diff --git a/build.gradle b/build.gradle index b75c080270f..e7216affefa 100644 --- a/build.gradle +++ b/build.gradle @@ -64,8 +64,8 @@ configurations { allprojects { group = 'org.jetbrains.lets-plot' - version = "2.0.6-alpha1" - project.ext.js_artifact_version = "2.0.6.dev1" + version = "2.1.0-rc1" + project.ext.js_artifact_version = "2.1.0rc1" // see also: python-package/lets_plot/_version.py repositories { diff --git a/js-package/distr/lets-plot.js b/js-package/distr/lets-plot.js index 38094ccde5c..3dfcfc9d3f2 100644 --- a/js-package/distr/lets-plot.js +++ b/js-package/distr/lets-plot.js @@ -95,7 +95,7 @@ eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPAC \***************************************************/ /***/ (function(module, exports, __webpack_require__) { -eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) {\n if (true)\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(/*! kotlin */ \"./kotlin-dce-dev/kotlin.js\"), __webpack_require__(/*! kotlin-logging-jsLegacy */ \"./kotlin-dce-dev/kotlin-logging-jsLegacy.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n else {}\n}(this, function (_, Kotlin, $module$kotlin_logging_jsLegacy) {\n 'use strict';\n var toMutableList = Kotlin.kotlin.collections.toMutableList_4c7yge$;\n var last = Kotlin.kotlin.collections.last_2p1efm$;\n var get_lastIndex = Kotlin.kotlin.collections.get_lastIndex_55thoc$;\n var first = Kotlin.kotlin.collections.first_2p1efm$;\n var plus = Kotlin.kotlin.collections.plus_qloxvw$;\n var equals = Kotlin.equals;\n var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_287e2$;\n var getPropertyCallableRef = Kotlin.getPropertyCallableRef;\n var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$;\n var ArrayList_init_0 = Kotlin.kotlin.collections.ArrayList_init_ww73n8$;\n var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init_pdl1vj$;\n var JsMath = Math;\n var to = Kotlin.kotlin.to_ujzrz7$;\n var mapOf = Kotlin.kotlin.collections.mapOf_qfcya0$;\n var Kind_OBJECT = Kotlin.Kind.OBJECT;\n var Kind_CLASS = Kotlin.Kind.CLASS;\n var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init_pdl1vj$;\n var joinToString = Kotlin.kotlin.collections.joinToString_fmv235$;\n var until = Kotlin.kotlin.ranges.until_dqglrj$;\n var substring = Kotlin.kotlin.text.substring_fc3b62$;\n var padStart = Kotlin.kotlin.text.padStart_vrc1nu$;\n var Map = Kotlin.kotlin.collections.Map;\n var throwCCE = Kotlin.throwCCE;\n var Enum = Kotlin.kotlin.Enum;\n var throwISE = Kotlin.throwISE;\n var Regex_init = Kotlin.kotlin.text.Regex_init_61zpoe$;\n var IllegalArgumentException_init_0 = Kotlin.kotlin.IllegalArgumentException_init;\n var ensureNotNull = Kotlin.ensureNotNull;\n var hashCode = Kotlin.hashCode;\n var StringBuilder_init = Kotlin.kotlin.text.StringBuilder_init;\n var RuntimeException_init = Kotlin.kotlin.RuntimeException_init;\n var toInt = Kotlin.kotlin.text.toInt_pdl1vz$;\n var Comparable = Kotlin.kotlin.Comparable;\n var toString = Kotlin.toString;\n var L0 = Kotlin.Long.ZERO;\n var L1 = Kotlin.Long.ONE;\n var L1000 = Kotlin.Long.fromInt(1000);\n var L60 = Kotlin.Long.fromInt(60);\n var L24 = Kotlin.Long.fromInt(24);\n var L7 = Kotlin.Long.fromInt(7);\n var contains = Kotlin.kotlin.text.contains_li3zpu$;\n var NumberFormatException = Kotlin.kotlin.NumberFormatException;\n var Kind_INTERFACE = Kotlin.Kind.INTERFACE;\n var L_5 = Kotlin.Long.fromInt(-5);\n var L4 = Kotlin.Long.fromInt(4);\n var L3 = Kotlin.Long.fromInt(3);\n var L60000 = Kotlin.Long.fromInt(60000);\n var L3600000 = Kotlin.Long.fromInt(3600000);\n var L86400000 = Kotlin.Long.fromInt(86400000);\n var defineInlineFunction = Kotlin.defineInlineFunction;\n var wrapFunction = Kotlin.wrapFunction;\n var HashMap_init = Kotlin.kotlin.collections.HashMap_init_bwtc7$;\n var IllegalStateException_init_0 = Kotlin.kotlin.IllegalStateException_init;\n var unboxChar = Kotlin.unboxChar;\n var toChar = Kotlin.toChar;\n var emptyList = Kotlin.kotlin.collections.emptyList_287e2$;\n var HashSet_init = Kotlin.kotlin.collections.HashSet_init_mqih57$;\n var asList = Kotlin.kotlin.collections.asList_us0mfu$;\n var listOf = Kotlin.kotlin.collections.listOf_i5x0yv$;\n var copyToArray = Kotlin.kotlin.collections.copyToArray;\n var HashSet_init_0 = Kotlin.kotlin.collections.HashSet_init_287e2$;\n var NullPointerException_init = Kotlin.kotlin.NullPointerException_init;\n var IllegalArgumentException = Kotlin.kotlin.IllegalArgumentException;\n var NoSuchElementException_init = Kotlin.kotlin.NoSuchElementException_init;\n var isFinite = Kotlin.kotlin.isFinite_yrwdxr$;\n var IndexOutOfBoundsException = Kotlin.kotlin.IndexOutOfBoundsException;\n var toList = Kotlin.kotlin.collections.toList_7wnvza$;\n var count = Kotlin.kotlin.collections.count_7wnvza$;\n var Collection = Kotlin.kotlin.collections.Collection;\n var plus_0 = Kotlin.kotlin.collections.plus_q4559j$;\n var List = Kotlin.kotlin.collections.List;\n var last_0 = Kotlin.kotlin.collections.last_7wnvza$;\n var ArrayList_init_1 = Kotlin.kotlin.collections.ArrayList_init_mqih57$;\n var reverse = Kotlin.kotlin.collections.reverse_vvxzk3$;\n var Comparator = Kotlin.kotlin.Comparator;\n var sortWith = Kotlin.kotlin.collections.sortWith_iwcb0m$;\n var toList_0 = Kotlin.kotlin.collections.toList_us0mfu$;\n var reversed = Kotlin.kotlin.comparisons.reversed_2avth4$;\n var naturalOrder = Kotlin.kotlin.comparisons.naturalOrder_dahdeg$;\n var lastOrNull = Kotlin.kotlin.collections.lastOrNull_2p1efm$;\n var binarySearch = Kotlin.kotlin.collections.binarySearch_jhx6be$;\n var HashMap_init_0 = Kotlin.kotlin.collections.HashMap_init_q3lmfv$;\n var abs = Kotlin.kotlin.math.abs_za3lpa$;\n var Unit = Kotlin.kotlin.Unit;\n var getCallableRef = Kotlin.getCallableRef;\n var map = Kotlin.kotlin.sequences.map_z5avom$;\n var numberToInt = Kotlin.numberToInt;\n var toMutableMap = Kotlin.kotlin.collections.toMutableMap_abgq59$;\n var throwUPAE = Kotlin.throwUPAE;\n var kotlin_js_internal_BooleanCompanionObject = Kotlin.kotlin.js.internal.BooleanCompanionObject;\n var first_0 = Kotlin.kotlin.collections.first_7wnvza$;\n var asSequence = Kotlin.kotlin.collections.asSequence_7wnvza$;\n var drop = Kotlin.kotlin.sequences.drop_wuwhe2$;\n var isWhitespace = Kotlin.kotlin.text.isWhitespace_myv2d0$;\n var toBoxedChar = Kotlin.toBoxedChar;\n var contains_0 = Kotlin.kotlin.collections.contains_o2f9me$;\n var CharRange = Kotlin.kotlin.ranges.CharRange;\n var iterator = Kotlin.kotlin.text.iterator_gw00vp$;\n var toDouble = Kotlin.kotlin.text.toDouble_pdl1vz$;\n var Exception_init = Kotlin.kotlin.Exception_init_pdl1vj$;\n var Exception = Kotlin.kotlin.Exception;\n var LinkedHashMap_init = Kotlin.kotlin.collections.LinkedHashMap_init_q3lmfv$;\n var MutableMap = Kotlin.kotlin.collections.MutableMap;\n var toSet = Kotlin.kotlin.collections.toSet_7wnvza$;\n var StringBuilder = Kotlin.kotlin.text.StringBuilder;\n var toString_0 = Kotlin.kotlin.text.toString_dqglrj$;\n var toInt_0 = Kotlin.kotlin.text.toInt_6ic1pp$;\n var numberToDouble = Kotlin.numberToDouble;\n var equals_0 = Kotlin.kotlin.text.equals_igcy3c$;\n var NoSuchElementException_init_0 = Kotlin.kotlin.NoSuchElementException;\n var Any = Object;\n var AbstractMutableSet = Kotlin.kotlin.collections.AbstractMutableSet;\n var AbstractCollection = Kotlin.kotlin.collections.AbstractCollection;\n var AbstractSet = Kotlin.kotlin.collections.AbstractSet;\n var MutableIterator = Kotlin.kotlin.collections.MutableIterator;\n var Array_0 = Array;\n var println = Kotlin.kotlin.io.println_s8jyv4$;\n var math = Kotlin.kotlin.math;\n var round = Kotlin.kotlin.math.round_14dthe$;\n var toLong = Kotlin.kotlin.text.toLong_pdl1vz$;\n var coerceAtLeast = Kotlin.kotlin.ranges.coerceAtLeast_dqglrj$;\n var toIntOrNull = Kotlin.kotlin.text.toIntOrNull_pdl1vz$;\n var repeat = Kotlin.kotlin.text.repeat_94bcnn$;\n var trimEnd = Kotlin.kotlin.text.trimEnd_wqw3xr$;\n var isNaN_0 = Kotlin.kotlin.isNaN_yrwdxr$;\n var kotlin_js_internal_DoubleCompanionObject = Kotlin.kotlin.js.internal.DoubleCompanionObject;\n var slice = Kotlin.kotlin.text.slice_fc3b62$;\n var startsWith = Kotlin.kotlin.text.startsWith_sgbm27$;\n var roundToLong = Kotlin.kotlin.math.roundToLong_yrwdxr$;\n var toString_1 = Kotlin.kotlin.text.toString_if0zpk$;\n var padEnd = Kotlin.kotlin.text.padEnd_vrc1nu$;\n var get_sign = Kotlin.kotlin.math.get_sign_s8ev3n$;\n var coerceAtLeast_0 = Kotlin.kotlin.ranges.coerceAtLeast_38ydlf$;\n var coerceAtMost = Kotlin.kotlin.ranges.coerceAtMost_38ydlf$;\n var asSequence_0 = Kotlin.kotlin.text.asSequence_gw00vp$;\n var plus_1 = Kotlin.kotlin.sequences.plus_v0iwhp$;\n var indexOf = Kotlin.kotlin.text.indexOf_l5u8uk$;\n var chunked = Kotlin.kotlin.sequences.chunked_wuwhe2$;\n var joinToString_0 = Kotlin.kotlin.sequences.joinToString_853xkz$;\n var reversed_0 = Kotlin.kotlin.text.reversed_gw00vp$;\n var MutableCollection = Kotlin.kotlin.collections.MutableCollection;\n var AbstractMutableList = Kotlin.kotlin.collections.AbstractMutableList;\n var MutableList = Kotlin.kotlin.collections.MutableList;\n var Throwable = Error;\n var plus_2 = Kotlin.kotlin.collections.plus_mydzjv$;\n var Random = Kotlin.kotlin.random.Random;\n var random = Kotlin.kotlin.collections.random_iscd7z$;\n var arrayListOf = Kotlin.kotlin.collections.arrayListOf_i5x0yv$;\n var minOrNull = Kotlin.kotlin.sequences.minOrNull_1bslqu$;\n var maxOrNull = Kotlin.kotlin.sequences.maxOrNull_1bslqu$;\n var flatten = Kotlin.kotlin.sequences.flatten_d9bjs1$;\n var first_1 = Kotlin.kotlin.sequences.first_veqyi0$;\n var Pair = Kotlin.kotlin.Pair;\n var sortedWith = Kotlin.kotlin.sequences.sortedWith_vjgqpk$;\n var filter = Kotlin.kotlin.sequences.filter_euau3h$;\n var toList_1 = Kotlin.kotlin.sequences.toList_veqyi0$;\n var listOf_0 = Kotlin.kotlin.collections.listOf_mh5how$;\n var single = Kotlin.kotlin.collections.single_2p1efm$;\n var replace = Kotlin.kotlin.text.replace_680rmw$;\n var StringBuilder_init_0 = Kotlin.kotlin.text.StringBuilder_init_za3lpa$;\n var toDoubleOrNull = Kotlin.kotlin.text.toDoubleOrNull_pdl1vz$;\n var AbstractList = Kotlin.kotlin.collections.AbstractList;\n var asIterable = Kotlin.kotlin.sequences.asIterable_veqyi0$;\n var Set = Kotlin.kotlin.collections.Set;\n var UnsupportedOperationException_init = Kotlin.kotlin.UnsupportedOperationException_init;\n var UnsupportedOperationException_init_0 = Kotlin.kotlin.UnsupportedOperationException_init_pdl1vj$;\n var startsWith_0 = Kotlin.kotlin.text.startsWith_7epoxm$;\n var roundToInt = Kotlin.kotlin.math.roundToInt_yrwdxr$;\n var indexOf_0 = Kotlin.kotlin.text.indexOf_8eortd$;\n var plus_3 = Kotlin.kotlin.collections.plus_iwxh38$;\n var replace_0 = Kotlin.kotlin.text.replace_r2fvfm$;\n var mapCapacity = Kotlin.kotlin.collections.mapCapacity_za3lpa$;\n var LinkedHashMap_init_0 = Kotlin.kotlin.collections.LinkedHashMap_init_bwtc7$;\n var mu = $module$kotlin_logging_jsLegacy.mu;\n Format$PatternSpecPart.prototype = Object.create(Format$SpecPart.prototype);\n Format$PatternSpecPart.prototype.constructor = Format$PatternSpecPart;\n Pattern$Companion$Kind.prototype = Object.create(Enum.prototype);\n Pattern$Companion$Kind.prototype.constructor = Pattern$Companion$Kind;\n Pattern.prototype = Object.create(Enum.prototype);\n Pattern.prototype.constructor = Pattern;\n Month$VarLengthMonth.prototype = Object.create(Month.prototype);\n Month$VarLengthMonth.prototype.constructor = Month$VarLengthMonth;\n WeekDay.prototype = Object.create(Enum.prototype);\n WeekDay.prototype.constructor = WeekDay;\n TimeZoneMoscow.prototype = Object.create(TimeZone.prototype);\n TimeZoneMoscow.prototype.constructor = TimeZoneMoscow;\n TimeZones$utc$ObjectLiteral.prototype = Object.create(TimeZone.prototype);\n TimeZones$utc$ObjectLiteral.prototype.constructor = TimeZones$utc$ObjectLiteral;\n TimeZones$offset$ObjectLiteral.prototype = Object.create(TimeZone.prototype);\n TimeZones$offset$ObjectLiteral.prototype.constructor = TimeZones$offset$ObjectLiteral;\n TimeZones$DSTimeZone.prototype = Object.create(TimeZone.prototype);\n TimeZones$DSTimeZone.prototype.constructor = TimeZones$DSTimeZone;\n TimeZones$withEuSummerTime$ObjectLiteral.prototype = Object.create(TimeZones$DSTimeZone.prototype);\n TimeZones$withEuSummerTime$ObjectLiteral.prototype.constructor = TimeZones$withEuSummerTime$ObjectLiteral;\n TimeZones$withUsSummerTime$ObjectLiteral.prototype = Object.create(TimeZones$DSTimeZone.prototype);\n TimeZones$withUsSummerTime$ObjectLiteral.prototype.constructor = TimeZones$withUsSummerTime$ObjectLiteral;\n Button.prototype = Object.create(Enum.prototype);\n Button.prototype.constructor = Button;\n Key.prototype = Object.create(Enum.prototype);\n Key.prototype.constructor = Key;\n KeyEvent.prototype = Object.create(Event.prototype);\n KeyEvent.prototype.constructor = KeyEvent;\n ModifierKey.prototype = Object.create(Enum.prototype);\n ModifierKey.prototype.constructor = ModifierKey;\n PointEvent.prototype = Object.create(Event.prototype);\n PointEvent.prototype.constructor = PointEvent;\n MouseEvent.prototype = Object.create(PointEvent.prototype);\n MouseEvent.prototype.constructor = MouseEvent;\n MouseEventSpec.prototype = Object.create(Enum.prototype);\n MouseEventSpec.prototype.constructor = MouseEventSpec;\n ComparatorOrdering.prototype = Object.create(Ordering.prototype);\n ComparatorOrdering.prototype.constructor = ComparatorOrdering;\n FluentArray.prototype = Object.create(FluentValue.prototype);\n FluentArray.prototype.constructor = FluentArray;\n FluentObject.prototype = Object.create(FluentValue.prototype);\n FluentObject.prototype.constructor = FluentObject;\n FluentPrimitive.prototype = Object.create(FluentValue.prototype);\n FluentPrimitive.prototype.constructor = FluentPrimitive;\n JsonParser$JsonException.prototype = Object.create(Exception.prototype);\n JsonParser$JsonException.prototype.constructor = JsonParser$JsonException;\n Token.prototype = Object.create(Enum.prototype);\n Token.prototype.constructor = Token;\n ListMap$keySet$ObjectLiteral.prototype = Object.create(AbstractMutableSet.prototype);\n ListMap$keySet$ObjectLiteral.prototype.constructor = ListMap$keySet$ObjectLiteral;\n ListMap$values$ObjectLiteral.prototype = Object.create(AbstractCollection.prototype);\n ListMap$values$ObjectLiteral.prototype.constructor = ListMap$values$ObjectLiteral;\n ListMap$entrySet$ObjectLiteral.prototype = Object.create(AbstractSet.prototype);\n ListMap$entrySet$ObjectLiteral.prototype.constructor = ListMap$entrySet$ObjectLiteral;\n ChildList_init$ObjectLiteral.prototype = Object.create(CollectionAdapter.prototype);\n ChildList_init$ObjectLiteral.prototype.constructor = ChildList_init$ObjectLiteral;\n AbstractObservableList.prototype = Object.create(AbstractMutableList.prototype);\n AbstractObservableList.prototype.constructor = AbstractObservableList;\n ObservableArrayList.prototype = Object.create(AbstractObservableList.prototype);\n ObservableArrayList.prototype.constructor = ObservableArrayList;\n ChildList.prototype = Object.create(ObservableArrayList.prototype);\n ChildList.prototype.constructor = ChildList;\n ValueProperty.prototype = Object.create(BaseReadableProperty.prototype);\n ValueProperty.prototype.constructor = ValueProperty;\n ChildProperty.prototype = Object.create(ValueProperty.prototype);\n ChildProperty.prototype.constructor = ChildProperty;\n CollectionItemEvent$EventType.prototype = Object.create(Enum.prototype);\n CollectionItemEvent$EventType.prototype.constructor = CollectionItemEvent$EventType;\n AbstractObservableList$addListener$ObjectLiteral.prototype = Object.create(Listeners.prototype);\n AbstractObservableList$addListener$ObjectLiteral.prototype.constructor = AbstractObservableList$addListener$ObjectLiteral;\n CompositeEventSource$addHandler$ObjectLiteral.prototype = Object.create(Listeners.prototype);\n CompositeEventSource$addHandler$ObjectLiteral.prototype.constructor = CompositeEventSource$addHandler$ObjectLiteral;\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral.prototype = Object.create(CollectionAdapter.prototype);\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral.prototype.constructor = EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral;\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0.prototype = Object.create(Registration.prototype);\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0.prototype.constructor = EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0;\n Listeners$add$ObjectLiteral.prototype = Object.create(Registration.prototype);\n Listeners$add$ObjectLiteral.prototype.constructor = Listeners$add$ObjectLiteral;\n DelayedValueProperty$addHandler$ObjectLiteral.prototype = Object.create(Listeners.prototype);\n DelayedValueProperty$addHandler$ObjectLiteral.prototype.constructor = DelayedValueProperty$addHandler$ObjectLiteral;\n DelayedValueProperty.prototype = Object.create(BaseReadableProperty.prototype);\n DelayedValueProperty.prototype.constructor = DelayedValueProperty;\n ValueProperty$addHandler$ObjectLiteral.prototype = Object.create(Listeners.prototype);\n ValueProperty$addHandler$ObjectLiteral.prototype.constructor = ValueProperty$addHandler$ObjectLiteral;\n CompositeRegistration.prototype = Object.create(Registration.prototype);\n CompositeRegistration.prototype.constructor = CompositeRegistration;\n Registration$EmptyRegistration.prototype = Object.create(Registration.prototype);\n Registration$EmptyRegistration.prototype.constructor = Registration$EmptyRegistration;\n Registration$Companion$from$ObjectLiteral.prototype = Object.create(Registration.prototype);\n Registration$Companion$from$ObjectLiteral.prototype.constructor = Registration$Companion$from$ObjectLiteral;\n Registration$Companion$from$ObjectLiteral_0.prototype = Object.create(Registration.prototype);\n Registration$Companion$from$ObjectLiteral_0.prototype.constructor = Registration$Companion$from$ObjectLiteral_0;\n SimpleFeature$GeometryType.prototype = Object.create(Enum.prototype);\n SimpleFeature$GeometryType.prototype.constructor = SimpleFeature$GeometryType;\n StringFormat$FormatType.prototype = Object.create(Enum.prototype);\n StringFormat$FormatType.prototype.constructor = StringFormat$FormatType;\n AbstractGeometryList.prototype = Object.create(AbstractList.prototype);\n AbstractGeometryList.prototype.constructor = AbstractGeometryList;\n GeometryType.prototype = Object.create(Enum.prototype);\n GeometryType.prototype.constructor = GeometryType;\n LineString.prototype = Object.create(AbstractGeometryList.prototype);\n LineString.prototype.constructor = LineString;\n MultiLineString.prototype = Object.create(AbstractGeometryList.prototype);\n MultiLineString.prototype.constructor = MultiLineString;\n MultiPoint.prototype = Object.create(AbstractGeometryList.prototype);\n MultiPoint.prototype.constructor = MultiPoint;\n MultiPolygon.prototype = Object.create(AbstractGeometryList.prototype);\n MultiPolygon.prototype.constructor = MultiPolygon;\n Polygon.prototype = Object.create(AbstractGeometryList.prototype);\n Polygon.prototype.constructor = Polygon;\n Ring.prototype = Object.create(AbstractGeometryList.prototype);\n Ring.prototype.constructor = Ring;\n function splitRings(points) {\n var $receiver = findRingIntervals(points);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(sublist(points, item));\n }\n var rings = toMutableList(destination);\n if (!rings.isEmpty()) {\n if (!isClosed(last(rings))) {\n rings.set_wxm5ur$(get_lastIndex(rings), makeClosed(last(rings)));\n }}return rings;\n }\n function makeClosed(path) {\n return plus(toMutableList(path), first(path));\n }\n function isClosed($receiver) {\n return equals(first($receiver), last($receiver));\n }\n function findRingIntervals(path) {\n var intervals = ArrayList_init();\n var startIndex = 0;\n var i = 0;\n var n = path.size;\n while (i < n) {\n if (startIndex !== i && equals(path.get_za3lpa$(startIndex), path.get_za3lpa$(i))) {\n intervals.add_11rb$(new ClosedRange(startIndex, i + 1 | 0));\n startIndex = i + 1 | 0;\n }i = i + 1 | 0;\n }\n if (startIndex !== path.size) {\n intervals.add_11rb$(new ClosedRange(startIndex, path.size));\n }return intervals;\n }\n function sublist($receiver, range) {\n return $receiver.subList_vux9f0$(range.lowerEnd, range.upperEnd);\n }\n function calculateArea(ring) {\n return calculateArea_0(ring, getPropertyCallableRef('x', 1, function ($receiver) {\n return $receiver.x;\n }), getPropertyCallableRef('y', 1, function ($receiver) {\n return $receiver.y;\n }));\n }\n function isClockwise(ring, x, y) {\n var tmp$;\n if (!!ring.isEmpty()) {\n var message = \"Ring shouldn't be empty to calculate clockwise\";\n throw IllegalStateException_init(message.toString());\n }var sum = 0.0;\n var prev = ring.get_za3lpa$(ring.size - 1 | 0);\n tmp$ = ring.iterator();\n while (tmp$.hasNext()) {\n var point = tmp$.next();\n sum += x(prev) * y(point) - x(point) * y(prev);\n prev = point;\n }\n return sum < 0.0;\n }\n function calculateArea_0(ring, x, y) {\n var area = 0.0;\n var j = ring.size - 1 | 0;\n for (var i = 0; i !== ring.size; ++i) {\n var p1 = ring.get_za3lpa$(i);\n var p2 = ring.get_za3lpa$(j);\n area += (x(p2) + x(p1)) * (y(p2) - y(p1));\n j = i;\n }\n var x_0 = area / 2;\n return JsMath.abs(x_0);\n }\n function DateLocale() {\n DateLocale_instance = this;\n this.weekDayAbbr = mapOf([to(WeekDay$MONDAY_getInstance(), 'Mon'), to(WeekDay$TUESDAY_getInstance(), 'Tue'), to(WeekDay$WEDNESDAY_getInstance(), 'Wed'), to(WeekDay$THURSDAY_getInstance(), 'Thu'), to(WeekDay$FRIDAY_getInstance(), 'Fri'), to(WeekDay$SATURDAY_getInstance(), 'Sat'), to(WeekDay$SUNDAY_getInstance(), 'Sun')]);\n this.weekDayFull = mapOf([to(WeekDay$MONDAY_getInstance(), 'Monday'), to(WeekDay$TUESDAY_getInstance(), 'Tuesday'), to(WeekDay$WEDNESDAY_getInstance(), 'Wednesday'), to(WeekDay$THURSDAY_getInstance(), 'Thursday'), to(WeekDay$FRIDAY_getInstance(), 'Friday'), to(WeekDay$SATURDAY_getInstance(), 'Saturday'), to(WeekDay$SUNDAY_getInstance(), 'Sunday')]);\n this.monthAbbr = mapOf([to(Month$Companion_getInstance().JANUARY, 'Jan'), to(Month$Companion_getInstance().FEBRUARY, 'Feb'), to(Month$Companion_getInstance().MARCH, 'Mar'), to(Month$Companion_getInstance().APRIL, 'Apr'), to(Month$Companion_getInstance().MAY, 'May'), to(Month$Companion_getInstance().JUNE, 'Jun'), to(Month$Companion_getInstance().JULY, 'Jul'), to(Month$Companion_getInstance().AUGUST, 'Aug'), to(Month$Companion_getInstance().SEPTEMBER, 'Sep'), to(Month$Companion_getInstance().OCTOBER, 'Oct'), to(Month$Companion_getInstance().NOVEMBER, 'Nov'), to(Month$Companion_getInstance().DECEMBER, 'Dec')]);\n this.monthFull = mapOf([to(Month$Companion_getInstance().JANUARY, 'January'), to(Month$Companion_getInstance().FEBRUARY, 'February'), to(Month$Companion_getInstance().MARCH, 'March'), to(Month$Companion_getInstance().APRIL, 'April'), to(Month$Companion_getInstance().MAY, 'May'), to(Month$Companion_getInstance().JUNE, 'June'), to(Month$Companion_getInstance().JULY, 'July'), to(Month$Companion_getInstance().AUGUST, 'August'), to(Month$Companion_getInstance().SEPTEMBER, 'September'), to(Month$Companion_getInstance().OCTOBER, 'October'), to(Month$Companion_getInstance().NOVEMBER, 'November'), to(Month$Companion_getInstance().DECEMBER, 'December')]);\n }\n DateLocale.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DateLocale',\n interfaces: []\n };\n var DateLocale_instance = null;\n function DateLocale_getInstance() {\n if (DateLocale_instance === null) {\n new DateLocale();\n }return DateLocale_instance;\n }\n function Format(spec) {\n Format$Companion_getInstance();\n this.spec_0 = spec;\n }\n function Format$SpecPart(str) {\n this.str = str;\n }\n Format$SpecPart.prototype.exec_amwj4p$ = function (dateTime) {\n return this.str;\n };\n Format$SpecPart.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SpecPart',\n interfaces: []\n };\n function Format$PatternSpecPart(str) {\n Format$SpecPart.call(this, str);\n var tmp$;\n tmp$ = Pattern$Companion_getInstance().patternByString_61zpoe$(str);\n if (tmp$ == null) {\n throw IllegalArgumentException_init('Wrong pattern: ' + str);\n }this.pattern = tmp$;\n }\n Format$PatternSpecPart.prototype.exec_amwj4p$ = function (dateTime) {\n return Format$Companion_getInstance().getValueForPattern_0(this.pattern, dateTime);\n };\n Format$PatternSpecPart.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PatternSpecPart',\n interfaces: [Format$SpecPart]\n };\n function Format$apply$lambda(closure$dateTime) {\n return function (it) {\n return it.exec_amwj4p$(closure$dateTime);\n };\n }\n Format.prototype.apply_amwj4p$ = function (dateTime) {\n return joinToString(this.spec_0, '', void 0, void 0, void 0, void 0, Format$apply$lambda(dateTime));\n };\n function Format$apply$lambda_0(closure$date) {\n return function (it) {\n return it.exec_amwj4p$(new DateTime(closure$date));\n };\n }\n Format.prototype.apply_z9gqti$ = function (date) {\n var $receiver = this.spec_0;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var predicate$result;\n if (Kotlin.isType(element, Format$PatternSpecPart) && element.pattern.kind === Pattern$Companion$Kind$DATE_getInstance()) {\n predicate$result = true;\n } else if (!Kotlin.isType(element, Format$PatternSpecPart)) {\n predicate$result = true;\n } else {\n predicate$result = false;\n }\n if (predicate$result)\n destination.add_11rb$(element);\n }\n return joinToString(destination, '', void 0, void 0, void 0, void 0, Format$apply$lambda_0(date));\n };\n function Format$apply$lambda_1(closure$time) {\n return function (it) {\n return it.exec_amwj4p$(new DateTime(Date$Companion_getInstance().EPOCH, closure$time));\n };\n }\n Format.prototype.apply_z96d9j$ = function (time) {\n var $receiver = this.spec_0;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var predicate$result;\n if (Kotlin.isType(element, Format$PatternSpecPart) && element.pattern.kind === Pattern$Companion$Kind$TIME_getInstance()) {\n predicate$result = true;\n } else if (!Kotlin.isType(element, Format$PatternSpecPart)) {\n predicate$result = true;\n } else {\n predicate$result = false;\n }\n if (predicate$result)\n destination.add_11rb$(element);\n }\n return joinToString(destination, '', void 0, void 0, void 0, void 0, Format$apply$lambda_1(time));\n };\n function Format$Companion() {\n Format$Companion_instance = this;\n }\n Format$Companion.prototype.parse_61zpoe$ = function (str) {\n var result = ArrayList_init();\n var resultSequence = Pattern$Companion_getInstance().PATTERN_REGEX.findAll_905azu$(str);\n var lastIndex = {v: 0};\n var tmp$;\n tmp$ = resultSequence.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var value = element.value;\n var range = element.range;\n var startIndex = range.first;\n var endIndex = range.last;\n if (startIndex > 0) {\n var spec = new Format$SpecPart(substring(str, until(lastIndex.v, startIndex)));\n result.add_11rb$(spec);\n }result.add_11rb$(new Format$PatternSpecPart(value));\n lastIndex.v = endIndex + 1 | 0;\n }\n if (lastIndex.v < str.length) {\n var startIndex_0 = lastIndex.v;\n result.add_11rb$(new Format$SpecPart(str.substring(startIndex_0)));\n }return result;\n };\n Format$Companion.prototype.getValueForPattern_0 = function (type, dateTime) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n switch (type.name) {\n case 'SECOND':\n return this.leadZero_0(dateTime.seconds);\n case 'MINUTE':\n return this.leadZero_0(dateTime.minutes);\n case 'HOUR_12':\n return this.getHours12_0(dateTime).toString();\n case 'HOUR_12_LEADING_ZERO':\n return this.leadZero_0(this.getHours12_0(dateTime));\n case 'HOUR_24':\n return this.leadZero_0(this.getHours24_0(dateTime));\n case 'MERIDIAN_LOWER':\n return this.getMeridian_0(dateTime);\n case 'MERIDIAN_UPPER':\n return this.getMeridian_0(dateTime).toUpperCase();\n case 'DAY_OF_WEEK':\n return this.getWeekDayNumber_0(dateTime);\n case 'DAY_OF_WEEK_ABBR':\n return (tmp$ = DateLocale_getInstance().weekDayAbbr.get_11rb$(dateTime.weekDay)) != null ? tmp$ : '';\n case 'DAY_OF_WEEK_FULL':\n return (tmp$_0 = DateLocale_getInstance().weekDayFull.get_11rb$(dateTime.weekDay)) != null ? tmp$_0 : '';\n case 'DAY_OF_MONTH':\n return dateTime.day.toString();\n case 'DAY_OF_MONTH_LEADING_ZERO':\n return this.leadZero_0(dateTime.day);\n case 'DAY_OF_THE_YEAR':\n return this.leadZero_0(dateTime.date.daysFromYearStart(), 3);\n case 'MONTH':\n return this.leadZero_0(((tmp$_2 = (tmp$_1 = dateTime.month) != null ? tmp$_1.ordinal() : null) != null ? tmp$_2 : 0) + 1 | 0);\n case 'MONTH_ABBR':\n var $receiver = DateLocale_getInstance().monthAbbr;\n var key = dateTime.month;\n var tmp$_5;\n return (tmp$_3 = (Kotlin.isType(tmp$_5 = $receiver, Map) ? tmp$_5 : throwCCE()).get_11rb$(key)) != null ? tmp$_3 : '';\n case 'MONTH_FULL':\n var $receiver_0 = DateLocale_getInstance().monthFull;\n var key_0 = dateTime.month;\n var tmp$_6;\n return (tmp$_4 = (Kotlin.isType(tmp$_6 = $receiver_0, Map) ? tmp$_6 : throwCCE()).get_11rb$(key_0)) != null ? tmp$_4 : '';\n case 'YEAR_SHORT':\n return dateTime.year.toString().substring(2);\n case 'YEAR_FULL':\n return dateTime.year.toString();\n default:return Kotlin.noWhenBranchMatched();\n }\n };\n Format$Companion.prototype.leadZero_0 = function (value, length) {\n if (length === void 0)\n length = 2;\n return padStart(value.toString(), length, 48);\n };\n Format$Companion.prototype.getHours12_0 = function (dateTime) {\n var tmp$;\n var hours = dateTime.hours;\n if (hours === 0)\n tmp$ = 12;\n else if (hours <= 12)\n tmp$ = hours;\n else\n tmp$ = hours - 12 | 0;\n return tmp$;\n };\n Format$Companion.prototype.getHours24_0 = function (dateTime) {\n if (dateTime.hours === 0)\n return 24;\n else\n return dateTime.hours;\n };\n Format$Companion.prototype.getMeridian_0 = function (dateTime) {\n var tmp$;\n var hours = dateTime.hours;\n if (hours === 24)\n tmp$ = 'am';\n else if (hours <= 12)\n tmp$ = 'am';\n else\n tmp$ = 'pm';\n return tmp$;\n };\n Format$Companion.prototype.getWeekDayNumber_0 = function (dateTime) {\n var num = dateTime.weekDay.ordinal + 1 | 0;\n if (num === 7) {\n num = 0;\n }return num.toString();\n };\n Format$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Format$Companion_instance = null;\n function Format$Companion_getInstance() {\n if (Format$Companion_instance === null) {\n new Format$Companion();\n }return Format$Companion_instance;\n }\n Format.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Format',\n interfaces: []\n };\n function Format_init(spec, $this) {\n $this = $this || Object.create(Format.prototype);\n Format.call($this, Format$Companion_getInstance().parse_61zpoe$(spec));\n return $this;\n }\n function Pattern(name, ordinal, string, kind) {\n Enum.call(this);\n this.string = string;\n this.kind = kind;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Pattern_initFields() {\n Pattern_initFields = function () {\n };\n Pattern$DAY_OF_WEEK_ABBR_instance = new Pattern('DAY_OF_WEEK_ABBR', 0, '%a', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$DAY_OF_WEEK_FULL_instance = new Pattern('DAY_OF_WEEK_FULL', 1, '%A', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$MONTH_ABBR_instance = new Pattern('MONTH_ABBR', 2, '%b', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$MONTH_FULL_instance = new Pattern('MONTH_FULL', 3, '%B', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$DAY_OF_MONTH_LEADING_ZERO_instance = new Pattern('DAY_OF_MONTH_LEADING_ZERO', 4, '%d', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$DAY_OF_MONTH_instance = new Pattern('DAY_OF_MONTH', 5, '%e', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$DAY_OF_THE_YEAR_instance = new Pattern('DAY_OF_THE_YEAR', 6, '%j', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$MONTH_instance = new Pattern('MONTH', 7, '%m', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$DAY_OF_WEEK_instance = new Pattern('DAY_OF_WEEK', 8, '%w', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$YEAR_SHORT_instance = new Pattern('YEAR_SHORT', 9, '%y', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$YEAR_FULL_instance = new Pattern('YEAR_FULL', 10, '%Y', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$HOUR_24_instance = new Pattern('HOUR_24', 11, '%H', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$HOUR_12_LEADING_ZERO_instance = new Pattern('HOUR_12_LEADING_ZERO', 12, '%I', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$HOUR_12_instance = new Pattern('HOUR_12', 13, '%l', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$MINUTE_instance = new Pattern('MINUTE', 14, '%M', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$MERIDIAN_LOWER_instance = new Pattern('MERIDIAN_LOWER', 15, '%P', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$MERIDIAN_UPPER_instance = new Pattern('MERIDIAN_UPPER', 16, '%p', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$SECOND_instance = new Pattern('SECOND', 17, '%S', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$Companion_getInstance();\n }\n var Pattern$DAY_OF_WEEK_ABBR_instance;\n function Pattern$DAY_OF_WEEK_ABBR_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_WEEK_ABBR_instance;\n }\n var Pattern$DAY_OF_WEEK_FULL_instance;\n function Pattern$DAY_OF_WEEK_FULL_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_WEEK_FULL_instance;\n }\n var Pattern$MONTH_ABBR_instance;\n function Pattern$MONTH_ABBR_getInstance() {\n Pattern_initFields();\n return Pattern$MONTH_ABBR_instance;\n }\n var Pattern$MONTH_FULL_instance;\n function Pattern$MONTH_FULL_getInstance() {\n Pattern_initFields();\n return Pattern$MONTH_FULL_instance;\n }\n var Pattern$DAY_OF_MONTH_LEADING_ZERO_instance;\n function Pattern$DAY_OF_MONTH_LEADING_ZERO_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_MONTH_LEADING_ZERO_instance;\n }\n var Pattern$DAY_OF_MONTH_instance;\n function Pattern$DAY_OF_MONTH_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_MONTH_instance;\n }\n var Pattern$DAY_OF_THE_YEAR_instance;\n function Pattern$DAY_OF_THE_YEAR_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_THE_YEAR_instance;\n }\n var Pattern$MONTH_instance;\n function Pattern$MONTH_getInstance() {\n Pattern_initFields();\n return Pattern$MONTH_instance;\n }\n var Pattern$DAY_OF_WEEK_instance;\n function Pattern$DAY_OF_WEEK_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_WEEK_instance;\n }\n var Pattern$YEAR_SHORT_instance;\n function Pattern$YEAR_SHORT_getInstance() {\n Pattern_initFields();\n return Pattern$YEAR_SHORT_instance;\n }\n var Pattern$YEAR_FULL_instance;\n function Pattern$YEAR_FULL_getInstance() {\n Pattern_initFields();\n return Pattern$YEAR_FULL_instance;\n }\n var Pattern$HOUR_24_instance;\n function Pattern$HOUR_24_getInstance() {\n Pattern_initFields();\n return Pattern$HOUR_24_instance;\n }\n var Pattern$HOUR_12_LEADING_ZERO_instance;\n function Pattern$HOUR_12_LEADING_ZERO_getInstance() {\n Pattern_initFields();\n return Pattern$HOUR_12_LEADING_ZERO_instance;\n }\n var Pattern$HOUR_12_instance;\n function Pattern$HOUR_12_getInstance() {\n Pattern_initFields();\n return Pattern$HOUR_12_instance;\n }\n var Pattern$MINUTE_instance;\n function Pattern$MINUTE_getInstance() {\n Pattern_initFields();\n return Pattern$MINUTE_instance;\n }\n var Pattern$MERIDIAN_LOWER_instance;\n function Pattern$MERIDIAN_LOWER_getInstance() {\n Pattern_initFields();\n return Pattern$MERIDIAN_LOWER_instance;\n }\n var Pattern$MERIDIAN_UPPER_instance;\n function Pattern$MERIDIAN_UPPER_getInstance() {\n Pattern_initFields();\n return Pattern$MERIDIAN_UPPER_instance;\n }\n var Pattern$SECOND_instance;\n function Pattern$SECOND_getInstance() {\n Pattern_initFields();\n return Pattern$SECOND_instance;\n }\n function Pattern$Companion() {\n Pattern$Companion_instance = this;\n this.PATTERN_REGEX = Regex_init('(%[aAbBdejmwyYHIlMpPS])');\n }\n function Pattern$Companion$Kind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Pattern$Companion$Kind_initFields() {\n Pattern$Companion$Kind_initFields = function () {\n };\n Pattern$Companion$Kind$DATE_instance = new Pattern$Companion$Kind('DATE', 0);\n Pattern$Companion$Kind$TIME_instance = new Pattern$Companion$Kind('TIME', 1);\n }\n var Pattern$Companion$Kind$DATE_instance;\n function Pattern$Companion$Kind$DATE_getInstance() {\n Pattern$Companion$Kind_initFields();\n return Pattern$Companion$Kind$DATE_instance;\n }\n var Pattern$Companion$Kind$TIME_instance;\n function Pattern$Companion$Kind$TIME_getInstance() {\n Pattern$Companion$Kind_initFields();\n return Pattern$Companion$Kind$TIME_instance;\n }\n Pattern$Companion$Kind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Kind',\n interfaces: [Enum]\n };\n function Pattern$Companion$Kind$values() {\n return [Pattern$Companion$Kind$DATE_getInstance(), Pattern$Companion$Kind$TIME_getInstance()];\n }\n Pattern$Companion$Kind.values = Pattern$Companion$Kind$values;\n function Pattern$Companion$Kind$valueOf(name) {\n switch (name) {\n case 'DATE':\n return Pattern$Companion$Kind$DATE_getInstance();\n case 'TIME':\n return Pattern$Companion$Kind$TIME_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.dateFormat.Pattern.Companion.Kind.' + name);\n }\n }\n Pattern$Companion$Kind.valueOf_61zpoe$ = Pattern$Companion$Kind$valueOf;\n Pattern$Companion.prototype.patternByString_61zpoe$ = function (patternString) {\n var $receiver = Pattern$values();\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$;\n for (tmp$ = 0; tmp$ !== $receiver.length; ++tmp$) {\n var element = $receiver[tmp$];\n if (equals(element.string, patternString)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n return firstOrNull$result;\n };\n Pattern$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Pattern$Companion_instance = null;\n function Pattern$Companion_getInstance() {\n Pattern_initFields();\n if (Pattern$Companion_instance === null) {\n new Pattern$Companion();\n }return Pattern$Companion_instance;\n }\n Pattern.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Pattern',\n interfaces: [Enum]\n };\n function Pattern$values() {\n return [Pattern$DAY_OF_WEEK_ABBR_getInstance(), Pattern$DAY_OF_WEEK_FULL_getInstance(), Pattern$MONTH_ABBR_getInstance(), Pattern$MONTH_FULL_getInstance(), Pattern$DAY_OF_MONTH_LEADING_ZERO_getInstance(), Pattern$DAY_OF_MONTH_getInstance(), Pattern$DAY_OF_THE_YEAR_getInstance(), Pattern$MONTH_getInstance(), Pattern$DAY_OF_WEEK_getInstance(), Pattern$YEAR_SHORT_getInstance(), Pattern$YEAR_FULL_getInstance(), Pattern$HOUR_24_getInstance(), Pattern$HOUR_12_LEADING_ZERO_getInstance(), Pattern$HOUR_12_getInstance(), Pattern$MINUTE_getInstance(), Pattern$MERIDIAN_LOWER_getInstance(), Pattern$MERIDIAN_UPPER_getInstance(), Pattern$SECOND_getInstance()];\n }\n Pattern.values = Pattern$values;\n function Pattern$valueOf(name) {\n switch (name) {\n case 'DAY_OF_WEEK_ABBR':\n return Pattern$DAY_OF_WEEK_ABBR_getInstance();\n case 'DAY_OF_WEEK_FULL':\n return Pattern$DAY_OF_WEEK_FULL_getInstance();\n case 'MONTH_ABBR':\n return Pattern$MONTH_ABBR_getInstance();\n case 'MONTH_FULL':\n return Pattern$MONTH_FULL_getInstance();\n case 'DAY_OF_MONTH_LEADING_ZERO':\n return Pattern$DAY_OF_MONTH_LEADING_ZERO_getInstance();\n case 'DAY_OF_MONTH':\n return Pattern$DAY_OF_MONTH_getInstance();\n case 'DAY_OF_THE_YEAR':\n return Pattern$DAY_OF_THE_YEAR_getInstance();\n case 'MONTH':\n return Pattern$MONTH_getInstance();\n case 'DAY_OF_WEEK':\n return Pattern$DAY_OF_WEEK_getInstance();\n case 'YEAR_SHORT':\n return Pattern$YEAR_SHORT_getInstance();\n case 'YEAR_FULL':\n return Pattern$YEAR_FULL_getInstance();\n case 'HOUR_24':\n return Pattern$HOUR_24_getInstance();\n case 'HOUR_12_LEADING_ZERO':\n return Pattern$HOUR_12_LEADING_ZERO_getInstance();\n case 'HOUR_12':\n return Pattern$HOUR_12_getInstance();\n case 'MINUTE':\n return Pattern$MINUTE_getInstance();\n case 'MERIDIAN_LOWER':\n return Pattern$MERIDIAN_LOWER_getInstance();\n case 'MERIDIAN_UPPER':\n return Pattern$MERIDIAN_UPPER_getInstance();\n case 'SECOND':\n return Pattern$SECOND_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.dateFormat.Pattern.' + name);\n }\n }\n Pattern.valueOf_61zpoe$ = Pattern$valueOf;\n function Date_0(day, month, year) {\n Date$Companion_getInstance();\n this.day = day;\n this.month = month;\n this.year = year;\n this.validate_0();\n }\n Object.defineProperty(Date_0.prototype, 'weekDay', {\n configurable: true,\n get: function () {\n var daysFromOrigin = this.daysFrom_z9gqti$(Date$Companion_getInstance().EPOCH);\n return WeekDay$values()[(daysFromOrigin + Date$Companion_getInstance().EPOCH_WEEKDAY_0.ordinal | 0) % WeekDay$values().length];\n }\n });\n Object.defineProperty(Date_0.prototype, 'dateStart', {\n configurable: true,\n get: function () {\n return new DateTime(this);\n }\n });\n Object.defineProperty(Date_0.prototype, 'dateEnd', {\n configurable: true,\n get: function () {\n return new DateTime(this, Time$Companion_getInstance().DAY_END);\n }\n });\n Date_0.prototype.validate_0 = function () {\n var tmp$;\n var daysInMonth = this.month.getDaysInYear_za3lpa$(this.year);\n tmp$ = this.day;\n var isValid = 1 <= tmp$ && tmp$ <= daysInMonth;\n if (!isValid) {\n throw IllegalArgumentException_init_0();\n }};\n Date_0.prototype.daysFrom_z9gqti$ = function (date) {\n if (this.compareTo_11rb$(date) < 0) {\n throw IllegalArgumentException_init_0();\n }var result = 0;\n if (this.year !== date.year) {\n var fromYear = date.year;\n var toYear = this.year;\n var leapYears = DateTimeUtil_getInstance().leapYearsBetween_6xvm5r$(fromYear, toYear);\n var years = toYear - fromYear | 0;\n result = result + (Kotlin.imul(leapYears, DateTimeUtil_getInstance().DAYS_IN_LEAP_YEAR_8be2vx$) + Kotlin.imul(years - leapYears | 0, DateTimeUtil_getInstance().DAYS_IN_YEAR_8be2vx$)) | 0;\n }return result + this.daysFromYearStart() - date.daysFromYearStart() | 0;\n };\n Date_0.prototype.daysFromYearStart = function () {\n var result = this.day;\n var current = this.month.prev();\n while (current != null) {\n result = result + current.getDaysInYear_za3lpa$(this.year) | 0;\n current = current.prev();\n }\n return result;\n };\n Date_0.prototype.addDays_za3lpa$ = function (days) {\n var days_0 = days;\n if (days_0 < 0) {\n throw IllegalArgumentException_init_0();\n }if (days_0 === 0)\n return this;\n var day = this.day;\n var month = this.month;\n var year = this.year;\n var lessThanYear = false;\n if (days_0 >= Date$Companion_getInstance().CACHE_DAYS_0 && year === Date$Companion_getInstance().EPOCH.year) {\n year = Date$Companion_getInstance().CACHE_STAMP_0.year;\n month = Date$Companion_getInstance().CACHE_STAMP_0.month;\n day = Date$Companion_getInstance().CACHE_STAMP_0.day;\n days_0 = days_0 - Date$Companion_getInstance().CACHE_DAYS_0 | 0;\n }while (days_0 > 0) {\n var daysToNextMonth = month.getDaysInYear_za3lpa$(year) - day + 1 | 0;\n if (days_0 < daysToNextMonth) {\n return new Date_0(day + days_0 | 0, month, year);\n } else {\n if (lessThanYear) {\n month = ensureNotNull(month.next());\n day = 1;\n days_0 = days_0 - daysToNextMonth | 0;\n } else {\n var daysToNextYear = Date$Companion_getInstance().lastDayOf_8fsw02$(year).daysFrom_z9gqti$(new Date_0(day, month, year)) + 1 | 0;\n if (days_0 >= daysToNextYear) {\n day = 1;\n month = Month$Companion_getInstance().JANUARY;\n year = year + 1 | 0;\n days_0 = days_0 - daysToNextYear | 0;\n } else {\n month = ensureNotNull(month.next());\n day = 1;\n days_0 = days_0 - daysToNextMonth | 0;\n lessThanYear = true;\n }\n }\n }\n }\n return new Date_0(day, month, year);\n };\n Date_0.prototype.nextDate = function () {\n return this.addDays_za3lpa$(1);\n };\n Date_0.prototype.prevDate = function () {\n return this.subtractDays_za3lpa$(1);\n };\n Date_0.prototype.subtractDays_za3lpa$ = function (days) {\n var tmp$;\n if (days < 0) {\n throw IllegalArgumentException_init_0();\n }if (days === 0)\n return this;\n if (days < this.day) {\n return new Date_0(this.day - days | 0, this.month, this.year);\n } else {\n var daysToPrevYear = this.daysFrom_z9gqti$(Date$Companion_getInstance().firstDayOf_8fsw02$(this.year));\n if (days > daysToPrevYear) {\n tmp$ = Date$Companion_getInstance().lastDayOf_8fsw02$(this.year - 1 | 0).subtractDays_za3lpa$(days - daysToPrevYear - 1 | 0);\n } else {\n tmp$ = Date$Companion_getInstance().lastDayOf_8fsw02$(this.year, ensureNotNull(this.month.prev())).subtractDays_za3lpa$(days - this.day | 0);\n }\n return tmp$;\n }\n };\n Date_0.prototype.compareTo_11rb$ = function (other) {\n if (this.year !== other.year)\n return this.year - other.year | 0;\n return this.month.ordinal() !== other.month.ordinal() ? this.month.ordinal() - other.month.ordinal() | 0 : this.day - other.day | 0;\n };\n Date_0.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, Date_0))\n return false;\n var date = (tmp$ = other) == null || Kotlin.isType(tmp$, Date_0) ? tmp$ : throwCCE();\n return ensureNotNull(date).year === this.year && date.month === this.month && date.day === this.day;\n };\n Date_0.prototype.hashCode = function () {\n return (this.year * 239 | 0) + (hashCode(this.month) * 31 | 0) + this.day | 0;\n };\n Date_0.prototype.toString = function () {\n var result = StringBuilder_init();\n result.append_s8jyv4$(this.year);\n this.appendMonth_0(result);\n this.appendDay_0(result);\n return result.toString();\n };\n Date_0.prototype.appendDay_0 = function (result) {\n if (this.day < 10) {\n result.append_pdl1vj$('0');\n }result.append_s8jyv4$(this.day);\n };\n Date_0.prototype.appendMonth_0 = function (result) {\n var month = this.month.ordinal() + 1 | 0;\n if (month < 10) {\n result.append_pdl1vj$('0');\n }result.append_s8jyv4$(month);\n };\n Date_0.prototype.toPrettyString = function () {\n var result = StringBuilder_init();\n this.appendDay_0(result);\n result.append_pdl1vj$('.');\n this.appendMonth_0(result);\n result.append_pdl1vj$('.');\n result.append_s8jyv4$(this.year);\n return result.toString();\n };\n function Date$Companion() {\n Date$Companion_instance = this;\n this.EPOCH = new Date_0(1, Month$Companion_getInstance().JANUARY, 1970);\n this.EPOCH_WEEKDAY_0 = WeekDay$THURSDAY_getInstance();\n this.CACHE_STAMP_0 = new Date_0(1, Month$Companion_getInstance().JANUARY, 2012);\n this.CACHE_DAYS_0 = this.CACHE_STAMP_0.daysFrom_z9gqti$(this.EPOCH);\n }\n Date$Companion.prototype.parse_61zpoe$ = function (str) {\n if (str.length !== 8) {\n throw RuntimeException_init();\n }var year = toInt(str.substring(0, 4));\n var month = toInt(str.substring(4, 6));\n var day = toInt(str.substring(6, 8));\n return new Date_0(day, Month$Companion_getInstance().values()[month - 1 | 0], year);\n };\n Date$Companion.prototype.firstDayOf_8fsw02$ = function (year, month) {\n if (month === void 0)\n month = Month$Companion_getInstance().JANUARY;\n return new Date_0(1, month, year);\n };\n Date$Companion.prototype.lastDayOf_8fsw02$ = function (year, month) {\n if (month === void 0)\n month = Month$Companion_getInstance().DECEMBER;\n return new Date_0(month.days, month, year);\n };\n Date$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Date$Companion_instance = null;\n function Date$Companion_getInstance() {\n if (Date$Companion_instance === null) {\n new Date$Companion();\n }return Date$Companion_instance;\n }\n Date_0.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Date',\n interfaces: [Comparable]\n };\n function DateTime(date, time) {\n DateTime$Companion_getInstance();\n if (time === void 0)\n time = Time$Companion_getInstance().DAY_START;\n this.date = date;\n this.time = time;\n }\n Object.defineProperty(DateTime.prototype, 'year', {\n configurable: true,\n get: function () {\n return this.date.year;\n }\n });\n Object.defineProperty(DateTime.prototype, 'month', {\n configurable: true,\n get: function () {\n return this.date.month;\n }\n });\n Object.defineProperty(DateTime.prototype, 'day', {\n configurable: true,\n get: function () {\n return this.date.day;\n }\n });\n Object.defineProperty(DateTime.prototype, 'weekDay', {\n configurable: true,\n get: function () {\n return this.date.weekDay;\n }\n });\n Object.defineProperty(DateTime.prototype, 'hours', {\n configurable: true,\n get: function () {\n return this.time.hours;\n }\n });\n Object.defineProperty(DateTime.prototype, 'minutes', {\n configurable: true,\n get: function () {\n return this.time.minutes;\n }\n });\n Object.defineProperty(DateTime.prototype, 'seconds', {\n configurable: true,\n get: function () {\n return this.time.seconds;\n }\n });\n Object.defineProperty(DateTime.prototype, 'milliseconds', {\n configurable: true,\n get: function () {\n return this.time.milliseconds;\n }\n });\n DateTime.prototype.changeDate_z9gqti$ = function (date) {\n return new DateTime(date, this.time);\n };\n DateTime.prototype.changeTime_z96d9j$ = function (time) {\n return new DateTime(this.date, time);\n };\n DateTime.prototype.add_27523k$ = function (duration) {\n var utcInstant = TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(this);\n return TimeZone$Companion_getInstance().UTC.toDateTime_x2y23v$(utcInstant.add_27523k$(duration));\n };\n DateTime.prototype.to_amwj4p$ = function (otherTime) {\n var currentInstant = TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(this);\n var otherInstant = TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(otherTime);\n return currentInstant.to_x2y23v$(otherInstant);\n };\n DateTime.prototype.isBefore_amwj4p$ = function (dateTime) {\n return this.compareTo_11rb$(dateTime) < 0;\n };\n DateTime.prototype.isAfter_amwj4p$ = function (dateTime) {\n return this.compareTo_11rb$(dateTime) > 0;\n };\n DateTime.prototype.hashCode = function () {\n return (this.date.hashCode() * 31 | 0) + this.time.hashCode() | 0;\n };\n DateTime.prototype.equals = function (other) {\n var tmp$, tmp$_0, tmp$_1;\n if (!Kotlin.isType(other, DateTime))\n return false;\n var otherDateTime = (tmp$ = other) == null || Kotlin.isType(tmp$, DateTime) ? tmp$ : throwCCE();\n return ((tmp$_0 = this.date) != null ? tmp$_0.equals(ensureNotNull(otherDateTime).date) : null) && ((tmp$_1 = this.time) != null ? tmp$_1.equals(otherDateTime.time) : null);\n };\n DateTime.prototype.compareTo_11rb$ = function (other) {\n var dateComparison = this.date.compareTo_11rb$(other.date);\n return dateComparison !== 0 ? dateComparison : this.time.compareTo_11rb$(other.time);\n };\n DateTime.prototype.toString = function () {\n return this.date.toString() + 'T' + toString(this.time);\n };\n DateTime.prototype.toPrettyString = function () {\n return this.time.toPrettyHMString() + ' ' + this.date.toPrettyString();\n };\n function DateTime$Companion() {\n DateTime$Companion_instance = this;\n }\n DateTime$Companion.prototype.parse_61zpoe$ = function (s) {\n if (s.length < 15) {\n throw IllegalArgumentException_init_0();\n }return new DateTime(Date$Companion_getInstance().parse_61zpoe$(s.substring(0, 8)), Time$Companion_getInstance().parse_61zpoe$(s.substring(9)));\n };\n DateTime$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DateTime$Companion_instance = null;\n function DateTime$Companion_getInstance() {\n if (DateTime$Companion_instance === null) {\n new DateTime$Companion();\n }return DateTime$Companion_instance;\n }\n DateTime.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DateTime',\n interfaces: [Comparable]\n };\n function DateTimeUtil() {\n DateTimeUtil_instance = this;\n this.BASE_YEAR = 1900;\n this.MAX_SUPPORTED_YEAR = 2100;\n this.MIN_SUPPORTED_YEAR_8be2vx$ = 1970;\n this.DAYS_IN_YEAR_8be2vx$ = 0;\n this.DAYS_IN_LEAP_YEAR_8be2vx$ = 0;\n this.LEAP_YEARS_FROM_1969_8be2vx$ = new Int32Array([477, 477, 477, 478, 478, 478, 478, 479, 479, 479, 479, 480, 480, 480, 480, 481, 481, 481, 481, 482, 482, 482, 482, 483, 483, 483, 483, 484, 484, 484, 484, 485, 485, 485, 485, 486, 486, 486, 486, 487, 487, 487, 487, 488, 488, 488, 488, 489, 489, 489, 489, 490, 490, 490, 490, 491, 491, 491, 491, 492, 492, 492, 492, 493, 493, 493, 493, 494, 494, 494, 494, 495, 495, 495, 495, 496, 496, 496, 496, 497, 497, 497, 497, 498, 498, 498, 498, 499, 499, 499, 499, 500, 500, 500, 500, 501, 501, 501, 501, 502, 502, 502, 502, 503, 503, 503, 503, 504, 504, 504, 504, 505, 505, 505, 505, 506, 506, 506, 506, 507, 507, 507, 507, 508, 508, 508, 508, 509, 509, 509, 509, 509]);\n var tmp$, tmp$_0;\n var leapYearDays = 0;\n var yearDays = 0;\n tmp$ = Month$Companion_getInstance().values();\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var m = tmp$[tmp$_0];\n leapYearDays = leapYearDays + m.getDaysInLeapYear() | 0;\n yearDays = yearDays + m.days | 0;\n }\n this.DAYS_IN_YEAR_8be2vx$ = yearDays;\n this.DAYS_IN_LEAP_YEAR_8be2vx$ = leapYearDays;\n }\n DateTimeUtil.prototype.isLeap_kcn2v3$ = function (year) {\n this.checkYear_0(year);\n return (this.LEAP_YEARS_FROM_1969_8be2vx$[year - 1970 + 1 | 0] - this.LEAP_YEARS_FROM_1969_8be2vx$[year - 1970 | 0] | 0) === 1;\n };\n DateTimeUtil.prototype.leapYearsBetween_6xvm5r$ = function (fromYear, toYear) {\n if (fromYear > toYear) {\n throw IllegalArgumentException_init_0();\n }this.checkYear_0(fromYear);\n this.checkYear_0(toYear);\n return this.LEAP_YEARS_FROM_1969_8be2vx$[toYear - 1970 | 0] - this.LEAP_YEARS_FROM_1969_8be2vx$[fromYear - 1970 | 0] | 0;\n };\n DateTimeUtil.prototype.leapYearsFromZero_0 = function (year) {\n return (year / 4 | 0) - (year / 100 | 0) + (year / 400 | 0) | 0;\n };\n DateTimeUtil.prototype.checkYear_0 = function (year) {\n if (year > 2100 || year < 1970) {\n throw IllegalArgumentException_init(year.toString() + '');\n }};\n DateTimeUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DateTimeUtil',\n interfaces: []\n };\n var DateTimeUtil_instance = null;\n function DateTimeUtil_getInstance() {\n if (DateTimeUtil_instance === null) {\n new DateTimeUtil();\n }return DateTimeUtil_instance;\n }\n function Duration(duration) {\n Duration$Companion_getInstance();\n this.duration = duration;\n }\n Object.defineProperty(Duration.prototype, 'isPositive', {\n configurable: true,\n get: function () {\n return this.duration.toNumber() > 0;\n }\n });\n Duration.prototype.mul_s8cxhz$ = function (times) {\n return new Duration(this.duration.multiply(times));\n };\n Duration.prototype.add_27523k$ = function (duration) {\n return new Duration(this.duration.add(duration.duration));\n };\n Duration.prototype.sub_27523k$ = function (duration) {\n return new Duration(this.duration.subtract(duration.duration));\n };\n Duration.prototype.div_27523k$ = function (duration) {\n return this.duration.toNumber() / duration.duration.toNumber();\n };\n Duration.prototype.compareTo_11rb$ = function (other) {\n var tmp$;\n var delta = this.duration.subtract(other.duration);\n if (delta.toNumber() > 0) {\n tmp$ = 1;\n } else if (equals(delta, L0)) {\n tmp$ = 0;\n } else {\n tmp$ = -1;\n }\n return tmp$;\n };\n Duration.prototype.hashCode = function () {\n return this.duration.toInt();\n };\n Duration.prototype.equals = function (other) {\n return !Kotlin.isType(other, Duration) ? false : equals(this.duration, other.duration);\n };\n Duration.prototype.toString = function () {\n return 'Duration : ' + toString(this.duration) + 'ms';\n };\n function Duration$Companion() {\n Duration$Companion_instance = this;\n this.MS = new Duration(L1);\n this.SECOND = this.MS.mul_s8cxhz$(L1000);\n this.MINUTE = this.SECOND.mul_s8cxhz$(L60);\n this.HOUR = this.MINUTE.mul_s8cxhz$(L60);\n this.DAY = this.HOUR.mul_s8cxhz$(L24);\n this.WEEK = this.DAY.mul_s8cxhz$(L7);\n }\n Duration$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Duration$Companion_instance = null;\n function Duration$Companion_getInstance() {\n if (Duration$Companion_instance === null) {\n new Duration$Companion();\n }return Duration$Companion_instance;\n }\n Duration.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Duration',\n interfaces: [Comparable]\n };\n function Instant(timeSinceEpoch) {\n this.timeSinceEpoch = timeSinceEpoch;\n }\n Instant.prototype.add_27523k$ = function (duration) {\n return new Instant(this.timeSinceEpoch.add(duration.duration));\n };\n Instant.prototype.sub_27523k$ = function (duration) {\n return new Instant(this.timeSinceEpoch.subtract(duration.duration));\n };\n Instant.prototype.to_x2y23v$ = function (instant) {\n return new Duration(instant.timeSinceEpoch.subtract(this.timeSinceEpoch));\n };\n Instant.prototype.compareTo_11rb$ = function (other) {\n var tmp$;\n var delta = this.timeSinceEpoch.subtract(other.timeSinceEpoch);\n if (delta.toNumber() > 0) {\n tmp$ = 1;\n } else if (equals(delta, L0)) {\n tmp$ = 0;\n } else {\n tmp$ = -1;\n }\n return tmp$;\n };\n Instant.prototype.hashCode = function () {\n return this.timeSinceEpoch.toInt();\n };\n Instant.prototype.toString = function () {\n return '' + toString(this.timeSinceEpoch);\n };\n Instant.prototype.equals = function (other) {\n return !Kotlin.isType(other, Instant) ? false : equals(this.timeSinceEpoch, other.timeSinceEpoch);\n };\n Instant.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Instant',\n interfaces: [Comparable]\n };\n function Month(days, myOrdinal, myName) {\n Month$Companion_getInstance();\n this.days = days;\n this.myOrdinal_hzcl1t$_0 = myOrdinal;\n this.myName_s01cg9$_0 = myName;\n }\n Month.prototype.ordinal = function () {\n return this.myOrdinal_hzcl1t$_0;\n };\n Month.prototype.getDaysInYear_za3lpa$ = function (year) {\n return this.days;\n };\n Month.prototype.getDaysInLeapYear = function () {\n return this.days;\n };\n Month.prototype.prev = function () {\n return this.myOrdinal_hzcl1t$_0 === 0 ? null : Month$Companion_getInstance().values()[this.myOrdinal_hzcl1t$_0 - 1 | 0];\n };\n Month.prototype.next = function () {\n var values = Month$Companion_getInstance().values();\n return this.myOrdinal_hzcl1t$_0 === (values.length - 1 | 0) ? null : values[this.myOrdinal_hzcl1t$_0 + 1 | 0];\n };\n Month.prototype.toString = function () {\n return this.myName_s01cg9$_0;\n };\n function Month$VarLengthMonth(days, myDaysInLeapYear, ordinal, name) {\n Month.call(this, days, ordinal, name);\n this.myDaysInLeapYear_0 = myDaysInLeapYear;\n }\n Month$VarLengthMonth.prototype.getDaysInLeapYear = function () {\n return this.myDaysInLeapYear_0;\n };\n Month$VarLengthMonth.prototype.getDaysInYear_za3lpa$ = function (year) {\n var tmp$;\n if (DateTimeUtil_getInstance().isLeap_kcn2v3$(year)) {\n tmp$ = this.getDaysInLeapYear();\n } else {\n tmp$ = this.days;\n }\n return tmp$;\n };\n Month$VarLengthMonth.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VarLengthMonth',\n interfaces: [Month]\n };\n function Month$Companion() {\n Month$Companion_instance = this;\n this.JANUARY = new Month(31, 0, 'January');\n this.FEBRUARY = new Month$VarLengthMonth(28, 29, 1, 'February');\n this.MARCH = new Month(31, 2, 'March');\n this.APRIL = new Month(30, 3, 'April');\n this.MAY = new Month(31, 4, 'May');\n this.JUNE = new Month(30, 5, 'June');\n this.JULY = new Month(31, 6, 'July');\n this.AUGUST = new Month(31, 7, 'August');\n this.SEPTEMBER = new Month(30, 8, 'September');\n this.OCTOBER = new Month(31, 9, 'October');\n this.NOVEMBER = new Month(30, 10, 'November');\n this.DECEMBER = new Month(31, 11, 'December');\n this.VALUES_0 = [this.JANUARY, this.FEBRUARY, this.MARCH, this.APRIL, this.MAY, this.JUNE, this.JULY, this.AUGUST, this.SEPTEMBER, this.OCTOBER, this.NOVEMBER, this.DECEMBER];\n }\n Month$Companion.prototype.values = function () {\n return this.VALUES_0;\n };\n Month$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Month$Companion_instance = null;\n function Month$Companion_getInstance() {\n if (Month$Companion_instance === null) {\n new Month$Companion();\n }return Month$Companion_instance;\n }\n Month.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Month',\n interfaces: []\n };\n function Time(hours, minutes, seconds, milliseconds) {\n Time$Companion_getInstance();\n if (seconds === void 0)\n seconds = 0;\n if (milliseconds === void 0)\n milliseconds = 0;\n this.hours = hours;\n this.minutes = minutes;\n this.seconds = seconds;\n this.milliseconds = milliseconds;\n if (this.hours < 0 || this.hours > 24) {\n throw IllegalArgumentException_init_0();\n }if (this.hours === 24 && (this.minutes !== 0 || this.seconds !== 0)) {\n throw IllegalArgumentException_init_0();\n }if (this.minutes < 0 || this.minutes >= 60) {\n throw IllegalArgumentException_init_0();\n }if (this.seconds < 0 || this.seconds >= 60) {\n throw IllegalArgumentException_init_0();\n }}\n Time.prototype.compareTo_11rb$ = function (other) {\n var delta = this.hours - other.hours | 0;\n if (delta !== 0)\n return delta;\n delta = this.minutes - other.minutes | 0;\n if (delta !== 0)\n return delta;\n delta = this.seconds - other.seconds | 0;\n return delta !== 0 ? delta : this.milliseconds - other.milliseconds | 0;\n };\n Time.prototype.hashCode = function () {\n return (this.hours * 239 | 0) + (this.minutes * 491 | 0) + (this.seconds * 41 | 0) + this.milliseconds | 0;\n };\n Time.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (!Kotlin.isType(other, Time))\n tmp$_0 = false;\n else {\n tmp$_0 = this.compareTo_11rb$(ensureNotNull((tmp$ = other) == null || Kotlin.isType(tmp$, Time) ? tmp$ : throwCCE())) === 0;\n }\n return tmp$_0;\n };\n Time.prototype.toString = function () {\n var result = StringBuilder_init();\n if (this.hours < 10)\n result.append_pdl1vj$('0');\n result.append_s8jyv4$(this.hours);\n if (this.minutes < 10)\n result.append_pdl1vj$('0');\n result.append_s8jyv4$(this.minutes);\n if (this.seconds < 10)\n result.append_pdl1vj$('0');\n result.append_s8jyv4$(this.seconds);\n return result.toString();\n };\n Time.prototype.toPrettyHMString = function () {\n var result = StringBuilder_init();\n if (this.hours < 10)\n result.append_pdl1vj$('0');\n result.append_s8jyv4$(this.hours).append_s8itvh$(Time$Companion_getInstance().DELIMITER_0);\n if (this.minutes < 10)\n result.append_pdl1vj$('0');\n result.append_s8jyv4$(this.minutes);\n return result.toString();\n };\n function Time$Companion() {\n Time$Companion_instance = this;\n this.DELIMITER_0 = 58;\n this.DAY_START = new Time(0, 0);\n this.DAY_END = new Time(24, 0);\n }\n Time$Companion.prototype.parse_61zpoe$ = function (s) {\n if (s.length < 6) {\n throw IllegalArgumentException_init_0();\n }var hours = toInt(s.substring(0, 2));\n var minutes = toInt(s.substring(2, 4));\n var seconds = toInt(s.substring(4, 6));\n return new Time(hours, minutes, seconds);\n };\n Time$Companion.prototype.fromPrettyHMString_61zpoe$ = function (time) {\n var $receiver = this.DELIMITER_0;\n if (!contains(time, String.fromCharCode($receiver) + '')) {\n throw IllegalArgumentException_init_0();\n }var length = time.length;\n if (length !== 5 && length !== 4) {\n throw IllegalArgumentException_init_0();\n }var hourLength = length === 4 ? 1 : 2;\n try {\n var tmp$ = toInt(time.substring(0, hourLength));\n var startIndex = hourLength + 1 | 0;\n return new Time(tmp$, toInt(time.substring(startIndex, length)), 0);\n } catch (ignored) {\n if (Kotlin.isType(ignored, NumberFormatException)) {\n throw IllegalArgumentException_init_0();\n } else\n throw ignored;\n }\n };\n Time$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Time$Companion_instance = null;\n function Time$Companion_getInstance() {\n if (Time$Companion_instance === null) {\n new Time$Companion();\n }return Time$Companion_instance;\n }\n Time.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Time',\n interfaces: [Comparable]\n };\n function WeekDay(name, ordinal, abbreviation, isWeekend) {\n Enum.call(this);\n this.abbreviation = abbreviation;\n this.isWeekend = isWeekend;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function WeekDay_initFields() {\n WeekDay_initFields = function () {\n };\n WeekDay$MONDAY_instance = new WeekDay('MONDAY', 0, 'MO', false);\n WeekDay$TUESDAY_instance = new WeekDay('TUESDAY', 1, 'TU', false);\n WeekDay$WEDNESDAY_instance = new WeekDay('WEDNESDAY', 2, 'WE', false);\n WeekDay$THURSDAY_instance = new WeekDay('THURSDAY', 3, 'TH', false);\n WeekDay$FRIDAY_instance = new WeekDay('FRIDAY', 4, 'FR', false);\n WeekDay$SATURDAY_instance = new WeekDay('SATURDAY', 5, 'SA', true);\n WeekDay$SUNDAY_instance = new WeekDay('SUNDAY', 6, 'SU', true);\n }\n var WeekDay$MONDAY_instance;\n function WeekDay$MONDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$MONDAY_instance;\n }\n var WeekDay$TUESDAY_instance;\n function WeekDay$TUESDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$TUESDAY_instance;\n }\n var WeekDay$WEDNESDAY_instance;\n function WeekDay$WEDNESDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$WEDNESDAY_instance;\n }\n var WeekDay$THURSDAY_instance;\n function WeekDay$THURSDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$THURSDAY_instance;\n }\n var WeekDay$FRIDAY_instance;\n function WeekDay$FRIDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$FRIDAY_instance;\n }\n var WeekDay$SATURDAY_instance;\n function WeekDay$SATURDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$SATURDAY_instance;\n }\n var WeekDay$SUNDAY_instance;\n function WeekDay$SUNDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$SUNDAY_instance;\n }\n WeekDay.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'WeekDay',\n interfaces: [Enum]\n };\n function WeekDay$values() {\n return [WeekDay$MONDAY_getInstance(), WeekDay$TUESDAY_getInstance(), WeekDay$WEDNESDAY_getInstance(), WeekDay$THURSDAY_getInstance(), WeekDay$FRIDAY_getInstance(), WeekDay$SATURDAY_getInstance(), WeekDay$SUNDAY_getInstance()];\n }\n WeekDay.values = WeekDay$values;\n function WeekDay$valueOf(name) {\n switch (name) {\n case 'MONDAY':\n return WeekDay$MONDAY_getInstance();\n case 'TUESDAY':\n return WeekDay$TUESDAY_getInstance();\n case 'WEDNESDAY':\n return WeekDay$WEDNESDAY_getInstance();\n case 'THURSDAY':\n return WeekDay$THURSDAY_getInstance();\n case 'FRIDAY':\n return WeekDay$FRIDAY_getInstance();\n case 'SATURDAY':\n return WeekDay$SATURDAY_getInstance();\n case 'SUNDAY':\n return WeekDay$SUNDAY_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.datetime.WeekDay.' + name);\n }\n }\n WeekDay.valueOf_61zpoe$ = WeekDay$valueOf;\n function DateSpec() {\n }\n DateSpec.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'DateSpec',\n interfaces: []\n };\n function DateSpecs() {\n DateSpecs_instance = this;\n }\n function DateSpecs$last$ObjectLiteral(closure$weekDay, closure$month) {\n this.closure$weekDay = closure$weekDay;\n this.closure$month = closure$month;\n }\n Object.defineProperty(DateSpecs$last$ObjectLiteral.prototype, 'rRule', {\n configurable: true,\n get: function () {\n return 'RRULE:FREQ=YEARLY;BYDAY=-1' + this.closure$weekDay.abbreviation + ';BYMONTH=' + toString(this.closure$month.ordinal() + 1 | 0);\n }\n });\n DateSpecs$last$ObjectLiteral.prototype.getDate_za3lpa$ = function (year) {\n var days = this.closure$month.getDaysInYear_za3lpa$(year);\n for (var d = days; d >= 1; d--) {\n var date = new Date_0(d, this.closure$month, year);\n if (date.weekDay === this.closure$weekDay)\n return date;\n }\n throw RuntimeException_init();\n };\n DateSpecs$last$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DateSpec]\n };\n DateSpecs.prototype.last_kvq57g$ = function (weekDay, month) {\n return new DateSpecs$last$ObjectLiteral(weekDay, month);\n };\n function DateSpecs$first$ObjectLiteral(closure$number, closure$weekDay, closure$month) {\n this.closure$number = closure$number;\n this.closure$weekDay = closure$weekDay;\n this.closure$month = closure$month;\n }\n Object.defineProperty(DateSpecs$first$ObjectLiteral.prototype, 'rRule', {\n configurable: true,\n get: function () {\n return 'RRULE:FREQ=YEARLY;BYDAY=' + toString(this.closure$number) + this.closure$weekDay.abbreviation + ';BYMONTH=' + toString(this.closure$month.ordinal() + 1 | 0);\n }\n });\n DateSpecs$first$ObjectLiteral.prototype.getDate_za3lpa$ = function (year) {\n var startDay = Kotlin.imul(this.closure$number - 1 | 0, WeekDay$values().length) + 1 | 0;\n var days = this.closure$month.getDaysInYear_za3lpa$(year);\n for (var d = startDay; d <= days; d++) {\n var date = new Date_0(d, this.closure$month, year);\n if (date.weekDay === this.closure$weekDay)\n return date;\n }\n throw RuntimeException_init();\n };\n DateSpecs$first$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DateSpec]\n };\n DateSpecs.prototype.first_t96ihi$ = function (weekDay, month, number) {\n if (number === void 0)\n number = 1;\n return new DateSpecs$first$ObjectLiteral(number, weekDay, month);\n };\n DateSpecs.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DateSpecs',\n interfaces: []\n };\n var DateSpecs_instance = null;\n function DateSpecs_getInstance() {\n if (DateSpecs_instance === null) {\n new DateSpecs();\n }return DateSpecs_instance;\n }\n function TimeZone(id) {\n TimeZone$Companion_getInstance();\n this.id = id;\n }\n TimeZone.prototype.convertTo_8hfrhi$ = function (toConvert, to) {\n return to === this ? toConvert : to.toDateTime_x2y23v$(this.toInstant_amwj4p$(toConvert));\n };\n TimeZone.prototype.convertTimeAtDay_aopdye$ = function (srcTime, dstDate, dstTimeZone) {\n var src = new DateTime(dstDate, srcTime);\n var dst = this.convertTo_8hfrhi$(src, dstTimeZone);\n var dayDiff = dstDate.compareTo_11rb$(dst.date);\n if (dayDiff !== 0) {\n var correctedDay = dayDiff > 0 ? dstDate.nextDate() : dstDate.prevDate();\n src = new DateTime(correctedDay, srcTime);\n dst = this.convertTo_8hfrhi$(src, dstTimeZone);\n }return dst.time;\n };\n TimeZone.prototype.getTimeZoneShift_x2y23v$ = function (instant) {\n var utcDateTime = this.toDateTime_x2y23v$(instant);\n return instant.to_x2y23v$(TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(utcDateTime));\n };\n TimeZone.prototype.toString = function () {\n return ensureNotNull(this.id);\n };\n function TimeZone$Companion() {\n TimeZone$Companion_instance = this;\n this.UTC = TimeZones_getInstance().utc();\n this.BERLIN = TimeZones_getInstance().withEuSummerTime_rwkwum$('Europe/Berlin', Duration$Companion_getInstance().HOUR.mul_s8cxhz$(L1));\n this.MOSCOW = new TimeZoneMoscow();\n this.NY = TimeZones_getInstance().withUsSummerTime_rwkwum$('America/New_York', Duration$Companion_getInstance().HOUR.mul_s8cxhz$(L_5));\n }\n TimeZone$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TimeZone$Companion_instance = null;\n function TimeZone$Companion_getInstance() {\n if (TimeZone$Companion_instance === null) {\n new TimeZone$Companion();\n }return TimeZone$Companion_instance;\n }\n TimeZone.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TimeZone',\n interfaces: []\n };\n function TimeZoneMoscow() {\n TimeZoneMoscow$Companion_getInstance();\n TimeZone.call(this, TimeZoneMoscow$Companion_getInstance().ID_0);\n this.myOldOffset_0 = Duration$Companion_getInstance().HOUR.mul_s8cxhz$(L4);\n this.myNewOffset_0 = Duration$Companion_getInstance().HOUR.mul_s8cxhz$(L3);\n this.myOldTz_0 = TimeZones_getInstance().offset_nf4kng$(null, this.myOldOffset_0, TimeZone$Companion_getInstance().UTC);\n this.myNewTz_0 = TimeZones_getInstance().offset_nf4kng$(null, this.myNewOffset_0, TimeZone$Companion_getInstance().UTC);\n this.myOffsetChangeTime_0 = new DateTime(new Date_0(26, Month$Companion_getInstance().OCTOBER, 2014), new Time(2, 0));\n this.myOffsetChangeInstant_0 = this.myOldTz_0.toInstant_amwj4p$(this.myOffsetChangeTime_0);\n }\n TimeZoneMoscow.prototype.toDateTime_x2y23v$ = function (instant) {\n return instant.compareTo_11rb$(this.myOffsetChangeInstant_0) >= 0 ? this.myNewTz_0.toDateTime_x2y23v$(instant) : this.myOldTz_0.toDateTime_x2y23v$(instant);\n };\n TimeZoneMoscow.prototype.toInstant_amwj4p$ = function (dateTime) {\n return dateTime.compareTo_11rb$(this.myOffsetChangeTime_0) >= 0 ? this.myNewTz_0.toInstant_amwj4p$(dateTime) : this.myOldTz_0.toInstant_amwj4p$(dateTime);\n };\n function TimeZoneMoscow$Companion() {\n TimeZoneMoscow$Companion_instance = this;\n this.ID_0 = 'Europe/Moscow';\n }\n TimeZoneMoscow$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TimeZoneMoscow$Companion_instance = null;\n function TimeZoneMoscow$Companion_getInstance() {\n if (TimeZoneMoscow$Companion_instance === null) {\n new TimeZoneMoscow$Companion();\n }return TimeZoneMoscow$Companion_instance;\n }\n TimeZoneMoscow.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TimeZoneMoscow',\n interfaces: [TimeZone]\n };\n function TimeZones() {\n TimeZones_instance = this;\n this.MILLIS_IN_SECOND_0 = L1000;\n this.MILLIS_IN_MINUTE_0 = L60000;\n this.MILLIS_IN_HOUR_0 = L3600000;\n this.MILLIS_IN_DAY_0 = L86400000;\n }\n TimeZones.prototype.toDateTime_0 = function (instant, offset) {\n var instant_0 = instant;\n instant_0 = instant_0.add_27523k$(offset);\n var days = instant_0.timeSinceEpoch.div(this.MILLIS_IN_DAY_0).toInt();\n var date = Date$Companion_getInstance().EPOCH.addDays_za3lpa$(days);\n var rest = instant_0.timeSinceEpoch.modulo(this.MILLIS_IN_DAY_0);\n var hour = rest.div(this.MILLIS_IN_HOUR_0).toInt();\n rest = rest.modulo(this.MILLIS_IN_HOUR_0);\n var minutes = rest.div(this.MILLIS_IN_MINUTE_0).toInt();\n rest = rest.modulo(this.MILLIS_IN_MINUTE_0);\n var seconds = rest.div(this.MILLIS_IN_SECOND_0).toInt();\n rest = rest.modulo(this.MILLIS_IN_SECOND_0);\n var milliseconds = rest.modulo(this.MILLIS_IN_SECOND_0).toInt();\n return new DateTime(date, new Time(hour, minutes, seconds, milliseconds));\n };\n TimeZones.prototype.toInstant_0 = function (dateTime, offset) {\n return (new Instant(this.toMillis_0(dateTime.date).add(this.toMillis_1(dateTime.time)))).sub_27523k$(offset);\n };\n TimeZones.prototype.toMillis_1 = function (time) {\n var minutes = Kotlin.Long.fromInt(time.hours).multiply(L60).add(Kotlin.Long.fromInt(time.minutes));\n var seconds = minutes.multiply(Kotlin.Long.fromInt(60)).add(Kotlin.Long.fromInt(time.seconds));\n return seconds.multiply(Kotlin.Long.fromInt(1000)).add(Kotlin.Long.fromInt(time.milliseconds));\n };\n TimeZones.prototype.toMillis_0 = function (date) {\n return Kotlin.Long.fromInt(date.daysFrom_z9gqti$(Date$Companion_getInstance().EPOCH)).multiply(this.MILLIS_IN_DAY_0);\n };\n function TimeZones$utc$ObjectLiteral(id) {\n TimeZone.call(this, id);\n }\n TimeZones$utc$ObjectLiteral.prototype.toDateTime_x2y23v$ = function (instant) {\n return TimeZones_getInstance().toDateTime_0(instant, new Duration(L0));\n };\n TimeZones$utc$ObjectLiteral.prototype.toInstant_amwj4p$ = function (dateTime) {\n return TimeZones_getInstance().toInstant_0(dateTime, new Duration(L0));\n };\n TimeZones$utc$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [TimeZone]\n };\n TimeZones.prototype.utc = function () {\n return new TimeZones$utc$ObjectLiteral('UTC');\n };\n function TimeZones$offset$ObjectLiteral(closure$base, closure$offset, id) {\n this.closure$base = closure$base;\n this.closure$offset = closure$offset;\n TimeZone.call(this, id);\n }\n TimeZones$offset$ObjectLiteral.prototype.toDateTime_x2y23v$ = function (instant) {\n return this.closure$base.toDateTime_x2y23v$(instant.add_27523k$(this.closure$offset));\n };\n TimeZones$offset$ObjectLiteral.prototype.toInstant_amwj4p$ = function (dateTime) {\n return this.closure$base.toInstant_amwj4p$(dateTime).sub_27523k$(this.closure$offset);\n };\n TimeZones$offset$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [TimeZone]\n };\n TimeZones.prototype.offset_nf4kng$ = function (id, offset, base) {\n return new TimeZones$offset$ObjectLiteral(base, offset, id);\n };\n function TimeZones$withEuSummerTime$ObjectLiteral(closure$startSpec, closure$utcChangeTime, closure$endSpec, id, offset) {\n this.closure$startSpec = closure$startSpec;\n this.closure$utcChangeTime = closure$utcChangeTime;\n this.closure$endSpec = closure$endSpec;\n TimeZones$DSTimeZone.call(this, id, offset);\n }\n TimeZones$withEuSummerTime$ObjectLiteral.prototype.getStartInstant_za3lpa$ = function (year) {\n return TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(new DateTime(this.closure$startSpec.getDate_za3lpa$(year), this.closure$utcChangeTime));\n };\n TimeZones$withEuSummerTime$ObjectLiteral.prototype.getEndInstant_za3lpa$ = function (year) {\n return TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(new DateTime(this.closure$endSpec.getDate_za3lpa$(year), this.closure$utcChangeTime));\n };\n TimeZones$withEuSummerTime$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [TimeZones$DSTimeZone]\n };\n TimeZones.prototype.withEuSummerTime_rwkwum$ = function (id, offset) {\n var startSpec = DateSpecs_getInstance().last_kvq57g$(WeekDay$SUNDAY_getInstance(), Month$Companion_getInstance().MARCH);\n var endSpec = DateSpecs_getInstance().last_kvq57g$(WeekDay$SUNDAY_getInstance(), Month$Companion_getInstance().OCTOBER);\n var utcChangeTime = new Time(1, 0);\n return new TimeZones$withEuSummerTime$ObjectLiteral(startSpec, utcChangeTime, endSpec, id, offset);\n };\n function TimeZones$withUsSummerTime$ObjectLiteral(closure$startSpec, closure$offset, closure$endSpec, id, offset) {\n this.closure$startSpec = closure$startSpec;\n this.closure$offset = closure$offset;\n this.closure$endSpec = closure$endSpec;\n TimeZones$DSTimeZone.call(this, id, offset);\n }\n TimeZones$withUsSummerTime$ObjectLiteral.prototype.getStartInstant_za3lpa$ = function (year) {\n return TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(new DateTime(this.closure$startSpec.getDate_za3lpa$(year), new Time(2, 0))).sub_27523k$(this.closure$offset);\n };\n TimeZones$withUsSummerTime$ObjectLiteral.prototype.getEndInstant_za3lpa$ = function (year) {\n return TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(new DateTime(this.closure$endSpec.getDate_za3lpa$(year), new Time(2, 0))).sub_27523k$(this.closure$offset.add_27523k$(Duration$Companion_getInstance().HOUR));\n };\n TimeZones$withUsSummerTime$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [TimeZones$DSTimeZone]\n };\n TimeZones.prototype.withUsSummerTime_rwkwum$ = function (id, offset) {\n var startSpec = DateSpecs_getInstance().first_t96ihi$(WeekDay$SUNDAY_getInstance(), Month$Companion_getInstance().MARCH, 2);\n var endSpec = DateSpecs_getInstance().first_t96ihi$(WeekDay$SUNDAY_getInstance(), Month$Companion_getInstance().NOVEMBER);\n return new TimeZones$withUsSummerTime$ObjectLiteral(startSpec, offset, endSpec, id, offset);\n };\n function TimeZones$DSTimeZone(id, offset) {\n TimeZone.call(this, id);\n this.myTz_0 = TimeZones_getInstance().offset_nf4kng$(null, offset, TimeZone$Companion_getInstance().UTC);\n this.mySummerTz_0 = TimeZones_getInstance().offset_nf4kng$(null, offset.add_27523k$(Duration$Companion_getInstance().HOUR), TimeZone$Companion_getInstance().UTC);\n }\n TimeZones$DSTimeZone.prototype.toDateTime_x2y23v$ = function (instant) {\n var tmp$;\n var tzDt = this.myTz_0.toDateTime_x2y23v$(instant);\n var start = this.getStartInstant_za3lpa$(tzDt.year);\n var end = this.getEndInstant_za3lpa$(tzDt.year);\n if (instant.compareTo_11rb$(start) > 0 && instant.compareTo_11rb$(end) < 0) {\n tmp$ = this.mySummerTz_0.toDateTime_x2y23v$(instant);\n } else {\n tmp$ = tzDt;\n }\n return tmp$;\n };\n TimeZones$DSTimeZone.prototype.toInstant_amwj4p$ = function (dateTime) {\n var tmp$;\n var startDt = this.toDateTime_x2y23v$(this.getStartInstant_za3lpa$(dateTime.year));\n var endDt = this.toDateTime_x2y23v$(this.getEndInstant_za3lpa$(dateTime.year));\n if (dateTime.compareTo_11rb$(startDt) > 0 && dateTime.compareTo_11rb$(endDt) < 0) {\n tmp$ = this.mySummerTz_0.toInstant_amwj4p$(dateTime);\n } else {\n tmp$ = this.myTz_0.toInstant_amwj4p$(dateTime);\n }\n return tmp$;\n };\n TimeZones$DSTimeZone.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DSTimeZone',\n interfaces: [TimeZone]\n };\n TimeZones.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'TimeZones',\n interfaces: []\n };\n var TimeZones_instance = null;\n function TimeZones_getInstance() {\n if (TimeZones_instance === null) {\n new TimeZones();\n }return TimeZones_instance;\n }\n function EnumInfo() {\n }\n EnumInfo.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'EnumInfo',\n interfaces: []\n };\n function EnumInfoFactory() {\n EnumInfoFactory_instance = this;\n }\n EnumInfoFactory.prototype.createEnumInfo_nxd2ia$ = defineInlineFunction('lets-plot-base-portable.jetbrains.datalore.base.enums.EnumInfoFactory.createEnumInfo_nxd2ia$', wrapFunction(function () {\n var EnumInfoImpl_init = _.jetbrains.datalore.base.enums.EnumInfoImpl;\n return function (EnumT_0, isEnumT) {\n return new EnumInfoImpl_init(EnumT_0.values());\n };\n }));\n EnumInfoFactory.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'EnumInfoFactory',\n interfaces: []\n };\n var EnumInfoFactory_instance = null;\n function EnumInfoFactory_getInstance() {\n if (EnumInfoFactory_instance === null) {\n new EnumInfoFactory();\n }return EnumInfoFactory_instance;\n }\n function EnumInfoImpl(enumConstants) {\n this.myNormalizedValueMap_0 = null;\n this.myOriginalNames_0 = null;\n var tmp$;\n var numConstants = enumConstants.length;\n var valueMap = HashMap_init(numConstants);\n var originalNames = ArrayList_init_0(numConstants);\n for (tmp$ = 0; tmp$ !== enumConstants.length; ++tmp$) {\n var value = enumConstants[tmp$];\n var originalName = value.toString();\n originalNames.add_11rb$(originalName);\n var normalizedName = this.toNormalizedName_0(originalName);\n var oldValue = valueMap.put_xwzc9p$(normalizedName, value);\n if (oldValue != null) {\n throw IllegalArgumentException_init(\"duplicate values: '\" + value + \"', '\" + toString(oldValue) + \"'\");\n }}\n this.myOriginalNames_0 = originalNames;\n this.myNormalizedValueMap_0 = valueMap;\n }\n Object.defineProperty(EnumInfoImpl.prototype, 'originalNames', {\n configurable: true,\n get: function () {\n return this.myOriginalNames_0;\n }\n });\n EnumInfoImpl.prototype.toNormalizedName_0 = function (name) {\n return name.toUpperCase();\n };\n EnumInfoImpl.prototype.safeValueOf_7po0m$ = function (name, defaultValue) {\n var value = this.safeValueOf_pdl1vj$(name);\n return value != null ? value : defaultValue;\n };\n EnumInfoImpl.prototype.safeValueOf_pdl1vj$ = function (name) {\n var result;\n if (this.hasValue_pdl1vj$(name)) {\n result = this.myNormalizedValueMap_0.get_11rb$(this.toNormalizedName_0(ensureNotNull(name)));\n } else {\n result = null;\n }\n return result;\n };\n EnumInfoImpl.prototype.hasValue_pdl1vj$ = function (name) {\n return name != null && this.myNormalizedValueMap_0.containsKey_11rb$(this.toNormalizedName_0(name));\n };\n EnumInfoImpl.prototype.unsafeValueOf_61zpoe$ = function (name) {\n var tmp$;\n tmp$ = this.safeValueOf_pdl1vj$(name);\n if (tmp$ == null) {\n throw IllegalArgumentException_init(\"name not found: '\" + name + \"'\");\n }return tmp$;\n };\n EnumInfoImpl.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'EnumInfoImpl',\n interfaces: [EnumInfo]\n };\n function Enums() {\n Enums_instance = this;\n }\n Enums.prototype.valueOf_a9gw98$ = defineInlineFunction('lets-plot-base-portable.jetbrains.datalore.base.enums.Enums.valueOf_a9gw98$', wrapFunction(function () {\n var equals = Kotlin.equals;\n var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init_pdl1vj$;\n return function (EnumT_0, isEnumT, name) {\n var tmp$, tmp$_0;\n tmp$ = EnumT_0.values();\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var e = tmp$[tmp$_0];\n if (equals(name, e.toString())) {\n return e;\n }}\n throw IllegalArgumentException_init(name);\n };\n }));\n Enums.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Enums',\n interfaces: []\n };\n var Enums_instance = null;\n function Enums_getInstance() {\n if (Enums_instance === null) {\n new Enums();\n }return Enums_instance;\n }\n function Button(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Button_initFields() {\n Button_initFields = function () {\n };\n Button$NONE_instance = new Button('NONE', 0);\n Button$LEFT_instance = new Button('LEFT', 1);\n Button$MIDDLE_instance = new Button('MIDDLE', 2);\n Button$RIGHT_instance = new Button('RIGHT', 3);\n }\n var Button$NONE_instance;\n function Button$NONE_getInstance() {\n Button_initFields();\n return Button$NONE_instance;\n }\n var Button$LEFT_instance;\n function Button$LEFT_getInstance() {\n Button_initFields();\n return Button$LEFT_instance;\n }\n var Button$MIDDLE_instance;\n function Button$MIDDLE_getInstance() {\n Button_initFields();\n return Button$MIDDLE_instance;\n }\n var Button$RIGHT_instance;\n function Button$RIGHT_getInstance() {\n Button_initFields();\n return Button$RIGHT_instance;\n }\n Button.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Button',\n interfaces: [Enum]\n };\n function Button$values() {\n return [Button$NONE_getInstance(), Button$LEFT_getInstance(), Button$MIDDLE_getInstance(), Button$RIGHT_getInstance()];\n }\n Button.values = Button$values;\n function Button$valueOf(name) {\n switch (name) {\n case 'NONE':\n return Button$NONE_getInstance();\n case 'LEFT':\n return Button$LEFT_getInstance();\n case 'MIDDLE':\n return Button$MIDDLE_getInstance();\n case 'RIGHT':\n return Button$RIGHT_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.event.Button.' + name);\n }\n }\n Button.valueOf_61zpoe$ = Button$valueOf;\n function Event() {\n this.eventContext_qzl3re$_d6nbbo$_0 = null;\n this.isConsumed_gb68t5$_0 = false;\n }\n Object.defineProperty(Event.prototype, 'eventContext_qzl3re$_0', {\n configurable: true,\n get: function () {\n return this.eventContext_qzl3re$_d6nbbo$_0;\n },\n set: function (eventContext) {\n if (this.eventContext_qzl3re$_0 != null) {\n throw IllegalStateException_init('Already set ' + toString(ensureNotNull(this.eventContext_qzl3re$_0)));\n }if (this.isConsumed) {\n throw IllegalStateException_init(\"Can't set a context to the consumed event\");\n }if (eventContext == null) {\n throw IllegalArgumentException_init(\"Can't set null context\");\n }this.eventContext_qzl3re$_d6nbbo$_0 = eventContext;\n }\n });\n Object.defineProperty(Event.prototype, 'isConsumed', {\n configurable: true,\n get: function () {\n return this.isConsumed_gb68t5$_0;\n },\n set: function (isConsumed) {\n this.isConsumed_gb68t5$_0 = isConsumed;\n }\n });\n Event.prototype.consume = function () {\n this.doConsume_smptag$_0();\n };\n Event.prototype.doConsume_smptag$_0 = function () {\n if (this.isConsumed) {\n throw IllegalStateException_init_0();\n }this.isConsumed = true;\n };\n Event.prototype.ensureConsumed = function () {\n if (!this.isConsumed) {\n this.consume();\n }};\n Event.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Event',\n interfaces: []\n };\n function EventContext() {\n }\n EventContext.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'EventContext',\n interfaces: []\n };\n function Key(name, ordinal, myValue) {\n Enum.call(this);\n this.myValue_n4kdnj$_0 = myValue;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Key_initFields() {\n Key_initFields = function () {\n };\n Key$A_instance = new Key('A', 0, 'A');\n Key$B_instance = new Key('B', 1, 'B');\n Key$C_instance = new Key('C', 2, 'C');\n Key$D_instance = new Key('D', 3, 'D');\n Key$E_instance = new Key('E', 4, 'E');\n Key$F_instance = new Key('F', 5, 'F');\n Key$G_instance = new Key('G', 6, 'G');\n Key$H_instance = new Key('H', 7, 'H');\n Key$I_instance = new Key('I', 8, 'I');\n Key$J_instance = new Key('J', 9, 'J');\n Key$K_instance = new Key('K', 10, 'K');\n Key$L_instance = new Key('L', 11, 'L');\n Key$M_instance = new Key('M', 12, 'M');\n Key$N_instance = new Key('N', 13, 'N');\n Key$O_instance = new Key('O', 14, 'O');\n Key$P_instance = new Key('P', 15, 'P');\n Key$Q_instance = new Key('Q', 16, 'Q');\n Key$R_instance = new Key('R', 17, 'R');\n Key$S_instance = new Key('S', 18, 'S');\n Key$T_instance = new Key('T', 19, 'T');\n Key$U_instance = new Key('U', 20, 'U');\n Key$V_instance = new Key('V', 21, 'V');\n Key$W_instance = new Key('W', 22, 'W');\n Key$X_instance = new Key('X', 23, 'X');\n Key$Y_instance = new Key('Y', 24, 'Y');\n Key$Z_instance = new Key('Z', 25, 'Z');\n Key$DIGIT_0_instance = new Key('DIGIT_0', 26, '0');\n Key$DIGIT_1_instance = new Key('DIGIT_1', 27, '1');\n Key$DIGIT_2_instance = new Key('DIGIT_2', 28, '2');\n Key$DIGIT_3_instance = new Key('DIGIT_3', 29, '3');\n Key$DIGIT_4_instance = new Key('DIGIT_4', 30, '4');\n Key$DIGIT_5_instance = new Key('DIGIT_5', 31, '5');\n Key$DIGIT_6_instance = new Key('DIGIT_6', 32, '6');\n Key$DIGIT_7_instance = new Key('DIGIT_7', 33, '7');\n Key$DIGIT_8_instance = new Key('DIGIT_8', 34, '8');\n Key$DIGIT_9_instance = new Key('DIGIT_9', 35, '9');\n Key$LEFT_BRACE_instance = new Key('LEFT_BRACE', 36, '[');\n Key$RIGHT_BRACE_instance = new Key('RIGHT_BRACE', 37, ']');\n Key$UP_instance = new Key('UP', 38, 'Up');\n Key$DOWN_instance = new Key('DOWN', 39, 'Down');\n Key$LEFT_instance = new Key('LEFT', 40, 'Left');\n Key$RIGHT_instance = new Key('RIGHT', 41, 'Right');\n Key$PAGE_UP_instance = new Key('PAGE_UP', 42, 'Page Up');\n Key$PAGE_DOWN_instance = new Key('PAGE_DOWN', 43, 'Page Down');\n Key$ESCAPE_instance = new Key('ESCAPE', 44, 'Escape');\n Key$ENTER_instance = new Key('ENTER', 45, 'Enter');\n Key$HOME_instance = new Key('HOME', 46, 'Home');\n Key$END_instance = new Key('END', 47, 'End');\n Key$TAB_instance = new Key('TAB', 48, 'Tab');\n Key$SPACE_instance = new Key('SPACE', 49, 'Space');\n Key$INSERT_instance = new Key('INSERT', 50, 'Insert');\n Key$DELETE_instance = new Key('DELETE', 51, 'Delete');\n Key$BACKSPACE_instance = new Key('BACKSPACE', 52, 'Backspace');\n Key$EQUALS_instance = new Key('EQUALS', 53, 'Equals');\n Key$BACK_QUOTE_instance = new Key('BACK_QUOTE', 54, '`');\n Key$PLUS_instance = new Key('PLUS', 55, 'Plus');\n Key$MINUS_instance = new Key('MINUS', 56, 'Minus');\n Key$SLASH_instance = new Key('SLASH', 57, 'Slash');\n Key$CONTROL_instance = new Key('CONTROL', 58, 'Ctrl');\n Key$META_instance = new Key('META', 59, 'Meta');\n Key$ALT_instance = new Key('ALT', 60, 'Alt');\n Key$SHIFT_instance = new Key('SHIFT', 61, 'Shift');\n Key$UNKNOWN_instance = new Key('UNKNOWN', 62, '?');\n Key$F1_instance = new Key('F1', 63, 'F1');\n Key$F2_instance = new Key('F2', 64, 'F2');\n Key$F3_instance = new Key('F3', 65, 'F3');\n Key$F4_instance = new Key('F4', 66, 'F4');\n Key$F5_instance = new Key('F5', 67, 'F5');\n Key$F6_instance = new Key('F6', 68, 'F6');\n Key$F7_instance = new Key('F7', 69, 'F7');\n Key$F8_instance = new Key('F8', 70, 'F8');\n Key$F9_instance = new Key('F9', 71, 'F9');\n Key$F10_instance = new Key('F10', 72, 'F10');\n Key$F11_instance = new Key('F11', 73, 'F11');\n Key$F12_instance = new Key('F12', 74, 'F12');\n Key$COMMA_instance = new Key('COMMA', 75, ',');\n Key$PERIOD_instance = new Key('PERIOD', 76, '.');\n }\n var Key$A_instance;\n function Key$A_getInstance() {\n Key_initFields();\n return Key$A_instance;\n }\n var Key$B_instance;\n function Key$B_getInstance() {\n Key_initFields();\n return Key$B_instance;\n }\n var Key$C_instance;\n function Key$C_getInstance() {\n Key_initFields();\n return Key$C_instance;\n }\n var Key$D_instance;\n function Key$D_getInstance() {\n Key_initFields();\n return Key$D_instance;\n }\n var Key$E_instance;\n function Key$E_getInstance() {\n Key_initFields();\n return Key$E_instance;\n }\n var Key$F_instance;\n function Key$F_getInstance() {\n Key_initFields();\n return Key$F_instance;\n }\n var Key$G_instance;\n function Key$G_getInstance() {\n Key_initFields();\n return Key$G_instance;\n }\n var Key$H_instance;\n function Key$H_getInstance() {\n Key_initFields();\n return Key$H_instance;\n }\n var Key$I_instance;\n function Key$I_getInstance() {\n Key_initFields();\n return Key$I_instance;\n }\n var Key$J_instance;\n function Key$J_getInstance() {\n Key_initFields();\n return Key$J_instance;\n }\n var Key$K_instance;\n function Key$K_getInstance() {\n Key_initFields();\n return Key$K_instance;\n }\n var Key$L_instance;\n function Key$L_getInstance() {\n Key_initFields();\n return Key$L_instance;\n }\n var Key$M_instance;\n function Key$M_getInstance() {\n Key_initFields();\n return Key$M_instance;\n }\n var Key$N_instance;\n function Key$N_getInstance() {\n Key_initFields();\n return Key$N_instance;\n }\n var Key$O_instance;\n function Key$O_getInstance() {\n Key_initFields();\n return Key$O_instance;\n }\n var Key$P_instance;\n function Key$P_getInstance() {\n Key_initFields();\n return Key$P_instance;\n }\n var Key$Q_instance;\n function Key$Q_getInstance() {\n Key_initFields();\n return Key$Q_instance;\n }\n var Key$R_instance;\n function Key$R_getInstance() {\n Key_initFields();\n return Key$R_instance;\n }\n var Key$S_instance;\n function Key$S_getInstance() {\n Key_initFields();\n return Key$S_instance;\n }\n var Key$T_instance;\n function Key$T_getInstance() {\n Key_initFields();\n return Key$T_instance;\n }\n var Key$U_instance;\n function Key$U_getInstance() {\n Key_initFields();\n return Key$U_instance;\n }\n var Key$V_instance;\n function Key$V_getInstance() {\n Key_initFields();\n return Key$V_instance;\n }\n var Key$W_instance;\n function Key$W_getInstance() {\n Key_initFields();\n return Key$W_instance;\n }\n var Key$X_instance;\n function Key$X_getInstance() {\n Key_initFields();\n return Key$X_instance;\n }\n var Key$Y_instance;\n function Key$Y_getInstance() {\n Key_initFields();\n return Key$Y_instance;\n }\n var Key$Z_instance;\n function Key$Z_getInstance() {\n Key_initFields();\n return Key$Z_instance;\n }\n var Key$DIGIT_0_instance;\n function Key$DIGIT_0_getInstance() {\n Key_initFields();\n return Key$DIGIT_0_instance;\n }\n var Key$DIGIT_1_instance;\n function Key$DIGIT_1_getInstance() {\n Key_initFields();\n return Key$DIGIT_1_instance;\n }\n var Key$DIGIT_2_instance;\n function Key$DIGIT_2_getInstance() {\n Key_initFields();\n return Key$DIGIT_2_instance;\n }\n var Key$DIGIT_3_instance;\n function Key$DIGIT_3_getInstance() {\n Key_initFields();\n return Key$DIGIT_3_instance;\n }\n var Key$DIGIT_4_instance;\n function Key$DIGIT_4_getInstance() {\n Key_initFields();\n return Key$DIGIT_4_instance;\n }\n var Key$DIGIT_5_instance;\n function Key$DIGIT_5_getInstance() {\n Key_initFields();\n return Key$DIGIT_5_instance;\n }\n var Key$DIGIT_6_instance;\n function Key$DIGIT_6_getInstance() {\n Key_initFields();\n return Key$DIGIT_6_instance;\n }\n var Key$DIGIT_7_instance;\n function Key$DIGIT_7_getInstance() {\n Key_initFields();\n return Key$DIGIT_7_instance;\n }\n var Key$DIGIT_8_instance;\n function Key$DIGIT_8_getInstance() {\n Key_initFields();\n return Key$DIGIT_8_instance;\n }\n var Key$DIGIT_9_instance;\n function Key$DIGIT_9_getInstance() {\n Key_initFields();\n return Key$DIGIT_9_instance;\n }\n var Key$LEFT_BRACE_instance;\n function Key$LEFT_BRACE_getInstance() {\n Key_initFields();\n return Key$LEFT_BRACE_instance;\n }\n var Key$RIGHT_BRACE_instance;\n function Key$RIGHT_BRACE_getInstance() {\n Key_initFields();\n return Key$RIGHT_BRACE_instance;\n }\n var Key$UP_instance;\n function Key$UP_getInstance() {\n Key_initFields();\n return Key$UP_instance;\n }\n var Key$DOWN_instance;\n function Key$DOWN_getInstance() {\n Key_initFields();\n return Key$DOWN_instance;\n }\n var Key$LEFT_instance;\n function Key$LEFT_getInstance() {\n Key_initFields();\n return Key$LEFT_instance;\n }\n var Key$RIGHT_instance;\n function Key$RIGHT_getInstance() {\n Key_initFields();\n return Key$RIGHT_instance;\n }\n var Key$PAGE_UP_instance;\n function Key$PAGE_UP_getInstance() {\n Key_initFields();\n return Key$PAGE_UP_instance;\n }\n var Key$PAGE_DOWN_instance;\n function Key$PAGE_DOWN_getInstance() {\n Key_initFields();\n return Key$PAGE_DOWN_instance;\n }\n var Key$ESCAPE_instance;\n function Key$ESCAPE_getInstance() {\n Key_initFields();\n return Key$ESCAPE_instance;\n }\n var Key$ENTER_instance;\n function Key$ENTER_getInstance() {\n Key_initFields();\n return Key$ENTER_instance;\n }\n var Key$HOME_instance;\n function Key$HOME_getInstance() {\n Key_initFields();\n return Key$HOME_instance;\n }\n var Key$END_instance;\n function Key$END_getInstance() {\n Key_initFields();\n return Key$END_instance;\n }\n var Key$TAB_instance;\n function Key$TAB_getInstance() {\n Key_initFields();\n return Key$TAB_instance;\n }\n var Key$SPACE_instance;\n function Key$SPACE_getInstance() {\n Key_initFields();\n return Key$SPACE_instance;\n }\n var Key$INSERT_instance;\n function Key$INSERT_getInstance() {\n Key_initFields();\n return Key$INSERT_instance;\n }\n var Key$DELETE_instance;\n function Key$DELETE_getInstance() {\n Key_initFields();\n return Key$DELETE_instance;\n }\n var Key$BACKSPACE_instance;\n function Key$BACKSPACE_getInstance() {\n Key_initFields();\n return Key$BACKSPACE_instance;\n }\n var Key$EQUALS_instance;\n function Key$EQUALS_getInstance() {\n Key_initFields();\n return Key$EQUALS_instance;\n }\n var Key$BACK_QUOTE_instance;\n function Key$BACK_QUOTE_getInstance() {\n Key_initFields();\n return Key$BACK_QUOTE_instance;\n }\n var Key$PLUS_instance;\n function Key$PLUS_getInstance() {\n Key_initFields();\n return Key$PLUS_instance;\n }\n var Key$MINUS_instance;\n function Key$MINUS_getInstance() {\n Key_initFields();\n return Key$MINUS_instance;\n }\n var Key$SLASH_instance;\n function Key$SLASH_getInstance() {\n Key_initFields();\n return Key$SLASH_instance;\n }\n var Key$CONTROL_instance;\n function Key$CONTROL_getInstance() {\n Key_initFields();\n return Key$CONTROL_instance;\n }\n var Key$META_instance;\n function Key$META_getInstance() {\n Key_initFields();\n return Key$META_instance;\n }\n var Key$ALT_instance;\n function Key$ALT_getInstance() {\n Key_initFields();\n return Key$ALT_instance;\n }\n var Key$SHIFT_instance;\n function Key$SHIFT_getInstance() {\n Key_initFields();\n return Key$SHIFT_instance;\n }\n var Key$UNKNOWN_instance;\n function Key$UNKNOWN_getInstance() {\n Key_initFields();\n return Key$UNKNOWN_instance;\n }\n var Key$F1_instance;\n function Key$F1_getInstance() {\n Key_initFields();\n return Key$F1_instance;\n }\n var Key$F2_instance;\n function Key$F2_getInstance() {\n Key_initFields();\n return Key$F2_instance;\n }\n var Key$F3_instance;\n function Key$F3_getInstance() {\n Key_initFields();\n return Key$F3_instance;\n }\n var Key$F4_instance;\n function Key$F4_getInstance() {\n Key_initFields();\n return Key$F4_instance;\n }\n var Key$F5_instance;\n function Key$F5_getInstance() {\n Key_initFields();\n return Key$F5_instance;\n }\n var Key$F6_instance;\n function Key$F6_getInstance() {\n Key_initFields();\n return Key$F6_instance;\n }\n var Key$F7_instance;\n function Key$F7_getInstance() {\n Key_initFields();\n return Key$F7_instance;\n }\n var Key$F8_instance;\n function Key$F8_getInstance() {\n Key_initFields();\n return Key$F8_instance;\n }\n var Key$F9_instance;\n function Key$F9_getInstance() {\n Key_initFields();\n return Key$F9_instance;\n }\n var Key$F10_instance;\n function Key$F10_getInstance() {\n Key_initFields();\n return Key$F10_instance;\n }\n var Key$F11_instance;\n function Key$F11_getInstance() {\n Key_initFields();\n return Key$F11_instance;\n }\n var Key$F12_instance;\n function Key$F12_getInstance() {\n Key_initFields();\n return Key$F12_instance;\n }\n var Key$COMMA_instance;\n function Key$COMMA_getInstance() {\n Key_initFields();\n return Key$COMMA_instance;\n }\n var Key$PERIOD_instance;\n function Key$PERIOD_getInstance() {\n Key_initFields();\n return Key$PERIOD_instance;\n }\n Key.prototype.toString = function () {\n return this.myValue_n4kdnj$_0;\n };\n Key.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Key',\n interfaces: [Enum]\n };\n function Key$values() {\n return [Key$A_getInstance(), Key$B_getInstance(), Key$C_getInstance(), Key$D_getInstance(), Key$E_getInstance(), Key$F_getInstance(), Key$G_getInstance(), Key$H_getInstance(), Key$I_getInstance(), Key$J_getInstance(), Key$K_getInstance(), Key$L_getInstance(), Key$M_getInstance(), Key$N_getInstance(), Key$O_getInstance(), Key$P_getInstance(), Key$Q_getInstance(), Key$R_getInstance(), Key$S_getInstance(), Key$T_getInstance(), Key$U_getInstance(), Key$V_getInstance(), Key$W_getInstance(), Key$X_getInstance(), Key$Y_getInstance(), Key$Z_getInstance(), Key$DIGIT_0_getInstance(), Key$DIGIT_1_getInstance(), Key$DIGIT_2_getInstance(), Key$DIGIT_3_getInstance(), Key$DIGIT_4_getInstance(), Key$DIGIT_5_getInstance(), Key$DIGIT_6_getInstance(), Key$DIGIT_7_getInstance(), Key$DIGIT_8_getInstance(), Key$DIGIT_9_getInstance(), Key$LEFT_BRACE_getInstance(), Key$RIGHT_BRACE_getInstance(), Key$UP_getInstance(), Key$DOWN_getInstance(), Key$LEFT_getInstance(), Key$RIGHT_getInstance(), Key$PAGE_UP_getInstance(), Key$PAGE_DOWN_getInstance(), Key$ESCAPE_getInstance(), Key$ENTER_getInstance(), Key$HOME_getInstance(), Key$END_getInstance(), Key$TAB_getInstance(), Key$SPACE_getInstance(), Key$INSERT_getInstance(), Key$DELETE_getInstance(), Key$BACKSPACE_getInstance(), Key$EQUALS_getInstance(), Key$BACK_QUOTE_getInstance(), Key$PLUS_getInstance(), Key$MINUS_getInstance(), Key$SLASH_getInstance(), Key$CONTROL_getInstance(), Key$META_getInstance(), Key$ALT_getInstance(), Key$SHIFT_getInstance(), Key$UNKNOWN_getInstance(), Key$F1_getInstance(), Key$F2_getInstance(), Key$F3_getInstance(), Key$F4_getInstance(), Key$F5_getInstance(), Key$F6_getInstance(), Key$F7_getInstance(), Key$F8_getInstance(), Key$F9_getInstance(), Key$F10_getInstance(), Key$F11_getInstance(), Key$F12_getInstance(), Key$COMMA_getInstance(), Key$PERIOD_getInstance()];\n }\n Key.values = Key$values;\n function Key$valueOf(name) {\n switch (name) {\n case 'A':\n return Key$A_getInstance();\n case 'B':\n return Key$B_getInstance();\n case 'C':\n return Key$C_getInstance();\n case 'D':\n return Key$D_getInstance();\n case 'E':\n return Key$E_getInstance();\n case 'F':\n return Key$F_getInstance();\n case 'G':\n return Key$G_getInstance();\n case 'H':\n return Key$H_getInstance();\n case 'I':\n return Key$I_getInstance();\n case 'J':\n return Key$J_getInstance();\n case 'K':\n return Key$K_getInstance();\n case 'L':\n return Key$L_getInstance();\n case 'M':\n return Key$M_getInstance();\n case 'N':\n return Key$N_getInstance();\n case 'O':\n return Key$O_getInstance();\n case 'P':\n return Key$P_getInstance();\n case 'Q':\n return Key$Q_getInstance();\n case 'R':\n return Key$R_getInstance();\n case 'S':\n return Key$S_getInstance();\n case 'T':\n return Key$T_getInstance();\n case 'U':\n return Key$U_getInstance();\n case 'V':\n return Key$V_getInstance();\n case 'W':\n return Key$W_getInstance();\n case 'X':\n return Key$X_getInstance();\n case 'Y':\n return Key$Y_getInstance();\n case 'Z':\n return Key$Z_getInstance();\n case 'DIGIT_0':\n return Key$DIGIT_0_getInstance();\n case 'DIGIT_1':\n return Key$DIGIT_1_getInstance();\n case 'DIGIT_2':\n return Key$DIGIT_2_getInstance();\n case 'DIGIT_3':\n return Key$DIGIT_3_getInstance();\n case 'DIGIT_4':\n return Key$DIGIT_4_getInstance();\n case 'DIGIT_5':\n return Key$DIGIT_5_getInstance();\n case 'DIGIT_6':\n return Key$DIGIT_6_getInstance();\n case 'DIGIT_7':\n return Key$DIGIT_7_getInstance();\n case 'DIGIT_8':\n return Key$DIGIT_8_getInstance();\n case 'DIGIT_9':\n return Key$DIGIT_9_getInstance();\n case 'LEFT_BRACE':\n return Key$LEFT_BRACE_getInstance();\n case 'RIGHT_BRACE':\n return Key$RIGHT_BRACE_getInstance();\n case 'UP':\n return Key$UP_getInstance();\n case 'DOWN':\n return Key$DOWN_getInstance();\n case 'LEFT':\n return Key$LEFT_getInstance();\n case 'RIGHT':\n return Key$RIGHT_getInstance();\n case 'PAGE_UP':\n return Key$PAGE_UP_getInstance();\n case 'PAGE_DOWN':\n return Key$PAGE_DOWN_getInstance();\n case 'ESCAPE':\n return Key$ESCAPE_getInstance();\n case 'ENTER':\n return Key$ENTER_getInstance();\n case 'HOME':\n return Key$HOME_getInstance();\n case 'END':\n return Key$END_getInstance();\n case 'TAB':\n return Key$TAB_getInstance();\n case 'SPACE':\n return Key$SPACE_getInstance();\n case 'INSERT':\n return Key$INSERT_getInstance();\n case 'DELETE':\n return Key$DELETE_getInstance();\n case 'BACKSPACE':\n return Key$BACKSPACE_getInstance();\n case 'EQUALS':\n return Key$EQUALS_getInstance();\n case 'BACK_QUOTE':\n return Key$BACK_QUOTE_getInstance();\n case 'PLUS':\n return Key$PLUS_getInstance();\n case 'MINUS':\n return Key$MINUS_getInstance();\n case 'SLASH':\n return Key$SLASH_getInstance();\n case 'CONTROL':\n return Key$CONTROL_getInstance();\n case 'META':\n return Key$META_getInstance();\n case 'ALT':\n return Key$ALT_getInstance();\n case 'SHIFT':\n return Key$SHIFT_getInstance();\n case 'UNKNOWN':\n return Key$UNKNOWN_getInstance();\n case 'F1':\n return Key$F1_getInstance();\n case 'F2':\n return Key$F2_getInstance();\n case 'F3':\n return Key$F3_getInstance();\n case 'F4':\n return Key$F4_getInstance();\n case 'F5':\n return Key$F5_getInstance();\n case 'F6':\n return Key$F6_getInstance();\n case 'F7':\n return Key$F7_getInstance();\n case 'F8':\n return Key$F8_getInstance();\n case 'F9':\n return Key$F9_getInstance();\n case 'F10':\n return Key$F10_getInstance();\n case 'F11':\n return Key$F11_getInstance();\n case 'F12':\n return Key$F12_getInstance();\n case 'COMMA':\n return Key$COMMA_getInstance();\n case 'PERIOD':\n return Key$PERIOD_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.event.Key.' + name);\n }\n }\n Key.valueOf_61zpoe$ = Key$valueOf;\n function KeyEvent() {\n this.keyStroke = null;\n this.keyChar = null;\n }\n Object.defineProperty(KeyEvent.prototype, 'key', {\n configurable: true,\n get: function () {\n return this.keyStroke.key;\n }\n });\n Object.defineProperty(KeyEvent.prototype, 'modifiers', {\n configurable: true,\n get: function () {\n return this.keyStroke.modifiers;\n }\n });\n KeyEvent.prototype.is_ji7i3y$ = function (key, modifiers) {\n return this.keyStroke.is_ji7i3y$(key, modifiers.slice());\n };\n KeyEvent.prototype.is_c4rqdo$ = function (specs) {\n var tmp$;\n for (tmp$ = 0; tmp$ !== specs.length; ++tmp$) {\n var s = specs[tmp$];\n if (s.matches_l9pgtg$(this.keyStroke))\n return true;\n }\n return false;\n };\n KeyEvent.prototype.is_4t3vif$ = function (specs) {\n var tmp$;\n for (tmp$ = 0; tmp$ !== specs.length; ++tmp$) {\n var s = specs[tmp$];\n if (s.matches_l9pgtg$(this.keyStroke))\n return true;\n }\n return false;\n };\n KeyEvent.prototype.has_hny0b7$ = function (key) {\n return this.keyStroke.has_hny0b7$(key);\n };\n KeyEvent.prototype.copy = function () {\n return KeyEvent_init_1(this.key, unboxChar(this.keyChar), this.modifiers);\n };\n KeyEvent.prototype.toString = function () {\n return this.keyStroke.toString();\n };\n KeyEvent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'KeyEvent',\n interfaces: [Event]\n };\n function KeyEvent_init(keyStroke, $this) {\n $this = $this || Object.create(KeyEvent.prototype);\n Event.call($this);\n KeyEvent.call($this);\n $this.keyStroke = keyStroke;\n $this.keyChar = toChar(0);\n return $this;\n }\n function KeyEvent_init_0(key, ch, $this) {\n if (ch === void 0)\n ch = toChar(0);\n $this = $this || Object.create(KeyEvent.prototype);\n Event.call($this);\n KeyEvent.call($this);\n $this.keyStroke = KeyStroke_init_0(key, emptyList());\n $this.keyChar = ch;\n return $this;\n }\n function KeyEvent_init_1(key, ch, modifiers, $this) {\n $this = $this || Object.create(KeyEvent.prototype);\n Event.call($this);\n KeyEvent.call($this);\n $this.keyStroke = KeyStroke_init_0(key, modifiers);\n $this.keyChar = ch;\n return $this;\n }\n function KeyModifiers(isCtrl, isAlt, isShift, isMeta) {\n KeyModifiers$Companion_getInstance();\n this.isCtrl = isCtrl;\n this.isAlt = isAlt;\n this.isShift = isShift;\n this.isMeta = isMeta;\n }\n function KeyModifiers$Companion() {\n KeyModifiers$Companion_instance = this;\n this.EMPTY_MODIFIERS_0 = KeyModifiers_init();\n }\n KeyModifiers$Companion.prototype.emptyModifiers = function () {\n return this.EMPTY_MODIFIERS_0;\n };\n KeyModifiers$Companion.prototype.withShift = function () {\n return new KeyModifiers(false, false, true, false);\n };\n KeyModifiers$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var KeyModifiers$Companion_instance = null;\n function KeyModifiers$Companion_getInstance() {\n if (KeyModifiers$Companion_instance === null) {\n new KeyModifiers$Companion();\n }return KeyModifiers$Companion_instance;\n }\n KeyModifiers.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'KeyModifiers',\n interfaces: []\n };\n function KeyModifiers_init($this) {\n $this = $this || Object.create(KeyModifiers.prototype);\n KeyModifiers.call($this, false, false, false, false);\n return $this;\n }\n function KeyStroke() {\n this.key = null;\n this.modifiers = null;\n }\n KeyStroke.prototype.has_hny0b7$ = function (key) {\n return this.modifiers.contains_11rb$(key);\n };\n KeyStroke.prototype.is_ji7i3y$ = function (key, modifiers) {\n return this.matches_l9pgtg$(KeyStroke_init(key, modifiers.slice()));\n };\n KeyStroke.prototype.matches_l9pgtg$ = function (keyStroke) {\n return this.equals(keyStroke);\n };\n KeyStroke.prototype.with_hny0b7$ = function (key) {\n var keys = HashSet_init(this.modifiers);\n keys.add_11rb$(key);\n return KeyStroke_init_0(this.key, keys);\n };\n KeyStroke.prototype.hashCode = function () {\n return (this.key.hashCode() * 31 | 0) + hashCode(this.modifiers) | 0;\n };\n KeyStroke.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, KeyStroke))\n return false;\n var otherKeyStroke = (tmp$ = other) == null || Kotlin.isType(tmp$, KeyStroke) ? tmp$ : throwCCE();\n return this.key === ensureNotNull(otherKeyStroke).key && equals(this.modifiers, ensureNotNull(otherKeyStroke).modifiers);\n };\n KeyStroke.prototype.toString = function () {\n return this.key.toString() + ' ' + this.modifiers;\n };\n KeyStroke.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'KeyStroke',\n interfaces: []\n };\n function KeyStroke_init(key, modifiers, $this) {\n $this = $this || Object.create(KeyStroke.prototype);\n KeyStroke_init_0(key, asList(modifiers), $this);\n return $this;\n }\n function KeyStroke_init_0(key, modifiers, $this) {\n $this = $this || Object.create(KeyStroke.prototype);\n KeyStroke.call($this);\n $this.key = key;\n $this.modifiers = HashSet_init(modifiers);\n return $this;\n }\n function KeyStrokeSpec() {\n this.myKeyStrokes_0 = null;\n }\n Object.defineProperty(KeyStrokeSpec.prototype, 'keyStrokes', {\n configurable: true,\n get: function () {\n return listOf(this.myKeyStrokes_0.slice());\n }\n });\n Object.defineProperty(KeyStrokeSpec.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myKeyStrokes_0.length === 0;\n }\n });\n KeyStrokeSpec.prototype.matches_l9pgtg$ = function (keyStroke) {\n var tmp$, tmp$_0;\n tmp$ = this.myKeyStrokes_0;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var spec = tmp$[tmp$_0];\n if (spec.matches_l9pgtg$(keyStroke)) {\n return true;\n }}\n return false;\n };\n KeyStrokeSpec.prototype.with_hny0b7$ = function (key) {\n var tmp$, tmp$_0;\n var modified = ArrayList_init();\n tmp$ = this.myKeyStrokes_0;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var keyStroke = tmp$[tmp$_0];\n modified.add_11rb$(keyStroke.with_hny0b7$(key));\n }\n return KeyStrokeSpec_init_0(modified);\n };\n KeyStrokeSpec.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n var that = (tmp$_0 = other) == null || Kotlin.isType(tmp$_0, KeyStrokeSpec) ? tmp$_0 : throwCCE();\n return equals(this.keyStrokes, ensureNotNull(that).keyStrokes);\n };\n KeyStrokeSpec.prototype.hashCode = function () {\n return hashCode(this.keyStrokes);\n };\n KeyStrokeSpec.prototype.toString = function () {\n return this.keyStrokes.toString();\n };\n KeyStrokeSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'KeyStrokeSpec',\n interfaces: []\n };\n function KeyStrokeSpec_init(key, modifiers, $this) {\n $this = $this || Object.create(KeyStrokeSpec.prototype);\n KeyStrokeSpec.call($this);\n $this.myKeyStrokes_0 = [KeyStroke_init(key, modifiers.slice())];\n return $this;\n }\n function KeyStrokeSpec_init_0(keyStrokes, $this) {\n $this = $this || Object.create(KeyStrokeSpec.prototype);\n KeyStrokeSpec.call($this);\n $this.myKeyStrokes_0 = copyToArray(keyStrokes);\n return $this;\n }\n function KeyStrokeSpec_init_1(keyStrokes, $this) {\n $this = $this || Object.create(KeyStrokeSpec.prototype);\n KeyStrokeSpec.call($this);\n $this.myKeyStrokes_0 = keyStrokes.slice();\n return $this;\n }\n function KeyStrokeSpecs() {\n KeyStrokeSpecs_instance = this;\n this.COPY = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$C_getInstance(), []), KeyStrokeSpec_init(Key$INSERT_getInstance(), [ModifierKey$CONTROL_getInstance()])]);\n this.CUT = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$X_getInstance(), []), KeyStrokeSpec_init(Key$DELETE_getInstance(), [ModifierKey$SHIFT_getInstance()])]);\n this.PASTE = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$V_getInstance(), []), KeyStrokeSpec_init(Key$INSERT_getInstance(), [ModifierKey$SHIFT_getInstance()])]);\n this.UNDO = this.ctrlOrMeta_ji7i3y$(Key$Z_getInstance(), []);\n this.REDO = this.UNDO.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.COMPLETE = KeyStrokeSpec_init(Key$SPACE_getInstance(), [ModifierKey$CONTROL_getInstance()]);\n this.SHOW_DOC = this.composite_c4rqdo$([KeyStrokeSpec_init(Key$F1_getInstance(), []), this.ctrlOrMeta_ji7i3y$(Key$J_getInstance(), [])]);\n this.HELP = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$I_getInstance(), []), this.ctrlOrMeta_ji7i3y$(Key$F1_getInstance(), [])]);\n this.HOME = this.composite_4t3vif$([KeyStroke_init(Key$HOME_getInstance(), []), KeyStroke_init(Key$LEFT_getInstance(), [ModifierKey$META_getInstance()])]);\n this.END = this.composite_4t3vif$([KeyStroke_init(Key$END_getInstance(), []), KeyStroke_init(Key$RIGHT_getInstance(), [ModifierKey$META_getInstance()])]);\n this.FILE_HOME = this.ctrlOrMeta_ji7i3y$(Key$HOME_getInstance(), []);\n this.FILE_END = this.ctrlOrMeta_ji7i3y$(Key$END_getInstance(), []);\n this.PREV_WORD = this.ctrlOrAlt_ji7i3y$(Key$LEFT_getInstance(), []);\n this.NEXT_WORD = this.ctrlOrAlt_ji7i3y$(Key$RIGHT_getInstance(), []);\n this.NEXT_EDITABLE = this.ctrlOrMeta_ji7i3y$(Key$RIGHT_getInstance(), [ModifierKey$ALT_getInstance()]);\n this.PREV_EDITABLE = this.ctrlOrMeta_ji7i3y$(Key$LEFT_getInstance(), [ModifierKey$ALT_getInstance()]);\n this.SELECT_ALL = this.ctrlOrMeta_ji7i3y$(Key$A_getInstance(), []);\n this.SELECT_FILE_HOME = this.FILE_HOME.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_FILE_END = this.FILE_END.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_HOME = this.HOME.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_END = this.END.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_WORD_FORWARD = this.NEXT_WORD.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_WORD_BACKWARD = this.PREV_WORD.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_LEFT = KeyStrokeSpec_init(Key$LEFT_getInstance(), [ModifierKey$SHIFT_getInstance()]);\n this.SELECT_RIGHT = KeyStrokeSpec_init(Key$RIGHT_getInstance(), [ModifierKey$SHIFT_getInstance()]);\n this.SELECT_UP = KeyStrokeSpec_init(Key$UP_getInstance(), [ModifierKey$SHIFT_getInstance()]);\n this.SELECT_DOWN = KeyStrokeSpec_init(Key$DOWN_getInstance(), [ModifierKey$SHIFT_getInstance()]);\n this.INCREASE_SELECTION = KeyStrokeSpec_init(Key$UP_getInstance(), [ModifierKey$ALT_getInstance()]);\n this.DECREASE_SELECTION = KeyStrokeSpec_init(Key$DOWN_getInstance(), [ModifierKey$ALT_getInstance()]);\n this.INSERT_BEFORE = this.composite_4t3vif$([KeyStroke_init_0(Key$ENTER_getInstance(), this.add_0(ModifierKey$META_getInstance(), [])), KeyStroke_init(Key$INSERT_getInstance(), []), KeyStroke_init_0(Key$ENTER_getInstance(), this.add_0(ModifierKey$CONTROL_getInstance(), []))]);\n this.INSERT_AFTER = KeyStrokeSpec_init(Key$ENTER_getInstance(), []);\n this.INSERT = this.composite_c4rqdo$([this.INSERT_BEFORE, this.INSERT_AFTER]);\n this.DUPLICATE = this.ctrlOrMeta_ji7i3y$(Key$D_getInstance(), []);\n this.DELETE_CURRENT = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$BACKSPACE_getInstance(), []), this.ctrlOrMeta_ji7i3y$(Key$DELETE_getInstance(), [])]);\n this.DELETE_TO_WORD_START = KeyStrokeSpec_init(Key$BACKSPACE_getInstance(), [ModifierKey$ALT_getInstance()]);\n this.MATCHING_CONSTRUCTS = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$LEFT_BRACE_getInstance(), [ModifierKey$ALT_getInstance()]), this.ctrlOrMeta_ji7i3y$(Key$RIGHT_BRACE_getInstance(), [ModifierKey$ALT_getInstance()])]);\n this.NAVIGATE = this.ctrlOrMeta_ji7i3y$(Key$B_getInstance(), []);\n this.NAVIGATE_BACK = this.ctrlOrMeta_ji7i3y$(Key$LEFT_BRACE_getInstance(), []);\n this.NAVIGATE_FORWARD = this.ctrlOrMeta_ji7i3y$(Key$RIGHT_BRACE_getInstance(), []);\n }\n KeyStrokeSpecs.prototype.ctrlOrMeta_ji7i3y$ = function (key, modifiers) {\n return this.composite_4t3vif$([KeyStroke_init_0(key, this.add_0(ModifierKey$CONTROL_getInstance(), modifiers.slice())), KeyStroke_init_0(key, this.add_0(ModifierKey$META_getInstance(), modifiers.slice()))]);\n };\n KeyStrokeSpecs.prototype.ctrlOrAlt_ji7i3y$ = function (key, modifiers) {\n return this.composite_4t3vif$([KeyStroke_init_0(key, this.add_0(ModifierKey$CONTROL_getInstance(), modifiers.slice())), KeyStroke_init_0(key, this.add_0(ModifierKey$ALT_getInstance(), modifiers.slice()))]);\n };\n KeyStrokeSpecs.prototype.add_0 = function (key, otherKeys) {\n var result = HashSet_init(asList(otherKeys));\n result.add_11rb$(key);\n return result;\n };\n KeyStrokeSpecs.prototype.composite_c4rqdo$ = function (specs) {\n var tmp$, tmp$_0;\n var keyStrokes = HashSet_init_0();\n for (tmp$ = 0; tmp$ !== specs.length; ++tmp$) {\n var spec = specs[tmp$];\n tmp$_0 = spec.keyStrokes.iterator();\n while (tmp$_0.hasNext()) {\n var ks = tmp$_0.next();\n keyStrokes.add_11rb$(ks);\n }\n }\n return KeyStrokeSpec_init_0(keyStrokes);\n };\n KeyStrokeSpecs.prototype.composite_4t3vif$ = function (specs) {\n return KeyStrokeSpec_init_1(specs.slice());\n };\n KeyStrokeSpecs.prototype.withoutShift_b0jlop$ = function (spec) {\n var tmp$;\n var keyStroke = spec.keyStrokes.iterator().next();\n var modifiers = keyStroke.modifiers;\n var withoutShift = HashSet_init_0();\n tmp$ = modifiers.iterator();\n while (tmp$.hasNext()) {\n var modifier = tmp$.next();\n if (modifier !== ModifierKey$SHIFT_getInstance()) {\n withoutShift.add_11rb$(modifier);\n }}\n return KeyEvent_init_1(keyStroke.key, toChar(0), withoutShift);\n };\n KeyStrokeSpecs.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'KeyStrokeSpecs',\n interfaces: []\n };\n var KeyStrokeSpecs_instance = null;\n function KeyStrokeSpecs_getInstance() {\n if (KeyStrokeSpecs_instance === null) {\n new KeyStrokeSpecs();\n }return KeyStrokeSpecs_instance;\n }\n function ModifierKey(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ModifierKey_initFields() {\n ModifierKey_initFields = function () {\n };\n ModifierKey$CONTROL_instance = new ModifierKey('CONTROL', 0);\n ModifierKey$ALT_instance = new ModifierKey('ALT', 1);\n ModifierKey$SHIFT_instance = new ModifierKey('SHIFT', 2);\n ModifierKey$META_instance = new ModifierKey('META', 3);\n }\n var ModifierKey$CONTROL_instance;\n function ModifierKey$CONTROL_getInstance() {\n ModifierKey_initFields();\n return ModifierKey$CONTROL_instance;\n }\n var ModifierKey$ALT_instance;\n function ModifierKey$ALT_getInstance() {\n ModifierKey_initFields();\n return ModifierKey$ALT_instance;\n }\n var ModifierKey$SHIFT_instance;\n function ModifierKey$SHIFT_getInstance() {\n ModifierKey_initFields();\n return ModifierKey$SHIFT_instance;\n }\n var ModifierKey$META_instance;\n function ModifierKey$META_getInstance() {\n ModifierKey_initFields();\n return ModifierKey$META_instance;\n }\n ModifierKey.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ModifierKey',\n interfaces: [Enum]\n };\n function ModifierKey$values() {\n return [ModifierKey$CONTROL_getInstance(), ModifierKey$ALT_getInstance(), ModifierKey$SHIFT_getInstance(), ModifierKey$META_getInstance()];\n }\n ModifierKey.values = ModifierKey$values;\n function ModifierKey$valueOf(name) {\n switch (name) {\n case 'CONTROL':\n return ModifierKey$CONTROL_getInstance();\n case 'ALT':\n return ModifierKey$ALT_getInstance();\n case 'SHIFT':\n return ModifierKey$SHIFT_getInstance();\n case 'META':\n return ModifierKey$META_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.event.ModifierKey.' + name);\n }\n }\n ModifierKey.valueOf_61zpoe$ = ModifierKey$valueOf;\n function MouseEvent(x, y, button, modifiers) {\n MouseEvent$Companion_getInstance();\n PointEvent.call(this, x, y);\n this.button = button;\n this.modifiers = modifiers;\n if (this.button == null) {\n var message = 'Null button';\n throw IllegalArgumentException_init(message.toString());\n }}\n function MouseEvent$Companion() {\n MouseEvent$Companion_instance = this;\n }\n MouseEvent$Companion.prototype.noButton_119tl4$ = function (v) {\n return MouseEvent_init(v, Button$NONE_getInstance(), KeyModifiers$Companion_getInstance().emptyModifiers());\n };\n MouseEvent$Companion.prototype.leftButton_119tl4$ = function (v) {\n return MouseEvent_init(v, Button$LEFT_getInstance(), KeyModifiers$Companion_getInstance().emptyModifiers());\n };\n MouseEvent$Companion.prototype.middleButton_119tl4$ = function (v) {\n return MouseEvent_init(v, Button$MIDDLE_getInstance(), KeyModifiers$Companion_getInstance().emptyModifiers());\n };\n MouseEvent$Companion.prototype.rightButton_119tl4$ = function (v) {\n return MouseEvent_init(v, Button$RIGHT_getInstance(), KeyModifiers$Companion_getInstance().emptyModifiers());\n };\n MouseEvent$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var MouseEvent$Companion_instance = null;\n function MouseEvent$Companion_getInstance() {\n if (MouseEvent$Companion_instance === null) {\n new MouseEvent$Companion();\n }return MouseEvent$Companion_instance;\n }\n MouseEvent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MouseEvent',\n interfaces: [PointEvent]\n };\n function MouseEvent_init(v, button, modifiers, $this) {\n $this = $this || Object.create(MouseEvent.prototype);\n MouseEvent.call($this, v.x, v.y, button, modifiers);\n return $this;\n }\n function MouseEventSource() {\n }\n MouseEventSource.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'MouseEventSource',\n interfaces: []\n };\n function MouseEventSpec(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function MouseEventSpec_initFields() {\n MouseEventSpec_initFields = function () {\n };\n MouseEventSpec$MOUSE_ENTERED_instance = new MouseEventSpec('MOUSE_ENTERED', 0);\n MouseEventSpec$MOUSE_LEFT_instance = new MouseEventSpec('MOUSE_LEFT', 1);\n MouseEventSpec$MOUSE_MOVED_instance = new MouseEventSpec('MOUSE_MOVED', 2);\n MouseEventSpec$MOUSE_DRAGGED_instance = new MouseEventSpec('MOUSE_DRAGGED', 3);\n MouseEventSpec$MOUSE_CLICKED_instance = new MouseEventSpec('MOUSE_CLICKED', 4);\n MouseEventSpec$MOUSE_DOUBLE_CLICKED_instance = new MouseEventSpec('MOUSE_DOUBLE_CLICKED', 5);\n MouseEventSpec$MOUSE_PRESSED_instance = new MouseEventSpec('MOUSE_PRESSED', 6);\n MouseEventSpec$MOUSE_RELEASED_instance = new MouseEventSpec('MOUSE_RELEASED', 7);\n }\n var MouseEventSpec$MOUSE_ENTERED_instance;\n function MouseEventSpec$MOUSE_ENTERED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_ENTERED_instance;\n }\n var MouseEventSpec$MOUSE_LEFT_instance;\n function MouseEventSpec$MOUSE_LEFT_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_LEFT_instance;\n }\n var MouseEventSpec$MOUSE_MOVED_instance;\n function MouseEventSpec$MOUSE_MOVED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_MOVED_instance;\n }\n var MouseEventSpec$MOUSE_DRAGGED_instance;\n function MouseEventSpec$MOUSE_DRAGGED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_DRAGGED_instance;\n }\n var MouseEventSpec$MOUSE_CLICKED_instance;\n function MouseEventSpec$MOUSE_CLICKED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_CLICKED_instance;\n }\n var MouseEventSpec$MOUSE_DOUBLE_CLICKED_instance;\n function MouseEventSpec$MOUSE_DOUBLE_CLICKED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_DOUBLE_CLICKED_instance;\n }\n var MouseEventSpec$MOUSE_PRESSED_instance;\n function MouseEventSpec$MOUSE_PRESSED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_PRESSED_instance;\n }\n var MouseEventSpec$MOUSE_RELEASED_instance;\n function MouseEventSpec$MOUSE_RELEASED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_RELEASED_instance;\n }\n MouseEventSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MouseEventSpec',\n interfaces: [Enum]\n };\n function MouseEventSpec$values() {\n return [MouseEventSpec$MOUSE_ENTERED_getInstance(), MouseEventSpec$MOUSE_LEFT_getInstance(), MouseEventSpec$MOUSE_MOVED_getInstance(), MouseEventSpec$MOUSE_DRAGGED_getInstance(), MouseEventSpec$MOUSE_CLICKED_getInstance(), MouseEventSpec$MOUSE_DOUBLE_CLICKED_getInstance(), MouseEventSpec$MOUSE_PRESSED_getInstance(), MouseEventSpec$MOUSE_RELEASED_getInstance()];\n }\n MouseEventSpec.values = MouseEventSpec$values;\n function MouseEventSpec$valueOf(name) {\n switch (name) {\n case 'MOUSE_ENTERED':\n return MouseEventSpec$MOUSE_ENTERED_getInstance();\n case 'MOUSE_LEFT':\n return MouseEventSpec$MOUSE_LEFT_getInstance();\n case 'MOUSE_MOVED':\n return MouseEventSpec$MOUSE_MOVED_getInstance();\n case 'MOUSE_DRAGGED':\n return MouseEventSpec$MOUSE_DRAGGED_getInstance();\n case 'MOUSE_CLICKED':\n return MouseEventSpec$MOUSE_CLICKED_getInstance();\n case 'MOUSE_DOUBLE_CLICKED':\n return MouseEventSpec$MOUSE_DOUBLE_CLICKED_getInstance();\n case 'MOUSE_PRESSED':\n return MouseEventSpec$MOUSE_PRESSED_getInstance();\n case 'MOUSE_RELEASED':\n return MouseEventSpec$MOUSE_RELEASED_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.event.MouseEventSpec.' + name);\n }\n }\n MouseEventSpec.valueOf_61zpoe$ = MouseEventSpec$valueOf;\n function PointEvent(x, y) {\n Event.call(this);\n this.x = x;\n this.y = y;\n }\n Object.defineProperty(PointEvent.prototype, 'location', {\n configurable: true,\n get: function () {\n return new Vector(this.x, this.y);\n }\n });\n PointEvent.prototype.toString = function () {\n return '{x=' + this.x + ',y=' + this.y + '}';\n };\n PointEvent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointEvent',\n interfaces: [Event]\n };\n function Function() {\n }\n Function.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Function',\n interfaces: []\n };\n function Functions() {\n Functions_instance = this;\n this.TRUE_PREDICATE_0 = Functions$TRUE_PREDICATE$lambda;\n this.FALSE_PREDICATE_0 = Functions$FALSE_PREDICATE$lambda;\n this.NULL_PREDICATE_0 = Functions$NULL_PREDICATE$lambda;\n this.NOT_NULL_PREDICATE_0 = Functions$NOT_NULL_PREDICATE$lambda;\n }\n function Functions$constantSupplier$ObjectLiteral(closure$value) {\n this.closure$value = closure$value;\n }\n Functions$constantSupplier$ObjectLiteral.prototype.get = function () {\n return this.closure$value;\n };\n Functions$constantSupplier$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Supplier]\n };\n Functions.prototype.constantSupplier_mh5how$ = function (value) {\n return new Functions$constantSupplier$ObjectLiteral(value);\n };\n Functions.prototype.memorize_kji2v1$ = function (supplier) {\n return new Functions$Memo(supplier);\n };\n Functions.prototype.alwaysTrue_287e2$ = function () {\n return this.TRUE_PREDICATE_0;\n };\n Functions.prototype.alwaysFalse_287e2$ = function () {\n return this.FALSE_PREDICATE_0;\n };\n function Functions$constant$lambda(closure$result) {\n return function (it) {\n return closure$result;\n };\n }\n Functions.prototype.constant_jkq9vw$ = function (result) {\n return Functions$constant$lambda(result);\n };\n Functions.prototype.isNull_287e2$ = function () {\n return this.NULL_PREDICATE_0;\n };\n Functions.prototype.isNotNull_287e2$ = function () {\n return this.NOT_NULL_PREDICATE_0;\n };\n function Functions$identity$lambda(it) {\n return it;\n }\n Functions.prototype.identity_287e2$ = function () {\n return Functions$identity$lambda;\n };\n function Functions$same$lambda(closure$value) {\n return function (it) {\n return it === closure$value;\n };\n }\n Functions.prototype.same_tpy1pm$ = function (value) {\n return Functions$same$lambda(value);\n };\n function Functions$funcOf$ObjectLiteral(closure$lambda) {\n this.closure$lambda = closure$lambda;\n }\n Functions$funcOf$ObjectLiteral.prototype.apply_11rb$ = function (value) {\n return this.closure$lambda(value);\n };\n Functions$funcOf$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Function]\n };\n Functions.prototype.funcOf_7h29gk$ = function (lambda) {\n return new Functions$funcOf$ObjectLiteral(lambda);\n };\n function Functions$Memo(mySupplier) {\n this.mySupplier_0 = mySupplier;\n this.myCachedValue_0 = null;\n this.myCached_0 = false;\n }\n Functions$Memo.prototype.get = function () {\n if (!this.myCached_0) {\n this.myCachedValue_0 = this.mySupplier_0.get();\n this.myCached_0 = true;\n }return ensureNotNull(this.myCachedValue_0);\n };\n Functions$Memo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Memo',\n interfaces: [Supplier]\n };\n function Functions$TRUE_PREDICATE$lambda(it) {\n return true;\n }\n function Functions$FALSE_PREDICATE$lambda(it) {\n return false;\n }\n function Functions$NULL_PREDICATE$lambda(it) {\n return it == null;\n }\n function Functions$NOT_NULL_PREDICATE$lambda(it) {\n return it != null;\n }\n Functions.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Functions',\n interfaces: []\n };\n var Functions_instance = null;\n function Functions_getInstance() {\n if (Functions_instance === null) {\n new Functions();\n }return Functions_instance;\n }\n function Runnable() {\n }\n Runnable.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Runnable',\n interfaces: []\n };\n function Supplier() {\n }\n Supplier.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Supplier',\n interfaces: []\n };\n function Value(myValue) {\n this.myValue_0 = myValue;\n }\n Value.prototype.get = function () {\n return this.myValue_0;\n };\n Value.prototype.set_11rb$ = function (value) {\n this.myValue_0 = value;\n };\n Value.prototype.toString = function () {\n return '' + toString(this.myValue_0);\n };\n Value.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Value',\n interfaces: [Supplier]\n };\n function Preconditions() {\n Preconditions_instance = this;\n }\n Preconditions.prototype.checkState_6taknv$ = function (expression) {\n if (!expression) {\n throw IllegalStateException_init_0();\n }};\n Preconditions.prototype.checkState_eltq40$ = function (expression, errorMessage) {\n if (!expression) {\n throw IllegalStateException_init(errorMessage.toString());\n }};\n Preconditions.prototype.checkArgument_6taknv$ = function (expression) {\n if (!expression) {\n throw IllegalArgumentException_init_0();\n }};\n Preconditions.prototype.checkArgument_eltq40$ = function (expression, errorMessage) {\n if (!expression) {\n throw IllegalArgumentException_init(errorMessage.toString());\n }};\n Preconditions.prototype.checkNotNull_mh5how$ = function (reference) {\n if (reference == null) {\n throw NullPointerException_init();\n }return reference;\n };\n Preconditions.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Preconditions',\n interfaces: []\n };\n var Preconditions_instance = null;\n function Preconditions_getInstance() {\n if (Preconditions_instance === null) {\n new Preconditions();\n }return Preconditions_instance;\n }\n function Strings() {\n Strings_instance = this;\n }\n Strings.prototype.isNullOrEmpty_pdl1vj$ = function (s) {\n var tmp$ = s == null;\n if (!tmp$) {\n tmp$ = s.length === 0;\n }return tmp$;\n };\n Strings.prototype.nullToEmpty_pdl1vj$ = function (string) {\n return string != null ? string : '';\n };\n Strings.prototype.repeat_bm4lxs$ = function (string, count) {\n var stringBuilder = StringBuilder_init();\n for (var i = 0; i < count; i++) {\n stringBuilder.append_pdl1vj$(string);\n }\n return stringBuilder.toString();\n };\n Strings.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Strings',\n interfaces: []\n };\n var Strings_instance = null;\n function Strings_getInstance() {\n if (Strings_instance === null) {\n new Strings();\n }return Strings_instance;\n }\n function Throwables() {\n Throwables_instance = this;\n }\n Throwables.prototype.getRootCause_tcv7n7$ = function (throwable) {\n var slowPointer = throwable;\n var advanceSlowPointer = false;\n var cause = throwable;\n while (cause.cause != null) {\n cause = ensureNotNull(cause.cause);\n if (cause === slowPointer) {\n throw new IllegalArgumentException('Loop in causal chain detected.', cause);\n }if (advanceSlowPointer) {\n slowPointer = ensureNotNull(slowPointer.cause);\n }advanceSlowPointer = !advanceSlowPointer;\n }\n return cause;\n };\n Throwables.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Throwables',\n interfaces: []\n };\n var Throwables_instance = null;\n function Throwables_getInstance() {\n if (Throwables_instance === null) {\n new Throwables();\n }return Throwables_instance;\n }\n function ClosedRange(lower, upper) {\n ClosedRange$Companion_getInstance();\n this.lowerEnd = null;\n this.upperEnd = null;\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if ((tmp$_0 = typeof (tmp$ = lower) === 'number' ? tmp$ : null) != null) {\n if (!isFinite(tmp$_0)) {\n var message = 'ends must be finite: lower=' + lower + ' upper=' + upper;\n throw IllegalArgumentException_init(message.toString());\n }}if ((tmp$_2 = typeof (tmp$_1 = upper) === 'number' ? tmp$_1 : null) != null) {\n if (!isFinite(tmp$_2)) {\n var message_0 = 'ends must be finite: lower=' + lower + ' upper=' + upper;\n throw IllegalArgumentException_init(message_0.toString());\n }}this.lowerEnd = Comparables_getInstance().min_sdesaw$(lower, upper);\n this.upperEnd = Comparables_getInstance().max_sdesaw$(lower, upper);\n }\n ClosedRange.prototype.contains_mef7kx$ = function (v) {\n return Comparables_getInstance().lse_sdesaw$(this.lowerEnd, v) && Comparables_getInstance().lse_sdesaw$(v, this.upperEnd);\n };\n ClosedRange.prototype.span_d226ot$ = function (other) {\n if (this.encloses_d226ot$(other))\n return this;\n return other.encloses_d226ot$(this) ? other : new ClosedRange(Comparables_getInstance().min_sdesaw$(this.lowerEnd, other.lowerEnd), Comparables_getInstance().max_sdesaw$(this.upperEnd, other.upperEnd));\n };\n ClosedRange.prototype.encloses_d226ot$ = function (other) {\n return Comparables_getInstance().lse_sdesaw$(this.lowerEnd, other.lowerEnd) && Comparables_getInstance().gte_sdesaw$(this.upperEnd, other.upperEnd);\n };\n ClosedRange.prototype.isConnected_d226ot$ = function (other) {\n return !(Comparables_getInstance().gt_sdesaw$(this.lowerEnd, other.upperEnd) || Comparables_getInstance().ls_sdesaw$(this.upperEnd, other.lowerEnd));\n };\n ClosedRange.prototype.intersection_d226ot$ = function (other) {\n if (!this.isConnected_d226ot$(other))\n throw IllegalArgumentException_init('Ranges are not connected: this=' + this + ' other=' + other);\n if (this.encloses_d226ot$(other))\n return other;\n return other.encloses_d226ot$(this) ? this : new ClosedRange(Comparables_getInstance().max_sdesaw$(this.lowerEnd, other.lowerEnd), Comparables_getInstance().min_sdesaw$(this.upperEnd, other.upperEnd));\n };\n ClosedRange.prototype.toString = function () {\n return 'ClosedRange[' + this.lowerEnd + ', ' + this.upperEnd + ']';\n };\n ClosedRange.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, ClosedRange) ? tmp$_0 : throwCCE();\n if (!equals(this.lowerEnd, other.lowerEnd))\n return false;\n if (!equals(this.upperEnd, other.upperEnd))\n return false;\n return true;\n };\n ClosedRange.prototype.hashCode = function () {\n return hashCode(this.lowerEnd) + (31 * hashCode(this.upperEnd) | 0) | 0;\n };\n function ClosedRange$Companion() {\n ClosedRange$Companion_instance = this;\n }\n ClosedRange$Companion.prototype.singleton_f1zjgi$ = function (v) {\n return new ClosedRange(v, v);\n };\n ClosedRange$Companion.prototype.encloseAll_17hg47$ = function (values) {\n var tmp$;\n var iterated = false;\n var min = null;\n var max = null;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (!iterated) {\n iterated = true;\n min = v;\n max = v;\n } else {\n min = Comparables_getInstance().min_sdesaw$(ensureNotNull(min), ensureNotNull(v));\n max = Comparables_getInstance().max_sdesaw$(ensureNotNull(max), v);\n }\n }\n if (!iterated) {\n throw NoSuchElementException_init();\n }return new ClosedRange(ensureNotNull(min), ensureNotNull(max));\n };\n ClosedRange$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ClosedRange$Companion_instance = null;\n function ClosedRange$Companion_getInstance() {\n if (ClosedRange$Companion_instance === null) {\n new ClosedRange$Companion();\n }return ClosedRange$Companion_instance;\n }\n ClosedRange.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ClosedRange',\n interfaces: []\n };\n function Comparables() {\n Comparables_instance = this;\n }\n Comparables.prototype.min_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) < 0 ? a : b;\n };\n Comparables.prototype.max_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) >= 0 ? a : b;\n };\n Comparables.prototype.lse_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) <= 0;\n };\n Comparables.prototype.gte_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) >= 0;\n };\n Comparables.prototype.ls_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) < 0;\n };\n Comparables.prototype.gt_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) > 0;\n };\n Comparables.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Comparables',\n interfaces: []\n };\n var Comparables_instance = null;\n function Comparables_getInstance() {\n if (Comparables_instance === null) {\n new Comparables();\n }return Comparables_instance;\n }\n function ComparatorOrdering(comparator) {\n Ordering.call(this);\n this.myComparator_0 = comparator;\n }\n ComparatorOrdering.prototype.compare = function (a, b) {\n return this.myComparator_0.compare(a, b);\n };\n ComparatorOrdering.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ComparatorOrdering',\n interfaces: [Ordering]\n };\n function Iterables() {\n Iterables_instance = this;\n }\n Iterables.prototype.checkNonNegative_0 = function (position) {\n if (position < 0) {\n throw new IndexOutOfBoundsException(position.toString());\n }};\n Iterables.prototype.toList_yl67zr$ = function (iterable) {\n return toList(iterable);\n };\n Iterables.prototype.size_fakr2g$ = function (iterable) {\n return count(iterable);\n };\n Iterables.prototype.isEmpty_fakr2g$ = function (iterable) {\n var tmp$, tmp$_0, tmp$_1;\n return (tmp$_1 = (tmp$_0 = Kotlin.isType(tmp$ = iterable, Collection) ? tmp$ : null) != null ? tmp$_0.isEmpty() : null) != null ? tmp$_1 : !iterable.iterator().hasNext();\n };\n Iterables.prototype.filter_fpit1u$ = function (unfiltered, retainIfTrue) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = unfiltered.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (retainIfTrue(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n Iterables.prototype.all_fpit1u$ = function (iterable, predicate) {\n var all$result;\n all$break: do {\n var tmp$;\n if (Kotlin.isType(iterable, Collection) && iterable.isEmpty()) {\n all$result = true;\n break all$break;\n }tmp$ = iterable.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (!predicate(element)) {\n all$result = false;\n break all$break;\n }}\n all$result = true;\n }\n while (false);\n return all$result;\n };\n Iterables.prototype.concat_yxozss$ = function (a, b) {\n return plus_0(a, b);\n };\n Iterables.prototype.get_7iig3d$ = function (iterable, position) {\n var tmp$;\n this.checkNonNegative_0(position);\n if (Kotlin.isType(iterable, List)) {\n return (Kotlin.isType(tmp$ = iterable, List) ? tmp$ : throwCCE()).get_za3lpa$(position);\n }var it = iterable.iterator();\n for (var i = 0; i <= position; i++) {\n if (i === position) {\n return it.next();\n }it.next();\n }\n throw new IndexOutOfBoundsException(position.toString());\n };\n Iterables.prototype.get_dhabsj$ = function (iterable, position, defaultValue) {\n var tmp$;\n this.checkNonNegative_0(position);\n if (Kotlin.isType(iterable, List)) {\n var list = Kotlin.isType(tmp$ = iterable, List) ? tmp$ : throwCCE();\n return position < list.size ? list.get_za3lpa$(position) : defaultValue;\n }var it = iterable.iterator();\n var i = 0;\n while (i <= position && it.hasNext()) {\n if (i === position) {\n return it.next();\n }it.next();\n i = i + 1 | 0;\n }\n return defaultValue;\n };\n Iterables.prototype.find_nk18wc$ = function (iterable, predicate, defaultValue) {\n var tmp$;\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_0;\n tmp$_0 = iterable.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (predicate(element)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n return (tmp$ = firstOrNull$result) != null ? tmp$ : defaultValue;\n };\n Iterables.prototype.getLast_yl67zr$ = function (iterable) {\n return last_0(iterable);\n };\n Iterables.prototype.toArray_hjktyj$ = function (iterable) {\n var collection;\n if (Kotlin.isType(iterable, Collection)) {\n collection = iterable;\n } else {\n collection = toList(iterable);\n }\n return copyToArray(collection);\n };\n Iterables.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Iterables',\n interfaces: []\n };\n var Iterables_instance = null;\n function Iterables_getInstance() {\n if (Iterables_instance === null) {\n new Iterables();\n }return Iterables_instance;\n }\n function Lists() {\n Lists_instance = this;\n }\n Lists.prototype.transform_l7riir$ = function (fromList, function_0) {\n var destination = ArrayList_init_0(collectionSizeOrDefault(fromList, 10));\n var tmp$;\n tmp$ = fromList.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(function_0(item));\n }\n return destination;\n };\n Lists.prototype.reverse_bemo1h$ = function (list) {\n var copy = ArrayList_init_1(list);\n reverse(copy);\n return copy;\n };\n Lists.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Lists',\n interfaces: []\n };\n var Lists_instance = null;\n function Lists_getInstance() {\n if (Lists_instance === null) {\n new Lists();\n }return Lists_instance;\n }\n function Ordering() {\n Ordering$Companion_getInstance();\n }\n Ordering.prototype.isOrdered_p1ys8y$ = function (iterable) {\n var it = iterable.iterator();\n if (it.hasNext()) {\n var prev = it.next();\n while (it.hasNext()) {\n var next = it.next();\n if (this.compare(prev, next) > 0) {\n return false;\n }prev = next;\n }\n }return true;\n };\n function Ordering$sortedCopy$ObjectLiteral(this$Ordering) {\n this.this$Ordering = this$Ordering;\n }\n Ordering$sortedCopy$ObjectLiteral.prototype.compare = function (a, b) {\n return this.this$Ordering.compare(a, b);\n };\n Ordering$sortedCopy$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Comparator]\n };\n Ordering.prototype.sortedCopy_m5x2f4$ = function (elements) {\n var tmp$;\n var array = Kotlin.isArray(tmp$ = Iterables_getInstance().toArray_hjktyj$(elements)) ? tmp$ : throwCCE();\n sortWith(array, new Ordering$sortedCopy$ObjectLiteral(this));\n return toList_0(array);\n };\n Ordering.prototype.reverse = function () {\n return new ComparatorOrdering(reversed(this));\n };\n Ordering.prototype.min_t5quzl$ = function (a, b) {\n return this.compare(a, b) <= 0 ? a : b;\n };\n Ordering.prototype.min_m5x2f4$ = function (iterable) {\n return this.min_x5a2gs$(iterable.iterator());\n };\n Ordering.prototype.min_x5a2gs$ = function (iterator) {\n var result = iterator.next();\n while (iterator.hasNext()) {\n result = this.min_t5quzl$(result, iterator.next());\n }\n return result;\n };\n Ordering.prototype.max_t5quzl$ = function (a, b) {\n return this.compare(a, b) >= 0 ? a : b;\n };\n Ordering.prototype.max_m5x2f4$ = function (iterable) {\n return this.max_x5a2gs$(iterable.iterator());\n };\n Ordering.prototype.max_x5a2gs$ = function (iterator) {\n var result = iterator.next();\n while (iterator.hasNext()) {\n result = this.max_t5quzl$(result, iterator.next());\n }\n return result;\n };\n function Ordering$Companion() {\n Ordering$Companion_instance = this;\n }\n Ordering$Companion.prototype.from_iajr8b$ = function (comparator) {\n var tmp$;\n return Kotlin.isType(comparator, Ordering) ? Kotlin.isType(tmp$ = comparator, Ordering) ? tmp$ : throwCCE() : new ComparatorOrdering(comparator);\n };\n Ordering$Companion.prototype.natural_dahdeg$ = function () {\n return new ComparatorOrdering(naturalOrder());\n };\n Ordering$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Ordering$Companion_instance = null;\n function Ordering$Companion_getInstance() {\n if (Ordering$Companion_instance === null) {\n new Ordering$Companion();\n }return Ordering$Companion_instance;\n }\n Ordering.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Ordering',\n interfaces: [Comparator]\n };\n function Sets() {\n Sets_instance = this;\n }\n Sets.prototype.newHashSet_yl67zr$ = function (elements) {\n var tmp$;\n if (Kotlin.isType(elements, Collection)) {\n var collection = Kotlin.isType(tmp$ = elements, Collection) ? tmp$ : throwCCE();\n return HashSet_init(collection);\n }return this.newHashSet_0(elements.iterator());\n };\n Sets.prototype.newHashSet_0 = function (elements) {\n var set = HashSet_init_0();\n while (elements.hasNext()) {\n set.add_11rb$(elements.next());\n }\n return set;\n };\n Sets.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Sets',\n interfaces: []\n };\n var Sets_instance = null;\n function Sets_getInstance() {\n if (Sets_instance === null) {\n new Sets();\n }return Sets_instance;\n }\n function Stack() {\n this.elements_0 = ArrayList_init();\n }\n Stack.prototype.empty = function () {\n return this.elements_0.isEmpty();\n };\n Stack.prototype.push_11rb$ = function (item) {\n return this.elements_0.add_11rb$(item);\n };\n Stack.prototype.pop = function () {\n return this.elements_0.isEmpty() ? null : this.elements_0.removeAt_za3lpa$(this.elements_0.size - 1 | 0);\n };\n Stack.prototype.peek = function () {\n return lastOrNull(this.elements_0);\n };\n Stack.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Stack',\n interfaces: []\n };\n function TreeMap() {\n this.sortedKeys_0 = ArrayList_init();\n this.map_0 = HashMap_init_0();\n }\n Object.defineProperty(TreeMap.prototype, 'values', {\n configurable: true,\n get: function () {\n return this.map_0.values;\n }\n });\n TreeMap.prototype.get_mef7kx$ = function (key) {\n return this.map_0.get_11rb$(key);\n };\n TreeMap.prototype.put_ncwa5f$ = function (key, value) {\n var index = binarySearch(this.sortedKeys_0, key);\n if (index < 0) {\n this.sortedKeys_0.add_wxm5ur$(~index, key);\n } else {\n this.sortedKeys_0.set_wxm5ur$(index, key);\n }\n return this.map_0.put_xwzc9p$(key, value);\n };\n TreeMap.prototype.containsKey_mef7kx$ = function (key) {\n return this.map_0.containsKey_11rb$(key);\n };\n TreeMap.prototype.floorKey_mef7kx$ = function (key) {\n var index = binarySearch(this.sortedKeys_0, key);\n if (index < 0) {\n index = ~index - 1 | 0;\n if (index < 0)\n return null;\n }return this.sortedKeys_0.get_za3lpa$(index);\n };\n TreeMap.prototype.ceilingKey_mef7kx$ = function (key) {\n var index = binarySearch(this.sortedKeys_0, key);\n if (index < 0) {\n index = ~index;\n if (index === this.sortedKeys_0.size)\n return null;\n }return this.sortedKeys_0.get_za3lpa$(index);\n };\n TreeMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TreeMap',\n interfaces: []\n };\n function DoubleRectangle(origin, dimension) {\n DoubleRectangle$Companion_getInstance();\n this.origin = origin;\n this.dimension = dimension;\n }\n Object.defineProperty(DoubleRectangle.prototype, 'center', {\n configurable: true,\n get: function () {\n return this.origin.add_gpjtzr$(this.dimension.mul_14dthe$(0.5));\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'left', {\n configurable: true,\n get: function () {\n return this.origin.x;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'right', {\n configurable: true,\n get: function () {\n return this.origin.x + this.dimension.x;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'top', {\n configurable: true,\n get: function () {\n return this.origin.y;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'bottom', {\n configurable: true,\n get: function () {\n return this.origin.y + this.dimension.y;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'width', {\n configurable: true,\n get: function () {\n return this.dimension.x;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'height', {\n configurable: true,\n get: function () {\n return this.dimension.y;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'parts', {\n configurable: true,\n get: function () {\n var result = ArrayList_init();\n result.add_11rb$(new DoubleSegment(this.origin, this.origin.add_gpjtzr$(new DoubleVector(this.dimension.x, 0.0))));\n result.add_11rb$(new DoubleSegment(this.origin, this.origin.add_gpjtzr$(new DoubleVector(0.0, this.dimension.y))));\n result.add_11rb$(new DoubleSegment(this.origin.add_gpjtzr$(this.dimension), this.origin.add_gpjtzr$(new DoubleVector(this.dimension.x, 0.0))));\n result.add_11rb$(new DoubleSegment(this.origin.add_gpjtzr$(this.dimension), this.origin.add_gpjtzr$(new DoubleVector(0.0, this.dimension.y))));\n return result;\n }\n });\n DoubleRectangle.prototype.xRange = function () {\n return new ClosedRange(this.origin.x, this.origin.x + this.dimension.x);\n };\n DoubleRectangle.prototype.yRange = function () {\n return new ClosedRange(this.origin.y, this.origin.y + this.dimension.y);\n };\n DoubleRectangle.prototype.contains_gpjtzr$ = function (v) {\n return this.origin.x <= v.x && this.origin.x + this.dimension.x >= v.x && this.origin.y <= v.y && this.origin.y + this.dimension.y >= v.y;\n };\n DoubleRectangle.prototype.union_wthzt5$ = function (rect) {\n var newOrigin = this.origin.min_gpjtzr$(rect.origin);\n var corner = this.origin.add_gpjtzr$(this.dimension);\n var rectCorner = rect.origin.add_gpjtzr$(rect.dimension);\n var newCorner = corner.max_gpjtzr$(rectCorner);\n var newDimension = newCorner.subtract_gpjtzr$(newOrigin);\n return new DoubleRectangle(newOrigin, newDimension);\n };\n DoubleRectangle.prototype.intersects_wthzt5$ = function (rect) {\n var t1 = this.origin;\n var t2 = this.origin.add_gpjtzr$(this.dimension);\n var r1 = rect.origin;\n var r2 = rect.origin.add_gpjtzr$(rect.dimension);\n return r2.x >= t1.x && t2.x >= r1.x && r2.y >= t1.y && t2.y >= r1.y;\n };\n DoubleRectangle.prototype.intersect_wthzt5$ = function (r) {\n var tmp$;\n var t1 = this.origin;\n var t2 = this.origin.add_gpjtzr$(this.dimension);\n var r1 = r.origin;\n var r2 = r.origin.add_gpjtzr$(r.dimension);\n var res1 = t1.max_gpjtzr$(r1);\n var res2 = t2.min_gpjtzr$(r2);\n var dim = res2.subtract_gpjtzr$(res1);\n if (dim.x < 0 || dim.y < 0) {\n tmp$ = null;\n } else\n tmp$ = new DoubleRectangle(res1, dim);\n return tmp$;\n };\n DoubleRectangle.prototype.add_gpjtzr$ = function (v) {\n return new DoubleRectangle(this.origin.add_gpjtzr$(v), this.dimension);\n };\n DoubleRectangle.prototype.subtract_gpjtzr$ = function (v) {\n return new DoubleRectangle(this.origin.subtract_gpjtzr$(v), this.dimension);\n };\n DoubleRectangle.prototype.distance_gpjtzr$ = function (to) {\n var tmp$;\n var result = 0.0;\n var hasResult = false;\n tmp$ = this.parts.iterator();\n while (tmp$.hasNext()) {\n var s = tmp$.next();\n if (!hasResult) {\n result = s.distance_gpjtzr$(to);\n hasResult = true;\n } else {\n var distance = s.distance_gpjtzr$(to);\n if (distance < result) {\n result = distance;\n }}\n }\n return result;\n };\n DoubleRectangle.prototype.hashCode = function () {\n return (this.origin.hashCode() * 31 | 0) + this.dimension.hashCode() | 0;\n };\n DoubleRectangle.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, DoubleRectangle)) {\n return false;\n }var r = (tmp$ = other) == null || Kotlin.isType(tmp$, DoubleRectangle) ? tmp$ : throwCCE();\n return ensureNotNull(r).origin.equals(this.origin) && r.dimension.equals(this.dimension);\n };\n DoubleRectangle.prototype.toString = function () {\n return '[rect ' + this.origin + ', ' + this.dimension + ']';\n };\n function DoubleRectangle$Companion() {\n DoubleRectangle$Companion_instance = this;\n }\n DoubleRectangle$Companion.prototype.span_qt8ska$ = function (leftTop, rightBottom) {\n return new DoubleRectangle(leftTop, rightBottom.subtract_gpjtzr$(leftTop));\n };\n DoubleRectangle$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DoubleRectangle$Companion_instance = null;\n function DoubleRectangle$Companion_getInstance() {\n if (DoubleRectangle$Companion_instance === null) {\n new DoubleRectangle$Companion();\n }return DoubleRectangle$Companion_instance;\n }\n DoubleRectangle.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleRectangle',\n interfaces: []\n };\n function DoubleRectangle_init(x, y, w, h, $this) {\n $this = $this || Object.create(DoubleRectangle.prototype);\n DoubleRectangle.call($this, new DoubleVector(x, y), new DoubleVector(w, h));\n return $this;\n }\n function DoubleRectangles() {\n DoubleRectangles_instance = this;\n }\n function DoubleRectangles$boundingBox$lambda(minX, minY, maxX, maxY) {\n return DoubleRectangle$Companion_getInstance().span_qt8ska$(new DoubleVector(minX, minY), new DoubleVector(maxX, maxY));\n }\n DoubleRectangles.prototype.boundingBox_qdtdbw$ = function (points) {\n return this.calculateBoundingBox_h5l7ap$(points, getPropertyCallableRef('x', 1, function ($receiver) {\n return $receiver.x;\n }), getPropertyCallableRef('y', 1, function ($receiver) {\n return $receiver.y;\n }), DoubleRectangles$boundingBox$lambda);\n };\n DoubleRectangles.prototype.calculateBoundingBox_h5l7ap$ = function (points, getX, getY, factory) {\n var tmp$;\n var first = points.iterator().next();\n var minLon = getX(first);\n var minLat = getY(first);\n var maxLon = minLon;\n var maxLat = minLat;\n tmp$ = points.iterator();\n while (tmp$.hasNext()) {\n var point = tmp$.next();\n var a = minLon;\n var b = getX(point);\n minLon = JsMath.min(a, b);\n var a_0 = maxLon;\n var b_0 = getX(point);\n maxLon = JsMath.max(a_0, b_0);\n var a_1 = minLat;\n var b_1 = getY(point);\n minLat = JsMath.min(a_1, b_1);\n var a_2 = maxLat;\n var b_2 = getY(point);\n maxLat = JsMath.max(a_2, b_2);\n }\n return factory(minLon, minLat, maxLon, maxLat);\n };\n DoubleRectangles.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DoubleRectangles',\n interfaces: []\n };\n var DoubleRectangles_instance = null;\n function DoubleRectangles_getInstance() {\n if (DoubleRectangles_instance === null) {\n new DoubleRectangles();\n }return DoubleRectangles_instance;\n }\n function DoubleSegment(start, end) {\n this.start = start;\n this.end = end;\n }\n DoubleSegment.prototype.distance_gpjtzr$ = function (v) {\n var vs = this.start.subtract_gpjtzr$(v);\n var ve = this.end.subtract_gpjtzr$(v);\n if (this.isDistanceToLineBest_0(v)) {\n var x = vs.x * ve.y - vs.y * ve.x;\n var pVolume = JsMath.abs(x);\n return pVolume / this.length();\n } else {\n var a = vs.length();\n var b = ve.length();\n return JsMath.min(a, b);\n }\n };\n DoubleSegment.prototype.isDistanceToLineBest_0 = function (v) {\n var es = this.start.subtract_gpjtzr$(this.end);\n var se = es.negate();\n var ev = v.subtract_gpjtzr$(this.end);\n var sv = v.subtract_gpjtzr$(this.start);\n return es.dotProduct_gpjtzr$(ev) >= 0 && se.dotProduct_gpjtzr$(sv) >= 0;\n };\n DoubleSegment.prototype.intersection_69p9e5$ = function (with_0) {\n var tmp$;\n var o1 = this.start;\n var o2 = with_0.start;\n var d1 = this.end.subtract_gpjtzr$(this.start);\n var d2 = with_0.end.subtract_gpjtzr$(with_0.start);\n var td = d1.dotProduct_gpjtzr$(d2.orthogonal());\n if (td === 0.0) {\n return null;\n }var t = o2.subtract_gpjtzr$(o1).dotProduct_gpjtzr$(d2.orthogonal()) / td;\n if (t < 0 || t > 1) {\n return null;\n }var sd = d2.dotProduct_gpjtzr$(d1.orthogonal());\n var s = o1.subtract_gpjtzr$(o2).dotProduct_gpjtzr$(d1.orthogonal()) / sd;\n if (s < 0 || s > 1) {\n tmp$ = null;\n } else\n tmp$ = o1.add_gpjtzr$(d1.mul_14dthe$(t));\n return tmp$;\n };\n DoubleSegment.prototype.length = function () {\n return this.start.subtract_gpjtzr$(this.end).length();\n };\n DoubleSegment.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, DoubleSegment)) {\n return false;\n }var l = (tmp$ = other) == null || Kotlin.isType(tmp$, DoubleSegment) ? tmp$ : throwCCE();\n return ensureNotNull(l).start.equals(this.start) && l.end.equals(this.end);\n };\n DoubleSegment.prototype.hashCode = function () {\n return (this.start.hashCode() * 31 | 0) + this.end.hashCode() | 0;\n };\n DoubleSegment.prototype.toString = function () {\n return '[' + this.start + ' -> ' + this.end + ']';\n };\n DoubleSegment.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleSegment',\n interfaces: []\n };\n function DoubleVector(x, y) {\n DoubleVector$Companion_getInstance();\n this.x = x;\n this.y = y;\n }\n DoubleVector.prototype.add_gpjtzr$ = function (v) {\n return new DoubleVector(this.x + v.x, this.y + v.y);\n };\n DoubleVector.prototype.subtract_gpjtzr$ = function (v) {\n return new DoubleVector(this.x - v.x, this.y - v.y);\n };\n DoubleVector.prototype.max_gpjtzr$ = function (v) {\n var a = this.x;\n var b = v.x;\n var tmp$ = JsMath.max(a, b);\n var a_0 = this.y;\n var b_0 = v.y;\n return new DoubleVector(tmp$, JsMath.max(a_0, b_0));\n };\n DoubleVector.prototype.min_gpjtzr$ = function (v) {\n var a = this.x;\n var b = v.x;\n var tmp$ = JsMath.min(a, b);\n var a_0 = this.y;\n var b_0 = v.y;\n return new DoubleVector(tmp$, JsMath.min(a_0, b_0));\n };\n DoubleVector.prototype.mul_14dthe$ = function (value) {\n return new DoubleVector(this.x * value, this.y * value);\n };\n DoubleVector.prototype.dotProduct_gpjtzr$ = function (v) {\n return this.x * v.x + this.y * v.y;\n };\n DoubleVector.prototype.negate = function () {\n return new DoubleVector(-this.x, -this.y);\n };\n DoubleVector.prototype.orthogonal = function () {\n return new DoubleVector(-this.y, this.x);\n };\n DoubleVector.prototype.length = function () {\n var x = this.x * this.x + this.y * this.y;\n return JsMath.sqrt(x);\n };\n DoubleVector.prototype.normalize = function () {\n return this.mul_14dthe$(1 / this.length());\n };\n DoubleVector.prototype.rotate_14dthe$ = function (phi) {\n var x = this.x * JsMath.cos(phi) - this.y * JsMath.sin(phi);\n var y = this.x * JsMath.sin(phi) + this.y * JsMath.cos(phi);\n return new DoubleVector(x, y);\n };\n DoubleVector.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, DoubleVector)) {\n return false;\n }var v = (tmp$ = other) == null || Kotlin.isType(tmp$, DoubleVector) ? tmp$ : throwCCE();\n return ensureNotNull(v).x === this.x && v.y === this.y;\n };\n DoubleVector.prototype.hashCode = function () {\n return hashCode(this.x) + (31 * hashCode(this.y) | 0) | 0;\n };\n DoubleVector.prototype.toString = function () {\n return '(' + this.x + ', ' + this.y + ')';\n };\n function DoubleVector$Companion() {\n DoubleVector$Companion_instance = this;\n this.ZERO = new DoubleVector(0.0, 0.0);\n }\n DoubleVector$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DoubleVector$Companion_instance = null;\n function DoubleVector$Companion_getInstance() {\n if (DoubleVector$Companion_instance === null) {\n new DoubleVector$Companion();\n }return DoubleVector$Companion_instance;\n }\n DoubleVector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleVector',\n interfaces: []\n };\n function Rectangle(origin, dimension) {\n this.origin = origin;\n this.dimension = dimension;\n }\n Object.defineProperty(Rectangle.prototype, 'boundSegments', {\n configurable: true,\n get: function () {\n var p = this.boundPoints_0;\n return [new Segment(p[0], p[1]), new Segment(p[1], p[2]), new Segment(p[2], p[3]), new Segment(p[3], p[0])];\n }\n });\n Object.defineProperty(Rectangle.prototype, 'boundPoints_0', {\n configurable: true,\n get: function () {\n return [this.origin, this.origin.add_119tl4$(new Vector(this.dimension.x, 0)), this.origin.add_119tl4$(this.dimension), this.origin.add_119tl4$(new Vector(0, this.dimension.y))];\n }\n });\n Rectangle.prototype.add_119tl4$ = function (v) {\n return new Rectangle(this.origin.add_119tl4$(v), this.dimension);\n };\n Rectangle.prototype.sub_119tl4$ = function (v) {\n return new Rectangle(this.origin.sub_119tl4$(v), this.dimension);\n };\n Rectangle.prototype.contains_vfns7u$ = function (r) {\n return this.contains_119tl4$(r.origin) && this.contains_119tl4$(r.origin.add_119tl4$(r.dimension));\n };\n Rectangle.prototype.contains_119tl4$ = function (v) {\n return this.origin.x <= v.x && (this.origin.x + this.dimension.x | 0) >= v.x && this.origin.y <= v.y && (this.origin.y + this.dimension.y | 0) >= v.y;\n };\n Rectangle.prototype.union_vfns7u$ = function (rect) {\n var newOrigin = this.origin.min_119tl4$(rect.origin);\n var corner = this.origin.add_119tl4$(this.dimension);\n var rectCorner = rect.origin.add_119tl4$(rect.dimension);\n var newCorner = corner.max_119tl4$(rectCorner);\n var newDimension = newCorner.sub_119tl4$(newOrigin);\n return new Rectangle(newOrigin, newDimension);\n };\n Rectangle.prototype.intersects_vfns7u$ = function (rect) {\n var t1 = this.origin;\n var t2 = this.origin.add_119tl4$(this.dimension);\n var r1 = rect.origin;\n var r2 = rect.origin.add_119tl4$(rect.dimension);\n return r2.x >= t1.x && t2.x >= r1.x && r2.y >= t1.y && t2.y >= r1.y;\n };\n Rectangle.prototype.intersect_vfns7u$ = function (r) {\n if (!this.intersects_vfns7u$(r)) {\n throw IllegalStateException_init('rectangle [' + this + \"] doesn't intersect [\" + r + ']');\n }var too = this.origin.add_119tl4$(this.dimension);\n var roo = r.origin.add_119tl4$(r.dimension);\n var ioo = too.min_119tl4$(roo);\n var io = this.origin.max_119tl4$(r.origin);\n return new Rectangle(io, ioo.sub_119tl4$(io));\n };\n Rectangle.prototype.innerIntersects_vfns7u$ = function (rect) {\n var t1 = this.origin;\n var t2 = this.origin.add_119tl4$(this.dimension);\n var r1 = rect.origin;\n var r2 = rect.origin.add_119tl4$(rect.dimension);\n return r2.x > t1.x && t2.x > r1.x && r2.y > t1.y && t2.y > r1.y;\n };\n Rectangle.prototype.changeDimension_119tl4$ = function (dim) {\n return new Rectangle(this.origin, dim);\n };\n Rectangle.prototype.distance_119tl4$ = function (to) {\n return this.toDoubleRectangle_0().distance_gpjtzr$(to.toDoubleVector());\n };\n Rectangle.prototype.xRange = function () {\n return new ClosedRange(this.origin.x, this.origin.x + this.dimension.x | 0);\n };\n Rectangle.prototype.yRange = function () {\n return new ClosedRange(this.origin.y, this.origin.y + this.dimension.y | 0);\n };\n Rectangle.prototype.hashCode = function () {\n return (this.origin.hashCode() * 31 | 0) + this.dimension.hashCode() | 0;\n };\n Rectangle.prototype.equals = function (other) {\n var tmp$, tmp$_0, tmp$_1;\n if (!Kotlin.isType(other, Rectangle))\n return false;\n var otherRect = (tmp$ = other) == null || Kotlin.isType(tmp$, Rectangle) ? tmp$ : throwCCE();\n return ((tmp$_0 = this.origin) != null ? tmp$_0.equals(ensureNotNull(otherRect).origin) : null) && ((tmp$_1 = this.dimension) != null ? tmp$_1.equals(otherRect.dimension) : null);\n };\n Rectangle.prototype.toDoubleRectangle_0 = function () {\n return new DoubleRectangle(this.origin.toDoubleVector(), this.dimension.toDoubleVector());\n };\n Rectangle.prototype.center = function () {\n return this.origin.add_119tl4$(new Vector(this.dimension.x / 2 | 0, this.dimension.y / 2 | 0));\n };\n Rectangle.prototype.toString = function () {\n return this.origin.toString() + ' - ' + this.dimension;\n };\n Rectangle.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Rectangle',\n interfaces: []\n };\n function Rectangle_init(x, y, width, height, $this) {\n $this = $this || Object.create(Rectangle.prototype);\n Rectangle.call($this, new Vector(x, y), new Vector(width, height));\n return $this;\n }\n function Rectangles() {\n Rectangles_instance = this;\n }\n Rectangles.prototype.zeroOrigin_vfns7u$ = function (r) {\n return new Rectangle(Vector$Companion_getInstance().ZERO, r.dimension);\n };\n Rectangles.prototype.upperDistance_w66x3o$ = function (inner, outer) {\n this.assertOuterInner_0(outer, inner);\n return this.topLeft_0(inner).y - this.topLeft_0(outer).y | 0;\n };\n Rectangles.prototype.lowerDistance_w66x3o$ = function (inner, outer) {\n this.assertOuterInner_0(outer, inner);\n return this.bottomLeft_0(outer).y - this.bottomLeft_0(inner).y | 0;\n };\n Rectangles.prototype.leftDistance_w66x3o$ = function (inner, outer) {\n this.assertOuterInner_0(outer, inner);\n return this.topLeft_0(inner).x - this.topLeft_0(outer).x | 0;\n };\n Rectangles.prototype.rightDistance_w66x3o$ = function (inner, outer) {\n this.assertOuterInner_0(outer, inner);\n return this.topRight_vfns7u$(outer).x - this.topRight_vfns7u$(inner).x | 0;\n };\n Rectangles.prototype.assertOuterInner_0 = function (outer, inner) {\n if (!outer.contains_vfns7u$(inner)) {\n throw IllegalArgumentException_init('Outer does not contain inner: outer = ' + outer + ', inner = ' + inner);\n }};\n Rectangles.prototype.extendUp_o8ajws$ = function (r, distance) {\n var change = new Vector(0, distance);\n return new Rectangle(r.origin.sub_119tl4$(change), r.dimension.add_119tl4$(change));\n };\n Rectangles.prototype.extendDown_o8ajws$ = function (r, distance) {\n return r.changeDimension_119tl4$(r.dimension.add_119tl4$(new Vector(0, distance)));\n };\n Rectangles.prototype.extendLeft_o8ajws$ = function (r, distance) {\n var change = new Vector(distance, 0);\n return new Rectangle(r.origin.sub_119tl4$(change), r.dimension.add_119tl4$(change));\n };\n Rectangles.prototype.extendRight_o8ajws$ = function (r, distance) {\n return r.changeDimension_119tl4$(r.dimension.add_119tl4$(new Vector(distance, 0)));\n };\n Rectangles.prototype.extendSides_ogcnvu$ = function (left, r, right) {\n return this.extendRight_o8ajws$(this.extendLeft_o8ajws$(r, left), right);\n };\n Rectangles.prototype.shrinkRight_o8ajws$ = function (r, distance) {\n if (r.dimension.x < distance) {\n throw IllegalArgumentException_init('To small rectangle = ' + r + ', distance = ' + distance);\n }return r.changeDimension_119tl4$(r.dimension.sub_119tl4$(new Vector(distance, 0)));\n };\n Rectangles.prototype.topLeft_0 = function (r) {\n return r.origin;\n };\n Rectangles.prototype.topRight_vfns7u$ = function (r) {\n return r.origin.add_119tl4$(new Vector(r.dimension.x, 0));\n };\n Rectangles.prototype.bottomLeft_0 = function (r) {\n return r.origin.add_119tl4$(new Vector(0, r.dimension.y));\n };\n Rectangles.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Rectangles',\n interfaces: []\n };\n var Rectangles_instance = null;\n function Rectangles_getInstance() {\n if (Rectangles_instance === null) {\n new Rectangles();\n }return Rectangles_instance;\n }\n function Segment(start, end) {\n this.start = start;\n this.end = end;\n }\n Segment.prototype.distance_119tl4$ = function (v) {\n var vs = this.start.sub_119tl4$(v);\n var ve = this.end.sub_119tl4$(v);\n if (this.isDistanceToLineBest_0(v)) {\n var pVolume = abs(Kotlin.imul(vs.x, ve.y) - Kotlin.imul(vs.y, ve.x) | 0);\n return pVolume / this.length();\n } else {\n var a = vs.toDoubleVector().length();\n var b = ve.toDoubleVector().length();\n return JsMath.min(a, b);\n }\n };\n Segment.prototype.isDistanceToLineBest_0 = function (v) {\n var es = this.start.sub_119tl4$(this.end);\n var se = es.negate();\n var ev = v.sub_119tl4$(this.end);\n var sv = v.sub_119tl4$(this.start);\n return es.dotProduct_119tl4$(ev) >= 0 && se.dotProduct_119tl4$(sv) >= 0;\n };\n Segment.prototype.toDoubleSegment = function () {\n return new DoubleSegment(this.start.toDoubleVector(), this.end.toDoubleVector());\n };\n Segment.prototype.intersection_51grtu$ = function (with_0) {\n return this.toDoubleSegment().intersection_69p9e5$(with_0.toDoubleSegment());\n };\n Segment.prototype.length = function () {\n return this.start.sub_119tl4$(this.end).length();\n };\n Segment.prototype.contains_119tl4$ = function (v) {\n var tmp$;\n var p1 = v.sub_119tl4$(this.start);\n var p2 = v.sub_119tl4$(this.end);\n if (p1.isParallel_119tl4$(p2)) {\n tmp$ = p1.dotProduct_119tl4$(p2) <= 0;\n } else\n tmp$ = false;\n return tmp$;\n };\n Segment.prototype.equals = function (other) {\n var tmp$, tmp$_0, tmp$_1;\n if (!Kotlin.isType(other, Segment)) {\n return false;\n }var l = (tmp$ = other) == null || Kotlin.isType(tmp$, Segment) ? tmp$ : throwCCE();\n return ((tmp$_0 = ensureNotNull(l).start) != null ? tmp$_0.equals(this.start) : null) && ((tmp$_1 = l.end) != null ? tmp$_1.equals(this.end) : null);\n };\n Segment.prototype.hashCode = function () {\n return (this.start.hashCode() * 31 | 0) + this.end.hashCode() | 0;\n };\n Segment.prototype.toString = function () {\n return '[' + this.start + ' -> ' + this.end + ']';\n };\n Segment.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Segment',\n interfaces: []\n };\n function Vector(x, y) {\n Vector$Companion_getInstance();\n this.x = x;\n this.y = y;\n }\n function Vector$Companion() {\n Vector$Companion_instance = this;\n this.ZERO = new Vector(0, 0);\n }\n Vector$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Vector$Companion_instance = null;\n function Vector$Companion_getInstance() {\n if (Vector$Companion_instance === null) {\n new Vector$Companion();\n }return Vector$Companion_instance;\n }\n Vector.prototype.add_119tl4$ = function (v) {\n return new Vector(this.x + v.x | 0, this.y + v.y | 0);\n };\n Vector.prototype.sub_119tl4$ = function (v) {\n return this.add_119tl4$(v.negate());\n };\n Vector.prototype.negate = function () {\n return new Vector(-this.x | 0, -this.y | 0);\n };\n Vector.prototype.max_119tl4$ = function (v) {\n var a = this.x;\n var b = v.x;\n var tmp$ = JsMath.max(a, b);\n var a_0 = this.y;\n var b_0 = v.y;\n return new Vector(tmp$, JsMath.max(a_0, b_0));\n };\n Vector.prototype.min_119tl4$ = function (v) {\n var a = this.x;\n var b = v.x;\n var tmp$ = JsMath.min(a, b);\n var a_0 = this.y;\n var b_0 = v.y;\n return new Vector(tmp$, JsMath.min(a_0, b_0));\n };\n Vector.prototype.mul_za3lpa$ = function (i) {\n return new Vector(Kotlin.imul(this.x, i), Kotlin.imul(this.y, i));\n };\n Vector.prototype.div_za3lpa$ = function (i) {\n return new Vector(this.x / i | 0, this.y / i | 0);\n };\n Vector.prototype.dotProduct_119tl4$ = function (v) {\n return Kotlin.imul(this.x, v.x) + Kotlin.imul(this.y, v.y) | 0;\n };\n Vector.prototype.length = function () {\n var x = Kotlin.imul(this.x, this.x) + Kotlin.imul(this.y, this.y) | 0;\n return JsMath.sqrt(x);\n };\n Vector.prototype.toDoubleVector = function () {\n return new DoubleVector(this.x, this.y);\n };\n Vector.prototype.abs = function () {\n return new Vector(abs(this.x), abs(this.y));\n };\n Vector.prototype.isParallel_119tl4$ = function (to) {\n return (Kotlin.imul(this.x, to.y) - Kotlin.imul(to.x, this.y) | 0) === 0;\n };\n Vector.prototype.orthogonal = function () {\n return new Vector(-this.y | 0, this.x);\n };\n Vector.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, Vector))\n return false;\n var otherVector = (tmp$ = other) == null || Kotlin.isType(tmp$, Vector) ? tmp$ : throwCCE();\n return this.x === ensureNotNull(otherVector).x && this.y === otherVector.y;\n };\n Vector.prototype.hashCode = function () {\n return (this.x * 31 | 0) + this.y | 0;\n };\n Vector.prototype.toString = function () {\n return '(' + this.x + ', ' + this.y + ')';\n };\n Vector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Vector',\n interfaces: []\n };\n function JsObjectSupport() {\n JsObjectSupport_instance = this;\n }\n function JsObjectSupport$mapToJsObjectInitializer$lambda(it) {\n return Unit;\n }\n function JsObjectSupport$mapToJsObjectInitializer$lambda_0(closure$buffer, closure$handleValue) {\n return function (list) {\n var tmp$;\n closure$buffer.append_s8itvh$(91);\n var first = true;\n tmp$ = list.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (!first)\n closure$buffer.append_s8itvh$(44);\n else\n first = false;\n closure$handleValue.v(v);\n }\n return closure$buffer.append_s8itvh$(93);\n };\n }\n function JsObjectSupport$mapToJsObjectInitializer$lambda_1(closure$buffer, closure$handleValue) {\n return function (map) {\n var tmp$, tmp$_0, tmp$_1;\n closure$buffer.append_s8itvh$(123);\n var first = true;\n tmp$ = map.entries.iterator();\n while (tmp$.hasNext()) {\n var tmp$_2 = tmp$.next();\n var k = tmp$_2.key;\n var v = tmp$_2.value;\n if ((typeof (tmp$_0 = k) === 'string' ? tmp$_0 : null) == null) {\n throw IllegalArgumentException_init('Only `string` keys are supported, was: ' + ((tmp$_1 = Kotlin.getKClassFromExpression(ensureNotNull(k)).simpleName) != null ? tmp$_1 : 'no class name'));\n }if (!first)\n closure$buffer.append_s8itvh$(44);\n else\n first = false;\n closure$buffer.append_s8itvh$(10);\n closure$buffer.append_s8itvh$(34).append_pdl1vj$(escape(k)).append_s8itvh$(34).append_s8itvh$(58);\n closure$handleValue.v(v);\n }\n return closure$buffer.append_pdl1vj$('\\n}');\n };\n }\n function JsObjectSupport$mapToJsObjectInitializer$lambda_2(closure$buffer, closure$handleList, closure$handleMap) {\n return function (v) {\n if (typeof v === 'string')\n closure$buffer.append_s8itvh$(34).append_pdl1vj$(escape(v)).append_s8itvh$(34);\n else if (typeof v === 'boolean' || Kotlin.isNumber(v))\n closure$buffer.append_s8jyv4$(v);\n else if (v == null)\n closure$buffer.append_pdl1vj$('null');\n else if (Kotlin.isArray(v))\n closure$handleList(asList(v));\n else if (Kotlin.isType(v, List))\n closure$handleList(v);\n else if (Kotlin.isType(v, Map))\n closure$handleMap(v);\n else\n throw IllegalArgumentException_init(\"Can't serialize object \" + toString(v));\n return Unit;\n };\n }\n JsObjectSupport.prototype.mapToJsObjectInitializer_6uu7i0$ = function (map) {\n var buffer = StringBuilder_init();\n var handleValue = {v: JsObjectSupport$mapToJsObjectInitializer$lambda};\n var handleList = JsObjectSupport$mapToJsObjectInitializer$lambda_0(buffer, handleValue);\n var handleMap = JsObjectSupport$mapToJsObjectInitializer$lambda_1(buffer, handleValue);\n handleValue.v = JsObjectSupport$mapToJsObjectInitializer$lambda_2(buffer, handleList, handleMap);\n handleMap(map);\n return buffer.toString();\n };\n JsObjectSupport.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'JsObjectSupport',\n interfaces: []\n };\n var JsObjectSupport_instance = null;\n function JsObjectSupport_getInstance() {\n if (JsObjectSupport_instance === null) {\n new JsObjectSupport();\n }return JsObjectSupport_instance;\n }\n function FluentArray() {\n this.myArray_0 = null;\n }\n FluentArray.prototype.getDouble_za3lpa$ = function (index) {\n var tmp$;\n return typeof (tmp$ = this.myArray_0.get_za3lpa$(index)) === 'number' ? tmp$ : throwCCE();\n };\n FluentArray.prototype.add_pdl1vj$ = function (v) {\n this.myArray_0.add_11rb$(v);\n return this;\n };\n FluentArray.prototype.add_yrwdxb$ = function (v) {\n this.myArray_0.add_11rb$(v);\n return this;\n };\n FluentArray.prototype.addStrings_d294za$ = function (values) {\n this.myArray_0.addAll_brywnq$(values);\n return this;\n };\n FluentArray.prototype.addAll_5ry1at$ = function (values) {\n var tmp$;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.myArray_0.add_11rb$(element.get());\n }\n return this;\n };\n FluentArray.prototype.addAll_m5dwgt$ = function (values) {\n this.addAll_5ry1at$(listOf(values.slice()));\n return this;\n };\n FluentArray.prototype.stream = function () {\n return streamOf(this.myArray_0);\n };\n FluentArray.prototype.objectStream = function () {\n return objectsStreamOf(this.myArray_0);\n };\n FluentArray.prototype.fluentObjectStream = function () {\n return map(objectsStreamOf(this.myArray_0), getCallableRef('FluentObject', function (p1) {\n return FluentObject_init(p1);\n }));\n };\n FluentArray.prototype.get = function () {\n return this.myArray_0;\n };\n FluentArray.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FluentArray',\n interfaces: [FluentValue]\n };\n function FluentArray_init($this) {\n $this = $this || Object.create(FluentArray.prototype);\n FluentValue.call($this);\n FluentArray.call($this);\n $this.myArray_0 = ArrayList_init();\n return $this;\n }\n function FluentArray_init_0(array, $this) {\n $this = $this || Object.create(FluentArray.prototype);\n FluentValue.call($this);\n FluentArray.call($this);\n $this.myArray_0 = ArrayList_init_1(array);\n return $this;\n }\n function FluentObject() {\n this.myObj_0 = null;\n }\n FluentObject.prototype.getArr_0 = function (key) {\n var tmp$;\n return Kotlin.isType(tmp$ = this.myObj_0.get_11rb$(key), List) ? tmp$ : throwCCE();\n };\n FluentObject.prototype.getObj_0 = function (key) {\n var tmp$;\n return Kotlin.isType(tmp$ = this.myObj_0.get_11rb$(key), Map) ? tmp$ : throwCCE();\n };\n FluentObject.prototype.get = function () {\n return this.myObj_0;\n };\n FluentObject.prototype.contains_61zpoe$ = function (key) {\n return this.myObj_0.containsKey_11rb$(key);\n };\n FluentObject.prototype.containsNotNull_0 = function (key) {\n return this.contains_61zpoe$(key) && this.myObj_0.get_11rb$(key) != null;\n };\n FluentObject.prototype.put_wxs67v$ = function (key, v) {\n var $receiver = this.myObj_0;\n var value = v != null ? v.get() : null;\n $receiver.put_xwzc9p$(key, value);\n return this;\n };\n FluentObject.prototype.put_jyasbz$ = function (key, v) {\n this.myObj_0.put_xwzc9p$(key, v);\n return this;\n };\n FluentObject.prototype.put_hzlfav$ = function (key, v) {\n this.myObj_0.put_xwzc9p$(key, v);\n return this;\n };\n FluentObject.prototype.put_h92gdm$ = function (key, v) {\n this.myObj_0.put_xwzc9p$(key, v);\n return this;\n };\n FluentObject.prototype.put_snuhza$ = function (key, v) {\n var tmp$ = this.myObj_0;\n var value = v != null ? formatEnum(v) : null;\n tmp$.put_xwzc9p$(key, value);\n return this;\n };\n FluentObject.prototype.getInt_61zpoe$ = function (key) {\n return numberToInt(getNumber(this.myObj_0, key));\n };\n FluentObject.prototype.getDouble_61zpoe$ = function (key) {\n return getDouble(this.myObj_0, key);\n };\n FluentObject.prototype.getBoolean_61zpoe$ = function (key) {\n var tmp$;\n return typeof (tmp$ = this.myObj_0.get_11rb$(key)) === 'boolean' ? tmp$ : throwCCE();\n };\n FluentObject.prototype.getString_61zpoe$ = function (key) {\n var tmp$;\n return typeof (tmp$ = this.myObj_0.get_11rb$(key)) === 'string' ? tmp$ : throwCCE();\n };\n FluentObject.prototype.getStrings_61zpoe$ = function (key) {\n var $receiver = this.getArr_0(key);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(getAsString(item));\n }\n return destination;\n };\n FluentObject.prototype.getEnum_xwn52g$ = function (key, enumValues) {\n var tmp$;\n return parseEnum(typeof (tmp$ = this.myObj_0.get_11rb$(key)) === 'string' ? tmp$ : throwCCE(), enumValues);\n };\n FluentObject.prototype.getEnum_a9gw98$ = defineInlineFunction('lets-plot-base-portable.jetbrains.datalore.base.json.FluentObject.getEnum_a9gw98$', function (T_0, isT, key) {\n return this.getEnum_xwn52g$(key, T_0.values());\n });\n FluentObject.prototype.getArray_61zpoe$ = function (key) {\n return FluentArray_init_0(this.getArr_0(key));\n };\n FluentObject.prototype.getObject_61zpoe$ = function (key) {\n return FluentObject_init(this.getObj_0(key));\n };\n FluentObject.prototype.getInt_qoz5hj$ = function (key, processor) {\n processor(this.getInt_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getDouble_l47sdb$ = function (key, processor) {\n processor(this.getDouble_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getBoolean_48wr2m$ = function (key, processor) {\n processor(this.getBoolean_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getString_hyc7mn$ = function (key, processor) {\n processor(this.getString_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getStrings_lpk3a7$ = function (key, processor) {\n processor(this.getStrings_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getEnum_651ru9$ = function (key, processor, enumValues) {\n processor(this.getEnum_xwn52g$(key, enumValues));\n return this;\n };\n FluentObject.prototype.getArray_nhu1ij$ = function (key, processor) {\n processor(this.getArray_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getObject_6k19qz$ = function (key, processor) {\n processor(this.getObject_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.putRemovable_wxs67v$ = function (key, v) {\n if (v != null) {\n this.put_wxs67v$(key, v);\n }return this;\n };\n FluentObject.prototype.putRemovable_snuhza$ = function (key, v) {\n if (v != null) {\n this.put_snuhza$(key, v);\n }return this;\n };\n FluentObject.prototype.forEntries_ophlsb$ = function (consumer) {\n var tmp$;\n tmp$ = this.myObj_0.keys.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n consumer(element, this.myObj_0.get_11rb$(element));\n }\n return this;\n };\n FluentObject.prototype.forObjEntries_izf7h5$ = function (consumer) {\n var tmp$;\n tmp$ = this.myObj_0.keys.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n consumer(element, Kotlin.isType(tmp$_0 = this.myObj_0.get_11rb$(element), Map) ? tmp$_0 : throwCCE());\n }\n return this;\n };\n FluentObject.prototype.forArrEntries_2wy1dl$ = function (consumer) {\n var tmp$;\n tmp$ = this.myObj_0.keys.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n consumer(element, Kotlin.isType(tmp$_0 = this.myObj_0.get_11rb$(element), List) ? tmp$_0 : throwCCE());\n }\n return this;\n };\n FluentObject.prototype.accept_ysf37t$ = function (consumer) {\n consumer(this);\n return this;\n };\n FluentObject.prototype.forStrings_2by8ig$ = function (key, processor) {\n var $receiver = getArr(this.myObj_0, key);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(getAsString(item));\n }\n var tmp$_0;\n tmp$_0 = destination.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n processor(element);\n }\n return this;\n };\n FluentObject.prototype.getExistingDouble_l47sdb$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n this.getDouble_l47sdb$(key, processor);\n }return this;\n };\n FluentObject.prototype.getOptionalStrings_jpy86i$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n processor(this.getStrings_61zpoe$(key));\n } else {\n processor(null);\n }\n return this;\n };\n FluentObject.prototype.getExistingString_hyc7mn$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n this.getString_hyc7mn$(key, processor);\n }return this;\n };\n function FluentObject$forExistingStrings$lambda$lambda(closure$processor) {\n return function (it) {\n closure$processor(ensureNotNull(it));\n return Unit;\n };\n }\n FluentObject.prototype.forExistingStrings_hyc7mn$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n this.forStrings_2by8ig$(key, FluentObject$forExistingStrings$lambda$lambda(processor));\n }return this;\n };\n FluentObject.prototype.getExistingObject_6k19qz$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n var obj = this.getObject_61zpoe$(key);\n if (!obj.myObj_0.keys.isEmpty()) {\n processor(obj);\n }}return this;\n };\n FluentObject.prototype.getExistingArray_nhu1ij$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n processor(this.getArray_61zpoe$(key));\n }return this;\n };\n FluentObject.prototype.forObjects_6k19qz$ = function (key, processor) {\n var tmp$;\n tmp$ = this.getArray_61zpoe$(key).fluentObjectStream().iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n processor(element);\n }\n return this;\n };\n FluentObject.prototype.getOptionalInt_w5p0jm$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n processor(this.getInt_61zpoe$(key));\n } else {\n processor(null);\n }\n return this;\n };\n FluentObject.prototype.getIntOrDefault_u1i54l$ = function (key, processor, defaultValue) {\n if (this.containsNotNull_0(key)) {\n processor(this.getInt_61zpoe$(key));\n } else {\n processor(defaultValue);\n }\n return this;\n };\n FluentObject.prototype.forEnums_651ru9$ = function (key, processor, enumValues) {\n var tmp$;\n tmp$ = this.getArr_0(key).iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n processor(parseEnum(typeof (tmp$_0 = element) === 'string' ? tmp$_0 : throwCCE(), enumValues));\n }\n return this;\n };\n FluentObject.prototype.getOptionalEnum_651ru9$ = function (key, processor, enumValues) {\n if (this.containsNotNull_0(key))\n processor(this.getEnum_xwn52g$(key, enumValues));\n else\n processor(null);\n return this;\n };\n FluentObject.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FluentObject',\n interfaces: [FluentValue]\n };\n function FluentObject_init(obj, $this) {\n $this = $this || Object.create(FluentObject.prototype);\n FluentValue.call($this);\n FluentObject.call($this);\n var tmp$;\n $this.myObj_0 = toMutableMap(Kotlin.isType(tmp$ = obj, Map) ? tmp$ : throwCCE());\n return $this;\n }\n function FluentObject_init_0($this) {\n $this = $this || Object.create(FluentObject.prototype);\n FluentValue.call($this);\n FluentObject.call($this);\n $this.myObj_0 = HashMap_init_0();\n return $this;\n }\n function FluentPrimitive() {\n this.value_0 = null;\n }\n FluentPrimitive.prototype.get = function () {\n return this.value_0;\n };\n FluentPrimitive.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FluentPrimitive',\n interfaces: [FluentValue]\n };\n function FluentPrimitive_init(v, $this) {\n $this = $this || Object.create(FluentPrimitive.prototype);\n FluentValue.call($this);\n FluentPrimitive.call($this);\n $this.value_0 = v;\n return $this;\n }\n function FluentPrimitive_init_0(v, $this) {\n $this = $this || Object.create(FluentPrimitive.prototype);\n FluentValue.call($this);\n FluentPrimitive.call($this);\n $this.value_0 = v;\n return $this;\n }\n function FluentPrimitive_init_1(v, $this) {\n $this = $this || Object.create(FluentPrimitive.prototype);\n FluentValue.call($this);\n FluentPrimitive.call($this);\n $this.value_0 = v;\n return $this;\n }\n function FluentPrimitive_init_2(v, $this) {\n $this = $this || Object.create(FluentPrimitive.prototype);\n FluentValue.call($this);\n FluentPrimitive.call($this);\n $this.value_0 = v;\n return $this;\n }\n function FluentValue() {\n }\n FluentValue.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FluentValue',\n interfaces: []\n };\n function JsonFormatter() {\n this.buffer_suueb3$_0 = this.buffer_suueb3$_0;\n }\n Object.defineProperty(JsonFormatter.prototype, 'buffer_0', {\n configurable: true,\n get: function () {\n if (this.buffer_suueb3$_0 == null)\n return throwUPAE('buffer');\n return this.buffer_suueb3$_0;\n },\n set: function (buffer) {\n this.buffer_suueb3$_0 = buffer;\n }\n });\n JsonFormatter.prototype.formatJson_za3rmp$ = function (o) {\n this.buffer_0 = StringBuilder_init();\n this.handleValue_0(o);\n return this.buffer_0.toString();\n };\n function JsonFormatter$handleList$lambda(this$JsonFormatter) {\n return function (tail) {\n var tmp$;\n tmp$ = tail.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var this$JsonFormatter_0 = this$JsonFormatter;\n this$JsonFormatter_0.append_0(',');\n this$JsonFormatter_0.handleValue_0(element);\n }\n return Unit;\n };\n }\n JsonFormatter.prototype.handleList_0 = function (list) {\n this.append_0('[');\n this.headTail_0(list, getCallableRef('handleValue', function ($receiver, p1) {\n return $receiver.handleValue_0(p1), Unit;\n }.bind(null, this)), JsonFormatter$handleList$lambda(this));\n this.append_0(']');\n };\n function JsonFormatter$handleMap$lambda(this$JsonFormatter) {\n return function (tail) {\n var tmp$;\n tmp$ = tail.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var this$JsonFormatter_0 = this$JsonFormatter;\n this$JsonFormatter_0.append_0(',\\n');\n this$JsonFormatter_0.handlePair_0(element);\n }\n return Unit;\n };\n }\n JsonFormatter.prototype.handleMap_0 = function (map) {\n this.append_0('{');\n this.headTail_0(map.entries, getCallableRef('handlePair', function ($receiver, p1) {\n return $receiver.handlePair_0(p1), Unit;\n }.bind(null, this)), JsonFormatter$handleMap$lambda(this));\n this.append_0('}');\n };\n JsonFormatter.prototype.handleValue_0 = function (v) {\n if (v == null)\n this.append_0('null');\n else if (typeof v === 'string')\n this.handleString_0(v);\n else if (Kotlin.isNumber(v) || equals(v, kotlin_js_internal_BooleanCompanionObject))\n this.append_0(v.toString());\n else if (Kotlin.isArray(v))\n this.handleList_0(asList(v));\n else if (Kotlin.isType(v, List))\n this.handleList_0(v);\n else if (Kotlin.isType(v, Map))\n this.handleMap_0(v);\n else\n throw IllegalArgumentException_init(\"Can't serialize object \" + toString(v));\n };\n JsonFormatter.prototype.handlePair_0 = function (pair) {\n this.handleString_0(pair.key);\n this.append_0(':');\n this.handleValue_0(pair.value);\n };\n JsonFormatter.prototype.handleString_0 = function (v) {\n if (v != null)\n if (typeof v === 'string')\n this.append_0('\"' + escape(v) + '\"');\n else\n throw IllegalArgumentException_init(\"Expected a string, but got '\" + toString(Kotlin.getKClassFromExpression(v).simpleName) + \"'\");\n };\n JsonFormatter.prototype.append_0 = function (s) {\n return this.buffer_0.append_pdl1vj$(s);\n };\n JsonFormatter.prototype.headTail_0 = function ($receiver, head, tail) {\n if (!$receiver.isEmpty()) {\n head(first_0($receiver));\n tail(drop(asSequence($receiver), 1));\n }};\n JsonFormatter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JsonFormatter',\n interfaces: []\n };\n function JsonLexer(input) {\n JsonLexer$Companion_getInstance();\n this.input_0 = input;\n this.i_0 = 0;\n this.tokenStart_0 = 0;\n this.currentToken_dslfm7$_0 = null;\n this.nextToken();\n }\n Object.defineProperty(JsonLexer.prototype, 'currentToken', {\n configurable: true,\n get: function () {\n return this.currentToken_dslfm7$_0;\n },\n set: function (currentToken) {\n this.currentToken_dslfm7$_0 = currentToken;\n }\n });\n Object.defineProperty(JsonLexer.prototype, 'currentChar_0', {\n configurable: true,\n get: function () {\n return this.input_0.charCodeAt(this.i_0);\n }\n });\n function JsonLexer$nextToken$lambda(it) {\n return isWhitespace(unboxChar(it));\n }\n JsonLexer.prototype.nextToken = function () {\n var tmp$;\n this.advanceWhile_0(JsonLexer$nextToken$lambda);\n if (this.isFinished()) {\n return;\n }if (this.currentChar_0 === 123) {\n var $receiver = Token$LEFT_BRACE_getInstance();\n this.advance_0();\n tmp$ = $receiver;\n } else if (this.currentChar_0 === 125) {\n var $receiver_0 = Token$RIGHT_BRACE_getInstance();\n this.advance_0();\n tmp$ = $receiver_0;\n } else if (this.currentChar_0 === 91) {\n var $receiver_1 = Token$LEFT_BRACKET_getInstance();\n this.advance_0();\n tmp$ = $receiver_1;\n } else if (this.currentChar_0 === 93) {\n var $receiver_2 = Token$RIGHT_BRACKET_getInstance();\n this.advance_0();\n tmp$ = $receiver_2;\n } else if (this.currentChar_0 === 44) {\n var $receiver_3 = Token$COMMA_getInstance();\n this.advance_0();\n tmp$ = $receiver_3;\n } else if (this.currentChar_0 === 58) {\n var $receiver_4 = Token$COLON_getInstance();\n this.advance_0();\n tmp$ = $receiver_4;\n } else if (this.currentChar_0 === 116) {\n var $receiver_5 = Token$TRUE_getInstance();\n this.read_0('true');\n tmp$ = $receiver_5;\n } else if (this.currentChar_0 === 102) {\n var $receiver_6 = Token$FALSE_getInstance();\n this.read_0('false');\n tmp$ = $receiver_6;\n } else if (this.currentChar_0 === 110) {\n var $receiver_7 = Token$NULL_getInstance();\n this.read_0('null');\n tmp$ = $receiver_7;\n } else if (this.currentChar_0 === 34) {\n var $receiver_8 = Token$STRING_getInstance();\n this.readString_0();\n tmp$ = $receiver_8;\n } else if (this.readNumber_0())\n tmp$ = Token$NUMBER_getInstance();\n else {\n throw IllegalStateException_init((this.i_0.toString() + ':' + String.fromCharCode(this.currentChar_0) + ' - unkown token').toString());\n }\n this.currentToken = tmp$;\n };\n JsonLexer.prototype.tokenValue = function () {\n var $receiver = this.input_0;\n var startIndex = this.tokenStart_0;\n var endIndex = this.i_0;\n return $receiver.substring(startIndex, endIndex);\n };\n JsonLexer.prototype.readString_0 = function () {\n this.startToken_0();\n this.advance_0();\n while (this.currentChar_0 !== 34) {\n if (this.currentChar_0 === 92) {\n this.advance_0();\n if (this.currentChar_0 === 117) {\n this.advance_0();\n for (var index = 0; index < 4; index++) {\n if (!JsonLexer$Companion_getInstance().isHex_0(this.currentChar_0)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }this.advance_0();\n }\n } else {\n var $receiver = SPECIAL_CHARS;\n var key = toBoxedChar(this.currentChar_0);\n var tmp$;\n if ((Kotlin.isType(tmp$ = $receiver, Map) ? tmp$ : throwCCE()).containsKey_11rb$(key))\n this.advance_0();\n else {\n throw IllegalStateException_init('Invalid escape sequence'.toString());\n }\n }\n } else {\n this.advance_0();\n }\n }\n this.advance_0();\n };\n function JsonLexer$readNumber$lambda(it) {\n return JsonLexer$Companion_getInstance().isDigit_0(unboxChar(it));\n }\n function JsonLexer$readNumber$lambda$lambda(it) {\n return JsonLexer$Companion_getInstance().isDigit_0(unboxChar(it));\n }\n function JsonLexer$readNumber$lambda_0(this$JsonLexer) {\n return function () {\n if (!JsonLexer$Companion_getInstance().isDigit_0(this$JsonLexer.currentChar_0)) {\n var message = 'Number should have decimal part';\n throw IllegalArgumentException_init(message.toString());\n }this$JsonLexer.advanceWhile_0(JsonLexer$readNumber$lambda$lambda);\n return Unit;\n };\n }\n function JsonLexer$readNumber$lambda$lambda_0(it) {\n return JsonLexer$Companion_getInstance().isDigit_0(unboxChar(it));\n }\n function JsonLexer$readNumber$lambda_1(this$JsonLexer) {\n return function () {\n this$JsonLexer.advanceIfCurrent_0(Kotlin.charArrayOf(43, 45));\n this$JsonLexer.advanceWhile_0(JsonLexer$readNumber$lambda$lambda_0);\n return Unit;\n };\n }\n JsonLexer.prototype.readNumber_0 = function () {\n if (!(JsonLexer$Companion_getInstance().isDigit_0(this.currentChar_0) || this.currentChar_0 === 45)) {\n return false;\n }this.startToken_0();\n this.advanceIfCurrent_0(Kotlin.charArrayOf(45));\n this.advanceWhile_0(JsonLexer$readNumber$lambda);\n this.advanceIfCurrent_0(Kotlin.charArrayOf(46), JsonLexer$readNumber$lambda_0(this));\n this.advanceIfCurrent_0(Kotlin.charArrayOf(101, 69), JsonLexer$readNumber$lambda_1(this));\n return true;\n };\n JsonLexer.prototype.isFinished = function () {\n return this.i_0 === this.input_0.length;\n };\n JsonLexer.prototype.startToken_0 = function () {\n this.tokenStart_0 = this.i_0;\n };\n JsonLexer.prototype.advance_0 = function () {\n this.i_0 = this.i_0 + 1 | 0;\n };\n JsonLexer.prototype.read_0 = function (str) {\n var forEach$result;\n var tmp$;\n tmp$ = iterator(str);\n while (tmp$.hasNext()) {\n var element = unboxChar(tmp$.next());\n var it = toBoxedChar(element);\n if (!(this.currentChar_0 === unboxChar(it))) {\n var message = 'Wrong data: ' + str;\n throw IllegalArgumentException_init(message.toString());\n }if (!!this.isFinished()) {\n var message_0 = 'Unexpected end of string';\n throw IllegalArgumentException_init(message_0.toString());\n }this.advance_0();\n }\n return forEach$result;\n };\n JsonLexer.prototype.advanceWhile_0 = function (pred) {\n while (!this.isFinished() && pred(toBoxedChar(this.currentChar_0)))\n this.advance_0();\n };\n function JsonLexer$advanceIfCurrent$lambda() {\n return Unit;\n }\n JsonLexer.prototype.advanceIfCurrent_0 = function (expected, then) {\n if (then === void 0)\n then = JsonLexer$advanceIfCurrent$lambda;\n if (!this.isFinished() && contains_0(expected, this.currentChar_0)) {\n this.advance_0();\n then();\n }};\n function JsonLexer$Companion() {\n JsonLexer$Companion_instance = this;\n this.digits_0 = new CharRange(48, 57);\n }\n JsonLexer$Companion.prototype.isDigit_0 = function ($receiver) {\n var $receiver_0 = this.digits_0;\n return $receiver != null && $receiver_0.contains_mef7kx$($receiver);\n };\n JsonLexer$Companion.prototype.isHex_0 = function ($receiver) {\n return this.isDigit_0($receiver) || (new CharRange(97, 102)).contains_mef7kx$($receiver) || (new CharRange(65, 70)).contains_mef7kx$($receiver);\n };\n JsonLexer$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var JsonLexer$Companion_instance = null;\n function JsonLexer$Companion_getInstance() {\n if (JsonLexer$Companion_instance === null) {\n new JsonLexer$Companion();\n }return JsonLexer$Companion_instance;\n }\n JsonLexer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JsonLexer',\n interfaces: []\n };\n function JsonParser(json) {\n this.json_0 = json;\n }\n JsonParser.prototype.parseJson = function () {\n var lexer = new JsonLexer(this.json_0);\n return this.parseValue_0(lexer);\n };\n JsonParser.prototype.parseValue_0 = function (lexer) {\n var tmp$, tmp$_0;\n tmp$ = lexer.currentToken;\n if (equals(tmp$, Token$STRING_getInstance())) {\n var $receiver = unescape(lexer.tokenValue());\n lexer.nextToken();\n tmp$_0 = $receiver;\n } else if (equals(tmp$, Token$NUMBER_getInstance())) {\n var $receiver_0 = toDouble(lexer.tokenValue());\n lexer.nextToken();\n tmp$_0 = $receiver_0;\n } else if (equals(tmp$, Token$FALSE_getInstance())) {\n lexer.nextToken();\n tmp$_0 = false;\n } else if (equals(tmp$, Token$TRUE_getInstance())) {\n lexer.nextToken();\n tmp$_0 = true;\n } else if (equals(tmp$, Token$NULL_getInstance())) {\n lexer.nextToken();\n tmp$_0 = null;\n } else if (equals(tmp$, Token$LEFT_BRACE_getInstance()))\n tmp$_0 = this.parseObject_0(lexer);\n else if (equals(tmp$, Token$LEFT_BRACKET_getInstance()))\n tmp$_0 = this.parseArray_0(lexer);\n else {\n throw IllegalStateException_init(('Invalid token: ' + toString(lexer.currentToken)).toString());\n }\n return tmp$_0;\n };\n function JsonParser$parseArray$checkCurrentToken(closure$lexer, this$JsonParser) {\n return function (token) {\n this$JsonParser.require_0(closure$lexer.currentToken, token, '[Arr] ');\n };\n }\n JsonParser.prototype.parseArray_0 = function (lexer) {\n var checkCurrentToken = JsonParser$parseArray$checkCurrentToken(lexer, this);\n var list = ArrayList_init();\n checkCurrentToken(Token$LEFT_BRACKET_getInstance());\n lexer.nextToken();\n while (!equals(lexer.currentToken, Token$RIGHT_BRACKET_getInstance())) {\n if (!list.isEmpty()) {\n checkCurrentToken(Token$COMMA_getInstance());\n lexer.nextToken();\n }list.add_11rb$(this.parseValue_0(lexer));\n }\n checkCurrentToken(Token$RIGHT_BRACKET_getInstance());\n lexer.nextToken();\n return list;\n };\n function JsonParser$parseObject$checkCurrentToken(closure$lexer, this$JsonParser) {\n return function (token) {\n this$JsonParser.require_0(closure$lexer.currentToken, token, '[Obj] ');\n };\n }\n JsonParser.prototype.parseObject_0 = function (lexer) {\n var checkCurrentToken = JsonParser$parseObject$checkCurrentToken(lexer, this);\n var map = LinkedHashMap_init();\n checkCurrentToken(Token$LEFT_BRACE_getInstance());\n lexer.nextToken();\n while (!equals(lexer.currentToken, Token$RIGHT_BRACE_getInstance())) {\n if (!map.isEmpty()) {\n checkCurrentToken(Token$COMMA_getInstance());\n lexer.nextToken();\n }checkCurrentToken(Token$STRING_getInstance());\n var key = unescape(lexer.tokenValue());\n lexer.nextToken();\n checkCurrentToken(Token$COLON_getInstance());\n lexer.nextToken();\n var value = this.parseValue_0(lexer);\n map.put_xwzc9p$(key, value);\n }\n checkCurrentToken(Token$RIGHT_BRACE_getInstance());\n lexer.nextToken();\n return map;\n };\n JsonParser.prototype.require_0 = function (current, expected, messagePrefix) {\n if (messagePrefix === void 0)\n messagePrefix = null;\n if (!equals(current, expected)) {\n throw new JsonParser$JsonException(messagePrefix + ('Expected token: ' + toString(expected) + ', actual: ' + toString(current)));\n }};\n function JsonParser$JsonException(message) {\n Exception_init(message, this);\n this.name = 'JsonParser$JsonException';\n }\n JsonParser$JsonException.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JsonException',\n interfaces: [Exception]\n };\n JsonParser.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JsonParser',\n interfaces: []\n };\n function JsonSupport() {\n JsonSupport_instance = this;\n }\n JsonSupport.prototype.parseJson_61zpoe$ = function (jsonString) {\n var tmp$;\n return Kotlin.isType(tmp$ = (new JsonParser(jsonString)).parseJson(), MutableMap) ? tmp$ : throwCCE();\n };\n JsonSupport.prototype.formatJson_za3rmp$ = function (o) {\n return (new JsonFormatter()).formatJson_za3rmp$(o);\n };\n JsonSupport.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'JsonSupport',\n interfaces: []\n };\n var JsonSupport_instance = null;\n function JsonSupport_getInstance() {\n if (JsonSupport_instance === null) {\n new JsonSupport();\n }return JsonSupport_instance;\n }\n function Token(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Token_initFields() {\n Token_initFields = function () {\n };\n Token$LEFT_BRACE_instance = new Token('LEFT_BRACE', 0);\n Token$RIGHT_BRACE_instance = new Token('RIGHT_BRACE', 1);\n Token$LEFT_BRACKET_instance = new Token('LEFT_BRACKET', 2);\n Token$RIGHT_BRACKET_instance = new Token('RIGHT_BRACKET', 3);\n Token$COMMA_instance = new Token('COMMA', 4);\n Token$COLON_instance = new Token('COLON', 5);\n Token$STRING_instance = new Token('STRING', 6);\n Token$NUMBER_instance = new Token('NUMBER', 7);\n Token$TRUE_instance = new Token('TRUE', 8);\n Token$FALSE_instance = new Token('FALSE', 9);\n Token$NULL_instance = new Token('NULL', 10);\n }\n var Token$LEFT_BRACE_instance;\n function Token$LEFT_BRACE_getInstance() {\n Token_initFields();\n return Token$LEFT_BRACE_instance;\n }\n var Token$RIGHT_BRACE_instance;\n function Token$RIGHT_BRACE_getInstance() {\n Token_initFields();\n return Token$RIGHT_BRACE_instance;\n }\n var Token$LEFT_BRACKET_instance;\n function Token$LEFT_BRACKET_getInstance() {\n Token_initFields();\n return Token$LEFT_BRACKET_instance;\n }\n var Token$RIGHT_BRACKET_instance;\n function Token$RIGHT_BRACKET_getInstance() {\n Token_initFields();\n return Token$RIGHT_BRACKET_instance;\n }\n var Token$COMMA_instance;\n function Token$COMMA_getInstance() {\n Token_initFields();\n return Token$COMMA_instance;\n }\n var Token$COLON_instance;\n function Token$COLON_getInstance() {\n Token_initFields();\n return Token$COLON_instance;\n }\n var Token$STRING_instance;\n function Token$STRING_getInstance() {\n Token_initFields();\n return Token$STRING_instance;\n }\n var Token$NUMBER_instance;\n function Token$NUMBER_getInstance() {\n Token_initFields();\n return Token$NUMBER_instance;\n }\n var Token$TRUE_instance;\n function Token$TRUE_getInstance() {\n Token_initFields();\n return Token$TRUE_instance;\n }\n var Token$FALSE_instance;\n function Token$FALSE_getInstance() {\n Token_initFields();\n return Token$FALSE_instance;\n }\n var Token$NULL_instance;\n function Token$NULL_getInstance() {\n Token_initFields();\n return Token$NULL_instance;\n }\n Token.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Token',\n interfaces: [Enum]\n };\n function Token$values() {\n return [Token$LEFT_BRACE_getInstance(), Token$RIGHT_BRACE_getInstance(), Token$LEFT_BRACKET_getInstance(), Token$RIGHT_BRACKET_getInstance(), Token$COMMA_getInstance(), Token$COLON_getInstance(), Token$STRING_getInstance(), Token$NUMBER_getInstance(), Token$TRUE_getInstance(), Token$FALSE_getInstance(), Token$NULL_getInstance()];\n }\n Token.values = Token$values;\n function Token$valueOf(name) {\n switch (name) {\n case 'LEFT_BRACE':\n return Token$LEFT_BRACE_getInstance();\n case 'RIGHT_BRACE':\n return Token$RIGHT_BRACE_getInstance();\n case 'LEFT_BRACKET':\n return Token$LEFT_BRACKET_getInstance();\n case 'RIGHT_BRACKET':\n return Token$RIGHT_BRACKET_getInstance();\n case 'COMMA':\n return Token$COMMA_getInstance();\n case 'COLON':\n return Token$COLON_getInstance();\n case 'STRING':\n return Token$STRING_getInstance();\n case 'NUMBER':\n return Token$NUMBER_getInstance();\n case 'TRUE':\n return Token$TRUE_getInstance();\n case 'FALSE':\n return Token$FALSE_getInstance();\n case 'NULL':\n return Token$NULL_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.json.Token.' + name);\n }\n }\n Token.valueOf_61zpoe$ = Token$valueOf;\n var SPECIAL_CHARS;\n var CONTROL_CHARS;\n function escape$appendOutput(closure$output, closure$i, this$escape) {\n return function (str) {\n var tmp$;\n var tmp$_0 = closure$output;\n var tmp$_1;\n if ((tmp$ = closure$output.v) != null)\n tmp$_1 = tmp$;\n else {\n var $receiver = this$escape;\n var endIndex = closure$i.v;\n tmp$_1 = new StringBuilder($receiver.substring(0, endIndex));\n }\n tmp$_0.v = tmp$_1.append_pdl1vj$(str);\n };\n }\n function escape($receiver) {\n var tmp$, tmp$_0, tmp$_1;\n var output = {v: null};\n var i = {v: 0};\n var appendOutput = escape$appendOutput(output, i, $receiver);\n while (i.v < $receiver.length) {\n var ch = $receiver.charCodeAt(i.v);\n switch (ch) {\n case 92:\n appendOutput('\\\\\\\\');\n break;\n case 34:\n appendOutput('\\\\\"');\n break;\n case 10:\n appendOutput('\\\\n');\n break;\n case 13:\n appendOutput('\\\\r');\n break;\n case 9:\n appendOutput('\\\\t');\n break;\n default:if (CONTROL_CHARS.contains_11rb$(toBoxedChar(ch))) {\n appendOutput('\\\\' + 'u' + padStart(toString_0(ch | 0, 16), 4, 48));\n } else\n (tmp$ = output.v) != null ? tmp$.append_s8itvh$(ch) : null;\n break;\n }\n i.v = i.v + 1 | 0;\n }\n return (tmp$_1 = (tmp$_0 = output.v) != null ? tmp$_0.toString() : null) != null ? tmp$_1 : $receiver;\n }\n function unescape($receiver) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3;\n var output = {v: null};\n var start = 1;\n var end = $receiver.length - 1 | 0;\n var i = {v: start};\n while (i.v < end) {\n var ch = $receiver.charCodeAt(i.v);\n if (ch === 92) {\n var tmp$_4;\n if ((tmp$ = output.v) != null)\n tmp$_4 = tmp$;\n else {\n var endIndex = i.v;\n tmp$_4 = new StringBuilder($receiver.substring(start, endIndex));\n }\n output.v = tmp$_4;\n var escapedChar = $receiver.charCodeAt((i.v = i.v + 1 | 0, i.v));\n var $receiver_0 = SPECIAL_CHARS;\n var key = toBoxedChar(escapedChar);\n var tmp$_5;\n if ((Kotlin.isType(tmp$_5 = $receiver_0, Map) ? tmp$_5 : throwCCE()).containsKey_11rb$(key)) {\n var $receiver_1 = SPECIAL_CHARS.get_11rb$(toBoxedChar(escapedChar));\n i.v = i.v + 1 | 0;\n tmp$_0 = unboxChar($receiver_1);\n } else if (escapedChar === 117) {\n var startIndex = i.v + 1 | 0;\n var endIndex_0 = i.v + 5 | 0;\n var $receiver_2 = toBoxedChar(toChar(toInt_0($receiver.substring(startIndex, endIndex_0), 16)));\n i.v = i.v + 5 | 0;\n tmp$_0 = unboxChar($receiver_2);\n } else\n throw new JsonParser$JsonException('Invalid escape character: ' + String.fromCharCode(escapedChar));\n output.v.append_s8jyv4$(toBoxedChar(tmp$_0));\n } else {\n (tmp$_1 = output.v) != null ? tmp$_1.append_s8itvh$(ch) : null;\n i.v = i.v + 1 | 0;\n }\n }\n return (tmp$_3 = (tmp$_2 = output.v) != null ? tmp$_2.toString() : null) != null ? tmp$_3 : $receiver.substring(start, end);\n }\n function streamOf(arr) {\n return asSequence(arr);\n }\n function objectsStreamOf$lambda(it) {\n var tmp$;\n return Kotlin.isType(tmp$ = it, Map) ? tmp$ : throwCCE();\n }\n function objectsStreamOf(arr) {\n return map(streamOf(arr), objectsStreamOf$lambda);\n }\n function stringStreamOf$lambda(it) {\n var tmp$;\n return (tmp$ = it) == null || typeof tmp$ === 'string' ? tmp$ : throwCCE();\n }\n function stringStreamOf(arr) {\n return map(streamOf(arr), stringStreamOf$lambda);\n }\n function isBoolean(e) {\n return typeof e === 'boolean';\n }\n function isNumber(e) {\n return Kotlin.isNumber(e);\n }\n function isString(e) {\n return typeof e === 'string';\n }\n function getAsDouble(v) {\n var tmp$;\n return numberToDouble(Kotlin.isNumber(tmp$ = v) ? tmp$ : throwCCE());\n }\n function getAsInt(v) {\n var tmp$;\n return numberToInt(Kotlin.isNumber(tmp$ = v) ? tmp$ : throwCCE());\n }\n function getAsBoolean(v) {\n var tmp$;\n return typeof (tmp$ = v) === 'boolean' ? tmp$ : throwCCE();\n }\n function containsString(obj, key) {\n var v = obj.get_11rb$(key);\n if (v == null || equals(v, isString(v)))\n return true;\n else\n return false;\n }\n function getAsString(e) {\n var tmp$;\n if (e == null)\n return null;\n else\n return typeof (tmp$ = e) === 'string' ? tmp$ : throwCCE();\n }\n function parseEnum(enumStringValue, values) {\n var first$result;\n first$break: do {\n var tmp$;\n for (tmp$ = 0; tmp$ !== values.length; ++tmp$) {\n var element = values[tmp$];\n if (equals_0(element.toString(), enumStringValue, true)) {\n first$result = element;\n break first$break;\n }}\n throw new NoSuchElementException_init_0('Array contains no element matching the predicate.');\n }\n while (false);\n return first$result;\n }\n var parseEnum_0 = defineInlineFunction('lets-plot-base-portable.jetbrains.datalore.base.json.parseEnum_a9gw98$', wrapFunction(function () {\n var parseEnum = _.jetbrains.datalore.base.json.parseEnum_xwn52g$;\n return function (T_0, isT, enumStringValue) {\n return parseEnum(enumStringValue, T_0.values());\n };\n }));\n function formatEnum(enumValue) {\n return enumValue.toString().toLowerCase();\n }\n function put($receiver, key, v) {\n var destination = ArrayList_init_0(collectionSizeOrDefault(v, 10));\n var tmp$;\n tmp$ = v.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(formatEnum(item));\n }\n return put_0($receiver, key, destination);\n }\n function put_0($receiver, key, v) {\n var tmp$ = FluentArray_init();\n var destination = ArrayList_init_0(collectionSizeOrDefault(v, 10));\n var tmp$_0;\n tmp$_0 = v.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(item);\n }\n return $receiver.put_wxs67v$(key, tmp$.addStrings_d294za$(destination));\n }\n function getNumber($receiver, key) {\n var tmp$;\n var tmp$_0;\n var tmp$_1;\n if ((Kotlin.isType(tmp$_1 = $receiver, Map) ? tmp$_1 : throwCCE()).get_11rb$(key) == null)\n tmp$_0 = 0.0;\n else {\n var tmp$_2;\n tmp$_0 = Kotlin.isNumber(tmp$ = (Kotlin.isType(tmp$_2 = $receiver, Map) ? tmp$_2 : throwCCE()).get_11rb$(key)) ? tmp$ : throwCCE();\n }\n return tmp$_0;\n }\n function getDouble($receiver, key) {\n return numberToDouble(getNumber($receiver, key));\n }\n function getString($receiver, key) {\n var tmp$;\n var tmp$_0;\n return typeof (tmp$ = (Kotlin.isType(tmp$_0 = $receiver, Map) ? tmp$_0 : throwCCE()).get_11rb$(key)) === 'string' ? tmp$ : throwCCE();\n }\n function getObj($receiver, key) {\n var tmp$;\n var tmp$_0;\n return Kotlin.isType(tmp$ = (Kotlin.isType(tmp$_0 = $receiver, Map) ? tmp$_0 : throwCCE()).get_11rb$(key), Map) ? tmp$ : throwCCE();\n }\n function getArr($receiver, key) {\n var tmp$;\n var tmp$_0;\n return Kotlin.isType(tmp$ = (Kotlin.isType(tmp$_0 = $receiver, Map) ? tmp$_0 : throwCCE()).get_11rb$(key), List) ? tmp$ : throwCCE();\n }\n function ListMap() {\n ListMap$Companion_getInstance();\n this.myData_0 = ListMap$Companion_getInstance().EMPTY_ARRAY_0;\n }\n function ListMap$Companion() {\n ListMap$Companion_instance = this;\n this.EMPTY_ARRAY_0 = Kotlin.newArray(0, null);\n }\n ListMap$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ListMap$Companion_instance = null;\n function ListMap$Companion_getInstance() {\n if (ListMap$Companion_instance === null) {\n new ListMap$Companion();\n }return ListMap$Companion_instance;\n }\n Object.defineProperty(ListMap.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.size() === 0;\n }\n });\n ListMap.prototype.containsKey_11rb$ = function (key) {\n return this.findByKey_0(key) >= 0;\n };\n ListMap.prototype.remove_11rb$ = function (key) {\n var tmp$;\n var index = this.findByKey_0(key);\n if (index >= 0) {\n var value = this.myData_0[index + 1 | 0];\n this.removeAt_0(index);\n return (tmp$ = value) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n } else {\n return null;\n }\n };\n function ListMap$keySet$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n AbstractMutableSet.call(this);\n }\n Object.defineProperty(ListMap$keySet$ObjectLiteral.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.this$ListMap.size();\n }\n });\n ListMap$keySet$ObjectLiteral.prototype.add_11rb$ = function (element) {\n throw IllegalStateException_init('Not available in keySet');\n };\n function ListMap$keySet$ObjectLiteral$iterator$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n }\n ListMap$keySet$ObjectLiteral$iterator$ObjectLiteral.prototype.get_za3lpa$ = function (index) {\n return this.this$ListMap.myData_0[index];\n };\n ListMap$keySet$ObjectLiteral$iterator$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListMap$IteratorSpec]\n };\n ListMap$keySet$ObjectLiteral.prototype.iterator = function () {\n return this.this$ListMap.mapIterator_0(new ListMap$keySet$ObjectLiteral$iterator$ObjectLiteral(this.this$ListMap));\n };\n ListMap$keySet$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AbstractMutableSet]\n };\n ListMap.prototype.keySet = function () {\n return new ListMap$keySet$ObjectLiteral(this);\n };\n function ListMap$values$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n AbstractCollection.call(this);\n }\n Object.defineProperty(ListMap$values$ObjectLiteral.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.this$ListMap.size();\n }\n });\n function ListMap$values$ObjectLiteral$iterator$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n }\n ListMap$values$ObjectLiteral$iterator$ObjectLiteral.prototype.get_za3lpa$ = function (index) {\n return this.this$ListMap.myData_0[index + 1 | 0];\n };\n ListMap$values$ObjectLiteral$iterator$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListMap$IteratorSpec]\n };\n ListMap$values$ObjectLiteral.prototype.iterator = function () {\n return this.this$ListMap.mapIterator_0(new ListMap$values$ObjectLiteral$iterator$ObjectLiteral(this.this$ListMap));\n };\n ListMap$values$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AbstractCollection]\n };\n ListMap.prototype.values = function () {\n return new ListMap$values$ObjectLiteral(this);\n };\n function ListMap$entrySet$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n AbstractSet.call(this);\n }\n Object.defineProperty(ListMap$entrySet$ObjectLiteral.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.this$ListMap.size();\n }\n });\n function ListMap$entrySet$ObjectLiteral$iterator$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n }\n ListMap$entrySet$ObjectLiteral$iterator$ObjectLiteral.prototype.get_za3lpa$ = function (index) {\n return new ListMap$Entry(this.this$ListMap, index);\n };\n ListMap$entrySet$ObjectLiteral$iterator$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListMap$IteratorSpec]\n };\n ListMap$entrySet$ObjectLiteral.prototype.iterator = function () {\n return this.this$ListMap.mapIterator_0(new ListMap$entrySet$ObjectLiteral$iterator$ObjectLiteral(this.this$ListMap));\n };\n ListMap$entrySet$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AbstractSet]\n };\n ListMap.prototype.entrySet = function () {\n return new ListMap$entrySet$ObjectLiteral(this);\n };\n ListMap.prototype.size = function () {\n return this.myData_0.length / 2 | 0;\n };\n ListMap.prototype.put_xwzc9p$ = function (key, value) {\n var tmp$;\n var index = this.findByKey_0(key);\n if (index >= 0) {\n var oldValue = this.myData_0[index + 1 | 0];\n this.myData_0[index + 1 | 0] = value;\n return (tmp$ = oldValue) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n }var array = Array_0(this.myData_0.length + 2 | 0);\n var tmp$_0;\n tmp$_0 = array.length - 1 | 0;\n for (var i = 0; i <= tmp$_0; i++) {\n array[i] = i < this.myData_0.length ? this.myData_0[i] : null;\n }\n var newArray = array;\n newArray[this.myData_0.length] = key;\n newArray[this.myData_0.length + 1 | 0] = value;\n this.myData_0 = newArray;\n return null;\n };\n ListMap.prototype.get_11rb$ = function (key) {\n var tmp$, tmp$_0;\n var index = this.findByKey_0(key);\n if (index === -1) {\n tmp$_0 = null;\n } else {\n tmp$_0 = (tmp$ = this.myData_0[index + 1 | 0]) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n }\n return tmp$_0;\n };\n ListMap.prototype.toString = function () {\n var builder = StringBuilder_init();\n builder.append_pdl1vj$('{');\n var i = 0;\n while (i < this.myData_0.length) {\n var k = this.myData_0[i];\n var v = this.myData_0[i + 1 | 0];\n if (i !== 0) {\n builder.append_pdl1vj$(',');\n }builder.append_s8jyv4$(k).append_pdl1vj$('=').append_s8jyv4$(v);\n i = i + 2 | 0;\n }\n builder.append_pdl1vj$('}');\n return builder.toString();\n };\n function ListMap$mapIterator$ObjectLiteral(this$ListMap, closure$spec) {\n this.this$ListMap = this$ListMap;\n this.closure$spec = closure$spec;\n this.index_0 = 0;\n this.nextCalled_0 = false;\n }\n ListMap$mapIterator$ObjectLiteral.prototype.hasNext = function () {\n return this.index_0 < this.this$ListMap.myData_0.length;\n };\n ListMap$mapIterator$ObjectLiteral.prototype.next = function () {\n var tmp$;\n if (!this.hasNext()) {\n throw NoSuchElementException_init();\n }this.nextCalled_0 = true;\n var value = (tmp$ = this.closure$spec.get_za3lpa$(this.index_0)) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n this.index_0 = this.index_0 + 2 | 0;\n return value;\n };\n ListMap$mapIterator$ObjectLiteral.prototype.remove = function () {\n if (!this.nextCalled_0) {\n throw IllegalStateException_init_0();\n }this.index_0 = this.index_0 - 2 | 0;\n this.this$ListMap.removeAt_0(this.index_0);\n this.nextCalled_0 = false;\n };\n ListMap$mapIterator$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [MutableIterator]\n };\n ListMap.prototype.mapIterator_0 = function (spec) {\n return new ListMap$mapIterator$ObjectLiteral(this, spec);\n };\n ListMap.prototype.findByKey_0 = function (key) {\n var i = 0;\n while (i < this.myData_0.length) {\n var k = this.myData_0[i];\n if (equals(key, k)) {\n return i;\n }i = i + 2 | 0;\n }\n return -1;\n };\n ListMap.prototype.removeAt_0 = function (index) {\n if (this.myData_0.length === 2) {\n this.myData_0 = ListMap$Companion_getInstance().EMPTY_ARRAY_0;\n return;\n }var array = Array_0(this.myData_0.length - 2 | 0);\n var tmp$;\n tmp$ = array.length - 1 | 0;\n for (var i = 0; i <= tmp$; i++) {\n var init$result;\n if (i < index) {\n init$result = this.myData_0[i];\n } else {\n init$result = this.myData_0[i + 2 | 0];\n }\n array[i] = init$result;\n }\n var newArray = array;\n this.myData_0 = newArray;\n };\n function ListMap$Entry($outer, myIndex) {\n this.$outer = $outer;\n this.myIndex_0 = myIndex;\n }\n ListMap$Entry.prototype.key = function () {\n var tmp$;\n return (tmp$ = this.$outer.myData_0[this.myIndex_0]) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n };\n ListMap$Entry.prototype.value = function () {\n var tmp$;\n return (tmp$ = this.$outer.myData_0[this.myIndex_0 + 1 | 0]) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n };\n ListMap$Entry.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Entry',\n interfaces: []\n };\n function ListMap$IteratorSpec() {\n }\n ListMap$IteratorSpec.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'IteratorSpec',\n interfaces: []\n };\n ListMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ListMap',\n interfaces: []\n };\n function Logger() {\n }\n Logger.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Logger',\n interfaces: []\n };\n function PrintlnLogger(name) {\n this.name = name;\n }\n PrintlnLogger.prototype.error_l35kib$ = function (e, message) {\n println('ERR [' + this.name + '] : ' + message());\n };\n PrintlnLogger.prototype.info_h4ejuu$ = function (message) {\n println('INFO [' + this.name + '] : ' + message());\n };\n PrintlnLogger.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PrintlnLogger',\n interfaces: [Logger]\n };\n function toRadians(degrees) {\n return degrees * math.PI / 180.0;\n }\n function toDegrees(radians) {\n return radians * 180.0 / math.PI;\n }\n function round_0(v) {\n return round_1(v.x, v.y);\n }\n function ceil(v) {\n return ceil_0(v.x, v.y);\n }\n function round_1(x, y) {\n return new Vector(numberToInt(round(x)), numberToInt(round(y)));\n }\n function ceil_0(x, y) {\n return new Vector(numberToInt(JsMath.ceil(x)), numberToInt(JsMath.ceil(y)));\n }\n function distance(vector, doubleVector) {\n var dx = doubleVector.x - vector.x;\n var dy = doubleVector.y - vector.y;\n var x = dx * dx + dy * dy;\n return JsMath.sqrt(x);\n }\n function ipow($receiver, e) {\n return JsMath.pow($receiver, e);\n }\n function length(v) {\n if (equals(v, L0)) {\n return 1;\n }var len = 0;\n var rem = v;\n while (rem.toNumber() > 0) {\n len = len + 1 | 0;\n rem = rem.div(Kotlin.Long.fromInt(10));\n }\n return len;\n }\n function NumberFormat(spec) {\n NumberFormat$Companion_getInstance();\n this.spec_0 = spec;\n }\n function NumberFormat$Spec(fill, align, sign, symbol, zero, width, comma, precision, type, trim) {\n if (fill === void 0)\n fill = ' ';\n if (align === void 0)\n align = '>';\n if (sign === void 0)\n sign = '-';\n if (width === void 0)\n width = -1;\n if (precision === void 0)\n precision = 6;\n if (type === void 0)\n type = '';\n if (trim === void 0)\n trim = false;\n this.fill = fill;\n this.align = align;\n this.sign = sign;\n this.symbol = symbol;\n this.zero = zero;\n this.width = width;\n this.comma = comma;\n this.precision = precision;\n this.type = type;\n this.trim = trim;\n }\n NumberFormat$Spec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Spec',\n interfaces: []\n };\n NumberFormat$Spec.prototype.component1 = function () {\n return this.fill;\n };\n NumberFormat$Spec.prototype.component2 = function () {\n return this.align;\n };\n NumberFormat$Spec.prototype.component3 = function () {\n return this.sign;\n };\n NumberFormat$Spec.prototype.component4 = function () {\n return this.symbol;\n };\n NumberFormat$Spec.prototype.component5 = function () {\n return this.zero;\n };\n NumberFormat$Spec.prototype.component6 = function () {\n return this.width;\n };\n NumberFormat$Spec.prototype.component7 = function () {\n return this.comma;\n };\n NumberFormat$Spec.prototype.component8 = function () {\n return this.precision;\n };\n NumberFormat$Spec.prototype.component9 = function () {\n return this.type;\n };\n NumberFormat$Spec.prototype.component10 = function () {\n return this.trim;\n };\n NumberFormat$Spec.prototype.copy_xzdl1p$ = function (fill, align, sign, symbol, zero, width, comma, precision, type, trim) {\n return new NumberFormat$Spec(fill === void 0 ? this.fill : fill, align === void 0 ? this.align : align, sign === void 0 ? this.sign : sign, symbol === void 0 ? this.symbol : symbol, zero === void 0 ? this.zero : zero, width === void 0 ? this.width : width, comma === void 0 ? this.comma : comma, precision === void 0 ? this.precision : precision, type === void 0 ? this.type : type, trim === void 0 ? this.trim : trim);\n };\n NumberFormat$Spec.prototype.toString = function () {\n return 'Spec(fill=' + Kotlin.toString(this.fill) + (', align=' + Kotlin.toString(this.align)) + (', sign=' + Kotlin.toString(this.sign)) + (', symbol=' + Kotlin.toString(this.symbol)) + (', zero=' + Kotlin.toString(this.zero)) + (', width=' + Kotlin.toString(this.width)) + (', comma=' + Kotlin.toString(this.comma)) + (', precision=' + Kotlin.toString(this.precision)) + (', type=' + Kotlin.toString(this.type)) + (', trim=' + Kotlin.toString(this.trim)) + ')';\n };\n NumberFormat$Spec.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.fill) | 0;\n result = result * 31 + Kotlin.hashCode(this.align) | 0;\n result = result * 31 + Kotlin.hashCode(this.sign) | 0;\n result = result * 31 + Kotlin.hashCode(this.symbol) | 0;\n result = result * 31 + Kotlin.hashCode(this.zero) | 0;\n result = result * 31 + Kotlin.hashCode(this.width) | 0;\n result = result * 31 + Kotlin.hashCode(this.comma) | 0;\n result = result * 31 + Kotlin.hashCode(this.precision) | 0;\n result = result * 31 + Kotlin.hashCode(this.type) | 0;\n result = result * 31 + Kotlin.hashCode(this.trim) | 0;\n return result;\n };\n NumberFormat$Spec.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.fill, other.fill) && Kotlin.equals(this.align, other.align) && Kotlin.equals(this.sign, other.sign) && Kotlin.equals(this.symbol, other.symbol) && Kotlin.equals(this.zero, other.zero) && Kotlin.equals(this.width, other.width) && Kotlin.equals(this.comma, other.comma) && Kotlin.equals(this.precision, other.precision) && Kotlin.equals(this.type, other.type) && Kotlin.equals(this.trim, other.trim)))));\n };\n function NumberFormat$NumberInfo(number, negative, integerPart, fractionalPart, exponent) {\n NumberFormat$NumberInfo$Companion_getInstance();\n if (number === void 0)\n number = 0.0;\n if (negative === void 0)\n negative = false;\n if (integerPart === void 0)\n integerPart = L0;\n if (fractionalPart === void 0)\n fractionalPart = L0;\n if (exponent === void 0)\n exponent = null;\n this.number = number;\n this.negative = negative;\n this.integerPart = integerPart;\n this.fractionalPart = fractionalPart;\n this.exponent = exponent;\n this.fractionLeadingZeros = 18 - length(this.fractionalPart) | 0;\n this.integerLength = length(this.integerPart);\n this.fractionString = repeat('0', this.fractionLeadingZeros) + trimEnd(this.fractionalPart.toString(), Kotlin.charArrayOf(48));\n }\n function NumberFormat$NumberInfo$Companion() {\n NumberFormat$NumberInfo$Companion_instance = this;\n this.MAX_DECIMALS_0 = 18;\n this.MAX_DECIMAL_VALUE_8be2vx$ = Kotlin.Long.fromNumber(JsMath.pow(10.0, 18));\n }\n function NumberFormat$NumberInfo$Companion$createNumberInfo$lambda(frac, exp) {\n var fraction = frac;\n if (exp > 18) {\n fraction = substring(frac, until(0, frac.length - (exp - 18) | 0));\n }var tmp$ = toLong(fraction);\n var n = coerceAtLeast(18 - exp | 0, 0);\n return tmp$.multiply(Kotlin.Long.fromNumber(JsMath.pow(10.0, n)));\n }\n NumberFormat$NumberInfo$Companion.prototype.createNumberInfo_yjmjg9$ = function (num) {\n var tmp$, tmp$_0, tmp$_1;\n var encodeFraction = NumberFormat$NumberInfo$Companion$createNumberInfo$lambda;\n var tmp$_2 = Regex_init('^(\\\\d+)\\\\.?(\\\\d+)?e?([+-]?\\\\d+)?$');\n var tmp$_3;\n var $receiver = numberToDouble(num);\n if ((tmp$_0 = (tmp$ = tmp$_2.find_905azu$(JsMath.abs($receiver).toString().toLowerCase())) != null ? tmp$.destructured : null) != null)\n tmp$_3 = tmp$_0;\n else {\n throw IllegalStateException_init(('Wrong number: ' + num.toString()).toString());\n }\n var tmp$_4 = tmp$_3;\n var intStr = tmp$_4.match.groupValues.get_za3lpa$(1);\n var fracStr = tmp$_4.match.groupValues.get_za3lpa$(2);\n var exponentString = tmp$_4.match.groupValues.get_za3lpa$(3);\n var exponent = (tmp$_1 = toIntOrNull(exponentString)) != null ? tmp$_1 : 0;\n if (abs(exponent) >= 18) {\n return NumberFormat$NumberFormat$NumberInfo_init(num, toLong(intStr), L0, exponent);\n }if (!(exponent < 18)) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }if (exponent < 0) {\n return NumberFormat$NumberFormat$NumberInfo_init(num, void 0, encodeFraction(intStr + fracStr, abs(exponent) + fracStr.length | 0));\n }if (!(exponent >= 0 && exponent <= 18)) {\n var message_0 = 'Check failed.';\n throw IllegalStateException_init(message_0.toString());\n }if (exponent >= fracStr.length) {\n return NumberFormat$NumberFormat$NumberInfo_init(num, toLong(intStr + fracStr + repeat('0', exponent - fracStr.length | 0)));\n }if (!(exponent >= 0 && exponent < fracStr.length)) {\n var message_1 = 'Check failed.';\n throw IllegalStateException_init(message_1.toString());\n }var tmp$_5 = toLong(intStr + substring(fracStr, until(0, exponent)));\n var $receiver_0 = fracStr.substring(exponent);\n return NumberFormat$NumberFormat$NumberInfo_init(num, tmp$_5, encodeFraction($receiver_0, $receiver_0.length));\n };\n NumberFormat$NumberInfo$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var NumberFormat$NumberInfo$Companion_instance = null;\n function NumberFormat$NumberInfo$Companion_getInstance() {\n if (NumberFormat$NumberInfo$Companion_instance === null) {\n new NumberFormat$NumberInfo$Companion();\n }return NumberFormat$NumberInfo$Companion_instance;\n }\n NumberFormat$NumberInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NumberInfo',\n interfaces: []\n };\n function NumberFormat$NumberFormat$NumberInfo_init(number, integerPart, fractionalPart, exponent, $this) {\n if (integerPart === void 0)\n integerPart = L0;\n if (fractionalPart === void 0)\n fractionalPart = L0;\n if (exponent === void 0)\n exponent = null;\n $this = $this || Object.create(NumberFormat$NumberInfo.prototype);\n var $receiver = numberToDouble(number);\n NumberFormat$NumberInfo.call($this, JsMath.abs($receiver), numberToDouble(number) < 0.0, integerPart, fractionalPart, exponent);\n return $this;\n }\n NumberFormat$NumberInfo.prototype.component1 = function () {\n return this.number;\n };\n NumberFormat$NumberInfo.prototype.component2 = function () {\n return this.negative;\n };\n NumberFormat$NumberInfo.prototype.component3 = function () {\n return this.integerPart;\n };\n NumberFormat$NumberInfo.prototype.component4 = function () {\n return this.fractionalPart;\n };\n NumberFormat$NumberInfo.prototype.component5 = function () {\n return this.exponent;\n };\n NumberFormat$NumberInfo.prototype.copy_xz9h4k$ = function (number, negative, integerPart, fractionalPart, exponent) {\n return new NumberFormat$NumberInfo(number === void 0 ? this.number : number, negative === void 0 ? this.negative : negative, integerPart === void 0 ? this.integerPart : integerPart, fractionalPart === void 0 ? this.fractionalPart : fractionalPart, exponent === void 0 ? this.exponent : exponent);\n };\n NumberFormat$NumberInfo.prototype.toString = function () {\n return 'NumberInfo(number=' + Kotlin.toString(this.number) + (', negative=' + Kotlin.toString(this.negative)) + (', integerPart=' + Kotlin.toString(this.integerPart)) + (', fractionalPart=' + Kotlin.toString(this.fractionalPart)) + (', exponent=' + Kotlin.toString(this.exponent)) + ')';\n };\n NumberFormat$NumberInfo.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.number) | 0;\n result = result * 31 + Kotlin.hashCode(this.negative) | 0;\n result = result * 31 + Kotlin.hashCode(this.integerPart) | 0;\n result = result * 31 + Kotlin.hashCode(this.fractionalPart) | 0;\n result = result * 31 + Kotlin.hashCode(this.exponent) | 0;\n return result;\n };\n NumberFormat$NumberInfo.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.number, other.number) && Kotlin.equals(this.negative, other.negative) && Kotlin.equals(this.integerPart, other.integerPart) && Kotlin.equals(this.fractionalPart, other.fractionalPart) && Kotlin.equals(this.exponent, other.exponent)))));\n };\n function NumberFormat$Output(body, sign, prefix, suffix, padding) {\n if (body === void 0)\n body = new NumberFormat$FormattedNumber();\n if (sign === void 0)\n sign = '';\n if (prefix === void 0)\n prefix = '';\n if (suffix === void 0)\n suffix = '';\n if (padding === void 0)\n padding = '';\n this.body = body;\n this.sign = sign;\n this.prefix = prefix;\n this.suffix = suffix;\n this.padding = padding;\n }\n NumberFormat$Output.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Output',\n interfaces: []\n };\n NumberFormat$Output.prototype.component1 = function () {\n return this.body;\n };\n NumberFormat$Output.prototype.component2 = function () {\n return this.sign;\n };\n NumberFormat$Output.prototype.component3 = function () {\n return this.prefix;\n };\n NumberFormat$Output.prototype.component4 = function () {\n return this.suffix;\n };\n NumberFormat$Output.prototype.component5 = function () {\n return this.padding;\n };\n NumberFormat$Output.prototype.copy_rm1j3u$ = function (body, sign, prefix, suffix, padding) {\n return new NumberFormat$Output(body === void 0 ? this.body : body, sign === void 0 ? this.sign : sign, prefix === void 0 ? this.prefix : prefix, suffix === void 0 ? this.suffix : suffix, padding === void 0 ? this.padding : padding);\n };\n NumberFormat$Output.prototype.toString = function () {\n return 'Output(body=' + Kotlin.toString(this.body) + (', sign=' + Kotlin.toString(this.sign)) + (', prefix=' + Kotlin.toString(this.prefix)) + (', suffix=' + Kotlin.toString(this.suffix)) + (', padding=' + Kotlin.toString(this.padding)) + ')';\n };\n NumberFormat$Output.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.body) | 0;\n result = result * 31 + Kotlin.hashCode(this.sign) | 0;\n result = result * 31 + Kotlin.hashCode(this.prefix) | 0;\n result = result * 31 + Kotlin.hashCode(this.suffix) | 0;\n result = result * 31 + Kotlin.hashCode(this.padding) | 0;\n return result;\n };\n NumberFormat$Output.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.body, other.body) && Kotlin.equals(this.sign, other.sign) && Kotlin.equals(this.prefix, other.prefix) && Kotlin.equals(this.suffix, other.suffix) && Kotlin.equals(this.padding, other.padding)))));\n };\n function NumberFormat$FormattedNumber(integerPart, fractionalPart, exponentialPart) {\n if (integerPart === void 0)\n integerPart = '';\n if (fractionalPart === void 0)\n fractionalPart = '';\n if (exponentialPart === void 0)\n exponentialPart = '';\n this.integerPart = integerPart;\n this.fractionalPart = fractionalPart;\n this.exponentialPart = exponentialPart;\n var tmp$;\n this.fractionalLength = (tmp$ = this.fractionalPart.length === 0 ? 0 : null) != null ? tmp$ : 1 + this.fractionalPart.length | 0;\n this.fullLength = this.integerPart.length + this.fractionalLength + this.exponentialPart.length | 0;\n }\n NumberFormat$FormattedNumber.prototype.toString = function () {\n var tmp$;\n var tmp$_0 = this.integerPart;\n var $receiver = NumberFormat$Companion_getInstance().FRACTION_DELIMITER_0;\n return tmp$_0 + ((tmp$ = this.fractionalPart.length > 0 ? $receiver : null) != null ? tmp$ : '') + this.fractionalPart + this.exponentialPart;\n };\n NumberFormat$FormattedNumber.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FormattedNumber',\n interfaces: []\n };\n NumberFormat$FormattedNumber.prototype.component1 = function () {\n return this.integerPart;\n };\n NumberFormat$FormattedNumber.prototype.component2 = function () {\n return this.fractionalPart;\n };\n NumberFormat$FormattedNumber.prototype.component3 = function () {\n return this.exponentialPart;\n };\n NumberFormat$FormattedNumber.prototype.copy_6hosri$ = function (integerPart, fractionalPart, exponentialPart) {\n return new NumberFormat$FormattedNumber(integerPart === void 0 ? this.integerPart : integerPart, fractionalPart === void 0 ? this.fractionalPart : fractionalPart, exponentialPart === void 0 ? this.exponentialPart : exponentialPart);\n };\n NumberFormat$FormattedNumber.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.integerPart) | 0;\n result = result * 31 + Kotlin.hashCode(this.fractionalPart) | 0;\n result = result * 31 + Kotlin.hashCode(this.exponentialPart) | 0;\n return result;\n };\n NumberFormat$FormattedNumber.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.integerPart, other.integerPart) && Kotlin.equals(this.fractionalPart, other.fractionalPart) && Kotlin.equals(this.exponentialPart, other.exponentialPart)))));\n };\n NumberFormat.prototype.apply_3p81yu$ = function (num) {\n var nonNumberString = this.handleNonNumbers_0(num);\n if (nonNumberString != null) {\n return nonNumberString;\n }var numberInfo = NumberFormat$NumberInfo$Companion_getInstance().createNumberInfo_yjmjg9$(num);\n var output = new NumberFormat$Output();\n output = this.computeBody_0(output, numberInfo);\n output = this.trimFraction_0(output);\n output = this.computeSign_0(output, numberInfo);\n output = this.computePrefix_0(output);\n output = this.computeSuffix_0(output);\n if (this.spec_0.comma && !this.spec_0.zero) {\n output = this.applyGroup_0(output);\n }output = this.computePadding_0(output);\n if (this.spec_0.comma && this.spec_0.zero) {\n output = this.applyGroup_0(output);\n }return this.getAlignedString_0(output);\n };\n NumberFormat.prototype.handleNonNumbers_0 = function (num) {\n var tmp$;\n var number = numberToDouble(num);\n if (isNaN_0(number))\n tmp$ = 'NaN';\n else if (number === kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY)\n tmp$ = '-Infinity';\n else if (number === kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY)\n tmp$ = '+Infinity';\n else\n tmp$ = null;\n return tmp$;\n };\n NumberFormat.prototype.getAlignedString_0 = function (output) {\n var tmp$;\n switch (this.spec_0.align) {\n case '<':\n tmp$ = output.sign + output.prefix + output.body + output.suffix + output.padding;\n break;\n case '=':\n tmp$ = output.sign + output.prefix + output.padding + output.body + output.suffix;\n break;\n case '^':\n var stop = output.padding.length / 2 | 0;\n tmp$ = slice(output.padding, until(0, stop)) + output.sign + output.prefix + output.body + output.suffix + slice(output.padding, until(stop, output.padding.length));\n break;\n default:tmp$ = output.padding + output.sign + output.prefix + output.body + output.suffix;\n break;\n }\n return tmp$;\n };\n NumberFormat.prototype.applyGroup_0 = function (output) {\n var tmp$, tmp$_0;\n var $receiver = output.padding;\n var zeroPadding = (tmp$ = this.spec_0.zero ? $receiver : null) != null ? tmp$ : '';\n var body = output.body;\n var fullIntStr = zeroPadding + body.integerPart;\n var x = fullIntStr.length / 3;\n var commas = numberToInt(JsMath.ceil(x) - 1);\n var width = coerceAtLeast(this.spec_0.width - body.fractionalLength - body.exponentialPart.length | 0, body.integerPart.length + commas | 0);\n fullIntStr = NumberFormat$Companion_getInstance().group_0(fullIntStr);\n if (fullIntStr.length > width) {\n var $receiver_0 = fullIntStr;\n var startIndex = fullIntStr.length - width | 0;\n fullIntStr = $receiver_0.substring(startIndex);\n if (startsWith(fullIntStr, 44)) {\n fullIntStr = '0' + fullIntStr;\n }}return output.copy_rm1j3u$(body.copy_6hosri$(fullIntStr), void 0, void 0, void 0, (tmp$_0 = this.spec_0.zero ? '' : null) != null ? tmp$_0 : output.padding);\n };\n NumberFormat.prototype.computeBody_0 = function (res, numberInfo) {\n var tmp$;\n switch (this.spec_0.type) {\n case '%':\n tmp$ = this.toFixedFormat_0(NumberFormat$NumberInfo$Companion_getInstance().createNumberInfo_yjmjg9$(numberInfo.number * 100), this.spec_0.precision);\n break;\n case 'c':\n tmp$ = new NumberFormat$FormattedNumber(numberInfo.number.toString());\n break;\n case 'd':\n tmp$ = this.toSimpleFormat_0(numberInfo, 0);\n break;\n case 'e':\n tmp$ = this.toSimpleFormat_0(this.toExponential_0(numberInfo, this.spec_0.precision), this.spec_0.precision);\n break;\n case 'f':\n tmp$ = this.toFixedFormat_0(numberInfo, this.spec_0.precision);\n break;\n case 'g':\n tmp$ = this.toPrecisionFormat_0(numberInfo, this.spec_0.precision);\n break;\n case 'b':\n tmp$ = new NumberFormat$FormattedNumber(toString_1(roundToLong(numberInfo.number), 2));\n break;\n case 'o':\n tmp$ = new NumberFormat$FormattedNumber(toString_1(roundToLong(numberInfo.number), 8));\n break;\n case 'X':\n tmp$ = new NumberFormat$FormattedNumber(toString_1(roundToLong(numberInfo.number), 16).toUpperCase());\n break;\n case 'x':\n tmp$ = new NumberFormat$FormattedNumber(toString_1(roundToLong(numberInfo.number), 16));\n break;\n case 's':\n tmp$ = this.toSiFormat_0(numberInfo, this.spec_0.precision);\n break;\n default:throw IllegalArgumentException_init('Wrong type: ' + this.spec_0.type);\n }\n var formattedNumber = tmp$;\n return res.copy_rm1j3u$(formattedNumber);\n };\n NumberFormat.prototype.toExponential_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = -1;\n var tmp$, tmp$_0;\n var num = numberInfo.number;\n if (num < NumberFormat$Companion_getInstance().TYPE_E_MIN) {\n return new NumberFormat$NumberInfo(0.0);\n }if (equals(numberInfo.integerPart, L0)) {\n tmp$_0 = -(numberInfo.fractionLeadingZeros + 1 | 0) | 0;\n } else {\n tmp$_0 = (numberInfo.integerLength - 1 | 0) + ((tmp$ = numberInfo.exponent) != null ? tmp$ : 0) | 0;\n }\n var e = tmp$_0;\n var n = e;\n var n_0 = num / JsMath.pow(10.0, n);\n var newInfo = NumberFormat$NumberInfo$Companion_getInstance().createNumberInfo_yjmjg9$(n_0);\n if (precision > -1) {\n newInfo = this.roundToPrecision_0(newInfo, precision);\n }if (newInfo.integerLength > 1) {\n e = e + 1 | 0;\n newInfo = NumberFormat$NumberInfo$Companion_getInstance().createNumberInfo_yjmjg9$(n_0 / 10);\n }return newInfo.copy_xz9h4k$(void 0, void 0, void 0, void 0, e);\n };\n NumberFormat.prototype.toPrecisionFormat_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = -1;\n if (equals(numberInfo.integerPart, L0)) {\n if (equals(numberInfo.fractionalPart, L0)) {\n return this.toFixedFormat_0(numberInfo, precision - 1 | 0);\n }return this.toFixedFormat_0(numberInfo, precision + numberInfo.fractionLeadingZeros | 0);\n } else {\n if (numberInfo.integerLength > precision) {\n return this.toSimpleFormat_0(this.toExponential_0(numberInfo, precision - 1 | 0), precision - 1 | 0);\n }return this.toFixedFormat_0(numberInfo, precision - numberInfo.integerLength | 0);\n }\n };\n NumberFormat.prototype.toFixedFormat_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = 0;\n var tmp$;\n if (precision <= 0) {\n return new NumberFormat$FormattedNumber(roundToLong(numberInfo.number).toString());\n }var newNumberInfo = this.roundToPrecision_0(numberInfo, precision);\n if (numberInfo.integerLength < newNumberInfo.integerLength) {\n tmp$ = precision - 1 | 0;\n } else {\n tmp$ = precision;\n }\n var completePrecision = tmp$;\n if (equals(newNumberInfo.fractionalPart, L0)) {\n return new NumberFormat$FormattedNumber(newNumberInfo.integerPart.toString(), repeat('0', completePrecision));\n }var fractionString = padEnd(newNumberInfo.fractionString, completePrecision, 48);\n return new NumberFormat$FormattedNumber(newNumberInfo.integerPart.toString(), fractionString);\n };\n NumberFormat.prototype.toSimpleFormat_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = -1;\n var tmp$;\n if (numberInfo.exponent != null) {\n var expSign = get_sign(numberInfo.exponent) >= 0 ? '+' : '';\n tmp$ = 'e' + expSign + toString(numberInfo.exponent);\n } else {\n tmp$ = '';\n }\n var exponentString = tmp$;\n var expNumberInfo = NumberFormat$NumberInfo$Companion_getInstance().createNumberInfo_yjmjg9$(numberInfo.integerPart.toNumber() + numberInfo.fractionalPart.toNumber() / NumberFormat$NumberInfo$Companion_getInstance().MAX_DECIMAL_VALUE_8be2vx$.toNumber());\n if (precision > -1) {\n var formattedNumber = this.toFixedFormat_0(expNumberInfo, precision);\n return formattedNumber.copy_6hosri$(void 0, void 0, exponentString);\n }var integerString = expNumberInfo.integerPart.toString();\n var fractionString = equals(expNumberInfo.fractionalPart, L0) ? '' : expNumberInfo.fractionString;\n return new NumberFormat$FormattedNumber(integerString, fractionString, exponentString);\n };\n NumberFormat.prototype.toSiFormat_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = -1;\n var tmp$, tmp$_0;\n if (numberInfo.exponent == null) {\n tmp$ = this.toExponential_0(numberInfo, precision - 1 | 0);\n } else {\n tmp$ = numberInfo;\n }\n var expNumberInfo = tmp$;\n var exponent = (tmp$_0 = expNumberInfo.exponent) != null ? tmp$_0 : 0;\n var x = exponent / 3.0;\n var suffixExp = numberToInt(coerceAtMost(coerceAtLeast_0(JsMath.floor(x), -8.0), 8.0)) * 3 | 0;\n var tmp$_1 = NumberFormat$NumberInfo$Companion_getInstance();\n var tmp$_2 = numberInfo.number;\n var n = -suffixExp | 0;\n var newNumberInfo = tmp$_1.createNumberInfo_yjmjg9$(tmp$_2 * JsMath.pow(10.0, n));\n var suffixIndex = 8 + (suffixExp / 3 | 0) | 0;\n var exponentString = NumberFormat$Companion_getInstance().SI_SUFFIXES_0[suffixIndex];\n var formattedNumber = this.toFixedFormat_0(newNumberInfo, precision - newNumberInfo.integerLength | 0);\n return formattedNumber.copy_6hosri$(void 0, void 0, exponentString);\n };\n NumberFormat.prototype.roundToPrecision_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = 0;\n var tmp$, tmp$_0, tmp$_1;\n var exp = (tmp$ = numberInfo.exponent) != null ? tmp$ : 0;\n var totalPrecision = precision + exp | 0;\n var fractionalPart;\n var integerPart;\n if (totalPrecision < 0) {\n fractionalPart = L0;\n var intShift = abs(totalPrecision);\n if (numberInfo.integerLength <= intShift) {\n tmp$_0 = L0;\n } else {\n tmp$_0 = numberInfo.integerPart.div(Kotlin.Long.fromNumber(JsMath.pow(10.0, intShift))).multiply(Kotlin.Long.fromNumber(JsMath.pow(10.0, intShift)));\n }\n integerPart = tmp$_0;\n } else {\n var precisionExp = NumberFormat$NumberInfo$Companion_getInstance().MAX_DECIMAL_VALUE_8be2vx$.div(Kotlin.Long.fromNumber(JsMath.pow(10.0, totalPrecision)));\n if (equals(precisionExp, L0)) {\n tmp$_1 = numberInfo.fractionalPart;\n } else {\n tmp$_1 = roundToLong(numberInfo.fractionalPart.toNumber() / precisionExp.toNumber()).multiply(precisionExp);\n }\n fractionalPart = tmp$_1;\n integerPart = numberInfo.integerPart;\n if (equals(fractionalPart, NumberFormat$NumberInfo$Companion_getInstance().MAX_DECIMAL_VALUE_8be2vx$)) {\n fractionalPart = L0;\n integerPart = integerPart.inc();\n }}\n var num = integerPart.toNumber() + fractionalPart.toNumber() / NumberFormat$NumberInfo$Companion_getInstance().MAX_DECIMAL_VALUE_8be2vx$.toNumber();\n return numberInfo.copy_xz9h4k$(num, void 0, integerPart, fractionalPart);\n };\n NumberFormat.prototype.trimFraction_0 = function (output) {\n var tmp$ = !this.spec_0.trim;\n if (!tmp$) {\n tmp$ = output.body.fractionalPart.length === 0;\n }if (tmp$) {\n return output;\n }var trimmedFraction = trimEnd(output.body.fractionalPart, Kotlin.charArrayOf(48));\n return output.copy_rm1j3u$(output.body.copy_6hosri$(void 0, trimmedFraction));\n };\n NumberFormat.prototype.computeSign_0 = function (output, numberInfo) {\n var tmp$;\n var $receiver = output.body;\n var $receiver_0 = plus_1(asSequence_0($receiver.integerPart), asSequence_0($receiver.fractionalPart));\n var all$result;\n all$break: do {\n var tmp$_0;\n tmp$_0 = $receiver_0.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (!(unboxChar(element) === 48)) {\n all$result = false;\n break all$break;\n }}\n all$result = true;\n }\n while (false);\n var isBodyZero = all$result;\n var isNegative = numberInfo.negative && !isBodyZero;\n if (isNegative) {\n tmp$ = '-';\n } else {\n tmp$ = !equals(this.spec_0.sign, '-') ? this.spec_0.sign : '';\n }\n var signStr = tmp$;\n return output.copy_rm1j3u$(void 0, signStr);\n };\n NumberFormat.prototype.computePrefix_0 = function (output) {\n var tmp$;\n switch (this.spec_0.symbol) {\n case '$':\n tmp$ = NumberFormat$Companion_getInstance().CURRENCY_0;\n break;\n case '#':\n tmp$ = indexOf('boxX', this.spec_0.type) > -1 ? '0' + this.spec_0.type.toLowerCase() : '';\n break;\n default:tmp$ = '';\n break;\n }\n var prefix = tmp$;\n return output.copy_rm1j3u$(void 0, void 0, prefix);\n };\n NumberFormat.prototype.computeSuffix_0 = function (res) {\n var tmp$ = void 0;\n var tmp$_0 = void 0;\n var tmp$_1 = void 0;\n var $receiver = NumberFormat$Companion_getInstance().PERCENT_0;\n var $receiver_0 = equals(this.spec_0.type, '%') ? $receiver : null;\n return res.copy_rm1j3u$(tmp$, tmp$_0, tmp$_1, $receiver_0 != null ? $receiver_0 : '');\n };\n NumberFormat.prototype.computePadding_0 = function (output) {\n var length = output.sign.length + output.prefix.length + output.body.fullLength + output.suffix.length | 0;\n var padding = length < this.spec_0.width ? repeat(this.spec_0.fill, this.spec_0.width - length | 0) : '';\n return output.copy_rm1j3u$(void 0, void 0, void 0, void 0, padding);\n };\n function NumberFormat$Companion() {\n NumberFormat$Companion_instance = this;\n this.TYPE_E_MIN = 1.0E-323;\n this.TYPE_S_UPPER_LIMiT = 1.0E40;\n this.TYPE_S_MAX = 1.0E26;\n this.CURRENCY_0 = '$';\n this.PERCENT_0 = '%';\n this.COMMA_0 = ',';\n this.FRACTION_DELIMITER_0 = '.';\n this.FRACTION_DELIMITER_LENGTH_0 = 1;\n this.GROUP_SIZE_0 = 3;\n this.SI_SUFFIXES_0 = ['y', 'z', 'a', 'f', 'p', 'n', '\\xB5', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];\n this.NUMBER_REGEX_0 = Regex_init('^(?:([^{}])?([<>=^]))?([+ -])?([#$])?(0)?(\\\\d+)?(,)?(?:\\\\.(\\\\d+))?([%bcdefgosXx])?$');\n }\n NumberFormat$Companion.prototype.create_61zpoe$ = function (spec) {\n return this.create_xck536$(this.parse_0(spec));\n };\n NumberFormat$Companion.prototype.create_xck536$ = function (spec) {\n var precision = spec.precision;\n var type = spec.type;\n var trim = false;\n if (equals(type, '')) {\n if (precision === -1) {\n precision = 12;\n }type = 'g';\n }if (equals(type, 'g')) {\n trim = true;\n }var zero = spec.zero;\n var fill = spec.fill;\n var align = spec.align;\n if (zero || (equals(fill, '0') && equals(align, '='))) {\n zero = true;\n fill = '0';\n align = '=';\n }return spec.copy_xzdl1p$(fill, align, void 0, void 0, zero, void 0, void 0, precision, type, trim);\n };\n NumberFormat$Companion.prototype.isValidPattern_61zpoe$ = function (spec) {\n return this.NUMBER_REGEX_0.matches_6bul2c$(spec);\n };\n NumberFormat$Companion.prototype.parse_0 = function (spec) {\n var 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, tmp$_12, tmp$_13;\n tmp$ = this.NUMBER_REGEX_0.find_905azu$(spec);\n if (tmp$ == null) {\n throw IllegalArgumentException_init('Wrong pattern format');\n }var matchResult = tmp$;\n return new NumberFormat$Spec((tmp$_1 = (tmp$_0 = matchResult.groups.get_za3lpa$(1)) != null ? tmp$_0.value : null) != null ? tmp$_1 : ' ', (tmp$_3 = (tmp$_2 = matchResult.groups.get_za3lpa$(2)) != null ? tmp$_2.value : null) != null ? tmp$_3 : '>', (tmp$_5 = (tmp$_4 = matchResult.groups.get_za3lpa$(3)) != null ? tmp$_4.value : null) != null ? tmp$_5 : '-', (tmp$_7 = (tmp$_6 = matchResult.groups.get_za3lpa$(4)) != null ? tmp$_6.value : null) != null ? tmp$_7 : '', matchResult.groups.get_za3lpa$(5) != null, toInt((tmp$_9 = (tmp$_8 = matchResult.groups.get_za3lpa$(6)) != null ? tmp$_8.value : null) != null ? tmp$_9 : '-1'), matchResult.groups.get_za3lpa$(7) != null, toInt((tmp$_11 = (tmp$_10 = matchResult.groups.get_za3lpa$(8)) != null ? tmp$_10.value : null) != null ? tmp$_11 : '6'), (tmp$_13 = (tmp$_12 = matchResult.groups.get_za3lpa$(9)) != null ? tmp$_12.value : null) != null ? tmp$_13 : '');\n };\n function NumberFormat$Companion$group$lambda(it) {\n return joinToString(it, '');\n }\n NumberFormat$Companion.prototype.group_0 = function (str) {\n var tmp$;\n var $receiver = joinToString_0(map(chunked(asSequence_0(reversed_0(Kotlin.isCharSequence(tmp$ = str) ? tmp$ : throwCCE()).toString()), 3), NumberFormat$Companion$group$lambda), this.COMMA_0);\n var tmp$_0;\n return reversed_0(Kotlin.isCharSequence(tmp$_0 = $receiver) ? tmp$_0 : throwCCE()).toString();\n };\n NumberFormat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var NumberFormat$Companion_instance = null;\n function NumberFormat$Companion_getInstance() {\n if (NumberFormat$Companion_instance === null) {\n new NumberFormat$Companion();\n }return NumberFormat$Companion_instance;\n }\n NumberFormat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NumberFormat',\n interfaces: []\n };\n function NumberFormat_init(spec, $this) {\n $this = $this || Object.create(NumberFormat.prototype);\n NumberFormat.call($this, NumberFormat$Companion_getInstance().create_61zpoe$(spec));\n return $this;\n }\n function ChildList(myParent) {\n ObservableArrayList.call(this);\n this.myParent_2riath$_0 = myParent;\n this.addListener_n5no9j$(new ChildList_init$ObjectLiteral());\n }\n ChildList.prototype.checkAdd_wxm5ur$ = function (index, item) {\n ObservableArrayList.prototype.checkAdd_wxm5ur$.call(this, index, item);\n if (item.parentProperty().get() != null) {\n throw IllegalArgumentException_init_0();\n }};\n function ChildList$beforeItemAdded$ObjectLiteral(closure$item, this$ChildList) {\n this.closure$item = closure$item;\n this.this$ChildList = this$ChildList;\n }\n function ChildList$beforeItemAdded$ObjectLiteral$get$ObjectLiteral(this$ChildList, closure$index) {\n this.this$ChildList = this$ChildList;\n this.closure$index = closure$index;\n }\n Object.defineProperty(ChildList$beforeItemAdded$ObjectLiteral$get$ObjectLiteral.prototype, 'role', {\n configurable: true,\n get: function () {\n return this.this$ChildList;\n }\n });\n ChildList$beforeItemAdded$ObjectLiteral$get$ObjectLiteral.prototype.get = function () {\n return this.this$ChildList.size <= this.closure$index ? null : this.this$ChildList.get_za3lpa$(this.closure$index);\n };\n ChildList$beforeItemAdded$ObjectLiteral$get$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Position]\n };\n ChildList$beforeItemAdded$ObjectLiteral.prototype.get = function () {\n var index = this.this$ChildList.indexOf_11rb$(this.closure$item);\n return new ChildList$beforeItemAdded$ObjectLiteral$get$ObjectLiteral(this.this$ChildList, index);\n };\n ChildList$beforeItemAdded$ObjectLiteral.prototype.remove = function () {\n this.this$ChildList.remove_11rb$(this.closure$item);\n };\n ChildList$beforeItemAdded$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PositionData]\n };\n ChildList.prototype.beforeItemAdded_wxm5ur$ = function (index, item) {\n item.parentProperty().set_11rb$(this.myParent_2riath$_0);\n item.setPositionData_uvvaqs$(new ChildList$beforeItemAdded$ObjectLiteral(item, this));\n };\n ChildList.prototype.checkSet_hu11d4$ = function (index, oldItem, newItem) {\n ObservableArrayList.prototype.checkSet_hu11d4$.call(this, index, oldItem, newItem);\n this.checkRemove_wxm5ur$(index, oldItem);\n this.checkAdd_wxm5ur$(index, newItem);\n };\n ChildList.prototype.beforeItemSet_hu11d4$ = function (index, oldItem, newItem) {\n this.beforeItemAdded_wxm5ur$(index, newItem);\n };\n ChildList.prototype.checkRemove_wxm5ur$ = function (index, item) {\n ObservableArrayList.prototype.checkRemove_wxm5ur$.call(this, index, item);\n if (item.parentProperty().get() !== this.myParent_2riath$_0) {\n throw IllegalArgumentException_init_0();\n }};\n function ChildList_init$ObjectLiteral() {\n CollectionAdapter.call(this);\n }\n ChildList_init$ObjectLiteral.prototype.onItemAdded_u8tacu$ = function (event) {\n ensureNotNull(event.newItem).parentProperty().flush();\n };\n ChildList_init$ObjectLiteral.prototype.onItemRemoved_u8tacu$ = function (event) {\n var item = event.oldItem;\n ensureNotNull(item).parentProperty().set_11rb$(null);\n item.setPositionData_uvvaqs$(null);\n item.parentProperty().flush();\n };\n ChildList_init$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [CollectionAdapter]\n };\n ChildList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ChildList',\n interfaces: [ObservableArrayList]\n };\n function ChildProperty(myParent) {\n ValueProperty.call(this, null);\n this.myParent_0 = myParent;\n }\n function ChildProperty$set$ObjectLiteral(this$ChildProperty) {\n this.this$ChildProperty = this$ChildProperty;\n }\n function ChildProperty$set$ObjectLiteral$get$ObjectLiteral(this$ChildProperty) {\n this.this$ChildProperty = this$ChildProperty;\n }\n Object.defineProperty(ChildProperty$set$ObjectLiteral$get$ObjectLiteral.prototype, 'role', {\n configurable: true,\n get: function () {\n return this.this$ChildProperty;\n }\n });\n ChildProperty$set$ObjectLiteral$get$ObjectLiteral.prototype.get = function () {\n return this.this$ChildProperty.get();\n };\n ChildProperty$set$ObjectLiteral$get$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Position]\n };\n ChildProperty$set$ObjectLiteral.prototype.get = function () {\n return new ChildProperty$set$ObjectLiteral$get$ObjectLiteral(this.this$ChildProperty);\n };\n ChildProperty$set$ObjectLiteral.prototype.remove = function () {\n this.this$ChildProperty.set_11rb$(null);\n };\n ChildProperty$set$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PositionData]\n };\n ChildProperty.prototype.set_11rb$ = function (value) {\n var tmp$;\n if (this.get() === value)\n return;\n if (value != null && value.parentProperty().get() != null) {\n throw IllegalStateException_init_0();\n }var oldValue = this.get();\n if (oldValue != null) {\n oldValue.parentProperty().set_11rb$(null);\n oldValue.setPositionData_uvvaqs$(null);\n }if (value != null) {\n value.parentProperty().set_11rb$(this.myParent_0);\n value.setPositionData_uvvaqs$(new ChildProperty$set$ObjectLiteral(this));\n }ValueProperty.prototype.set_11rb$.call(this, value);\n if (oldValue != null) {\n oldValue.parentProperty().flush();\n }(tmp$ = value != null ? value.parentProperty() : null) != null ? (tmp$.flush(), Unit) : null;\n };\n ChildProperty.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ChildProperty',\n interfaces: [ValueProperty]\n };\n function Position() {\n }\n Position.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Position',\n interfaces: []\n };\n function PositionData() {\n }\n PositionData.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PositionData',\n interfaces: []\n };\n function SimpleComposite() {\n this.myParent_eaa9sw$_0 = new DelayedValueProperty();\n this.myPositionData_2io8uh$_0 = null;\n }\n Object.defineProperty(SimpleComposite.prototype, 'position', {\n configurable: true,\n get: function () {\n if (this.myPositionData_2io8uh$_0 == null) {\n throw IllegalStateException_init_0();\n }return ensureNotNull(this.myPositionData_2io8uh$_0).get();\n }\n });\n SimpleComposite.prototype.removeFromParent = function () {\n if (this.myPositionData_2io8uh$_0 == null)\n return;\n ensureNotNull(this.myPositionData_2io8uh$_0).remove();\n };\n SimpleComposite.prototype.parentProperty = function () {\n return this.myParent_eaa9sw$_0;\n };\n SimpleComposite.prototype.setPositionData_uvvaqs$ = function (positionData) {\n this.myPositionData_2io8uh$_0 = positionData;\n };\n SimpleComposite.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SimpleComposite',\n interfaces: []\n };\n function CollectionAdapter() {\n }\n CollectionAdapter.prototype.onItemAdded_u8tacu$ = function (event) {\n };\n CollectionAdapter.prototype.onItemSet_u8tacu$ = function (event) {\n this.onItemRemoved_u8tacu$(new CollectionItemEvent(event.oldItem, null, event.index, CollectionItemEvent$EventType$REMOVE_getInstance()));\n this.onItemAdded_u8tacu$(new CollectionItemEvent(null, event.newItem, event.index, CollectionItemEvent$EventType$ADD_getInstance()));\n };\n CollectionAdapter.prototype.onItemRemoved_u8tacu$ = function (event) {\n };\n CollectionAdapter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CollectionAdapter',\n interfaces: [CollectionListener]\n };\n function CollectionItemEvent(oldItem, newItem, index, type) {\n this.oldItem = oldItem;\n this.newItem = newItem;\n this.index = index;\n this.type = type;\n if (CollectionItemEvent$EventType$ADD_getInstance() === this.type && this.oldItem != null || (CollectionItemEvent$EventType$REMOVE_getInstance() === this.type && this.newItem != null)) {\n throw IllegalStateException_init_0();\n }}\n CollectionItemEvent.prototype.dispatch_11rb$ = function (l) {\n if (CollectionItemEvent$EventType$ADD_getInstance() === this.type) {\n l.onItemAdded_u8tacu$(this);\n } else if (CollectionItemEvent$EventType$SET_getInstance() === this.type) {\n l.onItemSet_u8tacu$(this);\n } else {\n l.onItemRemoved_u8tacu$(this);\n }\n };\n CollectionItemEvent.prototype.toString = function () {\n var tmp$;\n if (CollectionItemEvent$EventType$ADD_getInstance() === this.type) {\n tmp$ = toString(this.newItem) + ' added at ' + toString(this.index);\n } else if (CollectionItemEvent$EventType$SET_getInstance() === this.type) {\n tmp$ = toString(this.oldItem) + ' replaced with ' + toString(this.newItem) + ' at ' + toString(this.index);\n } else {\n tmp$ = toString(this.oldItem) + ' removed at ' + toString(this.index);\n }\n return tmp$;\n };\n CollectionItemEvent.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, CollectionItemEvent) ? tmp$_0 : throwCCE();\n if (!equals(this.oldItem, other.oldItem))\n return false;\n if (!equals(this.newItem, other.newItem))\n return false;\n if (this.index !== other.index)\n return false;\n if (this.type !== other.type)\n return false;\n return true;\n };\n CollectionItemEvent.prototype.hashCode = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var result = (tmp$_0 = (tmp$ = this.oldItem) != null ? hashCode(tmp$) : null) != null ? tmp$_0 : 0;\n result = (31 * result | 0) + ((tmp$_2 = (tmp$_1 = this.newItem) != null ? hashCode(tmp$_1) : null) != null ? tmp$_2 : 0) | 0;\n result = (31 * result | 0) + this.index | 0;\n result = (31 * result | 0) + this.type.hashCode() | 0;\n return result;\n };\n function CollectionItemEvent$EventType(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function CollectionItemEvent$EventType_initFields() {\n CollectionItemEvent$EventType_initFields = function () {\n };\n CollectionItemEvent$EventType$ADD_instance = new CollectionItemEvent$EventType('ADD', 0);\n CollectionItemEvent$EventType$SET_instance = new CollectionItemEvent$EventType('SET', 1);\n CollectionItemEvent$EventType$REMOVE_instance = new CollectionItemEvent$EventType('REMOVE', 2);\n }\n var CollectionItemEvent$EventType$ADD_instance;\n function CollectionItemEvent$EventType$ADD_getInstance() {\n CollectionItemEvent$EventType_initFields();\n return CollectionItemEvent$EventType$ADD_instance;\n }\n var CollectionItemEvent$EventType$SET_instance;\n function CollectionItemEvent$EventType$SET_getInstance() {\n CollectionItemEvent$EventType_initFields();\n return CollectionItemEvent$EventType$SET_instance;\n }\n var CollectionItemEvent$EventType$REMOVE_instance;\n function CollectionItemEvent$EventType$REMOVE_getInstance() {\n CollectionItemEvent$EventType_initFields();\n return CollectionItemEvent$EventType$REMOVE_instance;\n }\n CollectionItemEvent$EventType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'EventType',\n interfaces: [Enum]\n };\n function CollectionItemEvent$EventType$values() {\n return [CollectionItemEvent$EventType$ADD_getInstance(), CollectionItemEvent$EventType$SET_getInstance(), CollectionItemEvent$EventType$REMOVE_getInstance()];\n }\n CollectionItemEvent$EventType.values = CollectionItemEvent$EventType$values;\n function CollectionItemEvent$EventType$valueOf(name) {\n switch (name) {\n case 'ADD':\n return CollectionItemEvent$EventType$ADD_getInstance();\n case 'SET':\n return CollectionItemEvent$EventType$SET_getInstance();\n case 'REMOVE':\n return CollectionItemEvent$EventType$REMOVE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.observable.collections.CollectionItemEvent.EventType.' + name);\n }\n }\n CollectionItemEvent$EventType.valueOf_61zpoe$ = CollectionItemEvent$EventType$valueOf;\n CollectionItemEvent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CollectionItemEvent',\n interfaces: [ListenerEvent]\n };\n function CollectionListener() {\n }\n CollectionListener.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'CollectionListener',\n interfaces: []\n };\n function ObservableCollection() {\n }\n ObservableCollection.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ObservableCollection',\n interfaces: [EventSource, MutableCollection]\n };\n function AbstractObservableList() {\n AbstractMutableList.call(this);\n this.myListeners_ky8jhb$_0 = null;\n }\n AbstractObservableList.prototype.checkAdd_wxm5ur$ = function (index, item) {\n if (index < 0 || index > this.size) {\n throw new IndexOutOfBoundsException('Add: index=' + index + ', size=' + this.size);\n }};\n AbstractObservableList.prototype.checkSet_hu11d4$ = function (index, oldItem, newItem) {\n if (index < 0 || index >= this.size) {\n throw new IndexOutOfBoundsException('Set: index=' + index + ', size=' + this.size);\n }};\n AbstractObservableList.prototype.checkRemove_wxm5ur$ = function (index, item) {\n if (index < 0 || index >= this.size) {\n throw new IndexOutOfBoundsException('Remove: index=' + index + ', size=' + this.size);\n }};\n function AbstractObservableList$add$ObjectLiteral(closure$event) {\n this.closure$event = closure$event;\n }\n AbstractObservableList$add$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onItemAdded_u8tacu$(this.closure$event);\n };\n AbstractObservableList$add$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n AbstractObservableList.prototype.add_wxm5ur$ = function (index, element) {\n this.checkAdd_wxm5ur$(index, element);\n this.beforeItemAdded_wxm5ur$(index, element);\n var success = false;\n try {\n this.doAdd_wxm5ur$(index, element);\n success = true;\n this.onItemAdd_wxm5ur$(index, element);\n if (this.myListeners_ky8jhb$_0 != null) {\n var event = new CollectionItemEvent(null, element, index, CollectionItemEvent$EventType$ADD_getInstance());\n ensureNotNull(this.myListeners_ky8jhb$_0).fire_kucmxw$(new AbstractObservableList$add$ObjectLiteral(event));\n }}finally {\n this.afterItemAdded_5x52oa$(index, element, success);\n }\n };\n AbstractObservableList.prototype.beforeItemAdded_wxm5ur$ = function (index, item) {\n };\n AbstractObservableList.prototype.onItemAdd_wxm5ur$ = function (index, item) {\n };\n AbstractObservableList.prototype.afterItemAdded_5x52oa$ = function (index, item, success) {\n };\n function AbstractObservableList$set$ObjectLiteral(closure$event) {\n this.closure$event = closure$event;\n }\n AbstractObservableList$set$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onItemSet_u8tacu$(this.closure$event);\n };\n AbstractObservableList$set$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n AbstractObservableList.prototype.set_wxm5ur$ = function (index, element) {\n var old = this.get_za3lpa$(index);\n this.checkSet_hu11d4$(index, old, element);\n this.beforeItemSet_hu11d4$(index, old, element);\n var success = false;\n try {\n this.doSet_wxm5ur$(index, element);\n success = true;\n this.onItemSet_hu11d4$(index, old, element);\n if (this.myListeners_ky8jhb$_0 != null) {\n var event = new CollectionItemEvent(old, element, index, CollectionItemEvent$EventType$SET_getInstance());\n ensureNotNull(this.myListeners_ky8jhb$_0).fire_kucmxw$(new AbstractObservableList$set$ObjectLiteral(event));\n }}finally {\n this.afterItemSet_yk9x8x$(index, old, element, success);\n }\n return old;\n };\n AbstractObservableList.prototype.doSet_wxm5ur$ = function (index, item) {\n this.doRemove_za3lpa$(index);\n this.doAdd_wxm5ur$(index, item);\n };\n AbstractObservableList.prototype.beforeItemSet_hu11d4$ = function (index, oldItem, newItem) {\n };\n AbstractObservableList.prototype.onItemSet_hu11d4$ = function (index, oldItem, newItem) {\n };\n AbstractObservableList.prototype.afterItemSet_yk9x8x$ = function (index, oldItem, newItem, success) {\n };\n function AbstractObservableList$removeAt$ObjectLiteral(closure$event) {\n this.closure$event = closure$event;\n }\n AbstractObservableList$removeAt$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onItemRemoved_u8tacu$(this.closure$event);\n };\n AbstractObservableList$removeAt$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n AbstractObservableList.prototype.removeAt_za3lpa$ = function (index) {\n var item = this.get_za3lpa$(index);\n this.checkRemove_wxm5ur$(index, item);\n this.beforeItemRemoved_wxm5ur$(index, item);\n var success = false;\n try {\n this.doRemove_za3lpa$(index);\n success = true;\n this.onItemRemove_wxm5ur$(index, item);\n if (this.myListeners_ky8jhb$_0 != null) {\n var event = new CollectionItemEvent(item, null, index, CollectionItemEvent$EventType$REMOVE_getInstance());\n ensureNotNull(this.myListeners_ky8jhb$_0).fire_kucmxw$(new AbstractObservableList$removeAt$ObjectLiteral(event));\n }}finally {\n this.afterItemRemoved_5x52oa$(index, item, success);\n }\n return item;\n };\n AbstractObservableList.prototype.beforeItemRemoved_wxm5ur$ = function (index, item) {\n };\n AbstractObservableList.prototype.onItemRemove_wxm5ur$ = function (index, item) {\n };\n AbstractObservableList.prototype.afterItemRemoved_5x52oa$ = function (index, item, success) {\n };\n function AbstractObservableList$addListener$ObjectLiteral(this$AbstractObservableList) {\n this.this$AbstractObservableList = this$AbstractObservableList;\n Listeners.call(this);\n }\n AbstractObservableList$addListener$ObjectLiteral.prototype.beforeFirstAdded = function () {\n this.this$AbstractObservableList.onListenersAdded();\n };\n AbstractObservableList$addListener$ObjectLiteral.prototype.afterLastRemoved = function () {\n this.this$AbstractObservableList.myListeners_ky8jhb$_0 = null;\n this.this$AbstractObservableList.onListenersRemoved();\n };\n AbstractObservableList$addListener$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Listeners]\n };\n AbstractObservableList.prototype.addListener_n5no9j$ = function (l) {\n if (this.myListeners_ky8jhb$_0 == null) {\n this.myListeners_ky8jhb$_0 = new AbstractObservableList$addListener$ObjectLiteral(this);\n }return ensureNotNull(this.myListeners_ky8jhb$_0).add_11rb$(l);\n };\n function AbstractObservableList$addHandler$ObjectLiteral(closure$handler) {\n this.closure$handler = closure$handler;\n }\n AbstractObservableList$addHandler$ObjectLiteral.prototype.onItemAdded_u8tacu$ = function (event) {\n this.closure$handler.onEvent_11rb$(event);\n };\n AbstractObservableList$addHandler$ObjectLiteral.prototype.onItemSet_u8tacu$ = function (event) {\n this.closure$handler.onEvent_11rb$(event);\n };\n AbstractObservableList$addHandler$ObjectLiteral.prototype.onItemRemoved_u8tacu$ = function (event) {\n this.closure$handler.onEvent_11rb$(event);\n };\n AbstractObservableList$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [CollectionListener]\n };\n AbstractObservableList.prototype.addHandler_gxwwpc$ = function (handler) {\n var listener = new AbstractObservableList$addHandler$ObjectLiteral(handler);\n return this.addListener_n5no9j$(listener);\n };\n AbstractObservableList.prototype.onListenersAdded = function () {\n };\n AbstractObservableList.prototype.onListenersRemoved = function () {\n };\n AbstractObservableList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractObservableList',\n interfaces: [ObservableList, AbstractMutableList]\n };\n function ObservableArrayList() {\n AbstractObservableList.call(this);\n this.myContainer_2lyzpq$_0 = null;\n }\n Object.defineProperty(ObservableArrayList.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.myContainer_2lyzpq$_0 == null ? 0 : ensureNotNull(this.myContainer_2lyzpq$_0).size;\n }\n });\n ObservableArrayList.prototype.get_za3lpa$ = function (index) {\n if (this.myContainer_2lyzpq$_0 == null) {\n throw new IndexOutOfBoundsException(index.toString());\n }return ensureNotNull(this.myContainer_2lyzpq$_0).get_za3lpa$(index);\n };\n ObservableArrayList.prototype.doAdd_wxm5ur$ = function (index, item) {\n this.ensureContainerInitialized_mjxwec$_0();\n ensureNotNull(this.myContainer_2lyzpq$_0).add_wxm5ur$(index, item);\n };\n ObservableArrayList.prototype.doSet_wxm5ur$ = function (index, item) {\n ensureNotNull(this.myContainer_2lyzpq$_0).set_wxm5ur$(index, item);\n };\n ObservableArrayList.prototype.doRemove_za3lpa$ = function (index) {\n ensureNotNull(this.myContainer_2lyzpq$_0).removeAt_za3lpa$(index);\n if (ensureNotNull(this.myContainer_2lyzpq$_0).isEmpty()) {\n this.myContainer_2lyzpq$_0 = null;\n }};\n ObservableArrayList.prototype.ensureContainerInitialized_mjxwec$_0 = function () {\n if (this.myContainer_2lyzpq$_0 == null) {\n this.myContainer_2lyzpq$_0 = ArrayList_init_0(1);\n }};\n ObservableArrayList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ObservableArrayList',\n interfaces: [AbstractObservableList]\n };\n function ObservableList() {\n }\n ObservableList.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ObservableList',\n interfaces: [ObservableCollection, MutableList]\n };\n function CompositeEventSource() {\n this.myHandlers_0 = null;\n this.myEventSources_0 = ArrayList_init();\n this.myRegistrations_0 = ArrayList_init();\n }\n CompositeEventSource.prototype.add_5zt0a2$ = function (source) {\n this.myEventSources_0.add_11rb$(source);\n };\n CompositeEventSource.prototype.remove_r5wlyb$ = function (source) {\n var $receiver = this.myEventSources_0;\n var tmp$;\n (Kotlin.isType(tmp$ = $receiver, MutableCollection) ? tmp$ : throwCCE()).remove_11rb$(source);\n };\n function CompositeEventSource$addHandler$ObjectLiteral(this$CompositeEventSource) {\n this.this$CompositeEventSource = this$CompositeEventSource;\n Listeners.call(this);\n }\n CompositeEventSource$addHandler$ObjectLiteral.prototype.beforeFirstAdded = function () {\n var tmp$;\n tmp$ = this.this$CompositeEventSource.myEventSources_0.iterator();\n while (tmp$.hasNext()) {\n var src = tmp$.next();\n this.this$CompositeEventSource.addHandlerTo_0(src);\n }\n };\n CompositeEventSource$addHandler$ObjectLiteral.prototype.afterLastRemoved = function () {\n var tmp$;\n tmp$ = this.this$CompositeEventSource.myRegistrations_0.iterator();\n while (tmp$.hasNext()) {\n var hr = tmp$.next();\n hr.remove();\n }\n this.this$CompositeEventSource.myRegistrations_0.clear();\n this.this$CompositeEventSource.myHandlers_0 = null;\n };\n CompositeEventSource$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Listeners]\n };\n CompositeEventSource.prototype.addHandler_gxwwpc$ = function (handler) {\n if (this.myHandlers_0 == null) {\n this.myHandlers_0 = new CompositeEventSource$addHandler$ObjectLiteral(this);\n }return ensureNotNull(this.myHandlers_0).add_11rb$(handler);\n };\n function CompositeEventSource$addHandlerTo$ObjectLiteral(this$CompositeEventSource) {\n this.this$CompositeEventSource = this$CompositeEventSource;\n }\n function CompositeEventSource$addHandlerTo$ObjectLiteral$onEvent$ObjectLiteral(closure$event) {\n this.closure$event = closure$event;\n }\n CompositeEventSource$addHandlerTo$ObjectLiteral$onEvent$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onEvent_11rb$(this.closure$event);\n };\n CompositeEventSource$addHandlerTo$ObjectLiteral$onEvent$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n CompositeEventSource$addHandlerTo$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n ensureNotNull(this.this$CompositeEventSource.myHandlers_0).fire_kucmxw$(new CompositeEventSource$addHandlerTo$ObjectLiteral$onEvent$ObjectLiteral(event));\n };\n CompositeEventSource$addHandlerTo$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n CompositeEventSource.prototype.addHandlerTo_0 = function (src) {\n this.myRegistrations_0.add_11rb$(src.addHandler_gxwwpc$(new CompositeEventSource$addHandlerTo$ObjectLiteral(this)));\n };\n CompositeEventSource.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CompositeEventSource',\n interfaces: [EventSource]\n };\n function CompositeEventSource_init(sources, $this) {\n $this = $this || Object.create(CompositeEventSource.prototype);\n CompositeEventSource.call($this);\n var tmp$;\n for (tmp$ = 0; tmp$ !== sources.length; ++tmp$) {\n var s = sources[tmp$];\n $this.add_5zt0a2$(s);\n }\n return $this;\n }\n function CompositeEventSource_init_0(sources, $this) {\n $this = $this || Object.create(CompositeEventSource.prototype);\n CompositeEventSource.call($this);\n var tmp$;\n tmp$ = sources.iterator();\n while (tmp$.hasNext()) {\n var s = tmp$.next();\n $this.add_5zt0a2$(s);\n }\n return $this;\n }\n function EventHandler() {\n }\n EventHandler.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'EventHandler',\n interfaces: []\n };\n function EventSource() {\n }\n EventSource.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'EventSource',\n interfaces: []\n };\n function EventSources() {\n EventSources_instance = this;\n }\n function EventSources$of$ObjectLiteral(closure$events) {\n this.closure$events = closure$events;\n }\n EventSources$of$ObjectLiteral.prototype.addHandler_gxwwpc$ = function (handler) {\n var tmp$, tmp$_0;\n tmp$ = this.closure$events;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var e = tmp$[tmp$_0];\n handler.onEvent_11rb$(e);\n }\n return Registration$Companion_getInstance().EMPTY;\n };\n EventSources$of$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventSource]\n };\n EventSources.prototype.of_i5x0yv$ = function (events) {\n return new EventSources$of$ObjectLiteral(events);\n };\n EventSources.prototype.empty_287e2$ = function () {\n return this.composite_xw2ruy$([]);\n };\n EventSources.prototype.composite_xw2ruy$ = function (sources) {\n return CompositeEventSource_init(sources.slice());\n };\n EventSources.prototype.composite_3qo2qg$ = function (sources) {\n return CompositeEventSource_init_0(sources);\n };\n function EventSources$filter$ObjectLiteral(closure$source, closure$pred) {\n this.closure$source = closure$source;\n this.closure$pred = closure$pred;\n }\n function EventSources$filter$ObjectLiteral$addHandler$ObjectLiteral(closure$pred, closure$handler) {\n this.closure$pred = closure$pred;\n this.closure$handler = closure$handler;\n }\n EventSources$filter$ObjectLiteral$addHandler$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n if (this.closure$pred(event)) {\n this.closure$handler.onEvent_11rb$(event);\n }};\n EventSources$filter$ObjectLiteral$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n EventSources$filter$ObjectLiteral.prototype.addHandler_gxwwpc$ = function (handler) {\n return this.closure$source.addHandler_gxwwpc$(new EventSources$filter$ObjectLiteral$addHandler$ObjectLiteral(this.closure$pred, handler));\n };\n EventSources$filter$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventSource]\n };\n EventSources.prototype.filter_ff3xdm$ = function (source, pred) {\n return new EventSources$filter$ObjectLiteral(source, pred);\n };\n EventSources.prototype.map_9hq6p$ = function (src, f) {\n return new MappingEventSource(src, f);\n };\n function EventSources$selectList$ObjectLiteral(closure$list, closure$selector) {\n this.closure$list = closure$list;\n this.closure$selector = closure$selector;\n }\n function EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral(closure$itemRegs, closure$selector, closure$handler) {\n this.closure$itemRegs = closure$itemRegs;\n this.closure$selector = closure$selector;\n this.closure$handler = closure$handler;\n CollectionAdapter.call(this);\n }\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral.prototype.onItemAdded_u8tacu$ = function (event) {\n this.closure$itemRegs.add_wxm5ur$(event.index, this.closure$selector(event.newItem).addHandler_gxwwpc$(this.closure$handler));\n };\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral.prototype.onItemRemoved_u8tacu$ = function (event) {\n this.closure$itemRegs.removeAt_za3lpa$(event.index).remove();\n };\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [CollectionAdapter]\n };\n function EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0(closure$itemRegs, closure$listReg) {\n this.closure$itemRegs = closure$itemRegs;\n this.closure$listReg = closure$listReg;\n Registration.call(this);\n }\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0.prototype.doRemove = function () {\n var tmp$;\n tmp$ = this.closure$itemRegs.iterator();\n while (tmp$.hasNext()) {\n var r = tmp$.next();\n r.remove();\n }\n this.closure$listReg.remove();\n };\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n EventSources$selectList$ObjectLiteral.prototype.addHandler_gxwwpc$ = function (handler) {\n var tmp$;\n var itemRegs = ArrayList_init();\n tmp$ = this.closure$list.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n itemRegs.add_11rb$(this.closure$selector(item).addHandler_gxwwpc$(handler));\n }\n var listReg = this.closure$list.addListener_n5no9j$(new EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral(itemRegs, this.closure$selector, handler));\n return new EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0(itemRegs, listReg);\n };\n EventSources$selectList$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventSource]\n };\n EventSources.prototype.selectList_jnjwvc$ = function (list, selector) {\n return new EventSources$selectList$ObjectLiteral(list, selector);\n };\n EventSources.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'EventSources',\n interfaces: []\n };\n var EventSources_instance = null;\n function EventSources_getInstance() {\n if (EventSources_instance === null) {\n new EventSources();\n }return EventSources_instance;\n }\n function ListenerCaller() {\n }\n ListenerCaller.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ListenerCaller',\n interfaces: []\n };\n function ListenerEvent() {\n }\n ListenerEvent.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ListenerEvent',\n interfaces: []\n };\n function Listeners() {\n this.myListeners_30lqoe$_0 = null;\n this.myFireDepth_t4vnc0$_0 = 0;\n this.myListenersCount_umrzvt$_0 = 0;\n }\n Object.defineProperty(Listeners.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myListeners_30lqoe$_0 == null || ensureNotNull(this.myListeners_30lqoe$_0).isEmpty();\n }\n });\n function Listeners$add$ObjectLiteral(this$Listeners, closure$l) {\n this.this$Listeners = this$Listeners;\n this.closure$l = closure$l;\n Registration.call(this);\n }\n Listeners$add$ObjectLiteral.prototype.doRemove = function () {\n var tmp$, tmp$_0;\n if (this.this$Listeners.myFireDepth_t4vnc0$_0 > 0) {\n ensureNotNull(this.this$Listeners.myListeners_30lqoe$_0).add_11rb$(new Listeners$ListenerOp(this.closure$l, false));\n } else {\n ensureNotNull(this.this$Listeners.myListeners_30lqoe$_0).remove_11rb$(Kotlin.isType(tmp$ = this.closure$l, Any) ? tmp$ : throwCCE());\n tmp$_0 = this.this$Listeners.myListenersCount_umrzvt$_0;\n this.this$Listeners.myListenersCount_umrzvt$_0 = tmp$_0 - 1 | 0;\n }\n if (this.this$Listeners.isEmpty) {\n this.this$Listeners.afterLastRemoved();\n }};\n Listeners$add$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n Listeners.prototype.add_11rb$ = function (l) {\n var tmp$;\n if (this.isEmpty) {\n this.beforeFirstAdded();\n }if (this.myFireDepth_t4vnc0$_0 > 0) {\n ensureNotNull(this.myListeners_30lqoe$_0).add_11rb$(new Listeners$ListenerOp(l, true));\n } else {\n if (this.myListeners_30lqoe$_0 == null) {\n this.myListeners_30lqoe$_0 = ArrayList_init_0(1);\n }ensureNotNull(this.myListeners_30lqoe$_0).add_11rb$(Kotlin.isType(tmp$ = l, Any) ? tmp$ : throwCCE());\n this.myListenersCount_umrzvt$_0 = this.myListenersCount_umrzvt$_0 + 1 | 0;\n }\n return new Listeners$add$ObjectLiteral(this, l);\n };\n Listeners.prototype.fire_kucmxw$ = function (h) {\n var tmp$;\n if (this.isEmpty)\n return;\n this.beforeFire_ul1jia$_0();\n try {\n var size = this.myListenersCount_umrzvt$_0;\n for (var i = 0; i < size; i++) {\n var l = (tmp$ = ensureNotNull(this.myListeners_30lqoe$_0).get_za3lpa$(i)) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n if (this.isRemoved_265rjw$_0(l))\n continue;\n try {\n h.call_11rb$(l);\n } catch (t) {\n if (Kotlin.isType(t, Throwable)) {\n ThrowableHandlers_getInstance().instance.handle_tcv7n7$(t);\n } else\n throw t;\n }\n }\n }finally {\n this.afterFire_xwa8xb$_0();\n }\n };\n Listeners.prototype.isRemoved_265rjw$_0 = function (l) {\n var tmp$;\n var size = ensureNotNull(this.myListeners_30lqoe$_0).size;\n for (var i = this.myListenersCount_umrzvt$_0; i < size; i++) {\n var op = Kotlin.isType(tmp$ = ensureNotNull(this.myListeners_30lqoe$_0).get_za3lpa$(i), Listeners$ListenerOp) ? tmp$ : throwCCE();\n if (!op.add && op.listener === l)\n return true;\n }\n return false;\n };\n Listeners.prototype.beforeFirstAdded = function () {\n };\n Listeners.prototype.afterLastRemoved = function () {\n };\n Listeners.prototype.beforeFire_ul1jia$_0 = function () {\n this.myFireDepth_t4vnc0$_0 = this.myFireDepth_t4vnc0$_0 + 1 | 0;\n };\n Listeners.prototype.afterFire_xwa8xb$_0 = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n this.myFireDepth_t4vnc0$_0 = this.myFireDepth_t4vnc0$_0 - 1 | 0;\n if (this.myFireDepth_t4vnc0$_0 === 0) {\n var opsList = ensureNotNull(this.myListeners_30lqoe$_0).subList_vux9f0$(this.myListenersCount_umrzvt$_0, ensureNotNull(this.myListeners_30lqoe$_0).size);\n var ops = copyToArray(opsList);\n opsList.clear();\n for (tmp$ = 0; tmp$ !== ops.length; ++tmp$) {\n var o = ops[tmp$];\n var op = Kotlin.isType(tmp$_0 = o, Listeners$ListenerOp) ? tmp$_0 : throwCCE();\n if (op.add) {\n ensureNotNull(this.myListeners_30lqoe$_0).add_11rb$(Kotlin.isType(tmp$_1 = op.listener, Any) ? tmp$_1 : throwCCE());\n this.myListenersCount_umrzvt$_0 = this.myListenersCount_umrzvt$_0 + 1 | 0;\n } else {\n ensureNotNull(this.myListeners_30lqoe$_0).remove_11rb$(Kotlin.isType(tmp$_2 = op.listener, Any) ? tmp$_2 : throwCCE());\n this.myListenersCount_umrzvt$_0 = this.myListenersCount_umrzvt$_0 - 1 | 0;\n }\n }\n if (this.isEmpty) {\n this.afterLastRemoved();\n }}};\n Listeners.prototype.size_8be2vx$ = function () {\n return this.myListeners_30lqoe$_0 == null ? 0 : ensureNotNull(this.myListeners_30lqoe$_0).size;\n };\n function Listeners$ListenerOp(listener, add) {\n this.listener = listener;\n this.add = add;\n }\n Listeners$ListenerOp.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ListenerOp',\n interfaces: []\n };\n Listeners.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Listeners',\n interfaces: []\n };\n function MappingEventSource(mySourceEventSource, myFunction) {\n this.mySourceEventSource_0 = mySourceEventSource;\n this.myFunction_0 = myFunction;\n }\n function MappingEventSource$addHandler$ObjectLiteral(closure$handler, this$MappingEventSource) {\n this.closure$handler = closure$handler;\n this.this$MappingEventSource = this$MappingEventSource;\n }\n MappingEventSource$addHandler$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n this.closure$handler.onEvent_11rb$(this.this$MappingEventSource.myFunction_0(event));\n };\n MappingEventSource$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n MappingEventSource.prototype.addHandler_gxwwpc$ = function (handler) {\n return this.mySourceEventSource_0.addHandler_gxwwpc$(new MappingEventSource$addHandler$ObjectLiteral(handler, this));\n };\n MappingEventSource.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MappingEventSource',\n interfaces: [EventSource]\n };\n function BaseReadableProperty() {\n this.propExpr_4jt19b$_0 = Kotlin.getKClassFromExpression(this).toString();\n }\n Object.defineProperty(BaseReadableProperty.prototype, 'propExpr', {\n configurable: true,\n get: function () {\n return this.propExpr_4jt19b$_0;\n }\n });\n BaseReadableProperty.prototype.toString = function () {\n return this.propExpr;\n };\n BaseReadableProperty.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BaseReadableProperty',\n interfaces: [ReadableProperty]\n };\n function DelayedValueProperty(myValue) {\n if (myValue === void 0)\n myValue = null;\n BaseReadableProperty.call(this);\n this.myValue_0 = myValue;\n this.myHandlers_0 = null;\n this.myPendingEvent_0 = null;\n }\n Object.defineProperty(DelayedValueProperty.prototype, 'propExpr', {\n configurable: true,\n get: function () {\n return 'delayedProperty()';\n }\n });\n DelayedValueProperty.prototype.get = function () {\n return this.myValue_0;\n };\n DelayedValueProperty.prototype.set_11rb$ = function (value) {\n if (equals(value, this.myValue_0))\n return;\n var oldValue = this.myValue_0;\n this.myValue_0 = value;\n if (this.myPendingEvent_0 != null) {\n throw IllegalStateException_init_0();\n }this.myPendingEvent_0 = new PropertyChangeEvent(oldValue, this.myValue_0);\n };\n function DelayedValueProperty$flush$ObjectLiteral(this$DelayedValueProperty) {\n this.this$DelayedValueProperty = this$DelayedValueProperty;\n }\n DelayedValueProperty$flush$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onEvent_11rb$(ensureNotNull(this.this$DelayedValueProperty.myPendingEvent_0));\n };\n DelayedValueProperty$flush$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n DelayedValueProperty.prototype.flush = function () {\n if (this.myHandlers_0 != null) {\n ensureNotNull(this.myHandlers_0).fire_kucmxw$(new DelayedValueProperty$flush$ObjectLiteral(this));\n }this.myPendingEvent_0 = null;\n };\n function DelayedValueProperty$addHandler$ObjectLiteral(this$DelayedValueProperty) {\n this.this$DelayedValueProperty = this$DelayedValueProperty;\n Listeners.call(this);\n }\n DelayedValueProperty$addHandler$ObjectLiteral.prototype.afterLastRemoved = function () {\n this.this$DelayedValueProperty.myHandlers_0 = null;\n };\n DelayedValueProperty$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Listeners]\n };\n DelayedValueProperty.prototype.addHandler_gxwwpc$ = function (handler) {\n if (this.myHandlers_0 == null) {\n this.myHandlers_0 = new DelayedValueProperty$addHandler$ObjectLiteral(this);\n }return ensureNotNull(this.myHandlers_0).add_11rb$(handler);\n };\n DelayedValueProperty.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DelayedValueProperty',\n interfaces: [Property, BaseReadableProperty]\n };\n function Property() {\n }\n Property.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Property',\n interfaces: [WritableProperty, ReadableProperty]\n };\n function PropertyBinding() {\n PropertyBinding_instance = this;\n }\n function PropertyBinding$bindOneWay$ObjectLiteral(closure$target) {\n this.closure$target = closure$target;\n }\n PropertyBinding$bindOneWay$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n var tmp$;\n this.closure$target.set_11rb$((tmp$ = event.newValue) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE());\n };\n PropertyBinding$bindOneWay$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n PropertyBinding.prototype.bindOneWay_2ov6i0$ = function (source, target) {\n target.set_11rb$(source.get());\n return source.addHandler_gxwwpc$(new PropertyBinding$bindOneWay$ObjectLiteral(target));\n };\n function PropertyBinding$bindTwoWay$UpdatingEventHandler(closure$syncing, closure$target, closure$source, myForward) {\n this.closure$syncing = closure$syncing;\n this.closure$target = closure$target;\n this.closure$source = closure$source;\n this.myForward_0 = myForward;\n }\n PropertyBinding$bindTwoWay$UpdatingEventHandler.prototype.onEvent_11rb$ = function (event) {\n if (this.closure$syncing.get())\n return;\n this.closure$syncing.set_11rb$(true);\n try {\n if (this.myForward_0) {\n this.closure$target.set_11rb$(this.closure$source.get());\n } else {\n this.closure$source.set_11rb$(this.closure$target.get());\n }\n }finally {\n this.closure$syncing.set_11rb$(false);\n }\n };\n PropertyBinding$bindTwoWay$UpdatingEventHandler.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'UpdatingEventHandler',\n interfaces: [EventHandler]\n };\n PropertyBinding.prototype.bindTwoWay_ejkotq$ = function (source, target) {\n var syncing = new ValueProperty(false);\n target.set_11rb$(source.get());\n return new CompositeRegistration([source.addHandler_gxwwpc$(new PropertyBinding$bindTwoWay$UpdatingEventHandler(syncing, target, source, true)), target.addHandler_gxwwpc$(new PropertyBinding$bindTwoWay$UpdatingEventHandler(syncing, target, source, false))]);\n };\n PropertyBinding.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PropertyBinding',\n interfaces: []\n };\n var PropertyBinding_instance = null;\n function PropertyBinding_getInstance() {\n if (PropertyBinding_instance === null) {\n new PropertyBinding();\n }return PropertyBinding_instance;\n }\n function PropertyChangeEvent(oldValue, newValue) {\n this.oldValue = oldValue;\n this.newValue = newValue;\n }\n PropertyChangeEvent.prototype.toString = function () {\n return toString(this.oldValue) + ' -> ' + toString(this.newValue);\n };\n PropertyChangeEvent.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, PropertyChangeEvent) ? tmp$_0 : throwCCE();\n if (!equals(this.oldValue, other.oldValue))\n return false;\n if (!equals(this.newValue, other.newValue))\n return false;\n return true;\n };\n PropertyChangeEvent.prototype.hashCode = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var result = (tmp$_0 = (tmp$ = this.oldValue) != null ? hashCode(tmp$) : null) != null ? tmp$_0 : 0;\n result = (31 * result | 0) + ((tmp$_2 = (tmp$_1 = this.newValue) != null ? hashCode(tmp$_1) : null) != null ? tmp$_2 : 0) | 0;\n return result;\n };\n PropertyChangeEvent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PropertyChangeEvent',\n interfaces: []\n };\n function ReadableProperty() {\n }\n ReadableProperty.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ReadableProperty',\n interfaces: [Supplier, EventSource]\n };\n function ValueProperty(myValue) {\n BaseReadableProperty.call(this);\n this.myValue_x0fqz2$_0 = myValue;\n this.myHandlers_sdxgfs$_0 = null;\n }\n Object.defineProperty(ValueProperty.prototype, 'propExpr', {\n configurable: true,\n get: function () {\n return 'valueProperty()';\n }\n });\n ValueProperty.prototype.get = function () {\n return this.myValue_x0fqz2$_0;\n };\n ValueProperty.prototype.set_11rb$ = function (value) {\n if (equals(value, this.myValue_x0fqz2$_0))\n return;\n var oldValue = this.myValue_x0fqz2$_0;\n this.myValue_x0fqz2$_0 = value;\n this.fireEvents_ym4swk$_0(oldValue, this.myValue_x0fqz2$_0);\n };\n function ValueProperty$fireEvents$ObjectLiteral(closure$event) {\n this.closure$event = closure$event;\n }\n ValueProperty$fireEvents$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onEvent_11rb$(this.closure$event);\n };\n ValueProperty$fireEvents$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n ValueProperty.prototype.fireEvents_ym4swk$_0 = function (oldValue, newValue) {\n if (this.myHandlers_sdxgfs$_0 != null) {\n var event = new PropertyChangeEvent(oldValue, newValue);\n ensureNotNull(this.myHandlers_sdxgfs$_0).fire_kucmxw$(new ValueProperty$fireEvents$ObjectLiteral(event));\n }};\n function ValueProperty$addHandler$ObjectLiteral(this$ValueProperty) {\n this.this$ValueProperty = this$ValueProperty;\n Listeners.call(this);\n }\n ValueProperty$addHandler$ObjectLiteral.prototype.afterLastRemoved = function () {\n this.this$ValueProperty.myHandlers_sdxgfs$_0 = null;\n };\n ValueProperty$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Listeners]\n };\n ValueProperty.prototype.addHandler_gxwwpc$ = function (handler) {\n if (this.myHandlers_sdxgfs$_0 == null) {\n this.myHandlers_sdxgfs$_0 = new ValueProperty$addHandler$ObjectLiteral(this);\n }return ensureNotNull(this.myHandlers_sdxgfs$_0).add_11rb$(handler);\n };\n ValueProperty.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ValueProperty',\n interfaces: [Property, BaseReadableProperty]\n };\n function WritableProperty() {\n }\n WritableProperty.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'WritableProperty',\n interfaces: []\n };\n function RandomGaussian(random) {\n this.random = random;\n this.nextNextGaussian_0 = 0.0;\n this.haveNextNextGaussian_0 = false;\n }\n RandomGaussian.prototype.nextGaussian = function () {\n if (this.haveNextNextGaussian_0) {\n this.haveNextNextGaussian_0 = false;\n return this.nextNextGaussian_0;\n } else {\n var v1;\n var v2;\n var s;\n do {\n v1 = 2 * this.random.nextDouble() - 1;\n v2 = 2 * this.random.nextDouble() - 1;\n s = v1 * v1 + v2 * v2;\n }\n while (s >= 1 || s === 0.0);\n var x = s;\n var x_0 = -2 * JsMath.log(x) / s;\n var multiplier = JsMath.sqrt(x_0);\n this.nextNextGaussian_0 = v2 * multiplier;\n this.haveNextNextGaussian_0 = true;\n return v1 * multiplier;\n }\n };\n RandomGaussian.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RandomGaussian',\n interfaces: []\n };\n function RandomString() {\n RandomString_instance = this;\n }\n RandomString.prototype.randomString_za3lpa$ = function (len) {\n var alphabet = plus_2(plus_0(new CharRange(97, 122), new CharRange(65, 90)), new CharRange(48, 57));\n var list = ArrayList_init_0(len);\n for (var index = 0; index < len; index++) {\n list.add_11rb$(random(alphabet, Random.Default));\n }\n return joinToString(list, '');\n };\n RandomString.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'RandomString',\n interfaces: []\n };\n var RandomString_instance = null;\n function RandomString_getInstance() {\n if (RandomString_instance === null) {\n new RandomString();\n }return RandomString_instance;\n }\n function CompositeRegistration(regs) {\n Registration.call(this);\n this.myRegistrations_0 = null;\n this.myRegistrations_0 = arrayListOf(regs.slice());\n }\n Object.defineProperty(CompositeRegistration.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myRegistrations_0.isEmpty();\n }\n });\n CompositeRegistration.prototype.add_3xv6fb$ = function (r) {\n this.myRegistrations_0.add_11rb$(r);\n return this;\n };\n CompositeRegistration.prototype.add_4wx45g$ = function (rs) {\n var tmp$;\n for (tmp$ = 0; tmp$ !== rs.length; ++tmp$) {\n var r = rs[tmp$];\n this.add_3xv6fb$(r);\n }\n return this;\n };\n CompositeRegistration.prototype.doRemove = function () {\n for (var i = this.myRegistrations_0.size - 1 | 0; i >= 0; i--) {\n this.myRegistrations_0.get_za3lpa$(i).remove();\n }\n this.myRegistrations_0.clear();\n };\n CompositeRegistration.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CompositeRegistration',\n interfaces: [Registration]\n };\n function Disposable() {\n }\n Disposable.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Disposable',\n interfaces: []\n };\n function Registration() {\n Registration$Companion_getInstance();\n this.myRemoved_guv51v$_0 = false;\n }\n Registration.prototype.remove = function () {\n if (this.myRemoved_guv51v$_0) {\n throw IllegalStateException_init('Registration already removed');\n }this.myRemoved_guv51v$_0 = true;\n this.doRemove();\n };\n Registration.prototype.dispose = function () {\n this.remove();\n };\n function Registration$EmptyRegistration() {\n Registration.call(this);\n }\n Registration$EmptyRegistration.prototype.doRemove = function () {\n };\n Registration$EmptyRegistration.prototype.remove = function () {\n };\n Registration$EmptyRegistration.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'EmptyRegistration',\n interfaces: [Registration]\n };\n function Registration$Companion() {\n Registration$Companion_instance = this;\n this.EMPTY = new Registration$EmptyRegistration();\n }\n function Registration$Companion$from$ObjectLiteral(closure$disposable) {\n this.closure$disposable = closure$disposable;\n Registration.call(this);\n }\n Registration$Companion$from$ObjectLiteral.prototype.doRemove = function () {\n this.closure$disposable.dispose();\n };\n Registration$Companion$from$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n Registration$Companion.prototype.from_gg3y3y$ = function (disposable) {\n return new Registration$Companion$from$ObjectLiteral(disposable);\n };\n function Registration$Companion$from$ObjectLiteral_0(closure$disposables) {\n this.closure$disposables = closure$disposables;\n Registration.call(this);\n }\n Registration$Companion$from$ObjectLiteral_0.prototype.doRemove = function () {\n var tmp$, tmp$_0;\n tmp$ = this.closure$disposables;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var d = tmp$[tmp$_0];\n d.dispose();\n }\n };\n Registration$Companion$from$ObjectLiteral_0.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n Registration$Companion.prototype.from_h9hjd7$ = function (disposables) {\n return new Registration$Companion$from$ObjectLiteral_0(disposables);\n };\n Registration$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Registration$Companion_instance = null;\n function Registration$Companion_getInstance() {\n if (Registration$Companion_instance === null) {\n new Registration$Companion();\n }return Registration$Companion_instance;\n }\n Registration.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Registration',\n interfaces: [Disposable]\n };\n function ThrowableHandler() {\n }\n ThrowableHandler.prototype.handle_tcv7n7$ = function (t) {\n throw t;\n };\n ThrowableHandler.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ThrowableHandler',\n interfaces: []\n };\n function ThrowableHandlers() {\n ThrowableHandlers_instance = this;\n this.instance = new ThrowableHandler();\n }\n ThrowableHandlers.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ThrowableHandlers',\n interfaces: []\n };\n var ThrowableHandlers_instance = null;\n function ThrowableHandlers_getInstance() {\n if (ThrowableHandlers_instance === null) {\n new ThrowableHandlers();\n }return ThrowableHandlers_instance;\n }\n var EARTH_RADIUS;\n var MIN_LONGITUDE;\n var MAX_LONGITUDE;\n var FULL_LONGITUDE;\n var MIN_LATITUDE;\n var MAX_LATITUDE;\n var FULL_LATITUDE;\n var compareBy$lambda = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function get_start($receiver) {\n return $receiver.first;\n }\n function get_end($receiver) {\n return $receiver.second;\n }\n function GeoBoundingBoxCalculator(myMapRect, myLoopX, myLoopY) {\n GeoBoundingBoxCalculator$Companion_getInstance();\n this.myMapRect_0 = myMapRect;\n this.myLoopX_0 = myLoopX;\n this.myLoopY_0 = myLoopY;\n }\n GeoBoundingBoxCalculator.prototype.calculateBoundingBox_qpfwx8$ = function (xSegments, ySegments) {\n var xRange_0 = this.calculateBoundingRange_0(xSegments, xRange(this.myMapRect_0), this.myLoopX_0);\n var yRange_0 = this.calculateBoundingRange_0(ySegments, yRange(this.myMapRect_0), this.myLoopY_0);\n return Rect_init(xRange_0.lowerEnd, yRange_0.lowerEnd, GeoBoundingBoxCalculator$Companion_getInstance().length_0(xRange_0), GeoBoundingBoxCalculator$Companion_getInstance().length_0(yRange_0));\n };\n GeoBoundingBoxCalculator.prototype.calculateBoundingRange_0 = function (segments, mapRange, loop) {\n var tmp$;\n if (loop) {\n tmp$ = GeoBoundingBoxCalculator$Companion_getInstance().calculateLoopLimitRange_h7l5yb$(segments, mapRange);\n } else {\n tmp$ = new ClosedRange(ensureNotNull(minOrNull(map(segments, getPropertyCallableRef('start', 1, function ($receiver) {\n return get_start($receiver);\n })))), ensureNotNull(maxOrNull(map(segments, getPropertyCallableRef('end', 1, function ($receiver) {\n return get_end($receiver);\n })))));\n }\n return tmp$;\n };\n function GeoBoundingBoxCalculator$Companion() {\n GeoBoundingBoxCalculator$Companion_instance = this;\n }\n function GeoBoundingBoxCalculator$Companion$calculateLoopLimitRange$lambda(closure$mapRange) {\n return function (it) {\n return LongitudeSegment$Companion_getInstance().splitSegment_6y0v78$(get_start(it), get_end(it), closure$mapRange.lowerEnd, closure$mapRange.upperEnd);\n };\n }\n GeoBoundingBoxCalculator$Companion.prototype.calculateLoopLimitRange_h7l5yb$ = function (segments, mapRange) {\n return this.normalizeCenter_0(this.invertRange_0(this.findMaxGapBetweenRanges_0(flatten(map(segments, GeoBoundingBoxCalculator$Companion$calculateLoopLimitRange$lambda(mapRange))), this.length_0(mapRange)), this.length_0(mapRange)), mapRange);\n };\n GeoBoundingBoxCalculator$Companion.prototype.normalizeCenter_0 = function (range, mapRange) {\n var tmp$;\n if (mapRange.contains_mef7kx$((range.upperEnd + range.lowerEnd) / 2)) {\n tmp$ = range;\n } else {\n tmp$ = new ClosedRange(range.lowerEnd - this.length_0(mapRange), range.upperEnd - this.length_0(mapRange));\n }\n return tmp$;\n };\n GeoBoundingBoxCalculator$Companion.prototype.findMaxGapBetweenRanges_0 = function (ranges, width) {\n var sortedRanges = sortedWith(ranges, new Comparator(compareBy$lambda(getPropertyCallableRef('lowerEnd', 1, function ($receiver) {\n return $receiver.lowerEnd;\n }))));\n var selector = getPropertyCallableRef('upperEnd', 1, function ($receiver) {\n return $receiver.upperEnd;\n });\n var maxByOrNull$result;\n maxByOrNull$break: do {\n var iterator = sortedRanges.iterator();\n if (!iterator.hasNext()) {\n maxByOrNull$result = null;\n break maxByOrNull$break;\n }var maxElem = iterator.next();\n if (!iterator.hasNext()) {\n maxByOrNull$result = maxElem;\n break maxByOrNull$break;\n }var maxValue = selector(maxElem);\n do {\n var e = iterator.next();\n var v = selector(e);\n if (Kotlin.compareTo(maxValue, v) < 0) {\n maxElem = e;\n maxValue = v;\n }}\n while (iterator.hasNext());\n maxByOrNull$result = maxElem;\n }\n while (false);\n var prevUpper = ensureNotNull(maxByOrNull$result).upperEnd;\n var nextLower = first_1(sortedRanges).lowerEnd;\n var a = width + nextLower;\n var b = prevUpper;\n var gapRight = JsMath.max(a, b);\n var maxGapRange = new ClosedRange(prevUpper, gapRight);\n var it = sortedRanges.iterator();\n prevUpper = it.next().upperEnd;\n while (it.hasNext()) {\n var range = it.next();\n nextLower = range.lowerEnd;\n if (nextLower > prevUpper && nextLower - prevUpper > this.length_0(maxGapRange)) {\n maxGapRange = new ClosedRange(prevUpper, nextLower);\n }var a_0 = prevUpper;\n var b_0 = range.upperEnd;\n prevUpper = JsMath.max(a_0, b_0);\n }\n return maxGapRange;\n };\n function GeoBoundingBoxCalculator$Companion$invertRange$safeRange(first, second) {\n return new ClosedRange(JsMath.min(first, second), JsMath.max(first, second));\n }\n GeoBoundingBoxCalculator$Companion.prototype.invertRange_0 = function (range, width) {\n var tmp$;\n var safeRange = GeoBoundingBoxCalculator$Companion$invertRange$safeRange;\n if (this.length_0(range) > width)\n tmp$ = new ClosedRange(range.lowerEnd, range.lowerEnd);\n else if (range.upperEnd > width)\n tmp$ = safeRange(range.upperEnd - width, range.lowerEnd);\n else\n tmp$ = safeRange(range.upperEnd, width + range.lowerEnd);\n return tmp$;\n };\n GeoBoundingBoxCalculator$Companion.prototype.length_0 = function ($receiver) {\n return $receiver.upperEnd - $receiver.lowerEnd;\n };\n GeoBoundingBoxCalculator$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeoBoundingBoxCalculator$Companion_instance = null;\n function GeoBoundingBoxCalculator$Companion_getInstance() {\n if (GeoBoundingBoxCalculator$Companion_instance === null) {\n new GeoBoundingBoxCalculator$Companion();\n }return GeoBoundingBoxCalculator$Companion_instance;\n }\n GeoBoundingBoxCalculator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeoBoundingBoxCalculator',\n interfaces: []\n };\n function makeSegments$lambda(closure$start, closure$end) {\n return function (it) {\n return new Pair(closure$start(it), closure$end(it));\n };\n }\n function makeSegments(start, end, size) {\n return map(asSequence(until(0, size)), makeSegments$lambda(start, end));\n }\n function geoRectsBBox$lambda(closure$rectangles) {\n return function (it) {\n return closure$rectangles.get_za3lpa$(it).startLongitude();\n };\n }\n function geoRectsBBox$lambda_0(closure$rectangles) {\n return function (it) {\n return closure$rectangles.get_za3lpa$(it).endLongitude();\n };\n }\n function geoRectsBBox$lambda_1(closure$rectangles) {\n return function (it) {\n return closure$rectangles.get_za3lpa$(it).minLatitude();\n };\n }\n function geoRectsBBox$lambda_2(closure$rectangles) {\n return function (it) {\n return closure$rectangles.get_za3lpa$(it).maxLatitude();\n };\n }\n function geoRectsBBox($receiver, rectangles) {\n return $receiver.calculateBoundingBox_qpfwx8$(makeSegments(geoRectsBBox$lambda(rectangles), geoRectsBBox$lambda_0(rectangles), rectangles.size), makeSegments(geoRectsBBox$lambda_1(rectangles), geoRectsBBox$lambda_2(rectangles), rectangles.size));\n }\n function pointsBBox$lambda(closure$xyCoords) {\n return function (index) {\n return closure$xyCoords.get_za3lpa$(2 * index | 0);\n };\n }\n function pointsBBox$lambda_0(closure$xyCoords) {\n return function (index) {\n return closure$xyCoords.get_za3lpa$((2 * index | 0) + 1 | 0);\n };\n }\n function pointsBBox($receiver, xyCoords) {\n if (!(xyCoords.size % 2 === 0)) {\n var message = 'Longitude-Latitude list is not even-numbered.';\n throw IllegalArgumentException_init(message.toString());\n }var x = pointsBBox$lambda(xyCoords);\n var y = pointsBBox$lambda_0(xyCoords);\n var i = xyCoords.size / 2 | 0;\n return $receiver.calculateBoundingBox_qpfwx8$(makeSegments(x, x, i), makeSegments(y, y, i));\n }\n function union$lambda(closure$rectangles) {\n return function (it) {\n return get_left(closure$rectangles.get_za3lpa$(it));\n };\n }\n function union$lambda_0(closure$rectangles) {\n return function (it) {\n return get_right(closure$rectangles.get_za3lpa$(it));\n };\n }\n function union$lambda_1(closure$rectangles) {\n return function (it) {\n return get_top(closure$rectangles.get_za3lpa$(it));\n };\n }\n function union$lambda_2(closure$rectangles) {\n return function (it) {\n return get_bottom(closure$rectangles.get_za3lpa$(it));\n };\n }\n function union($receiver, rectangles) {\n return $receiver.calculateBoundingBox_qpfwx8$(makeSegments(union$lambda(rectangles), union$lambda_0(rectangles), rectangles.size), makeSegments(union$lambda_1(rectangles), union$lambda_2(rectangles), rectangles.size));\n }\n function GeoJson() {\n GeoJson_instance = this;\n this.LON_INDEX_0 = 0;\n this.LAT_INDEX_0 = 1;\n }\n GeoJson.prototype.parse_gdwatq$ = function (geoJson, handler) {\n var geoObj = FluentObject_init(JsonSupport_getInstance().parseJson_61zpoe$(geoJson));\n var $receiver = new SimpleFeature$Consumer();\n handler($receiver);\n var geometryConsumer = $receiver;\n (new GeoJson$Parser()).parse_m8ausf$(geoObj, geometryConsumer);\n };\n GeoJson.prototype.parse_4mzk4t$ = function (geoJson, consumer) {\n var geoObj = FluentObject_init(JsonSupport_getInstance().parseJson_61zpoe$(geoJson));\n (new GeoJson$Parser()).parse_m8ausf$(geoObj, consumer);\n };\n function GeoJson$Parser() {\n }\n function GeoJson$Parser$parse$lambda(it) {\n return equals(it.getString_61zpoe$('type'), 'Feature');\n }\n function GeoJson$Parser$parse$lambda_0(it) {\n return it.getObject_61zpoe$('geometry');\n }\n GeoJson$Parser.prototype.parse_m8ausf$ = function (obj, handler) {\n var type = obj.getString_61zpoe$('type');\n switch (type) {\n case 'FeatureCollection':\n if (!obj.contains_61zpoe$('features')) {\n var message = \"GeoJson: Missing 'features' in 'FeatureCollection'\";\n throw IllegalArgumentException_init(message.toString());\n }\n var tmp$;\n tmp$ = map(filter(obj.getArray_61zpoe$('features').fluentObjectStream(), GeoJson$Parser$parse$lambda), GeoJson$Parser$parse$lambda_0).iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.parse_m8ausf$(element, handler);\n }\n\n break;\n case 'GeometryCollection':\n if (!obj.contains_61zpoe$('geometries')) {\n var message_0 = \"GeoJson: Missing 'geometries' in 'GeometryCollection'\";\n throw IllegalArgumentException_init(message_0.toString());\n }\n var tmp$_0;\n tmp$_0 = obj.getArray_61zpoe$('geometries').fluentObjectStream().iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n this.parse_m8ausf$(element_0, handler);\n }\n\n break;\n default:if (!obj.contains_61zpoe$('coordinates')) {\n var message_1 = \"GeoJson: Missing 'coordinates' in \" + type;\n throw IllegalArgumentException_init(message_1.toString());\n }\n var coordinates = obj.getArray_61zpoe$('coordinates');\n switch (type) {\n case 'Point':\n var $receiver = this.parsePoint_0(coordinates);\n getCallableRef('onPoint', function ($receiver, p1) {\n return $receiver.onPoint_adb7pk$(p1), Unit;\n }.bind(null, handler))($receiver);\n break;\n case 'LineString':\n var $receiver_0 = this.parseLineString_0(coordinates);\n getCallableRef('onLineString', function ($receiver, p1) {\n return $receiver.onLineString_1u6eph$(p1), Unit;\n }.bind(null, handler))($receiver_0);\n break;\n case 'Polygon':\n var $receiver_1 = this.parsePolygon_0(coordinates);\n getCallableRef('onPolygon', function ($receiver, p1) {\n return $receiver.onPolygon_z3kb82$(p1), Unit;\n }.bind(null, handler))($receiver_1);\n break;\n case 'MultiPoint':\n var $receiver_2 = this.parseMultiPoint_0(coordinates);\n getCallableRef('onMultiPoint', function ($receiver, p1) {\n return $receiver.onMultiPoint_oeq1z7$(p1), Unit;\n }.bind(null, handler))($receiver_2);\n break;\n case 'MultiLineString':\n var $receiver_3 = this.parseMultiLineString_0(coordinates);\n getCallableRef('onMultiLineString', function ($receiver, p1) {\n return $receiver.onMultiLineString_6n275e$(p1), Unit;\n }.bind(null, handler))($receiver_3);\n break;\n case 'MultiPolygon':\n var $receiver_4 = this.parseMultiPolygon_0(coordinates);\n getCallableRef('onMultiPolygon', function ($receiver, p1) {\n return $receiver.onMultiPolygon_a0zxnd$(p1), Unit;\n }.bind(null, handler))($receiver_4);\n break;\n default:throw IllegalStateException_init(('Not support GeoJson type: ' + type).toString());\n }\n\n break;\n }\n };\n GeoJson$Parser.prototype.parsePoint_0 = function (jsonPoint) {\n return explicitVec(jsonPoint.getDouble_za3lpa$(0), jsonPoint.getDouble_za3lpa$(1));\n };\n GeoJson$Parser.prototype.parseLineString_0 = function (jsonLineString) {\n return new LineString(this.mapArray_0(jsonLineString, getCallableRef('parsePoint', function ($receiver, p1) {\n return $receiver.parsePoint_0(p1);\n }.bind(null, this))));\n };\n GeoJson$Parser.prototype.parseRing_0 = function (jsonRing) {\n return new Ring(this.mapArray_0(jsonRing, getCallableRef('parsePoint', function ($receiver, p1) {\n return $receiver.parsePoint_0(p1);\n }.bind(null, this))));\n };\n GeoJson$Parser.prototype.parseMultiPoint_0 = function (jsonMultiPoint) {\n return new MultiPoint(this.mapArray_0(jsonMultiPoint, getCallableRef('parsePoint', function ($receiver, p1) {\n return $receiver.parsePoint_0(p1);\n }.bind(null, this))));\n };\n GeoJson$Parser.prototype.parsePolygon_0 = function (jsonPolygon) {\n return new Polygon(this.mapArray_0(jsonPolygon, getCallableRef('parseRing', function ($receiver, p1) {\n return $receiver.parseRing_0(p1);\n }.bind(null, this))));\n };\n GeoJson$Parser.prototype.parseMultiLineString_0 = function (jsonLineStrings) {\n return new MultiLineString(this.mapArray_0(jsonLineStrings, getCallableRef('parseLineString', function ($receiver, p1) {\n return $receiver.parseLineString_0(p1);\n }.bind(null, this))));\n };\n GeoJson$Parser.prototype.parseMultiPolygon_0 = function (jsonMultiPolygon) {\n return new MultiPolygon(this.mapArray_0(jsonMultiPolygon, getCallableRef('parsePolygon', function ($receiver, p1) {\n return $receiver.parsePolygon_0(p1);\n }.bind(null, this))));\n };\n function GeoJson$Parser$mapArray$lambda(closure$f) {\n return function (it) {\n var tmp$;\n return closure$f(FluentArray_init_0(Kotlin.isType(tmp$ = it, List) ? tmp$ : throwCCE()));\n };\n }\n GeoJson$Parser.prototype.mapArray_0 = function ($receiver, f) {\n return toList_1(map($receiver.stream(), GeoJson$Parser$mapArray$lambda(f)));\n };\n GeoJson$Parser.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Parser',\n interfaces: []\n };\n GeoJson.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GeoJson',\n interfaces: []\n };\n var GeoJson_instance = null;\n function GeoJson_getInstance() {\n if (GeoJson_instance === null) {\n new GeoJson();\n }return GeoJson_instance;\n }\n function GeoRectangle(startLongitude, minLatitude, endLongitude, maxLatitude) {\n this.myLongitudeSegment_0 = null;\n this.myLatitudeRange_0 = null;\n if (!(minLatitude <= maxLatitude)) {\n var message = 'Invalid latitude range: [' + minLatitude + '..' + maxLatitude + ']';\n throw IllegalArgumentException_init(message.toString());\n }this.myLongitudeSegment_0 = new LongitudeSegment(startLongitude, endLongitude);\n this.myLatitudeRange_0 = new ClosedRange(minLatitude, maxLatitude);\n }\n Object.defineProperty(GeoRectangle.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myLongitudeSegment_0.isEmpty && this.latitudeRangeIsEmpty_0(this.myLatitudeRange_0);\n }\n });\n GeoRectangle.prototype.latitudeRangeIsEmpty_0 = function (range) {\n return range.upperEnd === range.lowerEnd;\n };\n GeoRectangle.prototype.startLongitude = function () {\n return this.myLongitudeSegment_0.start();\n };\n GeoRectangle.prototype.endLongitude = function () {\n return this.myLongitudeSegment_0.end();\n };\n GeoRectangle.prototype.minLatitude = function () {\n return this.myLatitudeRange_0.lowerEnd;\n };\n GeoRectangle.prototype.maxLatitude = function () {\n return this.myLatitudeRange_0.upperEnd;\n };\n GeoRectangle.prototype.encloses_emtjl$ = function (rect) {\n return this.myLongitudeSegment_0.encloses_moa7dh$(rect.myLongitudeSegment_0) && this.myLatitudeRange_0.encloses_d226ot$(rect.myLatitudeRange_0);\n };\n GeoRectangle.prototype.splitByAntiMeridian = function () {\n var tmp$;\n var rects = ArrayList_init();\n var longitudeRanges = this.myLongitudeSegment_0.splitByAntiMeridian();\n tmp$ = longitudeRanges.iterator();\n while (tmp$.hasNext()) {\n var longitudeRange = tmp$.next();\n rects.add_11rb$(newSpanRectangle(new Vec(longitudeRange.lowerEnd, this.myLatitudeRange_0.lowerEnd), new Vec(longitudeRange.upperEnd, this.myLatitudeRange_0.upperEnd)));\n }\n return rects;\n };\n GeoRectangle.prototype.equals = function (other) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n var that = (tmp$_0 = other) == null || Kotlin.isType(tmp$_0, GeoRectangle) ? tmp$_0 : throwCCE();\n return ((tmp$_1 = this.myLongitudeSegment_0) != null ? tmp$_1.equals(ensureNotNull(that).myLongitudeSegment_0) : null) && ((tmp$_2 = this.myLatitudeRange_0) != null ? tmp$_2.equals(that.myLatitudeRange_0) : null);\n };\n GeoRectangle.prototype.hashCode = function () {\n return hashCode(listOf([this.myLongitudeSegment_0, this.myLatitudeRange_0]));\n };\n GeoRectangle.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeoRectangle',\n interfaces: []\n };\n function LonLat() {\n }\n LonLat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LonLat',\n interfaces: []\n };\n var EARTH_RECT;\n function limitLon(lon) {\n var tmp$ = MIN_LONGITUDE;\n var b = MAX_LONGITUDE;\n var b_0 = JsMath.min(lon, b);\n return JsMath.max(tmp$, b_0);\n }\n function limitLat(lat) {\n var tmp$ = MIN_LATITUDE;\n var b = MAX_LATITUDE;\n var b_0 = JsMath.min(lat, b);\n return JsMath.max(tmp$, b_0);\n }\n function normalizeLon(lon) {\n var result = lon - numberToInt(lon / FULL_LONGITUDE) * FULL_LONGITUDE;\n if (result > MAX_LONGITUDE) {\n result -= FULL_LONGITUDE;\n }if (result < -MAX_LONGITUDE) {\n result += FULL_LONGITUDE;\n }return result;\n }\n var BBOX_CALCULATOR;\n function convertToGeoRectangle(rect) {\n var left;\n var right;\n if (get_width(rect) < get_width(EARTH_RECT)) {\n left = normalizeLon(get_left(rect));\n right = normalizeLon(get_right(rect));\n } else {\n left = get_left(EARTH_RECT);\n right = get_right(EARTH_RECT);\n }\n return new GeoRectangle(left, limitLat(get_top(rect)), right, limitLat(get_bottom(rect)));\n }\n function calculateQuadKeys(rect, zoom) {\n var flippedRect = Rect_init(get_left(rect), -get_bottom(rect), get_width(rect), get_height(rect));\n return calculateQuadKeys_0(EARTH_RECT, flippedRect, zoom, getCallableRef('QuadKey', function (p1) {\n return new QuadKey(p1);\n }));\n }\n function LongitudeSegment(start, end) {\n LongitudeSegment$Companion_getInstance();\n this.myStart_0 = limitLon(start);\n this.myEnd_0 = limitLon(end);\n }\n Object.defineProperty(LongitudeSegment.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myEnd_0 === this.myStart_0;\n }\n });\n LongitudeSegment.prototype.start = function () {\n return this.myStart_0;\n };\n LongitudeSegment.prototype.end = function () {\n return this.myEnd_0;\n };\n LongitudeSegment.prototype.length = function () {\n return this.myEnd_0 - this.myStart_0 + (this.myEnd_0 < this.myStart_0 ? FULL_LONGITUDE : 0.0);\n };\n LongitudeSegment.prototype.encloses_moa7dh$ = function (longitudeSegment) {\n var tmp$;\n var externalRanges = this.splitByAntiMeridian();\n var internalRanges = longitudeSegment.splitByAntiMeridian();\n tmp$ = internalRanges.iterator();\n while (tmp$.hasNext()) {\n var internalRange = tmp$.next();\n if (!LongitudeSegment$Companion_getInstance().disjointRangesEncloseRange_0(externalRanges, internalRange)) {\n return false;\n }}\n return true;\n };\n LongitudeSegment.prototype.invert = function () {\n return new LongitudeSegment(this.myEnd_0, this.myStart_0);\n };\n LongitudeSegment.prototype.splitByAntiMeridian = function () {\n return LongitudeSegment$Companion_getInstance().splitSegment_6y0v78$(this.myStart_0, this.myEnd_0, MIN_LONGITUDE, MAX_LONGITUDE);\n };\n LongitudeSegment.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n var that = Kotlin.isType(tmp$_0 = other, LongitudeSegment) ? tmp$_0 : throwCCE();\n return equals(that.myStart_0, this.myStart_0) && equals(that.myEnd_0, this.myEnd_0);\n };\n LongitudeSegment.prototype.hashCode = function () {\n return hashCode(listOf([this.myStart_0, this.myEnd_0]));\n };\n function LongitudeSegment$Companion() {\n LongitudeSegment$Companion_instance = this;\n }\n LongitudeSegment$Companion.prototype.splitSegment_6y0v78$ = function (start, end, min, max) {\n var tmp$;\n if (start <= end) {\n tmp$ = listOf_0(new ClosedRange(start, end));\n } else {\n tmp$ = listOf([new ClosedRange(start, max), new ClosedRange(min, end)]);\n }\n return tmp$;\n };\n LongitudeSegment$Companion.prototype.disjointRangesEncloseRange_0 = function (ranges, internalRange) {\n var tmp$;\n tmp$ = ranges.iterator();\n while (tmp$.hasNext()) {\n var range = tmp$.next();\n if (range.encloses_d226ot$(internalRange)) {\n return true;\n }}\n return false;\n };\n LongitudeSegment$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LongitudeSegment$Companion_instance = null;\n function LongitudeSegment$Companion_getInstance() {\n if (LongitudeSegment$Companion_instance === null) {\n new LongitudeSegment$Companion();\n }return LongitudeSegment$Companion_instance;\n }\n LongitudeSegment.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LongitudeSegment',\n interfaces: []\n };\n function MercatorUtils() {\n MercatorUtils_instance = this;\n this.MAX_LONGITUDE_0 = 180.0;\n this.MAX_LATITUDE_0 = 85.0511287798;\n this.VALID_LONGITUDE_RANGE = new ClosedRange(-this.MAX_LONGITUDE_0, this.MAX_LONGITUDE_0);\n this.VALID_LATITUDE_RANGE = new ClosedRange(-this.MAX_LATITUDE_0, this.MAX_LATITUDE_0);\n }\n MercatorUtils.prototype.getMercatorX_14dthe$ = function (lon) {\n return toRadians(lon) * EARTH_RADIUS;\n };\n MercatorUtils.prototype.getMercatorY_14dthe$ = function (lat) {\n var lat_0 = this.normalizeLat_0(lat);\n var x = math.PI / 4 + toRadians(lat_0) / 2;\n var x_0 = JsMath.tan(x);\n return JsMath.log(x_0) * EARTH_RADIUS;\n };\n MercatorUtils.prototype.getLongitude_14dthe$ = function (x) {\n return toDegrees(x / EARTH_RADIUS);\n };\n MercatorUtils.prototype.getLatitude_14dthe$ = function (y) {\n var x = y / EARTH_RADIUS;\n var x_0 = JsMath.exp(x);\n return this.normalizeLat_0(toDegrees((JsMath.atan(x_0) - math.PI / 4) * 2));\n };\n MercatorUtils.prototype.checkLon_14dthe$ = function (lon) {\n return this.VALID_LONGITUDE_RANGE.contains_mef7kx$(lon);\n };\n MercatorUtils.prototype.checkLat_14dthe$ = function (lat) {\n return this.VALID_LATITUDE_RANGE.contains_mef7kx$(lat);\n };\n MercatorUtils.prototype.normalizeLat_0 = function (lat) {\n var tmp$ = -this.MAX_LATITUDE_0;\n var b = this.MAX_LATITUDE_0;\n var b_0 = JsMath.min(lat, b);\n return JsMath.max(tmp$, b_0);\n };\n MercatorUtils.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'MercatorUtils',\n interfaces: []\n };\n var MercatorUtils_instance = null;\n function MercatorUtils_getInstance() {\n if (MercatorUtils_instance === null) {\n new MercatorUtils();\n }return MercatorUtils_instance;\n }\n function QuadKey(key) {\n this.key = key;\n this.length = this.key.length;\n }\n QuadKey.prototype.plus_vnxxg4$ = function (other) {\n return new QuadKey(this.key + other.key);\n };\n QuadKey.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'QuadKey',\n interfaces: []\n };\n QuadKey.prototype.component1 = function () {\n return this.key;\n };\n QuadKey.prototype.copy_61zpoe$ = function (key) {\n return new QuadKey(key === void 0 ? this.key : key);\n };\n QuadKey.prototype.toString = function () {\n return 'QuadKey(key=' + Kotlin.toString(this.key) + ')';\n };\n QuadKey.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.key) | 0;\n return result;\n };\n QuadKey.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && Kotlin.equals(this.key, other.key))));\n };\n function computeRect$lambda(closure$flippedY) {\n return function (it) {\n return closure$flippedY;\n };\n }\n function computeRect($receiver) {\n var origin = computeOrigin($receiver, EARTH_RECT);\n var dimension = div_0(EARTH_RECT.dimension, calulateQuadsCount($receiver.length));\n var flippedY = minus_0(get_scalarBottom(EARTH_RECT), minus_0(plus_5(get_scalarY(origin), get_scalarY(dimension)), get_scalarTop(EARTH_RECT)));\n return new Rect(transform(origin, void 0, computeRect$lambda(flippedY)), dimension);\n }\n function computeRect_0($receiver, rect) {\n return projectRect($receiver, rect);\n }\n function projectRect($receiver, rect) {\n var origin = projectOrigin($receiver, rect);\n var dimension = div_0(rect.dimension, calulateQuadsCount($receiver.length));\n return new Rect(origin, dimension);\n }\n function zoom($receiver) {\n return $receiver.length;\n }\n function computeOrigin($receiver, mapRect) {\n return projectOrigin($receiver, mapRect);\n }\n function projectOrigin($receiver, mapRect) {\n var tmp$;\n var left = get_scalarLeft(mapRect);\n var top = get_scalarTop(mapRect);\n var width = get_scalarWidth(mapRect);\n var height = get_scalarHeight(mapRect);\n tmp$ = iterator($receiver.key);\n while (tmp$.hasNext()) {\n var quadrant = unboxChar(tmp$.next());\n width = div_2(width, 2.0);\n height = div_2(height, 2.0);\n if (quadrant === 49 || quadrant === 51) {\n left = plus_5(left, width);\n }if (quadrant === 50 || quadrant === 51) {\n top = plus_5(top, height);\n }}\n return newVec(left, top);\n }\n function calulateQuadsCount(zoom) {\n return numberToInt(ipow(2, zoom));\n }\n function calculateQuadKeys$calcQuadNum(value, range, tileCount) {\n var position = (value - range.lowerEnd) / (range.upperEnd - range.lowerEnd);\n var a = position * tileCount;\n var b = tileCount - 1 | 0;\n var b_0 = JsMath.min(a, b);\n return numberToInt(JsMath.max(0.0, b_0));\n }\n function calculateQuadKeys_0(mapRect, viewRect, zoom, quadKeyFactory) {\n var quadKeys = HashSet_init_0();\n var tileCount = calulateQuadsCount(zoom);\n var calcQuadNum = calculateQuadKeys$calcQuadNum;\n var xmin = calcQuadNum(get_left(viewRect), xRange(mapRect), tileCount);\n var xmax = calcQuadNum(get_right(viewRect), xRange(mapRect), tileCount);\n var ymin = calcQuadNum(get_top(viewRect), yRange(mapRect), tileCount);\n var ymax = calcQuadNum(get_bottom(viewRect), yRange(mapRect), tileCount);\n for (var x = xmin; x <= xmax; x++) {\n for (var y = ymin; y <= ymax; y++) {\n var $receiver = quadKeyFactory(xyToKey(x, y, zoom));\n getCallableRef('add', function ($receiver, p1) {\n return $receiver.add_11rb$(p1);\n }.bind(null, quadKeys))($receiver);\n }\n }\n return quadKeys;\n }\n function xyToKey(x, y, zoom) {\n var key = '';\n for (var i = zoom; i >= 1; i--) {\n var digit = 48;\n var mask = 1 << i - 1;\n if ((x & mask) !== 0) {\n digit = Kotlin.charInc(digit);\n }if ((y & mask) !== 0) {\n digit = toChar(digit + 2);\n }key += String.fromCharCode(digit);\n }\n return key;\n }\n function SimpleFeature() {\n SimpleFeature_instance = this;\n }\n function SimpleFeature$GeometryConsumer() {\n }\n SimpleFeature$GeometryConsumer.prototype.onPoint_adb7pk$ = function (point) {\n throw IllegalStateException_init(\"Point isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.prototype.onLineString_1u6eph$ = function (lineString) {\n throw IllegalStateException_init(\"LineString isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.prototype.onPolygon_z3kb82$ = function (polygon) {\n throw IllegalStateException_init(\"Polygon isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.prototype.onMultiPoint_oeq1z7$ = function (multiPoint) {\n throw IllegalStateException_init(\"MultiPoint isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.prototype.onMultiLineString_6n275e$ = function (multiLineString) {\n throw IllegalStateException_init(\"MultiLineString isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.prototype.onMultiPolygon_a0zxnd$ = function (multipolygon) {\n throw IllegalStateException_init(\"MultiPolygon isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GeometryConsumer',\n interfaces: []\n };\n function SimpleFeature$Consumer(onPoint, onLineString, onPolygon, onMultiPoint, onMultiLineString, onMultiPolygon) {\n if (onPoint === void 0)\n onPoint = SimpleFeature$SimpleFeature$Consumer_init$lambda;\n if (onLineString === void 0)\n onLineString = SimpleFeature$SimpleFeature$Consumer_init$lambda_0;\n if (onPolygon === void 0)\n onPolygon = SimpleFeature$SimpleFeature$Consumer_init$lambda_1;\n if (onMultiPoint === void 0)\n onMultiPoint = SimpleFeature$SimpleFeature$Consumer_init$lambda_2;\n if (onMultiLineString === void 0)\n onMultiLineString = SimpleFeature$SimpleFeature$Consumer_init$lambda_3;\n if (onMultiPolygon === void 0)\n onMultiPolygon = SimpleFeature$SimpleFeature$Consumer_init$lambda_4;\n this.onPoint = onPoint;\n this.onLineString = onLineString;\n this.onPolygon = onPolygon;\n this.onMultiPoint = onMultiPoint;\n this.onMultiLineString = onMultiLineString;\n this.onMultiPolygon = onMultiPolygon;\n }\n SimpleFeature$Consumer.prototype.onPoint_adb7pk$ = function (point) {\n this.onPoint(point);\n };\n SimpleFeature$Consumer.prototype.onLineString_1u6eph$ = function (lineString) {\n this.onLineString(lineString);\n };\n SimpleFeature$Consumer.prototype.onPolygon_z3kb82$ = function (polygon) {\n this.onPolygon(polygon);\n };\n SimpleFeature$Consumer.prototype.onMultiPoint_oeq1z7$ = function (multiPoint) {\n this.onMultiPoint(multiPoint);\n };\n SimpleFeature$Consumer.prototype.onMultiLineString_6n275e$ = function (multiLineString) {\n this.onMultiLineString(multiLineString);\n };\n SimpleFeature$Consumer.prototype.onMultiPolygon_a0zxnd$ = function (multipolygon) {\n this.onMultiPolygon(multipolygon);\n };\n function SimpleFeature$SimpleFeature$Consumer_init$lambda(it) {\n throw IllegalStateException_init(\"Point isn't supported\".toString());\n }\n function SimpleFeature$SimpleFeature$Consumer_init$lambda_0(it) {\n throw IllegalStateException_init(\"LineString isn't supported\".toString());\n }\n function SimpleFeature$SimpleFeature$Consumer_init$lambda_1(it) {\n throw IllegalStateException_init(\"Polygon isn't supported\".toString());\n }\n function SimpleFeature$SimpleFeature$Consumer_init$lambda_2(it) {\n throw IllegalStateException_init(\"MultiPoint isn't supported\".toString());\n }\n function SimpleFeature$SimpleFeature$Consumer_init$lambda_3(it) {\n throw IllegalStateException_init(\"MultiLineString isn't supported\".toString());\n }\n function SimpleFeature$SimpleFeature$Consumer_init$lambda_4(it) {\n throw IllegalStateException_init(\"MultiPolygon isn't supported\".toString());\n }\n SimpleFeature$Consumer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Consumer',\n interfaces: [SimpleFeature$GeometryConsumer]\n };\n function SimpleFeature$GeometryType(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function SimpleFeature$GeometryType_initFields() {\n SimpleFeature$GeometryType_initFields = function () {\n };\n SimpleFeature$GeometryType$POINT_instance = new SimpleFeature$GeometryType('POINT', 0);\n SimpleFeature$GeometryType$LINE_STRING_instance = new SimpleFeature$GeometryType('LINE_STRING', 1);\n SimpleFeature$GeometryType$POLYGON_instance = new SimpleFeature$GeometryType('POLYGON', 2);\n SimpleFeature$GeometryType$MULTI_POINT_instance = new SimpleFeature$GeometryType('MULTI_POINT', 3);\n SimpleFeature$GeometryType$MULTI_LINE_STRING_instance = new SimpleFeature$GeometryType('MULTI_LINE_STRING', 4);\n SimpleFeature$GeometryType$MULTI_POLYGON_instance = new SimpleFeature$GeometryType('MULTI_POLYGON', 5);\n SimpleFeature$GeometryType$GEOMETRY_COLLECTION_instance = new SimpleFeature$GeometryType('GEOMETRY_COLLECTION', 6);\n }\n var SimpleFeature$GeometryType$POINT_instance;\n function SimpleFeature$GeometryType$POINT_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$POINT_instance;\n }\n var SimpleFeature$GeometryType$LINE_STRING_instance;\n function SimpleFeature$GeometryType$LINE_STRING_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$LINE_STRING_instance;\n }\n var SimpleFeature$GeometryType$POLYGON_instance;\n function SimpleFeature$GeometryType$POLYGON_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$POLYGON_instance;\n }\n var SimpleFeature$GeometryType$MULTI_POINT_instance;\n function SimpleFeature$GeometryType$MULTI_POINT_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$MULTI_POINT_instance;\n }\n var SimpleFeature$GeometryType$MULTI_LINE_STRING_instance;\n function SimpleFeature$GeometryType$MULTI_LINE_STRING_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$MULTI_LINE_STRING_instance;\n }\n var SimpleFeature$GeometryType$MULTI_POLYGON_instance;\n function SimpleFeature$GeometryType$MULTI_POLYGON_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$MULTI_POLYGON_instance;\n }\n var SimpleFeature$GeometryType$GEOMETRY_COLLECTION_instance;\n function SimpleFeature$GeometryType$GEOMETRY_COLLECTION_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$GEOMETRY_COLLECTION_instance;\n }\n SimpleFeature$GeometryType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeometryType',\n interfaces: [Enum]\n };\n function SimpleFeature$GeometryType$values() {\n return [SimpleFeature$GeometryType$POINT_getInstance(), SimpleFeature$GeometryType$LINE_STRING_getInstance(), SimpleFeature$GeometryType$POLYGON_getInstance(), SimpleFeature$GeometryType$MULTI_POINT_getInstance(), SimpleFeature$GeometryType$MULTI_LINE_STRING_getInstance(), SimpleFeature$GeometryType$MULTI_POLYGON_getInstance(), SimpleFeature$GeometryType$GEOMETRY_COLLECTION_getInstance()];\n }\n SimpleFeature$GeometryType.values = SimpleFeature$GeometryType$values;\n function SimpleFeature$GeometryType$valueOf(name) {\n switch (name) {\n case 'POINT':\n return SimpleFeature$GeometryType$POINT_getInstance();\n case 'LINE_STRING':\n return SimpleFeature$GeometryType$LINE_STRING_getInstance();\n case 'POLYGON':\n return SimpleFeature$GeometryType$POLYGON_getInstance();\n case 'MULTI_POINT':\n return SimpleFeature$GeometryType$MULTI_POINT_getInstance();\n case 'MULTI_LINE_STRING':\n return SimpleFeature$GeometryType$MULTI_LINE_STRING_getInstance();\n case 'MULTI_POLYGON':\n return SimpleFeature$GeometryType$MULTI_POLYGON_getInstance();\n case 'GEOMETRY_COLLECTION':\n return SimpleFeature$GeometryType$GEOMETRY_COLLECTION_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.spatial.SimpleFeature.GeometryType.' + name);\n }\n }\n SimpleFeature$GeometryType.valueOf_61zpoe$ = SimpleFeature$GeometryType$valueOf;\n SimpleFeature.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'SimpleFeature',\n interfaces: []\n };\n var SimpleFeature_instance = null;\n function SimpleFeature_getInstance() {\n if (SimpleFeature_instance === null) {\n new SimpleFeature();\n }return SimpleFeature_instance;\n }\n function StringFormat(pattern, formatType) {\n StringFormat$Companion_getInstance();\n this.pattern_0 = pattern;\n this.formatType = formatType;\n this.myNumberFormatters_0 = null;\n var tmp$;\n var initNumberFormat = StringFormat_init$initNumberFormat;\n switch (this.formatType.name) {\n case 'NUMBER_FORMAT':\n tmp$ = listOf_0(initNumberFormat(this.pattern_0));\n break;\n case 'STRING_FORMAT':\n tmp$ = toList_1(map(map(StringFormat$Companion_getInstance().BRACES_REGEX_0.findAll_905azu$(this.pattern_0), StringFormat_init$lambda), StringFormat_init$lambda_0(initNumberFormat)));\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n this.myNumberFormatters_0 = tmp$;\n this.argsNumber = this.myNumberFormatters_0.size;\n }\n function StringFormat$FormatType(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function StringFormat$FormatType_initFields() {\n StringFormat$FormatType_initFields = function () {\n };\n StringFormat$FormatType$NUMBER_FORMAT_instance = new StringFormat$FormatType('NUMBER_FORMAT', 0);\n StringFormat$FormatType$STRING_FORMAT_instance = new StringFormat$FormatType('STRING_FORMAT', 1);\n }\n var StringFormat$FormatType$NUMBER_FORMAT_instance;\n function StringFormat$FormatType$NUMBER_FORMAT_getInstance() {\n StringFormat$FormatType_initFields();\n return StringFormat$FormatType$NUMBER_FORMAT_instance;\n }\n var StringFormat$FormatType$STRING_FORMAT_instance;\n function StringFormat$FormatType$STRING_FORMAT_getInstance() {\n StringFormat$FormatType_initFields();\n return StringFormat$FormatType$STRING_FORMAT_instance;\n }\n StringFormat$FormatType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FormatType',\n interfaces: [Enum]\n };\n function StringFormat$FormatType$values() {\n return [StringFormat$FormatType$NUMBER_FORMAT_getInstance(), StringFormat$FormatType$STRING_FORMAT_getInstance()];\n }\n StringFormat$FormatType.values = StringFormat$FormatType$values;\n function StringFormat$FormatType$valueOf(name) {\n switch (name) {\n case 'NUMBER_FORMAT':\n return StringFormat$FormatType$NUMBER_FORMAT_getInstance();\n case 'STRING_FORMAT':\n return StringFormat$FormatType$STRING_FORMAT_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.stringFormat.StringFormat.FormatType.' + name);\n }\n }\n StringFormat$FormatType.valueOf_61zpoe$ = StringFormat$FormatType$valueOf;\n StringFormat.prototype.format_za3rmp$ = function (value) {\n return this.format_pqjuzw$(listOf_0(value));\n };\n StringFormat.prototype.format_pqjuzw$ = function (values) {\n var tmp$;\n if (this.argsNumber !== values.size) {\n throw IllegalStateException_init((\"Can't format values \" + values + ' with pattern ' + '\"' + this.pattern_0 + '\"' + '). Wrong number of arguments: expected ' + this.argsNumber + ' instead of ' + values.size).toString());\n }loop_label: switch (this.formatType.name) {\n case 'NUMBER_FORMAT':\n if (!(this.myNumberFormatters_0.size === 1)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }\n tmp$ = this.formatValue_0(single(values), single(this.myNumberFormatters_0));\n break loop_label;\n case 'STRING_FORMAT':\n var index = {v: 0};\n var $this = StringFormat$Companion_getInstance().BRACES_REGEX_0;\n var input = this.pattern_0;\n var replace_20wsma$result;\n replace_20wsma$break: do {\n var match = $this.find_905azu$(input);\n if (match == null) {\n replace_20wsma$result = input.toString();\n break replace_20wsma$break;\n }var lastStart = 0;\n var length = input.length;\n var sb = StringBuilder_init_0(length);\n do {\n var foundMatch = ensureNotNull(match);\n sb.append_ezbsdh$(input, lastStart, foundMatch.range.start);\n var tmp$_0 = sb.append_gw00v9$;\n var tmp$_1;\n var originalValue = values.get_za3lpa$(index.v);\n var formatter = this.myNumberFormatters_0.get_za3lpa$((tmp$_1 = index.v, index.v = tmp$_1 + 1 | 0, tmp$_1));\n tmp$_0.call(sb, this.formatValue_0(originalValue, formatter));\n lastStart = foundMatch.range.endInclusive + 1 | 0;\n match = foundMatch.next();\n }\n while (lastStart < length && match != null);\n if (lastStart < length) {\n sb.append_ezbsdh$(input, lastStart, length);\n }replace_20wsma$result = sb.toString();\n }\n while (false);\n tmp$ = replace(replace(replace_20wsma$result, '{{', '{'), '}}', '}');\n break loop_label;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break loop_label;\n }\n return tmp$;\n };\n StringFormat.prototype.formatValue_0 = function (value, numberFormatter) {\n var tmp$, tmp$_0, tmp$_1;\n if (numberFormatter == null)\n tmp$_1 = value.toString();\n else if (Kotlin.isNumber(value))\n tmp$_1 = numberFormatter.apply_3p81yu$(value);\n else if (typeof value === 'string') {\n tmp$_1 = (tmp$_0 = (tmp$ = toDoubleOrNull(value)) != null ? getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_3p81yu$(p1);\n }.bind(null, numberFormatter))(tmp$) : null) != null ? tmp$_0 : value;\n } else {\n throw IllegalStateException_init(('Failed to format value with type ' + toString(Kotlin.getKClassFromExpression(value).simpleName) + '. Supported types are Number and String.').toString());\n }\n return tmp$_1;\n };\n function StringFormat$Companion() {\n StringFormat$Companion_instance = this;\n this.BRACES_REGEX_0 = Regex_init('(?![^{]|\\\\{\\\\{)(\\\\{([^{}]*)\\\\})(?=[^}]|\\\\}\\\\}|$)');\n this.TEXT_IN_BRACES = 2;\n }\n StringFormat$Companion.prototype.valueInLinePattern = function () {\n return '{}';\n };\n StringFormat$Companion.prototype.forOneArg_86f9bg$ = function (pattern, type, formatFor) {\n if (type === void 0)\n type = null;\n if (formatFor === void 0)\n formatFor = null;\n return this.create_w8bwfu$(pattern, type, formatFor, 1);\n };\n StringFormat$Companion.prototype.forNArgs_8vq31k$ = function (pattern, type, argCount, formatFor) {\n if (type === void 0)\n type = null;\n if (formatFor === void 0)\n formatFor = null;\n return this.create_w8bwfu$(pattern, type, formatFor, argCount);\n };\n StringFormat$Companion.prototype.create_w8bwfu$ = function (pattern, type, formatFor, expectedArgs) {\n if (type === void 0)\n type = null;\n if (formatFor === void 0)\n formatFor = null;\n if (expectedArgs === void 0)\n expectedArgs = -1;\n var tmp$;\n if (type != null)\n tmp$ = type;\n else if (NumberFormat$Companion_getInstance().isValidPattern_61zpoe$(pattern))\n tmp$ = StringFormat$FormatType$NUMBER_FORMAT_getInstance();\n else\n tmp$ = StringFormat$FormatType$STRING_FORMAT_getInstance();\n var formatType = tmp$;\n var $receiver = new StringFormat(pattern, formatType);\n if (expectedArgs > 0) {\n if (!($receiver.argsNumber === expectedArgs)) {\n var tmp$_0;\n var formatFor_0 = (tmp$_0 = formatFor != null ? 'to format ' + \"'\" + toString(formatFor) + \"'\" : null) != null ? tmp$_0 : '';\n var message = 'Wrong number of arguments in pattern ' + \"'\" + pattern + \"'\" + ' ' + formatFor_0 + '. ' + ('Expected ' + expectedArgs + ' ' + (expectedArgs > 1 ? 'arguments' : 'argument') + ' ') + ('instead of ' + $receiver.argsNumber);\n throw IllegalArgumentException_init(message.toString());\n }}return $receiver;\n };\n StringFormat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var StringFormat$Companion_instance = null;\n function StringFormat$Companion_getInstance() {\n if (StringFormat$Companion_instance === null) {\n new StringFormat$Companion();\n }return StringFormat$Companion_instance;\n }\n function StringFormat_init$initNumberFormat(pattern) {\n try {\n return NumberFormat_init(pattern);\n } catch (e) {\n if (Kotlin.isType(e, Exception)) {\n throw IllegalStateException_init(('Wrong number pattern: ' + pattern).toString());\n } else\n throw e;\n }\n }\n function StringFormat_init$lambda(it) {\n return it.groupValues.get_za3lpa$(2);\n }\n function StringFormat_init$lambda_0(closure$initNumberFormat) {\n return function (format) {\n if (format.length > 0) {\n return closure$initNumberFormat(format);\n } else {\n return null;\n }\n };\n }\n StringFormat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StringFormat',\n interfaces: []\n };\n function AbstractGeometryList(myGeometry) {\n AbstractList.call(this);\n this.myGeometry_8dt6c9$_0 = myGeometry;\n }\n AbstractGeometryList.prototype.get_za3lpa$ = function (index) {\n return this.myGeometry_8dt6c9$_0.get_za3lpa$(index);\n };\n Object.defineProperty(AbstractGeometryList.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.myGeometry_8dt6c9$_0.size;\n }\n });\n AbstractGeometryList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractGeometryList',\n interfaces: [AbstractList]\n };\n function isClockwise_0(ring) {\n return isClockwise(ring, getPropertyCallableRef('x', 1, function ($receiver) {\n return $receiver.x;\n }), getPropertyCallableRef('y', 1, function ($receiver) {\n return $receiver.y;\n }));\n }\n function createMultiPolygon(points) {\n var tmp$;\n if (points.isEmpty()) {\n return new MultiPolygon(emptyList());\n }var polygons = ArrayList_init();\n var rings = ArrayList_init();\n tmp$ = splitRings(points).iterator();\n while (tmp$.hasNext()) {\n var ring = tmp$.next();\n if (!rings.isEmpty() && isClockwise_0(ring)) {\n polygons.add_11rb$(new Polygon(rings));\n rings = ArrayList_init();\n }rings.add_11rb$(new Ring(ring));\n }\n if (!rings.isEmpty()) {\n polygons.add_11rb$(new Polygon(rings));\n }return new MultiPolygon(polygons);\n }\n function boundingBox$lambda(minX, minY, maxX, maxY) {\n return newSpanRectangle(new Vec(minX, minY), new Vec(maxX, maxY));\n }\n function boundingBox($receiver) {\n return DoubleRectangles_getInstance().calculateBoundingBox_h5l7ap$($receiver, getPropertyCallableRef('x', 1, function ($receiver) {\n return $receiver.x;\n }), getPropertyCallableRef('y', 1, function ($receiver) {\n return $receiver.y;\n }), boundingBox$lambda);\n }\n function Generic() {\n }\n Generic.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Generic',\n interfaces: []\n };\n function reinterpret($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, Vec) ? tmp$ : throwCCE();\n }\n function reinterpret_0($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, MultiPoint) ? tmp$ : throwCCE();\n }\n function reinterpret_1($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, LineString) ? tmp$ : throwCCE();\n }\n function reinterpret_2($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, MultiLineString) ? tmp$ : throwCCE();\n }\n function reinterpret_3($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, Polygon) ? tmp$ : throwCCE();\n }\n function reinterpret_4($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, MultiPolygon) ? tmp$ : throwCCE();\n }\n function get_bottom($receiver) {\n return $receiver.origin.y + $receiver.dimension.y;\n }\n function get_right($receiver) {\n return $receiver.origin.x + $receiver.dimension.x;\n }\n function get_height($receiver) {\n return $receiver.dimension.y;\n }\n function get_width($receiver) {\n return $receiver.dimension.x;\n }\n function get_top($receiver) {\n return $receiver.origin.y;\n }\n function get_left($receiver) {\n return $receiver.origin.x;\n }\n function get_scalarBottom($receiver) {\n return new Scalar(get_bottom($receiver));\n }\n function get_scalarRight($receiver) {\n return new Scalar(get_right($receiver));\n }\n function get_scalarHeight($receiver) {\n return new Scalar(get_height($receiver));\n }\n function get_scalarWidth($receiver) {\n return new Scalar(get_width($receiver));\n }\n function get_scalarTop($receiver) {\n return new Scalar(get_top($receiver));\n }\n function get_scalarLeft($receiver) {\n return new Scalar(get_left($receiver));\n }\n function get_center($receiver) {\n return plus_4(div_0($receiver.dimension, 2.0), $receiver.origin);\n }\n function get_scalarX($receiver) {\n return new Scalar($receiver.x);\n }\n function get_scalarY($receiver) {\n return new Scalar($receiver.y);\n }\n function plus_4($receiver, other) {\n return new Vec($receiver.x + other.x, $receiver.y + other.y);\n }\n function minus($receiver, other) {\n return new Vec($receiver.x - other.x, $receiver.y - other.y);\n }\n function times($receiver, other) {\n return new Vec($receiver.x * other.x, $receiver.y * other.y);\n }\n function div($receiver, other) {\n return new Vec($receiver.x / other.x, $receiver.y / other.y);\n }\n function times_0($receiver, scale) {\n return new Vec($receiver.x * scale, $receiver.y * scale);\n }\n function div_0($receiver, scale) {\n return new Vec($receiver.x / scale, $receiver.y / scale);\n }\n function unaryMinus($receiver) {\n return new Vec(-$receiver.x, -$receiver.y);\n }\n function transform$lambda(it) {\n return it;\n }\n function transform$lambda_0(it) {\n return it;\n }\n function transform($receiver, newX, newY) {\n if (newX === void 0)\n newX = transform$lambda;\n if (newY === void 0)\n newY = transform$lambda_0;\n return new Vec(newX(get_scalarX($receiver)).value, newY(get_scalarY($receiver)).value);\n }\n function plus_5($receiver, other) {\n return new Scalar($receiver.value + other.value);\n }\n function minus_0($receiver, other) {\n return new Scalar($receiver.value - other.value);\n }\n function times_1($receiver, other) {\n return new Scalar($receiver.value * other.value);\n }\n function div_1($receiver, other) {\n return new Scalar($receiver.value / other.value);\n }\n function div_2($receiver, other) {\n return new Scalar($receiver.value / other);\n }\n function times_2($receiver, other) {\n return new Scalar($receiver.value * other);\n }\n function unaryMinus_0($receiver) {\n return new Scalar(-$receiver.value);\n }\n function compareTo($receiver, i) {\n return Kotlin.compareTo($receiver.value, i);\n }\n function newSpanRectangle(leftTop, rightBottom) {\n return new Rect(leftTop, minus(rightBottom, leftTop));\n }\n function limit($receiver) {\n return boundingBox(asIterable(flatten(asSequence($receiver))));\n }\n function contains_1($receiver, v) {\n return $receiver.origin.x <= v.x && $receiver.origin.x + $receiver.dimension.x >= v.x && $receiver.origin.y <= v.y && $receiver.origin.y + $receiver.dimension.y >= v.y;\n }\n function intersects($receiver, rect) {\n var t1 = $receiver.origin;\n var t2 = plus_4($receiver.origin, $receiver.dimension);\n var r1 = rect.origin;\n var r2 = plus_4(rect.origin, rect.dimension);\n return r2.x >= t1.x && t2.x >= r1.x && r2.y >= t1.y && t2.y >= r1.y;\n }\n function xRange($receiver) {\n return new ClosedRange($receiver.origin.x, $receiver.origin.x + $receiver.dimension.x);\n }\n function yRange($receiver) {\n return new ClosedRange($receiver.origin.y, $receiver.origin.y + $receiver.dimension.y);\n }\n function limit_0($receiver) {\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(limit(item));\n }\n return destination;\n }\n function GeometryType(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function GeometryType_initFields() {\n GeometryType_initFields = function () {\n };\n GeometryType$MULTI_POINT_instance = new GeometryType('MULTI_POINT', 0);\n GeometryType$MULTI_LINESTRING_instance = new GeometryType('MULTI_LINESTRING', 1);\n GeometryType$MULTI_POLYGON_instance = new GeometryType('MULTI_POLYGON', 2);\n }\n var GeometryType$MULTI_POINT_instance;\n function GeometryType$MULTI_POINT_getInstance() {\n GeometryType_initFields();\n return GeometryType$MULTI_POINT_instance;\n }\n var GeometryType$MULTI_LINESTRING_instance;\n function GeometryType$MULTI_LINESTRING_getInstance() {\n GeometryType_initFields();\n return GeometryType$MULTI_LINESTRING_instance;\n }\n var GeometryType$MULTI_POLYGON_instance;\n function GeometryType$MULTI_POLYGON_getInstance() {\n GeometryType_initFields();\n return GeometryType$MULTI_POLYGON_instance;\n }\n GeometryType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeometryType',\n interfaces: [Enum]\n };\n function GeometryType$values() {\n return [GeometryType$MULTI_POINT_getInstance(), GeometryType$MULTI_LINESTRING_getInstance(), GeometryType$MULTI_POLYGON_getInstance()];\n }\n GeometryType.values = GeometryType$values;\n function GeometryType$valueOf(name) {\n switch (name) {\n case 'MULTI_POINT':\n return GeometryType$MULTI_POINT_getInstance();\n case 'MULTI_LINESTRING':\n return GeometryType$MULTI_LINESTRING_getInstance();\n case 'MULTI_POLYGON':\n return GeometryType$MULTI_POLYGON_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.typedGeometry.GeometryType.' + name);\n }\n }\n GeometryType.valueOf_61zpoe$ = GeometryType$valueOf;\n function Geometry(type, myMultiPoint, myMultiLineString, myMultiPolygon) {\n Geometry$Companion_getInstance();\n this.type = type;\n this.myMultiPoint_0 = myMultiPoint;\n this.myMultiLineString_0 = myMultiLineString;\n this.myMultiPolygon_0 = myMultiPolygon;\n }\n Object.defineProperty(Geometry.prototype, 'multiPoint', {\n configurable: true,\n get: function () {\n var tmp$;\n var tmp$_0;\n if ((tmp$ = this.myMultiPoint_0) != null)\n tmp$_0 = tmp$;\n else {\n throw IllegalStateException_init((this.type.toString() + ' is not a MultiPoint').toString());\n }\n return tmp$_0;\n }\n });\n Object.defineProperty(Geometry.prototype, 'multiLineString', {\n configurable: true,\n get: function () {\n var tmp$;\n var tmp$_0;\n if ((tmp$ = this.myMultiLineString_0) != null)\n tmp$_0 = tmp$;\n else {\n throw IllegalStateException_init((this.type.toString() + ' is not a MultiLineString').toString());\n }\n return tmp$_0;\n }\n });\n Object.defineProperty(Geometry.prototype, 'multiPolygon', {\n configurable: true,\n get: function () {\n var tmp$;\n var tmp$_0;\n if ((tmp$ = this.myMultiPolygon_0) != null)\n tmp$_0 = tmp$;\n else {\n throw IllegalStateException_init((this.type.toString() + ' is not a MultiPolygon').toString());\n }\n return tmp$_0;\n }\n });\n function Geometry$Companion() {\n Geometry$Companion_instance = this;\n }\n Geometry$Companion.prototype.createMultiPoint_xgn53i$ = function (multiPoint) {\n return new Geometry(GeometryType$MULTI_POINT_getInstance(), multiPoint, null, null);\n };\n Geometry$Companion.prototype.createMultiLineString_bc4hlz$ = function (multiLineString) {\n return new Geometry(GeometryType$MULTI_LINESTRING_getInstance(), null, multiLineString, null);\n };\n Geometry$Companion.prototype.createMultiPolygon_8ft4gs$ = function (multiPolygon) {\n return new Geometry(GeometryType$MULTI_POLYGON_getInstance(), null, null, multiPolygon);\n };\n Geometry$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Geometry$Companion_instance = null;\n function Geometry$Companion_getInstance() {\n if (Geometry$Companion_instance === null) {\n new Geometry$Companion();\n }return Geometry$Companion_instance;\n }\n Geometry.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Geometry',\n interfaces: []\n };\n function LineString(geometry) {\n AbstractGeometryList.call(this, geometry);\n }\n LineString.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LineString',\n interfaces: [AbstractGeometryList]\n };\n function MultiLineString(geometry) {\n AbstractGeometryList.call(this, geometry);\n }\n MultiLineString.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiLineString',\n interfaces: [AbstractGeometryList]\n };\n function MultiPoint(geometry) {\n AbstractGeometryList.call(this, geometry);\n }\n MultiPoint.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiPoint',\n interfaces: [AbstractGeometryList]\n };\n function MultiPolygon(polygons) {\n AbstractGeometryList.call(this, polygons);\n }\n MultiPolygon.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiPolygon',\n interfaces: [AbstractGeometryList]\n };\n function Polygon(rings) {\n AbstractGeometryList.call(this, rings);\n }\n Polygon.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Polygon',\n interfaces: [AbstractGeometryList]\n };\n function Rect(origin, dimension) {\n this.origin = origin;\n this.dimension = dimension;\n }\n Rect.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Rect',\n interfaces: []\n };\n function Rect_init(left, top, width, height, $this) {\n $this = $this || Object.create(Rect.prototype);\n Rect.call($this, new Vec(left, top), new Vec(width, height));\n return $this;\n }\n Rect.prototype.component1 = function () {\n return this.origin;\n };\n Rect.prototype.component2 = function () {\n return this.dimension;\n };\n Rect.prototype.copy_rbt1hw$ = function (origin, dimension) {\n return new Rect(origin === void 0 ? this.origin : origin, dimension === void 0 ? this.dimension : dimension);\n };\n Rect.prototype.toString = function () {\n return 'Rect(origin=' + Kotlin.toString(this.origin) + (', dimension=' + Kotlin.toString(this.dimension)) + ')';\n };\n Rect.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.origin) | 0;\n result = result * 31 + Kotlin.hashCode(this.dimension) | 0;\n return result;\n };\n Rect.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.origin, other.origin) && Kotlin.equals(this.dimension, other.dimension)))));\n };\n function Ring(points) {\n AbstractGeometryList.call(this, points);\n }\n Ring.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Ring',\n interfaces: [AbstractGeometryList]\n };\n function Scalar(value) {\n this.value = value;\n }\n Scalar.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Scalar',\n interfaces: []\n };\n Scalar.prototype.component1 = function () {\n return this.value;\n };\n Scalar.prototype.copy_14dthe$ = function (value) {\n return new Scalar(value === void 0 ? this.value : value);\n };\n Scalar.prototype.toString = function () {\n return 'Scalar(value=' + Kotlin.toString(this.value) + ')';\n };\n Scalar.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.value) | 0;\n return result;\n };\n Scalar.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && Kotlin.equals(this.value, other.value))));\n };\n function Vec(x, y) {\n this.x = x;\n this.y = y;\n }\n Vec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Vec',\n interfaces: []\n };\n function Vec_init(x, y, $this) {\n $this = $this || Object.create(Vec.prototype);\n Vec.call($this, x, y);\n return $this;\n }\n Vec.prototype.component1 = function () {\n return this.x;\n };\n Vec.prototype.component2 = function () {\n return this.y;\n };\n Vec.prototype.copy_lu1900$ = function (x, y) {\n return new Vec(x === void 0 ? this.x : x, y === void 0 ? this.y : y);\n };\n Vec.prototype.toString = function () {\n return 'Vec(x=' + Kotlin.toString(this.x) + (', y=' + Kotlin.toString(this.y)) + ')';\n };\n Vec.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.x) | 0;\n result = result * 31 + Kotlin.hashCode(this.y) | 0;\n return result;\n };\n Vec.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.x, other.x) && Kotlin.equals(this.y, other.y)))));\n };\n function explicitVec(x, y) {\n return new Vec(x, y);\n }\n function explicitVec_0(x, y) {\n return new Vec(x, y);\n }\n function newVec(x, y) {\n return new Vec(x.value, y.value);\n }\n function TypedKey() {\n }\n TypedKey.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'TypedKey',\n interfaces: []\n };\n function TypedKeyHashMap() {\n this.map = HashMap_init_0();\n }\n TypedKeyHashMap.prototype.get_ex36zt$ = function (key) {\n var tmp$;\n if (this.map.containsKey_11rb$(key)) {\n return (tmp$ = this.map.get_11rb$(key)) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n }throw new NoSuchElementException_init_0(\"Wasn't found key \" + key);\n };\n TypedKeyHashMap.prototype.set_ev6mlr$ = function (key, value) {\n this.put_ev6mlr$(key, value);\n };\n TypedKeyHashMap.prototype.put_ev6mlr$ = function (key, value) {\n if (value == null) {\n this.map.remove_11rb$(key);\n } else {\n this.map.put_xwzc9p$(key, value);\n }\n };\n TypedKeyHashMap.prototype.contains_ku7evr$ = function (key) {\n return this.containsKey_ex36zt$(key);\n };\n TypedKeyHashMap.prototype.containsKey_ex36zt$ = function (key) {\n return this.map.containsKey_11rb$(key);\n };\n TypedKeyHashMap.prototype.keys_287e2$ = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.map.keys, Set) ? tmp$ : throwCCE();\n };\n TypedKeyHashMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TypedKeyHashMap',\n interfaces: []\n };\n function UNSUPPORTED() {\n throw UnsupportedOperationException_init();\n }\n function UNSUPPORTED_0(what) {\n throw UnsupportedOperationException_init_0(what);\n }\n function Color(red, green, blue, alpha) {\n Color$Companion_getInstance();\n if (alpha === void 0)\n alpha = 255;\n this.red = red;\n this.green = green;\n this.blue = blue;\n this.alpha = alpha;\n if (!(0 <= this.red && this.red <= 255 && 0 <= this.green && this.green <= 255 && 0 <= this.blue && this.blue <= 255 && 0 <= this.alpha && this.alpha <= 255)) {\n var message = 'Color components out of range: ' + this;\n throw IllegalArgumentException_init(message.toString());\n }}\n Color.prototype.changeAlpha_za3lpa$ = function (newAlpha) {\n return new Color(this.red, this.green, this.blue, newAlpha);\n };\n Color.prototype.equals = function (other) {\n if (this === other) {\n return true;\n }if (!Kotlin.isType(other, Color)) {\n return false;\n }if (this.red !== other.red) {\n return false;\n }if (this.green !== other.green) {\n return false;\n }if (this.blue !== other.blue) {\n return false;\n }return this.alpha === other.alpha;\n };\n Color.prototype.toCssColor = function () {\n var tmp$;\n if (this.alpha === 255) {\n tmp$ = 'rgb(' + this.red + ',' + this.green + ',' + this.blue + ')';\n } else {\n tmp$ = 'rgba(' + toString(this.red) + ',' + toString(this.green) + ',' + toString(this.blue) + ',' + toString(this.alpha / 255.0) + ')';\n }\n return tmp$;\n };\n Color.prototype.toHexColor = function () {\n return '#' + Color$Companion_getInstance().toColorPart_0(this.red) + Color$Companion_getInstance().toColorPart_0(this.green) + Color$Companion_getInstance().toColorPart_0(this.blue);\n };\n Color.prototype.hashCode = function () {\n var result = 0;\n result = (31 * result | 0) + this.red | 0;\n result = (31 * result | 0) + this.green | 0;\n result = (31 * result | 0) + this.blue | 0;\n result = (31 * result | 0) + this.alpha | 0;\n return result;\n };\n Color.prototype.toString = function () {\n return 'color(' + this.red + ',' + this.green + ',' + this.blue + ',' + this.alpha + ')';\n };\n function Color$Companion() {\n Color$Companion_instance = this;\n this.TRANSPARENT = new Color(0, 0, 0, 0);\n this.WHITE = new Color(255, 255, 255);\n this.CONSOLE_WHITE = new Color(204, 204, 204);\n this.BLACK = new Color(0, 0, 0);\n this.LIGHT_GRAY = new Color(192, 192, 192);\n this.VERY_LIGHT_GRAY = new Color(210, 210, 210);\n this.GRAY = new Color(128, 128, 128);\n this.RED = new Color(255, 0, 0);\n this.LIGHT_GREEN = new Color(210, 255, 210);\n this.GREEN = new Color(0, 255, 0);\n this.DARK_GREEN = new Color(0, 128, 0);\n this.BLUE = new Color(0, 0, 255);\n this.DARK_BLUE = new Color(0, 0, 128);\n this.LIGHT_BLUE = new Color(210, 210, 255);\n this.YELLOW = new Color(255, 255, 0);\n this.CONSOLE_YELLOW = new Color(174, 174, 36);\n this.LIGHT_YELLOW = new Color(255, 255, 128);\n this.VERY_LIGHT_YELLOW = new Color(255, 255, 210);\n this.MAGENTA = new Color(255, 0, 255);\n this.LIGHT_MAGENTA = new Color(255, 210, 255);\n this.DARK_MAGENTA = new Color(128, 0, 128);\n this.CYAN = new Color(0, 255, 255);\n this.LIGHT_CYAN = new Color(210, 255, 255);\n this.ORANGE = new Color(255, 192, 0);\n this.PINK = new Color(255, 175, 175);\n this.LIGHT_PINK = new Color(255, 210, 210);\n this.PACIFIC_BLUE = this.parseHex_61zpoe$('#118ED8');\n this.RGB_0 = 'rgb';\n this.COLOR_0 = 'color';\n this.RGBA_0 = 'rgba';\n }\n Color$Companion.prototype.parseRGB_61zpoe$ = function (text) {\n var firstParen = this.findNext_0(text, '(', 0);\n var prefix = text.substring(0, firstParen);\n var firstComma = this.findNext_0(text, ',', firstParen + 1 | 0);\n var secondComma = this.findNext_0(text, ',', firstComma + 1 | 0);\n var thirdComma = -1;\n if (equals(prefix, this.RGBA_0))\n thirdComma = this.findNext_0(text, ',', secondComma + 1 | 0);\n else if (equals(prefix, this.COLOR_0))\n thirdComma = indexOf(text, ',', secondComma + 1 | 0);\n else if (!equals(prefix, this.RGB_0))\n throw IllegalArgumentException_init(text);\n var lastParen = this.findNext_0(text, ')', thirdComma + 1 | 0);\n var startIndex = firstParen + 1 | 0;\n var $receiver = text.substring(startIndex, firstComma);\n var tmp$;\n var $receiver_0 = Kotlin.isCharSequence(tmp$ = $receiver) ? tmp$ : throwCCE();\n var startIndex_0 = 0;\n var endIndex = $receiver_0.length - 1 | 0;\n var startFound = false;\n while (startIndex_0 <= endIndex) {\n var index = !startFound ? startIndex_0 : endIndex;\n var match = unboxChar(toBoxedChar($receiver_0.charCodeAt(index))) <= 32;\n if (!startFound) {\n if (!match)\n startFound = true;\n else\n startIndex_0 = startIndex_0 + 1 | 0;\n } else {\n if (!match)\n break;\n else\n endIndex = endIndex - 1 | 0;\n }\n }\n var red = toInt(Kotlin.subSequence($receiver_0, startIndex_0, endIndex + 1 | 0).toString());\n var startIndex_1 = firstComma + 1 | 0;\n var $receiver_1 = text.substring(startIndex_1, secondComma);\n var tmp$_0;\n var $receiver_0_0 = Kotlin.isCharSequence(tmp$_0 = $receiver_1) ? tmp$_0 : throwCCE();\n var startIndex_2 = 0;\n var endIndex_0 = $receiver_0_0.length - 1 | 0;\n var startFound_0 = false;\n while (startIndex_2 <= endIndex_0) {\n var index_0 = !startFound_0 ? startIndex_2 : endIndex_0;\n var match_0 = unboxChar(toBoxedChar($receiver_0_0.charCodeAt(index_0))) <= 32;\n if (!startFound_0) {\n if (!match_0)\n startFound_0 = true;\n else\n startIndex_2 = startIndex_2 + 1 | 0;\n } else {\n if (!match_0)\n break;\n else\n endIndex_0 = endIndex_0 - 1 | 0;\n }\n }\n var green = toInt(Kotlin.subSequence($receiver_0_0, startIndex_2, endIndex_0 + 1 | 0).toString());\n var blue;\n var alpha;\n if (thirdComma === -1) {\n var startIndex_3 = secondComma + 1 | 0;\n var $receiver_2 = text.substring(startIndex_3, lastParen);\n var tmp$_1;\n var $receiver_0_1 = Kotlin.isCharSequence(tmp$_1 = $receiver_2) ? tmp$_1 : throwCCE();\n var startIndex_4 = 0;\n var endIndex_1 = $receiver_0_1.length - 1 | 0;\n var startFound_1 = false;\n while (startIndex_4 <= endIndex_1) {\n var index_1 = !startFound_1 ? startIndex_4 : endIndex_1;\n var match_1 = unboxChar(toBoxedChar($receiver_0_1.charCodeAt(index_1))) <= 32;\n if (!startFound_1) {\n if (!match_1)\n startFound_1 = true;\n else\n startIndex_4 = startIndex_4 + 1 | 0;\n } else {\n if (!match_1)\n break;\n else\n endIndex_1 = endIndex_1 - 1 | 0;\n }\n }\n blue = toInt(Kotlin.subSequence($receiver_0_1, startIndex_4, endIndex_1 + 1 | 0).toString());\n alpha = 255;\n } else {\n var startIndex_5 = secondComma + 1 | 0;\n var endIndex_2 = thirdComma;\n var $receiver_3 = text.substring(startIndex_5, endIndex_2);\n var tmp$_2;\n var $receiver_0_2 = Kotlin.isCharSequence(tmp$_2 = $receiver_3) ? tmp$_2 : throwCCE();\n var startIndex_6 = 0;\n var endIndex_3 = $receiver_0_2.length - 1 | 0;\n var startFound_2 = false;\n while (startIndex_6 <= endIndex_3) {\n var index_2 = !startFound_2 ? startIndex_6 : endIndex_3;\n var match_2 = unboxChar(toBoxedChar($receiver_0_2.charCodeAt(index_2))) <= 32;\n if (!startFound_2) {\n if (!match_2)\n startFound_2 = true;\n else\n startIndex_6 = startIndex_6 + 1 | 0;\n } else {\n if (!match_2)\n break;\n else\n endIndex_3 = endIndex_3 - 1 | 0;\n }\n }\n blue = toInt(Kotlin.subSequence($receiver_0_2, startIndex_6, endIndex_3 + 1 | 0).toString());\n var startIndex_7 = thirdComma + 1 | 0;\n var $receiver_4 = text.substring(startIndex_7, lastParen);\n var tmp$_3;\n var $receiver_0_3 = Kotlin.isCharSequence(tmp$_3 = $receiver_4) ? tmp$_3 : throwCCE();\n var startIndex_8 = 0;\n var endIndex_4 = $receiver_0_3.length - 1 | 0;\n var startFound_3 = false;\n while (startIndex_8 <= endIndex_4) {\n var index_3 = !startFound_3 ? startIndex_8 : endIndex_4;\n var match_3 = unboxChar(toBoxedChar($receiver_0_3.charCodeAt(index_3))) <= 32;\n if (!startFound_3) {\n if (!match_3)\n startFound_3 = true;\n else\n startIndex_8 = startIndex_8 + 1 | 0;\n } else {\n if (!match_3)\n break;\n else\n endIndex_4 = endIndex_4 - 1 | 0;\n }\n }\n alpha = roundToInt(toDouble(Kotlin.subSequence($receiver_0_3, startIndex_8, endIndex_4 + 1 | 0).toString()) * 255);\n }\n return new Color(red, green, blue, alpha);\n };\n Color$Companion.prototype.findNext_0 = function (s, what, from) {\n var result = indexOf(s, what, from);\n if (result === -1) {\n throw IllegalArgumentException_init('text=' + s + ' what=' + what + ' from=' + from);\n }return result;\n };\n Color$Companion.prototype.parseHex_61zpoe$ = function (hexColor) {\n var hexColor_0 = hexColor;\n if (!startsWith_0(hexColor_0, '#')) {\n throw IllegalArgumentException_init('Not a HEX value: ' + hexColor_0);\n }hexColor_0 = hexColor_0.substring(1);\n if (hexColor_0.length !== 6) {\n throw IllegalArgumentException_init('Not a HEX value: ' + hexColor_0);\n }var r = toInt_0(hexColor_0.substring(0, 2), 16);\n var g = toInt_0(hexColor_0.substring(2, 4), 16);\n var b = toInt_0(hexColor_0.substring(4, 6), 16);\n return new Color(r, g, b);\n };\n Color$Companion.prototype.toColorPart_0 = function (value) {\n var tmp$;\n if (value < 0 || value > 255) {\n throw IllegalArgumentException_init('RGB color part must be in range [0..255] but was ' + value);\n }var result = toString_0(value, 16);\n if (result.length === 1) {\n tmp$ = '0' + result;\n } else {\n tmp$ = result;\n }\n return tmp$;\n };\n Color$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Color$Companion_instance = null;\n function Color$Companion_getInstance() {\n if (Color$Companion_instance === null) {\n new Color$Companion();\n }return Color$Companion_instance;\n }\n Color.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Color',\n interfaces: []\n };\n function Colors() {\n Colors_instance = this;\n this.DEFAULT_FACTOR_0 = 0.7;\n this.variantColors_0 = mapOf([to('dark_blue', Color$Companion_getInstance().DARK_BLUE), to('dark_green', Color$Companion_getInstance().DARK_GREEN), to('dark_magenta', Color$Companion_getInstance().DARK_MAGENTA), to('light_blue', Color$Companion_getInstance().LIGHT_BLUE), to('light_gray', Color$Companion_getInstance().LIGHT_GRAY), to('light_green', Color$Companion_getInstance().LIGHT_GREEN), to('light_yellow', Color$Companion_getInstance().LIGHT_YELLOW), to('light_magenta', Color$Companion_getInstance().LIGHT_MAGENTA), to('light_cyan', Color$Companion_getInstance().LIGHT_CYAN), to('light_pink', Color$Companion_getInstance().LIGHT_PINK), to('very_light_gray', Color$Companion_getInstance().VERY_LIGHT_GRAY), to('very_light_yellow', Color$Companion_getInstance().VERY_LIGHT_YELLOW)]);\n var tmp$ = plus_3(mapOf([to('white', Color$Companion_getInstance().WHITE), to('black', Color$Companion_getInstance().BLACK), to('gray', Color$Companion_getInstance().GRAY), to('red', Color$Companion_getInstance().RED), to('green', Color$Companion_getInstance().GREEN), to('blue', Color$Companion_getInstance().BLUE), to('yellow', Color$Companion_getInstance().YELLOW), to('magenta', Color$Companion_getInstance().MAGENTA), to('cyan', Color$Companion_getInstance().CYAN), to('orange', Color$Companion_getInstance().ORANGE), to('pink', Color$Companion_getInstance().PINK)]), this.variantColors_0);\n var $receiver = this.variantColors_0;\n var destination = LinkedHashMap_init_0(mapCapacity($receiver.size));\n var tmp$_0;\n tmp$_0 = $receiver.entries.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n destination.put_xwzc9p$(replace_0(element.key, 95, 45), element.value);\n }\n var tmp$_1 = plus_3(tmp$, destination);\n var $receiver_0 = this.variantColors_0;\n var destination_0 = LinkedHashMap_init_0(mapCapacity($receiver_0.size));\n var tmp$_2;\n tmp$_2 = $receiver_0.entries.iterator();\n while (tmp$_2.hasNext()) {\n var element_0 = tmp$_2.next();\n destination_0.put_xwzc9p$(replace(element_0.key, '_', ''), element_0.value);\n }\n this.namedColors_0 = plus_3(tmp$_1, destination_0);\n }\n Colors.prototype.parseColor_61zpoe$ = function (c) {\n var tmp$;\n if (indexOf_0(c, 40) > 0)\n tmp$ = Color$Companion_getInstance().parseRGB_61zpoe$(c);\n else if (startsWith_0(c, '#'))\n tmp$ = Color$Companion_getInstance().parseHex_61zpoe$(c);\n else if (this.isColorName_61zpoe$(c))\n tmp$ = this.forName_61zpoe$(c);\n else\n throw IllegalArgumentException_init('Error persing color value: ' + c);\n return tmp$;\n };\n Colors.prototype.isColorName_61zpoe$ = function (colorName) {\n return this.namedColors_0.containsKey_11rb$(colorName.toLowerCase());\n };\n Colors.prototype.forName_61zpoe$ = function (colorName) {\n var tmp$;\n tmp$ = this.namedColors_0.get_11rb$(colorName.toLowerCase());\n if (tmp$ == null) {\n throw IllegalArgumentException_init_0();\n }return tmp$;\n };\n Colors.prototype.generateHueColor = function () {\n return 360 * Random.Default.nextDouble();\n };\n Colors.prototype.generateColor_lu1900$ = function (s, v) {\n return this.rgbFromHsv_yvo9jy$(360 * Random.Default.nextDouble(), s, v);\n };\n Colors.prototype.rgbFromHsv_yvo9jy$ = function (h, s, v) {\n if (v === void 0)\n v = 1.0;\n var hd = h / 60;\n var c = v * s;\n var x = hd % 2 - 1;\n var x_0 = c * (1 - JsMath.abs(x));\n var r = 0.0;\n var g = 0.0;\n var b = 0.0;\n if (hd < 1) {\n r = c;\n g = x_0;\n } else if (hd < 2) {\n r = x_0;\n g = c;\n } else if (hd < 3) {\n g = c;\n b = x_0;\n } else if (hd < 4) {\n g = x_0;\n b = c;\n } else if (hd < 5) {\n r = x_0;\n b = c;\n } else {\n r = c;\n b = x_0;\n }\n var m = v - c;\n return new Color(numberToInt(255 * (r + m)), numberToInt(255 * (g + m)), numberToInt(255 * (b + m)));\n };\n Colors.prototype.hsvFromRgb_98b62m$ = function (color) {\n var tmp$;\n var scale = 1.0 / 255;\n var r = color.red * scale;\n var g = color.green * scale;\n var b = color.blue * scale;\n var b_0 = JsMath.min(g, b);\n var min = JsMath.min(r, b_0);\n var b_1 = JsMath.max(g, b);\n var max = JsMath.max(r, b_1);\n var v = max === 0.0 ? 0.0 : 1 - min / max;\n var h;\n var div = 1.0 / (6 * (max - min));\n if (max === min) {\n tmp$ = 0.0;\n } else if (max === r) {\n tmp$ = g >= b ? (g - b) * div : 1 + (g - b) * div;\n } else if (max === g) {\n tmp$ = 1.0 / 3 + (b - r) * div;\n } else {\n tmp$ = 2.0 / 3 + (r - g) * div;\n }\n h = tmp$;\n return new Float64Array([360 * h, v, max]);\n };\n Colors.prototype.darker_w32t8z$ = function (c, factor) {\n if (factor === void 0)\n factor = this.DEFAULT_FACTOR_0;\n var tmp$;\n if (c != null) {\n var a = numberToInt(c.red * factor);\n var tmp$_0 = JsMath.max(a, 0);\n var a_0 = numberToInt(c.green * factor);\n var tmp$_1 = JsMath.max(a_0, 0);\n var a_1 = numberToInt(c.blue * factor);\n tmp$ = new Color(tmp$_0, tmp$_1, JsMath.max(a_1, 0), c.alpha);\n } else\n tmp$ = null;\n return tmp$;\n };\n Colors.prototype.lighter_o14uds$ = function (c, factor) {\n if (factor === void 0)\n factor = this.DEFAULT_FACTOR_0;\n var r = c.red;\n var g = c.green;\n var b = c.blue;\n var alpha = c.alpha;\n var i = numberToInt(1.0 / (1.0 - factor));\n if (r === 0 && g === 0 && b === 0) {\n return new Color(i, i, i, alpha);\n }if (r > 0 && r < i)\n r = i;\n if (g > 0 && g < i)\n g = i;\n if (b > 0 && b < i)\n b = i;\n var a = numberToInt(r / factor);\n var tmp$ = JsMath.min(a, 255);\n var a_0 = numberToInt(g / factor);\n var tmp$_0 = JsMath.min(a_0, 255);\n var a_1 = numberToInt(b / factor);\n return new Color(tmp$, tmp$_0, JsMath.min(a_1, 255), alpha);\n };\n Colors.prototype.mimicTransparency_w1v12e$ = function (color, alpha, background) {\n var red = numberToInt(color.red * alpha + background.red * (1 - alpha));\n var green = numberToInt(color.green * alpha + background.green * (1 - alpha));\n var blue = numberToInt(color.blue * alpha + background.blue * (1 - alpha));\n return new Color(red, green, blue);\n };\n Colors.prototype.withOpacity_o14uds$ = function (c, opacity) {\n var tmp$;\n if (opacity < 1.0) {\n var b = numberToInt(round(255 * opacity));\n var b_0 = JsMath.min(255, b);\n tmp$ = c.changeAlpha_za3lpa$(JsMath.max(0, b_0));\n } else\n tmp$ = c;\n return tmp$;\n };\n Colors.prototype.contrast_a87jzg$ = function (color, other) {\n return (this.luminance_98b62m$(color) + 0.05) / (this.luminance_98b62m$(other) + 0.05);\n };\n Colors.prototype.luminance_98b62m$ = function (color) {\n return 0.2126 * this.colorLuminance_0(color.red) + 0.7152 * this.colorLuminance_0(color.green) + 0.0722 * this.colorLuminance_0(color.blue);\n };\n Colors.prototype.colorLuminance_0 = function (componentValue) {\n var tmp$;\n if (componentValue <= 10)\n tmp$ = componentValue / 3294.0;\n else {\n var $receiver = componentValue / 269.0 + 0.0513;\n tmp$ = JsMath.pow($receiver, 2.4);\n }\n return tmp$;\n };\n Colors.prototype.solid_98b62m$ = function (c) {\n return c.alpha === 255;\n };\n Colors.prototype.distributeEvenly_5wr77w$ = function (count, saturation) {\n var tmp$;\n var result = Kotlin.newArray(count, null);\n var sector = 360 / count | 0;\n for (var i = 0; i < count; i++) {\n result[i] = this.rgbFromHsv_yvo9jy$(Kotlin.imul(sector, i), saturation);\n }\n return Kotlin.isArray(tmp$ = result) ? tmp$ : throwCCE();\n };\n Colors.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Colors',\n interfaces: []\n };\n var Colors_instance = null;\n function Colors_getInstance() {\n if (Colors_instance === null) {\n new Colors();\n }return Colors_instance;\n }\n function toPngDataUri(base64EncodedPngImage) {\n return 'data:image/png;base64,' + base64EncodedPngImage;\n }\n function Font(family, size, isBold, isItalic) {\n if (isBold === void 0)\n isBold = false;\n if (isItalic === void 0)\n isItalic = false;\n this.family = family;\n this.size = size;\n this.isBold = isBold;\n this.isItalic = isItalic;\n }\n Font.prototype.toString = function () {\n return this.family.toString() + ' ' + this.size + ' ' + (this.isBold ? 'bold' : '') + ' ' + (this.isItalic ? 'italic' : '');\n };\n Font.prototype.equals = function (other) {\n if (this === other)\n return true;\n if (!Kotlin.isType(other, Font))\n return false;\n return this.family === other.family && this.size === other.size && this.isBold === other.isBold && this.isItalic === other.isItalic;\n };\n Font.prototype.hashCode = function () {\n var result = hashCode(this.family);\n result = (31 * result | 0) + this.size | 0;\n result = (31 * result | 0) + (this.isBold ? 1 : 0) | 0;\n result = (31 * result | 0) + (this.isItalic ? 1 : 0) | 0;\n return result;\n };\n Font.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Font',\n interfaces: []\n };\n function FontFamily(myName) {\n FontFamily$Companion_getInstance();\n this.myName_0 = myName;\n }\n FontFamily.prototype.toString = function () {\n return this.myName_0;\n };\n function FontFamily$Companion() {\n FontFamily$Companion_instance = this;\n this.MONOSPACED = this.forName_61zpoe$('monospace');\n this.SERIF = this.forName_61zpoe$('serif');\n }\n FontFamily$Companion.prototype.forName_61zpoe$ = function (name) {\n return new FontFamily(name);\n };\n FontFamily$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var FontFamily$Companion_instance = null;\n function FontFamily$Companion_getInstance() {\n if (FontFamily$Companion_instance === null) {\n new FontFamily$Companion();\n }return FontFamily$Companion_instance;\n }\n FontFamily.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FontFamily',\n interfaces: []\n };\n function HSV(h, saturation, value) {\n if (value === void 0)\n value = 1.0;\n this.h = h;\n this.s = 0;\n this.v = 0;\n if (!(saturation >= -0.001 && saturation <= 1.001)) {\n var message = \"HSV 'saturation' must be in range [0, 1] but was \" + saturation;\n throw IllegalArgumentException_init(message.toString());\n }if (!(value >= -0.001 && value <= 1.001)) {\n var message_0 = \"HSV 'value' must be in range [0, 1] but was \" + value;\n throw IllegalArgumentException_init(message_0.toString());\n }var x = numberToInt(saturation * 100) / 100.0;\n this.s = JsMath.abs(x);\n var x_0 = numberToInt(value * 100) / 100.0;\n this.v = JsMath.abs(x_0);\n }\n HSV.prototype.toString = function () {\n return 'HSV(' + this.h + ', ' + this.s + ', ' + this.v + ')';\n };\n HSV.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HSV',\n interfaces: []\n };\n function Interval(lowerBound, upperBound) {\n this.lowerBound = lowerBound;\n this.upperBound = upperBound;\n if (this.lowerBound > this.upperBound) {\n throw IllegalArgumentException_init('Lower bound is greater than upper: lower bound=' + toString(this.lowerBound) + ', upper bound=' + toString(this.upperBound));\n }}\n Object.defineProperty(Interval.prototype, 'length', {\n configurable: true,\n get: function () {\n return this.upperBound - this.lowerBound | 0;\n }\n });\n Interval.prototype.contains_za3lpa$ = function (point) {\n return this.lowerBound <= point && point <= this.upperBound;\n };\n Interval.prototype.contains_fvoaba$ = function (other) {\n return this.contains_za3lpa$(other.lowerBound) && this.contains_za3lpa$(other.upperBound);\n };\n Interval.prototype.intersects_fvoaba$ = function (other) {\n return this.contains_za3lpa$(other.lowerBound) || other.contains_za3lpa$(this.lowerBound);\n };\n Interval.prototype.union_fvoaba$ = function (other) {\n var a = this.lowerBound;\n var b = other.lowerBound;\n var tmp$ = JsMath.min(a, b);\n var a_0 = this.upperBound;\n var b_0 = other.upperBound;\n return new Interval(tmp$, JsMath.max(a_0, b_0));\n };\n Interval.prototype.add_za3lpa$ = function (delta) {\n return new Interval(this.lowerBound + delta | 0, this.upperBound + delta | 0);\n };\n Interval.prototype.sub_za3lpa$ = function (delta) {\n return new Interval(this.lowerBound - delta | 0, this.upperBound - delta | 0);\n };\n Interval.prototype.toString = function () {\n return '[' + this.lowerBound + ', ' + this.upperBound + ']';\n };\n Interval.prototype.equals = function (other) {\n var tmp$;\n if (this === other)\n return true;\n if (!Kotlin.isType(other, Interval))\n return false;\n var interval = (tmp$ = other) == null || Kotlin.isType(tmp$, Interval) ? tmp$ : throwCCE();\n return this.lowerBound !== ensureNotNull(interval).lowerBound ? false : this.upperBound === interval.upperBound;\n };\n Interval.prototype.hashCode = function () {\n var result = this.lowerBound;\n result = (31 * result | 0) + this.upperBound | 0;\n return result;\n };\n Interval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Interval',\n interfaces: []\n };\n function Pair_0(first, second) {\n this.first = first;\n this.second = second;\n }\n Pair_0.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, Pair_0) ? tmp$_0 : throwCCE();\n if (!equals(this.first, other.first))\n return false;\n if (!equals(this.second, other.second))\n return false;\n return true;\n };\n Pair_0.prototype.hashCode = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var result = (tmp$_0 = (tmp$ = this.first) != null ? hashCode(tmp$) : null) != null ? tmp$_0 : 0;\n result = (31 * result | 0) + ((tmp$_2 = (tmp$_1 = this.second) != null ? hashCode(tmp$_1) : null) != null ? tmp$_2 : 0) | 0;\n return result;\n };\n Pair_0.prototype.toString = function () {\n return '[' + this.first + ', ' + this.second + ']';\n };\n Pair_0.prototype.component1 = function () {\n return this.first;\n };\n Pair_0.prototype.component2 = function () {\n return this.second;\n };\n Pair_0.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Pair',\n interfaces: []\n };\n function SomeFig() {\n }\n SomeFig.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'SomeFig',\n interfaces: []\n };\n function PortableLogging() {\n PortableLogging_instance = this;\n }\n function PortableLogging$logger$ObjectLiteral(closure$kl) {\n this.closure$kl = closure$kl;\n }\n PortableLogging$logger$ObjectLiteral.prototype.error_l35kib$ = function (e, message) {\n this.closure$kl.error_ca4k3s$(e, message);\n };\n PortableLogging$logger$ObjectLiteral.prototype.info_h4ejuu$ = function (message) {\n this.closure$kl.info_nq59yw$(message);\n };\n PortableLogging$logger$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Logger]\n };\n PortableLogging.prototype.logger_xo1ogr$ = function (cl) {\n var tmp$;\n var kl = mu.KotlinLogging.logger_61zpoe$((tmp$ = cl.simpleName) != null ? tmp$ : '');\n return new PortableLogging$logger$ObjectLiteral(kl);\n };\n PortableLogging.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PortableLogging',\n interfaces: []\n };\n var PortableLogging_instance = null;\n function PortableLogging_getInstance() {\n if (PortableLogging_instance === null) {\n new PortableLogging();\n }return PortableLogging_instance;\n }\n var package$jetbrains = _.jetbrains || (_.jetbrains = {});\n var package$datalore = package$jetbrains.datalore || (package$jetbrains.datalore = {});\n var package$base = package$datalore.base || (package$datalore.base = {});\n var package$algorithms = package$base.algorithms || (package$base.algorithms = {});\n package$algorithms.splitRings_bemo1h$ = splitRings;\n package$algorithms.isClosed_2p1efm$ = isClosed;\n package$algorithms.calculateArea_ytws2g$ = calculateArea;\n package$algorithms.isClockwise_st9g9f$ = isClockwise;\n package$algorithms.calculateArea_st9g9f$ = calculateArea_0;\n var package$dateFormat = package$base.dateFormat || (package$base.dateFormat = {});\n Object.defineProperty(package$dateFormat, 'DateLocale', {\n get: DateLocale_getInstance\n });\n Format.SpecPart = Format$SpecPart;\n Format.PatternSpecPart = Format$PatternSpecPart;\n Object.defineProperty(Format, 'Companion', {\n get: Format$Companion_getInstance\n });\n package$dateFormat.Format_init_61zpoe$ = Format_init;\n package$dateFormat.Format = Format;\n Object.defineProperty(Pattern, 'DAY_OF_WEEK_ABBR', {\n get: Pattern$DAY_OF_WEEK_ABBR_getInstance\n });\n Object.defineProperty(Pattern, 'DAY_OF_WEEK_FULL', {\n get: Pattern$DAY_OF_WEEK_FULL_getInstance\n });\n Object.defineProperty(Pattern, 'MONTH_ABBR', {\n get: Pattern$MONTH_ABBR_getInstance\n });\n Object.defineProperty(Pattern, 'MONTH_FULL', {\n get: Pattern$MONTH_FULL_getInstance\n });\n Object.defineProperty(Pattern, 'DAY_OF_MONTH_LEADING_ZERO', {\n get: Pattern$DAY_OF_MONTH_LEADING_ZERO_getInstance\n });\n Object.defineProperty(Pattern, 'DAY_OF_MONTH', {\n get: Pattern$DAY_OF_MONTH_getInstance\n });\n Object.defineProperty(Pattern, 'DAY_OF_THE_YEAR', {\n get: Pattern$DAY_OF_THE_YEAR_getInstance\n });\n Object.defineProperty(Pattern, 'MONTH', {\n get: Pattern$MONTH_getInstance\n });\n Object.defineProperty(Pattern, 'DAY_OF_WEEK', {\n get: Pattern$DAY_OF_WEEK_getInstance\n });\n Object.defineProperty(Pattern, 'YEAR_SHORT', {\n get: Pattern$YEAR_SHORT_getInstance\n });\n Object.defineProperty(Pattern, 'YEAR_FULL', {\n get: Pattern$YEAR_FULL_getInstance\n });\n Object.defineProperty(Pattern, 'HOUR_24', {\n get: Pattern$HOUR_24_getInstance\n });\n Object.defineProperty(Pattern, 'HOUR_12_LEADING_ZERO', {\n get: Pattern$HOUR_12_LEADING_ZERO_getInstance\n });\n Object.defineProperty(Pattern, 'HOUR_12', {\n get: Pattern$HOUR_12_getInstance\n });\n Object.defineProperty(Pattern, 'MINUTE', {\n get: Pattern$MINUTE_getInstance\n });\n Object.defineProperty(Pattern, 'MERIDIAN_LOWER', {\n get: Pattern$MERIDIAN_LOWER_getInstance\n });\n Object.defineProperty(Pattern, 'MERIDIAN_UPPER', {\n get: Pattern$MERIDIAN_UPPER_getInstance\n });\n Object.defineProperty(Pattern, 'SECOND', {\n get: Pattern$SECOND_getInstance\n });\n Object.defineProperty(Pattern$Companion$Kind, 'DATE', {\n get: Pattern$Companion$Kind$DATE_getInstance\n });\n Object.defineProperty(Pattern$Companion$Kind, 'TIME', {\n get: Pattern$Companion$Kind$TIME_getInstance\n });\n Pattern$Companion.prototype.Kind = Pattern$Companion$Kind;\n Object.defineProperty(Pattern, 'Companion', {\n get: Pattern$Companion_getInstance\n });\n package$dateFormat.Pattern = Pattern;\n Object.defineProperty(Date_0, 'Companion', {\n get: Date$Companion_getInstance\n });\n var package$datetime = package$base.datetime || (package$base.datetime = {});\n package$datetime.Date = Date_0;\n Object.defineProperty(DateTime, 'Companion', {\n get: DateTime$Companion_getInstance\n });\n package$datetime.DateTime = DateTime;\n Object.defineProperty(package$datetime, 'DateTimeUtil', {\n get: DateTimeUtil_getInstance\n });\n Object.defineProperty(Duration, 'Companion', {\n get: Duration$Companion_getInstance\n });\n package$datetime.Duration = Duration;\n package$datetime.Instant = Instant;\n Object.defineProperty(Month, 'Companion', {\n get: Month$Companion_getInstance\n });\n package$datetime.Month = Month;\n Object.defineProperty(Time, 'Companion', {\n get: Time$Companion_getInstance\n });\n package$datetime.Time = Time;\n Object.defineProperty(WeekDay, 'MONDAY', {\n get: WeekDay$MONDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'TUESDAY', {\n get: WeekDay$TUESDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'WEDNESDAY', {\n get: WeekDay$WEDNESDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'THURSDAY', {\n get: WeekDay$THURSDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'FRIDAY', {\n get: WeekDay$FRIDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'SATURDAY', {\n get: WeekDay$SATURDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'SUNDAY', {\n get: WeekDay$SUNDAY_getInstance\n });\n package$datetime.WeekDay = WeekDay;\n var package$tz = package$datetime.tz || (package$datetime.tz = {});\n package$tz.DateSpec = DateSpec;\n Object.defineProperty(package$tz, 'DateSpecs', {\n get: DateSpecs_getInstance\n });\n Object.defineProperty(TimeZone, 'Companion', {\n get: TimeZone$Companion_getInstance\n });\n package$tz.TimeZone = TimeZone;\n Object.defineProperty(TimeZoneMoscow, 'Companion', {\n get: TimeZoneMoscow$Companion_getInstance\n });\n package$tz.TimeZoneMoscow = TimeZoneMoscow;\n Object.defineProperty(package$tz, 'TimeZones', {\n get: TimeZones_getInstance\n });\n var package$enums = package$base.enums || (package$base.enums = {});\n package$enums.EnumInfo = EnumInfo;\n Object.defineProperty(package$enums, 'EnumInfoFactory', {\n get: EnumInfoFactory_getInstance\n });\n package$enums.EnumInfoImpl = EnumInfoImpl;\n Object.defineProperty(package$enums, 'Enums', {\n get: Enums_getInstance\n });\n Object.defineProperty(Button, 'NONE', {\n get: Button$NONE_getInstance\n });\n Object.defineProperty(Button, 'LEFT', {\n get: Button$LEFT_getInstance\n });\n Object.defineProperty(Button, 'MIDDLE', {\n get: Button$MIDDLE_getInstance\n });\n Object.defineProperty(Button, 'RIGHT', {\n get: Button$RIGHT_getInstance\n });\n var package$event = package$base.event || (package$base.event = {});\n package$event.Button = Button;\n package$event.Event = Event;\n package$event.EventContext = EventContext;\n Object.defineProperty(Key, 'A', {\n get: Key$A_getInstance\n });\n Object.defineProperty(Key, 'B', {\n get: Key$B_getInstance\n });\n Object.defineProperty(Key, 'C', {\n get: Key$C_getInstance\n });\n Object.defineProperty(Key, 'D', {\n get: Key$D_getInstance\n });\n Object.defineProperty(Key, 'E', {\n get: Key$E_getInstance\n });\n Object.defineProperty(Key, 'F', {\n get: Key$F_getInstance\n });\n Object.defineProperty(Key, 'G', {\n get: Key$G_getInstance\n });\n Object.defineProperty(Key, 'H', {\n get: Key$H_getInstance\n });\n Object.defineProperty(Key, 'I', {\n get: Key$I_getInstance\n });\n Object.defineProperty(Key, 'J', {\n get: Key$J_getInstance\n });\n Object.defineProperty(Key, 'K', {\n get: Key$K_getInstance\n });\n Object.defineProperty(Key, 'L', {\n get: Key$L_getInstance\n });\n Object.defineProperty(Key, 'M', {\n get: Key$M_getInstance\n });\n Object.defineProperty(Key, 'N', {\n get: Key$N_getInstance\n });\n Object.defineProperty(Key, 'O', {\n get: Key$O_getInstance\n });\n Object.defineProperty(Key, 'P', {\n get: Key$P_getInstance\n });\n Object.defineProperty(Key, 'Q', {\n get: Key$Q_getInstance\n });\n Object.defineProperty(Key, 'R', {\n get: Key$R_getInstance\n });\n Object.defineProperty(Key, 'S', {\n get: Key$S_getInstance\n });\n Object.defineProperty(Key, 'T', {\n get: Key$T_getInstance\n });\n Object.defineProperty(Key, 'U', {\n get: Key$U_getInstance\n });\n Object.defineProperty(Key, 'V', {\n get: Key$V_getInstance\n });\n Object.defineProperty(Key, 'W', {\n get: Key$W_getInstance\n });\n Object.defineProperty(Key, 'X', {\n get: Key$X_getInstance\n });\n Object.defineProperty(Key, 'Y', {\n get: Key$Y_getInstance\n });\n Object.defineProperty(Key, 'Z', {\n get: Key$Z_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_0', {\n get: Key$DIGIT_0_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_1', {\n get: Key$DIGIT_1_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_2', {\n get: Key$DIGIT_2_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_3', {\n get: Key$DIGIT_3_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_4', {\n get: Key$DIGIT_4_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_5', {\n get: Key$DIGIT_5_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_6', {\n get: Key$DIGIT_6_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_7', {\n get: Key$DIGIT_7_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_8', {\n get: Key$DIGIT_8_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_9', {\n get: Key$DIGIT_9_getInstance\n });\n Object.defineProperty(Key, 'LEFT_BRACE', {\n get: Key$LEFT_BRACE_getInstance\n });\n Object.defineProperty(Key, 'RIGHT_BRACE', {\n get: Key$RIGHT_BRACE_getInstance\n });\n Object.defineProperty(Key, 'UP', {\n get: Key$UP_getInstance\n });\n Object.defineProperty(Key, 'DOWN', {\n get: Key$DOWN_getInstance\n });\n Object.defineProperty(Key, 'LEFT', {\n get: Key$LEFT_getInstance\n });\n Object.defineProperty(Key, 'RIGHT', {\n get: Key$RIGHT_getInstance\n });\n Object.defineProperty(Key, 'PAGE_UP', {\n get: Key$PAGE_UP_getInstance\n });\n Object.defineProperty(Key, 'PAGE_DOWN', {\n get: Key$PAGE_DOWN_getInstance\n });\n Object.defineProperty(Key, 'ESCAPE', {\n get: Key$ESCAPE_getInstance\n });\n Object.defineProperty(Key, 'ENTER', {\n get: Key$ENTER_getInstance\n });\n Object.defineProperty(Key, 'HOME', {\n get: Key$HOME_getInstance\n });\n Object.defineProperty(Key, 'END', {\n get: Key$END_getInstance\n });\n Object.defineProperty(Key, 'TAB', {\n get: Key$TAB_getInstance\n });\n Object.defineProperty(Key, 'SPACE', {\n get: Key$SPACE_getInstance\n });\n Object.defineProperty(Key, 'INSERT', {\n get: Key$INSERT_getInstance\n });\n Object.defineProperty(Key, 'DELETE', {\n get: Key$DELETE_getInstance\n });\n Object.defineProperty(Key, 'BACKSPACE', {\n get: Key$BACKSPACE_getInstance\n });\n Object.defineProperty(Key, 'EQUALS', {\n get: Key$EQUALS_getInstance\n });\n Object.defineProperty(Key, 'BACK_QUOTE', {\n get: Key$BACK_QUOTE_getInstance\n });\n Object.defineProperty(Key, 'PLUS', {\n get: Key$PLUS_getInstance\n });\n Object.defineProperty(Key, 'MINUS', {\n get: Key$MINUS_getInstance\n });\n Object.defineProperty(Key, 'SLASH', {\n get: Key$SLASH_getInstance\n });\n Object.defineProperty(Key, 'CONTROL', {\n get: Key$CONTROL_getInstance\n });\n Object.defineProperty(Key, 'META', {\n get: Key$META_getInstance\n });\n Object.defineProperty(Key, 'ALT', {\n get: Key$ALT_getInstance\n });\n Object.defineProperty(Key, 'SHIFT', {\n get: Key$SHIFT_getInstance\n });\n Object.defineProperty(Key, 'UNKNOWN', {\n get: Key$UNKNOWN_getInstance\n });\n Object.defineProperty(Key, 'F1', {\n get: Key$F1_getInstance\n });\n Object.defineProperty(Key, 'F2', {\n get: Key$F2_getInstance\n });\n Object.defineProperty(Key, 'F3', {\n get: Key$F3_getInstance\n });\n Object.defineProperty(Key, 'F4', {\n get: Key$F4_getInstance\n });\n Object.defineProperty(Key, 'F5', {\n get: Key$F5_getInstance\n });\n Object.defineProperty(Key, 'F6', {\n get: Key$F6_getInstance\n });\n Object.defineProperty(Key, 'F7', {\n get: Key$F7_getInstance\n });\n Object.defineProperty(Key, 'F8', {\n get: Key$F8_getInstance\n });\n Object.defineProperty(Key, 'F9', {\n get: Key$F9_getInstance\n });\n Object.defineProperty(Key, 'F10', {\n get: Key$F10_getInstance\n });\n Object.defineProperty(Key, 'F11', {\n get: Key$F11_getInstance\n });\n Object.defineProperty(Key, 'F12', {\n get: Key$F12_getInstance\n });\n Object.defineProperty(Key, 'COMMA', {\n get: Key$COMMA_getInstance\n });\n Object.defineProperty(Key, 'PERIOD', {\n get: Key$PERIOD_getInstance\n });\n package$event.Key = Key;\n package$event.KeyEvent_init_l9pgtg$ = KeyEvent_init;\n package$event.KeyEvent_init_79e79$ = KeyEvent_init_0;\n package$event.KeyEvent_init_m5etgt$ = KeyEvent_init_1;\n package$event.KeyEvent = KeyEvent;\n Object.defineProperty(KeyModifiers, 'Companion', {\n get: KeyModifiers$Companion_getInstance\n });\n package$event.KeyModifiers = KeyModifiers;\n package$event.KeyStroke_init_ji7i3y$ = KeyStroke_init;\n package$event.KeyStroke_init_812rgc$ = KeyStroke_init_0;\n package$event.KeyStroke = KeyStroke;\n package$event.KeyStrokeSpec_init_ji7i3y$ = KeyStrokeSpec_init;\n package$event.KeyStrokeSpec_init_luoraj$ = KeyStrokeSpec_init_0;\n package$event.KeyStrokeSpec_init_4t3vif$ = KeyStrokeSpec_init_1;\n package$event.KeyStrokeSpec = KeyStrokeSpec;\n Object.defineProperty(package$event, 'KeyStrokeSpecs', {\n get: KeyStrokeSpecs_getInstance\n });\n Object.defineProperty(ModifierKey, 'CONTROL', {\n get: ModifierKey$CONTROL_getInstance\n });\n Object.defineProperty(ModifierKey, 'ALT', {\n get: ModifierKey$ALT_getInstance\n });\n Object.defineProperty(ModifierKey, 'SHIFT', {\n get: ModifierKey$SHIFT_getInstance\n });\n Object.defineProperty(ModifierKey, 'META', {\n get: ModifierKey$META_getInstance\n });\n package$event.ModifierKey = ModifierKey;\n Object.defineProperty(MouseEvent, 'Companion', {\n get: MouseEvent$Companion_getInstance\n });\n package$event.MouseEvent_init_fbovgd$ = MouseEvent_init;\n package$event.MouseEvent = MouseEvent;\n package$event.MouseEventSource = MouseEventSource;\n Object.defineProperty(MouseEventSpec, 'MOUSE_ENTERED', {\n get: MouseEventSpec$MOUSE_ENTERED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_LEFT', {\n get: MouseEventSpec$MOUSE_LEFT_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_MOVED', {\n get: MouseEventSpec$MOUSE_MOVED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_DRAGGED', {\n get: MouseEventSpec$MOUSE_DRAGGED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_CLICKED', {\n get: MouseEventSpec$MOUSE_CLICKED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_DOUBLE_CLICKED', {\n get: MouseEventSpec$MOUSE_DOUBLE_CLICKED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_PRESSED', {\n get: MouseEventSpec$MOUSE_PRESSED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_RELEASED', {\n get: MouseEventSpec$MOUSE_RELEASED_getInstance\n });\n package$event.MouseEventSpec = MouseEventSpec;\n package$event.PointEvent = PointEvent;\n var package$function = package$base.function || (package$base.function = {});\n package$function.Function = Function;\n Object.defineProperty(package$function, 'Functions', {\n get: Functions_getInstance\n });\n package$function.Runnable = Runnable;\n package$function.Supplier = Supplier;\n package$function.Value = Value;\n var package$gcommon = package$base.gcommon || (package$base.gcommon = {});\n var package$base_0 = package$gcommon.base || (package$gcommon.base = {});\n Object.defineProperty(package$base_0, 'Preconditions', {\n get: Preconditions_getInstance\n });\n Object.defineProperty(package$base_0, 'Strings', {\n get: Strings_getInstance\n });\n Object.defineProperty(package$base_0, 'Throwables', {\n get: Throwables_getInstance\n });\n Object.defineProperty(ClosedRange, 'Companion', {\n get: ClosedRange$Companion_getInstance\n });\n var package$collect = package$gcommon.collect || (package$gcommon.collect = {});\n package$collect.ClosedRange = ClosedRange;\n Object.defineProperty(package$collect, 'Comparables', {\n get: Comparables_getInstance\n });\n package$collect.ComparatorOrdering = ComparatorOrdering;\n Object.defineProperty(package$collect, 'Iterables', {\n get: Iterables_getInstance\n });\n Object.defineProperty(package$collect, 'Lists', {\n get: Lists_getInstance\n });\n Object.defineProperty(Ordering, 'Companion', {\n get: Ordering$Companion_getInstance\n });\n package$collect.Ordering = Ordering;\n Object.defineProperty(package$collect, 'Sets', {\n get: Sets_getInstance\n });\n package$collect.Stack = Stack;\n package$collect.TreeMap = TreeMap;\n Object.defineProperty(DoubleRectangle, 'Companion', {\n get: DoubleRectangle$Companion_getInstance\n });\n var package$geometry = package$base.geometry || (package$base.geometry = {});\n package$geometry.DoubleRectangle_init_6y0v78$ = DoubleRectangle_init;\n package$geometry.DoubleRectangle = DoubleRectangle;\n Object.defineProperty(package$geometry, 'DoubleRectangles', {\n get: DoubleRectangles_getInstance\n });\n package$geometry.DoubleSegment = DoubleSegment;\n Object.defineProperty(DoubleVector, 'Companion', {\n get: DoubleVector$Companion_getInstance\n });\n package$geometry.DoubleVector = DoubleVector;\n package$geometry.Rectangle_init_tjonv8$ = Rectangle_init;\n package$geometry.Rectangle = Rectangle;\n Object.defineProperty(package$geometry, 'Rectangles', {\n get: Rectangles_getInstance\n });\n package$geometry.Segment = Segment;\n Object.defineProperty(Vector, 'Companion', {\n get: Vector$Companion_getInstance\n });\n package$geometry.Vector = Vector;\n var package$jsObject = package$base.jsObject || (package$base.jsObject = {});\n Object.defineProperty(package$jsObject, 'JsObjectSupport', {\n get: JsObjectSupport_getInstance\n });\n var package$json = package$base.json || (package$base.json = {});\n package$json.FluentArray_init = FluentArray_init;\n package$json.FluentArray_init_giv38x$ = FluentArray_init_0;\n package$json.FluentArray = FluentArray;\n package$json.FluentObject_init_bkhwtg$ = FluentObject_init;\n package$json.FluentObject_init = FluentObject_init_0;\n package$json.FluentObject = FluentObject;\n package$json.FluentPrimitive_init_s8ev37$ = FluentPrimitive_init;\n package$json.FluentPrimitive_init_pdl1vj$ = FluentPrimitive_init_0;\n package$json.FluentPrimitive_init_1v8dbw$ = FluentPrimitive_init_1;\n package$json.FluentPrimitive_init_rcaewn$ = FluentPrimitive_init_2;\n package$json.FluentPrimitive = FluentPrimitive;\n package$json.FluentValue = FluentValue;\n package$json.JsonFormatter = JsonFormatter;\n Object.defineProperty(JsonLexer, 'Companion', {\n get: JsonLexer$Companion_getInstance\n });\n package$json.JsonLexer = JsonLexer;\n JsonParser.JsonException = JsonParser$JsonException;\n package$json.JsonParser = JsonParser;\n Object.defineProperty(package$json, 'JsonSupport', {\n get: JsonSupport_getInstance\n });\n Object.defineProperty(Token, 'LEFT_BRACE', {\n get: Token$LEFT_BRACE_getInstance\n });\n Object.defineProperty(Token, 'RIGHT_BRACE', {\n get: Token$RIGHT_BRACE_getInstance\n });\n Object.defineProperty(Token, 'LEFT_BRACKET', {\n get: Token$LEFT_BRACKET_getInstance\n });\n Object.defineProperty(Token, 'RIGHT_BRACKET', {\n get: Token$RIGHT_BRACKET_getInstance\n });\n Object.defineProperty(Token, 'COMMA', {\n get: Token$COMMA_getInstance\n });\n Object.defineProperty(Token, 'COLON', {\n get: Token$COLON_getInstance\n });\n Object.defineProperty(Token, 'STRING', {\n get: Token$STRING_getInstance\n });\n Object.defineProperty(Token, 'NUMBER', {\n get: Token$NUMBER_getInstance\n });\n Object.defineProperty(Token, 'TRUE', {\n get: Token$TRUE_getInstance\n });\n Object.defineProperty(Token, 'FALSE', {\n get: Token$FALSE_getInstance\n });\n Object.defineProperty(Token, 'NULL', {\n get: Token$NULL_getInstance\n });\n package$json.Token = Token;\n Object.defineProperty(package$json, 'SPECIAL_CHARS_8be2vx$', {\n get: function () {\n return SPECIAL_CHARS;\n }\n });\n package$json.escape_pdl1vz$ = escape;\n package$json.unescape_pdl1vz$ = unescape;\n package$json.streamOf_9ma18$ = streamOf;\n package$json.objectsStreamOf_9ma18$ = objectsStreamOf;\n package$json.stringStreamOf_9ma18$ = stringStreamOf;\n package$json.isBoolean_za3rmp$ = isBoolean;\n package$json.isNumber_za3rmp$ = isNumber;\n package$json.isString_za3rmp$ = isString;\n package$json.getAsDouble_za3rmp$ = getAsDouble;\n package$json.getAsInt_s8jyv4$ = getAsInt;\n package$json.getAsBoolean_za3rmp$ = getAsBoolean;\n package$json.containsString_mer726$ = containsString;\n package$json.getAsString_s8jyv4$ = getAsString;\n package$json.parseEnum_xwn52g$ = parseEnum;\n package$json.formatEnum_wbfx10$ = formatEnum;\n package$json.put_tvzjva$ = put;\n package$json.put_5zytao$ = put_0;\n package$json.getNumber_8dq7w5$ = getNumber;\n package$json.getDouble_8dq7w5$ = getDouble;\n package$json.getString_8dq7w5$ = getString;\n package$json.getObj_8dq7w5$ = getObj;\n package$json.getArr_8dq7w5$ = getArr;\n Object.defineProperty(ListMap, 'Companion', {\n get: ListMap$Companion_getInstance\n });\n ListMap.Entry = ListMap$Entry;\n var package$listMap = package$base.listMap || (package$base.listMap = {});\n package$listMap.ListMap = ListMap;\n var package$logging = package$base.logging || (package$base.logging = {});\n package$logging.Logger = Logger;\n package$logging.PrintlnLogger = PrintlnLogger;\n var package$math = package$base.math || (package$base.math = {});\n package$math.toRadians_14dthe$ = toRadians;\n package$math.toDegrees_14dthe$ = toDegrees;\n package$math.round_gpjtzr$ = round_0;\n package$math.ceil_gpjtzr$ = ceil;\n package$math.round_lu1900$ = round_1;\n package$math.ceil_lu1900$ = ceil_0;\n package$math.distance_l3ath1$ = distance;\n package$math.ipow_dqglrj$ = ipow;\n var package$numberFormat = package$base.numberFormat || (package$base.numberFormat = {});\n package$numberFormat.length_s8cxhz$ = length;\n NumberFormat.Spec = NumberFormat$Spec;\n Object.defineProperty(NumberFormat$NumberInfo, 'Companion', {\n get: NumberFormat$NumberInfo$Companion_getInstance\n });\n NumberFormat.NumberInfo_init_hjbnfl$ = NumberFormat$NumberFormat$NumberInfo_init;\n NumberFormat.NumberInfo = NumberFormat$NumberInfo;\n NumberFormat.Output = NumberFormat$Output;\n NumberFormat.FormattedNumber = NumberFormat$FormattedNumber;\n Object.defineProperty(NumberFormat, 'Companion', {\n get: NumberFormat$Companion_getInstance\n });\n package$numberFormat.NumberFormat_init_61zpoe$ = NumberFormat_init;\n package$numberFormat.NumberFormat = NumberFormat;\n var package$observable = package$base.observable || (package$base.observable = {});\n var package$children = package$observable.children || (package$observable.children = {});\n package$children.ChildList = ChildList;\n package$children.ChildProperty = ChildProperty;\n package$children.Position = Position;\n package$children.PositionData = PositionData;\n package$children.SimpleComposite = SimpleComposite;\n var package$collections = package$observable.collections || (package$observable.collections = {});\n package$collections.CollectionAdapter = CollectionAdapter;\n Object.defineProperty(CollectionItemEvent$EventType, 'ADD', {\n get: CollectionItemEvent$EventType$ADD_getInstance\n });\n Object.defineProperty(CollectionItemEvent$EventType, 'SET', {\n get: CollectionItemEvent$EventType$SET_getInstance\n });\n Object.defineProperty(CollectionItemEvent$EventType, 'REMOVE', {\n get: CollectionItemEvent$EventType$REMOVE_getInstance\n });\n CollectionItemEvent.EventType = CollectionItemEvent$EventType;\n package$collections.CollectionItemEvent = CollectionItemEvent;\n package$collections.CollectionListener = CollectionListener;\n package$collections.ObservableCollection = ObservableCollection;\n var package$list = package$collections.list || (package$collections.list = {});\n package$list.AbstractObservableList = AbstractObservableList;\n package$list.ObservableArrayList = ObservableArrayList;\n package$list.ObservableList = ObservableList;\n var package$event_0 = package$observable.event || (package$observable.event = {});\n package$event_0.CompositeEventSource_init_xw2ruy$ = CompositeEventSource_init;\n package$event_0.CompositeEventSource_init_3qo2qg$ = CompositeEventSource_init_0;\n package$event_0.CompositeEventSource = CompositeEventSource;\n package$event_0.EventHandler = EventHandler;\n package$event_0.EventSource = EventSource;\n Object.defineProperty(package$event_0, 'EventSources', {\n get: EventSources_getInstance\n });\n package$event_0.ListenerCaller = ListenerCaller;\n package$event_0.ListenerEvent = ListenerEvent;\n package$event_0.Listeners = Listeners;\n package$event_0.MappingEventSource = MappingEventSource;\n var package$property = package$observable.property || (package$observable.property = {});\n package$property.BaseReadableProperty = BaseReadableProperty;\n package$property.DelayedValueProperty = DelayedValueProperty;\n package$property.Property = Property;\n Object.defineProperty(package$property, 'PropertyBinding', {\n get: PropertyBinding_getInstance\n });\n package$property.PropertyChangeEvent = PropertyChangeEvent;\n package$property.ReadableProperty = ReadableProperty;\n package$property.ValueProperty = ValueProperty;\n package$property.WritableProperty = WritableProperty;\n var package$random = package$base.random || (package$base.random = {});\n package$random.RandomGaussian = RandomGaussian;\n Object.defineProperty(package$random, 'RandomString', {\n get: RandomString_getInstance\n });\n var package$registration = package$base.registration || (package$base.registration = {});\n package$registration.CompositeRegistration = CompositeRegistration;\n package$registration.Disposable = Disposable;\n Object.defineProperty(Registration, 'Companion', {\n get: Registration$Companion_getInstance\n });\n package$registration.Registration = Registration;\n var package$throwableHandlers = package$registration.throwableHandlers || (package$registration.throwableHandlers = {});\n package$throwableHandlers.ThrowableHandler = ThrowableHandler;\n Object.defineProperty(package$throwableHandlers, 'ThrowableHandlers', {\n get: ThrowableHandlers_getInstance\n });\n var package$spatial = package$base.spatial || (package$base.spatial = {});\n Object.defineProperty(package$spatial, 'EARTH_RADIUS', {\n get: function () {\n return EARTH_RADIUS;\n }\n });\n Object.defineProperty(package$spatial, 'MIN_LONGITUDE', {\n get: function () {\n return MIN_LONGITUDE;\n }\n });\n Object.defineProperty(package$spatial, 'MAX_LONGITUDE', {\n get: function () {\n return MAX_LONGITUDE;\n }\n });\n Object.defineProperty(package$spatial, 'FULL_LONGITUDE', {\n get: function () {\n return FULL_LONGITUDE;\n }\n });\n Object.defineProperty(package$spatial, 'MIN_LATITUDE', {\n get: function () {\n return MIN_LATITUDE;\n }\n });\n Object.defineProperty(package$spatial, 'MAX_LATITUDE', {\n get: function () {\n return MAX_LATITUDE;\n }\n });\n Object.defineProperty(package$spatial, 'FULL_LATITUDE', {\n get: function () {\n return FULL_LATITUDE;\n }\n });\n package$spatial.get_start_cawtq0$ = get_start;\n package$spatial.get_end_cawtq0$ = get_end;\n Object.defineProperty(GeoBoundingBoxCalculator, 'Companion', {\n get: GeoBoundingBoxCalculator$Companion_getInstance\n });\n package$spatial.GeoBoundingBoxCalculator = GeoBoundingBoxCalculator;\n package$spatial.makeSegments_8o5yvy$ = makeSegments;\n package$spatial.geoRectsBBox_wfabpm$ = geoRectsBBox;\n package$spatial.pointsBBox_2r9fhj$ = pointsBBox;\n package$spatial.union_86o20w$ = union;\n Object.defineProperty(package$spatial, 'GeoJson', {\n get: GeoJson_getInstance\n });\n package$spatial.GeoRectangle = GeoRectangle;\n package$spatial.LonLat = LonLat;\n Object.defineProperty(package$spatial, 'EARTH_RECT', {\n get: function () {\n return EARTH_RECT;\n }\n });\n package$spatial.limitLon_14dthe$ = limitLon;\n package$spatial.limitLat_14dthe$ = limitLat;\n package$spatial.normalizeLon_14dthe$ = normalizeLon;\n Object.defineProperty(package$spatial, 'BBOX_CALCULATOR', {\n get: function () {\n return BBOX_CALCULATOR;\n }\n });\n package$spatial.convertToGeoRectangle_i3vl8m$ = convertToGeoRectangle;\n package$spatial.calculateQuadKeys_h9hod0$ = calculateQuadKeys;\n Object.defineProperty(LongitudeSegment, 'Companion', {\n get: LongitudeSegment$Companion_getInstance\n });\n package$spatial.LongitudeSegment = LongitudeSegment;\n Object.defineProperty(package$spatial, 'MercatorUtils', {\n get: MercatorUtils_getInstance\n });\n package$spatial.QuadKey = QuadKey;\n package$spatial.computeRect_c2pv3p$ = computeRect;\n package$spatial.computeRect_v4gkf3$ = computeRect_0;\n package$spatial.projectRect_cub2h3$ = projectRect;\n package$spatial.zoom_c2pv3p$ = zoom;\n package$spatial.computeOrigin_v4gkf3$ = computeOrigin;\n package$spatial.projectOrigin_cub2h3$ = projectOrigin;\n package$spatial.calulateQuadsCount_za3lpa$ = calulateQuadsCount;\n package$spatial.calculateQuadKeys_a35lcs$ = calculateQuadKeys_0;\n package$spatial.xyToKey_qt1dr2$ = xyToKey;\n SimpleFeature.prototype.GeometryConsumer = SimpleFeature$GeometryConsumer;\n SimpleFeature.prototype.Consumer = SimpleFeature$Consumer;\n Object.defineProperty(SimpleFeature$GeometryType, 'POINT', {\n get: SimpleFeature$GeometryType$POINT_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'LINE_STRING', {\n get: SimpleFeature$GeometryType$LINE_STRING_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'POLYGON', {\n get: SimpleFeature$GeometryType$POLYGON_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'MULTI_POINT', {\n get: SimpleFeature$GeometryType$MULTI_POINT_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'MULTI_LINE_STRING', {\n get: SimpleFeature$GeometryType$MULTI_LINE_STRING_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'MULTI_POLYGON', {\n get: SimpleFeature$GeometryType$MULTI_POLYGON_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'GEOMETRY_COLLECTION', {\n get: SimpleFeature$GeometryType$GEOMETRY_COLLECTION_getInstance\n });\n SimpleFeature.prototype.GeometryType = SimpleFeature$GeometryType;\n Object.defineProperty(package$spatial, 'SimpleFeature', {\n get: SimpleFeature_getInstance\n });\n Object.defineProperty(StringFormat$FormatType, 'NUMBER_FORMAT', {\n get: StringFormat$FormatType$NUMBER_FORMAT_getInstance\n });\n Object.defineProperty(StringFormat$FormatType, 'STRING_FORMAT', {\n get: StringFormat$FormatType$STRING_FORMAT_getInstance\n });\n StringFormat.FormatType = StringFormat$FormatType;\n Object.defineProperty(StringFormat, 'Companion', {\n get: StringFormat$Companion_getInstance\n });\n var package$stringFormat = package$base.stringFormat || (package$base.stringFormat = {});\n package$stringFormat.StringFormat = StringFormat;\n var package$typedGeometry = package$base.typedGeometry || (package$base.typedGeometry = {});\n package$typedGeometry.AbstractGeometryList = AbstractGeometryList;\n package$typedGeometry.isClockwise_hv912c$ = isClockwise_0;\n package$typedGeometry.createMultiPolygon_hv912c$ = createMultiPolygon;\n package$typedGeometry.boundingBox_gyuce3$ = boundingBox;\n package$typedGeometry.Generic = Generic;\n package$typedGeometry.reinterpret_q42o9k$ = reinterpret;\n package$typedGeometry.reinterpret_dr0qel$ = reinterpret_0;\n package$typedGeometry.reinterpret_2z483p$ = reinterpret_1;\n package$typedGeometry.reinterpret_typ3lq$ = reinterpret_2;\n package$typedGeometry.reinterpret_sux9xa$ = reinterpret_3;\n package$typedGeometry.reinterpret_dg847r$ = reinterpret_4;\n package$typedGeometry.get_bottom_h9e6jg$ = get_bottom;\n package$typedGeometry.get_right_h9e6jg$ = get_right;\n package$typedGeometry.get_height_h9e6jg$ = get_height;\n package$typedGeometry.get_width_h9e6jg$ = get_width;\n package$typedGeometry.get_top_h9e6jg$ = get_top;\n package$typedGeometry.get_left_h9e6jg$ = get_left;\n package$typedGeometry.get_scalarBottom_xdjzag$ = get_scalarBottom;\n package$typedGeometry.get_scalarRight_xdjzag$ = get_scalarRight;\n package$typedGeometry.get_scalarHeight_xdjzag$ = get_scalarHeight;\n package$typedGeometry.get_scalarWidth_xdjzag$ = get_scalarWidth;\n package$typedGeometry.get_scalarTop_xdjzag$ = get_scalarTop;\n package$typedGeometry.get_scalarLeft_xdjzag$ = get_scalarLeft;\n package$typedGeometry.get_center_xdjzag$ = get_center;\n package$typedGeometry.get_scalarX_xocuba$ = get_scalarX;\n package$typedGeometry.get_scalarY_xocuba$ = get_scalarY;\n package$typedGeometry.plus_cg1mpz$ = plus_4;\n package$typedGeometry.minus_cg1mpz$ = minus;\n package$typedGeometry.times_cg1mpz$ = times;\n package$typedGeometry.div_cg1mpz$ = div;\n package$typedGeometry.times_4nb5xq$ = times_0;\n package$typedGeometry.div_4nb5xq$ = div_0;\n package$typedGeometry.unaryMinus_e0pgg$ = unaryMinus;\n package$typedGeometry.transform_nj6yk8$ = transform;\n package$typedGeometry.plus_qnxb21$ = plus_5;\n package$typedGeometry.minus_qnxb21$ = minus_0;\n package$typedGeometry.times_qnxb21$ = times_1;\n package$typedGeometry.div_qnxb21$ = div_1;\n package$typedGeometry.div_i3tdhk$ = div_2;\n package$typedGeometry.times_i3tdhk$ = times_2;\n package$typedGeometry.unaryMinus_cr59ze$ = unaryMinus_0;\n package$typedGeometry.compareTo_85q7fw$ = compareTo;\n package$typedGeometry.newSpanRectangle_2d1svq$ = newSpanRectangle;\n package$typedGeometry.limit_106pae$ = limit;\n package$typedGeometry.contains_h8bixx$ = contains_1;\n package$typedGeometry.intersects_32samh$ = intersects;\n package$typedGeometry.xRange_h9e6jg$ = xRange;\n package$typedGeometry.yRange_h9e6jg$ = yRange;\n package$typedGeometry.limit_lddjmn$ = limit_0;\n Object.defineProperty(GeometryType, 'MULTI_POINT', {\n get: GeometryType$MULTI_POINT_getInstance\n });\n Object.defineProperty(GeometryType, 'MULTI_LINESTRING', {\n get: GeometryType$MULTI_LINESTRING_getInstance\n });\n Object.defineProperty(GeometryType, 'MULTI_POLYGON', {\n get: GeometryType$MULTI_POLYGON_getInstance\n });\n package$typedGeometry.GeometryType = GeometryType;\n Object.defineProperty(Geometry, 'Companion', {\n get: Geometry$Companion_getInstance\n });\n package$typedGeometry.Geometry = Geometry;\n package$typedGeometry.LineString = LineString;\n package$typedGeometry.MultiLineString = MultiLineString;\n package$typedGeometry.MultiPoint = MultiPoint;\n package$typedGeometry.MultiPolygon = MultiPolygon;\n package$typedGeometry.Polygon = Polygon;\n package$typedGeometry.Rect_init_94ua8u$ = Rect_init;\n package$typedGeometry.Rect = Rect;\n package$typedGeometry.Ring = Ring;\n package$typedGeometry.Scalar = Scalar;\n package$typedGeometry.Vec_init_vrm8gm$ = Vec_init;\n package$typedGeometry.Vec = Vec;\n package$typedGeometry.explicitVec_y7b45i$ = explicitVec;\n package$typedGeometry.explicitVec_vrm8gm$ = explicitVec_0;\n package$typedGeometry.newVec_4xl464$ = newVec;\n var package$typedKey = package$base.typedKey || (package$base.typedKey = {});\n package$typedKey.TypedKey = TypedKey;\n package$typedKey.TypedKeyHashMap = TypedKeyHashMap;\n var package$unsupported = package$base.unsupported || (package$base.unsupported = {});\n package$unsupported.UNSUPPORTED = UNSUPPORTED;\n package$unsupported.UNSUPPORTED_61zpoe$ = UNSUPPORTED_0;\n Object.defineProperty(Color, 'Companion', {\n get: Color$Companion_getInstance\n });\n var package$values = package$base.values || (package$base.values = {});\n package$values.Color = Color;\n Object.defineProperty(package$values, 'Colors', {\n get: Colors_getInstance\n });\n package$values.toPngDataUri_61zpoe$ = toPngDataUri;\n package$values.Font = Font;\n Object.defineProperty(FontFamily, 'Companion', {\n get: FontFamily$Companion_getInstance\n });\n package$values.FontFamily = FontFamily;\n package$values.HSV = HSV;\n package$values.Interval = Interval;\n package$values.Pair = Pair_0;\n package$values.SomeFig = SomeFig;\n Object.defineProperty(package$logging, 'PortableLogging', {\n get: PortableLogging_getInstance\n });\n SPECIAL_CHARS = mapOf([to(toBoxedChar(34), toBoxedChar(34)), to(toBoxedChar(92), toBoxedChar(92)), to(toBoxedChar(47), toBoxedChar(47)), to(toBoxedChar(98), toBoxedChar(8)), to(toBoxedChar(102), toBoxedChar(12)), to(toBoxedChar(110), toBoxedChar(10)), to(toBoxedChar(114), toBoxedChar(13)), to(toBoxedChar(116), toBoxedChar(9))]);\n var $receiver = until(0, 32);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(toBoxedChar(toChar(item)));\n }\n CONTROL_CHARS = toSet(destination);\n EARTH_RADIUS = 6378137.0;\n MIN_LONGITUDE = -180.0;\n MAX_LONGITUDE = 180.0;\n FULL_LONGITUDE = MAX_LONGITUDE - MIN_LONGITUDE;\n MIN_LATITUDE = -90.0;\n MAX_LATITUDE = 90.0;\n FULL_LATITUDE = MAX_LATITUDE - MIN_LATITUDE;\n EARTH_RECT = Rect_init(MIN_LONGITUDE, MIN_LATITUDE, FULL_LONGITUDE, FULL_LATITUDE);\n BBOX_CALCULATOR = new GeoBoundingBoxCalculator(EARTH_RECT, true, false);\n Kotlin.defineModule('lets-plot-base-portable', _);\n return _;\n}));\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9MZXRzUGxvdC8uL2tvdG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ICAgICAgdmFsIGVuZCA9IGdldEVuZEluc3RhbnQodHpEdC55ZWFyKVxuICAgICAgICAgICAgcmV0dXJuIGlmIChpbnN0YW50ID4gc3RhcnQgJiYgaW5zdGFudCA8IGVuZCkge1xuICAgICAgICAgICAgICAgIG15U3VtbWVyVHoudG9EYXRlVGltZShpbnN0YW50KVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0ekR0XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gdG9JbnN0YW50KGRhdGVUaW1lOiBEYXRlVGltZSk6IEluc3RhbnQge1xuICAgICAgICAgICAgdmFsIHN0YXJ0RHQgPSB0b0RhdGVUaW1lKGdldFN0YXJ0SW5zdGFudChkYXRlVGltZS55ZWFyKSlcbiAgICAgICAgICAgIHZhbCBlbmREdCA9IHRvRGF0ZVRpbWUoZ2V0RW5kSW5zdGFudChkYXRlVGltZS55ZWFyKSlcblxuICAgICAgICAgICAgcmV0dXJuIGlmIChkYXRlVGltZSA+IHN0YXJ0RHQgJiYgZGF0ZVRpbWUgPCBlbmREdCkge1xuICAgICAgICAgICAgICAgIG15U3VtbWVyVHoudG9JbnN0YW50KGRhdGVUaW1lKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBteVR6LnRvSW5zdGFudChkYXRlVGltZSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByb3RlY3RlZCBhYnN0cmFjdCBmdW4gZ2V0U3RhcnRJbnN0YW50KHllYXI6IEludCk6IEluc3RhbnRcblxuICAgICAgICBwcm90ZWN0ZWQgYWJzdHJhY3QgZnVuIGdldEVuZEluc3RhbnQoeWVhcjogSW50KTogSW5zdGFudFxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgMjAxMC0yMDE4IEpldEJyYWlucyBzLnIuby4gYW5kIEtvdGxpbiBQcm9ncmFtbWluZyBMYW5ndWFn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lQXJyYXkubGFzdEluZGV4T2YoZWxlbWVudDogQnl0ZSk6IEludCB7XG4gICAgZm9yIChpbmRleCBpbiBpbmRpY2VzLnJldmVyc2VkKCkpIHtcbiAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgbGFzdCBpbmRleCBvZiBbZWxlbWVudF0sIG9yIC0xIGlmIHRoZSBhcnJheSBkb2VzIG5vdCBjb250YWluIGVsZW1lbnQuXG4gKi9cbnB1YmxpYyBmdW4gU2hvcnRBcnJheS5sYXN0SW5kZXhPZihlbGVtZW50OiBTaG9ydCk6IEludCB7XG4gICAgZm9yIChpbmRleCBpbiBpbmRpY2VzLnJldmVyc2VkKCkpIHtcbiAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgbGFzdCBpbmRleCBvZiBbZWxlbWVudF0sIG9yIC0xIGlmIHRoZSBhcnJheSBkb2VzIG5vdCBjb250YWluIGVsZW1lbnQuXG4gKi9cbnB1YmxpYyBmdW4gSW50QXJyYXkubGFzdEluZGV4T2YoZWxlbWVudDogSW50KTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMucmV2ZXJzZWQoKSkge1xuICAgICAgICBpZiAoZWxlbWVudCA9PSB0aGlzW2luZGV4XSkge1xuICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIC0xXG59XG5cbi8qKlxuICogUmV0dXJucyBsYXN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZW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GZWJcIixcbiAgICAgICAgTW9udGguTUFSQ0ggdG8gXCJNYXJcIixcbiAgICAgICAgTW9udGguQVBSSUwgdG8gXCJBcHJcIixcbiAgICAgICAgTW9udGguTUFZIHRvIFwiTWF5XCIsXG4gICAgICAgIE1vbnRoLkpVTkUgdG8gXCJKdW5cIixcbiAgICAgICAgTW9udGguSlVMWSB0byBcIkp1bFwiLFxuICAgICAgICBNb250aC5BVUdVU1QgdG8gXCJBdWdcIixcbiAgICAgICAgTW9udGguU0VQVEVNQkVSIHRvIFwiU2VwXCIsXG4gICAgICAgIE1vbnRoLk9DVE9CRVIgdG8gXCJPY3RcIixcbiAgICAgICAgTW9udGguTk9WRU1CRVIgdG8gXCJOb3ZcIixcbiAgICAgICAgTW9udGguREVDRU1CRVIgdG8gXCJEZWNcIlxuICAgIClcblxuICAgIHZhbCBtb250aEZ1bGwgPSBtYXBPZihcbiAgICAgICAgTW9udGguSkFOVUFSWSB0byBcIkphbnVhcnlcIixcbiAgICAgICAgTW9udGguRkVCUlVBUlkgdG8gXCJGZWJydWFyeVwiLFxuICAgICAgICBNb250aC5NQVJDSCB0byBcIk1hcmNoXCIsXG4gICAgICAgIE1vbnRoLkFQUklMIHRvIFwiQXByaWxcIixcbiAgICAgICAgTW9udGguTUFZIHRvIFwiTWF5XCIsXG4gICAgICAgIE1vbnRoLkpVTkUgdG8gXCJKdW5lXCIsXG4gICAgICAgIE1vbnRoLkpVTFkgdG8gXCJKdWx5XCIsXG4gICAgICAgIE1vbnRoLkFVR1VTVCB0byBcIkF1Z3VzdFwiLFxuICAgICAgICBNb250aC5TRVBURU1CRVIgdG8gXCJTZXB0ZW1iZXJcIixcbiAgICAgICAgTW9udGguT0NUT0JFUiB0byBcIk9jdG9iZXJcIixcbiAgICAgICAgTW9udGguTk9WRU1CRVIgdG8gXCJOb3ZlbWJlclwiLFxuICAgICAgICBNb250aC5ERUNFTUJFUiB0byBcIkRlY2VtYmVyXCJcbiAgICApXG59IiwiLypcbiAqIENvc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ICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC5qb2luVG9TdHJpbmcoXCJcIikgeyBpdC5leGVjKERhdGVUaW1lKERhdGUuRVBPQ0gsIHRpbWUpKSB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgZnVuIHBhcnNlKHN0cjogU3RyaW5nKTogTGlzdDxTcGVjUGFydD4ge1xuICAgICAgICAgICAgdmFsIHJlc3VsdCA9IG11dGFibGVMaXN0T2Y8U3BlY1BhcnQ+KClcbiAgICAgICAgICAgIHZhbCByZXN1bHRTZXF1ZW5jZSA9IFBhdHRlcm4uUEFUVEVSTl9SRUdFWC5maW5kQWxsKHN0cilcbiAgICAgICAgICAgIHZhciBsYXN0SW5kZXggPSAwXG4gICAgICAgICAgICByZXN1bHRTZXF1ZW5jZS5mb3JFYWNoIHtcbiAgICAgICAgICAgICAgICB2YWwgdmFsdWUgPSBpdC52YWx1ZVxuICAgICAgICAgICAgICAgIHZhbCByYW5nZSA9IGl0LnJhbmdlXG4gICAgICAgICAgICAgICAgdmFsIHN0YXJ0SW5kZXggPSByYW5nZS5maXJzdFxuICAgICAgICAgICAgICAgIHZhbCBlbmRJbmRleCA9IHJhbmdlLmxhc3RcbiAgICAgICAgICAgICAgICBpZiAoc3RhcnRJbmRleCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHNwZWMgPSBTcGVjUGFydChzdHIuc3Vic3RyaW5nKGxhc3RJbmRleCB1bnRpbCBzdGFydEluZGV4KSlcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LmFkZChzcGVjKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXN1bHQuYWRkKFBhdHRlcm5TcGVjUGFydCh2YWx1ZSkpXG4gICAgICAgICAgICAgICAgbGFzdEluZGV4ID0gZW5kSW5kZXggKyAxXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChsYXN0SW5kZXggPCBzdHIub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aW5nID0gdmFsdWUudG9TdHJpbmcoKS5wYWRTdGFydChsZW5ndGgsICcwJylcblxuICAgICAgICBwcml2YXRlIGZ1biBnZXRIb3VyczEyKGRhdGVUaW1lOiBEYXRlVGltZSk6IEludCB7XG4gICAgICAgICAgICB2YWwgaG91cnMgPSBkYXRlVGltZS5ob3Vyc1xuICAgICAgICAgICAgcmV0dXJuIHdoZW4ge1xuICAgICAgICAgICAgICAgIGhvdXJzID09IDAgLT4gMTJcbiAgICAgICAgICAgICAgICBob3VycyA8PSAxMiAtPiBob3Vyc1xuICAgICAgICAgICAgICAgIGVsc2UgLT4gaG91cnMgLSAxMlxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZ2V0SG91cnMyNChkYXRlVGltZTogRGF0ZVRpbWUpOiBJbnQgPVxuICAgICAgICAgICAgd2hlbihkYXRlVGltZS5ob3Vycykge1xuICAgICAgICAgICAgICAgIDAgLT4gMjRcbiAgICAgICAgICAgICAgICBlbHNlIC0+IGRhdGVUaW1lLmhvdXJzXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZ2V0TWVyaWRpYW4oZGF0ZVRpbWU6IERhdGVUaW1lKTogU3RyaW5nIHtcbiAgICAgICAgICAgIHZhbCBob3VycyA9IGRhdGVUaW1lLmhvdXJzXG4gICAgICAgICAgICByZXR1cm4gd2hlbiB7XG4gICAgICAgICAgICAgICAgaG91cnMgPT0gMjQgLT4gXCJhbVwiXG4gICAgICAgICAgICAgICAgaG91cnMgPD0gMTIgLT4gXCJhbVwiXG4gICAgICAgICAgICAgICAgZWxzZSAtPiBcInBtXCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGdldFdlZWtEYXlOdW1iZXIoZGF0ZVRpbWU6IERhdGVUaW1lKTogU3RyaW5nIHtcbiAgICAgICAgICAgIHZhciBudW0gPSBkYXRlVGltZS53ZWVrR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G4gICAgICAgIHZhciBzdGFydCA9IDBcbiAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgIHZhbCBlbmQgPSBtaW5PZihzdGFydCArIDE2LCBtaW4pXG4gICAgICAgICAgICB2YXIgczEgPSB0aGlzLnN1YnN0cmluZyhzdGFydCwgZW5kKVxuICAgICAgICAgICAgdmFyIHMyID0gb3RoZXIuc3Vic3RyaW5nKHN0YXJ0LCBlbmQpXG4gICAgICAgICAgICBpZiAoczEgIT0gczIpIHtcbiAgICAgICAgICAgICAgICBzMSA9IHMxLnVwcGVyY2FzZSgpXG4gICAgICAgICAgICAgICAgczIgPSBzMi51cHBlcmNhc2UoKVxuICAgICAgICAgICAgICAgIGlmIChzMSAhPSBzMikge1xuICAgICAgICAgICAgICAgICAgICBzMSA9IHMxLmxvd2VyY2FzZSgpXG4gICAgICAgICAgICAgICAgICAgIHMyID0gczIubG93ZXJjYXNlKClcbiAgICAgICAgICAgICAgICAgICAgaWYgKHMxICE9IHMyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gczEuY29tcGFyZVRvKHMyKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGVuZCA9PSBtaW4pIGJyZWFrXG4gICAgICAgICAgICBzdGFydCA9IGVuZFxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBuMSAtIG4yXG4gICAgfSBlbHNlIHtcbiAgICAgICAgcmV0dXJuIGNvbXBhcmVUbyhvdGhlcilcbiAgICB9XG59XG5cbi8qKlxuICogUmV0dXJucyBgdHJ1ZWAgaWYgdGhlIGNvbnRlbnRzIG9mIHRoaXMgY2hhciBzZXF1ZW5jZSBhcmUgZXF1YWwgdG8gdGhlIGNvbnRlbnRzIG9mIHRoZSBzcGVjaWZpZWQgW290aGVyXSxcbiAqIGkuZS4gYm90aCBjaGFyIHNlcXVlbmNlcyBjb250YWluIHRoZSBzYW1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RBWVNfSU5fWUVBUlxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHJlc3VsdCArIGRheXNGcm9tWWVhclN0YXJ0KCkgLSBkYXRlLmRheXNGcm9tWWVhclN0YXJ0KClcbiAgICB9XG5cbiAgICBmdW4gZGF5c0Zyb21ZZWFyU3RhcnQoKTogSW50IHtcbiAgICAgICAgdmFyIHJlc3VsdCA9IGRheVxuICAgICAgICB2YXIgY3VycmVudCA9IG1vbnRoLnByZXYoKVxuICAgICAgICB3aGlsZSAoY3VycmVudCAhPSBudWxsKSB7XG4gICAgICAgICAgICByZXN1bHQgKz0gY3VycmVudC5nZXREYXlzSW5ZZWFyKHllYXIpXG4gICAgICAgICAgICBjdXJyZW50ID0gY3VycmVudC5wcmV2KClcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgfVxuXG4gICAgZnVuIGFkZERheXMoZGF5czogSW50KTogRGF0ZSB7XG4gICAgICAgIEBTdXBwcmVzcyhcIk5BTUVfU0hBRE9XSU5HXCIpXG4gICAgICAgIHZhciBkYXlzID0gZGF5c1xuICAgICAgICBpZiAoZGF5cyA8IDApIHtcbiAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGRheXMgPT0gMCkgcmV0dXJuIHRoaXNcblxuICAgICAgICB2YXIgZGF5ID0gdGhpcy5kYXlcbiAgICAgICAgdmFyIG1vbnRoID0gdGhpcy5tb250aFxuICAgICAgICB2YXIgeWVhciA9IHRoaXMueWVhclxuICAgICAgICB2YXIgbGVzc1RoYW5ZZWFyID0gZmFsc2VcblxuICAgICAgICBpZiAoZGF5cyA+PSBDQUNIRV9EQVlTICYmIHllYXIgPT0gRVBPQ0gueWVhcikge1xuICAgICAgICAgICAgeWVhciA9IENBQ0hFX1NUQU1QLnllYXJcbiAgICAgICAgICAgIG1vbnRoID0gQ0FDSEVfU1RBTVAubW9udGhcbiAgICAgICAgICAgIGRheSA9IENBQ0hFX1NUQU1QLmRheVxuICAgICAgICAgICAgZGF5cyAtPSBDQUNIRV9EQVlTXG4gICAgICAgIH1cblxuICAgICAgICB3aGlsZSAoZGF5cyA+IDApIHtcbiAgICAgICAgICAgIHZhbCBkYXlzVG9OZXh0TW9udGggPSBtb250aC5nZXREYXlzSW5ZZWFyKHllYXIpIC0gZGF5ICsgMVxuICAgICAgICAgICAgaWYgKGRheXMgPCBkYXlzVG9OZXh0TW9udGgpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gRGF0ZShkYXkgKyBkYXlzLCBtb250aCwgeWVhcilcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKGxlc3NUaGFuWWVhcikge1xuICAgICAgICAgICAgICAgICAgICBtb250aCA9IG1vbnRoLm5leHQoKSEhXG4gICAgICAgICAgICAgICAgICAgIGRheSA9IDFcbiAgICAgICAgICAgICAgICAgICAgZGF5cyAtPSBkYXlzVG9OZXh0TW9udGhcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB2YWwgZGF5c1RvTmV4dFllYXIgPSBsYXN0RGF5T2YoeWVhcikuZGF5c0Zyb20oRGF0ZShkYXksIG1vbnRoLCB5ZWFyKSkgKyAxXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXlzID49IGRheXNUb05leHRZZWFyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkYXkgPSAxXG4gICAgICAgICAgICAgICAgICAgICAgICBtb250aCA9IE1vbnRoLkpBTlVBUllcbiAgICAgICAgICAgICAgICAgICAgICAgIHllYXIgKz0gMVxuICAgICAgICAgICAgICAgICAgICAgICAgZGF5cyAtPSBkYXlzVG9OZXh0WWVhclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbW9udGggPSBtb250aC5uZXh0KCkhIVxuICAgICAgICAgICAgICAgICAgICAgICAgZGF5ID0gMVxuICAgICAgICAgICAgICAgICAgICAgICAgZGF5cyAtPSBkYXlzVG9OZXh0TW9udGhcbiAgICAgICAgICAgICAgICAgICAgICAgIGxlc3NUaGFuWWVhciA9IHRydWVcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBEYXRlKGRheSwgbW9udGgsIHllYXIpXG4gICAgfVxuXG4gICAgZnVuIG5leHREYXRlKCk6IERhdGUge1xuICAgICAgICByZXR1cm4gYWRkRGF5cygxKVxuICAgIH1cblxuICAgIGZ1biBwcmV2RGF0ZSgpOiBEYXRlIHtcbiAgICAgICAgcmV0dXJuIHN1YnRyYWN0RGF5cygxKVxuICAgIH1cblxuICAgIGZ1biBzdWJ0cmFjdERheXMoZGF5czogSW50KTogRGF0ZSB7XG4gICAgICAgIGlmIChkYXlzIDwgMCkge1xuICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoZGF5cyA9PSAwKSByZXR1cm4gdGhpc1xuXG4gICAgICAgIGlmIChkYXlzIDwgZGF5KSB7XG4gICAgICAgICAgICByZXR1cm4gRGF0ZShkYXkgLSBkYXlzLCBtb250aCwgeWVhcilcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHZhbCBkYXlzVG9QcmV2WWVhciA9IGRheXNGcm9tKGZpcnN0RGF5T2YoeWVhcikpXG4gICAgICAgICAgICByZXR1cm4gaWYgKGRheXMgPiBkYXlzVG9QcmV2WWVhcikge1xuICAgICAgICAgICAgICAgIGxhc3REYXlPZih5ZWFyIC0gMSkuc3VidHJhY3REYXlzKGRheXMgLSBkYXlzVG9QcmV2WWVhciAtIDEpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxhc3REYXlPZih5ZWFyLCBtb250aC5wcmV2KCkhISkuc3VidHJhY3REYXlzKGRheXMgLSBkYXkpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gY29tcGFyZVRvKG90aGVyOiBEYXRlKTogSW50IHtcbiAgICAgICAgaWYgKHllYXIgIT0gb3RoZXIueWVhcikgcmV0dXJuIHllYXIgLSBvdGhlci55ZWFyXG4gICAgICAgIHJldHVybiBpZiAobW9udGgub3JkaW5hbCgpICE9IG90aGVyLm1vbnRoLm9yZGluYWwoKSkgbW9udGgub3JkaW5hbCgpIC0gb3RoZXIubW9udGgub3JkaW5hbCgpIGVsc2UgZGF5IC0gb3RoZXIuZGF5XG5cbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gZXF1YWxzKG90aGVyOiBBbnk/KTogQm9vbGVhbiB7XG4gICAgICAgIGlmIChvdGhlciAhaXMgRGF0ZSkgcmV0dXJuIGZhbHNlXG5cbiAgICAgICAgdmFsIGRhdGUgPSBvdGhlciBhcyBEYXRlP1xuICAgICAgICByZXR1cm4gZGF0ZSEhLnllYXIgPT0geWVhciAmJlxuICAgICAgICAgICAgICAgIGRhdGUubW9udGggPT09IG1vbnRoICYmXG4gICAgICAgICAgICAgICAgZGF0ZS5kYXkgPT0gZGF5XG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGhhc2hDb2RlKCk6IEludCB7XG4gICAgICAgIHJldHVybiB5ZWFyICogMjM5ICsgbW9udGguaGFzaENvZGUoKSAqIDMxICsgZGF5XG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIHRvU3RyaW5nKCk6IFN0cmluZyB7XG4gICAgICAgIHZhbCByZXN1bHQgPSBTdHJpbmdCdWlsZGVyKClcbiAgICAgICAgcmVzdWx0LmFwcGVuZCh5ZWFyKVxuICAgICAgICBhcHBlbmRNb250aChyZXN1bHQpXG4gICAgICAgIGFwcGVuZERheShyZXN1bHQpXG4gICAgICAgIHJldHVybiByZXN1bHQudG9TdHJpbmcoK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AgICAgcHJpdmF0ZSB2YWwgQ0FDSEVfREFZUyA9IENBQ0hFX1NUQU1QLmRheXNGcm9tKEVQT0NIKVxuXG4gICAgICAgIGZ1biBwYXJzZShzdHI6IFN0cmluZyk6IERhdGUge1xuICAgICAgICAgICAgaWYgKHN0ci5sZW5ndGggIT0gOCkge1xuICAgICAgICAgICAgICAgIHRocm93IFJ1bnRpbWVFeGNlcHRpb24oKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgeWVhciA9IHN0ci5zdWJzdHJpbmcoMCwgNCkudG9JbnQoKVxuICAgICAgICAgICAgdmFsIG1vbnRoID0gc3RyLnN1YnN0cmluZyg0LCA2KS50b0ludCgpXG4gICAgICAgICAgICB2YWwgZGF5ID0gc3RyLnN1YnN0cmluZyg2LCA4KS50b0ludCgpXG4gICAgICAgICAgICByZXR1cm4gRGF0ZShkYXksIE1vbnRoLnZhbHVlcygpW21vbnRoIC0gMV0sIHllYXIpXG4gICAgICAgIH1cblxuICAgICAgICBASnZtT3ZlcmxvYWRzXG4gICAgICAgIGZ1biBmaXJzdERheU9mKHllYXI6IEludCwgbW9udGg6IE1vbnRoID0gTW9udGguSkFOVUFSWSk6IERhdGUge1xuICAgICAgICAgICAgcmV0dXJuIERhdGUoMSwgbW9udGgsIHllYXIpXG4gICAgICAgIH1cblxuICAgICAgICBASnZtT3ZlcmxvYWRzXG4gICAgICAgIGZ1biBsYXN0RGF5T2YoeWVhcjogSW50LCBtb250aDogTW9udGggPSBNb250aC5ERUNFTUJFUik6IERhdGUge1xuICAgICAgICAgICAgcmV0dXJuIERhdGUobW9udGguZGF5cywgbW9udGgsIHllYXIpXG4gICAgICAgIH1cbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgTUlUIGxpY2Vuc2UgdGhhdCB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ltZSgyNCwgMClcblxuICAgICAgICBmdW4gcGFyc2UoczogU3RyaW5nKTogVGltZSB7XG4gICAgICAgICAgICBpZiAocy5sZW5ndGggPCA2KSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIGhvdXJzID0gcy5zdWJzdHJpbmcoMCwgMikudG9JbnQoKVxuICAgICAgICAgICAgdmFsIG1pbnV0ZXMgPSBzLnN1YnN0cmluZygyLCA0KS50b0ludCgpXG4gICAgICAgICAgICB2YWwgc2Vjb25kcyA9IHMuc3Vic3RyaW5nKDQsIDYpLnRvSW50KClcblxuICAgICAgICAgICAgcmV0dXJuIFRpbWUoaG91cnMsIG1pbnV0ZXMsIHNlY29uZHMpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZnJvbVByZXR0eUhNU3RyaW5nKHRpbWU6IFN0cmluZyk6IFRpbWUge1xuICAgICAgICAgICAgaWYgKCF0aW1lLmNvbnRhaW5zKERFTElNSVRFUiArIFwiXCIpKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhbCBsZW5ndGggPSB0aW1lLmxlbmd0aFxuICAgICAgICAgICAgaWYgKGxlbmd0aCAhPSA1ICYmIGxlbmd0aCAhPSA0KSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhbCBob3VyTGVuZ3RoID0gaWYgKGxlbmd0aCA9PSA0KSAxIGVsc2UgMlxuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gVGltZShcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpbWUuc3Vic3RyaW5nKDAsIGhvdXJMZW5ndGgpLn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GltZUV4Y2VwdGlvbigpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBASnZtT3ZlcmxvYWRzXG4gICAgZnVuIGZpcnN0KHdlZWtEYXk6IFdlZWtEYXksIG1vbnRoOiBNb250aCwgbnVtYmVyOiBJbnQgPSAxKTogRGF0ZVNwZWMge1xuICAgICAgICByZXR1cm4gb2JqZWN0IDogRGF0ZVNwZWMge1xuXG4gICAgICAgICAgICBvdmVycmlkZSB2YWwgclJ1bGU6IFN0cmluZ1xuICAgICAgICAgICAgICAgIGdldCgpID0gXCJSUlVMRTpGUkVRPVlFQVJMWTtCWURBWT1cIiArIG51bWJlciArIHdlZWtEYXkuYWJicmV2aWF0aW9uICsgXCI7QllNT05USD1cIiArIChtb250aC5vcmRpbmFsKCkgKyAxKVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gZ2V0RGF0ZSh5ZWFyOiBJbnQpOiBEYXRlIHtcbiAgICAgICAgICAgICAgICB2YWwgc3RhcnREYXkgPSAobnVtYmVyIC0gMSkgKiBXZWVrRGF5LnZhbHVlcygpLnNpemUgKyAxXG4gICAgICAgICAgICAgICAgdmFsIGRheXMgPSBtb250aC5nZXREYXlzSW5ZZWFyKHllYXIpXG4gICAgICAgICAgICAgICAgZm9yIChkIGluIHN0YXJ0RGF5Li5kYXlzKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBkYXRlID0gRGF0ZShkLCBtb250aCwgeWVhcilcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGUud2Vla0RheSA9PT0gd2Vla0RheSkgcmV0dXJuIGRhdGVcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhyb3cgUnVudGltZUV4Y2VwdGlvbigpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpc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FRcbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjAuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGNhbiBiZSBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlLlxuICovXG5cbnBhY2thZ2UgamV0YnJhaW5zLmRhdGFsb3JlLmJhc2UuZXZlbnRcblxuXG5vcGVuIGNsYXNzIEV2ZW50IHtcbiAgICBwcml2YXRlIHZhciBldmVudENvbnRleHQ6IEV2ZW50Q29udGV4dD8gPSBudWxsXG4gICAgICAgIHNldChldmVudENvbnRleHQpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLmV2ZW50Q29udGV4dCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cga290bGluLklsbGVnYWxTdGF0ZUV4Y2VwdGlvbihcIkFscmVhZHkgc2V0IFwiICsgdGhpcy5ldmVudENvbnRleHQhISlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChpc0NvbnN1bWVkKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKFwiQ2FuJ3Qgc2V0IGEgY29udGV4dCB0byB0aGUgY29uc3VtZWQgZXZlbnRcIilcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChldmVudENvbnRleHQgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcIkNhbid0IHNldCBudWxsIGNvbnRleHRcIilcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGZpZWxkID0gZXZlbnRDb250ZXh0XG4gICAgICAgIH1cbiAgICB2YXIgaXNDb25zdW1lZDogQm9vbGVhbiA9IGZhbHNlXG4gICAgICAgIHByaXZhdGUgc2V0XG5cbiAgICBmdW4gY29uc3VtZ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BJbnQgPSBjdXJyZW50U3RhcnRJbmRleFxuICAgICAgICB2YXIgbmV4dEl0ZW06IEludFJhbmdlPyA9IG51bGxcbiAgICAgICAgdmFyIGNvdW50ZXI6IEludCA9IDBcblxuICAgICAgICBwcml2YXRlIGZ1biBjYWxjTmV4dCgpIHtcbiAgICAgICAgICAgIGlmIChuZXh0U2VhcmNoSW5kZXggPCAwKSB7XG4gICAgICAgICAgICAgICAgbmV4dFN0YXRlID0gMFxuICAgICAgICAgICAgICAgIG5leHRJdGVtID0gbnVsbFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAobGltaXQgPiAwICYmICsrY291bnRlciA+PSBsaW1pdCB8fCBuZXh0U2VhcmNoSW5kZXggPiBpbnB1dC5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgbmV4dEl0ZW0gPSBjdXJyZW50U3RhcnRJbmRleC4uaW5wdXQubGFzdEluZGV4XG4gICAgICAgICAgICAgICAgICAgIG5leHRTZWFyY2hJbmRleCA9IC0xXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIG1hdGNoID0gaW5wdXQuZ2V0TmV4dE1hdGNoKG5leHRTZWFyY2hJbmRleClcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1hdGNoID09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5leHRJdGVtID0gY3VycmVudFN0YXJ0SW5kZXguLmlucHV0Lmxhc3RJbmRleFxuICAgICAgICAgICAgICAgICAgICAgICAgbmV4dFNlYXJjaEluZGV4ID0gLTFcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCAoaW5kZXgsIGxlbmd0aCkgPSBtYXRjaFxuICAgICAgICAgICAgICAgICAgICAgICAgbmV4dEl0ZW0gPSBjdXJyZW50U3RhcnRJbmRleCB1bnRpbCBpbmRleFxuICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudFN0YXJ0SW5kZXggPSBpbmRleCArIGxlbmd0aFxuICAgICAgICAgICAgICAgICAgICAgICAgbmV4dFNlYXJjaEluZGV4ID0gY3VycmVudFN0YXJ0SW5kZXggKyBpZiAobGVuZ3RoID09IDApIDEgZWxzZSAwXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbmV4dFN0YXRlID0gMVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIG5leHQoKTogSW50UmFuZ2Uge1xuICAgICAgICAgICAgaWYgKG5leHRTdGF0ZSA9PSAtMSlcbiAgICAgICAgICAgICAgICBjYWxjTmV4dCgpXG4gICAgICAgICAgICBpZiAobmV4dFN0YXRlID09IDApXG4gICAgICAgICAgICAgICAgdGhyb3cgTm9TdWNoRWxlbWVudEV4Y2VwdGlvbigpXG4gICAgICAgICAgICB2YWwgcmVzdWx0ID0gbmV4dEl0ZW0gYXMgSW50UmFuZ2VcbiAgICAgICAgICAgIC8vIENsZWFuIG5leHQgdG8gYXZvaWQga2VlcGluZyByZWZlcmVuY2Ugb24geWllbGRlZCBpbnN0YW5jZVxuICAgICAgICAgICAgbmV4dEl0ZW0gPSBudWxsXG4gICAgICAgICAgICBuZXh0U3RhdGUgPSAtMVxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhhc05leHQoKTogQm9vbGVhbiB7XG4gICAgICAgICAgICBpZiAobmV4dFN0YXRlID09IC0xKVxuICAgICAgICAgICAgICAgIGNhbGNOZXh0KClcbiAgICAgICAgICAgIHJldHVybiBuZXh0U3RhdGUgPT0gMVxuICAgICAgICB9XG4gICAgfVxufVxuXG4vKipcbiAqIFJldHVybnMgYSBzZXF1ZW5jZSBvZiBpbmRleCByYW5nZXMgb2Ygc3Vic3RyaW5ncyBpbiB0aGlz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cGFyYWJsZTxUPj4gc2luZ2xldG9uKHY6IFQpOiBDbG9zZWRSYW5nZTxUPiB7XG4gICAgICAgICAgICByZXR1cm4gQ2xvc2VkUmFuZ2UodiwgdilcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biA8VCA6IENvbXBhcmFibGU8VD4+IGVuY2xvc2VBbGwodmFsdWVzOiBJdGVyYWJsZTxUPz4pOiBDbG9zZWRSYW5nZTxUPiB7XG4gICAgICAgICAgICB2YXIgaXRlcmF0ZWQgPSBmYWxzZVxuICAgICAgICAgICAgdmFyIG1pbjogVD8gPSBudWxsXG4gICAgICAgICAgICB2YXIgbWF4OiBUPyA9IG51bGxcbiAgICAgICAgICAgIGZvciAodjogVD8gaW4gdmFsdWVzKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFpdGVyYXRlZCkge1xuICAgICAgICAgICAgICAgICAgICBpdGVyYXRlZCA9IHRydWVcbiAgICAgICAgICAgICAgICAgICAgbWluID0gdlxuICAgICAgICAgICAgICAgICAgICBtYXggPSB2XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbWluID0gbWluKG1pbiEhLCB2ISEpXG4gICAgICAgICAgICAgICAgICAgIG1heCA9IG1heChtYXghISwgdilcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIWl0ZXJhdGVkKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgTm9TdWNoRWxlbWVudEV4Y2VwdGlvbigpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gQ2xvc2VkUmFuZ2U8VD4obWluISEsIG1heCEhKVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOSBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgTUlUIGxpY2Vuc2UgdGhhdC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GdldCgpID0gb3JpZ2luLmFkZChkaW1lbnNpb24ubXVsKDAuNSkpXG5cbiAgICB2YWwgbGVmdDogRG91YmxlXG4gICAgICAgIGdldCgpID0gb3JpZ2luLnhcblxuICAgIHZhbCByaWdodDogRG91YmxlXG4gICAgICAgIGdldCgpID0gb3JpZ2luLnggKyBkaW1lbnNpb24ueFxuXG4gICAgdmFsIHRvcDogRG91YmxlXG4gICAgICAgIGdldCgpID0gb3JpZ2luLnlcblxuICAgIHZhbCBib3R0b206IERvdWJsZVxuICAgICAgICBnZXQoKSA9IG9yaWdpbi55ICsgZGltZW5zaW9uLnlcblxuICAgIHZhbCB3aWR0aDogRG91YmxlXG4gICAgICAgIGdldCgpID0gZGltZW5zaW9uLnhcblxuICAgIHZhbCBoZWlnaHQ6IERvdWJsZVxuICAgICAgICBnZXQoKSA9IGRpbWVuc2lvbi55XG5cbiAgICB2YWwgcGFydHM6IEl0ZXJhYmxlPERvdWJsZVNlZ21lbnQ+XG4gICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgIHZhbCByZXN1bHQgPSBBcnJheUxpc3Q8RG91YmxlU2VnbWVudD4oKVxuICAgICAgICAgICAgcmVzdWx0LmFkZChEb3VibGVTZWdtZW50KG9yaWdpbiwgb3JpZ2luLmFkZChEb3VibGVWZWN0b3IoZGltZW5zaW9uLngsIDAuMCkpKSlcbiAgICAgICAgICAgIHJlc3VsdC5hZGQoRG91YmxlU2VnbWVudChvcmlnaW4sIG9yaWdpbi5hZGQoRG91YmxlVmVjdG9yKDAuMCwgZGltZW5zaW9uLnkpKSkpXG4gICAgICAgICAgICByZXN1bHQuYWRkKERvdWJsZVNlZ21lbnQob3JpZ2luLmFkZChkaW1lbnNpb24pLCBvcmlnaW4uYWRkKERvdWJsZVZlY3RvcihkaW1lbnNpb24ueCwgMC4wKSkpKVxuICAgICAgICAgICAgcmVzdWx0LmFkZChEb3VibGVTZWdtZW50KG9yaWdpbi5hZGQoZGltZW5zaW9uKSwgb3JpZ2luLm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lcblxuICAgIH1cblxuICAgIGZ1biBhZGQodjogRG91YmxlVmVjdG9yKTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgcmV0dXJuIERvdWJsZVJlY3RhbmdsZShvcmlnaW4uYWRkKHYpLCBkaW1lbnNpb24pXG4gICAgfVxuXG4gICAgZnVuIHN1YnRyYWN0KHY6IERvdWJsZVZlY3Rvcik6IERvdWJsZVJlY3RhbmdsZSB7XG4gICAgICAgIHJldHVybiBEb3VibGVSZWN0YW5nbGUob3JpZ2luLnN1YnRyYWN0KHYpLCBkaW1lbnNpb24pXG4gICAgfVxuXG4gICAgZnVuIGRpc3RhbmNlKHRvOiBEb3VibGVWZWN0b3IpOiBEb3VibGUge1xuICAgICAgICB2YXIgcmVzdWx0ID0gMC4wXG4gICAgICAgIHZhciBoYXNSZXN1bHQgPSBmYWxzZVxuICAgICAgICBmb3IgKHMgaW4gcGFydHMpIHtcbiAgICAgICAgICAgIGlmICghaGFzUmVzdWx0KSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gcy5kaXN0YW5jZSh0bylcbiAgICAgICAgICAgICAgICBoYXNSZXN1bHQgPSB0cnVlXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHZhbCBkaXN0YW5jZSA9IHMuZGlzdGFuY2UodG8pXG4gICAgICAgICAgICAgICAgaWYgKGRpc3RhbmNlIDwgcmVzdWx0KSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IGRpc3RhbmNlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gaGFzaENvZGUoKTogSW50IHtcbiAgICAgICAgcmV0dXJuIG9yaWdpbi5oYXNoQ29kZSgpICogMzEgKyBkaW1lbnNpb24uaGFzaENvZGUoKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBlcXVhbH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pbmdCb3gocG9pbnRzOiBJdGVyYWJsZTxEb3VibGVWZWN0b3I+KTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgcmV0dXJuIGNhbGN1bGF0ZUJvdW5kaW5nQm94KHBvaW50cywgRG91YmxlVmVjdG9yOjp4LCBEb3VibGVWZWN0b3I6OnkpXG4gICAgICAgIHsgbWluWCwgbWluWSwgbWF4WCwgbWF4WSAtPlxuICAgICAgICAgICAgRG91YmxlUmVjdGFuZ2xlLnNwYW4oXG4gICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKG1pblgsIG1pblkpLFxuICAgICAgICAgICAgICAgIERvdWJsZVZlY3RvcihtYXhYLCBtYXhZKVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuIDxQb2ludFQsIEJveFQ+IGNhbGN1bGF0ZUJvdW5kaW5nQm94KFxuICAgICAgICBwb2ludHM6IEl0ZXJhYmxlPFBvaW50VD4sXG4gICAgICAgIGdldFg6IChQb2ludFQpIC0+IERvdWJsZSxcbiAgICAgICAgZ2V0WTogKFBvaW50VCkgLT4gRG91YmxlLFxuICAgICAgICBmYWN0b3J5OiAobWluWDogRG91YmxlLCBtaW5ZOiBEb3VibGUsIG1heFg6IERvdWJsZSwgbWF4WTogRG91YmxlKSAtPiBCb3hUXG4gICAgKTogQm94VCB7XG4gICAgICAgIHZhbCBmaXJzdCA9IHBvaW50cy5pdGVyYXRvcigpLm5leHQoKVxuICAgICAgICB2YXIgbWluTG9uID0gZ2V0WChmaXJzdClcbiAgICAgICAgdmFyIG1pbkxhdCA9IGdldFkoZmlyc3QpXG4gICAgICAgIHZhciBtYXhMb24gPSBtaW5Mb25cbiAgICAgICAgdmFyIG1heExhdCA9IG1pbkxhdFxuXG4gICAgICAgIGZvciAocG9pbnQgaW4gcG9pbnRzKSB7XG4gICAgICAgICAgICBtaW5Mb24gPSBtaW4obWluTG9uLCBnZXRYKHBvaW50KSlcbiAgICAgICAgICAgIG1heEx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LmVzY2FwZVxuXG5vYmplY3QgSnNPYmplY3RTdXBwb3J0IHtcbiAgICBmdW4gbWFwVG9Kc09iamVjdEluaXRpYWxpemVyKG1hcDogTWFwPFN0cmluZywgKj4pOiBTdHJpbmcge1xuICAgICAgICB2YWwgYnVmZmVyID0gU3RyaW5nQnVpbGRlcigpXG5cbiAgICAgICAgdmFyIGhhbmRsZVZhbHVlOiAodjogQW55PykgLT4gVW5pdCA9IHt9XG4gICAgICAgIHZhbCBoYW5kbGVMaXN0ID0geyBsaXN0OiBMaXN0PCo+IC0+XG4gICAgICAgICAgICBidWZmZXIuYXBwZW5kKCdbJylcbiAgICAgICAgICAgIHZhciBmaXJzdCA9IHRydWVcbiAgICAgICAgICAgIGZvciAodiBpbiBsaXN0KSB7XG4gICAgICAgICAgICAgICAgaWYgKCFmaXJzdCkgYnVmZmVyLmFwcGVuZCgnLCcpIGVsc2UgZmlyc3QgPSBmYWxzZVxuICAgICAgICAgICAgICAgIGhhbmRsZVZhbHVlKHYpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBidWZmZXIuYXBwZW5kKCddJylcbiAgICAgICAgfVxuICAgICAgICBAU3VwcHJlc3MoXCJOQU1FX1NIQURPV0lOR1wiKVxuICAgICAgICB2YWwgaGFuZGxlTWFwID0geyBtYXA6IE1hcDwqLCAqPiAtPlxuICAgICAgICAgICAgYnVmZmVyLmFwcGVuZCgneycpXG4gICAgICAgICAgICB2YXIgZmlyc3QgPSB0cnVlXG4gICAgICAgICAgICBmb3IgKChrLCB2KSBpbiBtYXApIHtcbiAgICAgICAgICAgICAgICBrIGFzPyBTdHJpbmcgPzogdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFxuICAgICAgICAgICAgICAgICAgICBcIk9ubHkgYHN0cmluZ2Aga2V5cyBhcmUgc3VwcG9ydGVkLCB3YXM6ICR7ayEhOjpjbGFzcy5zaW1wbGVOYW1lID86IFwibm8gY2xhc3MgbmFtZVwifVwiXG4gICAgICA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cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBnZXRFeGlzdGluZ1N0cmluZyhrZXk6IFN0cmluZywgcHJvY2Vzc29yOiAoU3RyaW5nKSAtPiBVbml0KSA9IGFwcGx5IHtcbiAgICAgICAgaWYgKGNvbnRhaW5zTm90TnVsbChrZXkpKSB7XG4gICAgICAgICAgICBnZXRTdHJpbmcoa2V5LCBwcm9jZXNzb3IpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gZm9yRXhpc3RpbmdTdHJpbmdzKGtleTogU3RyaW5nLCBwcm9jZXNzb3I6IChTdHJpbmcpIC0+IFVuaXQpID0gYXBwbHkge1xuICAgICAgICBpZiAoY29udGFpbnNOb3ROdWxsKGtleSkpIHtcbiAgICAgICAgICAgIGZvclN0cmluZ3Moa2V5KSB7IHByb2Nlc3NvcihpdCEhKSB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gZ2V0RXhpc3RpbmdPYmplY3Qoa2V5OiBTdHJpbmcsIHByb2Nlc3NvcjogKEZsdWVudE9iamVjdCkgLT4gVW5pdCkgPSBhcHBseSB7XG4gICAgICAgIGlmIChjb250YWluc05vdE51bGwoa2V5KSkge1xuICAgICAgICAgICAgdmFsIG9iaiA9IGdldE9iamVjdChrZXkpXG4gICAgICAgICAgICBpZiAob2JqLm15T2JqLmtleXMuaXNOb3RFbXB0eSgpKSB7XG4gICAgICAgICAgICAgICAgcHJvY2Vzc29yKG9iailcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBnZXRFeGlzdGluZ0FycmF5KGtleTogU3RyaW5nLCBwcm9jZXNzb3I6IChGbHVlbnRBcnJheSkgLT4gVW5pdCkgPSBhcHBseSB7XG4gICAgICAgIGlmIChjb250YWluc05vdE51bGwoa2V5KSkge1xuICAgICAgICAgICAgcHJvY2Vzc29yKGdldEFycmF5KGtleSkpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gZm9yT2J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AgICAgICAgICBjdXJyZW50Q2hhciA9PSAnZicgLT4gVG9rZW4uRkFMU0UuYWxzbyB7IHJlYWQoXCJmYWxzZVwiKSB9XG4gICAgICAgICAgICBjdXJyZW50Q2hhciA9PSAnbicgLT4gVG9rZW4uTlVMTC5hbHNvIHsgcmVhZChcIm51bGxcIikgfVxuICAgICAgICAgICAgY3VycmVudENoYXIgPT0gJ1wiJyAtPiBUb2tlbi5TVFJJTkcuYWxzbyB7IHJlYWRTdHJpbmcoKSB9XG4gICAgICAgICAgICByZWFkTnVtYmVyKCkgLT4gVG9rZW4uTlVNQkVSXG4gICAgICAgICAgICBlbHNlIC0+IGVycm9yKFwiJGk6JHtjdXJyZW50Q2hhcn0gLSB1bmtvd24gdG9rZW5cIilcbiAgICAgICAgfS5hbHNvIHsgY3VycmVudFRva2VuID0gaXQgfVxuICAgIH1cblxuICAgIGZ1biB0b2tlblZhbHVlKCkgPSBpbnB1dC5zdWJzdHJpbmcodG9rZW5TdGFydCwgaSlcblxuICAgIHByaXZhdGUgZnVuIHJlYWRTdHJpbmcoKSB7XG4gICAgICAgIHN0YXJ0VG9rZW4oKVxuICAgICAgICBhZHZhbmNlKCkgLy8gb3BlbmluZyBxdW90ZVxuICAgICAgICB3aGlsZSghKGN1cnJlbnRDaGFyID09ICdcIicpKSB7XG4gICAgICAgICAgICBpZihjdXJyZW50Q2hhciA9PSAnXFxcXCcpIHtcbiAgICAgICAgICAgICAgICBhZHZhbmNlKClcbiAgICAgICAgICAgICAgICB3aGVuIHtcbiAgICAgICAgICAgICAgICAgICAgY3VycmVudENoYXIgPT0gJ3UnIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGFkdmFuY2UoKVxuICAgICAgICAgICAgICAgICAgICAgICAgcmVwZWF0KDQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKGN1cnJlbnRDaGFyLmlzSGV4KCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkdmFuY2UoKVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRDaGFyIGluIFNQRUNJQUxfQ0hBUlMgLT4gYWR2YW5jZSgpXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgLT4gZXJyb3IoXCJJbnZhbGlkIGVzY2FwZSBzZXF1ZW5jZVwiKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgYWR2YW5jZSgpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgYWR2YW5jZSgpIC8vIGNsb3NpbmcgcXVvdGVcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biByZWFkTnVtYmVyKCk6IEJvb2xlYW4ge1xuICAgICAgICBpZiAoIShjdXJyZW50Q2hhci5pc0RpZ2l0KCkgfHwgY3VycmVudENoYXIgPT0gJy0nKSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlXG4gICAgICAgIH1cblxuICAgICAgICBzdGFydFRva2VuKClcbiAgICAgICAgYWR2YW5jZUlmQ3VycmVudCgnLScpXG4gICAgICAgIGFkdmFuY2VXaGlsZSB7IGl0LmlzRGlnaXQoKSB9XG5cbiAgICAgICAgYWR2YW5jZUlmQ3VycmVudCgnLicpIHtcbiAgICAgICAgICAgIHJlcXVpcmUoY3VycmVudENoYXIuaXNEaWdpdCgpKSB7IFwiTnVtYmVyIHNob3VsZCBoYXZlIGRlY2ltYWwgcGFydFwiIH1cbiAgICAgICAgICAgIGFkdmFuY2VXaGlsZSB7IGl0LmlzRGlnaXQoKSB9XG4gICAgICAgIH1cblxuICAgICAgICBhZHZhbmNlSWZDdXJyZW50KCdlJywgJ0UnKSB7XG4gICAgICAgICAgICBhZHZhbmNlSWZDdXJyZW50KCcrJywgJy0nKVxuICAgICAgICAgICAgYWR2YW5jZVdoaWxlIHsgaXQuaXNEaWdpdCgpIH1cbi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4ZXIubmV4dFRva2VuKClcblxuICAgICAgICByZXR1cm4gbGlzdFxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHBhcnNlT2JqZWN0KGxleGVyOiBKc29uTGV4ZXIpOiBNYXA8U3RyaW5nLCBBbnk/PiB7XG4gICAgICAgIGZ1biBjaGVja0N1cnJlbnRUb2tlbih0b2tlbjogVG9rZW4pIHsgcmVxdWlyZShsZXhlci5jdXJyZW50VG9rZW4sIHRva2VuLCBcIltPYmpdIFwiKSB9XG5cbiAgICAgICAgdmFsIG1hcCA9IG11dGFibGVNYXBPZjxTdHJpbmcsIEFueT8+KClcblxuICAgICAgICBjaGVja0N1cnJlbnRUb2tlbihUb2tlbi5MRUZUX0JSQUNFKVxuICAgICAgICBsZXhlci5uZXh0VG9rZW4oKVxuXG4gICAgICAgIHdoaWxlIChsZXhlci5jdXJyZW50VG9rZW4gIT0gVG9rZW4uUklHSFRfQlJBQ0UpIHtcbiAgICAgICAgICAgIGlmIChtYXAuaXNOb3RFbXB0eSgpKSB7XG4gICAgICAgICAgICAgICAgY2hlY2tDdXJyZW50VG9rZW4oVG9rZW4uQ09NTUEpXG4gICAgICAgICAgICAgICAgbGV4ZXIubmV4dFRva2VuKClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY2hlY2tDdXJyZW50VG9rZW4oVG9rZW4uU1RSSU5HKVxuICAgICAgICAgICAgdmFsIGtleSA9IGxleGVyLnRva2VuVmFsdWUoKS51bmVzY2FwZSgpXG4gICAgICAgICAgICBsZXhlci5uZXh0VG9rZW4oKVxuXG4gICAgICAgICAgICBjaGVja0N1cnJlbnRUb2tlbihUb2tlbi5DT0xPTilcbiAgICAgICAgICAgIGxleGVyLm5leHRUb2tlbigpXG5cbiAgICAgICAgICAgIHZhbCB2YWx1ZSA9IHBhcnNlVmFsdWUobGV4ZXIpXG4gICAgICAgICAgICBtYXBba2V5XSA9IHZhbHVlXG4gICAgICAgIH1cblxuICAgICAgICBjaGVja0N1cnJlbnRU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gICAvLyBKc29uTnVsbCBjb3VudHMgYXMgZW1wdHkgYXJyYXlcbi8vICAgIGZ1biBjb250YWluc0FycmF5KG9iajogSnNvbk9iamVjdCwga2V5OiBTdHJpbmcpOiBCb29sZWFuIHtcbi8vICAgICAgICB2YWwgYXJyID0gb2JqW2tleV1cbi8vICAgICAgICByZXR1cm4gYXJyIGlzIEpzb25OdWxsIHx8IGFyciBpcyBKc29uQXJyYXlcbi8vICAgIH1cbi8vXG4vLyAgICAvLyBKc29uTnVsbCAtPiBlbXB0eSBhcnJheVxuLy8gICAgZnVuIGdldEFycihvYmo6IEpzb25PYmplY3QsIGtleTogU3RyaW5nKTogSnNvbkFycmF5IHtcbi8vICAgICAgICB2YWwgYXJyID0gb2JqW2tleV1cbi8vICAgICAgICBpZiAoYXJyIGlzIEpzb25OdWxsKSB7XG4vLyAgICAgICAgICAgIHJldHVybiBKc29uQXJyYXkoKVxuLy8gICAgICAgIH0gZWxzZSBpZiAoYXJyIGlzIEpzb25BcnJheSkge1xuLy8gICAgICAgICAgICByZXR1cm4gYXJyIGFzIEpzb25BcnJheVxuLy8gICAgICAgIH1cbi8vXG4vLyAgICAgICAgdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKFwiSnNvbk9iamVjdCBkb2VzIG5vdCBjb250YWluIGFycmF5OiAka2V5XCIpXG4vLyAgICB9XG4vL1xuLy8gICAgZnVuIHJlYWREb3VibGUoYXJyYXk6IEpzb25BcnJheSwgaW5kZXg6IEludCk6IERvdWJsZSB7XG4vLyAgICAgICAgcmV0dXJuIGFycmF5LmdldERvdWJsZShpbmRleClcbi8vICAgIH1cbi8vXG4vLyAgICBmdW4gZ2V0T3B0aW9uYWwob2JqOiBKc29uT2JqZWN0LCBrZXk6IFN0cmluZyk6IE9wdGlvbmFsPEFueT4ge1xuLy8gICAgICAgIHJldHVybiBpZiAoIW9iai5nZXRLZXlzKCkuY29udGFpbnMoa2V5KSkge1xuLy8gICAgICAgICAgICBPcHRpb25hbC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15RGF0YVtpbmRleCArIDFdXG4gICAgICAgICAgICByZW1vdmVBdChpbmRleClcbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIlVOQ0hFQ0tFRF9DQVNUXCIpXG4gICAgICAgICAgICByZXR1cm4gdmFsdWUgYXMgVj9cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4ga2V5U2V0KCk6IE11dGFibGVTZXQ8Sz4ge1xuICAgICAgICByZXR1cm4gb2JqZWN0IDogQWJzdHJhY3RNdXRhYmxlU2V0PEs+KCkge1xuICAgICAgICAgICAgb3ZlcnJpZGUgdmFsIHNpemU6IEludFxuICAgICAgICAgICAgICAgIGdldCgpID0gdGhpc0BMaXN0TWFwLnNpemUoKVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gYWRkKGVsZW1lbnQ6IEspOiBCb29sZWFuIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oXCJOb3QgYXZhaWxhYmxlIGluIGtleVNldFwiKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gaXRlcmF0b3IoKTogTXV0YWJsZUl0ZXJhdG9yPEs+IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbWFwSXRlcmF0b3Iob2JqZWN0IDogSXRlcmF0b3JTcGVjIHtcbiAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGUgb3BlcmF0b3IgZnVuIGdldChpbmRleDogSW50KTogQW55PyB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbXlEYXRhW2luZGV4XVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biB2YWx1ZXMoKTogQ29sbGVjdGlvbjxWPz4ge1xuICAgICAgICByZXR1cm4gb2JqZWN0IDogQWJzdHJhY3RDb2xsZWN0aW9uPFY/PigpIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIHZhbCBzaXplOiBJbnRcbiAgICAgICAgICAgICAgICBnZXQoKSA9IHRoaXNATGlzdE1hcC5zaXplKClcblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGl0ZXJhdG9yKCk6IEl0ZXJhdG9yPFY/PiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG1hcEl0ZXJhdG9yKG9iamVjdCA6IEl0ZXJhdG9yU3BlYyB7XG4gICAgICAgICAgICAgICAgICAgIG92ZXJyaWRlIG9wZXJhdG9yIGZ1biBnZXQoaW5kZXg6IEludCk6IEFueT8ge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG15RGF0YVtpbmRleCArIDFdXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuIGVudHJ5U2V0KCk6IFNldDxFbnRyeT4ge1xuICAgICAgICByZXR1cm4gb2JqZWN0IDogQWJzdHJhY3RTZXQ8RW50cnk+KCkge1xuICAgICAgICAgICAgb3ZlcnJpZGUgdmFsIHNpemU6IEludFxuICAgICAgICAgICAgICAgIGdldCgpID0gdGhpc0BMaXN0TWFwLnNpemUoKVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gaXRlcmF0b3IoKTogSXRlcmF0b3I8TGlzdE1hcDxLLCBWPi5FbnRyeT4ge1xuICAgICAgICAgICAgICAgIHJldHVybiBtYXBJdGVyYXRvcihvYmplY3QgOiBJdGVyYXRvclNwZWMge1xuICAgICAgICAgICAgICAgICAgICBvdmVycmlkZSBvcGVyYXRvciBmdW4gZ2V0KGluZGV4OiBJbnQpOiBBbnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVudHJ5KGluZGV4KVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBzaXplKCk6IEludCB7XG4gICAgICAgIHJldHVybiBteURhdGEuc2l6ZSAvIDJcbiAgICB9XG5cbiAgICBmdW4gcHV0KGtleTogSywgdmFsdWU6IFY/KTogVj8ge1xuICAgICAgICB2YWwgaW5kZXggPSBmaW5kQnlLZXkoa2V5KVxuICAgICAgICBpZiAoaW5kZXggPj0gMCkge1xuICAgICAgICAgICAgdmFsIG9sZFZhbHVlID0gbXlEYXRhW2luZGV4ICsgMV1cbiAgICAgICAgICAgIG15RGF0YVtpbmRleCArIDFdID0gdmFsdWVcbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIlVOQ0hFQ0tFRF9DQVNUXCIpXG4gICAgICAgICAgICByZXR1cm4gb2xkVmFsdWUgYXMgVj9cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBuZXdBcnJheSA9IEFycmF5KG15RGF0YS5zaXplICsgMikgeyBpIC0+XG4gICAgICAgICAgICBpZiAoaSA8IG15RGF0YS5zaXplKSBteURhdGFbaV0gZWxzZSBudWxsXG4gICAgICAgIH1cblxuICAgICAgICBuZXdBcnJheVtteURhdGEuc2l6ZV0gPSBrZXlcbiAgICAgICAgbmV3QXJyYXlbbXlEYXRhLnNpemUgKyAxXSA9IHZhbHVlXG4gICAgICAgIG15RGF0YSA9IG5ld0FycmF5XG4gICAgICAgIHJldHVybiBudWxsXG4gICAgfVxuXG4gICAgb3BlcmF0b3IgZnVuIGdldChrZXk6IEspOiBWPyB7XG4gICAgICAgIHZhbCBpbmRleCA9IGZpbmRCeUtleShrZXkpXG4gICAgICAgIHJldHVybiBpZiAoaW5kZXggPT0gLTEpIHtcbiAgICAgICAgICAgIG51bGxcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIlVOQ0hFQ0tFRF9DQVNUXCIpXG4gICAgICAgICAgICBteURhdGFbaW5kZXggKyAxXSBhcyBWP1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIHRvU3RyaW5nKCk6IFN0cmluZyB7XG4gICAgICAgIHZhbCBidWlsZGVyID0gU3RyaW5nQnVpbGRlcigpXG4gICAgICAgIGJ1aWxkZXIuYXBwZW5kKFwie1wiKVxuICAgICAgICB2YXIgaSA9IDBcbiAgICAgICAgd2hpbGUgKGkgPCBteURhdGEuc2l6ZSkge1xuICAgICAgICAgICAgdmFsIGsgPSBteURhdGFbaV1cbiAgICAgICAgICAgIHZhbCB2ID0gbXlEYXRhW2kgKyAxXVxuICAgICAgICAgICAgaWYgKGkgIT0gMCkge1xuICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKFwiLFwiKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoaykuYXBwZW5kKFwiPVwiKS5hcHBlbmQodilcbiAgICAgICAgICAgIGkgKz0gMlxuICAgICAgICB9XG4gICAgICAgIGJ1aWxkZXIuYXBwZW5kKFwifVwiKVxuXG4gICAgICAgIHJldHVybiBidWlsZGVyLnRvU3RyaW5nKClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biA8VD4gbWFwSXRlcmF0b3Ioc3BlYzogSXRlcmF0b3JTcGVjKTogTXV0YWJsZUl0ZXJhdG9yPFQ+IHtcbiAgICAgICAgcmV0dXJuIG9iamVjdCA6IE11dGFibGVJdGVyYXRvcjxUPiB7XG4gICAgICAgICAgICBwcml2YXRlIHZhciBpbmRleCA9IDBcbiAgICAgICAgICAgIHByaXZhdGUgdmFyIG5leHRDYWxsZWQgPSBmYWxzZVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gaGFzTmV4dCgpOiBCb29sZWFuIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXggPCBteURhdGEuc2l6ZVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gbmV4dCgpOiBUIHtcbiAgICAgICAgICAgICAgICBpZiAoIWhhc05leHQoKSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBOb1N1Y2hFbGVtZW50RXhjZXB0aW9uKClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbmV4dENhbGxlZCA9IHRydWVcbiAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgIHZhbCB2YWx1ZSA9IHNwZWNbaW5kZXhdIGFzIFRcbiAgICAgICAgICAgICAgICBpbmRleCArPSAyXG4gICAgICAgICAgICAgICAgcmV0dXJuIHZhbHVlXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biByZW1vdmUoKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFuZXh0Q2FsbGVkKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGluZGV4IC09IDJcbiAgICAgICAgICAgICAgICByZW1vdmVBdChpbmRleClcbiAgICAgICAgICAgICAgICBuZXh0Q2FsbGVkID0gZmFsc2VcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGZpbmRCeUtleShrZXk6IEspOiBJbnQge1xuICAgICAgICB2YXIgaSA9IDBcbiAgICAgICAgd2hpbGUgKGkgPCBteURhdGEuc2l6ZSkge1xuICAgICAgICAgICAgdmFsIGsgPSBteURhdGFbaV1cbiAgICAgICAgICAgIGlmIChrZXkgPT0gaykge1xuICAgICAgICAgICAgICAgIHJldHVybiBpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpICs9IDJcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gLTFcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biByZW1vdmVBdChpbmRleDogSW50KSB7XG4gICAgICAgIGlmIChteURhdGEuc2l6ZSA9PSAyKSB7XG4gICAgICAgICAgICBteURhdGEgPSBFTVBUWV9BUlJBWVxuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbmV3QXJyYXkgPSBBcnJheShteURhdGEuc2l6ZSAtIDIpIHsgaSAtPlxuICAgICAgICAgICAgaWYgKGkgPCBpbmRleCkge1xuICAgICAgICAgICAgICAgIG15RGF0YVtpXVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBteURhdGFbaSArIDJdXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBteURhdGEgPSBuZXdBcnJheVxuICAgIH1cblxuICAgIGlubmVyIGNsYXNzIEVudHJ5IGludGVybmFsIGNvbnN0cnVjdG9yKHByaXZhdGUgdmFsIG15SW5kZXg6IEludCkge1xuICAgICAgICBmdW4ga2V5KCk6IEsge1xuICAgICAgICAgICAgQFN1cHByZXNzKFwiVU5DSEVDS0VEX0NBU1RcIilcbiAgICAgICAgICAgIHJldHVybiBteURhdGFbbXlJbmRleF0gYXMgS1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHZhbHVlKCk6IFY/IHtcbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIlVOQ0hFQ0tFRF9DQVNUXCIpXG4gICAgICAgICAgICByZXR1cm4gbXlEYXRhW215SW5kZXggKyAxXSBhcyBWP1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBpbnRlcmZhY2UgSXRlcmF0b3JTcGVjIHtcbiAgICAgICAgb3BlcmF0b3IgZnVuIGdldChpbmRleDogSW50KTogQW55P1xuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjAuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IG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Y2VBdExlYXN0KDApKS50b0xvbmcoKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHZhbCAoaW50U3RyLCBmcmFjU3RyLCBleHBvbmVudFN0cmluZykgPVxuICAgICAgICAgICAgICAgICAgICBcIl4oXFxcXGQrKVxcXFwuPyhcXFxcZCspP2U/KFsrLV0/XFxcXGQrKT9cXCRcIlxuICAgICAgICAgICAgICAgICAgICAgICAgLnRvUmVnZXgoKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmZpbmQobnVtLnRvRG91YmxlKCkuYWJzb2x1dGVWYWx1ZS50b1N0cmluZygpLmxvd2VyY2FzZSgpKVxuICAgICAgICAgICAgICAgICAgICAgICAgPy5kZXN0cnVjdHVyZWRcbiAgICAgICAgICAgICAgICAgICAgICAgID86IGVycm9yKFwiV3JvbmcgbnVtYmVyOiAkbnVtXCIpXG5cbiAgICAgICAgICAgICAgICB2YWwgZXhwb25lbnQ6IEludCA9IGV4cG9uZW50U3RyaW5nLnRvSW50T3JOdWxsKCkgPzogMFxuXG4gICAgICAgICAgICAgICAgLy8gbnVtYmVyID0gMS4yMzQ1NkUrNTVcbiAgICAgICAgICAgICAgICBpZiAoZXhwb25lbnQuYWJzb2x1dGVWYWx1ZSA+PSBNQVhfREVDSU1BTFMpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE51bWJlckluZm8oXG4gICAgICAgICAgICAgICAgICAgICAgICBudW1iZXIgPSBudW0sXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBcIjFcIiAtPiAxXG4gICAgICAgICAgICAgICAgICAgICAgICBpbnRlZ2VyUGFydCA9IGludFN0ci50b0xvbmcoKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZyYWN0aW9uIHBhcnQgaWdub3JlZCBpbnRlbnRpb25hbGx5XG4gICAgICAgICAgICAgICAgICAgICAgICBmcmFjdGlvbmFsUGFydCA9IDAsXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyA1NVxuICAgICAgICAgICAgICAgICAgICAgICAgZXhwb25lbnQgPSBleHBvbmVudFxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgY2hlY2soZXhwb25lbnQgPCBNQVhfREVDSU1BTFMpXG4gICAgICAgICAgICAgICAgLy8gbnVtYmVyID0gMS4yM0UtNC4gZG91YmxlOiAwLjAwMDEyM1xuICAgICAgICAgICAgICAgIGlmIChleHBvbmVudCA8IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE51bWJlckluZm8oXG4gICAgICAgICAgICAgICAgICAgICAgICBudW1iZXIgPSBudW0sXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBcIjFcIiArIFwiMjNcIiAtPiAwMDBfMTIzXzAwMF8wMDBfMDAwXzAwMExcbiAgICAgICAgICAgICAgICAgICAgICAgIGZyYWN0aW9uYWxQYXJ0ID0gZW5jb2RlRnJhY3Rpb24oaW50U3RyICsgZnJhY1N0ciwgZXhwb25lbnQuYWJzb2x1dGVWYWx1ZSArIGZyYWNTdHIubGVuZ3RoKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgY2hlY2soZXhwb25lbnQgPj0gMCAmJiBleHBvbmVudCA8PSBNQVhfREVDSU1BTFMpXG4gICAgICAgICAgICAgICAgLy8gbnVtYmVyID0gMS4yMzRFKzUsIGRvdWJsZTogMTIzNDAwLjBcbiAgICAgICAgICAgICAgICBpZiAoZXhwb25lbnQgPj0gZnJhY1N0ci5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE51bWJlckluZm8oXG4gICAgICAgICAgICAgICAgICAgICAgICBudW1iZXIgPSBudW0sXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBcIjFcIiArIFwiMjM0XCIgKyBcIjAwXCIgLT4gMTIzNDAwXG4gICAgICAgICAgICAgICAgICAgICAgICBpbnRlZ2VyUGFydCA9IChpbnRTdHIgKyBmcmFjU3RyICsgXCIwXCIucmVwZWF0KGV4cG9uZW50IC0gZnJhY1N0ci5sZW5ndGgpKS50b0xvbmcoKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgY2hlY2soZXhwb25lbnQgPj0gMCAmJiBleHBvbmVudCA8IGZyYWNTdHIubGVuZ3RoKVxuICAgICAgICAgICAgICAgIC8vIG51bWJlciA9IDEuMjM0NTY3RSszLCBkb3VibGU6IDEyMzQuNTY3XG4gICAgICAgICAgICAgICAgcmV0dXJuIE51bWJlckluZm8oXG4gICAgICAgICAgICAgICAgICAgIG51bWJlciA9IG51bSxcbiAgICAgICAgICAgICAgICAgICAgLy8gXCIxXCIgKyBcIlsyMzRdNTY3XCIgLT4gMTIzNFxuICAgICAgICAgICAgICAgICAgICBpbnRlZ2VyUGFydCA9IChpbnRTdHIgKyBmcmFjU3RyLnN1YnN0cmluZygwIHVudGlsIGV4cG9uZW50KSkudG9Mb25nKCksXG4gICAgICAgICAgICAgICAgICAgIC8vIFwiMjM0WzU2N11cIiAtPiA1NjdfMDAwXzAwMF8wMDBfMDAwXzAwMFxuICAgICAgICAgICAgICAgICAgICBmcmFjdGlvbmFsUGFydCA9IGZyYWNTdHIuc3Vic3RyaW5nKGV4cG9uZW50KS5ydW4geyBlbmNvZGVGcmFjdGlvbih0aGlzLCB0aGlzLmxlbmd0aCkgfVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGRhdGEgY2xhc3MgT3V0cHV0KFxuICAgICAgICB2YWwgYm9keTogRm9ybWF0dGVkTnVtYmVyID0gRm9ybWF0dGVkTnVtYmVyKCksXG4gICAgICAgIHZhbCBzaWduOiBTdHJpbmcgPSBcIlwiLFxuICAgICAgICB2YWwgcHJlZml4OiBTdHJpbmcgPSBcIlwiLFxuICAgICAgICB2YWwgc3VmZml4OiB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m8gPSBjcmVhdGVOdW1iZXJJbmZvKG51bSlcbiAgICAgICAgdmFyIG91dHB1dCA9IE91dHB1dCgpXG5cbiAgICAgICAgb3V0cHV0ID0gY29tcHV0ZUJvZHkob3V0cHV0LCBudW1iZXJJbmZvKVxuICAgICAgICBvdXRwdXQgPSB0cmltRnJhY3Rpb24ob3V0cHV0KVxuXG4gICAgICAgIG91dHB1dCA9IGNvbXB1dGVTaWduKG91dHB1dCwgbnVtYmVySW5mbylcbiAgICAgICAgb3V0cHV0ID0gY29tcHV0ZVByZWZpeChvdXRwdXQpXG4gICAgICAgIG91dHB1dCA9IGNvbXB1dGVTdWZmaXgob3V0cHV0KVxuXG4gICAgICAgIGlmIChzcGVjLmNvbW1hICYmICFzcGVjLnplcm8pIHtcbiAgICAgICAgICAgIG91dHB1dCA9IGFwcGx5R3JvdXAob3V0cHV0KVxuICAgICAgICB9XG5cbiAgICAgICAgb3V0cHV0ID0gY29tcHV0ZVBhZGRpbmcob3V0cHV0KVxuXG4gICAgICAgIGlmIChzcGVjLmNvbW1hICYmIHNwZWMuemVybykge1xuICAgICAgICAgICAgb3V0cHV0ID0gYXBwbHlHcm91cChvdXRwdXQpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gZ2V0QWxpZ25lZFN0cmluZyhvdXRwdXQpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gaGFuZGxlTm9uTnVtYmVycyhudW06IE51bWJlcik6IFN0cmluZz8ge1xuICAgICAgICB2YWwgbnVtYmVyID0gbnVtLnRvRG91YmxlKClcbiAgICAgICAgcmV0dXJuIHdoZW4ge1xuICAgICAgICAgICAgbnVtYmVyLmlzTmFOKCkgLT4gXCJOYU5cIlxuICAgICAgICAgICAgbnVtYmVyID09IERvdWJsZS5ORUdBVElWRV9JTkZJTklUWSAtPiBcIi1JbmZpbml0eVwiXG4gICAgICAgICAgICBudW1iZXIgPT0gRG91YmxlLlBPU0lUSVZFX0lORklOSVRZIC0+IFwiK0luZmluaXR5XCJcbiAgICAgICAgICAgIGVsc2UgLT4gbnVsbFxuICAgICAgICB9XG4gICAgfVxuXG5cbiAgICBwcml2YXRlIGZ1biBnZXRBbGlnbmVkU3RyaW5nKG91dHB1dDogT3V0cHV0KTogU3RyaW5nIHtcbiAgICAgICAgd2l0aChvdXRwdXQpIHtcbiAgICAgICAgICAgIHJldHVybiB3aGVuIChzcGVjLmFsaWduKSB7XG4gICAgICAgICAgICAgICAgXCI8XCIgLT4gXCIkc2lnbiRwcmVmaXgkYm9keSRzdWZmaXgkcGFkZGluZ1wiXG4gICAgICAgICAgICAgICAgXCI9XCIgLT4gXCIkc2lnbiRwcmVmaXgkcGFkZGluZyRib2R5JHN1ZmZpeFwiXG4gICAgICAgICAgICAgICAgXCJeXCIgLT4ge1xuICAgICAgICAgICAgICAgICAgICB2YWwgc3RvcCA9IHBhZGRpbmcubGVuZ3RoIC8gMlxuICAgICAgICAgICAgICAgICAgICBcIiR7cGFkZGluZy5zbGljZSgwIHVudGlsIHN0b3ApfSRzaWduJHByZWZpeCRib2R5JHN1ZmZpeCR7cGFkZGluZy5zbGljZShzdG9wIHVudGlsIG91dHB1dC5wYWRkaW5nLmxlbmd0aCl9XCJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSAtPiBcIiRwYWRkaW5nJHNpZ24kcHJlZml4JGJvZHkkc3VmZml4XCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGFwcGx5R3JvdXAob3V0cHV0OiBPdXRwdXQpOiBPdXRwdXQge1xuXG4gICAgICAgIHZhbCB6ZXJvUGFkZGluZyA9IG91dHB1dC5wYWRkaW5nLnRha2VJZiB7IHNwZWMuemVybyB9ID86IFwiXCJcblxuICAgICAgICB2YWwgYm9keSA9IG91dHB1dC5ib2R5XG4gICAgICAgIHZhciBmdWxsSW50U3RyID0gemVyb1BhZGRpbmcgKyBib2R5LmludGVnZXJQYXJ0XG4gICAgICAgIHZhbCBjb21tYXMgPSAoY2VpbChmdWxsSW50U3RyLmxlbmd0aCAvIEdST1VQX1NJWkUudG9Eb3VibGUoKSkgLSAxKS50b0ludCgpXG5cbiAgICAgICAgdmFsIHdpZHRoID0gKHNwZWMud2lkdGggLSBib2R5LmZyYWN0aW9uYWxMZW5ndGggLSBib2R5LmV4cG9uZW50aWFsUGFydC5sZW5ndGgpXG4gICAgICAgICAgICAuY29lcmNlQXRMZWFzdChib2R5LmludGVnZXJQYXJ0Lmxlbmd0aCArIGNvbW1hcylcblxuICAgICAgICBmdWxsSW50U3RyID0gZ3JvdXAoZnVsbEludFN0cilcblxuICAgICAgICBpZiAoZnVsbEludFN0ci5sZW5ndGggPiB3aWR0aCkge1xuICAgICAgICAgICAgZnVsbEludFN0ciA9IGZ1bGxJbnRTdHIuc3Vic3RyaW5nKGZ1bGxJbnRTdHIubGVuZ3RoIC0gd2lkdGgpXG4gICAgICAgICAgICBpZiAoZnVsbEludFN0ci5zdGFydHNXaXRoKCcsJykpIHtcbiAgICAgICAgICAgICAgICBmdWxsSW50U3RyID0gXCIwJGZ1bGxJbnRTdHJcIlxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIG91dHB1dC5jb3B5KFxuICAgICAgICAgICAgYm9keSA9IGJvZHkuY29weShpbnRlZ2VyUGFydCA9IGZ1bGxJbnRTdHIpLFxuICAgICAgICAgICAgcGFkZGluZyA9IFwiXCIudGFrZUlmIHsgc3BlYy56ZXJvIH0gPzogb3V0cHV0LnBhZGRpbmdcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNvbXB1dGVCb2R5KHJlczogT3V0cHV0LCBudW1iZXJJbmZvOiBOdW1iZXJJbmZvKTogT3V0cHV0IHtcbiAgICAgICAgdmFsIGZvcm1hdHRlZE51bWJlciA9IHdoZW4gKHNwZWMudHlwZSkge1xuICAgICAgICAgICAgXCIlXCIgLT4gdG9GaXhlZEZvcm1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SWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiV3JvbmcgdHlwZTogJHtzcGVjLnR5cGV9XCIpXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlcy5jb3B5KGJvZHkgPSBmb3JtYXR0ZWROdW1iZXIpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gdG9FeHBvbmVudGlhbChudW1iZXJJbmZvOiBOdW1iZXJJbmZvLCBwcmVjaXNpb246IEludCA9IC0xKTogTnVtYmVySW5mbyB7XG4gICAgICAgIHZhbCBudW0gPSBudW1iZXJJbmZvLm51bWJlclxuICAgICAgICBpZiAobnVtIDwgVFlQRV9FX01JTikge1xuICAgICAgICAgICAgcmV0dXJuIE51bWJlckluZm8oMC4wKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGUgPSBpZiAobnVtYmVySW5mby5pbnRlZ2VyUGFydCA9PSAwTCkge1xuICAgICAgICAgICAgLShudW1iZXJJbmZvLmZyYWN0aW9uTGVhZGluZ1plcm9zICsgMSlcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIG51bWJlckluZm8uaW50ZWdlckxlbmd0aCAtIDEgK1xuICAgICAgICAgICAgICAgICAgICAobnVtYmVySW5mby5leHBvbmVudCA/OiAwKVxuICAgICAgICB9XG4gICAgICAgIHZhbCBuID0gbnVtIC8gMTAuMC5wb3coZSlcblxuICAgICAgICB2YXIgbmV3SW5mbyA9IGNyZWF0ZU51bWJlckluZm8obilcblxuICAgICAgICBpZiAocHJlY2lzaW9uID4gLTEpIHtcbiAgICAgICAgICAgIG5ld0luZm8gPSByb3VuZFRvUHJlY2lzaW9uKG5ld0luZm8sIHByZWNpc2lvbilcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChuZXdJbmZvLmludGVnZXJMZW5ndGggPiAxKSB7XG4gICAgICAgICAgICBlICs9IDFcbiAgICAgICAgICAgIG5ld0luZm8gPSBjcmVhdGVOdW1iZXJJbmZvKG4gLyAxMClcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBuZXdJbmZvLmNvcHkoZXhwb25lbnQgPSBlKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHRvUHJlY2lzaW9uRm9ybWF0KG51bWJlckluZm86IE51bWJlckluZm8sIHByZWNpc2lvbjogSW50ID0gLTEpOiBGb3JtYXR0ZWROdW1iZXIge1xuICAgICAgICBpZiAobnVtYmVySW5mby5pbnRlZ2VyUGFydCA9PSAwTCkge1xuICAgICAgICAgICAgaWYgKG51bWJlckluZm8uZnJhY3Rpb25hbFBhcnQgPT0gMEwpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdG9GaXhlZEZvcm1hdChudW1iZXJJbmZvLCBwcmVjaXNpb24gLSAxKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRvRml4ZWRGb3JtYXQobnVtYmVySW5mbywgcHJlY2lzaW9uICsgbnVtYmVySW5mby5mcmFjdGlvbkxlYWRpbmdaZXJvcylcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChudW1iZXJJbmZvLmludGVnZXJMZW5ndGggPiBwcmVjaXNpb24pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdG9TaW1wbGVGb3JtYXQodG9FeHBvbmVudGlhbChudW1iZXJJbmZvLCBwcmVjaXNpb24gLSAxKSwgcHJlY2lzaW9uIC0gMSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB0b0ZpeGVkRm9ybWF0KG51bWJlckluZm8sIHByZWNpc2lvbiAtIG51bWJlckluZm8uaW50ZWdlckxlbmd0aClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHRvRml4ZWRGb3JtYXQobnVtYmVySW5mbzogTnVtYmVySW5mbywgcHJlY2lzaW9uOiBJbnQgPSAwKTogRm9ybWF0dGVkTnVtYmVyIHtcbiAgICAgICAgaWYgKHByZWNpc2lvbiA8PSAwKSB7XG4gICAgICAgICAg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GV4cCA9IG51bWJlckluZm8uZXhwb25lbnQgPzogMFxuICAgICAgICB2YWwgdG90YWxQcmVjaXNpb24gPSBwcmVjaXNpb24gKyBleHBcblxuICAgICAgICB2YXIgZnJhY3Rpb25hbFBhcnQ6IExvbmdcbiAgICAgICAgdmFyIGludGVnZXJQYXJ0OiBMb25nXG5cbiAgICAgICAgaWYgKHRvdGFsUHJlY2lzaW9uIDwgMCkge1xuICAgICAgICAgICAgZnJhY3Rpb25hbFBhcnQgPSAwTFxuICAgICAgICAgICAgdmFsIGludFNoaWZ0ID0gdG90YWxQcmVjaXNpb24uYWJzb2x1dGVWYWx1ZVxuICAgICAgICAgICAgaW50ZWdlclBhcnQgPSBpZiAobnVtYmVySW5mby5pbnRlZ2VyTGVuZ3RoIDw9IGludFNoaWZ0KSB7XG4gICAgICAgICAgICAgICAgMFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBudW1iZXJJbmZvLmludGVnZXJQYXJ0IC8gMTAuMC5wb3coaW50U2hpZnQpLnRvTG9uZygpICogMTAuMC5wb3coaW50U2hpZnQpLnRvTG9uZygpXG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB2YWwgcHJlY2lzaW9uRXhwID0gTnVtYmVySW5mby5NQVhfREVDSU1BTF9WQUxVRSAvIDEwLjAucG93KHRvdGFsUHJlY2lzaW9uKS50b0xvbmcoKVxuICAgICAgICAgICAgZnJhY3Rpb25hbFBhcnQgPSBpZiAocHJlY2lzaW9uRXhwID09IDBMKSB7XG4gICAgICAgICAgICAgICAgbnVtYmVySW5mby5mcmFjdGlvbmFsUGFydFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAobnVtYmVySW5mby5mcmFjdGlvbmFsUGFydC50b0RvdWJsZSgpIC8gcHJlY2lzaW9uRXhwKS5yb3VuZFRvTG9uZygpICogcHJlY2lzaW9uRXhwXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpbnRlZ2VyUGFydCA9IG51bWJlckluZm8uaW50ZWdlclBhcnRcbiAgICAgICAgICAgIGlmIChmcmFjdGlvbmFsUGFydCA9PSBOdW1iZXJJbmZvLk1BWF9ERUNJTUFMX1ZBTFVFKSB7XG4gICAgICAgICAgICAgICAgZnJhY3Rpb25hbFBhcnQgPSAwXG4gICAgICAgICAgICAgICAgKytpbnRlZ2VyUGFydFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIG51bSA9IGludGVnZXJQYXJ0ICsgZnJhY3Rpb25hbFBhcnQudG9Eb3VibGUoKSAvIE51bWJlckluZm8uTUFYX0RFQ0lNQUxfVkFMVUVcblxuICAgICAgICByZXR1cm4gbnVtYmVySW5mby5jb3B5KG51bWJlciA9IG51bSwgZnJhY3Rpb25hbFBhcnQgPSBmcmFjdGlvbmFsUGFydCwgaW50ZWdlclBhcnQgPSBpbnRlZ2VyUGFydClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB0cmltRnJhY3Rpb24ob3V0cHV0OiBPdXRwdXQpOiBPdXRwdXQge1xuICAgICAgICBpZiAoIXNwZWMudHJpbSB8fCBvdXRwdXQuYm9keS5mcmFjdGlvbmFsUGFydC5pc0VtcHR5KCkpIHtcbiAgICAgICAgICAgIHJldHVybiBvdXRwdXRcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCB0cmltbWVkRnJhY3Rpb24gPSBvdXRwdXQuYm9keS5mcmFjdGlvbmFsUGFydC50cmltRW5kKCcwJylcbiAgICAgICAgcmV0dXJuIG91dHB1dC5jb3B5KFxuICAgICAgICAgICAgYm9keSA9IG91dHB1dC5ib2R5LmNvcHkoXG4gICAgICAgICAgICAgICAgZnJhY3Rpb25hbFBhcnQgPSB0cmltbWVkRnJhY3Rpb25cbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNvbXB1dGVTaWduKG91dHB1dDogT3V0cHV0LCBudW1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IHByaXZhdGUgY29uc3QgdmFsIEZSQUNUSU9OX0RFTElNSVRFUiA9IFwiLlwiXG4gICAgICAgIHByaXZhdGUgY29uc3QgdmFsIEZSQUNUSU9OX0RFTElNSVRFUl9MRU5HVEggPSBGUkFDVElPTl9ERUxJTUlURVIubGVuZ3RoXG4gICAgICAgIHByaXZhdGUgY29uc3QgdmFsIEdST1VQX1NJWkUgPSAzXG4gICAgICAgIHByaXZhdGUgdmFsIFNJX1NVRkZJWEVTID1cbiAgICAgICAgICAgIGFycmF5T2YoXCJ5XCIsIFwielwiLCBcImFcIiwgXCJmXCIsIFwicFwiLCBcIm5cIiwgXCLCtVwiLCBcIm1cIiwgXCJcIiwgXCJrXCIsIFwiTVwiLCBcIkdcIiwgXCJUXCIsIFwiUFwiLCBcIkVcIiwgXCJaXCIsIFwiWVwiKVxuXG4gICAgICAgIGZ1biBjcmVhdGUoc3BlYzogU3RyaW5nKTogU3BlYyB7XG4gICAgICAgICAgICByZXR1cm4gY3JlYXRlKHBhcnNlKHNwZWMpKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGNyZWF0ZShzcGVjOiBTcGVjKTogU3BlYyB7XG4gICAgICAgICAgICB2YXIgcHJlY2lzaW9uID0gc3BlYy5wcmVjaXNpb25cbiAgICAgICAgICAgIHZhciB0eXBlID0gc3BlYy50eXBlXG4gICAgICAgICAgICB2YXIgdHJpbSA9IGZhbHNlXG4gICAgICAgICAgICBpZiAodHlwZSA9PSBcIlwiKSB7XG4gICAgICAgICAgICAgICAgaWYgKHByZWNpc2lvbiA9PSAtMSkge1xuICAgICAgICAgICAgICAgICAgICBwcmVjaXNpb24gPSAxMlxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0eXBlID0gXCJnXCJcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKHR5cGUgPT0gXCJnXCIpIHtcbiAgICAgICAgICAgICAgICB0cmltID0gdHJ1ZVxuICAgICAgICAgICAgfVxuXG4gICA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2FsQXJndW1lbnRFeGNlcHRpb24oKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGJlZm9yZUl0ZW1BZGRlZChpbmRleDogSW50LCBpdGVtOiBDaGlsZFQpIHtcbiAgICAgICAgaXRlbS5wYXJlbnQoKS5zZXQobXlQYXJlbnQpXG4gICAgICAgIGl0ZW0uc2V0UG9zaXRpb25EYXRhKG9iamVjdCA6XG4gICAgICAgICAgICBQb3NpdGlvbkRhdGE8Q2hpbGRUPiB7XG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gZ2V0KCk6IFBvc2l0aW9uPENoaWxkVD4ge1xuICAgICAgICAgICAgICAgIEBTdXBwcmVzcyhcIk5BTUVfU0hBRE9XSU5HXCIpXG4gICAgICAgICAgICAgICAgdmFsIGluZGV4ID0gaW5kZXhPZihpdGVtKVxuICAgICAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBQb3NpdGlvbjxDaGlsZFQ+IHtcblxuICAgICAgICAgICAgICAgICAgICBvdmVycmlkZSB2YWwgcm9sZTogQW55XG4gICAgICAgICAgICAgICAgICAgICAgICBnZXQoKSA9IHRoaXNAQ2hpbGRMaXN0XG5cbiAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGdldCgpOiBDaGlsZFQ/IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpZiAoc2l6ZSA8PSBpbmRleCkgbnVsbCBlbHNlIHRoaXNAQ2hpbGRMaXN0LmdldChpbmRleClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHJlbW92ZSgpIHtcbiAgICAgICAgICAgICAgICB0aGlzQENoaWxkTGlzdC5yZW1vdmUoaXRlbSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSlcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gY2hlY2tTZXQoaW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ZhbCBteVJlZ2lzdHJhdGlvbnMgPSBBcnJheUxpc3Q8UmVnaXN0cmF0aW9uPigpXG5cbiAgICBjb25zdHJ1Y3Rvcih2YXJhcmcgc291cmNlczogRXZlbnRTb3VyY2U8RXZlbnRUPikge1xuICAgICAgICBmb3IgKHMgaW4gc291cmNlcykge1xuICAgICAgICAgICAgYWRkKHMpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb25zdHJ1Y3Rvcihzb3VyY2VzOiBJdGVyYWJsZTxFdmVudFNvdXJjZTxFdmVudFQ+Pikge1xuICAgICAgICBmb3IgKHMgaW4gc291cmNlcykge1xuICAgICAgICAgICAgYWRkKHMpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gYWRkKHNvdXJjZTogRXZlbnRTb3VyY2U8RXZlbnRUPikge1xuICAgICAgICBteUV2ZW50U291cmNlcy5hZGQoc291cmNlKVxuICAgIH1cblxuICAgIGZ1biByZW1vdmUoc291cmNlOiBFdmVudFNvdXJjZTxvdXQgRXZlbnRUPikge1xuICAgICAgICBteUV2ZW50U291cmNlcy5yZW1vdmUoc291cmNlKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBhZGRIYW5kbGVyKGhhbmRsZXI6IEV2ZW50SGFuZGxlcjxFdmVudFQ+KTogUmVnaXN0cmF0aW9uIHtcbiAgICAgICAgaWYgKG15SGFuZGxlcnMgPT0gbnVsbCkge1xuICAgICAgICAgICAgbXlIYW5kbGVycyA9IG9iamVjdCA6IExpc3RlbmVyczxFdmVudEhhbmRsZXI8RXZlbnRUPj4oKSB7XG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGJlZm9yZUZpcnN0QWRkZWQoKSB7XG4gICAgICAgICAgICAgICAgICAgIGZvciAoc3JjIGluIG15RXZlbnRTb3VyY2VzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBhZGRIYW5kbGVyVG8oc3JjKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGFmdGVyTGFzdFJlbW92ZWQoKSB7XG4gICAgICAgICAgICAgICAgICAgIGZvciAoaHIgaW4gbXlSZWdpc3RyYXRpb25zKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBoci5yZW1vdmUoKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIG15UmVnaXN0cmF0aW9ucy5jbGVhcigpXG4gICAgICAgICAgICAgICAgICAgIG15SGFuZGxlcnMgPSBudWxsXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBteUhhbmRsZXJzISEuYWRkKGhhbmRsZXIpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gPFBhcnRFdmVudFQgOiBFdmVudFQ+IGFkZEhhbmRsZXJUbyhzcmM6IEV2ZW50U291cmNlPFBhcnRFdmVudFQ+KSB7XG4gICAgICAgIG15UmVnaXN0cmF0aW9ucy5hZGQoc3JjLmFkZEhhbmRsZXIob2JqZWN0IDogRXZlbnRIYW5kbGVyPFBhcnRFdmVudFQ+IHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBvbkV2ZW50KGV2ZW50OiBQYXJ0RXZlbnRUKSB7XG4gICAgICAgICAgICAgICAgbXlIYW5kbGVycyEhLmZpcmUob2JqZWN0IDogTGlzdGVuZXJDYWxsZXI8RXZlbnRIYW5kbGVyPEV2ZW50VD4+IHtcbiAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGNhbGwobDogRXZlbnRIYW5kbGVyPEV2ZW50VD4pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGwub25FdmVudChldmVudClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pKVxuICAgIH1cbn0iLCIvKlxuICogQ29weXJpZ2h0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b24ge1xuICAgICAgICAgICAgICAgIHZhbCBpdGVtUmVncyA9IEFycmF5TGlzdDxSZWdpc3RyYXRpb24+KClcbiAgICAgICAgICAgICAgICBmb3IgKGl0ZW0gaW4gbGlzdCkge1xuICAgICAgICAgICAgICAgICAgICBpdGVtUmVncy5hZGQoc2VsZWN0b3IoaXRlbSkuYWRkSGFuZGxlcihoYW5kbGVyKSlcbiAgICAgICAgICAgICAgICB9XG5cblxuICAgICAgICAgICAgICAgIHZhbCBsaXN0UmVnID0gbGlzdC5hZGRMaXN0ZW5lcihvYmplY3QgOiBDb2xsZWN0aW9uQWRhcHRlcjxJdGVtVD4oKSB7XG4gICAgICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBvbkl0ZW1BZGRlZChldmVudDogQ29sbGVjdGlvbkl0ZW1FdmVudDxvdXQgSXRlbVQ+KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpdGVtUmVncy5hZGQoZXZlbnQuaW5kZXgsIHNlbGVjdG9yKGV2ZW50Lm5ld0l0ZW0pLmFkZEhhbmRsZXIoaGFuZGxlcikpXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gb25JdGVtUmVtb3ZlZChldmVudDogQ29sbGVjdGlvbkl0ZW1FdmVudDxvdXQgSXRlbVQ+KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpdGVtUmVncy5yZW1vdmVBdChldmVudC5pbmRleCkucmVtb3ZlKClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0IDogUmVnaXN0cmF0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gZG9SZW1vdmUoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgaW4gaXRlbVJlZ3MpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnJlb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gZ2V0KCkgPSBteUxpc3RlbmVycyA9PSBudWxsIHx8IG15TGlzdGVuZXJzISEuaXNFbXB0eSgpXG5cbiAgICBmdW4gYWRkKGw6IExpc3RlbmVyVCk6IFJlZ2lzdHJhdGlvbiB7XG4gICAgICAgIGlmIChpc0VtcHR5KSB7XG4gICAgICAgICAgICBiZWZvcmVGaXJzdEFkZGVkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChteUZpcmVEZXB0aCA+IDApIHtcbiAgICAgICAgICAgIG15TGlzdGVuZXJzISEuYWRkKExpc3RlbmVyT3AobCwgdHJ1ZSkpXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAobXlMaXN0ZW5lcnMgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIG15TGlzdGVuZXJzID0gQXJyYXlMaXN0KDEpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBteUxpc3RlbmVycyEhLmFkZChsIGFzIEFueSlcbiAgICAgICAgICAgIG15TGlzdGVuZXJzQ291bnQrK1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBvYmplY3QgOiBSZWdpc3RyYXRpb24oKSB7XG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gZG9SZW1vdmUoKSB7XG4gICAgICAgICAgICAgICAgaWYgKG15RmlyZURlcHRoID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBteUxpc3RlbmVycyEhLmFkZChcbiAgICAgICAgICAgICAgICAgICAgICAgIExpc3RlbmVyT3AoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWxzZVxuICAgICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbXlMaXN0ZW5lcnMhIS5yZW1vdmUobCBhcyBBbnkpXG4gICAgICAgICAgICAgICAgICAgIG15TGlzdGVuZXJzQ291bnQtLVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChpc0VtcHR5KSB7XG4gICAgICAgICAgICAgICAgICAgIGFmdGVyTGFzdFJlbW92ZWQoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBmaXJlKGg6IExpc3RlbmVyQ2FsbGVyPExpc3RlbmVyVD4pIHtcbiAgICAgICAgaWYgKGlzRW1wdHkpIHJldHVyblxuICAgICAgICBiZWZvcmVGaXJlKClcbiAgICAgICAgLy9leGNlcHRpb24gY2FuIGJlIHRocm93biBmcm9tIFRocm93YWJsZUhhbmRsZXJzLmdldEluc3RhbmNlKCkuaGFuZGxlKClcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHZhbCBzaXplID0gbXlMaXN0ZW5lcnNDb3VudFxuICAgICAgICAgICAgZm9yIChpIGluIDAgdW50aWwgc2l6ZSkge1xuICAgICAgICAgICAgICAgIEBTdXBwcmVzcyhcIlVOQ0hFQ0tFRF9DQVNUXCIpXG4gICAgICAgICAgICAgICAgdmFsIGwgPSBteUxpc3RlbmVycyEhW2ldIGFzIExpc3RlbmVyVFxuXG4gICAgICAgICAgICAgICAgaWYgKGlzUmVtb3ZlZChsKSkgY29udGludWVcblxuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGguY2FsbChsKVxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQ6IFRocm93YWJsZSkge1xuICAgICAgICAgICAgICAgICAgICBUaHJvd2FibGVIYW5kbGVycy5pbnN0YW5jZS5oYW5kbGUodClcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICAgIGFmdGVyRmlyZSgpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBpc1JlbW92ZWQobDogTGlzdGVuZ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biAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgdmFsIEVNUFRZOiBSZWdpc3RyYXRpb24gPVxuICAgICAgICAgICAgRW1wdHlSZWdpc3RyYXRpb24oKVxuXG4gICAgICAgIGZ1biBmcm9tKGRpc3Bvc2FibGU6IERpc3Bvc2FibGUpOiBSZWdpc3RyYXRpb24ge1xuICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IFJlZ2lzdHJhdGlvbigpIHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gZG9SZW1vdmUoKSB7XG4gICAgICAgICAgICAgICAgICAgIGRpc3Bvc2FibGUuZGlzcG9zZSgpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGZyb20odmFyYXJnIGRpc3Bvc2FibGVzOiBEaXNwb3NhYmxlKTogUmVnaXN0cmF0aW9uIHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBSZWdpc3RyYXRpb24oKSB7XG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGRvUmVtb3ZlKCkge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKGQgaW4gZGlzcG9zYWJsZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGQuZGlzcG9zZSgpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59IiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUuYmFzZS5yZWdpc3RyYXRpb24udGhyb3dhY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ICAgICAgICAgIENsb3NlZFJhbmdlKFxuICAgICAgICAgICAgICAgIHNlZ21lbnRzLm1hcChTZWdtZW50OjpzdGFydCkubWluT3JOdWxsKCkhISxcbiAgICAgICAgICAgICAgICBzZWdtZW50cy5tYXAoU2VnbWVudDo6ZW5kKS5tYXhPck51bGwoKSEhXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgaW50ZXJuYWwgZnVuIGNhbGN1bGF0ZUxvb3BMaW1pdFJhbmdlKFxuICAgICAgICAgICAgc2VnbWVudHM6IFNlcXVlbmNlPFNlZ21lbnQ+LFxuICAgICAgICAgICAgbWFwUmFuZ2U6IENsb3NlZFJhbmdlPERvdWJsZT5cbiAgICAgICAgKTogQ2xvc2VkUmFuZ2U8RG91YmxlPiB7XG4gICAgICAgICAgICByZXR1cm4gc2VnbWVudHNcbiAgICAgICAgICAgICAgICAubWFwIHtcbiAgICAgICAgICAgICAgICAgICAgc3BsaXRTZWdtZW50KFxuICAgICAgICAgICAgICAgICAgICAgICAgaXQuc3RhcnQsIGl0LmVuZCxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hcFJhbmdlLmxvd2VyRW5kLFxuICAgICAgICAgICAgICAgICAgICAgICAgbWFwUmFuZ2UudXBwZXJFbmRcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAuZmxhdHRlbigpXG4gICAgICAgICAgICAgICAgLnJ1biB7IGZpbmRNYXhHYXBCZXR3ZWVuUmFuZ2VzKHRoaXMsIG1hcFJhbmdlLmxlbmd0aCgpKSB9XG4gICAgICAgICAgICAgICAgLnJ1biB7IGludmVydFJhbmdlKHRoaXMsIG1hcFJhbmdlLmxlbmd0aCgpKSB9XG4gICAgICAgICAgICAgICAgLnJ1biB7IG5vcm1hbGl6ZUNlbnRlcih0aGlzLCBtYXBSYW5nZSkgfVxuICAgICAgICB9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XCJmZWF0dXJlc1wiKSkgeyBcIkdlb0pzb246IE1pc3NpbmcgJ2ZlYXR1cmVzJyBpbiAnRmVhdHVyZUNvbGxlY3Rpb24nXCIgfVxuXG4gICAgICAgICAgICAgICAgICAgIG9iai5nZXRBcnJheShcImZlYXR1cmVzXCIpLmZsdWVudE9iamVjdFN0cmVhbSgpXG4gICAgICAgICAgICAgICAgICAgICAgICAuZmlsdGVyIHsgaXQuZ2V0U3RyaW5nKFwidHlwZVwiKSA9PSBcIkZlYXR1cmVcIiB9XG4gICAgICAgICAgICAgICAgICAgICAgICAubWFwIHsgaXQuZ2V0T2JqZWN0KFwiZ2VvbWV0cnlcIikgfVxuICAgICAgICAgICAgICAgICAgICAgICAgLmZvckVhY2ggeyBwYXJzZShpdCwgaGFuZGxlcikgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIFwiR2VvbWV0cnlDb2xsZWN0aW9uXCIgLT4ge1xuICAgICAgICAgICAgICAgICAgICByZXF1aXJlKG9iai5jb250YWlucyhcImdlb21ldHJpZXNcIikpIHsgXCJHZW9Kc29uOiBNaXNzaW5nICdnZW9tZXRyaWVzJyBpbiAnR2VvbWV0cnlDb2xsZWN0aW9uJ1wiIH1cblxuICAgICAgICAgICAgICAgICAgICBvYmouZ2V0QXJyYXkoXCJnZW9tZXRyaWVzXCIpLmZsdWVudE9iamVjdFN0cmVhbSgpXG4gICAgICAgICAgICAgICAgICAgICAgICAuZm9yRWFjaCB7IHBhcnNlKGl0LCBoYW5kbGVyKSB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgZWxzZSAtPiB7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVpcmUob2JqLmNvbnRhaW5zKFwiY29vcmRpbmF0ZXNcIikpIHsgXCJHZW9Kc29uOiBNaXNzaW5nICdjb29yZGluYXRlcycgaW4gJHR5cGVcIiB9XG5cbiAgICAgICAgICAgICAgICAgICAgdmFsIGNvb3JkaW5hdGVzID0gb2JqLmdldEFycmF5KFwiY29vcmRpbmF0ZXNcIilcbiAgICAgICAgICAgICAgICAgICAgd2hlbiAodHlwZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJQb2ludFwiIC0+IHBhcnNlUG9pbnQoY29vcmRpbmF0ZXMpLmxldChoYW5kbGVyOjpvblBvaW50KVxuICAgICAgICAgICAgICAgICAgICAgICAgXCJMaW5lU3RyaW5nXCIgLT4gcGFyc2VMaW5lU3RyaW5nKGNvb3JkaW5hdGVzKS5sZXQoaGFuZGxlcjo6b25MaW5lU3RyaW5nKVxuICAgICAgICAgICAgICAgICAgICAgICAgXCJQb2x5Z29uXCIgLT4gcGFyc2VQb2x5Z29uKGNvb3JkaW5hdGVzKS5sZXQoaGFuZGxlcjo6b25Qb2x5Z29uKVxuICAgICAgICAgICAgICAgICAgICAgICAgXCJNdWx0aVBvaW50XCIgLT4gcGFyc2VNdWx0aVBvaW50KGNvb3JkaW5hdGVzKS5sZXQoaGFuZGxlcjo6b25NdWx0aVBvaW50KVxuICAgICAgICAgICAgICAgICAgICAgICAgXCJNdWx0aUxpbmVTdHJpbmdcIiAtPiBwYXJzZU11bHRpTGluZVN0cmluZyhjb29yZGluYXRlcykubGV0KGhhbmRsZXI6Om9uTXVsdGlMaW5lU3RyaW5nKVxuICAgICAgICAgICAgICAgICAgICAgICAgXCJNdWx0aVBvbHlnb25cIiAtPiBwYXJzZU11bHRpUG9seWdvbihjb29yZGluYXRlcykubGV0KGhhbmRsZXI6Om9uTXVsdGlQb2x5Z29uKVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiBlcnJvcihcIk5vdCBzdXBwb3J0IEdlb0pzb24gdHlwZTogJHR5cGVcIilcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHBhcnNlUG9pbnQoanNvblBvaW50OiBGbHVlbnRBcnJheSk6IFZlYzxUPiB7XG4gICAgICAgICAgICByZXR1cm4gZXhwbGljaXRWZWM8VD4oXG4gICAgICAgICAgICAgICAganNvblBvaW50LmdldERvdWJsZShMT05fSU5ERVgpLFxuICAgICAgICAgICAgICAgIGpzb25Qb2ludC5nZXREb3VibGUoTEFUX0lOREVYKVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gcGFyc2VMaW5lU3RyaW5nKGpzb25MaW5lU3RyaW5nOiBGbHVlbnRBcnJheSk6IExpbmVTdHJpbmc8VD4ge1xuICAgICAgICAgICAgcmV0dXJuIGpzb25MaW5lU3RyaW5nLm1hcEFycmF5KHRoaXM6OnBhcnNlUG9pbnQpLmxldCg6OkxpbmVTdHJpbmcpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBwYXJzZVJpbmcoanNvblJpbmc6IEZsdWVudEFycmF5KTogUmluZzxUPiB7XG4gICAgICAgICAgICByZXR1cm4ganNvblJpbmcubWFwQXJyYXkodGhpczo6cGFyc2VQb2ludCkubGV0KDo6UmluZylcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHBhcnNlTXVsdGlQb2ludChqc29uTXVsdGlQb2ludDogRmx1ZW50QXJyYXkpOiBNdWx0aVBvaW50PFQ+IHtcbiAgICAgICAgICAgIHJldHVybiBqc29uTXVsdGlQb2ludC5tYXBBcnJheSh0aGlzOjpwYXJzZVBvaW50KS5sZXQoOjpNdWx0aVBvaW50KVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gcGFyc2VQb2x5Z29uKGpzb25Qb2x5Z29uOiBGbHVlbnRBcnJheSk6IFBvbHlnb248VD4ge1xuICAgICAgICAgICAgcmV0dXJuIGpzb25Qb2x5Z29uLm1hcEFycmF5KHRoaXM6OnBhcnNlUmluZykubGV0KDo6UG9seWdvbilcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHBhcn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gICAgICAgIHZhbCBpbnRlcm5hbFJhbmdlcyA9IGxvbmdpdHVkZVNlZ21lbnQuc3BsaXRCeUFudGlNZXJpZGlhbigpXG5cbiAgICAgICAgZm9yIChpbnRlcm5hbFJhbmdlIGluIGludGVybmFsUmFuZ2VzKSB7XG4gICAgICAgICAgICBpZiAoIWRpc2pvaW50UmFuZ2VzRW5jbG9zZVJhbmdlKFxuICAgICAgICAgICAgICAgICAgICBleHRlcm5hbFJhbmdlcyxcbiAgICAgICAgICAgICAgICAgICAgaW50ZXJuYWxSYW5nZVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0cnVlXG4gICAgfVxuXG4gICAgZnVuIGludmVydCgpOiBMb25naXR1ZGVTZWdtZW50IHtcbiAgICAgICAgcmV0dXJuIExvbmdpdHVkZVNlZ21lbnQobXlFbmQsIG15U3RhcnQpXG4gICAgfVxuXG4gICAgZnVuIHNwbGl0QnlBbnRpTWVyaWRpYW4oKTogTGlzdDxDbG9zZWRSYW5nZTxEb3VibGU+PiB7XG4gICAgICAgIHJldHVybiBzcGxpdFNlZ21lbnQoXG4gICAgICAgICAgICBteVN0YXJ0LCBteUVuZCxcbiAgICAgICAgICAgIE1JTl9MT05HSVRVREUsXG4gICAgICAgICAgICBNQVhfTE9OR0lUVURFXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gZXF1YWxzKG90aGVyOiBBbnk/KTogQm9vbGVhbiB7XG4gICAgICAgIGlmICh0aGlzID09PSBvdGhlcikgcmV0dXJuIHRydWVcbiAgICAgICAgaWYgKG90aGVyID09IG51bGwgfHwgdGhpczo6Y2xhc3MgIT0gb3RoZXI6OmNsYXNzKSByZXR1cm4gZmFsc2VcbiAgICAgICAgdmFsIHRoYXQgPSBvdGhlciBhcyBMb25naXR1ZGVTZWdtZW50XG4gICAgICAgIHJldHVybiB0aGF0Lm15U3RhcnQuZXF1YWxzKG15U3RhcnQpICYmIHRoYXQubXlFbmQuZXF1YWxzKG15RW5kKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBoYXNoQ29kZSgpOiBJbnQge1xuICAgICAgICByZXR1cm4gbGlzdE9mKG15U3RhcnQsIG15RW5kKS5oYXNoQ29kZSgpXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGZ1biBzcGxpdFNlZ21lbnQoXG4gICAgICAgICAgICBzdGFydDogRG91YmxlLFxuICAgICAgICAgICAgZW5kOiBEb3VibGUsXG4gICAgICAgICAgICBtaW46IERvdWJsZSxcbiAgICAgICAgICAgIG1heDogRG91YmxlXG4gICAgICAgICkgOiBMaXN0PENsb3NlZFJhbmdlPERvdWJsZT4+IHtcbiAgICAgICAgICAgIHJldHVybiBpZiAoc3RhcnQgPD0gZW5kKSB7XG4gICAgICAgICAgICAgICAgbGlzdE9mKENsb3NlZFJhbmdlKHN0YXJ0LCBlbmQpKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBsaXN0T2YoXG4gICAgICAgICAgICAgICAgICAgIENsb3NlZFJhbmdlKHN0YXJ0LCBtYXgpLFxuICAgICAgICAgICAgICAgICAgICBDbG9zZWRSYW5nZShtaW4sIGVuZClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBkaXNqb2ludFJhbmdlc0VuY2xvc2VSYW5nZShcbiAgICAgICAgICAgIHJhbmdlczogTGlzdDxDbG9zZWRSYW5nZTxEb3VibGU+PixcbiAgICAgICAgICAgIGludGVybmFsUmFuZ2U6IENsb3NlZFJhbmdlPERvdWJsZT5cbiAgICAgICAgKTogQm9vbGVhbiB7XG4gICAgICAgICAgICBmb3IgKHJhbmdlIGluIHJhbmdlcykge1xuICAgICAgICAgICAgICAgIGlmI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5pdCB7XG4gICAgICAgIGZ1biBpbml0TnVtYmVyRm9ybWF0KHBhdHRlcm46IFN0cmluZyk6IE51bWJlckZvcm1hdCB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXJGb3JtYXQocGF0dGVybilcbiAgICAgICAgICAgIH0gY2F0Y2ggKGU6IEV4Y2VwdGlvbikge1xuICAgICAgICAgICAgICAgIGVycm9yKFwiV3JvbmcgbnVtYmVyIHBhdHRlcm46ICRwYXR0ZXJuXCIpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBteU51bWJlckZvcm1hdHRlcnMgPSB3aGVuIChmb3JtYXRUeXBlKSB7XG4gICAgICAgICAgICBGb3JtYXRUeXBlLk5VTUJFUl9GT1JNQVQgLT4gbGlzdE9mKGluaXROdW1iZXJGb3JtYXQocGF0dGVybikpXG4gICAgICAgICAgICBGb3JtYXRUeXBlLlNUUklOR19GT1JNQVQgLT4ge1xuICAgICAgICAgICAgICAgIEJSQUNFU19SRUdFWC5maW5kQWxsKHBhdHRlcm4pXG4gICAgICAgICAgICAgICAgICAgIC5tYXAgeyBpdC5ncm91cFZhbHVlc1tURVhUX0lOX0JSQUNFU10gfVxuICAgICAgICAgICAgICAgICAgICAubWFwIHsgZm9ybWF0IC0+XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZm9ybWF0LmlzTm90RW1wdHkoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXROdW1iZXJGb3JtYXQoZm9ybWF0KVxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgLnRvTGlzdCgpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICB2YWwgYXJnc051bWJlciA9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gICAgICAgICAgICBhcmdDb3VudDogSW50LFxuICAgICAgICAgICAgZm9ybWF0Rm9yOiBTdHJpbmc/ID0gbnVsbFxuICAgICAgICApOiBTdHJpbmdGb3JtYXQge1xuICAgICAgICAgICAgcmV0dXJuIGNyZWF0ZShwYXR0ZXJuLCB0eXBlLCBmb3JtYXRGb3IsIGFyZ0NvdW50KVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGNyZWF0ZShcbiAgICAgICAgICAgIHBhdHRlcm46IFN0cmluZyxcbiAgICAgICAgICAgIHR5cGU6IEZvcm1hdFR5cGU/ID0gbnVsbCxcbiAgICAgICAgICAgIGZvcm1hdEZvcjogU3RyaW5nPyA9IG51bGwsXG4gICAgICAgICAgICBleHBlY3RlZEFyZ3M6IEludCA9IC0xXG4gICAgICAgICk6IFN0cmluZ0Zvcm1hdCB7XG4gICAgICAgICAgICB2YWwgZm9ybWF0VHlwZSA9IHdoZW4ge1xuICAgICAgICAgICAgICAgIHR5cGUgIT0gbnVsbCAtPiB0eXBlXG4gICAgICAgICAgICAgICAgTnVtYmVyRm9ybWF0LmlzVmFsaWRQYXR0ZXJuKHBhdHRlcm4pIC0+IEZvcm1hdFR5cGUuTlVNQkVSX0ZPUk1BVFxuICAgICAgICAgICAgICAgIGVsc2UgLT4gRm9ybWF0VHlwZS5TVFJJTkdfRk9STUFUXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBTdHJpbmdGb3JtYXQocGF0dGVybiwgZm9ybWF0VHlwZSkuYWxzbyB7XG4gICAgICAgICAgICAgICAgaWYgKGV4cGVjdGVkQXJncyA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZShpdC5hcmdzTnVtYmVyID09IGV4cGVjdGVkQXJncykge1xuICAgICAgICAgICAgICAgICAgICAgICAgQFN1cHByZXNzKFwiTkFNRV9TSEFET1dJTkdcIilcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBmb3JtYXRGb3IgPSBmb3JtY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AgICBpbml0IHtcbiAgICAgICAgcmVxdWlyZShcbiAgICAgICAgICAgIDAgPD0gcmVkICYmIHJlZCA8PSAyNTUgJiZcbiAgICAgICAgICAgICAgICAgICAgMCA8PSBncmVlbiAmJiBncmVlbiA8PSAyNTUgJiZcbiAgICAgICAgICAgICAgICAgICAgMCA8PSBibHVlICYmIGJsdWUgPD0gMjU1ICYmXG4gICAgICAgICAgICAgICAgICAgIDAgPD0gYWxwaGEgJiYgYWxwaGEgPD0gMjU1XG4gICAgICAgICkgeyBcIkNvbG9yIGNvbXBvbmVudHMgb3V0IG9mIHJhbmdlOiAkdGhpc1wiIH1cbiAgICB9XG5cbiAgICBmdW4gY2hhbmdlQWxwaGEobmV3QWxwaGE6IEludCk6IENvbG9yIHtcbiAgICAgICAgcmV0dXJuIENvbG9yKHJlZCwgZ3JlZW4sIGJsdWUsIG5ld0FscGhhKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBlcXVhbHMob3RoZXI6IEFueT8pOiBCb29sZWFuIHtcbiAgICAgICAgaWYgKHRoaXMgPT09IG90aGVyKSB7XG4gICAgICAgICAgICByZXR1cm4gdHJ1ZVxuICAgICAgICB9XG4gICAgICAgIGlmIChvdGhlciAhaXMgQ29sb3IpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHJlZCAhPSBvdGhlci5yZWQpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICB9XG4gICAgICAgIGlmIChncmVlbiAhPSBvdGhlci5ncmVlbikge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGJsdWUgIT0gb3RoZXIuYmx1ZSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGFscGhhID09IG90aGVyLmFscGhhXG4gICAgfVxuXG4gICAgZnVuIHRvQ3NzQ29sb3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09IENPTE9SIC0+IHRoaXJkQ29tbWEgPSB0ZXh0LmluZGV4T2YoXCIsXCIsIHNlY29uZENvbW1hICsgMSlcbiAgICAgICAgICAgICAgICBwcmVmaXggIT0gUkdCIC0+IHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbih0ZXh0KVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgbGFzdFBhcmVuID0gZmluZE5leHQodGV4dCwgXCIpXCIsIHRoaXJkQ29tbWEgKyAxKVxuICAgICAgICAgICAgdmFsIHJlZCA9IHRleHQuc3Vic3RyaW5nKGZpcnN0UGFyZW4gKyAxLCBmaXJzdENvbW1hKS50cmltIHsgaXQgPD0gJyAnIH0udG9JbnQoKVxuICAgICAgICAgICAgdmFsIGdyZWVuID0gdGV4dC5zdWJzdHJpbmcoZmlyc3RDb21tYSArIDEsIHNlY29uZENvbW1hKS50cmltIHsgaXQgPD0gJyAnIH0udG9JbnQoKVxuXG4gICAgICAgICAgICB2YWwgYmx1ZTogSW50XG4gICAgICAgICAgICB2YWwgYWxwaGE6IEludFxuICAgICAgICAgICAgaWYgKHRoaXJkQ29tbWEgPT0gLTEpIHtcbiAgICAgICAgICAgICAgICBibHVlID0gdGV4dC5zdWJzdHJpbmcoc2Vjb25kQ29tbWEgKyAxLCBsYXN0UGFyZW4pLnRyaW0geyBpdCA8PSAnICcgfS50b0ludCgpXG4gICAgICAgICAgICAgICAgYWxwaGEgPSAyNTVcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgYmx1ZSA9IHRleHQuc3Vic3RyaW5nKHNlY29uZENvbW1hICsgMSwgdGhpcmRDb21tYSkudHJpbSB7IGl0IDw9ICcgJyB9LnRvSW50KClcbiAgICAgICAgICAgICAgICBhbHBoYSA9ICh0ZXh0LnN1YnN0cmluZyh0aGlyZENvbW1hICsgMSwgbGFzdFBhcmVuKS50cmltIHsgaXQgPD0gJyAnIH0udG9GbG9hdCgpICogMjU1KS5yb3VuZFRvSW50KClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIENvbG9yKHJlZCwgZ3JlZW4sIGJsdWUsIGFscGhhKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZmluZE5leHQoczogU3RyaW5nLCB3aGF0OiBTdHJpbmcsIGZyb206IEludCk6IEludCB7XG4gICAgICAgICAgICB2YWwgcmVzdWx0ID0gcy5pbmRleE9mKHdoYXQsIGZyb20pXG4gICAgICAgICAgICBpZiAocmVzdWx0ID09IC0xKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwidGV4dD0kcyB3aGF0PSR3aGF0IGZyb209JGZyb21cIilcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiByZXN1bHRcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBwYXJzZUhleChoZXhDb2xvcjogU3RyaW5nKTogQ29sb3Ige1xuICAgICAgICAgICAgQFN1cHByZXNzKFwiTkFNRV9TSEFET1dJTkdcIilcbiAgICAgICAgICAgIHZhciBoZXhDb2xvciA9IGhleENvbG9yXG4gICAgICAgICAgICBpZiAoIWhleENvbG9yLnN0YXJ0c1dpdGgoXCIjXCIpKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiTm90IGEgSEVYIHZhbHVlOiAkaGV4Q29sb3JcIilcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGhleENvbG9yID0gaGV4Q29sb3Iuc3Vic3RyaW5nKDEpXG4gICAgICAgICAgICBpZiAoaGV4Q29sb3IubGVuZ3RoICE9IDYpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oXCJOb3QgYSBIRVggdmFsdWU6ICRoZXhDb2xvclwiKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFsIHIgPS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ICAgICAgXCJ3aGl0ZVwiIHRvIENvbG9yLldISVRFLFxuICAgICAgICBcImJsYWNrXCIgdG8gQ29sb3IuQkxBQ0ssXG4gICAgICAgIFwiZ3JheVwiIHRvIENvbG9yLkdSQVksXG4gICAgICAgIFwicmVkXCIgdG8gQ29sb3IuUkVELFxuICAgICAgICBcImdyZWVuXCIgdG8gQ29sb3IuR1JFRU4sXG4gICAgICAgIFwiYmx1ZVwiIHRvIENvbG9yLkJMVUUsXG4gICAgICAgIFwieWVsbG93XCIgdG8gQ29sb3IuWUVMTE9XLFxuICAgICAgICBcIm1hZ2VudGFcIiB0byBDb2xvci5NQUdFTlRBLFxuICAgICAgICBcImN5YW5cIiB0byBDb2xvci5DWUFOLFxuICAgICAgICBcIm9yYW5nZVwiIHRvIENvbG9yLk9SQU5HRSxcbiAgICAgICAgXCJwaW5rXCIgdG8gQ29sb3IuUElOS1xuICAgICkgK1xuICAgICAgICAgICAgLy8gbGlnaHRfZ3JheVxuICAgICAgICAgICAgdmFyaWFudENvbG9ycyArXG4gICAgICAgICAgICAvLyBsaWdodC1ncmF5XG4gICAgICAgICAgICB2YXJpYW50Q29sb3JzLm1hcEtleXMgeyBpdC5rZXkucmVwbGFjZSgnXycsICctJykgfSArXG4gICAgICAgICAgICAvLyBsaWdodGdyYXlcbiAgICAgICAgICAgIHZhcmlhbnRDb2xvcnMubWFwS2V5cyB7IGl0LmtleS5yZXBsYWNlKFwiX1wiLCBcIlwiKSB9XG5cblxuICAgIC8qKlxuICAgICAqIEBwYXJhbSBjIGNvbG9yIHN0cmluZyB0byBwYXJzZS4gQWNjZXB0ZWQgZm9ybWF0czpcbiAgICAgKiAgICAgLSByZ2IociwgZywgYilcbiAgICAgKiAgICAgLSByZ2JhKHIsIGcsIGIsIGEpXG4gICAgICogICAgIC0gY29sb3IociwgZywgYiwgYSlcbiAgICAgKiAgICAgLSAjcnJnZ2JiXG4gICAgICogICAgIC0gd2hpdGUsIGdyZWVuIGV0Yy5cbiAgICAgK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xuICAgICAqIEBwYXJhbSBzIHNhdHVyYXRpb24sIFswLCAxXVxuICAgICAqIEBwYXJhbSB2IHZhbHVlLCBbMCwgMV1cbiAgICAgKi9cbiAgICBASnZtT3ZlcmxvYWRzXG4gICAgZnVuIHJnYkZyb21Ic3YoaDogRG91YmxlLCBzOiBEb3VibGUsIHY6IERvdWJsZSA9IDEuMCk6IENvbG9yIHtcbiAgICAgICAgdmFsIGhkID0gaCAvIDYwXG4gICAgICAgIHZhbCBjID0gdiAqIHNcbiAgICAgICAgdmFsIHggPSBjICogKDEgLSBhYnMoaGQgJSAyIC0gMSkpXG5cbiAgICAgICAgdmFyIHIgPSAwLjBcbiAgICAgICAgdmFyIGcgPSAwLjBcbiAgICAgICAgdmFyIGIgPSAwLjBcblxuICAgICAgICB3aGVuIHtcbiAgICAgICAgICAgIGhkIDwgMSAtPiB7XG4gICAgICAgICAgICAgICAgciA9IGNcbiAgICAgICAgICAgICAgICBnID0geFxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaGQgPCAyIC0+IHtcbiAgICAgICAgICAgICAgICByID0geFxuICAgICAgICAgICAgICAgIGcgPSBjXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBoZCA8IDMgLT4ge1xuICAgICAgICAgICAgICAgIGcgPSBjXG4gICAgICAgICAgICAgICAgYiA9IHhcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGhkIDwgNCAtPiB7XG4gICAgICAgICAgICAgICAgZyA9IHhcbiAgICAgICAgICAgICAgICBiID0gY1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaGQgPCA1IC0+IHtcbiAgICAgICAgICAgICAgICByID0geFxuICAgICAgICAgICAgICAgIGIgPSBjXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIC0+IHtcbiAgICAgICAgICAgICAgICByID0gY1xuICAgICAgICAgICAgICAgIGIgPSB4XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbSA9IHYgLSBjXG4gICAgICAgIHJldHVybiBDb2xvcigoMjU1ICogKHIgKyBtKSkudG9JbnQoKSwgKDI1NSAqIChnICsgbSkpLnRvSW50KCksICgyNTUgKiAoYiArIG0pKS50b0ludCgpKVxuICAgIH1cblxuICAgIGZ1biBoc3ZGcm9tUmdiKGNvbG9yOiBDb2xvcik6IERvdWJsZUFycmF5IHtcbiAgICAgICAgdmFsIHNjYWxlID0gKDFmIC8gMjU1KS50b0RvdWJsZSgpXG4gICAgICAgIHZhbCByID0gY29sb3IucmVkICogc2NhbGVcbiAgICAgICAgdmFsIGcgPSBjb2xvci5ncmVlbiAqIHNjYWxlXG4gICAgICAgIHZhbCBiID0gY29sb3IuYmx1ZSAqIHNjYWxlXG4gICAgICAgIHZhbCBtaW4gPSBtaW4ociwgbWluKGcsIGIpKVxuICAgICAgICB2YWwgbWF4ID0gbWF4KHIsIG1heChnLCBiKSlcblxuICAgICAgICB2YWwgdiA9IGlmIChtYXggPT0gMC4wKSAwLjAgZWxzZSAxIC0gbWluIC8gbWF4XG4gICAgICAgIHZhbCBoOiBEb3VibGVcbiAgICAgICAgdmFsIGRpdiA9IDFmIC8gKDYgKiAobWF4IC0gbWluKSlcblxuICAgICAgICBoID0gaWYgKG1heCA9PSBtaW4pIHtcbiAgICAgICAgICAgIDAuMFxuICAgICAgICB9IGVsc2UgaWYgKG1heCA9PSByKSB7XG4gICAgICAgICAgICBpZiAoZyA+PSBiKSAoZyAtIGIpICogZGl2IGVsc2UgMSArIChnIC0gYikgKiBkaXZcbiAgICAgICAgfSBlbHNlIGlmIChtYXggPT0gZykge1xuICAgICAgICAgICAgMWYgLyAzICsgKGIgLSByKSAqIGRpdlxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgMmYgLyAzICsgKHIgLSBnKSAqIGRpdlxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGRvdWJsZUFycmF5T2YoMzYwICogaCwgdiwgbWF4KVxuICAgIH1cblxuICAgIEBKdm1PdmVybG9hZHNcbiAgICBmdW4gZGFya2VyKGM6IENvbG9yPywgZmFjdG9yOiBEb3VibGUgPSBERUZBVUxUX0ZBQ1RPUik6IENvbG9yPyB7XG4gICAgICAgIHJldHVybiBjPy5sZXQge1xuICAgICAgICAgICAgQ29sb3IoXG4gICAgICAgICAgICAgICAgbWF4KChjLnJlZCAqIGZhY3RvcikudG9JbnQoKSwgMCksXG4gICAgICAgICAgICAgICAgbWF4KChjLmdyZWVuICogZmFjdG9yKS50b0ludCgpLCAwKSxcbiAgICAgICAgICAgICAgICBtYXgoKGMuYmx1ZSAqIGZhY3RvcikudG9JbnQoKSwgMCksXG4gICAgICAgICAgICAgICAgYy5hbHBoYVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgQEp2bU92ZXJsb2Fkc1xuICAgIGZ1biBsaWdodGVyKGM6IENvbG9yLCBmYWN0b3I6IERvdWJsZSA9IERFRkFVTFRfRkFDVE9SKTogQ29sb3Ige1xuICAgICAgICB2YXIgciA9IGMucmVkXG4gICAgICAgIHZhciBnID0gYy5ncmVlblxuICAgICAgICB2YXIgYiA9IGMuYmx1ZVxuICAgICAgICB2YWwgYWxwaGEgPSBjLmFscGhhXG5cbiAgICAgICAgdmFsIGkgPSAoMS4wIC8gKDEuMCAtIGZhY3RvcikpLnRvSW50KClcbiAgICAgICAgaWYgKHIgPT0gMCAmJiBnID09IDAgJiYgYiA9PSAwKSB7XG4gICAgICAgICAgICByZXR1cm4gQ29sb3IoaSwgaSwgaSwgYWxwaGEpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKHIgPiAwICYmIHIgPCBpKSByID0gaVxuICAgICAgICBpZiAoZyA+IDAgJiYgZyA8IGkpIGcgPSBpXG4gICAgICAgIGlmIChiID4gMCAmJiBiIDwgaSkgYiA9IGlcblxuICAgICAgICByZXR1cm4gQ29sb3IoXG4gICAgICAgICAgICBtaW4oKHIgLyBmYWN0b3IpLnRvSW50KCksIDI1NSksXG4gICAgICAgICAgICBtaW4oKGcgLyBmYWN0b3IpLnRvSW50KCksIDI1NSksXG4gICAgICAgICAgICBtaW4oKGIgLyBmYWN0b3IpLnRvSW50KCksIDI1NSksXG4gICAgICAgICAgICBhbHBoYVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIG1pbWljVHJhbnNwYXJlbmN5KGNvbG9yOiBDb2xvciwgYWxwaGE6IERvdWJsZSwgYmFja2dyb3VuZDogQ29sb3IpOiBDb2xvciB7XG4gICAgICAgIHZhbCByZWQgPSAoY29sb3IucmVkICogYWxwaGEgKyBiYWNrZ3JvdW5kLnJlZCAqICgxIC0gYWxwaGEpKS50b0ludCgpXG4gICAgICAgIHZhbCBncmVlbiA9IChjb2xvci5ncmVlbiAqIGFscGhhICsgYmFja2dyb3VuZC5ncmVlbiAqICgxIC0gYWxwaGEpKS50b0ludCgpXG4gICAgICAgIHZhbCBibHVlID0gKGNvbG9yLmJsdWUgKiBhbHBoYSArIGJhY2tncm91bmQuYmx1ZSAqICgxIC0gYWxwaGEpKS50b0ludCgpXG4gICAgICAgIHJldHVybiBDb2xvcihyZWQsIGdyZWVuLCBibHVlKVxuICAgIH1cblxuICAgIGZ1biB3aXRoT3BhY2l0eShjOiBDb2xvciwgb3BhY2l0eTogRG91YmxlKTogQ29sb3Ige1xuICAgICAgICByZXR1cm4gaWYgKG9wYWNpdHkgPCAxLjApIHtcbiAgICAgICAgICAgIGMuY2hhbmdlQWxwaGEobWF4KDAsIG1pbigyNTUsIHJvdW5kKDI1NSAqIG9wYWNpdHkpLnRvSW50KCkpKSlcbiAgICAgICAgfSBlbHNlIGNcbiAgICB9XG5cbiAgICBmdW4gY29udHJhc3QoY29sb3I6IENvbG9yLCBvdGhlcjogQ29sb3IpOiBEb3VibGUge1xuICAgICAgICByZXR1cm4gKGx1bWluYW5jZShjb2xvcikgKyAuMDUpIC8gKGx1bWluYW5jZShvdGhlcikgKyAuMDUpXG4gICAgfVxuXG4gICAgZnVuIGx1bWluYW5jZShjb2xvcjogQ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mb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlLlxuICovXG5cbnBhY2thZ2UgamV0YnJhaW5zLmRhdGFsb3JlLmJhc2Uuc3BhdGlhbFxuXG5jb25zdCB2YWwgRUFSVEhfUkFESVVTID0gNjM3ODEzNy4wXG5jb25zdCB2YWwgTUlOX0xPTkdJVFVERSA9IC0xODAuMFxuY29uc3QgdmFsIE1BWF9MT05HSVRVREUgPSAxODAuMFxuY29uc3QgdmFsIEZVTExfTE9OR0lUVURFID0gTUFYX0xPTkdJVFVERSAtIE1JTl9MT05HSVRVREVcbmNvbnN0IHZhbCBNSU5fTEFUSVRVREUgPSAtOTAuMFxuY29uc3QgdmFsIE1BWF9MQVRJVFVERSA9IDkwLjBcbmNvbnN0IHZhbCBGVUxMX0xBVElUVURFID0gTUFYX0xBVElUVURFIC0gTUlOX0xBVElUVURFXG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./kotlin-dce-dev/lets-plot-base-portable.js\n"); +eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) {\n if (true)\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(/*! kotlin */ \"./kotlin-dce-dev/kotlin.js\"), __webpack_require__(/*! kotlin-logging-jsLegacy */ \"./kotlin-dce-dev/kotlin-logging-jsLegacy.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n else {}\n}(this, function (_, Kotlin, $module$kotlin_logging_jsLegacy) {\n 'use strict';\n var toMutableList = Kotlin.kotlin.collections.toMutableList_4c7yge$;\n var last = Kotlin.kotlin.collections.last_2p1efm$;\n var get_lastIndex = Kotlin.kotlin.collections.get_lastIndex_55thoc$;\n var first = Kotlin.kotlin.collections.first_2p1efm$;\n var plus = Kotlin.kotlin.collections.plus_qloxvw$;\n var equals = Kotlin.equals;\n var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_287e2$;\n var getPropertyCallableRef = Kotlin.getPropertyCallableRef;\n var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$;\n var ArrayList_init_0 = Kotlin.kotlin.collections.ArrayList_init_ww73n8$;\n var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init_pdl1vj$;\n var JsMath = Math;\n var to = Kotlin.kotlin.to_ujzrz7$;\n var mapOf = Kotlin.kotlin.collections.mapOf_qfcya0$;\n var Kind_OBJECT = Kotlin.Kind.OBJECT;\n var Kind_CLASS = Kotlin.Kind.CLASS;\n var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init_pdl1vj$;\n var joinToString = Kotlin.kotlin.collections.joinToString_fmv235$;\n var until = Kotlin.kotlin.ranges.until_dqglrj$;\n var substring = Kotlin.kotlin.text.substring_fc3b62$;\n var padStart = Kotlin.kotlin.text.padStart_vrc1nu$;\n var Map = Kotlin.kotlin.collections.Map;\n var throwCCE = Kotlin.throwCCE;\n var Enum = Kotlin.kotlin.Enum;\n var throwISE = Kotlin.throwISE;\n var Regex_init = Kotlin.kotlin.text.Regex_init_61zpoe$;\n var IllegalArgumentException_init_0 = Kotlin.kotlin.IllegalArgumentException_init;\n var ensureNotNull = Kotlin.ensureNotNull;\n var hashCode = Kotlin.hashCode;\n var StringBuilder_init = Kotlin.kotlin.text.StringBuilder_init;\n var RuntimeException_init = Kotlin.kotlin.RuntimeException_init;\n var toInt = Kotlin.kotlin.text.toInt_pdl1vz$;\n var Comparable = Kotlin.kotlin.Comparable;\n var toString = Kotlin.toString;\n var L0 = Kotlin.Long.ZERO;\n var L1 = Kotlin.Long.ONE;\n var L1000 = Kotlin.Long.fromInt(1000);\n var L60 = Kotlin.Long.fromInt(60);\n var L24 = Kotlin.Long.fromInt(24);\n var L7 = Kotlin.Long.fromInt(7);\n var contains = Kotlin.kotlin.text.contains_li3zpu$;\n var NumberFormatException = Kotlin.kotlin.NumberFormatException;\n var Kind_INTERFACE = Kotlin.Kind.INTERFACE;\n var L_5 = Kotlin.Long.fromInt(-5);\n var L4 = Kotlin.Long.fromInt(4);\n var L3 = Kotlin.Long.fromInt(3);\n var L60000 = Kotlin.Long.fromInt(60000);\n var L3600000 = Kotlin.Long.fromInt(3600000);\n var L86400000 = Kotlin.Long.fromInt(86400000);\n var defineInlineFunction = Kotlin.defineInlineFunction;\n var wrapFunction = Kotlin.wrapFunction;\n var HashMap_init = Kotlin.kotlin.collections.HashMap_init_bwtc7$;\n var IllegalStateException_init_0 = Kotlin.kotlin.IllegalStateException_init;\n var unboxChar = Kotlin.unboxChar;\n var toChar = Kotlin.toChar;\n var emptyList = Kotlin.kotlin.collections.emptyList_287e2$;\n var HashSet_init = Kotlin.kotlin.collections.HashSet_init_mqih57$;\n var asList = Kotlin.kotlin.collections.asList_us0mfu$;\n var listOf = Kotlin.kotlin.collections.listOf_i5x0yv$;\n var copyToArray = Kotlin.kotlin.collections.copyToArray;\n var HashSet_init_0 = Kotlin.kotlin.collections.HashSet_init_287e2$;\n var NullPointerException_init = Kotlin.kotlin.NullPointerException_init;\n var IllegalArgumentException = Kotlin.kotlin.IllegalArgumentException;\n var NoSuchElementException_init = Kotlin.kotlin.NoSuchElementException_init;\n var isFinite = Kotlin.kotlin.isFinite_yrwdxr$;\n var IndexOutOfBoundsException = Kotlin.kotlin.IndexOutOfBoundsException;\n var toList = Kotlin.kotlin.collections.toList_7wnvza$;\n var count = Kotlin.kotlin.collections.count_7wnvza$;\n var Collection = Kotlin.kotlin.collections.Collection;\n var plus_0 = Kotlin.kotlin.collections.plus_q4559j$;\n var List = Kotlin.kotlin.collections.List;\n var last_0 = Kotlin.kotlin.collections.last_7wnvza$;\n var ArrayList_init_1 = Kotlin.kotlin.collections.ArrayList_init_mqih57$;\n var reverse = Kotlin.kotlin.collections.reverse_vvxzk3$;\n var Comparator = Kotlin.kotlin.Comparator;\n var sortWith = Kotlin.kotlin.collections.sortWith_iwcb0m$;\n var toList_0 = Kotlin.kotlin.collections.toList_us0mfu$;\n var reversed = Kotlin.kotlin.comparisons.reversed_2avth4$;\n var naturalOrder = Kotlin.kotlin.comparisons.naturalOrder_dahdeg$;\n var lastOrNull = Kotlin.kotlin.collections.lastOrNull_2p1efm$;\n var binarySearch = Kotlin.kotlin.collections.binarySearch_jhx6be$;\n var HashMap_init_0 = Kotlin.kotlin.collections.HashMap_init_q3lmfv$;\n var abs = Kotlin.kotlin.math.abs_za3lpa$;\n var Unit = Kotlin.kotlin.Unit;\n var getCallableRef = Kotlin.getCallableRef;\n var map = Kotlin.kotlin.sequences.map_z5avom$;\n var numberToInt = Kotlin.numberToInt;\n var toMutableMap = Kotlin.kotlin.collections.toMutableMap_abgq59$;\n var throwUPAE = Kotlin.throwUPAE;\n var kotlin_js_internal_BooleanCompanionObject = Kotlin.kotlin.js.internal.BooleanCompanionObject;\n var first_0 = Kotlin.kotlin.collections.first_7wnvza$;\n var asSequence = Kotlin.kotlin.collections.asSequence_7wnvza$;\n var drop = Kotlin.kotlin.sequences.drop_wuwhe2$;\n var isWhitespace = Kotlin.kotlin.text.isWhitespace_myv2d0$;\n var toBoxedChar = Kotlin.toBoxedChar;\n var contains_0 = Kotlin.kotlin.collections.contains_o2f9me$;\n var CharRange = Kotlin.kotlin.ranges.CharRange;\n var iterator = Kotlin.kotlin.text.iterator_gw00vp$;\n var toDouble = Kotlin.kotlin.text.toDouble_pdl1vz$;\n var Exception_init = Kotlin.kotlin.Exception_init_pdl1vj$;\n var Exception = Kotlin.kotlin.Exception;\n var LinkedHashMap_init = Kotlin.kotlin.collections.LinkedHashMap_init_q3lmfv$;\n var MutableMap = Kotlin.kotlin.collections.MutableMap;\n var toSet = Kotlin.kotlin.collections.toSet_7wnvza$;\n var StringBuilder = Kotlin.kotlin.text.StringBuilder;\n var toString_0 = Kotlin.kotlin.text.toString_dqglrj$;\n var toInt_0 = Kotlin.kotlin.text.toInt_6ic1pp$;\n var numberToDouble = Kotlin.numberToDouble;\n var equals_0 = Kotlin.kotlin.text.equals_igcy3c$;\n var NoSuchElementException_init_0 = Kotlin.kotlin.NoSuchElementException;\n var Any = Object;\n var AbstractMutableSet = Kotlin.kotlin.collections.AbstractMutableSet;\n var AbstractCollection = Kotlin.kotlin.collections.AbstractCollection;\n var AbstractSet = Kotlin.kotlin.collections.AbstractSet;\n var MutableIterator = Kotlin.kotlin.collections.MutableIterator;\n var Array_0 = Array;\n var println = Kotlin.kotlin.io.println_s8jyv4$;\n var math = Kotlin.kotlin.math;\n var round = Kotlin.kotlin.math.round_14dthe$;\n var toLong = Kotlin.kotlin.text.toLong_pdl1vz$;\n var coerceAtLeast = Kotlin.kotlin.ranges.coerceAtLeast_dqglrj$;\n var toIntOrNull = Kotlin.kotlin.text.toIntOrNull_pdl1vz$;\n var repeat = Kotlin.kotlin.text.repeat_94bcnn$;\n var trimEnd = Kotlin.kotlin.text.trimEnd_wqw3xr$;\n var isNaN_0 = Kotlin.kotlin.isNaN_yrwdxr$;\n var kotlin_js_internal_DoubleCompanionObject = Kotlin.kotlin.js.internal.DoubleCompanionObject;\n var slice = Kotlin.kotlin.text.slice_fc3b62$;\n var startsWith = Kotlin.kotlin.text.startsWith_sgbm27$;\n var roundToLong = Kotlin.kotlin.math.roundToLong_yrwdxr$;\n var toString_1 = Kotlin.kotlin.text.toString_if0zpk$;\n var padEnd = Kotlin.kotlin.text.padEnd_vrc1nu$;\n var get_sign = Kotlin.kotlin.math.get_sign_s8ev3n$;\n var coerceAtLeast_0 = Kotlin.kotlin.ranges.coerceAtLeast_38ydlf$;\n var coerceAtMost = Kotlin.kotlin.ranges.coerceAtMost_38ydlf$;\n var asSequence_0 = Kotlin.kotlin.text.asSequence_gw00vp$;\n var plus_1 = Kotlin.kotlin.sequences.plus_v0iwhp$;\n var indexOf = Kotlin.kotlin.text.indexOf_l5u8uk$;\n var chunked = Kotlin.kotlin.sequences.chunked_wuwhe2$;\n var joinToString_0 = Kotlin.kotlin.sequences.joinToString_853xkz$;\n var reversed_0 = Kotlin.kotlin.text.reversed_gw00vp$;\n var MutableCollection = Kotlin.kotlin.collections.MutableCollection;\n var AbstractMutableList = Kotlin.kotlin.collections.AbstractMutableList;\n var MutableList = Kotlin.kotlin.collections.MutableList;\n var Throwable = Error;\n var plus_2 = Kotlin.kotlin.collections.plus_mydzjv$;\n var Random = Kotlin.kotlin.random.Random;\n var random = Kotlin.kotlin.collections.random_iscd7z$;\n var arrayListOf = Kotlin.kotlin.collections.arrayListOf_i5x0yv$;\n var minOrNull = Kotlin.kotlin.sequences.minOrNull_1bslqu$;\n var maxOrNull = Kotlin.kotlin.sequences.maxOrNull_1bslqu$;\n var flatten = Kotlin.kotlin.sequences.flatten_d9bjs1$;\n var first_1 = Kotlin.kotlin.sequences.first_veqyi0$;\n var Pair = Kotlin.kotlin.Pair;\n var sortedWith = Kotlin.kotlin.sequences.sortedWith_vjgqpk$;\n var filter = Kotlin.kotlin.sequences.filter_euau3h$;\n var toList_1 = Kotlin.kotlin.sequences.toList_veqyi0$;\n var listOf_0 = Kotlin.kotlin.collections.listOf_mh5how$;\n var single = Kotlin.kotlin.collections.single_2p1efm$;\n var replace = Kotlin.kotlin.text.replace_680rmw$;\n var StringBuilder_init_0 = Kotlin.kotlin.text.StringBuilder_init_za3lpa$;\n var toDoubleOrNull = Kotlin.kotlin.text.toDoubleOrNull_pdl1vz$;\n var AbstractList = Kotlin.kotlin.collections.AbstractList;\n var asIterable = Kotlin.kotlin.sequences.asIterable_veqyi0$;\n var Set = Kotlin.kotlin.collections.Set;\n var UnsupportedOperationException_init = Kotlin.kotlin.UnsupportedOperationException_init;\n var UnsupportedOperationException_init_0 = Kotlin.kotlin.UnsupportedOperationException_init_pdl1vj$;\n var startsWith_0 = Kotlin.kotlin.text.startsWith_7epoxm$;\n var roundToInt = Kotlin.kotlin.math.roundToInt_yrwdxr$;\n var indexOf_0 = Kotlin.kotlin.text.indexOf_8eortd$;\n var plus_3 = Kotlin.kotlin.collections.plus_iwxh38$;\n var replace_0 = Kotlin.kotlin.text.replace_r2fvfm$;\n var mapCapacity = Kotlin.kotlin.collections.mapCapacity_za3lpa$;\n var LinkedHashMap_init_0 = Kotlin.kotlin.collections.LinkedHashMap_init_bwtc7$;\n var mu = $module$kotlin_logging_jsLegacy.mu;\n Format$PatternSpecPart.prototype = Object.create(Format$SpecPart.prototype);\n Format$PatternSpecPart.prototype.constructor = Format$PatternSpecPart;\n Pattern$Companion$Kind.prototype = Object.create(Enum.prototype);\n Pattern$Companion$Kind.prototype.constructor = Pattern$Companion$Kind;\n Pattern.prototype = Object.create(Enum.prototype);\n Pattern.prototype.constructor = Pattern;\n Month$VarLengthMonth.prototype = Object.create(Month.prototype);\n Month$VarLengthMonth.prototype.constructor = Month$VarLengthMonth;\n WeekDay.prototype = Object.create(Enum.prototype);\n WeekDay.prototype.constructor = WeekDay;\n TimeZoneMoscow.prototype = Object.create(TimeZone.prototype);\n TimeZoneMoscow.prototype.constructor = TimeZoneMoscow;\n TimeZones$utc$ObjectLiteral.prototype = Object.create(TimeZone.prototype);\n TimeZones$utc$ObjectLiteral.prototype.constructor = TimeZones$utc$ObjectLiteral;\n TimeZones$offset$ObjectLiteral.prototype = Object.create(TimeZone.prototype);\n TimeZones$offset$ObjectLiteral.prototype.constructor = TimeZones$offset$ObjectLiteral;\n TimeZones$DSTimeZone.prototype = Object.create(TimeZone.prototype);\n TimeZones$DSTimeZone.prototype.constructor = TimeZones$DSTimeZone;\n TimeZones$withEuSummerTime$ObjectLiteral.prototype = Object.create(TimeZones$DSTimeZone.prototype);\n TimeZones$withEuSummerTime$ObjectLiteral.prototype.constructor = TimeZones$withEuSummerTime$ObjectLiteral;\n TimeZones$withUsSummerTime$ObjectLiteral.prototype = Object.create(TimeZones$DSTimeZone.prototype);\n TimeZones$withUsSummerTime$ObjectLiteral.prototype.constructor = TimeZones$withUsSummerTime$ObjectLiteral;\n Button.prototype = Object.create(Enum.prototype);\n Button.prototype.constructor = Button;\n Key.prototype = Object.create(Enum.prototype);\n Key.prototype.constructor = Key;\n KeyEvent.prototype = Object.create(Event.prototype);\n KeyEvent.prototype.constructor = KeyEvent;\n ModifierKey.prototype = Object.create(Enum.prototype);\n ModifierKey.prototype.constructor = ModifierKey;\n PointEvent.prototype = Object.create(Event.prototype);\n PointEvent.prototype.constructor = PointEvent;\n MouseEvent.prototype = Object.create(PointEvent.prototype);\n MouseEvent.prototype.constructor = MouseEvent;\n MouseEventSpec.prototype = Object.create(Enum.prototype);\n MouseEventSpec.prototype.constructor = MouseEventSpec;\n ComparatorOrdering.prototype = Object.create(Ordering.prototype);\n ComparatorOrdering.prototype.constructor = ComparatorOrdering;\n FluentArray.prototype = Object.create(FluentValue.prototype);\n FluentArray.prototype.constructor = FluentArray;\n FluentObject.prototype = Object.create(FluentValue.prototype);\n FluentObject.prototype.constructor = FluentObject;\n FluentPrimitive.prototype = Object.create(FluentValue.prototype);\n FluentPrimitive.prototype.constructor = FluentPrimitive;\n JsonParser$JsonException.prototype = Object.create(Exception.prototype);\n JsonParser$JsonException.prototype.constructor = JsonParser$JsonException;\n Token.prototype = Object.create(Enum.prototype);\n Token.prototype.constructor = Token;\n ListMap$keySet$ObjectLiteral.prototype = Object.create(AbstractMutableSet.prototype);\n ListMap$keySet$ObjectLiteral.prototype.constructor = ListMap$keySet$ObjectLiteral;\n ListMap$values$ObjectLiteral.prototype = Object.create(AbstractCollection.prototype);\n ListMap$values$ObjectLiteral.prototype.constructor = ListMap$values$ObjectLiteral;\n ListMap$entrySet$ObjectLiteral.prototype = Object.create(AbstractSet.prototype);\n ListMap$entrySet$ObjectLiteral.prototype.constructor = ListMap$entrySet$ObjectLiteral;\n ChildList_init$ObjectLiteral.prototype = Object.create(CollectionAdapter.prototype);\n ChildList_init$ObjectLiteral.prototype.constructor = ChildList_init$ObjectLiteral;\n AbstractObservableList.prototype = Object.create(AbstractMutableList.prototype);\n AbstractObservableList.prototype.constructor = AbstractObservableList;\n ObservableArrayList.prototype = Object.create(AbstractObservableList.prototype);\n ObservableArrayList.prototype.constructor = ObservableArrayList;\n ChildList.prototype = Object.create(ObservableArrayList.prototype);\n ChildList.prototype.constructor = ChildList;\n ValueProperty.prototype = Object.create(BaseReadableProperty.prototype);\n ValueProperty.prototype.constructor = ValueProperty;\n ChildProperty.prototype = Object.create(ValueProperty.prototype);\n ChildProperty.prototype.constructor = ChildProperty;\n CollectionItemEvent$EventType.prototype = Object.create(Enum.prototype);\n CollectionItemEvent$EventType.prototype.constructor = CollectionItemEvent$EventType;\n AbstractObservableList$addListener$ObjectLiteral.prototype = Object.create(Listeners.prototype);\n AbstractObservableList$addListener$ObjectLiteral.prototype.constructor = AbstractObservableList$addListener$ObjectLiteral;\n CompositeEventSource$addHandler$ObjectLiteral.prototype = Object.create(Listeners.prototype);\n CompositeEventSource$addHandler$ObjectLiteral.prototype.constructor = CompositeEventSource$addHandler$ObjectLiteral;\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral.prototype = Object.create(CollectionAdapter.prototype);\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral.prototype.constructor = EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral;\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0.prototype = Object.create(Registration.prototype);\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0.prototype.constructor = EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0;\n Listeners$add$ObjectLiteral.prototype = Object.create(Registration.prototype);\n Listeners$add$ObjectLiteral.prototype.constructor = Listeners$add$ObjectLiteral;\n DelayedValueProperty$addHandler$ObjectLiteral.prototype = Object.create(Listeners.prototype);\n DelayedValueProperty$addHandler$ObjectLiteral.prototype.constructor = DelayedValueProperty$addHandler$ObjectLiteral;\n DelayedValueProperty.prototype = Object.create(BaseReadableProperty.prototype);\n DelayedValueProperty.prototype.constructor = DelayedValueProperty;\n ValueProperty$addHandler$ObjectLiteral.prototype = Object.create(Listeners.prototype);\n ValueProperty$addHandler$ObjectLiteral.prototype.constructor = ValueProperty$addHandler$ObjectLiteral;\n CompositeRegistration.prototype = Object.create(Registration.prototype);\n CompositeRegistration.prototype.constructor = CompositeRegistration;\n Registration$EmptyRegistration.prototype = Object.create(Registration.prototype);\n Registration$EmptyRegistration.prototype.constructor = Registration$EmptyRegistration;\n Registration$Companion$from$ObjectLiteral.prototype = Object.create(Registration.prototype);\n Registration$Companion$from$ObjectLiteral.prototype.constructor = Registration$Companion$from$ObjectLiteral;\n Registration$Companion$from$ObjectLiteral_0.prototype = Object.create(Registration.prototype);\n Registration$Companion$from$ObjectLiteral_0.prototype.constructor = Registration$Companion$from$ObjectLiteral_0;\n SimpleFeature$GeometryType.prototype = Object.create(Enum.prototype);\n SimpleFeature$GeometryType.prototype.constructor = SimpleFeature$GeometryType;\n StringFormat$FormatType.prototype = Object.create(Enum.prototype);\n StringFormat$FormatType.prototype.constructor = StringFormat$FormatType;\n AbstractGeometryList.prototype = Object.create(AbstractList.prototype);\n AbstractGeometryList.prototype.constructor = AbstractGeometryList;\n GeometryType.prototype = Object.create(Enum.prototype);\n GeometryType.prototype.constructor = GeometryType;\n LineString.prototype = Object.create(AbstractGeometryList.prototype);\n LineString.prototype.constructor = LineString;\n MultiLineString.prototype = Object.create(AbstractGeometryList.prototype);\n MultiLineString.prototype.constructor = MultiLineString;\n MultiPoint.prototype = Object.create(AbstractGeometryList.prototype);\n MultiPoint.prototype.constructor = MultiPoint;\n MultiPolygon.prototype = Object.create(AbstractGeometryList.prototype);\n MultiPolygon.prototype.constructor = MultiPolygon;\n Polygon.prototype = Object.create(AbstractGeometryList.prototype);\n Polygon.prototype.constructor = Polygon;\n Ring.prototype = Object.create(AbstractGeometryList.prototype);\n Ring.prototype.constructor = Ring;\n function splitRings(points) {\n var $receiver = findRingIntervals(points);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(sublist(points, item));\n }\n var rings = toMutableList(destination);\n if (!rings.isEmpty()) {\n if (!isClosed(last(rings))) {\n rings.set_wxm5ur$(get_lastIndex(rings), makeClosed(last(rings)));\n }}return rings;\n }\n function makeClosed(path) {\n return plus(toMutableList(path), first(path));\n }\n function isClosed($receiver) {\n return equals(first($receiver), last($receiver));\n }\n function findRingIntervals(path) {\n var intervals = ArrayList_init();\n var startIndex = 0;\n var i = 0;\n var n = path.size;\n while (i < n) {\n if (startIndex !== i && equals(path.get_za3lpa$(startIndex), path.get_za3lpa$(i))) {\n intervals.add_11rb$(new ClosedRange(startIndex, i + 1 | 0));\n startIndex = i + 1 | 0;\n }i = i + 1 | 0;\n }\n if (startIndex !== path.size) {\n intervals.add_11rb$(new ClosedRange(startIndex, path.size));\n }return intervals;\n }\n function sublist($receiver, range) {\n return $receiver.subList_vux9f0$(range.lowerEnd, range.upperEnd);\n }\n function calculateArea(ring) {\n return calculateArea_0(ring, getPropertyCallableRef('x', 1, function ($receiver) {\n return $receiver.x;\n }), getPropertyCallableRef('y', 1, function ($receiver) {\n return $receiver.y;\n }));\n }\n function isClockwise(ring, x, y) {\n var tmp$;\n if (!!ring.isEmpty()) {\n var message = \"Ring shouldn't be empty to calculate clockwise\";\n throw IllegalStateException_init(message.toString());\n }var sum = 0.0;\n var prev = ring.get_za3lpa$(ring.size - 1 | 0);\n tmp$ = ring.iterator();\n while (tmp$.hasNext()) {\n var point = tmp$.next();\n sum += x(prev) * y(point) - x(point) * y(prev);\n prev = point;\n }\n return sum < 0.0;\n }\n function calculateArea_0(ring, x, y) {\n var area = 0.0;\n var j = ring.size - 1 | 0;\n for (var i = 0; i !== ring.size; ++i) {\n var p1 = ring.get_za3lpa$(i);\n var p2 = ring.get_za3lpa$(j);\n area += (x(p2) + x(p1)) * (y(p2) - y(p1));\n j = i;\n }\n var x_0 = area / 2;\n return JsMath.abs(x_0);\n }\n function DateLocale() {\n DateLocale_instance = this;\n this.weekDayAbbr = mapOf([to(WeekDay$MONDAY_getInstance(), 'Mon'), to(WeekDay$TUESDAY_getInstance(), 'Tue'), to(WeekDay$WEDNESDAY_getInstance(), 'Wed'), to(WeekDay$THURSDAY_getInstance(), 'Thu'), to(WeekDay$FRIDAY_getInstance(), 'Fri'), to(WeekDay$SATURDAY_getInstance(), 'Sat'), to(WeekDay$SUNDAY_getInstance(), 'Sun')]);\n this.weekDayFull = mapOf([to(WeekDay$MONDAY_getInstance(), 'Monday'), to(WeekDay$TUESDAY_getInstance(), 'Tuesday'), to(WeekDay$WEDNESDAY_getInstance(), 'Wednesday'), to(WeekDay$THURSDAY_getInstance(), 'Thursday'), to(WeekDay$FRIDAY_getInstance(), 'Friday'), to(WeekDay$SATURDAY_getInstance(), 'Saturday'), to(WeekDay$SUNDAY_getInstance(), 'Sunday')]);\n this.monthAbbr = mapOf([to(Month$Companion_getInstance().JANUARY, 'Jan'), to(Month$Companion_getInstance().FEBRUARY, 'Feb'), to(Month$Companion_getInstance().MARCH, 'Mar'), to(Month$Companion_getInstance().APRIL, 'Apr'), to(Month$Companion_getInstance().MAY, 'May'), to(Month$Companion_getInstance().JUNE, 'Jun'), to(Month$Companion_getInstance().JULY, 'Jul'), to(Month$Companion_getInstance().AUGUST, 'Aug'), to(Month$Companion_getInstance().SEPTEMBER, 'Sep'), to(Month$Companion_getInstance().OCTOBER, 'Oct'), to(Month$Companion_getInstance().NOVEMBER, 'Nov'), to(Month$Companion_getInstance().DECEMBER, 'Dec')]);\n this.monthFull = mapOf([to(Month$Companion_getInstance().JANUARY, 'January'), to(Month$Companion_getInstance().FEBRUARY, 'February'), to(Month$Companion_getInstance().MARCH, 'March'), to(Month$Companion_getInstance().APRIL, 'April'), to(Month$Companion_getInstance().MAY, 'May'), to(Month$Companion_getInstance().JUNE, 'June'), to(Month$Companion_getInstance().JULY, 'July'), to(Month$Companion_getInstance().AUGUST, 'August'), to(Month$Companion_getInstance().SEPTEMBER, 'September'), to(Month$Companion_getInstance().OCTOBER, 'October'), to(Month$Companion_getInstance().NOVEMBER, 'November'), to(Month$Companion_getInstance().DECEMBER, 'December')]);\n }\n DateLocale.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DateLocale',\n interfaces: []\n };\n var DateLocale_instance = null;\n function DateLocale_getInstance() {\n if (DateLocale_instance === null) {\n new DateLocale();\n }return DateLocale_instance;\n }\n function Format(spec) {\n Format$Companion_getInstance();\n this.spec_0 = spec;\n }\n function Format$SpecPart(str) {\n this.str = str;\n }\n Format$SpecPart.prototype.exec_amwj4p$ = function (dateTime) {\n return this.str;\n };\n Format$SpecPart.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SpecPart',\n interfaces: []\n };\n function Format$PatternSpecPart(str) {\n Format$SpecPart.call(this, str);\n var tmp$;\n tmp$ = Pattern$Companion_getInstance().patternByString_61zpoe$(str);\n if (tmp$ == null) {\n throw IllegalArgumentException_init('Wrong pattern: ' + str);\n }this.pattern = tmp$;\n }\n Format$PatternSpecPart.prototype.exec_amwj4p$ = function (dateTime) {\n return Format$Companion_getInstance().getValueForPattern_0(this.pattern, dateTime);\n };\n Format$PatternSpecPart.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PatternSpecPart',\n interfaces: [Format$SpecPart]\n };\n function Format$apply$lambda(closure$dateTime) {\n return function (it) {\n return it.exec_amwj4p$(closure$dateTime);\n };\n }\n Format.prototype.apply_amwj4p$ = function (dateTime) {\n return joinToString(this.spec_0, '', void 0, void 0, void 0, void 0, Format$apply$lambda(dateTime));\n };\n function Format$apply$lambda_0(closure$date) {\n return function (it) {\n return it.exec_amwj4p$(new DateTime(closure$date));\n };\n }\n Format.prototype.apply_z9gqti$ = function (date) {\n var $receiver = this.spec_0;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var predicate$result;\n if (Kotlin.isType(element, Format$PatternSpecPart) && element.pattern.kind === Pattern$Companion$Kind$DATE_getInstance()) {\n predicate$result = true;\n } else if (!Kotlin.isType(element, Format$PatternSpecPart)) {\n predicate$result = true;\n } else {\n predicate$result = false;\n }\n if (predicate$result)\n destination.add_11rb$(element);\n }\n return joinToString(destination, '', void 0, void 0, void 0, void 0, Format$apply$lambda_0(date));\n };\n function Format$apply$lambda_1(closure$time) {\n return function (it) {\n return it.exec_amwj4p$(new DateTime(Date$Companion_getInstance().EPOCH, closure$time));\n };\n }\n Format.prototype.apply_z96d9j$ = function (time) {\n var $receiver = this.spec_0;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var predicate$result;\n if (Kotlin.isType(element, Format$PatternSpecPart) && element.pattern.kind === Pattern$Companion$Kind$TIME_getInstance()) {\n predicate$result = true;\n } else if (!Kotlin.isType(element, Format$PatternSpecPart)) {\n predicate$result = true;\n } else {\n predicate$result = false;\n }\n if (predicate$result)\n destination.add_11rb$(element);\n }\n return joinToString(destination, '', void 0, void 0, void 0, void 0, Format$apply$lambda_1(time));\n };\n function Format$Companion() {\n Format$Companion_instance = this;\n }\n Format$Companion.prototype.parse_61zpoe$ = function (str) {\n var result = ArrayList_init();\n var resultSequence = Pattern$Companion_getInstance().PATTERN_REGEX.findAll_905azu$(str);\n var lastIndex = {v: 0};\n var tmp$;\n tmp$ = resultSequence.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var value = element.value;\n var range = element.range;\n var startIndex = range.first;\n var endIndex = range.last;\n if (startIndex > 0) {\n var spec = new Format$SpecPart(substring(str, until(lastIndex.v, startIndex)));\n result.add_11rb$(spec);\n }result.add_11rb$(new Format$PatternSpecPart(value));\n lastIndex.v = endIndex + 1 | 0;\n }\n if (lastIndex.v < str.length) {\n var startIndex_0 = lastIndex.v;\n result.add_11rb$(new Format$SpecPart(str.substring(startIndex_0)));\n }return result;\n };\n Format$Companion.prototype.getValueForPattern_0 = function (type, dateTime) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n switch (type.name) {\n case 'SECOND':\n return this.leadZero_0(dateTime.seconds);\n case 'MINUTE':\n return this.leadZero_0(dateTime.minutes);\n case 'HOUR_12':\n return this.getHours12_0(dateTime).toString();\n case 'HOUR_12_LEADING_ZERO':\n return this.leadZero_0(this.getHours12_0(dateTime));\n case 'HOUR_24':\n return this.leadZero_0(this.getHours24_0(dateTime));\n case 'MERIDIAN_LOWER':\n return this.getMeridian_0(dateTime);\n case 'MERIDIAN_UPPER':\n return this.getMeridian_0(dateTime).toUpperCase();\n case 'DAY_OF_WEEK':\n return this.getWeekDayNumber_0(dateTime);\n case 'DAY_OF_WEEK_ABBR':\n return (tmp$ = DateLocale_getInstance().weekDayAbbr.get_11rb$(dateTime.weekDay)) != null ? tmp$ : '';\n case 'DAY_OF_WEEK_FULL':\n return (tmp$_0 = DateLocale_getInstance().weekDayFull.get_11rb$(dateTime.weekDay)) != null ? tmp$_0 : '';\n case 'DAY_OF_MONTH':\n return dateTime.day.toString();\n case 'DAY_OF_MONTH_LEADING_ZERO':\n return this.leadZero_0(dateTime.day);\n case 'DAY_OF_THE_YEAR':\n return this.leadZero_0(dateTime.date.daysFromYearStart(), 3);\n case 'MONTH':\n return this.leadZero_0(((tmp$_2 = (tmp$_1 = dateTime.month) != null ? tmp$_1.ordinal() : null) != null ? tmp$_2 : 0) + 1 | 0);\n case 'MONTH_ABBR':\n var $receiver = DateLocale_getInstance().monthAbbr;\n var key = dateTime.month;\n var tmp$_5;\n return (tmp$_3 = (Kotlin.isType(tmp$_5 = $receiver, Map) ? tmp$_5 : throwCCE()).get_11rb$(key)) != null ? tmp$_3 : '';\n case 'MONTH_FULL':\n var $receiver_0 = DateLocale_getInstance().monthFull;\n var key_0 = dateTime.month;\n var tmp$_6;\n return (tmp$_4 = (Kotlin.isType(tmp$_6 = $receiver_0, Map) ? tmp$_6 : throwCCE()).get_11rb$(key_0)) != null ? tmp$_4 : '';\n case 'YEAR_SHORT':\n return dateTime.year.toString().substring(2);\n case 'YEAR_FULL':\n return dateTime.year.toString();\n default:return Kotlin.noWhenBranchMatched();\n }\n };\n Format$Companion.prototype.leadZero_0 = function (value, length) {\n if (length === void 0)\n length = 2;\n return padStart(value.toString(), length, 48);\n };\n Format$Companion.prototype.getHours12_0 = function (dateTime) {\n var tmp$;\n var hours = dateTime.hours;\n if (hours === 0)\n tmp$ = 12;\n else if (hours <= 12)\n tmp$ = hours;\n else\n tmp$ = hours - 12 | 0;\n return tmp$;\n };\n Format$Companion.prototype.getHours24_0 = function (dateTime) {\n if (dateTime.hours === 0)\n return 24;\n else\n return dateTime.hours;\n };\n Format$Companion.prototype.getMeridian_0 = function (dateTime) {\n var tmp$;\n var hours = dateTime.hours;\n if (hours === 24)\n tmp$ = 'am';\n else if (hours <= 12)\n tmp$ = 'am';\n else\n tmp$ = 'pm';\n return tmp$;\n };\n Format$Companion.prototype.getWeekDayNumber_0 = function (dateTime) {\n var num = dateTime.weekDay.ordinal + 1 | 0;\n if (num === 7) {\n num = 0;\n }return num.toString();\n };\n Format$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Format$Companion_instance = null;\n function Format$Companion_getInstance() {\n if (Format$Companion_instance === null) {\n new Format$Companion();\n }return Format$Companion_instance;\n }\n Format.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Format',\n interfaces: []\n };\n function Format_init(spec, $this) {\n $this = $this || Object.create(Format.prototype);\n Format.call($this, Format$Companion_getInstance().parse_61zpoe$(spec));\n return $this;\n }\n function Pattern(name, ordinal, string, kind) {\n Enum.call(this);\n this.string = string;\n this.kind = kind;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Pattern_initFields() {\n Pattern_initFields = function () {\n };\n Pattern$DAY_OF_WEEK_ABBR_instance = new Pattern('DAY_OF_WEEK_ABBR', 0, '%a', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$DAY_OF_WEEK_FULL_instance = new Pattern('DAY_OF_WEEK_FULL', 1, '%A', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$MONTH_ABBR_instance = new Pattern('MONTH_ABBR', 2, '%b', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$MONTH_FULL_instance = new Pattern('MONTH_FULL', 3, '%B', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$DAY_OF_MONTH_LEADING_ZERO_instance = new Pattern('DAY_OF_MONTH_LEADING_ZERO', 4, '%d', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$DAY_OF_MONTH_instance = new Pattern('DAY_OF_MONTH', 5, '%e', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$DAY_OF_THE_YEAR_instance = new Pattern('DAY_OF_THE_YEAR', 6, '%j', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$MONTH_instance = new Pattern('MONTH', 7, '%m', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$DAY_OF_WEEK_instance = new Pattern('DAY_OF_WEEK', 8, '%w', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$YEAR_SHORT_instance = new Pattern('YEAR_SHORT', 9, '%y', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$YEAR_FULL_instance = new Pattern('YEAR_FULL', 10, '%Y', Pattern$Companion$Kind$DATE_getInstance());\n Pattern$HOUR_24_instance = new Pattern('HOUR_24', 11, '%H', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$HOUR_12_LEADING_ZERO_instance = new Pattern('HOUR_12_LEADING_ZERO', 12, '%I', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$HOUR_12_instance = new Pattern('HOUR_12', 13, '%l', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$MINUTE_instance = new Pattern('MINUTE', 14, '%M', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$MERIDIAN_LOWER_instance = new Pattern('MERIDIAN_LOWER', 15, '%P', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$MERIDIAN_UPPER_instance = new Pattern('MERIDIAN_UPPER', 16, '%p', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$SECOND_instance = new Pattern('SECOND', 17, '%S', Pattern$Companion$Kind$TIME_getInstance());\n Pattern$Companion_getInstance();\n }\n var Pattern$DAY_OF_WEEK_ABBR_instance;\n function Pattern$DAY_OF_WEEK_ABBR_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_WEEK_ABBR_instance;\n }\n var Pattern$DAY_OF_WEEK_FULL_instance;\n function Pattern$DAY_OF_WEEK_FULL_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_WEEK_FULL_instance;\n }\n var Pattern$MONTH_ABBR_instance;\n function Pattern$MONTH_ABBR_getInstance() {\n Pattern_initFields();\n return Pattern$MONTH_ABBR_instance;\n }\n var Pattern$MONTH_FULL_instance;\n function Pattern$MONTH_FULL_getInstance() {\n Pattern_initFields();\n return Pattern$MONTH_FULL_instance;\n }\n var Pattern$DAY_OF_MONTH_LEADING_ZERO_instance;\n function Pattern$DAY_OF_MONTH_LEADING_ZERO_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_MONTH_LEADING_ZERO_instance;\n }\n var Pattern$DAY_OF_MONTH_instance;\n function Pattern$DAY_OF_MONTH_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_MONTH_instance;\n }\n var Pattern$DAY_OF_THE_YEAR_instance;\n function Pattern$DAY_OF_THE_YEAR_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_THE_YEAR_instance;\n }\n var Pattern$MONTH_instance;\n function Pattern$MONTH_getInstance() {\n Pattern_initFields();\n return Pattern$MONTH_instance;\n }\n var Pattern$DAY_OF_WEEK_instance;\n function Pattern$DAY_OF_WEEK_getInstance() {\n Pattern_initFields();\n return Pattern$DAY_OF_WEEK_instance;\n }\n var Pattern$YEAR_SHORT_instance;\n function Pattern$YEAR_SHORT_getInstance() {\n Pattern_initFields();\n return Pattern$YEAR_SHORT_instance;\n }\n var Pattern$YEAR_FULL_instance;\n function Pattern$YEAR_FULL_getInstance() {\n Pattern_initFields();\n return Pattern$YEAR_FULL_instance;\n }\n var Pattern$HOUR_24_instance;\n function Pattern$HOUR_24_getInstance() {\n Pattern_initFields();\n return Pattern$HOUR_24_instance;\n }\n var Pattern$HOUR_12_LEADING_ZERO_instance;\n function Pattern$HOUR_12_LEADING_ZERO_getInstance() {\n Pattern_initFields();\n return Pattern$HOUR_12_LEADING_ZERO_instance;\n }\n var Pattern$HOUR_12_instance;\n function Pattern$HOUR_12_getInstance() {\n Pattern_initFields();\n return Pattern$HOUR_12_instance;\n }\n var Pattern$MINUTE_instance;\n function Pattern$MINUTE_getInstance() {\n Pattern_initFields();\n return Pattern$MINUTE_instance;\n }\n var Pattern$MERIDIAN_LOWER_instance;\n function Pattern$MERIDIAN_LOWER_getInstance() {\n Pattern_initFields();\n return Pattern$MERIDIAN_LOWER_instance;\n }\n var Pattern$MERIDIAN_UPPER_instance;\n function Pattern$MERIDIAN_UPPER_getInstance() {\n Pattern_initFields();\n return Pattern$MERIDIAN_UPPER_instance;\n }\n var Pattern$SECOND_instance;\n function Pattern$SECOND_getInstance() {\n Pattern_initFields();\n return Pattern$SECOND_instance;\n }\n function Pattern$Companion() {\n Pattern$Companion_instance = this;\n this.PATTERN_REGEX = Regex_init('(%[aAbBdejmwyYHIlMpPS])');\n }\n function Pattern$Companion$Kind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Pattern$Companion$Kind_initFields() {\n Pattern$Companion$Kind_initFields = function () {\n };\n Pattern$Companion$Kind$DATE_instance = new Pattern$Companion$Kind('DATE', 0);\n Pattern$Companion$Kind$TIME_instance = new Pattern$Companion$Kind('TIME', 1);\n }\n var Pattern$Companion$Kind$DATE_instance;\n function Pattern$Companion$Kind$DATE_getInstance() {\n Pattern$Companion$Kind_initFields();\n return Pattern$Companion$Kind$DATE_instance;\n }\n var Pattern$Companion$Kind$TIME_instance;\n function Pattern$Companion$Kind$TIME_getInstance() {\n Pattern$Companion$Kind_initFields();\n return Pattern$Companion$Kind$TIME_instance;\n }\n Pattern$Companion$Kind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Kind',\n interfaces: [Enum]\n };\n function Pattern$Companion$Kind$values() {\n return [Pattern$Companion$Kind$DATE_getInstance(), Pattern$Companion$Kind$TIME_getInstance()];\n }\n Pattern$Companion$Kind.values = Pattern$Companion$Kind$values;\n function Pattern$Companion$Kind$valueOf(name) {\n switch (name) {\n case 'DATE':\n return Pattern$Companion$Kind$DATE_getInstance();\n case 'TIME':\n return Pattern$Companion$Kind$TIME_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.dateFormat.Pattern.Companion.Kind.' + name);\n }\n }\n Pattern$Companion$Kind.valueOf_61zpoe$ = Pattern$Companion$Kind$valueOf;\n Pattern$Companion.prototype.patternByString_61zpoe$ = function (patternString) {\n var $receiver = Pattern$values();\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$;\n for (tmp$ = 0; tmp$ !== $receiver.length; ++tmp$) {\n var element = $receiver[tmp$];\n if (equals(element.string, patternString)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n return firstOrNull$result;\n };\n Pattern$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Pattern$Companion_instance = null;\n function Pattern$Companion_getInstance() {\n Pattern_initFields();\n if (Pattern$Companion_instance === null) {\n new Pattern$Companion();\n }return Pattern$Companion_instance;\n }\n Pattern.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Pattern',\n interfaces: [Enum]\n };\n function Pattern$values() {\n return [Pattern$DAY_OF_WEEK_ABBR_getInstance(), Pattern$DAY_OF_WEEK_FULL_getInstance(), Pattern$MONTH_ABBR_getInstance(), Pattern$MONTH_FULL_getInstance(), Pattern$DAY_OF_MONTH_LEADING_ZERO_getInstance(), Pattern$DAY_OF_MONTH_getInstance(), Pattern$DAY_OF_THE_YEAR_getInstance(), Pattern$MONTH_getInstance(), Pattern$DAY_OF_WEEK_getInstance(), Pattern$YEAR_SHORT_getInstance(), Pattern$YEAR_FULL_getInstance(), Pattern$HOUR_24_getInstance(), Pattern$HOUR_12_LEADING_ZERO_getInstance(), Pattern$HOUR_12_getInstance(), Pattern$MINUTE_getInstance(), Pattern$MERIDIAN_LOWER_getInstance(), Pattern$MERIDIAN_UPPER_getInstance(), Pattern$SECOND_getInstance()];\n }\n Pattern.values = Pattern$values;\n function Pattern$valueOf(name) {\n switch (name) {\n case 'DAY_OF_WEEK_ABBR':\n return Pattern$DAY_OF_WEEK_ABBR_getInstance();\n case 'DAY_OF_WEEK_FULL':\n return Pattern$DAY_OF_WEEK_FULL_getInstance();\n case 'MONTH_ABBR':\n return Pattern$MONTH_ABBR_getInstance();\n case 'MONTH_FULL':\n return Pattern$MONTH_FULL_getInstance();\n case 'DAY_OF_MONTH_LEADING_ZERO':\n return Pattern$DAY_OF_MONTH_LEADING_ZERO_getInstance();\n case 'DAY_OF_MONTH':\n return Pattern$DAY_OF_MONTH_getInstance();\n case 'DAY_OF_THE_YEAR':\n return Pattern$DAY_OF_THE_YEAR_getInstance();\n case 'MONTH':\n return Pattern$MONTH_getInstance();\n case 'DAY_OF_WEEK':\n return Pattern$DAY_OF_WEEK_getInstance();\n case 'YEAR_SHORT':\n return Pattern$YEAR_SHORT_getInstance();\n case 'YEAR_FULL':\n return Pattern$YEAR_FULL_getInstance();\n case 'HOUR_24':\n return Pattern$HOUR_24_getInstance();\n case 'HOUR_12_LEADING_ZERO':\n return Pattern$HOUR_12_LEADING_ZERO_getInstance();\n case 'HOUR_12':\n return Pattern$HOUR_12_getInstance();\n case 'MINUTE':\n return Pattern$MINUTE_getInstance();\n case 'MERIDIAN_LOWER':\n return Pattern$MERIDIAN_LOWER_getInstance();\n case 'MERIDIAN_UPPER':\n return Pattern$MERIDIAN_UPPER_getInstance();\n case 'SECOND':\n return Pattern$SECOND_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.dateFormat.Pattern.' + name);\n }\n }\n Pattern.valueOf_61zpoe$ = Pattern$valueOf;\n function Date_0(day, month, year) {\n Date$Companion_getInstance();\n this.day = day;\n this.month = month;\n this.year = year;\n this.validate_0();\n }\n Object.defineProperty(Date_0.prototype, 'weekDay', {\n configurable: true,\n get: function () {\n var daysFromOrigin = this.daysFrom_z9gqti$(Date$Companion_getInstance().EPOCH);\n return WeekDay$values()[(daysFromOrigin + Date$Companion_getInstance().EPOCH_WEEKDAY_0.ordinal | 0) % WeekDay$values().length];\n }\n });\n Object.defineProperty(Date_0.prototype, 'dateStart', {\n configurable: true,\n get: function () {\n return new DateTime(this);\n }\n });\n Object.defineProperty(Date_0.prototype, 'dateEnd', {\n configurable: true,\n get: function () {\n return new DateTime(this, Time$Companion_getInstance().DAY_END);\n }\n });\n Date_0.prototype.validate_0 = function () {\n var tmp$;\n var daysInMonth = this.month.getDaysInYear_za3lpa$(this.year);\n tmp$ = this.day;\n var isValid = 1 <= tmp$ && tmp$ <= daysInMonth;\n if (!isValid) {\n throw IllegalArgumentException_init_0();\n }};\n Date_0.prototype.daysFrom_z9gqti$ = function (date) {\n if (this.compareTo_11rb$(date) < 0) {\n throw IllegalArgumentException_init_0();\n }var result = 0;\n if (this.year !== date.year) {\n var fromYear = date.year;\n var toYear = this.year;\n var leapYears = DateTimeUtil_getInstance().leapYearsBetween_6xvm5r$(fromYear, toYear);\n var years = toYear - fromYear | 0;\n result = result + (Kotlin.imul(leapYears, DateTimeUtil_getInstance().DAYS_IN_LEAP_YEAR_8be2vx$) + Kotlin.imul(years - leapYears | 0, DateTimeUtil_getInstance().DAYS_IN_YEAR_8be2vx$)) | 0;\n }return result + this.daysFromYearStart() - date.daysFromYearStart() | 0;\n };\n Date_0.prototype.daysFromYearStart = function () {\n var result = this.day;\n var current = this.month.prev();\n while (current != null) {\n result = result + current.getDaysInYear_za3lpa$(this.year) | 0;\n current = current.prev();\n }\n return result;\n };\n Date_0.prototype.addDays_za3lpa$ = function (days) {\n var days_0 = days;\n if (days_0 < 0) {\n throw IllegalArgumentException_init_0();\n }if (days_0 === 0)\n return this;\n var day = this.day;\n var month = this.month;\n var year = this.year;\n var lessThanYear = false;\n if (days_0 >= Date$Companion_getInstance().CACHE_DAYS_0 && year === Date$Companion_getInstance().EPOCH.year) {\n year = Date$Companion_getInstance().CACHE_STAMP_0.year;\n month = Date$Companion_getInstance().CACHE_STAMP_0.month;\n day = Date$Companion_getInstance().CACHE_STAMP_0.day;\n days_0 = days_0 - Date$Companion_getInstance().CACHE_DAYS_0 | 0;\n }while (days_0 > 0) {\n var daysToNextMonth = month.getDaysInYear_za3lpa$(year) - day + 1 | 0;\n if (days_0 < daysToNextMonth) {\n return new Date_0(day + days_0 | 0, month, year);\n } else {\n if (lessThanYear) {\n month = ensureNotNull(month.next());\n day = 1;\n days_0 = days_0 - daysToNextMonth | 0;\n } else {\n var daysToNextYear = Date$Companion_getInstance().lastDayOf_8fsw02$(year).daysFrom_z9gqti$(new Date_0(day, month, year)) + 1 | 0;\n if (days_0 >= daysToNextYear) {\n day = 1;\n month = Month$Companion_getInstance().JANUARY;\n year = year + 1 | 0;\n days_0 = days_0 - daysToNextYear | 0;\n } else {\n month = ensureNotNull(month.next());\n day = 1;\n days_0 = days_0 - daysToNextMonth | 0;\n lessThanYear = true;\n }\n }\n }\n }\n return new Date_0(day, month, year);\n };\n Date_0.prototype.nextDate = function () {\n return this.addDays_za3lpa$(1);\n };\n Date_0.prototype.prevDate = function () {\n return this.subtractDays_za3lpa$(1);\n };\n Date_0.prototype.subtractDays_za3lpa$ = function (days) {\n var tmp$;\n if (days < 0) {\n throw IllegalArgumentException_init_0();\n }if (days === 0)\n return this;\n if (days < this.day) {\n return new Date_0(this.day - days | 0, this.month, this.year);\n } else {\n var daysToPrevYear = this.daysFrom_z9gqti$(Date$Companion_getInstance().firstDayOf_8fsw02$(this.year));\n if (days > daysToPrevYear) {\n tmp$ = Date$Companion_getInstance().lastDayOf_8fsw02$(this.year - 1 | 0).subtractDays_za3lpa$(days - daysToPrevYear - 1 | 0);\n } else {\n tmp$ = Date$Companion_getInstance().lastDayOf_8fsw02$(this.year, ensureNotNull(this.month.prev())).subtractDays_za3lpa$(days - this.day | 0);\n }\n return tmp$;\n }\n };\n Date_0.prototype.compareTo_11rb$ = function (other) {\n if (this.year !== other.year)\n return this.year - other.year | 0;\n return this.month.ordinal() !== other.month.ordinal() ? this.month.ordinal() - other.month.ordinal() | 0 : this.day - other.day | 0;\n };\n Date_0.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, Date_0))\n return false;\n var date = (tmp$ = other) == null || Kotlin.isType(tmp$, Date_0) ? tmp$ : throwCCE();\n return ensureNotNull(date).year === this.year && date.month === this.month && date.day === this.day;\n };\n Date_0.prototype.hashCode = function () {\n return (this.year * 239 | 0) + (hashCode(this.month) * 31 | 0) + this.day | 0;\n };\n Date_0.prototype.toString = function () {\n var result = StringBuilder_init();\n result.append_s8jyv4$(this.year);\n this.appendMonth_0(result);\n this.appendDay_0(result);\n return result.toString();\n };\n Date_0.prototype.appendDay_0 = function (result) {\n if (this.day < 10) {\n result.append_pdl1vj$('0');\n }result.append_s8jyv4$(this.day);\n };\n Date_0.prototype.appendMonth_0 = function (result) {\n var month = this.month.ordinal() + 1 | 0;\n if (month < 10) {\n result.append_pdl1vj$('0');\n }result.append_s8jyv4$(month);\n };\n Date_0.prototype.toPrettyString = function () {\n var result = StringBuilder_init();\n this.appendDay_0(result);\n result.append_pdl1vj$('.');\n this.appendMonth_0(result);\n result.append_pdl1vj$('.');\n result.append_s8jyv4$(this.year);\n return result.toString();\n };\n function Date$Companion() {\n Date$Companion_instance = this;\n this.EPOCH = new Date_0(1, Month$Companion_getInstance().JANUARY, 1970);\n this.EPOCH_WEEKDAY_0 = WeekDay$THURSDAY_getInstance();\n this.CACHE_STAMP_0 = new Date_0(1, Month$Companion_getInstance().JANUARY, 2012);\n this.CACHE_DAYS_0 = this.CACHE_STAMP_0.daysFrom_z9gqti$(this.EPOCH);\n }\n Date$Companion.prototype.parse_61zpoe$ = function (str) {\n if (str.length !== 8) {\n throw RuntimeException_init();\n }var year = toInt(str.substring(0, 4));\n var month = toInt(str.substring(4, 6));\n var day = toInt(str.substring(6, 8));\n return new Date_0(day, Month$Companion_getInstance().values()[month - 1 | 0], year);\n };\n Date$Companion.prototype.firstDayOf_8fsw02$ = function (year, month) {\n if (month === void 0)\n month = Month$Companion_getInstance().JANUARY;\n return new Date_0(1, month, year);\n };\n Date$Companion.prototype.lastDayOf_8fsw02$ = function (year, month) {\n if (month === void 0)\n month = Month$Companion_getInstance().DECEMBER;\n return new Date_0(month.days, month, year);\n };\n Date$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Date$Companion_instance = null;\n function Date$Companion_getInstance() {\n if (Date$Companion_instance === null) {\n new Date$Companion();\n }return Date$Companion_instance;\n }\n Date_0.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Date',\n interfaces: [Comparable]\n };\n function DateTime(date, time) {\n DateTime$Companion_getInstance();\n if (time === void 0)\n time = Time$Companion_getInstance().DAY_START;\n this.date = date;\n this.time = time;\n }\n Object.defineProperty(DateTime.prototype, 'year', {\n configurable: true,\n get: function () {\n return this.date.year;\n }\n });\n Object.defineProperty(DateTime.prototype, 'month', {\n configurable: true,\n get: function () {\n return this.date.month;\n }\n });\n Object.defineProperty(DateTime.prototype, 'day', {\n configurable: true,\n get: function () {\n return this.date.day;\n }\n });\n Object.defineProperty(DateTime.prototype, 'weekDay', {\n configurable: true,\n get: function () {\n return this.date.weekDay;\n }\n });\n Object.defineProperty(DateTime.prototype, 'hours', {\n configurable: true,\n get: function () {\n return this.time.hours;\n }\n });\n Object.defineProperty(DateTime.prototype, 'minutes', {\n configurable: true,\n get: function () {\n return this.time.minutes;\n }\n });\n Object.defineProperty(DateTime.prototype, 'seconds', {\n configurable: true,\n get: function () {\n return this.time.seconds;\n }\n });\n Object.defineProperty(DateTime.prototype, 'milliseconds', {\n configurable: true,\n get: function () {\n return this.time.milliseconds;\n }\n });\n DateTime.prototype.changeDate_z9gqti$ = function (date) {\n return new DateTime(date, this.time);\n };\n DateTime.prototype.changeTime_z96d9j$ = function (time) {\n return new DateTime(this.date, time);\n };\n DateTime.prototype.add_27523k$ = function (duration) {\n var utcInstant = TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(this);\n return TimeZone$Companion_getInstance().UTC.toDateTime_x2y23v$(utcInstant.add_27523k$(duration));\n };\n DateTime.prototype.to_amwj4p$ = function (otherTime) {\n var currentInstant = TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(this);\n var otherInstant = TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(otherTime);\n return currentInstant.to_x2y23v$(otherInstant);\n };\n DateTime.prototype.isBefore_amwj4p$ = function (dateTime) {\n return this.compareTo_11rb$(dateTime) < 0;\n };\n DateTime.prototype.isAfter_amwj4p$ = function (dateTime) {\n return this.compareTo_11rb$(dateTime) > 0;\n };\n DateTime.prototype.hashCode = function () {\n return (this.date.hashCode() * 31 | 0) + this.time.hashCode() | 0;\n };\n DateTime.prototype.equals = function (other) {\n var tmp$, tmp$_0, tmp$_1;\n if (!Kotlin.isType(other, DateTime))\n return false;\n var otherDateTime = (tmp$ = other) == null || Kotlin.isType(tmp$, DateTime) ? tmp$ : throwCCE();\n return ((tmp$_0 = this.date) != null ? tmp$_0.equals(ensureNotNull(otherDateTime).date) : null) && ((tmp$_1 = this.time) != null ? tmp$_1.equals(otherDateTime.time) : null);\n };\n DateTime.prototype.compareTo_11rb$ = function (other) {\n var dateComparison = this.date.compareTo_11rb$(other.date);\n return dateComparison !== 0 ? dateComparison : this.time.compareTo_11rb$(other.time);\n };\n DateTime.prototype.toString = function () {\n return this.date.toString() + 'T' + toString(this.time);\n };\n DateTime.prototype.toPrettyString = function () {\n return this.time.toPrettyHMString() + ' ' + this.date.toPrettyString();\n };\n function DateTime$Companion() {\n DateTime$Companion_instance = this;\n }\n DateTime$Companion.prototype.parse_61zpoe$ = function (s) {\n if (s.length < 15) {\n throw IllegalArgumentException_init_0();\n }return new DateTime(Date$Companion_getInstance().parse_61zpoe$(s.substring(0, 8)), Time$Companion_getInstance().parse_61zpoe$(s.substring(9)));\n };\n DateTime$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DateTime$Companion_instance = null;\n function DateTime$Companion_getInstance() {\n if (DateTime$Companion_instance === null) {\n new DateTime$Companion();\n }return DateTime$Companion_instance;\n }\n DateTime.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DateTime',\n interfaces: [Comparable]\n };\n function DateTimeUtil() {\n DateTimeUtil_instance = this;\n this.BASE_YEAR = 1900;\n this.MAX_SUPPORTED_YEAR = 2100;\n this.MIN_SUPPORTED_YEAR_8be2vx$ = 1970;\n this.DAYS_IN_YEAR_8be2vx$ = 0;\n this.DAYS_IN_LEAP_YEAR_8be2vx$ = 0;\n this.LEAP_YEARS_FROM_1969_8be2vx$ = new Int32Array([477, 477, 477, 478, 478, 478, 478, 479, 479, 479, 479, 480, 480, 480, 480, 481, 481, 481, 481, 482, 482, 482, 482, 483, 483, 483, 483, 484, 484, 484, 484, 485, 485, 485, 485, 486, 486, 486, 486, 487, 487, 487, 487, 488, 488, 488, 488, 489, 489, 489, 489, 490, 490, 490, 490, 491, 491, 491, 491, 492, 492, 492, 492, 493, 493, 493, 493, 494, 494, 494, 494, 495, 495, 495, 495, 496, 496, 496, 496, 497, 497, 497, 497, 498, 498, 498, 498, 499, 499, 499, 499, 500, 500, 500, 500, 501, 501, 501, 501, 502, 502, 502, 502, 503, 503, 503, 503, 504, 504, 504, 504, 505, 505, 505, 505, 506, 506, 506, 506, 507, 507, 507, 507, 508, 508, 508, 508, 509, 509, 509, 509, 509]);\n var tmp$, tmp$_0;\n var leapYearDays = 0;\n var yearDays = 0;\n tmp$ = Month$Companion_getInstance().values();\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var m = tmp$[tmp$_0];\n leapYearDays = leapYearDays + m.getDaysInLeapYear() | 0;\n yearDays = yearDays + m.days | 0;\n }\n this.DAYS_IN_YEAR_8be2vx$ = yearDays;\n this.DAYS_IN_LEAP_YEAR_8be2vx$ = leapYearDays;\n }\n DateTimeUtil.prototype.isLeap_kcn2v3$ = function (year) {\n this.checkYear_0(year);\n return (this.LEAP_YEARS_FROM_1969_8be2vx$[year - 1970 + 1 | 0] - this.LEAP_YEARS_FROM_1969_8be2vx$[year - 1970 | 0] | 0) === 1;\n };\n DateTimeUtil.prototype.leapYearsBetween_6xvm5r$ = function (fromYear, toYear) {\n if (fromYear > toYear) {\n throw IllegalArgumentException_init_0();\n }this.checkYear_0(fromYear);\n this.checkYear_0(toYear);\n return this.LEAP_YEARS_FROM_1969_8be2vx$[toYear - 1970 | 0] - this.LEAP_YEARS_FROM_1969_8be2vx$[fromYear - 1970 | 0] | 0;\n };\n DateTimeUtil.prototype.leapYearsFromZero_0 = function (year) {\n return (year / 4 | 0) - (year / 100 | 0) + (year / 400 | 0) | 0;\n };\n DateTimeUtil.prototype.checkYear_0 = function (year) {\n if (year > 2100 || year < 1970) {\n throw IllegalArgumentException_init(year.toString() + '');\n }};\n DateTimeUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DateTimeUtil',\n interfaces: []\n };\n var DateTimeUtil_instance = null;\n function DateTimeUtil_getInstance() {\n if (DateTimeUtil_instance === null) {\n new DateTimeUtil();\n }return DateTimeUtil_instance;\n }\n function Duration(duration) {\n Duration$Companion_getInstance();\n this.duration = duration;\n }\n Object.defineProperty(Duration.prototype, 'isPositive', {\n configurable: true,\n get: function () {\n return this.duration.toNumber() > 0;\n }\n });\n Duration.prototype.mul_s8cxhz$ = function (times) {\n return new Duration(this.duration.multiply(times));\n };\n Duration.prototype.add_27523k$ = function (duration) {\n return new Duration(this.duration.add(duration.duration));\n };\n Duration.prototype.sub_27523k$ = function (duration) {\n return new Duration(this.duration.subtract(duration.duration));\n };\n Duration.prototype.div_27523k$ = function (duration) {\n return this.duration.toNumber() / duration.duration.toNumber();\n };\n Duration.prototype.compareTo_11rb$ = function (other) {\n var tmp$;\n var delta = this.duration.subtract(other.duration);\n if (delta.toNumber() > 0) {\n tmp$ = 1;\n } else if (equals(delta, L0)) {\n tmp$ = 0;\n } else {\n tmp$ = -1;\n }\n return tmp$;\n };\n Duration.prototype.hashCode = function () {\n return this.duration.toInt();\n };\n Duration.prototype.equals = function (other) {\n return !Kotlin.isType(other, Duration) ? false : equals(this.duration, other.duration);\n };\n Duration.prototype.toString = function () {\n return 'Duration : ' + toString(this.duration) + 'ms';\n };\n function Duration$Companion() {\n Duration$Companion_instance = this;\n this.MS = new Duration(L1);\n this.SECOND = this.MS.mul_s8cxhz$(L1000);\n this.MINUTE = this.SECOND.mul_s8cxhz$(L60);\n this.HOUR = this.MINUTE.mul_s8cxhz$(L60);\n this.DAY = this.HOUR.mul_s8cxhz$(L24);\n this.WEEK = this.DAY.mul_s8cxhz$(L7);\n }\n Duration$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Duration$Companion_instance = null;\n function Duration$Companion_getInstance() {\n if (Duration$Companion_instance === null) {\n new Duration$Companion();\n }return Duration$Companion_instance;\n }\n Duration.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Duration',\n interfaces: [Comparable]\n };\n function Instant(timeSinceEpoch) {\n this.timeSinceEpoch = timeSinceEpoch;\n }\n Instant.prototype.add_27523k$ = function (duration) {\n return new Instant(this.timeSinceEpoch.add(duration.duration));\n };\n Instant.prototype.sub_27523k$ = function (duration) {\n return new Instant(this.timeSinceEpoch.subtract(duration.duration));\n };\n Instant.prototype.to_x2y23v$ = function (instant) {\n return new Duration(instant.timeSinceEpoch.subtract(this.timeSinceEpoch));\n };\n Instant.prototype.compareTo_11rb$ = function (other) {\n var tmp$;\n var delta = this.timeSinceEpoch.subtract(other.timeSinceEpoch);\n if (delta.toNumber() > 0) {\n tmp$ = 1;\n } else if (equals(delta, L0)) {\n tmp$ = 0;\n } else {\n tmp$ = -1;\n }\n return tmp$;\n };\n Instant.prototype.hashCode = function () {\n return this.timeSinceEpoch.toInt();\n };\n Instant.prototype.toString = function () {\n return '' + toString(this.timeSinceEpoch);\n };\n Instant.prototype.equals = function (other) {\n return !Kotlin.isType(other, Instant) ? false : equals(this.timeSinceEpoch, other.timeSinceEpoch);\n };\n Instant.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Instant',\n interfaces: [Comparable]\n };\n function Month(days, myOrdinal, myName) {\n Month$Companion_getInstance();\n this.days = days;\n this.myOrdinal_hzcl1t$_0 = myOrdinal;\n this.myName_s01cg9$_0 = myName;\n }\n Month.prototype.ordinal = function () {\n return this.myOrdinal_hzcl1t$_0;\n };\n Month.prototype.getDaysInYear_za3lpa$ = function (year) {\n return this.days;\n };\n Month.prototype.getDaysInLeapYear = function () {\n return this.days;\n };\n Month.prototype.prev = function () {\n return this.myOrdinal_hzcl1t$_0 === 0 ? null : Month$Companion_getInstance().values()[this.myOrdinal_hzcl1t$_0 - 1 | 0];\n };\n Month.prototype.next = function () {\n var values = Month$Companion_getInstance().values();\n return this.myOrdinal_hzcl1t$_0 === (values.length - 1 | 0) ? null : values[this.myOrdinal_hzcl1t$_0 + 1 | 0];\n };\n Month.prototype.toString = function () {\n return this.myName_s01cg9$_0;\n };\n function Month$VarLengthMonth(days, myDaysInLeapYear, ordinal, name) {\n Month.call(this, days, ordinal, name);\n this.myDaysInLeapYear_0 = myDaysInLeapYear;\n }\n Month$VarLengthMonth.prototype.getDaysInLeapYear = function () {\n return this.myDaysInLeapYear_0;\n };\n Month$VarLengthMonth.prototype.getDaysInYear_za3lpa$ = function (year) {\n var tmp$;\n if (DateTimeUtil_getInstance().isLeap_kcn2v3$(year)) {\n tmp$ = this.getDaysInLeapYear();\n } else {\n tmp$ = this.days;\n }\n return tmp$;\n };\n Month$VarLengthMonth.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VarLengthMonth',\n interfaces: [Month]\n };\n function Month$Companion() {\n Month$Companion_instance = this;\n this.JANUARY = new Month(31, 0, 'January');\n this.FEBRUARY = new Month$VarLengthMonth(28, 29, 1, 'February');\n this.MARCH = new Month(31, 2, 'March');\n this.APRIL = new Month(30, 3, 'April');\n this.MAY = new Month(31, 4, 'May');\n this.JUNE = new Month(30, 5, 'June');\n this.JULY = new Month(31, 6, 'July');\n this.AUGUST = new Month(31, 7, 'August');\n this.SEPTEMBER = new Month(30, 8, 'September');\n this.OCTOBER = new Month(31, 9, 'October');\n this.NOVEMBER = new Month(30, 10, 'November');\n this.DECEMBER = new Month(31, 11, 'December');\n this.VALUES_0 = [this.JANUARY, this.FEBRUARY, this.MARCH, this.APRIL, this.MAY, this.JUNE, this.JULY, this.AUGUST, this.SEPTEMBER, this.OCTOBER, this.NOVEMBER, this.DECEMBER];\n }\n Month$Companion.prototype.values = function () {\n return this.VALUES_0;\n };\n Month$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Month$Companion_instance = null;\n function Month$Companion_getInstance() {\n if (Month$Companion_instance === null) {\n new Month$Companion();\n }return Month$Companion_instance;\n }\n Month.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Month',\n interfaces: []\n };\n function Time(hours, minutes, seconds, milliseconds) {\n Time$Companion_getInstance();\n if (seconds === void 0)\n seconds = 0;\n if (milliseconds === void 0)\n milliseconds = 0;\n this.hours = hours;\n this.minutes = minutes;\n this.seconds = seconds;\n this.milliseconds = milliseconds;\n if (this.hours < 0 || this.hours > 24) {\n throw IllegalArgumentException_init_0();\n }if (this.hours === 24 && (this.minutes !== 0 || this.seconds !== 0)) {\n throw IllegalArgumentException_init_0();\n }if (this.minutes < 0 || this.minutes >= 60) {\n throw IllegalArgumentException_init_0();\n }if (this.seconds < 0 || this.seconds >= 60) {\n throw IllegalArgumentException_init_0();\n }}\n Time.prototype.compareTo_11rb$ = function (other) {\n var delta = this.hours - other.hours | 0;\n if (delta !== 0)\n return delta;\n delta = this.minutes - other.minutes | 0;\n if (delta !== 0)\n return delta;\n delta = this.seconds - other.seconds | 0;\n return delta !== 0 ? delta : this.milliseconds - other.milliseconds | 0;\n };\n Time.prototype.hashCode = function () {\n return (this.hours * 239 | 0) + (this.minutes * 491 | 0) + (this.seconds * 41 | 0) + this.milliseconds | 0;\n };\n Time.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (!Kotlin.isType(other, Time))\n tmp$_0 = false;\n else {\n tmp$_0 = this.compareTo_11rb$(ensureNotNull((tmp$ = other) == null || Kotlin.isType(tmp$, Time) ? tmp$ : throwCCE())) === 0;\n }\n return tmp$_0;\n };\n Time.prototype.toString = function () {\n var result = StringBuilder_init();\n if (this.hours < 10)\n result.append_pdl1vj$('0');\n result.append_s8jyv4$(this.hours);\n if (this.minutes < 10)\n result.append_pdl1vj$('0');\n result.append_s8jyv4$(this.minutes);\n if (this.seconds < 10)\n result.append_pdl1vj$('0');\n result.append_s8jyv4$(this.seconds);\n return result.toString();\n };\n Time.prototype.toPrettyHMString = function () {\n var result = StringBuilder_init();\n if (this.hours < 10)\n result.append_pdl1vj$('0');\n result.append_s8jyv4$(this.hours).append_s8itvh$(Time$Companion_getInstance().DELIMITER_0);\n if (this.minutes < 10)\n result.append_pdl1vj$('0');\n result.append_s8jyv4$(this.minutes);\n return result.toString();\n };\n function Time$Companion() {\n Time$Companion_instance = this;\n this.DELIMITER_0 = 58;\n this.DAY_START = new Time(0, 0);\n this.DAY_END = new Time(24, 0);\n }\n Time$Companion.prototype.parse_61zpoe$ = function (s) {\n if (s.length < 6) {\n throw IllegalArgumentException_init_0();\n }var hours = toInt(s.substring(0, 2));\n var minutes = toInt(s.substring(2, 4));\n var seconds = toInt(s.substring(4, 6));\n return new Time(hours, minutes, seconds);\n };\n Time$Companion.prototype.fromPrettyHMString_61zpoe$ = function (time) {\n var $receiver = this.DELIMITER_0;\n if (!contains(time, String.fromCharCode($receiver) + '')) {\n throw IllegalArgumentException_init_0();\n }var length = time.length;\n if (length !== 5 && length !== 4) {\n throw IllegalArgumentException_init_0();\n }var hourLength = length === 4 ? 1 : 2;\n try {\n var tmp$ = toInt(time.substring(0, hourLength));\n var startIndex = hourLength + 1 | 0;\n return new Time(tmp$, toInt(time.substring(startIndex, length)), 0);\n } catch (ignored) {\n if (Kotlin.isType(ignored, NumberFormatException)) {\n throw IllegalArgumentException_init_0();\n } else\n throw ignored;\n }\n };\n Time$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Time$Companion_instance = null;\n function Time$Companion_getInstance() {\n if (Time$Companion_instance === null) {\n new Time$Companion();\n }return Time$Companion_instance;\n }\n Time.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Time',\n interfaces: [Comparable]\n };\n function WeekDay(name, ordinal, abbreviation, isWeekend) {\n Enum.call(this);\n this.abbreviation = abbreviation;\n this.isWeekend = isWeekend;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function WeekDay_initFields() {\n WeekDay_initFields = function () {\n };\n WeekDay$MONDAY_instance = new WeekDay('MONDAY', 0, 'MO', false);\n WeekDay$TUESDAY_instance = new WeekDay('TUESDAY', 1, 'TU', false);\n WeekDay$WEDNESDAY_instance = new WeekDay('WEDNESDAY', 2, 'WE', false);\n WeekDay$THURSDAY_instance = new WeekDay('THURSDAY', 3, 'TH', false);\n WeekDay$FRIDAY_instance = new WeekDay('FRIDAY', 4, 'FR', false);\n WeekDay$SATURDAY_instance = new WeekDay('SATURDAY', 5, 'SA', true);\n WeekDay$SUNDAY_instance = new WeekDay('SUNDAY', 6, 'SU', true);\n }\n var WeekDay$MONDAY_instance;\n function WeekDay$MONDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$MONDAY_instance;\n }\n var WeekDay$TUESDAY_instance;\n function WeekDay$TUESDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$TUESDAY_instance;\n }\n var WeekDay$WEDNESDAY_instance;\n function WeekDay$WEDNESDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$WEDNESDAY_instance;\n }\n var WeekDay$THURSDAY_instance;\n function WeekDay$THURSDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$THURSDAY_instance;\n }\n var WeekDay$FRIDAY_instance;\n function WeekDay$FRIDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$FRIDAY_instance;\n }\n var WeekDay$SATURDAY_instance;\n function WeekDay$SATURDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$SATURDAY_instance;\n }\n var WeekDay$SUNDAY_instance;\n function WeekDay$SUNDAY_getInstance() {\n WeekDay_initFields();\n return WeekDay$SUNDAY_instance;\n }\n WeekDay.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'WeekDay',\n interfaces: [Enum]\n };\n function WeekDay$values() {\n return [WeekDay$MONDAY_getInstance(), WeekDay$TUESDAY_getInstance(), WeekDay$WEDNESDAY_getInstance(), WeekDay$THURSDAY_getInstance(), WeekDay$FRIDAY_getInstance(), WeekDay$SATURDAY_getInstance(), WeekDay$SUNDAY_getInstance()];\n }\n WeekDay.values = WeekDay$values;\n function WeekDay$valueOf(name) {\n switch (name) {\n case 'MONDAY':\n return WeekDay$MONDAY_getInstance();\n case 'TUESDAY':\n return WeekDay$TUESDAY_getInstance();\n case 'WEDNESDAY':\n return WeekDay$WEDNESDAY_getInstance();\n case 'THURSDAY':\n return WeekDay$THURSDAY_getInstance();\n case 'FRIDAY':\n return WeekDay$FRIDAY_getInstance();\n case 'SATURDAY':\n return WeekDay$SATURDAY_getInstance();\n case 'SUNDAY':\n return WeekDay$SUNDAY_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.datetime.WeekDay.' + name);\n }\n }\n WeekDay.valueOf_61zpoe$ = WeekDay$valueOf;\n function DateSpec() {\n }\n DateSpec.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'DateSpec',\n interfaces: []\n };\n function DateSpecs() {\n DateSpecs_instance = this;\n }\n function DateSpecs$last$ObjectLiteral(closure$weekDay, closure$month) {\n this.closure$weekDay = closure$weekDay;\n this.closure$month = closure$month;\n }\n Object.defineProperty(DateSpecs$last$ObjectLiteral.prototype, 'rRule', {\n configurable: true,\n get: function () {\n return 'RRULE:FREQ=YEARLY;BYDAY=-1' + this.closure$weekDay.abbreviation + ';BYMONTH=' + toString(this.closure$month.ordinal() + 1 | 0);\n }\n });\n DateSpecs$last$ObjectLiteral.prototype.getDate_za3lpa$ = function (year) {\n var days = this.closure$month.getDaysInYear_za3lpa$(year);\n for (var d = days; d >= 1; d--) {\n var date = new Date_0(d, this.closure$month, year);\n if (date.weekDay === this.closure$weekDay)\n return date;\n }\n throw RuntimeException_init();\n };\n DateSpecs$last$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DateSpec]\n };\n DateSpecs.prototype.last_kvq57g$ = function (weekDay, month) {\n return new DateSpecs$last$ObjectLiteral(weekDay, month);\n };\n function DateSpecs$first$ObjectLiteral(closure$number, closure$weekDay, closure$month) {\n this.closure$number = closure$number;\n this.closure$weekDay = closure$weekDay;\n this.closure$month = closure$month;\n }\n Object.defineProperty(DateSpecs$first$ObjectLiteral.prototype, 'rRule', {\n configurable: true,\n get: function () {\n return 'RRULE:FREQ=YEARLY;BYDAY=' + toString(this.closure$number) + this.closure$weekDay.abbreviation + ';BYMONTH=' + toString(this.closure$month.ordinal() + 1 | 0);\n }\n });\n DateSpecs$first$ObjectLiteral.prototype.getDate_za3lpa$ = function (year) {\n var startDay = Kotlin.imul(this.closure$number - 1 | 0, WeekDay$values().length) + 1 | 0;\n var days = this.closure$month.getDaysInYear_za3lpa$(year);\n for (var d = startDay; d <= days; d++) {\n var date = new Date_0(d, this.closure$month, year);\n if (date.weekDay === this.closure$weekDay)\n return date;\n }\n throw RuntimeException_init();\n };\n DateSpecs$first$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DateSpec]\n };\n DateSpecs.prototype.first_t96ihi$ = function (weekDay, month, number) {\n if (number === void 0)\n number = 1;\n return new DateSpecs$first$ObjectLiteral(number, weekDay, month);\n };\n DateSpecs.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DateSpecs',\n interfaces: []\n };\n var DateSpecs_instance = null;\n function DateSpecs_getInstance() {\n if (DateSpecs_instance === null) {\n new DateSpecs();\n }return DateSpecs_instance;\n }\n function TimeZone(id) {\n TimeZone$Companion_getInstance();\n this.id = id;\n }\n TimeZone.prototype.convertTo_8hfrhi$ = function (toConvert, to) {\n return to === this ? toConvert : to.toDateTime_x2y23v$(this.toInstant_amwj4p$(toConvert));\n };\n TimeZone.prototype.convertTimeAtDay_aopdye$ = function (srcTime, dstDate, dstTimeZone) {\n var src = new DateTime(dstDate, srcTime);\n var dst = this.convertTo_8hfrhi$(src, dstTimeZone);\n var dayDiff = dstDate.compareTo_11rb$(dst.date);\n if (dayDiff !== 0) {\n var correctedDay = dayDiff > 0 ? dstDate.nextDate() : dstDate.prevDate();\n src = new DateTime(correctedDay, srcTime);\n dst = this.convertTo_8hfrhi$(src, dstTimeZone);\n }return dst.time;\n };\n TimeZone.prototype.getTimeZoneShift_x2y23v$ = function (instant) {\n var utcDateTime = this.toDateTime_x2y23v$(instant);\n return instant.to_x2y23v$(TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(utcDateTime));\n };\n TimeZone.prototype.toString = function () {\n return ensureNotNull(this.id);\n };\n function TimeZone$Companion() {\n TimeZone$Companion_instance = this;\n this.UTC = TimeZones_getInstance().utc();\n this.BERLIN = TimeZones_getInstance().withEuSummerTime_rwkwum$('Europe/Berlin', Duration$Companion_getInstance().HOUR.mul_s8cxhz$(L1));\n this.MOSCOW = new TimeZoneMoscow();\n this.NY = TimeZones_getInstance().withUsSummerTime_rwkwum$('America/New_York', Duration$Companion_getInstance().HOUR.mul_s8cxhz$(L_5));\n }\n TimeZone$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TimeZone$Companion_instance = null;\n function TimeZone$Companion_getInstance() {\n if (TimeZone$Companion_instance === null) {\n new TimeZone$Companion();\n }return TimeZone$Companion_instance;\n }\n TimeZone.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TimeZone',\n interfaces: []\n };\n function TimeZoneMoscow() {\n TimeZoneMoscow$Companion_getInstance();\n TimeZone.call(this, TimeZoneMoscow$Companion_getInstance().ID_0);\n this.myOldOffset_0 = Duration$Companion_getInstance().HOUR.mul_s8cxhz$(L4);\n this.myNewOffset_0 = Duration$Companion_getInstance().HOUR.mul_s8cxhz$(L3);\n this.myOldTz_0 = TimeZones_getInstance().offset_nf4kng$(null, this.myOldOffset_0, TimeZone$Companion_getInstance().UTC);\n this.myNewTz_0 = TimeZones_getInstance().offset_nf4kng$(null, this.myNewOffset_0, TimeZone$Companion_getInstance().UTC);\n this.myOffsetChangeTime_0 = new DateTime(new Date_0(26, Month$Companion_getInstance().OCTOBER, 2014), new Time(2, 0));\n this.myOffsetChangeInstant_0 = this.myOldTz_0.toInstant_amwj4p$(this.myOffsetChangeTime_0);\n }\n TimeZoneMoscow.prototype.toDateTime_x2y23v$ = function (instant) {\n return instant.compareTo_11rb$(this.myOffsetChangeInstant_0) >= 0 ? this.myNewTz_0.toDateTime_x2y23v$(instant) : this.myOldTz_0.toDateTime_x2y23v$(instant);\n };\n TimeZoneMoscow.prototype.toInstant_amwj4p$ = function (dateTime) {\n return dateTime.compareTo_11rb$(this.myOffsetChangeTime_0) >= 0 ? this.myNewTz_0.toInstant_amwj4p$(dateTime) : this.myOldTz_0.toInstant_amwj4p$(dateTime);\n };\n function TimeZoneMoscow$Companion() {\n TimeZoneMoscow$Companion_instance = this;\n this.ID_0 = 'Europe/Moscow';\n }\n TimeZoneMoscow$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TimeZoneMoscow$Companion_instance = null;\n function TimeZoneMoscow$Companion_getInstance() {\n if (TimeZoneMoscow$Companion_instance === null) {\n new TimeZoneMoscow$Companion();\n }return TimeZoneMoscow$Companion_instance;\n }\n TimeZoneMoscow.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TimeZoneMoscow',\n interfaces: [TimeZone]\n };\n function TimeZones() {\n TimeZones_instance = this;\n this.MILLIS_IN_SECOND_0 = L1000;\n this.MILLIS_IN_MINUTE_0 = L60000;\n this.MILLIS_IN_HOUR_0 = L3600000;\n this.MILLIS_IN_DAY_0 = L86400000;\n }\n TimeZones.prototype.toDateTime_0 = function (instant, offset) {\n var instant_0 = instant;\n instant_0 = instant_0.add_27523k$(offset);\n var days = instant_0.timeSinceEpoch.div(this.MILLIS_IN_DAY_0).toInt();\n var date = Date$Companion_getInstance().EPOCH.addDays_za3lpa$(days);\n var rest = instant_0.timeSinceEpoch.modulo(this.MILLIS_IN_DAY_0);\n var hour = rest.div(this.MILLIS_IN_HOUR_0).toInt();\n rest = rest.modulo(this.MILLIS_IN_HOUR_0);\n var minutes = rest.div(this.MILLIS_IN_MINUTE_0).toInt();\n rest = rest.modulo(this.MILLIS_IN_MINUTE_0);\n var seconds = rest.div(this.MILLIS_IN_SECOND_0).toInt();\n rest = rest.modulo(this.MILLIS_IN_SECOND_0);\n var milliseconds = rest.modulo(this.MILLIS_IN_SECOND_0).toInt();\n return new DateTime(date, new Time(hour, minutes, seconds, milliseconds));\n };\n TimeZones.prototype.toInstant_0 = function (dateTime, offset) {\n return (new Instant(this.toMillis_0(dateTime.date).add(this.toMillis_1(dateTime.time)))).sub_27523k$(offset);\n };\n TimeZones.prototype.toMillis_1 = function (time) {\n var minutes = Kotlin.Long.fromInt(time.hours).multiply(L60).add(Kotlin.Long.fromInt(time.minutes));\n var seconds = minutes.multiply(Kotlin.Long.fromInt(60)).add(Kotlin.Long.fromInt(time.seconds));\n return seconds.multiply(Kotlin.Long.fromInt(1000)).add(Kotlin.Long.fromInt(time.milliseconds));\n };\n TimeZones.prototype.toMillis_0 = function (date) {\n return Kotlin.Long.fromInt(date.daysFrom_z9gqti$(Date$Companion_getInstance().EPOCH)).multiply(this.MILLIS_IN_DAY_0);\n };\n function TimeZones$utc$ObjectLiteral(id) {\n TimeZone.call(this, id);\n }\n TimeZones$utc$ObjectLiteral.prototype.toDateTime_x2y23v$ = function (instant) {\n return TimeZones_getInstance().toDateTime_0(instant, new Duration(L0));\n };\n TimeZones$utc$ObjectLiteral.prototype.toInstant_amwj4p$ = function (dateTime) {\n return TimeZones_getInstance().toInstant_0(dateTime, new Duration(L0));\n };\n TimeZones$utc$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [TimeZone]\n };\n TimeZones.prototype.utc = function () {\n return new TimeZones$utc$ObjectLiteral('UTC');\n };\n function TimeZones$offset$ObjectLiteral(closure$base, closure$offset, id) {\n this.closure$base = closure$base;\n this.closure$offset = closure$offset;\n TimeZone.call(this, id);\n }\n TimeZones$offset$ObjectLiteral.prototype.toDateTime_x2y23v$ = function (instant) {\n return this.closure$base.toDateTime_x2y23v$(instant.add_27523k$(this.closure$offset));\n };\n TimeZones$offset$ObjectLiteral.prototype.toInstant_amwj4p$ = function (dateTime) {\n return this.closure$base.toInstant_amwj4p$(dateTime).sub_27523k$(this.closure$offset);\n };\n TimeZones$offset$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [TimeZone]\n };\n TimeZones.prototype.offset_nf4kng$ = function (id, offset, base) {\n return new TimeZones$offset$ObjectLiteral(base, offset, id);\n };\n function TimeZones$withEuSummerTime$ObjectLiteral(closure$startSpec, closure$utcChangeTime, closure$endSpec, id, offset) {\n this.closure$startSpec = closure$startSpec;\n this.closure$utcChangeTime = closure$utcChangeTime;\n this.closure$endSpec = closure$endSpec;\n TimeZones$DSTimeZone.call(this, id, offset);\n }\n TimeZones$withEuSummerTime$ObjectLiteral.prototype.getStartInstant_za3lpa$ = function (year) {\n return TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(new DateTime(this.closure$startSpec.getDate_za3lpa$(year), this.closure$utcChangeTime));\n };\n TimeZones$withEuSummerTime$ObjectLiteral.prototype.getEndInstant_za3lpa$ = function (year) {\n return TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(new DateTime(this.closure$endSpec.getDate_za3lpa$(year), this.closure$utcChangeTime));\n };\n TimeZones$withEuSummerTime$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [TimeZones$DSTimeZone]\n };\n TimeZones.prototype.withEuSummerTime_rwkwum$ = function (id, offset) {\n var startSpec = DateSpecs_getInstance().last_kvq57g$(WeekDay$SUNDAY_getInstance(), Month$Companion_getInstance().MARCH);\n var endSpec = DateSpecs_getInstance().last_kvq57g$(WeekDay$SUNDAY_getInstance(), Month$Companion_getInstance().OCTOBER);\n var utcChangeTime = new Time(1, 0);\n return new TimeZones$withEuSummerTime$ObjectLiteral(startSpec, utcChangeTime, endSpec, id, offset);\n };\n function TimeZones$withUsSummerTime$ObjectLiteral(closure$startSpec, closure$offset, closure$endSpec, id, offset) {\n this.closure$startSpec = closure$startSpec;\n this.closure$offset = closure$offset;\n this.closure$endSpec = closure$endSpec;\n TimeZones$DSTimeZone.call(this, id, offset);\n }\n TimeZones$withUsSummerTime$ObjectLiteral.prototype.getStartInstant_za3lpa$ = function (year) {\n return TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(new DateTime(this.closure$startSpec.getDate_za3lpa$(year), new Time(2, 0))).sub_27523k$(this.closure$offset);\n };\n TimeZones$withUsSummerTime$ObjectLiteral.prototype.getEndInstant_za3lpa$ = function (year) {\n return TimeZone$Companion_getInstance().UTC.toInstant_amwj4p$(new DateTime(this.closure$endSpec.getDate_za3lpa$(year), new Time(2, 0))).sub_27523k$(this.closure$offset.add_27523k$(Duration$Companion_getInstance().HOUR));\n };\n TimeZones$withUsSummerTime$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [TimeZones$DSTimeZone]\n };\n TimeZones.prototype.withUsSummerTime_rwkwum$ = function (id, offset) {\n var startSpec = DateSpecs_getInstance().first_t96ihi$(WeekDay$SUNDAY_getInstance(), Month$Companion_getInstance().MARCH, 2);\n var endSpec = DateSpecs_getInstance().first_t96ihi$(WeekDay$SUNDAY_getInstance(), Month$Companion_getInstance().NOVEMBER);\n return new TimeZones$withUsSummerTime$ObjectLiteral(startSpec, offset, endSpec, id, offset);\n };\n function TimeZones$DSTimeZone(id, offset) {\n TimeZone.call(this, id);\n this.myTz_0 = TimeZones_getInstance().offset_nf4kng$(null, offset, TimeZone$Companion_getInstance().UTC);\n this.mySummerTz_0 = TimeZones_getInstance().offset_nf4kng$(null, offset.add_27523k$(Duration$Companion_getInstance().HOUR), TimeZone$Companion_getInstance().UTC);\n }\n TimeZones$DSTimeZone.prototype.toDateTime_x2y23v$ = function (instant) {\n var tmp$;\n var tzDt = this.myTz_0.toDateTime_x2y23v$(instant);\n var start = this.getStartInstant_za3lpa$(tzDt.year);\n var end = this.getEndInstant_za3lpa$(tzDt.year);\n if (instant.compareTo_11rb$(start) > 0 && instant.compareTo_11rb$(end) < 0) {\n tmp$ = this.mySummerTz_0.toDateTime_x2y23v$(instant);\n } else {\n tmp$ = tzDt;\n }\n return tmp$;\n };\n TimeZones$DSTimeZone.prototype.toInstant_amwj4p$ = function (dateTime) {\n var tmp$;\n var startDt = this.toDateTime_x2y23v$(this.getStartInstant_za3lpa$(dateTime.year));\n var endDt = this.toDateTime_x2y23v$(this.getEndInstant_za3lpa$(dateTime.year));\n if (dateTime.compareTo_11rb$(startDt) > 0 && dateTime.compareTo_11rb$(endDt) < 0) {\n tmp$ = this.mySummerTz_0.toInstant_amwj4p$(dateTime);\n } else {\n tmp$ = this.myTz_0.toInstant_amwj4p$(dateTime);\n }\n return tmp$;\n };\n TimeZones$DSTimeZone.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DSTimeZone',\n interfaces: [TimeZone]\n };\n TimeZones.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'TimeZones',\n interfaces: []\n };\n var TimeZones_instance = null;\n function TimeZones_getInstance() {\n if (TimeZones_instance === null) {\n new TimeZones();\n }return TimeZones_instance;\n }\n function EnumInfo() {\n }\n EnumInfo.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'EnumInfo',\n interfaces: []\n };\n function EnumInfoFactory() {\n EnumInfoFactory_instance = this;\n }\n EnumInfoFactory.prototype.createEnumInfo_nxd2ia$ = defineInlineFunction('lets-plot-base-portable.jetbrains.datalore.base.enums.EnumInfoFactory.createEnumInfo_nxd2ia$', wrapFunction(function () {\n var EnumInfoImpl_init = _.jetbrains.datalore.base.enums.EnumInfoImpl;\n return function (EnumT_0, isEnumT) {\n return new EnumInfoImpl_init(EnumT_0.values());\n };\n }));\n EnumInfoFactory.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'EnumInfoFactory',\n interfaces: []\n };\n var EnumInfoFactory_instance = null;\n function EnumInfoFactory_getInstance() {\n if (EnumInfoFactory_instance === null) {\n new EnumInfoFactory();\n }return EnumInfoFactory_instance;\n }\n function EnumInfoImpl(enumConstants) {\n this.myNormalizedValueMap_0 = null;\n this.myOriginalNames_0 = null;\n var tmp$;\n var numConstants = enumConstants.length;\n var valueMap = HashMap_init(numConstants);\n var originalNames = ArrayList_init_0(numConstants);\n for (tmp$ = 0; tmp$ !== enumConstants.length; ++tmp$) {\n var value = enumConstants[tmp$];\n var originalName = value.toString();\n originalNames.add_11rb$(originalName);\n var normalizedName = this.toNormalizedName_0(originalName);\n var oldValue = valueMap.put_xwzc9p$(normalizedName, value);\n if (oldValue != null) {\n throw IllegalArgumentException_init(\"duplicate values: '\" + value + \"', '\" + toString(oldValue) + \"'\");\n }}\n this.myOriginalNames_0 = originalNames;\n this.myNormalizedValueMap_0 = valueMap;\n }\n Object.defineProperty(EnumInfoImpl.prototype, 'originalNames', {\n configurable: true,\n get: function () {\n return this.myOriginalNames_0;\n }\n });\n EnumInfoImpl.prototype.toNormalizedName_0 = function (name) {\n return name.toUpperCase();\n };\n EnumInfoImpl.prototype.safeValueOf_7po0m$ = function (name, defaultValue) {\n var value = this.safeValueOf_pdl1vj$(name);\n return value != null ? value : defaultValue;\n };\n EnumInfoImpl.prototype.safeValueOf_pdl1vj$ = function (name) {\n var result;\n if (this.hasValue_pdl1vj$(name)) {\n result = this.myNormalizedValueMap_0.get_11rb$(this.toNormalizedName_0(ensureNotNull(name)));\n } else {\n result = null;\n }\n return result;\n };\n EnumInfoImpl.prototype.hasValue_pdl1vj$ = function (name) {\n return name != null && this.myNormalizedValueMap_0.containsKey_11rb$(this.toNormalizedName_0(name));\n };\n EnumInfoImpl.prototype.unsafeValueOf_61zpoe$ = function (name) {\n var tmp$;\n tmp$ = this.safeValueOf_pdl1vj$(name);\n if (tmp$ == null) {\n throw IllegalArgumentException_init(\"name not found: '\" + name + \"'\");\n }return tmp$;\n };\n EnumInfoImpl.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'EnumInfoImpl',\n interfaces: [EnumInfo]\n };\n function Enums() {\n Enums_instance = this;\n }\n Enums.prototype.valueOf_a9gw98$ = defineInlineFunction('lets-plot-base-portable.jetbrains.datalore.base.enums.Enums.valueOf_a9gw98$', wrapFunction(function () {\n var equals = Kotlin.equals;\n var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init_pdl1vj$;\n return function (EnumT_0, isEnumT, name) {\n var tmp$, tmp$_0;\n tmp$ = EnumT_0.values();\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var e = tmp$[tmp$_0];\n if (equals(name, e.toString())) {\n return e;\n }}\n throw IllegalArgumentException_init(name);\n };\n }));\n Enums.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Enums',\n interfaces: []\n };\n var Enums_instance = null;\n function Enums_getInstance() {\n if (Enums_instance === null) {\n new Enums();\n }return Enums_instance;\n }\n function Button(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Button_initFields() {\n Button_initFields = function () {\n };\n Button$NONE_instance = new Button('NONE', 0);\n Button$LEFT_instance = new Button('LEFT', 1);\n Button$MIDDLE_instance = new Button('MIDDLE', 2);\n Button$RIGHT_instance = new Button('RIGHT', 3);\n }\n var Button$NONE_instance;\n function Button$NONE_getInstance() {\n Button_initFields();\n return Button$NONE_instance;\n }\n var Button$LEFT_instance;\n function Button$LEFT_getInstance() {\n Button_initFields();\n return Button$LEFT_instance;\n }\n var Button$MIDDLE_instance;\n function Button$MIDDLE_getInstance() {\n Button_initFields();\n return Button$MIDDLE_instance;\n }\n var Button$RIGHT_instance;\n function Button$RIGHT_getInstance() {\n Button_initFields();\n return Button$RIGHT_instance;\n }\n Button.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Button',\n interfaces: [Enum]\n };\n function Button$values() {\n return [Button$NONE_getInstance(), Button$LEFT_getInstance(), Button$MIDDLE_getInstance(), Button$RIGHT_getInstance()];\n }\n Button.values = Button$values;\n function Button$valueOf(name) {\n switch (name) {\n case 'NONE':\n return Button$NONE_getInstance();\n case 'LEFT':\n return Button$LEFT_getInstance();\n case 'MIDDLE':\n return Button$MIDDLE_getInstance();\n case 'RIGHT':\n return Button$RIGHT_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.event.Button.' + name);\n }\n }\n Button.valueOf_61zpoe$ = Button$valueOf;\n function Event() {\n this.eventContext_qzl3re$_d6nbbo$_0 = null;\n this.isConsumed_gb68t5$_0 = false;\n }\n Object.defineProperty(Event.prototype, 'eventContext_qzl3re$_0', {\n configurable: true,\n get: function () {\n return this.eventContext_qzl3re$_d6nbbo$_0;\n },\n set: function (eventContext) {\n if (this.eventContext_qzl3re$_0 != null) {\n throw IllegalStateException_init('Already set ' + toString(ensureNotNull(this.eventContext_qzl3re$_0)));\n }if (this.isConsumed) {\n throw IllegalStateException_init(\"Can't set a context to the consumed event\");\n }if (eventContext == null) {\n throw IllegalArgumentException_init(\"Can't set null context\");\n }this.eventContext_qzl3re$_d6nbbo$_0 = eventContext;\n }\n });\n Object.defineProperty(Event.prototype, 'isConsumed', {\n configurable: true,\n get: function () {\n return this.isConsumed_gb68t5$_0;\n },\n set: function (isConsumed) {\n this.isConsumed_gb68t5$_0 = isConsumed;\n }\n });\n Event.prototype.consume = function () {\n this.doConsume_smptag$_0();\n };\n Event.prototype.doConsume_smptag$_0 = function () {\n if (this.isConsumed) {\n throw IllegalStateException_init_0();\n }this.isConsumed = true;\n };\n Event.prototype.ensureConsumed = function () {\n if (!this.isConsumed) {\n this.consume();\n }};\n Event.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Event',\n interfaces: []\n };\n function EventContext() {\n }\n EventContext.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'EventContext',\n interfaces: []\n };\n function Key(name, ordinal, myValue) {\n Enum.call(this);\n this.myValue_n4kdnj$_0 = myValue;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Key_initFields() {\n Key_initFields = function () {\n };\n Key$A_instance = new Key('A', 0, 'A');\n Key$B_instance = new Key('B', 1, 'B');\n Key$C_instance = new Key('C', 2, 'C');\n Key$D_instance = new Key('D', 3, 'D');\n Key$E_instance = new Key('E', 4, 'E');\n Key$F_instance = new Key('F', 5, 'F');\n Key$G_instance = new Key('G', 6, 'G');\n Key$H_instance = new Key('H', 7, 'H');\n Key$I_instance = new Key('I', 8, 'I');\n Key$J_instance = new Key('J', 9, 'J');\n Key$K_instance = new Key('K', 10, 'K');\n Key$L_instance = new Key('L', 11, 'L');\n Key$M_instance = new Key('M', 12, 'M');\n Key$N_instance = new Key('N', 13, 'N');\n Key$O_instance = new Key('O', 14, 'O');\n Key$P_instance = new Key('P', 15, 'P');\n Key$Q_instance = new Key('Q', 16, 'Q');\n Key$R_instance = new Key('R', 17, 'R');\n Key$S_instance = new Key('S', 18, 'S');\n Key$T_instance = new Key('T', 19, 'T');\n Key$U_instance = new Key('U', 20, 'U');\n Key$V_instance = new Key('V', 21, 'V');\n Key$W_instance = new Key('W', 22, 'W');\n Key$X_instance = new Key('X', 23, 'X');\n Key$Y_instance = new Key('Y', 24, 'Y');\n Key$Z_instance = new Key('Z', 25, 'Z');\n Key$DIGIT_0_instance = new Key('DIGIT_0', 26, '0');\n Key$DIGIT_1_instance = new Key('DIGIT_1', 27, '1');\n Key$DIGIT_2_instance = new Key('DIGIT_2', 28, '2');\n Key$DIGIT_3_instance = new Key('DIGIT_3', 29, '3');\n Key$DIGIT_4_instance = new Key('DIGIT_4', 30, '4');\n Key$DIGIT_5_instance = new Key('DIGIT_5', 31, '5');\n Key$DIGIT_6_instance = new Key('DIGIT_6', 32, '6');\n Key$DIGIT_7_instance = new Key('DIGIT_7', 33, '7');\n Key$DIGIT_8_instance = new Key('DIGIT_8', 34, '8');\n Key$DIGIT_9_instance = new Key('DIGIT_9', 35, '9');\n Key$LEFT_BRACE_instance = new Key('LEFT_BRACE', 36, '[');\n Key$RIGHT_BRACE_instance = new Key('RIGHT_BRACE', 37, ']');\n Key$UP_instance = new Key('UP', 38, 'Up');\n Key$DOWN_instance = new Key('DOWN', 39, 'Down');\n Key$LEFT_instance = new Key('LEFT', 40, 'Left');\n Key$RIGHT_instance = new Key('RIGHT', 41, 'Right');\n Key$PAGE_UP_instance = new Key('PAGE_UP', 42, 'Page Up');\n Key$PAGE_DOWN_instance = new Key('PAGE_DOWN', 43, 'Page Down');\n Key$ESCAPE_instance = new Key('ESCAPE', 44, 'Escape');\n Key$ENTER_instance = new Key('ENTER', 45, 'Enter');\n Key$HOME_instance = new Key('HOME', 46, 'Home');\n Key$END_instance = new Key('END', 47, 'End');\n Key$TAB_instance = new Key('TAB', 48, 'Tab');\n Key$SPACE_instance = new Key('SPACE', 49, 'Space');\n Key$INSERT_instance = new Key('INSERT', 50, 'Insert');\n Key$DELETE_instance = new Key('DELETE', 51, 'Delete');\n Key$BACKSPACE_instance = new Key('BACKSPACE', 52, 'Backspace');\n Key$EQUALS_instance = new Key('EQUALS', 53, 'Equals');\n Key$BACK_QUOTE_instance = new Key('BACK_QUOTE', 54, '`');\n Key$PLUS_instance = new Key('PLUS', 55, 'Plus');\n Key$MINUS_instance = new Key('MINUS', 56, 'Minus');\n Key$SLASH_instance = new Key('SLASH', 57, 'Slash');\n Key$CONTROL_instance = new Key('CONTROL', 58, 'Ctrl');\n Key$META_instance = new Key('META', 59, 'Meta');\n Key$ALT_instance = new Key('ALT', 60, 'Alt');\n Key$SHIFT_instance = new Key('SHIFT', 61, 'Shift');\n Key$UNKNOWN_instance = new Key('UNKNOWN', 62, '?');\n Key$F1_instance = new Key('F1', 63, 'F1');\n Key$F2_instance = new Key('F2', 64, 'F2');\n Key$F3_instance = new Key('F3', 65, 'F3');\n Key$F4_instance = new Key('F4', 66, 'F4');\n Key$F5_instance = new Key('F5', 67, 'F5');\n Key$F6_instance = new Key('F6', 68, 'F6');\n Key$F7_instance = new Key('F7', 69, 'F7');\n Key$F8_instance = new Key('F8', 70, 'F8');\n Key$F9_instance = new Key('F9', 71, 'F9');\n Key$F10_instance = new Key('F10', 72, 'F10');\n Key$F11_instance = new Key('F11', 73, 'F11');\n Key$F12_instance = new Key('F12', 74, 'F12');\n Key$COMMA_instance = new Key('COMMA', 75, ',');\n Key$PERIOD_instance = new Key('PERIOD', 76, '.');\n }\n var Key$A_instance;\n function Key$A_getInstance() {\n Key_initFields();\n return Key$A_instance;\n }\n var Key$B_instance;\n function Key$B_getInstance() {\n Key_initFields();\n return Key$B_instance;\n }\n var Key$C_instance;\n function Key$C_getInstance() {\n Key_initFields();\n return Key$C_instance;\n }\n var Key$D_instance;\n function Key$D_getInstance() {\n Key_initFields();\n return Key$D_instance;\n }\n var Key$E_instance;\n function Key$E_getInstance() {\n Key_initFields();\n return Key$E_instance;\n }\n var Key$F_instance;\n function Key$F_getInstance() {\n Key_initFields();\n return Key$F_instance;\n }\n var Key$G_instance;\n function Key$G_getInstance() {\n Key_initFields();\n return Key$G_instance;\n }\n var Key$H_instance;\n function Key$H_getInstance() {\n Key_initFields();\n return Key$H_instance;\n }\n var Key$I_instance;\n function Key$I_getInstance() {\n Key_initFields();\n return Key$I_instance;\n }\n var Key$J_instance;\n function Key$J_getInstance() {\n Key_initFields();\n return Key$J_instance;\n }\n var Key$K_instance;\n function Key$K_getInstance() {\n Key_initFields();\n return Key$K_instance;\n }\n var Key$L_instance;\n function Key$L_getInstance() {\n Key_initFields();\n return Key$L_instance;\n }\n var Key$M_instance;\n function Key$M_getInstance() {\n Key_initFields();\n return Key$M_instance;\n }\n var Key$N_instance;\n function Key$N_getInstance() {\n Key_initFields();\n return Key$N_instance;\n }\n var Key$O_instance;\n function Key$O_getInstance() {\n Key_initFields();\n return Key$O_instance;\n }\n var Key$P_instance;\n function Key$P_getInstance() {\n Key_initFields();\n return Key$P_instance;\n }\n var Key$Q_instance;\n function Key$Q_getInstance() {\n Key_initFields();\n return Key$Q_instance;\n }\n var Key$R_instance;\n function Key$R_getInstance() {\n Key_initFields();\n return Key$R_instance;\n }\n var Key$S_instance;\n function Key$S_getInstance() {\n Key_initFields();\n return Key$S_instance;\n }\n var Key$T_instance;\n function Key$T_getInstance() {\n Key_initFields();\n return Key$T_instance;\n }\n var Key$U_instance;\n function Key$U_getInstance() {\n Key_initFields();\n return Key$U_instance;\n }\n var Key$V_instance;\n function Key$V_getInstance() {\n Key_initFields();\n return Key$V_instance;\n }\n var Key$W_instance;\n function Key$W_getInstance() {\n Key_initFields();\n return Key$W_instance;\n }\n var Key$X_instance;\n function Key$X_getInstance() {\n Key_initFields();\n return Key$X_instance;\n }\n var Key$Y_instance;\n function Key$Y_getInstance() {\n Key_initFields();\n return Key$Y_instance;\n }\n var Key$Z_instance;\n function Key$Z_getInstance() {\n Key_initFields();\n return Key$Z_instance;\n }\n var Key$DIGIT_0_instance;\n function Key$DIGIT_0_getInstance() {\n Key_initFields();\n return Key$DIGIT_0_instance;\n }\n var Key$DIGIT_1_instance;\n function Key$DIGIT_1_getInstance() {\n Key_initFields();\n return Key$DIGIT_1_instance;\n }\n var Key$DIGIT_2_instance;\n function Key$DIGIT_2_getInstance() {\n Key_initFields();\n return Key$DIGIT_2_instance;\n }\n var Key$DIGIT_3_instance;\n function Key$DIGIT_3_getInstance() {\n Key_initFields();\n return Key$DIGIT_3_instance;\n }\n var Key$DIGIT_4_instance;\n function Key$DIGIT_4_getInstance() {\n Key_initFields();\n return Key$DIGIT_4_instance;\n }\n var Key$DIGIT_5_instance;\n function Key$DIGIT_5_getInstance() {\n Key_initFields();\n return Key$DIGIT_5_instance;\n }\n var Key$DIGIT_6_instance;\n function Key$DIGIT_6_getInstance() {\n Key_initFields();\n return Key$DIGIT_6_instance;\n }\n var Key$DIGIT_7_instance;\n function Key$DIGIT_7_getInstance() {\n Key_initFields();\n return Key$DIGIT_7_instance;\n }\n var Key$DIGIT_8_instance;\n function Key$DIGIT_8_getInstance() {\n Key_initFields();\n return Key$DIGIT_8_instance;\n }\n var Key$DIGIT_9_instance;\n function Key$DIGIT_9_getInstance() {\n Key_initFields();\n return Key$DIGIT_9_instance;\n }\n var Key$LEFT_BRACE_instance;\n function Key$LEFT_BRACE_getInstance() {\n Key_initFields();\n return Key$LEFT_BRACE_instance;\n }\n var Key$RIGHT_BRACE_instance;\n function Key$RIGHT_BRACE_getInstance() {\n Key_initFields();\n return Key$RIGHT_BRACE_instance;\n }\n var Key$UP_instance;\n function Key$UP_getInstance() {\n Key_initFields();\n return Key$UP_instance;\n }\n var Key$DOWN_instance;\n function Key$DOWN_getInstance() {\n Key_initFields();\n return Key$DOWN_instance;\n }\n var Key$LEFT_instance;\n function Key$LEFT_getInstance() {\n Key_initFields();\n return Key$LEFT_instance;\n }\n var Key$RIGHT_instance;\n function Key$RIGHT_getInstance() {\n Key_initFields();\n return Key$RIGHT_instance;\n }\n var Key$PAGE_UP_instance;\n function Key$PAGE_UP_getInstance() {\n Key_initFields();\n return Key$PAGE_UP_instance;\n }\n var Key$PAGE_DOWN_instance;\n function Key$PAGE_DOWN_getInstance() {\n Key_initFields();\n return Key$PAGE_DOWN_instance;\n }\n var Key$ESCAPE_instance;\n function Key$ESCAPE_getInstance() {\n Key_initFields();\n return Key$ESCAPE_instance;\n }\n var Key$ENTER_instance;\n function Key$ENTER_getInstance() {\n Key_initFields();\n return Key$ENTER_instance;\n }\n var Key$HOME_instance;\n function Key$HOME_getInstance() {\n Key_initFields();\n return Key$HOME_instance;\n }\n var Key$END_instance;\n function Key$END_getInstance() {\n Key_initFields();\n return Key$END_instance;\n }\n var Key$TAB_instance;\n function Key$TAB_getInstance() {\n Key_initFields();\n return Key$TAB_instance;\n }\n var Key$SPACE_instance;\n function Key$SPACE_getInstance() {\n Key_initFields();\n return Key$SPACE_instance;\n }\n var Key$INSERT_instance;\n function Key$INSERT_getInstance() {\n Key_initFields();\n return Key$INSERT_instance;\n }\n var Key$DELETE_instance;\n function Key$DELETE_getInstance() {\n Key_initFields();\n return Key$DELETE_instance;\n }\n var Key$BACKSPACE_instance;\n function Key$BACKSPACE_getInstance() {\n Key_initFields();\n return Key$BACKSPACE_instance;\n }\n var Key$EQUALS_instance;\n function Key$EQUALS_getInstance() {\n Key_initFields();\n return Key$EQUALS_instance;\n }\n var Key$BACK_QUOTE_instance;\n function Key$BACK_QUOTE_getInstance() {\n Key_initFields();\n return Key$BACK_QUOTE_instance;\n }\n var Key$PLUS_instance;\n function Key$PLUS_getInstance() {\n Key_initFields();\n return Key$PLUS_instance;\n }\n var Key$MINUS_instance;\n function Key$MINUS_getInstance() {\n Key_initFields();\n return Key$MINUS_instance;\n }\n var Key$SLASH_instance;\n function Key$SLASH_getInstance() {\n Key_initFields();\n return Key$SLASH_instance;\n }\n var Key$CONTROL_instance;\n function Key$CONTROL_getInstance() {\n Key_initFields();\n return Key$CONTROL_instance;\n }\n var Key$META_instance;\n function Key$META_getInstance() {\n Key_initFields();\n return Key$META_instance;\n }\n var Key$ALT_instance;\n function Key$ALT_getInstance() {\n Key_initFields();\n return Key$ALT_instance;\n }\n var Key$SHIFT_instance;\n function Key$SHIFT_getInstance() {\n Key_initFields();\n return Key$SHIFT_instance;\n }\n var Key$UNKNOWN_instance;\n function Key$UNKNOWN_getInstance() {\n Key_initFields();\n return Key$UNKNOWN_instance;\n }\n var Key$F1_instance;\n function Key$F1_getInstance() {\n Key_initFields();\n return Key$F1_instance;\n }\n var Key$F2_instance;\n function Key$F2_getInstance() {\n Key_initFields();\n return Key$F2_instance;\n }\n var Key$F3_instance;\n function Key$F3_getInstance() {\n Key_initFields();\n return Key$F3_instance;\n }\n var Key$F4_instance;\n function Key$F4_getInstance() {\n Key_initFields();\n return Key$F4_instance;\n }\n var Key$F5_instance;\n function Key$F5_getInstance() {\n Key_initFields();\n return Key$F5_instance;\n }\n var Key$F6_instance;\n function Key$F6_getInstance() {\n Key_initFields();\n return Key$F6_instance;\n }\n var Key$F7_instance;\n function Key$F7_getInstance() {\n Key_initFields();\n return Key$F7_instance;\n }\n var Key$F8_instance;\n function Key$F8_getInstance() {\n Key_initFields();\n return Key$F8_instance;\n }\n var Key$F9_instance;\n function Key$F9_getInstance() {\n Key_initFields();\n return Key$F9_instance;\n }\n var Key$F10_instance;\n function Key$F10_getInstance() {\n Key_initFields();\n return Key$F10_instance;\n }\n var Key$F11_instance;\n function Key$F11_getInstance() {\n Key_initFields();\n return Key$F11_instance;\n }\n var Key$F12_instance;\n function Key$F12_getInstance() {\n Key_initFields();\n return Key$F12_instance;\n }\n var Key$COMMA_instance;\n function Key$COMMA_getInstance() {\n Key_initFields();\n return Key$COMMA_instance;\n }\n var Key$PERIOD_instance;\n function Key$PERIOD_getInstance() {\n Key_initFields();\n return Key$PERIOD_instance;\n }\n Key.prototype.toString = function () {\n return this.myValue_n4kdnj$_0;\n };\n Key.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Key',\n interfaces: [Enum]\n };\n function Key$values() {\n return [Key$A_getInstance(), Key$B_getInstance(), Key$C_getInstance(), Key$D_getInstance(), Key$E_getInstance(), Key$F_getInstance(), Key$G_getInstance(), Key$H_getInstance(), Key$I_getInstance(), Key$J_getInstance(), Key$K_getInstance(), Key$L_getInstance(), Key$M_getInstance(), Key$N_getInstance(), Key$O_getInstance(), Key$P_getInstance(), Key$Q_getInstance(), Key$R_getInstance(), Key$S_getInstance(), Key$T_getInstance(), Key$U_getInstance(), Key$V_getInstance(), Key$W_getInstance(), Key$X_getInstance(), Key$Y_getInstance(), Key$Z_getInstance(), Key$DIGIT_0_getInstance(), Key$DIGIT_1_getInstance(), Key$DIGIT_2_getInstance(), Key$DIGIT_3_getInstance(), Key$DIGIT_4_getInstance(), Key$DIGIT_5_getInstance(), Key$DIGIT_6_getInstance(), Key$DIGIT_7_getInstance(), Key$DIGIT_8_getInstance(), Key$DIGIT_9_getInstance(), Key$LEFT_BRACE_getInstance(), Key$RIGHT_BRACE_getInstance(), Key$UP_getInstance(), Key$DOWN_getInstance(), Key$LEFT_getInstance(), Key$RIGHT_getInstance(), Key$PAGE_UP_getInstance(), Key$PAGE_DOWN_getInstance(), Key$ESCAPE_getInstance(), Key$ENTER_getInstance(), Key$HOME_getInstance(), Key$END_getInstance(), Key$TAB_getInstance(), Key$SPACE_getInstance(), Key$INSERT_getInstance(), Key$DELETE_getInstance(), Key$BACKSPACE_getInstance(), Key$EQUALS_getInstance(), Key$BACK_QUOTE_getInstance(), Key$PLUS_getInstance(), Key$MINUS_getInstance(), Key$SLASH_getInstance(), Key$CONTROL_getInstance(), Key$META_getInstance(), Key$ALT_getInstance(), Key$SHIFT_getInstance(), Key$UNKNOWN_getInstance(), Key$F1_getInstance(), Key$F2_getInstance(), Key$F3_getInstance(), Key$F4_getInstance(), Key$F5_getInstance(), Key$F6_getInstance(), Key$F7_getInstance(), Key$F8_getInstance(), Key$F9_getInstance(), Key$F10_getInstance(), Key$F11_getInstance(), Key$F12_getInstance(), Key$COMMA_getInstance(), Key$PERIOD_getInstance()];\n }\n Key.values = Key$values;\n function Key$valueOf(name) {\n switch (name) {\n case 'A':\n return Key$A_getInstance();\n case 'B':\n return Key$B_getInstance();\n case 'C':\n return Key$C_getInstance();\n case 'D':\n return Key$D_getInstance();\n case 'E':\n return Key$E_getInstance();\n case 'F':\n return Key$F_getInstance();\n case 'G':\n return Key$G_getInstance();\n case 'H':\n return Key$H_getInstance();\n case 'I':\n return Key$I_getInstance();\n case 'J':\n return Key$J_getInstance();\n case 'K':\n return Key$K_getInstance();\n case 'L':\n return Key$L_getInstance();\n case 'M':\n return Key$M_getInstance();\n case 'N':\n return Key$N_getInstance();\n case 'O':\n return Key$O_getInstance();\n case 'P':\n return Key$P_getInstance();\n case 'Q':\n return Key$Q_getInstance();\n case 'R':\n return Key$R_getInstance();\n case 'S':\n return Key$S_getInstance();\n case 'T':\n return Key$T_getInstance();\n case 'U':\n return Key$U_getInstance();\n case 'V':\n return Key$V_getInstance();\n case 'W':\n return Key$W_getInstance();\n case 'X':\n return Key$X_getInstance();\n case 'Y':\n return Key$Y_getInstance();\n case 'Z':\n return Key$Z_getInstance();\n case 'DIGIT_0':\n return Key$DIGIT_0_getInstance();\n case 'DIGIT_1':\n return Key$DIGIT_1_getInstance();\n case 'DIGIT_2':\n return Key$DIGIT_2_getInstance();\n case 'DIGIT_3':\n return Key$DIGIT_3_getInstance();\n case 'DIGIT_4':\n return Key$DIGIT_4_getInstance();\n case 'DIGIT_5':\n return Key$DIGIT_5_getInstance();\n case 'DIGIT_6':\n return Key$DIGIT_6_getInstance();\n case 'DIGIT_7':\n return Key$DIGIT_7_getInstance();\n case 'DIGIT_8':\n return Key$DIGIT_8_getInstance();\n case 'DIGIT_9':\n return Key$DIGIT_9_getInstance();\n case 'LEFT_BRACE':\n return Key$LEFT_BRACE_getInstance();\n case 'RIGHT_BRACE':\n return Key$RIGHT_BRACE_getInstance();\n case 'UP':\n return Key$UP_getInstance();\n case 'DOWN':\n return Key$DOWN_getInstance();\n case 'LEFT':\n return Key$LEFT_getInstance();\n case 'RIGHT':\n return Key$RIGHT_getInstance();\n case 'PAGE_UP':\n return Key$PAGE_UP_getInstance();\n case 'PAGE_DOWN':\n return Key$PAGE_DOWN_getInstance();\n case 'ESCAPE':\n return Key$ESCAPE_getInstance();\n case 'ENTER':\n return Key$ENTER_getInstance();\n case 'HOME':\n return Key$HOME_getInstance();\n case 'END':\n return Key$END_getInstance();\n case 'TAB':\n return Key$TAB_getInstance();\n case 'SPACE':\n return Key$SPACE_getInstance();\n case 'INSERT':\n return Key$INSERT_getInstance();\n case 'DELETE':\n return Key$DELETE_getInstance();\n case 'BACKSPACE':\n return Key$BACKSPACE_getInstance();\n case 'EQUALS':\n return Key$EQUALS_getInstance();\n case 'BACK_QUOTE':\n return Key$BACK_QUOTE_getInstance();\n case 'PLUS':\n return Key$PLUS_getInstance();\n case 'MINUS':\n return Key$MINUS_getInstance();\n case 'SLASH':\n return Key$SLASH_getInstance();\n case 'CONTROL':\n return Key$CONTROL_getInstance();\n case 'META':\n return Key$META_getInstance();\n case 'ALT':\n return Key$ALT_getInstance();\n case 'SHIFT':\n return Key$SHIFT_getInstance();\n case 'UNKNOWN':\n return Key$UNKNOWN_getInstance();\n case 'F1':\n return Key$F1_getInstance();\n case 'F2':\n return Key$F2_getInstance();\n case 'F3':\n return Key$F3_getInstance();\n case 'F4':\n return Key$F4_getInstance();\n case 'F5':\n return Key$F5_getInstance();\n case 'F6':\n return Key$F6_getInstance();\n case 'F7':\n return Key$F7_getInstance();\n case 'F8':\n return Key$F8_getInstance();\n case 'F9':\n return Key$F9_getInstance();\n case 'F10':\n return Key$F10_getInstance();\n case 'F11':\n return Key$F11_getInstance();\n case 'F12':\n return Key$F12_getInstance();\n case 'COMMA':\n return Key$COMMA_getInstance();\n case 'PERIOD':\n return Key$PERIOD_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.event.Key.' + name);\n }\n }\n Key.valueOf_61zpoe$ = Key$valueOf;\n function KeyEvent() {\n this.keyStroke = null;\n this.keyChar = null;\n }\n Object.defineProperty(KeyEvent.prototype, 'key', {\n configurable: true,\n get: function () {\n return this.keyStroke.key;\n }\n });\n Object.defineProperty(KeyEvent.prototype, 'modifiers', {\n configurable: true,\n get: function () {\n return this.keyStroke.modifiers;\n }\n });\n KeyEvent.prototype.is_ji7i3y$ = function (key, modifiers) {\n return this.keyStroke.is_ji7i3y$(key, modifiers.slice());\n };\n KeyEvent.prototype.is_c4rqdo$ = function (specs) {\n var tmp$;\n for (tmp$ = 0; tmp$ !== specs.length; ++tmp$) {\n var s = specs[tmp$];\n if (s.matches_l9pgtg$(this.keyStroke))\n return true;\n }\n return false;\n };\n KeyEvent.prototype.is_4t3vif$ = function (specs) {\n var tmp$;\n for (tmp$ = 0; tmp$ !== specs.length; ++tmp$) {\n var s = specs[tmp$];\n if (s.matches_l9pgtg$(this.keyStroke))\n return true;\n }\n return false;\n };\n KeyEvent.prototype.has_hny0b7$ = function (key) {\n return this.keyStroke.has_hny0b7$(key);\n };\n KeyEvent.prototype.copy = function () {\n return KeyEvent_init_1(this.key, unboxChar(this.keyChar), this.modifiers);\n };\n KeyEvent.prototype.toString = function () {\n return this.keyStroke.toString();\n };\n KeyEvent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'KeyEvent',\n interfaces: [Event]\n };\n function KeyEvent_init(keyStroke, $this) {\n $this = $this || Object.create(KeyEvent.prototype);\n Event.call($this);\n KeyEvent.call($this);\n $this.keyStroke = keyStroke;\n $this.keyChar = toChar(0);\n return $this;\n }\n function KeyEvent_init_0(key, ch, $this) {\n if (ch === void 0)\n ch = toChar(0);\n $this = $this || Object.create(KeyEvent.prototype);\n Event.call($this);\n KeyEvent.call($this);\n $this.keyStroke = KeyStroke_init_0(key, emptyList());\n $this.keyChar = ch;\n return $this;\n }\n function KeyEvent_init_1(key, ch, modifiers, $this) {\n $this = $this || Object.create(KeyEvent.prototype);\n Event.call($this);\n KeyEvent.call($this);\n $this.keyStroke = KeyStroke_init_0(key, modifiers);\n $this.keyChar = ch;\n return $this;\n }\n function KeyModifiers(isCtrl, isAlt, isShift, isMeta) {\n KeyModifiers$Companion_getInstance();\n this.isCtrl = isCtrl;\n this.isAlt = isAlt;\n this.isShift = isShift;\n this.isMeta = isMeta;\n }\n function KeyModifiers$Companion() {\n KeyModifiers$Companion_instance = this;\n this.EMPTY_MODIFIERS_0 = KeyModifiers_init();\n }\n KeyModifiers$Companion.prototype.emptyModifiers = function () {\n return this.EMPTY_MODIFIERS_0;\n };\n KeyModifiers$Companion.prototype.withShift = function () {\n return new KeyModifiers(false, false, true, false);\n };\n KeyModifiers$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var KeyModifiers$Companion_instance = null;\n function KeyModifiers$Companion_getInstance() {\n if (KeyModifiers$Companion_instance === null) {\n new KeyModifiers$Companion();\n }return KeyModifiers$Companion_instance;\n }\n KeyModifiers.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'KeyModifiers',\n interfaces: []\n };\n function KeyModifiers_init($this) {\n $this = $this || Object.create(KeyModifiers.prototype);\n KeyModifiers.call($this, false, false, false, false);\n return $this;\n }\n function KeyStroke() {\n this.key = null;\n this.modifiers = null;\n }\n KeyStroke.prototype.has_hny0b7$ = function (key) {\n return this.modifiers.contains_11rb$(key);\n };\n KeyStroke.prototype.is_ji7i3y$ = function (key, modifiers) {\n return this.matches_l9pgtg$(KeyStroke_init(key, modifiers.slice()));\n };\n KeyStroke.prototype.matches_l9pgtg$ = function (keyStroke) {\n return this.equals(keyStroke);\n };\n KeyStroke.prototype.with_hny0b7$ = function (key) {\n var keys = HashSet_init(this.modifiers);\n keys.add_11rb$(key);\n return KeyStroke_init_0(this.key, keys);\n };\n KeyStroke.prototype.hashCode = function () {\n return (this.key.hashCode() * 31 | 0) + hashCode(this.modifiers) | 0;\n };\n KeyStroke.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, KeyStroke))\n return false;\n var otherKeyStroke = (tmp$ = other) == null || Kotlin.isType(tmp$, KeyStroke) ? tmp$ : throwCCE();\n return this.key === ensureNotNull(otherKeyStroke).key && equals(this.modifiers, ensureNotNull(otherKeyStroke).modifiers);\n };\n KeyStroke.prototype.toString = function () {\n return this.key.toString() + ' ' + this.modifiers;\n };\n KeyStroke.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'KeyStroke',\n interfaces: []\n };\n function KeyStroke_init(key, modifiers, $this) {\n $this = $this || Object.create(KeyStroke.prototype);\n KeyStroke_init_0(key, asList(modifiers), $this);\n return $this;\n }\n function KeyStroke_init_0(key, modifiers, $this) {\n $this = $this || Object.create(KeyStroke.prototype);\n KeyStroke.call($this);\n $this.key = key;\n $this.modifiers = HashSet_init(modifiers);\n return $this;\n }\n function KeyStrokeSpec() {\n this.myKeyStrokes_0 = null;\n }\n Object.defineProperty(KeyStrokeSpec.prototype, 'keyStrokes', {\n configurable: true,\n get: function () {\n return listOf(this.myKeyStrokes_0.slice());\n }\n });\n Object.defineProperty(KeyStrokeSpec.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myKeyStrokes_0.length === 0;\n }\n });\n KeyStrokeSpec.prototype.matches_l9pgtg$ = function (keyStroke) {\n var tmp$, tmp$_0;\n tmp$ = this.myKeyStrokes_0;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var spec = tmp$[tmp$_0];\n if (spec.matches_l9pgtg$(keyStroke)) {\n return true;\n }}\n return false;\n };\n KeyStrokeSpec.prototype.with_hny0b7$ = function (key) {\n var tmp$, tmp$_0;\n var modified = ArrayList_init();\n tmp$ = this.myKeyStrokes_0;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var keyStroke = tmp$[tmp$_0];\n modified.add_11rb$(keyStroke.with_hny0b7$(key));\n }\n return KeyStrokeSpec_init_0(modified);\n };\n KeyStrokeSpec.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n var that = (tmp$_0 = other) == null || Kotlin.isType(tmp$_0, KeyStrokeSpec) ? tmp$_0 : throwCCE();\n return equals(this.keyStrokes, ensureNotNull(that).keyStrokes);\n };\n KeyStrokeSpec.prototype.hashCode = function () {\n return hashCode(this.keyStrokes);\n };\n KeyStrokeSpec.prototype.toString = function () {\n return this.keyStrokes.toString();\n };\n KeyStrokeSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'KeyStrokeSpec',\n interfaces: []\n };\n function KeyStrokeSpec_init(key, modifiers, $this) {\n $this = $this || Object.create(KeyStrokeSpec.prototype);\n KeyStrokeSpec.call($this);\n $this.myKeyStrokes_0 = [KeyStroke_init(key, modifiers.slice())];\n return $this;\n }\n function KeyStrokeSpec_init_0(keyStrokes, $this) {\n $this = $this || Object.create(KeyStrokeSpec.prototype);\n KeyStrokeSpec.call($this);\n $this.myKeyStrokes_0 = copyToArray(keyStrokes);\n return $this;\n }\n function KeyStrokeSpec_init_1(keyStrokes, $this) {\n $this = $this || Object.create(KeyStrokeSpec.prototype);\n KeyStrokeSpec.call($this);\n $this.myKeyStrokes_0 = keyStrokes.slice();\n return $this;\n }\n function KeyStrokeSpecs() {\n KeyStrokeSpecs_instance = this;\n this.COPY = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$C_getInstance(), []), KeyStrokeSpec_init(Key$INSERT_getInstance(), [ModifierKey$CONTROL_getInstance()])]);\n this.CUT = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$X_getInstance(), []), KeyStrokeSpec_init(Key$DELETE_getInstance(), [ModifierKey$SHIFT_getInstance()])]);\n this.PASTE = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$V_getInstance(), []), KeyStrokeSpec_init(Key$INSERT_getInstance(), [ModifierKey$SHIFT_getInstance()])]);\n this.UNDO = this.ctrlOrMeta_ji7i3y$(Key$Z_getInstance(), []);\n this.REDO = this.UNDO.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.COMPLETE = KeyStrokeSpec_init(Key$SPACE_getInstance(), [ModifierKey$CONTROL_getInstance()]);\n this.SHOW_DOC = this.composite_c4rqdo$([KeyStrokeSpec_init(Key$F1_getInstance(), []), this.ctrlOrMeta_ji7i3y$(Key$J_getInstance(), [])]);\n this.HELP = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$I_getInstance(), []), this.ctrlOrMeta_ji7i3y$(Key$F1_getInstance(), [])]);\n this.HOME = this.composite_4t3vif$([KeyStroke_init(Key$HOME_getInstance(), []), KeyStroke_init(Key$LEFT_getInstance(), [ModifierKey$META_getInstance()])]);\n this.END = this.composite_4t3vif$([KeyStroke_init(Key$END_getInstance(), []), KeyStroke_init(Key$RIGHT_getInstance(), [ModifierKey$META_getInstance()])]);\n this.FILE_HOME = this.ctrlOrMeta_ji7i3y$(Key$HOME_getInstance(), []);\n this.FILE_END = this.ctrlOrMeta_ji7i3y$(Key$END_getInstance(), []);\n this.PREV_WORD = this.ctrlOrAlt_ji7i3y$(Key$LEFT_getInstance(), []);\n this.NEXT_WORD = this.ctrlOrAlt_ji7i3y$(Key$RIGHT_getInstance(), []);\n this.NEXT_EDITABLE = this.ctrlOrMeta_ji7i3y$(Key$RIGHT_getInstance(), [ModifierKey$ALT_getInstance()]);\n this.PREV_EDITABLE = this.ctrlOrMeta_ji7i3y$(Key$LEFT_getInstance(), [ModifierKey$ALT_getInstance()]);\n this.SELECT_ALL = this.ctrlOrMeta_ji7i3y$(Key$A_getInstance(), []);\n this.SELECT_FILE_HOME = this.FILE_HOME.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_FILE_END = this.FILE_END.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_HOME = this.HOME.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_END = this.END.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_WORD_FORWARD = this.NEXT_WORD.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_WORD_BACKWARD = this.PREV_WORD.with_hny0b7$(ModifierKey$SHIFT_getInstance());\n this.SELECT_LEFT = KeyStrokeSpec_init(Key$LEFT_getInstance(), [ModifierKey$SHIFT_getInstance()]);\n this.SELECT_RIGHT = KeyStrokeSpec_init(Key$RIGHT_getInstance(), [ModifierKey$SHIFT_getInstance()]);\n this.SELECT_UP = KeyStrokeSpec_init(Key$UP_getInstance(), [ModifierKey$SHIFT_getInstance()]);\n this.SELECT_DOWN = KeyStrokeSpec_init(Key$DOWN_getInstance(), [ModifierKey$SHIFT_getInstance()]);\n this.INCREASE_SELECTION = KeyStrokeSpec_init(Key$UP_getInstance(), [ModifierKey$ALT_getInstance()]);\n this.DECREASE_SELECTION = KeyStrokeSpec_init(Key$DOWN_getInstance(), [ModifierKey$ALT_getInstance()]);\n this.INSERT_BEFORE = this.composite_4t3vif$([KeyStroke_init_0(Key$ENTER_getInstance(), this.add_0(ModifierKey$META_getInstance(), [])), KeyStroke_init(Key$INSERT_getInstance(), []), KeyStroke_init_0(Key$ENTER_getInstance(), this.add_0(ModifierKey$CONTROL_getInstance(), []))]);\n this.INSERT_AFTER = KeyStrokeSpec_init(Key$ENTER_getInstance(), []);\n this.INSERT = this.composite_c4rqdo$([this.INSERT_BEFORE, this.INSERT_AFTER]);\n this.DUPLICATE = this.ctrlOrMeta_ji7i3y$(Key$D_getInstance(), []);\n this.DELETE_CURRENT = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$BACKSPACE_getInstance(), []), this.ctrlOrMeta_ji7i3y$(Key$DELETE_getInstance(), [])]);\n this.DELETE_TO_WORD_START = KeyStrokeSpec_init(Key$BACKSPACE_getInstance(), [ModifierKey$ALT_getInstance()]);\n this.MATCHING_CONSTRUCTS = this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Key$LEFT_BRACE_getInstance(), [ModifierKey$ALT_getInstance()]), this.ctrlOrMeta_ji7i3y$(Key$RIGHT_BRACE_getInstance(), [ModifierKey$ALT_getInstance()])]);\n this.NAVIGATE = this.ctrlOrMeta_ji7i3y$(Key$B_getInstance(), []);\n this.NAVIGATE_BACK = this.ctrlOrMeta_ji7i3y$(Key$LEFT_BRACE_getInstance(), []);\n this.NAVIGATE_FORWARD = this.ctrlOrMeta_ji7i3y$(Key$RIGHT_BRACE_getInstance(), []);\n }\n KeyStrokeSpecs.prototype.ctrlOrMeta_ji7i3y$ = function (key, modifiers) {\n return this.composite_4t3vif$([KeyStroke_init_0(key, this.add_0(ModifierKey$CONTROL_getInstance(), modifiers.slice())), KeyStroke_init_0(key, this.add_0(ModifierKey$META_getInstance(), modifiers.slice()))]);\n };\n KeyStrokeSpecs.prototype.ctrlOrAlt_ji7i3y$ = function (key, modifiers) {\n return this.composite_4t3vif$([KeyStroke_init_0(key, this.add_0(ModifierKey$CONTROL_getInstance(), modifiers.slice())), KeyStroke_init_0(key, this.add_0(ModifierKey$ALT_getInstance(), modifiers.slice()))]);\n };\n KeyStrokeSpecs.prototype.add_0 = function (key, otherKeys) {\n var result = HashSet_init(asList(otherKeys));\n result.add_11rb$(key);\n return result;\n };\n KeyStrokeSpecs.prototype.composite_c4rqdo$ = function (specs) {\n var tmp$, tmp$_0;\n var keyStrokes = HashSet_init_0();\n for (tmp$ = 0; tmp$ !== specs.length; ++tmp$) {\n var spec = specs[tmp$];\n tmp$_0 = spec.keyStrokes.iterator();\n while (tmp$_0.hasNext()) {\n var ks = tmp$_0.next();\n keyStrokes.add_11rb$(ks);\n }\n }\n return KeyStrokeSpec_init_0(keyStrokes);\n };\n KeyStrokeSpecs.prototype.composite_4t3vif$ = function (specs) {\n return KeyStrokeSpec_init_1(specs.slice());\n };\n KeyStrokeSpecs.prototype.withoutShift_b0jlop$ = function (spec) {\n var tmp$;\n var keyStroke = spec.keyStrokes.iterator().next();\n var modifiers = keyStroke.modifiers;\n var withoutShift = HashSet_init_0();\n tmp$ = modifiers.iterator();\n while (tmp$.hasNext()) {\n var modifier = tmp$.next();\n if (modifier !== ModifierKey$SHIFT_getInstance()) {\n withoutShift.add_11rb$(modifier);\n }}\n return KeyEvent_init_1(keyStroke.key, toChar(0), withoutShift);\n };\n KeyStrokeSpecs.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'KeyStrokeSpecs',\n interfaces: []\n };\n var KeyStrokeSpecs_instance = null;\n function KeyStrokeSpecs_getInstance() {\n if (KeyStrokeSpecs_instance === null) {\n new KeyStrokeSpecs();\n }return KeyStrokeSpecs_instance;\n }\n function ModifierKey(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ModifierKey_initFields() {\n ModifierKey_initFields = function () {\n };\n ModifierKey$CONTROL_instance = new ModifierKey('CONTROL', 0);\n ModifierKey$ALT_instance = new ModifierKey('ALT', 1);\n ModifierKey$SHIFT_instance = new ModifierKey('SHIFT', 2);\n ModifierKey$META_instance = new ModifierKey('META', 3);\n }\n var ModifierKey$CONTROL_instance;\n function ModifierKey$CONTROL_getInstance() {\n ModifierKey_initFields();\n return ModifierKey$CONTROL_instance;\n }\n var ModifierKey$ALT_instance;\n function ModifierKey$ALT_getInstance() {\n ModifierKey_initFields();\n return ModifierKey$ALT_instance;\n }\n var ModifierKey$SHIFT_instance;\n function ModifierKey$SHIFT_getInstance() {\n ModifierKey_initFields();\n return ModifierKey$SHIFT_instance;\n }\n var ModifierKey$META_instance;\n function ModifierKey$META_getInstance() {\n ModifierKey_initFields();\n return ModifierKey$META_instance;\n }\n ModifierKey.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ModifierKey',\n interfaces: [Enum]\n };\n function ModifierKey$values() {\n return [ModifierKey$CONTROL_getInstance(), ModifierKey$ALT_getInstance(), ModifierKey$SHIFT_getInstance(), ModifierKey$META_getInstance()];\n }\n ModifierKey.values = ModifierKey$values;\n function ModifierKey$valueOf(name) {\n switch (name) {\n case 'CONTROL':\n return ModifierKey$CONTROL_getInstance();\n case 'ALT':\n return ModifierKey$ALT_getInstance();\n case 'SHIFT':\n return ModifierKey$SHIFT_getInstance();\n case 'META':\n return ModifierKey$META_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.event.ModifierKey.' + name);\n }\n }\n ModifierKey.valueOf_61zpoe$ = ModifierKey$valueOf;\n function MouseEvent(x, y, button, modifiers) {\n MouseEvent$Companion_getInstance();\n PointEvent.call(this, x, y);\n this.button = button;\n this.modifiers = modifiers;\n if (this.button == null) {\n var message = 'Null button';\n throw IllegalArgumentException_init(message.toString());\n }}\n function MouseEvent$Companion() {\n MouseEvent$Companion_instance = this;\n }\n MouseEvent$Companion.prototype.noButton_119tl4$ = function (v) {\n return MouseEvent_init(v, Button$NONE_getInstance(), KeyModifiers$Companion_getInstance().emptyModifiers());\n };\n MouseEvent$Companion.prototype.leftButton_119tl4$ = function (v) {\n return MouseEvent_init(v, Button$LEFT_getInstance(), KeyModifiers$Companion_getInstance().emptyModifiers());\n };\n MouseEvent$Companion.prototype.middleButton_119tl4$ = function (v) {\n return MouseEvent_init(v, Button$MIDDLE_getInstance(), KeyModifiers$Companion_getInstance().emptyModifiers());\n };\n MouseEvent$Companion.prototype.rightButton_119tl4$ = function (v) {\n return MouseEvent_init(v, Button$RIGHT_getInstance(), KeyModifiers$Companion_getInstance().emptyModifiers());\n };\n MouseEvent$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var MouseEvent$Companion_instance = null;\n function MouseEvent$Companion_getInstance() {\n if (MouseEvent$Companion_instance === null) {\n new MouseEvent$Companion();\n }return MouseEvent$Companion_instance;\n }\n MouseEvent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MouseEvent',\n interfaces: [PointEvent]\n };\n function MouseEvent_init(v, button, modifiers, $this) {\n $this = $this || Object.create(MouseEvent.prototype);\n MouseEvent.call($this, v.x, v.y, button, modifiers);\n return $this;\n }\n function MouseEventSource() {\n }\n MouseEventSource.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'MouseEventSource',\n interfaces: []\n };\n function MouseEventSpec(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function MouseEventSpec_initFields() {\n MouseEventSpec_initFields = function () {\n };\n MouseEventSpec$MOUSE_ENTERED_instance = new MouseEventSpec('MOUSE_ENTERED', 0);\n MouseEventSpec$MOUSE_LEFT_instance = new MouseEventSpec('MOUSE_LEFT', 1);\n MouseEventSpec$MOUSE_MOVED_instance = new MouseEventSpec('MOUSE_MOVED', 2);\n MouseEventSpec$MOUSE_DRAGGED_instance = new MouseEventSpec('MOUSE_DRAGGED', 3);\n MouseEventSpec$MOUSE_CLICKED_instance = new MouseEventSpec('MOUSE_CLICKED', 4);\n MouseEventSpec$MOUSE_DOUBLE_CLICKED_instance = new MouseEventSpec('MOUSE_DOUBLE_CLICKED', 5);\n MouseEventSpec$MOUSE_PRESSED_instance = new MouseEventSpec('MOUSE_PRESSED', 6);\n MouseEventSpec$MOUSE_RELEASED_instance = new MouseEventSpec('MOUSE_RELEASED', 7);\n }\n var MouseEventSpec$MOUSE_ENTERED_instance;\n function MouseEventSpec$MOUSE_ENTERED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_ENTERED_instance;\n }\n var MouseEventSpec$MOUSE_LEFT_instance;\n function MouseEventSpec$MOUSE_LEFT_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_LEFT_instance;\n }\n var MouseEventSpec$MOUSE_MOVED_instance;\n function MouseEventSpec$MOUSE_MOVED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_MOVED_instance;\n }\n var MouseEventSpec$MOUSE_DRAGGED_instance;\n function MouseEventSpec$MOUSE_DRAGGED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_DRAGGED_instance;\n }\n var MouseEventSpec$MOUSE_CLICKED_instance;\n function MouseEventSpec$MOUSE_CLICKED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_CLICKED_instance;\n }\n var MouseEventSpec$MOUSE_DOUBLE_CLICKED_instance;\n function MouseEventSpec$MOUSE_DOUBLE_CLICKED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_DOUBLE_CLICKED_instance;\n }\n var MouseEventSpec$MOUSE_PRESSED_instance;\n function MouseEventSpec$MOUSE_PRESSED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_PRESSED_instance;\n }\n var MouseEventSpec$MOUSE_RELEASED_instance;\n function MouseEventSpec$MOUSE_RELEASED_getInstance() {\n MouseEventSpec_initFields();\n return MouseEventSpec$MOUSE_RELEASED_instance;\n }\n MouseEventSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MouseEventSpec',\n interfaces: [Enum]\n };\n function MouseEventSpec$values() {\n return [MouseEventSpec$MOUSE_ENTERED_getInstance(), MouseEventSpec$MOUSE_LEFT_getInstance(), MouseEventSpec$MOUSE_MOVED_getInstance(), MouseEventSpec$MOUSE_DRAGGED_getInstance(), MouseEventSpec$MOUSE_CLICKED_getInstance(), MouseEventSpec$MOUSE_DOUBLE_CLICKED_getInstance(), MouseEventSpec$MOUSE_PRESSED_getInstance(), MouseEventSpec$MOUSE_RELEASED_getInstance()];\n }\n MouseEventSpec.values = MouseEventSpec$values;\n function MouseEventSpec$valueOf(name) {\n switch (name) {\n case 'MOUSE_ENTERED':\n return MouseEventSpec$MOUSE_ENTERED_getInstance();\n case 'MOUSE_LEFT':\n return MouseEventSpec$MOUSE_LEFT_getInstance();\n case 'MOUSE_MOVED':\n return MouseEventSpec$MOUSE_MOVED_getInstance();\n case 'MOUSE_DRAGGED':\n return MouseEventSpec$MOUSE_DRAGGED_getInstance();\n case 'MOUSE_CLICKED':\n return MouseEventSpec$MOUSE_CLICKED_getInstance();\n case 'MOUSE_DOUBLE_CLICKED':\n return MouseEventSpec$MOUSE_DOUBLE_CLICKED_getInstance();\n case 'MOUSE_PRESSED':\n return MouseEventSpec$MOUSE_PRESSED_getInstance();\n case 'MOUSE_RELEASED':\n return MouseEventSpec$MOUSE_RELEASED_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.event.MouseEventSpec.' + name);\n }\n }\n MouseEventSpec.valueOf_61zpoe$ = MouseEventSpec$valueOf;\n function PointEvent(x, y) {\n Event.call(this);\n this.x = x;\n this.y = y;\n }\n Object.defineProperty(PointEvent.prototype, 'location', {\n configurable: true,\n get: function () {\n return new Vector(this.x, this.y);\n }\n });\n PointEvent.prototype.toString = function () {\n return '{x=' + this.x + ',y=' + this.y + '}';\n };\n PointEvent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointEvent',\n interfaces: [Event]\n };\n function Function() {\n }\n Function.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Function',\n interfaces: []\n };\n function Functions() {\n Functions_instance = this;\n this.TRUE_PREDICATE_0 = Functions$TRUE_PREDICATE$lambda;\n this.FALSE_PREDICATE_0 = Functions$FALSE_PREDICATE$lambda;\n this.NULL_PREDICATE_0 = Functions$NULL_PREDICATE$lambda;\n this.NOT_NULL_PREDICATE_0 = Functions$NOT_NULL_PREDICATE$lambda;\n }\n function Functions$constantSupplier$ObjectLiteral(closure$value) {\n this.closure$value = closure$value;\n }\n Functions$constantSupplier$ObjectLiteral.prototype.get = function () {\n return this.closure$value;\n };\n Functions$constantSupplier$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Supplier]\n };\n Functions.prototype.constantSupplier_mh5how$ = function (value) {\n return new Functions$constantSupplier$ObjectLiteral(value);\n };\n Functions.prototype.memorize_kji2v1$ = function (supplier) {\n return new Functions$Memo(supplier);\n };\n Functions.prototype.alwaysTrue_287e2$ = function () {\n return this.TRUE_PREDICATE_0;\n };\n Functions.prototype.alwaysFalse_287e2$ = function () {\n return this.FALSE_PREDICATE_0;\n };\n function Functions$constant$lambda(closure$result) {\n return function (it) {\n return closure$result;\n };\n }\n Functions.prototype.constant_jkq9vw$ = function (result) {\n return Functions$constant$lambda(result);\n };\n Functions.prototype.isNull_287e2$ = function () {\n return this.NULL_PREDICATE_0;\n };\n Functions.prototype.isNotNull_287e2$ = function () {\n return this.NOT_NULL_PREDICATE_0;\n };\n function Functions$identity$lambda(it) {\n return it;\n }\n Functions.prototype.identity_287e2$ = function () {\n return Functions$identity$lambda;\n };\n function Functions$same$lambda(closure$value) {\n return function (it) {\n return it === closure$value;\n };\n }\n Functions.prototype.same_tpy1pm$ = function (value) {\n return Functions$same$lambda(value);\n };\n function Functions$funcOf$ObjectLiteral(closure$lambda) {\n this.closure$lambda = closure$lambda;\n }\n Functions$funcOf$ObjectLiteral.prototype.apply_11rb$ = function (value) {\n return this.closure$lambda(value);\n };\n Functions$funcOf$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Function]\n };\n Functions.prototype.funcOf_7h29gk$ = function (lambda) {\n return new Functions$funcOf$ObjectLiteral(lambda);\n };\n function Functions$Memo(mySupplier) {\n this.mySupplier_0 = mySupplier;\n this.myCachedValue_0 = null;\n this.myCached_0 = false;\n }\n Functions$Memo.prototype.get = function () {\n if (!this.myCached_0) {\n this.myCachedValue_0 = this.mySupplier_0.get();\n this.myCached_0 = true;\n }return ensureNotNull(this.myCachedValue_0);\n };\n Functions$Memo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Memo',\n interfaces: [Supplier]\n };\n function Functions$TRUE_PREDICATE$lambda(it) {\n return true;\n }\n function Functions$FALSE_PREDICATE$lambda(it) {\n return false;\n }\n function Functions$NULL_PREDICATE$lambda(it) {\n return it == null;\n }\n function Functions$NOT_NULL_PREDICATE$lambda(it) {\n return it != null;\n }\n Functions.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Functions',\n interfaces: []\n };\n var Functions_instance = null;\n function Functions_getInstance() {\n if (Functions_instance === null) {\n new Functions();\n }return Functions_instance;\n }\n function Runnable() {\n }\n Runnable.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Runnable',\n interfaces: []\n };\n function Supplier() {\n }\n Supplier.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Supplier',\n interfaces: []\n };\n function Value(myValue) {\n this.myValue_0 = myValue;\n }\n Value.prototype.get = function () {\n return this.myValue_0;\n };\n Value.prototype.set_11rb$ = function (value) {\n this.myValue_0 = value;\n };\n Value.prototype.toString = function () {\n return '' + toString(this.myValue_0);\n };\n Value.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Value',\n interfaces: [Supplier]\n };\n function Preconditions() {\n Preconditions_instance = this;\n }\n Preconditions.prototype.checkState_6taknv$ = function (expression) {\n if (!expression) {\n throw IllegalStateException_init_0();\n }};\n Preconditions.prototype.checkState_eltq40$ = function (expression, errorMessage) {\n if (!expression) {\n throw IllegalStateException_init(errorMessage.toString());\n }};\n Preconditions.prototype.checkArgument_6taknv$ = function (expression) {\n if (!expression) {\n throw IllegalArgumentException_init_0();\n }};\n Preconditions.prototype.checkArgument_eltq40$ = function (expression, errorMessage) {\n if (!expression) {\n throw IllegalArgumentException_init(errorMessage.toString());\n }};\n Preconditions.prototype.checkNotNull_mh5how$ = function (reference) {\n if (reference == null) {\n throw NullPointerException_init();\n }return reference;\n };\n Preconditions.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Preconditions',\n interfaces: []\n };\n var Preconditions_instance = null;\n function Preconditions_getInstance() {\n if (Preconditions_instance === null) {\n new Preconditions();\n }return Preconditions_instance;\n }\n function Strings() {\n Strings_instance = this;\n }\n Strings.prototype.isNullOrEmpty_pdl1vj$ = function (s) {\n var tmp$ = s == null;\n if (!tmp$) {\n tmp$ = s.length === 0;\n }return tmp$;\n };\n Strings.prototype.nullToEmpty_pdl1vj$ = function (string) {\n return string != null ? string : '';\n };\n Strings.prototype.repeat_bm4lxs$ = function (string, count) {\n var stringBuilder = StringBuilder_init();\n for (var i = 0; i < count; i++) {\n stringBuilder.append_pdl1vj$(string);\n }\n return stringBuilder.toString();\n };\n Strings.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Strings',\n interfaces: []\n };\n var Strings_instance = null;\n function Strings_getInstance() {\n if (Strings_instance === null) {\n new Strings();\n }return Strings_instance;\n }\n function Throwables() {\n Throwables_instance = this;\n }\n Throwables.prototype.getRootCause_tcv7n7$ = function (throwable) {\n var slowPointer = throwable;\n var advanceSlowPointer = false;\n var cause = throwable;\n while (cause.cause != null) {\n cause = ensureNotNull(cause.cause);\n if (cause === slowPointer) {\n throw new IllegalArgumentException('Loop in causal chain detected.', cause);\n }if (advanceSlowPointer) {\n slowPointer = ensureNotNull(slowPointer.cause);\n }advanceSlowPointer = !advanceSlowPointer;\n }\n return cause;\n };\n Throwables.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Throwables',\n interfaces: []\n };\n var Throwables_instance = null;\n function Throwables_getInstance() {\n if (Throwables_instance === null) {\n new Throwables();\n }return Throwables_instance;\n }\n function ClosedRange(lower, upper) {\n ClosedRange$Companion_getInstance();\n this.lowerEnd = null;\n this.upperEnd = null;\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if ((tmp$_0 = typeof (tmp$ = lower) === 'number' ? tmp$ : null) != null) {\n if (!isFinite(tmp$_0)) {\n var message = 'ends must be finite: lower=' + lower + ' upper=' + upper;\n throw IllegalStateException_init(message.toString());\n }}if ((tmp$_2 = typeof (tmp$_1 = upper) === 'number' ? tmp$_1 : null) != null) {\n if (!isFinite(tmp$_2)) {\n var message_0 = 'ends must be finite: lower=' + lower + ' upper=' + upper;\n throw IllegalStateException_init(message_0.toString());\n }}this.lowerEnd = Comparables_getInstance().min_sdesaw$(lower, upper);\n this.upperEnd = Comparables_getInstance().max_sdesaw$(lower, upper);\n }\n ClosedRange.prototype.contains_mef7kx$ = function (v) {\n return Comparables_getInstance().lse_sdesaw$(this.lowerEnd, v) && Comparables_getInstance().lse_sdesaw$(v, this.upperEnd);\n };\n ClosedRange.prototype.span_d226ot$ = function (other) {\n if (this.encloses_d226ot$(other))\n return this;\n return other.encloses_d226ot$(this) ? other : new ClosedRange(Comparables_getInstance().min_sdesaw$(this.lowerEnd, other.lowerEnd), Comparables_getInstance().max_sdesaw$(this.upperEnd, other.upperEnd));\n };\n ClosedRange.prototype.encloses_d226ot$ = function (other) {\n return Comparables_getInstance().lse_sdesaw$(this.lowerEnd, other.lowerEnd) && Comparables_getInstance().gte_sdesaw$(this.upperEnd, other.upperEnd);\n };\n ClosedRange.prototype.isConnected_d226ot$ = function (other) {\n return !(Comparables_getInstance().gt_sdesaw$(this.lowerEnd, other.upperEnd) || Comparables_getInstance().ls_sdesaw$(this.upperEnd, other.lowerEnd));\n };\n ClosedRange.prototype.intersection_d226ot$ = function (other) {\n if (!this.isConnected_d226ot$(other))\n throw IllegalArgumentException_init('Ranges are not connected: this=' + this + ' other=' + other);\n if (this.encloses_d226ot$(other))\n return other;\n return other.encloses_d226ot$(this) ? this : new ClosedRange(Comparables_getInstance().max_sdesaw$(this.lowerEnd, other.lowerEnd), Comparables_getInstance().min_sdesaw$(this.upperEnd, other.upperEnd));\n };\n ClosedRange.prototype.toString = function () {\n return 'ClosedRange[' + this.lowerEnd + ', ' + this.upperEnd + ']';\n };\n ClosedRange.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, ClosedRange) ? tmp$_0 : throwCCE();\n if (!equals(this.lowerEnd, other.lowerEnd))\n return false;\n if (!equals(this.upperEnd, other.upperEnd))\n return false;\n return true;\n };\n ClosedRange.prototype.hashCode = function () {\n return hashCode(this.lowerEnd) + (31 * hashCode(this.upperEnd) | 0) | 0;\n };\n function ClosedRange$Companion() {\n ClosedRange$Companion_instance = this;\n }\n ClosedRange$Companion.prototype.singleton_f1zjgi$ = function (v) {\n return new ClosedRange(v, v);\n };\n ClosedRange$Companion.prototype.encloseAll_17hg47$ = function (values) {\n var tmp$;\n var iterated = false;\n var min = null;\n var max = null;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (!iterated) {\n iterated = true;\n min = v;\n max = v;\n } else {\n min = Comparables_getInstance().min_sdesaw$(ensureNotNull(min), ensureNotNull(v));\n max = Comparables_getInstance().max_sdesaw$(ensureNotNull(max), v);\n }\n }\n if (!iterated) {\n throw NoSuchElementException_init();\n }return new ClosedRange(ensureNotNull(min), ensureNotNull(max));\n };\n ClosedRange$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ClosedRange$Companion_instance = null;\n function ClosedRange$Companion_getInstance() {\n if (ClosedRange$Companion_instance === null) {\n new ClosedRange$Companion();\n }return ClosedRange$Companion_instance;\n }\n ClosedRange.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ClosedRange',\n interfaces: []\n };\n function Comparables() {\n Comparables_instance = this;\n }\n Comparables.prototype.min_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) < 0 ? a : b;\n };\n Comparables.prototype.max_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) >= 0 ? a : b;\n };\n Comparables.prototype.lse_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) <= 0;\n };\n Comparables.prototype.gte_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) >= 0;\n };\n Comparables.prototype.ls_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) < 0;\n };\n Comparables.prototype.gt_sdesaw$ = function (a, b) {\n return Kotlin.compareTo(a, b) > 0;\n };\n Comparables.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Comparables',\n interfaces: []\n };\n var Comparables_instance = null;\n function Comparables_getInstance() {\n if (Comparables_instance === null) {\n new Comparables();\n }return Comparables_instance;\n }\n function ComparatorOrdering(comparator) {\n Ordering.call(this);\n this.myComparator_0 = comparator;\n }\n ComparatorOrdering.prototype.compare = function (a, b) {\n return this.myComparator_0.compare(a, b);\n };\n ComparatorOrdering.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ComparatorOrdering',\n interfaces: [Ordering]\n };\n function Iterables() {\n Iterables_instance = this;\n }\n Iterables.prototype.checkNonNegative_0 = function (position) {\n if (position < 0) {\n throw new IndexOutOfBoundsException(position.toString());\n }};\n Iterables.prototype.toList_yl67zr$ = function (iterable) {\n return toList(iterable);\n };\n Iterables.prototype.size_fakr2g$ = function (iterable) {\n return count(iterable);\n };\n Iterables.prototype.isEmpty_fakr2g$ = function (iterable) {\n var tmp$, tmp$_0, tmp$_1;\n return (tmp$_1 = (tmp$_0 = Kotlin.isType(tmp$ = iterable, Collection) ? tmp$ : null) != null ? tmp$_0.isEmpty() : null) != null ? tmp$_1 : !iterable.iterator().hasNext();\n };\n Iterables.prototype.filter_fpit1u$ = function (unfiltered, retainIfTrue) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = unfiltered.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (retainIfTrue(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n Iterables.prototype.all_fpit1u$ = function (iterable, predicate) {\n var all$result;\n all$break: do {\n var tmp$;\n if (Kotlin.isType(iterable, Collection) && iterable.isEmpty()) {\n all$result = true;\n break all$break;\n }tmp$ = iterable.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (!predicate(element)) {\n all$result = false;\n break all$break;\n }}\n all$result = true;\n }\n while (false);\n return all$result;\n };\n Iterables.prototype.concat_yxozss$ = function (a, b) {\n return plus_0(a, b);\n };\n Iterables.prototype.get_7iig3d$ = function (iterable, position) {\n var tmp$;\n this.checkNonNegative_0(position);\n if (Kotlin.isType(iterable, List)) {\n return (Kotlin.isType(tmp$ = iterable, List) ? tmp$ : throwCCE()).get_za3lpa$(position);\n }var it = iterable.iterator();\n for (var i = 0; i <= position; i++) {\n if (i === position) {\n return it.next();\n }it.next();\n }\n throw new IndexOutOfBoundsException(position.toString());\n };\n Iterables.prototype.get_dhabsj$ = function (iterable, position, defaultValue) {\n var tmp$;\n this.checkNonNegative_0(position);\n if (Kotlin.isType(iterable, List)) {\n var list = Kotlin.isType(tmp$ = iterable, List) ? tmp$ : throwCCE();\n return position < list.size ? list.get_za3lpa$(position) : defaultValue;\n }var it = iterable.iterator();\n var i = 0;\n while (i <= position && it.hasNext()) {\n if (i === position) {\n return it.next();\n }it.next();\n i = i + 1 | 0;\n }\n return defaultValue;\n };\n Iterables.prototype.find_nk18wc$ = function (iterable, predicate, defaultValue) {\n var tmp$;\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_0;\n tmp$_0 = iterable.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (predicate(element)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n return (tmp$ = firstOrNull$result) != null ? tmp$ : defaultValue;\n };\n Iterables.prototype.getLast_yl67zr$ = function (iterable) {\n return last_0(iterable);\n };\n Iterables.prototype.toArray_hjktyj$ = function (iterable) {\n var collection;\n if (Kotlin.isType(iterable, Collection)) {\n collection = iterable;\n } else {\n collection = toList(iterable);\n }\n return copyToArray(collection);\n };\n Iterables.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Iterables',\n interfaces: []\n };\n var Iterables_instance = null;\n function Iterables_getInstance() {\n if (Iterables_instance === null) {\n new Iterables();\n }return Iterables_instance;\n }\n function Lists() {\n Lists_instance = this;\n }\n Lists.prototype.transform_l7riir$ = function (fromList, function_0) {\n var destination = ArrayList_init_0(collectionSizeOrDefault(fromList, 10));\n var tmp$;\n tmp$ = fromList.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(function_0(item));\n }\n return destination;\n };\n Lists.prototype.reverse_bemo1h$ = function (list) {\n var copy = ArrayList_init_1(list);\n reverse(copy);\n return copy;\n };\n Lists.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Lists',\n interfaces: []\n };\n var Lists_instance = null;\n function Lists_getInstance() {\n if (Lists_instance === null) {\n new Lists();\n }return Lists_instance;\n }\n function Ordering() {\n Ordering$Companion_getInstance();\n }\n Ordering.prototype.isOrdered_p1ys8y$ = function (iterable) {\n var it = iterable.iterator();\n if (it.hasNext()) {\n var prev = it.next();\n while (it.hasNext()) {\n var next = it.next();\n if (this.compare(prev, next) > 0) {\n return false;\n }prev = next;\n }\n }return true;\n };\n function Ordering$sortedCopy$ObjectLiteral(this$Ordering) {\n this.this$Ordering = this$Ordering;\n }\n Ordering$sortedCopy$ObjectLiteral.prototype.compare = function (a, b) {\n return this.this$Ordering.compare(a, b);\n };\n Ordering$sortedCopy$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Comparator]\n };\n Ordering.prototype.sortedCopy_m5x2f4$ = function (elements) {\n var tmp$;\n var array = Kotlin.isArray(tmp$ = Iterables_getInstance().toArray_hjktyj$(elements)) ? tmp$ : throwCCE();\n sortWith(array, new Ordering$sortedCopy$ObjectLiteral(this));\n return toList_0(array);\n };\n Ordering.prototype.reverse = function () {\n return new ComparatorOrdering(reversed(this));\n };\n Ordering.prototype.min_t5quzl$ = function (a, b) {\n return this.compare(a, b) <= 0 ? a : b;\n };\n Ordering.prototype.min_m5x2f4$ = function (iterable) {\n return this.min_x5a2gs$(iterable.iterator());\n };\n Ordering.prototype.min_x5a2gs$ = function (iterator) {\n var result = iterator.next();\n while (iterator.hasNext()) {\n result = this.min_t5quzl$(result, iterator.next());\n }\n return result;\n };\n Ordering.prototype.max_t5quzl$ = function (a, b) {\n return this.compare(a, b) >= 0 ? a : b;\n };\n Ordering.prototype.max_m5x2f4$ = function (iterable) {\n return this.max_x5a2gs$(iterable.iterator());\n };\n Ordering.prototype.max_x5a2gs$ = function (iterator) {\n var result = iterator.next();\n while (iterator.hasNext()) {\n result = this.max_t5quzl$(result, iterator.next());\n }\n return result;\n };\n function Ordering$Companion() {\n Ordering$Companion_instance = this;\n }\n Ordering$Companion.prototype.from_iajr8b$ = function (comparator) {\n var tmp$;\n return Kotlin.isType(comparator, Ordering) ? Kotlin.isType(tmp$ = comparator, Ordering) ? tmp$ : throwCCE() : new ComparatorOrdering(comparator);\n };\n Ordering$Companion.prototype.natural_dahdeg$ = function () {\n return new ComparatorOrdering(naturalOrder());\n };\n Ordering$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Ordering$Companion_instance = null;\n function Ordering$Companion_getInstance() {\n if (Ordering$Companion_instance === null) {\n new Ordering$Companion();\n }return Ordering$Companion_instance;\n }\n Ordering.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Ordering',\n interfaces: [Comparator]\n };\n function Sets() {\n Sets_instance = this;\n }\n Sets.prototype.newHashSet_yl67zr$ = function (elements) {\n var tmp$;\n if (Kotlin.isType(elements, Collection)) {\n var collection = Kotlin.isType(tmp$ = elements, Collection) ? tmp$ : throwCCE();\n return HashSet_init(collection);\n }return this.newHashSet_0(elements.iterator());\n };\n Sets.prototype.newHashSet_0 = function (elements) {\n var set = HashSet_init_0();\n while (elements.hasNext()) {\n set.add_11rb$(elements.next());\n }\n return set;\n };\n Sets.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Sets',\n interfaces: []\n };\n var Sets_instance = null;\n function Sets_getInstance() {\n if (Sets_instance === null) {\n new Sets();\n }return Sets_instance;\n }\n function Stack() {\n this.elements_0 = ArrayList_init();\n }\n Stack.prototype.empty = function () {\n return this.elements_0.isEmpty();\n };\n Stack.prototype.push_11rb$ = function (item) {\n return this.elements_0.add_11rb$(item);\n };\n Stack.prototype.pop = function () {\n return this.elements_0.isEmpty() ? null : this.elements_0.removeAt_za3lpa$(this.elements_0.size - 1 | 0);\n };\n Stack.prototype.peek = function () {\n return lastOrNull(this.elements_0);\n };\n Stack.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Stack',\n interfaces: []\n };\n function TreeMap() {\n this.sortedKeys_0 = ArrayList_init();\n this.map_0 = HashMap_init_0();\n }\n Object.defineProperty(TreeMap.prototype, 'values', {\n configurable: true,\n get: function () {\n return this.map_0.values;\n }\n });\n TreeMap.prototype.get_mef7kx$ = function (key) {\n return this.map_0.get_11rb$(key);\n };\n TreeMap.prototype.put_ncwa5f$ = function (key, value) {\n var index = binarySearch(this.sortedKeys_0, key);\n if (index < 0) {\n this.sortedKeys_0.add_wxm5ur$(~index, key);\n } else {\n this.sortedKeys_0.set_wxm5ur$(index, key);\n }\n return this.map_0.put_xwzc9p$(key, value);\n };\n TreeMap.prototype.containsKey_mef7kx$ = function (key) {\n return this.map_0.containsKey_11rb$(key);\n };\n TreeMap.prototype.floorKey_mef7kx$ = function (key) {\n var index = binarySearch(this.sortedKeys_0, key);\n if (index < 0) {\n index = ~index - 1 | 0;\n if (index < 0)\n return null;\n }return this.sortedKeys_0.get_za3lpa$(index);\n };\n TreeMap.prototype.ceilingKey_mef7kx$ = function (key) {\n var index = binarySearch(this.sortedKeys_0, key);\n if (index < 0) {\n index = ~index;\n if (index === this.sortedKeys_0.size)\n return null;\n }return this.sortedKeys_0.get_za3lpa$(index);\n };\n TreeMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TreeMap',\n interfaces: []\n };\n function DoubleRectangle(origin, dimension) {\n DoubleRectangle$Companion_getInstance();\n this.origin = origin;\n this.dimension = dimension;\n }\n Object.defineProperty(DoubleRectangle.prototype, 'center', {\n configurable: true,\n get: function () {\n return this.origin.add_gpjtzr$(this.dimension.mul_14dthe$(0.5));\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'left', {\n configurable: true,\n get: function () {\n return this.origin.x;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'right', {\n configurable: true,\n get: function () {\n return this.origin.x + this.dimension.x;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'top', {\n configurable: true,\n get: function () {\n return this.origin.y;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'bottom', {\n configurable: true,\n get: function () {\n return this.origin.y + this.dimension.y;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'width', {\n configurable: true,\n get: function () {\n return this.dimension.x;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'height', {\n configurable: true,\n get: function () {\n return this.dimension.y;\n }\n });\n Object.defineProperty(DoubleRectangle.prototype, 'parts', {\n configurable: true,\n get: function () {\n var result = ArrayList_init();\n result.add_11rb$(new DoubleSegment(this.origin, this.origin.add_gpjtzr$(new DoubleVector(this.dimension.x, 0.0))));\n result.add_11rb$(new DoubleSegment(this.origin, this.origin.add_gpjtzr$(new DoubleVector(0.0, this.dimension.y))));\n result.add_11rb$(new DoubleSegment(this.origin.add_gpjtzr$(this.dimension), this.origin.add_gpjtzr$(new DoubleVector(this.dimension.x, 0.0))));\n result.add_11rb$(new DoubleSegment(this.origin.add_gpjtzr$(this.dimension), this.origin.add_gpjtzr$(new DoubleVector(0.0, this.dimension.y))));\n return result;\n }\n });\n DoubleRectangle.prototype.xRange = function () {\n return new ClosedRange(this.origin.x, this.origin.x + this.dimension.x);\n };\n DoubleRectangle.prototype.yRange = function () {\n return new ClosedRange(this.origin.y, this.origin.y + this.dimension.y);\n };\n DoubleRectangle.prototype.contains_gpjtzr$ = function (v) {\n return this.origin.x <= v.x && this.origin.x + this.dimension.x >= v.x && this.origin.y <= v.y && this.origin.y + this.dimension.y >= v.y;\n };\n DoubleRectangle.prototype.union_wthzt5$ = function (rect) {\n var newOrigin = this.origin.min_gpjtzr$(rect.origin);\n var corner = this.origin.add_gpjtzr$(this.dimension);\n var rectCorner = rect.origin.add_gpjtzr$(rect.dimension);\n var newCorner = corner.max_gpjtzr$(rectCorner);\n var newDimension = newCorner.subtract_gpjtzr$(newOrigin);\n return new DoubleRectangle(newOrigin, newDimension);\n };\n DoubleRectangle.prototype.intersects_wthzt5$ = function (rect) {\n var t1 = this.origin;\n var t2 = this.origin.add_gpjtzr$(this.dimension);\n var r1 = rect.origin;\n var r2 = rect.origin.add_gpjtzr$(rect.dimension);\n return r2.x >= t1.x && t2.x >= r1.x && r2.y >= t1.y && t2.y >= r1.y;\n };\n DoubleRectangle.prototype.intersect_wthzt5$ = function (r) {\n var tmp$;\n var t1 = this.origin;\n var t2 = this.origin.add_gpjtzr$(this.dimension);\n var r1 = r.origin;\n var r2 = r.origin.add_gpjtzr$(r.dimension);\n var res1 = t1.max_gpjtzr$(r1);\n var res2 = t2.min_gpjtzr$(r2);\n var dim = res2.subtract_gpjtzr$(res1);\n if (dim.x < 0 || dim.y < 0) {\n tmp$ = null;\n } else\n tmp$ = new DoubleRectangle(res1, dim);\n return tmp$;\n };\n DoubleRectangle.prototype.add_gpjtzr$ = function (v) {\n return new DoubleRectangle(this.origin.add_gpjtzr$(v), this.dimension);\n };\n DoubleRectangle.prototype.subtract_gpjtzr$ = function (v) {\n return new DoubleRectangle(this.origin.subtract_gpjtzr$(v), this.dimension);\n };\n DoubleRectangle.prototype.distance_gpjtzr$ = function (to) {\n var tmp$;\n var result = 0.0;\n var hasResult = false;\n tmp$ = this.parts.iterator();\n while (tmp$.hasNext()) {\n var s = tmp$.next();\n if (!hasResult) {\n result = s.distance_gpjtzr$(to);\n hasResult = true;\n } else {\n var distance = s.distance_gpjtzr$(to);\n if (distance < result) {\n result = distance;\n }}\n }\n return result;\n };\n DoubleRectangle.prototype.hashCode = function () {\n return (this.origin.hashCode() * 31 | 0) + this.dimension.hashCode() | 0;\n };\n DoubleRectangle.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, DoubleRectangle)) {\n return false;\n }var r = (tmp$ = other) == null || Kotlin.isType(tmp$, DoubleRectangle) ? tmp$ : throwCCE();\n return ensureNotNull(r).origin.equals(this.origin) && r.dimension.equals(this.dimension);\n };\n DoubleRectangle.prototype.toString = function () {\n return '[rect ' + this.origin + ', ' + this.dimension + ']';\n };\n function DoubleRectangle$Companion() {\n DoubleRectangle$Companion_instance = this;\n }\n DoubleRectangle$Companion.prototype.span_qt8ska$ = function (leftTop, rightBottom) {\n return new DoubleRectangle(leftTop, rightBottom.subtract_gpjtzr$(leftTop));\n };\n DoubleRectangle$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DoubleRectangle$Companion_instance = null;\n function DoubleRectangle$Companion_getInstance() {\n if (DoubleRectangle$Companion_instance === null) {\n new DoubleRectangle$Companion();\n }return DoubleRectangle$Companion_instance;\n }\n DoubleRectangle.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleRectangle',\n interfaces: []\n };\n function DoubleRectangle_init(x, y, w, h, $this) {\n $this = $this || Object.create(DoubleRectangle.prototype);\n DoubleRectangle.call($this, new DoubleVector(x, y), new DoubleVector(w, h));\n return $this;\n }\n function DoubleRectangles() {\n DoubleRectangles_instance = this;\n }\n function DoubleRectangles$boundingBox$lambda(minX, minY, maxX, maxY) {\n return DoubleRectangle$Companion_getInstance().span_qt8ska$(new DoubleVector(minX, minY), new DoubleVector(maxX, maxY));\n }\n DoubleRectangles.prototype.boundingBox_qdtdbw$ = function (points) {\n return this.calculateBoundingBox_h5l7ap$(points, getPropertyCallableRef('x', 1, function ($receiver) {\n return $receiver.x;\n }), getPropertyCallableRef('y', 1, function ($receiver) {\n return $receiver.y;\n }), DoubleRectangles$boundingBox$lambda);\n };\n DoubleRectangles.prototype.calculateBoundingBox_h5l7ap$ = function (points, getX, getY, factory) {\n var tmp$;\n var first = points.iterator().next();\n var minLon = getX(first);\n var minLat = getY(first);\n var maxLon = minLon;\n var maxLat = minLat;\n tmp$ = points.iterator();\n while (tmp$.hasNext()) {\n var point = tmp$.next();\n var a = minLon;\n var b = getX(point);\n minLon = JsMath.min(a, b);\n var a_0 = maxLon;\n var b_0 = getX(point);\n maxLon = JsMath.max(a_0, b_0);\n var a_1 = minLat;\n var b_1 = getY(point);\n minLat = JsMath.min(a_1, b_1);\n var a_2 = maxLat;\n var b_2 = getY(point);\n maxLat = JsMath.max(a_2, b_2);\n }\n return factory(minLon, minLat, maxLon, maxLat);\n };\n DoubleRectangles.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DoubleRectangles',\n interfaces: []\n };\n var DoubleRectangles_instance = null;\n function DoubleRectangles_getInstance() {\n if (DoubleRectangles_instance === null) {\n new DoubleRectangles();\n }return DoubleRectangles_instance;\n }\n function DoubleSegment(start, end) {\n this.start = start;\n this.end = end;\n }\n DoubleSegment.prototype.distance_gpjtzr$ = function (v) {\n var vs = this.start.subtract_gpjtzr$(v);\n var ve = this.end.subtract_gpjtzr$(v);\n if (this.isDistanceToLineBest_0(v)) {\n var x = vs.x * ve.y - vs.y * ve.x;\n var pVolume = JsMath.abs(x);\n return pVolume / this.length();\n } else {\n var a = vs.length();\n var b = ve.length();\n return JsMath.min(a, b);\n }\n };\n DoubleSegment.prototype.isDistanceToLineBest_0 = function (v) {\n var es = this.start.subtract_gpjtzr$(this.end);\n var se = es.negate();\n var ev = v.subtract_gpjtzr$(this.end);\n var sv = v.subtract_gpjtzr$(this.start);\n return es.dotProduct_gpjtzr$(ev) >= 0 && se.dotProduct_gpjtzr$(sv) >= 0;\n };\n DoubleSegment.prototype.intersection_69p9e5$ = function (with_0) {\n var tmp$;\n var o1 = this.start;\n var o2 = with_0.start;\n var d1 = this.end.subtract_gpjtzr$(this.start);\n var d2 = with_0.end.subtract_gpjtzr$(with_0.start);\n var td = d1.dotProduct_gpjtzr$(d2.orthogonal());\n if (td === 0.0) {\n return null;\n }var t = o2.subtract_gpjtzr$(o1).dotProduct_gpjtzr$(d2.orthogonal()) / td;\n if (t < 0 || t > 1) {\n return null;\n }var sd = d2.dotProduct_gpjtzr$(d1.orthogonal());\n var s = o1.subtract_gpjtzr$(o2).dotProduct_gpjtzr$(d1.orthogonal()) / sd;\n if (s < 0 || s > 1) {\n tmp$ = null;\n } else\n tmp$ = o1.add_gpjtzr$(d1.mul_14dthe$(t));\n return tmp$;\n };\n DoubleSegment.prototype.length = function () {\n return this.start.subtract_gpjtzr$(this.end).length();\n };\n DoubleSegment.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, DoubleSegment)) {\n return false;\n }var l = (tmp$ = other) == null || Kotlin.isType(tmp$, DoubleSegment) ? tmp$ : throwCCE();\n return ensureNotNull(l).start.equals(this.start) && l.end.equals(this.end);\n };\n DoubleSegment.prototype.hashCode = function () {\n return (this.start.hashCode() * 31 | 0) + this.end.hashCode() | 0;\n };\n DoubleSegment.prototype.toString = function () {\n return '[' + this.start + ' -> ' + this.end + ']';\n };\n DoubleSegment.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleSegment',\n interfaces: []\n };\n function DoubleVector(x, y) {\n DoubleVector$Companion_getInstance();\n this.x = x;\n this.y = y;\n }\n DoubleVector.prototype.add_gpjtzr$ = function (v) {\n return new DoubleVector(this.x + v.x, this.y + v.y);\n };\n DoubleVector.prototype.subtract_gpjtzr$ = function (v) {\n return new DoubleVector(this.x - v.x, this.y - v.y);\n };\n DoubleVector.prototype.max_gpjtzr$ = function (v) {\n var a = this.x;\n var b = v.x;\n var tmp$ = JsMath.max(a, b);\n var a_0 = this.y;\n var b_0 = v.y;\n return new DoubleVector(tmp$, JsMath.max(a_0, b_0));\n };\n DoubleVector.prototype.min_gpjtzr$ = function (v) {\n var a = this.x;\n var b = v.x;\n var tmp$ = JsMath.min(a, b);\n var a_0 = this.y;\n var b_0 = v.y;\n return new DoubleVector(tmp$, JsMath.min(a_0, b_0));\n };\n DoubleVector.prototype.mul_14dthe$ = function (value) {\n return new DoubleVector(this.x * value, this.y * value);\n };\n DoubleVector.prototype.dotProduct_gpjtzr$ = function (v) {\n return this.x * v.x + this.y * v.y;\n };\n DoubleVector.prototype.negate = function () {\n return new DoubleVector(-this.x, -this.y);\n };\n DoubleVector.prototype.orthogonal = function () {\n return new DoubleVector(-this.y, this.x);\n };\n DoubleVector.prototype.length = function () {\n var x = this.x * this.x + this.y * this.y;\n return JsMath.sqrt(x);\n };\n DoubleVector.prototype.normalize = function () {\n return this.mul_14dthe$(1 / this.length());\n };\n DoubleVector.prototype.rotate_14dthe$ = function (phi) {\n var x = this.x * JsMath.cos(phi) - this.y * JsMath.sin(phi);\n var y = this.x * JsMath.sin(phi) + this.y * JsMath.cos(phi);\n return new DoubleVector(x, y);\n };\n DoubleVector.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, DoubleVector)) {\n return false;\n }var v = (tmp$ = other) == null || Kotlin.isType(tmp$, DoubleVector) ? tmp$ : throwCCE();\n return ensureNotNull(v).x === this.x && v.y === this.y;\n };\n DoubleVector.prototype.hashCode = function () {\n return hashCode(this.x) + (31 * hashCode(this.y) | 0) | 0;\n };\n DoubleVector.prototype.toString = function () {\n return '(' + this.x + ', ' + this.y + ')';\n };\n function DoubleVector$Companion() {\n DoubleVector$Companion_instance = this;\n this.ZERO = new DoubleVector(0.0, 0.0);\n }\n DoubleVector$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DoubleVector$Companion_instance = null;\n function DoubleVector$Companion_getInstance() {\n if (DoubleVector$Companion_instance === null) {\n new DoubleVector$Companion();\n }return DoubleVector$Companion_instance;\n }\n DoubleVector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleVector',\n interfaces: []\n };\n function Rectangle(origin, dimension) {\n this.origin = origin;\n this.dimension = dimension;\n }\n Object.defineProperty(Rectangle.prototype, 'boundSegments', {\n configurable: true,\n get: function () {\n var p = this.boundPoints_0;\n return [new Segment(p[0], p[1]), new Segment(p[1], p[2]), new Segment(p[2], p[3]), new Segment(p[3], p[0])];\n }\n });\n Object.defineProperty(Rectangle.prototype, 'boundPoints_0', {\n configurable: true,\n get: function () {\n return [this.origin, this.origin.add_119tl4$(new Vector(this.dimension.x, 0)), this.origin.add_119tl4$(this.dimension), this.origin.add_119tl4$(new Vector(0, this.dimension.y))];\n }\n });\n Rectangle.prototype.add_119tl4$ = function (v) {\n return new Rectangle(this.origin.add_119tl4$(v), this.dimension);\n };\n Rectangle.prototype.sub_119tl4$ = function (v) {\n return new Rectangle(this.origin.sub_119tl4$(v), this.dimension);\n };\n Rectangle.prototype.contains_vfns7u$ = function (r) {\n return this.contains_119tl4$(r.origin) && this.contains_119tl4$(r.origin.add_119tl4$(r.dimension));\n };\n Rectangle.prototype.contains_119tl4$ = function (v) {\n return this.origin.x <= v.x && (this.origin.x + this.dimension.x | 0) >= v.x && this.origin.y <= v.y && (this.origin.y + this.dimension.y | 0) >= v.y;\n };\n Rectangle.prototype.union_vfns7u$ = function (rect) {\n var newOrigin = this.origin.min_119tl4$(rect.origin);\n var corner = this.origin.add_119tl4$(this.dimension);\n var rectCorner = rect.origin.add_119tl4$(rect.dimension);\n var newCorner = corner.max_119tl4$(rectCorner);\n var newDimension = newCorner.sub_119tl4$(newOrigin);\n return new Rectangle(newOrigin, newDimension);\n };\n Rectangle.prototype.intersects_vfns7u$ = function (rect) {\n var t1 = this.origin;\n var t2 = this.origin.add_119tl4$(this.dimension);\n var r1 = rect.origin;\n var r2 = rect.origin.add_119tl4$(rect.dimension);\n return r2.x >= t1.x && t2.x >= r1.x && r2.y >= t1.y && t2.y >= r1.y;\n };\n Rectangle.prototype.intersect_vfns7u$ = function (r) {\n if (!this.intersects_vfns7u$(r)) {\n throw IllegalStateException_init('rectangle [' + this + \"] doesn't intersect [\" + r + ']');\n }var too = this.origin.add_119tl4$(this.dimension);\n var roo = r.origin.add_119tl4$(r.dimension);\n var ioo = too.min_119tl4$(roo);\n var io = this.origin.max_119tl4$(r.origin);\n return new Rectangle(io, ioo.sub_119tl4$(io));\n };\n Rectangle.prototype.innerIntersects_vfns7u$ = function (rect) {\n var t1 = this.origin;\n var t2 = this.origin.add_119tl4$(this.dimension);\n var r1 = rect.origin;\n var r2 = rect.origin.add_119tl4$(rect.dimension);\n return r2.x > t1.x && t2.x > r1.x && r2.y > t1.y && t2.y > r1.y;\n };\n Rectangle.prototype.changeDimension_119tl4$ = function (dim) {\n return new Rectangle(this.origin, dim);\n };\n Rectangle.prototype.distance_119tl4$ = function (to) {\n return this.toDoubleRectangle_0().distance_gpjtzr$(to.toDoubleVector());\n };\n Rectangle.prototype.xRange = function () {\n return new ClosedRange(this.origin.x, this.origin.x + this.dimension.x | 0);\n };\n Rectangle.prototype.yRange = function () {\n return new ClosedRange(this.origin.y, this.origin.y + this.dimension.y | 0);\n };\n Rectangle.prototype.hashCode = function () {\n return (this.origin.hashCode() * 31 | 0) + this.dimension.hashCode() | 0;\n };\n Rectangle.prototype.equals = function (other) {\n var tmp$, tmp$_0, tmp$_1;\n if (!Kotlin.isType(other, Rectangle))\n return false;\n var otherRect = (tmp$ = other) == null || Kotlin.isType(tmp$, Rectangle) ? tmp$ : throwCCE();\n return ((tmp$_0 = this.origin) != null ? tmp$_0.equals(ensureNotNull(otherRect).origin) : null) && ((tmp$_1 = this.dimension) != null ? tmp$_1.equals(otherRect.dimension) : null);\n };\n Rectangle.prototype.toDoubleRectangle_0 = function () {\n return new DoubleRectangle(this.origin.toDoubleVector(), this.dimension.toDoubleVector());\n };\n Rectangle.prototype.center = function () {\n return this.origin.add_119tl4$(new Vector(this.dimension.x / 2 | 0, this.dimension.y / 2 | 0));\n };\n Rectangle.prototype.toString = function () {\n return this.origin.toString() + ' - ' + this.dimension;\n };\n Rectangle.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Rectangle',\n interfaces: []\n };\n function Rectangle_init(x, y, width, height, $this) {\n $this = $this || Object.create(Rectangle.prototype);\n Rectangle.call($this, new Vector(x, y), new Vector(width, height));\n return $this;\n }\n function Rectangles() {\n Rectangles_instance = this;\n }\n Rectangles.prototype.zeroOrigin_vfns7u$ = function (r) {\n return new Rectangle(Vector$Companion_getInstance().ZERO, r.dimension);\n };\n Rectangles.prototype.upperDistance_w66x3o$ = function (inner, outer) {\n this.assertOuterInner_0(outer, inner);\n return this.topLeft_0(inner).y - this.topLeft_0(outer).y | 0;\n };\n Rectangles.prototype.lowerDistance_w66x3o$ = function (inner, outer) {\n this.assertOuterInner_0(outer, inner);\n return this.bottomLeft_0(outer).y - this.bottomLeft_0(inner).y | 0;\n };\n Rectangles.prototype.leftDistance_w66x3o$ = function (inner, outer) {\n this.assertOuterInner_0(outer, inner);\n return this.topLeft_0(inner).x - this.topLeft_0(outer).x | 0;\n };\n Rectangles.prototype.rightDistance_w66x3o$ = function (inner, outer) {\n this.assertOuterInner_0(outer, inner);\n return this.topRight_vfns7u$(outer).x - this.topRight_vfns7u$(inner).x | 0;\n };\n Rectangles.prototype.assertOuterInner_0 = function (outer, inner) {\n if (!outer.contains_vfns7u$(inner)) {\n throw IllegalArgumentException_init('Outer does not contain inner: outer = ' + outer + ', inner = ' + inner);\n }};\n Rectangles.prototype.extendUp_o8ajws$ = function (r, distance) {\n var change = new Vector(0, distance);\n return new Rectangle(r.origin.sub_119tl4$(change), r.dimension.add_119tl4$(change));\n };\n Rectangles.prototype.extendDown_o8ajws$ = function (r, distance) {\n return r.changeDimension_119tl4$(r.dimension.add_119tl4$(new Vector(0, distance)));\n };\n Rectangles.prototype.extendLeft_o8ajws$ = function (r, distance) {\n var change = new Vector(distance, 0);\n return new Rectangle(r.origin.sub_119tl4$(change), r.dimension.add_119tl4$(change));\n };\n Rectangles.prototype.extendRight_o8ajws$ = function (r, distance) {\n return r.changeDimension_119tl4$(r.dimension.add_119tl4$(new Vector(distance, 0)));\n };\n Rectangles.prototype.extendSides_ogcnvu$ = function (left, r, right) {\n return this.extendRight_o8ajws$(this.extendLeft_o8ajws$(r, left), right);\n };\n Rectangles.prototype.shrinkRight_o8ajws$ = function (r, distance) {\n if (r.dimension.x < distance) {\n throw IllegalArgumentException_init('To small rectangle = ' + r + ', distance = ' + distance);\n }return r.changeDimension_119tl4$(r.dimension.sub_119tl4$(new Vector(distance, 0)));\n };\n Rectangles.prototype.topLeft_0 = function (r) {\n return r.origin;\n };\n Rectangles.prototype.topRight_vfns7u$ = function (r) {\n return r.origin.add_119tl4$(new Vector(r.dimension.x, 0));\n };\n Rectangles.prototype.bottomLeft_0 = function (r) {\n return r.origin.add_119tl4$(new Vector(0, r.dimension.y));\n };\n Rectangles.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Rectangles',\n interfaces: []\n };\n var Rectangles_instance = null;\n function Rectangles_getInstance() {\n if (Rectangles_instance === null) {\n new Rectangles();\n }return Rectangles_instance;\n }\n function Segment(start, end) {\n this.start = start;\n this.end = end;\n }\n Segment.prototype.distance_119tl4$ = function (v) {\n var vs = this.start.sub_119tl4$(v);\n var ve = this.end.sub_119tl4$(v);\n if (this.isDistanceToLineBest_0(v)) {\n var pVolume = abs(Kotlin.imul(vs.x, ve.y) - Kotlin.imul(vs.y, ve.x) | 0);\n return pVolume / this.length();\n } else {\n var a = vs.toDoubleVector().length();\n var b = ve.toDoubleVector().length();\n return JsMath.min(a, b);\n }\n };\n Segment.prototype.isDistanceToLineBest_0 = function (v) {\n var es = this.start.sub_119tl4$(this.end);\n var se = es.negate();\n var ev = v.sub_119tl4$(this.end);\n var sv = v.sub_119tl4$(this.start);\n return es.dotProduct_119tl4$(ev) >= 0 && se.dotProduct_119tl4$(sv) >= 0;\n };\n Segment.prototype.toDoubleSegment = function () {\n return new DoubleSegment(this.start.toDoubleVector(), this.end.toDoubleVector());\n };\n Segment.prototype.intersection_51grtu$ = function (with_0) {\n return this.toDoubleSegment().intersection_69p9e5$(with_0.toDoubleSegment());\n };\n Segment.prototype.length = function () {\n return this.start.sub_119tl4$(this.end).length();\n };\n Segment.prototype.contains_119tl4$ = function (v) {\n var tmp$;\n var p1 = v.sub_119tl4$(this.start);\n var p2 = v.sub_119tl4$(this.end);\n if (p1.isParallel_119tl4$(p2)) {\n tmp$ = p1.dotProduct_119tl4$(p2) <= 0;\n } else\n tmp$ = false;\n return tmp$;\n };\n Segment.prototype.equals = function (other) {\n var tmp$, tmp$_0, tmp$_1;\n if (!Kotlin.isType(other, Segment)) {\n return false;\n }var l = (tmp$ = other) == null || Kotlin.isType(tmp$, Segment) ? tmp$ : throwCCE();\n return ((tmp$_0 = ensureNotNull(l).start) != null ? tmp$_0.equals(this.start) : null) && ((tmp$_1 = l.end) != null ? tmp$_1.equals(this.end) : null);\n };\n Segment.prototype.hashCode = function () {\n return (this.start.hashCode() * 31 | 0) + this.end.hashCode() | 0;\n };\n Segment.prototype.toString = function () {\n return '[' + this.start + ' -> ' + this.end + ']';\n };\n Segment.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Segment',\n interfaces: []\n };\n function Vector(x, y) {\n Vector$Companion_getInstance();\n this.x = x;\n this.y = y;\n }\n function Vector$Companion() {\n Vector$Companion_instance = this;\n this.ZERO = new Vector(0, 0);\n }\n Vector$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Vector$Companion_instance = null;\n function Vector$Companion_getInstance() {\n if (Vector$Companion_instance === null) {\n new Vector$Companion();\n }return Vector$Companion_instance;\n }\n Vector.prototype.add_119tl4$ = function (v) {\n return new Vector(this.x + v.x | 0, this.y + v.y | 0);\n };\n Vector.prototype.sub_119tl4$ = function (v) {\n return this.add_119tl4$(v.negate());\n };\n Vector.prototype.negate = function () {\n return new Vector(-this.x | 0, -this.y | 0);\n };\n Vector.prototype.max_119tl4$ = function (v) {\n var a = this.x;\n var b = v.x;\n var tmp$ = JsMath.max(a, b);\n var a_0 = this.y;\n var b_0 = v.y;\n return new Vector(tmp$, JsMath.max(a_0, b_0));\n };\n Vector.prototype.min_119tl4$ = function (v) {\n var a = this.x;\n var b = v.x;\n var tmp$ = JsMath.min(a, b);\n var a_0 = this.y;\n var b_0 = v.y;\n return new Vector(tmp$, JsMath.min(a_0, b_0));\n };\n Vector.prototype.mul_za3lpa$ = function (i) {\n return new Vector(Kotlin.imul(this.x, i), Kotlin.imul(this.y, i));\n };\n Vector.prototype.div_za3lpa$ = function (i) {\n return new Vector(this.x / i | 0, this.y / i | 0);\n };\n Vector.prototype.dotProduct_119tl4$ = function (v) {\n return Kotlin.imul(this.x, v.x) + Kotlin.imul(this.y, v.y) | 0;\n };\n Vector.prototype.length = function () {\n var x = Kotlin.imul(this.x, this.x) + Kotlin.imul(this.y, this.y) | 0;\n return JsMath.sqrt(x);\n };\n Vector.prototype.toDoubleVector = function () {\n return new DoubleVector(this.x, this.y);\n };\n Vector.prototype.abs = function () {\n return new Vector(abs(this.x), abs(this.y));\n };\n Vector.prototype.isParallel_119tl4$ = function (to) {\n return (Kotlin.imul(this.x, to.y) - Kotlin.imul(to.x, this.y) | 0) === 0;\n };\n Vector.prototype.orthogonal = function () {\n return new Vector(-this.y | 0, this.x);\n };\n Vector.prototype.equals = function (other) {\n var tmp$;\n if (!Kotlin.isType(other, Vector))\n return false;\n var otherVector = (tmp$ = other) == null || Kotlin.isType(tmp$, Vector) ? tmp$ : throwCCE();\n return this.x === ensureNotNull(otherVector).x && this.y === otherVector.y;\n };\n Vector.prototype.hashCode = function () {\n return (this.x * 31 | 0) + this.y | 0;\n };\n Vector.prototype.toString = function () {\n return '(' + this.x + ', ' + this.y + ')';\n };\n Vector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Vector',\n interfaces: []\n };\n function JsObjectSupport() {\n JsObjectSupport_instance = this;\n }\n function JsObjectSupport$mapToJsObjectInitializer$lambda(it) {\n return Unit;\n }\n function JsObjectSupport$mapToJsObjectInitializer$lambda_0(closure$buffer, closure$handleValue) {\n return function (list) {\n var tmp$;\n closure$buffer.append_s8itvh$(91);\n var first = true;\n tmp$ = list.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (!first)\n closure$buffer.append_s8itvh$(44);\n else\n first = false;\n closure$handleValue.v(v);\n }\n return closure$buffer.append_s8itvh$(93);\n };\n }\n function JsObjectSupport$mapToJsObjectInitializer$lambda_1(closure$buffer, closure$handleValue) {\n return function (map) {\n var tmp$, tmp$_0, tmp$_1;\n closure$buffer.append_s8itvh$(123);\n var first = true;\n tmp$ = map.entries.iterator();\n while (tmp$.hasNext()) {\n var tmp$_2 = tmp$.next();\n var k = tmp$_2.key;\n var v = tmp$_2.value;\n if ((typeof (tmp$_0 = k) === 'string' ? tmp$_0 : null) == null) {\n throw IllegalArgumentException_init('Only `string` keys are supported, was: ' + ((tmp$_1 = Kotlin.getKClassFromExpression(ensureNotNull(k)).simpleName) != null ? tmp$_1 : 'no class name'));\n }if (!first)\n closure$buffer.append_s8itvh$(44);\n else\n first = false;\n closure$buffer.append_s8itvh$(10);\n closure$buffer.append_s8itvh$(34).append_pdl1vj$(escape(k)).append_s8itvh$(34).append_s8itvh$(58);\n closure$handleValue.v(v);\n }\n return closure$buffer.append_pdl1vj$('\\n}');\n };\n }\n function JsObjectSupport$mapToJsObjectInitializer$lambda_2(closure$buffer, closure$handleList, closure$handleMap) {\n return function (v) {\n if (typeof v === 'string')\n closure$buffer.append_s8itvh$(34).append_pdl1vj$(escape(v)).append_s8itvh$(34);\n else if (typeof v === 'boolean' || Kotlin.isNumber(v))\n closure$buffer.append_s8jyv4$(v);\n else if (v == null)\n closure$buffer.append_pdl1vj$('null');\n else if (Kotlin.isArray(v))\n closure$handleList(asList(v));\n else if (Kotlin.isType(v, List))\n closure$handleList(v);\n else if (Kotlin.isType(v, Map))\n closure$handleMap(v);\n else\n throw IllegalArgumentException_init(\"Can't serialize object \" + toString(v));\n return Unit;\n };\n }\n JsObjectSupport.prototype.mapToJsObjectInitializer_6uu7i0$ = function (map) {\n var buffer = StringBuilder_init();\n var handleValue = {v: JsObjectSupport$mapToJsObjectInitializer$lambda};\n var handleList = JsObjectSupport$mapToJsObjectInitializer$lambda_0(buffer, handleValue);\n var handleMap = JsObjectSupport$mapToJsObjectInitializer$lambda_1(buffer, handleValue);\n handleValue.v = JsObjectSupport$mapToJsObjectInitializer$lambda_2(buffer, handleList, handleMap);\n handleMap(map);\n return buffer.toString();\n };\n JsObjectSupport.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'JsObjectSupport',\n interfaces: []\n };\n var JsObjectSupport_instance = null;\n function JsObjectSupport_getInstance() {\n if (JsObjectSupport_instance === null) {\n new JsObjectSupport();\n }return JsObjectSupport_instance;\n }\n function FluentArray() {\n this.myArray_0 = null;\n }\n FluentArray.prototype.getDouble_za3lpa$ = function (index) {\n var tmp$;\n return typeof (tmp$ = this.myArray_0.get_za3lpa$(index)) === 'number' ? tmp$ : throwCCE();\n };\n FluentArray.prototype.add_pdl1vj$ = function (v) {\n this.myArray_0.add_11rb$(v);\n return this;\n };\n FluentArray.prototype.add_yrwdxb$ = function (v) {\n this.myArray_0.add_11rb$(v);\n return this;\n };\n FluentArray.prototype.addStrings_d294za$ = function (values) {\n this.myArray_0.addAll_brywnq$(values);\n return this;\n };\n FluentArray.prototype.addAll_5ry1at$ = function (values) {\n var tmp$;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.myArray_0.add_11rb$(element.get());\n }\n return this;\n };\n FluentArray.prototype.addAll_m5dwgt$ = function (values) {\n this.addAll_5ry1at$(listOf(values.slice()));\n return this;\n };\n FluentArray.prototype.stream = function () {\n return streamOf(this.myArray_0);\n };\n FluentArray.prototype.objectStream = function () {\n return objectsStreamOf(this.myArray_0);\n };\n FluentArray.prototype.fluentObjectStream = function () {\n return map(objectsStreamOf(this.myArray_0), getCallableRef('FluentObject', function (p1) {\n return FluentObject_init(p1);\n }));\n };\n FluentArray.prototype.get = function () {\n return this.myArray_0;\n };\n FluentArray.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FluentArray',\n interfaces: [FluentValue]\n };\n function FluentArray_init($this) {\n $this = $this || Object.create(FluentArray.prototype);\n FluentValue.call($this);\n FluentArray.call($this);\n $this.myArray_0 = ArrayList_init();\n return $this;\n }\n function FluentArray_init_0(array, $this) {\n $this = $this || Object.create(FluentArray.prototype);\n FluentValue.call($this);\n FluentArray.call($this);\n $this.myArray_0 = ArrayList_init_1(array);\n return $this;\n }\n function FluentObject() {\n this.myObj_0 = null;\n }\n FluentObject.prototype.getArr_0 = function (key) {\n var tmp$;\n return Kotlin.isType(tmp$ = this.myObj_0.get_11rb$(key), List) ? tmp$ : throwCCE();\n };\n FluentObject.prototype.getObj_0 = function (key) {\n var tmp$;\n return Kotlin.isType(tmp$ = this.myObj_0.get_11rb$(key), Map) ? tmp$ : throwCCE();\n };\n FluentObject.prototype.get = function () {\n return this.myObj_0;\n };\n FluentObject.prototype.contains_61zpoe$ = function (key) {\n return this.myObj_0.containsKey_11rb$(key);\n };\n FluentObject.prototype.containsNotNull_0 = function (key) {\n return this.contains_61zpoe$(key) && this.myObj_0.get_11rb$(key) != null;\n };\n FluentObject.prototype.put_wxs67v$ = function (key, v) {\n var $receiver = this.myObj_0;\n var value = v != null ? v.get() : null;\n $receiver.put_xwzc9p$(key, value);\n return this;\n };\n FluentObject.prototype.put_jyasbz$ = function (key, v) {\n this.myObj_0.put_xwzc9p$(key, v);\n return this;\n };\n FluentObject.prototype.put_hzlfav$ = function (key, v) {\n this.myObj_0.put_xwzc9p$(key, v);\n return this;\n };\n FluentObject.prototype.put_h92gdm$ = function (key, v) {\n this.myObj_0.put_xwzc9p$(key, v);\n return this;\n };\n FluentObject.prototype.put_snuhza$ = function (key, v) {\n var tmp$ = this.myObj_0;\n var value = v != null ? formatEnum(v) : null;\n tmp$.put_xwzc9p$(key, value);\n return this;\n };\n FluentObject.prototype.getInt_61zpoe$ = function (key) {\n return numberToInt(getNumber(this.myObj_0, key));\n };\n FluentObject.prototype.getDouble_61zpoe$ = function (key) {\n return getDouble(this.myObj_0, key);\n };\n FluentObject.prototype.getBoolean_61zpoe$ = function (key) {\n var tmp$;\n return typeof (tmp$ = this.myObj_0.get_11rb$(key)) === 'boolean' ? tmp$ : throwCCE();\n };\n FluentObject.prototype.getString_61zpoe$ = function (key) {\n var tmp$;\n return typeof (tmp$ = this.myObj_0.get_11rb$(key)) === 'string' ? tmp$ : throwCCE();\n };\n FluentObject.prototype.getStrings_61zpoe$ = function (key) {\n var $receiver = this.getArr_0(key);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(getAsString(item));\n }\n return destination;\n };\n FluentObject.prototype.getEnum_xwn52g$ = function (key, enumValues) {\n var tmp$;\n return parseEnum(typeof (tmp$ = this.myObj_0.get_11rb$(key)) === 'string' ? tmp$ : throwCCE(), enumValues);\n };\n FluentObject.prototype.getEnum_a9gw98$ = defineInlineFunction('lets-plot-base-portable.jetbrains.datalore.base.json.FluentObject.getEnum_a9gw98$', function (T_0, isT, key) {\n return this.getEnum_xwn52g$(key, T_0.values());\n });\n FluentObject.prototype.getArray_61zpoe$ = function (key) {\n return FluentArray_init_0(this.getArr_0(key));\n };\n FluentObject.prototype.getObject_61zpoe$ = function (key) {\n return FluentObject_init(this.getObj_0(key));\n };\n FluentObject.prototype.getInt_qoz5hj$ = function (key, processor) {\n processor(this.getInt_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getDouble_l47sdb$ = function (key, processor) {\n processor(this.getDouble_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getBoolean_48wr2m$ = function (key, processor) {\n processor(this.getBoolean_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getString_hyc7mn$ = function (key, processor) {\n processor(this.getString_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getStrings_lpk3a7$ = function (key, processor) {\n processor(this.getStrings_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getEnum_651ru9$ = function (key, processor, enumValues) {\n processor(this.getEnum_xwn52g$(key, enumValues));\n return this;\n };\n FluentObject.prototype.getArray_nhu1ij$ = function (key, processor) {\n processor(this.getArray_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.getObject_6k19qz$ = function (key, processor) {\n processor(this.getObject_61zpoe$(key));\n return this;\n };\n FluentObject.prototype.putRemovable_wxs67v$ = function (key, v) {\n if (v != null) {\n this.put_wxs67v$(key, v);\n }return this;\n };\n FluentObject.prototype.putRemovable_snuhza$ = function (key, v) {\n if (v != null) {\n this.put_snuhza$(key, v);\n }return this;\n };\n FluentObject.prototype.forEntries_ophlsb$ = function (consumer) {\n var tmp$;\n tmp$ = this.myObj_0.keys.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n consumer(element, this.myObj_0.get_11rb$(element));\n }\n return this;\n };\n FluentObject.prototype.forObjEntries_izf7h5$ = function (consumer) {\n var tmp$;\n tmp$ = this.myObj_0.keys.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n consumer(element, Kotlin.isType(tmp$_0 = this.myObj_0.get_11rb$(element), Map) ? tmp$_0 : throwCCE());\n }\n return this;\n };\n FluentObject.prototype.forArrEntries_2wy1dl$ = function (consumer) {\n var tmp$;\n tmp$ = this.myObj_0.keys.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n consumer(element, Kotlin.isType(tmp$_0 = this.myObj_0.get_11rb$(element), List) ? tmp$_0 : throwCCE());\n }\n return this;\n };\n FluentObject.prototype.accept_ysf37t$ = function (consumer) {\n consumer(this);\n return this;\n };\n FluentObject.prototype.forStrings_2by8ig$ = function (key, processor) {\n var $receiver = getArr(this.myObj_0, key);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(getAsString(item));\n }\n var tmp$_0;\n tmp$_0 = destination.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n processor(element);\n }\n return this;\n };\n FluentObject.prototype.getExistingDouble_l47sdb$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n this.getDouble_l47sdb$(key, processor);\n }return this;\n };\n FluentObject.prototype.getOptionalStrings_jpy86i$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n processor(this.getStrings_61zpoe$(key));\n } else {\n processor(null);\n }\n return this;\n };\n FluentObject.prototype.getExistingString_hyc7mn$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n this.getString_hyc7mn$(key, processor);\n }return this;\n };\n function FluentObject$forExistingStrings$lambda$lambda(closure$processor) {\n return function (it) {\n closure$processor(ensureNotNull(it));\n return Unit;\n };\n }\n FluentObject.prototype.forExistingStrings_hyc7mn$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n this.forStrings_2by8ig$(key, FluentObject$forExistingStrings$lambda$lambda(processor));\n }return this;\n };\n FluentObject.prototype.getExistingObject_6k19qz$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n var obj = this.getObject_61zpoe$(key);\n if (!obj.myObj_0.keys.isEmpty()) {\n processor(obj);\n }}return this;\n };\n FluentObject.prototype.getExistingArray_nhu1ij$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n processor(this.getArray_61zpoe$(key));\n }return this;\n };\n FluentObject.prototype.forObjects_6k19qz$ = function (key, processor) {\n var tmp$;\n tmp$ = this.getArray_61zpoe$(key).fluentObjectStream().iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n processor(element);\n }\n return this;\n };\n FluentObject.prototype.getOptionalInt_w5p0jm$ = function (key, processor) {\n if (this.containsNotNull_0(key)) {\n processor(this.getInt_61zpoe$(key));\n } else {\n processor(null);\n }\n return this;\n };\n FluentObject.prototype.getIntOrDefault_u1i54l$ = function (key, processor, defaultValue) {\n if (this.containsNotNull_0(key)) {\n processor(this.getInt_61zpoe$(key));\n } else {\n processor(defaultValue);\n }\n return this;\n };\n FluentObject.prototype.forEnums_651ru9$ = function (key, processor, enumValues) {\n var tmp$;\n tmp$ = this.getArr_0(key).iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n processor(parseEnum(typeof (tmp$_0 = element) === 'string' ? tmp$_0 : throwCCE(), enumValues));\n }\n return this;\n };\n FluentObject.prototype.getOptionalEnum_651ru9$ = function (key, processor, enumValues) {\n if (this.containsNotNull_0(key))\n processor(this.getEnum_xwn52g$(key, enumValues));\n else\n processor(null);\n return this;\n };\n FluentObject.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FluentObject',\n interfaces: [FluentValue]\n };\n function FluentObject_init(obj, $this) {\n $this = $this || Object.create(FluentObject.prototype);\n FluentValue.call($this);\n FluentObject.call($this);\n var tmp$;\n $this.myObj_0 = toMutableMap(Kotlin.isType(tmp$ = obj, Map) ? tmp$ : throwCCE());\n return $this;\n }\n function FluentObject_init_0($this) {\n $this = $this || Object.create(FluentObject.prototype);\n FluentValue.call($this);\n FluentObject.call($this);\n $this.myObj_0 = HashMap_init_0();\n return $this;\n }\n function FluentPrimitive() {\n this.value_0 = null;\n }\n FluentPrimitive.prototype.get = function () {\n return this.value_0;\n };\n FluentPrimitive.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FluentPrimitive',\n interfaces: [FluentValue]\n };\n function FluentPrimitive_init(v, $this) {\n $this = $this || Object.create(FluentPrimitive.prototype);\n FluentValue.call($this);\n FluentPrimitive.call($this);\n $this.value_0 = v;\n return $this;\n }\n function FluentPrimitive_init_0(v, $this) {\n $this = $this || Object.create(FluentPrimitive.prototype);\n FluentValue.call($this);\n FluentPrimitive.call($this);\n $this.value_0 = v;\n return $this;\n }\n function FluentPrimitive_init_1(v, $this) {\n $this = $this || Object.create(FluentPrimitive.prototype);\n FluentValue.call($this);\n FluentPrimitive.call($this);\n $this.value_0 = v;\n return $this;\n }\n function FluentPrimitive_init_2(v, $this) {\n $this = $this || Object.create(FluentPrimitive.prototype);\n FluentValue.call($this);\n FluentPrimitive.call($this);\n $this.value_0 = v;\n return $this;\n }\n function FluentValue() {\n }\n FluentValue.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FluentValue',\n interfaces: []\n };\n function JsonFormatter() {\n this.buffer_suueb3$_0 = this.buffer_suueb3$_0;\n }\n Object.defineProperty(JsonFormatter.prototype, 'buffer_0', {\n configurable: true,\n get: function () {\n if (this.buffer_suueb3$_0 == null)\n return throwUPAE('buffer');\n return this.buffer_suueb3$_0;\n },\n set: function (buffer) {\n this.buffer_suueb3$_0 = buffer;\n }\n });\n JsonFormatter.prototype.formatJson_za3rmp$ = function (o) {\n this.buffer_0 = StringBuilder_init();\n this.handleValue_0(o);\n return this.buffer_0.toString();\n };\n function JsonFormatter$handleList$lambda(this$JsonFormatter) {\n return function (tail) {\n var tmp$;\n tmp$ = tail.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var this$JsonFormatter_0 = this$JsonFormatter;\n this$JsonFormatter_0.append_0(',');\n this$JsonFormatter_0.handleValue_0(element);\n }\n return Unit;\n };\n }\n JsonFormatter.prototype.handleList_0 = function (list) {\n this.append_0('[');\n this.headTail_0(list, getCallableRef('handleValue', function ($receiver, p1) {\n return $receiver.handleValue_0(p1), Unit;\n }.bind(null, this)), JsonFormatter$handleList$lambda(this));\n this.append_0(']');\n };\n function JsonFormatter$handleMap$lambda(this$JsonFormatter) {\n return function (tail) {\n var tmp$;\n tmp$ = tail.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var this$JsonFormatter_0 = this$JsonFormatter;\n this$JsonFormatter_0.append_0(',\\n');\n this$JsonFormatter_0.handlePair_0(element);\n }\n return Unit;\n };\n }\n JsonFormatter.prototype.handleMap_0 = function (map) {\n this.append_0('{');\n this.headTail_0(map.entries, getCallableRef('handlePair', function ($receiver, p1) {\n return $receiver.handlePair_0(p1), Unit;\n }.bind(null, this)), JsonFormatter$handleMap$lambda(this));\n this.append_0('}');\n };\n JsonFormatter.prototype.handleValue_0 = function (v) {\n if (v == null)\n this.append_0('null');\n else if (typeof v === 'string')\n this.handleString_0(v);\n else if (Kotlin.isNumber(v) || equals(v, kotlin_js_internal_BooleanCompanionObject))\n this.append_0(v.toString());\n else if (Kotlin.isArray(v))\n this.handleList_0(asList(v));\n else if (Kotlin.isType(v, List))\n this.handleList_0(v);\n else if (Kotlin.isType(v, Map))\n this.handleMap_0(v);\n else\n throw IllegalArgumentException_init(\"Can't serialize object \" + toString(v));\n };\n JsonFormatter.prototype.handlePair_0 = function (pair) {\n this.handleString_0(pair.key);\n this.append_0(':');\n this.handleValue_0(pair.value);\n };\n JsonFormatter.prototype.handleString_0 = function (v) {\n if (v != null)\n if (typeof v === 'string')\n this.append_0('\"' + escape(v) + '\"');\n else\n throw IllegalArgumentException_init(\"Expected a string, but got '\" + toString(Kotlin.getKClassFromExpression(v).simpleName) + \"'\");\n };\n JsonFormatter.prototype.append_0 = function (s) {\n return this.buffer_0.append_pdl1vj$(s);\n };\n JsonFormatter.prototype.headTail_0 = function ($receiver, head, tail) {\n if (!$receiver.isEmpty()) {\n head(first_0($receiver));\n tail(drop(asSequence($receiver), 1));\n }};\n JsonFormatter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JsonFormatter',\n interfaces: []\n };\n function JsonLexer(input) {\n JsonLexer$Companion_getInstance();\n this.input_0 = input;\n this.i_0 = 0;\n this.tokenStart_0 = 0;\n this.currentToken_dslfm7$_0 = null;\n this.nextToken();\n }\n Object.defineProperty(JsonLexer.prototype, 'currentToken', {\n configurable: true,\n get: function () {\n return this.currentToken_dslfm7$_0;\n },\n set: function (currentToken) {\n this.currentToken_dslfm7$_0 = currentToken;\n }\n });\n Object.defineProperty(JsonLexer.prototype, 'currentChar_0', {\n configurable: true,\n get: function () {\n return this.input_0.charCodeAt(this.i_0);\n }\n });\n function JsonLexer$nextToken$lambda(it) {\n return isWhitespace(unboxChar(it));\n }\n JsonLexer.prototype.nextToken = function () {\n var tmp$;\n this.advanceWhile_0(JsonLexer$nextToken$lambda);\n if (this.isFinished()) {\n return;\n }if (this.currentChar_0 === 123) {\n var $receiver = Token$LEFT_BRACE_getInstance();\n this.advance_0();\n tmp$ = $receiver;\n } else if (this.currentChar_0 === 125) {\n var $receiver_0 = Token$RIGHT_BRACE_getInstance();\n this.advance_0();\n tmp$ = $receiver_0;\n } else if (this.currentChar_0 === 91) {\n var $receiver_1 = Token$LEFT_BRACKET_getInstance();\n this.advance_0();\n tmp$ = $receiver_1;\n } else if (this.currentChar_0 === 93) {\n var $receiver_2 = Token$RIGHT_BRACKET_getInstance();\n this.advance_0();\n tmp$ = $receiver_2;\n } else if (this.currentChar_0 === 44) {\n var $receiver_3 = Token$COMMA_getInstance();\n this.advance_0();\n tmp$ = $receiver_3;\n } else if (this.currentChar_0 === 58) {\n var $receiver_4 = Token$COLON_getInstance();\n this.advance_0();\n tmp$ = $receiver_4;\n } else if (this.currentChar_0 === 116) {\n var $receiver_5 = Token$TRUE_getInstance();\n this.read_0('true');\n tmp$ = $receiver_5;\n } else if (this.currentChar_0 === 102) {\n var $receiver_6 = Token$FALSE_getInstance();\n this.read_0('false');\n tmp$ = $receiver_6;\n } else if (this.currentChar_0 === 110) {\n var $receiver_7 = Token$NULL_getInstance();\n this.read_0('null');\n tmp$ = $receiver_7;\n } else if (this.currentChar_0 === 34) {\n var $receiver_8 = Token$STRING_getInstance();\n this.readString_0();\n tmp$ = $receiver_8;\n } else if (this.readNumber_0())\n tmp$ = Token$NUMBER_getInstance();\n else {\n throw IllegalStateException_init((this.i_0.toString() + ':' + String.fromCharCode(this.currentChar_0) + ' - unkown token').toString());\n }\n this.currentToken = tmp$;\n };\n JsonLexer.prototype.tokenValue = function () {\n var $receiver = this.input_0;\n var startIndex = this.tokenStart_0;\n var endIndex = this.i_0;\n return $receiver.substring(startIndex, endIndex);\n };\n JsonLexer.prototype.readString_0 = function () {\n this.startToken_0();\n this.advance_0();\n while (this.currentChar_0 !== 34) {\n if (this.currentChar_0 === 92) {\n this.advance_0();\n if (this.currentChar_0 === 117) {\n this.advance_0();\n for (var index = 0; index < 4; index++) {\n if (!JsonLexer$Companion_getInstance().isHex_0(this.currentChar_0)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }this.advance_0();\n }\n } else {\n var $receiver = SPECIAL_CHARS;\n var key = toBoxedChar(this.currentChar_0);\n var tmp$;\n if ((Kotlin.isType(tmp$ = $receiver, Map) ? tmp$ : throwCCE()).containsKey_11rb$(key))\n this.advance_0();\n else {\n throw IllegalStateException_init('Invalid escape sequence'.toString());\n }\n }\n } else {\n this.advance_0();\n }\n }\n this.advance_0();\n };\n function JsonLexer$readNumber$lambda(it) {\n return JsonLexer$Companion_getInstance().isDigit_0(unboxChar(it));\n }\n function JsonLexer$readNumber$lambda$lambda(it) {\n return JsonLexer$Companion_getInstance().isDigit_0(unboxChar(it));\n }\n function JsonLexer$readNumber$lambda_0(this$JsonLexer) {\n return function () {\n if (!JsonLexer$Companion_getInstance().isDigit_0(this$JsonLexer.currentChar_0)) {\n var message = 'Number should have decimal part';\n throw IllegalArgumentException_init(message.toString());\n }this$JsonLexer.advanceWhile_0(JsonLexer$readNumber$lambda$lambda);\n return Unit;\n };\n }\n function JsonLexer$readNumber$lambda$lambda_0(it) {\n return JsonLexer$Companion_getInstance().isDigit_0(unboxChar(it));\n }\n function JsonLexer$readNumber$lambda_1(this$JsonLexer) {\n return function () {\n this$JsonLexer.advanceIfCurrent_0(Kotlin.charArrayOf(43, 45));\n this$JsonLexer.advanceWhile_0(JsonLexer$readNumber$lambda$lambda_0);\n return Unit;\n };\n }\n JsonLexer.prototype.readNumber_0 = function () {\n if (!(JsonLexer$Companion_getInstance().isDigit_0(this.currentChar_0) || this.currentChar_0 === 45)) {\n return false;\n }this.startToken_0();\n this.advanceIfCurrent_0(Kotlin.charArrayOf(45));\n this.advanceWhile_0(JsonLexer$readNumber$lambda);\n this.advanceIfCurrent_0(Kotlin.charArrayOf(46), JsonLexer$readNumber$lambda_0(this));\n this.advanceIfCurrent_0(Kotlin.charArrayOf(101, 69), JsonLexer$readNumber$lambda_1(this));\n return true;\n };\n JsonLexer.prototype.isFinished = function () {\n return this.i_0 === this.input_0.length;\n };\n JsonLexer.prototype.startToken_0 = function () {\n this.tokenStart_0 = this.i_0;\n };\n JsonLexer.prototype.advance_0 = function () {\n this.i_0 = this.i_0 + 1 | 0;\n };\n JsonLexer.prototype.read_0 = function (str) {\n var forEach$result;\n var tmp$;\n tmp$ = iterator(str);\n while (tmp$.hasNext()) {\n var element = unboxChar(tmp$.next());\n var it = toBoxedChar(element);\n if (!(this.currentChar_0 === unboxChar(it))) {\n var message = 'Wrong data: ' + str;\n throw IllegalArgumentException_init(message.toString());\n }if (!!this.isFinished()) {\n var message_0 = 'Unexpected end of string';\n throw IllegalArgumentException_init(message_0.toString());\n }this.advance_0();\n }\n return forEach$result;\n };\n JsonLexer.prototype.advanceWhile_0 = function (pred) {\n while (!this.isFinished() && pred(toBoxedChar(this.currentChar_0)))\n this.advance_0();\n };\n function JsonLexer$advanceIfCurrent$lambda() {\n return Unit;\n }\n JsonLexer.prototype.advanceIfCurrent_0 = function (expected, then) {\n if (then === void 0)\n then = JsonLexer$advanceIfCurrent$lambda;\n if (!this.isFinished() && contains_0(expected, this.currentChar_0)) {\n this.advance_0();\n then();\n }};\n function JsonLexer$Companion() {\n JsonLexer$Companion_instance = this;\n this.digits_0 = new CharRange(48, 57);\n }\n JsonLexer$Companion.prototype.isDigit_0 = function ($receiver) {\n var $receiver_0 = this.digits_0;\n return $receiver != null && $receiver_0.contains_mef7kx$($receiver);\n };\n JsonLexer$Companion.prototype.isHex_0 = function ($receiver) {\n return this.isDigit_0($receiver) || (new CharRange(97, 102)).contains_mef7kx$($receiver) || (new CharRange(65, 70)).contains_mef7kx$($receiver);\n };\n JsonLexer$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var JsonLexer$Companion_instance = null;\n function JsonLexer$Companion_getInstance() {\n if (JsonLexer$Companion_instance === null) {\n new JsonLexer$Companion();\n }return JsonLexer$Companion_instance;\n }\n JsonLexer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JsonLexer',\n interfaces: []\n };\n function JsonParser(json) {\n this.json_0 = json;\n }\n JsonParser.prototype.parseJson = function () {\n var lexer = new JsonLexer(this.json_0);\n return this.parseValue_0(lexer);\n };\n JsonParser.prototype.parseValue_0 = function (lexer) {\n var tmp$, tmp$_0;\n tmp$ = lexer.currentToken;\n if (equals(tmp$, Token$STRING_getInstance())) {\n var $receiver = unescape(lexer.tokenValue());\n lexer.nextToken();\n tmp$_0 = $receiver;\n } else if (equals(tmp$, Token$NUMBER_getInstance())) {\n var $receiver_0 = toDouble(lexer.tokenValue());\n lexer.nextToken();\n tmp$_0 = $receiver_0;\n } else if (equals(tmp$, Token$FALSE_getInstance())) {\n lexer.nextToken();\n tmp$_0 = false;\n } else if (equals(tmp$, Token$TRUE_getInstance())) {\n lexer.nextToken();\n tmp$_0 = true;\n } else if (equals(tmp$, Token$NULL_getInstance())) {\n lexer.nextToken();\n tmp$_0 = null;\n } else if (equals(tmp$, Token$LEFT_BRACE_getInstance()))\n tmp$_0 = this.parseObject_0(lexer);\n else if (equals(tmp$, Token$LEFT_BRACKET_getInstance()))\n tmp$_0 = this.parseArray_0(lexer);\n else {\n throw IllegalStateException_init(('Invalid token: ' + toString(lexer.currentToken)).toString());\n }\n return tmp$_0;\n };\n function JsonParser$parseArray$checkCurrentToken(closure$lexer, this$JsonParser) {\n return function (token) {\n this$JsonParser.require_0(closure$lexer.currentToken, token, '[Arr] ');\n };\n }\n JsonParser.prototype.parseArray_0 = function (lexer) {\n var checkCurrentToken = JsonParser$parseArray$checkCurrentToken(lexer, this);\n var list = ArrayList_init();\n checkCurrentToken(Token$LEFT_BRACKET_getInstance());\n lexer.nextToken();\n while (!equals(lexer.currentToken, Token$RIGHT_BRACKET_getInstance())) {\n if (!list.isEmpty()) {\n checkCurrentToken(Token$COMMA_getInstance());\n lexer.nextToken();\n }list.add_11rb$(this.parseValue_0(lexer));\n }\n checkCurrentToken(Token$RIGHT_BRACKET_getInstance());\n lexer.nextToken();\n return list;\n };\n function JsonParser$parseObject$checkCurrentToken(closure$lexer, this$JsonParser) {\n return function (token) {\n this$JsonParser.require_0(closure$lexer.currentToken, token, '[Obj] ');\n };\n }\n JsonParser.prototype.parseObject_0 = function (lexer) {\n var checkCurrentToken = JsonParser$parseObject$checkCurrentToken(lexer, this);\n var map = LinkedHashMap_init();\n checkCurrentToken(Token$LEFT_BRACE_getInstance());\n lexer.nextToken();\n while (!equals(lexer.currentToken, Token$RIGHT_BRACE_getInstance())) {\n if (!map.isEmpty()) {\n checkCurrentToken(Token$COMMA_getInstance());\n lexer.nextToken();\n }checkCurrentToken(Token$STRING_getInstance());\n var key = unescape(lexer.tokenValue());\n lexer.nextToken();\n checkCurrentToken(Token$COLON_getInstance());\n lexer.nextToken();\n var value = this.parseValue_0(lexer);\n map.put_xwzc9p$(key, value);\n }\n checkCurrentToken(Token$RIGHT_BRACE_getInstance());\n lexer.nextToken();\n return map;\n };\n JsonParser.prototype.require_0 = function (current, expected, messagePrefix) {\n if (messagePrefix === void 0)\n messagePrefix = null;\n if (!equals(current, expected)) {\n throw new JsonParser$JsonException(messagePrefix + ('Expected token: ' + toString(expected) + ', actual: ' + toString(current)));\n }};\n function JsonParser$JsonException(message) {\n Exception_init(message, this);\n this.name = 'JsonParser$JsonException';\n }\n JsonParser$JsonException.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JsonException',\n interfaces: [Exception]\n };\n JsonParser.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JsonParser',\n interfaces: []\n };\n function JsonSupport() {\n JsonSupport_instance = this;\n }\n JsonSupport.prototype.parseJson_61zpoe$ = function (jsonString) {\n var tmp$;\n return Kotlin.isType(tmp$ = (new JsonParser(jsonString)).parseJson(), MutableMap) ? tmp$ : throwCCE();\n };\n JsonSupport.prototype.formatJson_za3rmp$ = function (o) {\n return (new JsonFormatter()).formatJson_za3rmp$(o);\n };\n JsonSupport.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'JsonSupport',\n interfaces: []\n };\n var JsonSupport_instance = null;\n function JsonSupport_getInstance() {\n if (JsonSupport_instance === null) {\n new JsonSupport();\n }return JsonSupport_instance;\n }\n function Token(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Token_initFields() {\n Token_initFields = function () {\n };\n Token$LEFT_BRACE_instance = new Token('LEFT_BRACE', 0);\n Token$RIGHT_BRACE_instance = new Token('RIGHT_BRACE', 1);\n Token$LEFT_BRACKET_instance = new Token('LEFT_BRACKET', 2);\n Token$RIGHT_BRACKET_instance = new Token('RIGHT_BRACKET', 3);\n Token$COMMA_instance = new Token('COMMA', 4);\n Token$COLON_instance = new Token('COLON', 5);\n Token$STRING_instance = new Token('STRING', 6);\n Token$NUMBER_instance = new Token('NUMBER', 7);\n Token$TRUE_instance = new Token('TRUE', 8);\n Token$FALSE_instance = new Token('FALSE', 9);\n Token$NULL_instance = new Token('NULL', 10);\n }\n var Token$LEFT_BRACE_instance;\n function Token$LEFT_BRACE_getInstance() {\n Token_initFields();\n return Token$LEFT_BRACE_instance;\n }\n var Token$RIGHT_BRACE_instance;\n function Token$RIGHT_BRACE_getInstance() {\n Token_initFields();\n return Token$RIGHT_BRACE_instance;\n }\n var Token$LEFT_BRACKET_instance;\n function Token$LEFT_BRACKET_getInstance() {\n Token_initFields();\n return Token$LEFT_BRACKET_instance;\n }\n var Token$RIGHT_BRACKET_instance;\n function Token$RIGHT_BRACKET_getInstance() {\n Token_initFields();\n return Token$RIGHT_BRACKET_instance;\n }\n var Token$COMMA_instance;\n function Token$COMMA_getInstance() {\n Token_initFields();\n return Token$COMMA_instance;\n }\n var Token$COLON_instance;\n function Token$COLON_getInstance() {\n Token_initFields();\n return Token$COLON_instance;\n }\n var Token$STRING_instance;\n function Token$STRING_getInstance() {\n Token_initFields();\n return Token$STRING_instance;\n }\n var Token$NUMBER_instance;\n function Token$NUMBER_getInstance() {\n Token_initFields();\n return Token$NUMBER_instance;\n }\n var Token$TRUE_instance;\n function Token$TRUE_getInstance() {\n Token_initFields();\n return Token$TRUE_instance;\n }\n var Token$FALSE_instance;\n function Token$FALSE_getInstance() {\n Token_initFields();\n return Token$FALSE_instance;\n }\n var Token$NULL_instance;\n function Token$NULL_getInstance() {\n Token_initFields();\n return Token$NULL_instance;\n }\n Token.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Token',\n interfaces: [Enum]\n };\n function Token$values() {\n return [Token$LEFT_BRACE_getInstance(), Token$RIGHT_BRACE_getInstance(), Token$LEFT_BRACKET_getInstance(), Token$RIGHT_BRACKET_getInstance(), Token$COMMA_getInstance(), Token$COLON_getInstance(), Token$STRING_getInstance(), Token$NUMBER_getInstance(), Token$TRUE_getInstance(), Token$FALSE_getInstance(), Token$NULL_getInstance()];\n }\n Token.values = Token$values;\n function Token$valueOf(name) {\n switch (name) {\n case 'LEFT_BRACE':\n return Token$LEFT_BRACE_getInstance();\n case 'RIGHT_BRACE':\n return Token$RIGHT_BRACE_getInstance();\n case 'LEFT_BRACKET':\n return Token$LEFT_BRACKET_getInstance();\n case 'RIGHT_BRACKET':\n return Token$RIGHT_BRACKET_getInstance();\n case 'COMMA':\n return Token$COMMA_getInstance();\n case 'COLON':\n return Token$COLON_getInstance();\n case 'STRING':\n return Token$STRING_getInstance();\n case 'NUMBER':\n return Token$NUMBER_getInstance();\n case 'TRUE':\n return Token$TRUE_getInstance();\n case 'FALSE':\n return Token$FALSE_getInstance();\n case 'NULL':\n return Token$NULL_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.json.Token.' + name);\n }\n }\n Token.valueOf_61zpoe$ = Token$valueOf;\n var SPECIAL_CHARS;\n var CONTROL_CHARS;\n function escape$appendOutput(closure$output, closure$i, this$escape) {\n return function (str) {\n var tmp$;\n var tmp$_0 = closure$output;\n var tmp$_1;\n if ((tmp$ = closure$output.v) != null)\n tmp$_1 = tmp$;\n else {\n var $receiver = this$escape;\n var endIndex = closure$i.v;\n tmp$_1 = new StringBuilder($receiver.substring(0, endIndex));\n }\n tmp$_0.v = tmp$_1.append_pdl1vj$(str);\n };\n }\n function escape($receiver) {\n var tmp$, tmp$_0, tmp$_1;\n var output = {v: null};\n var i = {v: 0};\n var appendOutput = escape$appendOutput(output, i, $receiver);\n while (i.v < $receiver.length) {\n var ch = $receiver.charCodeAt(i.v);\n switch (ch) {\n case 92:\n appendOutput('\\\\\\\\');\n break;\n case 34:\n appendOutput('\\\\\"');\n break;\n case 10:\n appendOutput('\\\\n');\n break;\n case 13:\n appendOutput('\\\\r');\n break;\n case 9:\n appendOutput('\\\\t');\n break;\n default:if (CONTROL_CHARS.contains_11rb$(toBoxedChar(ch))) {\n appendOutput('\\\\' + 'u' + padStart(toString_0(ch | 0, 16), 4, 48));\n } else\n (tmp$ = output.v) != null ? tmp$.append_s8itvh$(ch) : null;\n break;\n }\n i.v = i.v + 1 | 0;\n }\n return (tmp$_1 = (tmp$_0 = output.v) != null ? tmp$_0.toString() : null) != null ? tmp$_1 : $receiver;\n }\n function unescape($receiver) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3;\n var output = {v: null};\n var start = 1;\n var end = $receiver.length - 1 | 0;\n var i = {v: start};\n while (i.v < end) {\n var ch = $receiver.charCodeAt(i.v);\n if (ch === 92) {\n var tmp$_4;\n if ((tmp$ = output.v) != null)\n tmp$_4 = tmp$;\n else {\n var endIndex = i.v;\n tmp$_4 = new StringBuilder($receiver.substring(start, endIndex));\n }\n output.v = tmp$_4;\n var escapedChar = $receiver.charCodeAt((i.v = i.v + 1 | 0, i.v));\n var $receiver_0 = SPECIAL_CHARS;\n var key = toBoxedChar(escapedChar);\n var tmp$_5;\n if ((Kotlin.isType(tmp$_5 = $receiver_0, Map) ? tmp$_5 : throwCCE()).containsKey_11rb$(key)) {\n var $receiver_1 = SPECIAL_CHARS.get_11rb$(toBoxedChar(escapedChar));\n i.v = i.v + 1 | 0;\n tmp$_0 = unboxChar($receiver_1);\n } else if (escapedChar === 117) {\n var startIndex = i.v + 1 | 0;\n var endIndex_0 = i.v + 5 | 0;\n var $receiver_2 = toBoxedChar(toChar(toInt_0($receiver.substring(startIndex, endIndex_0), 16)));\n i.v = i.v + 5 | 0;\n tmp$_0 = unboxChar($receiver_2);\n } else\n throw new JsonParser$JsonException('Invalid escape character: ' + String.fromCharCode(escapedChar));\n output.v.append_s8jyv4$(toBoxedChar(tmp$_0));\n } else {\n (tmp$_1 = output.v) != null ? tmp$_1.append_s8itvh$(ch) : null;\n i.v = i.v + 1 | 0;\n }\n }\n return (tmp$_3 = (tmp$_2 = output.v) != null ? tmp$_2.toString() : null) != null ? tmp$_3 : $receiver.substring(start, end);\n }\n function streamOf(arr) {\n return asSequence(arr);\n }\n function objectsStreamOf$lambda(it) {\n var tmp$;\n return Kotlin.isType(tmp$ = it, Map) ? tmp$ : throwCCE();\n }\n function objectsStreamOf(arr) {\n return map(streamOf(arr), objectsStreamOf$lambda);\n }\n function stringStreamOf$lambda(it) {\n var tmp$;\n return (tmp$ = it) == null || typeof tmp$ === 'string' ? tmp$ : throwCCE();\n }\n function stringStreamOf(arr) {\n return map(streamOf(arr), stringStreamOf$lambda);\n }\n function isBoolean(e) {\n return typeof e === 'boolean';\n }\n function isNumber(e) {\n return Kotlin.isNumber(e);\n }\n function isString(e) {\n return typeof e === 'string';\n }\n function getAsDouble(v) {\n var tmp$;\n return numberToDouble(Kotlin.isNumber(tmp$ = v) ? tmp$ : throwCCE());\n }\n function getAsInt(v) {\n var tmp$;\n return numberToInt(Kotlin.isNumber(tmp$ = v) ? tmp$ : throwCCE());\n }\n function getAsBoolean(v) {\n var tmp$;\n return typeof (tmp$ = v) === 'boolean' ? tmp$ : throwCCE();\n }\n function containsString(obj, key) {\n var v = obj.get_11rb$(key);\n if (v == null || equals(v, isString(v)))\n return true;\n else\n return false;\n }\n function getAsString(e) {\n var tmp$;\n if (e == null)\n return null;\n else\n return typeof (tmp$ = e) === 'string' ? tmp$ : throwCCE();\n }\n function parseEnum(enumStringValue, values) {\n var first$result;\n first$break: do {\n var tmp$;\n for (tmp$ = 0; tmp$ !== values.length; ++tmp$) {\n var element = values[tmp$];\n if (equals_0(element.toString(), enumStringValue, true)) {\n first$result = element;\n break first$break;\n }}\n throw new NoSuchElementException_init_0('Array contains no element matching the predicate.');\n }\n while (false);\n return first$result;\n }\n var parseEnum_0 = defineInlineFunction('lets-plot-base-portable.jetbrains.datalore.base.json.parseEnum_a9gw98$', wrapFunction(function () {\n var parseEnum = _.jetbrains.datalore.base.json.parseEnum_xwn52g$;\n return function (T_0, isT, enumStringValue) {\n return parseEnum(enumStringValue, T_0.values());\n };\n }));\n function formatEnum(enumValue) {\n return enumValue.toString().toLowerCase();\n }\n function put($receiver, key, v) {\n var destination = ArrayList_init_0(collectionSizeOrDefault(v, 10));\n var tmp$;\n tmp$ = v.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(formatEnum(item));\n }\n return put_0($receiver, key, destination);\n }\n function put_0($receiver, key, v) {\n var tmp$ = FluentArray_init();\n var destination = ArrayList_init_0(collectionSizeOrDefault(v, 10));\n var tmp$_0;\n tmp$_0 = v.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(item);\n }\n return $receiver.put_wxs67v$(key, tmp$.addStrings_d294za$(destination));\n }\n function getNumber($receiver, key) {\n var tmp$;\n var tmp$_0;\n var tmp$_1;\n if ((Kotlin.isType(tmp$_1 = $receiver, Map) ? tmp$_1 : throwCCE()).get_11rb$(key) == null)\n tmp$_0 = 0.0;\n else {\n var tmp$_2;\n tmp$_0 = Kotlin.isNumber(tmp$ = (Kotlin.isType(tmp$_2 = $receiver, Map) ? tmp$_2 : throwCCE()).get_11rb$(key)) ? tmp$ : throwCCE();\n }\n return tmp$_0;\n }\n function getDouble($receiver, key) {\n return numberToDouble(getNumber($receiver, key));\n }\n function getString($receiver, key) {\n var tmp$;\n var tmp$_0;\n return typeof (tmp$ = (Kotlin.isType(tmp$_0 = $receiver, Map) ? tmp$_0 : throwCCE()).get_11rb$(key)) === 'string' ? tmp$ : throwCCE();\n }\n function getObj($receiver, key) {\n var tmp$;\n var tmp$_0;\n return Kotlin.isType(tmp$ = (Kotlin.isType(tmp$_0 = $receiver, Map) ? tmp$_0 : throwCCE()).get_11rb$(key), Map) ? tmp$ : throwCCE();\n }\n function getArr($receiver, key) {\n var tmp$;\n var tmp$_0;\n return Kotlin.isType(tmp$ = (Kotlin.isType(tmp$_0 = $receiver, Map) ? tmp$_0 : throwCCE()).get_11rb$(key), List) ? tmp$ : throwCCE();\n }\n function ListMap() {\n ListMap$Companion_getInstance();\n this.myData_0 = ListMap$Companion_getInstance().EMPTY_ARRAY_0;\n }\n function ListMap$Companion() {\n ListMap$Companion_instance = this;\n this.EMPTY_ARRAY_0 = Kotlin.newArray(0, null);\n }\n ListMap$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ListMap$Companion_instance = null;\n function ListMap$Companion_getInstance() {\n if (ListMap$Companion_instance === null) {\n new ListMap$Companion();\n }return ListMap$Companion_instance;\n }\n Object.defineProperty(ListMap.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.size() === 0;\n }\n });\n ListMap.prototype.containsKey_11rb$ = function (key) {\n return this.findByKey_0(key) >= 0;\n };\n ListMap.prototype.remove_11rb$ = function (key) {\n var tmp$;\n var index = this.findByKey_0(key);\n if (index >= 0) {\n var value = this.myData_0[index + 1 | 0];\n this.removeAt_0(index);\n return (tmp$ = value) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n } else {\n return null;\n }\n };\n function ListMap$keySet$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n AbstractMutableSet.call(this);\n }\n Object.defineProperty(ListMap$keySet$ObjectLiteral.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.this$ListMap.size();\n }\n });\n ListMap$keySet$ObjectLiteral.prototype.add_11rb$ = function (element) {\n throw IllegalStateException_init('Not available in keySet');\n };\n function ListMap$keySet$ObjectLiteral$iterator$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n }\n ListMap$keySet$ObjectLiteral$iterator$ObjectLiteral.prototype.get_za3lpa$ = function (index) {\n return this.this$ListMap.myData_0[index];\n };\n ListMap$keySet$ObjectLiteral$iterator$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListMap$IteratorSpec]\n };\n ListMap$keySet$ObjectLiteral.prototype.iterator = function () {\n return this.this$ListMap.mapIterator_0(new ListMap$keySet$ObjectLiteral$iterator$ObjectLiteral(this.this$ListMap));\n };\n ListMap$keySet$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AbstractMutableSet]\n };\n ListMap.prototype.keySet = function () {\n return new ListMap$keySet$ObjectLiteral(this);\n };\n function ListMap$values$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n AbstractCollection.call(this);\n }\n Object.defineProperty(ListMap$values$ObjectLiteral.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.this$ListMap.size();\n }\n });\n function ListMap$values$ObjectLiteral$iterator$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n }\n ListMap$values$ObjectLiteral$iterator$ObjectLiteral.prototype.get_za3lpa$ = function (index) {\n return this.this$ListMap.myData_0[index + 1 | 0];\n };\n ListMap$values$ObjectLiteral$iterator$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListMap$IteratorSpec]\n };\n ListMap$values$ObjectLiteral.prototype.iterator = function () {\n return this.this$ListMap.mapIterator_0(new ListMap$values$ObjectLiteral$iterator$ObjectLiteral(this.this$ListMap));\n };\n ListMap$values$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AbstractCollection]\n };\n ListMap.prototype.values = function () {\n return new ListMap$values$ObjectLiteral(this);\n };\n function ListMap$entrySet$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n AbstractSet.call(this);\n }\n Object.defineProperty(ListMap$entrySet$ObjectLiteral.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.this$ListMap.size();\n }\n });\n function ListMap$entrySet$ObjectLiteral$iterator$ObjectLiteral(this$ListMap) {\n this.this$ListMap = this$ListMap;\n }\n ListMap$entrySet$ObjectLiteral$iterator$ObjectLiteral.prototype.get_za3lpa$ = function (index) {\n return new ListMap$Entry(this.this$ListMap, index);\n };\n ListMap$entrySet$ObjectLiteral$iterator$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListMap$IteratorSpec]\n };\n ListMap$entrySet$ObjectLiteral.prototype.iterator = function () {\n return this.this$ListMap.mapIterator_0(new ListMap$entrySet$ObjectLiteral$iterator$ObjectLiteral(this.this$ListMap));\n };\n ListMap$entrySet$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AbstractSet]\n };\n ListMap.prototype.entrySet = function () {\n return new ListMap$entrySet$ObjectLiteral(this);\n };\n ListMap.prototype.size = function () {\n return this.myData_0.length / 2 | 0;\n };\n ListMap.prototype.put_xwzc9p$ = function (key, value) {\n var tmp$;\n var index = this.findByKey_0(key);\n if (index >= 0) {\n var oldValue = this.myData_0[index + 1 | 0];\n this.myData_0[index + 1 | 0] = value;\n return (tmp$ = oldValue) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n }var array = Array_0(this.myData_0.length + 2 | 0);\n var tmp$_0;\n tmp$_0 = array.length - 1 | 0;\n for (var i = 0; i <= tmp$_0; i++) {\n array[i] = i < this.myData_0.length ? this.myData_0[i] : null;\n }\n var newArray = array;\n newArray[this.myData_0.length] = key;\n newArray[this.myData_0.length + 1 | 0] = value;\n this.myData_0 = newArray;\n return null;\n };\n ListMap.prototype.get_11rb$ = function (key) {\n var tmp$, tmp$_0;\n var index = this.findByKey_0(key);\n if (index === -1) {\n tmp$_0 = null;\n } else {\n tmp$_0 = (tmp$ = this.myData_0[index + 1 | 0]) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n }\n return tmp$_0;\n };\n ListMap.prototype.toString = function () {\n var builder = StringBuilder_init();\n builder.append_pdl1vj$('{');\n var i = 0;\n while (i < this.myData_0.length) {\n var k = this.myData_0[i];\n var v = this.myData_0[i + 1 | 0];\n if (i !== 0) {\n builder.append_pdl1vj$(',');\n }builder.append_s8jyv4$(k).append_pdl1vj$('=').append_s8jyv4$(v);\n i = i + 2 | 0;\n }\n builder.append_pdl1vj$('}');\n return builder.toString();\n };\n function ListMap$mapIterator$ObjectLiteral(this$ListMap, closure$spec) {\n this.this$ListMap = this$ListMap;\n this.closure$spec = closure$spec;\n this.index_0 = 0;\n this.nextCalled_0 = false;\n }\n ListMap$mapIterator$ObjectLiteral.prototype.hasNext = function () {\n return this.index_0 < this.this$ListMap.myData_0.length;\n };\n ListMap$mapIterator$ObjectLiteral.prototype.next = function () {\n var tmp$;\n if (!this.hasNext()) {\n throw NoSuchElementException_init();\n }this.nextCalled_0 = true;\n var value = (tmp$ = this.closure$spec.get_za3lpa$(this.index_0)) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n this.index_0 = this.index_0 + 2 | 0;\n return value;\n };\n ListMap$mapIterator$ObjectLiteral.prototype.remove = function () {\n if (!this.nextCalled_0) {\n throw IllegalStateException_init_0();\n }this.index_0 = this.index_0 - 2 | 0;\n this.this$ListMap.removeAt_0(this.index_0);\n this.nextCalled_0 = false;\n };\n ListMap$mapIterator$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [MutableIterator]\n };\n ListMap.prototype.mapIterator_0 = function (spec) {\n return new ListMap$mapIterator$ObjectLiteral(this, spec);\n };\n ListMap.prototype.findByKey_0 = function (key) {\n var i = 0;\n while (i < this.myData_0.length) {\n var k = this.myData_0[i];\n if (equals(key, k)) {\n return i;\n }i = i + 2 | 0;\n }\n return -1;\n };\n ListMap.prototype.removeAt_0 = function (index) {\n if (this.myData_0.length === 2) {\n this.myData_0 = ListMap$Companion_getInstance().EMPTY_ARRAY_0;\n return;\n }var array = Array_0(this.myData_0.length - 2 | 0);\n var tmp$;\n tmp$ = array.length - 1 | 0;\n for (var i = 0; i <= tmp$; i++) {\n var init$result;\n if (i < index) {\n init$result = this.myData_0[i];\n } else {\n init$result = this.myData_0[i + 2 | 0];\n }\n array[i] = init$result;\n }\n var newArray = array;\n this.myData_0 = newArray;\n };\n function ListMap$Entry($outer, myIndex) {\n this.$outer = $outer;\n this.myIndex_0 = myIndex;\n }\n ListMap$Entry.prototype.key = function () {\n var tmp$;\n return (tmp$ = this.$outer.myData_0[this.myIndex_0]) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n };\n ListMap$Entry.prototype.value = function () {\n var tmp$;\n return (tmp$ = this.$outer.myData_0[this.myIndex_0 + 1 | 0]) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n };\n ListMap$Entry.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Entry',\n interfaces: []\n };\n function ListMap$IteratorSpec() {\n }\n ListMap$IteratorSpec.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'IteratorSpec',\n interfaces: []\n };\n ListMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ListMap',\n interfaces: []\n };\n function Logger() {\n }\n Logger.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Logger',\n interfaces: []\n };\n function PrintlnLogger(name) {\n this.name = name;\n }\n PrintlnLogger.prototype.error_l35kib$ = function (e, message) {\n println('ERR [' + this.name + '] : ' + message());\n };\n PrintlnLogger.prototype.info_h4ejuu$ = function (message) {\n println('INFO [' + this.name + '] : ' + message());\n };\n PrintlnLogger.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PrintlnLogger',\n interfaces: [Logger]\n };\n function toRadians(degrees) {\n return degrees * math.PI / 180.0;\n }\n function toDegrees(radians) {\n return radians * 180.0 / math.PI;\n }\n function round_0(v) {\n return round_1(v.x, v.y);\n }\n function ceil(v) {\n return ceil_0(v.x, v.y);\n }\n function round_1(x, y) {\n return new Vector(numberToInt(round(x)), numberToInt(round(y)));\n }\n function ceil_0(x, y) {\n return new Vector(numberToInt(JsMath.ceil(x)), numberToInt(JsMath.ceil(y)));\n }\n function distance(vector, doubleVector) {\n var dx = doubleVector.x - vector.x;\n var dy = doubleVector.y - vector.y;\n var x = dx * dx + dy * dy;\n return JsMath.sqrt(x);\n }\n function ipow($receiver, e) {\n return JsMath.pow($receiver, e);\n }\n function length(v) {\n if (equals(v, L0)) {\n return 1;\n }var len = 0;\n var rem = v;\n while (rem.toNumber() > 0) {\n len = len + 1 | 0;\n rem = rem.div(Kotlin.Long.fromInt(10));\n }\n return len;\n }\n function NumberFormat(spec) {\n NumberFormat$Companion_getInstance();\n this.spec_0 = spec;\n }\n function NumberFormat$Spec(fill, align, sign, symbol, zero, width, comma, precision, type, trim) {\n if (fill === void 0)\n fill = ' ';\n if (align === void 0)\n align = '>';\n if (sign === void 0)\n sign = '-';\n if (width === void 0)\n width = -1;\n if (precision === void 0)\n precision = 6;\n if (type === void 0)\n type = '';\n if (trim === void 0)\n trim = false;\n this.fill = fill;\n this.align = align;\n this.sign = sign;\n this.symbol = symbol;\n this.zero = zero;\n this.width = width;\n this.comma = comma;\n this.precision = precision;\n this.type = type;\n this.trim = trim;\n }\n NumberFormat$Spec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Spec',\n interfaces: []\n };\n NumberFormat$Spec.prototype.component1 = function () {\n return this.fill;\n };\n NumberFormat$Spec.prototype.component2 = function () {\n return this.align;\n };\n NumberFormat$Spec.prototype.component3 = function () {\n return this.sign;\n };\n NumberFormat$Spec.prototype.component4 = function () {\n return this.symbol;\n };\n NumberFormat$Spec.prototype.component5 = function () {\n return this.zero;\n };\n NumberFormat$Spec.prototype.component6 = function () {\n return this.width;\n };\n NumberFormat$Spec.prototype.component7 = function () {\n return this.comma;\n };\n NumberFormat$Spec.prototype.component8 = function () {\n return this.precision;\n };\n NumberFormat$Spec.prototype.component9 = function () {\n return this.type;\n };\n NumberFormat$Spec.prototype.component10 = function () {\n return this.trim;\n };\n NumberFormat$Spec.prototype.copy_xzdl1p$ = function (fill, align, sign, symbol, zero, width, comma, precision, type, trim) {\n return new NumberFormat$Spec(fill === void 0 ? this.fill : fill, align === void 0 ? this.align : align, sign === void 0 ? this.sign : sign, symbol === void 0 ? this.symbol : symbol, zero === void 0 ? this.zero : zero, width === void 0 ? this.width : width, comma === void 0 ? this.comma : comma, precision === void 0 ? this.precision : precision, type === void 0 ? this.type : type, trim === void 0 ? this.trim : trim);\n };\n NumberFormat$Spec.prototype.toString = function () {\n return 'Spec(fill=' + Kotlin.toString(this.fill) + (', align=' + Kotlin.toString(this.align)) + (', sign=' + Kotlin.toString(this.sign)) + (', symbol=' + Kotlin.toString(this.symbol)) + (', zero=' + Kotlin.toString(this.zero)) + (', width=' + Kotlin.toString(this.width)) + (', comma=' + Kotlin.toString(this.comma)) + (', precision=' + Kotlin.toString(this.precision)) + (', type=' + Kotlin.toString(this.type)) + (', trim=' + Kotlin.toString(this.trim)) + ')';\n };\n NumberFormat$Spec.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.fill) | 0;\n result = result * 31 + Kotlin.hashCode(this.align) | 0;\n result = result * 31 + Kotlin.hashCode(this.sign) | 0;\n result = result * 31 + Kotlin.hashCode(this.symbol) | 0;\n result = result * 31 + Kotlin.hashCode(this.zero) | 0;\n result = result * 31 + Kotlin.hashCode(this.width) | 0;\n result = result * 31 + Kotlin.hashCode(this.comma) | 0;\n result = result * 31 + Kotlin.hashCode(this.precision) | 0;\n result = result * 31 + Kotlin.hashCode(this.type) | 0;\n result = result * 31 + Kotlin.hashCode(this.trim) | 0;\n return result;\n };\n NumberFormat$Spec.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.fill, other.fill) && Kotlin.equals(this.align, other.align) && Kotlin.equals(this.sign, other.sign) && Kotlin.equals(this.symbol, other.symbol) && Kotlin.equals(this.zero, other.zero) && Kotlin.equals(this.width, other.width) && Kotlin.equals(this.comma, other.comma) && Kotlin.equals(this.precision, other.precision) && Kotlin.equals(this.type, other.type) && Kotlin.equals(this.trim, other.trim)))));\n };\n function NumberFormat$NumberInfo(number, negative, integerPart, fractionalPart, exponent) {\n NumberFormat$NumberInfo$Companion_getInstance();\n if (number === void 0)\n number = 0.0;\n if (negative === void 0)\n negative = false;\n if (integerPart === void 0)\n integerPart = L0;\n if (fractionalPart === void 0)\n fractionalPart = L0;\n if (exponent === void 0)\n exponent = null;\n this.number = number;\n this.negative = negative;\n this.integerPart = integerPart;\n this.fractionalPart = fractionalPart;\n this.exponent = exponent;\n this.fractionLeadingZeros = 18 - length(this.fractionalPart) | 0;\n this.integerLength = length(this.integerPart);\n this.fractionString = repeat('0', this.fractionLeadingZeros) + trimEnd(this.fractionalPart.toString(), Kotlin.charArrayOf(48));\n }\n function NumberFormat$NumberInfo$Companion() {\n NumberFormat$NumberInfo$Companion_instance = this;\n this.MAX_DECIMALS_0 = 18;\n this.MAX_DECIMAL_VALUE_8be2vx$ = Kotlin.Long.fromNumber(JsMath.pow(10.0, 18));\n }\n function NumberFormat$NumberInfo$Companion$createNumberInfo$lambda(frac, exp) {\n var fraction = frac;\n if (exp > 18) {\n fraction = substring(frac, until(0, frac.length - (exp - 18) | 0));\n }var tmp$ = toLong(fraction);\n var n = coerceAtLeast(18 - exp | 0, 0);\n return tmp$.multiply(Kotlin.Long.fromNumber(JsMath.pow(10.0, n)));\n }\n NumberFormat$NumberInfo$Companion.prototype.createNumberInfo_yjmjg9$ = function (num) {\n var tmp$, tmp$_0, tmp$_1;\n var encodeFraction = NumberFormat$NumberInfo$Companion$createNumberInfo$lambda;\n var tmp$_2 = Regex_init('^(\\\\d+)\\\\.?(\\\\d+)?e?([+-]?\\\\d+)?$');\n var tmp$_3;\n var $receiver = numberToDouble(num);\n if ((tmp$_0 = (tmp$ = tmp$_2.find_905azu$(JsMath.abs($receiver).toString().toLowerCase())) != null ? tmp$.destructured : null) != null)\n tmp$_3 = tmp$_0;\n else {\n throw IllegalStateException_init(('Wrong number: ' + num.toString()).toString());\n }\n var tmp$_4 = tmp$_3;\n var intStr = tmp$_4.match.groupValues.get_za3lpa$(1);\n var fracStr = tmp$_4.match.groupValues.get_za3lpa$(2);\n var exponentString = tmp$_4.match.groupValues.get_za3lpa$(3);\n var exponent = (tmp$_1 = toIntOrNull(exponentString)) != null ? tmp$_1 : 0;\n if (abs(exponent) >= 18) {\n return NumberFormat$NumberFormat$NumberInfo_init(num, toLong(intStr), L0, exponent);\n }if (!(exponent < 18)) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }if (exponent < 0) {\n return NumberFormat$NumberFormat$NumberInfo_init(num, void 0, encodeFraction(intStr + fracStr, abs(exponent) + fracStr.length | 0));\n }if (!(exponent >= 0 && exponent <= 18)) {\n var message_0 = 'Check failed.';\n throw IllegalStateException_init(message_0.toString());\n }if (exponent >= fracStr.length) {\n return NumberFormat$NumberFormat$NumberInfo_init(num, toLong(intStr + fracStr + repeat('0', exponent - fracStr.length | 0)));\n }if (!(exponent >= 0 && exponent < fracStr.length)) {\n var message_1 = 'Check failed.';\n throw IllegalStateException_init(message_1.toString());\n }var tmp$_5 = toLong(intStr + substring(fracStr, until(0, exponent)));\n var $receiver_0 = fracStr.substring(exponent);\n return NumberFormat$NumberFormat$NumberInfo_init(num, tmp$_5, encodeFraction($receiver_0, $receiver_0.length));\n };\n NumberFormat$NumberInfo$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var NumberFormat$NumberInfo$Companion_instance = null;\n function NumberFormat$NumberInfo$Companion_getInstance() {\n if (NumberFormat$NumberInfo$Companion_instance === null) {\n new NumberFormat$NumberInfo$Companion();\n }return NumberFormat$NumberInfo$Companion_instance;\n }\n NumberFormat$NumberInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NumberInfo',\n interfaces: []\n };\n function NumberFormat$NumberFormat$NumberInfo_init(number, integerPart, fractionalPart, exponent, $this) {\n if (integerPart === void 0)\n integerPart = L0;\n if (fractionalPart === void 0)\n fractionalPart = L0;\n if (exponent === void 0)\n exponent = null;\n $this = $this || Object.create(NumberFormat$NumberInfo.prototype);\n var $receiver = numberToDouble(number);\n NumberFormat$NumberInfo.call($this, JsMath.abs($receiver), numberToDouble(number) < 0.0, integerPart, fractionalPart, exponent);\n return $this;\n }\n NumberFormat$NumberInfo.prototype.component1 = function () {\n return this.number;\n };\n NumberFormat$NumberInfo.prototype.component2 = function () {\n return this.negative;\n };\n NumberFormat$NumberInfo.prototype.component3 = function () {\n return this.integerPart;\n };\n NumberFormat$NumberInfo.prototype.component4 = function () {\n return this.fractionalPart;\n };\n NumberFormat$NumberInfo.prototype.component5 = function () {\n return this.exponent;\n };\n NumberFormat$NumberInfo.prototype.copy_xz9h4k$ = function (number, negative, integerPart, fractionalPart, exponent) {\n return new NumberFormat$NumberInfo(number === void 0 ? this.number : number, negative === void 0 ? this.negative : negative, integerPart === void 0 ? this.integerPart : integerPart, fractionalPart === void 0 ? this.fractionalPart : fractionalPart, exponent === void 0 ? this.exponent : exponent);\n };\n NumberFormat$NumberInfo.prototype.toString = function () {\n return 'NumberInfo(number=' + Kotlin.toString(this.number) + (', negative=' + Kotlin.toString(this.negative)) + (', integerPart=' + Kotlin.toString(this.integerPart)) + (', fractionalPart=' + Kotlin.toString(this.fractionalPart)) + (', exponent=' + Kotlin.toString(this.exponent)) + ')';\n };\n NumberFormat$NumberInfo.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.number) | 0;\n result = result * 31 + Kotlin.hashCode(this.negative) | 0;\n result = result * 31 + Kotlin.hashCode(this.integerPart) | 0;\n result = result * 31 + Kotlin.hashCode(this.fractionalPart) | 0;\n result = result * 31 + Kotlin.hashCode(this.exponent) | 0;\n return result;\n };\n NumberFormat$NumberInfo.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.number, other.number) && Kotlin.equals(this.negative, other.negative) && Kotlin.equals(this.integerPart, other.integerPart) && Kotlin.equals(this.fractionalPart, other.fractionalPart) && Kotlin.equals(this.exponent, other.exponent)))));\n };\n function NumberFormat$Output(body, sign, prefix, suffix, padding) {\n if (body === void 0)\n body = new NumberFormat$FormattedNumber();\n if (sign === void 0)\n sign = '';\n if (prefix === void 0)\n prefix = '';\n if (suffix === void 0)\n suffix = '';\n if (padding === void 0)\n padding = '';\n this.body = body;\n this.sign = sign;\n this.prefix = prefix;\n this.suffix = suffix;\n this.padding = padding;\n }\n NumberFormat$Output.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Output',\n interfaces: []\n };\n NumberFormat$Output.prototype.component1 = function () {\n return this.body;\n };\n NumberFormat$Output.prototype.component2 = function () {\n return this.sign;\n };\n NumberFormat$Output.prototype.component3 = function () {\n return this.prefix;\n };\n NumberFormat$Output.prototype.component4 = function () {\n return this.suffix;\n };\n NumberFormat$Output.prototype.component5 = function () {\n return this.padding;\n };\n NumberFormat$Output.prototype.copy_rm1j3u$ = function (body, sign, prefix, suffix, padding) {\n return new NumberFormat$Output(body === void 0 ? this.body : body, sign === void 0 ? this.sign : sign, prefix === void 0 ? this.prefix : prefix, suffix === void 0 ? this.suffix : suffix, padding === void 0 ? this.padding : padding);\n };\n NumberFormat$Output.prototype.toString = function () {\n return 'Output(body=' + Kotlin.toString(this.body) + (', sign=' + Kotlin.toString(this.sign)) + (', prefix=' + Kotlin.toString(this.prefix)) + (', suffix=' + Kotlin.toString(this.suffix)) + (', padding=' + Kotlin.toString(this.padding)) + ')';\n };\n NumberFormat$Output.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.body) | 0;\n result = result * 31 + Kotlin.hashCode(this.sign) | 0;\n result = result * 31 + Kotlin.hashCode(this.prefix) | 0;\n result = result * 31 + Kotlin.hashCode(this.suffix) | 0;\n result = result * 31 + Kotlin.hashCode(this.padding) | 0;\n return result;\n };\n NumberFormat$Output.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.body, other.body) && Kotlin.equals(this.sign, other.sign) && Kotlin.equals(this.prefix, other.prefix) && Kotlin.equals(this.suffix, other.suffix) && Kotlin.equals(this.padding, other.padding)))));\n };\n function NumberFormat$FormattedNumber(integerPart, fractionalPart, exponentialPart) {\n if (integerPart === void 0)\n integerPart = '';\n if (fractionalPart === void 0)\n fractionalPart = '';\n if (exponentialPart === void 0)\n exponentialPart = '';\n this.integerPart = integerPart;\n this.fractionalPart = fractionalPart;\n this.exponentialPart = exponentialPart;\n var tmp$;\n this.fractionalLength = (tmp$ = this.fractionalPart.length === 0 ? 0 : null) != null ? tmp$ : 1 + this.fractionalPart.length | 0;\n this.fullLength = this.integerPart.length + this.fractionalLength + this.exponentialPart.length | 0;\n }\n NumberFormat$FormattedNumber.prototype.toString = function () {\n var tmp$;\n var tmp$_0 = this.integerPart;\n var $receiver = NumberFormat$Companion_getInstance().FRACTION_DELIMITER_0;\n return tmp$_0 + ((tmp$ = this.fractionalPart.length > 0 ? $receiver : null) != null ? tmp$ : '') + this.fractionalPart + this.exponentialPart;\n };\n NumberFormat$FormattedNumber.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FormattedNumber',\n interfaces: []\n };\n NumberFormat$FormattedNumber.prototype.component1 = function () {\n return this.integerPart;\n };\n NumberFormat$FormattedNumber.prototype.component2 = function () {\n return this.fractionalPart;\n };\n NumberFormat$FormattedNumber.prototype.component3 = function () {\n return this.exponentialPart;\n };\n NumberFormat$FormattedNumber.prototype.copy_6hosri$ = function (integerPart, fractionalPart, exponentialPart) {\n return new NumberFormat$FormattedNumber(integerPart === void 0 ? this.integerPart : integerPart, fractionalPart === void 0 ? this.fractionalPart : fractionalPart, exponentialPart === void 0 ? this.exponentialPart : exponentialPart);\n };\n NumberFormat$FormattedNumber.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.integerPart) | 0;\n result = result * 31 + Kotlin.hashCode(this.fractionalPart) | 0;\n result = result * 31 + Kotlin.hashCode(this.exponentialPart) | 0;\n return result;\n };\n NumberFormat$FormattedNumber.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.integerPart, other.integerPart) && Kotlin.equals(this.fractionalPart, other.fractionalPart) && Kotlin.equals(this.exponentialPart, other.exponentialPart)))));\n };\n NumberFormat.prototype.apply_3p81yu$ = function (num) {\n var nonNumberString = this.handleNonNumbers_0(num);\n if (nonNumberString != null) {\n return nonNumberString;\n }var numberInfo = NumberFormat$NumberInfo$Companion_getInstance().createNumberInfo_yjmjg9$(num);\n var output = new NumberFormat$Output();\n output = this.computeBody_0(output, numberInfo);\n output = this.trimFraction_0(output);\n output = this.computeSign_0(output, numberInfo);\n output = this.computePrefix_0(output);\n output = this.computeSuffix_0(output);\n if (this.spec_0.comma && !this.spec_0.zero) {\n output = this.applyGroup_0(output);\n }output = this.computePadding_0(output);\n if (this.spec_0.comma && this.spec_0.zero) {\n output = this.applyGroup_0(output);\n }return this.getAlignedString_0(output);\n };\n NumberFormat.prototype.handleNonNumbers_0 = function (num) {\n var tmp$;\n var number = numberToDouble(num);\n if (isNaN_0(number))\n tmp$ = 'NaN';\n else if (number === kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY)\n tmp$ = '-Infinity';\n else if (number === kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY)\n tmp$ = '+Infinity';\n else\n tmp$ = null;\n return tmp$;\n };\n NumberFormat.prototype.getAlignedString_0 = function (output) {\n var tmp$;\n switch (this.spec_0.align) {\n case '<':\n tmp$ = output.sign + output.prefix + output.body + output.suffix + output.padding;\n break;\n case '=':\n tmp$ = output.sign + output.prefix + output.padding + output.body + output.suffix;\n break;\n case '^':\n var stop = output.padding.length / 2 | 0;\n tmp$ = slice(output.padding, until(0, stop)) + output.sign + output.prefix + output.body + output.suffix + slice(output.padding, until(stop, output.padding.length));\n break;\n default:tmp$ = output.padding + output.sign + output.prefix + output.body + output.suffix;\n break;\n }\n return tmp$;\n };\n NumberFormat.prototype.applyGroup_0 = function (output) {\n var tmp$, tmp$_0;\n var $receiver = output.padding;\n var zeroPadding = (tmp$ = this.spec_0.zero ? $receiver : null) != null ? tmp$ : '';\n var body = output.body;\n var fullIntStr = zeroPadding + body.integerPart;\n var x = fullIntStr.length / 3;\n var commas = numberToInt(JsMath.ceil(x) - 1);\n var width = coerceAtLeast(this.spec_0.width - body.fractionalLength - body.exponentialPart.length | 0, body.integerPart.length + commas | 0);\n fullIntStr = NumberFormat$Companion_getInstance().group_0(fullIntStr);\n if (fullIntStr.length > width) {\n var $receiver_0 = fullIntStr;\n var startIndex = fullIntStr.length - width | 0;\n fullIntStr = $receiver_0.substring(startIndex);\n if (startsWith(fullIntStr, 44)) {\n fullIntStr = '0' + fullIntStr;\n }}return output.copy_rm1j3u$(body.copy_6hosri$(fullIntStr), void 0, void 0, void 0, (tmp$_0 = this.spec_0.zero ? '' : null) != null ? tmp$_0 : output.padding);\n };\n NumberFormat.prototype.computeBody_0 = function (res, numberInfo) {\n var tmp$;\n switch (this.spec_0.type) {\n case '%':\n tmp$ = this.toFixedFormat_0(NumberFormat$NumberInfo$Companion_getInstance().createNumberInfo_yjmjg9$(numberInfo.number * 100), this.spec_0.precision);\n break;\n case 'c':\n tmp$ = new NumberFormat$FormattedNumber(numberInfo.number.toString());\n break;\n case 'd':\n tmp$ = this.toSimpleFormat_0(numberInfo, 0);\n break;\n case 'e':\n tmp$ = this.toSimpleFormat_0(this.toExponential_0(numberInfo, this.spec_0.precision), this.spec_0.precision);\n break;\n case 'f':\n tmp$ = this.toFixedFormat_0(numberInfo, this.spec_0.precision);\n break;\n case 'g':\n tmp$ = this.toPrecisionFormat_0(numberInfo, this.spec_0.precision);\n break;\n case 'b':\n tmp$ = new NumberFormat$FormattedNumber(toString_1(roundToLong(numberInfo.number), 2));\n break;\n case 'o':\n tmp$ = new NumberFormat$FormattedNumber(toString_1(roundToLong(numberInfo.number), 8));\n break;\n case 'X':\n tmp$ = new NumberFormat$FormattedNumber(toString_1(roundToLong(numberInfo.number), 16).toUpperCase());\n break;\n case 'x':\n tmp$ = new NumberFormat$FormattedNumber(toString_1(roundToLong(numberInfo.number), 16));\n break;\n case 's':\n tmp$ = this.toSiFormat_0(numberInfo, this.spec_0.precision);\n break;\n default:throw IllegalArgumentException_init('Wrong type: ' + this.spec_0.type);\n }\n var formattedNumber = tmp$;\n return res.copy_rm1j3u$(formattedNumber);\n };\n NumberFormat.prototype.toExponential_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = -1;\n var tmp$, tmp$_0;\n var num = numberInfo.number;\n if (num < NumberFormat$Companion_getInstance().TYPE_E_MIN) {\n return new NumberFormat$NumberInfo(0.0);\n }if (equals(numberInfo.integerPart, L0)) {\n tmp$_0 = -(numberInfo.fractionLeadingZeros + 1 | 0) | 0;\n } else {\n tmp$_0 = (numberInfo.integerLength - 1 | 0) + ((tmp$ = numberInfo.exponent) != null ? tmp$ : 0) | 0;\n }\n var e = tmp$_0;\n var n = e;\n var n_0 = num / JsMath.pow(10.0, n);\n var newInfo = NumberFormat$NumberInfo$Companion_getInstance().createNumberInfo_yjmjg9$(n_0);\n if (precision > -1) {\n newInfo = this.roundToPrecision_0(newInfo, precision);\n }if (newInfo.integerLength > 1) {\n e = e + 1 | 0;\n newInfo = NumberFormat$NumberInfo$Companion_getInstance().createNumberInfo_yjmjg9$(n_0 / 10);\n }return newInfo.copy_xz9h4k$(void 0, void 0, void 0, void 0, e);\n };\n NumberFormat.prototype.toPrecisionFormat_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = -1;\n if (equals(numberInfo.integerPart, L0)) {\n if (equals(numberInfo.fractionalPart, L0)) {\n return this.toFixedFormat_0(numberInfo, precision - 1 | 0);\n }return this.toFixedFormat_0(numberInfo, precision + numberInfo.fractionLeadingZeros | 0);\n } else {\n if (numberInfo.integerLength > precision) {\n return this.toSimpleFormat_0(this.toExponential_0(numberInfo, precision - 1 | 0), precision - 1 | 0);\n }return this.toFixedFormat_0(numberInfo, precision - numberInfo.integerLength | 0);\n }\n };\n NumberFormat.prototype.toFixedFormat_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = 0;\n var tmp$;\n if (precision <= 0) {\n return new NumberFormat$FormattedNumber(roundToLong(numberInfo.number).toString());\n }var newNumberInfo = this.roundToPrecision_0(numberInfo, precision);\n if (numberInfo.integerLength < newNumberInfo.integerLength) {\n tmp$ = precision - 1 | 0;\n } else {\n tmp$ = precision;\n }\n var completePrecision = tmp$;\n if (equals(newNumberInfo.fractionalPart, L0)) {\n return new NumberFormat$FormattedNumber(newNumberInfo.integerPart.toString(), repeat('0', completePrecision));\n }var fractionString = padEnd(newNumberInfo.fractionString, completePrecision, 48);\n return new NumberFormat$FormattedNumber(newNumberInfo.integerPart.toString(), fractionString);\n };\n NumberFormat.prototype.toSimpleFormat_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = -1;\n var tmp$;\n if (numberInfo.exponent != null) {\n var expSign = get_sign(numberInfo.exponent) >= 0 ? '+' : '';\n tmp$ = 'e' + expSign + toString(numberInfo.exponent);\n } else {\n tmp$ = '';\n }\n var exponentString = tmp$;\n var expNumberInfo = NumberFormat$NumberInfo$Companion_getInstance().createNumberInfo_yjmjg9$(numberInfo.integerPart.toNumber() + numberInfo.fractionalPart.toNumber() / NumberFormat$NumberInfo$Companion_getInstance().MAX_DECIMAL_VALUE_8be2vx$.toNumber());\n if (precision > -1) {\n var formattedNumber = this.toFixedFormat_0(expNumberInfo, precision);\n return formattedNumber.copy_6hosri$(void 0, void 0, exponentString);\n }var integerString = expNumberInfo.integerPart.toString();\n var fractionString = equals(expNumberInfo.fractionalPart, L0) ? '' : expNumberInfo.fractionString;\n return new NumberFormat$FormattedNumber(integerString, fractionString, exponentString);\n };\n NumberFormat.prototype.toSiFormat_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = -1;\n var tmp$, tmp$_0;\n if (numberInfo.exponent == null) {\n tmp$ = this.toExponential_0(numberInfo, precision - 1 | 0);\n } else {\n tmp$ = numberInfo;\n }\n var expNumberInfo = tmp$;\n var exponent = (tmp$_0 = expNumberInfo.exponent) != null ? tmp$_0 : 0;\n var x = exponent / 3.0;\n var suffixExp = numberToInt(coerceAtMost(coerceAtLeast_0(JsMath.floor(x), -8.0), 8.0)) * 3 | 0;\n var tmp$_1 = NumberFormat$NumberInfo$Companion_getInstance();\n var tmp$_2 = numberInfo.number;\n var n = -suffixExp | 0;\n var newNumberInfo = tmp$_1.createNumberInfo_yjmjg9$(tmp$_2 * JsMath.pow(10.0, n));\n var suffixIndex = 8 + (suffixExp / 3 | 0) | 0;\n var exponentString = NumberFormat$Companion_getInstance().SI_SUFFIXES_0[suffixIndex];\n var formattedNumber = this.toFixedFormat_0(newNumberInfo, precision - newNumberInfo.integerLength | 0);\n return formattedNumber.copy_6hosri$(void 0, void 0, exponentString);\n };\n NumberFormat.prototype.roundToPrecision_0 = function (numberInfo, precision) {\n if (precision === void 0)\n precision = 0;\n var tmp$, tmp$_0, tmp$_1;\n var exp = (tmp$ = numberInfo.exponent) != null ? tmp$ : 0;\n var totalPrecision = precision + exp | 0;\n var fractionalPart;\n var integerPart;\n if (totalPrecision < 0) {\n fractionalPart = L0;\n var intShift = abs(totalPrecision);\n if (numberInfo.integerLength <= intShift) {\n tmp$_0 = L0;\n } else {\n tmp$_0 = numberInfo.integerPart.div(Kotlin.Long.fromNumber(JsMath.pow(10.0, intShift))).multiply(Kotlin.Long.fromNumber(JsMath.pow(10.0, intShift)));\n }\n integerPart = tmp$_0;\n } else {\n var precisionExp = NumberFormat$NumberInfo$Companion_getInstance().MAX_DECIMAL_VALUE_8be2vx$.div(Kotlin.Long.fromNumber(JsMath.pow(10.0, totalPrecision)));\n if (equals(precisionExp, L0)) {\n tmp$_1 = numberInfo.fractionalPart;\n } else {\n tmp$_1 = roundToLong(numberInfo.fractionalPart.toNumber() / precisionExp.toNumber()).multiply(precisionExp);\n }\n fractionalPart = tmp$_1;\n integerPart = numberInfo.integerPart;\n if (equals(fractionalPart, NumberFormat$NumberInfo$Companion_getInstance().MAX_DECIMAL_VALUE_8be2vx$)) {\n fractionalPart = L0;\n integerPart = integerPart.inc();\n }}\n var num = integerPart.toNumber() + fractionalPart.toNumber() / NumberFormat$NumberInfo$Companion_getInstance().MAX_DECIMAL_VALUE_8be2vx$.toNumber();\n return numberInfo.copy_xz9h4k$(num, void 0, integerPart, fractionalPart);\n };\n NumberFormat.prototype.trimFraction_0 = function (output) {\n var tmp$ = !this.spec_0.trim;\n if (!tmp$) {\n tmp$ = output.body.fractionalPart.length === 0;\n }if (tmp$) {\n return output;\n }var trimmedFraction = trimEnd(output.body.fractionalPart, Kotlin.charArrayOf(48));\n return output.copy_rm1j3u$(output.body.copy_6hosri$(void 0, trimmedFraction));\n };\n NumberFormat.prototype.computeSign_0 = function (output, numberInfo) {\n var tmp$;\n var $receiver = output.body;\n var $receiver_0 = plus_1(asSequence_0($receiver.integerPart), asSequence_0($receiver.fractionalPart));\n var all$result;\n all$break: do {\n var tmp$_0;\n tmp$_0 = $receiver_0.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (!(unboxChar(element) === 48)) {\n all$result = false;\n break all$break;\n }}\n all$result = true;\n }\n while (false);\n var isBodyZero = all$result;\n var isNegative = numberInfo.negative && !isBodyZero;\n if (isNegative) {\n tmp$ = '-';\n } else {\n tmp$ = !equals(this.spec_0.sign, '-') ? this.spec_0.sign : '';\n }\n var signStr = tmp$;\n return output.copy_rm1j3u$(void 0, signStr);\n };\n NumberFormat.prototype.computePrefix_0 = function (output) {\n var tmp$;\n switch (this.spec_0.symbol) {\n case '$':\n tmp$ = NumberFormat$Companion_getInstance().CURRENCY_0;\n break;\n case '#':\n tmp$ = indexOf('boxX', this.spec_0.type) > -1 ? '0' + this.spec_0.type.toLowerCase() : '';\n break;\n default:tmp$ = '';\n break;\n }\n var prefix = tmp$;\n return output.copy_rm1j3u$(void 0, void 0, prefix);\n };\n NumberFormat.prototype.computeSuffix_0 = function (res) {\n var tmp$ = void 0;\n var tmp$_0 = void 0;\n var tmp$_1 = void 0;\n var $receiver = NumberFormat$Companion_getInstance().PERCENT_0;\n var $receiver_0 = equals(this.spec_0.type, '%') ? $receiver : null;\n return res.copy_rm1j3u$(tmp$, tmp$_0, tmp$_1, $receiver_0 != null ? $receiver_0 : '');\n };\n NumberFormat.prototype.computePadding_0 = function (output) {\n var length = output.sign.length + output.prefix.length + output.body.fullLength + output.suffix.length | 0;\n var padding = length < this.spec_0.width ? repeat(this.spec_0.fill, this.spec_0.width - length | 0) : '';\n return output.copy_rm1j3u$(void 0, void 0, void 0, void 0, padding);\n };\n function NumberFormat$Companion() {\n NumberFormat$Companion_instance = this;\n this.TYPE_E_MIN = 1.0E-323;\n this.TYPE_S_UPPER_LIMiT = 1.0E40;\n this.TYPE_S_MAX = 1.0E26;\n this.CURRENCY_0 = '$';\n this.PERCENT_0 = '%';\n this.COMMA_0 = ',';\n this.FRACTION_DELIMITER_0 = '.';\n this.FRACTION_DELIMITER_LENGTH_0 = 1;\n this.GROUP_SIZE_0 = 3;\n this.SI_SUFFIXES_0 = ['y', 'z', 'a', 'f', 'p', 'n', '\\xB5', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];\n this.NUMBER_REGEX_0 = Regex_init('^(?:([^{}])?([<>=^]))?([+ -])?([#$])?(0)?(\\\\d+)?(,)?(?:\\\\.(\\\\d+))?([%bcdefgosXx])?$');\n }\n NumberFormat$Companion.prototype.create_61zpoe$ = function (spec) {\n return this.create_xck536$(this.parse_0(spec));\n };\n NumberFormat$Companion.prototype.create_xck536$ = function (spec) {\n var precision = spec.precision;\n var type = spec.type;\n var trim = false;\n if (equals(type, '')) {\n if (precision === -1) {\n precision = 12;\n }type = 'g';\n }if (equals(type, 'g')) {\n trim = true;\n }var zero = spec.zero;\n var fill = spec.fill;\n var align = spec.align;\n if (zero || (equals(fill, '0') && equals(align, '='))) {\n zero = true;\n fill = '0';\n align = '=';\n }return spec.copy_xzdl1p$(fill, align, void 0, void 0, zero, void 0, void 0, precision, type, trim);\n };\n NumberFormat$Companion.prototype.isValidPattern_61zpoe$ = function (spec) {\n return this.NUMBER_REGEX_0.matches_6bul2c$(spec);\n };\n NumberFormat$Companion.prototype.parse_0 = function (spec) {\n var 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, tmp$_12, tmp$_13;\n tmp$ = this.NUMBER_REGEX_0.find_905azu$(spec);\n if (tmp$ == null) {\n throw IllegalArgumentException_init('Wrong pattern format');\n }var matchResult = tmp$;\n return new NumberFormat$Spec((tmp$_1 = (tmp$_0 = matchResult.groups.get_za3lpa$(1)) != null ? tmp$_0.value : null) != null ? tmp$_1 : ' ', (tmp$_3 = (tmp$_2 = matchResult.groups.get_za3lpa$(2)) != null ? tmp$_2.value : null) != null ? tmp$_3 : '>', (tmp$_5 = (tmp$_4 = matchResult.groups.get_za3lpa$(3)) != null ? tmp$_4.value : null) != null ? tmp$_5 : '-', (tmp$_7 = (tmp$_6 = matchResult.groups.get_za3lpa$(4)) != null ? tmp$_6.value : null) != null ? tmp$_7 : '', matchResult.groups.get_za3lpa$(5) != null, toInt((tmp$_9 = (tmp$_8 = matchResult.groups.get_za3lpa$(6)) != null ? tmp$_8.value : null) != null ? tmp$_9 : '-1'), matchResult.groups.get_za3lpa$(7) != null, toInt((tmp$_11 = (tmp$_10 = matchResult.groups.get_za3lpa$(8)) != null ? tmp$_10.value : null) != null ? tmp$_11 : '6'), (tmp$_13 = (tmp$_12 = matchResult.groups.get_za3lpa$(9)) != null ? tmp$_12.value : null) != null ? tmp$_13 : '');\n };\n function NumberFormat$Companion$group$lambda(it) {\n return joinToString(it, '');\n }\n NumberFormat$Companion.prototype.group_0 = function (str) {\n var tmp$;\n var $receiver = joinToString_0(map(chunked(asSequence_0(reversed_0(Kotlin.isCharSequence(tmp$ = str) ? tmp$ : throwCCE()).toString()), 3), NumberFormat$Companion$group$lambda), this.COMMA_0);\n var tmp$_0;\n return reversed_0(Kotlin.isCharSequence(tmp$_0 = $receiver) ? tmp$_0 : throwCCE()).toString();\n };\n NumberFormat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var NumberFormat$Companion_instance = null;\n function NumberFormat$Companion_getInstance() {\n if (NumberFormat$Companion_instance === null) {\n new NumberFormat$Companion();\n }return NumberFormat$Companion_instance;\n }\n NumberFormat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NumberFormat',\n interfaces: []\n };\n function NumberFormat_init(spec, $this) {\n $this = $this || Object.create(NumberFormat.prototype);\n NumberFormat.call($this, NumberFormat$Companion_getInstance().create_61zpoe$(spec));\n return $this;\n }\n function ChildList(myParent) {\n ObservableArrayList.call(this);\n this.myParent_2riath$_0 = myParent;\n this.addListener_n5no9j$(new ChildList_init$ObjectLiteral());\n }\n ChildList.prototype.checkAdd_wxm5ur$ = function (index, item) {\n ObservableArrayList.prototype.checkAdd_wxm5ur$.call(this, index, item);\n if (item.parentProperty().get() != null) {\n throw IllegalArgumentException_init_0();\n }};\n function ChildList$beforeItemAdded$ObjectLiteral(closure$item, this$ChildList) {\n this.closure$item = closure$item;\n this.this$ChildList = this$ChildList;\n }\n function ChildList$beforeItemAdded$ObjectLiteral$get$ObjectLiteral(this$ChildList, closure$index) {\n this.this$ChildList = this$ChildList;\n this.closure$index = closure$index;\n }\n Object.defineProperty(ChildList$beforeItemAdded$ObjectLiteral$get$ObjectLiteral.prototype, 'role', {\n configurable: true,\n get: function () {\n return this.this$ChildList;\n }\n });\n ChildList$beforeItemAdded$ObjectLiteral$get$ObjectLiteral.prototype.get = function () {\n return this.this$ChildList.size <= this.closure$index ? null : this.this$ChildList.get_za3lpa$(this.closure$index);\n };\n ChildList$beforeItemAdded$ObjectLiteral$get$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Position]\n };\n ChildList$beforeItemAdded$ObjectLiteral.prototype.get = function () {\n var index = this.this$ChildList.indexOf_11rb$(this.closure$item);\n return new ChildList$beforeItemAdded$ObjectLiteral$get$ObjectLiteral(this.this$ChildList, index);\n };\n ChildList$beforeItemAdded$ObjectLiteral.prototype.remove = function () {\n this.this$ChildList.remove_11rb$(this.closure$item);\n };\n ChildList$beforeItemAdded$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PositionData]\n };\n ChildList.prototype.beforeItemAdded_wxm5ur$ = function (index, item) {\n item.parentProperty().set_11rb$(this.myParent_2riath$_0);\n item.setPositionData_uvvaqs$(new ChildList$beforeItemAdded$ObjectLiteral(item, this));\n };\n ChildList.prototype.checkSet_hu11d4$ = function (index, oldItem, newItem) {\n ObservableArrayList.prototype.checkSet_hu11d4$.call(this, index, oldItem, newItem);\n this.checkRemove_wxm5ur$(index, oldItem);\n this.checkAdd_wxm5ur$(index, newItem);\n };\n ChildList.prototype.beforeItemSet_hu11d4$ = function (index, oldItem, newItem) {\n this.beforeItemAdded_wxm5ur$(index, newItem);\n };\n ChildList.prototype.checkRemove_wxm5ur$ = function (index, item) {\n ObservableArrayList.prototype.checkRemove_wxm5ur$.call(this, index, item);\n if (item.parentProperty().get() !== this.myParent_2riath$_0) {\n throw IllegalArgumentException_init_0();\n }};\n function ChildList_init$ObjectLiteral() {\n CollectionAdapter.call(this);\n }\n ChildList_init$ObjectLiteral.prototype.onItemAdded_u8tacu$ = function (event) {\n ensureNotNull(event.newItem).parentProperty().flush();\n };\n ChildList_init$ObjectLiteral.prototype.onItemRemoved_u8tacu$ = function (event) {\n var item = event.oldItem;\n ensureNotNull(item).parentProperty().set_11rb$(null);\n item.setPositionData_uvvaqs$(null);\n item.parentProperty().flush();\n };\n ChildList_init$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [CollectionAdapter]\n };\n ChildList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ChildList',\n interfaces: [ObservableArrayList]\n };\n function ChildProperty(myParent) {\n ValueProperty.call(this, null);\n this.myParent_0 = myParent;\n }\n function ChildProperty$set$ObjectLiteral(this$ChildProperty) {\n this.this$ChildProperty = this$ChildProperty;\n }\n function ChildProperty$set$ObjectLiteral$get$ObjectLiteral(this$ChildProperty) {\n this.this$ChildProperty = this$ChildProperty;\n }\n Object.defineProperty(ChildProperty$set$ObjectLiteral$get$ObjectLiteral.prototype, 'role', {\n configurable: true,\n get: function () {\n return this.this$ChildProperty;\n }\n });\n ChildProperty$set$ObjectLiteral$get$ObjectLiteral.prototype.get = function () {\n return this.this$ChildProperty.get();\n };\n ChildProperty$set$ObjectLiteral$get$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Position]\n };\n ChildProperty$set$ObjectLiteral.prototype.get = function () {\n return new ChildProperty$set$ObjectLiteral$get$ObjectLiteral(this.this$ChildProperty);\n };\n ChildProperty$set$ObjectLiteral.prototype.remove = function () {\n this.this$ChildProperty.set_11rb$(null);\n };\n ChildProperty$set$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PositionData]\n };\n ChildProperty.prototype.set_11rb$ = function (value) {\n var tmp$;\n if (this.get() === value)\n return;\n if (value != null && value.parentProperty().get() != null) {\n throw IllegalStateException_init_0();\n }var oldValue = this.get();\n if (oldValue != null) {\n oldValue.parentProperty().set_11rb$(null);\n oldValue.setPositionData_uvvaqs$(null);\n }if (value != null) {\n value.parentProperty().set_11rb$(this.myParent_0);\n value.setPositionData_uvvaqs$(new ChildProperty$set$ObjectLiteral(this));\n }ValueProperty.prototype.set_11rb$.call(this, value);\n if (oldValue != null) {\n oldValue.parentProperty().flush();\n }(tmp$ = value != null ? value.parentProperty() : null) != null ? (tmp$.flush(), Unit) : null;\n };\n ChildProperty.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ChildProperty',\n interfaces: [ValueProperty]\n };\n function Position() {\n }\n Position.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Position',\n interfaces: []\n };\n function PositionData() {\n }\n PositionData.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PositionData',\n interfaces: []\n };\n function SimpleComposite() {\n this.myParent_eaa9sw$_0 = new DelayedValueProperty();\n this.myPositionData_2io8uh$_0 = null;\n }\n Object.defineProperty(SimpleComposite.prototype, 'position', {\n configurable: true,\n get: function () {\n if (this.myPositionData_2io8uh$_0 == null) {\n throw IllegalStateException_init_0();\n }return ensureNotNull(this.myPositionData_2io8uh$_0).get();\n }\n });\n SimpleComposite.prototype.removeFromParent = function () {\n if (this.myPositionData_2io8uh$_0 == null)\n return;\n ensureNotNull(this.myPositionData_2io8uh$_0).remove();\n };\n SimpleComposite.prototype.parentProperty = function () {\n return this.myParent_eaa9sw$_0;\n };\n SimpleComposite.prototype.setPositionData_uvvaqs$ = function (positionData) {\n this.myPositionData_2io8uh$_0 = positionData;\n };\n SimpleComposite.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SimpleComposite',\n interfaces: []\n };\n function CollectionAdapter() {\n }\n CollectionAdapter.prototype.onItemAdded_u8tacu$ = function (event) {\n };\n CollectionAdapter.prototype.onItemSet_u8tacu$ = function (event) {\n this.onItemRemoved_u8tacu$(new CollectionItemEvent(event.oldItem, null, event.index, CollectionItemEvent$EventType$REMOVE_getInstance()));\n this.onItemAdded_u8tacu$(new CollectionItemEvent(null, event.newItem, event.index, CollectionItemEvent$EventType$ADD_getInstance()));\n };\n CollectionAdapter.prototype.onItemRemoved_u8tacu$ = function (event) {\n };\n CollectionAdapter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CollectionAdapter',\n interfaces: [CollectionListener]\n };\n function CollectionItemEvent(oldItem, newItem, index, type) {\n this.oldItem = oldItem;\n this.newItem = newItem;\n this.index = index;\n this.type = type;\n if (CollectionItemEvent$EventType$ADD_getInstance() === this.type && this.oldItem != null || (CollectionItemEvent$EventType$REMOVE_getInstance() === this.type && this.newItem != null)) {\n throw IllegalStateException_init_0();\n }}\n CollectionItemEvent.prototype.dispatch_11rb$ = function (l) {\n if (CollectionItemEvent$EventType$ADD_getInstance() === this.type) {\n l.onItemAdded_u8tacu$(this);\n } else if (CollectionItemEvent$EventType$SET_getInstance() === this.type) {\n l.onItemSet_u8tacu$(this);\n } else {\n l.onItemRemoved_u8tacu$(this);\n }\n };\n CollectionItemEvent.prototype.toString = function () {\n var tmp$;\n if (CollectionItemEvent$EventType$ADD_getInstance() === this.type) {\n tmp$ = toString(this.newItem) + ' added at ' + toString(this.index);\n } else if (CollectionItemEvent$EventType$SET_getInstance() === this.type) {\n tmp$ = toString(this.oldItem) + ' replaced with ' + toString(this.newItem) + ' at ' + toString(this.index);\n } else {\n tmp$ = toString(this.oldItem) + ' removed at ' + toString(this.index);\n }\n return tmp$;\n };\n CollectionItemEvent.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, CollectionItemEvent) ? tmp$_0 : throwCCE();\n if (!equals(this.oldItem, other.oldItem))\n return false;\n if (!equals(this.newItem, other.newItem))\n return false;\n if (this.index !== other.index)\n return false;\n if (this.type !== other.type)\n return false;\n return true;\n };\n CollectionItemEvent.prototype.hashCode = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var result = (tmp$_0 = (tmp$ = this.oldItem) != null ? hashCode(tmp$) : null) != null ? tmp$_0 : 0;\n result = (31 * result | 0) + ((tmp$_2 = (tmp$_1 = this.newItem) != null ? hashCode(tmp$_1) : null) != null ? tmp$_2 : 0) | 0;\n result = (31 * result | 0) + this.index | 0;\n result = (31 * result | 0) + this.type.hashCode() | 0;\n return result;\n };\n function CollectionItemEvent$EventType(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function CollectionItemEvent$EventType_initFields() {\n CollectionItemEvent$EventType_initFields = function () {\n };\n CollectionItemEvent$EventType$ADD_instance = new CollectionItemEvent$EventType('ADD', 0);\n CollectionItemEvent$EventType$SET_instance = new CollectionItemEvent$EventType('SET', 1);\n CollectionItemEvent$EventType$REMOVE_instance = new CollectionItemEvent$EventType('REMOVE', 2);\n }\n var CollectionItemEvent$EventType$ADD_instance;\n function CollectionItemEvent$EventType$ADD_getInstance() {\n CollectionItemEvent$EventType_initFields();\n return CollectionItemEvent$EventType$ADD_instance;\n }\n var CollectionItemEvent$EventType$SET_instance;\n function CollectionItemEvent$EventType$SET_getInstance() {\n CollectionItemEvent$EventType_initFields();\n return CollectionItemEvent$EventType$SET_instance;\n }\n var CollectionItemEvent$EventType$REMOVE_instance;\n function CollectionItemEvent$EventType$REMOVE_getInstance() {\n CollectionItemEvent$EventType_initFields();\n return CollectionItemEvent$EventType$REMOVE_instance;\n }\n CollectionItemEvent$EventType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'EventType',\n interfaces: [Enum]\n };\n function CollectionItemEvent$EventType$values() {\n return [CollectionItemEvent$EventType$ADD_getInstance(), CollectionItemEvent$EventType$SET_getInstance(), CollectionItemEvent$EventType$REMOVE_getInstance()];\n }\n CollectionItemEvent$EventType.values = CollectionItemEvent$EventType$values;\n function CollectionItemEvent$EventType$valueOf(name) {\n switch (name) {\n case 'ADD':\n return CollectionItemEvent$EventType$ADD_getInstance();\n case 'SET':\n return CollectionItemEvent$EventType$SET_getInstance();\n case 'REMOVE':\n return CollectionItemEvent$EventType$REMOVE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.observable.collections.CollectionItemEvent.EventType.' + name);\n }\n }\n CollectionItemEvent$EventType.valueOf_61zpoe$ = CollectionItemEvent$EventType$valueOf;\n CollectionItemEvent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CollectionItemEvent',\n interfaces: [ListenerEvent]\n };\n function CollectionListener() {\n }\n CollectionListener.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'CollectionListener',\n interfaces: []\n };\n function ObservableCollection() {\n }\n ObservableCollection.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ObservableCollection',\n interfaces: [EventSource, MutableCollection]\n };\n function AbstractObservableList() {\n AbstractMutableList.call(this);\n this.myListeners_ky8jhb$_0 = null;\n }\n AbstractObservableList.prototype.checkAdd_wxm5ur$ = function (index, item) {\n if (index < 0 || index > this.size) {\n throw new IndexOutOfBoundsException('Add: index=' + index + ', size=' + this.size);\n }};\n AbstractObservableList.prototype.checkSet_hu11d4$ = function (index, oldItem, newItem) {\n if (index < 0 || index >= this.size) {\n throw new IndexOutOfBoundsException('Set: index=' + index + ', size=' + this.size);\n }};\n AbstractObservableList.prototype.checkRemove_wxm5ur$ = function (index, item) {\n if (index < 0 || index >= this.size) {\n throw new IndexOutOfBoundsException('Remove: index=' + index + ', size=' + this.size);\n }};\n function AbstractObservableList$add$ObjectLiteral(closure$event) {\n this.closure$event = closure$event;\n }\n AbstractObservableList$add$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onItemAdded_u8tacu$(this.closure$event);\n };\n AbstractObservableList$add$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n AbstractObservableList.prototype.add_wxm5ur$ = function (index, element) {\n this.checkAdd_wxm5ur$(index, element);\n this.beforeItemAdded_wxm5ur$(index, element);\n var success = false;\n try {\n this.doAdd_wxm5ur$(index, element);\n success = true;\n this.onItemAdd_wxm5ur$(index, element);\n if (this.myListeners_ky8jhb$_0 != null) {\n var event = new CollectionItemEvent(null, element, index, CollectionItemEvent$EventType$ADD_getInstance());\n ensureNotNull(this.myListeners_ky8jhb$_0).fire_kucmxw$(new AbstractObservableList$add$ObjectLiteral(event));\n }}finally {\n this.afterItemAdded_5x52oa$(index, element, success);\n }\n };\n AbstractObservableList.prototype.beforeItemAdded_wxm5ur$ = function (index, item) {\n };\n AbstractObservableList.prototype.onItemAdd_wxm5ur$ = function (index, item) {\n };\n AbstractObservableList.prototype.afterItemAdded_5x52oa$ = function (index, item, success) {\n };\n function AbstractObservableList$set$ObjectLiteral(closure$event) {\n this.closure$event = closure$event;\n }\n AbstractObservableList$set$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onItemSet_u8tacu$(this.closure$event);\n };\n AbstractObservableList$set$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n AbstractObservableList.prototype.set_wxm5ur$ = function (index, element) {\n var old = this.get_za3lpa$(index);\n this.checkSet_hu11d4$(index, old, element);\n this.beforeItemSet_hu11d4$(index, old, element);\n var success = false;\n try {\n this.doSet_wxm5ur$(index, element);\n success = true;\n this.onItemSet_hu11d4$(index, old, element);\n if (this.myListeners_ky8jhb$_0 != null) {\n var event = new CollectionItemEvent(old, element, index, CollectionItemEvent$EventType$SET_getInstance());\n ensureNotNull(this.myListeners_ky8jhb$_0).fire_kucmxw$(new AbstractObservableList$set$ObjectLiteral(event));\n }}finally {\n this.afterItemSet_yk9x8x$(index, old, element, success);\n }\n return old;\n };\n AbstractObservableList.prototype.doSet_wxm5ur$ = function (index, item) {\n this.doRemove_za3lpa$(index);\n this.doAdd_wxm5ur$(index, item);\n };\n AbstractObservableList.prototype.beforeItemSet_hu11d4$ = function (index, oldItem, newItem) {\n };\n AbstractObservableList.prototype.onItemSet_hu11d4$ = function (index, oldItem, newItem) {\n };\n AbstractObservableList.prototype.afterItemSet_yk9x8x$ = function (index, oldItem, newItem, success) {\n };\n function AbstractObservableList$removeAt$ObjectLiteral(closure$event) {\n this.closure$event = closure$event;\n }\n AbstractObservableList$removeAt$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onItemRemoved_u8tacu$(this.closure$event);\n };\n AbstractObservableList$removeAt$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n AbstractObservableList.prototype.removeAt_za3lpa$ = function (index) {\n var item = this.get_za3lpa$(index);\n this.checkRemove_wxm5ur$(index, item);\n this.beforeItemRemoved_wxm5ur$(index, item);\n var success = false;\n try {\n this.doRemove_za3lpa$(index);\n success = true;\n this.onItemRemove_wxm5ur$(index, item);\n if (this.myListeners_ky8jhb$_0 != null) {\n var event = new CollectionItemEvent(item, null, index, CollectionItemEvent$EventType$REMOVE_getInstance());\n ensureNotNull(this.myListeners_ky8jhb$_0).fire_kucmxw$(new AbstractObservableList$removeAt$ObjectLiteral(event));\n }}finally {\n this.afterItemRemoved_5x52oa$(index, item, success);\n }\n return item;\n };\n AbstractObservableList.prototype.beforeItemRemoved_wxm5ur$ = function (index, item) {\n };\n AbstractObservableList.prototype.onItemRemove_wxm5ur$ = function (index, item) {\n };\n AbstractObservableList.prototype.afterItemRemoved_5x52oa$ = function (index, item, success) {\n };\n function AbstractObservableList$addListener$ObjectLiteral(this$AbstractObservableList) {\n this.this$AbstractObservableList = this$AbstractObservableList;\n Listeners.call(this);\n }\n AbstractObservableList$addListener$ObjectLiteral.prototype.beforeFirstAdded = function () {\n this.this$AbstractObservableList.onListenersAdded();\n };\n AbstractObservableList$addListener$ObjectLiteral.prototype.afterLastRemoved = function () {\n this.this$AbstractObservableList.myListeners_ky8jhb$_0 = null;\n this.this$AbstractObservableList.onListenersRemoved();\n };\n AbstractObservableList$addListener$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Listeners]\n };\n AbstractObservableList.prototype.addListener_n5no9j$ = function (l) {\n if (this.myListeners_ky8jhb$_0 == null) {\n this.myListeners_ky8jhb$_0 = new AbstractObservableList$addListener$ObjectLiteral(this);\n }return ensureNotNull(this.myListeners_ky8jhb$_0).add_11rb$(l);\n };\n function AbstractObservableList$addHandler$ObjectLiteral(closure$handler) {\n this.closure$handler = closure$handler;\n }\n AbstractObservableList$addHandler$ObjectLiteral.prototype.onItemAdded_u8tacu$ = function (event) {\n this.closure$handler.onEvent_11rb$(event);\n };\n AbstractObservableList$addHandler$ObjectLiteral.prototype.onItemSet_u8tacu$ = function (event) {\n this.closure$handler.onEvent_11rb$(event);\n };\n AbstractObservableList$addHandler$ObjectLiteral.prototype.onItemRemoved_u8tacu$ = function (event) {\n this.closure$handler.onEvent_11rb$(event);\n };\n AbstractObservableList$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [CollectionListener]\n };\n AbstractObservableList.prototype.addHandler_gxwwpc$ = function (handler) {\n var listener = new AbstractObservableList$addHandler$ObjectLiteral(handler);\n return this.addListener_n5no9j$(listener);\n };\n AbstractObservableList.prototype.onListenersAdded = function () {\n };\n AbstractObservableList.prototype.onListenersRemoved = function () {\n };\n AbstractObservableList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractObservableList',\n interfaces: [ObservableList, AbstractMutableList]\n };\n function ObservableArrayList() {\n AbstractObservableList.call(this);\n this.myContainer_2lyzpq$_0 = null;\n }\n Object.defineProperty(ObservableArrayList.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.myContainer_2lyzpq$_0 == null ? 0 : ensureNotNull(this.myContainer_2lyzpq$_0).size;\n }\n });\n ObservableArrayList.prototype.get_za3lpa$ = function (index) {\n if (this.myContainer_2lyzpq$_0 == null) {\n throw new IndexOutOfBoundsException(index.toString());\n }return ensureNotNull(this.myContainer_2lyzpq$_0).get_za3lpa$(index);\n };\n ObservableArrayList.prototype.doAdd_wxm5ur$ = function (index, item) {\n this.ensureContainerInitialized_mjxwec$_0();\n ensureNotNull(this.myContainer_2lyzpq$_0).add_wxm5ur$(index, item);\n };\n ObservableArrayList.prototype.doSet_wxm5ur$ = function (index, item) {\n ensureNotNull(this.myContainer_2lyzpq$_0).set_wxm5ur$(index, item);\n };\n ObservableArrayList.prototype.doRemove_za3lpa$ = function (index) {\n ensureNotNull(this.myContainer_2lyzpq$_0).removeAt_za3lpa$(index);\n if (ensureNotNull(this.myContainer_2lyzpq$_0).isEmpty()) {\n this.myContainer_2lyzpq$_0 = null;\n }};\n ObservableArrayList.prototype.ensureContainerInitialized_mjxwec$_0 = function () {\n if (this.myContainer_2lyzpq$_0 == null) {\n this.myContainer_2lyzpq$_0 = ArrayList_init_0(1);\n }};\n ObservableArrayList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ObservableArrayList',\n interfaces: [AbstractObservableList]\n };\n function ObservableList() {\n }\n ObservableList.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ObservableList',\n interfaces: [ObservableCollection, MutableList]\n };\n function CompositeEventSource() {\n this.myHandlers_0 = null;\n this.myEventSources_0 = ArrayList_init();\n this.myRegistrations_0 = ArrayList_init();\n }\n CompositeEventSource.prototype.add_5zt0a2$ = function (source) {\n this.myEventSources_0.add_11rb$(source);\n };\n CompositeEventSource.prototype.remove_r5wlyb$ = function (source) {\n var $receiver = this.myEventSources_0;\n var tmp$;\n (Kotlin.isType(tmp$ = $receiver, MutableCollection) ? tmp$ : throwCCE()).remove_11rb$(source);\n };\n function CompositeEventSource$addHandler$ObjectLiteral(this$CompositeEventSource) {\n this.this$CompositeEventSource = this$CompositeEventSource;\n Listeners.call(this);\n }\n CompositeEventSource$addHandler$ObjectLiteral.prototype.beforeFirstAdded = function () {\n var tmp$;\n tmp$ = this.this$CompositeEventSource.myEventSources_0.iterator();\n while (tmp$.hasNext()) {\n var src = tmp$.next();\n this.this$CompositeEventSource.addHandlerTo_0(src);\n }\n };\n CompositeEventSource$addHandler$ObjectLiteral.prototype.afterLastRemoved = function () {\n var tmp$;\n tmp$ = this.this$CompositeEventSource.myRegistrations_0.iterator();\n while (tmp$.hasNext()) {\n var hr = tmp$.next();\n hr.remove();\n }\n this.this$CompositeEventSource.myRegistrations_0.clear();\n this.this$CompositeEventSource.myHandlers_0 = null;\n };\n CompositeEventSource$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Listeners]\n };\n CompositeEventSource.prototype.addHandler_gxwwpc$ = function (handler) {\n if (this.myHandlers_0 == null) {\n this.myHandlers_0 = new CompositeEventSource$addHandler$ObjectLiteral(this);\n }return ensureNotNull(this.myHandlers_0).add_11rb$(handler);\n };\n function CompositeEventSource$addHandlerTo$ObjectLiteral(this$CompositeEventSource) {\n this.this$CompositeEventSource = this$CompositeEventSource;\n }\n function CompositeEventSource$addHandlerTo$ObjectLiteral$onEvent$ObjectLiteral(closure$event) {\n this.closure$event = closure$event;\n }\n CompositeEventSource$addHandlerTo$ObjectLiteral$onEvent$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onEvent_11rb$(this.closure$event);\n };\n CompositeEventSource$addHandlerTo$ObjectLiteral$onEvent$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n CompositeEventSource$addHandlerTo$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n ensureNotNull(this.this$CompositeEventSource.myHandlers_0).fire_kucmxw$(new CompositeEventSource$addHandlerTo$ObjectLiteral$onEvent$ObjectLiteral(event));\n };\n CompositeEventSource$addHandlerTo$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n CompositeEventSource.prototype.addHandlerTo_0 = function (src) {\n this.myRegistrations_0.add_11rb$(src.addHandler_gxwwpc$(new CompositeEventSource$addHandlerTo$ObjectLiteral(this)));\n };\n CompositeEventSource.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CompositeEventSource',\n interfaces: [EventSource]\n };\n function CompositeEventSource_init(sources, $this) {\n $this = $this || Object.create(CompositeEventSource.prototype);\n CompositeEventSource.call($this);\n var tmp$;\n for (tmp$ = 0; tmp$ !== sources.length; ++tmp$) {\n var s = sources[tmp$];\n $this.add_5zt0a2$(s);\n }\n return $this;\n }\n function CompositeEventSource_init_0(sources, $this) {\n $this = $this || Object.create(CompositeEventSource.prototype);\n CompositeEventSource.call($this);\n var tmp$;\n tmp$ = sources.iterator();\n while (tmp$.hasNext()) {\n var s = tmp$.next();\n $this.add_5zt0a2$(s);\n }\n return $this;\n }\n function EventHandler() {\n }\n EventHandler.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'EventHandler',\n interfaces: []\n };\n function EventSource() {\n }\n EventSource.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'EventSource',\n interfaces: []\n };\n function EventSources() {\n EventSources_instance = this;\n }\n function EventSources$of$ObjectLiteral(closure$events) {\n this.closure$events = closure$events;\n }\n EventSources$of$ObjectLiteral.prototype.addHandler_gxwwpc$ = function (handler) {\n var tmp$, tmp$_0;\n tmp$ = this.closure$events;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var e = tmp$[tmp$_0];\n handler.onEvent_11rb$(e);\n }\n return Registration$Companion_getInstance().EMPTY;\n };\n EventSources$of$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventSource]\n };\n EventSources.prototype.of_i5x0yv$ = function (events) {\n return new EventSources$of$ObjectLiteral(events);\n };\n EventSources.prototype.empty_287e2$ = function () {\n return this.composite_xw2ruy$([]);\n };\n EventSources.prototype.composite_xw2ruy$ = function (sources) {\n return CompositeEventSource_init(sources.slice());\n };\n EventSources.prototype.composite_3qo2qg$ = function (sources) {\n return CompositeEventSource_init_0(sources);\n };\n function EventSources$filter$ObjectLiteral(closure$source, closure$pred) {\n this.closure$source = closure$source;\n this.closure$pred = closure$pred;\n }\n function EventSources$filter$ObjectLiteral$addHandler$ObjectLiteral(closure$pred, closure$handler) {\n this.closure$pred = closure$pred;\n this.closure$handler = closure$handler;\n }\n EventSources$filter$ObjectLiteral$addHandler$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n if (this.closure$pred(event)) {\n this.closure$handler.onEvent_11rb$(event);\n }};\n EventSources$filter$ObjectLiteral$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n EventSources$filter$ObjectLiteral.prototype.addHandler_gxwwpc$ = function (handler) {\n return this.closure$source.addHandler_gxwwpc$(new EventSources$filter$ObjectLiteral$addHandler$ObjectLiteral(this.closure$pred, handler));\n };\n EventSources$filter$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventSource]\n };\n EventSources.prototype.filter_ff3xdm$ = function (source, pred) {\n return new EventSources$filter$ObjectLiteral(source, pred);\n };\n EventSources.prototype.map_9hq6p$ = function (src, f) {\n return new MappingEventSource(src, f);\n };\n function EventSources$selectList$ObjectLiteral(closure$list, closure$selector) {\n this.closure$list = closure$list;\n this.closure$selector = closure$selector;\n }\n function EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral(closure$itemRegs, closure$selector, closure$handler) {\n this.closure$itemRegs = closure$itemRegs;\n this.closure$selector = closure$selector;\n this.closure$handler = closure$handler;\n CollectionAdapter.call(this);\n }\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral.prototype.onItemAdded_u8tacu$ = function (event) {\n this.closure$itemRegs.add_wxm5ur$(event.index, this.closure$selector(event.newItem).addHandler_gxwwpc$(this.closure$handler));\n };\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral.prototype.onItemRemoved_u8tacu$ = function (event) {\n this.closure$itemRegs.removeAt_za3lpa$(event.index).remove();\n };\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [CollectionAdapter]\n };\n function EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0(closure$itemRegs, closure$listReg) {\n this.closure$itemRegs = closure$itemRegs;\n this.closure$listReg = closure$listReg;\n Registration.call(this);\n }\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0.prototype.doRemove = function () {\n var tmp$;\n tmp$ = this.closure$itemRegs.iterator();\n while (tmp$.hasNext()) {\n var r = tmp$.next();\n r.remove();\n }\n this.closure$listReg.remove();\n };\n EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n EventSources$selectList$ObjectLiteral.prototype.addHandler_gxwwpc$ = function (handler) {\n var tmp$;\n var itemRegs = ArrayList_init();\n tmp$ = this.closure$list.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n itemRegs.add_11rb$(this.closure$selector(item).addHandler_gxwwpc$(handler));\n }\n var listReg = this.closure$list.addListener_n5no9j$(new EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral(itemRegs, this.closure$selector, handler));\n return new EventSources$selectList$ObjectLiteral$addHandler$ObjectLiteral_0(itemRegs, listReg);\n };\n EventSources$selectList$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventSource]\n };\n EventSources.prototype.selectList_jnjwvc$ = function (list, selector) {\n return new EventSources$selectList$ObjectLiteral(list, selector);\n };\n EventSources.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'EventSources',\n interfaces: []\n };\n var EventSources_instance = null;\n function EventSources_getInstance() {\n if (EventSources_instance === null) {\n new EventSources();\n }return EventSources_instance;\n }\n function ListenerCaller() {\n }\n ListenerCaller.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ListenerCaller',\n interfaces: []\n };\n function ListenerEvent() {\n }\n ListenerEvent.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ListenerEvent',\n interfaces: []\n };\n function Listeners() {\n this.myListeners_30lqoe$_0 = null;\n this.myFireDepth_t4vnc0$_0 = 0;\n this.myListenersCount_umrzvt$_0 = 0;\n }\n Object.defineProperty(Listeners.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myListeners_30lqoe$_0 == null || ensureNotNull(this.myListeners_30lqoe$_0).isEmpty();\n }\n });\n function Listeners$add$ObjectLiteral(this$Listeners, closure$l) {\n this.this$Listeners = this$Listeners;\n this.closure$l = closure$l;\n Registration.call(this);\n }\n Listeners$add$ObjectLiteral.prototype.doRemove = function () {\n var tmp$, tmp$_0;\n if (this.this$Listeners.myFireDepth_t4vnc0$_0 > 0) {\n ensureNotNull(this.this$Listeners.myListeners_30lqoe$_0).add_11rb$(new Listeners$ListenerOp(this.closure$l, false));\n } else {\n ensureNotNull(this.this$Listeners.myListeners_30lqoe$_0).remove_11rb$(Kotlin.isType(tmp$ = this.closure$l, Any) ? tmp$ : throwCCE());\n tmp$_0 = this.this$Listeners.myListenersCount_umrzvt$_0;\n this.this$Listeners.myListenersCount_umrzvt$_0 = tmp$_0 - 1 | 0;\n }\n if (this.this$Listeners.isEmpty) {\n this.this$Listeners.afterLastRemoved();\n }};\n Listeners$add$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n Listeners.prototype.add_11rb$ = function (l) {\n var tmp$;\n if (this.isEmpty) {\n this.beforeFirstAdded();\n }if (this.myFireDepth_t4vnc0$_0 > 0) {\n ensureNotNull(this.myListeners_30lqoe$_0).add_11rb$(new Listeners$ListenerOp(l, true));\n } else {\n if (this.myListeners_30lqoe$_0 == null) {\n this.myListeners_30lqoe$_0 = ArrayList_init_0(1);\n }ensureNotNull(this.myListeners_30lqoe$_0).add_11rb$(Kotlin.isType(tmp$ = l, Any) ? tmp$ : throwCCE());\n this.myListenersCount_umrzvt$_0 = this.myListenersCount_umrzvt$_0 + 1 | 0;\n }\n return new Listeners$add$ObjectLiteral(this, l);\n };\n Listeners.prototype.fire_kucmxw$ = function (h) {\n var tmp$;\n if (this.isEmpty)\n return;\n this.beforeFire_ul1jia$_0();\n try {\n var size = this.myListenersCount_umrzvt$_0;\n for (var i = 0; i < size; i++) {\n var l = (tmp$ = ensureNotNull(this.myListeners_30lqoe$_0).get_za3lpa$(i)) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n if (this.isRemoved_265rjw$_0(l))\n continue;\n try {\n h.call_11rb$(l);\n } catch (t) {\n if (Kotlin.isType(t, Throwable)) {\n ThrowableHandlers_getInstance().instance.handle_tcv7n7$(t);\n } else\n throw t;\n }\n }\n }finally {\n this.afterFire_xwa8xb$_0();\n }\n };\n Listeners.prototype.isRemoved_265rjw$_0 = function (l) {\n var tmp$;\n var size = ensureNotNull(this.myListeners_30lqoe$_0).size;\n for (var i = this.myListenersCount_umrzvt$_0; i < size; i++) {\n var op = Kotlin.isType(tmp$ = ensureNotNull(this.myListeners_30lqoe$_0).get_za3lpa$(i), Listeners$ListenerOp) ? tmp$ : throwCCE();\n if (!op.add && op.listener === l)\n return true;\n }\n return false;\n };\n Listeners.prototype.beforeFirstAdded = function () {\n };\n Listeners.prototype.afterLastRemoved = function () {\n };\n Listeners.prototype.beforeFire_ul1jia$_0 = function () {\n this.myFireDepth_t4vnc0$_0 = this.myFireDepth_t4vnc0$_0 + 1 | 0;\n };\n Listeners.prototype.afterFire_xwa8xb$_0 = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n this.myFireDepth_t4vnc0$_0 = this.myFireDepth_t4vnc0$_0 - 1 | 0;\n if (this.myFireDepth_t4vnc0$_0 === 0) {\n var opsList = ensureNotNull(this.myListeners_30lqoe$_0).subList_vux9f0$(this.myListenersCount_umrzvt$_0, ensureNotNull(this.myListeners_30lqoe$_0).size);\n var ops = copyToArray(opsList);\n opsList.clear();\n for (tmp$ = 0; tmp$ !== ops.length; ++tmp$) {\n var o = ops[tmp$];\n var op = Kotlin.isType(tmp$_0 = o, Listeners$ListenerOp) ? tmp$_0 : throwCCE();\n if (op.add) {\n ensureNotNull(this.myListeners_30lqoe$_0).add_11rb$(Kotlin.isType(tmp$_1 = op.listener, Any) ? tmp$_1 : throwCCE());\n this.myListenersCount_umrzvt$_0 = this.myListenersCount_umrzvt$_0 + 1 | 0;\n } else {\n ensureNotNull(this.myListeners_30lqoe$_0).remove_11rb$(Kotlin.isType(tmp$_2 = op.listener, Any) ? tmp$_2 : throwCCE());\n this.myListenersCount_umrzvt$_0 = this.myListenersCount_umrzvt$_0 - 1 | 0;\n }\n }\n if (this.isEmpty) {\n this.afterLastRemoved();\n }}};\n Listeners.prototype.size_8be2vx$ = function () {\n return this.myListeners_30lqoe$_0 == null ? 0 : ensureNotNull(this.myListeners_30lqoe$_0).size;\n };\n function Listeners$ListenerOp(listener, add) {\n this.listener = listener;\n this.add = add;\n }\n Listeners$ListenerOp.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ListenerOp',\n interfaces: []\n };\n Listeners.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Listeners',\n interfaces: []\n };\n function MappingEventSource(mySourceEventSource, myFunction) {\n this.mySourceEventSource_0 = mySourceEventSource;\n this.myFunction_0 = myFunction;\n }\n function MappingEventSource$addHandler$ObjectLiteral(closure$handler, this$MappingEventSource) {\n this.closure$handler = closure$handler;\n this.this$MappingEventSource = this$MappingEventSource;\n }\n MappingEventSource$addHandler$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n this.closure$handler.onEvent_11rb$(this.this$MappingEventSource.myFunction_0(event));\n };\n MappingEventSource$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n MappingEventSource.prototype.addHandler_gxwwpc$ = function (handler) {\n return this.mySourceEventSource_0.addHandler_gxwwpc$(new MappingEventSource$addHandler$ObjectLiteral(handler, this));\n };\n MappingEventSource.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MappingEventSource',\n interfaces: [EventSource]\n };\n function BaseReadableProperty() {\n this.propExpr_4jt19b$_0 = Kotlin.getKClassFromExpression(this).toString();\n }\n Object.defineProperty(BaseReadableProperty.prototype, 'propExpr', {\n configurable: true,\n get: function () {\n return this.propExpr_4jt19b$_0;\n }\n });\n BaseReadableProperty.prototype.toString = function () {\n return this.propExpr;\n };\n BaseReadableProperty.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BaseReadableProperty',\n interfaces: [ReadableProperty]\n };\n function DelayedValueProperty(myValue) {\n if (myValue === void 0)\n myValue = null;\n BaseReadableProperty.call(this);\n this.myValue_0 = myValue;\n this.myHandlers_0 = null;\n this.myPendingEvent_0 = null;\n }\n Object.defineProperty(DelayedValueProperty.prototype, 'propExpr', {\n configurable: true,\n get: function () {\n return 'delayedProperty()';\n }\n });\n DelayedValueProperty.prototype.get = function () {\n return this.myValue_0;\n };\n DelayedValueProperty.prototype.set_11rb$ = function (value) {\n if (equals(value, this.myValue_0))\n return;\n var oldValue = this.myValue_0;\n this.myValue_0 = value;\n if (this.myPendingEvent_0 != null) {\n throw IllegalStateException_init_0();\n }this.myPendingEvent_0 = new PropertyChangeEvent(oldValue, this.myValue_0);\n };\n function DelayedValueProperty$flush$ObjectLiteral(this$DelayedValueProperty) {\n this.this$DelayedValueProperty = this$DelayedValueProperty;\n }\n DelayedValueProperty$flush$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onEvent_11rb$(ensureNotNull(this.this$DelayedValueProperty.myPendingEvent_0));\n };\n DelayedValueProperty$flush$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n DelayedValueProperty.prototype.flush = function () {\n if (this.myHandlers_0 != null) {\n ensureNotNull(this.myHandlers_0).fire_kucmxw$(new DelayedValueProperty$flush$ObjectLiteral(this));\n }this.myPendingEvent_0 = null;\n };\n function DelayedValueProperty$addHandler$ObjectLiteral(this$DelayedValueProperty) {\n this.this$DelayedValueProperty = this$DelayedValueProperty;\n Listeners.call(this);\n }\n DelayedValueProperty$addHandler$ObjectLiteral.prototype.afterLastRemoved = function () {\n this.this$DelayedValueProperty.myHandlers_0 = null;\n };\n DelayedValueProperty$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Listeners]\n };\n DelayedValueProperty.prototype.addHandler_gxwwpc$ = function (handler) {\n if (this.myHandlers_0 == null) {\n this.myHandlers_0 = new DelayedValueProperty$addHandler$ObjectLiteral(this);\n }return ensureNotNull(this.myHandlers_0).add_11rb$(handler);\n };\n DelayedValueProperty.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DelayedValueProperty',\n interfaces: [Property, BaseReadableProperty]\n };\n function Property() {\n }\n Property.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Property',\n interfaces: [WritableProperty, ReadableProperty]\n };\n function PropertyBinding() {\n PropertyBinding_instance = this;\n }\n function PropertyBinding$bindOneWay$ObjectLiteral(closure$target) {\n this.closure$target = closure$target;\n }\n PropertyBinding$bindOneWay$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n var tmp$;\n this.closure$target.set_11rb$((tmp$ = event.newValue) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE());\n };\n PropertyBinding$bindOneWay$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n PropertyBinding.prototype.bindOneWay_2ov6i0$ = function (source, target) {\n target.set_11rb$(source.get());\n return source.addHandler_gxwwpc$(new PropertyBinding$bindOneWay$ObjectLiteral(target));\n };\n function PropertyBinding$bindTwoWay$UpdatingEventHandler(closure$syncing, closure$target, closure$source, myForward) {\n this.closure$syncing = closure$syncing;\n this.closure$target = closure$target;\n this.closure$source = closure$source;\n this.myForward_0 = myForward;\n }\n PropertyBinding$bindTwoWay$UpdatingEventHandler.prototype.onEvent_11rb$ = function (event) {\n if (this.closure$syncing.get())\n return;\n this.closure$syncing.set_11rb$(true);\n try {\n if (this.myForward_0) {\n this.closure$target.set_11rb$(this.closure$source.get());\n } else {\n this.closure$source.set_11rb$(this.closure$target.get());\n }\n }finally {\n this.closure$syncing.set_11rb$(false);\n }\n };\n PropertyBinding$bindTwoWay$UpdatingEventHandler.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'UpdatingEventHandler',\n interfaces: [EventHandler]\n };\n PropertyBinding.prototype.bindTwoWay_ejkotq$ = function (source, target) {\n var syncing = new ValueProperty(false);\n target.set_11rb$(source.get());\n return new CompositeRegistration([source.addHandler_gxwwpc$(new PropertyBinding$bindTwoWay$UpdatingEventHandler(syncing, target, source, true)), target.addHandler_gxwwpc$(new PropertyBinding$bindTwoWay$UpdatingEventHandler(syncing, target, source, false))]);\n };\n PropertyBinding.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PropertyBinding',\n interfaces: []\n };\n var PropertyBinding_instance = null;\n function PropertyBinding_getInstance() {\n if (PropertyBinding_instance === null) {\n new PropertyBinding();\n }return PropertyBinding_instance;\n }\n function PropertyChangeEvent(oldValue, newValue) {\n this.oldValue = oldValue;\n this.newValue = newValue;\n }\n PropertyChangeEvent.prototype.toString = function () {\n return toString(this.oldValue) + ' -> ' + toString(this.newValue);\n };\n PropertyChangeEvent.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, PropertyChangeEvent) ? tmp$_0 : throwCCE();\n if (!equals(this.oldValue, other.oldValue))\n return false;\n if (!equals(this.newValue, other.newValue))\n return false;\n return true;\n };\n PropertyChangeEvent.prototype.hashCode = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var result = (tmp$_0 = (tmp$ = this.oldValue) != null ? hashCode(tmp$) : null) != null ? tmp$_0 : 0;\n result = (31 * result | 0) + ((tmp$_2 = (tmp$_1 = this.newValue) != null ? hashCode(tmp$_1) : null) != null ? tmp$_2 : 0) | 0;\n return result;\n };\n PropertyChangeEvent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PropertyChangeEvent',\n interfaces: []\n };\n function ReadableProperty() {\n }\n ReadableProperty.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ReadableProperty',\n interfaces: [Supplier, EventSource]\n };\n function ValueProperty(myValue) {\n BaseReadableProperty.call(this);\n this.myValue_x0fqz2$_0 = myValue;\n this.myHandlers_sdxgfs$_0 = null;\n }\n Object.defineProperty(ValueProperty.prototype, 'propExpr', {\n configurable: true,\n get: function () {\n return 'valueProperty()';\n }\n });\n ValueProperty.prototype.get = function () {\n return this.myValue_x0fqz2$_0;\n };\n ValueProperty.prototype.set_11rb$ = function (value) {\n if (equals(value, this.myValue_x0fqz2$_0))\n return;\n var oldValue = this.myValue_x0fqz2$_0;\n this.myValue_x0fqz2$_0 = value;\n this.fireEvents_ym4swk$_0(oldValue, this.myValue_x0fqz2$_0);\n };\n function ValueProperty$fireEvents$ObjectLiteral(closure$event) {\n this.closure$event = closure$event;\n }\n ValueProperty$fireEvents$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onEvent_11rb$(this.closure$event);\n };\n ValueProperty$fireEvents$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n ValueProperty.prototype.fireEvents_ym4swk$_0 = function (oldValue, newValue) {\n if (this.myHandlers_sdxgfs$_0 != null) {\n var event = new PropertyChangeEvent(oldValue, newValue);\n ensureNotNull(this.myHandlers_sdxgfs$_0).fire_kucmxw$(new ValueProperty$fireEvents$ObjectLiteral(event));\n }};\n function ValueProperty$addHandler$ObjectLiteral(this$ValueProperty) {\n this.this$ValueProperty = this$ValueProperty;\n Listeners.call(this);\n }\n ValueProperty$addHandler$ObjectLiteral.prototype.afterLastRemoved = function () {\n this.this$ValueProperty.myHandlers_sdxgfs$_0 = null;\n };\n ValueProperty$addHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Listeners]\n };\n ValueProperty.prototype.addHandler_gxwwpc$ = function (handler) {\n if (this.myHandlers_sdxgfs$_0 == null) {\n this.myHandlers_sdxgfs$_0 = new ValueProperty$addHandler$ObjectLiteral(this);\n }return ensureNotNull(this.myHandlers_sdxgfs$_0).add_11rb$(handler);\n };\n ValueProperty.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ValueProperty',\n interfaces: [Property, BaseReadableProperty]\n };\n function WritableProperty() {\n }\n WritableProperty.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'WritableProperty',\n interfaces: []\n };\n function RandomGaussian(random) {\n this.random = random;\n this.nextNextGaussian_0 = 0.0;\n this.haveNextNextGaussian_0 = false;\n }\n RandomGaussian.prototype.nextGaussian = function () {\n if (this.haveNextNextGaussian_0) {\n this.haveNextNextGaussian_0 = false;\n return this.nextNextGaussian_0;\n } else {\n var v1;\n var v2;\n var s;\n do {\n v1 = 2 * this.random.nextDouble() - 1;\n v2 = 2 * this.random.nextDouble() - 1;\n s = v1 * v1 + v2 * v2;\n }\n while (s >= 1 || s === 0.0);\n var x = s;\n var x_0 = -2 * JsMath.log(x) / s;\n var multiplier = JsMath.sqrt(x_0);\n this.nextNextGaussian_0 = v2 * multiplier;\n this.haveNextNextGaussian_0 = true;\n return v1 * multiplier;\n }\n };\n RandomGaussian.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RandomGaussian',\n interfaces: []\n };\n function RandomString() {\n RandomString_instance = this;\n }\n RandomString.prototype.randomString_za3lpa$ = function (len) {\n var alphabet = plus_2(plus_0(new CharRange(97, 122), new CharRange(65, 90)), new CharRange(48, 57));\n var list = ArrayList_init_0(len);\n for (var index = 0; index < len; index++) {\n list.add_11rb$(random(alphabet, Random.Default));\n }\n return joinToString(list, '');\n };\n RandomString.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'RandomString',\n interfaces: []\n };\n var RandomString_instance = null;\n function RandomString_getInstance() {\n if (RandomString_instance === null) {\n new RandomString();\n }return RandomString_instance;\n }\n function CompositeRegistration(regs) {\n Registration.call(this);\n this.myRegistrations_0 = null;\n this.myRegistrations_0 = arrayListOf(regs.slice());\n }\n Object.defineProperty(CompositeRegistration.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myRegistrations_0.isEmpty();\n }\n });\n CompositeRegistration.prototype.add_3xv6fb$ = function (r) {\n this.myRegistrations_0.add_11rb$(r);\n return this;\n };\n CompositeRegistration.prototype.add_4wx45g$ = function (rs) {\n var tmp$;\n for (tmp$ = 0; tmp$ !== rs.length; ++tmp$) {\n var r = rs[tmp$];\n this.add_3xv6fb$(r);\n }\n return this;\n };\n CompositeRegistration.prototype.doRemove = function () {\n for (var i = this.myRegistrations_0.size - 1 | 0; i >= 0; i--) {\n this.myRegistrations_0.get_za3lpa$(i).remove();\n }\n this.myRegistrations_0.clear();\n };\n CompositeRegistration.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CompositeRegistration',\n interfaces: [Registration]\n };\n function Disposable() {\n }\n Disposable.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Disposable',\n interfaces: []\n };\n function Registration() {\n Registration$Companion_getInstance();\n this.myRemoved_guv51v$_0 = false;\n }\n Registration.prototype.remove = function () {\n if (this.myRemoved_guv51v$_0) {\n throw IllegalStateException_init('Registration already removed');\n }this.myRemoved_guv51v$_0 = true;\n this.doRemove();\n };\n Registration.prototype.dispose = function () {\n this.remove();\n };\n function Registration$EmptyRegistration() {\n Registration.call(this);\n }\n Registration$EmptyRegistration.prototype.doRemove = function () {\n };\n Registration$EmptyRegistration.prototype.remove = function () {\n };\n Registration$EmptyRegistration.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'EmptyRegistration',\n interfaces: [Registration]\n };\n function Registration$Companion() {\n Registration$Companion_instance = this;\n this.EMPTY = new Registration$EmptyRegistration();\n }\n function Registration$Companion$from$ObjectLiteral(closure$disposable) {\n this.closure$disposable = closure$disposable;\n Registration.call(this);\n }\n Registration$Companion$from$ObjectLiteral.prototype.doRemove = function () {\n this.closure$disposable.dispose();\n };\n Registration$Companion$from$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n Registration$Companion.prototype.from_gg3y3y$ = function (disposable) {\n return new Registration$Companion$from$ObjectLiteral(disposable);\n };\n function Registration$Companion$from$ObjectLiteral_0(closure$disposables) {\n this.closure$disposables = closure$disposables;\n Registration.call(this);\n }\n Registration$Companion$from$ObjectLiteral_0.prototype.doRemove = function () {\n var tmp$, tmp$_0;\n tmp$ = this.closure$disposables;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var d = tmp$[tmp$_0];\n d.dispose();\n }\n };\n Registration$Companion$from$ObjectLiteral_0.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n Registration$Companion.prototype.from_h9hjd7$ = function (disposables) {\n return new Registration$Companion$from$ObjectLiteral_0(disposables);\n };\n Registration$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Registration$Companion_instance = null;\n function Registration$Companion_getInstance() {\n if (Registration$Companion_instance === null) {\n new Registration$Companion();\n }return Registration$Companion_instance;\n }\n Registration.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Registration',\n interfaces: [Disposable]\n };\n function ThrowableHandler() {\n }\n ThrowableHandler.prototype.handle_tcv7n7$ = function (t) {\n throw t;\n };\n ThrowableHandler.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ThrowableHandler',\n interfaces: []\n };\n function ThrowableHandlers() {\n ThrowableHandlers_instance = this;\n this.instance = new ThrowableHandler();\n }\n ThrowableHandlers.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ThrowableHandlers',\n interfaces: []\n };\n var ThrowableHandlers_instance = null;\n function ThrowableHandlers_getInstance() {\n if (ThrowableHandlers_instance === null) {\n new ThrowableHandlers();\n }return ThrowableHandlers_instance;\n }\n var EARTH_RADIUS;\n var MIN_LONGITUDE;\n var MAX_LONGITUDE;\n var FULL_LONGITUDE;\n var MIN_LATITUDE;\n var MAX_LATITUDE;\n var FULL_LATITUDE;\n var compareBy$lambda = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function get_start($receiver) {\n return $receiver.first;\n }\n function get_end($receiver) {\n return $receiver.second;\n }\n function GeoBoundingBoxCalculator(myMapRect, myLoopX, myLoopY) {\n GeoBoundingBoxCalculator$Companion_getInstance();\n this.myMapRect_0 = myMapRect;\n this.myLoopX_0 = myLoopX;\n this.myLoopY_0 = myLoopY;\n }\n GeoBoundingBoxCalculator.prototype.calculateBoundingBox_qpfwx8$ = function (xSegments, ySegments) {\n var xRange_0 = this.calculateBoundingRange_0(xSegments, xRange(this.myMapRect_0), this.myLoopX_0);\n var yRange_0 = this.calculateBoundingRange_0(ySegments, yRange(this.myMapRect_0), this.myLoopY_0);\n return Rect_init(xRange_0.lowerEnd, yRange_0.lowerEnd, GeoBoundingBoxCalculator$Companion_getInstance().length_0(xRange_0), GeoBoundingBoxCalculator$Companion_getInstance().length_0(yRange_0));\n };\n GeoBoundingBoxCalculator.prototype.calculateBoundingRange_0 = function (segments, mapRange, loop) {\n var tmp$;\n if (loop) {\n tmp$ = GeoBoundingBoxCalculator$Companion_getInstance().calculateLoopLimitRange_h7l5yb$(segments, mapRange);\n } else {\n tmp$ = new ClosedRange(ensureNotNull(minOrNull(map(segments, getPropertyCallableRef('start', 1, function ($receiver) {\n return get_start($receiver);\n })))), ensureNotNull(maxOrNull(map(segments, getPropertyCallableRef('end', 1, function ($receiver) {\n return get_end($receiver);\n })))));\n }\n return tmp$;\n };\n function GeoBoundingBoxCalculator$Companion() {\n GeoBoundingBoxCalculator$Companion_instance = this;\n }\n function GeoBoundingBoxCalculator$Companion$calculateLoopLimitRange$lambda(closure$mapRange) {\n return function (it) {\n return LongitudeSegment$Companion_getInstance().splitSegment_6y0v78$(get_start(it), get_end(it), closure$mapRange.lowerEnd, closure$mapRange.upperEnd);\n };\n }\n GeoBoundingBoxCalculator$Companion.prototype.calculateLoopLimitRange_h7l5yb$ = function (segments, mapRange) {\n return this.normalizeCenter_0(this.invertRange_0(this.findMaxGapBetweenRanges_0(flatten(map(segments, GeoBoundingBoxCalculator$Companion$calculateLoopLimitRange$lambda(mapRange))), this.length_0(mapRange)), this.length_0(mapRange)), mapRange);\n };\n GeoBoundingBoxCalculator$Companion.prototype.normalizeCenter_0 = function (range, mapRange) {\n var tmp$;\n if (mapRange.contains_mef7kx$((range.upperEnd + range.lowerEnd) / 2)) {\n tmp$ = range;\n } else {\n tmp$ = new ClosedRange(range.lowerEnd - this.length_0(mapRange), range.upperEnd - this.length_0(mapRange));\n }\n return tmp$;\n };\n GeoBoundingBoxCalculator$Companion.prototype.findMaxGapBetweenRanges_0 = function (ranges, width) {\n var sortedRanges = sortedWith(ranges, new Comparator(compareBy$lambda(getPropertyCallableRef('lowerEnd', 1, function ($receiver) {\n return $receiver.lowerEnd;\n }))));\n var selector = getPropertyCallableRef('upperEnd', 1, function ($receiver) {\n return $receiver.upperEnd;\n });\n var maxByOrNull$result;\n maxByOrNull$break: do {\n var iterator = sortedRanges.iterator();\n if (!iterator.hasNext()) {\n maxByOrNull$result = null;\n break maxByOrNull$break;\n }var maxElem = iterator.next();\n if (!iterator.hasNext()) {\n maxByOrNull$result = maxElem;\n break maxByOrNull$break;\n }var maxValue = selector(maxElem);\n do {\n var e = iterator.next();\n var v = selector(e);\n if (Kotlin.compareTo(maxValue, v) < 0) {\n maxElem = e;\n maxValue = v;\n }}\n while (iterator.hasNext());\n maxByOrNull$result = maxElem;\n }\n while (false);\n var prevUpper = ensureNotNull(maxByOrNull$result).upperEnd;\n var nextLower = first_1(sortedRanges).lowerEnd;\n var a = width + nextLower;\n var b = prevUpper;\n var gapRight = JsMath.max(a, b);\n var maxGapRange = new ClosedRange(prevUpper, gapRight);\n var it = sortedRanges.iterator();\n prevUpper = it.next().upperEnd;\n while (it.hasNext()) {\n var range = it.next();\n nextLower = range.lowerEnd;\n if (nextLower > prevUpper && nextLower - prevUpper > this.length_0(maxGapRange)) {\n maxGapRange = new ClosedRange(prevUpper, nextLower);\n }var a_0 = prevUpper;\n var b_0 = range.upperEnd;\n prevUpper = JsMath.max(a_0, b_0);\n }\n return maxGapRange;\n };\n function GeoBoundingBoxCalculator$Companion$invertRange$safeRange(first, second) {\n return new ClosedRange(JsMath.min(first, second), JsMath.max(first, second));\n }\n GeoBoundingBoxCalculator$Companion.prototype.invertRange_0 = function (range, width) {\n var tmp$;\n var safeRange = GeoBoundingBoxCalculator$Companion$invertRange$safeRange;\n if (this.length_0(range) > width)\n tmp$ = new ClosedRange(range.lowerEnd, range.lowerEnd);\n else if (range.upperEnd > width)\n tmp$ = safeRange(range.upperEnd - width, range.lowerEnd);\n else\n tmp$ = safeRange(range.upperEnd, width + range.lowerEnd);\n return tmp$;\n };\n GeoBoundingBoxCalculator$Companion.prototype.length_0 = function ($receiver) {\n return $receiver.upperEnd - $receiver.lowerEnd;\n };\n GeoBoundingBoxCalculator$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeoBoundingBoxCalculator$Companion_instance = null;\n function GeoBoundingBoxCalculator$Companion_getInstance() {\n if (GeoBoundingBoxCalculator$Companion_instance === null) {\n new GeoBoundingBoxCalculator$Companion();\n }return GeoBoundingBoxCalculator$Companion_instance;\n }\n GeoBoundingBoxCalculator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeoBoundingBoxCalculator',\n interfaces: []\n };\n function makeSegments$lambda(closure$start, closure$end) {\n return function (it) {\n return new Pair(closure$start(it), closure$end(it));\n };\n }\n function makeSegments(start, end, size) {\n return map(asSequence(until(0, size)), makeSegments$lambda(start, end));\n }\n function geoRectsBBox$lambda(closure$rectangles) {\n return function (it) {\n return closure$rectangles.get_za3lpa$(it).startLongitude();\n };\n }\n function geoRectsBBox$lambda_0(closure$rectangles) {\n return function (it) {\n return closure$rectangles.get_za3lpa$(it).endLongitude();\n };\n }\n function geoRectsBBox$lambda_1(closure$rectangles) {\n return function (it) {\n return closure$rectangles.get_za3lpa$(it).minLatitude();\n };\n }\n function geoRectsBBox$lambda_2(closure$rectangles) {\n return function (it) {\n return closure$rectangles.get_za3lpa$(it).maxLatitude();\n };\n }\n function geoRectsBBox($receiver, rectangles) {\n return $receiver.calculateBoundingBox_qpfwx8$(makeSegments(geoRectsBBox$lambda(rectangles), geoRectsBBox$lambda_0(rectangles), rectangles.size), makeSegments(geoRectsBBox$lambda_1(rectangles), geoRectsBBox$lambda_2(rectangles), rectangles.size));\n }\n function pointsBBox$lambda(closure$xyCoords) {\n return function (index) {\n return closure$xyCoords.get_za3lpa$(2 * index | 0);\n };\n }\n function pointsBBox$lambda_0(closure$xyCoords) {\n return function (index) {\n return closure$xyCoords.get_za3lpa$((2 * index | 0) + 1 | 0);\n };\n }\n function pointsBBox($receiver, xyCoords) {\n if (!(xyCoords.size % 2 === 0)) {\n var message = 'Longitude-Latitude list is not even-numbered.';\n throw IllegalArgumentException_init(message.toString());\n }var x = pointsBBox$lambda(xyCoords);\n var y = pointsBBox$lambda_0(xyCoords);\n var i = xyCoords.size / 2 | 0;\n return $receiver.calculateBoundingBox_qpfwx8$(makeSegments(x, x, i), makeSegments(y, y, i));\n }\n function union$lambda(closure$rectangles) {\n return function (it) {\n return get_left(closure$rectangles.get_za3lpa$(it));\n };\n }\n function union$lambda_0(closure$rectangles) {\n return function (it) {\n return get_right(closure$rectangles.get_za3lpa$(it));\n };\n }\n function union$lambda_1(closure$rectangles) {\n return function (it) {\n return get_top(closure$rectangles.get_za3lpa$(it));\n };\n }\n function union$lambda_2(closure$rectangles) {\n return function (it) {\n return get_bottom(closure$rectangles.get_za3lpa$(it));\n };\n }\n function union($receiver, rectangles) {\n return $receiver.calculateBoundingBox_qpfwx8$(makeSegments(union$lambda(rectangles), union$lambda_0(rectangles), rectangles.size), makeSegments(union$lambda_1(rectangles), union$lambda_2(rectangles), rectangles.size));\n }\n function GeoJson() {\n GeoJson_instance = this;\n this.LON_INDEX_0 = 0;\n this.LAT_INDEX_0 = 1;\n }\n GeoJson.prototype.parse_gdwatq$ = function (geoJson, handler) {\n var geoObj = FluentObject_init(JsonSupport_getInstance().parseJson_61zpoe$(geoJson));\n var $receiver = new SimpleFeature$Consumer();\n handler($receiver);\n var geometryConsumer = $receiver;\n (new GeoJson$Parser()).parse_m8ausf$(geoObj, geometryConsumer);\n };\n GeoJson.prototype.parse_4mzk4t$ = function (geoJson, consumer) {\n var geoObj = FluentObject_init(JsonSupport_getInstance().parseJson_61zpoe$(geoJson));\n (new GeoJson$Parser()).parse_m8ausf$(geoObj, consumer);\n };\n function GeoJson$Parser() {\n }\n function GeoJson$Parser$parse$lambda(it) {\n return equals(it.getString_61zpoe$('type'), 'Feature');\n }\n function GeoJson$Parser$parse$lambda_0(it) {\n return it.getObject_61zpoe$('geometry');\n }\n GeoJson$Parser.prototype.parse_m8ausf$ = function (obj, handler) {\n var type = obj.getString_61zpoe$('type');\n switch (type) {\n case 'FeatureCollection':\n if (!obj.contains_61zpoe$('features')) {\n var message = \"GeoJson: Missing 'features' in 'FeatureCollection'\";\n throw IllegalArgumentException_init(message.toString());\n }\n var tmp$;\n tmp$ = map(filter(obj.getArray_61zpoe$('features').fluentObjectStream(), GeoJson$Parser$parse$lambda), GeoJson$Parser$parse$lambda_0).iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.parse_m8ausf$(element, handler);\n }\n\n break;\n case 'GeometryCollection':\n if (!obj.contains_61zpoe$('geometries')) {\n var message_0 = \"GeoJson: Missing 'geometries' in 'GeometryCollection'\";\n throw IllegalArgumentException_init(message_0.toString());\n }\n var tmp$_0;\n tmp$_0 = obj.getArray_61zpoe$('geometries').fluentObjectStream().iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n this.parse_m8ausf$(element_0, handler);\n }\n\n break;\n default:if (!obj.contains_61zpoe$('coordinates')) {\n var message_1 = \"GeoJson: Missing 'coordinates' in \" + type;\n throw IllegalArgumentException_init(message_1.toString());\n }\n var coordinates = obj.getArray_61zpoe$('coordinates');\n switch (type) {\n case 'Point':\n var $receiver = this.parsePoint_0(coordinates);\n getCallableRef('onPoint', function ($receiver, p1) {\n return $receiver.onPoint_adb7pk$(p1), Unit;\n }.bind(null, handler))($receiver);\n break;\n case 'LineString':\n var $receiver_0 = this.parseLineString_0(coordinates);\n getCallableRef('onLineString', function ($receiver, p1) {\n return $receiver.onLineString_1u6eph$(p1), Unit;\n }.bind(null, handler))($receiver_0);\n break;\n case 'Polygon':\n var $receiver_1 = this.parsePolygon_0(coordinates);\n getCallableRef('onPolygon', function ($receiver, p1) {\n return $receiver.onPolygon_z3kb82$(p1), Unit;\n }.bind(null, handler))($receiver_1);\n break;\n case 'MultiPoint':\n var $receiver_2 = this.parseMultiPoint_0(coordinates);\n getCallableRef('onMultiPoint', function ($receiver, p1) {\n return $receiver.onMultiPoint_oeq1z7$(p1), Unit;\n }.bind(null, handler))($receiver_2);\n break;\n case 'MultiLineString':\n var $receiver_3 = this.parseMultiLineString_0(coordinates);\n getCallableRef('onMultiLineString', function ($receiver, p1) {\n return $receiver.onMultiLineString_6n275e$(p1), Unit;\n }.bind(null, handler))($receiver_3);\n break;\n case 'MultiPolygon':\n var $receiver_4 = this.parseMultiPolygon_0(coordinates);\n getCallableRef('onMultiPolygon', function ($receiver, p1) {\n return $receiver.onMultiPolygon_a0zxnd$(p1), Unit;\n }.bind(null, handler))($receiver_4);\n break;\n default:throw IllegalStateException_init(('Not support GeoJson type: ' + type).toString());\n }\n\n break;\n }\n };\n GeoJson$Parser.prototype.parsePoint_0 = function (jsonPoint) {\n return explicitVec(jsonPoint.getDouble_za3lpa$(0), jsonPoint.getDouble_za3lpa$(1));\n };\n GeoJson$Parser.prototype.parseLineString_0 = function (jsonLineString) {\n return new LineString(this.mapArray_0(jsonLineString, getCallableRef('parsePoint', function ($receiver, p1) {\n return $receiver.parsePoint_0(p1);\n }.bind(null, this))));\n };\n GeoJson$Parser.prototype.parseRing_0 = function (jsonRing) {\n return new Ring(this.mapArray_0(jsonRing, getCallableRef('parsePoint', function ($receiver, p1) {\n return $receiver.parsePoint_0(p1);\n }.bind(null, this))));\n };\n GeoJson$Parser.prototype.parseMultiPoint_0 = function (jsonMultiPoint) {\n return new MultiPoint(this.mapArray_0(jsonMultiPoint, getCallableRef('parsePoint', function ($receiver, p1) {\n return $receiver.parsePoint_0(p1);\n }.bind(null, this))));\n };\n GeoJson$Parser.prototype.parsePolygon_0 = function (jsonPolygon) {\n return new Polygon(this.mapArray_0(jsonPolygon, getCallableRef('parseRing', function ($receiver, p1) {\n return $receiver.parseRing_0(p1);\n }.bind(null, this))));\n };\n GeoJson$Parser.prototype.parseMultiLineString_0 = function (jsonLineStrings) {\n return new MultiLineString(this.mapArray_0(jsonLineStrings, getCallableRef('parseLineString', function ($receiver, p1) {\n return $receiver.parseLineString_0(p1);\n }.bind(null, this))));\n };\n GeoJson$Parser.prototype.parseMultiPolygon_0 = function (jsonMultiPolygon) {\n return new MultiPolygon(this.mapArray_0(jsonMultiPolygon, getCallableRef('parsePolygon', function ($receiver, p1) {\n return $receiver.parsePolygon_0(p1);\n }.bind(null, this))));\n };\n function GeoJson$Parser$mapArray$lambda(closure$f) {\n return function (it) {\n var tmp$;\n return closure$f(FluentArray_init_0(Kotlin.isType(tmp$ = it, List) ? tmp$ : throwCCE()));\n };\n }\n GeoJson$Parser.prototype.mapArray_0 = function ($receiver, f) {\n return toList_1(map($receiver.stream(), GeoJson$Parser$mapArray$lambda(f)));\n };\n GeoJson$Parser.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Parser',\n interfaces: []\n };\n GeoJson.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GeoJson',\n interfaces: []\n };\n var GeoJson_instance = null;\n function GeoJson_getInstance() {\n if (GeoJson_instance === null) {\n new GeoJson();\n }return GeoJson_instance;\n }\n function GeoRectangle(startLongitude, minLatitude, endLongitude, maxLatitude) {\n this.myLongitudeSegment_0 = null;\n this.myLatitudeRange_0 = null;\n if (!(minLatitude <= maxLatitude)) {\n var message = 'Invalid latitude range: [' + minLatitude + '..' + maxLatitude + ']';\n throw IllegalArgumentException_init(message.toString());\n }this.myLongitudeSegment_0 = new LongitudeSegment(startLongitude, endLongitude);\n this.myLatitudeRange_0 = new ClosedRange(minLatitude, maxLatitude);\n }\n Object.defineProperty(GeoRectangle.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myLongitudeSegment_0.isEmpty && this.latitudeRangeIsEmpty_0(this.myLatitudeRange_0);\n }\n });\n GeoRectangle.prototype.latitudeRangeIsEmpty_0 = function (range) {\n return range.upperEnd === range.lowerEnd;\n };\n GeoRectangle.prototype.startLongitude = function () {\n return this.myLongitudeSegment_0.start();\n };\n GeoRectangle.prototype.endLongitude = function () {\n return this.myLongitudeSegment_0.end();\n };\n GeoRectangle.prototype.minLatitude = function () {\n return this.myLatitudeRange_0.lowerEnd;\n };\n GeoRectangle.prototype.maxLatitude = function () {\n return this.myLatitudeRange_0.upperEnd;\n };\n GeoRectangle.prototype.encloses_emtjl$ = function (rect) {\n return this.myLongitudeSegment_0.encloses_moa7dh$(rect.myLongitudeSegment_0) && this.myLatitudeRange_0.encloses_d226ot$(rect.myLatitudeRange_0);\n };\n GeoRectangle.prototype.splitByAntiMeridian = function () {\n var tmp$;\n var rects = ArrayList_init();\n var longitudeRanges = this.myLongitudeSegment_0.splitByAntiMeridian();\n tmp$ = longitudeRanges.iterator();\n while (tmp$.hasNext()) {\n var longitudeRange = tmp$.next();\n rects.add_11rb$(newSpanRectangle(new Vec(longitudeRange.lowerEnd, this.myLatitudeRange_0.lowerEnd), new Vec(longitudeRange.upperEnd, this.myLatitudeRange_0.upperEnd)));\n }\n return rects;\n };\n GeoRectangle.prototype.equals = function (other) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n var that = (tmp$_0 = other) == null || Kotlin.isType(tmp$_0, GeoRectangle) ? tmp$_0 : throwCCE();\n return ((tmp$_1 = this.myLongitudeSegment_0) != null ? tmp$_1.equals(ensureNotNull(that).myLongitudeSegment_0) : null) && ((tmp$_2 = this.myLatitudeRange_0) != null ? tmp$_2.equals(that.myLatitudeRange_0) : null);\n };\n GeoRectangle.prototype.hashCode = function () {\n return hashCode(listOf([this.myLongitudeSegment_0, this.myLatitudeRange_0]));\n };\n GeoRectangle.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeoRectangle',\n interfaces: []\n };\n function LonLat() {\n }\n LonLat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LonLat',\n interfaces: []\n };\n var EARTH_RECT;\n function limitLon(lon) {\n var tmp$ = MIN_LONGITUDE;\n var b = MAX_LONGITUDE;\n var b_0 = JsMath.min(lon, b);\n return JsMath.max(tmp$, b_0);\n }\n function limitLat(lat) {\n var tmp$ = MIN_LATITUDE;\n var b = MAX_LATITUDE;\n var b_0 = JsMath.min(lat, b);\n return JsMath.max(tmp$, b_0);\n }\n function normalizeLon(lon) {\n var result = lon - numberToInt(lon / FULL_LONGITUDE) * FULL_LONGITUDE;\n if (result > MAX_LONGITUDE) {\n result -= FULL_LONGITUDE;\n }if (result < -MAX_LONGITUDE) {\n result += FULL_LONGITUDE;\n }return result;\n }\n var BBOX_CALCULATOR;\n function convertToGeoRectangle(rect) {\n var left;\n var right;\n if (get_width(rect) < get_width(EARTH_RECT)) {\n left = normalizeLon(get_left(rect));\n right = normalizeLon(get_right(rect));\n } else {\n left = get_left(EARTH_RECT);\n right = get_right(EARTH_RECT);\n }\n return new GeoRectangle(left, limitLat(get_top(rect)), right, limitLat(get_bottom(rect)));\n }\n function calculateQuadKeys(rect, zoom) {\n var flippedRect = Rect_init(get_left(rect), -get_bottom(rect), get_width(rect), get_height(rect));\n return calculateQuadKeys_0(EARTH_RECT, flippedRect, zoom, getCallableRef('QuadKey', function (p1) {\n return new QuadKey(p1);\n }));\n }\n function LongitudeSegment(start, end) {\n LongitudeSegment$Companion_getInstance();\n this.myStart_0 = limitLon(start);\n this.myEnd_0 = limitLon(end);\n }\n Object.defineProperty(LongitudeSegment.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myEnd_0 === this.myStart_0;\n }\n });\n LongitudeSegment.prototype.start = function () {\n return this.myStart_0;\n };\n LongitudeSegment.prototype.end = function () {\n return this.myEnd_0;\n };\n LongitudeSegment.prototype.length = function () {\n return this.myEnd_0 - this.myStart_0 + (this.myEnd_0 < this.myStart_0 ? FULL_LONGITUDE : 0.0);\n };\n LongitudeSegment.prototype.encloses_moa7dh$ = function (longitudeSegment) {\n var tmp$;\n var externalRanges = this.splitByAntiMeridian();\n var internalRanges = longitudeSegment.splitByAntiMeridian();\n tmp$ = internalRanges.iterator();\n while (tmp$.hasNext()) {\n var internalRange = tmp$.next();\n if (!LongitudeSegment$Companion_getInstance().disjointRangesEncloseRange_0(externalRanges, internalRange)) {\n return false;\n }}\n return true;\n };\n LongitudeSegment.prototype.invert = function () {\n return new LongitudeSegment(this.myEnd_0, this.myStart_0);\n };\n LongitudeSegment.prototype.splitByAntiMeridian = function () {\n return LongitudeSegment$Companion_getInstance().splitSegment_6y0v78$(this.myStart_0, this.myEnd_0, MIN_LONGITUDE, MAX_LONGITUDE);\n };\n LongitudeSegment.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n var that = Kotlin.isType(tmp$_0 = other, LongitudeSegment) ? tmp$_0 : throwCCE();\n return equals(that.myStart_0, this.myStart_0) && equals(that.myEnd_0, this.myEnd_0);\n };\n LongitudeSegment.prototype.hashCode = function () {\n return hashCode(listOf([this.myStart_0, this.myEnd_0]));\n };\n function LongitudeSegment$Companion() {\n LongitudeSegment$Companion_instance = this;\n }\n LongitudeSegment$Companion.prototype.splitSegment_6y0v78$ = function (start, end, min, max) {\n var tmp$;\n if (start <= end) {\n tmp$ = listOf_0(new ClosedRange(start, end));\n } else {\n tmp$ = listOf([new ClosedRange(start, max), new ClosedRange(min, end)]);\n }\n return tmp$;\n };\n LongitudeSegment$Companion.prototype.disjointRangesEncloseRange_0 = function (ranges, internalRange) {\n var tmp$;\n tmp$ = ranges.iterator();\n while (tmp$.hasNext()) {\n var range = tmp$.next();\n if (range.encloses_d226ot$(internalRange)) {\n return true;\n }}\n return false;\n };\n LongitudeSegment$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LongitudeSegment$Companion_instance = null;\n function LongitudeSegment$Companion_getInstance() {\n if (LongitudeSegment$Companion_instance === null) {\n new LongitudeSegment$Companion();\n }return LongitudeSegment$Companion_instance;\n }\n LongitudeSegment.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LongitudeSegment',\n interfaces: []\n };\n function MercatorUtils() {\n MercatorUtils_instance = this;\n this.MAX_LONGITUDE_0 = 180.0;\n this.MAX_LATITUDE_0 = 85.0511287798;\n this.VALID_LONGITUDE_RANGE = new ClosedRange(-this.MAX_LONGITUDE_0, this.MAX_LONGITUDE_0);\n this.VALID_LATITUDE_RANGE = new ClosedRange(-this.MAX_LATITUDE_0, this.MAX_LATITUDE_0);\n }\n MercatorUtils.prototype.getMercatorX_14dthe$ = function (lon) {\n return toRadians(lon) * EARTH_RADIUS;\n };\n MercatorUtils.prototype.getMercatorY_14dthe$ = function (lat) {\n var lat_0 = this.normalizeLat_0(lat);\n var x = math.PI / 4 + toRadians(lat_0) / 2;\n var x_0 = JsMath.tan(x);\n return JsMath.log(x_0) * EARTH_RADIUS;\n };\n MercatorUtils.prototype.getLongitude_14dthe$ = function (x) {\n return toDegrees(x / EARTH_RADIUS);\n };\n MercatorUtils.prototype.getLatitude_14dthe$ = function (y) {\n var x = y / EARTH_RADIUS;\n var x_0 = JsMath.exp(x);\n return this.normalizeLat_0(toDegrees((JsMath.atan(x_0) - math.PI / 4) * 2));\n };\n MercatorUtils.prototype.checkLon_14dthe$ = function (lon) {\n return this.VALID_LONGITUDE_RANGE.contains_mef7kx$(lon);\n };\n MercatorUtils.prototype.checkLat_14dthe$ = function (lat) {\n return this.VALID_LATITUDE_RANGE.contains_mef7kx$(lat);\n };\n MercatorUtils.prototype.normalizeLat_0 = function (lat) {\n var tmp$ = -this.MAX_LATITUDE_0;\n var b = this.MAX_LATITUDE_0;\n var b_0 = JsMath.min(lat, b);\n return JsMath.max(tmp$, b_0);\n };\n MercatorUtils.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'MercatorUtils',\n interfaces: []\n };\n var MercatorUtils_instance = null;\n function MercatorUtils_getInstance() {\n if (MercatorUtils_instance === null) {\n new MercatorUtils();\n }return MercatorUtils_instance;\n }\n function QuadKey(key) {\n this.key = key;\n this.length = this.key.length;\n }\n QuadKey.prototype.plus_vnxxg4$ = function (other) {\n return new QuadKey(this.key + other.key);\n };\n QuadKey.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'QuadKey',\n interfaces: []\n };\n QuadKey.prototype.component1 = function () {\n return this.key;\n };\n QuadKey.prototype.copy_61zpoe$ = function (key) {\n return new QuadKey(key === void 0 ? this.key : key);\n };\n QuadKey.prototype.toString = function () {\n return 'QuadKey(key=' + Kotlin.toString(this.key) + ')';\n };\n QuadKey.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.key) | 0;\n return result;\n };\n QuadKey.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && Kotlin.equals(this.key, other.key))));\n };\n function computeRect$lambda(closure$flippedY) {\n return function (it) {\n return closure$flippedY;\n };\n }\n function computeRect($receiver) {\n var origin = computeOrigin($receiver, EARTH_RECT);\n var dimension = div_0(EARTH_RECT.dimension, calulateQuadsCount($receiver.length));\n var flippedY = minus_0(get_scalarBottom(EARTH_RECT), minus_0(plus_5(get_scalarY(origin), get_scalarY(dimension)), get_scalarTop(EARTH_RECT)));\n return new Rect(transform(origin, void 0, computeRect$lambda(flippedY)), dimension);\n }\n function computeRect_0($receiver, rect) {\n return projectRect($receiver, rect);\n }\n function projectRect($receiver, rect) {\n var origin = projectOrigin($receiver, rect);\n var dimension = div_0(rect.dimension, calulateQuadsCount($receiver.length));\n return new Rect(origin, dimension);\n }\n function zoom($receiver) {\n return $receiver.length;\n }\n function computeOrigin($receiver, mapRect) {\n return projectOrigin($receiver, mapRect);\n }\n function projectOrigin($receiver, mapRect) {\n var tmp$;\n var left = get_scalarLeft(mapRect);\n var top = get_scalarTop(mapRect);\n var width = get_scalarWidth(mapRect);\n var height = get_scalarHeight(mapRect);\n tmp$ = iterator($receiver.key);\n while (tmp$.hasNext()) {\n var quadrant = unboxChar(tmp$.next());\n width = div_2(width, 2.0);\n height = div_2(height, 2.0);\n if (quadrant === 49 || quadrant === 51) {\n left = plus_5(left, width);\n }if (quadrant === 50 || quadrant === 51) {\n top = plus_5(top, height);\n }}\n return newVec(left, top);\n }\n function calulateQuadsCount(zoom) {\n return numberToInt(ipow(2, zoom));\n }\n function calculateQuadKeys$calcQuadNum(value, range, tileCount) {\n var position = (value - range.lowerEnd) / (range.upperEnd - range.lowerEnd);\n var a = position * tileCount;\n var b = tileCount - 1 | 0;\n var b_0 = JsMath.min(a, b);\n return numberToInt(JsMath.max(0.0, b_0));\n }\n function calculateQuadKeys_0(mapRect, viewRect, zoom, quadKeyFactory) {\n var quadKeys = HashSet_init_0();\n var tileCount = calulateQuadsCount(zoom);\n var calcQuadNum = calculateQuadKeys$calcQuadNum;\n var xmin = calcQuadNum(get_left(viewRect), xRange(mapRect), tileCount);\n var xmax = calcQuadNum(get_right(viewRect), xRange(mapRect), tileCount);\n var ymin = calcQuadNum(get_top(viewRect), yRange(mapRect), tileCount);\n var ymax = calcQuadNum(get_bottom(viewRect), yRange(mapRect), tileCount);\n for (var x = xmin; x <= xmax; x++) {\n for (var y = ymin; y <= ymax; y++) {\n var $receiver = quadKeyFactory(xyToKey(x, y, zoom));\n getCallableRef('add', function ($receiver, p1) {\n return $receiver.add_11rb$(p1);\n }.bind(null, quadKeys))($receiver);\n }\n }\n return quadKeys;\n }\n function xyToKey(x, y, zoom) {\n var key = '';\n for (var i = zoom; i >= 1; i--) {\n var digit = 48;\n var mask = 1 << i - 1;\n if ((x & mask) !== 0) {\n digit = Kotlin.charInc(digit);\n }if ((y & mask) !== 0) {\n digit = toChar(digit + 2);\n }key += String.fromCharCode(digit);\n }\n return key;\n }\n function SimpleFeature() {\n SimpleFeature_instance = this;\n }\n function SimpleFeature$GeometryConsumer() {\n }\n SimpleFeature$GeometryConsumer.prototype.onPoint_adb7pk$ = function (point) {\n throw IllegalStateException_init(\"Point isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.prototype.onLineString_1u6eph$ = function (lineString) {\n throw IllegalStateException_init(\"LineString isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.prototype.onPolygon_z3kb82$ = function (polygon) {\n throw IllegalStateException_init(\"Polygon isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.prototype.onMultiPoint_oeq1z7$ = function (multiPoint) {\n throw IllegalStateException_init(\"MultiPoint isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.prototype.onMultiLineString_6n275e$ = function (multiLineString) {\n throw IllegalStateException_init(\"MultiLineString isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.prototype.onMultiPolygon_a0zxnd$ = function (multipolygon) {\n throw IllegalStateException_init(\"MultiPolygon isn't supported\".toString());\n };\n SimpleFeature$GeometryConsumer.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GeometryConsumer',\n interfaces: []\n };\n function SimpleFeature$Consumer(onPoint, onLineString, onPolygon, onMultiPoint, onMultiLineString, onMultiPolygon) {\n if (onPoint === void 0)\n onPoint = SimpleFeature$SimpleFeature$Consumer_init$lambda;\n if (onLineString === void 0)\n onLineString = SimpleFeature$SimpleFeature$Consumer_init$lambda_0;\n if (onPolygon === void 0)\n onPolygon = SimpleFeature$SimpleFeature$Consumer_init$lambda_1;\n if (onMultiPoint === void 0)\n onMultiPoint = SimpleFeature$SimpleFeature$Consumer_init$lambda_2;\n if (onMultiLineString === void 0)\n onMultiLineString = SimpleFeature$SimpleFeature$Consumer_init$lambda_3;\n if (onMultiPolygon === void 0)\n onMultiPolygon = SimpleFeature$SimpleFeature$Consumer_init$lambda_4;\n this.onPoint = onPoint;\n this.onLineString = onLineString;\n this.onPolygon = onPolygon;\n this.onMultiPoint = onMultiPoint;\n this.onMultiLineString = onMultiLineString;\n this.onMultiPolygon = onMultiPolygon;\n }\n SimpleFeature$Consumer.prototype.onPoint_adb7pk$ = function (point) {\n this.onPoint(point);\n };\n SimpleFeature$Consumer.prototype.onLineString_1u6eph$ = function (lineString) {\n this.onLineString(lineString);\n };\n SimpleFeature$Consumer.prototype.onPolygon_z3kb82$ = function (polygon) {\n this.onPolygon(polygon);\n };\n SimpleFeature$Consumer.prototype.onMultiPoint_oeq1z7$ = function (multiPoint) {\n this.onMultiPoint(multiPoint);\n };\n SimpleFeature$Consumer.prototype.onMultiLineString_6n275e$ = function (multiLineString) {\n this.onMultiLineString(multiLineString);\n };\n SimpleFeature$Consumer.prototype.onMultiPolygon_a0zxnd$ = function (multipolygon) {\n this.onMultiPolygon(multipolygon);\n };\n function SimpleFeature$SimpleFeature$Consumer_init$lambda(it) {\n throw IllegalStateException_init(\"Point isn't supported\".toString());\n }\n function SimpleFeature$SimpleFeature$Consumer_init$lambda_0(it) {\n throw IllegalStateException_init(\"LineString isn't supported\".toString());\n }\n function SimpleFeature$SimpleFeature$Consumer_init$lambda_1(it) {\n throw IllegalStateException_init(\"Polygon isn't supported\".toString());\n }\n function SimpleFeature$SimpleFeature$Consumer_init$lambda_2(it) {\n throw IllegalStateException_init(\"MultiPoint isn't supported\".toString());\n }\n function SimpleFeature$SimpleFeature$Consumer_init$lambda_3(it) {\n throw IllegalStateException_init(\"MultiLineString isn't supported\".toString());\n }\n function SimpleFeature$SimpleFeature$Consumer_init$lambda_4(it) {\n throw IllegalStateException_init(\"MultiPolygon isn't supported\".toString());\n }\n SimpleFeature$Consumer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Consumer',\n interfaces: [SimpleFeature$GeometryConsumer]\n };\n function SimpleFeature$GeometryType(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function SimpleFeature$GeometryType_initFields() {\n SimpleFeature$GeometryType_initFields = function () {\n };\n SimpleFeature$GeometryType$POINT_instance = new SimpleFeature$GeometryType('POINT', 0);\n SimpleFeature$GeometryType$LINE_STRING_instance = new SimpleFeature$GeometryType('LINE_STRING', 1);\n SimpleFeature$GeometryType$POLYGON_instance = new SimpleFeature$GeometryType('POLYGON', 2);\n SimpleFeature$GeometryType$MULTI_POINT_instance = new SimpleFeature$GeometryType('MULTI_POINT', 3);\n SimpleFeature$GeometryType$MULTI_LINE_STRING_instance = new SimpleFeature$GeometryType('MULTI_LINE_STRING', 4);\n SimpleFeature$GeometryType$MULTI_POLYGON_instance = new SimpleFeature$GeometryType('MULTI_POLYGON', 5);\n SimpleFeature$GeometryType$GEOMETRY_COLLECTION_instance = new SimpleFeature$GeometryType('GEOMETRY_COLLECTION', 6);\n }\n var SimpleFeature$GeometryType$POINT_instance;\n function SimpleFeature$GeometryType$POINT_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$POINT_instance;\n }\n var SimpleFeature$GeometryType$LINE_STRING_instance;\n function SimpleFeature$GeometryType$LINE_STRING_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$LINE_STRING_instance;\n }\n var SimpleFeature$GeometryType$POLYGON_instance;\n function SimpleFeature$GeometryType$POLYGON_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$POLYGON_instance;\n }\n var SimpleFeature$GeometryType$MULTI_POINT_instance;\n function SimpleFeature$GeometryType$MULTI_POINT_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$MULTI_POINT_instance;\n }\n var SimpleFeature$GeometryType$MULTI_LINE_STRING_instance;\n function SimpleFeature$GeometryType$MULTI_LINE_STRING_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$MULTI_LINE_STRING_instance;\n }\n var SimpleFeature$GeometryType$MULTI_POLYGON_instance;\n function SimpleFeature$GeometryType$MULTI_POLYGON_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$MULTI_POLYGON_instance;\n }\n var SimpleFeature$GeometryType$GEOMETRY_COLLECTION_instance;\n function SimpleFeature$GeometryType$GEOMETRY_COLLECTION_getInstance() {\n SimpleFeature$GeometryType_initFields();\n return SimpleFeature$GeometryType$GEOMETRY_COLLECTION_instance;\n }\n SimpleFeature$GeometryType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeometryType',\n interfaces: [Enum]\n };\n function SimpleFeature$GeometryType$values() {\n return [SimpleFeature$GeometryType$POINT_getInstance(), SimpleFeature$GeometryType$LINE_STRING_getInstance(), SimpleFeature$GeometryType$POLYGON_getInstance(), SimpleFeature$GeometryType$MULTI_POINT_getInstance(), SimpleFeature$GeometryType$MULTI_LINE_STRING_getInstance(), SimpleFeature$GeometryType$MULTI_POLYGON_getInstance(), SimpleFeature$GeometryType$GEOMETRY_COLLECTION_getInstance()];\n }\n SimpleFeature$GeometryType.values = SimpleFeature$GeometryType$values;\n function SimpleFeature$GeometryType$valueOf(name) {\n switch (name) {\n case 'POINT':\n return SimpleFeature$GeometryType$POINT_getInstance();\n case 'LINE_STRING':\n return SimpleFeature$GeometryType$LINE_STRING_getInstance();\n case 'POLYGON':\n return SimpleFeature$GeometryType$POLYGON_getInstance();\n case 'MULTI_POINT':\n return SimpleFeature$GeometryType$MULTI_POINT_getInstance();\n case 'MULTI_LINE_STRING':\n return SimpleFeature$GeometryType$MULTI_LINE_STRING_getInstance();\n case 'MULTI_POLYGON':\n return SimpleFeature$GeometryType$MULTI_POLYGON_getInstance();\n case 'GEOMETRY_COLLECTION':\n return SimpleFeature$GeometryType$GEOMETRY_COLLECTION_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.spatial.SimpleFeature.GeometryType.' + name);\n }\n }\n SimpleFeature$GeometryType.valueOf_61zpoe$ = SimpleFeature$GeometryType$valueOf;\n SimpleFeature.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'SimpleFeature',\n interfaces: []\n };\n var SimpleFeature_instance = null;\n function SimpleFeature_getInstance() {\n if (SimpleFeature_instance === null) {\n new SimpleFeature();\n }return SimpleFeature_instance;\n }\n function StringFormat(pattern, formatType) {\n StringFormat$Companion_getInstance();\n this.pattern_0 = pattern;\n this.formatType = formatType;\n this.myNumberFormatters_0 = null;\n var tmp$;\n var initNumberFormat = StringFormat_init$initNumberFormat;\n switch (this.formatType.name) {\n case 'NUMBER_FORMAT':\n tmp$ = listOf_0(initNumberFormat(this.pattern_0));\n break;\n case 'STRING_FORMAT':\n tmp$ = toList_1(map(map(StringFormat$Companion_getInstance().BRACES_REGEX_0.findAll_905azu$(this.pattern_0), StringFormat_init$lambda), StringFormat_init$lambda_0(initNumberFormat)));\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n this.myNumberFormatters_0 = tmp$;\n this.argsNumber = this.myNumberFormatters_0.size;\n }\n function StringFormat$FormatType(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function StringFormat$FormatType_initFields() {\n StringFormat$FormatType_initFields = function () {\n };\n StringFormat$FormatType$NUMBER_FORMAT_instance = new StringFormat$FormatType('NUMBER_FORMAT', 0);\n StringFormat$FormatType$STRING_FORMAT_instance = new StringFormat$FormatType('STRING_FORMAT', 1);\n }\n var StringFormat$FormatType$NUMBER_FORMAT_instance;\n function StringFormat$FormatType$NUMBER_FORMAT_getInstance() {\n StringFormat$FormatType_initFields();\n return StringFormat$FormatType$NUMBER_FORMAT_instance;\n }\n var StringFormat$FormatType$STRING_FORMAT_instance;\n function StringFormat$FormatType$STRING_FORMAT_getInstance() {\n StringFormat$FormatType_initFields();\n return StringFormat$FormatType$STRING_FORMAT_instance;\n }\n StringFormat$FormatType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FormatType',\n interfaces: [Enum]\n };\n function StringFormat$FormatType$values() {\n return [StringFormat$FormatType$NUMBER_FORMAT_getInstance(), StringFormat$FormatType$STRING_FORMAT_getInstance()];\n }\n StringFormat$FormatType.values = StringFormat$FormatType$values;\n function StringFormat$FormatType$valueOf(name) {\n switch (name) {\n case 'NUMBER_FORMAT':\n return StringFormat$FormatType$NUMBER_FORMAT_getInstance();\n case 'STRING_FORMAT':\n return StringFormat$FormatType$STRING_FORMAT_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.stringFormat.StringFormat.FormatType.' + name);\n }\n }\n StringFormat$FormatType.valueOf_61zpoe$ = StringFormat$FormatType$valueOf;\n StringFormat.prototype.format_za3rmp$ = function (value) {\n return this.format_pqjuzw$(listOf_0(value));\n };\n StringFormat.prototype.format_pqjuzw$ = function (values) {\n var tmp$;\n if (this.argsNumber !== values.size) {\n throw IllegalStateException_init((\"Can't format values \" + values + ' with pattern ' + '\"' + this.pattern_0 + '\"' + '). Wrong number of arguments: expected ' + this.argsNumber + ' instead of ' + values.size).toString());\n }loop_label: switch (this.formatType.name) {\n case 'NUMBER_FORMAT':\n if (!(this.myNumberFormatters_0.size === 1)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }\n tmp$ = this.formatValue_0(single(values), single(this.myNumberFormatters_0));\n break loop_label;\n case 'STRING_FORMAT':\n var index = {v: 0};\n var $this = StringFormat$Companion_getInstance().BRACES_REGEX_0;\n var input = this.pattern_0;\n var replace_20wsma$result;\n replace_20wsma$break: do {\n var match = $this.find_905azu$(input);\n if (match == null) {\n replace_20wsma$result = input.toString();\n break replace_20wsma$break;\n }var lastStart = 0;\n var length = input.length;\n var sb = StringBuilder_init_0(length);\n do {\n var foundMatch = ensureNotNull(match);\n sb.append_ezbsdh$(input, lastStart, foundMatch.range.start);\n var tmp$_0 = sb.append_gw00v9$;\n var tmp$_1;\n var originalValue = values.get_za3lpa$(index.v);\n var formatter = this.myNumberFormatters_0.get_za3lpa$((tmp$_1 = index.v, index.v = tmp$_1 + 1 | 0, tmp$_1));\n tmp$_0.call(sb, this.formatValue_0(originalValue, formatter));\n lastStart = foundMatch.range.endInclusive + 1 | 0;\n match = foundMatch.next();\n }\n while (lastStart < length && match != null);\n if (lastStart < length) {\n sb.append_ezbsdh$(input, lastStart, length);\n }replace_20wsma$result = sb.toString();\n }\n while (false);\n tmp$ = replace(replace(replace_20wsma$result, '{{', '{'), '}}', '}');\n break loop_label;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break loop_label;\n }\n return tmp$;\n };\n StringFormat.prototype.formatValue_0 = function (value, numberFormatter) {\n var tmp$, tmp$_0, tmp$_1;\n if (numberFormatter == null)\n tmp$_1 = value.toString();\n else if (Kotlin.isNumber(value))\n tmp$_1 = numberFormatter.apply_3p81yu$(value);\n else if (typeof value === 'string') {\n tmp$_1 = (tmp$_0 = (tmp$ = toDoubleOrNull(value)) != null ? getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_3p81yu$(p1);\n }.bind(null, numberFormatter))(tmp$) : null) != null ? tmp$_0 : value;\n } else {\n throw IllegalStateException_init(('Failed to format value with type ' + toString(Kotlin.getKClassFromExpression(value).simpleName) + '. Supported types are Number and String.').toString());\n }\n return tmp$_1;\n };\n function StringFormat$Companion() {\n StringFormat$Companion_instance = this;\n this.BRACES_REGEX_0 = Regex_init('(?![^{]|\\\\{\\\\{)(\\\\{([^{}]*)\\\\})(?=[^}]|\\\\}\\\\}|$)');\n this.TEXT_IN_BRACES = 2;\n }\n StringFormat$Companion.prototype.valueInLinePattern = function () {\n return '{}';\n };\n StringFormat$Companion.prototype.forOneArg_86f9bg$ = function (pattern, type, formatFor) {\n if (type === void 0)\n type = null;\n if (formatFor === void 0)\n formatFor = null;\n return this.create_w8bwfu$(pattern, type, formatFor, 1);\n };\n StringFormat$Companion.prototype.forNArgs_8vq31k$ = function (pattern, type, argCount, formatFor) {\n if (type === void 0)\n type = null;\n if (formatFor === void 0)\n formatFor = null;\n return this.create_w8bwfu$(pattern, type, formatFor, argCount);\n };\n StringFormat$Companion.prototype.create_w8bwfu$ = function (pattern, type, formatFor, expectedArgs) {\n if (type === void 0)\n type = null;\n if (formatFor === void 0)\n formatFor = null;\n if (expectedArgs === void 0)\n expectedArgs = -1;\n var tmp$;\n if (type != null)\n tmp$ = type;\n else if (NumberFormat$Companion_getInstance().isValidPattern_61zpoe$(pattern))\n tmp$ = StringFormat$FormatType$NUMBER_FORMAT_getInstance();\n else\n tmp$ = StringFormat$FormatType$STRING_FORMAT_getInstance();\n var formatType = tmp$;\n var $receiver = new StringFormat(pattern, formatType);\n if (expectedArgs > 0) {\n if (!($receiver.argsNumber === expectedArgs)) {\n var tmp$_0;\n var formatFor_0 = (tmp$_0 = formatFor != null ? 'to format ' + \"'\" + toString(formatFor) + \"'\" : null) != null ? tmp$_0 : '';\n var message = 'Wrong number of arguments in pattern ' + \"'\" + pattern + \"'\" + ' ' + formatFor_0 + '. ' + ('Expected ' + expectedArgs + ' ' + (expectedArgs > 1 ? 'arguments' : 'argument') + ' ') + ('instead of ' + $receiver.argsNumber);\n throw IllegalArgumentException_init(message.toString());\n }}return $receiver;\n };\n StringFormat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var StringFormat$Companion_instance = null;\n function StringFormat$Companion_getInstance() {\n if (StringFormat$Companion_instance === null) {\n new StringFormat$Companion();\n }return StringFormat$Companion_instance;\n }\n function StringFormat_init$initNumberFormat(pattern) {\n try {\n return NumberFormat_init(pattern);\n } catch (e) {\n if (Kotlin.isType(e, Exception)) {\n throw IllegalStateException_init(('Wrong number pattern: ' + pattern).toString());\n } else\n throw e;\n }\n }\n function StringFormat_init$lambda(it) {\n return it.groupValues.get_za3lpa$(2);\n }\n function StringFormat_init$lambda_0(closure$initNumberFormat) {\n return function (format) {\n if (format.length > 0) {\n return closure$initNumberFormat(format);\n } else {\n return null;\n }\n };\n }\n StringFormat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StringFormat',\n interfaces: []\n };\n function AbstractGeometryList(myGeometry) {\n AbstractList.call(this);\n this.myGeometry_8dt6c9$_0 = myGeometry;\n }\n AbstractGeometryList.prototype.get_za3lpa$ = function (index) {\n return this.myGeometry_8dt6c9$_0.get_za3lpa$(index);\n };\n Object.defineProperty(AbstractGeometryList.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.myGeometry_8dt6c9$_0.size;\n }\n });\n AbstractGeometryList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractGeometryList',\n interfaces: [AbstractList]\n };\n function isClockwise_0(ring) {\n return isClockwise(ring, getPropertyCallableRef('x', 1, function ($receiver) {\n return $receiver.x;\n }), getPropertyCallableRef('y', 1, function ($receiver) {\n return $receiver.y;\n }));\n }\n function createMultiPolygon(points) {\n var tmp$;\n if (points.isEmpty()) {\n return new MultiPolygon(emptyList());\n }var polygons = ArrayList_init();\n var rings = ArrayList_init();\n tmp$ = splitRings(points).iterator();\n while (tmp$.hasNext()) {\n var ring = tmp$.next();\n if (!rings.isEmpty() && isClockwise_0(ring)) {\n polygons.add_11rb$(new Polygon(rings));\n rings = ArrayList_init();\n }rings.add_11rb$(new Ring(ring));\n }\n if (!rings.isEmpty()) {\n polygons.add_11rb$(new Polygon(rings));\n }return new MultiPolygon(polygons);\n }\n function boundingBox$lambda(minX, minY, maxX, maxY) {\n return newSpanRectangle(new Vec(minX, minY), new Vec(maxX, maxY));\n }\n function boundingBox($receiver) {\n return DoubleRectangles_getInstance().calculateBoundingBox_h5l7ap$($receiver, getPropertyCallableRef('x', 1, function ($receiver) {\n return $receiver.x;\n }), getPropertyCallableRef('y', 1, function ($receiver) {\n return $receiver.y;\n }), boundingBox$lambda);\n }\n function Generic() {\n }\n Generic.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Generic',\n interfaces: []\n };\n function reinterpret($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, Vec) ? tmp$ : throwCCE();\n }\n function reinterpret_0($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, MultiPoint) ? tmp$ : throwCCE();\n }\n function reinterpret_1($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, LineString) ? tmp$ : throwCCE();\n }\n function reinterpret_2($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, MultiLineString) ? tmp$ : throwCCE();\n }\n function reinterpret_3($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, Polygon) ? tmp$ : throwCCE();\n }\n function reinterpret_4($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, MultiPolygon) ? tmp$ : throwCCE();\n }\n function get_bottom($receiver) {\n return $receiver.origin.y + $receiver.dimension.y;\n }\n function get_right($receiver) {\n return $receiver.origin.x + $receiver.dimension.x;\n }\n function get_height($receiver) {\n return $receiver.dimension.y;\n }\n function get_width($receiver) {\n return $receiver.dimension.x;\n }\n function get_top($receiver) {\n return $receiver.origin.y;\n }\n function get_left($receiver) {\n return $receiver.origin.x;\n }\n function get_scalarBottom($receiver) {\n return new Scalar(get_bottom($receiver));\n }\n function get_scalarRight($receiver) {\n return new Scalar(get_right($receiver));\n }\n function get_scalarHeight($receiver) {\n return new Scalar(get_height($receiver));\n }\n function get_scalarWidth($receiver) {\n return new Scalar(get_width($receiver));\n }\n function get_scalarTop($receiver) {\n return new Scalar(get_top($receiver));\n }\n function get_scalarLeft($receiver) {\n return new Scalar(get_left($receiver));\n }\n function get_center($receiver) {\n return plus_4(div_0($receiver.dimension, 2.0), $receiver.origin);\n }\n function get_scalarX($receiver) {\n return new Scalar($receiver.x);\n }\n function get_scalarY($receiver) {\n return new Scalar($receiver.y);\n }\n function plus_4($receiver, other) {\n return new Vec($receiver.x + other.x, $receiver.y + other.y);\n }\n function minus($receiver, other) {\n return new Vec($receiver.x - other.x, $receiver.y - other.y);\n }\n function times($receiver, other) {\n return new Vec($receiver.x * other.x, $receiver.y * other.y);\n }\n function div($receiver, other) {\n return new Vec($receiver.x / other.x, $receiver.y / other.y);\n }\n function times_0($receiver, scale) {\n return new Vec($receiver.x * scale, $receiver.y * scale);\n }\n function div_0($receiver, scale) {\n return new Vec($receiver.x / scale, $receiver.y / scale);\n }\n function unaryMinus($receiver) {\n return new Vec(-$receiver.x, -$receiver.y);\n }\n function transform$lambda(it) {\n return it;\n }\n function transform$lambda_0(it) {\n return it;\n }\n function transform($receiver, newX, newY) {\n if (newX === void 0)\n newX = transform$lambda;\n if (newY === void 0)\n newY = transform$lambda_0;\n return new Vec(newX(get_scalarX($receiver)).value, newY(get_scalarY($receiver)).value);\n }\n function plus_5($receiver, other) {\n return new Scalar($receiver.value + other.value);\n }\n function minus_0($receiver, other) {\n return new Scalar($receiver.value - other.value);\n }\n function times_1($receiver, other) {\n return new Scalar($receiver.value * other.value);\n }\n function div_1($receiver, other) {\n return new Scalar($receiver.value / other.value);\n }\n function div_2($receiver, other) {\n return new Scalar($receiver.value / other);\n }\n function times_2($receiver, other) {\n return new Scalar($receiver.value * other);\n }\n function unaryMinus_0($receiver) {\n return new Scalar(-$receiver.value);\n }\n function compareTo($receiver, i) {\n return Kotlin.compareTo($receiver.value, i);\n }\n function newSpanRectangle(leftTop, rightBottom) {\n return new Rect(leftTop, minus(rightBottom, leftTop));\n }\n function limit($receiver) {\n return boundingBox(asIterable(flatten(asSequence($receiver))));\n }\n function contains_1($receiver, v) {\n return $receiver.origin.x <= v.x && $receiver.origin.x + $receiver.dimension.x >= v.x && $receiver.origin.y <= v.y && $receiver.origin.y + $receiver.dimension.y >= v.y;\n }\n function intersects($receiver, rect) {\n var t1 = $receiver.origin;\n var t2 = plus_4($receiver.origin, $receiver.dimension);\n var r1 = rect.origin;\n var r2 = plus_4(rect.origin, rect.dimension);\n return r2.x >= t1.x && t2.x >= r1.x && r2.y >= t1.y && t2.y >= r1.y;\n }\n function xRange($receiver) {\n return new ClosedRange($receiver.origin.x, $receiver.origin.x + $receiver.dimension.x);\n }\n function yRange($receiver) {\n return new ClosedRange($receiver.origin.y, $receiver.origin.y + $receiver.dimension.y);\n }\n function limit_0($receiver) {\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(limit(item));\n }\n return destination;\n }\n function GeometryType(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function GeometryType_initFields() {\n GeometryType_initFields = function () {\n };\n GeometryType$MULTI_POINT_instance = new GeometryType('MULTI_POINT', 0);\n GeometryType$MULTI_LINESTRING_instance = new GeometryType('MULTI_LINESTRING', 1);\n GeometryType$MULTI_POLYGON_instance = new GeometryType('MULTI_POLYGON', 2);\n }\n var GeometryType$MULTI_POINT_instance;\n function GeometryType$MULTI_POINT_getInstance() {\n GeometryType_initFields();\n return GeometryType$MULTI_POINT_instance;\n }\n var GeometryType$MULTI_LINESTRING_instance;\n function GeometryType$MULTI_LINESTRING_getInstance() {\n GeometryType_initFields();\n return GeometryType$MULTI_LINESTRING_instance;\n }\n var GeometryType$MULTI_POLYGON_instance;\n function GeometryType$MULTI_POLYGON_getInstance() {\n GeometryType_initFields();\n return GeometryType$MULTI_POLYGON_instance;\n }\n GeometryType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeometryType',\n interfaces: [Enum]\n };\n function GeometryType$values() {\n return [GeometryType$MULTI_POINT_getInstance(), GeometryType$MULTI_LINESTRING_getInstance(), GeometryType$MULTI_POLYGON_getInstance()];\n }\n GeometryType.values = GeometryType$values;\n function GeometryType$valueOf(name) {\n switch (name) {\n case 'MULTI_POINT':\n return GeometryType$MULTI_POINT_getInstance();\n case 'MULTI_LINESTRING':\n return GeometryType$MULTI_LINESTRING_getInstance();\n case 'MULTI_POLYGON':\n return GeometryType$MULTI_POLYGON_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.base.typedGeometry.GeometryType.' + name);\n }\n }\n GeometryType.valueOf_61zpoe$ = GeometryType$valueOf;\n function Geometry(type, myMultiPoint, myMultiLineString, myMultiPolygon) {\n Geometry$Companion_getInstance();\n this.type = type;\n this.myMultiPoint_0 = myMultiPoint;\n this.myMultiLineString_0 = myMultiLineString;\n this.myMultiPolygon_0 = myMultiPolygon;\n }\n Object.defineProperty(Geometry.prototype, 'multiPoint', {\n configurable: true,\n get: function () {\n var tmp$;\n var tmp$_0;\n if ((tmp$ = this.myMultiPoint_0) != null)\n tmp$_0 = tmp$;\n else {\n throw IllegalStateException_init((this.type.toString() + ' is not a MultiPoint').toString());\n }\n return tmp$_0;\n }\n });\n Object.defineProperty(Geometry.prototype, 'multiLineString', {\n configurable: true,\n get: function () {\n var tmp$;\n var tmp$_0;\n if ((tmp$ = this.myMultiLineString_0) != null)\n tmp$_0 = tmp$;\n else {\n throw IllegalStateException_init((this.type.toString() + ' is not a MultiLineString').toString());\n }\n return tmp$_0;\n }\n });\n Object.defineProperty(Geometry.prototype, 'multiPolygon', {\n configurable: true,\n get: function () {\n var tmp$;\n var tmp$_0;\n if ((tmp$ = this.myMultiPolygon_0) != null)\n tmp$_0 = tmp$;\n else {\n throw IllegalStateException_init((this.type.toString() + ' is not a MultiPolygon').toString());\n }\n return tmp$_0;\n }\n });\n function Geometry$Companion() {\n Geometry$Companion_instance = this;\n }\n Geometry$Companion.prototype.createMultiPoint_xgn53i$ = function (multiPoint) {\n return new Geometry(GeometryType$MULTI_POINT_getInstance(), multiPoint, null, null);\n };\n Geometry$Companion.prototype.createMultiLineString_bc4hlz$ = function (multiLineString) {\n return new Geometry(GeometryType$MULTI_LINESTRING_getInstance(), null, multiLineString, null);\n };\n Geometry$Companion.prototype.createMultiPolygon_8ft4gs$ = function (multiPolygon) {\n return new Geometry(GeometryType$MULTI_POLYGON_getInstance(), null, null, multiPolygon);\n };\n Geometry$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Geometry$Companion_instance = null;\n function Geometry$Companion_getInstance() {\n if (Geometry$Companion_instance === null) {\n new Geometry$Companion();\n }return Geometry$Companion_instance;\n }\n Geometry.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Geometry',\n interfaces: []\n };\n function LineString(geometry) {\n AbstractGeometryList.call(this, geometry);\n }\n LineString.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LineString',\n interfaces: [AbstractGeometryList]\n };\n function MultiLineString(geometry) {\n AbstractGeometryList.call(this, geometry);\n }\n MultiLineString.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiLineString',\n interfaces: [AbstractGeometryList]\n };\n function MultiPoint(geometry) {\n AbstractGeometryList.call(this, geometry);\n }\n MultiPoint.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiPoint',\n interfaces: [AbstractGeometryList]\n };\n function MultiPolygon(polygons) {\n AbstractGeometryList.call(this, polygons);\n }\n MultiPolygon.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiPolygon',\n interfaces: [AbstractGeometryList]\n };\n function Polygon(rings) {\n AbstractGeometryList.call(this, rings);\n }\n Polygon.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Polygon',\n interfaces: [AbstractGeometryList]\n };\n function Rect(origin, dimension) {\n this.origin = origin;\n this.dimension = dimension;\n }\n Rect.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Rect',\n interfaces: []\n };\n function Rect_init(left, top, width, height, $this) {\n $this = $this || Object.create(Rect.prototype);\n Rect.call($this, new Vec(left, top), new Vec(width, height));\n return $this;\n }\n Rect.prototype.component1 = function () {\n return this.origin;\n };\n Rect.prototype.component2 = function () {\n return this.dimension;\n };\n Rect.prototype.copy_rbt1hw$ = function (origin, dimension) {\n return new Rect(origin === void 0 ? this.origin : origin, dimension === void 0 ? this.dimension : dimension);\n };\n Rect.prototype.toString = function () {\n return 'Rect(origin=' + Kotlin.toString(this.origin) + (', dimension=' + Kotlin.toString(this.dimension)) + ')';\n };\n Rect.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.origin) | 0;\n result = result * 31 + Kotlin.hashCode(this.dimension) | 0;\n return result;\n };\n Rect.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.origin, other.origin) && Kotlin.equals(this.dimension, other.dimension)))));\n };\n function Ring(points) {\n AbstractGeometryList.call(this, points);\n }\n Ring.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Ring',\n interfaces: [AbstractGeometryList]\n };\n function Scalar(value) {\n this.value = value;\n }\n Scalar.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Scalar',\n interfaces: []\n };\n Scalar.prototype.component1 = function () {\n return this.value;\n };\n Scalar.prototype.copy_14dthe$ = function (value) {\n return new Scalar(value === void 0 ? this.value : value);\n };\n Scalar.prototype.toString = function () {\n return 'Scalar(value=' + Kotlin.toString(this.value) + ')';\n };\n Scalar.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.value) | 0;\n return result;\n };\n Scalar.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && Kotlin.equals(this.value, other.value))));\n };\n function Vec(x, y) {\n this.x = x;\n this.y = y;\n }\n Vec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Vec',\n interfaces: []\n };\n function Vec_init(x, y, $this) {\n $this = $this || Object.create(Vec.prototype);\n Vec.call($this, x, y);\n return $this;\n }\n Vec.prototype.component1 = function () {\n return this.x;\n };\n Vec.prototype.component2 = function () {\n return this.y;\n };\n Vec.prototype.copy_lu1900$ = function (x, y) {\n return new Vec(x === void 0 ? this.x : x, y === void 0 ? this.y : y);\n };\n Vec.prototype.toString = function () {\n return 'Vec(x=' + Kotlin.toString(this.x) + (', y=' + Kotlin.toString(this.y)) + ')';\n };\n Vec.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.x) | 0;\n result = result * 31 + Kotlin.hashCode(this.y) | 0;\n return result;\n };\n Vec.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.x, other.x) && Kotlin.equals(this.y, other.y)))));\n };\n function explicitVec(x, y) {\n return new Vec(x, y);\n }\n function explicitVec_0(x, y) {\n return new Vec(x, y);\n }\n function newVec(x, y) {\n return new Vec(x.value, y.value);\n }\n function TypedKey() {\n }\n TypedKey.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'TypedKey',\n interfaces: []\n };\n function TypedKeyHashMap() {\n this.map = HashMap_init_0();\n }\n TypedKeyHashMap.prototype.get_ex36zt$ = function (key) {\n var tmp$;\n if (this.map.containsKey_11rb$(key)) {\n return (tmp$ = this.map.get_11rb$(key)) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();\n }throw new NoSuchElementException_init_0(\"Wasn't found key \" + key);\n };\n TypedKeyHashMap.prototype.set_ev6mlr$ = function (key, value) {\n this.put_ev6mlr$(key, value);\n };\n TypedKeyHashMap.prototype.put_ev6mlr$ = function (key, value) {\n if (value == null) {\n this.map.remove_11rb$(key);\n } else {\n this.map.put_xwzc9p$(key, value);\n }\n };\n TypedKeyHashMap.prototype.contains_ku7evr$ = function (key) {\n return this.containsKey_ex36zt$(key);\n };\n TypedKeyHashMap.prototype.containsKey_ex36zt$ = function (key) {\n return this.map.containsKey_11rb$(key);\n };\n TypedKeyHashMap.prototype.keys_287e2$ = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.map.keys, Set) ? tmp$ : throwCCE();\n };\n TypedKeyHashMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TypedKeyHashMap',\n interfaces: []\n };\n function UNSUPPORTED() {\n throw UnsupportedOperationException_init();\n }\n function UNSUPPORTED_0(what) {\n throw UnsupportedOperationException_init_0(what);\n }\n function Color(red, green, blue, alpha) {\n Color$Companion_getInstance();\n if (alpha === void 0)\n alpha = 255;\n this.red = red;\n this.green = green;\n this.blue = blue;\n this.alpha = alpha;\n if (!(0 <= this.red && this.red <= 255 && 0 <= this.green && this.green <= 255 && 0 <= this.blue && this.blue <= 255 && 0 <= this.alpha && this.alpha <= 255)) {\n var message = 'Color components out of range: ' + this;\n throw IllegalArgumentException_init(message.toString());\n }}\n Color.prototype.changeAlpha_za3lpa$ = function (newAlpha) {\n return new Color(this.red, this.green, this.blue, newAlpha);\n };\n Color.prototype.equals = function (other) {\n if (this === other) {\n return true;\n }if (!Kotlin.isType(other, Color)) {\n return false;\n }if (this.red !== other.red) {\n return false;\n }if (this.green !== other.green) {\n return false;\n }if (this.blue !== other.blue) {\n return false;\n }return this.alpha === other.alpha;\n };\n Color.prototype.toCssColor = function () {\n var tmp$;\n if (this.alpha === 255) {\n tmp$ = 'rgb(' + this.red + ',' + this.green + ',' + this.blue + ')';\n } else {\n tmp$ = 'rgba(' + toString(this.red) + ',' + toString(this.green) + ',' + toString(this.blue) + ',' + toString(this.alpha / 255.0) + ')';\n }\n return tmp$;\n };\n Color.prototype.toHexColor = function () {\n return '#' + Color$Companion_getInstance().toColorPart_0(this.red) + Color$Companion_getInstance().toColorPart_0(this.green) + Color$Companion_getInstance().toColorPart_0(this.blue);\n };\n Color.prototype.hashCode = function () {\n var result = 0;\n result = (31 * result | 0) + this.red | 0;\n result = (31 * result | 0) + this.green | 0;\n result = (31 * result | 0) + this.blue | 0;\n result = (31 * result | 0) + this.alpha | 0;\n return result;\n };\n Color.prototype.toString = function () {\n return 'color(' + this.red + ',' + this.green + ',' + this.blue + ',' + this.alpha + ')';\n };\n function Color$Companion() {\n Color$Companion_instance = this;\n this.TRANSPARENT = new Color(0, 0, 0, 0);\n this.WHITE = new Color(255, 255, 255);\n this.CONSOLE_WHITE = new Color(204, 204, 204);\n this.BLACK = new Color(0, 0, 0);\n this.LIGHT_GRAY = new Color(192, 192, 192);\n this.VERY_LIGHT_GRAY = new Color(210, 210, 210);\n this.GRAY = new Color(128, 128, 128);\n this.RED = new Color(255, 0, 0);\n this.LIGHT_GREEN = new Color(210, 255, 210);\n this.GREEN = new Color(0, 255, 0);\n this.DARK_GREEN = new Color(0, 128, 0);\n this.BLUE = new Color(0, 0, 255);\n this.DARK_BLUE = new Color(0, 0, 128);\n this.LIGHT_BLUE = new Color(210, 210, 255);\n this.YELLOW = new Color(255, 255, 0);\n this.CONSOLE_YELLOW = new Color(174, 174, 36);\n this.LIGHT_YELLOW = new Color(255, 255, 128);\n this.VERY_LIGHT_YELLOW = new Color(255, 255, 210);\n this.MAGENTA = new Color(255, 0, 255);\n this.LIGHT_MAGENTA = new Color(255, 210, 255);\n this.DARK_MAGENTA = new Color(128, 0, 128);\n this.CYAN = new Color(0, 255, 255);\n this.LIGHT_CYAN = new Color(210, 255, 255);\n this.ORANGE = new Color(255, 192, 0);\n this.PINK = new Color(255, 175, 175);\n this.LIGHT_PINK = new Color(255, 210, 210);\n this.PACIFIC_BLUE = this.parseHex_61zpoe$('#118ED8');\n this.RGB_0 = 'rgb';\n this.COLOR_0 = 'color';\n this.RGBA_0 = 'rgba';\n }\n Color$Companion.prototype.parseRGB_61zpoe$ = function (text) {\n var firstParen = this.findNext_0(text, '(', 0);\n var prefix = text.substring(0, firstParen);\n var firstComma = this.findNext_0(text, ',', firstParen + 1 | 0);\n var secondComma = this.findNext_0(text, ',', firstComma + 1 | 0);\n var thirdComma = -1;\n if (equals(prefix, this.RGBA_0))\n thirdComma = this.findNext_0(text, ',', secondComma + 1 | 0);\n else if (equals(prefix, this.COLOR_0))\n thirdComma = indexOf(text, ',', secondComma + 1 | 0);\n else if (!equals(prefix, this.RGB_0))\n throw IllegalArgumentException_init(text);\n var lastParen = this.findNext_0(text, ')', thirdComma + 1 | 0);\n var startIndex = firstParen + 1 | 0;\n var $receiver = text.substring(startIndex, firstComma);\n var tmp$;\n var $receiver_0 = Kotlin.isCharSequence(tmp$ = $receiver) ? tmp$ : throwCCE();\n var startIndex_0 = 0;\n var endIndex = $receiver_0.length - 1 | 0;\n var startFound = false;\n while (startIndex_0 <= endIndex) {\n var index = !startFound ? startIndex_0 : endIndex;\n var match = unboxChar(toBoxedChar($receiver_0.charCodeAt(index))) <= 32;\n if (!startFound) {\n if (!match)\n startFound = true;\n else\n startIndex_0 = startIndex_0 + 1 | 0;\n } else {\n if (!match)\n break;\n else\n endIndex = endIndex - 1 | 0;\n }\n }\n var red = toInt(Kotlin.subSequence($receiver_0, startIndex_0, endIndex + 1 | 0).toString());\n var startIndex_1 = firstComma + 1 | 0;\n var $receiver_1 = text.substring(startIndex_1, secondComma);\n var tmp$_0;\n var $receiver_0_0 = Kotlin.isCharSequence(tmp$_0 = $receiver_1) ? tmp$_0 : throwCCE();\n var startIndex_2 = 0;\n var endIndex_0 = $receiver_0_0.length - 1 | 0;\n var startFound_0 = false;\n while (startIndex_2 <= endIndex_0) {\n var index_0 = !startFound_0 ? startIndex_2 : endIndex_0;\n var match_0 = unboxChar(toBoxedChar($receiver_0_0.charCodeAt(index_0))) <= 32;\n if (!startFound_0) {\n if (!match_0)\n startFound_0 = true;\n else\n startIndex_2 = startIndex_2 + 1 | 0;\n } else {\n if (!match_0)\n break;\n else\n endIndex_0 = endIndex_0 - 1 | 0;\n }\n }\n var green = toInt(Kotlin.subSequence($receiver_0_0, startIndex_2, endIndex_0 + 1 | 0).toString());\n var blue;\n var alpha;\n if (thirdComma === -1) {\n var startIndex_3 = secondComma + 1 | 0;\n var $receiver_2 = text.substring(startIndex_3, lastParen);\n var tmp$_1;\n var $receiver_0_1 = Kotlin.isCharSequence(tmp$_1 = $receiver_2) ? tmp$_1 : throwCCE();\n var startIndex_4 = 0;\n var endIndex_1 = $receiver_0_1.length - 1 | 0;\n var startFound_1 = false;\n while (startIndex_4 <= endIndex_1) {\n var index_1 = !startFound_1 ? startIndex_4 : endIndex_1;\n var match_1 = unboxChar(toBoxedChar($receiver_0_1.charCodeAt(index_1))) <= 32;\n if (!startFound_1) {\n if (!match_1)\n startFound_1 = true;\n else\n startIndex_4 = startIndex_4 + 1 | 0;\n } else {\n if (!match_1)\n break;\n else\n endIndex_1 = endIndex_1 - 1 | 0;\n }\n }\n blue = toInt(Kotlin.subSequence($receiver_0_1, startIndex_4, endIndex_1 + 1 | 0).toString());\n alpha = 255;\n } else {\n var startIndex_5 = secondComma + 1 | 0;\n var endIndex_2 = thirdComma;\n var $receiver_3 = text.substring(startIndex_5, endIndex_2);\n var tmp$_2;\n var $receiver_0_2 = Kotlin.isCharSequence(tmp$_2 = $receiver_3) ? tmp$_2 : throwCCE();\n var startIndex_6 = 0;\n var endIndex_3 = $receiver_0_2.length - 1 | 0;\n var startFound_2 = false;\n while (startIndex_6 <= endIndex_3) {\n var index_2 = !startFound_2 ? startIndex_6 : endIndex_3;\n var match_2 = unboxChar(toBoxedChar($receiver_0_2.charCodeAt(index_2))) <= 32;\n if (!startFound_2) {\n if (!match_2)\n startFound_2 = true;\n else\n startIndex_6 = startIndex_6 + 1 | 0;\n } else {\n if (!match_2)\n break;\n else\n endIndex_3 = endIndex_3 - 1 | 0;\n }\n }\n blue = toInt(Kotlin.subSequence($receiver_0_2, startIndex_6, endIndex_3 + 1 | 0).toString());\n var startIndex_7 = thirdComma + 1 | 0;\n var $receiver_4 = text.substring(startIndex_7, lastParen);\n var tmp$_3;\n var $receiver_0_3 = Kotlin.isCharSequence(tmp$_3 = $receiver_4) ? tmp$_3 : throwCCE();\n var startIndex_8 = 0;\n var endIndex_4 = $receiver_0_3.length - 1 | 0;\n var startFound_3 = false;\n while (startIndex_8 <= endIndex_4) {\n var index_3 = !startFound_3 ? startIndex_8 : endIndex_4;\n var match_3 = unboxChar(toBoxedChar($receiver_0_3.charCodeAt(index_3))) <= 32;\n if (!startFound_3) {\n if (!match_3)\n startFound_3 = true;\n else\n startIndex_8 = startIndex_8 + 1 | 0;\n } else {\n if (!match_3)\n break;\n else\n endIndex_4 = endIndex_4 - 1 | 0;\n }\n }\n alpha = roundToInt(toDouble(Kotlin.subSequence($receiver_0_3, startIndex_8, endIndex_4 + 1 | 0).toString()) * 255);\n }\n return new Color(red, green, blue, alpha);\n };\n Color$Companion.prototype.findNext_0 = function (s, what, from) {\n var result = indexOf(s, what, from);\n if (result === -1) {\n throw IllegalArgumentException_init('text=' + s + ' what=' + what + ' from=' + from);\n }return result;\n };\n Color$Companion.prototype.parseHex_61zpoe$ = function (hexColor) {\n var hexColor_0 = hexColor;\n if (!startsWith_0(hexColor_0, '#')) {\n throw IllegalArgumentException_init('Not a HEX value: ' + hexColor_0);\n }hexColor_0 = hexColor_0.substring(1);\n if (hexColor_0.length !== 6) {\n throw IllegalArgumentException_init('Not a HEX value: ' + hexColor_0);\n }var r = toInt_0(hexColor_0.substring(0, 2), 16);\n var g = toInt_0(hexColor_0.substring(2, 4), 16);\n var b = toInt_0(hexColor_0.substring(4, 6), 16);\n return new Color(r, g, b);\n };\n Color$Companion.prototype.toColorPart_0 = function (value) {\n var tmp$;\n if (value < 0 || value > 255) {\n throw IllegalArgumentException_init('RGB color part must be in range [0..255] but was ' + value);\n }var result = toString_0(value, 16);\n if (result.length === 1) {\n tmp$ = '0' + result;\n } else {\n tmp$ = result;\n }\n return tmp$;\n };\n Color$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Color$Companion_instance = null;\n function Color$Companion_getInstance() {\n if (Color$Companion_instance === null) {\n new Color$Companion();\n }return Color$Companion_instance;\n }\n Color.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Color',\n interfaces: []\n };\n function Colors() {\n Colors_instance = this;\n this.DEFAULT_FACTOR_0 = 0.7;\n this.variantColors_0 = mapOf([to('dark_blue', Color$Companion_getInstance().DARK_BLUE), to('dark_green', Color$Companion_getInstance().DARK_GREEN), to('dark_magenta', Color$Companion_getInstance().DARK_MAGENTA), to('light_blue', Color$Companion_getInstance().LIGHT_BLUE), to('light_gray', Color$Companion_getInstance().LIGHT_GRAY), to('light_green', Color$Companion_getInstance().LIGHT_GREEN), to('light_yellow', Color$Companion_getInstance().LIGHT_YELLOW), to('light_magenta', Color$Companion_getInstance().LIGHT_MAGENTA), to('light_cyan', Color$Companion_getInstance().LIGHT_CYAN), to('light_pink', Color$Companion_getInstance().LIGHT_PINK), to('very_light_gray', Color$Companion_getInstance().VERY_LIGHT_GRAY), to('very_light_yellow', Color$Companion_getInstance().VERY_LIGHT_YELLOW)]);\n var tmp$ = plus_3(mapOf([to('white', Color$Companion_getInstance().WHITE), to('black', Color$Companion_getInstance().BLACK), to('gray', Color$Companion_getInstance().GRAY), to('red', Color$Companion_getInstance().RED), to('green', Color$Companion_getInstance().GREEN), to('blue', Color$Companion_getInstance().BLUE), to('yellow', Color$Companion_getInstance().YELLOW), to('magenta', Color$Companion_getInstance().MAGENTA), to('cyan', Color$Companion_getInstance().CYAN), to('orange', Color$Companion_getInstance().ORANGE), to('pink', Color$Companion_getInstance().PINK)]), this.variantColors_0);\n var $receiver = this.variantColors_0;\n var destination = LinkedHashMap_init_0(mapCapacity($receiver.size));\n var tmp$_0;\n tmp$_0 = $receiver.entries.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n destination.put_xwzc9p$(replace_0(element.key, 95, 45), element.value);\n }\n var tmp$_1 = plus_3(tmp$, destination);\n var $receiver_0 = this.variantColors_0;\n var destination_0 = LinkedHashMap_init_0(mapCapacity($receiver_0.size));\n var tmp$_2;\n tmp$_2 = $receiver_0.entries.iterator();\n while (tmp$_2.hasNext()) {\n var element_0 = tmp$_2.next();\n destination_0.put_xwzc9p$(replace(element_0.key, '_', ''), element_0.value);\n }\n this.namedColors_0 = plus_3(tmp$_1, destination_0);\n }\n Colors.prototype.parseColor_61zpoe$ = function (c) {\n var tmp$;\n if (indexOf_0(c, 40) > 0)\n tmp$ = Color$Companion_getInstance().parseRGB_61zpoe$(c);\n else if (startsWith_0(c, '#'))\n tmp$ = Color$Companion_getInstance().parseHex_61zpoe$(c);\n else if (this.isColorName_61zpoe$(c))\n tmp$ = this.forName_61zpoe$(c);\n else\n throw IllegalArgumentException_init('Error persing color value: ' + c);\n return tmp$;\n };\n Colors.prototype.isColorName_61zpoe$ = function (colorName) {\n return this.namedColors_0.containsKey_11rb$(colorName.toLowerCase());\n };\n Colors.prototype.forName_61zpoe$ = function (colorName) {\n var tmp$;\n tmp$ = this.namedColors_0.get_11rb$(colorName.toLowerCase());\n if (tmp$ == null) {\n throw IllegalArgumentException_init_0();\n }return tmp$;\n };\n Colors.prototype.generateHueColor = function () {\n return 360 * Random.Default.nextDouble();\n };\n Colors.prototype.generateColor_lu1900$ = function (s, v) {\n return this.rgbFromHsv_yvo9jy$(360 * Random.Default.nextDouble(), s, v);\n };\n Colors.prototype.rgbFromHsv_yvo9jy$ = function (h, s, v) {\n if (v === void 0)\n v = 1.0;\n var hd = h / 60;\n var c = v * s;\n var x = hd % 2 - 1;\n var x_0 = c * (1 - JsMath.abs(x));\n var r = 0.0;\n var g = 0.0;\n var b = 0.0;\n if (hd < 1) {\n r = c;\n g = x_0;\n } else if (hd < 2) {\n r = x_0;\n g = c;\n } else if (hd < 3) {\n g = c;\n b = x_0;\n } else if (hd < 4) {\n g = x_0;\n b = c;\n } else if (hd < 5) {\n r = x_0;\n b = c;\n } else {\n r = c;\n b = x_0;\n }\n var m = v - c;\n return new Color(numberToInt(255 * (r + m)), numberToInt(255 * (g + m)), numberToInt(255 * (b + m)));\n };\n Colors.prototype.hsvFromRgb_98b62m$ = function (color) {\n var tmp$;\n var scale = 1.0 / 255;\n var r = color.red * scale;\n var g = color.green * scale;\n var b = color.blue * scale;\n var b_0 = JsMath.min(g, b);\n var min = JsMath.min(r, b_0);\n var b_1 = JsMath.max(g, b);\n var max = JsMath.max(r, b_1);\n var v = max === 0.0 ? 0.0 : 1 - min / max;\n var h;\n var div = 1.0 / (6 * (max - min));\n if (max === min) {\n tmp$ = 0.0;\n } else if (max === r) {\n tmp$ = g >= b ? (g - b) * div : 1 + (g - b) * div;\n } else if (max === g) {\n tmp$ = 1.0 / 3 + (b - r) * div;\n } else {\n tmp$ = 2.0 / 3 + (r - g) * div;\n }\n h = tmp$;\n return new Float64Array([360 * h, v, max]);\n };\n Colors.prototype.darker_w32t8z$ = function (c, factor) {\n if (factor === void 0)\n factor = this.DEFAULT_FACTOR_0;\n var tmp$;\n if (c != null) {\n var a = numberToInt(c.red * factor);\n var tmp$_0 = JsMath.max(a, 0);\n var a_0 = numberToInt(c.green * factor);\n var tmp$_1 = JsMath.max(a_0, 0);\n var a_1 = numberToInt(c.blue * factor);\n tmp$ = new Color(tmp$_0, tmp$_1, JsMath.max(a_1, 0), c.alpha);\n } else\n tmp$ = null;\n return tmp$;\n };\n Colors.prototype.lighter_o14uds$ = function (c, factor) {\n if (factor === void 0)\n factor = this.DEFAULT_FACTOR_0;\n var r = c.red;\n var g = c.green;\n var b = c.blue;\n var alpha = c.alpha;\n var i = numberToInt(1.0 / (1.0 - factor));\n if (r === 0 && g === 0 && b === 0) {\n return new Color(i, i, i, alpha);\n }if (r > 0 && r < i)\n r = i;\n if (g > 0 && g < i)\n g = i;\n if (b > 0 && b < i)\n b = i;\n var a = numberToInt(r / factor);\n var tmp$ = JsMath.min(a, 255);\n var a_0 = numberToInt(g / factor);\n var tmp$_0 = JsMath.min(a_0, 255);\n var a_1 = numberToInt(b / factor);\n return new Color(tmp$, tmp$_0, JsMath.min(a_1, 255), alpha);\n };\n Colors.prototype.mimicTransparency_w1v12e$ = function (color, alpha, background) {\n var red = numberToInt(color.red * alpha + background.red * (1 - alpha));\n var green = numberToInt(color.green * alpha + background.green * (1 - alpha));\n var blue = numberToInt(color.blue * alpha + background.blue * (1 - alpha));\n return new Color(red, green, blue);\n };\n Colors.prototype.withOpacity_o14uds$ = function (c, opacity) {\n var tmp$;\n if (opacity < 1.0) {\n var b = numberToInt(round(255 * opacity));\n var b_0 = JsMath.min(255, b);\n tmp$ = c.changeAlpha_za3lpa$(JsMath.max(0, b_0));\n } else\n tmp$ = c;\n return tmp$;\n };\n Colors.prototype.contrast_a87jzg$ = function (color, other) {\n return (this.luminance_98b62m$(color) + 0.05) / (this.luminance_98b62m$(other) + 0.05);\n };\n Colors.prototype.luminance_98b62m$ = function (color) {\n return 0.2126 * this.colorLuminance_0(color.red) + 0.7152 * this.colorLuminance_0(color.green) + 0.0722 * this.colorLuminance_0(color.blue);\n };\n Colors.prototype.colorLuminance_0 = function (componentValue) {\n var tmp$;\n if (componentValue <= 10)\n tmp$ = componentValue / 3294.0;\n else {\n var $receiver = componentValue / 269.0 + 0.0513;\n tmp$ = JsMath.pow($receiver, 2.4);\n }\n return tmp$;\n };\n Colors.prototype.solid_98b62m$ = function (c) {\n return c.alpha === 255;\n };\n Colors.prototype.distributeEvenly_5wr77w$ = function (count, saturation) {\n var tmp$;\n var result = Kotlin.newArray(count, null);\n var sector = 360 / count | 0;\n for (var i = 0; i < count; i++) {\n result[i] = this.rgbFromHsv_yvo9jy$(Kotlin.imul(sector, i), saturation);\n }\n return Kotlin.isArray(tmp$ = result) ? tmp$ : throwCCE();\n };\n Colors.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Colors',\n interfaces: []\n };\n var Colors_instance = null;\n function Colors_getInstance() {\n if (Colors_instance === null) {\n new Colors();\n }return Colors_instance;\n }\n function toPngDataUri(base64EncodedPngImage) {\n return 'data:image/png;base64,' + base64EncodedPngImage;\n }\n function Font(family, size, isBold, isItalic) {\n if (isBold === void 0)\n isBold = false;\n if (isItalic === void 0)\n isItalic = false;\n this.family = family;\n this.size = size;\n this.isBold = isBold;\n this.isItalic = isItalic;\n }\n Font.prototype.toString = function () {\n return this.family.toString() + ' ' + this.size + ' ' + (this.isBold ? 'bold' : '') + ' ' + (this.isItalic ? 'italic' : '');\n };\n Font.prototype.equals = function (other) {\n if (this === other)\n return true;\n if (!Kotlin.isType(other, Font))\n return false;\n return this.family === other.family && this.size === other.size && this.isBold === other.isBold && this.isItalic === other.isItalic;\n };\n Font.prototype.hashCode = function () {\n var result = hashCode(this.family);\n result = (31 * result | 0) + this.size | 0;\n result = (31 * result | 0) + (this.isBold ? 1 : 0) | 0;\n result = (31 * result | 0) + (this.isItalic ? 1 : 0) | 0;\n return result;\n };\n Font.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Font',\n interfaces: []\n };\n function FontFamily(myName) {\n FontFamily$Companion_getInstance();\n this.myName_0 = myName;\n }\n FontFamily.prototype.toString = function () {\n return this.myName_0;\n };\n function FontFamily$Companion() {\n FontFamily$Companion_instance = this;\n this.MONOSPACED = this.forName_61zpoe$('monospace');\n this.SERIF = this.forName_61zpoe$('serif');\n }\n FontFamily$Companion.prototype.forName_61zpoe$ = function (name) {\n return new FontFamily(name);\n };\n FontFamily$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var FontFamily$Companion_instance = null;\n function FontFamily$Companion_getInstance() {\n if (FontFamily$Companion_instance === null) {\n new FontFamily$Companion();\n }return FontFamily$Companion_instance;\n }\n FontFamily.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FontFamily',\n interfaces: []\n };\n function HSV(h, saturation, value) {\n if (value === void 0)\n value = 1.0;\n this.h = h;\n this.s = 0;\n this.v = 0;\n if (!(saturation >= -0.001 && saturation <= 1.001)) {\n var message = \"HSV 'saturation' must be in range [0, 1] but was \" + saturation;\n throw IllegalArgumentException_init(message.toString());\n }if (!(value >= -0.001 && value <= 1.001)) {\n var message_0 = \"HSV 'value' must be in range [0, 1] but was \" + value;\n throw IllegalArgumentException_init(message_0.toString());\n }var x = numberToInt(saturation * 100) / 100.0;\n this.s = JsMath.abs(x);\n var x_0 = numberToInt(value * 100) / 100.0;\n this.v = JsMath.abs(x_0);\n }\n HSV.prototype.toString = function () {\n return 'HSV(' + this.h + ', ' + this.s + ', ' + this.v + ')';\n };\n HSV.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HSV',\n interfaces: []\n };\n function Interval(lowerBound, upperBound) {\n this.lowerBound = lowerBound;\n this.upperBound = upperBound;\n if (this.lowerBound > this.upperBound) {\n throw IllegalArgumentException_init('Lower bound is greater than upper: lower bound=' + toString(this.lowerBound) + ', upper bound=' + toString(this.upperBound));\n }}\n Object.defineProperty(Interval.prototype, 'length', {\n configurable: true,\n get: function () {\n return this.upperBound - this.lowerBound | 0;\n }\n });\n Interval.prototype.contains_za3lpa$ = function (point) {\n return this.lowerBound <= point && point <= this.upperBound;\n };\n Interval.prototype.contains_fvoaba$ = function (other) {\n return this.contains_za3lpa$(other.lowerBound) && this.contains_za3lpa$(other.upperBound);\n };\n Interval.prototype.intersects_fvoaba$ = function (other) {\n return this.contains_za3lpa$(other.lowerBound) || other.contains_za3lpa$(this.lowerBound);\n };\n Interval.prototype.union_fvoaba$ = function (other) {\n var a = this.lowerBound;\n var b = other.lowerBound;\n var tmp$ = JsMath.min(a, b);\n var a_0 = this.upperBound;\n var b_0 = other.upperBound;\n return new Interval(tmp$, JsMath.max(a_0, b_0));\n };\n Interval.prototype.add_za3lpa$ = function (delta) {\n return new Interval(this.lowerBound + delta | 0, this.upperBound + delta | 0);\n };\n Interval.prototype.sub_za3lpa$ = function (delta) {\n return new Interval(this.lowerBound - delta | 0, this.upperBound - delta | 0);\n };\n Interval.prototype.toString = function () {\n return '[' + this.lowerBound + ', ' + this.upperBound + ']';\n };\n Interval.prototype.equals = function (other) {\n var tmp$;\n if (this === other)\n return true;\n if (!Kotlin.isType(other, Interval))\n return false;\n var interval = (tmp$ = other) == null || Kotlin.isType(tmp$, Interval) ? tmp$ : throwCCE();\n return this.lowerBound !== ensureNotNull(interval).lowerBound ? false : this.upperBound === interval.upperBound;\n };\n Interval.prototype.hashCode = function () {\n var result = this.lowerBound;\n result = (31 * result | 0) + this.upperBound | 0;\n return result;\n };\n Interval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Interval',\n interfaces: []\n };\n function Pair_0(first, second) {\n this.first = first;\n this.second = second;\n }\n Pair_0.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, Pair_0) ? tmp$_0 : throwCCE();\n if (!equals(this.first, other.first))\n return false;\n if (!equals(this.second, other.second))\n return false;\n return true;\n };\n Pair_0.prototype.hashCode = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var result = (tmp$_0 = (tmp$ = this.first) != null ? hashCode(tmp$) : null) != null ? tmp$_0 : 0;\n result = (31 * result | 0) + ((tmp$_2 = (tmp$_1 = this.second) != null ? hashCode(tmp$_1) : null) != null ? tmp$_2 : 0) | 0;\n return result;\n };\n Pair_0.prototype.toString = function () {\n return '[' + this.first + ', ' + this.second + ']';\n };\n Pair_0.prototype.component1 = function () {\n return this.first;\n };\n Pair_0.prototype.component2 = function () {\n return this.second;\n };\n Pair_0.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Pair',\n interfaces: []\n };\n function SomeFig() {\n }\n SomeFig.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'SomeFig',\n interfaces: []\n };\n function PortableLogging() {\n PortableLogging_instance = this;\n }\n function PortableLogging$logger$ObjectLiteral(closure$kl) {\n this.closure$kl = closure$kl;\n }\n PortableLogging$logger$ObjectLiteral.prototype.error_l35kib$ = function (e, message) {\n this.closure$kl.error_ca4k3s$(e, message);\n };\n PortableLogging$logger$ObjectLiteral.prototype.info_h4ejuu$ = function (message) {\n this.closure$kl.info_nq59yw$(message);\n };\n PortableLogging$logger$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Logger]\n };\n PortableLogging.prototype.logger_xo1ogr$ = function (cl) {\n var tmp$;\n var kl = mu.KotlinLogging.logger_61zpoe$((tmp$ = cl.simpleName) != null ? tmp$ : '');\n return new PortableLogging$logger$ObjectLiteral(kl);\n };\n PortableLogging.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PortableLogging',\n interfaces: []\n };\n var PortableLogging_instance = null;\n function PortableLogging_getInstance() {\n if (PortableLogging_instance === null) {\n new PortableLogging();\n }return PortableLogging_instance;\n }\n var package$jetbrains = _.jetbrains || (_.jetbrains = {});\n var package$datalore = package$jetbrains.datalore || (package$jetbrains.datalore = {});\n var package$base = package$datalore.base || (package$datalore.base = {});\n var package$algorithms = package$base.algorithms || (package$base.algorithms = {});\n package$algorithms.splitRings_bemo1h$ = splitRings;\n package$algorithms.isClosed_2p1efm$ = isClosed;\n package$algorithms.calculateArea_ytws2g$ = calculateArea;\n package$algorithms.isClockwise_st9g9f$ = isClockwise;\n package$algorithms.calculateArea_st9g9f$ = calculateArea_0;\n var package$dateFormat = package$base.dateFormat || (package$base.dateFormat = {});\n Object.defineProperty(package$dateFormat, 'DateLocale', {\n get: DateLocale_getInstance\n });\n Format.SpecPart = Format$SpecPart;\n Format.PatternSpecPart = Format$PatternSpecPart;\n Object.defineProperty(Format, 'Companion', {\n get: Format$Companion_getInstance\n });\n package$dateFormat.Format_init_61zpoe$ = Format_init;\n package$dateFormat.Format = Format;\n Object.defineProperty(Pattern, 'DAY_OF_WEEK_ABBR', {\n get: Pattern$DAY_OF_WEEK_ABBR_getInstance\n });\n Object.defineProperty(Pattern, 'DAY_OF_WEEK_FULL', {\n get: Pattern$DAY_OF_WEEK_FULL_getInstance\n });\n Object.defineProperty(Pattern, 'MONTH_ABBR', {\n get: Pattern$MONTH_ABBR_getInstance\n });\n Object.defineProperty(Pattern, 'MONTH_FULL', {\n get: Pattern$MONTH_FULL_getInstance\n });\n Object.defineProperty(Pattern, 'DAY_OF_MONTH_LEADING_ZERO', {\n get: Pattern$DAY_OF_MONTH_LEADING_ZERO_getInstance\n });\n Object.defineProperty(Pattern, 'DAY_OF_MONTH', {\n get: Pattern$DAY_OF_MONTH_getInstance\n });\n Object.defineProperty(Pattern, 'DAY_OF_THE_YEAR', {\n get: Pattern$DAY_OF_THE_YEAR_getInstance\n });\n Object.defineProperty(Pattern, 'MONTH', {\n get: Pattern$MONTH_getInstance\n });\n Object.defineProperty(Pattern, 'DAY_OF_WEEK', {\n get: Pattern$DAY_OF_WEEK_getInstance\n });\n Object.defineProperty(Pattern, 'YEAR_SHORT', {\n get: Pattern$YEAR_SHORT_getInstance\n });\n Object.defineProperty(Pattern, 'YEAR_FULL', {\n get: Pattern$YEAR_FULL_getInstance\n });\n Object.defineProperty(Pattern, 'HOUR_24', {\n get: Pattern$HOUR_24_getInstance\n });\n Object.defineProperty(Pattern, 'HOUR_12_LEADING_ZERO', {\n get: Pattern$HOUR_12_LEADING_ZERO_getInstance\n });\n Object.defineProperty(Pattern, 'HOUR_12', {\n get: Pattern$HOUR_12_getInstance\n });\n Object.defineProperty(Pattern, 'MINUTE', {\n get: Pattern$MINUTE_getInstance\n });\n Object.defineProperty(Pattern, 'MERIDIAN_LOWER', {\n get: Pattern$MERIDIAN_LOWER_getInstance\n });\n Object.defineProperty(Pattern, 'MERIDIAN_UPPER', {\n get: Pattern$MERIDIAN_UPPER_getInstance\n });\n Object.defineProperty(Pattern, 'SECOND', {\n get: Pattern$SECOND_getInstance\n });\n Object.defineProperty(Pattern$Companion$Kind, 'DATE', {\n get: Pattern$Companion$Kind$DATE_getInstance\n });\n Object.defineProperty(Pattern$Companion$Kind, 'TIME', {\n get: Pattern$Companion$Kind$TIME_getInstance\n });\n Pattern$Companion.prototype.Kind = Pattern$Companion$Kind;\n Object.defineProperty(Pattern, 'Companion', {\n get: Pattern$Companion_getInstance\n });\n package$dateFormat.Pattern = Pattern;\n Object.defineProperty(Date_0, 'Companion', {\n get: Date$Companion_getInstance\n });\n var package$datetime = package$base.datetime || (package$base.datetime = {});\n package$datetime.Date = Date_0;\n Object.defineProperty(DateTime, 'Companion', {\n get: DateTime$Companion_getInstance\n });\n package$datetime.DateTime = DateTime;\n Object.defineProperty(package$datetime, 'DateTimeUtil', {\n get: DateTimeUtil_getInstance\n });\n Object.defineProperty(Duration, 'Companion', {\n get: Duration$Companion_getInstance\n });\n package$datetime.Duration = Duration;\n package$datetime.Instant = Instant;\n Object.defineProperty(Month, 'Companion', {\n get: Month$Companion_getInstance\n });\n package$datetime.Month = Month;\n Object.defineProperty(Time, 'Companion', {\n get: Time$Companion_getInstance\n });\n package$datetime.Time = Time;\n Object.defineProperty(WeekDay, 'MONDAY', {\n get: WeekDay$MONDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'TUESDAY', {\n get: WeekDay$TUESDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'WEDNESDAY', {\n get: WeekDay$WEDNESDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'THURSDAY', {\n get: WeekDay$THURSDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'FRIDAY', {\n get: WeekDay$FRIDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'SATURDAY', {\n get: WeekDay$SATURDAY_getInstance\n });\n Object.defineProperty(WeekDay, 'SUNDAY', {\n get: WeekDay$SUNDAY_getInstance\n });\n package$datetime.WeekDay = WeekDay;\n var package$tz = package$datetime.tz || (package$datetime.tz = {});\n package$tz.DateSpec = DateSpec;\n Object.defineProperty(package$tz, 'DateSpecs', {\n get: DateSpecs_getInstance\n });\n Object.defineProperty(TimeZone, 'Companion', {\n get: TimeZone$Companion_getInstance\n });\n package$tz.TimeZone = TimeZone;\n Object.defineProperty(TimeZoneMoscow, 'Companion', {\n get: TimeZoneMoscow$Companion_getInstance\n });\n package$tz.TimeZoneMoscow = TimeZoneMoscow;\n Object.defineProperty(package$tz, 'TimeZones', {\n get: TimeZones_getInstance\n });\n var package$enums = package$base.enums || (package$base.enums = {});\n package$enums.EnumInfo = EnumInfo;\n Object.defineProperty(package$enums, 'EnumInfoFactory', {\n get: EnumInfoFactory_getInstance\n });\n package$enums.EnumInfoImpl = EnumInfoImpl;\n Object.defineProperty(package$enums, 'Enums', {\n get: Enums_getInstance\n });\n Object.defineProperty(Button, 'NONE', {\n get: Button$NONE_getInstance\n });\n Object.defineProperty(Button, 'LEFT', {\n get: Button$LEFT_getInstance\n });\n Object.defineProperty(Button, 'MIDDLE', {\n get: Button$MIDDLE_getInstance\n });\n Object.defineProperty(Button, 'RIGHT', {\n get: Button$RIGHT_getInstance\n });\n var package$event = package$base.event || (package$base.event = {});\n package$event.Button = Button;\n package$event.Event = Event;\n package$event.EventContext = EventContext;\n Object.defineProperty(Key, 'A', {\n get: Key$A_getInstance\n });\n Object.defineProperty(Key, 'B', {\n get: Key$B_getInstance\n });\n Object.defineProperty(Key, 'C', {\n get: Key$C_getInstance\n });\n Object.defineProperty(Key, 'D', {\n get: Key$D_getInstance\n });\n Object.defineProperty(Key, 'E', {\n get: Key$E_getInstance\n });\n Object.defineProperty(Key, 'F', {\n get: Key$F_getInstance\n });\n Object.defineProperty(Key, 'G', {\n get: Key$G_getInstance\n });\n Object.defineProperty(Key, 'H', {\n get: Key$H_getInstance\n });\n Object.defineProperty(Key, 'I', {\n get: Key$I_getInstance\n });\n Object.defineProperty(Key, 'J', {\n get: Key$J_getInstance\n });\n Object.defineProperty(Key, 'K', {\n get: Key$K_getInstance\n });\n Object.defineProperty(Key, 'L', {\n get: Key$L_getInstance\n });\n Object.defineProperty(Key, 'M', {\n get: Key$M_getInstance\n });\n Object.defineProperty(Key, 'N', {\n get: Key$N_getInstance\n });\n Object.defineProperty(Key, 'O', {\n get: Key$O_getInstance\n });\n Object.defineProperty(Key, 'P', {\n get: Key$P_getInstance\n });\n Object.defineProperty(Key, 'Q', {\n get: Key$Q_getInstance\n });\n Object.defineProperty(Key, 'R', {\n get: Key$R_getInstance\n });\n Object.defineProperty(Key, 'S', {\n get: Key$S_getInstance\n });\n Object.defineProperty(Key, 'T', {\n get: Key$T_getInstance\n });\n Object.defineProperty(Key, 'U', {\n get: Key$U_getInstance\n });\n Object.defineProperty(Key, 'V', {\n get: Key$V_getInstance\n });\n Object.defineProperty(Key, 'W', {\n get: Key$W_getInstance\n });\n Object.defineProperty(Key, 'X', {\n get: Key$X_getInstance\n });\n Object.defineProperty(Key, 'Y', {\n get: Key$Y_getInstance\n });\n Object.defineProperty(Key, 'Z', {\n get: Key$Z_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_0', {\n get: Key$DIGIT_0_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_1', {\n get: Key$DIGIT_1_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_2', {\n get: Key$DIGIT_2_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_3', {\n get: Key$DIGIT_3_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_4', {\n get: Key$DIGIT_4_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_5', {\n get: Key$DIGIT_5_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_6', {\n get: Key$DIGIT_6_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_7', {\n get: Key$DIGIT_7_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_8', {\n get: Key$DIGIT_8_getInstance\n });\n Object.defineProperty(Key, 'DIGIT_9', {\n get: Key$DIGIT_9_getInstance\n });\n Object.defineProperty(Key, 'LEFT_BRACE', {\n get: Key$LEFT_BRACE_getInstance\n });\n Object.defineProperty(Key, 'RIGHT_BRACE', {\n get: Key$RIGHT_BRACE_getInstance\n });\n Object.defineProperty(Key, 'UP', {\n get: Key$UP_getInstance\n });\n Object.defineProperty(Key, 'DOWN', {\n get: Key$DOWN_getInstance\n });\n Object.defineProperty(Key, 'LEFT', {\n get: Key$LEFT_getInstance\n });\n Object.defineProperty(Key, 'RIGHT', {\n get: Key$RIGHT_getInstance\n });\n Object.defineProperty(Key, 'PAGE_UP', {\n get: Key$PAGE_UP_getInstance\n });\n Object.defineProperty(Key, 'PAGE_DOWN', {\n get: Key$PAGE_DOWN_getInstance\n });\n Object.defineProperty(Key, 'ESCAPE', {\n get: Key$ESCAPE_getInstance\n });\n Object.defineProperty(Key, 'ENTER', {\n get: Key$ENTER_getInstance\n });\n Object.defineProperty(Key, 'HOME', {\n get: Key$HOME_getInstance\n });\n Object.defineProperty(Key, 'END', {\n get: Key$END_getInstance\n });\n Object.defineProperty(Key, 'TAB', {\n get: Key$TAB_getInstance\n });\n Object.defineProperty(Key, 'SPACE', {\n get: Key$SPACE_getInstance\n });\n Object.defineProperty(Key, 'INSERT', {\n get: Key$INSERT_getInstance\n });\n Object.defineProperty(Key, 'DELETE', {\n get: Key$DELETE_getInstance\n });\n Object.defineProperty(Key, 'BACKSPACE', {\n get: Key$BACKSPACE_getInstance\n });\n Object.defineProperty(Key, 'EQUALS', {\n get: Key$EQUALS_getInstance\n });\n Object.defineProperty(Key, 'BACK_QUOTE', {\n get: Key$BACK_QUOTE_getInstance\n });\n Object.defineProperty(Key, 'PLUS', {\n get: Key$PLUS_getInstance\n });\n Object.defineProperty(Key, 'MINUS', {\n get: Key$MINUS_getInstance\n });\n Object.defineProperty(Key, 'SLASH', {\n get: Key$SLASH_getInstance\n });\n Object.defineProperty(Key, 'CONTROL', {\n get: Key$CONTROL_getInstance\n });\n Object.defineProperty(Key, 'META', {\n get: Key$META_getInstance\n });\n Object.defineProperty(Key, 'ALT', {\n get: Key$ALT_getInstance\n });\n Object.defineProperty(Key, 'SHIFT', {\n get: Key$SHIFT_getInstance\n });\n Object.defineProperty(Key, 'UNKNOWN', {\n get: Key$UNKNOWN_getInstance\n });\n Object.defineProperty(Key, 'F1', {\n get: Key$F1_getInstance\n });\n Object.defineProperty(Key, 'F2', {\n get: Key$F2_getInstance\n });\n Object.defineProperty(Key, 'F3', {\n get: Key$F3_getInstance\n });\n Object.defineProperty(Key, 'F4', {\n get: Key$F4_getInstance\n });\n Object.defineProperty(Key, 'F5', {\n get: Key$F5_getInstance\n });\n Object.defineProperty(Key, 'F6', {\n get: Key$F6_getInstance\n });\n Object.defineProperty(Key, 'F7', {\n get: Key$F7_getInstance\n });\n Object.defineProperty(Key, 'F8', {\n get: Key$F8_getInstance\n });\n Object.defineProperty(Key, 'F9', {\n get: Key$F9_getInstance\n });\n Object.defineProperty(Key, 'F10', {\n get: Key$F10_getInstance\n });\n Object.defineProperty(Key, 'F11', {\n get: Key$F11_getInstance\n });\n Object.defineProperty(Key, 'F12', {\n get: Key$F12_getInstance\n });\n Object.defineProperty(Key, 'COMMA', {\n get: Key$COMMA_getInstance\n });\n Object.defineProperty(Key, 'PERIOD', {\n get: Key$PERIOD_getInstance\n });\n package$event.Key = Key;\n package$event.KeyEvent_init_l9pgtg$ = KeyEvent_init;\n package$event.KeyEvent_init_79e79$ = KeyEvent_init_0;\n package$event.KeyEvent_init_m5etgt$ = KeyEvent_init_1;\n package$event.KeyEvent = KeyEvent;\n Object.defineProperty(KeyModifiers, 'Companion', {\n get: KeyModifiers$Companion_getInstance\n });\n package$event.KeyModifiers = KeyModifiers;\n package$event.KeyStroke_init_ji7i3y$ = KeyStroke_init;\n package$event.KeyStroke_init_812rgc$ = KeyStroke_init_0;\n package$event.KeyStroke = KeyStroke;\n package$event.KeyStrokeSpec_init_ji7i3y$ = KeyStrokeSpec_init;\n package$event.KeyStrokeSpec_init_luoraj$ = KeyStrokeSpec_init_0;\n package$event.KeyStrokeSpec_init_4t3vif$ = KeyStrokeSpec_init_1;\n package$event.KeyStrokeSpec = KeyStrokeSpec;\n Object.defineProperty(package$event, 'KeyStrokeSpecs', {\n get: KeyStrokeSpecs_getInstance\n });\n Object.defineProperty(ModifierKey, 'CONTROL', {\n get: ModifierKey$CONTROL_getInstance\n });\n Object.defineProperty(ModifierKey, 'ALT', {\n get: ModifierKey$ALT_getInstance\n });\n Object.defineProperty(ModifierKey, 'SHIFT', {\n get: ModifierKey$SHIFT_getInstance\n });\n Object.defineProperty(ModifierKey, 'META', {\n get: ModifierKey$META_getInstance\n });\n package$event.ModifierKey = ModifierKey;\n Object.defineProperty(MouseEvent, 'Companion', {\n get: MouseEvent$Companion_getInstance\n });\n package$event.MouseEvent_init_fbovgd$ = MouseEvent_init;\n package$event.MouseEvent = MouseEvent;\n package$event.MouseEventSource = MouseEventSource;\n Object.defineProperty(MouseEventSpec, 'MOUSE_ENTERED', {\n get: MouseEventSpec$MOUSE_ENTERED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_LEFT', {\n get: MouseEventSpec$MOUSE_LEFT_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_MOVED', {\n get: MouseEventSpec$MOUSE_MOVED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_DRAGGED', {\n get: MouseEventSpec$MOUSE_DRAGGED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_CLICKED', {\n get: MouseEventSpec$MOUSE_CLICKED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_DOUBLE_CLICKED', {\n get: MouseEventSpec$MOUSE_DOUBLE_CLICKED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_PRESSED', {\n get: MouseEventSpec$MOUSE_PRESSED_getInstance\n });\n Object.defineProperty(MouseEventSpec, 'MOUSE_RELEASED', {\n get: MouseEventSpec$MOUSE_RELEASED_getInstance\n });\n package$event.MouseEventSpec = MouseEventSpec;\n package$event.PointEvent = PointEvent;\n var package$function = package$base.function || (package$base.function = {});\n package$function.Function = Function;\n Object.defineProperty(package$function, 'Functions', {\n get: Functions_getInstance\n });\n package$function.Runnable = Runnable;\n package$function.Supplier = Supplier;\n package$function.Value = Value;\n var package$gcommon = package$base.gcommon || (package$base.gcommon = {});\n var package$base_0 = package$gcommon.base || (package$gcommon.base = {});\n Object.defineProperty(package$base_0, 'Preconditions', {\n get: Preconditions_getInstance\n });\n Object.defineProperty(package$base_0, 'Strings', {\n get: Strings_getInstance\n });\n Object.defineProperty(package$base_0, 'Throwables', {\n get: Throwables_getInstance\n });\n Object.defineProperty(ClosedRange, 'Companion', {\n get: ClosedRange$Companion_getInstance\n });\n var package$collect = package$gcommon.collect || (package$gcommon.collect = {});\n package$collect.ClosedRange = ClosedRange;\n Object.defineProperty(package$collect, 'Comparables', {\n get: Comparables_getInstance\n });\n package$collect.ComparatorOrdering = ComparatorOrdering;\n Object.defineProperty(package$collect, 'Iterables', {\n get: Iterables_getInstance\n });\n Object.defineProperty(package$collect, 'Lists', {\n get: Lists_getInstance\n });\n Object.defineProperty(Ordering, 'Companion', {\n get: Ordering$Companion_getInstance\n });\n package$collect.Ordering = Ordering;\n Object.defineProperty(package$collect, 'Sets', {\n get: Sets_getInstance\n });\n package$collect.Stack = Stack;\n package$collect.TreeMap = TreeMap;\n Object.defineProperty(DoubleRectangle, 'Companion', {\n get: DoubleRectangle$Companion_getInstance\n });\n var package$geometry = package$base.geometry || (package$base.geometry = {});\n package$geometry.DoubleRectangle_init_6y0v78$ = DoubleRectangle_init;\n package$geometry.DoubleRectangle = DoubleRectangle;\n Object.defineProperty(package$geometry, 'DoubleRectangles', {\n get: DoubleRectangles_getInstance\n });\n package$geometry.DoubleSegment = DoubleSegment;\n Object.defineProperty(DoubleVector, 'Companion', {\n get: DoubleVector$Companion_getInstance\n });\n package$geometry.DoubleVector = DoubleVector;\n package$geometry.Rectangle_init_tjonv8$ = Rectangle_init;\n package$geometry.Rectangle = Rectangle;\n Object.defineProperty(package$geometry, 'Rectangles', {\n get: Rectangles_getInstance\n });\n package$geometry.Segment = Segment;\n Object.defineProperty(Vector, 'Companion', {\n get: Vector$Companion_getInstance\n });\n package$geometry.Vector = Vector;\n var package$jsObject = package$base.jsObject || (package$base.jsObject = {});\n Object.defineProperty(package$jsObject, 'JsObjectSupport', {\n get: JsObjectSupport_getInstance\n });\n var package$json = package$base.json || (package$base.json = {});\n package$json.FluentArray_init = FluentArray_init;\n package$json.FluentArray_init_giv38x$ = FluentArray_init_0;\n package$json.FluentArray = FluentArray;\n package$json.FluentObject_init_bkhwtg$ = FluentObject_init;\n package$json.FluentObject_init = FluentObject_init_0;\n package$json.FluentObject = FluentObject;\n package$json.FluentPrimitive_init_s8ev37$ = FluentPrimitive_init;\n package$json.FluentPrimitive_init_pdl1vj$ = FluentPrimitive_init_0;\n package$json.FluentPrimitive_init_1v8dbw$ = FluentPrimitive_init_1;\n package$json.FluentPrimitive_init_rcaewn$ = FluentPrimitive_init_2;\n package$json.FluentPrimitive = FluentPrimitive;\n package$json.FluentValue = FluentValue;\n package$json.JsonFormatter = JsonFormatter;\n Object.defineProperty(JsonLexer, 'Companion', {\n get: JsonLexer$Companion_getInstance\n });\n package$json.JsonLexer = JsonLexer;\n JsonParser.JsonException = JsonParser$JsonException;\n package$json.JsonParser = JsonParser;\n Object.defineProperty(package$json, 'JsonSupport', {\n get: JsonSupport_getInstance\n });\n Object.defineProperty(Token, 'LEFT_BRACE', {\n get: Token$LEFT_BRACE_getInstance\n });\n Object.defineProperty(Token, 'RIGHT_BRACE', {\n get: Token$RIGHT_BRACE_getInstance\n });\n Object.defineProperty(Token, 'LEFT_BRACKET', {\n get: Token$LEFT_BRACKET_getInstance\n });\n Object.defineProperty(Token, 'RIGHT_BRACKET', {\n get: Token$RIGHT_BRACKET_getInstance\n });\n Object.defineProperty(Token, 'COMMA', {\n get: Token$COMMA_getInstance\n });\n Object.defineProperty(Token, 'COLON', {\n get: Token$COLON_getInstance\n });\n Object.defineProperty(Token, 'STRING', {\n get: Token$STRING_getInstance\n });\n Object.defineProperty(Token, 'NUMBER', {\n get: Token$NUMBER_getInstance\n });\n Object.defineProperty(Token, 'TRUE', {\n get: Token$TRUE_getInstance\n });\n Object.defineProperty(Token, 'FALSE', {\n get: Token$FALSE_getInstance\n });\n Object.defineProperty(Token, 'NULL', {\n get: Token$NULL_getInstance\n });\n package$json.Token = Token;\n Object.defineProperty(package$json, 'SPECIAL_CHARS_8be2vx$', {\n get: function () {\n return SPECIAL_CHARS;\n }\n });\n package$json.escape_pdl1vz$ = escape;\n package$json.unescape_pdl1vz$ = unescape;\n package$json.streamOf_9ma18$ = streamOf;\n package$json.objectsStreamOf_9ma18$ = objectsStreamOf;\n package$json.stringStreamOf_9ma18$ = stringStreamOf;\n package$json.isBoolean_za3rmp$ = isBoolean;\n package$json.isNumber_za3rmp$ = isNumber;\n package$json.isString_za3rmp$ = isString;\n package$json.getAsDouble_za3rmp$ = getAsDouble;\n package$json.getAsInt_s8jyv4$ = getAsInt;\n package$json.getAsBoolean_za3rmp$ = getAsBoolean;\n package$json.containsString_mer726$ = containsString;\n package$json.getAsString_s8jyv4$ = getAsString;\n package$json.parseEnum_xwn52g$ = parseEnum;\n package$json.formatEnum_wbfx10$ = formatEnum;\n package$json.put_tvzjva$ = put;\n package$json.put_5zytao$ = put_0;\n package$json.getNumber_8dq7w5$ = getNumber;\n package$json.getDouble_8dq7w5$ = getDouble;\n package$json.getString_8dq7w5$ = getString;\n package$json.getObj_8dq7w5$ = getObj;\n package$json.getArr_8dq7w5$ = getArr;\n Object.defineProperty(ListMap, 'Companion', {\n get: ListMap$Companion_getInstance\n });\n ListMap.Entry = ListMap$Entry;\n var package$listMap = package$base.listMap || (package$base.listMap = {});\n package$listMap.ListMap = ListMap;\n var package$logging = package$base.logging || (package$base.logging = {});\n package$logging.Logger = Logger;\n package$logging.PrintlnLogger = PrintlnLogger;\n var package$math = package$base.math || (package$base.math = {});\n package$math.toRadians_14dthe$ = toRadians;\n package$math.toDegrees_14dthe$ = toDegrees;\n package$math.round_gpjtzr$ = round_0;\n package$math.ceil_gpjtzr$ = ceil;\n package$math.round_lu1900$ = round_1;\n package$math.ceil_lu1900$ = ceil_0;\n package$math.distance_l3ath1$ = distance;\n package$math.ipow_dqglrj$ = ipow;\n var package$numberFormat = package$base.numberFormat || (package$base.numberFormat = {});\n package$numberFormat.length_s8cxhz$ = length;\n NumberFormat.Spec = NumberFormat$Spec;\n Object.defineProperty(NumberFormat$NumberInfo, 'Companion', {\n get: NumberFormat$NumberInfo$Companion_getInstance\n });\n NumberFormat.NumberInfo_init_hjbnfl$ = NumberFormat$NumberFormat$NumberInfo_init;\n NumberFormat.NumberInfo = NumberFormat$NumberInfo;\n NumberFormat.Output = NumberFormat$Output;\n NumberFormat.FormattedNumber = NumberFormat$FormattedNumber;\n Object.defineProperty(NumberFormat, 'Companion', {\n get: NumberFormat$Companion_getInstance\n });\n package$numberFormat.NumberFormat_init_61zpoe$ = NumberFormat_init;\n package$numberFormat.NumberFormat = NumberFormat;\n var package$observable = package$base.observable || (package$base.observable = {});\n var package$children = package$observable.children || (package$observable.children = {});\n package$children.ChildList = ChildList;\n package$children.ChildProperty = ChildProperty;\n package$children.Position = Position;\n package$children.PositionData = PositionData;\n package$children.SimpleComposite = SimpleComposite;\n var package$collections = package$observable.collections || (package$observable.collections = {});\n package$collections.CollectionAdapter = CollectionAdapter;\n Object.defineProperty(CollectionItemEvent$EventType, 'ADD', {\n get: CollectionItemEvent$EventType$ADD_getInstance\n });\n Object.defineProperty(CollectionItemEvent$EventType, 'SET', {\n get: CollectionItemEvent$EventType$SET_getInstance\n });\n Object.defineProperty(CollectionItemEvent$EventType, 'REMOVE', {\n get: CollectionItemEvent$EventType$REMOVE_getInstance\n });\n CollectionItemEvent.EventType = CollectionItemEvent$EventType;\n package$collections.CollectionItemEvent = CollectionItemEvent;\n package$collections.CollectionListener = CollectionListener;\n package$collections.ObservableCollection = ObservableCollection;\n var package$list = package$collections.list || (package$collections.list = {});\n package$list.AbstractObservableList = AbstractObservableList;\n package$list.ObservableArrayList = ObservableArrayList;\n package$list.ObservableList = ObservableList;\n var package$event_0 = package$observable.event || (package$observable.event = {});\n package$event_0.CompositeEventSource_init_xw2ruy$ = CompositeEventSource_init;\n package$event_0.CompositeEventSource_init_3qo2qg$ = CompositeEventSource_init_0;\n package$event_0.CompositeEventSource = CompositeEventSource;\n package$event_0.EventHandler = EventHandler;\n package$event_0.EventSource = EventSource;\n Object.defineProperty(package$event_0, 'EventSources', {\n get: EventSources_getInstance\n });\n package$event_0.ListenerCaller = ListenerCaller;\n package$event_0.ListenerEvent = ListenerEvent;\n package$event_0.Listeners = Listeners;\n package$event_0.MappingEventSource = MappingEventSource;\n var package$property = package$observable.property || (package$observable.property = {});\n package$property.BaseReadableProperty = BaseReadableProperty;\n package$property.DelayedValueProperty = DelayedValueProperty;\n package$property.Property = Property;\n Object.defineProperty(package$property, 'PropertyBinding', {\n get: PropertyBinding_getInstance\n });\n package$property.PropertyChangeEvent = PropertyChangeEvent;\n package$property.ReadableProperty = ReadableProperty;\n package$property.ValueProperty = ValueProperty;\n package$property.WritableProperty = WritableProperty;\n var package$random = package$base.random || (package$base.random = {});\n package$random.RandomGaussian = RandomGaussian;\n Object.defineProperty(package$random, 'RandomString', {\n get: RandomString_getInstance\n });\n var package$registration = package$base.registration || (package$base.registration = {});\n package$registration.CompositeRegistration = CompositeRegistration;\n package$registration.Disposable = Disposable;\n Object.defineProperty(Registration, 'Companion', {\n get: Registration$Companion_getInstance\n });\n package$registration.Registration = Registration;\n var package$throwableHandlers = package$registration.throwableHandlers || (package$registration.throwableHandlers = {});\n package$throwableHandlers.ThrowableHandler = ThrowableHandler;\n Object.defineProperty(package$throwableHandlers, 'ThrowableHandlers', {\n get: ThrowableHandlers_getInstance\n });\n var package$spatial = package$base.spatial || (package$base.spatial = {});\n Object.defineProperty(package$spatial, 'EARTH_RADIUS', {\n get: function () {\n return EARTH_RADIUS;\n }\n });\n Object.defineProperty(package$spatial, 'MIN_LONGITUDE', {\n get: function () {\n return MIN_LONGITUDE;\n }\n });\n Object.defineProperty(package$spatial, 'MAX_LONGITUDE', {\n get: function () {\n return MAX_LONGITUDE;\n }\n });\n Object.defineProperty(package$spatial, 'FULL_LONGITUDE', {\n get: function () {\n return FULL_LONGITUDE;\n }\n });\n Object.defineProperty(package$spatial, 'MIN_LATITUDE', {\n get: function () {\n return MIN_LATITUDE;\n }\n });\n Object.defineProperty(package$spatial, 'MAX_LATITUDE', {\n get: function () {\n return MAX_LATITUDE;\n }\n });\n Object.defineProperty(package$spatial, 'FULL_LATITUDE', {\n get: function () {\n return FULL_LATITUDE;\n }\n });\n package$spatial.get_start_cawtq0$ = get_start;\n package$spatial.get_end_cawtq0$ = get_end;\n Object.defineProperty(GeoBoundingBoxCalculator, 'Companion', {\n get: GeoBoundingBoxCalculator$Companion_getInstance\n });\n package$spatial.GeoBoundingBoxCalculator = GeoBoundingBoxCalculator;\n package$spatial.makeSegments_8o5yvy$ = makeSegments;\n package$spatial.geoRectsBBox_wfabpm$ = geoRectsBBox;\n package$spatial.pointsBBox_2r9fhj$ = pointsBBox;\n package$spatial.union_86o20w$ = union;\n Object.defineProperty(package$spatial, 'GeoJson', {\n get: GeoJson_getInstance\n });\n package$spatial.GeoRectangle = GeoRectangle;\n package$spatial.LonLat = LonLat;\n Object.defineProperty(package$spatial, 'EARTH_RECT', {\n get: function () {\n return EARTH_RECT;\n }\n });\n package$spatial.limitLon_14dthe$ = limitLon;\n package$spatial.limitLat_14dthe$ = limitLat;\n package$spatial.normalizeLon_14dthe$ = normalizeLon;\n Object.defineProperty(package$spatial, 'BBOX_CALCULATOR', {\n get: function () {\n return BBOX_CALCULATOR;\n }\n });\n package$spatial.convertToGeoRectangle_i3vl8m$ = convertToGeoRectangle;\n package$spatial.calculateQuadKeys_h9hod0$ = calculateQuadKeys;\n Object.defineProperty(LongitudeSegment, 'Companion', {\n get: LongitudeSegment$Companion_getInstance\n });\n package$spatial.LongitudeSegment = LongitudeSegment;\n Object.defineProperty(package$spatial, 'MercatorUtils', {\n get: MercatorUtils_getInstance\n });\n package$spatial.QuadKey = QuadKey;\n package$spatial.computeRect_c2pv3p$ = computeRect;\n package$spatial.computeRect_v4gkf3$ = computeRect_0;\n package$spatial.projectRect_cub2h3$ = projectRect;\n package$spatial.zoom_c2pv3p$ = zoom;\n package$spatial.computeOrigin_v4gkf3$ = computeOrigin;\n package$spatial.projectOrigin_cub2h3$ = projectOrigin;\n package$spatial.calulateQuadsCount_za3lpa$ = calulateQuadsCount;\n package$spatial.calculateQuadKeys_a35lcs$ = calculateQuadKeys_0;\n package$spatial.xyToKey_qt1dr2$ = xyToKey;\n SimpleFeature.prototype.GeometryConsumer = SimpleFeature$GeometryConsumer;\n SimpleFeature.prototype.Consumer = SimpleFeature$Consumer;\n Object.defineProperty(SimpleFeature$GeometryType, 'POINT', {\n get: SimpleFeature$GeometryType$POINT_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'LINE_STRING', {\n get: SimpleFeature$GeometryType$LINE_STRING_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'POLYGON', {\n get: SimpleFeature$GeometryType$POLYGON_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'MULTI_POINT', {\n get: SimpleFeature$GeometryType$MULTI_POINT_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'MULTI_LINE_STRING', {\n get: SimpleFeature$GeometryType$MULTI_LINE_STRING_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'MULTI_POLYGON', {\n get: SimpleFeature$GeometryType$MULTI_POLYGON_getInstance\n });\n Object.defineProperty(SimpleFeature$GeometryType, 'GEOMETRY_COLLECTION', {\n get: SimpleFeature$GeometryType$GEOMETRY_COLLECTION_getInstance\n });\n SimpleFeature.prototype.GeometryType = SimpleFeature$GeometryType;\n Object.defineProperty(package$spatial, 'SimpleFeature', {\n get: SimpleFeature_getInstance\n });\n Object.defineProperty(StringFormat$FormatType, 'NUMBER_FORMAT', {\n get: StringFormat$FormatType$NUMBER_FORMAT_getInstance\n });\n Object.defineProperty(StringFormat$FormatType, 'STRING_FORMAT', {\n get: StringFormat$FormatType$STRING_FORMAT_getInstance\n });\n StringFormat.FormatType = StringFormat$FormatType;\n Object.defineProperty(StringFormat, 'Companion', {\n get: StringFormat$Companion_getInstance\n });\n var package$stringFormat = package$base.stringFormat || (package$base.stringFormat = {});\n package$stringFormat.StringFormat = StringFormat;\n var package$typedGeometry = package$base.typedGeometry || (package$base.typedGeometry = {});\n package$typedGeometry.AbstractGeometryList = AbstractGeometryList;\n package$typedGeometry.isClockwise_hv912c$ = isClockwise_0;\n package$typedGeometry.createMultiPolygon_hv912c$ = createMultiPolygon;\n package$typedGeometry.boundingBox_gyuce3$ = boundingBox;\n package$typedGeometry.Generic = Generic;\n package$typedGeometry.reinterpret_q42o9k$ = reinterpret;\n package$typedGeometry.reinterpret_dr0qel$ = reinterpret_0;\n package$typedGeometry.reinterpret_2z483p$ = reinterpret_1;\n package$typedGeometry.reinterpret_typ3lq$ = reinterpret_2;\n package$typedGeometry.reinterpret_sux9xa$ = reinterpret_3;\n package$typedGeometry.reinterpret_dg847r$ = reinterpret_4;\n package$typedGeometry.get_bottom_h9e6jg$ = get_bottom;\n package$typedGeometry.get_right_h9e6jg$ = get_right;\n package$typedGeometry.get_height_h9e6jg$ = get_height;\n package$typedGeometry.get_width_h9e6jg$ = get_width;\n package$typedGeometry.get_top_h9e6jg$ = get_top;\n package$typedGeometry.get_left_h9e6jg$ = get_left;\n package$typedGeometry.get_scalarBottom_xdjzag$ = get_scalarBottom;\n package$typedGeometry.get_scalarRight_xdjzag$ = get_scalarRight;\n package$typedGeometry.get_scalarHeight_xdjzag$ = get_scalarHeight;\n package$typedGeometry.get_scalarWidth_xdjzag$ = get_scalarWidth;\n package$typedGeometry.get_scalarTop_xdjzag$ = get_scalarTop;\n package$typedGeometry.get_scalarLeft_xdjzag$ = get_scalarLeft;\n package$typedGeometry.get_center_xdjzag$ = get_center;\n package$typedGeometry.get_scalarX_xocuba$ = get_scalarX;\n package$typedGeometry.get_scalarY_xocuba$ = get_scalarY;\n package$typedGeometry.plus_cg1mpz$ = plus_4;\n package$typedGeometry.minus_cg1mpz$ = minus;\n package$typedGeometry.times_cg1mpz$ = times;\n package$typedGeometry.div_cg1mpz$ = div;\n package$typedGeometry.times_4nb5xq$ = times_0;\n package$typedGeometry.div_4nb5xq$ = div_0;\n package$typedGeometry.unaryMinus_e0pgg$ = unaryMinus;\n package$typedGeometry.transform_nj6yk8$ = transform;\n package$typedGeometry.plus_qnxb21$ = plus_5;\n package$typedGeometry.minus_qnxb21$ = minus_0;\n package$typedGeometry.times_qnxb21$ = times_1;\n package$typedGeometry.div_qnxb21$ = div_1;\n package$typedGeometry.div_i3tdhk$ = div_2;\n package$typedGeometry.times_i3tdhk$ = times_2;\n package$typedGeometry.unaryMinus_cr59ze$ = unaryMinus_0;\n package$typedGeometry.compareTo_85q7fw$ = compareTo;\n package$typedGeometry.newSpanRectangle_2d1svq$ = newSpanRectangle;\n package$typedGeometry.limit_106pae$ = limit;\n package$typedGeometry.contains_h8bixx$ = contains_1;\n package$typedGeometry.intersects_32samh$ = intersects;\n package$typedGeometry.xRange_h9e6jg$ = xRange;\n package$typedGeometry.yRange_h9e6jg$ = yRange;\n package$typedGeometry.limit_lddjmn$ = limit_0;\n Object.defineProperty(GeometryType, 'MULTI_POINT', {\n get: GeometryType$MULTI_POINT_getInstance\n });\n Object.defineProperty(GeometryType, 'MULTI_LINESTRING', {\n get: GeometryType$MULTI_LINESTRING_getInstance\n });\n Object.defineProperty(GeometryType, 'MULTI_POLYGON', {\n get: GeometryType$MULTI_POLYGON_getInstance\n });\n package$typedGeometry.GeometryType = GeometryType;\n Object.defineProperty(Geometry, 'Companion', {\n get: Geometry$Companion_getInstance\n });\n package$typedGeometry.Geometry = Geometry;\n package$typedGeometry.LineString = LineString;\n package$typedGeometry.MultiLineString = MultiLineString;\n package$typedGeometry.MultiPoint = MultiPoint;\n package$typedGeometry.MultiPolygon = MultiPolygon;\n package$typedGeometry.Polygon = Polygon;\n package$typedGeometry.Rect_init_94ua8u$ = Rect_init;\n package$typedGeometry.Rect = Rect;\n package$typedGeometry.Ring = Ring;\n package$typedGeometry.Scalar = Scalar;\n package$typedGeometry.Vec_init_vrm8gm$ = Vec_init;\n package$typedGeometry.Vec = Vec;\n package$typedGeometry.explicitVec_y7b45i$ = explicitVec;\n package$typedGeometry.explicitVec_vrm8gm$ = explicitVec_0;\n package$typedGeometry.newVec_4xl464$ = newVec;\n var package$typedKey = package$base.typedKey || (package$base.typedKey = {});\n package$typedKey.TypedKey = TypedKey;\n package$typedKey.TypedKeyHashMap = TypedKeyHashMap;\n var package$unsupported = package$base.unsupported || (package$base.unsupported = {});\n package$unsupported.UNSUPPORTED = UNSUPPORTED;\n package$unsupported.UNSUPPORTED_61zpoe$ = UNSUPPORTED_0;\n Object.defineProperty(Color, 'Companion', {\n get: Color$Companion_getInstance\n });\n var package$values = package$base.values || (package$base.values = {});\n package$values.Color = Color;\n Object.defineProperty(package$values, 'Colors', {\n get: Colors_getInstance\n });\n package$values.toPngDataUri_61zpoe$ = toPngDataUri;\n package$values.Font = Font;\n Object.defineProperty(FontFamily, 'Companion', {\n get: FontFamily$Companion_getInstance\n });\n package$values.FontFamily = FontFamily;\n package$values.HSV = HSV;\n package$values.Interval = Interval;\n package$values.Pair = Pair_0;\n package$values.SomeFig = SomeFig;\n Object.defineProperty(package$logging, 'PortableLogging', {\n get: PortableLogging_getInstance\n });\n SPECIAL_CHARS = mapOf([to(toBoxedChar(34), toBoxedChar(34)), to(toBoxedChar(92), toBoxedChar(92)), to(toBoxedChar(47), toBoxedChar(47)), to(toBoxedChar(98), toBoxedChar(8)), to(toBoxedChar(102), toBoxedChar(12)), to(toBoxedChar(110), toBoxedChar(10)), to(toBoxedChar(114), toBoxedChar(13)), to(toBoxedChar(116), toBoxedChar(9))]);\n var $receiver = until(0, 32);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(toBoxedChar(toChar(item)));\n }\n CONTROL_CHARS = toSet(destination);\n EARTH_RADIUS = 6378137.0;\n MIN_LONGITUDE = -180.0;\n MAX_LONGITUDE = 180.0;\n FULL_LONGITUDE = MAX_LONGITUDE - MIN_LONGITUDE;\n MIN_LATITUDE = -90.0;\n MAX_LATITUDE = 90.0;\n FULL_LATITUDE = MAX_LATITUDE - MIN_LATITUDE;\n EARTH_RECT = Rect_init(MIN_LONGITUDE, MIN_LATITUDE, FULL_LONGITUDE, FULL_LATITUDE);\n BBOX_CALCULATOR = new GeoBoundingBoxCalculator(EARTH_RECT, true, false);\n Kotlin.defineModule('lets-plot-base-portable', _);\n return _;\n}));\n\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B1dGMoKTogVGltZVpvbmUge1xuICAgICAgICByZXR1cm4gb2JqZWN0IDogVGltZVpvbmUoXCJVVENcIikge1xuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHRvRGF0ZVRpbWUoaW5zdGFudDogSW5zdGFudCk6IERhdGVUaW1lIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdG9EYXRlVGltZShpbnN0YW50LCBEdXJhdGlvbigwKSlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHRvSW5zdGFudChkYXRlVGltZTogRGF0ZVRpbWUpOiBJbnN0YW50IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdG9JbnN0YW50KGRhdGVUaW1lLCBEdXJhdGlvbigwKSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBvZmZzZXQoaWQ6IFN0cmluZz8sIG9mZnNldDogRHVyYXRpb24sIGJhc2U6IFRpbWVab25lKTogVGltZVpvbmUge1xuICAgICAgICByZXR1cm4gb2JqZWN0IDogVGltZVpvbmUoaWQpIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biB0b0RhdGVUaW1lKGluc3RhbnQ6IEluc3RhbnQpOiBEYXRlVGltZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGJhc2UudG9EYXRlVGltZShpbnN0YW50LmFkZChvZmZzZXQpKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gdG9JbnN0YW50KGRhdGVUaW1lOiBEYXRlVGltZSk6IEluc3RhbnQge1xuICAgICAgICAgICAgICAgIHJldHVybiBiYXNlLnRvSW5zdGFudChkYXRlVGltZSkuc3ViKG9mZnNldClcbiAgICAgICAgICAgIH1cblxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuIHdpdGhFdVN1bW1lclRpbWUoaWQ6IFN0cmluZywgb2Zmc2V0OiBEdXJhdGlvbik6IFRpbWVab25lIHtcbiAg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llYXIpXG4gICAgICAgICAgICByZXR1cm4gaWYgKGluc3RhbnQgPiBzdGFydCAmJiBpbnN0YW50IDwgZW5kKSB7XG4gICAgICAgICAgICAgICAgbXlTdW1tZXJUei50b0RhdGVUaW1lKGluc3RhbnQpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHR6RHRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB0b0luc3RhbnQoZGF0ZVRpbWU6IERhdGVUaW1lKTogSW5zdGFudCB7XG4gICAgICAgICAgICB2YWwgc3RhcnREdCA9IHRvRGF0ZVRpbWUoZ2V0U3RhcnRJbnN0YW50KGRhdGVUaW1lLnllYXIpKVxuICAgICAgICAgICAgdmFsIGVuZER0ID0gdG9EYXRlVGltZShnZXRFbmRJbnN0YW50KGRhdGVUaW1lLnllYXIpKVxuXG4gICAgICAgICAgICByZXR1cm4gaWYgKGRhdGVUaW1lID4gc3RhcnREdCAmJiBkYXRlVGltZSA8IGVuZER0KSB7XG4gICAgICAgICAgICAgICAgbXlTdW1tZXJUei50b0luc3RhbnQoZGF0ZVRpbWUpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG15VHoudG9JbnN0YW50KGRhdGVUaW1lKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJvdGVjdGVkIGFic3RyYWN0IGZ1biBnZXRTdGFydEluc3RhbnQoeWVhcjogSW50KTogSW5zdGFudFxuXG4gICAgICAgIHByb3RlY3RlZCBhYnN0cmFjdCBmdW4gZ2V0RW5kSW5zdGFudCh5ZWFyOiBJbnQpOiBJbnN0YW50XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAyMDEwLTIwMTggSmV0QnJhaW5zIHMuci5vLiBhbmQgS290bGluIFByb2dyYW1taW5nIExhbmd1YWdlIGNvbnRyaWJ1dG9ycy5cbiAqIFVzZSBvZiB0aGlzIHN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uICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIC0xXG59XG5cbi8qKlxuICogUmV0dXJucyBsYXN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBTaG9ydEFycmF5Lmxhc3RJbmRleE9mKGVsZW1lbnQ6IFNob3J0KTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMucmV2ZXJzZWQoKSkge1xuICAgICAgICBpZiAoZWxlbWVudCA9PSB0aGlzW2luZGV4XSkge1xuICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIC0xXG59XG5cbi8qKlxuICogUmV0dXJucyBsYXN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBJbnRBcnJheS5sYXN0SW5kZXhPZihlbGVtZW50OiBJbnQpOiBJbnQge1xuICAgIGZvciAoaW5kZXggaW4gaW5kaWNlcy5yZXZlcnNlZCgpKSB7XG4gICAgICAgIGlmIChlbGVtZW50ID09IHRoaXNbaW5kZXhdKSB7XG4gICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gLTFcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGxhc3QgaW5kZXggb2YgW2VsZW1lbnRdLCBvciAtMSBpZiB0aGUgYXJyYXkgZG9lcyBub3QgY29udGFpbiBlbGVtZW50LlxuICovXG5wdWJsaWMgZnVuIExvbmdBcnJheS5sYXN0SW5kZXhPZihlbGVtZW50OiBMb25nKTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMucmV2ZXJzZWQoKSkge1xuICAgICAgICB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vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIERvdWJsZUFycmF5LmNvdW50KCk6IEludCB7XG4gICAgcmV0dXJuIHNpemVcbn1cblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBudW1iZXIgb2YgZWxlbWVudHMgaW4gdGhpcyBhcnJheS5cbiAqL1xuQGtvdGxpbi5pbnRlcm5hbC5JbmxpbmVPbmx5XG5wdWJsaWMgaW5saW5lIGZ1biBCb29sZWFuQXJyYXkuY291bnQoKTogSW50IHtcbiAgICByZXR1cm4gc2l6ZVxufVxuXG4vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIENoYXJBcnJheS5jb3VudCgpOiBJbnQge1xuICAgIHJldHVybiBzaXplXG59XG5cbi8qKlxuICogUmV0dXJucyB0aGUgbnVtYmVyIG9mIGVsZW1lbnRzIG1hdGNoaW5nIHRoZSBnaXZlbiBbcHJlZGljYXRlXS5cbiAqL1xucHVibGljIGlubGluZSBmdW4gPFQ+IEFycmF5PG91dCBUPi5jb3VudChwcmVkaWNhdGU6IChUKSAtPiBCb29sZWFuKTogSW50IHtcbiAgICB2YXIgY291bnQgPSAwXG4gICAgZm9yIChlbGVtZW50IGluIHRoaXMpIGlmIChwcmVkaWNhdGUoZWxlbWVudCkpICsrY291bnRcbiAgICByZXR1cm4gY291bnRcbn1cblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBudW1iZXIgb2YgZWxlbWVudHMgbWF0Y2hpbmcgdGhlIGdpdmVuIFtwcmVkaWNhdGVdLlxuICovXG5wdWJsaWMgaW5saW5lIGZ1biBCeXRlQXJyYXkuY291bnQocHJlZGljYXRlOi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wiRnJpXCIsXG4gICAgICAgIFdlZWtEYXkuU0FUVVJEQVkgdG8gXCJTYXRcIixcbiAgICAgICAgV2Vla0RheS5TVU5EQVkgdG8gXCJTdW5cIlxuICAgIClcblxuICAgIHZhbCB3ZWVrRGF5RnVsbCA9IG1hcE9mKFxuICAgICAgICBXZWVrRGF5Lk1PTkRBWSB0byBcIk1vbmRheVwiLFxuICAgICAgICBXZWVrRGF5LlRVRVNEQVkgdG8gXCJUdWVzZGF5XCIsXG4gICAgICAgIFdlZWtEYXkuV0VETkVTREFZIHRvIFwiV2VkbmVzZGF5XCIsXG4gICAgICAgIFdlZWtEYXkuVEhVUlNEQVkgdG8gXCJUaHVyc2RheVwiLFxuICAgICAgICBXZWVrRGF5LkZSSURBWSB0byBcIkZyaWRheVwiLFxuICAgICAgICBXZWVrRGF5LlNBVFVSREFZIHRvIFwiU2F0dXJkYXlcIixcbiAgICAgICAgV2Vla0RheS5TVU5EQVkgdG8gXCJTdW5kYXlcIlxuICAgIClcblxuICAgIHZhbCBtb250aEFiYnIgPSBtYXBPZihcbiAgICAgICAgTW9udGguSkFOVUFSWSB0byBcIkphblwiLFxuICAgICAgICBNb250aC5GRUJSVUFSWSB0byBcIkZlYlwiLFxuICAgICAgICBNb250aC5NQVJDSCB0byBcIk1hclwiLFxuICAgICAgICBNb250aC5BUFJJTCB0byBcIkFwclwiLFxuICAgICAgICBNb250aC5NQVkgdG8gXCJNYXlcIixcbiAgICAgICAgTW9udGguSlVORSB0byBcIkp1blwiLFxuICAgICAgICBNb250aC5KVUxZIHRvIFwiSnVsXCIsXG4gICAgICAgIE1vbnRoLkFVR1VTVCB0byBcIkF1Z1wiLFxuICAgICAgICBNb250aC5TRVBURU1CRVIgdG8gXCJTZXBcIixcbiAgICAgICAgTW9udGguT0NUT0JFUiB0byBcIk9jdFwiLFxuICAgICAgICBNb250aC5OT1ZFTUJFUiB0byBcIk5vdlwiLFxuICAgICAgICBNb250aC5ERUNFTUJFUiB0byBcIkRlY1wi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FyIGxhc3RJbmRleCA9IDBcbiAgICAgICAgICAgIHJlc3VsdFNlcXVlbmNlLmZvckVhY2gge1xuICAgICAgICAgICAgICAgIHZhbCB2YWx1ZSA9IGl0LnZhbHVlXG4gICAgICAgICAgICAgICAgdmFsIHJhbmdlID0gaXQucmFuZ2VcbiAgICAgICAgICAgICAgICB2YWwgc3RhcnRJbmRleCA9IHJhbmdlLmZpcnN0XG4gICAgICAgICAgICAgICAgdmFsIGVuZEluZGV4ID0gcmFuZ2UubGFzdFxuICAgICAgICAgICAgICAgIGlmIChzdGFydEluZGV4ID4gMCkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgc3BlYyA9IFNwZWNQYXJ0KHN0ci5zdWJzdHJpbmcobGFzdEluZGV4IHVudGlsIHN0YXJ0SW5kZXgpKVxuICAgICAgICAgICAgICAgICAgICByZXN1bHQuYWRkKHNwZWMpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlc3VsdC5hZGQoUGF0dGVyblNwZWNQYXJ0KHZhbHVlKSlcbiAgICAgICAgICAgICAgICBsYXN0SW5kZXggPSBlbmRJbmRleCArIDFcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGxhc3RJbmRleCA8IHN0ci5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICByZXN1bHQuYWRkKFNwZWNQYXJ0KHN0ci5zdWJzdHJpbmcobGFzdEluZGV4KSkpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiByZXN1bHRcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGdldFZhbHVlRm9yUGF0dGVybih0eXBlOiBQYXR0ZXJuLCBkYXRlVGltZTogRGF0ZVRpbWUpOiBTdHJpbmcgPVxuICAgICAgICAgICAgd2hlbih0eXBlKSB7XG4gICAgICAgICAgICAgICAgUGF0dGVybi5TRUNPTkQgLT4gbGVhZFplcm8oZGF0ZVRpbWUuc2Vjb25kcylcbiAgICAgICAgIC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UVBUiAtPiBsZWFkWmVybyhkYXRlVGltZS5kYXRlLmRheXNGcm9tWWVhclN0YXJ0KCksIDMpXG4gICAgICAgICAgICAgICAgUGF0dGVybi5NT05USCAtPiBsZWFkWmVybygoZGF0ZVRpbWUubW9udGg/Lm9yZGluYWwoKSA/OiAwKSArIDEpXG4gICAgICAgICAgICAgICAgUGF0dGVybi5NT05USF9BQkJSIC0+IERhdGVMb2NhbGUubW9udGhBYmJyW2RhdGVUaW1lLm1vbnRoXSA/OiBcIlwiXG4gICAgICAgICAgICAgICAgUGF0dGVybi5NT05USF9GVUxMIC0+IERhdGVMb2NhbGUubW9udGhGdWxsW2RhdGVUaW1lLm1vbnRoXSA/OiBcIlwiXG4gICAgICAgICAgICAgICAgUGF0dGVybi5ZRUFSX1NIT1JUIC0+IGRhdGVUaW1lLnllYXIudG9TdHJpbmcoKS5zdWJzdHJpbmcoMilcbiAgICAgICAgICAgICAgICBQYXR0ZXJuLllFQVJfRlVMTCAtPiBkYXRlVGltZS55ZWFyLnRvU3RyaW5nKClcbiAgICAgICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBsZWFkWmVybyh2YWx1ZTogSW50LCBsZW5ndGg6IEludCA9IDIpOiBTdHJpbmcgPSB2YWx1ZS50b1N0cmluZygpLnBhZFN0YXJ0KGxlbmd0aCwgJzAnKVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGdldEhvdXJzMTIoZGF0ZVRpbWU6IERhdGVUaW1lKTogSW50IHtcbiAgICAgICAgICAgIHZhbCBob3VycyA9IGRhdGVUaW1lLmhvdXJzXG4gICAgICAgICAgICByZXR1cm4gd2hlbiB7XG4gICAgICAgICAgICAgICAgaG91cnMgPT0gMCAtPiAxMlxuICAgICAgICAgICAgICAgIGhvdXJzIDw9IDEyIC0+IGhvdXJzXG4gICAgICAgICAgICAgICAgZWxzZSAtPiBob3VycyAtIDEyXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBnZXRIb3VyczI0KGRhdGVUaW1lOiBEYXRlVGltZSk6IEludCA9XG4gICAgICAgICAgICB3aGVuKGRhdGVUaW1lLmhvdXJzKSB7XG4gICAgICAgICAgICAgICAgMCAtPiAyNFxuICAgICAgICAgICAgICAgIGVsc2UgLT4gZGF0ZVRpbWUuaG91cnNcbiAgICAgICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBnZXRNZXJpZGlhbihkYXRlVGltZTogRGF0ZVRpbWUpOiBTdHJpbmcge1xuICAgICAgICAgICAgdmFsIGhvdXJzID0gZGF0ZVRpbWUuaG91cnNcbiAgICAgICAgICAgIHJldHVybiB3aGVuIHtcbiAgICAgICAgICAgICAgICBob3VycyA9PSAyNCAtPiBcImFtXCJcbiAgICAgICAgICAgICAgICBob3VycyA8PSAxMiAtPiBcImFtXCJcbiAgICAgICAgICAgICAgICBlbHNlIC0+IFwicG1cIlxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZ2V0V2Vla0RheU51bWJlcihkYXRlVGltZTogRGF0ZVRpbWUpOiBTdHJpbmcge1xuICAgICAgICAgICAgdmFyIG51bSA9IGRhdGVUaW1lLndlZWtEYXkub3JkaW5hbCArIDFcbiAgICAgICAgICAgIGlmIChudW0gPT0gNykge1xuICAgICAgICAgICAgICAgIG51bSA9IDBcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBudW0udG9TdHJpbmcoKVxuICAgICAgICB9XG4gICAgfVxufSIsIi8qXG4gKiBDb3B5cmlnaHQgMjAxMC0yMDIxIEpldEJyYWlucyBzLnIuby4gYW5kIEtvdGxpbiBQcm9ncmFtbWluZyBMYW5ndWFnZSBjb250cmlidXRvcnMuXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgQXBhY2hlIDIuMCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBsa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ZSgpXG4gICAgICAgICAgICAgICAgaWYgKHMxICE9IHMyKSB7XG4gICAgICAgICAgICAgICAgICAgIHMxID0gczEubG93ZXJjYXNlKClcbiAgICAgICAgICAgICAgICAgICAgczIgPSBzMi5sb3dlcmNhc2UoKVxuICAgICAgICAgICAgICAgICAgICBpZiAoczEgIT0gczIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzMS5jb21wYXJlVG8oczIpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZW5kID09IG1pbikgYnJlYWtcbiAgICAgICAgICAgIHN0YXJ0ID0gZW5kXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG4xIC0gbjJcbiAgICB9IGVsc2Uge1xuICAgICAgICByZXR1cm4gY29tcGFyZVRvKG90aGVyKVxuICAgIH1cbn1cblxuLyoqXG4gKiBSZXR1cm5zIGB0cnVlYCBpZiB0aGUgY29udGVudHMgb2YgdGhpcyBjaGFyIHNlcXVlbmNlIGFyZSBlcXVhbCB0byB0aGUgY29udGVudHMgb2YgdGhlIHNwZWNpZmllZCBbb3RoZXJdLFxuICogaS5lLiBib3RoIGNoYXIgc2VxdWVuY2VzIGNvbnRhaW4gdGhlIHNhbWUgbnVtYmVyIG9mIHRoZSBzYW1lIGNoYXJhY3RlcnMgaW4gdGhlIHNhbWUgb3JkZXIuXG4gKlxuICogQHNhbXBsZSBzYW1wbGVzLnRleHQuU3RyaW5ncy5jb250ZW50RXF1YWxzXG4gKi9cbkBTaW5jZUtvdGxpbihcIjEuNVwiKVxucHVibGljIGFjdHVhbCBpbmZpeCBmdW4gQ2hhclNlcXVlbmNlPy5jb250ZW50RXF1YWxzKG90aGVyOiBDaGFyU2VxdWVuY2U/KTogQm9vbGVhbiA9IGNvbnRlbnRFcXVhbHNJbXBsKG90aGVyKVxuXG4vKipcbiAqIFJldHVybnMgYHRydWVgIGlmIHRoZSBjb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ICAgICAgICB2YWwgaXNWYWxpZCA9IGRheSBpbiAxLi5kYXlzSW5Nb250aFxuXG4gICAgICAgIGlmICghaXNWYWxpZCkge1xuICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBkYXlzRnJvbShkYXRlOiBEYXRlKTogSW50IHtcbiAgICAgICAgaWYgKGNvbXBhcmVUbyhkYXRlKSA8IDApIHtcbiAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigpXG4gICAgICAgIH1cblxuICAgICAgICB2YXIgcmVzdWx0ID0gMFxuXG4gICAgICAgIGlmICh5ZWFyICE9IGRhdGUueWVhcikge1xuICAgICAgICAgICAgdmFsIGZyb21ZZWFyID0gZGF0ZS55ZWFyXG4gICAgICAgICAgICB2YWwgdG9ZZWFyID0geWVhclxuICAgICAgICAgICAgdmFsIGxlYXBZZWFycyA9IERhdGVUaW1lVXRpbC5sZWFwWWVhcnNCZXR3ZWVuKGZyb21ZZWFyLCB0b1llYXIpXG4gICAgICAgICAgICB2YWwgeWVhcnMgPSB0b1llYXIgLSBmcm9tWWVhclxuICAgICAgICAgICAgcmVzdWx0ICs9IGxlYXBZZWFycyAqIERhdGVUaW1lVXRpbC5EQVlTX0lOX0xFQVBfWUVBUiArICh5ZWFycyAtIGxlYXBZZWFycykgKiBEYXRlVGltZVV0aWwuREFZU19JTl9ZRUFSXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVzdWx0ICsgZGF5c0Zyb21ZZWFyU3RhcnQoKSAtIGRhdGUuZGF5c0Zyb21ZZWFyU3RhcnQoKVxuICAgIH1cblxuICAgIGZ1biBkYXlzRnJvbVllYXJTdGFydCgpOiBJbnQge1xuICAgICAgICB2YXIgcmVzdWx0ID0gZGF5XG4gICAgICAgIHZhciBjdXJyZW50ID0gbW9udGgucHJldigpXG4gICAgICAgIHdoaWxlIChjdXJyZW50ICE9IG51bGwpIHtcbiAgICAgICAgICAgIHJlc3VsdCArPSBjdXJyZW50LmdldERheXNJblllYXIoeWVhcilcbiAgICAgICAgICAgIGN1cnJlbnQgPSBjdXJyZW50LnByZXYoKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBmdW4gYWRkRGF5cyhkYXlzOiBJbnQpOiBEYXRlIHtcbiAgICAgICAgQFN1cHByZXNzKFwiTkFNRV9TSEFET1dJTkdcIilcbiAgICAgICAgdmFyIGRheXMgPSBkYXlzXG4gICAgICAgIGlmIChkYXlzIDwgMCkge1xuICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoZGF5cyA9PSAwKSByZXR1cm4gdGhpc1xuXG4gICAgICAgIHZhciBkYXkgPSB0aGlzLmRheVxuICAgICAgICB2YXIgbW9udGggPSB0aGlzLm1vbnRoXG4gICAgICAgIHZhciB5ZWFyID0gdGhpcy55ZWFyXG4gICAgICAgIHZhciBsZXNzVGhhblllYXIgPSBmYWxzZVxuXG4gICAgICAgIGlmIChkYXlzID49IENBQ0hFX0RBWVMgJiYgeWVhciA9PSBFUE9DSC55ZWFyKSB7XG4gICAgICAgICAgICB5ZWFyID0gQ0FDSEVfU1RBTVAueWVhclxuICAgICAgICAgICAgbW9udGggPSBDQUNIRV9TVEFNUC5tb250aFxuICAgICAgICAgICAgZGF5ID0gQ0FDSEVfU1RBTVAuZGF5XG4gICAgICAgICAgICBkYXlzIC09IENBQ0hFX0RBWVNcbiAgICAgICAgfVxuXG4gICAgICAgIHdoaWxlIChkYXlzID4gMCkge1xuICAgICAgICAgICAgdmFsIGRheXNUb05leHRNb250aCA9IG1vbnRoLmdldERheXNJblllYXIoeWVhcikgLSBkYXkgKyAxXG4gICAgICAgICAgICBpZiAoZGF5cyA8IGRheXNUb05leHRNb250aCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBEYXRlKGRheSArIGRheXMsIG1vbnRoLCB5ZWFyKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAobGVzc1RoYW5ZZWFyKSB7XG4gICAgICAgICAgICAgICAgICAgIG1vbnRoID0gbW9udGgubmV4dCgpISFcbiAgICAgICAgICAgICAgICAgICAgZGF5ID0gMVxuICAgICAgICAgICAgICAgICAgICBkYXlzIC09IGRheXNUb05leHRNb250aFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBkYXlzVG9OZXh0WWVhciA9IGxhc3REYXlPZih5ZWFyKS5kYXlzRnJvbShEYXRlKGRheSwgbW9udGgsIHllYXIpKSArIDFcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRheXMgPj0gZGF5c1RvTmV4dFllYXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRheSA9IDFcbiAgICAgICAgICAgICAgICAgICAgICAgIG1vbnRoID0gTW9udGguSkFOVUFSWVxuICAgICAgICAgICAgICAgICAgICAgICAgeWVhciArPSAxXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXlzIC09IGRheXNUb05leHRZZWFyXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtb250aCA9IG1vbnRoLm5leHQoKSEhXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXkgPSAxXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXlzIC09IGRheXNUb05leHRNb250aFxuICAgICAgICAgICAgICAgICAgICAgICAgbGVzc1RoYW5ZZWFyID0gdHJ1ZVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIERhdGUoZGF5LCBtb250aCwgeWVhcilcbiAgICB9XG5cbiAgICBmdW4gbmV4dERhdGUoKTogRGF0ZSB7XG4gICAgICAgIHJldHVybiBhZGREYXlzKDEpXG4gICAgfVxuXG4gICAgZnVuIHByZXZEYXRlKCk6IERhdGUge1xuICAgICAgICByZXR1cm4gc3VidHJhY3REYXlzKDEpXG4gICAgfVxuXG4gICAgZnVuIHN1YnRyYWN0RGF5cyhkYXlzOiBJbnQpOiBEYXRlIHtcbiAgICAgICAgaWYgKGRheXMgPCAwKSB7XG4gICAgICAgICAgICB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oKVxuICAgICAgICB9XG4gICAgICAgIGlmIChkYXlzID09IDApIHJldHVybiB0aGlzXG5cbiAgICAgICAgaWYgKGRheXMgPCBkYXkpIHtcbiAgICAgICAgICAgIHJldHVybiBEYXRlKGRheSAtIGRheXMsIG1vbnRoLCB5ZWFyKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdmFsIGRheXNUb1ByZXZZZWFyID0gZGF5c0Zyb20oZmlyc3REYXlPZih5ZWFyKSlcbiAgICAgICAgICAgIHJldHVybiBpZiAoZGF5cyA+IGRheXNUb1ByZXZZZWFyKSB7XG4gICAgICAgICAgICAgICAgbGFzdERheU9mKHllYXIgLSAxKS5zdWJ0cmFjdERheXMoZGF5cyAtIGRheXNUb1ByZXZZZWFyIC0gMSlcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbGFzdERheU9mKHllYXIsIG1vbnRoLnByZXYoKSEhKS5zdWJ0cmFjdERheXMoZGF5cyAtIGRheSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBjb21wYXJlVG8ob3RoZXI6IERhdGUpOiBJbnQge1xuICAgICAgICBpZiAoeWVhciAhPSBvdGhlci55ZWFyKSByZXR1cm4geWVhciAtIG90aGVyLnllYXJcbiAgICAgICAgcmV0dXJuIGlmIChtb250aC5vcmRpbmFsKCkgIT0gb3RoZXIubW9udGgub3JkaW5hbCgpKSBtb250aC5vcmRpbmFsKC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EludCk6IEludCB7XG4gICAgICAgIHJldHVybiBkYXlzXG4gICAgfVxuXG4gICAgb3BlbiBmdW4gZ2V0RGF5c0luTGVhcFllYXIoKTogSW50IHtcbiAgICAgICAgcmV0dXJuIGRheXNcbiAgICB9XG5cbiAgICBmdW4gcHJldigpOiBNb250aD8ge1xuICAgICAgICByZXR1cm4gaWYgKG15T3JkaW5hbCA9PSAwKSBudWxsIGVsc2UgTW9udGgudmFsdWVzKClbbXlPcmRpbmFsIC0gMV1cbiAgICB9XG5cbiAgICBvcGVyYXRvciBmdW4gbmV4dCgpOiBNb250aD8ge1xuICAgICAgICB2YWwgdmFsdWVzID0gTW9udGgudmFsdWVzKClcbiAgICAgICAgcmV0dXJuIGlmIChteU9yZGluYWwgPT0gdmFsdWVzLnNpemUgLSAxKSBudWxsIGVsc2UgdmFsdWVzW215T3JkaW5hbCArIDFdXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIHRvU3RyaW5nKCk6IFN0cmluZyB7XG4gICAgICAgIHJldHVybiBteU5hbWVcbiAgICB9XG5cbiAgICBwcml2YXRlIGNsYXNzIFZhckxlbmd0aE1vbnRoKGRheXM6IEludCwgcHJpdmF0ZSB2YWwgbXlEYXlzSW5MZWFwWWVhcjogSW50LCBvcmRpbmFsOiBJbnQsIG5hbWU6IFN0cmluZykgOiBNb250aChkYXlzLCBvcmRpbmFsLCBuYW1lKSB7XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGdldERheXNJbkxlYXBZZWFyKCk6IEludCB7XG4gICAgICAgICAgICByZXR1cm4gbXlEYXlzSW5MZWFwWWVhclxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGdldERheXNJblllYXIoeWVhcjogSW50KTogSW50IHtcbiAgICAgICAgICAgIHJldHVybiBpZiAoRGF0ZVRpbWVVdGlsLmlzTGVhcCh5ZWFyKSkge1xuICAgICAgICAgICAgICAgIGdldERheXNJbkxlYXBZZWFyKClcbiAgICAgICAgICA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AgICAgIHJlc3VsdC5hcHBlbmQoaG91cnMpXG4gICAgICAgIGlmIChtaW51dGVzIDwgMTApIHJlc3VsdC5hcHBlbmQoXCIwXCIpXG4gICAgICAgIHJlc3VsdC5hcHBlbmQobWludXRlcylcbiAgICAgICAgaWYgKHNlY29uZHMgPCAxMCkgcmVzdWx0LmFwcGVuZChcIjBcIilcbiAgICAgICAgcmVzdWx0LmFwcGVuZChzZWNvbmRzKVxuICAgICAgICByZXR1cm4gcmVzdWx0LnRvU3RyaW5nKClcbiAgICB9XG5cbiAgICBmdW4gdG9QcmV0dHlITVN0cmluZygpOiBTdHJpbmcge1xuICAgICAgICB2YWwgcmVzdWx0ID0gU3RyaW5nQnVpbGRlcigpXG4gICAgICAgIGlmIChob3VycyA8IDEwKSByZXN1bHQuYXBwZW5kKFwiMFwiKVxuICAgICAgICByZXN1bHQuYXBwZW5kKGhvdXJzKS5hcHBlbmQoREVMSU1JVEVSKVxuICAgICAgICBpZiAobWludXRlcyA8IDEwKSByZXN1bHQuYXBwZW5kKFwiMFwiKVxuICAgICAgICByZXN1bHQuYXBwZW5kKG1pbnV0ZXMpXG4gICAgICAgIHJldHVybiByZXN1bHQudG9TdHJpbmcoKVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBwcml2YXRlIHZhbCBERUxJTUlURVIgPSAnOidcbiAgICAgICAgdmFsIERBWV9TVEFSVCA9IFRpbWUoMCwgMClcbiAgICAgICAgdmFsIERBWV9FTkQgPSBUaW1lKDI0LCAwKVxuXG4gICAgICAgIGZ1biBwYXJzZShzOiBTdHJpbmcpOiBUaW1lIHtcbiAgICAgICAgICAgIGlmIChzLmxlbmd0aCA8IDYpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgaG91cnMgPSBzLnN1YnN0cmluZygwLCAyKS50b0ludCgpXG4gICAgICAgICAgICB2YWwgbWludXRlcyA9IHMuc3Vic3RyaW5nKDIsIDQpLnRvSW50KClcbiAgICAgICAgICAgIHZhbCBzZWNvbmRzID0gcy5zdWJzdHJpbmcoNCwgNikudG9JbnQoKVxuXG4gICAgICAgICAgICByZXR1cm4gVGltZShob3VycywgbWludXRlcywgc2Vjb25kcylcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBmcm9tUHJldHR5SE1TdHJpbmcodGltZTogU3RyaW5nKTogVGltZSB7XG4gICAgICAgICAgICBpZiAoIXRpbWUuY29udGFpbnMoREVMSU1JVEVSICsgXCJcIikpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFsIGxlbmd0aCA9IHRpbWUubGVuZ3RoXG4gICAgICAgICAgICBpZiAobGVuZ3RoICE9IDUgJiYgbGVuZ3RoICE9IDQpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFsIGhvdXJMZW5ndGggPSBpZiAobGVuZ3RoID09IDQpIDEgZWxzZSAyXG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIHJldHVybiBUaW1lKFxuICAgICAgICAgICAgICAgICAgICAgICAgdGltZS5zdWJzdHJpbmcoMCwgaG91ckxlbmd0aCkudG9JbnQoKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpbWUuc3Vic3RyaW5nKGhvdXJMZW5ndGggKyAxLCBsZW5ndGgpLnRvSW50KCksIDApXG4gICAgICAgICAgICB9IGNhdGNoIChpZ25vcmVkOiBOdW1iZXJGb3JtYXRFeGNlcHRpb24pIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgIH1c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HRydWVcbiAgICB9XG5cbiAgICBmdW4gZW5zdXJlQ29uc3VtZWQoKSB7XG4gICAgICAgIGlmICghaXNDb25zdW1lZCkge1xuICAgICAgICAgICAgY29uc3VtZSgpXG4gICAgICAgIH1cbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgTUlUIGxpY2Vuc2UgdGhhdCBjYW4gYmUgZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZS5cbiAqL1xuXG5wYWNrYWdlIGpldGJyYWlucy5kYXRhbG9yZS5iYXNlLmV2ZW50XG5cbmVudW0gY2xhc3MgS2V5IHByaXZhdGUgY29uc3RydWN0b3IocHJpdmF0ZSB2YWwgbXlWYWx1ZTogU3RyaW5nKSB7XG4gICAgQShcIkFcIiksXG4gICAgQihcIkJcIiksXG4gICAgQyhcIkNcIiksXG4gICAgRChcIkRcIiksXG4gICAgRShcIkVcIiksXG4gICAgRihcIkZcIiksXG4gICAgRyhcIkdcIiksXG4gICAgSChcIkhcIiksXG4gICAgSShcIklcIiksXG4gICAgSihcIkpcIiksXG4gICAgSyhcIktcIiksXG4gICAgTChcIkxcIiksXG4gICAgTShcIk1cIiksXG4gICAgTihcIk5cIiksXG4gICAgTyhcIk9cIiksXG4gICAgUChcIlBcIiksXG4gICAgUShcIlFcIiksXG4gICAgUihcIlJcIiksXG4gICAgUyhcIlNcIiksXG4gICAgVChcIlRcIiksXG4gICAgVShcIlVcIiksXG4gICAgVihcIlZcIiksXG4gICAgVyhcIldcIiksXG4gICAgWChcIlhcIiksXG4gICAgWShcIllcIiksXG4gICAgWihcIlpcIiksXG4gICAgRElHSVRfMChcIjBcIiksXG4gICAgRElHSVRfMShcIjFcIiksXG4gICAgRElHSVRfMihcIjJcIiksXG4gICAgRElHSVRfMyhcIjNcIiksXG4gICAgRElHS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gICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChsaW1pdCA+IDAgJiYgKytjb3VudGVyID49IGxpbWl0IHx8IG5leHRTZWFyY2hJbmRleCA+IGlucHV0Lmxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICBuZXh0SXRlbSA9IGN1cnJlbnRTdGFydEluZGV4Li5pbnB1dC5sYXN0SW5kZXhcbiAgICAgICAgICAgICAgICAgICAgbmV4dFNlYXJjaEluZGV4ID0gLTFcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB2YWwgbWF0Y2ggPSBpbnB1dC5nZXROZXh0TWF0Y2gobmV4dFNlYXJjaEluZGV4KVxuICAgICAgICAgICAgICAgICAgICBpZiAobWF0Y2ggPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbmV4dEl0ZW0gPSBjdXJyZW50U3RhcnRJbmRleC4uaW5wdXQubGFzdEluZGV4XG4gICAgICAgICAgICAgICAgICAgICAgICBuZXh0U2VhcmNoSW5kZXggPSAtMVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIChpbmRleCwgbGVuZ3RoKSA9IG1hdGNoXG4gICAgICAgICAgICAgICAgICAgICAgICBuZXh0SXRlbSA9IGN1cnJlbnRTdGFydEluZGV4IHVudGlsIGluZGV4XG4gICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50U3RhcnRJbmRleCA9IGluZGV4ICsgbGVuZ3RoXG4gICAgICAgICAgICAgICAgICAgICAgICBuZXh0U2VhcmNoSW5kZXggPSBjdXJyZW50U3RhcnRJbmRleCArIGlmIChsZW5ndGggPT0gMCkgMSBlbHNlIDBcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBuZXh0U3RhdGUgPSAxXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBvdmVycm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8+KTogQ2xvc2VkUmFuZ2U8VD4ge1xuICAgICAgICAgICAgdmFyIGl0ZXJhdGVkID0gZmFsc2VcbiAgICAgICAgICAgIHZhciBtaW46IFQ/ID0gbnVsbFxuICAgICAgICAgICAgdmFyIG1heDogVD8gPSBudWxsXG4gICAgICAgICAgICBmb3IgKHY6IFQ/IGluIHZhbHVlcykge1xuICAgICAgICAgICAgICAgIGlmICghaXRlcmF0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgaXRlcmF0ZWQgPSB0cnVlXG4gICAgICAgICAgICAgICAgICAgIG1pbiA9IHZcbiAgICAgICAgICAgICAgICAgICAgbWF4ID0gdlxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIG1pbiA9IG1pbihtaW4hISwgdiEhKVxuICAgICAgICAgICAgICAgICAgICBtYXggPSBtYXgobWF4ISEsIHYpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFpdGVyYXRlZCkge1xuICAgICAgICAgICAgICAgIHRocm93IE5vU3VjaEVsZW1lbnRFeGNlcHRpb24oKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIENsb3NlZFJhbmdlPFQ+KG1pbiEhLCBtYXghISlcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkgSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKlxuICogVGhpcyBmaWxlIGhhcyBiZWVuIG1vZGlmaWVkIGJ5IEpldEJyYWlucyA6IEphdmEgY29kZSBoYXMgYmVlbiBjb252ZXJ0ZWQgdG8gS290bGluIGNvZGUuXG4gKlxuICogVEhFIEZPTExPV0lORyB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VWZWN0b3IpOiBEb3VibGVSZWN0YW5nbGUge1xuICAgICAgICByZXR1cm4gRG91YmxlUmVjdGFuZ2xlKG9yaWdpbi5zdWJ0cmFjdCh2KSwgZGltZW5zaW9uKVxuICAgIH1cblxuICAgIGZ1biBkaXN0YW5jZSh0bzogRG91YmxlVmVjdG9yKTogRG91YmxlIHtcbiAgICAgICAgdmFyIHJlc3VsdCA9IDAuMFxuICAgICAgICB2YXIgaGFzUmVzdWx0ID0gZmFsc2VcbiAgICAgICAgZm9yIChzIGluIHBhcnRzKSB7XG4gICAgICAgICAgICBpZiAoIWhhc1Jlc3VsdCkge1xuICAgICAgICAgICAgICAgIHJlc3VsdCA9IHMuZGlzdGFuY2UodG8pXG4gICAgICAgICAgICAgICAgaGFzUmVzdWx0ID0gdHJ1ZVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YWwgZGlzdGFuY2UgPSBzLmRpc3RhbmNlKHRvKVxuICAgICAgICAgICAgICAgIGlmIChkaXN0YW5jZSA8IHJlc3VsdCkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBkaXN0YW5jZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGhhc2hDb2RlKCk6IEludCB7XG4gICAgICAgIHJldHVybiBvcmlnaW4uaGFzaENvZGUoKSAqIDMxICsgZGltZW5zaW9uLmhhc2hDb2RlKClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gZXF1YWxzKG90aGVyOiBBbnk/KTogQm9vbGVhbiB7XG4gICAgICAgIGlmIChvdGhlciAhaXMgRG91YmxlUmVjdGFuZ2xlKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2VcbiAgICAgICAgfVxuICAgICAgICB2YWwgciA9IG90aGVyIGFzIERvdWJsZVJlY3RhbmdsZT9cbiAgICAgIC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7IG1pblgsIG1pblksIG1heFgsIG1heFkgLT5cbiAgICAgICAgICAgIERvdWJsZVJlY3RhbmdsZS5zcGFuKFxuICAgICAgICAgICAgICAgIERvdWJsZVZlY3RvcihtaW5YLCBtaW5ZKSxcbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IobWF4WCwgbWF4WSlcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biA8UG9pbnRULCBCb3hUPiBjYWxjdWxhdGVCb3VuZGluZ0JveChcbiAgICAgICAgcG9pbnRzOiBJdGVyYWJsZTxQb2ludFQ+LFxuICAgICAgICBnZXRYOiAoUG9pbnRUKSAtPiBEb3VibGUsXG4gICAgICAgIGdldFk6IChQb2ludFQpIC0+IERvdWJsZSxcbiAgICAgICAgZmFjdG9yeTogKG1pblg6IERvdWJsZSwgbWluWTogRG91YmxlLCBtYXhYOiBEb3VibGUsIG1heFk6IERvdWJsZSkgLT4gQm94VFxuICAgICk6IEJveFQge1xuICAgICAgICB2YWwgZmlyc3QgPSBwb2ludHMuaXRlcmF0b3IoKS5uZXh0KClcbiAgICAgICAgdmFyIG1pbkxvbiA9IGdldFgoZmlyc3QpXG4gICAgICAgIHZhciBtaW5MYXQgPSBnZXRZKGZpcnN0KVxuICAgICAgICB2YXIgbWF4TG9uID0gbWluTG9uXG4gICAgICAgIHZhciBtYXhMYXQgPSBtaW5MYXRcblxuICAgICAgICBmb3IgKHBvaW50IGluIHBvaW50cykge1xuICAgICAgICAgICAgbWluTG9uID0gbWluKG1pbkxvbiwgZ2V0WChwb2ludCkpXG4gICAgICAgICAgICBtYXhMb24gPSBtYXgobWF4TG9uLCBnZXRYKHBvaW50KSlcbiAgICAgICAgICAgIG1pbkxhdCA9IG1pbihtaW5MYXQsIGdldFkocG9pbnQpKVxuICAgICAgICAgICAgbWF4TGF0ID0gbWF4KG1heExhdCwgZ2V0WShwb2ludCkpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gZmFjdG9y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0dXJuIERvdWJsZVZlY3Rvcih4ICsgdi54LCB5ICsgdi55KVxuICAgIH1cblxuICAgIGZ1biBzdWJ0cmFjdCh2OiBEb3VibGVWZWN0b3IpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKHggLSB2LngsIHkgLSB2LnkpXG4gICAgfVxuXG4gICAgZnVuIG1heCh2OiBEb3VibGVWZWN0b3IpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKG1heCh4LCB2LngpLCBtYXgoeSwgdi55KSlcbiAgICB9XG5cbiAgICBmdW4gbWluKHY6IERvdWJsZVZlY3Rvcik6IERvdWJsZVZlY3RvciB7XG4gICAgICAgIHJldHVybiBEb3VibGVWZWN0b3IobWluKHgsIHYueCksIG1pbih5LCB2LnkpKVxuICAgIH1cblxuICAgIGZ1biBtdWwodmFsdWU6IERvdWJsZSk6IERvdWJsZVZlY3RvciB7XG4gICAgICAgIHJldHVybiBEb3VibGVWZWN0b3IoeCAqIHZhbHVlLCB5ICogdmFsdWUpXG4gICAgfVxuXG4gICAgZnVuIGRvdFByb2R1Y3QodjogRG91YmxlVmVjdG9yKTogRG91YmxlIHtcbiAgICAgICAgcmV0dXJuIHggKiB2LnggKyB5ICogdi55XG4gICAgfVxuXG4gICAgZnVuIG5lZ2F0ZSgpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKC14LCAteSlcbiAgICB9XG5cbiAgICBmdW4gb3J0aG9nb25hbCgpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKC15LCB4KVxuICAgIH1cblxuICAgIGZ1biBsZW5ndGgoKTogRG91YmxlIHtcbiAgICAgICAgcmV0dXJuIHNxcnQoeCAqIHggKyB5ICogeSlcbiAgICB9XG5cbiAgICBmdW4gbm9ybWFsaXplKCk6IERvdWJsZVZlY3RvciB7XG4gICAgIC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QgPSB7fVxuICAgICAgICB2YWwgaGFuZGxlTGlzdCA9IHsgbGlzdDogTGlzdDwqPiAtPlxuICAgICAgICAgICAgYnVmZmVyLmFwcGVuZCgnWycpXG4gICAgICAgICAgICB2YXIgZmlyc3QgPSB0cnVlXG4gICAgICAgICAgICBmb3IgKHYgaW4gbGlzdCkge1xuICAgICAgICAgICAgICAgIGlmICghZmlyc3QpIGJ1ZmZlci5hcHBlbmQoJywnKSBlbHNlIGZpcnN0ID0gZmFsc2VcbiAgICAgICAgICAgICAgICBoYW5kbGVWYWx1ZSh2KVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnVmZmVyLmFwcGVuZCgnXScpXG4gICAgICAgIH1cbiAgICAgICAgQFN1cHByZXNzKFwiTkFNRV9TSEFET1dJTkdcIilcbiAgICAgICAgdmFsIGhhbmRsZU1hcCA9IHsgbWFwOiBNYXA8KiwgKj4gLT5cbiAgICAgICAgICAgIGJ1ZmZlci5hcHBlbmQoJ3snKVxuICAgICAgICAgICAgdmFyIGZpcnN0ID0gdHJ1ZVxuICAgICAgICAgICAgZm9yICgoaywgdikgaW4gbWFwKSB7XG4gICAgICAgICAgICAgICAgayBhcz8gU3RyaW5nID86IHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcbiAgICAgICAgICAgICAgICAgICAgXCJPbmx5IGBzdHJpbmdgIGtleXMgYXJlIHN1cHBvcnRlZCwgd2FzOiAke2shITo6Y2xhc3Muc2ltcGxlTmFtZSA/OiBcIm5vIGNsYXNzIG5hbWVcIn1cIlxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICBpZiAoIWZpcnN0KSBidWZmZXIuYXBwZW5kKCcsJykgZWxzZSBmaXJzdCA9IGZhbHNlXG4gICAgICAgICAgICAgICAgYnVmZmVyLmFwcGVuZCgnXFxuJylcbiAgICAgICAgICAgICAgICBidWZmZXIuYXBwZW5kKCdcIicpLmFwcGVuZChrLmVzY2FwZSgpKS5hcHBlbmQoJ1w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ludD8pIC0+IFVuaXQpID0gYXBwbHkge1xuICAgICAgICBpZiAoY29udGFpbnNOb3ROdWxsKGtleSkpIHtcbiAgICAgICAgICAgIHByb2Nlc3NvcihnZXRJbnQoa2V5KSlcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHByb2Nlc3NvcihudWxsKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuIGdldEludE9yRGVmYXVsdChrZXk6IFN0cmluZywgcHJvY2Vzc29yOiAoSW50KSAtPiBVbml0LCBkZWZhdWx0VmFsdWU6IEludCkgPSBhcHBseSB7XG4gICAgICAgIGlmIChjb250YWluc05vdE51bGwoa2V5KSkge1xuICAgICAgICAgICAgcHJvY2Vzc29yKGdldEludChrZXkpKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcHJvY2Vzc29yKGRlZmF1bHRWYWx1ZSlcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biA8VCA6IEVudW08VD4+IGZvckVudW1zKGtleTogU3RyaW5nLCBwcm9jZXNzb3I6IChUKSAtPiBVbml0LCBlbnVtVmFsdWVzOiBBcnJheTxUPikgPSBhcHBseSB7XG4gICAgICAgIGdldEFycihrZXkpLmZvckVhY2ggeyBwcm9jZXNzb3IocGFyc2VFbnVtKGl0IGFzIFN0cmluZywgZW51bVZhbHVlcykpIH1cbiAgICB9XG5cbiAgICBmdW4gPFQgOiBFbnVtPFQ+PiBnZXRPcHRpb25hbEVudW0oa2V5OiBTdHJpbmcsIHByb2Nlc3NvcjogKFQ/KSAtPiBVbml0LCBlbnVtVmFsdWVzOiBBcnJheTxUPikgPSBhcHBseSB7XG4gICAgICAgIHdoZW4ge1xuICAgICAgICAgICAgY29udGFpbnNOb3ROdWxsKGtleSkgLT4gcHJvY2Vzc29yKGdldEVudW0oa2V5LCBlbnVtVmFsdWVzKSlcbiAgICAgICAgICAgIGVsc2UgLT4gcHJvY2Vzc29yKG51bGwpXG4gICAgICAgIH1cbiAgICB9XG59XG4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lcigpIC0+IFRva2VuLk5VTUJFUlxuICAgICAgICAgICAgZWxzZSAtPiBlcnJvcihcIiRpOiR7Y3VycmVudENoYXJ9IC0gdW5rb3duIHRva2VuXCIpXG4gICAgICAgIH0uYWxzbyB7IGN1cnJlbnRUb2tlbiA9IGl0IH1cbiAgICB9XG5cbiAgICBmdW4gdG9rZW5WYWx1ZSgpID0gaW5wdXQuc3Vic3RyaW5nKHRva2VuU3RhcnQsIGkpXG5cbiAgICBwcml2YXRlIGZ1biByZWFkU3RyaW5nKCkge1xuICAgICAgICBzdGFydFRva2VuKClcbiAgICAgICAgYWR2YW5jZSgpIC8vIG9wZW5pbmcgcXVvdGVcbiAgICAgICAgd2hpbGUoIShjdXJyZW50Q2hhciA9PSAnXCInKSkge1xuICAgICAgICAgICAgaWYoY3VycmVudENoYXIgPT0gJ1xcXFwnKSB7XG4gICAgICAgICAgICAgICAgYWR2YW5jZSgpXG4gICAgICAgICAgICAgICAgd2hlbiB7XG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRDaGFyID09ICd1JyAtPiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBhZHZhbmNlKClcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcGVhdCg0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZShjdXJyZW50Q2hhci5pc0hleCgpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZHZhbmNlKClcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjdXJyZW50Q2hhciBpbiBTUEVDSUFMX0NIQVJTIC0+IGFkdmFuY2UoKVxuICAgICAgICAgICAgICAgICAgICBlbHNlIC0+IGVycm9yKFwiSW52YWxpZCBlc2NhcGUgc2VxdWVuY2VcIilcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGFkdmFuY2UoKVx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aXN0PEFueT8+IHtcbiAgICAgICAgZnVuIGNoZWNrQ3VycmVudFRva2VuKHRva2VuOiBUb2tlbikgeyByZXF1aXJlKGxleGVyLmN1cnJlbnRUb2tlbiwgdG9rZW4sIFwiW0Fycl0gXCIpIH1cblxuICAgICAgICB2YWwgbGlzdCA9IG11dGFibGVMaXN0T2Y8QW55Pz4oKVxuXG4gICAgICAgIGNoZWNrQ3VycmVudFRva2VuKFRva2VuLkxFRlRfQlJBQ0tFVClcbiAgICAgICAgbGV4ZXIubmV4dFRva2VuKClcblxuICAgICAgICB3aGlsZSAobGV4ZXIuY3VycmVudFRva2VuICE9IFRva2VuLlJJR0hUX0JSQUNLRVQpIHtcbiAgICAgICAgICAgIGlmIChsaXN0LmlzTm90RW1wdHkoKSkge1xuICAgICAgICAgICAgICAgIGNoZWNrQ3VycmVudFRva2VuKFRva2VuLkNPTU1BKVxuICAgICAgICAgICAgICAgIGxleGVyLm5leHRUb2tlbigpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsaXN0LmFkZChwYXJzZVZhbHVlKGxleGVyKSlcbiAgICAgICAgfVxuXG4gICAgICAgIGNoZWNrQ3VycmVudFRva2VuKFRva2VuLlJJR0hUX0JSQUNLRVQpXG4gICAgICAgIGxleGVyLm5leHRUb2tlbigpXG5cbiAgICAgICAgcmV0dXJuIGxpc3RcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBwYXJzZU9iamVjdChsZXhlcjogSnNvbkxleGVyKTogTWFwPFN0cmluZywgQW55Pz4ge1xuICAgICAgICBmdW4gY2hlY2tDdXJyZW50VG9rZW4odG9rZW46IFRva2VuKSB7IHJlcXVpcmUobGV4ZXIuY3VycmVudFRva2VuLCB0b2tlbiwgXCJbT2JqXSBcIikgfVxuXG4gICAgICAgIHZhbCBtYXAgPSBtdXRhYmxlTWFwT2Y8U3RyaW5nLCBBbnk/PigpXG5cbiAgICAgICAgY2hlY2tDdXJyZW50VG9rZW4oVG9rZW4uTEVGVF9CUkFDRSlcbiAgICAgICAgbGV4ZXIubmV4dFRva2VuKClcblxuICAgICAgICB3aGlsZSAobGV4ZXIuY3VycmVudFRva2VuICE9IFRva2VuLlJJR0hUX0JSQUNFKSB7XG4gICAgICAgICAgICBpZiAobWFwLmlzTm90RW1wdHkoKSkge1xuICAgICAgICAgICAgICAgIGNoZWNrQ3VycmVudFRva2VuKFRva2VuLkNPTU1BKVxuICAgICAgICAgICAgICAgIGxleGVyLm5leHRUb2tlbigpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGNoZWNrQ3VycmVudFRva2VuKFRva2VuLlNUUklORylcbiAgICAgICAgICAgIHZhbCBrZXkgPSBsZXhlci50b2tlblZhbHVlKCkudW5lc2NhcGUoKVxuICAgICAgICAgICAgbGV4ZXIubmV4dFRva2VuKClcblxuICAgICAgICAgICAgY2hlY2tDdXJyZW50VG9rZW4oVG9rZW4uQ09MT04pXG4gICAgICAgICAgICBsZXhlci5uZXh0VG9rZW4oKVxuXG4gICAgICAgICAgICB2YWwgdmFsdWUgPSBwYXJzZVZhbHVlKGxleGVyKVxuICAgICAgICAgICAgbWFwW2tleV0gPSB2YWx1ZVxuICAgICAgICB9XG5cbiAgICAgICAgY2hlY2tDdXJyZW50VG9rZW4oVG9rZW4uUklHSFRfQlJBQ0UpXG4gICAgICAgIGxleGVyLm5leHRUb2tlbigpXG5cbiAgICAgICAgcmV0dXJuIG1hcFxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHJlcXVpcmUoY3VycmVudDogVG9rZW4/LCBleHBlY3RlZDogVG9rZW4/LCBtZXNzYWdlUHJlZml4OiBTdHJpbmc/ID0gbnVsbCkge1xuICAgICAgICBpZiAoY3VycmVudCAhPSBleHBlY3RlZCkge1xuICAgICAgICAgICAgdGhyb3cgSnNvbkV4Y2VwdGlvbihtZXNzYWdlUHJlZml4ICsgXCJFeHBlY3RlZCB0b2tlbjogJGV4cGVjdGVkLCBhY3R1YWw6ICRjdXJyZW50XCIpXG4gICAgICA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mF5KClcbi8vICAgICAgICB9IGVsc2UgaWYgKGFyciBpcyBKc29uQXJyYXkpIHtcbi8vICAgICAgICAgICAgcmV0dXJuIGFyciBhcyBKc29uQXJyYXlcbi8vICAgICAgICB9XG4vL1xuLy8gICAgICAgIHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbihcIkpzb25PYmplY3QgZG9lcyBub3QgY29udGFpbiBhcnJheTogJGtleVwiKVxuLy8gICAgfVxuLy9cbi8vICAgIGZ1biByZWFkRG91YmxlKGFycmF5OiBKc29uQXJyYXksIGluZGV4OiBJbnQpOiBEb3VibGUge1xuLy8gICAgICAgIHJldHVybiBhcnJheS5nZXREb3VibGUoaW5kZXgpXG4vLyAgICB9XG4vL1xuLy8gICAgZnVuIGdldE9wdGlvbmFsKG9iajogSnNvbk9iamVjdCwga2V5OiBTdHJpbmcpOiBPcHRpb25hbDxBbnk+IHtcbi8vICAgICAgICByZXR1cm4gaWYgKCFvYmouZ2V0S2V5cygpLmNvbnRhaW5zKGtleSkpIHtcbi8vICAgICAgICAgICAgT3B0aW9uYWwuZW1wdHkoKVxuLy8gICAgICAgIH0gZWxzZSBPcHRpb25hbC5vZk51bGxhYmxlKG9ialtrZXldKVxuLy8gICAgfVxuLy9cbi8vICAgIGZ1biBnZXRPcHRpb25hbEludCh2OiBBbnkpOiBPcHRpb25hbDxJbnQ+IHtcbi8vICAgICAgICBpZiAodiBpcyBKc29uTnVsbCkge1xuLy8gICAgICAgICAgICByZXR1cm4gT3B0aW9uYWwuZW1wdHkoKVxuLy8gICAgICAgIH0gZWxzZSBpZiAoaXNOdW1iZXIodikpIHtcbi8vICAgICAgICAgICAgcmV0dXJuIE9wdGlvbmFsLm9mKCh2IGFzIEpzb25OdW1iZXIpLmdldEludFZhbHVlKCkpXG4vLyAgICAgICAgfVxuLy9cbi8vICAgICAgICB0aHJvdyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oXCJPYmplY3QgaXMgbm90IEpzb25OdW1iZXI6IFwiIC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W50OiBLKTogQm9vbGVhbiB7XG4gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKFwiTm90IGF2YWlsYWJsZSBpbiBrZXlTZXRcIilcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGl0ZXJhdG9yKCk6IE11dGFibGVJdGVyYXRvcjxLPiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG1hcEl0ZXJhdG9yKG9iamVjdCA6IEl0ZXJhdG9yU3BlYyB7XG4gICAgICAgICAgICAgICAgICAgIG92ZXJyaWRlIG9wZXJhdG9yIGZ1biBnZXQoaW5kZXg6IEludCk6IEFueT8ge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG15RGF0YVtpbmRleF1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gdmFsdWVzKCk6IENvbGxlY3Rpb248Vj8+IHtcbiAgICAgICAgcmV0dXJuIG9iamVjdCA6IEFic3RyYWN0Q29sbGVjdGlvbjxWPz4oKSB7XG4gICAgICAgICAgICBvdmVycmlkZSB2YWwgc2l6ZTogSW50XG4gICAgICAgICAgICAgICAgZ2V0KCkgPSB0aGlzQExpc3RNYXAuc2l6ZSgpXG5cbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBpdGVyYXRvcigpOiBJdGVyYXRvcjxWPz4ge1xuICAgICAgICAgICAgICAgIHJldHVybiBtYXBJdGVyYXRvcihvYmplY3QgOiBJdGVyYXRvclNwZWMge1xuICAgICAgICAgICAgICAgICAgICBvdmVycmlkZSBvcGVyYXRvciBmdW4gZ2V0KGluZGV4OiBJbnQpOiBBbnk/IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBteURhdGFbaW5kZXggKyAxXVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBlbnRyeVNldCgpOiBTZXQ8RW50cnk+IHtcbiAgICAgICAgcmV0dXJuIG9iamVjdCA6IEFic3RyYWN0U2V0PEVudHJ5PigpIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIHZhbCBzaXplOiBJbnRcbiAgICAgICAgICAgICAgICBnZXQoKSA9IHRoaXNATGlzdE1hcC5zaXplKClcblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGl0ZXJhdG9yKCk6IEl0ZXJhdG9yPExpc3RNYXA8SywgVj4uRW50cnk+IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbWFwSXRlcmF0b3Iob2JqZWN0IDogSXRlcmF0b3JTcGVjIHtcbiAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGUgb3BlcmF0b3IgZnVuIGdldChpbmRleDogSW50KTogQW55IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFbnRyeShpbmRleClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gc2l6ZSgpOiBJbnQge1xuICAgICAgICByZXR1cm4gbXlEYXRhLnNpemUgLyAyXG4gICAgfVxuXG4gICAgZnVuIHB1dChrZXk6IEssIHZhbHVlOiBWPyk6IFY/IHtcbiAgICAgICAgdmFsIGluZGV4ID0gZmluZEJ5S2V5KGtleSlcbiAgICAgICAgaWYgKGluZGV4ID49IDApIHtcbiAgICAgICAgICAgIHZhbCBvbGRWYWx1ZSA9IG15RGF0YVtpbmRleCArIDFdXG4gICAgICAgICAgICBteURhdGFbaW5kZXggKyAxXSA9IHZhbHVlXG4gICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgcmV0dXJuIG9sZFZhbHVlIGFzIFY/XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbmV3QXJyYXkgPSBBcnJheShteURhdGEuc2l6ZSArIDIpIHsgaSAtPlxuICAgICAgICAgICAgaWYgKGkgPCBteURhdGEuc2l6ZSkgbXlEYXRhW2ldIGVsc2UgbnVsbFxuICAgICAgICB9XG5cbiAgICAgICAgbmV3QXJyYXlbbXlEYXRhLnNpemVdID0ga2V5XG4gICAgICAgIG5ld0FycmF5W215RGF0YS5zaXplICsgMV0gPSB2YWx1ZVxuICAgICAgICBteURhdGEgPSBuZXdBcnJheVxuICAgICAgICByZXR1cm4gbnVsbFxuICAgIH1cblxuICAgIG9wZXJhdG9yIGZ1biBnZXQoa2V5OiBLKTogVj8ge1xuICAgICAgICB2YWwgaW5kZXggPSBmaW5kQnlLZXkoa2V5KVxuICAgICAgICByZXR1cm4gaWYgKGluZGV4ID09IC0xKSB7XG4gICAgICAgICAgICBudWxsXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgbXlEYXRhW2luZGV4ICsgMV0gYXMgVj9cbiAgICAgICAgfVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biB0b1N0cmluZygpOiBTdHJpbmcge1xuICAgICAgICB2YWwgYnVpbGRlciA9IFN0cmluZ0J1aWxkZXIoKVxuICAgICAgICBidWlsZGVyLmFwcGVuZChcIntcIilcbiAgICAgICAgdmFyIGkgPSAwXG4gICAgICAgIHdoaWxlIChpIDwgbXlEYXRhLnNpemUpIHtcbiAgICAgICAgICAgIHZhbCBrID0gbXlEYXRhW2ldXG4gICAgICAgICAgICB2YWwgdiA9IG15RGF0YVtpICsgMV1cbiAgICAgICAgICAgIGlmIChpICE9IDApIHtcbiAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChcIixcIilcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGspLmFwcGVuZChcIj1cIikuYXBwZW5kKHYpXG4gICAgICAgICAgICBpICs9IDJcbiAgICAgICAgfVxuICAgICAgICBidWlsZGVyLmFwcGVuZChcIn1cIilcblxuICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gPFQ+IG1hcEl0ZXJhdG9yKHNwZWM6IEl0ZXJhdG9yU3BlYyk6IE11dGFibGVJdGVyYXRvcjxUPiB7XG4gICAgICAgIHJldHVybiBvYmplY3QgOiBNdXRhYmxlSXRlcmF0b3I8VD4ge1xuICAgICAgICAgICAgcHJpdmF0ZSB2YXIgaW5kZXggPSAwXG4gICAgICAgICAgICBwcml2YXRlIHZhciBuZXh0Q2FsbGVkID0gZmFsc2VcblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGhhc05leHQoKTogQm9vbGVhbiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGluZGV4IDwgbXlEYXRhLnNpemVcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIG5leHQoKTogVCB7XG4gICAgICAgICAgICAgICAgaWYgKCFoYXNOZXh0KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgTm9TdWNoRWxlbWVudEV4Y2VwdGlvbigpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG5leHRDYWxsZWQgPSB0cnVlXG4gICAgICAgICAgICAgICAgQFN1cHByZXNzKFwiVU5DSEVDS0VEX0NBU1RcIilcbiAgICAgICAgICAgICAgICB2YWwgdmFsdWUgPSBzcGVjW2luZGV4XSBhcyBUXG4gICAgICAgICAgICAgICAgaW5kZXggKz0gMlxuICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gcmVtb3ZlKCkge1xuICAgICAgICAgICAgICAgIGlmICghbmV4dENhbGxlZCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpbmRleCAtPSAyXG4gICAgICAgICAgICAgICAgcmVtb3ZlQXQoaW5kZXgpXG4gICAgICAgICAgICAgICAgbmV4dENhbGxlZCA9IGZhbHNlXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBmaW5kQnlLZXkoa2V5OiBLKTogSW50IHtcbiAgICAgICAgdmFyIGkgPSAwXG4gICAgICAgIHdoaWxlIChpIDwgbXlEYXRhLnNpemUpIHtcbiAgICAgICAgICAgIHZhbCBrID0gbXlEYXRhW2ldXG4gICAgICAgICAgICBpZiAoa2V5ID09IGspIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaSArPSAyXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIC0xXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gcmVtb3ZlQXQoaW5kZXg6IEludCkge1xuICAgICAgICBpZiAobXlEYXRhLnNpemUgPT0gMikge1xuICAgICAgICAgICAgbXlEYXRhID0gRU1QVFlfQVJSQVlcbiAgICAgICAgICAgIHJldHVyblxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIG5ld0FycmF5ID0gQXJyYXkobXlEYXRhLnNpemUgLSAyKSB7IGkgLT5cbiAgICAgICAgICAgIGlmIChpIDwgaW5kZXgpIHtcbiAgICAgICAgICAgICAgICBteURhdGFbaV1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbXlEYXRhW2kgKyAyXVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgbXlEYXRhID0gbmV3QXJyYXlcbiAgICB9XG5cbiAgICBpbm5lciBjbGFzcyBFbnRyeSBpbnRlcm5hbCBjb25zdHJ1Y3Rvcihwcml2YXRlIHZhbCBte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uICAgIH1cblxuICAgIHJldHVybiBsZW5cbn1cblxuY2xhc3MgTnVtYmVyRm9ybWF0KHByaXZhdGUgdmFsIHNwZWM6IFNwZWMpIHtcblxuICAgIGNvbnN0cnVjdG9yKHNwZWM6IFN0cmluZykgOiB0aGlzKGNyZWF0ZShzcGVjKSlcblxuICAgIGRhdGEgY2xhc3MgU3BlYyhcbiAgICAgICAgdmFsIGZpbGw6IFN0cmluZyA9IFwiIFwiLFxuICAgICAgICB2YWwgYWxpZ246IFN0cmluZyA9IFwiPlwiLFxuICAgICAgICB2YWwgc2lnbjogU3RyaW5nID0gXCItXCIsXG4gICAgICAgIHZhbCBzeW1ib2w6IFN0cmluZyxcbiAgICAgICAgdmFsIHplcm86IEJvb2xlYW4sXG4gICAgICAgIHZhbCB3aWR0aDogSW50ID0gLTEsXG4gICAgICAgIHZhbCBjb21tYTogQm9vbGVhbixcbiAgICAgICAgdmFsIHByZWNpc2lvbjogSW50ID0gNixcbiAgICAgICAgdmFsIHR5cGU6IFN0cmluZyA9IFwiXCIsXG4gICAgICAgIHZhbCB0cmltOiBCb29sZWFuID0gZmFsc2VcbiAgICApXG5cblxuICAgIGRhdGEgY2xhc3MgTnVtYmVySW5mbyhcbiAgICAgICAgdmFsIG51bWJlcjogRG91YmxlID0gMC4wLFxuICAgICAgICB2YWwgbmVnYXRpdmU6IEJvb2xlYW4gPSBmYWxzZSxcbiAgICAgICAgdmFsIGludGVnZXJQYXJ0OiBMb25nID0gMCxcbiAgICAgICAgdmFsIGZyYWN0aW9uYWxQYXJ0OiBMb25nID0gMCxcbiAgICAgICAgdmFsIGV4cG9uZW50OiBJbnQ/ID0gbnVsbFxuICAgICkge1xuICAgICAgICBjb25zdHJ1Y3RvcihcbiAgICAgICAgICAgIG51bWJlcjogTnVtYmVyLFxuICAgICAgICAgICAgaW50ZWdlclBhcnQ6IExvbmcgPSAwLFxuICAgICAgICAgICAgZnJhY3Rpb25hbFBhcnQ6IExvbmcgPSAwLFxuICAgICAgICA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Xh0ZW5kZWQgdG8gbWF4IGRlY2ltYWwgZGlnaXRzKVxuICAgICAgICAgICAgICAgIHZhbCBlbmNvZGVGcmFjdGlvbiA9IHsgZnJhYzogU3RyaW5nLCBleHA6IEludCAtPlxuICAgICAgICAgICAgICAgICAgICB2YXIgZnJhY3Rpb24gPSBmcmFjXG4gICAgICAgICAgICAgICAgICAgIC8vIGN1dHRpbmcgdGhlIGZyYWN0aW9uIGlmIGl0IGxvbmdlciB0aGFuIG1heCBkZWNpbWFsIGRpZ2l0c1xuICAgICAgICAgICAgICAgICAgICBpZiAoZXhwID4gTUFYX0RFQ0lNQUxTKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBmcmFjdGlvbiA9IGZyYWMuc3Vic3RyaW5nKDAgdW50aWwgKGZyYWMubGVuZ3RoIC0gKGV4cCAtIE1BWF9ERUNJTUFMUykpKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGZyYWN0aW9uLnRvTG9uZygpICogMTAuMC5wb3coKE1BWF9ERUNJTUFMUyAtIGV4cCkuY29lcmNlQXRMZWFzdCgwKSkudG9Mb25nKClcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB2YWwgKGludFN0ciwgZnJhY1N0ciwgZXhwb25lbnRTdHJpbmcpID1cbiAgICAgICAgICAgICAgICAgICAgXCJeKFxcXFxkKylcXFxcLj8oXFxcXGQrKT9lPyhbKy1dP1xcXFxkKyk/XFwkXCJcbiAgICAgICAgICAgICAgICAgICAgICAgIC50b1JlZ2V4KClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5maW5kKG51bS50b0RvdWJsZSgpLmFic29sdXRlVmFsdWUudG9TdHJpbmcoKS5sb3dlcmNhc2UoKSlcbiAgICAgICAgICAgICAgICAgICAgICAgID8uZGVzdHJ1Y3R1cmVkXG4gICAgICAgICAgICAgICAgICAgICAgICA/OiBlcnJvcihcIldyb25nIG51bWJlcjogJG51bVwiKVxuXG4gICAgICAgICAgICAgICAgdmFsIGV4cG9uZW50OiBJbnQgPSBleHBvbmVudFN0cmluZy50b0ludE9yTnVsbCgpID86IDBcblxuICAgICAgICAgICAgICAgIC8vIG51bWJlciA9IDEuMjM0NTZFKzU1XG4gICAgICAgICAgICAgICAgaWYgKGV4cG9uZW50LmFic29sdXRlVmFsdWUgPj0gTUFYX0RFQ0lNQUxTKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXJJbmZvKFxuICAgICAgICAgICAgICAgICAgICAgICAgbnVtYmVyID0gbnVtLFxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gXCIxXCIgLT4gMVxuICAgICAgICAgICAgICAgICAgICAgICAgaW50ZWdlclBhcnQgPSBpbnRTdHIudG9Mb25nKCksXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBmcmFjdGlvbiBwYXJ0IGlnbm9yZWQgaW50ZW50aW9uYWxseVxuICAgICAgICAgICAgICAgICAgICAgICAgZnJhY3Rpb25hbFBhcnQgPSAwLFxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gNTVcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4cG9uZW50ID0gZXhwb25lbnRcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGNoZWNrKGV4cG9uZW50IDwgTUFYX0RFQ0lNQUxTKVxuICAgICAgICAgICAgICAgIC8vIG51bWJlciA9IDEuMjNFLTQuIGRvdWJsZTogMC4wMDAxMjNcbiAgICAgICAgICAgICAgICBpZiAoZXhwb25lbnQgPCAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXJJbmZvKFxuICAgICAgICAgICAgICAgICAgICAgICAgbnVtYmVyID0gbnVtLFxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gXCIxXCIgKyBcIjIzXCIgLT4gMDAwXzEyM18wMDBfMDAwXzAwMF8wMDBMXG4gICAgICAgICAgICAgICAgICAgICAgICBmcmFjdGlvbmFsUGFydCA9IGVuY29kZUZyYWN0aW9uKGludFN0ciArIGZyYWNTdHIsIGV4cG9uZW50LmFic29sdXRlVmFsdWUgKyBmcmFjU3RyLmxlbmd0aClcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGNoZWNrKGV4cG9uZW50ID49IDAgJiYgZXhwb25lbnQgPD0gTUFYX0RFQ0lNQUxTKVxuICAgICAgICAgICAgICAgIC8vIG51bWJlciA9IDEuMjM0RSs1LCBkb3VibGU6IDEyMzQwMC4wXG4gICAgICAgICAgICAgICAgaWYgKGV4cG9uZW50ID49IGZyYWNTdHIubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXJJbmZvKFxuICAgICAgICAgICAgICAgICAgICAgICAgbnVtYmVyID0gbnVtLFxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gXCIxXCIgKyBcIjIzNFwiICsgXCIwMFwiIC0+IDEyMzQwMFxuICAgICAgICAgICAgICAgICAgICAgICAgaW50ZWdlclBhcnQgPSAoaW50U3RyICsgZnJhY1N0ciArIFwiMFwiLnJlcGVhdChleHBvbmVudCAtIGZyYWNTdHIubGVuZ3RoKSkudG9Mb25nKClcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGNoZWNrKGV4cG9uZW50ID49IDAgJiYgZXhwb25lbnQgPCBmcmFjU3RyLmxlbmd0aClcbiAgICAgICAgICAgICAgICAvLyBudW1iZXIgPSAxLjIzNDU2N0UrMywgZG91YmxlOiAxMjM0LjU2N1xuICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXJJbmZvKFxuICAgICAgICAgICAgICAgICAgICBudW1iZXIgPSBudW0sXG4gICAgICAgICAgICAgICAgICAgIC8vIFwiMVwiICsgXCJbMjM0XTU2N1wiIC0+IDEyMzRcbiAgICAgICAgICAgICAgICAgICAgaW50Z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dHB1dCA9IGNvbXB1dGVQYWRkaW5nKG91dHB1dClcblxuICAgICAgICBpZiAoc3BlYy5jb21tYSAmJiBzcGVjLnplcm8pIHtcbiAgICAgICAgICAgIG91dHB1dCA9IGFwcGx5R3JvdXAob3V0cHV0KVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGdldEFsaWduZWRTdHJpbmcob3V0cHV0KVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGhhbmRsZU5vbk51bWJlcnMobnVtOiBOdW1iZXIpOiBTdHJpbmc/IHtcbiAgICAgICAgdmFsIG51bWJlciA9IG51bS50b0RvdWJsZSgpXG4gICAgICAgIHJldHVybiB3aGVuIHtcbiAgICAgICAgICAgIG51bWJlci5pc05hTigpIC0+IFwiTmFOXCJcbiAgICAgICAgICAgIG51bWJlciA9PSBEb3VibGUuTkVHQVRJVkVfSU5GSU5JVFkgLT4gXCItSW5maW5pdHlcIlxuICAgICAgICAgICAgbnVtYmVyID09IERvdWJsZS5QT1NJVElWRV9JTkZJTklUWSAtPiBcIitJbmZpbml0eVwiXG4gICAgICAgICAgICBlbHNlIC0+IG51bGxcbiAgICAgICAgfVxuICAgIH1cblxuXG4gICAgcHJpdmF0ZSBmdW4gZ2V0QWxpZ25lZFN0cmluZyhvdXRwdXQ6IE91dHB1dCk6IFN0cmluZyB7XG4gICAgICAgIHdpdGgob3V0cHV0KSB7XG4gICAgICAgICAgICByZXR1cm4gd2hlbiAoc3BlYy5hbGlnbikge1xuICAgICAgICAgICAgICAgIFwiPFwiIC0+IFwiJHNpZ24kcHJlZml4JGJvZHkkc3VmZml4JHBhZGRpbmdcIlxuICAgICAgICAgICAgICAgIFwiPVwiIC0+IFwiJHNpZ24kcHJlZml4JHBhZGRpbmckYm9keSRzdWZmaXhcIlxuICAgICAgICAgICAgICAgIFwiXlwiIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHN0b3AgPSBwYWRkaW5nLmxlbmd0aCAvIDJcbiAgICAgICAgICAg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W9uRm9ybWF0KG51bWJlckluZm8sIHNwZWMucHJlY2lzaW9uKVxuICAgICAgICAgICAgXCJiXCIgLT4gRm9ybWF0dGVkTnVtYmVyKG51bWJlckluZm8ubnVtYmVyLnJvdW5kVG9Mb25nKCkudG9TdHJpbmcoMikpXG4gICAgICAgICAgICBcIm9cIiAtPiBGb3JtYXR0ZWROdW1iZXIobnVtYmVySW5mby5udW1iZXIucm91bmRUb0xvbmcoKS50b1N0cmluZyg4KSlcbiAgICAgICAgICAgIFwiWFwiIC0+IEZvcm1hdHRlZE51bWJlcihudW1iZXJJbmZvLm51bWJlci5yb3VuZFRvTG9uZygpLnRvU3RyaW5nKDE2KS51cHBlcmNhc2UoKSlcbiAgICAgICAgICAgIFwieFwiIC0+IEZvcm1hdHRlZE51bWJlcihudW1iZXJJbmZvLm51bWJlci5yb3VuZFRvTG9uZygpLnRvU3RyaW5nKDE2KSlcbiAgICAgICAgICAgIFwic1wiIC0+IHRvU2lGb3JtYXQobnVtYmVySW5mbywgc3BlYy5wcmVjaXNpb24pXG4gICAgICAgICAgICBlbHNlIC0+IHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcIldyb25nIHR5cGU6ICR7c3BlYy50eXBlfVwiKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXMuY29weShib2R5ID0gZm9ybWF0dGVkTnVtYmVyKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHRvRXhwb25lbnRpYWwobnVtYmVySW5mbzogTnVtYmVySW5mbywgcHJlY2lzaW9uOiBJbnQgPSAtMSk6IE51bWJlckluZm8ge1xuICAgICAgICB2YWwgbnVtID0gbnVtYmVySW5mby5udW1iZXJcbiAgICAgICAgaWYgKG51bSA8IFRZUEVfRV9NSU4pIHtcbiAgICAgICAgICAgIHJldHVybiBOdW1iZXJJbmZvKDAuMClcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBlID0gaWYgKG51bWJlckluZm8uaW50ZWdlclBhcnQgPT0gMEwpIHtcbiAgICAgICAgICAgIC0obnVtYmVySW5mby5mcmFjdGlvbkxlYWRpbmdaZXJvcyArIDEpXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBudW1iZXJJbmZvLmludGVnZXJMZW5ndGggLSAxICtcbiAgICAgICAgICAgICAgICAgICAgKG51bWJlckluZm8uZXhwb25lbnQgPzogMClcbiAgICAgICAgfVxuICAgICAgICB2YWwgbiA9IG51bSAvIDEwLjAucG93KGUpXG5cbiAgICAgICAgdmFyIG5ld0luZm8gPSBjcmVhdGVOdW1iZXJJbmZvKG4pXG5cbiAgICAgICAgaWYgKHByZWNpc2lvbiA+IC0xKSB7XG4gICAgICAgICAgICBuZXdJbmZvID0gcm91bmRUb1ByZWNpc2lvbihuZXdJbmZvLCBwcmVjaXNpb24pXG4gICAgICAgIH1cblxuICAgICAgICBpZiAobmV3SW5mby5pbnRlZ2VyTGVuZ3RoID4gMSkge1xuICAgICAgICAgICAgZSArPSAxXG4gICAgICAgICAgICBuZXdJbmZvID0gY3JlYXRlTnVtYmVySW5mbyhuIC8gMTApXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbmV3SW5mby5jb3B5KGV4cG9uZW50ID0gZSlcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB0b1ByZWNpc2lvbkZvcm1hdChudW1iZXJJbmZvOiBOdW1iZXJJbmZvLCBwcmVjaXNpb246IEludCA9IC0xKTogRm9ybWF0dGVkTnVtYmVyIHtcbiAgICAgICAgaWYgKG51bWJlckluZm8uaW50ZWdlclBhcnQgPT0gMEwpIHtcbiAgICAgICAgICAgIGlmIChudW1iZXJJbmZvLmZyYWN0aW9uYWxQYXJ0ID09IDBMKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRvRml4ZWRGb3JtYXQobnVtYmVySW5mbywgcHJlY2lzaW9uIC0gMSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB0b0ZpeGVkRm9ybWF0KG51bWJlckluZm8sIHByZWNpc2lvbiArIG51bWJlckluZm8uZnJhY3Rpb25MZWFkaW5nWmVyb3MpXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAobnVtYmVySW5mby5pbnRlZ2VyTGVuZ3RoID4gcHJlY2lzaW9uKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRvU2ltcGxlRm9ybWF0KHRvRXhwb25lbnRpYWwobnVtYmVySW5mbywgcHJlY2lzaW9uIC0gMSksIHByZWNpc2lvbiAtIDEpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdG9GaXhlZEZvcm1hdChudW1iZXJJbmZvLCBwcmVjaXNpb24gLSBudW1iZXJJbmZvLmludGVnZXJMZW5ndGgpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB0b0ZpeGVkRm9ybWF0KG51bWJlckluZm86IE51bWJlckluZm8sIHByZWNpc2lvbjogSW50ID0gMCk6IEZvcm1hdHRlZE51bWJlciB7XG4gICAgICAgIGlmIChwcmVjaXNpb24gPD0gMCkge1xuICAgICAgICAgICAgcmV0dXJuIEZvcm1hdHRlZE51bWJlcihudW1iZXJJbmZvLm51bWJlci5yb3VuZFRvTG9uZygpLnRvU3RyaW5nKCkpXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbmV3TnVtYmVySW5mbyA9IHJvdW5kVG9QcmVjaXNpb24obnVtYmVySW5mbywgcHJlY2lzaW9uKVxuXG4gICAgICAgIHZhbCBjb21wbGV0ZVByZWNpc2lvbiA9IGlmIChudW1iZXJJbmZvLmludGVnZXJMZW5ndGggPCBuZXdOdW1iZXJJbmZvLmludGVnZXJMZW5ndGgpIHtcbiAgICAgICAgICAgIHByZWNpc2lvbiAtIDFcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHByZWNpc2lvblxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKG5ld051bWJlckluZm8uZnJhY3Rpb25hbFBhcnQgPT0gMEwpIHtcbiAgICAgICAgICAgIHJldHVybiBGb3JtYXR0ZWROdW1iZXIobmV3TnVtYmVySW5mby5pbnRlZ2VyUGFydC50b1N0cmluZygpLCBcIjBcIi5yZXBlYXQoY29tcGxldGVQcmVjaXNpb24pKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGZyYWN0aW9uU3RyaW5nID0gbmV3TnVtYmVySW5mby5mcmFjdGlvblN0cmluZy5wYWRFbmQoY29tcGxldGVQcmVjaXNpb24sICcwJylcblxuICAgICAgICByZXR1cm4gRm9ybWF0dGVkTnVtYmVyKG5ld051bWJlckluZm8uaW50ZWdlclBhcnQudG9TdHJpbmcoKSwgZnJhY3Rpb25TdHJpbmcpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gdG9TaW1wbGVGb3JtYXQobnVtYmVySW5mbzogTnVtYmVySW5mbywgcHJlY2lzaW9uOiBJbnQgPSAtMSk6IEZvcm1hdHRlZE51bWJlciB7XG4gICAgICAgIHZhbCBleHBvbmVudFN0cmluZyA9IGlmIChudW1iZXJJbmZvLmV4cG9uZW50ICE9IG51bGwpIHtcbiAgICAgICAgICAgIHZhbCBleHBTaWduID0gaWYgKG51bWJlckluZm8uZXhwb25lbnQuc2lnbiA+PSAwKSBcIitcIiBlbHNlIFwiXCJcbiAgICAgICAgICAgIFwiZSRleHBTaWduJHtudW1iZXJJbmZvLmV4cG9uZW50fVwiXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBcIlwiXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgZXhwTnVtYmVySW5mbyA9XG4gICAgICAgICAgICBjcmVhdGVOdW1iZXJJbmZvKG51bWJlckluZm8uaW50ZWdlclBhcnQgKyBudW1iZXJJbmZvLmZyYWN0aW9uYWxQYXJ0IC8gTnVtYmVySW5mby5NQVhfREVDSU1BTF9WQUxVRS50b0RvdWJsZSgpKVxuXG4gICAgICAgIGlmIChwcmVjaXNpb24gPiAtMSkge1xuICAgICAgICAgICAgdmFsIGZvcm1hdHRlZE51bWJlciA9IHRvRml4ZWRGb3JtYXQoZXhwTnVtYmVySW5mbywgcHJlY2lzaW9uKVxuICAgICAgICAgICAgcmV0dXJuIGZvcm1hdHRlZE51bWJlci5jb3B5KGV4cG9uZW50aWFsUGFydCA9IGV4cG9uZW50U3RyaW5nKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGludGVnZXJTdHJpbmcgPSBleHBOdW1iZXJJbmZvLmludGVnZXJQYXJ0LnRvU3RyaW5nKClcbiAgICAgICAgdmFsIGZyYWN0aW9uU3RyaW5nID0gaWYgKGV4cE51bWJlckluZm8uZnJhY3Rpb25hbFBhcnQgPT0gMEwpIFwiXCIgZWxzZSBleHBOdW1iZXJJbmZvLmZyYWN0aW9uU3RyaW5nXG4gICAgICAgIHJldHVybiBGb3JtYXR0ZWROdW1iZXIoaW50ZWdlclN0cmluZywgZnJhY3Rpb25TdHJpbmcsIGV4cG9uZW50U3RyaW5nKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHRvU2lGb3JtYXQobnVtYmVySW5mbzogTnVtYmVySW5mbywgcHJlY2lzaW9uOiBJbnQgPSAtMSk6IEZvcm1hdHRlZE51bWJlciB7XG4gICAgICAgIHZhbCBleHBOdW1iZXJJbmZvID0gaWYgKG51bWJlckluZm8uZXhwb25lbnQgPT0gbnVsbCkge1xuICAgICAgICAgICAgdG9FeHBvbmVudGlhbChudW1iZXJJbmZvLCBwcmVjaXNpb24gLSAxKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgbnVtYmVySW5mb1xuICAgICAgICB9XG4gICAgICAgIHZhbCBleHBvbmVudCA9IGV4cE51bWJlckluZm8uZXhwb25lbnQgPzogMFxuICAgICAgICB2YWwgc3VmZml4RXhwID0gZmxvb3IoZXhwb25lbnQgLyAzLjApLmNvZXJjZUF0TGVhc3QoLTguMCkuY29lcmNlQXRNb3N0KDguMCkudG9JbnQoKSAqIDNcbiAgICAgICAgdmFsIG5ld051bWJlckluZm8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ICAgICAgICAgICAgICAgbnVtYmVySW5mby5pbnRlZ2VyUGFydCAvIDEwLjAucG93KGludFNoaWZ0KS50b0xvbmcoKSAqIDEwLjAucG93KGludFNoaWZ0KS50b0xvbmcoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdmFsIHByZWNpc2lvbkV4cCA9IE51bWJlckluZm8uTUFYX0RFQ0lNQUxfVkFMVUUgLyAxMC4wLnBvdyh0b3RhbFByZWNpc2lvbikudG9Mb25nKClcbiAgICAgICAgICAgIGZyYWN0aW9uYWxQYXJ0ID0gaWYgKHByZWNpc2lvbkV4cCA9PSAwTCkge1xuICAgICAgICAgICAgICAgIG51bWJlckluZm8uZnJhY3Rpb25hbFBhcnRcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgKG51bWJlckluZm8uZnJhY3Rpb25hbFBhcnQudG9Eb3VibGUoKSAvIHByZWNpc2lvbkV4cCkucm91bmRUb0xvbmcoKSAqIHByZWNpc2lvbkV4cFxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaW50ZWdlclBhcnQgPSBudW1iZXJJbmZvLmludGVnZXJQYXJ0XG4gICAgICAgICAgICBpZiAoZnJhY3Rpb25hbFBhcnQgPT0gTnVtYmVySW5mby5NQVhfREVDSU1BTF9WQUxVRSkge1xuICAgICAgICAgICAgICAgIGZyYWN0aW9uYWxQYXJ0ID0gMFxuICAgICAgICAgICAgICAgICsraW50ZWdlclBhcnRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBudW0gPSBpbnRlZ2VyUGFydCArIGZyYWN0aW9uYWxQYXJ0LnRvRG91YmxlKCkgLyBOdW1iZXJJbmZvLk1BWF9ERUNJTUFMX1ZBTFVFXG5cbiAgICAgICAgcmV0dXJuIG51bWJlckluZm8uY29weShudW1iZXIgPSBudW0sIGZyYWN0aW9uYWxQYXJ0ID0gZnJhY3Rpb25hbFBhcnQsIGludGV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6IFN0cmluZyk6IFNwZWMge1xuICAgICAgICAgICAgcmV0dXJuIGNyZWF0ZShwYXJzZShzcGVjKSlcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBjcmVhdGUoc3BlYzogU3BlYyk6IFNwZWMge1xuICAgICAgICAgICAgdmFyIHByZWNpc2lvbiA9IHNwZWMucHJlY2lzaW9uXG4gICAgICAgICAgICB2YXIgdHlwZSA9IHNwZWMudHlwZVxuICAgICAgICAgICAgdmFyIHRyaW0gPSBmYWxzZVxuICAgICAgICAgICAgaWYgKHR5cGUgPT0gXCJcIikge1xuICAgICAgICAgICAgICAgIGlmIChwcmVjaXNpb24gPT0gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgcHJlY2lzaW9uID0gMTJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdHlwZSA9IFwiZ1wiXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh0eXBlID09IFwiZ1wiKSB7XG4gICAgICAgICAgICAgICAgdHJpbSA9IHRydWVcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIHplcm8gPSBzcGVjLnplcm9cbiAgICAgICAgICAgIHZhciBmaWxsID0gc3BlYy5maWxsXG4gICAgICAgICAgICB2YXIgYWxpZ24gPSBzcGVjLmFsaWduXG4gICAgICAgICAgICBpZiAoemVybyB8fCAoZmlsbCA9PSBcIjBcIiAmJiBhbGlnbiA9PSBcIj1cIikpIHtcbiAgICAgICAgICAgICAgICB6ZXJvID0gdHJ1ZVxuICAgICAgICAgICAgICAgIGZpbGwgPSBcIjBcIlxuICAgICAgICAgICAgICAgIGFsaWduID0gXCI9XCJcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHNwZWMuY29weSh0eXBlID0gdHlwZSwgcHJlY2lzaW9uID0gcHJlY2lzaW9uLCB6ZXJvID0gemVybywgZmlsbCA9IGZpbGwsIGFsaWduID0gYWxpZ24sIHRyaW0gPSB0cmltKVxu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VmFsdWUgIT0gbnVsbCkge1xuICAgICAgICAgICAgb2xkVmFsdWUucGFyZW50KCkuc2V0KG51bGwpXG4gICAgICAgICAgICBvbGRWYWx1ZS5zZXRQb3NpdGlvbkRhdGEobnVsbClcbiAgICAgICAgfVxuICAgICAgICBpZiAodmFsdWUgIT0gbnVsbCkge1xuICAgICAgICAgICAgdmFsdWUucGFyZW50KCkuc2V0KG15UGFyZW50KVxuICAgICAgICAgICAgdmFsdWUuc2V0UG9zaXRpb25EYXRhKG9iamVjdCA6XG4gICAgICAgICAgICAgICAgUG9zaXRpb25EYXRhPENoaWxkVD4ge1xuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBnZXQoKTogUG9zaXRpb248Q2hpbGRUPiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBQb3NpdGlvbjxDaGlsZFQ+IHtcblxuICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGUgdmFsIHJvbGU6IEFueVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldCgpID0gdGhpc0BDaGlsZFByb3BlcnR5XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBnZXQoKTogQ2hpbGRUPyB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNAQ2hpbGRQcm9wZXJ0eS5nZXQoKVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHJlbW92ZSgpIHtcbiAgICAgICAgICAgICAgICAgICAgc2V0KG51bGwpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSlcbiAgICAgICAgfVxuXG4gICAgICAgIHN1cGVyLnNldCh2YWx1ZSlcblxuICAgICAgICBpZiAob2xkVmFsdWUgIT0gbnVsbCkge1xuICAgICAgICAgICAgb2xkVmFsd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Euc2l6ZVxuXG4gICAgb3ZlcnJpZGUgb3BlcmF0b3IgZnVuIGdldChpbmRleDogSW50KTogSXRlbVQge1xuICAgICAgICBpZiAobXlDb250YWluZXIgPT0gbnVsbCkge1xuICAgICAgICAgICAgdGhyb3cgSW5kZXhPdXRPZkJvdW5kc0V4Y2VwdGlvbihcIiRpbmRleFwiKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIG15Q29udGFpbmVyISFbaW5kZXhdXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGRvQWRkKGluZGV4OiBJbnQsIGl0ZW06IEl0ZW1UKSB7XG4gICAgICAgIGVuc3VyZUNvbnRhaW5lckluaXRpYWxpemVkKClcbiAgICAgICAgbXlDb250YWluZXIhIS5hZGQoaW5kZXgsIGl0ZW0pXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGRvU2V0KGluZGV4OiBJbnQsIGl0ZW06IEl0ZW1UKSB7XG4gICAgICAgIG15Q29udGFpbmVyISFbaW5kZXhdID0gaXRlbVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBkb1JlbW92ZShpbmRleDogSW50KSB7XG4gICAgICAgIG15Q29udGFpbmVyISEucmVtb3ZlQXQoaW5kZXgpXG4gICAgICAgIGlmIChteUNvbnRhaW5lciEhLmlzRW1wdHkoKSkge1xuICAgICAgICAgICAgbXlDb250YWluZXIgPSBudWxsXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBlbnN1cmVDb250YWluZXJJbml0aWFsaXplZCgpIHtcbiAgICAgICAgaWYgKG15Q29udGFpbmVyID09IG51bGwpIHtcbiAgICAgICAgICAgIG15Q29udGFpbmVyID0gQXJyYXlMaXN0KDEpXG4gICAgICAgIH1cbiAgICB9XG59IiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZ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VyY2U8b3V0IEV2ZW50VD4pIHtcbiAgICAgICAgbXlFdmVudFNvdXJjZXMucmVtb3ZlKHNvdXJjZSlcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gYWRkSGFuZGxlcihoYW5kbGVyOiBFdmVudEhhbmRsZXI8RXZlbnRUPik6IFJlZ2lzdHJhdGlvbiB7XG4gICAgICAgIGlmIChteUhhbmRsZXJzID09IG51bGwpIHtcbiAgICAgICAgICAgIG15SGFuZGxlcnMgPSBvYmplY3QgOiBMaXN0ZW5lcnM8RXZlbnRIYW5kbGVyPEV2ZW50VD4+KCkge1xuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBiZWZvcmVGaXJzdEFkZGVkKCkge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHNyYyBpbiBteUV2ZW50U291cmNlcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgYWRkSGFuZGxlclRvKHNyYylcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBhZnRlckxhc3RSZW1vdmVkKCkge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKGhyIGluIG15UmVnaXN0cmF0aW9ucykge1xuICAgICAgICAgICAgICAgICAgICAgICAgaHIucmVtb3ZlKClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBteVJlZ2lzdHJhdGlvbnMuY2xlYXIoKVxuICAgICAgICAgICAgICAgICAgICBteUhhbmRsZXJzID0gbnVsbFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbXlIYW5kbGVycyEhLmFkZChoYW5kbGVyKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIDxQYXJ0RXZlbnRUIDogRXZlbnRUPiBhZGRIYW5kbGVyVG8oc3JjOiBFdmVudFNvdXJjZTxQYXJ0RXZlbnRUPikge1xuIC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jZTxFdmVudFQ+KTogRXZlbnRTb3VyY2U8RXZlbnRUPiB7XG4gICAgICAgIHJldHVybiBDb21wb3NpdGVFdmVudFNvdXJjZSgqc291cmNlcylcbiAgICB9XG5cblxuICAgIGZ1biA8RXZlbnRUPiBjb21wb3NpdGUoc291cmNlczogSXRlcmFibGU8RXZlbnRTb3VyY2U8RXZlbnRUPj4pOiBFdmVudFNvdXJjZTxFdmVudFQ+IHtcbiAgICAgICAgcmV0dXJuIENvbXBvc2l0ZUV2ZW50U291cmNlKHNvdXJjZXMpXG4gICAgfVxuXG4gICAgZnVuIDxFdmVudFQ+IGZpbHRlcihzb3VyY2U6IEV2ZW50U291cmNlPEV2ZW50VD4sIHByZWQ6IFByZWRpY2F0ZTxpbiBFdmVudFQ+KTogRXZlbnRTb3VyY2U8RXZlbnRUPiB7XG4gICAgICAgIHJldHVybiBvYmplY3QgOiBFdmVudFNvdXJjZTxFdmVudFQ+IHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBhZGRIYW5kbGVyKGhhbmRsZXI6IEV2ZW50SGFuZGxlcjxFdmVudFQ+KTogUmVnaXN0cmF0aW9uIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gc291cmNlLmFkZEhhbmRsZXIob2JqZWN0IDogRXZlbnRIYW5kbGVyPEV2ZW50VD4ge1xuICAgICAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gb25FdmVudChldmVudDogRXZlbnRUKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocHJlZChldmVudCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLm9uRXZlbnQoZXZlbnQpXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuIDxTb3VyY2VFdmVudFQsIFRhcmdldEV2ZW50VD4gbWFwKHNyYz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gICAgICAgICAgICAgICAgaXRlbVJlZ3MuYWRkKGV2ZW50LmluZGV4LCBzZWxlY3RvcihldmVudC5uZXdJdGVtKS5hZGRIYW5kbGVyKGhhbmRsZXIpKVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIG9uSXRlbVJlbW92ZWQoZXZlbnQ6IENvbGxlY3Rpb25JdGVtRXZlbnQ8b3V0IEl0ZW1UPikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaXRlbVJlZ3MucmVtb3ZlQXQoZXZlbnQuaW5kZXgpLnJlbW92ZSgpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IFJlZ2lzdHJhdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGRvUmVtb3ZlKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyIGluIGl0ZW1SZWdzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgci5yZW1vdmUoKVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICBsaXN0UmVnLnJlbW92ZSgpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDIwLiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgTUlUIGxpY2Vuc2UgdGhhdCBjYW4gYmUgZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZS5cbiAqL1xuXG5wYWNrYWdlIGpldGJyYWlucy5kYXRhbG9yZS5iYXNlLm9ic2VydmFibGUuZXZlbnRcblxuXG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ICAgICAgbXlMaXN0ZW5lcnMhIS5hZGQobCBhcyBBbnkpXG4gICAgICAgICAgICBteUxpc3RlbmVyc0NvdW50KytcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gb2JqZWN0IDogUmVnaXN0cmF0aW9uKCkge1xuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGRvUmVtb3ZlKCkge1xuICAgICAgICAgICAgICAgIGlmIChteUZpcmVEZXB0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgbXlMaXN0ZW5lcnMhIS5hZGQoXG4gICAgICAgICAgICAgICAgICAgICAgICBMaXN0ZW5lck9wKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2VcbiAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIG15TGlzdGVuZXJzISEucmVtb3ZlKGwgYXMgQW55KVxuICAgICAgICAgICAgICAgICAgICBteUxpc3RlbmVyc0NvdW50LS1cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoaXNFbXB0eSkge1xuICAgICAgICAgICAgICAgICAgICBhZnRlckxhc3RSZW1vdmVkKClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gZmlyZShoOiBMaXN0ZW5lckNhbGxlcjxMaXN0ZW5lclQ+KSB7XG4gICAgICAgIGlmIChpc0VtcHR5KSByZXR1cm5cbiAgICAgICAgYmVmb3JlRmlyZSgpXG4gICAgICAgIC8vZXhjZXB0aW9uIGNhbiBiZSB0aHJvd24gZnJvbSBUaHJvd2FibGVIYW5kbGVycy5nZXRJbnN0YW5jZSgpLmhhbmRsZSgpXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICB2YWwgc2l6ZSA9IG15TGlzdGVuZXJzQ291bnRcbiAgICAgICAgICAgIGZvciAoaSBpbiAwIHVudGlsIHNpemUpIHtcbiAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgIHZhbCBsID0gbXlMaXN0ZW5lcnMhIVtpXSBhcyBMaXN0ZW5lclRcblxuICAgICAgICAgICAgICAgIGlmIChpc1JlbW92ZWQobCkpIGNvbnRpbnVlXG5cbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBoLmNhbGwobClcbiAgICAgICAgICAgICAgICB9IGNhdGNoICh0OiBUaHJvd2FibGUpIHtcbiAgICAgICAgICAgICAgICAgICAgVGhyb3dhYmxlSGFuZGxlcnMuaW5zdGFuY2UuaGFuZGxlKHQpXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZmluYWxseSB7XG4gICAgICAgICAgICBhZnRlckZpcmUoKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gaXNSZW1vdmVkKGw6IExpc3RlbmVyVCk6IEJvb2xlYW4ge1xuICAgICAgICB2YWwgc2l6ZSA9IG15TGlzdGVuZXJzISEuc2l6ZVxuICAgICAgICBmb3IgKGkgaW4gbXlMaXN0ZW5lcnNDb3VudCB1bnRpbCBzaXplKSB7XG4gICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgdmFsIG9wID0gbXlMaXN0ZW5lcnMhIVtpXSBhcyBMaXN0ZW5lck9wPExpc3RlbmVyVD5cbiAgICAgICAgICAgIGlmICghb3AuYWRkICYmIG9wLmxpc3RlbmVyID09PSBsKSByZXR1cm4gdHJ1ZVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZVxuICAgIH1cblxuICAgIHByb3RlY3RlZCBvcGVuIGZ1biBiZWZvcmVGaXJzdEFkZGVkKCkge31cblxuICAgIHByb3RlY3RlZCBvcGVuIGZ1biBhZnRlckxhc3RSZW1vdmVkKCkge31cblxuICAgIHByaXZhdGUgZnVuIGJlZm9yZUZpcmUoKSB7XG4gICAgICAgIG15RmlyZURlcHRoKytcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBhZnRlckZpcmUoKSB7XG4gICAgICAgIG15RmlyZURlcHRoLS1cbiAgICAgICAgaWYgKG15RmlyZURlcHRoID09IDApIHtcbiAgICAgICAgICAgIHZhbCBvcHNMaXN0ID0gbXlMaXN0ZW5lcnMhIS5zdWJMaXN0KG15TGlzdGVuZXJzQ291bnQsIG15TGlzdGVuZXJzISEuc2l6ZSlcbiAgICAgICAgICAgIHZhbCBvcHMgPSBvcHNMaXN0LnRvVHlwZWRBcnJheSgpXG4gICAgICAgICAgICBvcHNMaXN0LmNsZWFyKClcbiAgICAgICAgICAgIGZvciAobyBpbiBvcHMpIHtcbiAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgIHZhbCBvcCA9IG8gYXMgTGlzdGVuZXJPcDxMaXN0ZW5lclQ+XG4gICAgICAgICAgICAgICAgaWYgKG9wLmFkZCkge1xuICAgICAgICAgICAgICAgICAgICBteUxpc3RlbmVycyEhLmFkZChvcC5saXN0ZW5lciBhcyBBbnkpXG4gICAgICAgICAgICAgICAgICAgIG15TGlzdGVuZXJzQ291bnQrK1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIG15TGlzdGVuZXJzISEucmVtb3ZlKG9wLmxpc3RlbmVyIGFzIEFueSlcbiAgICAgICAgICAgICAgICAgICAgbXlMaXN0ZW5lcnNDb3VudC0tXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGlzRW1wdHkpIHtcbiAgICAgICAgICAgICAgICBhZnRlckxhc3RSZW1vdmVkKClcbiAgICAgICAgICA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VudDxvdXQgVmFsdWVUPikge1xuICAgICAgICAgICAgICAgIGlmIChzeW5jaW5nLmdldCgpKSByZXR1cm5cblxuICAgICAgICAgICAgICAgIHN5bmNpbmcuc2V0KHRydWUpXG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG15Rm9yd2FyZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0LnNldChzb3VyY2UuZ2V0KCkpXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2Uuc2V0KHRhcmdldC5nZXQoKSlcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZmluYWxseSB7XG4gICAgICAgICAgICAgICAgICAgIHN5bmNpbmcuc2V0KGZhbHNlKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBDb21wb3NpdGVSZWdpc3RyYXRpb24oXG4gICAgICAgICAgICAgICAgc291cmNlLmFkZEhhbmRsZXIoVXBkYXRpbmdFdmVudEhhbmRsZXIodHJ1ZSkpLFxuICAgICAgICAgICAgICAgIHRhcmdldC5hZGRIYW5kbGVyKFVwZGF0aW5nRXZlbnRIYW5kbGVyKGZhbHNlKSlcbiAgICAgICAgKVxuICAgIH1cbn0iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDIwLiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgTUlUIGxpY2Vuc2UgdGhhdCBjYW4gYmUgZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZS5cbiAqL1xuXG5wYWNrYWdlIGpldGJyYWlucy5kYXRhbG9yZS5iYXNlLm9ic2VydmFibGUucHJvcGVydHlcblxuY2xhc3MgUHJvcGVydHlDaGFuZ2VFdmVudDxWYWx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dhdXNzaWFuKSB7XG4gICAgICAgICAgICBoYXZlTmV4dE5leHRHYXVzc2lhbiA9IGZhbHNlXG4gICAgICAgICAgICByZXR1cm4gbmV4dE5leHRHYXVzc2lhblxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdmFyIHYxOiBEb3VibGVcbiAgICAgICAgICAgIHZhciB2MjogRG91YmxlXG4gICAgICAgICAgICB2YXIgczogRG91YmxlXG4gICAgICAgICAgICBkbyB7XG4gICAgICAgICAgICAgICAgdjEgPSAyICogcmFuZG9tLm5leHREb3VibGUoKSAtIDEgLy8gYmV0d2VlbiAtMSBhbmQgMVxuICAgICAgICAgICAgICAgIHYyID0gMiAqIHJhbmRvbS5uZXh0RG91YmxlKCkgLSAxIC8vIGJldHdlZW4gLTEgYW5kIDFcbiAgICAgICAgICAgICAgICBzID0gdjEgKiB2MSArIHYyICogdjJcbiAgICAgICAgICAgIH0gd2hpbGUgKHMgPj0gMSB8fCBzID09IDAuMClcbiAgICAgICAgICAgIHZhbCBtdWx0aXBsaWVyID0gc3FydCgtMiAqIGxuKHMpIC8gcylcbiAgICAgICAgICAgIG5leHROZXh0R2F1c3NpYW4gPSB2MiAqIG11bHRpcGxpZXJcbiAgICAgICAgICAgIGhhdmVOZXh0TmV4dEdhdXNzaWFuID0gdHJ1ZVxuICAgICAgICAgICAgcmV0dXJuIHYxICogbXVsdGlwbGllclxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUuYmFzZS5yYW5kb21cblxub2JqZWN0IFJhbmRvbVN0cmluZyB7XG4gICAgZnVuIH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vb3BZXG4gICAgICAgIClcbiAgICAgICAgcmV0dXJuIFJlY3QoXG4gICAgICAgICAgICB4UmFuZ2UubG93ZXJFbmQsXG4gICAgICAgICAgICB5UmFuZ2UubG93ZXJFbmQsXG4gICAgICAgICAgICB4UmFuZ2UubGVuZ3RoKCksXG4gICAgICAgICAgICB5UmFuZ2UubGVuZ3RoKClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNhbGN1bGF0ZUJvdW5kaW5nUmFuZ2UoXG4gICAgICAgIHNlZ21lbnRzOiBTZXF1ZW5jZTxTZWdtZW50PixcbiAgICAgICAgbWFwUmFuZ2U6IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIGxvb3A6IEJvb2xlYW5cbiAgICApOiBDbG9zZWRSYW5nZTxEb3VibGU+IHtcbiAgICAgICAgcmV0dXJuIGlmIChsb29wKSB7XG4gICAgICAgICAgICBjYWxjdWxhdGVMb29wTGltaXRSYW5nZShzZWdtZW50cywgbWFwUmFuZ2UpXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBDbG9zZWRSYW5nZShcbiAgICAgICAgICAgICAgICBzZWdtZW50cy5tYXAoU2VnbWVudDo6c3RhcnQpLm1pbk9yTnVsbCgpISEsXG4gICAgICAgICAgICAgICAgc2VnbWVudHMubWFwKFNlZ21lbnQ6OmVuZCkubWF4T3JOdWxsKCkhIVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGludGVybmFsIGZ1biBjYWxjdWxhdGVMb29wTGltaXRSYW5nZShcbiAgICAgICAgICAgIHNlZ21lbnRzOiBTZXF1ZW5jZTxTZWdtZW50PixcbiAgICAgICAgICAgIG1hcFJhbmdlOiBDbG9zZWRSYW5nZTxEb3VibGU+XG4gICAgICAgICk6IENsb3NlZFJhbmdlPERvdWJsZT4ge1xuICAgICAgICAgICAgcmV0dXJuIHNlZ21lbnRzXG4gICAgICAgICAgICAgICAgLm1hcCB7XG4gICAgICAgICAgICAgICAgICAgIHNwbGl0U2VnbWVudChcbiAgICAgICAgICAgICAgICAgICAgICAgIGl0LnN0YXJ0LCBpdC5lbmQsXG4gICAgICAgICAgICAgICAgICAgICAgICBtYXBSYW5nZS5sb3dlckVuZCxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hcFJhbmdlLnVwcGVyRW5kXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLmZsYXR0ZW4oKVxuICAgICAgICAgICAgICAgIC5ydW4geyBmaW5kTWF4R2FwQmV0d2VlblJhbmdlcyh0aGlzLCBtYXBSYW5nZS5sZW5ndGgoKSkgfVxuICAgICAgICAgICAgICAgIC5ydW4geyBpbnZlcnRSYW5nZSh0aGlzLCBtYXBSYW5nZS5sZW5ndGgoKSkgfVxuICAgICAgICAgICAgICAgIC5ydW4geyBub3JtYWxpemVDZW50ZXIodGhpcywgbWFwUmFuZ2UpIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIG5vcm1hbGl6ZUNlbnRlcihyYW5nZTogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgbWFwUmFuZ2U6IENsb3NlZFJhbmdlPERvdWJsZT4pOiBDbG9zZWRSYW5nZTxEb3VibGU+IHtcbiAgICAgICAgICAgIHJldHVybiBpZiAobWFwUmFuZ2UuY29udGFpbnMoKHJhbmdlLnVwcGVyRW5kICsgcmFuZ2UubG93ZXJFbmQpIC8gMikpIHtcbiAgICAgICAgICAgICAgICByYW5nZVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBDbG9zZWRSYW5nZShcbiAgICAgICAgICAgICAgICAgICAgcmFuZ2UubG93ZXJFbmQgLSBtYXBSYW5nZS5sZW5ndGgoKSxcbiAgICAgICAgICAgICAgICAgICAgcmFuZ2UudXBwZXJFbmQgLSBtYXBSYW5nZS5sZW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3RoKCkpIHtcbiAgICAgICAgICAgICAgICAgICAgbWF4R2FwUmFuZ2UgPSBDbG9zZWRSYW5nZShwcmV2VXBwZXIsIG5leHRMb3dlcilcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcHJldlVwcGVyID0gbWF4KHByZXZVcHBlciwgcmFuZ2UudXBwZXJFbmQpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gbWF4R2FwUmFuZ2VcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGludmVydFJhbmdlKHJhbmdlOiBDbG9zZWRSYW5nZTxEb3VibGU+LCB3aWR0aDogRG91YmxlKTogQ2xvc2VkUmFuZ2U8RG91YmxlPiB7XG4gICAgICAgICAgICAvLyBGaXggZm9yIHJvdW5kaW5nIGVycm9yIGZvciBpbnZlcnRSYW5nZSBpbnRyb2R1Y2VkIGJ5IG1hdGggd2l0aCB3aWR0aC5cbiAgICAgICAgICAgIGZ1biBzYWZlUmFuZ2UoZmlyc3Q6IERvdWJsZSwgc2Vjb25kOiBEb3VibGUpID0gQ2xvc2VkUmFuZ2UobWluKGZpcnN0LCBzZWNvbmQpLCBtYXgoZmlyc3QsIHNlY29uZCkpXG5cbiAgICAgICAgICAgIHJldHVybiB3aGVuIHtcbiAgICAgICAgICAgICAgICByYW5nZS5sZW5ndGgoKSA+IHdpZHRoIC0+XG4gICAgICAgICAgICAgICAgICAgIENsb3NlZFJhbmdlKHJhbmdlLmxvd2VyRW5kLCByYW5nZS5sb3dlckVuZClcbiAgICAgICAgICAgICAgICByYW5nZS51cHBlckVuZCA+IHdpZHRoIC0+XG4gICAgICAgICAgICAgICAgICAgIHNhZmVSYW5nZShyYW5nZS51cHBlckVuZCAtIHdpZHRoLCByYW5nZS5sb3dlckVuZClcbiAgICAgICAgICAgICAgICBlbHNlIC0+XG4gICAgICAgICAgICAgICAgICAgIHNhZmVSYW5nZShyYW5nZS51cHBlckVuZCwgd2lkdGggKyByYW5nZ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IC0+IHtcbiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZShvYmouY29udGFpbnMoXCJnZW9tZXRyaWVzXCIpKSB7IFwiR2VvSnNvbjogTWlzc2luZyAnZ2VvbWV0cmllcycgaW4gJ0dlb21ldHJ5Q29sbGVjdGlvbidcIiB9XG5cbiAgICAgICAgICAgICAgICAgICAgb2JqLmdldEFycmF5KFwiZ2VvbWV0cmllc1wiKS5mbHVlbnRPYmplY3RTdHJlYW0oKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmZvckVhY2ggeyBwYXJzZShpdCwgaGFuZGxlcikgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGVsc2UgLT4ge1xuICAgICAgICAgICAgICAgICAgICByZXF1aXJlKG9iai5jb250YWlucyhcImNvb3JkaW5hdGVzXCIpKSB7IFwiR2VvSnNvbjogTWlzc2luZyAnY29vcmRpbmF0ZXMnIGluICR0eXBlXCIgfVxuXG4gICAgICAgICAgICAgICAgICAgIHZhbCBjb29yZGluYXRlcyA9IG9iai5nZXRBcnJheShcImNvb3JkaW5hdGVzXCIpXG4gICAgICAgICAgICAgICAgICAgIHdoZW4gKHR5cGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiUG9pbnRcIiAtPiBwYXJzZVBvaW50KGNvb3JkaW5hdGVzKS5sZXQoaGFuZGxlcjo6b25Qb2ludClcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiTGluZVN0cmluZ1wiIC0+IHBhcnNlTGluZVN0cmluZyhjb29yZGluYXRlcykubGV0KGhhbmRsZXI6Om9uTGluZVN0cmluZylcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiUG9seWdvblwiIC0+IHBhcnNlUG9seWdvbihjb29yZGluYXRlcykubGV0KGhhbmRsZXI6Om9uUG9seWdvbilcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiTXVsdGlQb2ludFwiIC0+IHBhcnNlTXVsdGlQb2ludChjb29yZGluYXRlcykubGV0KGhhbmRsZXI6Om9uTXVsdGlQb2ludClcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiTXVsdGlMaW5lU3RyaW5nXCIgLT4gcGFyc2VNdWx0aUxpbmVTdHJpbmcoY29vcmRpbmF0ZXMpLmxldChoYW5kbGVyOjpvbk11bHRpTGluZVN0cmluZylcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiTXVsdGlQb2x5Z29uXCIgLT4gcGFyc2VNdWx0aVBvbHlnb24oY29vcmRpbmF0ZXMpLmxldChoYW5kbGVyOjpvbk11bHRpUG9seWdvbilcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgLT4gZXJyb3IoXCJOb3Qgc3VwcG9ydCBHZW9Kc29uIHR5cGU6ICR0eXBlXCIpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBwYXJzZVBvaW50KGpzb25Qb2ludDogRmx1ZW50QXJyYXkpOiBWZWM8VD4ge1xuICAgICAgICAgICAgcmV0dXJuIGV4cGxpY2l0VmVjPFQ+KFxuICAgICAgICAgICAgICAgIGpzb25Qb2ludC5nZXREb3VibGUoTE9OX0lOREVYKSxcbiAgICAgICAgICAgICAgICBqc29uUG9pbnQuZ2V0RG91YmxlKExBVF9JTkRFWClcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHBhcnNlTGluZVN0cmluZyhqc29uTGluZVN0cmluZzogRmx1ZW50QXJyYXkpOiBMaW5lU3RyaW5nPFQ+IHtcbiAgICAgICAgICAgIHJldHVybiBqc29uTGluZVN0cmluZy5tYXBBcnJheSh0aGlzOjpwYXJzZVBvaW50KS5sZXQoOjpMaW5lU3RyaW5nKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gcGFyc2VSaW5nKGpzb25SaW5nOiBGbHVlbnRBcnJheSk6IFJpbmc8VD4ge1xuICAgICAgICAgICAgcmV0dXJuIGpzb25SaW5nLm1hcEFycmF5KHRoaXM6OnBhcnNlUG9pbnQpLmxldCg6OlJpbmcpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBwYXJzZU11bHRpUG9pbnQoanNvbk11bHRpUG9pbnQ6IEZsdWVudEFycmF5KTogTXVsdGlQb2ludDxUPiB7XG4gICAgICAgICAgICByZXR1cm4ganNvbk11bHRpUG9pbnQubWFwQXJyYXkodGhpczo6cGFyc2VQb2ludCkubGV0KDo6TXVsdGlQb2ludClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHBhcnNlUG9seWdvbihqc29uUG9seWdvbjogRmx1ZW50QXJyYXkpOiBQb2x5Z29uPFQ+IHtcbiAgICAgICAgICAgIHJldHVybiBqc29uUG9seWdvbi5tYXBBcnJheSh0aGlzOjpwYXJzZVJpbmcpLmxldCg6OlBvbHlnb24pXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBwYXJzZU11bHRpTGluZVN0cmluZyhqc29uTGluZVN0cmluZ3M6IEZsdWVudEFycmF5KTogTXVsdGlMaW5lU3RyaW5nPFQ+IHtcbiAgICAgICAgICAgIHJldHVybiBqc29uTGluZVN0cmluZ3MubWFwQXJyYXkodGhpczo6cGFyc2VMaW5lU3RyaW5nKS5sZXQoOjpNdWx0aUxpbmVTdHJpbmcpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBwYXJzZU11bHRpUG9seWdvbihqc29uTXVsdGlQb2x5Z29uOiBGbHVlbnRBcnJheSk6IE11bHRpUG9seWdvbjxUPiB7XG4gICAgICAgICAgICByZXR1cm4ganNvbk11bHRpUG9seWdvbi5tYXBBcnJheSh0aGlzOjpwYXJzZVBvbHlnb24pLmxldCg6Ok11bHRpUG9seWdvbilcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIDxUPiBGbHVlbnRBcnJheS5tYXBBcnJhe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gICAgIHJldHVybiBMb25naXR1ZGVTZWdtZW50KG15RW5kLCBteVN0YXJ0KVxuICAgIH1cblxuICAgIGZ1biBzcGxpdEJ5QW50aU1lcmlkaWFuKCk6IExpc3Q8Q2xvc2VkUmFuZ2U8RG91YmxlPj4ge1xuICAgICAgICByZXR1cm4gc3BsaXRTZWdtZW50KFxuICAgICAgICAgICAgbXlTdGFydCwgbXlFbmQsXG4gICAgICAgICAgICBNSU5fTE9OR0lUVURFLFxuICAgICAgICAgICAgTUFYX0xPTkdJVFVERVxuICAgICAgICApXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGVxdWFscyhvdGhlcjogQW55Pyk6IEJvb2xlYW4ge1xuICAgICAgICBpZiAodGhpcyA9PT0gb3RoZXIpIHJldHVybiB0cnVlXG4gICAgICAgIGlmIChvdGhlciA9PSBudWxsIHx8IHRoaXM6OmNsYXNzICE9IG90aGVyOjpjbGFzcykgcmV0dXJuIGZhbHNlXG4gICAgICAgIHZhbCB0aGF0ID0gb3RoZXIgYXMgTG9uZ2l0dWRlU2VnbWVudFxuICAgICAgICByZXR1cm4gdGhhdC5teVN0YXJ0LmVxdWFscyhteVN0YXJ0KSAmJiB0aGF0Lm15RW5kLmVxdWFscyhteUVuZClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gaGFzaENvZGUoKTogSW50IHtcbiAgICAgICAgcmV0dXJuIGxpc3RPZihteVN0YXJ0LCBteUVuZCkuaGFzaENvZGUoKVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBmdW4gc3BsaXRTZWdtZW50KFxuICAgICAgICAgICAgc3RhcnQ6IERvdWJsZSxcbiAgICAgICAgICAgIGVuZDogRG91YmxlLFxuICAgICAgICAgICAgbWluOiBEb3VibGUsXG4gICAgICAgICAgICBtYXg6IERvdWJsZVxuICAgICAgICApIDogTGlzdDxDbG9zZWRSYW5nZTxEb3VibGU+PiB7XG4gICAgICAgICAgICByZXR1cm4g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ICAgICAgICAgICAgRm9ybWF0VHlwZS5TVFJJTkdfRk9STUFUIC0+IHtcbiAgICAgICAgICAgICAgICBCUkFDRVNfUkVHRVguZmluZEFsbChwYXR0ZXJuKVxuICAgICAgICAgICAgICAgICAgICAubWFwIHsgaXQuZ3JvdXBWYWx1ZXNbVEVYVF9JTl9CUkFDRVNdIH1cbiAgICAgICAgICAgICAgICAgICAgLm1hcCB7IGZvcm1hdCAtPlxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZvcm1hdC5pc05vdEVtcHR5KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbml0TnVtYmVyRm9ybWF0KGZvcm1hdClcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC50b0xpc3QoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgdmFsIGFyZ3NOdW1iZXIgPSBteU51bWJlckZvcm1hdHRlcnMuc2l6ZVxuXG4gICAgZnVuIGZvcm1hdCh2YWx1ZTogQW55KTogU3RyaW5nID0gZm9ybWF0KGxpc3RPZih2YWx1ZSkpXG5cbiAgICBmdW4gZm9ybWF0KHZhbHVlczogTGlzdDxBbnk+KTogU3RyaW5nIHtcbiAgICAgICAgaWYgKGFyZ3NOdW1iZXIgIT0gdmFsdWVzLnNpemUpIHtcbiAgICAgICAgICAgIGVycm9yKFwiQ2FuJ3QgZm9ybWF0IHZhbHVlcyAkdmFsdWVzIHdpdGggcGF0dGVybiBcXFwiJHBhdHRlcm5cXFwiKS4gV3JvbmcgbnVtYmVyIG9mIGFyZ3VtZW50czogZXhwZWN0ZWQgJGFyZ3NOdW1iZXIgaW5zdGVhZCBvZiAke3ZhbHVlcy5zaXplfVwiKVxuICAgICAgICB9XG4gICAgICAg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wiXCIoPyFbXntdfFxce1xceykoXFx7KFtee31dKilcXH0pKD89W159XXxcXH1cXH18JClcIlwiXCIpXG4gICAgICAgIGNvbnN0IHZhbCBURVhUX0lOX0JSQUNFUyA9IDJcblxuICAgICAgICBmdW4gdmFsdWVJbkxpbmVQYXR0ZXJuKCkgPSBcInt9XCJcblxuICAgICAgICBmdW4gZm9yT25lQXJnKFxuICAgICAgICAgICAgcGF0dGVybjogU3RyaW5nLFxuICAgICAgICAgICAgdHlwZTogRm9ybWF0VHlwZT8gPSBudWxsLFxuICAgICAgICAgICAgZm9ybWF0Rm9yOiBTdHJpbmc/ID0gbnVsbCxcbiAgICAgICAgKTogU3RyaW5nRm9ybWF0IHtcbiAgICAgICAgICAgIHJldHVybiBjcmVhdGUocGF0dGVybiwgdHlwZSwgZm9ybWF0Rm9yLCAxKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGZvck5BcmdzKFxuICAgICAgICAgICAgcGF0dGVybjogU3RyaW5nLFxuICAgICAgICAgICAgdHlwZTogRm9ybWF0VHlwZT8gPSBudWxsLFxuICAgICAgICAgICAgYXJnQ291bnQ6IEludCxcbiAgICAgICAgICAgIGZvcm1hdEZvcjogU3RyaW5nPyA9IG51bGxcbiAgICAgICAgKTogU3RyaW5nRm9ybWF0IHtcbiAgICAgICAgICAgIHJldHVybiBjcmVhdGUocGF0dGVybiwgdHlwZSwgZm9ybWF0Rm9yLCBhcmdDb3VudClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBjcmVhdGUoXG4gICAgICAgICAgICBwYXR0ZXJuOiBTdHJpbmcsXG4gICAgICAgICAgICB0eXBlOiBGb3JtYXRUeXBlPyA9IG51bGwsXG4gICAgICAgICAgICBmb3JtYXRGb3I6IFN0cmluZz8gPSBudWxsLFxuICAgICAgICAgICAgZXhwZWN0ZWRBcmdzOiBJbnQgPSAtMVxuICAgICAgICApOiBTdHJpbmdGb3JtYXQge1xuICAgICAgICAgICAgdmFsIGZvcm1hdFR5cGUgPSB3aGVuIHtcbiAgICAgICAgICAgICAgICB0eXBlICE9IG51bGwgLT4gdHlwZVxuICAgICAgICAgICAgICAgIE51bWJlckZvcm1hdC5pc1ZhbGlkUGF0dGVybihwYXR0ZXJuKSAtPiBGb3JtYXRUeXBlLk5VTUJFUl9GT1JNQVRcbiAgICAgICAgICAgICAgICBlbHNlIC0+IEZvcm1hdFR5cGUuU1RSSU5HX0ZPUk1BVFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gU3RyaW5nRm9ybWF0KHBhdHRlcm4sIGZvcm1hdFR5cGUpLmFsc28ge1xuICAgICAgICAgICAgICAgIGlmIChleHBlY3RlZEFyZ3MgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoaXQuYXJnc051bWJlciA9PSBleHBlY3RlZEFyZ3MpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIEBTdXBwcmVzcyhcIk5BTUVfU0hBRE9XSU5HXCIpXG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgZm9ybWF0Rm9yID0gZm9ybWF0Rm9yPy5sZXQgeyBcInRvIGZvcm1hdCBcXCckZm9ybWF0Rm9yXFwnXCIgfSA/OiBcIlwiXG4gICAgICAgICAgICAgICAgICAgICAgICBcIldyb25nIG51bWJlciBvZiBhcmd1bWVudHMgaW4gcGF0dGVybiBcXCckcGF0dGVyblxcJyAkZm9ybWF0Rm9yLiBcIiArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiRXhwZWN0ZWQgJGV4cGVjdGVkQXJncyAke2lmIChleHBlY3RlZEFyZ3MgPiAxKSBcImFyZ3VtZW50c1wiIGVsc2UgXCJhcmd1bWVudFwifSBcIiArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiaW5zdGVhZCBvZiAke2l0LmFyZ3NOdW1iZXJ9XCJcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cb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GNyZWF0ZU11bHRpUG9pbnQobXVsdGlQb2ludDogTXVsdGlQb2ludDxUeXBlVD4pOiBHZW9tZXRyeTxUeXBlVD4ge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21ldHJ5KFxuICAgICAgICAgICAgICAgIHR5cGUgPSBHZW9tZXRyeVR5cGUuTVVMVElfUE9JTlQsXG4gICAgICAgICAgICAgICAgbXlNdWx0aVBvaW50ID0gbXVsdGlQb2ludCxcbiAgICAgICAgICAgICAgICBteU11bHRpTGluZVN0cmluZyA9IG51bGwsXG4gICAgICAgICAgICAgICAgbXlNdWx0aVBvbHlnb24gPSBudWxsXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gPFR5cGVUPiBjcmVhdGVNdWx0aUxpbmVTdHJpbmcobXVsdGlMaW5lU3RyaW5nOiBNdWx0aUxpbmVTdHJpbmc8VHlwZVQ+KTogR2VvbWV0cnk8VHlwZVQ+IHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tZXRyeShcbiAgICAgICAgICAgICAgICB0eXBlID0gR2VvbWV0cnlUeXBlLk1VTFRJX0xJTkVTVFJJTkcsXG4gICAgICAgICAgICAgICAgbXlNdWx0aVBvaW50ID0gbnVsbCxcbiAgICAgICAgICAgICAgICBteU11bHRpTGluZVN0cmluZyA9IG11bHRpTGluZVN0cmluZyxcbiAgICAgICAgICAgICAgICBteU11bHRpUG9seWdvbiA9IG51bGxcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biA8VHlwZVQ+IGNyZWF0ZU11bHRpUG9seWdvbihtdWx0aVBvbHlnb246IE11bHRpUG9seWdvbjxUeXBlVD4pOiBHZW9tZXRyeTxUeXBlVD4ge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21ldHJ5KFxuICAgICAgICAgICAgICAgIHR5cGUgPSBHZW9tZXRyeVR5cGUuTVVMVElfUE9MWUdPTixcbiAgICAgICAgICAgICAgICBteU11bHRpUG9pbnQgPSBud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Bbnk/KTogQm9vbGVhbiB7XG4gICAgICAgIGlmICh0aGlzID09PSBvdGhlcikge1xuICAgICAgICAgICAgcmV0dXJuIHRydWVcbiAgICAgICAgfVxuICAgICAgICBpZiAob3RoZXIgIWlzIENvbG9yKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2VcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChyZWQgIT0gb3RoZXIucmVkKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2VcbiAgICAgICAgfVxuICAgICAgICBpZiAoZ3JlZW4gIT0gb3RoZXIuZ3JlZW4pIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICB9XG4gICAgICAgIGlmIChibHVlICE9IG90aGVyLmJsdWUpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBhbHBoYSA9PSBvdGhlci5hbHBoYVxuICAgIH1cblxuICAgIGZ1biB0b0Nzc0NvbG9yKCk6IFN0cmluZyB7XG4gICAgICAgIHJldHVybiBpZiAoYWxwaGEgPT0gMjU1KSB7XG4gICAgICAgICAgICBcInJnYigkcmVkLCRncmVlbiwkYmx1ZSlcIlxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgXCJyZ2JhKFwiICsgcmVkICsgXCIsXCIgKyBncmVlbiArIFwiLFwiICsgYmx1ZSArIFwiLFwiICsgYWxwaGEgLyAyNTUuMCArIFwiKVwiXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gdG9IZXhDb2xvcigpOiBTdHJpbmcge1xuICAgICAgICByZXR1cm4gXCIjXCIgKyB0b0NvbG9yUGFydChyZWQpICsgdG9Db2xvclBhcnQoZ3JlZW4pICsgdG9Db2xvclBhcnQoYmx1ZSlcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gaGFzaENvZGUoKTogSW50IHtcbiAgICAgICAgdmFyIHJlc3VsdCA9IDBcbiAgICAgICAgcmVzdWx0ID0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ICAgICAgdmFsIGJsdWU6IEludFxuICAgICAgICAgICAgdmFsIGFscGhhOiBJbnRcbiAgICAgICAgICAgIGlmICh0aGlyZENvbW1hID09IC0xKSB7XG4gICAgICAgICAgICAgICAgYmx1ZSA9IHRleHQuc3Vic3RyaW5nKHNlY29uZENvbW1hICsgMSwgbGFzdFBhcmVuKS50cmltIHsgaXQgPD0gJyAnIH0udG9JbnQoKVxuICAgICAgICAgICAgICAgIGFscGhhID0gMjU1XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGJsdWUgPSB0ZXh0LnN1YnN0cmluZyhzZWNvbmRDb21tYSArIDEsIHRoaXJkQ29tbWEpLnRyaW0geyBpdCA8PSAnICcgfS50b0ludCgpXG4gICAgICAgICAgICAgICAgYWxwaGEgPSAodGV4dC5zdWJzdHJpbmcodGhpcmRDb21tYSArIDEsIGxhc3RQYXJlbikudHJpbSB7IGl0IDw9ICcgJyB9LnRvRmxvYXQoKSAqIDI1NSkucm91bmRUb0ludCgpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBDb2xvcihyZWQsIGdyZWVuLCBibHVlLCBhbHBoYSlcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGZpbmROZXh0KHM6IFN0cmluZywgd2hhdDogU3RyaW5nLCBmcm9tOiBJbnQpOiBJbnQge1xuICAgICAgICAgICAgdmFsIHJlc3VsdCA9IHMuaW5kZXhPZih3aGF0LCBmcm9tKVxuICAgICAgICAgICAgaWYgKHJlc3VsdCA9PSAtMSkge1xuICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcInRleHQ9JHMgd2hhdD0kd2hhdCBmcm9tPSRmcm9tXCIpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcGFyc2VIZXgoaGV4Q29sb3I6IFN0cmluZyk6IENvbG9yIHtcbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIk5BTUVfU0hBRE9XSU5HXCIpXG4gICAgICAgICAgICB2YXIgaGV4Q29sb3IgPSBoZXhDb2xvclxuICAgICAgICAgICAgaWYgKCFoZXhDb2xvci5zdGFydHNXaXRoKFwiI1wiKSkge1xuICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcIk5vdCBhIEhFWCB2YWx1ZTogJGhleENvbG9yXCIpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBoZXhDb2xvciA9IGhleENvbG9yLnN1YnN0cmluZygxKVxuICAgICAgICAgICAgaWYgKGhleENvbG9yLmxlbmd0aCAhPSA2KSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiTm90IGEgSEVYIHZhbHVlOiAkaGV4Q29sb3JcIilcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhbCByID0gaGV4Q29sb3Iuc3Vic3RyaW5nKDAsIDIpLnRvSW50KDE2KVxuICAgICAgICAgICAgdmFsIGcgPSBoZXhDb2xvci5zdWJzdHJpbmcoMiwgNCkudG9JbnQoMTYpXG4gICAgICAgICAgICB2YWwgYiA9IGhleENvbG9yLnN1YnN0cmluZyg0LCA2KS50b0ludCgxNilcbiAgICAgICAgICAgIHJldHVybiBDb2xvcihyLCBnLCBiKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gdG9Db2xvclBhcnQodmFsdWU6IEludCk6IFN0cmluZyB7XG4gICAgICAgICAgICBpZiAodmFsdWUgPCAwIHx8IHZhbHVlID4gMjU1KSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiUkdCIGNvbG9yIHBhcnQgbXVzdCBiZSBpbiByYW5nZSBbMC4uMjU1XSBidXQgd2FzICR2YWx1ZVwiKVxuICAgICAgICAgICAgf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RDb2xvcnMgK1xuICAgICAgICAgICAgLy8gbGlnaHQtZ3JheVxuICAgICAgICAgICAgdmFyaWFudENvbG9ycy5tYXBLZXlzIHsgaXQua2V5LnJlcGxhY2UoJ18nLCAnLScpIH0gK1xuICAgICAgICAgICAgLy8gbGlnaHRncmF5XG4gICAgICAgICAgICB2YXJpYW50Q29sb3JzLm1hcEtleXMgeyBpdC5rZXkucmVwbGFjZShcIl9cIiwgXCJcIikgfVxuXG5cbiAgICAvKipcbiAgICAgKiBAcGFyYW0gYyBjb2xvciBzdHJpbmcgdG8gcGFyc2UuIEFjY2VwdGVkIGZvcm1hdHM6XG4gICAgICogICAgIC0gcmdiKHIsIGcsIGIpXG4gICAgICogICAgIC0gcmdiYShyLCBnLCBiLCBhKVxuICAgICAqICAgICAtIGNvbG9yKHIsIGcsIGIsIGEpXG4gICAgICogICAgIC0gI3JyZ2diYlxuICAgICAqICAgICAtIHdoaXRlLCBncmVlbiBldGMuXG4gICAgICovXG4gICAgZnVuIHBhcnNlQ29sb3IoYzogU3RyaW5nKTogQ29sb3Ige1xuICAgICAgICByZXR1cm4gd2hlbiB7XG4gICAgICAgICAgICBjLmluZGV4T2YoJygnKSA+IDAgLT4gQ29sb3IucGFyc2VSR0IoYylcbiAgICAgICAgICAgIGMuc3RhcnRzV2l0aChcIiNcIikgLT4gQ29sb3IucGFyc2VIZXgoYylcbiAgICAgICAgICAgIGlzQ29sb3JOYW1lKGMpIC0+IGZvck5hbWUoYylcbiAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiRXJyb3IgcGVyc2luZyBjb2xvciB2YWx1ZTogJGNcIilcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBpc0NvbG9yTmFtZShjb2xvck5hbWU6IFN0cmluZyk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gbmFtZWRDb2xvcnMuY29udGFpbnNLZXkoY29sb3JOYW1lLmxvd2VyY2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1cbiAgICAgICAgICAgIGhkIDwgMiAtPiB7XG4gICAgICAgICAgICAgICAgciA9IHhcbiAgICAgICAgICAgICAgICBnID0gY1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaGQgPCAzIC0+IHtcbiAgICAgICAgICAgICAgICBnID0gY1xuICAgICAgICAgICAgICAgIGIgPSB4XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBoZCA8IDQgLT4ge1xuICAgICAgICAgICAgICAgIGcgPSB4XG4gICAgICAgICAgICAgICAgYiA9IGNcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGhkIDwgNSAtPiB7XG4gICAgICAgICAgICAgICAgciA9IHhcbiAgICAgICAgICAgICAgICBiID0gY1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSAtPiB7XG4gICAgICAgICAgICAgICAgciA9IGNcbiAgICAgICAgICAgICAgICBiID0geFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIG0gPSB2IC0gY1xuICAgICAgICByZXR1cm4gQ29sb3IoKDI1NSAqIChyICsgbSkpLnRvSW50KCksICgyNTUgKiAoZyArIG0pKS50b0ludCgpLCAoMjU1ICogKGIgKyBtKSkudG9JbnQoKSlcbiAgICB9XG5cbiAgICBmdW4gaHN2RnJvbVJnYihjb2xvcjogQ29sb3IpOiBEb3VibGVBcnJheSB7XG4gICAgICAgIHZhbCBzY2FsZSA9ICgxZiAvIDI1NSkudG9Eb3VibGUoKVxuICAgICAgICB2YWwgciA9IGNvbG9yLnJlZCAqIHNjYWxlXG4gICAgICAgIHZhbCBnID0gY29sb3IuZ3JlZW4gKiBzY2FsZVxuICAgICAgICB2YWwgYiA9IGNvbG9yLmJsdWUgKiBzY2FsZVxuICAgICAgICB2YWwgbWluID0gbWluKHIsIG1pbihnLCBiKSlcbiAgICAgICAgdmFsIG1heCA9IG1heChyLCBtYXgoZywgYikpXG5cbiAgICAgICAgdmFsIHYgPSBpZiAobWF4ID09IDAuMCkgMC4wIGVsc2UgMSAtIG1pbiAvIG1heFxuICAgICAgICB2YWwgaDogRG91YmxlXG4gICAgICAgIHZhbCBkaXYgPSAxZiAvICg2ICogKG1heCAtIG1pbikpXG5cbiAgICAgICAgaCA9IGlmIChtYXggPT0gbWluKSB7XG4gICAgICAgICAgICAwLjBcbiAgICAgICAgfSBlbHNlIGlmIChtYXggPT0gcikge1xuICAgICAgICAgICAgaWYgKGcgPj0gYikgKGcgLSBiKSAqIGRpdiBlbHNlIDEgKyAoZyAtIGIpICogZGl2XG4gICAgICAgIH0gZWxzZSBpZiAobWF4ID09IGcpIHtcbiAgICAgICAgICAgIDFmIC8gMyArIChiIC0gcikgKiBkaXZcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIDJmIC8gMyArIChyIC0gZykgKiBkaXZcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBkb3VibGVBcnJheU9mKDM2MCAqIGgsIHYsIG1heClcbiAgICB9XG5cbiAgICBASnZtT3ZlcmxvYWRzXG4gICAgZnVuIGRhcmtlcihjOiBDb2xvcj8sIGZhY3RvcjogRG91YmxlID0gREVGQVVMVF9GQUNUT1IpOiBDb2xvcj8ge1xuICAgICAgICByZXR1cm4gYz8ubGV0IHtcbiAgICAgICAgICAgIENvbG9yKFxuICAgICAgICAgICAgICAgIG1heCgoYy5yZWQgKiBmYWN0b3IpLnRvSW50KCksIDApLFxuICAgICAgICAgICAgICAgIG1heCgoYy5ncmVlbiAqIGZhY3RvcikudG9JbnQoKSwgMCksXG4gICAgICAgICAgICAgICAgbWF4KChjLmJsdWUgKiBmYWN0b3IpLnRvSW50KCksIDApLFxuICAgICAgICAgICAgICAgIGMuYWxwaGFcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIEBKdm1PdmVybG9hZHNcbiAgICBmdW4gbGlnaHRlcihjOiBDb2xvciwgZmFjdG9yOiBEb3VibGUgPSBERUZBVUxUX0ZBQ1RPUik6IENvbG9yIHtcbiAgICAgICAgdmFyIHIgPSBjLnJlZFxuICAgICAgICB2YXIgZyA9IGMuZ3JlZW5cbiAgICAgICAgdmFyIGIgPSBjLmJsdWVcbiAgICAgICAgdmFsIGFscGhhID0gYy5hbHBoYVxuXG4gICAgICAgIHZhbCBpID0gKDEuMCAvICgxLjAgLSBmYWN0b3IpKS50b0ludCgpXG4gICAgICAgIGlmIChyID09IDAgJiYgZyA9PSAwICYmIGIgPT0gMCkge1xuICAgICAgICAgICAgcmV0dXJuIENvbG9yKGksIGksIGksIGFscGhhKVxuICAgICAgICB9XG4gICAgICAgIGlmIChyID4gMCAmJiByIDwgaSkgciA9IGlcbiAgICAgICAgaWYgKGcgPiAwICYmIGcgPCBpKSBnID0gaVxuICAgICAgICBpZiAoYiA+IDAgJiYgYiA8IGkpIGIgPSBpXG5cbiAgICAgICAgcmV0dXJuIENvbG9yKFxuICAgICAgICAgICAgbWluKChyIC8gZmFjdG9yKS50b0ludCgpLCAyNTUpLFxuICAgICAgICAgICAgbWluKChnIC8gZmFjdG9yKS50b0ludCgpLCAyNTUpLFxuICAgICAgICAgICAgbWluKChiIC8gZmFjdG9yKS50b0ludCgpLCAyNTUpLFxuICAgICAgICAgICAgYWxwaGFcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biBtaW1pY1RyYW5zcGFyZW5jeShjb2xvcjogQ29sb3IsIGFscGhhOiBEb3VibGUsIGJhY2tncm91bmQ6IENvbG9yKTogQ29sb3Ige1xuICAgICAgICB2YWwgcmVkID0gKGNvbG9yLnJlZCAqIGFscGhhICsgYmFja2dyb3VuZC5yZWQgKiAoMSAtIGFscGhhKSkudG9JbnQoKVxuICAgICAgICB2YWwgZ3JlZW4gPSAoY29sb3IuZ3JlZW4gKiBhbHBoYSArIGJhY2tncm91bmQuZ3JlZW4gKiAoMSAtIGFscGhhKSkudG9JbnQoKVxuICAgICAgICB2YWwgYmx1ZSA9IChjb2xvci5ibHVlICogYWxwaGEgKyBiYWNrZ3JvdW5kLmJsd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gIHJldHVybiBvYmplY3QgOiBMb2dnZXIge1xuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGVycm9yKGU6IFRocm93YWJsZSwgbWVzc2FnZTogKCkgLT4gU3RyaW5nKSB7XG4gICAgICAgICAgICAgICAga2wuZXJyb3IoZSwgbWVzc2FnZSlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGluZm8obWVzc2FnZTogKCkgLT4gU3RyaW5nKSB7XG4gICAgICAgICAgICAgICAga2wuaW5mbyhtZXNzYWdlKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuXG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgTUlUIGxpY2Vuc2UgdGhhdCBjYW4gYmUgZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZS5cbiAqL1xuXG5wYWNrYWdlIGpldGJyYWlucy5kYXRhbG9yZS5iYXNlLnNwYXRpYWxcblxuY29uc3QgdmFsIEVBUlRIX1JBRElVUyA9IDYzNzgxMzcuMFxuY29uc3QgdmFsIE1JTl9MT05HSVRVREUgPSAtMTgwLjBcbmNvbnN0IHZhbCBNQVhfTE9OR0lUVURFID0gMTgwLjBcbmNvbnN0IHZhbCBGVUxMX0xPTkdJVFVERSA9IE1BWF9MT05HSVRVREUgLSBNSU5fTE9OR0lUVURFXG5jb25zdCB2YWwgTUlOX0xBVElUVURFID0gLTkwLjBcbmNvbnN0IHZhbCBNQVhfTEFUSVRVREUgPSA5MC4wXG5jb25zdCB2YWwgRlVMTF9MQVRJVFVERSA9IE1BWF9MQVRJVFVERSAtIE1JTl9MQVRJVFVERVxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./kotlin-dce-dev/lets-plot-base-portable.js\n"); /***/ }), @@ -155,7 +155,7 @@ eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPAC \********************************************************/ /***/ (function(module, exports, __webpack_require__) { -eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) {\n if (true)\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(/*! kotlin */ \"./kotlin-dce-dev/kotlin.js\"), __webpack_require__(/*! lets-plot-base-portable */ \"./kotlin-dce-dev/lets-plot-base-portable.js\"), __webpack_require__(/*! lets-plot-plot-common-portable */ \"./kotlin-dce-dev/lets-plot-plot-common-portable.js\"), __webpack_require__(/*! lets-plot-vis-svg-portable */ \"./kotlin-dce-dev/lets-plot-vis-svg-portable.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n else {}\n}(this, function (_, Kotlin, $module$lets_plot_base_portable, $module$lets_plot_plot_common_portable, $module$lets_plot_vis_svg_portable) {\n 'use strict';\n var collect = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect;\n var Iterable = Kotlin.kotlin.collections.Iterable;\n var throwCCE = Kotlin.throwCCE;\n var equals = Kotlin.equals;\n var List = Kotlin.kotlin.collections.List;\n var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_287e2$;\n var Kind_OBJECT = Kotlin.Kind.OBJECT;\n var Kind_CLASS = Kotlin.Kind.CLASS;\n var TypedKey = $module$lets_plot_base_portable.jetbrains.datalore.base.typedKey.TypedKey;\n var Kind_INTERFACE = Kotlin.Kind.INTERFACE;\n var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init_pdl1vj$;\n var StringBuilder_init = Kotlin.kotlin.text.StringBuilder_init;\n var ensureNotNull = Kotlin.ensureNotNull;\n var emptyList = Kotlin.kotlin.collections.emptyList_287e2$;\n var LinkedHashSet_init = Kotlin.kotlin.collections.LinkedHashSet_init_mqih57$;\n var Collection = Kotlin.kotlin.collections.Collection;\n var data = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.data;\n var Enum = Kotlin.kotlin.Enum;\n var throwISE = Kotlin.throwISE;\n var isFinite = Kotlin.kotlin.isFinite_yrwdxr$;\n var zip = Kotlin.kotlin.collections.zip_45mdf7$;\n var getCallableRef = Kotlin.getCallableRef;\n var toList = Kotlin.kotlin.collections.toList_abgq59$;\n var compareBy = Kotlin.kotlin.comparisons.compareBy_bvgy4j$;\n var sortedWith = Kotlin.kotlin.collections.sortedWith_eknfly$;\n var reversed = Kotlin.kotlin.collections.reversed_7wnvza$;\n var plus = Kotlin.kotlin.collections.plus_mydzjv$;\n var toSet = Kotlin.kotlin.collections.toSet_7wnvza$;\n var logging = $module$lets_plot_base_portable.jetbrains.datalore.base.logging;\n var getKClass = Kotlin.getKClass;\n var ArrayList_init_0 = Kotlin.kotlin.collections.ArrayList_init_mqih57$;\n var HashMap_init = Kotlin.kotlin.collections.HashMap_init_q3lmfv$;\n var HashMap_init_0 = Kotlin.kotlin.collections.HashMap_init_73mtqc$;\n var LinkedHashMap_init = Kotlin.kotlin.collections.LinkedHashMap_init_q3lmfv$;\n var mapCapacity = Kotlin.kotlin.collections.mapCapacity_za3lpa$;\n var LinkedHashMap_init_0 = Kotlin.kotlin.collections.LinkedHashMap_init_bwtc7$;\n var MutableCollection = Kotlin.kotlin.collections.MutableCollection;\n var toString = Kotlin.toString;\n var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init_pdl1vj$;\n var TreeMap = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.TreeMap;\n var intersect = Kotlin.kotlin.collections.intersect_q4559j$;\n var Map = Kotlin.kotlin.collections.Map;\n var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$;\n var ArrayList_init_1 = Kotlin.kotlin.collections.ArrayList_init_ww73n8$;\n var JsMath = Math;\n var listOf = Kotlin.kotlin.collections.listOf_i5x0yv$;\n var Unit = Kotlin.kotlin.Unit;\n var TypedKeyHashMap = $module$lets_plot_base_portable.jetbrains.datalore.base.typedKey.TypedKeyHashMap;\n var kotlin_js_internal_DoubleCompanionObject = Kotlin.kotlin.js.internal.DoubleCompanionObject;\n var Color = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Color;\n var ClosedRange = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.ClosedRange;\n var HashSet_init = Kotlin.kotlin.collections.HashSet_init_mqih57$;\n var NoSuchElementException = Kotlin.kotlin.NoSuchElementException;\n var Iterator = Kotlin.kotlin.collections.Iterator;\n var Function = $module$lets_plot_base_portable.jetbrains.datalore.base.function.Function;\n var values = $module$lets_plot_base_portable.jetbrains.datalore.base.values;\n var svg = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg;\n var DoubleVector = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleVector;\n var geometry = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry;\n var Ordering = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.Ordering;\n var Comparator = Kotlin.kotlin.Comparator;\n var getPropertyCallableRef = Kotlin.getPropertyCallableRef;\n var coerceAtLeast = Kotlin.kotlin.ranges.coerceAtLeast_dqglrj$;\n var base = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.base;\n var startsWith = Kotlin.kotlin.text.startsWith_7epoxm$;\n var Regex_init = Kotlin.kotlin.text.Regex_init_61zpoe$;\n var DoubleSegment = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleSegment;\n var HashSet_init_0 = Kotlin.kotlin.collections.HashSet_init_ww73n8$;\n var reverse = Kotlin.kotlin.collections.reverse_vvxzk3$;\n var Any = Object;\n var DoubleRectangle = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleRectangle;\n var DoubleRectangle_init = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleRectangle_init_6y0v78$;\n var SvgLineElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgLineElement_init_6y0v78$;\n var SvgGElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgGElement;\n var slim = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.slim;\n var SvgRectElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement_init_6y0v78$;\n var SvgImageElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgImageElement_init_6y0v78$;\n var throwUPAE = Kotlin.throwUPAE;\n var isNaN_0 = Kotlin.kotlin.isNaN_yrwdxr$;\n var SvgPathDataBuilder = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgPathDataBuilder;\n var math = Kotlin.kotlin.math;\n var round = Kotlin.kotlin.math.round_14dthe$;\n var numberToInt = Kotlin.numberToInt;\n var SvgImageElementEx$Bitmap = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgImageElementEx.Bitmap;\n var SvgImageElementEx = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgImageElementEx;\n var SvgPathElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgPathElement_init_7jrsat$;\n var SvgShape = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgShape;\n var SvgElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgElement;\n var to = Kotlin.kotlin.to_ujzrz7$;\n var mapOf = Kotlin.kotlin.collections.mapOf_qfcya0$;\n var setOf = Kotlin.kotlin.collections.setOf_i5x0yv$;\n var take = Kotlin.kotlin.collections.take_ba2ldo$;\n var copyToArray = Kotlin.kotlin.collections.copyToArray;\n var splitRings = $module$lets_plot_base_portable.jetbrains.datalore.base.algorithms.splitRings_bemo1h$;\n var Pair = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Pair;\n var SvgRectElement_init_0 = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement_init_wthzt5$;\n var emptyMap = Kotlin.kotlin.collections.emptyMap_q3lmfv$;\n var Random = Kotlin.kotlin.random.Random;\n var asList = Kotlin.kotlin.collections.asList_us0mfu$;\n var SvgSlimObject = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.slim.SvgSlimObject;\n var SvgPathData = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgPathData;\n var SvgPathDataBuilder$Interpolation = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgPathDataBuilder.Interpolation;\n var WritableProperty = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.property.WritableProperty;\n var SvgColors = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgColors;\n var EventHandler = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event.EventHandler;\n var CompositeRegistration = $module$lets_plot_base_portable.jetbrains.datalore.base.registration.CompositeRegistration;\n var SvgClipPathElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgClipPathElement;\n var SvgRectElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement;\n var SvgDefsElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgDefsElement;\n var SvgIRI = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgIRI;\n var SvgGraphicsElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgGraphicsElement;\n var SvgTransformBuilder = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgTransformBuilder;\n var random = $module$lets_plot_base_portable.jetbrains.datalore.base.random;\n var SvgTextElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgTextElement_init_61zpoe$;\n var isBlank = Kotlin.kotlin.text.isBlank_gw00vp$;\n var numberToDouble = Kotlin.numberToDouble;\n var Pair_0 = Kotlin.kotlin.Pair;\n var toMap = Kotlin.kotlin.collections.toMap_6hr0sd$;\n var getValue = Kotlin.kotlin.collections.getValue_t9ocha$;\n var toList_0 = Kotlin.kotlin.collections.toList_7wnvza$;\n var checkIndexOverflow = Kotlin.kotlin.collections.checkIndexOverflow_za3lpa$;\n var isInfinite = Kotlin.kotlin.isInfinite_yrwdxr$;\n var toMutableList = Kotlin.kotlin.collections.toMutableList_4c7yge$;\n var YearInterval = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.time.interval.YearInterval;\n var time = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.time;\n var interval = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.time.interval;\n var until = Kotlin.kotlin.ranges.until_dqglrj$;\n var listOf_0 = Kotlin.kotlin.collections.listOf_mh5how$;\n var asReversed = Kotlin.kotlin.collections.asReversed_2p1efm$;\n var NumberFormat_init = $module$lets_plot_base_portable.jetbrains.datalore.base.numberFormat.NumberFormat_init_61zpoe$;\n var text = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.text;\n var TimeInterval = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.time.interval.TimeInterval;\n var first = Kotlin.kotlin.collections.first_2p1efm$;\n var last = Kotlin.kotlin.collections.last_2p1efm$;\n var filterNotNull = Kotlin.kotlin.collections.filterNotNull_m3lr2h$;\n var binarySearch = Kotlin.kotlin.collections.binarySearch_jhx6be$;\n var abs = Kotlin.kotlin.math.abs_za3lpa$;\n var maxOrNull = Kotlin.kotlin.collections.maxOrNull_l63kqw$;\n var mutableMapOf = Kotlin.kotlin.collections.mutableMapOf_qfcya0$;\n var HashSet_init_1 = Kotlin.kotlin.collections.HashSet_init_287e2$;\n var sortWith = Kotlin.kotlin.collections.sortWith_nqfjgj$;\n var hashCode = Kotlin.hashCode;\n var rangeTo = Kotlin.kotlin.ranges.rangeTo_38ydlf$;\n var withIndex = Kotlin.kotlin.collections.withIndex_7wnvza$;\n var LinkedHashSet_init_0 = Kotlin.kotlin.collections.LinkedHashSet_init_287e2$;\n var RuntimeException_init = Kotlin.kotlin.RuntimeException_init_pdl1vj$;\n var unzip = Kotlin.kotlin.collections.unzip_6hr0sd$;\n var sorted = Kotlin.kotlin.collections.sorted_exjks8$;\n var sum = Kotlin.kotlin.collections.sum_l63kqw$;\n var wrapFunction = Kotlin.wrapFunction;\n var Array_0 = Array;\n var L37 = Kotlin.Long.fromInt(37);\n var Random_0 = Kotlin.kotlin.random.Random_s8cxhz$;\n var coerceIn = Kotlin.kotlin.ranges.coerceIn_nig4hr$;\n var L_38038050983108802 = new Kotlin.Long(456400702, -8856424);\n var arrayCopy = Kotlin.kotlin.collections.arrayCopy;\n var average = Kotlin.kotlin.collections.average_bvy38s$;\n var arrayListOf = Kotlin.kotlin.collections.arrayListOf_i5x0yv$;\n var fill = Kotlin.kotlin.collections.fill_x4f2cq$;\n var sort = Kotlin.primitiveArraySort;\n var fill_0 = Kotlin.kotlin.collections.fill_tpuxuu$;\n var get_lastIndex = Kotlin.kotlin.collections.get_lastIndex_bvy38s$;\n var get_indices = Kotlin.kotlin.collections.get_indices_bvy38s$;\n var reversed_0 = Kotlin.kotlin.ranges.reversed_zf1xzc$;\n var toMutableList_0 = Kotlin.kotlin.collections.toMutableList_bvy38s$;\n var isNaN_1 = Kotlin.kotlin.isNaN_81szk$;\n var toBits = Kotlin.floatToBits;\n var toBits_0 = Kotlin.doubleToBits;\n var abs_0 = Kotlin.kotlin.math.abs_s8cxhz$;\n var L_2147483648 = Kotlin.Long.fromInt(-2147483648);\n var L_5852615386664158222 = new Kotlin.Long(1994767346, -1362668208);\n var zip_0 = Kotlin.kotlin.collections.zip_pmvpm9$;\n var toDoubleArray = Kotlin.kotlin.collections.toDoubleArray_tcduak$;\n var asSequence = Kotlin.kotlin.collections.asSequence_7wnvza$;\n var zip_1 = Kotlin.kotlin.sequences.zip_r7q3s9$;\n var drop = Kotlin.kotlin.sequences.drop_wuwhe2$;\n DataFrame$Variable$Source.prototype = Object.create(Enum.prototype);\n DataFrame$Variable$Source.prototype.constructor = DataFrame$Variable$Source;\n GeomKind.prototype = Object.create(Enum.prototype);\n GeomKind.prototype.constructor = GeomKind;\n AestheticsDefaults$Companion$bar$ObjectLiteral.prototype = Object.create(AestheticsDefaults.prototype);\n AestheticsDefaults$Companion$bar$ObjectLiteral.prototype.constructor = AestheticsDefaults$Companion$bar$ObjectLiteral;\n AestheticsDefaults$Companion$histogram$ObjectLiteral.prototype = Object.create(AestheticsDefaults.prototype);\n AestheticsDefaults$Companion$histogram$ObjectLiteral.prototype.constructor = AestheticsDefaults$Companion$histogram$ObjectLiteral;\n AestheticsDefaults$Companion$area$ObjectLiteral.prototype = Object.create(AestheticsDefaults.prototype);\n AestheticsDefaults$Companion$area$ObjectLiteral.prototype.constructor = AestheticsDefaults$Companion$area$ObjectLiteral;\n TransformVar$TransformVarByAes.prototype = Object.create(AesVisitor.prototype);\n TransformVar$TransformVarByAes.prototype.constructor = TransformVar$TransformVarByAes;\n ABLineGeom.prototype = Object.create(GeomBase.prototype);\n ABLineGeom.prototype.constructor = ABLineGeom;\n AreaGeom.prototype = Object.create(GeomBase.prototype);\n AreaGeom.prototype.constructor = AreaGeom;\n BarGeom.prototype = Object.create(GeomBase.prototype);\n BarGeom.prototype.constructor = BarGeom;\n TileGeom.prototype = Object.create(GeomBase.prototype);\n TileGeom.prototype.constructor = TileGeom;\n Bin2dGeom.prototype = Object.create(TileGeom.prototype);\n Bin2dGeom.prototype.constructor = Bin2dGeom;\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype = Object.create(DataPointAestheticsDelegate.prototype);\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.constructor = BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral;\n BoxplotGeom.prototype = Object.create(GeomBase.prototype);\n BoxplotGeom.prototype.constructor = BoxplotGeom;\n PathGeom.prototype = Object.create(GeomBase.prototype);\n PathGeom.prototype.constructor = PathGeom;\n ContourGeom.prototype = Object.create(PathGeom.prototype);\n ContourGeom.prototype.constructor = ContourGeom;\n PolygonGeom.prototype = Object.create(GeomBase.prototype);\n PolygonGeom.prototype.constructor = PolygonGeom;\n ContourfGeom.prototype = Object.create(PolygonGeom.prototype);\n ContourfGeom.prototype.constructor = ContourfGeom;\n CrossBarGeom.prototype = Object.create(GeomBase.prototype);\n CrossBarGeom.prototype.constructor = CrossBarGeom;\n Density2dGeom.prototype = Object.create(ContourGeom.prototype);\n Density2dGeom.prototype.constructor = Density2dGeom;\n Density2dfGeom.prototype = Object.create(ContourfGeom.prototype);\n Density2dfGeom.prototype.constructor = Density2dfGeom;\n DensityGeom.prototype = Object.create(AreaGeom.prototype);\n DensityGeom.prototype.constructor = DensityGeom;\n ErrorBarGeom.prototype = Object.create(GeomBase.prototype);\n ErrorBarGeom.prototype.constructor = ErrorBarGeom;\n LineGeom.prototype = Object.create(PathGeom.prototype);\n LineGeom.prototype.constructor = LineGeom;\n FreqpolyGeom.prototype = Object.create(LineGeom.prototype);\n FreqpolyGeom.prototype.constructor = FreqpolyGeom;\n HLineGeom.prototype = Object.create(GeomBase.prototype);\n HLineGeom.prototype.constructor = HLineGeom;\n HistogramGeom.prototype = Object.create(BarGeom.prototype);\n HistogramGeom.prototype.constructor = HistogramGeom;\n ImageGeom.prototype = Object.create(GeomBase.prototype);\n ImageGeom.prototype.constructor = ImageGeom;\n PointGeom.prototype = Object.create(GeomBase.prototype);\n PointGeom.prototype.constructor = PointGeom;\n JitterGeom.prototype = Object.create(PointGeom.prototype);\n JitterGeom.prototype.constructor = JitterGeom;\n LineRangeGeom.prototype = Object.create(GeomBase.prototype);\n LineRangeGeom.prototype.constructor = LineRangeGeom;\n MapGeom.prototype = Object.create(PolygonGeom.prototype);\n MapGeom.prototype.constructor = MapGeom;\n LinesHelper.prototype = Object.create(GeomHelper.prototype);\n LinesHelper.prototype.constructor = LinesHelper;\n PieGeom$PieHelper.prototype = Object.create(LinesHelper.prototype);\n PieGeom$PieHelper.prototype.constructor = PieGeom$PieHelper;\n PieGeom.prototype = Object.create(GeomBase.prototype);\n PieGeom.prototype.constructor = PieGeom;\n PointRangeGeom.prototype = Object.create(GeomBase.prototype);\n PointRangeGeom.prototype.constructor = PointRangeGeom;\n RasterGeom.prototype = Object.create(GeomBase.prototype);\n RasterGeom.prototype.constructor = RasterGeom;\n RectGeom.prototype = Object.create(GeomBase.prototype);\n RectGeom.prototype.constructor = RectGeom;\n RibbonGeom.prototype = Object.create(GeomBase.prototype);\n RibbonGeom.prototype.constructor = RibbonGeom;\n SegmentGeom.prototype = Object.create(GeomBase.prototype);\n SegmentGeom.prototype.constructor = SegmentGeom;\n SmoothGeom.prototype = Object.create(GeomBase.prototype);\n SmoothGeom.prototype.constructor = SmoothGeom;\n StepGeom$Direction.prototype = Object.create(Enum.prototype);\n StepGeom$Direction.prototype.constructor = StepGeom$Direction;\n StepGeom.prototype = Object.create(LineGeom.prototype);\n StepGeom.prototype.constructor = StepGeom;\n TextGeom.prototype = Object.create(GeomBase.prototype);\n TextGeom.prototype.constructor = TextGeom;\n VLineGeom.prototype = Object.create(GeomBase.prototype);\n VLineGeom.prototype.constructor = VLineGeom;\n ArrowSpec$toArrowAes$ObjectLiteral.prototype = Object.create(DataPointAestheticsDelegate.prototype);\n ArrowSpec$toArrowAes$ObjectLiteral.prototype.constructor = ArrowSpec$toArrowAes$ObjectLiteral;\n ArrowSpec$End.prototype = Object.create(Enum.prototype);\n ArrowSpec$End.prototype.constructor = ArrowSpec$End;\n ArrowSpec$Type.prototype = Object.create(Enum.prototype);\n ArrowSpec$Type.prototype.constructor = ArrowSpec$Type;\n RectanglesHelper.prototype = Object.create(GeomHelper.prototype);\n RectanglesHelper.prototype.constructor = RectanglesHelper;\n GeomTargetLocator$LookupSpace.prototype = Object.create(Enum.prototype);\n GeomTargetLocator$LookupSpace.prototype.constructor = GeomTargetLocator$LookupSpace;\n GeomTargetLocator$LookupStrategy.prototype = Object.create(Enum.prototype);\n GeomTargetLocator$LookupStrategy.prototype.constructor = GeomTargetLocator$LookupStrategy;\n HitShape$Kind.prototype = Object.create(Enum.prototype);\n HitShape$Kind.prototype.constructor = HitShape$Kind;\n HitShape$Companion$shapeWithPath$ObjectLiteral.prototype = Object.create(HitShape.prototype);\n HitShape$Companion$shapeWithPath$ObjectLiteral.prototype.constructor = HitShape$Companion$shapeWithPath$ObjectLiteral;\n TipLayoutHint$StemLength.prototype = Object.create(Enum.prototype);\n TipLayoutHint$StemLength.prototype.constructor = TipLayoutHint$StemLength;\n TipLayoutHint$Kind.prototype = Object.create(Enum.prototype);\n TipLayoutHint$Kind.prototype.constructor = TipLayoutHint$Kind;\n TooltipAnchor$VerticalAnchor.prototype = Object.create(Enum.prototype);\n TooltipAnchor$VerticalAnchor.prototype.constructor = TooltipAnchor$VerticalAnchor;\n TooltipAnchor$HorizontalAnchor.prototype = Object.create(Enum.prototype);\n TooltipAnchor$HorizontalAnchor.prototype.constructor = TooltipAnchor$HorizontalAnchor;\n LivemapConstants$DisplayMode.prototype = Object.create(Enum.prototype);\n LivemapConstants$DisplayMode.prototype.constructor = LivemapConstants$DisplayMode;\n LivemapConstants$Theme.prototype = Object.create(Enum.prototype);\n LivemapConstants$Theme.prototype.constructor = LivemapConstants$Theme;\n LivemapConstants$Projection.prototype = Object.create(Enum.prototype);\n LivemapConstants$Projection.prototype.constructor = LivemapConstants$Projection;\n PositionAdjustments$Meta.prototype = Object.create(Enum.prototype);\n PositionAdjustments$Meta.prototype.constructor = PositionAdjustments$Meta;\n PositionAdjustments$StackingStrategy.prototype = Object.create(Enum.prototype);\n PositionAdjustments$StackingStrategy.prototype.constructor = PositionAdjustments$StackingStrategy;\n StackPos$SplitPositiveNegative.prototype = Object.create(StackPos.prototype);\n StackPos$SplitPositiveNegative.prototype.constructor = StackPos$SplitPositiveNegative;\n StackPos$SumPositiveNegative.prototype = Object.create(StackPos.prototype);\n StackPos$SumPositiveNegative.prototype.constructor = StackPos$SumPositiveNegative;\n NamedLineType.prototype = Object.create(Enum.prototype);\n NamedLineType.prototype.constructor = NamedLineType;\n NamedLineType$BLANK.prototype = Object.create(NamedLineType.prototype);\n NamedLineType$BLANK.prototype.constructor = NamedLineType$BLANK;\n NamedLineType$SOLID.prototype = Object.create(NamedLineType.prototype);\n NamedLineType$SOLID.prototype.constructor = NamedLineType$SOLID;\n NamedShape.prototype = Object.create(Enum.prototype);\n NamedShape.prototype.constructor = NamedShape;\n CircleGlyph.prototype = Object.create(SingletonGlyph.prototype);\n CircleGlyph.prototype.constructor = CircleGlyph;\n TwoShapeGlyph.prototype = Object.create(MultiShapeGlyph.prototype);\n TwoShapeGlyph.prototype.constructor = TwoShapeGlyph;\n CrossGlyph.prototype = Object.create(TwoShapeGlyph.prototype);\n CrossGlyph.prototype.constructor = CrossGlyph;\n DiamondGlyph.prototype = Object.create(SingletonGlyph.prototype);\n DiamondGlyph.prototype.constructor = DiamondGlyph;\n PlusGlyph.prototype = Object.create(TwoShapeGlyph.prototype);\n PlusGlyph.prototype.constructor = PlusGlyph;\n SquareGlyph.prototype = Object.create(SingletonGlyph.prototype);\n SquareGlyph.prototype.constructor = SquareGlyph;\n TriangleGlyph.prototype = Object.create(SingletonGlyph.prototype);\n TriangleGlyph.prototype.constructor = TriangleGlyph;\n GroupComponent.prototype = Object.create(SvgComponent.prototype);\n GroupComponent.prototype.constructor = GroupComponent;\n LinePath.prototype = Object.create(SvgComponent.prototype);\n LinePath.prototype.constructor = LinePath;\n TextLabel$HorizontalAnchor.prototype = Object.create(Enum.prototype);\n TextLabel$HorizontalAnchor.prototype.constructor = TextLabel$HorizontalAnchor;\n TextLabel$VerticalAnchor.prototype = Object.create(Enum.prototype);\n TextLabel$VerticalAnchor.prototype.constructor = TextLabel$VerticalAnchor;\n TextLabel.prototype = Object.create(SvgComponent.prototype);\n TextLabel.prototype.constructor = TextLabel;\n ContinuousScale$MyBuilder.prototype = Object.create(AbstractScale$AbstractBuilder.prototype);\n ContinuousScale$MyBuilder.prototype.constructor = ContinuousScale$MyBuilder;\n ContinuousScale.prototype = Object.create(AbstractScale.prototype);\n ContinuousScale.prototype.constructor = ContinuousScale;\n DiscreteScale$MyBuilder.prototype = Object.create(AbstractScale$AbstractBuilder.prototype);\n DiscreteScale$MyBuilder.prototype.constructor = DiscreteScale$MyBuilder;\n DiscreteScale.prototype = Object.create(AbstractScale.prototype);\n DiscreteScale.prototype.constructor = DiscreteScale;\n DateTimeBreaksHelper.prototype = Object.create(BreaksHelperBase.prototype);\n DateTimeBreaksHelper.prototype.constructor = DateTimeBreaksHelper;\n LinearBreaksHelper.prototype = Object.create(BreaksHelperBase.prototype);\n LinearBreaksHelper.prototype.constructor = LinearBreaksHelper;\n IdentityTransform.prototype = Object.create(FunTransform.prototype);\n IdentityTransform.prototype.constructor = IdentityTransform;\n Log10Transform.prototype = Object.create(FunTransform.prototype);\n Log10Transform.prototype.constructor = Log10Transform;\n ReverseTransform.prototype = Object.create(FunTransform.prototype);\n ReverseTransform.prototype.constructor = ReverseTransform;\n SqrtTransform.prototype = Object.create(FunTransform.prototype);\n SqrtTransform.prototype.constructor = SqrtTransform;\n AbstractDensity2dStat.prototype = Object.create(BaseStat.prototype);\n AbstractDensity2dStat.prototype.constructor = AbstractDensity2dStat;\n Bin2dStat.prototype = Object.create(BaseStat.prototype);\n Bin2dStat.prototype.constructor = Bin2dStat;\n BinStat$XPosKind.prototype = Object.create(Enum.prototype);\n BinStat$XPosKind.prototype.constructor = BinStat$XPosKind;\n BinStat.prototype = Object.create(BaseStat.prototype);\n BinStat.prototype.constructor = BinStat;\n BoxplotStat.prototype = Object.create(BaseStat.prototype);\n BoxplotStat.prototype.constructor = BoxplotStat;\n ContourFillHelper$BorderKind.prototype = Object.create(Enum.prototype);\n ContourFillHelper$BorderKind.prototype.constructor = ContourFillHelper$BorderKind;\n ContourStat.prototype = Object.create(BaseStat.prototype);\n ContourStat.prototype.constructor = ContourStat;\n ContourfStat.prototype = Object.create(BaseStat.prototype);\n ContourfStat.prototype.constructor = ContourfStat;\n CorrelationStat$Method.prototype = Object.create(Enum.prototype);\n CorrelationStat$Method.prototype.constructor = CorrelationStat$Method;\n CorrelationStat$Type.prototype = Object.create(Enum.prototype);\n CorrelationStat$Type.prototype.constructor = CorrelationStat$Type;\n CorrelationStat.prototype = Object.create(BaseStat.prototype);\n CorrelationStat.prototype.constructor = CorrelationStat;\n CountStat.prototype = Object.create(BaseStat.prototype);\n CountStat.prototype.constructor = CountStat;\n Density2dStat.prototype = Object.create(AbstractDensity2dStat.prototype);\n Density2dStat.prototype.constructor = Density2dStat;\n Density2dfStat.prototype = Object.create(AbstractDensity2dStat.prototype);\n Density2dfStat.prototype.constructor = Density2dfStat;\n DensityStat$Kernel.prototype = Object.create(Enum.prototype);\n DensityStat$Kernel.prototype.constructor = DensityStat$Kernel;\n DensityStat$BandWidthMethod.prototype = Object.create(Enum.prototype);\n DensityStat$BandWidthMethod.prototype.constructor = DensityStat$BandWidthMethod;\n DensityStat.prototype = Object.create(BaseStat.prototype);\n DensityStat.prototype.constructor = DensityStat;\n SmoothStat$Method.prototype = Object.create(Enum.prototype);\n SmoothStat$Method.prototype.constructor = SmoothStat$Method;\n SmoothStat.prototype = Object.create(BaseStat.prototype);\n SmoothStat.prototype.constructor = SmoothStat;\n Stats$IdentityStat.prototype = Object.create(BaseStat.prototype);\n Stats$IdentityStat.prototype.constructor = Stats$IdentityStat;\n AbstractUnivariateSolver.prototype = Object.create(BaseAbstractUnivariateSolver.prototype);\n AbstractUnivariateSolver.prototype.constructor = AbstractUnivariateSolver;\n AllowedSolution.prototype = Object.create(Enum.prototype);\n AllowedSolution.prototype.constructor = AllowedSolution;\n Beta$regularizedBeta$ObjectLiteral.prototype = Object.create(ContinuedFraction.prototype);\n Beta$regularizedBeta$ObjectLiteral.prototype.constructor = Beta$regularizedBeta$ObjectLiteral;\n BrentSolver.prototype = Object.create(AbstractUnivariateSolver.prototype);\n BrentSolver.prototype.constructor = BrentSolver;\n Gamma$regularizedGammaQ$ObjectLiteral.prototype = Object.create(ContinuedFraction.prototype);\n Gamma$regularizedGammaQ$ObjectLiteral.prototype.constructor = Gamma$regularizedGammaQ$ObjectLiteral;\n MathArrays$OrderDirection.prototype = Object.create(Enum.prototype);\n MathArrays$OrderDirection.prototype.constructor = MathArrays$OrderDirection;\n TDistribution.prototype = Object.create(AbstractRealDistribution.prototype);\n TDistribution.prototype.constructor = TDistribution;\n LinearRegression.prototype = Object.create(RegressionEvaluator.prototype);\n LinearRegression.prototype.constructor = LinearRegression;\n LocalPolynomialRegression.prototype = Object.create(RegressionEvaluator.prototype);\n LocalPolynomialRegression.prototype.constructor = LocalPolynomialRegression;\n PolynomialRegression.prototype = Object.create(RegressionEvaluator.prototype);\n PolynomialRegression.prototype.constructor = PolynomialRegression;\n function Aes(name, isNumeric) {\n Aes$Companion_getInstance();\n if (isNumeric === void 0)\n isNumeric = true;\n this.name = name;\n this.isNumeric = isNumeric;\n Aes$Companion_getInstance().values_0.add_11rb$(this);\n }\n Object.defineProperty(Aes.prototype, 'isColor', {\n configurable: true,\n get: function () {\n return Aes$Companion_getInstance().isColor_896ixz$(this);\n }\n });\n Aes.prototype.toString = function () {\n return \"aes '\" + this.name + \"'\";\n };\n function Aes$Companion() {\n Aes$Companion_instance = this;\n this.values_0 = ArrayList_init();\n this.X = new Aes('x');\n this.Y = new Aes('y');\n this.Z = new Aes('z');\n this.COLOR = new Aes('color', false);\n this.FILL = new Aes('fill', false);\n this.ALPHA = new Aes('alpha');\n this.SHAPE = new Aes('shape', false);\n this.LINETYPE = new Aes('linetype', false);\n this.SIZE = new Aes('size');\n this.WIDTH = new Aes('width');\n this.HEIGHT = new Aes('height');\n this.WEIGHT = new Aes('weight');\n this.INTERCEPT = new Aes('intercept');\n this.SLOPE = new Aes('slope');\n this.XINTERCEPT = new Aes('xintercept');\n this.YINTERCEPT = new Aes('yintercept');\n this.LOWER = new Aes('lower');\n this.MIDDLE = new Aes('middle');\n this.UPPER = new Aes('upper');\n this.XMIN = new Aes('xmin');\n this.XMAX = new Aes('xmax');\n this.YMIN = new Aes('ymin');\n this.YMAX = new Aes('ymax');\n this.XEND = new Aes('xend');\n this.YEND = new Aes('yend');\n this.FRAME = new Aes('frame', false);\n this.SPEED = new Aes('speed');\n this.FLOW = new Aes('flow');\n this.LABEL = new Aes('label', false);\n this.FAMILY = new Aes('family', false);\n this.FONTFACE = new Aes('fontface', false);\n this.HJUST = new Aes('hjust', false);\n this.VJUST = new Aes('vjust', false);\n this.ANGLE = new Aes('angle');\n this.SYM_X = new Aes('sym_x');\n this.SYM_Y = new Aes('sym_y');\n }\n function Aes$Companion$numeric$lambda(aes) {\n return aes.isNumeric;\n }\n Aes$Companion.prototype.numeric_shhb9a$ = function (unfiltered) {\n var tmp$;\n return Kotlin.isType(tmp$ = collect.Iterables.filter_fpit1u$(unfiltered, Aes$Companion$numeric$lambda), Iterable) ? tmp$ : throwCCE();\n };\n Aes$Companion.prototype.isPositional_896ixz$ = function (aes) {\n return this.isPositionalXY_896ixz$(aes) || equals(aes, this.SLOPE);\n };\n Aes$Companion.prototype.isPositionalXY_896ixz$ = function (aes) {\n return this.isPositionalX_896ixz$(aes) || this.isPositionalY_896ixz$(aes);\n };\n Aes$Companion.prototype.isPositionalX_896ixz$ = function (aes) {\n return equals(aes, this.X) || equals(aes, this.XINTERCEPT) || equals(aes, this.XMIN) || equals(aes, this.XMAX) || equals(aes, this.XEND);\n };\n Aes$Companion.prototype.isPositionalY_896ixz$ = function (aes) {\n return equals(aes, this.Y) || equals(aes, this.YMIN) || equals(aes, this.YMAX) || equals(aes, this.INTERCEPT) || equals(aes, this.YINTERCEPT) || equals(aes, this.LOWER) || equals(aes, this.MIDDLE) || equals(aes, this.UPPER) || equals(aes, this.YEND);\n };\n Aes$Companion.prototype.isColor_896ixz$ = function (aes) {\n return equals(aes, this.COLOR) || equals(aes, this.FILL);\n };\n Aes$Companion.prototype.isAffectingScaleX_896ixz$ = function (aes) {\n return this.isPositionalX_896ixz$(aes);\n };\n Aes$Companion.prototype.isAffectingScaleY_896ixz$ = function (aes) {\n return this.isPositionalY_896ixz$(aes) && !equals(aes, this.INTERCEPT);\n };\n function Aes$Companion$affectingScaleX$lambda(this$Aes$) {\n return function (it) {\n return this$Aes$.isAffectingScaleX_896ixz$(it);\n };\n }\n Aes$Companion.prototype.affectingScaleX_shhb9a$ = function (unfiltered) {\n var numeric = this.numeric_shhb9a$(unfiltered);\n return collect.Iterables.filter_fpit1u$(numeric, Aes$Companion$affectingScaleX$lambda(this));\n };\n function Aes$Companion$affectingScaleY$lambda(this$Aes$) {\n return function (it) {\n return this$Aes$.isAffectingScaleY_896ixz$(it);\n };\n }\n Aes$Companion.prototype.affectingScaleY_shhb9a$ = function (unfiltered) {\n var numeric = this.numeric_shhb9a$(unfiltered);\n return collect.Iterables.filter_fpit1u$(numeric, Aes$Companion$affectingScaleY$lambda(this));\n };\n Aes$Companion.prototype.noGuideNeeded_896ixz$ = function (aes) {\n return equals(aes, this.FRAME) || equals(aes, this.SPEED) || equals(aes, this.FLOW) || equals(aes, this.LABEL) || equals(aes, this.SLOPE) || equals(aes, this.WIDTH) || equals(aes, this.HEIGHT) || equals(aes, this.HJUST) || equals(aes, this.VJUST) || equals(aes, this.ANGLE) || equals(aes, this.FAMILY) || equals(aes, this.FONTFACE) || equals(aes, this.SYM_X) || equals(aes, this.SYM_Y) || this.isPositional_896ixz$(aes);\n };\n Aes$Companion.prototype.values = function () {\n return this.values_0;\n };\n Aes$Companion.prototype.allPositional = function () {\n var tmp$;\n var $receiver = this.values_0;\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (this.isPositional_896ixz$(element))\n destination.add_11rb$(element);\n }\n return Kotlin.isType(tmp$ = destination, List) ? tmp$ : throwCCE();\n };\n Aes$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Aes$Companion_instance = null;\n function Aes$Companion_getInstance() {\n if (Aes$Companion_instance === null) {\n new Aes$Companion();\n }return Aes$Companion_instance;\n }\n Aes.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Aes',\n interfaces: [TypedKey]\n };\n function Aesthetics() {\n }\n Aesthetics.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Aesthetics',\n interfaces: []\n };\n function ContinuousTransform() {\n }\n ContinuousTransform.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ContinuousTransform',\n interfaces: [Transform]\n };\n function CoordinateSystem() {\n }\n CoordinateSystem.prototype.isPointInLimits_k2qmv6$ = function (p, isClient, callback$default) {\n if (isClient === void 0)\n isClient = true;\n return callback$default ? callback$default(p, isClient) : this.isPointInLimits_k2qmv6$$default(p, isClient);\n };\n CoordinateSystem.prototype.isRectInLimits_fd842m$ = function (rect, isClient, callback$default) {\n if (isClient === void 0)\n isClient = true;\n return callback$default ? callback$default(rect, isClient) : this.isRectInLimits_fd842m$$default(rect, isClient);\n };\n CoordinateSystem.prototype.isPathInLimits_f6t8kh$ = function (path, isClient, callback$default) {\n if (isClient === void 0)\n isClient = true;\n return callback$default ? callback$default(path, isClient) : this.isPathInLimits_f6t8kh$$default(path, isClient);\n };\n CoordinateSystem.prototype.isPolygonInLimits_f6t8kh$ = function (polygon, isClient, callback$default) {\n if (isClient === void 0)\n isClient = true;\n return callback$default ? callback$default(polygon, isClient) : this.isPolygonInLimits_f6t8kh$$default(polygon, isClient);\n };\n CoordinateSystem.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'CoordinateSystem',\n interfaces: []\n };\n function DataFrame(builder) {\n DataFrame$Companion_getInstance();\n this.myVectorByVar_0 = null;\n this.myIsNumeric_0 = null;\n this.myRanges_0 = HashMap_init();\n this.myDistinctValues_0 = HashMap_init();\n this.myOrderSpecs_0 = null;\n this.assertAllSeriesAreSameSize_0(builder.myVectorByVar_8be2vx$);\n this.myVectorByVar_0 = HashMap_init_0(builder.myVectorByVar_8be2vx$);\n this.myIsNumeric_0 = HashMap_init_0(builder.myIsNumeric_8be2vx$);\n this.myOrderSpecs_0 = builder.myOrderSpecs_8be2vx$;\n var tmp$;\n tmp$ = this.myOrderSpecs_0.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var $receiver = this.myDistinctValues_0;\n var key = element.variable;\n var value = this.getOrderedDistinctValues_0(element);\n $receiver.put_xwzc9p$(key, value);\n }\n }\n function DataFrame$OrderSpec(variable, orderBy, direction, aggregateOperation) {\n if (aggregateOperation === void 0)\n aggregateOperation = null;\n this.variable = variable;\n this.orderBy = orderBy;\n this.direction = direction;\n this.aggregateOperation = aggregateOperation;\n }\n DataFrame$OrderSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'OrderSpec',\n interfaces: []\n };\n Object.defineProperty(DataFrame.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myVectorByVar_0.isEmpty();\n }\n });\n DataFrame.prototype.assertAllSeriesAreSameSize_0 = function (vectorByVar) {\n if (vectorByVar.size > 1) {\n var entries = vectorByVar.entries.iterator();\n var first = entries.next();\n var size = first.value.size;\n while (entries.hasNext()) {\n var next = entries.next();\n if (next.value.size !== size) {\n throw IllegalArgumentException_init('All data series in data frame must have equal size\\n' + this.dumpSizes_0(vectorByVar));\n }}\n }};\n DataFrame.prototype.dumpSizes_0 = function (vectorByVar) {\n var tmp$;\n var sb = StringBuilder_init();\n tmp$ = vectorByVar.entries.iterator();\n while (tmp$.hasNext()) {\n var tmp$_0 = tmp$.next();\n var key = tmp$_0.key;\n var value = tmp$_0.value;\n sb.append_pdl1vj$(key.name).append_pdl1vj$(' : ').append_s8jyv4$(value.size).append_s8itvh$(10);\n }\n return sb.toString();\n };\n DataFrame.prototype.rowCount = function () {\n return this.myVectorByVar_0.isEmpty() ? 0 : this.myVectorByVar_0.entries.iterator().next().value.size;\n };\n DataFrame.prototype.has_8xm3sj$ = function (variable) {\n return this.myVectorByVar_0.containsKey_11rb$(variable);\n };\n DataFrame.prototype.isEmpty_8xm3sj$ = function (variable) {\n return this.get_8xm3sj$(variable).isEmpty();\n };\n DataFrame.prototype.hasNoOrEmpty_8xm3sj$ = function (variable) {\n return !this.has_8xm3sj$(variable) || this.isEmpty_8xm3sj$(variable);\n };\n DataFrame.prototype.get_8xm3sj$ = function (variable) {\n this.assertDefined_0(variable);\n return ensureNotNull(this.myVectorByVar_0.get_11rb$(variable));\n };\n DataFrame.prototype.getNumeric_8xm3sj$ = function (variable) {\n var tmp$;\n this.assertDefined_0(variable);\n var list = this.myVectorByVar_0.get_11rb$(variable);\n if (ensureNotNull(list).isEmpty()) {\n return emptyList();\n }this.assertNumeric_0(variable);\n return Kotlin.isType(tmp$ = list, List) ? tmp$ : throwCCE();\n };\n DataFrame.prototype.distinctValues_8xm3sj$ = function (variable) {\n this.assertDefined_0(variable);\n var tmp$;\n var value = this.myDistinctValues_0.get_11rb$(variable);\n if (value == null) {\n var tmp$_0;\n var $receiver = LinkedHashSet_init(this.get_8xm3sj$(variable));\n $receiver.remove_11rb$(null);\n var values = $receiver;\n return Kotlin.isType(tmp$_0 = values, Collection) ? tmp$_0 : throwCCE();\n } else {\n tmp$ = value;\n }\n return tmp$;\n };\n DataFrame.prototype.variables = function () {\n return this.myVectorByVar_0.keys;\n };\n DataFrame.prototype.isNumeric_8xm3sj$ = function (variable) {\n this.assertDefined_0(variable);\n if (!this.myIsNumeric_0.containsKey_11rb$(variable)) {\n var checkedDoubles = data.SeriesUtil.checkedDoubles_9ma18$(this.get_8xm3sj$(variable));\n var $receiver = this.myIsNumeric_0;\n var value = checkedDoubles.notEmptyAndCanBeCast();\n $receiver.put_xwzc9p$(variable, value);\n }return ensureNotNull(this.myIsNumeric_0.get_11rb$(variable));\n };\n DataFrame.prototype.range_8xm3sj$ = function (variable) {\n if (!this.myRanges_0.containsKey_11rb$(variable)) {\n var v = this.getNumeric_8xm3sj$(variable);\n var r = data.SeriesUtil.range_l63ks6$(v);\n this.myRanges_0.put_xwzc9p$(variable, r);\n }return this.myRanges_0.get_11rb$(variable);\n };\n DataFrame.prototype.builder = function () {\n return DataFrame$DataFrame$Builder_init_0(this);\n };\n function DataFrame$assertDefined$lambda(closure$e) {\n return function () {\n return ensureNotNull(closure$e.message);\n };\n }\n DataFrame.prototype.assertDefined_0 = function (variable) {\n if (!this.has_8xm3sj$(variable)) {\n var e = IllegalArgumentException_init(\"Undefined variable: '\" + variable + \"'\");\n DataFrame$Companion_getInstance().LOG_0.error_l35kib$(e, DataFrame$assertDefined$lambda(e));\n throw e;\n }};\n function DataFrame$assertNumeric$lambda(closure$e) {\n return function () {\n return ensureNotNull(closure$e.message);\n };\n }\n DataFrame.prototype.assertNumeric_0 = function (variable) {\n if (!this.isNumeric_8xm3sj$(variable)) {\n var e = IllegalArgumentException_init(\"Not a numeric variable: '\" + variable + \"'\");\n DataFrame$Companion_getInstance().LOG_0.error_l35kib$(e, DataFrame$assertNumeric$lambda(e));\n throw e;\n }};\n function DataFrame$selectIndices$lambda(closure$indices) {\n return function (serie) {\n return data.SeriesUtil.pickAtIndices_ge51dg$(serie, closure$indices);\n };\n }\n DataFrame.prototype.selectIndices_pqoyrt$ = function (indices) {\n return this.buildModified_0(DataFrame$selectIndices$lambda(indices));\n };\n function DataFrame$selectIndices$lambda_0(closure$indices) {\n return function (serie) {\n return data.SeriesUtil.pickAtIndices_jlfzfq$(serie, closure$indices);\n };\n }\n DataFrame.prototype.selectIndices_p1n9e9$ = function (indices) {\n return this.buildModified_0(DataFrame$selectIndices$lambda_0(indices));\n };\n function DataFrame$dropIndices$lambda(closure$indices) {\n return function (serie) {\n return data.SeriesUtil.skipAtIndices_jlfzfq$(serie, closure$indices);\n };\n }\n DataFrame.prototype.dropIndices_p1n9e9$ = function (indices) {\n return indices.isEmpty() ? this : this.buildModified_0(DataFrame$dropIndices$lambda(indices));\n };\n DataFrame.prototype.buildModified_0 = function (serieFun) {\n var tmp$;\n var builder = this.builder();\n tmp$ = this.myVectorByVar_0.keys.iterator();\n while (tmp$.hasNext()) {\n var variable = tmp$.next();\n var serie = this.myVectorByVar_0.get_11rb$(variable);\n var modifiedSerie = serieFun(ensureNotNull(serie));\n builder.putIntern_bxyhp4$(variable, modifiedSerie);\n }\n return builder.build();\n };\n function DataFrame$Variable(name, source, label) {\n DataFrame$Variable$Companion_getInstance();\n if (source === void 0)\n source = DataFrame$Variable$Source$ORIGIN_getInstance();\n if (label === void 0)\n label = name;\n this.name = name;\n this.source = source;\n this.label = label;\n }\n Object.defineProperty(DataFrame$Variable.prototype, 'isOrigin', {\n configurable: true,\n get: function () {\n return this.source === DataFrame$Variable$Source$ORIGIN_getInstance();\n }\n });\n Object.defineProperty(DataFrame$Variable.prototype, 'isStat', {\n configurable: true,\n get: function () {\n return this.source === DataFrame$Variable$Source$STAT_getInstance();\n }\n });\n Object.defineProperty(DataFrame$Variable.prototype, 'isTransform', {\n configurable: true,\n get: function () {\n return this.source === DataFrame$Variable$Source$TRANSFORM_getInstance();\n }\n });\n DataFrame$Variable.prototype.toString = function () {\n return this.name;\n };\n DataFrame$Variable.prototype.toSummaryString = function () {\n return this.name + \", '\" + this.label + \"' [\" + this.source + ']';\n };\n function DataFrame$Variable$Source(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function DataFrame$Variable$Source_initFields() {\n DataFrame$Variable$Source_initFields = function () {\n };\n DataFrame$Variable$Source$ORIGIN_instance = new DataFrame$Variable$Source('ORIGIN', 0);\n DataFrame$Variable$Source$TRANSFORM_instance = new DataFrame$Variable$Source('TRANSFORM', 1);\n DataFrame$Variable$Source$STAT_instance = new DataFrame$Variable$Source('STAT', 2);\n }\n var DataFrame$Variable$Source$ORIGIN_instance;\n function DataFrame$Variable$Source$ORIGIN_getInstance() {\n DataFrame$Variable$Source_initFields();\n return DataFrame$Variable$Source$ORIGIN_instance;\n }\n var DataFrame$Variable$Source$TRANSFORM_instance;\n function DataFrame$Variable$Source$TRANSFORM_getInstance() {\n DataFrame$Variable$Source_initFields();\n return DataFrame$Variable$Source$TRANSFORM_instance;\n }\n var DataFrame$Variable$Source$STAT_instance;\n function DataFrame$Variable$Source$STAT_getInstance() {\n DataFrame$Variable$Source_initFields();\n return DataFrame$Variable$Source$STAT_instance;\n }\n DataFrame$Variable$Source.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Source',\n interfaces: [Enum]\n };\n function DataFrame$Variable$Source$values() {\n return [DataFrame$Variable$Source$ORIGIN_getInstance(), DataFrame$Variable$Source$TRANSFORM_getInstance(), DataFrame$Variable$Source$STAT_getInstance()];\n }\n DataFrame$Variable$Source.values = DataFrame$Variable$Source$values;\n function DataFrame$Variable$Source$valueOf(name) {\n switch (name) {\n case 'ORIGIN':\n return DataFrame$Variable$Source$ORIGIN_getInstance();\n case 'TRANSFORM':\n return DataFrame$Variable$Source$TRANSFORM_getInstance();\n case 'STAT':\n return DataFrame$Variable$Source$STAT_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.DataFrame.Variable.Source.' + name);\n }\n }\n DataFrame$Variable$Source.valueOf_61zpoe$ = DataFrame$Variable$Source$valueOf;\n function DataFrame$Variable$Companion() {\n DataFrame$Variable$Companion_instance = this;\n }\n DataFrame$Variable$Companion.prototype.createOriginal_puj7f4$ = function (name, label) {\n if (label === void 0)\n label = name;\n return new DataFrame$Variable(name, DataFrame$Variable$Source$ORIGIN_getInstance(), label);\n };\n DataFrame$Variable$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DataFrame$Variable$Companion_instance = null;\n function DataFrame$Variable$Companion_getInstance() {\n if (DataFrame$Variable$Companion_instance === null) {\n new DataFrame$Variable$Companion();\n }return DataFrame$Variable$Companion_instance;\n }\n DataFrame$Variable.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Variable',\n interfaces: []\n };\n function DataFrame$getOrderedDistinctValues$isValueComparable(value) {\n return value != null && (!(typeof value === 'number') || isFinite(value));\n }\n function DataFrame$getOrderedDistinctValues$lambda(it) {\n var tmp$;\n return Kotlin.isComparable(tmp$ = it.second) ? tmp$ : throwCCE();\n }\n function DataFrame$getOrderedDistinctValues$lambda_0(it) {\n var tmp$;\n return Kotlin.isComparable(tmp$ = it.first) ? tmp$ : throwCCE();\n }\n DataFrame.prototype.getOrderedDistinctValues_0 = function (orderSpec) {\n var tmp$, tmp$_0;\n var isValueComparable = DataFrame$getOrderedDistinctValues$isValueComparable;\n if (orderSpec.aggregateOperation != null) {\n if (!this.isNumeric_8xm3sj$(orderSpec.orderBy)) {\n var message = \"Can't apply aggregate operation to non-numeric values\";\n throw IllegalArgumentException_init(message.toString());\n }var $receiver = zip(this.get_8xm3sj$(orderSpec.variable), this.getNumeric_8xm3sj$(orderSpec.orderBy));\n var destination = LinkedHashMap_init();\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n var value = element.component1();\n var key = value;\n var tmp$_0_0;\n var value_0 = destination.get_11rb$(key);\n if (value_0 == null) {\n var answer = ArrayList_init();\n destination.put_xwzc9p$(key, answer);\n tmp$_0_0 = answer;\n } else {\n tmp$_0_0 = value_0;\n }\n var list = tmp$_0_0;\n var tmp$_2 = list.add_11rb$;\n var byValue = element.component2();\n tmp$_2.call(list, byValue);\n }\n var destination_0 = LinkedHashMap_init_0(mapCapacity(destination.size));\n var tmp$_3;\n tmp$_3 = destination.entries.iterator();\n while (tmp$_3.hasNext()) {\n var element_0 = tmp$_3.next();\n var tmp$_4 = destination_0.put_xwzc9p$;\n var tmp$_5 = element_0.key;\n var byValues = element_0.value;\n var tmp$_6 = orderSpec.aggregateOperation;\n var destination_1 = ArrayList_init();\n var tmp$_7;\n tmp$_7 = byValues.iterator();\n while (tmp$_7.hasNext()) {\n var element_1 = tmp$_7.next();\n if (isValueComparable(element_1))\n destination_1.add_11rb$(element_1);\n }\n tmp$_4.call(destination_0, tmp$_5, tmp$_6.call(orderSpec, destination_1));\n }\n tmp$ = toList(destination_0);\n } else {\n tmp$ = zip(this.get_8xm3sj$(orderSpec.variable), this.get_8xm3sj$(orderSpec.orderBy));\n }\n var $receiver_0 = tmp$;\n var destination_2 = ArrayList_init();\n var tmp$_8;\n tmp$_8 = $receiver_0.iterator();\n while (tmp$_8.hasNext()) {\n var element_2 = tmp$_8.next();\n if (isValueComparable(element_2.second) && isValueComparable(element_2.first))\n destination_2.add_11rb$(element_2);\n }\n var $receiver_1 = sortedWith(destination_2, compareBy([DataFrame$getOrderedDistinctValues$lambda, DataFrame$getOrderedDistinctValues$lambda_0]));\n var destination_3 = ArrayList_init();\n var tmp$_9;\n tmp$_9 = $receiver_1.iterator();\n while (tmp$_9.hasNext()) {\n var element_3 = tmp$_9.next();\n var tmp$_0_1;\n if ((tmp$_0_1 = element_3.first) != null) {\n destination_3.add_11rb$(tmp$_0_1);\n }}\n var orderedValues = destination_3;\n var $receiver_2 = zip(this.get_8xm3sj$(orderSpec.variable), this.get_8xm3sj$(orderSpec.orderBy));\n var destination_4 = ArrayList_init();\n var tmp$_10;\n tmp$_10 = $receiver_2.iterator();\n while (tmp$_10.hasNext()) {\n var element_4 = tmp$_10.next();\n if (!isValueComparable(element_4.second))\n destination_4.add_11rb$(element_4);\n }\n var destination_5 = ArrayList_init();\n var tmp$_11;\n tmp$_11 = destination_4.iterator();\n while (tmp$_11.hasNext()) {\n var element_5 = tmp$_11.next();\n var tmp$_0_2;\n if ((tmp$_0_2 = element_5.first) != null) {\n destination_5.add_11rb$(tmp$_0_2);\n }}\n var nonComparableAppendix = destination_5;\n if (orderSpec.direction < 0) {\n tmp$_0 = reversed(orderedValues);\n } else {\n tmp$_0 = orderedValues;\n }\n return toSet(plus(tmp$_0, nonComparableAppendix));\n };\n function DataFrame$Companion() {\n DataFrame$Companion_instance = this;\n this.LOG_0 = logging.PortableLogging.logger_xo1ogr$(getKClass(DataFrame));\n }\n DataFrame$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DataFrame$Companion_instance = null;\n function DataFrame$Companion_getInstance() {\n if (DataFrame$Companion_instance === null) {\n new DataFrame$Companion();\n }return DataFrame$Companion_instance;\n }\n function DataFrame$Builder() {\n DataFrame$Builder$Companion_getInstance();\n this.myVectorByVar_8be2vx$ = HashMap_init();\n this.myIsNumeric_8be2vx$ = HashMap_init();\n this.myOrderSpecs_8be2vx$ = ArrayList_init();\n }\n DataFrame$Builder.prototype.put_2l962d$ = function (variable, v) {\n this.putIntern_bxyhp4$(variable, v);\n this.myIsNumeric_8be2vx$.remove_11rb$(variable);\n return this;\n };\n DataFrame$Builder.prototype.putNumeric_s1rqo9$ = function (variable, v) {\n this.putIntern_bxyhp4$(variable, v);\n this.myIsNumeric_8be2vx$.put_xwzc9p$(variable, true);\n return this;\n };\n DataFrame$Builder.prototype.putDiscrete_2l962d$ = function (variable, v) {\n this.putIntern_bxyhp4$(variable, v);\n this.myIsNumeric_8be2vx$.put_xwzc9p$(variable, false);\n return this;\n };\n DataFrame$Builder.prototype.putIntern_bxyhp4$ = function (variable, v) {\n var $receiver = this.myVectorByVar_8be2vx$;\n var value = ArrayList_init_0(v);\n $receiver.put_xwzc9p$(variable, value);\n };\n DataFrame$Builder.prototype.remove_8xm3sj$ = function (variable) {\n this.myVectorByVar_8be2vx$.remove_11rb$(variable);\n this.myIsNumeric_8be2vx$.remove_11rb$(variable);\n return this;\n };\n DataFrame$Builder.prototype.addOrderSpecs_l2t0xf$ = function (orderSpecs) {\n var action = getCallableRef('addOrderSpec', function ($receiver, p1) {\n return $receiver.addOrderSpec_22dbp4$(p1);\n }.bind(null, this));\n var tmp$;\n tmp$ = orderSpecs.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n action(element);\n }\n return this;\n };\n DataFrame$Builder.prototype.addOrderSpec_22dbp4$ = function (orderSpec) {\n var $receiver = this.myOrderSpecs_8be2vx$;\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (equals(element.variable, orderSpec.variable)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n var currentOrderSpec = firstOrNull$result;\n if ((currentOrderSpec != null ? currentOrderSpec.aggregateOperation : null) == null) {\n var $receiver_0 = this.myOrderSpecs_8be2vx$;\n var tmp$_0;\n (Kotlin.isType(tmp$_0 = $receiver_0, MutableCollection) ? tmp$_0 : throwCCE()).remove_11rb$(currentOrderSpec);\n this.myOrderSpecs_8be2vx$.add_11rb$(orderSpec);\n }return this;\n };\n DataFrame$Builder.prototype.build = function () {\n return new DataFrame(this);\n };\n function DataFrame$Builder$Companion() {\n DataFrame$Builder$Companion_instance = this;\n }\n DataFrame$Builder$Companion.prototype.emptyFrame = function () {\n return DataFrame$DataFrame$Builder_init().build();\n };\n DataFrame$Builder$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DataFrame$Builder$Companion_instance = null;\n function DataFrame$Builder$Companion_getInstance() {\n if (DataFrame$Builder$Companion_instance === null) {\n new DataFrame$Builder$Companion();\n }return DataFrame$Builder$Companion_instance;\n }\n DataFrame$Builder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Builder',\n interfaces: []\n };\n function DataFrame$DataFrame$Builder_init($this) {\n $this = $this || Object.create(DataFrame$Builder.prototype);\n DataFrame$Builder.call($this);\n return $this;\n }\n function DataFrame$DataFrame$Builder_init_0(data, $this) {\n $this = $this || Object.create(DataFrame$Builder.prototype);\n DataFrame$Builder.call($this);\n $this.myVectorByVar_8be2vx$.putAll_a2k3zr$(data.myVectorByVar_0);\n $this.myIsNumeric_8be2vx$.putAll_a2k3zr$(data.myIsNumeric_0);\n $this.myOrderSpecs_8be2vx$.addAll_brywnq$(data.myOrderSpecs_0);\n return $this;\n }\n DataFrame.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataFrame',\n interfaces: []\n };\n function DataPointAesthetics() {\n }\n DataPointAesthetics.prototype.defined_896ixz$ = function (aes) {\n var tmp$;\n if (aes.isNumeric) {\n var number = this.get_31786j$(aes);\n return number != null && isFinite(typeof (tmp$ = number) === 'number' ? tmp$ : throwCCE());\n }return true;\n };\n DataPointAesthetics.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'DataPointAesthetics',\n interfaces: []\n };\n function DiscreteTransform(domainValues, domainLimits) {\n this.domainValues = domainValues;\n this.domainLimits = domainLimits;\n this.numberByDomainValue_0 = LinkedHashMap_init();\n this.domainValueByNumber_0 = new TreeMap();\n var tmp$, tmp$_0;\n if (this.domainLimits.isEmpty()) {\n tmp$ = this.domainValues;\n } else {\n tmp$ = intersect(this.domainLimits, this.domainValues);\n }\n var effectiveDomain = tmp$;\n this.numberByDomainValue_0.putAll_a2k3zr$(MapperUtil_getInstance().mapDiscreteDomainValuesToNumbers_7f6uoc$(effectiveDomain));\n tmp$_0 = this.numberByDomainValue_0.entries.iterator();\n while (tmp$_0.hasNext()) {\n var tmp$_1 = tmp$_0.next();\n var domainValue = tmp$_1.key;\n var number = tmp$_1.value;\n this.domainValueByNumber_0.put_ncwa5f$(number, domainValue);\n }\n }\n DiscreteTransform.prototype.hasDomainLimits = function () {\n return !this.domainLimits.isEmpty();\n };\n DiscreteTransform.prototype.isInDomain_s8jyv4$ = function (v) {\n var $receiver = this.numberByDomainValue_0;\n var tmp$;\n return (Kotlin.isType(tmp$ = $receiver, Map) ? tmp$ : throwCCE()).containsKey_11rb$(v);\n };\n DiscreteTransform.prototype.apply_9ma18$ = function (l) {\n var destination = ArrayList_init_1(collectionSizeOrDefault(l, 10));\n var tmp$;\n tmp$ = l.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(this.asNumber_0(item));\n }\n return destination;\n };\n DiscreteTransform.prototype.applyInverse_yrwdxb$ = function (v) {\n return this.fromNumber_0(v);\n };\n DiscreteTransform.prototype.asNumber_0 = function (input) {\n if (input == null) {\n return null;\n }if (this.numberByDomainValue_0.containsKey_11rb$(input)) {\n return this.numberByDomainValue_0.get_11rb$(input);\n }throw IllegalStateException_init('value ' + toString(input) + ' is not in the domain: ' + this.numberByDomainValue_0.keys);\n };\n DiscreteTransform.prototype.fromNumber_0 = function (v) {\n var tmp$;\n if (v == null) {\n return null;\n }if (this.domainValueByNumber_0.containsKey_mef7kx$(v)) {\n return this.domainValueByNumber_0.get_mef7kx$(v);\n }var ceilingKey = this.domainValueByNumber_0.ceilingKey_mef7kx$(v);\n var floorKey = this.domainValueByNumber_0.floorKey_mef7kx$(v);\n var keyNumber = null;\n if (ceilingKey != null || floorKey != null) {\n if (ceilingKey == null)\n tmp$ = floorKey;\n else if (floorKey == null)\n tmp$ = ceilingKey;\n else {\n var x = ceilingKey - v;\n var ceilingDist = JsMath.abs(x);\n var x_0 = floorKey - v;\n var floorDist = JsMath.abs(x_0);\n tmp$ = ceilingDist < floorDist ? ceilingKey : floorKey;\n }\n keyNumber = tmp$;\n }return keyNumber != null ? this.domainValueByNumber_0.get_mef7kx$(keyNumber) : null;\n };\n DiscreteTransform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DiscreteTransform',\n interfaces: [Transform]\n };\n function Geom() {\n }\n Geom.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Geom',\n interfaces: []\n };\n function GeomContext() {\n }\n GeomContext.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GeomContext',\n interfaces: []\n };\n function GeomKind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function GeomKind_initFields() {\n GeomKind_initFields = function () {\n };\n GeomKind$PATH_instance = new GeomKind('PATH', 0);\n GeomKind$LINE_instance = new GeomKind('LINE', 1);\n GeomKind$SMOOTH_instance = new GeomKind('SMOOTH', 2);\n GeomKind$BAR_instance = new GeomKind('BAR', 3);\n GeomKind$HISTOGRAM_instance = new GeomKind('HISTOGRAM', 4);\n GeomKind$TILE_instance = new GeomKind('TILE', 5);\n GeomKind$BIN_2D_instance = new GeomKind('BIN_2D', 6);\n GeomKind$MAP_instance = new GeomKind('MAP', 7);\n GeomKind$ERROR_BAR_instance = new GeomKind('ERROR_BAR', 8);\n GeomKind$CROSS_BAR_instance = new GeomKind('CROSS_BAR', 9);\n GeomKind$LINE_RANGE_instance = new GeomKind('LINE_RANGE', 10);\n GeomKind$POINT_RANGE_instance = new GeomKind('POINT_RANGE', 11);\n GeomKind$POLYGON_instance = new GeomKind('POLYGON', 12);\n GeomKind$AB_LINE_instance = new GeomKind('AB_LINE', 13);\n GeomKind$H_LINE_instance = new GeomKind('H_LINE', 14);\n GeomKind$V_LINE_instance = new GeomKind('V_LINE', 15);\n GeomKind$BOX_PLOT_instance = new GeomKind('BOX_PLOT', 16);\n GeomKind$LIVE_MAP_instance = new GeomKind('LIVE_MAP', 17);\n GeomKind$POINT_instance = new GeomKind('POINT', 18);\n GeomKind$RIBBON_instance = new GeomKind('RIBBON', 19);\n GeomKind$AREA_instance = new GeomKind('AREA', 20);\n GeomKind$DENSITY_instance = new GeomKind('DENSITY', 21);\n GeomKind$CONTOUR_instance = new GeomKind('CONTOUR', 22);\n GeomKind$CONTOURF_instance = new GeomKind('CONTOURF', 23);\n GeomKind$DENSITY2D_instance = new GeomKind('DENSITY2D', 24);\n GeomKind$DENSITY2DF_instance = new GeomKind('DENSITY2DF', 25);\n GeomKind$JITTER_instance = new GeomKind('JITTER', 26);\n GeomKind$FREQPOLY_instance = new GeomKind('FREQPOLY', 27);\n GeomKind$STEP_instance = new GeomKind('STEP', 28);\n GeomKind$RECT_instance = new GeomKind('RECT', 29);\n GeomKind$SEGMENT_instance = new GeomKind('SEGMENT', 30);\n GeomKind$TEXT_instance = new GeomKind('TEXT', 31);\n GeomKind$RASTER_instance = new GeomKind('RASTER', 32);\n GeomKind$IMAGE_instance = new GeomKind('IMAGE', 33);\n }\n var GeomKind$PATH_instance;\n function GeomKind$PATH_getInstance() {\n GeomKind_initFields();\n return GeomKind$PATH_instance;\n }\n var GeomKind$LINE_instance;\n function GeomKind$LINE_getInstance() {\n GeomKind_initFields();\n return GeomKind$LINE_instance;\n }\n var GeomKind$SMOOTH_instance;\n function GeomKind$SMOOTH_getInstance() {\n GeomKind_initFields();\n return GeomKind$SMOOTH_instance;\n }\n var GeomKind$BAR_instance;\n function GeomKind$BAR_getInstance() {\n GeomKind_initFields();\n return GeomKind$BAR_instance;\n }\n var GeomKind$HISTOGRAM_instance;\n function GeomKind$HISTOGRAM_getInstance() {\n GeomKind_initFields();\n return GeomKind$HISTOGRAM_instance;\n }\n var GeomKind$TILE_instance;\n function GeomKind$TILE_getInstance() {\n GeomKind_initFields();\n return GeomKind$TILE_instance;\n }\n var GeomKind$BIN_2D_instance;\n function GeomKind$BIN_2D_getInstance() {\n GeomKind_initFields();\n return GeomKind$BIN_2D_instance;\n }\n var GeomKind$MAP_instance;\n function GeomKind$MAP_getInstance() {\n GeomKind_initFields();\n return GeomKind$MAP_instance;\n }\n var GeomKind$ERROR_BAR_instance;\n function GeomKind$ERROR_BAR_getInstance() {\n GeomKind_initFields();\n return GeomKind$ERROR_BAR_instance;\n }\n var GeomKind$CROSS_BAR_instance;\n function GeomKind$CROSS_BAR_getInstance() {\n GeomKind_initFields();\n return GeomKind$CROSS_BAR_instance;\n }\n var GeomKind$LINE_RANGE_instance;\n function GeomKind$LINE_RANGE_getInstance() {\n GeomKind_initFields();\n return GeomKind$LINE_RANGE_instance;\n }\n var GeomKind$POINT_RANGE_instance;\n function GeomKind$POINT_RANGE_getInstance() {\n GeomKind_initFields();\n return GeomKind$POINT_RANGE_instance;\n }\n var GeomKind$POLYGON_instance;\n function GeomKind$POLYGON_getInstance() {\n GeomKind_initFields();\n return GeomKind$POLYGON_instance;\n }\n var GeomKind$AB_LINE_instance;\n function GeomKind$AB_LINE_getInstance() {\n GeomKind_initFields();\n return GeomKind$AB_LINE_instance;\n }\n var GeomKind$H_LINE_instance;\n function GeomKind$H_LINE_getInstance() {\n GeomKind_initFields();\n return GeomKind$H_LINE_instance;\n }\n var GeomKind$V_LINE_instance;\n function GeomKind$V_LINE_getInstance() {\n GeomKind_initFields();\n return GeomKind$V_LINE_instance;\n }\n var GeomKind$BOX_PLOT_instance;\n function GeomKind$BOX_PLOT_getInstance() {\n GeomKind_initFields();\n return GeomKind$BOX_PLOT_instance;\n }\n var GeomKind$LIVE_MAP_instance;\n function GeomKind$LIVE_MAP_getInstance() {\n GeomKind_initFields();\n return GeomKind$LIVE_MAP_instance;\n }\n var GeomKind$POINT_instance;\n function GeomKind$POINT_getInstance() {\n GeomKind_initFields();\n return GeomKind$POINT_instance;\n }\n var GeomKind$RIBBON_instance;\n function GeomKind$RIBBON_getInstance() {\n GeomKind_initFields();\n return GeomKind$RIBBON_instance;\n }\n var GeomKind$AREA_instance;\n function GeomKind$AREA_getInstance() {\n GeomKind_initFields();\n return GeomKind$AREA_instance;\n }\n var GeomKind$DENSITY_instance;\n function GeomKind$DENSITY_getInstance() {\n GeomKind_initFields();\n return GeomKind$DENSITY_instance;\n }\n var GeomKind$CONTOUR_instance;\n function GeomKind$CONTOUR_getInstance() {\n GeomKind_initFields();\n return GeomKind$CONTOUR_instance;\n }\n var GeomKind$CONTOURF_instance;\n function GeomKind$CONTOURF_getInstance() {\n GeomKind_initFields();\n return GeomKind$CONTOURF_instance;\n }\n var GeomKind$DENSITY2D_instance;\n function GeomKind$DENSITY2D_getInstance() {\n GeomKind_initFields();\n return GeomKind$DENSITY2D_instance;\n }\n var GeomKind$DENSITY2DF_instance;\n function GeomKind$DENSITY2DF_getInstance() {\n GeomKind_initFields();\n return GeomKind$DENSITY2DF_instance;\n }\n var GeomKind$JITTER_instance;\n function GeomKind$JITTER_getInstance() {\n GeomKind_initFields();\n return GeomKind$JITTER_instance;\n }\n var GeomKind$FREQPOLY_instance;\n function GeomKind$FREQPOLY_getInstance() {\n GeomKind_initFields();\n return GeomKind$FREQPOLY_instance;\n }\n var GeomKind$STEP_instance;\n function GeomKind$STEP_getInstance() {\n GeomKind_initFields();\n return GeomKind$STEP_instance;\n }\n var GeomKind$RECT_instance;\n function GeomKind$RECT_getInstance() {\n GeomKind_initFields();\n return GeomKind$RECT_instance;\n }\n var GeomKind$SEGMENT_instance;\n function GeomKind$SEGMENT_getInstance() {\n GeomKind_initFields();\n return GeomKind$SEGMENT_instance;\n }\n var GeomKind$TEXT_instance;\n function GeomKind$TEXT_getInstance() {\n GeomKind_initFields();\n return GeomKind$TEXT_instance;\n }\n var GeomKind$RASTER_instance;\n function GeomKind$RASTER_getInstance() {\n GeomKind_initFields();\n return GeomKind$RASTER_instance;\n }\n var GeomKind$IMAGE_instance;\n function GeomKind$IMAGE_getInstance() {\n GeomKind_initFields();\n return GeomKind$IMAGE_instance;\n }\n GeomKind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomKind',\n interfaces: [Enum]\n };\n function GeomKind$values() {\n return [GeomKind$PATH_getInstance(), GeomKind$LINE_getInstance(), GeomKind$SMOOTH_getInstance(), GeomKind$BAR_getInstance(), GeomKind$HISTOGRAM_getInstance(), GeomKind$TILE_getInstance(), GeomKind$BIN_2D_getInstance(), GeomKind$MAP_getInstance(), GeomKind$ERROR_BAR_getInstance(), GeomKind$CROSS_BAR_getInstance(), GeomKind$LINE_RANGE_getInstance(), GeomKind$POINT_RANGE_getInstance(), GeomKind$POLYGON_getInstance(), GeomKind$AB_LINE_getInstance(), GeomKind$H_LINE_getInstance(), GeomKind$V_LINE_getInstance(), GeomKind$BOX_PLOT_getInstance(), GeomKind$LIVE_MAP_getInstance(), GeomKind$POINT_getInstance(), GeomKind$RIBBON_getInstance(), GeomKind$AREA_getInstance(), GeomKind$DENSITY_getInstance(), GeomKind$CONTOUR_getInstance(), GeomKind$CONTOURF_getInstance(), GeomKind$DENSITY2D_getInstance(), GeomKind$DENSITY2DF_getInstance(), GeomKind$JITTER_getInstance(), GeomKind$FREQPOLY_getInstance(), GeomKind$STEP_getInstance(), GeomKind$RECT_getInstance(), GeomKind$SEGMENT_getInstance(), GeomKind$TEXT_getInstance(), GeomKind$RASTER_getInstance(), GeomKind$IMAGE_getInstance()];\n }\n GeomKind.values = GeomKind$values;\n function GeomKind$valueOf(name) {\n switch (name) {\n case 'PATH':\n return GeomKind$PATH_getInstance();\n case 'LINE':\n return GeomKind$LINE_getInstance();\n case 'SMOOTH':\n return GeomKind$SMOOTH_getInstance();\n case 'BAR':\n return GeomKind$BAR_getInstance();\n case 'HISTOGRAM':\n return GeomKind$HISTOGRAM_getInstance();\n case 'TILE':\n return GeomKind$TILE_getInstance();\n case 'BIN_2D':\n return GeomKind$BIN_2D_getInstance();\n case 'MAP':\n return GeomKind$MAP_getInstance();\n case 'ERROR_BAR':\n return GeomKind$ERROR_BAR_getInstance();\n case 'CROSS_BAR':\n return GeomKind$CROSS_BAR_getInstance();\n case 'LINE_RANGE':\n return GeomKind$LINE_RANGE_getInstance();\n case 'POINT_RANGE':\n return GeomKind$POINT_RANGE_getInstance();\n case 'POLYGON':\n return GeomKind$POLYGON_getInstance();\n case 'AB_LINE':\n return GeomKind$AB_LINE_getInstance();\n case 'H_LINE':\n return GeomKind$H_LINE_getInstance();\n case 'V_LINE':\n return GeomKind$V_LINE_getInstance();\n case 'BOX_PLOT':\n return GeomKind$BOX_PLOT_getInstance();\n case 'LIVE_MAP':\n return GeomKind$LIVE_MAP_getInstance();\n case 'POINT':\n return GeomKind$POINT_getInstance();\n case 'RIBBON':\n return GeomKind$RIBBON_getInstance();\n case 'AREA':\n return GeomKind$AREA_getInstance();\n case 'DENSITY':\n return GeomKind$DENSITY_getInstance();\n case 'CONTOUR':\n return GeomKind$CONTOUR_getInstance();\n case 'CONTOURF':\n return GeomKind$CONTOURF_getInstance();\n case 'DENSITY2D':\n return GeomKind$DENSITY2D_getInstance();\n case 'DENSITY2DF':\n return GeomKind$DENSITY2DF_getInstance();\n case 'JITTER':\n return GeomKind$JITTER_getInstance();\n case 'FREQPOLY':\n return GeomKind$FREQPOLY_getInstance();\n case 'STEP':\n return GeomKind$STEP_getInstance();\n case 'RECT':\n return GeomKind$RECT_getInstance();\n case 'SEGMENT':\n return GeomKind$SEGMENT_getInstance();\n case 'TEXT':\n return GeomKind$TEXT_getInstance();\n case 'RASTER':\n return GeomKind$RASTER_getInstance();\n case 'IMAGE':\n return GeomKind$IMAGE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.GeomKind.' + name);\n }\n }\n GeomKind.valueOf_61zpoe$ = GeomKind$valueOf;\n function GeomMeta() {\n GeomMeta_instance = this;\n this.renderedAesByGeom_0 = HashMap_init();\n this.POINT_0 = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().SHAPE]);\n this.PATH_0 = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().SPEED, Aes$Companion_getInstance().FLOW]);\n this.POLYGON_0 = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n this.AREA_0 = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n }\n GeomMeta.prototype.renders_7dhqpi$ = function (geomKind) {\n if (!this.renderedAesByGeom_0.containsKey_11rb$(geomKind)) {\n var $receiver = this.renderedAesByGeom_0;\n var value = this.renderedAesList_0(geomKind);\n $receiver.put_xwzc9p$(geomKind, value);\n }return ensureNotNull(this.renderedAesByGeom_0.get_11rb$(geomKind));\n };\n GeomMeta.prototype.renderedAesList_0 = function (geomKind) {\n var tmp$;\n switch (geomKind.name) {\n case 'POINT':\n tmp$ = this.POINT_0;\n break;\n case 'PATH':\n tmp$ = this.PATH_0;\n break;\n case 'LINE':\n tmp$ = this.PATH_0;\n break;\n case 'SMOOTH':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'BAR':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().SIZE]);\n break;\n case 'HISTOGRAM':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().SIZE]);\n break;\n case 'TILE':\n case 'BIN_2D':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().HEIGHT, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SIZE]);\n break;\n case 'ERROR_BAR':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SIZE]);\n break;\n case 'CROSS_BAR':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().MIDDLE, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SHAPE, Aes$Companion_getInstance().SIZE]);\n break;\n case 'LINE_RANGE':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SIZE]);\n break;\n case 'POINT_RANGE':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SHAPE, Aes$Companion_getInstance().SIZE]);\n break;\n case 'CONTOUR':\n tmp$ = this.PATH_0;\n break;\n case 'CONTOURF':\n tmp$ = this.POLYGON_0;\n break;\n case 'POLYGON':\n tmp$ = this.POLYGON_0;\n break;\n case 'MAP':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'AB_LINE':\n tmp$ = listOf([Aes$Companion_getInstance().INTERCEPT, Aes$Companion_getInstance().SLOPE, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'H_LINE':\n tmp$ = listOf([Aes$Companion_getInstance().YINTERCEPT, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'V_LINE':\n tmp$ = listOf([Aes$Companion_getInstance().XINTERCEPT, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'BOX_PLOT':\n tmp$ = listOf([Aes$Companion_getInstance().LOWER, Aes$Companion_getInstance().MIDDLE, Aes$Companion_getInstance().UPPER, Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SHAPE, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().WIDTH]);\n break;\n case 'RIBBON':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'AREA':\n tmp$ = this.AREA_0;\n break;\n case 'DENSITY':\n tmp$ = this.AREA_0;\n break;\n case 'DENSITY2D':\n tmp$ = this.PATH_0;\n break;\n case 'DENSITY2DF':\n tmp$ = this.POLYGON_0;\n break;\n case 'JITTER':\n tmp$ = this.POINT_0;\n break;\n case 'FREQPOLY':\n tmp$ = this.PATH_0;\n break;\n case 'STEP':\n tmp$ = this.PATH_0;\n break;\n case 'RECT':\n tmp$ = listOf([Aes$Companion_getInstance().XMIN, Aes$Companion_getInstance().XMAX, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'SEGMENT':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().XEND, Aes$Companion_getInstance().YEND, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().SPEED, Aes$Companion_getInstance().FLOW]);\n break;\n case 'TEXT':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().LABEL, Aes$Companion_getInstance().FAMILY, Aes$Companion_getInstance().FONTFACE, Aes$Companion_getInstance().HJUST, Aes$Companion_getInstance().VJUST, Aes$Companion_getInstance().ANGLE]);\n break;\n case 'LIVE_MAP':\n tmp$ = listOf([Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().SHAPE, Aes$Companion_getInstance().FRAME, Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SYM_X, Aes$Companion_getInstance().SYM_Y]);\n break;\n case 'RASTER':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().HEIGHT, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'IMAGE':\n tmp$ = listOf([Aes$Companion_getInstance().XMIN, Aes$Companion_getInstance().XMAX, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX]);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n GeomMeta.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GeomMeta',\n interfaces: []\n };\n var GeomMeta_instance = null;\n function GeomMeta_getInstance() {\n if (GeomMeta_instance === null) {\n new GeomMeta();\n }return GeomMeta_instance;\n }\n function PositionAdjustment() {\n }\n Object.defineProperty(PositionAdjustment.prototype, 'isIdentity', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n PositionAdjustment.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PositionAdjustment',\n interfaces: []\n };\n function Scale() {\n }\n function Scale$Builder() {\n }\n Scale$Builder.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Builder',\n interfaces: []\n };\n Scale.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Scale',\n interfaces: []\n };\n function Stat() {\n }\n function Stat$apply$lambda(it) {\n return Unit;\n }\n Stat.prototype.apply_kdy6bf$ = function (data, statCtx, messageConsumer, callback$default) {\n if (messageConsumer === void 0)\n messageConsumer = Stat$apply$lambda;\n return callback$default ? callback$default(data, statCtx, messageConsumer) : this.apply_kdy6bf$$default(data, statCtx, messageConsumer);\n };\n Stat.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Stat',\n interfaces: []\n };\n function StatContext() {\n }\n StatContext.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'StatContext',\n interfaces: []\n };\n function Transform() {\n }\n Transform.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Transform',\n interfaces: []\n };\n function AesInitValue() {\n AesInitValue_instance = this;\n this.VALUE_MAP_0 = new TypedKeyHashMap();\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().X, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().Y, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().Z, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().YMIN, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().YMAX, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().COLOR, Color.Companion.PACIFIC_BLUE);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().FILL, Color.Companion.PACIFIC_BLUE);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().ALPHA, 1.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SHAPE, NamedShape$SOLID_CIRCLE_getInstance());\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().LINETYPE, NamedLineType$SOLID_getInstance());\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SIZE, 0.5);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().WIDTH, 1.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().HEIGHT, 1.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().WEIGHT, 1.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().INTERCEPT, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SLOPE, 1.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().XINTERCEPT, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().YINTERCEPT, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().LOWER, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().MIDDLE, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().UPPER, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().FRAME, 'empty frame');\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SPEED, 10.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().FLOW, 0.1);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().XMIN, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().XMAX, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().XEND, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().YEND, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().LABEL, '');\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().FAMILY, 'sans-serif');\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().FONTFACE, 'plain');\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().HJUST, 0.5);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().VJUST, 0.5);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().ANGLE, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SYM_X, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SYM_Y, 0.0);\n }\n AesInitValue.prototype.has_896ixz$ = function (aes) {\n return this.VALUE_MAP_0.containsKey_ex36zt$(aes);\n };\n AesInitValue.prototype.get_31786j$ = function (aes) {\n return this.VALUE_MAP_0.get_ex36zt$(aes);\n };\n AesInitValue.prototype.get_ex36zt$ = function (aes) {\n return this.VALUE_MAP_0.get_ex36zt$(aes);\n };\n AesInitValue.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'AesInitValue',\n interfaces: []\n };\n var AesInitValue_instance = null;\n function AesInitValue_getInstance() {\n if (AesInitValue_instance === null) {\n new AesInitValue();\n }return AesInitValue_instance;\n }\n function AesScaling() {\n AesScaling_instance = this;\n this.UNIT_SHAPE_SIZE = 2.2;\n }\n AesScaling.prototype.strokeWidth_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * 2.0;\n };\n AesScaling.prototype.circleDiameter_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * this.UNIT_SHAPE_SIZE;\n };\n AesScaling.prototype.circleDiameterSmaller_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * 1.5;\n };\n AesScaling.prototype.sizeFromCircleDiameter_14dthe$ = function (diameter) {\n return diameter / this.UNIT_SHAPE_SIZE;\n };\n AesScaling.prototype.textSize_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * 2;\n };\n AesScaling.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'AesScaling',\n interfaces: []\n };\n var AesScaling_instance = null;\n function AesScaling_getInstance() {\n if (AesScaling_instance === null) {\n new AesScaling();\n }return AesScaling_instance;\n }\n function AesVisitor() {\n }\n AesVisitor.prototype.visit_896ixz$ = function (aes) {\n var tmp$, tmp$_0;\n if (aes.isNumeric) {\n tmp$_0 = this.visitNumeric_vktour$(Kotlin.isType(tmp$ = aes, Aes) ? tmp$ : throwCCE());\n } else\n tmp$_0 = this.visitIntern_rp5ogw$_0(aes);\n return tmp$_0;\n };\n AesVisitor.prototype.visitNumeric_vktour$ = function (aes) {\n return this.visitIntern_rp5ogw$_0(aes);\n };\n AesVisitor.prototype.visitIntern_rp5ogw$_0 = function (aes) {\n if (equals(aes, Aes$Companion_getInstance().X)) {\n return this.x();\n }if (equals(aes, Aes$Companion_getInstance().Y)) {\n return this.y();\n }if (equals(aes, Aes$Companion_getInstance().Z)) {\n return this.z();\n }if (equals(aes, Aes$Companion_getInstance().YMIN)) {\n return this.ymin();\n }if (equals(aes, Aes$Companion_getInstance().YMAX)) {\n return this.ymax();\n }if (equals(aes, Aes$Companion_getInstance().COLOR)) {\n return this.color();\n }if (equals(aes, Aes$Companion_getInstance().FILL)) {\n return this.fill();\n }if (equals(aes, Aes$Companion_getInstance().ALPHA)) {\n return this.alpha();\n }if (equals(aes, Aes$Companion_getInstance().SHAPE)) {\n return this.shape();\n }if (equals(aes, Aes$Companion_getInstance().SIZE)) {\n return this.size();\n }if (equals(aes, Aes$Companion_getInstance().LINETYPE)) {\n return this.lineType();\n }if (equals(aes, Aes$Companion_getInstance().WIDTH)) {\n return this.width();\n }if (equals(aes, Aes$Companion_getInstance().HEIGHT)) {\n return this.height();\n }if (equals(aes, Aes$Companion_getInstance().WEIGHT)) {\n return this.weight();\n }if (equals(aes, Aes$Companion_getInstance().INTERCEPT)) {\n return this.intercept();\n }if (equals(aes, Aes$Companion_getInstance().SLOPE)) {\n return this.slope();\n }if (equals(aes, Aes$Companion_getInstance().XINTERCEPT)) {\n return this.interceptX();\n }if (equals(aes, Aes$Companion_getInstance().YINTERCEPT)) {\n return this.interceptY();\n }if (equals(aes, Aes$Companion_getInstance().LOWER)) {\n return this.lower();\n }if (equals(aes, Aes$Companion_getInstance().MIDDLE)) {\n return this.middle();\n }if (equals(aes, Aes$Companion_getInstance().UPPER)) {\n return this.upper();\n }if (equals(aes, Aes$Companion_getInstance().FRAME)) {\n return this.frame();\n }if (equals(aes, Aes$Companion_getInstance().SPEED)) {\n return this.speed();\n }if (equals(aes, Aes$Companion_getInstance().FLOW)) {\n return this.flow();\n }if (equals(aes, Aes$Companion_getInstance().XMIN)) {\n return this.xmin();\n }if (equals(aes, Aes$Companion_getInstance().XMAX)) {\n return this.xmax();\n }if (equals(aes, Aes$Companion_getInstance().XEND)) {\n return this.xend();\n }if (equals(aes, Aes$Companion_getInstance().YEND)) {\n return this.yend();\n }if (equals(aes, Aes$Companion_getInstance().LABEL)) {\n return this.label();\n }if (equals(aes, Aes$Companion_getInstance().FAMILY)) {\n return this.family();\n }if (equals(aes, Aes$Companion_getInstance().FONTFACE)) {\n return this.fontface();\n }if (equals(aes, Aes$Companion_getInstance().HJUST)) {\n return this.hjust();\n }if (equals(aes, Aes$Companion_getInstance().VJUST)) {\n return this.vjust();\n }if (equals(aes, Aes$Companion_getInstance().ANGLE)) {\n return this.angle();\n }if (equals(aes, Aes$Companion_getInstance().SYM_X)) {\n return this.symX();\n }if (equals(aes, Aes$Companion_getInstance().SYM_Y)) {\n return this.symY();\n }throw IllegalArgumentException_init('Unexpected aes: ' + aes);\n };\n AesVisitor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AesVisitor',\n interfaces: []\n };\n function AestheticsBuilder(myDataPointCount) {\n AestheticsBuilder$Companion_getInstance();\n if (myDataPointCount === void 0)\n myDataPointCount = 0;\n this.myDataPointCount_0 = myDataPointCount;\n this.myIndexFunctionMap_0 = null;\n this.myGroup_0 = AestheticsBuilder$Companion_getInstance().constant_mh5how$(0);\n this.myConstantAes_0 = collect.Sets.newHashSet_yl67zr$(Aes$Companion_getInstance().values());\n this.myOverallRangeByNumericAes_0 = HashMap_init();\n var tmp$;\n this.myIndexFunctionMap_0 = HashMap_init();\n tmp$ = Aes$Companion_getInstance().values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n var $receiver = this.myIndexFunctionMap_0;\n var value = AestheticsBuilder$Companion_getInstance().constant_mh5how$(AesInitValue_getInstance().get_31786j$(aes));\n $receiver.put_xwzc9p$(aes, value);\n }\n }\n AestheticsBuilder.prototype.dataPointCount_za3lpa$ = function (v) {\n this.myDataPointCount_0 = v;\n return this;\n };\n AestheticsBuilder.prototype.overallRange_xlyz3f$ = function (aes, range) {\n this.myOverallRangeByNumericAes_0.put_xwzc9p$(aes, range);\n return this;\n };\n AestheticsBuilder.prototype.x_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().X, v);\n };\n AestheticsBuilder.prototype.y_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().Y, v);\n };\n AestheticsBuilder.prototype.color_u2gvuj$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().COLOR, v);\n };\n AestheticsBuilder.prototype.fill_u2gvuj$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().FILL, v);\n };\n AestheticsBuilder.prototype.alpha_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().ALPHA, v);\n };\n AestheticsBuilder.prototype.shape_9kzkiq$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().SHAPE, v);\n };\n AestheticsBuilder.prototype.lineType_vv264d$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().LINETYPE, v);\n };\n AestheticsBuilder.prototype.size_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().SIZE, v);\n };\n AestheticsBuilder.prototype.width_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().WIDTH, v);\n };\n AestheticsBuilder.prototype.weight_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().WEIGHT, v);\n };\n AestheticsBuilder.prototype.frame_cfki2p$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().FRAME, v);\n };\n AestheticsBuilder.prototype.speed_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().SPEED, v);\n };\n AestheticsBuilder.prototype.flow_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().FLOW, v);\n };\n AestheticsBuilder.prototype.group_ddsh32$ = function (v) {\n this.myGroup_0 = v;\n return this;\n };\n AestheticsBuilder.prototype.label_bfjv6s$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().LABEL, v);\n };\n AestheticsBuilder.prototype.family_cfki2p$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().FAMILY, v);\n };\n AestheticsBuilder.prototype.fontface_cfki2p$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().FONTFACE, v);\n };\n AestheticsBuilder.prototype.hjust_bfjv6s$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().HJUST, v);\n };\n AestheticsBuilder.prototype.vjust_bfjv6s$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().VJUST, v);\n };\n AestheticsBuilder.prototype.angle_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().ANGLE, v);\n };\n AestheticsBuilder.prototype.xmin_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().XMIN, v);\n };\n AestheticsBuilder.prototype.xmax_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().XMAX, v);\n };\n AestheticsBuilder.prototype.ymin_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().YMIN, v);\n };\n AestheticsBuilder.prototype.ymax_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().YMAX, v);\n };\n AestheticsBuilder.prototype.symX_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().SYM_X, v);\n };\n AestheticsBuilder.prototype.symY_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().SYM_Y, v);\n };\n AestheticsBuilder.prototype.constantAes_bbdhip$ = function (aes, v) {\n this.myConstantAes_0.add_11rb$(aes);\n var $receiver = this.myIndexFunctionMap_0;\n var value = AestheticsBuilder$Companion_getInstance().constant_mh5how$(v);\n $receiver.put_xwzc9p$(aes, value);\n return this;\n };\n AestheticsBuilder.prototype.aes_u42xfl$ = function (aes, v) {\n this.myConstantAes_0.remove_11rb$(aes);\n this.myIndexFunctionMap_0.put_xwzc9p$(aes, v);\n return this;\n };\n AestheticsBuilder.prototype.build = function () {\n return new AestheticsBuilder$MyAesthetics(this);\n };\n function AestheticsBuilder$MyAesthetics(b) {\n this.myDataPointCount_0 = b.myDataPointCount_0;\n this.myIndexFunctionMap_0 = new TypedIndexFunctionMap(b.myIndexFunctionMap_0);\n this.group = b.myGroup_0;\n this.myConstantAes_0 = null;\n this.myOverallRangeByNumericAes_0 = null;\n this.myResolutionByAes_0 = HashMap_init();\n this.myRangeByNumericAes_0 = HashMap_init();\n this.myConstantAes_0 = HashSet_init(b.myConstantAes_0);\n this.myOverallRangeByNumericAes_0 = HashMap_init_0(b.myOverallRangeByNumericAes_0);\n }\n Object.defineProperty(AestheticsBuilder$MyAesthetics.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myDataPointCount_0 === 0;\n }\n });\n AestheticsBuilder$MyAesthetics.prototype.aes_31786j$ = function (aes) {\n return this.myIndexFunctionMap_0.get_31786j$(aes);\n };\n AestheticsBuilder$MyAesthetics.prototype.dataPointAt_za3lpa$ = function (index) {\n return new AestheticsBuilder$MyDataPointAesthetics(index, this);\n };\n AestheticsBuilder$MyAesthetics.prototype.dataPointCount = function () {\n return this.myDataPointCount_0;\n };\n function AestheticsBuilder$MyAesthetics$dataPoints$ObjectLiteral(this$MyAesthetics, closure$self) {\n this.this$MyAesthetics = this$MyAesthetics;\n this.closure$self = closure$self;\n }\n AestheticsBuilder$MyAesthetics$dataPoints$ObjectLiteral.prototype.iterator = function () {\n return new AestheticsBuilder$MyDataPointsIterator(this.this$MyAesthetics.myDataPointCount_0, this.closure$self);\n };\n AestheticsBuilder$MyAesthetics$dataPoints$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Iterable]\n };\n AestheticsBuilder$MyAesthetics.prototype.dataPoints = function () {\n var self_0 = this;\n return new AestheticsBuilder$MyAesthetics$dataPoints$ObjectLiteral(this, self_0);\n };\n AestheticsBuilder$MyAesthetics.prototype.range_vktour$ = function (aes) {\n var tmp$;\n if (!this.myRangeByNumericAes_0.containsKey_11rb$(aes)) {\n if (this.myDataPointCount_0 <= 0)\n tmp$ = new ClosedRange(0.0, 0.0);\n else if (this.myConstantAes_0.contains_11rb$(aes)) {\n var v = ensureNotNull(this.numericValues_vktour$(aes).iterator().next());\n if (isFinite(v)) {\n tmp$ = new ClosedRange(v, v);\n } else\n tmp$ = null;\n } else {\n var values = this.numericValues_vktour$(aes);\n tmp$ = data.SeriesUtil.range_l63ks6$(values);\n }\n var r = tmp$;\n this.myRangeByNumericAes_0.put_xwzc9p$(aes, r);\n }return this.myRangeByNumericAes_0.get_11rb$(aes);\n };\n AestheticsBuilder$MyAesthetics.prototype.overallRange_vktour$ = function (aes) {\n var tmp$;\n var tmp$_0;\n if ((tmp$ = this.myOverallRangeByNumericAes_0.get_11rb$(aes)) != null)\n tmp$_0 = tmp$;\n else {\n throw IllegalStateException_init(('Overall range is unknown for ' + aes).toString());\n }\n return tmp$_0;\n };\n AestheticsBuilder$MyAesthetics.prototype.resolution_594811$ = function (aes, naValue) {\n var tmp$;\n if (!this.myResolutionByAes_0.containsKey_11rb$(aes)) {\n if (this.myConstantAes_0.contains_11rb$(aes))\n tmp$ = 0.0;\n else {\n var values = this.numericValues_vktour$(aes);\n tmp$ = data.SeriesUtil.resolution_u62iiw$(values, naValue);\n }\n var resolution = tmp$;\n this.myResolutionByAes_0.put_xwzc9p$(aes, resolution);\n }return ensureNotNull(this.myResolutionByAes_0.get_11rb$(aes));\n };\n function AestheticsBuilder$MyAesthetics$numericValues$ObjectLiteral(this$MyAesthetics, closure$aes) {\n this.this$MyAesthetics = this$MyAesthetics;\n this.closure$aes = closure$aes;\n }\n AestheticsBuilder$MyAesthetics$numericValues$ObjectLiteral.prototype.iterator = function () {\n return new AestheticsBuilder$AesIterator(this.this$MyAesthetics.myDataPointCount_0, this.this$MyAesthetics.aes_31786j$(this.closure$aes));\n };\n AestheticsBuilder$MyAesthetics$numericValues$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Iterable]\n };\n AestheticsBuilder$MyAesthetics.prototype.numericValues_vktour$ = function (aes) {\n if (!aes.isNumeric) {\n var message = 'Numeric aes is expected: ' + aes;\n throw IllegalArgumentException_init(message.toString());\n }return new AestheticsBuilder$MyAesthetics$numericValues$ObjectLiteral(this, aes);\n };\n function AestheticsBuilder$MyAesthetics$groups$ObjectLiteral(this$MyAesthetics) {\n this.this$MyAesthetics = this$MyAesthetics;\n }\n AestheticsBuilder$MyAesthetics$groups$ObjectLiteral.prototype.iterator = function () {\n return new AestheticsBuilder$AesIterator(this.this$MyAesthetics.myDataPointCount_0, this.this$MyAesthetics.group);\n };\n AestheticsBuilder$MyAesthetics$groups$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Iterable]\n };\n AestheticsBuilder$MyAesthetics.prototype.groups = function () {\n return new AestheticsBuilder$MyAesthetics$groups$ObjectLiteral(this);\n };\n AestheticsBuilder$MyAesthetics.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyAesthetics',\n interfaces: [Aesthetics]\n };\n function AestheticsBuilder$MyDataPointsIterator(myLength, myAesthetics) {\n this.myLength_0 = myLength;\n this.myAesthetics_0 = myAesthetics;\n this.myIndex_0 = 0;\n }\n AestheticsBuilder$MyDataPointsIterator.prototype.hasNext = function () {\n return this.myIndex_0 < this.myLength_0;\n };\n AestheticsBuilder$MyDataPointsIterator.prototype.next = function () {\n var tmp$;\n if (this.hasNext()) {\n return this.myAesthetics_0.dataPointAt_za3lpa$((tmp$ = this.myIndex_0, this.myIndex_0 = tmp$ + 1 | 0, tmp$));\n }throw new NoSuchElementException('index=' + this.myIndex_0);\n };\n AestheticsBuilder$MyDataPointsIterator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyDataPointsIterator',\n interfaces: [Iterator]\n };\n function AestheticsBuilder$AesIterator(myLength, myAes) {\n this.myLength_0 = myLength;\n this.myAes_0 = myAes;\n this.myIndex_0 = 0;\n }\n AestheticsBuilder$AesIterator.prototype.hasNext = function () {\n return this.myIndex_0 < this.myLength_0;\n };\n AestheticsBuilder$AesIterator.prototype.next = function () {\n var tmp$;\n if (this.hasNext()) {\n return this.myAes_0((tmp$ = this.myIndex_0, this.myIndex_0 = tmp$ + 1 | 0, tmp$));\n }throw new NoSuchElementException('index=' + this.myIndex_0);\n };\n AestheticsBuilder$AesIterator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AesIterator',\n interfaces: [Iterator]\n };\n function AestheticsBuilder$MyDataPointAesthetics(myIndex, myAesthetics) {\n this.myIndex_0 = myIndex;\n this.myAesthetics_0 = myAesthetics;\n }\n AestheticsBuilder$MyDataPointAesthetics.prototype.index = function () {\n return ensureNotNull(this.myIndex_0);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.x = function () {\n return this.get_31786j$(Aes$Companion_getInstance().X);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.y = function () {\n return this.get_31786j$(Aes$Companion_getInstance().Y);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.z = function () {\n return this.get_31786j$(Aes$Companion_getInstance().Z);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.ymin = function () {\n return this.get_31786j$(Aes$Companion_getInstance().YMIN);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.ymax = function () {\n return this.get_31786j$(Aes$Companion_getInstance().YMAX);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.color = function () {\n return this.get_31786j$(Aes$Companion_getInstance().COLOR);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.fill = function () {\n return this.get_31786j$(Aes$Companion_getInstance().FILL);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.alpha = function () {\n return this.get_31786j$(Aes$Companion_getInstance().ALPHA);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.shape = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SHAPE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.lineType = function () {\n return this.get_31786j$(Aes$Companion_getInstance().LINETYPE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.size = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SIZE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.width = function () {\n return this.get_31786j$(Aes$Companion_getInstance().WIDTH);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.height = function () {\n return this.get_31786j$(Aes$Companion_getInstance().HEIGHT);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.weight = function () {\n return this.get_31786j$(Aes$Companion_getInstance().WEIGHT);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.intercept = function () {\n return this.get_31786j$(Aes$Companion_getInstance().INTERCEPT);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.slope = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SLOPE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.interceptX = function () {\n return this.get_31786j$(Aes$Companion_getInstance().XINTERCEPT);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.interceptY = function () {\n return this.get_31786j$(Aes$Companion_getInstance().YINTERCEPT);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.lower = function () {\n return this.get_31786j$(Aes$Companion_getInstance().LOWER);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.middle = function () {\n return this.get_31786j$(Aes$Companion_getInstance().MIDDLE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.upper = function () {\n return this.get_31786j$(Aes$Companion_getInstance().UPPER);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.frame = function () {\n return this.get_31786j$(Aes$Companion_getInstance().FRAME);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.speed = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SPEED);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.flow = function () {\n return this.get_31786j$(Aes$Companion_getInstance().FLOW);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.xmin = function () {\n return this.get_31786j$(Aes$Companion_getInstance().XMIN);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.xmax = function () {\n return this.get_31786j$(Aes$Companion_getInstance().XMAX);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.xend = function () {\n return this.get_31786j$(Aes$Companion_getInstance().XEND);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.yend = function () {\n return this.get_31786j$(Aes$Companion_getInstance().YEND);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.label = function () {\n return this.get_31786j$(Aes$Companion_getInstance().LABEL);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.family = function () {\n return this.get_31786j$(Aes$Companion_getInstance().FAMILY);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.fontface = function () {\n return this.get_31786j$(Aes$Companion_getInstance().FONTFACE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.hjust = function () {\n return this.get_31786j$(Aes$Companion_getInstance().HJUST);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.vjust = function () {\n return this.get_31786j$(Aes$Companion_getInstance().VJUST);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.angle = function () {\n return this.get_31786j$(Aes$Companion_getInstance().ANGLE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.symX = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SYM_X);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.symY = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SYM_Y);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.group = function () {\n return this.myAesthetics_0.group(ensureNotNull(this.myIndex_0));\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.numeric_vktour$ = function (aes) {\n return this.get_31786j$(aes);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.get_31786j$ = function (aes) {\n return this.myAesthetics_0.aes_31786j$(aes)(ensureNotNull(this.myIndex_0));\n };\n AestheticsBuilder$MyDataPointAesthetics.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyDataPointAesthetics',\n interfaces: [DataPointAesthetics]\n };\n function AestheticsBuilder$ArrayAes(myVal) {\n this.myVal_0 = myVal;\n }\n AestheticsBuilder$ArrayAes.prototype.apply_11rb$ = function (value) {\n return this.myVal_0[value];\n };\n AestheticsBuilder$ArrayAes.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ArrayAes',\n interfaces: [Function]\n };\n function AestheticsBuilder$MapperAes(myL, myF) {\n this.myL_0 = myL;\n this.myF_0 = myF;\n }\n AestheticsBuilder$MapperAes.prototype.apply_11rb$ = function (value) {\n return this.myF_0(this.myL_0.get_za3lpa$(value));\n };\n AestheticsBuilder$MapperAes.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MapperAes',\n interfaces: [Function]\n };\n function AestheticsBuilder$Companion() {\n AestheticsBuilder$Companion_instance = this;\n }\n function AestheticsBuilder$Companion$constant$lambda(closure$v) {\n return function (it) {\n return closure$v;\n };\n }\n AestheticsBuilder$Companion.prototype.constant_mh5how$ = function (v) {\n return AestheticsBuilder$Companion$constant$lambda(v);\n };\n function AestheticsBuilder$Companion$array$lambda(closure$v) {\n return function (value) {\n return closure$v[value];\n };\n }\n AestheticsBuilder$Companion.prototype.array_ro6dgy$ = function (v) {\n return AestheticsBuilder$Companion$array$lambda(v);\n };\n function AestheticsBuilder$Companion$collection$lambda(closure$v) {\n return function (value) {\n return collect.Iterables.get_7iig3d$(closure$v, value);\n };\n }\n AestheticsBuilder$Companion.prototype.collection_mqih57$ = function (v) {\n return AestheticsBuilder$Companion$collection$lambda(v);\n };\n function AestheticsBuilder$Companion$listMapper$lambda(closure$f, closure$v) {\n return function (value) {\n return closure$f(closure$v.get_za3lpa$(value));\n };\n }\n AestheticsBuilder$Companion.prototype.listMapper_sedzz5$ = function (v, f) {\n return AestheticsBuilder$Companion$listMapper$lambda(f, v);\n };\n AestheticsBuilder$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AestheticsBuilder$Companion_instance = null;\n function AestheticsBuilder$Companion_getInstance() {\n if (AestheticsBuilder$Companion_instance === null) {\n new AestheticsBuilder$Companion();\n }return AestheticsBuilder$Companion_instance;\n }\n AestheticsBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AestheticsBuilder',\n interfaces: []\n };\n function AestheticsDefaults() {\n AestheticsDefaults$Companion_getInstance();\n var $receiver = new TypedKeyHashMap();\n var tmp$, tmp$_0;\n tmp$ = Aes$Companion_getInstance().values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n $receiver.put_ev6mlr$(Kotlin.isType(tmp$_0 = aes, Aes) ? tmp$_0 : throwCCE(), AesInitValue_getInstance().get_31786j$(aes));\n }\n this.myDefaults_vq25h0$_0 = $receiver;\n this.myDefaultsInLegend_yhkzvq$_0 = new TypedKeyHashMap();\n }\n AestheticsDefaults.prototype.update_bbdhip$ = function (aes, defaultValue) {\n this.myDefaults_vq25h0$_0.put_ev6mlr$(aes, defaultValue);\n return this;\n };\n AestheticsDefaults.prototype.updateInLegend_bbdhip$ = function (aes, defaultValue) {\n this.myDefaultsInLegend_yhkzvq$_0.put_ev6mlr$(aes, defaultValue);\n return this;\n };\n AestheticsDefaults.prototype.rangeIncludesZero_896ixz$ = function (aes) {\n return false;\n };\n AestheticsDefaults.prototype.defaultValue_31786j$ = function (aes) {\n return this.myDefaults_vq25h0$_0.get_ex36zt$(aes);\n };\n AestheticsDefaults.prototype.defaultValueInLegend_31786j$ = function (aes) {\n var tmp$;\n if (this.myDefaultsInLegend_yhkzvq$_0.containsKey_ex36zt$(aes)) {\n tmp$ = this.myDefaultsInLegend_yhkzvq$_0.get_ex36zt$(aes);\n } else\n tmp$ = this.defaultValue_31786j$(aes);\n return tmp$;\n };\n function AestheticsDefaults$Companion() {\n AestheticsDefaults$Companion_instance = this;\n }\n AestheticsDefaults$Companion.prototype.point = function () {\n return this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 2.0).updateInLegend_bbdhip$(Aes$Companion_getInstance().SIZE, 5.0);\n };\n AestheticsDefaults$Companion.prototype.path = function () {\n return this.base_0();\n };\n AestheticsDefaults$Companion.prototype.line = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.abline = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.hline = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.vline = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.smooth = function () {\n return this.path().update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.MAGENTA).update_bbdhip$(Aes$Companion_getInstance().FILL, Color.Companion.BLACK);\n };\n function AestheticsDefaults$Companion$bar$ObjectLiteral() {\n AestheticsDefaults.call(this);\n }\n AestheticsDefaults$Companion$bar$ObjectLiteral.prototype.rangeIncludesZero_896ixz$ = function (aes) {\n return equals(aes, Aes$Companion_getInstance().Y) || AestheticsDefaults.prototype.rangeIncludesZero_896ixz$.call(this, aes);\n };\n AestheticsDefaults$Companion$bar$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AestheticsDefaults]\n };\n AestheticsDefaults$Companion.prototype.bar = function () {\n return (new AestheticsDefaults$Companion$bar$ObjectLiteral()).update_bbdhip$(Aes$Companion_getInstance().WIDTH, 0.9).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT);\n };\n function AestheticsDefaults$Companion$histogram$ObjectLiteral() {\n AestheticsDefaults.call(this);\n }\n AestheticsDefaults$Companion$histogram$ObjectLiteral.prototype.rangeIncludesZero_896ixz$ = function (aes) {\n return equals(aes, Aes$Companion_getInstance().Y) || AestheticsDefaults.prototype.rangeIncludesZero_896ixz$.call(this, aes);\n };\n AestheticsDefaults$Companion$histogram$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AestheticsDefaults]\n };\n AestheticsDefaults$Companion.prototype.histogram = function () {\n return (new AestheticsDefaults$Companion$histogram$ObjectLiteral()).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT);\n };\n AestheticsDefaults$Companion.prototype.tile = function () {\n return (new AestheticsDefaults()).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT);\n };\n AestheticsDefaults$Companion.prototype.bin2d = function () {\n return this.tile();\n };\n AestheticsDefaults$Companion.prototype.errorBar = function () {\n return (new AestheticsDefaults()).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.BLACK);\n };\n AestheticsDefaults$Companion.prototype.crossBar = function () {\n return (new AestheticsDefaults()).update_bbdhip$(Aes$Companion_getInstance().WIDTH, 0.9).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.BLACK).update_bbdhip$(Aes$Companion_getInstance().FILL, Color.Companion.WHITE);\n };\n AestheticsDefaults$Companion.prototype.lineRange = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.pointRange = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.polygon = function () {\n return this.base_0().update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT);\n };\n AestheticsDefaults$Companion.prototype.map = function () {\n return this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 0.2).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.GRAY).update_bbdhip$(Aes$Companion_getInstance().FILL, Color.Companion.TRANSPARENT);\n };\n AestheticsDefaults$Companion.prototype.boxplot = function () {\n return this.crossBar();\n };\n AestheticsDefaults$Companion.prototype.livemap_cx3y7u$ = function (displayMode) {\n var tmp$;\n switch (displayMode.name) {\n case 'POINT':\n tmp$ = this.point().updateInLegend_bbdhip$(Aes$Companion_getInstance().SIZE, 5.0);\n break;\n case 'BAR':\n tmp$ = this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 40.0).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT);\n break;\n case 'PIE':\n tmp$ = this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 20.0).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT).updateInLegend_bbdhip$(Aes$Companion_getInstance().SIZE, 5.0);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n AestheticsDefaults$Companion.prototype.ribbon = function () {\n return this.base_0();\n };\n function AestheticsDefaults$Companion$area$ObjectLiteral() {\n AestheticsDefaults.call(this);\n }\n AestheticsDefaults$Companion$area$ObjectLiteral.prototype.rangeIncludesZero_896ixz$ = function (aes) {\n return equals(aes, Aes$Companion_getInstance().Y) || AestheticsDefaults.prototype.rangeIncludesZero_896ixz$.call(this, aes);\n };\n AestheticsDefaults$Companion$area$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AestheticsDefaults]\n };\n AestheticsDefaults$Companion.prototype.area = function () {\n return new AestheticsDefaults$Companion$area$ObjectLiteral();\n };\n AestheticsDefaults$Companion.prototype.density = function () {\n return this.area().update_bbdhip$(Aes$Companion_getInstance().FILL, Color.Companion.TRANSPARENT);\n };\n AestheticsDefaults$Companion.prototype.contour = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.contourf = function () {\n return this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 0.0);\n };\n AestheticsDefaults$Companion.prototype.density2d = function () {\n return this.contour();\n };\n AestheticsDefaults$Companion.prototype.density2df = function () {\n return this.contourf();\n };\n AestheticsDefaults$Companion.prototype.jitter = function () {\n return this.point();\n };\n AestheticsDefaults$Companion.prototype.freqpoly = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.step = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.rect = function () {\n return this.polygon();\n };\n AestheticsDefaults$Companion.prototype.segment = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.text = function () {\n return this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 7.0).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.parseHex_61zpoe$('#3d3d3d'));\n };\n AestheticsDefaults$Companion.prototype.raster = function () {\n return this.base_0();\n };\n AestheticsDefaults$Companion.prototype.image = function () {\n return this.base_0();\n };\n AestheticsDefaults$Companion.prototype.base_0 = function () {\n return new AestheticsDefaults();\n };\n AestheticsDefaults$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AestheticsDefaults$Companion_instance = null;\n function AestheticsDefaults$Companion_getInstance() {\n if (AestheticsDefaults$Companion_instance === null) {\n new AestheticsDefaults$Companion();\n }return AestheticsDefaults$Companion_instance;\n }\n AestheticsDefaults.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AestheticsDefaults',\n interfaces: []\n };\n function AestheticsUtil() {\n AestheticsUtil_instance = this;\n this.ALPHA_CONTROLS_BOTH_8be2vx$ = false;\n }\n AestheticsUtil.prototype.fill_edjgex$ = function (filled, solid, p) {\n if (filled) {\n return ensureNotNull(p.fill());\n } else if (solid) {\n return ensureNotNull(p.color());\n }return Color.Companion.TRANSPARENT;\n };\n AestheticsUtil.prototype.decorate_l4vgcq$ = function (shape, filled, solid, p, strokeWidth) {\n var fill = this.fill_edjgex$(filled, solid, p);\n var stroke = ensureNotNull(p.color());\n var fillAlpha = 0.0;\n if (filled || solid) {\n fillAlpha = this.alpha_il6rhx$(fill, p);\n }var strokeAlpha = 0.0;\n if (strokeWidth > 0) {\n strokeAlpha = this.alpha_il6rhx$(stroke, p);\n }shape.update_mjoany$(fill, fillAlpha, stroke, strokeAlpha, strokeWidth);\n };\n AestheticsUtil.prototype.alpha_il6rhx$ = function (color, p) {\n var tmp$;\n if (values.Colors.solid_98b62m$(color)) {\n tmp$ = ensureNotNull(p.alpha());\n } else\n tmp$ = svg.SvgUtils.alpha2opacity_za3lpa$(color.alpha);\n return tmp$;\n };\n AestheticsUtil.prototype.strokeWidth_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * 2.0;\n };\n AestheticsUtil.prototype.textSize_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * 2;\n };\n AestheticsUtil.prototype.updateStroke_g0plfl$ = function (shape, p, applyAlpha) {\n shape.strokeColor().set_11rb$(p.color());\n if (values.Colors.solid_98b62m$(ensureNotNull(p.color())) && applyAlpha) {\n shape.strokeOpacity().set_11rb$(p.alpha());\n }};\n AestheticsUtil.prototype.updateFill_v4tjbc$ = function (shape, p) {\n shape.fillColor().set_11rb$(p.fill());\n if (values.Colors.solid_98b62m$(ensureNotNull(p.fill()))) {\n shape.fillOpacity().set_11rb$(p.alpha());\n }};\n AestheticsUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'AestheticsUtil',\n interfaces: []\n };\n var AestheticsUtil_instance = null;\n function AestheticsUtil_getInstance() {\n if (AestheticsUtil_instance === null) {\n new AestheticsUtil();\n }return AestheticsUtil_instance;\n }\n function TypedIndexFunctionMap(indexFunctionMap) {\n this.myMap_0 = indexFunctionMap;\n }\n TypedIndexFunctionMap.prototype.get_31786j$ = function (aes) {\n var tmp$;\n return typeof (tmp$ = this.myMap_0.get_11rb$(aes)) === 'function' ? tmp$ : throwCCE();\n };\n TypedIndexFunctionMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TypedIndexFunctionMap',\n interfaces: []\n };\n function Coords() {\n Coords_instance = this;\n }\n Coords.prototype.create_wd6eaa$ = function (xRange, yRange, xLim, yLim) {\n if (xLim === void 0)\n xLim = null;\n if (yLim === void 0)\n yLim = null;\n var origin = new DoubleVector(this.originX_0(xRange), this.originY_0(yRange));\n return this.create_e5yqp7$(origin, xLim, yLim);\n };\n Coords.prototype.create_e5yqp7$ = function (origin, xLim, yLim) {\n if (xLim === void 0)\n xLim = null;\n if (yLim === void 0)\n yLim = null;\n return new DefaultCoordinateSystem(this.toClientOffsetX_0(origin.x), this.toClientOffsetY_0(origin.y), this.fromClientOffsetX_0(origin.x), this.fromClientOffsetY_0(origin.y), xLim, yLim);\n };\n Coords.prototype.toClientOffsetX_4fzjta$ = function (xRange) {\n return this.toClientOffsetX_0(this.originX_0(xRange));\n };\n Coords.prototype.toClientOffsetY_4fzjta$ = function (yRange) {\n return this.toClientOffsetY_0(this.originY_0(yRange));\n };\n Coords.prototype.originX_0 = function (xRange) {\n return -xRange.lowerEnd;\n };\n Coords.prototype.originY_0 = function (yRange) {\n return yRange.upperEnd;\n };\n function Coords$toClientOffsetX$lambda(closure$originX) {\n return function (x) {\n return closure$originX + x;\n };\n }\n Coords.prototype.toClientOffsetX_0 = function (originX) {\n return Coords$toClientOffsetX$lambda(originX);\n };\n function Coords$fromClientOffsetX$lambda(closure$originX) {\n return function (x) {\n return x - closure$originX;\n };\n }\n Coords.prototype.fromClientOffsetX_0 = function (originX) {\n return Coords$fromClientOffsetX$lambda(originX);\n };\n function Coords$toClientOffsetY$lambda(closure$originY) {\n return function (y) {\n return closure$originY - y;\n };\n }\n Coords.prototype.toClientOffsetY_0 = function (originY) {\n return Coords$toClientOffsetY$lambda(originY);\n };\n function Coords$fromClientOffsetY$lambda(closure$originY) {\n return function (y) {\n return closure$originY - y;\n };\n }\n Coords.prototype.fromClientOffsetY_0 = function (originY) {\n return Coords$fromClientOffsetY$lambda(originY);\n };\n Coords.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Coords',\n interfaces: []\n };\n var Coords_instance = null;\n function Coords_getInstance() {\n if (Coords_instance === null) {\n new Coords();\n }return Coords_instance;\n }\n function DefaultCoordinateSystem(myToClientOffsetX, myToClientOffsetY, myFromClientOffsetX, myFromClientOffsetY, xLim, yLim) {\n this.myToClientOffsetX_0 = myToClientOffsetX;\n this.myToClientOffsetY_0 = myToClientOffsetY;\n this.myFromClientOffsetX_0 = myFromClientOffsetX;\n this.myFromClientOffsetY_0 = myFromClientOffsetY;\n this.xLim_0 = xLim;\n this.yLim_0 = yLim;\n }\n DefaultCoordinateSystem.prototype.toClient_gpjtzr$ = function (p) {\n return new DoubleVector(this.myToClientOffsetX_0(p.x), this.myToClientOffsetY_0(p.y));\n };\n DefaultCoordinateSystem.prototype.fromClient_gpjtzr$ = function (p) {\n return new DoubleVector(this.myFromClientOffsetX_0(p.x), this.myFromClientOffsetY_0(p.y));\n };\n DefaultCoordinateSystem.prototype.isPointInLimits_k2qmv6$$default = function (p, isClient) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var coord = isClient ? this.fromClient_gpjtzr$(p) : p;\n return ((tmp$_0 = (tmp$ = this.xLim_0) != null ? tmp$.contains_mef7kx$(coord.x) : null) != null ? tmp$_0 : true) && ((tmp$_2 = (tmp$_1 = this.yLim_0) != null ? tmp$_1.contains_mef7kx$(coord.y) : null) != null ? tmp$_2 : true);\n };\n DefaultCoordinateSystem.prototype.isRectInLimits_fd842m$$default = function (rect, isClient) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var r = isClient ? (new GeomCoord(this)).fromClient_wthzt5$(rect) : rect;\n return ((tmp$_0 = (tmp$ = this.xLim_0) != null ? tmp$.encloses_d226ot$(r.xRange()) : null) != null ? tmp$_0 : true) && ((tmp$_2 = (tmp$_1 = this.yLim_0) != null ? tmp$_1.encloses_d226ot$(r.yRange()) : null) != null ? tmp$_2 : true);\n };\n DefaultCoordinateSystem.prototype.isPathInLimits_f6t8kh$$default = function (path, isClient) {\n var any$result;\n any$break: do {\n var tmp$;\n if (Kotlin.isType(path, Collection) && path.isEmpty()) {\n any$result = false;\n break any$break;\n }tmp$ = path.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (this.isPointInLimits_k2qmv6$(element, isClient)) {\n any$result = true;\n break any$break;\n }}\n any$result = false;\n }\n while (false);\n return any$result;\n };\n DefaultCoordinateSystem.prototype.isPolygonInLimits_f6t8kh$$default = function (polygon, isClient) {\n var bbox = geometry.DoubleRectangles.boundingBox_qdtdbw$(polygon);\n return this.isRectInLimits_fd842m$(bbox, isClient);\n };\n Object.defineProperty(DefaultCoordinateSystem.prototype, 'xClientLimit', {\n configurable: true,\n get: function () {\n var tmp$;\n return (tmp$ = this.xLim_0) != null ? this.convertRange_0(tmp$, this.myToClientOffsetX_0) : null;\n }\n });\n Object.defineProperty(DefaultCoordinateSystem.prototype, 'yClientLimit', {\n configurable: true,\n get: function () {\n var tmp$;\n return (tmp$ = this.yLim_0) != null ? this.convertRange_0(tmp$, this.myToClientOffsetY_0) : null;\n }\n });\n DefaultCoordinateSystem.prototype.convertRange_0 = function (range, transform) {\n var l = transform(range.lowerEnd);\n var u = transform(range.upperEnd);\n return new ClosedRange(collect.Comparables.min_sdesaw$(l, u), collect.Comparables.max_sdesaw$(l, u));\n };\n DefaultCoordinateSystem.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DefaultCoordinateSystem',\n interfaces: [CoordinateSystem]\n };\n function Projection() {\n }\n Projection.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Projection',\n interfaces: []\n };\n function DataFrameUtil() {\n DataFrameUtil_instance = this;\n }\n DataFrameUtil.prototype.transformVarFor_896ixz$ = function (aes) {\n return TransformVar_getInstance().forAes_896ixz$(aes);\n };\n DataFrameUtil.prototype.applyTransform_xaiv89$ = function (data, var_0, aes, scale) {\n var transformVar = this.transformVarFor_896ixz$(aes);\n return this.applyTransform_0(data, var_0, transformVar, scale);\n };\n DataFrameUtil.prototype.applyTransform_0 = function (data, variable, transformVar, scale) {\n var transformSource = this.getTransformSource_0(data, variable, scale);\n var transformResult = scale.transform.apply_9ma18$(transformSource);\n return data.builder().putNumeric_s1rqo9$(transformVar, transformResult).build();\n };\n DataFrameUtil.prototype.getTransformSource_0 = function (data, variable, scale) {\n var transformSource = data.get_8xm3sj$(variable);\n return ScaleUtil_getInstance().cleanUpTransformSource_2jj1lg$(transformSource, scale);\n };\n DataFrameUtil.prototype.hasVariable_vede35$ = function (data, varName) {\n var tmp$;\n tmp$ = data.variables().iterator();\n while (tmp$.hasNext()) {\n var var_0 = tmp$.next();\n if (equals(varName, var_0.name)) {\n return true;\n }}\n return false;\n };\n DataFrameUtil.prototype.findVariableOrFail_vede35$ = function (data, varName) {\n var tmp$;\n tmp$ = data.variables().iterator();\n while (tmp$.hasNext()) {\n var var_0 = tmp$.next();\n if (equals(varName, var_0.name)) {\n return var_0;\n }}\n var tmp$_0 = \"Variable not found: '\" + varName + \"'. Variables in data frame: \";\n var $receiver = data.variables();\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n destination.add_11rb$(\"'\" + item.name + \"'\");\n }\n throw IllegalArgumentException_init(tmp$_0 + destination);\n };\n DataFrameUtil.prototype.isNumeric_vede35$ = function (data, varName) {\n return data.isNumeric_8xm3sj$(this.findVariableOrFail_vede35$(data, varName));\n };\n function DataFrameUtil$sortedCopy$lambda(o1, o2) {\n return Kotlin.compareTo(o1.name, o2.name);\n }\n DataFrameUtil.prototype.sortedCopy_jgbhqw$ = function (variables) {\n var ordering = Ordering.Companion.from_iajr8b$(new Comparator(DataFrameUtil$sortedCopy$lambda));\n return ordering.sortedCopy_m5x2f4$(variables);\n };\n DataFrameUtil.prototype.variables_dhhkv7$ = function (df) {\n var $receiver = df.variables();\n var keySelector = getPropertyCallableRef('name', 1, function ($receiver) {\n return $receiver.name;\n });\n var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault($receiver, 10)), 16);\n var destination = LinkedHashMap_init_0(capacity);\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n destination.put_xwzc9p$(keySelector(element), element);\n }\n return destination;\n };\n function DataFrameUtil$appendReplace$put(this$DataFrameUtil) {\n return function ($receiver, destVars, df) {\n var this$DataFrameUtil_0 = this$DataFrameUtil;\n var tmp$;\n tmp$ = destVars.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n var srcVar = this$DataFrameUtil_0.findVariableOrFail_vede35$(df, element.name);\n tmp$_0 = df.isNumeric_8xm3sj$(srcVar);\n if (tmp$_0 === true)\n $receiver.putNumeric_s1rqo9$(element, df.getNumeric_8xm3sj$(srcVar));\n else if (tmp$_0 === false)\n $receiver.putDiscrete_2l962d$(element, df.get_8xm3sj$(srcVar));\n else\n Kotlin.noWhenBranchMatched();\n }\n return $receiver;\n };\n }\n DataFrameUtil.prototype.appendReplace_yxlle4$ = function (df0, df1) {\n var put = DataFrameUtil$appendReplace$put(this);\n var tmp$ = DataFrame$DataFrame$Builder_init();\n var $receiver = df0.variables();\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var $receiver_0 = this.variables_dhhkv7$(df1);\n var key = element.name;\n var tmp$_1;\n if (!(Kotlin.isType(tmp$_1 = $receiver_0, Map) ? tmp$_1 : throwCCE()).containsKey_11rb$(key))\n destination.add_11rb$(element);\n }\n var tmp$_2 = put(tmp$, destination, df0);\n var $receiver_1 = df0.variables();\n var destination_0 = ArrayList_init();\n var tmp$_3;\n tmp$_3 = $receiver_1.iterator();\n while (tmp$_3.hasNext()) {\n var element_0 = tmp$_3.next();\n var $receiver_2 = this.variables_dhhkv7$(df1);\n var key_0 = element_0.name;\n var tmp$_4;\n if ((Kotlin.isType(tmp$_4 = $receiver_2, Map) ? tmp$_4 : throwCCE()).containsKey_11rb$(key_0))\n destination_0.add_11rb$(element_0);\n }\n var tmp$_5 = put(tmp$_2, destination_0, df1);\n var $receiver_3 = df1.variables();\n var destination_1 = ArrayList_init();\n var tmp$_6;\n tmp$_6 = $receiver_3.iterator();\n while (tmp$_6.hasNext()) {\n var element_1 = tmp$_6.next();\n var $receiver_4 = this.variables_dhhkv7$(df0);\n var key_1 = element_1.name;\n var tmp$_7;\n if (!(Kotlin.isType(tmp$_7 = $receiver_4, Map) ? tmp$_7 : throwCCE()).containsKey_11rb$(key_1))\n destination_1.add_11rb$(element_1);\n }\n return put(tmp$_5, destination_1, df1).build();\n };\n DataFrameUtil.prototype.toMap_dhhkv7$ = function (df) {\n var tmp$;\n var result = HashMap_init();\n var variables = df.variables();\n tmp$ = variables.iterator();\n while (tmp$.hasNext()) {\n var var_0 = tmp$.next();\n var key = var_0.name;\n var value = df.get_8xm3sj$(var_0);\n result.put_xwzc9p$(key, value);\n }\n return result;\n };\n DataFrameUtil.prototype.fromMap_bkhwtg$ = function (map) {\n var tmp$;\n var frameBuilder = DataFrame$DataFrame$Builder_init();\n tmp$ = map.entries.iterator();\n while (tmp$.hasNext()) {\n var tmp$_0 = tmp$.next();\n var key = tmp$_0.key;\n var value = tmp$_0.value;\n if (!(typeof key === 'string')) {\n var message = 'Map to data-frame: key expected a String but was ' + Kotlin.getKClassFromExpression(ensureNotNull(key)).simpleName + ' : ' + toString(key);\n throw IllegalArgumentException_init(message.toString());\n }if (!Kotlin.isType(value, List)) {\n var message_0 = 'Map to data-frame: value expected a List but was ' + Kotlin.getKClassFromExpression(ensureNotNull(value)).simpleName + ' : ' + toString(value);\n throw IllegalArgumentException_init(message_0.toString());\n }frameBuilder.put_2l962d$(this.createVariable_puj7f4$(key), value);\n }\n return frameBuilder.build();\n };\n DataFrameUtil.prototype.createVariable_puj7f4$ = function (name, label) {\n if (label === void 0)\n label = name;\n var tmp$;\n if (TransformVar_getInstance().isTransformVar_61zpoe$(name))\n tmp$ = TransformVar_getInstance().get_61zpoe$(name);\n else if (Stats_getInstance().isStatVar_61zpoe$(name))\n tmp$ = Stats_getInstance().statVar_61zpoe$(name);\n else if (Dummies_getInstance().isDummyVar_61zpoe$(name))\n tmp$ = Dummies_getInstance().newDummy_61zpoe$(name);\n else\n tmp$ = new DataFrame$Variable(name, DataFrame$Variable$Source$ORIGIN_getInstance(), label);\n return tmp$;\n };\n DataFrameUtil.prototype.getSummaryText_dhhkv7$ = function (df) {\n var tmp$;\n var sb = StringBuilder_init();\n tmp$ = df.variables().iterator();\n while (tmp$.hasNext()) {\n var variable = tmp$.next();\n sb.append_pdl1vj$(variable.toSummaryString()).append_pdl1vj$(' numeric: ' + toString(df.isNumeric_8xm3sj$(variable))).append_pdl1vj$(' size: ' + toString(df.get_8xm3sj$(variable).size)).append_s8itvh$(10);\n }\n return sb.toString();\n };\n DataFrameUtil.prototype.removeAllExcept_dipqvu$ = function (df, keepNames) {\n var tmp$;\n var b = df.builder();\n tmp$ = df.variables().iterator();\n while (tmp$.hasNext()) {\n var variable = tmp$.next();\n if (!keepNames.contains_11rb$(variable.name)) {\n b.remove_8xm3sj$(variable);\n }}\n return b.build();\n };\n DataFrameUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DataFrameUtil',\n interfaces: []\n };\n var DataFrameUtil_instance = null;\n function DataFrameUtil_getInstance() {\n if (DataFrameUtil_instance === null) {\n new DataFrameUtil();\n }return DataFrameUtil_instance;\n }\n function Dummies() {\n Dummies_instance = this;\n this.PREFIX_0 = '__';\n }\n Dummies.prototype.isDummyVar_61zpoe$ = function (varName) {\n if (!base.Strings.isNullOrEmpty_pdl1vj$(varName) && varName.length > 2 && startsWith(varName, this.PREFIX_0)) {\n var numStr = varName.substring(2);\n return Regex_init('[0-9]+').matches_6bul2c$(numStr);\n }return false;\n };\n Dummies.prototype.dummyNames_za3lpa$ = function (count) {\n var l = ArrayList_init();\n for (var i = 0; i < count; i++) {\n l.add_11rb$(this.PREFIX_0 + toString(i));\n }\n return l;\n };\n Dummies.prototype.newDummy_61zpoe$ = function (varName) {\n if (!this.isDummyVar_61zpoe$(varName)) {\n var message = 'Not a dummy var name';\n throw IllegalArgumentException_init(message.toString());\n }return new DataFrame$Variable(varName, DataFrame$Variable$Source$ORIGIN_getInstance(), '');\n };\n Dummies.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Dummies',\n interfaces: []\n };\n var Dummies_instance = null;\n function Dummies_getInstance() {\n if (Dummies_instance === null) {\n new Dummies();\n }return Dummies_instance;\n }\n function TransformVar() {\n TransformVar_instance = this;\n this.X = new DataFrame$Variable('transform.X', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.Y = new DataFrame$Variable('transform.Y', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.Z = new DataFrame$Variable('transform.Z', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.YMIN = new DataFrame$Variable('transform.YMIN', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.YMAX = new DataFrame$Variable('transform.YMAX', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.COLOR = new DataFrame$Variable('transform.COLOR', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.FILL = new DataFrame$Variable('transform.FILL', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.ALPHA = new DataFrame$Variable('transform.ALPHA', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SHAPE = new DataFrame$Variable('transform.SHAPE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.LINETYPE = new DataFrame$Variable('transform.LINETYPE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SIZE = new DataFrame$Variable('transform.SIZE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.WIDTH = new DataFrame$Variable('transform.WIDTH', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.HEIGHT = new DataFrame$Variable('transform.HEIGHT', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.WEIGHT = new DataFrame$Variable('transform.WEIGHT', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.INTERCEPT = new DataFrame$Variable('transform.INTERCEPT', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SLOPE = new DataFrame$Variable('transform.SLOPE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.XINTERCEPT = new DataFrame$Variable('transform.XINTERCEPT', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.YINTERCEPT = new DataFrame$Variable('transform.YINTERCEPT', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.LOWER = new DataFrame$Variable('transform.LOWER', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.MIDDLE = new DataFrame$Variable('transform.MIDDLE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.UPPER = new DataFrame$Variable('transform.UPPER', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.FRAME = new DataFrame$Variable('transform.FRAME', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SPEED = new DataFrame$Variable('transform.SPEED', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.FLOW = new DataFrame$Variable('transform.FLOW', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.XMIN = new DataFrame$Variable('transform.XMIN', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.XMAX = new DataFrame$Variable('transform.XMAX', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.XEND = new DataFrame$Variable('transform.XEND', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.YEND = new DataFrame$Variable('transform.YEND', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.LABEL = new DataFrame$Variable('transform.LABEL', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.FONT_FAMILY = new DataFrame$Variable('transform.FONT_FAMILY', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.FONT_FACE = new DataFrame$Variable('transform.FONT_FACE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.HJUST = new DataFrame$Variable('transform.HJUST', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.VJUST = new DataFrame$Variable('transform.VJUST', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.ANGLE = new DataFrame$Variable('transform.ANGLE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SYM_X = new DataFrame$Variable('transform.SYM_X', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SYM_Y = new DataFrame$Variable('transform.SYM_Y', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.VAR_BY_AES_0 = new TransformVar$TransformVarByAes();\n this.VARS_0 = null;\n var tmp$;\n var varByName = HashMap_init();\n tmp$ = Aes$Companion_getInstance().values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n var var_0 = this.VAR_BY_AES_0.visit_896ixz$(aes);\n var key = var_0.name;\n varByName.put_xwzc9p$(key, var_0);\n }\n this.VARS_0 = varByName;\n }\n TransformVar.prototype.isTransformVar_61zpoe$ = function (varName) {\n return this.VARS_0.containsKey_11rb$(varName);\n };\n TransformVar.prototype.get_61zpoe$ = function (varName) {\n if (!this.VARS_0.containsKey_11rb$(varName)) {\n var message = 'Unknown transform variable ' + varName;\n throw IllegalStateException_init(message.toString());\n }return ensureNotNull(this.VARS_0.get_11rb$(varName));\n };\n TransformVar.prototype.forAes_896ixz$ = function (aes) {\n return this.VAR_BY_AES_0.visit_896ixz$(aes);\n };\n function TransformVar$TransformVarByAes() {\n AesVisitor.call(this);\n }\n TransformVar$TransformVarByAes.prototype.x = function () {\n return TransformVar_getInstance().X;\n };\n TransformVar$TransformVarByAes.prototype.y = function () {\n return TransformVar_getInstance().Y;\n };\n TransformVar$TransformVarByAes.prototype.z = function () {\n return TransformVar_getInstance().Z;\n };\n TransformVar$TransformVarByAes.prototype.ymin = function () {\n return TransformVar_getInstance().YMIN;\n };\n TransformVar$TransformVarByAes.prototype.ymax = function () {\n return TransformVar_getInstance().YMAX;\n };\n TransformVar$TransformVarByAes.prototype.color = function () {\n return TransformVar_getInstance().COLOR;\n };\n TransformVar$TransformVarByAes.prototype.fill = function () {\n return TransformVar_getInstance().FILL;\n };\n TransformVar$TransformVarByAes.prototype.alpha = function () {\n return TransformVar_getInstance().ALPHA;\n };\n TransformVar$TransformVarByAes.prototype.shape = function () {\n return TransformVar_getInstance().SHAPE;\n };\n TransformVar$TransformVarByAes.prototype.lineType = function () {\n return TransformVar_getInstance().LINETYPE;\n };\n TransformVar$TransformVarByAes.prototype.size = function () {\n return TransformVar_getInstance().SIZE;\n };\n TransformVar$TransformVarByAes.prototype.width = function () {\n return TransformVar_getInstance().WIDTH;\n };\n TransformVar$TransformVarByAes.prototype.height = function () {\n return TransformVar_getInstance().HEIGHT;\n };\n TransformVar$TransformVarByAes.prototype.weight = function () {\n return TransformVar_getInstance().WEIGHT;\n };\n TransformVar$TransformVarByAes.prototype.intercept = function () {\n return TransformVar_getInstance().INTERCEPT;\n };\n TransformVar$TransformVarByAes.prototype.slope = function () {\n return TransformVar_getInstance().SLOPE;\n };\n TransformVar$TransformVarByAes.prototype.interceptX = function () {\n return TransformVar_getInstance().XINTERCEPT;\n };\n TransformVar$TransformVarByAes.prototype.interceptY = function () {\n return TransformVar_getInstance().YINTERCEPT;\n };\n TransformVar$TransformVarByAes.prototype.lower = function () {\n return TransformVar_getInstance().LOWER;\n };\n TransformVar$TransformVarByAes.prototype.middle = function () {\n return TransformVar_getInstance().MIDDLE;\n };\n TransformVar$TransformVarByAes.prototype.upper = function () {\n return TransformVar_getInstance().UPPER;\n };\n TransformVar$TransformVarByAes.prototype.frame = function () {\n return TransformVar_getInstance().FRAME;\n };\n TransformVar$TransformVarByAes.prototype.speed = function () {\n return TransformVar_getInstance().SPEED;\n };\n TransformVar$TransformVarByAes.prototype.flow = function () {\n return TransformVar_getInstance().FLOW;\n };\n TransformVar$TransformVarByAes.prototype.xmin = function () {\n return TransformVar_getInstance().XMIN;\n };\n TransformVar$TransformVarByAes.prototype.xmax = function () {\n return TransformVar_getInstance().XMAX;\n };\n TransformVar$TransformVarByAes.prototype.xend = function () {\n return TransformVar_getInstance().XEND;\n };\n TransformVar$TransformVarByAes.prototype.yend = function () {\n return TransformVar_getInstance().YEND;\n };\n TransformVar$TransformVarByAes.prototype.label = function () {\n return TransformVar_getInstance().LABEL;\n };\n TransformVar$TransformVarByAes.prototype.family = function () {\n return TransformVar_getInstance().FONT_FAMILY;\n };\n TransformVar$TransformVarByAes.prototype.fontface = function () {\n return TransformVar_getInstance().FONT_FACE;\n };\n TransformVar$TransformVarByAes.prototype.hjust = function () {\n return TransformVar_getInstance().HJUST;\n };\n TransformVar$TransformVarByAes.prototype.vjust = function () {\n return TransformVar_getInstance().VJUST;\n };\n TransformVar$TransformVarByAes.prototype.angle = function () {\n return TransformVar_getInstance().ANGLE;\n };\n TransformVar$TransformVarByAes.prototype.symX = function () {\n return TransformVar_getInstance().SYM_X;\n };\n TransformVar$TransformVarByAes.prototype.symY = function () {\n return TransformVar_getInstance().SYM_Y;\n };\n TransformVar$TransformVarByAes.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TransformVarByAes',\n interfaces: [AesVisitor]\n };\n TransformVar.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'TransformVar',\n interfaces: []\n };\n var TransformVar_instance = null;\n function TransformVar_getInstance() {\n if (TransformVar_instance === null) {\n new TransformVar();\n }return TransformVar_instance;\n }\n function ABLineGeom() {\n ABLineGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(ABLineGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return HLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n ABLineGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$, tmp$_0;\n var helper = (new GeomHelper(pos, coord, ctx)).createSvgElementHelper();\n helper.setStrokeAlphaEnabled_6taknv$(true);\n var viewPort = GeomBase$Companion_getInstance().aesViewPort_m7huy5$(aesthetics);\n var boundaries = collect.Iterables.toList_yl67zr$(viewPort.parts);\n var lines = ArrayList_init();\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var intercept = p.intercept();\n var slope = p.slope();\n if (data.SeriesUtil.allFinite_jma9l8$(intercept, slope)) {\n var p1 = new DoubleVector(viewPort.left, ensureNotNull(intercept) + viewPort.left * ensureNotNull(slope));\n var p2 = new DoubleVector(viewPort.right, p1.y + viewPort.dimension.x * slope);\n var s = new DoubleSegment(p1, p2);\n var lineEnds = HashSet_init_0(2);\n tmp$_0 = boundaries.iterator();\n while (tmp$_0.hasNext()) {\n var boundary = tmp$_0.next();\n var intersection = boundary.intersection_69p9e5$(s);\n if (intersection != null) {\n lineEnds.add_11rb$(intersection);\n if (lineEnds.size === 2) {\n break;\n }}}\n if (lineEnds.size === 2) {\n var it = lineEnds.iterator();\n var line = helper.createLine_ollnar$(it.next(), it.next(), p);\n lines.add_11rb$(line);\n }}}\n var tmp$_1;\n tmp$_1 = lines.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n root.add_26jijc$(element);\n }\n };\n function ABLineGeom$Companion() {\n ABLineGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n ABLineGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ABLineGeom$Companion_instance = null;\n function ABLineGeom$Companion_getInstance() {\n if (ABLineGeom$Companion_instance === null) {\n new ABLineGeom$Companion();\n }return ABLineGeom$Companion_instance;\n }\n ABLineGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ABLineGeom',\n interfaces: [GeomBase]\n };\n function AreaGeom() {\n AreaGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n AreaGeom.prototype.dataPoints_m7huy5$ = function (aesthetics) {\n return GeomUtil_getInstance().ordered_X_83glv4$(aesthetics.dataPoints());\n };\n AreaGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var dataPoints = this.dataPoints_m7huy5$(aesthetics);\n var helper = new LinesHelper(pos, coord, ctx);\n var paths = helper.createBands_22uu1u$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_Y, GeomUtil_getInstance().TO_LOCATION_X_ZERO);\n reverse(paths);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(paths, root);\n helper.setAlphaEnabled_6taknv$(false);\n var lines = helper.createLines_rrreuh$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_Y);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(lines, root);\n this.buildHints_69ip36$_0(aesthetics, pos, coord, ctx);\n };\n function AreaGeom$buildHints$lambda(closure$geomHelper, this$AreaGeom) {\n return function (p) {\n return this$AreaGeom.toClient_6nkesc$_0(closure$geomHelper, p);\n };\n }\n AreaGeom.prototype.buildHints_69ip36$_0 = function (aesthetics, pos, coord, ctx) {\n var tmp$;\n var geomHelper = new GeomHelper(pos, coord, ctx);\n var $receiver = this.dataPoints_m7huy5$(aesthetics);\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var x = element.x();\n var y = element.y();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y) && coord.isPointInLimits_k2qmv6$(new DoubleVector(ensureNotNull(x), ensureNotNull(y)), false))\n destination.add_11rb$(element);\n }\n var dataPoints = destination;\n var multiPointDataList = MultiPointDataConstructor_getInstance().createMultiPointDataByGroup_ugj9hh$(dataPoints, MultiPointDataConstructor_getInstance().singlePointAppender_v9bvvf$(AreaGeom$buildHints$lambda(geomHelper, this)), MultiPointDataConstructor_getInstance().reducer_8555vt$(0.999, false));\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n tmp$ = multiPointDataList.iterator();\n while (tmp$.hasNext()) {\n var multiPointData = tmp$.next();\n targetCollector.addPath_sa5m83$(multiPointData.points, multiPointData.localToGlobalIndex, this.setupTooltipParams_l6g9mh$(multiPointData.aes));\n }\n };\n AreaGeom.prototype.setupTooltipParams_l6g9mh$ = function (aes) {\n return GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromFill_l6g9mh$(aes));\n };\n AreaGeom.prototype.toClient_6nkesc$_0 = function (geomHelper, p) {\n var tmp$;\n var coord = GeomUtil_getInstance().TO_LOCATION_X_Y(p);\n if (coord != null) {\n tmp$ = geomHelper.toClient_tkjljq$(coord, p);\n } else {\n tmp$ = null;\n }\n return tmp$;\n };\n function AreaGeom$Companion() {\n AreaGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n AreaGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AreaGeom$Companion_instance = null;\n function AreaGeom$Companion_getInstance() {\n if (AreaGeom$Companion_instance === null) {\n new AreaGeom$Companion();\n }return AreaGeom$Companion_instance;\n }\n AreaGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AreaGeom',\n interfaces: [GeomBase]\n };\n function BarGeom() {\n BarGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n function BarGeom$buildIntern$lambda(it) {\n return HintColorUtil_getInstance().fromFill_l6g9mh$(it);\n }\n BarGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var helper = new RectanglesHelper(aesthetics, pos, coord, ctx);\n var rectangles = helper.createRectangles_rezc4r$(BarGeom$Companion_getInstance().rectangleByDataPoint_0(ctx));\n reverse(rectangles);\n var tmp$;\n tmp$ = rectangles.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n root.add_26jijc$(element);\n }\n BarTooltipHelper_getInstance().collectRectangleTargets_mj9gdb$(emptyList(), aesthetics, pos, coord, ctx, BarGeom$Companion_getInstance().rectangleByDataPoint_0(ctx), BarGeom$buildIntern$lambda);\n };\n function BarGeom$Companion() {\n BarGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n function BarGeom$Companion$rectangleByDataPoint$lambda(closure$ctx) {\n return function (p) {\n var x = p.x();\n var y = p.y();\n var w = p.width();\n return !data.SeriesUtil.allFinite_xjrefz$(x, y, w) ? null : GeomUtil_getInstance().rectangleByDataPoint_dyn5n6$(p, closure$ctx);\n };\n }\n BarGeom$Companion.prototype.rectangleByDataPoint_0 = function (ctx) {\n return BarGeom$Companion$rectangleByDataPoint$lambda(ctx);\n };\n BarGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BarGeom$Companion_instance = null;\n function BarGeom$Companion_getInstance() {\n if (BarGeom$Companion_instance === null) {\n new BarGeom$Companion();\n }return BarGeom$Companion_instance;\n }\n BarGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BarGeom',\n interfaces: [GeomBase]\n };\n function Bin2dGeom() {\n Bin2dGeom$Companion_getInstance();\n TileGeom.call(this);\n }\n function Bin2dGeom$Companion() {\n Bin2dGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n Bin2dGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Bin2dGeom$Companion_instance = null;\n function Bin2dGeom$Companion_getInstance() {\n if (Bin2dGeom$Companion_instance === null) {\n new Bin2dGeom$Companion();\n }return Bin2dGeom$Companion_instance;\n }\n Bin2dGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Bin2dGeom',\n interfaces: [TileGeom]\n };\n function BoxplotGeom() {\n BoxplotGeom$Companion_getInstance();\n GeomBase.call(this);\n this.fattenMidline = 1.0;\n this.outlierColor = null;\n this.outlierFill = null;\n this.outlierShape = null;\n this.outlierSize = null;\n }\n Object.defineProperty(BoxplotGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return BoxplotGeom$Companion_getInstance().LEGEND_FACTORY_0;\n }\n });\n function BoxplotGeom$buildIntern$lambda(it) {\n return HintColorUtil_getInstance().fromColor_l6g9mh$(it);\n }\n BoxplotGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n CrossBarHelper_getInstance().buildBoxes_sm51l0$(root, aesthetics, pos, coord, ctx, BoxplotGeom$Companion_getInstance().rectangleByDataPoint_0(ctx));\n this.buildLines_0(root, aesthetics, pos, coord, ctx);\n this.buildOutliers_0(root, aesthetics, pos, coord, ctx);\n BarTooltipHelper_getInstance().collectRectangleTargets_mj9gdb$(listOf([Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().UPPER, Aes$Companion_getInstance().MIDDLE, Aes$Companion_getInstance().LOWER, Aes$Companion_getInstance().YMIN]), aesthetics, pos, coord, ctx, BoxplotGeom$Companion_getInstance().rectangleByDataPoint_0(ctx), BoxplotGeom$buildIntern$lambda);\n };\n BoxplotGeom.prototype.buildLines_0 = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n CrossBarHelper_getInstance().buildMidlines_z5ejb9$(root, aesthetics, pos, coord, ctx, this.fattenMidline);\n var helper = new GeomHelper(pos, coord, ctx);\n var elementHelper = helper.createSvgElementHelper();\n tmp$ = GeomUtil_getInstance().withDefined_2oeq97$(aesthetics.dataPoints(), Aes$Companion_getInstance().X).iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = ensureNotNull(p.x());\n var lines = ArrayList_init();\n if (p.defined_896ixz$(Aes$Companion_getInstance().LOWER) && p.defined_896ixz$(Aes$Companion_getInstance().YMIN)) {\n var hinge = ensureNotNull(p.lower());\n var fence = ensureNotNull(p.ymin());\n lines.add_11rb$(elementHelper.createLine_ollnar$(new DoubleVector(x, hinge), new DoubleVector(x, fence), p));\n }if (p.defined_896ixz$(Aes$Companion_getInstance().UPPER) && p.defined_896ixz$(Aes$Companion_getInstance().YMAX)) {\n var hinge_0 = ensureNotNull(p.upper());\n var fence_0 = ensureNotNull(p.ymax());\n lines.add_11rb$(elementHelper.createLine_ollnar$(new DoubleVector(x, hinge_0), new DoubleVector(x, fence_0), p));\n var tmp$_0;\n tmp$_0 = lines.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n root.add_26jijc$(element);\n }\n }}\n };\n BoxplotGeom.prototype.buildOutliers_0 = function (root, aesthetics, pos, coord, ctx) {\n var outlierAesthetics = this.getOutliersAesthetics_0(aesthetics);\n (new PointGeom()).buildIntern_uzv8ab$(root, outlierAesthetics, pos, coord, ctx.withTargetCollector_xrq6q$(new NullGeomTargetCollector()));\n };\n function BoxplotGeom$getOutliersAesthetics$lambda(this$BoxplotGeom) {\n return function (p) {\n return this$BoxplotGeom.toOutlierDataPointAesthetics_0(p);\n };\n }\n BoxplotGeom.prototype.getOutliersAesthetics_0 = function (aesthetics) {\n return new MappedAesthetics(aesthetics, BoxplotGeom$getOutliersAesthetics$lambda(this));\n };\n function BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral(this$BoxplotGeom, p) {\n this.this$BoxplotGeom = this$BoxplotGeom;\n DataPointAestheticsDelegate.call(this, p);\n }\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.get_31786j$ = function (aes) {\n return this.getIntern_0(aes);\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.color = function () {\n return this.getIntern_0(Aes$Companion_getInstance().COLOR);\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.fill = function () {\n return this.getIntern_0(Aes$Companion_getInstance().FILL);\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.shape = function () {\n return this.getIntern_0(Aes$Companion_getInstance().SHAPE);\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.size = function () {\n return this.getIntern_0(Aes$Companion_getInstance().SIZE);\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.getIntern_0 = function (aes) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n if (equals(aes, Aes$Companion_getInstance().COLOR))\n tmp$_3 = (tmp$ = this.this$BoxplotGeom.outlierColor) != null ? tmp$ : DataPointAestheticsDelegate.prototype.color.call(this);\n else if (equals(aes, Aes$Companion_getInstance().FILL))\n tmp$_3 = (tmp$_0 = this.this$BoxplotGeom.outlierFill) != null ? tmp$_0 : DataPointAestheticsDelegate.prototype.fill.call(this);\n else if (equals(aes, Aes$Companion_getInstance().SHAPE))\n tmp$_3 = (tmp$_1 = this.this$BoxplotGeom.outlierShape) != null ? tmp$_1 : DataPointAestheticsDelegate.prototype.shape.call(this);\n else if (equals(aes, Aes$Companion_getInstance().SIZE))\n tmp$_3 = (tmp$_2 = this.this$BoxplotGeom.outlierSize) != null ? tmp$_2 : BoxplotGeom$Companion_getInstance().OUTLIER_DEF_SIZE_0;\n else\n tmp$_3 = DataPointAestheticsDelegate.prototype.get_31786j$.call(this, aes);\n var value = tmp$_3;\n return (tmp$_4 = value) == null || Kotlin.isType(tmp$_4, Any) ? tmp$_4 : throwCCE();\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DataPointAestheticsDelegate]\n };\n BoxplotGeom.prototype.toOutlierDataPointAesthetics_0 = function (p) {\n if (!p.defined_896ixz$(Aes$Companion_getInstance().Y)) {\n return p;\n }return new BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral(this, p);\n };\n function BoxplotGeom$Companion() {\n BoxplotGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n this.LEGEND_FACTORY_0 = CrossBarHelper_getInstance().legendFactory_6taknv$(true);\n this.OUTLIER_DEF_SIZE_0 = AestheticsDefaults$Companion_getInstance().point().defaultValue_31786j$(Aes$Companion_getInstance().SIZE);\n }\n function BoxplotGeom$Companion$rectangleByDataPoint$lambda(closure$ctx) {\n return function (p) {\n if (p.defined_896ixz$(Aes$Companion_getInstance().X) && p.defined_896ixz$(Aes$Companion_getInstance().LOWER) && p.defined_896ixz$(Aes$Companion_getInstance().UPPER) && p.defined_896ixz$(Aes$Companion_getInstance().WIDTH)) {\n var x = ensureNotNull(p.x());\n var lower = ensureNotNull(p.lower());\n var upper = ensureNotNull(p.upper());\n var width = GeomUtil_getInstance().widthPx_c6teas$(p, closure$ctx, 2.0);\n var origin = new DoubleVector(x - width / 2, lower);\n var dimensions = new DoubleVector(width, upper - lower);\n return new DoubleRectangle(origin, dimensions);\n } else {\n return null;\n }\n };\n }\n BoxplotGeom$Companion.prototype.rectangleByDataPoint_0 = function (ctx) {\n return BoxplotGeom$Companion$rectangleByDataPoint$lambda(ctx);\n };\n BoxplotGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BoxplotGeom$Companion_instance = null;\n function BoxplotGeom$Companion_getInstance() {\n if (BoxplotGeom$Companion_instance === null) {\n new BoxplotGeom$Companion();\n }return BoxplotGeom$Companion_instance;\n }\n BoxplotGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BoxplotGeom',\n interfaces: [GeomBase]\n };\n function ContourGeom() {\n ContourGeom$Companion_getInstance();\n PathGeom.call(this);\n }\n function ContourGeom$Companion() {\n ContourGeom$Companion_instance = this;\n this.HANDLES_GROUPS = PathGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n ContourGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContourGeom$Companion_instance = null;\n function ContourGeom$Companion_getInstance() {\n if (ContourGeom$Companion_instance === null) {\n new ContourGeom$Companion();\n }return ContourGeom$Companion_instance;\n }\n ContourGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContourGeom',\n interfaces: [PathGeom]\n };\n function ContourfGeom() {\n ContourfGeom$Companion_getInstance();\n PolygonGeom.call(this);\n }\n function ContourfGeom$Companion() {\n ContourfGeom$Companion_instance = this;\n this.HANDLES_GROUPS = PolygonGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n ContourfGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContourfGeom$Companion_instance = null;\n function ContourfGeom$Companion_getInstance() {\n if (ContourfGeom$Companion_instance === null) {\n new ContourfGeom$Companion();\n }return ContourfGeom$Companion_instance;\n }\n ContourfGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContourfGeom',\n interfaces: [PolygonGeom]\n };\n function CrossBarGeom() {\n CrossBarGeom$Companion_getInstance();\n GeomBase.call(this);\n this.fattenMidline = 2.5;\n }\n Object.defineProperty(CrossBarGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return CrossBarGeom$Companion_getInstance().LEGEND_FACTORY_0;\n }\n });\n function CrossBarGeom$buildIntern$lambda(it) {\n return HintColorUtil_getInstance().fromColor_l6g9mh$(it);\n }\n CrossBarGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n CrossBarHelper_getInstance().buildBoxes_sm51l0$(root, aesthetics, pos, coord, ctx, CrossBarGeom$Companion_getInstance().rectangleByDataPoint_0(ctx, false));\n CrossBarHelper_getInstance().buildMidlines_z5ejb9$(root, aesthetics, pos, coord, ctx, this.fattenMidline);\n BarTooltipHelper_getInstance().collectRectangleTargets_mj9gdb$(listOf([Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().YMIN]), aesthetics, pos, coord, ctx, CrossBarGeom$Companion_getInstance().rectangleByDataPoint_0(ctx, true), CrossBarGeom$buildIntern$lambda);\n };\n function CrossBarGeom$Companion() {\n CrossBarGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n this.LEGEND_FACTORY_0 = CrossBarHelper_getInstance().legendFactory_6taknv$(false);\n }\n function CrossBarGeom$Companion$rectangleByDataPoint$lambda(closure$isHintRect, closure$ctx) {\n return function (p) {\n if (!closure$isHintRect && p.defined_896ixz$(Aes$Companion_getInstance().X) && p.defined_896ixz$(Aes$Companion_getInstance().YMIN) && p.defined_896ixz$(Aes$Companion_getInstance().YMAX) && p.defined_896ixz$(Aes$Companion_getInstance().WIDTH)) {\n var x = ensureNotNull(p.x());\n var ymin = ensureNotNull(p.ymin());\n var ymax = ensureNotNull(p.ymax());\n var width = GeomUtil_getInstance().widthPx_c6teas$(p, closure$ctx, 2.0);\n var origin = new DoubleVector(x - width / 2, ymin);\n var dimensions = new DoubleVector(width, ymax - ymin);\n return new DoubleRectangle(origin, dimensions);\n } else if (closure$isHintRect && p.defined_896ixz$(Aes$Companion_getInstance().X) && p.defined_896ixz$(Aes$Companion_getInstance().MIDDLE)) {\n var x_0 = ensureNotNull(p.x());\n var middle = ensureNotNull(p.middle());\n var width_0 = GeomUtil_getInstance().widthPx_c6teas$(p, closure$ctx, 2.0);\n var origin_0 = new DoubleVector(x_0 - width_0 / 2, middle);\n var dimensions_0 = new DoubleVector(width_0, 0.0);\n return new DoubleRectangle(origin_0, dimensions_0);\n } else {\n return null;\n }\n };\n }\n CrossBarGeom$Companion.prototype.rectangleByDataPoint_0 = function (ctx, isHintRect) {\n return CrossBarGeom$Companion$rectangleByDataPoint$lambda(isHintRect, ctx);\n };\n CrossBarGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var CrossBarGeom$Companion_instance = null;\n function CrossBarGeom$Companion_getInstance() {\n if (CrossBarGeom$Companion_instance === null) {\n new CrossBarGeom$Companion();\n }return CrossBarGeom$Companion_instance;\n }\n CrossBarGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CrossBarGeom',\n interfaces: [GeomBase]\n };\n function Density2dGeom() {\n Density2dGeom$Companion_getInstance();\n ContourGeom.call(this);\n }\n function Density2dGeom$Companion() {\n Density2dGeom$Companion_instance = this;\n this.HANDLES_GROUPS = ContourGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n Density2dGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Density2dGeom$Companion_instance = null;\n function Density2dGeom$Companion_getInstance() {\n if (Density2dGeom$Companion_instance === null) {\n new Density2dGeom$Companion();\n }return Density2dGeom$Companion_instance;\n }\n Density2dGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Density2dGeom',\n interfaces: [ContourGeom]\n };\n function Density2dfGeom() {\n Density2dfGeom$Companion_getInstance();\n ContourfGeom.call(this);\n }\n function Density2dfGeom$Companion() {\n Density2dfGeom$Companion_instance = this;\n this.HANDLES_GROUPS = ContourfGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n Density2dfGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Density2dfGeom$Companion_instance = null;\n function Density2dfGeom$Companion_getInstance() {\n if (Density2dfGeom$Companion_instance === null) {\n new Density2dfGeom$Companion();\n }return Density2dfGeom$Companion_instance;\n }\n Density2dfGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Density2dfGeom',\n interfaces: [ContourfGeom]\n };\n function DensityGeom() {\n DensityGeom$Companion_getInstance();\n AreaGeom.call(this);\n }\n DensityGeom.prototype.setupTooltipParams_l6g9mh$ = function (aes) {\n return GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(aes));\n };\n function DensityGeom$Companion() {\n DensityGeom$Companion_instance = this;\n this.HANDLES_GROUPS = AreaGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n DensityGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DensityGeom$Companion_instance = null;\n function DensityGeom$Companion_getInstance() {\n if (DensityGeom$Companion_instance === null) {\n new DensityGeom$Companion();\n }return DensityGeom$Companion_instance;\n }\n DensityGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DensityGeom',\n interfaces: [AreaGeom]\n };\n function ErrorBarGeom() {\n ErrorBarGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(ErrorBarGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new ErrorBarGeom$MyLegendKeyElementFactory();\n }\n });\n ErrorBarGeom.prototype.dataPoints_0 = function (aesthetics) {\n return GeomUtil_getInstance().with_X_83glv4$(aesthetics.dataPoints());\n };\n ErrorBarGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var helper = new LinesHelper(pos, coord, ctx);\n var dataPoints = this.dataPoints_0(aesthetics);\n var geomHelper = new GeomHelper(pos, coord, ctx);\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = p.x();\n var ymin = p.ymin();\n var ymax = p.ymax();\n if (!data.SeriesUtil.allFinite_xjrefz$(x, ymin, ymax)) {\n continue;\n }var width = ensureNotNull(p.width());\n width *= ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n var height = ensureNotNull(ymax) - ensureNotNull(ymin);\n var r = DoubleRectangle_init(ensureNotNull(x) - width / 2, ymin, width, height);\n var g = ErrorBarGeom$Companion_getInstance().errorBarShape_0(helper.toClient_ioi29i$(r, p), p);\n root.add_26jijc$(g);\n this.buildHints_0(DoubleRectangle_init(r.left, r.center.y, r.width, 0.0), p, ctx, geomHelper);\n }\n };\n ErrorBarGeom.prototype.buildHints_0 = function (rect, p, ctx, geomHelper) {\n var clientRect = geomHelper.toClient_ioi29i$(rect, p);\n var hint = (new HintsCollection$HintConfigFactory()).defaultObjectRadius_14dthe$(clientRect.width / 2.0).defaultX_14dthe$(ensureNotNull(p.x())).defaultKind_nnfttk$(TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance());\n var hints = (new HintsCollection(p, geomHelper)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMAX)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMIN)).hints;\n ctx.targetCollector.addRectangle_bxzvr8$(p.index(), clientRect, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setTipLayoutHints_vgcgsc$(hints).setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(p)));\n };\n function ErrorBarGeom$MyLegendKeyElementFactory() {\n }\n ErrorBarGeom$MyLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var width = ensureNotNull(p.width()) * (size.x - strokeWidth);\n var height = size.y - strokeWidth;\n var x = (size.x - width) / 2;\n var y = strokeWidth / 2;\n return ErrorBarGeom$Companion_getInstance().errorBarShape_0(DoubleRectangle_init(x, y, width, height), p);\n };\n ErrorBarGeom$MyLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function ErrorBarGeom$Companion() {\n ErrorBarGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n ErrorBarGeom$Companion.prototype.errorBarShape_0 = function (r, p) {\n var tmp$;\n var left = r.left;\n var top = r.top;\n var right = r.right;\n var bottom = r.bottom;\n var center = left + r.width / 2;\n var shapeLines = ArrayList_init();\n shapeLines.add_11rb$(SvgLineElement_init(left, top, right, top));\n shapeLines.add_11rb$(SvgLineElement_init(left, bottom, right, bottom));\n shapeLines.add_11rb$(SvgLineElement_init(center, top, center, bottom));\n var g = new SvgGElement();\n tmp$ = shapeLines.iterator();\n while (tmp$.hasNext()) {\n var shapeLine = tmp$.next();\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(shapeLine, p);\n g.children().add_11rb$(shapeLine);\n }\n return g;\n };\n ErrorBarGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ErrorBarGeom$Companion_instance = null;\n function ErrorBarGeom$Companion_getInstance() {\n if (ErrorBarGeom$Companion_instance === null) {\n new ErrorBarGeom$Companion();\n }return ErrorBarGeom$Companion_instance;\n }\n ErrorBarGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ErrorBarGeom',\n interfaces: [GeomBase]\n };\n function FilledCircleLegendKeyElementFactory() {\n FilledCircleLegendKeyElementFactory$Companion_getInstance();\n }\n FilledCircleLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var location = new DoubleVector(size.x / 2, size.y / 2);\n var slimObject = PointShapeSvg_getInstance().create_d8smhz$(FilledCircleLegendKeyElementFactory$Companion_getInstance().SHAPE_0, location, p);\n var slimGroup = slim.SvgSlimElements.g_za3lpa$(1);\n slimObject.appendTo_i2myw1$(slimGroup);\n return GeomBase$Companion_getInstance().wrap_i2myw1$(slimGroup);\n };\n FilledCircleLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var shapeSize = FilledCircleLegendKeyElementFactory$Companion_getInstance().SHAPE_0.size_l6g9mh$(p);\n var strokeWidth = FilledCircleLegendKeyElementFactory$Companion_getInstance().SHAPE_0.strokeWidth_l6g9mh$(p);\n var size = shapeSize + strokeWidth + 2.0;\n return new DoubleVector(size, size);\n };\n function FilledCircleLegendKeyElementFactory$Companion() {\n FilledCircleLegendKeyElementFactory$Companion_instance = this;\n this.SHAPE_0 = NamedShape$FILLED_CIRCLE_getInstance();\n }\n FilledCircleLegendKeyElementFactory$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var FilledCircleLegendKeyElementFactory$Companion_instance = null;\n function FilledCircleLegendKeyElementFactory$Companion_getInstance() {\n if (FilledCircleLegendKeyElementFactory$Companion_instance === null) {\n new FilledCircleLegendKeyElementFactory$Companion();\n }return FilledCircleLegendKeyElementFactory$Companion_instance;\n }\n FilledCircleLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FilledCircleLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function FilledSquareLegendKeyElementFactory() {\n }\n FilledSquareLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var rect = SvgRectElement_init(0.0, 0.0, size.x, size.y);\n AestheticsUtil_getInstance().updateFill_v4tjbc$(rect, p);\n var g = new SvgGElement();\n g.children().add_11rb$(rect);\n return g;\n };\n FilledSquareLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FilledSquareLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function FreqpolyGeom() {\n FreqpolyGeom$Companion_getInstance();\n LineGeom.call(this);\n }\n function FreqpolyGeom$Companion() {\n FreqpolyGeom$Companion_instance = this;\n this.HANDLES_GROUPS = LineGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n FreqpolyGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var FreqpolyGeom$Companion_instance = null;\n function FreqpolyGeom$Companion_getInstance() {\n if (FreqpolyGeom$Companion_instance === null) {\n new FreqpolyGeom$Companion();\n }return FreqpolyGeom$Companion_instance;\n }\n FreqpolyGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FreqpolyGeom',\n interfaces: [LineGeom]\n };\n function GeomBase() {\n GeomBase$Companion_getInstance();\n }\n Object.defineProperty(GeomBase.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new GenericLegendKeyElementFactory();\n }\n });\n GeomBase.prototype.build_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n this.buildIntern_uzv8ab$(root, aesthetics, pos, coord, ctx);\n };\n GeomBase.prototype.getGeomTargetCollector_vl74i5$ = function (ctx) {\n return ctx.targetCollector;\n };\n function GeomBase$Companion() {\n GeomBase$Companion_instance = this;\n }\n GeomBase$Companion.prototype.wrap_i2myw1$ = function (slimGroup) {\n var g = new SvgGElement();\n g.isPrebuiltSubtree = true;\n g.children().add_11rb$(slimGroup.asDummySvgNode());\n return g;\n };\n GeomBase$Companion.prototype.wrap_4fnnkz$ = function (o) {\n var slimGroup = slim.SvgSlimElements.g_za3lpa$(1);\n o.appendTo_i2myw1$(slimGroup);\n return this.wrap_i2myw1$(slimGroup);\n };\n GeomBase$Companion.prototype.aesViewPort_m7huy5$ = function (aesthetics) {\n return this.rect_0(aesthetics.overallRange_vktour$(Aes$Companion_getInstance().X), aesthetics.overallRange_vktour$(Aes$Companion_getInstance().Y));\n };\n GeomBase$Companion.prototype.aesBoundingBox_m7huy5$ = function (aesthetics) {\n return this.rect_0(ensureNotNull(aesthetics.range_vktour$(Aes$Companion_getInstance().X)), ensureNotNull(aesthetics.range_vktour$(Aes$Companion_getInstance().Y)));\n };\n GeomBase$Companion.prototype.rect_0 = function (rangeX, rangeY) {\n return DoubleRectangle_init(rangeX.lowerEnd, rangeY.lowerEnd, data.SeriesUtil.span_4fzjta$(rangeX), data.SeriesUtil.span_4fzjta$(rangeY));\n };\n GeomBase$Companion.prototype.appendNodes_37zgbi$ = function (paths, root) {\n var tmp$;\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var path = tmp$.next();\n root.add_26jijc$(path.rootGroup);\n }\n };\n GeomBase$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomBase$Companion_instance = null;\n function GeomBase$Companion_getInstance() {\n if (GeomBase$Companion_instance === null) {\n new GeomBase$Companion();\n }return GeomBase$Companion_instance;\n }\n GeomBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomBase',\n interfaces: [Geom]\n };\n function HLineGeom() {\n HLineGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(HLineGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return HLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n HLineGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var geomHelper = new GeomHelper(pos, coord, ctx);\n var helper = geomHelper.createSvgElementHelper();\n helper.setStrokeAlphaEnabled_6taknv$(true);\n var viewPort = GeomBase$Companion_getInstance().aesViewPort_m7huy5$(aesthetics);\n var lines = ArrayList_init();\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var intercept = p.interceptY();\n if (data.SeriesUtil.isFinite_yrwdxb$(intercept)) {\n if (viewPort.yRange().contains_mef7kx$(ensureNotNull(intercept))) {\n var start = new DoubleVector(viewPort.left, intercept);\n var end = new DoubleVector(viewPort.right, intercept);\n var line = helper.createLine_ollnar$(start, end, p);\n lines.add_11rb$(line);\n var h = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var origin = new DoubleVector(start.x, intercept - h / 2 - 2.0);\n var dimensions = new DoubleVector(viewPort.dimension.x, h + 4.0);\n var rect = new DoubleRectangle(origin, dimensions);\n ctx.targetCollector.addRectangle_bxzvr8$(p.index(), geomHelper.toClient_ioi29i$(rect, p), GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(p)), TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance());\n }}}\n var tmp$_0;\n tmp$_0 = lines.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n root.add_26jijc$(element);\n }\n };\n function HLineGeom$Companion() {\n HLineGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n this.LEGEND_KEY_ELEMENT_FACTORY = new HLineLegendKeyElementFactory();\n }\n HLineGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HLineGeom$Companion_instance = null;\n function HLineGeom$Companion_getInstance() {\n if (HLineGeom$Companion_instance === null) {\n new HLineGeom$Companion();\n }return HLineGeom$Companion_instance;\n }\n HLineGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HLineGeom',\n interfaces: [GeomBase]\n };\n function HistogramGeom() {\n HistogramGeom$Companion_getInstance();\n BarGeom.call(this);\n }\n function HistogramGeom$Companion() {\n HistogramGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n HistogramGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HistogramGeom$Companion_instance = null;\n function HistogramGeom$Companion_getInstance() {\n if (HistogramGeom$Companion_instance === null) {\n new HistogramGeom$Companion();\n }return HistogramGeom$Companion_instance;\n }\n HistogramGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HistogramGeom',\n interfaces: [BarGeom]\n };\n function ImageGeom(imageUrl) {\n ImageGeom$Companion_getInstance();\n GeomBase.call(this);\n this.imageUrl_0 = imageUrl;\n }\n ImageGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n if (aesthetics.isEmpty)\n return;\n var p = aesthetics.dataPointAt_za3lpa$(0);\n var boundsAes = DoubleRectangle.Companion.span_qt8ska$(new DoubleVector(ensureNotNull(p.xmin()), ensureNotNull(p.ymin())), new DoubleVector(ensureNotNull(p.xmax()), ensureNotNull(p.ymax())));\n var helper = new GeomHelper(pos, coord, ctx);\n var boundsClient = helper.toClient_ioi29i$(boundsAes, p);\n var svgImageElement = SvgImageElement_init(boundsClient.origin.x, boundsClient.origin.y, boundsClient.dimension.x, boundsClient.dimension.y);\n svgImageElement.href().set_11rb$(this.imageUrl_0);\n root.add_26jijc$(svgImageElement);\n };\n function ImageGeom$Companion() {\n ImageGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n ImageGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ImageGeom$Companion_instance = null;\n function ImageGeom$Companion_getInstance() {\n if (ImageGeom$Companion_instance === null) {\n new ImageGeom$Companion();\n }return ImageGeom$Companion_instance;\n }\n ImageGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ImageGeom',\n interfaces: [GeomBase]\n };\n function JitterGeom() {\n JitterGeom$Companion_getInstance();\n PointGeom.call(this);\n }\n function JitterGeom$Companion() {\n JitterGeom$Companion_instance = this;\n this.HANDLES_GROUPS = PointGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n JitterGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var JitterGeom$Companion_instance = null;\n function JitterGeom$Companion_getInstance() {\n if (JitterGeom$Companion_instance === null) {\n new JitterGeom$Companion();\n }return JitterGeom$Companion_instance;\n }\n JitterGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JitterGeom',\n interfaces: [PointGeom]\n };\n function LineGeom() {\n LineGeom$Companion_getInstance();\n PathGeom.call(this);\n }\n LineGeom.prototype.dataPoints_m7huy5$ = function (aesthetics) {\n return GeomUtil_getInstance().ordered_X_83glv4$(PathGeom.prototype.dataPoints_m7huy5$.call(this, aesthetics));\n };\n function LineGeom$Companion() {\n LineGeom$Companion_instance = this;\n this.HANDLES_GROUPS = PathGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n LineGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LineGeom$Companion_instance = null;\n function LineGeom$Companion_getInstance() {\n if (LineGeom$Companion_instance === null) {\n new LineGeom$Companion();\n }return LineGeom$Companion_instance;\n }\n LineGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LineGeom',\n interfaces: [PathGeom]\n };\n function LineRangeGeom() {\n LineRangeGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(LineRangeGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return VLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n function LineRangeGeom$buildIntern$lambda(it) {\n return HintColorUtil_getInstance().fromColor_l6g9mh$(it);\n }\n LineRangeGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var geomHelper = new GeomHelper(pos, coord, ctx);\n var helper = geomHelper.createSvgElementHelper();\n tmp$ = GeomUtil_getInstance().withDefined_7jazl$(aesthetics.dataPoints(), Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX).iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = ensureNotNull(p.x());\n var ymin = ensureNotNull(p.ymin());\n var ymax = ensureNotNull(p.ymax());\n var start = new DoubleVector(x, ymin);\n var end = new DoubleVector(x, ymax);\n var line = helper.createLine_ollnar$(start, end, p);\n root.add_26jijc$(line);\n }\n BarTooltipHelper_getInstance().collectRectangleTargets_mj9gdb$(listOf([Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().YMIN]), aesthetics, pos, coord, ctx, LineRangeGeom$Companion_getInstance().rectangleByDataPoint(), LineRangeGeom$buildIntern$lambda);\n };\n function LineRangeGeom$Companion() {\n LineRangeGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n function LineRangeGeom$Companion$rectangleByDataPoint$lambda(p) {\n if (p.defined_896ixz$(Aes$Companion_getInstance().X) && p.defined_896ixz$(Aes$Companion_getInstance().YMIN) && p.defined_896ixz$(Aes$Companion_getInstance().YMAX)) {\n var x = ensureNotNull(p.x());\n var ymin = ensureNotNull(p.ymin());\n var ymax = ensureNotNull(p.ymax());\n var a = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var width = JsMath.max(a, 2.0) * 2.0;\n var height = ymax - ymin;\n var origin = new DoubleVector(x - width / 2, ymax - height / 2);\n var dimensions = new DoubleVector(width, 0.0);\n return new DoubleRectangle(origin, dimensions);\n } else {\n return null;\n }\n }\n LineRangeGeom$Companion.prototype.rectangleByDataPoint = function () {\n return LineRangeGeom$Companion$rectangleByDataPoint$lambda;\n };\n LineRangeGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LineRangeGeom$Companion_instance = null;\n function LineRangeGeom$Companion_getInstance() {\n if (LineRangeGeom$Companion_instance === null) {\n new LineRangeGeom$Companion();\n }return LineRangeGeom$Companion_instance;\n }\n LineRangeGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LineRangeGeom',\n interfaces: [GeomBase]\n };\n function LiveMapGeom(myDisplayMode) {\n LiveMapGeom$Companion_getInstance();\n this.myDisplayMode_0 = myDisplayMode;\n this.myMapProvider_pcd1rb$_0 = this.myMapProvider_pcd1rb$_0;\n }\n Object.defineProperty(LiveMapGeom.prototype, 'myMapProvider_0', {\n configurable: true,\n get: function () {\n if (this.myMapProvider_pcd1rb$_0 == null)\n return throwUPAE('myMapProvider');\n return this.myMapProvider_pcd1rb$_0;\n },\n set: function (myMapProvider) {\n this.myMapProvider_pcd1rb$_0 = myMapProvider;\n }\n });\n Object.defineProperty(LiveMapGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n var tmp$;\n switch (this.myDisplayMode_0.name) {\n case 'POINT':\n tmp$ = new PointLegendKeyElementFactory();\n break;\n case 'PIE':\n tmp$ = new FilledCircleLegendKeyElementFactory();\n break;\n default:tmp$ = new GenericLegendKeyElementFactory();\n break;\n }\n return tmp$;\n }\n });\n LiveMapGeom.prototype.build_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n throw IllegalStateException_init('Not applicable to live map');\n };\n LiveMapGeom.prototype.setLiveMapProvider_kld0fp$ = function (liveMapProvider) {\n this.myMapProvider_0 = liveMapProvider;\n };\n LiveMapGeom.prototype.createCanvasFigure_wthzt5$ = function (bounds) {\n return this.myMapProvider_0.createLiveMap_wthzt5$(bounds);\n };\n function LiveMapGeom$Companion() {\n LiveMapGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n LiveMapGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LiveMapGeom$Companion_instance = null;\n function LiveMapGeom$Companion_getInstance() {\n if (LiveMapGeom$Companion_instance === null) {\n new LiveMapGeom$Companion();\n }return LiveMapGeom$Companion_instance;\n }\n LiveMapGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LiveMapGeom',\n interfaces: [Geom]\n };\n function LiveMapProvider() {\n }\n function LiveMapProvider$LiveMapData(canvasFigure, targetLocator) {\n this.canvasFigure = canvasFigure;\n this.targetLocator = targetLocator;\n }\n LiveMapProvider$LiveMapData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LiveMapData',\n interfaces: []\n };\n LiveMapProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LiveMapProvider',\n interfaces: []\n };\n function MapGeom() {\n MapGeom$Companion_getInstance();\n PolygonGeom.call(this);\n }\n function MapGeom$Companion() {\n MapGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n MapGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var MapGeom$Companion_instance = null;\n function MapGeom$Companion_getInstance() {\n if (MapGeom$Companion_instance === null) {\n new MapGeom$Companion();\n }return MapGeom$Companion_instance;\n }\n MapGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MapGeom',\n interfaces: [PolygonGeom]\n };\n function PathGeom() {\n PathGeom$Companion_getInstance();\n GeomBase.call(this);\n this.animation = null;\n }\n Object.defineProperty(PathGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return HLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n PathGeom.prototype.dataPoints_m7huy5$ = function (aesthetics) {\n return GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints());\n };\n PathGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var dataPoints = this.dataPoints_m7huy5$(aesthetics);\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n var linesHelper = new LinesHelper(pos, coord, ctx);\n var geomConstructor = new LinePathConstructor(targetCollector, dataPoints, linesHelper, false);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(geomConstructor.construct_6taknv$(false), root);\n this.buildHints_9cwuu0$_0(aesthetics, coord, linesHelper, targetCollector);\n };\n PathGeom.prototype.buildHints_9cwuu0$_0 = function (aesthetics, coord, linesHelper, targetCollector) {\n var $receiver = this.dataPoints_m7huy5$(aesthetics);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var x = element.x();\n var y = element.y();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y) && coord.isPointInLimits_k2qmv6$(new DoubleVector(ensureNotNull(x), ensureNotNull(y)), false))\n destination.add_11rb$(element);\n }\n var dataPoints = destination;\n (new LinePathConstructor(targetCollector, dataPoints, linesHelper, false)).buildHints();\n };\n function PathGeom$Companion() {\n PathGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n PathGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PathGeom$Companion_instance = null;\n function PathGeom$Companion_getInstance() {\n if (PathGeom$Companion_instance === null) {\n new PathGeom$Companion();\n }return PathGeom$Companion_instance;\n }\n PathGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PathGeom',\n interfaces: [GeomBase]\n };\n function PieGeom(myCenter, myRadius) {\n PieGeom$Companion_getInstance();\n GeomBase.call(this);\n this.myCenter_0 = myCenter;\n this.myRadius_0 = myRadius;\n }\n PieGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var helper = new PieGeom$PieHelper(pos, coord, ctx);\n var segments = helper.createSegments_67zh1d$(aesthetics, this.myCenter_0, this.myRadius_0);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(segments, root);\n };\n function PieGeom$PieHelper(pos, coord, ctx) {\n LinesHelper.call(this, pos, coord, ctx);\n }\n PieGeom$PieHelper.prototype.createSegments_67zh1d$ = function (aesthetics, center, radius) {\n var tmp$;\n var result = ArrayList_init();\n var basis = new DoubleVector(0.0, -radius);\n var curAngle = kotlin_js_internal_DoubleCompanionObject.NaN;\n tmp$ = PieGeom$Companion_getInstance().dataPoints_0(aesthetics).iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var segmentSize = PieGeom$Companion_getInstance().shareToRad_0(ensureNotNull(p.y()));\n if (isNaN_0(curAngle)) {\n curAngle = segmentSize;\n }var angle = -segmentSize;\n var builder = new SvgPathDataBuilder(true);\n builder.moveTo_gpjtzr$(center);\n builder.lineTo_gpjtzr$(center.add_gpjtzr$(basis.rotate_14dthe$(curAngle)));\n var arcTo = center.add_gpjtzr$(basis.rotate_14dthe$(curAngle + angle));\n builder.ellipticalArc_gc0whr$(radius, radius, 0.0, -angle > math.PI, false, arcTo);\n builder.closePath();\n curAngle += angle;\n var path = new LinePath(builder);\n this.decorate_frjrd5$(path, p, true);\n result.add_11rb$(path);\n }\n return result;\n };\n PieGeom$PieHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PieHelper',\n interfaces: [LinesHelper]\n };\n function PieGeom$Companion() {\n PieGeom$Companion_instance = this;\n this.RENDERS = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().SIZE]);\n this.HANDLES_GROUPS = false;\n }\n PieGeom$Companion.prototype.dataPoints_0 = function (aesthetics) {\n var tmp$;\n var withX = GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints());\n if (collect.Iterables.isEmpty_fakr2g$(withX) || this.allEqualX_0(withX, collect.Iterables.get_7iig3d$(withX, 0).x())) {\n tmp$ = GeomUtil_getInstance().ordered_Y_hku6c7$(GeomUtil_getInstance().with_Y_83glv4$(aesthetics.dataPoints()), true);\n } else\n tmp$ = GeomUtil_getInstance().ordered_X_83glv4$(withX);\n return tmp$;\n };\n PieGeom$Companion.prototype.allEqualX_0 = function (hasX, val) {\n var tmp$;\n tmp$ = hasX.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n if (p.x() != val) {\n return false;\n }}\n return true;\n };\n PieGeom$Companion.prototype.shareToRad_0 = function (share) {\n return 0.9999 * 2.0 * math.PI * share;\n };\n PieGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PieGeom$Companion_instance = null;\n function PieGeom$Companion_getInstance() {\n if (PieGeom$Companion_instance === null) {\n new PieGeom$Companion();\n }return PieGeom$Companion_instance;\n }\n PieGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PieGeom',\n interfaces: [GeomBase]\n };\n function PointGeom() {\n PointGeom$Companion_getInstance();\n GeomBase.call(this);\n this.animation = null;\n this.sizeUnit = null;\n }\n Object.defineProperty(PointGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new PointLegendKeyElementFactory();\n }\n });\n PointGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var helper = new GeomHelper(pos, coord, ctx);\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n var count = aesthetics.dataPointCount();\n var slimGroup = slim.SvgSlimElements.g_za3lpa$(count);\n var sizeUnitRatio = this.getSizeUnitRatio_a8x9k9$_0(ctx);\n for (var i = 0; i < count; i++) {\n var p = aesthetics.dataPointAt_za3lpa$(i);\n var x = p.x();\n var y = p.y();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y)) {\n var location = helper.toClient_tkjljq$(new DoubleVector(ensureNotNull(x), ensureNotNull(y)), p);\n var shape = ensureNotNull(p.shape());\n targetCollector.addPoint_cnsimy$(i, location, sizeUnitRatio * shape.size_l6g9mh$(p) / 2, PointGeom$Companion_getInstance().tooltipParams_l6g9mh$(p));\n var o = PointShapeSvg_getInstance().create_d8smhz$(shape, location, p, sizeUnitRatio);\n o.appendTo_i2myw1$(slimGroup);\n }}\n root.add_26jijc$(GeomBase$Companion_getInstance().wrap_i2myw1$(slimGroup));\n };\n PointGeom.prototype.getSizeUnitRatio_a8x9k9$_0 = function (ctx) {\n var tmp$;\n if (this.sizeUnit != null) {\n var unitRes = ctx.getUnitResolution_vktour$(GeomHelper$Companion_getInstance().getSizeUnitAes_61zpoe$(ensureNotNull(this.sizeUnit)));\n tmp$ = unitRes / AesScaling_getInstance().UNIT_SHAPE_SIZE;\n } else {\n tmp$ = 1.0;\n }\n return tmp$;\n };\n function PointGeom$Companion() {\n PointGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n PointGeom$Companion.prototype.tooltipParams_l6g9mh$ = function (p) {\n var tmp$;\n var color = Color.Companion.TRANSPARENT;\n if (equals(p.shape(), TinyPointShape_getInstance())) {\n color = ensureNotNull(p.color());\n } else if (Kotlin.isType(p.shape(), NamedShape)) {\n var shape = Kotlin.isType(tmp$ = p.shape(), NamedShape) ? tmp$ : throwCCE();\n color = AestheticsUtil_getInstance().fill_edjgex$(shape.isFilled, shape.isSolid, p);\n }return GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColorValue_o14uds$(color, ensureNotNull(p.alpha())));\n };\n PointGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PointGeom$Companion_instance = null;\n function PointGeom$Companion_getInstance() {\n if (PointGeom$Companion_instance === null) {\n new PointGeom$Companion();\n }return PointGeom$Companion_instance;\n }\n PointGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointGeom',\n interfaces: [GeomBase]\n };\n function PointLegendKeyElementFactory(fatten) {\n if (fatten === void 0)\n fatten = 1.0;\n this.fatten_0 = fatten;\n }\n PointLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var location = new DoubleVector(size.x / 2, size.y / 2);\n var shape = ensureNotNull(p.shape());\n var slimObject = PointShapeSvg_getInstance().create_d8smhz$(shape, location, p, this.fatten_0);\n return GeomBase$Companion_getInstance().wrap_4fnnkz$(slimObject);\n };\n PointLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var shape = ensureNotNull(p.shape());\n var shapeSize = shape.size_l6g9mh$(p) * this.fatten_0;\n var strokeWidth = shape.strokeWidth_l6g9mh$(p);\n var size = shapeSize + strokeWidth + 2.0;\n return new DoubleVector(size, size);\n };\n PointLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function PointRangeGeom() {\n PointRangeGeom$Companion_getInstance();\n GeomBase.call(this);\n this.fattenMidPoint = PointRangeGeom$Companion_getInstance().DEF_FATTEN;\n }\n Object.defineProperty(PointRangeGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new CompositeLegendKeyElementFactory([new VLineLegendKeyElementFactory(), new PointLegendKeyElementFactory(PointRangeGeom$Companion_getInstance().DEF_FATTEN)]);\n }\n });\n function PointRangeGeom$buildIntern$lambda(it) {\n return HintColorUtil_getInstance().fromColor_l6g9mh$(it);\n }\n PointRangeGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var geomHelper = new GeomHelper(pos, coord, ctx);\n var helper = geomHelper.createSvgElementHelper();\n tmp$ = GeomUtil_getInstance().withDefined_i1kplo$(aesthetics.dataPoints(), Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX).iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = ensureNotNull(p.x());\n var y = ensureNotNull(p.y());\n var ymin = ensureNotNull(p.ymin());\n var ymax = ensureNotNull(p.ymax());\n var start = new DoubleVector(x, ymin);\n var end = new DoubleVector(x, ymax);\n var line = helper.createLine_ollnar$(start, end, p);\n root.add_26jijc$(line);\n var location = geomHelper.toClient_tkjljq$(new DoubleVector(x, y), p);\n var shape = ensureNotNull(p.shape());\n var o = PointShapeSvg_getInstance().create_d8smhz$(shape, location, p, this.fattenMidPoint);\n root.add_26jijc$(GeomBase$Companion_getInstance().wrap_4fnnkz$(o));\n }\n BarTooltipHelper_getInstance().collectRectangleTargets_mj9gdb$(listOf([Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().YMIN]), aesthetics, pos, coord, ctx, PointRangeGeom$Companion_getInstance().rectangleByDataPoint_14dthe$(this.fattenMidPoint), PointRangeGeom$buildIntern$lambda);\n };\n function PointRangeGeom$Companion() {\n PointRangeGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n this.DEF_FATTEN = 5.0;\n }\n function PointRangeGeom$Companion$rectangleByDataPoint$lambda(closure$fatten) {\n return function (p) {\n if (p.defined_896ixz$(Aes$Companion_getInstance().X) && p.defined_896ixz$(Aes$Companion_getInstance().Y)) {\n var x = ensureNotNull(p.x());\n var y = ensureNotNull(p.y());\n var shape = ensureNotNull(p.shape());\n var shapeSize = shape.size_l6g9mh$(p) * closure$fatten;\n var strokeWidth = shape.strokeWidth_l6g9mh$(p);\n var width = shapeSize + strokeWidth;\n var origin = new DoubleVector(x - width / 2, y);\n var dimensions = new DoubleVector(width, 0.0);\n return new DoubleRectangle(origin, dimensions);\n } else {\n return null;\n }\n };\n }\n PointRangeGeom$Companion.prototype.rectangleByDataPoint_14dthe$ = function (fatten) {\n return PointRangeGeom$Companion$rectangleByDataPoint$lambda(fatten);\n };\n PointRangeGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PointRangeGeom$Companion_instance = null;\n function PointRangeGeom$Companion_getInstance() {\n if (PointRangeGeom$Companion_instance === null) {\n new PointRangeGeom$Companion();\n }return PointRangeGeom$Companion_instance;\n }\n PointRangeGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointRangeGeom',\n interfaces: [GeomBase]\n };\n function PolygonGeom() {\n PolygonGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n PolygonGeom.prototype.dataPoints_m7huy5$ = function (aesthetics) {\n return GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints());\n };\n PolygonGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var dataPoints = this.dataPoints_m7huy5$(aesthetics);\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n var linesHelper = new LinesHelper(pos, coord, ctx);\n var geomConstructor = new LinePathConstructor(targetCollector, dataPoints, linesHelper, true);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(geomConstructor.construct_6taknv$(true), root);\n };\n function PolygonGeom$Companion() {\n PolygonGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n PolygonGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PolygonGeom$Companion_instance = null;\n function PolygonGeom$Companion_getInstance() {\n if (PolygonGeom$Companion_instance === null) {\n new PolygonGeom$Companion();\n }return PolygonGeom$Companion_instance;\n }\n PolygonGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolygonGeom',\n interfaces: [GeomBase]\n };\n function RasterGeom() {\n RasterGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(RasterGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new FilledSquareLegendKeyElementFactory();\n }\n });\n RasterGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$, tmp$_0;\n var iter = GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints()).iterator();\n if (!iter.hasNext()) {\n return;\n }var randomP = iter.next();\n var helper = new GeomHelper(pos, coord, ctx);\n var boundsXY = GeomBase$Companion_getInstance().aesBoundingBox_m7huy5$(aesthetics);\n var stepX = ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n var stepY = ctx.getResolution_vktour$(Aes$Companion_getInstance().Y);\n if (!(stepX > data.SeriesUtil.TINY)) {\n var message = 'x-step is too small: ' + stepX;\n throw IllegalArgumentException_init(message.toString());\n }if (!(stepY > data.SeriesUtil.TINY)) {\n var message_0 = 'y-step is too small: ' + stepY;\n throw IllegalArgumentException_init(message_0.toString());\n }var width = round(boundsXY.dimension.x / stepX) + 1;\n var height = round(boundsXY.dimension.y / stepY) + 1;\n if (width * height > 5000000) {\n var center = boundsXY.center;\n var lines = ['Raster image size', '[' + width + ' X ' + height + ']', 'exceeds capability', 'of', 'your imaging device'];\n var fontSize = 12.0;\n var lineHeight = fontSize + 4;\n var y = center.y + lineHeight * lines.length / 2.0;\n for (tmp$ = 0; tmp$ !== lines.length; ++tmp$) {\n var line = lines[tmp$];\n var label = new TextLabel(line);\n label.textColor().set_11rb$(Color.Companion.DARK_MAGENTA);\n label.textOpacity().set_11rb$(0.5);\n label.setFontSize_14dthe$(fontSize);\n label.setFontWeight_pdl1vj$('bold');\n label.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor$MIDDLE_getInstance());\n label.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor$CENTER_getInstance());\n var loc = helper.toClient_vf7nkp$(center.x, y, randomP);\n label.moveTo_gpjtzr$(loc);\n root.add_26jijc$(label.rootGroup);\n y -= lineHeight;\n }\n return;\n }var cols = numberToInt(round(width));\n var rows = numberToInt(round(height));\n var halfStep = new DoubleVector(stepX * 0.5, stepY * 0.5);\n var corner0 = helper.toClient_tkjljq$(boundsXY.origin.subtract_gpjtzr$(halfStep), randomP);\n var corner2 = helper.toClient_tkjljq$(boundsXY.origin.add_gpjtzr$(boundsXY.dimension).add_gpjtzr$(halfStep), randomP);\n var invertedX = corner2.x < corner0.x;\n var invertedY = corner2.y < corner0.y;\n var x0 = boundsXY.origin.x;\n var y0 = boundsXY.origin.y;\n var argbValues = new Int32Array(Kotlin.imul(cols, rows));\n tmp$_0 = GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints()).iterator();\n while (tmp$_0.hasNext()) {\n var p = tmp$_0.next();\n var x = p.x();\n var y_0 = p.y();\n var alpha = p.alpha();\n var color = p.fill();\n var col = numberToInt(round((ensureNotNull(x) - x0) / stepX));\n var row = numberToInt(round((ensureNotNull(y_0) - y0) / stepY));\n if (invertedX) {\n col = cols - (col + 1) | 0;\n }if (invertedY) {\n row = rows - (row + 1) | 0;\n }argbValues[Kotlin.imul(row, cols) + col | 0] = svg.SvgUtils.toARGB_o14uds$(ensureNotNull(color), ensureNotNull(alpha));\n }\n var bitmap = new SvgImageElementEx$Bitmap(cols, rows, argbValues);\n var a = corner0.x;\n var b = corner2.x;\n var tmp$_1 = JsMath.min(a, b);\n var a_0 = corner0.y;\n var b_0 = corner2.y;\n var tmp$_2 = JsMath.min(a_0, b_0);\n var x_0 = corner0.x - corner2.x;\n var tmp$_3 = JsMath.abs(x_0);\n var x_1 = corner0.y - corner2.y;\n var svgImageElement = new SvgImageElementEx(tmp$_1, tmp$_2, tmp$_3, JsMath.abs(x_1), bitmap);\n root.add_26jijc$(svgImageElement);\n };\n function RasterGeom$Companion() {\n RasterGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n RasterGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RasterGeom$Companion_instance = null;\n function RasterGeom$Companion_getInstance() {\n if (RasterGeom$Companion_instance === null) {\n new RasterGeom$Companion();\n }return RasterGeom$Companion_instance;\n }\n RasterGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RasterGeom',\n interfaces: [GeomBase]\n };\n function RectGeom() {\n RectGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n RectGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var helper = new RectanglesHelper(aesthetics, pos, coord, ctx);\n var $receiver = helper.createRectangles_rezc4r$(getCallableRef('rectangleByDataPoint', function ($receiver, p1) {\n return $receiver.rectangleByDataPoint_0(p1);\n }.bind(null, RectGeom$Companion_getInstance())));\n var action = getCallableRef('add', function ($receiver, p1) {\n return $receiver.add_26jijc$(p1), Unit;\n }.bind(null, root));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n action(element);\n }\n (new RectTargetCollectorHelper(helper, getCallableRef('rectangleByDataPoint', function ($receiver, p1) {\n return $receiver.rectangleByDataPoint_0(p1);\n }.bind(null, RectGeom$Companion_getInstance())), getCallableRef('fromFill', function ($receiver, p1) {\n return $receiver.fromFill_l6g9mh$(p1);\n }.bind(null, HintColorUtil_getInstance())), TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance())).collectTo_xrq6q$(ctx.targetCollector);\n };\n function RectGeom$Companion() {\n RectGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n RectGeom$Companion.prototype.rectangleByDataPoint_0 = function (p) {\n var tmp$;\n var xmin = p.xmin();\n var xmax = p.xmax();\n var ymin = p.ymin();\n var ymax = p.ymax();\n if (data.SeriesUtil.allFinite_rd1tgs$(xmin, xmax, ymin, ymax)) {\n tmp$ = DoubleRectangle.Companion.span_qt8ska$(new DoubleVector(ensureNotNull(xmin), ensureNotNull(ymin)), new DoubleVector(ensureNotNull(xmax), ensureNotNull(ymax)));\n } else {\n tmp$ = null;\n }\n return tmp$;\n };\n RectGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RectGeom$Companion_instance = null;\n function RectGeom$Companion_getInstance() {\n if (RectGeom$Companion_instance === null) {\n new RectGeom$Companion();\n }return RectGeom$Companion_instance;\n }\n RectGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RectGeom',\n interfaces: [GeomBase]\n };\n function RibbonGeom() {\n RibbonGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n RibbonGeom.prototype.dataPoints_0 = function (aesthetics) {\n var data = GeomUtil_getInstance().withDefined_7jazl$(aesthetics.dataPoints(), Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX);\n return GeomUtil_getInstance().ordered_X_83glv4$(data);\n };\n RibbonGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var dataPoints = this.dataPoints_0(aesthetics);\n var helper = new LinesHelper(pos, coord, ctx);\n var paths = helper.createBands_22uu1u$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_YMAX, GeomUtil_getInstance().TO_LOCATION_X_YMIN);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(paths, root);\n helper.setAlphaEnabled_6taknv$(false);\n var lines = helper.createLines_rrreuh$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_YMAX);\n lines.addAll_brywnq$(helper.createLines_rrreuh$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_YMIN));\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(lines, root);\n this.buildHints_0(aesthetics, pos, coord, ctx);\n };\n RibbonGeom.prototype.buildHints_0 = function (aesthetics, pos, coord, ctx) {\n var tmp$;\n var targetCollector = ctx.targetCollector;\n var helper = new GeomHelper(pos, coord, ctx);\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n this.addTarget_0(p, targetCollector, GeomUtil_getInstance().TO_LOCATION_X_YMAX, helper);\n }\n };\n RibbonGeom.prototype.addTarget_0 = function (p, collector, toLocation, helper) {\n var coord = toLocation(p);\n if (coord != null) {\n var hint = (new HintsCollection$HintConfigFactory()).defaultObjectRadius_14dthe$(0.0).defaultX_14dthe$(ensureNotNull(p.x())).defaultKind_nnfttk$(TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance()).defaultColor_yo1m5r$(ensureNotNull(p.fill()), null);\n var hintsCollection = (new HintsCollection(p, helper)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMAX)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMIN));\n collector.addPoint_cnsimy$(p.index(), helper.toClient_tkjljq$(coord, p), 0.0, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setTipLayoutHints_vgcgsc$(hintsCollection.hints));\n }};\n function RibbonGeom$Companion() {\n RibbonGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n RibbonGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RibbonGeom$Companion_instance = null;\n function RibbonGeom$Companion_getInstance() {\n if (RibbonGeom$Companion_instance === null) {\n new RibbonGeom$Companion();\n }return RibbonGeom$Companion_instance;\n }\n RibbonGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RibbonGeom',\n interfaces: [GeomBase]\n };\n function SegmentGeom() {\n SegmentGeom$Companion_getInstance();\n GeomBase.call(this);\n this.arrowSpec = null;\n this.animation = null;\n }\n Object.defineProperty(SegmentGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return HLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n function SegmentGeom$buildIntern$lambda(closure$p) {\n return function (it) {\n return closure$p.index();\n };\n }\n SegmentGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n var helper = (new GeomHelper(pos, coord, ctx)).createSvgElementHelper();\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n if (data.SeriesUtil.allFinite_rd1tgs$(p.x(), p.y(), p.xend(), p.yend())) {\n var start = new DoubleVector(ensureNotNull(p.x()), ensureNotNull(p.y()));\n var end = new DoubleVector(ensureNotNull(p.xend()), ensureNotNull(p.yend()));\n var line = helper.createLine_ollnar$(start, end, p);\n root.add_26jijc$(line);\n targetCollector.addPath_sa5m83$(listOf([coord.toClient_gpjtzr$(start), coord.toClient_gpjtzr$(end)]), SegmentGeom$buildIntern$lambda(p), GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(p)));\n if (this.arrowSpec != null) {\n var clientX1 = ensureNotNull(line.x1().get());\n var clientY1 = ensureNotNull(line.y1().get());\n var clientX2 = ensureNotNull(line.x2().get());\n var clientY2 = ensureNotNull(line.y2().get());\n var abscissa = clientX2 - clientX1;\n var ordinate = clientY2 - clientY1;\n if (abscissa !== 0.0 || ordinate !== 0.0) {\n var polarAngle = JsMath.atan2(ordinate, abscissa);\n var arrowAes = ensureNotNull(this.arrowSpec).toArrowAes_l6g9mh$(p);\n if (ensureNotNull(this.arrowSpec).isOnLastEnd) {\n var arrow = ensureNotNull(this.arrowSpec).createElement_yvo9jy$(polarAngle, clientX2, clientY2);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(arrow, arrowAes);\n root.add_26jijc$(arrow);\n }if (ensureNotNull(this.arrowSpec).isOnFirstEnd) {\n var arrow_0 = ensureNotNull(this.arrowSpec).createElement_yvo9jy$(polarAngle + math.PI, clientX1, clientY1);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(arrow_0, arrowAes);\n root.add_26jijc$(arrow_0);\n }}}}}\n };\n function SegmentGeom$Companion() {\n SegmentGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n SegmentGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SegmentGeom$Companion_instance = null;\n function SegmentGeom$Companion_getInstance() {\n if (SegmentGeom$Companion_instance === null) {\n new SegmentGeom$Companion();\n }return SegmentGeom$Companion_instance;\n }\n SegmentGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SegmentGeom',\n interfaces: [GeomBase]\n };\n function SmoothGeom() {\n SmoothGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(SmoothGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return HLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n SmoothGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var dataPoints = GeomUtil_getInstance().ordered_X_83glv4$(GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints()));\n var helper = new LinesHelper(pos, coord, ctx);\n helper.setAlphaEnabled_6taknv$(false);\n var regressionLines = helper.createLines_rrreuh$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_Y);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(regressionLines, root);\n helper.setAlphaFilter_m9g0ow$(SmoothGeom$Companion_getInstance().PROPORTION_0);\n helper.setWidthFilter_m9g0ow$(SmoothGeom$Companion_getInstance().ZERO_0);\n var bands = helper.createBands_22uu1u$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_YMAX, GeomUtil_getInstance().TO_LOCATION_X_YMIN);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(bands, root);\n this.buildHints_0(dataPoints, pos, coord, ctx);\n };\n SmoothGeom.prototype.buildHints_0 = function (dataPoints, pos, coord, ctx) {\n var tmp$;\n var helper = new GeomHelper(pos, coord, ctx);\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var xCoord = ensureNotNull(p.x());\n var objectRadius = 0.0;\n var hint = (new HintsCollection$HintConfigFactory()).defaultObjectRadius_14dthe$(objectRadius).defaultX_14dthe$(xCoord).defaultKind_nnfttk$(TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance()).defaultColor_yo1m5r$(ensureNotNull(p.fill()), SmoothGeom$Companion_getInstance().PROPORTION_0(p.alpha()));\n var hintsCollection = (new HintsCollection(p, helper)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMAX)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMIN)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().Y).color_98b62m$(ensureNotNull(p.color())));\n var clientCoord = helper.toClient_vf7nkp$(p.x(), p.y(), p);\n ctx.targetCollector.addPoint_cnsimy$(p.index(), clientCoord, objectRadius, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setTipLayoutHints_vgcgsc$(hintsCollection.hints));\n }\n };\n function SmoothGeom$Companion() {\n SmoothGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n this.PROPORTION_0 = SmoothGeom$Companion$PROPORTION$lambda;\n this.ZERO_0 = SmoothGeom$Companion$ZERO$lambda;\n }\n function SmoothGeom$Companion$PROPORTION$lambda(v) {\n return v == null ? null : v / 10;\n }\n function SmoothGeom$Companion$ZERO$lambda(f) {\n return 0.0;\n }\n SmoothGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SmoothGeom$Companion_instance = null;\n function SmoothGeom$Companion_getInstance() {\n if (SmoothGeom$Companion_instance === null) {\n new SmoothGeom$Companion();\n }return SmoothGeom$Companion_instance;\n }\n SmoothGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SmoothGeom',\n interfaces: [GeomBase]\n };\n function StepGeom() {\n StepGeom$Companion_getInstance();\n LineGeom.call(this);\n this.myDirection_0 = StepGeom$Companion_getInstance().DEF_DIRECTION;\n }\n StepGeom.prototype.setDirection_61zpoe$ = function (dir) {\n this.myDirection_0 = StepGeom$Direction$Companion_getInstance().toDirection_61zpoe$(dir);\n };\n StepGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var dataPoints = this.dataPoints_m7huy5$(aesthetics);\n var helper = new LinesHelper(pos, coord, ctx);\n var pathInfos = helper.createSteps_1fp004$(dataPoints, this.myDirection_0);\n tmp$ = pathInfos.iterator();\n while (tmp$.hasNext()) {\n var pathInfo = tmp$.next();\n root.add_26jijc$(pathInfo.path.rootGroup);\n }\n };\n function StepGeom$Direction(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function StepGeom$Direction_initFields() {\n StepGeom$Direction_initFields = function () {\n };\n StepGeom$Direction$HV_instance = new StepGeom$Direction('HV', 0);\n StepGeom$Direction$VH_instance = new StepGeom$Direction('VH', 1);\n StepGeom$Direction$Companion_getInstance();\n }\n var StepGeom$Direction$HV_instance;\n function StepGeom$Direction$HV_getInstance() {\n StepGeom$Direction_initFields();\n return StepGeom$Direction$HV_instance;\n }\n var StepGeom$Direction$VH_instance;\n function StepGeom$Direction$VH_getInstance() {\n StepGeom$Direction_initFields();\n return StepGeom$Direction$VH_instance;\n }\n function StepGeom$Direction$Companion() {\n StepGeom$Direction$Companion_instance = this;\n }\n StepGeom$Direction$Companion.prototype.toDirection_61zpoe$ = function (str) {\n var tmp$;\n switch (str) {\n case 'hv':\n case 'HV':\n tmp$ = StepGeom$Direction$HV_getInstance();\n break;\n case 'vh':\n case 'VH':\n tmp$ = StepGeom$Direction$VH_getInstance();\n break;\n default:throw IllegalArgumentException_init('Direction ' + str + \" is not allowed, only accept 'hv' or 'vh'\");\n }\n return tmp$;\n };\n StepGeom$Direction$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var StepGeom$Direction$Companion_instance = null;\n function StepGeom$Direction$Companion_getInstance() {\n StepGeom$Direction_initFields();\n if (StepGeom$Direction$Companion_instance === null) {\n new StepGeom$Direction$Companion();\n }return StepGeom$Direction$Companion_instance;\n }\n StepGeom$Direction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Direction',\n interfaces: [Enum]\n };\n function StepGeom$Direction$values() {\n return [StepGeom$Direction$HV_getInstance(), StepGeom$Direction$VH_getInstance()];\n }\n StepGeom$Direction.values = StepGeom$Direction$values;\n function StepGeom$Direction$valueOf(name) {\n switch (name) {\n case 'HV':\n return StepGeom$Direction$HV_getInstance();\n case 'VH':\n return StepGeom$Direction$VH_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.geom.StepGeom.Direction.' + name);\n }\n }\n StepGeom$Direction.valueOf_61zpoe$ = StepGeom$Direction$valueOf;\n function StepGeom$Companion() {\n StepGeom$Companion_instance = this;\n this.DEF_DIRECTION = StepGeom$Direction$HV_getInstance();\n this.HANDLES_GROUPS = LineGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n StepGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var StepGeom$Companion_instance = null;\n function StepGeom$Companion_getInstance() {\n if (StepGeom$Companion_instance === null) {\n new StepGeom$Companion();\n }return StepGeom$Companion_instance;\n }\n StepGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StepGeom',\n interfaces: [LineGeom]\n };\n function TextGeom() {\n TextGeom$Companion_getInstance();\n GeomBase.call(this);\n this.formatter = null;\n this.naValue = TextGeom$Companion_getInstance().DEF_NA_VALUE;\n this.sizeUnit = null;\n }\n Object.defineProperty(TextGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new TextLegendKeyElementFactory();\n }\n });\n TextGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var helper = new GeomHelper(pos, coord, ctx);\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n var sizeUnitRatio = this.getSizeUnitRatio_0(ctx);\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = p.x();\n var y = p.y();\n var text = this.toString_0(p.label());\n if (data.SeriesUtil.allFinite_jma9l8$(x, y) && !base.Strings.isNullOrEmpty_pdl1vj$(text)) {\n var label = new TextLabel(text);\n GeomHelper$Companion_getInstance().decorate_ijkgsm$(label, p, sizeUnitRatio);\n var loc = helper.toClient_vf7nkp$(x, y, p);\n label.moveTo_gpjtzr$(loc);\n root.add_26jijc$(label.rootGroup);\n targetCollector.addPoint_cnsimy$(p.index(), loc, sizeUnitRatio * AesScaling_getInstance().textSize_l6g9mh$(p) / 2, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(p)), TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance());\n }}\n };\n TextGeom.prototype.getSizeUnitRatio_0 = function (ctx) {\n var tmp$;\n if (this.sizeUnit != null) {\n var textWidth = 6.0;\n var unitRes = ctx.getUnitResolution_vktour$(GeomHelper$Companion_getInstance().getSizeUnitAes_61zpoe$(ensureNotNull(this.sizeUnit)));\n tmp$ = unitRes / textWidth;\n } else {\n tmp$ = 1.0;\n }\n return tmp$;\n };\n TextGeom.prototype.toString_0 = function (label) {\n var tmp$;\n if (label == null)\n tmp$ = this.naValue;\n else if (this.formatter != null)\n tmp$ = ensureNotNull(this.formatter).format_za3rmp$(label);\n else\n tmp$ = label.toString();\n return tmp$;\n };\n function TextGeom$Companion() {\n TextGeom$Companion_instance = this;\n this.DEF_NA_VALUE = 'n/a';\n this.HANDLES_GROUPS = false;\n }\n TextGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TextGeom$Companion_instance = null;\n function TextGeom$Companion_getInstance() {\n if (TextGeom$Companion_instance === null) {\n new TextGeom$Companion();\n }return TextGeom$Companion_instance;\n }\n TextGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TextGeom',\n interfaces: [GeomBase]\n };\n function TextLegendKeyElementFactory() {\n }\n TextLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var label = new TextLabel('a');\n GeomHelper$Companion_getInstance().decorate_ijkgsm$(label, p);\n label.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor$MIDDLE_getInstance());\n label.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor$CENTER_getInstance());\n label.moveTo_lu1900$(size.x / 2, size.y / 2);\n var g = new SvgGElement();\n g.children().add_11rb$(label.rootGroup);\n return g;\n };\n TextLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n return new DoubleVector(4.0, strokeWidth + 4);\n };\n TextLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TextLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function TileGeom() {\n TileGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n function TileGeom$buildIntern$lambda(p) {\n return HintColorUtil_getInstance().fromFill_l6g9mh$(p);\n }\n TileGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var helper = new RectanglesHelper(aesthetics, pos, coord, ctx);\n var slimGroup = helper.createSlimRectangles_rezc4r$(TileGeom$Companion_getInstance().rectangleByDataPoint_0(ctx));\n root.add_26jijc$(GeomBase$Companion_getInstance().wrap_i2myw1$(slimGroup));\n (new RectTargetCollectorHelper(helper, TileGeom$Companion_getInstance().rectangleByDataPoint_0(ctx), TileGeom$buildIntern$lambda, TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance())).collectTo_xrq6q$(ctx.targetCollector);\n };\n function TileGeom$Companion() {\n TileGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n function TileGeom$Companion$rectangleByDataPoint$lambda(closure$ctx) {\n return function (p) {\n var x = p.x();\n var y = p.y();\n var w = p.width();\n var h = p.height();\n var rect = null;\n if (data.SeriesUtil.allFinite_rd1tgs$(x, y, w, h)) {\n var width = ensureNotNull(w) * closure$ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n var height = ensureNotNull(h) * closure$ctx.getResolution_vktour$(Aes$Companion_getInstance().Y);\n var origin = new DoubleVector(ensureNotNull(x) - width / 2, ensureNotNull(y) - height / 2);\n var dimensions = new DoubleVector(width, height);\n rect = new DoubleRectangle(origin, dimensions);\n }return rect;\n };\n }\n TileGeom$Companion.prototype.rectangleByDataPoint_0 = function (ctx) {\n return TileGeom$Companion$rectangleByDataPoint$lambda(ctx);\n };\n TileGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TileGeom$Companion_instance = null;\n function TileGeom$Companion_getInstance() {\n if (TileGeom$Companion_instance === null) {\n new TileGeom$Companion();\n }return TileGeom$Companion_instance;\n }\n TileGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TileGeom',\n interfaces: [GeomBase]\n };\n function VLineGeom() {\n VLineGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(VLineGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return VLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n VLineGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var geomHelper = new GeomHelper(pos, coord, ctx);\n var helper = geomHelper.createSvgElementHelper();\n helper.setStrokeAlphaEnabled_6taknv$(true);\n var viewPort = GeomBase$Companion_getInstance().aesViewPort_m7huy5$(aesthetics);\n var lines = ArrayList_init();\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var intercept = p.interceptX();\n if (data.SeriesUtil.isFinite_yrwdxb$(intercept)) {\n if (viewPort.xRange().contains_mef7kx$(ensureNotNull(intercept))) {\n var start = new DoubleVector(intercept, viewPort.top);\n var end = new DoubleVector(intercept, viewPort.bottom);\n var line = helper.createLine_ollnar$(start, end, p);\n lines.add_11rb$(line);\n var a = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var width = JsMath.max(a, 2.0) * 2.0;\n var origin = new DoubleVector(intercept - width / 2, end.y);\n var dimensions = new DoubleVector(width, 0.0);\n var rect = new DoubleRectangle(origin, dimensions);\n ctx.targetCollector.addRectangle_bxzvr8$(p.index(), geomHelper.toClient_ioi29i$(rect, p), GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(p)));\n }}}\n var tmp$_0;\n tmp$_0 = lines.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n root.add_26jijc$(element);\n }\n };\n function VLineGeom$Companion() {\n VLineGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n this.LEGEND_KEY_ELEMENT_FACTORY = new VLineLegendKeyElementFactory();\n }\n VLineGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var VLineGeom$Companion_instance = null;\n function VLineGeom$Companion_getInstance() {\n if (VLineGeom$Companion_instance === null) {\n new VLineGeom$Companion();\n }return VLineGeom$Companion_instance;\n }\n VLineGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VLineGeom',\n interfaces: [GeomBase]\n };\n function CompositeLegendKeyElementFactory(factories) {\n this.factories_0 = factories;\n }\n CompositeLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var tmp$, tmp$_0;\n var g = new SvgGElement();\n tmp$ = this.factories_0;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var factory = tmp$[tmp$_0];\n g.children().add_11rb$(factory.createKeyElement_s1fn0c$(p, size));\n }\n return g;\n };\n CompositeLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n return LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$.call(this, p);\n };\n CompositeLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CompositeLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function GenericLegendKeyElementFactory() {\n }\n GenericLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var rect = SvgRectElement_init(0.0, 0.0, size.x, size.y);\n AestheticsUtil_getInstance().updateFill_v4tjbc$(rect, p);\n var line = SvgLineElement_init(0.0, size.y, size.x, 0.0);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(line, p);\n var g = new SvgGElement();\n g.children().add_11rb$(rect);\n g.children().add_11rb$(line);\n return g;\n };\n GenericLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GenericLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function HLineLegendKeyElementFactory() {\n }\n HLineLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var line = SvgLineElement_init(0.0, size.y / 2, size.x, size.y / 2);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(line, p);\n var g = new SvgGElement();\n g.children().add_11rb$(line);\n return g;\n };\n HLineLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n return new DoubleVector(4.0, strokeWidth + 4);\n };\n HLineLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HLineLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function VLineLegendKeyElementFactory() {\n }\n VLineLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var line = SvgLineElement_init(size.x / 2, 0.0, size.x / 2, size.y);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(line, p);\n var g = new SvgGElement();\n g.children().add_11rb$(line);\n return g;\n };\n VLineLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n return new DoubleVector(strokeWidth + 4, 4.0);\n };\n VLineLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VLineLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function ArrowSpec(angle, length, end, type) {\n this.angle = angle;\n this.length = length;\n this.end = end;\n this.type = type;\n }\n Object.defineProperty(ArrowSpec.prototype, 'isOnFirstEnd', {\n configurable: true,\n get: function () {\n return this.end === ArrowSpec$End$FIRST_getInstance() || this.end === ArrowSpec$End$BOTH_getInstance();\n }\n });\n Object.defineProperty(ArrowSpec.prototype, 'isOnLastEnd', {\n configurable: true,\n get: function () {\n return this.end === ArrowSpec$End$LAST_getInstance() || this.end === ArrowSpec$End$BOTH_getInstance();\n }\n });\n ArrowSpec.prototype.createElement_yvo9jy$ = function (polarAngle, x, y) {\n var tmp$ = Float64Array;\n var tmp$_0 = this.length;\n var x_0 = polarAngle - this.angle;\n var tmp$_1 = x - tmp$_0 * JsMath.cos(x_0);\n var tmp$_2 = this.length;\n var x_1 = polarAngle + this.angle;\n var xs = new tmp$([tmp$_1, x, x - tmp$_2 * JsMath.cos(x_1)]);\n var tmp$_3 = Float64Array;\n var tmp$_4 = this.length;\n var x_2 = polarAngle - this.angle;\n var tmp$_5 = y - tmp$_4 * JsMath.sin(x_2);\n var tmp$_6 = this.length;\n var x_3 = polarAngle + this.angle;\n var ys = new tmp$_3([tmp$_5, y, y - tmp$_6 * JsMath.sin(x_3)]);\n var b = (new SvgPathDataBuilder(true)).moveTo_przk3b$(xs[0], ys[0]);\n for (var i = 1; i <= 2; i++) {\n b.lineTo_przk3b$(xs[i], ys[i], true);\n }\n if (this.type === ArrowSpec$Type$CLOSED_getInstance()) {\n b.closePath();\n }return SvgPathElement_init(b.build());\n };\n function ArrowSpec$toArrowAes$ObjectLiteral(this$ArrowSpec, p) {\n DataPointAestheticsDelegate.call(this, p);\n this.myFilled_0 = this$ArrowSpec.type === ArrowSpec$Type$CLOSED_getInstance();\n }\n ArrowSpec$toArrowAes$ObjectLiteral.prototype.fill = function () {\n var tmp$;\n if (this.myFilled_0) {\n tmp$ = this.color();\n } else\n tmp$ = Color.Companion.TRANSPARENT;\n return tmp$;\n };\n ArrowSpec$toArrowAes$ObjectLiteral.prototype.lineType = function () {\n var tmp$;\n if (this.myFilled_0) {\n tmp$ = NamedLineType$SOLID_getInstance();\n } else\n tmp$ = DataPointAestheticsDelegate.prototype.lineType.call(this);\n return tmp$;\n };\n ArrowSpec$toArrowAes$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DataPointAestheticsDelegate]\n };\n ArrowSpec.prototype.toArrowAes_l6g9mh$ = function (p) {\n return new ArrowSpec$toArrowAes$ObjectLiteral(this, p);\n };\n function ArrowSpec$End(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ArrowSpec$End_initFields() {\n ArrowSpec$End_initFields = function () {\n };\n ArrowSpec$End$LAST_instance = new ArrowSpec$End('LAST', 0);\n ArrowSpec$End$FIRST_instance = new ArrowSpec$End('FIRST', 1);\n ArrowSpec$End$BOTH_instance = new ArrowSpec$End('BOTH', 2);\n }\n var ArrowSpec$End$LAST_instance;\n function ArrowSpec$End$LAST_getInstance() {\n ArrowSpec$End_initFields();\n return ArrowSpec$End$LAST_instance;\n }\n var ArrowSpec$End$FIRST_instance;\n function ArrowSpec$End$FIRST_getInstance() {\n ArrowSpec$End_initFields();\n return ArrowSpec$End$FIRST_instance;\n }\n var ArrowSpec$End$BOTH_instance;\n function ArrowSpec$End$BOTH_getInstance() {\n ArrowSpec$End_initFields();\n return ArrowSpec$End$BOTH_instance;\n }\n ArrowSpec$End.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'End',\n interfaces: [Enum]\n };\n function ArrowSpec$End$values() {\n return [ArrowSpec$End$LAST_getInstance(), ArrowSpec$End$FIRST_getInstance(), ArrowSpec$End$BOTH_getInstance()];\n }\n ArrowSpec$End.values = ArrowSpec$End$values;\n function ArrowSpec$End$valueOf(name) {\n switch (name) {\n case 'LAST':\n return ArrowSpec$End$LAST_getInstance();\n case 'FIRST':\n return ArrowSpec$End$FIRST_getInstance();\n case 'BOTH':\n return ArrowSpec$End$BOTH_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.geom.util.ArrowSpec.End.' + name);\n }\n }\n ArrowSpec$End.valueOf_61zpoe$ = ArrowSpec$End$valueOf;\n function ArrowSpec$Type(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ArrowSpec$Type_initFields() {\n ArrowSpec$Type_initFields = function () {\n };\n ArrowSpec$Type$OPEN_instance = new ArrowSpec$Type('OPEN', 0);\n ArrowSpec$Type$CLOSED_instance = new ArrowSpec$Type('CLOSED', 1);\n }\n var ArrowSpec$Type$OPEN_instance;\n function ArrowSpec$Type$OPEN_getInstance() {\n ArrowSpec$Type_initFields();\n return ArrowSpec$Type$OPEN_instance;\n }\n var ArrowSpec$Type$CLOSED_instance;\n function ArrowSpec$Type$CLOSED_getInstance() {\n ArrowSpec$Type_initFields();\n return ArrowSpec$Type$CLOSED_instance;\n }\n ArrowSpec$Type.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Type',\n interfaces: [Enum]\n };\n function ArrowSpec$Type$values() {\n return [ArrowSpec$Type$OPEN_getInstance(), ArrowSpec$Type$CLOSED_getInstance()];\n }\n ArrowSpec$Type.values = ArrowSpec$Type$values;\n function ArrowSpec$Type$valueOf(name) {\n switch (name) {\n case 'OPEN':\n return ArrowSpec$Type$OPEN_getInstance();\n case 'CLOSED':\n return ArrowSpec$Type$CLOSED_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.geom.util.ArrowSpec.Type.' + name);\n }\n }\n ArrowSpec$Type.valueOf_61zpoe$ = ArrowSpec$Type$valueOf;\n ArrowSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ArrowSpec',\n interfaces: []\n };\n function BarTooltipHelper() {\n BarTooltipHelper_instance = this;\n }\n BarTooltipHelper.prototype.collectRectangleTargets_mj9gdb$ = function (hintAesList, aesthetics, pos, coord, ctx, rectFactory, colorFactory) {\n var tmp$, tmp$_0;\n var helper = new GeomHelper(pos, coord, ctx);\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n tmp$_0 = rectFactory(p);\n if (tmp$_0 == null) {\n continue;\n }var rect = tmp$_0;\n var clientRect = helper.toClient_ioi29i$(DoubleRectangle_init(0.0, 0.0, rect.width, 0.0), p);\n var objectRadius = clientRect.width / 2.0;\n var xCoord = rect.center.x;\n var hintFactory = (new HintsCollection$HintConfigFactory()).defaultObjectRadius_14dthe$(objectRadius).defaultX_14dthe$(xCoord).defaultKind_nnfttk$(TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance());\n var tmp$_1;\n var accumulator = new HintsCollection(p, helper);\n tmp$_1 = hintAesList.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n accumulator = accumulator.addHint_p9kkqu$(hintFactory.create_vktour$(element));\n }\n var hintConfigs = accumulator;\n ctx.targetCollector.addRectangle_bxzvr8$(p.index(), helper.toClient_ioi29i$(rect, p), GeomTargetCollector$TooltipParams$Companion_getInstance().params().setTipLayoutHints_vgcgsc$(hintConfigs.hints).setColor_98b62m$(colorFactory(p)));\n }\n };\n BarTooltipHelper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'BarTooltipHelper',\n interfaces: []\n };\n var BarTooltipHelper_instance = null;\n function BarTooltipHelper_getInstance() {\n if (BarTooltipHelper_instance === null) {\n new BarTooltipHelper();\n }return BarTooltipHelper_instance;\n }\n function CrossBarHelper() {\n CrossBarHelper_instance = this;\n }\n CrossBarHelper.prototype.buildBoxes_sm51l0$ = function (root, aesthetics, pos, coord, ctx, rectFactory) {\n var helper = new RectanglesHelper(aesthetics, pos, coord, ctx);\n var rectangles = helper.createRectangles_rezc4r$(rectFactory);\n var tmp$;\n tmp$ = rectangles.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n root.add_26jijc$(element);\n }\n };\n CrossBarHelper.prototype.buildMidlines_z5ejb9$ = function (root, aesthetics, pos, coord, ctx, fatten) {\n var tmp$;\n var helper = new GeomHelper(pos, coord, ctx);\n var elementHelper = helper.createSvgElementHelper();\n tmp$ = GeomUtil_getInstance().withDefined_7jazl$(aesthetics.dataPoints(), Aes$Companion_getInstance().X, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().MIDDLE).iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = ensureNotNull(p.x());\n var middle = ensureNotNull(p.middle());\n var width = GeomUtil_getInstance().widthPx_c6teas$(p, ctx, 2.0);\n var line = elementHelper.createLine_ollnar$(new DoubleVector(x - width / 2, middle), new DoubleVector(x + width / 2, middle), p);\n var thickness = ensureNotNull(line.strokeWidth().get());\n line.strokeWidth().set_11rb$(thickness * fatten);\n root.add_26jijc$(line);\n }\n };\n CrossBarHelper.prototype.legendFactory_6taknv$ = function (whiskers) {\n return new CrossBarLegendKeyElementFactory(whiskers);\n };\n CrossBarHelper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'CrossBarHelper',\n interfaces: []\n };\n var CrossBarHelper_instance = null;\n function CrossBarHelper_getInstance() {\n if (CrossBarHelper_instance === null) {\n new CrossBarHelper();\n }return CrossBarHelper_instance;\n }\n function CrossBarLegendKeyElementFactory(whiskers) {\n this.whiskers = whiskers;\n }\n CrossBarLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var whiskerSize = 0.2;\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var width = (size.x - strokeWidth) * 0.8;\n var height = size.y - strokeWidth;\n var x = (size.x - width) / 2;\n var y = strokeWidth / 2;\n var boxHeight = height;\n var boxY = y;\n if (this.whiskers) {\n boxHeight = height * (1 - 2 * whiskerSize);\n boxY = y + height * whiskerSize;\n }var rect = SvgRectElement_init(x, boxY, width, boxHeight);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(rect, p);\n var middleY = y + height * 0.5;\n var middle = SvgLineElement_init(x, middleY, x + width, middleY);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(middle, p);\n var g = new SvgGElement();\n g.children().add_11rb$(rect);\n g.children().add_11rb$(middle);\n if (this.whiskers) {\n var middleX = x + width * 0.5;\n var lowerWhisker = SvgLineElement_init(middleX, y + height * (1 - whiskerSize), middleX, y + height);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(lowerWhisker, p);\n var upperWhisker = SvgLineElement_init(middleX, y, middleX, y + height * whiskerSize);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(upperWhisker, p);\n g.children().add_11rb$(lowerWhisker);\n g.children().add_11rb$(upperWhisker);\n }return g;\n };\n CrossBarLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CrossBarLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function DataPointAestheticsDelegate(p) {\n this.p_bcayt6$_0 = p;\n }\n DataPointAestheticsDelegate.prototype.index = function () {\n return this.p_bcayt6$_0.index();\n };\n DataPointAestheticsDelegate.prototype.x = function () {\n return this.p_bcayt6$_0.x();\n };\n DataPointAestheticsDelegate.prototype.y = function () {\n return this.p_bcayt6$_0.y();\n };\n DataPointAestheticsDelegate.prototype.z = function () {\n return this.p_bcayt6$_0.z();\n };\n DataPointAestheticsDelegate.prototype.ymin = function () {\n return this.p_bcayt6$_0.ymin();\n };\n DataPointAestheticsDelegate.prototype.ymax = function () {\n return this.p_bcayt6$_0.ymax();\n };\n DataPointAestheticsDelegate.prototype.color = function () {\n return this.p_bcayt6$_0.color();\n };\n DataPointAestheticsDelegate.prototype.fill = function () {\n return this.p_bcayt6$_0.fill();\n };\n DataPointAestheticsDelegate.prototype.alpha = function () {\n return this.p_bcayt6$_0.alpha();\n };\n DataPointAestheticsDelegate.prototype.shape = function () {\n return this.p_bcayt6$_0.shape();\n };\n DataPointAestheticsDelegate.prototype.lineType = function () {\n return this.p_bcayt6$_0.lineType();\n };\n DataPointAestheticsDelegate.prototype.size = function () {\n return this.p_bcayt6$_0.size();\n };\n DataPointAestheticsDelegate.prototype.width = function () {\n return this.p_bcayt6$_0.width();\n };\n DataPointAestheticsDelegate.prototype.height = function () {\n return this.p_bcayt6$_0.height();\n };\n DataPointAestheticsDelegate.prototype.weight = function () {\n return this.p_bcayt6$_0.weight();\n };\n DataPointAestheticsDelegate.prototype.intercept = function () {\n return this.p_bcayt6$_0.intercept();\n };\n DataPointAestheticsDelegate.prototype.slope = function () {\n return this.p_bcayt6$_0.slope();\n };\n DataPointAestheticsDelegate.prototype.interceptX = function () {\n return this.p_bcayt6$_0.interceptX();\n };\n DataPointAestheticsDelegate.prototype.interceptY = function () {\n return this.p_bcayt6$_0.interceptY();\n };\n DataPointAestheticsDelegate.prototype.lower = function () {\n return this.p_bcayt6$_0.lower();\n };\n DataPointAestheticsDelegate.prototype.middle = function () {\n return this.p_bcayt6$_0.middle();\n };\n DataPointAestheticsDelegate.prototype.upper = function () {\n return this.p_bcayt6$_0.upper();\n };\n DataPointAestheticsDelegate.prototype.frame = function () {\n return this.p_bcayt6$_0.frame();\n };\n DataPointAestheticsDelegate.prototype.speed = function () {\n return this.p_bcayt6$_0.speed();\n };\n DataPointAestheticsDelegate.prototype.flow = function () {\n return this.p_bcayt6$_0.flow();\n };\n DataPointAestheticsDelegate.prototype.xmin = function () {\n return this.p_bcayt6$_0.xmin();\n };\n DataPointAestheticsDelegate.prototype.xmax = function () {\n return this.p_bcayt6$_0.xmax();\n };\n DataPointAestheticsDelegate.prototype.xend = function () {\n return this.p_bcayt6$_0.xend();\n };\n DataPointAestheticsDelegate.prototype.yend = function () {\n return this.p_bcayt6$_0.yend();\n };\n DataPointAestheticsDelegate.prototype.label = function () {\n return this.p_bcayt6$_0.label();\n };\n DataPointAestheticsDelegate.prototype.family = function () {\n return this.p_bcayt6$_0.family();\n };\n DataPointAestheticsDelegate.prototype.fontface = function () {\n return this.p_bcayt6$_0.fontface();\n };\n DataPointAestheticsDelegate.prototype.hjust = function () {\n return this.p_bcayt6$_0.hjust();\n };\n DataPointAestheticsDelegate.prototype.vjust = function () {\n return this.p_bcayt6$_0.vjust();\n };\n DataPointAestheticsDelegate.prototype.angle = function () {\n return this.p_bcayt6$_0.angle();\n };\n DataPointAestheticsDelegate.prototype.symX = function () {\n return this.p_bcayt6$_0.symX();\n };\n DataPointAestheticsDelegate.prototype.symY = function () {\n return this.p_bcayt6$_0.symY();\n };\n DataPointAestheticsDelegate.prototype.group = function () {\n return this.p_bcayt6$_0.group();\n };\n DataPointAestheticsDelegate.prototype.numeric_vktour$ = function (aes) {\n return this.p_bcayt6$_0.numeric_vktour$(aes);\n };\n DataPointAestheticsDelegate.prototype.get_31786j$ = function (aes) {\n return this.p_bcayt6$_0.get_31786j$(aes);\n };\n DataPointAestheticsDelegate.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataPointAestheticsDelegate',\n interfaces: [DataPointAesthetics]\n };\n function GeomCoord(myCoord) {\n this.myCoord_0 = myCoord;\n }\n GeomCoord.prototype.toClient_gpjtzr$ = function (p) {\n return this.myCoord_0.toClient_gpjtzr$(p);\n };\n GeomCoord.prototype.fromClient_xoefl8$ = function (location) {\n return this.myCoord_0.fromClient_gpjtzr$(location);\n };\n function GeomCoord$toClient$lambda(this$GeomCoord) {\n return function (coord) {\n return this$GeomCoord.myCoord_0.toClient_gpjtzr$(coord);\n };\n }\n GeomCoord.prototype.toClient_wthzt5$ = function (r) {\n return this.translateRect_0(r, GeomCoord$toClient$lambda(this));\n };\n function GeomCoord$fromClient$lambda(this$GeomCoord) {\n return function (coord) {\n return this$GeomCoord.myCoord_0.fromClient_gpjtzr$(coord);\n };\n }\n GeomCoord.prototype.fromClient_wthzt5$ = function (r) {\n return this.translateRect_0(r, GeomCoord$fromClient$lambda(this));\n };\n GeomCoord.prototype.translateRect_0 = function (r, toLocation) {\n var r_0 = r;\n var xy1 = r_0.origin;\n var xy2 = new DoubleVector(r_0.right, r_0.bottom);\n var xy1cl = toLocation(xy1);\n var xy2cl = toLocation(xy2);\n if (!(xy1 != null ? xy1.equals(xy1cl) : null) || !(xy2 != null ? xy2.equals(xy2cl) : null)) {\n var a = xy1cl.x;\n var b = xy2cl.x;\n var xMin = JsMath.min(a, b);\n var a_0 = xy1cl.y;\n var b_0 = xy2cl.y;\n var yMin = JsMath.min(a_0, b_0);\n var a_1 = xy1cl.x;\n var b_1 = xy2cl.x;\n var xMax = JsMath.max(a_1, b_1);\n var a_2 = xy1cl.y;\n var b_2 = xy2cl.y;\n var yMax = JsMath.max(a_2, b_2);\n r_0 = DoubleRectangle_init(xMin, yMin, xMax - xMin, yMax - yMin);\n }return r_0;\n };\n GeomCoord.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomCoord',\n interfaces: []\n };\n function GeomHelper(myPos, coord, ctx) {\n GeomHelper$Companion_getInstance();\n this.myPos_ts7al2$_0 = myPos;\n this.ctx = ctx;\n this.myGeomCoord_mnazw1$_0 = new GeomCoord(coord);\n }\n GeomHelper.prototype.toClient_tkjljq$ = function (location, p) {\n return this.myGeomCoord_mnazw1$_0.toClient_gpjtzr$(this.adjust_umm47c$_0(location, p, this.myPos_ts7al2$_0, this.ctx));\n };\n GeomHelper.prototype.toClient_vf7nkp$ = function (x, y, p) {\n var location = new DoubleVector(ensureNotNull(x), ensureNotNull(y));\n return this.myGeomCoord_mnazw1$_0.toClient_gpjtzr$(this.adjust_umm47c$_0(location, p, this.myPos_ts7al2$_0, this.ctx));\n };\n GeomHelper.prototype.toClient_ioi29i$ = function (r, p) {\n var clientRect = this.myGeomCoord_mnazw1$_0.toClient_wthzt5$(this.adjust_en6it6$_0(r, p, this.myPos_ts7al2$_0, this.ctx));\n if (clientRect.width === 0.0) {\n clientRect = DoubleRectangle_init(clientRect.origin.x, clientRect.origin.y, 0.1, clientRect.height);\n }if (clientRect.height === 0.0) {\n clientRect = DoubleRectangle_init(clientRect.origin.x, clientRect.origin.y, clientRect.width, 0.1);\n }return clientRect;\n };\n GeomHelper.prototype.fromClient_gpjtzr$ = function (location) {\n return this.myGeomCoord_mnazw1$_0.fromClient_xoefl8$(location);\n };\n GeomHelper.prototype.adjust_umm47c$_0 = function (location, p, pos, ctx) {\n return pos.translate_tshsjz$(location, p, ctx);\n };\n GeomHelper.prototype.toClientRect_7iz5gz$ = function (p, aesMapper) {\n var tmp$;\n tmp$ = aesMapper(p);\n if (tmp$ == null) {\n return null;\n }var r = tmp$;\n return this.toClient_ioi29i$(r, p);\n };\n GeomHelper.prototype.adjust_en6it6$_0 = function (r, p, pos, ctx) {\n var leftTop = pos.translate_tshsjz$(r.origin, p, ctx);\n var rightBottom = pos.translate_tshsjz$(r.origin.add_gpjtzr$(r.dimension), p, ctx);\n return DoubleRectangle.Companion.span_qt8ska$(leftTop, rightBottom);\n };\n GeomHelper.prototype.project_rrreuh$ = function (dataPoints, projection) {\n var tmp$;\n var points = ArrayList_init();\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var location = projection(p);\n if (location != null) {\n var pp = this.toClient_tkjljq$(location, p);\n points.add_11rb$(pp);\n }}\n return points;\n };\n function GeomHelper$toClientLocation$lambda(closure$aesMapper, this$GeomHelper) {\n return function (aes) {\n var location = closure$aesMapper(aes);\n if (location != null) {\n return this$GeomHelper.toClient_tkjljq$(location, aes);\n } else {\n return null;\n }\n };\n }\n GeomHelper.prototype.toClientLocation_sfitzs$ = function (aesMapper) {\n return GeomHelper$toClientLocation$lambda(aesMapper, this);\n };\n GeomHelper.prototype.createSvgElementHelper = function () {\n return new GeomHelper$SvgElementHelper(this);\n };\n GeomHelper.prototype.toClient_je5qx7$ = function (locations, p) {\n var tmp$;\n var localLocations = ArrayList_init();\n tmp$ = locations.iterator();\n while (tmp$.hasNext()) {\n var location = tmp$.next();\n localLocations.add_11rb$(this.toClient_tkjljq$(location, p));\n }\n return localLocations;\n };\n function GeomHelper$SvgElementHelper($outer) {\n this.$outer = $outer;\n this.myStrokeAlphaEnabled_0 = false;\n }\n GeomHelper$SvgElementHelper.prototype.setStrokeAlphaEnabled_6taknv$ = function (b) {\n this.myStrokeAlphaEnabled_0 = b;\n };\n GeomHelper$SvgElementHelper.prototype.createLine_ollnar$ = function (start, end, p) {\n var start_0 = this.$outer.toClient_tkjljq$(start, p);\n var end_0 = this.$outer.toClient_tkjljq$(end, p);\n var line = SvgLineElement_init(start_0.x, start_0.y, end_0.x, end_0.y);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(line, p, this.myStrokeAlphaEnabled_0);\n return line;\n };\n GeomHelper$SvgElementHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SvgElementHelper',\n interfaces: []\n };\n function GeomHelper$Companion() {\n GeomHelper$Companion_instance = this;\n this.HJUST_MAP = mapOf([to('right', TextLabel$HorizontalAnchor$RIGHT_getInstance()), to('middle', TextLabel$HorizontalAnchor$MIDDLE_getInstance()), to('left', TextLabel$HorizontalAnchor$LEFT_getInstance()), to(0.0, TextLabel$HorizontalAnchor$RIGHT_getInstance()), to(0.5, TextLabel$HorizontalAnchor$MIDDLE_getInstance()), to(1.0, TextLabel$HorizontalAnchor$LEFT_getInstance())]);\n this.VJUST_MAP = mapOf([to('bottom', TextLabel$VerticalAnchor$BOTTOM_getInstance()), to('center', TextLabel$VerticalAnchor$CENTER_getInstance()), to('top', TextLabel$VerticalAnchor$TOP_getInstance()), to(0.0, TextLabel$VerticalAnchor$BOTTOM_getInstance()), to(0.5, TextLabel$VerticalAnchor$CENTER_getInstance()), to(1.0, TextLabel$VerticalAnchor$TOP_getInstance())]);\n this.FONT_WEIGHT_SET_0 = setOf(['bold', 'bolder', 'lighter']);\n this.FONT_STYLE_SET_0 = setOf(['italic', 'oblique']);\n this.FONT_FAMILY_MAP_0 = mapOf([to('sans', 'sans-serif'), to('serif', 'serif'), to('mono', 'monospace')]);\n }\n GeomHelper$Companion.prototype.decorate_ijkgsm$ = function (label, p, scale) {\n if (scale === void 0)\n scale = 1.0;\n var tmp$, tmp$_0;\n label.textColor().set_11rb$(p.color());\n label.textOpacity().set_11rb$(p.alpha());\n label.setFontSize_14dthe$(AesScaling_getInstance().textSize_l6g9mh$(p) * scale);\n var family = p.family();\n if (this.FONT_FAMILY_MAP_0.containsKey_11rb$(family)) {\n family = ensureNotNull(this.FONT_FAMILY_MAP_0.get_11rb$(family));\n }label.setFontFamily_pdl1vj$(family);\n var fontface = p.fontface();\n if (!base.Strings.isNullOrEmpty_pdl1vj$(fontface)) {\n var $receiver = Regex_init(' ').split_905azu$(fontface, 0);\n var dropLastWhile$result;\n dropLastWhile$break: do {\n if (!$receiver.isEmpty()) {\n var iterator = $receiver.listIterator_za3lpa$($receiver.size);\n while (iterator.hasPrevious()) {\n if (!(iterator.previous().length === 0)) {\n dropLastWhile$result = take($receiver, iterator.nextIndex() + 1 | 0);\n break dropLastWhile$break;\n }}\n }dropLastWhile$result = emptyList();\n }\n while (false);\n tmp$ = copyToArray(dropLastWhile$result);\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var s = tmp$[tmp$_0];\n if (this.FONT_WEIGHT_SET_0.contains_11rb$(s)) {\n label.setFontWeight_pdl1vj$(s);\n } else if (this.FONT_STYLE_SET_0.contains_11rb$(s)) {\n label.setFontStyle_pdl1vj$(s);\n }}\n }var hAnchor = this.textLabelAnchor_3zqsx9$(p.hjust(), this.HJUST_MAP, TextLabel$HorizontalAnchor$MIDDLE_getInstance());\n var vAnchor = this.textLabelAnchor_3zqsx9$(p.vjust(), this.VJUST_MAP, TextLabel$VerticalAnchor$CENTER_getInstance());\n if (hAnchor !== TextLabel$HorizontalAnchor$LEFT_getInstance()) {\n label.setHorizontalAnchor_ja80zo$(hAnchor);\n }if (vAnchor !== TextLabel$VerticalAnchor$BOTTOM_getInstance()) {\n label.setVerticalAnchor_yaudma$(vAnchor);\n }var angle = ensureNotNull(p.angle());\n if (angle !== 0.0) {\n angle = 360 - angle % 360;\n label.rotate_14dthe$(angle);\n }};\n GeomHelper$Companion.prototype.textLabelAnchor_3zqsx9$ = function (o, conversionMap, def) {\n var tmp$;\n return (tmp$ = conversionMap.get_11rb$(o)) != null ? tmp$ : def;\n };\n GeomHelper$Companion.prototype.decorate_d9jm6k$ = function (node, p, applyAlphaToAll) {\n if (applyAlphaToAll === void 0)\n applyAlphaToAll = AestheticsUtil_getInstance().ALPHA_CONTROLS_BOTH_8be2vx$;\n var tmp$;\n if (Kotlin.isType(node, SvgShape)) {\n this.decorateShape_0(Kotlin.isType(tmp$ = node, SvgShape) ? tmp$ : throwCCE(), p, applyAlphaToAll);\n }if (Kotlin.isType(node, SvgElement)) {\n var lineType = p.lineType();\n if (!(lineType.isBlank || lineType.isSolid)) {\n StrokeDashArraySupport_getInstance().apply_3xqz7j$(node, AesScaling_getInstance().strokeWidth_l6g9mh$(p), lineType.dashArray);\n }}};\n GeomHelper$Companion.prototype.decorateShape_0 = function (shape, p, applyAlphaToAll) {\n AestheticsUtil_getInstance().updateStroke_g0plfl$(shape, p, applyAlphaToAll);\n AestheticsUtil_getInstance().updateFill_v4tjbc$(shape, p);\n shape.strokeWidth().set_11rb$(AesScaling_getInstance().strokeWidth_l6g9mh$(p));\n };\n GeomHelper$Companion.prototype.decorateSlimShape_gb6c9f$ = function (shape, p) {\n var stroke = ensureNotNull(p.color());\n var strokeAlpha = AestheticsUtil_getInstance().alpha_il6rhx$(stroke, p);\n var fill = ensureNotNull(p.fill());\n var fillAlpha = AestheticsUtil_getInstance().alpha_il6rhx$(fill, p);\n shape.setFill_o14uds$(fill, fillAlpha);\n shape.setStroke_o14uds$(stroke, strokeAlpha);\n shape.setStrokeWidth_14dthe$(AesScaling_getInstance().strokeWidth_l6g9mh$(p));\n };\n GeomHelper$Companion.prototype.getSizeUnitAes_61zpoe$ = function (sizeUnitName) {\n var tmp$;\n switch (sizeUnitName.toLowerCase()) {\n case 'x':\n tmp$ = Aes$Companion_getInstance().X;\n break;\n case 'y':\n tmp$ = Aes$Companion_getInstance().Y;\n break;\n default:throw IllegalStateException_init((\"Size unit value must be either 'x' or 'y', but was \" + sizeUnitName + '.').toString());\n }\n return tmp$;\n };\n GeomHelper$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomHelper$Companion_instance = null;\n function GeomHelper$Companion_getInstance() {\n if (GeomHelper$Companion_instance === null) {\n new GeomHelper$Companion();\n }return GeomHelper$Companion_instance;\n }\n GeomHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomHelper',\n interfaces: []\n };\n function GeomUtil() {\n GeomUtil_instance = this;\n this.TO_LOCATION_X_Y = GeomUtil$TO_LOCATION_X_Y$lambda(this);\n this.TO_LOCATION_X_YMIN = GeomUtil$TO_LOCATION_X_YMIN$lambda(this);\n this.TO_LOCATION_X_YMAX = GeomUtil$TO_LOCATION_X_YMAX$lambda(this);\n this.TO_LOCATION_X_ZERO = GeomUtil$TO_LOCATION_X_ZERO$lambda(this);\n this.TO_RECTANGLE = GeomUtil$TO_RECTANGLE$lambda(this);\n this.ORDERING_X_0 = Ordering.Companion.from_iajr8b$(new GeomUtil$ORDERING_X$ObjectLiteral());\n this.ORDERING_Y_0 = Ordering.Companion.from_iajr8b$(new GeomUtil$ORDERING_Y$ObjectLiteral());\n this.WITH_X_Y_0 = GeomUtil$WITH_X_Y$lambda;\n this.WITH_X_0 = GeomUtil$WITH_X$lambda;\n this.WITH_Y_0 = GeomUtil$WITH_Y$lambda;\n }\n GeomUtil.prototype.toLocationOrNull_0 = function (x, y) {\n var tmp$;\n if (data.SeriesUtil.isFinite_yrwdxb$(x) && data.SeriesUtil.isFinite_yrwdxb$(y)) {\n tmp$ = new DoubleVector(ensureNotNull(x), ensureNotNull(y));\n } else\n tmp$ = null;\n return tmp$;\n };\n GeomUtil.prototype.with_X_Y_83glv4$ = function (dataPoints) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (this.WITH_X_Y_0(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.with_X_83glv4$ = function (dataPoints) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (this.WITH_X_0(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.with_Y_83glv4$ = function (dataPoints) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (this.WITH_Y_0(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.ordered_X_83glv4$ = function (dataPoints) {\n if (this.ORDERING_X_0.isOrdered_p1ys8y$(dataPoints)) {\n return dataPoints;\n }return this.ORDERING_X_0.sortedCopy_m5x2f4$(dataPoints);\n };\n GeomUtil.prototype.ordered_Y_hku6c7$ = function (dataPoints, reversed) {\n var ordering = reversed ? this.ORDERING_Y_0.reverse() : this.ORDERING_Y_0;\n if (ordering.isOrdered_p1ys8y$(dataPoints)) {\n return dataPoints;\n }return ordering.sortedCopy_m5x2f4$(dataPoints);\n };\n GeomUtil.prototype.widthPx_c6teas$ = function (p, ctx, minWidth) {\n var w = p.width();\n var width = ensureNotNull(w) * ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n return JsMath.max(width, minWidth);\n };\n GeomUtil.prototype.withDefined_2oeq97$ = function (dataPoints, aes) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.defined_896ixz$(aes))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.withDefined_fl3lpi$ = function (dataPoints, aes0, aes1) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.defined_896ixz$(aes0) && element.defined_896ixz$(aes1))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.withDefined_7jazl$ = function (dataPoints, aes0, aes1, aes2) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.defined_896ixz$(aes0) && element.defined_896ixz$(aes1) && element.defined_896ixz$(aes2))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.withDefined_i1kplo$ = function (dataPoints, aes0, aes1, aes2, aes3) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.defined_896ixz$(aes0) && element.defined_896ixz$(aes1) && element.defined_896ixz$(aes2) && element.defined_896ixz$(aes3))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.rectangleByDataPoint_dyn5n6$ = function (p, ctx) {\n var x = ensureNotNull(p.x());\n var y = ensureNotNull(p.y());\n var width = this.widthPx_c6teas$(p, ctx, 2.0);\n var origin;\n var dimensions;\n if (y >= 0) {\n origin = new DoubleVector(x - width / 2, 0.0);\n dimensions = new DoubleVector(width, y);\n } else {\n origin = new DoubleVector(x - width / 2, y);\n dimensions = new DoubleVector(width, -y);\n }\n return new DoubleRectangle(origin, dimensions);\n };\n GeomUtil.prototype.createGroups_83glv4$ = function (dataPoints) {\n var tmp$;\n var pointsByGroup = HashMap_init();\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var group = ensureNotNull(p.group());\n if (!pointsByGroup.containsKey_11rb$(group)) {\n var value = ArrayList_init();\n pointsByGroup.put_xwzc9p$(group, value);\n }ensureNotNull(pointsByGroup.get_11rb$(group)).add_11rb$(p);\n }\n return pointsByGroup;\n };\n GeomUtil.prototype.rectToGeometry_6y0v78$ = function (minX, minY, maxX, maxY) {\n return listOf([new DoubleVector(minX, minY), new DoubleVector(minX, maxY), new DoubleVector(maxX, maxY), new DoubleVector(maxX, minY), new DoubleVector(minX, minY)]);\n };\n function GeomUtil$TO_LOCATION_X_Y$lambda(this$GeomUtil) {\n return function (p) {\n return this$GeomUtil.toLocationOrNull_0(p.x(), p.y());\n };\n }\n function GeomUtil$TO_LOCATION_X_YMIN$lambda(this$GeomUtil) {\n return function (p) {\n return this$GeomUtil.toLocationOrNull_0(p.x(), p.ymin());\n };\n }\n function GeomUtil$TO_LOCATION_X_YMAX$lambda(this$GeomUtil) {\n return function (p) {\n return this$GeomUtil.toLocationOrNull_0(p.x(), p.ymax());\n };\n }\n function GeomUtil$TO_LOCATION_X_ZERO$lambda(this$GeomUtil) {\n return function (p) {\n return this$GeomUtil.toLocationOrNull_0(p.x(), 0.0);\n };\n }\n function GeomUtil$TO_RECTANGLE$lambda(this$GeomUtil) {\n return function (p) {\n if (data.SeriesUtil.allFinite_rd1tgs$(p.xmin(), p.ymin(), p.xmax(), p.ymax())) {\n return this$GeomUtil.rectToGeometry_6y0v78$(ensureNotNull(p.xmin()), ensureNotNull(p.ymin()), ensureNotNull(p.xmax()), ensureNotNull(p.ymax()));\n } else {\n return emptyList();\n }\n };\n }\n function GeomUtil$ORDERING_X$ObjectLiteral() {\n }\n GeomUtil$ORDERING_X$ObjectLiteral.prototype.compare = function (a, b) {\n var x1 = a != null ? a.x() : null;\n var x2 = b != null ? b.x() : null;\n if (x1 == null || x2 == null)\n return 0;\n else\n return Kotlin.compareTo(x1, x2);\n };\n GeomUtil$ORDERING_X$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Comparator]\n };\n function GeomUtil$ORDERING_Y$ObjectLiteral() {\n }\n GeomUtil$ORDERING_Y$ObjectLiteral.prototype.compare = function (a, b) {\n var y1 = a != null ? a.y() : null;\n var y2 = b != null ? b.y() : null;\n if (y1 == null || y2 == null)\n return 0;\n else\n return Kotlin.compareTo(y1, y2);\n };\n GeomUtil$ORDERING_Y$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Comparator]\n };\n function GeomUtil$WITH_X_Y$lambda(pointAes) {\n return data.SeriesUtil.allFinite_jma9l8$(pointAes.x(), pointAes.y());\n }\n function GeomUtil$WITH_X$lambda(pointAes) {\n return data.SeriesUtil.isFinite_yrwdxb$(pointAes.x());\n }\n function GeomUtil$WITH_Y$lambda(pointAes) {\n return data.SeriesUtil.isFinite_yrwdxb$(pointAes.y());\n }\n GeomUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GeomUtil',\n interfaces: []\n };\n var GeomUtil_instance = null;\n function GeomUtil_getInstance() {\n if (GeomUtil_instance === null) {\n new GeomUtil();\n }return GeomUtil_instance;\n }\n function HintColorUtil() {\n HintColorUtil_instance = this;\n }\n HintColorUtil.prototype.fromColor_l6g9mh$ = function (p) {\n return this.fromColorValue_o14uds$(ensureNotNull(p.color()), ensureNotNull(p.alpha()));\n };\n HintColorUtil.prototype.fromFill_l6g9mh$ = function (p) {\n return this.fromColorValue_o14uds$(ensureNotNull(p.fill()), ensureNotNull(p.alpha()));\n };\n HintColorUtil.prototype.fromColorValue_o14uds$ = function (color, alpha) {\n var tmp$;\n var intAlpha = numberToInt(255 * alpha);\n if (values.Colors.solid_98b62m$(color)) {\n tmp$ = color.changeAlpha_za3lpa$(intAlpha);\n } else\n tmp$ = color;\n return tmp$;\n };\n HintColorUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'HintColorUtil',\n interfaces: []\n };\n var HintColorUtil_instance = null;\n function HintColorUtil_getInstance() {\n if (HintColorUtil_instance === null) {\n new HintColorUtil();\n }return HintColorUtil_instance;\n }\n function HintsCollection(myPoint, myHelper) {\n this.myPoint_0 = myPoint;\n this.myHelper_0 = myHelper;\n this.myHints_0 = HashMap_init();\n }\n Object.defineProperty(HintsCollection.prototype, 'hints', {\n configurable: true,\n get: function () {\n return this.myHints_0;\n }\n });\n HintsCollection.prototype.addHint_p9kkqu$ = function (hintConfig) {\n var coord = this.getCoord_0(hintConfig);\n if (coord != null) {\n var $receiver = this.hints;\n var key = hintConfig.aes;\n var value = this.createHint_0(hintConfig, coord);\n $receiver.put_xwzc9p$(key, value);\n }return this;\n };\n HintsCollection.prototype.getCoord_0 = function (hintConfig) {\n var tmp$;\n if (hintConfig.x == null) {\n throw IllegalArgumentException_init('x coord is not set');\n }var aes = hintConfig.aes;\n if (!this.myPoint_0.defined_896ixz$(aes)) {\n tmp$ = null;\n } else\n tmp$ = this.myHelper_0.toClient_tkjljq$(new DoubleVector(ensureNotNull(hintConfig.x), ensureNotNull(this.myPoint_0.get_31786j$(aes))), this.myPoint_0);\n return tmp$;\n };\n HintsCollection.prototype.createHint_0 = function (hintConfig, coord) {\n var tmp$, tmp$_0;\n var objectRadius = hintConfig.objectRadius;\n var color = hintConfig.color_8be2vx$;\n if (objectRadius == null) {\n throw IllegalArgumentException_init('object radius is not set');\n }tmp$ = hintConfig.kind;\n if (equals(tmp$, TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance()))\n tmp$_0 = TipLayoutHint$Companion_getInstance().verticalTooltip_6lq1u6$(coord, objectRadius, color);\n else if (equals(tmp$, TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance()))\n tmp$_0 = TipLayoutHint$Companion_getInstance().horizontalTooltip_6lq1u6$(coord, objectRadius, color);\n else if (equals(tmp$, TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance()))\n tmp$_0 = TipLayoutHint$Companion_getInstance().cursorTooltip_itpcqk$(coord, color);\n else\n throw IllegalArgumentException_init('Unknown hint kind: ' + toString(hintConfig.kind));\n return tmp$_0;\n };\n function HintsCollection$HintConfigFactory() {\n this.myDefaultObjectRadius_0 = null;\n this.myDefaultX_0 = null;\n this.myDefaultColor_0 = null;\n this.myDefaultKind_0 = null;\n }\n HintsCollection$HintConfigFactory.prototype.defaultObjectRadius_14dthe$ = function (defaultObjectRadius) {\n this.myDefaultObjectRadius_0 = defaultObjectRadius;\n return this;\n };\n HintsCollection$HintConfigFactory.prototype.defaultX_14dthe$ = function (defaultX) {\n this.myDefaultX_0 = defaultX;\n return this;\n };\n HintsCollection$HintConfigFactory.prototype.defaultColor_yo1m5r$ = function (v, alpha) {\n if (alpha != null) {\n this.myDefaultColor_0 = v.changeAlpha_za3lpa$(numberToInt(255 * alpha));\n } else {\n this.myDefaultColor_0 = v;\n }\n return this;\n };\n HintsCollection$HintConfigFactory.prototype.create_vktour$ = function (aes) {\n return new HintsCollection$HintConfigFactory$HintConfig(this, aes);\n };\n HintsCollection$HintConfigFactory.prototype.defaultKind_nnfttk$ = function (kind) {\n this.myDefaultKind_0 = kind;\n return this;\n };\n function HintsCollection$HintConfigFactory$HintConfig($outer, aes) {\n this.$outer = $outer;\n this.aes = aes;\n this.kind = null;\n this.objectRadius_u2tfw5$_0 = null;\n this.x_is741i$_0 = null;\n this.color_8be2vx$_ng3d4v$_0 = null;\n this.objectRadius = this.$outer.myDefaultObjectRadius_0;\n this.x = this.$outer.myDefaultX_0;\n this.kind = this.$outer.myDefaultKind_0;\n this.color_8be2vx$ = this.$outer.myDefaultColor_0;\n }\n Object.defineProperty(HintsCollection$HintConfigFactory$HintConfig.prototype, 'objectRadius', {\n configurable: true,\n get: function () {\n return this.objectRadius_u2tfw5$_0;\n },\n set: function (objectRadius) {\n this.objectRadius_u2tfw5$_0 = objectRadius;\n }\n });\n Object.defineProperty(HintsCollection$HintConfigFactory$HintConfig.prototype, 'x', {\n configurable: true,\n get: function () {\n return this.x_is741i$_0;\n },\n set: function (x) {\n this.x_is741i$_0 = x;\n }\n });\n Object.defineProperty(HintsCollection$HintConfigFactory$HintConfig.prototype, 'color_8be2vx$', {\n configurable: true,\n get: function () {\n return this.color_8be2vx$_ng3d4v$_0;\n },\n set: function (color) {\n this.color_8be2vx$_ng3d4v$_0 = color;\n }\n });\n HintsCollection$HintConfigFactory$HintConfig.prototype.objectRadius_14dthe$ = function (v) {\n this.objectRadius = v;\n return this;\n };\n HintsCollection$HintConfigFactory$HintConfig.prototype.x_14dthe$ = function (v) {\n this.x = v;\n return this;\n };\n HintsCollection$HintConfigFactory$HintConfig.prototype.color_98b62m$ = function (v) {\n this.color_8be2vx$ = v;\n return this;\n };\n HintsCollection$HintConfigFactory$HintConfig.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HintConfig',\n interfaces: []\n };\n HintsCollection$HintConfigFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HintConfigFactory',\n interfaces: []\n };\n HintsCollection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HintsCollection',\n interfaces: []\n };\n function LinePathConstructor(myTargetCollector, myDataPoints, myLinesHelper, myClosePath) {\n LinePathConstructor$Companion_getInstance();\n this.myTargetCollector_0 = myTargetCollector;\n this.myDataPoints_0 = myDataPoints;\n this.myLinesHelper_0 = myLinesHelper;\n this.myClosePath_0 = myClosePath;\n }\n LinePathConstructor.prototype.construct_6taknv$ = function (withHints) {\n var tmp$;\n var linePaths = ArrayList_init();\n var multiPointDataList = this.createMultiPointDataByGroup_0();\n tmp$ = multiPointDataList.iterator();\n while (tmp$.hasNext()) {\n var multiPointData = tmp$.next();\n linePaths.addAll_brywnq$(this.myLinesHelper_0.createPaths_edlkk9$(multiPointData.aes, multiPointData.points, this.myClosePath_0));\n }\n if (withHints) {\n this.buildHints_0(multiPointDataList);\n }return linePaths;\n };\n LinePathConstructor.prototype.buildHints = function () {\n this.buildHints_0(this.createMultiPointDataByGroup_0());\n };\n LinePathConstructor.prototype.buildHints_0 = function (multiPointDataList) {\n var tmp$;\n tmp$ = multiPointDataList.iterator();\n while (tmp$.hasNext()) {\n var multiPointData = tmp$.next();\n if (this.myClosePath_0) {\n this.myTargetCollector_0.addPolygon_sa5m83$(multiPointData.points, multiPointData.localToGlobalIndex, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromFill_l6g9mh$(multiPointData.aes)));\n } else {\n this.myTargetCollector_0.addPath_sa5m83$(multiPointData.points, multiPointData.localToGlobalIndex, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(multiPointData.aes)));\n }\n }\n };\n function LinePathConstructor$createMultiPointDataByGroup$lambda(this$LinePathConstructor) {\n return function (p) {\n return this$LinePathConstructor.myLinesHelper_0.toClient_tkjljq$(ensureNotNull(GeomUtil_getInstance().TO_LOCATION_X_Y(p)), p);\n };\n }\n LinePathConstructor.prototype.createMultiPointDataByGroup_0 = function () {\n return MultiPointDataConstructor_getInstance().createMultiPointDataByGroup_ugj9hh$(this.myDataPoints_0, MultiPointDataConstructor_getInstance().singlePointAppender_v9bvvf$(LinePathConstructor$createMultiPointDataByGroup$lambda(this)), MultiPointDataConstructor_getInstance().reducer_8555vt$(LinePathConstructor$Companion_getInstance().DROP_POINT_DISTANCE_0, this.myClosePath_0));\n };\n function LinePathConstructor$Companion() {\n LinePathConstructor$Companion_instance = this;\n this.DROP_POINT_DISTANCE_0 = 0.999;\n }\n LinePathConstructor$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LinePathConstructor$Companion_instance = null;\n function LinePathConstructor$Companion_getInstance() {\n if (LinePathConstructor$Companion_instance === null) {\n new LinePathConstructor$Companion();\n }return LinePathConstructor$Companion_instance;\n }\n LinePathConstructor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinePathConstructor',\n interfaces: []\n };\n function LinesHelper(pos, coord, ctx) {\n GeomHelper.call(this, pos, coord, ctx);\n this.myAlphaFilter_nxoahd$_0 = LinesHelper$myAlphaFilter$lambda;\n this.myWidthFilter_sx37fb$_0 = LinesHelper$myWidthFilter$lambda;\n this.myAlphaEnabled_98jfa$_0 = true;\n }\n LinesHelper.prototype.insertPathSeparators_fr5rf4$_0 = function (rings) {\n var tmp$;\n var result = ArrayList_init();\n tmp$ = rings.iterator();\n while (tmp$.hasNext()) {\n var ring = tmp$.next();\n if (!result.isEmpty()) {\n result.add_11rb$(LinePath$Companion_getInstance().END_OF_SUBPATH);\n }result.addAll_brywnq$(ring);\n }\n return result;\n };\n LinesHelper.prototype.setAlphaEnabled_6taknv$ = function (b) {\n this.myAlphaEnabled_98jfa$_0 = b;\n };\n LinesHelper.prototype.createLines_rrreuh$ = function (dataPoints, toLocation) {\n return this.createPaths_gfkrhx$_0(dataPoints, toLocation, false);\n };\n function LinesHelper$createPaths$lambda(closure$toLocation) {\n return function (it) {\n return closure$toLocation(it);\n };\n }\n LinesHelper.prototype.createPaths_gfkrhx$_0 = function (dataPoints, toLocation, closePath) {\n var tmp$;\n var paths = ArrayList_init();\n var multiPointDataList = MultiPointDataConstructor_getInstance().createMultiPointDataByGroup_ugj9hh$(dataPoints, MultiPointDataConstructor_getInstance().singlePointAppender_v9bvvf$(this.toClientLocation_sfitzs$(LinesHelper$createPaths$lambda(toLocation))), MultiPointDataConstructor_getInstance().reducer_8555vt$(0.999, closePath));\n tmp$ = multiPointDataList.iterator();\n while (tmp$.hasNext()) {\n var multiPointData = tmp$.next();\n paths.addAll_brywnq$(this.createPaths_edlkk9$(multiPointData.aes, multiPointData.points, closePath));\n }\n return paths;\n };\n LinesHelper.prototype.createPaths_edlkk9$ = function (aes, points, closePath) {\n var paths = ArrayList_init();\n if (closePath) {\n paths.add_11rb$(LinePath$Companion_getInstance().polygon_yh26e7$(this.insertPathSeparators_fr5rf4$_0(splitRings(points))));\n } else {\n paths.add_11rb$(LinePath$Companion_getInstance().line_qdtdbw$(points));\n }\n var tmp$;\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.decorate_frjrd5$(element, aes, closePath);\n }\n return paths;\n };\n LinesHelper.prototype.createSteps_1fp004$ = function (dataPoints, dir) {\n var tmp$, tmp$_0;\n var pathInfos = ArrayList_init();\n var multiPointDataList = MultiPointDataConstructor_getInstance().createMultiPointDataByGroup_ugj9hh$(dataPoints, MultiPointDataConstructor_getInstance().singlePointAppender_v9bvvf$(this.toClientLocation_sfitzs$(GeomUtil_getInstance().TO_LOCATION_X_Y)), MultiPointDataConstructor_getInstance().reducer_8555vt$(0.999, false));\n tmp$ = multiPointDataList.iterator();\n while (tmp$.hasNext()) {\n var multiPointData = tmp$.next();\n var points = multiPointData.points;\n if (!points.isEmpty()) {\n var newPoints = ArrayList_init();\n var prev = null;\n tmp$_0 = points.iterator();\n while (tmp$_0.hasNext()) {\n var point = tmp$_0.next();\n if (prev != null) {\n var x = dir === StepGeom$Direction$HV_getInstance() ? point.x : prev.x;\n var y = dir === StepGeom$Direction$HV_getInstance() ? prev.y : point.y;\n newPoints.add_11rb$(new DoubleVector(x, y));\n }newPoints.add_11rb$(point);\n prev = point;\n }\n var path = LinePath$Companion_getInstance().line_qdtdbw$(newPoints);\n this.decorate_frjrd5$(path, multiPointData.aes, false);\n pathInfos.add_11rb$(new LinesHelper$PathInfo(path));\n }}\n return pathInfos;\n };\n function LinesHelper$createBands$lambda(closure$toLocationUpper) {\n return function (it) {\n return closure$toLocationUpper(it);\n };\n }\n function LinesHelper$createBands$lambda_0(closure$toLocationLower) {\n return function (it) {\n return closure$toLocationLower(it);\n };\n }\n LinesHelper.prototype.createBands_22uu1u$ = function (dataPoints, toLocationUpper, toLocationLower) {\n var tmp$;\n var lines = ArrayList_init();\n var pointsByGroup = GeomUtil_getInstance().createGroups_83glv4$(dataPoints);\n tmp$ = Ordering.Companion.natural_dahdeg$().sortedCopy_m5x2f4$(pointsByGroup.keys).iterator();\n while (tmp$.hasNext()) {\n var group = tmp$.next();\n var groupDataPoints = pointsByGroup.get_11rb$(group);\n var points = ArrayList_init_0(this.project_rrreuh$(ensureNotNull(groupDataPoints), LinesHelper$createBands$lambda(toLocationUpper)));\n var lowerPoints = reversed(groupDataPoints);\n points.addAll_brywnq$(this.project_rrreuh$(lowerPoints, LinesHelper$createBands$lambda_0(toLocationLower)));\n if (!points.isEmpty()) {\n var path = LinePath$Companion_getInstance().polygon_yh26e7$(points);\n this.decorateFillingPart_e7h5w8$_0(path, groupDataPoints.get_za3lpa$(0));\n lines.add_11rb$(path);\n }}\n return lines;\n };\n LinesHelper.prototype.decorate_frjrd5$ = function (path, p, filled) {\n var stroke = p.color();\n var strokeAlpha = ensureNotNull(this.myAlphaFilter_nxoahd$_0(AestheticsUtil_getInstance().alpha_il6rhx$(ensureNotNull(stroke), p)));\n path.color().set_11rb$(values.Colors.withOpacity_o14uds$(stroke, strokeAlpha));\n if (!AestheticsUtil_getInstance().ALPHA_CONTROLS_BOTH_8be2vx$ && (filled || !this.myAlphaEnabled_98jfa$_0)) {\n path.color().set_11rb$(stroke);\n }if (filled) {\n this.decorateFillingPart_e7h5w8$_0(path, p);\n }var size = ensureNotNull(this.myWidthFilter_sx37fb$_0(AesScaling_getInstance().strokeWidth_l6g9mh$(p)));\n path.width().set_11rb$(size);\n var lineType = p.lineType();\n if (!(lineType.isBlank || lineType.isSolid)) {\n path.dashArray().set_11rb$(lineType.dashArray);\n }};\n LinesHelper.prototype.decorateFillingPart_e7h5w8$_0 = function (path, p) {\n var fill = p.fill();\n var fillAlpha = ensureNotNull(this.myAlphaFilter_nxoahd$_0(AestheticsUtil_getInstance().alpha_il6rhx$(ensureNotNull(fill), p)));\n path.fill().set_11rb$(values.Colors.withOpacity_o14uds$(fill, fillAlpha));\n };\n LinesHelper.prototype.setAlphaFilter_m9g0ow$ = function (alphaFilter) {\n this.myAlphaFilter_nxoahd$_0 = alphaFilter;\n };\n LinesHelper.prototype.setWidthFilter_m9g0ow$ = function (widthFilter) {\n this.myWidthFilter_sx37fb$_0 = widthFilter;\n };\n function LinesHelper$PathInfo(path) {\n this.path = path;\n }\n LinesHelper$PathInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PathInfo',\n interfaces: []\n };\n function LinesHelper$myAlphaFilter$lambda(v) {\n return v;\n }\n function LinesHelper$myWidthFilter$lambda(v) {\n return v;\n }\n LinesHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinesHelper',\n interfaces: [GeomHelper]\n };\n function MappedAesthetics(myAesthetics, myPointAestheticsMapper) {\n this.myAesthetics_0 = myAesthetics;\n this.myPointAestheticsMapper_0 = myPointAestheticsMapper;\n }\n Object.defineProperty(MappedAesthetics.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myAesthetics_0.isEmpty;\n }\n });\n MappedAesthetics.prototype.dataPointAt_za3lpa$ = function (index) {\n return this.myPointAestheticsMapper_0(this.myAesthetics_0.dataPointAt_za3lpa$(index));\n };\n MappedAesthetics.prototype.dataPointCount = function () {\n return this.myAesthetics_0.dataPointCount();\n };\n MappedAesthetics.prototype.dataPoints = function () {\n var source = this.myAesthetics_0.dataPoints();\n var destination = ArrayList_init_1(collectionSizeOrDefault(source, 10));\n var tmp$;\n tmp$ = source.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(this.myPointAestheticsMapper_0(item));\n }\n return destination;\n };\n MappedAesthetics.prototype.range_vktour$ = function (aes) {\n throw IllegalStateException_init('MappedAesthetics.range: not implemented ' + aes);\n };\n MappedAesthetics.prototype.overallRange_vktour$ = function (aes) {\n throw IllegalStateException_init('MappedAesthetics.overallRange: not implemented ' + aes);\n };\n MappedAesthetics.prototype.resolution_594811$ = function (aes, naValue) {\n throw IllegalStateException_init('MappedAesthetics.resolution: not implemented ' + aes);\n };\n MappedAesthetics.prototype.numericValues_vktour$ = function (aes) {\n throw IllegalStateException_init('MappedAesthetics.numericValues: not implemented ' + aes);\n };\n MappedAesthetics.prototype.groups = function () {\n return this.myAesthetics_0.groups();\n };\n MappedAesthetics.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MappedAesthetics',\n interfaces: [Aesthetics]\n };\n function MultiPointData(aes, points, localToGlobalIndex, group) {\n this.aes = aes;\n this.points = points;\n this.localToGlobalIndex = localToGlobalIndex;\n this.group = group;\n }\n MultiPointData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiPointData',\n interfaces: []\n };\n function MultiPointDataConstructor() {\n MultiPointDataConstructor_instance = this;\n }\n function MultiPointDataConstructor$collector$lambda() {\n return new MultiPointDataConstructor$SimplePointCollector();\n }\n MultiPointDataConstructor.prototype.collector = function () {\n return MultiPointDataConstructor$collector$lambda;\n };\n function MultiPointDataConstructor$reducer$lambda(closure$dropPointDistance, closure$isPolygon) {\n return function () {\n return new MultiPointDataConstructor$PointReducer(closure$dropPointDistance, closure$isPolygon);\n };\n }\n MultiPointDataConstructor.prototype.reducer_8555vt$ = function (dropPointDistance, isPolygon) {\n return MultiPointDataConstructor$reducer$lambda(dropPointDistance, isPolygon);\n };\n function MultiPointDataConstructor$singlePointAppender$lambda(closure$toPoint) {\n return function (aes, coordinateConsumer) {\n coordinateConsumer(closure$toPoint(aes));\n return Unit;\n };\n }\n MultiPointDataConstructor.prototype.singlePointAppender_v9bvvf$ = function (toPoint) {\n return MultiPointDataConstructor$singlePointAppender$lambda(toPoint);\n };\n function MultiPointDataConstructor$multiPointAppender$lambda(closure$toPath) {\n return function (aes, coordinateConsumer) {\n var tmp$;\n tmp$ = closure$toPath(aes).iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n coordinateConsumer(element);\n }\n return Unit;\n };\n }\n MultiPointDataConstructor.prototype.multiPointAppender_t2aup3$ = function (toPath) {\n return MultiPointDataConstructor$multiPointAppender$lambda(toPath);\n };\n MultiPointDataConstructor.prototype.createMultiPointDataByGroup_ugj9hh$ = function (dataPoints, coordinateAppender, pointCollectorSupplier) {\n var tmp$, tmp$_0;\n var multiPointDataCombiners = HashMap_init();\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var group = p.group();\n var tmp$_1;\n if (!(Kotlin.isType(tmp$_1 = multiPointDataCombiners, Map) ? tmp$_1 : throwCCE()).containsKey_11rb$(group)) {\n var key = ensureNotNull(group);\n var value = new MultiPointDataConstructor$MultiPointDataCombiner(coordinateAppender, pointCollectorSupplier());\n multiPointDataCombiners.put_xwzc9p$(key, value);\n }var tmp$_2;\n ensureNotNull((Kotlin.isType(tmp$_2 = multiPointDataCombiners, Map) ? tmp$_2 : throwCCE()).get_11rb$(group)).add_lsjzq4$(p);\n }\n var result = ArrayList_init();\n var sortedGroup = Ordering.Companion.natural_dahdeg$().sortedCopy_m5x2f4$(multiPointDataCombiners.keys);\n tmp$_0 = sortedGroup.iterator();\n while (tmp$_0.hasNext()) {\n var group_0 = tmp$_0.next();\n var multiPointData = ensureNotNull(multiPointDataCombiners.get_11rb$(group_0)).create_kcn2v3$(group_0);\n if (!multiPointData.points.isEmpty()) {\n result.add_11rb$(multiPointData);\n }}\n return result;\n };\n function MultiPointDataConstructor$PointCollector() {\n }\n MultiPointDataConstructor$PointCollector.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PointCollector',\n interfaces: []\n };\n function MultiPointDataConstructor$MultiPointDataCombiner(myCoordinateAppender, myPointCollector) {\n this.myCoordinateAppender_0 = myCoordinateAppender;\n this.myPointCollector_0 = myPointCollector;\n this.myFirstAes_0 = null;\n }\n function MultiPointDataConstructor$MultiPointDataCombiner$add$lambda(this$MultiPointDataCombiner, closure$aes) {\n return function (it) {\n this$MultiPointDataCombiner.myPointCollector_0.add_aqrfag$(it, closure$aes.index());\n return Unit;\n };\n }\n MultiPointDataConstructor$MultiPointDataCombiner.prototype.add_lsjzq4$ = function (aes) {\n if (this.myFirstAes_0 == null) {\n this.myFirstAes_0 = aes;\n }this.myCoordinateAppender_0(aes, MultiPointDataConstructor$MultiPointDataCombiner$add$lambda(this, aes));\n };\n function MultiPointDataConstructor$MultiPointDataCombiner$create$lambda(closure$points) {\n return function (it) {\n return closure$points.second.get_za3lpa$(it);\n };\n }\n MultiPointDataConstructor$MultiPointDataCombiner.prototype.create_kcn2v3$ = function (group) {\n var points = this.myPointCollector_0.points;\n return new MultiPointData(ensureNotNull(this.myFirstAes_0), points.first, MultiPointDataConstructor$MultiPointDataCombiner$create$lambda(points), group);\n };\n MultiPointDataConstructor$MultiPointDataCombiner.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiPointDataCombiner',\n interfaces: []\n };\n function MultiPointDataConstructor$SimplePointCollector() {\n this.myPoints_0 = ArrayList_init();\n this.myIndexes_0 = ArrayList_init();\n }\n Object.defineProperty(MultiPointDataConstructor$SimplePointCollector.prototype, 'points', {\n configurable: true,\n get: function () {\n return new Pair(this.myPoints_0, this.myIndexes_0);\n }\n });\n MultiPointDataConstructor$SimplePointCollector.prototype.add_aqrfag$ = function (coord, index) {\n this.myPoints_0.add_11rb$(ensureNotNull(coord));\n this.myIndexes_0.add_11rb$(index);\n };\n MultiPointDataConstructor$SimplePointCollector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SimplePointCollector',\n interfaces: [MultiPointDataConstructor$PointCollector]\n };\n function MultiPointDataConstructor$PointReducer(myDropPointDistance, myPolygon) {\n this.myDropPointDistance_0 = myDropPointDistance;\n this.myPolygon_0 = myPolygon;\n this.myReducedPoints_0 = ArrayList_init();\n this.myReducedIndexes_0 = ArrayList_init();\n this.myLastAdded_0 = null;\n this.myLastPostponed_0 = null;\n this.myRegionStart_0 = null;\n }\n Object.defineProperty(MultiPointDataConstructor$PointReducer.prototype, 'points', {\n configurable: true,\n get: function () {\n if (this.myLastPostponed_0 != null) {\n this.addPoint_0(ensureNotNull(this.myLastPostponed_0).first, ensureNotNull(this.myLastPostponed_0).second);\n this.myLastPostponed_0 = null;\n }return new Pair(this.myReducedPoints_0, this.myReducedIndexes_0);\n }\n });\n MultiPointDataConstructor$PointReducer.prototype.isCloserThan_0 = function (p0, p1, distance) {\n var x = p0.x - p1.x;\n var tmp$ = JsMath.abs(x) < distance;\n if (tmp$) {\n var x_0 = p0.y - p1.y;\n tmp$ = JsMath.abs(x_0) < distance;\n }return tmp$;\n };\n MultiPointDataConstructor$PointReducer.prototype.add_aqrfag$ = function (coord, index) {\n if (coord == null) {\n return;\n }if (this.myLastAdded_0 == null) {\n this.storePoint_0(coord, index);\n return;\n }if (this.needPostpone_0(coord)) {\n this.postponePoint_0(coord, index);\n } else {\n if (this.myLastPostponed_0 != null) {\n this.addPoint_0(ensureNotNull(this.myLastPostponed_0).first, ensureNotNull(this.myLastPostponed_0).second);\n this.myLastPostponed_0 = null;\n }this.storePoint_0(coord, index);\n }\n };\n MultiPointDataConstructor$PointReducer.prototype.needPostpone_0 = function (loc) {\n var closeToAdded = this.areTooClose_0(this.myLastAdded_0, loc);\n var closeToPostponed = this.myLastPostponed_0 == null || this.areTooClose_0(ensureNotNull(this.myLastPostponed_0).first, loc);\n var regionClosePoint = this.isRegionStart_0(loc);\n return closeToAdded && closeToPostponed && !regionClosePoint;\n };\n MultiPointDataConstructor$PointReducer.prototype.postponePoint_0 = function (loc, index) {\n this.myLastPostponed_0 = new Pair(loc, index);\n };\n MultiPointDataConstructor$PointReducer.prototype.storePoint_0 = function (loc, index) {\n this.addPoint_0(loc, index);\n this.myLastAdded_0 = loc;\n this.processRegionStart_0(loc, index);\n };\n MultiPointDataConstructor$PointReducer.prototype.processRegionStart_0 = function (loc, index) {\n if (!this.myPolygon_0) {\n return;\n }if (this.myRegionStart_0 == null) {\n this.myRegionStart_0 = new Pair(loc, index);\n return;\n }if (this.isRegionStart_0(loc)) {\n this.myRegionStart_0 = null;\n this.myLastAdded_0 = null;\n }};\n MultiPointDataConstructor$PointReducer.prototype.isRegionStart_0 = function (loc) {\n var tmp$;\n if (!this.myPolygon_0) {\n return false;\n }if (this.myRegionStart_0 == null) {\n tmp$ = false;\n } else\n tmp$ = equals(ensureNotNull(this.myRegionStart_0).first, loc);\n return tmp$;\n };\n MultiPointDataConstructor$PointReducer.prototype.addPoint_0 = function (loc, index) {\n this.myReducedPoints_0.add_11rb$(loc);\n this.myReducedIndexes_0.add_11rb$(index);\n };\n MultiPointDataConstructor$PointReducer.prototype.areTooClose_0 = function (p1, p2) {\n return this.isCloserThan_0(ensureNotNull(p1), p2, this.myDropPointDistance_0);\n };\n MultiPointDataConstructor$PointReducer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointReducer',\n interfaces: [MultiPointDataConstructor$PointCollector]\n };\n MultiPointDataConstructor.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'MultiPointDataConstructor',\n interfaces: []\n };\n var MultiPointDataConstructor_instance = null;\n function MultiPointDataConstructor_getInstance() {\n if (MultiPointDataConstructor_instance === null) {\n new MultiPointDataConstructor();\n }return MultiPointDataConstructor_instance;\n }\n function RectTargetCollectorHelper(rectanglesHelper, rectangleByDataPoint, fillByDataPoint, tooltipKind) {\n this.rectanglesHelper_0 = rectanglesHelper;\n this.rectangleByDataPoint_0 = rectangleByDataPoint;\n this.fillByDataPoint_0 = fillByDataPoint;\n this.tooltipKind_0 = tooltipKind;\n }\n function RectTargetCollectorHelper$collectTo$lambda(closure$targetCollector, this$RectTargetCollectorHelper) {\n return function (p, rectangle) {\n closure$targetCollector.addRectangle_bxzvr8$(p.index(), rectangle, this$RectTargetCollectorHelper.tooltipParams_0(p), this$RectTargetCollectorHelper.tooltipKind_0);\n return Unit;\n };\n }\n RectTargetCollectorHelper.prototype.collectTo_xrq6q$ = function (targetCollector) {\n this.rectanglesHelper_0.iterateRectangleGeometry_xwqduk$(this.rectangleByDataPoint_0, RectTargetCollectorHelper$collectTo$lambda(targetCollector, this));\n };\n RectTargetCollectorHelper.prototype.tooltipParams_0 = function (p) {\n var params = GeomTargetCollector$TooltipParams$Companion_getInstance().params();\n params.setColor_98b62m$(this.fillByDataPoint_0(p));\n return params;\n };\n RectTargetCollectorHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RectTargetCollectorHelper',\n interfaces: []\n };\n function RectanglesHelper(myAesthetics, pos, coord, ctx) {\n GeomHelper.call(this, pos, coord, ctx);\n this.myAesthetics_0 = myAesthetics;\n }\n RectanglesHelper.prototype.createRectangles_rezc4r$ = function (rectangleByDataPoint) {\n var tmp$, tmp$_0;\n var result = ArrayList_init();\n tmp$ = this.myAesthetics_0.dataPointCount();\n for (var index = 0; index < tmp$; index++) {\n var p = this.myAesthetics_0.dataPointAt_za3lpa$(index);\n tmp$_0 = this.toClientRect_7iz5gz$(p, rectangleByDataPoint);\n if (tmp$_0 == null) {\n continue;\n }var clientRect = tmp$_0;\n var svgRect = SvgRectElement_init_0(clientRect);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(svgRect, p);\n result.add_11rb$(svgRect);\n }\n return result;\n };\n RectanglesHelper.prototype.iterateRectangleGeometry_xwqduk$ = function (rectangleByDataPoint, iterator) {\n var tmp$;\n tmp$ = this.myAesthetics_0.dataPointCount();\n for (var index = 0; index < tmp$; index++) {\n var p = this.myAesthetics_0.dataPointAt_za3lpa$(index);\n var rect = this.toClientRect_7iz5gz$(p, rectangleByDataPoint);\n if (rect != null) {\n iterator(p, rect);\n }}\n };\n RectanglesHelper.prototype.createSlimRectangles_rezc4r$ = function (rectangleByDataPoint) {\n var tmp$;\n var pointCount = this.myAesthetics_0.dataPointCount();\n var group = slim.SvgSlimElements.g_za3lpa$(pointCount);\n for (var index = 0; index < pointCount; index++) {\n var p = this.myAesthetics_0.dataPointAt_za3lpa$(index);\n tmp$ = this.toClientRect_7iz5gz$(p, rectangleByDataPoint);\n if (tmp$ == null) {\n continue;\n }var clientRect = tmp$;\n var slimShape = slim.SvgSlimElements.rect_6y0v78$(clientRect.left, clientRect.top, clientRect.width, clientRect.height);\n GeomHelper$Companion_getInstance().decorateSlimShape_gb6c9f$(slimShape, p);\n slimShape.appendTo_i2myw1$(group);\n }\n return group;\n };\n RectanglesHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RectanglesHelper',\n interfaces: [GeomHelper]\n };\n function ContextualMapping(tooltipLines, tooltipAnchor, tooltipMinWidth, tooltipColor, ignoreInvisibleTargets, hasGeneralTooltip, hasAxisTooltip, isCrosshairEnabled) {\n this.tooltipLines_85czob$_0 = tooltipLines;\n this.tooltipAnchor = tooltipAnchor;\n this.tooltipMinWidth = tooltipMinWidth;\n this.tooltipColor = tooltipColor;\n this.ignoreInvisibleTargets = ignoreInvisibleTargets;\n this.hasGeneralTooltip = hasGeneralTooltip;\n this.hasAxisTooltip = hasAxisTooltip;\n this.isCrosshairEnabled = isCrosshairEnabled;\n }\n ContextualMapping.prototype.getDataPoints_za3lpa$ = function (index) {\n var $receiver = this.tooltipLines_85czob$_0;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n if ((tmp$_0 = element.getDataPoint_za3lpa$(index)) != null) {\n destination.add_11rb$(tmp$_0);\n }}\n return destination;\n };\n ContextualMapping.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContextualMapping',\n interfaces: []\n };\n function DataContext(dataFrame, mappedDataAccess) {\n this.dataFrame = dataFrame;\n this.mappedDataAccess = mappedDataAccess;\n }\n DataContext.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataContext',\n interfaces: []\n };\n DataContext.prototype.component1 = function () {\n return this.dataFrame;\n };\n DataContext.prototype.component2 = function () {\n return this.mappedDataAccess;\n };\n DataContext.prototype.copy_nqispu$ = function (dataFrame, mappedDataAccess) {\n return new DataContext(dataFrame === void 0 ? this.dataFrame : dataFrame, mappedDataAccess === void 0 ? this.mappedDataAccess : mappedDataAccess);\n };\n DataContext.prototype.toString = function () {\n return 'DataContext(dataFrame=' + Kotlin.toString(this.dataFrame) + (', mappedDataAccess=' + Kotlin.toString(this.mappedDataAccess)) + ')';\n };\n DataContext.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.dataFrame) | 0;\n result = result * 31 + Kotlin.hashCode(this.mappedDataAccess) | 0;\n return result;\n };\n DataContext.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.dataFrame, other.dataFrame) && Kotlin.equals(this.mappedDataAccess, other.mappedDataAccess)))));\n };\n function GeomTarget(hitIndex, tipLayoutHint, aesTipLayoutHints) {\n this.hitIndex = hitIndex;\n this.tipLayoutHint_hymvab$_0 = tipLayoutHint;\n this.aesTipLayoutHints_wcnfmb$_0 = aesTipLayoutHints;\n }\n Object.defineProperty(GeomTarget.prototype, 'tipLayoutHint', {\n get: function () {\n return this.tipLayoutHint_hymvab$_0;\n }\n });\n Object.defineProperty(GeomTarget.prototype, 'aesTipLayoutHints', {\n get: function () {\n return this.aesTipLayoutHints_wcnfmb$_0;\n }\n });\n GeomTarget.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomTarget',\n interfaces: []\n };\n function GeomTargetCollector() {\n }\n GeomTargetCollector.prototype.addPoint_cnsimy$ = function (index, point, radius, tooltipParams, tooltipKind, callback$default) {\n if (tooltipKind === void 0)\n tooltipKind = TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance();\n callback$default ? callback$default(index, point, radius, tooltipParams, tooltipKind) : this.addPoint_cnsimy$$default(index, point, radius, tooltipParams, tooltipKind);\n };\n GeomTargetCollector.prototype.addRectangle_bxzvr8$ = function (index, rectangle, tooltipParams, tooltipKind, callback$default) {\n if (tooltipKind === void 0)\n tooltipKind = TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance();\n callback$default ? callback$default(index, rectangle, tooltipParams, tooltipKind) : this.addRectangle_bxzvr8$$default(index, rectangle, tooltipParams, tooltipKind);\n };\n GeomTargetCollector.prototype.addPath_sa5m83$ = function (points, localToGlobalIndex, tooltipParams, tooltipKind, callback$default) {\n if (tooltipKind === void 0)\n tooltipKind = TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance();\n callback$default ? callback$default(points, localToGlobalIndex, tooltipParams, tooltipKind) : this.addPath_sa5m83$$default(points, localToGlobalIndex, tooltipParams, tooltipKind);\n };\n GeomTargetCollector.prototype.addPolygon_sa5m83$ = function (points, localToGlobalIndex, tooltipParams, tooltipKind, callback$default) {\n if (tooltipKind === void 0)\n tooltipKind = TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance();\n callback$default ? callback$default(points, localToGlobalIndex, tooltipParams, tooltipKind) : this.addPolygon_sa5m83$$default(points, localToGlobalIndex, tooltipParams, tooltipKind);\n };\n function GeomTargetCollector$TooltipParams() {\n GeomTargetCollector$TooltipParams$Companion_getInstance();\n this.myTipLayoutHints_0 = emptyMap();\n this.myColor_0 = Color.Companion.GRAY;\n this.myStemLength_0 = TipLayoutHint$StemLength$NORMAL_getInstance();\n }\n GeomTargetCollector$TooltipParams.prototype.getTipLayoutHints = function () {\n return this.myTipLayoutHints_0;\n };\n GeomTargetCollector$TooltipParams.prototype.setTipLayoutHints_vgcgsc$ = function (tipLayoutHints) {\n this.myTipLayoutHints_0 = tipLayoutHints;\n return this;\n };\n GeomTargetCollector$TooltipParams.prototype.getColor = function () {\n return this.myColor_0;\n };\n GeomTargetCollector$TooltipParams.prototype.setColor_98b62m$ = function (color) {\n this.myColor_0 = color;\n return this;\n };\n GeomTargetCollector$TooltipParams.prototype.getStemLength = function () {\n return this.myStemLength_0;\n };\n GeomTargetCollector$TooltipParams.prototype.setStemLength_6gy7x$ = function (stemLength) {\n this.myStemLength_0 = stemLength;\n return this;\n };\n function GeomTargetCollector$TooltipParams$Companion() {\n GeomTargetCollector$TooltipParams$Companion_instance = this;\n }\n GeomTargetCollector$TooltipParams$Companion.prototype.params = function () {\n return new GeomTargetCollector$TooltipParams();\n };\n GeomTargetCollector$TooltipParams$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomTargetCollector$TooltipParams$Companion_instance = null;\n function GeomTargetCollector$TooltipParams$Companion_getInstance() {\n if (GeomTargetCollector$TooltipParams$Companion_instance === null) {\n new GeomTargetCollector$TooltipParams$Companion();\n }return GeomTargetCollector$TooltipParams$Companion_instance;\n }\n GeomTargetCollector$TooltipParams.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipParams',\n interfaces: []\n };\n GeomTargetCollector.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GeomTargetCollector',\n interfaces: []\n };\n function GeomTargetLocator() {\n }\n function GeomTargetLocator$LookupSpace(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function GeomTargetLocator$LookupSpace_initFields() {\n GeomTargetLocator$LookupSpace_initFields = function () {\n };\n GeomTargetLocator$LookupSpace$X_instance = new GeomTargetLocator$LookupSpace('X', 0);\n GeomTargetLocator$LookupSpace$XY_instance = new GeomTargetLocator$LookupSpace('XY', 1);\n GeomTargetLocator$LookupSpace$NONE_instance = new GeomTargetLocator$LookupSpace('NONE', 2);\n }\n var GeomTargetLocator$LookupSpace$X_instance;\n function GeomTargetLocator$LookupSpace$X_getInstance() {\n GeomTargetLocator$LookupSpace_initFields();\n return GeomTargetLocator$LookupSpace$X_instance;\n }\n var GeomTargetLocator$LookupSpace$XY_instance;\n function GeomTargetLocator$LookupSpace$XY_getInstance() {\n GeomTargetLocator$LookupSpace_initFields();\n return GeomTargetLocator$LookupSpace$XY_instance;\n }\n var GeomTargetLocator$LookupSpace$NONE_instance;\n function GeomTargetLocator$LookupSpace$NONE_getInstance() {\n GeomTargetLocator$LookupSpace_initFields();\n return GeomTargetLocator$LookupSpace$NONE_instance;\n }\n GeomTargetLocator$LookupSpace.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LookupSpace',\n interfaces: [Enum]\n };\n function GeomTargetLocator$LookupSpace$values() {\n return [GeomTargetLocator$LookupSpace$X_getInstance(), GeomTargetLocator$LookupSpace$XY_getInstance(), GeomTargetLocator$LookupSpace$NONE_getInstance()];\n }\n GeomTargetLocator$LookupSpace.values = GeomTargetLocator$LookupSpace$values;\n function GeomTargetLocator$LookupSpace$valueOf(name) {\n switch (name) {\n case 'X':\n return GeomTargetLocator$LookupSpace$X_getInstance();\n case 'XY':\n return GeomTargetLocator$LookupSpace$XY_getInstance();\n case 'NONE':\n return GeomTargetLocator$LookupSpace$NONE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupSpace.' + name);\n }\n }\n GeomTargetLocator$LookupSpace.valueOf_61zpoe$ = GeomTargetLocator$LookupSpace$valueOf;\n function GeomTargetLocator$LookupStrategy(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function GeomTargetLocator$LookupStrategy_initFields() {\n GeomTargetLocator$LookupStrategy_initFields = function () {\n };\n GeomTargetLocator$LookupStrategy$HOVER_instance = new GeomTargetLocator$LookupStrategy('HOVER', 0);\n GeomTargetLocator$LookupStrategy$NEAREST_instance = new GeomTargetLocator$LookupStrategy('NEAREST', 1);\n GeomTargetLocator$LookupStrategy$NONE_instance = new GeomTargetLocator$LookupStrategy('NONE', 2);\n }\n var GeomTargetLocator$LookupStrategy$HOVER_instance;\n function GeomTargetLocator$LookupStrategy$HOVER_getInstance() {\n GeomTargetLocator$LookupStrategy_initFields();\n return GeomTargetLocator$LookupStrategy$HOVER_instance;\n }\n var GeomTargetLocator$LookupStrategy$NEAREST_instance;\n function GeomTargetLocator$LookupStrategy$NEAREST_getInstance() {\n GeomTargetLocator$LookupStrategy_initFields();\n return GeomTargetLocator$LookupStrategy$NEAREST_instance;\n }\n var GeomTargetLocator$LookupStrategy$NONE_instance;\n function GeomTargetLocator$LookupStrategy$NONE_getInstance() {\n GeomTargetLocator$LookupStrategy_initFields();\n return GeomTargetLocator$LookupStrategy$NONE_instance;\n }\n GeomTargetLocator$LookupStrategy.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LookupStrategy',\n interfaces: [Enum]\n };\n function GeomTargetLocator$LookupStrategy$values() {\n return [GeomTargetLocator$LookupStrategy$HOVER_getInstance(), GeomTargetLocator$LookupStrategy$NEAREST_getInstance(), GeomTargetLocator$LookupStrategy$NONE_getInstance()];\n }\n GeomTargetLocator$LookupStrategy.values = GeomTargetLocator$LookupStrategy$values;\n function GeomTargetLocator$LookupStrategy$valueOf(name) {\n switch (name) {\n case 'HOVER':\n return GeomTargetLocator$LookupStrategy$HOVER_getInstance();\n case 'NEAREST':\n return GeomTargetLocator$LookupStrategy$NEAREST_getInstance();\n case 'NONE':\n return GeomTargetLocator$LookupStrategy$NONE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupStrategy.' + name);\n }\n }\n GeomTargetLocator$LookupStrategy.valueOf_61zpoe$ = GeomTargetLocator$LookupStrategy$valueOf;\n function GeomTargetLocator$LookupSpec(lookupSpace, lookupStrategy) {\n GeomTargetLocator$LookupSpec$Companion_getInstance();\n this.lookupSpace = lookupSpace;\n this.lookupStrategy = lookupStrategy;\n }\n function GeomTargetLocator$LookupSpec$Companion() {\n GeomTargetLocator$LookupSpec$Companion_instance = this;\n this.NONE = new GeomTargetLocator$LookupSpec(GeomTargetLocator$LookupSpace$NONE_getInstance(), GeomTargetLocator$LookupStrategy$NONE_getInstance());\n }\n GeomTargetLocator$LookupSpec$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomTargetLocator$LookupSpec$Companion_instance = null;\n function GeomTargetLocator$LookupSpec$Companion_getInstance() {\n if (GeomTargetLocator$LookupSpec$Companion_instance === null) {\n new GeomTargetLocator$LookupSpec$Companion();\n }return GeomTargetLocator$LookupSpec$Companion_instance;\n }\n GeomTargetLocator$LookupSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LookupSpec',\n interfaces: []\n };\n function GeomTargetLocator$LookupResult(targets, distance, geomKind, contextualMapping, isCrosshairEnabled) {\n this.targets = targets;\n this.distance_isy6z$_0 = distance;\n this.geomKind_g9qdl6$_0 = geomKind;\n this.contextualMapping_r13yoz$_0 = contextualMapping;\n this.isCrosshairEnabled = isCrosshairEnabled;\n }\n Object.defineProperty(GeomTargetLocator$LookupResult.prototype, 'distance', {\n get: function () {\n return this.distance_isy6z$_0;\n }\n });\n Object.defineProperty(GeomTargetLocator$LookupResult.prototype, 'geomKind', {\n get: function () {\n return this.geomKind_g9qdl6$_0;\n }\n });\n Object.defineProperty(GeomTargetLocator$LookupResult.prototype, 'contextualMapping', {\n get: function () {\n return this.contextualMapping_r13yoz$_0;\n }\n });\n GeomTargetLocator$LookupResult.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LookupResult',\n interfaces: []\n };\n GeomTargetLocator.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GeomTargetLocator',\n interfaces: []\n };\n function HitShape(kind, shape) {\n HitShape$Companion_getInstance();\n this.kind = kind;\n this.shape_kp8049$_0 = shape;\n }\n Object.defineProperty(HitShape.prototype, 'point', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.shape_kp8049$_0, HitShape$DoubleCircle) ? tmp$ : throwCCE();\n }\n });\n Object.defineProperty(HitShape.prototype, 'rect', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.shape_kp8049$_0, DoubleRectangle) ? tmp$ : throwCCE();\n }\n });\n Object.defineProperty(HitShape.prototype, 'points', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Not applicable to ' + this.kind);\n }\n });\n function HitShape$Kind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function HitShape$Kind_initFields() {\n HitShape$Kind_initFields = function () {\n };\n HitShape$Kind$POINT_instance = new HitShape$Kind('POINT', 0);\n HitShape$Kind$RECT_instance = new HitShape$Kind('RECT', 1);\n HitShape$Kind$POLYGON_instance = new HitShape$Kind('POLYGON', 2);\n HitShape$Kind$PATH_instance = new HitShape$Kind('PATH', 3);\n }\n var HitShape$Kind$POINT_instance;\n function HitShape$Kind$POINT_getInstance() {\n HitShape$Kind_initFields();\n return HitShape$Kind$POINT_instance;\n }\n var HitShape$Kind$RECT_instance;\n function HitShape$Kind$RECT_getInstance() {\n HitShape$Kind_initFields();\n return HitShape$Kind$RECT_instance;\n }\n var HitShape$Kind$POLYGON_instance;\n function HitShape$Kind$POLYGON_getInstance() {\n HitShape$Kind_initFields();\n return HitShape$Kind$POLYGON_instance;\n }\n var HitShape$Kind$PATH_instance;\n function HitShape$Kind$PATH_getInstance() {\n HitShape$Kind_initFields();\n return HitShape$Kind$PATH_instance;\n }\n HitShape$Kind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Kind',\n interfaces: [Enum]\n };\n function HitShape$Kind$values() {\n return [HitShape$Kind$POINT_getInstance(), HitShape$Kind$RECT_getInstance(), HitShape$Kind$POLYGON_getInstance(), HitShape$Kind$PATH_getInstance()];\n }\n HitShape$Kind.values = HitShape$Kind$values;\n function HitShape$Kind$valueOf(name) {\n switch (name) {\n case 'POINT':\n return HitShape$Kind$POINT_getInstance();\n case 'RECT':\n return HitShape$Kind$RECT_getInstance();\n case 'POLYGON':\n return HitShape$Kind$POLYGON_getInstance();\n case 'PATH':\n return HitShape$Kind$PATH_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.HitShape.Kind.' + name);\n }\n }\n HitShape$Kind.valueOf_61zpoe$ = HitShape$Kind$valueOf;\n function HitShape$DoubleCircle(center, radius) {\n this.center = center;\n this.radius = radius;\n }\n HitShape$DoubleCircle.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleCircle',\n interfaces: []\n };\n function HitShape$Companion() {\n HitShape$Companion_instance = this;\n }\n HitShape$Companion.prototype.point_e1sv3v$ = function (p, radius) {\n return new HitShape(HitShape$Kind$POINT_getInstance(), new HitShape$DoubleCircle(p, radius));\n };\n HitShape$Companion.prototype.rect_wthzt5$ = function (r) {\n return new HitShape(HitShape$Kind$RECT_getInstance(), r);\n };\n HitShape$Companion.prototype.path_ytws2g$ = function (points) {\n return this.shapeWithPath_0(HitShape$Kind$PATH_getInstance(), points);\n };\n HitShape$Companion.prototype.polygon_ytws2g$ = function (points) {\n return this.shapeWithPath_0(HitShape$Kind$POLYGON_getInstance(), points);\n };\n function HitShape$Companion$shapeWithPath$ObjectLiteral(closure$points, kind, shape) {\n this.closure$points = closure$points;\n HitShape.call(this, kind, shape);\n }\n Object.defineProperty(HitShape$Companion$shapeWithPath$ObjectLiteral.prototype, 'points', {\n configurable: true,\n get: function () {\n return this.closure$points;\n }\n });\n HitShape$Companion$shapeWithPath$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [HitShape]\n };\n HitShape$Companion.prototype.shapeWithPath_0 = function (kind, points) {\n return new HitShape$Companion$shapeWithPath$ObjectLiteral(points, kind, points);\n };\n HitShape$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HitShape$Companion_instance = null;\n function HitShape$Companion_getInstance() {\n if (HitShape$Companion_instance === null) {\n new HitShape$Companion();\n }return HitShape$Companion_instance;\n }\n HitShape.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HitShape',\n interfaces: []\n };\n function MappedDataAccess() {\n }\n function MappedDataAccess$MappedData(label, value, isContinuous) {\n this.label = label;\n this.value = value;\n this.isContinuous = isContinuous;\n }\n MappedDataAccess$MappedData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MappedData',\n interfaces: []\n };\n MappedDataAccess.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'MappedDataAccess',\n interfaces: []\n };\n function NullGeomTargetCollector() {\n }\n NullGeomTargetCollector.prototype.addPoint_cnsimy$$default = function (index, point, radius, tooltipParams, tooltipKind) {\n };\n NullGeomTargetCollector.prototype.addRectangle_bxzvr8$$default = function (index, rectangle, tooltipParams, tooltipKind) {\n };\n NullGeomTargetCollector.prototype.addPath_sa5m83$$default = function (points, localToGlobalIndex, tooltipParams, tooltipKind) {\n };\n NullGeomTargetCollector.prototype.addPolygon_sa5m83$$default = function (points, localToGlobalIndex, tooltipParams, tooltipKind) {\n };\n NullGeomTargetCollector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NullGeomTargetCollector',\n interfaces: [GeomTargetCollector]\n };\n function TipLayoutHint(kind, coord, objectRadius, color, stemLength) {\n TipLayoutHint$Companion_getInstance();\n this.kind_mdwpny$_0 = kind;\n this.coord_cmx6yh$_0 = coord;\n this.objectRadius_tv0yd$_0 = objectRadius;\n this.color_cmv83v$_0 = color;\n this.stemLength_x5log9$_0 = stemLength;\n }\n Object.defineProperty(TipLayoutHint.prototype, 'kind', {\n get: function () {\n return this.kind_mdwpny$_0;\n }\n });\n Object.defineProperty(TipLayoutHint.prototype, 'coord', {\n get: function () {\n return this.coord_cmx6yh$_0;\n }\n });\n Object.defineProperty(TipLayoutHint.prototype, 'objectRadius', {\n get: function () {\n return this.objectRadius_tv0yd$_0;\n }\n });\n Object.defineProperty(TipLayoutHint.prototype, 'color', {\n get: function () {\n return this.color_cmv83v$_0;\n }\n });\n Object.defineProperty(TipLayoutHint.prototype, 'stemLength', {\n get: function () {\n return this.stemLength_x5log9$_0;\n }\n });\n function TipLayoutHint$StemLength(name, ordinal, value) {\n Enum.call(this);\n this.value = value;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TipLayoutHint$StemLength_initFields() {\n TipLayoutHint$StemLength_initFields = function () {\n };\n TipLayoutHint$StemLength$NORMAL_instance = new TipLayoutHint$StemLength('NORMAL', 0, 12.0);\n TipLayoutHint$StemLength$SHORT_instance = new TipLayoutHint$StemLength('SHORT', 1, 5.0);\n TipLayoutHint$StemLength$NONE_instance = new TipLayoutHint$StemLength('NONE', 2, 0.0);\n }\n var TipLayoutHint$StemLength$NORMAL_instance;\n function TipLayoutHint$StemLength$NORMAL_getInstance() {\n TipLayoutHint$StemLength_initFields();\n return TipLayoutHint$StemLength$NORMAL_instance;\n }\n var TipLayoutHint$StemLength$SHORT_instance;\n function TipLayoutHint$StemLength$SHORT_getInstance() {\n TipLayoutHint$StemLength_initFields();\n return TipLayoutHint$StemLength$SHORT_instance;\n }\n var TipLayoutHint$StemLength$NONE_instance;\n function TipLayoutHint$StemLength$NONE_getInstance() {\n TipLayoutHint$StemLength_initFields();\n return TipLayoutHint$StemLength$NONE_instance;\n }\n TipLayoutHint$StemLength.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StemLength',\n interfaces: [Enum]\n };\n function TipLayoutHint$StemLength$values() {\n return [TipLayoutHint$StemLength$NORMAL_getInstance(), TipLayoutHint$StemLength$SHORT_getInstance(), TipLayoutHint$StemLength$NONE_getInstance()];\n }\n TipLayoutHint$StemLength.values = TipLayoutHint$StemLength$values;\n function TipLayoutHint$StemLength$valueOf(name) {\n switch (name) {\n case 'NORMAL':\n return TipLayoutHint$StemLength$NORMAL_getInstance();\n case 'SHORT':\n return TipLayoutHint$StemLength$SHORT_getInstance();\n case 'NONE':\n return TipLayoutHint$StemLength$NONE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.TipLayoutHint.StemLength.' + name);\n }\n }\n TipLayoutHint$StemLength.valueOf_61zpoe$ = TipLayoutHint$StemLength$valueOf;\n TipLayoutHint.prototype.toString = function () {\n return this.kind.toString();\n };\n function TipLayoutHint$Kind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TipLayoutHint$Kind_initFields() {\n TipLayoutHint$Kind_initFields = function () {\n };\n TipLayoutHint$Kind$VERTICAL_TOOLTIP_instance = new TipLayoutHint$Kind('VERTICAL_TOOLTIP', 0);\n TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_instance = new TipLayoutHint$Kind('HORIZONTAL_TOOLTIP', 1);\n TipLayoutHint$Kind$CURSOR_TOOLTIP_instance = new TipLayoutHint$Kind('CURSOR_TOOLTIP', 2);\n TipLayoutHint$Kind$X_AXIS_TOOLTIP_instance = new TipLayoutHint$Kind('X_AXIS_TOOLTIP', 3);\n TipLayoutHint$Kind$Y_AXIS_TOOLTIP_instance = new TipLayoutHint$Kind('Y_AXIS_TOOLTIP', 4);\n }\n var TipLayoutHint$Kind$VERTICAL_TOOLTIP_instance;\n function TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance() {\n TipLayoutHint$Kind_initFields();\n return TipLayoutHint$Kind$VERTICAL_TOOLTIP_instance;\n }\n var TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_instance;\n function TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance() {\n TipLayoutHint$Kind_initFields();\n return TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_instance;\n }\n var TipLayoutHint$Kind$CURSOR_TOOLTIP_instance;\n function TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance() {\n TipLayoutHint$Kind_initFields();\n return TipLayoutHint$Kind$CURSOR_TOOLTIP_instance;\n }\n var TipLayoutHint$Kind$X_AXIS_TOOLTIP_instance;\n function TipLayoutHint$Kind$X_AXIS_TOOLTIP_getInstance() {\n TipLayoutHint$Kind_initFields();\n return TipLayoutHint$Kind$X_AXIS_TOOLTIP_instance;\n }\n var TipLayoutHint$Kind$Y_AXIS_TOOLTIP_instance;\n function TipLayoutHint$Kind$Y_AXIS_TOOLTIP_getInstance() {\n TipLayoutHint$Kind_initFields();\n return TipLayoutHint$Kind$Y_AXIS_TOOLTIP_instance;\n }\n TipLayoutHint$Kind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Kind',\n interfaces: [Enum]\n };\n function TipLayoutHint$Kind$values() {\n return [TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance(), TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance(), TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance(), TipLayoutHint$Kind$X_AXIS_TOOLTIP_getInstance(), TipLayoutHint$Kind$Y_AXIS_TOOLTIP_getInstance()];\n }\n TipLayoutHint$Kind.values = TipLayoutHint$Kind$values;\n function TipLayoutHint$Kind$valueOf(name) {\n switch (name) {\n case 'VERTICAL_TOOLTIP':\n return TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance();\n case 'HORIZONTAL_TOOLTIP':\n return TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance();\n case 'CURSOR_TOOLTIP':\n return TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance();\n case 'X_AXIS_TOOLTIP':\n return TipLayoutHint$Kind$X_AXIS_TOOLTIP_getInstance();\n case 'Y_AXIS_TOOLTIP':\n return TipLayoutHint$Kind$Y_AXIS_TOOLTIP_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.TipLayoutHint.Kind.' + name);\n }\n }\n TipLayoutHint$Kind.valueOf_61zpoe$ = TipLayoutHint$Kind$valueOf;\n function TipLayoutHint$Companion() {\n TipLayoutHint$Companion_instance = this;\n }\n TipLayoutHint$Companion.prototype.verticalTooltip_6lq1u6$ = function (coord, objectRadius, color, stemLength) {\n if (stemLength === void 0)\n stemLength = TipLayoutHint$StemLength$NORMAL_getInstance();\n return new TipLayoutHint(TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance(), coord, objectRadius, color, stemLength);\n };\n TipLayoutHint$Companion.prototype.horizontalTooltip_6lq1u6$ = function (coord, objectRadius, color, stemLength) {\n if (stemLength === void 0)\n stemLength = TipLayoutHint$StemLength$NORMAL_getInstance();\n return new TipLayoutHint(TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance(), coord, objectRadius, color, stemLength);\n };\n TipLayoutHint$Companion.prototype.cursorTooltip_itpcqk$ = function (coord, color, stemLength) {\n if (stemLength === void 0)\n stemLength = TipLayoutHint$StemLength$NORMAL_getInstance();\n return new TipLayoutHint(TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance(), coord, 0.0, color, stemLength);\n };\n TipLayoutHint$Companion.prototype.xAxisTooltip_cgf2ia$ = function (coord, color, axisRadius, stemLength) {\n if (axisRadius === void 0)\n axisRadius = 0.0;\n if (stemLength === void 0)\n stemLength = TipLayoutHint$StemLength$NONE_getInstance();\n return new TipLayoutHint(TipLayoutHint$Kind$X_AXIS_TOOLTIP_getInstance(), coord, axisRadius, color, stemLength);\n };\n TipLayoutHint$Companion.prototype.yAxisTooltip_cgf2ia$ = function (coord, color, axisRadius, stemLength) {\n if (axisRadius === void 0)\n axisRadius = 0.0;\n if (stemLength === void 0)\n stemLength = TipLayoutHint$StemLength$NONE_getInstance();\n return new TipLayoutHint(TipLayoutHint$Kind$Y_AXIS_TOOLTIP_getInstance(), coord, axisRadius, color, stemLength);\n };\n TipLayoutHint$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TipLayoutHint$Companion_instance = null;\n function TipLayoutHint$Companion_getInstance() {\n if (TipLayoutHint$Companion_instance === null) {\n new TipLayoutHint$Companion();\n }return TipLayoutHint$Companion_instance;\n }\n TipLayoutHint.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TipLayoutHint',\n interfaces: []\n };\n function TooltipAnchor(verticalAnchor, horizontalAnchor) {\n this.verticalAnchor = verticalAnchor;\n this.horizontalAnchor = horizontalAnchor;\n }\n function TooltipAnchor$VerticalAnchor(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TooltipAnchor$VerticalAnchor_initFields() {\n TooltipAnchor$VerticalAnchor_initFields = function () {\n };\n TooltipAnchor$VerticalAnchor$TOP_instance = new TooltipAnchor$VerticalAnchor('TOP', 0);\n TooltipAnchor$VerticalAnchor$BOTTOM_instance = new TooltipAnchor$VerticalAnchor('BOTTOM', 1);\n TooltipAnchor$VerticalAnchor$MIDDLE_instance = new TooltipAnchor$VerticalAnchor('MIDDLE', 2);\n }\n var TooltipAnchor$VerticalAnchor$TOP_instance;\n function TooltipAnchor$VerticalAnchor$TOP_getInstance() {\n TooltipAnchor$VerticalAnchor_initFields();\n return TooltipAnchor$VerticalAnchor$TOP_instance;\n }\n var TooltipAnchor$VerticalAnchor$BOTTOM_instance;\n function TooltipAnchor$VerticalAnchor$BOTTOM_getInstance() {\n TooltipAnchor$VerticalAnchor_initFields();\n return TooltipAnchor$VerticalAnchor$BOTTOM_instance;\n }\n var TooltipAnchor$VerticalAnchor$MIDDLE_instance;\n function TooltipAnchor$VerticalAnchor$MIDDLE_getInstance() {\n TooltipAnchor$VerticalAnchor_initFields();\n return TooltipAnchor$VerticalAnchor$MIDDLE_instance;\n }\n TooltipAnchor$VerticalAnchor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalAnchor',\n interfaces: [Enum]\n };\n function TooltipAnchor$VerticalAnchor$values() {\n return [TooltipAnchor$VerticalAnchor$TOP_getInstance(), TooltipAnchor$VerticalAnchor$BOTTOM_getInstance(), TooltipAnchor$VerticalAnchor$MIDDLE_getInstance()];\n }\n TooltipAnchor$VerticalAnchor.values = TooltipAnchor$VerticalAnchor$values;\n function TooltipAnchor$VerticalAnchor$valueOf(name) {\n switch (name) {\n case 'TOP':\n return TooltipAnchor$VerticalAnchor$TOP_getInstance();\n case 'BOTTOM':\n return TooltipAnchor$VerticalAnchor$BOTTOM_getInstance();\n case 'MIDDLE':\n return TooltipAnchor$VerticalAnchor$MIDDLE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.TooltipAnchor.VerticalAnchor.' + name);\n }\n }\n TooltipAnchor$VerticalAnchor.valueOf_61zpoe$ = TooltipAnchor$VerticalAnchor$valueOf;\n function TooltipAnchor$HorizontalAnchor(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TooltipAnchor$HorizontalAnchor_initFields() {\n TooltipAnchor$HorizontalAnchor_initFields = function () {\n };\n TooltipAnchor$HorizontalAnchor$LEFT_instance = new TooltipAnchor$HorizontalAnchor('LEFT', 0);\n TooltipAnchor$HorizontalAnchor$RIGHT_instance = new TooltipAnchor$HorizontalAnchor('RIGHT', 1);\n TooltipAnchor$HorizontalAnchor$CENTER_instance = new TooltipAnchor$HorizontalAnchor('CENTER', 2);\n }\n var TooltipAnchor$HorizontalAnchor$LEFT_instance;\n function TooltipAnchor$HorizontalAnchor$LEFT_getInstance() {\n TooltipAnchor$HorizontalAnchor_initFields();\n return TooltipAnchor$HorizontalAnchor$LEFT_instance;\n }\n var TooltipAnchor$HorizontalAnchor$RIGHT_instance;\n function TooltipAnchor$HorizontalAnchor$RIGHT_getInstance() {\n TooltipAnchor$HorizontalAnchor_initFields();\n return TooltipAnchor$HorizontalAnchor$RIGHT_instance;\n }\n var TooltipAnchor$HorizontalAnchor$CENTER_instance;\n function TooltipAnchor$HorizontalAnchor$CENTER_getInstance() {\n TooltipAnchor$HorizontalAnchor_initFields();\n return TooltipAnchor$HorizontalAnchor$CENTER_instance;\n }\n TooltipAnchor$HorizontalAnchor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalAnchor',\n interfaces: [Enum]\n };\n function TooltipAnchor$HorizontalAnchor$values() {\n return [TooltipAnchor$HorizontalAnchor$LEFT_getInstance(), TooltipAnchor$HorizontalAnchor$RIGHT_getInstance(), TooltipAnchor$HorizontalAnchor$CENTER_getInstance()];\n }\n TooltipAnchor$HorizontalAnchor.values = TooltipAnchor$HorizontalAnchor$values;\n function TooltipAnchor$HorizontalAnchor$valueOf(name) {\n switch (name) {\n case 'LEFT':\n return TooltipAnchor$HorizontalAnchor$LEFT_getInstance();\n case 'RIGHT':\n return TooltipAnchor$HorizontalAnchor$RIGHT_getInstance();\n case 'CENTER':\n return TooltipAnchor$HorizontalAnchor$CENTER_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.TooltipAnchor.HorizontalAnchor.' + name);\n }\n }\n TooltipAnchor$HorizontalAnchor.valueOf_61zpoe$ = TooltipAnchor$HorizontalAnchor$valueOf;\n TooltipAnchor.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, TooltipAnchor) ? tmp$_0 : throwCCE();\n if (this.verticalAnchor !== other.verticalAnchor)\n return false;\n if (this.horizontalAnchor !== other.horizontalAnchor)\n return false;\n return true;\n };\n TooltipAnchor.prototype.hashCode = function () {\n var result = this.verticalAnchor.hashCode();\n result = (31 * result | 0) + this.horizontalAnchor.hashCode() | 0;\n return result;\n };\n TooltipAnchor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipAnchor',\n interfaces: []\n };\n function TooltipLineSpec() {\n }\n function TooltipLineSpec$DataPoint(label, value, aes, isAxis, isOutlier) {\n this.label = label;\n this.value = value;\n this.aes = aes;\n this.isAxis = isAxis;\n this.isOutlier = isOutlier;\n }\n TooltipLineSpec$DataPoint.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataPoint',\n interfaces: []\n };\n TooltipLineSpec.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'TooltipLineSpec',\n interfaces: []\n };\n function LivemapConstants() {\n }\n function LivemapConstants$DisplayMode(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LivemapConstants$DisplayMode_initFields() {\n LivemapConstants$DisplayMode_initFields = function () {\n };\n LivemapConstants$DisplayMode$POINT_instance = new LivemapConstants$DisplayMode('POINT', 0);\n LivemapConstants$DisplayMode$PIE_instance = new LivemapConstants$DisplayMode('PIE', 1);\n LivemapConstants$DisplayMode$BAR_instance = new LivemapConstants$DisplayMode('BAR', 2);\n }\n var LivemapConstants$DisplayMode$POINT_instance;\n function LivemapConstants$DisplayMode$POINT_getInstance() {\n LivemapConstants$DisplayMode_initFields();\n return LivemapConstants$DisplayMode$POINT_instance;\n }\n var LivemapConstants$DisplayMode$PIE_instance;\n function LivemapConstants$DisplayMode$PIE_getInstance() {\n LivemapConstants$DisplayMode_initFields();\n return LivemapConstants$DisplayMode$PIE_instance;\n }\n var LivemapConstants$DisplayMode$BAR_instance;\n function LivemapConstants$DisplayMode$BAR_getInstance() {\n LivemapConstants$DisplayMode_initFields();\n return LivemapConstants$DisplayMode$BAR_instance;\n }\n LivemapConstants$DisplayMode.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DisplayMode',\n interfaces: [Enum]\n };\n function LivemapConstants$DisplayMode$values() {\n return [LivemapConstants$DisplayMode$POINT_getInstance(), LivemapConstants$DisplayMode$PIE_getInstance(), LivemapConstants$DisplayMode$BAR_getInstance()];\n }\n LivemapConstants$DisplayMode.values = LivemapConstants$DisplayMode$values;\n function LivemapConstants$DisplayMode$valueOf(name) {\n switch (name) {\n case 'POINT':\n return LivemapConstants$DisplayMode$POINT_getInstance();\n case 'PIE':\n return LivemapConstants$DisplayMode$PIE_getInstance();\n case 'BAR':\n return LivemapConstants$DisplayMode$BAR_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.livemap.LivemapConstants.DisplayMode.' + name);\n }\n }\n LivemapConstants$DisplayMode.valueOf_61zpoe$ = LivemapConstants$DisplayMode$valueOf;\n function LivemapConstants$Theme(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LivemapConstants$Theme_initFields() {\n LivemapConstants$Theme_initFields = function () {\n };\n LivemapConstants$Theme$COLOR_instance = new LivemapConstants$Theme('COLOR', 0);\n LivemapConstants$Theme$LIGHT_instance = new LivemapConstants$Theme('LIGHT', 1);\n LivemapConstants$Theme$DARK_instance = new LivemapConstants$Theme('DARK', 2);\n }\n var LivemapConstants$Theme$COLOR_instance;\n function LivemapConstants$Theme$COLOR_getInstance() {\n LivemapConstants$Theme_initFields();\n return LivemapConstants$Theme$COLOR_instance;\n }\n var LivemapConstants$Theme$LIGHT_instance;\n function LivemapConstants$Theme$LIGHT_getInstance() {\n LivemapConstants$Theme_initFields();\n return LivemapConstants$Theme$LIGHT_instance;\n }\n var LivemapConstants$Theme$DARK_instance;\n function LivemapConstants$Theme$DARK_getInstance() {\n LivemapConstants$Theme_initFields();\n return LivemapConstants$Theme$DARK_instance;\n }\n LivemapConstants$Theme.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Theme',\n interfaces: [Enum]\n };\n function LivemapConstants$Theme$values() {\n return [LivemapConstants$Theme$COLOR_getInstance(), LivemapConstants$Theme$LIGHT_getInstance(), LivemapConstants$Theme$DARK_getInstance()];\n }\n LivemapConstants$Theme.values = LivemapConstants$Theme$values;\n function LivemapConstants$Theme$valueOf(name) {\n switch (name) {\n case 'COLOR':\n return LivemapConstants$Theme$COLOR_getInstance();\n case 'LIGHT':\n return LivemapConstants$Theme$LIGHT_getInstance();\n case 'DARK':\n return LivemapConstants$Theme$DARK_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.livemap.LivemapConstants.Theme.' + name);\n }\n }\n LivemapConstants$Theme.valueOf_61zpoe$ = LivemapConstants$Theme$valueOf;\n function LivemapConstants$Projection(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LivemapConstants$Projection_initFields() {\n LivemapConstants$Projection_initFields = function () {\n };\n LivemapConstants$Projection$EPSG3857_instance = new LivemapConstants$Projection('EPSG3857', 0);\n LivemapConstants$Projection$EPSG4326_instance = new LivemapConstants$Projection('EPSG4326', 1);\n LivemapConstants$Projection$AZIMUTHAL_instance = new LivemapConstants$Projection('AZIMUTHAL', 2);\n LivemapConstants$Projection$CONIC_instance = new LivemapConstants$Projection('CONIC', 3);\n }\n var LivemapConstants$Projection$EPSG3857_instance;\n function LivemapConstants$Projection$EPSG3857_getInstance() {\n LivemapConstants$Projection_initFields();\n return LivemapConstants$Projection$EPSG3857_instance;\n }\n var LivemapConstants$Projection$EPSG4326_instance;\n function LivemapConstants$Projection$EPSG4326_getInstance() {\n LivemapConstants$Projection_initFields();\n return LivemapConstants$Projection$EPSG4326_instance;\n }\n var LivemapConstants$Projection$AZIMUTHAL_instance;\n function LivemapConstants$Projection$AZIMUTHAL_getInstance() {\n LivemapConstants$Projection_initFields();\n return LivemapConstants$Projection$AZIMUTHAL_instance;\n }\n var LivemapConstants$Projection$CONIC_instance;\n function LivemapConstants$Projection$CONIC_getInstance() {\n LivemapConstants$Projection_initFields();\n return LivemapConstants$Projection$CONIC_instance;\n }\n LivemapConstants$Projection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Projection',\n interfaces: [Enum]\n };\n function LivemapConstants$Projection$values() {\n return [LivemapConstants$Projection$EPSG3857_getInstance(), LivemapConstants$Projection$EPSG4326_getInstance(), LivemapConstants$Projection$AZIMUTHAL_getInstance(), LivemapConstants$Projection$CONIC_getInstance()];\n }\n LivemapConstants$Projection.values = LivemapConstants$Projection$values;\n function LivemapConstants$Projection$valueOf(name) {\n switch (name) {\n case 'EPSG3857':\n return LivemapConstants$Projection$EPSG3857_getInstance();\n case 'EPSG4326':\n return LivemapConstants$Projection$EPSG4326_getInstance();\n case 'AZIMUTHAL':\n return LivemapConstants$Projection$AZIMUTHAL_getInstance();\n case 'CONIC':\n return LivemapConstants$Projection$CONIC_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.livemap.LivemapConstants.Projection.' + name);\n }\n }\n LivemapConstants$Projection.valueOf_61zpoe$ = LivemapConstants$Projection$valueOf;\n LivemapConstants.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LivemapConstants',\n interfaces: []\n };\n function LiveMapOptions(zoom, location, stroke, interactive, displayMode, scaled, clustering, labels, projection, geodesic, geocodingService, tileProvider, devParams) {\n this.zoom = zoom;\n this.location = location;\n this.stroke = stroke;\n this.interactive = interactive;\n this.displayMode = displayMode;\n this.scaled = scaled;\n this.clustering = clustering;\n this.labels = labels;\n this.projection = projection;\n this.geodesic = geodesic;\n this.geocodingService = geocodingService;\n this.tileProvider = tileProvider;\n this.devParams = devParams;\n }\n LiveMapOptions.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LiveMapOptions',\n interfaces: []\n };\n function DodgePos(aesthetics, myGroupCount, myWidth) {\n this.myGroupCount_0 = myGroupCount;\n this.myWidth_0 = myWidth;\n this.myDodgingNeeded_0 = false;\n this.myDodgingNeeded_0 = this.isDodgingNeeded_0(aesthetics);\n }\n DodgePos.prototype.isDodgingNeeded_0 = function (aesthetics) {\n var tmp$;\n var groupByX = HashMap_init();\n tmp$ = aesthetics.dataPointCount();\n for (var i = 0; i < tmp$; i++) {\n var p = aesthetics.dataPointAt_za3lpa$(i);\n if (p.defined_896ixz$(Aes$Companion_getInstance().X)) {\n var x = ensureNotNull(p.x());\n var group = p.group();\n if (groupByX.containsKey_11rb$(x)) {\n if (groupByX.get_11rb$(x) != group) {\n return true;\n }} else {\n groupByX.put_xwzc9p$(x, group);\n }\n }}\n return false;\n };\n DodgePos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n var tmp$;\n if (this.myDodgingNeeded_0) {\n var dataResolution = ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n var width = (tmp$ = this.myWidth_0) != null ? tmp$ : p.width();\n if (!data.SeriesUtil.isFinite_yrwdxb$(width)) {\n return v;\n }var slotIndex = ensureNotNull(p.group());\n var median = (this.myGroupCount_0 - 1 | 0) / 2.0;\n var xOffset = (slotIndex - median) * dataResolution * ensureNotNull(width);\n var xCenter = ensureNotNull(p.x());\n var xScaler = 1.0 / this.myGroupCount_0;\n var newX = (v.x + xOffset - xCenter) * xScaler + xCenter;\n return new DoubleVector(newX, v.y);\n }return v;\n };\n DodgePos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$DODGE_getInstance().handlesGroups();\n };\n DodgePos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DodgePos',\n interfaces: [PositionAdjustment]\n };\n function FillPos(aes) {\n this.myStackPosHelper_0 = StackPos$Companion_getInstance().splitPositiveNegative_m7huy5$(aes);\n this.myScalerByIndex_0 = this.mapIndexToScaler_0(aes);\n }\n FillPos.prototype.mapIndexToScaler_0 = function (aes) {\n var tmp$, tmp$_0;\n var posMaxByBin = HashMap_init();\n var negMaxByBin = HashMap_init();\n tmp$ = aes.dataPointCount();\n for (var i = 0; i < tmp$; i++) {\n var dataPoint = aes.dataPointAt_za3lpa$(i);\n var x = dataPoint.x();\n if (data.SeriesUtil.isFinite_yrwdxb$(x)) {\n var tmp$_1;\n if (!(Kotlin.isType(tmp$_1 = posMaxByBin, Map) ? tmp$_1 : throwCCE()).containsKey_11rb$(x)) {\n var key = ensureNotNull(x);\n posMaxByBin.put_xwzc9p$(key, 0.0);\n negMaxByBin.put_xwzc9p$(x, 0.0);\n }var y = dataPoint.y();\n if (data.SeriesUtil.isFinite_yrwdxb$(y)) {\n if (ensureNotNull(y) >= 0) {\n var key_0 = ensureNotNull(x);\n var value = ensureNotNull(posMaxByBin.get_11rb$(x)) + y;\n posMaxByBin.put_xwzc9p$(key_0, value);\n } else {\n var key_1 = ensureNotNull(x);\n var value_0 = ensureNotNull(negMaxByBin.get_11rb$(x)) - y;\n negMaxByBin.put_xwzc9p$(key_1, value_0);\n }\n }}}\n var scalerByIndex = HashMap_init();\n tmp$_0 = aes.dataPointCount();\n for (var i_0 = 0; i_0 < tmp$_0; i_0++) {\n var dataPoint_0 = aes.dataPointAt_za3lpa$(i_0);\n var x_0 = dataPoint_0.x();\n var y_0 = dataPoint_0.y();\n var tmp$_2;\n if ((Kotlin.isType(tmp$_2 = posMaxByBin, Map) ? tmp$_2 : throwCCE()).containsKey_11rb$(x_0) && data.SeriesUtil.isFinite_yrwdxb$(y_0)) {\n var tmp$_3 = ensureNotNull(y_0) >= 0;\n if (tmp$_3) {\n var tmp$_4;\n tmp$_3 = ensureNotNull((Kotlin.isType(tmp$_4 = posMaxByBin, Map) ? tmp$_4 : throwCCE()).get_11rb$(x_0)) > 0;\n }if (tmp$_3) {\n var tmp$_5;\n var value_1 = 1.0 / ensureNotNull((Kotlin.isType(tmp$_5 = posMaxByBin, Map) ? tmp$_5 : throwCCE()).get_11rb$(x_0));\n scalerByIndex.put_xwzc9p$(i_0, value_1);\n } else {\n var tmp$_6 = y_0 < 0;\n if (tmp$_6) {\n var tmp$_7;\n tmp$_6 = ensureNotNull((Kotlin.isType(tmp$_7 = negMaxByBin, Map) ? tmp$_7 : throwCCE()).get_11rb$(x_0)) > 0;\n }if (tmp$_6) {\n var tmp$_8;\n var value_2 = 1.0 / ensureNotNull((Kotlin.isType(tmp$_8 = negMaxByBin, Map) ? tmp$_8 : throwCCE()).get_11rb$(x_0));\n scalerByIndex.put_xwzc9p$(i_0, value_2);\n } else {\n scalerByIndex.put_xwzc9p$(i_0, 1.0);\n }\n }\n } else {\n scalerByIndex.put_xwzc9p$(i_0, 1.0);\n }\n }\n return scalerByIndex;\n };\n FillPos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n var newLoc = this.myStackPosHelper_0.translate_tshsjz$(v, p, ctx);\n return new DoubleVector(newLoc.x, newLoc.y * ensureNotNull(this.myScalerByIndex_0.get_11rb$(p.index())) * ctx.getUnitResolution_vktour$(Aes$Companion_getInstance().Y));\n };\n FillPos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$FILL_getInstance().handlesGroups();\n };\n FillPos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FillPos',\n interfaces: [PositionAdjustment]\n };\n function JitterDodgePos(aesthetics, groupCount, width, jitterWidth, jitterHeight) {\n this.myJitterPosHelper_0 = null;\n this.myDodgePosHelper_0 = null;\n this.myJitterPosHelper_0 = new JitterPos(jitterWidth, jitterHeight);\n this.myDodgePosHelper_0 = new DodgePos(aesthetics, groupCount, width);\n }\n JitterDodgePos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n var afterJitter = this.myJitterPosHelper_0.translate_tshsjz$(v, p, ctx);\n return this.myDodgePosHelper_0.translate_tshsjz$(afterJitter, p, ctx);\n };\n JitterDodgePos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$JITTER_DODGE_getInstance().handlesGroups();\n };\n JitterDodgePos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JitterDodgePos',\n interfaces: [PositionAdjustment]\n };\n function JitterPos(width, height) {\n JitterPos$Companion_getInstance();\n this.myWidth_0 = 0;\n this.myHeight_0 = 0;\n this.myWidth_0 = width != null ? width : JitterPos$Companion_getInstance().DEF_JITTER_WIDTH;\n this.myHeight_0 = height != null ? height : JitterPos$Companion_getInstance().DEF_JITTER_HEIGHT;\n }\n JitterPos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n var x = (2 * Random.Default.nextDouble() - 1) * this.myWidth_0 * ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n var y = (2 * Random.Default.nextDouble() - 1) * this.myHeight_0 * ctx.getResolution_vktour$(Aes$Companion_getInstance().Y);\n return v.add_gpjtzr$(new DoubleVector(x, y));\n };\n JitterPos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$JITTER_getInstance().handlesGroups();\n };\n function JitterPos$Companion() {\n JitterPos$Companion_instance = this;\n this.DEF_JITTER_WIDTH = 0.4;\n this.DEF_JITTER_HEIGHT = 0.4;\n }\n JitterPos$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var JitterPos$Companion_instance = null;\n function JitterPos$Companion_getInstance() {\n if (JitterPos$Companion_instance === null) {\n new JitterPos$Companion();\n }return JitterPos$Companion_instance;\n }\n JitterPos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JitterPos',\n interfaces: [PositionAdjustment]\n };\n function NudgePos(width, height) {\n NudgePos$Companion_getInstance();\n this.myWidth_0 = 0;\n this.myHeight_0 = 0;\n this.myWidth_0 = width != null ? width : NudgePos$Companion_getInstance().DEF_NUDGE_WIDTH;\n this.myHeight_0 = height != null ? height : NudgePos$Companion_getInstance().DEF_NUDGE_HEIGHT;\n }\n NudgePos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n var x = this.myWidth_0 * ctx.getUnitResolution_vktour$(Aes$Companion_getInstance().X);\n var y = this.myHeight_0 * ctx.getUnitResolution_vktour$(Aes$Companion_getInstance().Y);\n return v.add_gpjtzr$(new DoubleVector(x, y));\n };\n NudgePos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$NUDGE_getInstance().handlesGroups();\n };\n function NudgePos$Companion() {\n NudgePos$Companion_instance = this;\n this.DEF_NUDGE_WIDTH = 0.0;\n this.DEF_NUDGE_HEIGHT = 0.0;\n }\n NudgePos$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var NudgePos$Companion_instance = null;\n function NudgePos$Companion_getInstance() {\n if (NudgePos$Companion_instance === null) {\n new NudgePos$Companion();\n }return NudgePos$Companion_instance;\n }\n NudgePos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NudgePos',\n interfaces: [PositionAdjustment]\n };\n function PositionAdjustments() {\n PositionAdjustments_instance = this;\n }\n function PositionAdjustments$identity$ObjectLiteral() {\n }\n Object.defineProperty(PositionAdjustments$identity$ObjectLiteral.prototype, 'isIdentity', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n PositionAdjustments$identity$ObjectLiteral.prototype.translate_tshsjz$ = function (v, p, ctx) {\n return v;\n };\n PositionAdjustments$identity$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$IDENTITY_getInstance().handlesGroups();\n };\n PositionAdjustments$identity$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PositionAdjustment]\n };\n PositionAdjustments.prototype.identity = function () {\n return new PositionAdjustments$identity$ObjectLiteral();\n };\n PositionAdjustments.prototype.dodge_vvhcz8$ = function (aesthetics, groupCount, width) {\n return new DodgePos(aesthetics, groupCount, width);\n };\n PositionAdjustments.prototype.stack_4vnpmn$ = function (aes, strategy) {\n var tmp$;\n switch (strategy.name) {\n case 'SPLIT_POSITIVE_NEGATIVE':\n tmp$ = StackPos$Companion_getInstance().splitPositiveNegative_m7huy5$(aes);\n break;\n case 'SUM_POSITIVE_NEGATIVE':\n tmp$ = StackPos$Companion_getInstance().sumPositiveNegative_m7huy5$(aes);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n PositionAdjustments.prototype.fill_m7huy5$ = function (aesthetics) {\n return new FillPos(aesthetics);\n };\n PositionAdjustments.prototype.jitter_jma9l8$ = function (width, height) {\n return new JitterPos(width, height);\n };\n PositionAdjustments.prototype.nudge_jma9l8$ = function (width, height) {\n return new NudgePos(width, height);\n };\n PositionAdjustments.prototype.jitterDodge_e2pc44$ = function (aesthetics, groupCount, width, jitterWidth, jitterHeight) {\n return new JitterDodgePos(aesthetics, groupCount, width, jitterWidth, jitterHeight);\n };\n function PositionAdjustments$Meta(name, ordinal, myHandlesGroups) {\n Enum.call(this);\n this.myHandlesGroups_39qcox$_0 = myHandlesGroups;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function PositionAdjustments$Meta_initFields() {\n PositionAdjustments$Meta_initFields = function () {\n };\n PositionAdjustments$Meta$IDENTITY_instance = new PositionAdjustments$Meta('IDENTITY', 0, false);\n PositionAdjustments$Meta$DODGE_instance = new PositionAdjustments$Meta('DODGE', 1, true);\n PositionAdjustments$Meta$STACK_instance = new PositionAdjustments$Meta('STACK', 2, true);\n PositionAdjustments$Meta$FILL_instance = new PositionAdjustments$Meta('FILL', 3, true);\n PositionAdjustments$Meta$JITTER_instance = new PositionAdjustments$Meta('JITTER', 4, false);\n PositionAdjustments$Meta$NUDGE_instance = new PositionAdjustments$Meta('NUDGE', 5, false);\n PositionAdjustments$Meta$JITTER_DODGE_instance = new PositionAdjustments$Meta('JITTER_DODGE', 6, true);\n }\n var PositionAdjustments$Meta$IDENTITY_instance;\n function PositionAdjustments$Meta$IDENTITY_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$IDENTITY_instance;\n }\n var PositionAdjustments$Meta$DODGE_instance;\n function PositionAdjustments$Meta$DODGE_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$DODGE_instance;\n }\n var PositionAdjustments$Meta$STACK_instance;\n function PositionAdjustments$Meta$STACK_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$STACK_instance;\n }\n var PositionAdjustments$Meta$FILL_instance;\n function PositionAdjustments$Meta$FILL_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$FILL_instance;\n }\n var PositionAdjustments$Meta$JITTER_instance;\n function PositionAdjustments$Meta$JITTER_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$JITTER_instance;\n }\n var PositionAdjustments$Meta$NUDGE_instance;\n function PositionAdjustments$Meta$NUDGE_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$NUDGE_instance;\n }\n var PositionAdjustments$Meta$JITTER_DODGE_instance;\n function PositionAdjustments$Meta$JITTER_DODGE_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$JITTER_DODGE_instance;\n }\n PositionAdjustments$Meta.prototype.handlesGroups = function () {\n return this.myHandlesGroups_39qcox$_0;\n };\n PositionAdjustments$Meta.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Meta',\n interfaces: [Enum]\n };\n function PositionAdjustments$Meta$values() {\n return [PositionAdjustments$Meta$IDENTITY_getInstance(), PositionAdjustments$Meta$DODGE_getInstance(), PositionAdjustments$Meta$STACK_getInstance(), PositionAdjustments$Meta$FILL_getInstance(), PositionAdjustments$Meta$JITTER_getInstance(), PositionAdjustments$Meta$NUDGE_getInstance(), PositionAdjustments$Meta$JITTER_DODGE_getInstance()];\n }\n PositionAdjustments$Meta.values = PositionAdjustments$Meta$values;\n function PositionAdjustments$Meta$valueOf(name) {\n switch (name) {\n case 'IDENTITY':\n return PositionAdjustments$Meta$IDENTITY_getInstance();\n case 'DODGE':\n return PositionAdjustments$Meta$DODGE_getInstance();\n case 'STACK':\n return PositionAdjustments$Meta$STACK_getInstance();\n case 'FILL':\n return PositionAdjustments$Meta$FILL_getInstance();\n case 'JITTER':\n return PositionAdjustments$Meta$JITTER_getInstance();\n case 'NUDGE':\n return PositionAdjustments$Meta$NUDGE_getInstance();\n case 'JITTER_DODGE':\n return PositionAdjustments$Meta$JITTER_DODGE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.pos.PositionAdjustments.Meta.' + name);\n }\n }\n PositionAdjustments$Meta.valueOf_61zpoe$ = PositionAdjustments$Meta$valueOf;\n function PositionAdjustments$StackingStrategy(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function PositionAdjustments$StackingStrategy_initFields() {\n PositionAdjustments$StackingStrategy_initFields = function () {\n };\n PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_instance = new PositionAdjustments$StackingStrategy('SUM_POSITIVE_NEGATIVE', 0);\n PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_instance = new PositionAdjustments$StackingStrategy('SPLIT_POSITIVE_NEGATIVE', 1);\n }\n var PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_instance;\n function PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_getInstance() {\n PositionAdjustments$StackingStrategy_initFields();\n return PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_instance;\n }\n var PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_instance;\n function PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_getInstance() {\n PositionAdjustments$StackingStrategy_initFields();\n return PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_instance;\n }\n PositionAdjustments$StackingStrategy.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StackingStrategy',\n interfaces: [Enum]\n };\n function PositionAdjustments$StackingStrategy$values() {\n return [PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_getInstance(), PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_getInstance()];\n }\n PositionAdjustments$StackingStrategy.values = PositionAdjustments$StackingStrategy$values;\n function PositionAdjustments$StackingStrategy$valueOf(name) {\n switch (name) {\n case 'SUM_POSITIVE_NEGATIVE':\n return PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_getInstance();\n case 'SPLIT_POSITIVE_NEGATIVE':\n return PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.pos.PositionAdjustments.StackingStrategy.' + name);\n }\n }\n PositionAdjustments$StackingStrategy.valueOf_61zpoe$ = PositionAdjustments$StackingStrategy$valueOf;\n PositionAdjustments.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PositionAdjustments',\n interfaces: []\n };\n var PositionAdjustments_instance = null;\n function PositionAdjustments_getInstance() {\n if (PositionAdjustments_instance === null) {\n new PositionAdjustments();\n }return PositionAdjustments_instance;\n }\n function StackPos(aes) {\n StackPos$Companion_getInstance();\n this.myOffsetByIndex_0 = null;\n this.myOffsetByIndex_0 = this.mapIndexToOffset_m7huy5$(aes);\n }\n StackPos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n return v.add_gpjtzr$(new DoubleVector(0.0, ensureNotNull(this.myOffsetByIndex_0.get_11rb$(p.index()))));\n };\n StackPos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$STACK_getInstance().handlesGroups();\n };\n function StackPos$SplitPositiveNegative(aes) {\n StackPos.call(this, aes);\n }\n StackPos$SplitPositiveNegative.prototype.mapIndexToOffset_m7huy5$ = function (aes) {\n var tmp$;\n var offsetByIndex = HashMap_init();\n var negPosBaseByBin = HashMap_init();\n tmp$ = aes.dataPointCount();\n for (var i = 0; i < tmp$; i++) {\n var dataPoint = aes.dataPointAt_za3lpa$(i);\n var x = dataPoint.x();\n if (data.SeriesUtil.isFinite_yrwdxb$(x)) {\n var tmp$_0;\n if (!(Kotlin.isType(tmp$_0 = negPosBaseByBin, Map) ? tmp$_0 : throwCCE()).containsKey_11rb$(x)) {\n var key = ensureNotNull(x);\n var value = new Pair(new MutableDouble(0.0), new MutableDouble(0.0));\n negPosBaseByBin.put_xwzc9p$(key, value);\n }var y = dataPoint.y();\n if (data.SeriesUtil.isFinite_yrwdxb$(y)) {\n var tmp$_1;\n var pair = ensureNotNull((Kotlin.isType(tmp$_1 = negPosBaseByBin, Map) ? tmp$_1 : throwCCE()).get_11rb$(x));\n var offset;\n if (ensureNotNull(y) >= 0) {\n offset = pair.second.getAndAdd_14dthe$(y);\n } else {\n offset = pair.first.getAndAdd_14dthe$(y);\n }\n var value_0 = offset;\n offsetByIndex.put_xwzc9p$(i, value_0);\n }}}\n return offsetByIndex;\n };\n StackPos$SplitPositiveNegative.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SplitPositiveNegative',\n interfaces: [StackPos]\n };\n function StackPos$SumPositiveNegative(aes) {\n StackPos.call(this, aes);\n }\n StackPos$SumPositiveNegative.prototype.mapIndexToOffset_m7huy5$ = function (aes) {\n var tmp$;\n var offsetByIndex = HashMap_init();\n var baseByBin = HashMap_init();\n tmp$ = aes.dataPointCount();\n for (var i = 0; i < tmp$; i++) {\n var dataPointAes = aes.dataPointAt_za3lpa$(i);\n var x = ensureNotNull(dataPointAes.x());\n if (data.SeriesUtil.isFinite_14dthe$(x)) {\n if (!baseByBin.containsKey_11rb$(x)) {\n var value = new MutableDouble(0.0);\n baseByBin.put_xwzc9p$(x, value);\n }var y = ensureNotNull(dataPointAes.y());\n if (data.SeriesUtil.isFinite_14dthe$(y)) {\n var base = ensureNotNull(baseByBin.get_11rb$(x));\n var offset = base.getAndAdd_14dthe$(y);\n offsetByIndex.put_xwzc9p$(i, offset);\n }}}\n return offsetByIndex;\n };\n StackPos$SumPositiveNegative.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SumPositiveNegative',\n interfaces: [StackPos]\n };\n function StackPos$Companion() {\n StackPos$Companion_instance = this;\n }\n StackPos$Companion.prototype.splitPositiveNegative_m7huy5$ = function (aes) {\n return new StackPos$SplitPositiveNegative(aes);\n };\n StackPos$Companion.prototype.sumPositiveNegative_m7huy5$ = function (aes) {\n return new StackPos$SumPositiveNegative(aes);\n };\n StackPos$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var StackPos$Companion_instance = null;\n function StackPos$Companion_getInstance() {\n if (StackPos$Companion_instance === null) {\n new StackPos$Companion();\n }return StackPos$Companion_instance;\n }\n StackPos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StackPos',\n interfaces: [PositionAdjustment]\n };\n function LegendKeyElementFactory() {\n }\n LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var size = 2 * strokeWidth + 4;\n return new DoubleVector(size, size);\n };\n LegendKeyElementFactory.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LegendKeyElementFactory',\n interfaces: []\n };\n function SvgRoot() {\n }\n SvgRoot.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'SvgRoot',\n interfaces: []\n };\n function LineType() {\n }\n LineType.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LineType',\n interfaces: []\n };\n function NamedLineType(name, ordinal, code, myDashArray) {\n Enum.call(this);\n this.code = code;\n this.myDashArray_j93rys$_0 = myDashArray;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function NamedLineType_initFields() {\n NamedLineType_initFields = function () {\n };\n new NamedLineType$BLANK();\n new NamedLineType$SOLID();\n NamedLineType$DASHED_instance = new NamedLineType('DASHED', 2, 2, listOf([4.3, 4.3]));\n NamedLineType$DOTTED_instance = new NamedLineType('DOTTED', 3, 3, listOf([1.0, 3.2]));\n NamedLineType$DOTDASH_instance = new NamedLineType('DOTDASH', 4, 4, listOf([1.0, 3.2, 4.3, 3.2]));\n NamedLineType$LONGDASH_instance = new NamedLineType('LONGDASH', 5, 5, listOf([7.4, 3.2]));\n NamedLineType$TWODASH_instance = new NamedLineType('TWODASH', 6, 6, listOf([2.4, 2.4, 6.4, 2.4]));\n }\n function NamedLineType$BLANK() {\n NamedLineType$BLANK_instance = this;\n NamedLineType.call(this, 'BLANK', 0, 0, null);\n }\n Object.defineProperty(NamedLineType$BLANK.prototype, 'isBlank', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n NamedLineType$BLANK.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BLANK',\n interfaces: [NamedLineType]\n };\n var NamedLineType$BLANK_instance = null;\n function NamedLineType$BLANK_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$BLANK_instance;\n }\n function NamedLineType$SOLID() {\n NamedLineType$SOLID_instance = this;\n NamedLineType.call(this, 'SOLID', 1, 1, null);\n }\n Object.defineProperty(NamedLineType$SOLID.prototype, 'isSolid', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n NamedLineType$SOLID.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SOLID',\n interfaces: [NamedLineType]\n };\n var NamedLineType$SOLID_instance = null;\n function NamedLineType$SOLID_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$SOLID_instance;\n }\n var NamedLineType$DASHED_instance;\n function NamedLineType$DASHED_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$DASHED_instance;\n }\n var NamedLineType$DOTTED_instance;\n function NamedLineType$DOTTED_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$DOTTED_instance;\n }\n var NamedLineType$DOTDASH_instance;\n function NamedLineType$DOTDASH_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$DOTDASH_instance;\n }\n var NamedLineType$LONGDASH_instance;\n function NamedLineType$LONGDASH_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$LONGDASH_instance;\n }\n var NamedLineType$TWODASH_instance;\n function NamedLineType$TWODASH_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$TWODASH_instance;\n }\n Object.defineProperty(NamedLineType.prototype, 'isSolid', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(NamedLineType.prototype, 'isBlank', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(NamedLineType.prototype, 'dashArray', {\n configurable: true,\n get: function () {\n if (!(this.isSolid || this.isBlank)) {\n return ensureNotNull(this.myDashArray_j93rys$_0);\n }throw IllegalStateException_init('No dash array in ' + this.name.toLowerCase() + ' linetype');\n }\n });\n NamedLineType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NamedLineType',\n interfaces: [LineType, Enum]\n };\n function NamedLineType$values() {\n return [NamedLineType$BLANK_getInstance(), NamedLineType$SOLID_getInstance(), NamedLineType$DASHED_getInstance(), NamedLineType$DOTTED_getInstance(), NamedLineType$DOTDASH_getInstance(), NamedLineType$LONGDASH_getInstance(), NamedLineType$TWODASH_getInstance()];\n }\n NamedLineType.values = NamedLineType$values;\n function NamedLineType$valueOf(name) {\n switch (name) {\n case 'BLANK':\n return NamedLineType$BLANK_getInstance();\n case 'SOLID':\n return NamedLineType$SOLID_getInstance();\n case 'DASHED':\n return NamedLineType$DASHED_getInstance();\n case 'DOTTED':\n return NamedLineType$DOTTED_getInstance();\n case 'DOTDASH':\n return NamedLineType$DOTDASH_getInstance();\n case 'LONGDASH':\n return NamedLineType$LONGDASH_getInstance();\n case 'TWODASH':\n return NamedLineType$TWODASH_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.render.linetype.NamedLineType.' + name);\n }\n }\n NamedLineType.valueOf_61zpoe$ = NamedLineType$valueOf;\n function NamedShape(name, ordinal, code, isSolid, isFilled, isSmall) {\n if (isSolid === void 0)\n isSolid = false;\n if (isFilled === void 0)\n isFilled = false;\n if (isSmall === void 0)\n isSmall = false;\n Enum.call(this);\n this.code_djxmtz$_0 = code;\n this.isSolid = isSolid;\n this.isFilled = isFilled;\n this.isSmall_kvok7h$_0 = isSmall;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function NamedShape_initFields() {\n NamedShape_initFields = function () {\n };\n NamedShape$STICK_SQUARE_instance = new NamedShape('STICK_SQUARE', 0, 0);\n NamedShape$STICK_CIRCLE_instance = new NamedShape('STICK_CIRCLE', 1, 1);\n NamedShape$STICK_TRIANGLE_UP_instance = new NamedShape('STICK_TRIANGLE_UP', 2, 2);\n NamedShape$STICK_PLUS_instance = new NamedShape('STICK_PLUS', 3, 3);\n NamedShape$STICK_CROSS_instance = new NamedShape('STICK_CROSS', 4, 4);\n NamedShape$STICK_DIAMOND_instance = new NamedShape('STICK_DIAMOND', 5, 5);\n NamedShape$STICK_TRIANGLE_DOWN_instance = new NamedShape('STICK_TRIANGLE_DOWN', 6, 6);\n NamedShape$STICK_SQUARE_CROSS_instance = new NamedShape('STICK_SQUARE_CROSS', 7, 7);\n NamedShape$STICK_STAR_instance = new NamedShape('STICK_STAR', 8, 8);\n NamedShape$STICK_DIAMOND_PLUS_instance = new NamedShape('STICK_DIAMOND_PLUS', 9, 9);\n NamedShape$STICK_CIRCLE_PLUS_instance = new NamedShape('STICK_CIRCLE_PLUS', 10, 10);\n NamedShape$STICK_TRIANGLE_UP_DOWN_instance = new NamedShape('STICK_TRIANGLE_UP_DOWN', 11, 11);\n NamedShape$STICK_SQUARE_PLUS_instance = new NamedShape('STICK_SQUARE_PLUS', 12, 12);\n NamedShape$STICK_CIRCLE_CROSS_instance = new NamedShape('STICK_CIRCLE_CROSS', 13, 13);\n NamedShape$STICK_SQUARE_TRIANGLE_UP_instance = new NamedShape('STICK_SQUARE_TRIANGLE_UP', 14, 14);\n NamedShape$SOLID_SQUARE_instance = new NamedShape('SOLID_SQUARE', 15, 15, true, false);\n NamedShape$SOLID_CIRCLE_instance = new NamedShape('SOLID_CIRCLE', 16, 16, true, false);\n NamedShape$SOLID_TRIANGLE_UP_instance = new NamedShape('SOLID_TRIANGLE_UP', 17, 17, true, false);\n NamedShape$SOLID_DIAMOND_instance = new NamedShape('SOLID_DIAMOND', 18, 18, true, false, true);\n NamedShape$SOLID_CIRCLE_2_instance = new NamedShape('SOLID_CIRCLE_2', 19, 19, true, false);\n NamedShape$BULLET_instance = new NamedShape('BULLET', 20, 20, true, false, true);\n NamedShape$FILLED_CIRCLE_instance = new NamedShape('FILLED_CIRCLE', 21, 21, false, true);\n NamedShape$FILLED_SQUARE_instance = new NamedShape('FILLED_SQUARE', 22, 22, false, true);\n NamedShape$FILLED_DIAMOND_instance = new NamedShape('FILLED_DIAMOND', 23, 23, false, true);\n NamedShape$FILLED_TRIANGLE_UP_instance = new NamedShape('FILLED_TRIANGLE_UP', 24, 24, false, true);\n NamedShape$FILLED_TRIANGLE_DOWN_instance = new NamedShape('FILLED_TRIANGLE_DOWN', 25, 25, false, true);\n }\n Object.defineProperty(NamedShape.prototype, 'code', {\n get: function () {\n return this.code_djxmtz$_0;\n }\n });\n var NamedShape$STICK_SQUARE_instance;\n function NamedShape$STICK_SQUARE_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_SQUARE_instance;\n }\n var NamedShape$STICK_CIRCLE_instance;\n function NamedShape$STICK_CIRCLE_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_CIRCLE_instance;\n }\n var NamedShape$STICK_TRIANGLE_UP_instance;\n function NamedShape$STICK_TRIANGLE_UP_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_TRIANGLE_UP_instance;\n }\n var NamedShape$STICK_PLUS_instance;\n function NamedShape$STICK_PLUS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_PLUS_instance;\n }\n var NamedShape$STICK_CROSS_instance;\n function NamedShape$STICK_CROSS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_CROSS_instance;\n }\n var NamedShape$STICK_DIAMOND_instance;\n function NamedShape$STICK_DIAMOND_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_DIAMOND_instance;\n }\n var NamedShape$STICK_TRIANGLE_DOWN_instance;\n function NamedShape$STICK_TRIANGLE_DOWN_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_TRIANGLE_DOWN_instance;\n }\n var NamedShape$STICK_SQUARE_CROSS_instance;\n function NamedShape$STICK_SQUARE_CROSS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_SQUARE_CROSS_instance;\n }\n var NamedShape$STICK_STAR_instance;\n function NamedShape$STICK_STAR_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_STAR_instance;\n }\n var NamedShape$STICK_DIAMOND_PLUS_instance;\n function NamedShape$STICK_DIAMOND_PLUS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_DIAMOND_PLUS_instance;\n }\n var NamedShape$STICK_CIRCLE_PLUS_instance;\n function NamedShape$STICK_CIRCLE_PLUS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_CIRCLE_PLUS_instance;\n }\n var NamedShape$STICK_TRIANGLE_UP_DOWN_instance;\n function NamedShape$STICK_TRIANGLE_UP_DOWN_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_TRIANGLE_UP_DOWN_instance;\n }\n var NamedShape$STICK_SQUARE_PLUS_instance;\n function NamedShape$STICK_SQUARE_PLUS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_SQUARE_PLUS_instance;\n }\n var NamedShape$STICK_CIRCLE_CROSS_instance;\n function NamedShape$STICK_CIRCLE_CROSS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_CIRCLE_CROSS_instance;\n }\n var NamedShape$STICK_SQUARE_TRIANGLE_UP_instance;\n function NamedShape$STICK_SQUARE_TRIANGLE_UP_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_SQUARE_TRIANGLE_UP_instance;\n }\n var NamedShape$SOLID_SQUARE_instance;\n function NamedShape$SOLID_SQUARE_getInstance() {\n NamedShape_initFields();\n return NamedShape$SOLID_SQUARE_instance;\n }\n var NamedShape$SOLID_CIRCLE_instance;\n function NamedShape$SOLID_CIRCLE_getInstance() {\n NamedShape_initFields();\n return NamedShape$SOLID_CIRCLE_instance;\n }\n var NamedShape$SOLID_TRIANGLE_UP_instance;\n function NamedShape$SOLID_TRIANGLE_UP_getInstance() {\n NamedShape_initFields();\n return NamedShape$SOLID_TRIANGLE_UP_instance;\n }\n var NamedShape$SOLID_DIAMOND_instance;\n function NamedShape$SOLID_DIAMOND_getInstance() {\n NamedShape_initFields();\n return NamedShape$SOLID_DIAMOND_instance;\n }\n var NamedShape$SOLID_CIRCLE_2_instance;\n function NamedShape$SOLID_CIRCLE_2_getInstance() {\n NamedShape_initFields();\n return NamedShape$SOLID_CIRCLE_2_instance;\n }\n var NamedShape$BULLET_instance;\n function NamedShape$BULLET_getInstance() {\n NamedShape_initFields();\n return NamedShape$BULLET_instance;\n }\n var NamedShape$FILLED_CIRCLE_instance;\n function NamedShape$FILLED_CIRCLE_getInstance() {\n NamedShape_initFields();\n return NamedShape$FILLED_CIRCLE_instance;\n }\n var NamedShape$FILLED_SQUARE_instance;\n function NamedShape$FILLED_SQUARE_getInstance() {\n NamedShape_initFields();\n return NamedShape$FILLED_SQUARE_instance;\n }\n var NamedShape$FILLED_DIAMOND_instance;\n function NamedShape$FILLED_DIAMOND_getInstance() {\n NamedShape_initFields();\n return NamedShape$FILLED_DIAMOND_instance;\n }\n var NamedShape$FILLED_TRIANGLE_UP_instance;\n function NamedShape$FILLED_TRIANGLE_UP_getInstance() {\n NamedShape_initFields();\n return NamedShape$FILLED_TRIANGLE_UP_instance;\n }\n var NamedShape$FILLED_TRIANGLE_DOWN_instance;\n function NamedShape$FILLED_TRIANGLE_DOWN_getInstance() {\n NamedShape_initFields();\n return NamedShape$FILLED_TRIANGLE_DOWN_instance;\n }\n Object.defineProperty(NamedShape.prototype, 'isHollow', {\n configurable: true,\n get: function () {\n return !(this.isFilled || this.isSolid);\n }\n });\n NamedShape.prototype.size_l6g9mh$ = function (dataPoint) {\n return this.isSmall_kvok7h$_0 ? AesScaling_getInstance().circleDiameterSmaller_l6g9mh$(dataPoint) : AesScaling_getInstance().circleDiameter_l6g9mh$(dataPoint);\n };\n NamedShape.prototype.strokeWidth_l6g9mh$ = function (dataPoint) {\n return this.isSolid ? 0.0 : 1.0;\n };\n NamedShape.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NamedShape',\n interfaces: [PointShape, Enum]\n };\n function NamedShape$values() {\n return [NamedShape$STICK_SQUARE_getInstance(), NamedShape$STICK_CIRCLE_getInstance(), NamedShape$STICK_TRIANGLE_UP_getInstance(), NamedShape$STICK_PLUS_getInstance(), NamedShape$STICK_CROSS_getInstance(), NamedShape$STICK_DIAMOND_getInstance(), NamedShape$STICK_TRIANGLE_DOWN_getInstance(), NamedShape$STICK_SQUARE_CROSS_getInstance(), NamedShape$STICK_STAR_getInstance(), NamedShape$STICK_DIAMOND_PLUS_getInstance(), NamedShape$STICK_CIRCLE_PLUS_getInstance(), NamedShape$STICK_TRIANGLE_UP_DOWN_getInstance(), NamedShape$STICK_SQUARE_PLUS_getInstance(), NamedShape$STICK_CIRCLE_CROSS_getInstance(), NamedShape$STICK_SQUARE_TRIANGLE_UP_getInstance(), NamedShape$SOLID_SQUARE_getInstance(), NamedShape$SOLID_CIRCLE_getInstance(), NamedShape$SOLID_TRIANGLE_UP_getInstance(), NamedShape$SOLID_DIAMOND_getInstance(), NamedShape$SOLID_CIRCLE_2_getInstance(), NamedShape$BULLET_getInstance(), NamedShape$FILLED_CIRCLE_getInstance(), NamedShape$FILLED_SQUARE_getInstance(), NamedShape$FILLED_DIAMOND_getInstance(), NamedShape$FILLED_TRIANGLE_UP_getInstance(), NamedShape$FILLED_TRIANGLE_DOWN_getInstance()];\n }\n NamedShape.values = NamedShape$values;\n function NamedShape$valueOf(name) {\n switch (name) {\n case 'STICK_SQUARE':\n return NamedShape$STICK_SQUARE_getInstance();\n case 'STICK_CIRCLE':\n return NamedShape$STICK_CIRCLE_getInstance();\n case 'STICK_TRIANGLE_UP':\n return NamedShape$STICK_TRIANGLE_UP_getInstance();\n case 'STICK_PLUS':\n return NamedShape$STICK_PLUS_getInstance();\n case 'STICK_CROSS':\n return NamedShape$STICK_CROSS_getInstance();\n case 'STICK_DIAMOND':\n return NamedShape$STICK_DIAMOND_getInstance();\n case 'STICK_TRIANGLE_DOWN':\n return NamedShape$STICK_TRIANGLE_DOWN_getInstance();\n case 'STICK_SQUARE_CROSS':\n return NamedShape$STICK_SQUARE_CROSS_getInstance();\n case 'STICK_STAR':\n return NamedShape$STICK_STAR_getInstance();\n case 'STICK_DIAMOND_PLUS':\n return NamedShape$STICK_DIAMOND_PLUS_getInstance();\n case 'STICK_CIRCLE_PLUS':\n return NamedShape$STICK_CIRCLE_PLUS_getInstance();\n case 'STICK_TRIANGLE_UP_DOWN':\n return NamedShape$STICK_TRIANGLE_UP_DOWN_getInstance();\n case 'STICK_SQUARE_PLUS':\n return NamedShape$STICK_SQUARE_PLUS_getInstance();\n case 'STICK_CIRCLE_CROSS':\n return NamedShape$STICK_CIRCLE_CROSS_getInstance();\n case 'STICK_SQUARE_TRIANGLE_UP':\n return NamedShape$STICK_SQUARE_TRIANGLE_UP_getInstance();\n case 'SOLID_SQUARE':\n return NamedShape$SOLID_SQUARE_getInstance();\n case 'SOLID_CIRCLE':\n return NamedShape$SOLID_CIRCLE_getInstance();\n case 'SOLID_TRIANGLE_UP':\n return NamedShape$SOLID_TRIANGLE_UP_getInstance();\n case 'SOLID_DIAMOND':\n return NamedShape$SOLID_DIAMOND_getInstance();\n case 'SOLID_CIRCLE_2':\n return NamedShape$SOLID_CIRCLE_2_getInstance();\n case 'BULLET':\n return NamedShape$BULLET_getInstance();\n case 'FILLED_CIRCLE':\n return NamedShape$FILLED_CIRCLE_getInstance();\n case 'FILLED_SQUARE':\n return NamedShape$FILLED_SQUARE_getInstance();\n case 'FILLED_DIAMOND':\n return NamedShape$FILLED_DIAMOND_getInstance();\n case 'FILLED_TRIANGLE_UP':\n return NamedShape$FILLED_TRIANGLE_UP_getInstance();\n case 'FILLED_TRIANGLE_DOWN':\n return NamedShape$FILLED_TRIANGLE_DOWN_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.render.point.NamedShape.' + name);\n }\n }\n NamedShape.valueOf_61zpoe$ = NamedShape$valueOf;\n function PointShape() {\n }\n PointShape.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PointShape',\n interfaces: []\n };\n function PointShapeSvg() {\n PointShapeSvg_instance = this;\n }\n PointShapeSvg.prototype.create_d8smhz$ = function (shape, location, p, fatten) {\n if (fatten === void 0)\n fatten = 1.0;\n if (equals(shape, TinyPointShape_getInstance())) {\n return this.createTinyDotShape_0(location, p);\n }if (Kotlin.isType(shape, NamedShape)) {\n return this.createNamedShape_0(shape, location, p, fatten);\n }throw IllegalArgumentException_init('Unsupported point shape code ' + shape.code + ' ' + toString(Kotlin.getKClassFromExpression(shape).simpleName));\n };\n PointShapeSvg.prototype.createTinyDotShape_0 = function (location, p) {\n var r = slim.SvgSlimElements.rect_6y0v78$(location.x - 0.5, location.y - 0.5, 1.0, 1.0);\n var color = ensureNotNull(p.color());\n var alpha = AestheticsUtil_getInstance().alpha_il6rhx$(color, p);\n r.setFill_o14uds$(color, alpha);\n r.setStrokeWidth_14dthe$(0.0);\n return r;\n };\n PointShapeSvg.prototype.createNamedShape_0 = function (shape, location, p, fatten) {\n var glyph = this.createSlimGlyph_0(shape, location, shape.size_l6g9mh$(p) * fatten);\n AestheticsUtil_getInstance().decorate_l4vgcq$(glyph, shape.isFilled, shape.isSolid, p, shape.strokeWidth_l6g9mh$(p));\n return glyph;\n };\n PointShapeSvg.prototype.createSlimGlyph_0 = function (shape, location, size) {\n switch (shape.name) {\n case 'STICK_SQUARE':\n case 'SOLID_SQUARE':\n case 'FILLED_SQUARE':\n return Glyphs_getInstance().square_e1sv3v$(location, size);\n case 'STICK_CIRCLE':\n case 'SOLID_CIRCLE':\n case 'SOLID_CIRCLE_2':\n case 'BULLET':\n case 'FILLED_CIRCLE':\n return Glyphs_getInstance().circle_e1sv3v$(location, size);\n case 'STICK_TRIANGLE_UP':\n case 'SOLID_TRIANGLE_UP':\n case 'FILLED_TRIANGLE_UP':\n return Glyphs_getInstance().triangleUp_e1sv3v$(location, size);\n case 'STICK_TRIANGLE_DOWN':\n case 'FILLED_TRIANGLE_DOWN':\n return Glyphs_getInstance().triangleDown_e1sv3v$(location, size);\n case 'STICK_DIAMOND':\n case 'SOLID_DIAMOND':\n case 'FILLED_DIAMOND':\n return Glyphs_getInstance().diamond_e1sv3v$(location, size);\n case 'STICK_PLUS':\n return Glyphs_getInstance().stickPlus_e1sv3v$(location, size);\n case 'STICK_CROSS':\n return Glyphs_getInstance().stickCross_e1sv3v$(location, size);\n case 'STICK_SQUARE_CROSS':\n return Glyphs_getInstance().stickSquareCross_e1sv3v$(location, size);\n case 'STICK_STAR':\n return Glyphs_getInstance().stickStar_e1sv3v$(location, size);\n case 'STICK_DIAMOND_PLUS':\n return Glyphs_getInstance().stickDiamondPlus_e1sv3v$(location, size);\n case 'STICK_CIRCLE_PLUS':\n return Glyphs_getInstance().stickCirclePlus_e1sv3v$(location, size);\n case 'STICK_TRIANGLE_UP_DOWN':\n return Glyphs_getInstance().stickTriangleUpDown_e1sv3v$(location, size);\n case 'STICK_SQUARE_PLUS':\n return Glyphs_getInstance().stickSquarePlus_e1sv3v$(location, size);\n case 'STICK_CIRCLE_CROSS':\n return Glyphs_getInstance().stickCircleCross_e1sv3v$(location, size);\n case 'STICK_SQUARE_TRIANGLE_UP':\n return Glyphs_getInstance().stickSquareTriangleUp_e1sv3v$(location, size);\n default:Kotlin.noWhenBranchMatched();\n break;\n }\n };\n PointShapeSvg.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PointShapeSvg',\n interfaces: []\n };\n var PointShapeSvg_instance = null;\n function PointShapeSvg_getInstance() {\n if (PointShapeSvg_instance === null) {\n new PointShapeSvg();\n }return PointShapeSvg_instance;\n }\n function TinyPointShape() {\n TinyPointShape_instance = this;\n }\n Object.defineProperty(TinyPointShape.prototype, 'code', {\n configurable: true,\n get: function () {\n return 46;\n }\n });\n TinyPointShape.prototype.size_l6g9mh$ = function (dataPoint) {\n return 1.0;\n };\n TinyPointShape.prototype.strokeWidth_l6g9mh$ = function (dataPoint) {\n return 0.0;\n };\n TinyPointShape.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'TinyPointShape',\n interfaces: [PointShape]\n };\n var TinyPointShape_instance = null;\n function TinyPointShape_getInstance() {\n if (TinyPointShape_instance === null) {\n new TinyPointShape();\n }return TinyPointShape_instance;\n }\n function UpdatableShape() {\n }\n UpdatableShape.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'UpdatableShape',\n interfaces: []\n };\n function CircleGlyph(location, width) {\n SingletonGlyph_init_0(location, width, this);\n }\n CircleGlyph.prototype.createShape_e1sv3v$ = function (location, width) {\n return slim.SvgSlimElements.circle_yvo9jy$(location.x, location.y, width / 2);\n };\n CircleGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CircleGlyph',\n interfaces: [SingletonGlyph]\n };\n function CrossGlyph(location, size, inscribedInCircle) {\n CrossGlyph$Companion_getInstance();\n if (inscribedInCircle === void 0)\n inscribedInCircle = true;\n TwoShapeGlyph.call(this);\n var cx = location.x;\n var cy = location.y;\n var w = inscribedInCircle ? size * CrossGlyph$Companion_getInstance().CIRCLE_WIDTH_ADJUST_RATIO : size;\n var half = w / 2;\n var backSlashLine = slim.SvgSlimElements.line_6y0v78$(cx - half, cy - half, cx + half, cy + half);\n var slashLine = slim.SvgSlimElements.line_6y0v78$(cx - half, cy + half, cx + half, cy - half);\n this.setShapes_0(backSlashLine, slashLine);\n }\n function CrossGlyph$Companion() {\n CrossGlyph$Companion_instance = this;\n var x = math.PI / 4;\n this.CIRCLE_WIDTH_ADJUST_RATIO = JsMath.cos(x);\n }\n CrossGlyph$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var CrossGlyph$Companion_instance = null;\n function CrossGlyph$Companion_getInstance() {\n if (CrossGlyph$Companion_instance === null) {\n new CrossGlyph$Companion();\n }return CrossGlyph$Companion_instance;\n }\n CrossGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CrossGlyph',\n interfaces: [TwoShapeGlyph]\n };\n function DiamondGlyph(location, width) {\n SingletonGlyph_init_0(location, width, this);\n }\n DiamondGlyph.prototype.createShape_e1sv3v$ = function (location, width) {\n var half = width / 2;\n var x = new Float64Array([half, width, half, 0.0]);\n var y = new Float64Array([0.0, half, width, half]);\n var ox = location.x - half;\n var oy = location.y - half;\n for (var i = 0; i <= 3; i++) {\n x[i] = ox + x[i];\n y[i] = oy + y[i];\n }\n var pathData = GlyphUtil_getInstance().buildPathData_ceb5dm$(asList(x), asList(y));\n return slim.SvgSlimElements.path_za3rmp$(pathData);\n };\n DiamondGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DiamondGlyph',\n interfaces: [SingletonGlyph]\n };\n function Glyph() {\n }\n Glyph.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Glyph',\n interfaces: [SvgSlimObject, UpdatableShape]\n };\n function GlyphPair(myG1, myG2) {\n this.myG1_0 = myG1;\n this.myG2_0 = myG2;\n }\n GlyphPair.prototype.update_mjoany$ = function (fill, fillAlpha, stroke, strokeAlpha, strokeWidth) {\n this.myG1_0.update_mjoany$(fill, fillAlpha, stroke, strokeAlpha, strokeWidth);\n this.myG2_0.update_mjoany$(fill, fillAlpha, stroke, strokeAlpha, strokeWidth);\n };\n GlyphPair.prototype.appendTo_i2myw1$ = function (g) {\n this.myG1_0.appendTo_i2myw1$(g);\n this.myG2_0.appendTo_i2myw1$(g);\n };\n GlyphPair.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GlyphPair',\n interfaces: [Glyph]\n };\n function GlyphUtil() {\n GlyphUtil_instance = this;\n }\n GlyphUtil.prototype.buildPathData_ceb5dm$ = function (xs, ys) {\n if (!(xs.size === ys.size)) {\n var message = 'Sizes of X/Y collections must be equal';\n throw IllegalArgumentException_init(message.toString());\n }if (xs.isEmpty()) {\n return SvgPathData.Companion.EMPTY;\n }var builder = (new SvgPathDataBuilder(true)).moveTo_przk3b$(collect.Iterables.get_7iig3d$(xs, 0), collect.Iterables.get_7iig3d$(ys, 0)).interpolatePoints_3g1a62$(xs, ys, SvgPathDataBuilder$Interpolation.LINEAR).closePath();\n return builder.build();\n };\n GlyphUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GlyphUtil',\n interfaces: []\n };\n var GlyphUtil_instance = null;\n function GlyphUtil_getInstance() {\n if (GlyphUtil_instance === null) {\n new GlyphUtil();\n }return GlyphUtil_instance;\n }\n function Glyphs() {\n Glyphs_instance = this;\n }\n Glyphs.prototype.square_e1sv3v$ = function (location, width) {\n return new SquareGlyph(location, width);\n };\n Glyphs.prototype.circle_e1sv3v$ = function (location, width) {\n return new CircleGlyph(location, width);\n };\n Glyphs.prototype.diamond_e1sv3v$ = function (location, width) {\n return new DiamondGlyph(location, width);\n };\n Glyphs.prototype.triangleUp_e1sv3v$ = function (location, width) {\n return new TriangleGlyph(location, width, true);\n };\n Glyphs.prototype.triangleDown_e1sv3v$ = function (location, width) {\n return new TriangleGlyph(location, width, false);\n };\n Glyphs.prototype.stickPlus_e1sv3v$ = function (location, width) {\n return new PlusGlyph(location, width);\n };\n Glyphs.prototype.stickCross_e1sv3v$ = function (location, width) {\n return new CrossGlyph(location, width);\n };\n Glyphs.prototype.stickSquareCross_e1sv3v$ = function (location, size) {\n return new GlyphPair(new SquareGlyph(location, size), new CrossGlyph(location, size, false));\n };\n Glyphs.prototype.stickStar_e1sv3v$ = function (location, size) {\n return new GlyphPair(new PlusGlyph(location, size), new CrossGlyph(location, size));\n };\n Glyphs.prototype.stickDiamondPlus_e1sv3v$ = function (location, size) {\n return new GlyphPair(new DiamondGlyph(location, size), new PlusGlyph(location, size));\n };\n Glyphs.prototype.stickCirclePlus_e1sv3v$ = function (location, size) {\n return new GlyphPair(new CircleGlyph(location, size), new PlusGlyph(location, size));\n };\n Glyphs.prototype.stickTriangleUpDown_e1sv3v$ = function (location, size) {\n return new GlyphPair(new TriangleGlyph(location, size, true), new TriangleGlyph(location, size, false));\n };\n Glyphs.prototype.stickSquarePlus_e1sv3v$ = function (location, size) {\n return new GlyphPair(new SquareGlyph(location, size), new PlusGlyph(location, size));\n };\n Glyphs.prototype.stickCircleCross_e1sv3v$ = function (location, size) {\n return new GlyphPair(new CircleGlyph(location, size), new CrossGlyph(location, size));\n };\n Glyphs.prototype.stickSquareTriangleUp_e1sv3v$ = function (location, size) {\n return new GlyphPair(new SquareGlyph(location, size), new TriangleGlyph(location, size, true, true));\n };\n Glyphs.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Glyphs',\n interfaces: []\n };\n var Glyphs_instance = null;\n function Glyphs_getInstance() {\n if (Glyphs_instance === null) {\n new Glyphs();\n }return Glyphs_instance;\n }\n function MultiShapeGlyph() {\n }\n MultiShapeGlyph.prototype.update_0 = function (shape, fill, fillAlpha, stroke, strokeAlpha, strokeWidth) {\n shape != null ? (shape.setFill_o14uds$(fill, fillAlpha), Unit) : null;\n shape != null ? (shape.setStroke_o14uds$(stroke, strokeAlpha), Unit) : null;\n shape != null ? (shape.setStrokeWidth_14dthe$(strokeWidth), Unit) : null;\n };\n MultiShapeGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiShapeGlyph',\n interfaces: [Glyph]\n };\n function PlusGlyph(location, size) {\n TwoShapeGlyph.call(this);\n var half = size / 2;\n var ox = location.x - half;\n var oy = location.y - half;\n var hLine = slim.SvgSlimElements.line_6y0v78$(0 + ox, half + oy, size + ox, half + oy);\n var vLine = slim.SvgSlimElements.line_6y0v78$(half + ox, 0 + oy, half + ox, size + oy);\n this.setShapes_0(hLine, vLine);\n }\n PlusGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlusGlyph',\n interfaces: [TwoShapeGlyph]\n };\n function SingletonGlyph() {\n this.myShape_tmqwxg$_0 = null;\n }\n SingletonGlyph.prototype.update_mjoany$ = function (fill, fillAlpha, stroke, strokeAlpha, strokeWidth) {\n this.myShape_tmqwxg$_0.setFill_o14uds$(fill, fillAlpha);\n this.myShape_tmqwxg$_0.setStroke_o14uds$(stroke, strokeAlpha);\n this.myShape_tmqwxg$_0.setStrokeWidth_14dthe$(strokeWidth);\n };\n SingletonGlyph.prototype.appendTo_i2myw1$ = function (g) {\n this.myShape_tmqwxg$_0.appendTo_i2myw1$(g);\n };\n SingletonGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SingletonGlyph',\n interfaces: [Glyph]\n };\n function SingletonGlyph_init(shape, $this) {\n $this = $this || Object.create(SingletonGlyph.prototype);\n SingletonGlyph.call($this);\n $this.myShape_tmqwxg$_0 = shape;\n return $this;\n }\n function SingletonGlyph_init_0(location, width, $this) {\n $this = $this || Object.create(SingletonGlyph.prototype);\n SingletonGlyph.call($this);\n $this.myShape_tmqwxg$_0 = $this.createShape_e1sv3v$(location, width);\n return $this;\n }\n function SquareGlyph(location, size) {\n SingletonGlyph_init_0(location, size, this);\n }\n SquareGlyph.prototype.createShape_e1sv3v$ = function (location, width) {\n return slim.SvgSlimElements.rect_6y0v78$(location.x - width / 2, location.y - width / 2, width, width);\n };\n SquareGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SquareGlyph',\n interfaces: [SingletonGlyph]\n };\n function TriangleGlyph(location, size, pointingUp, inscribedInSquare) {\n TriangleGlyph$Companion_getInstance();\n if (inscribedInSquare === void 0)\n inscribedInSquare = false;\n SingletonGlyph_init(TriangleGlyph$Companion_getInstance().createTriangleShape_0(location, size, pointingUp, inscribedInSquare), this);\n }\n TriangleGlyph.prototype.createShape_e1sv3v$ = function (location, width) {\n throw IllegalStateException_init('Not applicable');\n };\n function TriangleGlyph$Companion() {\n TriangleGlyph$Companion_instance = this;\n var x = math.PI / 3;\n this.SIDE_TO_HEIGHT_RATIO_0 = JsMath.sin(x);\n this.VERTICAL_OFFSET_RATIO_0 = 1.0 / 12;\n }\n TriangleGlyph$Companion.prototype.createTriangleShape_0 = function (location, size, pointingUp, inscribedInSquare) {\n var half = size / 2;\n var height = inscribedInSquare ? size : this.SIDE_TO_HEIGHT_RATIO_0 * size;\n var vOffset = inscribedInSquare ? 0.0 : height * this.VERTICAL_OFFSET_RATIO_0;\n var x;\n var y;\n var dy = (size - height) / 2;\n if (pointingUp) {\n dy -= vOffset;\n x = new Float64Array([half, size, 0.0]);\n y = new Float64Array([0.0 + dy, height + dy, height + dy]);\n } else {\n dy += vOffset;\n x = new Float64Array([0.0, size, half]);\n y = new Float64Array([0.0 + dy, 0.0 + dy, height + dy]);\n }\n var ox = location.x - half;\n var oy = location.y - half;\n for (var i = 0; i <= 2; i++) {\n x[i] = ox + x[i];\n y[i] = oy + y[i];\n }\n var pathData = GlyphUtil_getInstance().buildPathData_ceb5dm$(asList(x), asList(y));\n return slim.SvgSlimElements.path_za3rmp$(pathData);\n };\n TriangleGlyph$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TriangleGlyph$Companion_instance = null;\n function TriangleGlyph$Companion_getInstance() {\n if (TriangleGlyph$Companion_instance === null) {\n new TriangleGlyph$Companion();\n }return TriangleGlyph$Companion_instance;\n }\n TriangleGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TriangleGlyph',\n interfaces: [SingletonGlyph]\n };\n function TwoShapeGlyph() {\n MultiShapeGlyph.call(this);\n this.myS1_0 = null;\n this.myS2_0 = null;\n }\n TwoShapeGlyph.prototype.setShapes_0 = function (s1, s2) {\n this.myS1_0 = s1;\n this.myS2_0 = s2;\n };\n TwoShapeGlyph.prototype.update_mjoany$ = function (fill, fillAlpha, stroke, strokeAlpha, strokeWidth) {\n this.update_0(this.myS1_0, fill, fillAlpha, stroke, strokeAlpha, strokeWidth);\n this.update_0(this.myS2_0, fill, fillAlpha, stroke, strokeAlpha, strokeWidth);\n };\n TwoShapeGlyph.prototype.appendTo_i2myw1$ = function (g) {\n ensureNotNull(this.myS1_0).appendTo_i2myw1$(g);\n ensureNotNull(this.myS2_0).appendTo_i2myw1$(g);\n };\n TwoShapeGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TwoShapeGlyph',\n interfaces: [MultiShapeGlyph]\n };\n function GroupComponent() {\n SvgComponent.call(this);\n }\n GroupComponent.prototype.buildComponent = function () {\n };\n GroupComponent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupComponent',\n interfaces: [SvgComponent]\n };\n function LinePath(builder) {\n LinePath$Companion_getInstance();\n SvgComponent.call(this);\n this.myPath_0 = null;\n this.myDashArray_0 = null;\n this.myPath_0 = SvgPathElement_init(builder.build());\n this.myPath_0.fill().set_11rb$(SvgColors.NONE);\n var lineWidth = 1.0;\n this.myPath_0.strokeWidth().set_11rb$(lineWidth);\n this.add_26jijc$(this.myPath_0);\n }\n LinePath.prototype.buildComponent = function () {\n };\n LinePath.prototype.color = function () {\n return this.myPath_0.strokeColor();\n };\n LinePath.prototype.fill = function () {\n return this.myPath_0.fillColor();\n };\n function LinePath$width$ObjectLiteral(this$LinePath) {\n this.this$LinePath = this$LinePath;\n }\n LinePath$width$ObjectLiteral.prototype.set_11rb$ = function (value) {\n this.this$LinePath.myPath_0.strokeWidth().set_11rb$(value);\n this.this$LinePath.updatePathDashArray_0();\n };\n LinePath$width$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [WritableProperty]\n };\n LinePath.prototype.width = function () {\n return new LinePath$width$ObjectLiteral(this);\n };\n function LinePath$dashArray$ObjectLiteral(this$LinePath) {\n this.this$LinePath = this$LinePath;\n }\n LinePath$dashArray$ObjectLiteral.prototype.set_11rb$ = function (value) {\n this.this$LinePath.myDashArray_0 = ArrayList_init_0(value);\n this.this$LinePath.updatePathDashArray_0();\n };\n LinePath$dashArray$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [WritableProperty]\n };\n LinePath.prototype.dashArray = function () {\n return new LinePath$dashArray$ObjectLiteral(this);\n };\n LinePath.prototype.updatePathDashArray_0 = function () {\n if (!(this.myDashArray_0 == null || ensureNotNull(this.myDashArray_0).isEmpty())) {\n var w = this.myPath_0.strokeWidth().get();\n var width = w != null ? w : 1.0;\n StrokeDashArraySupport_getInstance().apply_3xqz7j$(this.myPath_0, width, ensureNotNull(this.myDashArray_0));\n }};\n function LinePath$Companion() {\n LinePath$Companion_instance = this;\n this.END_OF_SUBPATH = null;\n }\n LinePath$Companion.prototype.line_qdtdbw$ = function (points) {\n return new LinePath(this.pathBuilder_0(points, false));\n };\n LinePath$Companion.prototype.polygon_yh26e7$ = function (points) {\n return new LinePath(this.pathBuilder_0(points, true));\n };\n LinePath$Companion.prototype.pathBuilder_0 = function (points, isPolygon) {\n var tmp$;\n var builder = new SvgPathDataBuilder(true);\n var curSegment = ArrayList_init();\n var interpolate = false;\n tmp$ = points.iterator();\n while (tmp$.hasNext()) {\n var point = tmp$.next();\n if (point === this.END_OF_SUBPATH) {\n this.buildSegment_0(builder, curSegment, interpolate);\n if (isPolygon) {\n builder.closePath();\n }curSegment = ArrayList_init();\n } else {\n curSegment.add_11rb$(ensureNotNull(point));\n }\n }\n this.buildSegment_0(builder, curSegment, interpolate);\n if (isPolygon) {\n builder.closePath();\n }return builder;\n };\n LinePath$Companion.prototype.buildSegment_0 = function (builder, curSegment, interpolate) {\n if (curSegment.isEmpty()) {\n return;\n }builder.moveTo_gpjtzr$(curSegment.get_za3lpa$(0));\n builder.interpolatePoints_1ravjc$(curSegment, interpolate ? SvgPathDataBuilder$Interpolation.CARDINAL : SvgPathDataBuilder$Interpolation.LINEAR);\n };\n LinePath$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LinePath$Companion_instance = null;\n function LinePath$Companion_getInstance() {\n if (LinePath$Companion_instance === null) {\n new LinePath$Companion();\n }return LinePath$Companion_instance;\n }\n LinePath.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinePath',\n interfaces: [SvgComponent]\n };\n function StrokeDashArraySupport() {\n StrokeDashArraySupport_instance = this;\n }\n StrokeDashArraySupport.prototype.apply_3xqz7j$ = function (element, strokeWidth, dashArray) {\n var tmp$;\n var sb = StringBuilder_init();\n tmp$ = dashArray.iterator();\n while (tmp$.hasNext()) {\n var relativeLength = tmp$.next();\n var length = relativeLength * strokeWidth;\n if (sb.length > 0) {\n sb.append_s8itvh$(44);\n }sb.append_pdl1vj$(length.toString());\n }\n element.getAttribute_61zpoe$(svg.SvgConstants.SVG_STROKE_DASHARRAY_ATTRIBUTE).set_11rb$(sb.toString());\n };\n StrokeDashArraySupport.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'StrokeDashArraySupport',\n interfaces: []\n };\n var StrokeDashArraySupport_instance = null;\n function StrokeDashArraySupport_getInstance() {\n if (StrokeDashArraySupport_instance === null) {\n new StrokeDashArraySupport();\n }return StrokeDashArraySupport_instance;\n }\n function SvgComponent() {\n SvgComponent$Companion_getInstance();\n this.myIsBuilt_hfl4wb$_0 = false;\n this.myIsBuilding_wftuqx$_0 = false;\n this.myRootGroup_34n42m$_0 = new SvgGElement();\n this.myChildComponents_jx3u37$_0 = ArrayList_init();\n this.myOrigin_c2o9zl$_0 = DoubleVector.Companion.ZERO;\n this.myRotationAngle_woxwye$_0 = 0.0;\n this.myCompositeRegistration_t8l21t$_0 = new CompositeRegistration([]);\n }\n Object.defineProperty(SvgComponent.prototype, 'childComponents', {\n configurable: true,\n get: function () {\n if (!this.myIsBuilt_hfl4wb$_0) {\n var message = 'Plot has not yet built';\n throw IllegalArgumentException_init(message.toString());\n }return ArrayList_init_0(this.myChildComponents_jx3u37$_0);\n }\n });\n Object.defineProperty(SvgComponent.prototype, 'rootGroup', {\n configurable: true,\n get: function () {\n this.ensureBuilt();\n return this.myRootGroup_34n42m$_0;\n }\n });\n SvgComponent.prototype.ensureBuilt = function () {\n if (!(this.myIsBuilt_hfl4wb$_0 || this.myIsBuilding_wftuqx$_0)) {\n this.buildComponentIntern_92lbvk$_0();\n }};\n SvgComponent.prototype.buildComponentIntern_92lbvk$_0 = function () {\n try {\n this.myIsBuilding_wftuqx$_0 = true;\n this.buildComponent();\n }finally {\n this.myIsBuilding_wftuqx$_0 = false;\n this.myIsBuilt_hfl4wb$_0 = true;\n }\n };\n function SvgComponent$rebuildHandler$ObjectLiteral(this$SvgComponent) {\n this.this$SvgComponent = this$SvgComponent;\n }\n SvgComponent$rebuildHandler$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n this.this$SvgComponent.needRebuild();\n };\n SvgComponent$rebuildHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n SvgComponent.prototype.rebuildHandler_287e2$ = function () {\n return new SvgComponent$rebuildHandler$ObjectLiteral(this);\n };\n SvgComponent.prototype.needRebuild = function () {\n if (this.myIsBuilt_hfl4wb$_0) {\n this.clear();\n this.buildComponentIntern_92lbvk$_0();\n }};\n SvgComponent.prototype.reg_3xv6fb$ = function (r) {\n this.myCompositeRegistration_t8l21t$_0.add_3xv6fb$(r);\n };\n SvgComponent.prototype.clear = function () {\n var tmp$;\n this.myIsBuilt_hfl4wb$_0 = false;\n tmp$ = this.myChildComponents_jx3u37$_0.iterator();\n while (tmp$.hasNext()) {\n var child = tmp$.next();\n child.clear();\n }\n this.myChildComponents_jx3u37$_0.clear();\n this.myRootGroup_34n42m$_0.children().clear();\n this.myCompositeRegistration_t8l21t$_0.remove();\n this.myCompositeRegistration_t8l21t$_0 = new CompositeRegistration([]);\n };\n SvgComponent.prototype.add_8icvvv$ = function (child) {\n this.myChildComponents_jx3u37$_0.add_11rb$(child);\n this.add_26jijc$(child.rootGroup);\n };\n SvgComponent.prototype.add_26jijc$ = function (node) {\n this.myRootGroup_34n42m$_0.children().add_11rb$(node);\n };\n SvgComponent.prototype.moveTo_gpjtzr$ = function (p) {\n this.myOrigin_c2o9zl$_0 = p;\n this.myRootGroup_34n42m$_0.transform().set_11rb$(SvgComponent$Companion_getInstance().buildTransform_e1sv3v$(this.myOrigin_c2o9zl$_0, this.myRotationAngle_woxwye$_0));\n };\n SvgComponent.prototype.moveTo_lu1900$ = function (x, y) {\n this.moveTo_gpjtzr$(new DoubleVector(x, y));\n };\n SvgComponent.prototype.rotate_14dthe$ = function (angle) {\n this.myRotationAngle_woxwye$_0 = angle;\n this.myRootGroup_34n42m$_0.transform().set_11rb$(SvgComponent$Companion_getInstance().buildTransform_e1sv3v$(this.myOrigin_c2o9zl$_0, this.myRotationAngle_woxwye$_0));\n };\n SvgComponent.prototype.toRelativeCoordinates_gpjtzr$ = function (location) {\n return this.rootGroup.pointToTransformedCoordinates_gpjtzr$(location);\n };\n SvgComponent.prototype.toAbsoluteCoordinates_gpjtzr$ = function (location) {\n return this.rootGroup.pointToAbsoluteCoordinates_gpjtzr$(location);\n };\n SvgComponent.prototype.clipBounds_wthzt5$ = function (rect) {\n var $receiver = new SvgClipPathElement();\n $receiver.id().set_11rb$(SvgUID_getInstance().get_61zpoe$(SvgComponent$Companion_getInstance().CLIP_PATH_ID_PREFIX));\n var tmp$ = $receiver.children();\n var $receiver_0 = new SvgRectElement();\n $receiver_0.x().set_11rb$(rect.left);\n $receiver_0.y().set_11rb$(rect.top);\n $receiver_0.width().set_11rb$(rect.width);\n $receiver_0.height().set_11rb$(rect.height);\n tmp$.add_11rb$($receiver_0);\n var clipPathElement = $receiver;\n var $receiver_1 = new SvgDefsElement();\n $receiver_1.children().add_11rb$(clipPathElement);\n var defs = $receiver_1;\n this.add_26jijc$(defs);\n this.rootGroup.clipPath().set_11rb$(new SvgIRI(ensureNotNull(clipPathElement.id().get())));\n this.rootGroup.setAttribute_qdh7ux$(SvgGraphicsElement.Companion.CLIP_BOUNDS_JFX, rect);\n };\n SvgComponent.prototype.addClassName_61zpoe$ = function (className) {\n this.myRootGroup_34n42m$_0.addClass_61zpoe$(className);\n };\n function SvgComponent$Companion() {\n SvgComponent$Companion_instance = this;\n this.CLIP_PATH_ID_PREFIX = '';\n }\n SvgComponent$Companion.prototype.buildTransform_e1sv3v$ = function (origin, rotationAngle) {\n var transformBuilder = new SvgTransformBuilder();\n if (!(origin != null ? origin.equals(DoubleVector.Companion.ZERO) : null)) {\n transformBuilder.translate_lu1900$(origin.x, origin.y);\n }if (rotationAngle !== 0.0) {\n transformBuilder.rotate_14dthe$(rotationAngle);\n }return transformBuilder.build();\n };\n SvgComponent$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SvgComponent$Companion_instance = null;\n function SvgComponent$Companion_getInstance() {\n if (SvgComponent$Companion_instance === null) {\n new SvgComponent$Companion();\n }return SvgComponent$Companion_instance;\n }\n SvgComponent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SvgComponent',\n interfaces: []\n };\n function SvgUID() {\n SvgUID_instance = this;\n this.suffixGen_0 = SvgUID$suffixGen$lambda;\n }\n function SvgUID$setUpForTest$lambda(closure$incrementalId) {\n return function () {\n return closure$incrementalId.next();\n };\n }\n SvgUID.prototype.setUpForTest = function () {\n var incrementalId = new SvgUID$IncrementalId();\n this.suffixGen_0 = SvgUID$setUpForTest$lambda(incrementalId);\n };\n SvgUID.prototype.get_61zpoe$ = function (prefix) {\n return prefix + this.suffixGen_0().toString();\n };\n function SvgUID$IncrementalId() {\n this.nextIndex_0 = 0;\n }\n SvgUID$IncrementalId.prototype.next = function () {\n var tmp$;\n return 'clip-' + (tmp$ = this.nextIndex_0, this.nextIndex_0 = tmp$ + 1 | 0, tmp$);\n };\n SvgUID$IncrementalId.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'IncrementalId',\n interfaces: []\n };\n function SvgUID$suffixGen$lambda() {\n return random.RandomString.randomString_za3lpa$(6);\n }\n SvgUID.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'SvgUID',\n interfaces: []\n };\n var SvgUID_instance = null;\n function SvgUID_getInstance() {\n if (SvgUID_instance === null) {\n new SvgUID();\n }return SvgUID_instance;\n }\n function TextLabel(text) {\n SvgComponent.call(this);\n this.myText_0 = SvgTextElement_init(text);\n this.myTextColor_0 = null;\n this.myFontSize_0 = 0.0;\n this.myFontWeight_0 = null;\n this.myFontFamily_0 = null;\n this.myFontStyle_0 = null;\n this.rootGroup.children().add_11rb$(this.myText_0);\n }\n TextLabel.prototype.buildComponent = function () {\n };\n function TextLabel$textColor$ObjectLiteral(this$TextLabel) {\n this.this$TextLabel = this$TextLabel;\n }\n TextLabel$textColor$ObjectLiteral.prototype.set_11rb$ = function (value) {\n this.this$TextLabel.myText_0.fillColor();\n this.this$TextLabel.myTextColor_0 = value;\n this.this$TextLabel.updateStyleAttribute_0();\n };\n TextLabel$textColor$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [WritableProperty]\n };\n TextLabel.prototype.textColor = function () {\n return new TextLabel$textColor$ObjectLiteral(this);\n };\n TextLabel.prototype.textOpacity = function () {\n return this.myText_0.fillOpacity();\n };\n TextLabel.prototype.x = function () {\n return this.myText_0.x();\n };\n TextLabel.prototype.y = function () {\n return this.myText_0.y();\n };\n TextLabel.prototype.setHorizontalAnchor_ja80zo$ = function (anchor) {\n this.myText_0.setAttribute_jyasbz$(svg.SvgConstants.SVG_TEXT_ANCHOR_ATTRIBUTE, this.toTextAnchor_0(anchor));\n };\n TextLabel.prototype.setVerticalAnchor_yaudma$ = function (anchor) {\n this.myText_0.setAttribute_jyasbz$(svg.SvgConstants.SVG_TEXT_DY_ATTRIBUTE, this.toDY_0(anchor));\n };\n TextLabel.prototype.setFontSize_14dthe$ = function (px) {\n this.myFontSize_0 = px;\n this.updateStyleAttribute_0();\n };\n TextLabel.prototype.setFontWeight_pdl1vj$ = function (cssName) {\n this.myFontWeight_0 = cssName;\n this.updateStyleAttribute_0();\n };\n TextLabel.prototype.setFontStyle_pdl1vj$ = function (cssName) {\n this.myFontStyle_0 = cssName;\n this.updateStyleAttribute_0();\n };\n TextLabel.prototype.setFontFamily_pdl1vj$ = function (fontFamily) {\n this.myFontFamily_0 = fontFamily;\n this.updateStyleAttribute_0();\n };\n TextLabel.prototype.updateStyleAttribute_0 = function () {\n var sb = StringBuilder_init();\n if (this.myTextColor_0 != null) {\n sb.append_pdl1vj$('fill:').append_pdl1vj$(ensureNotNull(this.myTextColor_0).toHexColor()).append_s8itvh$(59);\n }if (this.myFontSize_0 > 0 && this.myFontFamily_0 != null) {\n var fnt = StringBuilder_init();\n var $receiver = this.myFontStyle_0;\n if (!($receiver == null || $receiver.length === 0)) {\n fnt.append_pdl1vj$(ensureNotNull(this.myFontStyle_0)).append_s8itvh$(32);\n }var $receiver_0 = this.myFontWeight_0;\n if (!($receiver_0 == null || $receiver_0.length === 0)) {\n fnt.append_pdl1vj$(ensureNotNull(this.myFontWeight_0)).append_s8itvh$(32);\n }fnt.append_s8jyv4$(this.myFontSize_0).append_pdl1vj$('px ');\n fnt.append_pdl1vj$(ensureNotNull(this.myFontFamily_0)).append_pdl1vj$(';');\n sb.append_pdl1vj$('font:').append_gw00v9$(fnt);\n } else {\n var $receiver_1 = this.myFontStyle_0;\n if (!($receiver_1 == null || isBlank($receiver_1))) {\n sb.append_pdl1vj$('font-style:').append_pdl1vj$(ensureNotNull(this.myFontStyle_0)).append_s8itvh$(59);\n }var $receiver_2 = this.myFontWeight_0;\n if (!($receiver_2 == null || $receiver_2.length === 0)) {\n sb.append_pdl1vj$('font-weight:').append_pdl1vj$(ensureNotNull(this.myFontWeight_0)).append_s8itvh$(59);\n }if (this.myFontSize_0 > 0) {\n sb.append_pdl1vj$('font-size:').append_s8jyv4$(this.myFontSize_0).append_pdl1vj$('px;');\n }var $receiver_3 = this.myFontFamily_0;\n if (!($receiver_3 == null || $receiver_3.length === 0)) {\n sb.append_pdl1vj$('font-family:').append_pdl1vj$(ensureNotNull(this.myFontFamily_0)).append_s8itvh$(59);\n }}\n this.myText_0.setAttribute_jyasbz$(svg.SvgConstants.SVG_STYLE_ATTRIBUTE, sb.toString());\n };\n TextLabel.prototype.toTextAnchor_0 = function (anchor) {\n var tmp$;\n switch (anchor.name) {\n case 'LEFT':\n tmp$ = null;\n break;\n case 'MIDDLE':\n tmp$ = svg.SvgConstants.SVG_TEXT_ANCHOR_MIDDLE;\n break;\n case 'RIGHT':\n tmp$ = svg.SvgConstants.SVG_TEXT_ANCHOR_END;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n TextLabel.prototype.toDominantBaseline_0 = function (anchor) {\n var tmp$;\n switch (anchor.name) {\n case 'TOP':\n tmp$ = 'hanging';\n break;\n case 'CENTER':\n tmp$ = 'central';\n break;\n case 'BOTTOM':\n tmp$ = null;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n TextLabel.prototype.toDY_0 = function (anchor) {\n var tmp$;\n switch (anchor.name) {\n case 'TOP':\n tmp$ = svg.SvgConstants.SVG_TEXT_DY_TOP;\n break;\n case 'CENTER':\n tmp$ = svg.SvgConstants.SVG_TEXT_DY_CENTER;\n break;\n case 'BOTTOM':\n tmp$ = null;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n function TextLabel$HorizontalAnchor(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TextLabel$HorizontalAnchor_initFields() {\n TextLabel$HorizontalAnchor_initFields = function () {\n };\n TextLabel$HorizontalAnchor$LEFT_instance = new TextLabel$HorizontalAnchor('LEFT', 0);\n TextLabel$HorizontalAnchor$RIGHT_instance = new TextLabel$HorizontalAnchor('RIGHT', 1);\n TextLabel$HorizontalAnchor$MIDDLE_instance = new TextLabel$HorizontalAnchor('MIDDLE', 2);\n }\n var TextLabel$HorizontalAnchor$LEFT_instance;\n function TextLabel$HorizontalAnchor$LEFT_getInstance() {\n TextLabel$HorizontalAnchor_initFields();\n return TextLabel$HorizontalAnchor$LEFT_instance;\n }\n var TextLabel$HorizontalAnchor$RIGHT_instance;\n function TextLabel$HorizontalAnchor$RIGHT_getInstance() {\n TextLabel$HorizontalAnchor_initFields();\n return TextLabel$HorizontalAnchor$RIGHT_instance;\n }\n var TextLabel$HorizontalAnchor$MIDDLE_instance;\n function TextLabel$HorizontalAnchor$MIDDLE_getInstance() {\n TextLabel$HorizontalAnchor_initFields();\n return TextLabel$HorizontalAnchor$MIDDLE_instance;\n }\n TextLabel$HorizontalAnchor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalAnchor',\n interfaces: [Enum]\n };\n function TextLabel$HorizontalAnchor$values() {\n return [TextLabel$HorizontalAnchor$LEFT_getInstance(), TextLabel$HorizontalAnchor$RIGHT_getInstance(), TextLabel$HorizontalAnchor$MIDDLE_getInstance()];\n }\n TextLabel$HorizontalAnchor.values = TextLabel$HorizontalAnchor$values;\n function TextLabel$HorizontalAnchor$valueOf(name) {\n switch (name) {\n case 'LEFT':\n return TextLabel$HorizontalAnchor$LEFT_getInstance();\n case 'RIGHT':\n return TextLabel$HorizontalAnchor$RIGHT_getInstance();\n case 'MIDDLE':\n return TextLabel$HorizontalAnchor$MIDDLE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.render.svg.TextLabel.HorizontalAnchor.' + name);\n }\n }\n TextLabel$HorizontalAnchor.valueOf_61zpoe$ = TextLabel$HorizontalAnchor$valueOf;\n function TextLabel$VerticalAnchor(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TextLabel$VerticalAnchor_initFields() {\n TextLabel$VerticalAnchor_initFields = function () {\n };\n TextLabel$VerticalAnchor$TOP_instance = new TextLabel$VerticalAnchor('TOP', 0);\n TextLabel$VerticalAnchor$BOTTOM_instance = new TextLabel$VerticalAnchor('BOTTOM', 1);\n TextLabel$VerticalAnchor$CENTER_instance = new TextLabel$VerticalAnchor('CENTER', 2);\n }\n var TextLabel$VerticalAnchor$TOP_instance;\n function TextLabel$VerticalAnchor$TOP_getInstance() {\n TextLabel$VerticalAnchor_initFields();\n return TextLabel$VerticalAnchor$TOP_instance;\n }\n var TextLabel$VerticalAnchor$BOTTOM_instance;\n function TextLabel$VerticalAnchor$BOTTOM_getInstance() {\n TextLabel$VerticalAnchor_initFields();\n return TextLabel$VerticalAnchor$BOTTOM_instance;\n }\n var TextLabel$VerticalAnchor$CENTER_instance;\n function TextLabel$VerticalAnchor$CENTER_getInstance() {\n TextLabel$VerticalAnchor_initFields();\n return TextLabel$VerticalAnchor$CENTER_instance;\n }\n TextLabel$VerticalAnchor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalAnchor',\n interfaces: [Enum]\n };\n function TextLabel$VerticalAnchor$values() {\n return [TextLabel$VerticalAnchor$TOP_getInstance(), TextLabel$VerticalAnchor$BOTTOM_getInstance(), TextLabel$VerticalAnchor$CENTER_getInstance()];\n }\n TextLabel$VerticalAnchor.values = TextLabel$VerticalAnchor$values;\n function TextLabel$VerticalAnchor$valueOf(name) {\n switch (name) {\n case 'TOP':\n return TextLabel$VerticalAnchor$TOP_getInstance();\n case 'BOTTOM':\n return TextLabel$VerticalAnchor$BOTTOM_getInstance();\n case 'CENTER':\n return TextLabel$VerticalAnchor$CENTER_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.render.svg.TextLabel.VerticalAnchor.' + name);\n }\n }\n TextLabel$VerticalAnchor.valueOf_61zpoe$ = TextLabel$VerticalAnchor$valueOf;\n TextLabel.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TextLabel',\n interfaces: [SvgComponent]\n };\n function AbstractScale() {\n this.definedBreaks_0 = null;\n this.definedLabels_0 = null;\n this.name_iafnnl$_0 = null;\n this.mapper_ohg8eh$_0 = null;\n this.multiplicativeExpand_lxi716$_0 = 0.0;\n this.additiveExpand_59ok4k$_0 = 0.0;\n this.labelFormatter_tb2f2k$_0 = null;\n }\n Object.defineProperty(AbstractScale.prototype, 'name', {\n configurable: true,\n get: function () {\n return this.name_iafnnl$_0;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'mapper', {\n configurable: true,\n get: function () {\n return this.mapper_ohg8eh$_0;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'multiplicativeExpand', {\n configurable: true,\n get: function () {\n return this.multiplicativeExpand_lxi716$_0;\n },\n set: function (multiplicativeExpand) {\n this.multiplicativeExpand_lxi716$_0 = multiplicativeExpand;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'additiveExpand', {\n configurable: true,\n get: function () {\n return this.additiveExpand_59ok4k$_0;\n },\n set: function (additiveExpand) {\n this.additiveExpand_59ok4k$_0 = additiveExpand;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'labelFormatter', {\n configurable: true,\n get: function () {\n return this.labelFormatter_tb2f2k$_0;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'isContinuous', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'isContinuousDomain', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'breaks', {\n configurable: true,\n get: function () {\n var tmp$;\n if (!this.hasBreaks()) {\n var message = 'No breaks defined for scale ' + this.name;\n throw IllegalStateException_init(message.toString());\n }return Kotlin.isType(tmp$ = this.definedBreaks_0, List) ? tmp$ : throwCCE();\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'labels', {\n configurable: true,\n get: function () {\n if (!this.labelsDefined_0()) {\n var message = 'No labels defined for scale ' + this.name;\n throw IllegalStateException_init(message.toString());\n }return ensureNotNull(this.definedLabels_0);\n }\n });\n AbstractScale.prototype.hasBreaks = function () {\n return this.definedBreaks_0 != null;\n };\n AbstractScale.prototype.hasLabels = function () {\n return this.labelsDefined_0();\n };\n AbstractScale.prototype.labelsDefined_0 = function () {\n return this.definedLabels_0 != null;\n };\n function AbstractScale$AbstractBuilder(scale) {\n this.myName_8be2vx$ = scale.name;\n this.myBreaks_8be2vx$ = scale.definedBreaks_0;\n this.myLabels_8be2vx$ = scale.definedLabels_0;\n this.myLabelFormatter_8be2vx$ = scale.labelFormatter;\n this.myMapper_8be2vx$ = scale.mapper;\n this.myMultiplicativeExpand_8be2vx$ = scale.multiplicativeExpand;\n this.myAdditiveExpand_8be2vx$ = scale.additiveExpand;\n }\n AbstractScale$AbstractBuilder.prototype.breaks_pqjuzw$ = function (l) {\n var destination = ArrayList_init_1(collectionSizeOrDefault(l, 10));\n var tmp$;\n tmp$ = l.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_0;\n destination.add_11rb$((tmp$_0 = item) == null || Kotlin.isType(tmp$_0, Any) ? tmp$_0 : throwCCE());\n }\n this.myBreaks_8be2vx$ = destination;\n return this;\n };\n AbstractScale$AbstractBuilder.prototype.labels_mhpeer$ = function (l) {\n this.myLabels_8be2vx$ = l;\n return this;\n };\n AbstractScale$AbstractBuilder.prototype.labelFormatter_h0j1qz$ = function (v) {\n this.myLabelFormatter_8be2vx$ = v;\n return this;\n };\n AbstractScale$AbstractBuilder.prototype.mapper_1uitho$ = function (m) {\n this.myMapper_8be2vx$ = m;\n return this;\n };\n AbstractScale$AbstractBuilder.prototype.multiplicativeExpand_14dthe$ = function (v) {\n this.myMultiplicativeExpand_8be2vx$ = v;\n return this;\n };\n AbstractScale$AbstractBuilder.prototype.additiveExpand_14dthe$ = function (v) {\n this.myAdditiveExpand_8be2vx$ = v;\n return this;\n };\n AbstractScale$AbstractBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractBuilder',\n interfaces: [Scale$Builder]\n };\n AbstractScale.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractScale',\n interfaces: [Scale]\n };\n function AbstractScale_init(name, mapper, breaks, $this) {\n if (breaks === void 0)\n breaks = null;\n $this = $this || Object.create(AbstractScale.prototype);\n AbstractScale.call($this);\n $this.name_iafnnl$_0 = name;\n $this.mapper_ohg8eh$_0 = mapper;\n $this.definedBreaks_0 = breaks;\n $this.definedLabels_0 = null;\n $this.labelFormatter_tb2f2k$_0 = null;\n return $this;\n }\n function AbstractScale_init_0(b, $this) {\n $this = $this || Object.create(AbstractScale.prototype);\n AbstractScale.call($this);\n $this.name_iafnnl$_0 = b.myName_8be2vx$;\n $this.definedBreaks_0 = b.myBreaks_8be2vx$;\n $this.definedLabels_0 = b.myLabels_8be2vx$;\n $this.labelFormatter_tb2f2k$_0 = b.myLabelFormatter_8be2vx$;\n $this.mapper_ohg8eh$_0 = b.myMapper_8be2vx$;\n $this.multiplicativeExpand = b.myMultiplicativeExpand_8be2vx$;\n $this.additiveExpand = b.myAdditiveExpand_8be2vx$;\n return $this;\n }\n function BreaksGenerator() {\n }\n BreaksGenerator.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'BreaksGenerator',\n interfaces: []\n };\n function ContinuousScale() {\n this.continuousTransform_0 = null;\n this.customBreaksGenerator_0 = null;\n this.isContinuous_r02bms$_0 = false;\n this.isContinuousDomain_cs93sw$_0 = true;\n this.domainLimits_m56boh$_0 = null;\n }\n Object.defineProperty(ContinuousScale.prototype, 'isContinuous', {\n configurable: true,\n get: function () {\n return this.isContinuous_r02bms$_0;\n }\n });\n Object.defineProperty(ContinuousScale.prototype, 'isContinuousDomain', {\n configurable: true,\n get: function () {\n return this.isContinuousDomain_cs93sw$_0;\n }\n });\n Object.defineProperty(ContinuousScale.prototype, 'domainLimits', {\n configurable: true,\n get: function () {\n return this.domainLimits_m56boh$_0;\n }\n });\n Object.defineProperty(ContinuousScale.prototype, 'transform', {\n configurable: true,\n get: function () {\n return this.continuousTransform_0;\n }\n });\n Object.defineProperty(ContinuousScale.prototype, 'breaksGenerator', {\n configurable: true,\n get: function () {\n var tmp$;\n if (this.customBreaksGenerator_0 != null) {\n tmp$ = new Transforms$BreaksGeneratorForTransformedDomain(this.continuousTransform_0, this.customBreaksGenerator_0);\n } else {\n tmp$ = Transforms_getInstance().createBreaksGeneratorForTransformedDomain_5x42z5$(this.continuousTransform_0, this.labelFormatter);\n }\n return tmp$;\n }\n });\n ContinuousScale.prototype.hasBreaksGenerator = function () {\n return true;\n };\n ContinuousScale.prototype.isInDomainLimits_za3rmp$ = function (v) {\n var tmp$;\n if (Kotlin.isNumber(v)) {\n var d = numberToDouble(v);\n tmp$ = (isFinite(d) && d >= this.domainLimits.first && d <= this.domainLimits.second);\n } else {\n tmp$ = false;\n }\n return tmp$;\n };\n ContinuousScale.prototype.hasDomainLimits = function () {\n return isFinite(this.domainLimits.first) || isFinite(this.domainLimits.second);\n };\n ContinuousScale.prototype.with = function () {\n return new ContinuousScale$MyBuilder(this);\n };\n function ContinuousScale$MyBuilder(scale) {\n AbstractScale$AbstractBuilder.call(this, scale);\n this.myContinuousTransform = scale.continuousTransform_0;\n this.myCustomBreaksGenerator = scale.customBreaksGenerator_0;\n this.myLowerLimit = scale.domainLimits.first;\n this.myUpperLimit = scale.domainLimits.second;\n this.myContinuousOutput = scale.isContinuous;\n }\n ContinuousScale$MyBuilder.prototype.lowerLimit_14dthe$ = function (v) {\n if (!isFinite(v)) {\n var message = \"`lower` can't be \" + v;\n throw IllegalArgumentException_init(message.toString());\n }this.myLowerLimit = v;\n return this;\n };\n ContinuousScale$MyBuilder.prototype.upperLimit_14dthe$ = function (v) {\n if (!isFinite(v)) {\n var message = \"`upper` can't be \" + v;\n throw IllegalArgumentException_init(message.toString());\n }this.myUpperLimit = v;\n return this;\n };\n ContinuousScale$MyBuilder.prototype.limits_pqjuzw$ = function (domainValues) {\n throw IllegalArgumentException_init(\"Can't apply discrete limits to scale with continuous domain\");\n };\n ContinuousScale$MyBuilder.prototype.continuousTransform_gxz7zd$ = function (v) {\n this.myContinuousTransform = v;\n return this;\n };\n ContinuousScale$MyBuilder.prototype.breaksGenerator_6q5k0b$ = function (v) {\n this.myCustomBreaksGenerator = v;\n return this;\n };\n ContinuousScale$MyBuilder.prototype.build = function () {\n return ContinuousScale_init_0(this);\n };\n ContinuousScale$MyBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyBuilder',\n interfaces: [AbstractScale$AbstractBuilder]\n };\n ContinuousScale.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContinuousScale',\n interfaces: [AbstractScale]\n };\n function ContinuousScale_init(name, mapper, continuousOutput, $this) {\n $this = $this || Object.create(ContinuousScale.prototype);\n AbstractScale_init(name, mapper, void 0, $this);\n ContinuousScale.call($this);\n $this.isContinuous_r02bms$_0 = continuousOutput;\n $this.domainLimits_m56boh$_0 = new Pair_0(kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY, kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY);\n $this.continuousTransform_0 = Transforms_getInstance().IDENTITY;\n $this.customBreaksGenerator_0 = null;\n $this.multiplicativeExpand = 0.05;\n $this.additiveExpand = 0.0;\n return $this;\n }\n function ContinuousScale_init_0(b, $this) {\n $this = $this || Object.create(ContinuousScale.prototype);\n AbstractScale_init_0(b, $this);\n ContinuousScale.call($this);\n $this.continuousTransform_0 = b.myContinuousTransform;\n $this.customBreaksGenerator_0 = b.myCustomBreaksGenerator;\n $this.isContinuous_r02bms$_0 = b.myContinuousOutput;\n var lower = data.SeriesUtil.isFinite_yrwdxb$(b.myLowerLimit) ? ensureNotNull(b.myLowerLimit) : kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY;\n var upper = data.SeriesUtil.isFinite_yrwdxb$(b.myUpperLimit) ? ensureNotNull(b.myUpperLimit) : kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY;\n $this.domainLimits_m56boh$_0 = new Pair_0(JsMath.min(lower, upper), JsMath.max(lower, upper));\n return $this;\n }\n function DiscreteScale() {\n this.discreteTransform_0 = null;\n }\n Object.defineProperty(DiscreteScale.prototype, 'breaks', {\n configurable: true,\n get: function () {\n var tmp$;\n if (!this.hasDomainLimits()) {\n tmp$ = Kotlin.callGetter(this, AbstractScale.prototype, 'breaks');\n } else {\n var breaksSet = toSet(Kotlin.callGetter(this, AbstractScale.prototype, 'breaks'));\n var $receiver = this.discreteTransform_0.domainLimits;\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (breaksSet.contains_11rb$(element))\n destination.add_11rb$(element);\n }\n tmp$ = destination;\n }\n return tmp$;\n }\n });\n Object.defineProperty(DiscreteScale.prototype, 'labels', {\n configurable: true,\n get: function () {\n var tmp$;\n var labels = Kotlin.callGetter(this, AbstractScale.prototype, 'labels');\n if (!this.hasDomainLimits() || labels.isEmpty()) {\n tmp$ = labels;\n } else {\n var breaks = Kotlin.callGetter(this, AbstractScale.prototype, 'breaks');\n var destination = ArrayList_init_1(collectionSizeOrDefault(breaks, 10));\n var tmp$_0, tmp$_0_0;\n var index = 0;\n tmp$_0 = breaks.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(labels.get_za3lpa$(checkIndexOverflow((tmp$_0_0 = index, index = tmp$_0_0 + 1 | 0, tmp$_0_0)) % labels.size));\n }\n var breakLabels = destination;\n var labelByBreak = toMap(zip(breaks, breakLabels));\n var $receiver = this.discreteTransform_0.domainLimits;\n var destination_0 = ArrayList_init();\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n if (labelByBreak.containsKey_11rb$(element))\n destination_0.add_11rb$(element);\n }\n var destination_1 = ArrayList_init_1(collectionSizeOrDefault(destination_0, 10));\n var tmp$_2;\n tmp$_2 = destination_0.iterator();\n while (tmp$_2.hasNext()) {\n var item_0 = tmp$_2.next();\n destination_1.add_11rb$(getValue(labelByBreak, item_0));\n }\n tmp$ = destination_1;\n }\n return tmp$;\n }\n });\n Object.defineProperty(DiscreteScale.prototype, 'transform', {\n configurable: true,\n get: function () {\n return this.discreteTransform_0;\n }\n });\n Object.defineProperty(DiscreteScale.prototype, 'breaksGenerator', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init(\"No breaks generator for discrete scale '\" + this.name + \"'\");\n }\n });\n Object.defineProperty(DiscreteScale.prototype, 'domainLimits', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init(\"Not applicable to scale with discrete domain '\" + this.name + \"'\");\n }\n });\n DiscreteScale.prototype.hasBreaksGenerator = function () {\n return false;\n };\n DiscreteScale.prototype.hasDomainLimits = function () {\n return this.discreteTransform_0.hasDomainLimits();\n };\n DiscreteScale.prototype.isInDomainLimits_za3rmp$ = function (v) {\n return this.discreteTransform_0.isInDomain_s8jyv4$(v);\n };\n DiscreteScale.prototype.with = function () {\n return new DiscreteScale$MyBuilder(this);\n };\n function DiscreteScale$MyBuilder(scale) {\n AbstractScale$AbstractBuilder.call(this, scale);\n this.myDomainValues_8be2vx$ = scale.discreteTransform_0.domainValues;\n this.myDomainLimits_8be2vx$ = scale.discreteTransform_0.domainLimits;\n }\n DiscreteScale$MyBuilder.prototype.breaksGenerator_6q5k0b$ = function (v) {\n throw IllegalStateException_init('Not applicable to scale with discrete domain');\n };\n DiscreteScale$MyBuilder.prototype.lowerLimit_14dthe$ = function (v) {\n throw IllegalStateException_init('Not applicable to scale with discrete domain');\n };\n DiscreteScale$MyBuilder.prototype.upperLimit_14dthe$ = function (v) {\n throw IllegalStateException_init('Not applicable to scale with discrete domain');\n };\n DiscreteScale$MyBuilder.prototype.limits_pqjuzw$ = function (domainValues) {\n this.myDomainLimits_8be2vx$ = domainValues;\n return this;\n };\n DiscreteScale$MyBuilder.prototype.continuousTransform_gxz7zd$ = function (v) {\n return this;\n };\n DiscreteScale$MyBuilder.prototype.build = function () {\n return DiscreteScale_init_0(this);\n };\n DiscreteScale$MyBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyBuilder',\n interfaces: [AbstractScale$AbstractBuilder]\n };\n DiscreteScale.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DiscreteScale',\n interfaces: [AbstractScale]\n };\n function DiscreteScale_init(name, domainValues, mapper, $this) {\n $this = $this || Object.create(DiscreteScale.prototype);\n AbstractScale_init(name, mapper, toList_0(domainValues), $this);\n DiscreteScale.call($this);\n $this.discreteTransform_0 = new DiscreteTransform(domainValues, emptyList());\n $this.multiplicativeExpand = 0.0;\n $this.additiveExpand = 0.6;\n return $this;\n }\n function DiscreteScale_init_0(b, $this) {\n $this = $this || Object.create(DiscreteScale.prototype);\n AbstractScale_init_0(b, $this);\n DiscreteScale.call($this);\n $this.discreteTransform_0 = new DiscreteTransform(b.myDomainValues_8be2vx$, b.myDomainLimits_8be2vx$);\n return $this;\n }\n function MapperUtil() {\n MapperUtil_instance = this;\n }\n MapperUtil.prototype.map_rejkqi$ = function (r, mapper) {\n var a = ensureNotNull(mapper(r.lowerEnd));\n var b = ensureNotNull(mapper(r.upperEnd));\n return new ClosedRange(JsMath.min(a, b), JsMath.max(a, b));\n };\n MapperUtil.prototype.mapDiscreteDomainValuesToNumbers_7f6uoc$ = function (values) {\n return this.mapDiscreteDomainValuesToIndices_0(values);\n };\n MapperUtil.prototype.mapDiscreteDomainValuesToIndices_0 = function (values) {\n var tmp$, tmp$_0;\n var result = LinkedHashMap_init();\n var index = 0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (v != null && !result.containsKey_11rb$(v)) {\n var value = (tmp$_0 = index, index = tmp$_0 + 1 | 0, tmp$_0);\n result.put_xwzc9p$(v, value);\n }}\n return result;\n };\n MapperUtil.prototype.rangeWithLimitsAfterTransform_5yamkg$ = function (dataRange, lowerLimit, upperLimit, trans) {\n var tmp$, tmp$_0;\n if (lowerLimit != null && isFinite(lowerLimit)) {\n tmp$ = lowerLimit;\n } else {\n tmp$ = dataRange.lowerEnd;\n }\n var lower = tmp$;\n if (upperLimit != null && isFinite(upperLimit)) {\n tmp$_0 = upperLimit;\n } else {\n tmp$_0 = dataRange.upperEnd;\n }\n var upper = tmp$_0;\n var limits = listOf([lower, upper]);\n return ClosedRange.Companion.encloseAll_17hg47$(trans.apply_9ma18$(limits));\n };\n MapperUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'MapperUtil',\n interfaces: []\n };\n var MapperUtil_instance = null;\n function MapperUtil_getInstance() {\n if (MapperUtil_instance === null) {\n new MapperUtil();\n }return MapperUtil_instance;\n }\n function Mappers() {\n Mappers_instance = this;\n this.IDENTITY = Mappers$IDENTITY$lambda;\n }\n function Mappers$undefined$lambda(it) {\n throw IllegalStateException_init('Undefined mapper');\n }\n Mappers.prototype.undefined_287e2$ = function () {\n return Mappers$undefined$lambda;\n };\n function Mappers$nullable$lambda(closure$ifNull, closure$f) {\n return function (n) {\n if (n == null) {\n return closure$ifNull;\n } else {\n return closure$f(n);\n }\n };\n }\n Mappers.prototype.nullable_q9jsah$ = function (f, ifNull) {\n return Mappers$nullable$lambda(ifNull, f);\n };\n function Mappers$constant$lambda(closure$v) {\n return function (it) {\n return closure$v;\n };\n }\n Mappers.prototype.constant_14dthe$ = function (v) {\n return Mappers$constant$lambda(v);\n };\n Mappers.prototype.mul_mdyssk$ = function (domain, rangeSpan) {\n var factor = rangeSpan / (domain.upperEnd - domain.lowerEnd);\n if (!!(isInfinite(factor) || isNaN_0(factor))) {\n var message = \"Can't create mapper with ratio: \" + factor;\n throw IllegalStateException_init(message.toString());\n }return this.mul_14dthe$(factor);\n };\n function Mappers$mul$lambda(closure$factor) {\n return function (v) {\n if (v != null) {\n return closure$factor * v;\n } else\n return null;\n };\n }\n Mappers.prototype.mul_14dthe$ = function (factor) {\n return Mappers$mul$lambda(factor);\n };\n Mappers.prototype.linear_1jkouz$ = function (domain, range, reverse) {\n if (reverse === void 0)\n reverse = false;\n return this.linear_yl4mmw$(domain, reverse ? range.upperEnd : range.lowerEnd, reverse ? range.lowerEnd : range.upperEnd, kotlin_js_internal_DoubleCompanionObject.NaN);\n };\n Mappers.prototype.linear_lww37m$ = function (domain, range, defaultValue) {\n return this.linear_yl4mmw$(domain, range.lowerEnd, range.upperEnd, defaultValue);\n };\n function Mappers$linear$lambda(closure$slop, closure$intersect, closure$defaultValue) {\n return function (input) {\n return data.SeriesUtil.isFinite_yrwdxb$(input) ? ensureNotNull(input) * closure$slop + closure$intersect : closure$defaultValue;\n };\n }\n Mappers.prototype.linear_yl4mmw$ = function (domain, rangeLow, rangeHigh, defaultValue) {\n var slop = (rangeHigh - rangeLow) / (domain.upperEnd - domain.lowerEnd);\n if (!data.SeriesUtil.isFinite_14dthe$(slop)) {\n var v = (rangeHigh - rangeLow) / 2 + rangeLow;\n return this.constant_14dthe$(v);\n }var intersect = rangeLow - domain.lowerEnd * slop;\n return Mappers$linear$lambda(slop, intersect, defaultValue);\n };\n Mappers.prototype.discreteToContinuous_83ntpg$ = function (domainValues, outputRange, naValue) {\n var tmp$;\n var numberByDomainValue = MapperUtil_getInstance().mapDiscreteDomainValuesToNumbers_7f6uoc$(domainValues);\n tmp$ = data.SeriesUtil.range_l63ks6$(numberByDomainValue.values);\n if (tmp$ == null) {\n return this.IDENTITY;\n }var dataRange = tmp$;\n return this.linear_lww37m$(dataRange, outputRange, naValue);\n };\n function Mappers$discrete$lambda(closure$f) {\n return function (it) {\n return closure$f.apply_11rb$(it);\n };\n }\n Mappers.prototype.discrete_rath1t$ = function (outputValues, defaultOutputValue) {\n var f = new Mappers$DiscreteFun(outputValues, defaultOutputValue);\n return Mappers$discrete$lambda(f);\n };\n function Mappers$quantized$lambda(closure$defaultOutputValue) {\n return function (it) {\n return closure$defaultOutputValue;\n };\n }\n function Mappers$quantized$lambda_0(closure$f) {\n return function (it) {\n return closure$f.apply_11rb$(it);\n };\n }\n Mappers.prototype.quantized_hd8s0$ = function (domain, outputValues, defaultOutputValue) {\n if (domain == null) {\n return Mappers$quantized$lambda(defaultOutputValue);\n }var quantizer = new QuantizeScale();\n quantizer.domain_lu1900$(domain.lowerEnd, domain.upperEnd);\n quantizer.range_brywnq$(outputValues);\n var f = new Mappers$QuantizedFun(quantizer, defaultOutputValue);\n return Mappers$quantized$lambda_0(f);\n };\n function Mappers$DiscreteFun(myOutputValues, myDefaultOutputValue) {\n this.myOutputValues_0 = myOutputValues;\n this.myDefaultOutputValue_0 = myDefaultOutputValue;\n }\n Mappers$DiscreteFun.prototype.apply_11rb$ = function (value) {\n if (!data.SeriesUtil.isFinite_yrwdxb$(value)) {\n return this.myDefaultOutputValue_0;\n }var index = numberToInt(round(ensureNotNull(value)));\n index = index % this.myOutputValues_0.size;\n if (index < 0) {\n index = index + this.myOutputValues_0.size | 0;\n }return this.myOutputValues_0.get_za3lpa$(index);\n };\n Mappers$DiscreteFun.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DiscreteFun',\n interfaces: [Function]\n };\n function Mappers$QuantizedFun(myQuantizer, myDefaultOutputValue) {\n this.myQuantizer_0 = myQuantizer;\n this.myDefaultOutputValue_0 = myDefaultOutputValue;\n }\n Mappers$QuantizedFun.prototype.apply_11rb$ = function (value) {\n return !data.SeriesUtil.isFinite_yrwdxb$(value) ? this.myDefaultOutputValue_0 : this.myQuantizer_0.quantize_14dthe$(ensureNotNull(value));\n };\n Mappers$QuantizedFun.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'QuantizedFun',\n interfaces: [Function]\n };\n function Mappers$IDENTITY$lambda(v) {\n return v;\n }\n Mappers.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Mappers',\n interfaces: []\n };\n var Mappers_instance = null;\n function Mappers_getInstance() {\n if (Mappers_instance === null) {\n new Mappers();\n }return Mappers_instance;\n }\n function ScaleBreaks(domainValues, transformValues, labels) {\n this.domainValues = ArrayList_init_0(domainValues);\n this.transformValues = ArrayList_init_0(transformValues);\n this.labels = ArrayList_init_0(labels);\n }\n ScaleBreaks.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ScaleBreaks',\n interfaces: []\n };\n function ScaleUtil() {\n ScaleUtil_instance = this;\n }\n function ScaleUtil$labels$lambda(v) {\n return v.toString();\n }\n ScaleUtil.prototype.labels_x4zrm4$ = function (scale) {\n var tmp$;\n if (!scale.hasBreaks()) {\n return emptyList();\n }var breaks = scale.breaks;\n if (scale.hasLabels()) {\n var labels = scale.labels;\n if (breaks.size <= labels.size) {\n return labels.subList_vux9f0$(0, breaks.size);\n }var result = ArrayList_init();\n for (var i = 0; i !== breaks.size; ++i) {\n if (labels.isEmpty()) {\n result.add_11rb$('');\n } else {\n result.add_11rb$(labels.get_za3lpa$(i % labels.size));\n }\n }\n return result;\n }var formatter = (tmp$ = scale.labelFormatter) != null ? tmp$ : ScaleUtil$labels$lambda;\n var destination = ArrayList_init_1(collectionSizeOrDefault(breaks, 10));\n var tmp$_0;\n tmp$_0 = breaks.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(formatter(item));\n }\n return destination;\n };\n ScaleUtil.prototype.labelByBreak_x4zrm4$ = function (scale) {\n var result = HashMap_init();\n if (scale.hasBreaks()) {\n var breaks = scale.breaks.iterator();\n var labels = this.labels_x4zrm4$(scale).iterator();\n while (breaks.hasNext() && labels.hasNext()) {\n var key = breaks.next();\n var value = labels.next();\n result.put_xwzc9p$(key, value);\n }\n }return result;\n };\n ScaleUtil.prototype.breaksTransformed_x4zrm4$ = function (scale) {\n var $receiver = scale.transform.apply_9ma18$(scale.breaks);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_0;\n destination.add_11rb$(typeof (tmp$_0 = item) === 'number' ? tmp$_0 : throwCCE());\n }\n return destination;\n };\n ScaleUtil.prototype.axisBreaks_2m8kky$ = function (scale, coord, horizontal) {\n var tmp$;\n var scaleBreaks = this.transformAndMap_syim1y$(scale.breaks, scale);\n var axisBreaks = ArrayList_init();\n tmp$ = scaleBreaks.iterator();\n while (tmp$.hasNext()) {\n var br = tmp$.next();\n var mappedBrPoint = horizontal ? new DoubleVector(ensureNotNull(br), 0.0) : new DoubleVector(0.0, ensureNotNull(br));\n var axisBrPoint = coord.toClient_gpjtzr$(mappedBrPoint);\n var axisBr = horizontal ? axisBrPoint.x : axisBrPoint.y;\n axisBreaks.add_11rb$(axisBr);\n if (!isFinite(axisBr)) {\n throw IllegalStateException_init(\"Illegal axis '\" + scale.name + \"' break position \" + toString(axisBr) + ' at index ' + toString(axisBreaks.size - 1 | 0) + '\\nsource breaks : ' + toString(scale.breaks) + '\\ntranslated breaks: ' + toString(scaleBreaks) + '\\naxis breaks : ' + toString(axisBreaks));\n }}\n return axisBreaks;\n };\n ScaleUtil.prototype.map_dp4lfi$ = function (range, scale) {\n return MapperUtil_getInstance().map_rejkqi$(range, scale.mapper);\n };\n ScaleUtil.prototype.map_9ksyxk$ = function (l, scale) {\n var mapper = scale.mapper;\n var destination = ArrayList_init_1(collectionSizeOrDefault(l, 10));\n var tmp$;\n tmp$ = l.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(mapper(item));\n }\n return destination;\n };\n ScaleUtil.prototype.transformAndMap_syim1y$ = function (l, scale) {\n var cleaned = this.cleanUpTransformSource_2jj1lg$(l, scale);\n var transformed = scale.transform.apply_9ma18$(cleaned);\n return this.map_9ksyxk$(transformed, scale);\n };\n ScaleUtil.prototype.cleanUpTransformSource_2jj1lg$ = function (source, scale) {\n var tmp$;\n var source_0 = source;\n if (scale.hasDomainLimits()) {\n var $receiver = source_0;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(item == null || scale.isInDomainLimits_za3rmp$(item) ? item : null);\n }\n source_0 = destination;\n }if (Kotlin.isType(scale.transform, ContinuousTransform)) {\n var continuousTransform = Kotlin.isType(tmp$ = scale.transform, ContinuousTransform) ? tmp$ : throwCCE();\n if (continuousTransform.hasDomainLimits()) {\n var $receiver_0 = source_0;\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault($receiver_0, 10));\n var tmp$_1;\n tmp$_1 = $receiver_0.iterator();\n while (tmp$_1.hasNext()) {\n var item_0 = tmp$_1.next();\n var tmp$_2;\n destination_0.add_11rb$(continuousTransform.isInDomain_yrwdxb$((tmp$_2 = item_0) == null || typeof tmp$_2 === 'number' ? tmp$_2 : throwCCE()) ? item_0 : null);\n }\n source_0 = destination_0;\n }}return source_0;\n };\n ScaleUtil.prototype.inverseTransformToContinuousDomain_codrxm$ = function (l, scale) {\n var tmp$;\n if (!scale.isContinuousDomain) {\n var message = 'Not continuous numeric domain: ' + scale;\n throw IllegalStateException_init(message.toString());\n }return (Kotlin.isType(tmp$ = scale.transform, ContinuousTransform) ? tmp$ : throwCCE()).applyInverse_k9kaly$(l);\n };\n ScaleUtil.prototype.inverseTransform_codrxm$ = function (l, scale) {\n var tmp$;\n var transform = scale.transform;\n if (Kotlin.isType(transform, ContinuousTransform)) {\n tmp$ = transform.applyInverse_k9kaly$(l);\n } else {\n var destination = ArrayList_init_1(collectionSizeOrDefault(l, 10));\n var tmp$_0;\n tmp$_0 = l.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(transform.applyInverse_yrwdxb$(item));\n }\n tmp$ = destination;\n }\n return tmp$;\n };\n ScaleUtil.prototype.transformedDefinedLimits_x4zrm4$ = function (scale) {\n var tmp$, tmp$_0;\n var tmp$_1 = scale.domainLimits;\n var lower = tmp$_1.component1()\n , upper = tmp$_1.component2();\n var transform = Kotlin.isType(tmp$ = scale.transform, ContinuousTransform) ? tmp$ : throwCCE();\n var tmp$_2 = new Pair_0(transform.isInDomain_yrwdxb$(lower) ? ensureNotNull(transform.apply_yrwdxb$(lower)) : kotlin_js_internal_DoubleCompanionObject.NaN, transform.isInDomain_yrwdxb$(upper) ? ensureNotNull(transform.apply_yrwdxb$(upper)) : kotlin_js_internal_DoubleCompanionObject.NaN);\n var transformedLower = tmp$_2.component1()\n , transformedUpper = tmp$_2.component2();\n if (data.SeriesUtil.allFinite_jma9l8$(transformedLower, transformedUpper)) {\n tmp$_0 = new Pair_0(JsMath.min(transformedLower, transformedUpper), JsMath.max(transformedLower, transformedUpper));\n } else {\n tmp$_0 = new Pair_0(transformedLower, transformedUpper);\n }\n return tmp$_0;\n };\n ScaleUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ScaleUtil',\n interfaces: []\n };\n var ScaleUtil_instance = null;\n function ScaleUtil_getInstance() {\n if (ScaleUtil_instance === null) {\n new ScaleUtil();\n }return ScaleUtil_instance;\n }\n function Scales() {\n Scales_instance = this;\n }\n Scales.prototype.continuousDomain_sqn2xl$ = function (name, aes) {\n return ContinuousScale_init(name, Mappers_getInstance().undefined_287e2$(), aes.isNumeric);\n };\n Scales.prototype.continuousDomainNumericRange_61zpoe$ = function (name) {\n return ContinuousScale_init(name, Mappers_getInstance().undefined_287e2$(), true);\n };\n Scales.prototype.continuousDomain_lo18em$ = function (name, mapper, continuousRange) {\n return ContinuousScale_init(name, mapper, continuousRange);\n };\n Scales.prototype.discreteDomain_uksd38$ = function (name, domainValues) {\n return this.discreteDomain_l9mre7$(name, domainValues, Mappers_getInstance().undefined_287e2$());\n };\n Scales.prototype.discreteDomain_l9mre7$ = function (name, domainValues, mapper) {\n return DiscreteScale_init(name, domainValues, mapper);\n };\n Scales.prototype.pureDiscrete_kiqtr1$ = function (name, domainValues, outputValues, defaultOutputValue) {\n return this.discreteDomain_uksd38$(name, domainValues).with().mapper_1uitho$(Mappers_getInstance().discrete_rath1t$(outputValues, defaultOutputValue)).build();\n };\n Scales.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Scales',\n interfaces: []\n };\n var Scales_instance = null;\n function Scales_getInstance() {\n if (Scales_instance === null) {\n new Scales();\n }return Scales_instance;\n }\n function BreaksHelperBase(start, end, targetCount) {\n this.normalStart = 0;\n this.normalEnd = 0;\n this.span = 0;\n this.targetStep = 0;\n this.isReversed = false;\n if (!isFinite(start)) {\n var message = 'range start ' + start;\n throw IllegalArgumentException_init(message.toString());\n }if (!isFinite(end)) {\n var message_0 = 'range end ' + end;\n throw IllegalArgumentException_init(message_0.toString());\n }if (!(targetCount > 0)) {\n var message_1 = \"'count' must be positive: \" + targetCount;\n throw IllegalArgumentException_init(message_1.toString());\n }var span = end - start;\n var reversed = false;\n if (span < 0) {\n span = -span;\n reversed = true;\n }this.span = span;\n this.targetStep = this.span / targetCount;\n this.isReversed = reversed;\n this.normalStart = reversed ? end : start;\n this.normalEnd = reversed ? start : end;\n }\n BreaksHelperBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BreaksHelperBase',\n interfaces: []\n };\n function DateTimeBreaksHelper(rangeStart, rangeEnd, count, minInterval) {\n if (minInterval === void 0)\n minInterval = null;\n BreaksHelperBase.call(this, rangeStart, rangeEnd, count);\n this.breaks_n95hiz$_0 = null;\n this.formatter = null;\n var tmp$;\n var step = this.targetStep;\n if (step < 1000) {\n this.formatter = (new TimeScaleTickFormatterFactory(minInterval)).getFormatter_14dthe$(step);\n this.breaks_n95hiz$_0 = (new LinearBreaksHelper(rangeStart, rangeEnd, count)).breaks;\n } else {\n var start = this.normalStart;\n var end = this.normalEnd;\n var ticks = null;\n if (minInterval != null) {\n ticks = toMutableList(minInterval.range_lu1900$(start, end));\n }if (ticks != null && ticks.size <= count) {\n this.formatter = ensureNotNull(minInterval).tickFormatter;\n } else if (step > YearInterval.Companion.MS) {\n this.formatter = YearInterval.Companion.TICK_FORMATTER;\n ticks = ArrayList_init();\n var startDateTime = time.TimeUtil.asDateTimeUTC_14dthe$(start);\n var startYear = startDateTime.year;\n if (startDateTime.isAfter_amwj4p$(time.TimeUtil.yearStart_za3lpa$(startYear))) {\n startYear = startYear + 1 | 0;\n }var endYear = time.TimeUtil.asDateTimeUTC_14dthe$(end).year;\n var helper = new LinearBreaksHelper(startYear, endYear, count);\n tmp$ = helper.breaks.iterator();\n while (tmp$.hasNext()) {\n var tickYear = tmp$.next();\n var tickDate = time.TimeUtil.yearStart_za3lpa$(numberToInt(round(tickYear)));\n ticks.add_11rb$(time.TimeUtil.asInstantUTC_amwj4p$(tickDate).toNumber());\n }\n } else {\n var interval_0 = interval.NiceTimeInterval.forMillis_14dthe$(step);\n this.formatter = interval_0.tickFormatter;\n ticks = toMutableList(interval_0.range_lu1900$(start, end));\n }\n if (this.isReversed) {\n reverse(ticks);\n }this.breaks_n95hiz$_0 = ticks;\n }\n }\n Object.defineProperty(DateTimeBreaksHelper.prototype, 'breaks', {\n configurable: true,\n get: function () {\n return this.breaks_n95hiz$_0;\n }\n });\n DateTimeBreaksHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DateTimeBreaksHelper',\n interfaces: [BreaksHelperBase]\n };\n function LinearBreaksHelper(rangeStart, rangeEnd, count, precise) {\n LinearBreaksHelper$Companion_getInstance();\n if (precise === void 0)\n precise = false;\n BreaksHelperBase.call(this, rangeStart, rangeEnd, count);\n this.breaks_egvm9d$_0 = null;\n var tmp$, tmp$_0, tmp$_1;\n if (!(count > 0)) {\n var message = \"Can't compute breaks for count: \" + count;\n throw IllegalStateException_init(message.toString());\n }if (precise) {\n tmp$ = this.targetStep;\n } else {\n tmp$ = LinearBreaksHelper$Companion_getInstance().computeNiceStep_0(this.span, count);\n }\n var step = tmp$;\n if (precise) {\n var $receiver = until(0, count);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_2;\n tmp$_2 = $receiver.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination.add_11rb$(this.normalStart + step / 2 + item * step);\n }\n tmp$_0 = destination;\n } else {\n tmp$_0 = LinearBreaksHelper$Companion_getInstance().computeNiceBreaks_0(this.normalStart, this.normalEnd, step);\n }\n var breaks = tmp$_0;\n if (breaks.isEmpty()) {\n tmp$_1 = listOf_0(this.normalStart);\n } else if (this.isReversed) {\n tmp$_1 = asReversed(breaks);\n } else {\n tmp$_1 = breaks;\n }\n this.breaks_egvm9d$_0 = tmp$_1;\n }\n Object.defineProperty(LinearBreaksHelper.prototype, 'breaks', {\n configurable: true,\n get: function () {\n return this.breaks_egvm9d$_0;\n }\n });\n function LinearBreaksHelper$Companion() {\n LinearBreaksHelper$Companion_instance = this;\n }\n LinearBreaksHelper$Companion.prototype.computeNiceStep_0 = function (span, count) {\n var tmp$;\n var stepRaw = span / count;\n var x = JsMath.log10(stepRaw);\n var step10Power = JsMath.floor(x);\n var step = JsMath.pow(10.0, step10Power);\n var error = step * count / span;\n if (error <= 0.15)\n tmp$ = step * 10.0;\n else if (error <= 0.35)\n tmp$ = step * 5.0;\n else if (error <= 0.75)\n tmp$ = step * 2.0;\n else\n tmp$ = step;\n return tmp$;\n };\n LinearBreaksHelper$Companion.prototype.computeNiceBreaks_0 = function (start, end, step) {\n if (step === 0.0)\n return emptyList();\n var delta = step / 10000;\n var startE = start - delta;\n var endE = end + delta;\n var breaks = ArrayList_init();\n var x = startE / step;\n var tick = JsMath.ceil(x) * step;\n if (start >= 0 && startE < 0) {\n tick = 0.0;\n }while (tick <= endE) {\n var a = tick;\n tick = JsMath.min(a, end);\n breaks.add_11rb$(tick);\n tick += step;\n }\n return breaks;\n };\n LinearBreaksHelper$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LinearBreaksHelper$Companion_instance = null;\n function LinearBreaksHelper$Companion_getInstance() {\n if (LinearBreaksHelper$Companion_instance === null) {\n new LinearBreaksHelper$Companion();\n }return LinearBreaksHelper$Companion_instance;\n }\n LinearBreaksHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinearBreaksHelper',\n interfaces: [BreaksHelperBase]\n };\n function NumericBreakFormatter(value, step, allowMetricPrefix) {\n this.formatter_0 = null;\n var tmp$, tmp$_0, tmp$_1;\n if (value === 0.0) {\n tmp$ = kotlin_js_internal_DoubleCompanionObject.MIN_VALUE * 10;\n } else {\n tmp$ = JsMath.abs(value);\n }\n var value_0 = tmp$;\n if (step === 0.0) {\n tmp$_0 = value_0 / 10;\n } else {\n tmp$_0 = JsMath.abs(step);\n }\n var step_0 = tmp$_0;\n var type = 'f';\n var delimiter = '';\n var x = JsMath.abs(value_0);\n var domain10Power = JsMath.log10(x);\n var step10Power = JsMath.log10(step_0);\n var precision = -step10Power;\n var scientificNotation = false;\n if (domain10Power < 0 && step10Power < -4) {\n scientificNotation = true;\n type = 'e';\n precision = domain10Power - step10Power;\n } else if (domain10Power > 7 && step10Power > 2) {\n scientificNotation = true;\n precision = domain10Power - step10Power;\n }if (precision < 0) {\n precision = 0.0;\n type = 'd';\n }var x_0 = precision - 0.001;\n precision = JsMath.ceil(x_0);\n if (scientificNotation) {\n if (domain10Power > 0 && allowMetricPrefix) {\n tmp$_1 = 's';\n } else {\n tmp$_1 = 'e';\n }\n type = tmp$_1;\n } else {\n delimiter = ',';\n }\n this.formatter_0 = NumberFormat_init(delimiter + '.' + numberToInt(precision) + type);\n }\n NumericBreakFormatter.prototype.apply_za3rmp$ = function (value) {\n var tmp$;\n return this.formatter_0.apply_3p81yu$(Kotlin.isNumber(tmp$ = value) ? tmp$ : throwCCE());\n };\n NumericBreakFormatter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NumericBreakFormatter',\n interfaces: []\n };\n function QuantizeScale() {\n this.myHasDomain_0 = false;\n this.myDomainStart_0 = 0.0;\n this.myDomainEnd_0 = 0.0;\n this.myOutputValues_9bxfi2$_0 = this.myOutputValues_9bxfi2$_0;\n }\n Object.defineProperty(QuantizeScale.prototype, 'myOutputValues_0', {\n configurable: true,\n get: function () {\n if (this.myOutputValues_9bxfi2$_0 == null)\n return throwUPAE('myOutputValues');\n return this.myOutputValues_9bxfi2$_0;\n },\n set: function (myOutputValues) {\n this.myOutputValues_9bxfi2$_0 = myOutputValues;\n }\n });\n Object.defineProperty(QuantizeScale.prototype, 'outputValues', {\n configurable: true,\n get: function () {\n return this.myOutputValues_0;\n }\n });\n Object.defineProperty(QuantizeScale.prototype, 'domainQuantized', {\n configurable: true,\n get: function () {\n var tmp$;\n if (this.myDomainStart_0 === this.myDomainEnd_0) {\n return listOf_0(new ClosedRange(this.myDomainStart_0, this.myDomainEnd_0));\n }var list = ArrayList_init();\n var numBuckets = this.myOutputValues_0.size;\n var bucketSize = this.bucketSize_0();\n tmp$ = numBuckets - 1 | 0;\n for (var i = 0; i < tmp$; i++) {\n var bucket = new ClosedRange(this.myDomainStart_0 + bucketSize * i, this.myDomainStart_0 + bucketSize * (i + 1 | 0));\n list.add_11rb$(bucket);\n }\n var bucket_0 = new ClosedRange(this.myDomainStart_0 + bucketSize * (numBuckets - 1 | 0), this.myDomainEnd_0);\n list.add_11rb$(bucket_0);\n return list;\n }\n });\n QuantizeScale.prototype.domain_lu1900$ = function (start, end) {\n if (!(start <= end)) {\n var message = 'Domain start must be less then domain end: ' + start + ' > ' + end;\n throw IllegalArgumentException_init(message.toString());\n }this.myHasDomain_0 = true;\n this.myDomainStart_0 = start;\n this.myDomainEnd_0 = end;\n return this;\n };\n QuantizeScale.prototype.range_brywnq$ = function (values) {\n this.myOutputValues_0 = ArrayList_init_0(values);\n return this;\n };\n QuantizeScale.prototype.quantize_14dthe$ = function (v) {\n var i = this.outputIndex_0(v);\n return this.myOutputValues_0.get_za3lpa$(i);\n };\n QuantizeScale.prototype.outputIndex_0 = function (v) {\n if (!this.myHasDomain_0) {\n var message = 'Domain not defined.';\n throw IllegalStateException_init(message.toString());\n }var tmp$ = this.myOutputValues_9bxfi2$_0 != null;\n if (tmp$) {\n tmp$ = !this.myOutputValues_0.isEmpty();\n }if (!tmp$) {\n var message_0 = 'Output values are not defined.';\n throw IllegalStateException_init(message_0.toString());\n }var bucketSize = this.bucketSize_0();\n var index = numberToInt((v - this.myDomainStart_0) / bucketSize);\n var maxIndex = this.myOutputValues_0.size - 1 | 0;\n var b = JsMath.min(maxIndex, index);\n return JsMath.max(0, b);\n };\n QuantizeScale.prototype.getOutputValueIndex_za3rmp$ = function (domainValue) {\n var tmp$;\n if (Kotlin.isNumber(domainValue)) {\n tmp$ = this.outputIndex_0(numberToDouble(domainValue));\n } else\n tmp$ = -1;\n return tmp$;\n };\n QuantizeScale.prototype.getOutputValue_za3rmp$ = function (domainValue) {\n var tmp$;\n if (Kotlin.isNumber(domainValue)) {\n tmp$ = this.quantize_14dthe$(numberToDouble(domainValue));\n } else\n tmp$ = null;\n return tmp$;\n };\n QuantizeScale.prototype.bucketSize_0 = function () {\n return (this.myDomainEnd_0 - this.myDomainStart_0) / this.myOutputValues_0.size;\n };\n QuantizeScale.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'QuantizeScale',\n interfaces: [WithFiniteOrderedOutput]\n };\n function ScaleBreaksUtil() {\n ScaleBreaksUtil_instance = this;\n }\n ScaleBreaksUtil.prototype.withBreaks_qt1l9m$ = function (scale, transformedDomain, breakCount) {\n var scaleBreaks = scale.breaksGenerator.generateBreaks_1tlvto$(transformedDomain, breakCount);\n var breaks = scaleBreaks.domainValues;\n var labels = scaleBreaks.labels;\n return scale.with().breaks_pqjuzw$(breaks).labels_mhpeer$(labels).build();\n };\n ScaleBreaksUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ScaleBreaksUtil',\n interfaces: []\n };\n var ScaleBreaksUtil_instance = null;\n function ScaleBreaksUtil_getInstance() {\n if (ScaleBreaksUtil_instance === null) {\n new ScaleBreaksUtil();\n }return ScaleBreaksUtil_instance;\n }\n function TimeScaleTickFormatterFactory(minInterval) {\n this.minInterval_0 = minInterval;\n }\n TimeScaleTickFormatterFactory.prototype.getFormatter_14dthe$ = function (step) {\n return text.Formatter.time_61zpoe$(this.formatPattern_0(step));\n };\n TimeScaleTickFormatterFactory.prototype.formatPattern_0 = function (step) {\n if (step < 1000) {\n return TimeInterval.Companion.milliseconds_za3lpa$(1).tickFormatPattern;\n }if (this.minInterval_0 != null) {\n var stepCount = 100;\n var start = 0.0;\n var end = step * stepCount;\n var intervalCount = this.minInterval_0.range_lu1900$(start, end).size;\n if (stepCount >= intervalCount) {\n return this.minInterval_0.tickFormatPattern;\n }}if (step > YearInterval.Companion.MS) {\n return YearInterval.Companion.TICK_FORMAT;\n }var interval_0 = interval.NiceTimeInterval.forMillis_14dthe$(step);\n return interval_0.tickFormatPattern;\n };\n TimeScaleTickFormatterFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TimeScaleTickFormatterFactory',\n interfaces: []\n };\n function WithFiniteOrderedOutput() {\n }\n WithFiniteOrderedOutput.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'WithFiniteOrderedOutput',\n interfaces: []\n };\n function DateTimeBreaksGen(labelFormatter) {\n if (labelFormatter === void 0)\n labelFormatter = null;\n this.labelFormatter_0 = labelFormatter;\n }\n DateTimeBreaksGen.prototype.generateBreaks_1tlvto$ = function (domain, targetCount) {\n var tmp$, tmp$_0;\n var helper = this.breaksHelper_0(domain, targetCount);\n var ticks = helper.breaks;\n var labelFormatter = (tmp$ = this.labelFormatter_0) != null ? tmp$ : helper.formatter;\n var labels = ArrayList_init();\n tmp$_0 = ticks.iterator();\n while (tmp$_0.hasNext()) {\n var tick = tmp$_0.next();\n labels.add_11rb$(labelFormatter(tick));\n }\n return new ScaleBreaks(ticks, ticks, labels);\n };\n DateTimeBreaksGen.prototype.breaksHelper_0 = function (domainAfterTransform, targetCount) {\n return new DateTimeBreaksHelper(domainAfterTransform.lowerEnd, domainAfterTransform.upperEnd, targetCount);\n };\n DateTimeBreaksGen.prototype.labelFormatter_1tlvto$ = function (domain, targetCount) {\n var tmp$;\n return (tmp$ = this.labelFormatter_0) != null ? tmp$ : this.breaksHelper_0(domain, targetCount).formatter;\n };\n DateTimeBreaksGen.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DateTimeBreaksGen',\n interfaces: [BreaksGenerator]\n };\n function FunTransform(transformFun, inverseFun) {\n this.transformFun_vpw6mq$_0 = transformFun;\n this.inverseFun_2rsie$_0 = inverseFun;\n }\n FunTransform.prototype.apply_yrwdxb$ = function (v) {\n var tmp$;\n if (v != null) {\n tmp$ = this.transformFun_vpw6mq$_0(v);\n } else {\n tmp$ = null;\n }\n return tmp$;\n };\n FunTransform.prototype.apply_9ma18$ = function (l) {\n var $receiver = this.safeCastToDoubles_9ma18$(l);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(this.apply_yrwdxb$(item));\n }\n return destination;\n };\n FunTransform.prototype.applyInverse_yrwdxb$ = function (v) {\n var tmp$;\n if (v != null) {\n tmp$ = this.inverseFun_2rsie$_0(v);\n } else {\n tmp$ = null;\n }\n return tmp$;\n };\n FunTransform.prototype.applyInverse_k9kaly$ = function (l) {\n var destination = ArrayList_init_1(collectionSizeOrDefault(l, 10));\n var tmp$;\n tmp$ = l.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(this.applyInverse_yrwdxb$(item));\n }\n return destination;\n };\n FunTransform.prototype.safeCastToDoubles_9ma18$ = function (list) {\n var checkedDoubles = data.SeriesUtil.checkedDoubles_9ma18$(list);\n if (!checkedDoubles.canBeCast()) {\n var message = 'Not a collections of Double(s)';\n throw IllegalArgumentException_init(message.toString());\n }return checkedDoubles.cast();\n };\n FunTransform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FunTransform',\n interfaces: [ContinuousTransform]\n };\n function IdentityTransform() {\n FunTransform.call(this, IdentityTransform_init$lambda, IdentityTransform_init$lambda_0);\n }\n IdentityTransform.prototype.hasDomainLimits = function () {\n return false;\n };\n IdentityTransform.prototype.isInDomain_yrwdxb$ = function (v) {\n return data.SeriesUtil.isFinite_yrwdxb$(v);\n };\n IdentityTransform.prototype.createApplicableDomain_14dthe$ = function (middle) {\n var middle_0 = isFinite(middle) ? middle : 0.0;\n return new ClosedRange(middle_0 - 0.5, middle_0 + 0.5);\n };\n IdentityTransform.prototype.apply_9ma18$ = function (l) {\n return this.safeCastToDoubles_9ma18$(l);\n };\n IdentityTransform.prototype.applyInverse_k9kaly$ = function (l) {\n return l;\n };\n function IdentityTransform_init$lambda(v) {\n return v;\n }\n function IdentityTransform_init$lambda_0(v) {\n return v;\n }\n IdentityTransform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'IdentityTransform',\n interfaces: [FunTransform]\n };\n function LinearBreaksGen(formatter) {\n LinearBreaksGen$Companion_getInstance();\n if (formatter === void 0)\n formatter = null;\n this.formatter_0 = formatter;\n }\n LinearBreaksGen.prototype.generateBreaks_1tlvto$ = function (domain, targetCount) {\n var tmp$;\n var breaks = LinearBreaksGen$Companion_getInstance().generateBreakValues_omwdpb$(domain, targetCount);\n var fmt = (tmp$ = this.formatter_0) != null ? tmp$ : LinearBreaksGen$Companion_getInstance().createFormatter_0(breaks);\n var destination = ArrayList_init_1(collectionSizeOrDefault(breaks, 10));\n var tmp$_0;\n tmp$_0 = breaks.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(fmt(item));\n }\n var labels = destination;\n return new ScaleBreaks(breaks, breaks, labels);\n };\n LinearBreaksGen.prototype.labelFormatter_1tlvto$ = function (domain, targetCount) {\n var tmp$;\n return (tmp$ = this.formatter_0) != null ? tmp$ : LinearBreaksGen$Companion_getInstance().createFormatter_0(LinearBreaksGen$Companion_getInstance().generateBreakValues_omwdpb$(domain, targetCount));\n };\n function LinearBreaksGen$Companion() {\n LinearBreaksGen$Companion_instance = this;\n }\n LinearBreaksGen$Companion.prototype.generateBreakValues_omwdpb$ = function (domain, targetCount) {\n var helper = new LinearBreaksHelper(domain.lowerEnd, domain.upperEnd, targetCount);\n return helper.breaks;\n };\n LinearBreaksGen$Companion.prototype.createFormatter_0 = function (breakValues) {\n var tmp$, tmp$_0;\n if (breakValues.isEmpty())\n tmp$_0 = new Pair_0(0.0, 0.5);\n else {\n var x = first(breakValues);\n var tmp$_1 = JsMath.abs(x);\n var x_0 = last(breakValues);\n var b = JsMath.abs(x_0);\n var v = JsMath.max(tmp$_1, b);\n if (breakValues.size === 1)\n tmp$ = v / 10;\n else {\n var x_1 = breakValues.get_za3lpa$(1) - breakValues.get_za3lpa$(0);\n tmp$ = JsMath.abs(x_1);\n }\n var s = tmp$;\n tmp$_0 = new Pair_0(v, s);\n }\n var tmp$_2 = tmp$_0;\n var referenceValue = tmp$_2.component1()\n , step = tmp$_2.component2();\n var formatter = new NumericBreakFormatter(referenceValue, step, true);\n return getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_za3rmp$(p1);\n }.bind(null, formatter));\n };\n LinearBreaksGen$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LinearBreaksGen$Companion_instance = null;\n function LinearBreaksGen$Companion_getInstance() {\n if (LinearBreaksGen$Companion_instance === null) {\n new LinearBreaksGen$Companion();\n }return LinearBreaksGen$Companion_instance;\n }\n LinearBreaksGen.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinearBreaksGen',\n interfaces: [BreaksGenerator]\n };\n function Log10Transform() {\n Log10Transform$Companion_getInstance();\n FunTransform.call(this, Log10Transform_init$lambda, Log10Transform_init$lambda_0);\n }\n Log10Transform.prototype.hasDomainLimits = function () {\n return true;\n };\n Log10Transform.prototype.isInDomain_yrwdxb$ = function (v) {\n return data.SeriesUtil.isFinite_yrwdxb$(v) && ensureNotNull(v) >= 0.0;\n };\n Log10Transform.prototype.apply_yrwdxb$ = function (v) {\n return Log10Transform$Companion_getInstance().trimInfinity_0(FunTransform.prototype.apply_yrwdxb$.call(this, v));\n };\n Log10Transform.prototype.applyInverse_yrwdxb$ = function (v) {\n return FunTransform.prototype.applyInverse_yrwdxb$.call(this, v);\n };\n Log10Transform.prototype.createApplicableDomain_14dthe$ = function (middle) {\n var tmp$;\n if (this.isInDomain_yrwdxb$(middle))\n tmp$ = middle;\n else\n tmp$ = 0.0;\n var middle_0 = tmp$;\n var lower = middle_0 / 2;\n var upper = middle_0 === 0.0 ? 10.0 : middle_0 * 2;\n return new ClosedRange(lower, upper);\n };\n function Log10Transform$Companion() {\n Log10Transform$Companion_instance = this;\n this.LOWER_LIM_8be2vx$ = -kotlin_js_internal_DoubleCompanionObject.MAX_VALUE / 10;\n }\n Log10Transform$Companion.prototype.trimInfinity_0 = function (v) {\n var tmp$;\n if (v == null)\n tmp$ = null;\n else if (isNaN_0(v))\n tmp$ = kotlin_js_internal_DoubleCompanionObject.NaN;\n else {\n var a = this.LOWER_LIM_8be2vx$;\n tmp$ = JsMath.max(a, v);\n }\n return tmp$;\n };\n Log10Transform$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Log10Transform$Companion_instance = null;\n function Log10Transform$Companion_getInstance() {\n if (Log10Transform$Companion_instance === null) {\n new Log10Transform$Companion();\n }return Log10Transform$Companion_instance;\n }\n function Log10Transform_init$lambda(v) {\n return JsMath.log10(v);\n }\n function Log10Transform_init$lambda_0(v) {\n return JsMath.pow(10.0, v);\n }\n Log10Transform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Log10Transform',\n interfaces: [FunTransform]\n };\n function NonlinearBreaksGen(transform, formatter) {\n NonlinearBreaksGen$Companion_getInstance();\n if (formatter === void 0)\n formatter = null;\n this.transform_0 = transform;\n this.formatter_0 = formatter;\n }\n NonlinearBreaksGen.prototype.generateBreaks_1tlvto$ = function (domain, targetCount) {\n var tmp$;\n var breakValues = NonlinearBreaksGen$Companion_getInstance().generateBreakValues_0(domain, targetCount, this.transform_0);\n if (this.formatter_0 != null) {\n var size = breakValues.size;\n var list = ArrayList_init_1(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(this.formatter_0);\n }\n tmp$ = list;\n } else {\n tmp$ = NonlinearBreaksGen$Companion_getInstance().createFormatters_0(breakValues);\n }\n var breakFormatters = tmp$;\n var destination = ArrayList_init_1(collectionSizeOrDefault(breakValues, 10));\n var tmp$_0, tmp$_0_0;\n var index_0 = 0;\n tmp$_0 = breakValues.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(breakFormatters.get_za3lpa$(checkIndexOverflow((tmp$_0_0 = index_0, index_0 = tmp$_0_0 + 1 | 0, tmp$_0_0)))(item));\n }\n var labels = destination;\n return new ScaleBreaks(breakValues, breakValues, labels);\n };\n NonlinearBreaksGen.prototype.labelFormatter_1tlvto$ = function (domain, targetCount) {\n var tmp$;\n return (tmp$ = this.formatter_0) != null ? tmp$ : NonlinearBreaksGen$Companion_getInstance().createMultiFormatter_0(NonlinearBreaksGen$Companion_getInstance().generateBreakValues_0(domain, targetCount, this.transform_0));\n };\n function NonlinearBreaksGen$Companion() {\n NonlinearBreaksGen$Companion_instance = this;\n }\n function NonlinearBreaksGen$Companion$generateBreakValues$lambda(closure$transform) {\n return function (it) {\n return closure$transform.apply_yrwdxb$(it);\n };\n }\n NonlinearBreaksGen$Companion.prototype.generateBreakValues_0 = function (domain, targetCount, transform) {\n var transformedDomain = MapperUtil_getInstance().map_rejkqi$(domain, NonlinearBreaksGen$Companion$generateBreakValues$lambda(transform));\n var transformedBreakValues = LinearBreaksGen$Companion_getInstance().generateBreakValues_omwdpb$(transformedDomain, targetCount);\n return filterNotNull(transform.applyInverse_k9kaly$(transformedBreakValues));\n };\n NonlinearBreaksGen$Companion.prototype.createMultiFormatter_0 = function (breakValues) {\n var breakFormatters = this.createFormatters_0(breakValues);\n return getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_za3rmp$(p1);\n }.bind(null, new NonlinearBreaksGen$MultiFormatter(breakValues, breakFormatters)));\n };\n NonlinearBreaksGen$Companion.prototype.createFormatters_0 = function (breakValues) {\n if (breakValues.isEmpty())\n return emptyList();\n if (breakValues.size === 1) {\n var domainValue = breakValues.get_za3lpa$(0);\n var step = domainValue / 10;\n return listOf_0(this.createFormatter_0(domainValue, step));\n }var destination = ArrayList_init_1(collectionSizeOrDefault(breakValues, 10));\n var tmp$, tmp$_0;\n var index = 0;\n tmp$ = breakValues.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_1 = destination.add_11rb$;\n var i = checkIndexOverflow((tmp$_0 = index, index = tmp$_0 + 1 | 0, tmp$_0));\n var tmp$_2;\n if (i === 0)\n tmp$_2 = item - breakValues.get_za3lpa$(i + 1 | 0);\n else\n tmp$_2 = item - breakValues.get_za3lpa$(i - 1 | 0);\n var x = tmp$_2;\n var step_0 = JsMath.abs(x);\n tmp$_1.call(destination, this.createFormatter_0(item, step_0));\n }\n var formatters = destination;\n return formatters;\n };\n NonlinearBreaksGen$Companion.prototype.createFormatter_0 = function (domainValue, step) {\n return getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_za3rmp$(p1);\n }.bind(null, new NumericBreakFormatter(domainValue, step, true)));\n };\n NonlinearBreaksGen$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var NonlinearBreaksGen$Companion_instance = null;\n function NonlinearBreaksGen$Companion_getInstance() {\n if (NonlinearBreaksGen$Companion_instance === null) {\n new NonlinearBreaksGen$Companion();\n }return NonlinearBreaksGen$Companion_instance;\n }\n function NonlinearBreaksGen$MultiFormatter(breakValues, breakFormatters) {\n this.breakValues = breakValues;\n this.breakFormatters = breakFormatters;\n if (!(this.breakValues.size === this.breakFormatters.size)) {\n var message = 'MultiFormatter: breakValues.size=' + this.breakValues.size + ' but breakFormatters.size=' + this.breakFormatters.size;\n throw IllegalStateException_init(message.toString());\n }if (this.breakValues.size > 1) {\n var $receiver = this.breakValues;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$, tmp$_0;\n var index = 0;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_1 = destination.add_11rb$;\n var i = checkIndexOverflow((tmp$_0 = index, index = tmp$_0 + 1 | 0, tmp$_0));\n tmp$_1.call(destination, i === 0 ? 0.0 : item - this.breakValues.get_za3lpa$(i - 1 | 0));\n }\n var all$result;\n all$break: do {\n var tmp$_2;\n if (Kotlin.isType(destination, Collection) && destination.isEmpty()) {\n all$result = true;\n break all$break;\n }tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var element = tmp$_2.next();\n if (!(element >= 0.0)) {\n all$result = false;\n break all$break;\n }}\n all$result = true;\n }\n while (false);\n var ordered = all$result;\n if (!ordered) {\n var message_0 = 'MultiFormatter: values must be sorted in ascending order. Were: ' + this.breakValues + '.';\n throw IllegalStateException_init(message_0.toString());\n }}}\n NonlinearBreaksGen$MultiFormatter.prototype.apply_za3rmp$ = function (v) {\n var tmp$, tmp$_0;\n typeof (tmp$ = v) === 'number' ? tmp$ : throwCCE();\n if (this.breakValues.isEmpty())\n tmp$_0 = v.toString();\n else {\n var i = abs(binarySearch(this.breakValues, v));\n var b = this.breakValues.size - 1 | 0;\n var ii = JsMath.min(i, b);\n tmp$_0 = this.breakFormatters.get_za3lpa$(ii)(v);\n }\n return tmp$_0;\n };\n NonlinearBreaksGen$MultiFormatter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiFormatter',\n interfaces: []\n };\n NonlinearBreaksGen.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NonlinearBreaksGen',\n interfaces: [BreaksGenerator]\n };\n function ReverseTransform() {\n FunTransform.call(this, ReverseTransform_init$lambda, ReverseTransform_init$lambda_0);\n }\n ReverseTransform.prototype.hasDomainLimits = function () {\n return false;\n };\n ReverseTransform.prototype.isInDomain_yrwdxb$ = function (v) {\n return data.SeriesUtil.isFinite_yrwdxb$(v);\n };\n ReverseTransform.prototype.createApplicableDomain_14dthe$ = function (middle) {\n var middle_0 = isFinite(middle) ? middle : 0.0;\n return new ClosedRange(middle_0 - 0.5, middle_0 + 0.5);\n };\n function ReverseTransform_init$lambda(v) {\n return -v;\n }\n function ReverseTransform_init$lambda_0(v) {\n return -v;\n }\n ReverseTransform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ReverseTransform',\n interfaces: [FunTransform]\n };\n function SqrtTransform() {\n FunTransform.call(this, SqrtTransform_init$lambda, SqrtTransform_init$lambda_0);\n }\n SqrtTransform.prototype.hasDomainLimits = function () {\n return true;\n };\n SqrtTransform.prototype.isInDomain_yrwdxb$ = function (v) {\n return data.SeriesUtil.isFinite_yrwdxb$(v) && ensureNotNull(v) >= 0.0;\n };\n SqrtTransform.prototype.createApplicableDomain_14dthe$ = function (middle) {\n var tmp$;\n if (this.isInDomain_yrwdxb$(middle))\n tmp$ = middle;\n else\n tmp$ = 0.0;\n var middle_0 = tmp$;\n var a = middle_0 - 0.5;\n var lower = JsMath.max(a, 0.0);\n return new ClosedRange(lower, lower + 1.0);\n };\n function SqrtTransform_init$lambda(v) {\n return JsMath.sqrt(v);\n }\n function SqrtTransform_init$lambda_0(v) {\n return v * v;\n }\n SqrtTransform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SqrtTransform',\n interfaces: [FunTransform]\n };\n function Transforms() {\n Transforms_instance = this;\n this.IDENTITY = new IdentityTransform();\n this.REVERSE = new ReverseTransform();\n this.SQRT = new SqrtTransform();\n this.LOG10 = new Log10Transform();\n }\n Transforms.prototype.createBreaksGeneratorForTransformedDomain_5x42z5$ = function (transform, labelFormatter) {\n if (labelFormatter === void 0)\n labelFormatter = null;\n var tmp$;\n if (equals(transform, this.IDENTITY))\n tmp$ = new LinearBreaksGen(labelFormatter);\n else if (equals(transform, this.REVERSE))\n tmp$ = new LinearBreaksGen(labelFormatter);\n else if (equals(transform, this.SQRT))\n tmp$ = new NonlinearBreaksGen(this.SQRT, labelFormatter);\n else if (equals(transform, this.LOG10))\n tmp$ = new NonlinearBreaksGen(this.LOG10, labelFormatter);\n else\n throw IllegalStateException_init(\"Unexpected 'transform' type: \" + toString(Kotlin.getKClassFromExpression(transform).simpleName));\n var breaksGenerator = tmp$;\n return new Transforms$BreaksGeneratorForTransformedDomain(transform, breaksGenerator);\n };\n function Transforms$BreaksGeneratorForTransformedDomain(transform, breaksGenerator) {\n this.transform_0 = transform;\n this.breaksGenerator = breaksGenerator;\n }\n function Transforms$BreaksGeneratorForTransformedDomain$labelFormatter$lambda(this$BreaksGeneratorForTransformedDomain) {\n return function (it) {\n return this$BreaksGeneratorForTransformedDomain.transform_0.applyInverse_yrwdxb$(it);\n };\n }\n Transforms$BreaksGeneratorForTransformedDomain.prototype.labelFormatter_1tlvto$ = function (domain, targetCount) {\n var domainBeforeTransform = MapperUtil_getInstance().map_rejkqi$(domain, Transforms$BreaksGeneratorForTransformedDomain$labelFormatter$lambda(this));\n return this.breaksGenerator.labelFormatter_1tlvto$(domainBeforeTransform, targetCount);\n };\n function Transforms$BreaksGeneratorForTransformedDomain$generateBreaks$lambda(this$BreaksGeneratorForTransformedDomain) {\n return function (it) {\n return this$BreaksGeneratorForTransformedDomain.transform_0.applyInverse_yrwdxb$(it);\n };\n }\n Transforms$BreaksGeneratorForTransformedDomain.prototype.generateBreaks_1tlvto$ = function (domain, targetCount) {\n var domainBeforeTransform = MapperUtil_getInstance().map_rejkqi$(domain, Transforms$BreaksGeneratorForTransformedDomain$generateBreaks$lambda(this));\n var scaleBreaks = this.breaksGenerator.generateBreaks_1tlvto$(domainBeforeTransform, targetCount);\n var originalBreaks = scaleBreaks.domainValues;\n var $receiver = this.transform_0.apply_9ma18$(originalBreaks);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_0;\n destination.add_11rb$(typeof (tmp$_0 = item) === 'number' ? tmp$_0 : throwCCE());\n }\n var transformedBreaks = destination;\n return new ScaleBreaks(originalBreaks, transformedBreaks, scaleBreaks.labels);\n };\n Transforms$BreaksGeneratorForTransformedDomain.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BreaksGeneratorForTransformedDomain',\n interfaces: [BreaksGenerator]\n };\n Transforms.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Transforms',\n interfaces: []\n };\n var Transforms_instance = null;\n function Transforms_getInstance() {\n if (Transforms_instance === null) {\n new Transforms();\n }return Transforms_instance;\n }\n function AbstractDensity2dStat(bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth) {\n AbstractDensity2dStat$Companion_getInstance();\n BaseStat.call(this, AbstractDensity2dStat$Companion_getInstance().DEF_MAPPING_0);\n this.bandWidthX_pmqi0t$_0 = bandWidthX;\n this.bandWidthY_pmqi1o$_0 = bandWidthY;\n this.bandWidthMethod_3lcf4y$_0 = bandWidthMethod;\n this.adjust = adjust;\n this.kernel_ba223r$_0 = kernel;\n this.nX = nX;\n this.nY = nY;\n this.isContour = isContour;\n this.binCount_6z2ebo$_0 = binCount;\n this.binWidth_2e8jdx$_0 = binWidth;\n this.kernelFun = DensityStatUtil_getInstance().kernel_uyf859$(this.kernel_ba223r$_0);\n this.binOptions = new BinStatUtil$BinOptions(this.binCount_6z2ebo$_0, this.binWidth_2e8jdx$_0);\n if (!(this.nX <= 999)) {\n var message = 'The input nX = ' + this.nX + ' > ' + '999' + ' is too large!';\n throw IllegalArgumentException_init(message.toString());\n }if (!(this.nY <= 999)) {\n var message_0 = 'The input nY = ' + this.nY + ' > ' + '999' + ' is too large!';\n throw IllegalArgumentException_init(message_0.toString());\n }}\n AbstractDensity2dStat.prototype.getBandWidthX_k9kaly$ = function (xs) {\n var tmp$;\n return (tmp$ = this.bandWidthX_pmqi0t$_0) != null ? tmp$ : DensityStatUtil_getInstance().bandWidth_whucba$(this.bandWidthMethod_3lcf4y$_0, xs);\n };\n AbstractDensity2dStat.prototype.getBandWidthY_k9kaly$ = function (ys) {\n var tmp$;\n return (tmp$ = this.bandWidthY_pmqi1o$_0) != null ? tmp$ : DensityStatUtil_getInstance().bandWidth_whucba$(this.bandWidthMethod_3lcf4y$_0, ys);\n };\n AbstractDensity2dStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().WEIGHT]);\n };\n AbstractDensity2dStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n throw IllegalStateException_init(\"'density2d' statistic can't be executed on the client side\");\n };\n function AbstractDensity2dStat$Companion() {\n AbstractDensity2dStat$Companion_instance = this;\n this.DEF_KERNEL = DensityStat$Kernel$GAUSSIAN_getInstance();\n this.DEF_ADJUST = 1.0;\n this.DEF_N = 100;\n this.DEF_BW = DensityStat$BandWidthMethod$NRD0_getInstance();\n this.DEF_CONTOUR = true;\n this.DEF_BIN_COUNT = 10;\n this.DEF_BIN_WIDTH = 0.0;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y)]);\n this.MAX_N_0 = 999;\n }\n AbstractDensity2dStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AbstractDensity2dStat$Companion_instance = null;\n function AbstractDensity2dStat$Companion_getInstance() {\n if (AbstractDensity2dStat$Companion_instance === null) {\n new AbstractDensity2dStat$Companion();\n }return AbstractDensity2dStat$Companion_instance;\n }\n AbstractDensity2dStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractDensity2dStat',\n interfaces: [BaseStat]\n };\n function BaseStat(defaultMappings) {\n this.defaultMappings_lvkmi1$_0 = defaultMappings;\n }\n BaseStat.prototype.hasDefaultMapping_896ixz$ = function (aes) {\n return this.defaultMappings_lvkmi1$_0.containsKey_11rb$(aes);\n };\n BaseStat.prototype.getDefaultMapping_896ixz$ = function (aes) {\n if (this.defaultMappings_lvkmi1$_0.containsKey_11rb$(aes)) {\n return ensureNotNull(this.defaultMappings_lvkmi1$_0.get_11rb$(aes));\n }throw IllegalArgumentException_init('Stat ' + Kotlin.getKClassFromExpression(this).simpleName + ' has no default mapping for aes: ' + toString(aes));\n };\n BaseStat.prototype.hasRequiredValues_xht41f$ = function (data, aes) {\n var tmp$;\n for (tmp$ = 0; tmp$ !== aes.length; ++tmp$) {\n var requiredAes = aes[tmp$];\n var variable = TransformVar_getInstance().forAes_896ixz$(requiredAes);\n if (data.hasNoOrEmpty_8xm3sj$(variable)) {\n return false;\n }}\n return true;\n };\n BaseStat.prototype.withEmptyStatValues = function () {\n var tmp$;\n var newData = DataFrame$DataFrame$Builder_init();\n tmp$ = Aes$Companion_getInstance().values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n if (this.hasDefaultMapping_896ixz$(aes)) {\n newData.put_2l962d$(this.getDefaultMapping_896ixz$(aes), emptyList());\n }}\n return newData.build();\n };\n BaseStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BaseStat',\n interfaces: [Stat]\n };\n function Bin2dStat(binCountX, binCountY, binWidthX, binWidthY, drop) {\n Bin2dStat$Companion_getInstance();\n if (binCountX === void 0)\n binCountX = 30;\n if (binCountY === void 0)\n binCountY = 30;\n if (binWidthX === void 0)\n binWidthX = Bin2dStat$Companion_getInstance().DEF_BINWIDTH;\n if (binWidthY === void 0)\n binWidthY = Bin2dStat$Companion_getInstance().DEF_BINWIDTH;\n if (drop === void 0)\n drop = Bin2dStat$Companion_getInstance().DEF_DROP;\n BaseStat.call(this, Bin2dStat$Companion_getInstance().DEF_MAPPING_0);\n this.drop_0 = drop;\n this.binOptionsX_0 = new BinStatUtil$BinOptions(binCountX, binWidthX);\n this.binOptionsY_0 = new BinStatUtil$BinOptions(binCountY, binWidthY);\n }\n Bin2dStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().WEIGHT]);\n };\n Bin2dStat.prototype.apply_kdy6bf$$default = function (data_0, statCtx, messageConsumer) {\n if (!this.hasRequiredValues_xht41f$(data_0, [Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y])) {\n return this.withEmptyStatValues();\n }var xRange = statCtx.overallXRange();\n var yRange = statCtx.overallYRange();\n if (xRange == null || yRange == null) {\n return this.withEmptyStatValues();\n }var xRangeInit = Bin2dStat$Companion_getInstance().adjustRangeInitial_0(xRange);\n var yRangeInit = Bin2dStat$Companion_getInstance().adjustRangeInitial_0(yRange);\n var xCountAndWidthInit = BinStatUtil_getInstance().binCountAndWidth_11nzti$(data.SeriesUtil.span_4fzjta$(xRangeInit), this.binOptionsX_0);\n var yCountAndWidthInit = BinStatUtil_getInstance().binCountAndWidth_11nzti$(data.SeriesUtil.span_4fzjta$(yRangeInit), this.binOptionsY_0);\n var xRangeFinal = Bin2dStat$Companion_getInstance().adjustRangeFinal_0(xRange, xCountAndWidthInit.width);\n var yRangeFinal = Bin2dStat$Companion_getInstance().adjustRangeFinal_0(yRange, yCountAndWidthInit.width);\n var xCountAndWidthFinal = BinStatUtil_getInstance().binCountAndWidth_11nzti$(data.SeriesUtil.span_4fzjta$(xRangeFinal), this.binOptionsX_0);\n var yCountAndWidthFinal = BinStatUtil_getInstance().binCountAndWidth_11nzti$(data.SeriesUtil.span_4fzjta$(yRangeFinal), this.binOptionsY_0);\n var countTotal = Kotlin.imul(xCountAndWidthFinal.count, yCountAndWidthFinal.count);\n var densityNormalizingFactor = Bin2dStat$Companion_getInstance().densityNormalizingFactor_0(data.SeriesUtil.span_4fzjta$(xRangeFinal), data.SeriesUtil.span_4fzjta$(yRangeFinal), countTotal);\n var binsData = this.computeBins_0(data_0.getNumeric_8xm3sj$(TransformVar_getInstance().X), data_0.getNumeric_8xm3sj$(TransformVar_getInstance().Y), xRangeFinal.lowerEnd, yRangeFinal.lowerEnd, xCountAndWidthFinal.count, yCountAndWidthFinal.count, xCountAndWidthFinal.width, yCountAndWidthFinal.width, BinStatUtil_getInstance().weightAtIndex_dhhkv7$(data_0), densityNormalizingFactor);\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, binsData.x_8be2vx$).putNumeric_s1rqo9$(Stats_getInstance().Y, binsData.y_8be2vx$).putNumeric_s1rqo9$(Stats_getInstance().COUNT, binsData.count_8be2vx$).putNumeric_s1rqo9$(Stats_getInstance().DENSITY, binsData.density_8be2vx$).build();\n };\n Bin2dStat.prototype.computeBins_0 = function (xValues, yValues, xStart, yStart, binCountX, binCountY, binWidth, binHeight, weightAtIndex, densityNormalizingFactor) {\n var totalCount = 0.0;\n var countByBinIndexKey = HashMap_init();\n for (var dataIndex = 0; dataIndex !== xValues.size; ++dataIndex) {\n var x = xValues.get_za3lpa$(dataIndex);\n var y = yValues.get_za3lpa$(dataIndex);\n if (!data.SeriesUtil.allFinite_jma9l8$(x, y)) {\n continue;\n }var weight = weightAtIndex(dataIndex);\n totalCount += weight;\n var x_0 = (ensureNotNull(x) - xStart) / binWidth;\n var binIndexX = numberToInt(JsMath.floor(x_0));\n var x_1 = (ensureNotNull(y) - yStart) / binHeight;\n var binIndexY = numberToInt(JsMath.floor(x_1));\n var binIndexKey = new Pair_0(binIndexX, binIndexY);\n if (!countByBinIndexKey.containsKey_11rb$(binIndexKey)) {\n var value = new MutableDouble(0.0);\n countByBinIndexKey.put_xwzc9p$(binIndexKey, value);\n }ensureNotNull(countByBinIndexKey.get_11rb$(binIndexKey)).getAndAdd_14dthe$(weight);\n }\n var xs = ArrayList_init();\n var ys = ArrayList_init();\n var counts = ArrayList_init();\n var densities = ArrayList_init();\n var x0 = xStart + binWidth / 2;\n var y0 = yStart + binHeight / 2;\n for (var xIndex = 0; xIndex < binCountX; xIndex++) {\n for (var yIndex = 0; yIndex < binCountY; yIndex++) {\n var binIndexKey_0 = new Pair_0(xIndex, yIndex);\n var count = 0.0;\n if (countByBinIndexKey.containsKey_11rb$(binIndexKey_0)) {\n count = ensureNotNull(countByBinIndexKey.get_11rb$(binIndexKey_0)).get();\n }if (this.drop_0 && count === 0.0) {\n continue;\n }xs.add_11rb$(x0 + xIndex * binWidth);\n ys.add_11rb$(y0 + yIndex * binHeight);\n counts.add_11rb$(count);\n var density = count / totalCount * densityNormalizingFactor;\n densities.add_11rb$(density);\n }\n }\n return new Bin2dStat$Bins2dData(xs, ys, counts, densities);\n };\n function Bin2dStat$Companion() {\n Bin2dStat$Companion_instance = this;\n this.DEF_BINS = 30;\n this.DEF_BINWIDTH = null;\n this.DEF_DROP = true;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y), to(Aes$Companion_getInstance().FILL, Stats_getInstance().COUNT)]);\n }\n Bin2dStat$Companion.prototype.adjustRangeInitial_0 = function (r) {\n return data.SeriesUtil.ensureApplicableRange_4am1sd$(r);\n };\n Bin2dStat$Companion.prototype.adjustRangeFinal_0 = function (r, binWidth) {\n var tmp$;\n if (data.SeriesUtil.isSubTiny_4fzjta$(r)) {\n tmp$ = data.SeriesUtil.expand_wws5xy$(r, 0.5, 0.5);\n } else {\n var exp = binWidth / 2.0;\n tmp$ = data.SeriesUtil.expand_wws5xy$(r, exp, exp);\n }\n return tmp$;\n };\n Bin2dStat$Companion.prototype.densityNormalizingFactor_0 = function (xSpan, ySpan, count) {\n var area = xSpan * ySpan;\n var binArea = area / count;\n return 1.0 / binArea;\n };\n Bin2dStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Bin2dStat$Companion_instance = null;\n function Bin2dStat$Companion_getInstance() {\n if (Bin2dStat$Companion_instance === null) {\n new Bin2dStat$Companion();\n }return Bin2dStat$Companion_instance;\n }\n function Bin2dStat$Bins2dData(x, y, count, density) {\n this.x_8be2vx$ = x;\n this.y_8be2vx$ = y;\n this.count_8be2vx$ = count;\n this.density_8be2vx$ = density;\n }\n Bin2dStat$Bins2dData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Bins2dData',\n interfaces: []\n };\n function Bin2dStat$Bins2dWeightedCounts(total, countByBinXY) {\n this.total_8be2vx$ = total;\n this.countByBinXY_8be2vx$ = countByBinXY;\n }\n Bin2dStat$Bins2dWeightedCounts.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Bins2dWeightedCounts',\n interfaces: []\n };\n Bin2dStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Bin2dStat',\n interfaces: [BaseStat]\n };\n function BinStat(binCount, binWidth, xPosKind, xPos) {\n BinStat$Companion_getInstance();\n BaseStat.call(this, BinStat$Companion_getInstance().DEF_MAPPING_0);\n this.xPosKind_0 = xPosKind;\n this.xPos_0 = xPos;\n this.binOptions_0 = new BinStatUtil$BinOptions(binCount, binWidth);\n }\n BinStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().WEIGHT]);\n };\n BinStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n if (!this.hasRequiredValues_xht41f$(data, [Aes$Companion_getInstance().X])) {\n return this.withEmptyStatValues();\n }var statX = ArrayList_init();\n var statCount = ArrayList_init();\n var statDensity = ArrayList_init();\n var rangeX = statCtx.overallXRange();\n if (rangeX != null) {\n var binsData = this.computeStatSeries_0(data, rangeX, data.getNumeric_8xm3sj$(TransformVar_getInstance().X));\n statX.addAll_brywnq$(binsData.x_8be2vx$);\n statCount.addAll_brywnq$(binsData.count_8be2vx$);\n statDensity.addAll_brywnq$(binsData.density_8be2vx$);\n }return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().COUNT, statCount).putNumeric_s1rqo9$(Stats_getInstance().DENSITY, statDensity).build();\n };\n BinStat.prototype.computeStatSeries_0 = function (data_0, rangeX, valuesX) {\n var startX = rangeX.lowerEnd;\n var spanX = rangeX.upperEnd - ensureNotNull(startX);\n var b = BinStatUtil_getInstance().binCountAndWidth_11nzti$(spanX, this.binOptions_0);\n startX -= b.width * 0.7;\n spanX += b.width * 1.4;\n b = BinStatUtil_getInstance().binCountAndWidth_11nzti$(spanX, this.binOptions_0);\n var binCount = b.count;\n var binWidth = b.width;\n if (this.xPosKind_0 !== BinStat$XPosKind$NONE_getInstance()) {\n var minDelta = kotlin_js_internal_DoubleCompanionObject.MAX_VALUE;\n var x = this.xPos_0;\n for (var i = 0; i < binCount; i++) {\n var binLeft = startX + i * binWidth;\n var delta;\n if (this.xPosKind_0 === BinStat$XPosKind$CENTER_getInstance()) {\n delta = x - (binLeft + binWidth / 2);\n } else {\n if (i === 0) {\n minDelta = x - startX;\n }delta = x - (binLeft + binWidth);\n }\n var x_0 = delta;\n var tmp$ = JsMath.abs(x_0);\n var x_1 = minDelta;\n if (tmp$ < JsMath.abs(x_1)) {\n minDelta = delta;\n }}\n var offset = minDelta % (binWidth / 2);\n startX += offset;\n }var normalBinWidth = data.SeriesUtil.span_4fzjta$(rangeX) / binCount;\n var densityNormalizingFactor = normalBinWidth > 0 ? 1.0 / normalBinWidth : 1.0;\n var binsData = BinStatUtil_getInstance().computeBins_3oz8yg$(valuesX, startX, binCount, binWidth, BinStatUtil_getInstance().weightAtIndex_dhhkv7$(data_0), densityNormalizingFactor);\n if (!(binsData.x_8be2vx$.size === binCount)) {\n var message = 'Internal: stat data size=' + toString(binsData.x_8be2vx$.size) + ' expected bin count=' + toString(binCount);\n throw IllegalStateException_init(message.toString());\n }return binsData;\n };\n function BinStat$XPosKind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function BinStat$XPosKind_initFields() {\n BinStat$XPosKind_initFields = function () {\n };\n BinStat$XPosKind$NONE_instance = new BinStat$XPosKind('NONE', 0);\n BinStat$XPosKind$CENTER_instance = new BinStat$XPosKind('CENTER', 1);\n BinStat$XPosKind$BOUNDARY_instance = new BinStat$XPosKind('BOUNDARY', 2);\n }\n var BinStat$XPosKind$NONE_instance;\n function BinStat$XPosKind$NONE_getInstance() {\n BinStat$XPosKind_initFields();\n return BinStat$XPosKind$NONE_instance;\n }\n var BinStat$XPosKind$CENTER_instance;\n function BinStat$XPosKind$CENTER_getInstance() {\n BinStat$XPosKind_initFields();\n return BinStat$XPosKind$CENTER_instance;\n }\n var BinStat$XPosKind$BOUNDARY_instance;\n function BinStat$XPosKind$BOUNDARY_getInstance() {\n BinStat$XPosKind_initFields();\n return BinStat$XPosKind$BOUNDARY_instance;\n }\n BinStat$XPosKind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'XPosKind',\n interfaces: [Enum]\n };\n function BinStat$XPosKind$values() {\n return [BinStat$XPosKind$NONE_getInstance(), BinStat$XPosKind$CENTER_getInstance(), BinStat$XPosKind$BOUNDARY_getInstance()];\n }\n BinStat$XPosKind.values = BinStat$XPosKind$values;\n function BinStat$XPosKind$valueOf(name) {\n switch (name) {\n case 'NONE':\n return BinStat$XPosKind$NONE_getInstance();\n case 'CENTER':\n return BinStat$XPosKind$CENTER_getInstance();\n case 'BOUNDARY':\n return BinStat$XPosKind$BOUNDARY_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.BinStat.XPosKind.' + name);\n }\n }\n BinStat$XPosKind.valueOf_61zpoe$ = BinStat$XPosKind$valueOf;\n function BinStat$Companion() {\n BinStat$Companion_instance = this;\n this.DEF_BIN_COUNT = 30;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().COUNT)]);\n }\n BinStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BinStat$Companion_instance = null;\n function BinStat$Companion_getInstance() {\n if (BinStat$Companion_instance === null) {\n new BinStat$Companion();\n }return BinStat$Companion_instance;\n }\n BinStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BinStat',\n interfaces: [BaseStat]\n };\n function BinStatUtil() {\n BinStatUtil_instance = this;\n this.MAX_BIN_COUNT_0 = 500;\n }\n function BinStatUtil$weightAtIndex$lambda(closure$weights) {\n return function (index) {\n var weight = closure$weights.get_za3lpa$(index);\n return data.SeriesUtil.asFinite_z03gcz$(weight, 0.0);\n };\n }\n function BinStatUtil$weightAtIndex$lambda_0(it) {\n return 1.0;\n }\n BinStatUtil.prototype.weightAtIndex_dhhkv7$ = function (data) {\n if (data.has_8xm3sj$(TransformVar_getInstance().WEIGHT)) {\n var weights = data.getNumeric_8xm3sj$(TransformVar_getInstance().WEIGHT);\n return BinStatUtil$weightAtIndex$lambda(weights);\n }return BinStatUtil$weightAtIndex$lambda_0;\n };\n BinStatUtil.prototype.weightVector_5m8trb$ = function (dataLength, data) {\n var tmp$;\n if (data.has_8xm3sj$(TransformVar_getInstance().WEIGHT)) {\n tmp$ = data.getNumeric_8xm3sj$(TransformVar_getInstance().WEIGHT);\n } else {\n var list = ArrayList_init_1(dataLength);\n for (var index = 0; index < dataLength; index++) {\n list.add_11rb$(1.0);\n }\n tmp$ = list;\n }\n return tmp$;\n };\n BinStatUtil.prototype.binCountAndWidth_11nzti$ = function (dataRange, binOptions) {\n var binCount = binOptions.binCount;\n var binWidth;\n if (binOptions.hasBinWidth()) {\n binWidth = ensureNotNull(binOptions.binWidth);\n var count = dataRange / binWidth;\n var b = count;\n count = JsMath.min(500, b);\n var x = count;\n binCount = numberToInt(JsMath.ceil(x));\n } else {\n binWidth = dataRange / binCount;\n }\n return new BinStatUtil$CountAndWidth(binCount, binWidth);\n };\n BinStatUtil.prototype.computeBins_3oz8yg$ = function (valuesX, startX, binCount, binWidth, weightAtIndex, densityNormalizingFactor) {\n var totalCount = 0.0;\n var countByBinIndex = HashMap_init();\n for (var dataIndex = 0; dataIndex !== valuesX.size; ++dataIndex) {\n var x = valuesX.get_za3lpa$(dataIndex);\n if (!data.SeriesUtil.isFinite_yrwdxb$(x)) {\n continue;\n }var weight = weightAtIndex(dataIndex);\n totalCount += weight;\n var x_0 = (ensureNotNull(x) - startX) / binWidth;\n var binIndex = numberToInt(JsMath.floor(x_0));\n if (!countByBinIndex.containsKey_11rb$(binIndex)) {\n var value = new MutableDouble(0.0);\n countByBinIndex.put_xwzc9p$(binIndex, value);\n }ensureNotNull(countByBinIndex.get_11rb$(binIndex)).getAndAdd_14dthe$(weight);\n }\n var x_1 = ArrayList_init();\n var counts = ArrayList_init();\n var densities = ArrayList_init();\n var x0 = startX + binWidth / 2;\n for (var i = 0; i < binCount; i++) {\n x_1.add_11rb$(x0 + i * binWidth);\n var count = 0.0;\n if (countByBinIndex.containsKey_11rb$(i)) {\n count = ensureNotNull(countByBinIndex.get_11rb$(i)).get();\n }counts.add_11rb$(count);\n var density = count / totalCount * densityNormalizingFactor;\n densities.add_11rb$(density);\n }\n return new BinStatUtil$BinsData(x_1, counts, densities);\n };\n function BinStatUtil$BinOptions(binCount, binWidth) {\n this.binWidth = binWidth;\n var b = JsMath.max(1, binCount);\n this.binCount = JsMath.min(500, b);\n }\n BinStatUtil$BinOptions.prototype.hasBinWidth = function () {\n return this.binWidth != null && this.binWidth > 0;\n };\n BinStatUtil$BinOptions.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BinOptions',\n interfaces: []\n };\n function BinStatUtil$CountAndWidth(count, width) {\n this.count = count;\n this.width = width;\n }\n BinStatUtil$CountAndWidth.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CountAndWidth',\n interfaces: []\n };\n function BinStatUtil$BinsData(x, count, density) {\n this.x_8be2vx$ = x;\n this.count_8be2vx$ = count;\n this.density_8be2vx$ = density;\n }\n BinStatUtil$BinsData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BinsData',\n interfaces: []\n };\n BinStatUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'BinStatUtil',\n interfaces: []\n };\n var BinStatUtil_instance = null;\n function BinStatUtil_getInstance() {\n if (BinStatUtil_instance === null) {\n new BinStatUtil();\n }return BinStatUtil_instance;\n }\n function BoxplotStat(whiskerIQRRatio, computeWidth) {\n BoxplotStat$Companion_getInstance();\n BaseStat.call(this, BoxplotStat$Companion_getInstance().DEF_MAPPING_0);\n this.whiskerIQRRatio_0 = whiskerIQRRatio;\n this.computeWidth_0 = computeWidth;\n }\n BoxplotStat.prototype.hasDefaultMapping_896ixz$ = function (aes) {\n return BaseStat.prototype.hasDefaultMapping_896ixz$.call(this, aes) || (equals(aes, Aes$Companion_getInstance().WIDTH) && this.computeWidth_0);\n };\n BoxplotStat.prototype.getDefaultMapping_896ixz$ = function (aes) {\n var tmp$;\n if (equals(aes, Aes$Companion_getInstance().WIDTH)) {\n tmp$ = Stats_getInstance().WIDTH;\n } else {\n tmp$ = BaseStat.prototype.getDefaultMapping_896ixz$.call(this, aes);\n }\n return tmp$;\n };\n BoxplotStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y]);\n };\n BoxplotStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (!this.hasRequiredValues_xht41f$(data, [Aes$Companion_getInstance().Y])) {\n return this.withEmptyStatValues();\n }var ys = data.getNumeric_8xm3sj$(TransformVar_getInstance().Y);\n if (data.has_8xm3sj$(TransformVar_getInstance().X)) {\n tmp$ = data.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n } else {\n var size = ys.size;\n var list = ArrayList_init_1(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(0.0);\n }\n tmp$ = list;\n }\n var xs = tmp$;\n var statData = BoxplotStat$Companion_getInstance().buildStat_7jxs1q$(xs, ys, this.whiskerIQRRatio_0);\n var statCount = statData.remove_11rb$(Stats_getInstance().COUNT);\n var maxCountPerBin = (tmp$_1 = (tmp$_0 = statCount != null ? maxOrNull(statCount) : null) != null ? numberToInt(tmp$_0) : null) != null ? tmp$_1 : 0;\n if (maxCountPerBin === 0) {\n return this.withEmptyStatValues();\n }if (this.computeWidth_0) {\n var norm = JsMath.sqrt(maxCountPerBin);\n var $receiver = ensureNotNull(statCount);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_3;\n tmp$_3 = $receiver.iterator();\n while (tmp$_3.hasNext()) {\n var item = tmp$_3.next();\n destination.add_11rb$(JsMath.sqrt(item) / norm);\n }\n var statWidth = destination;\n var key = Stats_getInstance().WIDTH;\n statData.put_xwzc9p$(key, statWidth);\n }var builder = DataFrame$DataFrame$Builder_init();\n tmp$_2 = statData.entries.iterator();\n while (tmp$_2.hasNext()) {\n var tmp$_4 = tmp$_2.next();\n var variable = tmp$_4.key;\n var series = tmp$_4.value;\n builder.putNumeric_s1rqo9$(variable, series);\n }\n return builder.build();\n };\n function BoxplotStat$Companion() {\n BoxplotStat$Companion_instance = this;\n this.DEF_WHISKER_IQR_RATIO = 1.5;\n this.DEF_COMPUTE_WIDTH = false;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y), to(Aes$Companion_getInstance().YMIN, Stats_getInstance().Y_MIN), to(Aes$Companion_getInstance().YMAX, Stats_getInstance().Y_MAX), to(Aes$Companion_getInstance().LOWER, Stats_getInstance().LOWER), to(Aes$Companion_getInstance().MIDDLE, Stats_getInstance().MIDDLE), to(Aes$Companion_getInstance().UPPER, Stats_getInstance().UPPER)]);\n }\n BoxplotStat$Companion.prototype.buildStat_7jxs1q$ = function (xs, ys, whiskerIQRRatio) {\n var tmp$, tmp$_0, tmp$_1;\n var $receiver = zip(xs, ys);\n var destination = ArrayList_init();\n var tmp$_2;\n tmp$_2 = $receiver.iterator();\n while (tmp$_2.hasNext()) {\n var element = tmp$_2.next();\n var x = element.component1()\n , y = element.component2();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y))\n destination.add_11rb$(element);\n }\n var xyPairs = destination;\n if (xyPairs.isEmpty()) {\n return LinkedHashMap_init();\n }var binnedData = HashMap_init();\n tmp$ = xyPairs.iterator();\n while (tmp$.hasNext()) {\n var tmp$_3 = tmp$.next();\n var x_0 = tmp$_3.component1()\n , y_0 = tmp$_3.component2();\n var key = ensureNotNull(x_0);\n var tmp$_4;\n var value = binnedData.get_11rb$(key);\n if (value == null) {\n var answer = ArrayList_init();\n binnedData.put_xwzc9p$(key, answer);\n tmp$_4 = answer;\n } else {\n tmp$_4 = value;\n }\n tmp$_4.add_11rb$(ensureNotNull(y_0));\n }\n var statX = ArrayList_init();\n var statY = ArrayList_init();\n var statMiddle = ArrayList_init();\n var statLower = ArrayList_init();\n var statUpper = ArrayList_init();\n var statMin = ArrayList_init();\n var statMax = ArrayList_init();\n var statCount = ArrayList_init();\n tmp$_0 = binnedData.entries.iterator();\n while (tmp$_0.hasNext()) {\n var tmp$_5 = tmp$_0.next();\n var x_1 = tmp$_5.key;\n var bin = tmp$_5.value;\n var count = bin.size;\n var summary = FiveNumberSummary_init(bin);\n var middle = summary.median;\n var lowerHinge = summary.firstQuartile;\n var upperHinge = summary.thirdQuartile;\n var IQR = upperHinge - lowerHinge;\n var lowerFence = lowerHinge - IQR * whiskerIQRRatio;\n var upperFence = upperHinge + IQR * whiskerIQRRatio;\n var lowerWhisker = lowerFence;\n var upperWhisker = upperFence;\n if (data.SeriesUtil.allFinite_jma9l8$(lowerFence, upperFence)) {\n var destination_0 = ArrayList_init();\n var tmp$_6;\n tmp$_6 = bin.iterator();\n while (tmp$_6.hasNext()) {\n var element_0 = tmp$_6.next();\n if (element_0 >= lowerFence && element_0 <= upperFence)\n destination_0.add_11rb$(element_0);\n }\n var boxed = destination_0;\n var range = data.SeriesUtil.range_l63ks6$(boxed);\n if (range != null) {\n lowerWhisker = range.lowerEnd;\n upperWhisker = range.upperEnd;\n }}var destination_1 = ArrayList_init();\n var tmp$_7;\n tmp$_7 = bin.iterator();\n while (tmp$_7.hasNext()) {\n var element_1 = tmp$_7.next();\n if (element_1 < lowerFence || element_1 > upperFence)\n destination_1.add_11rb$(element_1);\n }\n var outliers = destination_1;\n tmp$_1 = outliers.iterator();\n while (tmp$_1.hasNext()) {\n var y_1 = tmp$_1.next();\n statX.add_11rb$(x_1);\n statY.add_11rb$(y_1);\n statMiddle.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statLower.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statUpper.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statMin.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statMax.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statCount.add_11rb$(count);\n }\n statX.add_11rb$(x_1);\n statY.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statMiddle.add_11rb$(middle);\n statLower.add_11rb$(lowerHinge);\n statUpper.add_11rb$(upperHinge);\n statMin.add_11rb$(lowerWhisker);\n statMax.add_11rb$(upperWhisker);\n statCount.add_11rb$(count);\n }\n return mutableMapOf([to(Stats_getInstance().X, statX), to(Stats_getInstance().Y, statY), to(Stats_getInstance().MIDDLE, statMiddle), to(Stats_getInstance().LOWER, statLower), to(Stats_getInstance().UPPER, statUpper), to(Stats_getInstance().Y_MIN, statMin), to(Stats_getInstance().Y_MAX, statMax), to(Stats_getInstance().COUNT, statCount)]);\n };\n BoxplotStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BoxplotStat$Companion_instance = null;\n function BoxplotStat$Companion_getInstance() {\n if (BoxplotStat$Companion_instance === null) {\n new BoxplotStat$Companion();\n }return BoxplotStat$Companion_instance;\n }\n BoxplotStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BoxplotStat',\n interfaces: [BaseStat]\n };\n function Contour() {\n Contour$Companion_getInstance();\n this.myContourX_0 = ArrayList_init();\n this.myContourY_0 = ArrayList_init();\n this.myContourLevel_0 = ArrayList_init();\n this.myContourGroup_0 = ArrayList_init();\n this.myGroup_0 = 0.0;\n }\n Object.defineProperty(Contour.prototype, 'dataFrame_0', {\n configurable: true,\n get: function () {\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, this.myContourX_0).putNumeric_s1rqo9$(Stats_getInstance().Y, this.myContourY_0).putNumeric_s1rqo9$(Stats_getInstance().LEVEL, this.myContourLevel_0).putNumeric_s1rqo9$(Stats_getInstance().GROUP, this.myContourGroup_0).build();\n }\n });\n Contour.prototype.add_e7h60q$ = function (polygon, fillLevel) {\n var tmp$;\n tmp$ = polygon.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n this.myContourX_0.add_11rb$(p.x);\n this.myContourY_0.add_11rb$(p.y);\n this.myContourLevel_0.add_11rb$(fillLevel);\n this.myContourGroup_0.add_11rb$(this.myGroup_0);\n }\n this.myGroup_0 += 1.0;\n };\n function Contour$Companion() {\n Contour$Companion_instance = this;\n }\n Contour$Companion.prototype.getPathDataFrame_9s3d7f$ = function (levels, pathListByLevel) {\n var tmp$, tmp$_0;\n var contour = new Contour();\n tmp$ = levels.iterator();\n while (tmp$.hasNext()) {\n var level = tmp$.next();\n var paths = ensureNotNull(pathListByLevel.get_11rb$(level));\n tmp$_0 = paths.iterator();\n while (tmp$_0.hasNext()) {\n var path = tmp$_0.next();\n contour.add_e7h60q$(path, level);\n }\n }\n return contour.dataFrame_0;\n };\n Contour$Companion.prototype.getPolygonDataFrame_dnsuee$ = function (fillLevels, polygonListByFillLevel) {\n var tmp$;\n var contour = new Contour();\n tmp$ = fillLevels.iterator();\n while (tmp$.hasNext()) {\n var fillLevel = tmp$.next();\n var polygon = ensureNotNull(polygonListByFillLevel.get_11rb$(fillLevel));\n contour.add_e7h60q$(polygon, fillLevel);\n }\n return contour.dataFrame_0;\n };\n Contour$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Contour$Companion_instance = null;\n function Contour$Companion_getInstance() {\n if (Contour$Companion_instance === null) {\n new Contour$Companion();\n }return Contour$Companion_instance;\n }\n Contour.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Contour',\n interfaces: []\n };\n function ContourFillHelper(xRange, yRange) {\n ContourFillHelper$Companion_getInstance();\n this.myLowLeft_0 = null;\n this.myLowRight_0 = null;\n this.myUpLeft_0 = null;\n this.myUpRight_0 = null;\n var xMin = xRange.lowerEnd;\n var xMax = xRange.upperEnd;\n var yMin = yRange.lowerEnd;\n var yMax = yRange.upperEnd;\n this.myLowLeft_0 = new DoubleVector(xMin, yMin);\n this.myLowRight_0 = new DoubleVector(xMax, yMin);\n this.myUpLeft_0 = new DoubleVector(xMin, yMax);\n this.myUpRight_0 = new DoubleVector(xMax, yMax);\n }\n ContourFillHelper.prototype.createPolygons_lrt0be$ = function (pathByLevels, levels, fillLevels) {\n var tmp$, tmp$_0, tmp$_1;\n var result = HashMap_init();\n var allPaths = ArrayList_init();\n tmp$ = pathByLevels.values.iterator();\n while (tmp$.hasNext()) {\n var level = tmp$.next();\n allPaths.addAll_brywnq$(level);\n }\n var cornerPoints = ArrayList_init();\n var outerMap = this.createOuterMap_0(allPaths, cornerPoints);\n var n = pathByLevels.keys.size;\n tmp$_0 = n + 1 | 0;\n for (var i = 0; i < tmp$_0; i++) {\n var polygonPieces = ArrayList_init();\n var value = ArrayList_init();\n if (i > 0) {\n polygonPieces.addAll_brywnq$(ContourFillHelper$Companion_getInstance().reverseAll_0(ensureNotNull(pathByLevels.get_11rb$(levels.get_za3lpa$(i - 1 | 0)))));\n }if (i < n) {\n polygonPieces.addAll_brywnq$(ensureNotNull(pathByLevels.get_11rb$(levels.get_za3lpa$(i))));\n }polygonPieces = this.createClosedPolygonLevels_0(polygonPieces, outerMap, cornerPoints);\n tmp$_1 = polygonPieces.iterator();\n while (tmp$_1.hasNext()) {\n var path = tmp$_1.next();\n value.addAll_brywnq$(path);\n }\n var key = fillLevels.get_za3lpa$(i);\n result.put_xwzc9p$(key, value);\n }\n return result;\n };\n ContourFillHelper.prototype.createClosedPolygonLevels_0 = function (openLevels, outerMap, cornerPoints) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var result = ArrayList_init();\n var donePath = HashSet_init_1();\n tmp$ = openLevels.iterator();\n while (tmp$.hasNext()) {\n var level = tmp$.next();\n var levelCopy = ArrayList_init_0(level);\n var p0 = levelCopy.get_za3lpa$(0);\n var p1 = levelCopy.get_za3lpa$(levelCopy.size - 1 | 0);\n if (p0 != null ? p0.equals(p1) : null) {\n result.add_11rb$(levelCopy);\n continue;\n }var pi2 = ensureNotNull(outerMap.get_11rb$(p1));\n levelCopy.add_11rb$(pi2);\n p1 = pi2;\n while (cornerPoints.contains_11rb$(p1)) {\n pi2 = ensureNotNull(outerMap.get_11rb$(p1));\n levelCopy.add_11rb$(pi2);\n p1 = pi2;\n }\n donePath.add_11rb$(levelCopy);\n }\n var pathByEndPoint = HashMap_init();\n tmp$_0 = donePath.iterator();\n while (tmp$_0.hasNext()) {\n var path = tmp$_0.next();\n var p0_0 = path.get_za3lpa$(0);\n var p1_0 = path.get_za3lpa$(path.size - 1 | 0);\n if (p0_0 != null ? p0_0.equals(p1_0) : null) {\n result.add_11rb$(path);\n continue;\n }if (pathByEndPoint.containsKey_11rb$(p0_0) || pathByEndPoint.containsKey_11rb$(p1_0)) {\n var path0 = pathByEndPoint.get_11rb$(p0_0);\n var path1 = pathByEndPoint.get_11rb$(p1_0);\n ContourStatUtil_getInstance().removePathByEndpoints_ebaanh$(path0, pathByEndPoint);\n ContourStatUtil_getInstance().removePathByEndpoints_ebaanh$(path1, pathByEndPoint);\n var longPath;\n if (path0 === path1) {\n ensureNotNull(path0).addAll_brywnq$(path.subList_vux9f0$(1, path.size));\n result.add_11rb$(path0);\n continue;\n } else if (path0 != null && path1 != null) {\n longPath = path0;\n longPath.addAll_brywnq$(path.subList_vux9f0$(1, path.size - 1 | 0));\n longPath.addAll_brywnq$(path1);\n } else if (path0 == null) {\n longPath = ensureNotNull(path1);\n longPath.addAll_u57x28$(0, path.subList_vux9f0$(0, path.size - 1 | 0));\n } else {\n longPath = path0;\n longPath.addAll_brywnq$(path.subList_vux9f0$(1, path.size));\n }\n var key = longPath.get_za3lpa$(0);\n var value = longPath;\n pathByEndPoint.put_xwzc9p$(key, value);\n var key_0 = longPath.get_za3lpa$(longPath.size - 1 | 0);\n var value_0 = longPath;\n pathByEndPoint.put_xwzc9p$(key_0, value_0);\n } else {\n var key_1 = path.get_za3lpa$(0);\n pathByEndPoint.put_xwzc9p$(key_1, path);\n var key_2 = path.get_za3lpa$(path.size - 1 | 0);\n pathByEndPoint.put_xwzc9p$(key_2, path);\n }\n }\n if (!pathByEndPoint.keys.isEmpty()) {\n throw IllegalArgumentException_init('Some paths are not cleared yet there is something wrong!' + toString(pathByEndPoint.keys.size));\n }tmp$_1 = result.iterator();\n while (tmp$_1.hasNext()) {\n var path_0 = tmp$_1.next();\n if (!((tmp$_2 = path_0.get_za3lpa$(0)) != null ? tmp$_2.equals(path_0.get_za3lpa$(path_0.size - 1 | 0)) : null)) {\n throw IllegalArgumentException_init('The polygons are not entirely closed!');\n }}\n return result;\n };\n function ContourFillHelper$createOuterMap$lambda(o1, o2) {\n return Kotlin.compareTo(o1.x, o2.x);\n }\n function ContourFillHelper$createOuterMap$lambda_0(o1, o2) {\n return Kotlin.compareTo(o1.y, o2.y);\n }\n function ContourFillHelper$createOuterMap$lambda_1(o1, o2) {\n return Kotlin.compareTo(o2.x, o1.x);\n }\n function ContourFillHelper$createOuterMap$lambda_2(o1, o2) {\n return Kotlin.compareTo(o2.y, o1.y);\n }\n ContourFillHelper.prototype.createOuterMap_0 = function (paths, cornerPoints) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var points = ArrayList_init();\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var path = tmp$.next();\n if (!((tmp$_0 = path.get_za3lpa$(0)) != null ? tmp$_0.equals(path.get_za3lpa$(path.size - 1 | 0)) : null)) {\n points.add_11rb$(path.get_za3lpa$(0));\n points.add_11rb$(path.get_za3lpa$(path.size - 1 | 0));\n }}\n var result = HashMap_init();\n var list = ArrayList_init();\n for (var i = 0; i <= 3; i++) {\n list.add_11rb$(ArrayList_init());\n }\n tmp$_1 = points.iterator();\n while (tmp$_1.hasNext()) {\n var point = tmp$_1.next();\n var kind = this.getKind_0(point);\n switch (kind.name) {\n case 'DOWN':\n list.get_za3lpa$(0).add_11rb$(point);\n break;\n case 'RIGHT':\n list.get_za3lpa$(1).add_11rb$(point);\n break;\n case 'UP':\n list.get_za3lpa$(2).add_11rb$(point);\n break;\n case 'LEFT':\n list.get_za3lpa$(3).add_11rb$(point);\n break;\n default:Kotlin.noWhenBranchMatched();\n break;\n }\n }\n sortWith(list.get_za3lpa$(0), new Comparator(ContourFillHelper$createOuterMap$lambda));\n sortWith(list.get_za3lpa$(1), new Comparator(ContourFillHelper$createOuterMap$lambda_0));\n sortWith(list.get_za3lpa$(2), new Comparator(ContourFillHelper$createOuterMap$lambda_1));\n sortWith(list.get_za3lpa$(3), new Comparator(ContourFillHelper$createOuterMap$lambda_2));\n var prepareMap = ArrayList_init();\n if (!list.get_za3lpa$(0).contains_11rb$(this.myLowLeft_0)) {\n prepareMap.add_11rb$(this.myLowLeft_0);\n cornerPoints.add_11rb$(this.myLowLeft_0);\n }prepareMap.addAll_brywnq$(list.get_za3lpa$(0));\n if (!list.get_za3lpa$(0).contains_11rb$(this.myLowRight_0)) {\n prepareMap.add_11rb$(this.myLowRight_0);\n cornerPoints.add_11rb$(this.myLowRight_0);\n }prepareMap.addAll_brywnq$(list.get_za3lpa$(1));\n if (!list.get_za3lpa$(1).contains_11rb$(this.myUpRight_0)) {\n prepareMap.add_11rb$(this.myUpRight_0);\n cornerPoints.add_11rb$(this.myUpRight_0);\n }prepareMap.addAll_brywnq$(list.get_za3lpa$(2));\n if (!list.get_za3lpa$(3).contains_11rb$(this.myUpLeft_0)) {\n prepareMap.add_11rb$(this.myUpLeft_0);\n cornerPoints.add_11rb$(this.myUpLeft_0);\n }prepareMap.addAll_brywnq$(list.get_za3lpa$(3));\n prepareMap.add_11rb$(prepareMap.get_za3lpa$(0));\n tmp$_2 = prepareMap.size - 1 | 0;\n for (var i_0 = 0; i_0 < tmp$_2; i_0++) {\n var key = prepareMap.get_za3lpa$(i_0);\n var value = prepareMap.get_za3lpa$(i_0 + 1 | 0);\n result.put_xwzc9p$(key, value);\n }\n return result;\n };\n ContourFillHelper.prototype.getKind_0 = function (point) {\n var tmp$;\n if (ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myLowLeft_0, this.myUpRight_0, point) && ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myUpLeft_0, this.myLowRight_0, point)) {\n tmp$ = ContourFillHelper$BorderKind$DOWN_getInstance();\n } else if (ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myLowLeft_0, this.myUpRight_0, point) && !ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myUpLeft_0, this.myLowRight_0, point)) {\n tmp$ = ContourFillHelper$BorderKind$RIGHT_getInstance();\n } else if (!ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myLowLeft_0, this.myUpRight_0, point) && !ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myUpLeft_0, this.myLowRight_0, point)) {\n tmp$ = ContourFillHelper$BorderKind$UP_getInstance();\n } else if (!ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myLowLeft_0, this.myUpRight_0, point) && ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myUpLeft_0, this.myLowRight_0, point)) {\n tmp$ = ContourFillHelper$BorderKind$LEFT_getInstance();\n } else {\n throw IllegalArgumentException_init('The Contour Point is not on the border ' + point);\n }\n return tmp$;\n };\n function ContourFillHelper$BorderKind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ContourFillHelper$BorderKind_initFields() {\n ContourFillHelper$BorderKind_initFields = function () {\n };\n ContourFillHelper$BorderKind$DOWN_instance = new ContourFillHelper$BorderKind('DOWN', 0);\n ContourFillHelper$BorderKind$RIGHT_instance = new ContourFillHelper$BorderKind('RIGHT', 1);\n ContourFillHelper$BorderKind$UP_instance = new ContourFillHelper$BorderKind('UP', 2);\n ContourFillHelper$BorderKind$LEFT_instance = new ContourFillHelper$BorderKind('LEFT', 3);\n }\n var ContourFillHelper$BorderKind$DOWN_instance;\n function ContourFillHelper$BorderKind$DOWN_getInstance() {\n ContourFillHelper$BorderKind_initFields();\n return ContourFillHelper$BorderKind$DOWN_instance;\n }\n var ContourFillHelper$BorderKind$RIGHT_instance;\n function ContourFillHelper$BorderKind$RIGHT_getInstance() {\n ContourFillHelper$BorderKind_initFields();\n return ContourFillHelper$BorderKind$RIGHT_instance;\n }\n var ContourFillHelper$BorderKind$UP_instance;\n function ContourFillHelper$BorderKind$UP_getInstance() {\n ContourFillHelper$BorderKind_initFields();\n return ContourFillHelper$BorderKind$UP_instance;\n }\n var ContourFillHelper$BorderKind$LEFT_instance;\n function ContourFillHelper$BorderKind$LEFT_getInstance() {\n ContourFillHelper$BorderKind_initFields();\n return ContourFillHelper$BorderKind$LEFT_instance;\n }\n ContourFillHelper$BorderKind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BorderKind',\n interfaces: [Enum]\n };\n function ContourFillHelper$BorderKind$values() {\n return [ContourFillHelper$BorderKind$DOWN_getInstance(), ContourFillHelper$BorderKind$RIGHT_getInstance(), ContourFillHelper$BorderKind$UP_getInstance(), ContourFillHelper$BorderKind$LEFT_getInstance()];\n }\n ContourFillHelper$BorderKind.values = ContourFillHelper$BorderKind$values;\n function ContourFillHelper$BorderKind$valueOf(name) {\n switch (name) {\n case 'DOWN':\n return ContourFillHelper$BorderKind$DOWN_getInstance();\n case 'RIGHT':\n return ContourFillHelper$BorderKind$RIGHT_getInstance();\n case 'UP':\n return ContourFillHelper$BorderKind$UP_getInstance();\n case 'LEFT':\n return ContourFillHelper$BorderKind$LEFT_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.ContourFillHelper.BorderKind.' + name);\n }\n }\n ContourFillHelper$BorderKind.valueOf_61zpoe$ = ContourFillHelper$BorderKind$valueOf;\n function ContourFillHelper$Companion() {\n ContourFillHelper$Companion_instance = this;\n }\n ContourFillHelper$Companion.prototype.computeFillLevels_4v6zbb$ = function (zRange, levels) {\n var tmp$;\n var fillLevels = ArrayList_init();\n fillLevels.add_11rb$(zRange.lowerEnd);\n tmp$ = levels.size - 1 | 0;\n for (var i = 0; i < tmp$; i++) {\n fillLevels.add_11rb$((levels.get_za3lpa$(i) + levels.get_za3lpa$(i + 1 | 0)) / 2.0);\n }\n fillLevels.add_11rb$(zRange.upperEnd);\n return fillLevels;\n };\n ContourFillHelper$Companion.prototype.reverseAll_0 = function (list) {\n var tmp$;\n var result = ArrayList_init();\n tmp$ = list.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var copy = ArrayList_init_0(item);\n reverse(copy);\n result.add_11rb$(copy);\n }\n return result;\n };\n ContourFillHelper$Companion.prototype.belowOrOnLine_0 = function (a, b, test) {\n var value = test.subtract_gpjtzr$(a);\n var standard = b.subtract_gpjtzr$(a);\n return standard.y * value.x - value.y * standard.x >= 0;\n };\n ContourFillHelper$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContourFillHelper$Companion_instance = null;\n function ContourFillHelper$Companion_getInstance() {\n if (ContourFillHelper$Companion_instance === null) {\n new ContourFillHelper$Companion();\n }return ContourFillHelper$Companion_instance;\n }\n ContourFillHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContourFillHelper',\n interfaces: []\n };\n function ContourStat(binCount, binWidth) {\n ContourStat$Companion_getInstance();\n BaseStat.call(this, ContourStat$Companion_getInstance().DEF_MAPPING_0);\n this.myBinOptions_0 = new BinStatUtil$BinOptions(binCount, binWidth);\n }\n ContourStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().Z]);\n };\n ContourStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n var tmp$;\n if (!this.hasRequiredValues_xht41f$(data, [Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().Z])) {\n return this.withEmptyStatValues();\n }tmp$ = ContourStatUtil_getInstance().computeLevels_wuiwgl$(data, this.myBinOptions_0);\n if (tmp$ == null) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }var levels = tmp$;\n var pathListByLevel = ContourStatUtil_getInstance().computeContours_jco5dt$(data, levels);\n return Contour$Companion_getInstance().getPathDataFrame_9s3d7f$(levels, pathListByLevel);\n };\n function ContourStat$Companion() {\n ContourStat$Companion_instance = this;\n this.DEF_BIN_COUNT = 10;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y)]);\n }\n ContourStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContourStat$Companion_instance = null;\n function ContourStat$Companion_getInstance() {\n if (ContourStat$Companion_instance === null) {\n new ContourStat$Companion();\n }return ContourStat$Companion_instance;\n }\n ContourStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContourStat',\n interfaces: [BaseStat]\n };\n function ContourStatUtil() {\n ContourStatUtil_instance = this;\n this.xLoc_0 = new Float64Array([0.0, 1.0, 1.0, 0.0, 0.5]);\n this.yLoc_0 = new Float64Array([0.0, 0.0, 1.0, 1.0, 0.5]);\n }\n ContourStatUtil.prototype.estimateRegularGridShape_fsp013$ = function (xs) {\n var tmp$;\n var colCount = 0;\n var x0 = null;\n tmp$ = xs.iterator();\n while (tmp$.hasNext()) {\n var x = tmp$.next();\n if (x0 == null) {\n x0 = x;\n } else if (x == x0) {\n break;\n }colCount = colCount + 1 | 0;\n }\n if (colCount <= 1) {\n throw IllegalArgumentException_init('Data grid must be at least 2 columns wide (was ' + colCount + ')');\n }var rowCount = xs.size / colCount | 0;\n if (rowCount <= 1) {\n throw IllegalArgumentException_init('Data grid must be at least 2 rows tall (was ' + rowCount + ')');\n }return new Pair(colCount, rowCount);\n };\n ContourStatUtil.prototype.computeLevels_wuiwgl$ = function (data, binOptions) {\n if (!(data.has_8xm3sj$(TransformVar_getInstance().X) && data.has_8xm3sj$(TransformVar_getInstance().Y) && data.has_8xm3sj$(TransformVar_getInstance().Z))) {\n return null;\n }var zRange = data.range_8xm3sj$(TransformVar_getInstance().Z);\n return this.computeLevels_kgz263$(zRange, binOptions);\n };\n ContourStatUtil.prototype.computeLevels_kgz263$ = function (zRange, binOptions) {\n var tmp$;\n if (zRange == null || data.SeriesUtil.isSubTiny_4fzjta$(zRange))\n return null;\n var b = BinStatUtil_getInstance().binCountAndWidth_11nzti$(data.SeriesUtil.span_4fzjta$(zRange), binOptions);\n var levels = ArrayList_init();\n tmp$ = b.count;\n for (var i = 0; i < tmp$; i++) {\n var level = i * b.width + zRange.lowerEnd;\n level += b.width / 2;\n levels.add_11rb$(level);\n }\n return levels;\n };\n ContourStatUtil.prototype.computeContours_jco5dt$ = function (data, levels) {\n var xVector = data.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n var zVector = data.getNumeric_8xm3sj$(TransformVar_getInstance().Z);\n var shape = this.estimateRegularGridShape_fsp013$(xVector);\n var colCount = shape.first;\n var rowCount = shape.second;\n var xRange = ensureNotNull(data.range_8xm3sj$(TransformVar_getInstance().X));\n var yRange = ensureNotNull(data.range_8xm3sj$(TransformVar_getInstance().Y));\n return this.computeContours_cxleoh$(xRange, yRange, colCount, rowCount, zVector, levels);\n };\n ContourStatUtil.prototype.computeContours_cxleoh$ = function (xRange, yRange, colCount, rowCount, data_0, levels) {\n var tmp$;\n var xStep = data.SeriesUtil.span_4fzjta$(xRange) / (colCount - 1 | 0);\n var yStep = data.SeriesUtil.span_4fzjta$(yRange) / (rowCount - 1 | 0);\n var origin = new DoubleVector(xRange.lowerEnd, yRange.lowerEnd);\n var pathListByLevel = HashMap_init();\n tmp$ = levels.iterator();\n while (tmp$.hasNext()) {\n var level = tmp$.next();\n var levelSegments = this.computeSegments_0(colCount, rowCount, data_0, level);\n var paths = this.joinSegments_0(levelSegments);\n var pathsReal = this.convertPaths_0(paths, xStep, yStep, origin, level);\n pathsReal = this.confirmPaths_0(pathsReal);\n var value = pathsReal;\n pathListByLevel.put_xwzc9p$(level, value);\n }\n return pathListByLevel;\n };\n ContourStatUtil.prototype.joinSegments_0 = function (segments) {\n var tmp$, tmp$_0;\n var pathList = ArrayList_init();\n var pathByEndPoint = HashMap_init();\n tmp$ = segments.iterator();\n while (tmp$.hasNext()) {\n var segment = tmp$.next();\n var p0 = segment.first;\n var p1 = segment.second;\n if (pathByEndPoint.containsKey_11rb$(p0) || pathByEndPoint.containsKey_11rb$(p1)) {\n var path0 = pathByEndPoint.get_11rb$(p0);\n var path1 = pathByEndPoint.get_11rb$(p1);\n if (path0 != null) {\n pathByEndPoint.remove_11rb$(path0.get_za3lpa$(0));\n pathByEndPoint.remove_11rb$(path0.get_za3lpa$(path0.size - 1 | 0));\n }if (path1 != null) {\n pathByEndPoint.remove_11rb$(path1.get_za3lpa$(0));\n pathByEndPoint.remove_11rb$(path1.get_za3lpa$(path1.size - 1 | 0));\n }var longPath;\n if (path0 === path1) {\n ensureNotNull(path0).add_11rb$(segment.second);\n pathList.add_11rb$(path0);\n continue;\n } else if (path0 != null && path1 != null) {\n longPath = path0;\n longPath.addAll_brywnq$(path1);\n } else if (path0 == null) {\n longPath = ensureNotNull(path1);\n longPath.add_wxm5ur$(0, segment.first);\n } else {\n longPath = path0;\n longPath.add_11rb$(segment.second);\n }\n var key = longPath.get_za3lpa$(0);\n var value = longPath;\n pathByEndPoint.put_xwzc9p$(key, value);\n var key_0 = longPath.get_za3lpa$(longPath.size - 1 | 0);\n var value_0 = longPath;\n pathByEndPoint.put_xwzc9p$(key_0, value_0);\n } else {\n var path = ArrayList_init();\n path.add_11rb$(segment.first);\n path.add_11rb$(segment.second);\n var key_1 = segment.first;\n pathByEndPoint.put_xwzc9p$(key_1, path);\n var key_2 = segment.second;\n pathByEndPoint.put_xwzc9p$(key_2, path);\n }\n }\n var pathSet = HashSet_init(pathByEndPoint.values);\n tmp$_0 = pathSet.iterator();\n while (tmp$_0.hasNext()) {\n var path_0 = tmp$_0.next();\n pathList.add_11rb$(path_0);\n }\n return pathList;\n };\n ContourStatUtil.prototype.convertPaths_0 = function (paths, xStep, yStep, origin, level) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var result = ArrayList_init();\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var path = tmp$.next();\n var temp = ArrayList_init();\n var lastPoint = null;\n tmp$_0 = path.iterator();\n while (tmp$_0.hasNext()) {\n var edge = tmp$_0.next();\n var intersect = edge.intersect_14dthe$(ensureNotNull(level));\n intersect = (new DoubleVector(xStep * intersect.x, yStep * intersect.y)).add_gpjtzr$(origin);\n if (equals(intersect, lastPoint)) {\n continue;\n }temp.add_11rb$(intersect);\n lastPoint = intersect;\n }\n if (((tmp$_1 = path.get_za3lpa$(0)) != null ? tmp$_1.equals(path.get_za3lpa$(path.size - 1 | 0)) : null) && !((tmp$_2 = temp.get_za3lpa$(0)) != null ? tmp$_2.equals(temp.get_za3lpa$(temp.size - 1 | 0)) : null)) {\n temp.set_wxm5ur$(temp.size - 1 | 0, temp.get_za3lpa$(0));\n }if (temp.size > 1) {\n result.add_11rb$(temp);\n }}\n return result;\n };\n ContourStatUtil.prototype.confirmPaths_0 = function (paths) {\n var tmp$, tmp$_0, tmp$_1;\n var newPaths = ArrayList_init();\n var pathByEndPoint = HashMap_init();\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var path = tmp$.next();\n var p0 = path.get_za3lpa$(0);\n var p1 = path.get_za3lpa$(path.size - 1 | 0);\n if (p0 != null ? p0.equals(p1) : null) {\n newPaths.add_11rb$(path);\n continue;\n }if (pathByEndPoint.containsKey_11rb$(p0) || pathByEndPoint.containsKey_11rb$(p1)) {\n var path0 = pathByEndPoint.get_11rb$(p0);\n var path1 = pathByEndPoint.get_11rb$(p1);\n this.removePathByEndpoints_ebaanh$(path0, pathByEndPoint);\n this.removePathByEndpoints_ebaanh$(path1, pathByEndPoint);\n var longPath = ArrayList_init();\n if (path0 === path1) {\n longPath.addAll_brywnq$(ensureNotNull(path0));\n longPath.addAll_brywnq$(path.subList_vux9f0$(1, path.size));\n newPaths.add_11rb$(longPath);\n continue;\n } else if (path0 != null && path1 != null) {\n longPath.addAll_brywnq$(path0);\n longPath.addAll_brywnq$(path.subList_vux9f0$(1, path.size - 1 | 0));\n longPath.addAll_brywnq$(path1);\n } else if (path0 == null) {\n longPath.addAll_brywnq$(ensureNotNull(path1));\n longPath.addAll_u57x28$(0, path.subList_vux9f0$(0, path.size - 1 | 0));\n } else {\n longPath.addAll_brywnq$(path0);\n longPath.addAll_brywnq$(path.subList_vux9f0$(1, path.size));\n }\n var key = longPath.get_za3lpa$(0);\n pathByEndPoint.put_xwzc9p$(key, longPath);\n var key_0 = longPath.get_za3lpa$(longPath.size - 1 | 0);\n pathByEndPoint.put_xwzc9p$(key_0, longPath);\n } else {\n var key_1 = path.get_za3lpa$(0);\n pathByEndPoint.put_xwzc9p$(key_1, path);\n var key_2 = path.get_za3lpa$(path.size - 1 | 0);\n pathByEndPoint.put_xwzc9p$(key_2, path);\n }\n }\n var pathSet = HashSet_init(pathByEndPoint.values);\n tmp$_0 = pathSet.iterator();\n while (tmp$_0.hasNext()) {\n var path_0 = tmp$_0.next();\n newPaths.add_11rb$(path_0);\n }\n var result = ArrayList_init();\n tmp$_1 = newPaths.iterator();\n while (tmp$_1.hasNext()) {\n var path_1 = tmp$_1.next();\n result.addAll_brywnq$(this.pathSeparator_0(path_1));\n }\n return result;\n };\n ContourStatUtil.prototype.removePathByEndpoints_ebaanh$ = function (path, pathByEndPoint) {\n if (path != null) {\n pathByEndPoint.remove_11rb$(path.get_za3lpa$(0));\n pathByEndPoint.remove_11rb$(path.get_za3lpa$(path.size - 1 | 0));\n }};\n ContourStatUtil.prototype.pathSeparator_0 = function (path) {\n var tmp$, tmp$_0;\n var result = ArrayList_init();\n var startIndex = 0;\n tmp$ = path.size - 1 | 0;\n for (var nextIndex = 1; nextIndex < tmp$; nextIndex++) {\n if ((tmp$_0 = path.get_za3lpa$(startIndex)) != null ? tmp$_0.equals(path.get_za3lpa$(nextIndex)) : null) {\n result.add_11rb$(path.subList_vux9f0$(startIndex, nextIndex + 1 | 0));\n startIndex = nextIndex;\n }}\n if (startIndex === 0) {\n return listOf_0(path);\n } else {\n result.add_11rb$(path.subList_vux9f0$(startIndex, path.size));\n return result;\n }\n };\n ContourStatUtil.prototype.computeSegments_0 = function (colCount, rowCount, data, level) {\n var tmp$, tmp$_0;\n var segments = ArrayList_init();\n tmp$ = rowCount - 1 | 0;\n for (var row = 0; row < tmp$; row++) {\n tmp$_0 = colCount - 1 | 0;\n for (var col = 0; col < tmp$_0; col++) {\n var i0 = Kotlin.imul(row, colCount) + col | 0;\n var i1 = Kotlin.imul(row, colCount) + col + 1 | 0;\n var i2 = Kotlin.imul(row + 1 | 0, colCount) + col + 1 | 0;\n var i3 = Kotlin.imul(row + 1 | 0, colCount) + col | 0;\n var v = new Float64Array(5);\n v[0] = ensureNotNull(data.get_za3lpa$(i0));\n v[1] = ensureNotNull(data.get_za3lpa$(i1));\n v[2] = ensureNotNull(data.get_za3lpa$(i2));\n v[3] = ensureNotNull(data.get_za3lpa$(i3));\n var min = v[0];\n var max = v[0];\n for (var i = 1; i <= 3; i++) {\n var a = min;\n var b = v[i];\n min = JsMath.min(a, b);\n var a_0 = max;\n var b_0 = v[i];\n max = JsMath.max(a_0, b_0);\n }\n if (min === max) {\n continue;\n }v[4] = (v[0] + v[1] + v[2] + v[3] - min - max) / 2;\n if (level > min && level <= max) {\n var cellSegments = this.computeSegmentsForGridCell_0(level, v, col, row);\n segments.addAll_brywnq$(cellSegments);\n }}\n }\n return segments;\n };\n ContourStatUtil.prototype.computeSegmentsForGridCell_0 = function (level, value5, col, row) {\n var result = ArrayList_init();\n var points = ArrayList_init();\n var tempVector;\n for (var i = 0; i <= 4; i++) {\n points.add_11rb$(new ContourStatUtil$TripleVector(col + this.xLoc_0[i], row + this.yLoc_0[i], value5[i]));\n }\n for (var i_0 = 0; i_0 <= 3; i_0++) {\n var i1 = (i_0 + 1 | 0) % 4;\n tempVector = ArrayList_init();\n tempVector.add_11rb$(points.get_za3lpa$(i_0));\n tempVector.add_11rb$(points.get_za3lpa$(i1));\n tempVector.add_11rb$(points.get_za3lpa$(4));\n var temp = this.intersectionSegment_0(tempVector, level);\n if (temp != null) {\n result.add_11rb$(temp);\n }}\n return result;\n };\n ContourStatUtil.prototype.intersectionSegment_0 = function (vectors, level) {\n var type = (vectors.get_za3lpa$(0).getType_14dthe$(ensureNotNull(level)) * 100 | 0) + (vectors.get_za3lpa$(1).getType_14dthe$(level) * 10 | 0) + vectors.get_za3lpa$(2).getType_14dthe$(level) | 0;\n var start;\n var end;\n switch (type) {\n case 100:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(2), vectors.get_za3lpa$(0));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(0), vectors.get_za3lpa$(1));\n break;\n case 10:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(0), vectors.get_za3lpa$(1));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(1), vectors.get_za3lpa$(2));\n break;\n case 1:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(1), vectors.get_za3lpa$(2));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(2), vectors.get_za3lpa$(0));\n break;\n case 110:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(0), vectors.get_za3lpa$(2));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(2), vectors.get_za3lpa$(1));\n break;\n case 101:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(2), vectors.get_za3lpa$(1));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(1), vectors.get_za3lpa$(0));\n break;\n case 11:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(1), vectors.get_za3lpa$(0));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(0), vectors.get_za3lpa$(2));\n break;\n default:return null;\n }\n return new Pair(start, end);\n };\n ContourStatUtil.prototype.checkEdges_0 = function (paths, colCount, rowCount) {\n var tmp$, tmp$_0;\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var path = tmp$.next();\n if (!((tmp$_0 = path.get_za3lpa$(0)) != null ? tmp$_0.equals(path.get_za3lpa$(path.size - 1 | 0)) : null)) {\n this.checkEdge_0(path.get_za3lpa$(0), colCount, rowCount);\n this.checkEdge_0(path.get_za3lpa$(path.size - 1 | 0), colCount, rowCount);\n }}\n };\n ContourStatUtil.prototype.checkEdge_0 = function (edge, colCount, rowCount) {\n var a = edge.myA;\n var b = edge.myB;\n if (a.myX === 0 && b.myX === 0) {\n return;\n }if (a.myY === 0 && b.myY === 0) {\n return;\n }if (a.myX === (colCount - 1 | 0) && b.myX === (colCount - 1 | 0)) {\n return;\n }if (a.myY === (rowCount - 1 | 0) && b.myY === (rowCount - 1 | 0)) {\n return;\n }throw IllegalArgumentException_init('Check Edge Failed');\n };\n function ContourStatUtil$TripleVector(x, y, z) {\n this.z = z;\n this.myX = 0;\n this.myY = 0;\n this.myIsCenter_0 = 0;\n this.myX = numberToInt(x);\n this.myY = numberToInt(y);\n this.myIsCenter_0 = x % 1 === 0.0 ? 0 : 1;\n }\n Object.defineProperty(ContourStatUtil$TripleVector.prototype, 'coord', {\n configurable: true,\n get: function () {\n return new DoubleVector(this.x, this.y);\n }\n });\n Object.defineProperty(ContourStatUtil$TripleVector.prototype, 'x', {\n configurable: true,\n get: function () {\n return this.myX + 0.5 * this.myIsCenter_0;\n }\n });\n Object.defineProperty(ContourStatUtil$TripleVector.prototype, 'y', {\n configurable: true,\n get: function () {\n return this.myY + 0.5 * this.myIsCenter_0;\n }\n });\n ContourStatUtil$TripleVector.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n var that = (tmp$_0 = other) == null || Kotlin.isType(tmp$_0, ContourStatUtil$TripleVector) ? tmp$_0 : throwCCE();\n return this.myX === ensureNotNull(that).myX && this.myY === that.myY && this.myIsCenter_0 === that.myIsCenter_0;\n };\n ContourStatUtil$TripleVector.prototype.hashCode = function () {\n return hashCode([this.myX, this.myY, this.myIsCenter_0]);\n };\n ContourStatUtil$TripleVector.prototype.getType_14dthe$ = function (level) {\n var tmp$;\n if (this.z >= level) {\n tmp$ = 1;\n } else {\n tmp$ = 0;\n }\n return tmp$;\n };\n ContourStatUtil$TripleVector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TripleVector',\n interfaces: []\n };\n function ContourStatUtil$Edge(myA, myB) {\n this.myA = myA;\n this.myB = myB;\n }\n ContourStatUtil$Edge.prototype.equals = function (other) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3;\n if (!Kotlin.isType(other, ContourStatUtil$Edge)) {\n return false;\n }var obj = (tmp$ = other) == null || Kotlin.isType(tmp$, ContourStatUtil$Edge) ? tmp$ : throwCCE();\n return ((tmp$_0 = this.myA) != null ? tmp$_0.equals(ensureNotNull(obj).myA) : null) && ((tmp$_1 = this.myB) != null ? tmp$_1.equals(obj.myB) : null) || (((tmp$_2 = this.myA) != null ? tmp$_2.equals(obj.myB) : null) && ((tmp$_3 = this.myB) != null ? tmp$_3.equals(obj.myA) : null));\n };\n ContourStatUtil$Edge.prototype.hashCode = function () {\n return this.myA.coord.hashCode() + this.myB.coord.hashCode() | 0;\n };\n ContourStatUtil$Edge.prototype.intersect_14dthe$ = function (level) {\n var z0 = this.myA.z;\n var z1 = this.myB.z;\n if (level === z0) {\n return this.myA.coord;\n }if (level === z1) {\n return this.myB.coord;\n }var ratio = (z1 - z0) / (level - z0);\n var x0 = this.myA.x;\n var y0 = this.myA.y;\n var x1 = this.myB.x;\n var y1 = this.myB.y;\n var x = x0 + (x1 - x0) / ratio;\n var y = y0 + (y1 - y0) / ratio;\n return new DoubleVector(x, y);\n };\n ContourStatUtil$Edge.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Edge',\n interfaces: []\n };\n ContourStatUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ContourStatUtil',\n interfaces: []\n };\n var ContourStatUtil_instance = null;\n function ContourStatUtil_getInstance() {\n if (ContourStatUtil_instance === null) {\n new ContourStatUtil();\n }return ContourStatUtil_instance;\n }\n function ContourfStat(binCount, binWidth) {\n ContourfStat$Companion_getInstance();\n BaseStat.call(this, ContourfStat$Companion_getInstance().DEF_MAPPING_0);\n this.myBinOptions_0 = new BinStatUtil$BinOptions(binCount, binWidth);\n }\n ContourfStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().Z]);\n };\n ContourfStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n var tmp$;\n if (!this.hasRequiredValues_xht41f$(data, [Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().Z])) {\n return this.withEmptyStatValues();\n }tmp$ = ContourStatUtil_getInstance().computeLevels_wuiwgl$(data, this.myBinOptions_0);\n if (tmp$ == null) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }var levels = tmp$;\n var pathListByLevel = ContourStatUtil_getInstance().computeContours_jco5dt$(data, levels);\n var xRange = ensureNotNull(data.range_8xm3sj$(TransformVar_getInstance().X));\n var yRange = ensureNotNull(data.range_8xm3sj$(TransformVar_getInstance().Y));\n var zRange = ensureNotNull(data.range_8xm3sj$(TransformVar_getInstance().Z));\n var helper = new ContourFillHelper(xRange, yRange);\n var fillLevels = ContourFillHelper$Companion_getInstance().computeFillLevels_4v6zbb$(zRange, levels);\n var polygonListByFillLevel = helper.createPolygons_lrt0be$(pathListByLevel, levels, fillLevels);\n return Contour$Companion_getInstance().getPolygonDataFrame_dnsuee$(fillLevels, polygonListByFillLevel);\n };\n function ContourfStat$Companion() {\n ContourfStat$Companion_instance = this;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y)]);\n }\n ContourfStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContourfStat$Companion_instance = null;\n function ContourfStat$Companion_getInstance() {\n if (ContourfStat$Companion_instance === null) {\n new ContourfStat$Companion();\n }return ContourfStat$Companion_instance;\n }\n ContourfStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContourfStat',\n interfaces: [BaseStat]\n };\n function CorrelationStat(correlationMethod, type, fillDiagonal, threshold) {\n CorrelationStat$Companion_getInstance();\n BaseStat.call(this, CorrelationStat$Companion_getInstance().DEF_MAPPING_0);\n this.correlationMethod = correlationMethod;\n this.type = type;\n this.fillDiagonal = fillDiagonal;\n this.threshold = threshold;\n }\n CorrelationStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n if (!(this.correlationMethod === CorrelationStat$Method$PEARSON_getInstance())) {\n var message = 'Unsupported correlation method: ' + this.correlationMethod + ' (only Pearson is currently available)';\n throw IllegalArgumentException_init(message.toString());\n }if (!rangeTo(0.0, 1.0).contains_mef7kx$(this.threshold)) {\n var message_0 = 'Threshold value: ' + this.threshold + ' must be in interval [0.0, 1.0]';\n throw IllegalArgumentException_init(message_0.toString());\n }var cm = CorrelationUtil_getInstance().correlationMatrix_ofg6u8$(data, this.type, this.fillDiagonal, getCallableRef('correlationPearson', function (p1, p2) {\n return correlationPearson(p1, p2);\n }), this.threshold);\n var values = cm.getNumeric_8xm3sj$(Stats_getInstance().CORR);\n var destination = ArrayList_init_1(collectionSizeOrDefault(values, 10));\n var tmp$;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(item != null ? JsMath.abs(item) : null);\n }\n var abs = destination;\n return cm.builder().putNumeric_s1rqo9$(Stats_getInstance().CORR_ABS, abs).build();\n };\n CorrelationStat.prototype.consumes = function () {\n return emptyList();\n };\n function CorrelationStat$Method(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function CorrelationStat$Method_initFields() {\n CorrelationStat$Method_initFields = function () {\n };\n CorrelationStat$Method$PEARSON_instance = new CorrelationStat$Method('PEARSON', 0);\n CorrelationStat$Method$SPEARMAN_instance = new CorrelationStat$Method('SPEARMAN', 1);\n CorrelationStat$Method$KENDALL_instance = new CorrelationStat$Method('KENDALL', 2);\n }\n var CorrelationStat$Method$PEARSON_instance;\n function CorrelationStat$Method$PEARSON_getInstance() {\n CorrelationStat$Method_initFields();\n return CorrelationStat$Method$PEARSON_instance;\n }\n var CorrelationStat$Method$SPEARMAN_instance;\n function CorrelationStat$Method$SPEARMAN_getInstance() {\n CorrelationStat$Method_initFields();\n return CorrelationStat$Method$SPEARMAN_instance;\n }\n var CorrelationStat$Method$KENDALL_instance;\n function CorrelationStat$Method$KENDALL_getInstance() {\n CorrelationStat$Method_initFields();\n return CorrelationStat$Method$KENDALL_instance;\n }\n CorrelationStat$Method.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Method',\n interfaces: [Enum]\n };\n function CorrelationStat$Method$values() {\n return [CorrelationStat$Method$PEARSON_getInstance(), CorrelationStat$Method$SPEARMAN_getInstance(), CorrelationStat$Method$KENDALL_getInstance()];\n }\n CorrelationStat$Method.values = CorrelationStat$Method$values;\n function CorrelationStat$Method$valueOf(name) {\n switch (name) {\n case 'PEARSON':\n return CorrelationStat$Method$PEARSON_getInstance();\n case 'SPEARMAN':\n return CorrelationStat$Method$SPEARMAN_getInstance();\n case 'KENDALL':\n return CorrelationStat$Method$KENDALL_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.CorrelationStat.Method.' + name);\n }\n }\n CorrelationStat$Method.valueOf_61zpoe$ = CorrelationStat$Method$valueOf;\n function CorrelationStat$Type(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function CorrelationStat$Type_initFields() {\n CorrelationStat$Type_initFields = function () {\n };\n CorrelationStat$Type$FULL_instance = new CorrelationStat$Type('FULL', 0);\n CorrelationStat$Type$UPPER_instance = new CorrelationStat$Type('UPPER', 1);\n CorrelationStat$Type$LOWER_instance = new CorrelationStat$Type('LOWER', 2);\n }\n var CorrelationStat$Type$FULL_instance;\n function CorrelationStat$Type$FULL_getInstance() {\n CorrelationStat$Type_initFields();\n return CorrelationStat$Type$FULL_instance;\n }\n var CorrelationStat$Type$UPPER_instance;\n function CorrelationStat$Type$UPPER_getInstance() {\n CorrelationStat$Type_initFields();\n return CorrelationStat$Type$UPPER_instance;\n }\n var CorrelationStat$Type$LOWER_instance;\n function CorrelationStat$Type$LOWER_getInstance() {\n CorrelationStat$Type_initFields();\n return CorrelationStat$Type$LOWER_instance;\n }\n CorrelationStat$Type.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Type',\n interfaces: [Enum]\n };\n function CorrelationStat$Type$values() {\n return [CorrelationStat$Type$FULL_getInstance(), CorrelationStat$Type$UPPER_getInstance(), CorrelationStat$Type$LOWER_getInstance()];\n }\n CorrelationStat$Type.values = CorrelationStat$Type$values;\n function CorrelationStat$Type$valueOf(name) {\n switch (name) {\n case 'FULL':\n return CorrelationStat$Type$FULL_getInstance();\n case 'UPPER':\n return CorrelationStat$Type$UPPER_getInstance();\n case 'LOWER':\n return CorrelationStat$Type$LOWER_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.CorrelationStat.Type.' + name);\n }\n }\n CorrelationStat$Type.valueOf_61zpoe$ = CorrelationStat$Type$valueOf;\n function CorrelationStat$Companion() {\n CorrelationStat$Companion_instance = this;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y), to(Aes$Companion_getInstance().COLOR, Stats_getInstance().CORR), to(Aes$Companion_getInstance().FILL, Stats_getInstance().CORR), to(Aes$Companion_getInstance().LABEL, Stats_getInstance().CORR)]);\n this.DEF_CORRELATION_METHOD = CorrelationStat$Method$PEARSON_getInstance();\n this.DEF_TYPE = CorrelationStat$Type$FULL_getInstance();\n this.DEF_FILL_DIAGONAL = true;\n this.DEF_THRESHOLD = 0.0;\n }\n CorrelationStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var CorrelationStat$Companion_instance = null;\n function CorrelationStat$Companion_getInstance() {\n if (CorrelationStat$Companion_instance === null) {\n new CorrelationStat$Companion();\n }return CorrelationStat$Companion_instance;\n }\n CorrelationStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CorrelationStat',\n interfaces: [BaseStat]\n };\n function CorrelationUtil() {\n CorrelationUtil_instance = this;\n }\n CorrelationUtil.prototype.correlation_n2j75g$ = function (lxs, lys, correlationFunction) {\n var tmp$ = allFinite(lxs, lys);\n var xs = tmp$.component1()\n , ys = tmp$.component2();\n return correlationFunction(xs, ys);\n };\n function CorrelationUtil$createComparator$lambda(closure$indexMap) {\n return function (a, b) {\n var tmp$, tmp$_0;\n var tmp$_1;\n if ((tmp$ = closure$indexMap.get_11rb$(a)) != null)\n tmp$_1 = tmp$;\n else {\n throw IllegalStateException_init(('Unknown variable label ' + a + '.').toString());\n }\n var lhsWeight = tmp$_1;\n var tmp$_2;\n if ((tmp$_0 = closure$indexMap.get_11rb$(b)) != null)\n tmp$_2 = tmp$_0;\n else {\n throw IllegalStateException_init(('Unknown variable label ' + b + '.').toString());\n }\n var rhsWeight = tmp$_2;\n return lhsWeight - rhsWeight | 0;\n };\n }\n CorrelationUtil.prototype.createComparator_0 = function (vars) {\n var $receiver = withIndex(vars);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(to(item.value.label, item.index));\n }\n var indexMap = toMap(destination);\n return new Comparator(CorrelationUtil$createComparator$lambda(indexMap));\n };\n function CorrelationUtil$correlationMatrix$addCorrelation(closure$threshold, closure$knownVars, closure$corrData) {\n return function (varX, varY, v) {\n if (JsMath.abs(v) >= closure$threshold) {\n closure$knownVars.add_11rb$(varX);\n closure$knownVars.add_11rb$(varY);\n var $receiver = closure$corrData;\n var key = to(varX, varY);\n $receiver.put_xwzc9p$(key, v);\n }};\n }\n CorrelationUtil.prototype.correlationMatrix_ofg6u8$ = function (data, type, fillDiagonal, correlationFunction, threshold) {\n if (threshold === void 0)\n threshold = CorrelationStat$Companion_getInstance().DEF_THRESHOLD;\n var tmp$, tmp$_0;\n var $receiver = data.variables();\n var destination = ArrayList_init();\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n if (DataFrameUtil_getInstance().isNumeric_vede35$(data, element.name))\n destination.add_11rb$(element);\n }\n var numerics = destination;\n var knownVars = LinkedHashSet_init_0();\n var corrData = LinkedHashMap_init();\n var addCorrelation = CorrelationUtil$correlationMatrix$addCorrelation(threshold, knownVars, corrData);\n var i = 0;\n for (var tmp$_2 = numerics.iterator(); tmp$_2.hasNext(); ++i) {\n var vx = tmp$_2.next();\n var xs = data.getNumeric_8xm3sj$(vx);\n if (fillDiagonal) {\n addCorrelation(vx.label, vx.label, 1.0);\n }for (var j = 0; j < i; j++) {\n var vy = numerics.get_za3lpa$(j);\n var ys = data.getNumeric_8xm3sj$(vy);\n var c = this.correlation_n2j75g$(xs, ys, correlationFunction);\n if (type === CorrelationStat$Type$FULL_getInstance() || type === CorrelationStat$Type$LOWER_getInstance()) {\n addCorrelation(vx.label, vy.label, c);\n }if (type === CorrelationStat$Type$FULL_getInstance() || type === CorrelationStat$Type$UPPER_getInstance()) {\n addCorrelation(vy.label, vx.label, c);\n }}\n }\n var var1 = ArrayList_init();\n var var2 = ArrayList_init();\n var corr = ArrayList_init();\n var sortedVars = sortedWith(knownVars, this.createComparator_0(numerics));\n tmp$ = sortedVars.iterator();\n while (tmp$.hasNext()) {\n var x = tmp$.next();\n tmp$_0 = sortedVars.iterator();\n while (tmp$_0.hasNext()) {\n var y = tmp$_0.next();\n var1.add_11rb$(x);\n var2.add_11rb$(y);\n corr.add_11rb$(corrData.get_11rb$(to(x, y)));\n }\n }\n return DataFrame$DataFrame$Builder_init().putDiscrete_2l962d$(Stats_getInstance().X, var1).putDiscrete_2l962d$(Stats_getInstance().Y, var2).putNumeric_s1rqo9$(Stats_getInstance().CORR, corr).build();\n };\n CorrelationUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'CorrelationUtil',\n interfaces: []\n };\n var CorrelationUtil_instance = null;\n function CorrelationUtil_getInstance() {\n if (CorrelationUtil_instance === null) {\n new CorrelationUtil();\n }return CorrelationUtil_instance;\n }\n function CountStat() {\n CountStat$Companion_getInstance();\n BaseStat.call(this, CountStat$Companion_getInstance().DEF_MAPPING_0);\n }\n CountStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().WEIGHT]);\n };\n CountStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n var tmp$;\n if (!this.hasRequiredValues_xht41f$(data, [Aes$Companion_getInstance().X])) {\n return this.withEmptyStatValues();\n }var valuesX = data.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n var weight = BinStatUtil_getInstance().weightVector_5m8trb$(valuesX.size, data);\n var statX = ArrayList_init();\n var statCount = ArrayList_init();\n var countByX = CountStat$Companion_getInstance().countByX_0(valuesX, weight);\n tmp$ = countByX.keys.iterator();\n while (tmp$.hasNext()) {\n var x = tmp$.next();\n statX.add_11rb$(x);\n statCount.add_11rb$(ensureNotNull(countByX.get_11rb$(x)).get());\n }\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().COUNT, statCount).build();\n };\n function CountStat$Companion() {\n CountStat$Companion_instance = this;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().COUNT)]);\n }\n CountStat$Companion.prototype.countByX_0 = function (valuesX, weight) {\n var result = LinkedHashMap_init();\n for (var i = 0; i !== valuesX.size; ++i) {\n var x = valuesX.get_za3lpa$(i);\n if (data.SeriesUtil.isFinite_yrwdxb$(x)) {\n if (!result.containsKey_11rb$(ensureNotNull(x))) {\n var value = new MutableDouble(0.0);\n result.put_xwzc9p$(x, value);\n }ensureNotNull(result.get_11rb$(x)).getAndAdd_14dthe$(data.SeriesUtil.asFinite_z03gcz$(weight.get_za3lpa$(i), 0.0));\n }}\n return result;\n };\n CountStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var CountStat$Companion_instance = null;\n function CountStat$Companion_getInstance() {\n if (CountStat$Companion_instance === null) {\n new CountStat$Companion();\n }return CountStat$Companion_instance;\n }\n CountStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CountStat',\n interfaces: [BaseStat]\n };\n function Density2dStat(bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth) {\n AbstractDensity2dStat.call(this, bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth);\n }\n Density2dStat.prototype.apply_kdy6bf$$default = function (data_0, statCtx, messageConsumer) {\n var tmp$, tmp$_0, tmp$_1;\n if (!this.hasRequiredValues_xht41f$(data_0, [Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y])) {\n return this.withEmptyStatValues();\n }var xVector = data_0.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n var yVector = data_0.getNumeric_8xm3sj$(TransformVar_getInstance().Y);\n if (xVector.isEmpty()) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }if (xVector.size !== yVector.size) {\n throw RuntimeException_init('len(x)= ' + toString(xVector.size) + ' and len(y)= ' + toString(yVector.size) + \" doesn't match!\");\n }var xRange = statCtx.overallXRange();\n var yRange = statCtx.overallYRange();\n var statX = ArrayList_init();\n var statY = ArrayList_init();\n var statDensity = ArrayList_init();\n var bandWidth = new Float64Array(2);\n bandWidth[0] = this.getBandWidthX_k9kaly$(xVector);\n bandWidth[1] = this.getBandWidthY_k9kaly$(yVector);\n var stepsX = DensityStatUtil_getInstance().createStepValues_1tlvto$(ensureNotNull(xRange), this.nX);\n var stepsY = DensityStatUtil_getInstance().createStepValues_1tlvto$(ensureNotNull(yRange), this.nY);\n var groupWeight = BinStatUtil_getInstance().weightVector_5m8trb$(xVector.size, data_0);\n var matrixX = BlockRealMatrix_init_0(DensityStatUtil_getInstance().createRawMatrix_a6xq99$(xVector, stepsX, this.kernelFun, bandWidth[0], this.adjust, groupWeight));\n var matrixY = BlockRealMatrix_init_0(DensityStatUtil_getInstance().createRawMatrix_a6xq99$(yVector, stepsY, this.kernelFun, bandWidth[1], this.adjust, groupWeight));\n var matrixFinal = matrixY.multiply_1dlv11$(matrixX.transpose());\n tmp$ = this.nY;\n for (var row = 0; row < tmp$; row++) {\n tmp$_0 = this.nX;\n for (var col = 0; col < tmp$_0; col++) {\n statX.add_11rb$(stepsX.get_za3lpa$(col));\n statY.add_11rb$(stepsY.get_za3lpa$(row));\n statDensity.add_11rb$(matrixFinal.getEntry_vux9f0$(row, col) / data.SeriesUtil.sum_k9kaly$(groupWeight));\n }\n }\n if (this.isContour) {\n var zRange = data.SeriesUtil.range_l63ks6$(statDensity);\n tmp$_1 = ContourStatUtil_getInstance().computeLevels_kgz263$(zRange, this.binOptions);\n if (tmp$_1 == null) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }var levels = tmp$_1;\n var pathListByLevel = ContourStatUtil_getInstance().computeContours_cxleoh$(xRange, yRange, this.nX, this.nY, statDensity, levels);\n return Contour$Companion_getInstance().getPathDataFrame_9s3d7f$(levels, pathListByLevel);\n } else {\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().Y, statY).putNumeric_s1rqo9$(Stats_getInstance().DENSITY, statDensity).build();\n }\n };\n Density2dStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Density2dStat',\n interfaces: [AbstractDensity2dStat]\n };\n function Density2dfStat(bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth) {\n AbstractDensity2dStat.call(this, bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth);\n }\n Density2dfStat.prototype.apply_kdy6bf$$default = function (data_0, statCtx, messageConsumer) {\n var tmp$, tmp$_0, tmp$_1;\n if (!this.hasRequiredValues_xht41f$(data_0, [Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y])) {\n return this.withEmptyStatValues();\n }var xVector = data_0.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n var yVector = data_0.getNumeric_8xm3sj$(TransformVar_getInstance().Y);\n if (xVector.isEmpty()) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }if (xVector.size !== yVector.size) {\n throw RuntimeException_init('len(x)= ' + toString(xVector.size) + ' and len(y)= ' + toString(yVector.size) + \" doesn't match!\");\n }var xRange = statCtx.overallXRange();\n var yRange = statCtx.overallYRange();\n var statX = ArrayList_init();\n var statY = ArrayList_init();\n var statDensity = ArrayList_init();\n var bandWidth = new Float64Array(2);\n bandWidth[0] = this.getBandWidthX_k9kaly$(xVector);\n bandWidth[1] = this.getBandWidthY_k9kaly$(yVector);\n var stepsX = DensityStatUtil_getInstance().createStepValues_1tlvto$(ensureNotNull(xRange), this.nX);\n var stepsY = DensityStatUtil_getInstance().createStepValues_1tlvto$(ensureNotNull(yRange), this.nY);\n var groupWeight = BinStatUtil_getInstance().weightVector_5m8trb$(xVector.size, data_0);\n var matrixX = BlockRealMatrix_init_0(DensityStatUtil_getInstance().createRawMatrix_a6xq99$(xVector, stepsX, this.kernelFun, bandWidth[0], this.adjust, groupWeight));\n var matrixY = BlockRealMatrix_init_0(DensityStatUtil_getInstance().createRawMatrix_a6xq99$(yVector, stepsY, this.kernelFun, bandWidth[1], this.adjust, groupWeight));\n var matrixFinal = matrixY.multiply_1dlv11$(matrixX.transpose());\n tmp$ = this.nY;\n for (var row = 0; row < tmp$; row++) {\n tmp$_0 = this.nX;\n for (var col = 0; col < tmp$_0; col++) {\n statX.add_11rb$(stepsX.get_za3lpa$(col));\n statY.add_11rb$(stepsY.get_za3lpa$(row));\n statDensity.add_11rb$(matrixFinal.getEntry_vux9f0$(row, col) / data.SeriesUtil.sum_k9kaly$(groupWeight));\n }\n }\n if (this.isContour) {\n var zRange = data.SeriesUtil.range_l63ks6$(statDensity);\n tmp$_1 = ContourStatUtil_getInstance().computeLevels_kgz263$(zRange, this.binOptions);\n if (tmp$_1 == null) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }var levels = tmp$_1;\n var pathListByLevel = ContourStatUtil_getInstance().computeContours_cxleoh$(xRange, yRange, this.nX, this.nY, statDensity, levels);\n var helper = new ContourFillHelper(xRange, yRange);\n var fillLevels = ContourFillHelper$Companion_getInstance().computeFillLevels_4v6zbb$(ensureNotNull(zRange), levels);\n var polygonListByFillLevel = helper.createPolygons_lrt0be$(pathListByLevel, levels, fillLevels);\n return Contour$Companion_getInstance().getPolygonDataFrame_dnsuee$(fillLevels.subList_vux9f0$(1, fillLevels.size), polygonListByFillLevel);\n } else {\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().Y, statY).putNumeric_s1rqo9$(Stats_getInstance().DENSITY, statDensity).build();\n }\n };\n Density2dfStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Density2dfStat',\n interfaces: [AbstractDensity2dStat]\n };\n var compareBy$lambda = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function DensityStat(bandWidth, bandWidthMethod, adjust, kernel, n, fullScalMax) {\n DensityStat$Companion_getInstance();\n BaseStat.call(this, DensityStat$Companion_getInstance().DEF_MAPPING_0);\n this.bandWidth_0 = bandWidth;\n this.bandWidthMethod_0 = bandWidthMethod;\n this.adjust_0 = adjust;\n this.kernel_0 = kernel;\n this.n_0 = n;\n this.fullScalMax_0 = fullScalMax;\n if (!(this.n_0 <= 1024)) {\n var message = 'The input n = ' + this.n_0 + ' > ' + '1024' + ' is too large!';\n throw IllegalArgumentException_init(message.toString());\n }}\n DensityStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().WEIGHT]);\n };\n function DensityStat$apply$lambda(it) {\n return it.first;\n }\n DensityStat.prototype.apply_kdy6bf$$default = function (data_0, statCtx, messageConsumer) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n if (!this.hasRequiredValues_xht41f$(data_0, [Aes$Companion_getInstance().X])) {\n return this.withEmptyStatValues();\n }var xs;\n var weights;\n if (data_0.has_8xm3sj$(TransformVar_getInstance().WEIGHT)) {\n var filtered = data.SeriesUtil.filterFinite_10sy24$(data_0.getNumeric_8xm3sj$(TransformVar_getInstance().X), data_0.getNumeric_8xm3sj$(TransformVar_getInstance().WEIGHT));\n var xsFiltered = filtered.get_za3lpa$(0);\n var weightsFiltered = filtered.get_za3lpa$(1);\n var tmp$_5 = unzip(sortedWith(zip(xsFiltered, weightsFiltered), new Comparator(compareBy$lambda(DensityStat$apply$lambda))));\n var xsSorted = tmp$_5.component1()\n , weightsSorted = tmp$_5.component2();\n xs = xsSorted;\n weights = weightsSorted;\n } else {\n var $receiver = filterNotNull(data_0.getNumeric_8xm3sj$(TransformVar_getInstance().X));\n var destination = ArrayList_init();\n var tmp$_6;\n tmp$_6 = $receiver.iterator();\n while (tmp$_6.hasNext()) {\n var element = tmp$_6.next();\n if (isFinite(element))\n destination.add_11rb$(element);\n }\n xs = sorted(destination);\n var size = xs.size;\n var list = ArrayList_init_1(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(1.0);\n }\n weights = list;\n }\n if (xs.isEmpty())\n return this.withEmptyStatValues();\n var rangeX = (tmp$ = statCtx.overallXRange()) != null ? tmp$ : new ClosedRange(-0.5, 0.5);\n var statX = DensityStatUtil_getInstance().createStepValues_1tlvto$(rangeX, this.n_0);\n var statDensity = ArrayList_init();\n var statCount = ArrayList_init();\n var statScaled = ArrayList_init();\n var bandWidth = (tmp$_0 = this.bandWidth_0) != null ? tmp$_0 : DensityStatUtil_getInstance().bandWidth_whucba$(this.bandWidthMethod_0, xs);\n var kernelFun = DensityStatUtil_getInstance().kernel_uyf859$(this.kernel_0);\n tmp$_1 = xs.size <= this.fullScalMax_0;\n if (tmp$_1 === true)\n tmp$_2 = DensityStatUtil_getInstance().densityFunctionFullScan_hztk2d$(xs, weights, kernelFun, bandWidth, this.adjust_0);\n else if (tmp$_1 === false)\n tmp$_2 = DensityStatUtil_getInstance().densityFunctionFast_hztk2d$(xs, weights, kernelFun, bandWidth, this.adjust_0);\n else\n tmp$_2 = Kotlin.noWhenBranchMatched();\n var densityFunction = tmp$_2;\n var nTotal = sum(weights);\n tmp$_3 = statX.iterator();\n while (tmp$_3.hasNext()) {\n var x = tmp$_3.next();\n var d = densityFunction(x);\n statCount.add_11rb$(d);\n statDensity.add_11rb$(d / nTotal);\n }\n var maxm = ensureNotNull(maxOrNull(statCount));\n tmp$_4 = statCount.iterator();\n while (tmp$_4.hasNext()) {\n var d_0 = tmp$_4.next();\n statScaled.add_11rb$(d_0 / maxm);\n }\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().DENSITY, statDensity).putNumeric_s1rqo9$(Stats_getInstance().COUNT, statCount).putNumeric_s1rqo9$(Stats_getInstance().SCALED, statScaled).build();\n };\n function DensityStat$Kernel(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function DensityStat$Kernel_initFields() {\n DensityStat$Kernel_initFields = function () {\n };\n DensityStat$Kernel$GAUSSIAN_instance = new DensityStat$Kernel('GAUSSIAN', 0);\n DensityStat$Kernel$RECTANGULAR_instance = new DensityStat$Kernel('RECTANGULAR', 1);\n DensityStat$Kernel$TRIANGULAR_instance = new DensityStat$Kernel('TRIANGULAR', 2);\n DensityStat$Kernel$BIWEIGHT_instance = new DensityStat$Kernel('BIWEIGHT', 3);\n DensityStat$Kernel$EPANECHNIKOV_instance = new DensityStat$Kernel('EPANECHNIKOV', 4);\n DensityStat$Kernel$OPTCOSINE_instance = new DensityStat$Kernel('OPTCOSINE', 5);\n DensityStat$Kernel$COSINE_instance = new DensityStat$Kernel('COSINE', 6);\n }\n var DensityStat$Kernel$GAUSSIAN_instance;\n function DensityStat$Kernel$GAUSSIAN_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$GAUSSIAN_instance;\n }\n var DensityStat$Kernel$RECTANGULAR_instance;\n function DensityStat$Kernel$RECTANGULAR_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$RECTANGULAR_instance;\n }\n var DensityStat$Kernel$TRIANGULAR_instance;\n function DensityStat$Kernel$TRIANGULAR_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$TRIANGULAR_instance;\n }\n var DensityStat$Kernel$BIWEIGHT_instance;\n function DensityStat$Kernel$BIWEIGHT_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$BIWEIGHT_instance;\n }\n var DensityStat$Kernel$EPANECHNIKOV_instance;\n function DensityStat$Kernel$EPANECHNIKOV_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$EPANECHNIKOV_instance;\n }\n var DensityStat$Kernel$OPTCOSINE_instance;\n function DensityStat$Kernel$OPTCOSINE_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$OPTCOSINE_instance;\n }\n var DensityStat$Kernel$COSINE_instance;\n function DensityStat$Kernel$COSINE_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$COSINE_instance;\n }\n DensityStat$Kernel.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Kernel',\n interfaces: [Enum]\n };\n function DensityStat$Kernel$values() {\n return [DensityStat$Kernel$GAUSSIAN_getInstance(), DensityStat$Kernel$RECTANGULAR_getInstance(), DensityStat$Kernel$TRIANGULAR_getInstance(), DensityStat$Kernel$BIWEIGHT_getInstance(), DensityStat$Kernel$EPANECHNIKOV_getInstance(), DensityStat$Kernel$OPTCOSINE_getInstance(), DensityStat$Kernel$COSINE_getInstance()];\n }\n DensityStat$Kernel.values = DensityStat$Kernel$values;\n function DensityStat$Kernel$valueOf(name) {\n switch (name) {\n case 'GAUSSIAN':\n return DensityStat$Kernel$GAUSSIAN_getInstance();\n case 'RECTANGULAR':\n return DensityStat$Kernel$RECTANGULAR_getInstance();\n case 'TRIANGULAR':\n return DensityStat$Kernel$TRIANGULAR_getInstance();\n case 'BIWEIGHT':\n return DensityStat$Kernel$BIWEIGHT_getInstance();\n case 'EPANECHNIKOV':\n return DensityStat$Kernel$EPANECHNIKOV_getInstance();\n case 'OPTCOSINE':\n return DensityStat$Kernel$OPTCOSINE_getInstance();\n case 'COSINE':\n return DensityStat$Kernel$COSINE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.DensityStat.Kernel.' + name);\n }\n }\n DensityStat$Kernel.valueOf_61zpoe$ = DensityStat$Kernel$valueOf;\n function DensityStat$BandWidthMethod(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function DensityStat$BandWidthMethod_initFields() {\n DensityStat$BandWidthMethod_initFields = function () {\n };\n DensityStat$BandWidthMethod$NRD0_instance = new DensityStat$BandWidthMethod('NRD0', 0);\n DensityStat$BandWidthMethod$NRD_instance = new DensityStat$BandWidthMethod('NRD', 1);\n }\n var DensityStat$BandWidthMethod$NRD0_instance;\n function DensityStat$BandWidthMethod$NRD0_getInstance() {\n DensityStat$BandWidthMethod_initFields();\n return DensityStat$BandWidthMethod$NRD0_instance;\n }\n var DensityStat$BandWidthMethod$NRD_instance;\n function DensityStat$BandWidthMethod$NRD_getInstance() {\n DensityStat$BandWidthMethod_initFields();\n return DensityStat$BandWidthMethod$NRD_instance;\n }\n DensityStat$BandWidthMethod.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BandWidthMethod',\n interfaces: [Enum]\n };\n function DensityStat$BandWidthMethod$values() {\n return [DensityStat$BandWidthMethod$NRD0_getInstance(), DensityStat$BandWidthMethod$NRD_getInstance()];\n }\n DensityStat$BandWidthMethod.values = DensityStat$BandWidthMethod$values;\n function DensityStat$BandWidthMethod$valueOf(name) {\n switch (name) {\n case 'NRD0':\n return DensityStat$BandWidthMethod$NRD0_getInstance();\n case 'NRD':\n return DensityStat$BandWidthMethod$NRD_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.DensityStat.BandWidthMethod.' + name);\n }\n }\n DensityStat$BandWidthMethod.valueOf_61zpoe$ = DensityStat$BandWidthMethod$valueOf;\n function DensityStat$Companion() {\n DensityStat$Companion_instance = this;\n this.DEF_KERNEL = DensityStat$Kernel$GAUSSIAN_getInstance();\n this.DEF_ADJUST = 1.0;\n this.DEF_N = 512;\n this.DEF_BW = DensityStat$BandWidthMethod$NRD0_getInstance();\n this.DEF_FULL_SCAN_MAX = 5000;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().DENSITY)]);\n this.MAX_N_0 = 1024;\n }\n DensityStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DensityStat$Companion_instance = null;\n function DensityStat$Companion_getInstance() {\n if (DensityStat$Companion_instance === null) {\n new DensityStat$Companion();\n }return DensityStat$Companion_instance;\n }\n DensityStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DensityStat',\n interfaces: [BaseStat]\n };\n function DensityStatUtil() {\n DensityStatUtil_instance = this;\n this.DEF_STEP_SIZE_0 = 0.5;\n }\n DensityStatUtil.prototype.stdDev_0 = function (data) {\n var tmp$, tmp$_0;\n var sum = 0.0;\n var counter = 0.0;\n tmp$ = data.iterator();\n while (tmp$.hasNext()) {\n var i = tmp$.next();\n sum += i;\n }\n var mean = sum / data.size;\n tmp$_0 = data.iterator();\n while (tmp$_0.hasNext()) {\n var i_0 = tmp$_0.next();\n var $receiver = i_0 - mean;\n counter += JsMath.pow($receiver, 2.0);\n }\n var x = counter / data.size;\n return JsMath.sqrt(x);\n };\n DensityStatUtil.prototype.bandWidth_whucba$ = function (bw, valuesX) {\n var tmp$;\n var mySize = valuesX.size;\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = valuesX.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (data.SeriesUtil.isFinite_yrwdxb$(element))\n destination.add_11rb$(element);\n }\n var valuesXFinite = Kotlin.isType(tmp$ = destination, List) ? tmp$ : throwCCE();\n var dataSummary = FiveNumberSummary_init(valuesXFinite);\n var myIQR = dataSummary.thirdQuartile - dataSummary.firstQuartile;\n var myStdD = this.stdDev_0(valuesXFinite);\n switch (bw.name) {\n case 'NRD0':\n if (myIQR > 0) {\n var b = myIQR / 1.34;\n var tmp$_1 = 0.9 * JsMath.min(myStdD, b);\n var x = -0.2;\n return tmp$_1 * JsMath.pow(mySize, x);\n }\n if (myStdD > 0) {\n var tmp$_2 = 0.9 * myStdD;\n var x_0 = -0.2;\n return tmp$_2 * JsMath.pow(mySize, x_0);\n }\n break;\n case 'NRD':\n if (myIQR > 0) {\n var b_0 = myIQR / 1.34;\n var tmp$_3 = 1.06 * JsMath.min(myStdD, b_0);\n var x_1 = -0.2;\n return tmp$_3 * JsMath.pow(mySize, x_1);\n }\n if (myStdD > 0) {\n var tmp$_4 = 1.06 * myStdD;\n var x_2 = -0.2;\n return tmp$_4 * JsMath.pow(mySize, x_2);\n }\n break;\n }\n return 1.0;\n };\n function DensityStatUtil$kernel$lambda(value) {\n var x = 2 * math.PI;\n var tmp$ = 1 / JsMath.sqrt(x);\n var x_0 = -0.5 * JsMath.pow(value, 2.0);\n return tmp$ * JsMath.exp(x_0);\n }\n function DensityStatUtil$kernel$lambda_0(value) {\n return JsMath.abs(value) <= 1 ? 0.5 : 0.0;\n }\n function DensityStatUtil$kernel$lambda_1(value) {\n return JsMath.abs(value) <= 1 ? 1 - JsMath.abs(value) : 0.0;\n }\n function DensityStatUtil$kernel$lambda_2(value) {\n var tmp$;\n if (JsMath.abs(value) <= 1) {\n var $receiver = 1 - value * value;\n tmp$ = 0.9375 * JsMath.pow($receiver, 2.0);\n } else\n tmp$ = 0.0;\n return tmp$;\n }\n function DensityStatUtil$kernel$lambda_3(value) {\n return JsMath.abs(value) <= 1 ? 0.75 * (1 - value * value) : 0.0;\n }\n function DensityStatUtil$kernel$lambda_4(value) {\n var tmp$;\n if (JsMath.abs(value) <= 1) {\n var tmp$_0 = math.PI / 4;\n var x = math.PI / 2 * value;\n tmp$ = tmp$_0 * JsMath.cos(x);\n } else\n tmp$ = 0.0;\n return tmp$;\n }\n function DensityStatUtil$kernel$lambda_5(value) {\n var tmp$;\n if (JsMath.abs(value) <= 1) {\n var x = math.PI * value;\n tmp$ = (JsMath.cos(x) + 1) / 2;\n } else\n tmp$ = 0.0;\n return tmp$;\n }\n DensityStatUtil.prototype.kernel_uyf859$ = function (ker) {\n var tmp$;\n switch (ker.name) {\n case 'GAUSSIAN':\n tmp$ = DensityStatUtil$kernel$lambda;\n break;\n case 'RECTANGULAR':\n tmp$ = DensityStatUtil$kernel$lambda_0;\n break;\n case 'TRIANGULAR':\n tmp$ = DensityStatUtil$kernel$lambda_1;\n break;\n case 'BIWEIGHT':\n tmp$ = DensityStatUtil$kernel$lambda_2;\n break;\n case 'EPANECHNIKOV':\n tmp$ = DensityStatUtil$kernel$lambda_3;\n break;\n case 'OPTCOSINE':\n tmp$ = DensityStatUtil$kernel$lambda_4;\n break;\n default:tmp$ = DensityStatUtil$kernel$lambda_5;\n break;\n }\n return tmp$;\n };\n function DensityStatUtil$densityFunctionFullScan$lambda(closure$xs, closure$ker, closure$h, closure$weights) {\n return function (x) {\n var sum = 0.0;\n for (var i = 0; i !== closure$xs.size; ++i) {\n sum += closure$ker((x - closure$xs.get_za3lpa$(i)) / closure$h) * closure$weights.get_za3lpa$(i);\n }\n return sum / closure$h;\n };\n }\n DensityStatUtil.prototype.densityFunctionFullScan_hztk2d$ = function (xs, weights, ker, bw, ad) {\n var h = bw * ad;\n return DensityStatUtil$densityFunctionFullScan$lambda(xs, ker, h, weights);\n };\n function DensityStatUtil$densityFunctionFast$lambda(closure$xs, closure$cutoff, closure$ker, closure$h, closure$weights) {\n return function (x) {\n var tmp$;\n var sum = 0.0;\n var from = binarySearch(closure$xs, x - closure$cutoff);\n if (from < 0) {\n from = (-from | 0) - 1 | 0;\n }var to = binarySearch(closure$xs, x + closure$cutoff);\n if (to < 0) {\n to = (-to | 0) - 1 | 0;\n }tmp$ = to;\n for (var i = from; i < tmp$; i++) {\n sum += closure$ker((x - closure$xs.get_za3lpa$(i)) / closure$h) * closure$weights.get_za3lpa$(i);\n }\n return sum / closure$h;\n };\n }\n DensityStatUtil.prototype.densityFunctionFast_hztk2d$ = function (xs, weights, ker, bw, ad) {\n var h = bw * ad;\n var cutoff = h * 5;\n return DensityStatUtil$densityFunctionFast$lambda(xs, cutoff, ker, h, weights);\n };\n DensityStatUtil.prototype.createStepValues_1tlvto$ = function (range, n) {\n var x = ArrayList_init();\n var min = range.lowerEnd;\n var max = range.upperEnd;\n var step;\n if (max === min) {\n max += this.DEF_STEP_SIZE_0;\n min -= this.DEF_STEP_SIZE_0;\n }step = (max - min) / (n - 1 | 0);\n for (var i = 0; i < n; i++) {\n x.add_11rb$(min + step * i);\n }\n return x;\n };\n DensityStatUtil.prototype.toKernel_61zpoe$ = function (method) {\n var tmp$;\n switch (method) {\n case 'gaussian':\n tmp$ = DensityStat$Kernel$GAUSSIAN_getInstance();\n break;\n case 'rectangular':\n case 'uniform':\n tmp$ = DensityStat$Kernel$RECTANGULAR_getInstance();\n break;\n case 'triangular':\n tmp$ = DensityStat$Kernel$TRIANGULAR_getInstance();\n break;\n case 'biweight':\n case 'quartic':\n tmp$ = DensityStat$Kernel$BIWEIGHT_getInstance();\n break;\n case 'epanechikov':\n case 'parabolic':\n tmp$ = DensityStat$Kernel$EPANECHNIKOV_getInstance();\n break;\n case 'optcosine':\n tmp$ = DensityStat$Kernel$OPTCOSINE_getInstance();\n break;\n case 'cosine':\n tmp$ = DensityStat$Kernel$COSINE_getInstance();\n break;\n default:throw IllegalArgumentException_init(\"Unsupported kernel method: '\" + method + \"'.\" + '\\n' + 'Use one of: gaussian, rectangular, triangular, biweight, epanechikov, optcosine, cos.');\n }\n return tmp$;\n };\n DensityStatUtil.prototype.toBandWidthMethod_61zpoe$ = function (bw) {\n var tmp$;\n switch (bw) {\n case 'nrd0':\n tmp$ = DensityStat$BandWidthMethod$NRD0_getInstance();\n break;\n case 'nrd':\n tmp$ = DensityStat$BandWidthMethod$NRD_getInstance();\n break;\n default:throw IllegalArgumentException_init(\"Unsupported bandwidth method: '\" + bw + \"'.\" + '\\n' + 'Use one of: nrd0, nrd.');\n }\n return tmp$;\n };\n DensityStatUtil.prototype.createRawMatrix_a6xq99$ = function (values, list, ker, bw, ad, weight) {\n var a = bw * ad;\n var n = values.size;\n var x = list.size;\n var array = Array_0(x);\n var tmp$;\n tmp$ = array.length - 1 | 0;\n for (var i = 0; i <= tmp$; i++) {\n array[i] = new Float64Array(n);\n }\n var result = array;\n for (var row = 0; row < x; row++) {\n for (var col = 0; col < n; col++) {\n var tmp$_0 = result[row];\n var tmp$_1 = ker((list.get_za3lpa$(row) - ensureNotNull(values.get_za3lpa$(col))) / a);\n var x_0 = ensureNotNull(weight.get_za3lpa$(col));\n tmp$_0[col] = tmp$_1 * JsMath.sqrt(x_0) / a;\n }\n }\n return result;\n };\n DensityStatUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DensityStatUtil',\n interfaces: []\n };\n var DensityStatUtil_instance = null;\n function DensityStatUtil_getInstance() {\n if (DensityStatUtil_instance === null) {\n new DensityStatUtil();\n }return DensityStatUtil_instance;\n }\n function FiveNumberSummary() {\n this.min = 0;\n this.max = 0;\n this.median = 0;\n this.firstQuartile = 0;\n this.thirdQuartile = 0;\n }\n FiveNumberSummary.prototype.medianAtPointer_0 = function (l, pointer) {\n var tmp$;\n var rint = round(pointer);\n if (pointer === rint) {\n tmp$ = l.get_za3lpa$(numberToInt(pointer));\n } else {\n tmp$ = (l.get_za3lpa$(numberToInt(JsMath.ceil(pointer))) + l.get_za3lpa$(numberToInt(JsMath.floor(pointer)))) / 2.0;\n }\n return tmp$;\n };\n FiveNumberSummary.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n var that = (tmp$_0 = other) == null || Kotlin.isType(tmp$_0, FiveNumberSummary) ? tmp$_0 : throwCCE();\n return Kotlin.compareTo(ensureNotNull(that).min, this.min) === 0 && Kotlin.compareTo(that.max, this.max) === 0 && Kotlin.compareTo(that.median, this.median) === 0 && Kotlin.compareTo(that.firstQuartile, this.firstQuartile) === 0 && Kotlin.compareTo(that.thirdQuartile, this.thirdQuartile) === 0;\n };\n FiveNumberSummary.prototype.hashCode = function () {\n return hashCode([this.min, this.max, this.median, this.firstQuartile, this.thirdQuartile]);\n };\n FiveNumberSummary.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FiveNumberSummary',\n interfaces: []\n };\n function FiveNumberSummary_init(data, $this) {\n $this = $this || Object.create(FiveNumberSummary.prototype);\n FiveNumberSummary.call($this);\n var sorted = Ordering.Companion.natural_dahdeg$().sortedCopy_m5x2f4$(data);\n if (sorted.isEmpty()) {\n $this.thirdQuartile = kotlin_js_internal_DoubleCompanionObject.NaN;\n $this.firstQuartile = $this.thirdQuartile;\n $this.median = $this.firstQuartile;\n $this.max = $this.median;\n $this.min = $this.max;\n } else if (sorted.size === 1) {\n $this.thirdQuartile = sorted.get_za3lpa$(0);\n $this.firstQuartile = $this.thirdQuartile;\n $this.median = $this.firstQuartile;\n $this.max = $this.median;\n $this.min = $this.max;\n } else {\n var maxIndex = sorted.size - 1 | 0;\n $this.min = sorted.get_za3lpa$(0);\n $this.max = sorted.get_za3lpa$(maxIndex);\n $this.median = $this.medianAtPointer_0(sorted, maxIndex * 0.5);\n $this.firstQuartile = $this.medianAtPointer_0(sorted, maxIndex * 0.25);\n $this.thirdQuartile = $this.medianAtPointer_0(sorted, maxIndex * 0.75);\n }\n return $this;\n }\n function FiveNumberSummary_init_0(min, max, median, firstQuartile, thirdQuartile, $this) {\n $this = $this || Object.create(FiveNumberSummary.prototype);\n FiveNumberSummary.call($this);\n $this.min = min;\n $this.max = max;\n $this.median = median;\n $this.firstQuartile = firstQuartile;\n $this.thirdQuartile = thirdQuartile;\n return $this;\n }\n function MultiOrdering(myKeys) {\n this.myKeys_0 = myKeys;\n this.myIndices_0 = null;\n var tmp$;\n this.myIndices_0 = ArrayList_init_1(this.myKeys_0.size);\n tmp$ = this.myKeys_0;\n for (var i = 0; i !== tmp$.size; ++i) {\n this.myIndices_0.add_11rb$(i);\n }\n sortWith(this.myIndices_0, new Comparator(MultiOrdering_init$lambda(this)));\n }\n MultiOrdering.prototype.sortedCopy_bemo1h$ = function (l) {\n var tmp$;\n if (!(l.size === this.myIndices_0.size)) {\n var message = 'Expected size ' + toString(this.myIndices_0.size) + ' but was size ' + toString(l.size);\n throw IllegalArgumentException_init(message.toString());\n }var copy = ArrayList_init_1(this.myIndices_0.size);\n tmp$ = this.myIndices_0.iterator();\n while (tmp$.hasNext()) {\n var oldIndex = tmp$.next();\n var v = l.get_za3lpa$(oldIndex);\n copy.add_11rb$(v);\n }\n return copy;\n };\n MultiOrdering.prototype.sortedCopyOfKeys = function () {\n return this.sortedCopy_bemo1h$(this.myKeys_0);\n };\n function MultiOrdering_init$lambda(this$MultiOrdering) {\n return function (i, j) {\n var keyI = this$MultiOrdering.myKeys_0.get_za3lpa$(ensureNotNull(i));\n var keyJ = this$MultiOrdering.myKeys_0.get_za3lpa$(ensureNotNull(j));\n if (keyI === keyJ)\n return 0;\n else if (keyI == null)\n return -1;\n else if (keyJ == null)\n return 1;\n else\n return Kotlin.compareTo(keyI, keyJ);\n };\n }\n MultiOrdering.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiOrdering',\n interfaces: []\n };\n function SimpleStatContext(myDataFrame) {\n this.myDataFrame_0 = myDataFrame;\n }\n SimpleStatContext.prototype.overallXRange = function () {\n return this.myDataFrame_0.range_8xm3sj$(TransformVar_getInstance().X);\n };\n SimpleStatContext.prototype.overallYRange = function () {\n return this.myDataFrame_0.range_8xm3sj$(TransformVar_getInstance().Y);\n };\n SimpleStatContext.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SimpleStatContext',\n interfaces: [StatContext]\n };\n function SmoothStat(smootherPointCount, smoothingMethod, confidenceLevel, displayConfidenceInterval, span, polynomialDegree, loessCriticalSize, samplingSeed) {\n SmoothStat$Companion_getInstance();\n BaseStat.call(this, SmoothStat$Companion_getInstance().DEF_MAPPING_0);\n this.smootherPointCount_0 = smootherPointCount;\n this.smoothingMethod_0 = smoothingMethod;\n this.confidenceLevel_0 = confidenceLevel;\n this.displayConfidenceInterval_0 = displayConfidenceInterval;\n this.span_0 = span;\n this.polynomialDegree_0 = polynomialDegree;\n this.loessCriticalSize_0 = loessCriticalSize;\n this.samplingSeed_0 = samplingSeed;\n }\n SmoothStat.prototype.hasDefaultMapping_896ixz$ = function (aes) {\n return BaseStat.prototype.hasDefaultMapping_896ixz$.call(this, aes) || (equals(aes, Aes$Companion_getInstance().YMIN) && this.displayConfidenceInterval_0) || (equals(aes, Aes$Companion_getInstance().YMAX) && this.displayConfidenceInterval_0);\n };\n SmoothStat.prototype.getDefaultMapping_896ixz$ = function (aes) {\n var tmp$;\n if (equals(aes, Aes$Companion_getInstance().YMIN)) {\n return Stats_getInstance().Y_MIN;\n }if (equals(aes, Aes$Companion_getInstance().YMAX)) {\n tmp$ = Stats_getInstance().Y_MAX;\n } else\n tmp$ = BaseStat.prototype.getDefaultMapping_896ixz$.call(this, aes);\n return tmp$;\n };\n function SmoothStat$Method(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function SmoothStat$Method_initFields() {\n SmoothStat$Method_initFields = function () {\n };\n SmoothStat$Method$LM_instance = new SmoothStat$Method('LM', 0);\n SmoothStat$Method$GLM_instance = new SmoothStat$Method('GLM', 1);\n SmoothStat$Method$GAM_instance = new SmoothStat$Method('GAM', 2);\n SmoothStat$Method$LOESS_instance = new SmoothStat$Method('LOESS', 3);\n SmoothStat$Method$RLM_instance = new SmoothStat$Method('RLM', 4);\n }\n var SmoothStat$Method$LM_instance;\n function SmoothStat$Method$LM_getInstance() {\n SmoothStat$Method_initFields();\n return SmoothStat$Method$LM_instance;\n }\n var SmoothStat$Method$GLM_instance;\n function SmoothStat$Method$GLM_getInstance() {\n SmoothStat$Method_initFields();\n return SmoothStat$Method$GLM_instance;\n }\n var SmoothStat$Method$GAM_instance;\n function SmoothStat$Method$GAM_getInstance() {\n SmoothStat$Method_initFields();\n return SmoothStat$Method$GAM_instance;\n }\n var SmoothStat$Method$LOESS_instance;\n function SmoothStat$Method$LOESS_getInstance() {\n SmoothStat$Method_initFields();\n return SmoothStat$Method$LOESS_instance;\n }\n var SmoothStat$Method$RLM_instance;\n function SmoothStat$Method$RLM_getInstance() {\n SmoothStat$Method_initFields();\n return SmoothStat$Method$RLM_instance;\n }\n SmoothStat$Method.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Method',\n interfaces: [Enum]\n };\n function SmoothStat$Method$values() {\n return [SmoothStat$Method$LM_getInstance(), SmoothStat$Method$GLM_getInstance(), SmoothStat$Method$GAM_getInstance(), SmoothStat$Method$LOESS_getInstance(), SmoothStat$Method$RLM_getInstance()];\n }\n SmoothStat$Method.values = SmoothStat$Method$values;\n function SmoothStat$Method$valueOf(name) {\n switch (name) {\n case 'LM':\n return SmoothStat$Method$LM_getInstance();\n case 'GLM':\n return SmoothStat$Method$GLM_getInstance();\n case 'GAM':\n return SmoothStat$Method$GAM_getInstance();\n case 'LOESS':\n return SmoothStat$Method$LOESS_getInstance();\n case 'RLM':\n return SmoothStat$Method$RLM_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.SmoothStat.Method.' + name);\n }\n }\n SmoothStat$Method.valueOf_61zpoe$ = SmoothStat$Method$valueOf;\n function SmoothStat$Companion() {\n SmoothStat$Companion_instance = this;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y)]);\n this.DEF_EVAL_POINT_COUNT = 80;\n this.DEF_SMOOTHING_METHOD = SmoothStat$Method$LM_getInstance();\n this.DEF_CONFIDENCE_LEVEL = 0.95;\n this.DEF_DISPLAY_CONFIDENCE_INTERVAL = true;\n this.DEF_SPAN = 0.5;\n this.DEF_DEG = 1;\n this.DEF_LOESS_CRITICAL_SIZE = 1000;\n this.DEF_SAMPLING_SEED = L37;\n }\n SmoothStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SmoothStat$Companion_instance = null;\n function SmoothStat$Companion_getInstance() {\n if (SmoothStat$Companion_instance === null) {\n new SmoothStat$Companion();\n }return SmoothStat$Companion_instance;\n }\n SmoothStat.prototype.consumes = function () {\n return listOf_0(Aes$Companion_getInstance().Y);\n };\n SmoothStat.prototype.needSampling_za3lpa$ = function (rowCount) {\n if (this.smoothingMethod_0 !== SmoothStat$Method$LOESS_getInstance()) {\n return false;\n }if (rowCount <= this.loessCriticalSize_0) {\n return false;\n }return true;\n };\n SmoothStat.prototype.applySampling_0 = function (data, messageConsumer) {\n var msg = 'LOESS drew a random sample with max_n=' + this.loessCriticalSize_0 + ', seed=' + this.samplingSeed_0.toString();\n messageConsumer(msg);\n return SamplingUtil_getInstance().sampleWithoutReplacement_egh5ya$(this.loessCriticalSize_0, Random_0(this.samplingSeed_0), data);\n };\n SmoothStat.prototype.apply_kdy6bf$$default = function (data_0, statCtx, messageConsumer) {\n if (!this.hasRequiredValues_xht41f$(data_0, [Aes$Companion_getInstance().Y])) {\n return this.withEmptyStatValues();\n }var data_1 = data_0;\n if (this.needSampling_za3lpa$(data_1.rowCount())) {\n data_1 = this.applySampling_0(data_1, messageConsumer);\n }var valuesY = data_1.getNumeric_8xm3sj$(TransformVar_getInstance().Y);\n if (valuesY.size < 3) {\n return this.withEmptyStatValues();\n }var valuesX;\n if (data_1.has_8xm3sj$(TransformVar_getInstance().X)) {\n valuesX = data_1.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n } else {\n valuesX = ArrayList_init();\n for (var i = 0; i !== valuesY.size; ++i) {\n valuesX.add_11rb$(i);\n }\n }\n if (data.SeriesUtil.range_l63ks6$(valuesX) == null)\n return this.withEmptyStatValues();\n var statX;\n var statY;\n var statMinY;\n var statMaxY;\n var statSE;\n var statValues = this.applySmoothing_0(valuesX, valuesY);\n statX = ensureNotNull(statValues.get_11rb$(Stats_getInstance().X));\n statY = ensureNotNull(statValues.get_11rb$(Stats_getInstance().Y));\n statMinY = ensureNotNull(statValues.get_11rb$(Stats_getInstance().Y_MIN));\n statMaxY = ensureNotNull(statValues.get_11rb$(Stats_getInstance().Y_MAX));\n statSE = ensureNotNull(statValues.get_11rb$(Stats_getInstance().SE));\n var statData = DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().Y, statY);\n if (this.displayConfidenceInterval_0) {\n statData.putNumeric_s1rqo9$(Stats_getInstance().Y_MIN, statMinY).putNumeric_s1rqo9$(Stats_getInstance().Y_MAX, statMaxY).putNumeric_s1rqo9$(Stats_getInstance().SE, statSE);\n }return statData.build();\n };\n SmoothStat.prototype.applySmoothing_0 = function (valuesX, valuesY) {\n var tmp$, tmp$_0, tmp$_1;\n var statX = ArrayList_init();\n var statY = ArrayList_init();\n var statMinY = ArrayList_init();\n var statMaxY = ArrayList_init();\n var statSE = ArrayList_init();\n var result = HashMap_init();\n var key = Stats_getInstance().X;\n result.put_xwzc9p$(key, statX);\n var key_0 = Stats_getInstance().Y;\n result.put_xwzc9p$(key_0, statY);\n var key_1 = Stats_getInstance().Y_MIN;\n result.put_xwzc9p$(key_1, statMinY);\n var key_2 = Stats_getInstance().Y_MAX;\n result.put_xwzc9p$(key_2, statMaxY);\n var key_3 = Stats_getInstance().SE;\n result.put_xwzc9p$(key_3, statSE);\n switch (this.smoothingMethod_0.name) {\n case 'LM':\n if (!(this.polynomialDegree_0 >= 1)) {\n var message = 'Degree of polynomial regression must be at least 1';\n throw IllegalArgumentException_init(message.toString());\n }\n if (this.polynomialDegree_0 === 1) {\n tmp$ = new LinearRegression(valuesX, valuesY, this.confidenceLevel_0);\n } else {\n if (PolynomialRegression$Companion_getInstance().canBeComputed_fgqkrm$(valuesX, valuesY, this.polynomialDegree_0)) {\n tmp$ = new PolynomialRegression(valuesX, valuesY, this.confidenceLevel_0, this.polynomialDegree_0);\n } else {\n return result;\n }\n }\n\n break;\n case 'LOESS':\n var evaluator = new LocalPolynomialRegression(valuesX, valuesY, this.confidenceLevel_0, this.span_0);\n if (evaluator.canCompute) {\n tmp$ = evaluator;\n } else {\n return result;\n }\n\n break;\n default:throw IllegalArgumentException_init('Unsupported smoother method: ' + this.smoothingMethod_0 + \" (only 'lm' and 'loess' methods are currently available)\");\n }\n var regression = tmp$;\n tmp$_0 = data.SeriesUtil.range_l63ks6$(valuesX);\n if (tmp$_0 == null) {\n return result;\n }var rangeX = tmp$_0;\n var startX = rangeX.lowerEnd;\n var spanX = rangeX.upperEnd - startX;\n var stepX = spanX / (this.smootherPointCount_0 - 1 | 0);\n tmp$_1 = this.smootherPointCount_0;\n for (var i = 0; i < tmp$_1; i++) {\n var x = startX + i * stepX;\n var eval_0 = regression.evalX_14dthe$(coerceIn(x, rangeX.lowerEnd, rangeX.upperEnd));\n statX.add_11rb$(x);\n statY.add_11rb$(eval_0.y);\n statMinY.add_11rb$(eval_0.ymin);\n statMaxY.add_11rb$(eval_0.ymax);\n statSE.add_11rb$(eval_0.se);\n }\n return result;\n };\n SmoothStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SmoothStat',\n interfaces: [BaseStat]\n };\n function Stats() {\n Stats_instance = this;\n this.X = new DataFrame$Variable('..x..', DataFrame$Variable$Source$STAT_getInstance(), 'x');\n this.Y = new DataFrame$Variable('..y..', DataFrame$Variable$Source$STAT_getInstance(), 'y');\n this.COUNT = new DataFrame$Variable('..count..', DataFrame$Variable$Source$STAT_getInstance(), 'count');\n this.DENSITY = new DataFrame$Variable('..density..', DataFrame$Variable$Source$STAT_getInstance(), 'density');\n this.Y_MIN = new DataFrame$Variable('..ymin..', DataFrame$Variable$Source$STAT_getInstance(), 'y min');\n this.Y_MAX = new DataFrame$Variable('..ymax..', DataFrame$Variable$Source$STAT_getInstance(), 'y max');\n this.SE = new DataFrame$Variable('..se..', DataFrame$Variable$Source$STAT_getInstance(), 'standard error');\n this.LEVEL = new DataFrame$Variable('..level..', DataFrame$Variable$Source$STAT_getInstance(), 'level');\n this.LOWER = new DataFrame$Variable('..lower..', DataFrame$Variable$Source$STAT_getInstance(), 'lower');\n this.MIDDLE = new DataFrame$Variable('..middle..', DataFrame$Variable$Source$STAT_getInstance(), 'middle');\n this.UPPER = new DataFrame$Variable('..upper..', DataFrame$Variable$Source$STAT_getInstance(), 'upper');\n this.WIDTH = new DataFrame$Variable('..width..', DataFrame$Variable$Source$STAT_getInstance(), 'width');\n this.CORR = new DataFrame$Variable('..corr..', DataFrame$Variable$Source$STAT_getInstance(), 'corr');\n this.CORR_ABS = new DataFrame$Variable('..corr_abs..', DataFrame$Variable$Source$STAT_getInstance(), 'corr_abs');\n this.SCALED = new DataFrame$Variable('..scaled..', DataFrame$Variable$Source$STAT_getInstance(), 'scaled');\n this.GROUP = new DataFrame$Variable('..group..', DataFrame$Variable$Source$STAT_getInstance(), 'group');\n this.IDENTITY = new Stats$IdentityStat();\n var tmp$;\n var variableList = listOf([this.X, this.Y, this.COUNT, this.DENSITY, this.Y_MIN, this.Y_MAX, this.SE, this.LEVEL, this.LOWER, this.MIDDLE, this.UPPER, this.WIDTH, this.SCALED, this.GROUP, this.CORR, this.CORR_ABS]);\n var result = HashMap_init();\n tmp$ = variableList.iterator();\n while (tmp$.hasNext()) {\n var variable = tmp$.next();\n var key = variable.name;\n result.put_xwzc9p$(key, variable);\n }\n this.VARS_0 = result;\n }\n Stats.prototype.isStatVar_61zpoe$ = function (varName) {\n return this.VARS_0.containsKey_11rb$(varName);\n };\n Stats.prototype.statVar_61zpoe$ = function (varName) {\n if (!this.VARS_0.containsKey_11rb$(varName)) {\n var message = 'Unknown stat variable ' + varName;\n throw IllegalArgumentException_init(message.toString());\n }return ensureNotNull(this.VARS_0.get_11rb$(varName));\n };\n Stats.prototype.defaultMapping_qbwusa$ = function (stat) {\n var tmp$;\n var map = HashMap_init();\n tmp$ = Aes$Companion_getInstance().values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n if (stat.hasDefaultMapping_896ixz$(aes)) {\n var variable = stat.getDefaultMapping_896ixz$(aes);\n map.put_xwzc9p$(aes, variable);\n }}\n return map;\n };\n Stats.prototype.count = function () {\n return new CountStat();\n };\n Stats.prototype.bin_yyf5ez$ = function (binCount, binWidth, center, boundary) {\n if (binCount === void 0)\n binCount = 30;\n if (binWidth === void 0)\n binWidth = null;\n if (center === void 0)\n center = null;\n if (boundary === void 0)\n boundary = null;\n var xPosKind = BinStat$XPosKind$NONE_getInstance();\n var xPosValue = 0.0;\n if (boundary != null) {\n xPosKind = BinStat$XPosKind$BOUNDARY_getInstance();\n xPosValue = boundary;\n } else if (center != null) {\n xPosKind = BinStat$XPosKind$CENTER_getInstance();\n xPosValue = center;\n }return new BinStat(binCount, binWidth, xPosKind, xPosValue);\n };\n Stats.prototype.smooth_aam2id$ = function (smootherPointCount, smoothingMethod, confidenceLevel, displayConfidenceInterval, span, polynomialDegree, loessCriticalSize, samplingSeed) {\n if (smootherPointCount === void 0)\n smootherPointCount = 80;\n if (smoothingMethod === void 0)\n smoothingMethod = SmoothStat$Companion_getInstance().DEF_SMOOTHING_METHOD;\n if (confidenceLevel === void 0)\n confidenceLevel = SmoothStat$Companion_getInstance().DEF_CONFIDENCE_LEVEL;\n if (displayConfidenceInterval === void 0)\n displayConfidenceInterval = SmoothStat$Companion_getInstance().DEF_DISPLAY_CONFIDENCE_INTERVAL;\n if (span === void 0)\n span = SmoothStat$Companion_getInstance().DEF_SPAN;\n if (polynomialDegree === void 0)\n polynomialDegree = 1;\n if (loessCriticalSize === void 0)\n loessCriticalSize = 1000;\n if (samplingSeed === void 0)\n samplingSeed = SmoothStat$Companion_getInstance().DEF_SAMPLING_SEED;\n return new SmoothStat(smootherPointCount, smoothingMethod, confidenceLevel, displayConfidenceInterval, span, polynomialDegree, loessCriticalSize, samplingSeed);\n };\n Stats.prototype.corr_6cvmjw$ = function (correlationMethod, type, fillDiagonal, threshold) {\n if (correlationMethod === void 0)\n correlationMethod = CorrelationStat$Companion_getInstance().DEF_CORRELATION_METHOD;\n if (type === void 0)\n type = CorrelationStat$Companion_getInstance().DEF_TYPE;\n if (fillDiagonal === void 0)\n fillDiagonal = CorrelationStat$Companion_getInstance().DEF_FILL_DIAGONAL;\n if (threshold === void 0)\n threshold = CorrelationStat$Companion_getInstance().DEF_THRESHOLD;\n return new CorrelationStat(correlationMethod, type, fillDiagonal, threshold);\n };\n Stats.prototype.contour_tvwy6j$ = function (binCount, binWidth) {\n if (binCount === void 0)\n binCount = 10;\n if (binWidth === void 0)\n binWidth = null;\n return new ContourStat(binCount, binWidth);\n };\n Stats.prototype.contourf_tvwy6j$ = function (binCount, binWidth) {\n if (binCount === void 0)\n binCount = 10;\n if (binWidth === void 0)\n binWidth = null;\n return new ContourfStat(binCount, binWidth);\n };\n Stats.prototype.boxplot_8555vt$ = function (whiskerIQRRatio, computeWidth) {\n if (whiskerIQRRatio === void 0)\n whiskerIQRRatio = BoxplotStat$Companion_getInstance().DEF_WHISKER_IQR_RATIO;\n if (computeWidth === void 0)\n computeWidth = BoxplotStat$Companion_getInstance().DEF_COMPUTE_WIDTH;\n return new BoxplotStat(whiskerIQRRatio, computeWidth);\n };\n Stats.prototype.density_s1yna4$ = function (bandWidth, bandWidthMethod, adjust, kernel, n, fullScalMax) {\n if (bandWidth === void 0)\n bandWidth = null;\n if (bandWidthMethod === void 0)\n bandWidthMethod = DensityStat$Companion_getInstance().DEF_BW;\n if (adjust === void 0)\n adjust = DensityStat$Companion_getInstance().DEF_ADJUST;\n if (kernel === void 0)\n kernel = DensityStat$Companion_getInstance().DEF_KERNEL;\n if (n === void 0)\n n = 512;\n if (fullScalMax === void 0)\n fullScalMax = 5000;\n return new DensityStat(bandWidth, bandWidthMethod, adjust, kernel, n, fullScalMax);\n };\n Stats.prototype.density2d_izm592$ = function (bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth) {\n if (bandWidthX === void 0)\n bandWidthX = null;\n if (bandWidthY === void 0)\n bandWidthY = null;\n if (bandWidthMethod === void 0)\n bandWidthMethod = AbstractDensity2dStat$Companion_getInstance().DEF_BW;\n if (adjust === void 0)\n adjust = AbstractDensity2dStat$Companion_getInstance().DEF_ADJUST;\n if (kernel === void 0)\n kernel = AbstractDensity2dStat$Companion_getInstance().DEF_KERNEL;\n if (nX === void 0)\n nX = 100;\n if (nY === void 0)\n nY = 100;\n if (isContour === void 0)\n isContour = AbstractDensity2dStat$Companion_getInstance().DEF_CONTOUR;\n if (binCount === void 0)\n binCount = 10;\n if (binWidth === void 0)\n binWidth = AbstractDensity2dStat$Companion_getInstance().DEF_BIN_WIDTH;\n return new Density2dStat(bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth);\n };\n Stats.prototype.density2df_izm592$ = function (bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth) {\n if (bandWidthX === void 0)\n bandWidthX = null;\n if (bandWidthY === void 0)\n bandWidthY = null;\n if (adjust === void 0)\n adjust = AbstractDensity2dStat$Companion_getInstance().DEF_ADJUST;\n if (kernel === void 0)\n kernel = AbstractDensity2dStat$Companion_getInstance().DEF_KERNEL;\n if (nX === void 0)\n nX = 100;\n if (nY === void 0)\n nY = 100;\n if (isContour === void 0)\n isContour = AbstractDensity2dStat$Companion_getInstance().DEF_CONTOUR;\n if (binCount === void 0)\n binCount = 10;\n if (binWidth === void 0)\n binWidth = AbstractDensity2dStat$Companion_getInstance().DEF_BIN_WIDTH;\n return new Density2dfStat(bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth);\n };\n function Stats$IdentityStat() {\n BaseStat.call(this, emptyMap());\n }\n Stats$IdentityStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n };\n Stats$IdentityStat.prototype.consumes = function () {\n return emptyList();\n };\n Stats$IdentityStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'IdentityStat',\n interfaces: [BaseStat]\n };\n Stats.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Stats',\n interfaces: []\n };\n var Stats_instance = null;\n function Stats_getInstance() {\n if (Stats_instance === null) {\n new Stats();\n }return Stats_instance;\n }\n function AbstractRealDistribution() {\n AbstractRealDistribution$Companion_getInstance();\n this.solverAbsoluteAccuracy_ojqt9g$_0 = AbstractRealDistribution$Companion_getInstance().SOLVER_DEFAULT_ABSOLUTE_ACCURACY;\n }\n Object.defineProperty(AbstractRealDistribution.prototype, 'solverAbsoluteAccuracy', {\n configurable: true,\n get: function () {\n return this.solverAbsoluteAccuracy_ojqt9g$_0;\n }\n });\n AbstractRealDistribution.prototype.cumulativeProbability_lu1900$ = function (x0, x1) {\n if (x0 > x1) {\n throw IllegalStateException_init(('NumberIsTooLarge - x0:' + x0 + ', x1:' + x1).toString());\n }return this.cumulativeProbability_14dthe$(x1) - this.cumulativeProbability_14dthe$(x0);\n };\n function AbstractRealDistribution$inverseCumulativeProbability$ObjectLiteral(this$AbstractRealDistribution, closure$p) {\n this.this$AbstractRealDistribution = this$AbstractRealDistribution;\n this.closure$p = closure$p;\n }\n AbstractRealDistribution$inverseCumulativeProbability$ObjectLiteral.prototype.value_14dthe$ = function (x) {\n return this.this$AbstractRealDistribution.cumulativeProbability_14dthe$(x) - this.closure$p;\n };\n AbstractRealDistribution$inverseCumulativeProbability$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [UnivariateFunction]\n };\n AbstractRealDistribution.prototype.inverseCumulativeProbability_14dthe$ = function (p) {\n if (p < 0.0 || p > 1.0) {\n throw IllegalStateException_init(('OutOfRange [0, 1] - p' + p).toString());\n }var lowerBound = this.supportLowerBound;\n if (p === 0.0) {\n return lowerBound;\n }var upperBound = this.supportUpperBound;\n if (p === 1.0) {\n return upperBound;\n }var mu = this.numericalMean;\n var x = this.numericalVariance;\n var sig = JsMath.sqrt(x);\n var chebyshevApplies;\n chebyshevApplies = !(isInfinite(mu) || isNaN_0(mu) || isInfinite(sig) || isNaN_0(sig));\n if (lowerBound === kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY) {\n if (chebyshevApplies) {\n var x_0 = (1.0 - p) / p;\n lowerBound = mu - sig * JsMath.sqrt(x_0);\n } else {\n lowerBound = -1.0;\n while (this.cumulativeProbability_14dthe$(lowerBound) >= p) {\n lowerBound *= 2.0;\n }\n }\n }if (upperBound === kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY) {\n if (chebyshevApplies) {\n var x_1 = p / (1.0 - p);\n upperBound = mu + sig * JsMath.sqrt(x_1);\n } else {\n upperBound = 1.0;\n while (this.cumulativeProbability_14dthe$(upperBound) < p) {\n upperBound *= 2.0;\n }\n }\n }var toSolve = new AbstractRealDistribution$inverseCumulativeProbability$ObjectLiteral(this, p);\n var x_2 = UnivariateSolverUtils_getInstance().solve_wb66u3$(toSolve, lowerBound, upperBound, this.solverAbsoluteAccuracy);\n if (!this.isSupportConnected) {\n var dx = this.solverAbsoluteAccuracy;\n if (x_2 - dx >= this.supportLowerBound) {\n var px = this.cumulativeProbability_14dthe$(x_2);\n if (this.cumulativeProbability_14dthe$(x_2 - dx) === px) {\n upperBound = x_2;\n while (upperBound - lowerBound > dx) {\n var midPoint = 0.5 * (lowerBound + upperBound);\n if (this.cumulativeProbability_14dthe$(midPoint) < px) {\n lowerBound = midPoint;\n } else {\n upperBound = midPoint;\n }\n }\n return upperBound;\n }}}return x_2;\n };\n function AbstractRealDistribution$Companion() {\n AbstractRealDistribution$Companion_instance = this;\n this.SOLVER_DEFAULT_ABSOLUTE_ACCURACY = 1.0E-6;\n this.serialVersionUID_0 = L_38038050983108802;\n }\n AbstractRealDistribution$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AbstractRealDistribution$Companion_instance = null;\n function AbstractRealDistribution$Companion_getInstance() {\n if (AbstractRealDistribution$Companion_instance === null) {\n new AbstractRealDistribution$Companion();\n }return AbstractRealDistribution$Companion_instance;\n }\n AbstractRealDistribution.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractRealDistribution',\n interfaces: [RealDistribution]\n };\n function AbstractUnivariateSolver() {\n }\n AbstractUnivariateSolver.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractUnivariateSolver',\n interfaces: [UnivariateSolver, BaseAbstractUnivariateSolver]\n };\n function AbstractUnivariateSolver_init(absoluteAccuracy, $this) {\n $this = $this || Object.create(AbstractUnivariateSolver.prototype);\n BaseAbstractUnivariateSolver_init(absoluteAccuracy, $this);\n AbstractUnivariateSolver.call($this);\n return $this;\n }\n function AbstractUnivariateSolver_init_0(relativeAccuracy, absoluteAccuracy, $this) {\n $this = $this || Object.create(AbstractUnivariateSolver.prototype);\n BaseAbstractUnivariateSolver.call($this, relativeAccuracy, absoluteAccuracy);\n AbstractUnivariateSolver.call($this);\n return $this;\n }\n function AbstractUnivariateSolver_init_1(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, $this) {\n $this = $this || Object.create(AbstractUnivariateSolver.prototype);\n BaseAbstractUnivariateSolver.call($this, relativeAccuracy, absoluteAccuracy, functionValueAccuracy);\n AbstractUnivariateSolver.call($this);\n return $this;\n }\n function AllowedSolution(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function AllowedSolution_initFields() {\n AllowedSolution_initFields = function () {\n };\n AllowedSolution$ANY_SIDE_instance = new AllowedSolution('ANY_SIDE', 0);\n AllowedSolution$LEFT_SIDE_instance = new AllowedSolution('LEFT_SIDE', 1);\n AllowedSolution$RIGHT_SIDE_instance = new AllowedSolution('RIGHT_SIDE', 2);\n AllowedSolution$BELOW_SIDE_instance = new AllowedSolution('BELOW_SIDE', 3);\n AllowedSolution$ABOVE_SIDE_instance = new AllowedSolution('ABOVE_SIDE', 4);\n }\n var AllowedSolution$ANY_SIDE_instance;\n function AllowedSolution$ANY_SIDE_getInstance() {\n AllowedSolution_initFields();\n return AllowedSolution$ANY_SIDE_instance;\n }\n var AllowedSolution$LEFT_SIDE_instance;\n function AllowedSolution$LEFT_SIDE_getInstance() {\n AllowedSolution_initFields();\n return AllowedSolution$LEFT_SIDE_instance;\n }\n var AllowedSolution$RIGHT_SIDE_instance;\n function AllowedSolution$RIGHT_SIDE_getInstance() {\n AllowedSolution_initFields();\n return AllowedSolution$RIGHT_SIDE_instance;\n }\n var AllowedSolution$BELOW_SIDE_instance;\n function AllowedSolution$BELOW_SIDE_getInstance() {\n AllowedSolution_initFields();\n return AllowedSolution$BELOW_SIDE_instance;\n }\n var AllowedSolution$ABOVE_SIDE_instance;\n function AllowedSolution$ABOVE_SIDE_getInstance() {\n AllowedSolution_initFields();\n return AllowedSolution$ABOVE_SIDE_instance;\n }\n AllowedSolution.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AllowedSolution',\n interfaces: [Enum]\n };\n function AllowedSolution$values() {\n return [AllowedSolution$ANY_SIDE_getInstance(), AllowedSolution$LEFT_SIDE_getInstance(), AllowedSolution$RIGHT_SIDE_getInstance(), AllowedSolution$BELOW_SIDE_getInstance(), AllowedSolution$ABOVE_SIDE_getInstance()];\n }\n AllowedSolution.values = AllowedSolution$values;\n function AllowedSolution$valueOf(name) {\n switch (name) {\n case 'ANY_SIDE':\n return AllowedSolution$ANY_SIDE_getInstance();\n case 'LEFT_SIDE':\n return AllowedSolution$LEFT_SIDE_getInstance();\n case 'RIGHT_SIDE':\n return AllowedSolution$RIGHT_SIDE_getInstance();\n case 'BELOW_SIDE':\n return AllowedSolution$BELOW_SIDE_getInstance();\n case 'ABOVE_SIDE':\n return AllowedSolution$ABOVE_SIDE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.math3.AllowedSolution.' + name);\n }\n }\n AllowedSolution.valueOf_61zpoe$ = AllowedSolution$valueOf;\n function BaseAbstractUnivariateSolver(relativeAccuracy, absoluteAccuracy, functionValueAccuracy) {\n BaseAbstractUnivariateSolver$Companion_getInstance();\n if (functionValueAccuracy === void 0)\n functionValueAccuracy = BaseAbstractUnivariateSolver$Companion_getInstance().DEFAULT_FUNCTION_VALUE_ACCURACY_0;\n this.relativeAccuracy_uztt24$_0 = relativeAccuracy;\n this.absoluteAccuracy_8af9zt$_0 = absoluteAccuracy;\n this.functionValueAccuracy_drq8h3$_0 = functionValueAccuracy;\n this.myEvaluations_xyk8ps$_0 = new Incrementor();\n this.min_3rehp5$_0 = 0;\n this.max_3rec07$_0 = 0;\n this.startValue_pn384a$_0 = 0;\n this.function_54gwsx$_0 = null;\n this.evaluations_io7904$_0 = this.myEvaluations_xyk8ps$_0.count;\n }\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'relativeAccuracy', {\n get: function () {\n return this.relativeAccuracy_uztt24$_0;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'absoluteAccuracy', {\n get: function () {\n return this.absoluteAccuracy_8af9zt$_0;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'functionValueAccuracy', {\n get: function () {\n return this.functionValueAccuracy_drq8h3$_0;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'min', {\n configurable: true,\n get: function () {\n return this.min_3rehp5$_0;\n },\n set: function (min) {\n this.min_3rehp5$_0 = min;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'max', {\n configurable: true,\n get: function () {\n return this.max_3rec07$_0;\n },\n set: function (max) {\n this.max_3rec07$_0 = max;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'startValue', {\n configurable: true,\n get: function () {\n return this.startValue_pn384a$_0;\n },\n set: function (startValue) {\n this.startValue_pn384a$_0 = startValue;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'maxEvaluations', {\n configurable: true,\n get: function () {\n return this.myEvaluations_xyk8ps$_0.maximalCount;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'evaluations', {\n configurable: true,\n get: function () {\n return this.evaluations_io7904$_0;\n }\n });\n BaseAbstractUnivariateSolver.prototype.computeObjectiveValue_14dthe$ = function (point) {\n this.incrementEvaluationCount();\n return ensureNotNull(this.function_54gwsx$_0).value_14dthe$(point);\n };\n BaseAbstractUnivariateSolver.prototype.setup_4y3h91$ = function (maxEval, f, min, max, startValue) {\n this.min = min;\n this.max = max;\n this.startValue = startValue;\n this.function_54gwsx$_0 = f;\n this.myEvaluations_xyk8ps$_0.maximalCount = maxEval;\n this.myEvaluations_xyk8ps$_0.resetCount();\n };\n BaseAbstractUnivariateSolver.prototype.solve_4y3h91$ = function (maxEval, f, min, max, startValue) {\n this.setup_4y3h91$(maxEval, f, min, max, startValue);\n return this.doSolve();\n };\n BaseAbstractUnivariateSolver.prototype.solve_rmnly1$ = function (maxEval, f, min, max) {\n return this.solve_4y3h91$(maxEval, f, min, max, min + 0.5 * (max - min));\n };\n BaseAbstractUnivariateSolver.prototype.solve_t5uqbd$ = function (maxEval, f, startValue) {\n return this.solve_4y3h91$(maxEval, f, kotlin_js_internal_DoubleCompanionObject.NaN, kotlin_js_internal_DoubleCompanionObject.NaN, startValue);\n };\n BaseAbstractUnivariateSolver.prototype.isBracketing_lu1900$ = function (lower, upper) {\n return UnivariateSolverUtils_getInstance().isBracketing_ljmp9$(ensureNotNull(this.function_54gwsx$_0), lower, upper);\n };\n BaseAbstractUnivariateSolver.prototype.isSequence_yvo9jy$ = function (start, mid, end) {\n return UnivariateSolverUtils_getInstance().isSequence_yvo9jy$(start, mid, end);\n };\n BaseAbstractUnivariateSolver.prototype.verifyInterval_lu1900$ = function (lower, upper) {\n UnivariateSolverUtils_getInstance().verifyInterval_lu1900$(lower, upper);\n };\n BaseAbstractUnivariateSolver.prototype.verifySequence_yvo9jy$ = function (lower, initial, upper) {\n UnivariateSolverUtils_getInstance().verifySequence_yvo9jy$(lower, initial, upper);\n };\n BaseAbstractUnivariateSolver.prototype.verifyBracketing_lu1900$ = function (lower, upper) {\n UnivariateSolverUtils_getInstance().verifyBracketing_ljmp9$(ensureNotNull(this.function_54gwsx$_0), lower, upper);\n };\n BaseAbstractUnivariateSolver.prototype.incrementEvaluationCount = function () {\n this.myEvaluations_xyk8ps$_0.incrementCount();\n };\n function BaseAbstractUnivariateSolver$Companion() {\n BaseAbstractUnivariateSolver$Companion_instance = this;\n this.DEFAULT_RELATIVE_ACCURACY_0 = 1.0E-14;\n this.DEFAULT_FUNCTION_VALUE_ACCURACY_0 = 1.0E-15;\n }\n BaseAbstractUnivariateSolver$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BaseAbstractUnivariateSolver$Companion_instance = null;\n function BaseAbstractUnivariateSolver$Companion_getInstance() {\n if (BaseAbstractUnivariateSolver$Companion_instance === null) {\n new BaseAbstractUnivariateSolver$Companion();\n }return BaseAbstractUnivariateSolver$Companion_instance;\n }\n BaseAbstractUnivariateSolver.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BaseAbstractUnivariateSolver',\n interfaces: [BaseUnivariateSolver]\n };\n function BaseAbstractUnivariateSolver_init(absoluteAccuracy, $this) {\n $this = $this || Object.create(BaseAbstractUnivariateSolver.prototype);\n BaseAbstractUnivariateSolver.call($this, BaseAbstractUnivariateSolver$Companion_getInstance().DEFAULT_RELATIVE_ACCURACY_0, absoluteAccuracy, BaseAbstractUnivariateSolver$Companion_getInstance().DEFAULT_FUNCTION_VALUE_ACCURACY_0);\n return $this;\n }\n function BaseUnivariateSolver() {\n }\n BaseUnivariateSolver.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'BaseUnivariateSolver',\n interfaces: []\n };\n function Beta() {\n Beta_instance = this;\n this.DEFAULT_EPSILON_0 = 1.0E-14;\n }\n Beta.prototype.regularizedBeta_88ee24$ = function (x, a, b, maxIterations) {\n return this.regularizedBeta_tychlm$(x, a, b, this.DEFAULT_EPSILON_0, maxIterations);\n };\n function Beta$regularizedBeta$ObjectLiteral(closure$b, closure$a) {\n this.closure$b = closure$b;\n this.closure$a = closure$a;\n ContinuedFraction.call(this);\n }\n Beta$regularizedBeta$ObjectLiteral.prototype.getB_5wr77w$ = function (n, x) {\n var ret;\n var m;\n if (n % 2 === 0) {\n m = n / 2.0;\n ret = m * (this.closure$b - m) * x / ((this.closure$a + 2 * m - 1) * (this.closure$a + 2 * m));\n } else {\n m = (n - 1.0) / 2.0;\n ret = -((this.closure$a + m) * (this.closure$a + this.closure$b + m) * x) / ((this.closure$a + 2 * m) * (this.closure$a + 2 * m + 1.0));\n }\n return ret;\n };\n Beta$regularizedBeta$ObjectLiteral.prototype.getA_5wr77w$ = function (n, x) {\n return 1.0;\n };\n Beta$regularizedBeta$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ContinuedFraction]\n };\n Beta.prototype.regularizedBeta_tychlm$ = function (x, a, b, epsilon, maxIterations) {\n if (epsilon === void 0)\n epsilon = this.DEFAULT_EPSILON_0;\n if (maxIterations === void 0)\n maxIterations = 2147483647;\n var ret;\n if (isNaN_0(x) || isNaN_0(a) || isNaN_0(b) || x < 0 || x > 1 || a <= 0.0 || b <= 0.0) {\n ret = kotlin_js_internal_DoubleCompanionObject.NaN;\n } else if (x > (a + 1.0) / (a + b + 2.0)) {\n ret = 1.0 - this.regularizedBeta_tychlm$(1.0 - x, b, a, epsilon, maxIterations);\n } else {\n var fraction = new Beta$regularizedBeta$ObjectLiteral(b, a);\n var tmp$ = a * JsMath.log(x);\n var x_0 = 1.0 - x;\n var x_1 = tmp$ + b * JsMath.log(x_0) - JsMath.log(a) - this.logBeta_88ee24$(a, b, epsilon, maxIterations);\n ret = JsMath.exp(x_1) * 1.0 / fraction.evaluate_syxxoe$(x, epsilon, maxIterations);\n }\n return ret;\n };\n Beta.prototype.logBeta_88ee24$ = function (a, b, epsilon, maxIterations) {\n if (epsilon === void 0)\n epsilon = this.DEFAULT_EPSILON_0;\n if (maxIterations === void 0)\n maxIterations = 2147483647;\n var ret;\n if (isNaN_0(a) || isNaN_0(b) || a <= 0.0 || b <= 0.0) {\n ret = kotlin_js_internal_DoubleCompanionObject.NaN;\n } else {\n ret = Gamma_getInstance().logGamma_14dthe$(a) + Gamma_getInstance().logGamma_14dthe$(b) - Gamma_getInstance().logGamma_14dthe$(a + b);\n }\n return ret;\n };\n Beta.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Beta',\n interfaces: []\n };\n var Beta_instance = null;\n function Beta_getInstance() {\n if (Beta_instance === null) {\n new Beta();\n }return Beta_instance;\n }\n function BlockRealMatrix() {\n this.BLOCK_SIZE_0 = 52;\n this.rows_0 = 0;\n this.columns_0 = 0;\n this.blockRows_0 = 0;\n this.blockColumns_0 = 0;\n this.blocks_4giiw5$_0 = this.blocks_4giiw5$_0;\n }\n Object.defineProperty(BlockRealMatrix.prototype, 'blocks_0', {\n configurable: true,\n get: function () {\n if (this.blocks_4giiw5$_0 == null)\n return throwUPAE('blocks');\n return this.blocks_4giiw5$_0;\n },\n set: function (blocks) {\n this.blocks_4giiw5$_0 = blocks;\n }\n });\n BlockRealMatrix.prototype.create_omvvzo$ = function (rows, columns, blockData, copyArray) {\n var tmp$;\n this.rows_0 = rows;\n this.columns_0 = columns;\n this.blockRows_0 = (rows + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n this.blockColumns_0 = (columns + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n var blocksCopyList = ArrayList_init();\n if (!copyArray) {\n this.blocks_0 = blockData;\n }var index = 0;\n tmp$ = this.blockRows_0;\n for (var iBlock = 0; iBlock < tmp$; iBlock++) {\n var iHeight = this.blockHeight_0(iBlock);\n var jBlock = 0;\n while (jBlock < this.blockColumns_0) {\n if (blockData[index].length !== Kotlin.imul(iHeight, this.blockWidth_0(jBlock))) {\n throw IllegalStateException_init(''.toString());\n }if (copyArray) {\n blocksCopyList.add_11rb$(blockData[index].slice());\n }jBlock = jBlock + 1 | 0;\n index = index + 1 | 0;\n }\n }\n if (copyArray) {\n this.blocks_0 = copyToArray(blocksCopyList);\n }};\n BlockRealMatrix.prototype.createBlocksLayout_0 = function (rows, columns) {\n var blockRows = (rows + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n var blockColumns = (columns + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n var blocksList = ArrayList_init();\n var blockIndex = 0;\n for (var iBlock = 0; iBlock < blockRows; iBlock++) {\n var pStart = Kotlin.imul(iBlock, this.BLOCK_SIZE_0);\n var a = pStart + this.BLOCK_SIZE_0 | 0;\n var pEnd = JsMath.min(a, rows);\n var iHeight = pEnd - pStart | 0;\n for (var jBlock = 0; jBlock < blockColumns; jBlock++) {\n var qStart = Kotlin.imul(jBlock, this.BLOCK_SIZE_0);\n var a_0 = qStart + this.BLOCK_SIZE_0 | 0;\n var qEnd = JsMath.min(a_0, columns);\n var jWidth = qEnd - qStart | 0;\n blocksList.add_11rb$(new Float64Array(Kotlin.imul(iHeight, jWidth)));\n blockIndex = blockIndex + 1 | 0;\n }\n }\n return copyToArray(blocksList);\n };\n BlockRealMatrix.prototype.transpose = function () {\n var tmp$, tmp$_0;\n var nRows = this.getRowDimension_0();\n var nCols = this.getColumnDimension_0();\n var out = BlockRealMatrix_init(nCols, nRows);\n var blockIndex = 0;\n tmp$ = this.blockColumns_0;\n for (var iBlock = 0; iBlock < tmp$; iBlock++) {\n tmp$_0 = this.blockRows_0;\n for (var jBlock = 0; jBlock < tmp$_0; jBlock++) {\n var outBlock = out.blocks_0[blockIndex];\n var tBlock = this.blocks_0[Kotlin.imul(jBlock, this.blockColumns_0) + iBlock | 0];\n var pStart = Kotlin.imul(iBlock, this.BLOCK_SIZE_0);\n var a = pStart + this.BLOCK_SIZE_0 | 0;\n var b = this.columns_0;\n var pEnd = JsMath.min(a, b);\n var qStart = Kotlin.imul(jBlock, this.BLOCK_SIZE_0);\n var a_0 = qStart + this.BLOCK_SIZE_0 | 0;\n var b_0 = this.rows_0;\n var qEnd = JsMath.min(a_0, b_0);\n var k = 0;\n for (var p = pStart; p < pEnd; p++) {\n var lInc = pEnd - pStart | 0;\n var l = p - pStart | 0;\n for (var q = qStart; q < qEnd; q++) {\n outBlock[k] = tBlock[l];\n k = k + 1 | 0;\n l = l + lInc | 0;\n }\n }\n blockIndex = blockIndex + 1 | 0;\n }\n }\n return out;\n };\n BlockRealMatrix.prototype.multiply_1dlv11$ = function (m) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (this.getColumnDimension_0() !== m.getRowDimension_0()) {\n throw IllegalStateException_init(('Matrix multiply dimension mismatch: ' + this.getColumnDimension_0() + ' x ' + m.getRowDimension_0()).toString());\n }var out = BlockRealMatrix_init(this.rows_0, m.columns_0);\n var blockIndex = 0;\n tmp$ = out.blockRows_0;\n for (var iBlock = 0; iBlock < tmp$; iBlock++) {\n var pStart = Kotlin.imul(iBlock, this.BLOCK_SIZE_0);\n var a = pStart + this.BLOCK_SIZE_0 | 0;\n var b = this.rows_0;\n var pEnd = JsMath.min(a, b);\n tmp$_0 = out.blockColumns_0;\n for (var jBlock = 0; jBlock < tmp$_0; jBlock++) {\n var jWidth = out.blockWidth_0(jBlock);\n var jWidth2 = jWidth + jWidth | 0;\n var jWidth3 = jWidth2 + jWidth | 0;\n var jWidth4 = jWidth3 + jWidth | 0;\n var outBlock = out.blocks_0[blockIndex];\n tmp$_1 = this.blockColumns_0;\n for (var kBlock = 0; kBlock < tmp$_1; kBlock++) {\n var kWidth = this.blockWidth_0(kBlock);\n var tBlock = this.blocks_0[Kotlin.imul(iBlock, this.blockColumns_0) + kBlock | 0];\n var mBlock = m.blocks_0[Kotlin.imul(kBlock, m.blockColumns_0) + jBlock | 0];\n var k = 0;\n for (var p = pStart; p < pEnd; p++) {\n var lStart = Kotlin.imul(p - pStart | 0, kWidth);\n var lEnd = lStart + kWidth | 0;\n for (var nStart = 0; nStart < jWidth; nStart++) {\n var sum = 0.0;\n var l = lStart;\n var n = nStart;\n while (l < (lEnd - 3 | 0)) {\n sum += tBlock[l] * mBlock[n] + tBlock[l + 1 | 0] * mBlock[n + jWidth | 0] + tBlock[l + 2 | 0] * mBlock[n + jWidth2 | 0] + tBlock[l + 3 | 0] * mBlock[n + jWidth3 | 0];\n l = l + 4 | 0;\n n = n + jWidth4 | 0;\n }\n while (l < lEnd) {\n sum = sum + tBlock[tmp$_2 = l, l = tmp$_2 + 1 | 0, tmp$_2] * mBlock[n];\n n = n + jWidth | 0;\n }\n outBlock[k] = outBlock[k] + sum;\n k = k + 1 | 0;\n }\n }\n }\n blockIndex = blockIndex + 1 | 0;\n }\n }\n return out;\n };\n BlockRealMatrix.prototype.getEntry_vux9f0$ = function (row, column) {\n if (row < 0 || row > this.getRowDimension_0()) {\n throw IllegalStateException_init(('row out of range: ' + row).toString());\n }if (column < 0 || column > this.getColumnDimension_0()) {\n throw IllegalStateException_init(('column out of range: ' + column).toString());\n }var iBlock = row / this.BLOCK_SIZE_0 | 0;\n var jBlock = column / this.BLOCK_SIZE_0 | 0;\n var k = Kotlin.imul(row - Kotlin.imul(iBlock, this.BLOCK_SIZE_0) | 0, this.blockWidth_0(jBlock)) + (column - Kotlin.imul(jBlock, this.BLOCK_SIZE_0)) | 0;\n return this.blocks_0[Kotlin.imul(iBlock, this.blockColumns_0) + jBlock | 0][k];\n };\n BlockRealMatrix.prototype.getRowDimension_0 = function () {\n return this.rows_0;\n };\n BlockRealMatrix.prototype.getColumnDimension_0 = function () {\n return this.columns_0;\n };\n BlockRealMatrix.prototype.blockWidth_0 = function (blockColumn) {\n return blockColumn === (this.blockColumns_0 - 1 | 0) ? this.columns_0 - Kotlin.imul(blockColumn, this.BLOCK_SIZE_0) | 0 : this.BLOCK_SIZE_0;\n };\n BlockRealMatrix.prototype.blockHeight_0 = function (blockRow) {\n return blockRow === (this.blockRows_0 - 1 | 0) ? this.rows_0 - Kotlin.imul(blockRow, this.BLOCK_SIZE_0) | 0 : this.BLOCK_SIZE_0;\n };\n BlockRealMatrix.prototype.toBlocksLayout_n8oub7$ = function (rawData) {\n var rows = rawData.length;\n var columns = rawData[0].length;\n var blockRows = (rows + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n var blockColumns = (columns + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n for (var i = 0; i !== rawData.length; ++i) {\n var length = rawData[i].length;\n if (length !== columns) {\n throw IllegalStateException_init(('Wrong dimension: ' + columns + ', ' + length).toString());\n }}\n var blocksList = ArrayList_init();\n var blockIndex = 0;\n for (var iBlock = 0; iBlock < blockRows; iBlock++) {\n var pStart = Kotlin.imul(iBlock, this.BLOCK_SIZE_0);\n var a = pStart + this.BLOCK_SIZE_0 | 0;\n var pEnd = JsMath.min(a, rows);\n var iHeight = pEnd - pStart | 0;\n for (var jBlock = 0; jBlock < blockColumns; jBlock++) {\n var qStart = Kotlin.imul(jBlock, this.BLOCK_SIZE_0);\n var a_0 = qStart + this.BLOCK_SIZE_0 | 0;\n var qEnd = JsMath.min(a_0, columns);\n var jWidth = qEnd - qStart | 0;\n var block = new Float64Array(Kotlin.imul(iHeight, jWidth));\n blocksList.add_11rb$(block);\n var index = 0;\n for (var p = pStart; p < pEnd; p++) {\n arrayCopy(rawData[p], block, index, qStart, qEnd);\n index = index + jWidth | 0;\n }\n blockIndex = blockIndex + 1 | 0;\n }\n }\n return copyToArray(blocksList);\n };\n BlockRealMatrix.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BlockRealMatrix',\n interfaces: []\n };\n function BlockRealMatrix_init(rows, columns, $this) {\n $this = $this || Object.create(BlockRealMatrix.prototype);\n BlockRealMatrix.call($this);\n $this.rows_0 = rows;\n $this.columns_0 = columns;\n $this.blockRows_0 = (rows + $this.BLOCK_SIZE_0 - 1 | 0) / $this.BLOCK_SIZE_0 | 0;\n $this.blockColumns_0 = (columns + $this.BLOCK_SIZE_0 - 1 | 0) / $this.BLOCK_SIZE_0 | 0;\n $this.blocks_0 = $this.createBlocksLayout_0(rows, columns);\n return $this;\n }\n function BlockRealMatrix_init_0(rawData, $this) {\n $this = $this || Object.create(BlockRealMatrix.prototype);\n BlockRealMatrix.call($this);\n $this.create_omvvzo$(rawData.length, rawData[0].length, $this.toBlocksLayout_n8oub7$(rawData), false);\n return $this;\n }\n function BracketedUnivariateSolver() {\n }\n BracketedUnivariateSolver.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'BracketedUnivariateSolver',\n interfaces: [BaseUnivariateSolver]\n };\n function BrentSolver() {\n BrentSolver$Companion_getInstance();\n }\n BrentSolver.prototype.doSolve = function () {\n var min = this.min;\n var max = this.max;\n var initial = this.startValue;\n var functionValueAccuracy = this.functionValueAccuracy;\n this.verifySequence_yvo9jy$(min, initial, max);\n var yInitial = this.computeObjectiveValue_14dthe$(initial);\n if (JsMath.abs(yInitial) <= functionValueAccuracy) {\n return initial;\n }var yMin = this.computeObjectiveValue_14dthe$(min);\n if (JsMath.abs(yMin) <= functionValueAccuracy) {\n return min;\n }if (yInitial * yMin < 0) {\n return this.brent_0(min, initial, yMin, yInitial);\n }var yMax = this.computeObjectiveValue_14dthe$(max);\n if (JsMath.abs(yMax) <= functionValueAccuracy) {\n return max;\n }if (yInitial * yMax < 0) {\n return this.brent_0(initial, max, yInitial, yMax);\n }throw IllegalStateException_init(('NoBracketing - min: ' + min + ', max: ' + max + ', yMin: ' + yMin + ', yMax: ' + yMax).toString());\n };\n BrentSolver.prototype.brent_0 = function (lo, hi, fLo, fHi) {\n var a = lo;\n var fa = fLo;\n var b = hi;\n var fb = fHi;\n var c = a;\n var fc = fa;\n var d = b - a;\n var e = d;\n var t = this.absoluteAccuracy;\n var eps = this.relativeAccuracy;\n while (true) {\n var x = fc;\n var tmp$ = JsMath.abs(x);\n var x_0 = fb;\n if (tmp$ < JsMath.abs(x_0)) {\n a = b;\n b = c;\n c = a;\n fa = fb;\n fb = fc;\n fc = fa;\n }var tmp$_0 = 2.0 * eps;\n var x_1 = b;\n var tol = tmp$_0 * JsMath.abs(x_1) + t;\n var m = 0.5 * (c - b);\n if (JsMath.abs(m) <= tol || Precision_getInstance().equals_syxxoe$(fb, 0.0)) {\n return b;\n }var x_2 = e;\n var tmp$_1 = JsMath.abs(x_2) < tol;\n if (!tmp$_1) {\n var x_3 = fa;\n var tmp$_2 = JsMath.abs(x_3);\n var x_4 = fb;\n tmp$_1 = tmp$_2 <= JsMath.abs(x_4);\n }if (tmp$_1) {\n d = m;\n e = d;\n } else {\n var s = fb / fa;\n var p;\n var q;\n if (a === c) {\n p = 2.0 * m * s;\n q = 1 - s;\n } else {\n q = fa / fc;\n var r = fb / fc;\n p = s * (2.0 * m * q * (q - r) - (b - a) * (r - 1));\n q = (q - 1) * (r - 1) * (s - 1);\n }\n if (p > 0) {\n q = -q;\n } else {\n p = -p;\n }\n s = e;\n e = d;\n var tmp$_3 = p;\n var tmp$_4 = 1.5 * m * q;\n var x_5 = tol * q;\n var tmp$_5 = tmp$_3 >= tmp$_4 - JsMath.abs(x_5);\n if (!tmp$_5) {\n var tmp$_6 = p;\n var x_6 = 0.5 * s * q;\n tmp$_5 = tmp$_6 >= JsMath.abs(x_6);\n }if (tmp$_5) {\n d = m;\n e = d;\n } else {\n d = p / q;\n }\n }\n a = b;\n fa = fb;\n var x_7 = d;\n if (JsMath.abs(x_7) > tol) {\n b += d;\n } else if (m > 0) {\n b += tol;\n } else {\n b -= tol;\n }\n fb = this.computeObjectiveValue_14dthe$(b);\n if (fb > 0 && fc > 0 || (fb <= 0 && fc <= 0)) {\n c = a;\n fc = fa;\n d = b - a;\n e = d;\n }}\n };\n function BrentSolver$Companion() {\n BrentSolver$Companion_instance = this;\n this.DEFAULT_ABSOLUTE_ACCURACY_0 = 1.0E-6;\n }\n BrentSolver$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BrentSolver$Companion_instance = null;\n function BrentSolver$Companion_getInstance() {\n if (BrentSolver$Companion_instance === null) {\n new BrentSolver$Companion();\n }return BrentSolver$Companion_instance;\n }\n BrentSolver.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BrentSolver',\n interfaces: [AbstractUnivariateSolver]\n };\n function BrentSolver_init(absoluteAccuracy, $this) {\n if (absoluteAccuracy === void 0)\n absoluteAccuracy = BrentSolver$Companion_getInstance().DEFAULT_ABSOLUTE_ACCURACY_0;\n $this = $this || Object.create(BrentSolver.prototype);\n AbstractUnivariateSolver_init(absoluteAccuracy, $this);\n BrentSolver.call($this);\n return $this;\n }\n function BrentSolver_init_0(relativeAccuracy, absoluteAccuracy, $this) {\n $this = $this || Object.create(BrentSolver.prototype);\n AbstractUnivariateSolver_init_0(relativeAccuracy, absoluteAccuracy, $this);\n BrentSolver.call($this);\n return $this;\n }\n function BrentSolver_init_1(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, $this) {\n $this = $this || Object.create(BrentSolver.prototype);\n AbstractUnivariateSolver_init_1(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, $this);\n BrentSolver.call($this);\n return $this;\n }\n function ContinuedFraction() {\n ContinuedFraction$Companion_getInstance();\n }\n ContinuedFraction.prototype.evaluate_12fank$ = function (x, maxIterations) {\n return this.evaluate_syxxoe$(x, ContinuedFraction$Companion_getInstance().DEFAULT_EPSILON_0, maxIterations);\n };\n ContinuedFraction.prototype.evaluate_syxxoe$ = function (x, epsilon, maxIterations) {\n if (epsilon === void 0)\n epsilon = ContinuedFraction$Companion_getInstance().DEFAULT_EPSILON_0;\n if (maxIterations === void 0)\n maxIterations = 2147483647;\n var p0 = 1.0;\n var p1 = this.getA_5wr77w$(0, x);\n var q0 = 0.0;\n var q1 = 1.0;\n var c = p1 / q1;\n var n = 0;\n var relativeError = kotlin_js_internal_DoubleCompanionObject.MAX_VALUE;\n while (n < maxIterations && relativeError > epsilon) {\n n = n + 1 | 0;\n var a = this.getA_5wr77w$(n, x);\n var b = this.getB_5wr77w$(n, x);\n var p2 = a * p1 + b * p0;\n var q2 = a * q1 + b * q0;\n var infinite = false;\n if (isInfinite(p2) || isInfinite(q2)) {\n var scaleFactor = 1.0;\n var lastScaleFactor = 1.0;\n var maxPower = 5;\n var scale = JsMath.max(a, b);\n if (scale <= 0) {\n throw IllegalStateException_init('ConvergenceException'.toString());\n }infinite = true;\n for (var i = 0; i < maxPower; i++) {\n lastScaleFactor = scaleFactor;\n scaleFactor *= scale;\n if (a !== 0.0 && a > b) {\n p2 = p1 / lastScaleFactor + b / scaleFactor * p0;\n q2 = q1 / lastScaleFactor + b / scaleFactor * q0;\n } else if (b !== 0.0) {\n p2 = a / scaleFactor * p1 + p0 / lastScaleFactor;\n q2 = a / scaleFactor * q1 + q0 / lastScaleFactor;\n }infinite = isInfinite(p2) || isInfinite(q2);\n if (!infinite) {\n break;\n }}\n }if (infinite) {\n throw IllegalStateException_init('ConvergenceException'.toString());\n }var r = p2 / q2;\n if (isNaN_0(r)) {\n throw IllegalStateException_init('ConvergenceException'.toString());\n }var x_0 = r / c - 1.0;\n relativeError = JsMath.abs(x_0);\n c = p2 / q2;\n p0 = p1;\n p1 = p2;\n q0 = q1;\n q1 = q2;\n }\n if (n >= maxIterations) {\n throw IllegalStateException_init('MaxCountExceeded'.toString());\n }return c;\n };\n function ContinuedFraction$Companion() {\n ContinuedFraction$Companion_instance = this;\n this.DEFAULT_EPSILON_0 = 1.0E-8;\n }\n ContinuedFraction$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContinuedFraction$Companion_instance = null;\n function ContinuedFraction$Companion_getInstance() {\n if (ContinuedFraction$Companion_instance === null) {\n new ContinuedFraction$Companion();\n }return ContinuedFraction$Companion_instance;\n }\n ContinuedFraction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContinuedFraction',\n interfaces: []\n };\n function mean(xs) {\n return average(xs);\n }\n function correlationPearson(xs, ys) {\n if (!(xs.length === ys.length)) {\n var message = 'Two series must have the same size.';\n throw IllegalArgumentException_init(message.toString());\n }if (!!(xs.length === 0)) {\n var message_0 = \"Can't correlate empty sequences.\";\n throw IllegalArgumentException_init(message_0.toString());\n }var mx = mean(xs);\n var my = mean(ys);\n var cov = 0.0;\n var d2x = 0.0;\n var d2y = 0.0;\n for (var i = 0; i !== xs.length; ++i) {\n var dx = xs[i] - mx;\n var dy = ys[i] - my;\n cov += dx * dy;\n d2x += JsMath.pow(dx, 2);\n d2y += JsMath.pow(dy, 2);\n }\n if (!(d2x !== 0.0 && d2y !== 0.0)) {\n var message_1 = 'Correlation is not defined for sequences with zero variation.';\n throw IllegalArgumentException_init(message_1.toString());\n }var x = d2x * d2y;\n return cov / JsMath.sqrt(x);\n }\n function ForsythePolynomialGenerator(knots) {\n ForsythePolynomialGenerator$Companion_getInstance();\n this.knots_0 = knots;\n this.ps_0 = null;\n if (!!(this.knots_0.length === 0)) {\n var message = 'The knots list must not be empty';\n throw IllegalArgumentException_init(message.toString());\n }this.ps_0 = arrayListOf([new PolynomialFunction(new Float64Array([1.0])), new PolynomialFunction(new Float64Array([-average(this.knots_0), 1.0]))]);\n }\n ForsythePolynomialGenerator.prototype.alphaBeta_0 = function (i) {\n var tmp$, tmp$_0;\n if (!(i === this.ps_0.size)) {\n var message = 'Alpha must be calculated sequentially.';\n throw IllegalArgumentException_init(message.toString());\n }var p = last(this.ps_0);\n var pp = this.ps_0.get_za3lpa$(this.ps_0.size - 2 | 0);\n var sxp = 0.0;\n var sp2 = 0.0;\n var spp2 = 0.0;\n tmp$ = this.knots_0;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var x = tmp$[tmp$_0];\n var $receiver = p.value_14dthe$(x);\n var pv2 = JsMath.pow($receiver, 2);\n var $receiver_0 = pp.value_14dthe$(x);\n var ppv2 = JsMath.pow($receiver_0, 2);\n sxp += x * pv2;\n sp2 += pv2;\n spp2 += ppv2;\n }\n return new Pair_0(sxp / sp2, sp2 / spp2);\n };\n ForsythePolynomialGenerator.prototype.getPolynomial_za3lpa$ = function (n) {\n var tmp$;\n if (!(n >= 0)) {\n var message = 'Degree of Forsythe polynomial must not be negative';\n throw IllegalArgumentException_init(message.toString());\n }if (!(n < this.knots_0.length)) {\n var message_0 = 'Degree of Forsythe polynomial must not exceed knots.size - 1';\n throw IllegalArgumentException_init(message_0.toString());\n }if (n >= this.ps_0.size) {\n var sz = this.ps_0.size;\n tmp$ = n + 1 | 0;\n for (var k = sz; k <= tmp$; k++) {\n var tmp$_0 = this.alphaBeta_0(k);\n var a = tmp$_0.component1()\n , b = tmp$_0.component2();\n var pPrev = last(this.ps_0);\n var pPrevPrev = this.ps_0.get_za3lpa$(this.ps_0.size - 2 | 0);\n var p = ForsythePolynomialGenerator$Companion_getInstance().X.times_3j0b7h$(pPrev).minus_3j0b7h$(times(a, pPrev)).minus_3j0b7h$(times(b, pPrevPrev));\n this.ps_0.add_11rb$(p);\n }\n }return this.ps_0.get_za3lpa$(n);\n };\n function ForsythePolynomialGenerator$Companion() {\n ForsythePolynomialGenerator$Companion_instance = this;\n this.X = new PolynomialFunction(new Float64Array([0.0, 1.0]));\n }\n ForsythePolynomialGenerator$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ForsythePolynomialGenerator$Companion_instance = null;\n function ForsythePolynomialGenerator$Companion_getInstance() {\n if (ForsythePolynomialGenerator$Companion_instance === null) {\n new ForsythePolynomialGenerator$Companion();\n }return ForsythePolynomialGenerator$Companion_instance;\n }\n ForsythePolynomialGenerator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ForsythePolynomialGenerator',\n interfaces: []\n };\n function Gamma() {\n Gamma_instance = this;\n this.GAMMA = 0.5772156649015329;\n this.DEFAULT_EPSILON_0 = 1.0E-14;\n this.LANCZOS_0 = new Float64Array([0.9999999999999971, 57.15623566586292, -59.59796035547549, 14.136097974741746, -0.4919138160976202, 3.399464998481189E-5, 4.652362892704858E-5, -9.837447530487956E-5, 1.580887032249125E-4, -2.1026444172410488E-4, 2.1743961811521265E-4, -1.643181065367639E-4, 8.441822398385275E-5, -2.6190838401581408E-5, 3.6899182659531625E-6]);\n var x = 2.0 * math.PI;\n this.HALF_LOG_2_PI_0 = 0.5 * JsMath.log(x);\n this.C_LIMIT_0 = 49.0;\n this.S_LIMIT_0 = 1.0E-5;\n }\n Gamma.prototype.logGamma_14dthe$ = function (x) {\n var ret;\n if (isNaN_0(x) || x <= 0.0) {\n ret = kotlin_js_internal_DoubleCompanionObject.NaN;\n } else {\n var g = 607.0 / 128.0;\n var sum = 0.0;\n for (var i = this.LANCZOS_0.length - 1 | 0; i >= 1; i--) {\n sum = sum + this.LANCZOS_0[i] / (x + i);\n }\n sum = sum + this.LANCZOS_0[0];\n var tmp = x + g + 0.5;\n var tmp$ = (x + 0.5) * JsMath.log(tmp) - tmp + this.HALF_LOG_2_PI_0;\n var x_0 = sum / x;\n ret = tmp$ + JsMath.log(x_0);\n }\n return ret;\n };\n Gamma.prototype.regularizedGammaP_88ee24$ = function (a, x, epsilon, maxIterations) {\n if (epsilon === void 0)\n epsilon = this.DEFAULT_EPSILON_0;\n if (maxIterations === void 0)\n maxIterations = 2147483647;\n var ret;\n if (isNaN_0(a) || isNaN_0(x) || a <= 0.0 || x < 0.0) {\n ret = kotlin_js_internal_DoubleCompanionObject.NaN;\n } else if (x === 0.0) {\n ret = 0.0;\n } else if (x >= a + 1) {\n ret = 1.0 - this.regularizedGammaQ_88ee24$(a, x, epsilon, maxIterations);\n } else {\n var n = 0.0;\n var an = 1.0 / a;\n var sum = an;\n while (true) {\n var x_0 = an / sum;\n if (!(JsMath.abs(x_0) > epsilon && n < maxIterations && sum < kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY))\n break;\n n = n + 1.0;\n an = an * (x / (a + n));\n sum = sum + an;\n }\n if (n >= maxIterations) {\n throw IllegalStateException_init(('MaxCountExceeded - maxIterations: ' + maxIterations).toString());\n } else if (isInfinite(sum)) {\n ret = 1.0;\n } else {\n var x_1 = -x + a * JsMath.log(x) - this.logGamma_14dthe$(a);\n ret = JsMath.exp(x_1) * sum;\n }\n }\n return ret;\n };\n function Gamma$regularizedGammaQ$ObjectLiteral(closure$a) {\n this.closure$a = closure$a;\n ContinuedFraction.call(this);\n }\n Gamma$regularizedGammaQ$ObjectLiteral.prototype.getA_5wr77w$ = function (n, x) {\n return 2.0 * n + 1.0 - this.closure$a + x;\n };\n Gamma$regularizedGammaQ$ObjectLiteral.prototype.getB_5wr77w$ = function (n, x) {\n return n * (this.closure$a - n);\n };\n Gamma$regularizedGammaQ$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ContinuedFraction]\n };\n Gamma.prototype.regularizedGammaQ_88ee24$ = function (a, x, epsilon, maxIterations) {\n if (epsilon === void 0)\n epsilon = this.DEFAULT_EPSILON_0;\n if (maxIterations === void 0)\n maxIterations = 2147483647;\n var ret;\n if (isNaN_0(a) || isNaN_0(x) || a <= 0.0 || x < 0.0) {\n ret = kotlin_js_internal_DoubleCompanionObject.NaN;\n } else if (x === 0.0) {\n ret = 1.0;\n } else if (x < a + 1.0) {\n ret = 1.0 - this.regularizedGammaP_88ee24$(a, x, epsilon, maxIterations);\n } else {\n var cf = new Gamma$regularizedGammaQ$ObjectLiteral(a);\n ret = 1.0 / cf.evaluate_syxxoe$(x, epsilon, maxIterations);\n var x_0 = -x + a * JsMath.log(x) - this.logGamma_14dthe$(a);\n ret = JsMath.exp(x_0) * ret;\n }\n return ret;\n };\n Gamma.prototype.digamma_14dthe$ = function (x) {\n if (x > 0 && x <= this.S_LIMIT_0) {\n return -this.GAMMA - 1 / x;\n }if (x >= this.C_LIMIT_0) {\n var inv = 1 / (x * x);\n return JsMath.log(x) - 0.5 / x - inv * (1.0 / 12 + inv * (1.0 / 120 - inv / 252));\n }return this.digamma_14dthe$(x + 1) - 1 / x;\n };\n Gamma.prototype.trigamma_14dthe$ = function (x) {\n if (x > 0 && x <= this.S_LIMIT_0) {\n return 1 / (x * x);\n }if (x >= this.C_LIMIT_0) {\n var inv = 1 / (x * x);\n return 1 / x + inv / 2 + inv / x * (1.0 / 6 - inv * (1.0 / 30 + inv / 42));\n }return this.trigamma_14dthe$(x + 1) + 1 / (x * x);\n };\n Gamma.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Gamma',\n interfaces: []\n };\n var Gamma_instance = null;\n function Gamma_getInstance() {\n if (Gamma_instance === null) {\n new Gamma();\n }return Gamma_instance;\n }\n function Incrementor(maximalCount, maxCountCallback) {\n if (maximalCount === void 0)\n maximalCount = 0;\n if (maxCountCallback === void 0)\n maxCountCallback = new Incrementor_init$ObjectLiteral();\n this.maximalCount = maximalCount;\n this.maxCountCallback_0 = maxCountCallback;\n this.count_k39d42$_0 = 0;\n }\n Object.defineProperty(Incrementor.prototype, 'count', {\n configurable: true,\n get: function () {\n return this.count_k39d42$_0;\n },\n set: function (count) {\n this.count_k39d42$_0 = count;\n }\n });\n Incrementor.prototype.canIncrement = function () {\n return this.count < this.maximalCount;\n };\n Incrementor.prototype.incrementCount_za3lpa$ = function (value) {\n for (var i = 0; i < value; i++) {\n this.incrementCount();\n }\n };\n Incrementor.prototype.incrementCount = function () {\n if ((this.count = this.count + 1 | 0, this.count) > this.maximalCount) {\n this.maxCountCallback_0.trigger_za3lpa$(this.maximalCount);\n }};\n Incrementor.prototype.resetCount = function () {\n this.count = 0;\n };\n function Incrementor$MaxCountExceededCallback() {\n }\n Incrementor$MaxCountExceededCallback.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'MaxCountExceededCallback',\n interfaces: []\n };\n function Incrementor_init$ObjectLiteral() {\n }\n Incrementor_init$ObjectLiteral.prototype.trigger_za3lpa$ = function (maximalCount) {\n throw IllegalStateException_init(('MaxCountExceeded: ' + maximalCount).toString());\n };\n Incrementor_init$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Incrementor$MaxCountExceededCallback]\n };\n Incrementor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Incrementor',\n interfaces: []\n };\n function LoessInterpolator(bandwidth, robustnessIters, accuracy) {\n LoessInterpolator$Companion_getInstance();\n if (bandwidth === void 0)\n bandwidth = LoessInterpolator$Companion_getInstance().DEFAULT_BANDWIDTH;\n if (robustnessIters === void 0)\n robustnessIters = 2;\n if (accuracy === void 0)\n accuracy = LoessInterpolator$Companion_getInstance().DEFAULT_ACCURACY;\n this.bandwidth_0 = bandwidth;\n this.robustnessIters_0 = robustnessIters;\n this.accuracy_0 = accuracy;\n if (this.bandwidth_0 <= 0 || this.bandwidth_0 > 1) {\n throw IllegalStateException_init(('Out of range of bandwidth value: ' + this.bandwidth_0 + ' should be > 0 and <= 1').toString());\n }if (this.robustnessIters_0 < 0) {\n throw IllegalStateException_init(('Not positive Robutness iterationa: ' + this.robustnessIters_0).toString());\n }}\n LoessInterpolator.prototype.interpolate_g9g6do$ = function (xval, yval) {\n return (new SplineInterpolator()).interpolate_g9g6do$(xval, this.smooth_0(xval, yval));\n };\n LoessInterpolator.prototype.smooth_1 = function (xval, yval, weights) {\n var tmp$, tmp$_0, tmp$_1;\n if (xval.length !== yval.length) {\n throw IllegalStateException_init(('Dimension mismatch of interpolation points: ' + xval.length + ' != ' + yval.length).toString());\n }var n = xval.length;\n if (n === 0) {\n throw IllegalStateException_init('No data to interpolate'.toString());\n }this.checkAllFiniteReal_0(xval);\n this.checkAllFiniteReal_0(yval);\n this.checkAllFiniteReal_0(weights);\n MathArrays_getInstance().checkOrder_gf7tl1$(xval);\n if (n === 1) {\n return new Float64Array([yval[0]]);\n }if (n === 2) {\n return new Float64Array([yval[0], yval[1]]);\n }var bandwidthInPoints = numberToInt(this.bandwidth_0 * n);\n if (bandwidthInPoints < 2) {\n throw IllegalStateException_init((\"LOESS 'bandwidthInPoints' is too small: \" + bandwidthInPoints + ' < 2').toString());\n }var res = new Float64Array(n);\n var residuals = new Float64Array(n);\n var sortedResiduals = new Float64Array(n);\n var robustnessWeights = new Float64Array(n);\n fill(robustnessWeights, 1.0);\n tmp$ = this.robustnessIters_0;\n for (var iter = 0; iter <= tmp$; iter++) {\n var bandwidthInterval = new Int32Array([0, bandwidthInPoints - 1 | 0]);\n for (var i = 0; i < n; i++) {\n var x = xval[i];\n if (i > 0) {\n this.updateBandwidthInterval_0(xval, weights, i, bandwidthInterval);\n }var ileft = bandwidthInterval[0];\n var iright = bandwidthInterval[1];\n var edge;\n if (xval[i] - xval[ileft] > xval[iright] - xval[i]) {\n tmp$_0 = ileft;\n } else {\n tmp$_0 = iright;\n }\n edge = tmp$_0;\n var sumWeights = 0.0;\n var sumX = 0.0;\n var sumXSquared = 0.0;\n var sumY = 0.0;\n var sumXY = 0.0;\n var x_0 = 1.0 / (xval[edge] - x);\n var denom = JsMath.abs(x_0);\n for (var k = ileft; k <= iright; k++) {\n var xk = xval[k];\n var yk = yval[k];\n var dist = k < i ? x - xk : xk - x;\n var w = this.tricube_0(dist * denom) * robustnessWeights[k] * weights[k];\n var xkw = xk * w;\n sumWeights += w;\n sumX += xkw;\n sumXSquared += xk * xkw;\n sumY += yk * w;\n sumXY += yk * xkw;\n }\n var meanX = sumX / sumWeights;\n var meanY = sumY / sumWeights;\n var meanXY = sumXY / sumWeights;\n var meanXSquared = sumXSquared / sumWeights;\n var beta;\n var x_1 = meanXSquared - meanX * meanX;\n var x_2 = JsMath.abs(x_1);\n if (JsMath.sqrt(x_2) < this.accuracy_0) {\n tmp$_1 = 0.0;\n } else {\n tmp$_1 = (meanXY - meanX * meanY) / (meanXSquared - meanX * meanX);\n }\n beta = tmp$_1;\n var alpha = meanY - beta * meanX;\n res[i] = beta * x + alpha;\n var x_3 = yval[i] - res[i];\n residuals[i] = JsMath.abs(x_3);\n }\n if (iter === this.robustnessIters_0) {\n break;\n }arrayCopy(residuals, sortedResiduals, 0, 0, n);\n sort(sortedResiduals);\n var medianResidual = sortedResiduals[n / 2 | 0];\n if (JsMath.abs(medianResidual) < this.accuracy_0) {\n break;\n }for (var i_0 = 0; i_0 < n; i_0++) {\n var arg = residuals[i_0] / (6 * medianResidual);\n if (arg >= 1) {\n robustnessWeights[i_0] = 0.0;\n } else {\n var w_0 = 1 - arg * arg;\n robustnessWeights[i_0] = w_0 * w_0;\n }\n }\n }\n return res;\n };\n LoessInterpolator.prototype.updateBandwidthInterval_0 = function (xval, weights, i, bandwidthInterval) {\n var left = bandwidthInterval[0];\n var right = bandwidthInterval[1];\n var nextRight = this.nextNonzero_0(weights, right);\n if (nextRight < xval.length && xval[nextRight] - xval[i] < xval[i] - xval[left]) {\n var nextLeft = this.nextNonzero_0(weights, bandwidthInterval[0]);\n bandwidthInterval[0] = nextLeft;\n bandwidthInterval[1] = nextRight;\n }};\n LoessInterpolator.prototype.tricube_0 = function (x) {\n var absX = JsMath.abs(x);\n if (absX >= 1.0) {\n return 0.0;\n }var tmp = 1 - absX * absX * absX;\n return tmp * tmp * tmp;\n };\n LoessInterpolator.prototype.nextNonzero_0 = function (weights, i) {\n var j = i + 1 | 0;\n while (j < weights.length && weights[j] === 0.0) {\n j = j + 1 | 0;\n }\n return j;\n };\n LoessInterpolator.prototype.smooth_0 = function (xval, yval) {\n if (xval.length !== yval.length) {\n throw IllegalStateException_init(('Dimension mismatch: ' + xval.length + ' != ' + yval.length).toString());\n }var unitWeights = new Float64Array(xval.length);\n fill(unitWeights, 1.0);\n return this.smooth_1(xval, yval, unitWeights);\n };\n LoessInterpolator.prototype.checkFinite_0 = function (x) {\n if (isInfinite(x) || isNaN_0(x)) {\n throw IllegalStateException_init(('Argument ' + x + ' is not a finite number').toString());\n }};\n LoessInterpolator.prototype.checkAllFiniteReal_0 = function (values) {\n for (var i = 0; i !== values.length; ++i) {\n this.checkFinite_0(values[i]);\n }\n };\n function LoessInterpolator$Companion() {\n LoessInterpolator$Companion_instance = this;\n this.DEFAULT_BANDWIDTH = 0.3;\n this.DEFAULT_ROBUSTNESS_ITERS = 2;\n this.DEFAULT_ACCURACY = 1.0E-12;\n }\n LoessInterpolator$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LoessInterpolator$Companion_instance = null;\n function LoessInterpolator$Companion_getInstance() {\n if (LoessInterpolator$Companion_instance === null) {\n new LoessInterpolator$Companion();\n }return LoessInterpolator$Companion_instance;\n }\n LoessInterpolator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LoessInterpolator',\n interfaces: []\n };\n function MathArrays() {\n MathArrays_instance = this;\n }\n function MathArrays$OrderDirection(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function MathArrays$OrderDirection_initFields() {\n MathArrays$OrderDirection_initFields = function () {\n };\n MathArrays$OrderDirection$INCREASING_instance = new MathArrays$OrderDirection('INCREASING', 0);\n MathArrays$OrderDirection$DECREASING_instance = new MathArrays$OrderDirection('DECREASING', 1);\n }\n var MathArrays$OrderDirection$INCREASING_instance;\n function MathArrays$OrderDirection$INCREASING_getInstance() {\n MathArrays$OrderDirection_initFields();\n return MathArrays$OrderDirection$INCREASING_instance;\n }\n var MathArrays$OrderDirection$DECREASING_instance;\n function MathArrays$OrderDirection$DECREASING_getInstance() {\n MathArrays$OrderDirection_initFields();\n return MathArrays$OrderDirection$DECREASING_instance;\n }\n MathArrays$OrderDirection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'OrderDirection',\n interfaces: [Enum]\n };\n function MathArrays$OrderDirection$values() {\n return [MathArrays$OrderDirection$INCREASING_getInstance(), MathArrays$OrderDirection$DECREASING_getInstance()];\n }\n MathArrays$OrderDirection.values = MathArrays$OrderDirection$values;\n function MathArrays$OrderDirection$valueOf(name) {\n switch (name) {\n case 'INCREASING':\n return MathArrays$OrderDirection$INCREASING_getInstance();\n case 'DECREASING':\n return MathArrays$OrderDirection$DECREASING_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.math3.MathArrays.OrderDirection.' + name);\n }\n }\n MathArrays$OrderDirection.valueOf_61zpoe$ = MathArrays$OrderDirection$valueOf;\n MathArrays.prototype.checkOrder_j8c91m$ = function (val, dir, strict, abort) {\n var tmp$;\n var previous = val[0];\n var max = val.length;\n var index;\n index = 1;\n ITEM: while (index < max) {\n if (equals(dir, MathArrays$OrderDirection$INCREASING_getInstance()))\n if (strict) {\n if (val[index] <= previous) {\n break ITEM;\n }} else {\n if (val[index] < previous) {\n break ITEM;\n }}\n else if (equals(dir, MathArrays$OrderDirection$DECREASING_getInstance()))\n if (strict) {\n if (val[index] >= previous) {\n break ITEM;\n }} else {\n if (val[index] > previous) {\n break ITEM;\n }}\n else {\n throw IllegalStateException_init(''.toString());\n }\n previous = val[index];\n index = index + 1 | 0;\n }\n if (index === max) {\n return true;\n }if (abort) {\n throw IllegalStateException_init('Non monotonic sequence'.toString());\n } else {\n tmp$ = false;\n }\n return tmp$;\n };\n MathArrays.prototype.checkOrder_hixecd$ = function (val, dir, strict) {\n this.checkOrder_j8c91m$(val, dir, strict, true);\n };\n MathArrays.prototype.checkOrder_gf7tl1$ = function (val) {\n this.checkOrder_hixecd$(val, MathArrays$OrderDirection$INCREASING_getInstance(), true);\n };\n MathArrays.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'MathArrays',\n interfaces: []\n };\n var MathArrays_instance = null;\n function MathArrays_getInstance() {\n if (MathArrays_instance === null) {\n new MathArrays();\n }return MathArrays_instance;\n }\n function Percentile() {\n Percentile_instance = this;\n this.MIN_SELECT_SIZE_0 = 15;\n this.MAX_CACHED_LEVELS_0 = 10;\n }\n Percentile.prototype.evaluate_pw9xcd$ = function (values, p) {\n this.test_0(values, 0, 0, false);\n return this.evaluate_0(values, 0, values.length, p);\n };\n Percentile.prototype.test_0 = function (values, begin, length, allowEmpty) {\n var tmp$;\n if (values == null) {\n throw IllegalStateException_init('Input array'.toString());\n }if (begin < 0) {\n throw IllegalStateException_init('start postion < 0'.toString());\n }if (length < 0) {\n throw IllegalStateException_init('length < 0'.toString());\n }if ((begin + length | 0) > values.length) {\n throw IllegalStateException_init('subarray ends after array end'.toString());\n }if (length === 0 && !allowEmpty) {\n tmp$ = false;\n } else\n tmp$ = true;\n return tmp$;\n };\n Percentile.prototype.evaluate_0 = function (values, begin, length, p) {\n this.test_0(values, begin, length, false);\n if (p > 100 || p <= 0) {\n throw IllegalStateException_init(('out of bounds quantile value: ' + p + ', must be in (0, 100]').toString());\n }if (length === 0) {\n return kotlin_js_internal_DoubleCompanionObject.NaN;\n }if (length === 1) {\n return values[begin];\n }var n = length;\n var pos = p * (n + 1) / 100;\n var fpos = JsMath.floor(pos);\n var intPos = numberToInt(fpos);\n var dif = pos - fpos;\n var work = new Float64Array(length);\n arrayCopy(values, work, 0, begin, length);\n var pivotsHeap = new Int32Array(1023);\n fill_0(pivotsHeap, -1);\n if (pos < 1) {\n return this.select_0(work, pivotsHeap, 0);\n }if (pos >= n) {\n return this.select_0(work, pivotsHeap, length - 1 | 0);\n }var lower = this.select_0(work, pivotsHeap, intPos - 1 | 0);\n var upper = this.select_0(work, pivotsHeap, intPos);\n return lower + dif * (upper - lower);\n };\n Percentile.prototype.select_0 = function (work, pivotsHeap, k) {\n var begin = 0;\n var end = work.length;\n var node = 0;\n while ((end - begin | 0) > 15) {\n var pivot;\n if (node < pivotsHeap.length && pivotsHeap[node] >= 0) {\n pivot = pivotsHeap[node];\n } else {\n pivot = this.partition_0(work, begin, end, this.medianOf3_0(work, begin, end));\n if (node < pivotsHeap.length) {\n pivotsHeap[node] = pivot;\n }}\n if (k === pivot) {\n return work[k];\n } else if (k < pivot) {\n end = pivot;\n var a = (2 * node | 0) + 1 | 0;\n node = JsMath.min(a, pivotsHeap.length);\n } else {\n begin = pivot + 1 | 0;\n var a_0 = (2 * node | 0) + 2 | 0;\n node = JsMath.min(a_0, pivotsHeap.length);\n }\n }\n this.insertionSort_0(work, begin, end);\n return work[k];\n };\n Percentile.prototype.partition_0 = function (work, begin, end, pivot) {\n var tmp$, tmp$_0;\n var value = work[pivot];\n work[pivot] = work[begin];\n var i = begin + 1 | 0;\n var j = end - 1 | 0;\n while (i < j) {\n while (i < j && work[j] >= value) {\n j = j - 1 | 0;\n }\n while (i < j && work[i] <= value) {\n i = i + 1 | 0;\n }\n if (i < j) {\n var tmp = work[i];\n work[tmp$ = i, i = tmp$ + 1 | 0, tmp$] = work[j];\n work[tmp$_0 = j, j = tmp$_0 - 1 | 0, tmp$_0] = tmp;\n }}\n if (i >= end || work[i] > value) {\n i = i - 1 | 0;\n }work[begin] = work[i];\n work[i] = value;\n return i;\n };\n Percentile.prototype.medianOf3_0 = function (work, begin, end) {\n var tmp$;\n var inclusiveEnd = end - 1 | 0;\n var middle = begin + ((inclusiveEnd - begin | 0) / 2 | 0) | 0;\n var wBegin = work[begin];\n var wMiddle = work[middle];\n var wEnd = work[inclusiveEnd];\n if (wBegin < wMiddle) {\n if (wMiddle < wEnd) {\n tmp$ = middle;\n } else {\n tmp$ = wBegin < wEnd ? inclusiveEnd : begin;\n }\n } else {\n if (wBegin < wEnd) {\n tmp$ = begin;\n } else {\n tmp$ = wMiddle < wEnd ? inclusiveEnd : middle;\n }\n }\n return tmp$;\n };\n Percentile.prototype.insertionSort_0 = function (work, begin, end) {\n for (var j = begin + 1 | 0; j < end; j++) {\n var saved = work[j];\n var i = j - 1 | 0;\n while (i >= begin && saved < work[i]) {\n work[i + 1 | 0] = work[i];\n i = i - 1 | 0;\n }\n work[i + 1 | 0] = saved;\n }\n };\n Percentile.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Percentile',\n interfaces: []\n };\n var Percentile_instance = null;\n function Percentile_getInstance() {\n if (Percentile_instance === null) {\n new Percentile();\n }return Percentile_instance;\n }\n function PolynomialFunction(c) {\n this.coefficients_0 = null;\n var tmp$ = c == null;\n if (!tmp$) {\n tmp$ = c.length === 0;\n }if (tmp$) {\n throw IllegalStateException_init('Empty polynomials coefficients array'.toString());\n }var n = c.length;\n while (n > 1 && c[n - 1 | 0] === 0.0) {\n n = n - 1 | 0;\n }\n this.coefficients_0 = new Float64Array(n);\n arrayCopy(c, this.coefficients_0, 0, 0, n);\n }\n PolynomialFunction.prototype.value_14dthe$ = function (x) {\n return this.evaluate_0(this.coefficients_0, x);\n };\n PolynomialFunction.prototype.evaluate_0 = function (coefficients, argument) {\n if (coefficients == null) {\n throw IllegalStateException_init('Null argument: coefficients of the polynomial to evaluate'.toString());\n }var n = coefficients.length;\n if (n === 0) {\n throw IllegalStateException_init('Empty polynomials coefficients array'.toString());\n }var result = coefficients[n - 1 | 0];\n for (var j = n - 2 | 0; j >= 0; j--) {\n result = argument * result + coefficients[j];\n }\n return result;\n };\n PolynomialFunction.prototype.unaryPlus = function () {\n return new PolynomialFunction(this.coefficients_0);\n };\n PolynomialFunction.prototype.unaryMinus = function () {\n var tmp$;\n var dd = new Float64Array(this.coefficients_0.length);\n tmp$ = this.coefficients_0;\n for (var i = 0; i !== tmp$.length; ++i) {\n var c = tmp$[i];\n dd[i] = -c;\n }\n return new PolynomialFunction(dd);\n };\n PolynomialFunction.prototype.apply_op_0 = function (other, op) {\n var sz = collect.Comparables.max_sdesaw$(this.coefficients_0.length, other.coefficients_0.length);\n var nc = new Float64Array(sz);\n for (var i = 0; i < sz; i++) {\n var a = i < this.coefficients_0.length ? this.coefficients_0[i] : 0.0;\n var b = i < other.coefficients_0.length ? other.coefficients_0[i] : 0.0;\n nc[i] = op(a, b);\n }\n return new PolynomialFunction(nc);\n };\n function PolynomialFunction$plus$lambda(x, y) {\n return x + y;\n }\n PolynomialFunction.prototype.plus_3j0b7h$ = function (other) {\n return this.apply_op_0(other, PolynomialFunction$plus$lambda);\n };\n function PolynomialFunction$minus$lambda(x, y) {\n return x - y;\n }\n PolynomialFunction.prototype.minus_3j0b7h$ = function (other) {\n return this.apply_op_0(other, PolynomialFunction$minus$lambda);\n };\n PolynomialFunction.prototype.multiply_14dthe$ = function (a) {\n var tmp$;\n var dd = new Float64Array(this.coefficients_0.length);\n tmp$ = this.coefficients_0;\n for (var i = 0; i !== tmp$.length; ++i) {\n var c = tmp$[i];\n dd[i] = a * c;\n }\n return new PolynomialFunction(dd);\n };\n PolynomialFunction.prototype.times_3j0b7h$ = function (other) {\n var nd = this.coefficients_0.length + other.coefficients_0.length - 1 | 0;\n var nc = new Float64Array(nd);\n for (var i = 0; i < nd; i++) {\n for (var j = 0; j <= i; j++) {\n var a = j < this.coefficients_0.length ? this.coefficients_0[j] : 0.0;\n var k = i - j | 0;\n var b = k < other.coefficients_0.length ? other.coefficients_0[k] : 0.0;\n nc[i] = nc[i] + a * b;\n }\n }\n return new PolynomialFunction(nc);\n };\n PolynomialFunction.prototype.degree = function () {\n var tmp$ = collect.Comparables;\n var $receiver = this.coefficients_0;\n var indexOfLast$result;\n indexOfLast$break: do {\n var tmp$_0;\n tmp$_0 = reversed_0(get_indices($receiver)).iterator();\n while (tmp$_0.hasNext()) {\n var index = tmp$_0.next();\n if ($receiver[index] !== 0.0) {\n indexOfLast$result = index;\n break indexOfLast$break;\n }}\n indexOfLast$result = -1;\n }\n while (false);\n return tmp$.max_sdesaw$(0, indexOfLast$result);\n };\n PolynomialFunction.prototype.compareTo_3j0b7h$ = function (other) {\n var d1 = this.degree();\n var d2 = other.degree();\n var n = collect.Comparables.min_sdesaw$(d1, d2) + 1 | 0;\n for (var i = 0; i < n; i++) {\n var a = this.coefficients_0[i];\n var b = other.coefficients_0[i];\n var res = Kotlin.compareTo(a, b);\n if (res !== 0)\n return res;\n }\n return Kotlin.primitiveCompareTo(d1, d2);\n };\n PolynomialFunction.prototype.equals = function (other) {\n if (other == null || !Kotlin.isType(other, PolynomialFunction))\n return false;\n return this.compareTo_3j0b7h$(other) === 0;\n };\n PolynomialFunction.prototype.hashCode = function () {\n return hashCode(this.coefficients_0);\n };\n PolynomialFunction.prototype.toString = function () {\n var sb = StringBuilder_init();\n for (var i = get_lastIndex(this.coefficients_0); i >= 0; i--) {\n if (this.coefficients_0[i] !== 0.0) {\n if (!(sb.length === 0))\n sb.append_pdl1vj$(' + ');\n sb.append_pdl1vj$(this.coefficients_0[i].toString());\n if (i > 0)\n sb.append_pdl1vj$('x');\n if (i > 1)\n sb.append_pdl1vj$('^').append_s8jyv4$(i);\n }}\n return sb.toString();\n };\n PolynomialFunction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolynomialFunction',\n interfaces: []\n };\n function times($receiver, p) {\n return p.multiply_14dthe$($receiver);\n }\n function PolynomialSplineFunction(_knots, _polynomials) {\n this.knots = null;\n this.polynomials = null;\n this.n_0 = 0;\n if (_knots == null) {\n throw IllegalStateException_init('Null argument '.toString());\n }if (_knots.length < 2) {\n throw IllegalStateException_init(('Spline partition must have at least 2 points, got ' + _knots.length).toString());\n }if ((_knots.length - 1 | 0) !== _polynomials.length) {\n throw IllegalStateException_init(('Dimensions mismatch: ' + _polynomials.length + ' polynomial functions != ' + _knots.length + ' segment delimiters').toString());\n }MathArrays_getInstance().checkOrder_gf7tl1$(_knots);\n this.n_0 = _knots.length - 1 | 0;\n this.knots = _knots;\n this.polynomials = Kotlin.newArray(this.n_0, null);\n arrayCopy(_polynomials, this.polynomials, 0, 0, this.n_0);\n }\n PolynomialSplineFunction.prototype.value_14dthe$ = function (v) {\n var tmp$;\n if (v < this.knots[0] || v > this.knots[this.n_0]) {\n throw IllegalStateException_init((v.toString() + ' out of [' + this.knots[0] + ', ' + this.knots[this.n_0] + '] range').toString());\n }var i = binarySearch(toMutableList_0(this.knots), v);\n if (i < 0) {\n i = (-i | 0) - 2 | 0;\n }if (i >= this.polynomials.length) {\n i = i - 1 | 0;\n }return (tmp$ = this.polynomials[i]) != null ? tmp$.value_14dthe$(v - this.knots[i]) : null;\n };\n PolynomialSplineFunction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolynomialSplineFunction',\n interfaces: []\n };\n function Precision() {\n Precision_instance = this;\n this.SGN_MASK_0 = L_2147483648;\n this.SGN_MASK_FLOAT_0 = -2147483648;\n }\n Precision.prototype.compareTo_yvo9jy$ = function (x, y, eps) {\n if (this.equals_yvo9jy$(x, y, eps)) {\n return 0;\n } else if (x < y) {\n return -1;\n }return 1;\n };\n Precision.prototype.compareTo_syxxoe$ = function (x, y, maxUlps) {\n if (this.equals_syxxoe$(x, y, maxUlps)) {\n return 0;\n } else if (x < y) {\n return -1;\n }return 1;\n };\n Precision.prototype.equalsIncludingNaN_dleff0$ = function (x, y) {\n return isNaN_1(x) && isNaN_1(y) || this.equals_a5xegy$(x, y, 1);\n };\n Precision.prototype.equals_y2kzbl$ = function (x, y, eps) {\n var tmp$ = this.equals_a5xegy$(x, y, 1);\n if (!tmp$) {\n var x_0 = y - x;\n tmp$ = JsMath.abs(x_0) <= eps;\n }return tmp$;\n };\n Precision.prototype.equalsIncludingNaN_y2kzbl$ = function (x, y, eps) {\n var tmp$ = this.equalsIncludingNaN_dleff0$(x, y);\n if (!tmp$) {\n var x_0 = y - x;\n tmp$ = JsMath.abs(x_0) <= eps;\n }return tmp$;\n };\n Precision.prototype.equals_a5xegy$ = function (x, y, maxUlps) {\n if (maxUlps === void 0)\n maxUlps = 1;\n var xInt = toBits(x);\n var yInt = toBits(y);\n if (xInt < 0) {\n xInt = this.SGN_MASK_FLOAT_0 - xInt | 0;\n }if (yInt < 0) {\n yInt = this.SGN_MASK_FLOAT_0 - yInt | 0;\n }var isEqual = abs(xInt - yInt | 0) <= maxUlps;\n return isEqual && !isNaN_1(x) && !isNaN_1(y);\n };\n Precision.prototype.equalsIncludingNaN_a5xegy$ = function (x, y, maxUlps) {\n return isNaN_1(x) && isNaN_1(y) || this.equals_a5xegy$(x, y, maxUlps);\n };\n Precision.prototype.equalsIncludingNaN_lu1900$ = function (x, y) {\n return isNaN_0(x) && isNaN_0(y) || this.equals_syxxoe$(x, y, 1);\n };\n Precision.prototype.equals_yvo9jy$ = function (x, y, eps) {\n var tmp$ = this.equals_syxxoe$(x, y, 1);\n if (!tmp$) {\n var x_0 = y - x;\n tmp$ = JsMath.abs(x_0) <= eps;\n }return tmp$;\n };\n Precision.prototype.equalsIncludingNaN_yvo9jy$ = function (x, y, eps) {\n var tmp$ = this.equalsIncludingNaN_lu1900$(x, y);\n if (!tmp$) {\n var x_0 = y - x;\n tmp$ = JsMath.abs(x_0) <= eps;\n }return tmp$;\n };\n Precision.prototype.equals_syxxoe$ = function (x, y, maxUlps) {\n if (maxUlps === void 0)\n maxUlps = 1;\n var xInt = toBits_0(x);\n var yInt = toBits_0(y);\n if (xInt.toNumber() < 0) {\n xInt = this.SGN_MASK_0.subtract(xInt);\n }if (yInt.toNumber() < 0) {\n yInt = this.SGN_MASK_0.subtract(yInt);\n }var isEqual = abs_0(xInt.subtract(yInt)).toNumber() <= maxUlps;\n return isEqual && !isNaN_0(x) && !isNaN_0(y);\n };\n Precision.prototype.equalsIncludingNaN_syxxoe$ = function (x, y, maxUlps) {\n return isNaN_0(x) && isNaN_0(y) || this.equals_syxxoe$(x, y, maxUlps);\n };\n Precision.prototype.representableDelta_lu1900$ = function (x, originalDelta) {\n return x + originalDelta - x;\n };\n Precision.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Precision',\n interfaces: []\n };\n var Precision_instance = null;\n function Precision_getInstance() {\n if (Precision_instance === null) {\n new Precision();\n }return Precision_instance;\n }\n function RealDistribution() {\n }\n RealDistribution.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'RealDistribution',\n interfaces: []\n };\n function SplineInterpolator() {\n }\n SplineInterpolator.prototype.interpolate_g9g6do$ = function (x, y) {\n if (x.length !== y.length) {\n throw IllegalStateException_init(('Dimension mismatch ' + x.length + ' != ' + y.length).toString());\n }if (x.length < 3) {\n throw IllegalStateException_init(('Too small value of points number: ' + x.length + ' < 3').toString());\n }var n = x.length - 1 | 0;\n MathArrays_getInstance().checkOrder_gf7tl1$(x);\n var h = new Float64Array(n);\n for (var i = 0; i < n; i++) {\n h[i] = x[i + 1 | 0] - x[i];\n }\n var mu = new Float64Array(n);\n var z = new Float64Array(n + 1 | 0);\n mu[0] = 0.0;\n z[0] = 0.0;\n for (var i_0 = 1; i_0 < n; i_0++) {\n var g = 2.0 * (x[i_0 + 1 | 0] - x[i_0 - 1 | 0]) - h[i_0 - 1 | 0] * mu[i_0 - 1 | 0];\n mu[i_0] = h[i_0] / g;\n z[i_0] = (3.0 * (y[i_0 + 1 | 0] * h[i_0 - 1 | 0] - y[i_0] * (x[i_0 + 1 | 0] - x[i_0 - 1 | 0]) + y[i_0 - 1 | 0] * h[i_0]) / (h[i_0 - 1 | 0] * h[i_0]) - h[i_0 - 1 | 0] * z[i_0 - 1 | 0]) / g;\n }\n var b = new Float64Array(n);\n var c = new Float64Array(n + 1 | 0);\n var d = new Float64Array(n);\n z[n] = 0.0;\n c[n] = 0.0;\n for (var j = n - 1 | 0; j >= 0; j--) {\n c[j] = z[j] - mu[j] * c[j + 1 | 0];\n b[j] = (y[j + 1 | 0] - y[j]) / h[j] - h[j] * (c[j + 1 | 0] + 2.0 * c[j]) / 3.0;\n d[j] = (c[j + 1 | 0] - c[j]) / (3.0 * h[j]);\n }\n var polynomials = Kotlin.newArray(n, null);\n var coefficients = new Float64Array(4);\n for (var i_1 = 0; i_1 < n; i_1++) {\n coefficients[0] = y[i_1];\n coefficients[1] = b[i_1];\n coefficients[2] = c[i_1];\n coefficients[3] = d[i_1];\n polynomials[i_1] = new PolynomialFunction(coefficients);\n }\n return new PolynomialSplineFunction(x, polynomials);\n };\n SplineInterpolator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SplineInterpolator',\n interfaces: []\n };\n function TDistribution(degreesOfFreedom, solverAbsoluteAccuracy) {\n TDistribution$Companion_getInstance();\n if (solverAbsoluteAccuracy === void 0)\n solverAbsoluteAccuracy = TDistribution$Companion_getInstance().DEFAULT_INVERSE_ABSOLUTE_ACCURACY;\n AbstractRealDistribution.call(this);\n this.degreesOfFreedom_0 = degreesOfFreedom;\n this.solverAbsoluteAccuracy_l8ezvu$_0 = solverAbsoluteAccuracy;\n if (this.degreesOfFreedom_0 <= 0) {\n throw IllegalStateException_init(('NotStrictlyPositive - DEGREES_OF_FREEDOM: ' + this.degreesOfFreedom_0).toString());\n }}\n Object.defineProperty(TDistribution.prototype, 'solverAbsoluteAccuracy', {\n get: function () {\n return this.solverAbsoluteAccuracy_l8ezvu$_0;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'numericalMean', {\n configurable: true,\n get: function () {\n var tmp$;\n var df = this.degreesOfFreedom_0;\n if (df > 1) {\n tmp$ = 0.0;\n } else\n tmp$ = kotlin_js_internal_DoubleCompanionObject.NaN;\n return tmp$;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'numericalVariance', {\n configurable: true,\n get: function () {\n var tmp$;\n var df = this.degreesOfFreedom_0;\n if (df > 2) {\n return df / (df - 2);\n }if (df > 1 && df <= 2) {\n tmp$ = kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY;\n } else\n tmp$ = kotlin_js_internal_DoubleCompanionObject.NaN;\n return tmp$;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'supportLowerBound', {\n configurable: true,\n get: function () {\n return kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'supportUpperBound', {\n configurable: true,\n get: function () {\n return kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'isSupportLowerBoundInclusive', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'isSupportUpperBoundInclusive', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'isSupportConnected', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n TDistribution.prototype.probability_14dthe$ = function (x) {\n return 0.0;\n };\n TDistribution.prototype.density_14dthe$ = function (x) {\n var n = this.degreesOfFreedom_0;\n var nPlus1Over2 = (n + 1) / 2;\n var tmp$ = Gamma_getInstance().logGamma_14dthe$(nPlus1Over2);\n var x_0 = math.PI;\n var tmp$_0 = tmp$ - 0.5 * (JsMath.log(x_0) + JsMath.log(n)) - Gamma_getInstance().logGamma_14dthe$(n / 2);\n var x_1 = 1 + x * x / n;\n var x_2 = tmp$_0 - nPlus1Over2 * JsMath.log(x_1);\n return JsMath.exp(x_2);\n };\n TDistribution.prototype.cumulativeProbability_14dthe$ = function (x) {\n var ret;\n if (x === 0.0) {\n ret = 0.5;\n } else {\n var t = Beta_getInstance().regularizedBeta_tychlm$(this.degreesOfFreedom_0 / (this.degreesOfFreedom_0 + x * x), 0.5 * this.degreesOfFreedom_0, 0.5);\n if (x < 0.0) {\n ret = 0.5 * t;\n } else {\n ret = 1.0 - 0.5 * t;\n }\n }\n return ret;\n };\n function TDistribution$Companion() {\n TDistribution$Companion_instance = this;\n this.DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1.0E-9;\n this.serialVersionUID_0 = L_5852615386664158222;\n }\n TDistribution$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TDistribution$Companion_instance = null;\n function TDistribution$Companion_getInstance() {\n if (TDistribution$Companion_instance === null) {\n new TDistribution$Companion();\n }return TDistribution$Companion_instance;\n }\n TDistribution.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TDistribution',\n interfaces: [AbstractRealDistribution]\n };\n function UnivariateFunction() {\n }\n UnivariateFunction.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'UnivariateFunction',\n interfaces: []\n };\n function UnivariateSolver() {\n }\n UnivariateSolver.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'UnivariateSolver',\n interfaces: [BaseUnivariateSolver]\n };\n function UnivariateSolverUtils() {\n UnivariateSolverUtils_instance = this;\n }\n UnivariateSolverUtils.prototype.solve_ljmp9$ = function (function_0, x0, x1) {\n var solver = BrentSolver_init();\n return solver.solve_rmnly1$(2147483647, function_0, x0, x1);\n };\n UnivariateSolverUtils.prototype.solve_wb66u3$ = function (function_0, x0, x1, absoluteAccuracy) {\n var solver = BrentSolver_init(absoluteAccuracy);\n return solver.solve_rmnly1$(2147483647, function_0, x0, x1);\n };\n UnivariateSolverUtils.prototype.forceSide_i33h9z$ = function (maxEval, f, bracketing, baseRoot, min, max, allowedSolution) {\n if (allowedSolution === AllowedSolution$ANY_SIDE_getInstance()) {\n return baseRoot;\n }var tmp$ = bracketing.absoluteAccuracy;\n var x = baseRoot * bracketing.relativeAccuracy;\n var b = JsMath.abs(x);\n var step = JsMath.max(tmp$, b);\n var b_0 = baseRoot - step;\n var xLo = JsMath.max(min, b_0);\n var fLo = f.value_14dthe$(xLo);\n var b_1 = baseRoot + step;\n var xHi = JsMath.min(max, b_1);\n var fHi = f.value_14dthe$(xHi);\n var remainingEval = maxEval - 2 | 0;\n while (remainingEval > 0) {\n if (fLo >= 0 && fHi <= 0 || (fLo <= 0 && fHi >= 0)) {\n return bracketing.solve_epddgp$(remainingEval, f, xLo, xHi, baseRoot, allowedSolution);\n }var changeLo = false;\n var changeHi = false;\n if (fLo < fHi) {\n if (fLo >= 0) {\n changeLo = true;\n } else {\n changeHi = true;\n }\n } else if (fLo > fHi) {\n if (fLo <= 0) {\n changeLo = true;\n } else {\n changeHi = true;\n }\n } else {\n changeLo = true;\n changeHi = true;\n }\n if (changeLo) {\n var b_2 = xLo - step;\n xLo = JsMath.max(min, b_2);\n fLo = f.value_14dthe$(xLo);\n remainingEval = remainingEval - 1 | 0;\n }if (changeHi) {\n var b_3 = xHi + step;\n xHi = JsMath.min(max, b_3);\n fHi = f.value_14dthe$(xHi);\n remainingEval = remainingEval - 1 | 0;\n }}\n throw IllegalStateException_init('NoBracketing'.toString());\n };\n UnivariateSolverUtils.prototype.bracket_cflw21$ = function (function_0, initial, lowerBound, upperBound, maximumIterations) {\n if (maximumIterations === void 0)\n maximumIterations = 2147483647;\n if (maximumIterations <= 0) {\n throw IllegalStateException_init('NotStrictlyPositive'.toString());\n }this.verifySequence_yvo9jy$(lowerBound, initial, upperBound);\n var a = initial;\n var b = initial;\n var fa;\n var fb;\n var numIterations = 0;\n do {\n var a_0 = a - 1.0;\n a = JsMath.max(a_0, lowerBound);\n var a_1 = b + 1.0;\n b = JsMath.min(a_1, upperBound);\n fa = function_0.value_14dthe$(a);\n fb = function_0.value_14dthe$(b);\n numIterations = numIterations + 1 | 0;\n }\n while (fa * fb > 0.0 && numIterations < maximumIterations && (a > lowerBound || b < upperBound));\n if (fa * fb > 0.0) {\n throw IllegalStateException_init('NoBracketing'.toString());\n }return new Float64Array([a, b]);\n };\n UnivariateSolverUtils.prototype.midpoint_lu1900$ = function (a, b) {\n return (a + b) * 0.5;\n };\n UnivariateSolverUtils.prototype.isBracketing_ljmp9$ = function (function_0, lower, upper) {\n var fLo = function_0.value_14dthe$(lower);\n var fHi = function_0.value_14dthe$(upper);\n return fLo >= 0 && fHi <= 0 || (fLo <= 0 && fHi >= 0);\n };\n UnivariateSolverUtils.prototype.isSequence_yvo9jy$ = function (start, mid, end) {\n return start < mid && mid < end;\n };\n UnivariateSolverUtils.prototype.verifyInterval_lu1900$ = function (lower, upper) {\n if (lower >= upper) {\n throw IllegalStateException_init('NumberIsTooLarge'.toString());\n }};\n UnivariateSolverUtils.prototype.verifySequence_yvo9jy$ = function (lower, initial, upper) {\n this.verifyInterval_lu1900$(lower, initial);\n this.verifyInterval_lu1900$(initial, upper);\n };\n UnivariateSolverUtils.prototype.verifyBracketing_ljmp9$ = function (function_0, lower, upper) {\n this.verifyInterval_lu1900$(lower, upper);\n if (!this.isBracketing_ljmp9$(function_0, lower, upper)) {\n throw IllegalStateException_init('NoBracketing'.toString());\n }};\n UnivariateSolverUtils.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'UnivariateSolverUtils',\n interfaces: []\n };\n var UnivariateSolverUtils_instance = null;\n function UnivariateSolverUtils_getInstance() {\n if (UnivariateSolverUtils_instance === null) {\n new UnivariateSolverUtils();\n }return UnivariateSolverUtils_instance;\n }\n function EvalResult(y, ymin, ymax, se) {\n this.y = y;\n this.ymin = ymin;\n this.ymax = ymax;\n this.se = se;\n }\n EvalResult.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'EvalResult',\n interfaces: []\n };\n EvalResult.prototype.component1 = function () {\n return this.y;\n };\n EvalResult.prototype.component2 = function () {\n return this.ymin;\n };\n EvalResult.prototype.component3 = function () {\n return this.ymax;\n };\n EvalResult.prototype.component4 = function () {\n return this.se;\n };\n EvalResult.prototype.copy_6y0v78$ = function (y, ymin, ymax, se) {\n return new EvalResult(y === void 0 ? this.y : y, ymin === void 0 ? this.ymin : ymin, ymax === void 0 ? this.ymax : ymax, se === void 0 ? this.se : se);\n };\n EvalResult.prototype.toString = function () {\n return 'EvalResult(y=' + Kotlin.toString(this.y) + (', ymin=' + Kotlin.toString(this.ymin)) + (', ymax=' + Kotlin.toString(this.ymax)) + (', se=' + Kotlin.toString(this.se)) + ')';\n };\n EvalResult.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.y) | 0;\n result = result * 31 + Kotlin.hashCode(this.ymin) | 0;\n result = result * 31 + Kotlin.hashCode(this.ymax) | 0;\n result = result * 31 + Kotlin.hashCode(this.se) | 0;\n return result;\n };\n EvalResult.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.y, other.y) && Kotlin.equals(this.ymin, other.ymin) && Kotlin.equals(this.ymax, other.ymax) && Kotlin.equals(this.se, other.se)))));\n };\n function LinearRegression(xs, ys, confidenceLevel) {\n RegressionEvaluator.call(this, xs, ys, confidenceLevel);\n this.n_0 = 0;\n this.meanX_0 = 0;\n this.sumXX_0 = 0;\n this.beta1_0 = 0;\n this.beta0_0 = 0;\n this.sy_0 = 0;\n this.tcritical_0 = 0;\n var tmp$ = allFinite(xs, ys);\n var xVals = tmp$.component1()\n , yVals = tmp$.component2();\n this.n_0 = xVals.length;\n this.meanX_0 = average(xVals);\n var tmp$_0;\n var sum = 0;\n for (tmp$_0 = 0; tmp$_0 !== xVals.length; ++tmp$_0) {\n var element = xVals[tmp$_0];\n var $receiver = element - this.meanX_0;\n sum += JsMath.pow($receiver, 2);\n }\n this.sumXX_0 = sum;\n var meanY = average(yVals);\n var tmp$_1;\n var sum_0 = 0;\n for (tmp$_1 = 0; tmp$_1 !== yVals.length; ++tmp$_1) {\n var element_0 = yVals[tmp$_1];\n var $receiver_0 = element_0 - meanY;\n sum_0 += JsMath.pow($receiver_0, 2);\n }\n var sumYY = sum_0;\n var tmp$_2;\n var sum_1 = 0;\n tmp$_2 = zip_0(xVals, yVals).iterator();\n while (tmp$_2.hasNext()) {\n var element_1 = tmp$_2.next();\n var x = element_1.component1()\n , y = element_1.component2();\n sum_1 += (x - this.meanX_0) * (y - meanY);\n }\n var sumXY = sum_1;\n this.beta1_0 = sumXY / this.sumXX_0;\n this.beta0_0 = meanY - this.beta1_0 * this.meanX_0;\n var b = sumYY - sumXY * sumXY / this.sumXX_0;\n var sse = JsMath.max(0.0, b);\n var x_0 = sse / (this.n_0 - 2 | 0);\n this.sy_0 = JsMath.sqrt(x_0);\n var alpha = 1.0 - confidenceLevel;\n this.tcritical_0 = (new TDistribution(this.n_0 - 2.0)).inverseCumulativeProbability_14dthe$(1.0 - alpha / 2.0);\n }\n LinearRegression.prototype.value_0 = function (x) {\n return this.beta1_0 * x + this.beta0_0;\n };\n LinearRegression.prototype.evalX_14dthe$ = function (x) {\n var $receiver = x - this.meanX_0;\n var dxSquare = JsMath.pow($receiver, 2);\n var tmp$ = this.sy_0;\n var x_0 = 1.0 / this.n_0 + dxSquare / this.sumXX_0;\n var se = tmp$ * JsMath.sqrt(x_0);\n var halfConfidenceInterval = this.tcritical_0 * se;\n var yHat = this.value_0(x);\n return new EvalResult(yHat, yHat - halfConfidenceInterval, yHat + halfConfidenceInterval, se);\n };\n LinearRegression.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinearRegression',\n interfaces: [RegressionEvaluator]\n };\n function LocalPolynomialRegression(xs, ys, confidenceLevel, bandwidth) {\n RegressionEvaluator.call(this, xs, ys, confidenceLevel);\n this.bandwidth_0 = bandwidth;\n this.canCompute = false;\n this.n_0 = 0;\n this.meanX_0 = 0;\n this.sumXX_0 = 0;\n this.sy_0 = 0;\n this.tcritical_0 = 0;\n this.polynomial_6goixr$_0 = this.polynomial_6goixr$_0;\n var tmp$;\n var tmp$_0 = averageByX_0(xs, ys);\n var xVals = tmp$_0.component1()\n , yVals = tmp$_0.component2();\n this.n_0 = xVals.length;\n var degreesOfFreedom = this.n_0 - 2.0;\n var bandwidthInPoints = numberToInt(this.bandwidth_0 * this.n_0);\n var bandwidthInPointsOk = bandwidthInPoints >= 2;\n this.canCompute = (this.n_0 >= 3 && degreesOfFreedom > 0 && bandwidthInPointsOk);\n this.meanX_0 = average(xVals);\n var tmp$_1;\n var sum = 0;\n for (tmp$_1 = 0; tmp$_1 !== xVals.length; ++tmp$_1) {\n var element = xVals[tmp$_1];\n var $receiver = element - this.meanX_0;\n sum += JsMath.pow($receiver, 2);\n }\n this.sumXX_0 = sum;\n var meanY = average(yVals);\n var tmp$_2;\n var sum_0 = 0;\n for (tmp$_2 = 0; tmp$_2 !== yVals.length; ++tmp$_2) {\n var element_0 = yVals[tmp$_2];\n var $receiver_0 = element_0 - meanY;\n sum_0 += JsMath.pow($receiver_0, 2);\n }\n var sumYY = sum_0;\n var tmp$_3;\n var sum_1 = 0;\n tmp$_3 = zip_0(xVals, yVals).iterator();\n while (tmp$_3.hasNext()) {\n var element_1 = tmp$_3.next();\n var x = element_1.component1()\n , y = element_1.component2();\n sum_1 += (x - this.meanX_0) * (y - meanY);\n }\n var sumXY = sum_1;\n var b = sumYY - sumXY * sumXY / this.sumXX_0;\n var sse = JsMath.max(0.0, b);\n var x_0 = sse / (this.n_0 - 2 | 0);\n this.sy_0 = JsMath.sqrt(x_0);\n if (this.canCompute) {\n this.polynomial_0 = this.getPoly_0(xVals, yVals);\n }if (this.canCompute) {\n var alpha = 1.0 - confidenceLevel;\n tmp$ = (new TDistribution(degreesOfFreedom)).inverseCumulativeProbability_14dthe$(1.0 - alpha / 2.0);\n } else {\n tmp$ = kotlin_js_internal_DoubleCompanionObject.NaN;\n }\n this.tcritical_0 = tmp$;\n }\n Object.defineProperty(LocalPolynomialRegression.prototype, 'polynomial_0', {\n configurable: true,\n get: function () {\n if (this.polynomial_6goixr$_0 == null)\n return throwUPAE('polynomial');\n return this.polynomial_6goixr$_0;\n },\n set: function (polynomial) {\n this.polynomial_6goixr$_0 = polynomial;\n }\n });\n LocalPolynomialRegression.prototype.evalX_14dthe$ = function (x) {\n var $receiver = x - this.meanX_0;\n var dxSquare = JsMath.pow($receiver, 2);\n var tmp$ = this.sy_0;\n var x_0 = 1.0 / this.n_0 + dxSquare / this.sumXX_0;\n var se = tmp$ * JsMath.sqrt(x_0);\n var halfConfidenceInterval = this.tcritical_0 * se;\n var yHat = ensureNotNull(this.polynomial_0.value_14dthe$(x));\n return new EvalResult(yHat, yHat - halfConfidenceInterval, yHat + halfConfidenceInterval, se);\n };\n LocalPolynomialRegression.prototype.getPoly_0 = function (xVals, yVals) {\n return (new LoessInterpolator(this.bandwidth_0, 4)).interpolate_g9g6do$(xVals, yVals);\n };\n LocalPolynomialRegression.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LocalPolynomialRegression',\n interfaces: [RegressionEvaluator]\n };\n function PolynomialRegression(xs, ys, confidenceLevel, deg) {\n PolynomialRegression$Companion_getInstance();\n RegressionEvaluator.call(this, xs, ys, confidenceLevel);\n this.p_0 = null;\n this.n_0 = 0;\n this.meanX_0 = 0;\n this.sumXX_0 = 0;\n this.sy_0 = 0;\n this.tcritical_0 = 0;\n if (!(deg >= 2)) {\n var message = 'Degree of polynomial must be at least 2';\n throw IllegalArgumentException_init(message.toString());\n }var tmp$ = averageByX_0(xs, ys);\n var xVals = tmp$.component1()\n , yVals = tmp$.component2();\n this.n_0 = xVals.length;\n if (!(this.n_0 > deg)) {\n var message_0 = 'The number of valid data points must be greater than deg';\n throw IllegalArgumentException_init(message_0.toString());\n }this.p_0 = this.calcPolynomial_0(deg, xVals, yVals);\n this.meanX_0 = average(xVals);\n var tmp$_0;\n var sum = 0;\n for (tmp$_0 = 0; tmp$_0 !== xVals.length; ++tmp$_0) {\n var element = xVals[tmp$_0];\n var $receiver = element - this.meanX_0;\n sum += JsMath.pow($receiver, 2);\n }\n this.sumXX_0 = sum;\n var df = (this.n_0 - deg | 0) - 1.0;\n var tmp$_1;\n var sum_0 = 0;\n tmp$_1 = zip_0(xVals, yVals).iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n var x = element_0.component1()\n , y = element_0.component2();\n var $receiver_0 = y - this.p_0.value_14dthe$(x);\n sum_0 += JsMath.pow($receiver_0, 2);\n }\n var sse = sum_0;\n var x_0 = sse / df;\n this.sy_0 = JsMath.sqrt(x_0);\n var alpha = 1.0 - confidenceLevel;\n this.tcritical_0 = (new TDistribution(df)).inverseCumulativeProbability_14dthe$(1.0 - alpha / 2.0);\n }\n PolynomialRegression.prototype.calcPolynomial_0 = function (deg, xVals, yVals) {\n var fpg = new ForsythePolynomialGenerator(xVals);\n var res = new PolynomialFunction(new Float64Array([0.0]));\n for (var i = 0; i <= deg; i++) {\n var p = fpg.getPolynomial_za3lpa$(i);\n var s = this.coefficient_0(p, xVals, yVals);\n res = res.plus_3j0b7h$(times(s, p));\n }\n return res;\n };\n PolynomialRegression.prototype.coefficient_0 = function (p, xVals, yVals) {\n var ww = 0.0;\n var w = 0.0;\n for (var i = 0; i < xVals.length; i++) {\n var x = xVals[i];\n var y = yVals[i];\n var pval = p.value_14dthe$(x);\n ww += pval * pval;\n w += y * pval;\n }\n return w / ww;\n };\n PolynomialRegression.prototype.evalX_14dthe$ = function (x) {\n var $receiver = x - this.meanX_0;\n var dxSquare = JsMath.pow($receiver, 2);\n var tmp$ = this.sy_0;\n var x_0 = 1.0 / this.n_0 + dxSquare / this.sumXX_0;\n var se = tmp$ * JsMath.sqrt(x_0);\n var halfConfidenceInterval = this.tcritical_0 * se;\n var yHat = this.p_0.value_14dthe$(x);\n return new EvalResult(yHat, yHat - halfConfidenceInterval, yHat + halfConfidenceInterval, se);\n };\n function PolynomialRegression$Companion() {\n PolynomialRegression$Companion_instance = this;\n }\n PolynomialRegression$Companion.prototype.canBeComputed_fgqkrm$ = function (xs, ys, deg) {\n var xVals = averageByX_0(xs, ys).component1();\n return xVals.length > deg;\n };\n PolynomialRegression$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PolynomialRegression$Companion_instance = null;\n function PolynomialRegression$Companion_getInstance() {\n if (PolynomialRegression$Companion_instance === null) {\n new PolynomialRegression$Companion();\n }return PolynomialRegression$Companion_instance;\n }\n PolynomialRegression.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolynomialRegression',\n interfaces: [RegressionEvaluator]\n };\n function RegressionEvaluator(xs, ys, confidenceLevel) {\n if (!rangeTo(0.01, 0.99).contains_mef7kx$(confidenceLevel)) {\n var message = 'Confidence level is out of range [0.01-0.99]. CL:' + confidenceLevel;\n throw IllegalArgumentException_init(message.toString());\n }if (!(xs.size === ys.size)) {\n var message_0 = 'X/Y must have same size. X:' + toString(xs.size) + ' Y:' + toString(ys.size);\n throw IllegalArgumentException_init(message_0.toString());\n }}\n RegressionEvaluator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RegressionEvaluator',\n interfaces: []\n };\n var compareBy$lambda_0 = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function RegressionUtil() {\n RegressionUtil_instance = this;\n }\n RegressionUtil.prototype.sampling_v81hsd$ = function (data, m) {\n var tmp$;\n var index = this.sampleInt_0(data.size, m);\n var result = ArrayList_init();\n for (tmp$ = 0; tmp$ !== index.length; ++tmp$) {\n var i = index[tmp$];\n result.add_11rb$(data.get_za3lpa$(i));\n }\n return result;\n };\n RegressionUtil.prototype.sampleInt_0 = function (n, m) {\n if (n < m || m < 0) {\n throw IllegalStateException_init(('Sample ' + m + ' data from ' + n + ' data is impossible!').toString());\n }var perm = new Int32Array(n);\n for (var i = 0; i < n; i++) {\n perm[i] = i;\n }\n var result = new Int32Array(m);\n for (var j = 0; j < m; j++) {\n var r = j + numberToInt(Random.Default.nextDouble() * (n - j | 0)) | 0;\n result[j] = perm[r];\n perm[r] = perm[j];\n }\n return result;\n };\n RegressionUtil.prototype.percentile_av4ikl$ = function (data, p) {\n return Percentile_getInstance().evaluate_pw9xcd$(toDoubleArray(data), p * 100);\n };\n RegressionUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'RegressionUtil',\n interfaces: []\n };\n var RegressionUtil_instance = null;\n function RegressionUtil_getInstance() {\n if (RegressionUtil_instance === null) {\n new RegressionUtil();\n }return RegressionUtil_instance;\n }\n function allFinite(xs, ys) {\n var tmp$;\n var tx = ArrayList_init();\n var ty = ArrayList_init();\n tmp$ = zip_1(asSequence(xs), asSequence(ys)).iterator();\n while (tmp$.hasNext()) {\n var tmp$_0 = tmp$.next();\n var x = tmp$_0.component1()\n , y = tmp$_0.component2();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y)) {\n tx.add_11rb$(ensureNotNull(x));\n ty.add_11rb$(ensureNotNull(y));\n }}\n return new Pair_0(toDoubleArray(tx), toDoubleArray(ty));\n }\n function finitePairs(xs, ys) {\n var tmp$;\n var res = ArrayList_init();\n tmp$ = zip_1(asSequence(xs), asSequence(ys)).iterator();\n while (tmp$.hasNext()) {\n var tmp$_0 = tmp$.next();\n var x = tmp$_0.component1()\n , y = tmp$_0.component2();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y)) {\n res.add_11rb$(new Pair_0(ensureNotNull(x), ensureNotNull(y)));\n }}\n return res;\n }\n function averageByX(lst) {\n var tmp$;\n if (lst.isEmpty())\n return new Pair_0(ArrayList_init(), ArrayList_init());\n var tx = ArrayList_init();\n var ty = ArrayList_init();\n var tmp$_0 = first(lst);\n var prevX = tmp$_0.component1()\n , sumY = tmp$_0.component2();\n var countY = 1;\n tmp$ = drop(asSequence(lst), 1).iterator();\n while (tmp$.hasNext()) {\n var tmp$_1 = tmp$.next();\n var x = tmp$_1.component1()\n , y = tmp$_1.component2();\n if (x === prevX) {\n sumY += y;\n countY = countY + 1 | 0;\n } else {\n tx.add_11rb$(prevX);\n ty.add_11rb$(sumY / countY);\n prevX = x;\n sumY = y;\n countY = 1;\n }\n }\n tx.add_11rb$(prevX);\n ty.add_11rb$(sumY / countY);\n return new Pair_0(tx, ty);\n }\n function averageByX$lambda(it) {\n return it.first;\n }\n function averageByX_0(xs, ys) {\n var tp = finitePairs(xs, ys);\n if (tp.size > 1) {\n sortWith(tp, new Comparator(compareBy$lambda_0(averageByX$lambda)));\n }var res = averageByX(tp);\n return new Pair_0(toDoubleArray(res.first), toDoubleArray(res.second));\n }\n function MutableDouble(myValue) {\n this.myValue_0 = myValue;\n }\n MutableDouble.prototype.getAndAdd_14dthe$ = function (v) {\n var prevValue = this.myValue_0;\n this.myValue_0 = prevValue + v;\n return prevValue;\n };\n MutableDouble.prototype.get = function () {\n return this.myValue_0;\n };\n MutableDouble.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MutableDouble',\n interfaces: []\n };\n function MutableInteger(myValue) {\n this.myValue_0 = myValue;\n }\n Object.defineProperty(MutableInteger.prototype, 'andIncrement', {\n configurable: true,\n get: function () {\n return this.getAndAdd_za3lpa$(1);\n }\n });\n MutableInteger.prototype.get = function () {\n return this.myValue_0;\n };\n MutableInteger.prototype.getAndAdd_za3lpa$ = function (v) {\n var prevValue = this.myValue_0;\n this.myValue_0 = prevValue + v | 0;\n return prevValue;\n };\n MutableInteger.prototype.increment = function () {\n this.getAndAdd_za3lpa$(1);\n };\n MutableInteger.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MutableInteger',\n interfaces: []\n };\n function SamplingUtil() {\n SamplingUtil_instance = this;\n }\n SamplingUtil.prototype.sampleWithoutReplacement_o7ew15$ = function (popSize, sampleSize, rand, onPick, onDrop) {\n var pick = sampleSize <= (popSize / 2 | 0);\n var indexCount = pick ? sampleSize : popSize - sampleSize | 0;\n var indexSet = HashSet_init_1();\n while (indexSet.size < indexCount) {\n indexSet.add_11rb$(rand.nextInt_za3lpa$(popSize));\n }\n return pick ? onPick(indexSet) : onDrop(indexSet);\n };\n function SamplingUtil$sampleWithoutReplacement$lambda(closure$data) {\n return function (it) {\n return closure$data.selectIndices_p1n9e9$(it);\n };\n }\n function SamplingUtil$sampleWithoutReplacement$lambda_0(closure$data) {\n return function (it) {\n return closure$data.dropIndices_p1n9e9$(it);\n };\n }\n SamplingUtil.prototype.sampleWithoutReplacement_egh5ya$ = function (sampleSize, rand, data) {\n return this.sampleWithoutReplacement_o7ew15$(data.rowCount(), sampleSize, rand, SamplingUtil$sampleWithoutReplacement$lambda(data), SamplingUtil$sampleWithoutReplacement$lambda_0(data));\n };\n SamplingUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'SamplingUtil',\n interfaces: []\n };\n var SamplingUtil_instance = null;\n function SamplingUtil_getInstance() {\n if (SamplingUtil_instance === null) {\n new SamplingUtil();\n }return SamplingUtil_instance;\n }\n Object.defineProperty(Aes, 'Companion', {\n get: Aes$Companion_getInstance\n });\n var package$jetbrains = _.jetbrains || (_.jetbrains = {});\n var package$datalore = package$jetbrains.datalore || (package$jetbrains.datalore = {});\n var package$plot = package$datalore.plot || (package$datalore.plot = {});\n var package$base = package$plot.base || (package$plot.base = {});\n package$base.Aes = Aes;\n package$base.Aesthetics = Aesthetics;\n package$base.ContinuousTransform = ContinuousTransform;\n package$base.CoordinateSystem = CoordinateSystem;\n DataFrame.OrderSpec = DataFrame$OrderSpec;\n Object.defineProperty(DataFrame$Variable$Source, 'ORIGIN', {\n get: DataFrame$Variable$Source$ORIGIN_getInstance\n });\n Object.defineProperty(DataFrame$Variable$Source, 'TRANSFORM', {\n get: DataFrame$Variable$Source$TRANSFORM_getInstance\n });\n Object.defineProperty(DataFrame$Variable$Source, 'STAT', {\n get: DataFrame$Variable$Source$STAT_getInstance\n });\n DataFrame$Variable.Source = DataFrame$Variable$Source;\n Object.defineProperty(DataFrame$Variable, 'Companion', {\n get: DataFrame$Variable$Companion_getInstance\n });\n DataFrame.Variable = DataFrame$Variable;\n Object.defineProperty(DataFrame, 'Companion', {\n get: DataFrame$Companion_getInstance\n });\n Object.defineProperty(DataFrame$Builder, 'Companion', {\n get: DataFrame$Builder$Companion_getInstance\n });\n DataFrame.Builder_init = DataFrame$DataFrame$Builder_init;\n DataFrame.Builder_init_dhhkv7$ = DataFrame$DataFrame$Builder_init_0;\n DataFrame.Builder = DataFrame$Builder;\n package$base.DataFrame = DataFrame;\n package$base.DataPointAesthetics = DataPointAesthetics;\n package$base.DiscreteTransform = DiscreteTransform;\n package$base.Geom = Geom;\n package$base.GeomContext = GeomContext;\n Object.defineProperty(GeomKind, 'PATH', {\n get: GeomKind$PATH_getInstance\n });\n Object.defineProperty(GeomKind, 'LINE', {\n get: GeomKind$LINE_getInstance\n });\n Object.defineProperty(GeomKind, 'SMOOTH', {\n get: GeomKind$SMOOTH_getInstance\n });\n Object.defineProperty(GeomKind, 'BAR', {\n get: GeomKind$BAR_getInstance\n });\n Object.defineProperty(GeomKind, 'HISTOGRAM', {\n get: GeomKind$HISTOGRAM_getInstance\n });\n Object.defineProperty(GeomKind, 'TILE', {\n get: GeomKind$TILE_getInstance\n });\n Object.defineProperty(GeomKind, 'BIN_2D', {\n get: GeomKind$BIN_2D_getInstance\n });\n Object.defineProperty(GeomKind, 'MAP', {\n get: GeomKind$MAP_getInstance\n });\n Object.defineProperty(GeomKind, 'ERROR_BAR', {\n get: GeomKind$ERROR_BAR_getInstance\n });\n Object.defineProperty(GeomKind, 'CROSS_BAR', {\n get: GeomKind$CROSS_BAR_getInstance\n });\n Object.defineProperty(GeomKind, 'LINE_RANGE', {\n get: GeomKind$LINE_RANGE_getInstance\n });\n Object.defineProperty(GeomKind, 'POINT_RANGE', {\n get: GeomKind$POINT_RANGE_getInstance\n });\n Object.defineProperty(GeomKind, 'POLYGON', {\n get: GeomKind$POLYGON_getInstance\n });\n Object.defineProperty(GeomKind, 'AB_LINE', {\n get: GeomKind$AB_LINE_getInstance\n });\n Object.defineProperty(GeomKind, 'H_LINE', {\n get: GeomKind$H_LINE_getInstance\n });\n Object.defineProperty(GeomKind, 'V_LINE', {\n get: GeomKind$V_LINE_getInstance\n });\n Object.defineProperty(GeomKind, 'BOX_PLOT', {\n get: GeomKind$BOX_PLOT_getInstance\n });\n Object.defineProperty(GeomKind, 'LIVE_MAP', {\n get: GeomKind$LIVE_MAP_getInstance\n });\n Object.defineProperty(GeomKind, 'POINT', {\n get: GeomKind$POINT_getInstance\n });\n Object.defineProperty(GeomKind, 'RIBBON', {\n get: GeomKind$RIBBON_getInstance\n });\n Object.defineProperty(GeomKind, 'AREA', {\n get: GeomKind$AREA_getInstance\n });\n Object.defineProperty(GeomKind, 'DENSITY', {\n get: GeomKind$DENSITY_getInstance\n });\n Object.defineProperty(GeomKind, 'CONTOUR', {\n get: GeomKind$CONTOUR_getInstance\n });\n Object.defineProperty(GeomKind, 'CONTOURF', {\n get: GeomKind$CONTOURF_getInstance\n });\n Object.defineProperty(GeomKind, 'DENSITY2D', {\n get: GeomKind$DENSITY2D_getInstance\n });\n Object.defineProperty(GeomKind, 'DENSITY2DF', {\n get: GeomKind$DENSITY2DF_getInstance\n });\n Object.defineProperty(GeomKind, 'JITTER', {\n get: GeomKind$JITTER_getInstance\n });\n Object.defineProperty(GeomKind, 'FREQPOLY', {\n get: GeomKind$FREQPOLY_getInstance\n });\n Object.defineProperty(GeomKind, 'STEP', {\n get: GeomKind$STEP_getInstance\n });\n Object.defineProperty(GeomKind, 'RECT', {\n get: GeomKind$RECT_getInstance\n });\n Object.defineProperty(GeomKind, 'SEGMENT', {\n get: GeomKind$SEGMENT_getInstance\n });\n Object.defineProperty(GeomKind, 'TEXT', {\n get: GeomKind$TEXT_getInstance\n });\n Object.defineProperty(GeomKind, 'RASTER', {\n get: GeomKind$RASTER_getInstance\n });\n Object.defineProperty(GeomKind, 'IMAGE', {\n get: GeomKind$IMAGE_getInstance\n });\n package$base.GeomKind = GeomKind;\n Object.defineProperty(package$base, 'GeomMeta', {\n get: GeomMeta_getInstance\n });\n package$base.PositionAdjustment = PositionAdjustment;\n Scale.Builder = Scale$Builder;\n package$base.Scale = Scale;\n package$base.Stat = Stat;\n package$base.StatContext = StatContext;\n package$base.Transform = Transform;\n var package$aes = package$base.aes || (package$base.aes = {});\n Object.defineProperty(package$aes, 'AesInitValue', {\n get: AesInitValue_getInstance\n });\n Object.defineProperty(package$aes, 'AesScaling', {\n get: AesScaling_getInstance\n });\n package$aes.AesVisitor = AesVisitor;\n Object.defineProperty(AestheticsBuilder, 'Companion', {\n get: AestheticsBuilder$Companion_getInstance\n });\n package$aes.AestheticsBuilder = AestheticsBuilder;\n Object.defineProperty(AestheticsDefaults, 'Companion', {\n get: AestheticsDefaults$Companion_getInstance\n });\n package$aes.AestheticsDefaults = AestheticsDefaults;\n Object.defineProperty(package$aes, 'AestheticsUtil', {\n get: AestheticsUtil_getInstance\n });\n package$aes.TypedIndexFunctionMap = TypedIndexFunctionMap;\n var package$coord = package$base.coord || (package$base.coord = {});\n Object.defineProperty(package$coord, 'Coords', {\n get: Coords_getInstance\n });\n package$coord.DefaultCoordinateSystem = DefaultCoordinateSystem;\n package$coord.Projection = Projection;\n var package$data = package$base.data || (package$base.data = {});\n Object.defineProperty(package$data, 'DataFrameUtil', {\n get: DataFrameUtil_getInstance\n });\n Object.defineProperty(package$data, 'Dummies', {\n get: Dummies_getInstance\n });\n Object.defineProperty(package$data, 'TransformVar', {\n get: TransformVar_getInstance\n });\n Object.defineProperty(ABLineGeom, 'Companion', {\n get: ABLineGeom$Companion_getInstance\n });\n var package$geom = package$base.geom || (package$base.geom = {});\n package$geom.ABLineGeom = ABLineGeom;\n Object.defineProperty(AreaGeom, 'Companion', {\n get: AreaGeom$Companion_getInstance\n });\n package$geom.AreaGeom = AreaGeom;\n Object.defineProperty(BarGeom, 'Companion', {\n get: BarGeom$Companion_getInstance\n });\n package$geom.BarGeom = BarGeom;\n Object.defineProperty(Bin2dGeom, 'Companion', {\n get: Bin2dGeom$Companion_getInstance\n });\n package$geom.Bin2dGeom = Bin2dGeom;\n Object.defineProperty(BoxplotGeom, 'Companion', {\n get: BoxplotGeom$Companion_getInstance\n });\n package$geom.BoxplotGeom = BoxplotGeom;\n Object.defineProperty(ContourGeom, 'Companion', {\n get: ContourGeom$Companion_getInstance\n });\n package$geom.ContourGeom = ContourGeom;\n Object.defineProperty(ContourfGeom, 'Companion', {\n get: ContourfGeom$Companion_getInstance\n });\n package$geom.ContourfGeom = ContourfGeom;\n Object.defineProperty(CrossBarGeom, 'Companion', {\n get: CrossBarGeom$Companion_getInstance\n });\n package$geom.CrossBarGeom = CrossBarGeom;\n Object.defineProperty(Density2dGeom, 'Companion', {\n get: Density2dGeom$Companion_getInstance\n });\n package$geom.Density2dGeom = Density2dGeom;\n Object.defineProperty(Density2dfGeom, 'Companion', {\n get: Density2dfGeom$Companion_getInstance\n });\n package$geom.Density2dfGeom = Density2dfGeom;\n Object.defineProperty(DensityGeom, 'Companion', {\n get: DensityGeom$Companion_getInstance\n });\n package$geom.DensityGeom = DensityGeom;\n Object.defineProperty(ErrorBarGeom, 'Companion', {\n get: ErrorBarGeom$Companion_getInstance\n });\n package$geom.ErrorBarGeom = ErrorBarGeom;\n Object.defineProperty(FilledCircleLegendKeyElementFactory, 'Companion', {\n get: FilledCircleLegendKeyElementFactory$Companion_getInstance\n });\n package$geom.FilledCircleLegendKeyElementFactory = FilledCircleLegendKeyElementFactory;\n package$geom.FilledSquareLegendKeyElementFactory = FilledSquareLegendKeyElementFactory;\n Object.defineProperty(FreqpolyGeom, 'Companion', {\n get: FreqpolyGeom$Companion_getInstance\n });\n package$geom.FreqpolyGeom = FreqpolyGeom;\n Object.defineProperty(GeomBase, 'Companion', {\n get: GeomBase$Companion_getInstance\n });\n package$geom.GeomBase = GeomBase;\n Object.defineProperty(HLineGeom, 'Companion', {\n get: HLineGeom$Companion_getInstance\n });\n package$geom.HLineGeom = HLineGeom;\n Object.defineProperty(HistogramGeom, 'Companion', {\n get: HistogramGeom$Companion_getInstance\n });\n package$geom.HistogramGeom = HistogramGeom;\n Object.defineProperty(ImageGeom, 'Companion', {\n get: ImageGeom$Companion_getInstance\n });\n package$geom.ImageGeom = ImageGeom;\n Object.defineProperty(JitterGeom, 'Companion', {\n get: JitterGeom$Companion_getInstance\n });\n package$geom.JitterGeom = JitterGeom;\n Object.defineProperty(LineGeom, 'Companion', {\n get: LineGeom$Companion_getInstance\n });\n package$geom.LineGeom = LineGeom;\n Object.defineProperty(LineRangeGeom, 'Companion', {\n get: LineRangeGeom$Companion_getInstance\n });\n package$geom.LineRangeGeom = LineRangeGeom;\n Object.defineProperty(LiveMapGeom, 'Companion', {\n get: LiveMapGeom$Companion_getInstance\n });\n package$geom.LiveMapGeom = LiveMapGeom;\n LiveMapProvider.LiveMapData = LiveMapProvider$LiveMapData;\n package$geom.LiveMapProvider = LiveMapProvider;\n Object.defineProperty(MapGeom, 'Companion', {\n get: MapGeom$Companion_getInstance\n });\n package$geom.MapGeom = MapGeom;\n Object.defineProperty(PathGeom, 'Companion', {\n get: PathGeom$Companion_getInstance\n });\n package$geom.PathGeom = PathGeom;\n Object.defineProperty(PieGeom, 'Companion', {\n get: PieGeom$Companion_getInstance\n });\n package$geom.PieGeom = PieGeom;\n Object.defineProperty(PointGeom, 'Companion', {\n get: PointGeom$Companion_getInstance\n });\n package$geom.PointGeom = PointGeom;\n package$geom.PointLegendKeyElementFactory = PointLegendKeyElementFactory;\n Object.defineProperty(PointRangeGeom, 'Companion', {\n get: PointRangeGeom$Companion_getInstance\n });\n package$geom.PointRangeGeom = PointRangeGeom;\n Object.defineProperty(PolygonGeom, 'Companion', {\n get: PolygonGeom$Companion_getInstance\n });\n package$geom.PolygonGeom = PolygonGeom;\n Object.defineProperty(RasterGeom, 'Companion', {\n get: RasterGeom$Companion_getInstance\n });\n package$geom.RasterGeom = RasterGeom;\n Object.defineProperty(RectGeom, 'Companion', {\n get: RectGeom$Companion_getInstance\n });\n package$geom.RectGeom = RectGeom;\n Object.defineProperty(RibbonGeom, 'Companion', {\n get: RibbonGeom$Companion_getInstance\n });\n package$geom.RibbonGeom = RibbonGeom;\n Object.defineProperty(SegmentGeom, 'Companion', {\n get: SegmentGeom$Companion_getInstance\n });\n package$geom.SegmentGeom = SegmentGeom;\n Object.defineProperty(SmoothGeom, 'Companion', {\n get: SmoothGeom$Companion_getInstance\n });\n package$geom.SmoothGeom = SmoothGeom;\n Object.defineProperty(StepGeom$Direction, 'HV', {\n get: StepGeom$Direction$HV_getInstance\n });\n Object.defineProperty(StepGeom$Direction, 'VH', {\n get: StepGeom$Direction$VH_getInstance\n });\n Object.defineProperty(StepGeom$Direction, 'Companion', {\n get: StepGeom$Direction$Companion_getInstance\n });\n StepGeom.Direction = StepGeom$Direction;\n Object.defineProperty(StepGeom, 'Companion', {\n get: StepGeom$Companion_getInstance\n });\n package$geom.StepGeom = StepGeom;\n Object.defineProperty(TextGeom, 'Companion', {\n get: TextGeom$Companion_getInstance\n });\n package$geom.TextGeom = TextGeom;\n package$geom.TextLegendKeyElementFactory = TextLegendKeyElementFactory;\n Object.defineProperty(TileGeom, 'Companion', {\n get: TileGeom$Companion_getInstance\n });\n package$geom.TileGeom = TileGeom;\n Object.defineProperty(VLineGeom, 'Companion', {\n get: VLineGeom$Companion_getInstance\n });\n package$geom.VLineGeom = VLineGeom;\n var package$legend = package$geom.legend || (package$geom.legend = {});\n package$legend.CompositeLegendKeyElementFactory = CompositeLegendKeyElementFactory;\n package$legend.GenericLegendKeyElementFactory = GenericLegendKeyElementFactory;\n package$legend.HLineLegendKeyElementFactory = HLineLegendKeyElementFactory;\n package$legend.VLineLegendKeyElementFactory = VLineLegendKeyElementFactory;\n Object.defineProperty(ArrowSpec$End, 'LAST', {\n get: ArrowSpec$End$LAST_getInstance\n });\n Object.defineProperty(ArrowSpec$End, 'FIRST', {\n get: ArrowSpec$End$FIRST_getInstance\n });\n Object.defineProperty(ArrowSpec$End, 'BOTH', {\n get: ArrowSpec$End$BOTH_getInstance\n });\n ArrowSpec.End = ArrowSpec$End;\n Object.defineProperty(ArrowSpec$Type, 'OPEN', {\n get: ArrowSpec$Type$OPEN_getInstance\n });\n Object.defineProperty(ArrowSpec$Type, 'CLOSED', {\n get: ArrowSpec$Type$CLOSED_getInstance\n });\n ArrowSpec.Type = ArrowSpec$Type;\n var package$util = package$geom.util || (package$geom.util = {});\n package$util.ArrowSpec = ArrowSpec;\n Object.defineProperty(package$util, 'BarTooltipHelper', {\n get: BarTooltipHelper_getInstance\n });\n Object.defineProperty(package$util, 'CrossBarHelper', {\n get: CrossBarHelper_getInstance\n });\n package$util.DataPointAestheticsDelegate = DataPointAestheticsDelegate;\n package$util.GeomCoord = GeomCoord;\n GeomHelper.SvgElementHelper = GeomHelper$SvgElementHelper;\n Object.defineProperty(GeomHelper, 'Companion', {\n get: GeomHelper$Companion_getInstance\n });\n package$util.GeomHelper = GeomHelper;\n Object.defineProperty(package$util, 'GeomUtil', {\n get: GeomUtil_getInstance\n });\n Object.defineProperty(package$util, 'HintColorUtil', {\n get: HintColorUtil_getInstance\n });\n HintsCollection$HintConfigFactory.HintConfig = HintsCollection$HintConfigFactory$HintConfig;\n HintsCollection.HintConfigFactory = HintsCollection$HintConfigFactory;\n package$util.HintsCollection = HintsCollection;\n Object.defineProperty(LinePathConstructor, 'Companion', {\n get: LinePathConstructor$Companion_getInstance\n });\n package$util.LinePathConstructor = LinePathConstructor;\n LinesHelper.PathInfo = LinesHelper$PathInfo;\n package$util.LinesHelper = LinesHelper;\n package$util.MappedAesthetics = MappedAesthetics;\n package$util.MultiPointData = MultiPointData;\n MultiPointDataConstructor.prototype.PointCollector = MultiPointDataConstructor$PointCollector;\n Object.defineProperty(package$util, 'MultiPointDataConstructor', {\n get: MultiPointDataConstructor_getInstance\n });\n package$util.RectTargetCollectorHelper = RectTargetCollectorHelper;\n package$util.RectanglesHelper = RectanglesHelper;\n var package$interact = package$base.interact || (package$base.interact = {});\n package$interact.ContextualMapping = ContextualMapping;\n package$interact.DataContext = DataContext;\n package$interact.GeomTarget = GeomTarget;\n Object.defineProperty(GeomTargetCollector$TooltipParams, 'Companion', {\n get: GeomTargetCollector$TooltipParams$Companion_getInstance\n });\n GeomTargetCollector.TooltipParams = GeomTargetCollector$TooltipParams;\n package$interact.GeomTargetCollector = GeomTargetCollector;\n Object.defineProperty(GeomTargetLocator$LookupSpace, 'X', {\n get: GeomTargetLocator$LookupSpace$X_getInstance\n });\n Object.defineProperty(GeomTargetLocator$LookupSpace, 'XY', {\n get: GeomTargetLocator$LookupSpace$XY_getInstance\n });\n Object.defineProperty(GeomTargetLocator$LookupSpace, 'NONE', {\n get: GeomTargetLocator$LookupSpace$NONE_getInstance\n });\n GeomTargetLocator.LookupSpace = GeomTargetLocator$LookupSpace;\n Object.defineProperty(GeomTargetLocator$LookupStrategy, 'HOVER', {\n get: GeomTargetLocator$LookupStrategy$HOVER_getInstance\n });\n Object.defineProperty(GeomTargetLocator$LookupStrategy, 'NEAREST', {\n get: GeomTargetLocator$LookupStrategy$NEAREST_getInstance\n });\n Object.defineProperty(GeomTargetLocator$LookupStrategy, 'NONE', {\n get: GeomTargetLocator$LookupStrategy$NONE_getInstance\n });\n GeomTargetLocator.LookupStrategy = GeomTargetLocator$LookupStrategy;\n Object.defineProperty(GeomTargetLocator$LookupSpec, 'Companion', {\n get: GeomTargetLocator$LookupSpec$Companion_getInstance\n });\n GeomTargetLocator.LookupSpec = GeomTargetLocator$LookupSpec;\n GeomTargetLocator.LookupResult = GeomTargetLocator$LookupResult;\n package$interact.GeomTargetLocator = GeomTargetLocator;\n Object.defineProperty(HitShape$Kind, 'POINT', {\n get: HitShape$Kind$POINT_getInstance\n });\n Object.defineProperty(HitShape$Kind, 'RECT', {\n get: HitShape$Kind$RECT_getInstance\n });\n Object.defineProperty(HitShape$Kind, 'POLYGON', {\n get: HitShape$Kind$POLYGON_getInstance\n });\n Object.defineProperty(HitShape$Kind, 'PATH', {\n get: HitShape$Kind$PATH_getInstance\n });\n HitShape.Kind = HitShape$Kind;\n HitShape.DoubleCircle = HitShape$DoubleCircle;\n Object.defineProperty(HitShape, 'Companion', {\n get: HitShape$Companion_getInstance\n });\n package$interact.HitShape = HitShape;\n MappedDataAccess.MappedData = MappedDataAccess$MappedData;\n package$interact.MappedDataAccess = MappedDataAccess;\n package$interact.NullGeomTargetCollector = NullGeomTargetCollector;\n Object.defineProperty(TipLayoutHint$StemLength, 'NORMAL', {\n get: TipLayoutHint$StemLength$NORMAL_getInstance\n });\n Object.defineProperty(TipLayoutHint$StemLength, 'SHORT', {\n get: TipLayoutHint$StemLength$SHORT_getInstance\n });\n Object.defineProperty(TipLayoutHint$StemLength, 'NONE', {\n get: TipLayoutHint$StemLength$NONE_getInstance\n });\n TipLayoutHint.StemLength = TipLayoutHint$StemLength;\n Object.defineProperty(TipLayoutHint$Kind, 'VERTICAL_TOOLTIP', {\n get: TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance\n });\n Object.defineProperty(TipLayoutHint$Kind, 'HORIZONTAL_TOOLTIP', {\n get: TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance\n });\n Object.defineProperty(TipLayoutHint$Kind, 'CURSOR_TOOLTIP', {\n get: TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance\n });\n Object.defineProperty(TipLayoutHint$Kind, 'X_AXIS_TOOLTIP', {\n get: TipLayoutHint$Kind$X_AXIS_TOOLTIP_getInstance\n });\n Object.defineProperty(TipLayoutHint$Kind, 'Y_AXIS_TOOLTIP', {\n get: TipLayoutHint$Kind$Y_AXIS_TOOLTIP_getInstance\n });\n TipLayoutHint.Kind = TipLayoutHint$Kind;\n Object.defineProperty(TipLayoutHint, 'Companion', {\n get: TipLayoutHint$Companion_getInstance\n });\n package$interact.TipLayoutHint = TipLayoutHint;\n Object.defineProperty(TooltipAnchor$VerticalAnchor, 'TOP', {\n get: TooltipAnchor$VerticalAnchor$TOP_getInstance\n });\n Object.defineProperty(TooltipAnchor$VerticalAnchor, 'BOTTOM', {\n get: TooltipAnchor$VerticalAnchor$BOTTOM_getInstance\n });\n Object.defineProperty(TooltipAnchor$VerticalAnchor, 'MIDDLE', {\n get: TooltipAnchor$VerticalAnchor$MIDDLE_getInstance\n });\n TooltipAnchor.VerticalAnchor = TooltipAnchor$VerticalAnchor;\n Object.defineProperty(TooltipAnchor$HorizontalAnchor, 'LEFT', {\n get: TooltipAnchor$HorizontalAnchor$LEFT_getInstance\n });\n Object.defineProperty(TooltipAnchor$HorizontalAnchor, 'RIGHT', {\n get: TooltipAnchor$HorizontalAnchor$RIGHT_getInstance\n });\n Object.defineProperty(TooltipAnchor$HorizontalAnchor, 'CENTER', {\n get: TooltipAnchor$HorizontalAnchor$CENTER_getInstance\n });\n TooltipAnchor.HorizontalAnchor = TooltipAnchor$HorizontalAnchor;\n package$interact.TooltipAnchor = TooltipAnchor;\n TooltipLineSpec.DataPoint = TooltipLineSpec$DataPoint;\n package$interact.TooltipLineSpec = TooltipLineSpec;\n Object.defineProperty(LivemapConstants$DisplayMode, 'POINT', {\n get: LivemapConstants$DisplayMode$POINT_getInstance\n });\n Object.defineProperty(LivemapConstants$DisplayMode, 'PIE', {\n get: LivemapConstants$DisplayMode$PIE_getInstance\n });\n Object.defineProperty(LivemapConstants$DisplayMode, 'BAR', {\n get: LivemapConstants$DisplayMode$BAR_getInstance\n });\n LivemapConstants.DisplayMode = LivemapConstants$DisplayMode;\n Object.defineProperty(LivemapConstants$Theme, 'COLOR', {\n get: LivemapConstants$Theme$COLOR_getInstance\n });\n Object.defineProperty(LivemapConstants$Theme, 'LIGHT', {\n get: LivemapConstants$Theme$LIGHT_getInstance\n });\n Object.defineProperty(LivemapConstants$Theme, 'DARK', {\n get: LivemapConstants$Theme$DARK_getInstance\n });\n LivemapConstants.Theme = LivemapConstants$Theme;\n Object.defineProperty(LivemapConstants$Projection, 'EPSG3857', {\n get: LivemapConstants$Projection$EPSG3857_getInstance\n });\n Object.defineProperty(LivemapConstants$Projection, 'EPSG4326', {\n get: LivemapConstants$Projection$EPSG4326_getInstance\n });\n Object.defineProperty(LivemapConstants$Projection, 'AZIMUTHAL', {\n get: LivemapConstants$Projection$AZIMUTHAL_getInstance\n });\n Object.defineProperty(LivemapConstants$Projection, 'CONIC', {\n get: LivemapConstants$Projection$CONIC_getInstance\n });\n LivemapConstants.Projection = LivemapConstants$Projection;\n var package$livemap = package$base.livemap || (package$base.livemap = {});\n package$livemap.LivemapConstants = LivemapConstants;\n package$livemap.LiveMapOptions = LiveMapOptions;\n var package$pos = package$base.pos || (package$base.pos = {});\n package$pos.DodgePos = DodgePos;\n package$pos.FillPos = FillPos;\n package$pos.JitterDodgePos = JitterDodgePos;\n Object.defineProperty(JitterPos, 'Companion', {\n get: JitterPos$Companion_getInstance\n });\n package$pos.JitterPos = JitterPos;\n Object.defineProperty(NudgePos, 'Companion', {\n get: NudgePos$Companion_getInstance\n });\n package$pos.NudgePos = NudgePos;\n Object.defineProperty(PositionAdjustments$Meta, 'IDENTITY', {\n get: PositionAdjustments$Meta$IDENTITY_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'DODGE', {\n get: PositionAdjustments$Meta$DODGE_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'STACK', {\n get: PositionAdjustments$Meta$STACK_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'FILL', {\n get: PositionAdjustments$Meta$FILL_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'JITTER', {\n get: PositionAdjustments$Meta$JITTER_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'NUDGE', {\n get: PositionAdjustments$Meta$NUDGE_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'JITTER_DODGE', {\n get: PositionAdjustments$Meta$JITTER_DODGE_getInstance\n });\n PositionAdjustments.prototype.Meta = PositionAdjustments$Meta;\n Object.defineProperty(PositionAdjustments$StackingStrategy, 'SUM_POSITIVE_NEGATIVE', {\n get: PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_getInstance\n });\n Object.defineProperty(PositionAdjustments$StackingStrategy, 'SPLIT_POSITIVE_NEGATIVE', {\n get: PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_getInstance\n });\n PositionAdjustments.prototype.StackingStrategy = PositionAdjustments$StackingStrategy;\n Object.defineProperty(package$pos, 'PositionAdjustments', {\n get: PositionAdjustments_getInstance\n });\n Object.defineProperty(StackPos, 'Companion', {\n get: StackPos$Companion_getInstance\n });\n package$pos.StackPos = StackPos;\n var package$render = package$base.render || (package$base.render = {});\n package$render.LegendKeyElementFactory = LegendKeyElementFactory;\n package$render.SvgRoot = SvgRoot;\n var package$linetype = package$render.linetype || (package$render.linetype = {});\n package$linetype.LineType = LineType;\n Object.defineProperty(NamedLineType, 'BLANK', {\n get: NamedLineType$BLANK_getInstance\n });\n Object.defineProperty(NamedLineType, 'SOLID', {\n get: NamedLineType$SOLID_getInstance\n });\n Object.defineProperty(NamedLineType, 'DASHED', {\n get: NamedLineType$DASHED_getInstance\n });\n Object.defineProperty(NamedLineType, 'DOTTED', {\n get: NamedLineType$DOTTED_getInstance\n });\n Object.defineProperty(NamedLineType, 'DOTDASH', {\n get: NamedLineType$DOTDASH_getInstance\n });\n Object.defineProperty(NamedLineType, 'LONGDASH', {\n get: NamedLineType$LONGDASH_getInstance\n });\n Object.defineProperty(NamedLineType, 'TWODASH', {\n get: NamedLineType$TWODASH_getInstance\n });\n package$linetype.NamedLineType = NamedLineType;\n Object.defineProperty(NamedShape, 'STICK_SQUARE', {\n get: NamedShape$STICK_SQUARE_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_CIRCLE', {\n get: NamedShape$STICK_CIRCLE_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_TRIANGLE_UP', {\n get: NamedShape$STICK_TRIANGLE_UP_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_PLUS', {\n get: NamedShape$STICK_PLUS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_CROSS', {\n get: NamedShape$STICK_CROSS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_DIAMOND', {\n get: NamedShape$STICK_DIAMOND_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_TRIANGLE_DOWN', {\n get: NamedShape$STICK_TRIANGLE_DOWN_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_SQUARE_CROSS', {\n get: NamedShape$STICK_SQUARE_CROSS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_STAR', {\n get: NamedShape$STICK_STAR_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_DIAMOND_PLUS', {\n get: NamedShape$STICK_DIAMOND_PLUS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_CIRCLE_PLUS', {\n get: NamedShape$STICK_CIRCLE_PLUS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_TRIANGLE_UP_DOWN', {\n get: NamedShape$STICK_TRIANGLE_UP_DOWN_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_SQUARE_PLUS', {\n get: NamedShape$STICK_SQUARE_PLUS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_CIRCLE_CROSS', {\n get: NamedShape$STICK_CIRCLE_CROSS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_SQUARE_TRIANGLE_UP', {\n get: NamedShape$STICK_SQUARE_TRIANGLE_UP_getInstance\n });\n Object.defineProperty(NamedShape, 'SOLID_SQUARE', {\n get: NamedShape$SOLID_SQUARE_getInstance\n });\n Object.defineProperty(NamedShape, 'SOLID_CIRCLE', {\n get: NamedShape$SOLID_CIRCLE_getInstance\n });\n Object.defineProperty(NamedShape, 'SOLID_TRIANGLE_UP', {\n get: NamedShape$SOLID_TRIANGLE_UP_getInstance\n });\n Object.defineProperty(NamedShape, 'SOLID_DIAMOND', {\n get: NamedShape$SOLID_DIAMOND_getInstance\n });\n Object.defineProperty(NamedShape, 'SOLID_CIRCLE_2', {\n get: NamedShape$SOLID_CIRCLE_2_getInstance\n });\n Object.defineProperty(NamedShape, 'BULLET', {\n get: NamedShape$BULLET_getInstance\n });\n Object.defineProperty(NamedShape, 'FILLED_CIRCLE', {\n get: NamedShape$FILLED_CIRCLE_getInstance\n });\n Object.defineProperty(NamedShape, 'FILLED_SQUARE', {\n get: NamedShape$FILLED_SQUARE_getInstance\n });\n Object.defineProperty(NamedShape, 'FILLED_DIAMOND', {\n get: NamedShape$FILLED_DIAMOND_getInstance\n });\n Object.defineProperty(NamedShape, 'FILLED_TRIANGLE_UP', {\n get: NamedShape$FILLED_TRIANGLE_UP_getInstance\n });\n Object.defineProperty(NamedShape, 'FILLED_TRIANGLE_DOWN', {\n get: NamedShape$FILLED_TRIANGLE_DOWN_getInstance\n });\n var package$point = package$render.point || (package$render.point = {});\n package$point.NamedShape = NamedShape;\n package$point.PointShape = PointShape;\n Object.defineProperty(package$point, 'PointShapeSvg', {\n get: PointShapeSvg_getInstance\n });\n Object.defineProperty(package$point, 'TinyPointShape', {\n get: TinyPointShape_getInstance\n });\n package$point.UpdatableShape = UpdatableShape;\n var package$symbol = package$point.symbol || (package$point.symbol = {});\n package$symbol.CircleGlyph = CircleGlyph;\n Object.defineProperty(CrossGlyph, 'Companion', {\n get: CrossGlyph$Companion_getInstance\n });\n package$symbol.CrossGlyph = CrossGlyph;\n package$symbol.DiamondGlyph = DiamondGlyph;\n package$symbol.Glyph = Glyph;\n package$symbol.GlyphPair = GlyphPair;\n Object.defineProperty(package$symbol, 'GlyphUtil', {\n get: GlyphUtil_getInstance\n });\n Object.defineProperty(package$symbol, 'Glyphs', {\n get: Glyphs_getInstance\n });\n package$symbol.MultiShapeGlyph = MultiShapeGlyph;\n package$symbol.PlusGlyph = PlusGlyph;\n package$symbol.SingletonGlyph_init_i91tmr$ = SingletonGlyph_init;\n package$symbol.SingletonGlyph_init_e1sv3v$ = SingletonGlyph_init_0;\n package$symbol.SingletonGlyph = SingletonGlyph;\n package$symbol.SquareGlyph = SquareGlyph;\n Object.defineProperty(TriangleGlyph, 'Companion', {\n get: TriangleGlyph$Companion_getInstance\n });\n package$symbol.TriangleGlyph = TriangleGlyph;\n package$symbol.TwoShapeGlyph = TwoShapeGlyph;\n var package$svg = package$render.svg || (package$render.svg = {});\n package$svg.GroupComponent = GroupComponent;\n Object.defineProperty(LinePath, 'Companion', {\n get: LinePath$Companion_getInstance\n });\n package$svg.LinePath = LinePath;\n Object.defineProperty(package$svg, 'StrokeDashArraySupport', {\n get: StrokeDashArraySupport_getInstance\n });\n Object.defineProperty(SvgComponent, 'Companion', {\n get: SvgComponent$Companion_getInstance\n });\n package$svg.SvgComponent = SvgComponent;\n Object.defineProperty(package$svg, 'SvgUID', {\n get: SvgUID_getInstance\n });\n Object.defineProperty(TextLabel$HorizontalAnchor, 'LEFT', {\n get: TextLabel$HorizontalAnchor$LEFT_getInstance\n });\n Object.defineProperty(TextLabel$HorizontalAnchor, 'RIGHT', {\n get: TextLabel$HorizontalAnchor$RIGHT_getInstance\n });\n Object.defineProperty(TextLabel$HorizontalAnchor, 'MIDDLE', {\n get: TextLabel$HorizontalAnchor$MIDDLE_getInstance\n });\n TextLabel.HorizontalAnchor = TextLabel$HorizontalAnchor;\n Object.defineProperty(TextLabel$VerticalAnchor, 'TOP', {\n get: TextLabel$VerticalAnchor$TOP_getInstance\n });\n Object.defineProperty(TextLabel$VerticalAnchor, 'BOTTOM', {\n get: TextLabel$VerticalAnchor$BOTTOM_getInstance\n });\n Object.defineProperty(TextLabel$VerticalAnchor, 'CENTER', {\n get: TextLabel$VerticalAnchor$CENTER_getInstance\n });\n TextLabel.VerticalAnchor = TextLabel$VerticalAnchor;\n package$svg.TextLabel = TextLabel;\n var package$scale = package$base.scale || (package$base.scale = {});\n package$scale.AbstractScale = AbstractScale;\n package$scale.BreaksGenerator = BreaksGenerator;\n package$scale.ContinuousScale_init_lo18em$ = ContinuousScale_init;\n package$scale.ContinuousScale = ContinuousScale;\n package$scale.DiscreteScale_init_l9mre7$ = DiscreteScale_init;\n package$scale.DiscreteScale = DiscreteScale;\n Object.defineProperty(package$scale, 'MapperUtil', {\n get: MapperUtil_getInstance\n });\n Object.defineProperty(package$scale, 'Mappers', {\n get: Mappers_getInstance\n });\n package$scale.ScaleBreaks = ScaleBreaks;\n Object.defineProperty(package$scale, 'ScaleUtil', {\n get: ScaleUtil_getInstance\n });\n Object.defineProperty(package$scale, 'Scales', {\n get: Scales_getInstance\n });\n var package$breaks = package$scale.breaks || (package$scale.breaks = {});\n package$breaks.BreaksHelperBase = BreaksHelperBase;\n package$breaks.DateTimeBreaksHelper = DateTimeBreaksHelper;\n Object.defineProperty(LinearBreaksHelper, 'Companion', {\n get: LinearBreaksHelper$Companion_getInstance\n });\n package$breaks.LinearBreaksHelper = LinearBreaksHelper;\n package$breaks.NumericBreakFormatter = NumericBreakFormatter;\n package$breaks.QuantizeScale = QuantizeScale;\n Object.defineProperty(package$breaks, 'ScaleBreaksUtil', {\n get: ScaleBreaksUtil_getInstance\n });\n package$breaks.TimeScaleTickFormatterFactory = TimeScaleTickFormatterFactory;\n package$breaks.WithFiniteOrderedOutput = WithFiniteOrderedOutput;\n var package$transform = package$scale.transform || (package$scale.transform = {});\n package$transform.DateTimeBreaksGen = DateTimeBreaksGen;\n package$transform.FunTransform = FunTransform;\n package$transform.IdentityTransform = IdentityTransform;\n Object.defineProperty(LinearBreaksGen, 'Companion', {\n get: LinearBreaksGen$Companion_getInstance\n });\n package$transform.LinearBreaksGen = LinearBreaksGen;\n Object.defineProperty(Log10Transform, 'Companion', {\n get: Log10Transform$Companion_getInstance\n });\n package$transform.Log10Transform = Log10Transform;\n Object.defineProperty(NonlinearBreaksGen, 'Companion', {\n get: NonlinearBreaksGen$Companion_getInstance\n });\n package$transform.NonlinearBreaksGen = NonlinearBreaksGen;\n package$transform.ReverseTransform = ReverseTransform;\n package$transform.SqrtTransform = SqrtTransform;\n Transforms.prototype.BreaksGeneratorForTransformedDomain = Transforms$BreaksGeneratorForTransformedDomain;\n Object.defineProperty(package$transform, 'Transforms', {\n get: Transforms_getInstance\n });\n Object.defineProperty(AbstractDensity2dStat, 'Companion', {\n get: AbstractDensity2dStat$Companion_getInstance\n });\n var package$stat = package$base.stat || (package$base.stat = {});\n package$stat.AbstractDensity2dStat = AbstractDensity2dStat;\n package$stat.BaseStat = BaseStat;\n Object.defineProperty(Bin2dStat, 'Companion', {\n get: Bin2dStat$Companion_getInstance\n });\n Bin2dStat.Bins2dData = Bin2dStat$Bins2dData;\n Bin2dStat.Bins2dWeightedCounts = Bin2dStat$Bins2dWeightedCounts;\n package$stat.Bin2dStat = Bin2dStat;\n Object.defineProperty(BinStat$XPosKind, 'NONE', {\n get: BinStat$XPosKind$NONE_getInstance\n });\n Object.defineProperty(BinStat$XPosKind, 'CENTER', {\n get: BinStat$XPosKind$CENTER_getInstance\n });\n Object.defineProperty(BinStat$XPosKind, 'BOUNDARY', {\n get: BinStat$XPosKind$BOUNDARY_getInstance\n });\n BinStat.XPosKind = BinStat$XPosKind;\n Object.defineProperty(BinStat, 'Companion', {\n get: BinStat$Companion_getInstance\n });\n package$stat.BinStat = BinStat;\n BinStatUtil.prototype.BinOptions = BinStatUtil$BinOptions;\n BinStatUtil.prototype.CountAndWidth = BinStatUtil$CountAndWidth;\n BinStatUtil.prototype.BinsData = BinStatUtil$BinsData;\n Object.defineProperty(package$stat, 'BinStatUtil', {\n get: BinStatUtil_getInstance\n });\n Object.defineProperty(BoxplotStat, 'Companion', {\n get: BoxplotStat$Companion_getInstance\n });\n package$stat.BoxplotStat = BoxplotStat;\n Object.defineProperty(Contour, 'Companion', {\n get: Contour$Companion_getInstance\n });\n package$stat.Contour = Contour;\n Object.defineProperty(ContourFillHelper, 'Companion', {\n get: ContourFillHelper$Companion_getInstance\n });\n package$stat.ContourFillHelper = ContourFillHelper;\n Object.defineProperty(ContourStat, 'Companion', {\n get: ContourStat$Companion_getInstance\n });\n package$stat.ContourStat = ContourStat;\n Object.defineProperty(package$stat, 'ContourStatUtil', {\n get: ContourStatUtil_getInstance\n });\n Object.defineProperty(ContourfStat, 'Companion', {\n get: ContourfStat$Companion_getInstance\n });\n package$stat.ContourfStat = ContourfStat;\n Object.defineProperty(CorrelationStat$Method, 'PEARSON', {\n get: CorrelationStat$Method$PEARSON_getInstance\n });\n Object.defineProperty(CorrelationStat$Method, 'SPEARMAN', {\n get: CorrelationStat$Method$SPEARMAN_getInstance\n });\n Object.defineProperty(CorrelationStat$Method, 'KENDALL', {\n get: CorrelationStat$Method$KENDALL_getInstance\n });\n CorrelationStat.Method = CorrelationStat$Method;\n Object.defineProperty(CorrelationStat$Type, 'FULL', {\n get: CorrelationStat$Type$FULL_getInstance\n });\n Object.defineProperty(CorrelationStat$Type, 'UPPER', {\n get: CorrelationStat$Type$UPPER_getInstance\n });\n Object.defineProperty(CorrelationStat$Type, 'LOWER', {\n get: CorrelationStat$Type$LOWER_getInstance\n });\n CorrelationStat.Type = CorrelationStat$Type;\n Object.defineProperty(CorrelationStat, 'Companion', {\n get: CorrelationStat$Companion_getInstance\n });\n package$stat.CorrelationStat = CorrelationStat;\n Object.defineProperty(package$stat, 'CorrelationUtil', {\n get: CorrelationUtil_getInstance\n });\n Object.defineProperty(CountStat, 'Companion', {\n get: CountStat$Companion_getInstance\n });\n package$stat.CountStat = CountStat;\n package$stat.Density2dStat = Density2dStat;\n package$stat.Density2dfStat = Density2dfStat;\n Object.defineProperty(DensityStat$Kernel, 'GAUSSIAN', {\n get: DensityStat$Kernel$GAUSSIAN_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'RECTANGULAR', {\n get: DensityStat$Kernel$RECTANGULAR_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'TRIANGULAR', {\n get: DensityStat$Kernel$TRIANGULAR_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'BIWEIGHT', {\n get: DensityStat$Kernel$BIWEIGHT_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'EPANECHNIKOV', {\n get: DensityStat$Kernel$EPANECHNIKOV_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'OPTCOSINE', {\n get: DensityStat$Kernel$OPTCOSINE_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'COSINE', {\n get: DensityStat$Kernel$COSINE_getInstance\n });\n DensityStat.Kernel = DensityStat$Kernel;\n Object.defineProperty(DensityStat$BandWidthMethod, 'NRD0', {\n get: DensityStat$BandWidthMethod$NRD0_getInstance\n });\n Object.defineProperty(DensityStat$BandWidthMethod, 'NRD', {\n get: DensityStat$BandWidthMethod$NRD_getInstance\n });\n DensityStat.BandWidthMethod = DensityStat$BandWidthMethod;\n Object.defineProperty(DensityStat, 'Companion', {\n get: DensityStat$Companion_getInstance\n });\n package$stat.DensityStat = DensityStat;\n Object.defineProperty(package$stat, 'DensityStatUtil', {\n get: DensityStatUtil_getInstance\n });\n package$stat.FiveNumberSummary_init_d3e2cz$ = FiveNumberSummary_init;\n package$stat.FiveNumberSummary_init_1lq62i$ = FiveNumberSummary_init_0;\n package$stat.FiveNumberSummary = FiveNumberSummary;\n package$stat.MultiOrdering = MultiOrdering;\n package$stat.SimpleStatContext = SimpleStatContext;\n Object.defineProperty(SmoothStat$Method, 'LM', {\n get: SmoothStat$Method$LM_getInstance\n });\n Object.defineProperty(SmoothStat$Method, 'GLM', {\n get: SmoothStat$Method$GLM_getInstance\n });\n Object.defineProperty(SmoothStat$Method, 'GAM', {\n get: SmoothStat$Method$GAM_getInstance\n });\n Object.defineProperty(SmoothStat$Method, 'LOESS', {\n get: SmoothStat$Method$LOESS_getInstance\n });\n Object.defineProperty(SmoothStat$Method, 'RLM', {\n get: SmoothStat$Method$RLM_getInstance\n });\n SmoothStat.Method = SmoothStat$Method;\n Object.defineProperty(SmoothStat, 'Companion', {\n get: SmoothStat$Companion_getInstance\n });\n package$stat.SmoothStat = SmoothStat;\n Object.defineProperty(package$stat, 'Stats', {\n get: Stats_getInstance\n });\n Object.defineProperty(AbstractRealDistribution, 'Companion', {\n get: AbstractRealDistribution$Companion_getInstance\n });\n var package$math3 = package$stat.math3 || (package$stat.math3 = {});\n package$math3.AbstractRealDistribution = AbstractRealDistribution;\n package$math3.AbstractUnivariateSolver_init_14dthe$ = AbstractUnivariateSolver_init;\n package$math3.AbstractUnivariateSolver_init_lu1900$ = AbstractUnivariateSolver_init_0;\n package$math3.AbstractUnivariateSolver_init_yvo9jy$ = AbstractUnivariateSolver_init_1;\n package$math3.AbstractUnivariateSolver = AbstractUnivariateSolver;\n Object.defineProperty(AllowedSolution, 'ANY_SIDE', {\n get: AllowedSolution$ANY_SIDE_getInstance\n });\n Object.defineProperty(AllowedSolution, 'LEFT_SIDE', {\n get: AllowedSolution$LEFT_SIDE_getInstance\n });\n Object.defineProperty(AllowedSolution, 'RIGHT_SIDE', {\n get: AllowedSolution$RIGHT_SIDE_getInstance\n });\n Object.defineProperty(AllowedSolution, 'BELOW_SIDE', {\n get: AllowedSolution$BELOW_SIDE_getInstance\n });\n Object.defineProperty(AllowedSolution, 'ABOVE_SIDE', {\n get: AllowedSolution$ABOVE_SIDE_getInstance\n });\n package$math3.AllowedSolution = AllowedSolution;\n Object.defineProperty(BaseAbstractUnivariateSolver, 'Companion', {\n get: BaseAbstractUnivariateSolver$Companion_getInstance\n });\n package$math3.BaseAbstractUnivariateSolver_init_8vzwiz$ = BaseAbstractUnivariateSolver_init;\n package$math3.BaseAbstractUnivariateSolver = BaseAbstractUnivariateSolver;\n package$math3.BaseUnivariateSolver = BaseUnivariateSolver;\n Object.defineProperty(package$math3, 'Beta', {\n get: Beta_getInstance\n });\n package$math3.BlockRealMatrix_init_vux9f0$ = BlockRealMatrix_init;\n package$math3.BlockRealMatrix_init_n8oub7$ = BlockRealMatrix_init_0;\n package$math3.BlockRealMatrix = BlockRealMatrix;\n package$math3.BracketedUnivariateSolver = BracketedUnivariateSolver;\n Object.defineProperty(BrentSolver, 'Companion', {\n get: BrentSolver$Companion_getInstance\n });\n package$math3.BrentSolver_init_14dthe$ = BrentSolver_init;\n package$math3.BrentSolver_init_lu1900$ = BrentSolver_init_0;\n package$math3.BrentSolver_init_yvo9jy$ = BrentSolver_init_1;\n package$math3.BrentSolver = BrentSolver;\n Object.defineProperty(ContinuedFraction, 'Companion', {\n get: ContinuedFraction$Companion_getInstance\n });\n package$math3.ContinuedFraction = ContinuedFraction;\n package$math3.mean_gf7tl1$ = mean;\n package$math3.correlationPearson_g9g6do$ = correlationPearson;\n Object.defineProperty(ForsythePolynomialGenerator, 'Companion', {\n get: ForsythePolynomialGenerator$Companion_getInstance\n });\n package$math3.ForsythePolynomialGenerator = ForsythePolynomialGenerator;\n Object.defineProperty(package$math3, 'Gamma', {\n get: Gamma_getInstance\n });\n Incrementor.MaxCountExceededCallback = Incrementor$MaxCountExceededCallback;\n package$math3.Incrementor = Incrementor;\n Object.defineProperty(LoessInterpolator, 'Companion', {\n get: LoessInterpolator$Companion_getInstance\n });\n package$math3.LoessInterpolator = LoessInterpolator;\n Object.defineProperty(MathArrays$OrderDirection, 'INCREASING', {\n get: MathArrays$OrderDirection$INCREASING_getInstance\n });\n Object.defineProperty(MathArrays$OrderDirection, 'DECREASING', {\n get: MathArrays$OrderDirection$DECREASING_getInstance\n });\n MathArrays.prototype.OrderDirection = MathArrays$OrderDirection;\n Object.defineProperty(package$math3, 'MathArrays', {\n get: MathArrays_getInstance\n });\n Object.defineProperty(package$math3, 'Percentile', {\n get: Percentile_getInstance\n });\n package$math3.PolynomialFunction = PolynomialFunction;\n package$math3.times_gax024$ = times;\n package$math3.PolynomialSplineFunction = PolynomialSplineFunction;\n Object.defineProperty(package$math3, 'Precision', {\n get: Precision_getInstance\n });\n package$math3.RealDistribution = RealDistribution;\n package$math3.SplineInterpolator = SplineInterpolator;\n Object.defineProperty(TDistribution, 'Companion', {\n get: TDistribution$Companion_getInstance\n });\n package$math3.TDistribution = TDistribution;\n package$math3.UnivariateFunction = UnivariateFunction;\n package$math3.UnivariateSolver = UnivariateSolver;\n Object.defineProperty(package$math3, 'UnivariateSolverUtils', {\n get: UnivariateSolverUtils_getInstance\n });\n var package$regression = package$stat.regression || (package$stat.regression = {});\n package$regression.EvalResult = EvalResult;\n package$regression.LinearRegression = LinearRegression;\n package$regression.LocalPolynomialRegression = LocalPolynomialRegression;\n Object.defineProperty(PolynomialRegression, 'Companion', {\n get: PolynomialRegression$Companion_getInstance\n });\n package$regression.PolynomialRegression = PolynomialRegression;\n package$regression.RegressionEvaluator = RegressionEvaluator;\n Object.defineProperty(package$regression, 'RegressionUtil', {\n get: RegressionUtil_getInstance\n });\n package$regression.allFinite_10sy24$ = allFinite;\n package$regression.averageByX_10sy24$ = averageByX_0;\n var package$util_0 = package$base.util || (package$base.util = {});\n package$util_0.MutableDouble = MutableDouble;\n package$util_0.MutableInteger = MutableInteger;\n Object.defineProperty(package$util_0, 'SamplingUtil', {\n get: SamplingUtil_getInstance\n });\n AestheticsBuilder$MyDataPointAesthetics.prototype.defined_896ixz$ = DataPointAesthetics.prototype.defined_896ixz$;\n DefaultCoordinateSystem.prototype.isPointInLimits_k2qmv6$ = CoordinateSystem.prototype.isPointInLimits_k2qmv6$;\n DefaultCoordinateSystem.prototype.isRectInLimits_fd842m$ = CoordinateSystem.prototype.isRectInLimits_fd842m$;\n DefaultCoordinateSystem.prototype.isPathInLimits_f6t8kh$ = CoordinateSystem.prototype.isPathInLimits_f6t8kh$;\n DefaultCoordinateSystem.prototype.isPolygonInLimits_f6t8kh$ = CoordinateSystem.prototype.isPolygonInLimits_f6t8kh$;\n DataPointAestheticsDelegate.prototype.defined_896ixz$ = DataPointAesthetics.prototype.defined_896ixz$;\n ErrorBarGeom$MyLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$;\n FilledSquareLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$;\n GenericLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$;\n CrossBarLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$;\n NullGeomTargetCollector.prototype.addPoint_cnsimy$ = GeomTargetCollector.prototype.addPoint_cnsimy$;\n NullGeomTargetCollector.prototype.addRectangle_bxzvr8$ = GeomTargetCollector.prototype.addRectangle_bxzvr8$;\n NullGeomTargetCollector.prototype.addPath_sa5m83$ = GeomTargetCollector.prototype.addPath_sa5m83$;\n NullGeomTargetCollector.prototype.addPolygon_sa5m83$ = GeomTargetCollector.prototype.addPolygon_sa5m83$;\n Object.defineProperty(DodgePos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n Object.defineProperty(FillPos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n Object.defineProperty(JitterDodgePos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n Object.defineProperty(JitterPos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n Object.defineProperty(NudgePos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n Object.defineProperty(StackPos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n BaseStat.prototype.apply_kdy6bf$ = Stat.prototype.apply_kdy6bf$;\n Kotlin.defineModule('lets-plot-plot-base-portable', _);\n return _;\n}));\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9MZXRzUGxvdC8uL2tvdGxpbi1kY2UtZGV2L2NvbW1vbi9zcmMvZ2VuZXJhdGVkL19Db2xsZWN0aW9ucy5rdD9mMDI3Iiwid2VicGFjazovL0xldHNQbG90Ly4va290bGluLWRjZS1kZXYvc3JjL2tvdGxpbi9jb2xsZWN0aW9ucy9NYXBzLmt0P2M3M2UiLCJ3ZWJwYWNrOi8vTGV0c1Bsb3QvLi9rb3RsaW4tZGNlLWRldi9zcmMva290bGluL2NvbGxlY3Rpb25zL011dGFibG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gICAgICAgICAgbmV4dEl0ZW0gPSBudWxsXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChsaW1pdCA+IDAgJiYgKytjb3VudGVyID49IGxpbWl0IHx8IG5leHRTZWFyY2hJbmRleCA+IGlucHV0Lmxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICBuZXh0SXRlbSA9IGN1cnJlbnRTdGFydEluZGV4Li5pbnB1dC5sYXN0SW5kZXhcbiAgICAgICAgICAgICAgICAgICAgbmV4dFNlYXJjaEluZGV4ID0gLTFcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB2YWwgbWF0Y2ggPSBpbnB1dC5nZXROZXh0TWF0Y2gobmV4dFNlYXJjaEluZGV4KVxuICAgICAgICAgICAgICAgICAgICBpZiAobWF0Y2ggPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbmV4dEl0ZW0gPSBjdXJyZW50U3RhcnRJbmRleC4uaW5wdXQubGFzdEluZGV4XG4gICAgICAgICAgICAgICAgICAgICAgICBuZXh0U2VhcmNoSW5kZXggPSAtMVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIChpbmRleCwgbGVuZ3RoKSA9IG1hdGNoXG4gICAgICAgICAgICAgICAgICAgICAgICBuZXh0SXRlbSA9IGN1cnJlbnRTdGFydEluZGV4IHVudGlsIGluZGV4XG4gICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50U3RhcnRJbmRleCA9IGluZGV4ICsgbGVuZ3RoXG4gICAgICAgICAgICAgICAgICAgICAgICBuZXh0U2VhcmNoSW5kZXggPSBjdXJyZW50U3RhcnRJbmRleCArIGlmIChsZW5ndGggPT0gMCkgMSBlbHNlIDBcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBuZXh0U3RhdGUgPSAxXG4gICAgIC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E1ldGhvZC5MTSAtPiB7XG4gICAgICAgICAgICAgICAgcmVxdWlyZShwb2x5bm9taWFsRGVncmVlID49IDEpIHsgXCJEZWdyZWUgb2YgcG9seW5vbWlhbCByZWdyZXNzaW9uIG11c3QgYmUgYXQgbGVhc3QgMVwiIH1cbiAgICAgICAgICAgICAgICBpZiAocG9seW5vbWlhbERlZ3JlZSA9PSAxKSB7XG4gICAgICAgICAgICAgICAgICAgIExpbmVhclJlZ3Jlc3Npb24odmFsdWVzWCwgdmFsdWVzWSwgY29uZmlkZW5jZUxldmVsKVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChQb2x5bm9taWFsUmVncmVzc2lvbi5jYW5CZUNvbXB1dGVkKHZhbHVlc1gsIHZhbHVlc1ksIHBvbHlub21pYWxEZWdyZWUpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBQb2x5bm9taWFsUmVncmVzc2lvbih2YWx1ZXNYLCB2YWx1ZXNZLCBjb25maWRlbmNlTGV2ZWwsIHBvbHlub21pYWxEZWdyZWUpXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0ICAgLy8gZW1wdHkgc3RhdCBkYXRhXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBNZXRob2QuTE9FU1MgLT4ge1xuICAgICAgICAgICAgICAgIHZhbCBldmFsdWF0b3IgPSBMb2NhbFBvbHlub21pYWxSZWdyZXNzaW9uKHZhbHVlc1gsIHZhbHVlc1ksIGNvbmZpZGVuY2VMZXZlbCwgc3BhbilcbiAgICAgICAgICAgICAgICBpZiAoZXZhbHVhdG9yLmNhbkNvbXB1dGUpIHtcbiAgICAgICAgICAgICAgICAgICAgZXZhbHVhdG9yXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICA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BlcnJvcihcIk51bWJlcklzVG9vTGFyZ2UgLSB4MDokeDAsIHgxOiR4MVwiKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBjdW11bGF0aXZlUHJvYmFiaWxpdHkoeDEpIC0gY3VtdWxhdGl2ZVByb2JhYmlsaXR5KHgwKVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIHtAaW5oZXJpdERvY31cbiAgICAgKlxuICAgICAqIFRoZSBkZWZhdWx0IGltcGxlbWVudGF0aW9uIHJldHVybnNcbiAgICAgKlxuICAgICAqICAqIFsuZ2V0U3VwcG9ydExvd2VyQm91bmRdIGZvciBgcCA9IDBgLFxuICAgICAqICAqIFsuZ2V0U3VwcG9ydFVwcGVyQm91bmRdIGZvciBgcCA9IDFgLlxuICAgICAqXG4gICAgICovXG4gICAgb3ZlcnJpZGUgZnVuIGludmVyc2VDdW11bGF0aXZlUHJvYmFiaWxpdHkocDogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgLypcbiAgICAgICAgICogSU1QTEVNRU5UQVRJT04gTk9URVNcbiAgICAgICAgICogLS0tLS0tLS0tLS0tLS0tLS0tLS1cbiAgICAgICAgICogV2hlcmUgYXBwbGljYWJsZSwgdXNlIGlzIG1hZGUgb2YgdGhlIG9uZS1zaWRlZCBDaGVieXNoZXYgaW5lcXVhbGl0eVxuICAgICAgICAgKiB0byBicmFja2V0IHRoZSByb290LiBUaGlzIGluZXF1YWxpdHkgc3RhdGVzIHRoYXRcbiAgICAgICAgICogUChYIC0gbXUgPj0gayAqIHNpZykgPD0gMSAvICgxICsga14yKSxcbiAgICAgICAgICogbXU6IG1lYW4sIHNpZzogc3RhbmRhcmQgZGV2aWF0aW9uLiBFcXVpdmFsZW50bHlcbiAgICAgICAgICogMSAtIFAoWCA8IG11ICsgayAqIHNpZykgPD0gMSAvICgxICsga14yKSxcbiAgICAgICAgICogRihtdSArIGsgKiBzaWcpID49IGteMiAvICgxICsga14yKS5cbiAgICAgICAgICpcbiAgICAgICAgICogRm9yIGsgPSBzcXJ0KHAgLyAoMSAtIHApKSwgd2UgZmluZFxuICAgICAgICAgKiBGKG11ICsgayAqIHNpZykgPj0gcCxcbiAgICAgICAgICogYW5kIChtdSArIGsgKiBzaWcpIGlzIGFuIHVwcGVyLWJvdW5kIGZvciB0aGUgcm9vdC5cbiAgICAgICAgICpcbiAgICAgICAgICogVGhlbiwgaW50cm9kdWNpbmcgWSA9IC1YLCBtZWFuKFkpID0gLW11LCBzZChZKSA9IHNpZywgYW5kXG4gICAgICAgICAqIFAoWSA+PSAtbXUgKyBrICogc2lnKSA8PSAxIC8gKDEgKyBrXjIpLFxuICAgICAgICAgKiBQKC1YID49IC1tdSArIGsgKiBzaWcpIDw9IDEgLyAoMSArIGteMiksXG4gICAgICAgICAqIFAoWCA8PSBtdSAtIGsgKiBzaWcpIDw9IDEgLyAoMSArIGteMiksXG4gICAgICAgICAqIEYobXUgLSBrICogc2lnKSA8PSAxIC8gKDEgKyBrXjIpLlxuICAgICAgICAgKlxuICAgICAgICAgKiBGb3IgayA9IHNxcnQoKDEgLSBwKSAvIHApLCB3ZSBmaW5kXG4gICAgICAgICAqIEYobXUgLSBrICogc2lnKSA8PSBwLFxuICAgICAgICAgKiBhbmQgKG11IC0gayAqIHNpZykgaXMgYSBsb3dlci1ib3VuZCBmb3IgdGhlIHJvb3QuXG4gICAgICAgICAqXG4gICAgICAgICAqIEluIGNhc2VzIHdoZXJlIHRoZSBDaGVieXNoZXYgaW5lcXVhbGl0eSBkb2VzIG5vdCBhcHBseSwgZ2VvbWV0cmljXG4gICAgICAgICAqIHByb2dyZXNzaW9ucyAxLCAyLCA0LCAuLi4gYW5kIC0xLCAtMiwgLTQsIC4uLiBhcmUgdXNlZCB0byBicmFja2V0XG4gICAgICAgICAqIHRoZSByb290LlxuICAgICAgICAgKi9cbiAgICAgICAgaWYgKHAgPCAwLjAgfHwgcCA+IDEuMCkge1xuICAgICAgICAgICAgZXJyb3IoXCJPdXRPZlJhbmdlIFswLCAxXSAtIHAkcFwiKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGxvd2VyQm91bmQgPSBzdXBwb3J0TG93ZXJCb3VuZFxuICAgICAgICBpZiAocCA9PSAwLjApIHtcbiAgICAgICAgICAgIHJldHVybiBsb3dlckJvdW5kXG4gICAgICAgIH1cblxuICAgICAgICB2YXIgdXBwZXJCb3VuZCA9IHN1cHBvcnRVcHBlckJvdW5kXG4gICAgICAgIGlmIChwID09IDEuMCkge1xuICAgICAgICAgICAgcmV0dXJuIHVwcGVyQm91bmRcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBtdSA9IG51bWVyaWNhbE1lYW5cbiAgICAgICAgdmFsIHNpZyA9IHNxcnQobnVtZXJpY2FsVmFyaWFuY2UpXG4gICAgICAgIHZhbCBjaGVieXNoZXZBcHBsaWVzOiBCb29sZWFuXG4gICAgICAgIGNoZWJ5c2hldkFwcGxpZXMgPSAhKG11LmlzSW5maW5pdGUoKSB8fCBtdS5pc05hTigpIHx8IHNpZy5pc0luZmluaXRlKCkgfHwgc2lnLmlzTmFOKCkpXG5cbiAgICAgICAgaWYgKGxvd2VyQm91bmQgPT0gRG91YmxlLk5FR0FUSVZFX0lORklOSVRZKSB7XG4gICAgICAgICAgICBpZiAoY2hlYnlzaGV2QXBwbGllcykge1xuICAgICAgICAgICAgICAgIGxvd2VyQm91bmQgPSBtdSAtIHNpZyAqIHNxcnQoKDEuMCAtIHApIC8gcClcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbG93ZXJCb3VuZCA9IC0xLjBcbiAgICAgICAgICAgICAgICB3aGlsZSAoY3VtdWxhdGl2ZVByb2JhYmlsaXR5KGxvd2VyQm91bmQpID49IHApIHtcbiAgICAgICAgICAgICAgICAgICAgbG93ZXJCb3VuZCAqPSAyLjBcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodXBwZXJCb3VuZCA9PSBEb3VibGUuUE9TSVRJVkVfSU5GSU5JVFkpIHtcbiAgICAgICAgICAgIGlmIChjaGVieXNoZXZBcHBsaWVzKSB7XG4gICAgICAgICAgICAgICAgdXBwZXJCb3VuZCA9IG11ICsgc2lnICogc3FydChwIC8gKDEuMCAtIHApKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB1cHBlckJvdW5kID0gMS4wXG4gICAgICAgICAgICAgICAgd2hpbGUgKGN1bXVsYXRpdmVQcm9iYWJpbGl0eSh1cHBlckJvdW5kKSA8IHApIHtcbiAgICAgICAgICAgICAgICAgICAgdXBwZXJCb3VuZCAqPSAyLjBcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgdG9Tb2x2ZSA9IG9iamVjdCA6IFVuaXZhcmlhdGVGdW5jdGlvbiB7XG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gdmFsdWUoeDogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY3VtdWxhdGl2ZVByb2JhYmlsaXR5KHgpIC0gcFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHggPSBVbml2YXJpYXRlU29sdmVyVXRpbHMuc29sdmUoXG4gICAgICAgICAgICB0b1NvbHZlLFxuICAgICAgICAgICAgbG93ZXJCb3VuZCxcbiAgICAgICAgICAgIHVwcGVyQm91bmQsXG4gICAgICAgICAgICBzb2x2ZXJBYnNvbHV0ZUFjY3VyYWN5XG4gICAgICAgIClcblxuICAgICAgICBpZiAoIWlzU3VwcG9ydENvbm5lY3RlZCkge1xuICAgICAgICAgICAgLyogVGVzdCBmb3IgcGxhdGVhdS4gKi9cbiAgICAgICAgICAgIHZhbCBkeCA9IHNvbHZlckFic29sdXRlQWNjdXJhY3lcbiAgICAgICAgICAgIGlmICh4IC0gZHggPj0gc3VwcG9ydExvd2VyQm91bmQpIHtcbiAgICAgICAgICAgICAgICB2YWwgcHggPSBjdW11bGF0aXZlUHJvYmFiaWxpdHkoeClcbiAgICAgICAgICAgICAgICBpZiAoY3VtdWxhdGl2ZVByb2JhYmlsaXR5KHggLSBkeCkgPT0gcHgpIHtcbiAgICAgICAgICAgICAgICAgICAgdXBwZXJCb3VuZCA9IHhcbiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHVwcGVyQm91bmQgLSBsb3dlckJvdW5kID4gZHgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBtaWRQb2ludCA9IDAuNSAqIChsb3dlckJvdW5kICsgdXBwZXJCb3VuZClcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdW11bGF0aXZlUHJvYmFiaWxpdHkobWlkUG9pbnQpIDwgcHgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb3dlckJvdW5kID0gbWlkUG9pbnRcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBwZXJCb3VuZCA9IG1pZFBvaW50XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVwcGVyQm91bmRcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHhcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgLyoqIERlZmF1bHQgYWNjdXJhY3kuICAqL1xuICAgICAgICB2YWwgU09MVkVSX0RFRkFVTFRfQUJTT0xVVEVfQUNDVVJBQ1kgPSAxZS02XG5cbiAgICAgICAgLyoqIFNlcmlhbGl6YWJsZSB2ZXJzaW9uIGlkZW50aWZpZXIgICovXG4gICAgICAgIHByaXZhdGUgY29uc3QgdmFsIHNlcmlhbFZlcnNpb25VSUQgPSAtMzgwMzgwNTA5ODMxMDg4MDJMXG4gICAgfV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xuXG4vKipcbiAqIFJldHVybnMgZmlyc3QgaW5kZXggb2YgW2VsZW1lbnRdLCBvciAtMSBpZiB0aGUgYXJyYXkgZG9lcyBub3QgY29udGFpbiBlbGVtZW50LlxuICovXG5wdWJsaWMgZnVuIDxAa290bGluLmludGVybmFsLk9ubHlJbnB1dFR5cGVzIFQ+IEFycmF5PG91dCBUPi5pbmRleE9mKGVsZW1lbnQ6IFQpOiBJbnQge1xuICAgIGlmIChlbGVtZW50ID09IG51bGwpIHtcbiAgICAgICAgZm9yIChpbmRleCBpbiBpbmRpY2VzKSB7XG4gICAgICAgICAgICBpZiAodGhpc1tpbmRleF0gPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgICAgZm9yIChpbmRleCBpbiBpbmRpY2VzKSB7XG4gICAgICAgICAgICBpZiAoZWxlbWVudCA9PSB0aGlzW2luZGV4XSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgZmlyc3QgaW5kZXggb2YgW2VsZW1lbnRdLCBvciAtMSBpZiB0aGUgYXJyYXkgZG9lcyBub3QgY29udGFpbiBlbGVtZW50LlxuICovXG5wdWJsaWMgZnVuIEJ5dGVBcnJheS5pbmRleE9mKGVsZW1lbnQ6IEJ5dGUpOiBJbnQge1xuICAgIGZvciAoaW5kZXggaW4gaW5kaWNlcykge1xuICAgICAgICBpZiAoZWxlbWVudCA9PSB0aGlzW2luZGV4XSkge1xuICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIC0xXG59XG5cbi8qKlxuICogUmV0dXJucyBmaXJzdCBpbmRleCBvZiBbZWxlbWVudF0sIG9yIC0xIGlmIHRoZSBhcnJheSBkb2VzIG5vdCBjb250YWluIGVsZW1lbnQuXG4gKi9cbnB1YmxpYyBmdW4gU2hvcnRBcnJheS5pbmRleE9mKGVsZW1lbnQ6IFNob3J0KTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMpIHtcbiAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgZmlyc3QgaW5kZXggb2YgW2VsZW1lbnRdLCBvciAtMSBpZiB0aGUgYXJyYXkgZG9lcyBub3QgY29udGFpbiBlbGVtZW50LlxuICovXG5wdWJsaWMgZnVuIEludEFycmF5LmluZGV4T2YoZWxlbWVudDogSW50KTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMpIHtcbiAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgZmlyc3QgaW5kZXggb2YgW2VsZW1lbnRdLCBvciAtMSBpZiB0aGUgYXJyYXkgZG9lcyBub3QgY29udGFpbiBlbGVtZW50LlxuICovXG5wdWJsaWMgZnVuIExvbmdBcnJheS5pbmRleE9mKGVsZW1lbnQ6IExvbmcpOiBJbnQge1xuICAgIGZvciAoaW5kZXggaW4gaW5kaWNlcykge1xuICAgICAgICBpZiAoZWxlbWVudCA9PSB0aGlzW2luZGV4XSkge1xuICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIC0xXG59XG5cbi8qKlxuICogUmV0dXJucyBmaXJzdCBpbmRleCBvZiBbZWxlbWVudF0sIG9yIC0xIGlmIHRoZSBhcnJheSBkb2VzIG5vdCBjb250YWluIGVsZW1lbn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aW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biA8QGtvdGxpbi5pbnRlcm5hbC5Pbmx5SW5wdXRUeXBlcyBUPiBBcnJheTxvdXQgVD4ubGFzdEluZGV4T2YoZWxlbWVudDogVCk6IEludCB7XG4gICAgaWYgKGVsZW1lbnQgPT0gbnVsbCkge1xuICAgICAgICBmb3IgKGluZGV4IGluIGluZGljZXMucmV2ZXJzZWQoKSkge1xuICAgICAgICAgICAgaWYgKHRoaXNbaW5kZXhdID09IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICAgIGZvciAoaW5kZXggaW4gaW5kaWNlcy5yZXZlcnNlZCgpKSB7XG4gICAgICAgICAgICBpZiAoZWxlbWVudCA9PSB0aGlzW2luZGV4XSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgbGFzdCBpbmRleCBvZiBbZWxlbWVudF0sIG9yIC0xIGlmIHRoZSBhcnJheSBkb2VzIG5vdCBjb250YWluIGVsZW1lbnQuXG4gKi9cbnB1YmxpYyBmdW4gQnl0ZUFycmF5Lmxhc3RJbmRleE9mKGVsZW1lbnQ6IEJ5dGUpOiBJbnQge1xuICAgIGZvciAoaW5kZXggaW4gaW5kaWNlcy5yZXZlcnNlZCgpKSB7XG4gICAgICAgIGlmIChlbGVtZW50ID09IHRoaXNbaW5kZXhdKSB7XG4gICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gLTFcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGxhc3QgaW5kZXggb2YgW2VsZW1lbnRdLCBvciAtMSBpZiB0aGUgYXJyYXkgZG9lcyBub3QgY29udGFpbiBlbGVtZW50LlxuICov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MgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIDxUPiBBcnJheTxvdXQgVD4uY291bnQoKTogSW50IHtcbiAgICByZXR1cm4gc2l6ZVxufVxuXG4vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIEJ5dGVBcnJheS5jb3VudCgpOiBJbnQge1xuICAgIHJldHVybiBzaXplXG59XG5cbi8qKlxuICogUmV0dXJucyB0aGUgbnVtYmVyIG9mIGVsZW1lbnRzIGluIHRoaXMgYXJyYXkuXG4gKi9cbkBrb3RsaW4uaW50ZXJuYWwuSW5saW5lT25seVxucHVibGljIGlubGluZSBmdW4gU2hvcnRBcnJheS5jb3VudCgpOiBJbnQge1xuICAgIHJldHVybiBzaXplXG59XG5cbi8qKlxuICogUmV0dXJucyB0aGUgbnVtYmVyIG9mIGVsZW1lbnRzIGluIHRoaXMgYXJyYXkuXG4gKi9cbkBrb3RsaW4uaW50ZXJuYWwuSW5saW5lT25seVxucHVibGljIGlubGluZSBmdW4gSW50QXJyYXkuY291bnQoKTogSW50IHtcbiAgICByZXR1cm4gc2l6ZVxufVxuXG4vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIExvbmdBcnJheS5jb3VudCgpOiBJbnQge1xuICAgIHJldHVybiBzaXplXG59XG5cbi8qKlxuICogUmV0dXJucyB0aGUgbnVtYmVyIG9mIGVsZW1lbnRzIGluIHRoaXMgYXJyYXkuXG4gKi9cbkBrb3RsaW4uaW50ZXJuYWwuSW5saW5lT25seVx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G91YmxlLk5hTlxuXG4gICAgICAgIH1cblxuICAgIC8qKlxuICAgICAqIHtAaW5oZXJpdERvY31cbiAgICAgKlxuICAgICAqIEZvciBkZWdyZWVzIG9mIGZyZWVkb20gcGFyYW1ldGVyIGBkZmAsIHRoZSB2YXJpYW5jZSBpc1xuICAgICAqXG4gICAgICogICogaWYgYGRmID4gMmAgdGhlbiBgZGYgLyAoZGYgLSAyKWAsXG4gICAgICogICogaWYgYDEgPCBkZiA8PSAyYCB0aGVuIHBvc2l0aXZlIGluZmluaXR5XG4gICAgICogKGBEb3VibGUuUE9TSVRJVkVfSU5GSU5JVFlgKSxcbiAgICAgKiAgKiBlbHNlIHVuZGVmaW5lZCAoYERvdWJsZS5OYU5gKS5cbiAgICAgKlxuICAgICAqL1xuICAgIG92ZXJyaWRlIHZhbCBudW1lcmljYWxWYXJpYW5jZTogRG91YmxlXG4gICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgIHZhbCBkZiA9IGRlZ3JlZXNPZkZyZWVkb21cblxuICAgICAgICAgICAgaWYgKGRmID4gMikge1xuICAgICAgICAgICAgICAgIHJldHVybiBkZiAvIChkZiAtIDIpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBpZiAoZGYgPiAxICYmIGRmIDw9IDIpIHtcbiAgICAgICAgICAgICAgICBEb3VibGUuUE9TSVRJVkVfSU5GSU5JVFlcbiAgICAgICAgICAgIH0gZWxzZSBEb3VibGUuTmFOXG5cbiAgICAgICAgfVxuXG4gICAgLyoqXG4gICAgICoge0Bpbmhlcml0RG9jfVxuICAgICAqXG4gICAgICogVGhlIGxvd2VyIGJvdW5kIG9mIHRoZSBzdXBwb3J0IGlzIGFsd2F5cyBuZWdhdGl2ZSBpbmZpbml0eSBubyBtYXR0ZXIgdGhlXG4gICAgICogcGFyYW1ldGVycy5cbiAgICAgKlxuICAgICAqIEByZXR1cm4gbG93ZXIgYm91bmQgb2YgdGhlIHN1cHBvcnQgKGFsd2F5c1xuICA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wcG9ydENvbm5lY3RlZDogQm9vbGVhblxuICAgICAgICBnZXQoKSA9IHRydWVcblxuICAgIGluaXQge1xuICAgICAgICBpZiAoZGVncmVlc09mRnJlZWRvbSA8PSAwKSB7XG4gICAgICAgICAgICBlcnJvcihcIk5vdFN0cmljdGx5UG9zaXRpdmUgLSBERUdSRUVTX09GX0ZSRUVET006ICRkZWdyZWVzT2ZGcmVlZG9tXCIpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiB7QGluaGVyaXREb2N9XG4gICAgICpcbiAgICAgKiBGb3IgdGhpcyBkaXN0cmlidXRpb24gYFAoWCA9IHgpYCBhbHdheXMgZXZhbHVhdGVzIHRvIDAuXG4gICAgICpcbiAgICAgKiBAcmV0dXJuIDBcbiAgICAgKi9cbiAgICBvdmVycmlkZSBmdW4gcHJvYmFiaWxpdHkoeDogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgcmV0dXJuIDAuMFxuICAgIH1cblxuICAgIC8qKiB7QGluaGVyaXREb2N9ICAqL1xuICAgIG92ZXJyaWRlIGZ1biBkZW5zaXR5KHg6IERvdWJsZSk6IERvdWJsZSB7XG4gICAgICAgIHZhbCBuID0gZGVncmVlc09mRnJlZWRvbVxuICAgICAgICB2YWwgblBsdXMxT3ZlcjIgPSAobiArIDEpIC8gMlxuICAgICAgICByZXR1cm4gZXhwKFxuICAgICAgICAgICAgR2FtbWEubG9nR2FtbWEoblBsdXMxT3ZlcjIpIC1cbiAgICAgICAgICAgICAgICAgICAgMC41ICogKGxuKFBJKSArIGxuKG4pKSAtXG4gICAgICAgICAgICAgICAgICAgIEdhbW1hLmxvZ0dhbW1hKG4gLyAyKSAtXG4gICAgICAgICAgICAgICAgICAgIG5QbHVzMU92ZXIyICogbG4oMSArIHggKiB4IC8gbilcbiAgICAgICAgKVxuICAgIH1cblxuICAgIC8qKiB7QGluaGVyaXREb2N9ICAqL1xuICAgIG92ZXJyaWRlIGZ1biBjdW11bGF0aXZlUHJvYmFiaWxpdHkoeDogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgdmFsIHJldDogRG91YmxlXG4gICAgICAgIGlmICh4ID09IDAuMCkge1xuICAgICAgICAgICAgcmV0ID0gMC41XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB2YWwgdCA9IEJldGEucmVndWxhcml6ZWRCZXRhKFxuICAgICAgICAgICAgICAgIGRlZ3JlZXNPZkZyZWVkb20gLyAoZGVncmVlc09mRnJlZWRvbSArIHggKiB4KSxcbiAgICAgICAgICAgICAgICAwLjUgKiBkZWdyZWVzT2ZGcmVlZG9tLFxuICAgICAgICAgICAgICAgIDAuNVxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgaWYgKHggPCAwLjApIHtcbiAgICAgICAgICAgICAgICByZXQgPSAwLjUgKiB0XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldCA9IDEuMCAtIDAuNSAqIHRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiByZXRcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIERlZmF1bHQgaW52ZXJzZSBjdW11bGF0aXZlIHByb2JhYmlsaXR5IGFjY3VyYWN5LlxuICAgICAgICAgKiBAc2luY2UgMi4xXG4gICAgICAgICAqL1xuICAgICAgICB2YWwgREVGQVVMVF9JTlZFUlNFX0FCU09MVVRFX0FDQ1VSQUNZID0gMWUtOVxuICAgICAgICAvKiogU2VyaWFsaXphYmxlIHZlcnNpb24gaWRlbnRpZmllciAgKi9cbiAgICAgICAgcHJpdmF0ZSB2YWwgc2VyaWFsVmVyc2lvblVJRCA9IC01ODUyNjE1Mzg2NjY0MTU4MjIyTFxuICAgIH1cbn1cbi8qKlxuICogQ3JlYXRlIGEgdCBkaXN0cmlidXRpb24gdXNpbmcgdGhlIGdpdmVuIGRlZ3JlZXMgb2YgZnJlZWRvbS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TxBZXM8RG91YmxlPj5cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBpc1Bvc2l0aW9uYWwoYWVzOiBBZXM8Kj4pOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBpc1Bvc2l0aW9uYWxYWShhZXMpIHx8XG4gICAgICAgICAgICAgICAgICAgIC8vIFNMT1BFIG11c3QgYmUgcG9zaXRpb25hbCBvclxuICAgICAgICAgICAgICAgICAgICAvLyBgZ2VvbV9hYmxpbmUoc2xvcGU9bnVtYmVyKWAgd2lsbCBub3Qgd29yay5cbiAgICAgICAgICAgICAgICAgICAgLy8gaXQgc2hvdWxkIGRyYXcgdGhlIHNhbWUgbGluZSBhczpcbiAgICAgICAgICAgICAgICAgICAgLy8gYGdlb21fYWJsaW5lKHNsb3BlPW51bWJlciwgaW50ZXJzZXB0PTApYFxuICAgICAgICAgICAgICAgICAgICAvLyBTZWU6IFBsb3RVdGlsLmNyZWF0ZUxheWVyQWVzdGhldGljcygpXG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBTTE9QRVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGlzUG9zaXRpb25hbFhZKGFlczogQWVzPCo+KTogQm9vbGVhbiB7XG4gICAgICAgICAgICByZXR1cm4gaXNQb3NpdGlvbmFsWChhZXMpIHx8XG4gICAgICAgICAgICAgICAgICAgIGlzUG9zaXRpb25hbFkoYWVzKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGlzUG9zaXRpb25hbFgoYWVzOiBBZXM8Kj4pOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBhZXMgPT0gWCB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gWElOVEVSQ0VQVCB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gWE1JTiB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gWE1BWCB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gWEVORFxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGlzUG9zaXRpb25hbFkoYWVzOiBBZXM8Kj4pOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBhZXMgPT0gWSB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gWU1JTiB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gWU1BWCB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gSU5URVJDRVBUIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBZSU5URVJDRVBUIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBMT1dFUiB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gTUlERExFIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBVUFBFUiB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gWUVORFxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGlzQ29sb3IoYWVzOiBBZXM8Kj4pOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBhZXMgPT0gQ09MT1IgfHwgYWVzID09IEZJTExcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBpc0FmZmVjdGluZ1NjYWxlWChhZXM6IEFlczwqPik6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIGlzUG9zaXRpb25hbFgoYWVzKSAvLyAmJiBhZXMgIT0gWElOVEVSQ0VQVFxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGlzQWZmZWN0aW5nU2NhbGVZKGFlczogQWVzPCo+KTogQm9vbGVhbiB7XG4gICAgICAgICAgICByZXR1cm4gaXNQb3NpdGlvbmFsWShhZXMpICYmXG4gICAgICAgICAgICAgICAgICAgIC8vIFwiSU5URVJDRVBUXCIgaXMgXCJwb3NpdGlvbmFsIFlcIiBiZWNhdXNlIGl0IG11c3QgdXNlIHRoZSBzYW1lICdtYXBwZXInIGFzIG90aGVyIFwicG9zaXRpb25hbCBZXCItcyxcbiAgICAgICAgICAgICAgICAgICAgLy8gYnV0IGl0cyByYW5nZSBvZiB2YWx1ZXMgaXMgbm90IHRha2VuIGluIGFjY291bnQgd2hlbiBjb21wdXRpbmcgdGhlIFktbWFwcGVyLlxuICAgICAgICAgICAgICAgICAgICBhZXMgIT0gSU5URVJDRVBUIC8vICYmXG4vLyAgICAgICAgICAgICAgICAgICAgYWVzICE9IFlJTlRFUkNFUFRcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBhZmZlY3RpbmdTY2FsZVgodW5maWx0ZXJlZDogSXRlcmFibGU8QWVzPCo+Pik6IEl0ZXJhYmxlPEFlczxEb3VibGU+PiB7XG4gICAgICAgICAgICB2YWwgbnVtZXJpYyA9IG51bWVyaWModW5maWx0ZXJlZClcbiAgICAgICAgICAgIHJldHVybiBmaWx0ZXIobnVtZXJpYykgeyBpc0FmZmVjdGluZ1NjYWxlWChpdCkgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGFmZmVjdGluZ1NjYWxlWSh1bmZpbHRlcmVkOiBJdGVyYWJsZTxBZXM8Kj4+KTogSXRlcmFibGU8QWVzPERvdWJsZT4+IHtcbiAgICAgICAgICAgIHZhbCBudW1lcmljID0gbnVtZXJpYyh1bmZpbHRlcmVkKVxuICAgICAgICAgICAgcmV0dXJuIGZpbHRlcihudW1lcmljKSB7IGlzQWZmZWN0aW5nU2NhbGVZKGl0KSB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gbm9HdWlkZU5lZWRlZChhZXM6IEFlczwqPik6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIGFlcyA9PSBGUkFNRSB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gU1BFRUQgfHxcbiAgICAgICAgICAgICAgICAgICAgYWVzID09IEZMT1cgfHxcbiAgICAgICAgICAgICAgICAgICAgYWVzID09IExBQkVMIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBTTE9QRSB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gV0lEVEggfHxcbiAgICAgICAgICAgICAgICAgICAgYWVzID09IEhFSUdIVCB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gSEpVU1QgfHxcbiAgICAgICAgICAgICAgICAgICAgYWVzID09IFZKVVNUIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBBTkdMRSB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gRkFNSUxZIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBGT05URkFDRSB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gU1lNX1ggfHxcbiAgICAgICAgICAgICAgICAgICAgYWVzID09IFNZTV9ZIHx8XG4gICAgICAgICAgICAgICAgICAgIGlzUG9zaXRpb25hbChhZXMpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdmFsdWVzKCk6IExpc3Q8QWVzPCo+PiB7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWVzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYWxsUG9zaXRpb25hbCgpOiBMaXN0PEFlczxEb3VibGU+PiB7XG4gICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgcmV0dXJuIHZhbHVlcy5maWx0ZXIgeyBpc1Bvc2l0aW9uYWwoaXQpIH0gYXMgTGlzdDxBZXM8RG91YmxlPj5cbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGNhbiBiZSBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlLlxuICovXG5cbnBhY2thZ2UgamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYmFzZVxuXG5pbXBvcnQgamV0YnJhaW5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AgICAgICAgICAgICAgIHZhbCBuZXh0ID0gZW50cmllcy5uZXh0KClcbiAgICAgICAgICAgICAgICBpZiAobmV4dC52YWx1ZS5zaXplICE9IHNpemUpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJBbGwgZGF0YSBzZXJpZXMgaW4gZGF0YSBmcmFtZSBtdXN0IGhhdmUgZXF1YWwgc2l6ZVxcblwiICsgZHVtcFNpemVzKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlY3RvckJ5VmFyXG4gICAgICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBkdW1wU2l6ZXModmVjdG9yQnlWYXI6IE1hcDxWYXJpYWJsZSwgTGlzdDwqPj4pOiBTdHJpbmcge1xuICAgICAgICB2YWwgc2IgPSBTdHJpbmdCdWlsZGVyKClcbiAgICAgICAgZm9yICgoa2V5LCB2YWx1ZSkgaW4gdmVjdG9yQnlWYXIpIHtcbiAgICAgICAgICAgIHNiLmFwcGVuZChrZXkubmFtZSlcbiAgICAgICAgICAgICAgICAuYXBwZW5kKFwiIDogXCIpXG4gICAgICAgICAgICAgICAgLmFwcGVuZCh2YWx1ZS5zaXplKVxuICAgICAgICAgICAgICAgIC5hcHBlbmQoJ1xcbicpXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHNiLnRvU3RyaW5nKClcbiAgICB9XG5cbiAgICBmdW4gcm93Q291bnQoKTogSW50IHtcbiAgICAgICAgcmV0dXJuIGlmIChteVZlY3RvckJ5VmFyLmlzRW1wdHkoKSkgMCBlbHNlIG15VmVjdG9yQnlWYXIuZW50cmllcy5pdGVyYXRvcigpLm5leHQoKS52YWx1ZS5zaXplXG4gICAgfVxu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aW9uPEFueT4ge1xuICAgICAgICBhc3NlcnREZWZpbmVkKHZhcmlhYmxlKVxuICAgICAgICByZXR1cm4gbXlEaXN0aW5jdFZhbHVlcy5nZXRPclB1dCh2YXJpYWJsZSkge1xuICAgICAgICAgICAgdmFsIHZhbHVlcyA9IExpbmtlZEhhc2hTZXQoZ2V0KHZhcmlhYmxlKSkuYXBwbHkge1xuICAgICAgICAgICAgICAgIHRoaXMucmVtb3ZlKG51bGwpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgcmV0dXJuIHZhbHVlcyBhcyBDb2xsZWN0aW9uPEFueT5cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biB2YXJpYWJsZXMoKTogU2V0PFZhcmlhYmxlPiB7XG4gICAgICAgIHJldHVybiBteVZlY3RvckJ5VmFyLmtleXNcbiAgICB9XG5cbiAgICBmdW4gaXNOdW1lcmljKHZhcmlhYmxlOiBWYXJpYWJsZSk6IEJvb2xlYW4ge1xuICAgICAgICBhc3NlcnREZWZpbmVkKHZhcmlhYmxlKVxuICAgICAgICBpZiAoIW15SXNOdW1lcmljLmNvbnRhaW5zS2V5KHZhcmlhYmxlKSkge1xuICAgICAgICAgICAgdmFsIGNoZWNrZWREb3VibGVzID0gU2VyaWVzVXRpbC5jaGVja2VkRG91YmxlcyhnZXQodmFyaWFibGUpKVxuICAgICAgICAgICAgbXlJc051bWVyaWNbdmFyaWFibGVdID0gY2hlY2tlZERvdWJsZXMubm90RW1wdHlBbmRDYW5CZUNhc3QoKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBteUlzTnVtZXJpY1t2YXJpYWJsZV0hIVxuICAgIH1cblxuICAgIGZ1biByYW5nZSh2YXJpYWJsZTogVmFyaWFibGUpOiBDbG9zZWRSYW5nZTxEb3VibGU+PyB7XG4gICAgICAgIGlmICghbXlSYW5nZXMuY29udGFpbnNLZXkodmFyaWFib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N0cmluZyxcbiAgICAgICAgdmFsIHNvdXJjZTogU291cmNlID0gU291cmNlLk9SSUdJTixcbiAgICAgICAgdmFsIGxhYmVsOiBTdHJpbmcgPSBuYW1lXG4gICAgKSB7XG5cbiAgICAgICAgdmFsIGlzT3JpZ2luOiBCb29sZWFuXG4gICAgICAgICAgICBnZXQoKSA9IHNvdXJjZSA9PSBTb3VyY2UuT1JJR0lOXG5cbiAgICAgICAgdmFsIGlzU3RhdDogQm9vbGVhblxuICAgICAgICAgICAgZ2V0KCkgPSBzb3VyY2UgPT0gU291cmNlLlNUQVRcblxuICAgICAgICB2YWwgaXNUcmFuc2Zvcm06IEJvb2xlYW5cbiAgICAgICAgICAgIGdldCgpID0gc291cmNlID09IFNvdXJjZS5UUkFOU0ZPUk1cblxuICAgICAgICBvdmVycmlkZSBmdW4gdG9TdHJpbmcoKTogU3RyaW5nIHtcbiAgICAgICAgICAgIC8vIGltcG9ydGFudFxuICAgICAgICAgICAgcmV0dXJuIG5hbWVcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB0b1N1bW1hcnlTdHJpbmcoKTogU3RyaW5nIHtcbiAgICAgICAgICAgIHJldHVybiBcIiRuYW1lLCAnJGxhYmVsJyBbJHNvdXJjZV1cIlxuICAgICAgICB9XG5cbiAgICAgICAgZW51bSBjbGFzcyBTb3VyY2Uge1xuICAgICAgICAgICAgT1JJR0lOLCBUUkFOU0ZPUk0sIFNUQVRcbiAgICAgICAgfVxuXG4gICAgICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuXG4gICAgICAgICAgICBASnZtT3ZlcmxvYWRzXG4gICAgICAgICAgICBmdW4gY3JlYXRlT3JpZ2luYWwobmFtZTogU3RyaW5nLCBsYWJlbDogU3RyaW5nID0gbmFtZSk6IFZhcmlhYmxlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gVmFyaWFibGUoXG4gICAgICAgICAgICAgICAgICAgIG5hbWUsXG4gICAgICAgICAgICAgICAgICAgIFNvdXJjZS5PU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6Y2xhc3MpXG4gICAgfVxuXG4gICAgY2xhc3MgQnVpbGRlciB7XG4gICAgICAgIGludGVybmFsIHZhbCBteVZlY3RvckJ5VmFyID0gSGFzaE1hcDxWYXJpYWJsZSwgTGlzdDwqPj4oKVxuICAgICAgICBpbnRlcm5hbCB2YWwgbXlJc051bWVyaWMgPSBIYXNoTWFwPFZhcmlhYmxlLCBCb29sZWFuPigpXG4gICAgICAgIGludGVybmFsIHZhbCBteU9yZGVyU3BlY3MgPSBBcnJheUxpc3Q8T3JkZXJTcGVjPigpXG5cbiAgICAgICAgY29uc3RydWN0b3IoKVxuXG4gICAgICAgIGNvbnN0cnVjdG9yKGRhdGE6IERhdGFGcmFtZSkge1xuICAgICAgICAgICAgbXlWZWN0b3JCeVZhci5wdXRBbGwoZGF0YS5teVZlY3RvckJ5VmFyKVxuICAgICAgICAgICAgbXlJc051bWVyaWMucHV0QWxsKGRhdGEubXlJc051bWVyaWMpXG4gICAgICAgICAgICBteU9yZGVyU3BlY3MuYWRkQWxsKGRhdGEubXlPcmRlclNwZWNzKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHB1dCh2YXJpYWJsZTogVmFyaWFibGUsIHY6IExpc3Q8Kj4pOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIHB1dEludGVybih2YXJpYWJsZSwgdilcbiAgICAgICAgICAgIG15SXNOdW1lcmljLnJlbW92ZSh2YXJpYWJsZSkgIC8vIHVua25vd24gc3RhdGVcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcHV0TnVtZXJpYyh2YXJpYWJsZTogVmFyaWFibGUsIHY6IExpc3Q8RG91YmxlPz4pOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIHB1dEludGVybih2YXJpYWJsZSwgdilcbiAgICAgICAgICAgIG15SXNOdW1lcmljW3ZhcmlhYmxlXSA9IHRydWVcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICA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Bhc051bWJlcihpbnB1dDogQW55Pyk6IERvdWJsZT8ge1xuICAgICAgICBpZiAoaW5wdXQgPT0gbnVsbCkge1xuICAgICAgICAgICAgcmV0dXJuIG51bGxcbiAgICAgICAgfVxuICAgICAgICBpZiAobnVtYmVyQnlEb21haW5WYWx1ZS5jb250YWluc0tleShpbnB1dCkpIHtcbiAgICAgICAgICAgIHJldHVybiBudW1iZXJCeURvbWFpblZhbHVlW2lucHV0XVxuICAgICAgICB9XG5cbiAgICAgICAgdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKFxuICAgICAgICAgICAgXCJ2YWx1ZSAkaW5wdXQgaXMgbm90IGluIHRoZSBkb21haW46ICR7bnVtYmVyQnlEb21haW5WYWx1ZS5rZXlzfVwiXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBmcm9tTnVtYmVyKHY6IERvdWJsZT8pOiBBbnk/IHtcbiAgICAgICAgaWYgKHYgPT0gbnVsbCkge1xuICAgICAgICAgICAgcmV0dXJuIG51bGxcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChkb21haW5WYWx1ZUJ5TnVtYmVyLmNvbnRhaW5zS2V5KHYpKSB7XG4gICAgICAgICAgICByZXR1cm4gZG9tYWluVmFsdWVCeU51bWJlclt2XVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gbG9vay11cCB0aGUgY2xvc2VzdCBrZXkgKG51bWJlcilcbiAgICAgICAgdmFsIGNlaWxpbmdLZXkgPSBkb21haW5WYWx1ZUJ5TnVtYmVyLmNlaWxpbmdLZXkodilcbiAgICAgICAgdmFsIGZsb29yS2V5ID0gZG9tYWluVmFsdWVCeU51bWJlci5mbG9vcktleSh2KVxuICAgICAgICB2YXIga2V5TnVtYmVyOiBEb3VibGU/ID0gbnVsbFxuICAgICAgICBpZiAoY2VpbGluZ0tleSAhPSBudWxsIHx8IGZsb29yS2V5ICE9IG51bGwpIHtcbiAgICAgICAgICAgIGtleU51bWJlciA9IHdoZ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Flc0xpc3QoZ2VvbUtpbmQ6IEdlb21LaW5kKTogTGlzdDxBZXM8Kj4+IHtcbiAgICAgICAgcmV0dXJuIHdoZW4gKGdlb21LaW5kKSB7XG4gICAgICAgICAgICBHZW9tS2luZC5QT0lOVCAtPiBQT0lOVFxuICAgICAgICAgICAgR2VvbUtpbmQuUEFUSCAtPiBQQVRIXG4gICAgICAgICAgICBHZW9tS2luZC5MSU5FIC0+IFBBVEhcblxuICAgICAgICAgICAgR2VvbUtpbmQuU01PT1RIIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWCwgQWVzLlksXG4gICAgICAgICAgICAgICAgQWVzLllNSU4sIEFlcy5ZTUFYLFxuXG4gICAgICAgICAgICAgICAgQWVzLlNJWkUsIC8vIHBhdGggd2lkdGhcbiAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuICAgICAgICAgICAgICAgIEFlcy5GSUxMLFxuICAgICAgICAgICAgICAgIEFlcy5BTFBIQVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5CQVIgLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIEFlcy5YLFxuICAgICAgICAgICAgICAgIEFlcy5ZLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuRklMTCxcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEEsXG4gICAgICAgICAgICAgICAgQWVzLldJRFRILFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIEdlb21LaW5kLkhJU1RPR1JBTSAtPiBsaXN0T2YoXG4gICAgICAgICAgICAgICAgQWVzLlgsIEFlcy5ZLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuRklMTCxcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEEsXG4gICAgICAgICAgICAgICAgLy9BZXMuV0VJR0hULCAgICAvLyBUb0RvOiB0aGlzIGlzIGFjdHVhbGx5IGhhbmRsZWQgYnkgJ3N0YXQnIChiaW4sY291bnQpXG4gICAgICAgICAgICAgICAgQWVzLldJRFRILFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIEdlb21LaW5kLlRJTEUsXG4gICAgICAgICAgICBHZW9tS2luZC5CSU5fMkQgLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIEFlcy5YLCBBZXMuWSxcbiAgICAgICAgICAgICAgICBBZXMuV0lEVEgsXG4gICAgICAgICAgICAgICAgQWVzLkhFSUdIVCxcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEEsXG4gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuICAgICAgICAgICAgICAgIEFlcy5GSUxMLFxuICAgICAgICAgICAgICAgIEFlcy5MSU5FVFlQRSxcbiAgICAgICAgICAgICAgICBBZXMuU0laRVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5FUlJPUl9CQVIgLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIEFlcy5YLFxuICAgICAgICAgICAgICAgIEFlcy5ZTUlOLCBBZXMuWU1BWCxcbiAgICAgICAgICAgICAgICBBZXMuV0lEVEgsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgICAgICAgICAgQWVzLlNJWkVcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuQ1JPU1NfQkFSIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWCxcbiAgICAgICAgICAgICAgICBBZXMuWU1JTiwgQWVzLllNQVgsIEFlcy5NSURETEUsXG4gICAgICAgICAgICAgICAgQWVzLldJRFRILFxuXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuRklMTCxcbiAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgICAgICAgICAgQWVzLlNIQVBFLFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIEdlb21LaW5kLkxJTkVfUkFOR0UgLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIEFlcy5YLFxuICAgICAgICAgICAgICAgIEFlcy5ZTUlOLCBBZXMuWU1BWCxcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEEsXG4gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuICAgICAgICAgICAgICAgIEFlcy5MSU5FVFlQRSxcbiAgICAgICAgICAgICAgICBBZXMuU0laRVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5QT0lOVF9SQU5HRSAtPiBsaXN0T2YoXG4gICAgICAgICAgICAgICAgQWVzLlgsIEFlcy5ZLFxuICAgICAgICAgICAgICAgIEFlcy5ZTUlOLCBBZXMuWU1BWCxcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEEsXG4gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuICAgICAgICAgICAgICAgIEFlcy5GSUxMLFxuICAgICAgICAgICAgICAgIEFlcy5MSU5FVFlQRSxcbiAgICAgICAgICAgICAgICBBZXMuU0hBUEUsXG4gICAgICAgICAgICAgICAgQWVzLlNJWkVcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuQ09OVE9VUiAtPiBQQVRIXG4gICAgICAgICAgICBHZW9tS2luZC5DT05UT1VSRiAtPiBQT0xZR09OXG4gICAgICAgICAgICBHZW9tS2luZC5QT0xZR09OIC0+IFBPTFlHT05cbiAgICAgICAgICAgIEdlb21LaW5kLk1BUCAtPiBsaXN0T2YoXG4gICAgICAgICAgICAgICAgLy8gYXV0by13aXJlZCB0byAneCcgb3IgJ2xvbmcnIGFuZCB0byAneScgb3IgJ2xhdCdcbiAgICAgICAgICAgICAgICBBZXMuWCwgQWVzLlksXG4gICAgICAgICAgICAgICAgQWVzLlNJWkUsIC8vIHBhdGggd2lkdGhcbiAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuICAgICAgICAgICAgICAgIEFlcy5GSUxMLFxuICAgICAgICAgICAgICAgIEFlcy5BTFBIQVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5BQl9MSU5FIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuSU5URVJDRVBULCBBZXMuU0xPUEUsXG4gICAgICAgICAgICAgICAgQWVzLlNJWkUsIC8vIHBhdGggd2lkdGhcbiAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuICAgICAgICAgICAgICAgIEFlcy5BTFBIQVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5IX0xJTkUgLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIEFlcy5ZSU5URVJDRVBULFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFLCAvLyBwYXRoIHdpZHRoXG4gICAgICAgICAgICAgICAgQWVzLkxJTkVUWVBFLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEFcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIEdlb21LaW5kLlZfTElORSAtPiBsaXN0T2YoXG4gICAgICAgICAgICAgICAgQWVzLlhJTlRFUkNFUFQsXG4gICAgICAgICAgICAgICAgQWVzLlNJWkUsIC8vIHBhdGggd2lkdGhcbiAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuICAgICAgICAgICAgICAgIEFlcy5BTFBIQVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5CT1hfUExPVCAtPiBsaXN0T2YoXG4gICAgICAgICAgICAgICAgQWVzLkxPV0VSLCAvLyBOYU4gZm9yICdvdXRsaWVyJyBkYXRhLXBvaW50XG4gICAgICAgICAgICAgICAgQWVzLk1JRERMRSwgLy8gTmFOIGZvciAnb3V0bGllcicgZGF0YS1wb2ludFxuICAgICAgICAgICAgICAgIEFlcy5VUFBFUiwgLy8gTmFOIGZvciAnb3V0bGllcicgZGF0YS1wb2ludFxuXG4gICAgICAgICAgICAgICAgQWVzLlgsXG4gICAgICAgICAgICAgICAgQWVzLlksIC8vIE5hTiBmb3IgJ2JveCcgZGF0YS1wb2ludCAodXNlZCBmb3Igb3V0bGllcnMpXG4gICAgICAgICAgICAgICAgQWVzLllNQVgsXG4gICAgICAgICAgICAgICAgQWVzLllNSU4sXG5cbiAgICAgICAgICAgICAgICBBZXMuQUxQSEEsXG4gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuICAgICAgICAgICAgICAgIEFlcy5GSUxMLFxuICAgICAgICAgICAgICAgIEFlcy5MSU5FVFlQRSxcbiAgICAgICAgICAgICAgICBBZXMuU0hBUEUsXG4gICAgICAgICAgICAgICAgQWVzLlNJWkUsIC8vIGxpbmUgd2lkdGhcbiAgICAgICAgICAgICAgICBBZXMuV0lEVEhcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuUklCQk9OIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWCxcbiAgICAgICAgICAgICAgICBBZXMuWU1JTiwgQWVzLllNQVgsXG4gICAgICAgICAgICAgICAgQWVzLlNJWkUsXG4gICAgICAgICAgICAgICAgQWVzLkxJTkVUWVBFLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuRklMTCxcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEFcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuQVJFQSAtPiBBUkVBXG4gICAgICAgICAgICBHZW9tS2luZC5ERU5TSVRZIC0+IEFSRUFcbiAgICAgICAgICAgIEdlb21LaW5kLkRFTlNJVFkyRCAtPiBQQVRIXG4gICAgICAgICAgICBHZW9tS2luZC5ERU5TSVRZMkRGIC0+IFBPTFlHT05cbiAgICAgICAgICAgIEdlb21LaW5kLkpJVFRFUiAtPiBQT0lOVFxuICAgICAgICAgICAgR2VvbUtpbmQuRlJFUVBPTFkgLT4gUEFUSFxuICAgICAgICAgICAgR2VvbUtpbmQuU1RFUCAtPiBQQVRIXG4gICAgICAgICAgICBHZW9tS2luZC5SRUNUIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWE1JTiwgQWVzLlhNQVgsXG4gICAgICAgICAgICAgICAgQWVzLllNSU4sIEFlcy5ZTUFYLFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFLFxuICAgICAgICAgICAgICAgIEFlcy5MSU5FVFlQRSxcbiAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgICAgICAgICAgQWVzLkZJTEwsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIEdlb21LaW5kLlNFR01FTlQgLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIEFlcy5YLCBBZXMuWSxcbiAgICAgICAgICAgICAgICBBZXMuWEVORCwgQWVzLllFTkQsXG4gICAgICAgICAgICAgICAgQWVzLlNJWkUsXG4gICAgICAgICAgICAgICAgQWVzLkxJTkVUWVBFLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEEsXG4gICAgICAgICAgICAgICAgQWVzLlNQRUVELFxuICAgICAgICAgICAgICAgIEFlcy5GTE9XXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIEdlb21LaW5kLlRFWFQgLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIEFlcy5YLCBBZXMuWSxcbiAgICAgICAgICAgICAgICBBZXMuU0laRSxcbiAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIEFlcy5MQUJFTCxcbiAgICAgICAgICAgICAgICBBZXMuRkFNSUxZLFxuICAgICAgICAgICAgICAgIEFlcy5GT05URkFDRSxcbiAgICAgICAgICAgICAgICBBZXMuSEpVU1QsXG4gICAgICAgICAgICAgICAgQWVzLlZKVVNULFxuICAgICAgICAgICAgICAgIEFlcy5BTkdMRVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5MSVZFX01BUCAtPiBsaXN0T2YoIC8vIFRvRG86IG5vdCBzdGF0aWMgLSBkZXBlbmRzIG9uICdkaXNwbGF5IG1vZGUnXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuRklMTCxcbiAgICAgICAgICAgICAgICBBZXMuU0laRSxcbiAgICAgICAgICAgICAgICBBZXMuU0hBUEUsXG4gICAgICAgICAgICAgICAgQWVzLkZSQU1FLFxuICAgICAgICAgICAgICAgIEFlcy5YLFxuICAgICAgICAgICAgICAgIEFlcy5ZLFxuICAgICAgICAgICAgICAgIEFlcy5TWU1fWCxcbiAgICAgICAgICAgICAgICBBZXMuU1lNX1lcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuUkFTVEVSIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWCwgQWVzLlksXG4gICAgICAgICAgICAgICAgQWVzLldJRFRILCAvLyBub3QgcmVuZGVyZWQgYnV0IHJlcXVpcmVkIGZvciBjb3JyZWN0IHggYWVzIHJhbmdlIGNvbXB1dGF0aW9uXG4gICAgICAgICAgICAgICAgQWVzLkhF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gICBmdW4gdmlzaXQoYWVzOiBBZXM8Kj4pOiBUIHtcbiAgICAgICAgcmV0dXJuIGlmIChhZXMuaXNOdW1lcmljKSB7XG4gICAgICAgICAgICAvLyBTYWZlIGNhc3QgYmVjYXVzZSBhbGwgJ251bWVyaWMnIGFlc3RoZXRpY3MgYXJlIDxEb3VibGU+XG4gICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgdmlzaXROdW1lcmljKGFlcyBhcyBBZXM8RG91YmxlPilcbiAgICAgICAgfSBlbHNlIHZpc2l0SW50ZXJuKGFlcylcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBEZXNjZW5kYW50cyBjYW4gb3ZlcnJpZGVcbiAgICAgKlxuICAgICAqIEBwYXJhbSBhZXNcbiAgICAgKi9cbiAgICBAU3VwcHJlc3MoXCJNZW1iZXJWaXNpYmlsaXR5Q2FuQmVQcml2YXRlXCIpXG4gICAgcHJvdGVjdGVkIGZ1biB2aXNpdE51bWVyaWMoYWVzOiBBZXM8RG91YmxlPik6IFQge1xuICAgICAgICByZXR1cm4gdmlzaXRJbnRlcm4oYWVzKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHZpc2l0SW50ZXJuKGFlczogQWVzPCo+KTogVCB7XG4gICAgICAgIGlmIChhZXMgPT0gWCkge1xuICAgICAgICAgICAgcmV0dXJuIHgoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gWSkge1xuICAgICAgICAgICAgcmV0dXJuIHkoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gWikge1xuICAgICAgICAgICAgcmV0dXJuIHooKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gWU1JTikge1xuICAgICAgICAgICAgcmV0dXJuIHltaW4oKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gWU1BWCkge1xuICAgICAgICAgICAgcmV0dXJuIHltYXgoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gQ09MT1IpIHtcbiAgICAgICAgICAgIHJldHVybiBjb2xvcigpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBGSUxMKSB7XG4gICAgICAgICAgICByZXR1cm4gZmlsbCgpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBBTFBIQSkge1xuICAgICAgICAgICAgcmV0dXJuIGFscGhhKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFNIQVBFKSB7XG4gICAgICAgICAgICByZXR1cm4gc2hhcGUoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gU0laRSkge1xuICAgICAgICAgICAgcmV0dXJuIHNpemUoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gTElORVRZUEUpIHtcbiAgICAgICAgICAgIHJldHVybiBsaW5lVHlwZSgpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBXSURUSCkge1xuICAgICAgICAgICAgcmV0dXJuIHdpZHRoKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IEhFSUdIVCkge1xuICAgICAgICAgICAgcmV0dXJuIGhlaWdodCgpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBXRUlHSFQpIHtcbiAgICAgICAgICAgIHJldHVybiB3ZWlnaHQoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gSU5URVJDRVBUKSB7XG4gICAgICAgICAgICByZXR1cm4gaW50ZXJjZXB0KClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFNMT1BFKSB7XG4gICAgICAgICAgICByZXR1cm4gc2xvcGUoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gWElOVEVSQ0VQVCkge1xuICAgICAgICAgICAgcmV0dXJuIGludGVyY2VwdFgoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gWUlOVEVSQ0VQVCkge1xuICAgICAgICAgICAgcmV0dXJuIGludGVyY2VwdFkoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gTE9XRVIpIHtcbiAgICAgICAgICAgIHJldHVybiBsb3dlcigpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBNSURETEUpIHtcbiAgICAgICAgICAgIHJldHVybiBtaWRkbGUoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gVVBQRVIpIHtcbiAgICAgICAgICAgIHJldHVybiB1cHBlcigpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBGUkFNRSkge1xuICAgICAgICAgICAgcmV0dXJuIGZyYW1lKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFNQRUVEKSB7XG4gICAgICAgICAgICByZXR1cm4gc3BlZWQoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gRkxPVykge1xuICAgICAgICAgICAgcmV0dXJuIGZsb3coKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gWE1JTikge1xuICAgICAgICAgICAgcmV0dXJuIHhtaW4oKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gWE1BWCkge1xuICAgICAgICAgICAgcmV0dXJuIHhtYXgoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gWEVORCkge1xuICAgICAgICAgICAgcmV0dXJuIHhlbmQoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gWUVORCkge1xuICAgICAgICAgICAgcmV0dXJuIHllbmQoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gTEFCRUwpIHtcbiAgICAgICAgICAgIHJldHVybiBsYWJlbCgpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBGQU1JTFkpIHtcbiAgICAgICAgICAgIHJldHVybiBmYW1pbHkoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gRk9OVE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LCB2KVxuICAgIH1cblxuICAgIGZ1biBzaXplKHY6IChJbnQpIC0+IERvdWJsZT8pOiBBZXN0aGV0aWNzQnVpbGRlciB7XG4gICAgICAgIHJldHVybiBhZXMoU0laRSwgdilcbiAgICB9XG5cbiAgICBmdW4gd2lkdGgodjogKEludCkgLT4gRG91YmxlPyk6IEFlc3RoZXRpY3NCdWlsZGVyIHtcbiAgICAgICAgcmV0dXJuIGFlcyhXSURUSCwgdilcbiAgICB9XG5cbiAgICBmdW4gd2VpZ2h0KHY6IChJbnQpIC0+IERvdWJsZT8pOiBBZXN0aGV0aWNzQnVpbGRlciB7XG4gICAgICAgIHJldHVybiBhZXMoV0VJR0hULCB2KVxuICAgIH1cblxuICAgIGZ1biBmcmFtZSh2OiAoSW50KSAtPiBTdHJpbmc/KTogQWVzdGhldGljc0J1aWxkZXIge1xuICAgICAgICByZXR1cm4gYWVzKEZSQU1FLCB2KVxuICAgIH1cblxuICAgIGZ1biBzcGVlZCh2OiAoSW50KSAtPiBEb3VibGU/KTogQWVzdGhldGljc0J1aWxkZXIge1xuICAgICAgICByZXR1cm4gYWVzKFNQRUVELCB2KVxuICAgIH1cblxuICAgIGZ1biBmbG93KHY6IChJbnQpIC0+IERvdWJsZT8pOiBBZXN0aGV0aWNzQnVpbGRlciB7XG4gICAgICAgIHJldHVybiBhZXMoRkxPVywgdilcbiAgICB9XG5cbiAgICBmdW4gZ3JvdXAodjogKEludCkgLT4gSW50KTogQWVzdGhldGljc0J1aWxkZXIge1xuICAgICAgICBteUdyb3VwID0gdlxuICAgICAgICByZXR1cm4gdGhpc1xuICAgIH1cblxuICAgIGZ1biBsYWJlbCh2OiAoSW50KSAtPiBBbnk/KTogQWVzdGhldGljc0J1aWxkZXIge1xuICAgICAgICByZXR1cm4gYWVzKExBQkVMLCB2KVxuICAgIH1cblxuICAgIGZ1biBmYW1pbHkodjogKEludCkgLT4gU3RyaW5nPyk6IEFlc3RoZXRpY3NCdWlsZGVyIHtcbiAgICAgICAgc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ncm91cCA9IGIubXlHcm91cFxuICAgICAgICBwcml2YXRlIHZhbCBteUNvbnN0YW50QWVzOiBTZXQ8QWVzPCo+PlxuICAgICAgICBwcml2YXRlIHZhbCBteU92ZXJhbGxSYW5nZUJ5TnVtZXJpY0FlczogTWFwPEFlczxEb3VibGU+LCBDbG9zZWRSYW5nZTxEb3VibGU+PlxuXG4gICAgICAgIHByaXZhdGUgdmFsIG15UmVzb2x1dGlvbkJ5QWVzID0gSGFzaE1hcDxBZXM8Kj4sIERvdWJsZT4oKVxuICAgICAgICBwcml2YXRlIHZhbCBteVJhbmdlQnlOdW1lcmljQWVzID0gSGFzaE1hcDxBZXM8RG91YmxlPiwgQ2xvc2VkUmFuZ2U8RG91YmxlPj8+KClcblxuICAgICAgICBvdmVycmlkZSB2YWwgaXNFbXB0eTogQm9vbGVhblxuICAgICAgICAgICAgZ2V0KCkgPSBteURhdGFQb2ludENvdW50ID09IDBcblxuICAgICAgICBpbml0IHtcbiAgICAgICAgICAgIG15Q29uc3RhbnRBZXMgPSBIYXNoU2V0KGIubXlDb25zdGFudEFlcylcbiAgICAgICAgICAgIG15T3ZlcmFsbFJhbmdlQnlOdW1lcmljQWVzID0gSGFzaE1hcChiLm15T3ZlcmFsbFJhbmdlQnlOdW1lcmljQWVzKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIDxUPiBhZXMoYWVzOiBBZXM8VD4pOiAoSW50KSAtPiBUIHtcbiAgICAgICAgICAgIHJldHVybiBteUluZGV4RnVuY3Rpb25NYXBbYWVzXVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGRhdGFQb2ludEF0KGluZGV4OiBJbnQpOiBEYXRhUG9pbnRBZXN0aGV0aWNzIHtcbiAgICAgICAgICAgIHJldHVybiBNeURhdGFQb2ludEFlc3RoZXRpY3MoXG4gICAgICAgICAgICAgICAgaW5kZXgsXG4gICAgICAgICAgICAgICAgdGhpc1xuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGRhdGFQb2ludENvdW50KCk6IEludCB7XG4gICAgICAgICAgICByZXR1cm4gbXlEYXRhUG9pbnRDb3VudFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGRhdGFQb2ludHMoKTogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz4ge1xuICAgICAgICAgICAgdmFsIHNlbGYgPSB0aGlzXG4gICAgICAgICAgICByZXR1cm4gb2JqZWN0IDogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz4ge1xuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBpdGVyYXRvcigpOiBJdGVyYXRvcjxEYXRhUG9pbnRBZXN0aGV0aWNzPiA9XG4gICAgICAgICAgICAgICAgICAgIE15RGF0YVBvaW50c0l0ZXJhdG9yKFxuICAgICAgICAgICAgICAgICAgICAgICAgbXlEYXRhUG9pbnRDb3VudCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGZcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHJhbmdlKGFlczogQWVzPERvdWJsZT4pOiBDbG9zZWRSYW5nZTxEb3VibGU+PyB7XG4gICAgICAgICAgICBpZiAoIW15UmFuZ2VCeU51bWVyaWNBZXMuY29udGFpbnNLZXkoYWVzKSkge1xuICAgICAgICAgICAgICAgIHZhbCByID0gd2hlbiB7XG4gICAgICAgICAgICAgICAgICAgIG15RGF0YVBvaW50Q291bnQgPD0gMCAtPlxuICAgICAgICAgICAgICAgICAgICAgICAgQ2xvc2VkUmFuZ2UoMC4wLCAwLjApXG4gICAgICAgICAgICAgICAgICAgIG15Q29uc3RhbnRBZXMuY29udGFpbnMoYWVzKSAtPiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBjb25zdGFudCBzaG91bGQgbm90IGJlIG51bGxcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCB2ID0gbnVtZXJpY1ZhbHVlcyhhZXMpLml0ZXJhdG9yKCkubmV4dCgpISFcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2LmlzRmluaXRlKCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBDbG9zZWRSYW5nZSh2LCB2KVxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIG51bGxcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBlbHNlIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCB2YWx1ZXMgPSBudW1lcmljVmFsdWVzKGFlcylcbiAgICAgICAgICAgICAgICAgICAgICAgIFNlcmllc1V0aWwucmFuZ2UodmFsdWVzKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG15UmFuZ2VCeU51bWVyaWNBZXNbYWVzXSA9IHJcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG15UmFuZ2VCeU51bWVyaWNBZXNbYWVzXVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIG92ZXJhbGxSYW5nZShhZXM6IEFlczxEb3VibGU+KTogQ2xvc2VkUmFuZ2U8RG91YmxlPiB7XG4gICAgICAgICAgICByZXR1cm4gbXlPdmVyYWxsUmFuZ2VCeU51bWVyaWNBZXNbYWVzXSA/OiBlcnJvcihcIk92ZXJhbGwgcmFuZ2UgaXMgdW5rbm93biBmb3IgJGFlc1wiKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHJlc29sdXRpb24oYWVzOiBBZXM8RG91YmxlPiwgbmFWYWx1ZTogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgICAgIGlmICghbXlSZXNvbHV0aW9uQnlBZXMuY29udGFpbnNLZXkoYWVzKSkge1xuICAgICAgICAgICAgICAgIHZhbCByZXNvbHV0aW9uOiBEb3VibGUgPVxuICAgICAgICAgICAgICAgICAgICB3aGVuIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG15Q29uc3RhbnRBZXMuY29udGFpbnMoYWVzKSAtPiAwLjBcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgLT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbCB2YWx1ZXMgPSBudW1lcmljVmFsdWVzKGFlcylcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBTZXJpZXNVdGlsLnJlc29sdXRpb24odmFsdWVzLCBuYVZhbHVlKVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbXlSZXNvbHV0aW9uQnlBZXNbYWVzXSA9IHJlc29sdXRpb25cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG15UmVzb2x1dGlvbkJ5QWVzW2Flc10hIVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIG51bWVyaWNWYWx1ZXMoYWVzOiBBZXM8RG91YmxlPik6IEl0ZXJhYmxlPERvdWJsZT8+IHtcbiAgICAgICAgICAgIHJlcXVpcmUoYWVzLmlzTnVtZXJpYykgeyBcIk51bWVyaWMgYWVzIGlzIGV4cGVjdGVkOiAkYWVzXCIgfVxuICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IEl0ZXJhYmxlPERvdWJsZT4ge1xuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBpdGVyYXRvcigpOiBJdGVyYXRvcjxEb3VibGU+IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlc0l0ZXJhdG9yKFxuICAgICAgICAgICAgICAgICAgICAgICAgbXlEYXRhUG9pbnRDb3VudCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGFlcyhhZXMpXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gZ3JvdXBzKCk6IEl0ZXJhYmxlPEludD4ge1xuICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IEl0ZXJhYmxlPEludD4ge1xuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBpdGVyYXRvcigpOiBJdGVyYXRvcjxJbnQ+IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlc0l0ZXJhdG9yKFxuICAgICAgICAgICAgICAgICAgICAgICAgbXlEYXRhUG9pbnRDb3VudCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGdyb3VwXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGNsYXNzIE15RGF0YVBvaW50c0l0ZXJhdG9yIGludGVybmFsIGNvbnN0cnVjdG9yKFxuICAgICAgICBwcml2YXRlIHZhbCBteUxlbmd0aDogSW50LFxuICAgICAgICBwcml2YXRlIHZhbCBteUFlc3RoZXRpY3M6IE15QWVzdGhldGljc1xuICAgICkgOiBJdGVyYXRvcjxEYXRhUG9pbnRBZXN0aGV0aWNzPiB7XG4gICAgICAgIHByaXZhdGUgdmFyIG15SW5kZXggPSAwXG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhhc05leHQoKTogQm9vbGVhbiB7XG4gICAgICAgICAgICByZXR1cm4gbXlJbmRleCA8IG15TGVuZ3RoXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gbmV4dCgpOiBEYXRhUG9pbnRBZXN0aGV0aWNzIHtcbiAgICAgICAgICAgIGlmIChoYXNOZXh0KCkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbXlBZXN0aGV0aWNzLmRhdGFQb2ludEF0KG15SW5kZXgrKylcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRocm93IE5vU3VjaEVsZW1lbnRFeGNlcHRpb24oXCJpbmRleD0kbXlJbmRleFwiKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBjbGFzcyBBZXNJdGVyYXRvcjxUPiBpbnRlcm5hbCBjb25zdHJ1Y3Rvcihwcml2YXRlIHZhbCBteUxlbmd0aDogSW50LCBwcml2YXRlIHZhbCBteUFlczogKEludCkgLT4gVCkgOlxuICAgICAgICBJdGVyYXRvcjxUPiB7XG4gICAgICAgIHByaXZhdGUgdmFyIG15SW5kZXggPSAwXG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhhc05leHQoKTogQm9vbGVhbiB7XG4gICAgICAgICAgICByZXR1cm4gbXlJbmRleCA8IG15TGVuZ3RoXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gbmV4dCgpOiBUIHtcbiAgICAgICAgICAgIGlmIChoYXNOZXh0KCkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbXlBZXMobXlJbmRleCsrKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhyb3cgTm9TdWNoRWxlbWVudEV4Y2VwdGlvbihcImluZGV4PSRteUluZGV4XCIpXG4gICAgICAgIH1cbiAgICB9XG5cblxuICAgIHByaXZhdGUgY2xhc3MgTXlEYXRhUG9pbnRBZXN0aGV0aWNzKFxuICAgICAgICBwcml2YXRlIHZhbCBteUluZGV4OiBJbnQ/LFxuICAgICAgICBwcml2YXRlIHZhbCBteUFlc3RoZXRpY3M6IE15QWVzdGhldGljc1xuICAgICkgOiBEYXRhUG9pbnRBZXN0aGV0aWNzIHtcblxuICAgICAgICBvdmVycmlkZSBmdW4gaW5kZXgoKTogSW50IHtcbiAgICAgICAgICAgIHJldHVybiBteUluZGV4ISFcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB4KCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChYKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHkoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFkpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4geigpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoWilcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB5bWluKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChZTUlOKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHltYXgoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFlNQVgpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gY29sb3IoKTogQ29sb3Ige1xuICAgICAgICAgICAgcmV0dXJuIGdldChDT0xPUilcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBmaWxsKCk6IENvbG9yIHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoRklMTClcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBhbHBoYSgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoQUxQSEEpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gc2hhcGUoKTogUG9pbnRTaGFwZSB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFNIQVBFKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGxpbmVUeXBlKCk6IExpbmVUeXBlIHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoTElORVRZUEUpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gc2l6ZSgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoU0laRSlcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB3aWR0aCgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoV0lEVEgpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaGVpZ2h0KCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChIRUlHSFQpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gd2VpZ2h0KCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChXRUlHSFQpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaW50ZXJjZXB0KCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChJTlRFUkNFUFQpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gc2xvcGUoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFNMT1BFKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGludGVyY2VwdFgoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFhJTlRFUkNFUFQpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaW50ZXJjZXB0WSgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoWUlOVEVSQ0VQVClcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBsb3dlcigpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoTE9XRVIpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gbWlkZGxlKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChNSURETEUpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gdXBwZXIoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFVQUEVSKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGZyYW1lKCk6IFN0cmluZyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KEZSQU1FKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHNwZWVkKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChTUEVFRClcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBmbG93KCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChGTE9XKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHhtaW4oKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFhNSU4pXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4geG1heCgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoWE1BWClcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB4ZW5kKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChYRU5EKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHllbmQoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFlFTkQpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gbGFiZWwoKTogQW55PyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KExBQkVMKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGZhbWlseSgpOiBTdHJpbmcge1xuICAgICAgICAgICAgcmV0dXJuIGdldChGQU1JTFkpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gZm9udGZhY2UoKTogU3RyaW5nIHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoRk9OVEZBQ0UpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaGp1c3QoKTogQW55IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoSEpVU1QpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gdmp1c3QoKTogQW55IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoVkpVU1QpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gYW5nbGUoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KEFOR0xFKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHN5bVgoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFNZTV9YKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHN5bVkoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFNZTV9ZKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGdyb3VwKCk6IEludD8ge1xuICAgICAgICAgICAgcmV0dXJuIG15QWVzdGhldGljcy5ncm91cChteUluZGV4ISEpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gbnVtZXJpYyhhZXM6IEFlczxEb3VibGU+KTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KGFlcylcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biA8VD4gZ2V0KGFlczogQWVzPFQ+KTogVCB7XG4gICAgICAgICAgICByZXR1cm4gbXlBZXN0aGV0aWNzLmFlcyhhZXMpKG15SW5kZXghISlcbiAgICAgICAgfVxuICAgIH1cblxuXG4gICAgcHJpdmF0ZSBjbGFzcyBBcnJheUFlczxWYWx1ZVQ+IGludGVybmFsIGNvbnN0cnVjdG9yKHByaXZhdGUgdmFsIG15VmFsOiBBcnJheTxvdXQgVmFsdWVUPikgOiBGdW5jdGlvbjxJbnQsIFZhbHVlVD4ge1xuICAgICAgICBvdmVycmlkZSBmdW4gYXBwbHkodmFsdWU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yB7XG4gICAgICAgICAgICByZXR1cm4gYmFzZSgpXG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuU0laRSwgMi4wKVxuICAgICAgICAgICAgICAgIC51cGRhdGVJbkxlZ2VuZChBZXMuU0laRSwgNS4wKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHBhdGgoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBiYXNlKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBsaW5lKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gcGF0aCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYWJsaW5lKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gcGF0aCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaGxpbmUoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBwYXRoKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB2bGluZSgpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIHBhdGgoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHNtb290aCgpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIHBhdGgoKVxuICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLkNPTE9SLCBDb2xvci5NQUdFTlRBKVxuICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLkZJTEwsIENvbG9yLkJMQUNLKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGJhcigpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IEFlc3RoZXRpY3NEZWZhdWx0cygpIHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gcmFuZ2VJbmNsdWRlc1plcm8oYWVzOiBBZXM8Kj4pOiBCb29sZWFuIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFlcyA9PSBBZXMuWSB8fCBzdXBlci5yYW5nZUluY2x1ZGVzWmVybyhhZXMpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLldJRFRILCAwLjkpXG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuQ09MT1IsIENvbG9yLlRSQU5TUEFSRU5UKSAgICAvLyBubyBvdXRsaW5lICh0cmFuc3BhcmVudClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBoaXN0b2dyYW0oKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBBZXN0aGV0aWNzRGVmYXVsdHMoKSB7XG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHJhbmdlSW5jbHVkZXNaZXJvKGFlczogQWVzPCo+KTogQm9vbGVhbiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBhZXMgPT0gQWVzLlkgfHwgc3VwZXIucmFuZ2VJbmNsdWRlc1plcm8oYWVzKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5DT0xPUiwgQ29sb3IuVFJBTlNQQVJFTlQpICAgIC8vIG5vIG91dGxpbmUgKHRyYW5zcGFyZW50KVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHRpbGUoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBBZXN0aGV0aWNzRGVmYXVsdHMoKVxuICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLkNPTE9SLCBDb2xvci5UUkFOU1BBUkVOVCkgICAgLy8gbm8gb3V0bGluZSAodHJhbnNwYXJlbnQpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYmluMmQoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiB0aWxlKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBlcnJvckJhcigpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIEFlc3RoZXRpY3NEZWZhdWx0cygpXG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuQ09MT1IsIENvbG9yLkJMQUNLKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGNyb3NzQmFyKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gQWVzdGhldGljc0RlZmF1bHRzKClcbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5XSURUSCwgMC45KVxuICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLkNPTE9SLCBDb2xvci5CTEFDSylcbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5GSUxMLCBDb2xvci5XSElURSlcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBsaW5lUmFuZ2UoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBwYXRoKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBwb2ludFJhbmdlKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gcGF0aCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcG9seWdvbigpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIGJhc2UoKVxuICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLkNPTE9SLCBDb2xvci5UUkFOU1BBUkVOVCkgICAgLy8gbm8gb3V0bGluZSAodHJhbnNwYXJlbnQpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gbWFwKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gYmFzZSgpXG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuU0laRSwgMC4yKSAgICAgICAgICAgICAgICAgICAgLy8gb3V0bGluZSB0aGlja25lc3NcbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5DT0xPUiwgQ29sb3IuR1JBWSlcbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5GSUxMLCBDb2xvci5UUkFOU1BBUkVOVClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBib3hwbG90KCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gY3Jvc3NCYXIoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGxpdmVtYXAoZGlzcGxheU1vZGU6IExpdmVtYXBDb25zdGFudHMuRGlzcGxheU1vZGUpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIHdoZW4gKGRpc3BsYXlNb2RlKSB7XG4gICAgICAgICAgICAgICAgTGl2ZW1hcENvbnN0YW50cy5EaXNwbGF5TW9kZS5QT0lOVCAtPiBwb2ludCgpXG4gICAgICAgICAgICAgICAgICAgIC51cGRhdGVJbkxlZ2VuZChBZXMuU0laRSwgNS4wKVxuICAgICAgICAgICAgICAgIExpdmVtYXBDb25zdGFudHMuRGlzcGxheU1vZGUuQkFSIC0+IGJhc2UoKVxuICAgICAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5TSVpFLCA0MC4wKVxuICAgICAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5DT0xPUiwgQ29sb3IuVFJBTlNQQVJFTlQpXG4gICAgICAgICAgICAgICAgTGl2ZW1hcENvbnN0YW50cy5EaXNwbGF5TW9kZS5QSUUgLT4gYmFzZSgpXG4gICAgICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLlNJWkUsIDIwLjApXG4gICAgICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLkNPTE9SLCBDb2xvci5UUkFOU1BBUkVOVClcbiAgICAgICAgICAgICAgICAgICAgLnVwZGF0ZUluTGVnZW5kKEFlcy5TSVpFLCA1LjApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcmliYm9uKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gYmFzZSgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYXJlYSgpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IEFlc3RoZXRpY3NEZWZhdWx0cygpIHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gcmFuZ2VJbmNsdWRlc1plcm8oYWVzOiBBZXM8Kj4pOiBCb29sZWFuIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFlcyA9PSBBZXMuWSB8fCBzdXBlci5yYW5nZUluY2x1ZGVzWmVybyhhZXMpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGRlbnNpdHkoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBhcmVhKClcbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5GSUxMLCBDb2xvci5UUkFOU1BBUkVOVClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBjb250b3VyKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gcGF0aCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gY29udG91cmYoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBiYXNlKClcbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5TSVpFLCAwLjApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZGVuc2l0eTJkKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gY29udG91cigpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZGVuc2l0eTJkZigpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIGNvbnRvdXJmKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBqaXR0ZXIoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBwb2ludCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZnJlcXBvbHkoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBwYXRoKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBzdGVwKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gcGF0aCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcmVjdCgpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIHBvbHlnb24oKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHNlZ21lbnQoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBwYXRoKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB0ZXh0KCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gYmFzZSgpXG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuU0laRSwgNy4wKVxuICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLkNPTE9SLCBDb2xvci5wYXJzZUhleChcIiMzZDNkM2RcIikpIC8vIGRhcmsgZ3JheVxuICAgICAgICB9XG5cblxuICAgICAgICBmdW4gcmFzdGVyKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gYmFzZSgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaW1hZ2UoK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lPERvdWJsZT4/ID0gbnVsbFxuICAgICk6IENvb3JkaW5hdGVTeXN0ZW0ge1xuICAgICAgICB2YWwgb3JpZ2luID0gRG91YmxlVmVjdG9yKFxuICAgICAgICAgICAgb3JpZ2luWCh4UmFuZ2UpLFxuICAgICAgICAgICAgb3JpZ2luWSh5UmFuZ2UpXG4gICAgICAgIClcbiAgICAgICAgcmV0dXJuIGNyZWF0ZShvcmlnaW4sIHhMaW0sIHlMaW0pXG4gICAgfVxuXG4gICAgZnVuIGNyZWF0ZShcbiAgICAgICAgb3JpZ2luOiBEb3VibGVWZWN0b3IsXG4gICAgICAgIHhMaW06IENsb3NlZFJhbmdlPERvdWJsZT4/ID0gbnVsbCxcbiAgICAgICAgeUxpbTogQ2xvc2VkUmFuZ2U8RG91YmxlPj8gPSBudWxsXG4gICAgKTogQ29vcmRpbmF0ZVN5c3RlbSB7XG4gICAgICAgIHJldHVybiBEZWZhdWx0Q29vcmRpbmF0ZVN5c3RlbShcbiAgICAgICAgICAgIHRvQ2xpZW50T2Zmc2V0WChvcmlnaW4ueCksXG4gICAgICAgICAgICB0b0NsaWVudE9mZnNldFkob3JpZ2luLnkpLFxuICAgICAgICAgICAgZnJvbUNsaWVudE9mZnNldFgob3JpZ2luLngpLFxuICAgICAgICAgICAgZnJvbUNsaWVudE9mZnNldFkob3JpZ2luLnkpLFxuICAgICAgICAgICAgeExpbSxcbiAgICAgICAgICAgIHlMaW1cbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biB0b0NsaWVudE9mZnNldFgoeFJhbmdlOiBDbG9zZWRSYW5nZTxEb3VibGU+KTogKERvdWJsZSkgLT4gRG91YmxlIHtcbiAgICAgICAgcmV0dXJuIHRvQ2xpZW50T2Zmc2V0WChcbiAgICAgICAgICAgIG9yaWdpblgoXG4gICAgICAgICAgICAgICAgeFJhbmdlXG4gICAgICAgICAgICApXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gdG9DbGllbnRPZmZzZXRZKHlSYW5nZTogQ2xvc2VkUmFuZ2U8RG91YmxlPik6IChEb3VibGUpIC0+IERvdWJsZSB7XG4gICAgICAgIHJldHVybiB0b0NsaWVudE9mZnNldFkoXG4gICAgICAgICAgICBvcmlnaW5ZKFxuICAgICAgICAgICAgICAgIHlSYW5nZVxuICAgICAgICAgICAgKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gb3JpZ2luWCh4UmFuZ2U6IENsb3NlZFJhbmdlPERvdWJsZT4pOiBEb3VibGUge1xuICAgICAgICByZXR1cm4gLXhSYW5nZS5sb3dlckVuZFxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIG9yaWdpblkoeVJhbmdlOiBDbG9zZWRSYW5nZTxEb3VibGU+KTogRG91YmxlIHtcbiAgICAgICAgcmV0dXJuIHlSYW5nZS51cHBlckVuZFxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHRvQ2xpZW50T2Zmc2V0WChvcmlnaW5YOiBEb3VibGUpOiAoRG91YmxlKSAtPiBEb3VibGUge1xuICAgICAgICByZXR1cm4geyB4IC0+IG9yaWdpblggKyB4IH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBmcm9tQ2xpZW50T2Zmc2V0WChvcmlnaW5YOiBEb3VibGUpOiAoRG91YmxlKSAtPiBEb3VibGUge1xuICAgICAgICByZXR1cm4geyB4IC0+IHggLSBvcmlnaW5YIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB0b0NsaWVudE9mZnNldFkob3JpZ2luWTogRG91YmxlKTogKERvdWJsZSkgLT4gRG91YmxlIHtcbiAgICAgICAgLy8geS1heGlzIGlzIGludmVydGVkXG4gICAgICAgIHJldHVybiB7IHkgLT4gb3JpZ2luWSAtIHkgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGZyb21DbGllbnRPZmZzZXRZKG9yaWdpblk6IERvdWJsZSk6IChEb3VibGUpIC0+IERvdWJsZSB7XG4gICAgICAgIC8vIHktYXhpcy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IHRyYW5zZm9ybVNvdXJjZSA9XG4vLyAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtU291cmNlLm1hcCB7IGlmIChjb250aW51b3VzVHJhbnNmb3JtLmlzSW5Eb21haW4oaXQgYXMgRG91YmxlPykpIGl0IGVsc2UgbnVsbCB9XG4vLyAgICAgICAgICAgIH1cbi8vICAgICAgICB9XG4vL1xuLy8gICAgICAgIHJldHVybiB0cmFuc2Zvcm1Tb3VyY2VcbiAgICAgICAgcmV0dXJuIFNjYWxlVXRpbC5jbGVhblVwVHJhbnNmb3JtU291cmNlKHRyYW5zZm9ybVNvdXJjZSwgc2NhbGUpXG4gICAgfVxuXG4gICAgZnVuIGhhc1ZhcmlhYmxlKGRhdGE6IERhdGFGcmFtZSwgdmFyTmFtZTogU3RyaW5nKTogQm9vbGVhbiB7XG4gICAgICAgIGZvciAoYHZhcmAgaW4gZGF0YS52YXJpYWJsZXMoKSkge1xuICAgICAgICAgICAgaWYgKHZhck5hbWUgPT0gYHZhcmAubmFtZSkge1xuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGZhbHNlXG4gICAgfVxuXG4gICAgZnVuIGZpbmRWYXJpYWJsZU9yRmFpbChkYXRhOiBEYXRhRnJhbWUsIHZhck5hbWU6IFN0cmluZyk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgIGZvciAoYHZhcmAgaW4gZGF0YS52YXJpYWJsZXMoKSkge1xuICAgICAgICAgICAgaWYgKHZhck5hbWUgPT0gYHZhcmAubmFtZSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBgdmFyYFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcbiAgICAgICAgICAgIFwiVmFyaWFibGUgbm90IGZvdW5kOiAnJHZhck5hbWUnLiBWYXJpYWJsZXMgaW4gZGF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ogU3RyaW5nID0gYXNEeW5hbWljKCkucmVwbGFjZShwYXR0ZXJuLCByZXBsYWNlbWVudClcblxuQFNpbmNlS290bGluKFwiMS4yXCIpXG5AU3VwcHJlc3MoXCJBQ1RVQUxfRlVOQ1RJT05fV0lUSF9ERUZBVUxUX0FSR1VNRU5UU1wiKVxucHVibGljIGFjdHVhbCBmdW4gU3RyaW5nLmNvbXBhcmVUbyhvdGhlcjogU3RyaW5nLCBpZ25vcmVDYXNlOiBCb29sZWFuID0gZmFsc2UpOiBJbnQge1xuICAgIGlmIChpZ25vcmVDYXNlKSB7XG4gICAgICAgIHZhbCBuMSA9IHRoaXMubGVuZ3RoXG4gICAgICAgIHZhbCBuMiA9IG90aGVyLmxlbmd0aFxuICAgICAgICB2YWwgbWluID0gbWluT2YobjEsIG4yKVxuICAgICAgICBpZiAobWluID09IDApIHJldHVybiBuMSAtIG4yXG4gICAgICAgIHZhciBzdGFydCA9IDBcbiAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgIHZhbCBlbmQgPSBtaW5PZihzdGFydCArIDE2LCBtaW4pXG4gICAgICAgICAgICB2YXIgczEgPSB0aGlzLnN1YnN0cmluZyhzdGFydCwgZW5kKVxuICAgICAgICAgICAgdmFyIHMyID0gb3RoZXIuc3Vic3RyaW5nKHN0YXJ0LCBlbmQpXG4gICAgICAgICAgICBpZiAoczEgIT0gczIpIHtcbiAgICAgICAgICAgICAgICBzMSA9IHMxLnVwcGVyY2FzZSgpXG4gICAgICAgICAgICAgICAgczIgPSBzMi51cHBlcmNhc2UoKVxuICAgICAgICAgICAgICAgIGlmIChzMSAhPSBzMikge1xuICAgICAgICAgICAgICAgICAgICBzMSA9IHMxLmxvd2VyY2FzZSgpXG4gICAgICAgICAgICAgICAgICAgIHMyID0gczIubG93ZXJjYXNlKClcbiAgICAgICAgICAgICAgICAgICAgaWYgKHMxICE9IHMyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gczEuY29tcGFy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aWRlIGZ1biBmaWxsKCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gRklMTFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGFscGhhKCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gQUxQSEFcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBzaGFwZSgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIFNIQVBFXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gbGluZVR5cGUoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBMSU5FVFlQRVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHNpemUoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBTSVpFXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gd2lkdGgoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBXSURUSFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhlaWdodCgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIEhFSUdIVFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHdlaWdodCgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIFdFSUdIVFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGludGVyY2VwdCgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIElOVEVSQ0VQVFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHNsb3BlKCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gU0xPUEVcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBpbnRlcmNlcHRYKCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gWElOVEVSQ0VQVFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGludGVyY2VwdFkoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBZSU5URVJDRVBUXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gbG93ZXIoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBMT1dFUlxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIG1pZGRsZSgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIE1JRERMRVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHVwcGVyKCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gVVBQRVJcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBmcmFtZSgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIEZSQU1FXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gc3BlZWQoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBTUEVFRFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGZsb3coKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBGTE9XXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4geG1pbigpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIFhNSU5cbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB4bWF4KCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gWE1BWFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHhlbmQoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBYRU5EXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4geWVuZCgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIFlFTkRcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBsYWJlbCgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIExBQkVMXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gZmFtaWx5KCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gRk9OVF9GQU1JTFlcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBmb250ZmFjZSgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIEZPTlRfRkFDRVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhqdXN0KCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gSEpVU1RcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB2anVzdCgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIFZKVVNUXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gYW5nbGUoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAg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El0ZXJhYmxlcy50b0xpc3Qodmlld1BvcnQucGFydHMpXG5cbiAgICAgICAgdmFsIGxpbmVzID0gQXJyYXlMaXN0PFN2Z0xpbmVFbGVtZW50PigpXG4gICAgICAgIGZvciAocCBpbiBhZXN0aGV0aWNzLmRhdGFQb2ludHMoKSkge1xuICAgICAgICAgICAgdmFsIGludGVyY2VwdCA9IHAuaW50ZXJjZXB0KClcbiAgICAgICAgICAgIHZhbCBzbG9wZSA9IHAuc2xvcGUoKVxuICAgICAgICAgICAgaWYgKFNlcmllc1V0aWwuYWxsRmluaXRlKGludGVyY2VwdCwgc2xvcGUpKSB7XG4gICAgICAgICAgICAgICAgdmFsIHAxID0gRG91YmxlVmVjdG9yKHZpZXdQb3J0LmxlZnQsIGludGVyY2VwdCEhICsgdmlld1BvcnQubGVmdCAqIHNsb3BlISEpXG4gICAgICAgICAgICAgICAgdmFsIHAyID0gRG91YmxlVmVjdG9yKHZpZXdQb3J0LnJpZ2h0LCBwMS55ICsgdmlld1BvcnQuZGltZW5zaW9uLnggKiBzbG9wZSlcbiAgICAgICAgICAgICAgICB2YWwgcyA9IERvdWJsZVNlZ21lbnQocDEsIHAyKVxuXG4gICAgICAgICAgICAgICAgdmFsIGxpbmVFbmRzID0gSGFzaFNldDxEb3VibGVWZWN0b3I+KDIpXG4gICAgICAgICAgICAgICAgZm9yIChib3VuZGFyeSBpbiBib3VuZGFyaWVzKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBpbnRlcnNlY3Rpb24gPSBib3VuZGFyeS5pbnRlcnNlY3Rpb24ocylcbiAgICAgICAgICAgICAgICAgICAgaWYgKGludGVyc2VjdGlvbiAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsaW5lRW5kcy5hZGQoaW50ZXJzZWN0aW9uKVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxpbmVFbmRzLnNpemUgPT0gMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXG4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pUG9pbnREYXRhLnBvaW50cyxcbiAgICAgICAgICAgICAgICBtdWx0aVBvaW50RGF0YS5sb2NhbFRvR2xvYmFsSW5kZXgsXG4gICAgICAgICAgICAgICAgc2V0dXBUb29sdGlwUGFyYW1zKG11bHRpUG9pbnREYXRhLmFlcylcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByb3RlY3RlZCBvcGVuIGZ1biBzZXR1cFRvb2x0aXBQYXJhbXMoYWVzOiBEYXRhUG9pbnRBZXN0aGV0aWNzKTogVG9vbHRpcFBhcmFtcyB7XG4gICAgICAgIHJldHVybiBwYXJhbXMoKS5zZXRDb2xvcihmcm9tRmlsbChhZXMpKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHRvQ2xpZW50KGdlb21IZWxwZXI6IEdlb21IZWxwZXIsIHA6IERhdGFQb2ludEFlc3RoZXRpY3MpOiBEb3VibGVWZWN0b3I/IHtcbiAgICAgICAgdmFsIGNvb3JkID0gR2VvbVV0aWwuVE9fTE9DQVRJT05fWF9ZKHApXG4gICAgICAgIHJldHVybiBpZiAoY29vcmQgIT0gbnVsbCkge1xuICAgICAgICAgICAgZ2VvbUhlbHBlci50b0NsaWVudChjb29yZCwgcClcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIG51bGxcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuLy8gICAgICAgIHZhbCBSRU5ERVJTID0gbGlzdE9mKFxuLy8gICAgICAgICAgICAgICAgQWVzLlgsXG4vLyAgICAgICAgICAgICAgICBBZXMuWSxcbi8vICAgICAgICAgICAgICAgIEFlcy5TSVpFLFxuLy8gICAgICAgICAgICAgICAgQWVzLkxJTkVUWVBFLFxuLy8gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuLy8gICAgICAgICAgICAgICAgQWVzLkZJTEwsXG4vLyAgICAgICAgICAgICAgICBBZXMuQUxQSEFcbi8vICAgICAgICApXG5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gICAgYWVzdGhldGljczogQWVzdGhldGljcyxcbiAgICAgICAgcG9zOiBQb3NpdGlvbkFkanVzdG1lbnQsXG4gICAgICAgIGNvb3JkOiBDb29yZGluYXRlU3lzdGVtLFxuICAgICAgICBjdHg6IEdlb21Db250ZXh0XG4gICAgKSB7XG4gICAgICAgIHZhbCBoZWxwZXIgPVxuICAgICAgICAgICAgUmVjdGFuZ2xlc0hlbHBlcihhZXN0aGV0aWNzLCBwb3MsIGNvb3JkLCBjdHgpXG4gICAgICAgIHZhbCByZWN0YW5nbGVzID0gaGVscGVyLmNyZWF0ZVJlY3RhbmdsZXMoXG4gICAgICAgICAgICByZWN0YW5nbGVCeURhdGFQb2ludChcbiAgICAgICAgICAgICAgICBjdHhcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgICAgICByZWN0YW5nbGVzLnJldmVyc2UoKVxuICAgICAgICByZWN0YW5nbGVzLmZvckVhY2ggeyByb290LmFkZChpdCkgfVxuXG4vLyAgICAgICAgUmVjdFRhcmdldENvbGxlY3RvckhlbHBlcihcbi8vICAgICAgICAgICAgaGVscGVyLFxuLy8gICAgICAgICAgICByZWN0YW5nbGVCeURhdGFQb2ludChjdHgpLFxuLy8gICAgICAgICAgICB7IEhpbnRDb2xvclV0aWwuZnJvbUZpbGwoaXQpIH0pXG4vLyAgICAgICAgICAgIC5jb2xsZWN0VG8oY3R4LnRhcmdldENvbGxlY3RvcilcbiAgICAgICAgQmFyVG9vbHRpcEhlbHBlci5jb2xsZWN0UmVjdGFuZ2xlVGFyZ2V0cyhcbiAgICAgICAgICAgIGVtcHR5TGlzdCgpLFxuICAgICAgICAgICAgYWVzdGhldGljcywgcG9zLCBjb29yZCwgY3R4LFxuICAgICAgICAgICAgcmVjdGFuZ2xlQnlEYXRhUG9pbnQoY3R4KSxcbiAgICAgICAgICAgIHsgSGludENvbG9yVXRpbC5mcm9tRmlsbChpdCkgfVxuICAgICAgICApXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iam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XG4gICAgICAgICAgICAgICAgdmFsIGZlbmNlID0gcC55bWluKCkhIVxuICAgICAgICAgICAgICAgIC8vIHdoaXNrZXIgbGluZVxuICAgICAgICAgICAgICAgIGxpbmVzLmFkZChcbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudEhlbHBlci5jcmVhdGVMaW5lKFxuICAgICAgICAgICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHgsIGhpbmdlKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIERvdWJsZVZlY3Rvcih4LCBmZW5jZSksXG4gICAgICAgICAgICAgICAgICAgICAgICBwXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgLy8gZmVuY2UgbGluZVxuICAgICAgICAgICAgICAgIC8qXG4gICAgICAgIGxpbmVzLmFkZChlbGVtZW50SGVscGVyLmNyZWF0ZUxpbmUoXG4gICAgICAgICAgICBuZXcgRG91YmxlVmVjdG9yKHggLSBoYWxmRmVuY2VXaWR0aCwgZmVuY2UpLFxuICAgICAgICAgICAgbmV3IERvdWJsZVZlY3Rvcih4ICsgaGFsZkZlbmNlV2lkdGgsIGZlbmNlKSxcbiAgICAgICAgICAgIHApKTtcbiAgICAgICAgKi9cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gdXBwZXIgd2hpc2tlclxuICAgICAgICAgICAgaWYgKHAuZGVmaW5lZChBZXMuVVBQRVIpICYmIHAuZGVmaW5lZChBZXMuWU1BWCkpIHtcbiAgICAgICAgICAgICAgICB2YWwgaGluZ2UgPSBwLnVwcGVyKCkhIVxuICAgICAgICAgICAgICAgIHZhbCBmZW5jZSA9IHAueW1heCgpISFcbiAgICAgICAgICAgICAgICAvLyB3aGlza2VyIGxpbmVcbiAgICAgICAgICAgICAgICBsaW5lcy5hZGQoXG4gICAgICAgICAgICAgICAgICAgIGVsZW1lbnRIZWxwZXIuY3JlYXRlTGluZShcbiAgICAgICAgICAgICAgICAgICAgICAgIERvdWJsZVZlY3Rvcih4LCBoaW5nZSksXG4gICAgICAgICAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IoeCwgZmVuY2UpLFxuICAgICAgICAgICAgICAgICAgICAgICAgcFxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIC8vIGZlbmNlIGxpbmVcbiAgICAgICAgICAgICAgICAvKlxuICAgICAgICBsaW5lcy5hZGQoZWxlbWVudEhlbHBlci5jcmVhdGVMaW5lKFxuICAgICAgICAgICAgbmV3IERvdWJsZVZlY3Rvcih4IC0gaGFsZkZlbmNlV2lkdGgsIGZlbmNlKSxcbiAgICAgICAgICAgIG5ldyBEb3VibGVWZWN0b3IoeCArIGhhbGZGZW5jZVdpZHRoLCBmZW5jZSksXG4gICAgICAgICAgICBwKSk7XG4gICAgICAgICovXG5cbiAgICAgICAgICAgICAgICBsaW5lcy5mb3JFYWNoIHsgcm9vdC5hZGQoaXQpIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGJ1aWxkT3V0bGllcnMoXG4gICAgICAgIHJvb3Q6IFN2Z1Jvb3QsXG4gICAgICAgIGFlc3RoZXRpY3M6IEFlc3RoZXRpY3MsXG4gICAgICAgIHBvczogUG9zaXRpb25BZGp1c3RtZW50LFxuICAgICAgICBjb29yZDogQ29vcmRpbmF0ZVN5c3RlbSxcbiAgICAgICAgY3R4OiBHZW9tQ29udGV4dFxuICAgICkge1xuICAgICAgICB2YWwgb3V0bGllckFlc3RoZXRpY3MgPSBnZXRPdXRsaWVyc0Flc3RoZXRpY3MoYWVzdGhldGljcylcbiAgICAgICAgUG9pbnRHZW9tKClcbiAgICAgICAgICAgIC5idWlsZEludGVybihyb290LCBvdXRsaWVyQWVzdGhldGljcywgcG9zLCBjb29yZCwgY3R4LndpdGhUYXJnZXRDb2xsZWN0b3IoTnVsbEdlb21UYXJnZXRDb2xsZWN0b3IoKS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Ck6IENvbG9yPyA9IGdldEludGVybihBZXMuQ09MT1IpXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gZmlsbCgpOiBDb2xvcj8gPSBnZXRJbnRlcm4oQWVzLkZJTEwpXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gc2hhcGUoKTogUG9pbnRTaGFwZT8gPSBnZXRJbnRlcm4oQWVzLlNIQVBFKVxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHNpemUoKTogRG91YmxlPyA9IGdldEludGVybihBZXMuU0laRSlcblxuICAgICAgICAgICAgcHJpdmF0ZSBmdW4gPFQ+IGdldEludGVybihhZXM6IEFlczxUPik6IFQ/IHtcbiAgICAgICAgICAgICAgICB2YWwgdmFsdWU6IEFueT8gPSB3aGVuIChhZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgQWVzLkNPTE9SIC0+IG91dGxpZXJDb2xvciA/OiBzdXBlci5jb2xvcigpXG4gICAgICAgICAgICAgICAgICAgIEFlcy5GSUxMIC0+IG91dGxpZXJGaWxsID86IHN1cGVyLmZpbGwoKVxuICAgICAgICAgICAgICAgICAgICBBZXMuU0hBUEUgLT4gb3V0bGllclNoYXBlID86IHN1cGVyLnNoYXBlKClcbiAgICAgICAgICAgICAgICAgICAgQWVzLlNJWkUgLT4gb3V0bGllclNpemUgPzogT1VUTElFUl9ERUZfU0laRSAgLy8gJ3NpemUnIG9mICdzdXBlcicgaXMgbGluZSB0aGlja25lc3Mgb24gYm94LXBsb3RcbiAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiBzdXBlci5nZXQoYWVzKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZSBhcyBUP1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgY29uc3QgdmFsIEhBTkRMRVNfR1JPVVBTID0gZmFsc2VcblxuICAgICAgICBwcml2YXRlIHZhbCBMRUdFTkRfRkFDVE9SWSA9IENyb3NzQmFySGVscGVyLmxlZ2VuZEZhY3RvcnkodHJ1ZSlcbiAgICAgICAgcHJpdmF0ZSB2YWwgT1VUTElFUl9ERUZfU0laRSA9IEFlc3RoZXRpY3NEZWZhdWx0cy5wb2ludCgpLmRlZmF1bHRWYWx1ZShBZXMuU0laRSlcblxuICAgICAgICBwcml2YXRlIGZ1biByZWN0YW5nbGVCeURhdGFQb2ludChjdHg6IEdlb21Db250ZXh0KTogKERhdGFQb2ludEFlc3RoZXRpY3MpIC0+IERvdWJsZVJlY3RhbmdsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIHsgcCAtPlxuICAgICAgICAgICAgICAgIGlmIChwLmRlZmluZWQoQWVzLlgpICYmXG4gICAgICAgICAgICAgICAgICAgIHAuZGVmaW5lZChBZXMuTE9XRVIpICYmXG4gICAgICAgICAgICAgICAgICAgIHAuZGVmaW5lZChBZXMuVVBQRVIpICYmXG4gICAgICAgICAgICAgICAgICAgIHAuZGVmaW5lZChBZXMuV0lEVEgpXG4gICAgICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCB4ID0gcC54KCkhIVxuICAgICAgICAgICAgICAgICAgICB2YWwgbG93ZXIgPSBwLmxvd2VyKCkhIVxuICAgICAgICAgICAgICAgICAgICB2YWwgdXBwZXIgPSBwLnVwcGVyKCkhIVxuICAgICAgICAgICAgICAgICAgICB2YWwgd2lkdGggPSBHZW9tVXRpbC53aWR0aFB4KHAsIGN0eCwgMi4wKVxuXG4gICAgICAgICAgICAgICAgICAgIHZhbCBvcmlnaW4gPSBEb3VibGVWZWN0b3IoeCAtIHdpZHRoIC8gMiwgbG93ZXIpXG4gICAgICAgICAgICAgICAgICAgIHZhbCBkaW1lbnNpb25zID0gRG91YmxlVmVjdG9yKHdpZHRoLCB1cHBlciAtIGxvd2VyKV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sLmZyb21Db2xvcihpdCkgfVxuICAgICAgICApXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGNvbnN0IHZhbCBIQU5ETEVTX0dST1VQUyA9IGZhbHNlXG5cbiAgICAgICAgcHJpdmF0ZSB2YWwgTEVHRU5EX0ZBQ1RPUlkgPSBDcm9zc0JhckhlbHBlci5sZWdlbmRGYWN0b3J5KGZhbHNlKVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHJlY3RhbmdsZUJ5RGF0YVBvaW50KFxuICAgICAgICAgICAgY3R4OiBHZW9tQ29udGV4dCxcbiAgICAgICAgICAgIGlzSGludFJlY3Q6IEJvb2xlYW5cbiAgICAgICAgKTogKERhdGFQb2ludEFlc3RoZXRpY3MpIC0+IERvdWJsZVJlY3RhbmdsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIHsgcCAtPlxuICAgICAgICAgICAgICAgIGlmICghaXNIaW50UmVjdCAmJlxuICAgICAgICAgICAgICAgICAgICBwLmRlZmluZWQoQWVzLlgpICYmXG4gICAgICAgICAgICAgICAgICAgIHAuZGVmaW5lZChBZXMuWU1JTikgJiZcbiAgICAgICAgICAgICAgICAgICAgcC5kZWZpbmVkKEFlcy5ZTUFYKSAmJlxuICAgICAgICAgICAgICAgICAgICBwLmRlZmluZWQoQWVzLldJRFRIKVxuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgeCA9IHAueCgpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIHltaW4gPSBwLnltaW4oKSEhXG4gICAgICAgICAgICAgICAgICAgIHZhbCB5bWF4ID0gcC55bWF4KCkhIVxuICAgICAgICAgICAgICAgICAgICB2YWwgd2lkdGggPSBHZW9tVXRpbC53aWR0aFB4KHAsIGN0eCwgMi4wKVxuXG4gICAgICAgICAgICAgICAgICAgIHZhbCBvcmlnaW4gPSBEb3VibGVWZWN0b3IoeCAtIHdpZHRoIC8gMiwgeW1pbilcbiAgICAgICAgICAgICAgICAgICAgdmFsIGRpbWVuc2lvbnMgPSBEb3VibGVWZWN0b3Iod2lkdGgsIHltYXggLSB5bWluKVxuICAgICAgICAgICAgICAgICAgICBEb3VibGVSZWN0YW5nbGUob3JpZ2luLCBkaW1lbnNpb25zKVxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNIaW50UmVjdCAmJlxuICAgICAgICAgICAgICAgICAgICBwLmRlZmluZWQoQWVzLlgpICYmXG4gICAgICAgICAgICAgICAgICAgIHAuZGVmaW5lZChBZXMuTUlERExFKVxuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgeCA9IHAueCgpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIG1pZGRsZSA9IHAubWlkZGxlKCkhIVxuICAgICAgICAgICAgICAgICAgICB2YWwgd2lkdGggPSBHZW9tVXRpbC53aWR0aFB4KHAsIGN0eCwgMi4wKVxuXG4gICAgICAgICAgICAgICAgICAgIHZhbCBvcmlnaW4gPSBEb3VibGVWZWN0b3IoeCAtIHdpZHRoIC8gMiwgbWlkZGxlKVxuICAgICAgICAgICAgICAgICAgICB2YWwgZGltZW5zaW9ucyA9IERvdWJsZVZlY3Rvcih3aWR0aCwgMC4wKVxuICAgICAgICAgICAgICAgICAgICBEb3VibGVSZWN0YW5nbGUob3JpZ2luLCBkaW1lbnNpb25zKVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIG51bGxcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDIwLiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgTUlUIGxpY2Vuc2UgdGhhdCBjYW4gYmUgZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZS5cbiAq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bmVzSGVscGVyKHBvcywgY29vcmQsIGN0eClcbiAgICAgICAgdmFsIGRhdGFQb2ludHMgPSBkYXRhUG9pbnRzKGFlc3RoZXRpY3MpXG4gICAgICAgIHZhbCBnZW9tSGVscGVyID0gR2VvbUhlbHBlcihwb3MsIGNvb3JkLCBjdHgpXG5cbiAgICAgICAgZm9yIChwIGluIGRhdGFQb2ludHMpIHtcbiAgICAgICAgICAgIHZhbCB4ID0gcC54KClcbiAgICAgICAgICAgIHZhbCB5bWluID0gcC55bWluKClcbiAgICAgICAgICAgIHZhbCB5bWF4ID0gcC55bWF4KClcbiAgICAgICAgICAgIGlmICghU2VyaWVzVXRpbC5hbGxGaW5pdGUoeCwgeW1pbiwgeW1heCkpIHtcbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFyIHdpZHRoID0gcC53aWR0aCgpISFcbiAgICAgICAgICAgIHdpZHRoICo9IGN0eC5nZXRSZXNvbHV0aW9uKEFlcy5YKVxuICAgICAgICAgICAgdmFsIGhlaWdodCA9IHltYXghISAtIHltaW4hIVxuXG4gICAgICAgICAgICB2YWwgciA9IERvdWJsZVJlY3RhbmdsZSh4ISEgLSB3aWR0aCAvIDIsIHltaW4sIHdpZHRoLCBoZWlnaHQpXG5cbiAgICAgICAgICAgIHZhbCBnID0gZXJyb3JCYXJTaGFwZShcbiAgICAgICAgICAgICAgICBoZWxwZXIudG9DbGllbnQoXG4gICAgICAgICAgICAgICAgICAgIHIsXG4gICAgICAgICAgICAgICAgICAgIHBcbiAgICAgICAgICAgICAgICApLCBwXG4gICAgICAgICAgICApXG4gICAgICAgICAgICByb290LmFkZChnKVxuXG4gICAgICAgICAgICBidWlsZEhpbnRzKFxuICAgICAgICAgICAgICAgIERvdWJsZVJlY3RhbmdsZShyLmxlZnQsIHIuY2VudGVyLnksIHIud2lkdGgsIDAuMCksXG4gICAgICAgICAgICAgICAgcCxcbiAgICAgICAgICAgICAgICBjdHgsXG4gICAgICAgICAgICAgICAgZ2VvbUhlbHBlclxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gYnVpbGRIaW50cyhyZWN0OiBEb3VibGVSZWN0YW5nbGUsIHA6IERhdGFQb2ludEFlc3RoZXRpY3MsIGN0eDogR2VvbUNvbnRleHQsIGdlb21IZWxwZXI6IEdlb21IZWxwZXIpIHtcbiAgICAgICAgdmFsIGNsaWVudFJlY3QgPSBnZW9tSGVscGVyLnRvQ2xpZW50KHJlY3QsIHApXG5cbiAgICAgICAgdmFsIGhpbnQgPSBIaW50Q29uZmlnRmFjdG9yeSgpXG4gICAgICAgICAgICAuZGVmYXVsdE9iamVjdFJhZGl1cyhjbGllbnRSZWN0LndpZHRoIC8gMi4wKVxuICAgICAgICAgICAgLmRlZmF1bHRYKHAueCgpISEpXG4gICAgICAgICAgICAuZGVmYXVsdEtpbmQoSE9SSVpPTlRBTF9UT09MVElQKVxuXG4gICAgICAgIHZhbCBoaW50cyA9IEhpbnRzQ29sbGVjdGlvbihwLCBnZW9tSGVscGVyKVxuICAgICAgICAgICAgLmFkZEhpbnQoaGludC5jcmVhdGUoQWVzLllNQVgpKVxuICAgICAgICAgICAgLmFkZEhpbnQoaGludC5jcmVhdGUoQWVzLllNSU4pKVxuICAgICAgICAgICAgLmhpbnRzXG5cbiAgICAgICAgY3R4LnRhcmdldENvbGxlY3Rvci5hZGRSZWN0YW5nbGUoXG4gICAgICAgICAgICBwLmluZGV4KCksIGNsaWVudFJlY3QsXG4gICAgICAgICAgICBwYXJhbXMoKVxuICAgICAgICAgICAgICAgIC5zZXRUaXBMYXlvdXRIaW50cyhoaW50cylcbiAgICAgICAgICAgICAgICAuc2V0Q29sb3IoZnJvbUNvbG9yKHApKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBjbGFzcyBNeUxlZ2VuZEtleUVsZW1lbnRGYWN0b3J5IDpcbiAgICAgICAgTGVnZW5kS2V5RWxlbWVudEZhY3Rvcnkge1xuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVLZXlFbGVtZW50KHA6IERhdGFQb2ludEFlc3RoZXRpY3MsIHNpemU6IERvdWJsZVZlY3Rvcik6IFN2Z0dFbGVtZW50IHtcbiAgICAgICAgICAgIHZhbCBzdHJva2VXaWR0aCA9IEFlc1NjYWxpbmcuc3Ryb2tlV2lkdGgocClcblxuICAgICAgICAgICAgdmFsIHdpZHRoID0gcC53aWR0aCgpISEgKiAoc2l6ZS54IC0gc3Ryb2tlV2lkdGgpXG4gICAgICAgICAgICB2YWwgaGVpZ2h0ID0gc2l6ZS55IC0gc3Ryb2tlV2lkdGhcbiAgICAgICAgICAgIHZhbCB4ID0gKHNpemUueCAtIHdpZHRoKSAvIDJcbiAgICAgICAgICAgIHZhbCB5ID0gc3Ryb2tlV2lkdGggLyAyXG4gICAgICAgICAgICByZXR1cm4gZXJyb3JCYXJTaGFwZShcbiAgICAgICAgICAgICAgICBEb3VibGVSZWN0YW5nbGUoXG4gICAgICAgICAgICAgICAgICAgIHgsXG4gICAgICAgICAgICAgICAgICAgIHksXG4gICAgICAgICAgICAgICAgICAgIHdpZHRoLFxuICAgICAgICAgICAgICAgICAgICBoZWlnaHRcbiAgICAgICAgICAgICAgICApLCBwXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgY29uc3QgdmFsIEhBTkRMRVNfR1JPVVBTID0gZmFsc2VcblxuICAgICAgICBwcml2YXRlIGZ1biBlcnJvckJhclNoYXBlKHI6IERvdWJsZVJlY3RhbmdsZSwgcDogRGF0YVBvaW50QWVzdGhldGljcyk6IFN2Z0dFbGVtZW50IHtcbiAgICAgICAgICAgIHZhbCBsZWZ0ID0gci5sZWZ0XG4gICAgICAgICAgICB2YWwgdG9wID0gci50b3BcbiAgICAgICAgICAgIHZhbCByaWdodCA9IHIucmlnaHRcbiAgICAg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ogU3ZnUm9vdCxcbiAgICAgICAgYWVzdGhldGljczogQWVzdGhldGljcyxcbiAgICAgICAgcG9zOiBQb3NpdGlvbkFkanVzdG1lbnQsXG4gICAgICAgIGNvb3JkOiBDb29yZGluYXRlU3lzdGVtLFxuICAgICAgICBjdHg6IEdlb21Db250ZXh0XG4gICAgKVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGZ1biB3cmFwKHNsaW1Hcm91cDogU3ZnU2xpbUdyb3VwKTogU3ZnR0VsZW1lbnQge1xuICAgICAgICAgICAgdmFsIGcgPSBTdmdHRWxlbWVudCgpXG4gICAgICAgICAgICBnLmlzUHJlYnVpbHRTdWJ0cmVlID0gdHJ1ZVxuICAgICAgICAgICAgZy5jaGlsZHJlbigpLmFkZChzbGltR3JvdXAuYXNEdW1teVN2Z05vZGUoKSlcbiAgICAgICAgICAgIHJldHVybiBnXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gd3JhcChvOiBTdmdTbGltT2JqZWN0KTogU3ZnR0VsZW1lbnQge1xuICAgICAgICAgICAgdmFsIHNsaW1Hcm91cCA9IFN2Z1NsaW1FbGVtZW50cy5nKDEpXG4gICAgICAgICAgICBvLmFwcGVuZFRvKHNsaW1Hcm91cClcbiAgICAgICAgICAgIHJldHVybiB3cmFwKHNsaW1Hcm91cClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBhZXNWaWV3UG9ydChhZXN0aGV0aWNzOiBBZXN0aGV0aWNzKTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgICAgIHJldHVybiByZWN0KFxuICAgICAgICAgICAgICAgIGFlc3RoZXRpY3Mub3ZlcmFsbFJhbmdlKEFlcy5YKSxcbiAgICAgICAgICAgICAgICBhZXN0aGV0aWNzLm92ZXJhbGxSYW5nZShBZXMuWSlcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBhZXNCb3VuZGluZ0JveChhZXN0aGV0aWNzOiBBZXN0a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GlmIChTZXJpZXNVdGlsLmlzRmluaXRlKGludGVyY2VwdCkpIHtcbiAgICAgICAgICAgICAgICBpZiAodmlld1BvcnQueVJhbmdlKCkuY29udGFpbnMoaW50ZXJjZXB0ISEpKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBzdGFydCA9IERvdWJsZVZlY3Rvcih2aWV3UG9ydC5sZWZ0LCBpbnRlcmNlcHQpXG4gICAgICAgICAgICAgICAgICAgIHZhbCBlbmQgPSBEb3VibGVWZWN0b3Iodmlld1BvcnQucmlnaHQsIGludGVyY2VwdClcbiAgICAgICAgICAgICAgICAgICAgdmFsIGxpbmUgPSBoZWxwZXIuY3JlYXRlTGluZShzdGFydCwgZW5kLCBwKVxuICAgICAgICAgICAgICAgICAgICBsaW5lcy5hZGQobGluZSlcblxuICAgICAgICAgICAgICAgICAgICB2YWwgaCA9IEFlc1NjYWxpbmcuc3Ryb2tlV2lkdGgocClcbiAgICAgICAgICAgICAgICAgICAgdmFsIG9yaWdpbiA9IERvdWJsZVZlY3RvcihzdGFydC54LCBpbnRlcmNlcHQgLSBoLzIgLSAyLjApXG4gICAgICAgICAgICAgICAgICAgIHZhbCBkaW1lbnNpb25zID0gRG91YmxlVmVjdG9yKHZpZXdQb3J0LmRpbWVuc2lvbi54LCBoICsgNC4wKVxuICAgICAgICAgICAgICAgICAgICB2YWwgcmVjdCA9IERvdWJsZVJlY3RhbmdsZShvcmlnaW4sIGRpbWVuc2lvbnMpXG4gICAgICAgICAgICAgICAgICAgIGN0eC50YXJnZXRDb2xsZWN0b3IuYWRkUmVjdGFuZ2xlKFxuICAgICAgICAgICAgICAgICAgICAgICAgcC5pbmRleCgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2VvbUhlbHBlci50b0NsaWVudChyZWN0LCBwKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIEdlb21UYXJnZXRDb2xsZWN0b3IuVG9vbHRpcFBhcmFtcy5wYXJhbXMoKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRDb2xvcihIaW50Q29sb3JVdGlsLmZyb21Db2xvcihwKSksXG4gICAgICAgICAgICAgICAgICAgICAgICBUaXBMYXlvdXRIaW50LktpbmQuQ1VSU09SX1RPT0xUSVBcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGxpbmVzLmZvckVhY2ggeyByb290LmFkZChpdCkgfVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBjb25zdCB2YWwgSEFORExFU19HUk9VUFMgPSBmYWxzZVxuXG4gICAgICAgIHZhbCBMRUdFTkRfS0VZX0VMRU1FTlRfRkFDVE9SWTogTGVnZW5kS2V5RWxlbWVudEZhY3RvcnkgPVxuICAgICAgICAgICAgSExpbmVMZWdlbmRLZXlFbGVtZW50RmFjdG9yeSgpXG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5iYXNlLmdlb21cblxuY2xhc3MgSGlzdG9ncmFtR2VvbSA6IEJhckdlb20oKSB7XG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4vLyAgICAgICAgdmFsIFJFTkRFUlMgPSBsaXN0T2YoXG4vLyAgICAgICAgICAgICAgICBBZXMuWCxcbi8vICAgICAgICAgICAgICAgIEFlcy5ZLFxuLy8gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuLy8gICAgICAgICAgICAgICAgQWVzLkZJTEwsXG4vLyAgICAgICAgICAgICAgICBBZXMuQUxQSEEsXG4vLyAg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50Lm9yaWdpbi54LCBib3VuZHNDbGllbnQub3JpZ2luLnksXG4gICAgICAgICAgICBib3VuZHNDbGllbnQuZGltZW5zaW9uLngsIGJvdW5kc0NsaWVudC5kaW1lbnNpb24ueVxuICAgICAgICApXG4gICAgICAgIHN2Z0ltYWdlRWxlbWVudC5ocmVmKCkuc2V0KGltYWdlVXJsKVxuICAgICAgICByb290LmFkZChzdmdJbWFnZUVsZW1lbnQpXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4vLyAgICAgICAgdmFsIFJFTkRFUlMgPSBsaXN0T2YoXG4vLyAgICAgICAgICAgICAgICBBZXMuWE1JTixcbi8vICAgICAgICAgICAgICAgIEFlcy5YTUFYLFxuLy8gICAgICAgICAgICAgICAgQWVzLllNSU4sXG4vLyAgICAgICAgICAgICAgICBBZXMuWU1BWFxuLy8gICAgICAgIClcblxuICAgICAgICBjb25zdCB2YWwgSEFORExFU19HUk9VUFMgPSBmYWxzZVxuICAgIH1cbn1cblxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5iYXNlLmdlb21cblxuY2xhc3MgSml0dGVyR2VvbSA6IFBvaW50R2VvbSgpIHtcbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbi8vICAgICAgICB2YWwgUkVOREVSUzogTGlzdDxBZXM8Kj4+ID0gUG9pbnRHZW9tLlJFTkRFUlNcblxuICAgICAgICBjb25zdCB2YWwgSEFORExFU19HUk9VUFMgPVxuICAgICAgICAgICAgUG9pbnRHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgfVxufVxuIiwiLypcbiAqI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X0tFWV9FTEVNRU5UX0ZBQ1RPUllcblxuICAgIG92ZXJyaWRlIGZ1biBidWlsZEludGVybihcbiAgICAgICAgcm9vdDogU3ZnUm9vdCxcbiAgICAgICAgYWVzdGhldGljczogQWVzdGhldGljcyxcbiAgICAgICAgcG9zOiBQb3NpdGlvbkFkanVzdG1lbnQsXG4gICAgICAgIGNvb3JkOiBDb29yZGluYXRlU3lzdGVtLFxuICAgICAgICBjdHg6IEdlb21Db250ZXh0XG4gICAgKSB7XG4gICAgICAgIHZhbCBnZW9tSGVscGVyID0gR2VvbUhlbHBlcihwb3MsIGNvb3JkLCBjdHgpXG4gICAgICAgIHZhbCBoZWxwZXIgPSBnZW9tSGVscGVyLmNyZWF0ZVN2Z0VsZW1lbnRIZWxwZXIoKVxuXG4gICAgICAgIGZvciAocCBpbiBHZW9tVXRpbC53aXRoRGVmaW5lZChhZXN0aGV0aWNzLmRhdGFQb2ludHMoKSwgQWVzLlgsIEFlcy5ZTUlOLCBBZXMuWU1BWCkpIHtcbiAgICAgICAgICAgIHZhbCB4ID0gcC54KCkhIVxuICAgICAgICAgICAgdmFsIHltaW4gPSBwLnltaW4oKSEhXG4gICAgICAgICAgICB2YWwgeW1heCA9IHAueW1heCgpISFcblxuICAgICAgICAgICAgdmFsIHN0YXJ0ID0gRG91YmxlVmVjdG9yKHgsIHltaW4pXG4gICAgICAgICAgICB2YWwgZW5kID0gRG91YmxlVmVjdG9yKHgsIHltYXgpXG4gICAgICAgICAgICB2YWwgbGluZSA9IGhlbHBlci5jcmVhdGVMaW5lKHN0YXJ0LCBlbmQsIHApXG4gICAgICAgICAgICByb290LmFkZChsaW5lKVxuICAgICAgICB9XG5cbiAgICAgICAgQmFyVG9vbHRpcEhlbHBlci5jb2xsZWN0UmVjdGFuZ2xlVGFyZ2V0cyhcbiAgICAgICAgICAgIGxpc3RPZihBZXMuWU1BWCwgQWVzLllNSU4pLFxuICAgICAgICAgICAgYWVzdGhldGljcywgcG9zLCBjb29yZCwgY3R4LFxuICAgICAgICAgICAgcmVjdGFuZ2xlQnlEYXRhUG9pbnQoKSxcbiAgICAgICAgICAgIHsgSGludENvbG9yVXRpbC5mcm9tQ29sb3IoaXQpIH1cbiAgICAgICAgKVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBjb25zdCB2YWwgSEFORExFU19HUk9VUFMgPSBmYWxzZVxuXG4gICAgICAgIGZ1biByZWN0YW5nbGVCeURhdGFQb2ludCgpOiAoRGF0YVBvaW50QWVzdGhldGljcykgLT4gRG91YmxlUmVjdGFuZ2xlPyB7XG4gICAgICAgICAgICByZXR1cm4geyBwIC0+XG4gICAgICAgICAgICAgICAgaWYgKHAuZGVmaW5lZChBZXMuWCkgJiZcbiAgICAgICAgICAgICAgICAgICAgcC5kZWZpbmVkKEFlcy5ZTUlOKSAmJlxuICAgICAgICAgICAgICAgICAgICBwLmRlZmluZWQoQWVzLllNQVgpXG4gICAgICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCB4ID0gcC54KCkhIVxuICAgICAgICAgICAgICAgICAgICB2YWwgeW1pbiA9IHAueW1pbigpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIHltYXggPSBwLnltYXgoKSEhXG4gICAgICAgICAgICAgICAgICAgIHZhbCB3aWR0aCA9IG1heChBZXNTY2FsaW5nLnN0cm9rZVdpZHRoKHApLCAyLjApICogMi4wXG4gICAgICAgICAgICAgICAgICAgIHZhbCBoZWlnaHQgPSB5bWF4IC0geW1pblxuXG4gICAgICAgICAgICAgICAgICAgIHZhbCBvcmlnaW4gPSBEb3VibGVWZWN0b3IoeCAtIHdpZHRoIC8gMiwgeW1heCAtIGhlaWdodCAvIDIpXG4gICAgICAgICAgICAgICAgICAgIHZhbCBkaW1lbnNpb25zID0gRG91YmxlVmVjdG9yKHdpZHRoLCAwLjAgKVxuICAgICAgICAgICAgICAgICAgICBEb3VibGVSZWN0YW5nbGUob3JpZ2luLCBkaW1lbn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ICAgICBnZW9tQ29uc3RydWN0b3IuY29uc3RydWN0KHdpdGhIaW50cyA9IGZhbHNlKSxcbiAgICAgICAgICAgIHJvb3RcbiAgICAgICAgKVxuICAgICAgICBidWlsZEhpbnRzKGFlc3RoZXRpY3MsIGNvb3JkLCBsaW5lc0hlbHBlciwgdGFyZ2V0Q29sbGVjdG9yKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGJ1aWxkSGludHMoXG4gICAgICAgIGFlc3RoZXRpY3M6IEFlc3RoZXRpY3MsXG4gICAgICAgIGNvb3JkOiBDb29yZGluYXRlU3lzdGVtLFxuICAgICAgICBsaW5lc0hlbHBlcjogTGluZXNIZWxwZXIsXG4gICAgICAgIHRhcmdldENvbGxlY3RvcjogR2VvbVRhcmdldENvbGxlY3RvclxuICAgICkge1xuICAgICAgICB2YWwgZGF0YVBvaW50cyA9IGRhdGFQb2ludHMoYWVzdGhldGljcykuZmlsdGVyIHsgcCAtPlxuICAgICAgICAgICAgdmFsIHggPSBwLngoKVxuICAgICAgICAgICAgdmFsIHkgPSBwLnkoKVxuICAgICAgICAgICAgU2VyaWVzVXRpbC5hbGxGaW5pdGUoeCwgeSkgJiYgY29vcmQuaXNQb2ludEluTGltaXRzKERvdWJsZVZlY3Rvcih4ISEseSEhKSwgaXNDbGllbnQgPSBmYWxzZSlcbiAgICAgICAgfVxuXG4gICAgICAgIExpbmVQYXRoQ29uc3RydWN0b3IoXG4gICAgICAgICAgICB0YXJnZXRDb2xsZWN0b3IsXG4gICAgICAgICAgICBkYXRhUG9pbnRzLFxuICAgICAgICAgICAgbGluZXNIZWxwZXIsXG4gICAgICAgICAgICBmYWxzZVxuICAgICAgICApLmJ1aWxkSGludHMoKVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBjb25zdCB2YWwgSEFORExFU19HUk9VUFMgPSB0cnVlXG4gICAgfVxuXG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDIwLiBKZXR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W5nbGUpKVxuICAgICAgICAgICAgICAgIGJ1aWxkZXIuZWxsaXB0aWNhbEFyYyhyYWRpdXMsIHJhZGl1cywgMC4wLCAtYW5nbGUgPiBQSSwgZmFsc2UsIGFyY1RvKVxuICAgICAgICAgICAgICAgIGJ1aWxkZXIuY2xvc2VQYXRoKClcblxuICAgICAgICAgICAgICAgIGN1ckFuZ2xlICs9IGFuZ2xlXG5cbiAgICAgICAgICAgICAgICB2YWwgcGF0aCA9IExpbmVQYXRoKGJ1aWxkZXIpXG4gICAgICAgICAgICAgICAgZGVjb3JhdGUocGF0aCwgcCwgdHJ1ZSlcbiAgICAgICAgICAgICAgICByZXN1bHQuYWRkKHBhdGgpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiByZXN1bHRcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICB2YWwgUkVOREVSUyA9IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWCwgLy8gb3B0aW9uYWwsIGNhbiBzcGVjaWZ5IG9yZGVyIG9mIHNlZ21lbnRzIGluIHBpZVxuICAgICAgICAgICAgICAgIEFlcy5ZLCAvLyBhbmdsZSB3aWR0aCBvZiBzZWdtZW50c1xuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuRklMTCxcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEEsXG4gICAgICAgICAgICAgICAgQWVzLldJRFRILFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFXG4gICAgICAgIClcblxuICAgICAgICBjb25zdCB2YWwgSEFORExFU19HUk9VUFMgPSBmYWxzZVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGRhdGFQb2ludHMoYWVzdGhldGljczogQWVzdGhldGljcyk6IEl0ZXJhYmxlPERhdGFQb2ludEFlc3RoZXRpY3M+IHtcbiAgICAgICAgICAgIHZhbCB3aXRoWCA9IEdlb21VdGlsLndpdGhfWF9ZKGFlc3RoZXRpY3MuZGF0YVBvaW50cygpKVxuICAgICAgICAgICAgcmV0dXJuIGlmIChJdGVyYWJsZXMuaXNFbXB0eSh3aXRoWCkgfHwgYWxsRXF1YWxYKFxuICAgICAgICAgICAgICAgICAgICB3aXRoWCxcbiAgICAgICAgICAgICAgICAgICAgZ2V0KHdpdGhYLCAwKS54KClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICBHZW9tVXRpbC5vcmRlcmVkX1koR2VvbVV0aWwud2l0aF9ZKGFlc3RoZXRpY3MuZGF0YVBvaW50cygpKSwgdHJ1ZSlcbiAgICAgICAgICAgIH0gZWxzZSBHZW9tVXRpbC5vcmRlcmVkX1god2l0aFgpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBhbGxFcXVhbFgoaGFzWDogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz4sIGB2YWxgOiBEb3VibGU/KTogQm9vbGVhbiB7XG4gICAgICAgICAgICBmb3IgKHAgaW4gaGFzWCkge1xuICAgICAgICAgICAgICAgIGlmIChwLngoKSAhPSBgdmFsYCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2VcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdHJ1ZVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gc2hhcmVUb1JhZChzaGFyZTogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgICAgIC8vIGRvbid0IGFsbG93IHN1bSB0byBiZSBtb3JlIHRoYW4gOTkuOTkgJSBvZiBmdWxsIGNpcmNsZSAob3RoZXJ3aXNlIGFyYyB3aWxsIGRpc2FwcGVhcilcbiAgICAgICAgICAgIHJldHVybiAwLjk5OTkgKiAyLjAgKiBQSSAqIHNoYXJlXG4gICAgICAgIH1cbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2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WVudEhlbHBlcigpXG5cbiAgICAgICAgZm9yIChwIGluIEdlb21VdGlsLndpdGhEZWZpbmVkKGFlc3RoZXRpY3MuZGF0YVBvaW50cygpLCBBZXMuWCwgQWVzLlksIEFlcy5ZTUlOLCBBZXMuWU1BWCkpIHtcbiAgICAgICAgICAgIHZhbCB4ID0gcC54KCkhIVxuICAgICAgICAgICAgdmFsIHkgPSBwLnkoKSEhXG4gICAgICAgICAgICB2YWwgeW1pbiA9IHAueW1pbigpISFcbiAgICAgICAgICAgIHZhbCB5bWF4ID0gcC55bWF4KCkhIVxuXG4gICAgICAgICAgICAvLyB2ZXJ0aWNhbCBsaW5lXG4gICAgICAgICAgICB2YWwgc3RhcnQgPSBEb3VibGVWZWN0b3IoeCwgeW1pbilcbiAgICAgICAgICAgIHZhbCBlbmQgPSBEb3VibGVWZWN0b3IoeCwgeW1heClcbiAgICAgICAgICAgIHZhbCBsaW5lID0gaGVscGVyLmNyZWF0ZUxpbmUoc3RhcnQsIGVuZCwgcClcbiAgICAgICAgICAgIHJvb3QuYWRkKGxpbmUpXG5cbiAgICAgICAgICAgIC8vIG1pZC1wb2ludFxuICAgICAgICAgICAgdmFsIGxvY2F0aW9uID0gZ2VvbUhlbHBlci50b0NsaWVudChEb3VibGVWZWN0b3IoeCwgeSksIHApXG4gICAgICAgICAgICB2YWwgc2hhcGUgPSBwLnNoYXBlKCkhIVxuICAgICAgICAgICAgdmFsIG8gPSBQb2ludFNoYXBlU3ZnLmNyZWF0ZShzaGFwZSwgbG9jYXRpb24sIHAsIGZhdHRlbk1pZFBvaW50KVxuICAgICAgICAgICAgcm9vdC5hZGQod3JhcChvKSlcbi8vICAgICAgICAgICAgY3R4LnRhcmdldENvbGxlY3Rvci5hZGRQb2ludChcbi8vICAgICAgICAgICAgICAgIHAuaW5kZXgoKSxcbi8vICAgICAgICAgICAgICAgIGxvY2F0aW9uLFxuLy8gICAgICAgICAgICAgICAgc2hhcGUuc2l6ZShwKSAqIGZhdHRlbk1pZGxpbmUgLyAyLFxuLy8gICAgICAgICAgICAgICAgUG9pbnRHZW9tLnRvb2x0aXBQYXJhbXMocClcbi8vICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgQmFyVG9vbHRpcEhlbHBlci5jb2xsZWN0UmVjdGFuZ2xlVGFyZ2V0cyhcbiAgICAgICAgICAgIGxpc3RPZihBZXMuWU1BWCwgQWVzLllNSU4pLFxuICAgICAgICAgICAgYWVzdGhldGljcywgcG9zLCBjb29yZCwgY3R4LFxuICAgICAgICAgICAgcmVjdGFuZ2xlQnlEYXRhUG9pbnQoZmF0dGVuTWlkUG9pbnQpLFxuICAgICAgICAgICAgeyBIaW50Q29sb3JVdGlsLmZyb21Db2xvcihpdCkgfVxuICAgICAgICApXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGNvbnN0IHZhbCBIQU5ETEVTX0dST1VQUyA9IGZhbHNlXG5cbiAgICAgICAgY29uc3QgdmFsIERFRl9GQVRURU4gPSA1LjBcblxuICAgICAgICBmdW4gcmVjdGFuZ2xlQnlEYXRhUG9pbnQoZmF0dGVuOiBEb3VibGUpOiAoRGF0YVBvaW50QWVzdGhldGljcykgLT4gRG91YmxlUmVjdGFuZ2xlPyB7XG4gICAgICAgICAgICByZXR1cm4geyBwIC0+XG4gICAgICAgICAgICAgICAgaWYgKHAuZGVmaW5lZChBZXMuWCkgJiZcbiAgICAgICAgICAgICAgICAgICAgcC5kZWZpbmVkKEFlcy5ZKVxuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgeCA9IHAueCgpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIHkgPSBwLnkoKSEhXG5cbiAgICAgICAgICAgICAgICAgICAgdmFsIHNoYXBlID0gcC5zaGFwZSgpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIHNoYXBlU2l6ZSA9IHNoYXBlLnNpemUocCkgKiBmYXR0ZW5cbiAgICAgICAgICAg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W91ciBpbWFnaW5nIGRldmljZVwiKVxuICAgICAgICAgICAgdmFsIGZvbnRTaXplID0gMTIuMFxuICAgICAgICAgICAgdmFsIGxpbmVIZWlnaHQgPSBmb250U2l6ZSArIDRcbiAgICAgICAgICAgIHZhciB5ID0gY2VudGVyLnkgKyBsaW5lSGVpZ2h0ICogbGluZXMuc2l6ZSAvIDIuMFxuICAgICAgICAgICAgZm9yIChsaW5lIGluIGxpbmVzKSB7XG4gICAgICAgICAgICAgICAgdmFsIGxhYmVsID0gVGV4dExhYmVsKGxpbmUpXG4gICAgICAgICAgICAgICAgbGFiZWwudGV4dENvbG9yKCkuc2V0KENvbG9yLkRBUktfTUFHRU5UQSlcbiAgICAgICAgICAgICAgICBsYWJlbC50ZXh0T3BhY2l0eSgpLnNldCgwLjUpXG4gICAgICAgICAgICAgICAgbGFiZWwuc2V0Rm9udFNpemUoZm9udFNpemUpXG4gICAgICAgICAgICAgICAgbGFiZWwuc2V0Rm9udFdlaWdodChcImJvbGRcIilcbiAgICAgICAgICAgICAgICBsYWJlbC5zZXRIb3Jpem9udGFsQW5jaG9yKEhvcml6b250YWxBbmNob3IuTUlERExFKVxuICAgICAgICAgICAgICAgIGxhYmVsLnNldFZlcnRpY2FsQW5jaG9yKFZlcnRpY2FsQW5jaG9yLkNFTlRFUilcbiAgICAgICAgICAgICAgICB2YWwgbG9jID0gaGVscGVyLnRvQ2xpZW50KGNlbnRlci54LCB5LCByYW5kb21QKVxuICAgICAgICAgICAgICAgIGxhYmVsLm1vdmVUbyhsb2MpXG4gICAgICAgICAgICAgICAgcm9vdC5hZGQobGFiZWwucm9vdEdyb3VwKVxuICAgICAgICAgICAgICAgIHkgLT0gbGluZUhlaWdodFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm5cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBjb2xzID0gcm91bmQod2lkdGgpLnRvSW50KClcbiAgICAgICAgdmFsIHJvd3MgPSByb3VuZChoZWlnaHQpL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2xvciA9IHAuZmlsbCgpXG5cbiAgICAgICAgICAgIHZhciBjb2wgPSByb3VuZCgoeCEhIC0geDApIC8gc3RlcFgpLnRvSW50KClcbiAgICAgICAgICAgIHZhciByb3cgPSByb3VuZCgoeSEhIC0geTApIC8gc3RlcFkpLnRvSW50KClcblxuICAgICAgICAgICAgaWYgKGludmVydGVkWCkge1xuICAgICAgICAgICAgICAgIGNvbCA9IGNvbHMgLSAoY29sICsgMSlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGludmVydGVkWSkge1xuICAgICAgICAgICAgICAgIHJvdyA9IHJvd3MgLSAocm93ICsgMSlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgYXJnYlZhbHVlc1tyb3cgKiBjb2xzICsgY29sXSA9IFN2Z1V0aWxzLnRvQVJHQihjb2xvciEhLCBhbHBoYSEhKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGJpdG1hcCA9IEJpdG1hcChjb2xzLCByb3dzLCBhcmdiVmFsdWVzKVxuICAgICAgICB2YWwgc3ZnSW1hZ2VFbGVtZW50ID0gU3ZnSW1hZ2VFbGVtZW50RXgoXG4gICAgICAgICAgICBtaW4oY29ybmVyMC54LCBjb3JuZXIyLngpLCBtaW4oY29ybmVyMC55LCBjb3JuZXIyLnkpLFxuICAgICAgICAgICAgYWJzKGNvcm5lcjAueCAtIGNvcm5lcjIueCksIGFicyhjb3JuZXIwLnkgLSBjb3JuZXIyLnkpLFxuICAgICAgICAgICAgYml0bWFwXG4gICAgICAgIClcbiAgICAgICAgcm9vdC5hZGQoc3ZnSW1hZ2VFbGVtZW50KVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuLy8gICAgICAgIHZhbCBSRU5ERVJTID0gbGlzdE9mKFxuLy8gICAgICAgICAgICAgICAgQWVzLlgsXG4vLyAgICAgICAgICAgICAgICBBZXMuWSxcbi8vICAgICAgICAgICAgICAgIEFlcy5XSURUSCwgLy8gbm90IHJlb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ICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuLy8gICAgICAgIHZhbCBSRU5ERVJTID0gbGlzdE9mKFxuLy8gICAgICAgICAgICAgICAgQWVzLlhNSU4sXG4vLyAgICAgICAgICAgICAgICBBZXMuWE1BWCxcbi8vICAgICAgICAgICAgICAgIEFlcy5ZTUlOLFxuLy8gICAgICAgICAgICAgICAgQWVzLllNQVgsXG4vLyAgICAgICAgICAgICAgICBBZXMuU0laRSxcbi8vICAgICAgICAgICAgICAgIEFlcy5MSU5FVFlQRSxcbi8vICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbi8vICAgICAgICAgICAgICAgIEFlcy5GSUxMLFxuLy8gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuLy8gICAgICAgIClcbiAgICAgICAgLy9yZWN0YW5nbGUgZ3JvdXBzIGFyZSB1c2VkIGluIGdlb21fbGl2ZW1hcFxuICAgICAgICBjb25zdCB2YWwgSEFORExFU19HUk9VUFMgPSB0cnVlXG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gcmVjdGFuZ2xlQnlEYXRhUG9pbnQocDogRGF0YVBvaW50QWVzdGhldGljcyk6IERvdWJsZVJlY3RhbmdsZT8ge1xuICAgICAgICAgICAgdmFsIHhtaW4gPSBwLnhtaW4oKVxuICAgICAgICAgICAgdmFsIHhtYXggPSBwLnhtYXgoKVxuICAgICAgICAgICAgdmFsIHltaW4gPSBwLnltaW4oKVxuICAgICAgICAgICAgdmFsIHltYXggPSBwLnltYXgoKVxuICAgICAgICAgICAgcmV0dXJuIGlmIChTZXJpZXNVdGlsLmFsbEZpbml0ZSh4bWluLCB4bWF4LCB5bWluLCB5bWF4KSkge1xuICAgICAgICAgICAgICAgIERvdWJsZVJlY3RhbmdsZS5zcGFuKERvdWJsZVZlY3Rvcih4bWluISEsIHltaW4hISksIERvdWJsZVZlY3Rvcih4bWF4ISEsIHltYXghISkpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgIC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lVmVjdG9yPyxcbiAgICAgICAgaGVscGVyOiBHZW9tSGVscGVyXG4gICAgKSB7XG4gICAgICAgIHZhbCBjb29yZCA9IHRvTG9jYXRpb24ocClcbiAgICAgICAgaWYgKGNvb3JkICE9IG51bGwpIHtcbiAgICAgICAgICAgIHZhbCBoaW50ID0gSGludHNDb2xsZWN0aW9uLkhpbnRDb25maWdGYWN0b3J5KClcbiAgICAgICAgICAgICAgICAuZGVmYXVsdE9iamVjdFJhZGl1cygwLjApXG4gICAgICAgICAgICAgICAgLmRlZmF1bHRYKHAueCgpISEpXG4gICAgICAgICAgICAgICAgLmRlZmF1bHRLaW5kKFRpcExheW91dEhpbnQuS2luZC5IT1JJWk9OVEFMX1RPT0xUSVApXG4gICAgICAgICAgICAgICAgLmRlZmF1bHRDb2xvcihcbiAgICAgICAgICAgICAgICAgICAgcC5maWxsKCkhISxcbiAgICAgICAgICAgICAgICAgICAgYWxwaGEgPSBudWxsXG4gICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICB2YWwgaGludHNDb2xsZWN0aW9uID0gSGludHNDb2xsZWN0aW9uKHAsIGhlbHBlcilcbiAgICAgICAgICAgICAgICAuYWRkSGludChoaW50LmNyZWF0ZShBZXMuWU1BWCkpXG4gICAgICAgICAgICAgICAgLmFkZEhpbnQoaGludC5jcmVhdGUoQWVzLllNSU4pKVxuXG4gICAgICAgICAgICBjb2xsZWN0b3IuYWRkUG9pbnQoXG4gICAgICAgICAgICAgICAgcC5pbmRleCgpLFxuICAgICAgICAgICAgICAgIGhlbHBlci50b0NsaWVudChjb29yZCwgcCksXG4gICAgICAgICAgICAgICAgMC4wLFxuICAgICAgICAgICAgICAgIHBhcmFtcygpLnNldFRpcExheW91dEhpbnRzKGhpbnRzQ29sbGVjdGlvbi5oaW50cylcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuLy8gICAgICAgIHZhbCBSRU5ERVJTID0gbGl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N0bWVudCxcbiAgICAgICAgY29vcmQ6IENvb3JkaW5hdGVTeXN0ZW0sXG4gICAgICAgIGN0eDogR2VvbUNvbnRleHRcbiAgICApIHtcbiAgICAgICAgdmFsIHRhcmdldENvbGxlY3RvciA9IGdldEdlb21UYXJnZXRDb2xsZWN0b3IoY3R4KVxuICAgICAgICB2YWwgaGVscGVyID0gR2VvbUhlbHBlcihwb3MsIGNvb3JkLCBjdHgpXG4gICAgICAgICAgICAuY3JlYXRlU3ZnRWxlbWVudEhlbHBlcigpXG5cbiAgICAgICAgZm9yIChwIGluIGFlc3RoZXRpY3MuZGF0YVBvaW50cygpKSB7XG4gICAgICAgICAgICBpZiAoU2VyaWVzVXRpbC5hbGxGaW5pdGUocC54KCksIHAueSgpLCBwLnhlbmQoKSwgcC55ZW5kKCkpKSB7XG4gICAgICAgICAgICAgICAgdmFsIHN0YXJ0ID0gRG91YmxlVmVjdG9yKHAueCgpISEsIHAueSgpISEpXG4gICAgICAgICAgICAgICAgdmFsIGVuZCA9IERvdWJsZVZlY3RvcihwLnhlbmQoKSEhLCBwLnllbmQoKSEhKVxuICAgICAgICAgICAgICAgIHZhbCBsaW5lID0gaGVscGVyLmNyZWF0ZUxpbmUoc3RhcnQsIGVuZCwgcClcbiAgICAgICAgICAgICAgICByb290LmFkZChsaW5lKVxuXG4gICAgICAgICAgICAgICAgdGFyZ2V0Q29sbGVjdG9yLmFkZFBhdGgoXG4gICAgICAgICAgICAgICAgICAgIGxpc3RPZihjb29yZC50b0NsaWVudChzdGFydCksIGNvb3JkLnRvQ2xpZW50KGVuZCkpLFxuICAgICAgICAgICAgICAgICAgICB7IHAuaW5kZXgoKSB9LFxuICAgICAgICAgICAgICAgICAgICBHZW9tVGFyZ2V0Q29sbGVjdG9yLlRvb2x0aXBQYXJhbXMucGFyYW1zKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRDb2xvcihIaW50Q29sb3JVdGlsLmZyb21Db2xvcihwKSlcbiAgICAgICAgICAgICAgICApXG5cbiAgICAgICAgICAgICAgICBpZiAoYXJyb3dTcGVjICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIGNsaWVudFgxID0gbGluZS54MSgpLmdldCgpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIGNsaWVudFkxID0gbGluZS55MSgpLmdldCgpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIGNsaWVudFgyID0gbGluZS54MigpLmdldCgpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIGNsaWVudFkyID0gbGluZS55MigpLmdldCgpISFcblxuICAgICAgICAgICAgICAgICAgICB2YWwgYWJzY2lzc2EgPSBjbGllbnRYMiAtIGNsaWVudFgxXG4gICAgICAgICAgICAgICAgICAgIHZhbCBvcmRpbmF0ZSA9IGNsaWVudFkyIC0gY2xpZW50WTFcbiAgICAgICAgICAgICAgICAgICAgaWYgKGFic2Npc3NhICE9IDAuMCB8fCBvcmRpbmF0ZSAhPSAwLjApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIENvbXB1dGUgdGhlIGFuZ2xlIHRoYXQgdGhlIHZlY3RvciBkZWZpbmVkIGJ5IHRoaXMgc2VnbWVudCBtYWtlcyB3aXRoIHRoZVxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gWC1heGlzIChyYWRpYW5zKVxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHBvbGFyQW5nbGUgPSBhdGFuMihvcmRpbmF0ZSwgYWJzY2lzc2EpXG5cbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBhcnJvd0FlcyA9IGFycm93U3BlYyEhLnRvQXJyb3dBZXMocClcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhcnJvd1NwZWMhIS5pc09uTGFzdEVuZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBhcnJvdyA9IGFycm93U3BlYyEhLmNyZWF0ZUVsZW1lbnQocG9sYXJBbmdsZSwgY2xpZW50WDIsIGNsaWVudFkyKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlY29yYXRlKGFycm93LCBhcnJvd0FlcylcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByb290LmFkZChhcnJvdylcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhcnJvd1NwZWMhIS5pc09uRmlyc3RFbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWwgYXJyb3cgPSBhcnJvd1NwZWMhIS5jcmVhdGVFbGVtZW50KHBvbGFyQW5nbGUgKyBQSSwgY2xpZW50WDEsIGNsaWVudFkxKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlY29yYXRlKGFycm93LCBhcnJvd0FlcylcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByb290LmFkZChhcnJvdylcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBjb25zdCB2YWwgSEFORExFU19HUk9VUFMgPSBmYWxzZVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjAuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGNhbiBiZSBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlLlxuICovXG5cbnBhY2thZ2UgamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYmFzZS5nZW9tXG5cbmltcG9ydCBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5iYXNlLipcbmltcG9ydCBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5iYXNlLmdlb20udXRpbC5HZW9tSGVscGVyXG5pbX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pXG5cbiAgICAgICAgYnVpbGRIaW50cyhkYXRhUG9pbnRzLCBwb3MsIGNvb3JkLCBjdHgpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gYnVpbGRIaW50cyhcbiAgICAgICAgZGF0YVBvaW50czogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz4sXG4gICAgICAgIHBvczogUG9zaXRpb25BZGp1c3RtZW50LFxuICAgICAgICBjb29yZDogQ29vcmRpbmF0ZVN5c3RlbSxcbiAgICAgICAgY3R4OiBHZW9tQ29udGV4dFxuICAgICkge1xuICAgICAgICB2YWwgaGVscGVyID0gR2VvbUhlbHBlcihwb3MsIGNvb3JkLCBjdHgpXG5cbiAgICAgICAgZm9yIChwIGluIGRhdGFQb2ludHMpIHtcbiAgICAgICAgICAgIHZhbCB4Q29vcmQgPSBwLngoKSEhXG4gICAgICAgICAgICB2YWwgb2JqZWN0UmFkaXVzID0gMC4wXG5cbiAgICAgICAgICAgIHZhbCBoaW50ID0gSGludENvbmZpZ0ZhY3RvcnkoKVxuICAgICAgICAgICAgICAgIC5kZWZhdWx0T2JqZWN0UmFkaXVzKG9iamVjdFJhZGl1cylcbiAgICAgICAgICAgICAgICAuZGVmYXVsdFgoeENvb3JkKVxuICAgICAgICAgICAgICAgIC5kZWZhdWx0S2luZChIT1JJWk9OVEFMX1RPT0xUSVApXG4gICAgICAgICAgICAgICAgLmRlZmF1bHRDb2xvcihcbiAgICAgICAgICAgICAgICAgICAgcC5maWxsKCkhISxcbiAgICAgICAgICAgICAgICAgICAgUFJPUE9SVElPTihwLmFscGhhKCkpXG4gICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICB2YWwgaGludHNDb2xsZWN0aW9uID0gSGludHNDb2xsZWN0aW9uKHAsIGhlbHBlcilcbiAgICAgICAgICAgICAgICAuYWRkSGludChoaW50LmNyZWF0ZShBZXMuWU1BWCkpXG4gICAgICAgICAgICAgICAgLmFkZEhpbnQoaGludC5jcmVhdGUoQWVzLllNSU4pKVxuICAgICAgICAgICAgICAgIC5hZGRIaW50KGhpbnQuY3JlYXRlKEFlcy5ZKS5jb2xvcihwLmNvbG9yKCkhISkpXG5cbiAgICAgICAgICAgIHZhbCBjbGllbnRDb29yZCA9IGhlbHBlci50b0NsaWVudChwLngoKSwgcC55KCksIHApXG4gICAgICAgICAgICBjdHgudGFyZ2V0Q29sbGVjdG9yLmFkZFBvaW50KFxuICAgICAgICAgICAgICAgIHAuaW5kZXgoKSwgY2xpZW50Q29vcmQsIG9iamVjdFJhZGl1cyxcbiAgICAgICAgICAgICAgICBwYXJhbXMoKVxuICAgICAgICAgICAgICAgICAgICAuc2V0VGlwTGF5b3V0SGludHMoaGludHNDb2xsZWN0aW9uLmhpbnRzKVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGNvbnN0IHZhbCBIQU5ETEVTX0dST1VQUyA9IHRydWVcblxuICAgICAgICBwcml2YXRlIHZhbCBQUk9QT1JUSU9OID0geyB2OiBEb3VibGU/IC0+IGlmICh2ID09IG51bGwpIG51bGwgZWxzZSB2IC8gMTAgfVxuICAgICAgICBwcml2YXRlIHZhbCBaRVJPID0geyBfOiBEb3VibGU/IC0+IDAuMCB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5iYXNlLmdlb21cblxuaW1wb3J0IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJhc2UuQWVzdGhldGljc1xuaW1wb3J0IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ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hbGxGaW5pdGUoeCwgeSkgJiYgIVN0cmluZ3MuaXNOdWxsT3JFbXB0eSh0ZXh0KSkge1xuICAgICAgICAgICAgICAgIHZhbCBsYWJlbCA9IFRleHRMYWJlbCh0ZXh0KVxuICAgICAgICAgICAgICAgIEdlb21IZWxwZXIuZGVjb3JhdGUobGFiZWwsIHAsIHNpemVVbml0UmF0aW8pXG5cbiAgICAgICAgICAgICAgICB2YWwgbG9jID0gaGVscGVyLnRvQ2xpZW50KHgsIHksIHApXG4gICAgICAgICAgICAgICAgbGFiZWwubW92ZVRvKGxvYylcbiAgICAgICAgICAgICAgICByb290LmFkZChsYWJlbC5yb290R3JvdXApXG5cbiAgICAgICAgICAgICAgICAvLyBUaGUgZ2VvbV90ZXh0IHRvb2x0aXAgaXMgc2ltaWxhciB0byB0aGUgZ2VvbV90aWxlOlxuICAgICAgICAgICAgICAgIC8vIGl0IGxvb2tzIGJldHRlciB3aGVuIHRoZSB0ZXh0IGlzIG9uIGEgdGlsZSBpbiBjb3JyX3Bsb3QgKGJ1dCB0aGUgY29sb3Igd2lsbCBiZSBkaWZmZXJlbnQgZnJvbSB0aGUgZ2VvbV90aWxlIHRvb2x0aXApXG4gICAgICAgICAgICAgICAgdGFyZ2V0Q29sbGVjdG9yLmFkZFBvaW50KFxuICAgICAgICAgICAgICAgICAgICBwLmluZGV4KCksXG4gICAgICAgICAgICAgICAgICAgIGxvYyxcbiAgICAgICAgICAgICAgICAgICAgc2l6ZVVuaXRSYXRpbyAqIEFlc1NjYWxpbmcudGV4dFNpemUocCkgLyAyLFxuICAgICAgICAgICAgICAgICAgICBHZW9tVGFyZ2V0Q29sbGVjdG9yLlRvb2x0aXBQYXJhbXMucGFyYW1zKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRDb2xvcihIaW50Q29sb3JVdGlsLmZyb21Db2xvcihwKSksXG4gICAgICAgICAgICAgICAgICAgIFRpcExheW91dEhpbnQuS2luZC5DVVJTT1JfVE9PTFRJUFxuICAg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AgICByb290OiBTdmdSb290LFxuICAgICAgICBhZXN0aGV0aWNzOiBBZXN0aGV0aWNzLFxuICAgICAgICBwb3M6IFBvc2l0aW9uQWRqdXN0bWVudCxcbiAgICAgICAgY29vcmQ6IENvb3JkaW5hdGVTeXN0ZW0sXG4gICAgICAgIGN0eDogR2VvbUNvbnRleHRcbiAgICApIHtcbiAgICAgICAgdmFsIGhlbHBlciA9XG4gICAgICAgICAgICBSZWN0YW5nbGVzSGVscGVyKGFlc3RoZXRpY3MsIHBvcywgY29vcmQsIGN0eClcbiAgICAgICAgdmFsIHNsaW1Hcm91cCA9IGhlbHBlci5jcmVhdGVTbGltUmVjdGFuZ2xlcyhcbiAgICAgICAgICAgIHJlY3RhbmdsZUJ5RGF0YVBvaW50KGN0eClcbiAgICAgICAgKVxuICAgICAgICByb290LmFkZCh3cmFwKHNsaW1Hcm91cCkpXG5cbiAgICAgICAgUmVjdFRhcmdldENvbGxlY3RvckhlbHBlcihcbiAgICAgICAgICAgIGhlbHBlcixcbiAgICAgICAgICAgIHJlY3RhbmdsZUJ5RGF0YVBvaW50KGN0eCksXG4gICAgICAgICAgICB7IHA6IERhdGFQb2ludEFlc3RoZXRpY3MgLT5cbiAgICAgICAgICAgICAgICBIaW50Q29sb3JVdGlsLmZyb21GaWxsKFxuICAgICAgICAgICAgICAgICAgICBwXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFRpcExheW91dEhpbnQuS2luZC5DVVJTT1JfVE9PTFRJUFxuICAgICAgICApXG4gICAgICAgICAgICAuY29sbGVjdFRvKGN0eC50YXJnZXRDb2xsZWN0b3IpXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGNvbnN0IHZhbCBIQU5ETEVTX0dST1VQUyA9IGZhbHNlXG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gcmVjdGFuZ2xlQnlEYXRhUG9pbnQoY3R4OiBHZW9tQ29udGV4dCk6IChEYXRhUG9pbnRBZXN0aGV0aWNzKSAtPiBEb3VibGVSZWN0YW5nbGU/IHtcbiAgICAgICAgICAgIHJldHVybiB7IHAgLT5cbiAgICAgICAgICAgICAgICB2YWwgeCA9IHAueCgpXG4gICAgICAgICAgICAgICAgdmFsIHkgPSBwLnkoKVxuICAgICAgICAgICAgICAgIHZhbCB3ID0gcC53aWR0aCgpXG4gICAgICAgICAgICAgICAgdmFsIGggPSBwLmhlaWdodCgpXG5cbiAgICAgICAgICAgICAgICB2YXIgcmVjdDogRG91YmxlUmVjdGFuZ2xlPyA9IG51bGxcbiAgICAgICAgICAgICAgICBpZiAoU2VyaWVzVXRpbC5hbGxGaW5pdGUoeCwgeSwgdywgaCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHdpZHRoID0gdyEhICogY3R4LmdldFJlc29sdXRpb24oQWVzLlgpXG4gICAgICAgICAgICAgICAgICAgIHZhbCBoZWlnaHQgPSBoISEgKiBjdHguZ2V0UmVzb2x1dGlvbihBZXMuWSlcblxuICAgICAgICAgICAgICAgICAgICB2YWwgb3JpZ2luID0gRG91YmxlVmVjdG9yKHghISAtIHdpZHRoIC8gMiwgeSEhIC0gaGVpZ2h0IC8gMilcbiAgICAgICAgICAgICAgICAgICAgdmFsIGRpbWVuc2lvbnMgPSBEb3VibGVWZWN0b3Iod2lkdGgsIGhlaWdodClcbiAgICAgICAgICAgICAgICAgICAgcmVjdCA9IERvdWJsZVJlY3RhbmdsZShvcmlnaW4sIGRpbWVuc2lvbnMpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlY3RcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjAuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGNhbiBiZS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ZXJjZXB0ID0gcC5pbnRlcmNlcHRYKClcbiAgICAgICAgICAgIGlmIChTZXJpZXNVdGlsLmlzRmluaXRlKGludGVyY2VwdCkpIHtcbiAgICAgICAgICAgICAgICBpZiAodmlld1BvcnQueFJhbmdlKCkuY29udGFpbnMoaW50ZXJjZXB0ISEpKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBzdGFydCA9IERvdWJsZVZlY3RvcihpbnRlcmNlcHQsIHZpZXdQb3J0LnRvcClcbiAgICAgICAgICAgICAgICAgICAgdmFsIGVuZCA9IERvdWJsZVZlY3RvcihpbnRlcmNlcHQsIHZpZXdQb3J0LmJvdHRvbSlcbiAgICAgICAgICAgICAgICAgICAgdmFsIGxpbmUgPSBoZWxwZXIuY3JlYXRlTGluZShzdGFydCwgZW5kLCBwKVxuICAgICAgICAgICAgICAgICAgICBsaW5lcy5hZGQobGluZSlcblxuICAgICAgICAgICAgICAgICAgICB2YWwgd2lkdGggPSBtYXgoQWVzU2NhbGluZy5zdHJva2VXaWR0aChwKSwgMi4wKSAqIDIuMFxuICAgICAgICAgICAgICAgICAgICB2YWwgb3JpZ2luID0gRG91YmxlVmVjdG9yKGludGVyY2VwdCAtIHdpZHRoIC8gMiwgZW5kLnkpXG4gICAgICAgICAgICAgICAgICAgIHZhbCBkaW1lbnNpb25zID0gRG91YmxlVmVjdG9yKHdpZHRoLCAwLjApXG4gICAgICAgICAgICAgICAgICAgIHZhbCByZWN0ID0gRG91YmxlUmVjdGFuZ2xlKG9yaWdpbiwgZGltZW5zaW9ucylcbiAgICAgICAgICAgICAgICAgICAgY3R4LnRhcmdldENvbGxlY3Rvci5hZGRSZWN0YW5nbGUoXG4gICAgICAgICAgICAgICAgICAgICAgICBwLmluZGV4KCksXG4gICAgICAgICAgICAgICAgICAgICAgICBnZW9tSGVscGVyLnRvQ2xpZW50KHJlY3QsIHApLFxuICAgICAgICAgICAgICAgICAgICAgICAgR2VvbVRhcmdldENvbGxlY3Rvci5Ub29sdGlwU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xuICAgICAgICAgICAgICAgIC5kZWZhdWx0S2luZChUaXBMYXlvdXRIaW50LktpbmQuSE9SSVpPTlRBTF9UT09MVElQKVxuXG4gICAgICAgICAgICB2YWwgaGludENvbmZpZ3MgPSBoaW50QWVzTGlzdFxuICAgICAgICAgICAgICAgIC5mb2xkKEhpbnRzQ29sbGVjdGlvbihwLCBoZWxwZXIpKSB7IGFjYywgYWVzIC0+XG4gICAgICAgICAgICAgICAgICAgIGFjYy5hZGRIaW50KGhpbnRGYWN0b3J5LmNyZWF0ZShhZXMpKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY3R4LnRhcmdldENvbGxlY3Rvci5hZGRSZWN0YW5nbGUoXG4gICAgICAgICAgICAgICAgcC5pbmRleCgpLFxuICAgICAgICAgICAgICAgIGhlbHBlci50b0NsaWVudChyZWN0LCBwKSxcbiAgICAgICAgICAgICAgICBHZW9tVGFyZ2V0Q29sbGVjdG9yLlRvb2x0aXBQYXJhbXMucGFyYW1zKClcbiAgICAgICAgICAgICAgICAgICAgLnNldFRpcExheW91dEhpbnRzKGhpbnRDb25maWdzLmhpbnRzKVxuLy8gICAgICAgICAgICAgICAgICAgIC5zZXRDb2xvcihIaW50Q29sb3JVdGlsLmZyb21Db2xvcihwKSlcbiAgICAgICAgICAgICAgICAgICAgLnNldENvbG9yKGNvbG9yRmFjdG9yeShwKSlcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cbn0iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDIwLiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgTUlUIGxpY2Vuc2UgdGhhdCBjYW4gYmUgZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZS5cbiAqL1xuXG5wYWNrYWdlIGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJhc2UuZ2VvbS51dGlsXG5cbmltcG9ydCBq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Flc3RoZXRpY3MsIHBvcywgY29vcmQsIGN0eClcbiAgICAgICAgdmFsIHJlY3RhbmdsZXMgPSBoZWxwZXIuY3JlYXRlUmVjdGFuZ2xlcyhyZWN0RmFjdG9yeSlcbiAgICAgICAgcmVjdGFuZ2xlcy5mb3JFYWNoIHsgcm9vdC5hZGQoaXQpIH1cbiAgICB9XG5cbiAgICBmdW4gYnVpbGRNaWRsaW5lcyhcbiAgICAgICAgcm9vdDogU3ZnUm9vdCxcbiAgICAgICAgYWVzdGhldGljczogQWVzdGhldGljcyxcbiAgICAgICAgcG9zOiBQb3NpdGlvbkFkanVzdG1lbnQsXG4gICAgICAgIGNvb3JkOiBDb29yZGluYXRlU3lzdGVtLFxuICAgICAgICBjdHg6IEdlb21Db250ZXh0LFxuICAgICAgICBmYXR0ZW46IERvdWJsZVxuICAgICkge1xuICAgICAgICB2YWwgaGVscGVyID0gR2VvbUhlbHBlcihwb3MsIGNvb3JkLCBjdHgpXG4gICAgICAgIHZhbCBlbGVtZW50SGVscGVyID0gaGVscGVyLmNyZWF0ZVN2Z0VsZW1lbnRIZWxwZXIoKVxuXG4gICAgICAgIGZvciAocCBpbiBHZW9tVXRpbC53aXRoRGVmaW5lZChcbiAgICAgICAgICAgIGFlc3RoZXRpY3MuZGF0YVBvaW50cygpLFxuICAgICAgICAgICAgQWVzLlgsXG4gICAgICAgICAgICBBZXMuV0lEVEgsXG4gICAgICAgICAgICBBZXMuTUlERExFXG4gICAgICAgICkpIHtcbiAgICAgICAgICAgIHZhbCB4ID0gcC54KCkhIVxuICAgICAgICAgICAgdmFsIG1pZGRsZSA9IHAubWlkZGxlKCkhIVxuICAgICAgICAgICAgdmFsIHdpZHRoID0gR2VvbVV0aWwud2lkdGhQeChwLCBjdHgsIDIuMClcblxuICAgICAgICAgICAgdmFsIGxpbmUgPSBlbGVtZW50SGVscGVyLmNyZWF0ZUxpbmUoXG4gICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHggLSB3aWR0aCAvID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gKHNpemUueCAtIHdpZHRoKSAvIDJcbiAgICAgICAgdmFsIHkgPSBzdHJva2VXaWR0aCAvIDJcblxuXG4gICAgICAgIC8vIGJveFxuICAgICAgICB2YXIgYm94SGVpZ2h0ID0gaGVpZ2h0XG4gICAgICAgIHZhciBib3hZID0geVxuICAgICAgICBpZiAod2hpc2tlcnMpIHtcbiAgICAgICAgICAgIGJveEhlaWdodCA9IGhlaWdodCAqICgxIC0gMiAqIHdoaXNrZXJTaXplKVxuICAgICAgICAgICAgYm94WSA9IHkgKyBoZWlnaHQgKiB3aGlza2VyU2l6ZVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHJlY3QgPSBTdmdSZWN0RWxlbWVudChcbiAgICAgICAgICAgIHgsXG4gICAgICAgICAgICBib3hZLFxuICAgICAgICAgICAgd2lkdGgsXG4gICAgICAgICAgICBib3hIZWlnaHRcbiAgICAgICAgKVxuICAgICAgICBHZW9tSGVscGVyLmRlY29yYXRlKHJlY3QsIHApXG5cbiAgICAgICAgLy8gbGluZXNcbiAgICAgICAgdmFsIG1pZGRsZVkgPSB5ICsgaGVpZ2h0ICogLjVcbiAgICAgICAgdmFsIG1pZGRsZSA9IFN2Z0xpbmVFbGVtZW50KHgsIG1pZGRsZVksIHggKyB3aWR0aCwgbWlkZGxlWSlcbiAgICAgICAgR2VvbUhlbHBlci5kZWNvcmF0ZShtaWRkbGUsIHApXG5cbiAgICAgICAgdmFsIGcgPSBTdmdHRWxlbWVudCgpXG4gICAgICAgIGcuY2hpbGRyZW4oKS5hZGQocmVjdClcbiAgICAgICAgZy5jaGlsZHJlbigpLmFkZChtaWRkbGUpXG5cbiAgICAgICAgaWYgKHdoaXNrZXJzKSB7XG4gICAgICAgICAgICB2YWwgbWlkZGxlWCA9IHggKyB3aWR0aCAqIC41XG4gICAgICAgICAgICB2YWwgbG93ZXJXaGlza2VyID1cbiAgICAgICAgICAgICAgICBTdmdMaW5lRWxlbWVudChtaWRkbGVYLCB5ICsgaGVpZ2h0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0aCAoc2hhcGUgYmVjb21lcyBpbnZpc2libGUpXG4gICAgICAgIGlmIChjbGllbnRSZWN0LndpZHRoID09IDAuMCkge1xuICAgICAgICAgICAgY2xpZW50UmVjdCA9IERvdWJsZVJlY3RhbmdsZShjbGllbnRSZWN0Lm9yaWdpbi54LCBjbGllbnRSZWN0Lm9yaWdpbi55LCAwLjEsIGNsaWVudFJlY3QuaGVpZ2h0KVxuICAgICAgICB9XG4gICAgICAgIGlmIChjbGllbnRSZWN0LmhlaWdodCA9PSAwLjApIHtcbiAgICAgICAgICAgIGNsaWVudFJlY3QgPSBEb3VibGVSZWN0YW5nbGUoY2xpZW50UmVjdC5vcmlnaW4ueCwgY2xpZW50UmVjdC5vcmlnaW4ueSwgY2xpZW50UmVjdC53aWR0aCwgMC4xKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBjbGllbnRSZWN0XG4gICAgfVxuXG4gICAgZnVuIGZyb21DbGllbnQobG9jYXRpb246IERvdWJsZVZlY3Rvcik6IERvdWJsZVZlY3RvciB7XG4gICAgICAgIHJldHVybiBteUdlb21Db29yZC5mcm9tQ2xpZW50KGxvY2F0aW9uKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGFkanVzdChcbiAgICAgICAgbG9jYXRpb246IERvdWJsZVZlY3RvcixcbiAgICAgICAgcDogRGF0YVBvaW50QWVzdGhldGljcyxcbiAgICAgICAgcG9zOiBQb3NpdGlvbkFkanVzdG1lbnQsXG4gICAgICAgIGN0eDogR2VvbUNvbnRleHRcbiAgICApOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICByZXR1cm4gcG9zLnRyYW5zbGF0ZShsb2NhdGlvbiwgcCwgY3R4KVxuICAgIH1cblxuICAgIGludGVybmFsIGZ1biB0b0NsaWVudFJlY3QoXG4gICAgICAgIHA6IERhdGFQb2ludEFlc3RoZXRpY3MsXG4gICAgICAgIGFlc01hcHBlcjogKERhdGFQb2ludEFlc3RoZXRpY3MpIC0+IERvdWJsZVJlY3Rh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WwgcHAgPSB0b0NsaWVudChsb2NhdGlvbiwgcClcbiAgICAgICAgICAgICAgICBwb2ludHMuYWRkKHBwKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBwb2ludHNcbiAgICB9XG5cbiAgICBpbnRlcm5hbCBmdW4gdG9DbGllbnRMb2NhdGlvbihhZXNNYXBwZXI6IChEYXRhUG9pbnRBZXN0aGV0aWNzKSAtPiBEb3VibGVWZWN0b3I/KTogKERhdGFQb2ludEFlc3RoZXRpY3MpIC0+IERvdWJsZVZlY3Rvcj8ge1xuICAgICAgICByZXR1cm4geyBhZXMgLT5cbiAgICAgICAgICAgIHZhbCBsb2NhdGlvbiA9IGFlc01hcHBlcihhZXMpXG4gICAgICAgICAgICBpZiAobG9jYXRpb24gIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHRvQ2xpZW50KGxvY2F0aW9uLCBhZXMpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG51bGxcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBjcmVhdGVTdmdFbGVtZW50SGVscGVyKCk6IFN2Z0VsZW1lbnRIZWxwZXIge1xuICAgICAgICByZXR1cm4gU3ZnRWxlbWVudEhlbHBlcigpXG4gICAgfVxuXG4gICAgZnVuIHRvQ2xpZW50KGxvY2F0aW9uczogTGlzdDxEb3VibGVWZWN0b3I+LCBwOiBEYXRhUG9pbnRBZXN0aGV0aWNzKTogTGlzdDxEb3VibGVWZWN0b3I+IHtcbiAgICAgICAgdmFsIGxvY2FsTG9jYXRpb25zID0gQXJyYXlMaXN0PERvdWJsZVZlY3Rvcj4oKVxuICAgICAgICBmb3IgKGxvY2F0aW9uIGluIGxvY2F0aW9ucykge1xuICAgICAgICAgICAgbG9jYWxMb2NhdGlvbnMuYWRkKHRvQ2xpZW50KGxvY2F0aW9uLCBwKSlcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbG9jYWxMb2NhdGlvbnNcbiAgICB9XG5cbiAgICBpbm5lciBjbGFzcyBTdmdFbGVtZW50SGVscGVyIHtcbiAgICAgICAgcHJpdmF0ZSB2YXIgbXlTdHJva2VBbHBoYUVuYWJsZWQgPSBmYWxzZVxuXG4gICAgICAgIGZ1biBzZXRTdHJva2VBbHBoYUVuYWJsZWQoYjogQm9vbGVhbikge1xuICAgICAgICAgICAgbXlTdHJva2VBbHBoYUVuYWJsZWQgPSBiXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gY3JlYXRlTGluZShzdGFydDogRG91YmxlVmVjdG9yLCBlbmQ6IERvdWJsZVZlY3RvciwgcDogRGF0YVBvaW50QWVzdGhldGljcyk6IFN2Z0xpbmVFbGVtZW50IHtcbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIk5BTUVfU0hBRE9XSU5HXCIpXG4gICAgICAgICAgICB2YWwgc3RhcnQgPSB0b0NsaWVudChzdGFydCwgcClcbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIk5BTUVfU0hBRE9XSU5HXCIpXG4gICAgICAgICAgICB2YWwgZW5kID0gdG9DbGllbnQoZW5kLCBwKVxuICAgICAgICAgICAgdmFsIGxpbmUgPSBTdmdMaW5lRWxlbWVudChcbiAgICAgICAgICAgICAgICBzdGFydC54LCBzdGFydC55LFxuICAgICAgICAgICAgICAgIGVuZC54LCBlbmQueVxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgZGVjb3JhdGUobGluZSwgcCwgbXlTdHJva2VBbHBoYUVuYWJsZWQpXG4gICAgICAgICAgICByZXR1cm4gbGluZVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHZhbCBISlVTVF9NQVA6IE1hcDxBbnksIFRleHRMYWJlbC5Ib3Jpem9udGFsQW5jaG9yPiA9IG1hcE9mKFxuICAgICAgICAgICAgXCJyaWdodFwiIHRvIFRleHRMYWJlbC5Ib3Jpem9udGFsQW5jaG9yLlJJR0hULFxuICAgICAgICAgICAgXCJtaWRkbGVcIiB0byBUZXh0TGFiZWwuSG9yaXpvbnRhbEFuY2hvci5NSURETEUsXG4gICAgICAgICAgICBcImxlZnRcIiB0byBUZXh0TGFiZWwuSG9yaXpvbnRhbEFuY2hvci5MRUZULFxuICAgICAgICAgICAgMC4wIHRvIFRleHRMYWJlbC5Ib3Jpem9udGFsQW5jaG9yLlJJR0hULFxuICAgICAgICAgICAgMC41IHRvIFRleHRMYWJlbC5Ib3Jpem9udGFsQW5jaG9yLk1JRERMRSxcbiAgICAgICAgICAgIDEuMCB0byBUZXh0TGFiZWwuSG9yaXpvbnRhbEFuY2hvci5MRUZUXG4gICAgICAgIClcbiAgICAgICAgdmFsIFZKVVNUX01BUDogTWFwPEFueSwgVGV4dExhYmVsLlZlcnRpY2FsQW5jaG9yPiA9IG1hcE9mKFxuICAgICAgICAgICAgXCJib3R0b21cIiB0byBUZXh0TGFiZWwuVmVydGljYWxBbmNob3IuQk9UVE9NLFxuICAgICAgICAgICAgXCJjZW50ZXJcIiB0byBUZXh0TGFiZWwuVmVydGljYWxBbmNob3IuQ0VOVEVSLFxuICAgICAgICAgICAgXCJ0b3BcIiB0byBUZXh0TGFiZWwuVmVydGljYWxBbmNob3IuVE9QLFxuICAgICAgICAgICAgMC4wIHRvIFRleHRMYWJlbC5WZXJ0aWNhbEFuY2hvci5CT1RUT00sXG4gICAgICAgICAgICAwLjUgdG8gVGV4dExhYmVsLlZlcnRpY2FsQW5jaG9yLkNFTlRFUixcbiAgICAgICAgICAgIDEuMCB0byBUZXh0TGFiZWwuVmVydGljYWxBbmNob3IuVE9QXG4gICAgICAgIClcbiAgICAgICAgcHJpdmF0ZSB2YWwgRk9OVF9XRUlHSFRfU0VUID0gc2V0T2YoXG4gICAgICAgICAgICBcImJvbGRcIiwgXCJib2xkZXJcIiwgXCJsaWdodGVyXCIgICAgIC8vICdub3JtYWwnIGlzIGRlZmF1bHRcbiAgICAgICAgKVxuICAgICAgICBwcml2YXRlIHZhbCBGT05UX1NUWUxFX1NFVCA9IHNldE9mKFxuICAgICAgICAgICAgXCJpdGFsaWNcIiwgXCJvYmxpcXVlXCIgICAgICAgICAgICAgICAgIC8vICdub3JtYWwnIGlzIGRlZmF1bHRcbiAgICAgICAgKVxuICAgICAgICBwcml2YXRlIHZhbCBGT05UX0ZBTUlMWV9NQVAgPSBtYXBPZihcbiAgICAgICAgICAgIFwic2Fuc1wiIHRvIFwic2Fucy1zZXJpZlwiLFxuICAgICAgICAgICAgXCJzZXJpZlwiIHRvIFwic2VyaWZcIixcbiAgICAgICAgICAgIFwibW9ub1wiIHRvIFwibW9ub3NwYWNlXCJcbiAgICAgICAgKVxuXG4gICAgICAgIGZ1biBkZWNvcmF0ZShsYWJlbDogVGV4dExhYmVsLCBwOiBEYXRhUG9pbnRBZXN0aGV0aWNzLCBzY2FsZTogRG91YmxlID0gMS4wKSB7XG5cbiAgICAgICAgICAgIGxhYmVsLnRleHRDb2xvcigpLnNldChwLmNvbG9yKCkpXG4gICAgICAgICAgICBsYWJlbC50ZXh0T3BhY2l0eSgpLnNldChwLmFscGhhKCkpXG4gICAgICAgICAgICBsYWJlbC5zZXRGb250U2l6ZShBZXNTY2FsaW5nLnRleHRTaXplKHApICogc2NhbGUpXG5cbiAgICAgICAgICAgIC8vIGZhbWlseVxuICAgICAgICAgICAgdmFyIGZhbWlseSA9IHAuZmFtaWx5KClcbiAgICAgICAgICAgIGlmIChGT05UX0ZBTUlMWV9NQVAuY29udGFpbnNLZXkoZmFtaWx5KSkgeyAgIC8vIG90aGVyd2lzZSAtIHVzZSB2YWx1ZSBhcyBwcm92aWRlZCBieSB1c2VyXG4gICAgICAgICAgICAgICAgZmFtaWx5ID0gRk9OVF9GQU1JTFlfTUFQLmdldChmYW1pbHkpISFcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGxhYmVsLnNldEZvbnRGYW1pbHkoZmFtaWx5KVxuXG4gICAgICAgICAgICAvLyBmb250ZmFjZVxuICAgICAgICAgICAgLy8gaWdub3JlICdwbGFpbicgLyAnbm9ybWFsJyBhcyBpdCBpcyBkZWZhdWx0IHZhbHVlc1xuICAgICAgICAgICAgdmFsIGZvbnRmYWNlID0gcC5mb250ZmFjZSgpXG4gICAgICAgICAgICBpZiAoIVN0cmluZ3MuaXNOdWxsT3JFbXB0eShmb250ZmFjZSkpIHtcbiAgICAgICAgICAgICAgICBmb3IgKHMgaW4gZm9udGZhY2Uuc3BsaXQoXCIgXCIudG9SZWdleCgpKS5kcm9wTGFzdFdoaWxlIHsgaXQuaXNFbXB0eSgpIH0udG9UeXBlZEFycmF5KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKEZPTlRfV0VJR0hUX1NFVC5jb250YWlucyhzKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWwuc2V0Rm9udFdlaWdodChzKVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKEZPTlRfU1RZTEVfU0VULmNvbnRhaW5zKHMpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsYWJlbC5zZXRGb250U3R5bGUocylcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gdGV4dCBqdXN0aWZpY2F0aW9uXG4gICAgICAgICAgICB2YWwgaEFuY2hvciA9XG4gICAgICAgICAgICAgICAgdGV4dExhYmVsQW5jaG9yKFxuICAgICAgICAgICAgICAgICAgICBwLmhqdXN0KCksXG4gICAgICAgICAgICAgICAgICAgIEhKVVNUX01BUCxcbiAgICAgICAgICAgICAgICAgICAgVGV4dExhYmVsLkhvcml6b250YWxBbmNob3IuTUlERExFXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgdmFsIHZBbmNob3IgPVxuICAgICAgICAgICAgICAgIHRleHRMYWJlbEFuY2hvcihcbiAgICAgICAgICAgICAgICAgICAgcC52anVzdCgpLFxuICAgICAgICAgICAgICAgICAgICBWSlVTVF9NQVAsXG4gICAgICAgICAgICAgICAgICAgIFRleHRMYWJlbC5WZXJ0aWNhbEFuY2hvci5DRU5URVJcbiAgICAgICAgICAgICAgICApXG5cbiAgICAgICAgICAgIGlmIChoQW5jaG9yICE9PSBUZXh0TGFiZWwuSG9yaXpvbnRhbEFuY2hvci5MRUZUKSB7ICAvLyAnbGVmdCcgaXMgZGVmYXVsdFxuICAgICAgICAgICAgICAgIGxhYmVsLnNldEhvcml6b250YWxBbmNob3IoaEFuY2hvcilcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh2QW5jaG9yICE9PSBUZXh0TGFiZWwuVmVydGljYWxBbmNob3IuQk9UVE9NKSB7ICAvLyAnYm90dG9tJyBpcyBkZWZhdWx0XG4gICAgICAgICAgICAgICAgbGFiZWwuc2V0VmVydGljYWxBbmNob3IodkFuY2hvcilcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIGFuZ2xlID0gcC5hbmdsZSgpISFcbiAgICAgICAgICAgIGlmIChhbmdsZSAhPSAwLjApIHtcbiAgICAgICAgICAgICAgICAvLyBnZ3Bsb3QgYW5nbGU6IGNvdW50ZXIgY2xvY2t3aXNlXG4gICAgICAgICAgICAgICAgLy8gU1ZHIGFuZ2xlOiBjbG9ja3dpc2VcbiAgICAgICAgICAgICAgICBhbmdsZSA9IDM2MCAtIGFuZ2xlICUgMzYwXG4gICAgICAgICAgICAgICAgbGFiZWwucm90YXRlKGFuZ2xlKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIDxUPiB0ZXh0TGFiZWxBbmNob3IobzogQW55LCBjb252ZXJzaW9uTWFwOiBNYXA8QW55LCBUPiwgZGVmOiBUKTogVCB7XG4gICAgICAgICAgICByZXR1cm4gY29udmVyc2lvbk1hcC5nZXRPckVsc2UobywgeyBkZWYgfSlcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBkZWNvcmF0ZShub2RlOiBTdmdOb2RlLCBwOiBEYXRhUG9pbnRBZXN0aGV0aWNzLCBhcHBseUFscGhhVG9BbGw6IEJvb2xlYW4gPSBBTFBIQV9DT05UUk9MU19CT1RIKSB7XG4gICAgICAgICAgICBpZiAobm9kZSBpcyBTdmdTaGFwZSkge1xuICAgICAgICAgICAgICAgIGRlY29yYXRlU2hhcGUoXG4gICAgICAgICAgICAgICAgICAgIG5vZGUgYXMgU3ZnU2hhcGUsXG4gICAgICAgICAgICAgICAgICAgIHAsXG4gICAgICAgICAgICAgICAgICAgIGFwcGx5QWxwaGFUb0FsbFxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKG5vZGUgaXMgU3ZnRWxlbWVudCkge1xuICAgICAgICAgICAgICAgIHZhbCBsaW5lVHlwZSA9IHAubGluZVR5cGUoKVxuICAgICAgICAgICAgICAgIGlmICghKGxpbmVUeXBlLmlzQmxhbmsgfHwgbGluZVR5cGUuaXNTb2xpZCkpIHtcbiAgICAgICAgICAgICAgICAgICAgU3Ryb2tlRGFzaEFycmF5U3VwcG9ydC5hcHBseShub2RlLCBBZXNTY2FsaW5nLnN0cm9rZVdpZHRoKHApLCBsaW5lVHlwZS5kYXNoQXJyYXkpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZGVjb3JhdGVTaGFwZShzaGFwZTogU3ZnU2hhcGUsIHA6IERhdGFQb2ludEFlc3RoZXRpY3MsIGFwcGx5QWxwaGFUb0FsbDogQm9vbGVhbikge1xuICAgICAgICAgICAgQWVzdGhldGljc1V0aWwudXBkYXRlU3Ryb2tlKHNoYXBlLCBwLCBhcHBseUFscGhhVG9BbGwpXG4gICAgICAgICAgICBBZXN0aGV0aWNzVXRpbC51cGRhdGVGaWxsKHNoYXBlLCBwKVxuICAgICAgICAgICAgc2hhcGUuc3Ryb2tlV2lkdGgoKS5zZXQoQWVzU2NhbGluZy5zdHJva2VXa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gICAgICBwLngoKSxcbiAgICAgICAgICAgIHAueW1pbigpXG4gICAgICAgIClcbiAgICB9XG4gICAgdmFsIFRPX0xPQ0FUSU9OX1hfWU1BWCA9IHsgcDogRGF0YVBvaW50QWVzdGhldGljcyAtPlxuICAgICAgICB0b0xvY2F0aW9uT3JOdWxsKFxuICAgICAgICAgICAgcC54KCksXG4gICAgICAgICAgICBwLnltYXgoKVxuICAgICAgICApXG4gICAgfVxuICAgIHZhbCBUT19MT0NBVElPTl9YX1pFUk8gPSB7IHA6IERhdGFQb2ludEFlc3RoZXRpY3MgLT5cbiAgICAgICAgdG9Mb2NhdGlvbk9yTnVsbChcbiAgICAgICAgICAgIHAueCgpLFxuICAgICAgICAgICAgMC4wXG4gICAgICAgIClcbiAgICB9XG4gICAgdmFsIFRPX1JFQ1RBTkdMRSA9IHsgcDogRGF0YVBvaW50QWVzdGhldGljcyAtPlxuICAgICAgICBpZiAoU2VyaWVzVXRpbC5hbGxGaW5pdGUocC54bWluKCksIHAueW1pbigpLCBwLnhtYXgoKSwgcC55bWF4KCkpKSB7XG4gICAgICAgICAgICByZWN0VG9HZW9tZXRyeShcbiAgICAgICAgICAgICAgICBwLnhtaW4oKSEhLFxuICAgICAgICAgICAgICAgIHAueW1pbigpISEsXG4gICAgICAgICAgICAgICAgcC54bWF4KCkhISxcbiAgICAgICAgICAgICAgICBwLnltYXgoKSEhXG4gICAgICAgICAgICApXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBlbXB0eUxpc3QoKVxuICAgICAgICB9XG4gICAgfVxuICAgIHByaXZhdGUgdmFsIE9SREVSSU5HX1ggPSBPcmRlcmluZy5mcm9tKG9iamVjdCA6IENvbXBhcmF0b3I8RGF0YVBvaW50QWVzdGhldGljcz8+IHtcbiAgICAgICAgb3ZlcnJpZGUgZnVuIGNvbXBhcmUoYTogRGF0YVBvaW50QWVzdGhldGljcz8sIGI6IERhdGFQb2ludEFlc3RoZXRpY3M/KTogSW50IHtcbiAgICAgICAgICAgIHZhbCB4MSA9IGE/LngoKVxuICAgICAgICAgICAgdmFsIHgyID0gYj8ueCgpXG4gICAgICAgICAgICBpZiAoeDEgPT0gbnVsbCB8fCB4MiA9PSBudWxsKVxuICAgICAgICAgICAgICAgIHJldHVybiAwXG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgcmV0dXJuIHgxLmNvbXBhcmVUbyh4MilcbiAgICAgICAgfVxuICAgIH0pXG4gICAgcHJpdmF0ZSB2YWwgT1JERVJJTkdfWSA9IE9yZGVyaW5nLmZyb20ob2JqZWN0IDogQ29tcGFyYXRvcjxEYXRhUG9pbnRBZXN0aGV0aWNzPz4ge1xuICAgICAgICBvdmVycmlkZSBmdW4gY29tcGFyZShhOiBEYXRhUG9pbnRBZXN0aGV0aWNzPywgYjogRGF0YVBvaW50QWVzdGhldGljcz8pOiBJbnQge1xuICAgICAgICAgICAgdmFsIHkxID0gYT8ueSgpXG4gICAgICAgICAgICB2YWwgeTIgPSBiPy55KClcbiAgICAgICAgICAgIGlmICh5MSA9PSBudWxsIHx8IHkyID09IG51bGwpXG4gICAgICAgICAgICAgICAgcmV0dXJuIDBcbiAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICByZXR1cm4geTEuY29tcGFyZVRvKHkyKVxuICAgICAgICB9XG4gICAgfSlcbiAgICBwcml2YXRlIHZhbCBXSVRIX1hfWSA9IHsgcG9pbnRBZXM6IERhdGFQb2ludEFlc3RoZXRpY3MgLT4gU2VyaWVzVXRpbC5hbGxGaW5pdGUocG9pbnRBZXMueCgpLCBwb2ludEFlcy55KCkpIH1cbiAgICBwcml2YXRlIHZhbCBXSVRIX1ggPSB7IHBvaW50QWVzOiBEYXRhUG9pbnRBZXN0aGV0aWNzIC0+IFNlcmllc1V0aWwuaXNGaW5pdGUocG9pbnRBZXMueCgpKSB9XG4gICAgcHJpdmF0ZSB2YWwgV0lUSF9ZID0geyBwb2ludEFlczogRGF0YVBvaW50QWVzdGhldGljcyAtP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PCo+LFxuICAgICAgICBhZXMyOiBBZXM8Kj4sXG4gICAgICAgIGFlczM6IEFlczwqPlxuICAgICk6IEl0ZXJhYmxlPERhdGFQb2ludEFlc3RoZXRpY3M+IHtcbiAgICAgICAgcmV0dXJuIGRhdGFQb2ludHMuZmlsdGVyIHsgcCAtPiBwLmRlZmluZWQoYWVzMCkgJiYgcC5kZWZpbmVkKGFlczEpICYmIHAuZGVmaW5lZChhZXMyKSAmJiBwLmRlZmluZWQoYWVzMykgfVxuICAgIH1cblxuICAgIGZ1biByZWN0YW5nbGVCeURhdGFQb2ludChwOiBEYXRhUG9pbnRBZXN0aGV0aWNzLCBjdHg6IEdlb21Db250ZXh0KTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgdmFsIHggPSBwLngoKSEhXG4gICAgICAgIHZhbCB5ID0gcC55KCkhIVxuICAgICAgICB2YWwgd2lkdGggPSB3aWR0aFB4KHAsIGN0eCwgMi4wKVxuXG4gICAgICAgIHZhbCBvcmlnaW46IERvdWJsZVZlY3RvclxuICAgICAgICB2YWwgZGltZW5zaW9uczogRG91YmxlVmVjdG9yXG4gICAgICAgIGlmICh5ID49IDApIHtcbiAgICAgICAgICAgIG9yaWdpbiA9IERvdWJsZVZlY3Rvcih4IC0gd2lkdGggLyAyLCAwLjApXG4gICAgICAgICAgICBkaW1lbnNpb25zID0gRG91YmxlVmVjdG9yKHdpZHRoLCB5KVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgb3JpZ2luID0gRG91YmxlVmVjdG9yKHggLSB3aWR0aCAvIDIsIHkpXG4gICAgICAgICAgICBkaW1lbnNpb25zID0gRG91YmxlVmVjdG9yKHdpZHRoLCAteSlcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBEb3VibGVSZWN0YW5nbGUob3JpZ2luLCBkaW1lbnNpb25zKVxuICAgIH1cblxuICAgIGZ1biBjcmVhdGVHcm91cHMoZGF0YVBvaW50czogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz4pOiBNYXA8SW50LCBMaXN0PERhdGFQb2ludEFlc3RoZXRpY3M+PiB7XG4gICAgICAgIHZhbCBwb2ludHNCeUdyb3VwID0gSGFzaE1hcDxJbnQsIE11dGFibGVMaXN0PERhdGFQb2ludEFlc3RoZXRpY3M+PigpXG4gICAgICAgIGZvciAocCBpbiBkYXRhUG9pbnRzKSB7XG4gICAgICAgICAgICB2YWwgZ3JvdXAgPSBwLmdyb3VwKCkhIVxuICAgICAgICAgICAgaWYgKCFwb2ludHNCeUdyb3VwLmNvbnRhaW5zS2V5KGdyb3VwKSkge1xuICAgICAgICAgICAgICAgIHBvaW50c0J5R3JvdXBbZ3JvdXBdID0gQXJyYXlMaXN0KClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHBvaW50c0J5R3JvdXBbZ3JvdXBdISEuYWRkKHApXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcG9pbnRzQnlHcm91cFxuICAgIH1cblxuICAgIGZ1biByZWN0VG9HZW9tZXRyeShtaW5YOiBEb3VibGUsIG1pblk6IERvdWJsZSwgbWF4WDogRG91YmxlLCBtYXhZOiBEb3VibGUpOiBMaXN0PERvdWJsZVZlY3Rvcj4ge1xuICAgICAgICByZXR1cm4gbGlzdE9mKFxuICAgICAgICAgICAgRG91YmxlVmVjdG9yKG1pblgsIG1pblkpLFxuICAgICAgICAgICAgRG91YmxlVmVjdG9yKG1pblgsIG1heFkpLFxuICAgICAgICAgICAgRG91YmxlVmVjdG9yKG1heFgsIG1heFkpLFxuICAgICAgICAgICAgRG91YmxlVmVjdG9yKG1heFgsIG1pblkpLFxuICAgICAgICAgICAgRG91YmxlVmVjdG9yKG1pblgsIG1pblkpXG4gICAgICAgIClcbiAgICB9XG59IiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCB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CkgPSBteUhpbnRzXG5cbiAgICBmdW4gYWRkSGludChoaW50Q29uZmlnOiBIaW50Q29uZmlnKTogSGludHNDb2xsZWN0aW9uIHtcbiAgICAgICAgdmFsIGNvb3JkID0gZ2V0Q29vcmQoaGludENvbmZpZylcblxuICAgICAgICBpZiAoY29vcmQgIT0gbnVsbCkge1xuICAgICAgICAgICAgaGludHNbaGludENvbmZpZy5hZXNdID0gY3JlYXRlSGludChoaW50Q29uZmlnLCBjb29yZClcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB0aGlzXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gZ2V0Q29vcmQoaGludENvbmZpZzogSGludENvbmZpZyk6IERvdWJsZVZlY3Rvcj8ge1xuICAgICAgICBpZiAoaGludENvbmZpZy54ID09IG51bGwpIHtcbiAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcInggY29vcmQgaXMgbm90IHNldFwiKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGFlcyA9IGhpbnRDb25maWcuYWVzXG4gICAgICAgIHJldHVybiBpZiAoIW15UG9pbnQuZGVmaW5lZChhZXMpKSB7XG4gICAgICAgICAgICBudWxsXG4gICAgICAgIH0gZWxzZSBteUhlbHBlci50b0NsaWVudChEb3VibGVWZWN0b3IoaGludENvbmZpZy54ISEsIG15UG9pbnQuZ2V0PERvdWJsZT4oYWVzKSEhKSwgbXlQb2ludClcblxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNyZWF0ZUhpbnQoaGludENvbmZpZzogSGludENvbmZpZywgY29vcmQ6IERvdWJsZVZlY3Rvcik6IFRpcExheW91dEhpbnQge1xuICAgICAgICB2YWwgb2JqZWN0UmFkaXVzID0gaGludENvbmZpZy5vYmplY3RSYWRpdXNcbiAgICAgICAgdmFsIGNvbG9yID0gaGludENvbmZpZy5jb2xvclxuXG4gICAgICAgIGlmIChvYmplY3RSYWRpdXMgPT0gbnVsbCkge1xuICAg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dG9yeSB7XG4gICAgICAgICAgICBteURlZmF1bHRPYmplY3RSYWRpdXMgPSBkZWZhdWx0T2JqZWN0UmFkaXVzXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGRlZmF1bHRYKGRlZmF1bHRYOiBEb3VibGUpOiBIaW50Q29uZmlnRmFjdG9yeSB7XG4gICAgICAgICAgICBteURlZmF1bHRYID0gZGVmYXVsdFhcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZGVmYXVsdENvbG9yKHY6IENvbG9yLCBhbHBoYTogRG91YmxlPyk6IEhpbnRDb25maWdGYWN0b3J5IHtcbiAgICAgICAgICAgIGlmIChhbHBoYSAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgbXlEZWZhdWx0Q29sb3IgPSB2LmNoYW5nZUFscGhhKCgyNTUgKiBhbHBoYSkudG9JbnQoKSlcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbXlEZWZhdWx0Q29sb3IgPSB2XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGNyZWF0ZShhZXM6IEFlczxEb3VibGU+KTogSGludENvbmZpZyB7XG4gICAgICAgICAgICByZXR1cm4gSGludENvbmZpZyhhZXMpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZGVmYXVsdEtpbmQoa2luZDogS2luZCk6IEhpbnRDb25maWdGYWN0b3J5IHtcbiAgICAgICAgICAgIG15RGVmYXVsdEtpbmQgPSBraW5kXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgaW5uZXIgY2xhc3MgSGludENvbmZpZyBpbnRlcm5hbCBjb25zdHJ1Y3Rvcih2YWwgYWVzOiBBZXM8RG91YmxlPikge1xuICAgICAgICAgICAgdmFsIGtpbmQ6IEtpbmQ/XG4gICAgICAgICAgICB2YXIgb2JqZWN0UmFkaXVzOiBEb3VibGU/ID0gbnVsbFxuICAgICAgICAgICAgICAgIHByaXZhdGUgc2V0XG4gICAgICAgICAgICB2YXIgeDogRG91YmxlPyA9IG51bGxcbiAgICAgICAgICAgICAgICBwcml2YXRlIHNldFxuICAgICAgICAgICAgaW50ZXJuYWwgdmFyIGNvbG9yOiBDb2xvcj8gPSBudWxsXG4gICAgICAgICAgICAgICAgcHJpdmF0ZSBzZXRcblxuICAgICAgICAgICAgaW5pdCB7XG4gICAgICAgICAgICAgICAgb2JqZWN0UmFkaXVzID0gbXlEZWZhdWx0T2JqZWN0UmFkaXVzXG4gICAgICAgICAgICAgICAgeCA9IG15RGVmYXVsdFhcbiAgICAgICAgICAgICAgICBraW5kID0gbXlEZWZhdWx0S2luZFxuICAgICAgICAgICAgICAgIGNvbG9yID0gbXlEZWZhdWx0Q29sb3JcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZnVuIG9iamVjdFJhZGl1cyh2OiBEb3VibGUpOiBIaW50Q29uZmlnIHtcbiAgICAgICAgICAgICAgICBvYmplY3RSYWRpdXMgPSB2XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZnVuIHgodjogRG91YmxlKTogSGludENvbmZpZyB7XG4gICAgICAgICAgICAgICAgeCA9IHZcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmdW4gY29sb3IodjogQ29sb3IpOiBIaW50Q29uZmlnIHtcbiAgICAgICAgICAgICAgICBjb2xvciA9IHZcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXM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G9zZVBhdGg6IEJvb2xlYW5cbikge1xuXG4gICAgZnVuIGNvbnN0cnVjdCh3aXRoSGludHM6IEJvb2xlYW4pOiBMaXN0PExpbmVQYXRoPiB7XG4gICAgICAgIHZhbCBsaW5lUGF0aHMgPSBBcnJheUxpc3Q8TGluZVBhdGg+KClcbiAgICAgICAgdmFsIG11bHRpUG9pbnREYXRhTGlzdCA9IGNyZWF0ZU11bHRpUG9pbnREYXRhQnlHcm91cCgpXG4gICAgICAgIGZvciAobXVsdGlQb2ludERhdGEgaW4gbXVsdGlQb2ludERhdGFMaXN0KSB7XG4gICAgICAgICAgIGxpbmVQYXRocy5hZGRBbGwobXlMaW5lc0hlbHBlci5jcmVhdGVQYXRocyhtdWx0aVBvaW50RGF0YS5hZXMsIG11bHRpUG9pbnREYXRhLnBvaW50cywgbXlDbG9zZVBhdGgpKVxuICAgICAgICB9XG4gICAgICAgIGlmICh3aXRoSGludHMpIHtcbiAgICAgICAgICAgIGJ1aWxkSGludHMobXVsdGlQb2ludERhdGFMaXN0KVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBsaW5lUGF0aHNcbiAgICB9XG5cbiAgICBmdW4gYnVpbGRIaW50cygpID0gYnVpbGRIaW50cyhjcmVhdGVNdWx0aVBvaW50RGF0YUJ5R3JvdXAoKSlcblxuICAgIHByaXZhdGUgZnVuIGJ1aWxkSGludHMobXVsdGlQb2ludERhdGFMaXN0OiBMaXN0PE11bHRpUG9pbnREYXRhPikge1xuICAgICAgICBmb3IgKG11bHRpUG9pbnREYXRhIGluIG11bHRpUG9pbnREYXRhTGlzdCkge1xuICAgICAgICAgICAgaWYgKG15Q2xvc2VQYXRoKSB7XG4gICAgICAgICAgICAgICAgbXlUYXJnZXRDb2xsZWN0b3IuYWRkUG9seWdvbihcbiAgICAgICAgICAgICAgICAgICAgbXVsdGlQb2ludERhdGEucG9pbnRzLFxuICAgICAgICAgICAgICAgICAgICBtdWx0aVBvaW50RGF0YS5sb2NhbFRvR2xvYmFsSW5kZXgsXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtcygpLnNldENvbG9yKFxuICAgICAgICAgICAgICAgICAgICAgICAgSGludENvbG9yVXRpbC5mcm9tRmlsbChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtdWx0aVBvaW50RGF0YS5hZXNcbiAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbXlUYXJnZXRDb2xsZWN0b3IuYWRkUGF0aChcbiAgICAgICAgICAgICAgICAgICAgbXVsdGlQb2ludERhdGEucG9pbnRzLFxuICAgICAgICAgICAgICAgICAgICBtdWx0aVBvaW50RGF0YS5sb2NhbFRvR2xvYmFsSW5kZXgsXG4gICAgICAgICAgICAgICAgICAgIHBhcmFtcygpLnNldENvbG9yKFxuICAgICAgICAgICAgICAgICAgICAgICAgSGludENvbG9yVXRpbC5mcm9tQ29sb3IoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbXVsdGlQb2ludERhdGEuYWVzXG4gICAgICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjcmVhdGVNdWx0aVBvaW50RGF0YUJ5R3JvdXAoKTogTGlzdDxNdWx0aVBvaW50RGF0YT4ge1xuICAgICAgICByZXR1cm4gTXVsdGlQb2ludERhdGFDb25zdHJ1Y3Rvci5jcmVhdGVNdWx0aVBvaW50RGF0YUJ5R3JvdXAoXG4gICAgICAgICAgICBteURhdGFQb2ludHMsXG4gICAgICAgICAgICBzaW5nbGVQb2ludEFwcGVuZGVyIHsgcCAtPiBteUxpbmVzSGVscGVyLnRvQ2xpZW50KEdlb21VdGlsLlRPX0xPQ0FUSU9OX1hfWShwKSEhLCBwKSB9LF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MgPSBBcnJheUxpc3Q8TGluZVBhdGg+KClcbiAgICAgICAgdmFsIG11bHRpUG9pbnREYXRhTGlzdCA9XG4gICAgICAgICAgICBNdWx0aVBvaW50RGF0YUNvbnN0cnVjdG9yLmNyZWF0ZU11bHRpUG9pbnREYXRhQnlHcm91cChcbiAgICAgICAgICAgICAgICBkYXRhUG9pbnRzLFxuICAgICAgICAgICAgICAgIHNpbmdsZVBvaW50QXBwZW5kZXIodG9DbGllbnRMb2NhdGlvbiB7IHRvTG9jYXRpb24oaXQpIH0pLFxuICAgICAgICAgICAgICAgIHJlZHVjZXIoMC45OTksIGNsb3NlUGF0aClcbiAgICAgICAgICAgIClcblxuICAgICAgICAvLyBkcmF3IGxpbmUgZm9yIGVhY2ggZ3JvdXBcbiAgICAgICAgZm9yIChtdWx0aVBvaW50RGF0YSBpbiBtdWx0aVBvaW50RGF0YUxpc3QpIHtcbiAgICAgICAgICAgIHBhdGhzLmFkZEFsbChjcmVhdGVQYXRocyhtdWx0aVBvaW50RGF0YS5hZXMsIG11bHRpUG9pbnREYXRhLnBvaW50cywgY2xvc2VQYXRoKSlcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBwYXRoc1xuICAgIH1cblxuICAgIGludGVybmFsIGZ1biBjcmVhdGVQYXRocyhhZXM6IERhdGFQb2ludEFlc3RoZXRpY3MsIHBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+LCBjbG9zZVBhdGg6IEJvb2xlYW4pOiBMaXN0PExpbmVQYXRoPiB7XG4gICAgICAgIHZhbCBwYXRocyA9IEFycmF5TGlzdDxMaW5lUGF0aD4oKVxuICAgICAgICBpZiAoY2xvc2VQYXRoKSB7XG4gICAgICAgICAgICBwYXRocy5hZGQoTGluZVBhdGgucG9seWdvbihpbnNlcnRQYXRoU2VwYXJhdG9ycyhzcGxpdFJpbmdzKHBvaW50cykpKSlcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHBhdGhzLmFkZChMaW5lUGF0aC5sa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ICAgICAgICAgICBmb3IgKHBvaW50IGluIHBvaW50cykge1xuICAgICAgICAgICAgICAgICAgICBpZiAocHJldiAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgeCA9IGlmIChkaXIgPT09IFN0ZXBHZW9tLkRpcmVjdGlvbi5IVikgcG9pbnQueCBlbHNlIHByZXYueFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHkgPSBpZiAoZGlyID09PSBTdGVwR2VvbS5EaXJlY3Rpb24uSFYpIHByZXYueSBlbHNlIHBvaW50LnlcbiAgICAgICAgICAgICAgICAgICAgICAgIG5ld1BvaW50cy5hZGQoRG91YmxlVmVjdG9yKHgsIHkpKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIG5ld1BvaW50cy5hZGQocG9pbnQpXG4gICAgICAgICAgICAgICAgICAgIHByZXYgPSBwb2ludFxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHZhbCBwYXRoID0gTGluZVBhdGgubGluZShuZXdQb2ludHMpXG4gICAgICAgICAgICAgICAgZGVjb3JhdGUocGF0aCwgbXVsdGlQb2ludERhdGEuYWVzLCBmYWxzZSlcbiAgICAgICAgICAgICAgICBwYXRoSW5mb3MuYWRkKFxuICAgICAgICAgICAgICAgICAgICBQYXRoSW5mbyhcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhdGhcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBwYXRoSW5mb3NcbiAgICB9XG5cbiAgICBmdW4gY3JlYXRlQmFuZHMoXG4gICAgICAgIGRhdGFQb2ludHM6IEl0ZXJhYmxlPERhdGFQb2ludEFlc3RoZXRpY3M+LFxuICAgICAgICB0b0xvY2F0aW9uVXBwZXI6IChEYXRhUG9pbnRBZXN0aGV0aWNzKSAtPiBEb3VibGVWZWN0b3I/LFxuIC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uKHBvaW50cylcbiAgICAgICAgICAgICAgICAvL2RlY29yYXRlKHBhdGgsIGdyb3VwRGF0YVBvaW50cy5nZXQoMCksIHRydWUpO1xuICAgICAgICAgICAgICAgIGRlY29yYXRlRmlsbGluZ1BhcnQocGF0aCwgZ3JvdXBEYXRhUG9pbnRzWzBdKVxuICAgICAgICAgICAgICAgIGxpbmVzLmFkZChwYXRoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBsaW5lc1xuICAgIH1cblxuICAgIHByb3RlY3RlZCBmdW4gZGVjb3JhdGUocGF0aDogTGluZVBhdGgsIHA6IERhdGFQb2ludEFlc3RoZXRpY3MsIGZpbGxlZDogQm9vbGVhbikge1xuXG4gICAgICAgIHZhbCBzdHJva2UgPSBwLmNvbG9yKClcbiAgICAgICAgdmFsIHN0cm9rZUFscGhhID0gbXlBbHBoYUZpbHRlcihBZXN0aGV0aWNzVXRpbC5hbHBoYShzdHJva2UhISwgcCkpISFcbiAgICAgICAgcGF0aC5jb2xvcigpLnNldCh3aXRoT3BhY2l0eShzdHJva2UsIHN0cm9rZUFscGhhKSlcbiAgICAgICAgaWYgKCFBZXN0aGV0aWNzVXRpbC5BTFBIQV9DT05UUk9MU19CT1RIICYmIChmaWxsZWQgfHwgIW15QWxwaGFFbmFibGVkKSkge1xuICAgICAgICAgICAgcGF0aC5jb2xvcigpLnNldChzdHJva2UpXG4gICAgICAgIH1cblxuICAgICAgICBpZiAoZmlsbGVkKSB7XG4gICAgICAgICAgICBkZWNvcmF0ZUZpbGxpbmdQYXJ0KHBhdGgsIHApXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgc2l6ZSA9IG15V2lkdGhGaWx0ZXIoQWVzU2NhbGluZy5zdHJva2VXaWR0aChwKSkhIVxuICAgICAgICBwYXRoLndpZHRoKCkuc2V0KHNpemUpXG5cbiAgICAgICAgdmFsIGxpbmVUeXBlID0gcC5saW5lVHlwZSgpXG4gICAgICAgIGlmICghKGxpbmVU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0ZUFwcGVuZGVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRDb2xsZWN0b3JTdXBwbGllcigpXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgbXVsdGlQb2ludERhdGFDb21iaW5lcnNbZ3JvdXBdISEuYWRkKHApXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgcmVzdWx0ID0gQXJyYXlMaXN0PE11bHRpUG9pbnREYXRhPigpXG5cbiAgICAgICAgdmFsIHNvcnRlZEdyb3VwID0gbmF0dXJhbDxJbnQ+KCkuc29ydGVkQ29weShtdWx0aVBvaW50RGF0YUNvbWJpbmVycy5rZXlzKVxuICAgICAgICBmb3IgKGdyb3VwIGluIHNvcnRlZEdyb3VwKSB7XG4gICAgICAgICAgICB2YWwgbXVsdGlQb2ludERhdGEgPSBtdWx0aVBvaW50RGF0YUNvbWJpbmVyc1tncm91cF0hIS5jcmVhdGUoZ3JvdXApXG5cbiAgICAgICAgICAgIGlmIChtdWx0aVBvaW50RGF0YS5wb2ludHMuaXNOb3RFbXB0eSgpKSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0LmFkZChtdWx0aVBvaW50RGF0YSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBpbnRlcmZhY2UgUG9pbnRDb2xsZWN0b3Ige1xuXG4gICAgICAgIHZhbCBwb2ludHM6IFBhaXI8TGlzdDxEb3VibGVWZWN0b3I+LCBMaXN0PEludD4+XG4gICAgICAgIGZ1biBhZGQoY29vcmQ6IERvdWJsZVZlY3Rvcj8sIGluZGV4OiBJbnQpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBjbGFzcyBNdWx0aVBvaW50RGF0YUNvbWJpbmVyIGludGVybmFsIGNvbnN0cnVjdG9yKFxuICAgICAgICBwcml2YXRlIHZhbCBteUNvb3JkaW5hdGVBcHBlbmRlcjogKERhdGFQb2ludEFlc3RoZXRpY3MsIChEb3VibGVWZWN0b3I/KSAtPiBVbml0KSAtPiBVbml0LFxuICAgICAgICBwcml2YXRlIHZhbCBteVBvaW50Q29sbGVjdG9yOiBQb2ludENvbGxlY3RvclxuICAgICkge1xuXG4gICAgICAgIHByaXZhdGUgdmFyIG15Rmlyc3RBZXM6IERhdGFQb2ludEFlc3RoZXRpY3M/ID0gbnVsbFxuXG4gICAgICAgIGludGVybmFsIGZ1biBhZGQoYWVzOiBEYXRhUG9pbnRBZXN0aGV0aWNzKSB7XG4gICAgICAgICAgICBpZiAobXlGaXJzdEFlcyA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgbXlGaXJzdEFlcyA9IGFlc1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbXlDb29yZGluYXRlQXBwZW5kZXIoYWVzKSB7IG15UG9pbnRDb2xsZWN0b3IuYWRkKGl0LCBhZXMuaW5kZXgoKSkgfVxuICAgICAgICB9XG5cbiAgICAgICAgaW50ZXJuYWwgZnVuIGNyZWF0ZShncm91cDogSW50KTogTXVsdGlQb2ludERhdGEge1xuICAgICAgICAgICAgdmFsIHBvaW50cyA9IG15UG9pbnRDb2xsZWN0b3IucG9pbnRzXG4gICAgICAgICAgICByZXR1cm4gTXVsdGlQb2ludERhdGEoXG4gICAgICAgICAgICAgICAgbXlGaXJzdEFlcyEhLFxuICAgICAgICAgICAgICAgIHBvaW50cy5maXJzdCxcbiAgICAgICAgICAgICAgICB7IHBvaW50cy5zZWNvbmRbaXRdIH0sXG4gICAgICAgICAgICAgICAgZ3JvdXBcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgU2ltcGxlUG9pbnRDb2xsZWN0b3IgaW50ZXJuYWwgY29uc3RydWN0b3IoKSA6XG4gICAgICAgIFBvaW50Q29sbGVjdG9yIHtcbiAgICAgICAgcHJpdmF0ZSB2YWwgbXlQb2ludHMgPSBBcnJheUxpc3Q8R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BsYXN0IHBvc3Rwb25lZCB0byBhdm9pZCBkaXNjb25uZWN0ZWQgY29udG91cnNcbiAgICAgICAgdmFsIHBvaW50czogUGFpcjxMaXN0PERvdWJsZVZlY3Rvcj4sIExpc3Q8SW50Pj5cbiAgICAgICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgICAgICBpZiAobXlMYXN0UG9zdHBvbmVkICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgYWRkUG9pbnQobXlMYXN0UG9zdHBvbmVkISEuZmlyc3QsIG15TGFzdFBvc3Rwb25lZCEhLnNlY29uZClcbiAgICAgICAgICAgICAgICAgICAgbXlMYXN0UG9zdHBvbmVkID0gbnVsbFxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHJldHVybiBQYWlyKG15UmVkdWNlZFBvaW50cywgbXlSZWR1Y2VkSW5kZXhlcylcbiAgICAgICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBpc0Nsb3NlclRoYW4ocDA6IERvdWJsZVZlY3RvciwgcDE6IERvdWJsZVZlY3RvciwgZGlzdGFuY2U6IERvdWJsZSk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIGFicyhwMC54IC0gcDEueCkgPCBkaXN0YW5jZSAmJiBhYnMocDAueSAtIHAxLnkpIDwgZGlzdGFuY2VcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBhZGQoY29vcmQ6IERvdWJsZVZlY3Rvcj8sIGluZGV4OiBJbnQpIHtcbiAgICAgICAgICAgIGlmIChjb29yZCA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChteUxhc3RBZGRlZCA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgc3RvcmVQb2ludChjb29yZCwgaW5kZXgpXG4gICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICB9XG5cbiAgICAgICAg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AgIG15TGFzdFBvc3Rwb25lZCA9IFBhaXIobG9jLCBpbmRleClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHN0b3JlUG9pbnQobG9jOiBEb3VibGVWZWN0b3IsIGluZGV4OiBJbnQpIHtcbiAgICAgICAgICAgIGFkZFBvaW50KGxvYywgaW5kZXgpXG4gICAgICAgICAgICBteUxhc3RBZGRlZCA9IGxvY1xuXG4gICAgICAgICAgICBwcm9jZXNzUmVnaW9uU3RhcnQobG9jLCBpbmRleClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHByb2Nlc3NSZWdpb25TdGFydChsb2M6IERvdWJsZVZlY3Rvcj8sIGluZGV4OiBJbnQ/KSB7XG4gICAgICAgICAgICBpZiAoIW15UG9seWdvbikge1xuICAgICAgICAgICAgICAgIHJldHVyblxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAobXlSZWdpb25TdGFydCA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgbXlSZWdpb25TdGFydCA9IFBhaXIobG9jLCBpbmRleClcbiAgICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGlzUmVnaW9uU3RhcnQobG9jKSkge1xuICAgICAgICAgICAgICAgIC8vIFJlZ2lvbiBpcyBjbG9zZWQuIFdhaXQgbmV4dCBzdGFydCBwb2ludC5cbiAgICAgICAgICAgICAgICBteVJlZ2lvblN0YXJ0ID0gbnVsbFxuICAgICAgICAgICAgICAgIG15TGFzdEFkZGVkID0gbnVsbFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gaXNSZWdpb25TdGFydChsb2M6IERvdWJsZVZlY3Rvcj8pOiBCb29sZWFuIHtcbiAgICAgICAgICAgIGlmICghbXlQb2x5Z29uKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlXG4gICAgICAgICAgICB9XG5cbiAg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AgICAgICAgfVxuXG4gICAgICAgIGZ1biBzZXRUaXBMYXlvdXRIaW50cyh0aXBMYXlvdXRIaW50czogTWFwPEFlczwqPiwgVGlwTGF5b3V0SGludD4pOiBUb29sdGlwUGFyYW1zIHtcbiAgICAgICAgICAgIG15VGlwTGF5b3V0SGludHMgPSB0aXBMYXlvdXRIaW50c1xuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBnZXRDb2xvcigpOiBDb2xvciB7XG4gICAgICAgICAgICByZXR1cm4gbXlDb2xvclxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHNldENvbG9yKGNvbG9yOiBDb2xvcik6IFRvb2x0aXBQYXJhbXMge1xuICAgICAgICAgICAgbXlDb2xvciA9IGNvbG9yXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGdldFN0ZW1MZW5ndGgoKTogVGlwTGF5b3V0SGludC5TdGVtTGVuZ3RoIHtcbiAgICAgICAgICAgIHJldHVybiBteVN0ZW1MZW5ndGhcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBzZXRTdGVtTGVuZ3RoKHN0ZW1MZW5ndGg6IFRpcExheW91dEhpbnQuU3RlbUxlbmd0aCk6IFRvb2x0aXBQYXJhbXMge1xuICAgICAgICAgICAgbXlTdGVtTGVuZ3RoID0gc3RlbUxlbmd0aFxuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICAgICAgZnVuIHBhcmFtcygpOiBUb29sdGlwUGFyYW1zIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gVG9vbHRpcFBhcmFtcygpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2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hjZXB0aW9uKFwiTm90IGFwcGxpY2FibGUgdG8gJGtpbmRcIilcblxuICAgIGVudW0gY2xhc3MgS2luZCB7XG4gICAgICAgIFBPSU5ULCBSRUNULCBQT0xZR09OLCBQQVRIXG4gICAgfVxuXG4gICAgY2xhc3MgRG91YmxlQ2lyY2xlKHZhbCBjZW50ZXI6IERvdWJsZVZlY3RvciwgdmFsIHJhZGl1czogRG91YmxlKVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGZ1biBwb2ludChwOiBEb3VibGVWZWN0b3IsIHJhZGl1czogRG91YmxlKTogSGl0U2hhcGUge1xuICAgICAgICAgICAgcmV0dXJuIEhpdFNoYXBlKEtpbmQuUE9JTlQsIERvdWJsZUNpcmNsZShwLCByYWRpdXMpKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHJlY3QocjogRG91YmxlUmVjdGFuZ2xlKTogSGl0U2hhcGUge1xuICAgICAgICAgICAgcmV0dXJuIEhpdFNoYXBlKEtpbmQuUkVDVCwgcilcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBwYXRoKHBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+KTogSGl0U2hhcGUge1xuICAgICAgICAgICAgcmV0dXJuIHNoYXBlV2l0aFBhdGgoS2luZC5QQVRILCBwb2ludHMpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcG9seWdvbihwb2ludHM6IExpc3Q8RG91YmxlVmVjdG9yPik6IEhpdFNoYXBlIHtcbiAgICAgICAgICAgIHJldHVybiBzaGFwZVdpdGhQYXRoKEtpbmQuUE9MWUdPTiwgcG9pbnRzKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gc2hhcGVXaXRoUGF0aChraW5kOiBLaW5kLCBwb2ludHM6IExpc3Q8RG91YmxlVmVjdG9yPik6IEhpdFNoYXBlIHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBIaXRTaGFwZShraW5kLCBwb2ludHMpI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W91dEhpbnQoXG4gICAgICAgICAgICAgICAgS2luZC5WRVJUSUNBTF9UT09MVElQLFxuICAgICAgICAgICAgICAgIGNvb3JkLFxuICAgICAgICAgICAgICAgIG9iamVjdFJhZGl1cyxcbiAgICAgICAgICAgICAgICBjb2xvcixcbiAgICAgICAgICAgICAgICBzdGVtTGVuZ3RoXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaG9yaXpvbnRhbFRvb2x0aXAoY29vcmQ6IERvdWJsZVZlY3Rvcj8sIG9iamVjdFJhZGl1czogRG91YmxlLCBjb2xvcjogQ29sb3I/LCBzdGVtTGVuZ3RoOiBTdGVtTGVuZ3RoID0gU3RlbUxlbmd0aC5OT1JNQUwpOiBUaXBMYXlvdXRIaW50IHtcbiAgICAgICAgICAgIHJldHVybiBUaXBMYXlvdXRIaW50KFxuICAgICAgICAgICAgICAgIEtpbmQuSE9SSVpPTlRBTF9UT09MVElQLFxuICAgICAgICAgICAgICAgIGNvb3JkLFxuICAgICAgICAgICAgICAgIG9iamVjdFJhZGl1cyxcbiAgICAgICAgICAgICAgICBjb2xvcixcbiAgICAgICAgICAgICAgICBzdGVtTGVuZ3RoXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gY3Vyc29yVG9vbHRpcChjb29yZDogRG91YmxlVmVjdG9yPywgY29sb3I6IENvbG9yPywgc3RlbUxlbmd0aDogU3RlbUxlbmd0aCA9IFN0ZW1MZW5ndGguTk9STUFMKTogVGlwTGF5b3V0SGludCB7XG4gICAgICAgICAgICByZXR1cm4gVGlwTGF5b3V0SGludChcbiAgICAgICAgICAgICAgICBraW5kID0gS2luZC5DVVJTT1JfVE9PTFRJUCxcbiAgICAgICAgICAgICAgICBjb29yZCA9IGNvb3JkLFxuICAgICAgICAgICAgICAgIG9iamVjdFJhZGl1cyA9IDAuMCxcbiAgICAgICAgICAgICAgICBjb2xvciA9IGNvbG9yLFxuICAgICAgICAgICAgICAgIHN0ZW1MZW5ndGggPSBzdGVtTGVuZ3RoXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4geEF4aXNUb29sdGlwKGNvb3JkOiBEb3VibGVWZWN0b3I/LCBjb2xvcjogQ29sb3I/LCBheGlzUmFkaXVzOiBEb3VibGUgPSAwLjAsIHN0ZW1MZW5ndGg6IFN0ZW1MZW5ndGggPSBTdGVtTGVuZ3RoLk5PTkUpOiBUaXBMYXlvdXRIaW50IHtcbiAgICAgICAgICAgIHJldHVybiBUaXBMYXlvdXRIaW50KFxuICAgICAgICAgICAgICAgIGtpbmQgPSBLaW5kLlhfQVhJU19UT09MVElQLFxuICAgICAgICAgICAgICAgIGNvb3JkID0gY29vcmQsXG4gICAgICAgICAgICAgICAgb2JqZWN0UmFkaXVzID0gYXhpc1JhZGl1cyxcbiAgICAgICAgICAgICAgICBjb2xvciA9IGNvbG9yLFxuICAgICAgICAgICAgICAgIHN0ZW1MZW5ndGggPSBzdGVtTGVuZ3RoXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4geUF4aXNUb29sdGlwKGNvb3JkOiBEb3VibGVWZWN0b3I/LCBjb2xvcjogQ29sb3I/LCBheGlzUmFkaXVzOiBEb3VibGUgPSAwLjAsIHN0ZW1MZW5ndGg6IFN0ZW1MZW5ndGggPSBTdGVtTGVuZ3RoLk5PTkUpOiBUaXBMYXlvdXRIaW50IHtcbiAgICAgICAgICAgIHJldHVybiBUaXBMYXlvdXRIaW50KFxuICAgICAgICAgICAgICAgIGtpbmQgPSBLaW5kLllfQVhJU19UT09MVElQLFxuICAgICAgICAgICAgICAgIGNvb3JkID0gY29vcmQsXG4gICAgICAgICAgICAgICAgb2JqZWN0UmFkaXVzID0gYXhpc1JhZGl1cyxcbiAgICAgICAgICAgICAgICBjb2xvciA9IGNvbG9yLFxuICAgICAgICAgICAgICAgIHN0ZW1MZW5ndGggPSBzdGVtTGVuZ3RoXG4gICAgICAgICAgICApXG4gICAgICAgI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aW9uQWRqdXN0bWVudCB7XG5cbiAgICBwcml2YXRlIHZhbCBteURvZGdpbmdOZWVkZWQ6IEJvb2xlYW5cbiAgICBwcml2YXRlIGZ1biBpc0RvZGdpbmdOZWVkZWQoYWVzdGhldGljczogQWVzdGhldGljcyk6IEJvb2xlYW4ge1xuICAgICAgICAvLyBpZiBmb3Igc29tZSBYIHRoZXJlIGFyZSBtb3JlIHRoZW4ganVzdCAxIGdyb3VwLCB0aGVuIGRvZGdpbmcgaXMgbmVlZGVkXG4gICAgICAgIHZhbCBncm91cEJ5WCA9IEhhc2hNYXA8RG91YmxlLCBJbnQ/PigpXG4gICAgICAgIGZvciAoaSBpbiAwIHVudGlsIGFlc3RoZXRpY3MuZGF0YVBvaW50Q291bnQoKSkge1xuICAgICAgICAgICAgdmFsIHAgPSBhZXN0aGV0aWNzLmRhdGFQb2ludEF0KGkpXG4gICAgICAgICAgICBpZiAocC5kZWZpbmVkKEFlcy5YKSkge1xuICAgICAgICAgICAgICAgIHZhbCB4ID0gcC54KCkhIVxuICAgICAgICAgICAgICAgIHZhbCBncm91cCA9IHAuZ3JvdXAoKVxuICAgICAgICAgICAgICAgIGlmIChncm91cEJ5WC5jb250YWluc0tleSh4KSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZ3JvdXBCeVhbeF0gIT0gZ3JvdXApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vID4xIGdyb3VwIGZvciB0aGlzIFhcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBncm91cEJ5WFt4XSA9IGdyb3VwXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZVxuICAgIH1cblxuICAgIGluaXQge1xuICAgICAgICBteURvZGdpbmdOZWVkZWQgPSBpc0RvZGdpbmdOZWVkZWQoYWVzdGhldGljcylcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gdHJhbnNsYXRlKHY6IERvdWJsZVZlY3RvciwgcDogRGF0YVBvaW50QWVzdGhldGljcywgY3R4OiBHZW9tQ29udGV4dCk6IERvdWJsZVZlY3RvciB7XG4gICAgICAgIGlmIChteURvZGdpbmdOZWVkZWQpIHtcbiAgICAgICAgICAgIHZhbCBkYXRhUmVzb2x1dGlvbiA9IGN0eC5nZXRSZXNvbHV0aW9uKEFlcy5YKVxuICAgICAgICAgICAgdmFsIHdpZHRoID0gbXlXaWR0aCA/OiBwLndpZHRoKClcblxuICAgICAgICAgICAgaWYgKCFTZXJpZXNVdGlsLmlzRmluaXRlKHdpZHRoKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiB2XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbCBzbG90SW5kZXggPSBwLmdyb3VwKCkhIVxuICAgICAgICAgICAgdmFsIG1lZGlhbiA9IChteUdyb3VwQ291bnQgLSAxKSAvIDIuMFxuICAgICAgICAgICAgdmFsIHhPZmZzZXQgPSAoc2xvdEluZGV4IC0gbWVkaWFuKSAqIGRhdGFSZXNvbHV0aW9uICogd2lkdGghIVxuICAgICAgICAgICAgdmFsIHhDZW50ZXIgPSBwLngoKSEhXG4gICAgICAgICAgICB2YWwgeFNjYWxlciA9IDEuMCAvIG15R3JvdXBDb3VudFxuXG4gICAgICAgICAgICB2YWwgbmV3WCA9ICh2LnggKyB4T2Zmc2V0IC0geENlbnRlcikgKiB4U2NhbGVyICsgeENlbnRlclxuXG4gICAgICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKG5ld1gsIHYueSlcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdlxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBoYW5kbGVzR3JvdXBzKCk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gUG9zaXRpb25BZGp1c3RtZW50cy5NZXRhL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yIChpIGluIDAgdW50aWwgYWVzLmRhdGFQb2ludENvdW50KCkpIHtcbiAgICAgICAgICAgIHZhbCBkYXRhUG9pbnQgPSBhZXMuZGF0YVBvaW50QXQoaSlcbiAgICAgICAgICAgIHZhbCB4ID0gZGF0YVBvaW50LngoKVxuICAgICAgICAgICAgaWYgKFNlcmllc1V0aWwuaXNGaW5pdGUoeCkpIHtcbiAgICAgICAgICAgICAgICBpZiAoIXBvc01heEJ5QmluLmNvbnRhaW5zS2V5KHgpKSB7XG4gICAgICAgICAgICAgICAgICAgIHBvc01heEJ5QmluW3ghIV0gPSAwLjBcbiAgICAgICAgICAgICAgICAgICAgbmVnTWF4QnlCaW5beF0gPSAwLjBcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB2YWwgeSA9IGRhdGFQb2ludC55KClcbiAgICAgICAgICAgICAgICBpZiAoU2VyaWVzVXRpbC5pc0Zpbml0ZSh5KSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoeSEhID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvc01heEJ5QmluW3ghIV0gPSBwb3NNYXhCeUJpblt4XSEhICsgeVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbmVnTWF4QnlCaW5beCEhXSA9IG5lZ01heEJ5QmluW3hdISEgLSB5XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdmFsIHNjYWxlckJ5SW5kZXggPSBIYXNoTWFwPEludCwgRG91YmxlPigpXG4gICAgICAgIC8vIERvdWJsZSBtYXggPSBtYXgoQ29sbGVjdGlvbnMubWF4KHBvc01heEJ5QmluLnZhbHVlcygpKSwgQ29sbGVjdGlvbnMubWF4KG5lZ01heEJ5QmluLnZhbHVlcygpKSk7XG4gICAgICAgIGZvciAoaSBpbiAwIHVudGlsIGFlcy5kYXRhUG9pbnRDb3VudCgpKSB7XG4gICAgICAgICAgICB2YWwgZGF0YVBvaW50ID0gYWVzLmRhdGFQb2ludEF0KGkpXG4gICAgICAgICAgICB2YWwgeCA9IGRhdGFQb2ludC54KClcbiAgICAgICAgICAgIHZhbCB5ID0gZGF0YVBvaW50LnkoKVxuICAgICAgICAgICAgaWYgKHBvc01heEJ5QmluLmNvbnRhaW5zS2V5KHgpICYmIFNlcmllc1V0aWwuaXNGaW5pdGUoeSkpIHtcbiAgICAgICAgICAgICAgICBpZiAoeSEhID49IDAgJiYgcG9zTWF4QnlCaW5beF0hISA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgc2NhbGVyQnlJbmRleFtpXSA9IDEuMCAvIHBvc01heEJ5QmluW3hdISFcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHkgPCAwICYmIG5lZ01heEJ5QmluW3hdISEgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHNjYWxlckJ5SW5kZXhbaV0gPSAxLjAgLyBuZWdNYXhCeUJpblt4XSEhXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc2NhbGVyQnlJbmRleFtpXSA9IDEuMFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgc2NhbGVyQnlJbmRleFtpXSA9IDEuMFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBzY2FsZXJCeUluZGV4XG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIHRyYW5zbGF0ZSh2OiBEb3VibGVWZWN0b3IsIHA6IERhdGFQb2ludEFlc3RoZXRpY3MsIGN0eDogR2VvbUNvbnRleHQpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICB2YWwgbmV3TG9jID0gbXlTdGFja1Bvc0hlbHBlci50cmFuc2xhdGUodiwgcCwgY3R4KVxuICAgICAgICByZXR1cm4gRG91YmxlVmVjdG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91YmxlLCBQYWlyPE11dGFibGVEb3VibGUsIE11dGFibGVEb3VibGU+PigpXG4gICAgICAgICAgICBmb3IgKGkgaW4gMCB1bnRpbCBhZXMuZGF0YVBvaW50Q291bnQoKSkge1xuICAgICAgICAgICAgICAgIHZhbCBkYXRhUG9pbnQgPSBhZXMuZGF0YVBvaW50QXQoaSlcbiAgICAgICAgICAgICAgICB2YWwgeCA9IGRhdGFQb2ludC54KClcbiAgICAgICAgICAgICAgICBpZiAoU2VyaWVzVXRpbC5pc0Zpbml0ZSh4KSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIW5lZ1Bvc0Jhc2VCeUJpbi5jb250YWluc0tleSh4KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbmVnUG9zQmFzZUJ5QmluW3ghIV0gPSBQYWlyKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIE11dGFibGVEb3VibGUoMC4wKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdXRhYmxlRG91YmxlKDAuMClcbiAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIHZhbCB5ID0gZGF0YVBvaW50LnkoKVxuICAgICAgICAgICAgICAgICAgICBpZiAoU2VyaWVzVXRpbC5pc0Zpbml0ZSh5KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHBhaXIgPSBuZWdQb3NCYXNlQnlCaW5beF0hIVxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIG9mZnNldDogRG91YmxlXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoeSEhID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZmZzZXQgPSBwYWlyLnNlY29uZC5nZXRBbmRBZGQoeSlcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgb2Zmc2V0ID0gcGFpci5maXJzdC5nZXRBbmRBZGQoeSlcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIG9mZnNldEJ5SW5kZXhbaV0gPSBvZmZzZXRcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG9mZnNldEJ5SW5kZXhcbiAgICAgICAgfVxuXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBjbGFzcyBTdW1Qb3NpdGl2ZU5lZ2F0aXZlIGludGVybmFsIGNvbnN0cnVjdG9yKGFlczogQWVzdGhldGljcykgOiBTdGFja1BvcyhhZXMpIHtcblxuICAgICAgICBvdmVycmlkZSBmdW4gbWFwSW5kZXhUb09mZnNldChhZXM6IEFlc3RoZXRpY3MpOiBNYXA8SW50LCBEb3VibGU+IHtcbiAgICAgICAgICAgIHZhbCBvZmZzZXRCeUluZGV4ID0gSGFzaE1hcDxJbnQsIERvdWJsZT4oKVxuICAgICAgICAgICAgdmFsIGJhc2VCeUJpbiA9IEhhc2hNYXA8RG91YmxlLCBNdXRhYmxlRG91YmxlPigpXG4gICAgICAgICAgICBmb3IgKGkgaW4gMCB1bnRpbCBhZXMuZGF0YVBvaW50Q291bnQoKSkge1xuICAgICAgICAgICAgICAgIHZhbCBkYXRhUG9pbnRBZXMgPSBhZXMuZGF0YVBvaW50QXQoaSlcbiAgICAgICAgICAgICAgICB2YWwgeCA9IGRhdGFQb2ludEFlcy54KCkhIVxuICAgICAgICAgICAgICAgIGlmIChTZXJpZXNVdGlsLmlzRmluaXRlKHgpKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghYmFzZUJ5QmluLmNvbnRhaW5zS2V5KHgpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBiYXNlQnlCaW5beF0gPSBNdXRhYmxlRG91YmxlKDAuMClcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIHZhbCB5ID0g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b3IsIHA6IERhdGFQb2ludEFlc3RoZXRpY3MsIGZhdHRlbjogRG91YmxlID0gMS4wKTogU3ZnU2xpbU9iamVjdCB7XG4gICAgICAgIGlmIChzaGFwZSA9PSBUaW55UG9pbnRTaGFwZSkge1xuICAgICAgICAgICAgcmV0dXJuIGNyZWF0ZVRpbnlEb3RTaGFwZShcbiAgICAgICAgICAgICAgICBsb2NhdGlvbixcbiAgICAgICAgICAgICAgICBwXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICAgICAgaWYgKHNoYXBlIGlzIE5hbWVkU2hhcGUpIHtcbiAgICAgICAgICAgIHJldHVybiBjcmVhdGVOYW1lZFNoYXBlKFxuICAgICAgICAgICAgICAgIHNoYXBlLFxuICAgICAgICAgICAgICAgIGxvY2F0aW9uLFxuICAgICAgICAgICAgICAgIHAsXG4gICAgICAgICAgICAgICAgZmF0dGVuXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiVW5zdXBwb3J0ZWQgcG9pbnQgc2hhcGUgY29kZSAke3NoYXBlLmNvZGV9ICR7c2hhcGU6OmNsYXNzLnNpbXBsZU5hbWV9XCIpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gY3JlYXRlVGlueURvdFNoYXBlKGxvY2F0aW9uOiBEb3VibGVWZWN0b3IsIHA6IERhdGFQb2ludEFlc3RoZXRpY3MpOiBTdmdTbGltT2JqZWN0IHtcbiAgICAgICAgdmFsIHIgPSBTdmdTbGltRWxlbWVudHMucmVjdChsb2NhdGlvbi54IC0gMC41LCBsb2NhdGlvbi55IC0gMC41LCAxLjAsIDEuMClcbiAgICAgICAgdmFsIGNvbG9yID0gcC5jb2xvcigpISFcbiAgICAgICAgdmFsIGFscGhhID0gQWVzdGhldGljc1V0aWwuYWxwaGEoY29sb3IsIHApXG4gICAgICAgIHIuc2V0RmlsbChjb2xvciwgYWxwaGEpXG4gICAgICA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vbGVhbik6IFN2Z1NsaW1TaGFwZSB7XG4gICAgICAgICAgICB2YWwgaGFsZiA9IHNpemUgLyAyXG4gICAgICAgICAgICB2YWwgaGVpZ2h0ID0gaWYgKGluc2NyaWJlZEluU3F1YXJlKVxuICAgICAgICAgICAgICAgIHNpemVcbiAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICBTSURFX1RPX0hFSUdIVF9SQVRJTyAqIHNpemVcblxuICAgICAgICAgICAgdmFsIHZPZmZzZXQgPSBpZiAoaW5zY3JpYmVkSW5TcXVhcmUpXG4gICAgICAgICAgICAgICAgMC4wXG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgaGVpZ2h0ICogVkVSVElDQUxfT0ZGU0VUX1JBVElPXG5cbiAgICAgICAgICAgIHZhbCB4OiBEb3VibGVBcnJheVxuICAgICAgICAgICAgdmFsIHk6IERvdWJsZUFycmF5XG4gICAgICAgICAgICB2YXIgZHkgPSAoc2l6ZSAtIGhlaWdodCkgLyAyXG4gICAgICAgICAgICBpZiAocG9pbnRpbmdVcCkge1xuICAgICAgICAgICAgICAgIGR5IC09IHZPZmZzZXRcbiAgICAgICAgICAgICAgICB4ID0gZG91YmxlQXJyYXlPZihoYWxmLCBzaXplLCAwLjApXG4gICAgICAgICAgICAgICAgeSA9IGRvdWJsZUFycmF5T2YoMC4wICsgZHksIGhlaWdodCArIGR5LCBoZWlnaHQgKyBkeSlcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgZHkgKz0gdk9mZnNldFxuICAgICAgICAgICAgICAgIHggPSBkb3VibGVBcnJheU9mKDAuMCwgc2l6ZSwgaGFsZilcbiAgICAgICAgICAgICAgICB5ID0gZG91YmxlQXJyYXlPZigwLjAgKyBkeSwgMC4wICsgZHksIGhlaWdodCArIGR5KVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgb3ggPSBsb2NhdGlvbi54IC0gaGFsZlxuICAgICAgICAgICAgdmFs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BMaXN0PERvdWJsZT4pIHtcbiAgICAgICAgICAgICAgICBteURhc2hBcnJheSA9IEFycmF5TGlzdCh2YWx1ZSlcbiAgICAgICAgICAgICAgICB1cGRhdGVQYXRoRGFzaEFycmF5KClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHVwZGF0ZVBhdGhEYXNoQXJyYXkoKSB7XG4gICAgICAgIGlmICghKG15RGFzaEFycmF5ID09IG51bGwgfHwgbXlEYXNoQXJyYXkhIS5pc0VtcHR5KCkpKSB7XG4gICAgICAgICAgICB2YWwgdyA9IG15UGF0aC5zdHJva2VXaWR0aCgpLmdldCgpXG4gICAgICAgICAgICB2YWwgd2lkdGggPSB3ID86IDEuMFxuICAgICAgICAgICAgU3Ryb2tlRGFzaEFycmF5U3VwcG9ydC5hcHBseShcbiAgICAgICAgICAgICAgICBteVBhdGgsXG4gICAgICAgICAgICAgICAgd2lkdGgsXG4gICAgICAgICAgICAgICAgbXlEYXNoQXJyYXkhIVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHZhbCBFTkRfT0ZfU1VCUEFUSDogRG91YmxlVmVjdG9yPyA9IG51bGwgIC8vIEVuZCBvZiBTdWIgUGF0aFxuXG4gICAgICAgIGZ1biBsaW5lKHBvaW50czogSXRlcmFibGU8RG91YmxlVmVjdG9yPik6IExpbmVQYXRoIHtcbiAgICAgICAgICAgIHJldHVybiBMaW5lUGF0aChcbiAgICAgICAgICAgICAgICBwYXRoQnVpbGRlcihcbiAgICAgICAgICAgICAgICAgICAgcG9pbnRzLFxuICAgICAgICAgICAgICAgICAgICBmYWxzZVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBwb2x5Z29uKHBvaW50czogSXRlcmFibGU8RG91YmxlVmVjdG9yPz4pOiBMaW5lUGF0aCB7XG4gICAgICAgICAgICByZXR1cm4gTGluZVBhdGgoXG4gICAgICAgICAgICAgICAgcGF0aEJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgICAgIHBvaW50cyxcbiAgICAgICAgICAgICAgICAgICAgdHJ1ZVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHBhdGhCdWlsZGVyKHBvaW50czogSXRlcmFibGU8RG91YmxlVmVjdG9yPz4sIGlzUG9seWdvbjogQm9vbGVhbik6IFN2Z1BhdGhEYXRhQnVpbGRlciB7XG4gICAgICAgICAgICB2YWwgYnVpbGRlciA9IFN2Z1BhdGhEYXRhQnVpbGRlcih0cnVlKVxuXG4gICAgICAgICAgICB2YXIgY3VyU2VnbWVudDogTXV0YWJsZUxpc3Q8RG91YmxlVmVjdG9yPiA9IEFycmF5TGlzdCgpXG4gICAgICAgICAgICB2YWwgaW50ZXJwb2xhdGUgPSBmYWxzZVxuICAgICAgICAgICAgZm9yIChwb2ludCBpbiBwb2ludHMpIHtcbiAgICAgICAgICAgICAgICBpZiAocG9pbnQgPT09IEVORF9PRl9TVUJQQVRIKSB7XG4gICAgICAgICAgICAgICAgICAgIGJ1aWxkU2VnbWVudChcbiAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIsXG4gICAgICAgICAgICAgICAgICAgICAgICBjdXJTZWdtZW50LFxuICAgICAgICAgICAgICAgICAgICAgICAgaW50ZXJwb2xhdGVcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICBpZiAoaXNQb2x5Z29uKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmNsb3NlUGF0aCgpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgY3VyU2VnbWVudCA9IEFycmF5TGlzdCgpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY3VyU2VnbWVudC5hZGQocG9pbnQhISlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBidWlsZFNlZ21lbnQoXG4gICAgICAgICAgICAgICAgYnVpbGRlcixcbiAgICAgICAgICAgICAgICBjdXJTZWdtZW50LFxuICAgICAgICAgICAgICAgIGludGVycG9sYXRlXG4gICAgICAgICAgICApXG4gICAgICAgICAgICBpZiAoaXNQb2x5Z29uKSB7XG4gICAgICAgICAgICAgICAgYnVpbGRlci5jbG9zZVBhdGgoKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gYnVpbGRlclxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gYnVpbGRTZWdtZW50KGJ1aWxkZXI6IFN2Z1BhdGhEYXRhQnVpbGRlciwgY3VyU2VnbWVudDogTGlzdDxEb3VibGVWZWN0b3I+LCBpbnRlcnBvbGF0ZTogQm9vbGVhbikge1xuICAgICAgICAgICAgaWYgKGN1clNlZ21lbnQuaXNFbXB0eSgpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBidWlsZGVyLm1vdmVUbyhjdXJTZWdtZW50WzBdKVxuICAgICAgICAgICAgYnVpbGRlci5pbnRlcnBvbGF0ZVBvaW50cyhcbiAgICAgICAgICAgICAgICBjdXJTZWdtZW50LFxuICAgICAgICAgICAgICAgIGlmIChpbnRlcnBvbGF0ZSkgU3ZnUGF0aERhdGFCdWlsZGVyLkludGVycG9sYXRpb24uQ0FSRElOQUwgZWxzZSBTdmdQYXRoRGF0YUJ1aWxkZXIuSW50ZXJwb2xhdGlvbi5MSU5FQVJcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzI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ZlKClcbiAgICAgICAgbXlDb21wb3NpdGVSZWdpc3RyYXRpb24gPSBDb21wb3NpdGVSZWdpc3RyYXRpb24oKVxuICAgIH1cblxuICAgIGZ1biBhZGQoY2hpbGQ6IFN2Z0NvbXBvbmVudCkge1xuICAgICAgICBteUNoaWxkQ29tcG9uZW50cy5hZGQoY2hpbGQpXG4gICAgICAgIGFkZChjaGlsZC5yb290R3JvdXApXG4gICAgfVxuXG4gICAgZnVuIGFkZChub2RlOiBTdmdOb2RlKSB7XG4gICAgICAgIG15Um9vdEdyb3VwLmNoaWxkcmVuKCkuYWRkKG5vZGUpXG4gICAgfVxuXG4gICAgZnVuIG1vdmVUbyhwOiBEb3VibGVWZWN0b3IpIHtcbiAgICAgICAgbXlPcmlnaW4gPSBwXG4gICAgICAgIG15Um9vdEdyb3VwLnRyYW5zZm9ybSgpLnNldChcbiAgICAgICAgICAgIGJ1aWxkVHJhbnNmb3JtKFxuICAgICAgICAgICAgICAgIG15T3JpZ2luLFxuICAgICAgICAgICAgICAgIG15Um90YXRpb25BbmdsZVxuICAgICAgICAgICAgKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIG1vdmVUbyh4OiBEb3VibGUsIHk6IERvdWJsZSkge1xuICAgICAgICBtb3ZlVG8oRG91YmxlVmVjdG9yKHgsIHkpKVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEBwYXJhbSBhbmdsZSBpbiBkZWdyZWVzXG4gICAgICovXG4gICAgZnVuIHJvdGF0ZShhbmdsZTogRG91YmxlKSB7XG4gICAgICAgIG15Um90YXRpb25BbmdsZSA9IGFuZ2xlXG4gICAgICAgIG15Um9vdEdyb3VwLnRyYW5zZm9ybSgpLnNldChcbiAgICAgICAgICAgIGJ1aWxkVHJhbnNmb3JtKFxuICAgICAgICAgICAgICAgIG15T3JpZ2luLFxuICAgICAgICAgICAgICAgIG15Um90YXRpb25BbmdsZVxuICAgICAgICAgICAgKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZ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gICAgaWYgKG15VGV4dENvbG9yICE9IG51bGwpIHtcbiAgICAgICAgICAgIHNiLmFwcGVuZChcImZpbGw6XCIpLmFwcGVuZChteVRleHRDb2xvciEhLnRvSGV4Q29sb3IoKSkuYXBwZW5kKCc7JylcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChteUZvbnRTaXplID4gMCAmJiBteUZvbnRGYW1pbHkgIT0gbnVsbCkge1xuICAgICAgICAgICAgLy8gdXNlIGZvbnQgc2hvcnRoYW5kIGJlY2F1c2UgdGhpcyBmb3JtYXQgaXMgZXhwZWN0ZWQgYnkgc3ZnIC0+IGNhbnZhcyBtYXBwZXJcbiAgICAgICAgICAgIC8vIGZvbnQ6IFtzdHlsZV0gW3dlaWdodF0gc2l6ZSBmYW1pbHk7XG4gICAgICAgICAgICB2YWwgZm50ID0gU3RyaW5nQnVpbGRlcigpXG4gICAgICAgICAgICBpZiAoIW15Rm9udFN0eWxlLmlzTnVsbE9yRW1wdHkoKSkge1xuICAgICAgICAgICAgICAgIGZudC5hcHBlbmQobXlGb250U3R5bGUhISkuYXBwZW5kKCcgJylcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICghbXlGb250V2VpZ2h0LmlzTnVsbE9yRW1wdHkoKSkge1xuICAgICAgICAgICAgICAgIGZudC5hcHBlbmQobXlGb250V2VpZ2h0ISEpLmFwcGVuZCgnICcpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBmbnQuYXBwZW5kKG15Rm9udFNpemUpLmFwcGVuZChcInB4IFwiKVxuICAgICAgICAgICAgZm50LmFwcGVuZChteUZvbnRGYW1pbHkhISkuYXBwZW5kKFwiO1wiKVxuXG4gICAgICAgICAgICBzYi5hcHBlbmQoXCJmb250OlwiKS5hcHBlbmQoZm50KVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgLy8gc2V0IGVhY2ggcHJvcGVydHkgc2VwYXJhdGVseVxuICAgICAgICAgICAgaWYgKCFteUZvbnRTdHlsZS5pc051bGxPckJsYW5rKCkpIHtcbiAgICAgICAgICAgICAgICBzYi5hcHBlbmQoXCJmb250LXN0eWxlOlwiKS5hcHBlbmQobXlGb250U3R5bGUhISkuYXBwZW5kKCc7JylcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICghbXlGb250V2VpZ2h0LmlzTnVsbE9yRW1wdHkoKSkge1xuICAgICAgICAgICAgICAgIHNiLmFwcGVuZChcImZvbnQtd2VpZ2h0OlwiKS5hcHBlbmQobXlGb250V2VpZ2h0ISEpLmFwcGVuZCgnOycpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobXlGb250U2l6ZSA+IDApIHtcbiAgICAgICAgICAgICAgICBzYi5hcHBlbmQoXCJmb250LXNpemU6XCIpLmFwcGVuZChteUZvbnRTaXplKS5hcHBlbmQoXCJweDtcIilcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICghbXlGb250RmFtaWx5LmlzTnVsbE9yRW1wdHkoKSkge1xuICAgICAgICAgICAgICAgIHNiLmFwcGVuZChcImZvbnQtZmFtaWx5OlwiKS5hcHBlbmQobXlGb250RmFtaWx5ISEpLmFwcGVuZCgnOycpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBteVRleHQuc2V0QXR0cmlidXRlKFNWR19TVFlMRV9BVFRSSUJVVEUsIHNiLnRvU3RyaW5nKCkpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gdG9UZXh0QW5jaG9yKGFuY2hvcjogSG9yaXpvbnRhbEFuY2hvcik6IFN0cmluZz8ge1xuICAgICAgICByZXR1cm4gd2hlbiAoYW5jaG9yKSB7XG4gICAgICAgICAgICBIb3Jpem9udGFsQW5jaG9yLkxFRlQgLT4gbnVsbCAvLyBkZWZhdWx0IC0gXCJzdGFydFwiO1xuICAgICAgICAgICAgSG9yaXpvbnRhbEFuY2hvci5NSURETEUgLT4gU1ZHX1RFWFRfQU5DSE9SX01JRERMRVxuICAgICAgICAgICAgSG9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bjogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgcmFuZ2U6IENsb3NlZFJhbmdlPERvdWJsZT4sIGRlZmF1bHRWYWx1ZTogRG91YmxlKTogKERvdWJsZT8pIC0+IERvdWJsZSB7XG4gICAgICAgIHJldHVybiBsaW5lYXIoXG4gICAgICAgICAgICBkb21haW4sXG4gICAgICAgICAgICByYW5nZS5sb3dlckVuZCxcbiAgICAgICAgICAgIHJhbmdlLnVwcGVyRW5kLFxuICAgICAgICAgICAgZGVmYXVsdFZhbHVlXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gbGluZWFyKFxuICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIHJhbmdlTG93OiBEb3VibGUsXG4gICAgICAgIHJhbmdlSGlnaDogRG91YmxlLFxuICAgICAgICBkZWZhdWx0VmFsdWU6IERvdWJsZVxuICAgICk6IChEb3VibGU/KSAtPiBEb3VibGUge1xuICAgICAgICB2YWwgc2xvcCA9IChyYW5nZUhpZ2ggLSByYW5nZUxvdykgLyAoZG9tYWluLnVwcGVyRW5kIC0gZG9tYWluLmxvd2VyRW5kKVxuICAgICAgICBpZiAoIVNlcmllc1V0aWwuaXNGaW5pdGUoc2xvcCkpIHtcbiAgICAgICAgICAgIC8vIG5vIHNsb3BcbiAgICAgICAgICAgIHZhbCB2ID0gKHJhbmdlSGlnaCAtIHJhbmdlTG93KSAvIDIgKyByYW5nZUxvd1xuICAgICAgICAgICAgcmV0dXJuIGNvbnN0YW50KHYpXG4gICAgICAgIH1cbiAgICAgICAgdmFsIGludGVyc2VjdCA9IHJhbmdlTG93IC0gZG9tYWluLmxvd2VyRW5kICogc2xvcFxuICAgICAgICByZXR1cm4geyBpbnB1dCAtPlxuICAgICAgICAgICAgaWYgKFNlcmllc1V0aWwuaXNGaW5pdGUoaW5wdXQpKVxuICAgICAgICAgICAgICAgIGlucHV0ISEgKiBzbG9wICsgaW50ZXJzZWN0XG4gICAgICAgICAgICB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Brb3RsaW4ubWF0aC5tYXhcbmltcG9ydCBrb3RsaW4ubWF0aC5taW5cblxub2JqZWN0IFNjYWxlVXRpbCB7XG5cbiAgICBmdW4gbGFiZWxzKHNjYWxlOiBTY2FsZTwqPik6IExpc3Q8U3RyaW5nPiB7XG4gICAgICAgIGlmICghc2NhbGUuaGFzQnJlYWtzKCkpIHtcbiAgICAgICAgICAgIHJldHVybiBlbXB0eUxpc3QoKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGJyZWFrcyA9IHNjYWxlLmJyZWFrc1xuICAgICAgICBpZiAoc2NhbGUuaGFzTGFiZWxzKCkpIHtcbiAgICAgICAgICAgIHZhbCBsYWJlbHMgPSBzY2FsZS5sYWJlbHNcblxuICAgICAgICAgICAgaWYgKGJyZWFrcy5zaXplIDw9IGxhYmVscy5zaXplKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGxhYmVscy5zdWJMaXN0KDAsIGJyZWFrcy5zaXplKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgcmVzdWx0ID0gQXJyYXlMaXN0PFN0cmluZz4oKVxuICAgICAgICAgICAgZm9yIChpIGluIGJyZWFrcy5pbmRpY2VzKSB7XG4gICAgICAgICAgICAgICAgaWYgKGxhYmVscy5pc0VtcHR5KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LmFkZChcIlwiKVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdC5hZGQobGFiZWxzW2kgJSBsYWJlbHMuc2l6ZV0pXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGZvcm1hdHRlcjogKEFueSkgLT4gU3RyaW5nID0gc2NhbGUubGFiZWxGb3JtYXR0ZXIgPzogeyB2OiBBbnkgLT4gdi50b1N0cmluZygpIH1cbiAgICAgICAgL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3Q8RG91YmxlPigpXG4gICAgICAgIGZvciAoYnIgaW4gc2NhbGVCcmVha3MpIHtcbiAgICAgICAgICAgIHZhbCBtYXBwZWRCclBvaW50ID0gaWYgKGhvcml6b250YWwpXG4gICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKGJyISEsIDAuMClcbiAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IoMC4wLCBiciEhKVxuXG4gICAgICAgICAgICB2YWwgYXhpc0JyUG9pbnQgPSBjb29yZC50b0NsaWVudChtYXBwZWRCclBvaW50KVxuICAgICAgICAgICAgdmFsIGF4aXNCciA9IGlmIChob3Jpem9udGFsKVxuICAgICAgICAgICAgICAgIGF4aXNCclBvaW50LnhcbiAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICBheGlzQnJQb2ludC55XG5cbiAgICAgICAgICAgIGF4aXNCcmVha3MuYWRkKGF4aXNCcilcbiAgICAgICAgICAgIGlmICghYXhpc0JyLmlzRmluaXRlKCkpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oXG4gICAgICAgICAgICAgICAgICAgIFwiSWxsZWdhbCBheGlzICdcIiArIHNjYWxlLm5hbWUgKyBcIicgYnJlYWsgcG9zaXRpb24gXCIgKyBheGlzQnIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiIGF0IGluZGV4IFwiICsgKGF4aXNCcmVha3Muc2l6ZSAtIDEpICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIlxcbnNvdXJjZSBicmVha3MgICAgOiBcIiArIHNjYWxlLmJyZWFrcyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJcXG50cmFuc2xhdGVkIGJyZWFrczogXCIgKyBzY2FsZUJyZWFrcyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJcXG5heGlzIGJyZWFrcyAgICAgIDogXCIgKyBheGlzQnJlYWtzXG4g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FuZ2UoXG4gICAgICAgIG5hbWU6IFN0cmluZ1xuICAgICk6IFNjYWxlPERvdWJsZT4ge1xuICAgICAgICByZXR1cm4gQ29udGludW91c1NjYWxlPERvdWJsZT4oXG4gICAgICAgICAgICBuYW1lLFxuICAgICAgICAgICAgTWFwcGVycy51bmRlZmluZWQoKSxcbiAgICAgICAgICAgIHRydWVcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biA8VD4gY29udGludW91c0RvbWFpbihcbiAgICAgICAgbmFtZTogU3RyaW5nLFxuICAgICAgICBtYXBwZXI6IChEb3VibGU/KSAtPiBUPyxcbiAgICAgICAgY29udGludW91c1JhbmdlOiBCb29sZWFuXG4gICAgKTogU2NhbGU8VD4ge1xuICAgICAgICByZXR1cm4gQ29udGludW91c1NjYWxlPFQ+KG5hbWUsIG1hcHBlciwgY29udGludW91c1JhbmdlKVxuICAgIH1cblxuICAgIGZ1biA8VD4gZGlzY3JldGVEb21haW4obmFtZTogU3RyaW5nLCBkb21haW5WYWx1ZXM6IENvbGxlY3Rpb248QW55Pik6IFNjYWxlPFQ+IHtcbiAgICAgICAgcmV0dXJuIGRpc2NyZXRlRG9tYWluKFxuICAgICAgICAgICAgbmFtZSxcbiAgICAgICAgICAgIGRvbWFpblZhbHVlcyxcbiAgICAgICAgICAgIE1hcHBlcnMudW5kZWZpbmVkKClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biA8VD4gZGlzY3JldGVEb21haW4obmFtZTogU3RyaW5nLCBkb21haW5WYWx1ZXM6IENvbGxlY3Rpb248QW55PiwgbWFwcGVyOiAoKERvdWJsZT8pIC0+IFQ/KSk6IFNjYWxlPFQ+IHtcbiAgICAgICAgcmV0dXJuIERpc2NyZXRlU2NhbGUobmFtZSwgZG9tYWluVmFsdWVzLCBtYXBwZXIpXG4gICAgfVxuXG4gICAgZnVuIDxUPiBwdXJlRGlzY3JldGUoXG4gICAgICAgIG5hbWU6IFN0cmluZyxcbiAgICAgICAgZG9tYWluVm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dlRW5kLCBjb3VudCkuYnJlYWtzXG5cbiAgICAgICAgfSBlbHNlIHtcblxuICAgICAgICAgICAgdmFsIHN0YXJ0ID0gbm9ybWFsU3RhcnRcbiAgICAgICAgICAgIHZhbCBlbmQgPSBub3JtYWxFbmRcblxuICAgICAgICAgICAgdmFyIHRpY2tzOiBNdXRhYmxlTGlzdDxEb3VibGU+PyA9IG51bGxcbiAgICAgICAgICAgIGlmIChtaW5JbnRlcnZhbCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgdGlja3MgPSBtaW5JbnRlcnZhbC5yYW5nZShzdGFydCwgZW5kKS50b011dGFibGVMaXN0KClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKHRpY2tzICE9IG51bGwgJiYgdGlja3Muc2l6ZSA8PSBjb3VudCkge1xuICAgICAgICAgICAgICAgIC8vIHNhbWUgb3Igc21hbGxlciBpbnRlcnZhbCByZXF1ZXN0ZWQgLT4gc3RheSB3aXRoIG1pbiBpbnRlcnZhbFxuICAgICAgICAgICAgICAgIGZvcm1hdHRlciA9IG1pbkludGVydmFsISEudGlja0Zvcm1hdHRlclxuICAgICAgICAgICAgICAgIC8vIG90aGVyd2lzZSAtIGxhcmdlciBzdGVwIHJlcXVlc3RlZCAtPiBjb21wdXRlIHRpY2tzXG4gICAgICAgICAgICB9IGVsc2UgaWYgKHN0ZXAgPiBZZWFySW50ZXJ2YWwuTVMpIHsgICAgICAgIC8vIHllYXJzXG4gICAgICAgICAgICAgICAgZm9ybWF0dGVyID0gWWVhckludGVydmFsLlRJQ0tfRk9STUFUVEVSXG4gICAgICAgICAgICAgICAgdGlja3MgPSBBcnJheUxpc3QoKVxuICAgICAgICAgICAgICAgIHZhbCBzdGFydERhdGVUaW1lID0gVGltZVV0aWwuYXNEYXRlVGltZVVUQyhzdGFydClcbiAgICAgICAgICAgICAgICB2YXIgc3RhcnRZZWFyID0gc3RhcnREYXRlVGltZS55ZWFyXG4gICAgICAgICAgICAgICAgaWYgKHN0YXJ0RGF0ZVRpbWUuaXNBZnRlcihUaW1lVXRpbC55ZWFyU3RhcnQoc3RhcnRZZWFyKSkpIHtcbiAgICAgICAgICAgICAgICAgICAgc3RhcnRZZWFyKytcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdmFsIGVuZFllYXIgPSBUaW1lVXRpbC5hc0RhdGVUaW1lVVRDKGVuZCkueWVhclxuICAgICAgICAgICAgICAgIHZhbCBoZWxwZXIgPSBMaW5lYXJCcmVha3NIZWxwZXIoXG4gICAgICAgICAgICAgICAgICAgIHN0YXJ0WWVhci50b0RvdWJsZSgpLFxuICAgICAgICAgICAgICAgICAgICBlbmRZZWFyLnRvRG91YmxlKCksXG4gICAgICAgICAgICAgICAgICAgIGNvdW50XG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIGZvciAodGlja1llYXIgaW4gaGVscGVyLmJyZWFrcykge1xuICAgICAgICAgICAgICAgICAgICB2YWwgdGlja0RhdGUgPSBUaW1lVXRpbC55ZWFyU3RhcnQocm91bmQodGlja1llYXIpLnRvSW50KCkpXG4gICAgICAgICAgICAgICAgICAgIHRpY2tzLmFkZChUaW1lVXRpbC5hc0luc3RhbnRVVEModGlja0RhdGUpLnRvRG91YmxlKCkpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YWwgaW50ZXJ2YWwgPSBOaWNlVGltZUludGVydmFsLmZvck1pbGxpcyhzdGVwKVxuICAgICAgICAgICAgICAgIGZvcm1hdHRlciA9IGludGVydmFsLnRpY2tGb3JtYXR0ZXJcbiAgICAgICAgICAgICAgICB0aWNrcyA9IGludGVydmFsLnJhbmdlKHN0YXJ0LCBlbmQpLnRvTXV0YWJsZUxpc3QoKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoaXNSZXZlcnNlZCkge1xuICAgICAgICAgICAgICAgIHRpY2tzLnJldmVyc2UoKVxuICAgICAgICA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ogc3RlcCB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBjb21wdXRlTmljZUJyZWFrcyhub3JtYWxTdGFydCwgbm9ybWFsRW5kLCBzdGVwKVxuICAgICAgICB9XG5cbiAgICAgICAgdGhpcy5icmVha3MgPSBpZiAoYnJlYWtzLmlzRW1wdHkoKSkge1xuICAgICAgICAgICAgbGlzdE9mKG5vcm1hbFN0YXJ0KVxuICAgICAgICB9IGVsc2UgaWYgKGlzUmV2ZXJzZWQpIHtcbiAgICAgICAgICAgIGJyZWFrcy5hc1JldmVyc2VkKClcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGJyZWFrc1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHByaXZhdGUgZnVuIGNvbXB1dGVOaWNlU3RlcChcbiAgICAgICAgICAgIHNwYW46IERvdWJsZSxcbiAgICAgICAgICAgIGNvdW50OiBJbnRcbiAgICAgICAgKTogRG91YmxlIHtcbiAgICAgICAgICAgIC8vIGNvbXB1dGUgc3RlcCBzbyB0aGF0IGl0IGlzIG11bHRpcGxlIG9mIDEwLCA1IG9yIDIuXG4gICAgICAgICAgICB2YWwgc3RlcFJhdyA9IHNwYW4gLyBjb3VudFxuICAgICAgICAgICAgdmFsIHN0ZXAxMFBvd2VyID0gZmxvb3IobG9nMTAoc3RlcFJhdykpXG4gICAgICAgICAgICB2YWwgc3RlcCA9IDEwLjAucG93KHN0ZXAxMFBvd2VyKVxuICAgICAgICAgICAgdmFsIGVycm9yID0gc3RlcCAqIGNvdW50IC8gc3BhblxuICAgICAgICAgICAgcmV0dXJuIHdoZW4ge1xuICAgICAgICAgICAgICAgIGVycm9yIDw9IDAuMTUgLT4gc3RlcCAqIDEwLjBcbiAgICAgICAgICAgICAgICBlcnJvciA8PSAwLjM1IC0+IHN0ZXAgKiA1LjBcbiAgICAgICAgICAgICAgICBlcnJvciA8PSAwLjc1IC0+IHN0ZXAgKiAyLjBcbiAgICAgICAgICAgICAgICBlbHNlIC0+IHN0ZXBcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGNvbXB1dGVOaWNlQnJlYWtzKFxuICAgICAgICAgICAgc3RhcnQ6IERvdWJsZSxcbiAgICAgICAgICAgIGVuZDogRG91YmxlLFxuICAgICAgICAgICAgc3RlcDogRG91YmxlXG4gICAgICAgICk6IExpc3Q8RG91YmxlPiB7XG4gICAgICAgICAgICBpZiAoc3RlcCA9PSAwLjApIHJldHVybiBlbXB0eUxpc3QoKVxuXG4gICAgICAgICAgICAvLyBleHRlbmQgcmFuZ2UgdG8gYWxsb3cgZm9yIEZQIGVycm9yc1xuICAgICAgICAgICAgdmFsIGRlbHRhID0gc3RlcCAvIDEwMDAwXG4gICAgICAgICAgICB2YWwgc3RhcnRFID0gc3RhcnQgLSBkZWx0YVxuICAgICAgICAgICAgdmFsIGVuZEUgPSBlbmQgKyBkZWx0YVxuXG4gICAgICAgICAgICB2YWwgYnJlYWtzID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICAgICAgdmFyIHRpY2sgPSBjZWlsKHN0YXJ0RSAvIHN0ZXApICogc3RlcFxuICAgICAgICAgICAgaWYgKHN0YXJ0ID49IDAgJiYgc3RhcnRFIDwgMCkge1xuICAgICAgICAgICAgICAgIC8vIGF2b2lkIG5lZ2F0aXZlIHplcm9cbiAgICAgICAgICAgICAgICB0aWNrID0gMC4wXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB3aGlsZSAodGljayA8PSBlbmRFKSB7XG4gICAgICAgICAgICAgICAgLy8gZG9uJ3QgYWxsb3cgdGlja3MgdG8gZ28gYmV5b25kIHRoZSByYW5nZVxuICAgICAgICAgICAgICAgIHRpY2sgPSBtaW4odGljaywgZW5kKVxuXG4gICAgICAgICAgICAgICAgYnJlYWtzLmFkZCh0aWNrKVxuICAgICAgICAgICAgICAgIHRpY2sgKz0gc3RlcFxu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PV0lOR1wiKVxuICAgICAgICB2YXIgc3RlcCA9IGlmIChzdGVwID09IDAuMCkge1xuICAgICAgICAgICAgdmFsdWUgLyAxMFxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgYWJzKHN0ZXApXG4gICAgICAgIH1cblxuXG4gICAgICAgIHZhciB0eXBlID0gXCJmXCJcbiAgICAgICAgdmFyIGRlbGltaXRlciA9IFwiXCJcblxuICAgICAgICB2YWwgZG9tYWluMTBQb3dlciA9IGxvZzEwKGFicyh2YWx1ZSkpXG4gICAgICAgIHZhbCBzdGVwMTBQb3dlciA9IGxvZzEwKHN0ZXApXG5cbiAgICAgICAgdmFyIHByZWNpc2lvbiA9IC1zdGVwMTBQb3dlclxuICAgICAgICB2YXIgc2NpZW50aWZpY05vdGF0aW9uID0gZmFsc2VcbiAgICAgICAgaWYgKGRvbWFpbjEwUG93ZXIgPCAwICYmIHN0ZXAxMFBvd2VyIDwgLTQpIHtcbiAgICAgICAgICAgIHNjaWVudGlmaWNOb3RhdGlvbiA9IHRydWVcbiAgICAgICAgICAgIHR5cGUgPSBcImVcIlxuICAgICAgICAgICAgcHJlY2lzaW9uID0gZG9tYWluMTBQb3dlciAtIHN0ZXAxMFBvd2VyXG4gICAgICAgIH0gZWxzZSBpZiAoZG9tYWluMTBQb3dlciA+IDcgJiYgc3RlcDEwUG93ZXIgPiAyKSB7XG4gICAgICAgICAgICBzY2llbnRpZmljTm90YXRpb24gPSB0cnVlXG4gICAgICAgICAgICBwcmVjaXNpb24gPSBkb21haW4xMFBvd2VyIC0gc3RlcDEwUG93ZXJcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChwcmVjaXNpb24gPCAwKSB7XG4gICAgICAgICAgICBwcmVjaXNpb24gPSAwLjBcbiAgICAgICAgICAgIHR5cGUgPSBcImRcIlxuICAgICAgICB9XG4gICAgICAgIC8vIHJvdW5kLXVwIHByZWNpc2lvbiB1bGxlc3MgaXQncyB2ZXJ5IGNsb3NlIHRvIHNtYWx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mQsIHVwcGVyQm91bmQpO1xuICAgICAgbGlzdC5hZGQoYnVja2V0KTtcbiAgICB9XG4qLy8vQ2xvc2VkUmFuZ2U8RG91YmxlPiBidWNrZXQgPSBDbG9zZWRSYW5nZU9wZW4obXlEb21haW5TdGFydCArIGJ1Y2tldFNpemUgKiBpLCBteURvbWFpblN0YXJ0ICsgYnVja2V0U2l6ZSAqIChpICsgMSkpO1xuICAgIC8vIFRvRG86IG1vdmUgaW5zaWRlIHRoZSBjeWNsZVxuICAgIC8vIGxhc3QgYnVja2V0IC0gY2xvc2VkXG4gICAgdmFsIGRvbWFpblF1YW50aXplZDogTGlzdDxDbG9zZWRSYW5nZTxEb3VibGU+PlxuICAgICAgICBnZXQoKSB7XG4gICAgICAgICAgICBpZiAobXlEb21haW5TdGFydCA9PSBteURvbWFpbkVuZCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBsaXN0T2YoQ2xvc2VkUmFuZ2UobXlEb21haW5TdGFydCwgbXlEb21haW5FbmQpKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgbGlzdCA9IEFycmF5TGlzdDxDbG9zZWRSYW5nZTxEb3VibGU+PigpXG4gICAgICAgICAgICB2YWwgbnVtQnVja2V0cyA9IG15T3V0cHV0VmFsdWVzLnNpemVcbiAgICAgICAgICAgIHZhbCBidWNrZXRTaXplID0gYnVja2V0U2l6ZSgpXG4gICAgICAgICAgICBmb3IgKGkgaW4gMCB1bnRpbCBudW1CdWNrZXRzIC0gMSkge1xuICAgICAgICAgICAgICAgIHZhbCBidWNrZXQgPSBDbG9zZWRSYW5nZShteURvbWFpblN0YXJ0ICsgYnVja2V0U2l6ZSAqIGksIG15RG9tYWluU3RhcnQgKyBidWNrZXRTaXplICogKGkgKyAxKSlcbiAgICAgICAgICAgICAgICBsaXN0LmFkZChidWNrZXQpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YWwgYnVja2V0ID0gQ2xvc2VkUmFuZ2UobXlEb21haW5TdGFydCArIGJ1Y2tldFNpemUgKiAobnVtQnVja2V0cyAtIDEpLCBteURvbWFpbkVuZClcbiAgICAgICAgICAgIGxpc3QuYWRkKGJ1Y2tldClcbiAgICAgICAgICAgIHJldHVybiBsaXN0XG4gICAgICAgIH1cblxuICAgIC8qKlxuICAgICAqIFNldCB0aGUgc2NhbGUncyBpbnB1dCBkb21haW4uXG4gICAgICovXG4gICAgZnVuIGRvbWFpbihzdGFydDogRG91YmxlLCBlbmQ6IERvdWJsZSk6IFF1YW50aXplU2NhbGU8VD4ge1xuICAgICAgICByZXF1aXJlKHN0YXJ0IDw9IGVuZCkgeyBcIkRvbWFpbiBzdGFydCBtdXN0IGJlIGxlc3MgdGhlbiBkb21haW4gZW5kOiAkc3RhcnQgPiAkZW5kXCIgfVxuICAgICAgICBteUhhc0RvbWFpbiA9IHRydWVcbiAgICAgICAgbXlEb21haW5TdGFydCA9IHN0YXJ0XG4gICAgICAgIG15RG9tYWluRW5kID0gZW5kXG4gICAgICAgIHJldHVybiB0aGlzXG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogU2NhbGUncyBvdXRwdXQgJ3F1YW50aXplZCcgdmFsdWVzXG4gICAgICovXG4gICAgZnVuIHJhbmdlKHZhbHVlczogQ29sbGVjdGlvbjxUPik6IFF1YW50aXplU2NhbGU8VD4ge1xuICAgICAgICBteU91dHB1dFZhbHVlcyA9IEFycmF5TGlzdCh2YWx1ZXMpXG4gICAgICAgIHJldHVybiB0aGlzXG4gICAgfVxuXG4gICAgZnVuIHF1YW50aXplKHY6IERvdWJsZSk6IFQge1xuICAgICAgICB2YWwgaSA9IG91dHB1dEluZGV4KHYpXG4gICAgICAgIHJldHVybiBteU91dHB1dFZhbHVlc1tpXVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIG91dHB1dEluZGV4KHY6IERvdWJsZSk6IEludCB7XG4gICAgICAgIGNoZWNrKG15SGFzRG9tYWluKSB7IFwiRG9tYWluIG5vdCBkZWZpbmVkLlwiIH1cbiAg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JhbmdlPERvdWJsZT4sIHRhcmdldENvdW50OiBJbnQpOiBMaXN0PERvdWJsZT4ge1xuICAgICAgICAgICAgdmFsIGhlbHBlciA9IExpbmVhckJyZWFrc0hlbHBlcihcbiAgICAgICAgICAgICAgICBkb21haW4ubG93ZXJFbmQsXG4gICAgICAgICAgICAgICAgZG9tYWluLnVwcGVyRW5kLFxuICAgICAgICAgICAgICAgIHRhcmdldENvdW50XG4gICAgICAgICAgICApXG4gICAgICAgICAgICByZXR1cm4gaGVscGVyLmJyZWFrc1xuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gY3JlYXRlRm9ybWF0dGVyKGJyZWFrVmFsdWVzOiBMaXN0PERvdWJsZT4pOiAoQW55KSAtPiBTdHJpbmcge1xuICAgICAgICAgICAgdmFsIChyZWZlcmVuY2VWYWx1ZSwgc3RlcCkgPSB3aGVuIHtcbiAgICAgICAgICAgICAgICBicmVha1ZhbHVlcy5pc0VtcHR5KCkgLT4gUGFpcigwLjAsIDAuNSlcbiAgICAgICAgICAgICAgICBlbHNlIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHYgPSBtYXgoYWJzKGJyZWFrVmFsdWVzLmZpcnN0KCkpLCBhYnMoYnJlYWtWYWx1ZXMubGFzdCgpKSlcbiAgICAgICAgICAgICAgICAgICAgdmFsIHMgPSB3aGVuIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrVmFsdWVzLnNpemUgPT0gMSAtPiB2IC8gMTBcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgLT4gYWJzKGJyZWFrVmFsdWVzWzFdIC0gYnJlYWtWYWx1ZXNbMF0pXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgUGFpcih2LCBzKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIGZvcm1hdHRlciA9IE51bWVyaWNCcmVha0Zvcm1hdHRlcihcb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seVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gY3JlYXRlRm9ybWF0dGVycyhicmVha1ZhbHVlczogTGlzdDxEb3VibGU+KTogTGlzdDwoQW55KSAtPiBTdHJpbmc+IHtcbiAgICAgICAgICAgIGlmIChicmVha1ZhbHVlcy5pc0VtcHR5KCkpIHJldHVybiBlbXB0eUxpc3QoKVxuICAgICAgICAgICAgaWYgKGJyZWFrVmFsdWVzLnNpemUgPT0gMSkge1xuICAgICAgICAgICAgICAgIHZhbCBkb21haW5WYWx1ZSA9IGJyZWFrVmFsdWVzWzBdXG4gICAgICAgICAgICAgICAgdmFsIHN0ZXAgPSBkb21haW5WYWx1ZSAvIDEwXG4gICAgICAgICAgICAgICAgcmV0dXJuIGxpc3RPZihjcmVhdGVGb3JtYXR0ZXIoZG9tYWluVmFsdWUsIHN0ZXApKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBmb3JtYXQgZWFjaCB0aWNrIHdpdGggaXRzIG93biBmb3JtYXR0ZXJcbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIlVubmVjZXNzYXJ5VmFyaWFibGVcIilcbiAgICAgICAgICAgIHZhbCBmb3JtYXR0ZXJzOiBMaXN0PChBbnkpIC0+IFN0cmluZz4gPSBicmVha1ZhbHVlcy5tYXBJbmRleGVkIHsgaSwgY3VyclZhbHVlIC0+XG4gICAgICAgICAgICAgICAgdmFsIHN0ZXAgPSBhYnMoXG4gICAgICAgICAgICAgICAgICAgIHdoZW4gKGkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIDAgLT4gY3VyclZhbHVlIC0gYnJlYWtWYWx1ZXNbaSArIDFdXG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIC0+IGN1cnJWYWx1ZSAtIGJyZWFrVmFsdWVzW2kgLSAxXVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIGNyZWF0ZUZvcm1hdHRl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pIDogQmFzZVN0YXQoREVGX01BUFBJTkcpIHtcblxuICAgIC8vICAgIHZhciBhZGp1c3QgPSBERUZfQURKVVNUXG4vLyAgICB2YXIgbnggPSBERUZfTlxuLy8gICAgICAgIHNldChuKSB7XG4vLyAgICAgICAgICAgIGlmIChuID4gTUFYX04pIHtcbi8vICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcIlRoZSBpbnB1dCBOeCBcIiArIG4gKyBcIiA+IFwiICsgTUFYX04gKyBcImlzIHRvbyBsYXJnZSFcIilcbi8vICAgICAgICAgICAgfVxuLy8gICAgICAgICAgICBmaWVsZCA9IG5cbi8vICAgICAgICB9XG4vLyAgICB2YXIgbnkgPSBERUZfTlxuLy8gICAgICAgIHNldChuKSB7XG4vLyAgICAgICAgICAgIGlmIChuID4gTUFYX04pIHtcbi8vICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcIlRoZSBpbnB1dCBOeSBcIiArIG4gKyBcIiA+IFwiICsgTUFYX04gKyBcImlzIHRvbyBsYXJnZSFcIilcbi8vICAgICAgICAgICAgfVxuLy8gICAgICAgICAgICBmaWVsZCA9IG5cbi8vICAgICAgICB9XG4vLyAgICB2YXIgaXNDb250b3VyID0gREVGX0NPTlRPVVJcbi8vICAgIHZhciBiYW5kV2lkdGhNZXRob2Q6IERlbnNpdHlTdGF0LkJhbmRXaWR0aE1ldGhvZCA9XG4vLyAgICAgICAgRGVuc2l0eVN0YXQuQmFuZFdpZHRoTWV0aG9kLk5SRFxuLy8gICAgICAgIHNldChidykge1xuLy8gICAgICAgICAgICBmaWVsZCA9IGJ3XG4vLyAgICAgICAgICAgIGJhbmRXaWR0aHMgPSBudWxsXG4vLyAgICAgICAgfVxuLy8gICAgcHJpdmF0ZSB2YXIgbXlCaW5Db3VudCA9IERFRl9CSU5fQ09VTlRcbi8vICAgIHByaXZhdGUgdmFyIG15QmluV2lkdGg6IERvdWJs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dpZHRoRmluYWwuY291bnQsXG4gICAgICAgICAgICB5Q291bnRBbmRXaWR0aEZpbmFsLmNvdW50LFxuICAgICAgICAgICAgeENvdW50QW5kV2lkdGhGaW5hbC53aWR0aCxcbiAgICAgICAgICAgIHlDb3VudEFuZFdpZHRoRmluYWwud2lkdGgsXG4gICAgICAgICAgICBCaW5TdGF0VXRpbC53ZWlnaHRBdEluZGV4KGRhdGEpLFxuICAgICAgICAgICAgZGVuc2l0eU5vcm1hbGl6aW5nRmFjdG9yXG4gICAgICAgIClcblxuICAgICAgICByZXR1cm4gRGF0YUZyYW1lLkJ1aWxkZXIoKVxuICAgICAgICAgICAgLnB1dE51bWVyaWMoU3RhdHMuWCwgYmluc0RhdGEueClcbiAgICAgICAgICAgIC5wdXROdW1lcmljKFN0YXRzLlksIGJpbnNEYXRhLnkpXG4gICAgICAgICAgICAucHV0TnVtZXJpYyhTdGF0cy5DT1VOVCwgYmluc0RhdGEuY291bnQpXG4gICAgICAgICAgICAucHV0TnVtZXJpYyhTdGF0cy5ERU5TSVRZLCBiaW5zRGF0YS5kZW5zaXR5KVxuICAgICAgICAgICAgLmJ1aWxkKClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjb21wdXRlQmlucyhcbiAgICAgICAgeFZhbHVlczogTGlzdDxEb3VibGU/PixcbiAgICAgICAgeVZhbHVlczogTGlzdDxEb3VibGU/PixcbiAgICAgICAgeFN0YXJ0OiBEb3VibGUsXG4gICAgICAgIHlTdGFydDogRG91YmxlLFxuICAgICAgICBiaW5Db3VudFg6IEludCxcbiAgICAgICAgYmluQ291bnRZOiBJbnQsXG4gICAgICAgIGJpbldpZHRoOiBEb3VibGUsXG4gICAgICAgIGJpbkhlaWdodDogRG91YmxlLFxuICAgICAgICB3ZWlnaHRBdEluZGV4OiAoSW50KSAtPiBEb3VibGUsXG4gICAgICAgIGRlbnNpdHlOb3JtYWxpemluZ0ZhY3RvcjogRG91YmxlXG4gICAgKTogQmluczJkRGF0YSB7XG5cbiAgICAgICAgdmFyIHRvdGFsQ291bnQgPSAwLjBcbiAgICAgICAgdmFsIGNvdW50QnlCaW5JbmRleEtleSA9IEhhc2hNYXA8UGFpcjxJbnQsIEludD4sIE11dGFibGVEb3VibGU+KClcbiAgICAgICAgZm9yIChkYXRhSW5kZXggaW4geFZhbHVlcy5pbmRpY2VzKSB7XG4gICAgICAgICAgICB2YWwgeCA9IHhWYWx1ZXNbZGF0YUluZGV4XVxuICAgICAgICAgICAgdmFsIHkgPSB5VmFsdWVzW2RhdGFJbmRleF1cbiAgICAgICAgICAgIGlmICghU2VyaWVzVXRpbC5hbGxGaW5pdGUoeCwgeSkpIHtcbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFsIHdlaWdodCA9IHdlaWdodEF0SW5kZXgoZGF0YUluZGV4KVxuICAgICAgICAgICAgdG90YWxDb3VudCArPSB3ZWlnaHRcbiAgICAgICAgICAgIHZhbCBiaW5JbmRleFggPSBmbG9vcigoeCEhIC0geFN0YXJ0KSAvIGJpbldpZHRoKS50b0ludCgpXG4gICAgICAgICAgICB2YWwgYmluSW5kZXhZID0gZmxvb3IoKHkhISAtIHlTdGFydCkgLyBiaW5IZWlnaHQpLnRvSW50KClcbiAgICAgICAgICAgIHZhbCBiaW5JbmRleEtleSA9IFBhaXIoYmluSW5kZXhYLCBiaW5JbmRleFkpXG4gICAgICAgICAgICBpZiAoIWNvdW50QnlCaW5JbmRleEtleS5jb250YWluc0tleShiaW5JbmRleEtleSkpIHtcbiAgICAgICAgICAgICAgICBjb3VudEJ5QmluSW5kZXhLZXlbYmluSW5kZXhLZXldID0gTXV0YWJsZURvdWJsZSgwLjApXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb3VudEJ5QmluSW5kZXhLZXlbYmluSW5kZXhLZXldISEuZ2V0QW5kQWRkKHdlaWdodClcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCB4cyA9IEFycmF5TGlzdDxEb3VibGU+KClcbiAgICAgICAgdmFsIHlzID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICB2YWwgY291bnRzID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICB2YWwgZGVuc2l0aWVzID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuXG4gICAgICAgIHZhbCB4MCA9IHhTdGFydCArIGJpbldpZHRoIC8gMlxuICAgICAgICB2YWwgeTAgPSB5U3RhcnQgKyBiaW5IZWlnaHQgLyAyXG4gICAgICAgIGZvciAoeEluZGV4IGluIDAgdW50aWwgYmluQ291bnRYKSB7XG4gICAgICAgICAgICBmb3IgKHlJbmRleCBpbiAwIHVudGlsIGJpbkNvdW50WSkge1xuICAgICAgICAgICAgICAgIHZhbCBiaW5JbmRleEtleSA9IFBhaXIoeEluZGV4LCB5SW5kZXgpXG4gICAgICAgICAgICAgICAgdmFyIGNvdW50ID0gMC4wXG4gICAgICAgICAgICAgICAgaWYgKGNvdW50QnlCaW5JbmRleEtleS5jb250YWluc0tleShiaW5JbmRleEtleSkpIHtcbiAgICAgICAgICAgICAgICAgICAgY291bnQgPSBjb3VudEJ5QmluSW5kZXhLZXlbYmluSW5kZXhLZXldISEuZ2V0KClcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoZHJvcCAmJiBjb3VudCA9PSAwLjApIHtcbiAgICAgICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB4cy5hZGQoeDAgKyB4SW5kZXggKiBiaW5XaWR0aClcbiAgICAgICAgICAgICAgICB5cy5hZGQoeTAgKyB5SW5kZXggKiBiaW5IZWlnaHQpXG4gICAgICAgICAgICAgICAgY291bnRzLmFkZChjb3VudClcbiAgICAgICAgICAgICAgICB2YWwgZGVuc2l0eSA9IGNvdW50IC8gdG90YWxDb3VudCAqIGRlbnNpdHlOb3JtYWxpemluZ0ZhY3RvclxuICAgICAgICAgICAgICAgIGRlbnNpdGllcy5hZGQoZGVuc2l0eSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBCaW5zMmREYXRhKHhzLCB5cywgY291bnRzLCBkZW5zaXRpZXMpXG4gICAgfVxuXG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcblxuICAgICAgICBjb25zdCB2YWwgREVGX0JJTlMgPSAzMFxuICAgICAgICB2YWwgREVGX0JJTldJRFRIOiBEb3VibGU/ID0gbnVsbFxuICAgICAgICBjb25zdCB2YWwgREVGX0RST1AgPSB0cnVlXG5cbiAgICAgICAgcHJpdmF0ZSB2YWwgREVGX01BUFBJTkc6IE1hcDxBZXM8Kj4sIERhdGFGcmFtZS5WYXJpYWJsZT4gPSBtYXBPZihcbiAgICAgICAgICAgIEFlcy5YIHRvIFN0YXRzLlgsXG4gICAgICAgICAgICBBZXMuWSB0byBTdGF0cy5ZLFxuICAgICAgICAgICAgQWVzLkZJTEwgdG8gU3RhdHMuQ09VTlRcbiAgICAgICAgKVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGFkanVzdFJhbmdlSW5pdGlhbChyOiBDbG9zZWRSYW5nZTxEb3VibGU+KTogQ2xvc2VkUmFuZ2U8RG91YmxlPiB7XG4gICAgICAgICAgICAvLyBzcGFuIGNhbid0IGJlIDBcbiAgICAgICAgICAgIHJldHVybiBlbnN1cmVBcHBsaWNhYmxlUmFuZ2UocilcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGFkanVzdFJhbmdlRmluYWwocjogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgYmluV2lkdGg6IERvdWJsZSk6IENsb3NlZFJhbmdlPERvdWJsZT4ge1xuICAgICAgICAgICAgcmV0dXJuIGlmIChpc1N1YlRpbnkocikpIHtcbiAgICAgICAgICAgICAgICAvLyAwIHNwYW4gYWxsd2F5cyBiZWNvbWVzIDFcbiAgICAgICAgICAgICAgICBleHBhbmQociwgMC41LCAwLjUpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIEV4cGFuZCByYW5nZSBieSBoYWxmIG9mIGJpbiB3aWR0aCAoYXJiaXRyYXJ5IGNob2lzZSAtIGNhbiBiZSBhbnkgcG9zaXRpdmUgbnVtKSB0b1xuICAgICAgICAgICAgICAgIC8vIGF2b2lkIGRhdGEtcG9pbnRzIG9uIHRoZSBtYXJnaW5hbCBiaW4gbWFyZ2luZXMuXG4gICAgICAgICAgICAgICAgdmFsIGV4cCA9IGJpbldpZHRoIC8gMi4wXG4gICAgICAgICAgICAgICAgZXhwYW5kKHIsIGV4cCwgZXhwKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZGVuc2l0eU5vcm1hbGl6aW5nRmFjdG9yKFxuICAgICAgICAgICAgeFNwYW46IERvdWJsZSxcbiAgICAgICAgICAgIHlTcGFuOiBEb3VibGUsXG4gICAgICAgICAgICBjb3VudDogSW50XG4gICAgICAgICk6IERvdWJsZSB7XG4gICAgICAgICAgICAvLyBkZW5zaXR5IHNob3VsZCBpbnRlZ3JhdGUgdG8gMS4wXG4gICAgICAgICAgICB2YWwgYXJlYSA9IHhTcGFuICogeVNwYW5cbiAgICAgICAgICAgIHZhbCBiaW5BcmVhID0gYXJlYSAvIGNvdW50XG4gICAgICAgICAgICByZXR1cm4gMS4wIC8gYmluQXJlYVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY2xhc3MgQmluczJkRGF0YShcbiAgICAgICAgaW50ZXJuYWwgdmFsIHg6IExpc3Q8RG91YmxlPixcbiAgICAgICAgaW50ZXJuYWwgdmFsIHk6IExpc3Q8RG91YmxlPixcbiAgICAgICAgaW50ZXJuYWwgdmFsIGNvdW50OiBMaXN0PERvdWJsZT4sXG4gICAgICAgIGludGVybmFsIHZhbCBkZW5zaXR5OiBMaXN0PERvdWJsZT5cbiAgICApXG5cbiAgICBjbGFzcyBCaW5zMmRXZWlnaHRlZ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ICAgICAgdmFyIG1pbkRlbHRhID0gRG91YmxlLk1BWF9WQUxVRVxuICAgICAgICAgICAgdmFsIHggPSB4UG9zXG5cbiAgICAgICAgICAgIGZvciAoaSBpbiAwIHVudGlsIGJpbkNvdW50KSB7XG4gICAgICAgICAgICAgICAgdmFsIGJpbkxlZnQgPSBzdGFydFggKyBpICogYmluV2lkdGhcbiAgICAgICAgICAgICAgICB2YWwgZGVsdGE6IERvdWJsZVxuICAgICAgICAgICAgICAgIGlmICh4UG9zS2luZCA9PSBYUG9zS2luZC5DRU5URVIpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVsdGEgPSB4IC0gKGJpbkxlZnQgKyBiaW5XaWR0aCAvIDIpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHsgICAgICAgLy8gQk9VTkRBUllcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWluRGVsdGEgPSB4IC0gc3RhcnRYIC8vIGluaXQgc3RpbGxcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBkZWx0YSA9IHggLSAoYmluTGVmdCArIGJpbldpZHRoKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChhYnMoZGVsdGEpIDwgYWJzKG1pbkRlbHRhKSkge1xuICAgICAgICAgICAgICAgICAgICBtaW5EZWx0YSA9IGRlbHRhXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBtYXggb2Zmc2V0OiArLy0wLjUgYmluIHdpZHRoXG4gICAgICAgICAgICB2YWwgb2Zmc2V0ID0gbWluRGVsdGEgJSAoYmluV2lkdGggLyAyKVxuICAgICAgICAgICAgc3RhcnRYICs9IG9mZnNldFxuICAgICAgICB9XG5cbiAgICAgICAgLy8gZGVuc2l0eSBwbG90IGFyZWEgc2hvdWxkIGJlID09IDFcbiAgICAgICAgdmFsIG5vcm1hbEJpbldpZHRoID0gU2VyaWVzVXRpbC5zcGFuKHJhbmdlWCkgLyBiaW5Db3VudFxuICAgICAgICB2YWwgZGVuc2l0eU5vcm1hbGl6aW5nRmFjdG9yID0gaWYgKG5vcm1hbEJpbldpZHRoID4gMClcbiAgICAgICAgICAgIDEuMCAvIG5vcm1hbEJpbldpZHRoXG4gICAgICAgIGVsc2VcbiAgICAgICAgICAgIDEuMFxuXG4gICAgICAgIC8vIGNvbXB1dGUgYmluc1xuXG4gICAgICAgIHZhbCBiaW5zRGF0YSA9IEJpblN0YXRVdGlsLmNvbXB1dGVCaW5zKFxuICAgICAgICAgICAgdmFsdWVzWCxcbiAgICAgICAgICAgIHN0YXJ0WCxcbiAgICAgICAgICAgIGJpbkNvdW50LFxuICAgICAgICAgICAgYmluV2lkdGgsXG4gICAgICAgICAgICBCaW5TdGF0VXRpbC53ZWlnaHRBdEluZGV4KGRhdGEpLFxuICAgICAgICAgICAgZGVuc2l0eU5vcm1hbGl6aW5nRmFjdG9yXG4gICAgICAgIClcbiAgICAgICAgY2hlY2soYmluc0RhdGEueC5zaXplID09IGJpbkNvdW50KVxuICAgICAgICB7IFwiSW50ZXJuYWw6IHN0YXQgZGF0YSBzaXplPVwiICsgYmluc0RhdGEueC5zaXplICsgXCIgZXhwZWN0ZWQgYmluIGNvdW50PVwiICsgYmluQ291bnQgfVxuXG4gICAgICAgIHJldHVybiBiaW5zRGF0YVxuICAgIH1cblxuICAgIGVudW0gY2xhc3MgWFBvc0tpbmQge1xuICAgICAgICBOT05FLCBDRU5URVIsIEJPVU5EQVJZXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGNvbnN0IHZhbCBERUZfQklOX0NPVU5UID0gMzBcblxuICAgICAgICBwcml2YXRlIHZhbCBERUZfTUFQUElORzogTWFwPEFlczwqPiwgRGF0YUZyYW1lLlZhcmlhYmxlPiA9IG1hcE9mKFxuICAgICAgICAgICAgQWVzLlggdG8gU3RhdHMuWCxcb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Chjb3VudCkudG9JbnQoKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgYmluV2lkdGggPSBkYXRhUmFuZ2UgLyBiaW5Db3VudFxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBDb3VudEFuZFdpZHRoKGJpbkNvdW50LCBiaW5XaWR0aClcbiAgICB9XG5cbiAgICBmdW4gY29tcHV0ZUJpbnMoXG4gICAgICAgIHZhbHVlc1g6IExpc3Q8RG91YmxlPz4sXG4gICAgICAgIHN0YXJ0WDogRG91YmxlLFxuICAgICAgICBiaW5Db3VudDogSW50LFxuICAgICAgICBiaW5XaWR0aDogRG91YmxlLFxuICAgICAgICB3ZWlnaHRBdEluZGV4OiAoSW50KSAtPiBEb3VibGUsXG4gICAgICAgIGRlbnNpdHlOb3JtYWxpemluZ0ZhY3RvcjogRG91YmxlXG4gICAgKTogQmluc0RhdGEge1xuXG4gICAgICAgIHZhciB0b3RhbENvdW50ID0gMC4wXG4gICAgICAgIHZhbCBjb3VudEJ5QmluSW5kZXggPSBIYXNoTWFwPEludCwgTXV0YWJsZURvdWJsZT4oKVxuLy8gICAgICAgIHZhbCBkYXRhSW5kaWNlc0J5QmluSW5kZXggPSBIYXNoTWFwPEludCwgTXV0YWJsZUxpc3Q8SW50Pj4oKVxuICAgICAgICBmb3IgKGRhdGFJbmRleCBpbiB2YWx1ZXNYLmluZGljZXMpIHtcbiAgICAgICAgICAgIHZhbCB4ID0gdmFsdWVzWFtkYXRhSW5kZXhdXG4gICAgICAgICAgICBpZiAoIVNlcmllc1V0aWwuaXNGaW5pdGUoeCkpIHtcbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFsIHdlaWdodCA9IHdlaWdodEF0SW5kZXgoZGF0YUluZGV4KVxuICAgICAgICAgICAgdG90YWxDb3VudCArPSB3ZWlnaHRcbiAgICAgICAgICAgIHZhbCBiaW5JbmRleCA9IGZsb29yKCh4ISEgLSBzdGFydFgpIC8gYmluV2lkdGgpLnRvSW50KClcbiAgICAgICAgICAgIGlmICghY291bnRCeUJpbkluZGV4LmNvbnRhaW5zS2V5KGJpbkluZGV4KSkge1xuICAgICAgICAgICAgICAgIGNvdW50QnlCaW5JbmRleFtiaW5JbmRleF0gPSBNdXRhYmxlRG91YmxlKDAuMClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvdW50QnlCaW5JbmRleFtiaW5JbmRleF0hIS5nZXRBbmRBZGQod2VpZ2h0KVxuXG4vLyAgICAgICAgICAgIGlmICghZGF0YUluZGljZXNCeUJpbkluZGV4LmNvbnRhaW5zS2V5KGJpbkluZGV4KSkge1xuLy8gICAgICAgICAgICAgICAgZGF0YUluZGljZXNCeUJpbkluZGV4W2JpbkluZGV4XSA9IEFycmF5TGlzdCgpXG4vLyAgICAgICAgICAgIH1cblxuLy8gICAgICAgICAgICBkYXRhSW5kaWNlc0J5QmluSW5kZXhbYmluSW5kZXhdISEuYWRkKGRhdGFJbmRleClcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCB4ID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICB2YWwgY291bnRzID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICB2YWwgZGVuc2l0aWVzID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuXG4gICAgICAgIHZhbCB4MCA9IHN0YXJ0WCArIGJpbldpZHRoIC8gMlxuICAgICAgICBmb3IgKGkgaW4gMCB1bnRpbCBiaW5Db3VudCkge1xuICAgICAgICAgICAgeC5hZGQoeDAgKyBpICogYmluV2lkdGgpXG5cbiAgICAgICAgICAgIHZhciBjb3VudCA9IDAuMFxuICAgICAgICAgICAgLy8gc29tZSBiaW5zIGFyZSBsZWZ0IGVtcHR5IChub3QgZXhjbHVkZWQgZnJvbSBtYXApXG4gICAgICAgICAgICBpZiAoY291bnRCeUJpbkluZGV4LmNvbnRhaW5zS2V5KGkpKSB7XG4gICAgICAgICAgICAgICAgY291bnQgPS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cy5YIHRvIFN0YXRzLlgsXG4gICAgICAgICAgICBBZXMuWSB0byBTdGF0cy5ZLFxuICAgICAgICAgICAgQWVzLllNSU4gdG8gU3RhdHMuWV9NSU4sXG4gICAgICAgICAgICBBZXMuWU1BWCB0byBTdGF0cy5ZX01BWCxcbiAgICAgICAgICAgIEFlcy5MT1dFUiB0byBTdGF0cy5MT1dFUixcbiAgICAgICAgICAgIEFlcy5NSURETEUgdG8gU3RhdHMuTUlERExFLFxuICAgICAgICAgICAgQWVzLlVQUEVSIHRvIFN0YXRzLlVQUEVSXG4gICAgICAgIClcblxuICAgICAgICBmdW4gYnVpbGRTdGF0KFxuICAgICAgICAgICAgeHM6IExpc3Q8RG91YmxlPz4sXG4gICAgICAgICAgICB5czogTGlzdDxEb3VibGU/PixcbiAgICAgICAgICAgIHdoaXNrZXJJUVJSYXRpbzogRG91YmxlXG4gICAgICAgICk6IE11dGFibGVNYXA8RGF0YUZyYW1lLlZhcmlhYmxlLCBMaXN0PERvdWJsZT4+IHtcblxuICAgICAgICAgICAgdmFsIHh5UGFpcnMgPSB4cy56aXAoeXMpLmZpbHRlciB7ICh4LCB5KSAtPlxuICAgICAgICAgICAgICAgIFNlcmllc1V0aWwuYWxsRmluaXRlKHgsIHkpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoeHlQYWlycy5pc0VtcHR5KCkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbXV0YWJsZU1hcE9mKClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIGJpbm5lZERhdGE6IE11dGFibGVNYXA8RG91YmxlLCBNdXRhYmxlTGlzdDxEb3VibGU+PiA9IEhhc2hNYXAoKVxuICAgICAgICAgICAgZm9yICgoeCwgeSkgaW4geHlQYWlycykge1xuICAgICAgICAgICAgICAgIGJpbm5lZERhdGEuZ2V0T3JQdXQoeCEhKSB7IEFycmF5TGlzdCgpIH0uYWRkKHkhISlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIHN0YXRYID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICAgICAgdmFsIHN0YXRZID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICAgICAgdmFsIHN0YXRNaWRkbGUgPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgICAgICB2YWwgc3RhdExvd2VyID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICAgICAgdmFsIHN0YXRVcHBlciA9IEFycmF5TGlzdDxEb3VibGU+KClcbiAgICAgICAgICAgIHZhbCBzdGF0TWluID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICAgICAgdmFsIHN0YXRNYXggPSBBcnJheUxpc3Q8RG91YmxlPigpXG5cbiAgICAgICAgICAgIHZhbCBzdGF0Q291bnQgPSBBcnJheUxpc3Q8RG91YmxlPigpXG5cbiAgICAgICAgICAgIGZvciAoKHgsIGJpbikgaW4gYmlubmVkRGF0YSkge1xuICAgICAgICAgICAgICAgIHZhbCBjb3VudCA9IGJpbi5zaXplLnRvRG91YmxlKClcblxuICAgICAgICAgICAgICAgIHZhbCBzdW1tYXJ5ID0gRml2ZU51bWJlclN1bW1hcnkoYmluKVxuICAgICAgICAgICAgICAgIHZhbCBtaWRkbGUgPSBzdW1tYXJ5Lm1lZGlhblxuICAgICAgICAgICAgICAgIHZhbCBsb3dlckhpbmdlID0gc3VtbWFyeS5maXJzdFF1YXJ0aWxlXG4gICAgICAgICAgICAgICAgdmFsIHVwcGVySGluZ2UgPSBzdW1tYXJ5LnRoaXJkUXVhcnRpbGVcbiAgICAgICAgICAgICAgICB2YWwgSVFSID0gdXBwZXJIaW5nZSAtIGxvd2VySGluZ2VcbiAgICAgICAgICAgICAgICB2YWwgbG93ZXJGZW5jZSA9IGxvd2VySGluZ2UgLSBJUVIgKiB3aGlza2VySVFSUmF0aW9cbiAgICAgICAgICAgICAgICB2YWwgdXBwZXJGZW5jZSA9IHVwcGVySGluZ2UgKyBJUVIgKiB3aGlza2VySVFSUmF0aW9cblxuICAgICAgICAgICAgICAgIHZhciBsb3dlcldoaXNrZXIgPSBsb3dlckZlbmNlXG4gICAgICAgICAgICAgICAgdmFyIHVwcGVyV2hpc2tlciA9IHVwcGVyRmVuY2VcbiAgICAgICAgICAgICAgICBpZiAoU2VyaWVzVXRpbC5hbGxGaW5pdGUobG93ZXJGZW5jZSwgdXBwZXJGZW5jZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIGJveGVkID0gYmluLmZpbHRlciB7IHkgLT4geSA+PSBsb3dlckZlbmNlICYmIHkgPD0gdXBwZXJGZW5jZSB9XG4gICAgICAgICAgICAgICAgICAgIHZhbCByYW5nZSA9IFNlcmllc1V0aWwucmFuZ2UoYm94ZWQpXG4gICAgICAgICAgICAgICAgICAgIGlmIChyYW5nZSAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb3dlcldoaXNrZXIgPSByYW5nZS5sb3dlckVuZFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBwZXJXaGlza2VyID0gcmFuZ2UudXBwZXJFbmRcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIGFkZCBvdXRsaWVycyBmaXJzdFxuICAgICAgICAgICAgICAgIHZhbCBvdXRsaWVycyA9IGJpbi5maWx0ZXIgeyB5IC0+IHkgPCBsb3dlckZlbmNlIHx8IHkgPiB1cHBlckZlbmNlIH1cbiAgICAgICAgICAgICAgICBmb3IgKHkgaW4gb3V0bGllcnMpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gJ291dGxpZXInIGRhdGEtcG9pbnRcbiAgICAgICAgICAgICAgICAgICAgc3RhdFguYWRkKHgpXG4gICAgICAgICAgICAgICAgICAgIHN0YXRZLmFkZCh5KVxuICAgICAgICAgICAgICAgICAgICAvLyBubyAnYm94JyBkYXRhXG4gICAgICAgICAgICAgICAgICAgIHN0YXRNaWRkbGUuYWRkKERvdWJsZS5OYU4pXG4gICAgICAgICAgICAgICAgICAgIHN0YXRMb3dlci5hZGQoRG91YmxlLk5hTilcbiAgICAgICAgICAgICAgICAgICAgc3RhdFVwcGVyLmFkZChEb3VibGUuTmFOKVxuICAgICAgICAgICAgICAgICAgICBzdGF0TWluLmFkZChEb3VibGUuTmFOKVxuICAgICAgICAgICAgICAgICAgICBzdGF0TWF4LmFkZChEb3VibGUuTmFOKVxuXG4gICAgICAgICAgICAgICAgICAgIHN0YXRDb3VudC5hZGQoY291bnQpXG5cbiAgICAgICAgICAgICAgICAgICAgLy8gTm90ZTogb3V0bGllcnMgd2lsbCBhbHNvIG5lZWQgJ3dpZHRoJyB2YWx1ZSxcbiAgICAgICAgICAgICAgICAgICAgLy8gZm9yIHRoZSAnZG9kZ2UnIHBvc2l0aW9uaW5nIHRvIHdvcmsgY29ycmVjdGx5IGZvciBhbGwgZGF0YS1wb2ludHMuXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gYWRkICdib3gnIGRhdGEtcG9pbnRcbiAgICAgICAgICAgICAgICBzdGF0WC5hZGQoeClcbiAgICAgICAgICAgICAgICBzdGF0WS5hZGQoRG91YmxlLk5hTikgIC8vIG5vIFkgZm9yICdib3gnIGRhdGEtcG9pbnRcbiAgICAgICAgICAgICAgICBzdGF0TWlkZGxlLmFkZChtaWRkbGUpXG4gICAgICAgICAgICAgICAgc3RhdExvd2VyLmFkZChsb3dlckhpbmdlKVxuICAgICAgICAgICAgICAgIHN0YXRVcHBlci5hZGQodXBwZXJIaW5nZSlcbiAgICAgICAgICAgICAgICBzdGF0TWluLmFkZChsb3dlcldoaXNrZXIpXG4gICAgICAgICAgICAgICAgc3RhdE1heC5hZGQodXBwZXJXaGlza2VyKVxuXG4gICAgICAgICAgICAgICAgc3RhdENvdW50LmFkZChjb3VudClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG11dGFibGVNYXBPZihcbiAgICAgICAgIC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lzdDxEb3VibGU+KClcbiAgICBwcml2YXRlIHZhbCBteUNvbnRvdXJHcm91cCA9IEFycmF5TGlzdDxEb3VibGU+KClcblxuICAgIHByaXZhdGUgdmFyIG15R3JvdXAgPSAwLjBcblxuICAgIHByaXZhdGUgdmFsIGRhdGFGcmFtZTogRGF0YUZyYW1lXG4gICAgICAgIGdldCgpID0gRGF0YUZyYW1lLkJ1aWxkZXIoKVxuICAgICAgICAgICAgICAgIC5wdXROdW1lcmljKFN0YXRzLlgsIG15Q29udG91clgpXG4gICAgICAgICAgICAgICAgLnB1dE51bWVyaWMoU3RhdHMuWSwgbXlDb250b3VyWSlcbiAgICAgICAgICAgICAgICAucHV0TnVtZXJpYyhTdGF0cy5MRVZFTCwgbXlDb250b3VyTGV2ZWwpXG4gICAgICAgICAgICAgICAgLnB1dE51bWVyaWMoU3RhdHMuR1JPVVAsIG15Q29udG91ckdyb3VwKVxuICAgICAgICAgICAgICAgIC5idWlsZCgpXG5cbiAgICBmdW4gYWRkKHBvbHlnb246IExpc3Q8RG91YmxlVmVjdG9yPiwgZmlsbExldmVsOiBEb3VibGUpIHtcbiAgICAgICAgZm9yIChwIGluIHBvbHlnb24pIHtcbiAgICAgICAgICAgIG15Q29udG91clguYWRkKHAueClcbiAgICAgICAgICAgIG15Q29udG91clkuYWRkKHAueSlcbiAgICAgICAgICAgIG15Q29udG91ckxldmVsLmFkZChmaWxsTGV2ZWwpXG4gICAgICAgICAgICBteUNvbnRvdXJHcm91cC5hZGQobXlHcm91cClcbiAgICAgICAgfVxuICAgICAgICAvLyBlYWNoIHBvbHlnb24gaW4gaXRzIG93biBncm91cFxuICAgICAgICBteUdyb3VwICs9IDEuMFxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuXG4gICAgICAgIGZ1biBnZXRQYXRoRGF0YUZyYW1lKFxuICAgICAgICAgICAgICAgIGxldmVsczogTGlzdDxEb3VibGU+LCBwYXRoTGlzdEJ5TGV2ZWw6IE1hcDxEb3VibGUsIExpc3Q8TGlzdDxEb3VibGVWZWN0b3I+Pj4pOiBEYXRhRnJhbWUge1xuICAgICAgICAgICAgdmFsIGNvbnRvdXIgPSBDb250b3VyKClcbiAgICAgICAgICAgIGZvciAobGV2ZWwgaW4gbGV2ZWxzKSB7XG4gICAgICAgICAgICAgICAgdmFsIHBhdGhzID0gcGF0aExpc3RCeUxldmVsW2xldmVsXSEhXG4gICAgICAgICAgICAgICAgZm9yIChwYXRoIGluIHBhdGhzKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnRvdXIuYWRkKHBhdGgsIGxldmVsKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBjb250b3VyLmRhdGFGcmFtZVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGdldFBvbHlnb25EYXRhRnJhbWUoXG4gICAgICAgICAgICAgICAgZmlsbExldmVsczogTGlzdDxEb3VibGU+LCBwb2x5Z29uTGlzdEJ5RmlsbExldmVsOiBNYXA8RG91YmxlLCBMaXN0PERvdWJsZVZlY3Rvcj4+KTogRGF0YUZyYW1lIHtcbiAgICAgICAgICAgIHZhbCBjb250b3VyID0gQ29udG91cigpXG5cbiAgICAgICAgICAgIGZvciAoZmlsbExldmVsIGluIGZpbGxMZXZlbHMpIHtcbiAgICAgICAgICAgICAgICB2YWwgcG9seWdvbiA9IHBvbHlnb25MaXN0QnlGaWxsTGV2ZWxbZmlsbExldmVsXSEhXG4gICAgICAgICAgICAgICAgY29udG91ci5hZGQocG9seWdvbiwgZmlsbExldmVsKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gY29udG91ci5kYXRhRnJhbWVcbiAgICAgICAgfVxuICAgIH1cblxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JV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G4gICAgICAgICAgICB2YWwgdmFsdWUgPSBBcnJheUxpc3Q8RG91YmxlVmVjdG9yPigpXG4gICAgICAgICAgICBpZiAoaSA+IDApIHtcbiAgICAgICAgICAgICAgICBwb2x5Z29uUGllY2VzLmFkZEFsbChcbiAgICAgICAgICAgICAgICAgICAgcmV2ZXJzZUFsbChcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhdGhCeUxldmVsc1tsZXZlbHNbaSAtIDFdXSEhXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaSA8IG4pIHtcbiAgICAgICAgICAgICAgICBwb2x5Z29uUGllY2VzLmFkZEFsbChwYXRoQnlMZXZlbHNbbGV2ZWxzW2ldXSEhKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcG9seWdvblBpZWNlcyA9IGNyZWF0ZUNsb3NlZFBvbHlnb25MZXZlbHMocG9seWdvblBpZWNlcywgb3V0ZXJNYXAsIGNvcm5lclBvaW50cylcbiAgICAgICAgICAgIGZvciAocGF0aCBpbiBwb2x5Z29uUGllY2VzKSB7XG4gICAgICAgICAgICAgICAgdmFsdWUuYWRkQWxsKHBhdGgpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXN1bHRbZmlsbExldmVsc1tpXV0gPSB2YWx1ZVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjcmVhdGVDbG9zZWRQb2x5Z29uTGV2ZWxzKFxuICAgICAgICAgICAgb3BlbkxldmVsczogTGlzdDxMaXN0PERvdWJsZVZlY3Rvcj4+LCBvdXRlck1hcDogTWFwPERvdWJsZVZlY3RvciwgRG91YmxlVmVjdG9yPiwgY29ybmVyUG9pbnRzOiBMaXN0PERvdWJsZVZlY3Rvcj4pOiBNdXRhYmxlTGlzdDxMaXN0PERvdWJsZVZlY3Rvcj4+IHtcbiAgICAgICAgdmFsIHJlc3VsdCA9IEFycmF5TGlzdDxMaXN0PERvdWJsZVZlY3Rvcj4+KClcblxuICAgICAgICB2YWwgZG9uZVBhdGggPSBIYXNoU2V0PE11dGFibGVMaXN0PERvdWJsZVZlY3Rvcj4+KClcbiAgICAgICAgLy9BZGQgYm91bmRhcnkgcGFydCB0byBlYWNoIG9wZW5QYXRoXG4gICAgICAgIGZvciAobGV2ZWwgaW4gb3BlbkxldmVscykge1xuICAgICAgICAgICAgdmFsIGxldmVsQ29weSA9IEFycmF5TGlzdChsZXZlbClcbiAgICAgICAgICAgIHZhbCBwMCA9IGxldmVsQ29weVswXVxuICAgICAgICAgICAgdmFyIHAxID0gbGV2ZWxDb3B5W2xldmVsQ29weS5zaXplIC0gMV1cbiAgICAgICAgICAgIC8vaWYgY3ljbGVcbiAgICAgICAgICAgIGlmIChwMCA9PSBwMSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5hZGQobGV2ZWxDb3B5KVxuICAgICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvL3AxIHJlbWFpbnMgdG8gYmUgdGhlIGVuZCBvZiBsZXZlbENvcHlcbiAgICAgICAgICAgIHZhciBwaTIgPSBvdXRlck1hcFtwMV0hIVxuICAgICAgICAgICAgbGV2ZWxDb3B5LmFkZChwaTIpXG4gICAgICAgICAgICBwMSA9IHBpMlxuICAgICAgICAgICAgd2hpbGUgKGNvcm5lclBvaW50cy5jb250YWlucyhwMSkpIHtcbiAgICAgICAgICAgICAgICBwaTIgPSBvdXRlck1hcFtwMV0hIVxuICAgICAgICAgICAgICAgIGxldmVsQ29weS5hZGQocGkyKVxuICAgICAgICAgICAgICAgIHAxID0gcGkyXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkb25lUGF0aC5hZGQobGV2ZWxDb3B5KVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHBhdGhCeUVuZFBvaW50ID0gSGFzaE1hcDxEb3VibGVWZWN0b3IsIE11dGFibGVMaXN0PERvdWJsZVZlY3Rvcj4+KClcblxuICAgICAgICBmb3IgKHBhdGggaW4gZG9uZVBhdGgpIHtcbiAgICAgICAgICAgIHZhbCBwMCA9IHBhdGhbMF1cbiAgICAgICAgICAgIHZhbCBwMSA9IHBhdGhbcGF0aC5zaXplIC0gMV1cbiAgICAgICAgICAgIC8vaWYgY3ljbGVcbiAgICAgICAgICAgIGlmIChwMCA9PSBwMSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5hZGQocGF0aClcbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAocGF0aEJ5RW5kUG9pbnQuY29udGFpbnNLZXkocDApIHx8IHBhdGhCeUVuZFBvaW50LmNvbnRhaW5zS2V5KHAxKSkge1xuICAgICAgICAgICAgICAgIC8vcmVtb3ZlIG5lZWQgdG8gYmUgbW9kaWZpZWQgcGF0aHNcbiAgICAgICAgICAgICAgICB2YWwgcGF0aDAgPSBwYXRoQnlFbmRQb2ludFtwMF1cbiAgICAgICAgICAgICAgICB2YWwgcGF0aDEgPSBwYXRoQnlFbmRQb2ludFtwMV1cbiAgICAgICAgICAgICAgICByZW1vdmVQYXRoQnlFbmRwb2ludHMocGF0aDAsIHBhdGhCeUVuZFBvaW50KVxuICAgICAgICAgICAgICAgIHJlbW92ZVBhdGhCeUVuZHBvaW50cyhwYXRoMSwgcGF0aEJ5RW5kUG9pbnQpXG5cbiAgICAgICAgICAgICAgICB2YWwgbG9uZ1BhdGg6IE11dGFibGVMaXN0PERvdWJsZVZlY3Rvcj5cbiAgICAgICAgICAgICAgICBpZiAocGF0aDAgPT09IHBhdGgxKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vYSBjeWNsZSBpcyBmb3JtZWRcbiAgICAgICAgICAgICAgICAgICAgcGF0aDAhIS5hZGRBbGwocGF0aC5zdWJMaXN0KDEsIHBhdGguc2l6ZSkpXG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdC5hZGQocGF0aDApXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwYXRoMCAhPSBudWxsICYmIHBhdGgxICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGggPSBwYXRoMFxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aC5hZGRBbGwocGF0aC5zdWJMaXN0KDEsIHBhdGguc2l6ZSAtIDEpKVxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aC5hZGRBbGwocGF0aDEpXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwYXRoMCA9PSBudWxsKSB7IC8vcGF0aDEhPW51bGxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGggPSBwYXRoMSEhXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZEFsbCgwLCBwYXRoLnN1Ykxpc3QoMCwgcGF0aC5zaXplIC0gMSkpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHsgLy9wYXRoMCE9bnVsbFxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aCA9IHBhdGgwXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZEFsbChwYXRoLnN1Ykxpc3QoMSwgcGF0aC5zaXplKSlcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludFtsb25nUGF0aFswXV0gPSBsb25nUGF0aFxuICAgICAgICAgICAgICAgIHBhdGhCeUVuZFBvaW50W2xvbmdQYXRoW2xvbmdQYXRoLnNpemUgLSAxXV0gPSBsb25nUGF0aFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludFtwYXRoWzBdXSA9IHBhdGhcbiAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludFtwYXRoW3BhdGguc2l6ZSAtIDFdXSA9IHBhdGhcbiAgICAgIC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ICAgICAgICAgICAgIHBvaW50cy5hZGQocGF0aFtwYXRoLnNpemUgLSAxXSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCByZXN1bHQgPSBIYXNoTWFwPERvdWJsZVZlY3RvciwgRG91YmxlVmVjdG9yPigpXG5cbiAgICAgICAgdmFsIGxpc3QgPSBBcnJheUxpc3Q8TXV0YWJsZUxpc3Q8RG91YmxlVmVjdG9yPj4oKVxuICAgICAgICBmb3IgKGkgaW4gMC4uMykge1xuICAgICAgICAgICAgbGlzdC5hZGQoQXJyYXlMaXN0KCkpXG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKHBvaW50IGluIHBvaW50cykge1xuICAgICAgICAgICAgdmFsIGtpbmQgPSBnZXRLaW5kKHBvaW50KVxuICAgICAgICAgICAgd2hlbiAoa2luZCkge1xuICAgICAgICAgICAgICAgIEJvcmRlcktpbmQuRE9XTiAtPiBsaXN0WzBdLmFkZChwb2ludClcbiAgICAgICAgICAgICAgICBCb3JkZXJLaW5kLlJJR0hUIC0+IGxpc3RbMV0uYWRkKHBvaW50KVxuICAgICAgICAgICAgICAgIEJvcmRlcktpbmQuVVAgLT4gbGlzdFsyXS5hZGQocG9pbnQpXG4gICAgICAgICAgICAgICAgQm9yZGVyS2luZC5MRUZUIC0+IGxpc3RbM10uYWRkKHBvaW50KVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgbGlzdFswXS5zb3J0V2l0aChDb21wYXJhdG9yIHsgbzEsIG8yIC0+IG8xLnguY29tcGFyZVRvKG8yLngpIH0pXG4gICAgICAgIGxpc3RbMV0uc29ydFdpdGgoQ29tcGFyYXRvciB7IG8xLCBvMiAtPiBvMS55LmNvbXBhcmVUbyhvMi55KSB9KVxuICAgICAgICBsaXN0WzJdLnNvcnRXaXRoKENvbXBhcmF0b3IgeyBvMSwgbzIgLT4gbzIueC5jb21wYXJlVG8obzEueCkgfSlcbiAgICAgICAgbGlzdFszXS5zb3J0V2l0aChDb21wYXJhdG9yIHsgbzEsIG8yIC0+IG8yLnkuY29tcGFyZVRvKG8xLnkpIH0pXG5cbiAgICAgICAgLy8gQWNjb3JkaW5nIHRvIGdldEtpbmQ6IG15TG93TGVmdCAtPiBET1dOOyBteUxvd1JpZ2h0IC0+IERPV047IG15VXBSaWdodCAtPiBSSUdIVDsgbXlVcExlZnQgLT4gTEVGVFxuICAgICAgICB2YWwgcHJlcGFyZU1hcCA9IEFycmF5TGlzdDxEb3VibGVWZWN0b3I+KClcbiAgICAgICAgaWYgKCFsaXN0WzBdLmNvbnRhaW5zKG15TG93TGVmdCkpIHtcbiAgICAgICAgICAgIHByZXBhcmVNYXAuYWRkKG15TG93TGVmdClcbiAgICAgICAgICAgIGNvcm5lclBvaW50cy5hZGQobXlMb3dMZWZ0KVxuICAgICAgICB9XG4gICAgICAgIHByZXBhcmVNYXAuYWRkQWxsKGxpc3RbMF0pXG4gICAgICAgIGlmICghbGlzdFswXS5jb250YWlucyhteUxvd1JpZ2h0KSkge1xuICAgICAgICAgICAgcHJlcGFyZU1hcC5hZGQobXlMb3dSaWdodClcbiAgICAgICAgICAgIGNvcm5lclBvaW50cy5hZGQobXlMb3dSaWdodClcbiAgICAgICAgfVxuICAgICAgICBwcmVwYXJlTWFwLmFkZEFsbChsaXN0WzFdKVxuICAgICAgICBpZiAoIWxpc3RbMV0uY29udGFpbnMobXlVcFJpZ2h0KSkge1xuICAgICAgICAgICAgcHJlcGFyZU1hcC5hZGQobXlVcFJpZ2h0KVxuICAgICAgICAgICAgY29ybmVyUG9pbnRzLmFkZChteVVwUmlnaHQpXG4gICAgICAgIH1cbiAgICAgICAgcHJlcGFyZU1hcC5hZGRBbGwobGlzdFsyXSlcbiAgICAgICAgaWYgKCFsaXN0WzNdLmNvbnRhaW5zKG15VXBMZWZ0KSkge1xuICAgICAgICAgICAgcHJlcGFyZU1hcC5hZGQobXlVcExlZnQpXG4gICAgICAgICAgICBjb3JuZXJQb2ludHMuYWRkKG15VXBMZWZ0KVxuICAgICAgICB9XG4gICAgICAgIHByZXBhcmVNYXAuYWRkQWxsKGxpc3RbM10pXG4gICAgICAgIHByZXBhcmVNYXAuYWRkKHByZXBhcmVNYXBbMF0pXG4gICAgICAgIGZvciAoaSBpbiAwIHVudGlsIHByZXBhcmVNYXAuc2l6ZSAtIDEpIHtcbiAgICAgICAgICAgIHJlc3VsdFtwcmVwYXJlTWFwW2ldXSA9IHByZXBhcmVNYXBbaSArIDFdXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gZ2V0S2luZChwb2ludDogRG91YmxlVmVjdG9yKTogQm9yZGVyS2luZCB7XG4gICAgICAgIHJldHVybiBpZiAoYmVsb3dPck9uTGluZShcbiAgICAgICAgICAgICAgICBteUxvd0xlZnQsXG4gICAgICAgICAgICAgICAgbXlVcFJpZ2h0LFxuICAgICAgICAgICAgICAgIHBvaW50XG4gICAgICAgICAgICApICYmIGJlbG93T3JPbkxpbmUoXG4gICAgICAgICAgICAgICAgbXlVcExlZnQsXG4gICAgICAgICAgICAgICAgbXlMb3dSaWdodCxcbiAgICAgICAgICAgICAgICBwb2ludFxuICAgICAgICAgICAgKVxuICAgICAgICApIHtcbiAgICAgICAgICAgIEJvcmRlcktpbmQuRE9XTlxuICAgICAgICB9IGVsc2UgaWYgKGJlbG93T3JPbkxpbmUoXG4gICAgICAgICAgICAgICAgbXlMb3dMZWZ0LFxuICAgICAgICAgICAgICAgIG15VXBSaWdodCxcbiAgICAgICAgICAgICAgICBwb2ludFxuICAgICAgICAgICAgKSAmJiAhYmVsb3dPck9uTGluZShcbiAgICAgICAgICAgICAgICBteVVwTGVmdCxcbiAgICAgICAgICAgICAgICBteUxvd1JpZ2h0LFxuICAgICAgICAgICAgICAgIHBvaW50XG4gICAgICAgICAgICApXG4gICAgICAgICkge1xuICAgICAgICAgICAgQm9yZGVyS2luZC5SSUdIVFxuICAgICAgICB9IGVsc2UgaWYgKCFiZWxvd09yT25MaW5lKFxuICAgICAgICAgICAgICAgIG15TG93TGVmdCxcbiAgICAgICAgICAgICAgICBteVVwUmlnaHQsXG4gICAgICAgICAgICAgICAgcG9pbnRcbiAgICAgICAgICAgICkgJiYgIWJlbG93T3JPbkxpbmUoXG4gICAgICAgICAgICAgICAgbXlVcExlZnQsXG4gICAgICAgICAgICAgICAgbXlMb3dSaWdodCxcbiAgICAgICAgICAgICAgICBwb2ludFxuICAgICAgICAgICAgKVxuICAgICAgICApIHtcbiAgICAgICAgICAgIEJvcmRlcktpbmQuVVBcbiAgICAgICAgfSBlbHNlIGlmICghYmVsb3dPck9uTGluZShcbiAgICAgICAgICAgICAgICBteUxvd0xlZnQsXG4gICAgICAgICAgICAgICAgbXlVcFJpZ2h0LFxuICAgICAgICAgICAgICAgIHBvaW50XG4gICAgICAgICAgICApICYmIGJlbG93T3JPbkxpbmUoXG4gICAgICAgICAgICAgICAgbXlVcExlZnQsXG4gICAgICAgICAgICAgICAgbXlMb3dSaWdodCxcbiAgICAgICAgICAgICAgICBwb2ludFxuICAgICAgICAgICAgKVxuICAgICAgICApIHtcbiAgICAgICAgICAgIEJvcmRlcktpbmQuTEVGVFxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiVGhlIENvbnRvdXIgUG9pbnQgaXMgbm90IG9uIHRoZSBib3JkZXIgJHBvaW50XCIpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGVudW0gY2xhc3MgQm9yZGVyS2luZCB7XG4gICAgICAgIERPV04sIFJJR0hULCBVUCwgTEVGVFxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuXG4gICAgICAgIGZ1biBjb21wdXRlRmlsbExldmVscyh6UmFuZ2U6IENsb3NlZFJhbmdlPERvdWJsZT4sIGxldmVsczogTGlzdDxEb3VibGU+KTogTGlzdDxEb3VibGU+IHtcbiAgICAgICAgICAgIHZhbCBmaWxsTGV2ZWxzID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICAgICAgZmlsbExldmVscy5hZGQoelJhbmdlLmxvd2VyRW5kKVxuICAgICAgICAgICAgZm9yIChpIGluIDAgdW50aWwgbGV2ZWxzLnNpemUgLSAxKSB7XG4gICAgICAgICAgICAgICAgZmlsbExldmVscy5hZGQoKGxldmVsc1tpXSArIGxldmVsc1tpICsgMV0pIC8gMi4wKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZmlsbExldmVscy5hZGQoelJhbmdlLnVwcGVyRW5kKVxuICAgICAgICAgICAgcmV0dXJuIGZpbGxMZXZlbHNcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIDxFPiByZXZlcnNlQWxsKGxpc3Q6IExpc3Q8TGlzdDxFPj4pOiBMaXN0PExpc3Q8RT4+IHtcbiAgICAgICAgICAgIHZhbCByZXN1bHQgPSBBcnJheUxpc3Q8TGlzdDxFPj4oKVxuICAgICAgICAgICAgZm9yIChpdGVtIGluIGxpc3QpIHtcbiAgICAgICAgICAgICAgICB2YWwgY29weSA9IEFycmF5TGlzdChpdGVtKVxuICAgICAgICAgICAgICAgIGNvcHkucmV2ZXJzZSgpXG4gICAgICAgICAgICAgICAgcmVzdWx0LmFkZChjb3B5KVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9XG5cbiAgICAgICAgLy8gYS54PGIueFxuICAgICAgICBwcml2YXRlIGZ1biBiZWxvd09yT25MaW5lKGE6IERvdWJsZVZlY3RvciwgYjogRG91YmxlVmVjdG9yLCB0ZXN0OiBEb3VibGVWZWN0b3IpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHZhbCB2YWx1ZSA9IHRlc3Quc3VidHJhY3QoYSlcbiAgICAgICAgICAgIHZhbCBzdGFuZGFyZCA9IGIuc3VidHJhY3QoYSlcblxuICAgICAgICAg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IG5lZWQgdG8gYmUgbW9kaWZpZWQgcGF0aHNcbiAgICAgICAgICAgICAgICB2YWwgcGF0aDAgPSBwYXRoQnlFbmRQb2ludFtwMF1cbiAgICAgICAgICAgICAgICB2YWwgcGF0aDEgPSBwYXRoQnlFbmRQb2ludFtwMV1cblxuICAgICAgICAgICAgICAgIGlmIChwYXRoMCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHBhdGhCeUVuZFBvaW50LnJlbW92ZShwYXRoMFswXSlcbiAgICAgICAgICAgICAgICAgICAgcGF0aEJ5RW5kUG9pbnQucmVtb3ZlKHBhdGgwW3BhdGgwLnNpemUgLSAxXSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHBhdGgxICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgcGF0aEJ5RW5kUG9pbnQucmVtb3ZlKHBhdGgxWzBdKVxuICAgICAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludC5yZW1vdmUocGF0aDFbcGF0aDEuc2l6ZSAtIDFdKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHZhbCBsb25nUGF0aDogTXV0YWJsZUxpc3Q8RWRnZT5cbiAgICAgICAgICAgICAgICBpZiAocGF0aDAgPT09IHBhdGgxKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vYSBjeWNsZSBpcyBmb3JtZWRcbiAgICAgICAgICAgICAgICAgICAgcGF0aDAhIS5hZGQoc2VnbWVudC5zZWNvbmQpXG4gICAgICAgICAgICAgICAgICAgIHBhdGhMaXN0LmFkZChwYXRoMClcbiAgICAgICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHBhdGgwICE9IG51bGwgJiYgcGF0aDEgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aCA9IHBhdGgwXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZEFsbChwYXRoMSlcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHBhdGgwID09IG51bGwpIHsgLy9wYXRoMSE9bnVsbFxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aCA9IHBhdGgxISFcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGguYWRkKDAsIHNlZ21lbnQuZmlyc3QpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHsgLy8gcGF0aDAhPW51bGxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGggPSBwYXRoMFxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aC5hZGQoc2VnbWVudC5zZWNvbmQpXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcGF0aEJ5RW5kUG9pbnRbbG9uZ1BhdGhbMF1dID0gbG9uZ1BhdGhcbiAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludFtsb25nUGF0aFtsb25nUGF0aC5zaXplIC0gMV1dID0gbG9uZ1BhdGhcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdmFsIHBhdGggPSBBcnJheUxpc3Q8RWRnZT4oKVxuICAgICAgICAgICAgICAgIHBhdGguYWRkKHNlZ21lbnQuZmlyc3QpXG4gICAgICAgICAgICAgICAgcGF0aC5hZGQoc2VnbWVudC5zZWNvbmQpXG4gICAgICAgICAgICAgICAgcGF0aEJ5RW5kUG9pbnRbc2VnbWVudC5maXJzdF0gPSBwYXRoXG4gICAgICAgICAgICAgICAgcGF0aEJ5RW5kUG9pbnRbc2VnbWVudC5zZWNvbmRdID0gcGF0aFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gY29sbGVjdCBwYXRocyAoZG9uJ3QgZHVwbGljYXRlKVxuICAgICAgICB2YWwgcGF0aFNldCA9IEhhc2hTZXQocGF0aEJ5RW5kUG9pbnQudmFsdWVzKVxuICAgICAgICBmb3IgKHBhdGggaW4gcGF0aFNldCkge1xuICAgICAgICAgICAgcGF0aExpc3QuYWRkKHBhdGgpXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHBhdGhMaXN0XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gY29udmVydFBhdGhzKFxuICAgICAgICBwYXRoczogTGlzdDxMaXN0PEVkZ2U+PixcbiAgICAgICAgeFN0ZXA6IERvdWJsZSxcbiAgICAgICAgeVN0ZXA6IERvdWJsZSxcbiAgICAgICAgb3JpZ2luOiBEb3VibGVWZWN0b3IsXG4gICAgICAgIGxldmVsOiBEb3VibGU/XG4gICAgKTogTGlzdDxMaXN0PERvdWJsZVZlY3Rvcj4+IHtcbiAgICAgICAgdmFsIHJlc3VsdCA9IEFycmF5TGlzdDxMaXN0PERvdWJsZVZlY3Rvcj4+KClcblxuICAgICAgICBmb3IgKHBhdGggaW4gcGF0aHMpIHtcbiAgICAgICAgICAgIHZhbCB0ZW1wID0gQXJyYXlMaXN0PERvdWJsZVZlY3Rvcj4oKVxuICAgICAgICAgICAgdmFyIGxhc3RQb2ludDogRG91YmxlVmVjdG9yPyA9IG51bGxcbiAgICAgICAgICAgIGZvciAoZWRnZSBpbiBwYXRoKSB7XG4gICAgICAgICAgICAgICAgdmFyIGludGVyc2VjdCA9IGVkZ2UuaW50ZXJzZWN0KGxldmVsISEpXG4gICAgICAgICAgICAgICAgaW50ZXJzZWN0ID0gRG91YmxlVmVjdG9yKHhTdGVwICogaW50ZXJzZWN0LngsIHlTdGVwICogaW50ZXJzZWN0LnkpLmFkZChvcmlnaW4pXG4gICAgICAgICAgICAgICAgLy8gaW4gY2FzZSB0d28gYWRqYWNlbnQgZG91YmxlIHZlY3RvcnMgYXJlIHRoZSBzYW1lXG4gICAgICAgICAgICAgICAgaWYgKGludGVyc2VjdCA9PSBsYXN0UG9pbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGVtcC5hZGQoaW50ZXJzZWN0KVxuICAgICAgICAgICAgICAgIGxhc3RQb2ludCA9IGludGVyc2VjdFxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gaW4gY2FzZSBvZiBzbGlnaHQgY29tcHV0YXRpb25hbCBlcnJvciBpbiBsb29wc1xuICAgICAgICAgICAgaWYgKHBhdGhbMF0gPT0gcGF0aFtwYXRoLnNpemUgLSAxXSAmJiB0ZW1wWzBdICE9IHRlbXBbdGVtcC5zaXplIC0gMV0pIHtcbiAgICAgICAgICAgICAgICB0ZW1wW3RlbXAuc2l6ZSAtIDFdID0gdGVtcFswXVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRlbXAuc2l6ZSA+IDEpIHtcbiAgICAgICAgICAgICAgICByZXN1bHQuYWRkKHRlbXApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gY29uZmlybVBhdGhzKHBhdGhzOiBMaXN0PExpc3Q8RG91YmxlVmVjdG9yPj4pOiBMaXN0PExpc3Q8RG91YmxlVmVjdG9yPj4ge1xuICAgICAgICAvLyBqb2luIHBhdGhzIHRoYXQgc2hhcmUgdGhlIHNhbWUgZW5kIHBvaW50c1xuICAgICAgICB2YWwgbmV3UGF0aHMgPSBBcnJheUxpc3Q8TGlzdDxEb3VibGVWZWN0b3I+PigpXG5cbiAgICAgICAgdmFsIHBhdGhCeUVuZFBvaW50ID0gSGFzaE1hcDxEb3VibGVWZWN0b3IsIExpc3Q8RG91YmxlVmVjdG9yPj4oKVxuXG4gICAgICAgIGZvciAocGF0aCBpbiBwYXRocykge1xuICAgICAgICAgICAgdmFsIHAwID0gcGF0aFswXVxuICAgICAgICAgICAgdmFsIHAxID0gcGF0aFtwYXRoLnNpemUgLSAxXVxuICAgICAgICAgICAgLy9pZiBjeWNsZVxuICAgICAgICAgICAgaWYgKHAwID09IHAxKSB7XG4gICAgICAgICAgICAgICAgbmV3UGF0aHMuYWRkKHBhdGgpXG4gICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKHBhdGhCeUVuZFBvaW50LmNvbnRhaW5zS2V5KHAwKSB8fCBwYXRoQnlFbmRQb2ludC5jb250YWluc0tleShwMSkpIHtcbiAgICAgICAgICAgICAgICAvL3JlbW92ZSBuZWVkIHRvIGJlIG1vZGlmaWVkIHBhdGhzXG4gICAgICAgICAgICAgICAgdmFsIHBhdGgwID0gcGF0aEJ5RW5kUG9pbnRbcDBdXG4gICAgICAgICAgICAgICAgdmFsIHBhdGgxID0gcGF0aEJ5RW5kUG9pbnRbcDFdXG4gICAgICAgICAgICAgICAgcmVtb3ZlUGF0aEJ5RW5kcG9pbnRzKHBhdGgwLCBwYXRoQnlFbmRQb2ludClcbiAgICAgICAgICAgICAgICByZW1vdmVQYXRoQnlFbmRwb2ludHMocGF0aDEsIHBhdGhCeUVuZFBvaW50KVxuXG4gICAgICAgICAgICAgICAgdmFsIGxvbmdQYXRoID0gQXJyYXlMaXN0PERvdWJsZVZlY3Rvcj4oKVxuICAgICAgICAgICAgICAgIGlmIChwYXRoMCA9PT0gcGF0aDEpIHtcbiAgICAgICAgICAgICAgICAgICAgLy9hIGN5Y2xlIGlzIGZvcm1lZFxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aC5hZGRBbGwocGF0aDAhISlcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGguYWRkQWxsKHBhdGguc3ViTGlzdCgxLCBwYXRoLnNpemUpKVxuICAgICAgICAgICAgICAgICAgICBuZXdQYXRocy5hZGQobG9uZ1BhdGgpXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwYXRoMCAhPSBudWxsICYmIHBhdGgxICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGguYWRkQWxsKHBhdGgwKVxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aC5hZGRBbGwocGF0aC5zdWJMaXN0KDEsIHBhdGguc2l6ZSAtIDEpKVxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aC5hZGRBbGwocGF0aDEpXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwYXRoMCA9PSBudWxsKSB7IC8vcGF0aDEhPW51bGxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGguYWRkQWxsKHBhdGgxISEpXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZEFsbCgwLCBwYXRoLnN1Ykxpc3QoMCwgcGF0aC5zaXplIC0gMSkpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHsgLy9wYXRoMCE9bnVsbFxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aC5hZGRBbGwocGF0aDApXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZEFsbChwYXRoLnN1Ykxpc3QoMSwgcGF0aC5zaXplKSlcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludFtsb25nUGF0aFswXV0gPSBsb25nUGF0aFxuICAgICAgICAgICAgICAgIHBhdGhCeUVuZFBvaW50W2xvbmdQYXRoW2xvbmdQYXRoLnNpemUgLSAxXV0gPSBsb25nUGF0aFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludFtwYXRoWzBdXSA9IHBhdGhcbiAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludFtwYXRoW3BhdGguc2l6ZSAtIDFdXSA9IHBhdGhcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBwYXRoU2V0ID0gSGFzaFNldChwYXRoQnlFbmRQb2ludC52YWx1ZXMpXG4gICAgICAgIGZvciAocGF0aCBpbiBwYXRoU2V0KSB7XG4gICAgICAgICAgICBuZXdQYXRocy5hZGQocGF0aClcbi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hdID09IHBhdGhbbmV4dEluZGV4XSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5hZGQocGF0aC5zdWJMaXN0KHN0YXJ0SW5kZXgsIG5leHRJbmRleCArIDEpKVxuICAgICAgICAgICAgICAgIHN0YXJ0SW5kZXggPSBuZXh0SW5kZXhcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoc3RhcnRJbmRleCA9PSAwKSB7XG4gICAgICAgICAgICByZXR1cm4gbGlzdE9mKHBhdGgpXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXN1bHQuYWRkKHBhdGguc3ViTGlzdChzdGFydEluZGV4LCBwYXRoLnNpemUpKVxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gY29tcHV0ZVNlZ21lbnRzKFxuICAgICAgICBjb2xDb3VudDogSW50LFxuICAgICAgICByb3dDb3VudDogSW50LFxuICAgICAgICBkYXRhOiBMaXN0PERvdWJsZT8+LFxuICAgICAgICBsZXZlbDogRG91YmxlXG4gICAgKTogTGlzdDxQYWlyPEVkZ2UsIEVkZ2U+PiB7XG5cbiAgICAgICAgdmFsIHNlZ21lbnRzID0gQXJyYXlMaXN0PFBhaXI8RWRnZSwgRWRnZT4+KClcbiAgICAgICAgZm9yIChyb3cgaW4gMCB1bnRpbCByb3dDb3VudCAtIDEpIHtcbiAgICAgICAgICAgIGZvciAoY29sIGluIDAgdW50aWwgY29sQ291bnQgLSAxKSB7XG4gICAgICAgICAgICAgICAgdmFsIGkwID0gcm93ICogY29sQ291bnQgKyBjb2xcbiAgICAgICAgICAgICAgICB2YWwgaTEgPSByb3cgKiBjb2xDb3VudCArIGNvbCArIDEgLy8gbmV4dCByaWdodFxuICAgICAgICAgICAgICAgIHZhbCBpMiA9IChyb3cgKyAxKSAqIGNvbENvdW50ICsgY29sICsgMSAvLyBuZXh0IHJpZ2h0ICYgdXBcbiAgICAgICAgICAgICAgICB2YWwgaTMgPSAocm93ICsgMSkgKiBjb2xDb3VudCArIGNvbCAvLyBuZXh0IHVwXG5cbiAgICAgICAgICAgICAgICB2YWwgdiA9IERvdWJsZUFycmF5KDUpXG4gICAgICAgICAgICAgICAgdlswXSA9IGRhdGFbaTBdISFcbiAgICAgICAgICAgICAgICB2WzFdID0gZGF0YVtpMV0hIVxuICAgICAgICAgICAgICAgIHZbMl0gPSBkYXRhW2kyXSEhXG4gICAgICAgICAgICAgICAgdlszXSA9IGRhdGFbaTNdISFcblxuICAgICAgICAgICAgICAgIHZhciBtaW4gPSB2WzBdXG4gICAgICAgICAgICAgICAgdmFyIG1heCA9IHZbMF1cbiAgICAgICAgICAgICAgICBmb3IgKGkgaW4gMS4uMykge1xuICAgICAgICAgICAgICAgICAgICBtaW4gPSBtaW4obWluLCB2W2ldKVxuICAgICAgICAgICAgICAgICAgICBtYXggPSBtYXgobWF4LCB2W2ldKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChtaW4gPT0gbWF4KSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIHNwZWNpYWwgY2FzZTogYWxsIHBvaW50cyBhcmUgaW4gdGhlIHNhbWUgcGxhbmUgLSBkcm9wXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gdls0XSA9ICh2WzBdICsgdlsxXSArIHZbMl0gKyB2WzNdKSAvIDQ7ICAgLy8gY2VudGVyICAoYXZlcmFnZSBvZiBjb3JuZXJzKVxuICAgICAgICAgICAgICAgIHZbNF0gPSAodlswXSArIHZbMV0gKyB2WzJdICsgdlszXSAtIG1pbiAtIG1heCkgLyAyICAgLy8gY2VudGVyICAoYXZlcmFnZSBvZiBjb3JuZXJzKVxuXG4gICAgICAgICAgICAgICAgaWYgKGxldmVsID4gbWluICYmIGxldmVsIDw9IG1heCkge1xuXG4gICAgICAgICAgICAg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gICAgICAgICAgICAgY29sICsgeExvY1tpXSxcbiAgICAgICAgICAgICAgICAgICAgcm93ICsgeUxvY1tpXSxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU1W2ldXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gQWxsIHRyaWFuZ2xlcyBhcmUgY291bnRlcmNsb2Nrd2lzZVxuICAgICAgICBmb3IgKGkgaW4gMC4uMykge1xuICAgICAgICAgICAgdmFsIGkxID0gKGkgKyAxKSAlIDRcbiAgICAgICAgICAgIHRlbXBWZWN0b3IgPSBBcnJheUxpc3QoKVxuICAgICAgICAgICAgdGVtcFZlY3Rvci5hZGQocG9pbnRzW2ldKVxuICAgICAgICAgICAgdGVtcFZlY3Rvci5hZGQocG9pbnRzW2kxXSlcbiAgICAgICAgICAgIHRlbXBWZWN0b3IuYWRkKHBvaW50c1s0XSlcbiAgICAgICAgICAgIHZhbCB0ZW1wID0gaW50ZXJzZWN0aW9uU2VnbWVudCh0ZW1wVmVjdG9yLCBsZXZlbClcbiAgICAgICAgICAgIGlmICh0ZW1wICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZXN1bHQuYWRkKHRlbXApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGludGVyc2VjdGlvblNlZ21lbnQodmVjdG9yczogTGlzdDxUcmlwbGVWZWN0b3I+LCBsZXZlbDogRG91YmxlPyk6IFBhaXI8RWRnZSwgRWRnZT4/IHtcbiAgICAgICAgLy8gaW5wdXQ6IGEgY291bnRlcmNsb2Nrd2lzZSB0cmlhbmdsZVxuICAgICAgICAvLyBvdXRwdXQ6IGEgc2VnbWVudCwgc3VjaCB0aGF0IHRoZSBoaWdoZXIgcGFydCBpcyBhbHdheXMgdG8gdGhlIHJpZ2h0XG4gICAgICAgIHZhbCB0eXBlID0gdmVjdG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AgICAgICB9XG4gICAgICAgIGlmIChhLm15WSA9PSAwICYmIGIubXlZID09IDApIHtcbiAgICAgICAgICAgIHJldHVyblxuICAgICAgICB9XG4gICAgICAgIGlmIChhLm15WCA9PSBjb2xDb3VudCAtIDEgJiYgYi5teVggPT0gY29sQ291bnQgLSAxKSB7XG4gICAgICAgICAgICByZXR1cm5cbiAgICAgICAgfVxuICAgICAgICBpZiAoYS5teVkgPT0gcm93Q291bnQgLSAxICYmIGIubXlZID09IHJvd0NvdW50IC0gMSkge1xuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cbiAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiQ2hlY2sgRWRnZSBGYWlsZWRcIilcbiAgICB9XG5cbiAgICBwcml2YXRlIGNsYXNzIFRyaXBsZVZlY3RvciBpbnRlcm5hbCBjb25zdHJ1Y3Rvcih4OiBEb3VibGUsIHk6IERvdWJsZSwgdmFsIHo6IERvdWJsZSkge1xuICAgICAgICB2YWwgbXlYOiBJbnRcbiAgICAgICAgdmFsIG15WTogSW50XG4gICAgICAgIHByaXZhdGUgdmFsIG15SXNDZW50ZXI6IEludFxuXG4gICAgICAgIHZhbCBjb29yZDogRG91YmxlVmVjdG9yXG4gICAgICAgICAgICBnZXQoKSA9IERvdWJsZVZlY3Rvcih4LCB5KVxuXG4gICAgICAgIHZhbCB4OiBEb3VibGVcbiAgICAgICAgICAgIGdldCgpID0gdGhpcy5teVggKyAwLjUgKiBteUlzQ2VudGVyXG5cbiAgICAgICAgdmFsIHk6IERvdWJsZVxuICAgICAgICAgICAgZ2V0KCkgPSB0aGlzLm15WSArIDAuNSAqIG15SXNDZW50ZXJcblxuICAgICAgICBpbml0IHtcbiAgICAgICAgICAgIHRoaXMubXlYID0geC50b0ludCgpXG4gICAgICAgICAgICB0aGlzLm15WSA9IHkudG9JbnQoKVxuICAgICAgICAgICAgdGhpcy5teUlzQ2VudGVyID0gaWYgKHggJSAxID09IDAuMCkgMCBlbHNlIDFcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBlcXVhbHMob3RoZXI6IEFueT8pOiBCb29sZWFuIHtcbiAgICAgICAgICAgIGlmICh0aGlzID09PSBvdGhlcikgcmV0dXJuIHRydWVcbiAgICAgICAgICAgIGlmIChvdGhlciA9PSBudWxsIHx8IHRoaXM6OmNsYXNzICE9IG90aGVyOjpjbGFzcykgcmV0dXJuIGZhbHNlXG4gICAgICAgICAgICB2YWwgdGhhdCA9IG90aGVyIGFzIFRyaXBsZVZlY3Rvcj9cbiAgICAgICAgICAgIHJldHVybiBteVggPT0gdGhhdCEhLm15WCAmJiBteVkgPT0gdGhhdC5teVkgJiYgbXlJc0NlbnRlciA9PSB0aGF0Lm15SXNDZW50ZXJcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBoYXNoQ29kZSgpOiBJbnQge1xuICAgICAgICAgICAgcmV0dXJuIGFycmF5T2YobXlYLCBteVksIG15SXNDZW50ZXIpLmhhc2hDb2RlKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBnZXRUeXBlKGxldmVsOiBEb3VibGUpOiBJbnQge1xuICAgICAgICAgICAgcmV0dXJuIGlmICh6ID49IGxldmVsKSB7XG4gICAgICAgICAgICAgICAgMVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAwXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGNsYXNzIEVkZ2UgaW50ZXJuYWwgY29uc3RydWN0b3IodmFsIG15QTogVHJpcGxlVmVjdG9yLCB2YWwgbXlCOiBUcmlwbGVWZWN0b3IpIHtcblxuICAgICAgICBvdmVycmlkZSBmdW4gZXF1YWxzKG90aGVyOiBBbnk/KTogQm9vbGVhbiB7XG4gICAgICAgICAgICBpZiAob3RoZXIgIWlzIEVkZ2UpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2VcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhbCBvYmogPSBvdGhlciBhcyBFZGdlP1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMubXlBID09IG9iaiEhLm15QSAmJiB0aGlzLm15QiA9PSBvYmoubXlCIHx8IHRoaXMubXlBID09IG9iai5teUIgJiYgdGhpcy5teUIgPT0gb2JqLm15QVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhhc2hDb2RlKCk6IEludCB7XG4gICAgICAgICAgICByZXR1cm4gbXlBLmNvb3JkLmhhc2hDb2RlKCkgKyBteUIuY29vcmQuaGFzaENvZGUoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGludGVyc2VjdChsZXZlbDogRG91YmxlKTogRG91YmxlVmVjdG9yIHtcbiAgICAgICAgICAgIHZhbCB6MCA9IG15QS56XG4gICAgICAgICAgICB2YWwgejEgPSBteUIuelxuXG4gICAgICAgICAgICBpZiAobGV2ZWwgPT0gejApIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbXlBLmNvb3JkXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobGV2ZWwgPT0gejEpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbXlCLmNvb3JkXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbCByYXRpbyA9ICh6MSAtIHowKSAvIChsZXZlbCAtIHowKVxuICAgICAgICAgICAgdmFsIHgwID0gbXlBLnhcbiAgICAgICAgICAgIHZhbCB5MCA9IG15QS55XG4gICAgICAgICAgICB2YWwgeDEgPSBteUIueFxuICAgICAgICAgICAgdmFsIHkxID0gbXlCLnlcbiAgICAgICAgICAgIHZhbCB4ID0geDAgKyAoeDEgLSB4MCkgLyByYXRpb1xuICAgICAgICAgICAgdmFsIHkgPSB5MCArICh5MSAtIHkwKSAvIHJhdGlvXG4gICAgICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKHgsIHkpXG4gICAgICAgIH1cbiAgIC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JEYXRhID0gbXV0YWJsZU1hcE9mPFBhaXI8U3RyaW5nLCBTdHJpbmc+LCBEb3VibGU+KClcblxuICAgICAgICBmdW4gYWRkQ29ycmVsYXRpb24odmFyWDogU3RyaW5nLCB2YXJZOiBTdHJpbmcsIHY6IERvdWJsZSkge1xuICAgICAgICAgICAgaWYgKGFicyh2KSA+PSB0aHJlc2hvbGQpIHtcbiAgICAgICAgICAgICAgICBrbm93blZhcnMuYWRkKHZhclgpXG4gICAgICAgICAgICAgICAga25vd25WYXJzLmFkZCh2YXJZKVxuICAgICAgICAgICAgICAgIGNvcnJEYXRhW3ZhclggdG8gdmFyWV0gPSB2XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKChpLCB2eCkgaW4gbnVtZXJpY3Mud2l0aEluZGV4KCkpIHtcbiAgICAgICAgICAgIHZhbCB4cyA9IGRhdGEuZ2V0TnVtZXJpYyh2eClcblxuICAgICAgICAgICAgaWYgKGZpbGxEaWFnb25hbCkgeyAgICAvLyB2YWx1ZXMgb24gbWFpbiBkaWFnb25hbCBkb2VzIG5vdCByZXF1aXJlIGNhbGN1bGF0aW9uc1xuICAgICAgICAgICAgICAgIGFkZENvcnJlbGF0aW9uKHZ4LmxhYmVsLCB2eC5sYWJlbCwgMS4wKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmb3IgKGogaW4gMCB1bnRpbCBpKSB7XG4gICAgICAgICAgICAgICAgdmFsIHZ5ID0gbnVtZXJpY3Nbal1cbiAgICAgICAgICAgICAgICB2YWwgeXMgPSBkYXRhLmdldE51bWVyaWModnkpXG4gICAgICAgICAgICAgICAgdmFsIGMgPSBjb3JyZWxhdGlvbih4cywgeXMsIGNvcnJlbGF0aW9uRnVuY3Rpb24pXG5cbiAgICAgICAgICAgICAgICBpZiAodHlwZSA9PSBDb3JyZWxhdGlvblN0YXQuVHlwZS5GVUxMIHx8IHR5cGUgPT0gQ29ycmVsYXRpb25TdGF0LlR5cGUuTE9XRVIpIHtcbiAgICAgICAgICAgICAgICAgICAgYWRkQ29ycmVsYXRpb24odngubGFiZWwsIHZ5LmxhYmVsLCBjKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmICh0eXBlID09IENvcnJlbGF0aW9uU3RhdC5UeXBlLkZVTEwgfHwgdHlwZSA9PSBDb3JyZWxhdGlvblN0YXQuVHlwZS5VUFBFUikge1xuICAgICAgICAgICAgICAgICAgICBhZGRDb3JyZWxhdGlvbih2eS5sYWJlbCwgdngubGFiZWwsIGMpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHZhcjEgPSBhcnJheUxpc3RPZjxTdHJpbmc+KClcbiAgICAgICAgdmFsIHZhcjIgPSBhcnJheUxpc3RPZjxTdHJpbmc+KClcbiAgICAgICAgdmFsIGNvcnIgPSBhcnJheUxpc3RPZjxEb3VibGU/PigpXG5cbiAgICAgICAgLy8gcHV0IGFsbCBjb3JyZWxhdGlvbiBtYXRyaXggdmFsdWVzIChpbmNsdWRpbmcgbnVsbHMpXG4gICAgICAgIC8vIHRvIHJlc3VsdCBkYXRhZnJhbWUgaW4gcHJvcGVyIG9yZGVyLCB0byBrZWVwIG1hdHJpeCBzaGFwZS5cbiAgICAgICAgdmFsIHNvcnRlZFZhcnMgPSBrbm93blZhcnMuc29ydGVkV2l0aChjcmVhdGVDb21wYXJhdG9yKG51bWVyaWNzKSlcblxuICAgICAgICBmb3IgKHggaW4gc29ydGVkVmFycykge1xuICAgICAgICAgICAgZm9yICh5IGluIHNvcnRlZFZhcnMpIHtcbiAgICAgICAgICAgICAgICB2YXIxLmFkZCh4KVxuICAgICAgICAgICAgICAgIHZhcjIuYWRkKHkpXG4gICAgICAgICAgICAgICAgY29yci5hZGQoY29yckRhdGFbeCB0byB5XSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBEYXRhRnJhbWUuQnVp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dGF0cy5DT1VOVCwgc3RhdENvdW50KVxuICAgICAgICAgICAgLmJ1aWxkKClcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgcHJpdmF0ZSB2YWwgREVGX01BUFBJTkc6IE1hcDxBZXM8Kj4sIERhdGFGcmFtZS5WYXJpYWJsZT4gPSBtYXBPZihcbiAgICAgICAgICAgIEFlcy5YIHRvIFN0YXRzLlgsXG4gICAgICAgICAgICBBZXMuWSB0byBTdGF0cy5DT1VOVFxuICAgICAgICApXG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gY291bnRCeVgodmFsdWVzWDogTGlzdDxEb3VibGU/Piwgd2VpZ2h0OiBMaXN0PERvdWJsZT8+KTogTWFwPERvdWJsZSwgTXV0YWJsZURvdWJsZT4ge1xuICAgICAgICAgICAgdmFsIHJlc3VsdCA9IExpbmtlZEhhc2hNYXA8RG91YmxlLCBNdXRhYmxlRG91YmxlPigpXG4gICAgICAgICAgICBmb3IgKGkgaW4gdmFsdWVzWC5pbmRpY2VzKSB7XG4gICAgICAgICAgICAgICAgdmFsIHggPSB2YWx1ZXNYW2ldXG4gICAgICAgICAgICAgICAgaWYgKFNlcmllc1V0aWwuaXNGaW5pdGUoeCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQuY29udGFpbnNLZXkoeCEhKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0W3hdID0gTXV0YWJsZURvdWJsZSgwLjApXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0W3hdISEuZ2V0QW5kQWRkKFNlcmllc1V0aWwuYXNGaW5pdGUod2VpZ2h0W2ldLCAwLjApKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiByZXN1bHRcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwM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AgIGJhbmRXaWR0aFsxXSA9IGdldEJhbmRXaWR0aFkoeVZlY3RvcilcblxuICAgICAgICB2YWwgc3RlcHNYID0gRGVuc2l0eVN0YXRVdGlsLmNyZWF0ZVN0ZXBWYWx1ZXMoeFJhbmdlISEsIG5YKVxuICAgICAgICB2YWwgc3RlcHNZID0gRGVuc2l0eVN0YXRVdGlsLmNyZWF0ZVN0ZXBWYWx1ZXMoeVJhbmdlISEsIG5ZKVxuXG4gICAgICAgIC8vIHdlaWdodCBhZXN0aGV0aWNzXG4gICAgICAgIHZhbCBncm91cFdlaWdodCA9IEJpblN0YXRVdGlsLndlaWdodFZlY3Rvcih4VmVjdG9yLnNpemUsIGRhdGEpXG5cbiAgICAgICAgdmFsIG1hdHJpeFggPSBCbG9ja1JlYWxNYXRyaXgoXG4gICAgICAgICAgICBEZW5zaXR5U3RhdFV0aWwuY3JlYXRlUmF3TWF0cml4KFxuICAgICAgICAgICAgICAgIHhWZWN0b3IsXG4gICAgICAgICAgICAgICAgc3RlcHNYLFxuICAgICAgICAgICAgICAgIGtlcm5lbEZ1bixcbiAgICAgICAgICAgICAgICBiYW5kV2lkdGhbMF0sXG4gICAgICAgICAgICAgICAgYWRqdXN0LFxuICAgICAgICAgICAgICAgIGdyb3VwV2VpZ2h0XG4gICAgICAgICAgICApXG4gICAgICAgIClcbiAgICAgICAgdmFsIG1hdHJpeFkgPSBCbG9ja1JlYWxNYXRyaXgoXG4gICAgICAgICAgICBEZW5zaXR5U3RhdFV0aWwuY3JlYXRlUmF3TWF0cml4KFxuICAgICAgICAgICAgICAgIHlWZWN0b3IsXG4gICAgICAgICAgICAgICAgc3RlcHNZLFxuICAgICAgICAgICAgICAgIGtlcm5lbEZ1bixcbiAgICAgICAgICAgICAgICBiYW5kV2lkdGhbMV0sXG4gICAgICAgICAgICAgICAgYWRqdXN0LFxuICAgICAgICAgICAgICAgIGdyb3VwV2VpZ2h0XG4gICAgICAgICAgICApXG4gICAgICAgIClcbiAgICAgICAgLy8gc2l6ZTogblkgKiBuWFxuICAgICAgICB2YWwgbWF0cml4RmluYWwgPSBtYXRyaXhZLm11bHRpcGx5KG1hdHJpeFgudHJhbnNwb3NlKCkpXG5cbiAgICAgICAgZm9yIChyb3cgaW4gMCB1bnRpbCBuWSkge1xuICAgICAgICAgICAgZm9yIChjb2wgaW4gMCB1bnRpbCBuWCkge1xuICAgICAgICAgICAgICAgIHN0YXRYLmFkZChzdGVwc1hbY29sXSlcbiAgICAgICAgICAgICAgICBzdGF0WS5hZGQoc3RlcHNZW3Jvd10pXG4gICAgICAgICAgICAgICAgc3RhdERlbnNpdHkuYWRkKG1hdHJpeEZpbmFsLmdldEVudHJ5KHJvdywgY29sKSAvIFNlcmllc1V0aWwuc3VtKGdyb3VwV2VpZ2h0KSlcbiAgICAgICAgICAgICAgICAvL25ld0dyb3Vwcy5hZGQoKGRvdWJsZSkgKGludCkgZ3JvdXApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGlzQ29udG91cikge1xuICAgICAgICAgICAgdmFsIHpSYW5nZSA9IFNlcmllc1V0aWwucmFuZ2Uoc3RhdERlbnNpdHkpXG4gICAgICAgICAgICB2YWwgbGV2ZWxzID0gQ29udG91clN0YXRVdGlsLmNvbXB1dGVMZXZlbHMoelJhbmdlLCBiaW5PcHRpb25zKVxuICAgICAgICAgICAgICAgID86IHJldHVybiBEYXRhRnJhbWUuQnVpbGRlci5lbXB0eUZyYW1lKClcblxuICAgICAgICAgICAgdmFsIHBhdGhMaXN0QnlMZXZlbCA9IENvbnRvdXJTdGF0VXRpbC5jb21wdXRlQ29udG91cnMoXG4gICAgICAgICAgICAgICAgeFJhbmdlLFxuICAgICAgICAgICAgICAgIHlSYW5nZSxcbiAgICAgICAgICAgICAgICBuWCxcbiAgICAgICAgICAgICAgICBuWSxcbiAgICAgICAgICAgICAgICBzdGF0RGVuc2l0eSxcbiAgICAgICAgICAgICAgICBsZXZlbHNcbiAgICAgICAgICAgIClcblx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AgICAgYWRqdXN0LFxuICAgICAgICAgICAgICAgIGdyb3VwV2VpZ2h0XG4gICAgICAgICAgICApXG4gICAgICAgIClcbiAgICAgICAgdmFsIG1hdHJpeFkgPSBCbG9ja1JlYWxNYXRyaXgoXG4gICAgICAgICAgICBEZW5zaXR5U3RhdFV0aWwuY3JlYXRlUmF3TWF0cml4KFxuICAgICAgICAgICAgICAgIHlWZWN0b3IsXG4gICAgICAgICAgICAgICAgc3RlcHNZLFxuICAgICAgICAgICAgICAgIGtlcm5lbEZ1bixcbiAgICAgICAgICAgICAgICBiYW5kV2lkdGhbMV0sXG4gICAgICAgICAgICAgICAgYWRqdXN0LFxuICAgICAgICAgICAgICAgIGdyb3VwV2VpZ2h0XG4gICAgICAgICAgICApXG4gICAgICAgIClcbiAgICAgICAgLy8gc2l6ZTogblkgKiBuWFxuICAgICAgICB2YWwgbWF0cml4RmluYWwgPSBtYXRyaXhZLm11bHRpcGx5KG1hdHJpeFgudHJhbnNwb3NlKCkpXG5cbiAgICAgICAgZm9yIChyb3cgaW4gMCB1bnRpbCBuWSkge1xuICAgICAgICAgICAgZm9yIChjb2wgaW4gMCB1bnRpbCBuWCkge1xuICAgICAgICAgICAgICAgIHN0YXRYLmFkZChzdGVwc1hbY29sXSlcbiAgICAgICAgICAgICAgICBzdGF0WS5hZGQoc3RlcHNZW3Jvd10pXG4gICAgICAgICAgICAgICAgc3RhdERlbnNpdHkuYWRkKG1hdHJpeEZpbmFsLmdldEVudHJ5KHJvdywgY29sKSAvIFNlcmllc1V0aWwuc3VtKGdyb3VwV2VpZ2h0KSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChpc0NvbnRvdXIpIHtcbiAgICAgICAgICAgIC8vIFRvRG86IGNoYW5nZSB6cmFuZ2UgaW50byB0aGUgcmFuZ2Ugb2YgeiBvdmVyIGVudGlyZSBkYXRhc2V0XG4gICAgICAgICAgICB2YWwgelJhbmdlID0gU2VyaWVzVXRpbC5yYW5nZShzdGF0RGVuc2l0eSlcbiAgICAgICAgICAgIHZhbCBsZXZlbHMgPSBDb250b3VyU3RhdFV0aWwuY29tcHV0ZUxldmVscyh6UmFuZ2UsIGJpbk9wdGlvbnMpXG4gICAgICAgICAgICAgICAgPzogcmV0dXJuIERhdGFGcmFtZS5CdWlsZGVyLmVtcHR5RnJhbWUoKVxuXG4gICAgICAgICAgICB2YWwgcGF0aExpc3RCeUxldmVsID0gQ29udG91clN0YXRVdGlsLmNvbXB1dGVDb250b3VycyhcbiAgICAgICAgICAgICAgICB4UmFuZ2UsXG4gICAgICAgICAgICAgICAgeVJhbmdlLFxuICAgICAgICAgICAgICAgIG5YLFxuICAgICAgICAgICAgICAgIG5ZLFxuICAgICAgICAgICAgICAgIHN0YXREZW5zaXR5LFxuICAgICAgICAgICAgICAgIGxldmVsc1xuICAgICAgICAgICAgKVxuICAgICAgICAgICAgdmFsIGhlbHBlciA9IENvbnRvdXJGaWxsSGVscGVyKHhSYW5nZSwgeVJhbmdlKVxuICAgICAgICAgICAgdmFsIGZpbGxMZXZlbHMgPVxuICAgICAgICAgICAgICAgIENvbnRvdXJGaWxsSGVscGVyLmNvbXB1dGVGaWxsTGV2ZWxzKHpSYW5nZSEhLCBsZXZlbHMpXG4gICAgICAgICAgICB2YWwgcG9seWdvbkxpc3RCeUZpbGxMZXZlbCA9IGhlbHBlci5jcmVhdGVQb2x5Z29ucyhwYXRoTGlzdEJ5TGV2ZWwsIGxldmVscywgZmlsbExldmVscylcblxuICAgICAgICAgICAgcmV0dXJuIENvbnRvdXIuZ2V0UG9seWdvbkRhdGFGcmFtZShcbiAgICAgICAgICAgICAgICBmaWxsTGV2ZWxzLnN1Ykxpc3QoXG4gICAgICAgICAgICAgICAgICAgIDEsXG4gICAgICAgICAgICAgICAgICAgIGZpbGxMZXZlbHMuc2l6ZVxuICAgICAgICAgICAgICAgICksIHBvbHlnb25MaXN0QnlGaWxsTGV2ZWxcbiAgICAgICAgICAgIClcbiAgICAgICAgf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VN0YXRVdGlsLmRlbnNpdHlGdW5jdGlvbkZ1bGxTY2FuKFxuICAgICAgICAgICAgICAgIHhzLFxuICAgICAgICAgICAgICAgIHdlaWdodHMsXG4gICAgICAgICAgICAgICAga2VybmVsRnVuLFxuICAgICAgICAgICAgICAgIGJhbmRXaWR0aCxcbiAgICAgICAgICAgICAgICBhZGp1c3RcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIGZhbHNlIC0+IERlbnNpdHlTdGF0VXRpbC5kZW5zaXR5RnVuY3Rpb25GYXN0KFxuICAgICAgICAgICAgICAgIHhzLFxuICAgICAgICAgICAgICAgIHdlaWdodHMsXG4gICAgICAgICAgICAgICAga2VybmVsRnVuLFxuICAgICAgICAgICAgICAgIGJhbmRXaWR0aCxcbiAgICAgICAgICAgICAgICBhZGp1c3RcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBuVG90YWwgPSB3ZWlnaHRzLnN1bSgpXG4gICAgICAgIGZvciAoeCBpbiBzdGF0WCkge1xuICAgICAgICAgICAgdmFsIGQgPSBkZW5zaXR5RnVuY3Rpb24oeClcbiAgICAgICAgICAgIHN0YXRDb3VudC5hZGQoZClcbiAgICAgICAgICAgIHN0YXREZW5zaXR5LmFkZChkIC8gblRvdGFsKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIG1heG0gPSBzdGF0Q291bnQubWF4T3JOdWxsKCkhIVxuICAgICAgICBmb3IgKGQgaW4gc3RhdENvdW50KSB7XG4gICAgICAgICAgICBzdGF0U2NhbGVkLmFkZChkIC8gbWF4bSlcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBEYXRhRnJhbWUuQnVpbGRlcigpXG4gICAgICAgICAgICAucHV0TnVtZXJpYyhTdGF0cy5YLCBzdGF0WClcbiAgICAgICAgICAgIC5wdXROdW1lcmljKFN0YXRzLkRFTlNJVFksIHN0YXREZW5zaXR5KVxuICAgICAgICAgICAgLnB1dE51bWVyaWMoU3RhdHMuQ09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ZhbCB2YWx1ZXNYRmluaXRlID0gdmFsdWVzWC5maWx0ZXIgeyBTZXJpZXNVdGlsLmlzRmluaXRlKGl0KSB9IGFzIExpc3Q8RG91YmxlPlxuICAgICAgICB2YWwgZGF0YVN1bW1hcnkgPSBGaXZlTnVtYmVyU3VtbWFyeSh2YWx1ZXNYRmluaXRlKVxuICAgICAgICB2YWwgbXlJUVIgPSBkYXRhU3VtbWFyeS50aGlyZFF1YXJ0aWxlIC0gZGF0YVN1bW1hcnkuZmlyc3RRdWFydGlsZVxuICAgICAgICB2YWwgbXlTdGREID0gc3RkRGV2KHZhbHVlc1hGaW5pdGUpXG5cbiAgICAgICAgd2hlbiAoYncpIHtcbiAgICAgICAgICAgIERlbnNpdHlTdGF0LkJhbmRXaWR0aE1ldGhvZC5OUkQwIC0+IHtcbiAgICAgICAgICAgICAgICBpZiAobXlJUVIgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAwLjkgKiBtaW4obXlTdGRELCBteUlRUiAvIDEuMzQpICogbXlTaXplLnRvRG91YmxlKCkucG93KC0wLjIpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChteVN0ZEQgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAwLjkgKiBteVN0ZEQgKiBteVNpemUudG9Eb3VibGUoKS5wb3coLTAuMilcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBEZW5zaXR5U3RhdC5CYW5kV2lkdGhNZXRob2QuTlJEIC0+IHtcbiAgICAgICAgICAgICAgICBpZiAobXlJUVIgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAxLjA2ICogbWluKG15U3RkRCwgbXlJUVIgLyAxLjM0KSAqIG15U2l6ZS50b0RvdWJsZSgpLnBvdygtMC4yKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAobXlTdGREID4gMCkge1xuICAgICAgICAgICAgICA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GlmIChhYnModmFsdWUpIDw9IDEpIFBJIC8gNCAqIGNvcyhQSSAvIDIgKiB2YWx1ZSkgZWxzZSAwLjAgfVxuICAgICAgICAgICAgZWxzZSAvL2Nhc2UgQ09TSU5FXG4gICAgICAgICAgICAtPiB7IHZhbHVlIC0+IGlmIChhYnModmFsdWUpIDw9IDEpIChjb3MoUEkgKiB2YWx1ZSkgKyAxKSAvIDIgZWxzZSAwLjAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgaW50ZXJuYWwgZnVuIGRlbnNpdHlGdW5jdGlvbkZ1bGxTY2FuKFxuICAgICAgICB4czogTGlzdDxEb3VibGU+LFxuICAgICAgICB3ZWlnaHRzOiBMaXN0PERvdWJsZT4sXG4gICAgICAgIGtlcjogKERvdWJsZSkgLT4gRG91YmxlLFxuICAgICAgICBidzogRG91YmxlLFxuICAgICAgICBhZDogRG91YmxlXG4gICAgKTogKERvdWJsZSkgLT4gRG91YmxlIHtcbiAgICAgICAgdmFsIGggPSBidyAqIGFkXG4gICAgICAgIHJldHVybiB7IHggLT5cbiAgICAgICAgICAgIHZhciBzdW0gPSAwLjBcbiAgICAgICAgICAgIGZvciAoaSBpbiB4cy5pbmRpY2VzKSB7XG4gICAgICAgICAgICAgICAgc3VtICs9IGtlcigoeCAtIHhzW2ldKSAvIGgpICogd2VpZ2h0c1tpXVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc3VtIC8gaFxuICAgICAgICB9XG4gICAgfVxuXG4gICAgaW50ZXJuYWwgZnVuIGRlbnNpdHlGdW5jdGlvbkZhc3QoXG4gICAgICAgIHhzOiBMaXN0PERvdWJsZT4sICAvLyBtdXN0IGJlIG9yZGVyZWQhXG4gICAgICAgIHdlaWdodHM6IExpc3Q8RG91YmxlPixcbiAgICAgICAga2VyOiAoRG91YmxlKSAtPiBEb3VibGUsXG4gICAgICAgIGJ3OiBEb3VibGUsXG4gICAgICAgIGFkOiBEb3VibGVcbiAgICApOiAoRG91YmxlKSAtPiBEb3VibGUge1xuICAgICAgICB2YWwgaCA9IGJ3ICogYWRcbiAgICAgICAgdmFsIGN1dG9mZiA9IGggKiA1XG5cbiAgICAgICAgcmV0dXJuIHsgeCAtPlxuICAgICAgICAgICAgdmFyIHN1bSA9IDAuMFxuICAgICAgICAgICAgdmFyIGZyb20gPSB4cy5iaW5hcnlTZWFyY2goeCAtIGN1dG9mZilcbiAgICAgICAgICAgIGlmIChmcm9tIDwgMCkge1xuICAgICAgICAgICAgICAgIGZyb20gPSAtZnJvbSAtIDFcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciB0byA9IHhzLmJpbmFyeVNlYXJjaCh4ICsgY3V0b2ZmKVxuICAgICAgICAgICAgaWYgKHRvIDwgMCkge1xuICAgICAgICAgICAgICAgIHRvID0gLXRvIC0gMVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmb3IgKGkgaW4gKGZyb20gdW50aWwgdG8pKSB7XG4gICAgICAgICAgICAgICAgc3VtICs9IGtlcigoeCAtIHhzW2ldKSAvIGgpICogd2VpZ2h0c1tpXVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc3VtIC8gaFxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuIGNyZWF0ZVN0ZXBWYWx1ZXMocmFuZ2U6IENsb3NlZFJhbmdlPERvdWJsZT4sIG46IEludCk6IExpc3Q8RG91YmxlPiB7XG4gICAgICAgIHZhbCB4ID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICB2YXIgbWluID0gcmFuZ2UubG93ZXJFbmRcbiAgICAgICAgdmFyIG1heCA9IHJhbmdlLnVwcGVyRW5kXG4gICAgICAgIHZhbCBzdGVwOiBEb3VibGVcblxuICAgICAgICBpZiAobWF4ID09IG1pbikge1xuICAgICAgICAgICAgbWF4ICs9IERFRl9TVEVQX1NJWkVcbiAgICAgICAgICAgIG1pbiAtPSBERUZfU1RFUF9TSVpFXG4gICAgICAgIH1cbiAgICAgICAgc3RlcCA9IChtYX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AgcHJpdmF0ZSB2YWwgbXlJbmRpY2VzOiBNdXRhYmxlTGlzdDxJbnQ+XG5cbiAgICBpbml0IHtcbiAgICAgICAgbXlJbmRpY2VzID0gQXJyYXlMaXN0KG15S2V5cy5zaXplKVxuICAgICAgICBmb3IgKGkgaW4gbXlLZXlzLmluZGljZXMpIHtcbiAgICAgICAgICAgIG15SW5kaWNlcy5hZGQoaSlcbiAgICAgICAgfVxuXG4gICAgICAgIG15SW5kaWNlcy5zb3J0V2l0aChDb21wYXJhdG9yIHsgaTogSW50PywgajogSW50PyAtPlxuICAgICAgICAgICAgdmFsIGtleUkgPSBteUtleXNbaSEhXVxuICAgICAgICAgICAgdmFsIGtleUogPSBteUtleXNbaiEhXVxuICAgICAgICAgICAgd2hlbiB7XG4gICAgICAgICAgICAgICAga2V5SSA9PT0ga2V5SiAtPiAwXG4gICAgICAgICAgICAgICAga2V5SSA9PSBudWxsIC0+IC0xXG4gICAgICAgICAgICAgICAga2V5SiA9PSBudWxsIC0+IDFcbiAgICAgICAgICAgICAgICBlbHNlIC0+IGtleUkuY29tcGFyZVRvKGtleUopXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pXG4gICAgfVxuXG4gICAgZnVuIDxUPiBzb3J0ZWRDb3B5KGw6IExpc3Q8VD8+KTogTGlzdDxUPz4ge1xuICAgICAgICByZXF1aXJlKGwuc2l6ZSA9PSBteUluZGljZXMuc2l6ZSkgeyBcIkV4cGVjdGVkIHNpemUgXCIgKyBteUluZGljZXMuc2l6ZSArIFwiIGJ1dCB3YXMgc2l6ZSBcIiArIGwuc2l6ZSB9XG4gICAgICAgIHZhbCBjb3B5ID0gQXJyYXlMaXN0PFQ/PihteUluZGljZXMuc2l6ZSlcbiAgICAgICAgZm9yIChvbGRJbmRleCBpbiBteUluZGljZXMpIHtcbiAgICAgICAgICAgIHZhbCB2ID0gbFtvbGRJbmRleF1cbiAgICAgICAgICAgIGNvcHkuYWRkKHYpXG4gICAgICAgIH1cbiAgICAgICAgcm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S5WYXJpYWJsZShcIi4uZ3JvdXAuLlwiLCBTVEFULCBcImdyb3VwXCIpXG5cbiAgICB2YWwgSURFTlRJVFk6IFN0YXQgPSBJZGVudGl0eVN0YXQoKVxuXG4gICAgcHJpdmF0ZSB2YWwgVkFSUzogTWFwPFN0cmluZywgRGF0YUZyYW1lLlZhcmlhYmxlPiA9IHJ1biB7XG4gICAgICAgIHZhbCB2YXJpYWJsZUxpc3QgPSBsaXN0T2YoXG4gICAgICAgICAgICBYLFxuICAgICAgICAgICAgWSxcbiAgICAgICAgICAgIENPVU5ULFxuICAgICAgICAgICAgREVOU0lUWSxcbiAgICAgICAgICAgIFlfTUlOLFxuICAgICAgICAgICAgWV9NQVgsXG4gICAgICAgICAgICBTRSxcbiAgICAgICAgICAgIExFVkVMLFxuICAgICAgICAgICAgTE9XRVIsXG4gICAgICAgICAgICBNSURETEUsXG4gICAgICAgICAgICBVUFBFUixcbiAgICAgICAgICAgIFdJRFRILFxuICAgICAgICAgICAgU0NBTEVELFxuICAgICAgICAgICAgR1JPVVAsXG4gICAgICAgICAgICBDT1JSLFxuICAgICAgICAgICAgQ09SUl9BQlNcbiAgICAgICAgKVxuXG4gICAgICAgIHZhbCByZXN1bHQgPSBIYXNoTWFwPFN0cmluZywgRGF0YUZyYW1lLlZhcmlhYmxlPigpXG4gICAgICAgIGZvciAodmFyaWFibGUgaW4gdmFyaWFibGVMaXN0KSB7XG4gICAgICAgICAgICByZXN1bHRbdmFyaWFibGUubmFtZV0gPSB2YXJpYWJsZVxuICAgICAgICB9XG4gICAgICAgIHJlc3VsdFxuICAgIH1cblxuICAgIGZ1biBpc1N0YXRWYXIodmFyTmFtZTogU3RyaW5nKTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiBWQVJTLmNvbnRhaW5zS2V5KHZhck5hbWUpXG4gICAgfVxuXG4gICAgZnVuIHN0YXRWYXIodmFyTmFtZTogU3RyaW5nKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICA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gICAgICB4UG9zS2luZCA9IEJpblN0YXQuWFBvc0tpbmQuQk9VTkRBUllcbiAgICAgICAgICAgIHhQb3NWYWx1ZSA9IGJvdW5kYXJ5XG4gICAgICAgIH0gZWxzZSBpZiAoY2VudGVyICE9IG51bGwpIHtcbiAgICAgICAgICAgIHhQb3NLaW5kID0gQmluU3RhdC5YUG9zS2luZC5DRU5URVJcbiAgICAgICAgICAgIHhQb3NWYWx1ZSA9IGNlbnRlclxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIEJpblN0YXQoXG4gICAgICAgICAgICBiaW5Db3VudCA9IGJpbkNvdW50LFxuICAgICAgICAgICAgYmluV2lkdGggPSBiaW5XaWR0aCxcbiAgICAgICAgICAgIHhQb3NLaW5kID0geFBvc0tpbmQsXG4gICAgICAgICAgICB4UG9zID0geFBvc1ZhbHVlXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gc21vb3RoKFxuICAgICAgICBzbW9vdGhlclBvaW50Q291bnQ6IEludCA9IFNtb290aFN0YXQuREVGX0VWQUxfUE9JTlRfQ09VTlQsXG4gICAgICAgIHNtb290aGluZ01ldGhvZDogU21vb3RoU3RhdC5NZXRob2QgPSBTbW9vdGhTdGF0LkRFRl9TTU9PVEhJTkdfTUVUSE9ELFxuICAgICAgICBjb25maWRlbmNlTGV2ZWw6IERvdWJsZSA9IFNtb290aFN0YXQuREVGX0NPTkZJREVOQ0VfTEVWRUwsXG4gICAgICAgIGRpc3BsYXlDb25maWRlbmNlSW50ZXJ2YWw6IEJvb2xlYW4gPSBTbW9vdGhTdGF0LkRFRl9ESVNQTEFZX0NPTkZJREVOQ0VfSU5URVJWQUwsXG4gICAgICAgIHNwYW46IERvdWJsZSA9IFNtb290aFN0YXQuREVGX1NQQU4sXG4gICAgICAgIHBvbHlub21pYWxEZWdyZWU6IEludCA9IFNtb290aFN0YXQuREVGX0RFRyxcbiAgICAgICAgbG9lc3NDcml0aWNhbFNpemU6IEludCA9IFNtb290aFN0YXQu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AgICk6IENvcnJlbGF0aW9uU3RhdCB7XG4gICAgICAgIHJldHVybiBDb3JyZWxhdGlvblN0YXQoXG4gICAgICAgICAgICBjb3JyZWxhdGlvbk1ldGhvZCA9IGNvcnJlbGF0aW9uTWV0aG9kLFxuICAgICAgICAgICAgdHlwZSA9IHR5cGUsXG4gICAgICAgICAgICBmaWxsRGlhZ29uYWwgPSBmaWxsRGlhZ29uYWwsXG4gICAgICAgICAgICB0aHJlc2hvbGQgPSB0aHJlc2hvbGRcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biBjb250b3VyKFxuICAgICAgICBiaW5Db3VudDogSW50ID0gQ29udG91clN0YXQuREVGX0JJTl9DT1VOVCxcbiAgICAgICAgYmluV2lkdGg6IERvdWJsZT8gPSBudWxsXG4gICAgKTogQ29udG91clN0YXQge1xuICAgICAgICByZXR1cm4gQ29udG91clN0YXQoXG4gICAgICAgICAgICBiaW5Db3VudCA9IGJpbkNvdW50LFxuICAgICAgICAgICAgYmluV2lkdGggPSBiaW5XaWR0aFxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIGNvbnRvdXJmKFxuICAgICAgICBiaW5Db3VudDogSW50ID0gQ29udG91clN0YXQuREVGX0JJTl9DT1VOVCxcbiAgICAgICAgYmluV2lkdGg6IERvdWJsZT8gPSBudWxsXG4gICAgKTogQ29udG91cmZTdGF0IHtcbiAgICAgICAgcmV0dXJuIENvbnRvdXJmU3RhdChcbiAgICAgICAgICAgIGJpbkNvdW50ID0gYmluQ291bnQsXG4gICAgICAgICAgICBiaW5XaWR0aCA9IGJpbldpZHRoXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gYm94cGxvdChcbiAgICAgICAgd2hpc2tlcklRUlJhdGlvOiBEb3VibGUgPSBCb3hwbG90U3RhdC5ERUZfV0hJU0tFUl9JUVJfUkFUSU8sXG4gICAgICAgIGNvbXB1dGVXaWR0aDogQm9vbGVhbiA9IEJveHBsb3RTdGF0LkRFRl9DT01QVVRFX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G91YmxlIHtcbiAgICAgICAgaW5jcmVtZW50RXZhbHVhdGlvbkNvdW50KClcbiAgICAgICAgcmV0dXJuIGZ1bmN0aW9uISEudmFsdWUocG9pbnQpXG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUHJlcGFyZSBmb3IgY29tcHV0YXRpb24uXG4gICAgICogU3ViY2xhc3NlcyBtdXN0IGNhbGwgdGhpcyBtZXRob2QgaWYgdGhleSBvdmVycmlkZSBhbnkgb2YgdGhlXG4gICAgICogYHNvbHZlYCBtZXRob2RzLlxuICAgICAqXG4gICAgICogQHBhcmFtIGYgRnVuY3Rpb24gdG8gc29sdmUuXG4gICAgICogQHBhcmFtIG1pbiBMb3dlciBib3VuZCBmb3IgdGhlIGludGVydmFsLlxuICAgICAqIEBwYXJhbSBtYXggVXBwZXIgYm91bmQgZm9yIHRoZSBpbnRlcnZhbC5cbiAgICAgKiBAcGFyYW0gc3RhcnRWYWx1ZSBTdGFydCB2YWx1ZSB0byB1c2UuXG4gICAgICogQHBhcmFtIG1heEV2YWwgTWF4aW11bSBudW1iZXIgb2YgZXZhbHVhdGlvbnMuXG4gICAgICovXG4gICAgcHJvdGVjdGVkIGZ1biBzZXR1cChcbiAgICAgICAgbWF4RXZhbDogSW50LFxuICAgICAgICBmOiBGVU5DLFxuICAgICAgICBtaW46IERvdWJsZSwgbWF4OiBEb3VibGUsXG4gICAgICAgIHN0YXJ0VmFsdWU6IERvdWJsZVxuICAgICkge1xuXG4gICAgICAgIC8vIFJlc2V0LlxuICAgICAgICB0aGlzLm1pbiA9IG1pblxuICAgICAgICB0aGlzLm1heCA9IG1heFxuICAgICAgICB0aGlzLnN0YXJ0VmFsdWUgPSBzdGFydFZhbHVlXG4gICAgICAgIGZ1bmN0aW9uID0gZlxuICAgICAgICBteUV2YWx1YXRpb25zLm1heGltYWxDb3VudCA9IG1heEV2YWxcbiAgICAgICAgbXlFdmFsdWF0aW9ucy5yZXNldENvdW50KClcbiAgICB9XG5cbiAgICAvKioge0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Y2FsIGVycm9yLiAgKi9cbiAgICBwcml2YXRlIHZhbCBERUZBVUxUX0VQU0lMT04gPSAxMGUtMTVcblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIHJlZ3VsYXJpemVkIGJldGEgZnVuY3Rpb24gSSh4LCBhLCBiKS5cbiAgICAgKlxuICAgICAqIEBwYXJhbSB4IHRoZSB2YWx1ZS5cbiAgICAgKiBAcGFyYW0gYSBQYXJhbWV0ZXIgYGFgLlxuICAgICAqIEBwYXJhbSBiIFBhcmFtZXRlciBgYmAuXG4gICAgICogQHBhcmFtIG1heEl0ZXJhdGlvbnMgTWF4aW11bSBudW1iZXIgb2YgXCJpdGVyYXRpb25zXCIgdG8gY29tcGxldGUuXG4gICAgICogQHJldHVybiB0aGUgcmVndWxhcml6ZWQgYmV0YSBmdW5jdGlvbiBJKHgsIGEsIGIpXG4gICAgICogQHRocm93cyBvcmcuYXBhY2hlLmNvbW1vbnMubWF0aDMuZXhjZXB0aW9uLk1heENvdW50RXhjZWVkZWRFeGNlcHRpb25cbiAgICAgKiBpZiB0aGUgYWxnb3JpdGhtIGZhaWxzIHRvIGNvbnZlcmdlLlxuICAgICAqL1xuICAgIGZ1biByZWd1bGFyaXplZEJldGEoXG4gICAgICAgIHg6IERvdWJsZSxcbiAgICAgICAgYTogRG91YmxlLCBiOiBEb3VibGUsXG4gICAgICAgIG1heEl0ZXJhdGlvbnM6IEludFxuICAgICk6IERvdWJsZSB7XG4gICAgICAgIHJldHVybiByZWd1bGFyaXplZEJldGEoXG4gICAgICAgICAgICB4LFxuICAgICAgICAgICAgYSxcbiAgICAgICAgICAgIGIsXG4gICAgICAgICAgICBERUZBVUxUX0VQU0lMT04sXG4gICAgICAgICAgICBtYXhJdGVyYXRpb25zXG4gICAgICAgIClcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIHRoZSByZWd1bGFyaXplZCBiZXRhIGZ1bmN0aW9uIEkoeCwgYSwgYikuXG4gICAgICpcbiA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IEBKdm1PdmVybG9hZHNcbiAgICBmdW4gcmVndWxhcml6ZWRCZXRhKFxuICAgICAgICB4OiBEb3VibGUsXG4gICAgICAgIGE6IERvdWJsZSwgYjogRG91YmxlLFxuICAgICAgICBlcHNpbG9uOiBEb3VibGUgPSBERUZBVUxUX0VQU0lMT04sIG1heEl0ZXJhdGlvbnM6IEludCA9IEludC5NQVhfVkFMVUVcbiAgICApOiBEb3VibGUge1xuICAgICAgICB2YWwgcmV0OiBEb3VibGVcblxuICAgICAgICBpZiAoeC5pc05hTigpIHx8XG4gICAgICAgICAgICBhLmlzTmFOKCkgfHxcbiAgICAgICAgICAgIGIuaXNOYU4oKSB8fFxuICAgICAgICAgICAgeCA8IDAgfHxcbiAgICAgICAgICAgIHggPiAxIHx8XG4gICAgICAgICAgICBhIDw9IDAuMCB8fFxuICAgICAgICAgICAgYiA8PSAwLjBcbiAgICAgICAgKSB7XG4gICAgICAgICAgICByZXQgPSBEb3VibGUuTmFOXG4gICAgICAgIH0gZWxzZSBpZiAoeCA+IChhICsgMS4wKSAvIChhICsgYiArIDIuMCkpIHtcbiAgICAgICAgICAgIHJldCA9IDEuMCAtIHJlZ3VsYXJpemVkQmV0YShcbiAgICAgICAgICAgICAgICAxLjAgLSB4LFxuICAgICAgICAgICAgICAgIGIsXG4gICAgICAgICAgICAgICAgYSxcbiAgICAgICAgICAgICAgICBlcHNpbG9uLFxuICAgICAgICAgICAgICAgIG1heEl0ZXJhdGlvbnNcbiAgICAgICAgICAgIClcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHZhbCBmcmFjdGlvbiA9IG9iamVjdCA6IENvbnRpbnVlZEZyYWN0aW9uKCkge1xuXG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGdldEIobjogSW50LCB4OiBEb3VibGUpOiBEb3VibGUge1xuICAgICAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJOQU1FX1NIQURPV0lOR1wiKVxuICAgICAgICAgICAgICAgICAgICB2YWwgcmV0OiBEb3VibGVcbiAgICAgICAgICAgICAgICAgICAgdmFsIG06IERvdWJsZVxuICAgICAgICAgICAgICAgICAgICBpZiAobiAlIDIgPT0gMCkgeyAvLyBldmVuXG4gICAgICAgICAgICAgICAgICAgICAgICBtID0gbiAvIDIuMFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0ID0gbSAqIChiIC0gbSkgKiB4IC8gKChhICsgMiAqIG0gLSAxKSAqIChhICsgMiAqIG0pKVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbSA9IChuIC0gMS4wKSAvIDIuMFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0ID0gLSgoYSArIG0pICogKGEgKyBiICsgbSkgKiB4KSAvICgoYSArIDIgKiBtKSAqIChhICsgMiAqIG0gKyAxLjApKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiByZXRcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gZ2V0QShuOiBJbnQsIHg6IERvdWJsZSk6IERvdWJsZSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAxLjBcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXQgPSBleHAoXG4gICAgICAgICAgICAgICAgYSAqIGxuKHgpICsgYiAqIGxuKDEuMCAtIHgpIC1cbiAgICAgICAgICAgICAgICAgICAgICAgIGxuKGEpIC0gbG9nQmV0YShhLCBiLCBlcHNpbG9uLCBtYXhJdGVyYXRpb25zKVxuICAgICAgICAgICAgKSAqIDEuMCAvIGZyYWN0aW9uLmV2YWx1YXRlKHgsIGVwc2lsb24sIG1heEl0ZXJhdGlvbnMpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmV0XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV0dXJucyB0aGUgbmF0dXJhbCBsb2dh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CBib3R0b21cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIC8vIHJlZmVyZW5jZSBleGlzdGluZyBhcnJheVxuICAgICAgICAgICAgYmxvY2tzID0gYmxvY2tEYXRhXG4gICAgICAgIH1cblxuICAgICAgICB2YXIgaW5kZXggPSAwXG4gICAgICAgIGZvciAoaUJsb2NrIGluIDAgdW50aWwgYmxvY2tSb3dzKSB7XG4gICAgICAgICAgICB2YWwgaUhlaWdodCA9IGJsb2NrSGVpZ2h0KGlCbG9jaylcbiAgICAgICAgICAgIHZhciBqQmxvY2sgPSAwXG4gICAgICAgICAgICB3aGlsZSAoakJsb2NrIDwgYmxvY2tDb2x1bW5zKSB7XG4gICAgICAgICAgICAgICAgaWYgKGJsb2NrRGF0YVtpbmRleF0uc2l6ZSAhPSBpSGVpZ2h0ICogYmxvY2tXaWR0aChqQmxvY2spKSB7XG4gICAgICAgICAgICAgICAgICAgIGVycm9yKFwiXCIpXG4gICAgICAgICAgICAgICAgICAgIC8vdGhyb3cgRGltZW5zaW9uTWlzbWF0Y2hFeGNlcHRpb24oXG4gICAgICAgICAgICAgICAgICAgIC8vICAgIGJsb2NrRGF0YVtpbmRleF0uc2l6ZSxcbiAgICAgICAgICAgICAgICAgICAgLy8gICAgaUhlaWdodCAqIGJsb2NrV2lkdGgoakJsb2NrKVxuICAgICAgICAgICAgICAgICAgICAvLylcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGNvcHlBcnJheSkge1xuICAgICAgICAgICAgICAgICAgICBibG9ja3NDb3B5TGlzdC5hZGQoYmxvY2tEYXRhW2luZGV4XS5jb3B5T2YoKSlcbiAgICAgICAgICAgICAgICAgICAgLy9ibG9ja3NbaW5kZXhdID0gYmxvY2tEYXRhW2luZGV4XS5jb3B5T2YoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICArK2pCbG9ja1xuICAgICAgICAgICAgICAgICsraW5kZXhcbiAgICAgICAgICAgIH1cb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AgIGZvciAoaUJsb2NrIGluIDAgdW50aWwgYmxvY2tSb3dzKSB7XG4gICAgICAgICAgICB2YWwgcFN0YXJ0ID0gaUJsb2NrICogQkxPQ0tfU0laRVxuICAgICAgICAgICAgdmFsIHBFbmQgPSBtaW4ocFN0YXJ0ICsgQkxPQ0tfU0laRSwgcm93cylcbiAgICAgICAgICAgIHZhbCBpSGVpZ2h0ID0gcEVuZCAtIHBTdGFydFxuICAgICAgICAgICAgZm9yIChqQmxvY2sgaW4gMCB1bnRpbCBibG9ja0NvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICB2YWwgcVN0YXJ0ID0gakJsb2NrICogQkxPQ0tfU0laRVxuICAgICAgICAgICAgICAgIHZhbCBxRW5kID0gbWluKHFTdGFydCArIEJMT0NLX1NJWkUsIGNvbHVtbnMpXG4gICAgICAgICAgICAgICAgdmFsIGpXaWR0aCA9IHFFbmQgLSBxU3RhcnRcbiAgICAgICAgICAgICAgICBibG9ja3NMaXN0LmFkZChEb3VibGVBcnJheShpSGVpZ2h0ICogaldpZHRoKSlcbiAgICAgICAgICAgICAgICArK2Jsb2NrSW5kZXhcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBibG9ja3NMaXN0LnRvVHlwZWRBcnJheSgpXG4gICAgfVxuXG4gICAgZnVuIHRyYW5zcG9zZSgpOiBCbG9ja1JlYWxNYXRyaXgge1xuICAgICAgICB2YWwgblJvd3MgPSBnZXRSb3dEaW1lbnNpb24oKVxuICAgICAgICB2YWwgbkNvbHMgPSBnZXRDb2x1bW5EaW1lbnNpb24oKVxuICAgICAgICB2YWwgb3V0ID0gQmxvY2tSZWFsTWF0cml4KG5Db2xzLCBuUm93cylcblxuICAgICAgICAvLyBwZXJmb3JtIHRyYW5zcG9zZSBibG9jay13aXNlLCB0byBlbnN1cmUgZ29vZCBjYWNoZSBiZWhhdmlvclxuICAgICAgICB2YXIgYmxvY2tJbmRleCA9IDBcbiAgICAgICAgZm9yIChpQmxvY2sgaW4gMCB1bnRpbCBibG9ja0NvbHVtbnMpIHtcbiAgICAgICAgICAgIGZvciAoakJsb2NrIGluIDAgdW50aWwgYmxvY2tSb3dzKSB7XG4gICAgICAgICAgICAgICAgLy8gdHJhbnNwb3NlIGN1cnJlbnQgYmxvY2tcbiAgICAgICAgICAgICAgICB2YWwgb3V0QmxvY2sgPSBvdXQuYmxvY2tzW2Jsb2NrSW5kZXhdXG4gICAgICAgICAgICAgICAgdmFsIHRCbG9jayA9IGJsb2Nrc1tqQmxvY2sgKiBibG9ja0NvbHVtbnMgKyBpQmxvY2tdXG4gICAgICAgICAgICAgICAgdmFsIHBTdGFydCA9IGlCbG9jayAqIEJMT0NLX1NJWkVcbiAgICAgICAgICAgICAgICB2YWwgcEVuZCA9IG1pbihwU3RhcnQgKyBCTE9DS19TSVpFLCBjb2x1bW5zKVxuICAgICAgICAgICAgICAgIHZhbCBxU3RhcnQgPSBqQmxvY2sgKiBCTE9DS19TSVpFXG4gICAgICAgICAgICAgICAgdmFsIHFFbmQgPSBtaW4ocVN0YXJ0ICsgQkxPQ0tfU0laRSwgcm93cylcbiAgICAgICAgICAgICAgICB2YXIgayA9IDBcbiAgICAgICAgICAgICAgICBmb3IgKHAgaW4gcFN0YXJ0IHVudGlsIHBFbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIGxJbmMgPSBwRW5kIC0gcFN0YXJ0XG4gICAgICAgICAgICAgICAgICAgIHZhciBsID0gcCAtIHBTdGFydFxuICAgICAgICAgICAgICAgICAgICBmb3IgKHEgaW4gcVN0YXJ0IHVudGlsIHFFbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG91dEJsb2NrW2tdID0gdEJsb2NrW2xdXG4gICAgICAgICAgICAgICAgICAgICAgICArK2tcbiAgICAgICAgICAgICAgICAgICAgICAgIGwgKz0gbEluY1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIG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xuICAgICAgICAgICAgdmFsIHBTdGFydCA9IGlCbG9jayAqIEJMT0NLX1NJWkVcbiAgICAgICAgICAgIHZhbCBwRW5kID0gbWluKHBTdGFydCArIEJMT0NLX1NJWkUsIHJvd3MpXG5cbiAgICAgICAgICAgIGZvciAoakJsb2NrIGluIDAgdW50aWwgb3V0LmJsb2NrQ29sdW1ucykge1xuICAgICAgICAgICAgICAgIHZhbCBqV2lkdGggPSBvdXQuYmxvY2tXaWR0aChqQmxvY2spXG4gICAgICAgICAgICAgICAgdmFsIGpXaWR0aDIgPSBqV2lkdGggKyBqV2lkdGhcbiAgICAgICAgICAgICAgICB2YWwgaldpZHRoMyA9IGpXaWR0aDIgKyBqV2lkdGhcbiAgICAgICAgICAgICAgICB2YWwgaldpZHRoNCA9IGpXaWR0aDMgKyBqV2lkdGhcblxuICAgICAgICAgICAgICAgIC8vIHNlbGVjdCBjdXJyZW50IGJsb2NrXG4gICAgICAgICAgICAgICAgdmFsIG91dEJsb2NrID0gb3V0LmJsb2Nrc1tibG9ja0luZGV4XVxuXG4gICAgICAgICAgICAgICAgLy8gcGVyZm9ybSBtdWx0aXBsaWNhdGlvbiBvbiBjdXJyZW50IGJsb2NrXG4gICAgICAgICAgICAgICAgZm9yIChrQmxvY2sgaW4gMCB1bnRpbCBibG9ja0NvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIGtXaWR0aCA9IGJsb2NrV2lkdGgoa0Jsb2NrKVxuICAgICAgICAgICAgICAgICAgICB2YWwgdEJsb2NrID0gYmxvY2tzW2lCbG9jayAqIGJsb2NrQ29sdW1ucyArIGtCbG9ja11cbiAgICAgICAgICAgICAgICAgICAgdmFsIG1CbG9jayA9IG0uYmxvY2tzW2tCbG9jayAqIG0uYmxvY2tDb2x1bW5zICsgakJsb2NrXVxuICAgICAgICAgICAgICAgICAgICB2YXIgayA9IDBcbiAgICAgICAgICAgICAgICAgICAgZm9yIChwIGluIHBTdGFydCB1bnRpbCBwRW5kKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgbFN0YXJ0ID0gKHAgLSBwU3RhcnQpICoga1dpZHRoXG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgbEVuZCA9IGxTdGFydCArIGtXaWR0aFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuU3RhcnQgaW4gMCB1bnRpbCBqV2lkdGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgc3VtID0gMC4wXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBsU3RhcnRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG5TdGFydFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChsIDwgbEVuZCAtIDMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VtICs9IHRCbG9ja1tsXSAqIG1CbG9ja1tuXSArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdEJsb2NrW2wgKyAxXSAqIG1CbG9ja1tuICsgaldpZHRoXSArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdEJsb2NrW2wgKyAyXSAqIG1CbG9ja1tuICsgaldpZHRoMl0gK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRCbG9ja1tsICsgM10gKiBtQmxvY2tbbiArIGpXaWR0aDNdXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgKz0gNFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICs9IGpXaWR0aDRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGwgPCBsRW5kKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1bSArPSB0QmxvY2tbbCsrXSAqIG1CbG9ja1tuXVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICs9IGpXaWR0aFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRCbG9ja1trXSArPSBzdW1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2tcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBnbyB0byBuZXh0IGJsb2NrXG4gICAgICAgICAgICAgICAgKytibG9ja0luZGV4XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gb3V0XG4gICAgfVxuXG5cbiAgICAvKioge0Bpbmhlcml0RG9jfSAgKi9cbiAgICBmdW4gZ2V0RW50cnkocm93OiBJbnQsIGNvbHVtbjogSW50KTogRG91YmxlIHtcbiAgICAgICAgLy9NYXRyaXhVdGlscy5jaGVja01hdHJpeEluZGV4KHRoaXMsIHJvdywgY29sdW1uKVxuICAgICAgICBpZiAocm93IDwgMCB8fCByb3cgPiBnZXRSb3dEaW1lbnNpb24oKSkgZXJyb3IoXCJyb3cgb3V0IG9mIHJhbmdlOiAkcm93XCIpXG4gICAgICAgIGlmIChjb2x1bW4gPCAwIHx8IGNvbHVtbiA+IGdldENvbHVtbkRpbWVuc2lvbigpKSBlcnJvcihcImNvbHVtbiBvdXQgb2YgcmFuZ2U6ICRjb2x1bW5cIilcblxuICAgICAgICB2YWwgaUJsb2NrID0gcm93IC8gQkxPQ0tfU0laRVxuICAgICAgICB2YWwgakJsb2NrID0gY29sdW1uIC8gQkxPQ0tfU0laRVxuICAgICAgICB2YWwgayA9IChyb3cgLSBpQmxvY2sgKiBCTE9DS19TSVpFKSAqIGJsb2NrV2lkdGgoakJsb2NrKSArIChjb2x1bW4gLSBqQmxvY2sgKiBCTE9DS19TSVpFKVxuICAgICAgICByZXR1cm4gYmxvY2tzW2lCbG9jayAqIGJsb2NrQ29sdW1ucyArIG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QmxvY2sgaW4gMCB1bnRpbCBibG9ja1Jvd3MpIHtcbiAgICAgICAgICAgIHZhbCBwU3RhcnQgPSBpQmxvY2sgKiBCTE9DS19TSVpFXG4gICAgICAgICAgICB2YWwgcEVuZCA9IG1pbihwU3RhcnQgKyBCTE9DS19TSVpFLCByb3dzKVxuICAgICAgICAgICAgdmFsIGlIZWlnaHQgPSBwRW5kIC0gcFN0YXJ0XG4gICAgICAgICAgICBmb3IgKGpCbG9jayBpbiAwIHVudGlsIGJsb2NrQ29sdW1ucykge1xuICAgICAgICAgICAgICAgIHZhbCBxU3RhcnQgPSBqQmxvY2sgKiBCTE9DS19TSVpFXG4gICAgICAgICAgICAgICAgdmFsIHFFbmQgPSBtaW4ocVN0YXJ0ICsgQkxPQ0tfU0laRSwgY29sdW1ucylcbiAgICAgICAgICAgICAgICB2YWwgaldpZHRoID0gcUVuZCAtIHFTdGFydFxuXG4gICAgICAgICAgICAgICAgLy8gYWxsb2NhdGUgbmV3IGJsb2NrXG4gICAgICAgICAgICAgICAgdmFsIGJsb2NrID0gRG91YmxlQXJyYXkoaUhlaWdodCAqIGpXaWR0aClcbiAgICAgICAgICAgICAgICBibG9ja3NMaXN0LmFkZChibG9jaylcblxuICAgICAgICAgICAgICAgIC8vIGNvcHkgZGF0YVxuICAgICAgICAgICAgICAgIHZhciBpbmRleCA9IDBcbiAgICAgICAgICAgICAgICBmb3IgKHAgaW4gcFN0YXJ0IHVudGlsIHBFbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmF3RGF0YVtwXS5jb3B5SW50byhibG9jaywgaW5kZXgsIHFTdGFydCwgcUVuZClcbiAgICAgICAgICAgICAgICAgICAgLy9TeXN0ZW0uYXJyYXljb3B5KHJhd0RhdGFbcF0sIHFTdGFydCwgYmxvY2ssIGluZGV4LCBqV2lkdGgpXG4gICAgICAgICAgICAgICAgICAgIGluZGV4ICs9IGpXaWR0aFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICArK2Js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aGk6IERvdWJsZSxcbiAgICAgICAgZkxvOiBEb3VibGUsIGZIaTogRG91YmxlXG4gICAgKTogRG91YmxlIHtcbiAgICAgICAgdmFyIGEgPSBsb1xuICAgICAgICB2YXIgZmEgPSBmTG9cbiAgICAgICAgdmFyIGIgPSBoaVxuICAgICAgICB2YXIgZmIgPSBmSGlcbiAgICAgICAgdmFyIGMgPSBhXG4gICAgICAgIHZhciBmYyA9IGZhXG4gICAgICAgIHZhciBkID0gYiAtIGFcbiAgICAgICAgdmFyIGUgPSBkXG5cbiAgICAgICAgdmFsIHQgPSBhYnNvbHV0ZUFjY3VyYWN5XG4gICAgICAgIHZhbCBlcHMgPSByZWxhdGl2ZUFjY3VyYWN5XG5cbiAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgIGlmIChhYnMoZmMpIDwgYWJzKGZiKSkge1xuICAgICAgICAgICAgICAgIGEgPSBiXG4gICAgICAgICAgICAgICAgYiA9IGNcbiAgICAgICAgICAgICAgICBjID0gYVxuICAgICAgICAgICAgICAgIGZhID0gZmJcbiAgICAgICAgICAgICAgICBmYiA9IGZjXG4gICAgICAgICAgICAgICAgZmMgPSBmYVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgdG9sID0gMi4wICogZXBzICogYWJzKGIpICsgdFxuICAgICAgICAgICAgdmFsIG0gPSAwLjUgKiAoYyAtIGIpXG5cbiAgICAgICAgICAgIGlmIChhYnMobSkgPD0gdG9sIHx8IFByZWNpc2lvbi5lcXVhbHMoZmIsIDAuMCkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gYlxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGFicyhlKSA8IHRvbCB8fCBhYnMoZmEpIDw9IGFicyhmYikpIHtcbiAgICAgICAgICAgICAgICAvLyBGb3JjZSBiaXNlY3Rpb24uXG4gICAgICAgICAgICAgICAgZCA9IG1cbiAgICAgICAgICAgICAgICBlID0gZFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YXIgcyA9IGZiIC8gZmFcbiAgICAgICAgICAgICAgICB2YXIgcDogRG91YmxlXG4gICAgICAgICAgICAgICAgdmFyIHE6IERvdWJsZVxuICAgICAgICAgICAgICAgIC8vIFRoZSBlcXVhbGl0eSB0ZXN0IChhID09IGMpIGlzIGludGVudGlvbmFsLFxuICAgICAgICAgICAgICAgIC8vIGl0IGlzIHBhcnQgb2YgdGhlIG9yaWdpbmFsIEJyZW50J3MgbWV0aG9kIGFuZFxuICAgICAgICAgICAgICAgIC8vIGl0IHNob3VsZCBOT1QgYmUgcmVwbGFjZWQgYnkgcHJveGltaXR5IHRlc3QuXG4gICAgICAgICAgICAgICAgaWYgKGEgPT0gYykge1xuICAgICAgICAgICAgICAgICAgICAvLyBMaW5lYXIgaW50ZXJwb2xhdGlvbi5cbiAgICAgICAgICAgICAgICAgICAgcCA9IDIuMCAqIG0gKiBzXG4gICAgICAgICAgICAgICAgICAgIHEgPSAxIC0gc1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIEludmVyc2UgcXVhZHJhdGljIGludGVycG9sYXRpb24uXG4gICAgICAgICAgICAgICAgICAgIHEgPSBmYSAvIGZjXG4gICAgICAgICAgICAgICAgICAgIHZhbCByID0gZmIgLyBmY1xuICAgICAgICAgICAgICAgICAgICBwID0gcyAqICgyLjAgKiBtICogcSAqIChxIC0gcikgLSAoYiAtIGEpICogKHIgLSAxKSlcbiAgICAgICAgICAgICAgICAgICAgcSA9IChxIC0gMSkgKiAociAtIDEpICogKHMgLSAxKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAocCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcSA9IC1xXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcCA9IC1wXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHMgPSBlXG4gICAgICAgICAgICAgICAgZSA9IGRcbiAgICAgICAgICAgICAgICBpZiAocCA+PSAxLjUgKiBtICogcSAtIGFicyh0b2wgKiBxKSB8fCBwID49IGFicygwLjUgKiBzICogcSkpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gSW52ZXJzZSBxdWFkcmF0aWMgaW50ZXJwb2xhdGlvbiBnaXZlcyBhIHZhbHVlXG4gICAgICAgICAgICAgICAgICAgIC8vIGluIHRoZSB3cm9uZyBkaXJlY3Rpb24sIG9yIHByb2dyZXNzIGlzIHNsb3cuXG4gICAgICAgICAgICAgICAgICAgIC8vIEZhbGwgYmFjayB0byBiaXNlY3Rpb24uXG4gICAgICAgICAgICAgICAgICAgIGQgPSBtXG4gICAgICAgICAgICAgICAgICAgIGUgPSBkXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgZCA9IHAgLyBxXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYSA9IGJcbiAgICAgICAgICAgIGZhID0gZmJcblxuICAgICAgICAgICAgaWYgKGFicyhkKSA+IHRvbCkge1xuICAgICAgICAgICAgICAgIGIgKz0gZFxuICAgICAgICAgICAgfSBlbHNlIGlmIChtID4gMCkge1xuICAgICAgICAgICAgICAgIGIgKz0gdG9sXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGIgLT0gdG9sXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBmYiA9IGNvbXB1dGVPYmplY3RpdmVWYWx1ZShiKVxuICAgICAgICAgICAgaWYgKGZiID4gMCAmJiBmYyA+IDAgfHwgZmIgPD0gMCAmJiBmYyA8PSAwKSB7XG4gICAgICAgICAgICAgICAgYyA9IGFcbiAgICAgICAgICAgICAgICBmYyA9IGZhXG4gICAgICAgICAgICAgICAgZCA9IGIgLSBhXG4gICAgICAgICAgICAgICAgZSA9IGRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuIC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B0aHJvd3MgQ29udmVyZ2VuY2VFeGNlcHRpb24gaWYgdGhlIGFsZ29yaXRobSBmYWlscyB0byBjb252ZXJnZS5cbiAgICAgKi9cbiAgICBASnZtT3ZlcmxvYWRzXG4gICAgZnVuIGV2YWx1YXRlKHg6IERvdWJsZSwgZXBzaWxvbjogRG91YmxlID0gREVGQVVMVF9FUFNJTE9OLCBtYXhJdGVyYXRpb25zOiBJbnQgPSBJbnQuTUFYX1ZBTFVFKTogRG91YmxlIHtcbiAgICAgICAgdmFyIHAwID0gMS4wXG4gICAgICAgIHZhciBwMSA9IGdldEEoMCwgeClcbiAgICAgICAgdmFyIHEwID0gMC4wXG4gICAgICAgIHZhciBxMSA9IDEuMFxuICAgICAgICB2YXIgYyA9IHAxIC8gcTFcbiAgICAgICAgdmFyIG4gPSAwXG4gICAgICAgIHZhciByZWxhdGl2ZUVycm9yID0gRG91YmxlLk1BWF9WQUxVRVxuICAgICAgICB3aGlsZSAobiA8IG1heEl0ZXJhdGlvbnMgJiYgcmVsYXRpdmVFcnJvciA+IGVwc2lsb24pIHtcbiAgICAgICAgICAgICsrblxuICAgICAgICAgICAgdmFsIGEgPSBnZXRBKG4sIHgpXG4gICAgICAgICAgICB2YWwgYiA9IGdldEIobiwgeClcbiAgICAgICAgICAgIHZhciBwMiA9IGEgKiBwMSArIGIgKiBwMFxuICAgICAgICAgICAgdmFyIHEyID0gYSAqIHExICsgYiAqIHEwXG4gICAgICAgICAgICB2YXIgaW5maW5pdGUgPSBmYWxzZVxuICAgICAgICAgICAgaWYgKHAyLmlzSW5maW5pdGUoKSB8fCBxMi5pc0luZmluaXRlKCkpIHtcbiAgICAgICAgICAgICAgICAvKlxuICAgICAgICAgICAgICAgICAqIE5lZWQgdG8gc2NhbGUuIFRyeSBzdWNjZXNzaXZlIHBvd2VycyBvZiB0aGUgbGFyZ2VyIG9mIGEgb3IgYlxuICAgICAgICAgICAgICAgICAqIHVwIHRvIDV0aCBwb3dlci4gVGhyb3cgQ29udmVyZ2VuY2VFeGNlcHRpb24gaWYgb25lIG9yIGJvdGhcbiAgICAgICAgICAgICAgICAgKiBvZiBwMiwgcTIgc3RpbGwgb3ZlcmZsb3cuXG4gICAgICAgICAgICAgICAgICovXG4gICAgICAgICAgICAgICAgdmFyIHNjYWxlRmFjdG9yID0gMS4wXG4gICAgICAgICAgICAgICAgQFN1cHByZXNzKFwiVkFSSUFCTEVfV0lUSF9SRURVTkRBTlRfSU5JVElBTElaRVJcIilcbiAgICAgICAgICAgICAgICB2YXIgbGFzdFNjYWxlRmFjdG9yID0gMS4wXG4gICAgICAgICAgICAgICAgdmFsIG1heFBvd2VyID0gNVxuICAgICAgICAgICAgICAgIHZhbCBzY2FsZSA9IG1heChhLCBiKVxuICAgICAgICAgICAgICAgIGlmIChzY2FsZSA8PSAwKSB7ICAvLyBDYW4ndCBzY2FsZVxuICAgICAgICAgICAgICAgICAgICBlcnJvcihcIkNvbnZlcmdlbmNlRXhjZXB0aW9uXCIpXG4gICAgICAgICAgICAgICAgICAgIC8vTG9jYWxpemVkRm9ybWF0cy5DT05USU5VRURfRlJBQ1RJT05fSU5GSU5JVFlfRElWRVJHRU5DRSxcbiAgICAgICAgICAgICAgICAgICAgLy94XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGluZmluaXRlID0gdHJ1ZVxuICAgICAgICAgICAgICAgIGZvciAoaSBpbiAwIHVudGlsIG1heFBvd2VyKSB7XG4gICAgICAgICAgICAgICAgICAgIGxhc3RTY2FsZUZhY3RvciA9IHNjYWxlRmFjdG9yXG4gICAgICAgICAgICAgICAgICAgIHNjYWxlRmFjdG9yICo9IHNjYWxlXG4gICAgICAgICAgICAgICAgICAgIGlmIChhICE9IDAuMCAmJiBhID4gYikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcDIgPSBwMSAvIGxhc3RTY2FsZUZhY3RvciArIGIgLyBzY2FsZUZhY3RvciAqIHAwXG4gICAgICAgICAgICAgICAgICAgICAgICBxMiA9IHExIC8gbGFzdFNjYWxlRmFjdG9yICsgYiAvIHNjYWxlRmFjdG9yICogcTBcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChiICE9IDAuMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcDIgPSBhIC8gc2NhbGVGYWN0b3IgKiBwMSArIHAwIC8gbGFzdFNjYWxlRmFjdG9yXG4gICAgICAgICAgICAgICAgICAgICAgICBxMiA9IGEgLyBzY2FsZUZhY3RvciAqIHExICsgcTAgLyBsYXN0U2NhbGVGYWN0b3JcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpbmZpbml0ZSA9IHAyLmlzSW5maW5pdGUoKSB8fCBxMi5pc0luZmluaXRlKClcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFpbmZpbml0ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGluZmluaXRlKSB7XG4gICAgICAgICAgICAgICAgLy8gU2NhbGluZyBmYWlsZWRcbiAgICAgICAgICAgICAgICBlcnJvcihcIkNvbnZlcmdlbmNlRXhjZXB0aW9uXCIpXG4gICAgICAgICAgICAgICAgLy9Mb2NhbGl6ZWRGb3JtYXRzLkNPTlRJTlVFRF9GUkFDVElPTl9JTkZJTklUWV9ESVZFUkdFTkNFLFxuICAgICAgICAgICAgICAgIC8veFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgciA9IHAyIC8gcTJcblxuICAgICAgICAgICAgaWYgKHIuaXNOYU4oKSkge1xuICAgICAgICAgICAgICAgIGVycm9yKFwiQ29udmVyZ2VuY2VFeGNlcHRpb25cIilcbiAgICAgICAgICAgICAgICAvL0xvY2FsaXplZEZvcm1hdHMuQ09OVElOVUVEX0ZSQUNUSU9OX05BTl9ESVZFUkdFTkNFLFxuICAgICAgICAgICAgICAgIC8veFxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmVsYXRpdmVFcnJvciA9IGFicyhyIC8gYyAtIDEuMClcblxuICAgICAgICAgICAgLy8gcHJlcGFyZSBmb3IgbmV4dCBpdGVyYXRpb25cbiAgICAgICAgICAgIGMgPSBwMiAvIHEyXG4gICAgICAgICAgICBwMCA9IHAxXG4gICAgICAgICAgICBwMSA9IHAyXG4gICAgICAgICAgICBxMCA9IHExXG4gICAgICAgICAgICBxMSA9IHEyXG4gICAgICAgIH1cblxuICAgICAgICBpZiAobiA+PSBtYXhJdGVyYXRpb25zKSB7XG4gICAgICAgICAgICBlcnJvcihcIk1heENvdW50RXhjZWVkZWRcIilcbiAgICAgICAgICAgIC8vTG9jYWxpemVkRm9ybWF0cy5OT05fQ09OVkVSR0VOVF9DT05USU5VRURfRlJBQ1RJT04sXG4gICAgICAgICAgICAvL21heEl0ZXJhdGlvbnMsIHhcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBjXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIC8qKiBNYXhpbXVtIGFsbG93ZWQgbnVtZXJpY2FsIGVycm9yLiAgKi9cbiAgICAgICAgcHJpdmF0ZSB2YWwgREVGQVVMVF9FUFNJTE9OID0gMTBlLTlcbiAgICB9XG59XG4vKipcbiAqIEV2YWx1YXRlcyB0aGUgY29udGludWVkIGZyYWN0aW9uIGF0IHRoZSB2YWx1ZSB4LlxuICogQHBhcmFtIHggdGhlIGV2YWx1YXRpb24gcG9pbnQuXG4gKiBAcmV0dXJuIHRoZSB2YWx1ZSBvZiB0aGUgY29udGludWVkIGZyYWN0aW9uIGV2YWx1YXRlZCBhdCB4LlxuICogQHRocm93cyBDb252ZXJnZW5jZUV4Y2VwdGlvbiBpZiB0aGUgYWxnb3JpdGhtIGZhaWxzIHRvIGNvbnZlcmdlLlxuICovXG4vKipcbiAqIEV2YWx1YXRlcyB0aGUgY29udGludWVkIGZyYWN0aW9uIG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ICAgcmV0ID0gMC4wXG4gICAgICAgIH0gZWxzZSBpZiAoeCA+PSBhICsgMSkge1xuICAgICAgICAgICAgLy8gdXNlIHJlZ3VsYXJpemVkR2FtbWFRIGJlY2F1c2UgaXQgc2hvdWxkIGNvbnZlcmdlIGZhc3RlciBpbiB0aGlzXG4gICAgICAgICAgICAvLyBjYXNlLlxuICAgICAgICAgICAgcmV0ID0gMS4wIC0gcmVndWxhcml6ZWRHYW1tYVEoYSwgeCwgZXBzaWxvbiwgbWF4SXRlcmF0aW9ucylcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIC8vIGNhbGN1bGF0ZSBzZXJpZXNcbiAgICAgICAgICAgIHZhciBuID0gMC4wIC8vIGN1cnJlbnQgZWxlbWVudCBpbmRleFxuICAgICAgICAgICAgdmFyIGFuID0gMS4wIC8gYSAvLyBuLXRoIGVsZW1lbnQgaW4gdGhlIHNlcmllc1xuICAgICAgICAgICAgdmFyIHN1bSA9IGFuIC8vIHBhcnRpYWwgc3VtXG4gICAgICAgICAgICB3aGlsZSAoYWJzKGFuIC8gc3VtKSA+IGVwc2lsb24gJiZcbiAgICAgICAgICAgICAgICBuIDwgbWF4SXRlcmF0aW9ucyAmJlxuICAgICAgICAgICAgICAgIHN1bSA8IERvdWJsZS5QT1NJVElWRV9JTkZJTklUWVxuICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgLy8gY29tcHV0ZSBuZXh0IGVsZW1lbnQgaW4gdGhlIHNlcmllc1xuICAgICAgICAgICAgICAgIG4gPSBuICsgMS4wXG4gICAgICAgICAgICAgICAgYW4gPSBhbiAqICh4IC8gKGEgKyBuKSlcblxuICAgICAgICAgICAgICAgIC8vIHVwZGF0ZSBwYXJ0aWFsIHN1bVxuICAgICAgICAgICAgICAgIHN1bSA9IHN1bSArIGFuXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobiA+PSBtYXhJdGVyYXRpb25zKSB7XG4gICAgICAgICAgICAgICAgZXJyb3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jYXVzZSBpdCBzaG91bGQgY29udmVyZ2UgZmFzdGVyIGluIHRoaXNcbiAgICAgICAgICAgIC8vIGNhc2UuXG4gICAgICAgICAgICByZXQgPSAxLjAgLSByZWd1bGFyaXplZEdhbW1hUChhLCB4LCBlcHNpbG9uLCBtYXhJdGVyYXRpb25zKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgLy8gY3JlYXRlIGNvbnRpbnVlZCBmcmFjdGlvblxuICAgICAgICAgICAgdmFsIGNmID0gb2JqZWN0IDogQ29udGludWVkRnJhY3Rpb24oKSB7XG5cbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gZ2V0QShuOiBJbnQsIHg6IERvdWJsZSk6IERvdWJsZSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAyLjAgKiBuICsgMS4wIC0gYSArIHhcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gZ2V0QihuOiBJbnQsIHg6IERvdWJsZSk6IERvdWJsZSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBuICogKGEgLSBuKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0ID0gMS4wIC8gY2YuZXZhbHVhdGUoeCwgZXBzaWxvbiwgbWF4SXRlcmF0aW9ucylcbiAgICAgICAgICAgIHJldCA9IGV4cCgteCArIGEgKiBsbih4KSAtIGxvZ0dhbW1hKGEpKSAqIHJldFxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHJldFxuICAgIH1cblxuXG4gICAgLyoqXG4gICAgICpcbiAgICAgKiBDb21wdXRlcyB0aGUgZGlnYW1tYSBmdW5jdGlvbiBvZiB4LlxuICAgICAqXG4gICAgICpcbiAgICAgKiBUaGlzIGlzIGFuIGluZGVwZW5kZW50bHkgd3JpdHRlbiBpbXBsZW1lbnRhdGlvbiBvZiB0aGUgYWxnb3JpdGhtIGRlc2NyaWJlZCBpbl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bmN0aW9uIG9mIHguXG4gICAgICogVGhpcyBmdW5jdGlvbiBpcyBkZXJpdmVkIGJ5IHRha2luZyB0aGUgZGVyaXZhdGl2ZSBvZiB0aGUgaW1wbGVtZW50YXRpb25cbiAgICAgKiBvZiBkaWdhbW1hLlxuICAgICAqXG4gICAgICogQHBhcmFtIHggQXJndW1lbnQuXG4gICAgICogQHJldHVybiB0cmlnYW1tYSh4KSB0byB3aXRoaW4gMTAtOCByZWxhdGl2ZSBvciBhYnNvbHV0ZSBlcnJvciB3aGljaGV2ZXIgaXMgc21hbGxlclxuICAgICAqIEBzZWUgW1RyaWdhbW1hXShodHRwczovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9UcmlnYW1tYV9mdW5jdGlvbilcbiAgICAgKlxuICAgICAqIEBzZWUgR2FtbWEuZGlnYW1tYVxuICAgICAqIEBzaW5jZSAyLjBcbiAgICAgKi9cbiAgICBmdW4gdHJpZ2FtbWEoeDogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgaWYgKHggPiAwICYmIHggPD0gU19MSU1JVCkge1xuICAgICAgICAgICAgcmV0dXJuIDEgLyAoeCAqIHgpXG4gICAgICAgIH1cblxuICAgICAgICBpZiAoeCA+PSBDX0xJTUlUKSB7XG4gICAgICAgICAgICB2YWwgaW52ID0gMSAvICh4ICogeClcbiAgICAgICAgICAgIC8vICAxICAgIDEgICAgICAxICAgICAgIDEgICAgICAgMVxuICAgICAgICAgICAgLy8gIC0gKyAtLS0tICsgLS0tLSAtIC0tLS0tICsgLS0tLS1cbiAgICAgICAgICAgIC8vICB4ICAgICAgMiAgICAgIDMgICAgICAgNSAgICAgICA3XG4gICAgICAgICAgICAvLyAgICAgIDIgeCAgICA2IHggICAgMzAgeCAgICA0MiB4XG4gICAgICAgICAgICByZXR1cm4gMSAvIHggKyBpbnYgLyAyICsgaW52IC8geCAqICgxLjAgLyA2IC0gaW52ICogKDEuMCAvIDMwICsgaW52IC8gNDIpKVxuICAgICAgICB9XG5cbiAg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GxhcmdlciB0aGFuIDIvbikuXG4gICAgICogQHNpbmNlIDIuMVxuICAgICAqL1xuICAgIHByaXZhdGUgZnVuIHNtb290aCh4dmFsOiBEb3VibGVBcnJheSwgeXZhbDogRG91YmxlQXJyYXksIHdlaWdodHM6IERvdWJsZUFycmF5KTogRG91YmxlQXJyYXkge1xuICAgICAgICBpZiAoeHZhbC5zaXplICE9IHl2YWwuc2l6ZSkge1xuICAgICAgICAgICAgZXJyb3IoXCJEaW1lbnNpb24gbWlzbWF0Y2ggb2YgaW50ZXJwb2xhdGlvbiBwb2ludHM6ICR7eHZhbC5zaXplfSAhPSAke3l2YWwuc2l6ZX1cIilcbiAgICAgICAgfVxuICAgICAgICB2YWwgbiA9IHh2YWwuc2l6ZVxuICAgICAgICBpZiAobiA9PSAwKSB7XG4gICAgICAgICAgICBlcnJvcihcIk5vIGRhdGEgdG8gaW50ZXJwb2xhdGVcIilcbiAgICAgICAgfVxuICAgICAgICBjaGVja0FsbEZpbml0ZVJlYWwoeHZhbClcbiAgICAgICAgY2hlY2tBbGxGaW5pdGVSZWFsKHl2YWwpXG4gICAgICAgIGNoZWNrQWxsRmluaXRlUmVhbCh3ZWlnaHRzKVxuICAgICAgICBNYXRoQXJyYXlzLmNoZWNrT3JkZXIoeHZhbClcbiAgICAgICAgaWYgKG4gPT0gMSkge1xuICAgICAgICAgICAgcmV0dXJuIGRvdWJsZUFycmF5T2YoeXZhbFswXSlcbiAgICAgICAgfVxuICAgICAgICBpZiAobiA9PSAyKSB7XG4gICAgICAgICAgICByZXR1cm4gZG91YmxlQXJyYXlPZih5dmFsWzBdLCB5dmFsWzFdKVxuICAgICAgICB9XG4gICAgICAgIHZhbCBiYW5kd2lkdGhJblBvaW50cyA9IChiYW5kd2lkdGggKiBuKS50b0ludCgpXG4gICAgICAgIGlmIChiYW5kd2lkdGhJblBvaW50cyA8IDIpIHtcbiAgICAgICAgICAgIGVycm9yKFwiTE9FU1MgJ2JhbmR3aWR0aEluUG9pbnRzJy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uXG4gICAgICAgICAgICAgICAgaWYgKGkgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUJhbmR3aWR0aEludGVydmFsKFxuICAgICAgICAgICAgICAgICAgICAgICAgeHZhbCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHdlaWdodHMsXG4gICAgICAgICAgICAgICAgICAgICAgICBpLFxuICAgICAgICAgICAgICAgICAgICAgICAgYmFuZHdpZHRoSW50ZXJ2YWxcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB2YWwgaWxlZnQgPSBiYW5kd2lkdGhJbnRlcnZhbFswXVxuICAgICAgICAgICAgICAgIHZhbCBpcmlnaHQgPSBiYW5kd2lkdGhJbnRlcnZhbFsxXVxuICAgICAgICAgICAgICAgIC8vIENvbXB1dGUgdGhlIHBvaW50IG9mIHRoZSBiYW5kd2lkdGggaW50ZXJ2YWwgdGhhdCBpc1xuICAgICAgICAgICAgICAgIC8vIGZhcnRoZXN0IGZyb20geFxuICAgICAgICAgICAgICAgIHZhbCBlZGdlOiBJbnRcbiAgICAgICAgICAgICAgICBlZGdlID0gaWYgKHh2YWxbaV0gLSB4dmFsW2lsZWZ0XSA+IHh2YWxbaXJpZ2h0XSAtIHh2YWxbaV0pIHtcbiAgICAgICAgICAgICAgICAgICAgaWxlZnRcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpcmlnaHRcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gQ29tcHV0ZSBhIGxlYXN0LXNxdWFyZXMgbGluZWFyIGZpdCB3ZWlnaHRlZCBieVxuICAgICAgICAgICAgICAgIC8vIHRoZSBwcm9kdWN0IG9mIHJvYnVzdG5lc3Mgd2VpZ2h0cyBhbmQgdGhlIHRyaWN1YmVcbiAgICAgICAgICAgICAgICAvLyB3ZWlnaHQgZnVuY3Rpb24uXG4gICAgICAgICAgICAgICAgLy8gU2VlIGh0dHA6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvTGluZWFyX3JlZ3Jlc3Npb25cbiAgICAgICAgICAgICAgICAvLyAoc2VjdGlvbiBcIlVuaXZhcmlhdGUgbGluZWFyIGNhc2VcIilcbiAgICAgICAgICAgICAgICAvLyBhbmQgaHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9XZWlnaHRlZF9sZWFzdF9zcXVhcmVzXG4gICAgICAgICAgICAgICAgLy8gKHNlY3Rpb24gXCJXZWlnaHRlZCBsZWFzdCBzcXVhcmVzXCIpXG4gICAgICAgICAgICAgICAgdmFyIHN1bVdlaWdodHMgPSAwLjBcbiAgICAgICAgICAgICAgICB2YXIgc3VtWCA9IDAuMFxuICAgICAgICAgICAgICAgIHZhciBzdW1YU3F1YXJlZCA9IDAuMFxuICAgICAgICAgICAgICAgIHZhciBzdW1ZID0gMC4wXG4gICAgICAgICAgICAgICAgdmFyIHN1bVhZID0gMC4wXG4gICAgICAgICAgICAgICAgdmFsIGRlbm9tOiBEb3VibGUgPSBhYnMoMS4wIC8gKHh2YWxbZWRnZV0gLSB4KSlcbiAgICAgICAgICAgICAgICBmb3IgKGsgaW4gaWxlZnQuLmlyaWdodCkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgeGsgPSB4dmFsW2tdXG4gICAgICAgICAgICAgICAgICAgIHZhbCB5ayA9IHl2YWxba11cbiAgICAgICAgICAgICAgICAgICAgdmFsIGRpc3QgPSBpZiAoayA8IGkpIHggLSB4ayBlbHNlIHhrIC0geFxuICAgICAgICAgICAgICAgICAgICB2YWwgdzogRG91YmxlID0gdHJpY3ViZShkaXN0ICogZGVub20pICogcm9idXN0bmVzc1dlaWdodHNba10gKiB3ZWlnaHRzW2tdXG4gICAgICAgICAgICAgICAgICAgIHZhbCB4a3cgPSB4ayAqIHdcbiAgICAgICAgICAgICAgICAgICAgc3VtV2VpZ2h0cyArPSB3XG4gICAgICAgICAgICAgICAgICAgIHN1bVggKz0geGt3XG4gICAgICAgICAgICAgICAgICAgIHN1bVhTcXVhcmVkICs9IHhrICogeGt3XG4gICAgICAgICAgICAgICAgICAgIHN1bVkgKz0geWsgKiB3XG4gICAgICAgICAgICAgICAgICAgIHN1bVhZICs9IHlrICogeGt3XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHZhbCBtZWFuWCA9IHN1bVggLyBzdW1XZWlnaHRzXG4gICAgICAgICAgICAgICAgdmFsIG1lYW5ZID0gc3VtWSAvIHN1bVdlaWdodHNcbiAgICAgICAgICAgICAgICB2YWwgbWVhblhZID0gc3VtWFkgLyBzdW1XZWlnaHRzXG4gICAgICAgICAgICAgICAgdmFsIG1lYW5YU3F1YXJlZCA9IHN1bVhTcXVhcmVkIC8gc3VtV2VpZ2h0c1xuICAgICAgICAgICAgICAgIHZhbCBiZXRhOiBEb3VibGVcbiAgICAgICAgICAgICAgICBiZXRhID0gaWYgKHNxcnQoYWJzKG1lYW5YU3F1YXJlZCAtIG1lYW5YICogbWVhblgpKSA8IGFjY3VyYWN5KSB7XG4gICAgICAgICAgICAgICAgICAgIDAuMFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIChtZWFuWFkgLSBtZWFuWCAqIG1lYW5ZKSAvIChtZWFuWFNxdWFyZWQgLSBtZWFuWCAqIG1lYW5YKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB2YWwgYWxwaGEgPSBtZWFuWSAtIGJldGEgKiBtZWFuWFxuICAgICAgICAgICAgICAgIHJlc1tpXSA9IGJldGEgKiB4ICsgYWxwaGFcbiAgICAgICAgICAgICAgICByZXNpZHVhbHNbaV0gPSBhYnMoeXZhbFtpXSAtIHJlc1tpXSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIE5vIG5lZWQgdG8gcmVjb21wdXRlIHRoZSByb2J1c3RuZXNzIHdlaWdodHMgYXQgdGhlIGxhc3RcbiAgICAgICAgICA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gKi9cbiAgICBwcml2YXRlIGZ1biB1cGRhdGVCYW5kd2lkdGhJbnRlcnZhbChcbiAgICAgICAgeHZhbDogRG91YmxlQXJyYXksIHdlaWdodHM6IERvdWJsZUFycmF5LFxuICAgICAgICBpOiBJbnQsXG4gICAgICAgIGJhbmR3aWR0aEludGVydmFsOiBJbnRBcnJheVxuICAgICkge1xuICAgICAgICB2YWwgbGVmdCA9IGJhbmR3aWR0aEludGVydmFsWzBdXG4gICAgICAgIHZhbCByaWdodCA9IGJhbmR3aWR0aEludGVydmFsWzFdXG4gICAgICAgIC8vIFRoZSByaWdodCBlZGdlIHNob3VsZCBiZSBhZGp1c3RlZCBpZiB0aGUgbmV4dCBwb2ludCB0byB0aGUgcmlnaHRcbiAgICAgICAgLy8gaXMgY2xvc2VyIHRvIHh2YWxbaV0gdGhhbiB0aGUgbGVmdG1vc3QgcG9pbnQgb2YgdGhlIGN1cnJlbnQgaW50ZXJ2YWxcbiAgICAgICAgdmFsIG5leHRSaWdodDogSW50ID0gbmV4dE5vbnplcm8od2VpZ2h0cywgcmlnaHQpXG4gICAgICAgIGlmIChuZXh0UmlnaHQgPCB4dmFsLnNpemUgJiYgeHZhbFtuZXh0UmlnaHRdIC0geHZhbFtpXSA8IHh2YWxbaV0gLSB4dmFsW2xlZnRdKSB7XG4gICAgICAgICAgICB2YWwgbmV4dExlZnQ6IEludCA9IG5leHROb256ZXJvKFxuICAgICAgICAgICAgICAgIHdlaWdodHMsIGJhbmR3aWR0aEludGVydmFsWzBdXG4gICAgICAgICAgICApXG4gICAgICAgICAgICBiYW5kd2lkdGhJbnRlcnZhbFswXSA9IG5leHRMZWZ0XG4gICAgICAgICAgICBiYW5kd2lkdGhJbnRlcnZhbFsxXSA9IG5leHRSaWdodFxuICAgICAgICB9XG4gICAgfVxuXG5cbiAgICAvKipcbiAgICAgKiBDb21wdXRlIHRoZVxuICAgICAqIFt0cmljdWJlXShodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL0xvY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XJpbmcgZGlyZWN0aW9uLlxuICAgICAqIEBwYXJhbSBzdHJpY3QgV2hldGhlciB0aGUgb3JkZXIgc2hvdWxkIGJlIHN0cmljdC5cbiAgICAgKiBAcGFyYW0gYWJvcnQgV2hldGhlciB0byB0aHJvdyBhbiBleGNlcHRpb24gaWYgdGhlIGNoZWNrIGZhaWxzLlxuICAgICAqIEByZXR1cm4gYHRydWVgIGlmIHRoZSBhcnJheSBpcyBzb3J0ZWQuXG4gICAgICogQHRocm93cyBOb25Nb25vdG9uaWNTZXF1ZW5jZUV4Y2VwdGlvbiBpZiB0aGUgYXJyYXkgaXMgbm90IHNvcnRlZFxuICAgICAqIGFuZCBgYWJvcnRgIGlzIGB0cnVlYC5cbiAgICAgKi9cbiAgICBmdW4gY2hlY2tPcmRlcihcbiAgICAgICAgYHZhbGA6IERvdWJsZUFycmF5LCBkaXI6IE9yZGVyRGlyZWN0aW9uPyxcbiAgICAgICAgc3RyaWN0OiBCb29sZWFuLCBhYm9ydDogQm9vbGVhblxuICAgICk6IEJvb2xlYW4ge1xuICAgICAgICB2YXIgcHJldmlvdXMgPSBgdmFsYFswXVxuICAgICAgICB2YWwgbWF4ID0gYHZhbGAuc2l6ZVxuICAgICAgICB2YXIgaW5kZXg6IEludFxuICAgICAgICBpbmRleCA9IDFcbiAgICAgICAgSVRFTUAgd2hpbGUgKGluZGV4IDwgbWF4KSB7XG4gICAgICAgICAgICB3aGVuIChkaXIpIHtcbiAgICAgICAgICAgICAgICBPcmRlckRpcmVjdGlvbi5JTkNSRUFTSU5HIC0+IGlmIChzdHJpY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGB2YWxgW2luZGV4XSA8PSBwcmV2aW91cykge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtASVRFTVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGB2YWxgW2luZGV4XSA8IHByZXZpb3VzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha0BJVEVNXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgT3JkZXJEaXJlY3Rpb24uREVDUkVBU0lORyAtPiBpZiAoc3RyaWN0KSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChgdmFsYFtpbmRleF0gPj0gcHJldmlvdXMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrQElURU1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChgdmFsYFtpbmRleF0gPiBwcmV2aW91cykge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtASVRFTVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgLT4gZXJyb3IoXCJcIilcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHByZXZpb3VzID0gYHZhbGBbaW5kZXhdXG4gICAgICAgICAgICBpbmRleCsrXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGluZGV4ID09IG1heCkgeyAvLyBMb29wIGNvbXBsZXRlZC5cbiAgICAgICAgICAgIHJldHVybiB0cnVlXG4gICAgICAgIH1cbiAgICAgICAgLy8gTG9vcCBlYXJseSBleGl0IG1lYW5zIHdyb25nIG9yZGVyaW5nLlxuICAgICAgICByZXR1cm4gaWYgKGFib3J0KSB7XG4gICAgICAgICAgICBlcnJvcihcIk5vbiBtb25vdG9uaWMgc2VxdWVuY2VcIilcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGZhbHNlXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDaGVjayB0aGF0IHRoZSBnaXZlbiBhcnJheSBpcyBzb3J0ZWQuXG4gICAgICpcbiAgICAgKiBAcGFyYW0gdmFsIF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oaSA8IGogJiYgd29ya1tqXSA+PSB2YWx1ZSkge1xuICAgICAgICAgICAgICAgIC0talxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgd2hpbGUgKGkgPCBqICYmIHdvcmtbaV0gPD0gdmFsdWUpIHtcbiAgICAgICAgICAgICAgICArK2lcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChpIDwgaikge1xuICAgICAgICAgICAgICAgIHZhbCB0bXAgPSB3b3JrW2ldXG4gICAgICAgICAgICAgICAgd29ya1tpKytdID0gd29ya1tqXVxuICAgICAgICAgICAgICAgIHdvcmtbai0tXSA9IHRtcFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChpID49IGVuZCB8fCB3b3JrW2ldID4gdmFsdWUpIHtcbiAgICAgICAgICAgIC0taVxuICAgICAgICB9XG4gICAgICAgIHdvcmtbYmVnaW5dID0gd29ya1tpXVxuICAgICAgICB3b3JrW2ldID0gdmFsdWVcbiAgICAgICAgcmV0dXJuIGlcbiAgICB9XG5cbiAgICAvKiogU2VsZWN0IGEgcGl2b3QgaW5kZXggYXMgdGhlIG1lZGlhbiBvZiB0aHJlZVxuICAgICAqIEBwYXJhbSB3b3JrIGRhdGEgYXJyYXlcbiAgICAgKiBAcGFyYW0gYmVnaW4gaW5kZXggb2YgdGhlIGZpcnN0IGVsZW1lbnQgb2YgdGhlIHNsaWNlXG4gICAgICogQHBhcmFtIGVuZCBpbmRleCBhZnRlciB0aGUgbGFzdCBlbGVtZW50IG9mIHRoZSBzbGljZVxuICAgICAqIEByZXR1cm4gdGhlIGluZGV4IG9mIHRoZSBtZWRpYW4gZWxlbWVudCBjaG9zZW4gYmV0d2VlbiB0aGVcbiAgICAgKiBmaXJzdCwgdGhlIG1pZGRsZSBhbmQgdGhlIGxhc3QgZWxlbWVudCBvZiB0aGUgYXJyYXkgc2xpY2VcbiAgICAgKi9cbiAgICBwcml2YXRlIGZ1biBtZWRpYW5PZjMod29yazogRG91YmxlQXJyYXksIGJlZ2luOiBJbnQsIGVuZDogSW50KTogSW50IHtcbiAgICAgICAgdmFsIGluY2x1c2l2ZUVuZCA9IGVuZCAtIDFcbiAgICAgICAgdmFsIG1pZGRsZSA9IGJlZ2luICsgKGluY2x1c2l2ZUVuZCAtIGJlZ2luKSAvIDJcbiAgICAgICAgdmFsIHdCZWdpbiA9IHdvcmtbYmVnaW5dXG4gICAgICAgIHZhbCB3TWlkZGxlID0gd29ya1ttaWRkbGVdXG4gICAgICAgIHZhbCB3RW5kID0gd29ya1tpbmNsdXNpdmVFbmRdXG4gICAgICAgIHJldHVybiBpZiAod0JlZ2luIDwgd01pZGRsZSkge1xuICAgICAgICAgICAgaWYgKHdNaWRkbGUgPCB3RW5kKSB7XG4gICAgICAgICAgICAgICAgbWlkZGxlXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmICh3QmVnaW4gPCB3RW5kKSBpbmNsdXNpdmVFbmQgZWxzZSBiZWdpblxuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgaWYgKHdCZWdpbiA8IHdFbmQpIHtcbiAgICAgICAgICAgICAgICBiZWdpblxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAod01pZGRsZSA8IHdFbmQpIGluY2x1c2l2ZUVuZCBlbHNlIG1pZGRsZVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogU29ydCBpbiBwbGFjZSBhIChzbWFsbCkgYXJyYXkgc2xpY2UgdXNpbmcgaW5zZXJ0aW9uIHNvcnRcbiAgICAgKiBAcGFyYW0gd29yayBhcnJheSB0byBzb3J0XG4gICAgICogQHBhcmFtIGJlZ2luIGluZGV4IG9mIHRoZSBmaXJzdCBlbGVtZW50IG9mIHRoZSBzbGljZSB0byBzb3J0XG4gICAgICogQHBhcmFtIGVuZCBpbmRleCBhZnRlciB0aGUgbGFzdCBlbGVtZ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aWYgYGNvZWZmaWNpZW50c2AgaXMgZW1wdHkuXG4gICAgICogQHRocm93cyBOdWxsQXJndW1lbnRFeGNlcHRpb24gaWYgYGNvZWZmaWNpZW50c2AgaXMgYG51bGxgLlxuICAgICAqL1xuICAgIHByaXZhdGUgZnVuIGV2YWx1YXRlKGNvZWZmaWNpZW50czogRG91YmxlQXJyYXk/LCBhcmd1bWVudDogRG91YmxlKTogRG91YmxlIHtcblxuICAgICAgICBpZiAoY29lZmZpY2llbnRzID09IG51bGwpXG4gICAgICAgICAgICBlcnJvcihcIk51bGwgYXJndW1lbnQ6IGNvZWZmaWNpZW50cyBvZiB0aGUgcG9seW5vbWlhbCB0byBldmFsdWF0ZVwiKVxuXG4gICAgICAgIHZhbCBuID0gY29lZmZpY2llbnRzLnNpemVcbiAgICAgICAgaWYgKG4gPT0gMCkge1xuICAgICAgICAgICAgZXJyb3IoXCJFbXB0eSBwb2x5bm9taWFscyBjb2VmZmljaWVudHMgYXJyYXlcIilcbiAgICAgICAgfVxuICAgICAgICB2YXIgcmVzdWx0ID0gY29lZmZpY2llbnRzW24gLSAxXVxuICAgICAgICBmb3IgKGogaW4gbiAtIDIgZG93blRvIDApIHtcbiAgICAgICAgICAgIHJlc3VsdCA9IGFyZ3VtZW50ICogcmVzdWx0ICsgY29lZmZpY2llbnRzW2pdXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgIH1cblxuICAgIG9wZXJhdG9yIGZ1biB1bmFyeVBsdXMoKSA9IFBvbHlub21pYWxGdW5jdGlvbihjb2VmZmljaWVudHMpXG5cbiAgICBvcGVyYXRvciBmdW4gdW5hcnlNaW51cygpOiBQb2x5bm9taWFsRnVuY3Rpb24ge1xuICAgICAgICB2YWwgZGQgPSBEb3VibGVBcnJheShjb2VmZmljaWVudHMuc2l6ZSlcblxuICAgICAgICBmb3IgKChpLCBjKSBpbiBjb2VmZmljaWVudHMud2l0aEluZGV4KCkpIHtcbiAgICAgICAgICAgIGRk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gZnVuIG11bHRpcGx5KGE6IERvdWJsZSk6IFBvbHlub21pYWxGdW5jdGlvbiB7XG4gICAgICAgIHZhbCBkZCA9IERvdWJsZUFycmF5KGNvZWZmaWNpZW50cy5zaXplKVxuXG4gICAgICAgIGZvciAoKGksIGMpIGluIGNvZWZmaWNpZW50cy53aXRoSW5kZXgoKSkge1xuICAgICAgICAgICAgZGRbaV0gPSBhICogY1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIFBvbHlub21pYWxGdW5jdGlvbihkZClcbiAgICB9XG5cbiAgICBvcGVyYXRvciBmdW4gdGltZXMob3RoZXI6IFBvbHlub21pYWxGdW5jdGlvbik6IFBvbHlub21pYWxGdW5jdGlvbiB7XG4gICAgICAgIHZhbCBuZCA9IGNvZWZmaWNpZW50cy5zaXplICsgb3RoZXIuY29lZmZpY2llbnRzLnNpemUgLSAxXG4gICAgICAgIHZhbCBuYyA9IERvdWJsZUFycmF5KG5kKVxuXG4gICAgICAgIGZvciAoaSBpbiAoMCB1bnRpbCBuZCkpIHtcbiAgICAgICAgICAgIGZvciAoaiBpbiAoMC4uaSkpIHtcbiAgICAgICAgICAgICAgICB2YWwgYSA9IGlmIChqIDwgY29lZmZpY2llbnRzLnNpemUpIGNvZWZmaWNpZW50c1tqXSBlbHNlIDAuMFxuICAgICAgICAgICAgICAgIHZhbCBrID0gaSAtIGpcbiAgICAgICAgICAgICAgICB2YWwgYiA9IGlmIChrIDwgb3RoZXIuY29lZmZpY2llbnRzLnNpemUpIG90aGVyLmNvZWZmaWNpZW50c1trXSBlbHNlIDAuMFxuICAgICAgICAgICAgICAgIG5jW2ldICs9IGEgKiBiXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gUG9seW5vbWlhbEZ1bmN0aW9uKG5jKVxuICAgIH1cblxuICAgIGZ1biBkZWdyZWUoKTogSW50ID0gbWF4KDAsIGNvZWZmaWNpZW50cy5pbmRleE9mTGFzdCB7IGl0ICE9IDAuMCB9KVxuXG4gICAgb3BlcmF0b3IgZnVuIGNvbXBhcmVUbyhvdGhlcjogUG9seW5vbWlhbEZ1bmN0aW9uKTogSW50IHtcbiAgICAgICAgdmFsIGQxID0gZGVncmVlKClcbiAgICAgICAgdmFsIGQyID0gb3RoZXIuZGVncmVlKClcbiAgICAgICAgdmFsIG4gPSBtaW4oZDEsIGQyKSArIDFcblxuICAgICAgICBmb3IgKGkgaW4gMCB1bnRpbCBuKSB7XG4gICAgICAgICAgICB2YWwgYSA9IGNvZWZmaWNpZW50c1tpXVxuICAgICAgICAgICAgdmFsIGIgPSBvdGhlci5jb2VmZmljaWVudHNbaV1cblxuICAgICAgICAgICAgdmFsIHJlcyA9IGEuY29tcGFyZVRvKGIpXG5cbiAgICAgICAgICAgIGlmIChyZXMgIT0gMClcbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gZDEuY29tcGFyZVRvKGQyKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIG9wZXJhdG9yIGZ1biBlcXVhbHMob3RoZXI6IEFueT8pOiBCb29sZWFuIHtcbiAgICAgICAgaWYgKG90aGVyID09IG51bGwgfHwgb3RoZXIgIWlzIFBvbHlub21pYWxGdW5jdGlvbilcbiAgICAgICAgICAgIHJldHVybiBmYWxzZVxuXG4gICAgICAgIHJldHVybiBjb21wYXJlVG8ob3RoZXIpID09IDBcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gaGFzaENvZGUoKTogSW50IHtcbiAgICAgICAgcmV0dXJuIGNvZWZmaWNpZW50cy5oYXNoQ29kZSgpXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIHRvU3RyaW5nKCk6IFN0cmluZyB7XG4gICAgICAgIHZhbCBzYiA9IFN0cmluZ0J1aWxkZXIoKVxuXG4gICAgICAgIGZvciAoaSBpbiBjb2VmZmljaWVudHMubGFzdEluZGV4IGRvd25UbyAwKSB7XG5cbiAgICAgICAgICAgIG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fVxuICAgICAgICB2YWwgbXUgPSBEb3VibGVBcnJheShuKVxuICAgICAgICB2YWwgeiA9IERvdWJsZUFycmF5KG4gKyAxKVxuICAgICAgICBtdVswXSA9IDAuMFxuICAgICAgICB6WzBdID0gMC4wXG5cbiAgICAgICAgZm9yIChpIGluIDEgdW50aWwgbikge1xuICAgICAgICAgICAgdmFyIGcgPSAyLjAgKiAoeFtpICsgMV0gLSB4W2kgLSAxXSkgLSBoW2kgLSAxXSAqIG11W2kgLSAxXVxuICAgICAgICAgICAgbXVbaV0gPSBoW2ldIC8gZ1xuICAgICAgICAgICAgeltpXSA9XG4gICAgICAgICAgICAgICAgKDMuMCAqICh5W2kgKyAxXSAqIGhbaSAtIDFdIC0geVtpXSAqICh4W2kgKyAxXSAtIHhbaSAtIDFdKSArIHlbaSAtIDFdICogaFtpXSkgL1xuICAgICAgICAgICAgICAgICAgICAgICAgKGhbaSAtIDFdICogaFtpXSkgLSBoW2kgLSAxXSAqIHpbaSAtIDFdKSAvIGdcbiAgICAgICAgfVxuICAgICAgICAvLyBjdWJpYyBzcGxpbmUgY29lZmZpY2llbnRzIC0tICBiIGlzIGxpbmVhciwgYyBxdWFkcmF0aWMsIGQgaXMgY3ViaWMgKG9yaWdpbmFsIHkncyBhcmUgY29uc3RhbnRzKVxuICAgICAgICB2YWwgYiA9IERvdWJsZUFycmF5KG4pXG4gICAgICAgIHZhbCBjID0gRG91YmxlQXJyYXkobiArIDEpXG4gICAgICAgIHZhbCBkID0gRG91YmxlQXJyYXkobilcbiAgICAgICAgeltuXSA9IDAuMFxuICAgICAgICBjW25dID0gMC4wXG4gICAgICAgIGZvciAoaiBpbiBuIC0gMSBkb3duVG8gMCkge1xuICAgICAgICAgICAgY1tqXSA9IHpbal0gLSBtdVtqXSAqIGNbaiArIDFdXG4gICAgICAgICAgICBiW2pdID0gKHlbaiArIDFdIC0geVtqXSkgLyBoW2pdIC0gaFtqXSAqIChjW2ogKyAxXSArIDIuMCAqIGNbal0pIC8gMy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ZkxvID0gZi52YWx1ZSh4TG8pXG4gICAgICAgIHZhciB4SGkgPSBtaW4obWF4LCBiYXNlUm9vdCArIHN0ZXApXG4gICAgICAgIHZhciBmSGkgPSBmLnZhbHVlKHhIaSlcbiAgICAgICAgdmFyIHJlbWFpbmluZ0V2YWwgPSBtYXhFdmFsIC0gMlxuICAgICAgICB3aGlsZSAocmVtYWluaW5nRXZhbCA+IDApIHtcblxuICAgICAgICAgICAgaWYgKGZMbyA+PSAwICYmIGZIaSA8PSAwIHx8IGZMbyA8PSAwICYmIGZIaSA+PSAwKSB7XG4gICAgICAgICAgICAgICAgLy8gY29tcHV0ZSB0aGUgcm9vdCBvbiB0aGUgc2VsZWN0ZWQgc2lkZVxuICAgICAgICAgICAgICAgIHJldHVybiBicmFja2V0aW5nLnNvbHZlKHJlbWFpbmluZ0V2YWwsIGYsIHhMbywgeEhpLCBiYXNlUm9vdCwgYWxsb3dlZFNvbHV0aW9uKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyB0cnkgaW5jcmVhc2luZyB0aGUgaW50ZXJ2YWxcbiAgICAgICAgICAgIHZhciBjaGFuZ2VMbyA9IGZhbHNlXG4gICAgICAgICAgICB2YXIgY2hhbmdlSGkgPSBmYWxzZVxuICAgICAgICAgICAgaWYgKGZMbyA8IGZIaSkge1xuICAgICAgICAgICAgICAgIC8vIGluY3JlYXNpbmcgZnVuY3Rpb25cbiAgICAgICAgICAgICAgICBpZiAoZkxvID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgY2hhbmdlTG8gPSB0cnVlXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY2hhbmdlSGkgPSB0cnVlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChmTG8gPiBmSGkpIHtcbiAgICAgICAgICAgICAgICAvLyBkZWNyZWFzaW5nIGZ1bmN0aW9uXG4gICAgICAgICAgICAgICAgaWYgKGZMbyA8PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIGNoYW5nZUxvID0gdHJ1ZVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGNoYW5nZUhpID0gdHJ1ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gdW5rbm93biB2YXJpYXRpb25cbiAgICAgICAgICAgICAgICBjaGFuZ2VMbyA9IHRydWVcbiAgICAgICAgICAgICAgICBjaGFuZ2VIaSA9IHRydWVcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gdXBkYXRlIHRoZSBsb3dlciBib3VuZFxuICAgICAgICAgICAgaWYgKGNoYW5nZUxvKSB7XG4gICAgICAgICAgICAgICAgeExvID0gbWF4KG1pbiwgeExvIC0gc3RlcClcbiAgICAgICAgICAgICAgICBmTG8gPSBmLnZhbHVlKHhMbylcbiAgICAgICAgICAgICAgICByZW1haW5pbmdFdmFsLS1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gdXBkYXRlIHRoZSBoaWdoZXIgYm91bmRcbiAgICAgICAgICAgIGlmIChjaGFuZ2VIaSkge1xuICAgICAgICAgICAgICAgIHhIaSA9IG1pbihtYXgsIHhIaSArIHN0ZXApXG4gICAgICAgICAgICAgICAgZkhpID0gZi52YWx1ZSh4SGkpXG4gICAgICAgICAgICAgICAgcmVtYWluaW5nRXZhbC0tXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgfVxuXG4gICAgICAgIGVycm9yKFwiTm9CcmFja2V0aW5nXCIpXG4gICAgICAgIC8vRXhjZXB0aW9uIC0gRkFJTEVEX0JSQUNLRVRJTkcgeExvOiR4TG8sIHhIaTogJHhIaSwgZkxvOiAkZkxvLCBmSGk6ICRmSGksIG1heEV2YWw6ICR7bWF4RXZhbCAtIHJlbWFpbmluZ0V2YWx9LCBtYXhFdmFsOiAkbWF4RXZhbCwgYmFzZVJvb3Q6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AgbG93ZXJCb3VuZDogRG91YmxlLCB1cHBlckJvdW5kOiBEb3VibGUsXG4gICAgICAgIG1heGltdW1JdGVyYXRpb25zOiBJbnQgPSBJbnQuTUFYX1ZBTFVFXG4gICAgKTogRG91YmxlQXJyYXkge1xuICAgICAgICBpZiAobWF4aW11bUl0ZXJhdGlvbnMgPD0gMCkge1xuICAgICAgICAgICAgZXJyb3IoXCJOb3RTdHJpY3RseVBvc2l0aXZlXCIpXG4gICAgICAgIH1cbiAgICAgICAgdmVyaWZ5U2VxdWVuY2UobG93ZXJCb3VuZCwgaW5pdGlhbCwgdXBwZXJCb3VuZClcblxuICAgICAgICB2YXIgYSA9IGluaXRpYWxcbiAgICAgICAgdmFyIGIgPSBpbml0aWFsXG4gICAgICAgIHZhciBmYTogRG91YmxlXG4gICAgICAgIHZhciBmYjogRG91YmxlXG4gICAgICAgIHZhciBudW1JdGVyYXRpb25zID0gMFxuXG4gICAgICAgIGRvIHtcbiAgICAgICAgICAgIGEgPSBtYXgoYSAtIDEuMCwgbG93ZXJCb3VuZClcbiAgICAgICAgICAgIGIgPSBtaW4oYiArIDEuMCwgdXBwZXJCb3VuZClcbiAgICAgICAgICAgIGZhID0gZnVuY3Rpb24udmFsdWUoYSlcblxuICAgICAgICAgICAgZmIgPSBmdW5jdGlvbi52YWx1ZShiKVxuICAgICAgICAgICAgKytudW1JdGVyYXRpb25zXG4gICAgICAgIH0gd2hpbGUgKGZhICogZmIgPiAwLjAgJiYgbnVtSXRlcmF0aW9ucyA8IG1heGltdW1JdGVyYXRpb25zICYmXG4gICAgICAgICAgICAoYSA+IGxvd2VyQm91bmQgfHwgYiA8IHVwcGVyQm91bmQpXG4gICAgICAgIClcblxuICAgICAgICBpZiAoZmEgKiBmYiA+IDAuMCkge1xuICAgICAgICAgICAgZXJyb3IoXCJOb0JyYWNrZXRpbmdcIilcbiAgICAgICAgICAgIC8vTG9jYWxpemVkRm9ybWF0cy5GQUlMRURfQlJBQ0tFVElORyxcbiAgICAg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bnQsIHhWYWxzOiBEb3VibGVBcnJheSwgeVZhbHM6IERvdWJsZUFycmF5KTogUG9seW5vbWlhbEZ1bmN0aW9uIHtcbiAgICAgICAgdmFsIGZwZyA9IEZvcnN5dGhlUG9seW5vbWlhbEdlbmVyYXRvcih4VmFscylcbiAgICAgICAgdmFyIHJlcyA9IFBvbHlub21pYWxGdW5jdGlvbihkb3VibGVBcnJheU9mKDAuMCkpXG5cbiAgICAgICAgZm9yIChpIGluIDAuLmRlZykge1xuICAgICAgICAgICAgdmFsIHAgPSBmcGcuZ2V0UG9seW5vbWlhbChpKVxuICAgICAgICAgICAgdmFsIHMgPSBjb2VmZmljaWVudChwLCB4VmFscywgeVZhbHMpXG4gICAgICAgICAgICByZXMgKz0gcyAqIHBcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiByZXNcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjb2VmZmljaWVudChwOiBQb2x5bm9taWFsRnVuY3Rpb24sIHhWYWxzOiBEb3VibGVBcnJheSwgeVZhbHM6IERvdWJsZUFycmF5KTogRG91YmxlIHtcbiAgICAgICAgdmFyIHd3ID0gMC4wXG4gICAgICAgIHZhciB3ID0gMC4wXG4gICAgICAgIGZvciAoaSBpbiAwIHVudGlsIHhWYWxzLnNpemUpIHtcbiAgICAgICAgICAgIHZhbCB4ID0geFZhbHNbaV1cbiAgICAgICAgICAgIHZhbCB5ID0geVZhbHNbaV1cbiAgICAgICAgICAgIHZhbCBwdmFsID0gcC52YWx1ZSh4KVxuXG4gICAgICAgICAgICB3dyArPSBwdmFsICogcHZhbFxuICAgICAgICAgICAgdyArPSB5ICogcHZhbFxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHcgLyB3d1xuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBldmFsWCh4OiBEb3VibGUpOiBFdmFsUmVzdWx0IHtcblxuICAgICAgICB2YWwgc2UgPSBydW4geyAvLyBzdGFuZGFyZCBlcnJvciBvZiBwcmV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LnppcCh5cy5hc1NlcXVlbmNlKCkpKSB7XG4gICAgICAgIGlmIChTZXJpZXNVdGlsLmFsbEZpbml0ZSh4LCB5KSkge1xuICAgICAgICAgICAgcmVzLmFkZChQYWlyKHghISwgeSEhKSlcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiByZXNcbn1cblxucHJpdmF0ZSBmdW4gYXZlcmFnZUJ5WChsc3Q6IExpc3Q8UGFpcjxEb3VibGUsIERvdWJsZT4+KTogUGFpcjxMaXN0PERvdWJsZT4sIExpc3Q8RG91YmxlPj4ge1xuXG4gICAgaWYgKGxzdC5pc0VtcHR5KCkpXG4gICAgICAgIHJldHVybiBQYWlyKEFycmF5TGlzdDxEb3VibGU+KCksIEFycmF5TGlzdDxEb3VibGU+KCkpXG5cbiAgICB2YWwgdHggPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgdmFsIHR5ID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgIHZhciAocHJldlgsIHN1bVkpID0gbHN0LmZpcnN0KClcbiAgICB2YXIgY291bnRZID0gMVxuXG4gICAgZm9yICgoeCwgeSkgaW4gbHN0LmFzU2VxdWVuY2UoKS5kcm9wKDEpKSB7XG4gICAgICAgIGlmICh4ID09IHByZXZYKSB7XG4gICAgICAgICAgICBzdW1ZICs9IHlcbiAgICAgICAgICAgICsrY291bnRZXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0eC5hZGQocHJldlgpXG4gICAgICAgICAgICB0eS5hZGQoc3VtWS5kaXYoY291bnRZKSlcbiAgICAgICAgICAgIHByZXZYID0geFxuICAgICAgICAgICAgc3VtWSA9IHlcbiAgICAgICAgICAgIGNvdW50WSA9IDFcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHR4LmFkZChwcmV2WClcbiAgICB0eS5hZGQoc3VtWS5kaXYoY291bnRZKSlcblxuICAgIHJldHVybiBQYWlyKHR4LCB0eSlcbn1cblxuZnVuIGF2ZXJhZ2VCeVgoeHM6I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ogKFNldDxJbnQ+KSAtPiBULCBvbkRyb3A6IChTZXQ8SW50PikgLT4gVFxuICAgICk6IFQge1xuICAgICAgICB2YWwgcGljayA9IHNhbXBsZVNpemUgPD0gcG9wU2l6ZSAvIDJcbiAgICAgICAgdmFsIGluZGV4Q291bnQgPSBpZiAocGljaykgc2FtcGxlU2l6ZSBlbHNlIHBvcFNpemUgLSBzYW1wbGVTaXplXG5cbiAgICAgICAgdmFsIGluZGV4U2V0ID0gSGFzaFNldDxJbnQ+KClcblxuICAgICAgICB3aGlsZSAoaW5kZXhTZXQuc2l6ZSA8IGluZGV4Q291bnQpIHtcbiAgICAgICAgICAgIGluZGV4U2V0LmFkZChyYW5kLm5leHRJbnQocG9wU2l6ZSkpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gaWYgKHBpY2spIG9uUGljayhpbmRleFNldCkgZWxzZSBvbkRyb3AoaW5kZXhTZXQpXG4gICAgfVxuXG4gICAgZnVuIHNhbXBsZVdpdGhvdXRSZXBsYWNlbWVudChzYW1wbGVTaXplOiBJbnQsIHJhbmQ6IFJhbmRvbSwgZGF0YTogRGF0YUZyYW1lKTogRGF0YUZyYW1lIHtcbiAgICAgICAgcmV0dXJuIHNhbXBsZVdpdGhvdXRSZXBsYWNlbWVudChcbiAgICAgICAgICAgIGRhdGEucm93Q291bnQoKSxcbiAgICAgICAgICAgIHNhbXBsZVNpemUsXG4gICAgICAgICAgICByYW5kLFxuICAgICAgICAgICAgeyBkYXRhLnNlbGVjdEluZGljZXMoaXQpIH0sXG4gICAgICAgICAgICB7IGRhdGEuZHJvcEluZGljZXMoaXQpIH1cbiAgICAgICAgKVxuICAgIH1cbn1cbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./kotlin-dce-dev/lets-plot-plot-base-portable.js\n"); +eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) {\n if (true)\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(/*! kotlin */ \"./kotlin-dce-dev/kotlin.js\"), __webpack_require__(/*! lets-plot-base-portable */ \"./kotlin-dce-dev/lets-plot-base-portable.js\"), __webpack_require__(/*! lets-plot-plot-common-portable */ \"./kotlin-dce-dev/lets-plot-plot-common-portable.js\"), __webpack_require__(/*! lets-plot-vis-svg-portable */ \"./kotlin-dce-dev/lets-plot-vis-svg-portable.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n else {}\n}(this, function (_, Kotlin, $module$lets_plot_base_portable, $module$lets_plot_plot_common_portable, $module$lets_plot_vis_svg_portable) {\n 'use strict';\n var collect = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect;\n var Iterable = Kotlin.kotlin.collections.Iterable;\n var throwCCE = Kotlin.throwCCE;\n var equals = Kotlin.equals;\n var List = Kotlin.kotlin.collections.List;\n var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_287e2$;\n var Kind_OBJECT = Kotlin.Kind.OBJECT;\n var Kind_CLASS = Kotlin.Kind.CLASS;\n var TypedKey = $module$lets_plot_base_portable.jetbrains.datalore.base.typedKey.TypedKey;\n var Kind_INTERFACE = Kotlin.Kind.INTERFACE;\n var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init_pdl1vj$;\n var StringBuilder_init = Kotlin.kotlin.text.StringBuilder_init;\n var ensureNotNull = Kotlin.ensureNotNull;\n var emptyList = Kotlin.kotlin.collections.emptyList_287e2$;\n var LinkedHashSet_init = Kotlin.kotlin.collections.LinkedHashSet_init_mqih57$;\n var Collection = Kotlin.kotlin.collections.Collection;\n var data = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.data;\n var Enum = Kotlin.kotlin.Enum;\n var throwISE = Kotlin.throwISE;\n var isFinite = Kotlin.kotlin.isFinite_yrwdxr$;\n var zip = Kotlin.kotlin.collections.zip_45mdf7$;\n var getCallableRef = Kotlin.getCallableRef;\n var toList = Kotlin.kotlin.collections.toList_abgq59$;\n var compareBy = Kotlin.kotlin.comparisons.compareBy_bvgy4j$;\n var sortedWith = Kotlin.kotlin.collections.sortedWith_eknfly$;\n var reversed = Kotlin.kotlin.collections.reversed_7wnvza$;\n var plus = Kotlin.kotlin.collections.plus_mydzjv$;\n var toSet = Kotlin.kotlin.collections.toSet_7wnvza$;\n var logging = $module$lets_plot_base_portable.jetbrains.datalore.base.logging;\n var getKClass = Kotlin.getKClass;\n var ArrayList_init_0 = Kotlin.kotlin.collections.ArrayList_init_mqih57$;\n var HashMap_init = Kotlin.kotlin.collections.HashMap_init_q3lmfv$;\n var HashMap_init_0 = Kotlin.kotlin.collections.HashMap_init_73mtqc$;\n var LinkedHashMap_init = Kotlin.kotlin.collections.LinkedHashMap_init_q3lmfv$;\n var mapCapacity = Kotlin.kotlin.collections.mapCapacity_za3lpa$;\n var LinkedHashMap_init_0 = Kotlin.kotlin.collections.LinkedHashMap_init_bwtc7$;\n var MutableCollection = Kotlin.kotlin.collections.MutableCollection;\n var toString = Kotlin.toString;\n var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init_pdl1vj$;\n var TreeMap = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.TreeMap;\n var intersect = Kotlin.kotlin.collections.intersect_q4559j$;\n var Map = Kotlin.kotlin.collections.Map;\n var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$;\n var ArrayList_init_1 = Kotlin.kotlin.collections.ArrayList_init_ww73n8$;\n var JsMath = Math;\n var listOf = Kotlin.kotlin.collections.listOf_i5x0yv$;\n var Unit = Kotlin.kotlin.Unit;\n var TypedKeyHashMap = $module$lets_plot_base_portable.jetbrains.datalore.base.typedKey.TypedKeyHashMap;\n var kotlin_js_internal_DoubleCompanionObject = Kotlin.kotlin.js.internal.DoubleCompanionObject;\n var Color = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Color;\n var ClosedRange = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.ClosedRange;\n var HashSet_init = Kotlin.kotlin.collections.HashSet_init_mqih57$;\n var NoSuchElementException = Kotlin.kotlin.NoSuchElementException;\n var Iterator = Kotlin.kotlin.collections.Iterator;\n var Function = $module$lets_plot_base_portable.jetbrains.datalore.base.function.Function;\n var values = $module$lets_plot_base_portable.jetbrains.datalore.base.values;\n var svg = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg;\n var DoubleVector = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleVector;\n var geometry = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry;\n var Ordering = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.Ordering;\n var Comparator = Kotlin.kotlin.Comparator;\n var getPropertyCallableRef = Kotlin.getPropertyCallableRef;\n var coerceAtLeast = Kotlin.kotlin.ranges.coerceAtLeast_dqglrj$;\n var base = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.base;\n var startsWith = Kotlin.kotlin.text.startsWith_7epoxm$;\n var Regex_init = Kotlin.kotlin.text.Regex_init_61zpoe$;\n var DoubleSegment = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleSegment;\n var HashSet_init_0 = Kotlin.kotlin.collections.HashSet_init_ww73n8$;\n var reverse = Kotlin.kotlin.collections.reverse_vvxzk3$;\n var Any = Object;\n var DoubleRectangle = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleRectangle;\n var DoubleRectangle_init = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleRectangle_init_6y0v78$;\n var SvgLineElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgLineElement_init_6y0v78$;\n var SvgGElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgGElement;\n var slim = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.slim;\n var SvgRectElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement_init_6y0v78$;\n var SvgImageElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgImageElement_init_6y0v78$;\n var throwUPAE = Kotlin.throwUPAE;\n var isNaN_0 = Kotlin.kotlin.isNaN_yrwdxr$;\n var SvgPathDataBuilder = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgPathDataBuilder;\n var math = Kotlin.kotlin.math;\n var round = Kotlin.kotlin.math.round_14dthe$;\n var numberToInt = Kotlin.numberToInt;\n var SvgImageElementEx$Bitmap = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgImageElementEx.Bitmap;\n var SvgImageElementEx = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgImageElementEx;\n var SvgPathElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgPathElement_init_7jrsat$;\n var SvgShape = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgShape;\n var SvgElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgElement;\n var to = Kotlin.kotlin.to_ujzrz7$;\n var mapOf = Kotlin.kotlin.collections.mapOf_qfcya0$;\n var setOf = Kotlin.kotlin.collections.setOf_i5x0yv$;\n var take = Kotlin.kotlin.collections.take_ba2ldo$;\n var copyToArray = Kotlin.kotlin.collections.copyToArray;\n var splitRings = $module$lets_plot_base_portable.jetbrains.datalore.base.algorithms.splitRings_bemo1h$;\n var Pair = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Pair;\n var SvgRectElement_init_0 = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement_init_wthzt5$;\n var emptyMap = Kotlin.kotlin.collections.emptyMap_q3lmfv$;\n var Random = Kotlin.kotlin.random.Random;\n var asList = Kotlin.kotlin.collections.asList_us0mfu$;\n var SvgSlimObject = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.slim.SvgSlimObject;\n var SvgPathData = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgPathData;\n var SvgPathDataBuilder$Interpolation = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgPathDataBuilder.Interpolation;\n var WritableProperty = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.property.WritableProperty;\n var SvgColors = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgColors;\n var EventHandler = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event.EventHandler;\n var CompositeRegistration = $module$lets_plot_base_portable.jetbrains.datalore.base.registration.CompositeRegistration;\n var SvgClipPathElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgClipPathElement;\n var SvgRectElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement;\n var SvgDefsElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgDefsElement;\n var SvgIRI = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgIRI;\n var SvgGraphicsElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgGraphicsElement;\n var SvgTransformBuilder = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgTransformBuilder;\n var random = $module$lets_plot_base_portable.jetbrains.datalore.base.random;\n var SvgTextElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgTextElement_init_61zpoe$;\n var isBlank = Kotlin.kotlin.text.isBlank_gw00vp$;\n var filterNotNull = Kotlin.kotlin.collections.filterNotNull_m3lr2h$;\n var checkIndexOverflow = Kotlin.kotlin.collections.checkIndexOverflow_za3lpa$;\n var numberToDouble = Kotlin.numberToDouble;\n var Pair_0 = Kotlin.kotlin.Pair;\n var toMap = Kotlin.kotlin.collections.toMap_6hr0sd$;\n var getValue = Kotlin.kotlin.collections.getValue_t9ocha$;\n var toList_0 = Kotlin.kotlin.collections.toList_7wnvza$;\n var isInfinite = Kotlin.kotlin.isInfinite_yrwdxr$;\n var toMutableList = Kotlin.kotlin.collections.toMutableList_4c7yge$;\n var YearInterval = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.time.interval.YearInterval;\n var time = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.time;\n var interval = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.time.interval;\n var until = Kotlin.kotlin.ranges.until_dqglrj$;\n var listOf_0 = Kotlin.kotlin.collections.listOf_mh5how$;\n var asReversed = Kotlin.kotlin.collections.asReversed_2p1efm$;\n var NumberFormat_init = $module$lets_plot_base_portable.jetbrains.datalore.base.numberFormat.NumberFormat_init_61zpoe$;\n var text = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.text;\n var TimeInterval = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.time.interval.TimeInterval;\n var first = Kotlin.kotlin.collections.first_2p1efm$;\n var last = Kotlin.kotlin.collections.last_2p1efm$;\n var binarySearch = Kotlin.kotlin.collections.binarySearch_jhx6be$;\n var abs = Kotlin.kotlin.math.abs_za3lpa$;\n var maxOrNull = Kotlin.kotlin.collections.maxOrNull_l63kqw$;\n var mutableMapOf = Kotlin.kotlin.collections.mutableMapOf_qfcya0$;\n var HashSet_init_1 = Kotlin.kotlin.collections.HashSet_init_287e2$;\n var sortWith = Kotlin.kotlin.collections.sortWith_nqfjgj$;\n var hashCode = Kotlin.hashCode;\n var rangeTo = Kotlin.kotlin.ranges.rangeTo_38ydlf$;\n var withIndex = Kotlin.kotlin.collections.withIndex_7wnvza$;\n var LinkedHashSet_init_0 = Kotlin.kotlin.collections.LinkedHashSet_init_287e2$;\n var RuntimeException_init = Kotlin.kotlin.RuntimeException_init_pdl1vj$;\n var unzip = Kotlin.kotlin.collections.unzip_6hr0sd$;\n var sorted = Kotlin.kotlin.collections.sorted_exjks8$;\n var sum = Kotlin.kotlin.collections.sum_l63kqw$;\n var wrapFunction = Kotlin.wrapFunction;\n var Array_0 = Array;\n var L37 = Kotlin.Long.fromInt(37);\n var Random_0 = Kotlin.kotlin.random.Random_s8cxhz$;\n var coerceIn = Kotlin.kotlin.ranges.coerceIn_nig4hr$;\n var L_38038050983108802 = new Kotlin.Long(456400702, -8856424);\n var arrayCopy = Kotlin.kotlin.collections.arrayCopy;\n var average = Kotlin.kotlin.collections.average_bvy38s$;\n var arrayListOf = Kotlin.kotlin.collections.arrayListOf_i5x0yv$;\n var fill = Kotlin.kotlin.collections.fill_x4f2cq$;\n var sort = Kotlin.primitiveArraySort;\n var fill_0 = Kotlin.kotlin.collections.fill_tpuxuu$;\n var get_lastIndex = Kotlin.kotlin.collections.get_lastIndex_bvy38s$;\n var get_indices = Kotlin.kotlin.collections.get_indices_bvy38s$;\n var reversed_0 = Kotlin.kotlin.ranges.reversed_zf1xzc$;\n var toMutableList_0 = Kotlin.kotlin.collections.toMutableList_bvy38s$;\n var isNaN_1 = Kotlin.kotlin.isNaN_81szk$;\n var toBits = Kotlin.floatToBits;\n var toBits_0 = Kotlin.doubleToBits;\n var abs_0 = Kotlin.kotlin.math.abs_s8cxhz$;\n var L_2147483648 = Kotlin.Long.fromInt(-2147483648);\n var L_5852615386664158222 = new Kotlin.Long(1994767346, -1362668208);\n var zip_0 = Kotlin.kotlin.collections.zip_pmvpm9$;\n var toDoubleArray = Kotlin.kotlin.collections.toDoubleArray_tcduak$;\n var asSequence = Kotlin.kotlin.collections.asSequence_7wnvza$;\n var zip_1 = Kotlin.kotlin.sequences.zip_r7q3s9$;\n var drop = Kotlin.kotlin.sequences.drop_wuwhe2$;\n DataFrame$Variable$Source.prototype = Object.create(Enum.prototype);\n DataFrame$Variable$Source.prototype.constructor = DataFrame$Variable$Source;\n GeomKind.prototype = Object.create(Enum.prototype);\n GeomKind.prototype.constructor = GeomKind;\n AestheticsDefaults$Companion$bar$ObjectLiteral.prototype = Object.create(AestheticsDefaults.prototype);\n AestheticsDefaults$Companion$bar$ObjectLiteral.prototype.constructor = AestheticsDefaults$Companion$bar$ObjectLiteral;\n AestheticsDefaults$Companion$histogram$ObjectLiteral.prototype = Object.create(AestheticsDefaults.prototype);\n AestheticsDefaults$Companion$histogram$ObjectLiteral.prototype.constructor = AestheticsDefaults$Companion$histogram$ObjectLiteral;\n AestheticsDefaults$Companion$area$ObjectLiteral.prototype = Object.create(AestheticsDefaults.prototype);\n AestheticsDefaults$Companion$area$ObjectLiteral.prototype.constructor = AestheticsDefaults$Companion$area$ObjectLiteral;\n TransformVar$TransformVarByAes.prototype = Object.create(AesVisitor.prototype);\n TransformVar$TransformVarByAes.prototype.constructor = TransformVar$TransformVarByAes;\n ABLineGeom.prototype = Object.create(GeomBase.prototype);\n ABLineGeom.prototype.constructor = ABLineGeom;\n AreaGeom.prototype = Object.create(GeomBase.prototype);\n AreaGeom.prototype.constructor = AreaGeom;\n BarGeom.prototype = Object.create(GeomBase.prototype);\n BarGeom.prototype.constructor = BarGeom;\n TileGeom.prototype = Object.create(GeomBase.prototype);\n TileGeom.prototype.constructor = TileGeom;\n Bin2dGeom.prototype = Object.create(TileGeom.prototype);\n Bin2dGeom.prototype.constructor = Bin2dGeom;\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype = Object.create(DataPointAestheticsDelegate.prototype);\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.constructor = BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral;\n BoxplotGeom.prototype = Object.create(GeomBase.prototype);\n BoxplotGeom.prototype.constructor = BoxplotGeom;\n PathGeom.prototype = Object.create(GeomBase.prototype);\n PathGeom.prototype.constructor = PathGeom;\n ContourGeom.prototype = Object.create(PathGeom.prototype);\n ContourGeom.prototype.constructor = ContourGeom;\n PolygonGeom.prototype = Object.create(GeomBase.prototype);\n PolygonGeom.prototype.constructor = PolygonGeom;\n ContourfGeom.prototype = Object.create(PolygonGeom.prototype);\n ContourfGeom.prototype.constructor = ContourfGeom;\n CrossBarGeom.prototype = Object.create(GeomBase.prototype);\n CrossBarGeom.prototype.constructor = CrossBarGeom;\n Density2dGeom.prototype = Object.create(ContourGeom.prototype);\n Density2dGeom.prototype.constructor = Density2dGeom;\n Density2dfGeom.prototype = Object.create(ContourfGeom.prototype);\n Density2dfGeom.prototype.constructor = Density2dfGeom;\n DensityGeom.prototype = Object.create(AreaGeom.prototype);\n DensityGeom.prototype.constructor = DensityGeom;\n ErrorBarGeom.prototype = Object.create(GeomBase.prototype);\n ErrorBarGeom.prototype.constructor = ErrorBarGeom;\n LineGeom.prototype = Object.create(PathGeom.prototype);\n LineGeom.prototype.constructor = LineGeom;\n FreqpolyGeom.prototype = Object.create(LineGeom.prototype);\n FreqpolyGeom.prototype.constructor = FreqpolyGeom;\n HLineGeom.prototype = Object.create(GeomBase.prototype);\n HLineGeom.prototype.constructor = HLineGeom;\n HistogramGeom.prototype = Object.create(BarGeom.prototype);\n HistogramGeom.prototype.constructor = HistogramGeom;\n ImageGeom.prototype = Object.create(GeomBase.prototype);\n ImageGeom.prototype.constructor = ImageGeom;\n PointGeom.prototype = Object.create(GeomBase.prototype);\n PointGeom.prototype.constructor = PointGeom;\n JitterGeom.prototype = Object.create(PointGeom.prototype);\n JitterGeom.prototype.constructor = JitterGeom;\n LineRangeGeom.prototype = Object.create(GeomBase.prototype);\n LineRangeGeom.prototype.constructor = LineRangeGeom;\n MapGeom.prototype = Object.create(PolygonGeom.prototype);\n MapGeom.prototype.constructor = MapGeom;\n LinesHelper.prototype = Object.create(GeomHelper.prototype);\n LinesHelper.prototype.constructor = LinesHelper;\n PieGeom$PieHelper.prototype = Object.create(LinesHelper.prototype);\n PieGeom$PieHelper.prototype.constructor = PieGeom$PieHelper;\n PieGeom.prototype = Object.create(GeomBase.prototype);\n PieGeom.prototype.constructor = PieGeom;\n PointRangeGeom.prototype = Object.create(GeomBase.prototype);\n PointRangeGeom.prototype.constructor = PointRangeGeom;\n RasterGeom.prototype = Object.create(GeomBase.prototype);\n RasterGeom.prototype.constructor = RasterGeom;\n RectGeom.prototype = Object.create(GeomBase.prototype);\n RectGeom.prototype.constructor = RectGeom;\n RibbonGeom.prototype = Object.create(GeomBase.prototype);\n RibbonGeom.prototype.constructor = RibbonGeom;\n SegmentGeom.prototype = Object.create(GeomBase.prototype);\n SegmentGeom.prototype.constructor = SegmentGeom;\n SmoothGeom.prototype = Object.create(GeomBase.prototype);\n SmoothGeom.prototype.constructor = SmoothGeom;\n StepGeom$Direction.prototype = Object.create(Enum.prototype);\n StepGeom$Direction.prototype.constructor = StepGeom$Direction;\n StepGeom.prototype = Object.create(LineGeom.prototype);\n StepGeom.prototype.constructor = StepGeom;\n TextGeom.prototype = Object.create(GeomBase.prototype);\n TextGeom.prototype.constructor = TextGeom;\n VLineGeom.prototype = Object.create(GeomBase.prototype);\n VLineGeom.prototype.constructor = VLineGeom;\n ArrowSpec$toArrowAes$ObjectLiteral.prototype = Object.create(DataPointAestheticsDelegate.prototype);\n ArrowSpec$toArrowAes$ObjectLiteral.prototype.constructor = ArrowSpec$toArrowAes$ObjectLiteral;\n ArrowSpec$End.prototype = Object.create(Enum.prototype);\n ArrowSpec$End.prototype.constructor = ArrowSpec$End;\n ArrowSpec$Type.prototype = Object.create(Enum.prototype);\n ArrowSpec$Type.prototype.constructor = ArrowSpec$Type;\n RectanglesHelper.prototype = Object.create(GeomHelper.prototype);\n RectanglesHelper.prototype.constructor = RectanglesHelper;\n GeomTargetLocator$LookupSpace.prototype = Object.create(Enum.prototype);\n GeomTargetLocator$LookupSpace.prototype.constructor = GeomTargetLocator$LookupSpace;\n GeomTargetLocator$LookupStrategy.prototype = Object.create(Enum.prototype);\n GeomTargetLocator$LookupStrategy.prototype.constructor = GeomTargetLocator$LookupStrategy;\n HitShape$Kind.prototype = Object.create(Enum.prototype);\n HitShape$Kind.prototype.constructor = HitShape$Kind;\n HitShape$Companion$shapeWithPath$ObjectLiteral.prototype = Object.create(HitShape.prototype);\n HitShape$Companion$shapeWithPath$ObjectLiteral.prototype.constructor = HitShape$Companion$shapeWithPath$ObjectLiteral;\n TipLayoutHint$StemLength.prototype = Object.create(Enum.prototype);\n TipLayoutHint$StemLength.prototype.constructor = TipLayoutHint$StemLength;\n TipLayoutHint$Kind.prototype = Object.create(Enum.prototype);\n TipLayoutHint$Kind.prototype.constructor = TipLayoutHint$Kind;\n TooltipAnchor$VerticalAnchor.prototype = Object.create(Enum.prototype);\n TooltipAnchor$VerticalAnchor.prototype.constructor = TooltipAnchor$VerticalAnchor;\n TooltipAnchor$HorizontalAnchor.prototype = Object.create(Enum.prototype);\n TooltipAnchor$HorizontalAnchor.prototype.constructor = TooltipAnchor$HorizontalAnchor;\n LivemapConstants$DisplayMode.prototype = Object.create(Enum.prototype);\n LivemapConstants$DisplayMode.prototype.constructor = LivemapConstants$DisplayMode;\n LivemapConstants$Theme.prototype = Object.create(Enum.prototype);\n LivemapConstants$Theme.prototype.constructor = LivemapConstants$Theme;\n LivemapConstants$Projection.prototype = Object.create(Enum.prototype);\n LivemapConstants$Projection.prototype.constructor = LivemapConstants$Projection;\n PositionAdjustments$Meta.prototype = Object.create(Enum.prototype);\n PositionAdjustments$Meta.prototype.constructor = PositionAdjustments$Meta;\n PositionAdjustments$StackingStrategy.prototype = Object.create(Enum.prototype);\n PositionAdjustments$StackingStrategy.prototype.constructor = PositionAdjustments$StackingStrategy;\n StackPos$SplitPositiveNegative.prototype = Object.create(StackPos.prototype);\n StackPos$SplitPositiveNegative.prototype.constructor = StackPos$SplitPositiveNegative;\n StackPos$SumPositiveNegative.prototype = Object.create(StackPos.prototype);\n StackPos$SumPositiveNegative.prototype.constructor = StackPos$SumPositiveNegative;\n NamedLineType.prototype = Object.create(Enum.prototype);\n NamedLineType.prototype.constructor = NamedLineType;\n NamedLineType$BLANK.prototype = Object.create(NamedLineType.prototype);\n NamedLineType$BLANK.prototype.constructor = NamedLineType$BLANK;\n NamedLineType$SOLID.prototype = Object.create(NamedLineType.prototype);\n NamedLineType$SOLID.prototype.constructor = NamedLineType$SOLID;\n NamedShape.prototype = Object.create(Enum.prototype);\n NamedShape.prototype.constructor = NamedShape;\n CircleGlyph.prototype = Object.create(SingletonGlyph.prototype);\n CircleGlyph.prototype.constructor = CircleGlyph;\n TwoShapeGlyph.prototype = Object.create(MultiShapeGlyph.prototype);\n TwoShapeGlyph.prototype.constructor = TwoShapeGlyph;\n CrossGlyph.prototype = Object.create(TwoShapeGlyph.prototype);\n CrossGlyph.prototype.constructor = CrossGlyph;\n DiamondGlyph.prototype = Object.create(SingletonGlyph.prototype);\n DiamondGlyph.prototype.constructor = DiamondGlyph;\n PlusGlyph.prototype = Object.create(TwoShapeGlyph.prototype);\n PlusGlyph.prototype.constructor = PlusGlyph;\n SquareGlyph.prototype = Object.create(SingletonGlyph.prototype);\n SquareGlyph.prototype.constructor = SquareGlyph;\n TriangleGlyph.prototype = Object.create(SingletonGlyph.prototype);\n TriangleGlyph.prototype.constructor = TriangleGlyph;\n GroupComponent.prototype = Object.create(SvgComponent.prototype);\n GroupComponent.prototype.constructor = GroupComponent;\n LinePath.prototype = Object.create(SvgComponent.prototype);\n LinePath.prototype.constructor = LinePath;\n TextLabel$HorizontalAnchor.prototype = Object.create(Enum.prototype);\n TextLabel$HorizontalAnchor.prototype.constructor = TextLabel$HorizontalAnchor;\n TextLabel$VerticalAnchor.prototype = Object.create(Enum.prototype);\n TextLabel$VerticalAnchor.prototype.constructor = TextLabel$VerticalAnchor;\n TextLabel.prototype = Object.create(SvgComponent.prototype);\n TextLabel.prototype.constructor = TextLabel;\n ContinuousScale$MyBuilder.prototype = Object.create(AbstractScale$AbstractBuilder.prototype);\n ContinuousScale$MyBuilder.prototype.constructor = ContinuousScale$MyBuilder;\n ContinuousScale.prototype = Object.create(AbstractScale.prototype);\n ContinuousScale.prototype.constructor = ContinuousScale;\n DiscreteScale$MyBuilder.prototype = Object.create(AbstractScale$AbstractBuilder.prototype);\n DiscreteScale$MyBuilder.prototype.constructor = DiscreteScale$MyBuilder;\n DiscreteScale.prototype = Object.create(AbstractScale.prototype);\n DiscreteScale.prototype.constructor = DiscreteScale;\n DateTimeBreaksHelper.prototype = Object.create(BreaksHelperBase.prototype);\n DateTimeBreaksHelper.prototype.constructor = DateTimeBreaksHelper;\n LinearBreaksHelper.prototype = Object.create(BreaksHelperBase.prototype);\n LinearBreaksHelper.prototype.constructor = LinearBreaksHelper;\n IdentityTransform.prototype = Object.create(FunTransform.prototype);\n IdentityTransform.prototype.constructor = IdentityTransform;\n Log10Transform.prototype = Object.create(FunTransform.prototype);\n Log10Transform.prototype.constructor = Log10Transform;\n ReverseTransform.prototype = Object.create(FunTransform.prototype);\n ReverseTransform.prototype.constructor = ReverseTransform;\n SqrtTransform.prototype = Object.create(FunTransform.prototype);\n SqrtTransform.prototype.constructor = SqrtTransform;\n AbstractDensity2dStat.prototype = Object.create(BaseStat.prototype);\n AbstractDensity2dStat.prototype.constructor = AbstractDensity2dStat;\n Bin2dStat.prototype = Object.create(BaseStat.prototype);\n Bin2dStat.prototype.constructor = Bin2dStat;\n BinStat$XPosKind.prototype = Object.create(Enum.prototype);\n BinStat$XPosKind.prototype.constructor = BinStat$XPosKind;\n BinStat.prototype = Object.create(BaseStat.prototype);\n BinStat.prototype.constructor = BinStat;\n BoxplotStat.prototype = Object.create(BaseStat.prototype);\n BoxplotStat.prototype.constructor = BoxplotStat;\n ContourFillHelper$BorderKind.prototype = Object.create(Enum.prototype);\n ContourFillHelper$BorderKind.prototype.constructor = ContourFillHelper$BorderKind;\n ContourStat.prototype = Object.create(BaseStat.prototype);\n ContourStat.prototype.constructor = ContourStat;\n ContourfStat.prototype = Object.create(BaseStat.prototype);\n ContourfStat.prototype.constructor = ContourfStat;\n CorrelationStat$Method.prototype = Object.create(Enum.prototype);\n CorrelationStat$Method.prototype.constructor = CorrelationStat$Method;\n CorrelationStat$Type.prototype = Object.create(Enum.prototype);\n CorrelationStat$Type.prototype.constructor = CorrelationStat$Type;\n CorrelationStat.prototype = Object.create(BaseStat.prototype);\n CorrelationStat.prototype.constructor = CorrelationStat;\n CountStat.prototype = Object.create(BaseStat.prototype);\n CountStat.prototype.constructor = CountStat;\n Density2dStat.prototype = Object.create(AbstractDensity2dStat.prototype);\n Density2dStat.prototype.constructor = Density2dStat;\n Density2dfStat.prototype = Object.create(AbstractDensity2dStat.prototype);\n Density2dfStat.prototype.constructor = Density2dfStat;\n DensityStat$Kernel.prototype = Object.create(Enum.prototype);\n DensityStat$Kernel.prototype.constructor = DensityStat$Kernel;\n DensityStat$BandWidthMethod.prototype = Object.create(Enum.prototype);\n DensityStat$BandWidthMethod.prototype.constructor = DensityStat$BandWidthMethod;\n DensityStat.prototype = Object.create(BaseStat.prototype);\n DensityStat.prototype.constructor = DensityStat;\n SmoothStat$Method.prototype = Object.create(Enum.prototype);\n SmoothStat$Method.prototype.constructor = SmoothStat$Method;\n SmoothStat.prototype = Object.create(BaseStat.prototype);\n SmoothStat.prototype.constructor = SmoothStat;\n Stats$IdentityStat.prototype = Object.create(BaseStat.prototype);\n Stats$IdentityStat.prototype.constructor = Stats$IdentityStat;\n AbstractUnivariateSolver.prototype = Object.create(BaseAbstractUnivariateSolver.prototype);\n AbstractUnivariateSolver.prototype.constructor = AbstractUnivariateSolver;\n AllowedSolution.prototype = Object.create(Enum.prototype);\n AllowedSolution.prototype.constructor = AllowedSolution;\n Beta$regularizedBeta$ObjectLiteral.prototype = Object.create(ContinuedFraction.prototype);\n Beta$regularizedBeta$ObjectLiteral.prototype.constructor = Beta$regularizedBeta$ObjectLiteral;\n BrentSolver.prototype = Object.create(AbstractUnivariateSolver.prototype);\n BrentSolver.prototype.constructor = BrentSolver;\n Gamma$regularizedGammaQ$ObjectLiteral.prototype = Object.create(ContinuedFraction.prototype);\n Gamma$regularizedGammaQ$ObjectLiteral.prototype.constructor = Gamma$regularizedGammaQ$ObjectLiteral;\n MathArrays$OrderDirection.prototype = Object.create(Enum.prototype);\n MathArrays$OrderDirection.prototype.constructor = MathArrays$OrderDirection;\n TDistribution.prototype = Object.create(AbstractRealDistribution.prototype);\n TDistribution.prototype.constructor = TDistribution;\n LinearRegression.prototype = Object.create(RegressionEvaluator.prototype);\n LinearRegression.prototype.constructor = LinearRegression;\n LocalPolynomialRegression.prototype = Object.create(RegressionEvaluator.prototype);\n LocalPolynomialRegression.prototype.constructor = LocalPolynomialRegression;\n PolynomialRegression.prototype = Object.create(RegressionEvaluator.prototype);\n PolynomialRegression.prototype.constructor = PolynomialRegression;\n function Aes(name, isNumeric) {\n Aes$Companion_getInstance();\n if (isNumeric === void 0)\n isNumeric = true;\n this.name = name;\n this.isNumeric = isNumeric;\n Aes$Companion_getInstance().values_0.add_11rb$(this);\n }\n Object.defineProperty(Aes.prototype, 'isColor', {\n configurable: true,\n get: function () {\n return Aes$Companion_getInstance().isColor_896ixz$(this);\n }\n });\n Aes.prototype.toString = function () {\n return \"aes '\" + this.name + \"'\";\n };\n function Aes$Companion() {\n Aes$Companion_instance = this;\n this.values_0 = ArrayList_init();\n this.X = new Aes('x');\n this.Y = new Aes('y');\n this.Z = new Aes('z');\n this.COLOR = new Aes('color', false);\n this.FILL = new Aes('fill', false);\n this.ALPHA = new Aes('alpha');\n this.SHAPE = new Aes('shape', false);\n this.LINETYPE = new Aes('linetype', false);\n this.SIZE = new Aes('size');\n this.WIDTH = new Aes('width');\n this.HEIGHT = new Aes('height');\n this.WEIGHT = new Aes('weight');\n this.INTERCEPT = new Aes('intercept');\n this.SLOPE = new Aes('slope');\n this.XINTERCEPT = new Aes('xintercept');\n this.YINTERCEPT = new Aes('yintercept');\n this.LOWER = new Aes('lower');\n this.MIDDLE = new Aes('middle');\n this.UPPER = new Aes('upper');\n this.XMIN = new Aes('xmin');\n this.XMAX = new Aes('xmax');\n this.YMIN = new Aes('ymin');\n this.YMAX = new Aes('ymax');\n this.XEND = new Aes('xend');\n this.YEND = new Aes('yend');\n this.FRAME = new Aes('frame', false);\n this.SPEED = new Aes('speed');\n this.FLOW = new Aes('flow');\n this.LABEL = new Aes('label', false);\n this.FAMILY = new Aes('family', false);\n this.FONTFACE = new Aes('fontface', false);\n this.HJUST = new Aes('hjust', false);\n this.VJUST = new Aes('vjust', false);\n this.ANGLE = new Aes('angle');\n this.SYM_X = new Aes('sym_x');\n this.SYM_Y = new Aes('sym_y');\n }\n function Aes$Companion$numeric$lambda(aes) {\n return aes.isNumeric;\n }\n Aes$Companion.prototype.numeric_shhb9a$ = function (unfiltered) {\n var tmp$;\n return Kotlin.isType(tmp$ = collect.Iterables.filter_fpit1u$(unfiltered, Aes$Companion$numeric$lambda), Iterable) ? tmp$ : throwCCE();\n };\n Aes$Companion.prototype.isPositional_896ixz$ = function (aes) {\n return this.isPositionalXY_896ixz$(aes) || equals(aes, this.SLOPE);\n };\n Aes$Companion.prototype.isPositionalXY_896ixz$ = function (aes) {\n return this.isPositionalX_896ixz$(aes) || this.isPositionalY_896ixz$(aes);\n };\n Aes$Companion.prototype.isPositionalX_896ixz$ = function (aes) {\n return equals(aes, this.X) || equals(aes, this.XINTERCEPT) || equals(aes, this.XMIN) || equals(aes, this.XMAX) || equals(aes, this.XEND);\n };\n Aes$Companion.prototype.isPositionalY_896ixz$ = function (aes) {\n return equals(aes, this.Y) || equals(aes, this.YMIN) || equals(aes, this.YMAX) || equals(aes, this.INTERCEPT) || equals(aes, this.YINTERCEPT) || equals(aes, this.LOWER) || equals(aes, this.MIDDLE) || equals(aes, this.UPPER) || equals(aes, this.YEND);\n };\n Aes$Companion.prototype.isColor_896ixz$ = function (aes) {\n return equals(aes, this.COLOR) || equals(aes, this.FILL);\n };\n Aes$Companion.prototype.isAffectingScaleX_896ixz$ = function (aes) {\n return this.isPositionalX_896ixz$(aes);\n };\n Aes$Companion.prototype.isAffectingScaleY_896ixz$ = function (aes) {\n return this.isPositionalY_896ixz$(aes) && !equals(aes, this.INTERCEPT);\n };\n function Aes$Companion$affectingScaleX$lambda(this$Aes$) {\n return function (it) {\n return this$Aes$.isAffectingScaleX_896ixz$(it);\n };\n }\n Aes$Companion.prototype.affectingScaleX_shhb9a$ = function (unfiltered) {\n var numeric = this.numeric_shhb9a$(unfiltered);\n return collect.Iterables.filter_fpit1u$(numeric, Aes$Companion$affectingScaleX$lambda(this));\n };\n function Aes$Companion$affectingScaleY$lambda(this$Aes$) {\n return function (it) {\n return this$Aes$.isAffectingScaleY_896ixz$(it);\n };\n }\n Aes$Companion.prototype.affectingScaleY_shhb9a$ = function (unfiltered) {\n var numeric = this.numeric_shhb9a$(unfiltered);\n return collect.Iterables.filter_fpit1u$(numeric, Aes$Companion$affectingScaleY$lambda(this));\n };\n Aes$Companion.prototype.noGuideNeeded_896ixz$ = function (aes) {\n return equals(aes, this.FRAME) || equals(aes, this.SPEED) || equals(aes, this.FLOW) || equals(aes, this.LABEL) || equals(aes, this.SLOPE) || equals(aes, this.WIDTH) || equals(aes, this.HEIGHT) || equals(aes, this.HJUST) || equals(aes, this.VJUST) || equals(aes, this.ANGLE) || equals(aes, this.FAMILY) || equals(aes, this.FONTFACE) || equals(aes, this.SYM_X) || equals(aes, this.SYM_Y) || this.isPositional_896ixz$(aes);\n };\n Aes$Companion.prototype.values = function () {\n return this.values_0;\n };\n Aes$Companion.prototype.allPositional = function () {\n var tmp$;\n var $receiver = this.values_0;\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (this.isPositional_896ixz$(element))\n destination.add_11rb$(element);\n }\n return Kotlin.isType(tmp$ = destination, List) ? tmp$ : throwCCE();\n };\n Aes$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Aes$Companion_instance = null;\n function Aes$Companion_getInstance() {\n if (Aes$Companion_instance === null) {\n new Aes$Companion();\n }return Aes$Companion_instance;\n }\n Aes.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Aes',\n interfaces: [TypedKey]\n };\n function Aesthetics() {\n }\n Aesthetics.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Aesthetics',\n interfaces: []\n };\n function ContinuousTransform() {\n }\n ContinuousTransform.prototype.createApplicableDomain_yrwdxb$ = function (middle, callback$default) {\n if (middle === void 0)\n middle = null;\n return callback$default ? callback$default(middle) : this.createApplicableDomain_yrwdxb$$default(middle);\n };\n ContinuousTransform.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ContinuousTransform',\n interfaces: [Transform]\n };\n function CoordinateSystem() {\n }\n CoordinateSystem.prototype.isPointInLimits_k2qmv6$ = function (p, isClient, callback$default) {\n if (isClient === void 0)\n isClient = true;\n return callback$default ? callback$default(p, isClient) : this.isPointInLimits_k2qmv6$$default(p, isClient);\n };\n CoordinateSystem.prototype.isRectInLimits_fd842m$ = function (rect, isClient, callback$default) {\n if (isClient === void 0)\n isClient = true;\n return callback$default ? callback$default(rect, isClient) : this.isRectInLimits_fd842m$$default(rect, isClient);\n };\n CoordinateSystem.prototype.isPathInLimits_f6t8kh$ = function (path, isClient, callback$default) {\n if (isClient === void 0)\n isClient = true;\n return callback$default ? callback$default(path, isClient) : this.isPathInLimits_f6t8kh$$default(path, isClient);\n };\n CoordinateSystem.prototype.isPolygonInLimits_f6t8kh$ = function (polygon, isClient, callback$default) {\n if (isClient === void 0)\n isClient = true;\n return callback$default ? callback$default(polygon, isClient) : this.isPolygonInLimits_f6t8kh$$default(polygon, isClient);\n };\n CoordinateSystem.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'CoordinateSystem',\n interfaces: []\n };\n function DataFrame(builder) {\n DataFrame$Companion_getInstance();\n this.myVectorByVar_0 = null;\n this.myIsNumeric_0 = null;\n this.myRanges_0 = HashMap_init();\n this.myDistinctValues_0 = HashMap_init();\n this.myOrderSpecs_0 = null;\n this.assertAllSeriesAreSameSize_0(builder.myVectorByVar_8be2vx$);\n this.myVectorByVar_0 = HashMap_init_0(builder.myVectorByVar_8be2vx$);\n this.myIsNumeric_0 = HashMap_init_0(builder.myIsNumeric_8be2vx$);\n this.myOrderSpecs_0 = builder.myOrderSpecs_8be2vx$;\n var tmp$;\n tmp$ = this.myOrderSpecs_0.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var $receiver = this.myDistinctValues_0;\n var key = element.variable;\n var value = this.getOrderedDistinctValues_0(element);\n $receiver.put_xwzc9p$(key, value);\n }\n }\n function DataFrame$OrderSpec(variable, orderBy, direction, aggregateOperation) {\n if (aggregateOperation === void 0)\n aggregateOperation = null;\n this.variable = variable;\n this.orderBy = orderBy;\n this.direction = direction;\n this.aggregateOperation = aggregateOperation;\n }\n DataFrame$OrderSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'OrderSpec',\n interfaces: []\n };\n Object.defineProperty(DataFrame.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myVectorByVar_0.isEmpty();\n }\n });\n DataFrame.prototype.assertAllSeriesAreSameSize_0 = function (vectorByVar) {\n if (vectorByVar.size > 1) {\n var entries = vectorByVar.entries.iterator();\n var first = entries.next();\n var size = first.value.size;\n while (entries.hasNext()) {\n var next = entries.next();\n if (next.value.size !== size) {\n throw IllegalArgumentException_init('All data series in data frame must have equal size\\n' + this.dumpSizes_0(vectorByVar));\n }}\n }};\n DataFrame.prototype.dumpSizes_0 = function (vectorByVar) {\n var tmp$;\n var sb = StringBuilder_init();\n tmp$ = vectorByVar.entries.iterator();\n while (tmp$.hasNext()) {\n var tmp$_0 = tmp$.next();\n var key = tmp$_0.key;\n var value = tmp$_0.value;\n sb.append_pdl1vj$(key.name).append_pdl1vj$(' : ').append_s8jyv4$(value.size).append_s8itvh$(10);\n }\n return sb.toString();\n };\n DataFrame.prototype.rowCount = function () {\n return this.myVectorByVar_0.isEmpty() ? 0 : this.myVectorByVar_0.entries.iterator().next().value.size;\n };\n DataFrame.prototype.has_8xm3sj$ = function (variable) {\n return this.myVectorByVar_0.containsKey_11rb$(variable);\n };\n DataFrame.prototype.isEmpty_8xm3sj$ = function (variable) {\n return this.get_8xm3sj$(variable).isEmpty();\n };\n DataFrame.prototype.hasNoOrEmpty_8xm3sj$ = function (variable) {\n return !this.has_8xm3sj$(variable) || this.isEmpty_8xm3sj$(variable);\n };\n DataFrame.prototype.get_8xm3sj$ = function (variable) {\n this.assertDefined_0(variable);\n return ensureNotNull(this.myVectorByVar_0.get_11rb$(variable));\n };\n DataFrame.prototype.getNumeric_8xm3sj$ = function (variable) {\n var tmp$;\n this.assertDefined_0(variable);\n var list = this.myVectorByVar_0.get_11rb$(variable);\n if (ensureNotNull(list).isEmpty()) {\n return emptyList();\n }this.assertNumeric_0(variable);\n return Kotlin.isType(tmp$ = list, List) ? tmp$ : throwCCE();\n };\n DataFrame.prototype.distinctValues_8xm3sj$ = function (variable) {\n this.assertDefined_0(variable);\n var tmp$;\n var value = this.myDistinctValues_0.get_11rb$(variable);\n if (value == null) {\n var tmp$_0;\n var $receiver = LinkedHashSet_init(this.get_8xm3sj$(variable));\n $receiver.remove_11rb$(null);\n var values = $receiver;\n return Kotlin.isType(tmp$_0 = values, Collection) ? tmp$_0 : throwCCE();\n } else {\n tmp$ = value;\n }\n return tmp$;\n };\n DataFrame.prototype.variables = function () {\n return this.myVectorByVar_0.keys;\n };\n DataFrame.prototype.isNumeric_8xm3sj$ = function (variable) {\n this.assertDefined_0(variable);\n if (!this.myIsNumeric_0.containsKey_11rb$(variable)) {\n var checkedDoubles = data.SeriesUtil.checkedDoubles_9ma18$(this.get_8xm3sj$(variable));\n var $receiver = this.myIsNumeric_0;\n var value = checkedDoubles.notEmptyAndCanBeCast();\n $receiver.put_xwzc9p$(variable, value);\n }return ensureNotNull(this.myIsNumeric_0.get_11rb$(variable));\n };\n DataFrame.prototype.range_8xm3sj$ = function (variable) {\n if (!this.myRanges_0.containsKey_11rb$(variable)) {\n var v = this.getNumeric_8xm3sj$(variable);\n var r = data.SeriesUtil.range_l63ks6$(v);\n this.myRanges_0.put_xwzc9p$(variable, r);\n }return this.myRanges_0.get_11rb$(variable);\n };\n DataFrame.prototype.builder = function () {\n return DataFrame$DataFrame$Builder_init_0(this);\n };\n function DataFrame$assertDefined$lambda(closure$e) {\n return function () {\n return ensureNotNull(closure$e.message);\n };\n }\n DataFrame.prototype.assertDefined_0 = function (variable) {\n if (!this.has_8xm3sj$(variable)) {\n var e = IllegalArgumentException_init(\"Undefined variable: '\" + variable + \"'\");\n DataFrame$Companion_getInstance().LOG_0.error_l35kib$(e, DataFrame$assertDefined$lambda(e));\n throw e;\n }};\n function DataFrame$assertNumeric$lambda(closure$e) {\n return function () {\n return ensureNotNull(closure$e.message);\n };\n }\n DataFrame.prototype.assertNumeric_0 = function (variable) {\n if (!this.isNumeric_8xm3sj$(variable)) {\n var e = IllegalArgumentException_init(\"Not a numeric variable: '\" + variable + \"'\");\n DataFrame$Companion_getInstance().LOG_0.error_l35kib$(e, DataFrame$assertNumeric$lambda(e));\n throw e;\n }};\n function DataFrame$selectIndices$lambda(closure$indices) {\n return function (serie) {\n return data.SeriesUtil.pickAtIndices_ge51dg$(serie, closure$indices);\n };\n }\n DataFrame.prototype.selectIndices_pqoyrt$ = function (indices) {\n return this.buildModified_0(DataFrame$selectIndices$lambda(indices));\n };\n function DataFrame$selectIndices$lambda_0(closure$indices) {\n return function (serie) {\n return data.SeriesUtil.pickAtIndices_jlfzfq$(serie, closure$indices);\n };\n }\n DataFrame.prototype.selectIndices_p1n9e9$ = function (indices) {\n return this.buildModified_0(DataFrame$selectIndices$lambda_0(indices));\n };\n function DataFrame$dropIndices$lambda(closure$indices) {\n return function (serie) {\n return data.SeriesUtil.skipAtIndices_jlfzfq$(serie, closure$indices);\n };\n }\n DataFrame.prototype.dropIndices_p1n9e9$ = function (indices) {\n return indices.isEmpty() ? this : this.buildModified_0(DataFrame$dropIndices$lambda(indices));\n };\n DataFrame.prototype.buildModified_0 = function (serieFun) {\n var tmp$;\n var builder = this.builder();\n tmp$ = this.myVectorByVar_0.keys.iterator();\n while (tmp$.hasNext()) {\n var variable = tmp$.next();\n var serie = this.myVectorByVar_0.get_11rb$(variable);\n var modifiedSerie = serieFun(ensureNotNull(serie));\n builder.putIntern_bxyhp4$(variable, modifiedSerie);\n }\n return builder.build();\n };\n function DataFrame$Variable(name, source, label) {\n DataFrame$Variable$Companion_getInstance();\n if (source === void 0)\n source = DataFrame$Variable$Source$ORIGIN_getInstance();\n if (label === void 0)\n label = name;\n this.name = name;\n this.source = source;\n this.label = label;\n }\n Object.defineProperty(DataFrame$Variable.prototype, 'isOrigin', {\n configurable: true,\n get: function () {\n return this.source === DataFrame$Variable$Source$ORIGIN_getInstance();\n }\n });\n Object.defineProperty(DataFrame$Variable.prototype, 'isStat', {\n configurable: true,\n get: function () {\n return this.source === DataFrame$Variable$Source$STAT_getInstance();\n }\n });\n Object.defineProperty(DataFrame$Variable.prototype, 'isTransform', {\n configurable: true,\n get: function () {\n return this.source === DataFrame$Variable$Source$TRANSFORM_getInstance();\n }\n });\n DataFrame$Variable.prototype.toString = function () {\n return this.name;\n };\n DataFrame$Variable.prototype.toSummaryString = function () {\n return this.name + \", '\" + this.label + \"' [\" + this.source + ']';\n };\n function DataFrame$Variable$Source(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function DataFrame$Variable$Source_initFields() {\n DataFrame$Variable$Source_initFields = function () {\n };\n DataFrame$Variable$Source$ORIGIN_instance = new DataFrame$Variable$Source('ORIGIN', 0);\n DataFrame$Variable$Source$TRANSFORM_instance = new DataFrame$Variable$Source('TRANSFORM', 1);\n DataFrame$Variable$Source$STAT_instance = new DataFrame$Variable$Source('STAT', 2);\n }\n var DataFrame$Variable$Source$ORIGIN_instance;\n function DataFrame$Variable$Source$ORIGIN_getInstance() {\n DataFrame$Variable$Source_initFields();\n return DataFrame$Variable$Source$ORIGIN_instance;\n }\n var DataFrame$Variable$Source$TRANSFORM_instance;\n function DataFrame$Variable$Source$TRANSFORM_getInstance() {\n DataFrame$Variable$Source_initFields();\n return DataFrame$Variable$Source$TRANSFORM_instance;\n }\n var DataFrame$Variable$Source$STAT_instance;\n function DataFrame$Variable$Source$STAT_getInstance() {\n DataFrame$Variable$Source_initFields();\n return DataFrame$Variable$Source$STAT_instance;\n }\n DataFrame$Variable$Source.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Source',\n interfaces: [Enum]\n };\n function DataFrame$Variable$Source$values() {\n return [DataFrame$Variable$Source$ORIGIN_getInstance(), DataFrame$Variable$Source$TRANSFORM_getInstance(), DataFrame$Variable$Source$STAT_getInstance()];\n }\n DataFrame$Variable$Source.values = DataFrame$Variable$Source$values;\n function DataFrame$Variable$Source$valueOf(name) {\n switch (name) {\n case 'ORIGIN':\n return DataFrame$Variable$Source$ORIGIN_getInstance();\n case 'TRANSFORM':\n return DataFrame$Variable$Source$TRANSFORM_getInstance();\n case 'STAT':\n return DataFrame$Variable$Source$STAT_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.DataFrame.Variable.Source.' + name);\n }\n }\n DataFrame$Variable$Source.valueOf_61zpoe$ = DataFrame$Variable$Source$valueOf;\n function DataFrame$Variable$Companion() {\n DataFrame$Variable$Companion_instance = this;\n }\n DataFrame$Variable$Companion.prototype.createOriginal_puj7f4$ = function (name, label) {\n if (label === void 0)\n label = name;\n return new DataFrame$Variable(name, DataFrame$Variable$Source$ORIGIN_getInstance(), label);\n };\n DataFrame$Variable$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DataFrame$Variable$Companion_instance = null;\n function DataFrame$Variable$Companion_getInstance() {\n if (DataFrame$Variable$Companion_instance === null) {\n new DataFrame$Variable$Companion();\n }return DataFrame$Variable$Companion_instance;\n }\n DataFrame$Variable.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Variable',\n interfaces: []\n };\n function DataFrame$getOrderedDistinctValues$isValueComparable(value) {\n return value != null && (!(typeof value === 'number') || isFinite(value));\n }\n function DataFrame$getOrderedDistinctValues$lambda(it) {\n var tmp$;\n return Kotlin.isComparable(tmp$ = it.second) ? tmp$ : throwCCE();\n }\n function DataFrame$getOrderedDistinctValues$lambda_0(it) {\n var tmp$;\n return Kotlin.isComparable(tmp$ = it.first) ? tmp$ : throwCCE();\n }\n DataFrame.prototype.getOrderedDistinctValues_0 = function (orderSpec) {\n var tmp$, tmp$_0;\n var isValueComparable = DataFrame$getOrderedDistinctValues$isValueComparable;\n if (orderSpec.aggregateOperation != null) {\n if (!this.isNumeric_8xm3sj$(orderSpec.orderBy)) {\n var message = \"Can't apply aggregate operation to non-numeric values\";\n throw IllegalArgumentException_init(message.toString());\n }var $receiver = zip(this.get_8xm3sj$(orderSpec.variable), this.getNumeric_8xm3sj$(orderSpec.orderBy));\n var destination = LinkedHashMap_init();\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n var value = element.component1();\n var key = value;\n var tmp$_0_0;\n var value_0 = destination.get_11rb$(key);\n if (value_0 == null) {\n var answer = ArrayList_init();\n destination.put_xwzc9p$(key, answer);\n tmp$_0_0 = answer;\n } else {\n tmp$_0_0 = value_0;\n }\n var list = tmp$_0_0;\n var tmp$_2 = list.add_11rb$;\n var byValue = element.component2();\n tmp$_2.call(list, byValue);\n }\n var destination_0 = LinkedHashMap_init_0(mapCapacity(destination.size));\n var tmp$_3;\n tmp$_3 = destination.entries.iterator();\n while (tmp$_3.hasNext()) {\n var element_0 = tmp$_3.next();\n var tmp$_4 = destination_0.put_xwzc9p$;\n var tmp$_5 = element_0.key;\n var byValues = element_0.value;\n var tmp$_6 = orderSpec.aggregateOperation;\n var destination_1 = ArrayList_init();\n var tmp$_7;\n tmp$_7 = byValues.iterator();\n while (tmp$_7.hasNext()) {\n var element_1 = tmp$_7.next();\n if (isValueComparable(element_1))\n destination_1.add_11rb$(element_1);\n }\n tmp$_4.call(destination_0, tmp$_5, tmp$_6.call(orderSpec, destination_1));\n }\n tmp$ = toList(destination_0);\n } else {\n tmp$ = zip(this.get_8xm3sj$(orderSpec.variable), this.get_8xm3sj$(orderSpec.orderBy));\n }\n var $receiver_0 = tmp$;\n var destination_2 = ArrayList_init();\n var tmp$_8;\n tmp$_8 = $receiver_0.iterator();\n while (tmp$_8.hasNext()) {\n var element_2 = tmp$_8.next();\n if (isValueComparable(element_2.second) && isValueComparable(element_2.first))\n destination_2.add_11rb$(element_2);\n }\n var $receiver_1 = sortedWith(destination_2, compareBy([DataFrame$getOrderedDistinctValues$lambda, DataFrame$getOrderedDistinctValues$lambda_0]));\n var destination_3 = ArrayList_init();\n var tmp$_9;\n tmp$_9 = $receiver_1.iterator();\n while (tmp$_9.hasNext()) {\n var element_3 = tmp$_9.next();\n var tmp$_0_1;\n if ((tmp$_0_1 = element_3.first) != null) {\n destination_3.add_11rb$(tmp$_0_1);\n }}\n var orderedValues = destination_3;\n var $receiver_2 = zip(this.get_8xm3sj$(orderSpec.variable), this.get_8xm3sj$(orderSpec.orderBy));\n var destination_4 = ArrayList_init();\n var tmp$_10;\n tmp$_10 = $receiver_2.iterator();\n while (tmp$_10.hasNext()) {\n var element_4 = tmp$_10.next();\n if (!isValueComparable(element_4.second))\n destination_4.add_11rb$(element_4);\n }\n var destination_5 = ArrayList_init();\n var tmp$_11;\n tmp$_11 = destination_4.iterator();\n while (tmp$_11.hasNext()) {\n var element_5 = tmp$_11.next();\n var tmp$_0_2;\n if ((tmp$_0_2 = element_5.first) != null) {\n destination_5.add_11rb$(tmp$_0_2);\n }}\n var nonComparableAppendix = destination_5;\n if (orderSpec.direction < 0) {\n tmp$_0 = reversed(orderedValues);\n } else {\n tmp$_0 = orderedValues;\n }\n return toSet(plus(tmp$_0, nonComparableAppendix));\n };\n function DataFrame$Companion() {\n DataFrame$Companion_instance = this;\n this.LOG_0 = logging.PortableLogging.logger_xo1ogr$(getKClass(DataFrame));\n }\n DataFrame$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DataFrame$Companion_instance = null;\n function DataFrame$Companion_getInstance() {\n if (DataFrame$Companion_instance === null) {\n new DataFrame$Companion();\n }return DataFrame$Companion_instance;\n }\n function DataFrame$Builder() {\n DataFrame$Builder$Companion_getInstance();\n this.myVectorByVar_8be2vx$ = HashMap_init();\n this.myIsNumeric_8be2vx$ = HashMap_init();\n this.myOrderSpecs_8be2vx$ = ArrayList_init();\n }\n DataFrame$Builder.prototype.put_2l962d$ = function (variable, v) {\n this.putIntern_bxyhp4$(variable, v);\n this.myIsNumeric_8be2vx$.remove_11rb$(variable);\n return this;\n };\n DataFrame$Builder.prototype.putNumeric_s1rqo9$ = function (variable, v) {\n this.putIntern_bxyhp4$(variable, v);\n this.myIsNumeric_8be2vx$.put_xwzc9p$(variable, true);\n return this;\n };\n DataFrame$Builder.prototype.putDiscrete_2l962d$ = function (variable, v) {\n this.putIntern_bxyhp4$(variable, v);\n this.myIsNumeric_8be2vx$.put_xwzc9p$(variable, false);\n return this;\n };\n DataFrame$Builder.prototype.putIntern_bxyhp4$ = function (variable, v) {\n var $receiver = this.myVectorByVar_8be2vx$;\n var value = ArrayList_init_0(v);\n $receiver.put_xwzc9p$(variable, value);\n };\n DataFrame$Builder.prototype.remove_8xm3sj$ = function (variable) {\n this.myVectorByVar_8be2vx$.remove_11rb$(variable);\n this.myIsNumeric_8be2vx$.remove_11rb$(variable);\n return this;\n };\n DataFrame$Builder.prototype.addOrderSpecs_l2t0xf$ = function (orderSpecs) {\n var action = getCallableRef('addOrderSpec', function ($receiver, p1) {\n return $receiver.addOrderSpec_22dbp4$(p1);\n }.bind(null, this));\n var tmp$;\n tmp$ = orderSpecs.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n action(element);\n }\n return this;\n };\n DataFrame$Builder.prototype.addOrderSpec_22dbp4$ = function (orderSpec) {\n var $receiver = this.myOrderSpecs_8be2vx$;\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (equals(element.variable, orderSpec.variable)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n var currentOrderSpec = firstOrNull$result;\n if ((currentOrderSpec != null ? currentOrderSpec.aggregateOperation : null) == null) {\n var $receiver_0 = this.myOrderSpecs_8be2vx$;\n var tmp$_0;\n (Kotlin.isType(tmp$_0 = $receiver_0, MutableCollection) ? tmp$_0 : throwCCE()).remove_11rb$(currentOrderSpec);\n this.myOrderSpecs_8be2vx$.add_11rb$(orderSpec);\n }return this;\n };\n DataFrame$Builder.prototype.build = function () {\n return new DataFrame(this);\n };\n function DataFrame$Builder$Companion() {\n DataFrame$Builder$Companion_instance = this;\n }\n DataFrame$Builder$Companion.prototype.emptyFrame = function () {\n return DataFrame$DataFrame$Builder_init().build();\n };\n DataFrame$Builder$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DataFrame$Builder$Companion_instance = null;\n function DataFrame$Builder$Companion_getInstance() {\n if (DataFrame$Builder$Companion_instance === null) {\n new DataFrame$Builder$Companion();\n }return DataFrame$Builder$Companion_instance;\n }\n DataFrame$Builder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Builder',\n interfaces: []\n };\n function DataFrame$DataFrame$Builder_init($this) {\n $this = $this || Object.create(DataFrame$Builder.prototype);\n DataFrame$Builder.call($this);\n return $this;\n }\n function DataFrame$DataFrame$Builder_init_0(data, $this) {\n $this = $this || Object.create(DataFrame$Builder.prototype);\n DataFrame$Builder.call($this);\n $this.myVectorByVar_8be2vx$.putAll_a2k3zr$(data.myVectorByVar_0);\n $this.myIsNumeric_8be2vx$.putAll_a2k3zr$(data.myIsNumeric_0);\n $this.myOrderSpecs_8be2vx$.addAll_brywnq$(data.myOrderSpecs_0);\n return $this;\n }\n DataFrame.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataFrame',\n interfaces: []\n };\n function DataPointAesthetics() {\n }\n DataPointAesthetics.prototype.defined_896ixz$ = function (aes) {\n var tmp$;\n if (aes.isNumeric) {\n var number = this.get_31786j$(aes);\n return number != null && isFinite(typeof (tmp$ = number) === 'number' ? tmp$ : throwCCE());\n }return true;\n };\n DataPointAesthetics.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'DataPointAesthetics',\n interfaces: []\n };\n function DiscreteTransform(domainValues, domainLimits) {\n this.domainValues = domainValues;\n this.domainLimits = domainLimits;\n this.numberByDomainValue_0 = LinkedHashMap_init();\n this.domainValueByNumber_0 = new TreeMap();\n var tmp$, tmp$_0;\n if (this.domainLimits.isEmpty()) {\n tmp$ = this.domainValues;\n } else {\n tmp$ = intersect(this.domainLimits, this.domainValues);\n }\n var effectiveDomain = tmp$;\n this.numberByDomainValue_0.putAll_a2k3zr$(MapperUtil_getInstance().mapDiscreteDomainValuesToNumbers_7f6uoc$(effectiveDomain));\n tmp$_0 = this.numberByDomainValue_0.entries.iterator();\n while (tmp$_0.hasNext()) {\n var tmp$_1 = tmp$_0.next();\n var domainValue = tmp$_1.key;\n var number = tmp$_1.value;\n this.domainValueByNumber_0.put_ncwa5f$(number, domainValue);\n }\n }\n DiscreteTransform.prototype.hasDomainLimits = function () {\n return !this.domainLimits.isEmpty();\n };\n DiscreteTransform.prototype.isInDomain_s8jyv4$ = function (v) {\n var $receiver = this.numberByDomainValue_0;\n var tmp$;\n return (Kotlin.isType(tmp$ = $receiver, Map) ? tmp$ : throwCCE()).containsKey_11rb$(v);\n };\n DiscreteTransform.prototype.apply_9ma18$ = function (l) {\n var destination = ArrayList_init_1(collectionSizeOrDefault(l, 10));\n var tmp$;\n tmp$ = l.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(this.asNumber_0(item));\n }\n return destination;\n };\n DiscreteTransform.prototype.applyInverse_yrwdxb$ = function (v) {\n return this.fromNumber_0(v);\n };\n DiscreteTransform.prototype.asNumber_0 = function (input) {\n if (input == null) {\n return null;\n }if (this.numberByDomainValue_0.containsKey_11rb$(input)) {\n return this.numberByDomainValue_0.get_11rb$(input);\n }throw IllegalStateException_init('value ' + toString(input) + ' is not in the domain: ' + this.numberByDomainValue_0.keys);\n };\n DiscreteTransform.prototype.fromNumber_0 = function (v) {\n var tmp$;\n if (v == null) {\n return null;\n }if (this.domainValueByNumber_0.containsKey_mef7kx$(v)) {\n return this.domainValueByNumber_0.get_mef7kx$(v);\n }var ceilingKey = this.domainValueByNumber_0.ceilingKey_mef7kx$(v);\n var floorKey = this.domainValueByNumber_0.floorKey_mef7kx$(v);\n var keyNumber = null;\n if (ceilingKey != null || floorKey != null) {\n if (ceilingKey == null)\n tmp$ = floorKey;\n else if (floorKey == null)\n tmp$ = ceilingKey;\n else {\n var x = ceilingKey - v;\n var ceilingDist = JsMath.abs(x);\n var x_0 = floorKey - v;\n var floorDist = JsMath.abs(x_0);\n tmp$ = ceilingDist < floorDist ? ceilingKey : floorKey;\n }\n keyNumber = tmp$;\n }return keyNumber != null ? this.domainValueByNumber_0.get_mef7kx$(keyNumber) : null;\n };\n DiscreteTransform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DiscreteTransform',\n interfaces: [Transform]\n };\n function Geom() {\n }\n Geom.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Geom',\n interfaces: []\n };\n function GeomContext() {\n }\n GeomContext.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GeomContext',\n interfaces: []\n };\n function GeomKind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function GeomKind_initFields() {\n GeomKind_initFields = function () {\n };\n GeomKind$PATH_instance = new GeomKind('PATH', 0);\n GeomKind$LINE_instance = new GeomKind('LINE', 1);\n GeomKind$SMOOTH_instance = new GeomKind('SMOOTH', 2);\n GeomKind$BAR_instance = new GeomKind('BAR', 3);\n GeomKind$HISTOGRAM_instance = new GeomKind('HISTOGRAM', 4);\n GeomKind$TILE_instance = new GeomKind('TILE', 5);\n GeomKind$BIN_2D_instance = new GeomKind('BIN_2D', 6);\n GeomKind$MAP_instance = new GeomKind('MAP', 7);\n GeomKind$ERROR_BAR_instance = new GeomKind('ERROR_BAR', 8);\n GeomKind$CROSS_BAR_instance = new GeomKind('CROSS_BAR', 9);\n GeomKind$LINE_RANGE_instance = new GeomKind('LINE_RANGE', 10);\n GeomKind$POINT_RANGE_instance = new GeomKind('POINT_RANGE', 11);\n GeomKind$POLYGON_instance = new GeomKind('POLYGON', 12);\n GeomKind$AB_LINE_instance = new GeomKind('AB_LINE', 13);\n GeomKind$H_LINE_instance = new GeomKind('H_LINE', 14);\n GeomKind$V_LINE_instance = new GeomKind('V_LINE', 15);\n GeomKind$BOX_PLOT_instance = new GeomKind('BOX_PLOT', 16);\n GeomKind$LIVE_MAP_instance = new GeomKind('LIVE_MAP', 17);\n GeomKind$POINT_instance = new GeomKind('POINT', 18);\n GeomKind$RIBBON_instance = new GeomKind('RIBBON', 19);\n GeomKind$AREA_instance = new GeomKind('AREA', 20);\n GeomKind$DENSITY_instance = new GeomKind('DENSITY', 21);\n GeomKind$CONTOUR_instance = new GeomKind('CONTOUR', 22);\n GeomKind$CONTOURF_instance = new GeomKind('CONTOURF', 23);\n GeomKind$DENSITY2D_instance = new GeomKind('DENSITY2D', 24);\n GeomKind$DENSITY2DF_instance = new GeomKind('DENSITY2DF', 25);\n GeomKind$JITTER_instance = new GeomKind('JITTER', 26);\n GeomKind$FREQPOLY_instance = new GeomKind('FREQPOLY', 27);\n GeomKind$STEP_instance = new GeomKind('STEP', 28);\n GeomKind$RECT_instance = new GeomKind('RECT', 29);\n GeomKind$SEGMENT_instance = new GeomKind('SEGMENT', 30);\n GeomKind$TEXT_instance = new GeomKind('TEXT', 31);\n GeomKind$RASTER_instance = new GeomKind('RASTER', 32);\n GeomKind$IMAGE_instance = new GeomKind('IMAGE', 33);\n }\n var GeomKind$PATH_instance;\n function GeomKind$PATH_getInstance() {\n GeomKind_initFields();\n return GeomKind$PATH_instance;\n }\n var GeomKind$LINE_instance;\n function GeomKind$LINE_getInstance() {\n GeomKind_initFields();\n return GeomKind$LINE_instance;\n }\n var GeomKind$SMOOTH_instance;\n function GeomKind$SMOOTH_getInstance() {\n GeomKind_initFields();\n return GeomKind$SMOOTH_instance;\n }\n var GeomKind$BAR_instance;\n function GeomKind$BAR_getInstance() {\n GeomKind_initFields();\n return GeomKind$BAR_instance;\n }\n var GeomKind$HISTOGRAM_instance;\n function GeomKind$HISTOGRAM_getInstance() {\n GeomKind_initFields();\n return GeomKind$HISTOGRAM_instance;\n }\n var GeomKind$TILE_instance;\n function GeomKind$TILE_getInstance() {\n GeomKind_initFields();\n return GeomKind$TILE_instance;\n }\n var GeomKind$BIN_2D_instance;\n function GeomKind$BIN_2D_getInstance() {\n GeomKind_initFields();\n return GeomKind$BIN_2D_instance;\n }\n var GeomKind$MAP_instance;\n function GeomKind$MAP_getInstance() {\n GeomKind_initFields();\n return GeomKind$MAP_instance;\n }\n var GeomKind$ERROR_BAR_instance;\n function GeomKind$ERROR_BAR_getInstance() {\n GeomKind_initFields();\n return GeomKind$ERROR_BAR_instance;\n }\n var GeomKind$CROSS_BAR_instance;\n function GeomKind$CROSS_BAR_getInstance() {\n GeomKind_initFields();\n return GeomKind$CROSS_BAR_instance;\n }\n var GeomKind$LINE_RANGE_instance;\n function GeomKind$LINE_RANGE_getInstance() {\n GeomKind_initFields();\n return GeomKind$LINE_RANGE_instance;\n }\n var GeomKind$POINT_RANGE_instance;\n function GeomKind$POINT_RANGE_getInstance() {\n GeomKind_initFields();\n return GeomKind$POINT_RANGE_instance;\n }\n var GeomKind$POLYGON_instance;\n function GeomKind$POLYGON_getInstance() {\n GeomKind_initFields();\n return GeomKind$POLYGON_instance;\n }\n var GeomKind$AB_LINE_instance;\n function GeomKind$AB_LINE_getInstance() {\n GeomKind_initFields();\n return GeomKind$AB_LINE_instance;\n }\n var GeomKind$H_LINE_instance;\n function GeomKind$H_LINE_getInstance() {\n GeomKind_initFields();\n return GeomKind$H_LINE_instance;\n }\n var GeomKind$V_LINE_instance;\n function GeomKind$V_LINE_getInstance() {\n GeomKind_initFields();\n return GeomKind$V_LINE_instance;\n }\n var GeomKind$BOX_PLOT_instance;\n function GeomKind$BOX_PLOT_getInstance() {\n GeomKind_initFields();\n return GeomKind$BOX_PLOT_instance;\n }\n var GeomKind$LIVE_MAP_instance;\n function GeomKind$LIVE_MAP_getInstance() {\n GeomKind_initFields();\n return GeomKind$LIVE_MAP_instance;\n }\n var GeomKind$POINT_instance;\n function GeomKind$POINT_getInstance() {\n GeomKind_initFields();\n return GeomKind$POINT_instance;\n }\n var GeomKind$RIBBON_instance;\n function GeomKind$RIBBON_getInstance() {\n GeomKind_initFields();\n return GeomKind$RIBBON_instance;\n }\n var GeomKind$AREA_instance;\n function GeomKind$AREA_getInstance() {\n GeomKind_initFields();\n return GeomKind$AREA_instance;\n }\n var GeomKind$DENSITY_instance;\n function GeomKind$DENSITY_getInstance() {\n GeomKind_initFields();\n return GeomKind$DENSITY_instance;\n }\n var GeomKind$CONTOUR_instance;\n function GeomKind$CONTOUR_getInstance() {\n GeomKind_initFields();\n return GeomKind$CONTOUR_instance;\n }\n var GeomKind$CONTOURF_instance;\n function GeomKind$CONTOURF_getInstance() {\n GeomKind_initFields();\n return GeomKind$CONTOURF_instance;\n }\n var GeomKind$DENSITY2D_instance;\n function GeomKind$DENSITY2D_getInstance() {\n GeomKind_initFields();\n return GeomKind$DENSITY2D_instance;\n }\n var GeomKind$DENSITY2DF_instance;\n function GeomKind$DENSITY2DF_getInstance() {\n GeomKind_initFields();\n return GeomKind$DENSITY2DF_instance;\n }\n var GeomKind$JITTER_instance;\n function GeomKind$JITTER_getInstance() {\n GeomKind_initFields();\n return GeomKind$JITTER_instance;\n }\n var GeomKind$FREQPOLY_instance;\n function GeomKind$FREQPOLY_getInstance() {\n GeomKind_initFields();\n return GeomKind$FREQPOLY_instance;\n }\n var GeomKind$STEP_instance;\n function GeomKind$STEP_getInstance() {\n GeomKind_initFields();\n return GeomKind$STEP_instance;\n }\n var GeomKind$RECT_instance;\n function GeomKind$RECT_getInstance() {\n GeomKind_initFields();\n return GeomKind$RECT_instance;\n }\n var GeomKind$SEGMENT_instance;\n function GeomKind$SEGMENT_getInstance() {\n GeomKind_initFields();\n return GeomKind$SEGMENT_instance;\n }\n var GeomKind$TEXT_instance;\n function GeomKind$TEXT_getInstance() {\n GeomKind_initFields();\n return GeomKind$TEXT_instance;\n }\n var GeomKind$RASTER_instance;\n function GeomKind$RASTER_getInstance() {\n GeomKind_initFields();\n return GeomKind$RASTER_instance;\n }\n var GeomKind$IMAGE_instance;\n function GeomKind$IMAGE_getInstance() {\n GeomKind_initFields();\n return GeomKind$IMAGE_instance;\n }\n GeomKind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomKind',\n interfaces: [Enum]\n };\n function GeomKind$values() {\n return [GeomKind$PATH_getInstance(), GeomKind$LINE_getInstance(), GeomKind$SMOOTH_getInstance(), GeomKind$BAR_getInstance(), GeomKind$HISTOGRAM_getInstance(), GeomKind$TILE_getInstance(), GeomKind$BIN_2D_getInstance(), GeomKind$MAP_getInstance(), GeomKind$ERROR_BAR_getInstance(), GeomKind$CROSS_BAR_getInstance(), GeomKind$LINE_RANGE_getInstance(), GeomKind$POINT_RANGE_getInstance(), GeomKind$POLYGON_getInstance(), GeomKind$AB_LINE_getInstance(), GeomKind$H_LINE_getInstance(), GeomKind$V_LINE_getInstance(), GeomKind$BOX_PLOT_getInstance(), GeomKind$LIVE_MAP_getInstance(), GeomKind$POINT_getInstance(), GeomKind$RIBBON_getInstance(), GeomKind$AREA_getInstance(), GeomKind$DENSITY_getInstance(), GeomKind$CONTOUR_getInstance(), GeomKind$CONTOURF_getInstance(), GeomKind$DENSITY2D_getInstance(), GeomKind$DENSITY2DF_getInstance(), GeomKind$JITTER_getInstance(), GeomKind$FREQPOLY_getInstance(), GeomKind$STEP_getInstance(), GeomKind$RECT_getInstance(), GeomKind$SEGMENT_getInstance(), GeomKind$TEXT_getInstance(), GeomKind$RASTER_getInstance(), GeomKind$IMAGE_getInstance()];\n }\n GeomKind.values = GeomKind$values;\n function GeomKind$valueOf(name) {\n switch (name) {\n case 'PATH':\n return GeomKind$PATH_getInstance();\n case 'LINE':\n return GeomKind$LINE_getInstance();\n case 'SMOOTH':\n return GeomKind$SMOOTH_getInstance();\n case 'BAR':\n return GeomKind$BAR_getInstance();\n case 'HISTOGRAM':\n return GeomKind$HISTOGRAM_getInstance();\n case 'TILE':\n return GeomKind$TILE_getInstance();\n case 'BIN_2D':\n return GeomKind$BIN_2D_getInstance();\n case 'MAP':\n return GeomKind$MAP_getInstance();\n case 'ERROR_BAR':\n return GeomKind$ERROR_BAR_getInstance();\n case 'CROSS_BAR':\n return GeomKind$CROSS_BAR_getInstance();\n case 'LINE_RANGE':\n return GeomKind$LINE_RANGE_getInstance();\n case 'POINT_RANGE':\n return GeomKind$POINT_RANGE_getInstance();\n case 'POLYGON':\n return GeomKind$POLYGON_getInstance();\n case 'AB_LINE':\n return GeomKind$AB_LINE_getInstance();\n case 'H_LINE':\n return GeomKind$H_LINE_getInstance();\n case 'V_LINE':\n return GeomKind$V_LINE_getInstance();\n case 'BOX_PLOT':\n return GeomKind$BOX_PLOT_getInstance();\n case 'LIVE_MAP':\n return GeomKind$LIVE_MAP_getInstance();\n case 'POINT':\n return GeomKind$POINT_getInstance();\n case 'RIBBON':\n return GeomKind$RIBBON_getInstance();\n case 'AREA':\n return GeomKind$AREA_getInstance();\n case 'DENSITY':\n return GeomKind$DENSITY_getInstance();\n case 'CONTOUR':\n return GeomKind$CONTOUR_getInstance();\n case 'CONTOURF':\n return GeomKind$CONTOURF_getInstance();\n case 'DENSITY2D':\n return GeomKind$DENSITY2D_getInstance();\n case 'DENSITY2DF':\n return GeomKind$DENSITY2DF_getInstance();\n case 'JITTER':\n return GeomKind$JITTER_getInstance();\n case 'FREQPOLY':\n return GeomKind$FREQPOLY_getInstance();\n case 'STEP':\n return GeomKind$STEP_getInstance();\n case 'RECT':\n return GeomKind$RECT_getInstance();\n case 'SEGMENT':\n return GeomKind$SEGMENT_getInstance();\n case 'TEXT':\n return GeomKind$TEXT_getInstance();\n case 'RASTER':\n return GeomKind$RASTER_getInstance();\n case 'IMAGE':\n return GeomKind$IMAGE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.GeomKind.' + name);\n }\n }\n GeomKind.valueOf_61zpoe$ = GeomKind$valueOf;\n function GeomMeta() {\n GeomMeta_instance = this;\n this.renderedAesByGeom_0 = HashMap_init();\n this.POINT_0 = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().SHAPE]);\n this.PATH_0 = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().SPEED, Aes$Companion_getInstance().FLOW]);\n this.POLYGON_0 = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n this.AREA_0 = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n }\n GeomMeta.prototype.renders_7dhqpi$ = function (geomKind) {\n if (!this.renderedAesByGeom_0.containsKey_11rb$(geomKind)) {\n var $receiver = this.renderedAesByGeom_0;\n var value = this.renderedAesList_0(geomKind);\n $receiver.put_xwzc9p$(geomKind, value);\n }return ensureNotNull(this.renderedAesByGeom_0.get_11rb$(geomKind));\n };\n GeomMeta.prototype.renderedAesList_0 = function (geomKind) {\n var tmp$;\n switch (geomKind.name) {\n case 'POINT':\n tmp$ = this.POINT_0;\n break;\n case 'PATH':\n tmp$ = this.PATH_0;\n break;\n case 'LINE':\n tmp$ = this.PATH_0;\n break;\n case 'SMOOTH':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'BAR':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().SIZE]);\n break;\n case 'HISTOGRAM':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().SIZE]);\n break;\n case 'TILE':\n case 'BIN_2D':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().HEIGHT, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SIZE]);\n break;\n case 'ERROR_BAR':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SIZE]);\n break;\n case 'CROSS_BAR':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().MIDDLE, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SHAPE, Aes$Companion_getInstance().SIZE]);\n break;\n case 'LINE_RANGE':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SIZE]);\n break;\n case 'POINT_RANGE':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SHAPE, Aes$Companion_getInstance().SIZE]);\n break;\n case 'CONTOUR':\n tmp$ = this.PATH_0;\n break;\n case 'CONTOURF':\n tmp$ = this.POLYGON_0;\n break;\n case 'POLYGON':\n tmp$ = this.POLYGON_0;\n break;\n case 'MAP':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'AB_LINE':\n tmp$ = listOf([Aes$Companion_getInstance().INTERCEPT, Aes$Companion_getInstance().SLOPE, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'H_LINE':\n tmp$ = listOf([Aes$Companion_getInstance().YINTERCEPT, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'V_LINE':\n tmp$ = listOf([Aes$Companion_getInstance().XINTERCEPT, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'BOX_PLOT':\n tmp$ = listOf([Aes$Companion_getInstance().LOWER, Aes$Companion_getInstance().MIDDLE, Aes$Companion_getInstance().UPPER, Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().SHAPE, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().WIDTH]);\n break;\n case 'RIBBON':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'AREA':\n tmp$ = this.AREA_0;\n break;\n case 'DENSITY':\n tmp$ = this.AREA_0;\n break;\n case 'DENSITY2D':\n tmp$ = this.PATH_0;\n break;\n case 'DENSITY2DF':\n tmp$ = this.POLYGON_0;\n break;\n case 'JITTER':\n tmp$ = this.POINT_0;\n break;\n case 'FREQPOLY':\n tmp$ = this.PATH_0;\n break;\n case 'STEP':\n tmp$ = this.PATH_0;\n break;\n case 'RECT':\n tmp$ = listOf([Aes$Companion_getInstance().XMIN, Aes$Companion_getInstance().XMAX, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'SEGMENT':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().XEND, Aes$Companion_getInstance().YEND, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().LINETYPE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().SPEED, Aes$Companion_getInstance().FLOW]);\n break;\n case 'TEXT':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().LABEL, Aes$Companion_getInstance().FAMILY, Aes$Companion_getInstance().FONTFACE, Aes$Companion_getInstance().HJUST, Aes$Companion_getInstance().VJUST, Aes$Companion_getInstance().ANGLE]);\n break;\n case 'LIVE_MAP':\n tmp$ = listOf([Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().SIZE, Aes$Companion_getInstance().SHAPE, Aes$Companion_getInstance().FRAME, Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().SYM_X, Aes$Companion_getInstance().SYM_Y]);\n break;\n case 'RASTER':\n tmp$ = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().HEIGHT, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA]);\n break;\n case 'IMAGE':\n tmp$ = listOf([Aes$Companion_getInstance().XMIN, Aes$Companion_getInstance().XMAX, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX]);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n GeomMeta.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GeomMeta',\n interfaces: []\n };\n var GeomMeta_instance = null;\n function GeomMeta_getInstance() {\n if (GeomMeta_instance === null) {\n new GeomMeta();\n }return GeomMeta_instance;\n }\n function PositionAdjustment() {\n }\n Object.defineProperty(PositionAdjustment.prototype, 'isIdentity', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n PositionAdjustment.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PositionAdjustment',\n interfaces: []\n };\n function Scale() {\n }\n function Scale$Builder() {\n }\n Scale$Builder.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Builder',\n interfaces: []\n };\n Scale.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Scale',\n interfaces: []\n };\n function Stat() {\n }\n function Stat$apply$lambda(it) {\n return Unit;\n }\n Stat.prototype.apply_kdy6bf$ = function (data, statCtx, messageConsumer, callback$default) {\n if (messageConsumer === void 0)\n messageConsumer = Stat$apply$lambda;\n return callback$default ? callback$default(data, statCtx, messageConsumer) : this.apply_kdy6bf$$default(data, statCtx, messageConsumer);\n };\n Stat.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Stat',\n interfaces: []\n };\n function StatContext() {\n }\n StatContext.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'StatContext',\n interfaces: []\n };\n function Transform() {\n }\n Transform.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Transform',\n interfaces: []\n };\n function AesInitValue() {\n AesInitValue_instance = this;\n this.VALUE_MAP_0 = new TypedKeyHashMap();\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().X, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().Y, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().Z, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().YMIN, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().YMAX, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().COLOR, Color.Companion.PACIFIC_BLUE);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().FILL, Color.Companion.PACIFIC_BLUE);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().ALPHA, 1.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SHAPE, NamedShape$SOLID_CIRCLE_getInstance());\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().LINETYPE, NamedLineType$SOLID_getInstance());\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SIZE, 0.5);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().WIDTH, 1.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().HEIGHT, 1.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().WEIGHT, 1.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().INTERCEPT, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SLOPE, 1.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().XINTERCEPT, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().YINTERCEPT, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().LOWER, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().MIDDLE, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().UPPER, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().FRAME, 'empty frame');\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SPEED, 10.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().FLOW, 0.1);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().XMIN, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().XMAX, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().XEND, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().YEND, kotlin_js_internal_DoubleCompanionObject.NaN);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().LABEL, '');\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().FAMILY, 'sans-serif');\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().FONTFACE, 'plain');\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().HJUST, 0.5);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().VJUST, 0.5);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().ANGLE, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SYM_X, 0.0);\n this.VALUE_MAP_0.set_ev6mlr$(Aes$Companion_getInstance().SYM_Y, 0.0);\n }\n AesInitValue.prototype.has_896ixz$ = function (aes) {\n return this.VALUE_MAP_0.containsKey_ex36zt$(aes);\n };\n AesInitValue.prototype.get_31786j$ = function (aes) {\n return this.VALUE_MAP_0.get_ex36zt$(aes);\n };\n AesInitValue.prototype.get_ex36zt$ = function (aes) {\n return this.VALUE_MAP_0.get_ex36zt$(aes);\n };\n AesInitValue.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'AesInitValue',\n interfaces: []\n };\n var AesInitValue_instance = null;\n function AesInitValue_getInstance() {\n if (AesInitValue_instance === null) {\n new AesInitValue();\n }return AesInitValue_instance;\n }\n function AesScaling() {\n AesScaling_instance = this;\n this.UNIT_SHAPE_SIZE = 2.2;\n }\n AesScaling.prototype.strokeWidth_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * 2.0;\n };\n AesScaling.prototype.circleDiameter_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * this.UNIT_SHAPE_SIZE;\n };\n AesScaling.prototype.circleDiameterSmaller_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * 1.5;\n };\n AesScaling.prototype.sizeFromCircleDiameter_14dthe$ = function (diameter) {\n return diameter / this.UNIT_SHAPE_SIZE;\n };\n AesScaling.prototype.textSize_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * 2;\n };\n AesScaling.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'AesScaling',\n interfaces: []\n };\n var AesScaling_instance = null;\n function AesScaling_getInstance() {\n if (AesScaling_instance === null) {\n new AesScaling();\n }return AesScaling_instance;\n }\n function AesVisitor() {\n }\n AesVisitor.prototype.visit_896ixz$ = function (aes) {\n var tmp$, tmp$_0;\n if (aes.isNumeric) {\n tmp$_0 = this.visitNumeric_vktour$(Kotlin.isType(tmp$ = aes, Aes) ? tmp$ : throwCCE());\n } else\n tmp$_0 = this.visitIntern_rp5ogw$_0(aes);\n return tmp$_0;\n };\n AesVisitor.prototype.visitNumeric_vktour$ = function (aes) {\n return this.visitIntern_rp5ogw$_0(aes);\n };\n AesVisitor.prototype.visitIntern_rp5ogw$_0 = function (aes) {\n if (equals(aes, Aes$Companion_getInstance().X)) {\n return this.x();\n }if (equals(aes, Aes$Companion_getInstance().Y)) {\n return this.y();\n }if (equals(aes, Aes$Companion_getInstance().Z)) {\n return this.z();\n }if (equals(aes, Aes$Companion_getInstance().YMIN)) {\n return this.ymin();\n }if (equals(aes, Aes$Companion_getInstance().YMAX)) {\n return this.ymax();\n }if (equals(aes, Aes$Companion_getInstance().COLOR)) {\n return this.color();\n }if (equals(aes, Aes$Companion_getInstance().FILL)) {\n return this.fill();\n }if (equals(aes, Aes$Companion_getInstance().ALPHA)) {\n return this.alpha();\n }if (equals(aes, Aes$Companion_getInstance().SHAPE)) {\n return this.shape();\n }if (equals(aes, Aes$Companion_getInstance().SIZE)) {\n return this.size();\n }if (equals(aes, Aes$Companion_getInstance().LINETYPE)) {\n return this.lineType();\n }if (equals(aes, Aes$Companion_getInstance().WIDTH)) {\n return this.width();\n }if (equals(aes, Aes$Companion_getInstance().HEIGHT)) {\n return this.height();\n }if (equals(aes, Aes$Companion_getInstance().WEIGHT)) {\n return this.weight();\n }if (equals(aes, Aes$Companion_getInstance().INTERCEPT)) {\n return this.intercept();\n }if (equals(aes, Aes$Companion_getInstance().SLOPE)) {\n return this.slope();\n }if (equals(aes, Aes$Companion_getInstance().XINTERCEPT)) {\n return this.interceptX();\n }if (equals(aes, Aes$Companion_getInstance().YINTERCEPT)) {\n return this.interceptY();\n }if (equals(aes, Aes$Companion_getInstance().LOWER)) {\n return this.lower();\n }if (equals(aes, Aes$Companion_getInstance().MIDDLE)) {\n return this.middle();\n }if (equals(aes, Aes$Companion_getInstance().UPPER)) {\n return this.upper();\n }if (equals(aes, Aes$Companion_getInstance().FRAME)) {\n return this.frame();\n }if (equals(aes, Aes$Companion_getInstance().SPEED)) {\n return this.speed();\n }if (equals(aes, Aes$Companion_getInstance().FLOW)) {\n return this.flow();\n }if (equals(aes, Aes$Companion_getInstance().XMIN)) {\n return this.xmin();\n }if (equals(aes, Aes$Companion_getInstance().XMAX)) {\n return this.xmax();\n }if (equals(aes, Aes$Companion_getInstance().XEND)) {\n return this.xend();\n }if (equals(aes, Aes$Companion_getInstance().YEND)) {\n return this.yend();\n }if (equals(aes, Aes$Companion_getInstance().LABEL)) {\n return this.label();\n }if (equals(aes, Aes$Companion_getInstance().FAMILY)) {\n return this.family();\n }if (equals(aes, Aes$Companion_getInstance().FONTFACE)) {\n return this.fontface();\n }if (equals(aes, Aes$Companion_getInstance().HJUST)) {\n return this.hjust();\n }if (equals(aes, Aes$Companion_getInstance().VJUST)) {\n return this.vjust();\n }if (equals(aes, Aes$Companion_getInstance().ANGLE)) {\n return this.angle();\n }if (equals(aes, Aes$Companion_getInstance().SYM_X)) {\n return this.symX();\n }if (equals(aes, Aes$Companion_getInstance().SYM_Y)) {\n return this.symY();\n }throw IllegalArgumentException_init('Unexpected aes: ' + aes);\n };\n AesVisitor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AesVisitor',\n interfaces: []\n };\n function AestheticsBuilder(myDataPointCount) {\n AestheticsBuilder$Companion_getInstance();\n if (myDataPointCount === void 0)\n myDataPointCount = 0;\n this.myDataPointCount_0 = myDataPointCount;\n this.myIndexFunctionMap_0 = null;\n this.myGroup_0 = AestheticsBuilder$Companion_getInstance().constant_mh5how$(0);\n this.myConstantAes_0 = collect.Sets.newHashSet_yl67zr$(Aes$Companion_getInstance().values());\n this.myOverallRangeByNumericAes_0 = HashMap_init();\n var tmp$;\n this.myIndexFunctionMap_0 = HashMap_init();\n tmp$ = Aes$Companion_getInstance().values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n var $receiver = this.myIndexFunctionMap_0;\n var value = AestheticsBuilder$Companion_getInstance().constant_mh5how$(AesInitValue_getInstance().get_31786j$(aes));\n $receiver.put_xwzc9p$(aes, value);\n }\n }\n AestheticsBuilder.prototype.dataPointCount_za3lpa$ = function (v) {\n this.myDataPointCount_0 = v;\n return this;\n };\n AestheticsBuilder.prototype.overallRange_xlyz3f$ = function (aes, range) {\n this.myOverallRangeByNumericAes_0.put_xwzc9p$(aes, range);\n return this;\n };\n AestheticsBuilder.prototype.x_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().X, v);\n };\n AestheticsBuilder.prototype.y_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().Y, v);\n };\n AestheticsBuilder.prototype.color_u2gvuj$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().COLOR, v);\n };\n AestheticsBuilder.prototype.fill_u2gvuj$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().FILL, v);\n };\n AestheticsBuilder.prototype.alpha_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().ALPHA, v);\n };\n AestheticsBuilder.prototype.shape_9kzkiq$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().SHAPE, v);\n };\n AestheticsBuilder.prototype.lineType_vv264d$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().LINETYPE, v);\n };\n AestheticsBuilder.prototype.size_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().SIZE, v);\n };\n AestheticsBuilder.prototype.width_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().WIDTH, v);\n };\n AestheticsBuilder.prototype.weight_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().WEIGHT, v);\n };\n AestheticsBuilder.prototype.frame_cfki2p$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().FRAME, v);\n };\n AestheticsBuilder.prototype.speed_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().SPEED, v);\n };\n AestheticsBuilder.prototype.flow_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().FLOW, v);\n };\n AestheticsBuilder.prototype.group_ddsh32$ = function (v) {\n this.myGroup_0 = v;\n return this;\n };\n AestheticsBuilder.prototype.label_bfjv6s$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().LABEL, v);\n };\n AestheticsBuilder.prototype.family_cfki2p$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().FAMILY, v);\n };\n AestheticsBuilder.prototype.fontface_cfki2p$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().FONTFACE, v);\n };\n AestheticsBuilder.prototype.hjust_bfjv6s$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().HJUST, v);\n };\n AestheticsBuilder.prototype.vjust_bfjv6s$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().VJUST, v);\n };\n AestheticsBuilder.prototype.angle_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().ANGLE, v);\n };\n AestheticsBuilder.prototype.xmin_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().XMIN, v);\n };\n AestheticsBuilder.prototype.xmax_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().XMAX, v);\n };\n AestheticsBuilder.prototype.ymin_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().YMIN, v);\n };\n AestheticsBuilder.prototype.ymax_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().YMAX, v);\n };\n AestheticsBuilder.prototype.symX_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().SYM_X, v);\n };\n AestheticsBuilder.prototype.symY_jmvnpd$ = function (v) {\n return this.aes_u42xfl$(Aes$Companion_getInstance().SYM_Y, v);\n };\n AestheticsBuilder.prototype.constantAes_bbdhip$ = function (aes, v) {\n this.myConstantAes_0.add_11rb$(aes);\n var $receiver = this.myIndexFunctionMap_0;\n var value = AestheticsBuilder$Companion_getInstance().constant_mh5how$(v);\n $receiver.put_xwzc9p$(aes, value);\n return this;\n };\n AestheticsBuilder.prototype.aes_u42xfl$ = function (aes, v) {\n this.myConstantAes_0.remove_11rb$(aes);\n this.myIndexFunctionMap_0.put_xwzc9p$(aes, v);\n return this;\n };\n AestheticsBuilder.prototype.build = function () {\n return new AestheticsBuilder$MyAesthetics(this);\n };\n function AestheticsBuilder$MyAesthetics(b) {\n this.myDataPointCount_0 = b.myDataPointCount_0;\n this.myIndexFunctionMap_0 = new TypedIndexFunctionMap(b.myIndexFunctionMap_0);\n this.group = b.myGroup_0;\n this.myConstantAes_0 = null;\n this.myOverallRangeByNumericAes_0 = null;\n this.myResolutionByAes_0 = HashMap_init();\n this.myRangeByNumericAes_0 = HashMap_init();\n this.myConstantAes_0 = HashSet_init(b.myConstantAes_0);\n this.myOverallRangeByNumericAes_0 = HashMap_init_0(b.myOverallRangeByNumericAes_0);\n }\n Object.defineProperty(AestheticsBuilder$MyAesthetics.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myDataPointCount_0 === 0;\n }\n });\n AestheticsBuilder$MyAesthetics.prototype.aes_31786j$ = function (aes) {\n return this.myIndexFunctionMap_0.get_31786j$(aes);\n };\n AestheticsBuilder$MyAesthetics.prototype.dataPointAt_za3lpa$ = function (index) {\n return new AestheticsBuilder$MyDataPointAesthetics(index, this);\n };\n AestheticsBuilder$MyAesthetics.prototype.dataPointCount = function () {\n return this.myDataPointCount_0;\n };\n function AestheticsBuilder$MyAesthetics$dataPoints$ObjectLiteral(this$MyAesthetics, closure$self) {\n this.this$MyAesthetics = this$MyAesthetics;\n this.closure$self = closure$self;\n }\n AestheticsBuilder$MyAesthetics$dataPoints$ObjectLiteral.prototype.iterator = function () {\n return new AestheticsBuilder$MyDataPointsIterator(this.this$MyAesthetics.myDataPointCount_0, this.closure$self);\n };\n AestheticsBuilder$MyAesthetics$dataPoints$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Iterable]\n };\n AestheticsBuilder$MyAesthetics.prototype.dataPoints = function () {\n var self_0 = this;\n return new AestheticsBuilder$MyAesthetics$dataPoints$ObjectLiteral(this, self_0);\n };\n AestheticsBuilder$MyAesthetics.prototype.range_vktour$ = function (aes) {\n var tmp$;\n if (!this.myRangeByNumericAes_0.containsKey_11rb$(aes)) {\n if (this.myDataPointCount_0 <= 0)\n tmp$ = new ClosedRange(0.0, 0.0);\n else if (this.myConstantAes_0.contains_11rb$(aes)) {\n var v = ensureNotNull(this.numericValues_vktour$(aes).iterator().next());\n if (isFinite(v)) {\n tmp$ = new ClosedRange(v, v);\n } else\n tmp$ = null;\n } else {\n var values = this.numericValues_vktour$(aes);\n tmp$ = data.SeriesUtil.range_l63ks6$(values);\n }\n var r = tmp$;\n this.myRangeByNumericAes_0.put_xwzc9p$(aes, r);\n }return this.myRangeByNumericAes_0.get_11rb$(aes);\n };\n AestheticsBuilder$MyAesthetics.prototype.overallRange_vktour$ = function (aes) {\n var tmp$;\n var tmp$_0;\n if ((tmp$ = this.myOverallRangeByNumericAes_0.get_11rb$(aes)) != null)\n tmp$_0 = tmp$;\n else {\n throw IllegalStateException_init(('Overall range is unknown for ' + aes).toString());\n }\n return tmp$_0;\n };\n AestheticsBuilder$MyAesthetics.prototype.resolution_594811$ = function (aes, naValue) {\n var tmp$;\n if (!this.myResolutionByAes_0.containsKey_11rb$(aes)) {\n if (this.myConstantAes_0.contains_11rb$(aes))\n tmp$ = 0.0;\n else {\n var values = this.numericValues_vktour$(aes);\n tmp$ = data.SeriesUtil.resolution_u62iiw$(values, naValue);\n }\n var resolution = tmp$;\n this.myResolutionByAes_0.put_xwzc9p$(aes, resolution);\n }return ensureNotNull(this.myResolutionByAes_0.get_11rb$(aes));\n };\n function AestheticsBuilder$MyAesthetics$numericValues$ObjectLiteral(this$MyAesthetics, closure$aes) {\n this.this$MyAesthetics = this$MyAesthetics;\n this.closure$aes = closure$aes;\n }\n AestheticsBuilder$MyAesthetics$numericValues$ObjectLiteral.prototype.iterator = function () {\n return new AestheticsBuilder$AesIterator(this.this$MyAesthetics.myDataPointCount_0, this.this$MyAesthetics.aes_31786j$(this.closure$aes));\n };\n AestheticsBuilder$MyAesthetics$numericValues$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Iterable]\n };\n AestheticsBuilder$MyAesthetics.prototype.numericValues_vktour$ = function (aes) {\n if (!aes.isNumeric) {\n var message = 'Numeric aes is expected: ' + aes;\n throw IllegalArgumentException_init(message.toString());\n }return new AestheticsBuilder$MyAesthetics$numericValues$ObjectLiteral(this, aes);\n };\n function AestheticsBuilder$MyAesthetics$groups$ObjectLiteral(this$MyAesthetics) {\n this.this$MyAesthetics = this$MyAesthetics;\n }\n AestheticsBuilder$MyAesthetics$groups$ObjectLiteral.prototype.iterator = function () {\n return new AestheticsBuilder$AesIterator(this.this$MyAesthetics.myDataPointCount_0, this.this$MyAesthetics.group);\n };\n AestheticsBuilder$MyAesthetics$groups$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Iterable]\n };\n AestheticsBuilder$MyAesthetics.prototype.groups = function () {\n return new AestheticsBuilder$MyAesthetics$groups$ObjectLiteral(this);\n };\n AestheticsBuilder$MyAesthetics.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyAesthetics',\n interfaces: [Aesthetics]\n };\n function AestheticsBuilder$MyDataPointsIterator(myLength, myAesthetics) {\n this.myLength_0 = myLength;\n this.myAesthetics_0 = myAesthetics;\n this.myIndex_0 = 0;\n }\n AestheticsBuilder$MyDataPointsIterator.prototype.hasNext = function () {\n return this.myIndex_0 < this.myLength_0;\n };\n AestheticsBuilder$MyDataPointsIterator.prototype.next = function () {\n var tmp$;\n if (this.hasNext()) {\n return this.myAesthetics_0.dataPointAt_za3lpa$((tmp$ = this.myIndex_0, this.myIndex_0 = tmp$ + 1 | 0, tmp$));\n }throw new NoSuchElementException('index=' + this.myIndex_0);\n };\n AestheticsBuilder$MyDataPointsIterator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyDataPointsIterator',\n interfaces: [Iterator]\n };\n function AestheticsBuilder$AesIterator(myLength, myAes) {\n this.myLength_0 = myLength;\n this.myAes_0 = myAes;\n this.myIndex_0 = 0;\n }\n AestheticsBuilder$AesIterator.prototype.hasNext = function () {\n return this.myIndex_0 < this.myLength_0;\n };\n AestheticsBuilder$AesIterator.prototype.next = function () {\n var tmp$;\n if (this.hasNext()) {\n return this.myAes_0((tmp$ = this.myIndex_0, this.myIndex_0 = tmp$ + 1 | 0, tmp$));\n }throw new NoSuchElementException('index=' + this.myIndex_0);\n };\n AestheticsBuilder$AesIterator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AesIterator',\n interfaces: [Iterator]\n };\n function AestheticsBuilder$MyDataPointAesthetics(myIndex, myAesthetics) {\n this.myIndex_0 = myIndex;\n this.myAesthetics_0 = myAesthetics;\n }\n AestheticsBuilder$MyDataPointAesthetics.prototype.index = function () {\n return ensureNotNull(this.myIndex_0);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.x = function () {\n return this.get_31786j$(Aes$Companion_getInstance().X);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.y = function () {\n return this.get_31786j$(Aes$Companion_getInstance().Y);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.z = function () {\n return this.get_31786j$(Aes$Companion_getInstance().Z);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.ymin = function () {\n return this.get_31786j$(Aes$Companion_getInstance().YMIN);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.ymax = function () {\n return this.get_31786j$(Aes$Companion_getInstance().YMAX);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.color = function () {\n return this.get_31786j$(Aes$Companion_getInstance().COLOR);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.fill = function () {\n return this.get_31786j$(Aes$Companion_getInstance().FILL);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.alpha = function () {\n return this.get_31786j$(Aes$Companion_getInstance().ALPHA);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.shape = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SHAPE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.lineType = function () {\n return this.get_31786j$(Aes$Companion_getInstance().LINETYPE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.size = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SIZE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.width = function () {\n return this.get_31786j$(Aes$Companion_getInstance().WIDTH);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.height = function () {\n return this.get_31786j$(Aes$Companion_getInstance().HEIGHT);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.weight = function () {\n return this.get_31786j$(Aes$Companion_getInstance().WEIGHT);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.intercept = function () {\n return this.get_31786j$(Aes$Companion_getInstance().INTERCEPT);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.slope = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SLOPE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.interceptX = function () {\n return this.get_31786j$(Aes$Companion_getInstance().XINTERCEPT);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.interceptY = function () {\n return this.get_31786j$(Aes$Companion_getInstance().YINTERCEPT);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.lower = function () {\n return this.get_31786j$(Aes$Companion_getInstance().LOWER);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.middle = function () {\n return this.get_31786j$(Aes$Companion_getInstance().MIDDLE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.upper = function () {\n return this.get_31786j$(Aes$Companion_getInstance().UPPER);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.frame = function () {\n return this.get_31786j$(Aes$Companion_getInstance().FRAME);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.speed = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SPEED);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.flow = function () {\n return this.get_31786j$(Aes$Companion_getInstance().FLOW);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.xmin = function () {\n return this.get_31786j$(Aes$Companion_getInstance().XMIN);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.xmax = function () {\n return this.get_31786j$(Aes$Companion_getInstance().XMAX);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.xend = function () {\n return this.get_31786j$(Aes$Companion_getInstance().XEND);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.yend = function () {\n return this.get_31786j$(Aes$Companion_getInstance().YEND);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.label = function () {\n return this.get_31786j$(Aes$Companion_getInstance().LABEL);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.family = function () {\n return this.get_31786j$(Aes$Companion_getInstance().FAMILY);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.fontface = function () {\n return this.get_31786j$(Aes$Companion_getInstance().FONTFACE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.hjust = function () {\n return this.get_31786j$(Aes$Companion_getInstance().HJUST);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.vjust = function () {\n return this.get_31786j$(Aes$Companion_getInstance().VJUST);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.angle = function () {\n return this.get_31786j$(Aes$Companion_getInstance().ANGLE);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.symX = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SYM_X);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.symY = function () {\n return this.get_31786j$(Aes$Companion_getInstance().SYM_Y);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.group = function () {\n return this.myAesthetics_0.group(ensureNotNull(this.myIndex_0));\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.numeric_vktour$ = function (aes) {\n return this.get_31786j$(aes);\n };\n AestheticsBuilder$MyDataPointAesthetics.prototype.get_31786j$ = function (aes) {\n return this.myAesthetics_0.aes_31786j$(aes)(ensureNotNull(this.myIndex_0));\n };\n AestheticsBuilder$MyDataPointAesthetics.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyDataPointAesthetics',\n interfaces: [DataPointAesthetics]\n };\n function AestheticsBuilder$ArrayAes(myVal) {\n this.myVal_0 = myVal;\n }\n AestheticsBuilder$ArrayAes.prototype.apply_11rb$ = function (value) {\n return this.myVal_0[value];\n };\n AestheticsBuilder$ArrayAes.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ArrayAes',\n interfaces: [Function]\n };\n function AestheticsBuilder$MapperAes(myL, myF) {\n this.myL_0 = myL;\n this.myF_0 = myF;\n }\n AestheticsBuilder$MapperAes.prototype.apply_11rb$ = function (value) {\n return this.myF_0(this.myL_0.get_za3lpa$(value));\n };\n AestheticsBuilder$MapperAes.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MapperAes',\n interfaces: [Function]\n };\n function AestheticsBuilder$Companion() {\n AestheticsBuilder$Companion_instance = this;\n }\n function AestheticsBuilder$Companion$constant$lambda(closure$v) {\n return function (it) {\n return closure$v;\n };\n }\n AestheticsBuilder$Companion.prototype.constant_mh5how$ = function (v) {\n return AestheticsBuilder$Companion$constant$lambda(v);\n };\n function AestheticsBuilder$Companion$array$lambda(closure$v) {\n return function (value) {\n return closure$v[value];\n };\n }\n AestheticsBuilder$Companion.prototype.array_ro6dgy$ = function (v) {\n return AestheticsBuilder$Companion$array$lambda(v);\n };\n function AestheticsBuilder$Companion$collection$lambda(closure$v) {\n return function (value) {\n return collect.Iterables.get_7iig3d$(closure$v, value);\n };\n }\n AestheticsBuilder$Companion.prototype.collection_mqih57$ = function (v) {\n return AestheticsBuilder$Companion$collection$lambda(v);\n };\n function AestheticsBuilder$Companion$listMapper$lambda(closure$f, closure$v) {\n return function (value) {\n return closure$f(closure$v.get_za3lpa$(value));\n };\n }\n AestheticsBuilder$Companion.prototype.listMapper_sedzz5$ = function (v, f) {\n return AestheticsBuilder$Companion$listMapper$lambda(f, v);\n };\n AestheticsBuilder$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AestheticsBuilder$Companion_instance = null;\n function AestheticsBuilder$Companion_getInstance() {\n if (AestheticsBuilder$Companion_instance === null) {\n new AestheticsBuilder$Companion();\n }return AestheticsBuilder$Companion_instance;\n }\n AestheticsBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AestheticsBuilder',\n interfaces: []\n };\n function AestheticsDefaults() {\n AestheticsDefaults$Companion_getInstance();\n var $receiver = new TypedKeyHashMap();\n var tmp$, tmp$_0;\n tmp$ = Aes$Companion_getInstance().values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n $receiver.put_ev6mlr$(Kotlin.isType(tmp$_0 = aes, Aes) ? tmp$_0 : throwCCE(), AesInitValue_getInstance().get_31786j$(aes));\n }\n this.myDefaults_vq25h0$_0 = $receiver;\n this.myDefaultsInLegend_yhkzvq$_0 = new TypedKeyHashMap();\n }\n AestheticsDefaults.prototype.update_bbdhip$ = function (aes, defaultValue) {\n this.myDefaults_vq25h0$_0.put_ev6mlr$(aes, defaultValue);\n return this;\n };\n AestheticsDefaults.prototype.updateInLegend_bbdhip$ = function (aes, defaultValue) {\n this.myDefaultsInLegend_yhkzvq$_0.put_ev6mlr$(aes, defaultValue);\n return this;\n };\n AestheticsDefaults.prototype.rangeIncludesZero_896ixz$ = function (aes) {\n return false;\n };\n AestheticsDefaults.prototype.defaultValue_31786j$ = function (aes) {\n return this.myDefaults_vq25h0$_0.get_ex36zt$(aes);\n };\n AestheticsDefaults.prototype.defaultValueInLegend_31786j$ = function (aes) {\n var tmp$;\n if (this.myDefaultsInLegend_yhkzvq$_0.containsKey_ex36zt$(aes)) {\n tmp$ = this.myDefaultsInLegend_yhkzvq$_0.get_ex36zt$(aes);\n } else\n tmp$ = this.defaultValue_31786j$(aes);\n return tmp$;\n };\n function AestheticsDefaults$Companion() {\n AestheticsDefaults$Companion_instance = this;\n }\n AestheticsDefaults$Companion.prototype.point = function () {\n return this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 2.0).updateInLegend_bbdhip$(Aes$Companion_getInstance().SIZE, 5.0);\n };\n AestheticsDefaults$Companion.prototype.path = function () {\n return this.base_0();\n };\n AestheticsDefaults$Companion.prototype.line = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.abline = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.hline = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.vline = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.smooth = function () {\n return this.path().update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.MAGENTA).update_bbdhip$(Aes$Companion_getInstance().FILL, Color.Companion.BLACK);\n };\n function AestheticsDefaults$Companion$bar$ObjectLiteral() {\n AestheticsDefaults.call(this);\n }\n AestheticsDefaults$Companion$bar$ObjectLiteral.prototype.rangeIncludesZero_896ixz$ = function (aes) {\n return equals(aes, Aes$Companion_getInstance().Y) || AestheticsDefaults.prototype.rangeIncludesZero_896ixz$.call(this, aes);\n };\n AestheticsDefaults$Companion$bar$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AestheticsDefaults]\n };\n AestheticsDefaults$Companion.prototype.bar = function () {\n return (new AestheticsDefaults$Companion$bar$ObjectLiteral()).update_bbdhip$(Aes$Companion_getInstance().WIDTH, 0.9).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT);\n };\n function AestheticsDefaults$Companion$histogram$ObjectLiteral() {\n AestheticsDefaults.call(this);\n }\n AestheticsDefaults$Companion$histogram$ObjectLiteral.prototype.rangeIncludesZero_896ixz$ = function (aes) {\n return equals(aes, Aes$Companion_getInstance().Y) || AestheticsDefaults.prototype.rangeIncludesZero_896ixz$.call(this, aes);\n };\n AestheticsDefaults$Companion$histogram$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AestheticsDefaults]\n };\n AestheticsDefaults$Companion.prototype.histogram = function () {\n return (new AestheticsDefaults$Companion$histogram$ObjectLiteral()).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT);\n };\n AestheticsDefaults$Companion.prototype.tile = function () {\n return (new AestheticsDefaults()).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT);\n };\n AestheticsDefaults$Companion.prototype.bin2d = function () {\n return this.tile();\n };\n AestheticsDefaults$Companion.prototype.errorBar = function () {\n return (new AestheticsDefaults()).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.BLACK);\n };\n AestheticsDefaults$Companion.prototype.crossBar = function () {\n return (new AestheticsDefaults()).update_bbdhip$(Aes$Companion_getInstance().WIDTH, 0.9).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.BLACK).update_bbdhip$(Aes$Companion_getInstance().FILL, Color.Companion.WHITE);\n };\n AestheticsDefaults$Companion.prototype.lineRange = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.pointRange = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.polygon = function () {\n return this.base_0().update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT);\n };\n AestheticsDefaults$Companion.prototype.map = function () {\n return this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 0.2).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.GRAY).update_bbdhip$(Aes$Companion_getInstance().FILL, Color.Companion.TRANSPARENT);\n };\n AestheticsDefaults$Companion.prototype.boxplot = function () {\n return this.crossBar();\n };\n AestheticsDefaults$Companion.prototype.livemap_cx3y7u$ = function (displayMode) {\n var tmp$;\n switch (displayMode.name) {\n case 'POINT':\n tmp$ = this.point().updateInLegend_bbdhip$(Aes$Companion_getInstance().SIZE, 5.0);\n break;\n case 'BAR':\n tmp$ = this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 40.0).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT);\n break;\n case 'PIE':\n tmp$ = this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 20.0).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.TRANSPARENT).updateInLegend_bbdhip$(Aes$Companion_getInstance().SIZE, 5.0);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n AestheticsDefaults$Companion.prototype.ribbon = function () {\n return this.base_0();\n };\n function AestheticsDefaults$Companion$area$ObjectLiteral() {\n AestheticsDefaults.call(this);\n }\n AestheticsDefaults$Companion$area$ObjectLiteral.prototype.rangeIncludesZero_896ixz$ = function (aes) {\n return equals(aes, Aes$Companion_getInstance().Y) || AestheticsDefaults.prototype.rangeIncludesZero_896ixz$.call(this, aes);\n };\n AestheticsDefaults$Companion$area$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [AestheticsDefaults]\n };\n AestheticsDefaults$Companion.prototype.area = function () {\n return new AestheticsDefaults$Companion$area$ObjectLiteral();\n };\n AestheticsDefaults$Companion.prototype.density = function () {\n return this.area().update_bbdhip$(Aes$Companion_getInstance().FILL, Color.Companion.TRANSPARENT);\n };\n AestheticsDefaults$Companion.prototype.contour = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.contourf = function () {\n return this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 0.0);\n };\n AestheticsDefaults$Companion.prototype.density2d = function () {\n return this.contour();\n };\n AestheticsDefaults$Companion.prototype.density2df = function () {\n return this.contourf();\n };\n AestheticsDefaults$Companion.prototype.jitter = function () {\n return this.point();\n };\n AestheticsDefaults$Companion.prototype.freqpoly = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.step = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.rect = function () {\n return this.polygon();\n };\n AestheticsDefaults$Companion.prototype.segment = function () {\n return this.path();\n };\n AestheticsDefaults$Companion.prototype.text = function () {\n return this.base_0().update_bbdhip$(Aes$Companion_getInstance().SIZE, 7.0).update_bbdhip$(Aes$Companion_getInstance().COLOR, Color.Companion.parseHex_61zpoe$('#3d3d3d'));\n };\n AestheticsDefaults$Companion.prototype.raster = function () {\n return this.base_0();\n };\n AestheticsDefaults$Companion.prototype.image = function () {\n return this.base_0();\n };\n AestheticsDefaults$Companion.prototype.base_0 = function () {\n return new AestheticsDefaults();\n };\n AestheticsDefaults$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AestheticsDefaults$Companion_instance = null;\n function AestheticsDefaults$Companion_getInstance() {\n if (AestheticsDefaults$Companion_instance === null) {\n new AestheticsDefaults$Companion();\n }return AestheticsDefaults$Companion_instance;\n }\n AestheticsDefaults.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AestheticsDefaults',\n interfaces: []\n };\n function AestheticsUtil() {\n AestheticsUtil_instance = this;\n this.ALPHA_CONTROLS_BOTH_8be2vx$ = false;\n }\n AestheticsUtil.prototype.fill_edjgex$ = function (filled, solid, p) {\n if (filled) {\n return ensureNotNull(p.fill());\n } else if (solid) {\n return ensureNotNull(p.color());\n }return Color.Companion.TRANSPARENT;\n };\n AestheticsUtil.prototype.decorate_l4vgcq$ = function (shape, filled, solid, p, strokeWidth) {\n var fill = this.fill_edjgex$(filled, solid, p);\n var stroke = ensureNotNull(p.color());\n var fillAlpha = 0.0;\n if (filled || solid) {\n fillAlpha = this.alpha_il6rhx$(fill, p);\n }var strokeAlpha = 0.0;\n if (strokeWidth > 0) {\n strokeAlpha = this.alpha_il6rhx$(stroke, p);\n }shape.update_mjoany$(fill, fillAlpha, stroke, strokeAlpha, strokeWidth);\n };\n AestheticsUtil.prototype.alpha_il6rhx$ = function (color, p) {\n var tmp$;\n if (values.Colors.solid_98b62m$(color)) {\n tmp$ = ensureNotNull(p.alpha());\n } else\n tmp$ = svg.SvgUtils.alpha2opacity_za3lpa$(color.alpha);\n return tmp$;\n };\n AestheticsUtil.prototype.strokeWidth_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * 2.0;\n };\n AestheticsUtil.prototype.textSize_l6g9mh$ = function (p) {\n return ensureNotNull(p.size()) * 2;\n };\n AestheticsUtil.prototype.updateStroke_g0plfl$ = function (shape, p, applyAlpha) {\n shape.strokeColor().set_11rb$(p.color());\n if (values.Colors.solid_98b62m$(ensureNotNull(p.color())) && applyAlpha) {\n shape.strokeOpacity().set_11rb$(p.alpha());\n }};\n AestheticsUtil.prototype.updateFill_v4tjbc$ = function (shape, p) {\n shape.fillColor().set_11rb$(p.fill());\n if (values.Colors.solid_98b62m$(ensureNotNull(p.fill()))) {\n shape.fillOpacity().set_11rb$(p.alpha());\n }};\n AestheticsUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'AestheticsUtil',\n interfaces: []\n };\n var AestheticsUtil_instance = null;\n function AestheticsUtil_getInstance() {\n if (AestheticsUtil_instance === null) {\n new AestheticsUtil();\n }return AestheticsUtil_instance;\n }\n function TypedIndexFunctionMap(indexFunctionMap) {\n this.myMap_0 = indexFunctionMap;\n }\n TypedIndexFunctionMap.prototype.get_31786j$ = function (aes) {\n var tmp$;\n return typeof (tmp$ = this.myMap_0.get_11rb$(aes)) === 'function' ? tmp$ : throwCCE();\n };\n TypedIndexFunctionMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TypedIndexFunctionMap',\n interfaces: []\n };\n function Coords() {\n Coords_instance = this;\n }\n Coords.prototype.create_wd6eaa$ = function (xRange, yRange, xLim, yLim) {\n if (xLim === void 0)\n xLim = null;\n if (yLim === void 0)\n yLim = null;\n var origin = new DoubleVector(this.originX_0(xRange), this.originY_0(yRange));\n return this.create_e5yqp7$(origin, xLim, yLim);\n };\n Coords.prototype.create_e5yqp7$ = function (origin, xLim, yLim) {\n if (xLim === void 0)\n xLim = null;\n if (yLim === void 0)\n yLim = null;\n return new DefaultCoordinateSystem(this.toClientOffsetX_0(origin.x), this.toClientOffsetY_0(origin.y), this.fromClientOffsetX_0(origin.x), this.fromClientOffsetY_0(origin.y), xLim, yLim);\n };\n Coords.prototype.toClientOffsetX_4fzjta$ = function (xRange) {\n return this.toClientOffsetX_0(this.originX_0(xRange));\n };\n Coords.prototype.toClientOffsetY_4fzjta$ = function (yRange) {\n return this.toClientOffsetY_0(this.originY_0(yRange));\n };\n Coords.prototype.originX_0 = function (xRange) {\n return -xRange.lowerEnd;\n };\n Coords.prototype.originY_0 = function (yRange) {\n return yRange.upperEnd;\n };\n function Coords$toClientOffsetX$lambda(closure$originX) {\n return function (x) {\n return closure$originX + x;\n };\n }\n Coords.prototype.toClientOffsetX_0 = function (originX) {\n return Coords$toClientOffsetX$lambda(originX);\n };\n function Coords$fromClientOffsetX$lambda(closure$originX) {\n return function (x) {\n return x - closure$originX;\n };\n }\n Coords.prototype.fromClientOffsetX_0 = function (originX) {\n return Coords$fromClientOffsetX$lambda(originX);\n };\n function Coords$toClientOffsetY$lambda(closure$originY) {\n return function (y) {\n return closure$originY - y;\n };\n }\n Coords.prototype.toClientOffsetY_0 = function (originY) {\n return Coords$toClientOffsetY$lambda(originY);\n };\n function Coords$fromClientOffsetY$lambda(closure$originY) {\n return function (y) {\n return closure$originY - y;\n };\n }\n Coords.prototype.fromClientOffsetY_0 = function (originY) {\n return Coords$fromClientOffsetY$lambda(originY);\n };\n Coords.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Coords',\n interfaces: []\n };\n var Coords_instance = null;\n function Coords_getInstance() {\n if (Coords_instance === null) {\n new Coords();\n }return Coords_instance;\n }\n function DefaultCoordinateSystem(myToClientOffsetX, myToClientOffsetY, myFromClientOffsetX, myFromClientOffsetY, xLim, yLim) {\n this.myToClientOffsetX_0 = myToClientOffsetX;\n this.myToClientOffsetY_0 = myToClientOffsetY;\n this.myFromClientOffsetX_0 = myFromClientOffsetX;\n this.myFromClientOffsetY_0 = myFromClientOffsetY;\n this.xLim_0 = xLim;\n this.yLim_0 = yLim;\n }\n DefaultCoordinateSystem.prototype.toClient_gpjtzr$ = function (p) {\n return new DoubleVector(this.myToClientOffsetX_0(p.x), this.myToClientOffsetY_0(p.y));\n };\n DefaultCoordinateSystem.prototype.fromClient_gpjtzr$ = function (p) {\n return new DoubleVector(this.myFromClientOffsetX_0(p.x), this.myFromClientOffsetY_0(p.y));\n };\n DefaultCoordinateSystem.prototype.isPointInLimits_k2qmv6$$default = function (p, isClient) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var coord = isClient ? this.fromClient_gpjtzr$(p) : p;\n return ((tmp$_0 = (tmp$ = this.xLim_0) != null ? tmp$.contains_mef7kx$(coord.x) : null) != null ? tmp$_0 : true) && ((tmp$_2 = (tmp$_1 = this.yLim_0) != null ? tmp$_1.contains_mef7kx$(coord.y) : null) != null ? tmp$_2 : true);\n };\n DefaultCoordinateSystem.prototype.isRectInLimits_fd842m$$default = function (rect, isClient) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var r = isClient ? (new GeomCoord(this)).fromClient_wthzt5$(rect) : rect;\n return ((tmp$_0 = (tmp$ = this.xLim_0) != null ? tmp$.encloses_d226ot$(r.xRange()) : null) != null ? tmp$_0 : true) && ((tmp$_2 = (tmp$_1 = this.yLim_0) != null ? tmp$_1.encloses_d226ot$(r.yRange()) : null) != null ? tmp$_2 : true);\n };\n DefaultCoordinateSystem.prototype.isPathInLimits_f6t8kh$$default = function (path, isClient) {\n var any$result;\n any$break: do {\n var tmp$;\n if (Kotlin.isType(path, Collection) && path.isEmpty()) {\n any$result = false;\n break any$break;\n }tmp$ = path.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (this.isPointInLimits_k2qmv6$(element, isClient)) {\n any$result = true;\n break any$break;\n }}\n any$result = false;\n }\n while (false);\n return any$result;\n };\n DefaultCoordinateSystem.prototype.isPolygonInLimits_f6t8kh$$default = function (polygon, isClient) {\n var bbox = geometry.DoubleRectangles.boundingBox_qdtdbw$(polygon);\n return this.isRectInLimits_fd842m$(bbox, isClient);\n };\n Object.defineProperty(DefaultCoordinateSystem.prototype, 'xClientLimit', {\n configurable: true,\n get: function () {\n var tmp$;\n return (tmp$ = this.xLim_0) != null ? this.convertRange_0(tmp$, this.myToClientOffsetX_0) : null;\n }\n });\n Object.defineProperty(DefaultCoordinateSystem.prototype, 'yClientLimit', {\n configurable: true,\n get: function () {\n var tmp$;\n return (tmp$ = this.yLim_0) != null ? this.convertRange_0(tmp$, this.myToClientOffsetY_0) : null;\n }\n });\n DefaultCoordinateSystem.prototype.convertRange_0 = function (range, transform) {\n var l = transform(range.lowerEnd);\n var u = transform(range.upperEnd);\n return new ClosedRange(collect.Comparables.min_sdesaw$(l, u), collect.Comparables.max_sdesaw$(l, u));\n };\n DefaultCoordinateSystem.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DefaultCoordinateSystem',\n interfaces: [CoordinateSystem]\n };\n function Projection() {\n }\n Projection.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Projection',\n interfaces: []\n };\n function DataFrameUtil() {\n DataFrameUtil_instance = this;\n }\n DataFrameUtil.prototype.transformVarFor_896ixz$ = function (aes) {\n return TransformVar_getInstance().forAes_896ixz$(aes);\n };\n DataFrameUtil.prototype.applyTransform_xaiv89$ = function (data, var_0, aes, scale) {\n var transformVar = this.transformVarFor_896ixz$(aes);\n return this.applyTransform_0(data, var_0, transformVar, scale);\n };\n DataFrameUtil.prototype.applyTransform_0 = function (data, variable, transformVar, scale) {\n var transformed = scale.applyTransform_yzw12z$(data.get_8xm3sj$(variable), true);\n return data.builder().putNumeric_s1rqo9$(transformVar, transformed).build();\n };\n DataFrameUtil.prototype.hasVariable_vede35$ = function (data, varName) {\n var tmp$;\n tmp$ = data.variables().iterator();\n while (tmp$.hasNext()) {\n var var_0 = tmp$.next();\n if (equals(varName, var_0.name)) {\n return true;\n }}\n return false;\n };\n DataFrameUtil.prototype.findVariableOrFail_vede35$ = function (data, varName) {\n var tmp$;\n tmp$ = data.variables().iterator();\n while (tmp$.hasNext()) {\n var variable = tmp$.next();\n if (equals(varName, variable.name)) {\n return variable;\n }}\n var tmp$_0 = \"Variable not found: '\" + varName + \"'. Variables in data frame: \";\n var $receiver = data.variables();\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n destination.add_11rb$(\"'\" + item.name + \"'\");\n }\n throw IllegalArgumentException_init(tmp$_0 + destination);\n };\n DataFrameUtil.prototype.isNumeric_vede35$ = function (data, varName) {\n return data.isNumeric_8xm3sj$(this.findVariableOrFail_vede35$(data, varName));\n };\n function DataFrameUtil$sortedCopy$lambda(o1, o2) {\n return Kotlin.compareTo(o1.name, o2.name);\n }\n DataFrameUtil.prototype.sortedCopy_jgbhqw$ = function (variables) {\n var ordering = Ordering.Companion.from_iajr8b$(new Comparator(DataFrameUtil$sortedCopy$lambda));\n return ordering.sortedCopy_m5x2f4$(variables);\n };\n DataFrameUtil.prototype.variables_dhhkv7$ = function (df) {\n var $receiver = df.variables();\n var keySelector = getPropertyCallableRef('name', 1, function ($receiver) {\n return $receiver.name;\n });\n var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault($receiver, 10)), 16);\n var destination = LinkedHashMap_init_0(capacity);\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n destination.put_xwzc9p$(keySelector(element), element);\n }\n return destination;\n };\n function DataFrameUtil$appendReplace$put(this$DataFrameUtil) {\n return function ($receiver, destVars, df) {\n var this$DataFrameUtil_0 = this$DataFrameUtil;\n var tmp$;\n tmp$ = destVars.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n var srcVar = this$DataFrameUtil_0.findVariableOrFail_vede35$(df, element.name);\n tmp$_0 = df.isNumeric_8xm3sj$(srcVar);\n if (tmp$_0 === true)\n $receiver.putNumeric_s1rqo9$(element, df.getNumeric_8xm3sj$(srcVar));\n else if (tmp$_0 === false)\n $receiver.putDiscrete_2l962d$(element, df.get_8xm3sj$(srcVar));\n else\n Kotlin.noWhenBranchMatched();\n }\n return $receiver;\n };\n }\n DataFrameUtil.prototype.appendReplace_yxlle4$ = function (df0, df1) {\n var put = DataFrameUtil$appendReplace$put(this);\n var tmp$ = DataFrame$DataFrame$Builder_init();\n var $receiver = df0.variables();\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var $receiver_0 = this.variables_dhhkv7$(df1);\n var key = element.name;\n var tmp$_1;\n if (!(Kotlin.isType(tmp$_1 = $receiver_0, Map) ? tmp$_1 : throwCCE()).containsKey_11rb$(key))\n destination.add_11rb$(element);\n }\n var tmp$_2 = put(tmp$, destination, df0);\n var $receiver_1 = df0.variables();\n var destination_0 = ArrayList_init();\n var tmp$_3;\n tmp$_3 = $receiver_1.iterator();\n while (tmp$_3.hasNext()) {\n var element_0 = tmp$_3.next();\n var $receiver_2 = this.variables_dhhkv7$(df1);\n var key_0 = element_0.name;\n var tmp$_4;\n if ((Kotlin.isType(tmp$_4 = $receiver_2, Map) ? tmp$_4 : throwCCE()).containsKey_11rb$(key_0))\n destination_0.add_11rb$(element_0);\n }\n var tmp$_5 = put(tmp$_2, destination_0, df1);\n var $receiver_3 = df1.variables();\n var destination_1 = ArrayList_init();\n var tmp$_6;\n tmp$_6 = $receiver_3.iterator();\n while (tmp$_6.hasNext()) {\n var element_1 = tmp$_6.next();\n var $receiver_4 = this.variables_dhhkv7$(df0);\n var key_1 = element_1.name;\n var tmp$_7;\n if (!(Kotlin.isType(tmp$_7 = $receiver_4, Map) ? tmp$_7 : throwCCE()).containsKey_11rb$(key_1))\n destination_1.add_11rb$(element_1);\n }\n return put(tmp$_5, destination_1, df1).build();\n };\n DataFrameUtil.prototype.toMap_dhhkv7$ = function (df) {\n var tmp$;\n var result = HashMap_init();\n var variables = df.variables();\n tmp$ = variables.iterator();\n while (tmp$.hasNext()) {\n var var_0 = tmp$.next();\n var key = var_0.name;\n var value = df.get_8xm3sj$(var_0);\n result.put_xwzc9p$(key, value);\n }\n return result;\n };\n DataFrameUtil.prototype.fromMap_bkhwtg$ = function (map) {\n var tmp$;\n var frameBuilder = DataFrame$DataFrame$Builder_init();\n tmp$ = map.entries.iterator();\n while (tmp$.hasNext()) {\n var tmp$_0 = tmp$.next();\n var key = tmp$_0.key;\n var value = tmp$_0.value;\n if (!(typeof key === 'string')) {\n var message = 'Map to data-frame: key expected a String but was ' + Kotlin.getKClassFromExpression(ensureNotNull(key)).simpleName + ' : ' + toString(key);\n throw IllegalArgumentException_init(message.toString());\n }if (!Kotlin.isType(value, List)) {\n var message_0 = 'Map to data-frame: value expected a List but was ' + Kotlin.getKClassFromExpression(ensureNotNull(value)).simpleName + ' : ' + toString(value);\n throw IllegalArgumentException_init(message_0.toString());\n }frameBuilder.put_2l962d$(this.createVariable_puj7f4$(key), value);\n }\n return frameBuilder.build();\n };\n DataFrameUtil.prototype.createVariable_puj7f4$ = function (name, label) {\n if (label === void 0)\n label = name;\n var tmp$;\n if (TransformVar_getInstance().isTransformVar_61zpoe$(name))\n tmp$ = TransformVar_getInstance().get_61zpoe$(name);\n else if (Stats_getInstance().isStatVar_61zpoe$(name))\n tmp$ = Stats_getInstance().statVar_61zpoe$(name);\n else if (Dummies_getInstance().isDummyVar_61zpoe$(name))\n tmp$ = Dummies_getInstance().newDummy_61zpoe$(name);\n else\n tmp$ = new DataFrame$Variable(name, DataFrame$Variable$Source$ORIGIN_getInstance(), label);\n return tmp$;\n };\n DataFrameUtil.prototype.getSummaryText_dhhkv7$ = function (df) {\n var tmp$;\n var sb = StringBuilder_init();\n tmp$ = df.variables().iterator();\n while (tmp$.hasNext()) {\n var variable = tmp$.next();\n sb.append_pdl1vj$(variable.toSummaryString()).append_pdl1vj$(' numeric: ' + toString(df.isNumeric_8xm3sj$(variable))).append_pdl1vj$(' size: ' + toString(df.get_8xm3sj$(variable).size)).append_s8itvh$(10);\n }\n return sb.toString();\n };\n DataFrameUtil.prototype.removeAllExcept_dipqvu$ = function (df, keepNames) {\n var tmp$;\n var b = df.builder();\n tmp$ = df.variables().iterator();\n while (tmp$.hasNext()) {\n var variable = tmp$.next();\n if (!keepNames.contains_11rb$(variable.name)) {\n b.remove_8xm3sj$(variable);\n }}\n return b.build();\n };\n DataFrameUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DataFrameUtil',\n interfaces: []\n };\n var DataFrameUtil_instance = null;\n function DataFrameUtil_getInstance() {\n if (DataFrameUtil_instance === null) {\n new DataFrameUtil();\n }return DataFrameUtil_instance;\n }\n function Dummies() {\n Dummies_instance = this;\n this.PREFIX_0 = '__';\n }\n Dummies.prototype.isDummyVar_61zpoe$ = function (varName) {\n if (!base.Strings.isNullOrEmpty_pdl1vj$(varName) && varName.length > 2 && startsWith(varName, this.PREFIX_0)) {\n var numStr = varName.substring(2);\n return Regex_init('[0-9]+').matches_6bul2c$(numStr);\n }return false;\n };\n Dummies.prototype.dummyNames_za3lpa$ = function (count) {\n var l = ArrayList_init();\n for (var i = 0; i < count; i++) {\n l.add_11rb$(this.PREFIX_0 + toString(i));\n }\n return l;\n };\n Dummies.prototype.newDummy_61zpoe$ = function (varName) {\n if (!this.isDummyVar_61zpoe$(varName)) {\n var message = 'Not a dummy var name';\n throw IllegalArgumentException_init(message.toString());\n }return new DataFrame$Variable(varName, DataFrame$Variable$Source$ORIGIN_getInstance(), '');\n };\n Dummies.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Dummies',\n interfaces: []\n };\n var Dummies_instance = null;\n function Dummies_getInstance() {\n if (Dummies_instance === null) {\n new Dummies();\n }return Dummies_instance;\n }\n function TransformVar() {\n TransformVar_instance = this;\n this.X = new DataFrame$Variable('transform.X', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.Y = new DataFrame$Variable('transform.Y', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.Z = new DataFrame$Variable('transform.Z', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.YMIN = new DataFrame$Variable('transform.YMIN', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.YMAX = new DataFrame$Variable('transform.YMAX', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.COLOR = new DataFrame$Variable('transform.COLOR', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.FILL = new DataFrame$Variable('transform.FILL', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.ALPHA = new DataFrame$Variable('transform.ALPHA', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SHAPE = new DataFrame$Variable('transform.SHAPE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.LINETYPE = new DataFrame$Variable('transform.LINETYPE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SIZE = new DataFrame$Variable('transform.SIZE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.WIDTH = new DataFrame$Variable('transform.WIDTH', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.HEIGHT = new DataFrame$Variable('transform.HEIGHT', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.WEIGHT = new DataFrame$Variable('transform.WEIGHT', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.INTERCEPT = new DataFrame$Variable('transform.INTERCEPT', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SLOPE = new DataFrame$Variable('transform.SLOPE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.XINTERCEPT = new DataFrame$Variable('transform.XINTERCEPT', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.YINTERCEPT = new DataFrame$Variable('transform.YINTERCEPT', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.LOWER = new DataFrame$Variable('transform.LOWER', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.MIDDLE = new DataFrame$Variable('transform.MIDDLE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.UPPER = new DataFrame$Variable('transform.UPPER', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.FRAME = new DataFrame$Variable('transform.FRAME', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SPEED = new DataFrame$Variable('transform.SPEED', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.FLOW = new DataFrame$Variable('transform.FLOW', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.XMIN = new DataFrame$Variable('transform.XMIN', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.XMAX = new DataFrame$Variable('transform.XMAX', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.XEND = new DataFrame$Variable('transform.XEND', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.YEND = new DataFrame$Variable('transform.YEND', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.LABEL = new DataFrame$Variable('transform.LABEL', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.FONT_FAMILY = new DataFrame$Variable('transform.FONT_FAMILY', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.FONT_FACE = new DataFrame$Variable('transform.FONT_FACE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.HJUST = new DataFrame$Variable('transform.HJUST', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.VJUST = new DataFrame$Variable('transform.VJUST', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.ANGLE = new DataFrame$Variable('transform.ANGLE', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SYM_X = new DataFrame$Variable('transform.SYM_X', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.SYM_Y = new DataFrame$Variable('transform.SYM_Y', DataFrame$Variable$Source$TRANSFORM_getInstance());\n this.VAR_BY_AES_0 = new TransformVar$TransformVarByAes();\n this.VARS_0 = null;\n var tmp$;\n var varByName = HashMap_init();\n tmp$ = Aes$Companion_getInstance().values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n var var_0 = this.VAR_BY_AES_0.visit_896ixz$(aes);\n var key = var_0.name;\n varByName.put_xwzc9p$(key, var_0);\n }\n this.VARS_0 = varByName;\n }\n TransformVar.prototype.isTransformVar_61zpoe$ = function (varName) {\n return this.VARS_0.containsKey_11rb$(varName);\n };\n TransformVar.prototype.get_61zpoe$ = function (varName) {\n if (!this.VARS_0.containsKey_11rb$(varName)) {\n var message = 'Unknown transform variable ' + varName;\n throw IllegalStateException_init(message.toString());\n }return ensureNotNull(this.VARS_0.get_11rb$(varName));\n };\n TransformVar.prototype.forAes_896ixz$ = function (aes) {\n return this.VAR_BY_AES_0.visit_896ixz$(aes);\n };\n function TransformVar$TransformVarByAes() {\n AesVisitor.call(this);\n }\n TransformVar$TransformVarByAes.prototype.x = function () {\n return TransformVar_getInstance().X;\n };\n TransformVar$TransformVarByAes.prototype.y = function () {\n return TransformVar_getInstance().Y;\n };\n TransformVar$TransformVarByAes.prototype.z = function () {\n return TransformVar_getInstance().Z;\n };\n TransformVar$TransformVarByAes.prototype.ymin = function () {\n return TransformVar_getInstance().YMIN;\n };\n TransformVar$TransformVarByAes.prototype.ymax = function () {\n return TransformVar_getInstance().YMAX;\n };\n TransformVar$TransformVarByAes.prototype.color = function () {\n return TransformVar_getInstance().COLOR;\n };\n TransformVar$TransformVarByAes.prototype.fill = function () {\n return TransformVar_getInstance().FILL;\n };\n TransformVar$TransformVarByAes.prototype.alpha = function () {\n return TransformVar_getInstance().ALPHA;\n };\n TransformVar$TransformVarByAes.prototype.shape = function () {\n return TransformVar_getInstance().SHAPE;\n };\n TransformVar$TransformVarByAes.prototype.lineType = function () {\n return TransformVar_getInstance().LINETYPE;\n };\n TransformVar$TransformVarByAes.prototype.size = function () {\n return TransformVar_getInstance().SIZE;\n };\n TransformVar$TransformVarByAes.prototype.width = function () {\n return TransformVar_getInstance().WIDTH;\n };\n TransformVar$TransformVarByAes.prototype.height = function () {\n return TransformVar_getInstance().HEIGHT;\n };\n TransformVar$TransformVarByAes.prototype.weight = function () {\n return TransformVar_getInstance().WEIGHT;\n };\n TransformVar$TransformVarByAes.prototype.intercept = function () {\n return TransformVar_getInstance().INTERCEPT;\n };\n TransformVar$TransformVarByAes.prototype.slope = function () {\n return TransformVar_getInstance().SLOPE;\n };\n TransformVar$TransformVarByAes.prototype.interceptX = function () {\n return TransformVar_getInstance().XINTERCEPT;\n };\n TransformVar$TransformVarByAes.prototype.interceptY = function () {\n return TransformVar_getInstance().YINTERCEPT;\n };\n TransformVar$TransformVarByAes.prototype.lower = function () {\n return TransformVar_getInstance().LOWER;\n };\n TransformVar$TransformVarByAes.prototype.middle = function () {\n return TransformVar_getInstance().MIDDLE;\n };\n TransformVar$TransformVarByAes.prototype.upper = function () {\n return TransformVar_getInstance().UPPER;\n };\n TransformVar$TransformVarByAes.prototype.frame = function () {\n return TransformVar_getInstance().FRAME;\n };\n TransformVar$TransformVarByAes.prototype.speed = function () {\n return TransformVar_getInstance().SPEED;\n };\n TransformVar$TransformVarByAes.prototype.flow = function () {\n return TransformVar_getInstance().FLOW;\n };\n TransformVar$TransformVarByAes.prototype.xmin = function () {\n return TransformVar_getInstance().XMIN;\n };\n TransformVar$TransformVarByAes.prototype.xmax = function () {\n return TransformVar_getInstance().XMAX;\n };\n TransformVar$TransformVarByAes.prototype.xend = function () {\n return TransformVar_getInstance().XEND;\n };\n TransformVar$TransformVarByAes.prototype.yend = function () {\n return TransformVar_getInstance().YEND;\n };\n TransformVar$TransformVarByAes.prototype.label = function () {\n return TransformVar_getInstance().LABEL;\n };\n TransformVar$TransformVarByAes.prototype.family = function () {\n return TransformVar_getInstance().FONT_FAMILY;\n };\n TransformVar$TransformVarByAes.prototype.fontface = function () {\n return TransformVar_getInstance().FONT_FACE;\n };\n TransformVar$TransformVarByAes.prototype.hjust = function () {\n return TransformVar_getInstance().HJUST;\n };\n TransformVar$TransformVarByAes.prototype.vjust = function () {\n return TransformVar_getInstance().VJUST;\n };\n TransformVar$TransformVarByAes.prototype.angle = function () {\n return TransformVar_getInstance().ANGLE;\n };\n TransformVar$TransformVarByAes.prototype.symX = function () {\n return TransformVar_getInstance().SYM_X;\n };\n TransformVar$TransformVarByAes.prototype.symY = function () {\n return TransformVar_getInstance().SYM_Y;\n };\n TransformVar$TransformVarByAes.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TransformVarByAes',\n interfaces: [AesVisitor]\n };\n TransformVar.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'TransformVar',\n interfaces: []\n };\n var TransformVar_instance = null;\n function TransformVar_getInstance() {\n if (TransformVar_instance === null) {\n new TransformVar();\n }return TransformVar_instance;\n }\n function ABLineGeom() {\n ABLineGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(ABLineGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return HLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n ABLineGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$, tmp$_0;\n var helper = (new GeomHelper(pos, coord, ctx)).createSvgElementHelper();\n helper.setStrokeAlphaEnabled_6taknv$(true);\n var viewPort = GeomBase$Companion_getInstance().aesViewPort_m7huy5$(aesthetics);\n var boundaries = collect.Iterables.toList_yl67zr$(viewPort.parts);\n var lines = ArrayList_init();\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var intercept = p.intercept();\n var slope = p.slope();\n if (data.SeriesUtil.allFinite_jma9l8$(intercept, slope)) {\n var p1 = new DoubleVector(viewPort.left, ensureNotNull(intercept) + viewPort.left * ensureNotNull(slope));\n var p2 = new DoubleVector(viewPort.right, p1.y + viewPort.dimension.x * slope);\n var s = new DoubleSegment(p1, p2);\n var lineEnds = HashSet_init_0(2);\n tmp$_0 = boundaries.iterator();\n while (tmp$_0.hasNext()) {\n var boundary = tmp$_0.next();\n var intersection = boundary.intersection_69p9e5$(s);\n if (intersection != null) {\n lineEnds.add_11rb$(intersection);\n if (lineEnds.size === 2) {\n break;\n }}}\n if (lineEnds.size === 2) {\n var it = lineEnds.iterator();\n var line = helper.createLine_ollnar$(it.next(), it.next(), p);\n lines.add_11rb$(line);\n }}}\n var tmp$_1;\n tmp$_1 = lines.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n root.add_26jijc$(element);\n }\n };\n function ABLineGeom$Companion() {\n ABLineGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n ABLineGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ABLineGeom$Companion_instance = null;\n function ABLineGeom$Companion_getInstance() {\n if (ABLineGeom$Companion_instance === null) {\n new ABLineGeom$Companion();\n }return ABLineGeom$Companion_instance;\n }\n ABLineGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ABLineGeom',\n interfaces: [GeomBase]\n };\n function AreaGeom() {\n AreaGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n AreaGeom.prototype.dataPoints_m7huy5$ = function (aesthetics) {\n return GeomUtil_getInstance().ordered_X_83glv4$(aesthetics.dataPoints());\n };\n AreaGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var dataPoints = this.dataPoints_m7huy5$(aesthetics);\n var helper = new LinesHelper(pos, coord, ctx);\n var paths = helper.createBands_22uu1u$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_Y, GeomUtil_getInstance().TO_LOCATION_X_ZERO);\n reverse(paths);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(paths, root);\n helper.setAlphaEnabled_6taknv$(false);\n var lines = helper.createLines_rrreuh$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_Y);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(lines, root);\n this.buildHints_69ip36$_0(aesthetics, pos, coord, ctx);\n };\n function AreaGeom$buildHints$lambda(closure$geomHelper, this$AreaGeom) {\n return function (p) {\n return this$AreaGeom.toClient_6nkesc$_0(closure$geomHelper, p);\n };\n }\n AreaGeom.prototype.buildHints_69ip36$_0 = function (aesthetics, pos, coord, ctx) {\n var tmp$;\n var geomHelper = new GeomHelper(pos, coord, ctx);\n var $receiver = this.dataPoints_m7huy5$(aesthetics);\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var x = element.x();\n var y = element.y();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y) && coord.isPointInLimits_k2qmv6$(new DoubleVector(ensureNotNull(x), ensureNotNull(y)), false))\n destination.add_11rb$(element);\n }\n var dataPoints = destination;\n var multiPointDataList = MultiPointDataConstructor_getInstance().createMultiPointDataByGroup_ugj9hh$(dataPoints, MultiPointDataConstructor_getInstance().singlePointAppender_v9bvvf$(AreaGeom$buildHints$lambda(geomHelper, this)), MultiPointDataConstructor_getInstance().reducer_8555vt$(0.999, false));\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n tmp$ = multiPointDataList.iterator();\n while (tmp$.hasNext()) {\n var multiPointData = tmp$.next();\n targetCollector.addPath_sa5m83$(multiPointData.points, multiPointData.localToGlobalIndex, this.setupTooltipParams_l6g9mh$(multiPointData.aes));\n }\n };\n AreaGeom.prototype.setupTooltipParams_l6g9mh$ = function (aes) {\n return GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromFill_l6g9mh$(aes));\n };\n AreaGeom.prototype.toClient_6nkesc$_0 = function (geomHelper, p) {\n var tmp$;\n var coord = GeomUtil_getInstance().TO_LOCATION_X_Y(p);\n if (coord != null) {\n tmp$ = geomHelper.toClient_tkjljq$(coord, p);\n } else {\n tmp$ = null;\n }\n return tmp$;\n };\n function AreaGeom$Companion() {\n AreaGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n AreaGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AreaGeom$Companion_instance = null;\n function AreaGeom$Companion_getInstance() {\n if (AreaGeom$Companion_instance === null) {\n new AreaGeom$Companion();\n }return AreaGeom$Companion_instance;\n }\n AreaGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AreaGeom',\n interfaces: [GeomBase]\n };\n function BarGeom() {\n BarGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n function BarGeom$buildIntern$lambda(it) {\n return HintColorUtil_getInstance().fromFill_l6g9mh$(it);\n }\n BarGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var helper = new RectanglesHelper(aesthetics, pos, coord, ctx);\n var rectangles = helper.createRectangles_rezc4r$(BarGeom$Companion_getInstance().rectangleByDataPoint_0(ctx));\n reverse(rectangles);\n var tmp$;\n tmp$ = rectangles.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n root.add_26jijc$(element);\n }\n BarTooltipHelper_getInstance().collectRectangleTargets_mj9gdb$(emptyList(), aesthetics, pos, coord, ctx, BarGeom$Companion_getInstance().rectangleByDataPoint_0(ctx), BarGeom$buildIntern$lambda);\n };\n function BarGeom$Companion() {\n BarGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n function BarGeom$Companion$rectangleByDataPoint$lambda(closure$ctx) {\n return function (p) {\n var x = p.x();\n var y = p.y();\n var w = p.width();\n return !data.SeriesUtil.allFinite_xjrefz$(x, y, w) ? null : GeomUtil_getInstance().rectangleByDataPoint_dyn5n6$(p, closure$ctx);\n };\n }\n BarGeom$Companion.prototype.rectangleByDataPoint_0 = function (ctx) {\n return BarGeom$Companion$rectangleByDataPoint$lambda(ctx);\n };\n BarGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BarGeom$Companion_instance = null;\n function BarGeom$Companion_getInstance() {\n if (BarGeom$Companion_instance === null) {\n new BarGeom$Companion();\n }return BarGeom$Companion_instance;\n }\n BarGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BarGeom',\n interfaces: [GeomBase]\n };\n function Bin2dGeom() {\n Bin2dGeom$Companion_getInstance();\n TileGeom.call(this);\n }\n function Bin2dGeom$Companion() {\n Bin2dGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n Bin2dGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Bin2dGeom$Companion_instance = null;\n function Bin2dGeom$Companion_getInstance() {\n if (Bin2dGeom$Companion_instance === null) {\n new Bin2dGeom$Companion();\n }return Bin2dGeom$Companion_instance;\n }\n Bin2dGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Bin2dGeom',\n interfaces: [TileGeom]\n };\n function BoxplotGeom() {\n BoxplotGeom$Companion_getInstance();\n GeomBase.call(this);\n this.fattenMidline = 1.0;\n this.outlierColor = null;\n this.outlierFill = null;\n this.outlierShape = null;\n this.outlierSize = null;\n }\n Object.defineProperty(BoxplotGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return BoxplotGeom$Companion_getInstance().LEGEND_FACTORY_0;\n }\n });\n function BoxplotGeom$buildIntern$lambda(it) {\n return HintColorUtil_getInstance().fromColor_l6g9mh$(it);\n }\n BoxplotGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n CrossBarHelper_getInstance().buildBoxes_sm51l0$(root, aesthetics, pos, coord, ctx, BoxplotGeom$Companion_getInstance().rectangleByDataPoint_0(ctx));\n this.buildLines_0(root, aesthetics, pos, coord, ctx);\n this.buildOutliers_0(root, aesthetics, pos, coord, ctx);\n BarTooltipHelper_getInstance().collectRectangleTargets_mj9gdb$(listOf([Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().UPPER, Aes$Companion_getInstance().MIDDLE, Aes$Companion_getInstance().LOWER, Aes$Companion_getInstance().YMIN]), aesthetics, pos, coord, ctx, BoxplotGeom$Companion_getInstance().rectangleByDataPoint_0(ctx), BoxplotGeom$buildIntern$lambda);\n };\n BoxplotGeom.prototype.buildLines_0 = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n CrossBarHelper_getInstance().buildMidlines_z5ejb9$(root, aesthetics, pos, coord, ctx, this.fattenMidline);\n var helper = new GeomHelper(pos, coord, ctx);\n var elementHelper = helper.createSvgElementHelper();\n tmp$ = GeomUtil_getInstance().withDefined_2oeq97$(aesthetics.dataPoints(), Aes$Companion_getInstance().X).iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = ensureNotNull(p.x());\n var lines = ArrayList_init();\n if (p.defined_896ixz$(Aes$Companion_getInstance().LOWER) && p.defined_896ixz$(Aes$Companion_getInstance().YMIN)) {\n var hinge = ensureNotNull(p.lower());\n var fence = ensureNotNull(p.ymin());\n lines.add_11rb$(elementHelper.createLine_ollnar$(new DoubleVector(x, hinge), new DoubleVector(x, fence), p));\n }if (p.defined_896ixz$(Aes$Companion_getInstance().UPPER) && p.defined_896ixz$(Aes$Companion_getInstance().YMAX)) {\n var hinge_0 = ensureNotNull(p.upper());\n var fence_0 = ensureNotNull(p.ymax());\n lines.add_11rb$(elementHelper.createLine_ollnar$(new DoubleVector(x, hinge_0), new DoubleVector(x, fence_0), p));\n var tmp$_0;\n tmp$_0 = lines.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n root.add_26jijc$(element);\n }\n }}\n };\n BoxplotGeom.prototype.buildOutliers_0 = function (root, aesthetics, pos, coord, ctx) {\n var outlierAesthetics = this.getOutliersAesthetics_0(aesthetics);\n (new PointGeom()).buildIntern_uzv8ab$(root, outlierAesthetics, pos, coord, ctx.withTargetCollector_xrq6q$(new NullGeomTargetCollector()));\n };\n function BoxplotGeom$getOutliersAesthetics$lambda(this$BoxplotGeom) {\n return function (p) {\n return this$BoxplotGeom.toOutlierDataPointAesthetics_0(p);\n };\n }\n BoxplotGeom.prototype.getOutliersAesthetics_0 = function (aesthetics) {\n return new MappedAesthetics(aesthetics, BoxplotGeom$getOutliersAesthetics$lambda(this));\n };\n function BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral(this$BoxplotGeom, p) {\n this.this$BoxplotGeom = this$BoxplotGeom;\n DataPointAestheticsDelegate.call(this, p);\n }\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.get_31786j$ = function (aes) {\n return this.getIntern_0(aes);\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.color = function () {\n return this.getIntern_0(Aes$Companion_getInstance().COLOR);\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.fill = function () {\n return this.getIntern_0(Aes$Companion_getInstance().FILL);\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.shape = function () {\n return this.getIntern_0(Aes$Companion_getInstance().SHAPE);\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.size = function () {\n return this.getIntern_0(Aes$Companion_getInstance().SIZE);\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.prototype.getIntern_0 = function (aes) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n if (equals(aes, Aes$Companion_getInstance().COLOR))\n tmp$_3 = (tmp$ = this.this$BoxplotGeom.outlierColor) != null ? tmp$ : DataPointAestheticsDelegate.prototype.color.call(this);\n else if (equals(aes, Aes$Companion_getInstance().FILL))\n tmp$_3 = (tmp$_0 = this.this$BoxplotGeom.outlierFill) != null ? tmp$_0 : DataPointAestheticsDelegate.prototype.fill.call(this);\n else if (equals(aes, Aes$Companion_getInstance().SHAPE))\n tmp$_3 = (tmp$_1 = this.this$BoxplotGeom.outlierShape) != null ? tmp$_1 : DataPointAestheticsDelegate.prototype.shape.call(this);\n else if (equals(aes, Aes$Companion_getInstance().SIZE))\n tmp$_3 = (tmp$_2 = this.this$BoxplotGeom.outlierSize) != null ? tmp$_2 : BoxplotGeom$Companion_getInstance().OUTLIER_DEF_SIZE_0;\n else\n tmp$_3 = DataPointAestheticsDelegate.prototype.get_31786j$.call(this, aes);\n var value = tmp$_3;\n return (tmp$_4 = value) == null || Kotlin.isType(tmp$_4, Any) ? tmp$_4 : throwCCE();\n };\n BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DataPointAestheticsDelegate]\n };\n BoxplotGeom.prototype.toOutlierDataPointAesthetics_0 = function (p) {\n if (!p.defined_896ixz$(Aes$Companion_getInstance().Y)) {\n return p;\n }return new BoxplotGeom$toOutlierDataPointAesthetics$ObjectLiteral(this, p);\n };\n function BoxplotGeom$Companion() {\n BoxplotGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n this.LEGEND_FACTORY_0 = CrossBarHelper_getInstance().legendFactory_6taknv$(true);\n this.OUTLIER_DEF_SIZE_0 = AestheticsDefaults$Companion_getInstance().point().defaultValue_31786j$(Aes$Companion_getInstance().SIZE);\n }\n function BoxplotGeom$Companion$rectangleByDataPoint$lambda(closure$ctx) {\n return function (p) {\n if (p.defined_896ixz$(Aes$Companion_getInstance().X) && p.defined_896ixz$(Aes$Companion_getInstance().LOWER) && p.defined_896ixz$(Aes$Companion_getInstance().UPPER) && p.defined_896ixz$(Aes$Companion_getInstance().WIDTH)) {\n var x = ensureNotNull(p.x());\n var lower = ensureNotNull(p.lower());\n var upper = ensureNotNull(p.upper());\n var width = GeomUtil_getInstance().widthPx_c6teas$(p, closure$ctx, 2.0);\n var origin = new DoubleVector(x - width / 2, lower);\n var dimensions = new DoubleVector(width, upper - lower);\n return new DoubleRectangle(origin, dimensions);\n } else {\n return null;\n }\n };\n }\n BoxplotGeom$Companion.prototype.rectangleByDataPoint_0 = function (ctx) {\n return BoxplotGeom$Companion$rectangleByDataPoint$lambda(ctx);\n };\n BoxplotGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BoxplotGeom$Companion_instance = null;\n function BoxplotGeom$Companion_getInstance() {\n if (BoxplotGeom$Companion_instance === null) {\n new BoxplotGeom$Companion();\n }return BoxplotGeom$Companion_instance;\n }\n BoxplotGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BoxplotGeom',\n interfaces: [GeomBase]\n };\n function ContourGeom() {\n ContourGeom$Companion_getInstance();\n PathGeom.call(this);\n }\n function ContourGeom$Companion() {\n ContourGeom$Companion_instance = this;\n this.HANDLES_GROUPS = PathGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n ContourGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContourGeom$Companion_instance = null;\n function ContourGeom$Companion_getInstance() {\n if (ContourGeom$Companion_instance === null) {\n new ContourGeom$Companion();\n }return ContourGeom$Companion_instance;\n }\n ContourGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContourGeom',\n interfaces: [PathGeom]\n };\n function ContourfGeom() {\n ContourfGeom$Companion_getInstance();\n PolygonGeom.call(this);\n }\n function ContourfGeom$Companion() {\n ContourfGeom$Companion_instance = this;\n this.HANDLES_GROUPS = PolygonGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n ContourfGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContourfGeom$Companion_instance = null;\n function ContourfGeom$Companion_getInstance() {\n if (ContourfGeom$Companion_instance === null) {\n new ContourfGeom$Companion();\n }return ContourfGeom$Companion_instance;\n }\n ContourfGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContourfGeom',\n interfaces: [PolygonGeom]\n };\n function CrossBarGeom() {\n CrossBarGeom$Companion_getInstance();\n GeomBase.call(this);\n this.fattenMidline = 2.5;\n }\n Object.defineProperty(CrossBarGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return CrossBarGeom$Companion_getInstance().LEGEND_FACTORY_0;\n }\n });\n function CrossBarGeom$buildIntern$lambda(it) {\n return HintColorUtil_getInstance().fromColor_l6g9mh$(it);\n }\n CrossBarGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n CrossBarHelper_getInstance().buildBoxes_sm51l0$(root, aesthetics, pos, coord, ctx, CrossBarGeom$Companion_getInstance().rectangleByDataPoint_0(ctx, false));\n CrossBarHelper_getInstance().buildMidlines_z5ejb9$(root, aesthetics, pos, coord, ctx, this.fattenMidline);\n BarTooltipHelper_getInstance().collectRectangleTargets_mj9gdb$(listOf([Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().YMIN]), aesthetics, pos, coord, ctx, CrossBarGeom$Companion_getInstance().rectangleByDataPoint_0(ctx, true), CrossBarGeom$buildIntern$lambda);\n };\n function CrossBarGeom$Companion() {\n CrossBarGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n this.LEGEND_FACTORY_0 = CrossBarHelper_getInstance().legendFactory_6taknv$(false);\n }\n function CrossBarGeom$Companion$rectangleByDataPoint$lambda(closure$isHintRect, closure$ctx) {\n return function (p) {\n if (!closure$isHintRect && p.defined_896ixz$(Aes$Companion_getInstance().X) && p.defined_896ixz$(Aes$Companion_getInstance().YMIN) && p.defined_896ixz$(Aes$Companion_getInstance().YMAX) && p.defined_896ixz$(Aes$Companion_getInstance().WIDTH)) {\n var x = ensureNotNull(p.x());\n var ymin = ensureNotNull(p.ymin());\n var ymax = ensureNotNull(p.ymax());\n var width = GeomUtil_getInstance().widthPx_c6teas$(p, closure$ctx, 2.0);\n var origin = new DoubleVector(x - width / 2, ymin);\n var dimensions = new DoubleVector(width, ymax - ymin);\n return new DoubleRectangle(origin, dimensions);\n } else if (closure$isHintRect && p.defined_896ixz$(Aes$Companion_getInstance().X) && p.defined_896ixz$(Aes$Companion_getInstance().MIDDLE)) {\n var x_0 = ensureNotNull(p.x());\n var middle = ensureNotNull(p.middle());\n var width_0 = GeomUtil_getInstance().widthPx_c6teas$(p, closure$ctx, 2.0);\n var origin_0 = new DoubleVector(x_0 - width_0 / 2, middle);\n var dimensions_0 = new DoubleVector(width_0, 0.0);\n return new DoubleRectangle(origin_0, dimensions_0);\n } else {\n return null;\n }\n };\n }\n CrossBarGeom$Companion.prototype.rectangleByDataPoint_0 = function (ctx, isHintRect) {\n return CrossBarGeom$Companion$rectangleByDataPoint$lambda(isHintRect, ctx);\n };\n CrossBarGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var CrossBarGeom$Companion_instance = null;\n function CrossBarGeom$Companion_getInstance() {\n if (CrossBarGeom$Companion_instance === null) {\n new CrossBarGeom$Companion();\n }return CrossBarGeom$Companion_instance;\n }\n CrossBarGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CrossBarGeom',\n interfaces: [GeomBase]\n };\n function Density2dGeom() {\n Density2dGeom$Companion_getInstance();\n ContourGeom.call(this);\n }\n function Density2dGeom$Companion() {\n Density2dGeom$Companion_instance = this;\n this.HANDLES_GROUPS = ContourGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n Density2dGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Density2dGeom$Companion_instance = null;\n function Density2dGeom$Companion_getInstance() {\n if (Density2dGeom$Companion_instance === null) {\n new Density2dGeom$Companion();\n }return Density2dGeom$Companion_instance;\n }\n Density2dGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Density2dGeom',\n interfaces: [ContourGeom]\n };\n function Density2dfGeom() {\n Density2dfGeom$Companion_getInstance();\n ContourfGeom.call(this);\n }\n function Density2dfGeom$Companion() {\n Density2dfGeom$Companion_instance = this;\n this.HANDLES_GROUPS = ContourfGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n Density2dfGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Density2dfGeom$Companion_instance = null;\n function Density2dfGeom$Companion_getInstance() {\n if (Density2dfGeom$Companion_instance === null) {\n new Density2dfGeom$Companion();\n }return Density2dfGeom$Companion_instance;\n }\n Density2dfGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Density2dfGeom',\n interfaces: [ContourfGeom]\n };\n function DensityGeom() {\n DensityGeom$Companion_getInstance();\n AreaGeom.call(this);\n }\n DensityGeom.prototype.setupTooltipParams_l6g9mh$ = function (aes) {\n return GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(aes));\n };\n function DensityGeom$Companion() {\n DensityGeom$Companion_instance = this;\n this.HANDLES_GROUPS = AreaGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n DensityGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DensityGeom$Companion_instance = null;\n function DensityGeom$Companion_getInstance() {\n if (DensityGeom$Companion_instance === null) {\n new DensityGeom$Companion();\n }return DensityGeom$Companion_instance;\n }\n DensityGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DensityGeom',\n interfaces: [AreaGeom]\n };\n function ErrorBarGeom() {\n ErrorBarGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(ErrorBarGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new ErrorBarGeom$MyLegendKeyElementFactory();\n }\n });\n ErrorBarGeom.prototype.dataPoints_0 = function (aesthetics) {\n return GeomUtil_getInstance().with_X_83glv4$(aesthetics.dataPoints());\n };\n ErrorBarGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var helper = new LinesHelper(pos, coord, ctx);\n var dataPoints = this.dataPoints_0(aesthetics);\n var geomHelper = new GeomHelper(pos, coord, ctx);\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = p.x();\n var ymin = p.ymin();\n var ymax = p.ymax();\n if (!data.SeriesUtil.allFinite_xjrefz$(x, ymin, ymax)) {\n continue;\n }var width = ensureNotNull(p.width());\n width *= ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n var height = ensureNotNull(ymax) - ensureNotNull(ymin);\n var r = DoubleRectangle_init(ensureNotNull(x) - width / 2, ymin, width, height);\n var g = ErrorBarGeom$Companion_getInstance().errorBarShape_0(helper.toClient_ioi29i$(r, p), p);\n root.add_26jijc$(g);\n this.buildHints_0(DoubleRectangle_init(r.left, r.center.y, r.width, 0.0), p, ctx, geomHelper);\n }\n };\n ErrorBarGeom.prototype.buildHints_0 = function (rect, p, ctx, geomHelper) {\n var clientRect = geomHelper.toClient_ioi29i$(rect, p);\n var hint = (new HintsCollection$HintConfigFactory()).defaultObjectRadius_14dthe$(clientRect.width / 2.0).defaultX_14dthe$(ensureNotNull(p.x())).defaultKind_nnfttk$(TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance());\n var hints = (new HintsCollection(p, geomHelper)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMAX)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMIN)).hints;\n ctx.targetCollector.addRectangle_bxzvr8$(p.index(), clientRect, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setTipLayoutHints_vgcgsc$(hints).setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(p)));\n };\n function ErrorBarGeom$MyLegendKeyElementFactory() {\n }\n ErrorBarGeom$MyLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var width = ensureNotNull(p.width()) * (size.x - strokeWidth);\n var height = size.y - strokeWidth;\n var x = (size.x - width) / 2;\n var y = strokeWidth / 2;\n return ErrorBarGeom$Companion_getInstance().errorBarShape_0(DoubleRectangle_init(x, y, width, height), p);\n };\n ErrorBarGeom$MyLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function ErrorBarGeom$Companion() {\n ErrorBarGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n ErrorBarGeom$Companion.prototype.errorBarShape_0 = function (r, p) {\n var tmp$;\n var left = r.left;\n var top = r.top;\n var right = r.right;\n var bottom = r.bottom;\n var center = left + r.width / 2;\n var shapeLines = ArrayList_init();\n shapeLines.add_11rb$(SvgLineElement_init(left, top, right, top));\n shapeLines.add_11rb$(SvgLineElement_init(left, bottom, right, bottom));\n shapeLines.add_11rb$(SvgLineElement_init(center, top, center, bottom));\n var g = new SvgGElement();\n tmp$ = shapeLines.iterator();\n while (tmp$.hasNext()) {\n var shapeLine = tmp$.next();\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(shapeLine, p);\n g.children().add_11rb$(shapeLine);\n }\n return g;\n };\n ErrorBarGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ErrorBarGeom$Companion_instance = null;\n function ErrorBarGeom$Companion_getInstance() {\n if (ErrorBarGeom$Companion_instance === null) {\n new ErrorBarGeom$Companion();\n }return ErrorBarGeom$Companion_instance;\n }\n ErrorBarGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ErrorBarGeom',\n interfaces: [GeomBase]\n };\n function FilledCircleLegendKeyElementFactory() {\n FilledCircleLegendKeyElementFactory$Companion_getInstance();\n }\n FilledCircleLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var location = new DoubleVector(size.x / 2, size.y / 2);\n var slimObject = PointShapeSvg_getInstance().create_d8smhz$(FilledCircleLegendKeyElementFactory$Companion_getInstance().SHAPE_0, location, p);\n var slimGroup = slim.SvgSlimElements.g_za3lpa$(1);\n slimObject.appendTo_i2myw1$(slimGroup);\n return GeomBase$Companion_getInstance().wrap_i2myw1$(slimGroup);\n };\n FilledCircleLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var shapeSize = FilledCircleLegendKeyElementFactory$Companion_getInstance().SHAPE_0.size_l6g9mh$(p);\n var strokeWidth = FilledCircleLegendKeyElementFactory$Companion_getInstance().SHAPE_0.strokeWidth_l6g9mh$(p);\n var size = shapeSize + strokeWidth + 2.0;\n return new DoubleVector(size, size);\n };\n function FilledCircleLegendKeyElementFactory$Companion() {\n FilledCircleLegendKeyElementFactory$Companion_instance = this;\n this.SHAPE_0 = NamedShape$FILLED_CIRCLE_getInstance();\n }\n FilledCircleLegendKeyElementFactory$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var FilledCircleLegendKeyElementFactory$Companion_instance = null;\n function FilledCircleLegendKeyElementFactory$Companion_getInstance() {\n if (FilledCircleLegendKeyElementFactory$Companion_instance === null) {\n new FilledCircleLegendKeyElementFactory$Companion();\n }return FilledCircleLegendKeyElementFactory$Companion_instance;\n }\n FilledCircleLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FilledCircleLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function FilledSquareLegendKeyElementFactory() {\n }\n FilledSquareLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var rect = SvgRectElement_init(0.0, 0.0, size.x, size.y);\n AestheticsUtil_getInstance().updateFill_v4tjbc$(rect, p);\n var g = new SvgGElement();\n g.children().add_11rb$(rect);\n return g;\n };\n FilledSquareLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FilledSquareLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function FreqpolyGeom() {\n FreqpolyGeom$Companion_getInstance();\n LineGeom.call(this);\n }\n function FreqpolyGeom$Companion() {\n FreqpolyGeom$Companion_instance = this;\n this.HANDLES_GROUPS = LineGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n FreqpolyGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var FreqpolyGeom$Companion_instance = null;\n function FreqpolyGeom$Companion_getInstance() {\n if (FreqpolyGeom$Companion_instance === null) {\n new FreqpolyGeom$Companion();\n }return FreqpolyGeom$Companion_instance;\n }\n FreqpolyGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FreqpolyGeom',\n interfaces: [LineGeom]\n };\n function GeomBase() {\n GeomBase$Companion_getInstance();\n }\n Object.defineProperty(GeomBase.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new GenericLegendKeyElementFactory();\n }\n });\n GeomBase.prototype.build_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n this.buildIntern_uzv8ab$(root, aesthetics, pos, coord, ctx);\n };\n GeomBase.prototype.getGeomTargetCollector_vl74i5$ = function (ctx) {\n return ctx.targetCollector;\n };\n function GeomBase$Companion() {\n GeomBase$Companion_instance = this;\n }\n GeomBase$Companion.prototype.wrap_i2myw1$ = function (slimGroup) {\n var g = new SvgGElement();\n g.isPrebuiltSubtree = true;\n g.children().add_11rb$(slimGroup.asDummySvgNode());\n return g;\n };\n GeomBase$Companion.prototype.wrap_4fnnkz$ = function (o) {\n var slimGroup = slim.SvgSlimElements.g_za3lpa$(1);\n o.appendTo_i2myw1$(slimGroup);\n return this.wrap_i2myw1$(slimGroup);\n };\n GeomBase$Companion.prototype.aesViewPort_m7huy5$ = function (aesthetics) {\n return this.rect_0(aesthetics.overallRange_vktour$(Aes$Companion_getInstance().X), aesthetics.overallRange_vktour$(Aes$Companion_getInstance().Y));\n };\n GeomBase$Companion.prototype.aesBoundingBox_m7huy5$ = function (aesthetics) {\n return this.rect_0(ensureNotNull(aesthetics.range_vktour$(Aes$Companion_getInstance().X)), ensureNotNull(aesthetics.range_vktour$(Aes$Companion_getInstance().Y)));\n };\n GeomBase$Companion.prototype.rect_0 = function (rangeX, rangeY) {\n return DoubleRectangle_init(rangeX.lowerEnd, rangeY.lowerEnd, data.SeriesUtil.span_4fzjta$(rangeX), data.SeriesUtil.span_4fzjta$(rangeY));\n };\n GeomBase$Companion.prototype.appendNodes_37zgbi$ = function (paths, root) {\n var tmp$;\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var path = tmp$.next();\n root.add_26jijc$(path.rootGroup);\n }\n };\n GeomBase$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomBase$Companion_instance = null;\n function GeomBase$Companion_getInstance() {\n if (GeomBase$Companion_instance === null) {\n new GeomBase$Companion();\n }return GeomBase$Companion_instance;\n }\n GeomBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomBase',\n interfaces: [Geom]\n };\n function HLineGeom() {\n HLineGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(HLineGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return HLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n HLineGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var geomHelper = new GeomHelper(pos, coord, ctx);\n var helper = geomHelper.createSvgElementHelper();\n helper.setStrokeAlphaEnabled_6taknv$(true);\n var viewPort = GeomBase$Companion_getInstance().aesViewPort_m7huy5$(aesthetics);\n var lines = ArrayList_init();\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var intercept = p.interceptY();\n if (data.SeriesUtil.isFinite_yrwdxb$(intercept)) {\n if (viewPort.yRange().contains_mef7kx$(ensureNotNull(intercept))) {\n var start = new DoubleVector(viewPort.left, intercept);\n var end = new DoubleVector(viewPort.right, intercept);\n var line = helper.createLine_ollnar$(start, end, p);\n lines.add_11rb$(line);\n var h = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var origin = new DoubleVector(start.x, intercept - h / 2 - 2.0);\n var dimensions = new DoubleVector(viewPort.dimension.x, h + 4.0);\n var rect = new DoubleRectangle(origin, dimensions);\n ctx.targetCollector.addRectangle_bxzvr8$(p.index(), geomHelper.toClient_ioi29i$(rect, p), GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(p)), TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance());\n }}}\n var tmp$_0;\n tmp$_0 = lines.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n root.add_26jijc$(element);\n }\n };\n function HLineGeom$Companion() {\n HLineGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n this.LEGEND_KEY_ELEMENT_FACTORY = new HLineLegendKeyElementFactory();\n }\n HLineGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HLineGeom$Companion_instance = null;\n function HLineGeom$Companion_getInstance() {\n if (HLineGeom$Companion_instance === null) {\n new HLineGeom$Companion();\n }return HLineGeom$Companion_instance;\n }\n HLineGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HLineGeom',\n interfaces: [GeomBase]\n };\n function HistogramGeom() {\n HistogramGeom$Companion_getInstance();\n BarGeom.call(this);\n }\n function HistogramGeom$Companion() {\n HistogramGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n HistogramGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HistogramGeom$Companion_instance = null;\n function HistogramGeom$Companion_getInstance() {\n if (HistogramGeom$Companion_instance === null) {\n new HistogramGeom$Companion();\n }return HistogramGeom$Companion_instance;\n }\n HistogramGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HistogramGeom',\n interfaces: [BarGeom]\n };\n function ImageGeom(imageUrl) {\n ImageGeom$Companion_getInstance();\n GeomBase.call(this);\n this.imageUrl_0 = imageUrl;\n }\n ImageGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n if (aesthetics.isEmpty)\n return;\n var p = aesthetics.dataPointAt_za3lpa$(0);\n var boundsAes = DoubleRectangle.Companion.span_qt8ska$(new DoubleVector(ensureNotNull(p.xmin()), ensureNotNull(p.ymin())), new DoubleVector(ensureNotNull(p.xmax()), ensureNotNull(p.ymax())));\n var helper = new GeomHelper(pos, coord, ctx);\n var boundsClient = helper.toClient_ioi29i$(boundsAes, p);\n var svgImageElement = SvgImageElement_init(boundsClient.origin.x, boundsClient.origin.y, boundsClient.dimension.x, boundsClient.dimension.y);\n svgImageElement.href().set_11rb$(this.imageUrl_0);\n root.add_26jijc$(svgImageElement);\n };\n function ImageGeom$Companion() {\n ImageGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n ImageGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ImageGeom$Companion_instance = null;\n function ImageGeom$Companion_getInstance() {\n if (ImageGeom$Companion_instance === null) {\n new ImageGeom$Companion();\n }return ImageGeom$Companion_instance;\n }\n ImageGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ImageGeom',\n interfaces: [GeomBase]\n };\n function JitterGeom() {\n JitterGeom$Companion_getInstance();\n PointGeom.call(this);\n }\n function JitterGeom$Companion() {\n JitterGeom$Companion_instance = this;\n this.HANDLES_GROUPS = PointGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n JitterGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var JitterGeom$Companion_instance = null;\n function JitterGeom$Companion_getInstance() {\n if (JitterGeom$Companion_instance === null) {\n new JitterGeom$Companion();\n }return JitterGeom$Companion_instance;\n }\n JitterGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JitterGeom',\n interfaces: [PointGeom]\n };\n function LineGeom() {\n LineGeom$Companion_getInstance();\n PathGeom.call(this);\n }\n LineGeom.prototype.dataPoints_m7huy5$ = function (aesthetics) {\n return GeomUtil_getInstance().ordered_X_83glv4$(PathGeom.prototype.dataPoints_m7huy5$.call(this, aesthetics));\n };\n function LineGeom$Companion() {\n LineGeom$Companion_instance = this;\n this.HANDLES_GROUPS = PathGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n LineGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LineGeom$Companion_instance = null;\n function LineGeom$Companion_getInstance() {\n if (LineGeom$Companion_instance === null) {\n new LineGeom$Companion();\n }return LineGeom$Companion_instance;\n }\n LineGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LineGeom',\n interfaces: [PathGeom]\n };\n function LineRangeGeom() {\n LineRangeGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(LineRangeGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return VLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n function LineRangeGeom$buildIntern$lambda(it) {\n return HintColorUtil_getInstance().fromColor_l6g9mh$(it);\n }\n LineRangeGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var geomHelper = new GeomHelper(pos, coord, ctx);\n var helper = geomHelper.createSvgElementHelper();\n tmp$ = GeomUtil_getInstance().withDefined_7jazl$(aesthetics.dataPoints(), Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX).iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = ensureNotNull(p.x());\n var ymin = ensureNotNull(p.ymin());\n var ymax = ensureNotNull(p.ymax());\n var start = new DoubleVector(x, ymin);\n var end = new DoubleVector(x, ymax);\n var line = helper.createLine_ollnar$(start, end, p);\n root.add_26jijc$(line);\n }\n BarTooltipHelper_getInstance().collectRectangleTargets_mj9gdb$(listOf([Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().YMIN]), aesthetics, pos, coord, ctx, LineRangeGeom$Companion_getInstance().rectangleByDataPoint(), LineRangeGeom$buildIntern$lambda);\n };\n function LineRangeGeom$Companion() {\n LineRangeGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n function LineRangeGeom$Companion$rectangleByDataPoint$lambda(p) {\n if (p.defined_896ixz$(Aes$Companion_getInstance().X) && p.defined_896ixz$(Aes$Companion_getInstance().YMIN) && p.defined_896ixz$(Aes$Companion_getInstance().YMAX)) {\n var x = ensureNotNull(p.x());\n var ymin = ensureNotNull(p.ymin());\n var ymax = ensureNotNull(p.ymax());\n var a = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var width = JsMath.max(a, 2.0) * 2.0;\n var height = ymax - ymin;\n var origin = new DoubleVector(x - width / 2, ymax - height / 2);\n var dimensions = new DoubleVector(width, 0.0);\n return new DoubleRectangle(origin, dimensions);\n } else {\n return null;\n }\n }\n LineRangeGeom$Companion.prototype.rectangleByDataPoint = function () {\n return LineRangeGeom$Companion$rectangleByDataPoint$lambda;\n };\n LineRangeGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LineRangeGeom$Companion_instance = null;\n function LineRangeGeom$Companion_getInstance() {\n if (LineRangeGeom$Companion_instance === null) {\n new LineRangeGeom$Companion();\n }return LineRangeGeom$Companion_instance;\n }\n LineRangeGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LineRangeGeom',\n interfaces: [GeomBase]\n };\n function LiveMapGeom(myDisplayMode) {\n LiveMapGeom$Companion_getInstance();\n this.myDisplayMode_0 = myDisplayMode;\n this.myMapProvider_pcd1rb$_0 = this.myMapProvider_pcd1rb$_0;\n }\n Object.defineProperty(LiveMapGeom.prototype, 'myMapProvider_0', {\n configurable: true,\n get: function () {\n if (this.myMapProvider_pcd1rb$_0 == null)\n return throwUPAE('myMapProvider');\n return this.myMapProvider_pcd1rb$_0;\n },\n set: function (myMapProvider) {\n this.myMapProvider_pcd1rb$_0 = myMapProvider;\n }\n });\n Object.defineProperty(LiveMapGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n var tmp$;\n switch (this.myDisplayMode_0.name) {\n case 'POINT':\n tmp$ = new PointLegendKeyElementFactory();\n break;\n case 'PIE':\n tmp$ = new FilledCircleLegendKeyElementFactory();\n break;\n default:tmp$ = new GenericLegendKeyElementFactory();\n break;\n }\n return tmp$;\n }\n });\n LiveMapGeom.prototype.build_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n throw IllegalStateException_init('Not applicable to live map');\n };\n LiveMapGeom.prototype.setLiveMapProvider_kld0fp$ = function (liveMapProvider) {\n this.myMapProvider_0 = liveMapProvider;\n };\n LiveMapGeom.prototype.createCanvasFigure_wthzt5$ = function (bounds) {\n return this.myMapProvider_0.createLiveMap_wthzt5$(bounds);\n };\n function LiveMapGeom$Companion() {\n LiveMapGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n LiveMapGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LiveMapGeom$Companion_instance = null;\n function LiveMapGeom$Companion_getInstance() {\n if (LiveMapGeom$Companion_instance === null) {\n new LiveMapGeom$Companion();\n }return LiveMapGeom$Companion_instance;\n }\n LiveMapGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LiveMapGeom',\n interfaces: [Geom]\n };\n function LiveMapProvider() {\n }\n function LiveMapProvider$LiveMapData(canvasFigure, targetLocator) {\n this.canvasFigure = canvasFigure;\n this.targetLocator = targetLocator;\n }\n LiveMapProvider$LiveMapData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LiveMapData',\n interfaces: []\n };\n LiveMapProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LiveMapProvider',\n interfaces: []\n };\n function MapGeom() {\n MapGeom$Companion_getInstance();\n PolygonGeom.call(this);\n }\n function MapGeom$Companion() {\n MapGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n MapGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var MapGeom$Companion_instance = null;\n function MapGeom$Companion_getInstance() {\n if (MapGeom$Companion_instance === null) {\n new MapGeom$Companion();\n }return MapGeom$Companion_instance;\n }\n MapGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MapGeom',\n interfaces: [PolygonGeom]\n };\n function PathGeom() {\n PathGeom$Companion_getInstance();\n GeomBase.call(this);\n this.animation = null;\n }\n Object.defineProperty(PathGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return HLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n PathGeom.prototype.dataPoints_m7huy5$ = function (aesthetics) {\n return GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints());\n };\n PathGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var dataPoints = this.dataPoints_m7huy5$(aesthetics);\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n var linesHelper = new LinesHelper(pos, coord, ctx);\n var geomConstructor = new LinePathConstructor(targetCollector, dataPoints, linesHelper, false);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(geomConstructor.construct_6taknv$(false), root);\n this.buildHints_9cwuu0$_0(aesthetics, coord, linesHelper, targetCollector);\n };\n PathGeom.prototype.buildHints_9cwuu0$_0 = function (aesthetics, coord, linesHelper, targetCollector) {\n var $receiver = this.dataPoints_m7huy5$(aesthetics);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var x = element.x();\n var y = element.y();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y) && coord.isPointInLimits_k2qmv6$(new DoubleVector(ensureNotNull(x), ensureNotNull(y)), false))\n destination.add_11rb$(element);\n }\n var dataPoints = destination;\n (new LinePathConstructor(targetCollector, dataPoints, linesHelper, false)).buildHints();\n };\n function PathGeom$Companion() {\n PathGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n PathGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PathGeom$Companion_instance = null;\n function PathGeom$Companion_getInstance() {\n if (PathGeom$Companion_instance === null) {\n new PathGeom$Companion();\n }return PathGeom$Companion_instance;\n }\n PathGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PathGeom',\n interfaces: [GeomBase]\n };\n function PieGeom(myCenter, myRadius) {\n PieGeom$Companion_getInstance();\n GeomBase.call(this);\n this.myCenter_0 = myCenter;\n this.myRadius_0 = myRadius;\n }\n PieGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var helper = new PieGeom$PieHelper(pos, coord, ctx);\n var segments = helper.createSegments_67zh1d$(aesthetics, this.myCenter_0, this.myRadius_0);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(segments, root);\n };\n function PieGeom$PieHelper(pos, coord, ctx) {\n LinesHelper.call(this, pos, coord, ctx);\n }\n PieGeom$PieHelper.prototype.createSegments_67zh1d$ = function (aesthetics, center, radius) {\n var tmp$;\n var result = ArrayList_init();\n var basis = new DoubleVector(0.0, -radius);\n var curAngle = kotlin_js_internal_DoubleCompanionObject.NaN;\n tmp$ = PieGeom$Companion_getInstance().dataPoints_0(aesthetics).iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var segmentSize = PieGeom$Companion_getInstance().shareToRad_0(ensureNotNull(p.y()));\n if (isNaN_0(curAngle)) {\n curAngle = segmentSize;\n }var angle = -segmentSize;\n var builder = new SvgPathDataBuilder(true);\n builder.moveTo_gpjtzr$(center);\n builder.lineTo_gpjtzr$(center.add_gpjtzr$(basis.rotate_14dthe$(curAngle)));\n var arcTo = center.add_gpjtzr$(basis.rotate_14dthe$(curAngle + angle));\n builder.ellipticalArc_gc0whr$(radius, radius, 0.0, -angle > math.PI, false, arcTo);\n builder.closePath();\n curAngle += angle;\n var path = new LinePath(builder);\n this.decorate_frjrd5$(path, p, true);\n result.add_11rb$(path);\n }\n return result;\n };\n PieGeom$PieHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PieHelper',\n interfaces: [LinesHelper]\n };\n function PieGeom$Companion() {\n PieGeom$Companion_instance = this;\n this.RENDERS = listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().COLOR, Aes$Companion_getInstance().FILL, Aes$Companion_getInstance().ALPHA, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().SIZE]);\n this.HANDLES_GROUPS = false;\n }\n PieGeom$Companion.prototype.dataPoints_0 = function (aesthetics) {\n var tmp$;\n var withX = GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints());\n if (collect.Iterables.isEmpty_fakr2g$(withX) || this.allEqualX_0(withX, collect.Iterables.get_7iig3d$(withX, 0).x())) {\n tmp$ = GeomUtil_getInstance().ordered_Y_hku6c7$(GeomUtil_getInstance().with_Y_83glv4$(aesthetics.dataPoints()), true);\n } else\n tmp$ = GeomUtil_getInstance().ordered_X_83glv4$(withX);\n return tmp$;\n };\n PieGeom$Companion.prototype.allEqualX_0 = function (hasX, val) {\n var tmp$;\n tmp$ = hasX.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n if (p.x() != val) {\n return false;\n }}\n return true;\n };\n PieGeom$Companion.prototype.shareToRad_0 = function (share) {\n return 0.9999 * 2.0 * math.PI * share;\n };\n PieGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PieGeom$Companion_instance = null;\n function PieGeom$Companion_getInstance() {\n if (PieGeom$Companion_instance === null) {\n new PieGeom$Companion();\n }return PieGeom$Companion_instance;\n }\n PieGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PieGeom',\n interfaces: [GeomBase]\n };\n function PointGeom() {\n PointGeom$Companion_getInstance();\n GeomBase.call(this);\n this.animation = null;\n this.sizeUnit = null;\n }\n Object.defineProperty(PointGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new PointLegendKeyElementFactory();\n }\n });\n PointGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var helper = new GeomHelper(pos, coord, ctx);\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n var count = aesthetics.dataPointCount();\n var slimGroup = slim.SvgSlimElements.g_za3lpa$(count);\n var sizeUnitRatio = this.getSizeUnitRatio_a8x9k9$_0(ctx);\n for (var i = 0; i < count; i++) {\n var p = aesthetics.dataPointAt_za3lpa$(i);\n var x = p.x();\n var y = p.y();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y)) {\n var location = helper.toClient_tkjljq$(new DoubleVector(ensureNotNull(x), ensureNotNull(y)), p);\n var shape = ensureNotNull(p.shape());\n targetCollector.addPoint_cnsimy$(i, location, sizeUnitRatio * shape.size_l6g9mh$(p) / 2, PointGeom$Companion_getInstance().tooltipParams_l6g9mh$(p));\n var o = PointShapeSvg_getInstance().create_d8smhz$(shape, location, p, sizeUnitRatio);\n o.appendTo_i2myw1$(slimGroup);\n }}\n root.add_26jijc$(GeomBase$Companion_getInstance().wrap_i2myw1$(slimGroup));\n };\n PointGeom.prototype.getSizeUnitRatio_a8x9k9$_0 = function (ctx) {\n var tmp$;\n if (this.sizeUnit != null) {\n var unitRes = ctx.getUnitResolution_vktour$(GeomHelper$Companion_getInstance().getSizeUnitAes_61zpoe$(ensureNotNull(this.sizeUnit)));\n tmp$ = unitRes / AesScaling_getInstance().UNIT_SHAPE_SIZE;\n } else {\n tmp$ = 1.0;\n }\n return tmp$;\n };\n function PointGeom$Companion() {\n PointGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n PointGeom$Companion.prototype.tooltipParams_l6g9mh$ = function (p) {\n var tmp$;\n var color = Color.Companion.TRANSPARENT;\n if (equals(p.shape(), TinyPointShape_getInstance())) {\n color = ensureNotNull(p.color());\n } else if (Kotlin.isType(p.shape(), NamedShape)) {\n var shape = Kotlin.isType(tmp$ = p.shape(), NamedShape) ? tmp$ : throwCCE();\n color = AestheticsUtil_getInstance().fill_edjgex$(shape.isFilled, shape.isSolid, p);\n }return GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColorValue_o14uds$(color, ensureNotNull(p.alpha())));\n };\n PointGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PointGeom$Companion_instance = null;\n function PointGeom$Companion_getInstance() {\n if (PointGeom$Companion_instance === null) {\n new PointGeom$Companion();\n }return PointGeom$Companion_instance;\n }\n PointGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointGeom',\n interfaces: [GeomBase]\n };\n function PointLegendKeyElementFactory(fatten) {\n if (fatten === void 0)\n fatten = 1.0;\n this.fatten_0 = fatten;\n }\n PointLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var location = new DoubleVector(size.x / 2, size.y / 2);\n var shape = ensureNotNull(p.shape());\n var slimObject = PointShapeSvg_getInstance().create_d8smhz$(shape, location, p, this.fatten_0);\n return GeomBase$Companion_getInstance().wrap_4fnnkz$(slimObject);\n };\n PointLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var shape = ensureNotNull(p.shape());\n var shapeSize = shape.size_l6g9mh$(p) * this.fatten_0;\n var strokeWidth = shape.strokeWidth_l6g9mh$(p);\n var size = shapeSize + strokeWidth + 2.0;\n return new DoubleVector(size, size);\n };\n PointLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function PointRangeGeom() {\n PointRangeGeom$Companion_getInstance();\n GeomBase.call(this);\n this.fattenMidPoint = PointRangeGeom$Companion_getInstance().DEF_FATTEN;\n }\n Object.defineProperty(PointRangeGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new CompositeLegendKeyElementFactory([new VLineLegendKeyElementFactory(), new PointLegendKeyElementFactory(PointRangeGeom$Companion_getInstance().DEF_FATTEN)]);\n }\n });\n function PointRangeGeom$buildIntern$lambda(it) {\n return HintColorUtil_getInstance().fromColor_l6g9mh$(it);\n }\n PointRangeGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var geomHelper = new GeomHelper(pos, coord, ctx);\n var helper = geomHelper.createSvgElementHelper();\n tmp$ = GeomUtil_getInstance().withDefined_i1kplo$(aesthetics.dataPoints(), Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX).iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = ensureNotNull(p.x());\n var y = ensureNotNull(p.y());\n var ymin = ensureNotNull(p.ymin());\n var ymax = ensureNotNull(p.ymax());\n var start = new DoubleVector(x, ymin);\n var end = new DoubleVector(x, ymax);\n var line = helper.createLine_ollnar$(start, end, p);\n root.add_26jijc$(line);\n var location = geomHelper.toClient_tkjljq$(new DoubleVector(x, y), p);\n var shape = ensureNotNull(p.shape());\n var o = PointShapeSvg_getInstance().create_d8smhz$(shape, location, p, this.fattenMidPoint);\n root.add_26jijc$(GeomBase$Companion_getInstance().wrap_4fnnkz$(o));\n }\n BarTooltipHelper_getInstance().collectRectangleTargets_mj9gdb$(listOf([Aes$Companion_getInstance().YMAX, Aes$Companion_getInstance().YMIN]), aesthetics, pos, coord, ctx, PointRangeGeom$Companion_getInstance().rectangleByDataPoint_14dthe$(this.fattenMidPoint), PointRangeGeom$buildIntern$lambda);\n };\n function PointRangeGeom$Companion() {\n PointRangeGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n this.DEF_FATTEN = 5.0;\n }\n function PointRangeGeom$Companion$rectangleByDataPoint$lambda(closure$fatten) {\n return function (p) {\n if (p.defined_896ixz$(Aes$Companion_getInstance().X) && p.defined_896ixz$(Aes$Companion_getInstance().Y)) {\n var x = ensureNotNull(p.x());\n var y = ensureNotNull(p.y());\n var shape = ensureNotNull(p.shape());\n var shapeSize = shape.size_l6g9mh$(p) * closure$fatten;\n var strokeWidth = shape.strokeWidth_l6g9mh$(p);\n var width = shapeSize + strokeWidth;\n var origin = new DoubleVector(x - width / 2, y);\n var dimensions = new DoubleVector(width, 0.0);\n return new DoubleRectangle(origin, dimensions);\n } else {\n return null;\n }\n };\n }\n PointRangeGeom$Companion.prototype.rectangleByDataPoint_14dthe$ = function (fatten) {\n return PointRangeGeom$Companion$rectangleByDataPoint$lambda(fatten);\n };\n PointRangeGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PointRangeGeom$Companion_instance = null;\n function PointRangeGeom$Companion_getInstance() {\n if (PointRangeGeom$Companion_instance === null) {\n new PointRangeGeom$Companion();\n }return PointRangeGeom$Companion_instance;\n }\n PointRangeGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointRangeGeom',\n interfaces: [GeomBase]\n };\n function PolygonGeom() {\n PolygonGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n PolygonGeom.prototype.dataPoints_m7huy5$ = function (aesthetics) {\n return GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints());\n };\n PolygonGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var dataPoints = this.dataPoints_m7huy5$(aesthetics);\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n var linesHelper = new LinesHelper(pos, coord, ctx);\n var geomConstructor = new LinePathConstructor(targetCollector, dataPoints, linesHelper, true);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(geomConstructor.construct_6taknv$(true), root);\n };\n function PolygonGeom$Companion() {\n PolygonGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n PolygonGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PolygonGeom$Companion_instance = null;\n function PolygonGeom$Companion_getInstance() {\n if (PolygonGeom$Companion_instance === null) {\n new PolygonGeom$Companion();\n }return PolygonGeom$Companion_instance;\n }\n PolygonGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolygonGeom',\n interfaces: [GeomBase]\n };\n function RasterGeom() {\n RasterGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(RasterGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new FilledSquareLegendKeyElementFactory();\n }\n });\n RasterGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$, tmp$_0;\n var iter = GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints()).iterator();\n if (!iter.hasNext()) {\n return;\n }var randomP = iter.next();\n var helper = new GeomHelper(pos, coord, ctx);\n var boundsXY = GeomBase$Companion_getInstance().aesBoundingBox_m7huy5$(aesthetics);\n var stepX = ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n var stepY = ctx.getResolution_vktour$(Aes$Companion_getInstance().Y);\n if (!(stepX > data.SeriesUtil.TINY)) {\n var message = 'x-step is too small: ' + stepX;\n throw IllegalArgumentException_init(message.toString());\n }if (!(stepY > data.SeriesUtil.TINY)) {\n var message_0 = 'y-step is too small: ' + stepY;\n throw IllegalArgumentException_init(message_0.toString());\n }var width = round(boundsXY.dimension.x / stepX) + 1;\n var height = round(boundsXY.dimension.y / stepY) + 1;\n if (width * height > 5000000) {\n var center = boundsXY.center;\n var lines = ['Raster image size', '[' + width + ' X ' + height + ']', 'exceeds capability', 'of', 'your imaging device'];\n var fontSize = 12.0;\n var lineHeight = fontSize + 4;\n var y = center.y + lineHeight * lines.length / 2.0;\n for (tmp$ = 0; tmp$ !== lines.length; ++tmp$) {\n var line = lines[tmp$];\n var label = new TextLabel(line);\n label.textColor().set_11rb$(Color.Companion.DARK_MAGENTA);\n label.textOpacity().set_11rb$(0.5);\n label.setFontSize_14dthe$(fontSize);\n label.setFontWeight_pdl1vj$('bold');\n label.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor$MIDDLE_getInstance());\n label.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor$CENTER_getInstance());\n var loc = helper.toClient_vf7nkp$(center.x, y, randomP);\n label.moveTo_gpjtzr$(loc);\n root.add_26jijc$(label.rootGroup);\n y -= lineHeight;\n }\n return;\n }var cols = numberToInt(round(width));\n var rows = numberToInt(round(height));\n var halfStep = new DoubleVector(stepX * 0.5, stepY * 0.5);\n var corner0 = helper.toClient_tkjljq$(boundsXY.origin.subtract_gpjtzr$(halfStep), randomP);\n var corner2 = helper.toClient_tkjljq$(boundsXY.origin.add_gpjtzr$(boundsXY.dimension).add_gpjtzr$(halfStep), randomP);\n var invertedX = corner2.x < corner0.x;\n var invertedY = corner2.y < corner0.y;\n var x0 = boundsXY.origin.x;\n var y0 = boundsXY.origin.y;\n var argbValues = new Int32Array(Kotlin.imul(cols, rows));\n tmp$_0 = GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints()).iterator();\n while (tmp$_0.hasNext()) {\n var p = tmp$_0.next();\n var x = p.x();\n var y_0 = p.y();\n var alpha = p.alpha();\n var color = p.fill();\n var col = numberToInt(round((ensureNotNull(x) - x0) / stepX));\n var row = numberToInt(round((ensureNotNull(y_0) - y0) / stepY));\n if (invertedX) {\n col = cols - (col + 1) | 0;\n }if (invertedY) {\n row = rows - (row + 1) | 0;\n }argbValues[Kotlin.imul(row, cols) + col | 0] = svg.SvgUtils.toARGB_o14uds$(ensureNotNull(color), ensureNotNull(alpha));\n }\n var bitmap = new SvgImageElementEx$Bitmap(cols, rows, argbValues);\n var a = corner0.x;\n var b = corner2.x;\n var tmp$_1 = JsMath.min(a, b);\n var a_0 = corner0.y;\n var b_0 = corner2.y;\n var tmp$_2 = JsMath.min(a_0, b_0);\n var x_0 = corner0.x - corner2.x;\n var tmp$_3 = JsMath.abs(x_0);\n var x_1 = corner0.y - corner2.y;\n var svgImageElement = new SvgImageElementEx(tmp$_1, tmp$_2, tmp$_3, JsMath.abs(x_1), bitmap);\n root.add_26jijc$(svgImageElement);\n };\n function RasterGeom$Companion() {\n RasterGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n RasterGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RasterGeom$Companion_instance = null;\n function RasterGeom$Companion_getInstance() {\n if (RasterGeom$Companion_instance === null) {\n new RasterGeom$Companion();\n }return RasterGeom$Companion_instance;\n }\n RasterGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RasterGeom',\n interfaces: [GeomBase]\n };\n function RectGeom() {\n RectGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n RectGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var helper = new RectanglesHelper(aesthetics, pos, coord, ctx);\n var $receiver = helper.createRectangles_rezc4r$(getCallableRef('rectangleByDataPoint', function ($receiver, p1) {\n return $receiver.rectangleByDataPoint_0(p1);\n }.bind(null, RectGeom$Companion_getInstance())));\n var action = getCallableRef('add', function ($receiver, p1) {\n return $receiver.add_26jijc$(p1), Unit;\n }.bind(null, root));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n action(element);\n }\n (new RectTargetCollectorHelper(helper, getCallableRef('rectangleByDataPoint', function ($receiver, p1) {\n return $receiver.rectangleByDataPoint_0(p1);\n }.bind(null, RectGeom$Companion_getInstance())), getCallableRef('fromFill', function ($receiver, p1) {\n return $receiver.fromFill_l6g9mh$(p1);\n }.bind(null, HintColorUtil_getInstance())), TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance())).collectTo_xrq6q$(ctx.targetCollector);\n };\n function RectGeom$Companion() {\n RectGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n RectGeom$Companion.prototype.rectangleByDataPoint_0 = function (p) {\n var tmp$;\n var xmin = p.xmin();\n var xmax = p.xmax();\n var ymin = p.ymin();\n var ymax = p.ymax();\n if (data.SeriesUtil.allFinite_rd1tgs$(xmin, xmax, ymin, ymax)) {\n tmp$ = DoubleRectangle.Companion.span_qt8ska$(new DoubleVector(ensureNotNull(xmin), ensureNotNull(ymin)), new DoubleVector(ensureNotNull(xmax), ensureNotNull(ymax)));\n } else {\n tmp$ = null;\n }\n return tmp$;\n };\n RectGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RectGeom$Companion_instance = null;\n function RectGeom$Companion_getInstance() {\n if (RectGeom$Companion_instance === null) {\n new RectGeom$Companion();\n }return RectGeom$Companion_instance;\n }\n RectGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RectGeom',\n interfaces: [GeomBase]\n };\n function RibbonGeom() {\n RibbonGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n RibbonGeom.prototype.dataPoints_0 = function (aesthetics) {\n var data = GeomUtil_getInstance().withDefined_7jazl$(aesthetics.dataPoints(), Aes$Companion_getInstance().X, Aes$Companion_getInstance().YMIN, Aes$Companion_getInstance().YMAX);\n return GeomUtil_getInstance().ordered_X_83glv4$(data);\n };\n RibbonGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var dataPoints = this.dataPoints_0(aesthetics);\n var helper = new LinesHelper(pos, coord, ctx);\n var paths = helper.createBands_22uu1u$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_YMAX, GeomUtil_getInstance().TO_LOCATION_X_YMIN);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(paths, root);\n helper.setAlphaEnabled_6taknv$(false);\n var lines = helper.createLines_rrreuh$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_YMAX);\n lines.addAll_brywnq$(helper.createLines_rrreuh$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_YMIN));\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(lines, root);\n this.buildHints_0(aesthetics, pos, coord, ctx);\n };\n RibbonGeom.prototype.buildHints_0 = function (aesthetics, pos, coord, ctx) {\n var tmp$;\n var targetCollector = ctx.targetCollector;\n var helper = new GeomHelper(pos, coord, ctx);\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n this.addTarget_0(p, targetCollector, GeomUtil_getInstance().TO_LOCATION_X_YMAX, helper);\n }\n };\n RibbonGeom.prototype.addTarget_0 = function (p, collector, toLocation, helper) {\n var coord = toLocation(p);\n if (coord != null) {\n var hint = (new HintsCollection$HintConfigFactory()).defaultObjectRadius_14dthe$(0.0).defaultX_14dthe$(ensureNotNull(p.x())).defaultKind_nnfttk$(TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance()).defaultColor_yo1m5r$(ensureNotNull(p.fill()), null);\n var hintsCollection = (new HintsCollection(p, helper)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMAX)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMIN));\n collector.addPoint_cnsimy$(p.index(), helper.toClient_tkjljq$(coord, p), 0.0, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setTipLayoutHints_vgcgsc$(hintsCollection.hints));\n }};\n function RibbonGeom$Companion() {\n RibbonGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n }\n RibbonGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RibbonGeom$Companion_instance = null;\n function RibbonGeom$Companion_getInstance() {\n if (RibbonGeom$Companion_instance === null) {\n new RibbonGeom$Companion();\n }return RibbonGeom$Companion_instance;\n }\n RibbonGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RibbonGeom',\n interfaces: [GeomBase]\n };\n function SegmentGeom() {\n SegmentGeom$Companion_getInstance();\n GeomBase.call(this);\n this.arrowSpec = null;\n this.animation = null;\n }\n Object.defineProperty(SegmentGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return HLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n function SegmentGeom$buildIntern$lambda(closure$p) {\n return function (it) {\n return closure$p.index();\n };\n }\n SegmentGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n var helper = (new GeomHelper(pos, coord, ctx)).createSvgElementHelper();\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n if (data.SeriesUtil.allFinite_rd1tgs$(p.x(), p.y(), p.xend(), p.yend())) {\n var start = new DoubleVector(ensureNotNull(p.x()), ensureNotNull(p.y()));\n var end = new DoubleVector(ensureNotNull(p.xend()), ensureNotNull(p.yend()));\n var line = helper.createLine_ollnar$(start, end, p);\n root.add_26jijc$(line);\n targetCollector.addPath_sa5m83$(listOf([coord.toClient_gpjtzr$(start), coord.toClient_gpjtzr$(end)]), SegmentGeom$buildIntern$lambda(p), GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(p)));\n if (this.arrowSpec != null) {\n var clientX1 = ensureNotNull(line.x1().get());\n var clientY1 = ensureNotNull(line.y1().get());\n var clientX2 = ensureNotNull(line.x2().get());\n var clientY2 = ensureNotNull(line.y2().get());\n var abscissa = clientX2 - clientX1;\n var ordinate = clientY2 - clientY1;\n if (abscissa !== 0.0 || ordinate !== 0.0) {\n var polarAngle = JsMath.atan2(ordinate, abscissa);\n var arrowAes = ensureNotNull(this.arrowSpec).toArrowAes_l6g9mh$(p);\n if (ensureNotNull(this.arrowSpec).isOnLastEnd) {\n var arrow = ensureNotNull(this.arrowSpec).createElement_yvo9jy$(polarAngle, clientX2, clientY2);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(arrow, arrowAes);\n root.add_26jijc$(arrow);\n }if (ensureNotNull(this.arrowSpec).isOnFirstEnd) {\n var arrow_0 = ensureNotNull(this.arrowSpec).createElement_yvo9jy$(polarAngle + math.PI, clientX1, clientY1);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(arrow_0, arrowAes);\n root.add_26jijc$(arrow_0);\n }}}}}\n };\n function SegmentGeom$Companion() {\n SegmentGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n SegmentGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SegmentGeom$Companion_instance = null;\n function SegmentGeom$Companion_getInstance() {\n if (SegmentGeom$Companion_instance === null) {\n new SegmentGeom$Companion();\n }return SegmentGeom$Companion_instance;\n }\n SegmentGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SegmentGeom',\n interfaces: [GeomBase]\n };\n function SmoothGeom() {\n SmoothGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(SmoothGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return HLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n SmoothGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var dataPoints = GeomUtil_getInstance().ordered_X_83glv4$(GeomUtil_getInstance().with_X_Y_83glv4$(aesthetics.dataPoints()));\n var helper = new LinesHelper(pos, coord, ctx);\n helper.setAlphaEnabled_6taknv$(false);\n var regressionLines = helper.createLines_rrreuh$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_Y);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(regressionLines, root);\n helper.setAlphaFilter_m9g0ow$(SmoothGeom$Companion_getInstance().PROPORTION_0);\n helper.setWidthFilter_m9g0ow$(SmoothGeom$Companion_getInstance().ZERO_0);\n var bands = helper.createBands_22uu1u$(dataPoints, GeomUtil_getInstance().TO_LOCATION_X_YMAX, GeomUtil_getInstance().TO_LOCATION_X_YMIN);\n GeomBase$Companion_getInstance().appendNodes_37zgbi$(bands, root);\n this.buildHints_0(dataPoints, pos, coord, ctx);\n };\n SmoothGeom.prototype.buildHints_0 = function (dataPoints, pos, coord, ctx) {\n var tmp$;\n var helper = new GeomHelper(pos, coord, ctx);\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var xCoord = ensureNotNull(p.x());\n var objectRadius = 0.0;\n var hint = (new HintsCollection$HintConfigFactory()).defaultObjectRadius_14dthe$(objectRadius).defaultX_14dthe$(xCoord).defaultKind_nnfttk$(TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance()).defaultColor_yo1m5r$(ensureNotNull(p.fill()), SmoothGeom$Companion_getInstance().PROPORTION_0(p.alpha()));\n var hintsCollection = (new HintsCollection(p, helper)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMAX)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().YMIN)).addHint_p9kkqu$(hint.create_vktour$(Aes$Companion_getInstance().Y).color_98b62m$(ensureNotNull(p.color())));\n var clientCoord = helper.toClient_vf7nkp$(p.x(), p.y(), p);\n ctx.targetCollector.addPoint_cnsimy$(p.index(), clientCoord, objectRadius, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setTipLayoutHints_vgcgsc$(hintsCollection.hints));\n }\n };\n function SmoothGeom$Companion() {\n SmoothGeom$Companion_instance = this;\n this.HANDLES_GROUPS = true;\n this.PROPORTION_0 = SmoothGeom$Companion$PROPORTION$lambda;\n this.ZERO_0 = SmoothGeom$Companion$ZERO$lambda;\n }\n function SmoothGeom$Companion$PROPORTION$lambda(v) {\n return v == null ? null : v / 10;\n }\n function SmoothGeom$Companion$ZERO$lambda(f) {\n return 0.0;\n }\n SmoothGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SmoothGeom$Companion_instance = null;\n function SmoothGeom$Companion_getInstance() {\n if (SmoothGeom$Companion_instance === null) {\n new SmoothGeom$Companion();\n }return SmoothGeom$Companion_instance;\n }\n SmoothGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SmoothGeom',\n interfaces: [GeomBase]\n };\n function StepGeom() {\n StepGeom$Companion_getInstance();\n LineGeom.call(this);\n this.myDirection_0 = StepGeom$Companion_getInstance().DEF_DIRECTION;\n }\n StepGeom.prototype.setDirection_61zpoe$ = function (dir) {\n this.myDirection_0 = StepGeom$Direction$Companion_getInstance().toDirection_61zpoe$(dir);\n };\n StepGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var dataPoints = this.dataPoints_m7huy5$(aesthetics);\n var helper = new LinesHelper(pos, coord, ctx);\n var pathInfos = helper.createSteps_1fp004$(dataPoints, this.myDirection_0);\n tmp$ = pathInfos.iterator();\n while (tmp$.hasNext()) {\n var pathInfo = tmp$.next();\n root.add_26jijc$(pathInfo.path.rootGroup);\n }\n };\n function StepGeom$Direction(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function StepGeom$Direction_initFields() {\n StepGeom$Direction_initFields = function () {\n };\n StepGeom$Direction$HV_instance = new StepGeom$Direction('HV', 0);\n StepGeom$Direction$VH_instance = new StepGeom$Direction('VH', 1);\n StepGeom$Direction$Companion_getInstance();\n }\n var StepGeom$Direction$HV_instance;\n function StepGeom$Direction$HV_getInstance() {\n StepGeom$Direction_initFields();\n return StepGeom$Direction$HV_instance;\n }\n var StepGeom$Direction$VH_instance;\n function StepGeom$Direction$VH_getInstance() {\n StepGeom$Direction_initFields();\n return StepGeom$Direction$VH_instance;\n }\n function StepGeom$Direction$Companion() {\n StepGeom$Direction$Companion_instance = this;\n }\n StepGeom$Direction$Companion.prototype.toDirection_61zpoe$ = function (str) {\n var tmp$;\n switch (str) {\n case 'hv':\n case 'HV':\n tmp$ = StepGeom$Direction$HV_getInstance();\n break;\n case 'vh':\n case 'VH':\n tmp$ = StepGeom$Direction$VH_getInstance();\n break;\n default:throw IllegalArgumentException_init('Direction ' + str + \" is not allowed, only accept 'hv' or 'vh'\");\n }\n return tmp$;\n };\n StepGeom$Direction$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var StepGeom$Direction$Companion_instance = null;\n function StepGeom$Direction$Companion_getInstance() {\n StepGeom$Direction_initFields();\n if (StepGeom$Direction$Companion_instance === null) {\n new StepGeom$Direction$Companion();\n }return StepGeom$Direction$Companion_instance;\n }\n StepGeom$Direction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Direction',\n interfaces: [Enum]\n };\n function StepGeom$Direction$values() {\n return [StepGeom$Direction$HV_getInstance(), StepGeom$Direction$VH_getInstance()];\n }\n StepGeom$Direction.values = StepGeom$Direction$values;\n function StepGeom$Direction$valueOf(name) {\n switch (name) {\n case 'HV':\n return StepGeom$Direction$HV_getInstance();\n case 'VH':\n return StepGeom$Direction$VH_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.geom.StepGeom.Direction.' + name);\n }\n }\n StepGeom$Direction.valueOf_61zpoe$ = StepGeom$Direction$valueOf;\n function StepGeom$Companion() {\n StepGeom$Companion_instance = this;\n this.DEF_DIRECTION = StepGeom$Direction$HV_getInstance();\n this.HANDLES_GROUPS = LineGeom$Companion_getInstance().HANDLES_GROUPS;\n }\n StepGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var StepGeom$Companion_instance = null;\n function StepGeom$Companion_getInstance() {\n if (StepGeom$Companion_instance === null) {\n new StepGeom$Companion();\n }return StepGeom$Companion_instance;\n }\n StepGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StepGeom',\n interfaces: [LineGeom]\n };\n function TextGeom() {\n TextGeom$Companion_getInstance();\n GeomBase.call(this);\n this.formatter = null;\n this.naValue = TextGeom$Companion_getInstance().DEF_NA_VALUE;\n this.sizeUnit = null;\n }\n Object.defineProperty(TextGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return new TextLegendKeyElementFactory();\n }\n });\n TextGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var helper = new GeomHelper(pos, coord, ctx);\n var targetCollector = this.getGeomTargetCollector_vl74i5$(ctx);\n var sizeUnitRatio = this.getSizeUnitRatio_0(ctx);\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = p.x();\n var y = p.y();\n var text = this.toString_0(p.label());\n if (data.SeriesUtil.allFinite_jma9l8$(x, y) && !base.Strings.isNullOrEmpty_pdl1vj$(text)) {\n var label = new TextLabel(text);\n GeomHelper$Companion_getInstance().decorate_ijkgsm$(label, p, sizeUnitRatio);\n var loc = helper.toClient_vf7nkp$(x, y, p);\n label.moveTo_gpjtzr$(loc);\n root.add_26jijc$(label.rootGroup);\n targetCollector.addPoint_cnsimy$(p.index(), loc, sizeUnitRatio * AesScaling_getInstance().textSize_l6g9mh$(p) / 2, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(p)), TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance());\n }}\n };\n TextGeom.prototype.getSizeUnitRatio_0 = function (ctx) {\n var tmp$;\n if (this.sizeUnit != null) {\n var textWidth = 6.0;\n var unitRes = ctx.getUnitResolution_vktour$(GeomHelper$Companion_getInstance().getSizeUnitAes_61zpoe$(ensureNotNull(this.sizeUnit)));\n tmp$ = unitRes / textWidth;\n } else {\n tmp$ = 1.0;\n }\n return tmp$;\n };\n TextGeom.prototype.toString_0 = function (label) {\n var tmp$;\n if (label == null)\n tmp$ = this.naValue;\n else if (this.formatter != null)\n tmp$ = ensureNotNull(this.formatter).format_za3rmp$(label);\n else\n tmp$ = label.toString();\n return tmp$;\n };\n function TextGeom$Companion() {\n TextGeom$Companion_instance = this;\n this.DEF_NA_VALUE = 'n/a';\n this.HANDLES_GROUPS = false;\n }\n TextGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TextGeom$Companion_instance = null;\n function TextGeom$Companion_getInstance() {\n if (TextGeom$Companion_instance === null) {\n new TextGeom$Companion();\n }return TextGeom$Companion_instance;\n }\n TextGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TextGeom',\n interfaces: [GeomBase]\n };\n function TextLegendKeyElementFactory() {\n }\n TextLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var label = new TextLabel('a');\n GeomHelper$Companion_getInstance().decorate_ijkgsm$(label, p);\n label.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor$MIDDLE_getInstance());\n label.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor$CENTER_getInstance());\n label.moveTo_lu1900$(size.x / 2, size.y / 2);\n var g = new SvgGElement();\n g.children().add_11rb$(label.rootGroup);\n return g;\n };\n TextLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n return new DoubleVector(4.0, strokeWidth + 4);\n };\n TextLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TextLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function TileGeom() {\n TileGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n function TileGeom$buildIntern$lambda(p) {\n return HintColorUtil_getInstance().fromFill_l6g9mh$(p);\n }\n TileGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var helper = new RectanglesHelper(aesthetics, pos, coord, ctx);\n var slimGroup = helper.createSlimRectangles_rezc4r$(TileGeom$Companion_getInstance().rectangleByDataPoint_0(ctx));\n root.add_26jijc$(GeomBase$Companion_getInstance().wrap_i2myw1$(slimGroup));\n (new RectTargetCollectorHelper(helper, TileGeom$Companion_getInstance().rectangleByDataPoint_0(ctx), TileGeom$buildIntern$lambda, TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance())).collectTo_xrq6q$(ctx.targetCollector);\n };\n function TileGeom$Companion() {\n TileGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n }\n function TileGeom$Companion$rectangleByDataPoint$lambda(closure$ctx) {\n return function (p) {\n var x = p.x();\n var y = p.y();\n var w = p.width();\n var h = p.height();\n var rect = null;\n if (data.SeriesUtil.allFinite_rd1tgs$(x, y, w, h)) {\n var width = ensureNotNull(w) * closure$ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n var height = ensureNotNull(h) * closure$ctx.getResolution_vktour$(Aes$Companion_getInstance().Y);\n var origin = new DoubleVector(ensureNotNull(x) - width / 2, ensureNotNull(y) - height / 2);\n var dimensions = new DoubleVector(width, height);\n rect = new DoubleRectangle(origin, dimensions);\n }return rect;\n };\n }\n TileGeom$Companion.prototype.rectangleByDataPoint_0 = function (ctx) {\n return TileGeom$Companion$rectangleByDataPoint$lambda(ctx);\n };\n TileGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TileGeom$Companion_instance = null;\n function TileGeom$Companion_getInstance() {\n if (TileGeom$Companion_instance === null) {\n new TileGeom$Companion();\n }return TileGeom$Companion_instance;\n }\n TileGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TileGeom',\n interfaces: [GeomBase]\n };\n function VLineGeom() {\n VLineGeom$Companion_getInstance();\n GeomBase.call(this);\n }\n Object.defineProperty(VLineGeom.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return VLineGeom$Companion_getInstance().LEGEND_KEY_ELEMENT_FACTORY;\n }\n });\n VLineGeom.prototype.buildIntern_uzv8ab$ = function (root, aesthetics, pos, coord, ctx) {\n var tmp$;\n var geomHelper = new GeomHelper(pos, coord, ctx);\n var helper = geomHelper.createSvgElementHelper();\n helper.setStrokeAlphaEnabled_6taknv$(true);\n var viewPort = GeomBase$Companion_getInstance().aesViewPort_m7huy5$(aesthetics);\n var lines = ArrayList_init();\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var intercept = p.interceptX();\n if (data.SeriesUtil.isFinite_yrwdxb$(intercept)) {\n if (viewPort.xRange().contains_mef7kx$(ensureNotNull(intercept))) {\n var start = new DoubleVector(intercept, viewPort.top);\n var end = new DoubleVector(intercept, viewPort.bottom);\n var line = helper.createLine_ollnar$(start, end, p);\n lines.add_11rb$(line);\n var a = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var width = JsMath.max(a, 2.0) * 2.0;\n var origin = new DoubleVector(intercept - width / 2, end.y);\n var dimensions = new DoubleVector(width, 0.0);\n var rect = new DoubleRectangle(origin, dimensions);\n ctx.targetCollector.addRectangle_bxzvr8$(p.index(), geomHelper.toClient_ioi29i$(rect, p), GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(p)));\n }}}\n var tmp$_0;\n tmp$_0 = lines.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n root.add_26jijc$(element);\n }\n };\n function VLineGeom$Companion() {\n VLineGeom$Companion_instance = this;\n this.HANDLES_GROUPS = false;\n this.LEGEND_KEY_ELEMENT_FACTORY = new VLineLegendKeyElementFactory();\n }\n VLineGeom$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var VLineGeom$Companion_instance = null;\n function VLineGeom$Companion_getInstance() {\n if (VLineGeom$Companion_instance === null) {\n new VLineGeom$Companion();\n }return VLineGeom$Companion_instance;\n }\n VLineGeom.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VLineGeom',\n interfaces: [GeomBase]\n };\n function CompositeLegendKeyElementFactory(factories) {\n this.factories_0 = factories;\n }\n CompositeLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var tmp$, tmp$_0;\n var g = new SvgGElement();\n tmp$ = this.factories_0;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var factory = tmp$[tmp$_0];\n g.children().add_11rb$(factory.createKeyElement_s1fn0c$(p, size));\n }\n return g;\n };\n CompositeLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n return LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$.call(this, p);\n };\n CompositeLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CompositeLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function GenericLegendKeyElementFactory() {\n }\n GenericLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var rect = SvgRectElement_init(0.0, 0.0, size.x, size.y);\n AestheticsUtil_getInstance().updateFill_v4tjbc$(rect, p);\n var line = SvgLineElement_init(0.0, size.y, size.x, 0.0);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(line, p);\n var g = new SvgGElement();\n g.children().add_11rb$(rect);\n g.children().add_11rb$(line);\n return g;\n };\n GenericLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GenericLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function HLineLegendKeyElementFactory() {\n }\n HLineLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var line = SvgLineElement_init(0.0, size.y / 2, size.x, size.y / 2);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(line, p);\n var g = new SvgGElement();\n g.children().add_11rb$(line);\n return g;\n };\n HLineLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n return new DoubleVector(4.0, strokeWidth + 4);\n };\n HLineLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HLineLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function VLineLegendKeyElementFactory() {\n }\n VLineLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var line = SvgLineElement_init(size.x / 2, 0.0, size.x / 2, size.y);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(line, p);\n var g = new SvgGElement();\n g.children().add_11rb$(line);\n return g;\n };\n VLineLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n return new DoubleVector(strokeWidth + 4, 4.0);\n };\n VLineLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VLineLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function ArrowSpec(angle, length, end, type) {\n this.angle = angle;\n this.length = length;\n this.end = end;\n this.type = type;\n }\n Object.defineProperty(ArrowSpec.prototype, 'isOnFirstEnd', {\n configurable: true,\n get: function () {\n return this.end === ArrowSpec$End$FIRST_getInstance() || this.end === ArrowSpec$End$BOTH_getInstance();\n }\n });\n Object.defineProperty(ArrowSpec.prototype, 'isOnLastEnd', {\n configurable: true,\n get: function () {\n return this.end === ArrowSpec$End$LAST_getInstance() || this.end === ArrowSpec$End$BOTH_getInstance();\n }\n });\n ArrowSpec.prototype.createElement_yvo9jy$ = function (polarAngle, x, y) {\n var tmp$ = Float64Array;\n var tmp$_0 = this.length;\n var x_0 = polarAngle - this.angle;\n var tmp$_1 = x - tmp$_0 * JsMath.cos(x_0);\n var tmp$_2 = this.length;\n var x_1 = polarAngle + this.angle;\n var xs = new tmp$([tmp$_1, x, x - tmp$_2 * JsMath.cos(x_1)]);\n var tmp$_3 = Float64Array;\n var tmp$_4 = this.length;\n var x_2 = polarAngle - this.angle;\n var tmp$_5 = y - tmp$_4 * JsMath.sin(x_2);\n var tmp$_6 = this.length;\n var x_3 = polarAngle + this.angle;\n var ys = new tmp$_3([tmp$_5, y, y - tmp$_6 * JsMath.sin(x_3)]);\n var b = (new SvgPathDataBuilder(true)).moveTo_przk3b$(xs[0], ys[0]);\n for (var i = 1; i <= 2; i++) {\n b.lineTo_przk3b$(xs[i], ys[i], true);\n }\n if (this.type === ArrowSpec$Type$CLOSED_getInstance()) {\n b.closePath();\n }return SvgPathElement_init(b.build());\n };\n function ArrowSpec$toArrowAes$ObjectLiteral(this$ArrowSpec, p) {\n DataPointAestheticsDelegate.call(this, p);\n this.myFilled_0 = this$ArrowSpec.type === ArrowSpec$Type$CLOSED_getInstance();\n }\n ArrowSpec$toArrowAes$ObjectLiteral.prototype.fill = function () {\n var tmp$;\n if (this.myFilled_0) {\n tmp$ = this.color();\n } else\n tmp$ = Color.Companion.TRANSPARENT;\n return tmp$;\n };\n ArrowSpec$toArrowAes$ObjectLiteral.prototype.lineType = function () {\n var tmp$;\n if (this.myFilled_0) {\n tmp$ = NamedLineType$SOLID_getInstance();\n } else\n tmp$ = DataPointAestheticsDelegate.prototype.lineType.call(this);\n return tmp$;\n };\n ArrowSpec$toArrowAes$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DataPointAestheticsDelegate]\n };\n ArrowSpec.prototype.toArrowAes_l6g9mh$ = function (p) {\n return new ArrowSpec$toArrowAes$ObjectLiteral(this, p);\n };\n function ArrowSpec$End(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ArrowSpec$End_initFields() {\n ArrowSpec$End_initFields = function () {\n };\n ArrowSpec$End$LAST_instance = new ArrowSpec$End('LAST', 0);\n ArrowSpec$End$FIRST_instance = new ArrowSpec$End('FIRST', 1);\n ArrowSpec$End$BOTH_instance = new ArrowSpec$End('BOTH', 2);\n }\n var ArrowSpec$End$LAST_instance;\n function ArrowSpec$End$LAST_getInstance() {\n ArrowSpec$End_initFields();\n return ArrowSpec$End$LAST_instance;\n }\n var ArrowSpec$End$FIRST_instance;\n function ArrowSpec$End$FIRST_getInstance() {\n ArrowSpec$End_initFields();\n return ArrowSpec$End$FIRST_instance;\n }\n var ArrowSpec$End$BOTH_instance;\n function ArrowSpec$End$BOTH_getInstance() {\n ArrowSpec$End_initFields();\n return ArrowSpec$End$BOTH_instance;\n }\n ArrowSpec$End.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'End',\n interfaces: [Enum]\n };\n function ArrowSpec$End$values() {\n return [ArrowSpec$End$LAST_getInstance(), ArrowSpec$End$FIRST_getInstance(), ArrowSpec$End$BOTH_getInstance()];\n }\n ArrowSpec$End.values = ArrowSpec$End$values;\n function ArrowSpec$End$valueOf(name) {\n switch (name) {\n case 'LAST':\n return ArrowSpec$End$LAST_getInstance();\n case 'FIRST':\n return ArrowSpec$End$FIRST_getInstance();\n case 'BOTH':\n return ArrowSpec$End$BOTH_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.geom.util.ArrowSpec.End.' + name);\n }\n }\n ArrowSpec$End.valueOf_61zpoe$ = ArrowSpec$End$valueOf;\n function ArrowSpec$Type(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ArrowSpec$Type_initFields() {\n ArrowSpec$Type_initFields = function () {\n };\n ArrowSpec$Type$OPEN_instance = new ArrowSpec$Type('OPEN', 0);\n ArrowSpec$Type$CLOSED_instance = new ArrowSpec$Type('CLOSED', 1);\n }\n var ArrowSpec$Type$OPEN_instance;\n function ArrowSpec$Type$OPEN_getInstance() {\n ArrowSpec$Type_initFields();\n return ArrowSpec$Type$OPEN_instance;\n }\n var ArrowSpec$Type$CLOSED_instance;\n function ArrowSpec$Type$CLOSED_getInstance() {\n ArrowSpec$Type_initFields();\n return ArrowSpec$Type$CLOSED_instance;\n }\n ArrowSpec$Type.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Type',\n interfaces: [Enum]\n };\n function ArrowSpec$Type$values() {\n return [ArrowSpec$Type$OPEN_getInstance(), ArrowSpec$Type$CLOSED_getInstance()];\n }\n ArrowSpec$Type.values = ArrowSpec$Type$values;\n function ArrowSpec$Type$valueOf(name) {\n switch (name) {\n case 'OPEN':\n return ArrowSpec$Type$OPEN_getInstance();\n case 'CLOSED':\n return ArrowSpec$Type$CLOSED_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.geom.util.ArrowSpec.Type.' + name);\n }\n }\n ArrowSpec$Type.valueOf_61zpoe$ = ArrowSpec$Type$valueOf;\n ArrowSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ArrowSpec',\n interfaces: []\n };\n function BarTooltipHelper() {\n BarTooltipHelper_instance = this;\n }\n BarTooltipHelper.prototype.collectRectangleTargets_mj9gdb$ = function (hintAesList, aesthetics, pos, coord, ctx, rectFactory, colorFactory) {\n var tmp$, tmp$_0;\n var helper = new GeomHelper(pos, coord, ctx);\n tmp$ = aesthetics.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n tmp$_0 = rectFactory(p);\n if (tmp$_0 == null) {\n continue;\n }var rect = tmp$_0;\n var clientRect = helper.toClient_ioi29i$(DoubleRectangle_init(0.0, 0.0, rect.width, 0.0), p);\n var objectRadius = clientRect.width / 2.0;\n var xCoord = rect.center.x;\n var hintFactory = (new HintsCollection$HintConfigFactory()).defaultObjectRadius_14dthe$(objectRadius).defaultX_14dthe$(xCoord).defaultKind_nnfttk$(TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance());\n var tmp$_1;\n var accumulator = new HintsCollection(p, helper);\n tmp$_1 = hintAesList.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n accumulator = accumulator.addHint_p9kkqu$(hintFactory.create_vktour$(element));\n }\n var hintConfigs = accumulator;\n ctx.targetCollector.addRectangle_bxzvr8$(p.index(), helper.toClient_ioi29i$(rect, p), GeomTargetCollector$TooltipParams$Companion_getInstance().params().setTipLayoutHints_vgcgsc$(hintConfigs.hints).setColor_98b62m$(colorFactory(p)));\n }\n };\n BarTooltipHelper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'BarTooltipHelper',\n interfaces: []\n };\n var BarTooltipHelper_instance = null;\n function BarTooltipHelper_getInstance() {\n if (BarTooltipHelper_instance === null) {\n new BarTooltipHelper();\n }return BarTooltipHelper_instance;\n }\n function CrossBarHelper() {\n CrossBarHelper_instance = this;\n }\n CrossBarHelper.prototype.buildBoxes_sm51l0$ = function (root, aesthetics, pos, coord, ctx, rectFactory) {\n var helper = new RectanglesHelper(aesthetics, pos, coord, ctx);\n var rectangles = helper.createRectangles_rezc4r$(rectFactory);\n var tmp$;\n tmp$ = rectangles.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n root.add_26jijc$(element);\n }\n };\n CrossBarHelper.prototype.buildMidlines_z5ejb9$ = function (root, aesthetics, pos, coord, ctx, fatten) {\n var tmp$;\n var helper = new GeomHelper(pos, coord, ctx);\n var elementHelper = helper.createSvgElementHelper();\n tmp$ = GeomUtil_getInstance().withDefined_7jazl$(aesthetics.dataPoints(), Aes$Companion_getInstance().X, Aes$Companion_getInstance().WIDTH, Aes$Companion_getInstance().MIDDLE).iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var x = ensureNotNull(p.x());\n var middle = ensureNotNull(p.middle());\n var width = GeomUtil_getInstance().widthPx_c6teas$(p, ctx, 2.0);\n var line = elementHelper.createLine_ollnar$(new DoubleVector(x - width / 2, middle), new DoubleVector(x + width / 2, middle), p);\n var thickness = ensureNotNull(line.strokeWidth().get());\n line.strokeWidth().set_11rb$(thickness * fatten);\n root.add_26jijc$(line);\n }\n };\n CrossBarHelper.prototype.legendFactory_6taknv$ = function (whiskers) {\n return new CrossBarLegendKeyElementFactory(whiskers);\n };\n CrossBarHelper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'CrossBarHelper',\n interfaces: []\n };\n var CrossBarHelper_instance = null;\n function CrossBarHelper_getInstance() {\n if (CrossBarHelper_instance === null) {\n new CrossBarHelper();\n }return CrossBarHelper_instance;\n }\n function CrossBarLegendKeyElementFactory(whiskers) {\n this.whiskers = whiskers;\n }\n CrossBarLegendKeyElementFactory.prototype.createKeyElement_s1fn0c$ = function (p, size) {\n var whiskerSize = 0.2;\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var width = (size.x - strokeWidth) * 0.8;\n var height = size.y - strokeWidth;\n var x = (size.x - width) / 2;\n var y = strokeWidth / 2;\n var boxHeight = height;\n var boxY = y;\n if (this.whiskers) {\n boxHeight = height * (1 - 2 * whiskerSize);\n boxY = y + height * whiskerSize;\n }var rect = SvgRectElement_init(x, boxY, width, boxHeight);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(rect, p);\n var middleY = y + height * 0.5;\n var middle = SvgLineElement_init(x, middleY, x + width, middleY);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(middle, p);\n var g = new SvgGElement();\n g.children().add_11rb$(rect);\n g.children().add_11rb$(middle);\n if (this.whiskers) {\n var middleX = x + width * 0.5;\n var lowerWhisker = SvgLineElement_init(middleX, y + height * (1 - whiskerSize), middleX, y + height);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(lowerWhisker, p);\n var upperWhisker = SvgLineElement_init(middleX, y, middleX, y + height * whiskerSize);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(upperWhisker, p);\n g.children().add_11rb$(lowerWhisker);\n g.children().add_11rb$(upperWhisker);\n }return g;\n };\n CrossBarLegendKeyElementFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CrossBarLegendKeyElementFactory',\n interfaces: [LegendKeyElementFactory]\n };\n function DataPointAestheticsDelegate(p) {\n this.p_bcayt6$_0 = p;\n }\n DataPointAestheticsDelegate.prototype.index = function () {\n return this.p_bcayt6$_0.index();\n };\n DataPointAestheticsDelegate.prototype.x = function () {\n return this.p_bcayt6$_0.x();\n };\n DataPointAestheticsDelegate.prototype.y = function () {\n return this.p_bcayt6$_0.y();\n };\n DataPointAestheticsDelegate.prototype.z = function () {\n return this.p_bcayt6$_0.z();\n };\n DataPointAestheticsDelegate.prototype.ymin = function () {\n return this.p_bcayt6$_0.ymin();\n };\n DataPointAestheticsDelegate.prototype.ymax = function () {\n return this.p_bcayt6$_0.ymax();\n };\n DataPointAestheticsDelegate.prototype.color = function () {\n return this.p_bcayt6$_0.color();\n };\n DataPointAestheticsDelegate.prototype.fill = function () {\n return this.p_bcayt6$_0.fill();\n };\n DataPointAestheticsDelegate.prototype.alpha = function () {\n return this.p_bcayt6$_0.alpha();\n };\n DataPointAestheticsDelegate.prototype.shape = function () {\n return this.p_bcayt6$_0.shape();\n };\n DataPointAestheticsDelegate.prototype.lineType = function () {\n return this.p_bcayt6$_0.lineType();\n };\n DataPointAestheticsDelegate.prototype.size = function () {\n return this.p_bcayt6$_0.size();\n };\n DataPointAestheticsDelegate.prototype.width = function () {\n return this.p_bcayt6$_0.width();\n };\n DataPointAestheticsDelegate.prototype.height = function () {\n return this.p_bcayt6$_0.height();\n };\n DataPointAestheticsDelegate.prototype.weight = function () {\n return this.p_bcayt6$_0.weight();\n };\n DataPointAestheticsDelegate.prototype.intercept = function () {\n return this.p_bcayt6$_0.intercept();\n };\n DataPointAestheticsDelegate.prototype.slope = function () {\n return this.p_bcayt6$_0.slope();\n };\n DataPointAestheticsDelegate.prototype.interceptX = function () {\n return this.p_bcayt6$_0.interceptX();\n };\n DataPointAestheticsDelegate.prototype.interceptY = function () {\n return this.p_bcayt6$_0.interceptY();\n };\n DataPointAestheticsDelegate.prototype.lower = function () {\n return this.p_bcayt6$_0.lower();\n };\n DataPointAestheticsDelegate.prototype.middle = function () {\n return this.p_bcayt6$_0.middle();\n };\n DataPointAestheticsDelegate.prototype.upper = function () {\n return this.p_bcayt6$_0.upper();\n };\n DataPointAestheticsDelegate.prototype.frame = function () {\n return this.p_bcayt6$_0.frame();\n };\n DataPointAestheticsDelegate.prototype.speed = function () {\n return this.p_bcayt6$_0.speed();\n };\n DataPointAestheticsDelegate.prototype.flow = function () {\n return this.p_bcayt6$_0.flow();\n };\n DataPointAestheticsDelegate.prototype.xmin = function () {\n return this.p_bcayt6$_0.xmin();\n };\n DataPointAestheticsDelegate.prototype.xmax = function () {\n return this.p_bcayt6$_0.xmax();\n };\n DataPointAestheticsDelegate.prototype.xend = function () {\n return this.p_bcayt6$_0.xend();\n };\n DataPointAestheticsDelegate.prototype.yend = function () {\n return this.p_bcayt6$_0.yend();\n };\n DataPointAestheticsDelegate.prototype.label = function () {\n return this.p_bcayt6$_0.label();\n };\n DataPointAestheticsDelegate.prototype.family = function () {\n return this.p_bcayt6$_0.family();\n };\n DataPointAestheticsDelegate.prototype.fontface = function () {\n return this.p_bcayt6$_0.fontface();\n };\n DataPointAestheticsDelegate.prototype.hjust = function () {\n return this.p_bcayt6$_0.hjust();\n };\n DataPointAestheticsDelegate.prototype.vjust = function () {\n return this.p_bcayt6$_0.vjust();\n };\n DataPointAestheticsDelegate.prototype.angle = function () {\n return this.p_bcayt6$_0.angle();\n };\n DataPointAestheticsDelegate.prototype.symX = function () {\n return this.p_bcayt6$_0.symX();\n };\n DataPointAestheticsDelegate.prototype.symY = function () {\n return this.p_bcayt6$_0.symY();\n };\n DataPointAestheticsDelegate.prototype.group = function () {\n return this.p_bcayt6$_0.group();\n };\n DataPointAestheticsDelegate.prototype.numeric_vktour$ = function (aes) {\n return this.p_bcayt6$_0.numeric_vktour$(aes);\n };\n DataPointAestheticsDelegate.prototype.get_31786j$ = function (aes) {\n return this.p_bcayt6$_0.get_31786j$(aes);\n };\n DataPointAestheticsDelegate.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataPointAestheticsDelegate',\n interfaces: [DataPointAesthetics]\n };\n function GeomCoord(myCoord) {\n this.myCoord_0 = myCoord;\n }\n GeomCoord.prototype.toClient_gpjtzr$ = function (p) {\n return this.myCoord_0.toClient_gpjtzr$(p);\n };\n GeomCoord.prototype.fromClient_xoefl8$ = function (location) {\n return this.myCoord_0.fromClient_gpjtzr$(location);\n };\n function GeomCoord$toClient$lambda(this$GeomCoord) {\n return function (coord) {\n return this$GeomCoord.myCoord_0.toClient_gpjtzr$(coord);\n };\n }\n GeomCoord.prototype.toClient_wthzt5$ = function (r) {\n return this.translateRect_0(r, GeomCoord$toClient$lambda(this));\n };\n function GeomCoord$fromClient$lambda(this$GeomCoord) {\n return function (coord) {\n return this$GeomCoord.myCoord_0.fromClient_gpjtzr$(coord);\n };\n }\n GeomCoord.prototype.fromClient_wthzt5$ = function (r) {\n return this.translateRect_0(r, GeomCoord$fromClient$lambda(this));\n };\n GeomCoord.prototype.translateRect_0 = function (r, toLocation) {\n var r_0 = r;\n var xy1 = r_0.origin;\n var xy2 = new DoubleVector(r_0.right, r_0.bottom);\n var xy1cl = toLocation(xy1);\n var xy2cl = toLocation(xy2);\n if (!(xy1 != null ? xy1.equals(xy1cl) : null) || !(xy2 != null ? xy2.equals(xy2cl) : null)) {\n var a = xy1cl.x;\n var b = xy2cl.x;\n var xMin = JsMath.min(a, b);\n var a_0 = xy1cl.y;\n var b_0 = xy2cl.y;\n var yMin = JsMath.min(a_0, b_0);\n var a_1 = xy1cl.x;\n var b_1 = xy2cl.x;\n var xMax = JsMath.max(a_1, b_1);\n var a_2 = xy1cl.y;\n var b_2 = xy2cl.y;\n var yMax = JsMath.max(a_2, b_2);\n r_0 = DoubleRectangle_init(xMin, yMin, xMax - xMin, yMax - yMin);\n }return r_0;\n };\n GeomCoord.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomCoord',\n interfaces: []\n };\n function GeomHelper(myPos, coord, ctx) {\n GeomHelper$Companion_getInstance();\n this.myPos_ts7al2$_0 = myPos;\n this.ctx = ctx;\n this.myGeomCoord_mnazw1$_0 = new GeomCoord(coord);\n }\n GeomHelper.prototype.toClient_tkjljq$ = function (location, p) {\n return this.myGeomCoord_mnazw1$_0.toClient_gpjtzr$(this.adjust_umm47c$_0(location, p, this.myPos_ts7al2$_0, this.ctx));\n };\n GeomHelper.prototype.toClient_vf7nkp$ = function (x, y, p) {\n var location = new DoubleVector(ensureNotNull(x), ensureNotNull(y));\n return this.myGeomCoord_mnazw1$_0.toClient_gpjtzr$(this.adjust_umm47c$_0(location, p, this.myPos_ts7al2$_0, this.ctx));\n };\n GeomHelper.prototype.toClient_ioi29i$ = function (r, p) {\n var clientRect = this.myGeomCoord_mnazw1$_0.toClient_wthzt5$(this.adjust_en6it6$_0(r, p, this.myPos_ts7al2$_0, this.ctx));\n if (clientRect.width === 0.0) {\n clientRect = DoubleRectangle_init(clientRect.origin.x, clientRect.origin.y, 0.1, clientRect.height);\n }if (clientRect.height === 0.0) {\n clientRect = DoubleRectangle_init(clientRect.origin.x, clientRect.origin.y, clientRect.width, 0.1);\n }return clientRect;\n };\n GeomHelper.prototype.fromClient_gpjtzr$ = function (location) {\n return this.myGeomCoord_mnazw1$_0.fromClient_xoefl8$(location);\n };\n GeomHelper.prototype.adjust_umm47c$_0 = function (location, p, pos, ctx) {\n return pos.translate_tshsjz$(location, p, ctx);\n };\n GeomHelper.prototype.toClientRect_7iz5gz$ = function (p, aesMapper) {\n var tmp$;\n tmp$ = aesMapper(p);\n if (tmp$ == null) {\n return null;\n }var r = tmp$;\n return this.toClient_ioi29i$(r, p);\n };\n GeomHelper.prototype.adjust_en6it6$_0 = function (r, p, pos, ctx) {\n var leftTop = pos.translate_tshsjz$(r.origin, p, ctx);\n var rightBottom = pos.translate_tshsjz$(r.origin.add_gpjtzr$(r.dimension), p, ctx);\n return DoubleRectangle.Companion.span_qt8ska$(leftTop, rightBottom);\n };\n GeomHelper.prototype.project_rrreuh$ = function (dataPoints, projection) {\n var tmp$;\n var points = ArrayList_init();\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var location = projection(p);\n if (location != null) {\n var pp = this.toClient_tkjljq$(location, p);\n points.add_11rb$(pp);\n }}\n return points;\n };\n function GeomHelper$toClientLocation$lambda(closure$aesMapper, this$GeomHelper) {\n return function (aes) {\n var location = closure$aesMapper(aes);\n if (location != null) {\n return this$GeomHelper.toClient_tkjljq$(location, aes);\n } else {\n return null;\n }\n };\n }\n GeomHelper.prototype.toClientLocation_sfitzs$ = function (aesMapper) {\n return GeomHelper$toClientLocation$lambda(aesMapper, this);\n };\n GeomHelper.prototype.createSvgElementHelper = function () {\n return new GeomHelper$SvgElementHelper(this);\n };\n GeomHelper.prototype.toClient_je5qx7$ = function (locations, p) {\n var tmp$;\n var localLocations = ArrayList_init();\n tmp$ = locations.iterator();\n while (tmp$.hasNext()) {\n var location = tmp$.next();\n localLocations.add_11rb$(this.toClient_tkjljq$(location, p));\n }\n return localLocations;\n };\n function GeomHelper$SvgElementHelper($outer) {\n this.$outer = $outer;\n this.myStrokeAlphaEnabled_0 = false;\n }\n GeomHelper$SvgElementHelper.prototype.setStrokeAlphaEnabled_6taknv$ = function (b) {\n this.myStrokeAlphaEnabled_0 = b;\n };\n GeomHelper$SvgElementHelper.prototype.createLine_ollnar$ = function (start, end, p) {\n var start_0 = this.$outer.toClient_tkjljq$(start, p);\n var end_0 = this.$outer.toClient_tkjljq$(end, p);\n var line = SvgLineElement_init(start_0.x, start_0.y, end_0.x, end_0.y);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(line, p, this.myStrokeAlphaEnabled_0);\n return line;\n };\n GeomHelper$SvgElementHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SvgElementHelper',\n interfaces: []\n };\n function GeomHelper$Companion() {\n GeomHelper$Companion_instance = this;\n this.HJUST_MAP = mapOf([to('right', TextLabel$HorizontalAnchor$RIGHT_getInstance()), to('middle', TextLabel$HorizontalAnchor$MIDDLE_getInstance()), to('left', TextLabel$HorizontalAnchor$LEFT_getInstance()), to(0.0, TextLabel$HorizontalAnchor$RIGHT_getInstance()), to(0.5, TextLabel$HorizontalAnchor$MIDDLE_getInstance()), to(1.0, TextLabel$HorizontalAnchor$LEFT_getInstance())]);\n this.VJUST_MAP = mapOf([to('bottom', TextLabel$VerticalAnchor$BOTTOM_getInstance()), to('center', TextLabel$VerticalAnchor$CENTER_getInstance()), to('top', TextLabel$VerticalAnchor$TOP_getInstance()), to(0.0, TextLabel$VerticalAnchor$BOTTOM_getInstance()), to(0.5, TextLabel$VerticalAnchor$CENTER_getInstance()), to(1.0, TextLabel$VerticalAnchor$TOP_getInstance())]);\n this.FONT_WEIGHT_SET_0 = setOf(['bold', 'bolder', 'lighter']);\n this.FONT_STYLE_SET_0 = setOf(['italic', 'oblique']);\n this.FONT_FAMILY_MAP_0 = mapOf([to('sans', 'sans-serif'), to('serif', 'serif'), to('mono', 'monospace')]);\n }\n GeomHelper$Companion.prototype.decorate_ijkgsm$ = function (label, p, scale) {\n if (scale === void 0)\n scale = 1.0;\n var tmp$, tmp$_0;\n label.textColor().set_11rb$(p.color());\n label.textOpacity().set_11rb$(p.alpha());\n label.setFontSize_14dthe$(AesScaling_getInstance().textSize_l6g9mh$(p) * scale);\n var family = p.family();\n if (this.FONT_FAMILY_MAP_0.containsKey_11rb$(family)) {\n family = ensureNotNull(this.FONT_FAMILY_MAP_0.get_11rb$(family));\n }label.setFontFamily_pdl1vj$(family);\n var fontface = p.fontface();\n if (!base.Strings.isNullOrEmpty_pdl1vj$(fontface)) {\n var $receiver = Regex_init(' ').split_905azu$(fontface, 0);\n var dropLastWhile$result;\n dropLastWhile$break: do {\n if (!$receiver.isEmpty()) {\n var iterator = $receiver.listIterator_za3lpa$($receiver.size);\n while (iterator.hasPrevious()) {\n if (!(iterator.previous().length === 0)) {\n dropLastWhile$result = take($receiver, iterator.nextIndex() + 1 | 0);\n break dropLastWhile$break;\n }}\n }dropLastWhile$result = emptyList();\n }\n while (false);\n tmp$ = copyToArray(dropLastWhile$result);\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var s = tmp$[tmp$_0];\n if (this.FONT_WEIGHT_SET_0.contains_11rb$(s)) {\n label.setFontWeight_pdl1vj$(s);\n } else if (this.FONT_STYLE_SET_0.contains_11rb$(s)) {\n label.setFontStyle_pdl1vj$(s);\n }}\n }var hAnchor = this.textLabelAnchor_3zqsx9$(p.hjust(), this.HJUST_MAP, TextLabel$HorizontalAnchor$MIDDLE_getInstance());\n var vAnchor = this.textLabelAnchor_3zqsx9$(p.vjust(), this.VJUST_MAP, TextLabel$VerticalAnchor$CENTER_getInstance());\n if (hAnchor !== TextLabel$HorizontalAnchor$LEFT_getInstance()) {\n label.setHorizontalAnchor_ja80zo$(hAnchor);\n }if (vAnchor !== TextLabel$VerticalAnchor$BOTTOM_getInstance()) {\n label.setVerticalAnchor_yaudma$(vAnchor);\n }var angle = ensureNotNull(p.angle());\n if (angle !== 0.0) {\n angle = 360 - angle % 360;\n label.rotate_14dthe$(angle);\n }};\n GeomHelper$Companion.prototype.textLabelAnchor_3zqsx9$ = function (o, conversionMap, def) {\n var tmp$;\n return (tmp$ = conversionMap.get_11rb$(o)) != null ? tmp$ : def;\n };\n GeomHelper$Companion.prototype.decorate_d9jm6k$ = function (node, p, applyAlphaToAll) {\n if (applyAlphaToAll === void 0)\n applyAlphaToAll = AestheticsUtil_getInstance().ALPHA_CONTROLS_BOTH_8be2vx$;\n var tmp$;\n if (Kotlin.isType(node, SvgShape)) {\n this.decorateShape_0(Kotlin.isType(tmp$ = node, SvgShape) ? tmp$ : throwCCE(), p, applyAlphaToAll);\n }if (Kotlin.isType(node, SvgElement)) {\n var lineType = p.lineType();\n if (!(lineType.isBlank || lineType.isSolid)) {\n StrokeDashArraySupport_getInstance().apply_3xqz7j$(node, AesScaling_getInstance().strokeWidth_l6g9mh$(p), lineType.dashArray);\n }}};\n GeomHelper$Companion.prototype.decorateShape_0 = function (shape, p, applyAlphaToAll) {\n AestheticsUtil_getInstance().updateStroke_g0plfl$(shape, p, applyAlphaToAll);\n AestheticsUtil_getInstance().updateFill_v4tjbc$(shape, p);\n shape.strokeWidth().set_11rb$(AesScaling_getInstance().strokeWidth_l6g9mh$(p));\n };\n GeomHelper$Companion.prototype.decorateSlimShape_gb6c9f$ = function (shape, p) {\n var stroke = ensureNotNull(p.color());\n var strokeAlpha = AestheticsUtil_getInstance().alpha_il6rhx$(stroke, p);\n var fill = ensureNotNull(p.fill());\n var fillAlpha = AestheticsUtil_getInstance().alpha_il6rhx$(fill, p);\n shape.setFill_o14uds$(fill, fillAlpha);\n shape.setStroke_o14uds$(stroke, strokeAlpha);\n shape.setStrokeWidth_14dthe$(AesScaling_getInstance().strokeWidth_l6g9mh$(p));\n };\n GeomHelper$Companion.prototype.getSizeUnitAes_61zpoe$ = function (sizeUnitName) {\n var tmp$;\n switch (sizeUnitName.toLowerCase()) {\n case 'x':\n tmp$ = Aes$Companion_getInstance().X;\n break;\n case 'y':\n tmp$ = Aes$Companion_getInstance().Y;\n break;\n default:throw IllegalStateException_init((\"Size unit value must be either 'x' or 'y', but was \" + sizeUnitName + '.').toString());\n }\n return tmp$;\n };\n GeomHelper$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomHelper$Companion_instance = null;\n function GeomHelper$Companion_getInstance() {\n if (GeomHelper$Companion_instance === null) {\n new GeomHelper$Companion();\n }return GeomHelper$Companion_instance;\n }\n GeomHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomHelper',\n interfaces: []\n };\n function GeomUtil() {\n GeomUtil_instance = this;\n this.TO_LOCATION_X_Y = GeomUtil$TO_LOCATION_X_Y$lambda(this);\n this.TO_LOCATION_X_YMIN = GeomUtil$TO_LOCATION_X_YMIN$lambda(this);\n this.TO_LOCATION_X_YMAX = GeomUtil$TO_LOCATION_X_YMAX$lambda(this);\n this.TO_LOCATION_X_ZERO = GeomUtil$TO_LOCATION_X_ZERO$lambda(this);\n this.TO_RECTANGLE = GeomUtil$TO_RECTANGLE$lambda(this);\n this.ORDERING_X_0 = Ordering.Companion.from_iajr8b$(new GeomUtil$ORDERING_X$ObjectLiteral());\n this.ORDERING_Y_0 = Ordering.Companion.from_iajr8b$(new GeomUtil$ORDERING_Y$ObjectLiteral());\n this.WITH_X_Y_0 = GeomUtil$WITH_X_Y$lambda;\n this.WITH_X_0 = GeomUtil$WITH_X$lambda;\n this.WITH_Y_0 = GeomUtil$WITH_Y$lambda;\n }\n GeomUtil.prototype.toLocationOrNull_0 = function (x, y) {\n var tmp$;\n if (data.SeriesUtil.isFinite_yrwdxb$(x) && data.SeriesUtil.isFinite_yrwdxb$(y)) {\n tmp$ = new DoubleVector(ensureNotNull(x), ensureNotNull(y));\n } else\n tmp$ = null;\n return tmp$;\n };\n GeomUtil.prototype.with_X_Y_83glv4$ = function (dataPoints) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (this.WITH_X_Y_0(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.with_X_83glv4$ = function (dataPoints) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (this.WITH_X_0(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.with_Y_83glv4$ = function (dataPoints) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (this.WITH_Y_0(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.ordered_X_83glv4$ = function (dataPoints) {\n if (this.ORDERING_X_0.isOrdered_p1ys8y$(dataPoints)) {\n return dataPoints;\n }return this.ORDERING_X_0.sortedCopy_m5x2f4$(dataPoints);\n };\n GeomUtil.prototype.ordered_Y_hku6c7$ = function (dataPoints, reversed) {\n var ordering = reversed ? this.ORDERING_Y_0.reverse() : this.ORDERING_Y_0;\n if (ordering.isOrdered_p1ys8y$(dataPoints)) {\n return dataPoints;\n }return ordering.sortedCopy_m5x2f4$(dataPoints);\n };\n GeomUtil.prototype.widthPx_c6teas$ = function (p, ctx, minWidth) {\n var w = p.width();\n var width = ensureNotNull(w) * ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n return JsMath.max(width, minWidth);\n };\n GeomUtil.prototype.withDefined_2oeq97$ = function (dataPoints, aes) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.defined_896ixz$(aes))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.withDefined_fl3lpi$ = function (dataPoints, aes0, aes1) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.defined_896ixz$(aes0) && element.defined_896ixz$(aes1))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.withDefined_7jazl$ = function (dataPoints, aes0, aes1, aes2) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.defined_896ixz$(aes0) && element.defined_896ixz$(aes1) && element.defined_896ixz$(aes2))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.withDefined_i1kplo$ = function (dataPoints, aes0, aes1, aes2, aes3) {\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.defined_896ixz$(aes0) && element.defined_896ixz$(aes1) && element.defined_896ixz$(aes2) && element.defined_896ixz$(aes3))\n destination.add_11rb$(element);\n }\n return destination;\n };\n GeomUtil.prototype.rectangleByDataPoint_dyn5n6$ = function (p, ctx) {\n var x = ensureNotNull(p.x());\n var y = ensureNotNull(p.y());\n var width = this.widthPx_c6teas$(p, ctx, 2.0);\n var origin;\n var dimensions;\n if (y >= 0) {\n origin = new DoubleVector(x - width / 2, 0.0);\n dimensions = new DoubleVector(width, y);\n } else {\n origin = new DoubleVector(x - width / 2, y);\n dimensions = new DoubleVector(width, -y);\n }\n return new DoubleRectangle(origin, dimensions);\n };\n GeomUtil.prototype.createGroups_83glv4$ = function (dataPoints) {\n var tmp$;\n var pointsByGroup = HashMap_init();\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var group = ensureNotNull(p.group());\n if (!pointsByGroup.containsKey_11rb$(group)) {\n var value = ArrayList_init();\n pointsByGroup.put_xwzc9p$(group, value);\n }ensureNotNull(pointsByGroup.get_11rb$(group)).add_11rb$(p);\n }\n return pointsByGroup;\n };\n GeomUtil.prototype.rectToGeometry_6y0v78$ = function (minX, minY, maxX, maxY) {\n return listOf([new DoubleVector(minX, minY), new DoubleVector(minX, maxY), new DoubleVector(maxX, maxY), new DoubleVector(maxX, minY), new DoubleVector(minX, minY)]);\n };\n function GeomUtil$TO_LOCATION_X_Y$lambda(this$GeomUtil) {\n return function (p) {\n return this$GeomUtil.toLocationOrNull_0(p.x(), p.y());\n };\n }\n function GeomUtil$TO_LOCATION_X_YMIN$lambda(this$GeomUtil) {\n return function (p) {\n return this$GeomUtil.toLocationOrNull_0(p.x(), p.ymin());\n };\n }\n function GeomUtil$TO_LOCATION_X_YMAX$lambda(this$GeomUtil) {\n return function (p) {\n return this$GeomUtil.toLocationOrNull_0(p.x(), p.ymax());\n };\n }\n function GeomUtil$TO_LOCATION_X_ZERO$lambda(this$GeomUtil) {\n return function (p) {\n return this$GeomUtil.toLocationOrNull_0(p.x(), 0.0);\n };\n }\n function GeomUtil$TO_RECTANGLE$lambda(this$GeomUtil) {\n return function (p) {\n if (data.SeriesUtil.allFinite_rd1tgs$(p.xmin(), p.ymin(), p.xmax(), p.ymax())) {\n return this$GeomUtil.rectToGeometry_6y0v78$(ensureNotNull(p.xmin()), ensureNotNull(p.ymin()), ensureNotNull(p.xmax()), ensureNotNull(p.ymax()));\n } else {\n return emptyList();\n }\n };\n }\n function GeomUtil$ORDERING_X$ObjectLiteral() {\n }\n GeomUtil$ORDERING_X$ObjectLiteral.prototype.compare = function (a, b) {\n var x1 = a != null ? a.x() : null;\n var x2 = b != null ? b.x() : null;\n if (x1 == null || x2 == null)\n return 0;\n else\n return Kotlin.compareTo(x1, x2);\n };\n GeomUtil$ORDERING_X$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Comparator]\n };\n function GeomUtil$ORDERING_Y$ObjectLiteral() {\n }\n GeomUtil$ORDERING_Y$ObjectLiteral.prototype.compare = function (a, b) {\n var y1 = a != null ? a.y() : null;\n var y2 = b != null ? b.y() : null;\n if (y1 == null || y2 == null)\n return 0;\n else\n return Kotlin.compareTo(y1, y2);\n };\n GeomUtil$ORDERING_Y$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Comparator]\n };\n function GeomUtil$WITH_X_Y$lambda(pointAes) {\n return data.SeriesUtil.allFinite_jma9l8$(pointAes.x(), pointAes.y());\n }\n function GeomUtil$WITH_X$lambda(pointAes) {\n return data.SeriesUtil.isFinite_yrwdxb$(pointAes.x());\n }\n function GeomUtil$WITH_Y$lambda(pointAes) {\n return data.SeriesUtil.isFinite_yrwdxb$(pointAes.y());\n }\n GeomUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GeomUtil',\n interfaces: []\n };\n var GeomUtil_instance = null;\n function GeomUtil_getInstance() {\n if (GeomUtil_instance === null) {\n new GeomUtil();\n }return GeomUtil_instance;\n }\n function HintColorUtil() {\n HintColorUtil_instance = this;\n }\n HintColorUtil.prototype.fromColor_l6g9mh$ = function (p) {\n return this.fromColorValue_o14uds$(ensureNotNull(p.color()), ensureNotNull(p.alpha()));\n };\n HintColorUtil.prototype.fromFill_l6g9mh$ = function (p) {\n return this.fromColorValue_o14uds$(ensureNotNull(p.fill()), ensureNotNull(p.alpha()));\n };\n HintColorUtil.prototype.fromColorValue_o14uds$ = function (color, alpha) {\n var tmp$;\n var intAlpha = numberToInt(255 * alpha);\n if (values.Colors.solid_98b62m$(color)) {\n tmp$ = color.changeAlpha_za3lpa$(intAlpha);\n } else\n tmp$ = color;\n return tmp$;\n };\n HintColorUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'HintColorUtil',\n interfaces: []\n };\n var HintColorUtil_instance = null;\n function HintColorUtil_getInstance() {\n if (HintColorUtil_instance === null) {\n new HintColorUtil();\n }return HintColorUtil_instance;\n }\n function HintsCollection(myPoint, myHelper) {\n this.myPoint_0 = myPoint;\n this.myHelper_0 = myHelper;\n this.myHints_0 = HashMap_init();\n }\n Object.defineProperty(HintsCollection.prototype, 'hints', {\n configurable: true,\n get: function () {\n return this.myHints_0;\n }\n });\n HintsCollection.prototype.addHint_p9kkqu$ = function (hintConfig) {\n var coord = this.getCoord_0(hintConfig);\n if (coord != null) {\n var $receiver = this.hints;\n var key = hintConfig.aes;\n var value = this.createHint_0(hintConfig, coord);\n $receiver.put_xwzc9p$(key, value);\n }return this;\n };\n HintsCollection.prototype.getCoord_0 = function (hintConfig) {\n var tmp$;\n if (hintConfig.x == null) {\n throw IllegalArgumentException_init('x coord is not set');\n }var aes = hintConfig.aes;\n if (!this.myPoint_0.defined_896ixz$(aes)) {\n tmp$ = null;\n } else\n tmp$ = this.myHelper_0.toClient_tkjljq$(new DoubleVector(ensureNotNull(hintConfig.x), ensureNotNull(this.myPoint_0.get_31786j$(aes))), this.myPoint_0);\n return tmp$;\n };\n HintsCollection.prototype.createHint_0 = function (hintConfig, coord) {\n var tmp$, tmp$_0;\n var objectRadius = hintConfig.objectRadius;\n var color = hintConfig.color_8be2vx$;\n if (objectRadius == null) {\n throw IllegalArgumentException_init('object radius is not set');\n }tmp$ = hintConfig.kind;\n if (equals(tmp$, TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance()))\n tmp$_0 = TipLayoutHint$Companion_getInstance().verticalTooltip_6lq1u6$(coord, objectRadius, color);\n else if (equals(tmp$, TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance()))\n tmp$_0 = TipLayoutHint$Companion_getInstance().horizontalTooltip_6lq1u6$(coord, objectRadius, color);\n else if (equals(tmp$, TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance()))\n tmp$_0 = TipLayoutHint$Companion_getInstance().cursorTooltip_itpcqk$(coord, color);\n else\n throw IllegalArgumentException_init('Unknown hint kind: ' + toString(hintConfig.kind));\n return tmp$_0;\n };\n function HintsCollection$HintConfigFactory() {\n this.myDefaultObjectRadius_0 = null;\n this.myDefaultX_0 = null;\n this.myDefaultColor_0 = null;\n this.myDefaultKind_0 = null;\n }\n HintsCollection$HintConfigFactory.prototype.defaultObjectRadius_14dthe$ = function (defaultObjectRadius) {\n this.myDefaultObjectRadius_0 = defaultObjectRadius;\n return this;\n };\n HintsCollection$HintConfigFactory.prototype.defaultX_14dthe$ = function (defaultX) {\n this.myDefaultX_0 = defaultX;\n return this;\n };\n HintsCollection$HintConfigFactory.prototype.defaultColor_yo1m5r$ = function (v, alpha) {\n if (alpha != null) {\n this.myDefaultColor_0 = v.changeAlpha_za3lpa$(numberToInt(255 * alpha));\n } else {\n this.myDefaultColor_0 = v;\n }\n return this;\n };\n HintsCollection$HintConfigFactory.prototype.create_vktour$ = function (aes) {\n return new HintsCollection$HintConfigFactory$HintConfig(this, aes);\n };\n HintsCollection$HintConfigFactory.prototype.defaultKind_nnfttk$ = function (kind) {\n this.myDefaultKind_0 = kind;\n return this;\n };\n function HintsCollection$HintConfigFactory$HintConfig($outer, aes) {\n this.$outer = $outer;\n this.aes = aes;\n this.kind = null;\n this.objectRadius_u2tfw5$_0 = null;\n this.x_is741i$_0 = null;\n this.color_8be2vx$_ng3d4v$_0 = null;\n this.objectRadius = this.$outer.myDefaultObjectRadius_0;\n this.x = this.$outer.myDefaultX_0;\n this.kind = this.$outer.myDefaultKind_0;\n this.color_8be2vx$ = this.$outer.myDefaultColor_0;\n }\n Object.defineProperty(HintsCollection$HintConfigFactory$HintConfig.prototype, 'objectRadius', {\n configurable: true,\n get: function () {\n return this.objectRadius_u2tfw5$_0;\n },\n set: function (objectRadius) {\n this.objectRadius_u2tfw5$_0 = objectRadius;\n }\n });\n Object.defineProperty(HintsCollection$HintConfigFactory$HintConfig.prototype, 'x', {\n configurable: true,\n get: function () {\n return this.x_is741i$_0;\n },\n set: function (x) {\n this.x_is741i$_0 = x;\n }\n });\n Object.defineProperty(HintsCollection$HintConfigFactory$HintConfig.prototype, 'color_8be2vx$', {\n configurable: true,\n get: function () {\n return this.color_8be2vx$_ng3d4v$_0;\n },\n set: function (color) {\n this.color_8be2vx$_ng3d4v$_0 = color;\n }\n });\n HintsCollection$HintConfigFactory$HintConfig.prototype.objectRadius_14dthe$ = function (v) {\n this.objectRadius = v;\n return this;\n };\n HintsCollection$HintConfigFactory$HintConfig.prototype.x_14dthe$ = function (v) {\n this.x = v;\n return this;\n };\n HintsCollection$HintConfigFactory$HintConfig.prototype.color_98b62m$ = function (v) {\n this.color_8be2vx$ = v;\n return this;\n };\n HintsCollection$HintConfigFactory$HintConfig.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HintConfig',\n interfaces: []\n };\n HintsCollection$HintConfigFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HintConfigFactory',\n interfaces: []\n };\n HintsCollection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HintsCollection',\n interfaces: []\n };\n function LinePathConstructor(myTargetCollector, myDataPoints, myLinesHelper, myClosePath) {\n LinePathConstructor$Companion_getInstance();\n this.myTargetCollector_0 = myTargetCollector;\n this.myDataPoints_0 = myDataPoints;\n this.myLinesHelper_0 = myLinesHelper;\n this.myClosePath_0 = myClosePath;\n }\n LinePathConstructor.prototype.construct_6taknv$ = function (withHints) {\n var tmp$;\n var linePaths = ArrayList_init();\n var multiPointDataList = this.createMultiPointDataByGroup_0();\n tmp$ = multiPointDataList.iterator();\n while (tmp$.hasNext()) {\n var multiPointData = tmp$.next();\n linePaths.addAll_brywnq$(this.myLinesHelper_0.createPaths_edlkk9$(multiPointData.aes, multiPointData.points, this.myClosePath_0));\n }\n if (withHints) {\n this.buildHints_0(multiPointDataList);\n }return linePaths;\n };\n LinePathConstructor.prototype.buildHints = function () {\n this.buildHints_0(this.createMultiPointDataByGroup_0());\n };\n LinePathConstructor.prototype.buildHints_0 = function (multiPointDataList) {\n var tmp$;\n tmp$ = multiPointDataList.iterator();\n while (tmp$.hasNext()) {\n var multiPointData = tmp$.next();\n if (this.myClosePath_0) {\n this.myTargetCollector_0.addPolygon_sa5m83$(multiPointData.points, multiPointData.localToGlobalIndex, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromFill_l6g9mh$(multiPointData.aes)));\n } else {\n this.myTargetCollector_0.addPath_sa5m83$(multiPointData.points, multiPointData.localToGlobalIndex, GeomTargetCollector$TooltipParams$Companion_getInstance().params().setColor_98b62m$(HintColorUtil_getInstance().fromColor_l6g9mh$(multiPointData.aes)));\n }\n }\n };\n function LinePathConstructor$createMultiPointDataByGroup$lambda(this$LinePathConstructor) {\n return function (p) {\n return this$LinePathConstructor.myLinesHelper_0.toClient_tkjljq$(ensureNotNull(GeomUtil_getInstance().TO_LOCATION_X_Y(p)), p);\n };\n }\n LinePathConstructor.prototype.createMultiPointDataByGroup_0 = function () {\n return MultiPointDataConstructor_getInstance().createMultiPointDataByGroup_ugj9hh$(this.myDataPoints_0, MultiPointDataConstructor_getInstance().singlePointAppender_v9bvvf$(LinePathConstructor$createMultiPointDataByGroup$lambda(this)), MultiPointDataConstructor_getInstance().reducer_8555vt$(LinePathConstructor$Companion_getInstance().DROP_POINT_DISTANCE_0, this.myClosePath_0));\n };\n function LinePathConstructor$Companion() {\n LinePathConstructor$Companion_instance = this;\n this.DROP_POINT_DISTANCE_0 = 0.999;\n }\n LinePathConstructor$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LinePathConstructor$Companion_instance = null;\n function LinePathConstructor$Companion_getInstance() {\n if (LinePathConstructor$Companion_instance === null) {\n new LinePathConstructor$Companion();\n }return LinePathConstructor$Companion_instance;\n }\n LinePathConstructor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinePathConstructor',\n interfaces: []\n };\n function LinesHelper(pos, coord, ctx) {\n GeomHelper.call(this, pos, coord, ctx);\n this.myAlphaFilter_nxoahd$_0 = LinesHelper$myAlphaFilter$lambda;\n this.myWidthFilter_sx37fb$_0 = LinesHelper$myWidthFilter$lambda;\n this.myAlphaEnabled_98jfa$_0 = true;\n }\n LinesHelper.prototype.insertPathSeparators_fr5rf4$_0 = function (rings) {\n var tmp$;\n var result = ArrayList_init();\n tmp$ = rings.iterator();\n while (tmp$.hasNext()) {\n var ring = tmp$.next();\n if (!result.isEmpty()) {\n result.add_11rb$(LinePath$Companion_getInstance().END_OF_SUBPATH);\n }result.addAll_brywnq$(ring);\n }\n return result;\n };\n LinesHelper.prototype.setAlphaEnabled_6taknv$ = function (b) {\n this.myAlphaEnabled_98jfa$_0 = b;\n };\n LinesHelper.prototype.createLines_rrreuh$ = function (dataPoints, toLocation) {\n return this.createPaths_gfkrhx$_0(dataPoints, toLocation, false);\n };\n function LinesHelper$createPaths$lambda(closure$toLocation) {\n return function (it) {\n return closure$toLocation(it);\n };\n }\n LinesHelper.prototype.createPaths_gfkrhx$_0 = function (dataPoints, toLocation, closePath) {\n var tmp$;\n var paths = ArrayList_init();\n var multiPointDataList = MultiPointDataConstructor_getInstance().createMultiPointDataByGroup_ugj9hh$(dataPoints, MultiPointDataConstructor_getInstance().singlePointAppender_v9bvvf$(this.toClientLocation_sfitzs$(LinesHelper$createPaths$lambda(toLocation))), MultiPointDataConstructor_getInstance().reducer_8555vt$(0.999, closePath));\n tmp$ = multiPointDataList.iterator();\n while (tmp$.hasNext()) {\n var multiPointData = tmp$.next();\n paths.addAll_brywnq$(this.createPaths_edlkk9$(multiPointData.aes, multiPointData.points, closePath));\n }\n return paths;\n };\n LinesHelper.prototype.createPaths_edlkk9$ = function (aes, points, closePath) {\n var paths = ArrayList_init();\n if (closePath) {\n paths.add_11rb$(LinePath$Companion_getInstance().polygon_yh26e7$(this.insertPathSeparators_fr5rf4$_0(splitRings(points))));\n } else {\n paths.add_11rb$(LinePath$Companion_getInstance().line_qdtdbw$(points));\n }\n var tmp$;\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.decorate_frjrd5$(element, aes, closePath);\n }\n return paths;\n };\n LinesHelper.prototype.createSteps_1fp004$ = function (dataPoints, dir) {\n var tmp$, tmp$_0;\n var pathInfos = ArrayList_init();\n var multiPointDataList = MultiPointDataConstructor_getInstance().createMultiPointDataByGroup_ugj9hh$(dataPoints, MultiPointDataConstructor_getInstance().singlePointAppender_v9bvvf$(this.toClientLocation_sfitzs$(GeomUtil_getInstance().TO_LOCATION_X_Y)), MultiPointDataConstructor_getInstance().reducer_8555vt$(0.999, false));\n tmp$ = multiPointDataList.iterator();\n while (tmp$.hasNext()) {\n var multiPointData = tmp$.next();\n var points = multiPointData.points;\n if (!points.isEmpty()) {\n var newPoints = ArrayList_init();\n var prev = null;\n tmp$_0 = points.iterator();\n while (tmp$_0.hasNext()) {\n var point = tmp$_0.next();\n if (prev != null) {\n var x = dir === StepGeom$Direction$HV_getInstance() ? point.x : prev.x;\n var y = dir === StepGeom$Direction$HV_getInstance() ? prev.y : point.y;\n newPoints.add_11rb$(new DoubleVector(x, y));\n }newPoints.add_11rb$(point);\n prev = point;\n }\n var path = LinePath$Companion_getInstance().line_qdtdbw$(newPoints);\n this.decorate_frjrd5$(path, multiPointData.aes, false);\n pathInfos.add_11rb$(new LinesHelper$PathInfo(path));\n }}\n return pathInfos;\n };\n function LinesHelper$createBands$lambda(closure$toLocationUpper) {\n return function (it) {\n return closure$toLocationUpper(it);\n };\n }\n function LinesHelper$createBands$lambda_0(closure$toLocationLower) {\n return function (it) {\n return closure$toLocationLower(it);\n };\n }\n LinesHelper.prototype.createBands_22uu1u$ = function (dataPoints, toLocationUpper, toLocationLower) {\n var tmp$;\n var lines = ArrayList_init();\n var pointsByGroup = GeomUtil_getInstance().createGroups_83glv4$(dataPoints);\n tmp$ = Ordering.Companion.natural_dahdeg$().sortedCopy_m5x2f4$(pointsByGroup.keys).iterator();\n while (tmp$.hasNext()) {\n var group = tmp$.next();\n var groupDataPoints = pointsByGroup.get_11rb$(group);\n var points = ArrayList_init_0(this.project_rrreuh$(ensureNotNull(groupDataPoints), LinesHelper$createBands$lambda(toLocationUpper)));\n var lowerPoints = reversed(groupDataPoints);\n points.addAll_brywnq$(this.project_rrreuh$(lowerPoints, LinesHelper$createBands$lambda_0(toLocationLower)));\n if (!points.isEmpty()) {\n var path = LinePath$Companion_getInstance().polygon_yh26e7$(points);\n this.decorateFillingPart_e7h5w8$_0(path, groupDataPoints.get_za3lpa$(0));\n lines.add_11rb$(path);\n }}\n return lines;\n };\n LinesHelper.prototype.decorate_frjrd5$ = function (path, p, filled) {\n var stroke = p.color();\n var strokeAlpha = ensureNotNull(this.myAlphaFilter_nxoahd$_0(AestheticsUtil_getInstance().alpha_il6rhx$(ensureNotNull(stroke), p)));\n path.color().set_11rb$(values.Colors.withOpacity_o14uds$(stroke, strokeAlpha));\n if (!AestheticsUtil_getInstance().ALPHA_CONTROLS_BOTH_8be2vx$ && (filled || !this.myAlphaEnabled_98jfa$_0)) {\n path.color().set_11rb$(stroke);\n }if (filled) {\n this.decorateFillingPart_e7h5w8$_0(path, p);\n }var size = ensureNotNull(this.myWidthFilter_sx37fb$_0(AesScaling_getInstance().strokeWidth_l6g9mh$(p)));\n path.width().set_11rb$(size);\n var lineType = p.lineType();\n if (!(lineType.isBlank || lineType.isSolid)) {\n path.dashArray().set_11rb$(lineType.dashArray);\n }};\n LinesHelper.prototype.decorateFillingPart_e7h5w8$_0 = function (path, p) {\n var fill = p.fill();\n var fillAlpha = ensureNotNull(this.myAlphaFilter_nxoahd$_0(AestheticsUtil_getInstance().alpha_il6rhx$(ensureNotNull(fill), p)));\n path.fill().set_11rb$(values.Colors.withOpacity_o14uds$(fill, fillAlpha));\n };\n LinesHelper.prototype.setAlphaFilter_m9g0ow$ = function (alphaFilter) {\n this.myAlphaFilter_nxoahd$_0 = alphaFilter;\n };\n LinesHelper.prototype.setWidthFilter_m9g0ow$ = function (widthFilter) {\n this.myWidthFilter_sx37fb$_0 = widthFilter;\n };\n function LinesHelper$PathInfo(path) {\n this.path = path;\n }\n LinesHelper$PathInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PathInfo',\n interfaces: []\n };\n function LinesHelper$myAlphaFilter$lambda(v) {\n return v;\n }\n function LinesHelper$myWidthFilter$lambda(v) {\n return v;\n }\n LinesHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinesHelper',\n interfaces: [GeomHelper]\n };\n function MappedAesthetics(myAesthetics, myPointAestheticsMapper) {\n this.myAesthetics_0 = myAesthetics;\n this.myPointAestheticsMapper_0 = myPointAestheticsMapper;\n }\n Object.defineProperty(MappedAesthetics.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myAesthetics_0.isEmpty;\n }\n });\n MappedAesthetics.prototype.dataPointAt_za3lpa$ = function (index) {\n return this.myPointAestheticsMapper_0(this.myAesthetics_0.dataPointAt_za3lpa$(index));\n };\n MappedAesthetics.prototype.dataPointCount = function () {\n return this.myAesthetics_0.dataPointCount();\n };\n MappedAesthetics.prototype.dataPoints = function () {\n var source = this.myAesthetics_0.dataPoints();\n var destination = ArrayList_init_1(collectionSizeOrDefault(source, 10));\n var tmp$;\n tmp$ = source.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(this.myPointAestheticsMapper_0(item));\n }\n return destination;\n };\n MappedAesthetics.prototype.range_vktour$ = function (aes) {\n throw IllegalStateException_init('MappedAesthetics.range: not implemented ' + aes);\n };\n MappedAesthetics.prototype.overallRange_vktour$ = function (aes) {\n throw IllegalStateException_init('MappedAesthetics.overallRange: not implemented ' + aes);\n };\n MappedAesthetics.prototype.resolution_594811$ = function (aes, naValue) {\n throw IllegalStateException_init('MappedAesthetics.resolution: not implemented ' + aes);\n };\n MappedAesthetics.prototype.numericValues_vktour$ = function (aes) {\n throw IllegalStateException_init('MappedAesthetics.numericValues: not implemented ' + aes);\n };\n MappedAesthetics.prototype.groups = function () {\n return this.myAesthetics_0.groups();\n };\n MappedAesthetics.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MappedAesthetics',\n interfaces: [Aesthetics]\n };\n function MultiPointData(aes, points, localToGlobalIndex, group) {\n this.aes = aes;\n this.points = points;\n this.localToGlobalIndex = localToGlobalIndex;\n this.group = group;\n }\n MultiPointData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiPointData',\n interfaces: []\n };\n function MultiPointDataConstructor() {\n MultiPointDataConstructor_instance = this;\n }\n function MultiPointDataConstructor$collector$lambda() {\n return new MultiPointDataConstructor$SimplePointCollector();\n }\n MultiPointDataConstructor.prototype.collector = function () {\n return MultiPointDataConstructor$collector$lambda;\n };\n function MultiPointDataConstructor$reducer$lambda(closure$dropPointDistance, closure$isPolygon) {\n return function () {\n return new MultiPointDataConstructor$PointReducer(closure$dropPointDistance, closure$isPolygon);\n };\n }\n MultiPointDataConstructor.prototype.reducer_8555vt$ = function (dropPointDistance, isPolygon) {\n return MultiPointDataConstructor$reducer$lambda(dropPointDistance, isPolygon);\n };\n function MultiPointDataConstructor$singlePointAppender$lambda(closure$toPoint) {\n return function (aes, coordinateConsumer) {\n coordinateConsumer(closure$toPoint(aes));\n return Unit;\n };\n }\n MultiPointDataConstructor.prototype.singlePointAppender_v9bvvf$ = function (toPoint) {\n return MultiPointDataConstructor$singlePointAppender$lambda(toPoint);\n };\n function MultiPointDataConstructor$multiPointAppender$lambda(closure$toPath) {\n return function (aes, coordinateConsumer) {\n var tmp$;\n tmp$ = closure$toPath(aes).iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n coordinateConsumer(element);\n }\n return Unit;\n };\n }\n MultiPointDataConstructor.prototype.multiPointAppender_t2aup3$ = function (toPath) {\n return MultiPointDataConstructor$multiPointAppender$lambda(toPath);\n };\n MultiPointDataConstructor.prototype.createMultiPointDataByGroup_ugj9hh$ = function (dataPoints, coordinateAppender, pointCollectorSupplier) {\n var tmp$, tmp$_0;\n var multiPointDataCombiners = HashMap_init();\n tmp$ = dataPoints.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var group = p.group();\n var tmp$_1;\n if (!(Kotlin.isType(tmp$_1 = multiPointDataCombiners, Map) ? tmp$_1 : throwCCE()).containsKey_11rb$(group)) {\n var key = ensureNotNull(group);\n var value = new MultiPointDataConstructor$MultiPointDataCombiner(coordinateAppender, pointCollectorSupplier());\n multiPointDataCombiners.put_xwzc9p$(key, value);\n }var tmp$_2;\n ensureNotNull((Kotlin.isType(tmp$_2 = multiPointDataCombiners, Map) ? tmp$_2 : throwCCE()).get_11rb$(group)).add_lsjzq4$(p);\n }\n var result = ArrayList_init();\n var sortedGroup = Ordering.Companion.natural_dahdeg$().sortedCopy_m5x2f4$(multiPointDataCombiners.keys);\n tmp$_0 = sortedGroup.iterator();\n while (tmp$_0.hasNext()) {\n var group_0 = tmp$_0.next();\n var multiPointData = ensureNotNull(multiPointDataCombiners.get_11rb$(group_0)).create_kcn2v3$(group_0);\n if (!multiPointData.points.isEmpty()) {\n result.add_11rb$(multiPointData);\n }}\n return result;\n };\n function MultiPointDataConstructor$PointCollector() {\n }\n MultiPointDataConstructor$PointCollector.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PointCollector',\n interfaces: []\n };\n function MultiPointDataConstructor$MultiPointDataCombiner(myCoordinateAppender, myPointCollector) {\n this.myCoordinateAppender_0 = myCoordinateAppender;\n this.myPointCollector_0 = myPointCollector;\n this.myFirstAes_0 = null;\n }\n function MultiPointDataConstructor$MultiPointDataCombiner$add$lambda(this$MultiPointDataCombiner, closure$aes) {\n return function (it) {\n this$MultiPointDataCombiner.myPointCollector_0.add_aqrfag$(it, closure$aes.index());\n return Unit;\n };\n }\n MultiPointDataConstructor$MultiPointDataCombiner.prototype.add_lsjzq4$ = function (aes) {\n if (this.myFirstAes_0 == null) {\n this.myFirstAes_0 = aes;\n }this.myCoordinateAppender_0(aes, MultiPointDataConstructor$MultiPointDataCombiner$add$lambda(this, aes));\n };\n function MultiPointDataConstructor$MultiPointDataCombiner$create$lambda(closure$points) {\n return function (it) {\n return closure$points.second.get_za3lpa$(it);\n };\n }\n MultiPointDataConstructor$MultiPointDataCombiner.prototype.create_kcn2v3$ = function (group) {\n var points = this.myPointCollector_0.points;\n return new MultiPointData(ensureNotNull(this.myFirstAes_0), points.first, MultiPointDataConstructor$MultiPointDataCombiner$create$lambda(points), group);\n };\n MultiPointDataConstructor$MultiPointDataCombiner.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiPointDataCombiner',\n interfaces: []\n };\n function MultiPointDataConstructor$SimplePointCollector() {\n this.myPoints_0 = ArrayList_init();\n this.myIndexes_0 = ArrayList_init();\n }\n Object.defineProperty(MultiPointDataConstructor$SimplePointCollector.prototype, 'points', {\n configurable: true,\n get: function () {\n return new Pair(this.myPoints_0, this.myIndexes_0);\n }\n });\n MultiPointDataConstructor$SimplePointCollector.prototype.add_aqrfag$ = function (coord, index) {\n this.myPoints_0.add_11rb$(ensureNotNull(coord));\n this.myIndexes_0.add_11rb$(index);\n };\n MultiPointDataConstructor$SimplePointCollector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SimplePointCollector',\n interfaces: [MultiPointDataConstructor$PointCollector]\n };\n function MultiPointDataConstructor$PointReducer(myDropPointDistance, myPolygon) {\n this.myDropPointDistance_0 = myDropPointDistance;\n this.myPolygon_0 = myPolygon;\n this.myReducedPoints_0 = ArrayList_init();\n this.myReducedIndexes_0 = ArrayList_init();\n this.myLastAdded_0 = null;\n this.myLastPostponed_0 = null;\n this.myRegionStart_0 = null;\n }\n Object.defineProperty(MultiPointDataConstructor$PointReducer.prototype, 'points', {\n configurable: true,\n get: function () {\n if (this.myLastPostponed_0 != null) {\n this.addPoint_0(ensureNotNull(this.myLastPostponed_0).first, ensureNotNull(this.myLastPostponed_0).second);\n this.myLastPostponed_0 = null;\n }return new Pair(this.myReducedPoints_0, this.myReducedIndexes_0);\n }\n });\n MultiPointDataConstructor$PointReducer.prototype.isCloserThan_0 = function (p0, p1, distance) {\n var x = p0.x - p1.x;\n var tmp$ = JsMath.abs(x) < distance;\n if (tmp$) {\n var x_0 = p0.y - p1.y;\n tmp$ = JsMath.abs(x_0) < distance;\n }return tmp$;\n };\n MultiPointDataConstructor$PointReducer.prototype.add_aqrfag$ = function (coord, index) {\n if (coord == null) {\n return;\n }if (this.myLastAdded_0 == null) {\n this.storePoint_0(coord, index);\n return;\n }if (this.needPostpone_0(coord)) {\n this.postponePoint_0(coord, index);\n } else {\n if (this.myLastPostponed_0 != null) {\n this.addPoint_0(ensureNotNull(this.myLastPostponed_0).first, ensureNotNull(this.myLastPostponed_0).second);\n this.myLastPostponed_0 = null;\n }this.storePoint_0(coord, index);\n }\n };\n MultiPointDataConstructor$PointReducer.prototype.needPostpone_0 = function (loc) {\n var closeToAdded = this.areTooClose_0(this.myLastAdded_0, loc);\n var closeToPostponed = this.myLastPostponed_0 == null || this.areTooClose_0(ensureNotNull(this.myLastPostponed_0).first, loc);\n var regionClosePoint = this.isRegionStart_0(loc);\n return closeToAdded && closeToPostponed && !regionClosePoint;\n };\n MultiPointDataConstructor$PointReducer.prototype.postponePoint_0 = function (loc, index) {\n this.myLastPostponed_0 = new Pair(loc, index);\n };\n MultiPointDataConstructor$PointReducer.prototype.storePoint_0 = function (loc, index) {\n this.addPoint_0(loc, index);\n this.myLastAdded_0 = loc;\n this.processRegionStart_0(loc, index);\n };\n MultiPointDataConstructor$PointReducer.prototype.processRegionStart_0 = function (loc, index) {\n if (!this.myPolygon_0) {\n return;\n }if (this.myRegionStart_0 == null) {\n this.myRegionStart_0 = new Pair(loc, index);\n return;\n }if (this.isRegionStart_0(loc)) {\n this.myRegionStart_0 = null;\n this.myLastAdded_0 = null;\n }};\n MultiPointDataConstructor$PointReducer.prototype.isRegionStart_0 = function (loc) {\n var tmp$;\n if (!this.myPolygon_0) {\n return false;\n }if (this.myRegionStart_0 == null) {\n tmp$ = false;\n } else\n tmp$ = equals(ensureNotNull(this.myRegionStart_0).first, loc);\n return tmp$;\n };\n MultiPointDataConstructor$PointReducer.prototype.addPoint_0 = function (loc, index) {\n this.myReducedPoints_0.add_11rb$(loc);\n this.myReducedIndexes_0.add_11rb$(index);\n };\n MultiPointDataConstructor$PointReducer.prototype.areTooClose_0 = function (p1, p2) {\n return this.isCloserThan_0(ensureNotNull(p1), p2, this.myDropPointDistance_0);\n };\n MultiPointDataConstructor$PointReducer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointReducer',\n interfaces: [MultiPointDataConstructor$PointCollector]\n };\n MultiPointDataConstructor.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'MultiPointDataConstructor',\n interfaces: []\n };\n var MultiPointDataConstructor_instance = null;\n function MultiPointDataConstructor_getInstance() {\n if (MultiPointDataConstructor_instance === null) {\n new MultiPointDataConstructor();\n }return MultiPointDataConstructor_instance;\n }\n function RectTargetCollectorHelper(rectanglesHelper, rectangleByDataPoint, fillByDataPoint, tooltipKind) {\n this.rectanglesHelper_0 = rectanglesHelper;\n this.rectangleByDataPoint_0 = rectangleByDataPoint;\n this.fillByDataPoint_0 = fillByDataPoint;\n this.tooltipKind_0 = tooltipKind;\n }\n function RectTargetCollectorHelper$collectTo$lambda(closure$targetCollector, this$RectTargetCollectorHelper) {\n return function (p, rectangle) {\n closure$targetCollector.addRectangle_bxzvr8$(p.index(), rectangle, this$RectTargetCollectorHelper.tooltipParams_0(p), this$RectTargetCollectorHelper.tooltipKind_0);\n return Unit;\n };\n }\n RectTargetCollectorHelper.prototype.collectTo_xrq6q$ = function (targetCollector) {\n this.rectanglesHelper_0.iterateRectangleGeometry_xwqduk$(this.rectangleByDataPoint_0, RectTargetCollectorHelper$collectTo$lambda(targetCollector, this));\n };\n RectTargetCollectorHelper.prototype.tooltipParams_0 = function (p) {\n var params = GeomTargetCollector$TooltipParams$Companion_getInstance().params();\n params.setColor_98b62m$(this.fillByDataPoint_0(p));\n return params;\n };\n RectTargetCollectorHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RectTargetCollectorHelper',\n interfaces: []\n };\n function RectanglesHelper(myAesthetics, pos, coord, ctx) {\n GeomHelper.call(this, pos, coord, ctx);\n this.myAesthetics_0 = myAesthetics;\n }\n RectanglesHelper.prototype.createRectangles_rezc4r$ = function (rectangleByDataPoint) {\n var tmp$, tmp$_0;\n var result = ArrayList_init();\n tmp$ = this.myAesthetics_0.dataPointCount();\n for (var index = 0; index < tmp$; index++) {\n var p = this.myAesthetics_0.dataPointAt_za3lpa$(index);\n tmp$_0 = this.toClientRect_7iz5gz$(p, rectangleByDataPoint);\n if (tmp$_0 == null) {\n continue;\n }var clientRect = tmp$_0;\n var svgRect = SvgRectElement_init_0(clientRect);\n GeomHelper$Companion_getInstance().decorate_d9jm6k$(svgRect, p);\n result.add_11rb$(svgRect);\n }\n return result;\n };\n RectanglesHelper.prototype.iterateRectangleGeometry_xwqduk$ = function (rectangleByDataPoint, iterator) {\n var tmp$;\n tmp$ = this.myAesthetics_0.dataPointCount();\n for (var index = 0; index < tmp$; index++) {\n var p = this.myAesthetics_0.dataPointAt_za3lpa$(index);\n var rect = this.toClientRect_7iz5gz$(p, rectangleByDataPoint);\n if (rect != null) {\n iterator(p, rect);\n }}\n };\n RectanglesHelper.prototype.createSlimRectangles_rezc4r$ = function (rectangleByDataPoint) {\n var tmp$;\n var pointCount = this.myAesthetics_0.dataPointCount();\n var group = slim.SvgSlimElements.g_za3lpa$(pointCount);\n for (var index = 0; index < pointCount; index++) {\n var p = this.myAesthetics_0.dataPointAt_za3lpa$(index);\n tmp$ = this.toClientRect_7iz5gz$(p, rectangleByDataPoint);\n if (tmp$ == null) {\n continue;\n }var clientRect = tmp$;\n var slimShape = slim.SvgSlimElements.rect_6y0v78$(clientRect.left, clientRect.top, clientRect.width, clientRect.height);\n GeomHelper$Companion_getInstance().decorateSlimShape_gb6c9f$(slimShape, p);\n slimShape.appendTo_i2myw1$(group);\n }\n return group;\n };\n RectanglesHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RectanglesHelper',\n interfaces: [GeomHelper]\n };\n function ContextualMapping(tooltipLines, tooltipAnchor, tooltipMinWidth, tooltipColor, ignoreInvisibleTargets, hasGeneralTooltip, hasAxisTooltip, isCrosshairEnabled) {\n this.tooltipLines_85czob$_0 = tooltipLines;\n this.tooltipAnchor = tooltipAnchor;\n this.tooltipMinWidth = tooltipMinWidth;\n this.tooltipColor = tooltipColor;\n this.ignoreInvisibleTargets = ignoreInvisibleTargets;\n this.hasGeneralTooltip = hasGeneralTooltip;\n this.hasAxisTooltip = hasAxisTooltip;\n this.isCrosshairEnabled = isCrosshairEnabled;\n }\n ContextualMapping.prototype.getDataPoints_za3lpa$ = function (index) {\n var $receiver = this.tooltipLines_85czob$_0;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n if ((tmp$_0 = element.getDataPoint_za3lpa$(index)) != null) {\n destination.add_11rb$(tmp$_0);\n }}\n return destination;\n };\n ContextualMapping.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContextualMapping',\n interfaces: []\n };\n function DataContext(dataFrame, mappedDataAccess) {\n this.dataFrame = dataFrame;\n this.mappedDataAccess = mappedDataAccess;\n }\n DataContext.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataContext',\n interfaces: []\n };\n DataContext.prototype.component1 = function () {\n return this.dataFrame;\n };\n DataContext.prototype.component2 = function () {\n return this.mappedDataAccess;\n };\n DataContext.prototype.copy_nqispu$ = function (dataFrame, mappedDataAccess) {\n return new DataContext(dataFrame === void 0 ? this.dataFrame : dataFrame, mappedDataAccess === void 0 ? this.mappedDataAccess : mappedDataAccess);\n };\n DataContext.prototype.toString = function () {\n return 'DataContext(dataFrame=' + Kotlin.toString(this.dataFrame) + (', mappedDataAccess=' + Kotlin.toString(this.mappedDataAccess)) + ')';\n };\n DataContext.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.dataFrame) | 0;\n result = result * 31 + Kotlin.hashCode(this.mappedDataAccess) | 0;\n return result;\n };\n DataContext.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.dataFrame, other.dataFrame) && Kotlin.equals(this.mappedDataAccess, other.mappedDataAccess)))));\n };\n function GeomTarget(hitIndex, tipLayoutHint, aesTipLayoutHints) {\n this.hitIndex = hitIndex;\n this.tipLayoutHint_hymvab$_0 = tipLayoutHint;\n this.aesTipLayoutHints_wcnfmb$_0 = aesTipLayoutHints;\n }\n Object.defineProperty(GeomTarget.prototype, 'tipLayoutHint', {\n get: function () {\n return this.tipLayoutHint_hymvab$_0;\n }\n });\n Object.defineProperty(GeomTarget.prototype, 'aesTipLayoutHints', {\n get: function () {\n return this.aesTipLayoutHints_wcnfmb$_0;\n }\n });\n GeomTarget.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomTarget',\n interfaces: []\n };\n function GeomTargetCollector() {\n }\n GeomTargetCollector.prototype.addPoint_cnsimy$ = function (index, point, radius, tooltipParams, tooltipKind, callback$default) {\n if (tooltipKind === void 0)\n tooltipKind = TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance();\n callback$default ? callback$default(index, point, radius, tooltipParams, tooltipKind) : this.addPoint_cnsimy$$default(index, point, radius, tooltipParams, tooltipKind);\n };\n GeomTargetCollector.prototype.addRectangle_bxzvr8$ = function (index, rectangle, tooltipParams, tooltipKind, callback$default) {\n if (tooltipKind === void 0)\n tooltipKind = TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance();\n callback$default ? callback$default(index, rectangle, tooltipParams, tooltipKind) : this.addRectangle_bxzvr8$$default(index, rectangle, tooltipParams, tooltipKind);\n };\n GeomTargetCollector.prototype.addPath_sa5m83$ = function (points, localToGlobalIndex, tooltipParams, tooltipKind, callback$default) {\n if (tooltipKind === void 0)\n tooltipKind = TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance();\n callback$default ? callback$default(points, localToGlobalIndex, tooltipParams, tooltipKind) : this.addPath_sa5m83$$default(points, localToGlobalIndex, tooltipParams, tooltipKind);\n };\n GeomTargetCollector.prototype.addPolygon_sa5m83$ = function (points, localToGlobalIndex, tooltipParams, tooltipKind, callback$default) {\n if (tooltipKind === void 0)\n tooltipKind = TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance();\n callback$default ? callback$default(points, localToGlobalIndex, tooltipParams, tooltipKind) : this.addPolygon_sa5m83$$default(points, localToGlobalIndex, tooltipParams, tooltipKind);\n };\n function GeomTargetCollector$TooltipParams() {\n GeomTargetCollector$TooltipParams$Companion_getInstance();\n this.myTipLayoutHints_0 = emptyMap();\n this.myColor_0 = Color.Companion.GRAY;\n this.myStemLength_0 = TipLayoutHint$StemLength$NORMAL_getInstance();\n }\n GeomTargetCollector$TooltipParams.prototype.getTipLayoutHints = function () {\n return this.myTipLayoutHints_0;\n };\n GeomTargetCollector$TooltipParams.prototype.setTipLayoutHints_vgcgsc$ = function (tipLayoutHints) {\n this.myTipLayoutHints_0 = tipLayoutHints;\n return this;\n };\n GeomTargetCollector$TooltipParams.prototype.getColor = function () {\n return this.myColor_0;\n };\n GeomTargetCollector$TooltipParams.prototype.setColor_98b62m$ = function (color) {\n this.myColor_0 = color;\n return this;\n };\n GeomTargetCollector$TooltipParams.prototype.getStemLength = function () {\n return this.myStemLength_0;\n };\n GeomTargetCollector$TooltipParams.prototype.setStemLength_6gy7x$ = function (stemLength) {\n this.myStemLength_0 = stemLength;\n return this;\n };\n function GeomTargetCollector$TooltipParams$Companion() {\n GeomTargetCollector$TooltipParams$Companion_instance = this;\n }\n GeomTargetCollector$TooltipParams$Companion.prototype.params = function () {\n return new GeomTargetCollector$TooltipParams();\n };\n GeomTargetCollector$TooltipParams$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomTargetCollector$TooltipParams$Companion_instance = null;\n function GeomTargetCollector$TooltipParams$Companion_getInstance() {\n if (GeomTargetCollector$TooltipParams$Companion_instance === null) {\n new GeomTargetCollector$TooltipParams$Companion();\n }return GeomTargetCollector$TooltipParams$Companion_instance;\n }\n GeomTargetCollector$TooltipParams.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipParams',\n interfaces: []\n };\n GeomTargetCollector.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GeomTargetCollector',\n interfaces: []\n };\n function GeomTargetLocator() {\n }\n function GeomTargetLocator$LookupSpace(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function GeomTargetLocator$LookupSpace_initFields() {\n GeomTargetLocator$LookupSpace_initFields = function () {\n };\n GeomTargetLocator$LookupSpace$X_instance = new GeomTargetLocator$LookupSpace('X', 0);\n GeomTargetLocator$LookupSpace$XY_instance = new GeomTargetLocator$LookupSpace('XY', 1);\n GeomTargetLocator$LookupSpace$NONE_instance = new GeomTargetLocator$LookupSpace('NONE', 2);\n }\n var GeomTargetLocator$LookupSpace$X_instance;\n function GeomTargetLocator$LookupSpace$X_getInstance() {\n GeomTargetLocator$LookupSpace_initFields();\n return GeomTargetLocator$LookupSpace$X_instance;\n }\n var GeomTargetLocator$LookupSpace$XY_instance;\n function GeomTargetLocator$LookupSpace$XY_getInstance() {\n GeomTargetLocator$LookupSpace_initFields();\n return GeomTargetLocator$LookupSpace$XY_instance;\n }\n var GeomTargetLocator$LookupSpace$NONE_instance;\n function GeomTargetLocator$LookupSpace$NONE_getInstance() {\n GeomTargetLocator$LookupSpace_initFields();\n return GeomTargetLocator$LookupSpace$NONE_instance;\n }\n GeomTargetLocator$LookupSpace.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LookupSpace',\n interfaces: [Enum]\n };\n function GeomTargetLocator$LookupSpace$values() {\n return [GeomTargetLocator$LookupSpace$X_getInstance(), GeomTargetLocator$LookupSpace$XY_getInstance(), GeomTargetLocator$LookupSpace$NONE_getInstance()];\n }\n GeomTargetLocator$LookupSpace.values = GeomTargetLocator$LookupSpace$values;\n function GeomTargetLocator$LookupSpace$valueOf(name) {\n switch (name) {\n case 'X':\n return GeomTargetLocator$LookupSpace$X_getInstance();\n case 'XY':\n return GeomTargetLocator$LookupSpace$XY_getInstance();\n case 'NONE':\n return GeomTargetLocator$LookupSpace$NONE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupSpace.' + name);\n }\n }\n GeomTargetLocator$LookupSpace.valueOf_61zpoe$ = GeomTargetLocator$LookupSpace$valueOf;\n function GeomTargetLocator$LookupStrategy(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function GeomTargetLocator$LookupStrategy_initFields() {\n GeomTargetLocator$LookupStrategy_initFields = function () {\n };\n GeomTargetLocator$LookupStrategy$HOVER_instance = new GeomTargetLocator$LookupStrategy('HOVER', 0);\n GeomTargetLocator$LookupStrategy$NEAREST_instance = new GeomTargetLocator$LookupStrategy('NEAREST', 1);\n GeomTargetLocator$LookupStrategy$NONE_instance = new GeomTargetLocator$LookupStrategy('NONE', 2);\n }\n var GeomTargetLocator$LookupStrategy$HOVER_instance;\n function GeomTargetLocator$LookupStrategy$HOVER_getInstance() {\n GeomTargetLocator$LookupStrategy_initFields();\n return GeomTargetLocator$LookupStrategy$HOVER_instance;\n }\n var GeomTargetLocator$LookupStrategy$NEAREST_instance;\n function GeomTargetLocator$LookupStrategy$NEAREST_getInstance() {\n GeomTargetLocator$LookupStrategy_initFields();\n return GeomTargetLocator$LookupStrategy$NEAREST_instance;\n }\n var GeomTargetLocator$LookupStrategy$NONE_instance;\n function GeomTargetLocator$LookupStrategy$NONE_getInstance() {\n GeomTargetLocator$LookupStrategy_initFields();\n return GeomTargetLocator$LookupStrategy$NONE_instance;\n }\n GeomTargetLocator$LookupStrategy.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LookupStrategy',\n interfaces: [Enum]\n };\n function GeomTargetLocator$LookupStrategy$values() {\n return [GeomTargetLocator$LookupStrategy$HOVER_getInstance(), GeomTargetLocator$LookupStrategy$NEAREST_getInstance(), GeomTargetLocator$LookupStrategy$NONE_getInstance()];\n }\n GeomTargetLocator$LookupStrategy.values = GeomTargetLocator$LookupStrategy$values;\n function GeomTargetLocator$LookupStrategy$valueOf(name) {\n switch (name) {\n case 'HOVER':\n return GeomTargetLocator$LookupStrategy$HOVER_getInstance();\n case 'NEAREST':\n return GeomTargetLocator$LookupStrategy$NEAREST_getInstance();\n case 'NONE':\n return GeomTargetLocator$LookupStrategy$NONE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupStrategy.' + name);\n }\n }\n GeomTargetLocator$LookupStrategy.valueOf_61zpoe$ = GeomTargetLocator$LookupStrategy$valueOf;\n function GeomTargetLocator$LookupSpec(lookupSpace, lookupStrategy) {\n GeomTargetLocator$LookupSpec$Companion_getInstance();\n this.lookupSpace = lookupSpace;\n this.lookupStrategy = lookupStrategy;\n }\n function GeomTargetLocator$LookupSpec$Companion() {\n GeomTargetLocator$LookupSpec$Companion_instance = this;\n this.NONE = new GeomTargetLocator$LookupSpec(GeomTargetLocator$LookupSpace$NONE_getInstance(), GeomTargetLocator$LookupStrategy$NONE_getInstance());\n }\n GeomTargetLocator$LookupSpec$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomTargetLocator$LookupSpec$Companion_instance = null;\n function GeomTargetLocator$LookupSpec$Companion_getInstance() {\n if (GeomTargetLocator$LookupSpec$Companion_instance === null) {\n new GeomTargetLocator$LookupSpec$Companion();\n }return GeomTargetLocator$LookupSpec$Companion_instance;\n }\n GeomTargetLocator$LookupSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LookupSpec',\n interfaces: []\n };\n function GeomTargetLocator$LookupResult(targets, distance, geomKind, contextualMapping, isCrosshairEnabled) {\n this.targets = targets;\n this.distance_isy6z$_0 = distance;\n this.geomKind_g9qdl6$_0 = geomKind;\n this.contextualMapping_r13yoz$_0 = contextualMapping;\n this.isCrosshairEnabled = isCrosshairEnabled;\n }\n Object.defineProperty(GeomTargetLocator$LookupResult.prototype, 'distance', {\n get: function () {\n return this.distance_isy6z$_0;\n }\n });\n Object.defineProperty(GeomTargetLocator$LookupResult.prototype, 'geomKind', {\n get: function () {\n return this.geomKind_g9qdl6$_0;\n }\n });\n Object.defineProperty(GeomTargetLocator$LookupResult.prototype, 'contextualMapping', {\n get: function () {\n return this.contextualMapping_r13yoz$_0;\n }\n });\n GeomTargetLocator$LookupResult.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LookupResult',\n interfaces: []\n };\n GeomTargetLocator.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GeomTargetLocator',\n interfaces: []\n };\n function HitShape(kind, shape) {\n HitShape$Companion_getInstance();\n this.kind = kind;\n this.shape_kp8049$_0 = shape;\n }\n Object.defineProperty(HitShape.prototype, 'point', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.shape_kp8049$_0, HitShape$DoubleCircle) ? tmp$ : throwCCE();\n }\n });\n Object.defineProperty(HitShape.prototype, 'rect', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.shape_kp8049$_0, DoubleRectangle) ? tmp$ : throwCCE();\n }\n });\n Object.defineProperty(HitShape.prototype, 'points', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Not applicable to ' + this.kind);\n }\n });\n function HitShape$Kind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function HitShape$Kind_initFields() {\n HitShape$Kind_initFields = function () {\n };\n HitShape$Kind$POINT_instance = new HitShape$Kind('POINT', 0);\n HitShape$Kind$RECT_instance = new HitShape$Kind('RECT', 1);\n HitShape$Kind$POLYGON_instance = new HitShape$Kind('POLYGON', 2);\n HitShape$Kind$PATH_instance = new HitShape$Kind('PATH', 3);\n }\n var HitShape$Kind$POINT_instance;\n function HitShape$Kind$POINT_getInstance() {\n HitShape$Kind_initFields();\n return HitShape$Kind$POINT_instance;\n }\n var HitShape$Kind$RECT_instance;\n function HitShape$Kind$RECT_getInstance() {\n HitShape$Kind_initFields();\n return HitShape$Kind$RECT_instance;\n }\n var HitShape$Kind$POLYGON_instance;\n function HitShape$Kind$POLYGON_getInstance() {\n HitShape$Kind_initFields();\n return HitShape$Kind$POLYGON_instance;\n }\n var HitShape$Kind$PATH_instance;\n function HitShape$Kind$PATH_getInstance() {\n HitShape$Kind_initFields();\n return HitShape$Kind$PATH_instance;\n }\n HitShape$Kind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Kind',\n interfaces: [Enum]\n };\n function HitShape$Kind$values() {\n return [HitShape$Kind$POINT_getInstance(), HitShape$Kind$RECT_getInstance(), HitShape$Kind$POLYGON_getInstance(), HitShape$Kind$PATH_getInstance()];\n }\n HitShape$Kind.values = HitShape$Kind$values;\n function HitShape$Kind$valueOf(name) {\n switch (name) {\n case 'POINT':\n return HitShape$Kind$POINT_getInstance();\n case 'RECT':\n return HitShape$Kind$RECT_getInstance();\n case 'POLYGON':\n return HitShape$Kind$POLYGON_getInstance();\n case 'PATH':\n return HitShape$Kind$PATH_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.HitShape.Kind.' + name);\n }\n }\n HitShape$Kind.valueOf_61zpoe$ = HitShape$Kind$valueOf;\n function HitShape$DoubleCircle(center, radius) {\n this.center = center;\n this.radius = radius;\n }\n HitShape$DoubleCircle.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleCircle',\n interfaces: []\n };\n function HitShape$Companion() {\n HitShape$Companion_instance = this;\n }\n HitShape$Companion.prototype.point_e1sv3v$ = function (p, radius) {\n return new HitShape(HitShape$Kind$POINT_getInstance(), new HitShape$DoubleCircle(p, radius));\n };\n HitShape$Companion.prototype.rect_wthzt5$ = function (r) {\n return new HitShape(HitShape$Kind$RECT_getInstance(), r);\n };\n HitShape$Companion.prototype.path_ytws2g$ = function (points) {\n return this.shapeWithPath_0(HitShape$Kind$PATH_getInstance(), points);\n };\n HitShape$Companion.prototype.polygon_ytws2g$ = function (points) {\n return this.shapeWithPath_0(HitShape$Kind$POLYGON_getInstance(), points);\n };\n function HitShape$Companion$shapeWithPath$ObjectLiteral(closure$points, kind, shape) {\n this.closure$points = closure$points;\n HitShape.call(this, kind, shape);\n }\n Object.defineProperty(HitShape$Companion$shapeWithPath$ObjectLiteral.prototype, 'points', {\n configurable: true,\n get: function () {\n return this.closure$points;\n }\n });\n HitShape$Companion$shapeWithPath$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [HitShape]\n };\n HitShape$Companion.prototype.shapeWithPath_0 = function (kind, points) {\n return new HitShape$Companion$shapeWithPath$ObjectLiteral(points, kind, points);\n };\n HitShape$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HitShape$Companion_instance = null;\n function HitShape$Companion_getInstance() {\n if (HitShape$Companion_instance === null) {\n new HitShape$Companion();\n }return HitShape$Companion_instance;\n }\n HitShape.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HitShape',\n interfaces: []\n };\n function MappedDataAccess() {\n }\n function MappedDataAccess$MappedData(label, value, isContinuous) {\n this.label = label;\n this.value = value;\n this.isContinuous = isContinuous;\n }\n MappedDataAccess$MappedData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MappedData',\n interfaces: []\n };\n MappedDataAccess.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'MappedDataAccess',\n interfaces: []\n };\n function NullGeomTargetCollector() {\n }\n NullGeomTargetCollector.prototype.addPoint_cnsimy$$default = function (index, point, radius, tooltipParams, tooltipKind) {\n };\n NullGeomTargetCollector.prototype.addRectangle_bxzvr8$$default = function (index, rectangle, tooltipParams, tooltipKind) {\n };\n NullGeomTargetCollector.prototype.addPath_sa5m83$$default = function (points, localToGlobalIndex, tooltipParams, tooltipKind) {\n };\n NullGeomTargetCollector.prototype.addPolygon_sa5m83$$default = function (points, localToGlobalIndex, tooltipParams, tooltipKind) {\n };\n NullGeomTargetCollector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NullGeomTargetCollector',\n interfaces: [GeomTargetCollector]\n };\n function TipLayoutHint(kind, coord, objectRadius, color, stemLength) {\n TipLayoutHint$Companion_getInstance();\n this.kind_mdwpny$_0 = kind;\n this.coord_cmx6yh$_0 = coord;\n this.objectRadius_tv0yd$_0 = objectRadius;\n this.color_cmv83v$_0 = color;\n this.stemLength_x5log9$_0 = stemLength;\n }\n Object.defineProperty(TipLayoutHint.prototype, 'kind', {\n get: function () {\n return this.kind_mdwpny$_0;\n }\n });\n Object.defineProperty(TipLayoutHint.prototype, 'coord', {\n get: function () {\n return this.coord_cmx6yh$_0;\n }\n });\n Object.defineProperty(TipLayoutHint.prototype, 'objectRadius', {\n get: function () {\n return this.objectRadius_tv0yd$_0;\n }\n });\n Object.defineProperty(TipLayoutHint.prototype, 'color', {\n get: function () {\n return this.color_cmv83v$_0;\n }\n });\n Object.defineProperty(TipLayoutHint.prototype, 'stemLength', {\n get: function () {\n return this.stemLength_x5log9$_0;\n }\n });\n function TipLayoutHint$StemLength(name, ordinal, value) {\n Enum.call(this);\n this.value = value;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TipLayoutHint$StemLength_initFields() {\n TipLayoutHint$StemLength_initFields = function () {\n };\n TipLayoutHint$StemLength$NORMAL_instance = new TipLayoutHint$StemLength('NORMAL', 0, 12.0);\n TipLayoutHint$StemLength$SHORT_instance = new TipLayoutHint$StemLength('SHORT', 1, 5.0);\n TipLayoutHint$StemLength$NONE_instance = new TipLayoutHint$StemLength('NONE', 2, 0.0);\n }\n var TipLayoutHint$StemLength$NORMAL_instance;\n function TipLayoutHint$StemLength$NORMAL_getInstance() {\n TipLayoutHint$StemLength_initFields();\n return TipLayoutHint$StemLength$NORMAL_instance;\n }\n var TipLayoutHint$StemLength$SHORT_instance;\n function TipLayoutHint$StemLength$SHORT_getInstance() {\n TipLayoutHint$StemLength_initFields();\n return TipLayoutHint$StemLength$SHORT_instance;\n }\n var TipLayoutHint$StemLength$NONE_instance;\n function TipLayoutHint$StemLength$NONE_getInstance() {\n TipLayoutHint$StemLength_initFields();\n return TipLayoutHint$StemLength$NONE_instance;\n }\n TipLayoutHint$StemLength.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StemLength',\n interfaces: [Enum]\n };\n function TipLayoutHint$StemLength$values() {\n return [TipLayoutHint$StemLength$NORMAL_getInstance(), TipLayoutHint$StemLength$SHORT_getInstance(), TipLayoutHint$StemLength$NONE_getInstance()];\n }\n TipLayoutHint$StemLength.values = TipLayoutHint$StemLength$values;\n function TipLayoutHint$StemLength$valueOf(name) {\n switch (name) {\n case 'NORMAL':\n return TipLayoutHint$StemLength$NORMAL_getInstance();\n case 'SHORT':\n return TipLayoutHint$StemLength$SHORT_getInstance();\n case 'NONE':\n return TipLayoutHint$StemLength$NONE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.TipLayoutHint.StemLength.' + name);\n }\n }\n TipLayoutHint$StemLength.valueOf_61zpoe$ = TipLayoutHint$StemLength$valueOf;\n TipLayoutHint.prototype.toString = function () {\n return this.kind.toString();\n };\n function TipLayoutHint$Kind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TipLayoutHint$Kind_initFields() {\n TipLayoutHint$Kind_initFields = function () {\n };\n TipLayoutHint$Kind$VERTICAL_TOOLTIP_instance = new TipLayoutHint$Kind('VERTICAL_TOOLTIP', 0);\n TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_instance = new TipLayoutHint$Kind('HORIZONTAL_TOOLTIP', 1);\n TipLayoutHint$Kind$CURSOR_TOOLTIP_instance = new TipLayoutHint$Kind('CURSOR_TOOLTIP', 2);\n TipLayoutHint$Kind$X_AXIS_TOOLTIP_instance = new TipLayoutHint$Kind('X_AXIS_TOOLTIP', 3);\n TipLayoutHint$Kind$Y_AXIS_TOOLTIP_instance = new TipLayoutHint$Kind('Y_AXIS_TOOLTIP', 4);\n }\n var TipLayoutHint$Kind$VERTICAL_TOOLTIP_instance;\n function TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance() {\n TipLayoutHint$Kind_initFields();\n return TipLayoutHint$Kind$VERTICAL_TOOLTIP_instance;\n }\n var TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_instance;\n function TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance() {\n TipLayoutHint$Kind_initFields();\n return TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_instance;\n }\n var TipLayoutHint$Kind$CURSOR_TOOLTIP_instance;\n function TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance() {\n TipLayoutHint$Kind_initFields();\n return TipLayoutHint$Kind$CURSOR_TOOLTIP_instance;\n }\n var TipLayoutHint$Kind$X_AXIS_TOOLTIP_instance;\n function TipLayoutHint$Kind$X_AXIS_TOOLTIP_getInstance() {\n TipLayoutHint$Kind_initFields();\n return TipLayoutHint$Kind$X_AXIS_TOOLTIP_instance;\n }\n var TipLayoutHint$Kind$Y_AXIS_TOOLTIP_instance;\n function TipLayoutHint$Kind$Y_AXIS_TOOLTIP_getInstance() {\n TipLayoutHint$Kind_initFields();\n return TipLayoutHint$Kind$Y_AXIS_TOOLTIP_instance;\n }\n TipLayoutHint$Kind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Kind',\n interfaces: [Enum]\n };\n function TipLayoutHint$Kind$values() {\n return [TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance(), TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance(), TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance(), TipLayoutHint$Kind$X_AXIS_TOOLTIP_getInstance(), TipLayoutHint$Kind$Y_AXIS_TOOLTIP_getInstance()];\n }\n TipLayoutHint$Kind.values = TipLayoutHint$Kind$values;\n function TipLayoutHint$Kind$valueOf(name) {\n switch (name) {\n case 'VERTICAL_TOOLTIP':\n return TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance();\n case 'HORIZONTAL_TOOLTIP':\n return TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance();\n case 'CURSOR_TOOLTIP':\n return TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance();\n case 'X_AXIS_TOOLTIP':\n return TipLayoutHint$Kind$X_AXIS_TOOLTIP_getInstance();\n case 'Y_AXIS_TOOLTIP':\n return TipLayoutHint$Kind$Y_AXIS_TOOLTIP_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.TipLayoutHint.Kind.' + name);\n }\n }\n TipLayoutHint$Kind.valueOf_61zpoe$ = TipLayoutHint$Kind$valueOf;\n function TipLayoutHint$Companion() {\n TipLayoutHint$Companion_instance = this;\n }\n TipLayoutHint$Companion.prototype.verticalTooltip_6lq1u6$ = function (coord, objectRadius, color, stemLength) {\n if (stemLength === void 0)\n stemLength = TipLayoutHint$StemLength$NORMAL_getInstance();\n return new TipLayoutHint(TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance(), coord, objectRadius, color, stemLength);\n };\n TipLayoutHint$Companion.prototype.horizontalTooltip_6lq1u6$ = function (coord, objectRadius, color, stemLength) {\n if (stemLength === void 0)\n stemLength = TipLayoutHint$StemLength$NORMAL_getInstance();\n return new TipLayoutHint(TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance(), coord, objectRadius, color, stemLength);\n };\n TipLayoutHint$Companion.prototype.cursorTooltip_itpcqk$ = function (coord, color, stemLength) {\n if (stemLength === void 0)\n stemLength = TipLayoutHint$StemLength$NORMAL_getInstance();\n return new TipLayoutHint(TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance(), coord, 0.0, color, stemLength);\n };\n TipLayoutHint$Companion.prototype.xAxisTooltip_cgf2ia$ = function (coord, color, axisRadius, stemLength) {\n if (axisRadius === void 0)\n axisRadius = 0.0;\n if (stemLength === void 0)\n stemLength = TipLayoutHint$StemLength$NONE_getInstance();\n return new TipLayoutHint(TipLayoutHint$Kind$X_AXIS_TOOLTIP_getInstance(), coord, axisRadius, color, stemLength);\n };\n TipLayoutHint$Companion.prototype.yAxisTooltip_cgf2ia$ = function (coord, color, axisRadius, stemLength) {\n if (axisRadius === void 0)\n axisRadius = 0.0;\n if (stemLength === void 0)\n stemLength = TipLayoutHint$StemLength$NONE_getInstance();\n return new TipLayoutHint(TipLayoutHint$Kind$Y_AXIS_TOOLTIP_getInstance(), coord, axisRadius, color, stemLength);\n };\n TipLayoutHint$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TipLayoutHint$Companion_instance = null;\n function TipLayoutHint$Companion_getInstance() {\n if (TipLayoutHint$Companion_instance === null) {\n new TipLayoutHint$Companion();\n }return TipLayoutHint$Companion_instance;\n }\n TipLayoutHint.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TipLayoutHint',\n interfaces: []\n };\n function TooltipAnchor(verticalAnchor, horizontalAnchor) {\n this.verticalAnchor = verticalAnchor;\n this.horizontalAnchor = horizontalAnchor;\n }\n function TooltipAnchor$VerticalAnchor(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TooltipAnchor$VerticalAnchor_initFields() {\n TooltipAnchor$VerticalAnchor_initFields = function () {\n };\n TooltipAnchor$VerticalAnchor$TOP_instance = new TooltipAnchor$VerticalAnchor('TOP', 0);\n TooltipAnchor$VerticalAnchor$BOTTOM_instance = new TooltipAnchor$VerticalAnchor('BOTTOM', 1);\n TooltipAnchor$VerticalAnchor$MIDDLE_instance = new TooltipAnchor$VerticalAnchor('MIDDLE', 2);\n }\n var TooltipAnchor$VerticalAnchor$TOP_instance;\n function TooltipAnchor$VerticalAnchor$TOP_getInstance() {\n TooltipAnchor$VerticalAnchor_initFields();\n return TooltipAnchor$VerticalAnchor$TOP_instance;\n }\n var TooltipAnchor$VerticalAnchor$BOTTOM_instance;\n function TooltipAnchor$VerticalAnchor$BOTTOM_getInstance() {\n TooltipAnchor$VerticalAnchor_initFields();\n return TooltipAnchor$VerticalAnchor$BOTTOM_instance;\n }\n var TooltipAnchor$VerticalAnchor$MIDDLE_instance;\n function TooltipAnchor$VerticalAnchor$MIDDLE_getInstance() {\n TooltipAnchor$VerticalAnchor_initFields();\n return TooltipAnchor$VerticalAnchor$MIDDLE_instance;\n }\n TooltipAnchor$VerticalAnchor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalAnchor',\n interfaces: [Enum]\n };\n function TooltipAnchor$VerticalAnchor$values() {\n return [TooltipAnchor$VerticalAnchor$TOP_getInstance(), TooltipAnchor$VerticalAnchor$BOTTOM_getInstance(), TooltipAnchor$VerticalAnchor$MIDDLE_getInstance()];\n }\n TooltipAnchor$VerticalAnchor.values = TooltipAnchor$VerticalAnchor$values;\n function TooltipAnchor$VerticalAnchor$valueOf(name) {\n switch (name) {\n case 'TOP':\n return TooltipAnchor$VerticalAnchor$TOP_getInstance();\n case 'BOTTOM':\n return TooltipAnchor$VerticalAnchor$BOTTOM_getInstance();\n case 'MIDDLE':\n return TooltipAnchor$VerticalAnchor$MIDDLE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.TooltipAnchor.VerticalAnchor.' + name);\n }\n }\n TooltipAnchor$VerticalAnchor.valueOf_61zpoe$ = TooltipAnchor$VerticalAnchor$valueOf;\n function TooltipAnchor$HorizontalAnchor(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TooltipAnchor$HorizontalAnchor_initFields() {\n TooltipAnchor$HorizontalAnchor_initFields = function () {\n };\n TooltipAnchor$HorizontalAnchor$LEFT_instance = new TooltipAnchor$HorizontalAnchor('LEFT', 0);\n TooltipAnchor$HorizontalAnchor$RIGHT_instance = new TooltipAnchor$HorizontalAnchor('RIGHT', 1);\n TooltipAnchor$HorizontalAnchor$CENTER_instance = new TooltipAnchor$HorizontalAnchor('CENTER', 2);\n }\n var TooltipAnchor$HorizontalAnchor$LEFT_instance;\n function TooltipAnchor$HorizontalAnchor$LEFT_getInstance() {\n TooltipAnchor$HorizontalAnchor_initFields();\n return TooltipAnchor$HorizontalAnchor$LEFT_instance;\n }\n var TooltipAnchor$HorizontalAnchor$RIGHT_instance;\n function TooltipAnchor$HorizontalAnchor$RIGHT_getInstance() {\n TooltipAnchor$HorizontalAnchor_initFields();\n return TooltipAnchor$HorizontalAnchor$RIGHT_instance;\n }\n var TooltipAnchor$HorizontalAnchor$CENTER_instance;\n function TooltipAnchor$HorizontalAnchor$CENTER_getInstance() {\n TooltipAnchor$HorizontalAnchor_initFields();\n return TooltipAnchor$HorizontalAnchor$CENTER_instance;\n }\n TooltipAnchor$HorizontalAnchor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalAnchor',\n interfaces: [Enum]\n };\n function TooltipAnchor$HorizontalAnchor$values() {\n return [TooltipAnchor$HorizontalAnchor$LEFT_getInstance(), TooltipAnchor$HorizontalAnchor$RIGHT_getInstance(), TooltipAnchor$HorizontalAnchor$CENTER_getInstance()];\n }\n TooltipAnchor$HorizontalAnchor.values = TooltipAnchor$HorizontalAnchor$values;\n function TooltipAnchor$HorizontalAnchor$valueOf(name) {\n switch (name) {\n case 'LEFT':\n return TooltipAnchor$HorizontalAnchor$LEFT_getInstance();\n case 'RIGHT':\n return TooltipAnchor$HorizontalAnchor$RIGHT_getInstance();\n case 'CENTER':\n return TooltipAnchor$HorizontalAnchor$CENTER_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.interact.TooltipAnchor.HorizontalAnchor.' + name);\n }\n }\n TooltipAnchor$HorizontalAnchor.valueOf_61zpoe$ = TooltipAnchor$HorizontalAnchor$valueOf;\n TooltipAnchor.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, TooltipAnchor) ? tmp$_0 : throwCCE();\n if (this.verticalAnchor !== other.verticalAnchor)\n return false;\n if (this.horizontalAnchor !== other.horizontalAnchor)\n return false;\n return true;\n };\n TooltipAnchor.prototype.hashCode = function () {\n var result = this.verticalAnchor.hashCode();\n result = (31 * result | 0) + this.horizontalAnchor.hashCode() | 0;\n return result;\n };\n TooltipAnchor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipAnchor',\n interfaces: []\n };\n function TooltipLineSpec() {\n }\n function TooltipLineSpec$DataPoint(label, value, aes, isAxis, isOutlier) {\n this.label = label;\n this.value = value;\n this.aes = aes;\n this.isAxis = isAxis;\n this.isOutlier = isOutlier;\n }\n TooltipLineSpec$DataPoint.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataPoint',\n interfaces: []\n };\n TooltipLineSpec.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'TooltipLineSpec',\n interfaces: []\n };\n function LivemapConstants() {\n }\n function LivemapConstants$DisplayMode(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LivemapConstants$DisplayMode_initFields() {\n LivemapConstants$DisplayMode_initFields = function () {\n };\n LivemapConstants$DisplayMode$POINT_instance = new LivemapConstants$DisplayMode('POINT', 0);\n LivemapConstants$DisplayMode$PIE_instance = new LivemapConstants$DisplayMode('PIE', 1);\n LivemapConstants$DisplayMode$BAR_instance = new LivemapConstants$DisplayMode('BAR', 2);\n }\n var LivemapConstants$DisplayMode$POINT_instance;\n function LivemapConstants$DisplayMode$POINT_getInstance() {\n LivemapConstants$DisplayMode_initFields();\n return LivemapConstants$DisplayMode$POINT_instance;\n }\n var LivemapConstants$DisplayMode$PIE_instance;\n function LivemapConstants$DisplayMode$PIE_getInstance() {\n LivemapConstants$DisplayMode_initFields();\n return LivemapConstants$DisplayMode$PIE_instance;\n }\n var LivemapConstants$DisplayMode$BAR_instance;\n function LivemapConstants$DisplayMode$BAR_getInstance() {\n LivemapConstants$DisplayMode_initFields();\n return LivemapConstants$DisplayMode$BAR_instance;\n }\n LivemapConstants$DisplayMode.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DisplayMode',\n interfaces: [Enum]\n };\n function LivemapConstants$DisplayMode$values() {\n return [LivemapConstants$DisplayMode$POINT_getInstance(), LivemapConstants$DisplayMode$PIE_getInstance(), LivemapConstants$DisplayMode$BAR_getInstance()];\n }\n LivemapConstants$DisplayMode.values = LivemapConstants$DisplayMode$values;\n function LivemapConstants$DisplayMode$valueOf(name) {\n switch (name) {\n case 'POINT':\n return LivemapConstants$DisplayMode$POINT_getInstance();\n case 'PIE':\n return LivemapConstants$DisplayMode$PIE_getInstance();\n case 'BAR':\n return LivemapConstants$DisplayMode$BAR_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.livemap.LivemapConstants.DisplayMode.' + name);\n }\n }\n LivemapConstants$DisplayMode.valueOf_61zpoe$ = LivemapConstants$DisplayMode$valueOf;\n function LivemapConstants$Theme(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LivemapConstants$Theme_initFields() {\n LivemapConstants$Theme_initFields = function () {\n };\n LivemapConstants$Theme$COLOR_instance = new LivemapConstants$Theme('COLOR', 0);\n LivemapConstants$Theme$LIGHT_instance = new LivemapConstants$Theme('LIGHT', 1);\n LivemapConstants$Theme$DARK_instance = new LivemapConstants$Theme('DARK', 2);\n }\n var LivemapConstants$Theme$COLOR_instance;\n function LivemapConstants$Theme$COLOR_getInstance() {\n LivemapConstants$Theme_initFields();\n return LivemapConstants$Theme$COLOR_instance;\n }\n var LivemapConstants$Theme$LIGHT_instance;\n function LivemapConstants$Theme$LIGHT_getInstance() {\n LivemapConstants$Theme_initFields();\n return LivemapConstants$Theme$LIGHT_instance;\n }\n var LivemapConstants$Theme$DARK_instance;\n function LivemapConstants$Theme$DARK_getInstance() {\n LivemapConstants$Theme_initFields();\n return LivemapConstants$Theme$DARK_instance;\n }\n LivemapConstants$Theme.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Theme',\n interfaces: [Enum]\n };\n function LivemapConstants$Theme$values() {\n return [LivemapConstants$Theme$COLOR_getInstance(), LivemapConstants$Theme$LIGHT_getInstance(), LivemapConstants$Theme$DARK_getInstance()];\n }\n LivemapConstants$Theme.values = LivemapConstants$Theme$values;\n function LivemapConstants$Theme$valueOf(name) {\n switch (name) {\n case 'COLOR':\n return LivemapConstants$Theme$COLOR_getInstance();\n case 'LIGHT':\n return LivemapConstants$Theme$LIGHT_getInstance();\n case 'DARK':\n return LivemapConstants$Theme$DARK_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.livemap.LivemapConstants.Theme.' + name);\n }\n }\n LivemapConstants$Theme.valueOf_61zpoe$ = LivemapConstants$Theme$valueOf;\n function LivemapConstants$Projection(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LivemapConstants$Projection_initFields() {\n LivemapConstants$Projection_initFields = function () {\n };\n LivemapConstants$Projection$EPSG3857_instance = new LivemapConstants$Projection('EPSG3857', 0);\n LivemapConstants$Projection$EPSG4326_instance = new LivemapConstants$Projection('EPSG4326', 1);\n LivemapConstants$Projection$AZIMUTHAL_instance = new LivemapConstants$Projection('AZIMUTHAL', 2);\n LivemapConstants$Projection$CONIC_instance = new LivemapConstants$Projection('CONIC', 3);\n }\n var LivemapConstants$Projection$EPSG3857_instance;\n function LivemapConstants$Projection$EPSG3857_getInstance() {\n LivemapConstants$Projection_initFields();\n return LivemapConstants$Projection$EPSG3857_instance;\n }\n var LivemapConstants$Projection$EPSG4326_instance;\n function LivemapConstants$Projection$EPSG4326_getInstance() {\n LivemapConstants$Projection_initFields();\n return LivemapConstants$Projection$EPSG4326_instance;\n }\n var LivemapConstants$Projection$AZIMUTHAL_instance;\n function LivemapConstants$Projection$AZIMUTHAL_getInstance() {\n LivemapConstants$Projection_initFields();\n return LivemapConstants$Projection$AZIMUTHAL_instance;\n }\n var LivemapConstants$Projection$CONIC_instance;\n function LivemapConstants$Projection$CONIC_getInstance() {\n LivemapConstants$Projection_initFields();\n return LivemapConstants$Projection$CONIC_instance;\n }\n LivemapConstants$Projection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Projection',\n interfaces: [Enum]\n };\n function LivemapConstants$Projection$values() {\n return [LivemapConstants$Projection$EPSG3857_getInstance(), LivemapConstants$Projection$EPSG4326_getInstance(), LivemapConstants$Projection$AZIMUTHAL_getInstance(), LivemapConstants$Projection$CONIC_getInstance()];\n }\n LivemapConstants$Projection.values = LivemapConstants$Projection$values;\n function LivemapConstants$Projection$valueOf(name) {\n switch (name) {\n case 'EPSG3857':\n return LivemapConstants$Projection$EPSG3857_getInstance();\n case 'EPSG4326':\n return LivemapConstants$Projection$EPSG4326_getInstance();\n case 'AZIMUTHAL':\n return LivemapConstants$Projection$AZIMUTHAL_getInstance();\n case 'CONIC':\n return LivemapConstants$Projection$CONIC_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.livemap.LivemapConstants.Projection.' + name);\n }\n }\n LivemapConstants$Projection.valueOf_61zpoe$ = LivemapConstants$Projection$valueOf;\n LivemapConstants.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LivemapConstants',\n interfaces: []\n };\n function LiveMapOptions(zoom, location, stroke, interactive, displayMode, scaled, clustering, labels, projection, geodesic, geocodingService, tileProvider, devParams) {\n this.zoom = zoom;\n this.location = location;\n this.stroke = stroke;\n this.interactive = interactive;\n this.displayMode = displayMode;\n this.scaled = scaled;\n this.clustering = clustering;\n this.labels = labels;\n this.projection = projection;\n this.geodesic = geodesic;\n this.geocodingService = geocodingService;\n this.tileProvider = tileProvider;\n this.devParams = devParams;\n }\n LiveMapOptions.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LiveMapOptions',\n interfaces: []\n };\n function DodgePos(aesthetics, myGroupCount, myWidth) {\n this.myGroupCount_0 = myGroupCount;\n this.myWidth_0 = myWidth;\n this.myDodgingNeeded_0 = false;\n this.myDodgingNeeded_0 = this.isDodgingNeeded_0(aesthetics);\n }\n DodgePos.prototype.isDodgingNeeded_0 = function (aesthetics) {\n var tmp$;\n var groupByX = HashMap_init();\n tmp$ = aesthetics.dataPointCount();\n for (var i = 0; i < tmp$; i++) {\n var p = aesthetics.dataPointAt_za3lpa$(i);\n if (p.defined_896ixz$(Aes$Companion_getInstance().X)) {\n var x = ensureNotNull(p.x());\n var group = p.group();\n if (groupByX.containsKey_11rb$(x)) {\n if (groupByX.get_11rb$(x) != group) {\n return true;\n }} else {\n groupByX.put_xwzc9p$(x, group);\n }\n }}\n return false;\n };\n DodgePos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n var tmp$;\n if (this.myDodgingNeeded_0) {\n var dataResolution = ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n var width = (tmp$ = this.myWidth_0) != null ? tmp$ : p.width();\n if (!data.SeriesUtil.isFinite_yrwdxb$(width)) {\n return v;\n }var slotIndex = ensureNotNull(p.group());\n var median = (this.myGroupCount_0 - 1 | 0) / 2.0;\n var xOffset = (slotIndex - median) * dataResolution * ensureNotNull(width);\n var xCenter = ensureNotNull(p.x());\n var xScaler = 1.0 / this.myGroupCount_0;\n var newX = (v.x + xOffset - xCenter) * xScaler + xCenter;\n return new DoubleVector(newX, v.y);\n }return v;\n };\n DodgePos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$DODGE_getInstance().handlesGroups();\n };\n DodgePos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DodgePos',\n interfaces: [PositionAdjustment]\n };\n function FillPos(aes) {\n this.myStackPosHelper_0 = StackPos$Companion_getInstance().splitPositiveNegative_m7huy5$(aes);\n this.myScalerByIndex_0 = this.mapIndexToScaler_0(aes);\n }\n FillPos.prototype.mapIndexToScaler_0 = function (aes) {\n var tmp$, tmp$_0;\n var posMaxByBin = HashMap_init();\n var negMaxByBin = HashMap_init();\n tmp$ = aes.dataPointCount();\n for (var i = 0; i < tmp$; i++) {\n var dataPoint = aes.dataPointAt_za3lpa$(i);\n var x = dataPoint.x();\n if (data.SeriesUtil.isFinite_yrwdxb$(x)) {\n var tmp$_1;\n if (!(Kotlin.isType(tmp$_1 = posMaxByBin, Map) ? tmp$_1 : throwCCE()).containsKey_11rb$(x)) {\n var key = ensureNotNull(x);\n posMaxByBin.put_xwzc9p$(key, 0.0);\n negMaxByBin.put_xwzc9p$(x, 0.0);\n }var y = dataPoint.y();\n if (data.SeriesUtil.isFinite_yrwdxb$(y)) {\n if (ensureNotNull(y) >= 0) {\n var key_0 = ensureNotNull(x);\n var value = ensureNotNull(posMaxByBin.get_11rb$(x)) + y;\n posMaxByBin.put_xwzc9p$(key_0, value);\n } else {\n var key_1 = ensureNotNull(x);\n var value_0 = ensureNotNull(negMaxByBin.get_11rb$(x)) - y;\n negMaxByBin.put_xwzc9p$(key_1, value_0);\n }\n }}}\n var scalerByIndex = HashMap_init();\n tmp$_0 = aes.dataPointCount();\n for (var i_0 = 0; i_0 < tmp$_0; i_0++) {\n var dataPoint_0 = aes.dataPointAt_za3lpa$(i_0);\n var x_0 = dataPoint_0.x();\n var y_0 = dataPoint_0.y();\n var tmp$_2;\n if ((Kotlin.isType(tmp$_2 = posMaxByBin, Map) ? tmp$_2 : throwCCE()).containsKey_11rb$(x_0) && data.SeriesUtil.isFinite_yrwdxb$(y_0)) {\n var tmp$_3 = ensureNotNull(y_0) >= 0;\n if (tmp$_3) {\n var tmp$_4;\n tmp$_3 = ensureNotNull((Kotlin.isType(tmp$_4 = posMaxByBin, Map) ? tmp$_4 : throwCCE()).get_11rb$(x_0)) > 0;\n }if (tmp$_3) {\n var tmp$_5;\n var value_1 = 1.0 / ensureNotNull((Kotlin.isType(tmp$_5 = posMaxByBin, Map) ? tmp$_5 : throwCCE()).get_11rb$(x_0));\n scalerByIndex.put_xwzc9p$(i_0, value_1);\n } else {\n var tmp$_6 = y_0 < 0;\n if (tmp$_6) {\n var tmp$_7;\n tmp$_6 = ensureNotNull((Kotlin.isType(tmp$_7 = negMaxByBin, Map) ? tmp$_7 : throwCCE()).get_11rb$(x_0)) > 0;\n }if (tmp$_6) {\n var tmp$_8;\n var value_2 = 1.0 / ensureNotNull((Kotlin.isType(tmp$_8 = negMaxByBin, Map) ? tmp$_8 : throwCCE()).get_11rb$(x_0));\n scalerByIndex.put_xwzc9p$(i_0, value_2);\n } else {\n scalerByIndex.put_xwzc9p$(i_0, 1.0);\n }\n }\n } else {\n scalerByIndex.put_xwzc9p$(i_0, 1.0);\n }\n }\n return scalerByIndex;\n };\n FillPos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n var newLoc = this.myStackPosHelper_0.translate_tshsjz$(v, p, ctx);\n return new DoubleVector(newLoc.x, newLoc.y * ensureNotNull(this.myScalerByIndex_0.get_11rb$(p.index())) * ctx.getUnitResolution_vktour$(Aes$Companion_getInstance().Y));\n };\n FillPos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$FILL_getInstance().handlesGroups();\n };\n FillPos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FillPos',\n interfaces: [PositionAdjustment]\n };\n function JitterDodgePos(aesthetics, groupCount, width, jitterWidth, jitterHeight) {\n this.myJitterPosHelper_0 = null;\n this.myDodgePosHelper_0 = null;\n this.myJitterPosHelper_0 = new JitterPos(jitterWidth, jitterHeight);\n this.myDodgePosHelper_0 = new DodgePos(aesthetics, groupCount, width);\n }\n JitterDodgePos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n var afterJitter = this.myJitterPosHelper_0.translate_tshsjz$(v, p, ctx);\n return this.myDodgePosHelper_0.translate_tshsjz$(afterJitter, p, ctx);\n };\n JitterDodgePos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$JITTER_DODGE_getInstance().handlesGroups();\n };\n JitterDodgePos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JitterDodgePos',\n interfaces: [PositionAdjustment]\n };\n function JitterPos(width, height) {\n JitterPos$Companion_getInstance();\n this.myWidth_0 = 0;\n this.myHeight_0 = 0;\n this.myWidth_0 = width != null ? width : JitterPos$Companion_getInstance().DEF_JITTER_WIDTH;\n this.myHeight_0 = height != null ? height : JitterPos$Companion_getInstance().DEF_JITTER_HEIGHT;\n }\n JitterPos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n var x = (2 * Random.Default.nextDouble() - 1) * this.myWidth_0 * ctx.getResolution_vktour$(Aes$Companion_getInstance().X);\n var y = (2 * Random.Default.nextDouble() - 1) * this.myHeight_0 * ctx.getResolution_vktour$(Aes$Companion_getInstance().Y);\n return v.add_gpjtzr$(new DoubleVector(x, y));\n };\n JitterPos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$JITTER_getInstance().handlesGroups();\n };\n function JitterPos$Companion() {\n JitterPos$Companion_instance = this;\n this.DEF_JITTER_WIDTH = 0.4;\n this.DEF_JITTER_HEIGHT = 0.4;\n }\n JitterPos$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var JitterPos$Companion_instance = null;\n function JitterPos$Companion_getInstance() {\n if (JitterPos$Companion_instance === null) {\n new JitterPos$Companion();\n }return JitterPos$Companion_instance;\n }\n JitterPos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'JitterPos',\n interfaces: [PositionAdjustment]\n };\n function NudgePos(width, height) {\n NudgePos$Companion_getInstance();\n this.myWidth_0 = 0;\n this.myHeight_0 = 0;\n this.myWidth_0 = width != null ? width : NudgePos$Companion_getInstance().DEF_NUDGE_WIDTH;\n this.myHeight_0 = height != null ? height : NudgePos$Companion_getInstance().DEF_NUDGE_HEIGHT;\n }\n NudgePos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n var x = this.myWidth_0 * ctx.getUnitResolution_vktour$(Aes$Companion_getInstance().X);\n var y = this.myHeight_0 * ctx.getUnitResolution_vktour$(Aes$Companion_getInstance().Y);\n return v.add_gpjtzr$(new DoubleVector(x, y));\n };\n NudgePos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$NUDGE_getInstance().handlesGroups();\n };\n function NudgePos$Companion() {\n NudgePos$Companion_instance = this;\n this.DEF_NUDGE_WIDTH = 0.0;\n this.DEF_NUDGE_HEIGHT = 0.0;\n }\n NudgePos$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var NudgePos$Companion_instance = null;\n function NudgePos$Companion_getInstance() {\n if (NudgePos$Companion_instance === null) {\n new NudgePos$Companion();\n }return NudgePos$Companion_instance;\n }\n NudgePos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NudgePos',\n interfaces: [PositionAdjustment]\n };\n function PositionAdjustments() {\n PositionAdjustments_instance = this;\n }\n function PositionAdjustments$identity$ObjectLiteral() {\n }\n Object.defineProperty(PositionAdjustments$identity$ObjectLiteral.prototype, 'isIdentity', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n PositionAdjustments$identity$ObjectLiteral.prototype.translate_tshsjz$ = function (v, p, ctx) {\n return v;\n };\n PositionAdjustments$identity$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$IDENTITY_getInstance().handlesGroups();\n };\n PositionAdjustments$identity$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PositionAdjustment]\n };\n PositionAdjustments.prototype.identity = function () {\n return new PositionAdjustments$identity$ObjectLiteral();\n };\n PositionAdjustments.prototype.dodge_vvhcz8$ = function (aesthetics, groupCount, width) {\n return new DodgePos(aesthetics, groupCount, width);\n };\n PositionAdjustments.prototype.stack_4vnpmn$ = function (aes, strategy) {\n var tmp$;\n switch (strategy.name) {\n case 'SPLIT_POSITIVE_NEGATIVE':\n tmp$ = StackPos$Companion_getInstance().splitPositiveNegative_m7huy5$(aes);\n break;\n case 'SUM_POSITIVE_NEGATIVE':\n tmp$ = StackPos$Companion_getInstance().sumPositiveNegative_m7huy5$(aes);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n PositionAdjustments.prototype.fill_m7huy5$ = function (aesthetics) {\n return new FillPos(aesthetics);\n };\n PositionAdjustments.prototype.jitter_jma9l8$ = function (width, height) {\n return new JitterPos(width, height);\n };\n PositionAdjustments.prototype.nudge_jma9l8$ = function (width, height) {\n return new NudgePos(width, height);\n };\n PositionAdjustments.prototype.jitterDodge_e2pc44$ = function (aesthetics, groupCount, width, jitterWidth, jitterHeight) {\n return new JitterDodgePos(aesthetics, groupCount, width, jitterWidth, jitterHeight);\n };\n function PositionAdjustments$Meta(name, ordinal, myHandlesGroups) {\n Enum.call(this);\n this.myHandlesGroups_39qcox$_0 = myHandlesGroups;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function PositionAdjustments$Meta_initFields() {\n PositionAdjustments$Meta_initFields = function () {\n };\n PositionAdjustments$Meta$IDENTITY_instance = new PositionAdjustments$Meta('IDENTITY', 0, false);\n PositionAdjustments$Meta$DODGE_instance = new PositionAdjustments$Meta('DODGE', 1, true);\n PositionAdjustments$Meta$STACK_instance = new PositionAdjustments$Meta('STACK', 2, true);\n PositionAdjustments$Meta$FILL_instance = new PositionAdjustments$Meta('FILL', 3, true);\n PositionAdjustments$Meta$JITTER_instance = new PositionAdjustments$Meta('JITTER', 4, false);\n PositionAdjustments$Meta$NUDGE_instance = new PositionAdjustments$Meta('NUDGE', 5, false);\n PositionAdjustments$Meta$JITTER_DODGE_instance = new PositionAdjustments$Meta('JITTER_DODGE', 6, true);\n }\n var PositionAdjustments$Meta$IDENTITY_instance;\n function PositionAdjustments$Meta$IDENTITY_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$IDENTITY_instance;\n }\n var PositionAdjustments$Meta$DODGE_instance;\n function PositionAdjustments$Meta$DODGE_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$DODGE_instance;\n }\n var PositionAdjustments$Meta$STACK_instance;\n function PositionAdjustments$Meta$STACK_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$STACK_instance;\n }\n var PositionAdjustments$Meta$FILL_instance;\n function PositionAdjustments$Meta$FILL_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$FILL_instance;\n }\n var PositionAdjustments$Meta$JITTER_instance;\n function PositionAdjustments$Meta$JITTER_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$JITTER_instance;\n }\n var PositionAdjustments$Meta$NUDGE_instance;\n function PositionAdjustments$Meta$NUDGE_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$NUDGE_instance;\n }\n var PositionAdjustments$Meta$JITTER_DODGE_instance;\n function PositionAdjustments$Meta$JITTER_DODGE_getInstance() {\n PositionAdjustments$Meta_initFields();\n return PositionAdjustments$Meta$JITTER_DODGE_instance;\n }\n PositionAdjustments$Meta.prototype.handlesGroups = function () {\n return this.myHandlesGroups_39qcox$_0;\n };\n PositionAdjustments$Meta.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Meta',\n interfaces: [Enum]\n };\n function PositionAdjustments$Meta$values() {\n return [PositionAdjustments$Meta$IDENTITY_getInstance(), PositionAdjustments$Meta$DODGE_getInstance(), PositionAdjustments$Meta$STACK_getInstance(), PositionAdjustments$Meta$FILL_getInstance(), PositionAdjustments$Meta$JITTER_getInstance(), PositionAdjustments$Meta$NUDGE_getInstance(), PositionAdjustments$Meta$JITTER_DODGE_getInstance()];\n }\n PositionAdjustments$Meta.values = PositionAdjustments$Meta$values;\n function PositionAdjustments$Meta$valueOf(name) {\n switch (name) {\n case 'IDENTITY':\n return PositionAdjustments$Meta$IDENTITY_getInstance();\n case 'DODGE':\n return PositionAdjustments$Meta$DODGE_getInstance();\n case 'STACK':\n return PositionAdjustments$Meta$STACK_getInstance();\n case 'FILL':\n return PositionAdjustments$Meta$FILL_getInstance();\n case 'JITTER':\n return PositionAdjustments$Meta$JITTER_getInstance();\n case 'NUDGE':\n return PositionAdjustments$Meta$NUDGE_getInstance();\n case 'JITTER_DODGE':\n return PositionAdjustments$Meta$JITTER_DODGE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.pos.PositionAdjustments.Meta.' + name);\n }\n }\n PositionAdjustments$Meta.valueOf_61zpoe$ = PositionAdjustments$Meta$valueOf;\n function PositionAdjustments$StackingStrategy(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function PositionAdjustments$StackingStrategy_initFields() {\n PositionAdjustments$StackingStrategy_initFields = function () {\n };\n PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_instance = new PositionAdjustments$StackingStrategy('SUM_POSITIVE_NEGATIVE', 0);\n PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_instance = new PositionAdjustments$StackingStrategy('SPLIT_POSITIVE_NEGATIVE', 1);\n }\n var PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_instance;\n function PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_getInstance() {\n PositionAdjustments$StackingStrategy_initFields();\n return PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_instance;\n }\n var PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_instance;\n function PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_getInstance() {\n PositionAdjustments$StackingStrategy_initFields();\n return PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_instance;\n }\n PositionAdjustments$StackingStrategy.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StackingStrategy',\n interfaces: [Enum]\n };\n function PositionAdjustments$StackingStrategy$values() {\n return [PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_getInstance(), PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_getInstance()];\n }\n PositionAdjustments$StackingStrategy.values = PositionAdjustments$StackingStrategy$values;\n function PositionAdjustments$StackingStrategy$valueOf(name) {\n switch (name) {\n case 'SUM_POSITIVE_NEGATIVE':\n return PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_getInstance();\n case 'SPLIT_POSITIVE_NEGATIVE':\n return PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.pos.PositionAdjustments.StackingStrategy.' + name);\n }\n }\n PositionAdjustments$StackingStrategy.valueOf_61zpoe$ = PositionAdjustments$StackingStrategy$valueOf;\n PositionAdjustments.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PositionAdjustments',\n interfaces: []\n };\n var PositionAdjustments_instance = null;\n function PositionAdjustments_getInstance() {\n if (PositionAdjustments_instance === null) {\n new PositionAdjustments();\n }return PositionAdjustments_instance;\n }\n function StackPos(aes) {\n StackPos$Companion_getInstance();\n this.myOffsetByIndex_0 = null;\n this.myOffsetByIndex_0 = this.mapIndexToOffset_m7huy5$(aes);\n }\n StackPos.prototype.translate_tshsjz$ = function (v, p, ctx) {\n return v.add_gpjtzr$(new DoubleVector(0.0, ensureNotNull(this.myOffsetByIndex_0.get_11rb$(p.index()))));\n };\n StackPos.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta$STACK_getInstance().handlesGroups();\n };\n function StackPos$SplitPositiveNegative(aes) {\n StackPos.call(this, aes);\n }\n StackPos$SplitPositiveNegative.prototype.mapIndexToOffset_m7huy5$ = function (aes) {\n var tmp$;\n var offsetByIndex = HashMap_init();\n var negPosBaseByBin = HashMap_init();\n tmp$ = aes.dataPointCount();\n for (var i = 0; i < tmp$; i++) {\n var dataPoint = aes.dataPointAt_za3lpa$(i);\n var x = dataPoint.x();\n if (data.SeriesUtil.isFinite_yrwdxb$(x)) {\n var tmp$_0;\n if (!(Kotlin.isType(tmp$_0 = negPosBaseByBin, Map) ? tmp$_0 : throwCCE()).containsKey_11rb$(x)) {\n var key = ensureNotNull(x);\n var value = new Pair(new MutableDouble(0.0), new MutableDouble(0.0));\n negPosBaseByBin.put_xwzc9p$(key, value);\n }var y = dataPoint.y();\n if (data.SeriesUtil.isFinite_yrwdxb$(y)) {\n var tmp$_1;\n var pair = ensureNotNull((Kotlin.isType(tmp$_1 = negPosBaseByBin, Map) ? tmp$_1 : throwCCE()).get_11rb$(x));\n var offset;\n if (ensureNotNull(y) >= 0) {\n offset = pair.second.getAndAdd_14dthe$(y);\n } else {\n offset = pair.first.getAndAdd_14dthe$(y);\n }\n var value_0 = offset;\n offsetByIndex.put_xwzc9p$(i, value_0);\n }}}\n return offsetByIndex;\n };\n StackPos$SplitPositiveNegative.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SplitPositiveNegative',\n interfaces: [StackPos]\n };\n function StackPos$SumPositiveNegative(aes) {\n StackPos.call(this, aes);\n }\n StackPos$SumPositiveNegative.prototype.mapIndexToOffset_m7huy5$ = function (aes) {\n var tmp$;\n var offsetByIndex = HashMap_init();\n var baseByBin = HashMap_init();\n tmp$ = aes.dataPointCount();\n for (var i = 0; i < tmp$; i++) {\n var dataPointAes = aes.dataPointAt_za3lpa$(i);\n var x = ensureNotNull(dataPointAes.x());\n if (data.SeriesUtil.isFinite_14dthe$(x)) {\n if (!baseByBin.containsKey_11rb$(x)) {\n var value = new MutableDouble(0.0);\n baseByBin.put_xwzc9p$(x, value);\n }var y = ensureNotNull(dataPointAes.y());\n if (data.SeriesUtil.isFinite_14dthe$(y)) {\n var base = ensureNotNull(baseByBin.get_11rb$(x));\n var offset = base.getAndAdd_14dthe$(y);\n offsetByIndex.put_xwzc9p$(i, offset);\n }}}\n return offsetByIndex;\n };\n StackPos$SumPositiveNegative.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SumPositiveNegative',\n interfaces: [StackPos]\n };\n function StackPos$Companion() {\n StackPos$Companion_instance = this;\n }\n StackPos$Companion.prototype.splitPositiveNegative_m7huy5$ = function (aes) {\n return new StackPos$SplitPositiveNegative(aes);\n };\n StackPos$Companion.prototype.sumPositiveNegative_m7huy5$ = function (aes) {\n return new StackPos$SumPositiveNegative(aes);\n };\n StackPos$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var StackPos$Companion_instance = null;\n function StackPos$Companion_getInstance() {\n if (StackPos$Companion_instance === null) {\n new StackPos$Companion();\n }return StackPos$Companion_instance;\n }\n StackPos.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StackPos',\n interfaces: [PositionAdjustment]\n };\n function LegendKeyElementFactory() {\n }\n LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = function (p) {\n var strokeWidth = AesScaling_getInstance().strokeWidth_l6g9mh$(p);\n var size = 2 * strokeWidth + 4;\n return new DoubleVector(size, size);\n };\n LegendKeyElementFactory.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LegendKeyElementFactory',\n interfaces: []\n };\n function SvgRoot() {\n }\n SvgRoot.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'SvgRoot',\n interfaces: []\n };\n function LineType() {\n }\n LineType.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LineType',\n interfaces: []\n };\n function NamedLineType(name, ordinal, code, myDashArray) {\n Enum.call(this);\n this.code = code;\n this.myDashArray_j93rys$_0 = myDashArray;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function NamedLineType_initFields() {\n NamedLineType_initFields = function () {\n };\n new NamedLineType$BLANK();\n new NamedLineType$SOLID();\n NamedLineType$DASHED_instance = new NamedLineType('DASHED', 2, 2, listOf([4.3, 4.3]));\n NamedLineType$DOTTED_instance = new NamedLineType('DOTTED', 3, 3, listOf([1.0, 3.2]));\n NamedLineType$DOTDASH_instance = new NamedLineType('DOTDASH', 4, 4, listOf([1.0, 3.2, 4.3, 3.2]));\n NamedLineType$LONGDASH_instance = new NamedLineType('LONGDASH', 5, 5, listOf([7.4, 3.2]));\n NamedLineType$TWODASH_instance = new NamedLineType('TWODASH', 6, 6, listOf([2.4, 2.4, 6.4, 2.4]));\n }\n function NamedLineType$BLANK() {\n NamedLineType$BLANK_instance = this;\n NamedLineType.call(this, 'BLANK', 0, 0, null);\n }\n Object.defineProperty(NamedLineType$BLANK.prototype, 'isBlank', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n NamedLineType$BLANK.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BLANK',\n interfaces: [NamedLineType]\n };\n var NamedLineType$BLANK_instance = null;\n function NamedLineType$BLANK_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$BLANK_instance;\n }\n function NamedLineType$SOLID() {\n NamedLineType$SOLID_instance = this;\n NamedLineType.call(this, 'SOLID', 1, 1, null);\n }\n Object.defineProperty(NamedLineType$SOLID.prototype, 'isSolid', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n NamedLineType$SOLID.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SOLID',\n interfaces: [NamedLineType]\n };\n var NamedLineType$SOLID_instance = null;\n function NamedLineType$SOLID_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$SOLID_instance;\n }\n var NamedLineType$DASHED_instance;\n function NamedLineType$DASHED_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$DASHED_instance;\n }\n var NamedLineType$DOTTED_instance;\n function NamedLineType$DOTTED_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$DOTTED_instance;\n }\n var NamedLineType$DOTDASH_instance;\n function NamedLineType$DOTDASH_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$DOTDASH_instance;\n }\n var NamedLineType$LONGDASH_instance;\n function NamedLineType$LONGDASH_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$LONGDASH_instance;\n }\n var NamedLineType$TWODASH_instance;\n function NamedLineType$TWODASH_getInstance() {\n NamedLineType_initFields();\n return NamedLineType$TWODASH_instance;\n }\n Object.defineProperty(NamedLineType.prototype, 'isSolid', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(NamedLineType.prototype, 'isBlank', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(NamedLineType.prototype, 'dashArray', {\n configurable: true,\n get: function () {\n if (!(this.isSolid || this.isBlank)) {\n return ensureNotNull(this.myDashArray_j93rys$_0);\n }throw IllegalStateException_init('No dash array in ' + this.name.toLowerCase() + ' linetype');\n }\n });\n NamedLineType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NamedLineType',\n interfaces: [LineType, Enum]\n };\n function NamedLineType$values() {\n return [NamedLineType$BLANK_getInstance(), NamedLineType$SOLID_getInstance(), NamedLineType$DASHED_getInstance(), NamedLineType$DOTTED_getInstance(), NamedLineType$DOTDASH_getInstance(), NamedLineType$LONGDASH_getInstance(), NamedLineType$TWODASH_getInstance()];\n }\n NamedLineType.values = NamedLineType$values;\n function NamedLineType$valueOf(name) {\n switch (name) {\n case 'BLANK':\n return NamedLineType$BLANK_getInstance();\n case 'SOLID':\n return NamedLineType$SOLID_getInstance();\n case 'DASHED':\n return NamedLineType$DASHED_getInstance();\n case 'DOTTED':\n return NamedLineType$DOTTED_getInstance();\n case 'DOTDASH':\n return NamedLineType$DOTDASH_getInstance();\n case 'LONGDASH':\n return NamedLineType$LONGDASH_getInstance();\n case 'TWODASH':\n return NamedLineType$TWODASH_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.render.linetype.NamedLineType.' + name);\n }\n }\n NamedLineType.valueOf_61zpoe$ = NamedLineType$valueOf;\n function NamedShape(name, ordinal, code, isSolid, isFilled, isSmall) {\n if (isSolid === void 0)\n isSolid = false;\n if (isFilled === void 0)\n isFilled = false;\n if (isSmall === void 0)\n isSmall = false;\n Enum.call(this);\n this.code_djxmtz$_0 = code;\n this.isSolid = isSolid;\n this.isFilled = isFilled;\n this.isSmall_kvok7h$_0 = isSmall;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function NamedShape_initFields() {\n NamedShape_initFields = function () {\n };\n NamedShape$STICK_SQUARE_instance = new NamedShape('STICK_SQUARE', 0, 0);\n NamedShape$STICK_CIRCLE_instance = new NamedShape('STICK_CIRCLE', 1, 1);\n NamedShape$STICK_TRIANGLE_UP_instance = new NamedShape('STICK_TRIANGLE_UP', 2, 2);\n NamedShape$STICK_PLUS_instance = new NamedShape('STICK_PLUS', 3, 3);\n NamedShape$STICK_CROSS_instance = new NamedShape('STICK_CROSS', 4, 4);\n NamedShape$STICK_DIAMOND_instance = new NamedShape('STICK_DIAMOND', 5, 5);\n NamedShape$STICK_TRIANGLE_DOWN_instance = new NamedShape('STICK_TRIANGLE_DOWN', 6, 6);\n NamedShape$STICK_SQUARE_CROSS_instance = new NamedShape('STICK_SQUARE_CROSS', 7, 7);\n NamedShape$STICK_STAR_instance = new NamedShape('STICK_STAR', 8, 8);\n NamedShape$STICK_DIAMOND_PLUS_instance = new NamedShape('STICK_DIAMOND_PLUS', 9, 9);\n NamedShape$STICK_CIRCLE_PLUS_instance = new NamedShape('STICK_CIRCLE_PLUS', 10, 10);\n NamedShape$STICK_TRIANGLE_UP_DOWN_instance = new NamedShape('STICK_TRIANGLE_UP_DOWN', 11, 11);\n NamedShape$STICK_SQUARE_PLUS_instance = new NamedShape('STICK_SQUARE_PLUS', 12, 12);\n NamedShape$STICK_CIRCLE_CROSS_instance = new NamedShape('STICK_CIRCLE_CROSS', 13, 13);\n NamedShape$STICK_SQUARE_TRIANGLE_UP_instance = new NamedShape('STICK_SQUARE_TRIANGLE_UP', 14, 14);\n NamedShape$SOLID_SQUARE_instance = new NamedShape('SOLID_SQUARE', 15, 15, true, false);\n NamedShape$SOLID_CIRCLE_instance = new NamedShape('SOLID_CIRCLE', 16, 16, true, false);\n NamedShape$SOLID_TRIANGLE_UP_instance = new NamedShape('SOLID_TRIANGLE_UP', 17, 17, true, false);\n NamedShape$SOLID_DIAMOND_instance = new NamedShape('SOLID_DIAMOND', 18, 18, true, false, true);\n NamedShape$SOLID_CIRCLE_2_instance = new NamedShape('SOLID_CIRCLE_2', 19, 19, true, false);\n NamedShape$BULLET_instance = new NamedShape('BULLET', 20, 20, true, false, true);\n NamedShape$FILLED_CIRCLE_instance = new NamedShape('FILLED_CIRCLE', 21, 21, false, true);\n NamedShape$FILLED_SQUARE_instance = new NamedShape('FILLED_SQUARE', 22, 22, false, true);\n NamedShape$FILLED_DIAMOND_instance = new NamedShape('FILLED_DIAMOND', 23, 23, false, true);\n NamedShape$FILLED_TRIANGLE_UP_instance = new NamedShape('FILLED_TRIANGLE_UP', 24, 24, false, true);\n NamedShape$FILLED_TRIANGLE_DOWN_instance = new NamedShape('FILLED_TRIANGLE_DOWN', 25, 25, false, true);\n }\n Object.defineProperty(NamedShape.prototype, 'code', {\n get: function () {\n return this.code_djxmtz$_0;\n }\n });\n var NamedShape$STICK_SQUARE_instance;\n function NamedShape$STICK_SQUARE_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_SQUARE_instance;\n }\n var NamedShape$STICK_CIRCLE_instance;\n function NamedShape$STICK_CIRCLE_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_CIRCLE_instance;\n }\n var NamedShape$STICK_TRIANGLE_UP_instance;\n function NamedShape$STICK_TRIANGLE_UP_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_TRIANGLE_UP_instance;\n }\n var NamedShape$STICK_PLUS_instance;\n function NamedShape$STICK_PLUS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_PLUS_instance;\n }\n var NamedShape$STICK_CROSS_instance;\n function NamedShape$STICK_CROSS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_CROSS_instance;\n }\n var NamedShape$STICK_DIAMOND_instance;\n function NamedShape$STICK_DIAMOND_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_DIAMOND_instance;\n }\n var NamedShape$STICK_TRIANGLE_DOWN_instance;\n function NamedShape$STICK_TRIANGLE_DOWN_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_TRIANGLE_DOWN_instance;\n }\n var NamedShape$STICK_SQUARE_CROSS_instance;\n function NamedShape$STICK_SQUARE_CROSS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_SQUARE_CROSS_instance;\n }\n var NamedShape$STICK_STAR_instance;\n function NamedShape$STICK_STAR_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_STAR_instance;\n }\n var NamedShape$STICK_DIAMOND_PLUS_instance;\n function NamedShape$STICK_DIAMOND_PLUS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_DIAMOND_PLUS_instance;\n }\n var NamedShape$STICK_CIRCLE_PLUS_instance;\n function NamedShape$STICK_CIRCLE_PLUS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_CIRCLE_PLUS_instance;\n }\n var NamedShape$STICK_TRIANGLE_UP_DOWN_instance;\n function NamedShape$STICK_TRIANGLE_UP_DOWN_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_TRIANGLE_UP_DOWN_instance;\n }\n var NamedShape$STICK_SQUARE_PLUS_instance;\n function NamedShape$STICK_SQUARE_PLUS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_SQUARE_PLUS_instance;\n }\n var NamedShape$STICK_CIRCLE_CROSS_instance;\n function NamedShape$STICK_CIRCLE_CROSS_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_CIRCLE_CROSS_instance;\n }\n var NamedShape$STICK_SQUARE_TRIANGLE_UP_instance;\n function NamedShape$STICK_SQUARE_TRIANGLE_UP_getInstance() {\n NamedShape_initFields();\n return NamedShape$STICK_SQUARE_TRIANGLE_UP_instance;\n }\n var NamedShape$SOLID_SQUARE_instance;\n function NamedShape$SOLID_SQUARE_getInstance() {\n NamedShape_initFields();\n return NamedShape$SOLID_SQUARE_instance;\n }\n var NamedShape$SOLID_CIRCLE_instance;\n function NamedShape$SOLID_CIRCLE_getInstance() {\n NamedShape_initFields();\n return NamedShape$SOLID_CIRCLE_instance;\n }\n var NamedShape$SOLID_TRIANGLE_UP_instance;\n function NamedShape$SOLID_TRIANGLE_UP_getInstance() {\n NamedShape_initFields();\n return NamedShape$SOLID_TRIANGLE_UP_instance;\n }\n var NamedShape$SOLID_DIAMOND_instance;\n function NamedShape$SOLID_DIAMOND_getInstance() {\n NamedShape_initFields();\n return NamedShape$SOLID_DIAMOND_instance;\n }\n var NamedShape$SOLID_CIRCLE_2_instance;\n function NamedShape$SOLID_CIRCLE_2_getInstance() {\n NamedShape_initFields();\n return NamedShape$SOLID_CIRCLE_2_instance;\n }\n var NamedShape$BULLET_instance;\n function NamedShape$BULLET_getInstance() {\n NamedShape_initFields();\n return NamedShape$BULLET_instance;\n }\n var NamedShape$FILLED_CIRCLE_instance;\n function NamedShape$FILLED_CIRCLE_getInstance() {\n NamedShape_initFields();\n return NamedShape$FILLED_CIRCLE_instance;\n }\n var NamedShape$FILLED_SQUARE_instance;\n function NamedShape$FILLED_SQUARE_getInstance() {\n NamedShape_initFields();\n return NamedShape$FILLED_SQUARE_instance;\n }\n var NamedShape$FILLED_DIAMOND_instance;\n function NamedShape$FILLED_DIAMOND_getInstance() {\n NamedShape_initFields();\n return NamedShape$FILLED_DIAMOND_instance;\n }\n var NamedShape$FILLED_TRIANGLE_UP_instance;\n function NamedShape$FILLED_TRIANGLE_UP_getInstance() {\n NamedShape_initFields();\n return NamedShape$FILLED_TRIANGLE_UP_instance;\n }\n var NamedShape$FILLED_TRIANGLE_DOWN_instance;\n function NamedShape$FILLED_TRIANGLE_DOWN_getInstance() {\n NamedShape_initFields();\n return NamedShape$FILLED_TRIANGLE_DOWN_instance;\n }\n Object.defineProperty(NamedShape.prototype, 'isHollow', {\n configurable: true,\n get: function () {\n return !(this.isFilled || this.isSolid);\n }\n });\n NamedShape.prototype.size_l6g9mh$ = function (dataPoint) {\n return this.isSmall_kvok7h$_0 ? AesScaling_getInstance().circleDiameterSmaller_l6g9mh$(dataPoint) : AesScaling_getInstance().circleDiameter_l6g9mh$(dataPoint);\n };\n NamedShape.prototype.strokeWidth_l6g9mh$ = function (dataPoint) {\n return this.isSolid ? 0.0 : 1.0;\n };\n NamedShape.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NamedShape',\n interfaces: [PointShape, Enum]\n };\n function NamedShape$values() {\n return [NamedShape$STICK_SQUARE_getInstance(), NamedShape$STICK_CIRCLE_getInstance(), NamedShape$STICK_TRIANGLE_UP_getInstance(), NamedShape$STICK_PLUS_getInstance(), NamedShape$STICK_CROSS_getInstance(), NamedShape$STICK_DIAMOND_getInstance(), NamedShape$STICK_TRIANGLE_DOWN_getInstance(), NamedShape$STICK_SQUARE_CROSS_getInstance(), NamedShape$STICK_STAR_getInstance(), NamedShape$STICK_DIAMOND_PLUS_getInstance(), NamedShape$STICK_CIRCLE_PLUS_getInstance(), NamedShape$STICK_TRIANGLE_UP_DOWN_getInstance(), NamedShape$STICK_SQUARE_PLUS_getInstance(), NamedShape$STICK_CIRCLE_CROSS_getInstance(), NamedShape$STICK_SQUARE_TRIANGLE_UP_getInstance(), NamedShape$SOLID_SQUARE_getInstance(), NamedShape$SOLID_CIRCLE_getInstance(), NamedShape$SOLID_TRIANGLE_UP_getInstance(), NamedShape$SOLID_DIAMOND_getInstance(), NamedShape$SOLID_CIRCLE_2_getInstance(), NamedShape$BULLET_getInstance(), NamedShape$FILLED_CIRCLE_getInstance(), NamedShape$FILLED_SQUARE_getInstance(), NamedShape$FILLED_DIAMOND_getInstance(), NamedShape$FILLED_TRIANGLE_UP_getInstance(), NamedShape$FILLED_TRIANGLE_DOWN_getInstance()];\n }\n NamedShape.values = NamedShape$values;\n function NamedShape$valueOf(name) {\n switch (name) {\n case 'STICK_SQUARE':\n return NamedShape$STICK_SQUARE_getInstance();\n case 'STICK_CIRCLE':\n return NamedShape$STICK_CIRCLE_getInstance();\n case 'STICK_TRIANGLE_UP':\n return NamedShape$STICK_TRIANGLE_UP_getInstance();\n case 'STICK_PLUS':\n return NamedShape$STICK_PLUS_getInstance();\n case 'STICK_CROSS':\n return NamedShape$STICK_CROSS_getInstance();\n case 'STICK_DIAMOND':\n return NamedShape$STICK_DIAMOND_getInstance();\n case 'STICK_TRIANGLE_DOWN':\n return NamedShape$STICK_TRIANGLE_DOWN_getInstance();\n case 'STICK_SQUARE_CROSS':\n return NamedShape$STICK_SQUARE_CROSS_getInstance();\n case 'STICK_STAR':\n return NamedShape$STICK_STAR_getInstance();\n case 'STICK_DIAMOND_PLUS':\n return NamedShape$STICK_DIAMOND_PLUS_getInstance();\n case 'STICK_CIRCLE_PLUS':\n return NamedShape$STICK_CIRCLE_PLUS_getInstance();\n case 'STICK_TRIANGLE_UP_DOWN':\n return NamedShape$STICK_TRIANGLE_UP_DOWN_getInstance();\n case 'STICK_SQUARE_PLUS':\n return NamedShape$STICK_SQUARE_PLUS_getInstance();\n case 'STICK_CIRCLE_CROSS':\n return NamedShape$STICK_CIRCLE_CROSS_getInstance();\n case 'STICK_SQUARE_TRIANGLE_UP':\n return NamedShape$STICK_SQUARE_TRIANGLE_UP_getInstance();\n case 'SOLID_SQUARE':\n return NamedShape$SOLID_SQUARE_getInstance();\n case 'SOLID_CIRCLE':\n return NamedShape$SOLID_CIRCLE_getInstance();\n case 'SOLID_TRIANGLE_UP':\n return NamedShape$SOLID_TRIANGLE_UP_getInstance();\n case 'SOLID_DIAMOND':\n return NamedShape$SOLID_DIAMOND_getInstance();\n case 'SOLID_CIRCLE_2':\n return NamedShape$SOLID_CIRCLE_2_getInstance();\n case 'BULLET':\n return NamedShape$BULLET_getInstance();\n case 'FILLED_CIRCLE':\n return NamedShape$FILLED_CIRCLE_getInstance();\n case 'FILLED_SQUARE':\n return NamedShape$FILLED_SQUARE_getInstance();\n case 'FILLED_DIAMOND':\n return NamedShape$FILLED_DIAMOND_getInstance();\n case 'FILLED_TRIANGLE_UP':\n return NamedShape$FILLED_TRIANGLE_UP_getInstance();\n case 'FILLED_TRIANGLE_DOWN':\n return NamedShape$FILLED_TRIANGLE_DOWN_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.render.point.NamedShape.' + name);\n }\n }\n NamedShape.valueOf_61zpoe$ = NamedShape$valueOf;\n function PointShape() {\n }\n PointShape.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PointShape',\n interfaces: []\n };\n function PointShapeSvg() {\n PointShapeSvg_instance = this;\n }\n PointShapeSvg.prototype.create_d8smhz$ = function (shape, location, p, fatten) {\n if (fatten === void 0)\n fatten = 1.0;\n if (equals(shape, TinyPointShape_getInstance())) {\n return this.createTinyDotShape_0(location, p);\n }if (Kotlin.isType(shape, NamedShape)) {\n return this.createNamedShape_0(shape, location, p, fatten);\n }throw IllegalArgumentException_init('Unsupported point shape code ' + shape.code + ' ' + toString(Kotlin.getKClassFromExpression(shape).simpleName));\n };\n PointShapeSvg.prototype.createTinyDotShape_0 = function (location, p) {\n var r = slim.SvgSlimElements.rect_6y0v78$(location.x - 0.5, location.y - 0.5, 1.0, 1.0);\n var color = ensureNotNull(p.color());\n var alpha = AestheticsUtil_getInstance().alpha_il6rhx$(color, p);\n r.setFill_o14uds$(color, alpha);\n r.setStrokeWidth_14dthe$(0.0);\n return r;\n };\n PointShapeSvg.prototype.createNamedShape_0 = function (shape, location, p, fatten) {\n var glyph = this.createSlimGlyph_0(shape, location, shape.size_l6g9mh$(p) * fatten);\n AestheticsUtil_getInstance().decorate_l4vgcq$(glyph, shape.isFilled, shape.isSolid, p, shape.strokeWidth_l6g9mh$(p));\n return glyph;\n };\n PointShapeSvg.prototype.createSlimGlyph_0 = function (shape, location, size) {\n switch (shape.name) {\n case 'STICK_SQUARE':\n case 'SOLID_SQUARE':\n case 'FILLED_SQUARE':\n return Glyphs_getInstance().square_e1sv3v$(location, size);\n case 'STICK_CIRCLE':\n case 'SOLID_CIRCLE':\n case 'SOLID_CIRCLE_2':\n case 'BULLET':\n case 'FILLED_CIRCLE':\n return Glyphs_getInstance().circle_e1sv3v$(location, size);\n case 'STICK_TRIANGLE_UP':\n case 'SOLID_TRIANGLE_UP':\n case 'FILLED_TRIANGLE_UP':\n return Glyphs_getInstance().triangleUp_e1sv3v$(location, size);\n case 'STICK_TRIANGLE_DOWN':\n case 'FILLED_TRIANGLE_DOWN':\n return Glyphs_getInstance().triangleDown_e1sv3v$(location, size);\n case 'STICK_DIAMOND':\n case 'SOLID_DIAMOND':\n case 'FILLED_DIAMOND':\n return Glyphs_getInstance().diamond_e1sv3v$(location, size);\n case 'STICK_PLUS':\n return Glyphs_getInstance().stickPlus_e1sv3v$(location, size);\n case 'STICK_CROSS':\n return Glyphs_getInstance().stickCross_e1sv3v$(location, size);\n case 'STICK_SQUARE_CROSS':\n return Glyphs_getInstance().stickSquareCross_e1sv3v$(location, size);\n case 'STICK_STAR':\n return Glyphs_getInstance().stickStar_e1sv3v$(location, size);\n case 'STICK_DIAMOND_PLUS':\n return Glyphs_getInstance().stickDiamondPlus_e1sv3v$(location, size);\n case 'STICK_CIRCLE_PLUS':\n return Glyphs_getInstance().stickCirclePlus_e1sv3v$(location, size);\n case 'STICK_TRIANGLE_UP_DOWN':\n return Glyphs_getInstance().stickTriangleUpDown_e1sv3v$(location, size);\n case 'STICK_SQUARE_PLUS':\n return Glyphs_getInstance().stickSquarePlus_e1sv3v$(location, size);\n case 'STICK_CIRCLE_CROSS':\n return Glyphs_getInstance().stickCircleCross_e1sv3v$(location, size);\n case 'STICK_SQUARE_TRIANGLE_UP':\n return Glyphs_getInstance().stickSquareTriangleUp_e1sv3v$(location, size);\n default:Kotlin.noWhenBranchMatched();\n break;\n }\n };\n PointShapeSvg.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PointShapeSvg',\n interfaces: []\n };\n var PointShapeSvg_instance = null;\n function PointShapeSvg_getInstance() {\n if (PointShapeSvg_instance === null) {\n new PointShapeSvg();\n }return PointShapeSvg_instance;\n }\n function TinyPointShape() {\n TinyPointShape_instance = this;\n }\n Object.defineProperty(TinyPointShape.prototype, 'code', {\n configurable: true,\n get: function () {\n return 46;\n }\n });\n TinyPointShape.prototype.size_l6g9mh$ = function (dataPoint) {\n return 1.0;\n };\n TinyPointShape.prototype.strokeWidth_l6g9mh$ = function (dataPoint) {\n return 0.0;\n };\n TinyPointShape.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'TinyPointShape',\n interfaces: [PointShape]\n };\n var TinyPointShape_instance = null;\n function TinyPointShape_getInstance() {\n if (TinyPointShape_instance === null) {\n new TinyPointShape();\n }return TinyPointShape_instance;\n }\n function UpdatableShape() {\n }\n UpdatableShape.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'UpdatableShape',\n interfaces: []\n };\n function CircleGlyph(location, width) {\n SingletonGlyph_init_0(location, width, this);\n }\n CircleGlyph.prototype.createShape_e1sv3v$ = function (location, width) {\n return slim.SvgSlimElements.circle_yvo9jy$(location.x, location.y, width / 2);\n };\n CircleGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CircleGlyph',\n interfaces: [SingletonGlyph]\n };\n function CrossGlyph(location, size, inscribedInCircle) {\n CrossGlyph$Companion_getInstance();\n if (inscribedInCircle === void 0)\n inscribedInCircle = true;\n TwoShapeGlyph.call(this);\n var cx = location.x;\n var cy = location.y;\n var w = inscribedInCircle ? size * CrossGlyph$Companion_getInstance().CIRCLE_WIDTH_ADJUST_RATIO : size;\n var half = w / 2;\n var backSlashLine = slim.SvgSlimElements.line_6y0v78$(cx - half, cy - half, cx + half, cy + half);\n var slashLine = slim.SvgSlimElements.line_6y0v78$(cx - half, cy + half, cx + half, cy - half);\n this.setShapes_0(backSlashLine, slashLine);\n }\n function CrossGlyph$Companion() {\n CrossGlyph$Companion_instance = this;\n var x = math.PI / 4;\n this.CIRCLE_WIDTH_ADJUST_RATIO = JsMath.cos(x);\n }\n CrossGlyph$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var CrossGlyph$Companion_instance = null;\n function CrossGlyph$Companion_getInstance() {\n if (CrossGlyph$Companion_instance === null) {\n new CrossGlyph$Companion();\n }return CrossGlyph$Companion_instance;\n }\n CrossGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CrossGlyph',\n interfaces: [TwoShapeGlyph]\n };\n function DiamondGlyph(location, width) {\n SingletonGlyph_init_0(location, width, this);\n }\n DiamondGlyph.prototype.createShape_e1sv3v$ = function (location, width) {\n var half = width / 2;\n var x = new Float64Array([half, width, half, 0.0]);\n var y = new Float64Array([0.0, half, width, half]);\n var ox = location.x - half;\n var oy = location.y - half;\n for (var i = 0; i <= 3; i++) {\n x[i] = ox + x[i];\n y[i] = oy + y[i];\n }\n var pathData = GlyphUtil_getInstance().buildPathData_ceb5dm$(asList(x), asList(y));\n return slim.SvgSlimElements.path_za3rmp$(pathData);\n };\n DiamondGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DiamondGlyph',\n interfaces: [SingletonGlyph]\n };\n function Glyph() {\n }\n Glyph.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Glyph',\n interfaces: [SvgSlimObject, UpdatableShape]\n };\n function GlyphPair(myG1, myG2) {\n this.myG1_0 = myG1;\n this.myG2_0 = myG2;\n }\n GlyphPair.prototype.update_mjoany$ = function (fill, fillAlpha, stroke, strokeAlpha, strokeWidth) {\n this.myG1_0.update_mjoany$(fill, fillAlpha, stroke, strokeAlpha, strokeWidth);\n this.myG2_0.update_mjoany$(fill, fillAlpha, stroke, strokeAlpha, strokeWidth);\n };\n GlyphPair.prototype.appendTo_i2myw1$ = function (g) {\n this.myG1_0.appendTo_i2myw1$(g);\n this.myG2_0.appendTo_i2myw1$(g);\n };\n GlyphPair.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GlyphPair',\n interfaces: [Glyph]\n };\n function GlyphUtil() {\n GlyphUtil_instance = this;\n }\n GlyphUtil.prototype.buildPathData_ceb5dm$ = function (xs, ys) {\n if (!(xs.size === ys.size)) {\n var message = 'Sizes of X/Y collections must be equal';\n throw IllegalArgumentException_init(message.toString());\n }if (xs.isEmpty()) {\n return SvgPathData.Companion.EMPTY;\n }var builder = (new SvgPathDataBuilder(true)).moveTo_przk3b$(collect.Iterables.get_7iig3d$(xs, 0), collect.Iterables.get_7iig3d$(ys, 0)).interpolatePoints_3g1a62$(xs, ys, SvgPathDataBuilder$Interpolation.LINEAR).closePath();\n return builder.build();\n };\n GlyphUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GlyphUtil',\n interfaces: []\n };\n var GlyphUtil_instance = null;\n function GlyphUtil_getInstance() {\n if (GlyphUtil_instance === null) {\n new GlyphUtil();\n }return GlyphUtil_instance;\n }\n function Glyphs() {\n Glyphs_instance = this;\n }\n Glyphs.prototype.square_e1sv3v$ = function (location, width) {\n return new SquareGlyph(location, width);\n };\n Glyphs.prototype.circle_e1sv3v$ = function (location, width) {\n return new CircleGlyph(location, width);\n };\n Glyphs.prototype.diamond_e1sv3v$ = function (location, width) {\n return new DiamondGlyph(location, width);\n };\n Glyphs.prototype.triangleUp_e1sv3v$ = function (location, width) {\n return new TriangleGlyph(location, width, true);\n };\n Glyphs.prototype.triangleDown_e1sv3v$ = function (location, width) {\n return new TriangleGlyph(location, width, false);\n };\n Glyphs.prototype.stickPlus_e1sv3v$ = function (location, width) {\n return new PlusGlyph(location, width);\n };\n Glyphs.prototype.stickCross_e1sv3v$ = function (location, width) {\n return new CrossGlyph(location, width);\n };\n Glyphs.prototype.stickSquareCross_e1sv3v$ = function (location, size) {\n return new GlyphPair(new SquareGlyph(location, size), new CrossGlyph(location, size, false));\n };\n Glyphs.prototype.stickStar_e1sv3v$ = function (location, size) {\n return new GlyphPair(new PlusGlyph(location, size), new CrossGlyph(location, size));\n };\n Glyphs.prototype.stickDiamondPlus_e1sv3v$ = function (location, size) {\n return new GlyphPair(new DiamondGlyph(location, size), new PlusGlyph(location, size));\n };\n Glyphs.prototype.stickCirclePlus_e1sv3v$ = function (location, size) {\n return new GlyphPair(new CircleGlyph(location, size), new PlusGlyph(location, size));\n };\n Glyphs.prototype.stickTriangleUpDown_e1sv3v$ = function (location, size) {\n return new GlyphPair(new TriangleGlyph(location, size, true), new TriangleGlyph(location, size, false));\n };\n Glyphs.prototype.stickSquarePlus_e1sv3v$ = function (location, size) {\n return new GlyphPair(new SquareGlyph(location, size), new PlusGlyph(location, size));\n };\n Glyphs.prototype.stickCircleCross_e1sv3v$ = function (location, size) {\n return new GlyphPair(new CircleGlyph(location, size), new CrossGlyph(location, size));\n };\n Glyphs.prototype.stickSquareTriangleUp_e1sv3v$ = function (location, size) {\n return new GlyphPair(new SquareGlyph(location, size), new TriangleGlyph(location, size, true, true));\n };\n Glyphs.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Glyphs',\n interfaces: []\n };\n var Glyphs_instance = null;\n function Glyphs_getInstance() {\n if (Glyphs_instance === null) {\n new Glyphs();\n }return Glyphs_instance;\n }\n function MultiShapeGlyph() {\n }\n MultiShapeGlyph.prototype.update_0 = function (shape, fill, fillAlpha, stroke, strokeAlpha, strokeWidth) {\n shape != null ? (shape.setFill_o14uds$(fill, fillAlpha), Unit) : null;\n shape != null ? (shape.setStroke_o14uds$(stroke, strokeAlpha), Unit) : null;\n shape != null ? (shape.setStrokeWidth_14dthe$(strokeWidth), Unit) : null;\n };\n MultiShapeGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiShapeGlyph',\n interfaces: [Glyph]\n };\n function PlusGlyph(location, size) {\n TwoShapeGlyph.call(this);\n var half = size / 2;\n var ox = location.x - half;\n var oy = location.y - half;\n var hLine = slim.SvgSlimElements.line_6y0v78$(0 + ox, half + oy, size + ox, half + oy);\n var vLine = slim.SvgSlimElements.line_6y0v78$(half + ox, 0 + oy, half + ox, size + oy);\n this.setShapes_0(hLine, vLine);\n }\n PlusGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlusGlyph',\n interfaces: [TwoShapeGlyph]\n };\n function SingletonGlyph() {\n this.myShape_tmqwxg$_0 = null;\n }\n SingletonGlyph.prototype.update_mjoany$ = function (fill, fillAlpha, stroke, strokeAlpha, strokeWidth) {\n this.myShape_tmqwxg$_0.setFill_o14uds$(fill, fillAlpha);\n this.myShape_tmqwxg$_0.setStroke_o14uds$(stroke, strokeAlpha);\n this.myShape_tmqwxg$_0.setStrokeWidth_14dthe$(strokeWidth);\n };\n SingletonGlyph.prototype.appendTo_i2myw1$ = function (g) {\n this.myShape_tmqwxg$_0.appendTo_i2myw1$(g);\n };\n SingletonGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SingletonGlyph',\n interfaces: [Glyph]\n };\n function SingletonGlyph_init(shape, $this) {\n $this = $this || Object.create(SingletonGlyph.prototype);\n SingletonGlyph.call($this);\n $this.myShape_tmqwxg$_0 = shape;\n return $this;\n }\n function SingletonGlyph_init_0(location, width, $this) {\n $this = $this || Object.create(SingletonGlyph.prototype);\n SingletonGlyph.call($this);\n $this.myShape_tmqwxg$_0 = $this.createShape_e1sv3v$(location, width);\n return $this;\n }\n function SquareGlyph(location, size) {\n SingletonGlyph_init_0(location, size, this);\n }\n SquareGlyph.prototype.createShape_e1sv3v$ = function (location, width) {\n return slim.SvgSlimElements.rect_6y0v78$(location.x - width / 2, location.y - width / 2, width, width);\n };\n SquareGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SquareGlyph',\n interfaces: [SingletonGlyph]\n };\n function TriangleGlyph(location, size, pointingUp, inscribedInSquare) {\n TriangleGlyph$Companion_getInstance();\n if (inscribedInSquare === void 0)\n inscribedInSquare = false;\n SingletonGlyph_init(TriangleGlyph$Companion_getInstance().createTriangleShape_0(location, size, pointingUp, inscribedInSquare), this);\n }\n TriangleGlyph.prototype.createShape_e1sv3v$ = function (location, width) {\n throw IllegalStateException_init('Not applicable');\n };\n function TriangleGlyph$Companion() {\n TriangleGlyph$Companion_instance = this;\n var x = math.PI / 3;\n this.SIDE_TO_HEIGHT_RATIO_0 = JsMath.sin(x);\n this.VERTICAL_OFFSET_RATIO_0 = 1.0 / 12;\n }\n TriangleGlyph$Companion.prototype.createTriangleShape_0 = function (location, size, pointingUp, inscribedInSquare) {\n var half = size / 2;\n var height = inscribedInSquare ? size : this.SIDE_TO_HEIGHT_RATIO_0 * size;\n var vOffset = inscribedInSquare ? 0.0 : height * this.VERTICAL_OFFSET_RATIO_0;\n var x;\n var y;\n var dy = (size - height) / 2;\n if (pointingUp) {\n dy -= vOffset;\n x = new Float64Array([half, size, 0.0]);\n y = new Float64Array([0.0 + dy, height + dy, height + dy]);\n } else {\n dy += vOffset;\n x = new Float64Array([0.0, size, half]);\n y = new Float64Array([0.0 + dy, 0.0 + dy, height + dy]);\n }\n var ox = location.x - half;\n var oy = location.y - half;\n for (var i = 0; i <= 2; i++) {\n x[i] = ox + x[i];\n y[i] = oy + y[i];\n }\n var pathData = GlyphUtil_getInstance().buildPathData_ceb5dm$(asList(x), asList(y));\n return slim.SvgSlimElements.path_za3rmp$(pathData);\n };\n TriangleGlyph$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TriangleGlyph$Companion_instance = null;\n function TriangleGlyph$Companion_getInstance() {\n if (TriangleGlyph$Companion_instance === null) {\n new TriangleGlyph$Companion();\n }return TriangleGlyph$Companion_instance;\n }\n TriangleGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TriangleGlyph',\n interfaces: [SingletonGlyph]\n };\n function TwoShapeGlyph() {\n MultiShapeGlyph.call(this);\n this.myS1_0 = null;\n this.myS2_0 = null;\n }\n TwoShapeGlyph.prototype.setShapes_0 = function (s1, s2) {\n this.myS1_0 = s1;\n this.myS2_0 = s2;\n };\n TwoShapeGlyph.prototype.update_mjoany$ = function (fill, fillAlpha, stroke, strokeAlpha, strokeWidth) {\n this.update_0(this.myS1_0, fill, fillAlpha, stroke, strokeAlpha, strokeWidth);\n this.update_0(this.myS2_0, fill, fillAlpha, stroke, strokeAlpha, strokeWidth);\n };\n TwoShapeGlyph.prototype.appendTo_i2myw1$ = function (g) {\n ensureNotNull(this.myS1_0).appendTo_i2myw1$(g);\n ensureNotNull(this.myS2_0).appendTo_i2myw1$(g);\n };\n TwoShapeGlyph.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TwoShapeGlyph',\n interfaces: [MultiShapeGlyph]\n };\n function GroupComponent() {\n SvgComponent.call(this);\n }\n GroupComponent.prototype.buildComponent = function () {\n };\n GroupComponent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupComponent',\n interfaces: [SvgComponent]\n };\n function LinePath(builder) {\n LinePath$Companion_getInstance();\n SvgComponent.call(this);\n this.myPath_0 = null;\n this.myDashArray_0 = null;\n this.myPath_0 = SvgPathElement_init(builder.build());\n this.myPath_0.fill().set_11rb$(SvgColors.NONE);\n var lineWidth = 1.0;\n this.myPath_0.strokeWidth().set_11rb$(lineWidth);\n this.add_26jijc$(this.myPath_0);\n }\n LinePath.prototype.buildComponent = function () {\n };\n LinePath.prototype.color = function () {\n return this.myPath_0.strokeColor();\n };\n LinePath.prototype.fill = function () {\n return this.myPath_0.fillColor();\n };\n function LinePath$width$ObjectLiteral(this$LinePath) {\n this.this$LinePath = this$LinePath;\n }\n LinePath$width$ObjectLiteral.prototype.set_11rb$ = function (value) {\n this.this$LinePath.myPath_0.strokeWidth().set_11rb$(value);\n this.this$LinePath.updatePathDashArray_0();\n };\n LinePath$width$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [WritableProperty]\n };\n LinePath.prototype.width = function () {\n return new LinePath$width$ObjectLiteral(this);\n };\n function LinePath$dashArray$ObjectLiteral(this$LinePath) {\n this.this$LinePath = this$LinePath;\n }\n LinePath$dashArray$ObjectLiteral.prototype.set_11rb$ = function (value) {\n this.this$LinePath.myDashArray_0 = ArrayList_init_0(value);\n this.this$LinePath.updatePathDashArray_0();\n };\n LinePath$dashArray$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [WritableProperty]\n };\n LinePath.prototype.dashArray = function () {\n return new LinePath$dashArray$ObjectLiteral(this);\n };\n LinePath.prototype.updatePathDashArray_0 = function () {\n if (!(this.myDashArray_0 == null || ensureNotNull(this.myDashArray_0).isEmpty())) {\n var w = this.myPath_0.strokeWidth().get();\n var width = w != null ? w : 1.0;\n StrokeDashArraySupport_getInstance().apply_3xqz7j$(this.myPath_0, width, ensureNotNull(this.myDashArray_0));\n }};\n function LinePath$Companion() {\n LinePath$Companion_instance = this;\n this.END_OF_SUBPATH = null;\n }\n LinePath$Companion.prototype.line_qdtdbw$ = function (points) {\n return new LinePath(this.pathBuilder_0(points, false));\n };\n LinePath$Companion.prototype.polygon_yh26e7$ = function (points) {\n return new LinePath(this.pathBuilder_0(points, true));\n };\n LinePath$Companion.prototype.pathBuilder_0 = function (points, isPolygon) {\n var tmp$;\n var builder = new SvgPathDataBuilder(true);\n var curSegment = ArrayList_init();\n var interpolate = false;\n tmp$ = points.iterator();\n while (tmp$.hasNext()) {\n var point = tmp$.next();\n if (point === this.END_OF_SUBPATH) {\n this.buildSegment_0(builder, curSegment, interpolate);\n if (isPolygon) {\n builder.closePath();\n }curSegment = ArrayList_init();\n } else {\n curSegment.add_11rb$(ensureNotNull(point));\n }\n }\n this.buildSegment_0(builder, curSegment, interpolate);\n if (isPolygon) {\n builder.closePath();\n }return builder;\n };\n LinePath$Companion.prototype.buildSegment_0 = function (builder, curSegment, interpolate) {\n if (curSegment.isEmpty()) {\n return;\n }builder.moveTo_gpjtzr$(curSegment.get_za3lpa$(0));\n builder.interpolatePoints_1ravjc$(curSegment, interpolate ? SvgPathDataBuilder$Interpolation.CARDINAL : SvgPathDataBuilder$Interpolation.LINEAR);\n };\n LinePath$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LinePath$Companion_instance = null;\n function LinePath$Companion_getInstance() {\n if (LinePath$Companion_instance === null) {\n new LinePath$Companion();\n }return LinePath$Companion_instance;\n }\n LinePath.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinePath',\n interfaces: [SvgComponent]\n };\n function StrokeDashArraySupport() {\n StrokeDashArraySupport_instance = this;\n }\n StrokeDashArraySupport.prototype.apply_3xqz7j$ = function (element, strokeWidth, dashArray) {\n var tmp$;\n var sb = StringBuilder_init();\n tmp$ = dashArray.iterator();\n while (tmp$.hasNext()) {\n var relativeLength = tmp$.next();\n var length = relativeLength * strokeWidth;\n if (sb.length > 0) {\n sb.append_s8itvh$(44);\n }sb.append_pdl1vj$(length.toString());\n }\n element.getAttribute_61zpoe$(svg.SvgConstants.SVG_STROKE_DASHARRAY_ATTRIBUTE).set_11rb$(sb.toString());\n };\n StrokeDashArraySupport.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'StrokeDashArraySupport',\n interfaces: []\n };\n var StrokeDashArraySupport_instance = null;\n function StrokeDashArraySupport_getInstance() {\n if (StrokeDashArraySupport_instance === null) {\n new StrokeDashArraySupport();\n }return StrokeDashArraySupport_instance;\n }\n function SvgComponent() {\n SvgComponent$Companion_getInstance();\n this.myIsBuilt_hfl4wb$_0 = false;\n this.myIsBuilding_wftuqx$_0 = false;\n this.myRootGroup_34n42m$_0 = new SvgGElement();\n this.myChildComponents_jx3u37$_0 = ArrayList_init();\n this.myOrigin_c2o9zl$_0 = DoubleVector.Companion.ZERO;\n this.myRotationAngle_woxwye$_0 = 0.0;\n this.myCompositeRegistration_t8l21t$_0 = new CompositeRegistration([]);\n }\n Object.defineProperty(SvgComponent.prototype, 'childComponents', {\n configurable: true,\n get: function () {\n if (!this.myIsBuilt_hfl4wb$_0) {\n var message = 'Plot has not yet built';\n throw IllegalArgumentException_init(message.toString());\n }return ArrayList_init_0(this.myChildComponents_jx3u37$_0);\n }\n });\n Object.defineProperty(SvgComponent.prototype, 'rootGroup', {\n configurable: true,\n get: function () {\n this.ensureBuilt();\n return this.myRootGroup_34n42m$_0;\n }\n });\n SvgComponent.prototype.ensureBuilt = function () {\n if (!(this.myIsBuilt_hfl4wb$_0 || this.myIsBuilding_wftuqx$_0)) {\n this.buildComponentIntern_92lbvk$_0();\n }};\n SvgComponent.prototype.buildComponentIntern_92lbvk$_0 = function () {\n try {\n this.myIsBuilding_wftuqx$_0 = true;\n this.buildComponent();\n }finally {\n this.myIsBuilding_wftuqx$_0 = false;\n this.myIsBuilt_hfl4wb$_0 = true;\n }\n };\n function SvgComponent$rebuildHandler$ObjectLiteral(this$SvgComponent) {\n this.this$SvgComponent = this$SvgComponent;\n }\n SvgComponent$rebuildHandler$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n this.this$SvgComponent.needRebuild();\n };\n SvgComponent$rebuildHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n SvgComponent.prototype.rebuildHandler_287e2$ = function () {\n return new SvgComponent$rebuildHandler$ObjectLiteral(this);\n };\n SvgComponent.prototype.needRebuild = function () {\n if (this.myIsBuilt_hfl4wb$_0) {\n this.clear();\n this.buildComponentIntern_92lbvk$_0();\n }};\n SvgComponent.prototype.reg_3xv6fb$ = function (r) {\n this.myCompositeRegistration_t8l21t$_0.add_3xv6fb$(r);\n };\n SvgComponent.prototype.clear = function () {\n var tmp$;\n this.myIsBuilt_hfl4wb$_0 = false;\n tmp$ = this.myChildComponents_jx3u37$_0.iterator();\n while (tmp$.hasNext()) {\n var child = tmp$.next();\n child.clear();\n }\n this.myChildComponents_jx3u37$_0.clear();\n this.myRootGroup_34n42m$_0.children().clear();\n this.myCompositeRegistration_t8l21t$_0.remove();\n this.myCompositeRegistration_t8l21t$_0 = new CompositeRegistration([]);\n };\n SvgComponent.prototype.add_8icvvv$ = function (child) {\n this.myChildComponents_jx3u37$_0.add_11rb$(child);\n this.add_26jijc$(child.rootGroup);\n };\n SvgComponent.prototype.add_26jijc$ = function (node) {\n this.myRootGroup_34n42m$_0.children().add_11rb$(node);\n };\n SvgComponent.prototype.moveTo_gpjtzr$ = function (p) {\n this.myOrigin_c2o9zl$_0 = p;\n this.myRootGroup_34n42m$_0.transform().set_11rb$(SvgComponent$Companion_getInstance().buildTransform_e1sv3v$(this.myOrigin_c2o9zl$_0, this.myRotationAngle_woxwye$_0));\n };\n SvgComponent.prototype.moveTo_lu1900$ = function (x, y) {\n this.moveTo_gpjtzr$(new DoubleVector(x, y));\n };\n SvgComponent.prototype.rotate_14dthe$ = function (angle) {\n this.myRotationAngle_woxwye$_0 = angle;\n this.myRootGroup_34n42m$_0.transform().set_11rb$(SvgComponent$Companion_getInstance().buildTransform_e1sv3v$(this.myOrigin_c2o9zl$_0, this.myRotationAngle_woxwye$_0));\n };\n SvgComponent.prototype.toRelativeCoordinates_gpjtzr$ = function (location) {\n return this.rootGroup.pointToTransformedCoordinates_gpjtzr$(location);\n };\n SvgComponent.prototype.toAbsoluteCoordinates_gpjtzr$ = function (location) {\n return this.rootGroup.pointToAbsoluteCoordinates_gpjtzr$(location);\n };\n SvgComponent.prototype.clipBounds_wthzt5$ = function (rect) {\n var $receiver = new SvgClipPathElement();\n $receiver.id().set_11rb$(SvgUID_getInstance().get_61zpoe$(SvgComponent$Companion_getInstance().CLIP_PATH_ID_PREFIX));\n var tmp$ = $receiver.children();\n var $receiver_0 = new SvgRectElement();\n $receiver_0.x().set_11rb$(rect.left);\n $receiver_0.y().set_11rb$(rect.top);\n $receiver_0.width().set_11rb$(rect.width);\n $receiver_0.height().set_11rb$(rect.height);\n tmp$.add_11rb$($receiver_0);\n var clipPathElement = $receiver;\n var $receiver_1 = new SvgDefsElement();\n $receiver_1.children().add_11rb$(clipPathElement);\n var defs = $receiver_1;\n this.add_26jijc$(defs);\n this.rootGroup.clipPath().set_11rb$(new SvgIRI(ensureNotNull(clipPathElement.id().get())));\n this.rootGroup.setAttribute_qdh7ux$(SvgGraphicsElement.Companion.CLIP_BOUNDS_JFX, rect);\n };\n SvgComponent.prototype.addClassName_61zpoe$ = function (className) {\n this.myRootGroup_34n42m$_0.addClass_61zpoe$(className);\n };\n function SvgComponent$Companion() {\n SvgComponent$Companion_instance = this;\n this.CLIP_PATH_ID_PREFIX = '';\n }\n SvgComponent$Companion.prototype.buildTransform_e1sv3v$ = function (origin, rotationAngle) {\n var transformBuilder = new SvgTransformBuilder();\n if (!(origin != null ? origin.equals(DoubleVector.Companion.ZERO) : null)) {\n transformBuilder.translate_lu1900$(origin.x, origin.y);\n }if (rotationAngle !== 0.0) {\n transformBuilder.rotate_14dthe$(rotationAngle);\n }return transformBuilder.build();\n };\n SvgComponent$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SvgComponent$Companion_instance = null;\n function SvgComponent$Companion_getInstance() {\n if (SvgComponent$Companion_instance === null) {\n new SvgComponent$Companion();\n }return SvgComponent$Companion_instance;\n }\n SvgComponent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SvgComponent',\n interfaces: []\n };\n function SvgUID() {\n SvgUID_instance = this;\n this.suffixGen_0 = SvgUID$suffixGen$lambda;\n }\n function SvgUID$setUpForTest$lambda(closure$incrementalId) {\n return function () {\n return closure$incrementalId.next();\n };\n }\n SvgUID.prototype.setUpForTest = function () {\n var incrementalId = new SvgUID$IncrementalId();\n this.suffixGen_0 = SvgUID$setUpForTest$lambda(incrementalId);\n };\n SvgUID.prototype.get_61zpoe$ = function (prefix) {\n return prefix + this.suffixGen_0().toString();\n };\n function SvgUID$IncrementalId() {\n this.nextIndex_0 = 0;\n }\n SvgUID$IncrementalId.prototype.next = function () {\n var tmp$;\n return 'clip-' + (tmp$ = this.nextIndex_0, this.nextIndex_0 = tmp$ + 1 | 0, tmp$);\n };\n SvgUID$IncrementalId.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'IncrementalId',\n interfaces: []\n };\n function SvgUID$suffixGen$lambda() {\n return random.RandomString.randomString_za3lpa$(6);\n }\n SvgUID.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'SvgUID',\n interfaces: []\n };\n var SvgUID_instance = null;\n function SvgUID_getInstance() {\n if (SvgUID_instance === null) {\n new SvgUID();\n }return SvgUID_instance;\n }\n function TextLabel(text) {\n SvgComponent.call(this);\n this.myText_0 = SvgTextElement_init(text);\n this.myTextColor_0 = null;\n this.myFontSize_0 = 0.0;\n this.myFontWeight_0 = null;\n this.myFontFamily_0 = null;\n this.myFontStyle_0 = null;\n this.rootGroup.children().add_11rb$(this.myText_0);\n }\n TextLabel.prototype.buildComponent = function () {\n };\n function TextLabel$textColor$ObjectLiteral(this$TextLabel) {\n this.this$TextLabel = this$TextLabel;\n }\n TextLabel$textColor$ObjectLiteral.prototype.set_11rb$ = function (value) {\n this.this$TextLabel.myText_0.fillColor();\n this.this$TextLabel.myTextColor_0 = value;\n this.this$TextLabel.updateStyleAttribute_0();\n };\n TextLabel$textColor$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [WritableProperty]\n };\n TextLabel.prototype.textColor = function () {\n return new TextLabel$textColor$ObjectLiteral(this);\n };\n TextLabel.prototype.textOpacity = function () {\n return this.myText_0.fillOpacity();\n };\n TextLabel.prototype.x = function () {\n return this.myText_0.x();\n };\n TextLabel.prototype.y = function () {\n return this.myText_0.y();\n };\n TextLabel.prototype.setHorizontalAnchor_ja80zo$ = function (anchor) {\n this.myText_0.setAttribute_jyasbz$(svg.SvgConstants.SVG_TEXT_ANCHOR_ATTRIBUTE, this.toTextAnchor_0(anchor));\n };\n TextLabel.prototype.setVerticalAnchor_yaudma$ = function (anchor) {\n this.myText_0.setAttribute_jyasbz$(svg.SvgConstants.SVG_TEXT_DY_ATTRIBUTE, this.toDY_0(anchor));\n };\n TextLabel.prototype.setFontSize_14dthe$ = function (px) {\n this.myFontSize_0 = px;\n this.updateStyleAttribute_0();\n };\n TextLabel.prototype.setFontWeight_pdl1vj$ = function (cssName) {\n this.myFontWeight_0 = cssName;\n this.updateStyleAttribute_0();\n };\n TextLabel.prototype.setFontStyle_pdl1vj$ = function (cssName) {\n this.myFontStyle_0 = cssName;\n this.updateStyleAttribute_0();\n };\n TextLabel.prototype.setFontFamily_pdl1vj$ = function (fontFamily) {\n this.myFontFamily_0 = fontFamily;\n this.updateStyleAttribute_0();\n };\n TextLabel.prototype.updateStyleAttribute_0 = function () {\n var sb = StringBuilder_init();\n if (this.myTextColor_0 != null) {\n sb.append_pdl1vj$('fill:').append_pdl1vj$(ensureNotNull(this.myTextColor_0).toHexColor()).append_s8itvh$(59);\n }if (this.myFontSize_0 > 0 && this.myFontFamily_0 != null) {\n var fnt = StringBuilder_init();\n var $receiver = this.myFontStyle_0;\n if (!($receiver == null || $receiver.length === 0)) {\n fnt.append_pdl1vj$(ensureNotNull(this.myFontStyle_0)).append_s8itvh$(32);\n }var $receiver_0 = this.myFontWeight_0;\n if (!($receiver_0 == null || $receiver_0.length === 0)) {\n fnt.append_pdl1vj$(ensureNotNull(this.myFontWeight_0)).append_s8itvh$(32);\n }fnt.append_s8jyv4$(this.myFontSize_0).append_pdl1vj$('px ');\n fnt.append_pdl1vj$(ensureNotNull(this.myFontFamily_0)).append_pdl1vj$(';');\n sb.append_pdl1vj$('font:').append_gw00v9$(fnt);\n } else {\n var $receiver_1 = this.myFontStyle_0;\n if (!($receiver_1 == null || isBlank($receiver_1))) {\n sb.append_pdl1vj$('font-style:').append_pdl1vj$(ensureNotNull(this.myFontStyle_0)).append_s8itvh$(59);\n }var $receiver_2 = this.myFontWeight_0;\n if (!($receiver_2 == null || $receiver_2.length === 0)) {\n sb.append_pdl1vj$('font-weight:').append_pdl1vj$(ensureNotNull(this.myFontWeight_0)).append_s8itvh$(59);\n }if (this.myFontSize_0 > 0) {\n sb.append_pdl1vj$('font-size:').append_s8jyv4$(this.myFontSize_0).append_pdl1vj$('px;');\n }var $receiver_3 = this.myFontFamily_0;\n if (!($receiver_3 == null || $receiver_3.length === 0)) {\n sb.append_pdl1vj$('font-family:').append_pdl1vj$(ensureNotNull(this.myFontFamily_0)).append_s8itvh$(59);\n }}\n this.myText_0.setAttribute_jyasbz$(svg.SvgConstants.SVG_STYLE_ATTRIBUTE, sb.toString());\n };\n TextLabel.prototype.toTextAnchor_0 = function (anchor) {\n var tmp$;\n switch (anchor.name) {\n case 'LEFT':\n tmp$ = null;\n break;\n case 'MIDDLE':\n tmp$ = svg.SvgConstants.SVG_TEXT_ANCHOR_MIDDLE;\n break;\n case 'RIGHT':\n tmp$ = svg.SvgConstants.SVG_TEXT_ANCHOR_END;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n TextLabel.prototype.toDominantBaseline_0 = function (anchor) {\n var tmp$;\n switch (anchor.name) {\n case 'TOP':\n tmp$ = 'hanging';\n break;\n case 'CENTER':\n tmp$ = 'central';\n break;\n case 'BOTTOM':\n tmp$ = null;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n TextLabel.prototype.toDY_0 = function (anchor) {\n var tmp$;\n switch (anchor.name) {\n case 'TOP':\n tmp$ = svg.SvgConstants.SVG_TEXT_DY_TOP;\n break;\n case 'CENTER':\n tmp$ = svg.SvgConstants.SVG_TEXT_DY_CENTER;\n break;\n case 'BOTTOM':\n tmp$ = null;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n function TextLabel$HorizontalAnchor(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TextLabel$HorizontalAnchor_initFields() {\n TextLabel$HorizontalAnchor_initFields = function () {\n };\n TextLabel$HorizontalAnchor$LEFT_instance = new TextLabel$HorizontalAnchor('LEFT', 0);\n TextLabel$HorizontalAnchor$RIGHT_instance = new TextLabel$HorizontalAnchor('RIGHT', 1);\n TextLabel$HorizontalAnchor$MIDDLE_instance = new TextLabel$HorizontalAnchor('MIDDLE', 2);\n }\n var TextLabel$HorizontalAnchor$LEFT_instance;\n function TextLabel$HorizontalAnchor$LEFT_getInstance() {\n TextLabel$HorizontalAnchor_initFields();\n return TextLabel$HorizontalAnchor$LEFT_instance;\n }\n var TextLabel$HorizontalAnchor$RIGHT_instance;\n function TextLabel$HorizontalAnchor$RIGHT_getInstance() {\n TextLabel$HorizontalAnchor_initFields();\n return TextLabel$HorizontalAnchor$RIGHT_instance;\n }\n var TextLabel$HorizontalAnchor$MIDDLE_instance;\n function TextLabel$HorizontalAnchor$MIDDLE_getInstance() {\n TextLabel$HorizontalAnchor_initFields();\n return TextLabel$HorizontalAnchor$MIDDLE_instance;\n }\n TextLabel$HorizontalAnchor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalAnchor',\n interfaces: [Enum]\n };\n function TextLabel$HorizontalAnchor$values() {\n return [TextLabel$HorizontalAnchor$LEFT_getInstance(), TextLabel$HorizontalAnchor$RIGHT_getInstance(), TextLabel$HorizontalAnchor$MIDDLE_getInstance()];\n }\n TextLabel$HorizontalAnchor.values = TextLabel$HorizontalAnchor$values;\n function TextLabel$HorizontalAnchor$valueOf(name) {\n switch (name) {\n case 'LEFT':\n return TextLabel$HorizontalAnchor$LEFT_getInstance();\n case 'RIGHT':\n return TextLabel$HorizontalAnchor$RIGHT_getInstance();\n case 'MIDDLE':\n return TextLabel$HorizontalAnchor$MIDDLE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.render.svg.TextLabel.HorizontalAnchor.' + name);\n }\n }\n TextLabel$HorizontalAnchor.valueOf_61zpoe$ = TextLabel$HorizontalAnchor$valueOf;\n function TextLabel$VerticalAnchor(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function TextLabel$VerticalAnchor_initFields() {\n TextLabel$VerticalAnchor_initFields = function () {\n };\n TextLabel$VerticalAnchor$TOP_instance = new TextLabel$VerticalAnchor('TOP', 0);\n TextLabel$VerticalAnchor$BOTTOM_instance = new TextLabel$VerticalAnchor('BOTTOM', 1);\n TextLabel$VerticalAnchor$CENTER_instance = new TextLabel$VerticalAnchor('CENTER', 2);\n }\n var TextLabel$VerticalAnchor$TOP_instance;\n function TextLabel$VerticalAnchor$TOP_getInstance() {\n TextLabel$VerticalAnchor_initFields();\n return TextLabel$VerticalAnchor$TOP_instance;\n }\n var TextLabel$VerticalAnchor$BOTTOM_instance;\n function TextLabel$VerticalAnchor$BOTTOM_getInstance() {\n TextLabel$VerticalAnchor_initFields();\n return TextLabel$VerticalAnchor$BOTTOM_instance;\n }\n var TextLabel$VerticalAnchor$CENTER_instance;\n function TextLabel$VerticalAnchor$CENTER_getInstance() {\n TextLabel$VerticalAnchor_initFields();\n return TextLabel$VerticalAnchor$CENTER_instance;\n }\n TextLabel$VerticalAnchor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalAnchor',\n interfaces: [Enum]\n };\n function TextLabel$VerticalAnchor$values() {\n return [TextLabel$VerticalAnchor$TOP_getInstance(), TextLabel$VerticalAnchor$BOTTOM_getInstance(), TextLabel$VerticalAnchor$CENTER_getInstance()];\n }\n TextLabel$VerticalAnchor.values = TextLabel$VerticalAnchor$values;\n function TextLabel$VerticalAnchor$valueOf(name) {\n switch (name) {\n case 'TOP':\n return TextLabel$VerticalAnchor$TOP_getInstance();\n case 'BOTTOM':\n return TextLabel$VerticalAnchor$BOTTOM_getInstance();\n case 'CENTER':\n return TextLabel$VerticalAnchor$CENTER_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.render.svg.TextLabel.VerticalAnchor.' + name);\n }\n }\n TextLabel$VerticalAnchor.valueOf_61zpoe$ = TextLabel$VerticalAnchor$valueOf;\n TextLabel.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TextLabel',\n interfaces: [SvgComponent]\n };\n function AbstractScale() {\n this.definedBreaks_0 = null;\n this.definedLabels_0 = null;\n this.name_iafnnl$_0 = null;\n this.mapper_ohg8eh$_0 = null;\n this.multiplicativeExpand_lxi716$_0 = 0.0;\n this.additiveExpand_59ok4k$_0 = 0.0;\n this.labelFormatter_tb2f2k$_0 = null;\n }\n Object.defineProperty(AbstractScale.prototype, 'name', {\n configurable: true,\n get: function () {\n return this.name_iafnnl$_0;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'mapper', {\n configurable: true,\n get: function () {\n return this.mapper_ohg8eh$_0;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'multiplicativeExpand', {\n configurable: true,\n get: function () {\n return this.multiplicativeExpand_lxi716$_0;\n },\n set: function (multiplicativeExpand) {\n this.multiplicativeExpand_lxi716$_0 = multiplicativeExpand;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'additiveExpand', {\n configurable: true,\n get: function () {\n return this.additiveExpand_59ok4k$_0;\n },\n set: function (additiveExpand) {\n this.additiveExpand_59ok4k$_0 = additiveExpand;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'labelFormatter', {\n configurable: true,\n get: function () {\n return this.labelFormatter_tb2f2k$_0;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'isContinuous', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(AbstractScale.prototype, 'isContinuousDomain', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n AbstractScale.prototype.hasBreaks = function () {\n return this.definedBreaks_0 != null;\n };\n AbstractScale.prototype.getBreaksIntern = function () {\n var tmp$;\n if (!this.hasBreaks()) {\n var message = 'No breaks defined for scale ' + this.name;\n throw IllegalStateException_init(message.toString());\n }return Kotlin.isType(tmp$ = this.definedBreaks_0, List) ? tmp$ : throwCCE();\n };\n AbstractScale.prototype.getLabelsIntern = function () {\n if (!(this.definedLabels_0 != null)) {\n var message = 'No labels defined for scale ' + this.name;\n throw IllegalStateException_init(message.toString());\n }return this.definedLabels_0;\n };\n AbstractScale.prototype.applyTransform_yzw12z$ = function (source, checkLimits) {\n var tmp$;\n var source_0 = source;\n if (checkLimits && this.hasDomainLimits()) {\n var $receiver = source_0;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(item == null || this.isInDomainLimits_za3rmp$(item) ? item : null);\n }\n source_0 = destination;\n }if (Kotlin.isType(this.transform, ContinuousTransform)) {\n var continuousTransform = Kotlin.isType(tmp$ = this.transform, ContinuousTransform) ? tmp$ : throwCCE();\n if (continuousTransform.hasDomainLimits()) {\n var $receiver_0 = source_0;\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault($receiver_0, 10));\n var tmp$_1;\n tmp$_1 = $receiver_0.iterator();\n while (tmp$_1.hasNext()) {\n var item_0 = tmp$_1.next();\n var tmp$_2;\n destination_0.add_11rb$(continuousTransform.isInDomain_yrwdxb$((tmp$_2 = item_0) == null || typeof tmp$_2 === 'number' ? tmp$_2 : throwCCE()) ? item_0 : null);\n }\n source_0 = destination_0;\n }}return this.transform.apply_9ma18$(source_0);\n };\n AbstractScale.prototype.getScaleBreaks = function () {\n if (!this.hasBreaks()) {\n return ScaleBreaks$Companion_getInstance().EMPTY;\n }var breakValuesIntern = this.getBreaksIntern();\n var labels = this.getLabels_0(breakValuesIntern);\n var transformed = this.applyTransform_yzw12z$(breakValuesIntern, false);\n var destination = ArrayList_init_1(collectionSizeOrDefault(transformed, 10));\n var tmp$, tmp$_0;\n var index = 0;\n tmp$ = transformed.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_1 = destination.add_11rb$;\n var i = checkIndexOverflow((tmp$_0 = index, index = tmp$_0 + 1 | 0, tmp$_0));\n tmp$_1.call(destination, item == null ? null : i);\n }\n var keepIndices = toSet(filterNotNull(destination));\n var destination_0 = ArrayList_init();\n var tmp$_2, tmp$_0_0;\n var index_0 = 0;\n tmp$_2 = breakValuesIntern.iterator();\n while (tmp$_2.hasNext()) {\n var item_0 = tmp$_2.next();\n if (keepIndices.contains_11rb$(checkIndexOverflow((tmp$_0_0 = index_0, index_0 = tmp$_0_0 + 1 | 0, tmp$_0_0))))\n destination_0.add_11rb$(item_0);\n }\n var tmp$_3 = filterNotNull(transformed);\n var destination_1 = ArrayList_init();\n var tmp$_4, tmp$_0_1;\n var index_1 = 0;\n tmp$_4 = labels.iterator();\n while (tmp$_4.hasNext()) {\n var item_1 = tmp$_4.next();\n if (keepIndices.contains_11rb$(checkIndexOverflow((tmp$_0_1 = index_1, index_1 = tmp$_0_1 + 1 | 0, tmp$_0_1))))\n destination_1.add_11rb$(item_1);\n }\n return new ScaleBreaks(destination_0, tmp$_3, destination_1);\n };\n function AbstractScale$getLabels$lambda(v) {\n return v.toString();\n }\n AbstractScale.prototype.getLabels_0 = function (breaks) {\n var tmp$, tmp$_0;\n if (this.definedLabels_0 != null) {\n var labels = this.getLabelsIntern();\n if (labels.isEmpty()) {\n var size = breaks.size;\n var list = ArrayList_init_1(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$('');\n }\n tmp$ = list;\n } else if (breaks.size <= labels.size)\n tmp$ = labels.subList_vux9f0$(0, breaks.size);\n else {\n var size_0 = breaks.size;\n var list_0 = ArrayList_init_1(size_0);\n for (var index_0 = 0; index_0 < size_0; index_0++) {\n list_0.add_11rb$(labels.get_za3lpa$(index_0 % labels.size));\n }\n tmp$ = list_0;\n }\n return tmp$;\n }var formatter = (tmp$_0 = this.labelFormatter) != null ? tmp$_0 : AbstractScale$getLabels$lambda;\n var destination = ArrayList_init_1(collectionSizeOrDefault(breaks, 10));\n var tmp$_1;\n tmp$_1 = breaks.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n destination.add_11rb$(formatter(item));\n }\n return destination;\n };\n function AbstractScale$AbstractBuilder(scale) {\n this.myName_8be2vx$ = scale.name;\n this.myBreaks_8be2vx$ = scale.definedBreaks_0;\n this.myLabels_8be2vx$ = scale.definedLabels_0;\n this.myLabelFormatter_8be2vx$ = scale.labelFormatter;\n this.myMapper_8be2vx$ = scale.mapper;\n this.myMultiplicativeExpand_8be2vx$ = scale.multiplicativeExpand;\n this.myAdditiveExpand_8be2vx$ = scale.additiveExpand;\n }\n AbstractScale$AbstractBuilder.prototype.breaks_pqjuzw$ = function (l) {\n var destination = ArrayList_init_1(collectionSizeOrDefault(l, 10));\n var tmp$;\n tmp$ = l.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_0;\n destination.add_11rb$((tmp$_0 = item) == null || Kotlin.isType(tmp$_0, Any) ? tmp$_0 : throwCCE());\n }\n this.myBreaks_8be2vx$ = destination;\n return this;\n };\n AbstractScale$AbstractBuilder.prototype.labels_mhpeer$ = function (l) {\n this.myLabels_8be2vx$ = l;\n return this;\n };\n AbstractScale$AbstractBuilder.prototype.labelFormatter_h0j1qz$ = function (v) {\n this.myLabelFormatter_8be2vx$ = v;\n return this;\n };\n AbstractScale$AbstractBuilder.prototype.mapper_1uitho$ = function (m) {\n this.myMapper_8be2vx$ = m;\n return this;\n };\n AbstractScale$AbstractBuilder.prototype.multiplicativeExpand_14dthe$ = function (v) {\n this.myMultiplicativeExpand_8be2vx$ = v;\n return this;\n };\n AbstractScale$AbstractBuilder.prototype.additiveExpand_14dthe$ = function (v) {\n this.myAdditiveExpand_8be2vx$ = v;\n return this;\n };\n AbstractScale$AbstractBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractBuilder',\n interfaces: [Scale$Builder]\n };\n AbstractScale.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractScale',\n interfaces: [Scale]\n };\n function AbstractScale_init(name, mapper, breaks, $this) {\n if (breaks === void 0)\n breaks = null;\n $this = $this || Object.create(AbstractScale.prototype);\n AbstractScale.call($this);\n $this.name_iafnnl$_0 = name;\n $this.mapper_ohg8eh$_0 = mapper;\n $this.definedBreaks_0 = breaks;\n $this.definedLabels_0 = null;\n $this.labelFormatter_tb2f2k$_0 = null;\n return $this;\n }\n function AbstractScale_init_0(b, $this) {\n $this = $this || Object.create(AbstractScale.prototype);\n AbstractScale.call($this);\n $this.name_iafnnl$_0 = b.myName_8be2vx$;\n $this.definedBreaks_0 = b.myBreaks_8be2vx$;\n $this.definedLabels_0 = b.myLabels_8be2vx$;\n $this.labelFormatter_tb2f2k$_0 = b.myLabelFormatter_8be2vx$;\n $this.mapper_ohg8eh$_0 = b.myMapper_8be2vx$;\n $this.multiplicativeExpand = b.myMultiplicativeExpand_8be2vx$;\n $this.additiveExpand = b.myAdditiveExpand_8be2vx$;\n return $this;\n }\n function BreaksGenerator() {\n }\n BreaksGenerator.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'BreaksGenerator',\n interfaces: []\n };\n function ContinuousScale() {\n this.continuousTransform_0 = null;\n this.customBreaksGenerator_0 = null;\n this.isContinuous_r02bms$_0 = false;\n this.isContinuousDomain_cs93sw$_0 = true;\n this.continuousDomainLimits = null;\n }\n Object.defineProperty(ContinuousScale.prototype, 'isContinuous', {\n configurable: true,\n get: function () {\n return this.isContinuous_r02bms$_0;\n }\n });\n Object.defineProperty(ContinuousScale.prototype, 'isContinuousDomain', {\n configurable: true,\n get: function () {\n return this.isContinuousDomain_cs93sw$_0;\n }\n });\n Object.defineProperty(ContinuousScale.prototype, 'transform', {\n configurable: true,\n get: function () {\n return this.continuousTransform_0;\n }\n });\n ContinuousScale.prototype.getBreaksGenerator = function () {\n var tmp$;\n if (this.customBreaksGenerator_0 != null) {\n tmp$ = new Transforms$BreaksGeneratorForTransformedDomain(this.continuousTransform_0, this.customBreaksGenerator_0);\n } else {\n tmp$ = Transforms_getInstance().createBreaksGeneratorForTransformedDomain_5x42z5$(this.continuousTransform_0, this.labelFormatter);\n }\n return tmp$;\n };\n ContinuousScale.prototype.isInDomainLimits_za3rmp$ = function (v) {\n var tmp$;\n if (Kotlin.isNumber(v)) {\n var d = numberToDouble(v);\n tmp$ = (isFinite(d) && d >= this.continuousDomainLimits.first && d <= this.continuousDomainLimits.second);\n } else {\n tmp$ = false;\n }\n return tmp$;\n };\n ContinuousScale.prototype.hasDomainLimits = function () {\n return isFinite(this.continuousDomainLimits.first) || isFinite(this.continuousDomainLimits.second);\n };\n ContinuousScale.prototype.with = function () {\n return new ContinuousScale$MyBuilder(this);\n };\n function ContinuousScale$MyBuilder(scale) {\n AbstractScale$AbstractBuilder.call(this, scale);\n this.myContinuousTransform = scale.continuousTransform_0;\n this.myCustomBreaksGenerator = scale.customBreaksGenerator_0;\n this.myLowerLimit = scale.continuousDomainLimits.first;\n this.myUpperLimit = scale.continuousDomainLimits.second;\n this.myContinuousOutput = scale.isContinuous;\n }\n ContinuousScale$MyBuilder.prototype.lowerLimit_14dthe$ = function (v) {\n if (!isFinite(v)) {\n var message = \"`lower` can't be \" + v;\n throw IllegalArgumentException_init(message.toString());\n }this.myLowerLimit = v;\n return this;\n };\n ContinuousScale$MyBuilder.prototype.upperLimit_14dthe$ = function (v) {\n if (!isFinite(v)) {\n var message = \"`upper` can't be \" + v;\n throw IllegalArgumentException_init(message.toString());\n }this.myUpperLimit = v;\n return this;\n };\n ContinuousScale$MyBuilder.prototype.limits_pqjuzw$ = function (domainValues) {\n throw IllegalArgumentException_init(\"Can't apply discrete limits to scale with continuous domain\");\n };\n ContinuousScale$MyBuilder.prototype.continuousTransform_gxz7zd$ = function (v) {\n this.myContinuousTransform = v;\n return this;\n };\n ContinuousScale$MyBuilder.prototype.breaksGenerator_6q5k0b$ = function (v) {\n this.myCustomBreaksGenerator = v;\n return this;\n };\n ContinuousScale$MyBuilder.prototype.build = function () {\n return ContinuousScale_init_0(this);\n };\n ContinuousScale$MyBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyBuilder',\n interfaces: [AbstractScale$AbstractBuilder]\n };\n ContinuousScale.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContinuousScale',\n interfaces: [AbstractScale]\n };\n function ContinuousScale_init(name, mapper, continuousOutput, $this) {\n $this = $this || Object.create(ContinuousScale.prototype);\n AbstractScale_init(name, mapper, void 0, $this);\n ContinuousScale.call($this);\n $this.isContinuous_r02bms$_0 = continuousOutput;\n $this.continuousDomainLimits = new Pair_0(kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY, kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY);\n $this.continuousTransform_0 = Transforms_getInstance().IDENTITY;\n $this.customBreaksGenerator_0 = null;\n $this.multiplicativeExpand = 0.05;\n $this.additiveExpand = 0.0;\n return $this;\n }\n function ContinuousScale_init_0(b, $this) {\n $this = $this || Object.create(ContinuousScale.prototype);\n AbstractScale_init_0(b, $this);\n ContinuousScale.call($this);\n $this.continuousTransform_0 = b.myContinuousTransform;\n $this.customBreaksGenerator_0 = b.myCustomBreaksGenerator;\n $this.isContinuous_r02bms$_0 = b.myContinuousOutput;\n var lower = data.SeriesUtil.isFinite_yrwdxb$(b.myLowerLimit) ? ensureNotNull(b.myLowerLimit) : kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY;\n var upper = data.SeriesUtil.isFinite_yrwdxb$(b.myUpperLimit) ? ensureNotNull(b.myUpperLimit) : kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY;\n $this.continuousDomainLimits = new Pair_0(JsMath.min(lower, upper), JsMath.max(lower, upper));\n return $this;\n }\n function DiscreteScale() {\n this.discreteTransform_0 = null;\n }\n Object.defineProperty(DiscreteScale.prototype, 'transform', {\n configurable: true,\n get: function () {\n return this.discreteTransform_0;\n }\n });\n DiscreteScale.prototype.getBreaksGenerator = function () {\n throw IllegalStateException_init(\"No breaks generator for discrete scale '\" + this.name + \"'\");\n };\n DiscreteScale.prototype.hasDomainLimits = function () {\n return this.discreteTransform_0.hasDomainLimits();\n };\n DiscreteScale.prototype.isInDomainLimits_za3rmp$ = function (v) {\n return this.discreteTransform_0.isInDomain_s8jyv4$(v);\n };\n DiscreteScale.prototype.getBreaksIntern = function () {\n var tmp$;\n if (!this.hasDomainLimits()) {\n tmp$ = AbstractScale.prototype.getBreaksIntern.call(this);\n } else {\n var breaksSet = toSet(AbstractScale.prototype.getBreaksIntern.call(this));\n var $receiver = this.discreteTransform_0.domainLimits;\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (breaksSet.contains_11rb$(element))\n destination.add_11rb$(element);\n }\n tmp$ = destination;\n }\n return tmp$;\n };\n DiscreteScale.prototype.getLabelsIntern = function () {\n var tmp$;\n var labels = AbstractScale.prototype.getLabelsIntern.call(this);\n if (!this.hasDomainLimits() || labels.isEmpty()) {\n tmp$ = labels;\n } else {\n var breaks = AbstractScale.prototype.getBreaksIntern.call(this);\n var destination = ArrayList_init_1(collectionSizeOrDefault(breaks, 10));\n var tmp$_0, tmp$_0_0;\n var index = 0;\n tmp$_0 = breaks.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(labels.get_za3lpa$(checkIndexOverflow((tmp$_0_0 = index, index = tmp$_0_0 + 1 | 0, tmp$_0_0)) % labels.size));\n }\n var breakLabels = destination;\n var labelByBreak = toMap(zip(breaks, breakLabels));\n var $receiver = this.discreteTransform_0.domainLimits;\n var destination_0 = ArrayList_init();\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n if (labelByBreak.containsKey_11rb$(element))\n destination_0.add_11rb$(element);\n }\n var destination_1 = ArrayList_init_1(collectionSizeOrDefault(destination_0, 10));\n var tmp$_2;\n tmp$_2 = destination_0.iterator();\n while (tmp$_2.hasNext()) {\n var item_0 = tmp$_2.next();\n destination_1.add_11rb$(getValue(labelByBreak, item_0));\n }\n tmp$ = destination_1;\n }\n return tmp$;\n };\n DiscreteScale.prototype.with = function () {\n return new DiscreteScale$MyBuilder(this);\n };\n function DiscreteScale$MyBuilder(scale) {\n AbstractScale$AbstractBuilder.call(this, scale);\n this.myDomainValues_8be2vx$ = scale.discreteTransform_0.domainValues;\n this.myDomainLimits_8be2vx$ = scale.discreteTransform_0.domainLimits;\n }\n DiscreteScale$MyBuilder.prototype.breaksGenerator_6q5k0b$ = function (v) {\n throw IllegalStateException_init('Not applicable to scale with discrete domain');\n };\n DiscreteScale$MyBuilder.prototype.lowerLimit_14dthe$ = function (v) {\n throw IllegalStateException_init('Not applicable to scale with discrete domain');\n };\n DiscreteScale$MyBuilder.prototype.upperLimit_14dthe$ = function (v) {\n throw IllegalStateException_init('Not applicable to scale with discrete domain');\n };\n DiscreteScale$MyBuilder.prototype.limits_pqjuzw$ = function (domainValues) {\n this.myDomainLimits_8be2vx$ = domainValues;\n return this;\n };\n DiscreteScale$MyBuilder.prototype.continuousTransform_gxz7zd$ = function (v) {\n return this;\n };\n DiscreteScale$MyBuilder.prototype.build = function () {\n return DiscreteScale_init_0(this);\n };\n DiscreteScale$MyBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyBuilder',\n interfaces: [AbstractScale$AbstractBuilder]\n };\n DiscreteScale.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DiscreteScale',\n interfaces: [AbstractScale]\n };\n function DiscreteScale_init(name, domainValues, mapper, $this) {\n $this = $this || Object.create(DiscreteScale.prototype);\n AbstractScale_init(name, mapper, toList_0(domainValues), $this);\n DiscreteScale.call($this);\n $this.discreteTransform_0 = new DiscreteTransform(domainValues, emptyList());\n $this.multiplicativeExpand = 0.0;\n $this.additiveExpand = 0.6;\n return $this;\n }\n function DiscreteScale_init_0(b, $this) {\n $this = $this || Object.create(DiscreteScale.prototype);\n AbstractScale_init_0(b, $this);\n DiscreteScale.call($this);\n $this.discreteTransform_0 = new DiscreteTransform(b.myDomainValues_8be2vx$, b.myDomainLimits_8be2vx$);\n return $this;\n }\n function MapperUtil() {\n MapperUtil_instance = this;\n }\n MapperUtil.prototype.map_rejkqi$ = function (r, mapper) {\n var a = ensureNotNull(mapper(r.lowerEnd));\n var b = ensureNotNull(mapper(r.upperEnd));\n return new ClosedRange(JsMath.min(a, b), JsMath.max(a, b));\n };\n MapperUtil.prototype.mapDiscreteDomainValuesToNumbers_7f6uoc$ = function (values) {\n return this.mapDiscreteDomainValuesToIndices_0(values);\n };\n MapperUtil.prototype.mapDiscreteDomainValuesToIndices_0 = function (values) {\n var tmp$, tmp$_0;\n var result = LinkedHashMap_init();\n var index = 0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (v != null && !result.containsKey_11rb$(v)) {\n var value = (tmp$_0 = index, index = tmp$_0 + 1 | 0, tmp$_0);\n result.put_xwzc9p$(v, value);\n }}\n return result;\n };\n MapperUtil.prototype.rangeWithLimitsAfterTransform_1g0x2p$ = function (dataRange, lowerLimit, upperLimit, trans) {\n var tmp$, tmp$_0;\n if (lowerLimit != null && isFinite(lowerLimit)) {\n tmp$ = lowerLimit;\n } else {\n tmp$ = dataRange.lowerEnd;\n }\n var lower = tmp$;\n if (!trans.isInDomain_yrwdxb$(lower)) {\n var message = '[' + toString(Kotlin.getKClassFromExpression(trans).simpleName) + '] Lower end ' + lower + \" is outside of transform's domain.\";\n throw IllegalStateException_init(message.toString());\n }if (upperLimit != null && isFinite(upperLimit)) {\n tmp$_0 = upperLimit;\n } else {\n tmp$_0 = dataRange.upperEnd;\n }\n var upper = tmp$_0;\n if (!trans.isInDomain_yrwdxb$(upper)) {\n var message_0 = '[' + toString(Kotlin.getKClassFromExpression(trans).simpleName) + '] Lower end ' + upper + \" is outside of transform's domain.\";\n throw IllegalStateException_init(message_0.toString());\n }var limits = listOf([lower, upper]);\n return ClosedRange.Companion.encloseAll_17hg47$(trans.apply_9ma18$(limits));\n };\n MapperUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'MapperUtil',\n interfaces: []\n };\n var MapperUtil_instance = null;\n function MapperUtil_getInstance() {\n if (MapperUtil_instance === null) {\n new MapperUtil();\n }return MapperUtil_instance;\n }\n function Mappers() {\n Mappers_instance = this;\n this.IDENTITY = Mappers$IDENTITY$lambda;\n }\n function Mappers$undefined$lambda(it) {\n throw IllegalStateException_init('Undefined mapper');\n }\n Mappers.prototype.undefined_287e2$ = function () {\n return Mappers$undefined$lambda;\n };\n function Mappers$nullable$lambda(closure$ifNull, closure$f) {\n return function (n) {\n if (n == null) {\n return closure$ifNull;\n } else {\n return closure$f(n);\n }\n };\n }\n Mappers.prototype.nullable_q9jsah$ = function (f, ifNull) {\n return Mappers$nullable$lambda(ifNull, f);\n };\n function Mappers$constant$lambda(closure$v) {\n return function (it) {\n return closure$v;\n };\n }\n Mappers.prototype.constant_14dthe$ = function (v) {\n return Mappers$constant$lambda(v);\n };\n Mappers.prototype.mul_mdyssk$ = function (domain, rangeSpan) {\n var factor = rangeSpan / (domain.upperEnd - domain.lowerEnd);\n if (!!(isInfinite(factor) || isNaN_0(factor))) {\n var message = \"Can't create mapper with ratio: \" + factor;\n throw IllegalStateException_init(message.toString());\n }return this.mul_14dthe$(factor);\n };\n function Mappers$mul$lambda(closure$factor) {\n return function (v) {\n if (v != null) {\n return closure$factor * v;\n } else\n return null;\n };\n }\n Mappers.prototype.mul_14dthe$ = function (factor) {\n return Mappers$mul$lambda(factor);\n };\n Mappers.prototype.linear_1jkouz$ = function (domain, range, reverse) {\n if (reverse === void 0)\n reverse = false;\n return this.linear_yl4mmw$(domain, reverse ? range.upperEnd : range.lowerEnd, reverse ? range.lowerEnd : range.upperEnd, kotlin_js_internal_DoubleCompanionObject.NaN);\n };\n Mappers.prototype.linear_lww37m$ = function (domain, range, defaultValue) {\n return this.linear_yl4mmw$(domain, range.lowerEnd, range.upperEnd, defaultValue);\n };\n function Mappers$linear$lambda(closure$slop, closure$intersect, closure$defaultValue) {\n return function (input) {\n return data.SeriesUtil.isFinite_yrwdxb$(input) ? ensureNotNull(input) * closure$slop + closure$intersect : closure$defaultValue;\n };\n }\n Mappers.prototype.linear_yl4mmw$ = function (domain, rangeLow, rangeHigh, defaultValue) {\n var slop = (rangeHigh - rangeLow) / (domain.upperEnd - domain.lowerEnd);\n if (!data.SeriesUtil.isFinite_14dthe$(slop)) {\n var v = (rangeHigh - rangeLow) / 2 + rangeLow;\n return this.constant_14dthe$(v);\n }var intersect = rangeLow - domain.lowerEnd * slop;\n return Mappers$linear$lambda(slop, intersect, defaultValue);\n };\n Mappers.prototype.discreteToContinuous_83ntpg$ = function (domainValues, outputRange, naValue) {\n var tmp$;\n var numberByDomainValue = MapperUtil_getInstance().mapDiscreteDomainValuesToNumbers_7f6uoc$(domainValues);\n tmp$ = data.SeriesUtil.range_l63ks6$(numberByDomainValue.values);\n if (tmp$ == null) {\n return this.IDENTITY;\n }var dataRange = tmp$;\n return this.linear_lww37m$(dataRange, outputRange, naValue);\n };\n function Mappers$discrete$lambda(closure$f) {\n return function (it) {\n return closure$f.apply_11rb$(it);\n };\n }\n Mappers.prototype.discrete_rath1t$ = function (outputValues, defaultOutputValue) {\n var f = new Mappers$DiscreteFun(outputValues, defaultOutputValue);\n return Mappers$discrete$lambda(f);\n };\n function Mappers$quantized$lambda(closure$defaultOutputValue) {\n return function (it) {\n return closure$defaultOutputValue;\n };\n }\n function Mappers$quantized$lambda_0(closure$f) {\n return function (it) {\n return closure$f.apply_11rb$(it);\n };\n }\n Mappers.prototype.quantized_hd8s0$ = function (domain, outputValues, defaultOutputValue) {\n if (domain == null) {\n return Mappers$quantized$lambda(defaultOutputValue);\n }var quantizer = new QuantizeScale();\n quantizer.domain_lu1900$(domain.lowerEnd, domain.upperEnd);\n quantizer.range_brywnq$(outputValues);\n var f = new Mappers$QuantizedFun(quantizer, defaultOutputValue);\n return Mappers$quantized$lambda_0(f);\n };\n function Mappers$DiscreteFun(myOutputValues, myDefaultOutputValue) {\n this.myOutputValues_0 = myOutputValues;\n this.myDefaultOutputValue_0 = myDefaultOutputValue;\n }\n Mappers$DiscreteFun.prototype.apply_11rb$ = function (value) {\n if (!data.SeriesUtil.isFinite_yrwdxb$(value)) {\n return this.myDefaultOutputValue_0;\n }var index = numberToInt(round(ensureNotNull(value)));\n index = index % this.myOutputValues_0.size;\n if (index < 0) {\n index = index + this.myOutputValues_0.size | 0;\n }return this.myOutputValues_0.get_za3lpa$(index);\n };\n Mappers$DiscreteFun.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DiscreteFun',\n interfaces: [Function]\n };\n function Mappers$QuantizedFun(myQuantizer, myDefaultOutputValue) {\n this.myQuantizer_0 = myQuantizer;\n this.myDefaultOutputValue_0 = myDefaultOutputValue;\n }\n Mappers$QuantizedFun.prototype.apply_11rb$ = function (value) {\n return !data.SeriesUtil.isFinite_yrwdxb$(value) ? this.myDefaultOutputValue_0 : this.myQuantizer_0.quantize_14dthe$(ensureNotNull(value));\n };\n Mappers$QuantizedFun.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'QuantizedFun',\n interfaces: [Function]\n };\n function Mappers$IDENTITY$lambda(v) {\n return v;\n }\n Mappers.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Mappers',\n interfaces: []\n };\n var Mappers_instance = null;\n function Mappers_getInstance() {\n if (Mappers_instance === null) {\n new Mappers();\n }return Mappers_instance;\n }\n function ScaleBreaks(domainValues, transformedValues, labels) {\n ScaleBreaks$Companion_getInstance();\n this.domainValues = domainValues;\n this.transformedValues = transformedValues;\n this.labels = labels;\n if (!(this.domainValues.size === this.transformedValues.size)) {\n var message = 'Scale breaks size: ' + this.domainValues.size + ' transformed size: ' + this.transformedValues.size + ' but expected to be the same';\n throw IllegalArgumentException_init(message.toString());\n }if (!(this.domainValues.size === this.labels.size)) {\n var message_0 = 'Scale breaks size: ' + this.domainValues.size + ' labels size: ' + this.labels.size + ' but expected to be the same';\n throw IllegalArgumentException_init(message_0.toString());\n }}\n Object.defineProperty(ScaleBreaks.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.domainValues.isEmpty();\n }\n });\n Object.defineProperty(ScaleBreaks.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.domainValues.size;\n }\n });\n function ScaleBreaks$Companion() {\n ScaleBreaks$Companion_instance = this;\n this.EMPTY = new ScaleBreaks(emptyList(), emptyList(), emptyList());\n }\n ScaleBreaks$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ScaleBreaks$Companion_instance = null;\n function ScaleBreaks$Companion_getInstance() {\n if (ScaleBreaks$Companion_instance === null) {\n new ScaleBreaks$Companion();\n }return ScaleBreaks$Companion_instance;\n }\n ScaleBreaks.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ScaleBreaks',\n interfaces: []\n };\n function ScaleUtil() {\n ScaleUtil_instance = this;\n }\n ScaleUtil.prototype.labelByBreak_x4zrm4$ = function (scale) {\n var scaleBreaks = scale.getScaleBreaks();\n return toMap(zip(scaleBreaks.domainValues, scaleBreaks.labels));\n };\n ScaleUtil.prototype.map_dp4lfi$ = function (range, scale) {\n return MapperUtil_getInstance().map_rejkqi$(range, scale.mapper);\n };\n ScaleUtil.prototype.map_9ksyxk$ = function (l, scale) {\n var mapper = scale.mapper;\n var destination = ArrayList_init_1(collectionSizeOrDefault(l, 10));\n var tmp$;\n tmp$ = l.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(mapper(item));\n }\n return destination;\n };\n ScaleUtil.prototype.inverseTransformToContinuousDomain_codrxm$ = function (l, scale) {\n var tmp$;\n if (!scale.isContinuousDomain) {\n var message = 'Not continuous numeric domain: ' + scale;\n throw IllegalStateException_init(message.toString());\n }return (Kotlin.isType(tmp$ = scale.transform, ContinuousTransform) ? tmp$ : throwCCE()).applyInverse_k9kaly$(l);\n };\n ScaleUtil.prototype.inverseTransform_codrxm$ = function (l, scale) {\n var tmp$;\n var transform = scale.transform;\n if (Kotlin.isType(transform, ContinuousTransform)) {\n tmp$ = transform.applyInverse_k9kaly$(l);\n } else {\n var destination = ArrayList_init_1(collectionSizeOrDefault(l, 10));\n var tmp$_0;\n tmp$_0 = l.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(transform.applyInverse_yrwdxb$(item));\n }\n tmp$ = destination;\n }\n return tmp$;\n };\n ScaleUtil.prototype.transformedDefinedLimits_x4zrm4$ = function (scale) {\n var tmp$, tmp$_0, tmp$_1;\n Kotlin.isType(tmp$ = scale, ContinuousScale) ? tmp$ : throwCCE();\n var tmp$_2 = scale.continuousDomainLimits;\n var lower = tmp$_2.component1()\n , upper = tmp$_2.component2();\n var transform = Kotlin.isType(tmp$_0 = scale.transform, ContinuousTransform) ? tmp$_0 : throwCCE();\n var tmp$_3 = new Pair_0(transform.isInDomain_yrwdxb$(lower) ? ensureNotNull(transform.apply_yrwdxb$(lower)) : kotlin_js_internal_DoubleCompanionObject.NaN, transform.isInDomain_yrwdxb$(upper) ? ensureNotNull(transform.apply_yrwdxb$(upper)) : kotlin_js_internal_DoubleCompanionObject.NaN);\n var transformedLower = tmp$_3.component1()\n , transformedUpper = tmp$_3.component2();\n if (data.SeriesUtil.allFinite_jma9l8$(transformedLower, transformedUpper)) {\n tmp$_1 = new Pair_0(JsMath.min(transformedLower, transformedUpper), JsMath.max(transformedLower, transformedUpper));\n } else {\n tmp$_1 = new Pair_0(transformedLower, transformedUpper);\n }\n return tmp$_1;\n };\n ScaleUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ScaleUtil',\n interfaces: []\n };\n var ScaleUtil_instance = null;\n function ScaleUtil_getInstance() {\n if (ScaleUtil_instance === null) {\n new ScaleUtil();\n }return ScaleUtil_instance;\n }\n function Scales() {\n Scales_instance = this;\n }\n Scales.prototype.continuousDomain_sqn2xl$ = function (name, aes) {\n return ContinuousScale_init(name, Mappers_getInstance().undefined_287e2$(), aes.isNumeric);\n };\n Scales.prototype.continuousDomainNumericRange_61zpoe$ = function (name) {\n return ContinuousScale_init(name, Mappers_getInstance().undefined_287e2$(), true);\n };\n Scales.prototype.continuousDomain_lo18em$ = function (name, mapper, continuousRange) {\n return ContinuousScale_init(name, mapper, continuousRange);\n };\n Scales.prototype.discreteDomain_uksd38$ = function (name, domainValues) {\n return this.discreteDomain_l9mre7$(name, domainValues, Mappers_getInstance().undefined_287e2$());\n };\n Scales.prototype.discreteDomain_l9mre7$ = function (name, domainValues, mapper) {\n return DiscreteScale_init(name, domainValues, mapper);\n };\n Scales.prototype.pureDiscrete_kiqtr1$ = function (name, domainValues, outputValues, defaultOutputValue) {\n return this.discreteDomain_uksd38$(name, domainValues).with().mapper_1uitho$(Mappers_getInstance().discrete_rath1t$(outputValues, defaultOutputValue)).build();\n };\n Scales.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Scales',\n interfaces: []\n };\n var Scales_instance = null;\n function Scales_getInstance() {\n if (Scales_instance === null) {\n new Scales();\n }return Scales_instance;\n }\n function BreaksHelperBase(start, end, targetCount) {\n this.normalStart = 0;\n this.normalEnd = 0;\n this.span = 0;\n this.targetStep = 0;\n this.isReversed = false;\n if (!isFinite(start)) {\n var message = 'range start ' + start;\n throw IllegalArgumentException_init(message.toString());\n }if (!isFinite(end)) {\n var message_0 = 'range end ' + end;\n throw IllegalArgumentException_init(message_0.toString());\n }if (!(targetCount > 0)) {\n var message_1 = \"'count' must be positive: \" + targetCount;\n throw IllegalArgumentException_init(message_1.toString());\n }var span = end - start;\n var reversed = false;\n if (span < 0) {\n span = -span;\n reversed = true;\n }this.span = span;\n this.targetStep = this.span / targetCount;\n this.isReversed = reversed;\n this.normalStart = reversed ? end : start;\n this.normalEnd = reversed ? start : end;\n }\n BreaksHelperBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BreaksHelperBase',\n interfaces: []\n };\n function DateTimeBreaksHelper(rangeStart, rangeEnd, count, minInterval) {\n if (minInterval === void 0)\n minInterval = null;\n BreaksHelperBase.call(this, rangeStart, rangeEnd, count);\n this.breaks_n95hiz$_0 = null;\n this.formatter = null;\n var tmp$;\n var step = this.targetStep;\n if (step < 1000) {\n this.formatter = (new TimeScaleTickFormatterFactory(minInterval)).getFormatter_14dthe$(step);\n this.breaks_n95hiz$_0 = (new LinearBreaksHelper(rangeStart, rangeEnd, count)).breaks;\n } else {\n var start = this.normalStart;\n var end = this.normalEnd;\n var ticks = null;\n if (minInterval != null) {\n ticks = toMutableList(minInterval.range_lu1900$(start, end));\n }if (ticks != null && ticks.size <= count) {\n this.formatter = ensureNotNull(minInterval).tickFormatter;\n } else if (step > YearInterval.Companion.MS) {\n this.formatter = YearInterval.Companion.TICK_FORMATTER;\n ticks = ArrayList_init();\n var startDateTime = time.TimeUtil.asDateTimeUTC_14dthe$(start);\n var startYear = startDateTime.year;\n if (startDateTime.isAfter_amwj4p$(time.TimeUtil.yearStart_za3lpa$(startYear))) {\n startYear = startYear + 1 | 0;\n }var endYear = time.TimeUtil.asDateTimeUTC_14dthe$(end).year;\n var helper = new LinearBreaksHelper(startYear, endYear, count);\n tmp$ = helper.breaks.iterator();\n while (tmp$.hasNext()) {\n var tickYear = tmp$.next();\n var tickDate = time.TimeUtil.yearStart_za3lpa$(numberToInt(round(tickYear)));\n ticks.add_11rb$(time.TimeUtil.asInstantUTC_amwj4p$(tickDate).toNumber());\n }\n } else {\n var interval_0 = interval.NiceTimeInterval.forMillis_14dthe$(step);\n this.formatter = interval_0.tickFormatter;\n ticks = toMutableList(interval_0.range_lu1900$(start, end));\n }\n if (this.isReversed) {\n reverse(ticks);\n }this.breaks_n95hiz$_0 = ticks;\n }\n }\n Object.defineProperty(DateTimeBreaksHelper.prototype, 'breaks', {\n configurable: true,\n get: function () {\n return this.breaks_n95hiz$_0;\n }\n });\n DateTimeBreaksHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DateTimeBreaksHelper',\n interfaces: [BreaksHelperBase]\n };\n function LinearBreaksHelper(rangeStart, rangeEnd, count, precise) {\n LinearBreaksHelper$Companion_getInstance();\n if (precise === void 0)\n precise = false;\n BreaksHelperBase.call(this, rangeStart, rangeEnd, count);\n this.breaks_egvm9d$_0 = null;\n var tmp$, tmp$_0, tmp$_1;\n if (!(count > 0)) {\n var message = \"Can't compute breaks for count: \" + count;\n throw IllegalStateException_init(message.toString());\n }if (precise) {\n tmp$ = this.targetStep;\n } else {\n tmp$ = LinearBreaksHelper$Companion_getInstance().computeNiceStep_0(this.span, count);\n }\n var step = tmp$;\n if (precise) {\n var $receiver = until(0, count);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_2;\n tmp$_2 = $receiver.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination.add_11rb$(this.normalStart + step / 2 + item * step);\n }\n tmp$_0 = destination;\n } else {\n tmp$_0 = LinearBreaksHelper$Companion_getInstance().computeNiceBreaks_0(this.normalStart, this.normalEnd, step);\n }\n var breaks = tmp$_0;\n if (breaks.isEmpty()) {\n tmp$_1 = listOf_0(this.normalStart);\n } else if (this.isReversed) {\n tmp$_1 = asReversed(breaks);\n } else {\n tmp$_1 = breaks;\n }\n this.breaks_egvm9d$_0 = tmp$_1;\n }\n Object.defineProperty(LinearBreaksHelper.prototype, 'breaks', {\n configurable: true,\n get: function () {\n return this.breaks_egvm9d$_0;\n }\n });\n function LinearBreaksHelper$Companion() {\n LinearBreaksHelper$Companion_instance = this;\n }\n LinearBreaksHelper$Companion.prototype.computeNiceStep_0 = function (span, count) {\n var tmp$;\n var stepRaw = span / count;\n var x = JsMath.log10(stepRaw);\n var step10Power = JsMath.floor(x);\n var step = JsMath.pow(10.0, step10Power);\n var error = step * count / span;\n if (error <= 0.15)\n tmp$ = step * 10.0;\n else if (error <= 0.35)\n tmp$ = step * 5.0;\n else if (error <= 0.75)\n tmp$ = step * 2.0;\n else\n tmp$ = step;\n return tmp$;\n };\n LinearBreaksHelper$Companion.prototype.computeNiceBreaks_0 = function (start, end, step) {\n if (step === 0.0)\n return emptyList();\n var delta = step / 10000;\n var startE = start - delta;\n var endE = end + delta;\n var breaks = ArrayList_init();\n var x = startE / step;\n var tick = JsMath.ceil(x) * step;\n if (start >= 0 && startE < 0) {\n tick = 0.0;\n }while (tick <= endE) {\n var a = tick;\n tick = JsMath.min(a, end);\n breaks.add_11rb$(tick);\n tick += step;\n }\n return breaks;\n };\n LinearBreaksHelper$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LinearBreaksHelper$Companion_instance = null;\n function LinearBreaksHelper$Companion_getInstance() {\n if (LinearBreaksHelper$Companion_instance === null) {\n new LinearBreaksHelper$Companion();\n }return LinearBreaksHelper$Companion_instance;\n }\n LinearBreaksHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinearBreaksHelper',\n interfaces: [BreaksHelperBase]\n };\n function NumericBreakFormatter(value, step, allowMetricPrefix) {\n this.formatter_0 = null;\n var tmp$, tmp$_0, tmp$_1;\n if (value === 0.0) {\n tmp$ = kotlin_js_internal_DoubleCompanionObject.MIN_VALUE * 10;\n } else {\n tmp$ = JsMath.abs(value);\n }\n var value_0 = tmp$;\n if (step === 0.0) {\n tmp$_0 = value_0 / 10;\n } else {\n tmp$_0 = JsMath.abs(step);\n }\n var step_0 = tmp$_0;\n var type = 'f';\n var delimiter = '';\n var x = JsMath.abs(value_0);\n var domain10Power = JsMath.log10(x);\n var step10Power = JsMath.log10(step_0);\n var precision = -step10Power;\n var scientificNotation = false;\n if (domain10Power < 0 && step10Power < -4) {\n scientificNotation = true;\n type = 'e';\n precision = domain10Power - step10Power;\n } else if (domain10Power > 7 && step10Power > 2) {\n scientificNotation = true;\n precision = domain10Power - step10Power;\n }if (precision < 0) {\n precision = 0.0;\n type = 'd';\n }var x_0 = precision - 0.001;\n precision = JsMath.ceil(x_0);\n if (scientificNotation) {\n if (domain10Power > 0 && allowMetricPrefix) {\n tmp$_1 = 's';\n } else {\n tmp$_1 = 'e';\n }\n type = tmp$_1;\n } else {\n delimiter = ',';\n }\n this.formatter_0 = NumberFormat_init(delimiter + '.' + numberToInt(precision) + type);\n }\n NumericBreakFormatter.prototype.apply_za3rmp$ = function (value) {\n var tmp$;\n return this.formatter_0.apply_3p81yu$(Kotlin.isNumber(tmp$ = value) ? tmp$ : throwCCE());\n };\n NumericBreakFormatter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NumericBreakFormatter',\n interfaces: []\n };\n function QuantizeScale() {\n this.myHasDomain_0 = false;\n this.myDomainStart_0 = 0.0;\n this.myDomainEnd_0 = 0.0;\n this.myOutputValues_9bxfi2$_0 = this.myOutputValues_9bxfi2$_0;\n }\n Object.defineProperty(QuantizeScale.prototype, 'myOutputValues_0', {\n configurable: true,\n get: function () {\n if (this.myOutputValues_9bxfi2$_0 == null)\n return throwUPAE('myOutputValues');\n return this.myOutputValues_9bxfi2$_0;\n },\n set: function (myOutputValues) {\n this.myOutputValues_9bxfi2$_0 = myOutputValues;\n }\n });\n Object.defineProperty(QuantizeScale.prototype, 'outputValues', {\n configurable: true,\n get: function () {\n return this.myOutputValues_0;\n }\n });\n Object.defineProperty(QuantizeScale.prototype, 'domainQuantized', {\n configurable: true,\n get: function () {\n var tmp$;\n if (this.myDomainStart_0 === this.myDomainEnd_0) {\n return listOf_0(new ClosedRange(this.myDomainStart_0, this.myDomainEnd_0));\n }var list = ArrayList_init();\n var numBuckets = this.myOutputValues_0.size;\n var bucketSize = this.bucketSize_0();\n tmp$ = numBuckets - 1 | 0;\n for (var i = 0; i < tmp$; i++) {\n var bucket = new ClosedRange(this.myDomainStart_0 + bucketSize * i, this.myDomainStart_0 + bucketSize * (i + 1 | 0));\n list.add_11rb$(bucket);\n }\n var bucket_0 = new ClosedRange(this.myDomainStart_0 + bucketSize * (numBuckets - 1 | 0), this.myDomainEnd_0);\n list.add_11rb$(bucket_0);\n return list;\n }\n });\n QuantizeScale.prototype.domain_lu1900$ = function (start, end) {\n if (!(start <= end)) {\n var message = 'Domain start must be less then domain end: ' + start + ' > ' + end;\n throw IllegalArgumentException_init(message.toString());\n }this.myHasDomain_0 = true;\n this.myDomainStart_0 = start;\n this.myDomainEnd_0 = end;\n return this;\n };\n QuantizeScale.prototype.range_brywnq$ = function (values) {\n this.myOutputValues_0 = ArrayList_init_0(values);\n return this;\n };\n QuantizeScale.prototype.quantize_14dthe$ = function (v) {\n var i = this.outputIndex_0(v);\n return this.myOutputValues_0.get_za3lpa$(i);\n };\n QuantizeScale.prototype.outputIndex_0 = function (v) {\n if (!this.myHasDomain_0) {\n var message = 'Domain not defined.';\n throw IllegalStateException_init(message.toString());\n }var tmp$ = this.myOutputValues_9bxfi2$_0 != null;\n if (tmp$) {\n tmp$ = !this.myOutputValues_0.isEmpty();\n }if (!tmp$) {\n var message_0 = 'Output values are not defined.';\n throw IllegalStateException_init(message_0.toString());\n }var bucketSize = this.bucketSize_0();\n var index = numberToInt((v - this.myDomainStart_0) / bucketSize);\n var maxIndex = this.myOutputValues_0.size - 1 | 0;\n var b = JsMath.min(maxIndex, index);\n return JsMath.max(0, b);\n };\n QuantizeScale.prototype.getOutputValueIndex_za3rmp$ = function (domainValue) {\n var tmp$;\n if (Kotlin.isNumber(domainValue)) {\n tmp$ = this.outputIndex_0(numberToDouble(domainValue));\n } else\n tmp$ = -1;\n return tmp$;\n };\n QuantizeScale.prototype.getOutputValue_za3rmp$ = function (domainValue) {\n var tmp$;\n if (Kotlin.isNumber(domainValue)) {\n tmp$ = this.quantize_14dthe$(numberToDouble(domainValue));\n } else\n tmp$ = null;\n return tmp$;\n };\n QuantizeScale.prototype.bucketSize_0 = function () {\n return (this.myDomainEnd_0 - this.myDomainStart_0) / this.myOutputValues_0.size;\n };\n QuantizeScale.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'QuantizeScale',\n interfaces: [WithFiniteOrderedOutput]\n };\n function ScaleBreaksUtil() {\n ScaleBreaksUtil_instance = this;\n }\n ScaleBreaksUtil.prototype.withBreaks_qt1l9m$ = function (scale, transformedDomain, breakCount) {\n var scaleBreaks = scale.getBreaksGenerator().generateBreaks_1tlvto$(transformedDomain, breakCount);\n var breaks = scaleBreaks.domainValues;\n var labels = scaleBreaks.labels;\n return scale.with().breaks_pqjuzw$(breaks).labels_mhpeer$(labels).build();\n };\n ScaleBreaksUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ScaleBreaksUtil',\n interfaces: []\n };\n var ScaleBreaksUtil_instance = null;\n function ScaleBreaksUtil_getInstance() {\n if (ScaleBreaksUtil_instance === null) {\n new ScaleBreaksUtil();\n }return ScaleBreaksUtil_instance;\n }\n function TimeScaleTickFormatterFactory(minInterval) {\n this.minInterval_0 = minInterval;\n }\n TimeScaleTickFormatterFactory.prototype.getFormatter_14dthe$ = function (step) {\n return text.Formatter.time_61zpoe$(this.formatPattern_0(step));\n };\n TimeScaleTickFormatterFactory.prototype.formatPattern_0 = function (step) {\n if (step < 1000) {\n return TimeInterval.Companion.milliseconds_za3lpa$(1).tickFormatPattern;\n }if (this.minInterval_0 != null) {\n var stepCount = 100;\n var start = 0.0;\n var end = step * stepCount;\n var intervalCount = this.minInterval_0.range_lu1900$(start, end).size;\n if (stepCount >= intervalCount) {\n return this.minInterval_0.tickFormatPattern;\n }}if (step > YearInterval.Companion.MS) {\n return YearInterval.Companion.TICK_FORMAT;\n }var interval_0 = interval.NiceTimeInterval.forMillis_14dthe$(step);\n return interval_0.tickFormatPattern;\n };\n TimeScaleTickFormatterFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TimeScaleTickFormatterFactory',\n interfaces: []\n };\n function WithFiniteOrderedOutput() {\n }\n WithFiniteOrderedOutput.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'WithFiniteOrderedOutput',\n interfaces: []\n };\n function DateTimeBreaksGen(labelFormatter) {\n if (labelFormatter === void 0)\n labelFormatter = null;\n this.labelFormatter_0 = labelFormatter;\n }\n DateTimeBreaksGen.prototype.generateBreaks_1tlvto$ = function (domain, targetCount) {\n var tmp$, tmp$_0;\n var helper = this.breaksHelper_0(domain, targetCount);\n var ticks = helper.breaks;\n var labelFormatter = (tmp$ = this.labelFormatter_0) != null ? tmp$ : helper.formatter;\n var labels = ArrayList_init();\n tmp$_0 = ticks.iterator();\n while (tmp$_0.hasNext()) {\n var tick = tmp$_0.next();\n labels.add_11rb$(labelFormatter(tick));\n }\n return new ScaleBreaks(ticks, ticks, labels);\n };\n DateTimeBreaksGen.prototype.breaksHelper_0 = function (domainAfterTransform, targetCount) {\n return new DateTimeBreaksHelper(domainAfterTransform.lowerEnd, domainAfterTransform.upperEnd, targetCount);\n };\n DateTimeBreaksGen.prototype.labelFormatter_1tlvto$ = function (domain, targetCount) {\n var tmp$;\n return (tmp$ = this.labelFormatter_0) != null ? tmp$ : this.breaksHelper_0(domain, targetCount).formatter;\n };\n DateTimeBreaksGen.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DateTimeBreaksGen',\n interfaces: [BreaksGenerator]\n };\n function FunTransform(transformFun, inverseFun) {\n this.transformFun_vpw6mq$_0 = transformFun;\n this.inverseFun_2rsie$_0 = inverseFun;\n }\n FunTransform.prototype.apply_yrwdxb$ = function (v) {\n var tmp$;\n if (v != null) {\n tmp$ = this.transformFun_vpw6mq$_0(v);\n } else {\n tmp$ = null;\n }\n return tmp$;\n };\n FunTransform.prototype.apply_9ma18$ = function (l) {\n var $receiver = this.safeCastToDoubles_9ma18$(l);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(this.apply_yrwdxb$(item));\n }\n return destination;\n };\n FunTransform.prototype.applyInverse_yrwdxb$ = function (v) {\n var tmp$;\n if (v != null) {\n tmp$ = this.inverseFun_2rsie$_0(v);\n } else {\n tmp$ = null;\n }\n return tmp$;\n };\n FunTransform.prototype.applyInverse_k9kaly$ = function (l) {\n var destination = ArrayList_init_1(collectionSizeOrDefault(l, 10));\n var tmp$;\n tmp$ = l.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(this.applyInverse_yrwdxb$(item));\n }\n return destination;\n };\n FunTransform.prototype.safeCastToDoubles_9ma18$ = function (list) {\n var checkedDoubles = data.SeriesUtil.checkedDoubles_9ma18$(list);\n if (!checkedDoubles.canBeCast()) {\n var message = 'Not a collections of Double(s)';\n throw IllegalArgumentException_init(message.toString());\n }return checkedDoubles.cast();\n };\n FunTransform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FunTransform',\n interfaces: [ContinuousTransform]\n };\n function IdentityTransform() {\n FunTransform.call(this, IdentityTransform_init$lambda, IdentityTransform_init$lambda_0);\n }\n IdentityTransform.prototype.hasDomainLimits = function () {\n return false;\n };\n IdentityTransform.prototype.isInDomain_yrwdxb$ = function (v) {\n return data.SeriesUtil.isFinite_yrwdxb$(v);\n };\n IdentityTransform.prototype.createApplicableDomain_yrwdxb$$default = function (middle) {\n if (middle == null) {\n return this.createApplicableDomain_yrwdxb$(0.0);\n }var middle_0 = isFinite(middle) ? middle : 0.0;\n return new ClosedRange(middle_0 - 0.5, middle_0 + 0.5);\n };\n IdentityTransform.prototype.toApplicableDomain_4fzjta$ = function (range) {\n return range;\n };\n IdentityTransform.prototype.apply_9ma18$ = function (l) {\n return this.safeCastToDoubles_9ma18$(l);\n };\n IdentityTransform.prototype.applyInverse_k9kaly$ = function (l) {\n return l;\n };\n function IdentityTransform_init$lambda(v) {\n return v;\n }\n function IdentityTransform_init$lambda_0(v) {\n return v;\n }\n IdentityTransform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'IdentityTransform',\n interfaces: [FunTransform]\n };\n function LinearBreaksGen(formatter) {\n LinearBreaksGen$Companion_getInstance();\n if (formatter === void 0)\n formatter = null;\n this.formatter_0 = formatter;\n }\n LinearBreaksGen.prototype.generateBreaks_1tlvto$ = function (domain, targetCount) {\n var tmp$;\n var breaks = LinearBreaksGen$Companion_getInstance().generateBreakValues_omwdpb$(domain, targetCount);\n var fmt = (tmp$ = this.formatter_0) != null ? tmp$ : LinearBreaksGen$Companion_getInstance().createFormatter_0(breaks);\n var destination = ArrayList_init_1(collectionSizeOrDefault(breaks, 10));\n var tmp$_0;\n tmp$_0 = breaks.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(fmt(item));\n }\n var labels = destination;\n return new ScaleBreaks(breaks, breaks, labels);\n };\n LinearBreaksGen.prototype.labelFormatter_1tlvto$ = function (domain, targetCount) {\n var tmp$;\n return (tmp$ = this.formatter_0) != null ? tmp$ : LinearBreaksGen$Companion_getInstance().createFormatter_0(LinearBreaksGen$Companion_getInstance().generateBreakValues_omwdpb$(domain, targetCount));\n };\n function LinearBreaksGen$Companion() {\n LinearBreaksGen$Companion_instance = this;\n }\n LinearBreaksGen$Companion.prototype.generateBreakValues_omwdpb$ = function (domain, targetCount) {\n var helper = new LinearBreaksHelper(domain.lowerEnd, domain.upperEnd, targetCount);\n return helper.breaks;\n };\n LinearBreaksGen$Companion.prototype.createFormatter_0 = function (breakValues) {\n var tmp$, tmp$_0;\n if (breakValues.isEmpty())\n tmp$_0 = new Pair_0(0.0, 0.5);\n else {\n var x = first(breakValues);\n var tmp$_1 = JsMath.abs(x);\n var x_0 = last(breakValues);\n var b = JsMath.abs(x_0);\n var v = JsMath.max(tmp$_1, b);\n if (breakValues.size === 1)\n tmp$ = v / 10;\n else {\n var x_1 = breakValues.get_za3lpa$(1) - breakValues.get_za3lpa$(0);\n tmp$ = JsMath.abs(x_1);\n }\n var s = tmp$;\n tmp$_0 = new Pair_0(v, s);\n }\n var tmp$_2 = tmp$_0;\n var referenceValue = tmp$_2.component1()\n , step = tmp$_2.component2();\n var formatter = new NumericBreakFormatter(referenceValue, step, true);\n return getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_za3rmp$(p1);\n }.bind(null, formatter));\n };\n LinearBreaksGen$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LinearBreaksGen$Companion_instance = null;\n function LinearBreaksGen$Companion_getInstance() {\n if (LinearBreaksGen$Companion_instance === null) {\n new LinearBreaksGen$Companion();\n }return LinearBreaksGen$Companion_instance;\n }\n LinearBreaksGen.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinearBreaksGen',\n interfaces: [BreaksGenerator]\n };\n function Log10Transform() {\n Log10Transform$Companion_getInstance();\n FunTransform.call(this, Log10Transform_init$lambda, Log10Transform_init$lambda_0);\n }\n Log10Transform.prototype.hasDomainLimits = function () {\n return true;\n };\n Log10Transform.prototype.isInDomain_yrwdxb$ = function (v) {\n return data.SeriesUtil.isFinite_yrwdxb$(v) && ensureNotNull(v) >= Log10Transform$Companion_getInstance().LOWER_LIM_DOMAIN_8be2vx$;\n };\n Log10Transform.prototype.isZero_0 = function (v) {\n return data.SeriesUtil.isFinite_yrwdxb$(v) && ensureNotNull(v) >= 0.0 && v < Log10Transform$Companion_getInstance().LOWER_LIM_DOMAIN_8be2vx$;\n };\n Log10Transform.prototype.apply_yrwdxb$ = function (v) {\n return Log10Transform$Companion_getInstance().trimInfinity_0(FunTransform.prototype.apply_yrwdxb$.call(this, v));\n };\n Log10Transform.prototype.createApplicableDomain_yrwdxb$$default = function (middle) {\n var tmp$, tmp$_0;\n if (this.isInDomain_yrwdxb$(middle)) {\n var a = ensureNotNull(middle);\n var b = Log10Transform$Companion_getInstance().LOWER_LIM_DOMAIN_8be2vx$;\n tmp$ = JsMath.max(a, b);\n } else if (this.isZero_0(middle))\n tmp$ = Log10Transform$Companion_getInstance().LOWER_LIM_DOMAIN_8be2vx$;\n else\n tmp$ = 1.0;\n var middle_0 = tmp$;\n if (middle_0 < 1) {\n tmp$_0 = middle_0 / 2;\n } else {\n tmp$_0 = middle_0 - 0.5;\n }\n var lower = tmp$_0;\n var b_0 = Log10Transform$Companion_getInstance().LOWER_LIM_DOMAIN_8be2vx$;\n return new ClosedRange(JsMath.max(lower, b_0), middle_0 + 0.5);\n };\n Log10Transform.prototype.toApplicableDomain_4fzjta$ = function (range) {\n var a = range.lowerEnd;\n var b = Log10Transform$Companion_getInstance().LOWER_LIM_DOMAIN_8be2vx$;\n var lower = JsMath.max(a, b);\n var a_0 = range.upperEnd;\n var upper = JsMath.max(a_0, lower);\n return new ClosedRange(lower, upper);\n };\n function Log10Transform$Companion() {\n Log10Transform$Companion_instance = this;\n this.LOWER_LIM_TRANSFOTMED_8be2vx$ = -kotlin_js_internal_DoubleCompanionObject.MAX_VALUE / 10;\n this.LOWER_LIM_DOMAIN_8be2vx$ = kotlin_js_internal_DoubleCompanionObject.MIN_VALUE * 10;\n }\n Log10Transform$Companion.prototype.trimInfinity_0 = function (v) {\n var tmp$;\n if (v == null)\n tmp$ = null;\n else if (isNaN_0(v))\n tmp$ = kotlin_js_internal_DoubleCompanionObject.NaN;\n else {\n var a = this.LOWER_LIM_TRANSFOTMED_8be2vx$;\n tmp$ = JsMath.max(a, v);\n }\n return tmp$;\n };\n Log10Transform$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Log10Transform$Companion_instance = null;\n function Log10Transform$Companion_getInstance() {\n if (Log10Transform$Companion_instance === null) {\n new Log10Transform$Companion();\n }return Log10Transform$Companion_instance;\n }\n function Log10Transform_init$lambda(v) {\n return JsMath.log10(v);\n }\n function Log10Transform_init$lambda_0(v) {\n return JsMath.pow(10.0, v);\n }\n Log10Transform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Log10Transform',\n interfaces: [FunTransform]\n };\n function NonlinearBreaksGen(transform, formatter) {\n NonlinearBreaksGen$Companion_getInstance();\n if (formatter === void 0)\n formatter = null;\n this.transform_0 = transform;\n this.formatter_0 = formatter;\n }\n NonlinearBreaksGen.prototype.generateBreaks_1tlvto$ = function (domain, targetCount) {\n var tmp$;\n var breakValues = NonlinearBreaksGen$Companion_getInstance().generateBreakValues_0(domain, targetCount, this.transform_0);\n if (this.formatter_0 != null) {\n var size = breakValues.size;\n var list = ArrayList_init_1(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(this.formatter_0);\n }\n tmp$ = list;\n } else {\n tmp$ = NonlinearBreaksGen$Companion_getInstance().createFormatters_0(breakValues);\n }\n var breakFormatters = tmp$;\n var destination = ArrayList_init_1(collectionSizeOrDefault(breakValues, 10));\n var tmp$_0, tmp$_0_0;\n var index_0 = 0;\n tmp$_0 = breakValues.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(breakFormatters.get_za3lpa$(checkIndexOverflow((tmp$_0_0 = index_0, index_0 = tmp$_0_0 + 1 | 0, tmp$_0_0)))(item));\n }\n var labels = destination;\n return new ScaleBreaks(breakValues, breakValues, labels);\n };\n NonlinearBreaksGen.prototype.labelFormatter_1tlvto$ = function (domain, targetCount) {\n var tmp$;\n return (tmp$ = this.formatter_0) != null ? tmp$ : NonlinearBreaksGen$Companion_getInstance().createMultiFormatter_0(NonlinearBreaksGen$Companion_getInstance().generateBreakValues_0(domain, targetCount, this.transform_0));\n };\n function NonlinearBreaksGen$Companion() {\n NonlinearBreaksGen$Companion_instance = this;\n }\n function NonlinearBreaksGen$Companion$generateBreakValues$lambda(closure$transform) {\n return function (it) {\n return closure$transform.apply_yrwdxb$(it);\n };\n }\n NonlinearBreaksGen$Companion.prototype.generateBreakValues_0 = function (domain, targetCount, transform) {\n var transformedDomain = MapperUtil_getInstance().map_rejkqi$(domain, NonlinearBreaksGen$Companion$generateBreakValues$lambda(transform));\n var transformedBreakValues = LinearBreaksGen$Companion_getInstance().generateBreakValues_omwdpb$(transformedDomain, targetCount);\n return filterNotNull(transform.applyInverse_k9kaly$(transformedBreakValues));\n };\n NonlinearBreaksGen$Companion.prototype.createMultiFormatter_0 = function (breakValues) {\n var breakFormatters = this.createFormatters_0(breakValues);\n return getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_za3rmp$(p1);\n }.bind(null, new NonlinearBreaksGen$MultiFormatter(breakValues, breakFormatters)));\n };\n NonlinearBreaksGen$Companion.prototype.createFormatters_0 = function (breakValues) {\n if (breakValues.isEmpty())\n return emptyList();\n if (breakValues.size === 1) {\n var domainValue = breakValues.get_za3lpa$(0);\n var step = domainValue / 10;\n return listOf_0(this.createFormatter_0(domainValue, step));\n }var destination = ArrayList_init_1(collectionSizeOrDefault(breakValues, 10));\n var tmp$, tmp$_0;\n var index = 0;\n tmp$ = breakValues.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_1 = destination.add_11rb$;\n var i = checkIndexOverflow((tmp$_0 = index, index = tmp$_0 + 1 | 0, tmp$_0));\n var tmp$_2;\n if (i === 0)\n tmp$_2 = item - breakValues.get_za3lpa$(i + 1 | 0);\n else\n tmp$_2 = item - breakValues.get_za3lpa$(i - 1 | 0);\n var x = tmp$_2;\n var step_0 = JsMath.abs(x);\n tmp$_1.call(destination, this.createFormatter_0(item, step_0));\n }\n var formatters = destination;\n return formatters;\n };\n NonlinearBreaksGen$Companion.prototype.createFormatter_0 = function (domainValue, step) {\n return getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_za3rmp$(p1);\n }.bind(null, new NumericBreakFormatter(domainValue, step, true)));\n };\n NonlinearBreaksGen$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var NonlinearBreaksGen$Companion_instance = null;\n function NonlinearBreaksGen$Companion_getInstance() {\n if (NonlinearBreaksGen$Companion_instance === null) {\n new NonlinearBreaksGen$Companion();\n }return NonlinearBreaksGen$Companion_instance;\n }\n function NonlinearBreaksGen$MultiFormatter(breakValues, breakFormatters) {\n this.breakValues = breakValues;\n this.breakFormatters = breakFormatters;\n if (!(this.breakValues.size === this.breakFormatters.size)) {\n var message = 'MultiFormatter: breakValues.size=' + this.breakValues.size + ' but breakFormatters.size=' + this.breakFormatters.size;\n throw IllegalStateException_init(message.toString());\n }if (this.breakValues.size > 1) {\n var $receiver = this.breakValues;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$, tmp$_0;\n var index = 0;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_1 = destination.add_11rb$;\n var i = checkIndexOverflow((tmp$_0 = index, index = tmp$_0 + 1 | 0, tmp$_0));\n tmp$_1.call(destination, i === 0 ? 0.0 : item - this.breakValues.get_za3lpa$(i - 1 | 0));\n }\n var all$result;\n all$break: do {\n var tmp$_2;\n if (Kotlin.isType(destination, Collection) && destination.isEmpty()) {\n all$result = true;\n break all$break;\n }tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var element = tmp$_2.next();\n if (!(element >= 0.0)) {\n all$result = false;\n break all$break;\n }}\n all$result = true;\n }\n while (false);\n var ordered = all$result;\n if (!ordered) {\n var message_0 = 'MultiFormatter: values must be sorted in ascending order. Were: ' + this.breakValues + '.';\n throw IllegalStateException_init(message_0.toString());\n }}}\n NonlinearBreaksGen$MultiFormatter.prototype.apply_za3rmp$ = function (v) {\n var tmp$, tmp$_0;\n typeof (tmp$ = v) === 'number' ? tmp$ : throwCCE();\n if (this.breakValues.isEmpty())\n tmp$_0 = v.toString();\n else {\n var i = abs(binarySearch(this.breakValues, v));\n var b = this.breakValues.size - 1 | 0;\n var ii = JsMath.min(i, b);\n tmp$_0 = this.breakFormatters.get_za3lpa$(ii)(v);\n }\n return tmp$_0;\n };\n NonlinearBreaksGen$MultiFormatter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiFormatter',\n interfaces: []\n };\n NonlinearBreaksGen.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NonlinearBreaksGen',\n interfaces: [BreaksGenerator]\n };\n function ReverseTransform() {\n FunTransform.call(this, ReverseTransform_init$lambda, ReverseTransform_init$lambda_0);\n }\n ReverseTransform.prototype.hasDomainLimits = function () {\n return false;\n };\n ReverseTransform.prototype.isInDomain_yrwdxb$ = function (v) {\n return data.SeriesUtil.isFinite_yrwdxb$(v);\n };\n ReverseTransform.prototype.createApplicableDomain_yrwdxb$$default = function (middle) {\n return Transforms_getInstance().IDENTITY.createApplicableDomain_yrwdxb$(middle);\n };\n ReverseTransform.prototype.toApplicableDomain_4fzjta$ = function (range) {\n return Transforms_getInstance().IDENTITY.toApplicableDomain_4fzjta$(range);\n };\n function ReverseTransform_init$lambda(v) {\n return -v;\n }\n function ReverseTransform_init$lambda_0(v) {\n return -v;\n }\n ReverseTransform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ReverseTransform',\n interfaces: [FunTransform]\n };\n function SqrtTransform() {\n FunTransform.call(this, SqrtTransform_init$lambda, SqrtTransform_init$lambda_0);\n }\n SqrtTransform.prototype.hasDomainLimits = function () {\n return true;\n };\n SqrtTransform.prototype.isInDomain_yrwdxb$ = function (v) {\n return data.SeriesUtil.isFinite_yrwdxb$(v) && ensureNotNull(v) >= 0.0;\n };\n SqrtTransform.prototype.createApplicableDomain_yrwdxb$$default = function (middle) {\n var tmp$;\n if (this.isInDomain_yrwdxb$(middle)) {\n var a = ensureNotNull(middle);\n tmp$ = JsMath.max(a, 0.0);\n } else\n tmp$ = 1.0;\n var middle_0 = tmp$;\n var a_0 = middle_0 - 0.5;\n return new ClosedRange(JsMath.max(a_0, 0.0), middle_0 + 0.5);\n };\n SqrtTransform.prototype.toApplicableDomain_4fzjta$ = function (range) {\n var a = range.lowerEnd;\n var lower = JsMath.max(a, 0.0);\n var a_0 = range.upperEnd;\n var upper = JsMath.max(a_0, 0.0);\n return new ClosedRange(lower, upper);\n };\n function SqrtTransform_init$lambda(v) {\n return JsMath.sqrt(v);\n }\n function SqrtTransform_init$lambda_0(v) {\n return v * v;\n }\n SqrtTransform.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SqrtTransform',\n interfaces: [FunTransform]\n };\n function Transforms() {\n Transforms_instance = this;\n this.IDENTITY = new IdentityTransform();\n this.REVERSE = new ReverseTransform();\n this.SQRT = new SqrtTransform();\n this.LOG10 = new Log10Transform();\n }\n Transforms.prototype.createBreaksGeneratorForTransformedDomain_5x42z5$ = function (transform, labelFormatter) {\n if (labelFormatter === void 0)\n labelFormatter = null;\n var tmp$;\n if (equals(transform, this.IDENTITY))\n tmp$ = new LinearBreaksGen(labelFormatter);\n else if (equals(transform, this.REVERSE))\n tmp$ = new LinearBreaksGen(labelFormatter);\n else if (equals(transform, this.SQRT))\n tmp$ = new NonlinearBreaksGen(this.SQRT, labelFormatter);\n else if (equals(transform, this.LOG10))\n tmp$ = new NonlinearBreaksGen(this.LOG10, labelFormatter);\n else\n throw IllegalStateException_init(\"Unexpected 'transform' type: \" + toString(Kotlin.getKClassFromExpression(transform).simpleName));\n var breaksGenerator = tmp$;\n return new Transforms$BreaksGeneratorForTransformedDomain(transform, breaksGenerator);\n };\n Transforms.prototype.ensureApplicableDomain_wa8y5m$ = function (dataRange, transform) {\n var tmp$;\n if (dataRange == null) {\n return transform.createApplicableDomain_yrwdxb$();\n }var domain = transform.toApplicableDomain_4fzjta$(dataRange);\n if (data.SeriesUtil.isSubTiny_4fzjta$(domain))\n tmp$ = transform.createApplicableDomain_yrwdxb$(domain.upperEnd);\n else\n tmp$ = domain;\n return tmp$;\n };\n function Transforms$BreaksGeneratorForTransformedDomain(transform, breaksGenerator) {\n this.transform_0 = transform;\n this.breaksGenerator = breaksGenerator;\n }\n function Transforms$BreaksGeneratorForTransformedDomain$labelFormatter$lambda(this$BreaksGeneratorForTransformedDomain) {\n return function (it) {\n return this$BreaksGeneratorForTransformedDomain.transform_0.applyInverse_yrwdxb$(it);\n };\n }\n Transforms$BreaksGeneratorForTransformedDomain.prototype.labelFormatter_1tlvto$ = function (domain, targetCount) {\n var domainBeforeTransform = MapperUtil_getInstance().map_rejkqi$(domain, Transforms$BreaksGeneratorForTransformedDomain$labelFormatter$lambda(this));\n return this.breaksGenerator.labelFormatter_1tlvto$(domainBeforeTransform, targetCount);\n };\n function Transforms$BreaksGeneratorForTransformedDomain$generateBreaks$lambda(this$BreaksGeneratorForTransformedDomain) {\n return function (it) {\n return this$BreaksGeneratorForTransformedDomain.transform_0.applyInverse_yrwdxb$(it);\n };\n }\n Transforms$BreaksGeneratorForTransformedDomain.prototype.generateBreaks_1tlvto$ = function (domain, targetCount) {\n var domainBeforeTransform = MapperUtil_getInstance().map_rejkqi$(domain, Transforms$BreaksGeneratorForTransformedDomain$generateBreaks$lambda(this));\n var scaleBreaks = this.breaksGenerator.generateBreaks_1tlvto$(domainBeforeTransform, targetCount);\n var originalBreaks = scaleBreaks.domainValues;\n var $receiver = this.transform_0.apply_9ma18$(originalBreaks);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_0;\n destination.add_11rb$(typeof (tmp$_0 = item) === 'number' ? tmp$_0 : throwCCE());\n }\n var transformedBreaks = destination;\n return new ScaleBreaks(originalBreaks, transformedBreaks, scaleBreaks.labels);\n };\n Transforms$BreaksGeneratorForTransformedDomain.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BreaksGeneratorForTransformedDomain',\n interfaces: [BreaksGenerator]\n };\n Transforms.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Transforms',\n interfaces: []\n };\n var Transforms_instance = null;\n function Transforms_getInstance() {\n if (Transforms_instance === null) {\n new Transforms();\n }return Transforms_instance;\n }\n function AbstractDensity2dStat(bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth) {\n AbstractDensity2dStat$Companion_getInstance();\n BaseStat.call(this, AbstractDensity2dStat$Companion_getInstance().DEF_MAPPING_0);\n this.bandWidthX_pmqi0t$_0 = bandWidthX;\n this.bandWidthY_pmqi1o$_0 = bandWidthY;\n this.bandWidthMethod_3lcf4y$_0 = bandWidthMethod;\n this.adjust = adjust;\n this.kernel_ba223r$_0 = kernel;\n this.nX = nX;\n this.nY = nY;\n this.isContour = isContour;\n this.binCount_6z2ebo$_0 = binCount;\n this.binWidth_2e8jdx$_0 = binWidth;\n this.kernelFun = DensityStatUtil_getInstance().kernel_uyf859$(this.kernel_ba223r$_0);\n this.binOptions = new BinStatUtil$BinOptions(this.binCount_6z2ebo$_0, this.binWidth_2e8jdx$_0);\n if (!(this.nX <= 999)) {\n var message = 'The input nX = ' + this.nX + ' > ' + '999' + ' is too large!';\n throw IllegalArgumentException_init(message.toString());\n }if (!(this.nY <= 999)) {\n var message_0 = 'The input nY = ' + this.nY + ' > ' + '999' + ' is too large!';\n throw IllegalArgumentException_init(message_0.toString());\n }}\n AbstractDensity2dStat.prototype.getBandWidthX_k9kaly$ = function (xs) {\n var tmp$;\n return (tmp$ = this.bandWidthX_pmqi0t$_0) != null ? tmp$ : DensityStatUtil_getInstance().bandWidth_whucba$(this.bandWidthMethod_3lcf4y$_0, xs);\n };\n AbstractDensity2dStat.prototype.getBandWidthY_k9kaly$ = function (ys) {\n var tmp$;\n return (tmp$ = this.bandWidthY_pmqi1o$_0) != null ? tmp$ : DensityStatUtil_getInstance().bandWidth_whucba$(this.bandWidthMethod_3lcf4y$_0, ys);\n };\n AbstractDensity2dStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().WEIGHT]);\n };\n AbstractDensity2dStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n throw IllegalStateException_init(\"'density2d' statistic can't be executed on the client side\");\n };\n function AbstractDensity2dStat$Companion() {\n AbstractDensity2dStat$Companion_instance = this;\n this.DEF_KERNEL = DensityStat$Kernel$GAUSSIAN_getInstance();\n this.DEF_ADJUST = 1.0;\n this.DEF_N = 100;\n this.DEF_BW = DensityStat$BandWidthMethod$NRD0_getInstance();\n this.DEF_CONTOUR = true;\n this.DEF_BIN_COUNT = 10;\n this.DEF_BIN_WIDTH = 0.0;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y)]);\n this.MAX_N_0 = 999;\n }\n AbstractDensity2dStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AbstractDensity2dStat$Companion_instance = null;\n function AbstractDensity2dStat$Companion_getInstance() {\n if (AbstractDensity2dStat$Companion_instance === null) {\n new AbstractDensity2dStat$Companion();\n }return AbstractDensity2dStat$Companion_instance;\n }\n AbstractDensity2dStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractDensity2dStat',\n interfaces: [BaseStat]\n };\n function BaseStat(defaultMappings) {\n this.defaultMappings_lvkmi1$_0 = defaultMappings;\n }\n BaseStat.prototype.hasDefaultMapping_896ixz$ = function (aes) {\n return this.defaultMappings_lvkmi1$_0.containsKey_11rb$(aes);\n };\n BaseStat.prototype.getDefaultMapping_896ixz$ = function (aes) {\n if (this.defaultMappings_lvkmi1$_0.containsKey_11rb$(aes)) {\n return ensureNotNull(this.defaultMappings_lvkmi1$_0.get_11rb$(aes));\n }throw IllegalArgumentException_init('Stat ' + Kotlin.getKClassFromExpression(this).simpleName + ' has no default mapping for aes: ' + toString(aes));\n };\n BaseStat.prototype.hasRequiredValues_xht41f$ = function (data, aes) {\n var tmp$;\n for (tmp$ = 0; tmp$ !== aes.length; ++tmp$) {\n var requiredAes = aes[tmp$];\n var variable = TransformVar_getInstance().forAes_896ixz$(requiredAes);\n if (data.hasNoOrEmpty_8xm3sj$(variable)) {\n return false;\n }}\n return true;\n };\n BaseStat.prototype.withEmptyStatValues = function () {\n var tmp$;\n var newData = DataFrame$DataFrame$Builder_init();\n tmp$ = Aes$Companion_getInstance().values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n if (this.hasDefaultMapping_896ixz$(aes)) {\n newData.put_2l962d$(this.getDefaultMapping_896ixz$(aes), emptyList());\n }}\n return newData.build();\n };\n BaseStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BaseStat',\n interfaces: [Stat]\n };\n function Bin2dStat(binCountX, binCountY, binWidthX, binWidthY, drop) {\n Bin2dStat$Companion_getInstance();\n if (binCountX === void 0)\n binCountX = 30;\n if (binCountY === void 0)\n binCountY = 30;\n if (binWidthX === void 0)\n binWidthX = Bin2dStat$Companion_getInstance().DEF_BINWIDTH;\n if (binWidthY === void 0)\n binWidthY = Bin2dStat$Companion_getInstance().DEF_BINWIDTH;\n if (drop === void 0)\n drop = Bin2dStat$Companion_getInstance().DEF_DROP;\n BaseStat.call(this, Bin2dStat$Companion_getInstance().DEF_MAPPING_0);\n this.drop_0 = drop;\n this.binOptionsX_0 = new BinStatUtil$BinOptions(binCountX, binWidthX);\n this.binOptionsY_0 = new BinStatUtil$BinOptions(binCountY, binWidthY);\n }\n Bin2dStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().WEIGHT]);\n };\n Bin2dStat.prototype.apply_kdy6bf$$default = function (data_0, statCtx, messageConsumer) {\n if (!this.hasRequiredValues_xht41f$(data_0, [Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y])) {\n return this.withEmptyStatValues();\n }var xRange = statCtx.overallXRange();\n var yRange = statCtx.overallYRange();\n if (xRange == null || yRange == null) {\n return this.withEmptyStatValues();\n }var xRangeInit = Bin2dStat$Companion_getInstance().adjustRangeInitial_0(xRange);\n var yRangeInit = Bin2dStat$Companion_getInstance().adjustRangeInitial_0(yRange);\n var xCountAndWidthInit = BinStatUtil_getInstance().binCountAndWidth_11nzti$(data.SeriesUtil.span_4fzjta$(xRangeInit), this.binOptionsX_0);\n var yCountAndWidthInit = BinStatUtil_getInstance().binCountAndWidth_11nzti$(data.SeriesUtil.span_4fzjta$(yRangeInit), this.binOptionsY_0);\n var xRangeFinal = Bin2dStat$Companion_getInstance().adjustRangeFinal_0(xRange, xCountAndWidthInit.width);\n var yRangeFinal = Bin2dStat$Companion_getInstance().adjustRangeFinal_0(yRange, yCountAndWidthInit.width);\n var xCountAndWidthFinal = BinStatUtil_getInstance().binCountAndWidth_11nzti$(data.SeriesUtil.span_4fzjta$(xRangeFinal), this.binOptionsX_0);\n var yCountAndWidthFinal = BinStatUtil_getInstance().binCountAndWidth_11nzti$(data.SeriesUtil.span_4fzjta$(yRangeFinal), this.binOptionsY_0);\n var countTotal = Kotlin.imul(xCountAndWidthFinal.count, yCountAndWidthFinal.count);\n var densityNormalizingFactor = Bin2dStat$Companion_getInstance().densityNormalizingFactor_0(data.SeriesUtil.span_4fzjta$(xRangeFinal), data.SeriesUtil.span_4fzjta$(yRangeFinal), countTotal);\n var binsData = this.computeBins_0(data_0.getNumeric_8xm3sj$(TransformVar_getInstance().X), data_0.getNumeric_8xm3sj$(TransformVar_getInstance().Y), xRangeFinal.lowerEnd, yRangeFinal.lowerEnd, xCountAndWidthFinal.count, yCountAndWidthFinal.count, xCountAndWidthFinal.width, yCountAndWidthFinal.width, BinStatUtil_getInstance().weightAtIndex_dhhkv7$(data_0), densityNormalizingFactor);\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, binsData.x_8be2vx$).putNumeric_s1rqo9$(Stats_getInstance().Y, binsData.y_8be2vx$).putNumeric_s1rqo9$(Stats_getInstance().COUNT, binsData.count_8be2vx$).putNumeric_s1rqo9$(Stats_getInstance().DENSITY, binsData.density_8be2vx$).build();\n };\n Bin2dStat.prototype.computeBins_0 = function (xValues, yValues, xStart, yStart, binCountX, binCountY, binWidth, binHeight, weightAtIndex, densityNormalizingFactor) {\n var totalCount = 0.0;\n var countByBinIndexKey = HashMap_init();\n for (var dataIndex = 0; dataIndex !== xValues.size; ++dataIndex) {\n var x = xValues.get_za3lpa$(dataIndex);\n var y = yValues.get_za3lpa$(dataIndex);\n if (!data.SeriesUtil.allFinite_jma9l8$(x, y)) {\n continue;\n }var weight = weightAtIndex(dataIndex);\n totalCount += weight;\n var x_0 = (ensureNotNull(x) - xStart) / binWidth;\n var binIndexX = numberToInt(JsMath.floor(x_0));\n var x_1 = (ensureNotNull(y) - yStart) / binHeight;\n var binIndexY = numberToInt(JsMath.floor(x_1));\n var binIndexKey = new Pair_0(binIndexX, binIndexY);\n if (!countByBinIndexKey.containsKey_11rb$(binIndexKey)) {\n var value = new MutableDouble(0.0);\n countByBinIndexKey.put_xwzc9p$(binIndexKey, value);\n }ensureNotNull(countByBinIndexKey.get_11rb$(binIndexKey)).getAndAdd_14dthe$(weight);\n }\n var xs = ArrayList_init();\n var ys = ArrayList_init();\n var counts = ArrayList_init();\n var densities = ArrayList_init();\n var x0 = xStart + binWidth / 2;\n var y0 = yStart + binHeight / 2;\n for (var xIndex = 0; xIndex < binCountX; xIndex++) {\n for (var yIndex = 0; yIndex < binCountY; yIndex++) {\n var binIndexKey_0 = new Pair_0(xIndex, yIndex);\n var count = 0.0;\n if (countByBinIndexKey.containsKey_11rb$(binIndexKey_0)) {\n count = ensureNotNull(countByBinIndexKey.get_11rb$(binIndexKey_0)).get();\n }if (this.drop_0 && count === 0.0) {\n continue;\n }xs.add_11rb$(x0 + xIndex * binWidth);\n ys.add_11rb$(y0 + yIndex * binHeight);\n counts.add_11rb$(count);\n var density = count / totalCount * densityNormalizingFactor;\n densities.add_11rb$(density);\n }\n }\n return new Bin2dStat$Bins2dData(xs, ys, counts, densities);\n };\n function Bin2dStat$Companion() {\n Bin2dStat$Companion_instance = this;\n this.DEF_BINS = 30;\n this.DEF_BINWIDTH = null;\n this.DEF_DROP = true;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y), to(Aes$Companion_getInstance().FILL, Stats_getInstance().COUNT)]);\n }\n Bin2dStat$Companion.prototype.adjustRangeInitial_0 = function (r) {\n return data.SeriesUtil.ensureApplicableRange_4am1sd$(r);\n };\n Bin2dStat$Companion.prototype.adjustRangeFinal_0 = function (r, binWidth) {\n var tmp$;\n if (data.SeriesUtil.isSubTiny_4fzjta$(r)) {\n tmp$ = data.SeriesUtil.expand_wws5xy$(r, 0.5, 0.5);\n } else {\n var exp = binWidth / 2.0;\n tmp$ = data.SeriesUtil.expand_wws5xy$(r, exp, exp);\n }\n return tmp$;\n };\n Bin2dStat$Companion.prototype.densityNormalizingFactor_0 = function (xSpan, ySpan, count) {\n var area = xSpan * ySpan;\n var binArea = area / count;\n return 1.0 / binArea;\n };\n Bin2dStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Bin2dStat$Companion_instance = null;\n function Bin2dStat$Companion_getInstance() {\n if (Bin2dStat$Companion_instance === null) {\n new Bin2dStat$Companion();\n }return Bin2dStat$Companion_instance;\n }\n function Bin2dStat$Bins2dData(x, y, count, density) {\n this.x_8be2vx$ = x;\n this.y_8be2vx$ = y;\n this.count_8be2vx$ = count;\n this.density_8be2vx$ = density;\n }\n Bin2dStat$Bins2dData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Bins2dData',\n interfaces: []\n };\n function Bin2dStat$Bins2dWeightedCounts(total, countByBinXY) {\n this.total_8be2vx$ = total;\n this.countByBinXY_8be2vx$ = countByBinXY;\n }\n Bin2dStat$Bins2dWeightedCounts.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Bins2dWeightedCounts',\n interfaces: []\n };\n Bin2dStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Bin2dStat',\n interfaces: [BaseStat]\n };\n function BinStat(binCount, binWidth, xPosKind, xPos) {\n BinStat$Companion_getInstance();\n BaseStat.call(this, BinStat$Companion_getInstance().DEF_MAPPING_0);\n this.xPosKind_0 = xPosKind;\n this.xPos_0 = xPos;\n this.binOptions_0 = new BinStatUtil$BinOptions(binCount, binWidth);\n }\n BinStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().WEIGHT]);\n };\n BinStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n if (!this.hasRequiredValues_xht41f$(data, [Aes$Companion_getInstance().X])) {\n return this.withEmptyStatValues();\n }var statX = ArrayList_init();\n var statCount = ArrayList_init();\n var statDensity = ArrayList_init();\n var rangeX = statCtx.overallXRange();\n if (rangeX != null) {\n var binsData = this.computeStatSeries_0(data, rangeX, data.getNumeric_8xm3sj$(TransformVar_getInstance().X));\n statX.addAll_brywnq$(binsData.x_8be2vx$);\n statCount.addAll_brywnq$(binsData.count_8be2vx$);\n statDensity.addAll_brywnq$(binsData.density_8be2vx$);\n }return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().COUNT, statCount).putNumeric_s1rqo9$(Stats_getInstance().DENSITY, statDensity).build();\n };\n BinStat.prototype.computeStatSeries_0 = function (data_0, rangeX, valuesX) {\n var startX = rangeX.lowerEnd;\n var spanX = rangeX.upperEnd - ensureNotNull(startX);\n var b = BinStatUtil_getInstance().binCountAndWidth_11nzti$(spanX, this.binOptions_0);\n startX -= b.width * 0.7;\n spanX += b.width * 1.4;\n b = BinStatUtil_getInstance().binCountAndWidth_11nzti$(spanX, this.binOptions_0);\n var binCount = b.count;\n var binWidth = b.width;\n if (this.xPosKind_0 !== BinStat$XPosKind$NONE_getInstance()) {\n var minDelta = kotlin_js_internal_DoubleCompanionObject.MAX_VALUE;\n var x = this.xPos_0;\n for (var i = 0; i < binCount; i++) {\n var binLeft = startX + i * binWidth;\n var delta;\n if (this.xPosKind_0 === BinStat$XPosKind$CENTER_getInstance()) {\n delta = x - (binLeft + binWidth / 2);\n } else {\n if (i === 0) {\n minDelta = x - startX;\n }delta = x - (binLeft + binWidth);\n }\n var x_0 = delta;\n var tmp$ = JsMath.abs(x_0);\n var x_1 = minDelta;\n if (tmp$ < JsMath.abs(x_1)) {\n minDelta = delta;\n }}\n var offset = minDelta % (binWidth / 2);\n startX += offset;\n }var normalBinWidth = data.SeriesUtil.span_4fzjta$(rangeX) / binCount;\n var densityNormalizingFactor = normalBinWidth > 0 ? 1.0 / normalBinWidth : 1.0;\n var binsData = BinStatUtil_getInstance().computeBins_3oz8yg$(valuesX, startX, binCount, binWidth, BinStatUtil_getInstance().weightAtIndex_dhhkv7$(data_0), densityNormalizingFactor);\n if (!(binsData.x_8be2vx$.size === binCount)) {\n var message = 'Internal: stat data size=' + toString(binsData.x_8be2vx$.size) + ' expected bin count=' + toString(binCount);\n throw IllegalStateException_init(message.toString());\n }return binsData;\n };\n function BinStat$XPosKind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function BinStat$XPosKind_initFields() {\n BinStat$XPosKind_initFields = function () {\n };\n BinStat$XPosKind$NONE_instance = new BinStat$XPosKind('NONE', 0);\n BinStat$XPosKind$CENTER_instance = new BinStat$XPosKind('CENTER', 1);\n BinStat$XPosKind$BOUNDARY_instance = new BinStat$XPosKind('BOUNDARY', 2);\n }\n var BinStat$XPosKind$NONE_instance;\n function BinStat$XPosKind$NONE_getInstance() {\n BinStat$XPosKind_initFields();\n return BinStat$XPosKind$NONE_instance;\n }\n var BinStat$XPosKind$CENTER_instance;\n function BinStat$XPosKind$CENTER_getInstance() {\n BinStat$XPosKind_initFields();\n return BinStat$XPosKind$CENTER_instance;\n }\n var BinStat$XPosKind$BOUNDARY_instance;\n function BinStat$XPosKind$BOUNDARY_getInstance() {\n BinStat$XPosKind_initFields();\n return BinStat$XPosKind$BOUNDARY_instance;\n }\n BinStat$XPosKind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'XPosKind',\n interfaces: [Enum]\n };\n function BinStat$XPosKind$values() {\n return [BinStat$XPosKind$NONE_getInstance(), BinStat$XPosKind$CENTER_getInstance(), BinStat$XPosKind$BOUNDARY_getInstance()];\n }\n BinStat$XPosKind.values = BinStat$XPosKind$values;\n function BinStat$XPosKind$valueOf(name) {\n switch (name) {\n case 'NONE':\n return BinStat$XPosKind$NONE_getInstance();\n case 'CENTER':\n return BinStat$XPosKind$CENTER_getInstance();\n case 'BOUNDARY':\n return BinStat$XPosKind$BOUNDARY_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.BinStat.XPosKind.' + name);\n }\n }\n BinStat$XPosKind.valueOf_61zpoe$ = BinStat$XPosKind$valueOf;\n function BinStat$Companion() {\n BinStat$Companion_instance = this;\n this.DEF_BIN_COUNT = 30;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().COUNT)]);\n }\n BinStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BinStat$Companion_instance = null;\n function BinStat$Companion_getInstance() {\n if (BinStat$Companion_instance === null) {\n new BinStat$Companion();\n }return BinStat$Companion_instance;\n }\n BinStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BinStat',\n interfaces: [BaseStat]\n };\n function BinStatUtil() {\n BinStatUtil_instance = this;\n this.MAX_BIN_COUNT_0 = 500;\n }\n function BinStatUtil$weightAtIndex$lambda(closure$weights) {\n return function (index) {\n var weight = closure$weights.get_za3lpa$(index);\n return data.SeriesUtil.asFinite_z03gcz$(weight, 0.0);\n };\n }\n function BinStatUtil$weightAtIndex$lambda_0(it) {\n return 1.0;\n }\n BinStatUtil.prototype.weightAtIndex_dhhkv7$ = function (data) {\n if (data.has_8xm3sj$(TransformVar_getInstance().WEIGHT)) {\n var weights = data.getNumeric_8xm3sj$(TransformVar_getInstance().WEIGHT);\n return BinStatUtil$weightAtIndex$lambda(weights);\n }return BinStatUtil$weightAtIndex$lambda_0;\n };\n BinStatUtil.prototype.weightVector_5m8trb$ = function (dataLength, data) {\n var tmp$;\n if (data.has_8xm3sj$(TransformVar_getInstance().WEIGHT)) {\n tmp$ = data.getNumeric_8xm3sj$(TransformVar_getInstance().WEIGHT);\n } else {\n var list = ArrayList_init_1(dataLength);\n for (var index = 0; index < dataLength; index++) {\n list.add_11rb$(1.0);\n }\n tmp$ = list;\n }\n return tmp$;\n };\n BinStatUtil.prototype.binCountAndWidth_11nzti$ = function (dataRange, binOptions) {\n var binCount = binOptions.binCount;\n var binWidth;\n if (binOptions.hasBinWidth()) {\n binWidth = ensureNotNull(binOptions.binWidth);\n var count = dataRange / binWidth;\n var b = count;\n count = JsMath.min(500, b);\n var x = count;\n binCount = numberToInt(JsMath.ceil(x));\n } else {\n binWidth = dataRange / binCount;\n }\n return new BinStatUtil$CountAndWidth(binCount, binWidth);\n };\n BinStatUtil.prototype.computeBins_3oz8yg$ = function (valuesX, startX, binCount, binWidth, weightAtIndex, densityNormalizingFactor) {\n var totalCount = 0.0;\n var countByBinIndex = HashMap_init();\n for (var dataIndex = 0; dataIndex !== valuesX.size; ++dataIndex) {\n var x = valuesX.get_za3lpa$(dataIndex);\n if (!data.SeriesUtil.isFinite_yrwdxb$(x)) {\n continue;\n }var weight = weightAtIndex(dataIndex);\n totalCount += weight;\n var x_0 = (ensureNotNull(x) - startX) / binWidth;\n var binIndex = numberToInt(JsMath.floor(x_0));\n if (!countByBinIndex.containsKey_11rb$(binIndex)) {\n var value = new MutableDouble(0.0);\n countByBinIndex.put_xwzc9p$(binIndex, value);\n }ensureNotNull(countByBinIndex.get_11rb$(binIndex)).getAndAdd_14dthe$(weight);\n }\n var x_1 = ArrayList_init();\n var counts = ArrayList_init();\n var densities = ArrayList_init();\n var x0 = startX + binWidth / 2;\n for (var i = 0; i < binCount; i++) {\n x_1.add_11rb$(x0 + i * binWidth);\n var count = 0.0;\n if (countByBinIndex.containsKey_11rb$(i)) {\n count = ensureNotNull(countByBinIndex.get_11rb$(i)).get();\n }counts.add_11rb$(count);\n var density = count / totalCount * densityNormalizingFactor;\n densities.add_11rb$(density);\n }\n return new BinStatUtil$BinsData(x_1, counts, densities);\n };\n function BinStatUtil$BinOptions(binCount, binWidth) {\n this.binWidth = binWidth;\n var b = JsMath.max(1, binCount);\n this.binCount = JsMath.min(500, b);\n }\n BinStatUtil$BinOptions.prototype.hasBinWidth = function () {\n return this.binWidth != null && this.binWidth > 0;\n };\n BinStatUtil$BinOptions.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BinOptions',\n interfaces: []\n };\n function BinStatUtil$CountAndWidth(count, width) {\n this.count = count;\n this.width = width;\n }\n BinStatUtil$CountAndWidth.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CountAndWidth',\n interfaces: []\n };\n function BinStatUtil$BinsData(x, count, density) {\n this.x_8be2vx$ = x;\n this.count_8be2vx$ = count;\n this.density_8be2vx$ = density;\n }\n BinStatUtil$BinsData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BinsData',\n interfaces: []\n };\n BinStatUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'BinStatUtil',\n interfaces: []\n };\n var BinStatUtil_instance = null;\n function BinStatUtil_getInstance() {\n if (BinStatUtil_instance === null) {\n new BinStatUtil();\n }return BinStatUtil_instance;\n }\n function BoxplotStat(whiskerIQRRatio, computeWidth) {\n BoxplotStat$Companion_getInstance();\n BaseStat.call(this, BoxplotStat$Companion_getInstance().DEF_MAPPING_0);\n this.whiskerIQRRatio_0 = whiskerIQRRatio;\n this.computeWidth_0 = computeWidth;\n }\n BoxplotStat.prototype.hasDefaultMapping_896ixz$ = function (aes) {\n return BaseStat.prototype.hasDefaultMapping_896ixz$.call(this, aes) || (equals(aes, Aes$Companion_getInstance().WIDTH) && this.computeWidth_0);\n };\n BoxplotStat.prototype.getDefaultMapping_896ixz$ = function (aes) {\n var tmp$;\n if (equals(aes, Aes$Companion_getInstance().WIDTH)) {\n tmp$ = Stats_getInstance().WIDTH;\n } else {\n tmp$ = BaseStat.prototype.getDefaultMapping_896ixz$.call(this, aes);\n }\n return tmp$;\n };\n BoxplotStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y]);\n };\n BoxplotStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (!this.hasRequiredValues_xht41f$(data, [Aes$Companion_getInstance().Y])) {\n return this.withEmptyStatValues();\n }var ys = data.getNumeric_8xm3sj$(TransformVar_getInstance().Y);\n if (data.has_8xm3sj$(TransformVar_getInstance().X)) {\n tmp$ = data.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n } else {\n var size = ys.size;\n var list = ArrayList_init_1(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(0.0);\n }\n tmp$ = list;\n }\n var xs = tmp$;\n var statData = BoxplotStat$Companion_getInstance().buildStat_7jxs1q$(xs, ys, this.whiskerIQRRatio_0);\n var statCount = statData.remove_11rb$(Stats_getInstance().COUNT);\n var maxCountPerBin = (tmp$_1 = (tmp$_0 = statCount != null ? maxOrNull(statCount) : null) != null ? numberToInt(tmp$_0) : null) != null ? tmp$_1 : 0;\n if (maxCountPerBin === 0) {\n return this.withEmptyStatValues();\n }if (this.computeWidth_0) {\n var norm = JsMath.sqrt(maxCountPerBin);\n var $receiver = ensureNotNull(statCount);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_3;\n tmp$_3 = $receiver.iterator();\n while (tmp$_3.hasNext()) {\n var item = tmp$_3.next();\n destination.add_11rb$(JsMath.sqrt(item) / norm);\n }\n var statWidth = destination;\n var key = Stats_getInstance().WIDTH;\n statData.put_xwzc9p$(key, statWidth);\n }var builder = DataFrame$DataFrame$Builder_init();\n tmp$_2 = statData.entries.iterator();\n while (tmp$_2.hasNext()) {\n var tmp$_4 = tmp$_2.next();\n var variable = tmp$_4.key;\n var series = tmp$_4.value;\n builder.putNumeric_s1rqo9$(variable, series);\n }\n return builder.build();\n };\n function BoxplotStat$Companion() {\n BoxplotStat$Companion_instance = this;\n this.DEF_WHISKER_IQR_RATIO = 1.5;\n this.DEF_COMPUTE_WIDTH = false;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y), to(Aes$Companion_getInstance().YMIN, Stats_getInstance().Y_MIN), to(Aes$Companion_getInstance().YMAX, Stats_getInstance().Y_MAX), to(Aes$Companion_getInstance().LOWER, Stats_getInstance().LOWER), to(Aes$Companion_getInstance().MIDDLE, Stats_getInstance().MIDDLE), to(Aes$Companion_getInstance().UPPER, Stats_getInstance().UPPER)]);\n }\n BoxplotStat$Companion.prototype.buildStat_7jxs1q$ = function (xs, ys, whiskerIQRRatio) {\n var tmp$, tmp$_0, tmp$_1;\n var $receiver = zip(xs, ys);\n var destination = ArrayList_init();\n var tmp$_2;\n tmp$_2 = $receiver.iterator();\n while (tmp$_2.hasNext()) {\n var element = tmp$_2.next();\n var x = element.component1()\n , y = element.component2();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y))\n destination.add_11rb$(element);\n }\n var xyPairs = destination;\n if (xyPairs.isEmpty()) {\n return LinkedHashMap_init();\n }var binnedData = HashMap_init();\n tmp$ = xyPairs.iterator();\n while (tmp$.hasNext()) {\n var tmp$_3 = tmp$.next();\n var x_0 = tmp$_3.component1()\n , y_0 = tmp$_3.component2();\n var key = ensureNotNull(x_0);\n var tmp$_4;\n var value = binnedData.get_11rb$(key);\n if (value == null) {\n var answer = ArrayList_init();\n binnedData.put_xwzc9p$(key, answer);\n tmp$_4 = answer;\n } else {\n tmp$_4 = value;\n }\n tmp$_4.add_11rb$(ensureNotNull(y_0));\n }\n var statX = ArrayList_init();\n var statY = ArrayList_init();\n var statMiddle = ArrayList_init();\n var statLower = ArrayList_init();\n var statUpper = ArrayList_init();\n var statMin = ArrayList_init();\n var statMax = ArrayList_init();\n var statCount = ArrayList_init();\n tmp$_0 = binnedData.entries.iterator();\n while (tmp$_0.hasNext()) {\n var tmp$_5 = tmp$_0.next();\n var x_1 = tmp$_5.key;\n var bin = tmp$_5.value;\n var count = bin.size;\n var summary = FiveNumberSummary_init(bin);\n var middle = summary.median;\n var lowerHinge = summary.firstQuartile;\n var upperHinge = summary.thirdQuartile;\n var IQR = upperHinge - lowerHinge;\n var lowerFence = lowerHinge - IQR * whiskerIQRRatio;\n var upperFence = upperHinge + IQR * whiskerIQRRatio;\n var lowerWhisker = lowerFence;\n var upperWhisker = upperFence;\n if (data.SeriesUtil.allFinite_jma9l8$(lowerFence, upperFence)) {\n var destination_0 = ArrayList_init();\n var tmp$_6;\n tmp$_6 = bin.iterator();\n while (tmp$_6.hasNext()) {\n var element_0 = tmp$_6.next();\n if (element_0 >= lowerFence && element_0 <= upperFence)\n destination_0.add_11rb$(element_0);\n }\n var boxed = destination_0;\n var range = data.SeriesUtil.range_l63ks6$(boxed);\n if (range != null) {\n lowerWhisker = range.lowerEnd;\n upperWhisker = range.upperEnd;\n }}var destination_1 = ArrayList_init();\n var tmp$_7;\n tmp$_7 = bin.iterator();\n while (tmp$_7.hasNext()) {\n var element_1 = tmp$_7.next();\n if (element_1 < lowerFence || element_1 > upperFence)\n destination_1.add_11rb$(element_1);\n }\n var outliers = destination_1;\n tmp$_1 = outliers.iterator();\n while (tmp$_1.hasNext()) {\n var y_1 = tmp$_1.next();\n statX.add_11rb$(x_1);\n statY.add_11rb$(y_1);\n statMiddle.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statLower.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statUpper.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statMin.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statMax.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statCount.add_11rb$(count);\n }\n statX.add_11rb$(x_1);\n statY.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n statMiddle.add_11rb$(middle);\n statLower.add_11rb$(lowerHinge);\n statUpper.add_11rb$(upperHinge);\n statMin.add_11rb$(lowerWhisker);\n statMax.add_11rb$(upperWhisker);\n statCount.add_11rb$(count);\n }\n return mutableMapOf([to(Stats_getInstance().X, statX), to(Stats_getInstance().Y, statY), to(Stats_getInstance().MIDDLE, statMiddle), to(Stats_getInstance().LOWER, statLower), to(Stats_getInstance().UPPER, statUpper), to(Stats_getInstance().Y_MIN, statMin), to(Stats_getInstance().Y_MAX, statMax), to(Stats_getInstance().COUNT, statCount)]);\n };\n BoxplotStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BoxplotStat$Companion_instance = null;\n function BoxplotStat$Companion_getInstance() {\n if (BoxplotStat$Companion_instance === null) {\n new BoxplotStat$Companion();\n }return BoxplotStat$Companion_instance;\n }\n BoxplotStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BoxplotStat',\n interfaces: [BaseStat]\n };\n function Contour() {\n Contour$Companion_getInstance();\n this.myContourX_0 = ArrayList_init();\n this.myContourY_0 = ArrayList_init();\n this.myContourLevel_0 = ArrayList_init();\n this.myContourGroup_0 = ArrayList_init();\n this.myGroup_0 = 0.0;\n }\n Object.defineProperty(Contour.prototype, 'dataFrame_0', {\n configurable: true,\n get: function () {\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, this.myContourX_0).putNumeric_s1rqo9$(Stats_getInstance().Y, this.myContourY_0).putNumeric_s1rqo9$(Stats_getInstance().LEVEL, this.myContourLevel_0).putNumeric_s1rqo9$(Stats_getInstance().GROUP, this.myContourGroup_0).build();\n }\n });\n Contour.prototype.add_e7h60q$ = function (polygon, fillLevel) {\n var tmp$;\n tmp$ = polygon.iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n this.myContourX_0.add_11rb$(p.x);\n this.myContourY_0.add_11rb$(p.y);\n this.myContourLevel_0.add_11rb$(fillLevel);\n this.myContourGroup_0.add_11rb$(this.myGroup_0);\n }\n this.myGroup_0 += 1.0;\n };\n function Contour$Companion() {\n Contour$Companion_instance = this;\n }\n Contour$Companion.prototype.getPathDataFrame_9s3d7f$ = function (levels, pathListByLevel) {\n var tmp$, tmp$_0;\n var contour = new Contour();\n tmp$ = levels.iterator();\n while (tmp$.hasNext()) {\n var level = tmp$.next();\n var paths = ensureNotNull(pathListByLevel.get_11rb$(level));\n tmp$_0 = paths.iterator();\n while (tmp$_0.hasNext()) {\n var path = tmp$_0.next();\n contour.add_e7h60q$(path, level);\n }\n }\n return contour.dataFrame_0;\n };\n Contour$Companion.prototype.getPolygonDataFrame_dnsuee$ = function (fillLevels, polygonListByFillLevel) {\n var tmp$;\n var contour = new Contour();\n tmp$ = fillLevels.iterator();\n while (tmp$.hasNext()) {\n var fillLevel = tmp$.next();\n var polygon = ensureNotNull(polygonListByFillLevel.get_11rb$(fillLevel));\n contour.add_e7h60q$(polygon, fillLevel);\n }\n return contour.dataFrame_0;\n };\n Contour$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Contour$Companion_instance = null;\n function Contour$Companion_getInstance() {\n if (Contour$Companion_instance === null) {\n new Contour$Companion();\n }return Contour$Companion_instance;\n }\n Contour.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Contour',\n interfaces: []\n };\n function ContourFillHelper(xRange, yRange) {\n ContourFillHelper$Companion_getInstance();\n this.myLowLeft_0 = null;\n this.myLowRight_0 = null;\n this.myUpLeft_0 = null;\n this.myUpRight_0 = null;\n var xMin = xRange.lowerEnd;\n var xMax = xRange.upperEnd;\n var yMin = yRange.lowerEnd;\n var yMax = yRange.upperEnd;\n this.myLowLeft_0 = new DoubleVector(xMin, yMin);\n this.myLowRight_0 = new DoubleVector(xMax, yMin);\n this.myUpLeft_0 = new DoubleVector(xMin, yMax);\n this.myUpRight_0 = new DoubleVector(xMax, yMax);\n }\n ContourFillHelper.prototype.createPolygons_lrt0be$ = function (pathByLevels, levels, fillLevels) {\n var tmp$, tmp$_0, tmp$_1;\n var result = HashMap_init();\n var allPaths = ArrayList_init();\n tmp$ = pathByLevels.values.iterator();\n while (tmp$.hasNext()) {\n var level = tmp$.next();\n allPaths.addAll_brywnq$(level);\n }\n var cornerPoints = ArrayList_init();\n var outerMap = this.createOuterMap_0(allPaths, cornerPoints);\n var n = pathByLevels.keys.size;\n tmp$_0 = n + 1 | 0;\n for (var i = 0; i < tmp$_0; i++) {\n var polygonPieces = ArrayList_init();\n var value = ArrayList_init();\n if (i > 0) {\n polygonPieces.addAll_brywnq$(ContourFillHelper$Companion_getInstance().reverseAll_0(ensureNotNull(pathByLevels.get_11rb$(levels.get_za3lpa$(i - 1 | 0)))));\n }if (i < n) {\n polygonPieces.addAll_brywnq$(ensureNotNull(pathByLevels.get_11rb$(levels.get_za3lpa$(i))));\n }polygonPieces = this.createClosedPolygonLevels_0(polygonPieces, outerMap, cornerPoints);\n tmp$_1 = polygonPieces.iterator();\n while (tmp$_1.hasNext()) {\n var path = tmp$_1.next();\n value.addAll_brywnq$(path);\n }\n var key = fillLevels.get_za3lpa$(i);\n result.put_xwzc9p$(key, value);\n }\n return result;\n };\n ContourFillHelper.prototype.createClosedPolygonLevels_0 = function (openLevels, outerMap, cornerPoints) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var result = ArrayList_init();\n var donePath = HashSet_init_1();\n tmp$ = openLevels.iterator();\n while (tmp$.hasNext()) {\n var level = tmp$.next();\n var levelCopy = ArrayList_init_0(level);\n var p0 = levelCopy.get_za3lpa$(0);\n var p1 = levelCopy.get_za3lpa$(levelCopy.size - 1 | 0);\n if (p0 != null ? p0.equals(p1) : null) {\n result.add_11rb$(levelCopy);\n continue;\n }var pi2 = ensureNotNull(outerMap.get_11rb$(p1));\n levelCopy.add_11rb$(pi2);\n p1 = pi2;\n while (cornerPoints.contains_11rb$(p1)) {\n pi2 = ensureNotNull(outerMap.get_11rb$(p1));\n levelCopy.add_11rb$(pi2);\n p1 = pi2;\n }\n donePath.add_11rb$(levelCopy);\n }\n var pathByEndPoint = HashMap_init();\n tmp$_0 = donePath.iterator();\n while (tmp$_0.hasNext()) {\n var path = tmp$_0.next();\n var p0_0 = path.get_za3lpa$(0);\n var p1_0 = path.get_za3lpa$(path.size - 1 | 0);\n if (p0_0 != null ? p0_0.equals(p1_0) : null) {\n result.add_11rb$(path);\n continue;\n }if (pathByEndPoint.containsKey_11rb$(p0_0) || pathByEndPoint.containsKey_11rb$(p1_0)) {\n var path0 = pathByEndPoint.get_11rb$(p0_0);\n var path1 = pathByEndPoint.get_11rb$(p1_0);\n ContourStatUtil_getInstance().removePathByEndpoints_ebaanh$(path0, pathByEndPoint);\n ContourStatUtil_getInstance().removePathByEndpoints_ebaanh$(path1, pathByEndPoint);\n var longPath;\n if (path0 === path1) {\n ensureNotNull(path0).addAll_brywnq$(path.subList_vux9f0$(1, path.size));\n result.add_11rb$(path0);\n continue;\n } else if (path0 != null && path1 != null) {\n longPath = path0;\n longPath.addAll_brywnq$(path.subList_vux9f0$(1, path.size - 1 | 0));\n longPath.addAll_brywnq$(path1);\n } else if (path0 == null) {\n longPath = ensureNotNull(path1);\n longPath.addAll_u57x28$(0, path.subList_vux9f0$(0, path.size - 1 | 0));\n } else {\n longPath = path0;\n longPath.addAll_brywnq$(path.subList_vux9f0$(1, path.size));\n }\n var key = longPath.get_za3lpa$(0);\n var value = longPath;\n pathByEndPoint.put_xwzc9p$(key, value);\n var key_0 = longPath.get_za3lpa$(longPath.size - 1 | 0);\n var value_0 = longPath;\n pathByEndPoint.put_xwzc9p$(key_0, value_0);\n } else {\n var key_1 = path.get_za3lpa$(0);\n pathByEndPoint.put_xwzc9p$(key_1, path);\n var key_2 = path.get_za3lpa$(path.size - 1 | 0);\n pathByEndPoint.put_xwzc9p$(key_2, path);\n }\n }\n if (!pathByEndPoint.keys.isEmpty()) {\n throw IllegalArgumentException_init('Some paths are not cleared yet there is something wrong!' + toString(pathByEndPoint.keys.size));\n }tmp$_1 = result.iterator();\n while (tmp$_1.hasNext()) {\n var path_0 = tmp$_1.next();\n if (!((tmp$_2 = path_0.get_za3lpa$(0)) != null ? tmp$_2.equals(path_0.get_za3lpa$(path_0.size - 1 | 0)) : null)) {\n throw IllegalArgumentException_init('The polygons are not entirely closed!');\n }}\n return result;\n };\n function ContourFillHelper$createOuterMap$lambda(o1, o2) {\n return Kotlin.compareTo(o1.x, o2.x);\n }\n function ContourFillHelper$createOuterMap$lambda_0(o1, o2) {\n return Kotlin.compareTo(o1.y, o2.y);\n }\n function ContourFillHelper$createOuterMap$lambda_1(o1, o2) {\n return Kotlin.compareTo(o2.x, o1.x);\n }\n function ContourFillHelper$createOuterMap$lambda_2(o1, o2) {\n return Kotlin.compareTo(o2.y, o1.y);\n }\n ContourFillHelper.prototype.createOuterMap_0 = function (paths, cornerPoints) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var points = ArrayList_init();\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var path = tmp$.next();\n if (!((tmp$_0 = path.get_za3lpa$(0)) != null ? tmp$_0.equals(path.get_za3lpa$(path.size - 1 | 0)) : null)) {\n points.add_11rb$(path.get_za3lpa$(0));\n points.add_11rb$(path.get_za3lpa$(path.size - 1 | 0));\n }}\n var result = HashMap_init();\n var list = ArrayList_init();\n for (var i = 0; i <= 3; i++) {\n list.add_11rb$(ArrayList_init());\n }\n tmp$_1 = points.iterator();\n while (tmp$_1.hasNext()) {\n var point = tmp$_1.next();\n var kind = this.getKind_0(point);\n switch (kind.name) {\n case 'DOWN':\n list.get_za3lpa$(0).add_11rb$(point);\n break;\n case 'RIGHT':\n list.get_za3lpa$(1).add_11rb$(point);\n break;\n case 'UP':\n list.get_za3lpa$(2).add_11rb$(point);\n break;\n case 'LEFT':\n list.get_za3lpa$(3).add_11rb$(point);\n break;\n default:Kotlin.noWhenBranchMatched();\n break;\n }\n }\n sortWith(list.get_za3lpa$(0), new Comparator(ContourFillHelper$createOuterMap$lambda));\n sortWith(list.get_za3lpa$(1), new Comparator(ContourFillHelper$createOuterMap$lambda_0));\n sortWith(list.get_za3lpa$(2), new Comparator(ContourFillHelper$createOuterMap$lambda_1));\n sortWith(list.get_za3lpa$(3), new Comparator(ContourFillHelper$createOuterMap$lambda_2));\n var prepareMap = ArrayList_init();\n if (!list.get_za3lpa$(0).contains_11rb$(this.myLowLeft_0)) {\n prepareMap.add_11rb$(this.myLowLeft_0);\n cornerPoints.add_11rb$(this.myLowLeft_0);\n }prepareMap.addAll_brywnq$(list.get_za3lpa$(0));\n if (!list.get_za3lpa$(0).contains_11rb$(this.myLowRight_0)) {\n prepareMap.add_11rb$(this.myLowRight_0);\n cornerPoints.add_11rb$(this.myLowRight_0);\n }prepareMap.addAll_brywnq$(list.get_za3lpa$(1));\n if (!list.get_za3lpa$(1).contains_11rb$(this.myUpRight_0)) {\n prepareMap.add_11rb$(this.myUpRight_0);\n cornerPoints.add_11rb$(this.myUpRight_0);\n }prepareMap.addAll_brywnq$(list.get_za3lpa$(2));\n if (!list.get_za3lpa$(3).contains_11rb$(this.myUpLeft_0)) {\n prepareMap.add_11rb$(this.myUpLeft_0);\n cornerPoints.add_11rb$(this.myUpLeft_0);\n }prepareMap.addAll_brywnq$(list.get_za3lpa$(3));\n prepareMap.add_11rb$(prepareMap.get_za3lpa$(0));\n tmp$_2 = prepareMap.size - 1 | 0;\n for (var i_0 = 0; i_0 < tmp$_2; i_0++) {\n var key = prepareMap.get_za3lpa$(i_0);\n var value = prepareMap.get_za3lpa$(i_0 + 1 | 0);\n result.put_xwzc9p$(key, value);\n }\n return result;\n };\n ContourFillHelper.prototype.getKind_0 = function (point) {\n var tmp$;\n if (ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myLowLeft_0, this.myUpRight_0, point) && ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myUpLeft_0, this.myLowRight_0, point)) {\n tmp$ = ContourFillHelper$BorderKind$DOWN_getInstance();\n } else if (ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myLowLeft_0, this.myUpRight_0, point) && !ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myUpLeft_0, this.myLowRight_0, point)) {\n tmp$ = ContourFillHelper$BorderKind$RIGHT_getInstance();\n } else if (!ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myLowLeft_0, this.myUpRight_0, point) && !ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myUpLeft_0, this.myLowRight_0, point)) {\n tmp$ = ContourFillHelper$BorderKind$UP_getInstance();\n } else if (!ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myLowLeft_0, this.myUpRight_0, point) && ContourFillHelper$Companion_getInstance().belowOrOnLine_0(this.myUpLeft_0, this.myLowRight_0, point)) {\n tmp$ = ContourFillHelper$BorderKind$LEFT_getInstance();\n } else {\n throw IllegalArgumentException_init('The Contour Point is not on the border ' + point);\n }\n return tmp$;\n };\n function ContourFillHelper$BorderKind(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ContourFillHelper$BorderKind_initFields() {\n ContourFillHelper$BorderKind_initFields = function () {\n };\n ContourFillHelper$BorderKind$DOWN_instance = new ContourFillHelper$BorderKind('DOWN', 0);\n ContourFillHelper$BorderKind$RIGHT_instance = new ContourFillHelper$BorderKind('RIGHT', 1);\n ContourFillHelper$BorderKind$UP_instance = new ContourFillHelper$BorderKind('UP', 2);\n ContourFillHelper$BorderKind$LEFT_instance = new ContourFillHelper$BorderKind('LEFT', 3);\n }\n var ContourFillHelper$BorderKind$DOWN_instance;\n function ContourFillHelper$BorderKind$DOWN_getInstance() {\n ContourFillHelper$BorderKind_initFields();\n return ContourFillHelper$BorderKind$DOWN_instance;\n }\n var ContourFillHelper$BorderKind$RIGHT_instance;\n function ContourFillHelper$BorderKind$RIGHT_getInstance() {\n ContourFillHelper$BorderKind_initFields();\n return ContourFillHelper$BorderKind$RIGHT_instance;\n }\n var ContourFillHelper$BorderKind$UP_instance;\n function ContourFillHelper$BorderKind$UP_getInstance() {\n ContourFillHelper$BorderKind_initFields();\n return ContourFillHelper$BorderKind$UP_instance;\n }\n var ContourFillHelper$BorderKind$LEFT_instance;\n function ContourFillHelper$BorderKind$LEFT_getInstance() {\n ContourFillHelper$BorderKind_initFields();\n return ContourFillHelper$BorderKind$LEFT_instance;\n }\n ContourFillHelper$BorderKind.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BorderKind',\n interfaces: [Enum]\n };\n function ContourFillHelper$BorderKind$values() {\n return [ContourFillHelper$BorderKind$DOWN_getInstance(), ContourFillHelper$BorderKind$RIGHT_getInstance(), ContourFillHelper$BorderKind$UP_getInstance(), ContourFillHelper$BorderKind$LEFT_getInstance()];\n }\n ContourFillHelper$BorderKind.values = ContourFillHelper$BorderKind$values;\n function ContourFillHelper$BorderKind$valueOf(name) {\n switch (name) {\n case 'DOWN':\n return ContourFillHelper$BorderKind$DOWN_getInstance();\n case 'RIGHT':\n return ContourFillHelper$BorderKind$RIGHT_getInstance();\n case 'UP':\n return ContourFillHelper$BorderKind$UP_getInstance();\n case 'LEFT':\n return ContourFillHelper$BorderKind$LEFT_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.ContourFillHelper.BorderKind.' + name);\n }\n }\n ContourFillHelper$BorderKind.valueOf_61zpoe$ = ContourFillHelper$BorderKind$valueOf;\n function ContourFillHelper$Companion() {\n ContourFillHelper$Companion_instance = this;\n }\n ContourFillHelper$Companion.prototype.computeFillLevels_4v6zbb$ = function (zRange, levels) {\n var tmp$;\n var fillLevels = ArrayList_init();\n fillLevels.add_11rb$(zRange.lowerEnd);\n tmp$ = levels.size - 1 | 0;\n for (var i = 0; i < tmp$; i++) {\n fillLevels.add_11rb$((levels.get_za3lpa$(i) + levels.get_za3lpa$(i + 1 | 0)) / 2.0);\n }\n fillLevels.add_11rb$(zRange.upperEnd);\n return fillLevels;\n };\n ContourFillHelper$Companion.prototype.reverseAll_0 = function (list) {\n var tmp$;\n var result = ArrayList_init();\n tmp$ = list.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var copy = ArrayList_init_0(item);\n reverse(copy);\n result.add_11rb$(copy);\n }\n return result;\n };\n ContourFillHelper$Companion.prototype.belowOrOnLine_0 = function (a, b, test) {\n var value = test.subtract_gpjtzr$(a);\n var standard = b.subtract_gpjtzr$(a);\n return standard.y * value.x - value.y * standard.x >= 0;\n };\n ContourFillHelper$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContourFillHelper$Companion_instance = null;\n function ContourFillHelper$Companion_getInstance() {\n if (ContourFillHelper$Companion_instance === null) {\n new ContourFillHelper$Companion();\n }return ContourFillHelper$Companion_instance;\n }\n ContourFillHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContourFillHelper',\n interfaces: []\n };\n function ContourStat(binCount, binWidth) {\n ContourStat$Companion_getInstance();\n BaseStat.call(this, ContourStat$Companion_getInstance().DEF_MAPPING_0);\n this.myBinOptions_0 = new BinStatUtil$BinOptions(binCount, binWidth);\n }\n ContourStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().Z]);\n };\n ContourStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n var tmp$;\n if (!this.hasRequiredValues_xht41f$(data, [Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().Z])) {\n return this.withEmptyStatValues();\n }tmp$ = ContourStatUtil_getInstance().computeLevels_wuiwgl$(data, this.myBinOptions_0);\n if (tmp$ == null) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }var levels = tmp$;\n var pathListByLevel = ContourStatUtil_getInstance().computeContours_jco5dt$(data, levels);\n return Contour$Companion_getInstance().getPathDataFrame_9s3d7f$(levels, pathListByLevel);\n };\n function ContourStat$Companion() {\n ContourStat$Companion_instance = this;\n this.DEF_BIN_COUNT = 10;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y)]);\n }\n ContourStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContourStat$Companion_instance = null;\n function ContourStat$Companion_getInstance() {\n if (ContourStat$Companion_instance === null) {\n new ContourStat$Companion();\n }return ContourStat$Companion_instance;\n }\n ContourStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContourStat',\n interfaces: [BaseStat]\n };\n function ContourStatUtil() {\n ContourStatUtil_instance = this;\n this.xLoc_0 = new Float64Array([0.0, 1.0, 1.0, 0.0, 0.5]);\n this.yLoc_0 = new Float64Array([0.0, 0.0, 1.0, 1.0, 0.5]);\n }\n ContourStatUtil.prototype.estimateRegularGridShape_fsp013$ = function (xs) {\n var tmp$;\n var colCount = 0;\n var x0 = null;\n tmp$ = xs.iterator();\n while (tmp$.hasNext()) {\n var x = tmp$.next();\n if (x0 == null) {\n x0 = x;\n } else if (x == x0) {\n break;\n }colCount = colCount + 1 | 0;\n }\n if (colCount <= 1) {\n throw IllegalArgumentException_init('Data grid must be at least 2 columns wide (was ' + colCount + ')');\n }var rowCount = xs.size / colCount | 0;\n if (rowCount <= 1) {\n throw IllegalArgumentException_init('Data grid must be at least 2 rows tall (was ' + rowCount + ')');\n }return new Pair(colCount, rowCount);\n };\n ContourStatUtil.prototype.computeLevels_wuiwgl$ = function (data, binOptions) {\n if (!(data.has_8xm3sj$(TransformVar_getInstance().X) && data.has_8xm3sj$(TransformVar_getInstance().Y) && data.has_8xm3sj$(TransformVar_getInstance().Z))) {\n return null;\n }var zRange = data.range_8xm3sj$(TransformVar_getInstance().Z);\n return this.computeLevels_kgz263$(zRange, binOptions);\n };\n ContourStatUtil.prototype.computeLevels_kgz263$ = function (zRange, binOptions) {\n var tmp$;\n if (zRange == null || data.SeriesUtil.isSubTiny_4fzjta$(zRange))\n return null;\n var b = BinStatUtil_getInstance().binCountAndWidth_11nzti$(data.SeriesUtil.span_4fzjta$(zRange), binOptions);\n var levels = ArrayList_init();\n tmp$ = b.count;\n for (var i = 0; i < tmp$; i++) {\n var level = i * b.width + zRange.lowerEnd;\n level += b.width / 2;\n levels.add_11rb$(level);\n }\n return levels;\n };\n ContourStatUtil.prototype.computeContours_jco5dt$ = function (data, levels) {\n var xVector = data.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n var zVector = data.getNumeric_8xm3sj$(TransformVar_getInstance().Z);\n var shape = this.estimateRegularGridShape_fsp013$(xVector);\n var colCount = shape.first;\n var rowCount = shape.second;\n var xRange = ensureNotNull(data.range_8xm3sj$(TransformVar_getInstance().X));\n var yRange = ensureNotNull(data.range_8xm3sj$(TransformVar_getInstance().Y));\n return this.computeContours_cxleoh$(xRange, yRange, colCount, rowCount, zVector, levels);\n };\n ContourStatUtil.prototype.computeContours_cxleoh$ = function (xRange, yRange, colCount, rowCount, data_0, levels) {\n var tmp$;\n var xStep = data.SeriesUtil.span_4fzjta$(xRange) / (colCount - 1 | 0);\n var yStep = data.SeriesUtil.span_4fzjta$(yRange) / (rowCount - 1 | 0);\n var origin = new DoubleVector(xRange.lowerEnd, yRange.lowerEnd);\n var pathListByLevel = HashMap_init();\n tmp$ = levels.iterator();\n while (tmp$.hasNext()) {\n var level = tmp$.next();\n var levelSegments = this.computeSegments_0(colCount, rowCount, data_0, level);\n var paths = this.joinSegments_0(levelSegments);\n var pathsReal = this.convertPaths_0(paths, xStep, yStep, origin, level);\n pathsReal = this.confirmPaths_0(pathsReal);\n var value = pathsReal;\n pathListByLevel.put_xwzc9p$(level, value);\n }\n return pathListByLevel;\n };\n ContourStatUtil.prototype.joinSegments_0 = function (segments) {\n var tmp$, tmp$_0;\n var pathList = ArrayList_init();\n var pathByEndPoint = HashMap_init();\n tmp$ = segments.iterator();\n while (tmp$.hasNext()) {\n var segment = tmp$.next();\n var p0 = segment.first;\n var p1 = segment.second;\n if (pathByEndPoint.containsKey_11rb$(p0) || pathByEndPoint.containsKey_11rb$(p1)) {\n var path0 = pathByEndPoint.get_11rb$(p0);\n var path1 = pathByEndPoint.get_11rb$(p1);\n if (path0 != null) {\n pathByEndPoint.remove_11rb$(path0.get_za3lpa$(0));\n pathByEndPoint.remove_11rb$(path0.get_za3lpa$(path0.size - 1 | 0));\n }if (path1 != null) {\n pathByEndPoint.remove_11rb$(path1.get_za3lpa$(0));\n pathByEndPoint.remove_11rb$(path1.get_za3lpa$(path1.size - 1 | 0));\n }var longPath;\n if (path0 === path1) {\n ensureNotNull(path0).add_11rb$(segment.second);\n pathList.add_11rb$(path0);\n continue;\n } else if (path0 != null && path1 != null) {\n longPath = path0;\n longPath.addAll_brywnq$(path1);\n } else if (path0 == null) {\n longPath = ensureNotNull(path1);\n longPath.add_wxm5ur$(0, segment.first);\n } else {\n longPath = path0;\n longPath.add_11rb$(segment.second);\n }\n var key = longPath.get_za3lpa$(0);\n var value = longPath;\n pathByEndPoint.put_xwzc9p$(key, value);\n var key_0 = longPath.get_za3lpa$(longPath.size - 1 | 0);\n var value_0 = longPath;\n pathByEndPoint.put_xwzc9p$(key_0, value_0);\n } else {\n var path = ArrayList_init();\n path.add_11rb$(segment.first);\n path.add_11rb$(segment.second);\n var key_1 = segment.first;\n pathByEndPoint.put_xwzc9p$(key_1, path);\n var key_2 = segment.second;\n pathByEndPoint.put_xwzc9p$(key_2, path);\n }\n }\n var pathSet = HashSet_init(pathByEndPoint.values);\n tmp$_0 = pathSet.iterator();\n while (tmp$_0.hasNext()) {\n var path_0 = tmp$_0.next();\n pathList.add_11rb$(path_0);\n }\n return pathList;\n };\n ContourStatUtil.prototype.convertPaths_0 = function (paths, xStep, yStep, origin, level) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var result = ArrayList_init();\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var path = tmp$.next();\n var temp = ArrayList_init();\n var lastPoint = null;\n tmp$_0 = path.iterator();\n while (tmp$_0.hasNext()) {\n var edge = tmp$_0.next();\n var intersect = edge.intersect_14dthe$(ensureNotNull(level));\n intersect = (new DoubleVector(xStep * intersect.x, yStep * intersect.y)).add_gpjtzr$(origin);\n if (equals(intersect, lastPoint)) {\n continue;\n }temp.add_11rb$(intersect);\n lastPoint = intersect;\n }\n if (((tmp$_1 = path.get_za3lpa$(0)) != null ? tmp$_1.equals(path.get_za3lpa$(path.size - 1 | 0)) : null) && !((tmp$_2 = temp.get_za3lpa$(0)) != null ? tmp$_2.equals(temp.get_za3lpa$(temp.size - 1 | 0)) : null)) {\n temp.set_wxm5ur$(temp.size - 1 | 0, temp.get_za3lpa$(0));\n }if (temp.size > 1) {\n result.add_11rb$(temp);\n }}\n return result;\n };\n ContourStatUtil.prototype.confirmPaths_0 = function (paths) {\n var tmp$, tmp$_0, tmp$_1;\n var newPaths = ArrayList_init();\n var pathByEndPoint = HashMap_init();\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var path = tmp$.next();\n var p0 = path.get_za3lpa$(0);\n var p1 = path.get_za3lpa$(path.size - 1 | 0);\n if (p0 != null ? p0.equals(p1) : null) {\n newPaths.add_11rb$(path);\n continue;\n }if (pathByEndPoint.containsKey_11rb$(p0) || pathByEndPoint.containsKey_11rb$(p1)) {\n var path0 = pathByEndPoint.get_11rb$(p0);\n var path1 = pathByEndPoint.get_11rb$(p1);\n this.removePathByEndpoints_ebaanh$(path0, pathByEndPoint);\n this.removePathByEndpoints_ebaanh$(path1, pathByEndPoint);\n var longPath = ArrayList_init();\n if (path0 === path1) {\n longPath.addAll_brywnq$(ensureNotNull(path0));\n longPath.addAll_brywnq$(path.subList_vux9f0$(1, path.size));\n newPaths.add_11rb$(longPath);\n continue;\n } else if (path0 != null && path1 != null) {\n longPath.addAll_brywnq$(path0);\n longPath.addAll_brywnq$(path.subList_vux9f0$(1, path.size - 1 | 0));\n longPath.addAll_brywnq$(path1);\n } else if (path0 == null) {\n longPath.addAll_brywnq$(ensureNotNull(path1));\n longPath.addAll_u57x28$(0, path.subList_vux9f0$(0, path.size - 1 | 0));\n } else {\n longPath.addAll_brywnq$(path0);\n longPath.addAll_brywnq$(path.subList_vux9f0$(1, path.size));\n }\n var key = longPath.get_za3lpa$(0);\n pathByEndPoint.put_xwzc9p$(key, longPath);\n var key_0 = longPath.get_za3lpa$(longPath.size - 1 | 0);\n pathByEndPoint.put_xwzc9p$(key_0, longPath);\n } else {\n var key_1 = path.get_za3lpa$(0);\n pathByEndPoint.put_xwzc9p$(key_1, path);\n var key_2 = path.get_za3lpa$(path.size - 1 | 0);\n pathByEndPoint.put_xwzc9p$(key_2, path);\n }\n }\n var pathSet = HashSet_init(pathByEndPoint.values);\n tmp$_0 = pathSet.iterator();\n while (tmp$_0.hasNext()) {\n var path_0 = tmp$_0.next();\n newPaths.add_11rb$(path_0);\n }\n var result = ArrayList_init();\n tmp$_1 = newPaths.iterator();\n while (tmp$_1.hasNext()) {\n var path_1 = tmp$_1.next();\n result.addAll_brywnq$(this.pathSeparator_0(path_1));\n }\n return result;\n };\n ContourStatUtil.prototype.removePathByEndpoints_ebaanh$ = function (path, pathByEndPoint) {\n if (path != null) {\n pathByEndPoint.remove_11rb$(path.get_za3lpa$(0));\n pathByEndPoint.remove_11rb$(path.get_za3lpa$(path.size - 1 | 0));\n }};\n ContourStatUtil.prototype.pathSeparator_0 = function (path) {\n var tmp$, tmp$_0;\n var result = ArrayList_init();\n var startIndex = 0;\n tmp$ = path.size - 1 | 0;\n for (var nextIndex = 1; nextIndex < tmp$; nextIndex++) {\n if ((tmp$_0 = path.get_za3lpa$(startIndex)) != null ? tmp$_0.equals(path.get_za3lpa$(nextIndex)) : null) {\n result.add_11rb$(path.subList_vux9f0$(startIndex, nextIndex + 1 | 0));\n startIndex = nextIndex;\n }}\n if (startIndex === 0) {\n return listOf_0(path);\n } else {\n result.add_11rb$(path.subList_vux9f0$(startIndex, path.size));\n return result;\n }\n };\n ContourStatUtil.prototype.computeSegments_0 = function (colCount, rowCount, data, level) {\n var tmp$, tmp$_0;\n var segments = ArrayList_init();\n tmp$ = rowCount - 1 | 0;\n for (var row = 0; row < tmp$; row++) {\n tmp$_0 = colCount - 1 | 0;\n for (var col = 0; col < tmp$_0; col++) {\n var i0 = Kotlin.imul(row, colCount) + col | 0;\n var i1 = Kotlin.imul(row, colCount) + col + 1 | 0;\n var i2 = Kotlin.imul(row + 1 | 0, colCount) + col + 1 | 0;\n var i3 = Kotlin.imul(row + 1 | 0, colCount) + col | 0;\n var v = new Float64Array(5);\n v[0] = ensureNotNull(data.get_za3lpa$(i0));\n v[1] = ensureNotNull(data.get_za3lpa$(i1));\n v[2] = ensureNotNull(data.get_za3lpa$(i2));\n v[3] = ensureNotNull(data.get_za3lpa$(i3));\n var min = v[0];\n var max = v[0];\n for (var i = 1; i <= 3; i++) {\n var a = min;\n var b = v[i];\n min = JsMath.min(a, b);\n var a_0 = max;\n var b_0 = v[i];\n max = JsMath.max(a_0, b_0);\n }\n if (min === max) {\n continue;\n }v[4] = (v[0] + v[1] + v[2] + v[3] - min - max) / 2;\n if (level > min && level <= max) {\n var cellSegments = this.computeSegmentsForGridCell_0(level, v, col, row);\n segments.addAll_brywnq$(cellSegments);\n }}\n }\n return segments;\n };\n ContourStatUtil.prototype.computeSegmentsForGridCell_0 = function (level, value5, col, row) {\n var result = ArrayList_init();\n var points = ArrayList_init();\n var tempVector;\n for (var i = 0; i <= 4; i++) {\n points.add_11rb$(new ContourStatUtil$TripleVector(col + this.xLoc_0[i], row + this.yLoc_0[i], value5[i]));\n }\n for (var i_0 = 0; i_0 <= 3; i_0++) {\n var i1 = (i_0 + 1 | 0) % 4;\n tempVector = ArrayList_init();\n tempVector.add_11rb$(points.get_za3lpa$(i_0));\n tempVector.add_11rb$(points.get_za3lpa$(i1));\n tempVector.add_11rb$(points.get_za3lpa$(4));\n var temp = this.intersectionSegment_0(tempVector, level);\n if (temp != null) {\n result.add_11rb$(temp);\n }}\n return result;\n };\n ContourStatUtil.prototype.intersectionSegment_0 = function (vectors, level) {\n var type = (vectors.get_za3lpa$(0).getType_14dthe$(ensureNotNull(level)) * 100 | 0) + (vectors.get_za3lpa$(1).getType_14dthe$(level) * 10 | 0) + vectors.get_za3lpa$(2).getType_14dthe$(level) | 0;\n var start;\n var end;\n switch (type) {\n case 100:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(2), vectors.get_za3lpa$(0));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(0), vectors.get_za3lpa$(1));\n break;\n case 10:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(0), vectors.get_za3lpa$(1));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(1), vectors.get_za3lpa$(2));\n break;\n case 1:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(1), vectors.get_za3lpa$(2));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(2), vectors.get_za3lpa$(0));\n break;\n case 110:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(0), vectors.get_za3lpa$(2));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(2), vectors.get_za3lpa$(1));\n break;\n case 101:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(2), vectors.get_za3lpa$(1));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(1), vectors.get_za3lpa$(0));\n break;\n case 11:\n start = new ContourStatUtil$Edge(vectors.get_za3lpa$(1), vectors.get_za3lpa$(0));\n end = new ContourStatUtil$Edge(vectors.get_za3lpa$(0), vectors.get_za3lpa$(2));\n break;\n default:return null;\n }\n return new Pair(start, end);\n };\n ContourStatUtil.prototype.checkEdges_0 = function (paths, colCount, rowCount) {\n var tmp$, tmp$_0;\n tmp$ = paths.iterator();\n while (tmp$.hasNext()) {\n var path = tmp$.next();\n if (!((tmp$_0 = path.get_za3lpa$(0)) != null ? tmp$_0.equals(path.get_za3lpa$(path.size - 1 | 0)) : null)) {\n this.checkEdge_0(path.get_za3lpa$(0), colCount, rowCount);\n this.checkEdge_0(path.get_za3lpa$(path.size - 1 | 0), colCount, rowCount);\n }}\n };\n ContourStatUtil.prototype.checkEdge_0 = function (edge, colCount, rowCount) {\n var a = edge.myA;\n var b = edge.myB;\n if (a.myX === 0 && b.myX === 0) {\n return;\n }if (a.myY === 0 && b.myY === 0) {\n return;\n }if (a.myX === (colCount - 1 | 0) && b.myX === (colCount - 1 | 0)) {\n return;\n }if (a.myY === (rowCount - 1 | 0) && b.myY === (rowCount - 1 | 0)) {\n return;\n }throw IllegalArgumentException_init('Check Edge Failed');\n };\n function ContourStatUtil$TripleVector(x, y, z) {\n this.z = z;\n this.myX = 0;\n this.myY = 0;\n this.myIsCenter_0 = 0;\n this.myX = numberToInt(x);\n this.myY = numberToInt(y);\n this.myIsCenter_0 = x % 1 === 0.0 ? 0 : 1;\n }\n Object.defineProperty(ContourStatUtil$TripleVector.prototype, 'coord', {\n configurable: true,\n get: function () {\n return new DoubleVector(this.x, this.y);\n }\n });\n Object.defineProperty(ContourStatUtil$TripleVector.prototype, 'x', {\n configurable: true,\n get: function () {\n return this.myX + 0.5 * this.myIsCenter_0;\n }\n });\n Object.defineProperty(ContourStatUtil$TripleVector.prototype, 'y', {\n configurable: true,\n get: function () {\n return this.myY + 0.5 * this.myIsCenter_0;\n }\n });\n ContourStatUtil$TripleVector.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n var that = (tmp$_0 = other) == null || Kotlin.isType(tmp$_0, ContourStatUtil$TripleVector) ? tmp$_0 : throwCCE();\n return this.myX === ensureNotNull(that).myX && this.myY === that.myY && this.myIsCenter_0 === that.myIsCenter_0;\n };\n ContourStatUtil$TripleVector.prototype.hashCode = function () {\n return hashCode([this.myX, this.myY, this.myIsCenter_0]);\n };\n ContourStatUtil$TripleVector.prototype.getType_14dthe$ = function (level) {\n var tmp$;\n if (this.z >= level) {\n tmp$ = 1;\n } else {\n tmp$ = 0;\n }\n return tmp$;\n };\n ContourStatUtil$TripleVector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TripleVector',\n interfaces: []\n };\n function ContourStatUtil$Edge(myA, myB) {\n this.myA = myA;\n this.myB = myB;\n }\n ContourStatUtil$Edge.prototype.equals = function (other) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3;\n if (!Kotlin.isType(other, ContourStatUtil$Edge)) {\n return false;\n }var obj = (tmp$ = other) == null || Kotlin.isType(tmp$, ContourStatUtil$Edge) ? tmp$ : throwCCE();\n return ((tmp$_0 = this.myA) != null ? tmp$_0.equals(ensureNotNull(obj).myA) : null) && ((tmp$_1 = this.myB) != null ? tmp$_1.equals(obj.myB) : null) || (((tmp$_2 = this.myA) != null ? tmp$_2.equals(obj.myB) : null) && ((tmp$_3 = this.myB) != null ? tmp$_3.equals(obj.myA) : null));\n };\n ContourStatUtil$Edge.prototype.hashCode = function () {\n return this.myA.coord.hashCode() + this.myB.coord.hashCode() | 0;\n };\n ContourStatUtil$Edge.prototype.intersect_14dthe$ = function (level) {\n var z0 = this.myA.z;\n var z1 = this.myB.z;\n if (level === z0) {\n return this.myA.coord;\n }if (level === z1) {\n return this.myB.coord;\n }var ratio = (z1 - z0) / (level - z0);\n var x0 = this.myA.x;\n var y0 = this.myA.y;\n var x1 = this.myB.x;\n var y1 = this.myB.y;\n var x = x0 + (x1 - x0) / ratio;\n var y = y0 + (y1 - y0) / ratio;\n return new DoubleVector(x, y);\n };\n ContourStatUtil$Edge.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Edge',\n interfaces: []\n };\n ContourStatUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ContourStatUtil',\n interfaces: []\n };\n var ContourStatUtil_instance = null;\n function ContourStatUtil_getInstance() {\n if (ContourStatUtil_instance === null) {\n new ContourStatUtil();\n }return ContourStatUtil_instance;\n }\n function ContourfStat(binCount, binWidth) {\n ContourfStat$Companion_getInstance();\n BaseStat.call(this, ContourfStat$Companion_getInstance().DEF_MAPPING_0);\n this.myBinOptions_0 = new BinStatUtil$BinOptions(binCount, binWidth);\n }\n ContourfStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().Z]);\n };\n ContourfStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n var tmp$;\n if (!this.hasRequiredValues_xht41f$(data, [Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y, Aes$Companion_getInstance().Z])) {\n return this.withEmptyStatValues();\n }tmp$ = ContourStatUtil_getInstance().computeLevels_wuiwgl$(data, this.myBinOptions_0);\n if (tmp$ == null) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }var levels = tmp$;\n var pathListByLevel = ContourStatUtil_getInstance().computeContours_jco5dt$(data, levels);\n var xRange = ensureNotNull(data.range_8xm3sj$(TransformVar_getInstance().X));\n var yRange = ensureNotNull(data.range_8xm3sj$(TransformVar_getInstance().Y));\n var zRange = ensureNotNull(data.range_8xm3sj$(TransformVar_getInstance().Z));\n var helper = new ContourFillHelper(xRange, yRange);\n var fillLevels = ContourFillHelper$Companion_getInstance().computeFillLevels_4v6zbb$(zRange, levels);\n var polygonListByFillLevel = helper.createPolygons_lrt0be$(pathListByLevel, levels, fillLevels);\n return Contour$Companion_getInstance().getPolygonDataFrame_dnsuee$(fillLevels, polygonListByFillLevel);\n };\n function ContourfStat$Companion() {\n ContourfStat$Companion_instance = this;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y)]);\n }\n ContourfStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContourfStat$Companion_instance = null;\n function ContourfStat$Companion_getInstance() {\n if (ContourfStat$Companion_instance === null) {\n new ContourfStat$Companion();\n }return ContourfStat$Companion_instance;\n }\n ContourfStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContourfStat',\n interfaces: [BaseStat]\n };\n function CorrelationStat(correlationMethod, type, fillDiagonal, threshold) {\n CorrelationStat$Companion_getInstance();\n BaseStat.call(this, CorrelationStat$Companion_getInstance().DEF_MAPPING_0);\n this.correlationMethod = correlationMethod;\n this.type = type;\n this.fillDiagonal = fillDiagonal;\n this.threshold = threshold;\n }\n CorrelationStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n if (!(this.correlationMethod === CorrelationStat$Method$PEARSON_getInstance())) {\n var message = 'Unsupported correlation method: ' + this.correlationMethod + ' (only Pearson is currently available)';\n throw IllegalArgumentException_init(message.toString());\n }if (!rangeTo(0.0, 1.0).contains_mef7kx$(this.threshold)) {\n var message_0 = 'Threshold value: ' + this.threshold + ' must be in interval [0.0, 1.0]';\n throw IllegalArgumentException_init(message_0.toString());\n }var cm = CorrelationUtil_getInstance().correlationMatrix_ofg6u8$(data, this.type, this.fillDiagonal, getCallableRef('correlationPearson', function (p1, p2) {\n return correlationPearson(p1, p2);\n }), this.threshold);\n var values = cm.getNumeric_8xm3sj$(Stats_getInstance().CORR);\n var destination = ArrayList_init_1(collectionSizeOrDefault(values, 10));\n var tmp$;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(item != null ? JsMath.abs(item) : null);\n }\n var abs = destination;\n return cm.builder().putNumeric_s1rqo9$(Stats_getInstance().CORR_ABS, abs).build();\n };\n CorrelationStat.prototype.consumes = function () {\n return emptyList();\n };\n function CorrelationStat$Method(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function CorrelationStat$Method_initFields() {\n CorrelationStat$Method_initFields = function () {\n };\n CorrelationStat$Method$PEARSON_instance = new CorrelationStat$Method('PEARSON', 0);\n CorrelationStat$Method$SPEARMAN_instance = new CorrelationStat$Method('SPEARMAN', 1);\n CorrelationStat$Method$KENDALL_instance = new CorrelationStat$Method('KENDALL', 2);\n }\n var CorrelationStat$Method$PEARSON_instance;\n function CorrelationStat$Method$PEARSON_getInstance() {\n CorrelationStat$Method_initFields();\n return CorrelationStat$Method$PEARSON_instance;\n }\n var CorrelationStat$Method$SPEARMAN_instance;\n function CorrelationStat$Method$SPEARMAN_getInstance() {\n CorrelationStat$Method_initFields();\n return CorrelationStat$Method$SPEARMAN_instance;\n }\n var CorrelationStat$Method$KENDALL_instance;\n function CorrelationStat$Method$KENDALL_getInstance() {\n CorrelationStat$Method_initFields();\n return CorrelationStat$Method$KENDALL_instance;\n }\n CorrelationStat$Method.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Method',\n interfaces: [Enum]\n };\n function CorrelationStat$Method$values() {\n return [CorrelationStat$Method$PEARSON_getInstance(), CorrelationStat$Method$SPEARMAN_getInstance(), CorrelationStat$Method$KENDALL_getInstance()];\n }\n CorrelationStat$Method.values = CorrelationStat$Method$values;\n function CorrelationStat$Method$valueOf(name) {\n switch (name) {\n case 'PEARSON':\n return CorrelationStat$Method$PEARSON_getInstance();\n case 'SPEARMAN':\n return CorrelationStat$Method$SPEARMAN_getInstance();\n case 'KENDALL':\n return CorrelationStat$Method$KENDALL_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.CorrelationStat.Method.' + name);\n }\n }\n CorrelationStat$Method.valueOf_61zpoe$ = CorrelationStat$Method$valueOf;\n function CorrelationStat$Type(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function CorrelationStat$Type_initFields() {\n CorrelationStat$Type_initFields = function () {\n };\n CorrelationStat$Type$FULL_instance = new CorrelationStat$Type('FULL', 0);\n CorrelationStat$Type$UPPER_instance = new CorrelationStat$Type('UPPER', 1);\n CorrelationStat$Type$LOWER_instance = new CorrelationStat$Type('LOWER', 2);\n }\n var CorrelationStat$Type$FULL_instance;\n function CorrelationStat$Type$FULL_getInstance() {\n CorrelationStat$Type_initFields();\n return CorrelationStat$Type$FULL_instance;\n }\n var CorrelationStat$Type$UPPER_instance;\n function CorrelationStat$Type$UPPER_getInstance() {\n CorrelationStat$Type_initFields();\n return CorrelationStat$Type$UPPER_instance;\n }\n var CorrelationStat$Type$LOWER_instance;\n function CorrelationStat$Type$LOWER_getInstance() {\n CorrelationStat$Type_initFields();\n return CorrelationStat$Type$LOWER_instance;\n }\n CorrelationStat$Type.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Type',\n interfaces: [Enum]\n };\n function CorrelationStat$Type$values() {\n return [CorrelationStat$Type$FULL_getInstance(), CorrelationStat$Type$UPPER_getInstance(), CorrelationStat$Type$LOWER_getInstance()];\n }\n CorrelationStat$Type.values = CorrelationStat$Type$values;\n function CorrelationStat$Type$valueOf(name) {\n switch (name) {\n case 'FULL':\n return CorrelationStat$Type$FULL_getInstance();\n case 'UPPER':\n return CorrelationStat$Type$UPPER_getInstance();\n case 'LOWER':\n return CorrelationStat$Type$LOWER_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.CorrelationStat.Type.' + name);\n }\n }\n CorrelationStat$Type.valueOf_61zpoe$ = CorrelationStat$Type$valueOf;\n function CorrelationStat$Companion() {\n CorrelationStat$Companion_instance = this;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y), to(Aes$Companion_getInstance().COLOR, Stats_getInstance().CORR), to(Aes$Companion_getInstance().FILL, Stats_getInstance().CORR), to(Aes$Companion_getInstance().LABEL, Stats_getInstance().CORR)]);\n this.DEF_CORRELATION_METHOD = CorrelationStat$Method$PEARSON_getInstance();\n this.DEF_TYPE = CorrelationStat$Type$FULL_getInstance();\n this.DEF_FILL_DIAGONAL = true;\n this.DEF_THRESHOLD = 0.0;\n }\n CorrelationStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var CorrelationStat$Companion_instance = null;\n function CorrelationStat$Companion_getInstance() {\n if (CorrelationStat$Companion_instance === null) {\n new CorrelationStat$Companion();\n }return CorrelationStat$Companion_instance;\n }\n CorrelationStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CorrelationStat',\n interfaces: [BaseStat]\n };\n function CorrelationUtil() {\n CorrelationUtil_instance = this;\n }\n CorrelationUtil.prototype.correlation_n2j75g$ = function (lxs, lys, correlationFunction) {\n var tmp$ = allFinite(lxs, lys);\n var xs = tmp$.component1()\n , ys = tmp$.component2();\n return correlationFunction(xs, ys);\n };\n function CorrelationUtil$createComparator$lambda(closure$indexMap) {\n return function (a, b) {\n var tmp$, tmp$_0;\n var tmp$_1;\n if ((tmp$ = closure$indexMap.get_11rb$(a)) != null)\n tmp$_1 = tmp$;\n else {\n throw IllegalStateException_init(('Unknown variable label ' + a + '.').toString());\n }\n var lhsWeight = tmp$_1;\n var tmp$_2;\n if ((tmp$_0 = closure$indexMap.get_11rb$(b)) != null)\n tmp$_2 = tmp$_0;\n else {\n throw IllegalStateException_init(('Unknown variable label ' + b + '.').toString());\n }\n var rhsWeight = tmp$_2;\n return lhsWeight - rhsWeight | 0;\n };\n }\n CorrelationUtil.prototype.createComparator_0 = function (vars) {\n var $receiver = withIndex(vars);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(to(item.value.label, item.index));\n }\n var indexMap = toMap(destination);\n return new Comparator(CorrelationUtil$createComparator$lambda(indexMap));\n };\n function CorrelationUtil$correlationMatrix$addCorrelation(closure$threshold, closure$knownVars, closure$corrData) {\n return function (varX, varY, v) {\n if (JsMath.abs(v) >= closure$threshold) {\n closure$knownVars.add_11rb$(varX);\n closure$knownVars.add_11rb$(varY);\n var $receiver = closure$corrData;\n var key = to(varX, varY);\n $receiver.put_xwzc9p$(key, v);\n }};\n }\n CorrelationUtil.prototype.correlationMatrix_ofg6u8$ = function (data, type, fillDiagonal, correlationFunction, threshold) {\n if (threshold === void 0)\n threshold = CorrelationStat$Companion_getInstance().DEF_THRESHOLD;\n var tmp$, tmp$_0;\n var $receiver = data.variables();\n var destination = ArrayList_init();\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n if (DataFrameUtil_getInstance().isNumeric_vede35$(data, element.name))\n destination.add_11rb$(element);\n }\n var numerics = destination;\n var knownVars = LinkedHashSet_init_0();\n var corrData = LinkedHashMap_init();\n var addCorrelation = CorrelationUtil$correlationMatrix$addCorrelation(threshold, knownVars, corrData);\n var i = 0;\n for (var tmp$_2 = numerics.iterator(); tmp$_2.hasNext(); ++i) {\n var vx = tmp$_2.next();\n var xs = data.getNumeric_8xm3sj$(vx);\n if (fillDiagonal) {\n addCorrelation(vx.label, vx.label, 1.0);\n }for (var j = 0; j < i; j++) {\n var vy = numerics.get_za3lpa$(j);\n var ys = data.getNumeric_8xm3sj$(vy);\n var c = this.correlation_n2j75g$(xs, ys, correlationFunction);\n if (type === CorrelationStat$Type$FULL_getInstance() || type === CorrelationStat$Type$LOWER_getInstance()) {\n addCorrelation(vx.label, vy.label, c);\n }if (type === CorrelationStat$Type$FULL_getInstance() || type === CorrelationStat$Type$UPPER_getInstance()) {\n addCorrelation(vy.label, vx.label, c);\n }}\n }\n var var1 = ArrayList_init();\n var var2 = ArrayList_init();\n var corr = ArrayList_init();\n var sortedVars = sortedWith(knownVars, this.createComparator_0(numerics));\n tmp$ = sortedVars.iterator();\n while (tmp$.hasNext()) {\n var x = tmp$.next();\n tmp$_0 = sortedVars.iterator();\n while (tmp$_0.hasNext()) {\n var y = tmp$_0.next();\n var1.add_11rb$(x);\n var2.add_11rb$(y);\n corr.add_11rb$(corrData.get_11rb$(to(x, y)));\n }\n }\n return DataFrame$DataFrame$Builder_init().putDiscrete_2l962d$(Stats_getInstance().X, var1).putDiscrete_2l962d$(Stats_getInstance().Y, var2).putNumeric_s1rqo9$(Stats_getInstance().CORR, corr).build();\n };\n CorrelationUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'CorrelationUtil',\n interfaces: []\n };\n var CorrelationUtil_instance = null;\n function CorrelationUtil_getInstance() {\n if (CorrelationUtil_instance === null) {\n new CorrelationUtil();\n }return CorrelationUtil_instance;\n }\n function CountStat() {\n CountStat$Companion_getInstance();\n BaseStat.call(this, CountStat$Companion_getInstance().DEF_MAPPING_0);\n }\n CountStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().WEIGHT]);\n };\n CountStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n var tmp$;\n if (!this.hasRequiredValues_xht41f$(data, [Aes$Companion_getInstance().X])) {\n return this.withEmptyStatValues();\n }var valuesX = data.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n var weight = BinStatUtil_getInstance().weightVector_5m8trb$(valuesX.size, data);\n var statX = ArrayList_init();\n var statCount = ArrayList_init();\n var countByX = CountStat$Companion_getInstance().countByX_0(valuesX, weight);\n tmp$ = countByX.keys.iterator();\n while (tmp$.hasNext()) {\n var x = tmp$.next();\n statX.add_11rb$(x);\n statCount.add_11rb$(ensureNotNull(countByX.get_11rb$(x)).get());\n }\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().COUNT, statCount).build();\n };\n function CountStat$Companion() {\n CountStat$Companion_instance = this;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().COUNT)]);\n }\n CountStat$Companion.prototype.countByX_0 = function (valuesX, weight) {\n var result = LinkedHashMap_init();\n for (var i = 0; i !== valuesX.size; ++i) {\n var x = valuesX.get_za3lpa$(i);\n if (data.SeriesUtil.isFinite_yrwdxb$(x)) {\n if (!result.containsKey_11rb$(ensureNotNull(x))) {\n var value = new MutableDouble(0.0);\n result.put_xwzc9p$(x, value);\n }ensureNotNull(result.get_11rb$(x)).getAndAdd_14dthe$(data.SeriesUtil.asFinite_z03gcz$(weight.get_za3lpa$(i), 0.0));\n }}\n return result;\n };\n CountStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var CountStat$Companion_instance = null;\n function CountStat$Companion_getInstance() {\n if (CountStat$Companion_instance === null) {\n new CountStat$Companion();\n }return CountStat$Companion_instance;\n }\n CountStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CountStat',\n interfaces: [BaseStat]\n };\n function Density2dStat(bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth) {\n AbstractDensity2dStat.call(this, bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth);\n }\n Density2dStat.prototype.apply_kdy6bf$$default = function (data_0, statCtx, messageConsumer) {\n var tmp$, tmp$_0, tmp$_1;\n if (!this.hasRequiredValues_xht41f$(data_0, [Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y])) {\n return this.withEmptyStatValues();\n }var xVector = data_0.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n var yVector = data_0.getNumeric_8xm3sj$(TransformVar_getInstance().Y);\n if (xVector.isEmpty()) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }if (xVector.size !== yVector.size) {\n throw RuntimeException_init('len(x)= ' + toString(xVector.size) + ' and len(y)= ' + toString(yVector.size) + \" doesn't match!\");\n }var xRange = statCtx.overallXRange();\n var yRange = statCtx.overallYRange();\n var statX = ArrayList_init();\n var statY = ArrayList_init();\n var statDensity = ArrayList_init();\n var bandWidth = new Float64Array(2);\n bandWidth[0] = this.getBandWidthX_k9kaly$(xVector);\n bandWidth[1] = this.getBandWidthY_k9kaly$(yVector);\n var stepsX = DensityStatUtil_getInstance().createStepValues_1tlvto$(ensureNotNull(xRange), this.nX);\n var stepsY = DensityStatUtil_getInstance().createStepValues_1tlvto$(ensureNotNull(yRange), this.nY);\n var groupWeight = BinStatUtil_getInstance().weightVector_5m8trb$(xVector.size, data_0);\n var matrixX = BlockRealMatrix_init_0(DensityStatUtil_getInstance().createRawMatrix_a6xq99$(xVector, stepsX, this.kernelFun, bandWidth[0], this.adjust, groupWeight));\n var matrixY = BlockRealMatrix_init_0(DensityStatUtil_getInstance().createRawMatrix_a6xq99$(yVector, stepsY, this.kernelFun, bandWidth[1], this.adjust, groupWeight));\n var matrixFinal = matrixY.multiply_1dlv11$(matrixX.transpose());\n tmp$ = this.nY;\n for (var row = 0; row < tmp$; row++) {\n tmp$_0 = this.nX;\n for (var col = 0; col < tmp$_0; col++) {\n statX.add_11rb$(stepsX.get_za3lpa$(col));\n statY.add_11rb$(stepsY.get_za3lpa$(row));\n statDensity.add_11rb$(matrixFinal.getEntry_vux9f0$(row, col) / data.SeriesUtil.sum_k9kaly$(groupWeight));\n }\n }\n if (this.isContour) {\n var zRange = data.SeriesUtil.range_l63ks6$(statDensity);\n tmp$_1 = ContourStatUtil_getInstance().computeLevels_kgz263$(zRange, this.binOptions);\n if (tmp$_1 == null) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }var levels = tmp$_1;\n var pathListByLevel = ContourStatUtil_getInstance().computeContours_cxleoh$(xRange, yRange, this.nX, this.nY, statDensity, levels);\n return Contour$Companion_getInstance().getPathDataFrame_9s3d7f$(levels, pathListByLevel);\n } else {\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().Y, statY).putNumeric_s1rqo9$(Stats_getInstance().DENSITY, statDensity).build();\n }\n };\n Density2dStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Density2dStat',\n interfaces: [AbstractDensity2dStat]\n };\n function Density2dfStat(bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth) {\n AbstractDensity2dStat.call(this, bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth);\n }\n Density2dfStat.prototype.apply_kdy6bf$$default = function (data_0, statCtx, messageConsumer) {\n var tmp$, tmp$_0, tmp$_1;\n if (!this.hasRequiredValues_xht41f$(data_0, [Aes$Companion_getInstance().X, Aes$Companion_getInstance().Y])) {\n return this.withEmptyStatValues();\n }var xVector = data_0.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n var yVector = data_0.getNumeric_8xm3sj$(TransformVar_getInstance().Y);\n if (xVector.isEmpty()) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }if (xVector.size !== yVector.size) {\n throw RuntimeException_init('len(x)= ' + toString(xVector.size) + ' and len(y)= ' + toString(yVector.size) + \" doesn't match!\");\n }var xRange = statCtx.overallXRange();\n var yRange = statCtx.overallYRange();\n var statX = ArrayList_init();\n var statY = ArrayList_init();\n var statDensity = ArrayList_init();\n var bandWidth = new Float64Array(2);\n bandWidth[0] = this.getBandWidthX_k9kaly$(xVector);\n bandWidth[1] = this.getBandWidthY_k9kaly$(yVector);\n var stepsX = DensityStatUtil_getInstance().createStepValues_1tlvto$(ensureNotNull(xRange), this.nX);\n var stepsY = DensityStatUtil_getInstance().createStepValues_1tlvto$(ensureNotNull(yRange), this.nY);\n var groupWeight = BinStatUtil_getInstance().weightVector_5m8trb$(xVector.size, data_0);\n var matrixX = BlockRealMatrix_init_0(DensityStatUtil_getInstance().createRawMatrix_a6xq99$(xVector, stepsX, this.kernelFun, bandWidth[0], this.adjust, groupWeight));\n var matrixY = BlockRealMatrix_init_0(DensityStatUtil_getInstance().createRawMatrix_a6xq99$(yVector, stepsY, this.kernelFun, bandWidth[1], this.adjust, groupWeight));\n var matrixFinal = matrixY.multiply_1dlv11$(matrixX.transpose());\n tmp$ = this.nY;\n for (var row = 0; row < tmp$; row++) {\n tmp$_0 = this.nX;\n for (var col = 0; col < tmp$_0; col++) {\n statX.add_11rb$(stepsX.get_za3lpa$(col));\n statY.add_11rb$(stepsY.get_za3lpa$(row));\n statDensity.add_11rb$(matrixFinal.getEntry_vux9f0$(row, col) / data.SeriesUtil.sum_k9kaly$(groupWeight));\n }\n }\n if (this.isContour) {\n var zRange = data.SeriesUtil.range_l63ks6$(statDensity);\n tmp$_1 = ContourStatUtil_getInstance().computeLevels_kgz263$(zRange, this.binOptions);\n if (tmp$_1 == null) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n }var levels = tmp$_1;\n var pathListByLevel = ContourStatUtil_getInstance().computeContours_cxleoh$(xRange, yRange, this.nX, this.nY, statDensity, levels);\n var helper = new ContourFillHelper(xRange, yRange);\n var fillLevels = ContourFillHelper$Companion_getInstance().computeFillLevels_4v6zbb$(ensureNotNull(zRange), levels);\n var polygonListByFillLevel = helper.createPolygons_lrt0be$(pathListByLevel, levels, fillLevels);\n return Contour$Companion_getInstance().getPolygonDataFrame_dnsuee$(fillLevels.subList_vux9f0$(1, fillLevels.size), polygonListByFillLevel);\n } else {\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().Y, statY).putNumeric_s1rqo9$(Stats_getInstance().DENSITY, statDensity).build();\n }\n };\n Density2dfStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Density2dfStat',\n interfaces: [AbstractDensity2dStat]\n };\n var compareBy$lambda = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function DensityStat(bandWidth, bandWidthMethod, adjust, kernel, n, fullScalMax) {\n DensityStat$Companion_getInstance();\n BaseStat.call(this, DensityStat$Companion_getInstance().DEF_MAPPING_0);\n this.bandWidth_0 = bandWidth;\n this.bandWidthMethod_0 = bandWidthMethod;\n this.adjust_0 = adjust;\n this.kernel_0 = kernel;\n this.n_0 = n;\n this.fullScalMax_0 = fullScalMax;\n if (!(this.n_0 <= 1024)) {\n var message = 'The input n = ' + this.n_0 + ' > ' + '1024' + ' is too large!';\n throw IllegalArgumentException_init(message.toString());\n }}\n DensityStat.prototype.consumes = function () {\n return listOf([Aes$Companion_getInstance().X, Aes$Companion_getInstance().WEIGHT]);\n };\n function DensityStat$apply$lambda(it) {\n return it.first;\n }\n DensityStat.prototype.apply_kdy6bf$$default = function (data_0, statCtx, messageConsumer) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n if (!this.hasRequiredValues_xht41f$(data_0, [Aes$Companion_getInstance().X])) {\n return this.withEmptyStatValues();\n }var xs;\n var weights;\n if (data_0.has_8xm3sj$(TransformVar_getInstance().WEIGHT)) {\n var filtered = data.SeriesUtil.filterFinite_10sy24$(data_0.getNumeric_8xm3sj$(TransformVar_getInstance().X), data_0.getNumeric_8xm3sj$(TransformVar_getInstance().WEIGHT));\n var xsFiltered = filtered.get_za3lpa$(0);\n var weightsFiltered = filtered.get_za3lpa$(1);\n var tmp$_5 = unzip(sortedWith(zip(xsFiltered, weightsFiltered), new Comparator(compareBy$lambda(DensityStat$apply$lambda))));\n var xsSorted = tmp$_5.component1()\n , weightsSorted = tmp$_5.component2();\n xs = xsSorted;\n weights = weightsSorted;\n } else {\n var $receiver = filterNotNull(data_0.getNumeric_8xm3sj$(TransformVar_getInstance().X));\n var destination = ArrayList_init();\n var tmp$_6;\n tmp$_6 = $receiver.iterator();\n while (tmp$_6.hasNext()) {\n var element = tmp$_6.next();\n if (isFinite(element))\n destination.add_11rb$(element);\n }\n xs = sorted(destination);\n var size = xs.size;\n var list = ArrayList_init_1(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(1.0);\n }\n weights = list;\n }\n if (xs.isEmpty())\n return this.withEmptyStatValues();\n var rangeX = (tmp$ = statCtx.overallXRange()) != null ? tmp$ : new ClosedRange(-0.5, 0.5);\n var statX = DensityStatUtil_getInstance().createStepValues_1tlvto$(rangeX, this.n_0);\n var statDensity = ArrayList_init();\n var statCount = ArrayList_init();\n var statScaled = ArrayList_init();\n var bandWidth = (tmp$_0 = this.bandWidth_0) != null ? tmp$_0 : DensityStatUtil_getInstance().bandWidth_whucba$(this.bandWidthMethod_0, xs);\n var kernelFun = DensityStatUtil_getInstance().kernel_uyf859$(this.kernel_0);\n tmp$_1 = xs.size <= this.fullScalMax_0;\n if (tmp$_1 === true)\n tmp$_2 = DensityStatUtil_getInstance().densityFunctionFullScan_hztk2d$(xs, weights, kernelFun, bandWidth, this.adjust_0);\n else if (tmp$_1 === false)\n tmp$_2 = DensityStatUtil_getInstance().densityFunctionFast_hztk2d$(xs, weights, kernelFun, bandWidth, this.adjust_0);\n else\n tmp$_2 = Kotlin.noWhenBranchMatched();\n var densityFunction = tmp$_2;\n var nTotal = sum(weights);\n tmp$_3 = statX.iterator();\n while (tmp$_3.hasNext()) {\n var x = tmp$_3.next();\n var d = densityFunction(x);\n statCount.add_11rb$(d);\n statDensity.add_11rb$(d / nTotal);\n }\n var maxm = ensureNotNull(maxOrNull(statCount));\n tmp$_4 = statCount.iterator();\n while (tmp$_4.hasNext()) {\n var d_0 = tmp$_4.next();\n statScaled.add_11rb$(d_0 / maxm);\n }\n return DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().DENSITY, statDensity).putNumeric_s1rqo9$(Stats_getInstance().COUNT, statCount).putNumeric_s1rqo9$(Stats_getInstance().SCALED, statScaled).build();\n };\n function DensityStat$Kernel(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function DensityStat$Kernel_initFields() {\n DensityStat$Kernel_initFields = function () {\n };\n DensityStat$Kernel$GAUSSIAN_instance = new DensityStat$Kernel('GAUSSIAN', 0);\n DensityStat$Kernel$RECTANGULAR_instance = new DensityStat$Kernel('RECTANGULAR', 1);\n DensityStat$Kernel$TRIANGULAR_instance = new DensityStat$Kernel('TRIANGULAR', 2);\n DensityStat$Kernel$BIWEIGHT_instance = new DensityStat$Kernel('BIWEIGHT', 3);\n DensityStat$Kernel$EPANECHNIKOV_instance = new DensityStat$Kernel('EPANECHNIKOV', 4);\n DensityStat$Kernel$OPTCOSINE_instance = new DensityStat$Kernel('OPTCOSINE', 5);\n DensityStat$Kernel$COSINE_instance = new DensityStat$Kernel('COSINE', 6);\n }\n var DensityStat$Kernel$GAUSSIAN_instance;\n function DensityStat$Kernel$GAUSSIAN_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$GAUSSIAN_instance;\n }\n var DensityStat$Kernel$RECTANGULAR_instance;\n function DensityStat$Kernel$RECTANGULAR_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$RECTANGULAR_instance;\n }\n var DensityStat$Kernel$TRIANGULAR_instance;\n function DensityStat$Kernel$TRIANGULAR_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$TRIANGULAR_instance;\n }\n var DensityStat$Kernel$BIWEIGHT_instance;\n function DensityStat$Kernel$BIWEIGHT_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$BIWEIGHT_instance;\n }\n var DensityStat$Kernel$EPANECHNIKOV_instance;\n function DensityStat$Kernel$EPANECHNIKOV_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$EPANECHNIKOV_instance;\n }\n var DensityStat$Kernel$OPTCOSINE_instance;\n function DensityStat$Kernel$OPTCOSINE_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$OPTCOSINE_instance;\n }\n var DensityStat$Kernel$COSINE_instance;\n function DensityStat$Kernel$COSINE_getInstance() {\n DensityStat$Kernel_initFields();\n return DensityStat$Kernel$COSINE_instance;\n }\n DensityStat$Kernel.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Kernel',\n interfaces: [Enum]\n };\n function DensityStat$Kernel$values() {\n return [DensityStat$Kernel$GAUSSIAN_getInstance(), DensityStat$Kernel$RECTANGULAR_getInstance(), DensityStat$Kernel$TRIANGULAR_getInstance(), DensityStat$Kernel$BIWEIGHT_getInstance(), DensityStat$Kernel$EPANECHNIKOV_getInstance(), DensityStat$Kernel$OPTCOSINE_getInstance(), DensityStat$Kernel$COSINE_getInstance()];\n }\n DensityStat$Kernel.values = DensityStat$Kernel$values;\n function DensityStat$Kernel$valueOf(name) {\n switch (name) {\n case 'GAUSSIAN':\n return DensityStat$Kernel$GAUSSIAN_getInstance();\n case 'RECTANGULAR':\n return DensityStat$Kernel$RECTANGULAR_getInstance();\n case 'TRIANGULAR':\n return DensityStat$Kernel$TRIANGULAR_getInstance();\n case 'BIWEIGHT':\n return DensityStat$Kernel$BIWEIGHT_getInstance();\n case 'EPANECHNIKOV':\n return DensityStat$Kernel$EPANECHNIKOV_getInstance();\n case 'OPTCOSINE':\n return DensityStat$Kernel$OPTCOSINE_getInstance();\n case 'COSINE':\n return DensityStat$Kernel$COSINE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.DensityStat.Kernel.' + name);\n }\n }\n DensityStat$Kernel.valueOf_61zpoe$ = DensityStat$Kernel$valueOf;\n function DensityStat$BandWidthMethod(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function DensityStat$BandWidthMethod_initFields() {\n DensityStat$BandWidthMethod_initFields = function () {\n };\n DensityStat$BandWidthMethod$NRD0_instance = new DensityStat$BandWidthMethod('NRD0', 0);\n DensityStat$BandWidthMethod$NRD_instance = new DensityStat$BandWidthMethod('NRD', 1);\n }\n var DensityStat$BandWidthMethod$NRD0_instance;\n function DensityStat$BandWidthMethod$NRD0_getInstance() {\n DensityStat$BandWidthMethod_initFields();\n return DensityStat$BandWidthMethod$NRD0_instance;\n }\n var DensityStat$BandWidthMethod$NRD_instance;\n function DensityStat$BandWidthMethod$NRD_getInstance() {\n DensityStat$BandWidthMethod_initFields();\n return DensityStat$BandWidthMethod$NRD_instance;\n }\n DensityStat$BandWidthMethod.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BandWidthMethod',\n interfaces: [Enum]\n };\n function DensityStat$BandWidthMethod$values() {\n return [DensityStat$BandWidthMethod$NRD0_getInstance(), DensityStat$BandWidthMethod$NRD_getInstance()];\n }\n DensityStat$BandWidthMethod.values = DensityStat$BandWidthMethod$values;\n function DensityStat$BandWidthMethod$valueOf(name) {\n switch (name) {\n case 'NRD0':\n return DensityStat$BandWidthMethod$NRD0_getInstance();\n case 'NRD':\n return DensityStat$BandWidthMethod$NRD_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.DensityStat.BandWidthMethod.' + name);\n }\n }\n DensityStat$BandWidthMethod.valueOf_61zpoe$ = DensityStat$BandWidthMethod$valueOf;\n function DensityStat$Companion() {\n DensityStat$Companion_instance = this;\n this.DEF_KERNEL = DensityStat$Kernel$GAUSSIAN_getInstance();\n this.DEF_ADJUST = 1.0;\n this.DEF_N = 512;\n this.DEF_BW = DensityStat$BandWidthMethod$NRD0_getInstance();\n this.DEF_FULL_SCAN_MAX = 5000;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().DENSITY)]);\n this.MAX_N_0 = 1024;\n }\n DensityStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DensityStat$Companion_instance = null;\n function DensityStat$Companion_getInstance() {\n if (DensityStat$Companion_instance === null) {\n new DensityStat$Companion();\n }return DensityStat$Companion_instance;\n }\n DensityStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DensityStat',\n interfaces: [BaseStat]\n };\n function DensityStatUtil() {\n DensityStatUtil_instance = this;\n this.DEF_STEP_SIZE_0 = 0.5;\n }\n DensityStatUtil.prototype.stdDev_0 = function (data) {\n var tmp$, tmp$_0;\n var sum = 0.0;\n var counter = 0.0;\n tmp$ = data.iterator();\n while (tmp$.hasNext()) {\n var i = tmp$.next();\n sum += i;\n }\n var mean = sum / data.size;\n tmp$_0 = data.iterator();\n while (tmp$_0.hasNext()) {\n var i_0 = tmp$_0.next();\n var $receiver = i_0 - mean;\n counter += JsMath.pow($receiver, 2.0);\n }\n var x = counter / data.size;\n return JsMath.sqrt(x);\n };\n DensityStatUtil.prototype.bandWidth_whucba$ = function (bw, valuesX) {\n var tmp$;\n var mySize = valuesX.size;\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = valuesX.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (data.SeriesUtil.isFinite_yrwdxb$(element))\n destination.add_11rb$(element);\n }\n var valuesXFinite = Kotlin.isType(tmp$ = destination, List) ? tmp$ : throwCCE();\n var dataSummary = FiveNumberSummary_init(valuesXFinite);\n var myIQR = dataSummary.thirdQuartile - dataSummary.firstQuartile;\n var myStdD = this.stdDev_0(valuesXFinite);\n switch (bw.name) {\n case 'NRD0':\n if (myIQR > 0) {\n var b = myIQR / 1.34;\n var tmp$_1 = 0.9 * JsMath.min(myStdD, b);\n var x = -0.2;\n return tmp$_1 * JsMath.pow(mySize, x);\n }\n if (myStdD > 0) {\n var tmp$_2 = 0.9 * myStdD;\n var x_0 = -0.2;\n return tmp$_2 * JsMath.pow(mySize, x_0);\n }\n break;\n case 'NRD':\n if (myIQR > 0) {\n var b_0 = myIQR / 1.34;\n var tmp$_3 = 1.06 * JsMath.min(myStdD, b_0);\n var x_1 = -0.2;\n return tmp$_3 * JsMath.pow(mySize, x_1);\n }\n if (myStdD > 0) {\n var tmp$_4 = 1.06 * myStdD;\n var x_2 = -0.2;\n return tmp$_4 * JsMath.pow(mySize, x_2);\n }\n break;\n }\n return 1.0;\n };\n function DensityStatUtil$kernel$lambda(value) {\n var x = 2 * math.PI;\n var tmp$ = 1 / JsMath.sqrt(x);\n var x_0 = -0.5 * JsMath.pow(value, 2.0);\n return tmp$ * JsMath.exp(x_0);\n }\n function DensityStatUtil$kernel$lambda_0(value) {\n return JsMath.abs(value) <= 1 ? 0.5 : 0.0;\n }\n function DensityStatUtil$kernel$lambda_1(value) {\n return JsMath.abs(value) <= 1 ? 1 - JsMath.abs(value) : 0.0;\n }\n function DensityStatUtil$kernel$lambda_2(value) {\n var tmp$;\n if (JsMath.abs(value) <= 1) {\n var $receiver = 1 - value * value;\n tmp$ = 0.9375 * JsMath.pow($receiver, 2.0);\n } else\n tmp$ = 0.0;\n return tmp$;\n }\n function DensityStatUtil$kernel$lambda_3(value) {\n return JsMath.abs(value) <= 1 ? 0.75 * (1 - value * value) : 0.0;\n }\n function DensityStatUtil$kernel$lambda_4(value) {\n var tmp$;\n if (JsMath.abs(value) <= 1) {\n var tmp$_0 = math.PI / 4;\n var x = math.PI / 2 * value;\n tmp$ = tmp$_0 * JsMath.cos(x);\n } else\n tmp$ = 0.0;\n return tmp$;\n }\n function DensityStatUtil$kernel$lambda_5(value) {\n var tmp$;\n if (JsMath.abs(value) <= 1) {\n var x = math.PI * value;\n tmp$ = (JsMath.cos(x) + 1) / 2;\n } else\n tmp$ = 0.0;\n return tmp$;\n }\n DensityStatUtil.prototype.kernel_uyf859$ = function (ker) {\n var tmp$;\n switch (ker.name) {\n case 'GAUSSIAN':\n tmp$ = DensityStatUtil$kernel$lambda;\n break;\n case 'RECTANGULAR':\n tmp$ = DensityStatUtil$kernel$lambda_0;\n break;\n case 'TRIANGULAR':\n tmp$ = DensityStatUtil$kernel$lambda_1;\n break;\n case 'BIWEIGHT':\n tmp$ = DensityStatUtil$kernel$lambda_2;\n break;\n case 'EPANECHNIKOV':\n tmp$ = DensityStatUtil$kernel$lambda_3;\n break;\n case 'OPTCOSINE':\n tmp$ = DensityStatUtil$kernel$lambda_4;\n break;\n default:tmp$ = DensityStatUtil$kernel$lambda_5;\n break;\n }\n return tmp$;\n };\n function DensityStatUtil$densityFunctionFullScan$lambda(closure$xs, closure$ker, closure$h, closure$weights) {\n return function (x) {\n var sum = 0.0;\n for (var i = 0; i !== closure$xs.size; ++i) {\n sum += closure$ker((x - closure$xs.get_za3lpa$(i)) / closure$h) * closure$weights.get_za3lpa$(i);\n }\n return sum / closure$h;\n };\n }\n DensityStatUtil.prototype.densityFunctionFullScan_hztk2d$ = function (xs, weights, ker, bw, ad) {\n var h = bw * ad;\n return DensityStatUtil$densityFunctionFullScan$lambda(xs, ker, h, weights);\n };\n function DensityStatUtil$densityFunctionFast$lambda(closure$xs, closure$cutoff, closure$ker, closure$h, closure$weights) {\n return function (x) {\n var tmp$;\n var sum = 0.0;\n var from = binarySearch(closure$xs, x - closure$cutoff);\n if (from < 0) {\n from = (-from | 0) - 1 | 0;\n }var to = binarySearch(closure$xs, x + closure$cutoff);\n if (to < 0) {\n to = (-to | 0) - 1 | 0;\n }tmp$ = to;\n for (var i = from; i < tmp$; i++) {\n sum += closure$ker((x - closure$xs.get_za3lpa$(i)) / closure$h) * closure$weights.get_za3lpa$(i);\n }\n return sum / closure$h;\n };\n }\n DensityStatUtil.prototype.densityFunctionFast_hztk2d$ = function (xs, weights, ker, bw, ad) {\n var h = bw * ad;\n var cutoff = h * 5;\n return DensityStatUtil$densityFunctionFast$lambda(xs, cutoff, ker, h, weights);\n };\n DensityStatUtil.prototype.createStepValues_1tlvto$ = function (range, n) {\n var x = ArrayList_init();\n var min = range.lowerEnd;\n var max = range.upperEnd;\n var step;\n if (max === min) {\n max += this.DEF_STEP_SIZE_0;\n min -= this.DEF_STEP_SIZE_0;\n }step = (max - min) / (n - 1 | 0);\n for (var i = 0; i < n; i++) {\n x.add_11rb$(min + step * i);\n }\n return x;\n };\n DensityStatUtil.prototype.toKernel_61zpoe$ = function (method) {\n var tmp$;\n switch (method) {\n case 'gaussian':\n tmp$ = DensityStat$Kernel$GAUSSIAN_getInstance();\n break;\n case 'rectangular':\n case 'uniform':\n tmp$ = DensityStat$Kernel$RECTANGULAR_getInstance();\n break;\n case 'triangular':\n tmp$ = DensityStat$Kernel$TRIANGULAR_getInstance();\n break;\n case 'biweight':\n case 'quartic':\n tmp$ = DensityStat$Kernel$BIWEIGHT_getInstance();\n break;\n case 'epanechikov':\n case 'parabolic':\n tmp$ = DensityStat$Kernel$EPANECHNIKOV_getInstance();\n break;\n case 'optcosine':\n tmp$ = DensityStat$Kernel$OPTCOSINE_getInstance();\n break;\n case 'cosine':\n tmp$ = DensityStat$Kernel$COSINE_getInstance();\n break;\n default:throw IllegalArgumentException_init(\"Unsupported kernel method: '\" + method + \"'.\" + '\\n' + 'Use one of: gaussian, rectangular, triangular, biweight, epanechikov, optcosine, cos.');\n }\n return tmp$;\n };\n DensityStatUtil.prototype.toBandWidthMethod_61zpoe$ = function (bw) {\n var tmp$;\n switch (bw) {\n case 'nrd0':\n tmp$ = DensityStat$BandWidthMethod$NRD0_getInstance();\n break;\n case 'nrd':\n tmp$ = DensityStat$BandWidthMethod$NRD_getInstance();\n break;\n default:throw IllegalArgumentException_init(\"Unsupported bandwidth method: '\" + bw + \"'.\" + '\\n' + 'Use one of: nrd0, nrd.');\n }\n return tmp$;\n };\n DensityStatUtil.prototype.createRawMatrix_a6xq99$ = function (values, list, ker, bw, ad, weight) {\n var a = bw * ad;\n var n = values.size;\n var x = list.size;\n var array = Array_0(x);\n var tmp$;\n tmp$ = array.length - 1 | 0;\n for (var i = 0; i <= tmp$; i++) {\n array[i] = new Float64Array(n);\n }\n var result = array;\n for (var row = 0; row < x; row++) {\n for (var col = 0; col < n; col++) {\n var tmp$_0 = result[row];\n var tmp$_1 = ker((list.get_za3lpa$(row) - ensureNotNull(values.get_za3lpa$(col))) / a);\n var x_0 = ensureNotNull(weight.get_za3lpa$(col));\n tmp$_0[col] = tmp$_1 * JsMath.sqrt(x_0) / a;\n }\n }\n return result;\n };\n DensityStatUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DensityStatUtil',\n interfaces: []\n };\n var DensityStatUtil_instance = null;\n function DensityStatUtil_getInstance() {\n if (DensityStatUtil_instance === null) {\n new DensityStatUtil();\n }return DensityStatUtil_instance;\n }\n function FiveNumberSummary() {\n this.min = 0;\n this.max = 0;\n this.median = 0;\n this.firstQuartile = 0;\n this.thirdQuartile = 0;\n }\n FiveNumberSummary.prototype.medianAtPointer_0 = function (l, pointer) {\n var tmp$;\n var rint = round(pointer);\n if (pointer === rint) {\n tmp$ = l.get_za3lpa$(numberToInt(pointer));\n } else {\n tmp$ = (l.get_za3lpa$(numberToInt(JsMath.ceil(pointer))) + l.get_za3lpa$(numberToInt(JsMath.floor(pointer)))) / 2.0;\n }\n return tmp$;\n };\n FiveNumberSummary.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n var that = (tmp$_0 = other) == null || Kotlin.isType(tmp$_0, FiveNumberSummary) ? tmp$_0 : throwCCE();\n return Kotlin.compareTo(ensureNotNull(that).min, this.min) === 0 && Kotlin.compareTo(that.max, this.max) === 0 && Kotlin.compareTo(that.median, this.median) === 0 && Kotlin.compareTo(that.firstQuartile, this.firstQuartile) === 0 && Kotlin.compareTo(that.thirdQuartile, this.thirdQuartile) === 0;\n };\n FiveNumberSummary.prototype.hashCode = function () {\n return hashCode([this.min, this.max, this.median, this.firstQuartile, this.thirdQuartile]);\n };\n FiveNumberSummary.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FiveNumberSummary',\n interfaces: []\n };\n function FiveNumberSummary_init(data, $this) {\n $this = $this || Object.create(FiveNumberSummary.prototype);\n FiveNumberSummary.call($this);\n var sorted = Ordering.Companion.natural_dahdeg$().sortedCopy_m5x2f4$(data);\n if (sorted.isEmpty()) {\n $this.thirdQuartile = kotlin_js_internal_DoubleCompanionObject.NaN;\n $this.firstQuartile = $this.thirdQuartile;\n $this.median = $this.firstQuartile;\n $this.max = $this.median;\n $this.min = $this.max;\n } else if (sorted.size === 1) {\n $this.thirdQuartile = sorted.get_za3lpa$(0);\n $this.firstQuartile = $this.thirdQuartile;\n $this.median = $this.firstQuartile;\n $this.max = $this.median;\n $this.min = $this.max;\n } else {\n var maxIndex = sorted.size - 1 | 0;\n $this.min = sorted.get_za3lpa$(0);\n $this.max = sorted.get_za3lpa$(maxIndex);\n $this.median = $this.medianAtPointer_0(sorted, maxIndex * 0.5);\n $this.firstQuartile = $this.medianAtPointer_0(sorted, maxIndex * 0.25);\n $this.thirdQuartile = $this.medianAtPointer_0(sorted, maxIndex * 0.75);\n }\n return $this;\n }\n function FiveNumberSummary_init_0(min, max, median, firstQuartile, thirdQuartile, $this) {\n $this = $this || Object.create(FiveNumberSummary.prototype);\n FiveNumberSummary.call($this);\n $this.min = min;\n $this.max = max;\n $this.median = median;\n $this.firstQuartile = firstQuartile;\n $this.thirdQuartile = thirdQuartile;\n return $this;\n }\n function MultiOrdering(myKeys) {\n this.myKeys_0 = myKeys;\n this.myIndices_0 = null;\n var tmp$;\n this.myIndices_0 = ArrayList_init_1(this.myKeys_0.size);\n tmp$ = this.myKeys_0;\n for (var i = 0; i !== tmp$.size; ++i) {\n this.myIndices_0.add_11rb$(i);\n }\n sortWith(this.myIndices_0, new Comparator(MultiOrdering_init$lambda(this)));\n }\n MultiOrdering.prototype.sortedCopy_bemo1h$ = function (l) {\n var tmp$;\n if (!(l.size === this.myIndices_0.size)) {\n var message = 'Expected size ' + toString(this.myIndices_0.size) + ' but was size ' + toString(l.size);\n throw IllegalArgumentException_init(message.toString());\n }var copy = ArrayList_init_1(this.myIndices_0.size);\n tmp$ = this.myIndices_0.iterator();\n while (tmp$.hasNext()) {\n var oldIndex = tmp$.next();\n var v = l.get_za3lpa$(oldIndex);\n copy.add_11rb$(v);\n }\n return copy;\n };\n MultiOrdering.prototype.sortedCopyOfKeys = function () {\n return this.sortedCopy_bemo1h$(this.myKeys_0);\n };\n function MultiOrdering_init$lambda(this$MultiOrdering) {\n return function (i, j) {\n var keyI = this$MultiOrdering.myKeys_0.get_za3lpa$(ensureNotNull(i));\n var keyJ = this$MultiOrdering.myKeys_0.get_za3lpa$(ensureNotNull(j));\n if (keyI === keyJ)\n return 0;\n else if (keyI == null)\n return -1;\n else if (keyJ == null)\n return 1;\n else\n return Kotlin.compareTo(keyI, keyJ);\n };\n }\n MultiOrdering.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MultiOrdering',\n interfaces: []\n };\n function SimpleStatContext(myDataFrame) {\n this.myDataFrame_0 = myDataFrame;\n }\n SimpleStatContext.prototype.overallXRange = function () {\n return this.myDataFrame_0.range_8xm3sj$(TransformVar_getInstance().X);\n };\n SimpleStatContext.prototype.overallYRange = function () {\n return this.myDataFrame_0.range_8xm3sj$(TransformVar_getInstance().Y);\n };\n SimpleStatContext.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SimpleStatContext',\n interfaces: [StatContext]\n };\n function SmoothStat(smootherPointCount, smoothingMethod, confidenceLevel, displayConfidenceInterval, span, polynomialDegree, loessCriticalSize, samplingSeed) {\n SmoothStat$Companion_getInstance();\n BaseStat.call(this, SmoothStat$Companion_getInstance().DEF_MAPPING_0);\n this.smootherPointCount_0 = smootherPointCount;\n this.smoothingMethod_0 = smoothingMethod;\n this.confidenceLevel_0 = confidenceLevel;\n this.displayConfidenceInterval_0 = displayConfidenceInterval;\n this.span_0 = span;\n this.polynomialDegree_0 = polynomialDegree;\n this.loessCriticalSize_0 = loessCriticalSize;\n this.samplingSeed_0 = samplingSeed;\n }\n SmoothStat.prototype.hasDefaultMapping_896ixz$ = function (aes) {\n return BaseStat.prototype.hasDefaultMapping_896ixz$.call(this, aes) || (equals(aes, Aes$Companion_getInstance().YMIN) && this.displayConfidenceInterval_0) || (equals(aes, Aes$Companion_getInstance().YMAX) && this.displayConfidenceInterval_0);\n };\n SmoothStat.prototype.getDefaultMapping_896ixz$ = function (aes) {\n var tmp$;\n if (equals(aes, Aes$Companion_getInstance().YMIN)) {\n return Stats_getInstance().Y_MIN;\n }if (equals(aes, Aes$Companion_getInstance().YMAX)) {\n tmp$ = Stats_getInstance().Y_MAX;\n } else\n tmp$ = BaseStat.prototype.getDefaultMapping_896ixz$.call(this, aes);\n return tmp$;\n };\n function SmoothStat$Method(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function SmoothStat$Method_initFields() {\n SmoothStat$Method_initFields = function () {\n };\n SmoothStat$Method$LM_instance = new SmoothStat$Method('LM', 0);\n SmoothStat$Method$GLM_instance = new SmoothStat$Method('GLM', 1);\n SmoothStat$Method$GAM_instance = new SmoothStat$Method('GAM', 2);\n SmoothStat$Method$LOESS_instance = new SmoothStat$Method('LOESS', 3);\n SmoothStat$Method$RLM_instance = new SmoothStat$Method('RLM', 4);\n }\n var SmoothStat$Method$LM_instance;\n function SmoothStat$Method$LM_getInstance() {\n SmoothStat$Method_initFields();\n return SmoothStat$Method$LM_instance;\n }\n var SmoothStat$Method$GLM_instance;\n function SmoothStat$Method$GLM_getInstance() {\n SmoothStat$Method_initFields();\n return SmoothStat$Method$GLM_instance;\n }\n var SmoothStat$Method$GAM_instance;\n function SmoothStat$Method$GAM_getInstance() {\n SmoothStat$Method_initFields();\n return SmoothStat$Method$GAM_instance;\n }\n var SmoothStat$Method$LOESS_instance;\n function SmoothStat$Method$LOESS_getInstance() {\n SmoothStat$Method_initFields();\n return SmoothStat$Method$LOESS_instance;\n }\n var SmoothStat$Method$RLM_instance;\n function SmoothStat$Method$RLM_getInstance() {\n SmoothStat$Method_initFields();\n return SmoothStat$Method$RLM_instance;\n }\n SmoothStat$Method.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Method',\n interfaces: [Enum]\n };\n function SmoothStat$Method$values() {\n return [SmoothStat$Method$LM_getInstance(), SmoothStat$Method$GLM_getInstance(), SmoothStat$Method$GAM_getInstance(), SmoothStat$Method$LOESS_getInstance(), SmoothStat$Method$RLM_getInstance()];\n }\n SmoothStat$Method.values = SmoothStat$Method$values;\n function SmoothStat$Method$valueOf(name) {\n switch (name) {\n case 'LM':\n return SmoothStat$Method$LM_getInstance();\n case 'GLM':\n return SmoothStat$Method$GLM_getInstance();\n case 'GAM':\n return SmoothStat$Method$GAM_getInstance();\n case 'LOESS':\n return SmoothStat$Method$LOESS_getInstance();\n case 'RLM':\n return SmoothStat$Method$RLM_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.SmoothStat.Method.' + name);\n }\n }\n SmoothStat$Method.valueOf_61zpoe$ = SmoothStat$Method$valueOf;\n function SmoothStat$Companion() {\n SmoothStat$Companion_instance = this;\n this.DEF_MAPPING_0 = mapOf([to(Aes$Companion_getInstance().X, Stats_getInstance().X), to(Aes$Companion_getInstance().Y, Stats_getInstance().Y)]);\n this.DEF_EVAL_POINT_COUNT = 80;\n this.DEF_SMOOTHING_METHOD = SmoothStat$Method$LM_getInstance();\n this.DEF_CONFIDENCE_LEVEL = 0.95;\n this.DEF_DISPLAY_CONFIDENCE_INTERVAL = true;\n this.DEF_SPAN = 0.5;\n this.DEF_DEG = 1;\n this.DEF_LOESS_CRITICAL_SIZE = 1000;\n this.DEF_SAMPLING_SEED = L37;\n }\n SmoothStat$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SmoothStat$Companion_instance = null;\n function SmoothStat$Companion_getInstance() {\n if (SmoothStat$Companion_instance === null) {\n new SmoothStat$Companion();\n }return SmoothStat$Companion_instance;\n }\n SmoothStat.prototype.consumes = function () {\n return listOf_0(Aes$Companion_getInstance().Y);\n };\n SmoothStat.prototype.needSampling_za3lpa$ = function (rowCount) {\n if (this.smoothingMethod_0 !== SmoothStat$Method$LOESS_getInstance()) {\n return false;\n }if (rowCount <= this.loessCriticalSize_0) {\n return false;\n }return true;\n };\n SmoothStat.prototype.applySampling_0 = function (data, messageConsumer) {\n var msg = 'LOESS drew a random sample with max_n=' + this.loessCriticalSize_0 + ', seed=' + this.samplingSeed_0.toString();\n messageConsumer(msg);\n return SamplingUtil_getInstance().sampleWithoutReplacement_egh5ya$(this.loessCriticalSize_0, Random_0(this.samplingSeed_0), data);\n };\n SmoothStat.prototype.apply_kdy6bf$$default = function (data_0, statCtx, messageConsumer) {\n if (!this.hasRequiredValues_xht41f$(data_0, [Aes$Companion_getInstance().Y])) {\n return this.withEmptyStatValues();\n }var data_1 = data_0;\n if (this.needSampling_za3lpa$(data_1.rowCount())) {\n data_1 = this.applySampling_0(data_1, messageConsumer);\n }var valuesY = data_1.getNumeric_8xm3sj$(TransformVar_getInstance().Y);\n if (valuesY.size < 3) {\n return this.withEmptyStatValues();\n }var valuesX;\n if (data_1.has_8xm3sj$(TransformVar_getInstance().X)) {\n valuesX = data_1.getNumeric_8xm3sj$(TransformVar_getInstance().X);\n } else {\n valuesX = ArrayList_init();\n for (var i = 0; i !== valuesY.size; ++i) {\n valuesX.add_11rb$(i);\n }\n }\n if (data.SeriesUtil.range_l63ks6$(valuesX) == null)\n return this.withEmptyStatValues();\n var statX;\n var statY;\n var statMinY;\n var statMaxY;\n var statSE;\n var statValues = this.applySmoothing_0(valuesX, valuesY);\n statX = ensureNotNull(statValues.get_11rb$(Stats_getInstance().X));\n statY = ensureNotNull(statValues.get_11rb$(Stats_getInstance().Y));\n statMinY = ensureNotNull(statValues.get_11rb$(Stats_getInstance().Y_MIN));\n statMaxY = ensureNotNull(statValues.get_11rb$(Stats_getInstance().Y_MAX));\n statSE = ensureNotNull(statValues.get_11rb$(Stats_getInstance().SE));\n var statData = DataFrame$DataFrame$Builder_init().putNumeric_s1rqo9$(Stats_getInstance().X, statX).putNumeric_s1rqo9$(Stats_getInstance().Y, statY);\n if (this.displayConfidenceInterval_0) {\n statData.putNumeric_s1rqo9$(Stats_getInstance().Y_MIN, statMinY).putNumeric_s1rqo9$(Stats_getInstance().Y_MAX, statMaxY).putNumeric_s1rqo9$(Stats_getInstance().SE, statSE);\n }return statData.build();\n };\n SmoothStat.prototype.applySmoothing_0 = function (valuesX, valuesY) {\n var tmp$, tmp$_0, tmp$_1;\n var statX = ArrayList_init();\n var statY = ArrayList_init();\n var statMinY = ArrayList_init();\n var statMaxY = ArrayList_init();\n var statSE = ArrayList_init();\n var result = HashMap_init();\n var key = Stats_getInstance().X;\n result.put_xwzc9p$(key, statX);\n var key_0 = Stats_getInstance().Y;\n result.put_xwzc9p$(key_0, statY);\n var key_1 = Stats_getInstance().Y_MIN;\n result.put_xwzc9p$(key_1, statMinY);\n var key_2 = Stats_getInstance().Y_MAX;\n result.put_xwzc9p$(key_2, statMaxY);\n var key_3 = Stats_getInstance().SE;\n result.put_xwzc9p$(key_3, statSE);\n switch (this.smoothingMethod_0.name) {\n case 'LM':\n if (!(this.polynomialDegree_0 >= 1)) {\n var message = 'Degree of polynomial regression must be at least 1';\n throw IllegalArgumentException_init(message.toString());\n }\n if (this.polynomialDegree_0 === 1) {\n tmp$ = new LinearRegression(valuesX, valuesY, this.confidenceLevel_0);\n } else {\n if (PolynomialRegression$Companion_getInstance().canBeComputed_fgqkrm$(valuesX, valuesY, this.polynomialDegree_0)) {\n tmp$ = new PolynomialRegression(valuesX, valuesY, this.confidenceLevel_0, this.polynomialDegree_0);\n } else {\n return result;\n }\n }\n\n break;\n case 'LOESS':\n var evaluator = new LocalPolynomialRegression(valuesX, valuesY, this.confidenceLevel_0, this.span_0);\n if (evaluator.canCompute) {\n tmp$ = evaluator;\n } else {\n return result;\n }\n\n break;\n default:throw IllegalArgumentException_init('Unsupported smoother method: ' + this.smoothingMethod_0 + \" (only 'lm' and 'loess' methods are currently available)\");\n }\n var regression = tmp$;\n tmp$_0 = data.SeriesUtil.range_l63ks6$(valuesX);\n if (tmp$_0 == null) {\n return result;\n }var rangeX = tmp$_0;\n var startX = rangeX.lowerEnd;\n var spanX = rangeX.upperEnd - startX;\n var stepX = spanX / (this.smootherPointCount_0 - 1 | 0);\n tmp$_1 = this.smootherPointCount_0;\n for (var i = 0; i < tmp$_1; i++) {\n var x = startX + i * stepX;\n var eval_0 = regression.evalX_14dthe$(coerceIn(x, rangeX.lowerEnd, rangeX.upperEnd));\n statX.add_11rb$(x);\n statY.add_11rb$(eval_0.y);\n statMinY.add_11rb$(eval_0.ymin);\n statMaxY.add_11rb$(eval_0.ymax);\n statSE.add_11rb$(eval_0.se);\n }\n return result;\n };\n SmoothStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SmoothStat',\n interfaces: [BaseStat]\n };\n function Stats() {\n Stats_instance = this;\n this.X = new DataFrame$Variable('..x..', DataFrame$Variable$Source$STAT_getInstance(), 'x');\n this.Y = new DataFrame$Variable('..y..', DataFrame$Variable$Source$STAT_getInstance(), 'y');\n this.COUNT = new DataFrame$Variable('..count..', DataFrame$Variable$Source$STAT_getInstance(), 'count');\n this.DENSITY = new DataFrame$Variable('..density..', DataFrame$Variable$Source$STAT_getInstance(), 'density');\n this.Y_MIN = new DataFrame$Variable('..ymin..', DataFrame$Variable$Source$STAT_getInstance(), 'y min');\n this.Y_MAX = new DataFrame$Variable('..ymax..', DataFrame$Variable$Source$STAT_getInstance(), 'y max');\n this.SE = new DataFrame$Variable('..se..', DataFrame$Variable$Source$STAT_getInstance(), 'standard error');\n this.LEVEL = new DataFrame$Variable('..level..', DataFrame$Variable$Source$STAT_getInstance(), 'level');\n this.LOWER = new DataFrame$Variable('..lower..', DataFrame$Variable$Source$STAT_getInstance(), 'lower');\n this.MIDDLE = new DataFrame$Variable('..middle..', DataFrame$Variable$Source$STAT_getInstance(), 'middle');\n this.UPPER = new DataFrame$Variable('..upper..', DataFrame$Variable$Source$STAT_getInstance(), 'upper');\n this.WIDTH = new DataFrame$Variable('..width..', DataFrame$Variable$Source$STAT_getInstance(), 'width');\n this.CORR = new DataFrame$Variable('..corr..', DataFrame$Variable$Source$STAT_getInstance(), 'corr');\n this.CORR_ABS = new DataFrame$Variable('..corr_abs..', DataFrame$Variable$Source$STAT_getInstance(), 'corr_abs');\n this.SCALED = new DataFrame$Variable('..scaled..', DataFrame$Variable$Source$STAT_getInstance(), 'scaled');\n this.GROUP = new DataFrame$Variable('..group..', DataFrame$Variable$Source$STAT_getInstance(), 'group');\n this.IDENTITY = new Stats$IdentityStat();\n var tmp$;\n var variableList = listOf([this.X, this.Y, this.COUNT, this.DENSITY, this.Y_MIN, this.Y_MAX, this.SE, this.LEVEL, this.LOWER, this.MIDDLE, this.UPPER, this.WIDTH, this.SCALED, this.GROUP, this.CORR, this.CORR_ABS]);\n var result = HashMap_init();\n tmp$ = variableList.iterator();\n while (tmp$.hasNext()) {\n var variable = tmp$.next();\n var key = variable.name;\n result.put_xwzc9p$(key, variable);\n }\n this.VARS_0 = result;\n }\n Stats.prototype.isStatVar_61zpoe$ = function (varName) {\n return this.VARS_0.containsKey_11rb$(varName);\n };\n Stats.prototype.statVar_61zpoe$ = function (varName) {\n if (!this.VARS_0.containsKey_11rb$(varName)) {\n var message = 'Unknown stat variable ' + varName;\n throw IllegalArgumentException_init(message.toString());\n }return ensureNotNull(this.VARS_0.get_11rb$(varName));\n };\n Stats.prototype.defaultMapping_qbwusa$ = function (stat) {\n var tmp$;\n var map = HashMap_init();\n tmp$ = Aes$Companion_getInstance().values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n if (stat.hasDefaultMapping_896ixz$(aes)) {\n var variable = stat.getDefaultMapping_896ixz$(aes);\n map.put_xwzc9p$(aes, variable);\n }}\n return map;\n };\n Stats.prototype.count = function () {\n return new CountStat();\n };\n Stats.prototype.bin_yyf5ez$ = function (binCount, binWidth, center, boundary) {\n if (binCount === void 0)\n binCount = 30;\n if (binWidth === void 0)\n binWidth = null;\n if (center === void 0)\n center = null;\n if (boundary === void 0)\n boundary = null;\n var xPosKind = BinStat$XPosKind$NONE_getInstance();\n var xPosValue = 0.0;\n if (boundary != null) {\n xPosKind = BinStat$XPosKind$BOUNDARY_getInstance();\n xPosValue = boundary;\n } else if (center != null) {\n xPosKind = BinStat$XPosKind$CENTER_getInstance();\n xPosValue = center;\n }return new BinStat(binCount, binWidth, xPosKind, xPosValue);\n };\n Stats.prototype.smooth_aam2id$ = function (smootherPointCount, smoothingMethod, confidenceLevel, displayConfidenceInterval, span, polynomialDegree, loessCriticalSize, samplingSeed) {\n if (smootherPointCount === void 0)\n smootherPointCount = 80;\n if (smoothingMethod === void 0)\n smoothingMethod = SmoothStat$Companion_getInstance().DEF_SMOOTHING_METHOD;\n if (confidenceLevel === void 0)\n confidenceLevel = SmoothStat$Companion_getInstance().DEF_CONFIDENCE_LEVEL;\n if (displayConfidenceInterval === void 0)\n displayConfidenceInterval = SmoothStat$Companion_getInstance().DEF_DISPLAY_CONFIDENCE_INTERVAL;\n if (span === void 0)\n span = SmoothStat$Companion_getInstance().DEF_SPAN;\n if (polynomialDegree === void 0)\n polynomialDegree = 1;\n if (loessCriticalSize === void 0)\n loessCriticalSize = 1000;\n if (samplingSeed === void 0)\n samplingSeed = SmoothStat$Companion_getInstance().DEF_SAMPLING_SEED;\n return new SmoothStat(smootherPointCount, smoothingMethod, confidenceLevel, displayConfidenceInterval, span, polynomialDegree, loessCriticalSize, samplingSeed);\n };\n Stats.prototype.corr_6cvmjw$ = function (correlationMethod, type, fillDiagonal, threshold) {\n if (correlationMethod === void 0)\n correlationMethod = CorrelationStat$Companion_getInstance().DEF_CORRELATION_METHOD;\n if (type === void 0)\n type = CorrelationStat$Companion_getInstance().DEF_TYPE;\n if (fillDiagonal === void 0)\n fillDiagonal = CorrelationStat$Companion_getInstance().DEF_FILL_DIAGONAL;\n if (threshold === void 0)\n threshold = CorrelationStat$Companion_getInstance().DEF_THRESHOLD;\n return new CorrelationStat(correlationMethod, type, fillDiagonal, threshold);\n };\n Stats.prototype.contour_tvwy6j$ = function (binCount, binWidth) {\n if (binCount === void 0)\n binCount = 10;\n if (binWidth === void 0)\n binWidth = null;\n return new ContourStat(binCount, binWidth);\n };\n Stats.prototype.contourf_tvwy6j$ = function (binCount, binWidth) {\n if (binCount === void 0)\n binCount = 10;\n if (binWidth === void 0)\n binWidth = null;\n return new ContourfStat(binCount, binWidth);\n };\n Stats.prototype.boxplot_8555vt$ = function (whiskerIQRRatio, computeWidth) {\n if (whiskerIQRRatio === void 0)\n whiskerIQRRatio = BoxplotStat$Companion_getInstance().DEF_WHISKER_IQR_RATIO;\n if (computeWidth === void 0)\n computeWidth = BoxplotStat$Companion_getInstance().DEF_COMPUTE_WIDTH;\n return new BoxplotStat(whiskerIQRRatio, computeWidth);\n };\n Stats.prototype.density_s1yna4$ = function (bandWidth, bandWidthMethod, adjust, kernel, n, fullScalMax) {\n if (bandWidth === void 0)\n bandWidth = null;\n if (bandWidthMethod === void 0)\n bandWidthMethod = DensityStat$Companion_getInstance().DEF_BW;\n if (adjust === void 0)\n adjust = DensityStat$Companion_getInstance().DEF_ADJUST;\n if (kernel === void 0)\n kernel = DensityStat$Companion_getInstance().DEF_KERNEL;\n if (n === void 0)\n n = 512;\n if (fullScalMax === void 0)\n fullScalMax = 5000;\n return new DensityStat(bandWidth, bandWidthMethod, adjust, kernel, n, fullScalMax);\n };\n Stats.prototype.density2d_izm592$ = function (bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth) {\n if (bandWidthX === void 0)\n bandWidthX = null;\n if (bandWidthY === void 0)\n bandWidthY = null;\n if (bandWidthMethod === void 0)\n bandWidthMethod = AbstractDensity2dStat$Companion_getInstance().DEF_BW;\n if (adjust === void 0)\n adjust = AbstractDensity2dStat$Companion_getInstance().DEF_ADJUST;\n if (kernel === void 0)\n kernel = AbstractDensity2dStat$Companion_getInstance().DEF_KERNEL;\n if (nX === void 0)\n nX = 100;\n if (nY === void 0)\n nY = 100;\n if (isContour === void 0)\n isContour = AbstractDensity2dStat$Companion_getInstance().DEF_CONTOUR;\n if (binCount === void 0)\n binCount = 10;\n if (binWidth === void 0)\n binWidth = AbstractDensity2dStat$Companion_getInstance().DEF_BIN_WIDTH;\n return new Density2dStat(bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth);\n };\n Stats.prototype.density2df_izm592$ = function (bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth) {\n if (bandWidthX === void 0)\n bandWidthX = null;\n if (bandWidthY === void 0)\n bandWidthY = null;\n if (adjust === void 0)\n adjust = AbstractDensity2dStat$Companion_getInstance().DEF_ADJUST;\n if (kernel === void 0)\n kernel = AbstractDensity2dStat$Companion_getInstance().DEF_KERNEL;\n if (nX === void 0)\n nX = 100;\n if (nY === void 0)\n nY = 100;\n if (isContour === void 0)\n isContour = AbstractDensity2dStat$Companion_getInstance().DEF_CONTOUR;\n if (binCount === void 0)\n binCount = 10;\n if (binWidth === void 0)\n binWidth = AbstractDensity2dStat$Companion_getInstance().DEF_BIN_WIDTH;\n return new Density2dfStat(bandWidthX, bandWidthY, bandWidthMethod, adjust, kernel, nX, nY, isContour, binCount, binWidth);\n };\n function Stats$IdentityStat() {\n BaseStat.call(this, emptyMap());\n }\n Stats$IdentityStat.prototype.apply_kdy6bf$$default = function (data, statCtx, messageConsumer) {\n return DataFrame$Builder$Companion_getInstance().emptyFrame();\n };\n Stats$IdentityStat.prototype.consumes = function () {\n return emptyList();\n };\n Stats$IdentityStat.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'IdentityStat',\n interfaces: [BaseStat]\n };\n Stats.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Stats',\n interfaces: []\n };\n var Stats_instance = null;\n function Stats_getInstance() {\n if (Stats_instance === null) {\n new Stats();\n }return Stats_instance;\n }\n function AbstractRealDistribution() {\n AbstractRealDistribution$Companion_getInstance();\n this.solverAbsoluteAccuracy_ojqt9g$_0 = AbstractRealDistribution$Companion_getInstance().SOLVER_DEFAULT_ABSOLUTE_ACCURACY;\n }\n Object.defineProperty(AbstractRealDistribution.prototype, 'solverAbsoluteAccuracy', {\n configurable: true,\n get: function () {\n return this.solverAbsoluteAccuracy_ojqt9g$_0;\n }\n });\n AbstractRealDistribution.prototype.cumulativeProbability_lu1900$ = function (x0, x1) {\n if (x0 > x1) {\n throw IllegalStateException_init(('NumberIsTooLarge - x0:' + x0 + ', x1:' + x1).toString());\n }return this.cumulativeProbability_14dthe$(x1) - this.cumulativeProbability_14dthe$(x0);\n };\n function AbstractRealDistribution$inverseCumulativeProbability$ObjectLiteral(this$AbstractRealDistribution, closure$p) {\n this.this$AbstractRealDistribution = this$AbstractRealDistribution;\n this.closure$p = closure$p;\n }\n AbstractRealDistribution$inverseCumulativeProbability$ObjectLiteral.prototype.value_14dthe$ = function (x) {\n return this.this$AbstractRealDistribution.cumulativeProbability_14dthe$(x) - this.closure$p;\n };\n AbstractRealDistribution$inverseCumulativeProbability$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [UnivariateFunction]\n };\n AbstractRealDistribution.prototype.inverseCumulativeProbability_14dthe$ = function (p) {\n if (p < 0.0 || p > 1.0) {\n throw IllegalStateException_init(('OutOfRange [0, 1] - p' + p).toString());\n }var lowerBound = this.supportLowerBound;\n if (p === 0.0) {\n return lowerBound;\n }var upperBound = this.supportUpperBound;\n if (p === 1.0) {\n return upperBound;\n }var mu = this.numericalMean;\n var x = this.numericalVariance;\n var sig = JsMath.sqrt(x);\n var chebyshevApplies;\n chebyshevApplies = !(isInfinite(mu) || isNaN_0(mu) || isInfinite(sig) || isNaN_0(sig));\n if (lowerBound === kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY) {\n if (chebyshevApplies) {\n var x_0 = (1.0 - p) / p;\n lowerBound = mu - sig * JsMath.sqrt(x_0);\n } else {\n lowerBound = -1.0;\n while (this.cumulativeProbability_14dthe$(lowerBound) >= p) {\n lowerBound *= 2.0;\n }\n }\n }if (upperBound === kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY) {\n if (chebyshevApplies) {\n var x_1 = p / (1.0 - p);\n upperBound = mu + sig * JsMath.sqrt(x_1);\n } else {\n upperBound = 1.0;\n while (this.cumulativeProbability_14dthe$(upperBound) < p) {\n upperBound *= 2.0;\n }\n }\n }var toSolve = new AbstractRealDistribution$inverseCumulativeProbability$ObjectLiteral(this, p);\n var x_2 = UnivariateSolverUtils_getInstance().solve_wb66u3$(toSolve, lowerBound, upperBound, this.solverAbsoluteAccuracy);\n if (!this.isSupportConnected) {\n var dx = this.solverAbsoluteAccuracy;\n if (x_2 - dx >= this.supportLowerBound) {\n var px = this.cumulativeProbability_14dthe$(x_2);\n if (this.cumulativeProbability_14dthe$(x_2 - dx) === px) {\n upperBound = x_2;\n while (upperBound - lowerBound > dx) {\n var midPoint = 0.5 * (lowerBound + upperBound);\n if (this.cumulativeProbability_14dthe$(midPoint) < px) {\n lowerBound = midPoint;\n } else {\n upperBound = midPoint;\n }\n }\n return upperBound;\n }}}return x_2;\n };\n function AbstractRealDistribution$Companion() {\n AbstractRealDistribution$Companion_instance = this;\n this.SOLVER_DEFAULT_ABSOLUTE_ACCURACY = 1.0E-6;\n this.serialVersionUID_0 = L_38038050983108802;\n }\n AbstractRealDistribution$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AbstractRealDistribution$Companion_instance = null;\n function AbstractRealDistribution$Companion_getInstance() {\n if (AbstractRealDistribution$Companion_instance === null) {\n new AbstractRealDistribution$Companion();\n }return AbstractRealDistribution$Companion_instance;\n }\n AbstractRealDistribution.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractRealDistribution',\n interfaces: [RealDistribution]\n };\n function AbstractUnivariateSolver() {\n }\n AbstractUnivariateSolver.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractUnivariateSolver',\n interfaces: [UnivariateSolver, BaseAbstractUnivariateSolver]\n };\n function AbstractUnivariateSolver_init(absoluteAccuracy, $this) {\n $this = $this || Object.create(AbstractUnivariateSolver.prototype);\n BaseAbstractUnivariateSolver_init(absoluteAccuracy, $this);\n AbstractUnivariateSolver.call($this);\n return $this;\n }\n function AbstractUnivariateSolver_init_0(relativeAccuracy, absoluteAccuracy, $this) {\n $this = $this || Object.create(AbstractUnivariateSolver.prototype);\n BaseAbstractUnivariateSolver.call($this, relativeAccuracy, absoluteAccuracy);\n AbstractUnivariateSolver.call($this);\n return $this;\n }\n function AbstractUnivariateSolver_init_1(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, $this) {\n $this = $this || Object.create(AbstractUnivariateSolver.prototype);\n BaseAbstractUnivariateSolver.call($this, relativeAccuracy, absoluteAccuracy, functionValueAccuracy);\n AbstractUnivariateSolver.call($this);\n return $this;\n }\n function AllowedSolution(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function AllowedSolution_initFields() {\n AllowedSolution_initFields = function () {\n };\n AllowedSolution$ANY_SIDE_instance = new AllowedSolution('ANY_SIDE', 0);\n AllowedSolution$LEFT_SIDE_instance = new AllowedSolution('LEFT_SIDE', 1);\n AllowedSolution$RIGHT_SIDE_instance = new AllowedSolution('RIGHT_SIDE', 2);\n AllowedSolution$BELOW_SIDE_instance = new AllowedSolution('BELOW_SIDE', 3);\n AllowedSolution$ABOVE_SIDE_instance = new AllowedSolution('ABOVE_SIDE', 4);\n }\n var AllowedSolution$ANY_SIDE_instance;\n function AllowedSolution$ANY_SIDE_getInstance() {\n AllowedSolution_initFields();\n return AllowedSolution$ANY_SIDE_instance;\n }\n var AllowedSolution$LEFT_SIDE_instance;\n function AllowedSolution$LEFT_SIDE_getInstance() {\n AllowedSolution_initFields();\n return AllowedSolution$LEFT_SIDE_instance;\n }\n var AllowedSolution$RIGHT_SIDE_instance;\n function AllowedSolution$RIGHT_SIDE_getInstance() {\n AllowedSolution_initFields();\n return AllowedSolution$RIGHT_SIDE_instance;\n }\n var AllowedSolution$BELOW_SIDE_instance;\n function AllowedSolution$BELOW_SIDE_getInstance() {\n AllowedSolution_initFields();\n return AllowedSolution$BELOW_SIDE_instance;\n }\n var AllowedSolution$ABOVE_SIDE_instance;\n function AllowedSolution$ABOVE_SIDE_getInstance() {\n AllowedSolution_initFields();\n return AllowedSolution$ABOVE_SIDE_instance;\n }\n AllowedSolution.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AllowedSolution',\n interfaces: [Enum]\n };\n function AllowedSolution$values() {\n return [AllowedSolution$ANY_SIDE_getInstance(), AllowedSolution$LEFT_SIDE_getInstance(), AllowedSolution$RIGHT_SIDE_getInstance(), AllowedSolution$BELOW_SIDE_getInstance(), AllowedSolution$ABOVE_SIDE_getInstance()];\n }\n AllowedSolution.values = AllowedSolution$values;\n function AllowedSolution$valueOf(name) {\n switch (name) {\n case 'ANY_SIDE':\n return AllowedSolution$ANY_SIDE_getInstance();\n case 'LEFT_SIDE':\n return AllowedSolution$LEFT_SIDE_getInstance();\n case 'RIGHT_SIDE':\n return AllowedSolution$RIGHT_SIDE_getInstance();\n case 'BELOW_SIDE':\n return AllowedSolution$BELOW_SIDE_getInstance();\n case 'ABOVE_SIDE':\n return AllowedSolution$ABOVE_SIDE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.math3.AllowedSolution.' + name);\n }\n }\n AllowedSolution.valueOf_61zpoe$ = AllowedSolution$valueOf;\n function BaseAbstractUnivariateSolver(relativeAccuracy, absoluteAccuracy, functionValueAccuracy) {\n BaseAbstractUnivariateSolver$Companion_getInstance();\n if (functionValueAccuracy === void 0)\n functionValueAccuracy = BaseAbstractUnivariateSolver$Companion_getInstance().DEFAULT_FUNCTION_VALUE_ACCURACY_0;\n this.relativeAccuracy_uztt24$_0 = relativeAccuracy;\n this.absoluteAccuracy_8af9zt$_0 = absoluteAccuracy;\n this.functionValueAccuracy_drq8h3$_0 = functionValueAccuracy;\n this.myEvaluations_xyk8ps$_0 = new Incrementor();\n this.min_3rehp5$_0 = 0;\n this.max_3rec07$_0 = 0;\n this.startValue_pn384a$_0 = 0;\n this.function_54gwsx$_0 = null;\n this.evaluations_io7904$_0 = this.myEvaluations_xyk8ps$_0.count;\n }\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'relativeAccuracy', {\n get: function () {\n return this.relativeAccuracy_uztt24$_0;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'absoluteAccuracy', {\n get: function () {\n return this.absoluteAccuracy_8af9zt$_0;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'functionValueAccuracy', {\n get: function () {\n return this.functionValueAccuracy_drq8h3$_0;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'min', {\n configurable: true,\n get: function () {\n return this.min_3rehp5$_0;\n },\n set: function (min) {\n this.min_3rehp5$_0 = min;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'max', {\n configurable: true,\n get: function () {\n return this.max_3rec07$_0;\n },\n set: function (max) {\n this.max_3rec07$_0 = max;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'startValue', {\n configurable: true,\n get: function () {\n return this.startValue_pn384a$_0;\n },\n set: function (startValue) {\n this.startValue_pn384a$_0 = startValue;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'maxEvaluations', {\n configurable: true,\n get: function () {\n return this.myEvaluations_xyk8ps$_0.maximalCount;\n }\n });\n Object.defineProperty(BaseAbstractUnivariateSolver.prototype, 'evaluations', {\n configurable: true,\n get: function () {\n return this.evaluations_io7904$_0;\n }\n });\n BaseAbstractUnivariateSolver.prototype.computeObjectiveValue_14dthe$ = function (point) {\n this.incrementEvaluationCount();\n return ensureNotNull(this.function_54gwsx$_0).value_14dthe$(point);\n };\n BaseAbstractUnivariateSolver.prototype.setup_4y3h91$ = function (maxEval, f, min, max, startValue) {\n this.min = min;\n this.max = max;\n this.startValue = startValue;\n this.function_54gwsx$_0 = f;\n this.myEvaluations_xyk8ps$_0.maximalCount = maxEval;\n this.myEvaluations_xyk8ps$_0.resetCount();\n };\n BaseAbstractUnivariateSolver.prototype.solve_4y3h91$ = function (maxEval, f, min, max, startValue) {\n this.setup_4y3h91$(maxEval, f, min, max, startValue);\n return this.doSolve();\n };\n BaseAbstractUnivariateSolver.prototype.solve_rmnly1$ = function (maxEval, f, min, max) {\n return this.solve_4y3h91$(maxEval, f, min, max, min + 0.5 * (max - min));\n };\n BaseAbstractUnivariateSolver.prototype.solve_t5uqbd$ = function (maxEval, f, startValue) {\n return this.solve_4y3h91$(maxEval, f, kotlin_js_internal_DoubleCompanionObject.NaN, kotlin_js_internal_DoubleCompanionObject.NaN, startValue);\n };\n BaseAbstractUnivariateSolver.prototype.isBracketing_lu1900$ = function (lower, upper) {\n return UnivariateSolverUtils_getInstance().isBracketing_ljmp9$(ensureNotNull(this.function_54gwsx$_0), lower, upper);\n };\n BaseAbstractUnivariateSolver.prototype.isSequence_yvo9jy$ = function (start, mid, end) {\n return UnivariateSolverUtils_getInstance().isSequence_yvo9jy$(start, mid, end);\n };\n BaseAbstractUnivariateSolver.prototype.verifyInterval_lu1900$ = function (lower, upper) {\n UnivariateSolverUtils_getInstance().verifyInterval_lu1900$(lower, upper);\n };\n BaseAbstractUnivariateSolver.prototype.verifySequence_yvo9jy$ = function (lower, initial, upper) {\n UnivariateSolverUtils_getInstance().verifySequence_yvo9jy$(lower, initial, upper);\n };\n BaseAbstractUnivariateSolver.prototype.verifyBracketing_lu1900$ = function (lower, upper) {\n UnivariateSolverUtils_getInstance().verifyBracketing_ljmp9$(ensureNotNull(this.function_54gwsx$_0), lower, upper);\n };\n BaseAbstractUnivariateSolver.prototype.incrementEvaluationCount = function () {\n this.myEvaluations_xyk8ps$_0.incrementCount();\n };\n function BaseAbstractUnivariateSolver$Companion() {\n BaseAbstractUnivariateSolver$Companion_instance = this;\n this.DEFAULT_RELATIVE_ACCURACY_0 = 1.0E-14;\n this.DEFAULT_FUNCTION_VALUE_ACCURACY_0 = 1.0E-15;\n }\n BaseAbstractUnivariateSolver$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BaseAbstractUnivariateSolver$Companion_instance = null;\n function BaseAbstractUnivariateSolver$Companion_getInstance() {\n if (BaseAbstractUnivariateSolver$Companion_instance === null) {\n new BaseAbstractUnivariateSolver$Companion();\n }return BaseAbstractUnivariateSolver$Companion_instance;\n }\n BaseAbstractUnivariateSolver.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BaseAbstractUnivariateSolver',\n interfaces: [BaseUnivariateSolver]\n };\n function BaseAbstractUnivariateSolver_init(absoluteAccuracy, $this) {\n $this = $this || Object.create(BaseAbstractUnivariateSolver.prototype);\n BaseAbstractUnivariateSolver.call($this, BaseAbstractUnivariateSolver$Companion_getInstance().DEFAULT_RELATIVE_ACCURACY_0, absoluteAccuracy, BaseAbstractUnivariateSolver$Companion_getInstance().DEFAULT_FUNCTION_VALUE_ACCURACY_0);\n return $this;\n }\n function BaseUnivariateSolver() {\n }\n BaseUnivariateSolver.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'BaseUnivariateSolver',\n interfaces: []\n };\n function Beta() {\n Beta_instance = this;\n this.DEFAULT_EPSILON_0 = 1.0E-14;\n }\n Beta.prototype.regularizedBeta_88ee24$ = function (x, a, b, maxIterations) {\n return this.regularizedBeta_tychlm$(x, a, b, this.DEFAULT_EPSILON_0, maxIterations);\n };\n function Beta$regularizedBeta$ObjectLiteral(closure$b, closure$a) {\n this.closure$b = closure$b;\n this.closure$a = closure$a;\n ContinuedFraction.call(this);\n }\n Beta$regularizedBeta$ObjectLiteral.prototype.getB_5wr77w$ = function (n, x) {\n var ret;\n var m;\n if (n % 2 === 0) {\n m = n / 2.0;\n ret = m * (this.closure$b - m) * x / ((this.closure$a + 2 * m - 1) * (this.closure$a + 2 * m));\n } else {\n m = (n - 1.0) / 2.0;\n ret = -((this.closure$a + m) * (this.closure$a + this.closure$b + m) * x) / ((this.closure$a + 2 * m) * (this.closure$a + 2 * m + 1.0));\n }\n return ret;\n };\n Beta$regularizedBeta$ObjectLiteral.prototype.getA_5wr77w$ = function (n, x) {\n return 1.0;\n };\n Beta$regularizedBeta$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ContinuedFraction]\n };\n Beta.prototype.regularizedBeta_tychlm$ = function (x, a, b, epsilon, maxIterations) {\n if (epsilon === void 0)\n epsilon = this.DEFAULT_EPSILON_0;\n if (maxIterations === void 0)\n maxIterations = 2147483647;\n var ret;\n if (isNaN_0(x) || isNaN_0(a) || isNaN_0(b) || x < 0 || x > 1 || a <= 0.0 || b <= 0.0) {\n ret = kotlin_js_internal_DoubleCompanionObject.NaN;\n } else if (x > (a + 1.0) / (a + b + 2.0)) {\n ret = 1.0 - this.regularizedBeta_tychlm$(1.0 - x, b, a, epsilon, maxIterations);\n } else {\n var fraction = new Beta$regularizedBeta$ObjectLiteral(b, a);\n var tmp$ = a * JsMath.log(x);\n var x_0 = 1.0 - x;\n var x_1 = tmp$ + b * JsMath.log(x_0) - JsMath.log(a) - this.logBeta_88ee24$(a, b, epsilon, maxIterations);\n ret = JsMath.exp(x_1) * 1.0 / fraction.evaluate_syxxoe$(x, epsilon, maxIterations);\n }\n return ret;\n };\n Beta.prototype.logBeta_88ee24$ = function (a, b, epsilon, maxIterations) {\n if (epsilon === void 0)\n epsilon = this.DEFAULT_EPSILON_0;\n if (maxIterations === void 0)\n maxIterations = 2147483647;\n var ret;\n if (isNaN_0(a) || isNaN_0(b) || a <= 0.0 || b <= 0.0) {\n ret = kotlin_js_internal_DoubleCompanionObject.NaN;\n } else {\n ret = Gamma_getInstance().logGamma_14dthe$(a) + Gamma_getInstance().logGamma_14dthe$(b) - Gamma_getInstance().logGamma_14dthe$(a + b);\n }\n return ret;\n };\n Beta.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Beta',\n interfaces: []\n };\n var Beta_instance = null;\n function Beta_getInstance() {\n if (Beta_instance === null) {\n new Beta();\n }return Beta_instance;\n }\n function BlockRealMatrix() {\n this.BLOCK_SIZE_0 = 52;\n this.rows_0 = 0;\n this.columns_0 = 0;\n this.blockRows_0 = 0;\n this.blockColumns_0 = 0;\n this.blocks_4giiw5$_0 = this.blocks_4giiw5$_0;\n }\n Object.defineProperty(BlockRealMatrix.prototype, 'blocks_0', {\n configurable: true,\n get: function () {\n if (this.blocks_4giiw5$_0 == null)\n return throwUPAE('blocks');\n return this.blocks_4giiw5$_0;\n },\n set: function (blocks) {\n this.blocks_4giiw5$_0 = blocks;\n }\n });\n BlockRealMatrix.prototype.create_omvvzo$ = function (rows, columns, blockData, copyArray) {\n var tmp$;\n this.rows_0 = rows;\n this.columns_0 = columns;\n this.blockRows_0 = (rows + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n this.blockColumns_0 = (columns + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n var blocksCopyList = ArrayList_init();\n if (!copyArray) {\n this.blocks_0 = blockData;\n }var index = 0;\n tmp$ = this.blockRows_0;\n for (var iBlock = 0; iBlock < tmp$; iBlock++) {\n var iHeight = this.blockHeight_0(iBlock);\n var jBlock = 0;\n while (jBlock < this.blockColumns_0) {\n if (blockData[index].length !== Kotlin.imul(iHeight, this.blockWidth_0(jBlock))) {\n throw IllegalStateException_init(''.toString());\n }if (copyArray) {\n blocksCopyList.add_11rb$(blockData[index].slice());\n }jBlock = jBlock + 1 | 0;\n index = index + 1 | 0;\n }\n }\n if (copyArray) {\n this.blocks_0 = copyToArray(blocksCopyList);\n }};\n BlockRealMatrix.prototype.createBlocksLayout_0 = function (rows, columns) {\n var blockRows = (rows + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n var blockColumns = (columns + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n var blocksList = ArrayList_init();\n var blockIndex = 0;\n for (var iBlock = 0; iBlock < blockRows; iBlock++) {\n var pStart = Kotlin.imul(iBlock, this.BLOCK_SIZE_0);\n var a = pStart + this.BLOCK_SIZE_0 | 0;\n var pEnd = JsMath.min(a, rows);\n var iHeight = pEnd - pStart | 0;\n for (var jBlock = 0; jBlock < blockColumns; jBlock++) {\n var qStart = Kotlin.imul(jBlock, this.BLOCK_SIZE_0);\n var a_0 = qStart + this.BLOCK_SIZE_0 | 0;\n var qEnd = JsMath.min(a_0, columns);\n var jWidth = qEnd - qStart | 0;\n blocksList.add_11rb$(new Float64Array(Kotlin.imul(iHeight, jWidth)));\n blockIndex = blockIndex + 1 | 0;\n }\n }\n return copyToArray(blocksList);\n };\n BlockRealMatrix.prototype.transpose = function () {\n var tmp$, tmp$_0;\n var nRows = this.getRowDimension_0();\n var nCols = this.getColumnDimension_0();\n var out = BlockRealMatrix_init(nCols, nRows);\n var blockIndex = 0;\n tmp$ = this.blockColumns_0;\n for (var iBlock = 0; iBlock < tmp$; iBlock++) {\n tmp$_0 = this.blockRows_0;\n for (var jBlock = 0; jBlock < tmp$_0; jBlock++) {\n var outBlock = out.blocks_0[blockIndex];\n var tBlock = this.blocks_0[Kotlin.imul(jBlock, this.blockColumns_0) + iBlock | 0];\n var pStart = Kotlin.imul(iBlock, this.BLOCK_SIZE_0);\n var a = pStart + this.BLOCK_SIZE_0 | 0;\n var b = this.columns_0;\n var pEnd = JsMath.min(a, b);\n var qStart = Kotlin.imul(jBlock, this.BLOCK_SIZE_0);\n var a_0 = qStart + this.BLOCK_SIZE_0 | 0;\n var b_0 = this.rows_0;\n var qEnd = JsMath.min(a_0, b_0);\n var k = 0;\n for (var p = pStart; p < pEnd; p++) {\n var lInc = pEnd - pStart | 0;\n var l = p - pStart | 0;\n for (var q = qStart; q < qEnd; q++) {\n outBlock[k] = tBlock[l];\n k = k + 1 | 0;\n l = l + lInc | 0;\n }\n }\n blockIndex = blockIndex + 1 | 0;\n }\n }\n return out;\n };\n BlockRealMatrix.prototype.multiply_1dlv11$ = function (m) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (this.getColumnDimension_0() !== m.getRowDimension_0()) {\n throw IllegalStateException_init(('Matrix multiply dimension mismatch: ' + this.getColumnDimension_0() + ' x ' + m.getRowDimension_0()).toString());\n }var out = BlockRealMatrix_init(this.rows_0, m.columns_0);\n var blockIndex = 0;\n tmp$ = out.blockRows_0;\n for (var iBlock = 0; iBlock < tmp$; iBlock++) {\n var pStart = Kotlin.imul(iBlock, this.BLOCK_SIZE_0);\n var a = pStart + this.BLOCK_SIZE_0 | 0;\n var b = this.rows_0;\n var pEnd = JsMath.min(a, b);\n tmp$_0 = out.blockColumns_0;\n for (var jBlock = 0; jBlock < tmp$_0; jBlock++) {\n var jWidth = out.blockWidth_0(jBlock);\n var jWidth2 = jWidth + jWidth | 0;\n var jWidth3 = jWidth2 + jWidth | 0;\n var jWidth4 = jWidth3 + jWidth | 0;\n var outBlock = out.blocks_0[blockIndex];\n tmp$_1 = this.blockColumns_0;\n for (var kBlock = 0; kBlock < tmp$_1; kBlock++) {\n var kWidth = this.blockWidth_0(kBlock);\n var tBlock = this.blocks_0[Kotlin.imul(iBlock, this.blockColumns_0) + kBlock | 0];\n var mBlock = m.blocks_0[Kotlin.imul(kBlock, m.blockColumns_0) + jBlock | 0];\n var k = 0;\n for (var p = pStart; p < pEnd; p++) {\n var lStart = Kotlin.imul(p - pStart | 0, kWidth);\n var lEnd = lStart + kWidth | 0;\n for (var nStart = 0; nStart < jWidth; nStart++) {\n var sum = 0.0;\n var l = lStart;\n var n = nStart;\n while (l < (lEnd - 3 | 0)) {\n sum += tBlock[l] * mBlock[n] + tBlock[l + 1 | 0] * mBlock[n + jWidth | 0] + tBlock[l + 2 | 0] * mBlock[n + jWidth2 | 0] + tBlock[l + 3 | 0] * mBlock[n + jWidth3 | 0];\n l = l + 4 | 0;\n n = n + jWidth4 | 0;\n }\n while (l < lEnd) {\n sum = sum + tBlock[tmp$_2 = l, l = tmp$_2 + 1 | 0, tmp$_2] * mBlock[n];\n n = n + jWidth | 0;\n }\n outBlock[k] = outBlock[k] + sum;\n k = k + 1 | 0;\n }\n }\n }\n blockIndex = blockIndex + 1 | 0;\n }\n }\n return out;\n };\n BlockRealMatrix.prototype.getEntry_vux9f0$ = function (row, column) {\n if (row < 0 || row > this.getRowDimension_0()) {\n throw IllegalStateException_init(('row out of range: ' + row).toString());\n }if (column < 0 || column > this.getColumnDimension_0()) {\n throw IllegalStateException_init(('column out of range: ' + column).toString());\n }var iBlock = row / this.BLOCK_SIZE_0 | 0;\n var jBlock = column / this.BLOCK_SIZE_0 | 0;\n var k = Kotlin.imul(row - Kotlin.imul(iBlock, this.BLOCK_SIZE_0) | 0, this.blockWidth_0(jBlock)) + (column - Kotlin.imul(jBlock, this.BLOCK_SIZE_0)) | 0;\n return this.blocks_0[Kotlin.imul(iBlock, this.blockColumns_0) + jBlock | 0][k];\n };\n BlockRealMatrix.prototype.getRowDimension_0 = function () {\n return this.rows_0;\n };\n BlockRealMatrix.prototype.getColumnDimension_0 = function () {\n return this.columns_0;\n };\n BlockRealMatrix.prototype.blockWidth_0 = function (blockColumn) {\n return blockColumn === (this.blockColumns_0 - 1 | 0) ? this.columns_0 - Kotlin.imul(blockColumn, this.BLOCK_SIZE_0) | 0 : this.BLOCK_SIZE_0;\n };\n BlockRealMatrix.prototype.blockHeight_0 = function (blockRow) {\n return blockRow === (this.blockRows_0 - 1 | 0) ? this.rows_0 - Kotlin.imul(blockRow, this.BLOCK_SIZE_0) | 0 : this.BLOCK_SIZE_0;\n };\n BlockRealMatrix.prototype.toBlocksLayout_n8oub7$ = function (rawData) {\n var rows = rawData.length;\n var columns = rawData[0].length;\n var blockRows = (rows + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n var blockColumns = (columns + this.BLOCK_SIZE_0 - 1 | 0) / this.BLOCK_SIZE_0 | 0;\n for (var i = 0; i !== rawData.length; ++i) {\n var length = rawData[i].length;\n if (length !== columns) {\n throw IllegalStateException_init(('Wrong dimension: ' + columns + ', ' + length).toString());\n }}\n var blocksList = ArrayList_init();\n var blockIndex = 0;\n for (var iBlock = 0; iBlock < blockRows; iBlock++) {\n var pStart = Kotlin.imul(iBlock, this.BLOCK_SIZE_0);\n var a = pStart + this.BLOCK_SIZE_0 | 0;\n var pEnd = JsMath.min(a, rows);\n var iHeight = pEnd - pStart | 0;\n for (var jBlock = 0; jBlock < blockColumns; jBlock++) {\n var qStart = Kotlin.imul(jBlock, this.BLOCK_SIZE_0);\n var a_0 = qStart + this.BLOCK_SIZE_0 | 0;\n var qEnd = JsMath.min(a_0, columns);\n var jWidth = qEnd - qStart | 0;\n var block = new Float64Array(Kotlin.imul(iHeight, jWidth));\n blocksList.add_11rb$(block);\n var index = 0;\n for (var p = pStart; p < pEnd; p++) {\n arrayCopy(rawData[p], block, index, qStart, qEnd);\n index = index + jWidth | 0;\n }\n blockIndex = blockIndex + 1 | 0;\n }\n }\n return copyToArray(blocksList);\n };\n BlockRealMatrix.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BlockRealMatrix',\n interfaces: []\n };\n function BlockRealMatrix_init(rows, columns, $this) {\n $this = $this || Object.create(BlockRealMatrix.prototype);\n BlockRealMatrix.call($this);\n $this.rows_0 = rows;\n $this.columns_0 = columns;\n $this.blockRows_0 = (rows + $this.BLOCK_SIZE_0 - 1 | 0) / $this.BLOCK_SIZE_0 | 0;\n $this.blockColumns_0 = (columns + $this.BLOCK_SIZE_0 - 1 | 0) / $this.BLOCK_SIZE_0 | 0;\n $this.blocks_0 = $this.createBlocksLayout_0(rows, columns);\n return $this;\n }\n function BlockRealMatrix_init_0(rawData, $this) {\n $this = $this || Object.create(BlockRealMatrix.prototype);\n BlockRealMatrix.call($this);\n $this.create_omvvzo$(rawData.length, rawData[0].length, $this.toBlocksLayout_n8oub7$(rawData), false);\n return $this;\n }\n function BracketedUnivariateSolver() {\n }\n BracketedUnivariateSolver.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'BracketedUnivariateSolver',\n interfaces: [BaseUnivariateSolver]\n };\n function BrentSolver() {\n BrentSolver$Companion_getInstance();\n }\n BrentSolver.prototype.doSolve = function () {\n var min = this.min;\n var max = this.max;\n var initial = this.startValue;\n var functionValueAccuracy = this.functionValueAccuracy;\n this.verifySequence_yvo9jy$(min, initial, max);\n var yInitial = this.computeObjectiveValue_14dthe$(initial);\n if (JsMath.abs(yInitial) <= functionValueAccuracy) {\n return initial;\n }var yMin = this.computeObjectiveValue_14dthe$(min);\n if (JsMath.abs(yMin) <= functionValueAccuracy) {\n return min;\n }if (yInitial * yMin < 0) {\n return this.brent_0(min, initial, yMin, yInitial);\n }var yMax = this.computeObjectiveValue_14dthe$(max);\n if (JsMath.abs(yMax) <= functionValueAccuracy) {\n return max;\n }if (yInitial * yMax < 0) {\n return this.brent_0(initial, max, yInitial, yMax);\n }throw IllegalStateException_init(('NoBracketing - min: ' + min + ', max: ' + max + ', yMin: ' + yMin + ', yMax: ' + yMax).toString());\n };\n BrentSolver.prototype.brent_0 = function (lo, hi, fLo, fHi) {\n var a = lo;\n var fa = fLo;\n var b = hi;\n var fb = fHi;\n var c = a;\n var fc = fa;\n var d = b - a;\n var e = d;\n var t = this.absoluteAccuracy;\n var eps = this.relativeAccuracy;\n while (true) {\n var x = fc;\n var tmp$ = JsMath.abs(x);\n var x_0 = fb;\n if (tmp$ < JsMath.abs(x_0)) {\n a = b;\n b = c;\n c = a;\n fa = fb;\n fb = fc;\n fc = fa;\n }var tmp$_0 = 2.0 * eps;\n var x_1 = b;\n var tol = tmp$_0 * JsMath.abs(x_1) + t;\n var m = 0.5 * (c - b);\n if (JsMath.abs(m) <= tol || Precision_getInstance().equals_syxxoe$(fb, 0.0)) {\n return b;\n }var x_2 = e;\n var tmp$_1 = JsMath.abs(x_2) < tol;\n if (!tmp$_1) {\n var x_3 = fa;\n var tmp$_2 = JsMath.abs(x_3);\n var x_4 = fb;\n tmp$_1 = tmp$_2 <= JsMath.abs(x_4);\n }if (tmp$_1) {\n d = m;\n e = d;\n } else {\n var s = fb / fa;\n var p;\n var q;\n if (a === c) {\n p = 2.0 * m * s;\n q = 1 - s;\n } else {\n q = fa / fc;\n var r = fb / fc;\n p = s * (2.0 * m * q * (q - r) - (b - a) * (r - 1));\n q = (q - 1) * (r - 1) * (s - 1);\n }\n if (p > 0) {\n q = -q;\n } else {\n p = -p;\n }\n s = e;\n e = d;\n var tmp$_3 = p;\n var tmp$_4 = 1.5 * m * q;\n var x_5 = tol * q;\n var tmp$_5 = tmp$_3 >= tmp$_4 - JsMath.abs(x_5);\n if (!tmp$_5) {\n var tmp$_6 = p;\n var x_6 = 0.5 * s * q;\n tmp$_5 = tmp$_6 >= JsMath.abs(x_6);\n }if (tmp$_5) {\n d = m;\n e = d;\n } else {\n d = p / q;\n }\n }\n a = b;\n fa = fb;\n var x_7 = d;\n if (JsMath.abs(x_7) > tol) {\n b += d;\n } else if (m > 0) {\n b += tol;\n } else {\n b -= tol;\n }\n fb = this.computeObjectiveValue_14dthe$(b);\n if (fb > 0 && fc > 0 || (fb <= 0 && fc <= 0)) {\n c = a;\n fc = fa;\n d = b - a;\n e = d;\n }}\n };\n function BrentSolver$Companion() {\n BrentSolver$Companion_instance = this;\n this.DEFAULT_ABSOLUTE_ACCURACY_0 = 1.0E-6;\n }\n BrentSolver$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var BrentSolver$Companion_instance = null;\n function BrentSolver$Companion_getInstance() {\n if (BrentSolver$Companion_instance === null) {\n new BrentSolver$Companion();\n }return BrentSolver$Companion_instance;\n }\n BrentSolver.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BrentSolver',\n interfaces: [AbstractUnivariateSolver]\n };\n function BrentSolver_init(absoluteAccuracy, $this) {\n if (absoluteAccuracy === void 0)\n absoluteAccuracy = BrentSolver$Companion_getInstance().DEFAULT_ABSOLUTE_ACCURACY_0;\n $this = $this || Object.create(BrentSolver.prototype);\n AbstractUnivariateSolver_init(absoluteAccuracy, $this);\n BrentSolver.call($this);\n return $this;\n }\n function BrentSolver_init_0(relativeAccuracy, absoluteAccuracy, $this) {\n $this = $this || Object.create(BrentSolver.prototype);\n AbstractUnivariateSolver_init_0(relativeAccuracy, absoluteAccuracy, $this);\n BrentSolver.call($this);\n return $this;\n }\n function BrentSolver_init_1(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, $this) {\n $this = $this || Object.create(BrentSolver.prototype);\n AbstractUnivariateSolver_init_1(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, $this);\n BrentSolver.call($this);\n return $this;\n }\n function ContinuedFraction() {\n ContinuedFraction$Companion_getInstance();\n }\n ContinuedFraction.prototype.evaluate_12fank$ = function (x, maxIterations) {\n return this.evaluate_syxxoe$(x, ContinuedFraction$Companion_getInstance().DEFAULT_EPSILON_0, maxIterations);\n };\n ContinuedFraction.prototype.evaluate_syxxoe$ = function (x, epsilon, maxIterations) {\n if (epsilon === void 0)\n epsilon = ContinuedFraction$Companion_getInstance().DEFAULT_EPSILON_0;\n if (maxIterations === void 0)\n maxIterations = 2147483647;\n var p0 = 1.0;\n var p1 = this.getA_5wr77w$(0, x);\n var q0 = 0.0;\n var q1 = 1.0;\n var c = p1 / q1;\n var n = 0;\n var relativeError = kotlin_js_internal_DoubleCompanionObject.MAX_VALUE;\n while (n < maxIterations && relativeError > epsilon) {\n n = n + 1 | 0;\n var a = this.getA_5wr77w$(n, x);\n var b = this.getB_5wr77w$(n, x);\n var p2 = a * p1 + b * p0;\n var q2 = a * q1 + b * q0;\n var infinite = false;\n if (isInfinite(p2) || isInfinite(q2)) {\n var scaleFactor = 1.0;\n var lastScaleFactor = 1.0;\n var maxPower = 5;\n var scale = JsMath.max(a, b);\n if (scale <= 0) {\n throw IllegalStateException_init('ConvergenceException'.toString());\n }infinite = true;\n for (var i = 0; i < maxPower; i++) {\n lastScaleFactor = scaleFactor;\n scaleFactor *= scale;\n if (a !== 0.0 && a > b) {\n p2 = p1 / lastScaleFactor + b / scaleFactor * p0;\n q2 = q1 / lastScaleFactor + b / scaleFactor * q0;\n } else if (b !== 0.0) {\n p2 = a / scaleFactor * p1 + p0 / lastScaleFactor;\n q2 = a / scaleFactor * q1 + q0 / lastScaleFactor;\n }infinite = isInfinite(p2) || isInfinite(q2);\n if (!infinite) {\n break;\n }}\n }if (infinite) {\n throw IllegalStateException_init('ConvergenceException'.toString());\n }var r = p2 / q2;\n if (isNaN_0(r)) {\n throw IllegalStateException_init('ConvergenceException'.toString());\n }var x_0 = r / c - 1.0;\n relativeError = JsMath.abs(x_0);\n c = p2 / q2;\n p0 = p1;\n p1 = p2;\n q0 = q1;\n q1 = q2;\n }\n if (n >= maxIterations) {\n throw IllegalStateException_init('MaxCountExceeded'.toString());\n }return c;\n };\n function ContinuedFraction$Companion() {\n ContinuedFraction$Companion_instance = this;\n this.DEFAULT_EPSILON_0 = 1.0E-8;\n }\n ContinuedFraction$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContinuedFraction$Companion_instance = null;\n function ContinuedFraction$Companion_getInstance() {\n if (ContinuedFraction$Companion_instance === null) {\n new ContinuedFraction$Companion();\n }return ContinuedFraction$Companion_instance;\n }\n ContinuedFraction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContinuedFraction',\n interfaces: []\n };\n function mean(xs) {\n return average(xs);\n }\n function correlationPearson(xs, ys) {\n if (!(xs.length === ys.length)) {\n var message = 'Two series must have the same size.';\n throw IllegalArgumentException_init(message.toString());\n }if (!!(xs.length === 0)) {\n var message_0 = \"Can't correlate empty sequences.\";\n throw IllegalArgumentException_init(message_0.toString());\n }var mx = mean(xs);\n var my = mean(ys);\n var cov = 0.0;\n var d2x = 0.0;\n var d2y = 0.0;\n for (var i = 0; i !== xs.length; ++i) {\n var dx = xs[i] - mx;\n var dy = ys[i] - my;\n cov += dx * dy;\n d2x += JsMath.pow(dx, 2);\n d2y += JsMath.pow(dy, 2);\n }\n if (!(d2x !== 0.0 && d2y !== 0.0)) {\n var message_1 = 'Correlation is not defined for sequences with zero variation.';\n throw IllegalArgumentException_init(message_1.toString());\n }var x = d2x * d2y;\n return cov / JsMath.sqrt(x);\n }\n function ForsythePolynomialGenerator(knots) {\n ForsythePolynomialGenerator$Companion_getInstance();\n this.knots_0 = knots;\n this.ps_0 = null;\n if (!!(this.knots_0.length === 0)) {\n var message = 'The knots list must not be empty';\n throw IllegalArgumentException_init(message.toString());\n }this.ps_0 = arrayListOf([new PolynomialFunction(new Float64Array([1.0])), new PolynomialFunction(new Float64Array([-average(this.knots_0), 1.0]))]);\n }\n ForsythePolynomialGenerator.prototype.alphaBeta_0 = function (i) {\n var tmp$, tmp$_0;\n if (!(i === this.ps_0.size)) {\n var message = 'Alpha must be calculated sequentially.';\n throw IllegalArgumentException_init(message.toString());\n }var p = last(this.ps_0);\n var pp = this.ps_0.get_za3lpa$(this.ps_0.size - 2 | 0);\n var sxp = 0.0;\n var sp2 = 0.0;\n var spp2 = 0.0;\n tmp$ = this.knots_0;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var x = tmp$[tmp$_0];\n var $receiver = p.value_14dthe$(x);\n var pv2 = JsMath.pow($receiver, 2);\n var $receiver_0 = pp.value_14dthe$(x);\n var ppv2 = JsMath.pow($receiver_0, 2);\n sxp += x * pv2;\n sp2 += pv2;\n spp2 += ppv2;\n }\n return new Pair_0(sxp / sp2, sp2 / spp2);\n };\n ForsythePolynomialGenerator.prototype.getPolynomial_za3lpa$ = function (n) {\n var tmp$;\n if (!(n >= 0)) {\n var message = 'Degree of Forsythe polynomial must not be negative';\n throw IllegalArgumentException_init(message.toString());\n }if (!(n < this.knots_0.length)) {\n var message_0 = 'Degree of Forsythe polynomial must not exceed knots.size - 1';\n throw IllegalArgumentException_init(message_0.toString());\n }if (n >= this.ps_0.size) {\n var sz = this.ps_0.size;\n tmp$ = n + 1 | 0;\n for (var k = sz; k <= tmp$; k++) {\n var tmp$_0 = this.alphaBeta_0(k);\n var a = tmp$_0.component1()\n , b = tmp$_0.component2();\n var pPrev = last(this.ps_0);\n var pPrevPrev = this.ps_0.get_za3lpa$(this.ps_0.size - 2 | 0);\n var p = ForsythePolynomialGenerator$Companion_getInstance().X.times_3j0b7h$(pPrev).minus_3j0b7h$(times(a, pPrev)).minus_3j0b7h$(times(b, pPrevPrev));\n this.ps_0.add_11rb$(p);\n }\n }return this.ps_0.get_za3lpa$(n);\n };\n function ForsythePolynomialGenerator$Companion() {\n ForsythePolynomialGenerator$Companion_instance = this;\n this.X = new PolynomialFunction(new Float64Array([0.0, 1.0]));\n }\n ForsythePolynomialGenerator$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ForsythePolynomialGenerator$Companion_instance = null;\n function ForsythePolynomialGenerator$Companion_getInstance() {\n if (ForsythePolynomialGenerator$Companion_instance === null) {\n new ForsythePolynomialGenerator$Companion();\n }return ForsythePolynomialGenerator$Companion_instance;\n }\n ForsythePolynomialGenerator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ForsythePolynomialGenerator',\n interfaces: []\n };\n function Gamma() {\n Gamma_instance = this;\n this.GAMMA = 0.5772156649015329;\n this.DEFAULT_EPSILON_0 = 1.0E-14;\n this.LANCZOS_0 = new Float64Array([0.9999999999999971, 57.15623566586292, -59.59796035547549, 14.136097974741746, -0.4919138160976202, 3.399464998481189E-5, 4.652362892704858E-5, -9.837447530487956E-5, 1.580887032249125E-4, -2.1026444172410488E-4, 2.1743961811521265E-4, -1.643181065367639E-4, 8.441822398385275E-5, -2.6190838401581408E-5, 3.6899182659531625E-6]);\n var x = 2.0 * math.PI;\n this.HALF_LOG_2_PI_0 = 0.5 * JsMath.log(x);\n this.C_LIMIT_0 = 49.0;\n this.S_LIMIT_0 = 1.0E-5;\n }\n Gamma.prototype.logGamma_14dthe$ = function (x) {\n var ret;\n if (isNaN_0(x) || x <= 0.0) {\n ret = kotlin_js_internal_DoubleCompanionObject.NaN;\n } else {\n var g = 607.0 / 128.0;\n var sum = 0.0;\n for (var i = this.LANCZOS_0.length - 1 | 0; i >= 1; i--) {\n sum = sum + this.LANCZOS_0[i] / (x + i);\n }\n sum = sum + this.LANCZOS_0[0];\n var tmp = x + g + 0.5;\n var tmp$ = (x + 0.5) * JsMath.log(tmp) - tmp + this.HALF_LOG_2_PI_0;\n var x_0 = sum / x;\n ret = tmp$ + JsMath.log(x_0);\n }\n return ret;\n };\n Gamma.prototype.regularizedGammaP_88ee24$ = function (a, x, epsilon, maxIterations) {\n if (epsilon === void 0)\n epsilon = this.DEFAULT_EPSILON_0;\n if (maxIterations === void 0)\n maxIterations = 2147483647;\n var ret;\n if (isNaN_0(a) || isNaN_0(x) || a <= 0.0 || x < 0.0) {\n ret = kotlin_js_internal_DoubleCompanionObject.NaN;\n } else if (x === 0.0) {\n ret = 0.0;\n } else if (x >= a + 1) {\n ret = 1.0 - this.regularizedGammaQ_88ee24$(a, x, epsilon, maxIterations);\n } else {\n var n = 0.0;\n var an = 1.0 / a;\n var sum = an;\n while (true) {\n var x_0 = an / sum;\n if (!(JsMath.abs(x_0) > epsilon && n < maxIterations && sum < kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY))\n break;\n n = n + 1.0;\n an = an * (x / (a + n));\n sum = sum + an;\n }\n if (n >= maxIterations) {\n throw IllegalStateException_init(('MaxCountExceeded - maxIterations: ' + maxIterations).toString());\n } else if (isInfinite(sum)) {\n ret = 1.0;\n } else {\n var x_1 = -x + a * JsMath.log(x) - this.logGamma_14dthe$(a);\n ret = JsMath.exp(x_1) * sum;\n }\n }\n return ret;\n };\n function Gamma$regularizedGammaQ$ObjectLiteral(closure$a) {\n this.closure$a = closure$a;\n ContinuedFraction.call(this);\n }\n Gamma$regularizedGammaQ$ObjectLiteral.prototype.getA_5wr77w$ = function (n, x) {\n return 2.0 * n + 1.0 - this.closure$a + x;\n };\n Gamma$regularizedGammaQ$ObjectLiteral.prototype.getB_5wr77w$ = function (n, x) {\n return n * (this.closure$a - n);\n };\n Gamma$regularizedGammaQ$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ContinuedFraction]\n };\n Gamma.prototype.regularizedGammaQ_88ee24$ = function (a, x, epsilon, maxIterations) {\n if (epsilon === void 0)\n epsilon = this.DEFAULT_EPSILON_0;\n if (maxIterations === void 0)\n maxIterations = 2147483647;\n var ret;\n if (isNaN_0(a) || isNaN_0(x) || a <= 0.0 || x < 0.0) {\n ret = kotlin_js_internal_DoubleCompanionObject.NaN;\n } else if (x === 0.0) {\n ret = 1.0;\n } else if (x < a + 1.0) {\n ret = 1.0 - this.regularizedGammaP_88ee24$(a, x, epsilon, maxIterations);\n } else {\n var cf = new Gamma$regularizedGammaQ$ObjectLiteral(a);\n ret = 1.0 / cf.evaluate_syxxoe$(x, epsilon, maxIterations);\n var x_0 = -x + a * JsMath.log(x) - this.logGamma_14dthe$(a);\n ret = JsMath.exp(x_0) * ret;\n }\n return ret;\n };\n Gamma.prototype.digamma_14dthe$ = function (x) {\n if (x > 0 && x <= this.S_LIMIT_0) {\n return -this.GAMMA - 1 / x;\n }if (x >= this.C_LIMIT_0) {\n var inv = 1 / (x * x);\n return JsMath.log(x) - 0.5 / x - inv * (1.0 / 12 + inv * (1.0 / 120 - inv / 252));\n }return this.digamma_14dthe$(x + 1) - 1 / x;\n };\n Gamma.prototype.trigamma_14dthe$ = function (x) {\n if (x > 0 && x <= this.S_LIMIT_0) {\n return 1 / (x * x);\n }if (x >= this.C_LIMIT_0) {\n var inv = 1 / (x * x);\n return 1 / x + inv / 2 + inv / x * (1.0 / 6 - inv * (1.0 / 30 + inv / 42));\n }return this.trigamma_14dthe$(x + 1) + 1 / (x * x);\n };\n Gamma.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Gamma',\n interfaces: []\n };\n var Gamma_instance = null;\n function Gamma_getInstance() {\n if (Gamma_instance === null) {\n new Gamma();\n }return Gamma_instance;\n }\n function Incrementor(maximalCount, maxCountCallback) {\n if (maximalCount === void 0)\n maximalCount = 0;\n if (maxCountCallback === void 0)\n maxCountCallback = new Incrementor_init$ObjectLiteral();\n this.maximalCount = maximalCount;\n this.maxCountCallback_0 = maxCountCallback;\n this.count_k39d42$_0 = 0;\n }\n Object.defineProperty(Incrementor.prototype, 'count', {\n configurable: true,\n get: function () {\n return this.count_k39d42$_0;\n },\n set: function (count) {\n this.count_k39d42$_0 = count;\n }\n });\n Incrementor.prototype.canIncrement = function () {\n return this.count < this.maximalCount;\n };\n Incrementor.prototype.incrementCount_za3lpa$ = function (value) {\n for (var i = 0; i < value; i++) {\n this.incrementCount();\n }\n };\n Incrementor.prototype.incrementCount = function () {\n if ((this.count = this.count + 1 | 0, this.count) > this.maximalCount) {\n this.maxCountCallback_0.trigger_za3lpa$(this.maximalCount);\n }};\n Incrementor.prototype.resetCount = function () {\n this.count = 0;\n };\n function Incrementor$MaxCountExceededCallback() {\n }\n Incrementor$MaxCountExceededCallback.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'MaxCountExceededCallback',\n interfaces: []\n };\n function Incrementor_init$ObjectLiteral() {\n }\n Incrementor_init$ObjectLiteral.prototype.trigger_za3lpa$ = function (maximalCount) {\n throw IllegalStateException_init(('MaxCountExceeded: ' + maximalCount).toString());\n };\n Incrementor_init$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Incrementor$MaxCountExceededCallback]\n };\n Incrementor.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Incrementor',\n interfaces: []\n };\n function LoessInterpolator(bandwidth, robustnessIters, accuracy) {\n LoessInterpolator$Companion_getInstance();\n if (bandwidth === void 0)\n bandwidth = LoessInterpolator$Companion_getInstance().DEFAULT_BANDWIDTH;\n if (robustnessIters === void 0)\n robustnessIters = 2;\n if (accuracy === void 0)\n accuracy = LoessInterpolator$Companion_getInstance().DEFAULT_ACCURACY;\n this.bandwidth_0 = bandwidth;\n this.robustnessIters_0 = robustnessIters;\n this.accuracy_0 = accuracy;\n if (this.bandwidth_0 <= 0 || this.bandwidth_0 > 1) {\n throw IllegalStateException_init(('Out of range of bandwidth value: ' + this.bandwidth_0 + ' should be > 0 and <= 1').toString());\n }if (this.robustnessIters_0 < 0) {\n throw IllegalStateException_init(('Not positive Robutness iterationa: ' + this.robustnessIters_0).toString());\n }}\n LoessInterpolator.prototype.interpolate_g9g6do$ = function (xval, yval) {\n return (new SplineInterpolator()).interpolate_g9g6do$(xval, this.smooth_0(xval, yval));\n };\n LoessInterpolator.prototype.smooth_1 = function (xval, yval, weights) {\n var tmp$, tmp$_0, tmp$_1;\n if (xval.length !== yval.length) {\n throw IllegalStateException_init(('Dimension mismatch of interpolation points: ' + xval.length + ' != ' + yval.length).toString());\n }var n = xval.length;\n if (n === 0) {\n throw IllegalStateException_init('No data to interpolate'.toString());\n }this.checkAllFiniteReal_0(xval);\n this.checkAllFiniteReal_0(yval);\n this.checkAllFiniteReal_0(weights);\n MathArrays_getInstance().checkOrder_gf7tl1$(xval);\n if (n === 1) {\n return new Float64Array([yval[0]]);\n }if (n === 2) {\n return new Float64Array([yval[0], yval[1]]);\n }var bandwidthInPoints = numberToInt(this.bandwidth_0 * n);\n if (bandwidthInPoints < 2) {\n throw IllegalStateException_init((\"LOESS 'bandwidthInPoints' is too small: \" + bandwidthInPoints + ' < 2').toString());\n }var res = new Float64Array(n);\n var residuals = new Float64Array(n);\n var sortedResiduals = new Float64Array(n);\n var robustnessWeights = new Float64Array(n);\n fill(robustnessWeights, 1.0);\n tmp$ = this.robustnessIters_0;\n for (var iter = 0; iter <= tmp$; iter++) {\n var bandwidthInterval = new Int32Array([0, bandwidthInPoints - 1 | 0]);\n for (var i = 0; i < n; i++) {\n var x = xval[i];\n if (i > 0) {\n this.updateBandwidthInterval_0(xval, weights, i, bandwidthInterval);\n }var ileft = bandwidthInterval[0];\n var iright = bandwidthInterval[1];\n var edge;\n if (xval[i] - xval[ileft] > xval[iright] - xval[i]) {\n tmp$_0 = ileft;\n } else {\n tmp$_0 = iright;\n }\n edge = tmp$_0;\n var sumWeights = 0.0;\n var sumX = 0.0;\n var sumXSquared = 0.0;\n var sumY = 0.0;\n var sumXY = 0.0;\n var x_0 = 1.0 / (xval[edge] - x);\n var denom = JsMath.abs(x_0);\n for (var k = ileft; k <= iright; k++) {\n var xk = xval[k];\n var yk = yval[k];\n var dist = k < i ? x - xk : xk - x;\n var w = this.tricube_0(dist * denom) * robustnessWeights[k] * weights[k];\n var xkw = xk * w;\n sumWeights += w;\n sumX += xkw;\n sumXSquared += xk * xkw;\n sumY += yk * w;\n sumXY += yk * xkw;\n }\n var meanX = sumX / sumWeights;\n var meanY = sumY / sumWeights;\n var meanXY = sumXY / sumWeights;\n var meanXSquared = sumXSquared / sumWeights;\n var beta;\n var x_1 = meanXSquared - meanX * meanX;\n var x_2 = JsMath.abs(x_1);\n if (JsMath.sqrt(x_2) < this.accuracy_0) {\n tmp$_1 = 0.0;\n } else {\n tmp$_1 = (meanXY - meanX * meanY) / (meanXSquared - meanX * meanX);\n }\n beta = tmp$_1;\n var alpha = meanY - beta * meanX;\n res[i] = beta * x + alpha;\n var x_3 = yval[i] - res[i];\n residuals[i] = JsMath.abs(x_3);\n }\n if (iter === this.robustnessIters_0) {\n break;\n }arrayCopy(residuals, sortedResiduals, 0, 0, n);\n sort(sortedResiduals);\n var medianResidual = sortedResiduals[n / 2 | 0];\n if (JsMath.abs(medianResidual) < this.accuracy_0) {\n break;\n }for (var i_0 = 0; i_0 < n; i_0++) {\n var arg = residuals[i_0] / (6 * medianResidual);\n if (arg >= 1) {\n robustnessWeights[i_0] = 0.0;\n } else {\n var w_0 = 1 - arg * arg;\n robustnessWeights[i_0] = w_0 * w_0;\n }\n }\n }\n return res;\n };\n LoessInterpolator.prototype.updateBandwidthInterval_0 = function (xval, weights, i, bandwidthInterval) {\n var left = bandwidthInterval[0];\n var right = bandwidthInterval[1];\n var nextRight = this.nextNonzero_0(weights, right);\n if (nextRight < xval.length && xval[nextRight] - xval[i] < xval[i] - xval[left]) {\n var nextLeft = this.nextNonzero_0(weights, bandwidthInterval[0]);\n bandwidthInterval[0] = nextLeft;\n bandwidthInterval[1] = nextRight;\n }};\n LoessInterpolator.prototype.tricube_0 = function (x) {\n var absX = JsMath.abs(x);\n if (absX >= 1.0) {\n return 0.0;\n }var tmp = 1 - absX * absX * absX;\n return tmp * tmp * tmp;\n };\n LoessInterpolator.prototype.nextNonzero_0 = function (weights, i) {\n var j = i + 1 | 0;\n while (j < weights.length && weights[j] === 0.0) {\n j = j + 1 | 0;\n }\n return j;\n };\n LoessInterpolator.prototype.smooth_0 = function (xval, yval) {\n if (xval.length !== yval.length) {\n throw IllegalStateException_init(('Dimension mismatch: ' + xval.length + ' != ' + yval.length).toString());\n }var unitWeights = new Float64Array(xval.length);\n fill(unitWeights, 1.0);\n return this.smooth_1(xval, yval, unitWeights);\n };\n LoessInterpolator.prototype.checkFinite_0 = function (x) {\n if (isInfinite(x) || isNaN_0(x)) {\n throw IllegalStateException_init(('Argument ' + x + ' is not a finite number').toString());\n }};\n LoessInterpolator.prototype.checkAllFiniteReal_0 = function (values) {\n for (var i = 0; i !== values.length; ++i) {\n this.checkFinite_0(values[i]);\n }\n };\n function LoessInterpolator$Companion() {\n LoessInterpolator$Companion_instance = this;\n this.DEFAULT_BANDWIDTH = 0.3;\n this.DEFAULT_ROBUSTNESS_ITERS = 2;\n this.DEFAULT_ACCURACY = 1.0E-12;\n }\n LoessInterpolator$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LoessInterpolator$Companion_instance = null;\n function LoessInterpolator$Companion_getInstance() {\n if (LoessInterpolator$Companion_instance === null) {\n new LoessInterpolator$Companion();\n }return LoessInterpolator$Companion_instance;\n }\n LoessInterpolator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LoessInterpolator',\n interfaces: []\n };\n function MathArrays() {\n MathArrays_instance = this;\n }\n function MathArrays$OrderDirection(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function MathArrays$OrderDirection_initFields() {\n MathArrays$OrderDirection_initFields = function () {\n };\n MathArrays$OrderDirection$INCREASING_instance = new MathArrays$OrderDirection('INCREASING', 0);\n MathArrays$OrderDirection$DECREASING_instance = new MathArrays$OrderDirection('DECREASING', 1);\n }\n var MathArrays$OrderDirection$INCREASING_instance;\n function MathArrays$OrderDirection$INCREASING_getInstance() {\n MathArrays$OrderDirection_initFields();\n return MathArrays$OrderDirection$INCREASING_instance;\n }\n var MathArrays$OrderDirection$DECREASING_instance;\n function MathArrays$OrderDirection$DECREASING_getInstance() {\n MathArrays$OrderDirection_initFields();\n return MathArrays$OrderDirection$DECREASING_instance;\n }\n MathArrays$OrderDirection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'OrderDirection',\n interfaces: [Enum]\n };\n function MathArrays$OrderDirection$values() {\n return [MathArrays$OrderDirection$INCREASING_getInstance(), MathArrays$OrderDirection$DECREASING_getInstance()];\n }\n MathArrays$OrderDirection.values = MathArrays$OrderDirection$values;\n function MathArrays$OrderDirection$valueOf(name) {\n switch (name) {\n case 'INCREASING':\n return MathArrays$OrderDirection$INCREASING_getInstance();\n case 'DECREASING':\n return MathArrays$OrderDirection$DECREASING_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.base.stat.math3.MathArrays.OrderDirection.' + name);\n }\n }\n MathArrays$OrderDirection.valueOf_61zpoe$ = MathArrays$OrderDirection$valueOf;\n MathArrays.prototype.checkOrder_j8c91m$ = function (val, dir, strict, abort) {\n var tmp$;\n var previous = val[0];\n var max = val.length;\n var index;\n index = 1;\n ITEM: while (index < max) {\n if (equals(dir, MathArrays$OrderDirection$INCREASING_getInstance()))\n if (strict) {\n if (val[index] <= previous) {\n break ITEM;\n }} else {\n if (val[index] < previous) {\n break ITEM;\n }}\n else if (equals(dir, MathArrays$OrderDirection$DECREASING_getInstance()))\n if (strict) {\n if (val[index] >= previous) {\n break ITEM;\n }} else {\n if (val[index] > previous) {\n break ITEM;\n }}\n else {\n throw IllegalStateException_init(''.toString());\n }\n previous = val[index];\n index = index + 1 | 0;\n }\n if (index === max) {\n return true;\n }if (abort) {\n throw IllegalStateException_init('Non monotonic sequence'.toString());\n } else {\n tmp$ = false;\n }\n return tmp$;\n };\n MathArrays.prototype.checkOrder_hixecd$ = function (val, dir, strict) {\n this.checkOrder_j8c91m$(val, dir, strict, true);\n };\n MathArrays.prototype.checkOrder_gf7tl1$ = function (val) {\n this.checkOrder_hixecd$(val, MathArrays$OrderDirection$INCREASING_getInstance(), true);\n };\n MathArrays.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'MathArrays',\n interfaces: []\n };\n var MathArrays_instance = null;\n function MathArrays_getInstance() {\n if (MathArrays_instance === null) {\n new MathArrays();\n }return MathArrays_instance;\n }\n function Percentile() {\n Percentile_instance = this;\n this.MIN_SELECT_SIZE_0 = 15;\n this.MAX_CACHED_LEVELS_0 = 10;\n }\n Percentile.prototype.evaluate_pw9xcd$ = function (values, p) {\n this.test_0(values, 0, 0, false);\n return this.evaluate_0(values, 0, values.length, p);\n };\n Percentile.prototype.test_0 = function (values, begin, length, allowEmpty) {\n var tmp$;\n if (values == null) {\n throw IllegalStateException_init('Input array'.toString());\n }if (begin < 0) {\n throw IllegalStateException_init('start postion < 0'.toString());\n }if (length < 0) {\n throw IllegalStateException_init('length < 0'.toString());\n }if ((begin + length | 0) > values.length) {\n throw IllegalStateException_init('subarray ends after array end'.toString());\n }if (length === 0 && !allowEmpty) {\n tmp$ = false;\n } else\n tmp$ = true;\n return tmp$;\n };\n Percentile.prototype.evaluate_0 = function (values, begin, length, p) {\n this.test_0(values, begin, length, false);\n if (p > 100 || p <= 0) {\n throw IllegalStateException_init(('out of bounds quantile value: ' + p + ', must be in (0, 100]').toString());\n }if (length === 0) {\n return kotlin_js_internal_DoubleCompanionObject.NaN;\n }if (length === 1) {\n return values[begin];\n }var n = length;\n var pos = p * (n + 1) / 100;\n var fpos = JsMath.floor(pos);\n var intPos = numberToInt(fpos);\n var dif = pos - fpos;\n var work = new Float64Array(length);\n arrayCopy(values, work, 0, begin, length);\n var pivotsHeap = new Int32Array(1023);\n fill_0(pivotsHeap, -1);\n if (pos < 1) {\n return this.select_0(work, pivotsHeap, 0);\n }if (pos >= n) {\n return this.select_0(work, pivotsHeap, length - 1 | 0);\n }var lower = this.select_0(work, pivotsHeap, intPos - 1 | 0);\n var upper = this.select_0(work, pivotsHeap, intPos);\n return lower + dif * (upper - lower);\n };\n Percentile.prototype.select_0 = function (work, pivotsHeap, k) {\n var begin = 0;\n var end = work.length;\n var node = 0;\n while ((end - begin | 0) > 15) {\n var pivot;\n if (node < pivotsHeap.length && pivotsHeap[node] >= 0) {\n pivot = pivotsHeap[node];\n } else {\n pivot = this.partition_0(work, begin, end, this.medianOf3_0(work, begin, end));\n if (node < pivotsHeap.length) {\n pivotsHeap[node] = pivot;\n }}\n if (k === pivot) {\n return work[k];\n } else if (k < pivot) {\n end = pivot;\n var a = (2 * node | 0) + 1 | 0;\n node = JsMath.min(a, pivotsHeap.length);\n } else {\n begin = pivot + 1 | 0;\n var a_0 = (2 * node | 0) + 2 | 0;\n node = JsMath.min(a_0, pivotsHeap.length);\n }\n }\n this.insertionSort_0(work, begin, end);\n return work[k];\n };\n Percentile.prototype.partition_0 = function (work, begin, end, pivot) {\n var tmp$, tmp$_0;\n var value = work[pivot];\n work[pivot] = work[begin];\n var i = begin + 1 | 0;\n var j = end - 1 | 0;\n while (i < j) {\n while (i < j && work[j] >= value) {\n j = j - 1 | 0;\n }\n while (i < j && work[i] <= value) {\n i = i + 1 | 0;\n }\n if (i < j) {\n var tmp = work[i];\n work[tmp$ = i, i = tmp$ + 1 | 0, tmp$] = work[j];\n work[tmp$_0 = j, j = tmp$_0 - 1 | 0, tmp$_0] = tmp;\n }}\n if (i >= end || work[i] > value) {\n i = i - 1 | 0;\n }work[begin] = work[i];\n work[i] = value;\n return i;\n };\n Percentile.prototype.medianOf3_0 = function (work, begin, end) {\n var tmp$;\n var inclusiveEnd = end - 1 | 0;\n var middle = begin + ((inclusiveEnd - begin | 0) / 2 | 0) | 0;\n var wBegin = work[begin];\n var wMiddle = work[middle];\n var wEnd = work[inclusiveEnd];\n if (wBegin < wMiddle) {\n if (wMiddle < wEnd) {\n tmp$ = middle;\n } else {\n tmp$ = wBegin < wEnd ? inclusiveEnd : begin;\n }\n } else {\n if (wBegin < wEnd) {\n tmp$ = begin;\n } else {\n tmp$ = wMiddle < wEnd ? inclusiveEnd : middle;\n }\n }\n return tmp$;\n };\n Percentile.prototype.insertionSort_0 = function (work, begin, end) {\n for (var j = begin + 1 | 0; j < end; j++) {\n var saved = work[j];\n var i = j - 1 | 0;\n while (i >= begin && saved < work[i]) {\n work[i + 1 | 0] = work[i];\n i = i - 1 | 0;\n }\n work[i + 1 | 0] = saved;\n }\n };\n Percentile.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Percentile',\n interfaces: []\n };\n var Percentile_instance = null;\n function Percentile_getInstance() {\n if (Percentile_instance === null) {\n new Percentile();\n }return Percentile_instance;\n }\n function PolynomialFunction(c) {\n this.coefficients_0 = null;\n var tmp$ = c == null;\n if (!tmp$) {\n tmp$ = c.length === 0;\n }if (tmp$) {\n throw IllegalStateException_init('Empty polynomials coefficients array'.toString());\n }var n = c.length;\n while (n > 1 && c[n - 1 | 0] === 0.0) {\n n = n - 1 | 0;\n }\n this.coefficients_0 = new Float64Array(n);\n arrayCopy(c, this.coefficients_0, 0, 0, n);\n }\n PolynomialFunction.prototype.value_14dthe$ = function (x) {\n return this.evaluate_0(this.coefficients_0, x);\n };\n PolynomialFunction.prototype.evaluate_0 = function (coefficients, argument) {\n if (coefficients == null) {\n throw IllegalStateException_init('Null argument: coefficients of the polynomial to evaluate'.toString());\n }var n = coefficients.length;\n if (n === 0) {\n throw IllegalStateException_init('Empty polynomials coefficients array'.toString());\n }var result = coefficients[n - 1 | 0];\n for (var j = n - 2 | 0; j >= 0; j--) {\n result = argument * result + coefficients[j];\n }\n return result;\n };\n PolynomialFunction.prototype.unaryPlus = function () {\n return new PolynomialFunction(this.coefficients_0);\n };\n PolynomialFunction.prototype.unaryMinus = function () {\n var tmp$;\n var dd = new Float64Array(this.coefficients_0.length);\n tmp$ = this.coefficients_0;\n for (var i = 0; i !== tmp$.length; ++i) {\n var c = tmp$[i];\n dd[i] = -c;\n }\n return new PolynomialFunction(dd);\n };\n PolynomialFunction.prototype.apply_op_0 = function (other, op) {\n var sz = collect.Comparables.max_sdesaw$(this.coefficients_0.length, other.coefficients_0.length);\n var nc = new Float64Array(sz);\n for (var i = 0; i < sz; i++) {\n var a = i < this.coefficients_0.length ? this.coefficients_0[i] : 0.0;\n var b = i < other.coefficients_0.length ? other.coefficients_0[i] : 0.0;\n nc[i] = op(a, b);\n }\n return new PolynomialFunction(nc);\n };\n function PolynomialFunction$plus$lambda(x, y) {\n return x + y;\n }\n PolynomialFunction.prototype.plus_3j0b7h$ = function (other) {\n return this.apply_op_0(other, PolynomialFunction$plus$lambda);\n };\n function PolynomialFunction$minus$lambda(x, y) {\n return x - y;\n }\n PolynomialFunction.prototype.minus_3j0b7h$ = function (other) {\n return this.apply_op_0(other, PolynomialFunction$minus$lambda);\n };\n PolynomialFunction.prototype.multiply_14dthe$ = function (a) {\n var tmp$;\n var dd = new Float64Array(this.coefficients_0.length);\n tmp$ = this.coefficients_0;\n for (var i = 0; i !== tmp$.length; ++i) {\n var c = tmp$[i];\n dd[i] = a * c;\n }\n return new PolynomialFunction(dd);\n };\n PolynomialFunction.prototype.times_3j0b7h$ = function (other) {\n var nd = this.coefficients_0.length + other.coefficients_0.length - 1 | 0;\n var nc = new Float64Array(nd);\n for (var i = 0; i < nd; i++) {\n for (var j = 0; j <= i; j++) {\n var a = j < this.coefficients_0.length ? this.coefficients_0[j] : 0.0;\n var k = i - j | 0;\n var b = k < other.coefficients_0.length ? other.coefficients_0[k] : 0.0;\n nc[i] = nc[i] + a * b;\n }\n }\n return new PolynomialFunction(nc);\n };\n PolynomialFunction.prototype.degree = function () {\n var tmp$ = collect.Comparables;\n var $receiver = this.coefficients_0;\n var indexOfLast$result;\n indexOfLast$break: do {\n var tmp$_0;\n tmp$_0 = reversed_0(get_indices($receiver)).iterator();\n while (tmp$_0.hasNext()) {\n var index = tmp$_0.next();\n if ($receiver[index] !== 0.0) {\n indexOfLast$result = index;\n break indexOfLast$break;\n }}\n indexOfLast$result = -1;\n }\n while (false);\n return tmp$.max_sdesaw$(0, indexOfLast$result);\n };\n PolynomialFunction.prototype.compareTo_3j0b7h$ = function (other) {\n var d1 = this.degree();\n var d2 = other.degree();\n var n = collect.Comparables.min_sdesaw$(d1, d2) + 1 | 0;\n for (var i = 0; i < n; i++) {\n var a = this.coefficients_0[i];\n var b = other.coefficients_0[i];\n var res = Kotlin.compareTo(a, b);\n if (res !== 0)\n return res;\n }\n return Kotlin.primitiveCompareTo(d1, d2);\n };\n PolynomialFunction.prototype.equals = function (other) {\n if (other == null || !Kotlin.isType(other, PolynomialFunction))\n return false;\n return this.compareTo_3j0b7h$(other) === 0;\n };\n PolynomialFunction.prototype.hashCode = function () {\n return hashCode(this.coefficients_0);\n };\n PolynomialFunction.prototype.toString = function () {\n var sb = StringBuilder_init();\n for (var i = get_lastIndex(this.coefficients_0); i >= 0; i--) {\n if (this.coefficients_0[i] !== 0.0) {\n if (!(sb.length === 0))\n sb.append_pdl1vj$(' + ');\n sb.append_pdl1vj$(this.coefficients_0[i].toString());\n if (i > 0)\n sb.append_pdl1vj$('x');\n if (i > 1)\n sb.append_pdl1vj$('^').append_s8jyv4$(i);\n }}\n return sb.toString();\n };\n PolynomialFunction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolynomialFunction',\n interfaces: []\n };\n function times($receiver, p) {\n return p.multiply_14dthe$($receiver);\n }\n function PolynomialSplineFunction(_knots, _polynomials) {\n this.knots = null;\n this.polynomials = null;\n this.n_0 = 0;\n if (_knots == null) {\n throw IllegalStateException_init('Null argument '.toString());\n }if (_knots.length < 2) {\n throw IllegalStateException_init(('Spline partition must have at least 2 points, got ' + _knots.length).toString());\n }if ((_knots.length - 1 | 0) !== _polynomials.length) {\n throw IllegalStateException_init(('Dimensions mismatch: ' + _polynomials.length + ' polynomial functions != ' + _knots.length + ' segment delimiters').toString());\n }MathArrays_getInstance().checkOrder_gf7tl1$(_knots);\n this.n_0 = _knots.length - 1 | 0;\n this.knots = _knots;\n this.polynomials = Kotlin.newArray(this.n_0, null);\n arrayCopy(_polynomials, this.polynomials, 0, 0, this.n_0);\n }\n PolynomialSplineFunction.prototype.value_14dthe$ = function (v) {\n var tmp$;\n if (v < this.knots[0] || v > this.knots[this.n_0]) {\n throw IllegalStateException_init((v.toString() + ' out of [' + this.knots[0] + ', ' + this.knots[this.n_0] + '] range').toString());\n }var i = binarySearch(toMutableList_0(this.knots), v);\n if (i < 0) {\n i = (-i | 0) - 2 | 0;\n }if (i >= this.polynomials.length) {\n i = i - 1 | 0;\n }return (tmp$ = this.polynomials[i]) != null ? tmp$.value_14dthe$(v - this.knots[i]) : null;\n };\n PolynomialSplineFunction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolynomialSplineFunction',\n interfaces: []\n };\n function Precision() {\n Precision_instance = this;\n this.SGN_MASK_0 = L_2147483648;\n this.SGN_MASK_FLOAT_0 = -2147483648;\n }\n Precision.prototype.compareTo_yvo9jy$ = function (x, y, eps) {\n if (this.equals_yvo9jy$(x, y, eps)) {\n return 0;\n } else if (x < y) {\n return -1;\n }return 1;\n };\n Precision.prototype.compareTo_syxxoe$ = function (x, y, maxUlps) {\n if (this.equals_syxxoe$(x, y, maxUlps)) {\n return 0;\n } else if (x < y) {\n return -1;\n }return 1;\n };\n Precision.prototype.equalsIncludingNaN_dleff0$ = function (x, y) {\n return isNaN_1(x) && isNaN_1(y) || this.equals_a5xegy$(x, y, 1);\n };\n Precision.prototype.equals_y2kzbl$ = function (x, y, eps) {\n var tmp$ = this.equals_a5xegy$(x, y, 1);\n if (!tmp$) {\n var x_0 = y - x;\n tmp$ = JsMath.abs(x_0) <= eps;\n }return tmp$;\n };\n Precision.prototype.equalsIncludingNaN_y2kzbl$ = function (x, y, eps) {\n var tmp$ = this.equalsIncludingNaN_dleff0$(x, y);\n if (!tmp$) {\n var x_0 = y - x;\n tmp$ = JsMath.abs(x_0) <= eps;\n }return tmp$;\n };\n Precision.prototype.equals_a5xegy$ = function (x, y, maxUlps) {\n if (maxUlps === void 0)\n maxUlps = 1;\n var xInt = toBits(x);\n var yInt = toBits(y);\n if (xInt < 0) {\n xInt = this.SGN_MASK_FLOAT_0 - xInt | 0;\n }if (yInt < 0) {\n yInt = this.SGN_MASK_FLOAT_0 - yInt | 0;\n }var isEqual = abs(xInt - yInt | 0) <= maxUlps;\n return isEqual && !isNaN_1(x) && !isNaN_1(y);\n };\n Precision.prototype.equalsIncludingNaN_a5xegy$ = function (x, y, maxUlps) {\n return isNaN_1(x) && isNaN_1(y) || this.equals_a5xegy$(x, y, maxUlps);\n };\n Precision.prototype.equalsIncludingNaN_lu1900$ = function (x, y) {\n return isNaN_0(x) && isNaN_0(y) || this.equals_syxxoe$(x, y, 1);\n };\n Precision.prototype.equals_yvo9jy$ = function (x, y, eps) {\n var tmp$ = this.equals_syxxoe$(x, y, 1);\n if (!tmp$) {\n var x_0 = y - x;\n tmp$ = JsMath.abs(x_0) <= eps;\n }return tmp$;\n };\n Precision.prototype.equalsIncludingNaN_yvo9jy$ = function (x, y, eps) {\n var tmp$ = this.equalsIncludingNaN_lu1900$(x, y);\n if (!tmp$) {\n var x_0 = y - x;\n tmp$ = JsMath.abs(x_0) <= eps;\n }return tmp$;\n };\n Precision.prototype.equals_syxxoe$ = function (x, y, maxUlps) {\n if (maxUlps === void 0)\n maxUlps = 1;\n var xInt = toBits_0(x);\n var yInt = toBits_0(y);\n if (xInt.toNumber() < 0) {\n xInt = this.SGN_MASK_0.subtract(xInt);\n }if (yInt.toNumber() < 0) {\n yInt = this.SGN_MASK_0.subtract(yInt);\n }var isEqual = abs_0(xInt.subtract(yInt)).toNumber() <= maxUlps;\n return isEqual && !isNaN_0(x) && !isNaN_0(y);\n };\n Precision.prototype.equalsIncludingNaN_syxxoe$ = function (x, y, maxUlps) {\n return isNaN_0(x) && isNaN_0(y) || this.equals_syxxoe$(x, y, maxUlps);\n };\n Precision.prototype.representableDelta_lu1900$ = function (x, originalDelta) {\n return x + originalDelta - x;\n };\n Precision.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Precision',\n interfaces: []\n };\n var Precision_instance = null;\n function Precision_getInstance() {\n if (Precision_instance === null) {\n new Precision();\n }return Precision_instance;\n }\n function RealDistribution() {\n }\n RealDistribution.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'RealDistribution',\n interfaces: []\n };\n function SplineInterpolator() {\n }\n SplineInterpolator.prototype.interpolate_g9g6do$ = function (x, y) {\n if (x.length !== y.length) {\n throw IllegalStateException_init(('Dimension mismatch ' + x.length + ' != ' + y.length).toString());\n }if (x.length < 3) {\n throw IllegalStateException_init(('Too small value of points number: ' + x.length + ' < 3').toString());\n }var n = x.length - 1 | 0;\n MathArrays_getInstance().checkOrder_gf7tl1$(x);\n var h = new Float64Array(n);\n for (var i = 0; i < n; i++) {\n h[i] = x[i + 1 | 0] - x[i];\n }\n var mu = new Float64Array(n);\n var z = new Float64Array(n + 1 | 0);\n mu[0] = 0.0;\n z[0] = 0.0;\n for (var i_0 = 1; i_0 < n; i_0++) {\n var g = 2.0 * (x[i_0 + 1 | 0] - x[i_0 - 1 | 0]) - h[i_0 - 1 | 0] * mu[i_0 - 1 | 0];\n mu[i_0] = h[i_0] / g;\n z[i_0] = (3.0 * (y[i_0 + 1 | 0] * h[i_0 - 1 | 0] - y[i_0] * (x[i_0 + 1 | 0] - x[i_0 - 1 | 0]) + y[i_0 - 1 | 0] * h[i_0]) / (h[i_0 - 1 | 0] * h[i_0]) - h[i_0 - 1 | 0] * z[i_0 - 1 | 0]) / g;\n }\n var b = new Float64Array(n);\n var c = new Float64Array(n + 1 | 0);\n var d = new Float64Array(n);\n z[n] = 0.0;\n c[n] = 0.0;\n for (var j = n - 1 | 0; j >= 0; j--) {\n c[j] = z[j] - mu[j] * c[j + 1 | 0];\n b[j] = (y[j + 1 | 0] - y[j]) / h[j] - h[j] * (c[j + 1 | 0] + 2.0 * c[j]) / 3.0;\n d[j] = (c[j + 1 | 0] - c[j]) / (3.0 * h[j]);\n }\n var polynomials = Kotlin.newArray(n, null);\n var coefficients = new Float64Array(4);\n for (var i_1 = 0; i_1 < n; i_1++) {\n coefficients[0] = y[i_1];\n coefficients[1] = b[i_1];\n coefficients[2] = c[i_1];\n coefficients[3] = d[i_1];\n polynomials[i_1] = new PolynomialFunction(coefficients);\n }\n return new PolynomialSplineFunction(x, polynomials);\n };\n SplineInterpolator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SplineInterpolator',\n interfaces: []\n };\n function TDistribution(degreesOfFreedom, solverAbsoluteAccuracy) {\n TDistribution$Companion_getInstance();\n if (solverAbsoluteAccuracy === void 0)\n solverAbsoluteAccuracy = TDistribution$Companion_getInstance().DEFAULT_INVERSE_ABSOLUTE_ACCURACY;\n AbstractRealDistribution.call(this);\n this.degreesOfFreedom_0 = degreesOfFreedom;\n this.solverAbsoluteAccuracy_l8ezvu$_0 = solverAbsoluteAccuracy;\n if (this.degreesOfFreedom_0 <= 0) {\n throw IllegalStateException_init(('NotStrictlyPositive - DEGREES_OF_FREEDOM: ' + this.degreesOfFreedom_0).toString());\n }}\n Object.defineProperty(TDistribution.prototype, 'solverAbsoluteAccuracy', {\n get: function () {\n return this.solverAbsoluteAccuracy_l8ezvu$_0;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'numericalMean', {\n configurable: true,\n get: function () {\n var tmp$;\n var df = this.degreesOfFreedom_0;\n if (df > 1) {\n tmp$ = 0.0;\n } else\n tmp$ = kotlin_js_internal_DoubleCompanionObject.NaN;\n return tmp$;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'numericalVariance', {\n configurable: true,\n get: function () {\n var tmp$;\n var df = this.degreesOfFreedom_0;\n if (df > 2) {\n return df / (df - 2);\n }if (df > 1 && df <= 2) {\n tmp$ = kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY;\n } else\n tmp$ = kotlin_js_internal_DoubleCompanionObject.NaN;\n return tmp$;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'supportLowerBound', {\n configurable: true,\n get: function () {\n return kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'supportUpperBound', {\n configurable: true,\n get: function () {\n return kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'isSupportLowerBoundInclusive', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'isSupportUpperBoundInclusive', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(TDistribution.prototype, 'isSupportConnected', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n TDistribution.prototype.probability_14dthe$ = function (x) {\n return 0.0;\n };\n TDistribution.prototype.density_14dthe$ = function (x) {\n var n = this.degreesOfFreedom_0;\n var nPlus1Over2 = (n + 1) / 2;\n var tmp$ = Gamma_getInstance().logGamma_14dthe$(nPlus1Over2);\n var x_0 = math.PI;\n var tmp$_0 = tmp$ - 0.5 * (JsMath.log(x_0) + JsMath.log(n)) - Gamma_getInstance().logGamma_14dthe$(n / 2);\n var x_1 = 1 + x * x / n;\n var x_2 = tmp$_0 - nPlus1Over2 * JsMath.log(x_1);\n return JsMath.exp(x_2);\n };\n TDistribution.prototype.cumulativeProbability_14dthe$ = function (x) {\n var ret;\n if (x === 0.0) {\n ret = 0.5;\n } else {\n var t = Beta_getInstance().regularizedBeta_tychlm$(this.degreesOfFreedom_0 / (this.degreesOfFreedom_0 + x * x), 0.5 * this.degreesOfFreedom_0, 0.5);\n if (x < 0.0) {\n ret = 0.5 * t;\n } else {\n ret = 1.0 - 0.5 * t;\n }\n }\n return ret;\n };\n function TDistribution$Companion() {\n TDistribution$Companion_instance = this;\n this.DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1.0E-9;\n this.serialVersionUID_0 = L_5852615386664158222;\n }\n TDistribution$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TDistribution$Companion_instance = null;\n function TDistribution$Companion_getInstance() {\n if (TDistribution$Companion_instance === null) {\n new TDistribution$Companion();\n }return TDistribution$Companion_instance;\n }\n TDistribution.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TDistribution',\n interfaces: [AbstractRealDistribution]\n };\n function UnivariateFunction() {\n }\n UnivariateFunction.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'UnivariateFunction',\n interfaces: []\n };\n function UnivariateSolver() {\n }\n UnivariateSolver.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'UnivariateSolver',\n interfaces: [BaseUnivariateSolver]\n };\n function UnivariateSolverUtils() {\n UnivariateSolverUtils_instance = this;\n }\n UnivariateSolverUtils.prototype.solve_ljmp9$ = function (function_0, x0, x1) {\n var solver = BrentSolver_init();\n return solver.solve_rmnly1$(2147483647, function_0, x0, x1);\n };\n UnivariateSolverUtils.prototype.solve_wb66u3$ = function (function_0, x0, x1, absoluteAccuracy) {\n var solver = BrentSolver_init(absoluteAccuracy);\n return solver.solve_rmnly1$(2147483647, function_0, x0, x1);\n };\n UnivariateSolverUtils.prototype.forceSide_i33h9z$ = function (maxEval, f, bracketing, baseRoot, min, max, allowedSolution) {\n if (allowedSolution === AllowedSolution$ANY_SIDE_getInstance()) {\n return baseRoot;\n }var tmp$ = bracketing.absoluteAccuracy;\n var x = baseRoot * bracketing.relativeAccuracy;\n var b = JsMath.abs(x);\n var step = JsMath.max(tmp$, b);\n var b_0 = baseRoot - step;\n var xLo = JsMath.max(min, b_0);\n var fLo = f.value_14dthe$(xLo);\n var b_1 = baseRoot + step;\n var xHi = JsMath.min(max, b_1);\n var fHi = f.value_14dthe$(xHi);\n var remainingEval = maxEval - 2 | 0;\n while (remainingEval > 0) {\n if (fLo >= 0 && fHi <= 0 || (fLo <= 0 && fHi >= 0)) {\n return bracketing.solve_epddgp$(remainingEval, f, xLo, xHi, baseRoot, allowedSolution);\n }var changeLo = false;\n var changeHi = false;\n if (fLo < fHi) {\n if (fLo >= 0) {\n changeLo = true;\n } else {\n changeHi = true;\n }\n } else if (fLo > fHi) {\n if (fLo <= 0) {\n changeLo = true;\n } else {\n changeHi = true;\n }\n } else {\n changeLo = true;\n changeHi = true;\n }\n if (changeLo) {\n var b_2 = xLo - step;\n xLo = JsMath.max(min, b_2);\n fLo = f.value_14dthe$(xLo);\n remainingEval = remainingEval - 1 | 0;\n }if (changeHi) {\n var b_3 = xHi + step;\n xHi = JsMath.min(max, b_3);\n fHi = f.value_14dthe$(xHi);\n remainingEval = remainingEval - 1 | 0;\n }}\n throw IllegalStateException_init('NoBracketing'.toString());\n };\n UnivariateSolverUtils.prototype.bracket_cflw21$ = function (function_0, initial, lowerBound, upperBound, maximumIterations) {\n if (maximumIterations === void 0)\n maximumIterations = 2147483647;\n if (maximumIterations <= 0) {\n throw IllegalStateException_init('NotStrictlyPositive'.toString());\n }this.verifySequence_yvo9jy$(lowerBound, initial, upperBound);\n var a = initial;\n var b = initial;\n var fa;\n var fb;\n var numIterations = 0;\n do {\n var a_0 = a - 1.0;\n a = JsMath.max(a_0, lowerBound);\n var a_1 = b + 1.0;\n b = JsMath.min(a_1, upperBound);\n fa = function_0.value_14dthe$(a);\n fb = function_0.value_14dthe$(b);\n numIterations = numIterations + 1 | 0;\n }\n while (fa * fb > 0.0 && numIterations < maximumIterations && (a > lowerBound || b < upperBound));\n if (fa * fb > 0.0) {\n throw IllegalStateException_init('NoBracketing'.toString());\n }return new Float64Array([a, b]);\n };\n UnivariateSolverUtils.prototype.midpoint_lu1900$ = function (a, b) {\n return (a + b) * 0.5;\n };\n UnivariateSolverUtils.prototype.isBracketing_ljmp9$ = function (function_0, lower, upper) {\n var fLo = function_0.value_14dthe$(lower);\n var fHi = function_0.value_14dthe$(upper);\n return fLo >= 0 && fHi <= 0 || (fLo <= 0 && fHi >= 0);\n };\n UnivariateSolverUtils.prototype.isSequence_yvo9jy$ = function (start, mid, end) {\n return start < mid && mid < end;\n };\n UnivariateSolverUtils.prototype.verifyInterval_lu1900$ = function (lower, upper) {\n if (lower >= upper) {\n throw IllegalStateException_init('NumberIsTooLarge'.toString());\n }};\n UnivariateSolverUtils.prototype.verifySequence_yvo9jy$ = function (lower, initial, upper) {\n this.verifyInterval_lu1900$(lower, initial);\n this.verifyInterval_lu1900$(initial, upper);\n };\n UnivariateSolverUtils.prototype.verifyBracketing_ljmp9$ = function (function_0, lower, upper) {\n this.verifyInterval_lu1900$(lower, upper);\n if (!this.isBracketing_ljmp9$(function_0, lower, upper)) {\n throw IllegalStateException_init('NoBracketing'.toString());\n }};\n UnivariateSolverUtils.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'UnivariateSolverUtils',\n interfaces: []\n };\n var UnivariateSolverUtils_instance = null;\n function UnivariateSolverUtils_getInstance() {\n if (UnivariateSolverUtils_instance === null) {\n new UnivariateSolverUtils();\n }return UnivariateSolverUtils_instance;\n }\n function EvalResult(y, ymin, ymax, se) {\n this.y = y;\n this.ymin = ymin;\n this.ymax = ymax;\n this.se = se;\n }\n EvalResult.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'EvalResult',\n interfaces: []\n };\n EvalResult.prototype.component1 = function () {\n return this.y;\n };\n EvalResult.prototype.component2 = function () {\n return this.ymin;\n };\n EvalResult.prototype.component3 = function () {\n return this.ymax;\n };\n EvalResult.prototype.component4 = function () {\n return this.se;\n };\n EvalResult.prototype.copy_6y0v78$ = function (y, ymin, ymax, se) {\n return new EvalResult(y === void 0 ? this.y : y, ymin === void 0 ? this.ymin : ymin, ymax === void 0 ? this.ymax : ymax, se === void 0 ? this.se : se);\n };\n EvalResult.prototype.toString = function () {\n return 'EvalResult(y=' + Kotlin.toString(this.y) + (', ymin=' + Kotlin.toString(this.ymin)) + (', ymax=' + Kotlin.toString(this.ymax)) + (', se=' + Kotlin.toString(this.se)) + ')';\n };\n EvalResult.prototype.hashCode = function () {\n var result = 0;\n result = result * 31 + Kotlin.hashCode(this.y) | 0;\n result = result * 31 + Kotlin.hashCode(this.ymin) | 0;\n result = result * 31 + Kotlin.hashCode(this.ymax) | 0;\n result = result * 31 + Kotlin.hashCode(this.se) | 0;\n return result;\n };\n EvalResult.prototype.equals = function (other) {\n return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.y, other.y) && Kotlin.equals(this.ymin, other.ymin) && Kotlin.equals(this.ymax, other.ymax) && Kotlin.equals(this.se, other.se)))));\n };\n function LinearRegression(xs, ys, confidenceLevel) {\n RegressionEvaluator.call(this, xs, ys, confidenceLevel);\n this.n_0 = 0;\n this.meanX_0 = 0;\n this.sumXX_0 = 0;\n this.beta1_0 = 0;\n this.beta0_0 = 0;\n this.sy_0 = 0;\n this.tcritical_0 = 0;\n var tmp$ = allFinite(xs, ys);\n var xVals = tmp$.component1()\n , yVals = tmp$.component2();\n this.n_0 = xVals.length;\n this.meanX_0 = average(xVals);\n var tmp$_0;\n var sum = 0;\n for (tmp$_0 = 0; tmp$_0 !== xVals.length; ++tmp$_0) {\n var element = xVals[tmp$_0];\n var $receiver = element - this.meanX_0;\n sum += JsMath.pow($receiver, 2);\n }\n this.sumXX_0 = sum;\n var meanY = average(yVals);\n var tmp$_1;\n var sum_0 = 0;\n for (tmp$_1 = 0; tmp$_1 !== yVals.length; ++tmp$_1) {\n var element_0 = yVals[tmp$_1];\n var $receiver_0 = element_0 - meanY;\n sum_0 += JsMath.pow($receiver_0, 2);\n }\n var sumYY = sum_0;\n var tmp$_2;\n var sum_1 = 0;\n tmp$_2 = zip_0(xVals, yVals).iterator();\n while (tmp$_2.hasNext()) {\n var element_1 = tmp$_2.next();\n var x = element_1.component1()\n , y = element_1.component2();\n sum_1 += (x - this.meanX_0) * (y - meanY);\n }\n var sumXY = sum_1;\n this.beta1_0 = sumXY / this.sumXX_0;\n this.beta0_0 = meanY - this.beta1_0 * this.meanX_0;\n var b = sumYY - sumXY * sumXY / this.sumXX_0;\n var sse = JsMath.max(0.0, b);\n var x_0 = sse / (this.n_0 - 2 | 0);\n this.sy_0 = JsMath.sqrt(x_0);\n var alpha = 1.0 - confidenceLevel;\n this.tcritical_0 = (new TDistribution(this.n_0 - 2.0)).inverseCumulativeProbability_14dthe$(1.0 - alpha / 2.0);\n }\n LinearRegression.prototype.value_0 = function (x) {\n return this.beta1_0 * x + this.beta0_0;\n };\n LinearRegression.prototype.evalX_14dthe$ = function (x) {\n var $receiver = x - this.meanX_0;\n var dxSquare = JsMath.pow($receiver, 2);\n var tmp$ = this.sy_0;\n var x_0 = 1.0 / this.n_0 + dxSquare / this.sumXX_0;\n var se = tmp$ * JsMath.sqrt(x_0);\n var halfConfidenceInterval = this.tcritical_0 * se;\n var yHat = this.value_0(x);\n return new EvalResult(yHat, yHat - halfConfidenceInterval, yHat + halfConfidenceInterval, se);\n };\n LinearRegression.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinearRegression',\n interfaces: [RegressionEvaluator]\n };\n function LocalPolynomialRegression(xs, ys, confidenceLevel, bandwidth) {\n RegressionEvaluator.call(this, xs, ys, confidenceLevel);\n this.bandwidth_0 = bandwidth;\n this.canCompute = false;\n this.n_0 = 0;\n this.meanX_0 = 0;\n this.sumXX_0 = 0;\n this.sy_0 = 0;\n this.tcritical_0 = 0;\n this.polynomial_6goixr$_0 = this.polynomial_6goixr$_0;\n var tmp$;\n var tmp$_0 = averageByX_0(xs, ys);\n var xVals = tmp$_0.component1()\n , yVals = tmp$_0.component2();\n this.n_0 = xVals.length;\n var degreesOfFreedom = this.n_0 - 2.0;\n var bandwidthInPoints = numberToInt(this.bandwidth_0 * this.n_0);\n var bandwidthInPointsOk = bandwidthInPoints >= 2;\n this.canCompute = (this.n_0 >= 3 && degreesOfFreedom > 0 && bandwidthInPointsOk);\n this.meanX_0 = average(xVals);\n var tmp$_1;\n var sum = 0;\n for (tmp$_1 = 0; tmp$_1 !== xVals.length; ++tmp$_1) {\n var element = xVals[tmp$_1];\n var $receiver = element - this.meanX_0;\n sum += JsMath.pow($receiver, 2);\n }\n this.sumXX_0 = sum;\n var meanY = average(yVals);\n var tmp$_2;\n var sum_0 = 0;\n for (tmp$_2 = 0; tmp$_2 !== yVals.length; ++tmp$_2) {\n var element_0 = yVals[tmp$_2];\n var $receiver_0 = element_0 - meanY;\n sum_0 += JsMath.pow($receiver_0, 2);\n }\n var sumYY = sum_0;\n var tmp$_3;\n var sum_1 = 0;\n tmp$_3 = zip_0(xVals, yVals).iterator();\n while (tmp$_3.hasNext()) {\n var element_1 = tmp$_3.next();\n var x = element_1.component1()\n , y = element_1.component2();\n sum_1 += (x - this.meanX_0) * (y - meanY);\n }\n var sumXY = sum_1;\n var b = sumYY - sumXY * sumXY / this.sumXX_0;\n var sse = JsMath.max(0.0, b);\n var x_0 = sse / (this.n_0 - 2 | 0);\n this.sy_0 = JsMath.sqrt(x_0);\n if (this.canCompute) {\n this.polynomial_0 = this.getPoly_0(xVals, yVals);\n }if (this.canCompute) {\n var alpha = 1.0 - confidenceLevel;\n tmp$ = (new TDistribution(degreesOfFreedom)).inverseCumulativeProbability_14dthe$(1.0 - alpha / 2.0);\n } else {\n tmp$ = kotlin_js_internal_DoubleCompanionObject.NaN;\n }\n this.tcritical_0 = tmp$;\n }\n Object.defineProperty(LocalPolynomialRegression.prototype, 'polynomial_0', {\n configurable: true,\n get: function () {\n if (this.polynomial_6goixr$_0 == null)\n return throwUPAE('polynomial');\n return this.polynomial_6goixr$_0;\n },\n set: function (polynomial) {\n this.polynomial_6goixr$_0 = polynomial;\n }\n });\n LocalPolynomialRegression.prototype.evalX_14dthe$ = function (x) {\n var $receiver = x - this.meanX_0;\n var dxSquare = JsMath.pow($receiver, 2);\n var tmp$ = this.sy_0;\n var x_0 = 1.0 / this.n_0 + dxSquare / this.sumXX_0;\n var se = tmp$ * JsMath.sqrt(x_0);\n var halfConfidenceInterval = this.tcritical_0 * se;\n var yHat = ensureNotNull(this.polynomial_0.value_14dthe$(x));\n return new EvalResult(yHat, yHat - halfConfidenceInterval, yHat + halfConfidenceInterval, se);\n };\n LocalPolynomialRegression.prototype.getPoly_0 = function (xVals, yVals) {\n return (new LoessInterpolator(this.bandwidth_0, 4)).interpolate_g9g6do$(xVals, yVals);\n };\n LocalPolynomialRegression.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LocalPolynomialRegression',\n interfaces: [RegressionEvaluator]\n };\n function PolynomialRegression(xs, ys, confidenceLevel, deg) {\n PolynomialRegression$Companion_getInstance();\n RegressionEvaluator.call(this, xs, ys, confidenceLevel);\n this.p_0 = null;\n this.n_0 = 0;\n this.meanX_0 = 0;\n this.sumXX_0 = 0;\n this.sy_0 = 0;\n this.tcritical_0 = 0;\n if (!(deg >= 2)) {\n var message = 'Degree of polynomial must be at least 2';\n throw IllegalArgumentException_init(message.toString());\n }var tmp$ = averageByX_0(xs, ys);\n var xVals = tmp$.component1()\n , yVals = tmp$.component2();\n this.n_0 = xVals.length;\n if (!(this.n_0 > deg)) {\n var message_0 = 'The number of valid data points must be greater than deg';\n throw IllegalArgumentException_init(message_0.toString());\n }this.p_0 = this.calcPolynomial_0(deg, xVals, yVals);\n this.meanX_0 = average(xVals);\n var tmp$_0;\n var sum = 0;\n for (tmp$_0 = 0; tmp$_0 !== xVals.length; ++tmp$_0) {\n var element = xVals[tmp$_0];\n var $receiver = element - this.meanX_0;\n sum += JsMath.pow($receiver, 2);\n }\n this.sumXX_0 = sum;\n var df = (this.n_0 - deg | 0) - 1.0;\n var tmp$_1;\n var sum_0 = 0;\n tmp$_1 = zip_0(xVals, yVals).iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n var x = element_0.component1()\n , y = element_0.component2();\n var $receiver_0 = y - this.p_0.value_14dthe$(x);\n sum_0 += JsMath.pow($receiver_0, 2);\n }\n var sse = sum_0;\n var x_0 = sse / df;\n this.sy_0 = JsMath.sqrt(x_0);\n var alpha = 1.0 - confidenceLevel;\n this.tcritical_0 = (new TDistribution(df)).inverseCumulativeProbability_14dthe$(1.0 - alpha / 2.0);\n }\n PolynomialRegression.prototype.calcPolynomial_0 = function (deg, xVals, yVals) {\n var fpg = new ForsythePolynomialGenerator(xVals);\n var res = new PolynomialFunction(new Float64Array([0.0]));\n for (var i = 0; i <= deg; i++) {\n var p = fpg.getPolynomial_za3lpa$(i);\n var s = this.coefficient_0(p, xVals, yVals);\n res = res.plus_3j0b7h$(times(s, p));\n }\n return res;\n };\n PolynomialRegression.prototype.coefficient_0 = function (p, xVals, yVals) {\n var ww = 0.0;\n var w = 0.0;\n for (var i = 0; i < xVals.length; i++) {\n var x = xVals[i];\n var y = yVals[i];\n var pval = p.value_14dthe$(x);\n ww += pval * pval;\n w += y * pval;\n }\n return w / ww;\n };\n PolynomialRegression.prototype.evalX_14dthe$ = function (x) {\n var $receiver = x - this.meanX_0;\n var dxSquare = JsMath.pow($receiver, 2);\n var tmp$ = this.sy_0;\n var x_0 = 1.0 / this.n_0 + dxSquare / this.sumXX_0;\n var se = tmp$ * JsMath.sqrt(x_0);\n var halfConfidenceInterval = this.tcritical_0 * se;\n var yHat = this.p_0.value_14dthe$(x);\n return new EvalResult(yHat, yHat - halfConfidenceInterval, yHat + halfConfidenceInterval, se);\n };\n function PolynomialRegression$Companion() {\n PolynomialRegression$Companion_instance = this;\n }\n PolynomialRegression$Companion.prototype.canBeComputed_fgqkrm$ = function (xs, ys, deg) {\n var xVals = averageByX_0(xs, ys).component1();\n return xVals.length > deg;\n };\n PolynomialRegression$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PolynomialRegression$Companion_instance = null;\n function PolynomialRegression$Companion_getInstance() {\n if (PolynomialRegression$Companion_instance === null) {\n new PolynomialRegression$Companion();\n }return PolynomialRegression$Companion_instance;\n }\n PolynomialRegression.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolynomialRegression',\n interfaces: [RegressionEvaluator]\n };\n function RegressionEvaluator(xs, ys, confidenceLevel) {\n if (!rangeTo(0.01, 0.99).contains_mef7kx$(confidenceLevel)) {\n var message = 'Confidence level is out of range [0.01-0.99]. CL:' + confidenceLevel;\n throw IllegalArgumentException_init(message.toString());\n }if (!(xs.size === ys.size)) {\n var message_0 = 'X/Y must have same size. X:' + toString(xs.size) + ' Y:' + toString(ys.size);\n throw IllegalArgumentException_init(message_0.toString());\n }}\n RegressionEvaluator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RegressionEvaluator',\n interfaces: []\n };\n var compareBy$lambda_0 = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function RegressionUtil() {\n RegressionUtil_instance = this;\n }\n RegressionUtil.prototype.sampling_v81hsd$ = function (data, m) {\n var tmp$;\n var index = this.sampleInt_0(data.size, m);\n var result = ArrayList_init();\n for (tmp$ = 0; tmp$ !== index.length; ++tmp$) {\n var i = index[tmp$];\n result.add_11rb$(data.get_za3lpa$(i));\n }\n return result;\n };\n RegressionUtil.prototype.sampleInt_0 = function (n, m) {\n if (n < m || m < 0) {\n throw IllegalStateException_init(('Sample ' + m + ' data from ' + n + ' data is impossible!').toString());\n }var perm = new Int32Array(n);\n for (var i = 0; i < n; i++) {\n perm[i] = i;\n }\n var result = new Int32Array(m);\n for (var j = 0; j < m; j++) {\n var r = j + numberToInt(Random.Default.nextDouble() * (n - j | 0)) | 0;\n result[j] = perm[r];\n perm[r] = perm[j];\n }\n return result;\n };\n RegressionUtil.prototype.percentile_av4ikl$ = function (data, p) {\n return Percentile_getInstance().evaluate_pw9xcd$(toDoubleArray(data), p * 100);\n };\n RegressionUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'RegressionUtil',\n interfaces: []\n };\n var RegressionUtil_instance = null;\n function RegressionUtil_getInstance() {\n if (RegressionUtil_instance === null) {\n new RegressionUtil();\n }return RegressionUtil_instance;\n }\n function allFinite(xs, ys) {\n var tmp$;\n var tx = ArrayList_init();\n var ty = ArrayList_init();\n tmp$ = zip_1(asSequence(xs), asSequence(ys)).iterator();\n while (tmp$.hasNext()) {\n var tmp$_0 = tmp$.next();\n var x = tmp$_0.component1()\n , y = tmp$_0.component2();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y)) {\n tx.add_11rb$(ensureNotNull(x));\n ty.add_11rb$(ensureNotNull(y));\n }}\n return new Pair_0(toDoubleArray(tx), toDoubleArray(ty));\n }\n function finitePairs(xs, ys) {\n var tmp$;\n var res = ArrayList_init();\n tmp$ = zip_1(asSequence(xs), asSequence(ys)).iterator();\n while (tmp$.hasNext()) {\n var tmp$_0 = tmp$.next();\n var x = tmp$_0.component1()\n , y = tmp$_0.component2();\n if (data.SeriesUtil.allFinite_jma9l8$(x, y)) {\n res.add_11rb$(new Pair_0(ensureNotNull(x), ensureNotNull(y)));\n }}\n return res;\n }\n function averageByX(lst) {\n var tmp$;\n if (lst.isEmpty())\n return new Pair_0(ArrayList_init(), ArrayList_init());\n var tx = ArrayList_init();\n var ty = ArrayList_init();\n var tmp$_0 = first(lst);\n var prevX = tmp$_0.component1()\n , sumY = tmp$_0.component2();\n var countY = 1;\n tmp$ = drop(asSequence(lst), 1).iterator();\n while (tmp$.hasNext()) {\n var tmp$_1 = tmp$.next();\n var x = tmp$_1.component1()\n , y = tmp$_1.component2();\n if (x === prevX) {\n sumY += y;\n countY = countY + 1 | 0;\n } else {\n tx.add_11rb$(prevX);\n ty.add_11rb$(sumY / countY);\n prevX = x;\n sumY = y;\n countY = 1;\n }\n }\n tx.add_11rb$(prevX);\n ty.add_11rb$(sumY / countY);\n return new Pair_0(tx, ty);\n }\n function averageByX$lambda(it) {\n return it.first;\n }\n function averageByX_0(xs, ys) {\n var tp = finitePairs(xs, ys);\n if (tp.size > 1) {\n sortWith(tp, new Comparator(compareBy$lambda_0(averageByX$lambda)));\n }var res = averageByX(tp);\n return new Pair_0(toDoubleArray(res.first), toDoubleArray(res.second));\n }\n function MutableDouble(myValue) {\n this.myValue_0 = myValue;\n }\n MutableDouble.prototype.getAndAdd_14dthe$ = function (v) {\n var prevValue = this.myValue_0;\n this.myValue_0 = prevValue + v;\n return prevValue;\n };\n MutableDouble.prototype.get = function () {\n return this.myValue_0;\n };\n MutableDouble.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MutableDouble',\n interfaces: []\n };\n function MutableInteger(myValue) {\n this.myValue_0 = myValue;\n }\n Object.defineProperty(MutableInteger.prototype, 'andIncrement', {\n configurable: true,\n get: function () {\n return this.getAndAdd_za3lpa$(1);\n }\n });\n MutableInteger.prototype.get = function () {\n return this.myValue_0;\n };\n MutableInteger.prototype.getAndAdd_za3lpa$ = function (v) {\n var prevValue = this.myValue_0;\n this.myValue_0 = prevValue + v | 0;\n return prevValue;\n };\n MutableInteger.prototype.increment = function () {\n this.getAndAdd_za3lpa$(1);\n };\n MutableInteger.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MutableInteger',\n interfaces: []\n };\n function SamplingUtil() {\n SamplingUtil_instance = this;\n }\n SamplingUtil.prototype.sampleWithoutReplacement_o7ew15$ = function (popSize, sampleSize, rand, onPick, onDrop) {\n var pick = sampleSize <= (popSize / 2 | 0);\n var indexCount = pick ? sampleSize : popSize - sampleSize | 0;\n var indexSet = HashSet_init_1();\n while (indexSet.size < indexCount) {\n indexSet.add_11rb$(rand.nextInt_za3lpa$(popSize));\n }\n return pick ? onPick(indexSet) : onDrop(indexSet);\n };\n function SamplingUtil$sampleWithoutReplacement$lambda(closure$data) {\n return function (it) {\n return closure$data.selectIndices_p1n9e9$(it);\n };\n }\n function SamplingUtil$sampleWithoutReplacement$lambda_0(closure$data) {\n return function (it) {\n return closure$data.dropIndices_p1n9e9$(it);\n };\n }\n SamplingUtil.prototype.sampleWithoutReplacement_egh5ya$ = function (sampleSize, rand, data) {\n return this.sampleWithoutReplacement_o7ew15$(data.rowCount(), sampleSize, rand, SamplingUtil$sampleWithoutReplacement$lambda(data), SamplingUtil$sampleWithoutReplacement$lambda_0(data));\n };\n SamplingUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'SamplingUtil',\n interfaces: []\n };\n var SamplingUtil_instance = null;\n function SamplingUtil_getInstance() {\n if (SamplingUtil_instance === null) {\n new SamplingUtil();\n }return SamplingUtil_instance;\n }\n Object.defineProperty(Aes, 'Companion', {\n get: Aes$Companion_getInstance\n });\n var package$jetbrains = _.jetbrains || (_.jetbrains = {});\n var package$datalore = package$jetbrains.datalore || (package$jetbrains.datalore = {});\n var package$plot = package$datalore.plot || (package$datalore.plot = {});\n var package$base = package$plot.base || (package$plot.base = {});\n package$base.Aes = Aes;\n package$base.Aesthetics = Aesthetics;\n package$base.ContinuousTransform = ContinuousTransform;\n package$base.CoordinateSystem = CoordinateSystem;\n DataFrame.OrderSpec = DataFrame$OrderSpec;\n Object.defineProperty(DataFrame$Variable$Source, 'ORIGIN', {\n get: DataFrame$Variable$Source$ORIGIN_getInstance\n });\n Object.defineProperty(DataFrame$Variable$Source, 'TRANSFORM', {\n get: DataFrame$Variable$Source$TRANSFORM_getInstance\n });\n Object.defineProperty(DataFrame$Variable$Source, 'STAT', {\n get: DataFrame$Variable$Source$STAT_getInstance\n });\n DataFrame$Variable.Source = DataFrame$Variable$Source;\n Object.defineProperty(DataFrame$Variable, 'Companion', {\n get: DataFrame$Variable$Companion_getInstance\n });\n DataFrame.Variable = DataFrame$Variable;\n Object.defineProperty(DataFrame, 'Companion', {\n get: DataFrame$Companion_getInstance\n });\n Object.defineProperty(DataFrame$Builder, 'Companion', {\n get: DataFrame$Builder$Companion_getInstance\n });\n DataFrame.Builder_init = DataFrame$DataFrame$Builder_init;\n DataFrame.Builder_init_dhhkv7$ = DataFrame$DataFrame$Builder_init_0;\n DataFrame.Builder = DataFrame$Builder;\n package$base.DataFrame = DataFrame;\n package$base.DataPointAesthetics = DataPointAesthetics;\n package$base.DiscreteTransform = DiscreteTransform;\n package$base.Geom = Geom;\n package$base.GeomContext = GeomContext;\n Object.defineProperty(GeomKind, 'PATH', {\n get: GeomKind$PATH_getInstance\n });\n Object.defineProperty(GeomKind, 'LINE', {\n get: GeomKind$LINE_getInstance\n });\n Object.defineProperty(GeomKind, 'SMOOTH', {\n get: GeomKind$SMOOTH_getInstance\n });\n Object.defineProperty(GeomKind, 'BAR', {\n get: GeomKind$BAR_getInstance\n });\n Object.defineProperty(GeomKind, 'HISTOGRAM', {\n get: GeomKind$HISTOGRAM_getInstance\n });\n Object.defineProperty(GeomKind, 'TILE', {\n get: GeomKind$TILE_getInstance\n });\n Object.defineProperty(GeomKind, 'BIN_2D', {\n get: GeomKind$BIN_2D_getInstance\n });\n Object.defineProperty(GeomKind, 'MAP', {\n get: GeomKind$MAP_getInstance\n });\n Object.defineProperty(GeomKind, 'ERROR_BAR', {\n get: GeomKind$ERROR_BAR_getInstance\n });\n Object.defineProperty(GeomKind, 'CROSS_BAR', {\n get: GeomKind$CROSS_BAR_getInstance\n });\n Object.defineProperty(GeomKind, 'LINE_RANGE', {\n get: GeomKind$LINE_RANGE_getInstance\n });\n Object.defineProperty(GeomKind, 'POINT_RANGE', {\n get: GeomKind$POINT_RANGE_getInstance\n });\n Object.defineProperty(GeomKind, 'POLYGON', {\n get: GeomKind$POLYGON_getInstance\n });\n Object.defineProperty(GeomKind, 'AB_LINE', {\n get: GeomKind$AB_LINE_getInstance\n });\n Object.defineProperty(GeomKind, 'H_LINE', {\n get: GeomKind$H_LINE_getInstance\n });\n Object.defineProperty(GeomKind, 'V_LINE', {\n get: GeomKind$V_LINE_getInstance\n });\n Object.defineProperty(GeomKind, 'BOX_PLOT', {\n get: GeomKind$BOX_PLOT_getInstance\n });\n Object.defineProperty(GeomKind, 'LIVE_MAP', {\n get: GeomKind$LIVE_MAP_getInstance\n });\n Object.defineProperty(GeomKind, 'POINT', {\n get: GeomKind$POINT_getInstance\n });\n Object.defineProperty(GeomKind, 'RIBBON', {\n get: GeomKind$RIBBON_getInstance\n });\n Object.defineProperty(GeomKind, 'AREA', {\n get: GeomKind$AREA_getInstance\n });\n Object.defineProperty(GeomKind, 'DENSITY', {\n get: GeomKind$DENSITY_getInstance\n });\n Object.defineProperty(GeomKind, 'CONTOUR', {\n get: GeomKind$CONTOUR_getInstance\n });\n Object.defineProperty(GeomKind, 'CONTOURF', {\n get: GeomKind$CONTOURF_getInstance\n });\n Object.defineProperty(GeomKind, 'DENSITY2D', {\n get: GeomKind$DENSITY2D_getInstance\n });\n Object.defineProperty(GeomKind, 'DENSITY2DF', {\n get: GeomKind$DENSITY2DF_getInstance\n });\n Object.defineProperty(GeomKind, 'JITTER', {\n get: GeomKind$JITTER_getInstance\n });\n Object.defineProperty(GeomKind, 'FREQPOLY', {\n get: GeomKind$FREQPOLY_getInstance\n });\n Object.defineProperty(GeomKind, 'STEP', {\n get: GeomKind$STEP_getInstance\n });\n Object.defineProperty(GeomKind, 'RECT', {\n get: GeomKind$RECT_getInstance\n });\n Object.defineProperty(GeomKind, 'SEGMENT', {\n get: GeomKind$SEGMENT_getInstance\n });\n Object.defineProperty(GeomKind, 'TEXT', {\n get: GeomKind$TEXT_getInstance\n });\n Object.defineProperty(GeomKind, 'RASTER', {\n get: GeomKind$RASTER_getInstance\n });\n Object.defineProperty(GeomKind, 'IMAGE', {\n get: GeomKind$IMAGE_getInstance\n });\n package$base.GeomKind = GeomKind;\n Object.defineProperty(package$base, 'GeomMeta', {\n get: GeomMeta_getInstance\n });\n package$base.PositionAdjustment = PositionAdjustment;\n Scale.Builder = Scale$Builder;\n package$base.Scale = Scale;\n package$base.Stat = Stat;\n package$base.StatContext = StatContext;\n package$base.Transform = Transform;\n var package$aes = package$base.aes || (package$base.aes = {});\n Object.defineProperty(package$aes, 'AesInitValue', {\n get: AesInitValue_getInstance\n });\n Object.defineProperty(package$aes, 'AesScaling', {\n get: AesScaling_getInstance\n });\n package$aes.AesVisitor = AesVisitor;\n Object.defineProperty(AestheticsBuilder, 'Companion', {\n get: AestheticsBuilder$Companion_getInstance\n });\n package$aes.AestheticsBuilder = AestheticsBuilder;\n Object.defineProperty(AestheticsDefaults, 'Companion', {\n get: AestheticsDefaults$Companion_getInstance\n });\n package$aes.AestheticsDefaults = AestheticsDefaults;\n Object.defineProperty(package$aes, 'AestheticsUtil', {\n get: AestheticsUtil_getInstance\n });\n package$aes.TypedIndexFunctionMap = TypedIndexFunctionMap;\n var package$coord = package$base.coord || (package$base.coord = {});\n Object.defineProperty(package$coord, 'Coords', {\n get: Coords_getInstance\n });\n package$coord.DefaultCoordinateSystem = DefaultCoordinateSystem;\n package$coord.Projection = Projection;\n var package$data = package$base.data || (package$base.data = {});\n Object.defineProperty(package$data, 'DataFrameUtil', {\n get: DataFrameUtil_getInstance\n });\n Object.defineProperty(package$data, 'Dummies', {\n get: Dummies_getInstance\n });\n Object.defineProperty(package$data, 'TransformVar', {\n get: TransformVar_getInstance\n });\n Object.defineProperty(ABLineGeom, 'Companion', {\n get: ABLineGeom$Companion_getInstance\n });\n var package$geom = package$base.geom || (package$base.geom = {});\n package$geom.ABLineGeom = ABLineGeom;\n Object.defineProperty(AreaGeom, 'Companion', {\n get: AreaGeom$Companion_getInstance\n });\n package$geom.AreaGeom = AreaGeom;\n Object.defineProperty(BarGeom, 'Companion', {\n get: BarGeom$Companion_getInstance\n });\n package$geom.BarGeom = BarGeom;\n Object.defineProperty(Bin2dGeom, 'Companion', {\n get: Bin2dGeom$Companion_getInstance\n });\n package$geom.Bin2dGeom = Bin2dGeom;\n Object.defineProperty(BoxplotGeom, 'Companion', {\n get: BoxplotGeom$Companion_getInstance\n });\n package$geom.BoxplotGeom = BoxplotGeom;\n Object.defineProperty(ContourGeom, 'Companion', {\n get: ContourGeom$Companion_getInstance\n });\n package$geom.ContourGeom = ContourGeom;\n Object.defineProperty(ContourfGeom, 'Companion', {\n get: ContourfGeom$Companion_getInstance\n });\n package$geom.ContourfGeom = ContourfGeom;\n Object.defineProperty(CrossBarGeom, 'Companion', {\n get: CrossBarGeom$Companion_getInstance\n });\n package$geom.CrossBarGeom = CrossBarGeom;\n Object.defineProperty(Density2dGeom, 'Companion', {\n get: Density2dGeom$Companion_getInstance\n });\n package$geom.Density2dGeom = Density2dGeom;\n Object.defineProperty(Density2dfGeom, 'Companion', {\n get: Density2dfGeom$Companion_getInstance\n });\n package$geom.Density2dfGeom = Density2dfGeom;\n Object.defineProperty(DensityGeom, 'Companion', {\n get: DensityGeom$Companion_getInstance\n });\n package$geom.DensityGeom = DensityGeom;\n Object.defineProperty(ErrorBarGeom, 'Companion', {\n get: ErrorBarGeom$Companion_getInstance\n });\n package$geom.ErrorBarGeom = ErrorBarGeom;\n Object.defineProperty(FilledCircleLegendKeyElementFactory, 'Companion', {\n get: FilledCircleLegendKeyElementFactory$Companion_getInstance\n });\n package$geom.FilledCircleLegendKeyElementFactory = FilledCircleLegendKeyElementFactory;\n package$geom.FilledSquareLegendKeyElementFactory = FilledSquareLegendKeyElementFactory;\n Object.defineProperty(FreqpolyGeom, 'Companion', {\n get: FreqpolyGeom$Companion_getInstance\n });\n package$geom.FreqpolyGeom = FreqpolyGeom;\n Object.defineProperty(GeomBase, 'Companion', {\n get: GeomBase$Companion_getInstance\n });\n package$geom.GeomBase = GeomBase;\n Object.defineProperty(HLineGeom, 'Companion', {\n get: HLineGeom$Companion_getInstance\n });\n package$geom.HLineGeom = HLineGeom;\n Object.defineProperty(HistogramGeom, 'Companion', {\n get: HistogramGeom$Companion_getInstance\n });\n package$geom.HistogramGeom = HistogramGeom;\n Object.defineProperty(ImageGeom, 'Companion', {\n get: ImageGeom$Companion_getInstance\n });\n package$geom.ImageGeom = ImageGeom;\n Object.defineProperty(JitterGeom, 'Companion', {\n get: JitterGeom$Companion_getInstance\n });\n package$geom.JitterGeom = JitterGeom;\n Object.defineProperty(LineGeom, 'Companion', {\n get: LineGeom$Companion_getInstance\n });\n package$geom.LineGeom = LineGeom;\n Object.defineProperty(LineRangeGeom, 'Companion', {\n get: LineRangeGeom$Companion_getInstance\n });\n package$geom.LineRangeGeom = LineRangeGeom;\n Object.defineProperty(LiveMapGeom, 'Companion', {\n get: LiveMapGeom$Companion_getInstance\n });\n package$geom.LiveMapGeom = LiveMapGeom;\n LiveMapProvider.LiveMapData = LiveMapProvider$LiveMapData;\n package$geom.LiveMapProvider = LiveMapProvider;\n Object.defineProperty(MapGeom, 'Companion', {\n get: MapGeom$Companion_getInstance\n });\n package$geom.MapGeom = MapGeom;\n Object.defineProperty(PathGeom, 'Companion', {\n get: PathGeom$Companion_getInstance\n });\n package$geom.PathGeom = PathGeom;\n Object.defineProperty(PieGeom, 'Companion', {\n get: PieGeom$Companion_getInstance\n });\n package$geom.PieGeom = PieGeom;\n Object.defineProperty(PointGeom, 'Companion', {\n get: PointGeom$Companion_getInstance\n });\n package$geom.PointGeom = PointGeom;\n package$geom.PointLegendKeyElementFactory = PointLegendKeyElementFactory;\n Object.defineProperty(PointRangeGeom, 'Companion', {\n get: PointRangeGeom$Companion_getInstance\n });\n package$geom.PointRangeGeom = PointRangeGeom;\n Object.defineProperty(PolygonGeom, 'Companion', {\n get: PolygonGeom$Companion_getInstance\n });\n package$geom.PolygonGeom = PolygonGeom;\n Object.defineProperty(RasterGeom, 'Companion', {\n get: RasterGeom$Companion_getInstance\n });\n package$geom.RasterGeom = RasterGeom;\n Object.defineProperty(RectGeom, 'Companion', {\n get: RectGeom$Companion_getInstance\n });\n package$geom.RectGeom = RectGeom;\n Object.defineProperty(RibbonGeom, 'Companion', {\n get: RibbonGeom$Companion_getInstance\n });\n package$geom.RibbonGeom = RibbonGeom;\n Object.defineProperty(SegmentGeom, 'Companion', {\n get: SegmentGeom$Companion_getInstance\n });\n package$geom.SegmentGeom = SegmentGeom;\n Object.defineProperty(SmoothGeom, 'Companion', {\n get: SmoothGeom$Companion_getInstance\n });\n package$geom.SmoothGeom = SmoothGeom;\n Object.defineProperty(StepGeom$Direction, 'HV', {\n get: StepGeom$Direction$HV_getInstance\n });\n Object.defineProperty(StepGeom$Direction, 'VH', {\n get: StepGeom$Direction$VH_getInstance\n });\n Object.defineProperty(StepGeom$Direction, 'Companion', {\n get: StepGeom$Direction$Companion_getInstance\n });\n StepGeom.Direction = StepGeom$Direction;\n Object.defineProperty(StepGeom, 'Companion', {\n get: StepGeom$Companion_getInstance\n });\n package$geom.StepGeom = StepGeom;\n Object.defineProperty(TextGeom, 'Companion', {\n get: TextGeom$Companion_getInstance\n });\n package$geom.TextGeom = TextGeom;\n package$geom.TextLegendKeyElementFactory = TextLegendKeyElementFactory;\n Object.defineProperty(TileGeom, 'Companion', {\n get: TileGeom$Companion_getInstance\n });\n package$geom.TileGeom = TileGeom;\n Object.defineProperty(VLineGeom, 'Companion', {\n get: VLineGeom$Companion_getInstance\n });\n package$geom.VLineGeom = VLineGeom;\n var package$legend = package$geom.legend || (package$geom.legend = {});\n package$legend.CompositeLegendKeyElementFactory = CompositeLegendKeyElementFactory;\n package$legend.GenericLegendKeyElementFactory = GenericLegendKeyElementFactory;\n package$legend.HLineLegendKeyElementFactory = HLineLegendKeyElementFactory;\n package$legend.VLineLegendKeyElementFactory = VLineLegendKeyElementFactory;\n Object.defineProperty(ArrowSpec$End, 'LAST', {\n get: ArrowSpec$End$LAST_getInstance\n });\n Object.defineProperty(ArrowSpec$End, 'FIRST', {\n get: ArrowSpec$End$FIRST_getInstance\n });\n Object.defineProperty(ArrowSpec$End, 'BOTH', {\n get: ArrowSpec$End$BOTH_getInstance\n });\n ArrowSpec.End = ArrowSpec$End;\n Object.defineProperty(ArrowSpec$Type, 'OPEN', {\n get: ArrowSpec$Type$OPEN_getInstance\n });\n Object.defineProperty(ArrowSpec$Type, 'CLOSED', {\n get: ArrowSpec$Type$CLOSED_getInstance\n });\n ArrowSpec.Type = ArrowSpec$Type;\n var package$util = package$geom.util || (package$geom.util = {});\n package$util.ArrowSpec = ArrowSpec;\n Object.defineProperty(package$util, 'BarTooltipHelper', {\n get: BarTooltipHelper_getInstance\n });\n Object.defineProperty(package$util, 'CrossBarHelper', {\n get: CrossBarHelper_getInstance\n });\n package$util.DataPointAestheticsDelegate = DataPointAestheticsDelegate;\n package$util.GeomCoord = GeomCoord;\n GeomHelper.SvgElementHelper = GeomHelper$SvgElementHelper;\n Object.defineProperty(GeomHelper, 'Companion', {\n get: GeomHelper$Companion_getInstance\n });\n package$util.GeomHelper = GeomHelper;\n Object.defineProperty(package$util, 'GeomUtil', {\n get: GeomUtil_getInstance\n });\n Object.defineProperty(package$util, 'HintColorUtil', {\n get: HintColorUtil_getInstance\n });\n HintsCollection$HintConfigFactory.HintConfig = HintsCollection$HintConfigFactory$HintConfig;\n HintsCollection.HintConfigFactory = HintsCollection$HintConfigFactory;\n package$util.HintsCollection = HintsCollection;\n Object.defineProperty(LinePathConstructor, 'Companion', {\n get: LinePathConstructor$Companion_getInstance\n });\n package$util.LinePathConstructor = LinePathConstructor;\n LinesHelper.PathInfo = LinesHelper$PathInfo;\n package$util.LinesHelper = LinesHelper;\n package$util.MappedAesthetics = MappedAesthetics;\n package$util.MultiPointData = MultiPointData;\n MultiPointDataConstructor.prototype.PointCollector = MultiPointDataConstructor$PointCollector;\n Object.defineProperty(package$util, 'MultiPointDataConstructor', {\n get: MultiPointDataConstructor_getInstance\n });\n package$util.RectTargetCollectorHelper = RectTargetCollectorHelper;\n package$util.RectanglesHelper = RectanglesHelper;\n var package$interact = package$base.interact || (package$base.interact = {});\n package$interact.ContextualMapping = ContextualMapping;\n package$interact.DataContext = DataContext;\n package$interact.GeomTarget = GeomTarget;\n Object.defineProperty(GeomTargetCollector$TooltipParams, 'Companion', {\n get: GeomTargetCollector$TooltipParams$Companion_getInstance\n });\n GeomTargetCollector.TooltipParams = GeomTargetCollector$TooltipParams;\n package$interact.GeomTargetCollector = GeomTargetCollector;\n Object.defineProperty(GeomTargetLocator$LookupSpace, 'X', {\n get: GeomTargetLocator$LookupSpace$X_getInstance\n });\n Object.defineProperty(GeomTargetLocator$LookupSpace, 'XY', {\n get: GeomTargetLocator$LookupSpace$XY_getInstance\n });\n Object.defineProperty(GeomTargetLocator$LookupSpace, 'NONE', {\n get: GeomTargetLocator$LookupSpace$NONE_getInstance\n });\n GeomTargetLocator.LookupSpace = GeomTargetLocator$LookupSpace;\n Object.defineProperty(GeomTargetLocator$LookupStrategy, 'HOVER', {\n get: GeomTargetLocator$LookupStrategy$HOVER_getInstance\n });\n Object.defineProperty(GeomTargetLocator$LookupStrategy, 'NEAREST', {\n get: GeomTargetLocator$LookupStrategy$NEAREST_getInstance\n });\n Object.defineProperty(GeomTargetLocator$LookupStrategy, 'NONE', {\n get: GeomTargetLocator$LookupStrategy$NONE_getInstance\n });\n GeomTargetLocator.LookupStrategy = GeomTargetLocator$LookupStrategy;\n Object.defineProperty(GeomTargetLocator$LookupSpec, 'Companion', {\n get: GeomTargetLocator$LookupSpec$Companion_getInstance\n });\n GeomTargetLocator.LookupSpec = GeomTargetLocator$LookupSpec;\n GeomTargetLocator.LookupResult = GeomTargetLocator$LookupResult;\n package$interact.GeomTargetLocator = GeomTargetLocator;\n Object.defineProperty(HitShape$Kind, 'POINT', {\n get: HitShape$Kind$POINT_getInstance\n });\n Object.defineProperty(HitShape$Kind, 'RECT', {\n get: HitShape$Kind$RECT_getInstance\n });\n Object.defineProperty(HitShape$Kind, 'POLYGON', {\n get: HitShape$Kind$POLYGON_getInstance\n });\n Object.defineProperty(HitShape$Kind, 'PATH', {\n get: HitShape$Kind$PATH_getInstance\n });\n HitShape.Kind = HitShape$Kind;\n HitShape.DoubleCircle = HitShape$DoubleCircle;\n Object.defineProperty(HitShape, 'Companion', {\n get: HitShape$Companion_getInstance\n });\n package$interact.HitShape = HitShape;\n MappedDataAccess.MappedData = MappedDataAccess$MappedData;\n package$interact.MappedDataAccess = MappedDataAccess;\n package$interact.NullGeomTargetCollector = NullGeomTargetCollector;\n Object.defineProperty(TipLayoutHint$StemLength, 'NORMAL', {\n get: TipLayoutHint$StemLength$NORMAL_getInstance\n });\n Object.defineProperty(TipLayoutHint$StemLength, 'SHORT', {\n get: TipLayoutHint$StemLength$SHORT_getInstance\n });\n Object.defineProperty(TipLayoutHint$StemLength, 'NONE', {\n get: TipLayoutHint$StemLength$NONE_getInstance\n });\n TipLayoutHint.StemLength = TipLayoutHint$StemLength;\n Object.defineProperty(TipLayoutHint$Kind, 'VERTICAL_TOOLTIP', {\n get: TipLayoutHint$Kind$VERTICAL_TOOLTIP_getInstance\n });\n Object.defineProperty(TipLayoutHint$Kind, 'HORIZONTAL_TOOLTIP', {\n get: TipLayoutHint$Kind$HORIZONTAL_TOOLTIP_getInstance\n });\n Object.defineProperty(TipLayoutHint$Kind, 'CURSOR_TOOLTIP', {\n get: TipLayoutHint$Kind$CURSOR_TOOLTIP_getInstance\n });\n Object.defineProperty(TipLayoutHint$Kind, 'X_AXIS_TOOLTIP', {\n get: TipLayoutHint$Kind$X_AXIS_TOOLTIP_getInstance\n });\n Object.defineProperty(TipLayoutHint$Kind, 'Y_AXIS_TOOLTIP', {\n get: TipLayoutHint$Kind$Y_AXIS_TOOLTIP_getInstance\n });\n TipLayoutHint.Kind = TipLayoutHint$Kind;\n Object.defineProperty(TipLayoutHint, 'Companion', {\n get: TipLayoutHint$Companion_getInstance\n });\n package$interact.TipLayoutHint = TipLayoutHint;\n Object.defineProperty(TooltipAnchor$VerticalAnchor, 'TOP', {\n get: TooltipAnchor$VerticalAnchor$TOP_getInstance\n });\n Object.defineProperty(TooltipAnchor$VerticalAnchor, 'BOTTOM', {\n get: TooltipAnchor$VerticalAnchor$BOTTOM_getInstance\n });\n Object.defineProperty(TooltipAnchor$VerticalAnchor, 'MIDDLE', {\n get: TooltipAnchor$VerticalAnchor$MIDDLE_getInstance\n });\n TooltipAnchor.VerticalAnchor = TooltipAnchor$VerticalAnchor;\n Object.defineProperty(TooltipAnchor$HorizontalAnchor, 'LEFT', {\n get: TooltipAnchor$HorizontalAnchor$LEFT_getInstance\n });\n Object.defineProperty(TooltipAnchor$HorizontalAnchor, 'RIGHT', {\n get: TooltipAnchor$HorizontalAnchor$RIGHT_getInstance\n });\n Object.defineProperty(TooltipAnchor$HorizontalAnchor, 'CENTER', {\n get: TooltipAnchor$HorizontalAnchor$CENTER_getInstance\n });\n TooltipAnchor.HorizontalAnchor = TooltipAnchor$HorizontalAnchor;\n package$interact.TooltipAnchor = TooltipAnchor;\n TooltipLineSpec.DataPoint = TooltipLineSpec$DataPoint;\n package$interact.TooltipLineSpec = TooltipLineSpec;\n Object.defineProperty(LivemapConstants$DisplayMode, 'POINT', {\n get: LivemapConstants$DisplayMode$POINT_getInstance\n });\n Object.defineProperty(LivemapConstants$DisplayMode, 'PIE', {\n get: LivemapConstants$DisplayMode$PIE_getInstance\n });\n Object.defineProperty(LivemapConstants$DisplayMode, 'BAR', {\n get: LivemapConstants$DisplayMode$BAR_getInstance\n });\n LivemapConstants.DisplayMode = LivemapConstants$DisplayMode;\n Object.defineProperty(LivemapConstants$Theme, 'COLOR', {\n get: LivemapConstants$Theme$COLOR_getInstance\n });\n Object.defineProperty(LivemapConstants$Theme, 'LIGHT', {\n get: LivemapConstants$Theme$LIGHT_getInstance\n });\n Object.defineProperty(LivemapConstants$Theme, 'DARK', {\n get: LivemapConstants$Theme$DARK_getInstance\n });\n LivemapConstants.Theme = LivemapConstants$Theme;\n Object.defineProperty(LivemapConstants$Projection, 'EPSG3857', {\n get: LivemapConstants$Projection$EPSG3857_getInstance\n });\n Object.defineProperty(LivemapConstants$Projection, 'EPSG4326', {\n get: LivemapConstants$Projection$EPSG4326_getInstance\n });\n Object.defineProperty(LivemapConstants$Projection, 'AZIMUTHAL', {\n get: LivemapConstants$Projection$AZIMUTHAL_getInstance\n });\n Object.defineProperty(LivemapConstants$Projection, 'CONIC', {\n get: LivemapConstants$Projection$CONIC_getInstance\n });\n LivemapConstants.Projection = LivemapConstants$Projection;\n var package$livemap = package$base.livemap || (package$base.livemap = {});\n package$livemap.LivemapConstants = LivemapConstants;\n package$livemap.LiveMapOptions = LiveMapOptions;\n var package$pos = package$base.pos || (package$base.pos = {});\n package$pos.DodgePos = DodgePos;\n package$pos.FillPos = FillPos;\n package$pos.JitterDodgePos = JitterDodgePos;\n Object.defineProperty(JitterPos, 'Companion', {\n get: JitterPos$Companion_getInstance\n });\n package$pos.JitterPos = JitterPos;\n Object.defineProperty(NudgePos, 'Companion', {\n get: NudgePos$Companion_getInstance\n });\n package$pos.NudgePos = NudgePos;\n Object.defineProperty(PositionAdjustments$Meta, 'IDENTITY', {\n get: PositionAdjustments$Meta$IDENTITY_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'DODGE', {\n get: PositionAdjustments$Meta$DODGE_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'STACK', {\n get: PositionAdjustments$Meta$STACK_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'FILL', {\n get: PositionAdjustments$Meta$FILL_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'JITTER', {\n get: PositionAdjustments$Meta$JITTER_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'NUDGE', {\n get: PositionAdjustments$Meta$NUDGE_getInstance\n });\n Object.defineProperty(PositionAdjustments$Meta, 'JITTER_DODGE', {\n get: PositionAdjustments$Meta$JITTER_DODGE_getInstance\n });\n PositionAdjustments.prototype.Meta = PositionAdjustments$Meta;\n Object.defineProperty(PositionAdjustments$StackingStrategy, 'SUM_POSITIVE_NEGATIVE', {\n get: PositionAdjustments$StackingStrategy$SUM_POSITIVE_NEGATIVE_getInstance\n });\n Object.defineProperty(PositionAdjustments$StackingStrategy, 'SPLIT_POSITIVE_NEGATIVE', {\n get: PositionAdjustments$StackingStrategy$SPLIT_POSITIVE_NEGATIVE_getInstance\n });\n PositionAdjustments.prototype.StackingStrategy = PositionAdjustments$StackingStrategy;\n Object.defineProperty(package$pos, 'PositionAdjustments', {\n get: PositionAdjustments_getInstance\n });\n Object.defineProperty(StackPos, 'Companion', {\n get: StackPos$Companion_getInstance\n });\n package$pos.StackPos = StackPos;\n var package$render = package$base.render || (package$base.render = {});\n package$render.LegendKeyElementFactory = LegendKeyElementFactory;\n package$render.SvgRoot = SvgRoot;\n var package$linetype = package$render.linetype || (package$render.linetype = {});\n package$linetype.LineType = LineType;\n Object.defineProperty(NamedLineType, 'BLANK', {\n get: NamedLineType$BLANK_getInstance\n });\n Object.defineProperty(NamedLineType, 'SOLID', {\n get: NamedLineType$SOLID_getInstance\n });\n Object.defineProperty(NamedLineType, 'DASHED', {\n get: NamedLineType$DASHED_getInstance\n });\n Object.defineProperty(NamedLineType, 'DOTTED', {\n get: NamedLineType$DOTTED_getInstance\n });\n Object.defineProperty(NamedLineType, 'DOTDASH', {\n get: NamedLineType$DOTDASH_getInstance\n });\n Object.defineProperty(NamedLineType, 'LONGDASH', {\n get: NamedLineType$LONGDASH_getInstance\n });\n Object.defineProperty(NamedLineType, 'TWODASH', {\n get: NamedLineType$TWODASH_getInstance\n });\n package$linetype.NamedLineType = NamedLineType;\n Object.defineProperty(NamedShape, 'STICK_SQUARE', {\n get: NamedShape$STICK_SQUARE_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_CIRCLE', {\n get: NamedShape$STICK_CIRCLE_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_TRIANGLE_UP', {\n get: NamedShape$STICK_TRIANGLE_UP_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_PLUS', {\n get: NamedShape$STICK_PLUS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_CROSS', {\n get: NamedShape$STICK_CROSS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_DIAMOND', {\n get: NamedShape$STICK_DIAMOND_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_TRIANGLE_DOWN', {\n get: NamedShape$STICK_TRIANGLE_DOWN_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_SQUARE_CROSS', {\n get: NamedShape$STICK_SQUARE_CROSS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_STAR', {\n get: NamedShape$STICK_STAR_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_DIAMOND_PLUS', {\n get: NamedShape$STICK_DIAMOND_PLUS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_CIRCLE_PLUS', {\n get: NamedShape$STICK_CIRCLE_PLUS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_TRIANGLE_UP_DOWN', {\n get: NamedShape$STICK_TRIANGLE_UP_DOWN_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_SQUARE_PLUS', {\n get: NamedShape$STICK_SQUARE_PLUS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_CIRCLE_CROSS', {\n get: NamedShape$STICK_CIRCLE_CROSS_getInstance\n });\n Object.defineProperty(NamedShape, 'STICK_SQUARE_TRIANGLE_UP', {\n get: NamedShape$STICK_SQUARE_TRIANGLE_UP_getInstance\n });\n Object.defineProperty(NamedShape, 'SOLID_SQUARE', {\n get: NamedShape$SOLID_SQUARE_getInstance\n });\n Object.defineProperty(NamedShape, 'SOLID_CIRCLE', {\n get: NamedShape$SOLID_CIRCLE_getInstance\n });\n Object.defineProperty(NamedShape, 'SOLID_TRIANGLE_UP', {\n get: NamedShape$SOLID_TRIANGLE_UP_getInstance\n });\n Object.defineProperty(NamedShape, 'SOLID_DIAMOND', {\n get: NamedShape$SOLID_DIAMOND_getInstance\n });\n Object.defineProperty(NamedShape, 'SOLID_CIRCLE_2', {\n get: NamedShape$SOLID_CIRCLE_2_getInstance\n });\n Object.defineProperty(NamedShape, 'BULLET', {\n get: NamedShape$BULLET_getInstance\n });\n Object.defineProperty(NamedShape, 'FILLED_CIRCLE', {\n get: NamedShape$FILLED_CIRCLE_getInstance\n });\n Object.defineProperty(NamedShape, 'FILLED_SQUARE', {\n get: NamedShape$FILLED_SQUARE_getInstance\n });\n Object.defineProperty(NamedShape, 'FILLED_DIAMOND', {\n get: NamedShape$FILLED_DIAMOND_getInstance\n });\n Object.defineProperty(NamedShape, 'FILLED_TRIANGLE_UP', {\n get: NamedShape$FILLED_TRIANGLE_UP_getInstance\n });\n Object.defineProperty(NamedShape, 'FILLED_TRIANGLE_DOWN', {\n get: NamedShape$FILLED_TRIANGLE_DOWN_getInstance\n });\n var package$point = package$render.point || (package$render.point = {});\n package$point.NamedShape = NamedShape;\n package$point.PointShape = PointShape;\n Object.defineProperty(package$point, 'PointShapeSvg', {\n get: PointShapeSvg_getInstance\n });\n Object.defineProperty(package$point, 'TinyPointShape', {\n get: TinyPointShape_getInstance\n });\n package$point.UpdatableShape = UpdatableShape;\n var package$symbol = package$point.symbol || (package$point.symbol = {});\n package$symbol.CircleGlyph = CircleGlyph;\n Object.defineProperty(CrossGlyph, 'Companion', {\n get: CrossGlyph$Companion_getInstance\n });\n package$symbol.CrossGlyph = CrossGlyph;\n package$symbol.DiamondGlyph = DiamondGlyph;\n package$symbol.Glyph = Glyph;\n package$symbol.GlyphPair = GlyphPair;\n Object.defineProperty(package$symbol, 'GlyphUtil', {\n get: GlyphUtil_getInstance\n });\n Object.defineProperty(package$symbol, 'Glyphs', {\n get: Glyphs_getInstance\n });\n package$symbol.MultiShapeGlyph = MultiShapeGlyph;\n package$symbol.PlusGlyph = PlusGlyph;\n package$symbol.SingletonGlyph_init_i91tmr$ = SingletonGlyph_init;\n package$symbol.SingletonGlyph_init_e1sv3v$ = SingletonGlyph_init_0;\n package$symbol.SingletonGlyph = SingletonGlyph;\n package$symbol.SquareGlyph = SquareGlyph;\n Object.defineProperty(TriangleGlyph, 'Companion', {\n get: TriangleGlyph$Companion_getInstance\n });\n package$symbol.TriangleGlyph = TriangleGlyph;\n package$symbol.TwoShapeGlyph = TwoShapeGlyph;\n var package$svg = package$render.svg || (package$render.svg = {});\n package$svg.GroupComponent = GroupComponent;\n Object.defineProperty(LinePath, 'Companion', {\n get: LinePath$Companion_getInstance\n });\n package$svg.LinePath = LinePath;\n Object.defineProperty(package$svg, 'StrokeDashArraySupport', {\n get: StrokeDashArraySupport_getInstance\n });\n Object.defineProperty(SvgComponent, 'Companion', {\n get: SvgComponent$Companion_getInstance\n });\n package$svg.SvgComponent = SvgComponent;\n Object.defineProperty(package$svg, 'SvgUID', {\n get: SvgUID_getInstance\n });\n Object.defineProperty(TextLabel$HorizontalAnchor, 'LEFT', {\n get: TextLabel$HorizontalAnchor$LEFT_getInstance\n });\n Object.defineProperty(TextLabel$HorizontalAnchor, 'RIGHT', {\n get: TextLabel$HorizontalAnchor$RIGHT_getInstance\n });\n Object.defineProperty(TextLabel$HorizontalAnchor, 'MIDDLE', {\n get: TextLabel$HorizontalAnchor$MIDDLE_getInstance\n });\n TextLabel.HorizontalAnchor = TextLabel$HorizontalAnchor;\n Object.defineProperty(TextLabel$VerticalAnchor, 'TOP', {\n get: TextLabel$VerticalAnchor$TOP_getInstance\n });\n Object.defineProperty(TextLabel$VerticalAnchor, 'BOTTOM', {\n get: TextLabel$VerticalAnchor$BOTTOM_getInstance\n });\n Object.defineProperty(TextLabel$VerticalAnchor, 'CENTER', {\n get: TextLabel$VerticalAnchor$CENTER_getInstance\n });\n TextLabel.VerticalAnchor = TextLabel$VerticalAnchor;\n package$svg.TextLabel = TextLabel;\n var package$scale = package$base.scale || (package$base.scale = {});\n package$scale.AbstractScale = AbstractScale;\n package$scale.BreaksGenerator = BreaksGenerator;\n package$scale.ContinuousScale_init_lo18em$ = ContinuousScale_init;\n package$scale.ContinuousScale = ContinuousScale;\n package$scale.DiscreteScale_init_l9mre7$ = DiscreteScale_init;\n package$scale.DiscreteScale = DiscreteScale;\n Object.defineProperty(package$scale, 'MapperUtil', {\n get: MapperUtil_getInstance\n });\n Object.defineProperty(package$scale, 'Mappers', {\n get: Mappers_getInstance\n });\n Object.defineProperty(ScaleBreaks, 'Companion', {\n get: ScaleBreaks$Companion_getInstance\n });\n package$scale.ScaleBreaks = ScaleBreaks;\n Object.defineProperty(package$scale, 'ScaleUtil', {\n get: ScaleUtil_getInstance\n });\n Object.defineProperty(package$scale, 'Scales', {\n get: Scales_getInstance\n });\n var package$breaks = package$scale.breaks || (package$scale.breaks = {});\n package$breaks.BreaksHelperBase = BreaksHelperBase;\n package$breaks.DateTimeBreaksHelper = DateTimeBreaksHelper;\n Object.defineProperty(LinearBreaksHelper, 'Companion', {\n get: LinearBreaksHelper$Companion_getInstance\n });\n package$breaks.LinearBreaksHelper = LinearBreaksHelper;\n package$breaks.NumericBreakFormatter = NumericBreakFormatter;\n package$breaks.QuantizeScale = QuantizeScale;\n Object.defineProperty(package$breaks, 'ScaleBreaksUtil', {\n get: ScaleBreaksUtil_getInstance\n });\n package$breaks.TimeScaleTickFormatterFactory = TimeScaleTickFormatterFactory;\n package$breaks.WithFiniteOrderedOutput = WithFiniteOrderedOutput;\n var package$transform = package$scale.transform || (package$scale.transform = {});\n package$transform.DateTimeBreaksGen = DateTimeBreaksGen;\n package$transform.FunTransform = FunTransform;\n package$transform.IdentityTransform = IdentityTransform;\n Object.defineProperty(LinearBreaksGen, 'Companion', {\n get: LinearBreaksGen$Companion_getInstance\n });\n package$transform.LinearBreaksGen = LinearBreaksGen;\n Object.defineProperty(Log10Transform, 'Companion', {\n get: Log10Transform$Companion_getInstance\n });\n package$transform.Log10Transform = Log10Transform;\n Object.defineProperty(NonlinearBreaksGen, 'Companion', {\n get: NonlinearBreaksGen$Companion_getInstance\n });\n package$transform.NonlinearBreaksGen = NonlinearBreaksGen;\n package$transform.ReverseTransform = ReverseTransform;\n package$transform.SqrtTransform = SqrtTransform;\n Transforms.prototype.BreaksGeneratorForTransformedDomain = Transforms$BreaksGeneratorForTransformedDomain;\n Object.defineProperty(package$transform, 'Transforms', {\n get: Transforms_getInstance\n });\n Object.defineProperty(AbstractDensity2dStat, 'Companion', {\n get: AbstractDensity2dStat$Companion_getInstance\n });\n var package$stat = package$base.stat || (package$base.stat = {});\n package$stat.AbstractDensity2dStat = AbstractDensity2dStat;\n package$stat.BaseStat = BaseStat;\n Object.defineProperty(Bin2dStat, 'Companion', {\n get: Bin2dStat$Companion_getInstance\n });\n Bin2dStat.Bins2dData = Bin2dStat$Bins2dData;\n Bin2dStat.Bins2dWeightedCounts = Bin2dStat$Bins2dWeightedCounts;\n package$stat.Bin2dStat = Bin2dStat;\n Object.defineProperty(BinStat$XPosKind, 'NONE', {\n get: BinStat$XPosKind$NONE_getInstance\n });\n Object.defineProperty(BinStat$XPosKind, 'CENTER', {\n get: BinStat$XPosKind$CENTER_getInstance\n });\n Object.defineProperty(BinStat$XPosKind, 'BOUNDARY', {\n get: BinStat$XPosKind$BOUNDARY_getInstance\n });\n BinStat.XPosKind = BinStat$XPosKind;\n Object.defineProperty(BinStat, 'Companion', {\n get: BinStat$Companion_getInstance\n });\n package$stat.BinStat = BinStat;\n BinStatUtil.prototype.BinOptions = BinStatUtil$BinOptions;\n BinStatUtil.prototype.CountAndWidth = BinStatUtil$CountAndWidth;\n BinStatUtil.prototype.BinsData = BinStatUtil$BinsData;\n Object.defineProperty(package$stat, 'BinStatUtil', {\n get: BinStatUtil_getInstance\n });\n Object.defineProperty(BoxplotStat, 'Companion', {\n get: BoxplotStat$Companion_getInstance\n });\n package$stat.BoxplotStat = BoxplotStat;\n Object.defineProperty(Contour, 'Companion', {\n get: Contour$Companion_getInstance\n });\n package$stat.Contour = Contour;\n Object.defineProperty(ContourFillHelper, 'Companion', {\n get: ContourFillHelper$Companion_getInstance\n });\n package$stat.ContourFillHelper = ContourFillHelper;\n Object.defineProperty(ContourStat, 'Companion', {\n get: ContourStat$Companion_getInstance\n });\n package$stat.ContourStat = ContourStat;\n Object.defineProperty(package$stat, 'ContourStatUtil', {\n get: ContourStatUtil_getInstance\n });\n Object.defineProperty(ContourfStat, 'Companion', {\n get: ContourfStat$Companion_getInstance\n });\n package$stat.ContourfStat = ContourfStat;\n Object.defineProperty(CorrelationStat$Method, 'PEARSON', {\n get: CorrelationStat$Method$PEARSON_getInstance\n });\n Object.defineProperty(CorrelationStat$Method, 'SPEARMAN', {\n get: CorrelationStat$Method$SPEARMAN_getInstance\n });\n Object.defineProperty(CorrelationStat$Method, 'KENDALL', {\n get: CorrelationStat$Method$KENDALL_getInstance\n });\n CorrelationStat.Method = CorrelationStat$Method;\n Object.defineProperty(CorrelationStat$Type, 'FULL', {\n get: CorrelationStat$Type$FULL_getInstance\n });\n Object.defineProperty(CorrelationStat$Type, 'UPPER', {\n get: CorrelationStat$Type$UPPER_getInstance\n });\n Object.defineProperty(CorrelationStat$Type, 'LOWER', {\n get: CorrelationStat$Type$LOWER_getInstance\n });\n CorrelationStat.Type = CorrelationStat$Type;\n Object.defineProperty(CorrelationStat, 'Companion', {\n get: CorrelationStat$Companion_getInstance\n });\n package$stat.CorrelationStat = CorrelationStat;\n Object.defineProperty(package$stat, 'CorrelationUtil', {\n get: CorrelationUtil_getInstance\n });\n Object.defineProperty(CountStat, 'Companion', {\n get: CountStat$Companion_getInstance\n });\n package$stat.CountStat = CountStat;\n package$stat.Density2dStat = Density2dStat;\n package$stat.Density2dfStat = Density2dfStat;\n Object.defineProperty(DensityStat$Kernel, 'GAUSSIAN', {\n get: DensityStat$Kernel$GAUSSIAN_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'RECTANGULAR', {\n get: DensityStat$Kernel$RECTANGULAR_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'TRIANGULAR', {\n get: DensityStat$Kernel$TRIANGULAR_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'BIWEIGHT', {\n get: DensityStat$Kernel$BIWEIGHT_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'EPANECHNIKOV', {\n get: DensityStat$Kernel$EPANECHNIKOV_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'OPTCOSINE', {\n get: DensityStat$Kernel$OPTCOSINE_getInstance\n });\n Object.defineProperty(DensityStat$Kernel, 'COSINE', {\n get: DensityStat$Kernel$COSINE_getInstance\n });\n DensityStat.Kernel = DensityStat$Kernel;\n Object.defineProperty(DensityStat$BandWidthMethod, 'NRD0', {\n get: DensityStat$BandWidthMethod$NRD0_getInstance\n });\n Object.defineProperty(DensityStat$BandWidthMethod, 'NRD', {\n get: DensityStat$BandWidthMethod$NRD_getInstance\n });\n DensityStat.BandWidthMethod = DensityStat$BandWidthMethod;\n Object.defineProperty(DensityStat, 'Companion', {\n get: DensityStat$Companion_getInstance\n });\n package$stat.DensityStat = DensityStat;\n Object.defineProperty(package$stat, 'DensityStatUtil', {\n get: DensityStatUtil_getInstance\n });\n package$stat.FiveNumberSummary_init_d3e2cz$ = FiveNumberSummary_init;\n package$stat.FiveNumberSummary_init_1lq62i$ = FiveNumberSummary_init_0;\n package$stat.FiveNumberSummary = FiveNumberSummary;\n package$stat.MultiOrdering = MultiOrdering;\n package$stat.SimpleStatContext = SimpleStatContext;\n Object.defineProperty(SmoothStat$Method, 'LM', {\n get: SmoothStat$Method$LM_getInstance\n });\n Object.defineProperty(SmoothStat$Method, 'GLM', {\n get: SmoothStat$Method$GLM_getInstance\n });\n Object.defineProperty(SmoothStat$Method, 'GAM', {\n get: SmoothStat$Method$GAM_getInstance\n });\n Object.defineProperty(SmoothStat$Method, 'LOESS', {\n get: SmoothStat$Method$LOESS_getInstance\n });\n Object.defineProperty(SmoothStat$Method, 'RLM', {\n get: SmoothStat$Method$RLM_getInstance\n });\n SmoothStat.Method = SmoothStat$Method;\n Object.defineProperty(SmoothStat, 'Companion', {\n get: SmoothStat$Companion_getInstance\n });\n package$stat.SmoothStat = SmoothStat;\n Object.defineProperty(package$stat, 'Stats', {\n get: Stats_getInstance\n });\n Object.defineProperty(AbstractRealDistribution, 'Companion', {\n get: AbstractRealDistribution$Companion_getInstance\n });\n var package$math3 = package$stat.math3 || (package$stat.math3 = {});\n package$math3.AbstractRealDistribution = AbstractRealDistribution;\n package$math3.AbstractUnivariateSolver_init_14dthe$ = AbstractUnivariateSolver_init;\n package$math3.AbstractUnivariateSolver_init_lu1900$ = AbstractUnivariateSolver_init_0;\n package$math3.AbstractUnivariateSolver_init_yvo9jy$ = AbstractUnivariateSolver_init_1;\n package$math3.AbstractUnivariateSolver = AbstractUnivariateSolver;\n Object.defineProperty(AllowedSolution, 'ANY_SIDE', {\n get: AllowedSolution$ANY_SIDE_getInstance\n });\n Object.defineProperty(AllowedSolution, 'LEFT_SIDE', {\n get: AllowedSolution$LEFT_SIDE_getInstance\n });\n Object.defineProperty(AllowedSolution, 'RIGHT_SIDE', {\n get: AllowedSolution$RIGHT_SIDE_getInstance\n });\n Object.defineProperty(AllowedSolution, 'BELOW_SIDE', {\n get: AllowedSolution$BELOW_SIDE_getInstance\n });\n Object.defineProperty(AllowedSolution, 'ABOVE_SIDE', {\n get: AllowedSolution$ABOVE_SIDE_getInstance\n });\n package$math3.AllowedSolution = AllowedSolution;\n Object.defineProperty(BaseAbstractUnivariateSolver, 'Companion', {\n get: BaseAbstractUnivariateSolver$Companion_getInstance\n });\n package$math3.BaseAbstractUnivariateSolver_init_8vzwiz$ = BaseAbstractUnivariateSolver_init;\n package$math3.BaseAbstractUnivariateSolver = BaseAbstractUnivariateSolver;\n package$math3.BaseUnivariateSolver = BaseUnivariateSolver;\n Object.defineProperty(package$math3, 'Beta', {\n get: Beta_getInstance\n });\n package$math3.BlockRealMatrix_init_vux9f0$ = BlockRealMatrix_init;\n package$math3.BlockRealMatrix_init_n8oub7$ = BlockRealMatrix_init_0;\n package$math3.BlockRealMatrix = BlockRealMatrix;\n package$math3.BracketedUnivariateSolver = BracketedUnivariateSolver;\n Object.defineProperty(BrentSolver, 'Companion', {\n get: BrentSolver$Companion_getInstance\n });\n package$math3.BrentSolver_init_14dthe$ = BrentSolver_init;\n package$math3.BrentSolver_init_lu1900$ = BrentSolver_init_0;\n package$math3.BrentSolver_init_yvo9jy$ = BrentSolver_init_1;\n package$math3.BrentSolver = BrentSolver;\n Object.defineProperty(ContinuedFraction, 'Companion', {\n get: ContinuedFraction$Companion_getInstance\n });\n package$math3.ContinuedFraction = ContinuedFraction;\n package$math3.mean_gf7tl1$ = mean;\n package$math3.correlationPearson_g9g6do$ = correlationPearson;\n Object.defineProperty(ForsythePolynomialGenerator, 'Companion', {\n get: ForsythePolynomialGenerator$Companion_getInstance\n });\n package$math3.ForsythePolynomialGenerator = ForsythePolynomialGenerator;\n Object.defineProperty(package$math3, 'Gamma', {\n get: Gamma_getInstance\n });\n Incrementor.MaxCountExceededCallback = Incrementor$MaxCountExceededCallback;\n package$math3.Incrementor = Incrementor;\n Object.defineProperty(LoessInterpolator, 'Companion', {\n get: LoessInterpolator$Companion_getInstance\n });\n package$math3.LoessInterpolator = LoessInterpolator;\n Object.defineProperty(MathArrays$OrderDirection, 'INCREASING', {\n get: MathArrays$OrderDirection$INCREASING_getInstance\n });\n Object.defineProperty(MathArrays$OrderDirection, 'DECREASING', {\n get: MathArrays$OrderDirection$DECREASING_getInstance\n });\n MathArrays.prototype.OrderDirection = MathArrays$OrderDirection;\n Object.defineProperty(package$math3, 'MathArrays', {\n get: MathArrays_getInstance\n });\n Object.defineProperty(package$math3, 'Percentile', {\n get: Percentile_getInstance\n });\n package$math3.PolynomialFunction = PolynomialFunction;\n package$math3.times_gax024$ = times;\n package$math3.PolynomialSplineFunction = PolynomialSplineFunction;\n Object.defineProperty(package$math3, 'Precision', {\n get: Precision_getInstance\n });\n package$math3.RealDistribution = RealDistribution;\n package$math3.SplineInterpolator = SplineInterpolator;\n Object.defineProperty(TDistribution, 'Companion', {\n get: TDistribution$Companion_getInstance\n });\n package$math3.TDistribution = TDistribution;\n package$math3.UnivariateFunction = UnivariateFunction;\n package$math3.UnivariateSolver = UnivariateSolver;\n Object.defineProperty(package$math3, 'UnivariateSolverUtils', {\n get: UnivariateSolverUtils_getInstance\n });\n var package$regression = package$stat.regression || (package$stat.regression = {});\n package$regression.EvalResult = EvalResult;\n package$regression.LinearRegression = LinearRegression;\n package$regression.LocalPolynomialRegression = LocalPolynomialRegression;\n Object.defineProperty(PolynomialRegression, 'Companion', {\n get: PolynomialRegression$Companion_getInstance\n });\n package$regression.PolynomialRegression = PolynomialRegression;\n package$regression.RegressionEvaluator = RegressionEvaluator;\n Object.defineProperty(package$regression, 'RegressionUtil', {\n get: RegressionUtil_getInstance\n });\n package$regression.allFinite_10sy24$ = allFinite;\n package$regression.averageByX_10sy24$ = averageByX_0;\n var package$util_0 = package$base.util || (package$base.util = {});\n package$util_0.MutableDouble = MutableDouble;\n package$util_0.MutableInteger = MutableInteger;\n Object.defineProperty(package$util_0, 'SamplingUtil', {\n get: SamplingUtil_getInstance\n });\n AestheticsBuilder$MyDataPointAesthetics.prototype.defined_896ixz$ = DataPointAesthetics.prototype.defined_896ixz$;\n DefaultCoordinateSystem.prototype.isPointInLimits_k2qmv6$ = CoordinateSystem.prototype.isPointInLimits_k2qmv6$;\n DefaultCoordinateSystem.prototype.isRectInLimits_fd842m$ = CoordinateSystem.prototype.isRectInLimits_fd842m$;\n DefaultCoordinateSystem.prototype.isPathInLimits_f6t8kh$ = CoordinateSystem.prototype.isPathInLimits_f6t8kh$;\n DefaultCoordinateSystem.prototype.isPolygonInLimits_f6t8kh$ = CoordinateSystem.prototype.isPolygonInLimits_f6t8kh$;\n DataPointAestheticsDelegate.prototype.defined_896ixz$ = DataPointAesthetics.prototype.defined_896ixz$;\n ErrorBarGeom$MyLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$;\n FilledSquareLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$;\n GenericLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$;\n CrossBarLegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$ = LegendKeyElementFactory.prototype.minimumKeySize_l6g9mh$;\n NullGeomTargetCollector.prototype.addPoint_cnsimy$ = GeomTargetCollector.prototype.addPoint_cnsimy$;\n NullGeomTargetCollector.prototype.addRectangle_bxzvr8$ = GeomTargetCollector.prototype.addRectangle_bxzvr8$;\n NullGeomTargetCollector.prototype.addPath_sa5m83$ = GeomTargetCollector.prototype.addPath_sa5m83$;\n NullGeomTargetCollector.prototype.addPolygon_sa5m83$ = GeomTargetCollector.prototype.addPolygon_sa5m83$;\n Object.defineProperty(DodgePos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n Object.defineProperty(FillPos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n Object.defineProperty(JitterDodgePos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n Object.defineProperty(JitterPos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n Object.defineProperty(NudgePos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n Object.defineProperty(StackPos.prototype, 'isIdentity', Object.getOwnPropertyDescriptor(PositionAdjustment.prototype, 'isIdentity'));\n FunTransform.prototype.createApplicableDomain_yrwdxb$ = ContinuousTransform.prototype.createApplicableDomain_yrwdxb$;\n BaseStat.prototype.apply_kdy6bf$ = Stat.prototype.apply_kdy6bf$;\n Kotlin.defineModule('lets-plot-plot-base-portable', _);\n return _;\n}));\n\n//# sourceURL=[module]\n//# sourceMappingUR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c3Q8VD5cbiAgICBpZiAodGhpcyBpcyBDb2xsZWN0aW9uPCo+KSB7XG4gICAgICAgIHZhbCByZXN1bHRTaXplID0gc2l6ZSAtIG5cbiAgICAgICAgaWYgKHJlc3VsdFNpemUgPD0gMClcbiAgICAgICAgICAgIHJldHVybiBlbXB0eUxpc3QoKVxuICAgICAgICBpZiAocmVzdWx0U2l6ZSA9PSAxKVxuICAgICAgICAgICAgcmV0dXJuIGxpc3RPZihsYXN0KCkpXG4gICAgICAgIGxpc3QgPSBBcnJheUxpc3Q8VD4ocmVzdWx0U2l6ZSlcbiAgICAgICAgaWYgKHRoaXMgaXMgTGlzdDxUPikge1xuICAgICAgICAgICAgaWYgKHRoaXMgaXMgUmFuZG9tQWNjZXNzKSB7XG4gICAgICAgICAgICAgICAgZm9yIChpbmRleCBpbiBuIHVudGlsIHNpemUpXG4gICAgICAgICAgICAgICAgICAgIGxpc3QuYWRkKHRoaXNbaW5kZXhdKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBmb3IgKGl0ZW0gaW4gbGlzdEl0ZXJhdG9yKG4pKVxuICAgICAgICAgICAgICAgICAgICBsaXN0LmFkZChpdGVtKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGxpc3RcbiAgICAgICAgfVxuICAgIH1cbiAgICBlbHNlIHtcbiAgICAgICAgbGlzdCA9IEFycmF5TGlzdDxUPigpXG4gICAgfVxuICAgIHZhciBjb3VudCA9IDBcbiAgICBmb3IgKGl0ZW0gaW4gdGhpcykge1xuICAgICAgICBpZiAoY291bnQgPj0gbikgbGlzdC5hZGQoaXRlbSkgZWxzZSArK2NvdW50XG4gICAgfVxuICAgIHJldHVybiBsaXN0Lm9wdGltaXplUmVhZE9ubHlMaXN0KClcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGEgbGlzdCBjb250YWluaW5nIGFsbCBlbGVtZW50cyBleGNlcHQgbGFzdCBbbl0gZWxlbWVudHMuXG4gKiBc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GVtID0gY3VycmVudFN0YXJ0SW5kZXguLmlucHV0Lmxhc3RJbmRleFxuICAgICAgICAgICAgICAgICAgICBuZXh0U2VhcmNoSW5kZXggPSAtMVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBtYXRjaCA9IGlucHV0LmdldE5leHRNYXRjaChuZXh0U2VhcmNoSW5kZXgpXG4gICAgICAgICAgICAgICAgICAgIGlmIChtYXRjaCA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBuZXh0SXRlbSA9IGN1cnJlbnRTdGFydEluZGV4Li5pbnB1dC5sYXN0SW5kZXhcbiAgICAgICAgICAgICAgICAgICAgICAgIG5leHRTZWFyY2hJbmRleCA9IC0xXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgKGluZGV4LCBsZW5ndGgpID0gbWF0Y2hcbiAgICAgICAgICAgICAgICAgICAgICAgIG5leHRJdGVtID0gY3VycmVudFN0YXJ0SW5kZXggdW50aWwgaW5kZXhcbiAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRTdGFydEluZGV4ID0gaW5kZXggKyBsZW5ndGhcbiAgICAgICAgICAgICAgICAgICAgICAgIG5leHRTZWFyY2hJbmRleCA9IGN1cnJlbnRTdGFydEluZGV4ICsgaWYgKGxlbmd0aCA9PSAwKSAxIGVsc2UgMFxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG5leHRTdGF0ZSA9IDFcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBuZXh0KCk6IEludFJhbmdlIHtcbiAgICAgICAgICAgIGlmIChuZXh0U3RhdGUgPT0gLTEpXG4gICAgICAgICAgICAgICAgY2FsY05leHQoKVxuICAgICAgICAgICAgaWYgKG5leHRTdGF0ZSA9PSAwKVxuICAgIC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2YWx1ZXNYLCB2YWx1ZXNZLCBjb25maWRlbmNlTGV2ZWwpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKFBvbHlub21pYWxSZWdyZXNzaW9uLmNhbkJlQ29tcHV0ZWQodmFsdWVzWCwgdmFsdWVzWSwgcG9seW5vbWlhbERlZ3JlZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFBvbHlub21pYWxSZWdyZXNzaW9uKHZhbHVlc1gsIHZhbHVlc1ksIGNvbmZpZGVuY2VMZXZlbCwgcG9seW5vbWlhbERlZ3JlZSlcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQgICAvLyBlbXB0eSBzdGF0IGRhdGFcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIE1ldGhvZC5MT0VTUyAtPiB7XG4gICAgICAgICAgICAgICAgdmFsIGV2YWx1YXRvciA9IExvY2FsUG9seW5vbWlhbFJlZ3Jlc3Npb24odmFsdWVzWCwgdmFsdWVzWSwgY29uZmlkZW5jZUxldmVsLCBzcGFuKVxuICAgICAgICAgICAgICAgIGlmIChldmFsdWF0b3IuY2FuQ29tcHV0ZSkge1xuICAgICAgICAgICAgICAgICAgICBldmFsdWF0b3JcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0ICAgLy8gZW1wdHkgc3RhdCBkYXRhXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSAtPiB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oXG4gICAgICAgICAgICAgICAgXCJVbnN1cHBvcnRlZCBzbW9vdGhlciBtZXRob2Q6ICRzbW9vdGhpbmdNZXRob2QgKG9ubHkgJ2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WSkgPSAtbXUsIHNkKFkpID0gc2lnLCBhbmRcbiAgICAgICAgICogUChZID49IC1tdSArIGsgKiBzaWcpIDw9IDEgLyAoMSArIGteMiksXG4gICAgICAgICAqIFAoLVggPj0gLW11ICsgayAqIHNpZykgPD0gMSAvICgxICsga14yKSxcbiAgICAgICAgICogUChYIDw9IG11IC0gayAqIHNpZykgPD0gMSAvICgxICsga14yKSxcbiAgICAgICAgICogRihtdSAtIGsgKiBzaWcpIDw9IDEgLyAoMSArIGteMikuXG4gICAgICAgICAqXG4gICAgICAgICAqIEZvciBrID0gc3FydCgoMSAtIHApIC8gcCksIHdlIGZpbmRcbiAgICAgICAgICogRihtdSAtIGsgKiBzaWcpIDw9IHAsXG4gICAgICAgICAqIGFuZCAobXUgLSBrICogc2lnKSBpcyBhIGxvd2VyLWJvdW5kIGZvciB0aGUgcm9vdC5cbiAgICAgICAgICpcbiAgICAgICAgICogSW4gY2FzZXMgd2hlcmUgdGhlIENoZWJ5c2hldiBpbmVxdWFsaXR5IGRvZXMgbm90IGFwcGx5LCBnZW9tZXRyaWNcbiAgICAgICAgICogcHJvZ3Jlc3Npb25zIDEsIDIsIDQsIC4uLiBhbmQgLTEsIC0yLCAtNCwgLi4uIGFyZSB1c2VkIHRvIGJyYWNrZXRcbiAgICAgICAgICogdGhlIHJvb3QuXG4gICAgICAgICAqL1xuICAgICAgICBpZiAocCA8IDAuMCB8fCBwID4gMS4wKSB7XG4gICAgICAgICAgICBlcnJvcihcIk91dE9mUmFuZ2UgWzAsIDFdIC0gcCRwXCIpXG4gICAgICAgIH1cblxuICAgICAgICB2YXIgbG93ZXJCb3VuZCA9IHN1cHBvcnRMb3dlckJvdW5kXG4gICAgICAgIGlmIChwID09IDAuMCkge1xuICAgICAgICAgICAgcmV0dXJuIGxvd2VyQm91bmRcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciB1cHBlckJvdW5kID0gc3VwcG9ydFVwcGVyQm91bmRcbiAgICAgICAgaWYgKHAgPT0gMS4wKSB7XG4gICAgICAgICAgICByZXR1cm4gdXBwZXJCb3VuZFxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIG11ID0gbnVtZXJpY2FsTWVhblxuICAgICAgICB2YWwgc2lnID0gc3FydChudW1lcmljYWxWYXJpYW5jZSlcbiAgICAgICAgdmFsIGNoZWJ5c2hldkFwcGxpZXM6IEJvb2xlYW5cbiAgICAgICAgY2hlYnlzaGV2QXBwbGllcyA9ICEobXUuaXNJbmZpbml0ZSgpIHx8IG11LmlzTmFOKCkgfHwgc2lnLmlzSW5maW5pdGUoKSB8fCBzaWcuaXNOYU4oKSlcblxuICAgICAgICBpZiAobG93ZXJCb3VuZCA9PSBEb3VibGUuTkVHQVRJVkVfSU5GSU5JVFkpIHtcbiAgICAgICAgICAgIGlmIChjaGVieXNoZXZBcHBsaWVzKSB7XG4gICAgICAgICAgICAgICAgbG93ZXJCb3VuZCA9IG11IC0gc2lnICogc3FydCgoMS4wIC0gcCkgLyBwKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBsb3dlckJvdW5kID0gLTEuMFxuICAgICAgICAgICAgICAgIHdoaWxlIChjdW11bGF0aXZlUHJvYmFiaWxpdHkobG93ZXJCb3VuZCkgPj0gcCkge1xuICAgICAgICAgICAgICAgICAgICBsb3dlckJvdW5kICo9IDIuMFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh1cHBlckJvdW5kID09IERvdWJsZS5QT1NJVElWRV9JTkZJTklUWSkge1xuICAgICAgICAgICAgaWYgKGNoZWJ5c2hldkFwcGxpZXMpIHtcbiAgICAgICAgICAgICAgICB1cHBlckJvdW5kID0gbXUgKyBzaWcgKiBzcXJ0KHAgLyAoMS4wIC0gcCkpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHVwcGVyQm91bmQgPSAxLjBcbiAgICAgICAgICAgICAgICB3aGlsZSAoY3VtdWxhdGl2ZVByb2JhYmlsaXR5KHVwcGVyQm91bmQpIDwgcCkge1xuICAgICAgICAgICAgICAgICAgICB1cHBlckJvdW5kICo9IDIuMFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCB0b1NvbHZlID0gb2JqZWN0IDogVW5pdmFyaWF0ZUZ1bmN0aW9uIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biB2YWx1ZSh4OiBEb3VibGUpOiBEb3VibGUge1xuICAgICAgICAgICAgICAgIHJldHVybiBjdW11bGF0aXZlUHJvYmFiaWxpdHkoeCkgLSBwXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgeCA9IFVuaXZhcmlhdGVTb2x2ZXJVdGlscy5zb2x2ZShcbiAgICAgICAgICAgIHRvU29sdmUsXG4gICAgICAgICAgICBsb3dlckJvdW5kLFxuICAgICAgICAgICAgdXBwZXJCb3VuZCxcbiAgICAgICAgICAgIHNvbHZlckFic29sdXRlQWNjdXJhY3lcbiAgICAgICAgKVxuXG4gICAgICAgIGlmICghaXNTdXBwb3J0Q29ubmVjdGVkKSB7XG4gICAgICAgICAgICAvKiBUZXN0IGZvciBwbGF0ZWF1LiAqL1xuICAgICAgICAgICAgdmFsIGR4ID0gc29sdmVyQWJzb2x1dGVBY2N1cmFjeVxuICAgICAgICAgICAgaWYgKHggLSBkeCA+PSBzdXBwb3J0TG93ZXJCb3VuZCkge1xuICAgICAgICAgICAgICAgIHZhbCBweCA9IGN1bXVsYXRpdmVQcm9iYWJpbGl0eSh4KVxuICAgICAgICAgICAgICAgIGlmIChjdW11bGF0aXZlUHJvYmFiaWxpdHkoeCAtIGR4KSA9PSBweCkge1xuICAgICAgICAgICAgICAgICAgICB1cHBlckJvdW5kID0geFxuICAgICAgICAgICAgICAgICAgICB3aGlsZSAodXBwZXJCb3VuZCAtIGxvd2VyQm91bmQgPiBkeCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIG1pZFBvaW50ID0gMC41ICogKGxvd2VyQm91bmQgKyB1cHBlckJvdW5kKVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGN1bXVsYXRpdmVQcm9iYWJpbGl0eShtaWRQb2ludCkgPCBweCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvd2VyQm91bmQgPSBtaWRQb2ludFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cHBlckJvdW5kID0gbWlkUG9pbnRcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXBwZXJCb3VuZFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4geFxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICAvKiogRGVmYXVsdCBhY2N1cmFjeS4gICovXG4gICAgICAgIHZhbCBTT0xWRVJfREVGQVVMVF9BQlNPTFVURV9BQ0NVUkFDWSA9IDFlLTZcblxuICAgICAgICAvKiogU2VyaWFsaXphYmxlIHZlcnNpb24gaWRlbnRpZmllciAgKi9cbiAgICAgICAgcHJpdmF0ZSBjb25zdCB2YWwgc2VyaWFsVmVyc2lvblVJRCA9IC0zODAzODA1MDk4MzEwODgwMkxcbiAgICB9XG59XG5cbiIsIi8qXG4gKiBDb3B5cmlnaHQgMjAxMC0yMDIxIEpldEJyYWlucyBzLnIuby4gYW5kIEtvdGxpbiBQcm9ncmFtbWluZyBMYW5ndWFnZSBjb250cmlidXRvcnMuXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgQXBhY2hlIDIuMCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBsaWNlbnNlL0x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pYyBmdW4gPEBrb3RsaW4uaW50ZXJuYWwuT25seUlucHV0VHlwZXMgVD4gQXJyYXk8b3V0IFQ+LmluZGV4T2YoZWxlbWVudDogVCk6IEludCB7XG4gICAgaWYgKGVsZW1lbnQgPT0gbnVsbCkge1xuICAgICAgICBmb3IgKGluZGV4IGluIGluZGljZXMpIHtcbiAgICAgICAgICAgIGlmICh0aGlzW2luZGV4XSA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgICBmb3IgKGluZGV4IGluIGluZGljZXMpIHtcbiAgICAgICAgICAgIGlmIChlbGVtZW50ID09IHRoaXNbaW5kZXhdKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIC0xXG59XG5cbi8qKlxuICogUmV0dXJucyBmaXJzdCBpbmRleCBvZiBbZWxlbWVudF0sIG9yIC0xIGlmIHRoZSBhcnJheSBkb2VzIG5vdCBjb250YWluIGVsZW1lbnQuXG4gKi9cbnB1YmxpYyBmdW4gQnl0ZUFycmF5LmluZGV4T2YoZWxlbWVudDogQnl0ZSk6IEludCB7XG4gICAgZm9yIChpbmRleCBpbiBpbmRpY2VzKSB7XG4gICAgICAgIGlmIChlbGVtZW50ID09IHRoaXNbaW5kZXhdKSB7XG4gICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gLTFcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGZpcnN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBTaG9ydEFycmF5LmluZGV4T2YoZWxlbWVudDogU2hvcnQpOiBJbnQge1xuICAgIGZvciAoa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ZiAoZWxlbWVudCA9PSBudWxsKSB7XG4gICAgICAgIGZvciAoaW5kZXggaW4gaW5kaWNlcy5yZXZlcnNlZCgpKSB7XG4gICAgICAgICAgICBpZiAodGhpc1tpbmRleF0gPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgICAgZm9yIChpbmRleCBpbiBpbmRpY2VzLnJldmVyc2VkKCkpIHtcbiAgICAgICAgICAgIGlmIChlbGVtZW50ID09IHRoaXNbaW5kZXhdKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIC0xXG59XG5cbi8qKlxuICogUmV0dXJucyBsYXN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBCeXRlQXJyYXkubGFzdEluZGV4T2YoZWxlbWVudDogQnl0ZSk6IEludCB7XG4gICAgZm9yIChpbmRleCBpbiBpbmRpY2VzLnJldmVyc2VkKCkpIHtcbiAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgbGFzdCBpbmRleCBvZiBbZWxlbWVudF0sIG9yIC0xIGlmIHRoZSBhcnJheSBkb2VzIG5vdCBjb250YWluIGVsZW1lbnQuXG4gKi9cbnB1YmxpYyBmdW4gU2hvcnRBcnJheS5sYXN0SW5kZXhPZihlbGVtZW50OiBTaG9ydCk6IEludCB7XG4gICAgZm9yIChpbmRleCBpbiBpbmRpY2VzLnJldmVyc2VkKCkpIHtcbiAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgbGFzdCBpbmRleCBvZiBbZWxlbWVudF0sIG9yIC0xIGlmIHRoZSBhcnJheSBkb2VzIG5vdCBjb250YWluIGVsZW1lbnQuXG4gKi9cbnB1YmxpYyBmdW4gSW50QXJyYXkubGFzdEluZGV4T2YoZWxlbWVudDogSW50KTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMucmV2ZXJzZWQoKSkge1xuICAgICAgICBpZiAoZWxlbWVudCA9PSB0aGlzW2luZGV4XSkge1xuICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIC0xXG59XG5cbi8qKlxuICogUmV0dXJucyBsYXN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBMb25nQXJyYXkubGFzdEluZGV4T2YoZWxlbWVudDogTG9uZyk6IEludCB7XG4gICAgZm9yIChpbmRleCBpbiBpbmRpY2VzLnJldmVyc2VkKCkpIHtcbiAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgbGFzdCBpbmRleCBvZiBbZWxlbWVudF0sIG9yIC0xIGlmIHRoZSBhcnJheSBkb2VzIG5vdCBjb250YWluIGVsZW1lbnQuXG4gKi9cbkBEZXByZWNhdGVkKFwiVGhlIGZ1bmN0aW9uIGhhcyB1bmNsZWFyIGJlaGF2aW9yIHdoZW4gc2VhcmNoaW5nIGZvciBOYU4gb3IgemVybyB2YWx1ZXMgYW5k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VxuICAgIGlmIChuID09IDApIHJldHVybiBlbXB0eUxpc3QoKVxuICAgIGlmIChuID49IHNpemUpIHJldHVybiB0b0xpc3QoKVxuICAgIGlmIChuID09IDEpIHJldHVybiBsaXN0T2YodGhpc1swXSlcbiAgICB2YXIgY291bnQgPSAwXG4gICAgdmFsIGxpc3QgPSBBcnJheUxpc3Q8TG9uZz4obilcbiAgICBmb3IgKGl0ZW0gaW4gdGhpcykge1xuICAgICAgICBsaXN0LmFkZChpdGVtKVxuICAgICAgICBpZiAoKytjb3VudCA9PSBuKVxuICAgICAgICAgICAgYnJlYWtcbiAgICB9XG4gICAgcmV0dXJuIGxpc3Rcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGEgbGlzdCBjb250YWluaW5nIGZpcnN0IFtuXSBlbGVtZW50cy5cbiAqIFxuICogQHRocm93cyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gaWYgW25dIGlzIG5lZ2F0aXZlLlxuICogXG4gKiBAc2FtcGxlIHNhbXBsZXMuY29sbGVjdGlvbnMuQ29sbGVjdGlvbnMuVHJhbnNmb3JtYXRpb25zLnRha2VcbiAqL1xucHVibGljIGZ1biBGbG9hdEFycmF5LnRha2UobjogSW50KTogTGlzdDxGbG9hdD4ge1xuICAgIHJlcXVpcmUobiA+PSAwKSB7IFwiUmVxdWVzdGVkIGVsZW1lbnQgY291bnQgJG4gaXMgbGVzcyB0aGFuIHplcm8uXCIgfVxuICAgIGlmIChuID09IDApIHJldHVybiBlbXB0eUxpc3QoKVxuICAgIGlmIChuID49IHNpemUpIHJldHVybiB0b0xpc3QoKVxuICAgIGlmIChuID09IDEpIHJldHVybiBsaXN0T2YodGhpc1swXSlcbiAgICB2YXIgY291bnQgPSAwXG4gICAgdmFsIGxpc3QgPSBBcnJheUxpc3Q8RmxvYXQ+KG4pXG4gICAgZm9yIChpdGVtIGluIHRoaXMpIHtcbiAgICAgICAgbGlzdC5hZGQoaXRlbSlcbiAgICAgICAgaWYgKCsrY291bnQg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kZJTklUWWApLFxuICAgICAqICAqIGVsc2UgdW5kZWZpbmVkIChgRG91YmxlLk5hTmApLlxuICAgICAqXG4gICAgICovXG4gICAgb3ZlcnJpZGUgdmFsIG51bWVyaWNhbFZhcmlhbmNlOiBEb3VibGVcbiAgICAgICAgZ2V0KCkge1xuICAgICAgICAgICAgdmFsIGRmID0gZGVncmVlc09mRnJlZWRvbVxuXG4gICAgICAgICAgICBpZiAoZGYgPiAyKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGRmIC8gKGRmIC0gMilcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIGlmIChkZiA+IDEgJiYgZGYgPD0gMikge1xuICAgICAgICAgICAgICAgIERvdWJsZS5QT1NJVElWRV9JTkZJTklUWVxuICAgICAgICAgICAgfSBlbHNlIERvdWJsZS5OYU5cblxuICAgICAgICB9XG5cbiAgICAvKipcbiAgICAgKiB7QGluaGVyaXREb2N9XG4gICAgICpcbiAgICAgKiBUaGUgbG93ZXIgYm91bmQgb2YgdGhlIHN1cHBvcnQgaXMgYWx3YXlzIG5lZ2F0aXZlIGluZmluaXR5IG5vIG1hdHRlciB0aGVcbiAgICAgKiBwYXJhbWV0ZXJzLlxuICAgICAqXG4gICAgICogQHJldHVybiBsb3dlciBib3VuZCBvZiB0aGUgc3VwcG9ydCAoYWx3YXlzXG4gICAgICogYERvdWJsZS5ORUdBVElWRV9JTkZJTklUWWApXG4gICAgICovXG4gICAgb3ZlcnJpZGUgdmFsIHN1cHBvcnRMb3dlckJvdW5kOiBEb3VibGVcbiAgICAgICAgZ2V0KCkgPSBEb3VibGUuTkVHQVRJVkVfSU5GSU5JVFlcblxuICAgIC8qKlxuICAgICAqIHtAaW5oZXJpdERvY31cbiAgICAgKlxuICAgICAqIFRoZSB1cHBlciBib3VuZCBvZiB0aGUgc3VwcG9ydCBpcyBhbHdheXMgcG9zaXRpdmUgaW5maW5pdHkgbm8gbWF0dGVyIHRoZVxuICAgICAqIHBhcmFt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Rpc3RyaWJ1dGlvbiBgUChYID0geClgIGFsd2F5cyBldmFsdWF0ZXMgdG8gMC5cbiAgICAgKlxuICAgICAqIEByZXR1cm4gMFxuICAgICAqL1xuICAgIG92ZXJyaWRlIGZ1biBwcm9iYWJpbGl0eSh4OiBEb3VibGUpOiBEb3VibGUge1xuICAgICAgICByZXR1cm4gMC4wXG4gICAgfVxuXG4gICAgLyoqIHtAaW5oZXJpdERvY30gICovXG4gICAgb3ZlcnJpZGUgZnVuIGRlbnNpdHkoeDogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgdmFsIG4gPSBkZWdyZWVzT2ZGcmVlZG9tXG4gICAgICAgIHZhbCBuUGx1czFPdmVyMiA9IChuICsgMSkgLyAyXG4gICAgICAgIHJldHVybiBleHAoXG4gICAgICAgICAgICBHYW1tYS5sb2dHYW1tYShuUGx1czFPdmVyMikgLVxuICAgICAgICAgICAgICAgICAgICAwLjUgKiAobG4oUEkpICsgbG4obikpIC1cbiAgICAgICAgICAgICAgICAgICAgR2FtbWEubG9nR2FtbWEobiAvIDIpIC1cbiAgICAgICAgICAgICAgICAgICAgblBsdXMxT3ZlcjIgKiBsbigxICsgeCAqIHggLyBuKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgLyoqIHtAaW5oZXJpdERvY30gICovXG4gICAgb3ZlcnJpZGUgZnVuIGN1bXVsYXRpdmVQcm9iYWJpbGl0eSh4OiBEb3VibGUpOiBEb3VibGUge1xuICAgICAgICB2YWwgcmV0OiBEb3VibGVcbiAgICAgICAgaWYgKHggPT0gMC4wKSB7XG4gICAgICAgICAgICByZXQgPSAwLjVcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHZhbCB0ID0gQmV0YS5yZWd1bGFyaXplZEJldGEoXG4gICAgICAgICAgICAgICAgZGVncmVlc09mRnJlZWRvbSAvIChkZWdyZWVzT2ZGcmVlZG9tICsgeCAqIHgpLFxuICAgICAgICAgICAgICAgIDAuNSAqIGRlZ3JlZXNPZkZ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JhdyB0aGUgc2FtZSBsaW5lIGFzOlxuICAgICAgICAgICAgICAgICAgICAvLyBgZ2VvbV9hYmxpbmUoc2xvcGU9bnVtYmVyLCBpbnRlcnNlcHQ9MClgXG4gICAgICAgICAgICAgICAgICAgIC8vIFNlZTogUGxvdFV0aWwuY3JlYXRlTGF5ZXJBZXN0aGV0aWNzKClcbiAgICAgICAgICAgICAgICAgICAgYWVzID09IFNMT1BFXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaXNQb3NpdGlvbmFsWFkoYWVzOiBBZXM8Kj4pOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBpc1Bvc2l0aW9uYWxYKGFlcykgfHxcbiAgICAgICAgICAgICAgICAgICAgaXNQb3NpdGlvbmFsWShhZXMpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaXNQb3NpdGlvbmFsWChhZXM6IEFlczwqPik6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIGFlcyA9PSBYIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBYSU5URVJDRVBUIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBYTUlOIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBYTUFYIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBYRU5EXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaXNQb3NpdGlvbmFsWShhZXM6IEFlczwqPik6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIGFlcyA9PSBZIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBZTUlOIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBZTUFYIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBJTlRFUkNFUFQgfHxcbiAgICAgICAgICAgICAgICAgICAgYWVzID09IFlJTlRFUkNFUFQgfHxcbiAgICAgICAgICAgICAgICAgICAgYWVzID09IExPV0VSIHx8XG4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FibGU8QWVzPERvdWJsZT4+IHtcbiAgICAgICAgICAgIHZhbCBudW1lcmljID0gbnVtZXJpYyh1bmZpbHRlcmVkKVxuICAgICAgICAgICAgcmV0dXJuIGZpbHRlcihudW1lcmljKSB7IGlzQWZmZWN0aW5nU2NhbGVYKGl0KSB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYWZmZWN0aW5nU2NhbGVZKHVuZmlsdGVyZWQ6IEl0ZXJhYmxlPEFlczwqPj4pOiBJdGVyYWJsZTxBZXM8RG91YmxlPj4ge1xuICAgICAgICAgICAgdmFsIG51bWVyaWMgPSBudW1lcmljKHVuZmlsdGVyZWQpXG4gICAgICAgICAgICByZXR1cm4gZmlsdGVyKG51bWVyaWMpIHsgaXNBZmZlY3RpbmdTY2FsZVkoaXQpIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBub0d1aWRlTmVlZGVkKGFlczogQWVzPCo+KTogQm9vbGVhbiB7XG4gICAgICAgICAgICByZXR1cm4gYWVzID09IEZSQU1FIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBTUEVFRCB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gRkxPVyB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gTEFCRUwgfHxcbiAgICAgICAgICAgICAgICAgICAgYWVzID09IFNMT1BFIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBXSURUSCB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gSEVJR0hUIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBISlVTVCB8fFxuICAgICAgICAgICAgICAgICAgICBhZXMgPT0gVkpVU1QgfHxcbiAgICAgICAgICAgICAgICAgICAgYWVzID09IEFOR0xFIHx8XG4gICAgICAgICAgICAgICAgICAgIGFlcyA9PSBGQU1JTFkgfHxcbiAgICAgICAgICAgICAgICAgICAgYWVzID09IEZPTlRGQUNFIHx8XG4gICAgICAgICAgICAgICAgICAgIGF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GVyU3BlY3NcbiAgICAgICAgbXlPcmRlclNwZWNzLmZvckVhY2ggeyBvcmRlclNwZWMgLT5cbiAgICAgICAgICAgIG15RGlzdGluY3RWYWx1ZXNbb3JkZXJTcGVjLnZhcmlhYmxlXSA9IGdldE9yZGVyZWREaXN0aW5jdFZhbHVlcyhvcmRlclNwZWMpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBhc3NlcnRBbGxTZXJpZXNBcmVTYW1lU2l6ZSh2ZWN0b3JCeVZhcjogTWFwPFZhcmlhYmxlLCBMaXN0PCo+Pikge1xuICAgICAgICBpZiAodmVjdG9yQnlWYXIuc2l6ZSA+IDEpIHtcbiAgICAgICAgICAgIHZhbCBlbnRyaWVzID0gdmVjdG9yQnlWYXIuZW50cmllcy5pdGVyYXRvcigpXG4gICAgICAgICAgICB2YWwgZmlyc3QgPSBlbnRyaWVzLm5leHQoKVxuICAgICAgICAgICAgdmFsIHNpemUgPSBmaXJzdC52YWx1ZS5zaXplXG4gICAgICAgICAgICB3aGlsZSAoZW50cmllcy5oYXNOZXh0KCkpIHtcbiAgICAgICAgICAgICAgICB2YWwgbmV4dCA9IGVudHJpZXMubmV4dCgpXG4gICAgICAgICAgICAgICAgaWYgKG5leHQudmFsdWUuc2l6ZSAhPSBzaXplKSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiQWxsIGRhdGEgc2VyaWVzIGluIGRhdGEgZnJhbWUgbXVzdCBoYXZlIGVxdWFsIHNpemVcXG5cIiArIGR1bXBTaXplcyhcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZWN0b3JCeVZhclxuICAgICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF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gICAgICAgb3ZlcnJpZGUgZnVuIHRvU3RyaW5nKCk6IFN0cmluZyB7XG4gICAgICAgICAgICAvLyBpbXBvcnRhbnRcbiAgICAgICAgICAgIHJldHVybiBuYW1lXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdG9TdW1tYXJ5U3RyaW5nKCk6IFN0cmluZyB7XG4gICAgICAgICAgICByZXR1cm4gXCIkbmFtZSwgJyRsYWJlbCcgWyRzb3VyY2VdXCJcbiAgICAgICAgfVxuXG4gICAgICAgIGVudW0gY2xhc3MgU291cmNlIHtcbiAgICAgICAgICAgIE9SSUdJTiwgVFJBTlNGT1JNLCBTVEFUXG4gICAgICAgIH1cblxuICAgICAgICBjb21wYW5pb24gb2JqZWN0IHtcblxuICAgICAgICAgICAgQEp2bU92ZXJsb2Fkc1xuICAgICAgICAgICAgZnVuIGNyZWF0ZU9yaWdpbmFsKG5hbWU6IFN0cmluZywgbGFiZWw6IFN0cmluZyA9IG5hbWUpOiBWYXJpYWJsZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFZhcmlhYmxlKFxuICAgICAgICAgICAgICAgICAgICBuYW1lLFxuICAgICAgICAgICAgICAgICAgICBTb3VyY2UuT1JJR0lOLFxuICAgICAgICAgICAgICAgICAgICBsYWJlbFxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGdldE9yZGVyZWREaXN0aW5jdFZhbHVlcyhvcmRlclNwZWM6IE9yZGVyU3BlYyk6IFNldDxBbnk+IHtcbiAgICAgICAgZnVuIGlzVmFsdWVDb21wYXJhYmxlKHZhbHVlOiBBbnk/KSA9IHZhbHVlICE9IG51bGwgJiYgKHZhbHVlICFpcyBEb3VibGUgfHwgdmFsdWUuaXNGaW5pdGUoKSlcblxuICAgICAgICB2YWwgb3JkZXJlZFZhbHVlcyA9IGlmIChvcmRlclNwZWMuYWdncmVnYXRlT3BlcmF0aW9uICE9IG51bG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AgICAgICAgICAgIG15SXNOdW1lcmljLnB1dEFsbChkYXRhLm15SXNOdW1lcmljKVxuICAgICAgICAgICAgbXlPcmRlclNwZWNzLmFkZEFsbChkYXRhLm15T3JkZXJTcGVjcylcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBwdXQodmFyaWFibGU6IFZhcmlhYmxlLCB2OiBMaXN0PCo+KTogQnVpbGRlciB7XG4gICAgICAgICAgICBwdXRJbnRlcm4odmFyaWFibGUsIHYpXG4gICAgICAgICAgICBteUlzTnVtZXJpYy5yZW1vdmUodmFyaWFibGUpICAvLyB1bmtub3duIHN0YXRlXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHB1dE51bWVyaWModmFyaWFibGU6IFZhcmlhYmxlLCB2OiBMaXN0PERvdWJsZT8+KTogQnVpbGRlciB7XG4gICAgICAgICAgICBwdXRJbnRlcm4odmFyaWFibGUsIHYpXG4gICAgICAgICAgICBteUlzTnVtZXJpY1t2YXJpYWJsZV0gPSB0cnVlXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHB1dERpc2NyZXRlKHZhcmlhYmxlOiBWYXJpYWJsZSwgdjogTGlzdDwqPik6IEJ1aWxkZXIge1xuICAgICAgICAgICAgcHV0SW50ZXJuKHZhcmlhYmxlLCB2KVxuICAgICAgICAgICAgbXlJc051bWVyaWNbdmFyaWFibGVdID0gZmFsc2VcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBpbnRlcm5hbCBmdW4gcHV0SW50ZXJuKHZhcmlhYmxlOiBWYXJpYWJsZSwgdjogTGlzdDwqPikge1xuICAgICAgICAgICAgbXlWZWN0b3JCeVZhclt2YXJpYWJsZV0gPSBBcnJheUxpc3QodilcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biByZW1vdmUodmFyaWFibGU6IFZhcmlhYmxlKTogQnVpbGRlciB7XG4gICAgICAgICAgICBteVZlY3RvckJ5VmFyLnJlbW92ZSh2YXJpYWJsZSlcbiAgICAgICAgICAgIG15SXNOdW1lcmljLnJlbW92ZSh2YXJpYWJsZSlcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYWRkT3JkZXJTcGVjcyhvcmRlclNwZWNzOiBMaXN0PE9yZGVyU3BlYz4pOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIG9yZGVyU3BlY3MuZm9yRWFjaCg6OmFkZE9yZGVyU3BlYylcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYWRkT3JkZXJTcGVjKG9yZGVyU3BlYzogT3JkZXJTcGVjKTogQnVpbGRlciB7XG4gICAgICAgICAgICB2YWwgY3VycmVudE9yZGVyU3BlYyA9IG15T3JkZXJTcGVjcy5maW5kIHsgaXQudmFyaWFibGUgPT0gb3JkZXJTcGVjLnZhcmlhYmxlIH1cbiAgICAgICAgICAgIC8vIElmIG11bHRpcGxlIHNwZWNpZmljYXRpb25zIGZvciB0aGUgdmFyaWFibGUgLSBjaG9vc2UgYSBtb3JlIHNwZWNpZmljIG9uZTpcbiAgICAgICAgICAgIGlmIChjdXJyZW50T3JkZXJTcGVjPy5hZ2dyZWdhdGVPcGVyYXRpb24gPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIG15T3JkZXJTcGVjcy5yZW1vdmUoY3VycmVudE9yZGVyU3BlYylcbiAgICAgICAgICAgICAgICBteU9yZGVyU3BlY3MuYWRkKG9yZGVyU3BlYylcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYnVpbGQoKTogRGF0YUZyYW1lIHtcbiAgICAgICAgICAgIHJldHVybiBEYXRhRnJhbWUodGhpcylcbiAgICAgICAgfVxuXG4gICAgICAgIGNvbXBhbmlvbiBvYmplY3Qge1x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YXNEb21haW5MaW1pdHMoKTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiBkb21haW5MaW1pdHMuaXNOb3RFbXB0eSgpXG4gICAgfVxuXG4gICAgZnVuIGlzSW5Eb21haW4odjogQW55Pyk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gbnVtYmVyQnlEb21haW5WYWx1ZS5jb250YWluc0tleSh2KVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBhcHBseShsOiBMaXN0PCo+KTogTGlzdDxEb3VibGU/PiB7XG4gICAgICAgIHJldHVybiBsLm1hcCB7IGFzTnVtYmVyKGl0KSB9XG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGFwcGx5SW52ZXJzZSh2OiBEb3VibGU/KTogQW55PyB7XG4gICAgICAgIHJldHVybiBmcm9tTnVtYmVyKHYpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gYXNOdW1iZXIoaW5wdXQ6IEFueT8pOiBEb3VibGU/IHtcbiAgICAgICAgaWYgKGlucHV0ID09IG51bGwpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsXG4gICAgICAgIH1cbiAgICAgICAgaWYgKG51bWJlckJ5RG9tYWluVmFsdWUuY29udGFpbnNLZXkoaW5wdXQpKSB7XG4gICAgICAgICAgICByZXR1cm4gbnVtYmVyQnlEb21haW5WYWx1ZVtpbnB1dF1cbiAgICAgICAgfVxuXG4gICAgICAgIHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbihcbiAgICAgICAgICAgIFwidmFsdWUgJGlucHV0IGlzIG5vdCBpbiB0aGUgZG9tYWluOiAke251bWJlckJ5RG9tYWluVmFsdWUua2V5c31cIlxuICAgICAgICApXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gZnJvbU51bWJlcih2OiBEb3VibGU/KTogQW55PyB7XG4gICAgICAgIGlmICh2ID09IG51bGwpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsXG4gICAgICAgIH1cblxuICAgICAgICBpZiAoZG9tYWluVmFsdWVCeU51bWJlci5jb250YWluc0tleSh2KSkge1xuICAgICAgICAgICAgcmV0dXJuIGRvbWFpblZhbHVlQnlOdW1iZXJbdl1cbiAgICAgICAgfVxuXG4gICAgICAgIC8vIGxvb2stdXAgdGhlIGNsb3Nlc3Qga2V5IChudW1iZXIpXG4gICAgICAgIHZhbCBjZWlsaW5nS2V5ID0gZG9tYWluVmFsdWVCeU51bWJlci5jZWlsaW5nS2V5KHYpXG4gICAgICAgIHZhbCBmbG9vcktleSA9IGRvbWFpblZhbHVlQnlOdW1iZXIuZmxvb3JLZXkodilcbiAgICAgICAgdmFyIGtleU51bWJlcjogRG91YmxlPyA9IG51bGxcbiAgICAgICAgaWYgKGNlaWxpbmdLZXkgIT0gbnVsbCB8fCBmbG9vcktleSAhPSBudWxsKSB7XG4gICAgICAgICAgICBrZXlOdW1iZXIgPSB3aGVuIHtcbiAgICAgICAgICAgICAgICBjZWlsaW5nS2V5ID09IG51bGwgLT4gZmxvb3JLZXlcbiAgICAgICAgICAgICAgICBmbG9vcktleSA9PSBudWxsIC0+IGNlaWxpbmdLZXlcbiAgICAgICAgICAgICAgICBlbHNlIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIGNlaWxpbmdEaXN0ID0gYWJzKGNlaWxpbmdLZXkgLSB2KVxuICAgICAgICAgICAgICAgICAgICB2YWwgZmxvb3JEaXN0ID0gYWJzKGZsb29yS2V5IC0gdilcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNlaWxpbmdEaXN0IDwgZmxvb3JEaXN0KSBjZWlsaW5nS2V5IGVsc2UgZmxvb3JLZXlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGlmIChrZXlOdW1iZXIgIT0gbnVsbCkgZG9tYWluVmFsdWVCeU51bWJlcltrZXlOdW1iZXJdIGVsc2UgbnVsbFxuICAgIH1cbn0iLCIvKlxuICogQ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y5BTFBIQSxcbiAgICAgICAgQWVzLlNQRUVELFxuICAgICAgICBBZXMuRkxPV1xuICAgIClcblxuICAgIHByaXZhdGUgdmFsIFBPTFlHT04gPSBsaXN0T2YoXG4gICAgICAgIEFlcy5YLCBBZXMuWSxcbiAgICAgICAgQWVzLlNJWkUsIC8vIHBhdGggd2lkdGhcbiAgICAgICAgQWVzLkxJTkVUWVBFLFxuICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgIEFlcy5GSUxMLFxuICAgICAgICBBZXMuQUxQSEFcbiAgICApXG5cbiAgICBwcml2YXRlIHZhbCBBUkVBID0gbGlzdE9mKFxuICAgICAgICBBZXMuWCwgQWVzLlksXG4gICAgICAgIEFlcy5TSVpFLFxuICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgQWVzLkZJTEwsXG4gICAgICAgIEFlcy5BTFBIQVxuICAgIClcblxuXG4gICAgcHJpdmF0ZSBmdW4gcmVuZGVyZWRBZXNMaXN0KGdlb21LaW5kOiBHZW9tS2luZCk6IExpc3Q8QWVzPCo+PiB7XG4gICAgICAgIHJldHVybiB3aGVuIChnZW9tS2luZCkge1xuICAgICAgICAgICAgR2VvbUtpbmQuUE9JTlQgLT4gUE9JTlRcbiAgICAgICAgICAgIEdlb21LaW5kLlBBVEggLT4gUEFUSFxuICAgICAgICAgICAgR2VvbUtpbmQuTElORSAtPiBQQVRIXG5cbiAgICAgICAgICAgIEdlb21LaW5kLlNNT09USCAtPiBsaXN0T2YoXG4gICAgICAgICAgICAgICAgQWVzLlgsIEFlcy5ZLFxuICAgICAgICAgICAgICAgIEFlcy5ZTUlOLCBBZXMuWU1BWCxcblxuICAgICAgICAgICAgICAgIEFlcy5TSVpFLCAvLyBwYXRoIHdpZHRoXG4gICAgICAgICAgICAgICAgQWVzLkxJTkVUWVBFLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuRklMTCxcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEFcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuQkFSIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWCxcbiAgICAgICAgICAgICAgICBBZXMuWSxcbiAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgICAgICAgICAgQWVzLkZJTEwsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIEFlcy5XSURUSCxcbiAgICAgICAgICAgICAgICBBZXMuU0laRVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5ISVNUT0dSQU0gLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIEFlcy5YLCBBZXMuWSxcbiAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgICAgICAgICAgQWVzLkZJTEwsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIC8vQWVzLldFSUdIVCwgICAgLy8gVG9EbzogdGhpcyBpcyBhY3R1YWxseSBoYW5kbGVkIGJ5ICdzdGF0JyAoYmluLGNvdW50KVxuICAgICAgICAgICAgICAgIEFlcy5XSURUSCxcbiAgICAgICAgICAgICAgICBBZXMuU0laRVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5USUxFLFxuICAgICAgICAgICAgR2VvbUtpbmQuQklOXzJEIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWCwgQWVzLlksXG4gICAgICAgICAgICAgICAgQWVzLldJRFRILFxuICAgICAgICAgICAgICAgIEFlcy5IRUlHSFQsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuRklMTCxcbiAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgICAgICAgICAgQWVzLlNJWkVcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuRVJST1JfQkFSIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWCxcbiAgICAgICAgICAgICAgICBBZXMuWU1JTiwgQWVzLllNQVgsXG4gICAgICAgICAgICAgICAgQWVzLldJRFRILFxuICAgICAgICAgICAgICAgIEFlcy5BTFBIQSxcbiAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgICAgICAgICAgQWVzLkxJTkVUWVBFLFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIEdlb21LaW5kLkNST1NTX0JBUiAtPiBsaXN0T2YoXG4gICAgICAgICAgICAgICAgQWVzLlgsXG4gICAgICAgICAgICAgICAgQWVzLllNSU4sIEFlcy5ZTUFYLCBBZXMuTUlERExFLFxuICAgICAgICAgICAgICAgIEFlcy5XSURUSCxcblxuICAgICAgICAgICAgICAgIEFlcy5BTFBIQSxcbiAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgICAgICAgICAgQWVzLkZJTEwsXG4gICAgICAgICAgICAgICAgQWVzLkxJTkVUWVBFLFxuICAgICAgICAgICAgICAgIEFlcy5TSEFQRSxcbiAgICAgICAgICAgICAgICBBZXMuU0laRVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5MSU5FX1JBTkdFIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWCxcbiAgICAgICAgICAgICAgICBBZXMuWU1JTiwgQWVzLllNQVgsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgICAgICAgICAgQWVzLlNJWkVcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuUE9JTlRfUkFOR0UgLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIEFlcy5YLCBBZXMuWSxcbiAgICAgICAgICAgICAgICBBZXMuWU1JTiwgQWVzLllNQVgsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuRklMTCxcbiAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgICAgICAgICAgQWVzLlNIQVBFLFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIEdlb21LaW5kLkNPTlRPVVIgLT4gUEFUSFxuICAgICAgICAgICAgR2VvbUtpbmQuQ09OVE9VUkYgLT4gUE9MWUdPTlxuICAgICAgICAgICAgR2VvbUtpbmQuUE9MWUdPTiAtPiBQT0xZR09OXG4gICAgICAgICAgICBHZW9tS2luZC5NQVAgLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIC8vIGF1dG8td2lyZWQgdG8gJ3gnIG9yICdsb25nJyBhbmQgdG8gJ3knIG9yICdsYXQnXG4gICAgICAgICAgICAgICAgQWVzLlgsIEFlcy5ZLFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFLCAvLyBwYXRoIHdpZHRoXG4gICAgICAgICAgICAgICAgQWVzLkxJTkVUWVBFLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuRklMTCxcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEFcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuQUJfTElORSAtPiBsaXN0T2YoXG4gICAgICAgICAgICAgICAgQWVzLklOVEVSQ0VQVCwgQWVzLlNMT1BFLFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFLCAvLyBwYXRoIHdpZHRoXG4gICAgICAgICAgICAgICAgQWVzLkxJTkVUWVBFLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEFcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuSF9MSU5FIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWUlOVEVSQ0VQVCxcbiAgICAgICAgICAgICAgICBBZXMuU0laRSwgLy8gcGF0aCB3aWR0aFxuICAgICAgICAgICAgICAgIEFlcy5MSU5FVFlQRSxcbiAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBXG4gICAgICAgICAgICApXG4gICAgICAgICAgICBHZW9tS2luZC5WX0xJTkUgLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIEFlcy5YSU5URVJDRVBULFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFLCAvLyBwYXRoIHdpZHRoXG4gICAgICAgICAgICAgICAgQWVzLkxJTkVUWVBFLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuQUxQSEFcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuQk9YX1BMT1QgLT4gbGlzdE9mKFxuICAgICAgICAgICAgICAgIEFlcy5MT1dFUiwgLy8gTmFOIGZvciAnb3V0bGllcicgZGF0YS1wb2ludFxuICAgICAgICAgICAgICAgIEFlcy5NSURETEUsIC8vIE5hTiBmb3IgJ291dGxpZXInIGRhdGEtcG9pbnRcbiAgICAgICAgICAgICAgICBBZXMuVVBQRVIsIC8vIE5hTiBmb3IgJ291dGxpZXInIGRhdGEtcG9pbnRcblxuICAgICAgICAgICAgICAgIEFlcy5YLFxuICAgICAgICAgICAgICAgIEFlcy5ZLCAvLyBOYU4gZm9yICdib3gnIGRhdGEtcG9pbnQgKHVzZWQgZm9yIG91dGxpZXJzKVxuICAgICAgICAgICAgICAgIEFlcy5ZTUFYLFxuICAgICAgICAgICAgICAgIEFlcy5ZTUlOLFxuXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICBBZXMuRklMTCxcbiAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgICAgICAgICAgQWVzLlNIQVBFLFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFLCAvLyBsaW5lIHdpZHRoXG4gICAgICAgICAgICAgICAgQWVzLldJRFRIXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIEdlb21LaW5kLlJJQkJPTiAtPiBsaXN0T2YoXG4gICAgICAgICAgICAgICAgQWVzLlgsXG4gICAgICAgICAgICAgICAgQWVzLllNSU4sIEFlcy5ZTUFYLFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFLFxuICAgICAgICAgICAgICAgIEFlcy5MSU5FVFlQRSxcbiAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgICAgICAgICAgQWVzLkZJTEwsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIEdlb21LaW5kLkFSRUEgLT4gQVJFQVxuICAgICAgICAgICAgR2VvbUtpbmQuREVOU0lUWSAtPiBBUkVBXG4gICAgICAgICAgICBHZW9tS2luZC5ERU5TSVRZMkQgLT4gUEFUSFxuICAgICAgICAgICAgR2VvbUtpbmQuREVOU0lUWTJERiAtPiBQT0xZR09OXG4gICAgICAgICAgICBHZW9tS2luZC5KSVRURVIgLT4gUE9JTlRcbiAgICAgICAgICAgIEdlb21LaW5kLkZSRVFQT0xZIC0+IFBBVEhcbiAgICAgICAgICAgIEdlb21LaW5kLlNURVAgLT4gUEFUSFxuICAgICAgICAgICAgR2VvbUtpbmQuUkVDVCAtPiBsaXN0T2YoXG4gICAgICAgICAgICAgICAgQWVzLlhNSU4sIEFlcy5YTUFYLFxuICAgICAgICAgICAgICAgIEFlcy5ZTUlOLCBBZXMuWU1BWCxcbiAgICAgICAgICAgICAgICBBZXMuU0laRSxcbiAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuICAgICAgICAgICAgICAgIEFlcy5GSUxMLFxuICAgICAgICAgICAgICAgIEFlcy5BTFBIQVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5TRUdNRU5UIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWCwgQWVzLlksXG4gICAgICAgICAgICAgICAgQWVzLlhFTkQsIEFlcy5ZRU5ELFxuICAgICAgICAgICAgICAgIEFlcy5TSVpFLFxuICAgICAgICAgICAgICAgIEFlcy5MSU5FVFlQRSxcbiAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIEFlcy5TUEVFRCxcbiAgICAgICAgICAgICAgICBBZXMuRkxPV1xuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBHZW9tS2luZC5URVhUIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWCwgQWVzLlksXG4gICAgICAgICAgICAgICAgQWVzLlNJWkUsXG4gICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuICAgICAgICAgICAgICAgIEFlcy5BTFBIQSxcbiAgICAgICAgICAgICAgICBBZXMuTEFCRUwsXG4gICAgICAgICAgICAgICAgQWVzLkZBTUlMWSxcbiAgICAgICAgICAgICAgICBBZXMuRk9OVEZBQ0UsXG4gICAgICAgICAgICAgICAgQWVzLkhKVVNULFxuICAgICAgICAgICAgICAgIEFlcy5WSlVTVCxcbiAgICAgICAgICAgICAgICBBZXMuQU5HTEVcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgR2VvbUtpbmQuTElWRV9NQVAgLT4gbGlzdE9mKCAvLyBUb0RvOiBub3Qgc3RhdGljIC0gZGVwZW5kcyBvbiAnZGlzcGxheSBtb2RlJ1xuICAgICAgICAgICAgICAgIEFlcy5BTFBIQSxcbiAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgICAgICAgICAgQWVzLkZJTEwsXG4gICAgICAgICAgICAgICAgQWVzLlNJWkUsXG4gICAgICAgICAgICAgICAgQWVzLlNIQVBFLFxuICAgICAgICAgICAgICAgIEFlcy5GUkFNRSxcbiAgICAgICAgICAgICAgICBBZXMuWCxcbiAgICAgICAgICAgICAgICBBZXMuWSxcbiAgICAgICAgICAgICAgICBBZXMuU1lNX1gsXG4gICAgICAgICAgICAgICAgQWVzLlNZTV9ZXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIEdlb21LaW5kLlJBU1RFUiAtPiBsaXN0T2YoXG4gICAgICAgICAgICAgICAgQWVzLlgsIEFlcy5ZLFxuICAgICAgICAgICAgICAgIEFlcy5XSURUSCwgLy8gbm90IHJlbmRlcmVkIGJ1dCByZXF1aXJlZCBmb3IgY29ycmVjdCB4IGFlcyByYW5nZSBjb21wdXRhdGlvblxuICAgICAgICAgICAgICAgIEFlcy5IRUlHSFQsIC8vIC0tIHRoZSBzYW1lIC0tXG4gICAgICAgICAgICAgICAgQWVzLkZJTEwsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIEdlb21LaW5kLklNQUdFIC0+IGxpc3RPZihcbiAgICAgICAgICAgICAgICBBZXMuWE1JTixcbiAgICAgICAgICAgICAgICBBZXMuWE1BWCxcbiAgICAgICAgICAgICAgICBBZXMuWU1JTixcbiAgICAgICAgICAgICAgICBBZXMuWU1BWFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxufSIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGNhbiBiZSBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlLlx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Y3RlZCBmdW4gdmlzaXROdW1lcmljKGFlczogQWVzPERvdWJsZT4pOiBUIHtcbiAgICAgICAgcmV0dXJuIHZpc2l0SW50ZXJuKGFlcylcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB2aXNpdEludGVybihhZXM6IEFlczwqPik6IFQge1xuICAgICAgICBpZiAoYWVzID09IFgpIHtcbiAgICAgICAgICAgIHJldHVybiB4KClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFkpIHtcbiAgICAgICAgICAgIHJldHVybiB5KClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFopIHtcbiAgICAgICAgICAgIHJldHVybiB6KClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFlNSU4pIHtcbiAgICAgICAgICAgIHJldHVybiB5bWluKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFlNQVgpIHtcbiAgICAgICAgICAgIHJldHVybiB5bWF4KClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IENPTE9SKSB7XG4gICAgICAgICAgICByZXR1cm4gY29sb3IoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gRklMTCkge1xuICAgICAgICAgICAgcmV0dXJuIGZpbGwoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gQUxQSEEpIHtcbiAgICAgICAgICAgIHJldHVybiBhbHBoYSgpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBTSEFQRSkge1xuICAgICAgICAgICAgcmV0dXJuIHNoYXBlKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFNJWkUpIHtcbiAgICAgICAgICAgIHJldHVybiBzaXplKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IExJTkVUWVBFKSB7XG4gICAgICAgICAgICByZXR1cm4gbGluZVR5cGUoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gV0lEVEgpIHtcbiAgICAgICAgICAgIHJldHVybiB3aWR0aCgpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBIRUlHSFQpIHtcbiAgICAgICAgICAgIHJldHVybiBoZWlnaHQoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gV0VJR0hUKSB7XG4gICAgICAgICAgICByZXR1cm4gd2VpZ2h0KClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IElOVEVSQ0VQVCkge1xuICAgICAgICAgICAgcmV0dXJuIGludGVyY2VwdCgpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBTTE9QRSkge1xuICAgICAgICAgICAgcmV0dXJuIHNsb3BlKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFhJTlRFUkNFUFQpIHtcbiAgICAgICAgICAgIHJldHVybiBpbnRlcmNlcHRYKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFlJTlRFUkNFUFQpIHtcbiAgICAgICAgICAgIHJldHVybiBpbnRlcmNlcHRZKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IExPV0VSKSB7XG4gICAgICAgICAgICByZXR1cm4gbG93ZXIoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gTUlERExFKSB7XG4gICAgICAgICAgICByZXR1cm4gbWlkZGxlKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFVQUEVSKSB7XG4gICAgICAgICAgICByZXR1cm4gdXBwZXIoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gRlJBTUUpIHtcbiAgICAgICAgICAgIHJldHVybiBmcmFtZSgpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBTUEVFRCkge1xuICAgICAgICAgICAgcmV0dXJuIHNwZWVkKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IEZMT1cpIHtcbiAgICAgICAgICAgIHJldHVybiBmbG93KClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFhNSU4pIHtcbiAgICAgICAgICAgIHJldHVybiB4bWluKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFhNQVgpIHtcbiAgICAgICAgICAgIHJldHVybiB4bWF4KClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFhFTkQpIHtcbiAgICAgICAgICAgIHJldHVybiB4ZW5kKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IFlFTkQpIHtcbiAgICAgICAgICAgIHJldHVybiB5ZW5kKClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IExBQkVMKSB7XG4gICAgICAgICAgICByZXR1cm4gbGFiZWwoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gRkFNSUxZKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFtaWx5KClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IEZPTlRGQUNFKSB7XG4gICAgICAgICAgICByZXR1cm4gZm9udGZhY2UoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChhZXMgPT0gSEpVU1QpIHtcbiAgICAgICAgICAgIHJldHVybiBoanVzdCgpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGFlcyA9PSBWSlVTVCkge1xuICAgICAgICAgICAgcmV0dXJuIHZqdXN0KClcbiAgICAgICAgfVxuICAgICAgICBpZiAoYWVzID09IEFOR0xFKSB7XG4gICAgICAgICAgICByZXR1cm4gYW5nbGUoKVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGFlcyA9PSBTWU1fWCkge1xuICAgICAgICAgICAgcmV0dXJuIHN5bVgoKVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGFlcyA9PSBTWU1fWSkge1xuICAgICAgICAgICAgcmV0dXJuIHN5bVkoKVxuICAgICAgICB9XG5cbiAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiVW5leHBlY3RlZCBhZXM6IC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zLnZhbHVlcygpKSB7XG4gICAgICAgICAgICAvLyBTYWZlIGNhc3QgYmVjYXVzZSBBZXNJbml0VmFsdWUuZ2V0KGFlcykgaXMgZ3VhcmFudGVlZCB0byByZXR1cm4gY29ycmVjdCB0eXBlLlxuICAgICAgICAgICAgbXlJbmRleEZ1bmN0aW9uTWFwW2Flc10gPVxuICAgICAgICAgICAgICAgIGNvbnN0YW50KFxuICAgICAgICAgICAgICAgICAgICBBZXNJbml0VmFsdWVbYWVzXVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBkYXRhUG9pbnRDb3VudCh2OiBJbnQpOiBBZXN0aGV0aWNzQnVpbGRlciB7XG4gICAgICAgIG15RGF0YVBvaW50Q291bnQgPSB2XG4gICAgICAgIHJldHVybiB0aGlzXG4gICAgfVxuXG4gICAgZnVuIG92ZXJhbGxSYW5nZShhZXM6IEFlczxEb3VibGU+LCByYW5nZTogQ2xvc2VkUmFuZ2U8RG91YmxlPik6IEFlc3RoZXRpY3NCdWlsZGVyIHtcbiAgICAgICAgLy8gSXQncyBmdWxsIHJhbmdlIChsZW5ndGggcHgpIG9mIHgveSBheGlzXG4gICAgICAgIG15T3ZlcmFsbFJhbmdlQnlOdW1lcmljQWVzW2Flc10gPSByYW5nZVxuICAgICAgICByZXR1cm4gdGhpc1xuICAgIH1cblxuICAgIGZ1biB4KHY6IChJbnQpIC0+IERvdWJsZT8pOiBBZXN0aGV0aWNzQnVpbGRlciB7XG4gICAgICAgIHJldHVybiBhZXMoWCwgdilcbiAgICB9XG5cbiAgICBmdW4geSh2OiAoSW50KSAtPiBEb3VibGU/KTogQWVzdGhldGljc0J1aWxkZXIge1xuICAgICAgICByZXR1cm4gYWVzKFksIHYpXG4gICAgfVxuXG4gICAgZnVuIGNvbG9yKHY6IChJbnQpIC0+IENvbG9yPyk6IEFlc3RoZXRpY3NCdWlsZGVyIHtcbiAgICAgICAgcmV0dXJuIGFlcyhDT0xPUiwgdilc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dWlsZGVyIHtcbiAgICAgICAgcmV0dXJuIGFlcyhTUEVFRCwgdilcbiAgICB9XG5cbiAgICBmdW4gZmxvdyh2OiAoSW50KSAtPiBEb3VibGU/KTogQWVzdGhldGljc0J1aWxkZXIge1xuICAgICAgICByZXR1cm4gYWVzKEZMT1csIHYpXG4gICAgfVxuXG4gICAgZnVuIGdyb3VwKHY6IChJbnQpIC0+IEludCk6IEFlc3RoZXRpY3NCdWlsZGVyIHtcbiAgICAgICAgbXlHcm91cCA9IHZcbiAgICAgICAgcmV0dXJuIHRoaXNcbiAgICB9XG5cbiAgICBmdW4gbGFiZWwodjogKEludCkgLT4gQW55Pyk6IEFlc3RoZXRpY3NCdWlsZGVyIHtcbiAgICAgICAgcmV0dXJuIGFlcyhMQUJFTCwgdilcbiAgICB9XG5cbiAgICBmdW4gZmFtaWx5KHY6IChJbnQpIC0+IFN0cmluZz8pOiBBZXN0aGV0aWNzQnVpbGRlciB7XG4gICAgICAgIHJldHVybiBhZXMoRkFNSUxZLCB2KVxuICAgIH1cblxuICAgIGZ1biBmb250ZmFjZSh2OiAoSW50KSAtPiBTdHJpbmc/KTogQWVzdGhldGljc0J1aWxkZXIge1xuICAgICAgICByZXR1cm4gYWVzKEZPTlRGQUNFLCB2KVxuICAgIH1cblxuICAgIGZ1biBoanVzdCh2OiAoSW50KSAtPiBBbnk/KTogQWVzdGhldGljc0J1aWxkZXIge1xuICAgICAgICByZXR1cm4gYWVzKEhKVVNULCB2KVxuICAgIH1cblxuICAgIGZ1biB2anVzdCh2OiAoSW50KSAtPiBBbnk/KTogQWVzdGhldGljc0J1aWxkZXIge1xuICAgICAgICByZXR1cm4gYWVzKFZKVVNULCB2KVxuICAgIH1cblxuICAgIGZ1biBhbmdsZSh2OiAoSW50KSAtPiBEb3VibGU/KTogQWVzdGhldGljc0J1aWxkZXIge1xuICAgICAgICByZXR1cm4gYWVzKEFOR0xFLCB2KVxuICAgIH1cblxuICAgIGZ1biB4bWluKHY6IChJbnQpIC0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NldChiLm15Q29uc3RhbnRBZXMpXG4gICAgICAgICAgICBteU92ZXJhbGxSYW5nZUJ5TnVtZXJpY0FlcyA9IEhhc2hNYXAoYi5teU92ZXJhbGxSYW5nZUJ5TnVtZXJpY0FlcylcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biA8VD4gYWVzKGFlczogQWVzPFQ+KTogKEludCkgLT4gVCB7XG4gICAgICAgICAgICByZXR1cm4gbXlJbmRleEZ1bmN0aW9uTWFwW2Flc11cbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBkYXRhUG9pbnRBdChpbmRleDogSW50KTogRGF0YVBvaW50QWVzdGhldGljcyB7XG4gICAgICAgICAgICByZXR1cm4gTXlEYXRhUG9pbnRBZXN0aGV0aWNzKFxuICAgICAgICAgICAgICAgIGluZGV4LFxuICAgICAgICAgICAgICAgIHRoaXNcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBkYXRhUG9pbnRDb3VudCgpOiBJbnQge1xuICAgICAgICAgICAgcmV0dXJuIG15RGF0YVBvaW50Q291bnRcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBkYXRhUG9pbnRzKCk6IEl0ZXJhYmxlPERhdGFQb2ludEFlc3RoZXRpY3M+IHtcbiAgICAgICAgICAgIHZhbCBzZWxmID0gdGhpc1xuICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IEl0ZXJhYmxlPERhdGFQb2ludEFlc3RoZXRpY3M+IHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gaXRlcmF0b3IoKTogSXRlcmF0b3I8RGF0YVBvaW50QWVzdGhldGljcz4gPVxuICAgICAgICAgICAgICAgICAgICBNeURhdGFQb2ludHNJdGVyYXRvcihcbiAgICAgICAgICAgICAgICAgICAgICAgIG15RGF0YVBvaW50Q291bnQsXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biByYW5nZShhZXM6IEFlczxEb3VibGU+KTogQ2xvc2VkUmFuZ2U8RG91YmxlPj8ge1xuICAgICAgICAgICAgaWYgKCFteVJhbmdlQnlOdW1lcmljQWVzLmNvbnRhaW5zS2V5KGFlcykpIHtcbiAgICAgICAgICAgICAgICB2YWwgciA9IHdoZW4ge1xuICAgICAgICAgICAgICAgICAgICBteURhdGFQb2ludENvdW50IDw9IDAgLT5cbiAgICAgICAgICAgICAgICAgICAgICAgIENsb3NlZFJhbmdlKDAuMCwgMC4wKVxuICAgICAgICAgICAgICAgICAgICBteUNvbnN0YW50QWVzLmNvbnRhaW5zKGFlcykgLT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gY29uc3RhbnQgc2hvdWxkIG5vdCBiZSBudWxsXG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgdiA9IG51bWVyaWNWYWx1ZXMoYWVzKS5pdGVyYXRvcigpLm5leHQoKSEhXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodi5pc0Zpbml0ZSgpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2xvc2VkUmFuZ2UodiwgdilcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBudWxsXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgdmFsdWVzID0gbnVtZXJpY1ZhbHVlcyhhZXMpXG4gICAgICAgICAgICAgICAgICAgICAgICBTZXJpZXNVdGlsLnJhbmdlKHZhbHVlcylcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBteVJhbmdlQnlOdW1lcmljQWVzW2Flc10gPSByXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBteVJhbmdlQnlOdW1lcmljQWVzW2Flc11cbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBvdmVyYWxsUmFuZ2UoYWVzOiBBZXM8RG91YmxlPik6IENsb3NlZFJhbmdlPERvdWJsZT4ge1xuICAgICAgICAgICAgcmV0dXJuIG15T3ZlcmFsbFJhbmdlQnlOdW1lcmljQWVzW2Flc10gPzogZXJyb3IoXCJPdmVyYWxsIHJhbmdlIGlzIHVua25vd24gZm9yICRhZXNcIilcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biByZXNvbHV0aW9uKGFlczogQWVzPERvdWJsZT4sIG5hVmFsdWU6IERvdWJsZSk6IERvdWJsZSB7XG4gICAgICAgICAgICBpZiAoIW15UmVzb2x1dGlvbkJ5QWVzLmNvbnRhaW5zS2V5KGFlcykpIHtcbiAgICAgICAgICAgICAgICB2YWwgcmVzb2x1dGlvbjogRG91YmxlID1cbiAgICAgICAgICAgICAgICAgICAgd2hlbiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBteUNvbnN0YW50QWVzLmNvbnRhaW5zKGFlcykgLT4gMC4wXG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWwgdmFsdWVzID0gbnVtZXJpY1ZhbHVlcyhhZXMpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgU2VyaWVzVXRpbC5yZXNvbHV0aW9uKHZhbHVlcywgbmFWYWx1ZSlcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG15UmVzb2x1dGlvbkJ5QWVzW2Flc10gPSByZXNvbHV0aW9uXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBteVJlc29sdXRpb25CeUFlc1thZXNdISFcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBudW1lcmljVmFsdWVzKGFlczogQWVzPERvdWJsZT4pOiBJdGVyYWJsZTxEb3VibGU/PiB7XG4gICAgICAgICAgICByZXF1aXJlKGFlcy5pc051bWVyaWMpIHsgXCJOdW1lcmljIGFlcyBpcyBleHBlY3RlZDogJGFlc1wiIH1cbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBJdGVyYWJsZTxEb3VibGU+IHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gaXRlcmF0b3IoKTogSXRlcmF0b3I8RG91YmxlPiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBBZXNJdGVyYXRvcihcbiAgICAgICAgICAgICAgICAgICAgICAgIG15RGF0YVBvaW50Q291bnQsXG4gICAgICAgICAgICAgICAgICAgICAgICBhZXMoYWVzKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGdyb3VwcygpOiBJdGVyYWJsZTxJbnQ+IHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBJdGVyYWJsZTxJbnQ+IHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gaXRlcmF0b3IoKTogSXRlcmF0b3I8SW50PiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBBZXNJdGVyYXRvcihcbiAgICAgICAgICAgICAgICAgICAgICAgIG15RGF0YVBvaW50Q291bnQsXG4gICAgICAgICAgICAgICAgICAgICAgICBncm91cFxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBjbGFzcyBNeURhdGFQb2ludHNJdGVyYXRvciBpbnRlcm5hbCBjb25zdHJ1Y3RvcihcbiAgICAgICAgcHJpdmF0ZSB2YWwgbXlMZW5ndGg6IEludCxcbiAgICAgICAgcHJpdmF0ZSB2YWwgbXlBZXN0aGV0aWNzOiBNeUFlc3RoZXRpY3NcbiAgICApIDogSXRlcmF0b3I8RGF0YVBvaW50QWVzdGhldGljcz4ge1xuICAgICAgICBwcml2YXRlIHZhciBteUluZGV4ID0gMFxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBoYXNOZXh0KCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIG15SW5kZXggPCBteUxlbmd0aFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIG5leHQoKTogRGF0YVBvaW50QWVzdGhldGljcyB7XG4gICAgICAgICAgICBpZiAoaGFzTmV4dCgpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG15QWVzdGhldGljcy5kYXRhUG9pbnRBdChteUluZGV4KyspXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aHJvdyBOb1N1Y2hFbGVtZW50RXhjZXB0aW9uKFwiaW5kZXg9JG15SW5kZXhcIilcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgQWVzSXRlcmF0b3I8VD4gaW50ZXJuYWwgY29uc3RydWN0b3IocHJpdmF0ZSB2YWwgbXlMZW5ndGg6IEludCwgcHJpdmF0ZSB2YWwgbXlBZXM6IChJbnQpIC0+IFQpIDpcbiAgICAgICAgSXRlcmF0b3I8VD4ge1xuICAgICAgICBwcml2YXRlIHZhciBteUluZGV4ID0gMFxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBoYXNOZXh0KCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIG15SW5kZXggPCBteUxlbmd0aFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIG5leHQoKTogVCB7XG4gICAgICAgICAgICBpZiAoaGFzTmV4dCgpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG15QWVzKG15SW5kZXgrKylcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRocm93IE5vU3VjaEVsZW1lbnRFeGNlcHRpb24oXCJpbmRleD0kbXlJbmRleFwiKVxuICAgICAgICB9XG4gICAgfVxuXG5cbiAgICBwcml2YXRlIGNsYXNzIE15RGF0YVBvaW50QWVzdGhldGljcyhcbiAgICAgICAgcHJpdmF0ZSB2YWwgbXlJbmRleDogSW50PyxcbiAgICAgICAgcHJpdmF0ZSB2YWwgbXlBZXN0aGV0aWNzOiBNeUFlc3RoZXRpY3NcbiAgICApIDogRGF0YVBvaW50QWVzdGhldGljcyB7XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGluZGV4KCk6IEludCB7XG4gICAgICAgICAgICByZXR1cm4gbXlJbmRleCEhXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4geCgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoWClcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB5KCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChZKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHooKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFopXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4geW1pbigpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoWU1JTilcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB5bWF4KCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChZTUFYKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGNvbG9yKCk6IENvbG9yIHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoQ09MT1IpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gZmlsbCgpOiBDb2xvciB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KEZJTEwpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gYWxwaGEoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KEFMUEhBKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHNoYXBlKCk6IFBvaW50U2hhcGUge1xuICAgICAgICAgICAgcmV0dXJuIGdldChTSEFQRSlcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBsaW5lVHlwZSgpOiBMaW5lVHlwZSB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KExJTkVUWVBFKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHNpemUoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFNJWkUpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gd2lkdGgoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFdJRFRIKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhlaWdodCgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoSEVJR0hUKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHdlaWdodCgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoV0VJR0hUKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGludGVyY2VwdCgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoSU5URVJDRVBUKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHNsb3BlKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChTTE9QRSlcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBpbnRlcmNlcHRYKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChYSU5URVJDRVBUKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGludGVyY2VwdFkoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFlJTlRFUkNFUFQpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gbG93ZXIoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KExPV0VSKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIG1pZGRsZSgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoTUlERExFKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHVwcGVyKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChVUFBFUilcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBmcmFtZSgpOiBTdHJpbmcge1xuICAgICAgICAgICAgcmV0dXJuIGdldChGUkFNRSlcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBzcGVlZCgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoU1BFRUQpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gZmxvdygpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoRkxPVylcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB4bWluKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChYTUlOKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHhtYXgoKTogRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFhNQVgpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4geGVuZCgpOiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoWEVORClcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB5ZW5kKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChZRU5EKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGxhYmVsKCk6IEFueT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChMQUJFTClcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBmYW1pbHkoKTogU3RyaW5nIHtcbiAgICAgICAgICAgIHJldHVybiBnZXQoRkFNSUxZKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGZvbnRmYWNlKCk6IFN0cmluZyB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KEZPTlRGQUNFKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhqdXN0KCk6IEFueSB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KEhKVVNUKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHZqdXN0KCk6IEFueSB7XG4gICAgICAgICAgICByZXR1cm4gZ2V0KFZKVVNUKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGFuZ2xlKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChBTkdMRSlcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBzeW1YKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChTWU1fWClcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBzeW1ZKCk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIGdldChTWU1fWSlcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBncm91cCgpOiBJbnQ/IHtcbiAgICAgICAgICAgIHJldHVybiBteUFlc3RoZXRpY3MuZ3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gICAgICAgICAgICByZXR1cm4gcGF0aCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdmxpbmUoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBwYXRoKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBzbW9vdGgoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBwYXRoKClcbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5DT0xPUiwgQ29sb3IuTUFHRU5UQSlcbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5GSUxMLCBDb2xvci5CTEFDSylcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBiYXIoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBBZXN0aGV0aWNzRGVmYXVsdHMoKSB7XG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHJhbmdlSW5jbHVkZXNaZXJvKGFlczogQWVzPCo+KTogQm9vbGVhbiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBhZXMgPT0gQWVzLlkgfHwgc3VwZXIucmFuZ2VJbmNsdWRlc1plcm8oYWVzKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5XSURUSCwgMC45KVxuICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLkNPTE9SLCBDb2xvci5UUkFOU1BBUkVOVCkgICAgLy8gbm8gb3V0bGluZSAodHJhbnNwYXJlbnQpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaGlzdG9ncmFtKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gb2JqZWN0IDogQWVzdGhldGljc0RlZmF1bHRzKCkge1xuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biByYW5nZUluY2x1ZGVzWmVybyhhZXM6IEFlczwqPik6IEJvb2xlYW4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gYWVzID09IEFlcy5ZIHx8IHN1cGVyLnJhbmdlSW5jbHVkZXNaZXJvKGFlcylcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuQ09MT1IsIENvbG9yLlRSQU5TUEFSRU5UKSAgICAvLyBubyBvdXRsaW5lICh0cmFuc3BhcmVudClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB0aWxlKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gQWVzdGhldGljc0RlZmF1bHRzKClcbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5DT0xPUiwgQ29sb3IuVFJBTlNQQVJFTlQpICAgIC8vIG5vIG91dGxpbmUgKHRyYW5zcGFyZW50KVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGJpbjJkKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gdGlsZSgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZXJyb3JCYXIoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBBZXN0aGV0aWNzRGVmYXVsdHMoKVxuICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLkNPTE9SLCBDb2xvci5CTEFDSylcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBjcm9zc0JhcigpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIEFlc3RoZXRpY3NEZWZhdWx0cygpXG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuV0lEVEgsIDAuOSlcbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5DT0xPUiwgQ29sb3IuQkxBQ0spXG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuRklMTCwgQ29sb3IuV0hJVEUpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gbGluZVJhbmdlKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gcGF0aCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcG9pbnRSYW5nZSgpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIHBhdGgoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHBvbHlnb24oKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBiYXNlKClcbiAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5DT0xPUiwgQ29sb3IuVFJBTlNQQVJFTlQpICAgIC8vIG5vIG91dGxpbmUgKHRyYW5zcGFyZW50KVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIG1hcCgpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIGJhc2UoKVxuICAgICAgICAgICAgICAgIC51cGRhdGUoQWVzLlNJWkUsIDAuMikgICAgICAgICAgICAgICAgICAgIC8vIG91dGxpbmUgdGhpY2tuZXNzXG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuQ09MT1IsIENvbG9yLkdSQVkpXG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuRklMTCwgQ29sb3IuVFJBTlNQQVJFTlQpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYm94cGxvdCgpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIGNyb3NzQmFyKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBsaXZlbWFwKGRpc3BsYXlNb2RlOiBMaXZlbWFwQ29uc3RhbnRzLkRpc3BsYXlNb2RlKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiB3aGVuIChkaXNwbGF5TW9kZSkge1xuICAgICAgICAgICAgICAgIExpdmVtYXBDb25zdGFudHMuRGlzcGxheU1vZGUuUE9JTlQgLT4gcG9pbnQoKVxuICAgICAgICAgICAgICAgICAgICAudXBkYXRlSW5MZWdlbmQoQWVzLlNJWkUsIDUuMClcbiAgICAgICAgICAgICAgICBMaXZlbWFwQ29uc3RhbnRzLkRpc3BsYXlNb2RlLkJBUiAtPiBiYXNlKClcbiAgICAgICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuU0laRSwgNDAuMClcbiAgICAgICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuQ09MT1IsIENvbG9yLlRSQU5TUEFSRU5UKVxuICAgICAgICAgICAgICAgIExpdmVtYXBDb25zdGFudHMuRGlzcGxheU1vZGUuUElFIC0+IGJhc2UoKVxuICAgICAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5TSVpFLCAyMC4wKVxuICAgICAgICAgICAgICAgICAgICAudXBkYXRlKEFlcy5DT0xPUiwgQ29sb3IuVFJBTlNQQVJFTlQpXG4gICAgICAgICAgICAgICAgICAgIC51cGRhdGVJbkxlZ2VuZChBZXMuU0laRSwgNS4wKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHJpYmJvbigpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIGJhc2UoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGFyZWEoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBBZXN0aGV0aWNzRGVmYXVsdHMoKSB7XG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHJhbmdlSW5jbHVkZXNaZXJvKGFlczogQWVzPCo+KTogQm9vbGVhbiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBhZXMgPT0gQWVzLlkgfHwgc3VwZXIucmFuZ2VJbmNsdWRlc1plcm8oYWVzKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBkZW5zaXR5KCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gYXJlYSgpXG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuRklMTCwgQ29sb3IuVFJBTlNQQVJFTlQpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gY29udG91cigpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIHBhdGgoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGNvbnRvdXJmKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gYmFzZSgpXG4gICAgICAgICAgICAgICAgLnVwZGF0ZShBZXMuU0laRSwgMC4wKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGRlbnNpdHkyZCgpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIGNvbnRvdXIoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGRlbnNpdHkyZGYoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgIHJldHVybiBjb250b3VyZigpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaml0dGVyKCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gcG9pbnQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGZyZXFwb2x5KCk6IEFlc3RoZXRpY3NEZWZhdWx0cyB7XG4gICAgICAgICAgICByZXR1cm4gcGF0aCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gc3RlcCgpOiBBZXN0aGV0aWNzRGVmYXVsdHMge1xuICAgICAgICAgICAgcmV0dXJuIHBhdGgoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHJlY3QoKTogQWVzdGhldGljc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AgIC8vIGFlcyBVbml0cyAtPiBweFxuLy8gICAgICAgIHJldHVybiBwLnNpemUoKSEhICogMi4yXG4vLyAgICB9XG4vL1xuLy8gICAgZnVuIGNpcmNsZURpYW1ldGVyU21hbGxlcihwOiBEYXRhUG9pbnRBZXN0aGV0aWNzKTogRG91YmxlIHtcbi8vICAgICAgICAvLyBhZXMgVW5pdHMgLT4gcHhcbi8vICAgICAgICByZXR1cm4gcC5zaXplKCkhISAqIDEuNVxuLy8gICAgfVxuLy9cbi8vICAgIGZ1biBzaXplRnJvbUNpcmNsZURpYW1ldGVyKGRpYW1ldGVyOiBEb3VibGUpOiBEb3VibGUge1xuLy8gICAgICAgIC8vIHB4IC0+IGFlcyBVbml0c1xuLy8gICAgICAgIHJldHVybiBkaWFtZXRlciAvIDIuMlxuLy8gICAgfVxuLy9cbiAgICBmdW4gdGV4dFNpemUocDogRGF0YVBvaW50QWVzdGhldGljcyk6IERvdWJsZSB7XG4gICAgICAgIC8vIGFlcyBVbml0cyAtPiBweFxuICAgICAgICByZXR1cm4gcC5zaXplKCkhISAqIDJcbiAgICB9XG5cbiAgICBmdW4gdXBkYXRlU3Ryb2tlKHNoYXBlOiBTdmdTaGFwZSwgcDogRGF0YVBvaW50QWVzdGhldGljcywgYXBwbHlBbHBoYTogQm9vbGVhbikge1xuICAgICAgICBzaGFwZS5zdHJva2VDb2xvcigpLnNldChwLmNvbG9yKCkpXG4gICAgICAgIGlmIChzb2xpZChwLmNvbG9yKCkhISkgJiYgYXBwbHlBbHBoYSkge1xuICAgICAgICAgICAgc2hhcGUuc3Ryb2tlT3BhY2l0eSgpLnNldChwLmFscGhhKCkpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gdXBkYXRlRmlsbChzaGFwZTogU3ZnU2hhcGUsIHA6IERhdGFQb2ludEFlc3RoZXRpY3MpIHtcbiAgICAgICAgc2hhcGUuZmlsbENvbG9yKCkuc2V0KHAuZmlsbCgpKVxuICAgICAgICBpZiAoc29saWQoc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gICB0b0NsaWVudE9mZnNldFgob3JpZ2luLngpLFxuICAgICAgICAgICAgdG9DbGllbnRPZmZzZXRZKG9yaWdpbi55KSxcbiAgICAgICAgICAgIGZyb21DbGllbnRPZmZzZXRYKG9yaWdpbi54KSxcbiAgICAgICAgICAgIGZyb21DbGllbnRPZmZzZXRZKG9yaWdpbi55KSxcbiAgICAgICAgICAgIHhMaW0sXG4gICAgICAgICAgICB5TGltXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gdG9DbGllbnRPZmZzZXRYKHhSYW5nZTogQ2xvc2VkUmFuZ2U8RG91YmxlPik6IChEb3VibGUpIC0+IERvdWJsZSB7XG4gICAgICAgIHJldHVybiB0b0NsaWVudE9mZnNldFgoXG4gICAgICAgICAgICBvcmlnaW5YKFxuICAgICAgICAgICAgICAgIHhSYW5nZVxuICAgICAgICAgICAgKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIHRvQ2xpZW50T2Zmc2V0WSh5UmFuZ2U6IENsb3NlZFJhbmdlPERvdWJsZT4pOiAoRG91YmxlKSAtPiBEb3VibGUge1xuICAgICAgICByZXR1cm4gdG9DbGllbnRPZmZzZXRZKFxuICAgICAgICAgICAgb3JpZ2luWShcbiAgICAgICAgICAgICAgICB5UmFuZ2VcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIG9yaWdpblgoeFJhbmdlOiBDbG9zZWRSYW5nZTxEb3VibGU+KTogRG91YmxlIHtcbiAgICAgICAgcmV0dXJuIC14UmFuZ2UubG93ZXJFbmRcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBvcmlnaW5ZKHlSYW5nZTogQ2xvc2VkUmFuZ2U8RG91YmxlPik6IERvdWJsZSB7XG4gICAgICAgIHJldHVybiB5UmFuZ2UudXBwZXJFbmRcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB0b0NsaWVudE9mZnNldFgob3JpZ2luWDogRG91YmxlKTogKERvd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nNmb3JtU291cmNlLCBzY2FsZSlcbi8vICAgIH1cblxuICAgIGZ1biBoYXNWYXJpYWJsZShkYXRhOiBEYXRhRnJhbWUsIHZhck5hbWU6IFN0cmluZyk6IEJvb2xlYW4ge1xuICAgICAgICBmb3IgKGB2YXJgIGluIGRhdGEudmFyaWFibGVzKCkpIHtcbiAgICAgICAgICAgIGlmICh2YXJOYW1lID09IGB2YXJgLm5hbWUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZVxuICAgIH1cblxuICAgIGZ1biBmaW5kVmFyaWFibGVPckZhaWwoZGF0YTogRGF0YUZyYW1lLCB2YXJOYW1lOiBTdHJpbmcpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICBmb3IgKHZhcmlhYmxlIGluIGRhdGEudmFyaWFibGVzKCkpIHtcbiAgICAgICAgICAgIGlmICh2YXJOYW1lID09IHZhcmlhYmxlLm5hbWUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdmFyaWFibGVcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oXG4gICAgICAgICAgICBcIlZhcmlhYmxlIG5vdCBmb3VuZDogJyR2YXJOYW1lJy4gVmFyaWFibGVzIGluIGRhdGEgZnJhbWU6ICR7XG4gICAgICAgICAgICAgICAgZGF0YS52YXJpYWJsZXMoKS5tYXAgeyBcIicke2l0Lm5hbWV9J1wiIH1cbiAgICAgICAgICAgIH1cIlxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIGlzTnVtZXJpYyhkYXRhOiBEYXRhRnJhbWUsIHZhck5hbWU6IFN0cmluZyk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gZGF0YS5pc051bWVyaWMoZmluZFZhcmlhYmxlT3JGYWlsKGRhdGEsIHZhck5hbWUpKVxuIC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FN0cmluZy5jb21wYXJlVG8ob3RoZXI6IFN0cmluZywgaWdub3JlQ2FzZTogQm9vbGVhbiA9IGZhbHNlKTogSW50IHtcbiAgICBpZiAoaWdub3JlQ2FzZSkge1xuICAgICAgICB2YWwgbjEgPSB0aGlzLmxlbmd0aFxuICAgICAgICB2YWwgbjIgPSBvdGhlci5sZW5ndGhcbiAgICAgICAgdmFsIG1pbiA9IG1pbk9mKG4xLCBuMilcbiAgICAgICAgaWYgKG1pbiA9PSAwKSByZXR1cm4gbjEgLSBuMlxuICAgICAgICB2YXIgc3RhcnQgPSAwXG4gICAgICAgIHdoaWxlICh0cnVlKSB7XG4gICAgICAgICAgICB2YWwgZW5kID0gbWluT2Yoc3RhcnQgKyAxNiwgbWluKVxuICAgICAgICAgICAgdmFyIHMxID0gdGhpcy5zdWJzdHJpbmcoc3RhcnQsIGVuZClcbiAgICAgICAgICAgIHZhciBzMiA9IG90aGVyLnN1YnN0cmluZyhzdGFydCwgZW5kKVxuICAgICAgICAgICAgaWYgKHMxICE9IHMyKSB7XG4gICAgICAgICAgICAgICAgczEgPSBzMS51cHBlcmNhc2UoKVxuICAgICAgICAgICAgICAgIHMyID0gczIudXBwZXJjYXNlKClcbiAgICAgICAgICAgICAgICBpZiAoczEgIT0gczIpIHtcbiAgICAgICAgICAgICAgICAgICAgczEgPSBzMS5sb3dlcmNhc2UoKVxuICAgICAgICAgICAgICAgICAgICBzMiA9IHMyLmxvd2VyY2FzZSgpXG4gICAgICAgICAgICAgICAgICAgIGlmIChzMSAhPSBzMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMxLmNvbXBhcmVUbyhzMilcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChlbmQgPT0gbWluKSBicmVha1xuICAgICAgICAgICAgc3RhcnQgPSBlbmRcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbjEgLSBuMlx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4gICAgICAgIHJldHVybiBWQVJTW3Zhck5hbWVdISFcbiAgICB9XG5cbiAgICBmdW4gZm9yQWVzKGFlczogQWVzPCo+KTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgcmV0dXJuIFZBUl9CWV9BRVMudmlzaXQoYWVzKVxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgVHJhbnNmb3JtVmFyQnlBZXMgOiBBZXNWaXNpdG9yPERhdGFGcmFtZS5WYXJpYWJsZT4oKSB7XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHgoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBYXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4geSgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIFlcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB6KCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gWlxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHltaW4oKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBZTUlOXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4geW1heCgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIFlNQVhcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBjb2xvcigpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIENPTE9SXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gZmlsbCgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIEZJTExcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBhbHB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VmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIFhNQVhcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biB4ZW5kKCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gWEVORFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHllbmQoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBZRU5EXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gbGFiZWwoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBMQUJFTFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGZhbWlseSgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIEZPTlRfRkFNSUxZXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gZm9udGZhY2UoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBGT05UX0ZBQ0VcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBoanVzdCgpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIEhKVVNUXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gdmp1c3QoKTogRGF0YUZyYW1lLlZhcmlhYmxlIHtcbiAgICAgICAgICAgIHJldHVybiBWSlVTVFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGFuZ2xlKCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gQU5HTEVcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBzeW1YKCk6IERhdGFGcmFtZS5WYXJpYWJsZSB7XG4gICAgICAg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4oKVxuICAgICAgICBmb3IgKHAgaW4gYWVzdGhldGljcy5kYXRhUG9pbnRzKCkpIHtcbiAgICAgICAgICAgIHZhbCBpbnRlcmNlcHQgPSBwLmludGVyY2VwdCgpXG4gICAgICAgICAgICB2YWwgc2xvcGUgPSBwLnNsb3BlKClcbiAgICAgICAgICAgIGlmIChTZXJpZXNVdGlsLmFsbEZpbml0ZShpbnRlcmNlcHQsIHNsb3BlKSkge1xuICAgICAgICAgICAgICAgIHZhbCBwMSA9IERvdWJsZVZlY3Rvcih2aWV3UG9ydC5sZWZ0LCBpbnRlcmNlcHQhISArIHZpZXdQb3J0LmxlZnQgKiBzbG9wZSEhKVxuICAgICAgICAgICAgICAgIHZhbCBwMiA9IERvdWJsZVZlY3Rvcih2aWV3UG9ydC5yaWdodCwgcDEueSArIHZpZXdQb3J0LmRpbWVuc2lvbi54ICogc2xvcGUpXG4gICAgICAgICAgICAgICAgdmFsIHMgPSBEb3VibGVTZWdtZW50KHAxLCBwMilcblxuICAgICAgICAgICAgICAgIHZhbCBsaW5lRW5kcyA9IEhhc2hTZXQ8RG91YmxlVmVjdG9yPigyKVxuICAgICAgICAgICAgICAgIGZvciAoYm91bmRhcnkgaW4gYm91bmRhcmllcykge1xuICAgICAgICAgICAgICAgICAgICB2YWwgaW50ZXJzZWN0aW9uID0gYm91bmRhcnkuaW50ZXJzZWN0aW9uKHMpXG4gICAgICAgICAgICAgICAgICAgIGlmIChpbnRlcnNlY3Rpb24gIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGluZUVuZHMuYWRkKGludGVyc2VjdGlvbilcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsaW5lRW5kcy5zaXplID09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKGxpbmV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GNvb3JkOiBDb29yZGluYXRlU3lzdGVtLCBjdHg6IEdlb21Db250ZXh0KSB7XG4gICAgICAgIHZhbCBnZW9tSGVscGVyID0gR2VvbUhlbHBlcihwb3MsIGNvb3JkLCBjdHgpXG4gICAgICAgIHZhbCBkYXRhUG9pbnRzID0gZGF0YVBvaW50cyhhZXN0aGV0aWNzKS5maWx0ZXIgeyBwIC0+XG4gICAgICAgICAgICB2YWwgeCA9IHAueCgpXG4gICAgICAgICAgICB2YWwgeSA9IHAueSgpXG4gICAgICAgICAgICBTZXJpZXNVdGlsLmFsbEZpbml0ZSh4LCB5KSAmJiBjb29yZC5pc1BvaW50SW5MaW1pdHMoRG91YmxlVmVjdG9yKHghISx5ISEpLCBpc0NsaWVudCA9IGZhbHNlKVxuICAgICAgICB9XG4gICAgICAgIHZhbCBtdWx0aVBvaW50RGF0YUxpc3QgPSBNdWx0aVBvaW50RGF0YUNvbnN0cnVjdG9yLmNyZWF0ZU11bHRpUG9pbnREYXRhQnlHcm91cChcbiAgICAgICAgICAgIGRhdGFQb2ludHMsXG4gICAgICAgICAgICBzaW5nbGVQb2ludEFwcGVuZGVyIHsgcCAtPiB0b0NsaWVudChnZW9tSGVscGVyLCBwKSB9LFxuICAgICAgICAgICAgcmVkdWNlcigwLjk5OSwgZmFsc2UpXG4gICAgICAgIClcblxuICAgICAgICB2YWwgdGFyZ2V0Q29sbGVjdG9yID0gZ2V0R2VvbVRhcmdldENvbGxlY3RvcihjdHgpXG4gICAgICAgIGZvciAobXVsdGlQb2ludERhdGEgaW4gbXVsdGlQb2ludERhdGFMaXN0KSB7XG4gICAgICAgICAgICB0YXJnZXRDb2xsZWN0b3IuYWRkUGF0aChcbiAgICAgICAgICAgICAgICBtdWx0aVBvaW50RGF0YS5wb2ludHMsXG4gICAgICAgICAgICAgICAgbXVsdGlQb2ludERhdGEubG9jYWxUb0dsb2JhbEluZGV4LFxuICAgICAgICAgICAgICAgIHNldHVwVG9vbHRpcFBhcmFtcyhtdWx0aVBvaW50RGF0YS5hZXMpXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcm90ZWN0ZWQgb3BlbiBmdW4gc2V0dXBUb29sdGlwUGFyYW1zKGFlczogRGF0YVBvaW50QWVzdGhldGljcyk6IFRvb2x0aXBQYXJhbXMge1xuICAgICAgICByZXR1cm4gcGFyYW1zKCkuc2V0Q29sb3IoZnJvbUZpbGwoYWVzKSlcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB0b0NsaWVudChnZW9tSGVscGVyOiBHZW9tSGVscGVyLCBwOiBEYXRhUG9pbnRBZXN0aGV0aWNzKTogRG91YmxlVmVjdG9yPyB7XG4gICAgICAgIHZhbCBjb29yZCA9IEdlb21VdGlsLlRPX0xPQ0FUSU9OX1hfWShwKVxuICAgICAgICByZXR1cm4gaWYgKGNvb3JkICE9IG51bGwpIHtcbiAgICAgICAgICAgIGdlb21IZWxwZXIudG9DbGllbnQoY29vcmQsIHApXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBudWxsXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbi8vICAgICAgICB2YWwgUkVOREVSUyA9IGxpc3RPZihcbi8vICAgICAgICAgICAgICAgIEFlcy5YLFxuLy8gICAgICAgICAgICAgICAgQWVzLlksXG4vLyAgICAgICAgICAgICAgICBBZXMuU0laRSxcbi8vICAgICAgICAgICAgICAgIEFlcy5MSU5FVFlQRSxcbi8vICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbi8vICAgICAgICAgICAgICAgIEFlcy5GSUxMLFxuLy8gICAgICAgICAgICAgICAgQWVzLkFMUEhBXG4vLyAgICAgICAgKVxuXG4gICAgICAgIGNvbnN0IHZhbCBIQU5ETEVTX0dST1VQUyA9IHRydWVcbiAgICB9XG5cblxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9m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gb3V0bGllclNoYXBlOiBQb2ludFNoYXBlPyA9IG51bGxcbiAgICB2YXIgb3V0bGllclNpemU6IERvdWJsZT8gPSBudWxsXG5cbiAgICBvdmVycmlkZSB2YWwgbGVnZW5kS2V5RWxlbWVudEZhY3Rvcnk6IExlZ2VuZEtleUVsZW1lbnRGYWN0b3J5XG4gICAgICAgIGdldCgpID0gTEVHRU5EX0ZBQ1RPUllcblxuICAgIG92ZXJyaWRlIGZ1biBidWlsZEludGVybihcbiAgICAgICAgcm9vdDogU3ZnUm9vdCxcbiAgICAgICAgYWVzdGhldGljczogQWVzdGhldGljcyxcbiAgICAgICAgcG9zOiBQb3NpdGlvbkFkanVzdG1lbnQsXG4gICAgICAgIGNvb3JkOiBDb29yZGluYXRlU3lzdGVtLFxuICAgICAgICBjdHg6IEdlb21Db250ZXh0XG4gICAgKSB7XG4gICAgICAgIENyb3NzQmFySGVscGVyLmJ1aWxkQm94ZXMoXG4gICAgICAgICAgICByb290LCBhZXN0aGV0aWNzLCBwb3MsIGNvb3JkLCBjdHgsXG4gICAgICAgICAgICByZWN0YW5nbGVCeURhdGFQb2ludChjdHgpXG4gICAgICAgIClcbiAgICAgICAgYnVpbGRMaW5lcyhyb290LCBhZXN0aGV0aWNzLCBwb3MsIGNvb3JkLCBjdHgpXG4gICAgICAgIGJ1aWxkT3V0bGllcnMocm9vdCwgYWVzdGhldGljcywgcG9zLCBjb29yZCwgY3R4KVxuICAgICAgICBCYXJUb29sdGlwSGVscGVyLmNvbGxlY3RSZWN0YW5nbGVUYXJnZXRzKFxuICAgICAgICAgICAgbGlzdE9mKEFlcy5ZTUFYLCBBZXMuVVBQRVIsIEFlcy5NSURETEUsIEFlcy5MT1dFUiwgQWVzLllNSU4pLFxuICAgICAgICAgICAgYWVzdGhldGljcywgcG9zLCBjb29yZCwgY3R4LFxuICAgICAgICAgICAgcmVjdGFuZ2xlQnlEYXRhUG9pbnQoY3R4KSxcbiAgICAgICAgICAgIHsgSGludENvbG9yVXRpbC5mcm9tQ29sb3IoaXQpIH1cbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGJ1aWxkTGluZXMoXG4gICAgICAgIHJvb3Q6IFN2Z1Jvb3QsXG4gICAgICAgIGFlc3RoZXRpY3M6IEFlc3RoZXRpY3MsXG4gICAgICAgIHBvczogUG9zaXRpb25BZGp1c3RtZW50LFxuICAgICAgICBjb29yZDogQ29vcmRpbmF0ZVN5c3RlbSxcbiAgICAgICAgY3R4OiBHZW9tQ29udGV4dFxuICAgICkge1xuICAgICAgICBDcm9zc0JhckhlbHBlci5idWlsZE1pZGxpbmVzKHJvb3QsIGFlc3RoZXRpY3MsIHBvcywgY29vcmQsIGN0eCwgZmF0dGVuTWlkbGluZSlcblxuICAgICAgICB2YWwgaGVscGVyID0gR2VvbUhlbHBlcihwb3MsIGNvb3JkLCBjdHgpXG4gICAgICAgIHZhbCBlbGVtZW50SGVscGVyID0gaGVscGVyLmNyZWF0ZVN2Z0VsZW1lbnRIZWxwZXIoKVxuICAgICAgICBmb3IgKHAgaW4gR2VvbVV0aWwud2l0aERlZmluZWQoYWVzdGhldGljcy5kYXRhUG9pbnRzKCksIEFlcy5YKSkge1xuICAgICAgICAgICAgdmFsIHggPSBwLngoKSEhXG4gICAgICAgICAgICB2YWwgbGluZXMgPSBBcnJheUxpc3Q8U3ZnTGluZUVsZW1lbnQ+KClcblxuICAgICAgICAgICAgLy8gbG93ZXIgd2hpc2tlclxuICAgICAgICAgICAgaWYgKHAuZGVmaW5lZChBZXMuTE9XRVIpICYmIHAuZGVmaW5lZChBZXMuWU1JTikpIHtcbiAgICAgICAgICAgICAgICB2YWwgaGluZ2UgPSBwLmxvd2VyKCkhIVxuICAgICAgICAgICAgICAgIHZhbCBmZW5jZSA9IHAueW1pbigpISFcbiAgICAgICAgICAgICAgICAvLyB3aGlza2VyIGxpbmVcbiAgICAgICAgICAgICAgICBsaW5lcy5hZGQoXG4gICAgICAgICAgICAgICAgICAgIGVsZW1lbnRIZWxwZXIuY3JlYXRlTGluZShcbiAgICAgICAgICAgICAgICAgICAgICAgIERvdWJsZVZlY3Rvcih4LCBoaW5nZSksXG4gICAgICAgICAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IoeCwgZmVuY2UpLFxuICAgICAgICAgICAgICAgICAgICAgICAgcFxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIC8vIGZlbmNlIGxpbmVcbiAgICAgICAgICAgICAgICAvKlxuICAgICAgICBsaW5lcy5hZGQoZWxlbWVudEhlbHBlci5jcmVhdGVMaW5lKFxuICAgICAgICAgICAgbmV3IERvdWJsZVZlY3Rvcih4IC0gaGFsZkZlbmNlV2lkdGgsIGZlbmNlKSxcbiAgICAgICAgICAgIG5ldyBEb3VibGVWZWN0b3IoeCArIGhhbGZGZW5jZVdpZHRoLCBmZW5jZSksXG4gICAgICAgICAgICBwKSk7XG4gICAgICAgICovXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIHVwcGVyIHdoaXNrZXJcbiAgICAgICAgICAgIGlmIChwLmRlZmluZWQoQWVzLlVQUEVSKSAmJiBwLmRlZmluZWQoQWVzLllNQVgpKSB7XG4gICAgICAgICAgICAgICAgdmFsIGhpbmdlID0gcC51cHBlcigpISFcbiAgICAgICAgICAgICAgICB2YWwgZmVuY2UgPSBwLnltYXgoKSEhXG4gICAgICAgICAgICAgICAgLy8gd2hpc2tlciBsaW5lXG4gICAgICAgICAgICAgICAgbGluZXMuYWRkKFxuICAgICAgICAgICAgICAgICAgICBlbGVtZW50SGVscGVyLmNyZWF0ZUxpbmUoXG4gICAgICAgICAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IoeCwgaGluZ2UpLFxuICAgICAgICAgICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHgsIGZlbmNlKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAvLyBmZW5jZSBsaW5lXG4gICAgICAgICAgICAgICAgLypcbiAgICAgICAgbGluZXMuYWRkKGVsZW1lbnRIZWxwZXIuY3JlYXRlTGluZShcbiAgICAgICAgICAgIG5ldyBEb3VibGVWZWN0b3IoeCAtIGhhbGZGZW5jZVdpZHRoLCBmZW5jZSksXG4gICAgICAgICAgICBuZXcgRG91YmxlVmVjdG9yKHggKyBoYWxmRmVuY2VXaWR0aCwgZmVuY2UpLFxuICAgICAgICAgICAgcCkpO1xuICAgICAgICAqL1xuXG4gICAgICAgICAgICAgICAgbGluZXMuZm9yRWFjaCB7IHJvb3QuYWRkKGl0KSB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBidWlsZE91dGxpZXJzKFxuICAgICAgICByb290OiBTdmdSb290LFxuICAgICAgICBhZXN0aGV0aWNzOiBBZXN0aGV0aWNzLFxuICAgICAgICBwb3M6IFBvc2l0aW9uQWRqdXN0bWVudCxcbiAgICAgICAgY29vcmQ6IENvb3JkaW5hdGVTeXN0ZW0sXG4gICAgICAgIGN0eDogR2VvbUNvbnRleHRcbiAgICApIHtcbiAgICAgICAgdmFsIG91dGxpZXJBZXN0aGV0aWNzID0gZ2V0T3V0bGllcnNBZXN0aGV0aWNzKGFlc3RoZXRpY3MpXG4gICAgICAgIFBvaW50R2VvbSgpXG4gICAgICAgICAgICAuYnVpbGRJbnRlcm4ocm9vdCwgb3V0bGllckFlc3RoZXRpY3MsIHBvcywgY29vcmQsIGN0eC53aXRoVGFyZ2V0Q29sbGVjdG9yKE51bGxHZW9tVGFyZ2V0Q29sbGVjdG9yKCkpKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGdldE91dGxpZXJzQWVzdGhldGljcyhhZXN0aGV0aWNzOiBBZXN0aGV0aWNzKTogQWVzdGhldGljcyB7XG4gICAgICAgIHJldHVybiBNYXBwZWRBZXN0aGV0aWN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mRGYWN0b3J5KHRydWUpXG4gICAgICAgIHByaXZhdGUgdmFsIE9VVExJRVJfREVGX1NJWkUgPSBBZXN0aGV0aWNzRGVmYXVsdHMucG9pbnQoKS5kZWZhdWx0VmFsdWUoQWVzLlNJWkUpXG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gcmVjdGFuZ2xlQnlEYXRhUG9pbnQoY3R4OiBHZW9tQ29udGV4dCk6IChEYXRhUG9pbnRBZXN0aGV0aWNzKSAtPiBEb3VibGVSZWN0YW5nbGU/IHtcbiAgICAgICAgICAgIHJldHVybiB7IHAgLT5cbiAgICAgICAgICAgICAgICBpZiAocC5kZWZpbmVkKEFlcy5YKSAmJlxuICAgICAgICAgICAgICAgICAgICBwLmRlZmluZWQoQWVzLkxPV0VSKSAmJlxuICAgICAgICAgICAgICAgICAgICBwLmRlZmluZWQoQWVzLlVQUEVSKSAmJlxuICAgICAgICAgICAgICAgICAgICBwLmRlZmluZWQoQWVzLldJRFRIKVxuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgeCA9IHAueCgpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIGxvd2VyID0gcC5sb3dlcigpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIHVwcGVyID0gcC51cHBlcigpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIHdpZHRoID0gR2VvbVV0aWwud2lkdGhQeChwLCBjdHgsIDIuMClcblxuICAgICAgICAgICAgICAgICAgICB2YWwgb3JpZ2luID0gRG91YmxlVmVjdG9yKHggLSB3aWR0aCAvIDIsIGxvd2VyKVxuICAgICAgICAgICAgICAgICAgICB2YWwgZGltZW5zaW9ucyA9IERvdWJsZVZlY3Rvcih3aWR0aCwgdXBwZXIgLSBsb3dlcilcbiAgICAgICAgICAgICAgICAgICAgRG91YmxlUmVjdGFuZ2xlKG9yaWdpbiwgZGltZW5zaW9ucylcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICA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U19HUk9VUFMgPSBmYWxzZVxuXG4gICAgICAgIHByaXZhdGUgdmFsIExFR0VORF9GQUNUT1JZID0gQ3Jvc3NCYXJIZWxwZXIubGVnZW5kRmFjdG9yeShmYWxzZSlcblxuICAgICAgICBwcml2YXRlIGZ1biByZWN0YW5nbGVCeURhdGFQb2ludChcbiAgICAgICAgICAgIGN0eDogR2VvbUNvbnRleHQsXG4gICAgICAgICAgICBpc0hpbnRSZWN0OiBCb29sZWFuXG4gICAgICAgICk6IChEYXRhUG9pbnRBZXN0aGV0aWNzKSAtPiBEb3VibGVSZWN0YW5nbGU/IHtcbiAgICAgICAgICAgIHJldHVybiB7IHAgLT5cbiAgICAgICAgICAgICAgICBpZiAoIWlzSGludFJlY3QgJiZcbiAgICAgICAgICAgICAgICAgICAgcC5kZWZpbmVkKEFlcy5YKSAmJlxuICAgICAgICAgICAgICAgICAgICBwLmRlZmluZWQoQWVzLllNSU4pICYmXG4gICAgICAgICAgICAgICAgICAgIHAuZGVmaW5lZChBZXMuWU1BWCkgJiZcbiAgICAgICAgICAgICAgICAgICAgcC5kZWZpbmVkKEFlcy5XSURUSClcbiAgICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHggPSBwLngoKSEhXG4gICAgICAgICAgICAgICAgICAgIHZhbCB5bWluID0gcC55bWluKCkhIVxuICAgICAgICAgICAgICAgICAgICB2YWwgeW1heCA9IHAueW1heCgpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIHdpZHRoID0gR2VvbVV0aWwud2lkdGhQeChwLCBjdHgsIDIuMClcblxuICAgICAgICAgICAgICAgICAgICB2YWwgb3JpZ2luID0gRG91YmxlVmVjdG9yKHggLSB3aWR0aCAvIDIsIHltaW4pXG4gICAgICAgICAgICAgICAgICAgIHZhbCBkaW1lbnNpb25zID0gRG91YmxlVmVjdG9yKHdpZHRoLCB5bWF4IC0geW1pbilcbiAgICAgICAgICAgICAgICAgICAgRG91YmxlUmVjdGFuZ2xlKG9yaWdpbiwgZGltZW5zaW9ucylcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlzSGludFJlY3QgJiZcbiAgICAgICAgICAgICAgICAgICAgcC5kZWZpbmVkKEFlcy5YKSAmJlxuICAgICAgICAgICAgICAgICAgICBwLmRlZmluZWQoQWVzLk1JRERMRSlcbiAgICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHggPSBwLngoKSEhXG4gICAgICAgICAgICAgICAgICAgIHZhbCBtaWRkbGUgPSBwLm1pZGRsZSgpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIHdpZHRoID0gR2VvbVV0aWwud2lkdGhQeChwLCBjdHgsIDIuMClcblxuICAgICAgICAgICAgICAgICAgICB2YWwgb3JpZ2luID0gRG91YmxlVmVjdG9yKHggLSB3aWR0aCAvIDIsIG1pZGRsZSlcbiAgICAgICAgICAgICAgICAgICAgdmFsIGRpbWVuc2lvbnMgPSBEb3VibGVWZWN0b3Iod2lkdGgsIDAuMClcbiAgICAgICAgICAgICAgICAgICAgRG91YmxlUmVjdGFuZ2xlKG9yaWdpbiwgZGltZW5zaW9ucylcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBudWxsXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5iYXNlLmdlb21cblxuY2xhc3MgRGVuc2l0eTJkR2VvbSA6IENvbnRvdXJHZW9tKCkge1xuICAgIGNvbXBhbmlvbiBvY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BkYXRhUG9pbnRzKSB7XG4gICAgICAgICAgICB2YWwgeCA9IHAueCgpXG4gICAgICAgICAgICB2YWwgeW1pbiA9IHAueW1pbigpXG4gICAgICAgICAgICB2YWwgeW1heCA9IHAueW1heCgpXG4gICAgICAgICAgICBpZiAoIVNlcmllc1V0aWwuYWxsRmluaXRlKHgsIHltaW4sIHltYXgpKSB7XG4gICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciB3aWR0aCA9IHAud2lkdGgoKSEhXG4gICAgICAgICAgICB3aWR0aCAqPSBjdHguZ2V0UmVzb2x1dGlvbihBZXMuWClcbiAgICAgICAgICAgIHZhbCBoZWlnaHQgPSB5bWF4ISEgLSB5bWluISFcblxuICAgICAgICAgICAgdmFsIHIgPSBEb3VibGVSZWN0YW5nbGUoeCEhIC0gd2lkdGggLyAyLCB5bWluLCB3aWR0aCwgaGVpZ2h0KVxuXG4gICAgICAgICAgICB2YWwgZyA9IGVycm9yQmFyU2hhcGUoXG4gICAgICAgICAgICAgICAgaGVscGVyLnRvQ2xpZW50KFxuICAgICAgICAgICAgICAgICAgICByLFxuICAgICAgICAgICAgICAgICAgICBwXG4gICAgICAgICAgICAgICAgKSwgcFxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgcm9vdC5hZGQoZylcblxuICAgICAgICAgICAgYnVpbGRIaW50cyhcbiAgICAgICAgICAgICAgICBEb3VibGVSZWN0YW5nbGUoci5sZWZ0LCByLmNlbnRlci55LCByLndpZHRoLCAwLjApLFxuICAgICAgICAgICAgICAgIHAsXG4gICAgICAgICAgICAgICAgY3R4LFxuICAgICAgICAgICAgICAgIGdlb21IZWxwZXJcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGJ1aWxkSGludHMocmVjdDogRG91YmxlUmVjdGFuZ2xlLCBwOiBEYXRhUG9pbnRBZXN0aGV0aWNzLCBjdHg6IEdlb21Db250ZXh0LCBnZW9tSGVscGVyOiBHZW9tSGVscGVyKSB7XG4gICAgICAgIHZhbCBjbGllbnRSZWN0ID0gZ2VvbUhlbHBlci50b0NsaWVudChyZWN0LCBwKVxuXG4gICAgICAgIHZhbCBoaW50ID0gSGludENvbmZpZ0ZhY3RvcnkoKVxuICAgICAgICAgICAgLmRlZmF1bHRPYmplY3RSYWRpdXMoY2xpZW50UmVjdC53aWR0aCAvIDIuMClcbiAgICAgICAgICAgIC5kZWZhdWx0WChwLngoKSEhKVxuICAgICAgICAgICAgLmRlZmF1bHRLaW5kKEhPUklaT05UQUxfVE9PTFRJUClcblxuICAgICAgICB2YWwgaGludHMgPSBIaW50c0NvbGxlY3Rpb24ocCwgZ2VvbUhlbHBlcilcbiAgICAgICAgICAgIC5hZGRIaW50KGhpbnQuY3JlYXRlKEFlcy5ZTUFYKSlcbiAgICAgICAgICAgIC5hZGRIaW50KGhpbnQuY3JlYXRlKEFlcy5ZTUlOKSlcbiAgICAgICAgICAgIC5oaW50c1xuXG4gICAgICAgIGN0eC50YXJnZXRDb2xsZWN0b3IuYWRkUmVjdGFuZ2xlKFxuICAgICAgICAgICAgcC5pbmRleCgpLCBjbGllbnRSZWN0LFxuICAgICAgICAgICAgcGFyYW1zKClcbiAgICAgICAgICAgICAgICAuc2V0VGlwTGF5b3V0SGludHMoaGludHMpXG4gICAgICAgICAgICAgICAgLnNldENvbG9yKGZyb21Db2xvcihwKSlcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgTXlMZWdlbmRLZXlFbGVtZW50RmFjdG9yeSA6XG4gICAgICAgIExlZ2VuZEtleUVsZW1lbnRGYWN0b3J5IHtcblxuICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlS2V5RWxlbWVudChwOiBEYXRhUG9pbnRBZXN0aGV0aWNzLCBzaXplOiBEb3VibGVWZWN0b3IpOiBTdmdHRWxlbWVudCB7XG4gICAgICAgICAgICB2YWwgc3Ryb2tlV2lkdGggPSBBZXNTY2FsaW5nLnN0cm9rZVdpZHRoKHApXG5cbiAgICAgICAgICAgIHZhbCB3aWR0aCA9IHAud2lkdGgoKSEhICogKHNpemUueCAtIHN0cm9rZVdpZHRoKVxuICAgICAgICAgICAgdmFsIGhlaWdodCA9IHNpemUueSAtIHN0cm9rZVdpZHRoXG4gICAgICAgICAgICB2YWwgeCA9IChzaXplLnggLSB3aWR0aCkgLyAyXG4gICAgICAgICAgICB2YWwgeSA9IHN0cm9rZVdpZHRoIC8gMlxuICAgICAgICAgICAgcmV0dXJuIGVycm9yQmFyU2hhcGUoXG4gICAgICAgICAgICAgICAgRG91YmxlUmVjdGFuZ2xlKFxuICAgICAgICAgICAgICAgICAgICB4LFxuICAgICAgICAgICAgICAgICAgICB5LFxuICAgICAgICAgICAgICAgICAgICB3aWR0aCxcbiAgICAgICAgICAgICAgICAgICAgaGVpZ2h0XG4gICAgICAgICAgICAgICAgKSwgcFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGNvbnN0IHZhbCBIQU5ETEVTX0dST1VQUyA9IGZhbHNlXG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZXJyb3JCYXJTaGFwZShyOiBEb3VibGVSZWN0YW5nbGUsIHA6IERhdGFQb2ludEFlc3RoZXRpY3MpOiBTdmdHRWxlbWVudCB7XG4gICAgICAgICAgICB2YWwgbGVmdCA9IHIubGVmdFxuICAgICAgICAgICAgdmFsIHRvcCA9IHIudG9wXG4gICAgICAgICAgICB2YWwgcmlnaHQgPSByLnJpZ2h0XG4gICAgICAgICAgICB2YWwgYm90dG9tID0gci5ib3R0b21cbiAgICAgICAgICAgIHZhbCBjZW50ZXIgPSBsZWZ0ICsgci53aWR0aCAvIDJcbiAgICAgICAgICAgIHZhbCBzaGFwZUxpbmVzID0gQXJyYXlMaXN0PFN2Z0xpbmVFbGVtZW50PigpXG4gICAgICAgICAgICBzaGFwZUxpbmV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XBhbmlvbiBvYmplY3Qge1xuICAgICAgICBmdW4gd3JhcChzbGltR3JvdXA6IFN2Z1NsaW1Hcm91cCk6IFN2Z0dFbGVtZW50IHtcbiAgICAgICAgICAgIHZhbCBnID0gU3ZnR0VsZW1lbnQoKVxuICAgICAgICAgICAgZy5pc1ByZWJ1aWx0U3VidHJlZSA9IHRydWVcbiAgICAgICAgICAgIGcuY2hpbGRyZW4oKS5hZGQoc2xpbUdyb3VwLmFzRHVtbXlTdmdOb2RlKCkpXG4gICAgICAgICAgICByZXR1cm4gZ1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHdyYXAobzogU3ZnU2xpbU9iamVjdCk6IFN2Z0dFbGVtZW50IHtcbiAgICAgICAgICAgIHZhbCBzbGltR3JvdXAgPSBTdmdTbGltRWxlbWVudHMuZygxKVxuICAgICAgICAgICAgby5hcHBlbmRUbyhzbGltR3JvdXApXG4gICAgICAgICAgICByZXR1cm4gd3JhcChzbGltR3JvdXApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYWVzVmlld1BvcnQoYWVzdGhldGljczogQWVzdGhldGljcyk6IERvdWJsZVJlY3RhbmdsZSB7XG4gICAgICAgICAgICByZXR1cm4gcmVjdChcbiAgICAgICAgICAgICAgICBhZXN0aGV0aWNzLm92ZXJhbGxSYW5nZShBZXMuWCksXG4gICAgICAgICAgICAgICAgYWVzdGhldGljcy5vdmVyYWxsUmFuZ2UoQWVzLlkpXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYWVzQm91bmRpbmdCb3goYWVzdGhldGljczogQWVzdGhldGljcyk6IERvdWJsZVJlY3RhbmdsZSB7XG4gICAgICAgICAgICByZXR1cm4gcmVjdChcbiAgICAgICAgICAgICAgICBhZXN0aGV0aWNzLnJhbmdlKEFlcy5YKSEhLFxuICAgICAgICAgICAgICAgIGFlc3RoZXRpY3MucmFuZ2UoQWVzLlkpISFcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICA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5kID0gRG91YmxlVmVjdG9yKHZpZXdQb3J0LnJpZ2h0LCBpbnRlcmNlcHQpXG4gICAgICAgICAgICAgICAgICAgIHZhbCBsaW5lID0gaGVscGVyLmNyZWF0ZUxpbmUoc3RhcnQsIGVuZCwgcClcbiAgICAgICAgICAgICAgICAgICAgbGluZXMuYWRkKGxpbmUpXG5cbiAgICAgICAgICAgICAgICAgICAgdmFsIGggPSBBZXNTY2FsaW5nLnN0cm9rZVdpZHRoKHApXG4gICAgICAgICAgICAgICAgICAgIHZhbCBvcmlnaW4gPSBEb3VibGVWZWN0b3Ioc3RhcnQueCwgaW50ZXJjZXB0IC0gaC8yIC0gMi4wKVxuICAgICAgICAgICAgICAgICAgICB2YWwgZGltZW5zaW9ucyA9IERvdWJsZVZlY3Rvcih2aWV3UG9ydC5kaW1lbnNpb24ueCwgaCArIDQuMClcbiAgICAgICAgICAgICAgICAgICAgdmFsIHJlY3QgPSBEb3VibGVSZWN0YW5nbGUob3JpZ2luLCBkaW1lbnNpb25zKVxuICAgICAgICAgICAgICAgICAgICBjdHgudGFyZ2V0Q29sbGVjdG9yLmFkZFJlY3RhbmdsZShcbiAgICAgICAgICAgICAgICAgICAgICAgIHAuaW5kZXgoKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGdlb21IZWxwZXIudG9DbGllbnQocmVjdCwgcCksXG4gICAgICAgICAgICAgICAgICAgICAgICBHZW9tVGFyZ2V0Q29sbGVjdG9yLlRvb2x0aXBQYXJhbXMucGFyYW1zKClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0Q29sb3IoSGludENvbG9yVXRpbC5mcm9tQ29sb3IocCkpLFxuICAgICAgICAgICAgICAgICAgICAgICAgVGlwTGF5b3V0SGludC5LaW5kLkNVUlNPUl9UT09MVElQXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBsaW5lcy5mb3JFYWNoIHsgc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W50LFxuICAgICAgICBjb29yZDogQ29vcmRpbmF0ZVN5c3RlbSxcbiAgICAgICAgY3R4OiBHZW9tQ29udGV4dFxuICAgICkge1xuICAgICAgICB2YWwgZ2VvbUhlbHBlciA9IEdlb21IZWxwZXIocG9zLCBjb29yZCwgY3R4KVxuICAgICAgICB2YWwgaGVscGVyID0gZ2VvbUhlbHBlci5jcmVhdGVTdmdFbGVtZW50SGVscGVyKClcblxuICAgICAgICBmb3IgKHAgaW4gR2VvbVV0aWwud2l0aERlZmluZWQoYWVzdGhldGljcy5kYXRhUG9pbnRzKCksIEFlcy5YLCBBZXMuWU1JTiwgQWVzLllNQVgpKSB7XG4gICAgICAgICAgICB2YWwgeCA9IHAueCgpISFcbiAgICAgICAgICAgIHZhbCB5bWluID0gcC55bWluKCkhIVxuICAgICAgICAgICAgdmFsIHltYXggPSBwLnltYXgoKSEhXG5cbiAgICAgICAgICAgIHZhbCBzdGFydCA9IERvdWJsZVZlY3Rvcih4LCB5bWluKVxuICAgICAgICAgICAgdmFsIGVuZCA9IERvdWJsZVZlY3Rvcih4LCB5bWF4KVxuICAgICAgICAgICAgdmFsIGxpbmUgPSBoZWxwZXIuY3JlYXRlTGluZShzdGFydCwgZW5kLCBwKVxuICAgICAgICAgICAgcm9vdC5hZGQobGluZSlcbiAgICAgICAgfVxuXG4gICAgICAgIEJhclRvb2x0aXBIZWxwZXIuY29sbGVjdFJlY3RhbmdsZVRhcmdldHMoXG4gICAgICAgICAgICBsaXN0T2YoQWVzLllNQVgsIEFlcy5ZTUlOKSxcbiAgICAgICAgICAgIGFlc3RoZXRpY3MsIHBvcywgY29vcmQsIGN0eCxcbiAgICAgICAgICAgIHJlY3RhbmdsZUJ5RGF0YVBvaW50KCksXG4gICAgICAgICAgICB7IEhpbnRDb2xvclV0aWwuZnJvbUNvbG9yKGl0KSB9XG4gICAgICAgIClcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgY29uc3QgdmFsIEhBTkRMRVNfR1JPVVBTID0gZmFsc2VcblxuICAgICAgICBmdW4gcmVjdGFuZ2xlQnlEYXRhUG9pbnQoKTogKERhdGFQb2ludEFlc3RoZXRpY3MpIC0+IERvdWJsZVJlY3RhbmdsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIHsgcCAtPlxuICAgICAgICAgICAgICAgIGlmIChwLmRlZmluZWQoQWVzLlgpICYmXG4gICAgICAgICAgICAgICAgICAgIHAuZGVmaW5lZChBZXMuWU1JTikgJiZcbiAgICAgICAgICAgICAgICAgICAgcC5kZWZpbmVkKEFlcy5ZTUFYKVxuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgeCA9IHAueCgpISFcbiAgICAgICAgICAgICAgICAgICAgdmFsIHltaW4gPSBwLnltaW4oKSEhXG4gICAgICAgICAgICAgICAgICAgIHZhbCB5bWF4ID0gcC55bWF4KCkhIVxuICAgICAgICAgICAgICAgICAgICB2YWwgd2lkdGggPSBtYXgoQWVzU2NhbGluZy5zdHJva2VXaWR0aChwKSwgMi4wKSAqIDIuMFxuICAgICAgICAgICAgICAgICAgICB2YWwgaGVpZ2h0ID0geW1heCAtIHltaW5cblxuICAgICAgICAgICAgICAgICAgICB2YWwgb3JpZ2luID0gRG91YmxlVmVjdG9yKHggLSB3aWR0aCAvIDIsIHltYXggLSBoZWlnaHQgLyAyKVxuICAgICAgICAgICAgICAgICAgICB2YWwgZGltZW5zaW9ucyA9IERvdWJsZVZlY3Rvcih3aWR0aCwgMC4wIClcbiAgICAgICAgICAgICAgICAgICAgRG91YmxlUmVjdGFuZ2xlKG9yaWdpbiwgZGltZW5zaW9ucylcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBudWxsXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5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iBmdW4gZGF0YVBvaW50cyhhZXN0aGV0aWNzOiBBZXN0aGV0aWNzKTogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz4ge1xuICAgICAgICByZXR1cm4gR2VvbVV0aWwud2l0aF9YX1koYWVzdGhldGljcy5kYXRhUG9pbnRzKCkpXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGJ1aWxkSW50ZXJuKFxuICAgICAgICByb290OiBTdmdSb290LFxuICAgICAgICBhZXN0aGV0aWNzOiBBZXN0aGV0aWNzLFxuICAgICAgICBwb3M6IFBvc2l0aW9uQWRqdXN0bWVudCxcbiAgICAgICAgY29vcmQ6IENvb3JkaW5hdGVTeXN0ZW0sXG4gICAgICAgIGN0eDogR2VvbUNvbnRleHRcbiAgICApIHtcblxuICAgICAgICB2YWwgZGF0YVBvaW50cyA9IGRhdGFQb2ludHMoYWVzdGhldGljcylcbiAgICAgICAgdmFsIHRhcmdldENvbGxlY3RvciA9IGdldEdlb21UYXJnZXRDb2xsZWN0b3IoY3R4KVxuICAgICAgICB2YWwgbGluZXNIZWxwZXIgPSBMaW5lc0hlbHBlcihwb3MsIGNvb3JkLCBjdHgpXG5cbiAgICAgICAgdmFsIGdlb21Db25zdHJ1Y3RvciA9IExpbmVQYXRoQ29uc3RydWN0b3IoXG4gICAgICAgICAgICB0YXJnZXRDb2xsZWN0b3IsXG4gICAgICAgICAgICBkYXRhUG9pbnRzLFxuICAgICAgICAgICAgbGluZXNIZWxwZXIsXG4gICAgICAgICAgICBmYWxzZVxuICAgICAgICApXG4gICAgICAgIGFwcGVuZE5vZGVzKFxuICAgICAgICAgICAgZ2VvbUNvbnN0cnVjdG9yLmNvbnN0cnVjdCh3aXRoSGludHMgPSBmYWxzZSksXG4gICAgICAgICAgICByb290XG4gICAgICAgIClcbiAgICAgICAgYnVpbGRIaW50cyhhZXN0aGV0aWNzLCBjb29yZCwgbGluZXNIZWxwZXIsIHRhcmdldENvbGxlY3RvcilcbiAgICB9XG5c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BhbmdsZVxuXG4gICAgICAgICAgICAgICAgdmFsIHBhdGggPSBMaW5lUGF0aChidWlsZGVyKVxuICAgICAgICAgICAgICAgIGRlY29yYXRlKHBhdGgsIHAsIHRydWUpXG4gICAgICAgICAgICAgICAgcmVzdWx0LmFkZChwYXRoKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgdmFsIFJFTkRFUlMgPSBsaXN0T2YoXG4gICAgICAgICAgICAgICAgQWVzLlgsIC8vIG9wdGlvbmFsLCBjYW4gc3BlY2lmeSBvcmRlciBvZiBzZWdtZW50cyBpbiBwaWVcbiAgICAgICAgICAgICAgICBBZXMuWSwgLy8gYW5nbGUgd2lkdGggb2Ygc2VnbWVudHNcbiAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4gICAgICAgICAgICAgICAgQWVzLkZJTEwsXG4gICAgICAgICAgICAgICAgQWVzLkFMUEhBLFxuICAgICAgICAgICAgICAgIEFlcy5XSURUSCxcbiAgICAgICAgICAgICAgICBBZXMuU0laRVxuICAgICAgICApXG5cbiAgICAgICAgY29uc3QgdmFsIEhBTkRMRVNfR1JPVVBTID0gZmFsc2VcblxuICAgICAgICBwcml2YXRlIGZ1biBkYXRhUG9pbnRzKGFlc3RoZXRpY3M6IEFlc3RoZXRpY3MpOiBJdGVyYWJsZTxEYXRhUG9pbnRBZXN0aGV0aWNzPiB7XG4gICAgICAgICAgICB2YWwgd2l0aFggPSBHZW9tVXRpbC53aXRoX1hfWShhZXN0aGV0aWNzLmRhdGFQb2ludHMoKSlcbiAgICAgICAgICAgIHJldHVybiBpZiAoSXRlcmFibGVzLmlzRW1wdHkod2l0aFgpIHx8IGFsbEVxdWFsWChcbiAgICAgICAgICAgICAgICAgICAgd2l0aFgsXG4gICAgICAgICAgICAgICAgICAgIGdldCh3aXRoWCwgMCkueCgpXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgR2VvbVV0aWwub3JkZXJlZF9ZKEdlb21VdGlsLndpdGhfWShhZXN0aGV0aWNzLmRhdGFQb2ludHMoKSksIHRydWUpXG4gICAgICAgICAgICB9IGVsc2UgR2VvbVV0aWwub3JkZXJlZF9YKHdpdGhYKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gYWxsRXF1YWxYKGhhc1g6IEl0ZXJhYmxlPERhdGFQb2ludEFlc3RoZXRpY3M+LCBgdmFsYDogRG91YmxlPyk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgZm9yIChwIGluIGhhc1gpIHtcbiAgICAgICAgICAgICAgICBpZiAocC54KCkgIT0gYHZhbGApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRydWVcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHNoYXJlVG9SYWQoc2hhcmU6IERvdWJsZSk6IERvdWJsZSB7XG4gICAgICAgICAgICAvLyBkb24ndCBhbGxvdyBzdW0gdG8gYmUgbW9yZSB0aGFuIDk5Ljk5ICUgb2YgZnVsbCBjaXJjbGUgKG90aGVyd2lzZSBhcmMgd2lsbCBkaXNhcHBlYXIpXG4gICAgICAgICAgICByZXR1cm4gMC45OTk5ICogMi4wICogUEkgKiBzaGFyZVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0Y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0eDogR2VvbUNvbnRleHRcbiAgICApIHtcbiAgICAgICAgdmFsIGhlbHBlciA9IEdlb21IZWxwZXIocG9zLCBjb29yZCwgY3R4KVxuICAgICAgICB2YWwgdGFyZ2V0Q29sbGVjdG9yID0gZ2V0R2VvbVRhcmdldENvbGxlY3RvcihjdHgpXG5cbiAgICAgICAgdmFsIGNvdW50ID0gYWVzdGhldGljcy5kYXRhUG9pbnRDb3VudCgpXG4gICAgICAgIHZhbCBzbGltR3JvdXAgPSBTdmdTbGltRWxlbWVudHMuZyhjb3VudClcbiAgICAgICAgdmFsIHNpemVVbml0UmF0aW8gPSBnZXRTaXplVW5pdFJhdGlvKGN0eClcblxuICAgICAgICBmb3IgKGkgaW4gMCB1bnRpbCBjb3VudCkge1xuICAgICAgICAgICAgdmFsIHAgPSBhZXN0aGV0aWNzLmRhdGFQb2ludEF0KGkpXG4gICAgICAgICAgICB2YWwgeCA9IHAueCgpXG4gICAgICAgICAgICB2YWwgeSA9IHAueSgpXG5cbiAgICAgICAgICAgIGlmIChTZXJpZXNVdGlsLmFsbEZpbml0ZSh4LCB5KSkge1xuICAgICAgICAgICAgICAgIHZhbCBsb2NhdGlvbiA9IGhlbHBlci50b0NsaWVudChEb3VibGVWZWN0b3IoeCEhLCB5ISEpLCBwKVxuXG4gICAgICAgICAgICAgICAgdmFsIHNoYXBlID0gcC5zaGFwZSgpISFcblxuICAgICAgICAgICAgICAgIHRhcmdldENvbGxlY3Rvci5hZGRQb2ludChcbiAgICAgICAgICAgICAgICAgICAgaSwgbG9jYXRpb24sIHNpemVVbml0UmF0aW8gKiBzaGFwZS5zaXplKHApIC8gMixcbiAgICAgICAgICAgICAgICAgICAgdG9vbHRpcFBhcmFtcyhwKVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB2YWwgbyA9IFBvaW50U2hhcGVTdmcuY3JlYXRlKHNoYXBlLCBsb2NhdGlvbiwgcCwgc2l6ZVVuaXRSYXRpbylcbiAgICAgICAgICAgICAg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AgICAgdmFsIHltaW4gPSBwLnltaW4oKSEhXG4gICAgICAgICAgICB2YWwgeW1heCA9IHAueW1heCgpISFcblxuICAgICAgICAgICAgLy8gdmVydGljYWwgbGluZVxuICAgICAgICAgICAgdmFsIHN0YXJ0ID0gRG91YmxlVmVjdG9yKHgsIHltaW4pXG4gICAgICAgICAgICB2YWwgZW5kID0gRG91YmxlVmVjdG9yKHgsIHltYXgpXG4gICAgICAgICAgICB2YWwgbGluZSA9IGhlbHBlci5jcmVhdGVMaW5lKHN0YXJ0LCBlbmQsIHApXG4gICAgICAgICAgICByb290LmFkZChsaW5lKVxuXG4gICAgICAgICAgICAvLyBtaWQtcG9pbnRcbiAgICAgICAgICAgIHZhbCBsb2NhdGlvbiA9IGdlb21IZWxwZXIudG9DbGllbnQoRG91YmxlVmVjdG9yKHgsIHkpLCBwKVxuICAgICAgICAgICAgdmFsIHNoYXBlID0gcC5zaGFwZSgpISFcbiAgICAgICAgICAgIHZhbCBvID0gUG9pbnRTaGFwZVN2Zy5jcmVhdGUoc2hhcGUsIGxvY2F0aW9uLCBwLCBmYXR0ZW5NaWRQb2ludClcbiAgICAgICAgICAgIHJvb3QuYWRkKHdyYXAobykpXG4vLyAgICAgICAgICAgIGN0eC50YXJnZXRDb2xsZWN0b3IuYWRkUG9pbnQoXG4vLyAgICAgICAgICAgICAgICBwLmluZGV4KCksXG4vLyAgICAgICAgICAgICAgICBsb2NhdGlvbixcbi8vICAgICAgICAgICAgICAgIHNoYXBlLnNpemUocCkgKiBmYXR0ZW5NaWRsaW5lIC8gMixcbi8vICAgICAgICAgICAgICAgIFBvaW50R2VvbS50b29sdGlwUGFyYW1zKHApXG4vLyAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIEJhclRvb2x0aXBIZWxwZXIuY29sbGVjdFJlY3RhbmdsZVRhcmdldHMoXG4gICAgICAgICAgICBsaXN0T2YoQWVzLllNQVgsIEFlcy5ZTUlOKSxcbiAgICAgICAgICAgIGFlc3RoZXRpY3MsIHBvcywgY29vcmQsIGN0eCxcbiAgICAgICAgICAgIHJlY3RhbmdsZUJ5RGF0YVBvaW50KGZhdHRlbk1pZFBvaW50KSxcbiAgICAgICAgICAgIHsgSGludENvbG9yVXRpbC5mcm9tQ29sb3IoaXQpIH1cbiAgICAgICAgKVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBjb25zdCB2YWwgSEFORExFU19HUk9VUFMgPSBmYWxzZVxuXG4gICAgICAgIGNvbnN0IHZhbCBERUZfRkFUVEVOID0gNS4wXG5cbiAgICAgICAgZnVuIHJlY3RhbmdsZUJ5RGF0YVBvaW50KGZhdHRlbjogRG91YmxlKTogKERhdGFQb2ludEFlc3RoZXRpY3MpIC0+IERvdWJsZVJlY3RhbmdsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIHsgcCAtPlxuICAgICAgICAgICAgICAgIGlmIChwLmRlZmluZWQoQWVzLlgpICYmXG4gICAgICAgICAgICAgICAgICAgIHAuZGVmaW5lZChBZXMuWSlcbiAgICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHggPSBwLngoKSEhXG4gICAgICAgICAgICAgICAgICAgIHZhbCB5ID0gcC55KCkhIVxuXG4gICAgICAgICAgICAgICAgICAgIHZhbCBzaGFwZSA9IHAuc2hhcGUoKSEhXG4gICAgICAgICAgICAgICAgICAgIHZhbCBzaGFwZVNpemUgPSBzaGFwZS5zaXplKHApICogZmF0dGVuXG4gICAgICAgICAgICAgICAgICAgIHZhbCBzdHJva2VXaWR0aCA9IHNoYXBlLnN0cm9rZVdpZHRoKHApXG4gICAgICAgICAgICAgICAgICAgIHZhbCB3aWR0aCA9IHNoYXBlU2l6ZSArIHN0cm9rZVdpZHRoXG5cbiAgICAgICAgICAgICAgICAgICAgdmFsIG9yaWdpbiA9IERvdWJsZVZlY3Rvcih4IC0gd2lkdGggLyAyLCB5KVxuICAgICAgICAgICAgICAgICAgICB2YWwgZGlt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ICAgICAgIHZhbCBsYWJlbCA9IFRleHRMYWJlbChsaW5lKVxuICAgICAgICAgICAgICAgIGxhYmVsLnRleHRDb2xvcigpLnNldChDb2xvci5EQVJLX01BR0VOVEEpXG4gICAgICAgICAgICAgICAgbGFiZWwudGV4dE9wYWNpdHkoKS5zZXQoMC41KVxuICAgICAgICAgICAgICAgIGxhYmVsLnNldEZvbnRTaXplKGZvbnRTaXplKVxuICAgICAgICAgICAgICAgIGxhYmVsLnNldEZvbnRXZWlnaHQoXCJib2xkXCIpXG4gICAgICAgICAgICAgICAgbGFiZWwuc2V0SG9yaXpvbnRhbEFuY2hvcihIb3Jpem9udGFsQW5jaG9yLk1JRERMRSlcbiAgICAgICAgICAgICAgICBsYWJlbC5zZXRWZXJ0aWNhbEFuY2hvcihWZXJ0aWNhbEFuY2hvci5DRU5URVIpXG4gICAgICAgICAgICAgICAgdmFsIGxvYyA9IGhlbHBlci50b0NsaWVudChjZW50ZXIueCwgeSwgcmFuZG9tUClcbiAgICAgICAgICAgICAgICBsYWJlbC5tb3ZlVG8obG9jKVxuICAgICAgICAgICAgICAgIHJvb3QuYWRkKGxhYmVsLnJvb3RHcm91cClcbiAgICAgICAgICAgICAgICB5IC09IGxpbmVIZWlnaHRcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgY29scyA9IHJvdW5kKHdpZHRoKS50b0ludCgpXG4gICAgICAgIHZhbCByb3dzID0gcm91bmQoaGVpZ2h0KS50b0ludCgpXG5cbiAgICAgICAgLy8gdHJhbnNsYXRlIHRvIGNsaWVudCBjb29yZGluYXRlc1xuICAgICAgICAvLyBleHBhbmQgYm91bmRzIGJ5IDEvMiBzdGVwIGJlZm9yZSB0aGUgdHJhbnNsYXRpb24gdG8gYWRqdXN0IGZvciB0aGUgc2l6ZSBvZiAnaW1hZ2UgcGl4ZWwnXG4gICAgICAgIHZhbCBoYWxmU3RlcCA9IERvdWJsZVZlY3R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C0gKGNvbCArIDEpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChpbnZlcnRlZFkpIHtcbiAgICAgICAgICAgICAgICByb3cgPSByb3dzIC0gKHJvdyArIDEpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGFyZ2JWYWx1ZXNbcm93ICogY29scyArIGNvbF0gPSBTdmdVdGlscy50b0FSR0IoY29sb3IhISwgYWxwaGEhISlcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBiaXRtYXAgPSBCaXRtYXAoY29scywgcm93cywgYXJnYlZhbHVlcylcbiAgICAgICAgdmFsIHN2Z0ltYWdlRWxlbWVudCA9IFN2Z0ltYWdlRWxlbWVudEV4KFxuICAgICAgICAgICAgbWluKGNvcm5lcjAueCwgY29ybmVyMi54KSwgbWluKGNvcm5lcjAueSwgY29ybmVyMi55KSxcbiAgICAgICAgICAgIGFicyhjb3JuZXIwLnggLSBjb3JuZXIyLngpLCBhYnMoY29ybmVyMC55IC0gY29ybmVyMi55KSxcbiAgICAgICAgICAgIGJpdG1hcFxuICAgICAgICApXG4gICAgICAgIHJvb3QuYWRkKHN2Z0ltYWdlRWxlbWVudClcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbi8vICAgICAgICB2YWwgUkVOREVSUyA9IGxpc3RPZihcbi8vICAgICAgICAgICAgICAgIEFlcy5YLFxuLy8gICAgICAgICAgICAgICAgQWVzLlksXG4vLyAgICAgICAgICAgICAgICBBZXMuV0lEVEgsIC8vIG5vdCByZW5kZXJlZCBidXQgcmVxdWlyZWQgZm9yIGNvcnJlY3QgeCBhZXMgcmFuZ2UgY29tcHV0YXRpb25cbi8vICAgICAgICAgICAgICAgIEFlcy5IRUlHSFQsIC8vIC0tIHRoZSBzYW1lIC0tXG4vLyAgICAgICAgICAgICAgICBBZXMuRklMTCxcbi8vICAgICAgICAgICAgICAgIEFlcy5BTFBIQVxuLy8gICAgICAgIClcblxuICAgICAgICBjb25zdCB2Y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AgICAgQWVzLlNJWkUsXG4vLyAgICAgICAgICAgICAgICBBZXMuTElORVRZUEUsXG4vLyAgICAgICAgICAgICAgICBBZXMuQ09MT1IsXG4vLyAgICAgICAgICAgICAgICBBZXMuRklMTCxcbi8vICAgICAgICAgICAgICAgIEFlcy5BTFBIQSxcbi8vICAgICAgICApXG4gICAgICAgIC8vcmVjdGFuZ2xlIGdyb3VwcyBhcmUgdXNlZCBpbiBnZW9tX2xpdmVtYXBcbiAgICAgICAgY29uc3QgdmFsIEhBTkRMRVNfR1JPVVBTID0gdHJ1ZVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHJlY3RhbmdsZUJ5RGF0YVBvaW50KHA6IERhdGFQb2ludEFlc3RoZXRpY3MpOiBEb3VibGVSZWN0YW5nbGU/IHtcbiAgICAgICAgICAgIHZhbCB4bWluID0gcC54bWluKClcbiAgICAgICAgICAgIHZhbCB4bWF4ID0gcC54bWF4KClcbiAgICAgICAgICAgIHZhbCB5bWluID0gcC55bWluKClcbiAgICAgICAgICAgIHZhbCB5bWF4ID0gcC55bWF4KClcbiAgICAgICAgICAgIHJldHVybiBpZiAoU2VyaWVzVXRpbC5hbGxGaW5pdGUoeG1pbiwgeG1heCwgeW1pbiwgeW1heCkpIHtcbiAgICAgICAgICAgICAgICBEb3VibGVSZWN0YW5nbGUuc3BhbihEb3VibGVWZWN0b3IoeG1pbiEhLCB5bWluISEpLCBEb3VibGVWZWN0b3IoeG1heCEhLCB5bWF4ISEpKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgbnVsbFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGlu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pXG4gICAgICAgICAgICAgICAgLmRlZmF1bHRPYmplY3RSYWRpdXMoMC4wKVxuICAgICAgICAgICAgICAgIC5kZWZhdWx0WChwLngoKSEhKVxuICAgICAgICAgICAgICAgIC5kZWZhdWx0S2luZChUaXBMYXlvdXRIaW50LktpbmQuSE9SSVpPTlRBTF9UT09MVElQKVxuICAgICAgICAgICAgICAgIC5kZWZhdWx0Q29sb3IoXG4gICAgICAgICAgICAgICAgICAgIHAuZmlsbCgpISEsXG4gICAgICAgICAgICAgICAgICAgIGFscGhhID0gbnVsbFxuICAgICAgICAgICAgICAgIClcblxuICAgICAgICAgICAgdmFsIGhpbnRzQ29sbGVjdGlvbiA9IEhpbnRzQ29sbGVjdGlvbihwLCBoZWxwZXIpXG4gICAgICAgICAgICAgICAgLmFkZEhpbnQoaGludC5jcmVhdGUoQWVzLllNQVgpKVxuICAgICAgICAgICAgICAgIC5hZGRIaW50KGhpbnQuY3JlYXRlKEFlcy5ZTUlOKSlcblxuICAgICAgICAgICAgY29sbGVjdG9yLmFkZFBvaW50KFxuICAgICAgICAgICAgICAgIHAuaW5kZXgoKSxcbiAgICAgICAgICAgICAgICBoZWxwZXIudG9DbGllbnQoY29vcmQsIHApLFxuICAgICAgICAgICAgICAgIDAuMCxcbiAgICAgICAgICAgICAgICBwYXJhbXMoKS5zZXRUaXBMYXlvdXRIaW50cyhoaW50c0NvbGxlY3Rpb24uaGludHMpXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbi8vICAgICAgICB2YWwgUkVOREVSUyA9IGxpc3RPZihcbi8vICAgICAgICAgICAgICAgIEFlcy5YLFxuLy8gICAgICAgICAgICAgICAgQWVzLllNSU4sXG4vLyAgICAgICAgICAgICAgICBBZXMuWU1BWCxcbi8vICAgICAgICAgICAgICAgIEFlcy5TSVpFLFxuLy8gICAgICAgICAgICAgICAgQWVzLkxJTkVUWVBFLFxuLy8gICAgICAgICAgICAgIC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sIGhlbHBlciA9IEdlb21IZWxwZXIocG9zLCBjb29yZCwgY3R4KVxuICAgICAgICAgICAgLmNyZWF0ZVN2Z0VsZW1lbnRIZWxwZXIoKVxuXG4gICAgICAgIGZvciAocCBpbiBhZXN0aGV0aWNzLmRhdGFQb2ludHMoKSkge1xuICAgICAgICAgICAgaWYgKFNlcmllc1V0aWwuYWxsRmluaXRlKHAueCgpLCBwLnkoKSwgcC54ZW5kKCksIHAueWVuZCgpKSkge1xuICAgICAgICAgICAgICAgIHZhbCBzdGFydCA9IERvdWJsZVZlY3RvcihwLngoKSEhLCBwLnkoKSEhKVxuICAgICAgICAgICAgICAgIHZhbCBlbmQgPSBEb3VibGVWZWN0b3IocC54ZW5kKCkhISwgcC55ZW5kKCkhISlcbiAgICAgICAgICAgICAgICB2YWwgbGluZSA9IGhlbHBlci5jcmVhdGVMaW5lKHN0YXJ0LCBlbmQsIHApXG4gICAgICAgICAgICAgICAgcm9vdC5hZGQobGluZSlcblxuICAgICAgICAgICAgICAgIHRhcmdldENvbGxlY3Rvci5hZGRQYXRoKFxuICAgICAgICAgICAgICAgICAgICBsaXN0T2YoY29vcmQudG9DbGllbnQoc3RhcnQpLCBjb29yZC50b0NsaWVudChlbmQpKSxcbiAgICAgICAgICAgICAgICAgICAgeyBwLmluZGV4KCkgfSxcbiAgICAgICAgICAgICAgICAgICAgR2VvbVRhcmdldENvbGxlY3Rvci5Ub29sdGlwUGFyYW1zLnBhcmFtcygpXG4gICAgICAgICAgICAgICAgICAgICAgICAuc2V0Q29sb3IoSGludENvbG9yVXRpbC5mcm9tQ29sb3IocCkpXG4gICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICAgICAgaWYgKGFycm93U3BlYyAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBjbGllbnRYMSA9IGxpbmUueDEoKS5nZXQoKSEhXG4gICAgICAgICAgICAgICAgICAgIHZhbCBjbGllbnRZMSA9IGxpbmUueTEoKS5nZXQoKSEhXG4gICAgICAgICAgICAgICAgICAgIHZhbCBjbGllbnRYMiA9IGxpbmUueDIoKS5nZXQoKSEhXG4gICAgICAgICAgICAgICAgICAgIHZhbCBjbGllbnRZMiA9IGxpbmUueTIoKS5nZXQoKSEhXG5cbiAgICAgICAgICAgICAgICAgICAgdmFsIGFic2Npc3NhID0gY2xpZW50WDIgLSBjbGllbnRYMVxuICAgICAgICAgICAgICAgICAgICB2YWwgb3JkaW5hdGUgPSBjbGllbnRZMiAtIGNsaWVudFkxXG4gICAgICAgICAgICAgICAgICAgIGlmIChhYnNjaXNzYSAhPSAwLjAgfHwgb3JkaW5hdGUgIT0gMC4wKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBDb21wdXRlIHRoZSBhbmdsZSB0aGF0IHRoZSB2ZWN0b3IgZGVmaW5lZCBieSB0aGlzIHNlZ21lbnQgbWFrZXMgd2l0aCB0aGVcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFgtYXhpcyAocmFkaWFucylcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBwb2xhckFuZ2xlID0gYXRhbjIob3JkaW5hdGUsIGFic2Npc3NhKVxuXG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgYXJyb3dBZXMgPSBhcnJvd1NwZWMhIS50b0Fycm93QWVzKHApXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYXJyb3dTcGVjISEuaXNPbkxhc3RFbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWwgYXJyb3cgPSBhcnJvd1NwZWMhIS5jcmVhdGVFbGVtZW50KHBvbGFyQW5nbGUsIGNsaWVudFgyLCBjbGllbnRZMilcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWNvcmF0ZShhcnJvdywgYXJyb3dBZXMpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcm9vdC5hZGQoYXJyb3cpXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC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AgICAgICBwb3M6IFBvc2l0aW9uQWRqdXN0bWVudCxcbiAgICAgICAgY29vcmQ6IENvb3JkaW5hdGVTeXN0ZW0sXG4gICAgICAgIGN0eDogR2VvbUNvbnRleHRcbiAgICApIHtcbiAgICAgICAgdmFsIGhlbHBlciA9IEdlb21IZWxwZXIocG9zLCBjb29yZCwgY3R4KVxuXG4gICAgICAgIGZvciAocCBpbiBkYXRhUG9pbnRzKSB7XG4gICAgICAgICAgICB2YWwgeENvb3JkID0gcC54KCkhIVxuICAgICAgICAgICAgdmFsIG9iamVjdFJhZGl1cyA9IDAuMFxuXG4gICAgICAgICAgICB2YWwgaGludCA9IEhpbnRDb25maWdGYWN0b3J5KClcbiAgICAgICAgICAgICAgICAuZGVmYXVsdE9iamVjdFJhZGl1cyhvYmplY3RSYWRpdXMpXG4gICAgICAgICAgICAgICAgLmRlZmF1bHRYKHhDb29yZClcbiAgICAgICAgICAgICAgICAuZGVmYXVsdEtpbmQoSE9SSVpPTlRBTF9UT09MVElQKVxuICAgICAgICAgICAgICAgIC5kZWZhdWx0Q29sb3IoXG4gICAgICAgICAgICAgICAgICAgIHAuZmlsbCgpISEsXG4gICAgICAgICAgICAgICAgICAgIFBST1BPUlRJT04ocC5hbHBoYSgpKVxuICAgICAgICAgICAgICAgIClcblxuICAgICAgICAgICAgdmFsIGhpbnRzQ29sbGVjdGlvbiA9IEhpbnRzQ29sbGVjdGlvbihwLCBoZWxwZXIpXG4gICAgICAgICAgICAgICAgLmFkZEhpbnQoaGludC5jcmVhdGUoQWVzLllNQVgpKVxuICAgICAgICAgICAgICAgIC5hZGRIaW50KGhpbnQuY3JlYXRlKEFlcy5ZTUlOKSlcbiAgICAgICAgICAgICAgICAuYWRkSGludChoaW50LmNyZWF0ZShBZXMuWSkuY29sb3IocC5jb2xvcigpISEpKVxuXG4gICAgICAgICAgICB2YWwgY2xpZW50Q29vcmQgPSBoZWxwZXIudG9DbGllbnQocC54KCksIHAueSgpLCBwKVxuICAgICAgICAgIC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JhdGlvKVxuXG4gICAgICAgICAgICAgICAgdmFsIGxvYyA9IGhlbHBlci50b0NsaWVudCh4LCB5LCBwKVxuICAgICAgICAgICAgICAgIGxhYmVsLm1vdmVUbyhsb2MpXG4gICAgICAgICAgICAgICAgcm9vdC5hZGQobGFiZWwucm9vdEdyb3VwKVxuXG4gICAgICAgICAgICAgICAgLy8gVGhlIGdlb21fdGV4dCB0b29sdGlwIGlzIHNpbWlsYXIgdG8gdGhlIGdlb21fdGlsZTpcbiAgICAgICAgICAgICAgICAvLyBpdCBsb29rcyBiZXR0ZXIgd2hlbiB0aGUgdGV4dCBpcyBvbiBhIHRpbGUgaW4gY29ycl9wbG90IChidXQgdGhlIGNvbG9yIHdpbGwgYmUgZGlmZmVyZW50IGZyb20gdGhlIGdlb21fdGlsZSB0b29sdGlwKVxuICAgICAgICAgICAgICAgIHRhcmdldENvbGxlY3Rvci5hZGRQb2ludChcbiAgICAgICAgICAgICAgICAgICAgcC5pbmRleCgpLFxuICAgICAgICAgICAgICAgICAgICBsb2MsXG4gICAgICAgICAgICAgICAgICAgIHNpemVVbml0UmF0aW8gKiBBZXNTY2FsaW5nLnRleHRTaXplKHApIC8gMixcbiAgICAgICAgICAgICAgICAgICAgR2VvbVRhcmdldENvbGxlY3Rvci5Ub29sdGlwUGFyYW1zLnBhcmFtcygpXG4gICAgICAgICAgICAgICAgICAgICAgICAuc2V0Q29sb3IoSGludENvbG9yVXRpbC5mcm9tQ29sb3IocCkpLFxuICAgICAgICAgICAgICAgICAgICBUaXBMYXlvdXRIaW50LktpbmQuQ1VSU09SX1RPT0xUSVBcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICAvLyBUaGlzIGltcGxlbWVudGF0aW9uIGlzIG92ZXJzaW1wbGlmaWVkLlxuICAgIC8vIEN1cnJlbnQgaW1wbGVtZW50YXRpb24gd29ya3MgZm9yIGxhYmVsX2Zvcm1hdCA9Jy4yZidcbiAgICAvLyBhbmQgdmFsdWVzIGJldHdlZW4gLTEuMCBhbmQgMS4wLlxuICAgIHByaXZhdGUgZnVuIGdldFNpemVVbml0UmF0aW8oY3R4OiBHZW9tQ29udGV4dCk6IERvdWJsZSB7XG4gICAgICAgIHJldHVybiBpZiAoIHNpemVVbml0ICE9IG51bGwpICB7XG4gICAgICAgICAgICB2YWwgdGV4dFdpZHRoID0gNi4wXG4gICAgICAgICAgICB2YWwgdW5pdFJlcyA9IGN0eC5nZXRVbml0UmVzb2x1dGlvbihHZW9tSGVscGVyLmdldFNpemVVbml0QWVzKHNpemVVbml0ISEpKVxuICAgICAgICAgICAgdW5pdFJlcyAvIHRleHRXaWR0aFxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgMS4wXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB0b1N0cmluZyhsYWJlbDogQW55Pyk6IFN0cmluZyB7XG4gICAgICAgIHJldHVybiB3aGVuIHtcbiAgICAgICAgICAgIGxhYmVsID09IG51bGwgLT4gbmFWYWx1ZVxuICAgICAgICAgICAgZm9ybWF0dGVyICE9IG51bGwgLT4gZm9ybWF0dGVyISEuZm9ybWF0KGxhYmVsKVxuICAgICAgICAgICAgZWxzZSAtPiBsYWJlbC50b1N0cmluZygpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgY29uc3QgdmFsIERFRl9OQV9WQUxVRSA9IFwibi9hXCJcbiAgICAgICAgY29uc3QgdmFsIEhBTkRMRVNfR1JPVVBTID0gZmFsc2VcbiAgICB9XG59XG5cbi8vIEhvdyAnanVzdCcgYW5kICdhbmdsZScgd29ya3MgdG9nZXRoZXJcbi8vIGh0dHBzOi8vc3RhY2tvdmVyZmxvdy5jb20vcXVlc3Rpb25zLzcyNjM4NDkvd2hhdC1kby1oanVzdC1hbmQtdmp1c3QtZG8td2hlbi1tYWtpbmctYS1wbG90LXVzaW5nLWdncGxv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gPVxuICAgICAgICAgICAgUmVjdGFuZ2xlc0hlbHBlcihhZXN0aGV0aWNzLCBwb3MsIGNvb3JkLCBjdHgpXG4gICAgICAgIHZhbCBzbGltR3JvdXAgPSBoZWxwZXIuY3JlYXRlU2xpbVJlY3RhbmdsZXMoXG4gICAgICAgICAgICByZWN0YW5nbGVCeURhdGFQb2ludChjdHgpXG4gICAgICAgIClcbiAgICAgICAgcm9vdC5hZGQod3JhcChzbGltR3JvdXApKVxuXG4gICAgICAgIFJlY3RUYXJnZXRDb2xsZWN0b3JIZWxwZXIoXG4gICAgICAgICAgICBoZWxwZXIsXG4gICAgICAgICAgICByZWN0YW5nbGVCeURhdGFQb2ludChjdHgpLFxuICAgICAgICAgICAgeyBwOiBEYXRhUG9pbnRBZXN0aGV0aWNzIC0+XG4gICAgICAgICAgICAgICAgSGludENvbG9yVXRpbC5mcm9tRmlsbChcbiAgICAgICAgICAgICAgICAgICAgcFxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBUaXBMYXlvdXRIaW50LktpbmQuQ1VSU09SX1RPT0xUSVBcbiAgICAgICAgKVxuICAgICAgICAgICAgLmNvbGxlY3RUbyhjdHgudGFyZ2V0Q29sbGVjdG9yKVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBjb25zdCB2YWwgSEFORExFU19HUk9VUFMgPSBmYWxzZVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHJlY3RhbmdsZUJ5RGF0YVBvaW50KGN0eDogR2VvbUNvbnRleHQpOiAoRGF0YVBvaW50QWVzdGhldGljcykgLT4gRG91YmxlUmVjdGFuZ2xlPyB7XG4gICAgICAgICAgICByZXR1cm4geyBwIC0+XG4gICAgICAgICAgICAgICAgdmFsIHggPSBwLngoKVxuICAgICAgICAgICAgICAgIHZhbCB5ID0gcC55KClcbiAgICAgICAgICAgICAgICB2YWwgdyA9IHAud2lkdGgoKVxuICAgICAgICAgICAgICAg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QgPSBEb3VibGVWZWN0b3IoaW50ZXJjZXB0LCB2aWV3UG9ydC50b3ApXG4gICAgICAgICAgICAgICAgICAgIHZhbCBlbmQgPSBEb3VibGVWZWN0b3IoaW50ZXJjZXB0LCB2aWV3UG9ydC5ib3R0b20pXG4gICAgICAgICAgICAgICAgICAgIHZhbCBsaW5lID0gaGVscGVyLmNyZWF0ZUxpbmUoc3RhcnQsIGVuZCwgcClcbiAgICAgICAgICAgICAgICAgICAgbGluZXMuYWRkKGxpbmUpXG5cbiAgICAgICAgICAgICAgICAgICAgdmFsIHdpZHRoID0gbWF4KEFlc1NjYWxpbmcuc3Ryb2tlV2lkdGgocCksIDIuMCkgKiAyLjBcbiAgICAgICAgICAgICAgICAgICAgdmFsIG9yaWdpbiA9IERvdWJsZVZlY3RvcihpbnRlcmNlcHQgLSB3aWR0aCAvIDIsIGVuZC55KVxuICAgICAgICAgICAgICAgICAgICB2YWwgZGltZW5zaW9ucyA9IERvdWJsZVZlY3Rvcih3aWR0aCwgMC4wKVxuICAgICAgICAgICAgICAgICAgICB2YWwgcmVjdCA9IERvdWJsZVJlY3RhbmdsZShvcmlnaW4sIGRpbWVuc2lvbnMpXG4gICAgICAgICAgICAgICAgICAgIGN0eC50YXJnZXRDb2xsZWN0b3IuYWRkUmVjdGFuZ2xlKFxuICAgICAgICAgICAgICAgICAgICAgICAgcC5pbmRleCgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2VvbUhlbHBlci50b0NsaWVudChyZWN0LCBwKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIEdlb21UYXJnZXRDb2xsZWN0b3IuVG9vbHRpcFBhcmFtcy5wYXJhbXMoKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRDb2xvcihIaW50Q29sb3JVdGlsLmZyb21Db2xvcihwKSlcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGx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bGFyQW5nbGUgLSBhbmdsZSksIHksIHkgLSBsZW5ndGggKiBzaW4ocG9sYXJBbmdsZSArIGFuZ2xlKSlcblxuICAgICAgICB2YWwgYiA9IFN2Z1BhdGhEYXRhQnVpbGRlcih0cnVlKVxuICAgICAgICAgICAgICAgIC5tb3ZlVG8oeHNbMF0sIHlzWzBdKVxuXG4gICAgICAgIGZvciAoaSBpbiAxLi4yKSB7XG4gICAgICAgICAgICBiLmxpbmVUbyh4c1tpXSwgeXNbaV0sIHRydWUpXG4gICAgICAgIH1cblxuICAgICAgICBpZiAodHlwZSA9PSBUeXBlLkNMT1NFRCkge1xuICAgICAgICAgICAgYi5jbG9zZVBhdGgoKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIFN2Z1BhdGhFbGVtZW50KGIuYnVpbGQoKSlcbiAgICB9XG5cbiAgICBmdW4gdG9BcnJvd0FlcyhwOiBEYXRhUG9pbnRBZXN0aGV0aWNzKTogRGF0YVBvaW50QWVzdGhldGljcyB7XG4gICAgICAgIHJldHVybiBvYmplY3QgOiBEYXRhUG9pbnRBZXN0aGV0aWNzRGVsZWdhdGUocCkge1xuICAgICAgICAgICAgcHJpdmF0ZSB2YWwgbXlGaWxsZWQgPSB0eXBlID09IFR5cGUuQ0xPU0VEXG5cbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBmaWxsKCk6IENvbG9yPyB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGlmIChteUZpbGxlZCkge1xuICAgICAgICAgICAgICAgICAgICBjb2xvcigpXG4gICAgICAgICAgICAgICAgfSBlbHNlIENvbG9yLlRSQU5TUEFSRU5UXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBsaW5lVHlwZSgpOiBMaW5lVHlwZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGlmIChteUZpbGxlZCkge1xuICAgICAgICAgICAgICAgICAgICBOYW1lZExpbmVUeXBlLlNPTElEIC8vIGF2b2l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AgICBhZXN0aGV0aWNzOiBBZXN0aGV0aWNzLFxuICAgICAgICBwb3M6IFBvc2l0aW9uQWRqdXN0bWVudCxcbiAgICAgICAgY29vcmQ6IENvb3JkaW5hdGVTeXN0ZW0sXG4gICAgICAgIGN0eDogR2VvbUNvbnRleHQsXG4gICAgICAgIHJlY3RGYWN0b3J5OiAoRGF0YVBvaW50QWVzdGhldGljcykgLT4gRG91YmxlUmVjdGFuZ2xlPyxcbiAgICAgICAgY29sb3JGYWN0b3J5OiAoRGF0YVBvaW50QWVzdGhldGljcykgLT4gQ29sb3JcbiAgICApIHtcbiAgICAgICAgdmFsIGhlbHBlciA9IEdlb21IZWxwZXIocG9zLCBjb29yZCwgY3R4KVxuXG4gICAgICAgIGZvciAocCBpbiBhZXN0aGV0aWNzLmRhdGFQb2ludHMoKSkge1xuICAgICAgICAgICAgdmFsIHJlY3QgPSByZWN0RmFjdG9yeShwKSA/OiBjb250aW51ZVxuXG4gICAgICAgICAgICB2YWwgY2xpZW50UmVjdCA9IGhlbHBlci50b0NsaWVudChEb3VibGVSZWN0YW5nbGUoMC4wLCAwLjAsIHJlY3Qud2lkdGgsIDAuMCksIHApXG4gICAgICAgICAgICB2YWwgb2JqZWN0UmFkaXVzID0gY2xpZW50UmVjdC53aWR0aCAvIDIuMFxuXG4gICAgICAgICAgICB2YWwgeENvb3JkID0gcmVjdC5jZW50ZXIueFxuICAgICAgICAgICAgdmFsIGhpbnRGYWN0b3J5ID0gSGludHNDb2xsZWN0aW9uLkhpbnRDb25maWdGYWN0b3J5KClcbiAgICAgICAgICAgICAgICAuZGVmYXVsdE9iamVjdFJhZGl1cyhvYmplY3RSYWRpdXMpXG4gICAgICAgICAgICAgICAgLmRlZmF1bHRYKHhDb29yZClcbiAgICAgICAgICAgICAgICAuZGVmYXVsdEtpbmQoVGlwTGF5b3V0SGludC5LaW5kLkhPUklaT05UQUxfVE9PTFRJUClcblxuICAgICAgICAgICAgdmFsIGhpbnRDb25maWdzID0gaGludEFlc0xpc3RcbiAgICAgICAgICAgICAgICAuZm9sZChIaW50c0NvbGxlY3Rpb24ocCwgaGVscGVyKSkgeyBhY2MsIGFlcyAtPlxuICAgICAgICAgICAgICAgICAgICBhY2MuYWRkSGludChoaW50RmFjdG9yeS5jcmVhdGUoYWVzKSlcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGN0eC50YXJnZXRDb2xsZWN0b3IuYWRkUmVjdGFuZ2xlKFxuICAgICAgICAgICAgICAgIHAuaW5kZXgoKSxcbiAgICAgICAgICAgICAgICBoZWxwZXIudG9DbGllbnQocmVjdCwgcCksXG4gICAgICAgICAgICAgICAgR2VvbVRhcmdldENvbGxlY3Rvci5Ub29sdGlwUGFyYW1zLnBhcmFtcygpXG4gICAgICAgICAgICAgICAgICAgIC5zZXRUaXBMYXlvdXRIaW50cyhoaW50Q29uZmlncy5oaW50cylcbi8vICAgICAgICAgICAgICAgICAgICAuc2V0Q29sb3IoSGludENvbG9yVXRpbC5mcm9tQ29sb3IocCkpXG4gICAgICAgICAgICAgICAgICAgIC5zZXRDb2xvcihjb2xvckZhY3RvcnkocCkpXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICB9XG59IiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5iYXNlLmdlb20udXRpbFxuXG5pbXBvcnQgamV0YnJhaW5zLmRhdGFsb3JlLmJhc2UuZ2VvbWV0cnkuRG91YmxlUmVjdGFuZ2xlXG5pbXBvcnQgamV0YnJhaW5zLmRhdGFsb3JlLmJhc2UuZ2VvbWV0cnkuRG91YmxlVmVjdG9yXG5pbXBv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9yRWFjaCB7IHJvb3QuYWRkKGl0KSB9XG4gICAgfVxuXG4gICAgZnVuIGJ1aWxkTWlkbGluZXMoXG4gICAgICAgIHJvb3Q6IFN2Z1Jvb3QsXG4gICAgICAgIGFlc3RoZXRpY3M6IEFlc3RoZXRpY3MsXG4gICAgICAgIHBvczogUG9zaXRpb25BZGp1c3RtZW50LFxuICAgICAgICBjb29yZDogQ29vcmRpbmF0ZVN5c3RlbSxcbiAgICAgICAgY3R4OiBHZW9tQ29udGV4dCxcbiAgICAgICAgZmF0dGVuOiBEb3VibGVcbiAgICApIHtcbiAgICAgICAgdmFsIGhlbHBlciA9IEdlb21IZWxwZXIocG9zLCBjb29yZCwgY3R4KVxuICAgICAgICB2YWwgZWxlbWVudEhlbHBlciA9IGhlbHBlci5jcmVhdGVTdmdFbGVtZW50SGVscGVyKClcblxuICAgICAgICBmb3IgKHAgaW4gR2VvbVV0aWwud2l0aERlZmluZWQoXG4gICAgICAgICAgICBhZXN0aGV0aWNzLmRhdGFQb2ludHMoKSxcbiAgICAgICAgICAgIEFlcy5YLFxuICAgICAgICAgICAgQWVzLldJRFRILFxuICAgICAgICAgICAgQWVzLk1JRERMRVxuICAgICAgICApKSB7XG4gICAgICAgICAgICB2YWwgeCA9IHAueCgpISFcbiAgICAgICAgICAgIHZhbCBtaWRkbGUgPSBwLm1pZGRsZSgpISFcbiAgICAgICAgICAgIHZhbCB3aWR0aCA9IEdlb21VdGlsLndpZHRoUHgocCwgY3R4LCAyLjApXG5cbiAgICAgICAgICAgIHZhbCBsaW5lID0gZWxlbWVudEhlbHBlci5jcmVhdGVMaW5lKFxuICAgICAgICAgICAgICAgIERvdWJsZVZlY3Rvcih4IC0gd2lkdGggLyAyLCBtaWRkbGUpLFxuICAgICAgICAgICAgICAgIERvdWJsZVZlY3Rvcih4ICsgd2lkdGggLyAyLCBtaWRkbGUpLFxuICAgICAgICAgICAgICAgIHBcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgLy8gYWRqdXN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RBZXN0aGV0aWNzIHtcblxuICAgIG92ZXJyaWRlIGZ1biBpbmRleCgpOiBJbnQge1xuICAgICAgICByZXR1cm4gcC5pbmRleCgpXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIHgoKTogRG91YmxlPyB7XG4gICAgICAgIHJldHVybiBwLngoKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biB5KCk6IERvdWJsZT8ge1xuICAgICAgICByZXR1cm4gcC55KClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4geigpOiBEb3VibGU/IHtcbiAgICAgICAgcmV0dXJuIHAueigpXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIHltaW4oKTogRG91YmxlPyB7XG4gICAgICAgIHJldHVybiBwLnltaW4oKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biB5bWF4KCk6IERvdWJsZT8ge1xuICAgICAgICByZXR1cm4gcC55bWF4KClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gY29sb3IoKTogQ29sb3I/IHtcbiAgICAgICAgcmV0dXJuIHAuY29sb3IoKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBmaWxsKCk6IENvbG9yPyB7XG4gICAgICAgIHJldHVybiBwLmZpbGwoKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBhbHBoYSgpOiBEb3VibGU/IHtcbiAgICAgICAgcmV0dXJuIHAuYWxwaGEoKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBzaGFwZSgpOiBQb2ludFNoYXBlPyB7XG4gICAgICAgIHJldHVybiBwLnNoYXBlKClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gbGluZVR5cGUoKTogTGluZVR5cGUge1xuICAgICAgICByZXR1cm4gcC5saW5lVHlwZSgpXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIHNpemUoKTogRG91YmxlPyB7XG4gICAgICAgIHJldHVybiBwLnNpemUoKVxuICAgIH1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GVyKHApID86IHJldHVybiBudWxsXG4gICAgICAgIHJldHVybiB0b0NsaWVudChyLCBwKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGFkanVzdChcbiAgICAgICAgcjogRG91YmxlUmVjdGFuZ2xlLFxuICAgICAgICBwOiBEYXRhUG9pbnRBZXN0aGV0aWNzLFxuICAgICAgICBwb3M6IFBvc2l0aW9uQWRqdXN0bWVudCxcbiAgICAgICAgY3R4OiBHZW9tQ29udGV4dFxuICAgICk6IERvdWJsZVJlY3RhbmdsZSB7XG4gICAgICAgIHZhbCBsZWZ0VG9wID0gcG9zLnRyYW5zbGF0ZShyLm9yaWdpbiwgcCwgY3R4KVxuICAgICAgICB2YWwgcmlnaHRCb3R0b20gPSBwb3MudHJhbnNsYXRlKHIub3JpZ2luLmFkZChyLmRpbWVuc2lvbiksIHAsIGN0eClcbiAgICAgICAgcmV0dXJuIERvdWJsZVJlY3RhbmdsZS5zcGFuKGxlZnRUb3AsIHJpZ2h0Qm90dG9tKVxuICAgIH1cblxuICAgIHByb3RlY3RlZCBmdW4gcHJvamVjdChcbiAgICAgICAgZGF0YVBvaW50czogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz4sXG4gICAgICAgIHByb2plY3Rpb246IChEYXRhUG9pbnRBZXN0aGV0aWNzKSAtPiBEb3VibGVWZWN0b3I/XG4gICAgKTogTGlzdDxEb3VibGVWZWN0b3I+IHtcbiAgICAgICAgdmFsIHBvaW50cyA9IEFycmF5TGlzdDxEb3VibGVWZWN0b3I+KClcbiAgICAgICAgZm9yIChwIGluIGRhdGFQb2ludHMpIHtcbiAgICAgICAgICAgIHZhbCBsb2NhdGlvbiA9IHByb2plY3Rpb24ocClcbiAgICAgICAgICAgIGlmIChsb2NhdGlvbiAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgdmFsIHBwID0gdG9DbGllbnQobG9jYXRpb24sIHApXG4gICAgICAgICAgICAgICAgcG9pbnRzLmFkZChwcClcbiAgICAgICAgICA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XRhbGljXCIsIFwib2JsaXF1ZVwiICAgICAgICAgICAgICAgICAvLyAnbm9ybWFsJyBpcyBkZWZhdWx0XG4gICAgICAgIClcbiAgICAgICAgcHJpdmF0ZSB2YWwgRk9OVF9GQU1JTFlfTUFQID0gbWFwT2YoXG4gICAgICAgICAgICBcInNhbnNcIiB0byBcInNhbnMtc2VyaWZcIixcbiAgICAgICAgICAgIFwic2VyaWZcIiB0byBcInNlcmlmXCIsXG4gICAgICAgICAgICBcIm1vbm9cIiB0byBcIm1vbm9zcGFjZVwiXG4gICAgICAgIClcblxuICAgICAgICBmdW4gZGVjb3JhdGUobGFiZWw6IFRleHRMYWJlbCwgcDogRGF0YVBvaW50QWVzdGhldGljcywgc2NhbGU6IERvdWJsZSA9IDEuMCkge1xuXG4gICAgICAgICAgICBsYWJlbC50ZXh0Q29sb3IoKS5zZXQocC5jb2xvcigpKVxuICAgICAgICAgICAgbGFiZWwudGV4dE9wYWNpdHkoKS5zZXQocC5hbHBoYSgpKVxuICAgICAgICAgICAgbGFiZWwuc2V0Rm9udFNpemUoQWVzU2NhbGluZy50ZXh0U2l6ZShwKSAqIHNjYWxlKVxuXG4gICAgICAgICAgICAvLyBmYW1pbHlcbiAgICAgICAgICAgIHZhciBmYW1pbHkgPSBwLmZhbWlseSgpXG4gICAgICAgICAgICBpZiAoRk9OVF9GQU1JTFlfTUFQLmNvbnRhaW5zS2V5KGZhbWlseSkpIHsgICAvLyBvdGhlcndpc2UgLSB1c2UgdmFsdWUgYXMgcHJvdmlkZWQgYnkgdXNlclxuICAgICAgICAgICAgICAgIGZhbWlseSA9IEZPTlRfRkFNSUxZX01BUC5nZXQoZmFtaWx5KSEhXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsYWJlbC5zZXRGb250RmFtaWx5KGZhbWlseSlcblxuICAgICAgICAgICAgLy8gZm9udGZhY2VcbiAgICAgICAgICAgIC8vIGlnbm9yZSAncGxhaW4nIC8gJ25vcm1hbCcgYXMgaXQgaXMgZGVmYXVsdCB2YWx1ZXNcbiAgICAgICAgICAgIHZhbCBmb250ZmFjZSA9IHAuZm9udGZhY2UoKVxuICAgICAgICAgICAgaWYgKCFTdHJpbmdzLmlzTnVsbE9yRW1wdHkoZm9udGZhY2UpKSB7XG4gICAgICAgICAgICAgICAgZm9yIChzIGluIGZvbnRmYWNlLnNwbGl0KFwiIFwiLnRvUmVnZXgoKSkuZHJvcExhc3RXaGlsZSB7IGl0LmlzRW1wdHkoKSB9LnRvVHlwZWRBcnJheSgpKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChGT05UX1dFSUdIVF9TRVQuY29udGFpbnMocykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsLnNldEZvbnRXZWlnaHQocylcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChGT05UX1NUWUxFX1NFVC5jb250YWlucyhzKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWwuc2V0Rm9udFN0eWxlKHMpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIHRleHQganVzdGlmaWNhdGlvblxuICAgICAgICAgICAgdmFsIGhBbmNob3IgPVxuICAgICAgICAgICAgICAgIHRleHRMYWJlbEFuY2hvcihcbiAgICAgICAgICAgICAgICAgICAgcC5oanVzdCgpLFxuICAgICAgICAgICAgICAgICAgICBISlVTVF9NQVAsXG4gICAgICAgICAgICAgICAgICAgIFRleHRMYWJlbC5Ib3Jpem9udGFsQW5jaG9yLk1JRERMRVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIHZhbCB2QW5jaG9yID1cbiAgICAgICAgICAgICAgICB0ZXh0TGFiZWxBbmNob3IoXG4gICAgICAgICAgICAgICAgICAgIHAudmp1c3QoKSxcbiAgICAgICAgICAgICAgICAgICAgVkpVU1RfTUFQLFxuICAgICAgICAgICAgICAgICAgICBUZXh0TGFiZWwuVmVydGljYWxBbmNob3IuQ0VOVEVSXG4gICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBpZiAoaEFuY2hvciAhPT0gVGV4dExhYmVsLkhvcml6b250YWxBbmNob3IuTEVGVCkgeyAgLy8gJ2xlZnQnIGlzIGRlZmF1bHRcbiAgICAgICAgICAgICAgICBsYWJlbC5zZXRIb3Jpem9udGFsQW5jaG9yKGhBbmNob3IpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodkFuY2hvciAhPT0gVGV4dExhYmVsLlZlcnRpY2FsQW5jaG9yLkJPVFRPTSkgeyAgLy8gJ2JvdHRvbScgaXMgZGVmYXVsdFxuICAgICAgICAgICAgICAgIGxhYmVsLnNldFZlcnRpY2FsQW5jaG9yKHZBbmNob3IpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBhbmdsZSA9IHAuYW5nbGUoKSEhXG4gICAgICAgICAgICBpZiAoYW5nbGUgIT0gMC4wKSB7XG4gICAgICAgICAgICAgICAgLy8gZ2dwbG90IGFuZ2xlOiBjb3VudGVyIGNsb2Nrd2lzZVxuICAgICAgICAgICAgICAgIC8vIFNWRyBhbmdsZTogY2xvY2t3aXNlXG4gICAgICAgICAgICAgICAgYW5nbGUgPSAzNjAgLSBhbmdsZSAlIDM2MFxuICAgICAgICAgICAgICAgIGxhYmVsLnJvdGF0ZShhbmdsZSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biA8VD4gdGV4dExhYmVsQW5jaG9yKG86IEFueSwgY29udmVyc2lvbk1hcDogTWFwPEFueSwgVD4sIGRlZjogVCk6IFQge1xuICAgICAgICAgICAgcmV0dXJuIGNvbnZlcnNpb25NYXAuZ2V0T3JFbHNlKG8sIHsgZGVmIH0pXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZGVjb3JhdGUobm9kZTogU3ZnTm9kZSwgcDogRGF0YVBvaW50QWVzdGhldGljcywgYXBwbHlBbHBoYVRvQWxsOiBCb29sZWFuID0gQUxQSEFfQ09OVFJPTFNfQk9USCkge1xuICAgICAgICAgICAgaWYgKG5vZGUgaXMgU3ZnU2hhcGUpIHtcbiAgICAgICAgICAgICAgICBkZWNvcmF0ZVNoYXBlKFxuICAgICAgICAgICAgICAgICAgICBub2RlIGFzIFN2Z1NoYXBlLFxuICAgICAgICAgICAgICAgICAgICBwLFxuICAgICAgICAgICAgICAgICAgICBhcHBseUFscGhhVG9BbGxcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChub2RlIGlzIFN2Z0VsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICB2YWwgbGluZVR5cGUgPSBwLmxpbmVUeXBlKClcbiAgICAgICAgICAgICAgICBpZiAoIShsaW5lVHlwZS5pc0JsYW5rIHx8IGxpbmVUeXBlLmlzU29saWQpKSB7XG4gICAgICAgICAgICAgICAgICAgIFN0cm9rZURhc2hBcnJheVN1cHBvcnQuYXBwbHkobm9kZSwgQWVzU2NhbGluZy5zdHJva2VXaWR0aChwKSwgbGluZVR5cGUuZGFzaEFycmF5KVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGRlY29yYXRlU2hhcGUoc2hhcGU6IFN2Z1NoYXBlLCBwOiBEYXRhUG9pbnRBZXN0aGV0aWNzLCBhcHBseUFscGhhVG9BbGw6IEJvb2xlYW4pIHtcbiAgICAgICAgICAgIEFlc3RoZXRpY3NVdGlsLnVwZGF0ZVN0cm9rZShzaGFwZSwgcCwgYXBwbHlBbHBoYVRvQWxsKVxuICAgICAgICAgICAgQWVzdGhldGljc1V0aWwudXBkYXRlRmlsbChzaGFwZSwgcClcbiAgICAgICAgICAgIHNoYXBlLnN0cm9rZVdpZHRoKCkuc2V0KEFlc1NjYWxpbmcuc3Ryb2tlV2lkdGgocCkpXG4gICAgICAgIH1cblxuICAgICAgICBpbnRlcm5hbCBmd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T19MT0NBVElPTl9YX1lNQVggPSB7IHA6IERhdGFQb2ludEFlc3RoZXRpY3MgLT5cbiAgICAgICAgdG9Mb2NhdGlvbk9yTnVsbChcbiAgICAgICAgICAgIHAueCgpLFxuICAgICAgICAgICAgcC55bWF4KClcbiAgICAgICAgKVxuICAgIH1cbiAgICB2YWwgVE9fTE9DQVRJT05fWF9aRVJPID0geyBwOiBEYXRhUG9pbnRBZXN0aGV0aWNzIC0+XG4gICAgICAgIHRvTG9jYXRpb25Pck51bGwoXG4gICAgICAgICAgICBwLngoKSxcbiAgICAgICAgICAgIDAuMFxuICAgICAgICApXG4gICAgfVxuICAgIHZhbCBUT19SRUNUQU5HTEUgPSB7IHA6IERhdGFQb2ludEFlc3RoZXRpY3MgLT5cbiAgICAgICAgaWYgKFNlcmllc1V0aWwuYWxsRmluaXRlKHAueG1pbigpLCBwLnltaW4oKSwgcC54bWF4KCksIHAueW1heCgpKSkge1xuICAgICAgICAgICAgcmVjdFRvR2VvbWV0cnkoXG4gICAgICAgICAgICAgICAgcC54bWluKCkhISxcbiAgICAgICAgICAgICAgICBwLnltaW4oKSEhLFxuICAgICAgICAgICAgICAgIHAueG1heCgpISEsXG4gICAgICAgICAgICAgICAgcC55bWF4KCkhIVxuICAgICAgICAgICAgKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgZW1wdHlMaXN0KClcbiAgICAgICAgfVxuICAgIH1cbiAgICBwcml2YXRlIHZhbCBPUkRFUklOR19YID0gT3JkZXJpbmcuZnJvbShvYmplY3QgOiBDb21wYXJhdG9yPERhdGFQb2ludEFlc3RoZXRpY3M/PiB7XG4gICAgICAgIG92ZXJyaWRlIGZ1biBjb21wYXJlKGE6IERhdGFQb2ludEFlc3RoZXRpY3M/LCBiOiBEYXRhUG9pbnRBZXN0aGV0aWNzPyk6IEludCB7XG4gICAgICAgICAgICB2YWwgeDEgPSBhPy54KClcbiAgICAgICAgICAgIHZhbCB4MiA9IGI/LngoKVxuICAgICAgICAgICA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W4gb3JkZXJlZF9YKGRhdGFQb2ludHM6IEl0ZXJhYmxlPERhdGFQb2ludEFlc3RoZXRpY3M+KTogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz4ge1xuICAgICAgICBpZiAoT1JERVJJTkdfWC5pc09yZGVyZWQoZGF0YVBvaW50cykpIHtcbiAgICAgICAgICAgIHJldHVybiBkYXRhUG9pbnRzXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIE9SREVSSU5HX1guc29ydGVkQ29weShkYXRhUG9pbnRzKVxuICAgIH1cblxuICAgIGZ1biBvcmRlcmVkX1koZGF0YVBvaW50czogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz4sIHJldmVyc2VkOiBCb29sZWFuKTogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz4ge1xuICAgICAgICB2YWwgb3JkZXJpbmcgPSBpZiAocmV2ZXJzZWQpIE9SREVSSU5HX1kucmV2ZXJzZSgpIGVsc2UgT1JERVJJTkdfWVxuICAgICAgICBpZiAob3JkZXJpbmcuaXNPcmRlcmVkKGRhdGFQb2ludHMpKSB7XG4gICAgICAgICAgICByZXR1cm4gZGF0YVBvaW50c1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBvcmRlcmluZy5zb3J0ZWRDb3B5KGRhdGFQb2ludHMpXG4gICAgfVxuXG4gICAgZnVuIHdpZHRoUHgocDogRGF0YVBvaW50QWVzdGhldGljcywgY3R4OiBHZW9tQ29udGV4dCwgbWluV2lkdGg6IERvdWJsZSk6IERvdWJsZSB7XG4gICAgICAgIHZhbCB3ID0gcC53aWR0aCgpXG4gICAgICAgIHZhbCB3aWR0aCA9IHchISAqIGN0eC5nZXRSZXNvbHV0aW9uKEFlcy5YKVxuICAgICAgICByZXR1cm4gbWF4KHdpZHRoLCBtaW5XaWR0aClcbiAgICB9XG5cbiAgICBmdW4gd2l0aERlZmluZWQoZGF0YVBvaW50czogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz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SGludENvbmZpZyk6IEhpbnRzQ29sbGVjdGlvbiB7XG4gICAgICAgIHZhbCBjb29yZCA9IGdldENvb3JkKGhpbnRDb25maWcpXG5cbiAgICAgICAgaWYgKGNvb3JkICE9IG51bGwpIHtcbiAgICAgICAgICAgIGhpbnRzW2hpbnRDb25maWcuYWVzXSA9IGNyZWF0ZUhpbnQoaGludENvbmZpZywgY29vcmQpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gdGhpc1xuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGdldENvb3JkKGhpbnRDb25maWc6IEhpbnRDb25maWcpOiBEb3VibGVWZWN0b3I/IHtcbiAgICAgICAgaWYgKGhpbnRDb25maWcueCA9PSBudWxsKSB7XG4gICAgICAgICAgICB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oXCJ4IGNvb3JkIGlzIG5vdCBzZXRcIilcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBhZXMgPSBoaW50Q29uZmlnLmFlc1xuICAgICAgICByZXR1cm4gaWYgKCFteVBvaW50LmRlZmluZWQoYWVzKSkge1xuICAgICAgICAgICAgbnVsbFxuICAgICAgICB9IGVsc2UgbXlIZWxwZXIudG9DbGllbnQoRG91YmxlVmVjdG9yKGhpbnRDb25maWcueCEhLCBteVBvaW50LmdldDxEb3VibGU+KGFlcykhISksIG15UG9pbnQpXG5cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjcmVhdGVIaW50KGhpbnRDb25maWc6IEhpbnRDb25maWcsIGNvb3JkOiBEb3VibGVWZWN0b3IpOiBUaXBMYXlvdXRIaW50IHtcbiAgICAgICAgdmFsIG9iamVjdFJhZGl1cyA9IGhpbnRDb25maWcub2JqZWN0UmFkaXVzXG4gICAgICAgIHZhbCBjb2xvciA9IGhpbnRDb25maWcuY29sb3JcblxuICAgICAgICBpZiAob2JqZWN0UmFkaXVzID09IG51bGwpIHtcbiAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcIm9iamVjdCByYWRpdXMgaXMgbm90IHNldFwiKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHdoZW4gKGhpbnRDb25maWcua2luZCkge1xuICAgICAgICAgICAgS2luZC5WRVJUSUNBTF9UT09MVElQIC0+IFRpcExheW91dEhpbnQudmVydGljYWxUb29sdGlwKGNvb3JkLCBvYmplY3RSYWRpdXMsIGNvbG9yKVxuXG4gICAgICAgICAgICBLaW5kLkhPUklaT05UQUxfVE9PTFRJUCAtPiBUaXBMYXlvdXRIaW50Lmhvcml6b250YWxUb29sdGlwKGNvb3JkLCBvYmplY3RSYWRpdXMsIGNvbG9yKVxuXG4gICAgICAgICAgICBLaW5kLkNVUlNPUl9UT09MVElQIC0+IFRpcExheW91dEhpbnQuY3Vyc29yVG9vbHRpcChjb29yZCwgY29sb3IpXG5cbiAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiVW5rbm93biBoaW50IGtpbmQ6IFwiICsgaGludENvbmZpZy5raW5kKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY2xhc3MgSGludENvbmZpZ0ZhY3Rvcnkge1xuXG4gICAgICAgIHByaXZhdGUgdmFyIG15RGVmYXVsdE9iamVjdFJhZGl1czogRG91YmxlPyA9IG51bGxcbiAgICAgICAgcHJpdmF0ZSB2YXIgbXlEZWZhdWx0WDogRG91YmxlPyA9IG51bGxcbiAgICAgICAgcHJpdmF0ZSB2YXIgbXlEZWZhdWx0Q29sb3I6IENvbG9yPyA9IG51bGxcbiAgICAgICAgcHJpdmF0ZSB2YXIgbXlEZWZhdWx0S2luZDogS2luZD8gPSBudWxsXG5cbiAgICAgICAgZnVuIGRlZmF1bHRPYmplY3RSYWRpdXMoZGVmYXVsdE9iamVjdFJhZGl1czogRG91YmxlKTogSGludENvbmZpZ0ZhY3Rvcnkge1xuICAgICAgICAgICAgbXlEZWZhdWx0T2JqZWN0UmFkaXVzID0gZGVmYXVsdE9iamVjdFJhZGl1c1xuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBkZWZhdWx0WChkZWZhdWx0WDogRG91YmxlKTogSGludENvbmZpZ0ZhY3Rvcnkge1xuICAgICAgICAgICAgbXlEZWZhdWx0WCA9IGRlZmF1bHRYXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGRlZmF1bHRDb2xvcih2OiBDb2xvciwgYWxwaGE6IERvdWJsZT8pOiBIaW50Q29uZmlnRmFjdG9yeSB7XG4gICAgICAgICAgICBpZiAoYWxwaGEgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIG15RGVmYXVsdENvbG9yID0gdi5jaGFuZ2VBbHBoYSgoMjU1ICogYWxwaGEpLnRvSW50KCkpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG15RGVmYXVsdENvbG9yID0gdlxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBjcmVhdGUoYWVzOiBBZXM8RG91YmxlPik6IEhpbnRDb25maWcge1xuICAgICAgICAgICAgcmV0dXJuIEhpbnRDb25maWcoYWVzKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGRlZmF1bHRLaW5kKGtpbmQ6IEtpbmQpOiBIaW50Q29uZmlnRmFjdG9yeSB7XG4gICAgICAgICAgICBteURlZmF1bHRLaW5kID0ga2luZFxuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGlubmVyIGNsYXNzIEhpbnRDb25maWcgaW50ZXJuYWwgY29uc3RydWN0b3IodmFsIGFlczogQWVzPERvdWJsZT4pIHtcbiAgICAgICAgICAgIHZhbCBraW5kOiBLaW5kP1xuICAgICAgICAgICAgdmFyIG9iamVjdFJhZGl1czogRG91YmxlPyA9IG51bGxcbiAgICAgICAgICAgICAgICBwcml2YXRlIHNldFxuICAgICAgICAgICAgdmFyIHg6IERvdWJsZT8gPSBudWxsXG4gICAgICAgICAgICAgICAgcHJpdmF0ZSBzZXRcbiAgICAgICAgICAgIGludGVybmFsIHZhciBjb2xvcjogQ29sb3I/ID0gbnVsbFxuICAgICAgICAgICAgICAgIHByaXZhdGUgc2V0XG5cbiAgICAgICAgICAgIGluaXQge1xuICAgICAgICAgICAgICAgIG9iamVjdFJhZGl1cyA9IG15RGVmYXVsdE9iamVjdFJhZGl1c1xuICAgICAgICAgICAgICAgIHggPSBteURlZmF1bHRYXG4gICAgICAgICAgICAgICAga2luZCA9IG15RGVmYXVsdEtpbmRcbiAgICAgICAgICAgICAgICBjb2xvciA9IG15RGVmYXVsdENvbG9yXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZ1biBvYmplY3RSYWRpdXModjogRG91YmxlKTogSGludENvbmZpZyB7XG4gICAgICAgICAgICAgICAgb2JqZWN0UmFkaXVzID0gdlxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZ1biB4KHY6IERvdWJsZSk6IEhpbnRDb25maWcge1xuICAgICAgICAgICAgICAgIHggPSB2XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZnVuIGNvbG9yKHY6IENvbG9yKTogSGludENvbmZpZyB7XG4gICAgICAgICAgICAgICAgY29sb3IgPSB2XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjAuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGN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GlzdDxMaW5lUGF0aD4ge1xuICAgICAgICB2YWwgbGluZVBhdGhzID0gQXJyYXlMaXN0PExpbmVQYXRoPigpXG4gICAgICAgIHZhbCBtdWx0aVBvaW50RGF0YUxpc3QgPSBjcmVhdGVNdWx0aVBvaW50RGF0YUJ5R3JvdXAoKVxuICAgICAgICBmb3IgKG11bHRpUG9pbnREYXRhIGluIG11bHRpUG9pbnREYXRhTGlzdCkge1xuICAgICAgICAgICBsaW5lUGF0aHMuYWRkQWxsKG15TGluZXNIZWxwZXIuY3JlYXRlUGF0aHMobXVsdGlQb2ludERhdGEuYWVzLCBtdWx0aVBvaW50RGF0YS5wb2ludHMsIG15Q2xvc2VQYXRoKSlcbiAgICAgICAgfVxuICAgICAgICBpZiAod2l0aEhpbnRzKSB7XG4gICAgICAgICAgICBidWlsZEhpbnRzKG11bHRpUG9pbnREYXRhTGlzdClcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbGluZVBhdGhzXG4gICAgfVxuXG4gICAgZnVuIGJ1aWxkSGludHMoKSA9IGJ1aWxkSGludHMoY3JlYXRlTXVsdGlQb2ludERhdGFCeUdyb3VwKCkpXG5cbiAgICBwcml2YXRlIGZ1biBidWlsZEhpbnRzKG11bHRpUG9pbnREYXRhTGlzdDogTGlzdDxNdWx0aVBvaW50RGF0YT4pIHtcbiAgICAgICAgZm9yIChtdWx0aVBvaW50RGF0YSBpbiBtdWx0aVBvaW50RGF0YUxpc3QpIHtcbiAgICAgICAgICAgIGlmIChteUNsb3NlUGF0aCkge1xuICAgICAgICAgICAgICAgIG15VGFyZ2V0Q29sbGVjdG9yLmFkZFBvbHlnb24oXG4gICAgICAgICAgICAgICAgICAgIG11bHRpUG9pbnREYXRhLnBvaW50cyxcbiAgICAgICAgICAgICAgICAgICAgbXVsdGlQb2ludERhdGEubG9jYWxUb0dsb2JhbEluZGV4LFxuICAgICAgICAgICAgICAgICAgICBwYXJhbXMoKS5zZXRDb2xvcihcbiAgICAgICAgICAgICAgICAgICAgICAgIEhpbnRDb2xvclV0aWwuZnJvbUZpbGwoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbXVsdGlQb2ludERhdGEuYWVzXG4gICAgICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG15VGFyZ2V0Q29sbGVjdG9yLmFkZFBhdGgoXG4gICAgICAgICAgICAgICAgICAgIG11bHRpUG9pbnREYXRhLnBvaW50cyxcbiAgICAgICAgICAgICAgICAgICAgbXVsdGlQb2ludERhdGEubG9jYWxUb0dsb2JhbEluZGV4LFxuICAgICAgICAgICAgICAgICAgICBwYXJhbXMoKS5zZXRDb2xvcihcbiAgICAgICAgICAgICAgICAgICAgICAgIEhpbnRDb2xvclV0aWwuZnJvbUNvbG9yKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG11bHRpUG9pbnREYXRhLmFlc1xuICAgICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gY3JlYXRlTXVsdGlQb2ludERhdGFCeUdyb3VwKCk6IExpc3Q8TXVsdGlQb2ludERhdGE+IHtcbiAgICAgICAgcmV0dXJuIE11bHRpUG9pbnREYXRhQ29uc3RydWN0b3IuY3JlYXRlTXVsdGlQb2ludERhdGFCeUdyb3VwKFxuICAgICAgICAgICAgbXlEYXRhUG9pbnRzLFxuICAgICAgICAgICAgc2luZ2xlUG9pbnRBcHBlbmRlciB7IHAgLT4gbXlMaW5lc0hlbHBlci50b0NsaWVudChHZW9tVXRpbC5UT19MT0NBVElPTl9YX1kocCkhISwgcCkgfSxcbiAgICAgICAgICAgIHJlZHVjZXIoRFJPUF9QT0lOVF9ESVNUQU5DRSwgbXlDbG9zZVBhdGgpXG4gIC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YgKHByZXYgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHggPSBpZiAoZGlyID09PSBTdGVwR2VvbS5EaXJlY3Rpb24uSFYpIHBvaW50LnggZWxzZSBwcmV2LnhcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCB5ID0gaWYgKGRpciA9PT0gU3RlcEdlb20uRGlyZWN0aW9uLkhWKSBwcmV2LnkgZWxzZSBwb2ludC55XG4gICAgICAgICAgICAgICAgICAgICAgICBuZXdQb2ludHMuYWRkKERvdWJsZVZlY3Rvcih4LCB5KSlcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBuZXdQb2ludHMuYWRkKHBvaW50KVxuICAgICAgICAgICAgICAgICAgICBwcmV2ID0gcG9pbnRcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB2YWwgcGF0aCA9IExpbmVQYXRoLmxpbmUobmV3UG9pbnRzKVxuICAgICAgICAgICAgICAgIGRlY29yYXRlKHBhdGgsIG11bHRpUG9pbnREYXRhLmFlcywgZmFsc2UpXG4gICAgICAgICAgICAgICAgcGF0aEluZm9zLmFkZChcbiAgICAgICAgICAgICAgICAgICAgUGF0aEluZm8oXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcGF0aEluZm9zXG4gICAgfVxuXG4gICAgZnVuIGNyZWF0ZUJhbmRzKFxuICAgICAgICBkYXRhUG9pbnRzOiBJdGVyYWJsZTxEYXRhUG9pbnRBZXN0aGV0aWNzPixcbiAgICAgICAgdG9Mb2NhdGlvblVwcGVyOiAoRGF0YVBvaW50QWVzdGhldGljcykgLT4gRG91YmxlVmVjdG9yPyxcbiAgICAgICAgdG9Mb2NhdGlvbkxvd2VyOiAoRGF0YVBvaW50QWVzdGhldGljcykgLT4gRG91YmxlVmVjdG9yP1xuICAgICk6IE11dGFibGVMaXN0PExpbmVQYXRoPiB7XG5cbiAgICAgICAgdmFsIGxpbmVzID0gQXJyYXlMaXN0PExpbmVQYXRoPigpXG4gICAgICAgIHZhbCBwb2ludHNCeUdyb3VwID0gR2VvbVV0aWwuY3JlYXRlR3JvdXBzKGRhdGFQb2ludHMpXG5cbiAgICAgICAgLy8gZHJhdyBsaW5lIGZvciBlYWNoIGdyb3VwXG4gICAgICAgIGZvciAoZ3JvdXAgaW4gT3JkZXJpbmcubmF0dXJhbDxJbnQ+KCkuc29ydGVkQ29weShwb2ludHNCeUdyb3VwLmtleXMpKSB7XG4gICAgICAgICAgICB2YWwgZ3JvdXBEYXRhUG9pbnRzID0gcG9pbnRzQnlHcm91cFtncm91cF1cbiAgICAgICAgICAgIC8vIHVwcGVyIG1hcmdpbiBwb2ludHNcbiAgICAgICAgICAgIHZhbCBwb2ludHMgPSBBcnJheUxpc3QocHJvamVjdChncm91cERhdGFQb2ludHMhISkgeyB0b0xvY2F0aW9uVXBwZXIoaXQpIH0pXG5cbiAgICAgICAgICAgIC8vIGxvd2VyIG1hcmdpbiBwb2ludCBpbiByZXZlcnNlZCBvcmRlclxuLy8gICAgICAgICAgICB2YWwgbG93ZXJQb2ludHMgPSBJbW11dGFibGVMaXN0LnJldmVyc2UoZ3JvdXBEYXRhUG9pbnRzKVxuICAgICAgICAgICAgdmFsIGxvd2VyUG9pbnRzID0gZ3JvdXBEYXRhUG9pbnRzLnJldmVyc2VkKClcbiAgICAgICAgICAgIHBvaW50cy5hZGRBbGwocHJvamVjdChsb3dlclBvaW50cykgeyB0b0xvY2F0aW9uTG93ZXIoaXQpIH0pXG5cbiAgICAgICAgICAgIGlmICghcG9pbnRzLmlzRW1wdHkoKSkge1xuICAgICAgICAgICAgICAgIHZhbCBwYXRoID0gTGluZVBhdGgucG9seWdvbihwb2ludHMpXG4gICAgICAgICAgICAgICAgLy9kZWNvcmF0ZShwYXRoLCBncm91cERhd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xuICAgIH1cblxuICAgIGZ1biBtdWx0aVBvaW50QXBwZW5kZXIoXG4gICAgICAgICAgICB0b1BhdGg6IChEYXRhUG9pbnRBZXN0aGV0aWNzKSAtPiBMaXN0PERvdWJsZVZlY3Rvcj4pOiAoRGF0YVBvaW50QWVzdGhldGljcywgKERvdWJsZVZlY3RvcikgLT4gVW5pdCkgLT4gVW5pdCB7XG4gICAgICAgIHJldHVybiB7IGFlcywgY29vcmRpbmF0ZUNvbnN1bWVyIC0+IHRvUGF0aChhZXMpLmZvckVhY2goY29vcmRpbmF0ZUNvbnN1bWVyKSB9XG4gICAgfVxuXG4gICAgZnVuIGNyZWF0ZU11bHRpUG9pbnREYXRhQnlHcm91cChcbiAgICAgICAgZGF0YVBvaW50czogSXRlcmFibGU8RGF0YVBvaW50QWVzdGhldGljcz4sXG4gICAgICAgIGNvb3JkaW5hdGVBcHBlbmRlcjogKERhdGFQb2ludEFlc3RoZXRpY3MsIChEb3VibGVWZWN0b3I/KSAtPiBVbml0KSAtPiBVbml0LFxuICAgICAgICBwb2ludENvbGxlY3RvclN1cHBsaWVyOiAoKSAtPiBQb2ludENvbGxlY3RvclxuICAgICk6IExpc3Q8TXVsdGlQb2ludERhdGE+IHtcbiAgICAgICAgdmFsIG11bHRpUG9pbnREYXRhQ29tYmluZXJzID0gSGFzaE1hcDxJbnQsIE11bHRpUG9pbnREYXRhQ29tYmluZXI+KClcblxuICAgICAgICBmb3IgKHAgaW4gZGF0YVBvaW50cykge1xuICAgICAgICAgICAgdmFsIGdyb3VwID0gcC5ncm91cCgpXG4gICAgICAgICAgICBpZiAoIW11bHRpUG9pbnREYXRhQ29tYmluZXJzLmNvbnRhaW5zS2V5KGdyb3VwKSkge1xuICAgICAgICAgICAgICAgIG11bHRpUG9pbnREYXRhQ29tYmluZXJzW2dyb3VwISFdID1cbiAgICAgICAgICAgICAgICAgICAgTXVsdGlQb2ludERhdGFDb21iaW5lcihcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvb3JkaW5hdGVBcHBlbmRlcixcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50Q29sbGVjdG9yU3VwcGxpZXIoKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG11bHRpUG9pbnREYXRhQ29tYmluZXJzW2dyb3VwXSEhLmFkZChwKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHJlc3VsdCA9IEFycmF5TGlzdDxNdWx0aVBvaW50RGF0YT4oKVxuXG4gICAgICAgIHZhbCBzb3J0ZWRHcm91cCA9IG5hdHVyYWw8SW50PigpLnNvcnRlZENvcHkobXVsdGlQb2ludERhdGFDb21iaW5lcnMua2V5cylcbiAgICAgICAgZm9yIChncm91cCBpbiBzb3J0ZWRHcm91cCkge1xuICAgICAgICAgICAgdmFsIG11bHRpUG9pbnREYXRhID0gbXVsdGlQb2ludERhdGFDb21iaW5lcnNbZ3JvdXBdISEuY3JlYXRlKGdyb3VwKVxuXG4gICAgICAgICAgICBpZiAobXVsdGlQb2ludERhdGEucG9pbnRzLmlzTm90RW1wdHkoKSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5hZGQobXVsdGlQb2ludERhdGEpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgfVxuXG4gICAgaW50ZXJmYWNlIFBvaW50Q29sbGVjdG9yIHtcblxuICAgICAgICB2YWwgcG9pbnRzOiBQYWlyPExpc3Q8RG91YmxlVmVjdG9yPiwgTGlzdDxJbnQ+PlxuICAgICAgICBmdW4gYWRkKGNvb3JkOiBEb3VibGVWZWN0b3I/LCBpbmRleDogSW50KVxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgTXVsdGlQb2ludERhdGFDb21iaW5lciBpbnRlcm5hbCBjb25zdHJ1Y3RvcihcbiAgICAgICAgcHJpdmF0ZSB2YWwgbXlDb29yZGluYXRlQXBwZW5kZXI6IChEYXRhUG9pbnRBZXN0aGV0aWNzLCAoRG91YmxlVmVjdG9yPykgLT4gVW5pdCkgLT4gVW5pdCxcbiAgICAgICAgcHJpdmF0ZSB2YWwgbXlQb2ludENvbGxlY3RvcjogUG9pbnRDb2xsZWN0b3JcbiAgICApIHtcblxuICAgICAgICBwcml2YXRlIHZhciBteUZpcnN0QWVzOiBEYXRhUG9pbnRBZXN0aGV0aWNzPyA9IG51bGxcblxuICAgICAgICBpbnRlcm5hbCBmdW4gYWRkKGFlczogRGF0YVBvaW50QWVzdGhldGljcykge1xuICAgICAgICAgICAgaWYgKG15Rmlyc3RBZXMgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIG15Rmlyc3RBZXMgPSBhZXNcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG15Q29vcmRpbmF0ZUFwcGVuZGVyKGFlcykgeyBteVBvaW50Q29sbGVjdG9yLmFkZChpdCwgYWVzLmluZGV4KCkpIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGludGVybmFsIGZ1biBjcmVhdGUoZ3JvdXA6IEludCk6IE11bHRpUG9pbnREYXRhIHtcbiAgICAgICAgICAgIHZhbCBwb2ludHMgPSBteVBvaW50Q29sbGVjdG9yLnBvaW50c1xuICAgICAgICAgICAgcmV0dXJuIE11bHRpUG9pbnREYXRhKFxuICAgICAgICAgICAgICAgIG15Rmlyc3RBZXMhISxcbiAgICAgICAgICAgICAgICBwb2ludHMuZmlyc3QsXG4gICAgICAgICAgICAgICAgeyBwb2ludHMuc2Vjb25kW2l0XSB9LFxuICAgICAgICAgICAgICAgIGdyb3VwXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGNsYXNzIFNpbXBsZVBvaW50Q29sbGVjdG9yIGludGVybmFsIGNvbnN0cnVjdG9yKCkgOlxuICAgICAgICBQb2ludENvbGxlY3RvciB7XG4gICAgICAgIHByaXZhdGUgdmFsIG15UG9pbnRzID0gQXJyYXlMaXN0PERvdWJsZVZlY3R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0cG9uZWQgdG8gYXZvaWQgZGlzY29ubmVjdGVkIGNvbnRvdXJzXG4gICAgICAgIHZhbCBwb2ludHM6IFBhaXI8TGlzdDxEb3VibGVWZWN0b3I+LCBMaXN0PEludD4+XG4gICAgICAgICAgICBnZXQoKSB7XG4gICAgICAgICAgICAgICAgaWYgKG15TGFzdFBvc3Rwb25lZCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIGFkZFBvaW50KG15TGFzdFBvc3Rwb25lZCEhLmZpcnN0LCBteUxhc3RQb3N0cG9uZWQhIS5zZWNvbmQpXG4gICAgICAgICAgICAgICAgICAgIG15TGFzdFBvc3Rwb25lZCA9IG51bGxcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gUGFpcihteVJlZHVjZWRQb2ludHMsIG15UmVkdWNlZEluZGV4ZXMpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gaXNDbG9zZXJUaGFuKHAwOiBEb3VibGVWZWN0b3IsIHAxOiBEb3VibGVWZWN0b3IsIGRpc3RhbmNlOiBEb3VibGUpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBhYnMocDAueCAtIHAxLngpIDwgZGlzdGFuY2UgJiYgYWJzKHAwLnkgLSBwMS55KSA8IGRpc3RhbmNlXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gYWRkKGNvb3JkOiBEb3VibGVWZWN0b3I/LCBpbmRleDogSW50KSB7XG4gICAgICAgICAgICBpZiAoY29vcmQgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJldHVyblxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAobXlMYXN0QWRkZWQgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHN0b3JlUG9pbnQoY29vcmQsIGluZGV4KVxuICAgICAgICAgICAgICAgIHJldHVyblxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAobmVlZFBvc3Rwb25lKGNvb3JkKSkge1xuICAgICAgICAgICAgICAgIHBvc3Rwb25lUG9pbnQoY29vcmQsIGluZGV4KVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBhZGQgYWxsXG4gICAgICAgICAgICAgICAgaWYgKG15TGFzdFBvc3Rwb25lZCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIGFkZFBvaW50KG15TGFzdFBvc3Rwb25lZCEhLmZpcnN0LCBteUxhc3RQb3N0cG9uZWQhIS5zZWNvbmQpXG4gICAgICAgICAgICAgICAgICAgIG15TGFzdFBvc3Rwb25lZCA9IG51bGxcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc3RvcmVQb2ludChjb29yZCwgaW5kZXgpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBuZWVkUG9zdHBvbmUobG9jOiBEb3VibGVWZWN0b3IpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHZhbCBjbG9zZVRvQWRkZWQgPSBhcmVUb29DbG9zZShteUxhc3RBZGRlZCwgbG9jKVxuICAgICAgICAgICAgdmFsIGNsb3NlVG9Qb3N0cG9uZWQgPSBteUxhc3RQb3N0cG9uZWQgPT0gbnVsbCB8fCBhcmVUb29DbG9zZShteUxhc3RQb3N0cG9uZWQhIS5maXJzdCwgbG9jKVxuICAgICAgICAgICAgdmFsIHJlZ2lvbkNsb3NlUG9pbnQgPSBpc1JlZ2lvblN0YXJ0KGxvYylcblxuICAgICAgICAgICAgcmV0dXJuIGNsb3NlVG9BZGRlZCAmJiBjbG9zZVRvUG9zdHBvbmVkICYmICFyZWdpb25DbG9zZVBvaW50XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBwb3N0cG9uZVBvaW50KGxvYzogRG91YmxlVmVjdG9yLCBpbmRleDogSW50KSB7XG4gICAgICAgICAgICBteUxhc3RQb3N0cG9uZWQgPSBQYWlyKGxvYywgaW5kZXgpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBzdG9yZVBvaW50KGxvYzogRG91YmxlVmVjdG9yLCBpbmRleDogSW50KSB7XG4gICAgICAgICAgICBhZGRQb2ludChsb2MsIGluZGV4KVxuICAgICAgICAgICAgbXlMYXN0QWRkZWQgPSBsb2NcblxuICAgICAgICAgICAgcHJvY2Vzc1JlZ2lvblN0YXJ0KGxvYywgaW5kZXgpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBwcm9jZXNzUmVnaW9uU3RhcnQobG9jOiBEb3VibGVWZWN0b3I/LCBpbmRleDogSW50Pykge1xuICAgICAgICAgICAgaWYgKCFteVBvbHlnb24pIHtcbiAgICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKG15UmVnaW9uU3RhcnQgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIG15UmVnaW9uU3RhcnQgPSBQYWlyKGxvYywgaW5kZXgpXG4gICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChpc1JlZ2lvblN0YXJ0KGxvYykpIHtcbiAgICAgICAgICAgICAgICAvLyBSZWdpb24gaXMgY2xvc2VkLiBXYWl0IG5leHQgc3RhcnQgcG9pbnQuXG4gICAgICAgICAgICAgICAgbXlSZWdpb25TdGFydCA9IG51bGxcbiAgICAgICAgICAgICAgICBteUxhc3RBZGRlZCA9IG51bGxcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGlzUmVnaW9uU3RhcnQobG9jOiBEb3VibGVWZWN0b3I/KTogQm9vbGVhbiB7XG4gICAgICAgICAgICBpZiAoIW15UG9seWdvbikge1xuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gaWYgKG15UmVnaW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V0aWNzLmRhdGFQb2ludENvdW50KCkpIHtcbiAgICAgICAgICAgIHZhbCBwID0gbXlBZXN0aGV0aWNzLmRhdGFQb2ludEF0KGluZGV4KVxuICAgICAgICAgICAgdmFsIHJlY3QgPSB0b0NsaWVudFJlY3QocCwgcmVjdGFuZ2xlQnlEYXRhUG9pbnQpXG5cbiAgICAgICAgICAgIHJlY3Q/LmxldCB7XG4gICAgICAgICAgICAgICAgaXRlcmF0b3IocCwgcmVjdClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuXG4gICAgZnVuIGNyZWF0ZVNsaW1SZWN0YW5nbGVzKHJlY3RhbmdsZUJ5RGF0YVBvaW50OiAoRGF0YVBvaW50QWVzdGhldGljcykgLT4gRG91YmxlUmVjdGFuZ2xlPyk6IFN2Z1NsaW1Hcm91cCB7XG4gICAgICAgIHZhbCBwb2ludENvdW50ID0gbXlBZXN0aGV0aWNzLmRhdGFQb2ludENvdW50KClcbiAgICAgICAgdmFsIGdyb3VwID0gU3ZnU2xpbUVsZW1lbnRzLmcocG9pbnRDb3VudClcblxuICAgICAgICBmb3IgKGluZGV4IGluIDAgdW50aWwgcG9pbnRDb3VudCkge1xuICAgICAgICAgICAgdmFsIHAgPSBteUFlc3RoZXRpY3MuZGF0YVBvaW50QXQoaW5kZXgpXG4gICAgICAgICAgICB2YWwgY2xpZW50UmVjdCA9IHRvQ2xpZW50UmVjdChwLCByZWN0YW5nbGVCeURhdGFQb2ludCkgPzogY29udGludWVcblxuICAgICAgICAgICAgdmFsIHNsaW1TaGFwZSA9IFN2Z1NsaW1FbGVtZW50cy5yZWN0KGNsaWVudFJlY3QubGVmdCwgY2xpZW50UmVjdC50b3AsIGNsaWVudFJlY3Qud2lkdGgsIGNsaWVudFJlY3QuaGVpZ2h0KVxuICAgICAgICAgICAgZGVjb3JhdGVTbGltU2hhcGUoXG4gICAgICAgICAgICAgICAgc2xpbVNoYXBlLFxuICAgICAgICAgICAgICAgIHBcbiAgICAgIC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QYXJhbXMsXG4gICAgICAgIHRvb2x0aXBLaW5kOiBLaW5kID0gS2luZC5IT1JJWk9OVEFMX1RPT0xUSVBcbiAgICApXG5cbiAgICBmdW4gYWRkUGF0aChcbiAgICAgICAgcG9pbnRzOiBMaXN0PERvdWJsZVZlY3Rvcj4sXG4gICAgICAgIGxvY2FsVG9HbG9iYWxJbmRleDogKEludCkgLT4gSW50LFxuICAgICAgICB0b29sdGlwUGFyYW1zOiBUb29sdGlwUGFyYW1zLFxuICAgICAgICB0b29sdGlwS2luZDogS2luZCA9IEtpbmQuSE9SSVpPTlRBTF9UT09MVElQXG4gICAgKVxuXG4gICAgZnVuIGFkZFBvbHlnb24oXG4gICAgICAgIHBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+LFxuICAgICAgICBsb2NhbFRvR2xvYmFsSW5kZXg6IChJbnQpIC0+IEludCxcbiAgICAgICAgdG9vbHRpcFBhcmFtczogVG9vbHRpcFBhcmFtcyxcbiAgICAgICAgdG9vbHRpcEtpbmQ6IEtpbmQgPSBLaW5kLkNVUlNPUl9UT09MVElQXG4gICAgKVxuXG4gICAgY2xhc3MgVG9vbHRpcFBhcmFtcyB7XG5cbiAgICAgICAgcHJpdmF0ZSB2YXIgbXlUaXBMYXlvdXRIaW50cyA9IGVtcHR5TWFwPEFlczwqPiwgVGlwTGF5b3V0SGludD4oKVxuICAgICAgICBwcml2YXRlIHZhciBteUNvbG9yID0gQ29sb3IuR1JBWVxuICAgICAgICBwcml2YXRlIHZhciBteVN0ZW1MZW5ndGggPSBUaXBMYXlvdXRIaW50LlN0ZW1MZW5ndGguTk9STUFMXG5cbiAgICAgICAgZnVuIGdldFRpcExheW91dEhpbnRzKCk6IE1hcDxBZXM8Kj4sIFRpcExheW91dEhpbnQ+IHtcbiAgICAgICAgICAgIHJldHVybiBteVRpcExheW91dEhpbnRzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gc2V0VGlwTGF5b3V0SGludHModGlwTGF5b3V0SGludHM6IE1hcDxBZXM8Kj4sIFRpcExheW91dEhpbnQ+KTogVG9vbHRpcFBhcmFtcyB7XG4gICAgICAgICAgICBteVRpcExheW91dEhpbnRzID0gdGlwTGF5b3V0SGludHNcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZ2V0Q29sb3IoKTogQ29sb3Ige1xuICAgICAgICAgICAgcmV0dXJuIG15Q29sb3JcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBzZXRDb2xvcihjb2xvcjogQ29sb3IpOiBUb29sdGlwUGFyYW1zIHtcbiAgICAgICAgICAgIG15Q29sb3IgPSBjb2xvclxuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBnZXRTdGVtTGVuZ3RoKCk6IFRpcExheW91dEhpbnQuU3RlbUxlbmd0aCB7XG4gICAgICAgICAgICByZXR1cm4gbXlTdGVtTGVuZ3RoXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gc2V0U3RlbUxlbmd0aChzdGVtTGVuZ3RoOiBUaXBMYXlvdXRIaW50LlN0ZW1MZW5ndGgpOiBUb29sdGlwUGFyYW1zIHtcbiAgICAgICAgICAgIG15U3RlbUxlbmd0aCA9IHN0ZW1MZW5ndGhcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgICAgIGZ1biBwYXJhbXMoKTogVG9vbHRpcFBhcmFtcyB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFRvb2x0aXBQYXJhbXMoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJ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AgICAgICAgICAgICBjb29yZCxcbiAgICAgICAgICAgICAgICBvYmplY3RSYWRpdXMsXG4gICAgICAgICAgICAgICAgY29sb3IsXG4gICAgICAgICAgICAgICAgc3RlbUxlbmd0aFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGhvcml6b250YWxUb29sdGlwKGNvb3JkOiBEb3VibGVWZWN0b3I/LCBvYmplY3RSYWRpdXM6IERvdWJsZSwgY29sb3I6IENvbG9yPywgc3RlbUxlbmd0aDogU3RlbUxlbmd0aCA9IFN0ZW1MZW5ndGguTk9STUFMKTogVGlwTGF5b3V0SGludCB7XG4gICAgICAgICAgICByZXR1cm4gVGlwTGF5b3V0SGludChcbiAgICAgICAgICAgICAgICBLaW5kLkhPUklaT05UQUxfVE9PTFRJUCxcbiAgICAgICAgICAgICAgICBjb29yZCxcbiAgICAgICAgICAgICAgICBvYmplY3RSYWRpdXMsXG4gICAgICAgICAgICAgICAgY29sb3IsXG4gICAgICAgICAgICAgICAgc3RlbUxlbmd0aFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGN1cnNvclRvb2x0aXAoY29vcmQ6IERvdWJsZVZlY3Rvcj8sIGNvbG9yOiBDb2xvcj8sIHN0ZW1MZW5ndGg6IFN0ZW1MZW5ndGggPSBTdGVtTGVuZ3RoLk5PUk1BTCk6IFRpcExheW91dEhpbnQge1xuICAgICAgICAgICAgcmV0dXJuIFRpcExheW91dEhpbnQoXG4gICAgICAgICAgICAgICAga2luZCA9IEtpbmQuQ1VSU09SX1RPT0xUSVAsXG4gICAgICAgICAgICAgICAgY29vcmQgPSBjb29yZCxcbiAgICAgICAgICAgICAgICBvYmplY3RSYWRpdXMgPSAwLjAsXG4gICAgICAgICAgICAgICAgY29sb3IgPSBjb2xvcixcbiAgICAgICAgICAgICAgICBzdGVtTGVuZ3RoID0gc3RlbUxlbmd0aFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHhBeGlzVG9vbHRpcChjb29yZDogRG91YmxlVmVjdG9yPywgY29sb3I6IENvbG9yPywgYXhpc1JhZGl1czogRG91YmxlID0gMC4wLCBzdGVtTGVuZ3RoOiBTdGVtTGVuZ3RoID0gU3RlbUxlbmd0aC5OT05FKTogVGlwTGF5b3V0SGludCB7XG4gICAgICAgICAgICByZXR1cm4gVGlwTGF5b3V0SGludChcbiAgICAgICAgICAgICAgICBraW5kID0gS2luZC5YX0FYSVNfVE9PTFRJUCxcbiAgICAgICAgICAgICAgICBjb29yZCA9IGNvb3JkLFxuICAgICAgICAgICAgICAgIG9iamVjdFJhZGl1cyA9IGF4aXNSYWRpdXMsXG4gICAgICAgICAgICAgICAgY29sb3IgPSBjb2xvcixcbiAgICAgICAgICAgICAgICBzdGVtTGVuZ3RoID0gc3RlbUxlbmd0aFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHlBeGlzVG9vbHRpcChjb29yZDogRG91YmxlVmVjdG9yPywgY29sb3I6IENvbG9yPywgYXhpc1JhZGl1czogRG91YmxlID0gMC4wLCBzdGVtTGVuZ3RoOiBTdGVtTGVuZ3RoID0gU3RlbUxlbmd0aC5OT05FKTogVGlwTGF5b3V0SGludCB7XG4gICAgICAgICAgICByZXR1cm4gVGlwTGF5b3V0SGludChcbiAgICAgICAgICAgICAgICBraW5kID0gS2luZC5ZX0FYSVNfVE9PTFRJUCxcbiAgICAgICAgICAgICAgICBjb29yZCA9IGNvb3JkLFxuICAgICAgICAgICAgICAgIG9iamVjdFJhZGl1cyA9IGF4aXNSYWRpdXMsXG4gICAgICAgICAgICAgICAgY29sb3IgPSBjb2xvcixcbiAgICAgICAgICAgICAgICBzdGVtTGVuZ3RoID0gc3RlbUxlbmd0aFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9m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AgcHJpdmF0ZSBmdW4gaXNEb2RnaW5nTmVlZGVkKGFlc3RoZXRpY3M6IEFlc3RoZXRpY3MpOiBCb29sZWFuIHtcbiAgICAgICAgLy8gaWYgZm9yIHNvbWUgWCB0aGVyZSBhcmUgbW9yZSB0aGVuIGp1c3QgMSBncm91cCwgdGhlbiBkb2RnaW5nIGlzIG5lZWRlZFxuICAgICAgICB2YWwgZ3JvdXBCeVggPSBIYXNoTWFwPERvdWJsZSwgSW50Pz4oKVxuICAgICAgICBmb3IgKGkgaW4gMCB1bnRpbCBhZXN0aGV0aWNzLmRhdGFQb2ludENvdW50KCkpIHtcbiAgICAgICAgICAgIHZhbCBwID0gYWVzdGhldGljcy5kYXRhUG9pbnRBdChpKVxuICAgICAgICAgICAgaWYgKHAuZGVmaW5lZChBZXMuWCkpIHtcbiAgICAgICAgICAgICAgICB2YWwgeCA9IHAueCgpISFcbiAgICAgICAgICAgICAgICB2YWwgZ3JvdXAgPSBwLmdyb3VwKClcbiAgICAgICAgICAgICAgICBpZiAoZ3JvdXBCeVguY29udGFpbnNLZXkoeCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGdyb3VwQnlYW3hdICE9IGdyb3VwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyA+MSBncm91cCBmb3IgdGhpcyBYXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgZ3JvdXBCeVhbeF0gPSBncm91cFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gZmFsc2VcbiAgICB9XG5cbiAgICBpbml0IHtcbiAgICAgICAgbXlEb2RnaW5nTmVlZGVkID0gaXNEb2RnaW5nTmVlZGVkKGFlc3RoZXRpY3MpXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnV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G4gICAgICAgICAgICB2YWwgZGF0YVBvaW50ID0gYWVzLmRhdGFQb2ludEF0KGkpXG4gICAgICAgICAgICB2YWwgeCA9IGRhdGFQb2ludC54KClcbiAgICAgICAgICAgIGlmIChTZXJpZXNVdGlsLmlzRmluaXRlKHgpKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFwb3NNYXhCeUJpbi5jb250YWluc0tleSh4KSkge1xuICAgICAgICAgICAgICAgICAgICBwb3NNYXhCeUJpblt4ISFdID0gMC4wXG4gICAgICAgICAgICAgICAgICAgIG5lZ01heEJ5QmluW3hdID0gMC4wXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdmFsIHkgPSBkYXRhUG9pbnQueSgpXG4gICAgICAgICAgICAgICAgaWYgKFNlcmllc1V0aWwuaXNGaW5pdGUoeSkpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHkhISA+PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwb3NNYXhCeUJpblt4ISFdID0gcG9zTWF4QnlCaW5beF0hISArIHlcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5lZ01heEJ5QmluW3ghIV0gPSBuZWdNYXhCeUJpblt4XSEhIC0geVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHZhbCBzY2FsZXJCeUluZGV4ID0gSGFzaE1hcDxJbnQsIERvdWJsZT4oKVxuICAgICAgICAvLyBEb3VibGUgbWF4ID0gbWF4KENvbGxlY3Rpb25zLm1heChwb3NNYXhCeUJpbi52YWx1ZXMoKSksIENvbGxlY3Rpb25zLm1heChuZWdNYXhCeUJpbi52YWx1ZXMoKSkpO1xuICAgICAgICBmb3IgKGkgaW4gMCB1bnRpbCBhZXMuZGF0YVBvaW50Q291bnQoKSkge1xuICAgICAgICAgICAgdmFsIGRhdGFQb2ludCA9IGFlcy5kYXRhUG9pbnRBdChpKVxuICAgICAgICAgICAgdmFsIHggPSBkYXRhUG9pbnQueCgpXG4gICAgICAgICAgICB2YWwgeSA9IGRhdGFQb2ludC55KClcbiAgICAgICAgICAgIGlmIChwb3NNYXhCeUJpbi5jb250YWluc0tleSh4KSAmJiBTZXJpZXNVdGlsLmlzRmluaXRlKHkpKSB7XG4gICAgICAgICAgICAgICAgaWYgKHkhISA+PSAwICYmIHBvc01heEJ5QmluW3hdISEgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHNjYWxlckJ5SW5kZXhbaV0gPSAxLjAgLyBwb3NNYXhCeUJpblt4XSEhXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICh5IDwgMCAmJiBuZWdNYXhCeUJpblt4XSEhID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBzY2FsZXJCeUluZGV4W2ldID0gMS4wIC8gbmVnTWF4QnlCaW5beF0hIVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHNjYWxlckJ5SW5kZXhbaV0gPSAxLjBcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHNjYWxlckJ5SW5kZXhbaV0gPSAxLjBcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gc2NhbGVyQnlJbmRleFxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biB0cmFuc2xhdGUodjogRG91YmxlVmVjdG9yLCBwOiBEYXRhUG9pbnRBZXN0aGV0aWNzLCBjdHg6IEdlb21Db250ZXh0KTogRG91YmxlVmVjdG9yIHtcbiAgICAgICAgdmFsIG5ld0xvYyA9IG15U3RhY2tQb3NIZWxwZXIudHJhbnNsYXRlKHYsIHAsIGN0eClcbiAgICAgICAgcmV0dXJuIERvdWJsZVZlY3RvcihuZXdMb2MueCwgbmV3TG9jLnkgKiBteVNjYWxlckJ5SW5kZXhbcC5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RG91YmxlPj4oKVxuICAgICAgICAgICAgZm9yIChpIGluIDAgdW50aWwgYWVzLmRhdGFQb2ludENvdW50KCkpIHtcbiAgICAgICAgICAgICAgICB2YWwgZGF0YVBvaW50ID0gYWVzLmRhdGFQb2ludEF0KGkpXG4gICAgICAgICAgICAgICAgdmFsIHggPSBkYXRhUG9pbnQueCgpXG4gICAgICAgICAgICAgICAgaWYgKFNlcmllc1V0aWwuaXNGaW5pdGUoeCkpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFuZWdQb3NCYXNlQnlCaW4uY29udGFpbnNLZXkoeCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5lZ1Bvc0Jhc2VCeUJpblt4ISFdID0gUGFpcihcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdXRhYmxlRG91YmxlKDAuMCksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgTXV0YWJsZURvdWJsZSgwLjApXG4gICAgICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICB2YWwgeSA9IGRhdGFQb2ludC55KClcbiAgICAgICAgICAgICAgICAgICAgaWYgKFNlcmllc1V0aWwuaXNGaW5pdGUoeSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBwYWlyID0gbmVnUG9zQmFzZUJ5QmluW3hdISFcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBvZmZzZXQ6IERvdWJsZVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkhISA+PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgb2Zmc2V0ID0gcGFpci5zZWNvbmQuZ2V0QW5kQWRkKHkpXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9mZnNldCA9IHBhaXIuZmlyc3QuZ2V0QW5kQWRkKHkpXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBvZmZzZXRCeUluZGV4W2ldID0gb2Zmc2V0XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBvZmZzZXRCeUluZGV4XG4gICAgICAgIH1cblxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgU3VtUG9zaXRpdmVOZWdhdGl2ZSBpbnRlcm5hbCBjb25zdHJ1Y3RvcihhZXM6IEFlc3RoZXRpY3MpIDogU3RhY2tQb3MoYWVzKSB7XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIG1hcEluZGV4VG9PZmZzZXQoYWVzOiBBZXN0aGV0aWNzKTogTWFwPEludCwgRG91YmxlPiB7XG4gICAgICAgICAgICB2YWwgb2Zmc2V0QnlJbmRleCA9IEhhc2hNYXA8SW50LCBEb3VibGU+KClcbiAgICAgICAgICAgIHZhbCBiYXNlQnlCaW4gPSBIYXNoTWFwPERvdWJsZSwgTXV0YWJsZURvdWJsZT4oKVxuICAgICAgICAgICAgZm9yIChpIGluIDAgdW50aWwgYWVzLmRhdGFQb2ludENvdW50KCkpIHtcbiAgICAgICAgICAgICAgICB2YWwgZGF0YVBvaW50QWVzID0gYWVzLmRhdGFQb2ludEF0KGkpXG4gICAgICAgICAgICAgICAgdmFsIHggPSBkYXRhUG9pbnRBZXMueCgpISFcbiAgICAgICAgICAgICAgICBpZiAoU2VyaWVzVXRpbC5pc0Zpbml0ZSh4KSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIWJhc2VCeUJpbi5jb250YWluc0tleSh4KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgYmFzZUJ5QmluW3hdID0gTXV0YWJsZURvdWJsZSgwLjApXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICB2YWwgeSA9IGRhdGFQb2ludEFlcy55KCkhIVxuICAgICAgICAgICAgICAgICAgICB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IERvdWJsZSA9IDEuMCk6IFN2Z1NsaW1PYmplY3Qge1xuICAgICAgICBpZiAoc2hhcGUgPT0gVGlueVBvaW50U2hhcGUpIHtcbiAgICAgICAgICAgIHJldHVybiBjcmVhdGVUaW55RG90U2hhcGUoXG4gICAgICAgICAgICAgICAgbG9jYXRpb24sXG4gICAgICAgICAgICAgICAgcFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgICAgIGlmIChzaGFwZSBpcyBOYW1lZFNoYXBlKSB7XG4gICAgICAgICAgICByZXR1cm4gY3JlYXRlTmFtZWRTaGFwZShcbiAgICAgICAgICAgICAgICBzaGFwZSxcbiAgICAgICAgICAgICAgICBsb2NhdGlvbixcbiAgICAgICAgICAgICAgICBwLFxuICAgICAgICAgICAgICAgIGZhdHRlblxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcIlVuc3VwcG9ydGVkIHBvaW50IHNoYXBlIGNvZGUgJHtzaGFwZS5jb2RlfSAke3NoYXBlOjpjbGFzcy5zaW1wbGVOYW1lfVwiKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNyZWF0ZVRpbnlEb3RTaGFwZShsb2NhdGlvbjogRG91YmxlVmVjdG9yLCBwOiBEYXRhUG9pbnRBZXN0aGV0aWNzKTogU3ZnU2xpbU9iamVjdCB7XG4gICAgICAgIHZhbCByID0gU3ZnU2xpbUVsZW1lbnRzLnJlY3QobG9jYXRpb24ueCAtIDAuNSwgbG9jYXRpb24ueSAtIDAuNSwgMS4wLCAxLjApXG4gICAgICAgIHZhbCBjb2xvciA9IHAuY29sb3IoKSEhXG4gICAgICAgIHZhbCBhbHBoYSA9IEFlc3RoZXRpY3NVdGlsLmFscGhhKGNvbG9yLCBwKVxuICAgICAgICByLnNldEZpbGwoY29sb3IsIGFscGhhKVxuICAgICAgICByLnNldFN0cm9rZVdpZHRoKDAuMClcbiAgICAgICAgcmV0dXJuI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iBHbHlwaCB7XG4gICAgICAgIHJldHVybiBQbHVzR2x5cGgobG9jYXRpb24sIHdpZHRoKVxuICAgIH1cblxuICAgIGZ1biBzdGlja0Nyb3NzKGxvY2F0aW9uOiBEb3VibGVWZWN0b3IsIHdpZHRoOiBEb3VibGUpOiBHbHlwaCB7XG4gICAgICAgIHJldHVybiBDcm9zc0dseXBoKGxvY2F0aW9uLCB3aWR0aClcbiAgICB9XG5cbiAgICBmdW4gc3RpY2tTcXVhcmVDcm9zcyhsb2NhdGlvbjogRG91YmxlVmVjdG9yLCBzaXplOiBEb3VibGUpOiBHbHlwaCB7XG4gICAgICAgIHJldHVybiBHbHlwaFBhaXIoXG4gICAgICAgICAgICBTcXVhcmVHbHlwaChsb2NhdGlvbiwgc2l6ZSksXG4gICAgICAgICAgICBDcm9zc0dseXBoKGxvY2F0aW9uLCBzaXplLCBmYWxzZSlcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biBzdGlja1N0YXIobG9jYXRpb246IERvdWJsZVZlY3Rvciwgc2l6ZTogRG91YmxlKTogR2x5cGgge1xuICAgICAgICByZXR1cm4gR2x5cGhQYWlyKFxuICAgICAgICAgICAgUGx1c0dseXBoKGxvY2F0aW9uLCBzaXplKSxcbiAgICAgICAgICAgIENyb3NzR2x5cGgobG9jYXRpb24sIHNpemUpXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gc3RpY2tEaWFtb25kUGx1cyhsb2NhdGlvbjogRG91YmxlVmVjdG9yLCBzaXplOiBEb3VibGUpOiBHbHlwaCB7XG4gICAgICAgIHJldHVybiBHbHlwaFBhaXIoXG4gICAgICAgICAgICBEaWFtb25kR2x5cGgobG9jYXRpb24sIHNpemUpLFxuICAgICAgICAgICAgUGx1c0dseXBoKGxvY2F0aW9uLCBzaXplKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIHN0aWNrQ2lyY2xlUGx1cyhsb2NhdGlvbjogRG91YmxlVmVjdG9yLCBzaXplOiBEb3VibGUpOiBHbHlwaCB7XG4gICAgICAgIHJldHVybiBHbHlwaFBhaXIoXG4gICAgICAgICAgICBDaXJjbGVHbHlwaChsb2NhdGlvbiwgc2l6ZSksXG4gICAgICAgICAgICBQbHVzR2x5cGgobG9jYXRpb24sIHNpemUpXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gc3RpY2tUcmlhbmdsZVVwRG93bihsb2NhdGlvbjogRG91YmxlVmVjdG9yLCBzaXplOiBEb3VibGUpOiBHbHlwaCB7XG4gICAgICAgIHJldHVybiBHbHlwaFBhaXIoXG4gICAgICAgICAgICBUcmlhbmdsZUdseXBoKGxvY2F0aW9uLCBzaXplLCB0cnVlKSxcbiAgICAgICAgICAgIFRyaWFuZ2xlR2x5cGgobG9jYXRpb24sIHNpemUsIGZhbHNlKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIHN0aWNrU3F1YXJlUGx1cyhsb2NhdGlvbjogRG91YmxlVmVjdG9yLCBzaXplOiBEb3VibGUpOiBHbHlwaCB7XG4gICAgICAgIHJldHVybiBHbHlwaFBhaXIoXG4gICAgICAgICAgICBTcXVhcmVHbHlwaChsb2NhdGlvbiwgc2l6ZSksXG4gICAgICAgICAgICBQbHVzR2x5cGgobG9jYXRpb24sIHNpemUpXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gc3RpY2tDaXJjbGVDcm9zcyhsb2NhdGlvbjogRG91YmxlVmVjdG9yLCBzaXplOiBEb3VibGUpOiBHbHlwaCB7XG4gICAgICAgIHJldHVybiBHbHlwaFBhaXIoXG4gICAgICAgICAgICBDaXJjbGVHbHlwaChsb2NhdGlvbiwgc2l6ZSksXG4gICAgICAgICAgICBDcm9zc0dseXBoKGxvY2F0aW9uLCBzaXplKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIHN0aWNrU3F1YXJlVHJpYW5nbGVVcChsb2NhdGlvbjogRG91YmxlVmVjdG9yLCBzaXplOiBEb3VibGUpOiBHbHlwaCB7XG4gIC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AgdmFsIGhlaWdodCA9IGlmIChpbnNjcmliZWRJblNxdWFyZSlcbiAgICAgICAgICAgICAgICBzaXplXG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgU0lERV9UT19IRUlHSFRfUkFUSU8gKiBzaXplXG5cbiAgICAgICAgICAgIHZhbCB2T2Zmc2V0ID0gaWYgKGluc2NyaWJlZEluU3F1YXJlKVxuICAgICAgICAgICAgICAgIDAuMFxuICAgICAgICAgICAgZWxzZVxuICAgICAgICAgICAgICAgIGhlaWdodCAqIFZFUlRJQ0FMX09GRlNFVF9SQVRJT1xuXG4gICAgICAgICAgICB2YWwgeDogRG91YmxlQXJyYXlcbiAgICAgICAgICAgIHZhbCB5OiBEb3VibGVBcnJheVxuICAgICAgICAgICAgdmFyIGR5ID0gKHNpemUgLSBoZWlnaHQpIC8gMlxuICAgICAgICAgICAgaWYgKHBvaW50aW5nVXApIHtcbiAgICAgICAgICAgICAgICBkeSAtPSB2T2Zmc2V0XG4gICAgICAgICAgICAgICAgeCA9IGRvdWJsZUFycmF5T2YoaGFsZiwgc2l6ZSwgMC4wKVxuICAgICAgICAgICAgICAgIHkgPSBkb3VibGVBcnJheU9mKDAuMCArIGR5LCBoZWlnaHQgKyBkeSwgaGVpZ2h0ICsgZHkpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGR5ICs9IHZPZmZzZXRcbiAgICAgICAgICAgICAgICB4ID0gZG91YmxlQXJyYXlPZigwLjAsIHNpemUsIGhhbGYpXG4gICAgICAgICAgICAgICAgeSA9IGRvdWJsZUFycmF5T2YoMC4wICsgZHksIDAuMCArIGR5LCBoZWlnaHQgKyBkeSlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIG94ID0gbG9jYXRpb24ueCAtIGhhbGZcbiAgICAgICAgICAgIHZhbCBveSA9IGxvY2F0aW9uLnkgLSBoYWxmXG4gICAgICAgICAgICBmb3IgKGkgaW4gMC4uMikge1xuICAgICAgIC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0aERhc2hBcnJheSgpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB1cGRhdGVQYXRoRGFzaEFycmF5KCkge1xuICAgICAgICBpZiAoIShteURhc2hBcnJheSA9PSBudWxsIHx8IG15RGFzaEFycmF5ISEuaXNFbXB0eSgpKSkge1xuICAgICAgICAgICAgdmFsIHcgPSBteVBhdGguc3Ryb2tlV2lkdGgoKS5nZXQoKVxuICAgICAgICAgICAgdmFsIHdpZHRoID0gdyA/OiAxLjBcbiAgICAgICAgICAgIFN0cm9rZURhc2hBcnJheVN1cHBvcnQuYXBwbHkoXG4gICAgICAgICAgICAgICAgbXlQYXRoLFxuICAgICAgICAgICAgICAgIHdpZHRoLFxuICAgICAgICAgICAgICAgIG15RGFzaEFycmF5ISFcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICB2YWwgRU5EX09GX1NVQlBBVEg6IERvdWJsZVZlY3Rvcj8gPSBudWxsICAvLyBFbmQgb2YgU3ViIFBhdGhcblxuICAgICAgICBmdW4gbGluZShwb2ludHM6IEl0ZXJhYmxlPERvdWJsZVZlY3Rvcj4pOiBMaW5lUGF0aCB7XG4gICAgICAgICAgICByZXR1cm4gTGluZVBhdGgoXG4gICAgICAgICAgICAgICAgcGF0aEJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgICAgIHBvaW50cyxcbiAgICAgICAgICAgICAgICAgICAgZmFsc2VcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcG9seWdvbihwb2ludHM6IEl0ZXJhYmxlPERvdWJsZVZlY3Rvcj8+KTogTGluZVBhdGgge1xuICAgICAgICAgICAgcmV0dXJuIExpbmVQYXRoKFxuICAgICAgICAgICAgICAgIHBhdGhCdWlsZGVyKFxuICAgICAgICAgICAgICAgICAgICBwb2ludHMsXG4gICAgICAgICAgICAgICAgICAgIHRydWVcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBwYXRoQnVpbGRlcihwb2ludHM6IEl0ZXJhYmxlPERvdWJsZVZlY3Rvcj8+LCBpc1BvbHlnb246IEJvb2xlYW4pOiBTdmdQYXRoRGF0YUJ1aWxkZXIge1xuICAgICAgICAgICAgdmFsIGJ1aWxkZXIgPSBTdmdQYXRoRGF0YUJ1aWxkZXIodHJ1ZSlcblxuICAgICAgICAgICAgdmFyIGN1clNlZ21lbnQ6IE11dGFibGVMaXN0PERvdWJsZVZlY3Rvcj4gPSBBcnJheUxpc3QoKVxuICAgICAgICAgICAgdmFsIGludGVycG9sYXRlID0gZmFsc2VcbiAgICAgICAgICAgIGZvciAocG9pbnQgaW4gcG9pbnRzKSB7XG4gICAgICAgICAgICAgICAgaWYgKHBvaW50ID09PSBFTkRfT0ZfU1VCUEFUSCkge1xuICAgICAgICAgICAgICAgICAgICBidWlsZFNlZ21lbnQoXG4gICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgY3VyU2VnbWVudCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGludGVycG9sYXRlXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzUG9seWdvbikge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5jbG9zZVBhdGgoKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGN1clNlZ21lbnQgPSBBcnJheUxpc3QoKVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGN1clNlZ21lbnQuYWRkKHBvaW50ISEpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnVpbGRTZWdtZW50KFxuICAgICAgICAgICAgICAgI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Q29tcG9uZW50PigpXG4gICAgcHJpdmF0ZSB2YXIgbXlPcmlnaW4gPSBEb3VibGVWZWN0b3IuWkVST1xuICAgIHByaXZhdGUgdmFyIG15Um90YXRpb25BbmdsZSA9IDAuMFxuICAgIHByaXZhdGUgdmFyIG15Q29tcG9zaXRlUmVnaXN0cmF0aW9uID0gQ29tcG9zaXRlUmVnaXN0cmF0aW9uKClcblxuICAgIHByb3RlY3RlZCB2YWwgY2hpbGRDb21wb25lbnRzOiBMaXN0PFN2Z0NvbXBvbmVudD5cbiAgICAgICAgZ2V0KCkge1xuICAgICAgICAgICAgcmVxdWlyZShteUlzQnVpbHQpIHsgXCJQbG90IGhhcyBub3QgeWV0IGJ1aWx0XCIgfVxuICAgICAgICAgICAgcmV0dXJuIEFycmF5TGlzdChteUNoaWxkQ29tcG9uZW50cylcbiAgICAgICAgfVxuXG4gICAgdmFsIHJvb3RHcm91cDogU3ZnR0VsZW1lbnRcbiAgICAgICAgZ2V0KCkge1xuICAgICAgICAgICAgZW5zdXJlQnVpbHQoKVxuICAgICAgICAgICAgcmV0dXJuIG15Um9vdEdyb3VwXG4gICAgICAgIH1cblxuICAgIGZ1biBlbnN1cmVCdWlsdCgpIHtcbiAgICAgICAgaWYgKCEobXlJc0J1aWx0IHx8IG15SXNCdWlsZGluZykpIHtcbiAgICAgICAgICAgIGJ1aWxkQ29tcG9uZW50SW50ZXJuKClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGJ1aWxkQ29tcG9uZW50SW50ZXJuKCkge1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgbXlJc0J1aWxkaW5nID0gdHJ1ZVxuICAgICAgICAgICAgYnVpbGRDb21wb25lbnQoKVxuICAgICAgICB9IGZpbmFsbHkge1xuICAgICAgICAgICAgbXlJc0J1aWxkaW5nID0gZmFsc2VcbiAgICAgICAgICAgIG15SXNCdWlsdCA9IHRydWVcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByb3RlY3RlZCBhYnN0cmFjdCBmdW4gYnVpbGRDb21wb25lbnQoKVxuXG4gICAgcHJvdGVjdGVkIGZ1biA8RXZlbnRUPiByZWJ1aWxkSGFuZGxlcigpOiBFdmVudEhhbmRsZXI8RXZlbnRUPiB7XG4gICAgICAgIHJldHVybiBvYmplY3QgOiBFdmVudEhhbmRsZXI8RXZlbnRUPiB7XG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gb25FdmVudChldmVudDogRXZlbnRUKSB7XG4gICAgICAgICAgICAgICAgbmVlZFJlYnVpbGQoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJvdGVjdGVkIGZ1biBuZWVkUmVidWlsZCgpIHtcbiAgICAgICAgaWYgKG15SXNCdWlsdCkge1xuICAgICAgICAgICAgY2xlYXIoKVxuICAgICAgICAgICAgYnVpbGRDb21wb25lbnRJbnRlcm4oKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJvdGVjdGVkIGZ1biByZWcocjogUmVnaXN0cmF0aW9uKSB7XG4gICAgICAgIG15Q29tcG9zaXRlUmVnaXN0cmF0aW9uLmFkZChyKVxuICAgIH1cblxuICAgIGZ1biBjbGVhcigpIHtcbiAgICAgICAgbXlJc0J1aWx0ID0gZmFsc2VcbiAgICAgICAgZm9yIChjaGlsZCBpbiBteUNoaWxkQ29tcG9uZW50cykge1xuICAgICAgICAgICAgY2hpbGQuY2xlYXIoKVxuICAgICAgICB9XG4gICAgICAgIG15Q2hpbGRDb21wb25lbnRzLmNsZWFyKClcbiAgICAgICAgbXlSb290R3JvdXAuY2hpbGRyZW4oKS5jbGVhcigpXG4gICAgICAgIG15Q29tcG9zaXRlUmVnaXN0cmF0aW9uLnJlbW92ZSgpXG4gICAgICAgIG15Q29tcG9zaXRlUmVnaXN0cmF0aW9uID0gQ29tcG9zaXRlUmVnaXN0cmF0aW9uKClcbiAgICB9XG5cbiAgICBmdW4gYWRkKGNoaWxkOiBTdmdDb21wb25lbnQpIHtcbiAgICAgICAgbXlDaGlsZENvbXBvbmVudHMuYWRkKGNoaWxkKVxuICAgICAgICBhZGQoY2hpbGQucm9vdEdyb3VwKVxuICAgIH1cblxuICAgIGZ1biBhZGQobm9kZTogU3ZnTm9kZSkge1xuICAgICAgICBteVJvb3RHcm91cC5jaGlsZHJlbigpLmFkZChub2RlKVxuICAgIH1cblxuICAgIGZ1biBtb3ZlVG8ocDogRG91YmxlVmVjdG9yKSB7XG4gICAgICAgIG15T3JpZ2luID0gcFxuICAgICAgICBteVJvb3RHcm91cC50cmFuc2Zvcm0oKS5zZXQoXG4gICAgICAgICAgICBidWlsZFRyYW5zZm9ybShcbiAgICAgICAgICAgICAgICBteU9yaWdpbixcbiAgICAgICAgICAgICAgICBteVJvdGF0aW9uQW5nbGVcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biBtb3ZlVG8oeDogRG91YmxlLCB5OiBEb3VibGUpIHtcbiAgICAgICAgbW92ZVRvKERvdWJsZVZlY3Rvcih4LCB5KSlcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBAcGFyYW0gYW5nbGUgaW4gZGVncmVlc1xuICAgICAqL1xuICAgIGZ1biByb3RhdGUoYW5nbGU6IERvdWJsZSkge1xuICAgICAgICBteVJvdGF0aW9uQW5nbGUgPSBhbmdsZVxuICAgICAgICBteVJvb3RHcm91cC50cmFuc2Zvcm0oKS5zZXQoXG4gICAgICAgICAgICBidWlsZFRyYW5zZm9ybShcbiAgICAgICAgICAgICAgICBteU9yaWdpbixcbiAgICAgICAgICAgICAgICBteVJvdGF0aW9uQW5nbGVcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biB0b1JlbGF0aXZlQ29vcmRpbmF0ZXMobG9jYXRpb246IERvdWJsZVZlY3Rvcik6IERvdWJsZVZlY3RvciB7XG4gICAgICAgIHJldHVybiByb290R3JvdXAucG9pbnRUb1RyYW5zZm9ybWVkQ29vcmRpbmF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Gb250U2l6ZSA+IDAgJiYgbXlGb250RmFtaWx5ICE9IG51bGwpIHtcbiAgICAgICAgICAgIC8vIHVzZSBmb250IHNob3J0aGFuZCBiZWNhdXNlIHRoaXMgZm9ybWF0IGlzIGV4cGVjdGVkIGJ5IHN2ZyAtPiBjYW52YXMgbWFwcGVyXG4gICAgICAgICAgICAvLyBmb250OiBbc3R5bGVdIFt3ZWlnaHRdIHNpemUgZmFtaWx5O1xuICAgICAgICAgICAgdmFsIGZudCA9IFN0cmluZ0J1aWxkZXIoKVxuICAgICAgICAgICAgaWYgKCFteUZvbnRTdHlsZS5pc051bGxPckVtcHR5KCkpIHtcbiAgICAgICAgICAgICAgICBmbnQuYXBwZW5kKG15Rm9udFN0eWxlISEpLmFwcGVuZCgnICcpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIW15Rm9udFdlaWdodC5pc051bGxPckVtcHR5KCkpIHtcbiAgICAgICAgICAgICAgICBmbnQuYXBwZW5kKG15Rm9udFdlaWdodCEhKS5hcHBlbmQoJyAnKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZm50LmFwcGVuZChteUZvbnRTaXplKS5hcHBlbmQoXCJweCBcIilcbiAgICAgICAgICAgIGZudC5hcHBlbmQobXlGb250RmFtaWx5ISEpLmFwcGVuZChcIjtcIilcblxuICAgICAgICAgICAgc2IuYXBwZW5kKFwiZm9udDpcIikuYXBwZW5kKGZudClcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIC8vIHNldCBlYWNoIHByb3BlcnR5IHNlcGFyYXRlbHlcbiAgICAgICAgICAgIGlmICghbXlGb250U3R5bGUuaXNOdWxsT3JCbGFuaygpKSB7XG4gICAgICAgICAgICAgICAgc2IuYXBwZW5kKFwiZm9udC1zdHlsZTpcIikuYXBwZW5kKG15Rm9udFN0eWxlISEpLmFwcGVuZCgnOycpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIW15Rm9udFdlaWdodC5pc051bGxPckVtcHR5KCkpIHtcbiAgICAgICAgICAgICAgICBzYi5hcHBlbmQoXCJmb250LXdlaWdodDpcIikuYXBwZW5kKG15Rm9udFdlaWdodCEhKS5hcHBlbmQoJzsnKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKG15Rm9udFNpemUgPiAwKSB7XG4gICAgICAgICAgICAgICAgc2IuYXBwZW5kKFwiZm9udC1zaXplOlwiKS5hcHBlbmQobXlGb250U2l6ZSkuYXBwZW5kKFwicHg7XCIpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIW15Rm9udEZhbWlseS5pc051bGxPckVtcHR5KCkpIHtcbiAgICAgICAgICAgICAgICBzYi5hcHBlbmQoXCJmb250LWZhbWlseTpcIikuYXBwZW5kKG15Rm9udEZhbWlseSEhKS5hcHBlbmQoJzsnKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgbXlUZXh0LnNldEF0dHJpYnV0ZShTVkdfU1RZTEVfQVRUUklCVVRFLCBzYi50b1N0cmluZygpKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHRvVGV4dEFuY2hvcihhbmNob3I6IEhvcml6b250YWxBbmNob3IpOiBTdHJpbmc/IHtcbiAgICAgICAgcmV0dXJuIHdoZW4gKGFuY2hvcikge1xuICAgICAgICAgICAgSG9yaXpvbnRhbEFuY2hvci5MRUZUIC0+IG51bGwgLy8gZGVmYXVsdCAtIFwic3RhcnRcIjtcbiAgICAgICAgICAgIEhvcml6b250YWxBbmNob3IuTUlERExFIC0+IFNWR19URVhUX0FOQ0hPUl9NSURETEVcbiAgICAgICAgICAgIEhvcml6b250YWxBbmNob3IuUklHSFQgLT4gU1ZHX1RFWFRfQU5DSE9SX0VORFxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gdG9Eb21pbmFudEJhc2VsaW5lKGFuY2hvcjogVmVydGljYWxBbmNob3IpOiBTdHJpbmc/IHtcbiAgICAgICAgcmV0dXJuIH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TogU3RyaW5nLFxuICAgICAgICBtYXBwZXI6ICgoRG91YmxlPykgLT4gVD8pLFxuICAgICAgICBjb250aW51b3VzT3V0cHV0OiBCb29sZWFuXG4gICAgKSA6IHN1cGVyKG5hbWUsIG1hcHBlcikge1xuICAgICAgICBpc0NvbnRpbnVvdXMgPSBjb250aW51b3VzT3V0cHV0XG4gICAgICAgIGNvbnRpbnVvdXNEb21haW5MaW1pdHMgPSBQYWlyKERvdWJsZS5ORUdBVElWRV9JTkZJTklUWSwgRG91YmxlLlBPU0lUSVZFX0lORklOSVRZKVxuICAgICAgICBjb250aW51b3VzVHJhbnNmb3JtID0gVHJhbnNmb3Jtcy5JREVOVElUWVxuICAgICAgICBjdXN0b21CcmVha3NHZW5lcmF0b3IgPSBudWxsXG5cbiAgICAgICAgLy8gc2VlOiBodHRwczovL2dncGxvdDIudGlkeXZlcnNlLm9yZy9yZWZlcmVuY2Uvc2NhbGVfY29udGludW91cy5odG1sXG4gICAgICAgIC8vIGRlZmF1bHRzIGZvciBjb250aW51b3VzIHNjYWxlLlxuICAgICAgICBtdWx0aXBsaWNhdGl2ZUV4cGFuZCA9IDAuMDVcbiAgICAgICAgYWRkaXRpdmVFeHBhbmQgPSAwLjBcbiAgICB9XG5cbiAgICBwcml2YXRlIGNvbnN0cnVjdG9yKGI6IE15QnVpbGRlcjxUPikgOiBzdXBlcihiKSB7XG4gICAgICAgIGNvbnRpbnVvdXNUcmFuc2Zvcm0gPSBiLm15Q29udGludW91c1RyYW5zZm9ybVxuICAgICAgICBjdXN0b21CcmVha3NHZW5lcmF0b3IgPSBiLm15Q3VzdG9tQnJlYWtzR2VuZXJhdG9yXG4gICAgICAgIGlzQ29udGludW91cyA9IGIubXlDb250aW51b3VzT3V0cHV0XG4gICAgICAgIHZhbCBsb3dlciA9IGlmIChTZXJpZXNVdGlsLmlzRmluaXRlKGIubXlMb3dlckxpbWl0KSkgYi5teUxvd2VyTGltaXQhISBlbHNlIERvdWJsZS5ORUdBVElWRV9J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JVbmRlZmluZWQgbWFwcGVyXCIpIH1cblxuICAgIGZ1biA8VD4gbnVsbGFibGUoZjogKERvdWJsZT8pIC0+IFQsIGlmTnVsbDogVCk6IChEb3VibGU/KSAtPiBUIHtcbiAgICAgICAgcmV0dXJuIHsgbiAtPlxuICAgICAgICAgICAgaWYgKG4gPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIGlmTnVsbFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBmKG4pXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gY29uc3RhbnQodjogRG91YmxlKTogKERvdWJsZT8pIC0+IERvdWJsZSA9IHsgdiB9XG5cbiAgICBmdW4gbXVsKGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgcmFuZ2VTcGFuOiBEb3VibGUpOiAoRG91YmxlPykgLT4gRG91YmxlPyB7XG4gICAgICAgIHZhbCBmYWN0b3IgPSByYW5nZVNwYW4gLyAoZG9tYWluLnVwcGVyRW5kIC0gZG9tYWluLmxvd2VyRW5kKVxuICAgICAgICBjaGVjayghKGZhY3Rvci5pc0luZmluaXRlKCkgfHwgZmFjdG9yLmlzTmFOKCkpKSB7IFwiQ2FuJ3QgY3JlYXRlIG1hcHBlciB3aXRoIHJhdGlvOiAkZmFjdG9yXCIgfVxuICAgICAgICByZXR1cm4gbXVsKGZhY3RvcilcbiAgICB9XG5cbiAgICBmdW4gbXVsKGZhY3RvcjogRG91YmxlKTogKERvdWJsZT8pIC0+IERvdWJsZT8ge1xuICAgICAgICByZXR1cm4geyB2IC0+XG4gICAgICAgICAgICBpZiAodiAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgZmFjdG9yICogdlxuICAgICAgICAgICAgfSBlbHNlIG51bGxcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBsaW5lYXIoZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LCByYW5nZTogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgcmV2ZXJzZTogQm9vbGVhbiA9IGZhbHNlKTogKERvdWJsZT8pIC0+IERvdWJsZSB7XG4gICAgICAgIHJldHVybiBsaW5lYXIoXG4gICAgICAgICAgICBkb21haW4sXG4gICAgICAgICAgICByYW5nZUxvdyA9IGlmIChyZXZlcnNlKSByYW5nZS51cHBlckVuZCBlbHNlIHJhbmdlLmxvd2VyRW5kLFxuICAgICAgICAgICAgcmFuZ2VIaWdoID0gaWYgKHJldmVyc2UpIHJhbmdlLmxvd2VyRW5kIGVsc2UgcmFuZ2UudXBwZXJFbmQsXG4gICAgICAgICAgICBEb3VibGUuTmFOXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gbGluZWFyKGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgcmFuZ2U6IENsb3NlZFJhbmdlPERvdWJsZT4sIGRlZmF1bHRWYWx1ZTogRG91YmxlKTogKERvdWJsZT8pIC0+IERvdWJsZSB7XG4gICAgICAgIHJldHVybiBsaW5lYXIoXG4gICAgICAgICAgICBkb21haW4sXG4gICAgICAgICAgICByYW5nZS5sb3dlckVuZCxcbiAgICAgICAgICAgIHJhbmdlLnVwcGVyRW5kLFxuICAgICAgICAgICAgZGVmYXVsdFZhbHVlXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gbGluZWFyKFxuICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIHJhbmdlTG93OiBEb3VibGUsXG4gICAgICAgIHJhbmdlSGlnaDogRG91YmxlLFxuICAgICAgICBkZWZhdWx0VmFsdWU6IERvdWJsZVxuICAgICk6IChEb3VibGU/KSAtPiBEb3VibGUge1xuICAgICAgICB2YWwgc2xvcCA9IChyYW5nZUhpZ2ggLSByYW5nZUxvdykgLyAoZG9tYWluLnVwcGVyRW5kIC0gZG9tYWluLmxvd2VyRW5kKVxuICAgICAgICBpZiAoIVNlcmllc1V0aWwuaXNGaW5pdG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ZExvd2VyLCB0cmFuc2Zvcm1lZFVwcGVyKVxuICAgICAgICAgICAgKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgUGFpcih0cmFuc2Zvcm1lZExvd2VyLCB0cmFuc2Zvcm1lZFVwcGVyKVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5iYXNlLnNjYWxlXG5cbmltcG9ydCBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5iYXNlLkFlc1xuaW1wb3J0IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJhc2UuU2NhbGVcblxub2JqZWN0IFNjYWxlcyB7XG4gICAgZnVuIDxUPiBjb250aW51b3VzRG9tYWluKFxuICAgICAgICBuYW1lOiBTdHJpbmcsXG4gICAgICAgIGFlczogQWVzPFQ+XG4gICAgKTogU2NhbGU8VD4ge1xuICAgICAgICByZXR1cm4gQ29udGludW91c1NjYWxlPFQ+KFxuICAgICAgICAgICAgbmFtZSxcbiAgICAgICAgICAgIE1hcHBlcnMudW5kZWZpbmVkKCksXG4gICAgICAgICAgICBhZXMuaXNOdW1lcmljXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gY29udGludW91c0RvbWFpbk51bWVyaWNSYW5nZShcbiAgICAgICAgbmFtZTogU3RyaW5nXG4gICAgKTogU2NhbGU8RG91YmxlPiB7XG4gICAgICAgIHJldHVybiBDb250aW51b3VzU2NhbGU8RG91YmxlPihcbiAgICAgICAgICAgIG5hbWUsXG4gICAgICAgICAgICBNYXBwZXJzLnVuZGVmaW5lZCgpLFxuICAgICAgICAgICAgdHJ1ZVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIDxUPiBjb250aW51b3VzRG9tYWluKFxuICAgICAgICBuYW1lOiBTdHJpbmcsXG4gICAgICAgIG1hcHBlcjogKERvdWJsZT8pIC0+IFQ/LFxuICAgICAgICBjb250aW51b3VzUmFuZ2U6IEJvb2xlYW5cbiAgICApOiBTY2FsZTxUPiB7XG4gICAgICAgIHJldHVybiBDb250aW51b3VzU2NhbGU8VD4obmFtZSwgbWFwcGVyLCBjb250aW51b3VzUmFuZ2UpXG4gICAgfVxuXG4gICAgZnVuIDxUPiBkaXNjcmV0ZURvbWFpbihuYW1lOiBTdHJpbmcsIGRvbWFpblZhbHVlczogQ29sbGVjdGlvbjxBbnk+KTogU2NhbGU8VD4ge1xuICAgICAgICByZXR1cm4gZGlzY3JldGVEb21haW4oXG4gICAgICAgICAgICBuYW1lLFxuICAgICAgICAgICAgZG9tYWluVmFsdWVzLFxuICAgICAgICAgICAgTWFwcGVycy51bmRlZmluZWQoKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIDxUPiBkaXNjcmV0ZURvbWFpbihuYW1lOiBTdHJpbmcsIGRvbWFpblZhbHVlczogQ29sbGVjdGlvbjxBbnk+LCBtYXBwZXI6ICgoRG91YmxlPykgLT4gVD8pKTogU2NhbGU8VD4ge1xuICAgICAgICByZXR1cm4gRGlzY3JldGVTY2FsZShuYW1lLCBkb21haW5WYWx1ZXMsIG1hcHBlcilcbiAgICB9XG5cbiAgICBmdW4gPFQ+IHB1cmVEaXNjcmV0ZShcbiAgICAgICAgbmFtZTogU3RyaW5nLFxuICAgICAgICBkb21haW5WYWx1ZXM6IExpc3Q8QW55PixcbiAgICAgICAgb3V0cHV0VmFsdWVzOiBMaXN0PFQ+LFxuICAgICAgICBkZWZhdWx0T3V0cHV0VmFsdWU6IFRcbiAgICApOiBTY2FsZTxUPiB7XG4gICAgICAgIHJldHVybiBkaXNjcmV0ZURvbWFpbjxUPihuYW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GFibGVMaXN0PERvdWJsZT4/ID0gbnVsbFxuICAgICAgICAgICAgaWYgKG1pbkludGVydmFsICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICB0aWNrcyA9IG1pbkludGVydmFsLnJhbmdlKHN0YXJ0LCBlbmQpLnRvTXV0YWJsZUxpc3QoKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAodGlja3MgIT0gbnVsbCAmJiB0aWNrcy5zaXplIDw9IGNvdW50KSB7XG4gICAgICAgICAgICAgICAgLy8gc2FtZSBvciBzbWFsbGVyIGludGVydmFsIHJlcXVlc3RlZCAtPiBzdGF5IHdpdGggbWluIGludGVydmFsXG4gICAgICAgICAgICAgICAgZm9ybWF0dGVyID0gbWluSW50ZXJ2YWwhIS50aWNrRm9ybWF0dGVyXG4gICAgICAgICAgICAgICAgLy8gb3RoZXJ3aXNlIC0gbGFyZ2VyIHN0ZXAgcmVxdWVzdGVkIC0+IGNvbXB1dGUgdGlja3NcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RlcCA+IFllYXJJbnRlcnZhbC5NUykgeyAgICAgICAgLy8geWVhcnNcbiAgICAgICAgICAgICAgICBmb3JtYXR0ZXIgPSBZZWFySW50ZXJ2YWwuVElDS19GT1JNQVRURVJcbiAgICAgICAgICAgICAgICB0aWNrcyA9IEFycmF5TGlzdCgpXG4gICAgICAgICAgICAgICAgdmFsIHN0YXJ0RGF0ZVRpbWUgPSBUaW1lVXRpbC5hc0RhdGVUaW1lVVRDKHN0YXJ0KVxuICAgICAgICAgICAgICAgIHZhciBzdGFydFllYXIgPSBzdGFydERhdGVUaW1lLnllYXJcbiAgICAgICAgICAgICAgICBpZiAoc3RhcnREYXRlVGltZS5pc0FmdGVyKFRpbWVVdGlsLnllYXJTdGFydChzdGFydFllYXIpKSkge1xuICAgICAgICAgICAgICAgICAgICBzdGFydFllYXIrK1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB2YWwgZW5kWWVhciA9IFRpbWVVdGlsLmFzRGF0ZVRpbWVVVEMoZW5kKS55ZWFyXG4gICAgICAgICAgICAgICAgdmFsIGhlbHBlciA9IExpbmVhckJyZWFrc0hlbHBlcihcbiAgICAgICAgICAgICAgICAgICAgc3RhcnRZZWFyLnRvRG91YmxlKCksXG4gICAgICAgICAgICAgICAgICAgIGVuZFllYXIudG9Eb3VibGUoKSxcbiAgICAgICAgICAgICAgICAgICAgY291bnRcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgZm9yICh0aWNrWWVhciBpbiBoZWxwZXIuYnJlYWtzKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCB0aWNrRGF0ZSA9IFRpbWVVdGlsLnllYXJTdGFydChyb3VuZCh0aWNrWWVhcikudG9JbnQoKSlcbiAgICAgICAgICAgICAgICAgICAgdGlja3MuYWRkKFRpbWVVdGlsLmFzSW5zdGFudFVUQyh0aWNrRGF0ZSkudG9Eb3VibGUoKSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHZhbCBpbnRlcnZhbCA9IE5pY2VUaW1lSW50ZXJ2YWwuZm9yTWlsbGlzKHN0ZXApXG4gICAgICAgICAgICAgICAgZm9ybWF0dGVyID0gaW50ZXJ2YWwudGlja0Zvcm1hdHRlclxuICAgICAgICAgICAgICAgIHRpY2tzID0gaW50ZXJ2YWwucmFuZ2Uoc3RhcnQsIGVuZCkudG9NdXRhYmxlTGlzdCgpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChpc1JldmVyc2VkKSB7XG4gICAgICAgICAgICAgICAgdGlja3MucmV2ZXJzZSgpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVha3MgPSB0aWNrc1xuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZ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3MuaXNFbXB0eSgpKSB7XG4gICAgICAgICAgICBsaXN0T2Yobm9ybWFsU3RhcnQpXG4gICAgICAgIH0gZWxzZSBpZiAoaXNSZXZlcnNlZCkge1xuICAgICAgICAgICAgYnJlYWtzLmFzUmV2ZXJzZWQoKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgYnJlYWtzXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgcHJpdmF0ZSBmdW4gY29tcHV0ZU5pY2VTdGVwKFxuICAgICAgICAgICAgc3BhbjogRG91YmxlLFxuICAgICAgICAgICAgY291bnQ6IEludFxuICAgICAgICApOiBEb3VibGUge1xuICAgICAgICAgICAgLy8gY29tcHV0ZSBzdGVwIHNvIHRoYXQgaXQgaXMgbXVsdGlwbGUgb2YgMTAsIDUgb3IgMi5cbiAgICAgICAgICAgIHZhbCBzdGVwUmF3ID0gc3BhbiAvIGNvdW50XG4gICAgICAgICAgICB2YWwgc3RlcDEwUG93ZXIgPSBmbG9vcihsb2cxMChzdGVwUmF3KSlcbiAgICAgICAgICAgIHZhbCBzdGVwID0gMTAuMC5wb3coc3RlcDEwUG93ZXIpXG4gICAgICAgICAgICB2YWwgZXJyb3IgPSBzdGVwICogY291bnQgLyBzcGFuXG4gICAgICAgICAgICByZXR1cm4gd2hlbiB7XG4gICAgICAgICAgICAgICAgZXJyb3IgPD0gMC4xNSAtPiBzdGVwICogMTAuMFxuICAgICAgICAgICAgICAgIGVycm9yIDw9IDAuMzUgLT4gc3RlcCAqIDUuMFxuICAgICAgICAgICAgICAgIGVycm9yIDw9IDAuNzUgLT4gc3RlcCAqIDIuMFxuICAgICAgICAgICAgICAgIGVsc2UgLT4gc3RlcFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gY29tcHV0ZU5pY2VCcmVha3MoXG4gICAgICAgICAgICBzdGFydDogRG91YmxlLFxuICAgICAgICAgICAgZW5kOiBEb3VibGUsXG4gICAgICAgICAgICBzdGVwOiBEb3VibGVcbiAgICAgICAgKTogTGlzdDxEb3VibGU+IHtcbiAgICAgICAgICAgIGlmIChzdGVwID09IDAuMCkgcmV0dXJuIGVtcHR5TGlzdCgpXG5cbiAgICAgICAgICAgIC8vIGV4dGVuZCByYW5nZSB0byBhbGxvdyBmb3IgRlAgZXJyb3JzXG4gICAgICAgICAgICB2YWwgZGVsdGEgPSBzdGVwIC8gMTAwMDBcbiAgICAgICAgICAgIHZhbCBzdGFydEUgPSBzdGFydCAtIGRlbHRhXG4gICAgICAgICAgICB2YWwgZW5kRSA9IGVuZCArIGRlbHRhXG5cbiAgICAgICAgICAgIHZhbCBicmVha3MgPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgICAgICB2YXIgdGljayA9IGNlaWwoc3RhcnRFIC8gc3RlcCkgKiBzdGVwXG4gICAgICAgICAgICBpZiAoc3RhcnQgPj0gMCAmJiBzdGFydEUgPCAwKSB7XG4gICAgICAgICAgICAgICAgLy8gYXZvaWQgbmVnYXRpdmUgemVyb1xuICAgICAgICAgICAgICAgIHRpY2sgPSAwLjBcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHdoaWxlICh0aWNrIDw9IGVuZEUpIHtcbiAgICAgICAgICAgICAgICAvLyBkb24ndCBhbGxvdyB0aWNrcyB0byBnbyBiZXlvbmQgdGhlIHJhbmdlXG4gICAgICAgICAgICAgICAgdGljayA9IG1pbih0aWNrLCBlbmQpXG5cbiAgICAgICAgICAgICAgICBicmVha3MuYWRkKHRpY2spXG4gICAgICAgICAgICAgICAgdGljayArPSBzdGVwXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBicmVha3NcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGl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ICAgdmFyIHR5cGUgPSBcImZcIlxuICAgICAgICB2YXIgZGVsaW1pdGVyID0gXCJcIlxuXG4gICAgICAgIHZhbCBkb21haW4xMFBvd2VyID0gbG9nMTAoYWJzKHZhbHVlKSlcbiAgICAgICAgdmFsIHN0ZXAxMFBvd2VyID0gbG9nMTAoc3RlcClcblxuICAgICAgICB2YXIgcHJlY2lzaW9uID0gLXN0ZXAxMFBvd2VyXG4gICAgICAgIHZhciBzY2llbnRpZmljTm90YXRpb24gPSBmYWxzZVxuICAgICAgICBpZiAoZG9tYWluMTBQb3dlciA8IDAgJiYgc3RlcDEwUG93ZXIgPCAtNCkge1xuICAgICAgICAgICAgc2NpZW50aWZpY05vdGF0aW9uID0gdHJ1ZVxuICAgICAgICAgICAgdHlwZSA9IFwiZVwiXG4gICAgICAgICAgICBwcmVjaXNpb24gPSBkb21haW4xMFBvd2VyIC0gc3RlcDEwUG93ZXJcbiAgICAgICAgfSBlbHNlIGlmIChkb21haW4xMFBvd2VyID4gNyAmJiBzdGVwMTBQb3dlciA+IDIpIHtcbiAgICAgICAgICAgIHNjaWVudGlmaWNOb3RhdGlvbiA9IHRydWVcbiAgICAgICAgICAgIHByZWNpc2lvbiA9IGRvbWFpbjEwUG93ZXIgLSBzdGVwMTBQb3dlclxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHByZWNpc2lvbiA8IDApIHtcbiAgICAgICAgICAgIHByZWNpc2lvbiA9IDAuMFxuICAgICAgICAgICAgdHlwZSA9IFwiZFwiXG4gICAgICAgIH1cbiAgICAgICAgLy8gcm91bmQtdXAgcHJlY2lzaW9uIHVsbGVzcyBpdCdzIHZlcnkgY2xvc2UgdG8gc21hbGxlciBpbnQuXG4gICAgICAgIHByZWNpc2lvbiA9IGNlaWwocHJlY2lzaW9uIC0gMC4wMDEpXG5cbiAgICAgICAgaWYgKHNjaWVudGlmaWNOb3RhdGlvbikge1xuICAgICAgICAgICAgdHlwZSA9IGlmIChkb21haW4xMFBvd2VyID4gMCA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IGksIG15RG9tYWluU3RhcnQgKyBidWNrZXRTaXplICogKGkgKyAxKSk7XG4gICAgLy8gVG9EbzogbW92ZSBpbnNpZGUgdGhlIGN5Y2xlXG4gICAgLy8gbGFzdCBidWNrZXQgLSBjbG9zZWRcbiAgICB2YWwgZG9tYWluUXVhbnRpemVkOiBMaXN0PENsb3NlZFJhbmdlPERvdWJsZT4+XG4gICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgIGlmIChteURvbWFpblN0YXJ0ID09IG15RG9tYWluRW5kKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGxpc3RPZihDbG9zZWRSYW5nZShteURvbWFpblN0YXJ0LCBteURvbWFpbkVuZCkpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbCBsaXN0ID0gQXJyYXlMaXN0PENsb3NlZFJhbmdlPERvdWJsZT4+KClcbiAgICAgICAgICAgIHZhbCBudW1CdWNrZXRzID0gbXlPdXRwdXRWYWx1ZXMuc2l6ZVxuICAgICAgICAgICAgdmFsIGJ1Y2tldFNpemUgPSBidWNrZXRTaXplKClcbiAgICAgICAgICAgIGZvciAoaSBpbiAwIHVudGlsIG51bUJ1Y2tldHMgLSAxKSB7XG4gICAgICAgICAgICAgICAgdmFsIGJ1Y2tldCA9IENsb3NlZFJhbmdlKG15RG9tYWluU3RhcnQgKyBidWNrZXRTaXplICogaSwgbXlEb21haW5TdGFydCArIGJ1Y2tldFNpemUgKiAoaSArIDEpKVxuICAgICAgICAgICAgICAgIGxpc3QuYWRkKGJ1Y2tldClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhbCBidWNrZXQgPSBDbG9zZWRSYW5nZShteURvbWFpblN0YXJ0ICsgYnVja2V0U2l6ZSAqIChudW1CdWNrZXRzIC0gMSksIG15RG9tYWluRW5kKVxuICAgICAgICAgICAgbGlzdC5hZGQoYnVja2V0KVxuICAgICAgICAgICAgcmV0dXJuIGxpc3RcbiAgICAgICAgfVxuXG4gICAgLyoqXG4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cihnZW5lcmF0ZUJyZWFrVmFsdWVzKGRvbWFpbiwgdGFyZ2V0Q291bnQpKVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBpbnRlcm5hbCBmdW4gZ2VuZXJhdGVCcmVha1ZhbHVlcyhkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sIHRhcmdldENvdW50OiBJbnQpOiBMaXN0PERvdWJsZT4ge1xuICAgICAgICAgICAgdmFsIGhlbHBlciA9IExpbmVhckJyZWFrc0hlbHBlcihcbiAgICAgICAgICAgICAgICBkb21haW4ubG93ZXJFbmQsXG4gICAgICAgICAgICAgICAgZG9tYWluLnVwcGVyRW5kLFxuICAgICAgICAgICAgICAgIHRhcmdldENvdW50XG4gICAgICAgICAgICApXG4gICAgICAgICAgICByZXR1cm4gaGVscGVyLmJyZWFrc1xuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gY3JlYXRlRm9ybWF0dGVyKGJyZWFrVmFsdWVzOiBMaXN0PERvdWJsZT4pOiAoQW55KSAtPiBTdHJpbmcge1xuICAgICAgICAgICAgdmFsIChyZWZlcmVuY2VWYWx1ZSwgc3RlcCkgPSB3aGVuIHtcbiAgICAgICAgICAgICAgICBicmVha1ZhbHVlcy5pc0VtcHR5KCkgLT4gUGFpcigwLjAsIDAuNSlcbiAgICAgICAgICAgICAgICBlbHNlIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHYgPSBtYXgoYWJzKGJyZWFrVmFsdWVzLmZpcnN0KCkpLCBhYnMoYnJlYWtWYWx1ZXMubGFzdCgpKSlcbiAgICAgICAgICAgICAgICAgICAgdmFsIHMgPSB3aGVuIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrVmFsdWVzLnNpemUgPT0gMSAtPiB2IC8gMTBcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgLT4gYWJzKGJyZWFrVmFsdWVzWzFdIC0gYnJlYWtWYWx1ZXNb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lkZGxlIC0gMC41XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIENsb3NlZFJhbmdlKG1heChsb3dlciwgTE9XRVJfTElNX0RPTUFJTiksIG1pZGRsZSArIDAuNSlcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gdG9BcHBsaWNhYmxlRG9tYWluKHJhbmdlOiBDbG9zZWRSYW5nZTxEb3VibGU+KTogQ2xvc2VkUmFuZ2U8RG91YmxlPiB7XG4gICAgICAgIHZhbCBsb3dlciA9IG1heChyYW5nZS5sb3dlckVuZCwgTE9XRVJfTElNX0RPTUFJTilcbiAgICAgICAgdmFsIHVwcGVyID0gbWF4KHJhbmdlLnVwcGVyRW5kLCBsb3dlcilcbiAgICAgICAgcmV0dXJuIENsb3NlZFJhbmdlKGxvd2VyLCB1cHBlcilcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgaW50ZXJuYWwgY29uc3QgdmFsIExPV0VSX0xJTV9UUkFOU0ZPVE1FRDogRG91YmxlID0gLURvdWJsZS5NQVhfVkFMVUUgLyAxMFxuICAgICAgICBpbnRlcm5hbCBjb25zdCB2YWwgTE9XRVJfTElNX0RPTUFJTjogRG91YmxlID0gRG91YmxlLk1JTl9WQUxVRSAqIDEwXG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEF2b2lkIHRyYW5zZm9ybWluZyAwLjAgLT4gLUluZmluaXR5XG4gICAgICAgICAqL1xuICAgICAgICBwcml2YXRlIGZ1biB0cmltSW5maW5pdHkodjogRG91YmxlPyk6IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIHdoZW4ge1xuICAgICAgICAgICAgICAgIHYgPT0gbnVsbCAtPiBudWxsXG4gICAgICAgICAgICAgICAgdi5pc05hTigpIC0+IERvdWJsZS5OYU5cbiAgICAgICAgICAgICAgICBlbHNlIC0+IG1heChMT1dFUl9MSU1fVFJBTlNGT1RNRUQsIHYpXG4gICAgICAgICAgICB9XG4gICAgICA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sdWU6IERvdWJsZSwgc3RlcDogRG91YmxlKTogKEFueSkgLT4gU3RyaW5nIHtcbiAgICAgICAgICAgIHJldHVybiBOdW1lcmljQnJlYWtGb3JtYXR0ZXIoXG4gICAgICAgICAgICAgICAgZG9tYWluVmFsdWUsXG4gICAgICAgICAgICAgICAgc3RlcCxcbiAgICAgICAgICAgICAgICB0cnVlXG4gICAgICAgICAgICApOjphcHBseVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBjbGFzcyBNdWx0aUZvcm1hdHRlcihcbiAgICAgICAgdmFsIGJyZWFrVmFsdWVzOiBMaXN0PERvdWJsZT4sXG4gICAgICAgIHZhbCBicmVha0Zvcm1hdHRlcnM6IExpc3Q8KEFueSkgLT4gU3RyaW5nPlxuICAgICkge1xuICAgICAgICBpbml0IHtcbiAgICAgICAgICAgIGNoZWNrKGJyZWFrVmFsdWVzLnNpemUgPT0gYnJlYWtGb3JtYXR0ZXJzLnNpemUpIHtcbiAgICAgICAgICAgICAgICBcIk11bHRpRm9ybWF0dGVyOiBicmVha1ZhbHVlcy5zaXplPSR7YnJlYWtWYWx1ZXMuc2l6ZX0gYnV0IGJyZWFrRm9ybWF0dGVycy5zaXplPSR7YnJlYWtGb3JtYXR0ZXJzLnNpemV9XCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChicmVha1ZhbHVlcy5zaXplID4gMSkge1xuICAgICAgICAgICAgICAgIHZhbCBvcmRlcmVkID0gYnJlYWtWYWx1ZXNcbiAgICAgICAgICAgICAgICAgICAgLm1hcEluZGV4ZWQgeyBpLCB2IC0+IGlmIChpID09IDApIDAuMCBlbHNlIHYgLSBicmVha1ZhbHVlc1tpIC0gMV0gfVxuICAgICAgICAgICAgICAgICAgICAuYWxsIHsgaXQgPj0gMC4wIH1cbiAgICAgICAgICAgICAgICBjaGVjayhvcmRlcmVkKSB7IFwiTXVsdGlGb3JtYXR0ZXI6IHZhbHVlcyBtdXN0IGJlIHNvcnRlZC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WYgKG4gPiBNQVhfTikge1xuLy8gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiVGhlIGlucHV0IE54IFwiICsgbiArIFwiID4gXCIgKyBNQVhfTiArIFwiaXMgdG9vIGxhcmdlIVwiKVxuLy8gICAgICAgICAgICB9XG4vLyAgICAgICAgICAgIGZpZWxkID0gblxuLy8gICAgICAgIH1cbi8vICAgIHZhciBueSA9IERFRl9OXG4vLyAgICAgICAgc2V0KG4pIHtcbi8vICAgICAgICAgICAgaWYgKG4gPiBNQVhfTikge1xuLy8gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiVGhlIGlucHV0IE55IFwiICsgbiArIFwiID4gXCIgKyBNQVhfTiArIFwiaXMgdG9vIGxhcmdlIVwiKVxuLy8gICAgICAgICAgICB9XG4vLyAgICAgICAgICAgIGZpZWxkID0gblxuLy8gICAgICAgIH1cbi8vICAgIHZhciBpc0NvbnRvdXIgPSBERUZfQ09OVE9VUlxuLy8gICAgdmFyIGJhbmRXaWR0aE1ldGhvZDogRGVuc2l0eVN0YXQuQmFuZFdpZHRoTWV0aG9kID1cbi8vICAgICAgICBEZW5zaXR5U3RhdC5CYW5kV2lkdGhNZXRob2QuTlJEXG4vLyAgICAgICAgc2V0KGJ3KSB7XG4vLyAgICAgICAgICAgIGZpZWxkID0gYndcbi8vICAgICAgICAgICAgYmFuZFdpZHRocyA9IG51bGxcbi8vICAgICAgICB9XG4vLyAgICBwcml2YXRlIHZhciBteUJpbkNvdW50ID0gREVGX0JJTl9DT1VOVFxuLy8gICAgcHJpdmF0ZSB2YXIgbXlCaW5XaWR0aDogRG91YmxlID0gMC50b0RvdWJsZSgpXG5cbi8vICAgIHByb3RlY3RlZCB2YWwgYmFuZFdpZHRoczogRG91YmxlQXJyYXlcblxuICAgIHByb3RlY3RlZCB2YWwga2VybmVsRnVuOiAoKERvdWJsZSkgLT4gRG91Ym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geUNvdW50QW5kV2lkdGhGaW5hbC53aWR0aCxcbiAgICAgICAgICAgIEJpblN0YXRVdGlsLndlaWdodEF0SW5kZXgoZGF0YSksXG4gICAgICAgICAgICBkZW5zaXR5Tm9ybWFsaXppbmdGYWN0b3JcbiAgICAgICAgKVxuXG4gICAgICAgIHJldHVybiBEYXRhRnJhbWUuQnVpbGRlcigpXG4gICAgICAgICAgICAucHV0TnVtZXJpYyhTdGF0cy5YLCBiaW5zRGF0YS54KVxuICAgICAgICAgICAgLnB1dE51bWVyaWMoU3RhdHMuWSwgYmluc0RhdGEueSlcbiAgICAgICAgICAgIC5wdXROdW1lcmljKFN0YXRzLkNPVU5ULCBiaW5zRGF0YS5jb3VudClcbiAgICAgICAgICAgIC5wdXROdW1lcmljKFN0YXRzLkRFTlNJVFksIGJpbnNEYXRhLmRlbnNpdHkpXG4gICAgICAgICAgICAuYnVpbGQoKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNvbXB1dGVCaW5zKFxuICAgICAgICB4VmFsdWVzOiBMaXN0PERvdWJsZT8+LFxuICAgICAgICB5VmFsdWVzOiBMaXN0PERvdWJsZT8+LFxuICAgICAgICB4U3RhcnQ6IERvdWJsZSxcbiAgICAgICAgeVN0YXJ0OiBEb3VibGUsXG4gICAgICAgIGJpbkNvdW50WDogSW50LFxuICAgICAgICBiaW5Db3VudFk6IEludCxcbiAgICAgICAgYmluV2lkdGg6IERvdWJsZSxcbiAgICAgICAgYmluSGVpZ2h0OiBEb3VibGUsXG4gICAgICAgIHdlaWdodEF0SW5kZXg6IChJbnQpIC0+IERvdWJsZSxcbiAgICAgICAgZGVuc2l0eU5vcm1hbGl6aW5nRmFjdG9yOiBEb3VibGVcbiAgICApOiBCaW5zMmREYXRhIHtcblxuICAgICAgICB2YXIgdG90YWxDb3VudCA9IDAuMFxuICAgICAgICB2YWwgY291bnRCeUJpbkluZGV4S2V5ID0gSGFzaE1hcDxQYWlyPEludCwgSW50PiwgTXV0YWJsZURvdWJsZT4oKVxuICAgICAgICBmb3IgKGRhdGFJbmRleCBpbiB4VmFsdWVzLmluZGljZXMpIHtcbiAgICAgICAgICAgIHZhbCB4ID0geFZhbHVlc1tkYXRhSW5kZXhdXG4gICAgICAgICAgICB2YWwgeSA9IHlWYWx1ZXNbZGF0YUluZGV4XVxuICAgICAgICAgICAgaWYgKCFTZXJpZXNVdGlsLmFsbEZpbml0ZSh4LCB5KSkge1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YWwgd2VpZ2h0ID0gd2VpZ2h0QXRJbmRleChkYXRhSW5kZXgpXG4gICAgICAgICAgICB0b3RhbENvdW50ICs9IHdlaWdodFxuICAgICAgICAgICAgdmFsIGJpbkluZGV4WCA9IGZsb29yKCh4ISEgLSB4U3RhcnQpIC8gYmluV2lkdGgpLnRvSW50KClcbiAgICAgICAgICAgIHZhbCBiaW5JbmRleFkgPSBmbG9vcigoeSEhIC0geVN0YXJ0KSAvIGJpbkhlaWdodCkudG9JbnQoKVxuICAgICAgICAgICAgdmFsIGJpbkluZGV4S2V5ID0gUGFpcihiaW5JbmRleFgsIGJpbkluZGV4WSlcbiAgICAgICAgICAgIGlmICghY291bnRCeUJpbkluZGV4S2V5LmNvbnRhaW5zS2V5KGJpbkluZGV4S2V5KSkge1xuICAgICAgICAgICAgICAgIGNvdW50QnlCaW5JbmRleEtleVtiaW5JbmRleEtleV0gPSBNdXRhYmxlRG91YmxlKDAuMClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvdW50QnlCaW5JbmRleEtleVtiaW5JbmRleEtleV0hIS5nZXRBbmRBZGQod2VpZ2h0KVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHhzID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICB2YWwgeXMgPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgIHZhbCBjb3VudHMgPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgIHZhbCBkZW5zaXRpZXMgPSBBcnJheUxpc3Q8RG91YmxlPigpXG5cbiAgICAgICAgdmFsIHgwID0geFN0YXJ0ICsgYmluV2lkdGggLyAyXG4gICAgICAgIHZhbCB5MCA9IHlTdGFydCArIGJpbkhlaWdodCAvIDJcbiAgICAgICAgZm9yICh4SW5kZXggaW4gMCB1bnRpbCBiaW5Db3VudFgpIHtcbiAgICAgICAgICAgIGZvciAoeUluZGV4IGluIDAgdW50aWwgYmluQ291bnRZKSB7XG4gICAgICAgICAgICAgICAgdmFsIGJpbkluZGV4S2V5ID0gUGFpcih4SW5kZXgsIHlJbmRleClcbiAgICAgICAgICAgICAgICB2YXIgY291bnQgPSAwLjBcbiAgICAgICAgICAgICAgICBpZiAoY291bnRCeUJpbkluZGV4S2V5LmNvbnRhaW5zS2V5KGJpbkluZGV4S2V5KSkge1xuICAgICAgICAgICAgICAgICAgICBjb3VudCA9IGNvdW50QnlCaW5JbmRleEtleVtiaW5JbmRleEtleV0hIS5nZXQoKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChkcm9wICYmIGNvdW50ID09IDAuMCkge1xuICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHhzLmFkZCh4MCArIHhJbmRleCAqIGJpbldpZHRoKVxuICAgICAgICAgICAgICAgIHlzLmFkZCh5MCArIHlJbmRleCAqIGJpbkhlaWdodClcbiAgICAgICAgICAgICAgICBjb3VudHMuYWRkKGNvdW50KVxuICAgICAgICAgICAgICAgIHZhbCBkZW5zaXR5ID0gY291bnQgLyB0b3RhbENvdW50ICogZGVuc2l0eU5vcm1hbGl6aW5nRmFjdG9yXG4gICAgICAgICAgICAgICAgZGVuc2l0aWVzLmFkZChkZW5zaXR5KVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIEJpbnMyZERhdGEoeHMsIHlzLCBjb3Vud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2hvaXNlIC0gY2FuIGJlIGFueSBwb3NpdGl2ZSBudW0pIHRvXG4gICAgICAgICAgICAgICAgLy8gYXZvaWQgZGF0YS1wb2ludHMgb24gdGhlIG1hcmdpbmFsIGJpbiBtYXJnaW5lcy5cbiAgICAgICAgICAgICAgICB2YWwgZXhwID0gYmluV2lkdGggLyAyLjBcbiAgICAgICAgICAgICAgICBleHBhbmQociwgZXhwLCBleHApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBkZW5zaXR5Tm9ybWFsaXppbmdGYWN0b3IoXG4gICAgICAgICAgICB4U3BhbjogRG91YmxlLFxuICAgICAgICAgICAgeVNwYW46IERvdWJsZSxcbiAgICAgICAgICAgIGNvdW50OiBJbnRcbiAgICAgICAgKTogRG91YmxlIHtcbiAgICAgICAgICAgIC8vIGRlbnNpdHkgc2hvdWxkIGludGVncmF0ZSB0byAxLjBcbiAgICAgICAgICAgIHZhbCBhcmVhID0geFNwYW4gKiB5U3BhblxuICAgICAgICAgICAgdmFsIGJpbkFyZWEgPSBhcmVhIC8gY291bnRcbiAgICAgICAgICAgIHJldHVybiAxLjAgLyBiaW5BcmVhXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjbGFzcyBCaW5zMmREYXRhKFxuICAgICAgICBpbnRlcm5hbCB2YWwgeDogTGlzdDxEb3VibGU+LFxuICAgICAgICBpbnRlcm5hbCB2YWwgeTogTGlzdDxEb3VibGU+LFxuICAgICAgICBpbnRlcm5hbCB2YWwgY291bnQ6IExpc3Q8RG91YmxlPixcbiAgICAgICAgaW50ZXJuYWwgdmFsIGRlbnNpdHk6IExpc3Q8RG91YmxlPlxuICAgIClcblxuICAgIGNsYXNzIEJpbnMyZFdlaWdodGVkQ291bnRzKFxuICAgICAgICBpbnRlcm5hbCB2YWwgdG90YWw6IERvdWJsZSxcbiAgICAgICAgaW50ZXJuYWwgdmFsIGNvdW50QnlCaW5YWTogTWFwPFBhaXI8RG91YmxlL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Expc3Q8RG91YmxlPz5cbiAgICApOiBCaW5TdGF0VXRpbC5CaW5zRGF0YSB7XG4gICAgICAgIHZhciBzdGFydFg6IERvdWJsZT8gPSByYW5nZVgubG93ZXJFbmRcbiAgICAgICAgdmFyIHNwYW5YID0gcmFuZ2VYLnVwcGVyRW5kIC0gc3RhcnRYISFcblxuICAgICAgICAvLyBpbml0aWFsIGJpbiBjb3VudC93aWR0aFxuICAgICAgICB2YXIgYjogQmluU3RhdFV0aWwuQ291bnRBbmRXaWR0aCA9IEJpblN0YXRVdGlsLmJpbkNvdW50QW5kV2lkdGgoc3BhblgsIGJpbk9wdGlvbnMpXG5cbiAgICAgICAgLy8gYWRqdXN0ZWQgYmluIGNvdW50L3dpZHRoXG4gICAgICAgIC8vIGV4dGVuZCB0aGUgZGF0YSByYW5nZSBieSAwLjcgb2YgYmluV2lkdGggb24gZWFjaCBlbmRzICh0byBhbGxvdyBsaW1pdGVkIGhvcml6b250YWwgYWRqdXN0bWVudHMpXG4gICAgICAgIHN0YXJ0WCAtPSBiLndpZHRoICogMC43XG4gICAgICAgIHNwYW5YICs9IGIud2lkdGggKiAxLjRcbiAgICAgICAgYiA9IEJpblN0YXRVdGlsLmJpbkNvdW50QW5kV2lkdGgoc3BhblgsIGJpbk9wdGlvbnMpXG4gICAgICAgIHZhbCBiaW5Db3VudCA9IGIuY291bnRcbiAgICAgICAgdmFsIGJpbldpZHRoID0gYi53aWR0aFxuXG4gICAgICAgIC8vIG9wdGlvbmFsIGhvcml6b250YWwgYWRqdXN0bWVudCAoKy8tMC41IGJpbiB3aWR0aCBtYXgpXG4gICAgICAgIGlmICh4UG9zS2luZCAhPSBYUG9zS2luZC5OT05FKSB7XG4gICAgICAgICAgICB2YXIgbWluRGVsdGEgPSBEb3VibGUuTUFYX1ZBTFVFXG4gICAgICAgICAgICB2YWwgeCA9IHhQb3NcblxuICAgICAgICAgICAgZm9yIChpIGluIDAgdW50aWwgYmluQ291bnQpIHtcbiAgICAgICAgICAgICAgICB2YWwgYmluTGVmdCA9IHN0YXJ0WCArIGkgKiBiaW5XaWR0aFxuICAgICAgICAgICAgICAgIHZhbCBkZWx0YTogRG91YmxlXG4gICAgICAgICAgICAgICAgaWYgKHhQb3NLaW5kID09IFhQb3NLaW5kLkNFTlRFUikge1xuICAgICAgICAgICAgICAgICAgICBkZWx0YSA9IHggLSAoYmluTGVmdCArIGJpbldpZHRoIC8gMilcbiAgICAgICAgICAgICAgICB9IGVsc2UgeyAgICAgICAvLyBCT1VOREFSWVxuICAgICAgICAgICAgICAgICAgICBpZiAoaSA9PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtaW5EZWx0YSA9IHggLSBzdGFydFggLy8gaW5pdCBzdGlsbFxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGRlbHRhID0geCAtIChiaW5MZWZ0ICsgYmluV2lkdGgpXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKGFicyhkZWx0YSkgPCBhYnMobWluRGVsdGEpKSB7XG4gICAgICAgICAgICAgICAgICAgIG1pbkRlbHRhID0gZGVsdGFcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIG1heCBvZmZzZXQ6ICsvLTAuNSBiaW4gd2lkdGhcbiAgICAgICAgICAgIHZhbCBvZmZzZXQgPSBtaW5EZWx0YSAlIChiaW5XaWR0aCAvIDIpXG4gICAgICAgICAgICBzdGFydFggKz0gb2Zmc2V0XG4gICAgICAgIH1cblxuICAgICAgICAvLyBkZW5zaXR5IHBsb3QgYXJlYSBzaG91bGQgYmUgPT0gMVxuICAgICAgICB2YWwgbm9ybWFsQmluV2lkdGggPSBTZXJpZXNVdGlsLnNwYW4ocmFuZ2VYKSAvIGJpbkNvdW50XG4gICAgICAgIHZhbCBkZW5zaXR5Tm9ybWFsaXppbmdGYWN0b3IgPSBpZiAobm9ybWFsQmluV2lkdGggPiAwKVxuICAgICA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CAwLjApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHsgMS4wIH1cbiAgICB9XG5cbiAgICAvLyBUb0RvOiBuZWVkIHRvIGRlYWwgZml0aCBuL2EgdmFsdWVzIChzZWUgRGVuc2l0eVN0YXQpXG4gICAgZnVuIHdlaWdodFZlY3RvcihkYXRhTGVuZ3RoOiBJbnQsIGRhdGE6IERhdGFGcmFtZSk6IExpc3Q8RG91YmxlPz4ge1xuICAgICAgICByZXR1cm4gaWYgKGRhdGEuaGFzKFRyYW5zZm9ybVZhci5XRUlHSFQpKSB7XG4gICAgICAgICAgICBkYXRhLmdldE51bWVyaWMoVHJhbnNmb3JtVmFyLldFSUdIVClcbiAgICAgICAgfSBlbHNlIExpc3QoZGF0YUxlbmd0aCkgeyAxLjAgfVxuICAgIH1cblxuICAgIGZ1biBiaW5Db3VudEFuZFdpZHRoKGRhdGFSYW5nZTogRG91YmxlLCBiaW5PcHRpb25zOiBCaW5PcHRpb25zKTogQ291bnRBbmRXaWR0aCB7XG4gICAgICAgIHZhciBiaW5Db3VudCA9IGJpbk9wdGlvbnMuYmluQ291bnRcbiAgICAgICAgdmFsIGJpbldpZHRoOiBEb3VibGVcbiAgICAgICAgaWYgKGJpbk9wdGlvbnMuaGFzQmluV2lkdGgoKSkge1xuICAgICAgICAgICAgYmluV2lkdGggPSBiaW5PcHRpb25zLmJpbldpZHRoISFcbiAgICAgICAgICAgIHZhciBjb3VudCA9IGRhdGFSYW5nZSAvIGJpbldpZHRoXG4gICAgICAgICAgICBjb3VudCA9IG1pbihNQVhfQklOX0NPVU5ULnRvRG91YmxlKCksIGNvdW50KVxuICAgICAgICAgICAgYmluQ291bnQgPSBjZWlsKGNvdW50KS50b0ludCgpXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBiaW5XaWR0aCA9IGRhdGFSYW5nZSAvIGJpbkNvdW50XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIENvdW50QW5kV2lkdGgoYmluQ291bnQsIGJpbldpZHRoKVxuICAgIH1cblxuICAgIGZ1biBjb21wdXRlQmlucyhcbiAgICAgICAgdmFsdWVzWDogTGlzdDxEb3VibGU/PixcbiAgICAgICAgc3RhcnRYOiBEb3VibGUsXG4gICAgICAgIGJpbkNvdW50OiBJbnQsXG4gICAgICAgIGJpbldpZHRoOiBEb3VibGUsXG4gICAgICAgIHdlaWdodEF0SW5kZXg6IChJbnQpIC0+IERvdWJsZSxcbiAgICAgICAgZGVuc2l0eU5vcm1hbGl6aW5nRmFjdG9yOiBEb3VibGVcbiAgICApOiBCaW5zRGF0YSB7XG5cbiAgICAgICAgdmFyIHRvdGFsQ291bnQgPSAwLjBcbiAgICAgICAgdmFsIGNvdW50QnlCaW5JbmRleCA9IEhhc2hNYXA8SW50LCBNdXRhYmxlRG91YmxlPigpXG4vLyAgICAgICAgdmFsIGRhdGFJbmRpY2VzQnlCaW5JbmRleCA9IEhhc2hNYXA8SW50LCBNdXRhYmxlTGlzdDxJbnQ+PigpXG4gICAgICAgIGZvciAoZGF0YUluZGV4IGluIHZhbHVlc1guaW5kaWNlcykge1xuICAgICAgICAgICAgdmFsIHggPSB2YWx1ZXNYW2RhdGFJbmRleF1cbiAgICAgICAgICAgIGlmICghU2VyaWVzVXRpbC5pc0Zpbml0ZSh4KSkge1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YWwgd2VpZ2h0ID0gd2VpZ2h0QXRJbmRleChkYXRhSW5kZXgpXG4gICAgICAgICAgICB0b3RhbENvdW50ICs9IHdlaWdodFxuICAgICAgICAgICAgdmFsIGJpbkluZGV4ID0gZmxvb3IoKHghISAtIHN0YXJ0WCkgLyBiaW5XaWR0aCkudG9JbnQoKVxuICAgICAgICAgICAgaWYgKCFjb3VudEJ5QmluSW5kZXguY29udGFpbnNLZXkoYmluSW5kZXgpKSB7XG4gICAgICAgICAgICAgICAgY291bnRCeUJpbkluZGV4W2JpbkluZGV4XSA9IE11dGFibGVEb3VibGUoMC4wKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY291bnRCeUJpbkluZGV4W2JpbkluZGV4XSEhLmdldEFuZEFkZCh3ZWlnaHQpXG5cbi8vICAgICAgICAgICAgaWYgKCFkYXRhSW5kaWNlc0J5QmluSW5kZXguY29udGFpbnNLZXkoYmluSW5kZXgpKSB7XG4vLyAgICAgICAgICAgICAgICBkYXRhSW5kaWNlc0J5QmluSW5kZXhbYmluSW5kZXhdID0gQXJyYXlMaXN0KClcbi8vICAgICAgICAgICAgfVxuXG4vLyAgICAgICAgICAgIGRhdGFJbmRpY2VzQnlCaW5JbmRleFtiaW5JbmRleF0hIS5hZGQoZGF0YUluZGV4KVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHggPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgIHZhbCBjb3VudHMgPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgIHZhbCBkZW5zaXRpZXMgPSBBcnJheUxpc3Q8RG91YmxlPigpXG5cbiAgICAgICAgdmFsIHgwID0gc3RhcnRYICsgYmluV2lkdGggLyAyXG4gICAgICAgIGZvciAoaSBpbiAwIHVudGlsIGJpbkNvdW50KSB7XG4gICAgICAgICAgICB4LmFkZCh4MCArIGkgKiBiaW5XaWR0aClcblxuICAgICAgICAgICAgdmFyIGNvdW50ID0gMC4wXG4gICAgICAgICAgICAvLyBzb21lIGJpbnMgYXJlIGxlZnQgZW1wdHkgKG5vdCBleGNsdWRlZCBmcm9tIG1hcClcbiAgICAgICAgICAgIGlmIChjb3VudEJ5QmluSW5kZXguY29udGFpbnNLZXkoaSkpIHtcbiAgICAgICAgICAgICAgICBjb3VudCA9IGNvdW50QnlCaW5JbmRleFtpXSEhLmdldCgpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGNvdW50cy5hZGQoY291bnQpXG4gICAgICAgICAgICB2YWwgZGVuc2l0eSA9IGNvdW50IC8gd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4Q291bnRQZXJCaW4gPT0gMCkge1xuICAgICAgICAgICAgcmV0dXJuIHdpdGhFbXB0eVN0YXRWYWx1ZXMoKVxuICAgICAgICB9XG4gICAgICAgIGlmIChjb21wdXRlV2lkdGgpIHtcbiAgICAgICAgICAgIC8vICd3aWR0aCcgaXMgaW4gcmFuZ2UgMC4uMVxuICAgICAgICAgICAgdmFsIG5vcm0gPSBzcXJ0KG1heENvdW50UGVyQmluLnRvRG91YmxlKCkpXG4gICAgICAgICAgICB2YWwgc3RhdFdpZHRoID0gc3RhdENvdW50ISEubWFwIHsgY291bnQgLT4gc3FydChjb3VudCkgLyBub3JtIH1cbiAgICAgICAgICAgIHN0YXREYXRhW1N0YXRzLldJRFRIXSA9IHN0YXRXaWR0aFxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGJ1aWxkZXIgPSBEYXRhRnJhbWUuQnVpbGRlcigpXG4gICAgICAgIGZvciAoKHZhcmlhYmxlLCBzZXJpZXMpIGluIHN0YXREYXRhKSB7XG4gICAgICAgICAgICBidWlsZGVyLnB1dE51bWVyaWModmFyaWFibGUsIHNlcmllcylcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gYnVpbGRlci5idWlsZCgpXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGNvbnN0IHZhbCBERUZfV0hJU0tFUl9JUVJfUkFUSU8gPSAxLjVcbiAgICAgICAgY29uc3QgdmFsIERFRl9DT01QVVRFX1dJRFRIID0gZmFsc2VcblxuICAgICAgICBwcml2YXRlIHZhbCBERUZfTUFQUElORzogTWFwPEFlczwqPiwgRGF0YUZyYW1lLlZhcmlhYmxlPiA9IG1hcE9mKFxuICAgICAgICAgICAgQWVzLlggdG8gU3RhdHMuWCxcbiAgICAgICAgICAgIEFlcy5ZIHRvIFN0YXRzLlksXG4gICAgICAgICAgICBBZXMuWU1JTiB0byBTdGF0cy5ZX01JTixcbiAgICAgICAgICAgIEFlcy5ZTUFYIHRvIFN0YXRzLllfTUFYLFxuICAgICAgICAgICAgQWVzLkxPV0VSIHRvIFN0YXRzLkxPV0VSLFxuICAgICAgICAgICAgQWVzLk1JRERMRSB0byBTdGF0cy5NSURETEUsXG4gICAgICAgICAgICBBZXMuVVBQRVIgdG8gU3RhdHMuVVBQRVJcbiAgICAgICAgKVxuXG4gICAgICAgIGZ1biBidWlsZFN0YXQoXG4gICAgICAgICAgICB4czogTGlzdDxEb3VibGU/PixcbiAgICAgICAgICAgIHlzOiBMaXN0PERvdWJsZT8+LFxuICAgICAgICAgICAgd2hpc2tlcklRUlJhdGlvOiBEb3VibGVcbiAgICAgICAgKTogTXV0YWJsZU1hcDxEYXRhRnJhbWUuVmFyaWFibGUsIExpc3Q8RG91YmxlPj4ge1xuXG4gICAgICAgICAgICB2YWwgeHlQYWlycyA9IHhzLnppcCh5cykuZmlsdGVyIHsgKHgsIHkpIC0+XG4gICAgICAgICAgICAgICAgU2VyaWVzVXRpbC5hbGxGaW5pdGUoeCwgeSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh4eVBhaXJzLmlzRW1wdHkoKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBtdXRhYmxlTWFwT2YoKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgYmlubmVkRGF0YTogTXV0YWJsZU1hcDxEb3VibGUsIE11dGFibGVMaXN0PERvdWJsZT4+ID0gSGFzaE1hcCgpXG4gICAgICAgICAgICBmb3IgKCh4LCB5KSBpbiB4eVBhaXJzKSB7XG4gICAgICAgICAgICAgICAgYmlubmVkRGF0YS5nZXRPclB1dCh4ISEpIHsgQXJyYXlMaXN0KCkgfS5hZGQoeSEhKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgc3RhdFggPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgICAgICB2YWwgc3RhdFkgPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgICAgICB2YWwgc3RhdE1pZGRsZSA9IEFycmF5TGlzdDxEb3VibGU+KClcbiAgICAgICAgICAgIHZhbCBzdGF0TG93ZXIgPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgICAgICB2YWwgc3RhdFVwcGVyID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICAgICAgdmFsIHN0YXRNaW4gPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgICAgICB2YWwgc3RhdE1heCA9IEFycmF5TGlzdDxEb3VibGU+KClcblxuICAgICAgICAgICAgdmFsIHN0YXRDb3VudCA9IEFycmF5TGlzdDxEb3VibGU+KClcblxuICAgICAgICAgICAgZm9yICgoeCwgYmluKSBpbiBiaW5uZWREYXRhKSB7XG4gICAgICAgICAgICAgICAgdmFsIGNvdW50ID0gYmluLnNpemUudG9Eb3VibGUoKVxuXG4gICAgICAgICAgICAgICAgdmFsIHN1bW1hcnkgPSBGaXZlTnVtYmVyU3VtbWFyeShiaW4pXG4gICAgICAgICAgICAgICAgdmFsIG1pZGRsZSA9IHN1bW1hcnkubWVkaWFuXG4gICAgICAgICAgICAgICAgdmFsIGxvd2VySGluZ2UgPSBzdW1tYXJ5LmZpcnN0UXVhcnRpbGVcbiAgICAgICAgICAgICAgICB2YWwgdXBwZXJIaW5nZSA9IHN1bW1hcnkudGhpcmRRdWFydGlsZVxuICAgICAgICAgICAgICAgIHZhbCBJUVIgPSB1cHBlckhpbmdlIC0gbG93ZXJIaW5nZVxuICAgICAgICAgICAgICAgIHZhbCBsb3dlckZlbmNlID0gbG93ZXJIaW5nZSAtIElRUiAqIHdoaXNrZXJJUVJSYXRpb1xuICAgICAgICAgICAgICAgIHZhbCB1cHBlckZlbmNlID0gdXBwZXJIaW5nZSArIElRUiAqIHdoaXNrZXJJUVJSYXRpb1xuXG4gICAgICAgICAgICAgICAgdmFyIGxvd2VyV2hpc2tlciA9IGxvd2VyRmVuY2VcbiAgICAgICAgICAgICAgICB2YXIgdXBwZXJXaGlza2VyID0gdXBwZXJGZW5jZVxuICAgICAgICAgICAgICAgIGlmIChTZXJpZXNVdGlsLmFsbEZpbml0ZShsb3dlckZlbmNlLCB1cHBlckZlbmNlKSkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgYm94ZWQgPSBiaW4uZmlsdGVyIHsgeSAtPiB5ID49IGxvd2VyRmVuY2UgJiYgeSA8PSB1cHBlckZlbmNlIH1cbiAgICAgICAgICAgICAgICAgICAgdmFsIHJhbmdlID0gU2VyaWVzVXRpbC5yYW5nZShib3hlZClcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJhbmdlICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvd2VyV2hpc2tlciA9IHJhbmdlLmxvd2VyRW5kXG4gICAgICAgICAgICAgICAgICAgICAgICB1cHBlcldoaXNrZXIgPSByYW5nZS51cHBlckVuZFxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gYWRkIG91dGxpZXJzIGZpcnN0XG4gICAgICAgICAgICAgICAgdmFsIG91dGxpZXJzID0gYmluLmZpbHRlciB7IHkgLT4geSA8IGxvd2VyRmVuY2UgfHwgeSA+IHVwcGVyRmVuY2UgfVxuICAgICAgICAgICAgICAgIGZvciAoeSBpbiBvdXRsaWVycykge1xuICAgICAgICAgICAgICAgICAgICAvLyAnb3V0bGllcicgZGF0YS1wb2ludFxuICAgICAgICAgICAgICAgICAgICBzdGF0WC5hZGQoeClcbiAgICAgICAgICAgICAgICAgICAgc3RhdFkuYWRkKHkpXG4gICAgICAgICAgICAgICAgICAgIC8vIG5vICdib3gnIGRhdGFcbiAgICAgICAgICAgICAgICAgICAgc3RhdE1pZGRsZS5hZGQoRG91YmxlLk5hTilcbiAgICAgICAgICAgICAgICAgICAgc3RhdExvd2VyLmFkZChEb3VibGUuTmFOKVxuICAgICAgICAgICAgICAgICAgICBzdGF0VXBwZXIuYWRkKERvdWJsZS5OYU4pXG4gICAgICAgICAgICAgICAgICAgIHN0YXRNaW4uYWRkKERvdWJsZS5OYU4pXG4gICAgICAgICAgICAgICAgICAgIHN0YXRNYXguYWRkKERvdWJsZS5OYU4pXG5cbiAgICAgICAgICAgICAgICAgICAgc3RhdENvdW50LmFkZChjb3VudClcblxuICAgICAgICAgICAgICAgICAgICAvLyBOb3RlOiBvdXRsaWVycyB3aWxsIGFsc28gbmVlZCAnd2lkdGgnIHZhbHVlLFxuICAgICAgICAgICAgICAgICAgICAvLyBmb3IgdGhlICdkb2RnZScgcG9zaXRpb25pbmcgdG8gd29yayBjb3JyZWN0bHkgZm9yIGFsbCBkYXRhLXBvaW50cy5cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAvLyBhZGQgJ2JveCcgZGF0YS1wb2ludFxuICAgICAgICAgICAgICAgIHN0YXRYLmFkZCh4KVxuICAgICAgICAgICAgICAgIHN0YXRZLmFkZChEb3VibGUuTmFOKSAgLy8gbm8gWSBmb3IgJ2JveCcgZGF0YS1wb2ludFxuICAgICAgICAgICAgICAgIHN0YXRNaWRkbGUuYWRkKG1pZGRsZSlcbiAgICAgICAgICAgICAgICBzdGF0TG93ZXIuYWRkKGxvd2VySGluZ2UpXG4gICAgICAgICAgICAgICAgc3RhdFVwcGVyLmFkZCh1cHBlckhpbmdlKVxuICAgICAgICAgICAgICAgIHN0YXRNaW4uYWRkKGxvd2VyV2hpc2tlcilcbiAgICAgICAgICAgICAgICBzdGF0TWF4LmFkZCh1cHBlcldoaXNrZXIpXG5cbiAgICAgICAgICAgICAgICBzdGF0Q291bnQuYWRkKGNvdW50KVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gbXV0YWJsZU1hcE9mKFxuICAgICAgICAgICAgICAgIFN0YXRzLlggdG8gc3RhdFgsXG4gICAgICAgICAgICAgICAgU3RhdHMuWSB0byBzdGF0WSxcbiAgICAgICAgICAgICAgICBTdGF0cy5NSURETEUgdG8gc3RhdE1pZGRsZSxcbiAgIC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91cCA9IDAuMFxuXG4gICAgcHJpdmF0ZSB2YWwgZGF0YUZyYW1lOiBEYXRhRnJhbWVcbiAgICAgICAgZ2V0KCkgPSBEYXRhRnJhbWUuQnVpbGRlcigpXG4gICAgICAgICAgICAgICAgLnB1dE51bWVyaWMoU3RhdHMuWCwgbXlDb250b3VyWClcbiAgICAgICAgICAgICAgICAucHV0TnVtZXJpYyhTdGF0cy5ZLCBteUNvbnRvdXJZKVxuICAgICAgICAgICAgICAgIC5wdXROdW1lcmljKFN0YXRzLkxFVkVMLCBteUNvbnRvdXJMZXZlbClcbiAgICAgICAgICAgICAgICAucHV0TnVtZXJpYyhTdGF0cy5HUk9VUCwgbXlDb250b3VyR3JvdXApXG4gICAgICAgICAgICAgICAgLmJ1aWxkKClcblxuICAgIGZ1biBhZGQocG9seWdvbjogTGlzdDxEb3VibGVWZWN0b3I+LCBmaWxsTGV2ZWw6IERvdWJsZSkge1xuICAgICAgICBmb3IgKHAgaW4gcG9seWdvbikge1xuICAgICAgICAgICAgbXlDb250b3VyWC5hZGQocC54KVxuICAgICAgICAgICAgbXlDb250b3VyWS5hZGQocC55KVxuICAgICAgICAgICAgbXlDb250b3VyTGV2ZWwuYWRkKGZpbGxMZXZlbClcbiAgICAgICAgICAgIG15Q29udG91ckdyb3VwLmFkZChteUdyb3VwKVxuICAgICAgICB9XG4gICAgICAgIC8vIGVhY2ggcG9seWdvbiBpbiBpdHMgb3duIGdyb3VwXG4gICAgICAgIG15R3JvdXAgKz0gMS4wXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG5cbiAgICAgICAgZnVuIGdldFBhdGhEYXRhRnJhbWUoXG4gICAgICAgICAgICAgICAgbGV2ZWxzOiBMaXN0PERvdWJsZT4sIHBhdGhMaXN0QnlMZXZlbDogTWFwPERvdWJsZSwgTGlzdDxMaXN0PERvdWJsZVZlY3Rvcj4+Pik6IERhdGFGcmFtZSB7XG4gICAgICAgICAgICB2YWwgY29udG91ciA9IENvbnR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+KClcbiAgICAgICAgICAgIGlmIChpID4gMCkge1xuICAgICAgICAgICAgICAgIHBvbHlnb25QaWVjZXMuYWRkQWxsKFxuICAgICAgICAgICAgICAgICAgICByZXZlcnNlQWxsKFxuICAgICAgICAgICAgICAgICAgICAgICAgcGF0aEJ5TGV2ZWxzW2xldmVsc1tpIC0gMV1dISFcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChpIDwgbikge1xuICAgICAgICAgICAgICAgIHBvbHlnb25QaWVjZXMuYWRkQWxsKHBhdGhCeUxldmVsc1tsZXZlbHNbaV1dISEpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwb2x5Z29uUGllY2VzID0gY3JlYXRlQ2xvc2VkUG9seWdvbkxldmVscyhwb2x5Z29uUGllY2VzLCBvdXRlck1hcCwgY29ybmVyUG9pbnRzKVxuICAgICAgICAgICAgZm9yIChwYXRoIGluIHBvbHlnb25QaWVjZXMpIHtcbiAgICAgICAgICAgICAgICB2YWx1ZS5hZGRBbGwocGF0aClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlc3VsdFtmaWxsTGV2ZWxzW2ldXSA9IHZhbHVlXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNyZWF0ZUNsb3NlZFBvbHlnb25MZXZlbHMoXG4gICAgICAgICAgICBvcGVuTGV2ZWxzOiBMaXN0PExpc3Q8RG91YmxlVmVjdG9yPj4sIG91dGVyTWFwOiBNYXA8RG91YmxlVmVjdG9yLCBEb3VibGVWZWN0b3I+LCBjb3JuZXJQb2ludHM6IExpc3Q8RG91YmxlVmVjdG9yPik6IE11dGFibGVMaXN0PExpc3Q8RG91YmxlVmVjdG9yPj4ge1xuICAgICAgICB2YWwgcmVzdWx0ID0gQXJyYXlMaXN0PExpc3Q8RG91YmxlVmVjdG9yPj4oKVxuXG4gICAgICAgIHZhbCBkb25lUGF0aCA9IEhhc2hTZXQ8TXV0YWJsZUxpc3Q8RG91YmxlVmVjdG9yPj4oKVxuICAgICAgICAvL0FkZCBib3VuZGFyeSBwYXJ0IHRvIGVhY2ggb3BlblBhdGhcbiAgICAgICAgZm9yIChsZXZlbCBpbiBvcGVuTGV2ZWxzKSB7XG4gICAgICAgICAgICB2YWwgbGV2ZWxDb3B5ID0gQXJyYXlMaXN0KGxldmVsKVxuICAgICAgICAgICAgdmFsIHAwID0gbGV2ZWxDb3B5WzBdXG4gICAgICAgICAgICB2YXIgcDEgPSBsZXZlbENvcHlbbGV2ZWxDb3B5LnNpemUgLSAxXVxuICAgICAgICAgICAgLy9pZiBjeWNsZVxuICAgICAgICAgICAgaWYgKHAwID09IHAxKSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0LmFkZChsZXZlbENvcHkpXG4gICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vcDEgcmVtYWlucyB0byBiZSB0aGUgZW5kIG9mIGxldmVsQ29weVxuICAgICAgICAgICAgdmFyIHBpMiA9IG91dGVyTWFwW3AxXSEhXG4gICAgICAgICAgICBsZXZlbENvcHkuYWRkKHBpMilcbiAgICAgICAgICAgIHAxID0gcGkyXG4gICAgICAgICAgICB3aGlsZSAoY29ybmVyUG9pbnRzLmNvbnRhaW5zKHAxKSkge1xuICAgICAgICAgICAgICAgIHBpMiA9IG91dGVyTWFwW3AxXSEhXG4gICAgICAgICAgICAgICAgbGV2ZWxDb3B5LmFkZChwaTIpXG4gICAgICAgICAgICAgICAgcDEgPSBwaTJcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGRvbmVQYXRoLmFkZChsZXZlbENvcHkpXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgcGF0aEJ5RW5kUG9pbnQgPSBIYXNoTWFwPERvdWJsZVZlY3RvciwgTXV0YWJsZUxpc3Q8RG91YmxlVmVjdG9yPj4oKVxuXG4gICAgICAgIGZvciAocGF0aCBpbiBkb25lUGF0aCkge1xuICAgICAgICAgICAgdmFsIHAwID0gcGF0aFswXVxuICAgICAgICAgICAgdmFsIHAxID0gcGF0aFtwYXRoLnNpemUgLSAxXVxuICAgICAgICAgICAgLy9pZiBjeWNsZVxuICAgICAgICAgICAgaWYgKHAwID09IHAxKSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0LmFkZChwYXRoKVxuICAgICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChwYXRoQnlFbmRQb2ludC5jb250YWluc0tleShwMCkgfHwgcGF0aEJ5RW5kUG9pbnQuY29udGFpbnNLZXkocDEpKSB7XG4gICAgICAgICAgICAgICAgLy9yZW1vdmUgbmVlZCB0byBiZSBtb2RpZmllZCBwYXRoc1xuICAgICAgICAgICAgICAgIHZhbCBwYXRoMCA9IHBhdGhCeUVuZFBvaW50W3AwXVxuICAgICAgICAgICAgICAgIHZhbCBwYXRoMSA9IHBhdGhCeUVuZFBvaW50W3AxXVxuICAgICAgICAgICAgICAgIHJlbW92ZVBhdGhCeUVuZHBvaW50cyhwYXRoMCwgcGF0aEJ5RW5kUG9pbnQpXG4gICAgICAgICAgICAgICAgcmVtb3ZlUGF0aEJ5RW5kcG9pbnRzKHBhdGgxLCBwYXRoQnlFbmRQb2ludClcblxuICAgICAgICAgICAgICAgIHZhbCBsb25nUGF0aDogTXV0YWJsZUxpc3Q8RG91YmxlVmVjdG9yPlxuICAgICAgICAgICAgICAgIGlmIChwYXRoMCA9PT0gcGF0aDEpIHtcbiAgICAgICAgICAgICAgICAgICAgLy9hIGN5Y2xlIGlzIGZvcm1lZFxuICAgICAgICAgICAgICAgICAgICBwYXRoMCEhLmFkZEFsbChwYXRoLnN1Ykxpc3QoMSwgcGF0aC5zaXplKSlcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LmFkZChwYXRoMClcbiAgICAgICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHBhdGgwICE9IG51bGwgJiYgcGF0aDEgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aCA9IHBhdGgwXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZEFsbChwYXRoLnN1Ykxpc3QoMSwgcGF0aC5zaXplIC0gMSkpXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZEFsbChwYXRoMSlcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHBhdGgwID09IG51bGwpIHsgLy9wYXRoMSE9bnVsbFxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aCA9IHBhdGgxISFcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGguYWRkQWxsKDAsIHBhdGguc3ViTGlzdCgwLCBwYXRoLnNpemUgLSAxKSlcbiAgICAgICAgICAgICAgICB9IGVsc2UgeyAvL3BhdGgwIT1udWxsXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoID0gcGF0aDBcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGguYWRkQWxsKHBhdGguc3ViTGlzdCgxLCBwYXRoLnNpemUpKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHBhdGhCeUVuZFBvaW50W2xvbmdQYXRoWzBdXSA9IGxvbmdQYXRoXG4gICAgICAgICAgICAgICAgcGF0aEJ5RW5kUG9pbnRbbG9uZ1BhdGhbbG9uZ1BhdGguc2l6ZSAtIDFdXSA9IGxvbmdQYXRoXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHBhdGhCeUVuZFBvaW50W3BhdGhbMF1dID0gcGF0aFxuICAgICAgICAgICAgICAgIHBhdGhCeUVuZFBvaW50W3BhdGhbcGF0aC5zaXplIC0gMV1dID0gcGF0aFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKCFwYXR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Gguc2l6ZSAtIDFdKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHJlc3VsdCA9IEhhc2hNYXA8RG91YmxlVmVjdG9yLCBEb3VibGVWZWN0b3I+KClcblxuICAgICAgICB2YWwgbGlzdCA9IEFycmF5TGlzdDxNdXRhYmxlTGlzdDxEb3VibGVWZWN0b3I+PigpXG4gICAgICAgIGZvciAoaSBpbiAwLi4zKSB7XG4gICAgICAgICAgICBsaXN0LmFkZChBcnJheUxpc3QoKSlcbiAgICAgICAgfVxuXG4gICAgICAgIGZvciAocG9pbnQgaW4gcG9pbnRzKSB7XG4gICAgICAgICAgICB2YWwga2luZCA9IGdldEtpbmQocG9pbnQpXG4gICAgICAgICAgICB3aGVuIChraW5kKSB7XG4gICAgICAgICAgICAgICAgQm9yZGVyS2luZC5ET1dOIC0+IGxpc3RbMF0uYWRkKHBvaW50KVxuICAgICAgICAgICAgICAgIEJvcmRlcktpbmQuUklHSFQgLT4gbGlzdFsxXS5hZGQocG9pbnQpXG4gICAgICAgICAgICAgICAgQm9yZGVyS2luZC5VUCAtPiBsaXN0WzJdLmFkZChwb2ludClcbiAgICAgICAgICAgICAgICBCb3JkZXJLaW5kLkxFRlQgLT4gbGlzdFszXS5hZGQocG9pbnQpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBsaXN0WzBdLnNvcnRXaXRoKENvbXBhcmF0b3IgeyBvMSwgbzIgLT4gbzEueC5jb21wYXJlVG8obzIueCkgfSlcbiAgICAgICAgbGlzdFsxXS5zb3J0V2l0aChDb21wYXJhdG9yIHsgbzEsIG8yIC0+IG8xLnkuY29tcGFyZVRvKG8yLnkpIH0pXG4gICAgICAgIGxpc3RbMl0uc29ydFdpdGgoQ29tcGFyYXRvciB7IG8xLCBvMiAtPiBvMi54LmNvbXBhcmVUbyhvMS54KSB9KVxuICAgICAgICBsaXN0WzNdLnNvcnRXaXRoKENvbXBhcmF0b3IgeyBvMSwgbzIgLT4gbzIueS5jb21wYXJlVG8obzEueSkgfSlcblxuICAgICAgICAvLyBBY2NvcmRpbmcgdG8gZ2V0S2luZDogbXlMb3dMZWZ0IC0+IERPV047IG15TG93UmlnaHQgLT4gRE9XTjsgbXlVcFJpZ2h0IC0+IFJJR0hUOyBteVVwTGVmdCAtPiBMRUZUXG4gICAgICAgIHZhbCBwcmVwYXJlTWFwID0gQXJyYXlMaXN0PERvdWJsZVZlY3Rvcj4oKVxuICAgICAgICBpZiAoIWxpc3RbMF0uY29udGFpbnMobXlMb3dMZWZ0KSkge1xuICAgICAgICAgICAgcHJlcGFyZU1hcC5hZGQobXlMb3dMZWZ0KVxuICAgICAgICAgICAgY29ybmVyUG9pbnRzLmFkZChteUxvd0xlZnQpXG4gICAgICAgIH1cbiAgICAgICAgcHJlcGFyZU1hcC5hZGRBbGwobGlzdFswXSlcbiAgICAgICAgaWYgKCFsaXN0WzBdLmNvbnRhaW5zKG15TG93UmlnaHQpKSB7XG4gICAgICAgICAgICBwcmVwYXJlTWFwLmFkZChteUxvd1JpZ2h0KVxuICAgICAgICAgICAgY29ybmVyUG9pbnRzLmFkZChteUxvd1JpZ2h0KVxuICAgICAgICB9XG4gICAgICAgIHByZXBhcmVNYXAuYWRkQWxsKGxpc3RbMV0pXG4gICAgICAgIGlmICghbGlzdFsxXS5jb250YWlucyhteVVwUmlnaHQpKSB7XG4gICAgICAgICAgICBwcmVwYXJlTWFwLmFkZChteVVwUmlnaHQpXG4gICAgICAgICAgICBjb3JuZXJQb2ludHMuYWRkKG15VXBSaWdodClcbiAgICAgICAgfVxuICAgICAgICBwcmVwYXJlTWFwLmFkZEFsbChsaXN0WzJdKVxuICAgICAgICBpZiAoIWxpc3RbM10uY29udGFpbnMobXlVcExlZnQpKSB7XG4gICAgICAgICAgICBwcmVwYXJlTWFwLmFkZChteVVwTGVmdClcbiAgICAgICAgICAgIGNvcm5lclBvaW50cy5hZGQobXlVcExlZnQpXG4gICAgICAgIH1cbiAgICAgICAgcHJlcGFyZU1hcC5hZGRBbGwobGlzdFszXSlcbiAgICAgICAgcHJlcGFyZU1hcC5hZGQocHJlcGFyZU1hcFswXSlcbiAgICAgICAgZm9yIChpIGluIDAgdW50aWwgcHJlcGFyZU1hcC5zaXplIC0gMSkge1xuICAgICAgICAgICAgcmVzdWx0W3ByZXBhcmVNYXBbaV1dID0gcHJlcGFyZU1hcFtpICsgMV1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBnZXRLaW5kKHBvaW50OiBEb3VibGVWZWN0b3IpOiBCb3JkZXJLaW5kIHtcbiAgICAgICAgcmV0dXJuIGlmIChiZWxvd09yT25MaW5lKFxuICAgICAgICAgICAgICAgIG15TG93TGVmdCxcbiAgICAgICAgICAgICAgICBteVVwUmlnaHQsXG4gICAgICAgICAgICAgICAgcG9pbnRcbiAgICAgICAgICAgICkgJiYgYmVsb3dPck9uTGluZShcbiAgICAgICAgICAgICAgICBteVVwTGVmdCxcbiAgICAgICAgICAgICAgICBteUxvd1JpZ2h0LFxuICAgICAgICAgICAgICAgIHBvaW50XG4gICAgICAgICAgICApXG4gICAgICAgICkge1xuICAgICAgICAgICAgQm9yZGVyS2luZC5ET1dOXG4gICAgICAgIH0gZWxzZSBpZiAoYmVsb3dPck9uTGluZShcbiAgICAgICAgICAgICAgICBteUxvd0xlZnQsXG4gICAgICAgICAgICAgICAgbXlVcFJpZ2h0LFxuICAgICAgICAgICAgICAgIHBvaW50XG4gICAgICAgICAgICApICYmICFiZWxvd09yT25MaW5lKFxuICAgICAgICAgICAgICAgIG15VXBMZWZ0LFxuICAgICAgICAgICAgICAgIG15TG93UmlnaHQsXG4gICAgICAgICAgICAgICAgcG9pbnRcbiAgICAgICAgICAgIClcbiAgICAgICAgKSB7XG4gICAgICAgICAgICBCb3JkZXJLaW5kLlJJR0hUXG4gICAgICAgIH0gZWxzZSBpZiAoIWJlbG93T3JPbkxpbmUoXG4gICAgICAgICAgICAgICAgbXlMb3dMZWZ0LFxuICAgICAgICAgICAgICAgIG15VXBSaWdodCxcbiAgICAgICAgICAgICAgICBwb2ludFxuICAgICAgICAgICAgKSAmJiAhYmVsb3dPck9uTGluZShcbiAgICAgICAgICAgICAgICBteVVwTGVmdCxcbiAgICAgICAgICAgICAgICBteUxvd1JpZ2h0LFxuICAgICAgICAgICAgICAgIHBvaW50XG4gICAgICAgICAgICApXG4gICAgICAgICkge1xuICAgICAgICAgICAgQm9yZGVyS2luZC5VUFxuICAgICAgICB9IGVsc2UgaWYgKCFiZWxvd09yT25MaW5lKFxuICAgICAgICAgICAgICAgIG15TG93TGVmdCxcbiAgICAgICAgICAgICAgICBteVVwUmlnaHQsXG4gICAgICAgICAgICAgICAgcG9pbnRcbiAgICAgICAgICAgICkgJiYgYmVsb3dPck9uTGluZShcbiAgICAgICAgICAgICAgICBteVVwTGVmdCxcbiAgICAgICAgICAgICAgICBteUxvd1JpZ2h0LFxuICAgICAgICAgICAgICAgIHBvaW50XG4gICAgICAgICAgICApXG4gICAgICAgICkge1xuICAgICAgICAgICAgQm9yZGVyS2luZC5MRUZUXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oXCJUaGUgQ29udG91ciBQb2ludCBpcyBub3Qgb24gdGhlIGJvcmRlciAkcG9pbnRcIilcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZW51bSBjbGFzcyBCb3JkZXJLaW5kIHtcbiAgICAgICAgRE9XTiwgUklHSFQsIFVQLCBMRUZUXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG5cbiAgICAgICAgZnVuIGNvbXB1dGVGaWxsTGV2ZWxzKHpSYW5nZTogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgbGV2ZWxzOiBMaXN0PERvdWJsZT4pOiBMaXN0PERvdWJsZT4ge1xuICAgICAgICAgICAgdmFsIGZpb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mlzU3ViVGlueVxuaW1wb3J0IGtvdGxpbi5tYXRoLm1heFxuaW1wb3J0IGtvdGxpbi5tYXRoLm1pblxuXG5vYmplY3QgQ29udG91clN0YXRVdGlsIHtcbiAgICBwcml2YXRlIHZhbCB4TG9jID0gZG91YmxlQXJyYXlPZigwLjAsIDEuMCwgMS4wLCAwLjAsIC41KVxuICAgIHByaXZhdGUgdmFsIHlMb2MgPSBkb3VibGVBcnJheU9mKDAuMCwgMC4wLCAxLjAsIDEuMCwgLjUpXG5cbiAgICAvKipcbiAgICAgKiBAcGFyYW0geHMgLSBzZXJpZXMgZGVmaW5pbmcgeC1jb29yZGluYXRlcyBvZiBkYXRhLXBvaW50c1xuICAgICAqIEByZXR1cm4gUGFpcihjb2wsIHJvdykgb3IgZmFpbCBpZiBub3QgYSByZWd1bGFyIGdyaWRcbiAgICAgKi9cbiAgICBpbnRlcm5hbCBmdW4gZXN0aW1hdGVSZWd1bGFyR3JpZFNoYXBlKHhzOiBMaXN0PERvdWJsZT8+KTogUGFpcjxJbnQsIEludD4ge1xuICAgICAgICAvLyBudW0gb2YgY29sdW1uc1xuICAgICAgICAvLyByZWd1bGFyIFgvWSBncmlkIGlzIGV4cGVjdGVkXG4gICAgICAgIHZhciBjb2xDb3VudCA9IDBcbiAgICAgICAgdmFyIHgwOiBEb3VibGU/ID0gbnVsbFxuICAgICAgICBmb3IgKHggaW4geHMpIHtcbiAgICAgICAgICAgIGlmICh4MCA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgeDAgPSB4XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHggPT0geDApIHtcbiAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29sQ291bnQrK1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGNvbENvdW50IDw9IDEpIHtcbiAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcIkRhdGEgZ3JpZCBtdXN0IGJlIGF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ZCBwYXRoc1xuICAgICAgICAgICAgICAgIHZhbCBwYXRoMCA9IHBhdGhCeUVuZFBvaW50W3AwXVxuICAgICAgICAgICAgICAgIHZhbCBwYXRoMSA9IHBhdGhCeUVuZFBvaW50W3AxXVxuXG4gICAgICAgICAgICAgICAgaWYgKHBhdGgwICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgcGF0aEJ5RW5kUG9pbnQucmVtb3ZlKHBhdGgwWzBdKVxuICAgICAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludC5yZW1vdmUocGF0aDBbcGF0aDAuc2l6ZSAtIDFdKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAocGF0aDEgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludC5yZW1vdmUocGF0aDFbMF0pXG4gICAgICAgICAgICAgICAgICAgIHBhdGhCeUVuZFBvaW50LnJlbW92ZShwYXRoMVtwYXRoMS5zaXplIC0gMV0pXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdmFsIGxvbmdQYXRoOiBNdXRhYmxlTGlzdDxFZGdlPlxuICAgICAgICAgICAgICAgIGlmIChwYXRoMCA9PT0gcGF0aDEpIHtcbiAgICAgICAgICAgICAgICAgICAgLy9hIGN5Y2xlIGlzIGZvcm1lZFxuICAgICAgICAgICAgICAgICAgICBwYXRoMCEhLmFkZChzZWdtZW50LnNlY29uZClcbiAgICAgICAgICAgICAgICAgICAgcGF0aExpc3QuYWRkKHBhdGgwKVxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAocGF0aDAgIT0gbnVsbCAmJiBwYXRoMSAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoID0gcGF0aDBcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGguYWRkQWxsKHBhdGgxKVxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAocGF0aDAgPT0gbnVsbCkgeyAvL3BhdGgxIT1udWxsXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoID0gcGF0aDEhIVxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aC5hZGQoMCwgc2VnbWVudC5maXJzdClcbiAgICAgICAgICAgICAgICB9IGVsc2UgeyAvLyBwYXRoMCE9bnVsbFxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aCA9IHBhdGgwXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZChzZWdtZW50LnNlY29uZClcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludFtsb25nUGF0aFswXV0gPSBsb25nUGF0aFxuICAgICAgICAgICAgICAgIHBhdGhCeUVuZFBvaW50W2xvbmdQYXRoW2xvbmdQYXRoLnNpemUgLSAxXV0gPSBsb25nUGF0aFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YWwgcGF0aCA9IEFycmF5TGlzdDxFZGdlPigpXG4gICAgICAgICAgICAgICAgcGF0aC5hZGQoc2VnbWVudC5maXJzdClcbiAgICAgICAgICAgICAgICBwYXRoLmFkZChzZWdtZW50LnNlY29uZClcbiAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludFtzZWdtZW50LmZpcnN0XSA9IHBhdGhcbiAgICAgICAgICAgICAgICBwYXRoQnlFbmRQb2ludFtzZWdtZW50LnNlY29uZF0gPSBwYXRoXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICAvLyBjb2xsZWN0IHBhdGhzIChkb24ndCBkdXBsaWNhdGUpXG4gICAgICAgIHZhbCBwYXRoU2V0ID0gSGFzaFNldChwYXRoQnlFbmRQb2ludC52YWx1ZXMpXG4gICAgICAgIGZvciAocGF0aCBpbiBwYXRoU2V0KSB7XG4gICAgICAgICAgICBwYXRoTGlzdC5hZGQocGF0aClcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcGF0aExpc3RcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjb252ZXJ0UGF0aHMoXG4gICAgICAgIHBhdGhzOiBMaXN0PExpc3Q8RWRnZT4+LFxuICAgICAgICB4U3RlcDogRG91YmxlLFxuICAgICAgICB5U3RlcDogRG91YmxlLFxuICAgICAgICBvcmlnaW46IERvdWJsZVZlY3RvcixcbiAgICAgICAgbGV2ZWw6IERvdWJsZT9cbiAgICApOiBMaXN0PExpc3Q8RG91YmxlVmVjdG9yPj4ge1xuICAgICAgICB2YWwgcmVzdWx0ID0gQXJyYXlMaXN0PExpc3Q8RG91YmxlVmVjdG9yPj4oKVxuXG4gICAgICAgIGZvciAocGF0aCBpbiBwYXRocykge1xuICAgICAgICAgICAgdmFsIHRlbXAgPSBBcnJheUxpc3Q8RG91YmxlVmVjdG9yPigpXG4gICAgICAgICAgICB2YXIgbGFzdFBvaW50OiBEb3VibGVWZWN0b3I/ID0gbnVsbFxuICAgICAgICAgICAgZm9yIChlZGdlIGluIHBhdGgpIHtcbiAgICAgICAgICAgICAgICB2YXIgaW50ZXJzZWN0ID0gZWRnZS5pbnRlcnNlY3QobGV2ZWwhISlcbiAgICAgICAgICAgICAgICBpbnRlcnNlY3QgPSBEb3VibGVWZWN0b3IoeFN0ZXAgKiBpbnRlcnNlY3QueCwgeVN0ZXAgKiBpbnRlcnNlY3QueSkuYWRkKG9yaWdpbilcbiAgICAgICAgICAgICAgICAvLyBpbiBjYXNlIHR3byBhZGphY2VudCBkb3VibGUgdmVjdG9ycyBhcmUgdGhlIHNhbWVcbiAgICAgICAgICAgICAgICBpZiAoaW50ZXJzZWN0ID09IGxhc3RQb2ludCkge1xuICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0ZW1wLmFkZChpbnRlcnNlY3QpXG4gICAgICAgICAgICAgICAgbGFzdFBvaW50ID0gaW50ZXJzZWN0XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBpbiBjYXNlIG9mIHNsaWdodCBjb21wdXRhdGlvbmFsIGVycm9yIGluIGxvb3BzXG4gICAgICAgICAgICBpZiAocGF0aFswXSA9PSBwYXRoW3BhdGguc2l6ZSAtIDFdICYmIHRlbXBbMF0gIT0gdGVtcFt0ZW1wLnNpemUgLSAxXSkge1xuICAgICAgICAgICAgICAgIHRlbXBbdGVtcC5zaXplIC0gMV0gPSB0ZW1wWzBdXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodGVtcC5zaXplID4gMSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5hZGQodGVtcClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjb25maXJtUGF0aHMocGF0aHM6IExpc3Q8TGlzdDxEb3VibGVWZWN0b3I+Pik6IExpc3Q8TGlzdDxEb3VibGVWZWN0b3I+PiB7XG4gICAgICAgIC8vIGpvaW4gcGF0aHMgdGhhdCBzaGFyZSB0aGUgc2FtZSBlbmQgcG9pbnRzXG4gICAgICAgIHZhbCBuZXdQYXRocyA9IEFycmF5TGlzdDxMaXN0PERvdWJsZVZlY3Rvcj4+KClcblxuICAgICAgICB2YWwgcGF0aEJ5RW5kUG9pbnQgPSBIYXNoTWFwPERvdWJsZVZlY3RvciwgTGlzdDxEb3VibGVWZWN0b3I+PigpXG5cbiAgICAgICAgZm9yIChwYXRoIGluIHBhdGhzKSB7XG4gICAgICAgICAgICB2YWwgcDAgPSBwYXRoWzBdXG4gICAgICAgICAgICB2YWwgcDEgPSBwYXRoW3BhdGguc2l6ZSAtIDFdXG4gICAgICAgICAgICAvL2lmIGN5Y2xlXG4gICAgICAgICAgICBpZiAocDAgPT0gcDEpIHtcbiAgICAgICAgICAgICAgICBuZXdQYXRocy5hZGQocGF0aClcbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAocGF0aEJ5RW5kUG9pbnQuY29udGFpbnNLZXkocDApIHx8IHBhdGhCeUVuZFBvaW50LmNvbnRhaW5zS2V5KHAxKSkge1xuICAgICAgICAgICAgICAgIC8vcmVtb3ZlIG5lZWQgdG8gYmUgbW9kaWZpZWQgcGF0aHNcbiAgICAgICAgICAgICAgICB2YWwgcGF0aDAgPSBwYXRoQnlFbmRQb2ludFtwMF1cbiAgICAgICAgICAgICAgICB2YWwgcGF0aDEgPSBwYXRoQnlFbmRQb2ludFtwMV1cbiAgICAgICAgICAgICAgICByZW1vdmVQYXRoQnlFbmRwb2ludHMocGF0aDAsIHBhdGhCeUVuZFBvaW50KVxuICAgICAgICAgICAgICAgIHJlbW92ZVBhdGhCeUVuZHBvaW50cyhwYXRoMSwgcGF0aEJ5RW5kUG9pbnQpXG5cbiAgICAgICAgICAgICAgICB2YWwgbG9uZ1BhdGggPSBBcnJheUxpc3Q8RG91YmxlVmVjdG9yPigpXG4gICAgICAgICAgICAgICAgaWYgKHBhdGgwID09PSBwYXRoMSkge1xuICAgICAgICAgICAgICAgICAgICAvL2EgY3ljbGUgaXMgZm9ybWVkXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZEFsbChwYXRoMCEhKVxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aC5hZGRBbGwocGF0aC5zdWJMaXN0KDEsIHBhdGguc2l6ZSkpXG4gICAgICAgICAgICAgICAgICAgIG5ld1BhdGhzLmFkZChsb25nUGF0aClcbiAgICAgICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHBhdGgwICE9IG51bGwgJiYgcGF0aDEgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aC5hZGRBbGwocGF0aDApXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZEFsbChwYXRoLnN1Ykxpc3QoMSwgcGF0aC5zaXplIC0gMSkpXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZEFsbChwYXRoMSlcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHBhdGgwID09IG51bGwpIHsgLy9wYXRoMSE9bnVsbFxuICAgICAgICAgICAgICAgICAgICBsb25nUGF0aC5hZGRBbGwocGF0aDEhISlcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGguYWRkQWxsKDAsIHBhdGguc3ViTGlzdCgwLCBwYXRoLnNpemUgLSAxKSlcbiAgICAgICAgICAgICAgICB9IGVsc2UgeyAvL3BhdGgwIT1udWxsXG4gICAgICAgICAgICAgICAgICAgIGxvbmdQYXRoLmFkZEFsbChwYXRoMClcbiAgICAgICAgICAgICAgICAgICAgbG9uZ1BhdGguYWRkQWxsKHBhdGguc3ViTGlzdCgxLCBwYXRoLnNpemUpKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHBhdGhCeUVuZFBvaW50W2xvbmdQYXRoWzBdXSA9IGxvbmdQYXRoXG4gICAgICAgICAgICAgICAgcGF0aEJ5RW5kUG9pbnRbbG9uZ1BhdGhbbG9uZ1BhdGguc2l6ZSAtIDFdXSA9IGxvbmdQYXRoXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHBhdGhCeUVuZFBvaW50W3BhdGhbMF1dID0gcGF0aFxuICAgICAgICAgICAgICAgIHBhdGhCeUVuZFBvaW50W3BhdGhbcGF0aC5zaXplIC0gMV1dID0gcGF0aFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHBhdGhTZXQgPSBIYXNoU2V0KHBhdGhCeUVuZFBvaW50LnZhbHVlcylcbiAgICAgICAgZm9yIChwYXRoIGluIHBhdGhTZXQpIHtcbiAgICAgICAgICAgIG5ld1BhdGhzLmFkZChwYXRoKVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gcHJldmVudCB0aGUgZGVnZW5lcm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0LmFkZChwYXRoLnN1Ykxpc3Qoc3RhcnRJbmRleCwgbmV4dEluZGV4ICsgMSkpXG4gICAgICAgICAgICAgICAgc3RhcnRJbmRleCA9IG5leHRJbmRleFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChzdGFydEluZGV4ID09IDApIHtcbiAgICAgICAgICAgIHJldHVybiBsaXN0T2YocGF0aClcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJlc3VsdC5hZGQocGF0aC5zdWJMaXN0KHN0YXJ0SW5kZXgsIHBhdGguc2l6ZSkpXG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjb21wdXRlU2VnbWVudHMoXG4gICAgICAgIGNvbENvdW50OiBJbnQsXG4gICAgICAgIHJvd0NvdW50OiBJbnQsXG4gICAgICAgIGRhdGE6IExpc3Q8RG91YmxlPz4sXG4gICAgICAgIGxldmVsOiBEb3VibGVcbiAgICApOiBMaXN0PFBhaXI8RWRnZSwgRWRnZT4+IHtcblxuICAgICAgICB2YWwgc2VnbWVudHMgPSBBcnJheUxpc3Q8UGFpcjxFZGdlLCBFZGdlPj4oKVxuICAgICAgICBmb3IgKHJvdyBpbiAwIHVudGlsIHJvd0NvdW50IC0gMSkge1xuICAgICAgICAgICAgZm9yIChjb2wgaW4gMCB1bnRpbCBjb2xDb3VudCAtIDEpIHtcbiAgICAgICAgICAgICAgICB2YWwgaTAgPSByb3cgKiBjb2xDb3VudCArIGNvbFxuICAgICAgICAgICAgICAgIHZhbCBpMSA9IHJvdyAqIGNvbENvdW50ICsgY29sICsgMSAvLyBuZXh0IHJpZ2h0XG4gICAgICAgICAgICAgICAgdmFsIGkyID0gKHJvdyArIDEpICogY29sQ291bnQgKyBjb2wgKyAxIC8vIG5leHQgcmlnaHQgJiB1cFxuICAgICAgICAgICAgICAgIHZhbCBpMyA9IChyb3cgKyAxKSAqIGNvbENvdW50ICsgY29sIC8vIG5leHQgdXBcblxuICAgICAgICAgICAgICAgIHZhbCB2ID0gRG91YmxlQXJyYXkoNSlcbiAgICAgICAgICAgICAgICB2WzBdID0gZGF0YVtpMF0hIVxuICAgICAgICAgICAgICAgIHZbMV0gPSBkYXRhW2kxXSEhXG4gICAgICAgICAgICAgICAgdlsyXSA9IGRhdGFbaTJdISFcbiAgICAgICAgICAgICAgICB2WzNdID0gZGF0YVtpM10hIVxuXG4gICAgICAgICAgICAgICAgdmFyIG1pbiA9IHZbMF1cbiAgICAgICAgICAgICAgICB2YXIgbWF4ID0gdlswXVxuICAgICAgICAgICAgICAgIGZvciAoaSBpbiAxLi4zKSB7XG4gICAgICAgICAgICAgICAgICAgIG1pbiA9IG1pbihtaW4sIHZbaV0pXG4gICAgICAgICAgICAgICAgICAgIG1heCA9IG1heChtYXgsIHZbaV0pXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKG1pbiA9PSBtYXgpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gc3BlY2lhbCBjYXNlOiBhbGwgcG9pbnRzIGFyZSBpbiB0aGUgc2FtZSBwbGFuZSAtIGRyb3BcbiAgICAgICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAvLyB2WzRdID0gKHZbMF0gKyB2WzFdICsgdlsyXSArIHZbM10pIC8gNDsgICAvLyBjZW50ZXIgIChhdmVyYWdlIG9mIGNvcm5lcnMpXG4gICAgICAgICAgICAgICAgdls0XSA9ICh2WzBdICsgdlsxXSArIHZbMl0gKyB2WzNdIC0gbWluIC0gbWF4KSAvIDIgICAvLyBjZW50ZXIgIChhdmVyYWdlIG9mIGNvcm5lcnMpXG5cbiAgICAgICAgICAgICAgICBpZiAobGV2ZWwgPiBtaW4gJiYgbGV2ZWwgPD0gbWF4KSB7XG5cbiAgICAgICAgICAgICAgICAgICAgdmFsIGNlbGxTZWdtZW50cyA9XG4gICAgICAgICAgICAgICAgICAgICAgICBjb21wdXRlU2VnbWVudHNGb3JHcmlkQ2VsbChsZXZlbCwgdiwgY29sLCByb3cpXG4gICAgICAgICAgICAgICAgICAgIHNlZ21lbnRzLmFkZEFsbChjZWxsU2VnbWVudHMpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHNlZ21lbnRzXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gY29tcHV0ZVNlZ21lbnRzRm9yR3JpZENlbGwoXG4gICAgICAgIGxldmVsOiBEb3VibGU/LFxuICAgICAgICB2YWx1ZTU6IERvdWJsZUFycmF5LFxuICAgICAgICBjb2w6IEludCxcbiAgICAgICAgcm93OiBJbnRcbiAgICApOiBMaXN0PFBhaXI8RWRnZSwgRWRnZT4+IHtcbiAgICAgICAgLy8gdHJpYW5nbGVzOlxuICAgICAgICAvLyBbMF0gMC0xLTRcbiAgICAgICAgLy8gWzFdIDEtMi00XG4gICAgICAgIC8vIFsyXSAyLTMtNFxuICAgICAgICAvLyBbM10gMy0wLTRcbiAgICAgICAgLy8gY2hlY2sgZWFjaCBlZGdlIG9mIGVhY2ggdHJpYW5nbGUgLSBmaW5kIGVkZ2VzIHRoYXQgY3Jvc3MgdGhlIGxldmVsICdwbGFuZSdcblxuICAgICAgICB2YWwgcmVzdWx0ID0gQXJyYXlMaXN0PFBhaXI8RWRnZSwgRWRnZT4+KClcbiAgICAgICAgdmFsIHBvaW50cyA9IEFycmF5TGlzdDxUcmlwbGVWZWN0b3I+KClcbiAgICAgICAgdmFyIHRlbXBWZWN0b3I6IE11dGFibGVMaXN0PFRyaXBsZVZlY3Rvcj5cbiAgICAgICAgZm9yIChpIGluIDAuLjQpIHtcbiAgICAgICAgICAgIHBvaW50cy5hZGQoXG4gICAgICAgICAgICAgICAgVHJpcGxlVmVjdG9yKFxuICAgICAgICAgICAgICAgICAgICBjb2wgKyB4TG9jW2ldLFxuICAgIC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ICAgICB9XG4gICAgICAgICAgICAxMSAtPiB7XG4gICAgICAgICAgICAgICAgc3RhcnQgPSBFZGdlKHZlY3RvcnNbMV0sIHZlY3RvcnNbMF0pXG4gICAgICAgICAgICAgICAgZW5kID0gRWRnZSh2ZWN0b3JzWzBdLCB2ZWN0b3JzWzJdKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSAtPiByZXR1cm4gbnVsbFxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBQYWlyKHN0YXJ0LCBlbmQpXG4gICAgfVxuXG4gICAgLy8gdG8gY2hlY2sgaWYgYWxsIHRoZSBzaWRlIGVkZ2VzIGFyZSBvbiB0aGUgYm9hcmRlciAqKkRlYnVnIFVzZSoqXG4gICAgcHJpdmF0ZSBmdW4gY2hlY2tFZGdlcyhwYXRoczogTGlzdDxMaXN0PEVkZ2U+PiwgY29sQ291bnQ6IEludCwgcm93Q291bnQ6IEludCkge1xuICAgICAgICBmb3IgKHBhdGggaW4gcGF0aHMpIHtcbiAgICAgICAgICAgIGlmIChwYXRoWzBdICE9IHBhdGhbcGF0aC5zaXplIC0gMV0pIHtcbiAgICAgICAgICAgICAgICBjaGVja0VkZ2UocGF0aFswXSwgY29sQ291bnQsIHJvd0NvdW50KVxuICAgICAgICAgICAgICAgIGNoZWNrRWRnZShwYXRoW3BhdGguc2l6ZSAtIDFdLCBjb2xDb3VudCwgcm93Q291bnQpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjaGVja0VkZ2UoZWRnZTogRWRnZSwgY29sQ291bnQ6IEludCwgcm93Q291bnQ6IEludCkge1xuICAgICAgICB2YWwgYSA9IGVkZ2UubXlBXG4gICAgICAgIHZhbCBiID0gZWRnZS5teUJcbiAgICAgICAgaWYgKGEubXlYID09IDAgJiYgYi5teVggPT0gMCkge1xuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGEubXlZID09IDAgJiYgYi5teVkgPT0gMCkge1xuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cbiAgICAgICAgaWYgKGEubXlYID09IGNvbENvdW50IC0gMSAmJiBiLm15WCA9PSBjb2xDb3VudCAtIDEpIHtcbiAgICAgICAgICAgIHJldHVyblxuICAgICAgICB9XG4gICAgICAgIGlmIChhLm15WSA9PSByb3dDb3VudCAtIDEgJiYgYi5teVkgPT0gcm93Q291bnQgLSAxKSB7XG4gICAgICAgICAgICByZXR1cm5cbiAgICAgICAgfVxuICAgICAgICB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oXCJDaGVjayBFZGdlIEZhaWxlZFwiKVxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgVHJpcGxlVmVjdG9yIGludGVybmFsIGNvbnN0cnVjdG9yKHg6IERvdWJsZSwgeTogRG91YmxlLCB2YWwgejogRG91YmxlKSB7XG4gICAgICAgIHZhbCBteVg6IEludFxuICAgICAgICB2YWwgbXlZOiBJbnRcbiAgICAgICAgcHJpdmF0ZSB2YWwgbXlJc0NlbnRlcjogSW50XG5cbiAgICAgICAgdmFsIGNvb3JkOiBEb3VibGVWZWN0b3JcbiAgICAgICAgICAgIGdldCgpID0gRG91YmxlVmVjdG9yKHgsIHkpXG5cbiAgICAgICAgdmFsIHg6IERvdWJsZVxuICAgICAgICAgICAgZ2V0KCkgPSB0aGlzLm15WCArIDAuNSAqIG15SXNDZW50ZXJcblxuICAgICAgICB2YWwgeTogRG91YmxlXG4gICAgICAgICAgICBnZXQoKSA9IHRoaXMubXlZICsgMC41ICogbXlJc0NlbnRlclxuXG4gICAgICAgIGluaXQge1xuICAgICAgICAgICAgdGhpcy5teVggPSB4LnRvSW50KClcbiAgICAgICAgICAgIHRoaXMubXlZID0geS50b0ludCgpXG4gICAgICAgICAgICB0aGlzLm15SXNDZW50ZXIgPSBpZiAoeCAlIDEgPT0gMC4wKSAwIGVsc2UgMVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGVxdWFscyhvdGhlcjogQW55Pyk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgaWYgKHRoaXMgPT09IG90aGVyKSByZXR1cm4gdHJ1ZVxuICAgICAgICAgICAgaWYgKG90aGVyID09IG51bGwgfHwgdGhpczo6Y2xhc3MgIT0gb3RoZXI6OmNsYXNzKSByZXR1cm4gZmFsc2VcbiAgICAgICAgICAgIHZhbCB0aGF0ID0gb3RoZXIgYXMgVHJpcGxlVmVjdG9yP1xuICAgICAgICAgICAgcmV0dXJuIG15WCA9PSB0aGF0ISEubXlYICYmIG15WSA9PSB0aGF0Lm15WSAmJiBteUlzQ2VudGVyID09IHRoYXQubXlJc0NlbnRlclxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhhc2hDb2RlKCk6IEludCB7XG4gICAgICAgICAgICByZXR1cm4gYXJyYXlPZihteVgsIG15WSwgbXlJc0NlbnRlcikuaGFzaENvZGUoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGdldFR5cGUobGV2ZWw6IERvdWJsZSk6IEludCB7XG4gICAgICAgICAgICByZXR1cm4gaWYgKHogPj0gbGV2ZWwpIHtcbiAgICAgICAgICAgICAgICAxXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIDBcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgRWRnZSBpbnRlcm5hbCBjb25zdHJ1Y3Rvcih2YWwgbXlBOiBUcmlwbGVWZWN0b3IsIHZhbCBteUI6IFRyaXBsZVZlY3Rvcikge1xuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBlcXVhbHMob3RoZXI6IEFueT8pOiBCb29sZWFuIHtcbiAgICAgICAgICAgIGlmIChvdGhlciAhaXMgRWRnZSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFsIG9iaiA9IG90aGVyIGFzIEVkZ2U/XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5teUEgPT0gb2JqISEubXlBICYmIHRoaXMubXlCID09IG9iai5teUIgfHwgdGhpcy5teUEgPT0gb2JqLm15QiAmJiB0aGlzLm15QiA9PSBvYmoubXlBXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaGFzaENvZGUoKTogSW50IHtcbiAgICAgICAgICAgIHJldHVybiBteUEuY29vcmQuaGFzaENvZGUoKSArIG15Qi5jb29yZC5oYXNoQ29kZSgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaW50ZXJzZWN0KGxldmVsOiBEb3VibGUpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICAgICAgdmFsIHowID0gbXlBLnpcbiAgICAgICAgICAgIHZhbCB6MSA9IG15Qi56XG5cbiAgICAgICAgICAgIGlmIChsZXZlbCA9PSB6MCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBteUEuY29vcmRcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChsZXZlbCA9PSB6MSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBteUIuY29vcmRcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIHJhdGlvID0gKHoxIC0gejApIC8gKGxldmVsIC0gejApXG4gICAgICAgICAgICB2YWwgeDAgPSBteUEueFxuICAgICAgICAgICAgdmFsIHkwID0gbXlBLnlcbiAgICAgICAgICAgIHZhbCB4MSA9IG15Qi54XG4gICAgICAgICAgICB2YWwgeTEgPSBteUIueVxuICAgICAgICAgICAgdmFsIHggPSB4MCArICh4MSAtIHgwKSAvIHJhdGlvXG4gICAgICAgICAgICB2YWwgeSA9IHkwICsgKHkxIC0geTApIC8gcmF0aW9cbiAgICAgICAgICAgIHJldHVybiBEb3VibGVWZWN0b3IoeCwgeSlcbiAgICAgICAgfVxuICAgIH1cbn0vLyAqKkRlYnVnIFVzZSoqXG4iLCIvKlxuICogQ29we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hYmxlTWFwT2Y8UGFpcjxTdHJpbmcsIFN0cmluZz4sIERvdWJsZT4oKVxuXG4gICAgICAgIGZ1biBhZGRDb3JyZWxhdGlvbih2YXJYOiBTdHJpbmcsIHZhclk6IFN0cmluZywgdjogRG91YmxlKSB7XG4gICAgICAgICAgICBpZiAoYWJzKHYpID49IHRocmVzaG9sZCkge1xuICAgICAgICAgICAgICAgIGtub3duVmFycy5hZGQodmFyWClcbiAgICAgICAgICAgICAgICBrbm93blZhcnMuYWRkKHZhclkpXG4gICAgICAgICAgICAgICAgY29yckRhdGFbdmFyWCB0byB2YXJZXSA9IHZcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZvciAoKGksIHZ4KSBpbiBudW1lcmljcy53aXRoSW5kZXgoKSkge1xuICAgICAgICAgICAgdmFsIHhzID0gZGF0YS5nZXROdW1lcmljKHZ4KVxuXG4gICAgICAgICAgICBpZiAoZmlsbERpYWdvbmFsKSB7ICAgIC8vIHZhbHVlcyBvbiBtYWluIGRpYWdvbmFsIGRvZXMgbm90IHJlcXVpcmUgY2FsY3VsYXRpb25zXG4gICAgICAgICAgICAgICAgYWRkQ29ycmVsYXRpb24odngubGFiZWwsIHZ4LmxhYmVsLCAxLjApXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZvciAoaiBpbiAwIHVudGlsIGkpIHtcbiAgICAgICAgICAgICAgICB2YWwgdnkgPSBudW1lcmljc1tqXVxuICAgICAgICAgICAgICAgIHZhbCB5cyA9IGRhdGEuZ2V0TnVtZXJpYyh2eSlcbiAgICAgICAgICAgICAgICB2YWwgYyA9IGNvcnJlbGF0aW9uKHhzLCB5cywgY29ycmVsYXRpb25GdW5jdGlvbilcblxuICAgICAgICAgICAgICAgIGlmICh0eXBlID09IENvcnJlbGF0aW9uU3RhdC5UeXBlLkZVTEwgfHwgdHlwZSA9PSBDb3JyZWxhdGlvblN0YXQuVHlwZS5MT1dFUikge1xuICAgICAgICAgICAgICAgICAgICBhZGRDb3JyZWxhdGlvbih2eC5sYWJlbCwgdnkubGFiZWwsIGMpXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKHR5cGUgPT0gQ29ycmVsYXRpb25TdGF0LlR5cGUuRlVMTCB8fCB0eXBlID09IENvcnJlbGF0aW9uU3RhdC5UeXBlLlVQUEVSKSB7XG4gICAgICAgICAgICAgICAgICAgIGFkZENvcnJlbGF0aW9uKHZ5LmxhYmVsLCB2eC5sYWJlbCwgYylcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgdmFyMSA9IGFycmF5TGlzdE9mPFN0cmluZz4oKVxuICAgICAgICB2YWwgdmFyMiA9IGFycmF5TGlzdE9mPFN0cmluZz4oKVxuICAgICAgICB2YWwgY29yciA9IGFycmF5TGlzdE9mPERvdWJsZT8+KClcblxuICAgICAgICAvLyBwdXQgYWxsIGNvcnJlbGF0aW9uIG1hdHJpeCB2YWx1ZXMgKGluY2x1ZGluZyBudWxscylcbiAgICAgICAgLy8gdG8gcmVzdWx0IGRhdGFmcmFtZSBpbiBwcm9wZXIgb3JkZXIsIHRvIGtlZXAgbWF0cml4IHNoYXBlLlxuICAgICAgICB2YWwgc29ydGVkVmFycyA9IGtub3duVmFycy5zb3J0ZWRXaXRoKGNyZWF0ZUNvbXBhcmF0b3IobnVtZXJpY3MpKVxuXG4gICAgICAgIGZvciAoeCBpbiBzb3J0ZWRWYXJzKSB7XG4gICAgICAgICAgICBmb3IgKHkgaW4gc29ydGVkVmFycykge1xuICAgICAgICAgICAgICAgIHZhcjEuYWRkKHgpXG4gICAgICAgICAgICAgICAgdmFyMi5hZGQoeSlcbiAgICAgICAgICAgICAgICBjb3JyLmFkZChjb3JyRGF0YVt4IHRvIHldKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIERhdGFGcmFtZS5CdWlsZGVyKClcbiAgICAgICAgICAgI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zdGF0Q291bnQpXG4gICAgICAgICAgICAuYnVpbGQoKVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBwcml2YXRlIHZhbCBERUZfTUFQUElORzogTWFwPEFlczwqPiwgRGF0YUZyYW1lLlZhcmlhYmxlPiA9IG1hcE9mKFxuICAgICAgICAgICAgQWVzLlggdG8gU3RhdHMuWCxcbiAgICAgICAgICAgIEFlcy5ZIHRvIFN0YXRzLkNPVU5UXG4gICAgICAgIClcblxuICAgICAgICBwcml2YXRlIGZ1biBjb3VudEJ5WCh2YWx1ZXNYOiBMaXN0PERvdWJsZT8+LCB3ZWlnaHQ6IExpc3Q8RG91YmxlPz4pOiBNYXA8RG91YmxlLCBNdXRhYmxlRG91YmxlPiB7XG4gICAgICAgICAgICB2YWwgcmVzdWx0ID0gTGlua2VkSGFzaE1hcDxEb3VibGUsIE11dGFibGVEb3VibGU+KClcbiAgICAgICAgICAgIGZvciAoaSBpbiB2YWx1ZXNYLmluZGljZXMpIHtcbiAgICAgICAgICAgICAgICB2YWwgeCA9IHZhbHVlc1hbaV1cbiAgICAgICAgICAgICAgICBpZiAoU2VyaWVzVXRpbC5pc0Zpbml0ZSh4KSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3VsdC5jb250YWluc0tleSh4ISEpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRbeF0gPSBNdXRhYmxlRG91YmxlKDAuMClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXN1bHRbeF0hIS5nZXRBbmRBZGQoU2VyaWVzVXRpbC5hc0Zpbml0ZSh3ZWlnaHRbaV0sIDAuMCkpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5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RoWSh5VmVjdG9yKVxuXG4gICAgICAgIHZhbCBzdGVwc1ggPSBEZW5zaXR5U3RhdFV0aWwuY3JlYXRlU3RlcFZhbHVlcyh4UmFuZ2UhISwgblgpXG4gICAgICAgIHZhbCBzdGVwc1kgPSBEZW5zaXR5U3RhdFV0aWwuY3JlYXRlU3RlcFZhbHVlcyh5UmFuZ2UhISwgblkpXG5cbiAgICAgICAgLy8gd2VpZ2h0IGFlc3RoZXRpY3NcbiAgICAgICAgdmFsIGdyb3VwV2VpZ2h0ID0gQmluU3RhdFV0aWwud2VpZ2h0VmVjdG9yKHhWZWN0b3Iuc2l6ZSwgZGF0YSlcblxuICAgICAgICB2YWwgbWF0cml4WCA9IEJsb2NrUmVhbE1hdHJpeChcbiAgICAgICAgICAgIERlbnNpdHlTdGF0VXRpbC5jcmVhdGVSYXdNYXRyaXgoXG4gICAgICAgICAgICAgICAgeFZlY3RvcixcbiAgICAgICAgICAgICAgICBzdGVwc1gsXG4gICAgICAgICAgICAgICAga2VybmVsRnVuLFxuICAgICAgICAgICAgICAgIGJhbmRXaWR0aFswXSxcbiAgICAgICAgICAgICAgICBhZGp1c3QsXG4gICAgICAgICAgICAgICAgZ3JvdXBXZWlnaHRcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgICAgICB2YWwgbWF0cml4WSA9IEJsb2NrUmVhbE1hdHJpeChcbiAgICAgICAgICAgIERlbnNpdHlTdGF0VXRpbC5jcmVhdGVSYXdNYXRyaXgoXG4gICAgICAgICAgICAgICAgeVZlY3RvcixcbiAgICAgICAgICAgICAgICBzdGVwc1ksXG4gICAgICAgICAgICAgICAga2VybmVsRnVuLFxuICAgICAgICAgICAgICAgIGJhbmRXaWR0aFsxXSxcbiAgICAgICAgICAgICAgICBhZGp1c3QsXG4gICAgICAgICAgICAgICAgZ3JvdXBXZWlnaHRcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgICAgICAvLyBzaXplOiBuWSAqIG5YXG4gICAgICAgIHZhbCBtYXRyaXhGaW5hbCA9IG1hdHJpeFkubXVsdGlwbHkobWF0cml4WC50cmFuc3Bvc2UoKSlcblxuICAgICAgICBmb3IgKHJvdyBpbiAwIHVudGlsIG5ZKSB7XG4gICAgICAgICAgICBmb3IgKGNvbCBpbiAwIHVudGlsIG5YKSB7XG4gICAgICAgICAgICAgICAgc3RhdFguYWRkKHN0ZXBzWFtjb2xdKVxuICAgICAgICAgICAgICAgIHN0YXRZLmFkZChzdGVwc1lbcm93XSlcbiAgICAgICAgICAgICAgICBzdGF0RGVuc2l0eS5hZGQobWF0cml4RmluYWwuZ2V0RW50cnkocm93LCBjb2wpIC8gU2VyaWVzVXRpbC5zdW0oZ3JvdXBXZWlnaHQpKVxuICAgICAgICAgICAgICAgIC8vbmV3R3JvdXBzLmFkZCgoZG91YmxlKSAoaW50KSBncm91cCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaXNDb250b3VyKSB7XG4gICAgICAgICAgICB2YWwgelJhbmdlID0gU2VyaWVzVXRpbC5yYW5nZShzdGF0RGVuc2l0eSlcbiAgICAgICAgICAgIHZhbCBsZXZlbHMgPSBDb250b3VyU3RhdFV0aWwuY29tcHV0ZUxldmVscyh6UmFuZ2UsIGJpbk9wdGlvbnMpXG4gICAgICAgICAgICAgICAgPzogcmV0dXJuIERhdGFGcmFtZS5CdWlsZGVyLmVtcHR5RnJhbWUoKVxuXG4gICAgICAgICAgICB2YWwgcGF0aExpc3RCeUxldmVsID0gQ29udG91clN0YXRVdGlsLmNvbXB1dGVDb250b3VycyhcbiAgICAgICAgICAgICAgICB4UmFuZ2UsXG4gICAgICAgICAgICAgICAgeVJhbmdlLFxuICAgICAgICAgICAgICAgIG5YLFxuICAgICAgICAgICAgICAgIG5ZLFxuICAgICAgICAgICAgICAgIHN0YXREZW5zaXR5LFxuICAgICAgICAgICAgICAgIGxldmVsc1xuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICByZXR1cm4gQ29udG91ci5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naHRcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgICAgICB2YWwgbWF0cml4WSA9IEJsb2NrUmVhbE1hdHJpeChcbiAgICAgICAgICAgIERlbnNpdHlTdGF0VXRpbC5jcmVhdGVSYXdNYXRyaXgoXG4gICAgICAgICAgICAgICAgeVZlY3RvcixcbiAgICAgICAgICAgICAgICBzdGVwc1ksXG4gICAgICAgICAgICAgICAga2VybmVsRnVuLFxuICAgICAgICAgICAgICAgIGJhbmRXaWR0aFsxXSxcbiAgICAgICAgICAgICAgICBhZGp1c3QsXG4gICAgICAgICAgICAgICAgZ3JvdXBXZWlnaHRcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgICAgICAvLyBzaXplOiBuWSAqIG5YXG4gICAgICAgIHZhbCBtYXRyaXhGaW5hbCA9IG1hdHJpeFkubXVsdGlwbHkobWF0cml4WC50cmFuc3Bvc2UoKSlcblxuICAgICAgICBmb3IgKHJvdyBpbiAwIHVudGlsIG5ZKSB7XG4gICAgICAgICAgICBmb3IgKGNvbCBpbiAwIHVudGlsIG5YKSB7XG4gICAgICAgICAgICAgICAgc3RhdFguYWRkKHN0ZXBzWFtjb2xdKVxuICAgICAgICAgICAgICAgIHN0YXRZLmFkZChzdGVwc1lbcm93XSlcbiAgICAgICAgICAgICAgICBzdGF0RGVuc2l0eS5hZGQobWF0cml4RmluYWwuZ2V0RW50cnkocm93LCBjb2wpIC8gU2VyaWVzVXRpbC5zdW0oZ3JvdXBXZWlnaHQpKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGlzQ29udG91cikge1xuICAgICAgICAgICAgLy8gVG9EbzogY2hhbmdlIHpyYW5nZSBpbnRvIHRoZSByYW5nZSBvZiB6IG92ZXIgZW50aXJlIGRhdGFzZXRcbiAgICAgICAgICAgIHZhbCB6UmFuZ2UgPSBTZXJpZXNVdGlsLnJhbmdlKHN0YXREZW5zaXR5KVxuICAgICAgICAgICAgdmFsIGxldmVscyA9IENvbnRvdXJTdGF0VXRpbC5jb21wdXRlTGV2ZWxzKHpSYW5nZSwgYmluT3B0aW9ucylcbiAgICAgICAgICAgICAgICA/OiByZXR1cm4gRGF0YUZyYW1lLkJ1aWxkZXIuZW1wdHlGcmFtZSgpXG5cbiAgICAgICAgICAgIHZhbCBwYXRoTGlzdEJ5TGV2ZWwgPSBDb250b3VyU3RhdFV0aWwuY29tcHV0ZUNvbnRvdXJzKFxuICAgICAgICAgICAgICAgIHhSYW5nZSxcbiAgICAgICAgICAgICAgICB5UmFuZ2UsXG4gICAgICAgICAgICAgICAgblgsXG4gICAgICAgICAgICAgICAgblksXG4gICAgICAgICAgICAgICAgc3RhdERlbnNpdHksXG4gICAgICAgICAgICAgICAgbGV2ZWxzXG4gICAgICAgICAgICApXG4gICAgICAgICAgICB2YWwgaGVscGVyID0gQ29udG91ckZpbGxIZWxwZXIoeFJhbmdlLCB5UmFuZ2UpXG4gICAgICAgICAgICB2YWwgZmlsbExldmVscyA9XG4gICAgICAgICAgICAgICAgQ29udG91ckZpbGxIZWxwZXIuY29tcHV0ZUZpbGxMZXZlbHMoelJhbmdlISEsIGxldmVscylcbiAgICAgICAgICAgIHZhbCBwb2x5Z29uTGlzdEJ5RmlsbExldmVsID0gaGVscGVyLmNyZWF0ZVBvbHlnb25zKHBhdGhMaXN0QnlMZXZlbCwgbGV2ZWxzLCBmaWxsTGV2ZWxzKVxuXG4gICAgICAgICAgICByZXR1cm4gQ29udG91ci5nZXRQb2x5Z29uRGF0YUZyYW1lKFxuICAgICAgICAgICAgICAgIGZpbGxMZXZlbHMuc3ViTGlzdChcbiAgICAgICAgICAgICAgICAgICAgMSxcbiAgICAgICAgICAgICAgICAgICAgZmlsbExldmVscy5zaXplXG4gICAgICAgICAgICAgICAgKSwgcG9seWdvbkxpc3RCeUZpbGxMZXZlbFxuICAgICAgICAgICAgKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIERhdGFGcmFtZS5CdWlsZG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AgICAgICAgICAgeHMsXG4gICAgICAgICAgICAgICAgd2VpZ2h0cyxcbiAgICAgICAgICAgICAgICBrZXJuZWxGdW4sXG4gICAgICAgICAgICAgICAgYmFuZFdpZHRoLFxuICAgICAgICAgICAgICAgIGFkanVzdFxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgZmFsc2UgLT4gRGVuc2l0eVN0YXRVdGlsLmRlbnNpdHlGdW5jdGlvbkZhc3QoXG4gICAgICAgICAgICAgICAgeHMsXG4gICAgICAgICAgICAgICAgd2VpZ2h0cyxcbiAgICAgICAgICAgICAgICBrZXJuZWxGdW4sXG4gICAgICAgICAgICAgICAgYmFuZFdpZHRoLFxuICAgICAgICAgICAgICAgIGFkanVzdFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIG5Ub3RhbCA9IHdlaWdodHMuc3VtKClcbiAgICAgICAgZm9yICh4IGluIHN0YXRYKSB7XG4gICAgICAgICAgICB2YWwgZCA9IGRlbnNpdHlGdW5jdGlvbih4KVxuICAgICAgICAgICAgc3RhdENvdW50LmFkZChkKVxuICAgICAgICAgICAgc3RhdERlbnNpdHkuYWRkKGQgLyBuVG90YWwpXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbWF4bSA9IHN0YXRDb3VudC5tYXhPck51bGwoKSEhXG4gICAgICAgIGZvciAoZCBpbiBzdGF0Q291bnQpIHtcbiAgICAgICAgICAgIHN0YXRTY2FsZWQuYWRkKGQgLyBtYXhtKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIERhdGFGcmFtZS5CdWlsZGVyKClcbiAgICAgICAgICAgIC5wdXROdW1lcmljKFN0YXRzLlgsIHN0YXRYKVxuICAgICAgICAgICAgLnB1dE51bWVyaWMoU3RhdHMuREVOU0lUWSwgc3RhdERlbnNpdHkpXG4gICAgICAgICAgICAucHV0TnVtZXJpYyhTdGF0cy5DT1VOVCwgc3RhdENvdW50KVxuICAgICAgICAgICAgLnB1dE51bWVyaWMoU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cmllc1V0aWwuaXNGaW5pdGUoaXQpIH0gYXMgTGlzdDxEb3VibGU+XG4gICAgICAgIHZhbCBkYXRhU3VtbWFyeSA9IEZpdmVOdW1iZXJTdW1tYXJ5KHZhbHVlc1hGaW5pdGUpXG4gICAgICAgIHZhbCBteUlRUiA9IGRhdGFTdW1tYXJ5LnRoaXJkUXVhcnRpbGUgLSBkYXRhU3VtbWFyeS5maXJzdFF1YXJ0aWxlXG4gICAgICAgIHZhbCBteVN0ZEQgPSBzdGREZXYodmFsdWVzWEZpbml0ZSlcblxuICAgICAgICB3aGVuIChidykge1xuICAgICAgICAgICAgRGVuc2l0eVN0YXQuQmFuZFdpZHRoTWV0aG9kLk5SRDAgLT4ge1xuICAgICAgICAgICAgICAgIGlmIChteUlRUiA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAuOSAqIG1pbihteVN0ZEQsIG15SVFSIC8gMS4zNCkgKiBteVNpemUudG9Eb3VibGUoKS5wb3coLTAuMilcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKG15U3RkRCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAuOSAqIG15U3RkRCAqIG15U2l6ZS50b0RvdWJsZSgpLnBvdygtMC4yKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIERlbnNpdHlTdGF0LkJhbmRXaWR0aE1ldGhvZC5OUkQgLT4ge1xuICAgICAgICAgICAgICAgIGlmIChteUlRUiA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDEuMDYgKiBtaW4obXlTdGRELCBteUlRUiAvIDEuMzQpICogbXlTaXplLnRvRG91YmxlKCkucG93KC0wLjIpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChteVN0ZEQgPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAxLjA2ICogbXlTdGREICogbXlTaXplLnRvRG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gICB2YWwgY3V0b2ZmID0gaCAqIDVcblxuICAgICAgICByZXR1cm4geyB4IC0+XG4gICAgICAgICAgICB2YXIgc3VtID0gMC4wXG4gICAgICAgICAgICB2YXIgZnJvbSA9IHhzLmJpbmFyeVNlYXJjaCh4IC0gY3V0b2ZmKVxuICAgICAgICAgICAgaWYgKGZyb20gPCAwKSB7XG4gICAgICAgICAgICAgICAgZnJvbSA9IC1mcm9tIC0gMVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFyIHRvID0geHMuYmluYXJ5U2VhcmNoKHggKyBjdXRvZmYpXG4gICAgICAgICAgICBpZiAodG8gPCAwKSB7XG4gICAgICAgICAgICAgICAgdG8gPSAtdG8gLSAxXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZvciAoaSBpbiAoZnJvbSB1bnRpbCB0bykpIHtcbiAgICAgICAgICAgICAgICBzdW0gKz0ga2VyKCh4IC0geHNbaV0pIC8gaCkgKiB3ZWlnaHRzW2ldXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzdW0gLyBoXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gY3JlYXRlU3RlcFZhbHVlcyhyYW5nZTogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgbjogSW50KTogTGlzdDxEb3VibGU+IHtcbiAgICAgICAgdmFsIHggPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgIHZhciBtaW4gPSByYW5nZS5sb3dlckVuZFxuICAgICAgICB2YXIgbWF4ID0gcmFuZ2UudXBwZXJFbmRcbiAgICAgICAgdmFsIHN0ZXA6IERvdWJsZVxuXG4gICAgICAgIGlmIChtYXggPT0gbWluKSB7XG4gICAgICAgICAgICBtYXggKz0gREVGX1NURVBfU0laRVxuICAgICAgICAgICAgbWluIC09IERFRl9TVEVQX1NJWkVcbiAgICAgICAgfVxuICAgICAgICBzdGVwID0gKG1heCAtIG1pbikgLyAobiAtIDEpXG4gICAgICAgIGZvciAoaSBpbiAwIH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292LCBvcHRjb3NpbmUsIGNvcy5cIlxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuIHRvQmFuZFdpZHRoTWV0aG9kKGJ3OiBTdHJpbmcpOiBEZW5zaXR5U3RhdC5CYW5kV2lkdGhNZXRob2Qge1xuICAgICAgICByZXR1cm4gd2hlbiAoYncpIHtcbiAgICAgICAgICAgIFwibnJkMFwiIC0+IERlbnNpdHlTdGF0LkJhbmRXaWR0aE1ldGhvZC5OUkQwXG4gICAgICAgICAgICBcIm5yZFwiIC0+IERlbnNpdHlTdGF0LkJhbmRXaWR0aE1ldGhvZC5OUkRcbiAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFxuICAgICAgICAgICAgICAgIFwiVW5zdXBwb3J0ZWQgYmFuZHdpZHRoIG1ldGhvZDogJyRidycuXFxuXCIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJVc2Ugb25lIG9mOiBucmQwLCBucmQuXCJcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBjcmVhdGVSYXdNYXRyaXgoXG4gICAgICAgIHZhbHVlczogTGlzdDxEb3VibGU/PixcbiAgICAgICAgbGlzdDogTGlzdDxEb3VibGU+LFxuICAgICAgICBrZXI6IChEb3VibGUpIC0+IERvdWJsZSxcbiAgICAgICAgYnc6IERvdWJsZSxcbiAgICAgICAgYWQ6IERvdWJsZSxcbiAgICAgICAgd2VpZ2h0OiBMaXN0PERvdWJsZT8+XG4gICAgKTogQXJyYXk8RG91YmxlQXJyYXk+IHtcbiAgICAgICAgdmFsIGEgPSBidyAqIGFkXG4gICAgICAgIHZhbCBuID0gdmFsdWVzLnNpemVcbiAgICAgICAgdmFsIHggPSBsaXN0LnNpemVcbiAgICAgICAgdmFsIHJlc3VsdCA9IEFycmF5KHgpIHsgRG91YmxlQXJyYXkobikgfVxuXG4gICAgICAgIGZvciAocm93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xuICAgIHZhbCBmaXJzdFF1YXJ0aWxlOiBEb3VibGVcbiAgICAvLyAyNSAlXG4gICAgdmFsIHRoaXJkUXVhcnRpbGU6IERvdWJsZSAgICAvLyA3NSAlXG5cbiAgICBwcml2YXRlIGZ1biBtZWRpYW5BdFBvaW50ZXIobDogTGlzdDxEb3VibGU+LCBwb2ludGVyOiBEb3VibGUpOiBEb3VibGUge1xuICAgICAgICB2YWwgcmludCA9IHJvdW5kKHBvaW50ZXIpXG4gICAgICAgIHJldHVybiBpZiAocG9pbnRlciA9PSByaW50KSB7XG4gICAgICAgICAgICBsW3BvaW50ZXIudG9JbnQoKV1cbiAgICAgICAgfSBlbHNlIChsW2NlaWwocG9pbnRlcikudG9JbnQoKV0gKyBsW2Zsb29yKHBvaW50ZXIpLnRvSW50KCldKSAvIDIuMFxuICAgIH1cblxuICAgIGNvbnN0cnVjdG9yKGRhdGE6IExpc3Q8RG91YmxlPikge1xuICAgICAgICB2YWwgc29ydGVkID0gT3JkZXJpbmcubmF0dXJhbDxEb3VibGU+KCkuc29ydGVkQ29weShkYXRhKVxuICAgICAgICBpZiAoc29ydGVkLmlzRW1wdHkoKSkge1xuICAgICAgICAgICAgdGhpcmRRdWFydGlsZSA9IERvdWJsZS5OYU5cbiAgICAgICAgICAgIGZpcnN0UXVhcnRpbGUgPSB0aGlyZFF1YXJ0aWxlXG4gICAgICAgICAgICBtZWRpYW4gPSBmaXJzdFF1YXJ0aWxlXG4gICAgICAgICAgICBtYXggPSBtZWRpYW5cbiAgICAgICAgICAgIG1pbiA9IG1heFxuICAgICAgICB9IGVsc2UgaWYgKHNvcnRlZC5zaXplID09IDEpIHtcbiAgICAgICAgICAgIHRoaXJkUXVhcnRpbGUgPSBzb3J0ZWQuZ2V0KDApXG4gICAgICAgICAgICBmaXJzdFF1YXJ0aWxlID0gdGhpcmRRdWFydGlsZVxuICAgICAgICAgICAgbWVkaWFuID0gZmlyc3RRdWFydGlsZVxuICAgICAgICAgICAgbWF4ID0gbW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3QobXlLZXlzLnNpemUpXG4gICAgICAgIGZvciAoaSBpbiBteUtleXMuaW5kaWNlcykge1xuICAgICAgICAgICAgbXlJbmRpY2VzLmFkZChpKVxuICAgICAgICB9XG5cbiAgICAgICAgbXlJbmRpY2VzLnNvcnRXaXRoKENvbXBhcmF0b3IgeyBpOiBJbnQ/LCBqOiBJbnQ/IC0+XG4gICAgICAgICAgICB2YWwga2V5SSA9IG15S2V5c1tpISFdXG4gICAgICAgICAgICB2YWwga2V5SiA9IG15S2V5c1tqISFdXG4gICAgICAgICAgICB3aGVuIHtcbiAgICAgICAgICAgICAgICBrZXlJID09PSBrZXlKIC0+IDBcbiAgICAgICAgICAgICAgICBrZXlJID09IG51bGwgLT4gLTFcbiAgICAgICAgICAgICAgICBrZXlKID09IG51bGwgLT4gMVxuICAgICAgICAgICAgICAgIGVsc2UgLT4ga2V5SS5jb21wYXJlVG8oa2V5SilcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSlcbiAgICB9XG5cbiAgICBmdW4gPFQ+IHNvcnRlZENvcHkobDogTGlzdDxUPz4pOiBMaXN0PFQ/PiB7XG4gICAgICAgIHJlcXVpcmUobC5zaXplID09IG15SW5kaWNlcy5zaXplKSB7IFwiRXhwZWN0ZWQgc2l6ZSBcIiArIG15SW5kaWNlcy5zaXplICsgXCIgYnV0IHdhcyBzaXplIFwiICsgbC5zaXplIH1cbiAgICAgICAgdmFsIGNvcHkgPSBBcnJheUxpc3Q8VD8+KG15SW5kaWNlcy5zaXplKVxuICAgICAgICBmb3IgKG9sZEluZGV4IGluIG15SW5kaWNlcykge1xuICAgICAgICAgICAgdmFsIHYgPSBsW29sZEluZGV4XVxuICAgICAgICAgICAgY29weS5hZGQodilcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY29weVxuICAgIH1cblxuICAgIGZ1biBzb3J0ZWRDb3B5T2ZLZXlzKCk6IExpc3Q8Sz8+IHtcbiAgICAgICAgcmV0dXJuIHNvcnRlZENvcHkobXlLZXlzKV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VJTOiBNYXA8U3RyaW5nLCBEYXRhRnJhbWUuVmFyaWFibGU+ID0gcnVuIHtcbiAgICAgICAgdmFsIHZhcmlhYmxlTGlzdCA9IGxpc3RPZihcbiAgICAgICAgICAgIFgsXG4gICAgICAgICAgICBZLFxuICAgICAgICAgICAgQ09VTlQsXG4gICAgICAgICAgICBERU5TSVRZLFxuICAgICAgICAgICAgWV9NSU4sXG4gICAgICAgICAgICBZX01BWCxcbiAgICAgICAgICAgIFNFLFxuICAgICAgICAgICAgTEVWRUwsXG4gICAgICAgICAgICBMT1dFUixcbiAgICAgICAgICAgIE1JRERMRSxcbiAgICAgICAgICAgIFVQUEVSLFxuICAgICAgICAgICAgV0lEVEgsXG4gICAgICAgICAgICBTQ0FMRUQsXG4gICAgICAgICAgICBHUk9VUCxcbiAgICAgICAgICAgIENPUlIsXG4gICAgICAgICAgICBDT1JSX0FCU1xuICAgICAgICApXG5cbiAgICAgICAgdmFsIHJlc3VsdCA9IEhhc2hNYXA8U3RyaW5nLCBEYXRhRnJhbWUuVmFyaWFibGU+KClcbiAgICAgICAgZm9yICh2YXJpYWJsZSBpbiB2YXJpYWJsZUxpc3QpIHtcbiAgICAgICAgICAgIHJlc3VsdFt2YXJpYWJsZS5uYW1lXSA9IHZhcmlhYmxlXG4gICAgICAgIH1cbiAgICAgICAgcmVzdWx0XG4gICAgfVxuXG4gICAgZnVuIGlzU3RhdFZhcih2YXJOYW1lOiBTdHJpbmcpOiBCb29sZWFuIHtcbiAgICAgICAgcmV0dXJuIFZBUlMuY29udGFpbnNLZXkodmFyTmFtZSlcbiAgICB9XG5cbiAgICBmdW4gc3RhdFZhcih2YXJOYW1lOiBTdHJpbmcpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICByZXF1aXJlKFZBUlMuY29udGFpbnNLZXkodmFyTmFtZSkpIHsgXCJVbmtub3duIHN0YXQgdmFyaWFibGUgJHZhck5hbWVcIiB9XG4gICAgICAgIHJldHVybiBWQVJTW3Zhck5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IT0gbnVsbCkge1xuICAgICAgICAgICAgeFBvc0tpbmQgPSBCaW5TdGF0LlhQb3NLaW5kLkNFTlRFUlxuICAgICAgICAgICAgeFBvc1ZhbHVlID0gY2VudGVyXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gQmluU3RhdChcbiAgICAgICAgICAgIGJpbkNvdW50ID0gYmluQ291bnQsXG4gICAgICAgICAgICBiaW5XaWR0aCA9IGJpbldpZHRoLFxuICAgICAgICAgICAgeFBvc0tpbmQgPSB4UG9zS2luZCxcbiAgICAgICAgICAgIHhQb3MgPSB4UG9zVmFsdWVcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biBzbW9vdGgoXG4gICAgICAgIHNtb290aGVyUG9pbnRDb3VudDogSW50ID0gU21vb3RoU3RhdC5ERUZfRVZBTF9QT0lOVF9DT1VOVCxcbiAgICAgICAgc21vb3RoaW5nTWV0aG9kOiBTbW9vdGhTdGF0Lk1ldGhvZCA9IFNtb290aFN0YXQuREVGX1NNT09USElOR19NRVRIT0QsXG4gICAgICAgIGNvbmZpZGVuY2VMZXZlbDogRG91YmxlID0gU21vb3RoU3RhdC5ERUZfQ09ORklERU5DRV9MRVZFTCxcbiAgICAgICAgZGlzcGxheUNvbmZpZGVuY2VJbnRlcnZhbDogQm9vbGVhbiA9IFNtb290aFN0YXQuREVGX0RJU1BMQVlfQ09ORklERU5DRV9JTlRFUlZBTCxcbiAgICAgICAgc3BhbjogRG91YmxlID0gU21vb3RoU3RhdC5ERUZfU1BBTixcbiAgICAgICAgcG9seW5vbWlhbERlZ3JlZTogSW50ID0gU21vb3RoU3RhdC5ERUZfREVHLFxuICAgICAgICBsb2Vzc0NyaXRpY2FsU2l6ZTogSW50ID0gU21vb3RoU3RhdC5ERUZfTE9FU1NfQ1JJVElDQUxfU0laRSxcbiAgICAgICAgc2FtcGxpbmdTZWVkOiBMb25nID0gU21vb3RoU3RhdC5ERUZfU0FNUExJTkdfU0VFRFxuICAgICk6IFNtb290aFN0YX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NZXRob2QsXG4gICAgICAgICAgICB0eXBlID0gdHlwZSxcbiAgICAgICAgICAgIGZpbGxEaWFnb25hbCA9IGZpbGxEaWFnb25hbCxcbiAgICAgICAgICAgIHRocmVzaG9sZCA9IHRocmVzaG9sZFxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIGNvbnRvdXIoXG4gICAgICAgIGJpbkNvdW50OiBJbnQgPSBDb250b3VyU3RhdC5ERUZfQklOX0NPVU5ULFxuICAgICAgICBiaW5XaWR0aDogRG91YmxlPyA9IG51bGxcbiAgICApOiBDb250b3VyU3RhdCB7XG4gICAgICAgIHJldHVybiBDb250b3VyU3RhdChcbiAgICAgICAgICAgIGJpbkNvdW50ID0gYmluQ291bnQsXG4gICAgICAgICAgICBiaW5XaWR0aCA9IGJpbldpZHRoXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gY29udG91cmYoXG4gICAgICAgIGJpbkNvdW50OiBJbnQgPSBDb250b3VyU3RhdC5ERUZfQklOX0NPVU5ULFxuICAgICAgICBiaW5XaWR0aDogRG91YmxlPyA9IG51bGxcbiAgICApOiBDb250b3VyZlN0YXQge1xuICAgICAgICByZXR1cm4gQ29udG91cmZTdGF0KFxuICAgICAgICAgICAgYmluQ291bnQgPSBiaW5Db3VudCxcbiAgICAgICAgICAgIGJpbldpZHRoID0gYmluV2lkdGhcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biBib3hwbG90KFxuICAgICAgICB3aGlza2VySVFSUmF0aW86IERvdWJsZSA9IEJveHBsb3RTdGF0LkRFRl9XSElTS0VSX0lRUl9SQVRJTyxcbiAgICAgICAgY29tcHV0ZVdpZHRoOiBCb29sZWFuID0gQm94cGxvdFN0YXQuREVGX0NPTVBVVEVfV0lEVEhcbiAgICApOiBCb3hwbG90U3RhdCB7XG4gICAgICAgIHJldHVybiBCb3hwbG90U3RhdCh3aGlza2VySVFSUmF0aW8sIGNvbXB1dGVXaWR0aClcbiAgICB9XG5cbiAgICBmdW4gZG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bWF4SXRlcmF0aW9uczogSW50ID0gSW50Lk1BWF9WQUxVRVxuICAgICk6IERvdWJsZSB7XG4gICAgICAgIHZhbCByZXQ6IERvdWJsZVxuXG4gICAgICAgIGlmICh4LmlzTmFOKCkgfHxcbiAgICAgICAgICAgIGEuaXNOYU4oKSB8fFxuICAgICAgICAgICAgYi5pc05hTigpIHx8XG4gICAgICAgICAgICB4IDwgMCB8fFxuICAgICAgICAgICAgeCA+IDEgfHxcbiAgICAgICAgICAgIGEgPD0gMC4wIHx8XG4gICAgICAgICAgICBiIDw9IDAuMFxuICAgICAgICApIHtcbiAgICAgICAgICAgIHJldCA9IERvdWJsZS5OYU5cbiAgICAgICAgfSBlbHNlIGlmICh4ID4gKGEgKyAxLjApIC8gKGEgKyBiICsgMi4wKSkge1xuICAgICAgICAgICAgcmV0ID0gMS4wIC0gcmVndWxhcml6ZWRCZXRhKFxuICAgICAgICAgICAgICAgIDEuMCAtIHgsXG4gICAgICAgICAgICAgICAgYixcbiAgICAgICAgICAgICAgICBhLFxuICAgICAgICAgICAgICAgIGVwc2lsb24sXG4gICAgICAgICAgICAgICAgbWF4SXRlcmF0aW9uc1xuICAgICAgICAgICAgKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdmFsIGZyYWN0aW9uID0gb2JqZWN0IDogQ29udGludWVkRnJhY3Rpb24oKSB7XG5cbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gZ2V0QihuOiBJbnQsIHg6IERvdWJsZSk6IERvdWJsZSB7XG4gICAgICAgICAgICAgICAgICAgIEBTdXBwcmVzcyhcIk5BTUVfU0hBRE9XSU5HXCIpXG4gICAgICAgICAgICAgICAgICAgIHZhbCByZXQ6IERvdWJsZVxuICAgICAgICAgICAgICAgICAgICB2YWwgbTogRG91YmxlXG4gICAgICAgICAgICAgICAgICAgIGlmIChuICUgMiA9PSAwKSB7IC8vIGV2ZW5cbiAgICAgICAgICAgICAgICAgICAgICAgIG0gPSBuIC8gMi4wXG4gICAgICAgICAgICAgICAgICAgICAgICByZXQgPSBtICogKGIgLSBtKSAqIHggLyAoKGEgKyAyICogbSAtIDEpICogKGEgKyAyICogbSkpXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBtID0gKG4gLSAxLjApIC8gMi4wXG4gICAgICAgICAgICAgICAgICAgICAgICByZXQgPSAtKChhICsgbSkgKiAoYSArIGIgKyBtKSAqIHgpIC8gKChhICsgMiAqIG0pICogKGEgKyAyICogbSArIDEuMCkpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJldFxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBnZXRBKG46IEludCwgeDogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDEuMFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldCA9IGV4cChcbiAgICAgICAgICAgICAgICBhICogbG4oeCkgKyBiICogbG4oMS4wIC0geCkgLVxuICAgICAgICAgICAgICAgICAgICAgICAgbG4oYSkgLSBsb2dCZXRhKGEsIGIsIGVwc2lsb24sIG1heEl0ZXJhdGlvbnMpXG4gICAgICAgICAgICApICogMS4wIC8gZnJhY3Rpb24uZXZhbHVhdGUoeCwgZXBzaWxvbiwgbWF4SXRlcmF0aW9ucylcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiByZXRcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIHRoZSBuYXR1cmFsIGxvZ2FyaXRobSBvZiB0aGUgYmV0YSBmdW5jdGlvbiBCKGEsIGIpLlxuICAgICAqXG4gICAgICogVGhlIGltcGxlbWVudGF0aW9uIG9mIHRoaXMgbWV0aG9kIGlzIGJhc2VkIG9uOlxuICAgICAqXG4gICAgICogICogW1xuICogQmV0YSBGdW5jdGlv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0RhdGFcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBpbmRleCA9IDBcbiAgICAgICAgZm9yIChpQmxvY2sgaW4gMCB1bnRpbCBibG9ja1Jvd3MpIHtcbiAgICAgICAgICAgIHZhbCBpSGVpZ2h0ID0gYmxvY2tIZWlnaHQoaUJsb2NrKVxuICAgICAgICAgICAgdmFyIGpCbG9jayA9IDBcbiAgICAgICAgICAgIHdoaWxlIChqQmxvY2sgPCBibG9ja0NvbHVtbnMpIHtcbiAgICAgICAgICAgICAgICBpZiAoYmxvY2tEYXRhW2luZGV4XS5zaXplICE9IGlIZWlnaHQgKiBibG9ja1dpZHRoKGpCbG9jaykpIHtcbiAgICAgICAgICAgICAgICAgICAgZXJyb3IoXCJcIilcbiAgICAgICAgICAgICAgICAgICAgLy90aHJvdyBEaW1lbnNpb25NaXNtYXRjaEV4Y2VwdGlvbihcbiAgICAgICAgICAgICAgICAgICAgLy8gICAgYmxvY2tEYXRhW2luZGV4XS5zaXplLFxuICAgICAgICAgICAgICAgICAgICAvLyAgICBpSGVpZ2h0ICogYmxvY2tXaWR0aChqQmxvY2spXG4gICAgICAgICAgICAgICAgICAgIC8vKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoY29weUFycmF5KSB7XG4gICAgICAgICAgICAgICAgICAgIGJsb2Nrc0NvcHlMaXN0LmFkZChibG9ja0RhdGFbaW5kZXhdLmNvcHlPZigpKVxuICAgICAgICAgICAgICAgICAgICAvL2Jsb2Nrc1tpbmRleF0gPSBibG9ja0RhdGFbaW5kZXhdLmNvcHlPZigpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICsrakJsb2NrXG4gICAgICAgICAgICAgICAgKytpbmRleFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGNvcHlBcnJheSkge1xuICAgICAgICAgICAgYmxvY2tzID0gYmxvY2tzQ29weUxpc3QudG9UeXBlZEFycmF5KClcbiAgICAgIC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ICAgICAvLyB0cmFuc3Bvc2UgY3VycmVudCBibG9ja1xuICAgICAgICAgICAgICAgIHZhbCBvdXRCbG9jayA9IG91dC5ibG9ja3NbYmxvY2tJbmRleF1cbiAgICAgICAgICAgICAgICB2YWwgdEJsb2NrID0gYmxvY2tzW2pCbG9jayAqIGJsb2NrQ29sdW1ucyArIGlCbG9ja11cbiAgICAgICAgICAgICAgICB2YWwgcFN0YXJ0ID0gaUJsb2NrICogQkxPQ0tfU0laRVxuICAgICAgICAgICAgICAgIHZhbCBwRW5kID0gbWluKHBTdGFydCArIEJMT0NLX1NJWkUsIGNvbHVtbnMpXG4gICAgICAgICAgICAgICAgdmFsIHFTdGFydCA9IGpCbG9jayAqIEJMT0NLX1NJWkVcbiAgICAgICAgICAgICAgICB2YWwgcUVuZCA9IG1pbihxU3RhcnQgKyBCTE9DS19TSVpFLCByb3dzKVxuICAgICAgICAgICAgICAgIHZhciBrID0gMFxuICAgICAgICAgICAgICAgIGZvciAocCBpbiBwU3RhcnQgdW50aWwgcEVuZCkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgbEluYyA9IHBFbmQgLSBwU3RhcnRcbiAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBwIC0gcFN0YXJ0XG4gICAgICAgICAgICAgICAgICAgIGZvciAocSBpbiBxU3RhcnQgdW50aWwgcUVuZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgb3V0QmxvY2tba10gPSB0QmxvY2tbbF1cbiAgICAgICAgICAgICAgICAgICAgICAgICsra1xuICAgICAgICAgICAgICAgICAgICAgICAgbCArPSBsSW5jXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gZ28gdG8gbmV4dCBibG9ja1xuICAgICAgICAgICAgICAgICsrYmxvY2tJbmRleFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIG91dFxuICAgIH1cblxuICAgIC8qKlxuICAgICAqI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m9yIChqQmxvY2sgaW4gMCB1bnRpbCBvdXQuYmxvY2tDb2x1bW5zKSB7XG4gICAgICAgICAgICAgICAgdmFsIGpXaWR0aCA9IG91dC5ibG9ja1dpZHRoKGpCbG9jaylcbiAgICAgICAgICAgICAgICB2YWwgaldpZHRoMiA9IGpXaWR0aCArIGpXaWR0aFxuICAgICAgICAgICAgICAgIHZhbCBqV2lkdGgzID0galdpZHRoMiArIGpXaWR0aFxuICAgICAgICAgICAgICAgIHZhbCBqV2lkdGg0ID0galdpZHRoMyArIGpXaWR0aFxuXG4gICAgICAgICAgICAgICAgLy8gc2VsZWN0IGN1cnJlbnQgYmxvY2tcbiAgICAgICAgICAgICAgICB2YWwgb3V0QmxvY2sgPSBvdXQuYmxvY2tzW2Jsb2NrSW5kZXhdXG5cbiAgICAgICAgICAgICAgICAvLyBwZXJmb3JtIG11bHRpcGxpY2F0aW9uIG9uIGN1cnJlbnQgYmxvY2tcbiAgICAgICAgICAgICAgICBmb3IgKGtCbG9jayBpbiAwIHVudGlsIGJsb2NrQ29sdW1ucykge1xuICAgICAgICAgICAgICAgICAgICB2YWwga1dpZHRoID0gYmxvY2tXaWR0aChrQmxvY2spXG4gICAgICAgICAgICAgICAgICAgIHZhbCB0QmxvY2sgPSBibG9ja3NbaUJsb2NrICogYmxvY2tDb2x1bW5zICsga0Jsb2NrXVxuICAgICAgICAgICAgICAgICAgICB2YWwgbUJsb2NrID0gbS5ibG9ja3Nba0Jsb2NrICogbS5ibG9ja0NvbHVtbnMgKyBqQmxvY2tdXG4gICAgICAgICAgICAgICAgICAgIHZhciBrID0gMFxuICAgICAgICAgICAgICAgICAgICBmb3IgKHAgaW4gcFN0YXJ0IHVudGlsIHBFbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBsU3RhcnQgPSAocCAtIHBTdGFydCkgKiBrV2lkdGhcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBsRW5kID0gbFN0YXJ0ICsga1dpZHRoXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG5TdGFydCBpbiAwIHVudGlsIGpXaWR0aCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzdW0gPSAwLjBcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGxTdGFydFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gblN0YXJ0XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGwgPCBsRW5kIC0gMykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdW0gKz0gdEJsb2NrW2xdICogbUJsb2NrW25dICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0QmxvY2tbbCArIDFdICogbUJsb2NrW24gKyBqV2lkdGhdICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0QmxvY2tbbCArIDJdICogbUJsb2NrW24gKyBqV2lkdGgyXSArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdEJsb2NrW2wgKyAzXSAqIG1CbG9ja1tuICsgaldpZHRoM11cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCArPSA0XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gKz0galdpZHRoNFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAobCA8IGxFbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VtICs9IHRCbG9ja1tsKytdICogbUJsb2NrW25dXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gKz0galdpZHRoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dEJsb2NrW2tdICs9IHN1bVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICsra1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIGdvIHRvIG5leHQgYmxvY2tcbiAgICAgICAgICAgICAgICArK2Jsb2NrSW5kZXhcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBvdXRcbiAgICB9XG5cblxuICAgIC8qKiB7QGluaGVyaXREb2N9ICAqL1xuICAgIGZ1biBnZXRFbnRyeShyb3c6IEludCwgY29sdW1uOiBJbnQpOiBEb3VibGUge1xuICAgICAgICAvL01hdHJpeFV0aWxzLmNoZWNrTWF0cml4SW5kZXgodGhpcywgcm93LCBjb2x1bW4pXG4gICAgICAgIGlmIChyb3cgPCAwIHx8IHJvdyA+IGdldFJvd0RpbWVuc2lvbigpKSBlcnJvcihcInJvdyBvdXQgb2YgcmFuZ2U6ICRyb3dcIilcbiAgICAgICAgaWYgKGNvbHVtbiA8IDAgfHwgY29sdW1uID4gZ2V0Q29sdW1uRGltZW5zaW9uKCkpIGVycm9yKFwiY29sdW1uIG91dCBvZiByYW5nZTogJGNvbHVtblwiKVxuXG4gICAgICAgIHZhbCBpQmxvY2sgPSByb3cgLyBCTE9DS19TSVpFXG4gICAgICAgIHZhbCBqQmxvY2sgPSBjb2x1bW4gLyBCTE9DS19TSVpFXG4gICAgICAgIHZhbCBrID0gKHJvdyAtIGlCbG9jayAqIEJMT0NLX1NJWkUpICogYmxvY2tXaWR0aChqQmxvY2spICsgKGNvbHVtbiAtIGpCbG9jayAqIEJMT0NLX1NJWkUpXG4gICAgICAgIHJldHVybiBibG9ja3NbaUJsb2NrICogYmxvY2tDb2x1bW5zICsgakJsb2NrXVtrXVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGdldFJvd0RpbWVuc2lvbigpOiBJbnQge1xuICAgICAgICByZXR1cm4gcm93c1xuICAgIH1cblxuICAgIC8qKiB7QGluaGVyaXREb2N9ICAqL1xuICAgIHByaXZhd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JWkUsIHJvd3MpXG4gICAgICAgICAgICB2YWwgaUhlaWdodCA9IHBFbmQgLSBwU3RhcnRcbiAgICAgICAgICAgIGZvciAoakJsb2NrIGluIDAgdW50aWwgYmxvY2tDb2x1bW5zKSB7XG4gICAgICAgICAgICAgICAgdmFsIHFTdGFydCA9IGpCbG9jayAqIEJMT0NLX1NJWkVcbiAgICAgICAgICAgICAgICB2YWwgcUVuZCA9IG1pbihxU3RhcnQgKyBCTE9DS19TSVpFLCBjb2x1bW5zKVxuICAgICAgICAgICAgICAgIHZhbCBqV2lkdGggPSBxRW5kIC0gcVN0YXJ0XG5cbiAgICAgICAgICAgICAgICAvLyBhbGxvY2F0ZSBuZXcgYmxvY2tcbiAgICAgICAgICAgICAgICB2YWwgYmxvY2sgPSBEb3VibGVBcnJheShpSGVpZ2h0ICogaldpZHRoKVxuICAgICAgICAgICAgICAgIGJsb2Nrc0xpc3QuYWRkKGJsb2NrKVxuXG4gICAgICAgICAgICAgICAgLy8gY29weSBkYXRhXG4gICAgICAgICAgICAgICAgdmFyIGluZGV4ID0gMFxuICAgICAgICAgICAgICAgIGZvciAocCBpbiBwU3RhcnQgdW50aWwgcEVuZCkge1xuICAgICAgICAgICAgICAgICAgICByYXdEYXRhW3BdLmNvcHlJbnRvKGJsb2NrLCBpbmRleCwgcVN0YXJ0LCBxRW5kKVxuICAgICAgICAgICAgICAgICAgICAvL1N5c3RlbS5hcnJheWNvcHkocmF3RGF0YVtwXSwgcVN0YXJ0LCBibG9jaywgaW5kZXgsIGpXaWR0aClcbiAgICAgICAgICAgICAgICAgICAgaW5kZXggKz0galdpZHRoXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICsrYmxvY2tJbmRleFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGJsb2Nrc0xpc3QudG9UeXBlZEFycmF5KClcbiAgICB9XG59IiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOSBKZXRCcmFpbn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iA9IGhpXG4gICAgICAgIHZhciBmYiA9IGZIaVxuICAgICAgICB2YXIgYyA9IGFcbiAgICAgICAgdmFyIGZjID0gZmFcbiAgICAgICAgdmFyIGQgPSBiIC0gYVxuICAgICAgICB2YXIgZSA9IGRcblxuICAgICAgICB2YWwgdCA9IGFic29sdXRlQWNjdXJhY3lcbiAgICAgICAgdmFsIGVwcyA9IHJlbGF0aXZlQWNjdXJhY3lcblxuICAgICAgICB3aGlsZSAodHJ1ZSkge1xuICAgICAgICAgICAgaWYgKGFicyhmYykgPCBhYnMoZmIpKSB7XG4gICAgICAgICAgICAgICAgYSA9IGJcbiAgICAgICAgICAgICAgICBiID0gY1xuICAgICAgICAgICAgICAgIGMgPSBhXG4gICAgICAgICAgICAgICAgZmEgPSBmYlxuICAgICAgICAgICAgICAgIGZiID0gZmNcbiAgICAgICAgICAgICAgICBmYyA9IGZhXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbCB0b2wgPSAyLjAgKiBlcHMgKiBhYnMoYikgKyB0XG4gICAgICAgICAgICB2YWwgbSA9IDAuNSAqIChjIC0gYilcblxuICAgICAgICAgICAgaWYgKGFicyhtKSA8PSB0b2wgfHwgUHJlY2lzaW9uLmVxdWFscyhmYiwgMC4wKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBiXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoYWJzKGUpIDwgdG9sIHx8IGFicyhmYSkgPD0gYWJzKGZiKSkge1xuICAgICAgICAgICAgICAgIC8vIEZvcmNlIGJpc2VjdGlvbi5cbiAgICAgICAgICAgICAgICBkID0gbVxuICAgICAgICAgICAgICAgIGUgPSBkXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHZhciBzID0gZmIgLyBmYVxuICAgICAgICAgICAgICAgIHZhciBwOiBEb3VibGVcbiAgICAgICAgICAgICAgICB2YXIgcTogRG91YmxlXG4gICAgICAgICAgICAgICAgLy8gVGhlIGVxdWFsaXR5IHRlc3QgKGEgPT0gYykgaXMgaW50ZW50aW9uYWwsXG4gICAgICAgICAgICAgICAgLy8gaXQgaXMgcGFydCBvZiB0aGUgb3JpZ2luYWwgQnJlbnQncyBtZXRob2QgYW5kXG4gICAgICAgICAgICAgICAgLy8gaXQgc2hvdWxkIE5PVCBiZSByZXBsYWNlZCBieSBwcm94aW1pdHkgdGVzdC5cbiAgICAgICAgICAgICAgICBpZiAoYSA9PSBjKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIExpbmVhciBpbnRlcnBvbGF0aW9uLlxuICAgICAgICAgICAgICAgICAgICBwID0gMi4wICogbSAqIHNcbiAgICAgICAgICAgICAgICAgICAgcSA9IDEgLSBzXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gSW52ZXJzZSBxdWFkcmF0aWMgaW50ZXJwb2xhdGlvbi5cbiAgICAgICAgICAgICAgICAgICAgcSA9IGZhIC8gZmNcbiAgICAgICAgICAgICAgICAgICAgdmFsIHIgPSBmYiAvIGZjXG4gICAgICAgICAgICAgICAgICAgIHAgPSBzICogKDIuMCAqIG0gKiBxICogKHEgLSByKSAtIChiIC0gYSkgKiAociAtIDEpKVxuICAgICAgICAgICAgICAgICAgICBxID0gKHEgLSAxKSAqIChyIC0gMSkgKiAocyAtIDEpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChwID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBxID0gLXFcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBwID0gLXBcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcyA9IGVcbiAgICAgICAgICAgICAgICBlID0gZFxuICAgICAgICAgICAgICAgIGlmIChwID49IDEuNSAqIG0gKiBxIC0gYWJzKHRvbCAqIHEpIHx8IHAgPj0gYWJzKDAuNSAqIHMgKiBxKSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBJbnZlcnNlIHF1YWRyYXRpYyBpbnRlcnBvbGF0aW9uIGdpdmVzIGEgdmFsdWVcbiAgICAgICAgICAgICAgICAgICAgLy8gaW4gdGhlIHdyb25nIGRpcmVjdGlvbiwgb3IgcHJvZ3Jlc3MgaXMgc2xvdy5cbiAgICAgICAgICAgICAgICAgICAgLy8gRmFsbCBiYWNrIHRvIGJpc2VjdGlvbi5cbiAgICAgICAgICAgICAgICAgICAgZCA9IG1cbiAgICAgICAgICAgICAgICAgICAgZSA9IGRcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBkID0gcCAvIHFcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBhID0gYlxuICAgICAgICAgICAgZmEgPSBmYlxuXG4gICAgICAgICAgICBpZiAoYWJzKGQpID4gdG9sKSB7XG4gICAgICAgICAgICAgICAgYiArPSBkXG4gICAgICAgICAgICB9IGVsc2UgaWYgKG0gPiAwKSB7XG4gICAgICAgICAgICAgICAgYiArPSB0b2xcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgYiAtPSB0b2xcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGZiID0gY29tcHV0ZU9iamVjdGl2ZVZhbHVlKGIpXG4gICAgICAgICAgICBpZiAoZmIgPiAwICYmIGZjID4gMCB8fCBmYiA8PSAwICYmIGZjIDw9IDApIHtcbiAgICAgICAgICAgICAgICBjID0gYVxuICAgICAgICAgICAgICAgIGZjID0gZmFcbiAgICAgICAgICAgICAgICBkID0gYiAtIGFcbiAgICAgICAgICAgICAgICBlID0gZFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG5cbiAgICAgICAgLyoqIERlZmF1bHQgYWJzb2x1dGUgYWNjdXJhY3kuICAqL1xuICAgICAgICBwcml2YXRlIHZhbCBERUZBVUxUX0FCU09MVVRFX0FDQ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BEb3VibGUgPSBERUZBVUxUX0VQU0lMT04sIG1heEl0ZXJhdGlvbnM6IEludCA9IEludC5NQVhfVkFMVUUpOiBEb3VibGUge1xuICAgICAgICB2YXIgcDAgPSAxLjBcbiAgICAgICAgdmFyIHAxID0gZ2V0QSgwLCB4KVxuICAgICAgICB2YXIgcTAgPSAwLjBcbiAgICAgICAgdmFyIHExID0gMS4wXG4gICAgICAgIHZhciBjID0gcDEgLyBxMVxuICAgICAgICB2YXIgbiA9IDBcbiAgICAgICAgdmFyIHJlbGF0aXZlRXJyb3IgPSBEb3VibGUuTUFYX1ZBTFVFXG4gICAgICAgIHdoaWxlIChuIDwgbWF4SXRlcmF0aW9ucyAmJiByZWxhdGl2ZUVycm9yID4gZXBzaWxvbikge1xuICAgICAgICAgICAgKytuXG4gICAgICAgICAgICB2YWwgYSA9IGdldEEobiwgeClcbiAgICAgICAgICAgIHZhbCBiID0gZ2V0QihuLCB4KVxuICAgICAgICAgICAgdmFyIHAyID0gYSAqIHAxICsgYiAqIHAwXG4gICAgICAgICAgICB2YXIgcTIgPSBhICogcTEgKyBiICogcTBcbiAgICAgICAgICAgIHZhciBpbmZpbml0ZSA9IGZhbHNlXG4gICAgICAgICAgICBpZiAocDIuaXNJbmZpbml0ZSgpIHx8IHEyLmlzSW5maW5pdGUoKSkge1xuICAgICAgICAgICAgICAgIC8qXG4gICAgICAgICAgICAgICAgICogTmVlZCB0byBzY2FsZS4gVHJ5IHN1Y2Nlc3NpdmUgcG93ZXJzIG9mIHRoZSBsYXJnZXIgb2YgYSBvciBiXG4gICAgICAgICAgICAgICAgICogdXAgdG8gNXRoIHBvd2VyLiBUaHJvdyBDb252ZXJnZW5jZUV4Y2VwdGlvbiBpZiBvbmUgb3IgYm90aFxuICAgICAgICAgICAgICAgICAqIG9mIHAyLCBxMiBzdGlsbCBvdmVyZmxvdy5cbiAgICAgICAgICAgICAgICAgKi9cbiAgICAgICAgICAgICAgICB2YXIgc2NhbGVGYWN0b3IgPSAxLjBcbiAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJWQVJJQUJMRV9XSVRIX1JFRFVOREFOVF9JTklUSUFMSVpFUlwiKVxuICAgICAgICAgICAgICAgIHZhciBsYXN0U2NhbGVGYWN0b3IgPSAxLjBcbiAgICAgICAgICAgICAgICB2YWwgbWF4UG93ZXIgPSA1XG4gICAgICAgICAgICAgICAgdmFsIHNjYWxlID0gbWF4KGEsIGIpXG4gICAgICAgICAgICAgICAgaWYgKHNjYWxlIDw9IDApIHsgIC8vIENhbid0IHNjYWxlXG4gICAgICAgICAgICAgICAgICAgIGVycm9yKFwiQ29udmVyZ2VuY2VFeGNlcHRpb25cIilcbiAgICAgICAgICAgICAgICAgICAgLy9Mb2NhbGl6ZWRGb3JtYXRzLkNPTlRJTlVFRF9GUkFDVElPTl9JTkZJTklUWV9ESVZFUkdFTkNFLFxuICAgICAgICAgICAgICAgICAgICAvL3hcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaW5maW5pdGUgPSB0cnVlXG4gICAgICAgICAgICAgICAgZm9yIChpIGluIDAgdW50aWwgbWF4UG93ZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgbGFzdFNjYWxlRmFjdG9yID0gc2NhbGVGYWN0b3JcbiAgICAgICAgICAgICAgICAgICAgc2NhbGVGYWN0b3IgKj0gc2NhbGVcbiAgICAgICAgICAgICAgICAgICAgaWYgKGEgIT0gMC4wICYmIGEgPiBiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwMiA9IHAxIC8gbGFzdFNjYWxlRmFjdG9yICsgYiAvIHNjYWxlRmFjdG9yICogcDBcbiAgICAgICAgICAgICAgICAgICAgICAgIHEyID0gcTEgLyBsYXN0U2NhbGVGYWN0b3IgKyBiIC8gc2NhbGVGYWN0b3IgKiBxMFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGIgIT0gMC4wKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwMiA9IGEgLyBzY2FsZUZhY3RvciAqIHAxICsgcDAgLyBsYXN0U2NhbGVGYWN0b3JcbiAgICAgICAgICAgICAgICAgICAgICAgIHEyID0gYSAvIHNjYWxlRmFjdG9yICogcTEgKyBxMCAvIGxhc3RTY2FsZUZhY3RvclxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGluZmluaXRlID0gcDIuaXNJbmZpbml0ZSgpIHx8IHEyLmlzSW5maW5pdGUoKVxuICAgICAgICAgICAgICAgICAgICBpZiAoIWluZmluaXRlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoaW5maW5pdGUpIHtcbiAgICAgICAgICAgICAgICAvLyBTY2FsaW5nIGZhaWxlZFxuICAgICAgICAgICAgICAgIGVycm9yKFwiQ29udmVyZ2VuY2VFeGNlcHRpb25cIilcbiAgICAgICAgICAgICAgICAvL0xvY2FsaXplZEZvcm1hdHMuQ09OVElOVUVEX0ZSQUNUSU9OX0lORklOSVRZX0RJVkVSR0VOQ0UsXG4gICAgICAgICAgICAgICAgLy94XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbCByID0gcDIgLyBxMlxuXG4gICAgICAgICAgICBpZiAoci5pc05hTigpKSB7XG4gICAgICAgICAgICAgICAgZXJyb3IoXCJDb252ZXJnZW5jZUV4Y2VwdGlvblwiKVxuICAgICAgICAgICAgICAgIC8vTG9jYWxpemVkRm9ybWF0cy5DT05USU5VRURfRlJBQ1RJT05fTkFOX0RJVkVSR0VOQ0UsXG4gICAgICAgICAgICAgICAgLy94XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZWxhdGl2ZUVycm9yID0gYWJzKHIgLyBjIC0gMS4wKVxuXG4gICAgICAgICAgICAvLyBwcmVwYXJlIGZvciBuZXh0IGl0ZXJhdGlvblxuICAgICAgICAgICAgYyA9IHAyI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Z2UgZmFzdGVyIGluIHRoaXNcbiAgICAgICAgICAgIC8vIGNhc2UuXG4gICAgICAgICAgICByZXQgPSAxLjAgLSByZWd1bGFyaXplZEdhbW1hUShhLCB4LCBlcHNpbG9uLCBtYXhJdGVyYXRpb25zKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgLy8gY2FsY3VsYXRlIHNlcmllc1xuICAgICAgICAgICAgdmFyIG4gPSAwLjAgLy8gY3VycmVudCBlbGVtZW50IGluZGV4XG4gICAgICAgICAgICB2YXIgYW4gPSAxLjAgLyBhIC8vIG4tdGggZWxlbWVudCBpbiB0aGUgc2VyaWVzXG4gICAgICAgICAgICB2YXIgc3VtID0gYW4gLy8gcGFydGlhbCBzdW1cbiAgICAgICAgICAgIHdoaWxlIChhYnMoYW4gLyBzdW0pID4gZXBzaWxvbiAmJlxuICAgICAgICAgICAgICAgIG4gPCBtYXhJdGVyYXRpb25zICYmXG4gICAgICAgICAgICAgICAgc3VtIDwgRG91YmxlLlBPU0lUSVZFX0lORklOSVRZXG4gICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICAvLyBjb21wdXRlIG5leHQgZWxlbWVudCBpbiB0aGUgc2VyaWVzXG4gICAgICAgICAgICAgICAgbiA9IG4gKyAxLjBcbiAgICAgICAgICAgICAgICBhbiA9IGFuICogKHggLyAoYSArIG4pKVxuXG4gICAgICAgICAgICAgICAgLy8gdXBkYXRlIHBhcnRpYWwgc3VtXG4gICAgICAgICAgICAgICAgc3VtID0gc3VtICsgYW5cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChuID49IG1heEl0ZXJhdGlvbnMpIHtcbiAgICAgICAgICAgICAgICBlcnJvcihcIk1heENvdW50RXhjZWVkZWQgLSBtYXhJdGVyYXRpb25zOiAkbWF4SXRlcmF0aW9uc1wiKVxuICAgICAgICAgICAgfSBlbHNlIGlmIChzdW0uaXNJbmZpbml0ZSgpKSB7XG4gICAgICAgICAgICAgICAgcmV0ID0gMS4w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GlvbnMpXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAvLyBjcmVhdGUgY29udGludWVkIGZyYWN0aW9uXG4gICAgICAgICAgICB2YWwgY2YgPSBvYmplY3QgOiBDb250aW51ZWRGcmFjdGlvbigpIHtcblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBnZXRBKG46IEludCwgeDogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDIuMCAqIG4gKyAxLjAgLSBhICsgeFxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBnZXRCKG46IEludCwgeDogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gKiAoYSAtIG4pXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXQgPSAxLjAgLyBjZi5ldmFsdWF0ZSh4LCBlcHNpbG9uLCBtYXhJdGVyYXRpb25zKVxuICAgICAgICAgICAgcmV0ID0gZXhwKC14ICsgYSAqIGxuKHgpIC0gbG9nR2FtbWEoYSkpICogcmV0XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmV0XG4gICAgfVxuXG5cbiAgICAvKipcbiAgICAgKlxuICAgICAqIENvbXB1dGVzIHRoZSBkaWdhbW1hIGZ1bmN0aW9uIG9mIHguXG4gICAgICpcbiAgICAgKlxuICAgICAqIFRoaXMgaXMgYW4gaW5kZXBlbmRlbnRseSB3cml0dGVuIGltcGxlbWVudGF0aW9uIG9mIHRoZSBhbGdvcml0aG0gZGVzY3JpYmVkIGluXG4gICAgICogSm9zZSBCZXJuYXJkbywgQWxnb3JpdGhtIEFTIDEwMzogUHNpIChEaWdhbW1hKSBGdW5jdGlvbiwgQXBwbGllZCBTdGF0aXN0aWNzLCAxOTc2LlxuICAgICAqXG4gICAgICpcbiAgICAgKiBTb21lIG9mIHRoZSBjb25zdGF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gICAgICogQHNpbmNlIDIuMFxuICAgICAqL1xuICAgIGZ1biBkaWdhbW1hKHg6IERvdWJsZSk6IERvdWJsZSB7XG4gICAgICAgIGlmICh4ID4gMCAmJiB4IDw9IFNfTElNSVQpIHtcbiAgICAgICAgICAgIC8vIHVzZSBtZXRob2QgNSBmcm9tIEJlcm5hcmRvIEFTMTAzXG4gICAgICAgICAgICAvLyBhY2N1cmF0ZSB0byBPKHgpXG4gICAgICAgICAgICByZXR1cm4gLUdBTU1BIC0gMSAvIHhcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh4ID49IENfTElNSVQpIHtcbiAgICAgICAgICAgIC8vIHVzZSBtZXRob2QgNCAoYWNjdXJhdGUgdG8gTygxL3heOClcbiAgICAgICAgICAgIHZhbCBpbnYgPSAxIC8gKHggKiB4KVxuICAgICAgICAgICAgLy8gICAgICAgICAgICAxICAgICAgIDEgICAgICAgIDEgICAgICAgICAxXG4gICAgICAgICAgICAvLyBsb2coeCkgLSAgLS0tIC0gLS0tLS0tICsgLS0tLS0tLSAtIC0tLS0tLS1cbiAgICAgICAgICAgIC8vICAgICAgICAgICAyIHggICAxMiB4XjIgICAxMjAgeF40ICAgMjUyIHheNlxuICAgICAgICAgICAgcmV0dXJuIGxuKHgpIC0gMC41IC8geCAtIGludiAqICgxLjAgLyAxMiArIGludiAqICgxLjAgLyAxMjAgLSBpbnYgLyAyNTIpKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGRpZ2FtbWEoeCArIDEpIC0gMSAvIHhcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDb21wdXRlcyB0aGUgdHJpZ2FtbWEgZnVuY3Rpb24gb2YgeC5cbiAgICAgKiBUaGlzIGZ1bmN0aW9uIGlzIGRlcml2ZWQgYnkgdGFraW5nIHRoZSBkZXJpdmF0aXZlIG9mIHRoZSBpbXBsZW1lbnRhdGlvblxuICAgICAqIG9mIGRpZ2FtbWEuXG4gICAgICpcbiAgICAgKiBAcGFyYW0geCBBcmd1bWVudC5cbiAgICAgKiBAcmV0dXJuIHRyaWdhbW1hKHgpIHRvIHdpdGhpbiAxMC04IHJlbGF0aXZlIG9yIGFic29sdXRlIGVycm9yIHdoaWNoZXZlciBpcyBzbWFsbGVyXG4gICAgICogQHNlZSBbVHJpZ2FtbWFdKGh0dHBzOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL1RyaWdhbW1hX2Z1bmN0aW9uKVxuICAgICAqXG4gICAgICogQHNlZSBHYW1tYS5kaWdhbW1hXG4gICAgICogQHNpbmNlIDIuMFxuICAgICAqL1xuICAgIGZ1biB0cmlnYW1tYSh4OiBEb3VibGUpOiBEb3VibGUge1xuICAgICAgICBpZiAoeCA+IDAgJiYgeCA8PSBTX0xJTUlUKSB7XG4gICAgICAgICAgICByZXR1cm4gMSAvICh4ICogeClcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh4ID49IENfTElNSVQpIHtcbiAgICAgICAgICAgIHZhbCBpbnYgPSAxIC8gKHggKiB4KVxuICAgICAgICAgICAgLy8gIDEgICAgMSAgICAgIDEgICAgICAgMSAgICAgICAxXG4gICAgICAgICAgICAvLyAgLSArIC0tLS0gKyAtLS0tIC0gLS0tLS0gKyAtLS0tLVxuICAgICAgICAgICAgLy8gIHggICAgICAyICAgICAgMyAgICAgICA1ICAgICAgIDdcbiAgICAgICAgICAgIC8vICAgICAgMiB4ICAgIDYgeCAgICAzMCB4ICAgIDQyIHhcbiAgICAgICAgICAgIHJldHVybiAxIC8geCArIGludiAvIDIgKyBpbnYgLyB4ICogKDEuMCAvIDYgLSBpbnYgKiAoMS4wIC8gMzAgKyBpbnYgLyA0MikpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gdHJpZ2FtbWEoeCArIDEpICsgMSAvICh4ICogeClcbiAgICB9XG59XG4vKipcbiAqIERlZmF1bHQgY29uc3RydWN0b3IuICBQcm9oaWJpdCBpbnN0YW50aWF0aW9uLlxuICovXG4vKipcbiAqIFJldHVybnMgdGhl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vdW50LlxuICAgICAqXG4gICAgICogQHJldHVybiB0aGUgY3VycmVudCBjb3VudC5cbiAgICAgKi9cbiAgICB2YXIgY291bnQgPSAwXG4gICAgICAgIHByaXZhdGUgc2V0XG5cbiAgICAvKipcbiAgICAgKiBDaGVja3Mgd2hldGhlciBhIHNpbmdsZSBpbmNyZW1lbnQgaXMgYWxsb3dlZC5cbiAgICAgKlxuICAgICAqIEByZXR1cm4gYGZhbHNlYCBpZiB0aGUgbmV4dCBjYWxsIHRvIFsgaW5jcmVtZW50Q291bnRdWy5pbmNyZW1lbnRDb3VudF0gd2lsbCB0cmlnZ2VyIGEgYE1heENvdW50RXhjZWVkZWRFeGNlcHRpb25gLFxuICAgICAqIGB0cnVlYCBvdGhlcndpc2UuXG4gICAgICovXG4gICAgZnVuIGNhbkluY3JlbWVudCgpOiBCb29sZWFuIHtcbiAgICAgICAgcmV0dXJuIGNvdW50IDwgbWF4aW1hbENvdW50XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUGVyZm9ybXMgbXVsdGlwbGUgaW5jcmVtZW50cy5cbiAgICAgKiBTZWUgdGhlIG90aGVyIFtpbmNyZW1lbnRDb3VudF1bLmluY3JlbWVudENvdW50XSBtZXRob2QpLlxuICAgICAqXG4gICAgICogQHBhcmFtIHZhbHVlIE51bWJlciBvZiBpbmNyZW1lbnRzLlxuICAgICAqIEB0aHJvd3MgTWF4Q291bnRFeGNlZWRlZEV4Y2VwdGlvbiBhdCBjb3VudGVyIGV4aGF1c3Rpb24uXG4gICAgICovXG4gICAgZnVuIGluY3JlbWVudENvdW50KHZhbHVlOiBJbnQpIHtcbiAgICAgICAgZm9yIChpIGluIDAgdW50aWwgdmFsdWUpIHtcbiAgICAgICAgICAgIGluY3JlbWVudENvdW50KClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEFkZHMgb25lIHRvIHRoZSBjdXJyZW50IGl0ZXJhdGlvbiBjb3VudC5cbiAgICAgKiBBdCBjb3VudGV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ICAgICBlcnJvcihcIkRpbWVuc2lvbiBtaXNtYXRjaCBvZiBpbnRlcnBvbGF0aW9uIHBvaW50czogJHt4dmFsLnNpemV9ICE9ICR7eXZhbC5zaXplfVwiKVxuICAgICAgICB9XG4gICAgICAgIHZhbCBuID0geHZhbC5zaXplXG4gICAgICAgIGlmIChuID09IDApIHtcbiAgICAgICAgICAgIGVycm9yKFwiTm8gZGF0YSB0byBpbnRlcnBvbGF0ZVwiKVxuICAgICAgICB9XG4gICAgICAgIGNoZWNrQWxsRmluaXRlUmVhbCh4dmFsKVxuICAgICAgICBjaGVja0FsbEZpbml0ZVJlYWwoeXZhbClcbiAgICAgICAgY2hlY2tBbGxGaW5pdGVSZWFsKHdlaWdodHMpXG4gICAgICAgIE1hdGhBcnJheXMuY2hlY2tPcmRlcih4dmFsKVxuICAgICAgICBpZiAobiA9PSAxKSB7XG4gICAgICAgICAgICByZXR1cm4gZG91YmxlQXJyYXlPZih5dmFsWzBdKVxuICAgICAgICB9XG4gICAgICAgIGlmIChuID09IDIpIHtcbiAgICAgICAgICAgIHJldHVybiBkb3VibGVBcnJheU9mKHl2YWxbMF0sIHl2YWxbMV0pXG4gICAgICAgIH1cbiAgICAgICAgdmFsIGJhbmR3aWR0aEluUG9pbnRzID0gKGJhbmR3aWR0aCAqIG4pLnRvSW50KClcbiAgICAgICAgaWYgKGJhbmR3aWR0aEluUG9pbnRzIDwgMikge1xuICAgICAgICAgICAgZXJyb3IoXCJMT0VTUyAnYmFuZHdpZHRoSW5Qb2ludHMnIGlzIHRvbyBzbWFsbDogJGJhbmR3aWR0aEluUG9pbnRzIDwgMlwiKVxuICAgICAgICB9XG4gICAgICAgIHZhbCByZXMgPSBEb3VibGVBcnJheShuKVxuICAgICAgICB2YWwgcmVzaWR1YWxzID0gRG91YmxlQXJyYXkobilcbiAgICAgICAgdmFsIHNvcnRlZFJlc2lkdWFscyA9IERvdWJsZUFycmF5KG4pXG4gICAgICAgIHZhbCByb2J1c3RuZXNzV2VpZ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kd2lkdGhJbnRlcnZhbFxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHZhbCBpbGVmdCA9IGJhbmR3aWR0aEludGVydmFsWzBdXG4gICAgICAgICAgICAgICAgdmFsIGlyaWdodCA9IGJhbmR3aWR0aEludGVydmFsWzFdXG4gICAgICAgICAgICAgICAgLy8gQ29tcHV0ZSB0aGUgcG9pbnQgb2YgdGhlIGJhbmR3aWR0aCBpbnRlcnZhbCB0aGF0IGlzXG4gICAgICAgICAgICAgICAgLy8gZmFydGhlc3QgZnJvbSB4XG4gICAgICAgICAgICAgICAgdmFsIGVkZ2U6IEludFxuICAgICAgICAgICAgICAgIGVkZ2UgPSBpZiAoeHZhbFtpXSAtIHh2YWxbaWxlZnRdID4geHZhbFtpcmlnaHRdIC0geHZhbFtpXSkge1xuICAgICAgICAgICAgICAgICAgICBpbGVmdFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGlyaWdodFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBDb21wdXRlIGEgbGVhc3Qtc3F1YXJlcyBsaW5lYXIgZml0IHdlaWdodGVkIGJ5XG4gICAgICAgICAgICAgICAgLy8gdGhlIHByb2R1Y3Qgb2Ygcm9idXN0bmVzcyB3ZWlnaHRzIGFuZCB0aGUgdHJpY3ViZVxuICAgICAgICAgICAgICAgIC8vIHdlaWdodCBmdW5jdGlvbi5cbiAgICAgICAgICAgICAgICAvLyBTZWUgaHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9MaW5lYXJfcmVncmVzc2lvblxuICAgICAgICAgICAgICAgIC8vIChzZWN0aW9uIFwiVW5pdmFyaWF0ZSBsaW5lYXIgY2FzZVwiKVxuICAgICAgICAgICAgICAgIC8vIGFuZCBodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL1dlaWdodGVkX2xlYXN0X3NxdWFyZXNcbiAgICAgICAgICAgICAgICAvLyAoc2VjdGlvbiBcIldlaWdodGVkIGxlYXN0IHNxdWFyZXNcIilcbiAgICAgICAgICAgICAgICB2YXIgc3VtV2VpZ2h0cyA9IDAuMFxuICAgICAgICAgICAgICAgIHZhciBzdW1YID0gMC4wXG4gICAgICAgICAgICAgICAgdmFyIHN1bVhTcXVhcmVkID0gMC4wXG4gICAgICAgICAgICAgICAgdmFyIHN1bVkgPSAwLjBcbiAgICAgICAgICAgICAgICB2YXIgc3VtWFkgPSAwLjBcbiAgICAgICAgICAgICAgICB2YWwgZGVub206IERvdWJsZSA9IGFicygxLjAgLyAoeHZhbFtlZGdlXSAtIHgpKVxuICAgICAgICAgICAgICAgIGZvciAoayBpbiBpbGVmdC4uaXJpZ2h0KSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCB4ayA9IHh2YWxba11cbiAgICAgICAgICAgICAgICAgICAgdmFsIHlrID0geXZhbFtrXVxuICAgICAgICAgICAgICAgICAgICB2YWwgZGlzdCA9IGlmIChrIDwgaSkgeCAtIHhrIGVsc2UgeGsgLSB4XG4gICAgICAgICAgICAgICAgICAgIHZhbCB3OiBEb3VibGUgPSB0cmljdWJlKGRpc3QgKiBkZW5vbSkgKiByb2J1c3RuZXNzV2VpZ2h0c1trXSAqIHdlaWdodHNba11cbiAgICAgICAgICAgICAgICAgICAgdmFsIHhrdyA9IHhrICogd1xuICAgICAgICAgICAgICAgICAgICBzdW1XZWlnaHRzICs9IHdcbiAgICAgICAgICAgICAgICAgICAgc3VtWCArPSB4a3dcbiAgICAgICAgICAgICAgICAgICAgc3VtWFNxdWFyZWQgKz0geGsgKiB4a3dcbiAgICAgICAgICAgICAgICAgICAgc3VtWSArPSB5ayAqIHdcbiAgICAgICAgICAgICAgICAgICAgc3VtWFkgKz0geWsgKiB4a3dcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdmFsIG1lYW5YID0gc3VtWCAvIHN1bVdlaWdodHNcbiAgICAgICAgICAgICAgICB2YWwgbWVhblkgPSBzdW1ZIC8gc3VtV2VpZ2h0c1xuICAgICAgICAgICAgICAgIHZhbCBtZWFuWFkgPSBzdW1YWSAvIHN1bVdlaWdodHNcbiAgICAgICAgICAgICAgICB2YWwgbWVhblhTcXVhcmVkID0gc3VtWFNxdWFyZWQgLyBzdW1XZWlnaHRzXG4gICAgICAgICAgICAgICAgdmFsIGJldGE6IERvdWJsZVxuICAgICAgICAgICAgICAgIGJldGEgPSBpZiAoc3FydChhYnMobWVhblhTcXVhcmVkIC0gbWVhblggKiBtZWFuWCkpIDwgYWNjdXJhY3kpIHtcbiAgICAgICAgICAgICAgICAgICAgMC4wXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgKG1lYW5YWSAtIG1lYW5YICogbWVhblkpIC8gKG1lYW5YU3F1YXJlZCAtIG1lYW5YICogbWVhblgpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHZhbCBhbHBoYSA9IG1lYW5ZIC0gYmV0YSAqIG1lYW5YXG4gICAgICAgICAgICAgICAgcmVzW2ldID0gYmV0YSAqIHggKyBhbHBoYVxuICAgICAgICAgICAgICAgIHJlc2lkdWFsc1tpXSA9IGFicyh5dmFsW2ldIC0gcmVzW2ldKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gTm8gbmVlZCB0byByZWNvbXB1dGUgdGhlIHJvYnVzdG5lc3Mgd2VpZ2h0cyBhdCB0aGUgbGFzdFxuICAgICAgICAgICAgLy8gaXRlcmF0aW9uLCB0aGV5IHdvbid0IGJlIG5lZWRlZCBhbnltb3JlXG4gICAgICAgICAgICBpZiAoaXRlciA9PSByb2J1c3RuZXNzSXRlcnMpIHtcbiAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gUmVjb21wdXRlIHRoZSByb2J1c3RuZXNzIHdlaWdodHMuXG4gICAgICAgICAgICAvLyBGaW5kIHRoZSBtZWRpYW4gcmVzaWR1YWwuXG4gICAgICAgICAgICAvLyBBbiBhcnJheWNvcHkgYW5kIGEgc29ydCBhcmUgY29tcGxldGVseSB0cmFjdGFibGUgaGVyZSxcbiAgICAgICAgICAgIC8vIGJlY2F1c2UgdGhlIHByZWNlZGluZyBsb29wIGlzIGEgbG90IG1vcmUgZXhwZW5zaXZlXG4gICAgICAgICAgICByZXNpZHVhbHMuY29weUludG8oc29ydGVkUmVzaWR1YWxzLCAwLCAwLCBuKVxuICAgICAgICAgICAgc29ydGVkUmVzaWR1YWxzLnNvcnQoKVxuXG4gICAgICAgICAgICB2YWwgbWVkaWFuUmVzaWR1YWwgPSBzb3J0ZWRSZXNpZHVhbHNbbiAvIDJdXG4gICAgICAgICAgICBpZiAoYWJzKG1lZGlhblJlc2lkdWFsKSA8IGFjY3VyYWN5KSB7XG4gICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGZvciAoaSBpbiAwIHVudGlsIG4pIHtcbiAgICAgICAgICAgICAgICB2YWwgYXJnID0gcmVzaWR1YWxzW2ldIC8gKDYgKiBtZWRpYW5SZXNpZHVhbClcbiAgICAgICAgICAgICAgICBpZiAoYXJnID49IDEpIHtcbiAgICAgICAgICAgICAgICAgICAgcm9idXN0bmVzc1dlaWdodHNbaV0gPSAwLjBcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB2YWwgdyA9IDEgLSBhcmcgKiBhcmdcbiAgICAgICAgICAgICAgICAgICAgcm9idXN0bmVzc1dlaWdodHNbaV0gPSB3ICogd1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzXG4gICAgfVxuXG5cbiAgICAvKipcbiAgICAgKiBHaXZlbiBhbiBpbmRleCBpbnRlcnZhbCBpbnRvIHh2YWwgdGhhdCBlbWJyYWNlcyBhIGNlcnRhaW4gbnVtYmVyIG9mXG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cml2YXRlIGZ1biB0cmljdWJlKHg6IERvdWJsZSk6IERvdWJsZSB7XG4gICAgICAgIHZhbCBhYnNYOiBEb3VibGUgPSBhYnMoeClcbiAgICAgICAgaWYgKGFic1ggPj0gMS4wKSB7XG4gICAgICAgICAgICByZXR1cm4gMC4wXG4gICAgICAgIH1cbiAgICAgICAgdmFsIHRtcCA9IDEgLSBhYnNYICogYWJzWCAqIGFic1hcbiAgICAgICAgcmV0dXJuIHRtcCAqIHRtcCAqIHRtcFxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybiB0aGUgc21hbGxlc3QgaW5kZXggYGpgIHN1Y2ggdGhhdFxuICAgICAqIGBqID4gaSAmJiAoaiA9PSB3ZWlnaHRzLmxlbmd0aCB8fCB3ZWlnaHRzW2pdICE9IDApYC5cbiAgICAgKlxuICAgICAqIEBwYXJhbSB3ZWlnaHRzIFdlaWdodHMgYXJyYXkuXG4gICAgICogQHBhcmFtIGkgSW5kZXggZnJvbSB3aGljaCB0byBzdGFydCBzZWFyY2guXG4gICAgICogQHJldHVybiB0aGUgc21hbGxlc3QgY29tcGxpYW50IGluZGV4LlxuICAgICAqL1xuICAgIHByaXZhdGUgZnVuIG5leHROb256ZXJvKHdlaWdodHM6IERvdWJsZUFycmF5LCBpOiBJbnQpOiBJbnQge1xuICAgICAgICB2YXIgaiA9IGkgKyAxXG4gICAgICAgIHdoaWxlIChqIDwgd2VpZ2h0cy5zaXplICYmIHdlaWdodHNbal0gPT0gMC4wKSB7XG4gICAgICAgICAgICArK2pcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4galxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENvbXB1dGUgYSBsb2VzcyBmaXQgb24gdGhlIGRhdGEgYXQgdGhlIG9yaWdpbmFsIGFic2Npc3NhZS5cbiAgICAgKlxuICAgICAqIEBwYXJhbSB4dmFsIHRoZSBhcmd1bWVudHMgZm9yIHRoZSBpbnRlcnBvbGF0aW9uIHBvaW50c1xuICAgICAq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gaWYgdGhlIGFycmF5IGlzIHNvcnRlZC5cbiAgICAgKiBAdGhyb3dzIE5vbk1vbm90b25pY1NlcXVlbmNlRXhjZXB0aW9uIGlmIHRoZSBhcnJheSBpcyBub3Qgc29ydGVkXG4gICAgICogYW5kIGBhYm9ydGAgaXMgYHRydWVgLlxuICAgICAqL1xuICAgIGZ1biBjaGVja09yZGVyKFxuICAgICAgICBgdmFsYDogRG91YmxlQXJyYXksIGRpcjogT3JkZXJEaXJlY3Rpb24/LFxuICAgICAgICBzdHJpY3Q6IEJvb2xlYW4sIGFib3J0OiBCb29sZWFuXG4gICAgKTogQm9vbGVhbiB7XG4gICAgICAgIHZhciBwcmV2aW91cyA9IGB2YWxgWzBdXG4gICAgICAgIHZhbCBtYXggPSBgdmFsYC5zaXplXG4gICAgICAgIHZhciBpbmRleDogSW50XG4gICAgICAgIGluZGV4ID0gMVxuICAgICAgICBJVEVNQCB3aGlsZSAoaW5kZXggPCBtYXgpIHtcbiAgICAgICAgICAgIHdoZW4gKGRpcikge1xuICAgICAgICAgICAgICAgIE9yZGVyRGlyZWN0aW9uLklOQ1JFQVNJTkcgLT4gaWYgKHN0cmljdCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoYHZhbGBbaW5kZXhdIDw9IHByZXZpb3VzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha0BJVEVNXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAoYHZhbGBbaW5kZXhdIDwgcHJldmlvdXMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrQElURU1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBPcmRlckRpcmVjdGlvbi5ERUNSRUFTSU5HIC0+IGlmIChzdHJpY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGB2YWxgW2luZGV4XSA+PSBwcmV2aW91cykge1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtASVRFTVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGB2YWxgW2luZGV4XSA+IHByZXZpb3VzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha0BJVEVNXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSAtPiBlcnJvcihcIlwiKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcHJldmlvdXMgPSBgdmFsYFtpbmRleF1cbiAgICAgICAgICAgIGluZGV4KytcbiAgICAgICAgfVxuICAgICAgICBpZiAoaW5kZXggPT0gbWF4KSB7IC8vIExvb3AgY29tcGxldGVkLlxuICAgICAgICAgICAgcmV0dXJuIHRydWVcbiAgICAgICAgfVxuICAgICAgICAvLyBMb29wIGVhcmx5IGV4aXQgbWVhbnMgd3Jvbmcgb3JkZXJpbmcuXG4gICAgICAgIHJldHVybiBpZiAoYWJvcnQpIHtcbiAgICAgICAgICAgIGVycm9yKFwiTm9uIG1vbm90b25pYyBzZXF1ZW5jZVwiKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgZmFsc2VcbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENoZWNrIHRoYXQgdGhlIGdpdmVuIGFycmF5IGlzIHNvcnRlZC5cbiAgICAgKlxuICAgICAqIEBwYXJhbSB2YWwgVmFsdWVzLlxuICAgICAqIEBwYXJhbSBkaXIgT3JkZXJpbmcgZGlyZWN0aW9uLlxuICAgICAqIEBwYXJhbSBzdHJpY3QgV2hldGhlciB0aGUgb3JkZXIgc2hvdWxkIGJlIHN0cmljdC5cbiAgICAgKiBAdGhyb3dzIE5vbk1vbm90b25pY1NlcXVlbmNlRXhjZXB0aW9uIGlmIHRoZSBhcnJheSBpcyBub3Q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4gc21hbGxlc3QgZWxlbWVudFxuICAgICAqL1xuICAgIHByaXZhdGUgZnVuIHNlbGVjdCh3b3JrOiBEb3VibGVBcnJheSwgcGl2b3RzSGVhcDogSW50QXJyYXksIGs6IEludCk6IERvdWJsZSB7XG4gICAgICAgIHZhciBiZWdpbiA9IDBcbiAgICAgICAgdmFyIGVuZCA9IHdvcmsuc2l6ZVxuICAgICAgICB2YXIgbm9kZSA9IDBcbiAgICAgICAgd2hpbGUgKGVuZCAtIGJlZ2luID4gTUlOX1NFTEVDVF9TSVpFKSB7XG4gICAgICAgICAgICB2YWwgcGl2b3Q6IEludFxuICAgICAgICAgICAgaWYgKG5vZGUgPCBwaXZvdHNIZWFwLnNpemUgJiYgcGl2b3RzSGVhcFtub2RlXSA+PSAwKSB7IC8vIHRoZSBwaXZvdCBoYXMgYWxyZWFkeSBiZWVuIGZvdW5kIGluIGEgcHJldmlvdXMgY2FsbFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFuZCB0aGUgYXJyYXkgaGFzIGFscmVhZHkgYmVlbiBwYXJ0aXRpb25lZCBhcm91bmQgaXRcbiAgICAgICAgICAgICAgICBwaXZvdCA9IHBpdm90c0hlYXBbbm9kZV1cbiAgICAgICAgICAgIH0gZWxzZSB7IC8vIHNlbGVjdCBhIHBpdm90IGFuZCBwYXJ0aXRpb24gd29yayBhcnJheSBhcm91bmQgaXRcbiAgICAgICAgICAgICAgICBwaXZvdCA9IHBhcnRpdGlvbih3b3JrLCBiZWdpbiwgZW5kLCBtZWRpYW5PZjMod29yaywgYmVnaW4sIGVuZCkpXG4gICAgICAgICAgICAgICAgaWYgKG5vZGUgPCBwaXZvdHNIZWFwLnNpemUpIHtcbiAgICAgICAgICAgICAgICAgICAgcGl2b3RzSGVhcFtub2RlXSA9IHBpdm90XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgK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GUpOiBEb3VibGUge1xuXG4gICAgICAgIGlmIChjb2VmZmljaWVudHMgPT0gbnVsbClcbiAgICAgICAgICAgIGVycm9yKFwiTnVsbCBhcmd1bWVudDogY29lZmZpY2llbnRzIG9mIHRoZSBwb2x5bm9taWFsIHRvIGV2YWx1YXRlXCIpXG5cbiAgICAgICAgdmFsIG4gPSBjb2VmZmljaWVudHMuc2l6ZVxuICAgICAgICBpZiAobiA9PSAwKSB7XG4gICAgICAgICAgICBlcnJvcihcIkVtcHR5IHBvbHlub21pYWxzIGNvZWZmaWNpZW50cyBhcnJheVwiKVxuICAgICAgICB9XG4gICAgICAgIHZhciByZXN1bHQgPSBjb2VmZmljaWVudHNbbiAtIDFdXG4gICAgICAgIGZvciAoaiBpbiBuIC0gMiBkb3duVG8gMCkge1xuICAgICAgICAgICAgcmVzdWx0ID0gYXJndW1lbnQgKiByZXN1bHQgKyBjb2VmZmljaWVudHNbal1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgfVxuXG4gICAgb3BlcmF0b3IgZnVuIHVuYXJ5UGx1cygpID0gUG9seW5vbWlhbEZ1bmN0aW9uKGNvZWZmaWNpZW50cylcblxuICAgIG9wZXJhdG9yIGZ1biB1bmFyeU1pbnVzKCk6IFBvbHlub21pYWxGdW5jdGlvbiB7XG4gICAgICAgIHZhbCBkZCA9IERvdWJsZUFycmF5KGNvZWZmaWNpZW50cy5zaXplKVxuXG4gICAgICAgIGZvciAoKGksIGMpIGluIGNvZWZmaWNpZW50cy53aXRoSW5kZXgoKSkge1xuICAgICAgICAgICAgZGRbaV0gPSAtY1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIFBvbHlub21pYWxGdW5jdGlvbihkZClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBhcHBseV9vcChvdGhlcjogUG9seW5vbWlhbEZ1bmN0aW9uLCBvcDogKERvdWJsZSwgRG91YmxlKSAtPiBEb3VibGUpOiBQb2x5bm9taWFsRnVuY3Rpb24ge1xuICAgICAgICB2YWwgc3ogPSBtYXgoY29lZmZpY2llbnRzLnNpemUsIG90aGVyLmNvZWZmaWNpZW50cy5zaXplKVxuICAgICAgICB2YWwgbmMgPSBEb3VibGVBcnJheShzeilcblxuICAgICAgICBmb3IgKGkgaW4gKDAgdW50aWwgc3opKSB7XG4gICAgICAgICAgICB2YWwgYSA9IGlmIChpIDwgY29lZmZpY2llbnRzLnNpemUpIGNvZWZmaWNpZW50c1tpXSBlbHNlIDAuMFxuICAgICAgICAgICAgdmFsIGIgPSBpZiAoaSA8IG90aGVyLmNvZWZmaWNpZW50cy5zaXplKSBvdGhlci5jb2VmZmljaWVudHNbaV0gZWxzZSAwLjBcbiAgICAgICAgICAgIG5jW2ldID0gb3AoYSwgYilcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBQb2x5bm9taWFsRnVuY3Rpb24obmMpXG4gICAgfVxuXG4gICAgb3BlcmF0b3IgZnVuIHBsdXMob3RoZXI6IFBvbHlub21pYWxGdW5jdGlvbik6IFBvbHlub21pYWxGdW5jdGlvbiB7XG4gICAgICAgIHJldHVybiBhcHBseV9vcChvdGhlcikgeyB4LCB5IC0+IHggKyB5IH1cbiAgICB9XG5cbiAgICBvcGVyYXRvciBmdW4gbWludXMob3RoZXI6IFBvbHlub21pYWxGdW5jdGlvbik6IFBvbHlub21pYWxGdW5jdGlvbiB7XG4gICAgICAgIHJldHVybiBhcHBseV9vcChvdGhlcikgeyB4LCB5IC0+IHggLSB5IH1cbiAgICB9XG5cbiAgICBmdW4gbXVsdGlwbHkoYTogRG91YmxlKTogUG9seW5vbWlhbEZ1bmN0aW9uIHtcbiAgICAgICAgdmFsIGRkID0gRG91YmxlQXJyYXkoY29lZmZpY2llbnRzLnNpemUpXG5cbiAgICAgICAgZm9yICgoaSwgYykgaW4gY29lZmZpY2llbnRzLndpdGhJbmRleCgpKSB7XG4gICAgICAgICAgICBkZFtpXSA9IGEgKiBjXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gUG9seW5vbWlhbEZ1bmN0aW9uKGRkKVxuICAgIH1cblxuICAgIG9wZXJhdG9yIGZ1biB0aW1lcyhvdGhlcjogUG9seW5vbWlhbEZ1bmN0aW9uKTogUG9seW5vbWlhbEZ1bmN0aW9uIHtcbiAgICAgICAgdmFsIG5kID0gY29lZmZpY2llbnRzLnNpemUgKyBvdGhlci5jb2VmZmljaWVudHMuc2l6ZSAtIDFcbiAgICAgICAgdmFsIG5jID0gRG91YmxlQXJyYXkobmQpXG5cbiAgICAgICAgZm9yIChpIGluICgwIHVudGlsIG5kKSkge1xuICAgICAgICAgICAgZm9yIChqIGluICgwLi5pKSkge1xuICAgICAgICAgICAgICAgIHZhbCBhID0gaWYgKGogPCBjb2VmZmljaWVudHMuc2l6ZSkgY29lZmZpY2llbnRzW2pdIGVsc2UgMC4wXG4gICAgICAgICAgICAgICAgdmFsIGsgPSBpIC0galxuICAgICAgICAgICAgICAgIHZhbCBiID0gaWYgKGsgPCBvdGhlci5jb2VmZmljaWVudHMuc2l6ZSkgb3RoZXIuY29lZmZpY2llbnRzW2tdIGVsc2UgMC4wXG4gICAgICAgICAgICAgICAgbmNbaV0gKz0gYSAqIGJcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBQb2x5bm9taWFsRnVuY3Rpb24obmMpXG4gICAgfVxuXG4gICAgZnVuIGRlZ3JlZSgpOiBJbnQgPSBtYXgoMCwgY29lZmZpY2llbnRzLmluZGV4T2ZMYXN0IHsgaXQgIT0gMC4wIH0pXG5cbiAgICBvcGVyYXRvciBmdW4gY29tcGFyZVRvKG90aGVyOiBQb2x5bm9taWFsRnVuY3Rpb24pOiBJbnQge1xuICAgICAgICB2YWwgZDEgPSBkZWdyZWUoKVxuICAgICAgICB2YWwgZDIgPSBvdGhlci5kZWdyZWUoKVxuICAgICAgICB2YWwgbiA9IG1pbihkMSwgZDIpICsgMVxuXG4gICAgICAgIGZvciAoaSBpbiAwIHVudGlsIG4pIHtcbiAgICAgICAgICAgIHZhbCBhID0gY29lZmZpY2llbnRzW2ldXG4gICAgICAgICAgICB2YWwgYiA9IG90aGVyLmNvZWZmaWNpZW50c1tpXVxuXG4gICAgICAgICAgICB2YWwgcmVzID0gYS5jb21wYXJlVG8oYilcblxuICAgICAgICAgICAgaWYgKHJlcyAhPSAwKVxuICAgICAgICAgICAgICAgIHJldHVybiByZXNcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBkMS5jb21wYXJlVG8oZDIpXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgb3BlcmF0b3IgZnVuIGVxdWFscyhvdGhlcjogQW55Pyk6IEJvb2xlYW4ge1xuICAgICAgICBpZiAob3RoZXIgPT0gbnVsbCB8fCBvdGhlciAhaXMgUG9seW5vbWlhbEZ1bmN0aW9uKVxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlXG5cbiAgICAgICAgcmV0dXJuIGNvbXBhcmVUbyhvdGhlcikgPT0gMFxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBoYXNoQ29kZSgpOiBJbnQge1xuICAgICAgICByZXR1cm4gY29lZmZpY2llbnRzLmhhc2hDb2RlKClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gdG9TdHJpbmcoKTogU3RyaW5nIHtcbiAgICAgICAgdmFsIHNiID0gU3RyaW5nQnVpbGRlcigpXG5cbiAgICAgICAgZm9yIChpIGluIGNvZWZmaWNpZW50cy5sYXN0SW5kZXggZG93blRvIDApIHtcblxuICAgICAgICAgICAgaWYgKGNvZWZmaWNpZW50c1tpXSAhPSAwLjApIHtcblxuICAgICAgICAgICAgICAgIGlmICghc2IuaXNFbXB0eSgpKVxuICAgICAgICAgICAgICAgICAgICBzYi5hcHBlbmQoXCIgKyBcIilcblxuICAgICAgICAgICAgICAgIHNiLmFwcGVuZChjb2VmZmljaWVudHNbaV0udG9TdHJpbmcoKSlcblxuICAgICAgICAgICAgICAgIGlmIChpID4gMClcbiA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GwpIHtcbiAgICAgICAgICAgIGVycm9yKFwiTnVsbCBhcmd1bWVudCBcIilcbiAgICAgICAgfVxuICAgICAgICBpZiAoX2tub3RzLnNpemUgPCAyKSB7XG4gICAgICAgICAgICBlcnJvcihcIlNwbGluZSBwYXJ0aXRpb24gbXVzdCBoYXZlIGF0IGxlYXN0IDIgcG9pbnRzLCBnb3QgJHtfa25vdHMuc2l6ZX1cIilcbiAgICAgICAgfVxuICAgICAgICBpZiAoX2tub3RzLnNpemUgLSAxICE9IF9wb2x5bm9taWFscy5zaXplKSB7XG4gICAgICAgICAgICBlcnJvcihcIkRpbWVuc2lvbnMgbWlzbWF0Y2g6ICR7X3BvbHlub21pYWxzLnNpemV9IHBvbHlub21pYWwgZnVuY3Rpb25zICE9ICAke19rbm90cy5zaXplfSBzZWdtZW50IGRlbGltaXRlcnNcIilcbiAgICAgICAgfVxuXG4gICAgICAgIE1hdGhBcnJheXMuY2hlY2tPcmRlcihfa25vdHMpXG5cbiAgICAgICAgdGhpcy5uID0gX2tub3RzLnNpemUgLSAxXG4gICAgICAgIHRoaXMua25vdHMgPSBfa25vdHNcblxuICAgICAgICB0aGlzLnBvbHlub21pYWxzID0gYXJyYXlPZk51bGxzPFBvbHlub21pYWxGdW5jdGlvbj8+KG4pXG4gICAgICAgIF9wb2x5bm9taWFscy5jb3B5SW50byAodGhpcy5wb2x5bm9taWFscywgMCwgMCwgbilcblxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENvbXB1dGUgdGhlIHZhbHVlIGZvciB0aGUgZnVuY3Rpb24uXG4gICAgICogU2VlIFtQb2x5bm9taWFsU3BsaW5lRnVuY3Rpb25dIGZvciBkZXRhaWxzIG9uIHRoZSBhbGdvcml0aG0gZm9yXG4gICAgICogY29tcHV0aW5nIHRoZSB2YWx1ZSBvZiB0aGUgZnVuY3Rpb24uXG4gICAgICpcbiAgICAgKiBAcGFyYW0gdiBQb2ludCBmb3Igd2hpY2ggdGhlIGZ1bmN0aW9uIHZhbHV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yb3dzIE51bWJlcklzVG9vU21hbGxFeGNlcHRpb24gaWYgdGhlIHNpemUgb2YgYHhgIGlzIHNtYWxsZXJcbiAgICAgKiB0aGFuIDMuXG4gICAgICovXG4gICAgZnVuIGludGVycG9sYXRlKHg6IERvdWJsZUFycmF5LCB5OiBEb3VibGVBcnJheSk6IFBvbHlub21pYWxTcGxpbmVGdW5jdGlvbiB7XG4gICAgICAgIGlmICh4LnNpemUgIT0geS5zaXplKSB7XG4gICAgICAgICAgICBlcnJvcihcIkRpbWVuc2lvbiBtaXNtYXRjaCAke3guc2l6ZX0gIT0gJHt5LnNpemV9XCIpXG4gICAgICAgIH1cbiAgICAgICAgaWYgKHguc2l6ZSA8IDMpIHtcbiAgICAgICAgICAgIGVycm9yKFwiVG9vIHNtYWxsIHZhbHVlIG9mIHBvaW50cyBudW1iZXI6ICR7eC5zaXplfSA8IDNcIilcbiAgICAgICAgfVxuICAgICAgICAvLyBOdW1iZXIgb2YgaW50ZXJ2YWxzLiAgVGhlIG51bWJlciBvZiBkYXRhIHBvaW50cyBpcyBuICsgMS5cbiAgICAgICAgdmFsIG4gPSB4LnNpemUgLSAxXG4gICAgICAgIE1hdGhBcnJheXMuY2hlY2tPcmRlcih4KVxuICAgICAgICAvLyBEaWZmZXJlbmNlcyBiZXR3ZWVuIGtub3QgcG9pbnRzXG4gICAgICAgIHZhbCBoID0gRG91YmxlQXJyYXkobilcbiAgICAgICAgZm9yIChpIGluIDAgdW50aWwgbikge1xuICAgICAgICAgICAgaFtpXSA9IHhbaSArIDFdIC0geFtpXVxuICAgICAgICB9XG4gICAgICAgIHZhbCBtdSA9IERvdWJsZUFycmF5KG4pXG4gICAgICAgIHZhbCB6ID0gRG91YmxlQXJyYXkobiArIDEpXG4gICAgICAgIG11WzBdID0gMC4wXG4gICAgICAgIHpbMF0gPSAwLjBcblxuICAgICAgICBmb3IgKGkgaW4gMSB1bnRpbCBuKSB7XG4gICAgICAgICAgICB2YXIgZyA9IDIuMCAqICh4W2kgKyAxXSAtIHhbaSAtIDFdKSAtIGhbaSAtIDFdICogbXVbaSAtIDFdXG4gICAgICAgICAgICBtdVtpXSA9IGhbaV0gLyBnXG4gICAgICAgICAgICB6W2ldID1cbiAgICAgICAgICAgICAgICAoMy4wICogKHlbaSArIDFdICogaFtpIC0gMV0gLSB5W2ldICogKHhbaSArIDFdIC0geFtpIC0gMV0pICsgeVtpIC0gMV0gKiBoW2ldKSAvXG4gICAgICAgICAgICAgICAgICAgICAgICAoaFtpIC0gMV0gKiBoW2ldKSAtIGhbaSAtIDFdICogeltpIC0gMV0pIC8gZ1xuICAgICAgICB9XG4gICAgICAgIC8vIGN1YmljIHNwbGluZSBjb2VmZmljaWVudHMgLS0gIGIgaXMgbGluZWFyLCBjIHF1YWRyYXRpYywgZCBpcyBjdWJpYyAob3JpZ2luYWwgeSdzIGFyZSBjb25zdGFudHMpXG4gICAgICAgIHZhbCBiID0gRG91YmxlQXJyYXkobilcbiAgICAgICAgdmFsIGMgPSBEb3VibGVBcnJheShuICsgMSlcbiAgICAgICAgdmFsIGQgPSBEb3VibGVBcnJheShuKVxuICAgICAgICB6W25dID0gMC4wXG4gICAgICAgIGNbbl0gPSAwLjBcbiAgICAgICAgZm9yIChqIGluIG4gLSAxIGRvd25UbyAwKSB7XG4gICAgICAgICAgICBjW2pdID0geltqXSAtIG11W2pdICogY1tqICsgMV1cbiAgICAgICAgICAgIGJbal0gPSAoeVtqICsgMV0gLSB5W2pdKSAvIGhbal0gLSBoW2pdICogKGNbaiArIDFdICsgMi4wICogY1tqXSkgLyAzLjBcbiAgICAgICAgICAgIGRbal0gPSAoY1tqICsgMV0gLSBjW2pdKSAvICgzLjAgKiBoW2pdKVxuICAgICAgICB9XG4gICAgICAgIHZhbCBwb2x5bm9taWFsczogQXJyYXk8UG9seW5vbWlhbEZ1bmN0aW9uPz4gPSBhcnJheU9mTnVsbHM8UG9seW5vbWlhbEZ1bmN0aW9uPihuKVxuICAgICAgICB2YWwgY29lZmZpY2llbn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lU2lkZShcbiAgICAgICAgbWF4RXZhbDogSW50LCBmOiBVbml2YXJpYXRlRnVuY3Rpb24sXG4gICAgICAgIGJyYWNrZXRpbmc6IEJyYWNrZXRlZFVuaXZhcmlhdGVTb2x2ZXI8VW5pdmFyaWF0ZUZ1bmN0aW9uPixcbiAgICAgICAgYmFzZVJvb3Q6IERvdWJsZSwgbWluOiBEb3VibGUsIG1heDogRG91YmxlLFxuICAgICAgICBhbGxvd2VkU29sdXRpb246IEFsbG93ZWRTb2x1dGlvblxuICAgICk6IERvdWJsZSB7XG5cbiAgICAgICAgaWYgKGFsbG93ZWRTb2x1dGlvbiA9PSBBbGxvd2VkU29sdXRpb24uQU5ZX1NJREUpIHtcbiAgICAgICAgICAgIC8vIG5vIGZ1cnRoZXIgYnJhY2tldGluZyByZXF1aXJlZFxuICAgICAgICAgICAgcmV0dXJuIGJhc2VSb290XG4gICAgICAgIH1cblxuICAgICAgICAvLyBmaW5kIGEgdmVyeSBzbWFsbCBpbnRlcnZhbCBicmFja2V0aW5nIHRoZSByb290XG4gICAgICAgIHZhbCBzdGVwID0gbWF4KFxuICAgICAgICAgICAgYnJhY2tldGluZy5hYnNvbHV0ZUFjY3VyYWN5LFxuICAgICAgICAgICAgYWJzKGJhc2VSb290ICogYnJhY2tldGluZy5yZWxhdGl2ZUFjY3VyYWN5KVxuICAgICAgICApXG4gICAgICAgIHZhciB4TG8gPSBtYXgobWluLCBiYXNlUm9vdCAtIHN0ZXApXG4gICAgICAgIHZhciBmTG8gPSBmLnZhbHVlKHhMbylcbiAgICAgICAgdmFyIHhIaSA9IG1pbihtYXgsIGJhc2VSb290ICsgc3RlcClcbiAgICAgICAgdmFyIGZIaSA9IGYudmFsdWUoeEhpKVxuICAgICAgICB2YXIgcmVtYWluaW5nRXZhbCA9IG1heEV2YWwgLSAyXG4gICAgICAgIHdoaWxlIChyZW1haW5pbmdFdmFsID4gMCkge1xuXG4gICAgICAgICAgICBpZiAoZkxvID49IDAgJiYgZkhpIDw9IDAgfHwgZkxvIDw9IDAgJiYgZkhpID49IDApIHtcbiAgICAgICAgICAgICAgICAvLyBjb21wdXRlIHRoZSByb290IG9uIHRoZSBzZWxlY3RlZCBzaWRlXG4gICAgICAgICAgICAgICAgcmV0dXJuIGJyYWNrZXRpbmcuc29sdmUocmVtYWluaW5nRXZhbCwgZiwgeExvLCB4SGksIGJhc2VSb290LCBhbGxvd2VkU29sdXRpb24pXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIHRyeSBpbmNyZWFzaW5nIHRoZSBpbnRlcnZhbFxuICAgICAgICAgICAgdmFyIGNoYW5nZUxvID0gZmFsc2VcbiAgICAgICAgICAgIHZhciBjaGFuZ2VIaSA9IGZhbHNlXG4gICAgICAgICAgICBpZiAoZkxvIDwgZkhpKSB7XG4gICAgICAgICAgICAgICAgLy8gaW5jcmVhc2luZyBmdW5jdGlvblxuICAgICAgICAgICAgICAgIGlmIChmTG8gPj0gMCkge1xuICAgICAgICAgICAgICAgICAgICBjaGFuZ2VMbyA9IHRydWVcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBjaGFuZ2VIaSA9IHRydWVcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGZMbyA+IGZIaSkge1xuICAgICAgICAgICAgICAgIC8vIGRlY3JlYXNpbmcgZnVuY3Rpb25cbiAgICAgICAgICAgICAgICBpZiAoZkxvIDw9IDApIHtcbiAgICAgICAgICAgICAgICAgICAgY2hhbmdlTG8gPSB0cnVlXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY2hhbmdlSGkgPSB0cnVlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyB1bmtub3duIHZhcmlhdGlvblxuICAgICAgICAgICAgICAgIGNoYW5nZUxvID0gdHJ1ZVxuICAgICAgICAgICAgICAgIGNoYW5nZUhpID0gdHJ1ZVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyB1cGRhdGUgdGhlIGxvd2VyIGJvdW5kXG4gICAgICAgICAgICBpZiAoY2hhbmdlTG8pIHtcbiAgICAgICAgICAgICAgICB4TG8gPSBtYXgobWluLCB4TG8gLSBzdGVwKVxuICAgICAgICAgICAgICAgIGZMbyA9IGYudmFsdWUoeExvKVxuICAgICAgICAgICAgICAgIHJlbWFpbmluZ0V2YWwtLVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyB1cGRhdGUgdGhlIGhpZ2hlciBib3VuZFxuICAgICAgICAgICAgaWYgKGNoYW5nZUhpKSB7XG4gICAgICAgICAgICAgICAgeEhpID0gbWluKG1heCwgeEhpICsgc3RlcClcbiAgICAgICAgICAgICAgICBmSGkgPSBmLnZhbHVlKHhIaSlcbiAgICAgICAgICAgICAgICByZW1haW5pbmdFdmFsLS1cbiAgICAgICAgICAgIH1cblxuICAgICAgICB9XG5cbiAgICAgICAgZXJyb3IoXCJOb0JyYWNrZXRpbmdcIilcbiAgICAgICAgLy9FeGNlcHRpb24gLSBGQUlMRURfQlJBQ0tFVElORyB4TG86JHhMbywgeEhpOiAkeEhpLCBmTG86ICRmTG8sIGZIaTogJGZIaSwgbWF4RXZhbDogJHttYXhFdmFsIC0gcmVtYWluaW5nRXZhbH0sIG1heEV2YWw6ICRtYXhFdmFsLCBiYXNlUm9vdDogJGJhc2VSb290LCBtaW46ICRtaW4sIG1heDogJG1heFwiKVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIGF0dGVtcHRzIHRvIGZpbmQgdHdvIHZhbHVlcyBhIGFuZCBiIHNhdGlzZnlpbmdcbiAgICAgKiAgKiAgYCBsb3dlckJvdW5kIDw9IGEgPCBpbml0aWFsIDwgYiA8PSB1cHBlckJvdW5kYFxuICAgICAqICAqICBgIGYoYSkgKiBmKGIpIDw9IDAgYFxuICAgICAqXG4gICAg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ZShsb3dlckJvdW5kLCBpbml0aWFsLCB1cHBlckJvdW5kKVxuXG4gICAgICAgIHZhciBhID0gaW5pdGlhbFxuICAgICAgICB2YXIgYiA9IGluaXRpYWxcbiAgICAgICAgdmFyIGZhOiBEb3VibGVcbiAgICAgICAgdmFyIGZiOiBEb3VibGVcbiAgICAgICAgdmFyIG51bUl0ZXJhdGlvbnMgPSAwXG5cbiAgICAgICAgZG8ge1xuICAgICAgICAgICAgYSA9IG1heChhIC0gMS4wLCBsb3dlckJvdW5kKVxuICAgICAgICAgICAgYiA9IG1pbihiICsgMS4wLCB1cHBlckJvdW5kKVxuICAgICAgICAgICAgZmEgPSBmdW5jdGlvbi52YWx1ZShhKVxuXG4gICAgICAgICAgICBmYiA9IGZ1bmN0aW9uLnZhbHVlKGIpXG4gICAgICAgICAgICArK251bUl0ZXJhdGlvbnNcbiAgICAgICAgfSB3aGlsZSAoZmEgKiBmYiA+IDAuMCAmJiBudW1JdGVyYXRpb25zIDwgbWF4aW11bUl0ZXJhdGlvbnMgJiZcbiAgICAgICAgICAgIChhID4gbG93ZXJCb3VuZCB8fCBiIDwgdXBwZXJCb3VuZClcbiAgICAgICAgKVxuXG4gICAgICAgIGlmIChmYSAqIGZiID4gMC4wKSB7XG4gICAgICAgICAgICBlcnJvcihcIk5vQnJhY2tldGluZ1wiKVxuICAgICAgICAgICAgLy9Mb2NhbGl6ZWRGb3JtYXRzLkZBSUxFRF9CUkFDS0VUSU5HLFxuICAgICAgICAgICAgLy9hLCBiLCBmYSwgZmIsXG4gICAgICAgICAgICAvL251bUl0ZXJhdGlvbnMsIG1heGltdW1JdGVyYXRpb25zLCBpbml0aWFsLFxuICAgICAgICAgICAgLy9sb3dlckJvdW5kLCB1cHBlckJvdW5kXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gZG91YmxlQXJyYXlPZihhLCBiKVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENvbXB1dGUgdGhlIG1pZHBvaW50IG9mIHR3byB2YW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1bVhYID0geFZhbHMuc3VtT2YgeyAoaXQgLSBtZWFuWCkucG93KDIpIH1cblxuICAgICAgICB2YWwgbWVhblkgPSB5VmFscy5hdmVyYWdlKClcbiAgICAgICAgdmFsIHN1bVlZID0geVZhbHMuc3VtT2YgeyAoaXQgLSBtZWFuWSkucG93KDIpIH1cbiAgICAgICAgdmFsIHN1bVhZID0geFZhbHMuemlwKHlWYWxzKS5zdW1PZiB7ICh4LCB5KSAtPiAoeCAtIG1lYW5YKSAqICh5IC0gbWVhblkpIH1cblxuICAgICAgICBzeSA9IHJ1biB7XG4gICAgICAgICAgICB2YWwgc3NlID0gbWF4KDAuMCwgc3VtWVkgLSBzdW1YWSAqIHN1bVhZIC8gc3VtWFgpXG4gICAgICAgICAgICBzcXJ0KHNzZSAvIChuIC0gMikpXG4gICAgICAgIH1cblxuXG4gICAgICAgIGlmIChjYW5Db21wdXRlKSB7XG4gICAgICAgICAgICBwb2x5bm9taWFsID0gZ2V0UG9seSh4VmFscywgeVZhbHMpXG4gICAgICAgIH1cblxuICAgICAgICB0Y3JpdGljYWwgPSBpZiAoY2FuQ29tcHV0ZSkge1xuICAgICAgICAgICAgdmFsIGFscGhhID0gMS4wIC0gY29uZmlkZW5jZUxldmVsXG4gICAgICAgICAgICBURGlzdHJpYnV0aW9uKGRlZ3JlZXNPZkZyZWVkb20pLmludmVyc2VDdW11bGF0aXZlUHJvYmFiaWxpdHkoMS4wIC0gYWxwaGEgLyAyLjApXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBEb3VibGUuTmFOXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gZXZhbFgoeDogRG91YmxlKTogRXZhbFJlc3VsdCB7XG5cbiAgICAgICAgdmFsIHNlID0gcnVuIHtcbiAgICAgICAgICAgIC8vIHggZGV2aWF0aW9uIHNxdWFyZWRcbiAgICAgICAgICAgIHZhbCBkeFNxdWFyZSA9ICh4IC0gbWVhblgpLnBvdygyKVxuICA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lzdDxUPiwgbTogSW50KTogQXJyYXlMaXN0PFQ+IHtcbiAgICAgICAgdmFsIGluZGV4ID0gc2FtcGxlSW50KGRhdGEuc2l6ZSwgbSlcbiAgICAgICAgdmFsIHJlc3VsdCA9IEFycmF5TGlzdDxUPigpXG4gICAgICAgIGZvciAoaSBpbiBpbmRleCkge1xuICAgICAgICAgICAgcmVzdWx0LmFkZChkYXRhW2ldKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICAvLyBzYW1wbGUgbSBpbnQgZnJvbSAwLi5uLTFcbiAgICBwcml2YXRlIGZ1biBzYW1wbGVJbnQobjogSW50LCBtOiBJbnQpOiBJbnRBcnJheSB7XG4gICAgICAgIGlmIChuIDwgbSB8fCBtIDwgMCkge1xuICAgICAgICAgICAgZXJyb3IoXCJTYW1wbGUgJG0gZGF0YSBmcm9tICRuIGRhdGEgaXMgaW1wb3NzaWJsZSFcIilcbiAgICAgICAgfVxuICAgICAgICB2YWwgcGVybSA9IEludEFycmF5KG4pXG4gICAgICAgIGZvciAoaSBpbiAwIHVudGlsIG4pIHtcbiAgICAgICAgICAgIHBlcm1baV0gPSBpXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgcmVzdWx0ID0gSW50QXJyYXkobSlcbiAgICAgICAgZm9yIChqIGluIDAgdW50aWwgbSkge1xuICAgICAgICAgICAgdmFsIHIgPSBqICsgKFJhbmRvbS5uZXh0RG91YmxlKCkgKiAobiAtIGopKS50b0ludCgpXG4gICAgICAgICAgICByZXN1bHRbal0gPSBwZXJtW3JdXG4gICAgICAgICAgICBwZXJtW3JdID0gcGVybVtqXVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBmdW4gcGVyY2VudGlsZShkYXRhOiBMaXN0PERvdWJsZT4sIHA6IERvdWJsZSk6IERvdWJsZSB7XG4gICAgICAgIHJldHVybiBQZXJjZW50aWxlLmV2YWx1YXRlKGRhdGEud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VxuXG4gICAgICAgIHdoaWxlIChpbmRleFNldC5zaXplIDwgaW5kZXhDb3VudCkge1xuICAgICAgICAgICAgaW5kZXhTZXQuYWRkKHJhbmQubmV4dEludChwb3BTaXplKSlcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBpZiAocGljaykgb25QaWNrKGluZGV4U2V0KSBlbHNlIG9uRHJvcChpbmRleFNldClcbiAgICB9XG5cbiAgICBmdW4gc2FtcGxlV2l0aG91dFJlcGxhY2VtZW50KHNhbXBsZVNpemU6IEludCwgcmFuZDogUmFuZG9tLCBkYXRhOiBEYXRhRnJhbWUpOiBEYXRhRnJhbWUge1xuICAgICAgICByZXR1cm4gc2FtcGxlV2l0aG91dFJlcGxhY2VtZW50KFxuICAgICAgICAgICAgZGF0YS5yb3dDb3VudCgpLFxuICAgICAgICAgICAgc2FtcGxlU2l6ZSxcbiAgICAgICAgICAgIHJhbmQsXG4gICAgICAgICAgICB7IGRhdGEuc2VsZWN0SW5kaWNlcyhpdCkgfSxcbiAgICAgICAgICAgIHsgZGF0YS5kcm9wSW5kaWNlcyhpdCkgfVxuICAgICAgICApXG4gICAgfVxufVxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./kotlin-dce-dev/lets-plot-plot-base-portable.js\n"); /***/ }), @@ -165,7 +165,7 @@ eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPAC \***********************************************************/ /***/ (function(module, exports, __webpack_require__) { -eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) {\n if (true)\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(/*! kotlin */ \"./kotlin-dce-dev/kotlin.js\"), __webpack_require__(/*! lets-plot-plot-base-portable */ \"./kotlin-dce-dev/lets-plot-plot-base-portable.js\"), __webpack_require__(/*! lets-plot-base-portable */ \"./kotlin-dce-dev/lets-plot-base-portable.js\"), __webpack_require__(/*! lets-plot-vis-svg-portable */ \"./kotlin-dce-dev/lets-plot-vis-svg-portable.js\"), __webpack_require__(/*! lets-plot-plot-common-portable */ \"./kotlin-dce-dev/lets-plot-plot-common-portable.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n else {}\n}(this, function (_, Kotlin, $module$lets_plot_plot_base_portable, $module$lets_plot_base_portable, $module$lets_plot_vis_svg_portable, $module$lets_plot_plot_common_portable) {\n 'use strict';\n var data = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.data;\n var println = Kotlin.kotlin.io.println_s8jyv4$;\n var Kind_OBJECT = Kotlin.Kind.OBJECT;\n var scale = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.scale;\n var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init_pdl1vj$;\n var Kind_CLASS = Kotlin.Kind.CLASS;\n var CoordinateSystem = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.CoordinateSystem;\n var Scale = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.Scale;\n var Kind_INTERFACE = Kotlin.Kind.INTERFACE;\n var base = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.base;\n var TextLabel = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.svg.TextLabel;\n var TextLabel$HorizontalAnchor = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.svg.TextLabel.HorizontalAnchor;\n var TextLabel$VerticalAnchor = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.svg.TextLabel.VerticalAnchor;\n var RuntimeException = Kotlin.kotlin.RuntimeException;\n var ensureNotNull = Kotlin.ensureNotNull;\n var EventHandler = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event.EventHandler;\n var Registration = $module$lets_plot_base_portable.jetbrains.datalore.base.registration.Registration;\n var DoubleVector = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleVector;\n var SvgGElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgGElement;\n var SvgEventSpec = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.event.SvgEventSpec;\n var SvgEventHandler = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.event.SvgEventHandler;\n var DoubleRectangle = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleRectangle;\n var SvgRectElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement_init_wthzt5$;\n var Color = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Color;\n var DoubleRectangle_init = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleRectangle_init_6y0v78$;\n var getCallableRef = Kotlin.getCallableRef;\n var logging = $module$lets_plot_base_portable.jetbrains.datalore.base.logging;\n var getKClass = Kotlin.getKClass;\n var SvgComponent = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.svg.SvgComponent;\n var ValueProperty = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.property.ValueProperty;\n var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_287e2$;\n var throwUPAE = Kotlin.throwUPAE;\n var ArrayList_init_0 = Kotlin.kotlin.collections.ArrayList_init_mqih57$;\n var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init_pdl1vj$;\n var SvgCssResource = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgCssResource;\n var SvgRectElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement;\n var CompositeRegistration = $module$lets_plot_base_portable.jetbrains.datalore.base.registration.CompositeRegistration;\n var SvgSvgElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgSvgElement;\n var Unit = Kotlin.kotlin.Unit;\n var JsMath = Math;\n var HashMap_init = Kotlin.kotlin.collections.HashMap_init_q3lmfv$;\n var Aes = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.Aes;\n var ClosedRange = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.ClosedRange;\n var LiveMapGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.LiveMapGeom;\n var throwCCE = Kotlin.throwCCE;\n var emptyList = Kotlin.kotlin.collections.emptyList_287e2$;\n var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$;\n var ArrayList_init_1 = Kotlin.kotlin.collections.ArrayList_init_ww73n8$;\n var collect = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect;\n var lazy = Kotlin.kotlin.lazy_klfg04$;\n var Pair = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Pair;\n var data_0 = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.data;\n var kotlin_js_internal_DoubleCompanionObject = Kotlin.kotlin.js.internal.DoubleCompanionObject;\n var emptyMap = Kotlin.kotlin.collections.emptyMap_q3lmfv$;\n var HashMap_init_0 = Kotlin.kotlin.collections.HashMap_init_73mtqc$;\n var AestheticsBuilder = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.aes.AestheticsBuilder;\n var toString = Kotlin.toString;\n var ContinuousTransform = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.ContinuousTransform;\n var isNaN_0 = Kotlin.kotlin.isNaN_yrwdxr$;\n var Map = Kotlin.kotlin.collections.Map;\n var SvgRoot = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.SvgRoot;\n var equals = Kotlin.equals;\n var hashCode = Kotlin.hashCode;\n var breaks = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.scale.breaks;\n var NullGeomTargetCollector = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.NullGeomTargetCollector;\n var to = Kotlin.kotlin.to_ujzrz7$;\n var toMap = Kotlin.kotlin.collections.toMap_6hr0sd$;\n var TypedKeyHashMap = $module$lets_plot_base_portable.jetbrains.datalore.base.typedKey.TypedKeyHashMap;\n var stat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat;\n var SimpleStatContext = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.SimpleStatContext;\n var GeomTargetLocator$LookupSpec = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupSpec;\n var GeomContext = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.GeomContext;\n var LinkedHashMap_init = Kotlin.kotlin.collections.LinkedHashMap_init_q3lmfv$;\n var getValue = Kotlin.kotlin.collections.getValue_t9ocha$;\n var zip = Kotlin.kotlin.collections.zip_45mdf7$;\n var numberToInt = Kotlin.numberToInt;\n var flatten = Kotlin.kotlin.collections.flatten_u0ad8z$;\n var getPropertyCallableRef = Kotlin.getPropertyCallableRef;\n var Collection = Kotlin.kotlin.collections.Collection;\n var toList = Kotlin.kotlin.toList_tt9upe$;\n var isFinite = Kotlin.kotlin.isFinite_yrwdxr$;\n var first = Kotlin.kotlin.collections.first_2p1efm$;\n var HashSet_init = Kotlin.kotlin.collections.HashSet_init_mqih57$;\n var DataFrame$DataFrame$Builder_init = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.DataFrame.Builder_init;\n var distinct = Kotlin.kotlin.collections.distinct_7wnvza$;\n var listOf = Kotlin.kotlin.collections.listOf_mh5how$;\n var plus = Kotlin.kotlin.collections.plus_mydzjv$;\n var List = Kotlin.kotlin.collections.List;\n var sortedDescending = Kotlin.kotlin.collections.sortedDescending_exjks8$;\n var sorted = Kotlin.kotlin.collections.sorted_exjks8$;\n var pos = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.pos;\n var PositionAdjustments$StackingStrategy = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.pos.PositionAdjustments.StackingStrategy;\n var PositionAdjustments$Meta = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.pos.PositionAdjustments.Meta;\n var toMap_0 = Kotlin.kotlin.collections.toMap_abgq59$;\n var listOfNotNull = Kotlin.kotlin.collections.listOfNotNull_jurz7g$;\n var sortedWith = Kotlin.kotlin.collections.sortedWith_eknfly$;\n var Enum = Kotlin.kotlin.Enum;\n var throwISE = Kotlin.throwISE;\n var Pair_0 = Kotlin.kotlin.Pair;\n var checkIndexOverflow = Kotlin.kotlin.collections.checkIndexOverflow_za3lpa$;\n var wrapFunction = Kotlin.wrapFunction;\n var Comparator = Kotlin.kotlin.Comparator;\n var L37 = Kotlin.Long.fromInt(37);\n var base_0 = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base;\n var PointGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.PointGeom;\n var GeomKind = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.GeomKind;\n var AestheticsDefaults = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.aes.AestheticsDefaults;\n var PathGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.PathGeom;\n var LineGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.LineGeom;\n var SmoothGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.SmoothGeom;\n var BarGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.BarGeom;\n var HistogramGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.HistogramGeom;\n var TileGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.TileGeom;\n var Bin2dGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.Bin2dGeom;\n var ErrorBarGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.ErrorBarGeom;\n var CrossBarGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.CrossBarGeom;\n var LineRangeGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.LineRangeGeom;\n var PointRangeGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.PointRangeGeom;\n var ContourGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.ContourGeom;\n var ContourfGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.ContourfGeom;\n var PolygonGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.PolygonGeom;\n var MapGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.MapGeom;\n var ABLineGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.ABLineGeom;\n var HLineGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.HLineGeom;\n var VLineGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.VLineGeom;\n var BoxplotGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.BoxplotGeom;\n var RibbonGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.RibbonGeom;\n var AreaGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.AreaGeom;\n var DensityGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.DensityGeom;\n var Density2dGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.Density2dGeom;\n var Density2dfGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.Density2dfGeom;\n var JitterGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.JitterGeom;\n var FreqpolyGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.FreqpolyGeom;\n var StepGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.StepGeom;\n var RectGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.RectGeom;\n var SegmentGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.SegmentGeom;\n var TextGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.TextGeom;\n var RasterGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.RasterGeom;\n var ImageGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.ImageGeom;\n var MappedDataAccess = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.MappedDataAccess;\n var MappedDataAccess$MappedData = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.MappedDataAccess.MappedData;\n var coord = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.coord;\n var spatial = $module$lets_plot_base_portable.jetbrains.datalore.base.spatial;\n var Projection = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.coord.Projection;\n var DataFrame$Builder = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.DataFrame.Builder;\n var first_0 = Kotlin.kotlin.collections.first_7wnvza$;\n var HashSet_init_0 = Kotlin.kotlin.collections.HashSet_init_287e2$;\n var listOfNotNull_0 = Kotlin.kotlin.collections.listOfNotNull_issdgt$;\n var plus_0 = Kotlin.kotlin.collections.plus_q4559j$;\n var Ordering = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.Ordering;\n var LinkedHashSet_init = Kotlin.kotlin.collections.LinkedHashSet_init_287e2$;\n var mapCapacity = Kotlin.kotlin.collections.mapCapacity_za3lpa$;\n var coerceAtLeast = Kotlin.kotlin.ranges.coerceAtLeast_dqglrj$;\n var LinkedHashMap_init_0 = Kotlin.kotlin.collections.LinkedHashMap_init_bwtc7$;\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n var requireNoNulls = Kotlin.kotlin.collections.requireNoNulls_whsx6z$;\n var firstOrNull = Kotlin.kotlin.collections.firstOrNull_2p1efm$;\n var Comparable = Kotlin.kotlin.Comparable;\n var binarySearch = Kotlin.kotlin.collections.binarySearch_jhx6be$;\n var listOf_0 = Kotlin.kotlin.collections.listOf_i5x0yv$;\n var DataFrame$OrderSpec = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.DataFrame.OrderSpec;\n var Listeners = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event.Listeners;\n var ListenerCaller = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event.ListenerCaller;\n var MouseEventSource = $module$lets_plot_base_portable.jetbrains.datalore.base.event.MouseEventSource;\n var RuntimeException_init = Kotlin.kotlin.RuntimeException_init_pdl1vj$;\n var SvgLineElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgLineElement_init_6y0v78$;\n var property = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.property;\n var svg = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg;\n var SvgLineElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgLineElement;\n var EventSource = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event.EventSource;\n var event = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event;\n var reverse = Kotlin.kotlin.collections.reverse_vvxzk3$;\n var SvgRectElement_init_0 = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement_init_6y0v78$;\n var NoSuchElementException_init = Kotlin.kotlin.NoSuchElementException_init;\n var isBlank = Kotlin.kotlin.text.isBlank_gw00vp$;\n var GroupComponent = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.svg.GroupComponent;\n var SvgColors = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgColors;\n var ContextualMapping = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.ContextualMapping;\n var DataContext = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.DataContext;\n var GeomTargetLocator$LookupStrategy = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupStrategy;\n var GeomTargetLocator$LookupSpace = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupSpace;\n var minus = Kotlin.kotlin.collections.minus_q4559j$;\n var toMutableList = Kotlin.kotlin.collections.toMutableList_4c7yge$;\n var DoubleSegment = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleSegment;\n var mapOf = Kotlin.kotlin.collections.mapOf_qfcya0$;\n var lastOrNull = Kotlin.kotlin.collections.lastOrNull_2p1efm$;\n var contains = Kotlin.kotlin.collections.contains_2ws7j4$;\n var TipLayoutHint = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.TipLayoutHint;\n var addAll = Kotlin.kotlin.collections.addAll_ipc267$;\n var HitShape = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.HitShape;\n var GeomTargetCollector = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetCollector;\n var GeomTargetLocator = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetLocator;\n var GeomTargetLocator$LookupResult = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupResult;\n var TipLayoutHint$Kind = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.TipLayoutHint.Kind;\n var setOf = Kotlin.kotlin.collections.setOf_i5x0yv$;\n var minOrNull = Kotlin.kotlin.collections.minOrNull_l63kqw$;\n var NoSuchElementException_init_0 = Kotlin.kotlin.NoSuchElementException;\n var IllegalStateException_init_0 = Kotlin.kotlin.IllegalStateException_init;\n var splitRings = $module$lets_plot_base_portable.jetbrains.datalore.base.algorithms.splitRings_bemo1h$;\n var geometry = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry;\n var calculateArea = $module$lets_plot_base_portable.jetbrains.datalore.base.algorithms.calculateArea_ytws2g$;\n var PolylineSimplifier = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.geometry.PolylineSimplifier;\n var GeomTarget = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTarget;\n var toRadians = $module$lets_plot_base_portable.jetbrains.datalore.base.math.toRadians_14dthe$;\n var StringBuilder_init = Kotlin.kotlin.text.StringBuilder_init;\n var StringBuilder = Kotlin.kotlin.text.StringBuilder;\n var trimMargin = Kotlin.kotlin.text.trimMargin_rjktp$;\n var shuffle = Kotlin.kotlin.collections.shuffle_9jeydg$;\n var take = Kotlin.kotlin.collections.take_ba2ldo$;\n var toSet = Kotlin.kotlin.collections.toSet_7wnvza$;\n var Random = Kotlin.kotlin.random.Random_s8cxhz$;\n var Random_0 = Kotlin.kotlin.random.Random;\n var util = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.util;\n var round = Kotlin.kotlin.math.round_14dthe$;\n var until = Kotlin.kotlin.ranges.until_dqglrj$;\n var sum = Kotlin.kotlin.collections.sum_l63kqw$;\n var MutableDouble = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.util.MutableDouble;\n var MutableInteger = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.util.MutableInteger;\n var get_indices = Kotlin.kotlin.collections.get_indices_gzk92b$;\n var asSequence = Kotlin.kotlin.collections.asSequence_7wnvza$;\n var map = Kotlin.kotlin.sequences.map_z5avom$;\n var reversed = Kotlin.kotlin.comparisons.reversed_2avth4$;\n var sortedWith_0 = Kotlin.kotlin.sequences.sortedWith_vjgqpk$;\n var roundToInt = Kotlin.kotlin.math.roundToInt_yrwdxr$;\n var toList_0 = Kotlin.kotlin.sequences.toList_veqyi0$;\n var isClosed = $module$lets_plot_base_portable.jetbrains.datalore.base.algorithms.isClosed_2p1efm$;\n var AbstractList = Kotlin.kotlin.collections.AbstractList;\n var joinToString = Kotlin.kotlin.collections.joinToString_fmv235$;\n var point = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.point;\n var NamedLineType = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.linetype.NamedLineType;\n var aes = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.aes;\n var Function = $module$lets_plot_base_portable.jetbrains.datalore.base.function.Function;\n var AssertionError_init = Kotlin.kotlin.AssertionError_init_pdl1vj$;\n var filterNotNull = Kotlin.kotlin.collections.filterNotNull_m3lr2h$;\n var reversed_0 = Kotlin.kotlin.collections.reversed_7wnvza$;\n var numberToDouble = Kotlin.numberToDouble;\n var StringFormat = $module$lets_plot_base_portable.jetbrains.datalore.base.stringFormat.StringFormat;\n var transform = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.scale.transform;\n var values = $module$lets_plot_base_portable.jetbrains.datalore.base.values;\n var HSV = $module$lets_plot_base_portable.jetbrains.datalore.base.values.HSV;\n var NamedShape = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.point.NamedShape;\n var NamedShape$values = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.point.NamedShape.values;\n var LinkedHashSet_init_0 = Kotlin.kotlin.collections.LinkedHashSet_init_mqih57$;\n var color = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color;\n var ColorPalette$Type = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Type;\n var ColorPalette$Qualitative = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Qualitative;\n var ColorPalette$Sequential$valueOf = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Sequential.valueOf_61zpoe$;\n var ColorPalette$Diverging$valueOf = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Diverging.valueOf_61zpoe$;\n var ColorPalette$Qualitative$valueOf = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Qualitative.valueOf_61zpoe$;\n var IllegalArgumentException = Kotlin.kotlin.IllegalArgumentException;\n var ColorPalette$Sequential$values = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Sequential.values;\n var ColorPalette$Diverging$values = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Diverging.values;\n var ColorPalette$Qualitative$values = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Qualitative.values;\n var joinToString_0 = Kotlin.kotlin.collections.joinToString_cgipc5$;\n var rangeTo = Kotlin.kotlin.ranges.rangeTo_38ydlf$;\n var TooltipLineSpec$DataPoint = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.TooltipLineSpec.DataPoint;\n var StringFormat$FormatType = $module$lets_plot_base_portable.jetbrains.datalore.base.stringFormat.StringFormat.FormatType;\n var single = Kotlin.kotlin.collections.single_2p1efm$;\n var TooltipLineSpec = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.TooltipLineSpec;\n Plot$buildPlot$ObjectLiteral_0.prototype = Object.create(Registration.prototype);\n Plot$buildPlot$ObjectLiteral_0.prototype.constructor = Plot$buildPlot$ObjectLiteral_0;\n Plot.prototype = Object.create(SvgComponent.prototype);\n Plot.prototype.constructor = Plot;\n PlotBuilder$MyPlot.prototype = Object.create(Plot.prototype);\n PlotBuilder$MyPlot.prototype.constructor = PlotBuilder$MyPlot;\n PlotTile.prototype = Object.create(SvgComponent.prototype);\n PlotTile.prototype.constructor = PlotTile;\n PlotTooltipHelper$TileInfo$TileTargetLocator.prototype = Object.create(TransformedTargetLocator.prototype);\n PlotTooltipHelper$TileInfo$TileTargetLocator.prototype.constructor = PlotTooltipHelper$TileInfo$TileTargetLocator;\n SvgLayerRenderer.prototype = Object.create(SvgComponent.prototype);\n SvgLayerRenderer.prototype.constructor = SvgLayerRenderer;\n ColorBarAssembler$createColorBar$ObjectLiteral.prototype = Object.create(LegendBoxInfo.prototype);\n ColorBarAssembler$createColorBar$ObjectLiteral.prototype.constructor = ColorBarAssembler$createColorBar$ObjectLiteral;\n ColorBarOptions.prototype = Object.create(GuideOptions.prototype);\n ColorBarOptions.prototype.constructor = ColorBarOptions;\n GuideOptions$Companion$NONE$ObjectLiteral.prototype = Object.create(GuideOptions.prototype);\n GuideOptions$Companion$NONE$ObjectLiteral.prototype.constructor = GuideOptions$Companion$NONE$ObjectLiteral;\n LegendAssembler$createLegend$ObjectLiteral.prototype = Object.create(LegendBoxInfo.prototype);\n LegendAssembler$createLegend$ObjectLiteral.prototype.constructor = LegendAssembler$createLegend$ObjectLiteral;\n LegendOptions.prototype = Object.create(GuideOptions.prototype);\n LegendOptions.prototype.constructor = LegendOptions;\n PosProvider$Companion$wrap$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$wrap$ObjectLiteral.prototype.constructor = PosProvider$Companion$wrap$ObjectLiteral;\n PosProvider$Companion$barStack$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$barStack$ObjectLiteral.prototype.constructor = PosProvider$Companion$barStack$ObjectLiteral;\n PosProvider$Companion$dodge$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$dodge$ObjectLiteral.prototype.constructor = PosProvider$Companion$dodge$ObjectLiteral;\n PosProvider$Companion$fill$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$fill$ObjectLiteral.prototype.constructor = PosProvider$Companion$fill$ObjectLiteral;\n PosProvider$Companion$jitter$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$jitter$ObjectLiteral.prototype.constructor = PosProvider$Companion$jitter$ObjectLiteral;\n PosProvider$Companion$nudge$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$nudge$ObjectLiteral.prototype.constructor = PosProvider$Companion$nudge$ObjectLiteral;\n PosProvider$Companion$jitterDodge$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$jitterDodge$ObjectLiteral.prototype.constructor = PosProvider$Companion$jitterDodge$ObjectLiteral;\n FacetGrid.prototype = Object.create(PlotFacets.prototype);\n FacetGrid.prototype.constructor = FacetGrid;\n FacetWrap$Direction.prototype = Object.create(Enum.prototype);\n FacetWrap$Direction.prototype.constructor = FacetWrap$Direction;\n FacetWrap.prototype = Object.create(PlotFacets.prototype);\n FacetWrap.prototype.constructor = FacetWrap;\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.prototype = Object.create(GeomProvider.prototype);\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.prototype.constructor = GeomProvider$GeomProviderBuilder$build$ObjectLiteral;\n CartesianCoordProvider.prototype = Object.create(CoordProviderBase.prototype);\n CartesianCoordProvider.prototype.constructor = CartesianCoordProvider;\n FixedRatioCoordProvider.prototype = Object.create(CoordProviderBase.prototype);\n FixedRatioCoordProvider.prototype.constructor = FixedRatioCoordProvider;\n ProjectionCoordProvider.prototype = Object.create(CoordProviderBase.prototype);\n ProjectionCoordProvider.prototype.constructor = ProjectionCoordProvider;\n MouseEventPeer$addEventHandler$ObjectLiteral.prototype = Object.create(Registration.prototype);\n MouseEventPeer$addEventHandler$ObjectLiteral.prototype.constructor = MouseEventPeer$addEventHandler$ObjectLiteral;\n AxisComponent.prototype = Object.create(SvgComponent.prototype);\n AxisComponent.prototype.constructor = AxisComponent;\n LegendBox.prototype = Object.create(SvgComponent.prototype);\n LegendBox.prototype.constructor = LegendBox;\n ColorBarComponent.prototype = Object.create(LegendBox.prototype);\n ColorBarComponent.prototype.constructor = ColorBarComponent;\n ColorBarComponentLayout.prototype = Object.create(LegendBoxLayout.prototype);\n ColorBarComponentLayout.prototype.constructor = ColorBarComponentLayout;\n ColorBarComponentLayout$HorizontalLayout.prototype = Object.create(ColorBarComponentLayout.prototype);\n ColorBarComponentLayout$HorizontalLayout.prototype.constructor = ColorBarComponentLayout$HorizontalLayout;\n ColorBarComponentLayout$VerticalLayout.prototype = Object.create(ColorBarComponentLayout.prototype);\n ColorBarComponentLayout$VerticalLayout.prototype.constructor = ColorBarComponentLayout$VerticalLayout;\n ColorBarComponentSpec.prototype = Object.create(LegendBoxSpec.prototype);\n ColorBarComponentSpec.prototype.constructor = ColorBarComponentSpec;\n LegendArrangement.prototype = Object.create(Enum.prototype);\n LegendArrangement.prototype.constructor = LegendArrangement;\n LegendComponent.prototype = Object.create(LegendBox.prototype);\n LegendComponent.prototype.constructor = LegendComponent;\n LegendComponentLayout.prototype = Object.create(LegendBoxLayout.prototype);\n LegendComponentLayout.prototype.constructor = LegendComponentLayout;\n LegendComponentLayout$MyHorizontal.prototype = Object.create(LegendComponentLayout.prototype);\n LegendComponentLayout$MyHorizontal.prototype.constructor = LegendComponentLayout$MyHorizontal;\n LegendComponentLayout$MyMultiRow.prototype = Object.create(LegendComponentLayout.prototype);\n LegendComponentLayout$MyMultiRow.prototype.constructor = LegendComponentLayout$MyMultiRow;\n LegendComponentLayout$MyHorizontalMultiRow.prototype = Object.create(LegendComponentLayout$MyMultiRow.prototype);\n LegendComponentLayout$MyHorizontalMultiRow.prototype.constructor = LegendComponentLayout$MyHorizontalMultiRow;\n LegendComponentLayout$MyVertical.prototype = Object.create(LegendComponentLayout$MyMultiRow.prototype);\n LegendComponentLayout$MyVertical.prototype.constructor = LegendComponentLayout$MyVertical;\n LegendComponentSpec.prototype = Object.create(LegendBoxSpec.prototype);\n LegendComponentSpec.prototype.constructor = LegendComponentSpec;\n LegendDirection.prototype = Object.create(Enum.prototype);\n LegendDirection.prototype.constructor = LegendDirection;\n Orientation.prototype = Object.create(Enum.prototype);\n Orientation.prototype.constructor = Orientation;\n MathUtil$ClosestPointChecker$COMPARISON_RESULT.prototype = Object.create(Enum.prototype);\n MathUtil$ClosestPointChecker$COMPARISON_RESULT.prototype.constructor = MathUtil$ClosestPointChecker$COMPARISON_RESULT;\n LayerTargetLocator$Collector$CollectingStrategy.prototype = Object.create(Enum.prototype);\n LayerTargetLocator$Collector$CollectingStrategy.prototype.constructor = LayerTargetLocator$Collector$CollectingStrategy;\n PointTargetProjection.prototype = Object.create(TargetProjection.prototype);\n PointTargetProjection.prototype.constructor = PointTargetProjection;\n RectTargetProjection.prototype = Object.create(TargetProjection.prototype);\n RectTargetProjection.prototype.constructor = RectTargetProjection;\n PolygonTargetProjection.prototype = Object.create(TargetProjection.prototype);\n PolygonTargetProjection.prototype.constructor = PolygonTargetProjection;\n PathTargetProjection.prototype = Object.create(TargetProjection.prototype);\n PathTargetProjection.prototype.constructor = PathTargetProjection;\n FacetGridPlotLayout.prototype = Object.create(PlotLayoutBase.prototype);\n FacetGridPlotLayout.prototype.constructor = FacetGridPlotLayout;\n LegendBoxInfo$Companion$EMPTY$ObjectLiteral.prototype = Object.create(LegendBoxInfo.prototype);\n LegendBoxInfo$Companion$EMPTY$ObjectLiteral.prototype.constructor = LegendBoxInfo$Companion$EMPTY$ObjectLiteral;\n SingleTilePlotLayout.prototype = Object.create(PlotLayoutBase.prototype);\n SingleTilePlotLayout.prototype.constructor = SingleTilePlotLayout;\n HorizontalAxisLayouter.prototype = Object.create(AxisLayouter.prototype);\n HorizontalAxisLayouter.prototype.constructor = HorizontalAxisLayouter;\n VerticalAxisLayouter.prototype = Object.create(AxisLayouter.prototype);\n VerticalAxisLayouter.prototype.constructor = VerticalAxisLayouter;\n AbstractFixedBreaksLabelsLayout.prototype = Object.create(AxisLabelsLayout.prototype);\n AbstractFixedBreaksLabelsLayout.prototype.constructor = AbstractFixedBreaksLabelsLayout;\n HorizontalFixedBreaksLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n HorizontalFixedBreaksLabelsLayout.prototype.constructor = HorizontalFixedBreaksLabelsLayout;\n HorizontalFlexBreaksLabelsLayout.prototype = Object.create(AxisLabelsLayout.prototype);\n HorizontalFlexBreaksLabelsLayout.prototype.constructor = HorizontalFlexBreaksLabelsLayout;\n HorizontalMultilineLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n HorizontalMultilineLabelsLayout.prototype.constructor = HorizontalMultilineLabelsLayout;\n HorizontalSimpleLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n HorizontalSimpleLabelsLayout.prototype.constructor = HorizontalSimpleLabelsLayout;\n HorizontalTiltedLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n HorizontalTiltedLabelsLayout.prototype.constructor = HorizontalTiltedLabelsLayout;\n HorizontalVerticalLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n HorizontalVerticalLabelsLayout.prototype.constructor = HorizontalVerticalLabelsLayout;\n VerticalFixedBreaksLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n VerticalFixedBreaksLabelsLayout.prototype.constructor = VerticalFixedBreaksLabelsLayout;\n VerticalFlexBreaksLabelsLayout.prototype = Object.create(AxisLabelsLayout.prototype);\n VerticalFlexBreaksLabelsLayout.prototype.constructor = VerticalFlexBreaksLabelsLayout;\n PlotLabelSpec.prototype = Object.create(Enum.prototype);\n PlotLabelSpec.prototype.constructor = PlotLabelSpec;\n GroupSamplingBase.prototype = Object.create(SamplingBase.prototype);\n GroupSamplingBase.prototype.constructor = GroupSamplingBase;\n GroupRandomSampling.prototype = Object.create(GroupSamplingBase.prototype);\n GroupRandomSampling.prototype.constructor = GroupRandomSampling;\n GroupSystematicSampling.prototype = Object.create(GroupSamplingBase.prototype);\n GroupSystematicSampling.prototype.constructor = GroupSystematicSampling;\n PickSampling.prototype = Object.create(SamplingBase.prototype);\n PickSampling.prototype.constructor = PickSampling;\n RandomSampling.prototype = Object.create(SamplingBase.prototype);\n RandomSampling.prototype.constructor = RandomSampling;\n RandomStratifiedSampling.prototype = Object.create(SamplingBase.prototype);\n RandomStratifiedSampling.prototype.constructor = RandomStratifiedSampling;\n SystematicSampling.prototype = Object.create(SamplingBase.prototype);\n SystematicSampling.prototype.constructor = SystematicSampling;\n VertexSampling.prototype = Object.create(SamplingBase.prototype);\n VertexSampling.prototype.constructor = VertexSampling;\n VertexSampling$VertexVwSampling.prototype = Object.create(VertexSampling.prototype);\n VertexSampling$VertexVwSampling.prototype.constructor = VertexSampling$VertexVwSampling;\n VertexSampling$VertexDpSampling.prototype = Object.create(VertexSampling.prototype);\n VertexSampling$VertexDpSampling.prototype.constructor = VertexSampling$VertexDpSampling;\n VertexSampling$DoubleVectorComponentsList.prototype = Object.create(AbstractList.prototype);\n VertexSampling$DoubleVectorComponentsList.prototype.constructor = VertexSampling$DoubleVectorComponentsList;\n ContinuousOnlyMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n ContinuousOnlyMapperProvider.prototype.constructor = ContinuousOnlyMapperProvider;\n DiscreteOnlyMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n DiscreteOnlyMapperProvider.prototype.constructor = DiscreteOnlyMapperProvider;\n IdentityDiscreteMapperProvider.prototype = Object.create(DiscreteOnlyMapperProvider.prototype);\n IdentityDiscreteMapperProvider.prototype.constructor = IdentityDiscreteMapperProvider;\n DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral.prototype = Object.create(IdentityDiscreteMapperProvider.prototype);\n DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral.prototype.constructor = DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral;\n DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral.prototype = Object.create(IdentityDiscreteMapperProvider.prototype);\n DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral.prototype.constructor = DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral;\n LinearNormalizingMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n LinearNormalizingMapperProvider.prototype.constructor = LinearNormalizingMapperProvider;\n AlphaMapperProvider.prototype = Object.create(LinearNormalizingMapperProvider.prototype);\n AlphaMapperProvider.prototype.constructor = AlphaMapperProvider;\n ColorBrewerMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n ColorBrewerMapperProvider.prototype.constructor = ColorBrewerMapperProvider;\n ColorGradient2MapperProvider.prototype = Object.create(ContinuousOnlyMapperProvider.prototype);\n ColorGradient2MapperProvider.prototype.constructor = ColorGradient2MapperProvider;\n ColorGradientMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n ColorGradientMapperProvider.prototype.constructor = ColorGradientMapperProvider;\n HSVColorMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n HSVColorMapperProvider.prototype.constructor = HSVColorMapperProvider;\n ColorHueMapperProvider.prototype = Object.create(HSVColorMapperProvider.prototype);\n ColorHueMapperProvider.prototype.constructor = ColorHueMapperProvider;\n DirectlyProportionalMapperProvider.prototype = Object.create(ContinuousOnlyMapperProvider.prototype);\n DirectlyProportionalMapperProvider.prototype.constructor = DirectlyProportionalMapperProvider;\n GreyscaleLightnessMapperProvider.prototype = Object.create(HSVColorMapperProvider.prototype);\n GreyscaleLightnessMapperProvider.prototype.constructor = GreyscaleLightnessMapperProvider;\n SizeAreaMapperProvider.prototype = Object.create(DirectlyProportionalMapperProvider.prototype);\n SizeAreaMapperProvider.prototype.constructor = SizeAreaMapperProvider;\n SizeMapperProvider.prototype = Object.create(LinearNormalizingMapperProvider.prototype);\n SizeMapperProvider.prototype.constructor = SizeMapperProvider;\n DefaultTheme$multiTile$ObjectLiteral.prototype = Object.create(DefaultTheme.prototype);\n DefaultTheme$multiTile$ObjectLiteral.prototype.constructor = DefaultTheme$multiTile$ObjectLiteral;\n DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral.prototype = Object.create(DefaultAxisTheme.prototype);\n DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral.prototype.constructor = DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral;\n function FeatureSwitch() {\n FeatureSwitch_instance = this;\n this.PLOT_DEBUG_DRAWING = false;\n this.LEGEND_DEBUG_DRAWING = false;\n this.PRINT_DEBUG_LOGS_0 = false;\n this.PRINT_ENCODED_DATA_SUMMARY_0 = false;\n this.USE_DATA_FRAME_ENCODING = true;\n }\n FeatureSwitch.prototype.printEncodedDataSummary_d0u64m$ = function (header, dataSpec) {\n if (this.PRINT_ENCODED_DATA_SUMMARY_0) {\n this.printEncodedDataSummary_0(header, data.DataFrameUtil.fromMap_bkhwtg$(dataSpec));\n }};\n FeatureSwitch.prototype.isDebugLogEnabled = function () {\n return this.PRINT_DEBUG_LOGS_0;\n };\n FeatureSwitch.prototype.printEncodedDataSummary_0 = function (header, df) {\n if (this.PRINT_ENCODED_DATA_SUMMARY_0) {\n var summary = data.DataFrameUtil.getSummaryText_dhhkv7$(df);\n println(header);\n println(summary);\n }};\n FeatureSwitch.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'FeatureSwitch',\n interfaces: []\n };\n var FeatureSwitch_instance = null;\n function FeatureSwitch_getInstance() {\n if (FeatureSwitch_instance === null) {\n new FeatureSwitch();\n }return FeatureSwitch_instance;\n }\n function AxisUtil() {\n AxisUtil_instance = this;\n }\n AxisUtil.prototype.applyLayoutInfo_4pg061$ = function (axis, info) {\n axis.tickLabelOffsets.set_11rb$(info.tickLabelAdditionalOffsets);\n axis.tickLabelRotationDegree.set_11rb$(info.tickLabelRotationAngle);\n if (info.tickLabelHorizontalAnchor != null) {\n axis.tickLabelHorizontalAnchor.set_11rb$(info.tickLabelHorizontalAnchor);\n }if (info.tickLabelVerticalAnchor != null) {\n axis.tickLabelVerticalAnchor.set_11rb$(info.tickLabelVerticalAnchor);\n }axis.tickLabelSmallFont.set_11rb$(info.tickLabelSmallFont);\n };\n AxisUtil.prototype.applyTheme_tna4q5$ = function (axis, theme) {\n axis.tickLabelsEnabled().set_11rb$(theme.showTickLabels());\n axis.tickMarksEnabled().set_11rb$(theme.showTickMarks());\n axis.axisLineEnabled().set_11rb$(theme.showLine());\n axis.lineWidth.set_11rb$(theme.lineWidth());\n axis.tickMarkLength.set_11rb$(theme.tickMarkLength());\n axis.tickMarkPadding.set_11rb$(theme.tickMarkPadding());\n axis.tickMarkWidth.set_11rb$(theme.tickMarkWidth());\n };\n AxisUtil.prototype.setBreaks_6e5l22$ = function (axis, scale_0, coord, isHorizontal) {\n axis.breaks.set_11rb$(scale.ScaleUtil.axisBreaks_2m8kky$(scale_0, coord, isHorizontal));\n axis.labels.set_11rb$(scale.ScaleUtil.labels_x4zrm4$(scale_0));\n };\n AxisUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'AxisUtil',\n interfaces: []\n };\n var AxisUtil_instance = null;\n function AxisUtil_getInstance() {\n if (AxisUtil_instance === null) {\n new AxisUtil();\n }return AxisUtil_instance;\n }\n function BogusCoordinateSystem() {\n }\n BogusCoordinateSystem.prototype.toClient_gpjtzr$ = function (p) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n BogusCoordinateSystem.prototype.fromClient_gpjtzr$ = function (p) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n BogusCoordinateSystem.prototype.isPointInLimits_k2qmv6$$default = function (p, isClient) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n BogusCoordinateSystem.prototype.isRectInLimits_fd842m$$default = function (rect, isClient) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n BogusCoordinateSystem.prototype.isPathInLimits_f6t8kh$$default = function (path, isClient) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n BogusCoordinateSystem.prototype.isPolygonInLimits_f6t8kh$$default = function (polygon, isClient) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n Object.defineProperty(BogusCoordinateSystem.prototype, 'xClientLimit', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusCoordinateSystem.prototype, 'yClientLimit', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n }\n });\n BogusCoordinateSystem.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BogusCoordinateSystem',\n interfaces: [CoordinateSystem]\n };\n function BogusScale() {\n }\n Object.defineProperty(BogusScale.prototype, 'name', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'breaks', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'labels', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'labelFormatter', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'isContinuous', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'isContinuousDomain', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'domainLimits', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'multiplicativeExpand', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'additiveExpand', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'transform', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'mapper', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'breaksGenerator', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n BogusScale.prototype.hasBreaksGenerator = function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.prototype.hasBreaks = function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.prototype.hasLabels = function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.prototype.hasDomainLimits = function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.prototype.isInDomainLimits_za3rmp$ = function (v) {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.prototype.with = function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BogusScale',\n interfaces: [Scale]\n };\n function GeomLayer() {\n }\n GeomLayer.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GeomLayer',\n interfaces: []\n };\n function GeomLayerListUtil() {\n GeomLayerListUtil_instance = this;\n }\n GeomLayerListUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GeomLayerListUtil',\n interfaces: []\n };\n var GeomLayerListUtil_instance = null;\n function GeomLayerListUtil_getInstance() {\n if (GeomLayerListUtil_instance === null) {\n new GeomLayerListUtil();\n }return GeomLayerListUtil_instance;\n }\n function LayerRendererUtil() {\n LayerRendererUtil_instance = this;\n }\n LayerRendererUtil.prototype.createLayerRendererData_knseyn$ = function (layer, sharedNumericMappers, overallNumericDomains) {\n var aestheticMappers = PlotUtil_getInstance().prepareLayerAestheticMappers_viiuew$(layer, sharedNumericMappers);\n var aesthetics = PlotUtil_getInstance().createLayerAesthetics_kpf4gp$(layer, aestheticMappers, overallNumericDomains);\n var pos = PlotUtil_getInstance().createLayerPos_2iooof$(layer, aesthetics);\n return new LayerRendererUtil$LayerRendererData(layer, aesthetics, aestheticMappers, pos);\n };\n function LayerRendererUtil$LayerRendererData(layer, aesthetics, aestheticMappers, pos) {\n this.aesthetics = aesthetics;\n this.aestheticMappers = aestheticMappers;\n this.pos = pos;\n this.geom = layer.geom;\n this.geomKind = layer.geomKind;\n this.dataAccess = layer.dataAccess;\n this.contextualMapping = layer.contextualMapping;\n }\n LayerRendererUtil$LayerRendererData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LayerRendererData',\n interfaces: []\n };\n LayerRendererUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'LayerRendererUtil',\n interfaces: []\n };\n var LayerRendererUtil_instance = null;\n function LayerRendererUtil_getInstance() {\n if (LayerRendererUtil_instance === null) {\n new LayerRendererUtil();\n }return LayerRendererUtil_instance;\n }\n function Plot(theme) {\n Plot$Companion_getInstance();\n SvgComponent.call(this);\n this.theme_5sfato$_0 = theme;\n this.myPreferredSize_8a54qv$_0 = new ValueProperty(Plot$Companion_getInstance().DEF_PLOT_SIZE_0);\n this.myLaidOutSize_jqfjq$_0 = new ValueProperty(DoubleVector.Companion.ZERO);\n this.myTooltipHelper_3jkkzs$_0 = new PlotTooltipHelper();\n this.myLiveMapFigures_nd8qng$_0 = ArrayList_init();\n this.mouseEventPeer = new MouseEventPeer();\n }\n Object.defineProperty(Plot.prototype, 'liveMapFigures_8be2vx$', {\n configurable: true,\n get: function () {\n return this.myLiveMapFigures_nd8qng$_0;\n }\n });\n Plot.prototype.preferredSize_8be2vx$ = function () {\n return this.myPreferredSize_8a54qv$_0;\n };\n Plot.prototype.laidOutSize = function () {\n return this.myLaidOutSize_jqfjq$_0;\n };\n function Plot$buildComponent$lambda() {\n return 'buildPlot';\n }\n Plot.prototype.buildComponent = function () {\n var tmp$;\n try {\n this.buildPlot_wr1hxq$_0();\n } catch (e) {\n if (Kotlin.isType(e, RuntimeException)) {\n Plot$Companion_getInstance().LOG_0.error_l35kib$(e, Plot$buildComponent$lambda);\n var rootCause = base.Throwables.getRootCause_tcv7n7$(e);\n var messages = ['Error building plot: ' + Kotlin.getKClassFromExpression(rootCause).simpleName, rootCause.message != null ? \"'\" + rootCause.message + \"'\" : ''];\n var y = this.myPreferredSize_8a54qv$_0.get().y / 2 - 8;\n for (tmp$ = 0; tmp$ !== messages.length; ++tmp$) {\n var s = messages[tmp$];\n var errorLabel = new TextLabel(s);\n errorLabel.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE);\n errorLabel.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.CENTER);\n errorLabel.moveTo_lu1900$(this.myPreferredSize_8a54qv$_0.get().x / 2, y);\n this.rootGroup.children().add_11rb$(errorLabel.rootGroup);\n y += 16.0;\n }\n } else\n throw e;\n }\n };\n function Plot$buildPlot$ObjectLiteral(this$Plot) {\n this.this$Plot = this$Plot;\n }\n Plot$buildPlot$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n var newValue = event.newValue;\n if (ensureNotNull(newValue).x > 0 && newValue.y > 0) {\n this.this$Plot.rebuildPlot_v06af3$_0();\n }};\n Plot$buildPlot$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n function Plot$buildPlot$ObjectLiteral_0(this$Plot) {\n this.this$Plot = this$Plot;\n Registration.call(this);\n }\n Plot$buildPlot$ObjectLiteral_0.prototype.doRemove = function () {\n this.this$Plot.myTooltipHelper_3jkkzs$_0.removeAllTileInfos();\n this.this$Plot.myLiveMapFigures_nd8qng$_0.clear();\n };\n Plot$buildPlot$ObjectLiteral_0.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n Plot.prototype.buildPlot_wr1hxq$_0 = function () {\n this.rootGroup.addClass_61zpoe$(Style_getInstance().PLOT);\n this.buildPlotComponents_8cuv6w$_0();\n this.reg_3xv6fb$(this.myPreferredSize_8a54qv$_0.addHandler_gxwwpc$(new Plot$buildPlot$ObjectLiteral(this)));\n this.reg_3xv6fb$(new Plot$buildPlot$ObjectLiteral_0(this));\n };\n Plot.prototype.rebuildPlot_v06af3$_0 = function () {\n this.clear();\n this.buildPlot_wr1hxq$_0();\n };\n Plot.prototype.createTile_rg9gwo$_0 = function (tilesOrigin, tileInfo, tileLayers, theme) {\n var xScale;\n var yScale;\n var coord;\n if (tileInfo.xAxisInfo != null && tileInfo.yAxisInfo != null) {\n var xDomain = ensureNotNull(tileInfo.xAxisInfo.axisDomain);\n var xAxisLength = tileInfo.xAxisInfo.axisLength;\n var yDomain = ensureNotNull(tileInfo.yAxisInfo.axisDomain);\n var yAxisLength = tileInfo.yAxisInfo.axisLength;\n xScale = this.coordProvider.buildAxisScaleX_hcz7zd$(this.scaleXProto, xDomain, xAxisLength, ensureNotNull(tileInfo.xAxisInfo.axisBreaks));\n yScale = this.coordProvider.buildAxisScaleY_hcz7zd$(this.scaleYProto, yDomain, yAxisLength, ensureNotNull(tileInfo.yAxisInfo.axisBreaks));\n coord = this.coordProvider.createCoordinateSystem_uncllg$(xDomain, xAxisLength, yDomain, yAxisLength);\n } else {\n xScale = new BogusScale();\n yScale = new BogusScale();\n coord = new BogusCoordinateSystem();\n }\n var tile = new PlotTile(tileLayers, xScale, yScale, tilesOrigin, tileInfo, coord, theme);\n tile.setShowAxis_6taknv$(this.isAxisEnabled);\n tile.debugDrawing().set_11rb$(Plot$Companion_getInstance().DEBUG_DRAWING_0);\n return tile;\n };\n Plot.prototype.createAxisTitle_depkt8$_0 = function (text, orientation, plotBounds, geomBounds) {\n var tmp$;\n var horizontalAnchor = TextLabel$HorizontalAnchor.MIDDLE;\n switch (orientation.name) {\n case 'LEFT':\n case 'RIGHT':\n case 'TOP':\n tmp$ = TextLabel$VerticalAnchor.TOP;\n break;\n case 'BOTTOM':\n tmp$ = TextLabel$VerticalAnchor.BOTTOM;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n var verticalAnchor = tmp$;\n var titleLocation;\n var rotation = 0.0;\n switch (orientation.name) {\n case 'LEFT':\n titleLocation = new DoubleVector(plotBounds.left + PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN, geomBounds.center.y);\n rotation = -90.0;\n break;\n case 'RIGHT':\n titleLocation = new DoubleVector(plotBounds.right - PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN, geomBounds.center.y);\n rotation = 90.0;\n break;\n case 'TOP':\n titleLocation = new DoubleVector(geomBounds.center.x, plotBounds.top + PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN);\n break;\n case 'BOTTOM':\n titleLocation = new DoubleVector(geomBounds.center.x, plotBounds.bottom - PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN);\n break;\n default:Kotlin.noWhenBranchMatched();\n break;\n }\n var titleLabel = new TextLabel(text);\n titleLabel.setHorizontalAnchor_ja80zo$(horizontalAnchor);\n titleLabel.setVerticalAnchor_yaudma$(verticalAnchor);\n titleLabel.moveTo_gpjtzr$(titleLocation);\n titleLabel.rotate_14dthe$(rotation);\n var titleElement = titleLabel.rootGroup;\n titleElement.addClass_61zpoe$(Style_getInstance().AXIS_TITLE);\n var parent = new SvgGElement();\n parent.addClass_61zpoe$(Style_getInstance().AXIS);\n parent.children().add_11rb$(titleElement);\n this.add_26jijc$(parent);\n };\n function Plot$onMouseMove$ObjectLiteral(closure$message) {\n this.closure$message = closure$message;\n }\n Plot$onMouseMove$ObjectLiteral.prototype.handle_42da0z$ = function (node, e) {\n println(this.closure$message);\n };\n Plot$onMouseMove$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [SvgEventHandler]\n };\n Plot.prototype.onMouseMove_hnimoe$_0 = function (e, message) {\n e.addEventHandler_mm8kk2$(SvgEventSpec.MOUSE_MOVE, new Plot$onMouseMove$ObjectLiteral(message));\n };\n Plot.prototype.buildPlotComponents_8cuv6w$_0 = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4, tmp$_5;\n var preferredSize = this.myPreferredSize_8a54qv$_0.get();\n var overallRect = new DoubleRectangle(DoubleVector.Companion.ZERO, preferredSize);\n if (Plot$Companion_getInstance().DEBUG_DRAWING_0) {\n var rect = SvgRectElement_init(overallRect);\n rect.strokeColor().set_11rb$(Color.Companion.MAGENTA);\n rect.strokeWidth().set_11rb$(1.0);\n rect.fillOpacity().set_11rb$(0.0);\n this.onMouseMove_hnimoe$_0(rect, 'MAGENTA: preferred size: ' + overallRect);\n this.add_26jijc$(rect);\n }if (this.hasLiveMap()) {\n tmp$ = PlotLayoutUtil_getInstance().liveMapBounds_wthzt5$(overallRect);\n } else {\n tmp$ = overallRect;\n }\n var entirePlot = tmp$;\n if (this.hasTitle()) {\n var titleSize = PlotLayoutUtil_getInstance().titleDimensions_61zpoe$(this.title);\n tmp$_0 = new DoubleRectangle(entirePlot.origin.add_gpjtzr$(new DoubleVector(0.0, titleSize.y)), entirePlot.dimension.subtract_gpjtzr$(new DoubleVector(0.0, titleSize.y)));\n } else {\n tmp$_0 = entirePlot;\n }\n var withoutTitle = tmp$_0;\n var boxesLayoutResult = null;\n var legendTheme = this.theme_5sfato$_0.legend();\n if (legendTheme.position().isFixed) {\n var legendBoxesLayout = new LegendBoxesLayout(withoutTitle, legendTheme);\n boxesLayoutResult = legendBoxesLayout.doLayout_8sg693$(this.legendBoxInfos);\n tmp$_1 = boxesLayoutResult.plotInnerBoundsWithoutLegendBoxes;\n } else {\n tmp$_1 = withoutTitle;\n }\n var withoutTitleAndLegends = tmp$_1;\n if (Plot$Companion_getInstance().DEBUG_DRAWING_0) {\n var rect_0 = SvgRectElement_init(withoutTitleAndLegends);\n rect_0.strokeColor().set_11rb$(Color.Companion.BLUE);\n rect_0.strokeWidth().set_11rb$(1.0);\n rect_0.fillOpacity().set_11rb$(0.0);\n this.onMouseMove_hnimoe$_0(rect_0, 'BLUE: plot without title and legends: ' + withoutTitleAndLegends);\n this.add_26jijc$(rect_0);\n }var geomAndAxis = withoutTitleAndLegends;\n if (this.isAxisEnabled) {\n if (this.hasAxisTitleLeft()) {\n var titleSize_0 = PlotLayoutUtil_getInstance().axisTitleDimensions_61zpoe$(this.axisTitleLeft);\n var thickness = titleSize_0.y + PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN + PlotLayoutUtil_getInstance().AXIS_TITLE_INNER_MARGIN;\n geomAndAxis = DoubleRectangle_init(geomAndAxis.left + thickness, geomAndAxis.top, geomAndAxis.width - thickness, geomAndAxis.height);\n }if (this.hasAxisTitleBottom()) {\n var titleSize_1 = PlotLayoutUtil_getInstance().axisTitleDimensions_61zpoe$(this.axisTitleBottom);\n var thickness_0 = titleSize_1.y + PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN + PlotLayoutUtil_getInstance().AXIS_TITLE_INNER_MARGIN;\n geomAndAxis = DoubleRectangle_init(geomAndAxis.left, geomAndAxis.top, geomAndAxis.width, geomAndAxis.height - thickness_0);\n }}var plotLayout = this.plotLayout();\n var plotInfo = plotLayout.doLayout_gpjtzr$(geomAndAxis.dimension);\n this.myLaidOutSize_jqfjq$_0.set_11rb$(preferredSize);\n if (plotInfo.tiles.isEmpty()) {\n return;\n }var geomAreaBounds = PlotLayoutUtil_getInstance().absoluteGeomBounds_vjhcds$(geomAndAxis.origin, plotInfo);\n if (legendTheme.position().isOverlay) {\n var legendBoxesLayout_0 = new LegendBoxesLayout(geomAreaBounds, legendTheme);\n boxesLayoutResult = legendBoxesLayout_0.doLayout_8sg693$(this.legendBoxInfos);\n }if (plotInfo.tiles.size > 1) {\n tmp$_2 = this.theme_5sfato$_0.multiTile();\n } else {\n tmp$_2 = this.theme_5sfato$_0;\n }\n var tileTheme = tmp$_2;\n var tilesOrigin = geomAndAxis.origin;\n tmp$_3 = plotInfo.tiles.iterator();\n while (tmp$_3.hasNext()) {\n var tileLayoutInfo = tmp$_3.next();\n var tileLayersIndex = tileLayoutInfo.trueIndex;\n var tile = this.createTile_rg9gwo$_0(tilesOrigin, tileLayoutInfo, this.tileLayers_za3lpa$(tileLayersIndex), tileTheme);\n var plotOriginAbsolute = tilesOrigin.add_gpjtzr$(tileLayoutInfo.plotOrigin);\n tile.moveTo_gpjtzr$(plotOriginAbsolute);\n this.add_8icvvv$(tile);\n if ((tmp$_4 = tile.liveMapFigure) != null) {\n getCallableRef('add', function ($receiver, p1) {\n return $receiver.add_11rb$(p1);\n }.bind(null, this.myLiveMapFigures_nd8qng$_0))(tmp$_4);\n }var geomBoundsAbsolute = tileLayoutInfo.geomBounds.add_gpjtzr$(plotOriginAbsolute);\n this.myTooltipHelper_3jkkzs$_0.addTileInfo_t6qbjr$(geomBoundsAbsolute, tile.targetLocators);\n }\n if (Plot$Companion_getInstance().DEBUG_DRAWING_0) {\n var rect_1 = SvgRectElement_init(geomAreaBounds);\n rect_1.strokeColor().set_11rb$(Color.Companion.RED);\n rect_1.strokeWidth().set_11rb$(1.0);\n rect_1.fillOpacity().set_11rb$(0.0);\n this.add_26jijc$(rect_1);\n }if (this.hasTitle()) {\n var titleLabel = new TextLabel(this.title);\n titleLabel.addClassName_61zpoe$(Style_getInstance().PLOT_TITLE);\n titleLabel.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.LEFT);\n titleLabel.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.CENTER);\n var titleSize_2 = PlotLayoutUtil_getInstance().titleDimensions_61zpoe$(this.title);\n var titleBounds = DoubleRectangle_init(geomAreaBounds.origin.x, 0.0, titleSize_2.x, titleSize_2.y);\n titleLabel.moveTo_gpjtzr$(new DoubleVector(titleBounds.left, titleBounds.center.y));\n this.add_8icvvv$(titleLabel);\n if (Plot$Companion_getInstance().DEBUG_DRAWING_0) {\n var rect_2 = SvgRectElement_init(titleBounds);\n rect_2.strokeColor().set_11rb$(Color.Companion.BLUE);\n rect_2.strokeWidth().set_11rb$(1.0);\n rect_2.fillOpacity().set_11rb$(0.0);\n this.add_26jijc$(rect_2);\n }}if (this.isAxisEnabled) {\n if (this.hasAxisTitleLeft()) {\n this.createAxisTitle_depkt8$_0(this.axisTitleLeft, Orientation$LEFT_getInstance(), withoutTitleAndLegends, geomAreaBounds);\n }if (this.hasAxisTitleBottom()) {\n this.createAxisTitle_depkt8$_0(this.axisTitleBottom, Orientation$BOTTOM_getInstance(), withoutTitleAndLegends, geomAreaBounds);\n }}if (boxesLayoutResult != null) {\n tmp$_5 = boxesLayoutResult.boxWithLocationList.iterator();\n while (tmp$_5.hasNext()) {\n var boxWithLocation = tmp$_5.next();\n var legendBox = boxWithLocation.legendBox.createLegendBox();\n legendBox.moveTo_gpjtzr$(boxWithLocation.location);\n this.add_8icvvv$(legendBox);\n }\n }};\n Plot.prototype.createTooltipSpecs_gpjtzr$ = function (plotCoord) {\n return this.myTooltipHelper_3jkkzs$_0.createTooltipSpecs_gpjtzr$(plotCoord);\n };\n Plot.prototype.getGeomBounds_gpjtzr$ = function (plotCoord) {\n return this.myTooltipHelper_3jkkzs$_0.getGeomBounds_gpjtzr$(plotCoord);\n };\n function Plot$Companion() {\n Plot$Companion_instance = this;\n this.LOG_0 = logging.PortableLogging.logger_xo1ogr$(getKClass(Plot));\n this.DEF_PLOT_SIZE_0 = new DoubleVector(600.0, 400.0);\n this.DEBUG_DRAWING_0 = FeatureSwitch_getInstance().PLOT_DEBUG_DRAWING;\n }\n Plot$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Plot$Companion_instance = null;\n function Plot$Companion_getInstance() {\n if (Plot$Companion_instance === null) {\n new Plot$Companion();\n }return Plot$Companion_instance;\n }\n Plot.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Plot',\n interfaces: [SvgComponent]\n };\n function PlotBuilder(myTheme) {\n this.myTheme_0 = myTheme;\n this.myLayersByTile_0 = ArrayList_init();\n this.myTitle_0 = null;\n this.myCoordProvider_3t551e$_0 = this.myCoordProvider_3t551e$_0;\n this.myLayout_0 = null;\n this.myAxisTitleLeft_0 = null;\n this.myAxisTitleBottom_0 = null;\n this.myLegendBoxInfos_0 = ArrayList_init();\n this.myScaleXProto_s7k1di$_0 = this.myScaleXProto_s7k1di$_0;\n this.myScaleYProto_dj5r5h$_0 = this.myScaleYProto_dj5r5h$_0;\n this.myAxisEnabled_0 = true;\n this.myInteractionsEnabled_0 = true;\n this.hasLiveMap_0 = false;\n }\n Object.defineProperty(PlotBuilder.prototype, 'myCoordProvider_0', {\n configurable: true,\n get: function () {\n if (this.myCoordProvider_3t551e$_0 == null)\n return throwUPAE('myCoordProvider');\n return this.myCoordProvider_3t551e$_0;\n },\n set: function (myCoordProvider) {\n this.myCoordProvider_3t551e$_0 = myCoordProvider;\n }\n });\n Object.defineProperty(PlotBuilder.prototype, 'myScaleXProto_0', {\n configurable: true,\n get: function () {\n if (this.myScaleXProto_s7k1di$_0 == null)\n return throwUPAE('myScaleXProto');\n return this.myScaleXProto_s7k1di$_0;\n },\n set: function (myScaleXProto) {\n this.myScaleXProto_s7k1di$_0 = myScaleXProto;\n }\n });\n Object.defineProperty(PlotBuilder.prototype, 'myScaleYProto_0', {\n configurable: true,\n get: function () {\n if (this.myScaleYProto_dj5r5h$_0 == null)\n return throwUPAE('myScaleYProto');\n return this.myScaleYProto_dj5r5h$_0;\n },\n set: function (myScaleYProto) {\n this.myScaleYProto_dj5r5h$_0 = myScaleYProto;\n }\n });\n PlotBuilder.prototype.setTitle_pdl1vj$ = function (title) {\n this.myTitle_0 = title;\n };\n PlotBuilder.prototype.setAxisTitleLeft_61zpoe$ = function (v) {\n this.myAxisTitleLeft_0 = v;\n };\n PlotBuilder.prototype.setAxisTitleBottom_61zpoe$ = function (v) {\n this.myAxisTitleBottom_0 = v;\n };\n PlotBuilder.prototype.setCoordProvider_sdecqr$ = function (coordProvider) {\n this.myCoordProvider_0 = coordProvider;\n return this;\n };\n PlotBuilder.prototype.addTileLayers_relqli$ = function (tileLayers) {\n this.myLayersByTile_0.add_11rb$(ArrayList_init_0(tileLayers));\n return this;\n };\n PlotBuilder.prototype.setPlotLayout_vjneqj$ = function (layout) {\n this.myLayout_0 = layout;\n return this;\n };\n PlotBuilder.prototype.addLegendBoxInfo_29gouq$ = function (v) {\n this.myLegendBoxInfos_0.add_11rb$(v);\n return this;\n };\n PlotBuilder.prototype.scaleXProto_iu85h4$ = function (scaleXProto) {\n this.myScaleXProto_0 = scaleXProto;\n return this;\n };\n PlotBuilder.prototype.scaleYProto_iu85h4$ = function (scaleYProto) {\n this.myScaleYProto_0 = scaleYProto;\n return this;\n };\n PlotBuilder.prototype.axisEnabled_6taknv$ = function (b) {\n this.myAxisEnabled_0 = b;\n return this;\n };\n PlotBuilder.prototype.interactionsEnabled_6taknv$ = function (b) {\n this.myInteractionsEnabled_0 = b;\n return this;\n };\n PlotBuilder.prototype.setLiveMap_6taknv$ = function (b) {\n this.hasLiveMap_0 = b;\n return this;\n };\n PlotBuilder.prototype.build = function () {\n return new PlotBuilder$MyPlot(this);\n };\n function PlotBuilder$MyPlot(b) {\n Plot.call(this, b.myTheme_0);\n this.scaleXProto_rbtdab$_0 = b.myScaleXProto_0;\n this.scaleYProto_t0wegs$_0 = b.myScaleYProto_0;\n this.myTitle_0 = b.myTitle_0;\n this.myAxisTitleLeft_0 = b.myAxisTitleLeft_0;\n this.myAxisTitleBottom_0 = b.myAxisTitleBottom_0;\n this.myAxisXTitleEnabled_0 = b.myTheme_0.axisX().showTitle();\n this.myAxisYTitleEnabled_0 = b.myTheme_0.axisY().showTitle();\n this.coordProvider_o460zb$_0 = b.myCoordProvider_0;\n this.myLayersByTile_0 = null;\n this.myLayout_0 = null;\n this.myLegendBoxInfos_0 = null;\n this.hasLiveMap_0 = false;\n this.isAxisEnabled_70ondl$_0 = false;\n this.isInteractionsEnabled_dvtvmh$_0 = false;\n this.myLayersByTile_0 = ArrayList_init_0(b.myLayersByTile_0);\n this.myLayout_0 = b.myLayout_0;\n this.myLegendBoxInfos_0 = ArrayList_init_0(b.myLegendBoxInfos_0);\n this.hasLiveMap_0 = b.hasLiveMap_0;\n this.isAxisEnabled_70ondl$_0 = b.myAxisEnabled_0;\n this.isInteractionsEnabled_dvtvmh$_0 = b.myInteractionsEnabled_0;\n }\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'scaleXProto', {\n configurable: true,\n get: function () {\n return this.scaleXProto_rbtdab$_0;\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'scaleYProto', {\n configurable: true,\n get: function () {\n return this.scaleYProto_t0wegs$_0;\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'coordProvider', {\n configurable: true,\n get: function () {\n return this.coordProvider_o460zb$_0;\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'isAxisEnabled', {\n configurable: true,\n get: function () {\n return this.isAxisEnabled_70ondl$_0;\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'isInteractionsEnabled', {\n configurable: true,\n get: function () {\n return this.isInteractionsEnabled_dvtvmh$_0;\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'title', {\n configurable: true,\n get: function () {\n if (!this.hasTitle()) {\n var message = 'No title';\n throw IllegalArgumentException_init(message.toString());\n }return ensureNotNull(this.myTitle_0);\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'axisTitleLeft', {\n configurable: true,\n get: function () {\n if (!this.hasAxisTitleLeft()) {\n var message = 'No left axis title';\n throw IllegalArgumentException_init(message.toString());\n }return ensureNotNull(this.myAxisTitleLeft_0);\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'axisTitleBottom', {\n configurable: true,\n get: function () {\n if (!this.hasAxisTitleBottom()) {\n var message = 'No bottom axis title';\n throw IllegalArgumentException_init(message.toString());\n }return ensureNotNull(this.myAxisTitleBottom_0);\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'legendBoxInfos', {\n configurable: true,\n get: function () {\n return this.myLegendBoxInfos_0;\n }\n });\n PlotBuilder$MyPlot.prototype.hasTitle = function () {\n return !base.Strings.isNullOrEmpty_pdl1vj$(this.myTitle_0);\n };\n PlotBuilder$MyPlot.prototype.hasAxisTitleLeft = function () {\n return this.myAxisYTitleEnabled_0 && !base.Strings.isNullOrEmpty_pdl1vj$(this.myAxisTitleLeft_0);\n };\n PlotBuilder$MyPlot.prototype.hasAxisTitleBottom = function () {\n return this.myAxisXTitleEnabled_0 && !base.Strings.isNullOrEmpty_pdl1vj$(this.myAxisTitleBottom_0);\n };\n PlotBuilder$MyPlot.prototype.hasLiveMap = function () {\n return this.hasLiveMap_0;\n };\n PlotBuilder$MyPlot.prototype.tileLayers_za3lpa$ = function (tileIndex) {\n return this.myLayersByTile_0.get_za3lpa$(tileIndex);\n };\n PlotBuilder$MyPlot.prototype.plotLayout = function () {\n return ensureNotNull(this.myLayout_0);\n };\n PlotBuilder$MyPlot.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyPlot',\n interfaces: [Plot]\n };\n PlotBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotBuilder',\n interfaces: []\n };\n function PlotContainerPortable(plot, preferredSize) {\n PlotContainerPortable$Companion_getInstance();\n this.plot = plot;\n this.preferredSize_sl52i3$_0 = preferredSize;\n this.svg = new SvgSvgElement();\n this.myContentBuilt_l8hvkk$_0 = false;\n this.myRegistrations_wwtuqx$_0 = new CompositeRegistration([]);\n this.svg.addClass_61zpoe$(Style_getInstance().PLOT_CONTAINER);\n this.setSvgSize_2l8z8v$_0(this.preferredSize_sl52i3$_0.get());\n this.plot.laidOutSize().addHandler_gxwwpc$(PlotContainerPortable$Companion_getInstance().sizePropHandler_0(PlotContainerPortable_init$lambda(this)));\n this.preferredSize_sl52i3$_0.addHandler_gxwwpc$(PlotContainerPortable$Companion_getInstance().sizePropHandler_0(PlotContainerPortable_init$lambda_0(this)));\n }\n Object.defineProperty(PlotContainerPortable.prototype, 'liveMapFigures', {\n configurable: true,\n get: function () {\n return this.plot.liveMapFigures_8be2vx$;\n }\n });\n Object.defineProperty(PlotContainerPortable.prototype, 'isLiveMap', {\n configurable: true,\n get: function () {\n return !this.plot.liveMapFigures_8be2vx$.isEmpty();\n }\n });\n PlotContainerPortable.prototype.ensureContentBuilt = function () {\n if (!this.myContentBuilt_l8hvkk$_0) {\n this.buildContent();\n }};\n PlotContainerPortable.prototype.revalidateContent_r8qzcp$_0 = function () {\n if (this.myContentBuilt_l8hvkk$_0) {\n this.clearContent();\n this.buildContent();\n }};\n function PlotContainerPortable$buildContent$ObjectLiteral() {\n }\n PlotContainerPortable$buildContent$ObjectLiteral.prototype.css = function () {\n return Style_getInstance().css;\n };\n PlotContainerPortable$buildContent$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [SvgCssResource]\n };\n PlotContainerPortable.prototype.buildContent = function () {\n if (!!this.myContentBuilt_l8hvkk$_0) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }this.myContentBuilt_l8hvkk$_0 = true;\n this.svg.setStyle_i8z0m3$(new PlotContainerPortable$buildContent$ObjectLiteral());\n var backdrop = new SvgRectElement();\n backdrop.addClass_61zpoe$(Style_getInstance().PLOT_BACKDROP);\n backdrop.setAttribute_jyasbz$('width', '100%');\n backdrop.setAttribute_jyasbz$('height', '100%');\n this.svg.children().add_11rb$(backdrop);\n this.plot.preferredSize_8be2vx$().set_11rb$(this.preferredSize_sl52i3$_0.get());\n this.svg.children().add_11rb$(this.plot.rootGroup);\n };\n PlotContainerPortable.prototype.clearContent = function () {\n if (this.myContentBuilt_l8hvkk$_0) {\n this.myContentBuilt_l8hvkk$_0 = false;\n this.svg.children().clear();\n this.plot.clear();\n this.myRegistrations_wwtuqx$_0.remove();\n this.myRegistrations_wwtuqx$_0 = new CompositeRegistration([]);\n }};\n PlotContainerPortable.prototype.reg_3xv6fb$ = function (registration) {\n this.myRegistrations_wwtuqx$_0.add_3xv6fb$(registration);\n };\n PlotContainerPortable.prototype.setSvgSize_2l8z8v$_0 = function (size) {\n this.svg.width().set_11rb$(size.x);\n this.svg.height().set_11rb$(size.y);\n };\n function PlotContainerPortable$Companion() {\n PlotContainerPortable$Companion_instance = this;\n }\n function PlotContainerPortable$Companion$sizePropHandler$ObjectLiteral(closure$block) {\n this.closure$block = closure$block;\n }\n PlotContainerPortable$Companion$sizePropHandler$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n var newValue = event.newValue;\n if (newValue != null) {\n this.closure$block(newValue);\n }};\n PlotContainerPortable$Companion$sizePropHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n PlotContainerPortable$Companion.prototype.sizePropHandler_0 = function (block) {\n return new PlotContainerPortable$Companion$sizePropHandler$ObjectLiteral(block);\n };\n PlotContainerPortable$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PlotContainerPortable$Companion_instance = null;\n function PlotContainerPortable$Companion_getInstance() {\n if (PlotContainerPortable$Companion_instance === null) {\n new PlotContainerPortable$Companion();\n }return PlotContainerPortable$Companion_instance;\n }\n function PlotContainerPortable_init$lambda(this$PlotContainerPortable) {\n return function (laidOutSize) {\n var a = this$PlotContainerPortable.preferredSize_sl52i3$_0.get().x;\n var b = laidOutSize.x;\n var tmp$ = JsMath.max(a, b);\n var a_0 = this$PlotContainerPortable.preferredSize_sl52i3$_0.get().y;\n var b_0 = laidOutSize.y;\n var newSvgSize = new DoubleVector(tmp$, JsMath.max(a_0, b_0));\n this$PlotContainerPortable.setSvgSize_2l8z8v$_0(newSvgSize);\n return Unit;\n };\n }\n function PlotContainerPortable_init$lambda_0(this$PlotContainerPortable) {\n return function (newPreferredSize) {\n if (newPreferredSize.x > 0 && newPreferredSize.y > 0) {\n this$PlotContainerPortable.revalidateContent_r8qzcp$_0();\n }return Unit;\n };\n }\n PlotContainerPortable.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotContainerPortable',\n interfaces: []\n };\n function PlotTile(layers, myScaleX, myScaleY, myTilesOrigin, myLayoutInfo, myCoord, myTheme) {\n SvgComponent.call(this);\n this.myScaleX_0 = myScaleX;\n this.myScaleY_0 = myScaleY;\n this.myTilesOrigin_0 = myTilesOrigin;\n this.myLayoutInfo_0 = myLayoutInfo;\n this.myCoord_0 = myCoord;\n this.myTheme_0 = myTheme;\n this.myDebugDrawing_0 = new ValueProperty(false);\n this.myLayers_0 = null;\n this.myTargetLocators_0 = ArrayList_init();\n this.myShowAxis_0 = false;\n this.liveMapFigure_y5x745$_0 = null;\n this.myLayers_0 = ArrayList_init_0(layers);\n this.moveTo_gpjtzr$(this.myLayoutInfo_0.getAbsoluteBounds_gpjtzr$(this.myTilesOrigin_0).origin);\n }\n Object.defineProperty(PlotTile.prototype, 'liveMapFigure', {\n configurable: true,\n get: function () {\n return this.liveMapFigure_y5x745$_0;\n },\n set: function (liveMapFigure) {\n this.liveMapFigure_y5x745$_0 = liveMapFigure;\n }\n });\n Object.defineProperty(PlotTile.prototype, 'targetLocators', {\n configurable: true,\n get: function () {\n return this.myTargetLocators_0;\n }\n });\n Object.defineProperty(PlotTile.prototype, 'isDebugDrawing_0', {\n configurable: true,\n get: function () {\n return this.myDebugDrawing_0.get();\n }\n });\n PlotTile.prototype.buildComponent = function () {\n var tmp$, tmp$_0, tmp$_1;\n var geomBounds = this.myLayoutInfo_0.geomBounds;\n if (this.myTheme_0.plot().showInnerFrame()) {\n var $receiver = SvgRectElement_init(geomBounds);\n $receiver.strokeColor().set_11rb$(this.myTheme_0.plot().innerFrameColor());\n $receiver.strokeWidth().set_11rb$(1.0);\n $receiver.fillOpacity().set_11rb$(0.0);\n var rect = $receiver;\n this.add_26jijc$(rect);\n }this.addFacetLabels_0(geomBounds, this.myTheme_0.facets());\n var $receiver_0 = this.myLayers_0;\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_2;\n tmp$_2 = $receiver_0.iterator();\n while (tmp$_2.hasNext()) {\n var element = tmp$_2.next();\n if (element.isLiveMap) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n var liveMapGeomLayer = firstOrNull$result;\n if (liveMapGeomLayer == null && this.myShowAxis_0) {\n this.addAxis_0(geomBounds);\n }if (this.isDebugDrawing_0) {\n var tileBounds = this.myLayoutInfo_0.bounds;\n var rect_0 = SvgRectElement_init(tileBounds);\n rect_0.fillColor().set_11rb$(Color.Companion.BLACK);\n rect_0.strokeWidth().set_11rb$(0.0);\n rect_0.fillOpacity().set_11rb$(0.1);\n this.add_26jijc$(rect_0);\n }if (this.isDebugDrawing_0) {\n var clipBounds = this.myLayoutInfo_0.clipBounds;\n var rect_1 = SvgRectElement_init(clipBounds);\n rect_1.fillColor().set_11rb$(Color.Companion.DARK_GREEN);\n rect_1.strokeWidth().set_11rb$(0.0);\n rect_1.fillOpacity().set_11rb$(0.3);\n this.add_26jijc$(rect_1);\n }if (this.isDebugDrawing_0) {\n var rect_2 = SvgRectElement_init(geomBounds);\n rect_2.fillColor().set_11rb$(Color.Companion.PINK);\n rect_2.strokeWidth().set_11rb$(1.0);\n rect_2.fillOpacity().set_11rb$(0.5);\n this.add_26jijc$(rect_2);\n }if (liveMapGeomLayer != null) {\n var realBounds = this.myLayoutInfo_0.getAbsoluteGeomBounds_gpjtzr$(this.myTilesOrigin_0);\n var liveMapData = createCanvasFigure(liveMapGeomLayer, realBounds);\n this.liveMapFigure = liveMapData.canvasFigure;\n this.myTargetLocators_0.add_11rb$(liveMapData.targetLocator);\n } else {\n var sharedNumericMappers = HashMap_init();\n var overallNumericDomains = HashMap_init();\n var xAxisInfo = this.myLayoutInfo_0.xAxisInfo;\n var yAxisInfo = this.myLayoutInfo_0.yAxisInfo;\n var mapperX = this.myScaleX_0.mapper;\n var mapperY = this.myScaleY_0.mapper;\n var key = Aes.Companion.X;\n sharedNumericMappers.put_xwzc9p$(key, mapperX);\n var key_0 = Aes.Companion.Y;\n sharedNumericMappers.put_xwzc9p$(key_0, mapperY);\n var key_1 = Aes.Companion.SLOPE;\n var value = scale.Mappers.mul_14dthe$(ensureNotNull(mapperY(1.0)) / ensureNotNull(mapperX(1.0)));\n sharedNumericMappers.put_xwzc9p$(key_1, value);\n var key_2 = Aes.Companion.X;\n var value_0 = ensureNotNull(ensureNotNull(xAxisInfo).axisDomain);\n overallNumericDomains.put_xwzc9p$(key_2, value_0);\n var key_3 = Aes.Companion.Y;\n var value_1 = ensureNotNull(ensureNotNull(yAxisInfo).axisDomain);\n overallNumericDomains.put_xwzc9p$(key_3, value_1);\n var geomLayerComponents = this.buildGeoms_0(sharedNumericMappers, overallNumericDomains, this.myCoord_0);\n tmp$ = geomLayerComponents.iterator();\n while (tmp$.hasNext()) {\n var layerComponent = tmp$.next();\n layerComponent.moveTo_gpjtzr$(geomBounds.origin);\n var xRange = (tmp$_0 = this.myCoord_0.xClientLimit) != null ? tmp$_0 : new ClosedRange(0.0, geomBounds.width);\n var yRange = (tmp$_1 = this.myCoord_0.yClientLimit) != null ? tmp$_1 : new ClosedRange(0.0, geomBounds.height);\n var clipRect = GeometryUtil_getInstance().doubleRange_gyv40k$(xRange, yRange);\n layerComponent.clipBounds_wthzt5$(clipRect);\n this.add_8icvvv$(layerComponent);\n }\n }\n };\n PlotTile.prototype.addFacetLabels_0 = function (geomBounds, theme) {\n var tmp$;\n var xLabels = this.myLayoutInfo_0.facetXLabels;\n if (!xLabels.isEmpty()) {\n var labelSize = FacetGridPlotLayout$Companion_getInstance().facetColLabelSize_14dthe$(geomBounds.width);\n var labelOrig = new DoubleVector(geomBounds.left + 0, geomBounds.top - FacetGridPlotLayout$Companion_getInstance().facetColHeadHeight_za3lpa$(xLabels.size) + 6);\n var labelBounds = new DoubleRectangle(labelOrig, labelSize);\n tmp$ = xLabels.iterator();\n while (tmp$.hasNext()) {\n var xLabel = tmp$.next();\n var $receiver = SvgRectElement_init(labelBounds);\n $receiver.strokeWidth().set_11rb$(0.0);\n $receiver.fillColor().set_11rb$(theme.labelBackground());\n var rect = $receiver;\n this.add_26jijc$(rect);\n var x = labelBounds.center.x;\n var y = labelBounds.center.y;\n var lab = new TextLabel(xLabel);\n lab.moveTo_lu1900$(x, y);\n lab.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE);\n lab.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.CENTER);\n this.add_8icvvv$(lab);\n labelBounds = labelBounds.add_gpjtzr$(new DoubleVector(0.0, labelSize.y));\n }\n }if (this.myLayoutInfo_0.facetYLabel != null) {\n var hPad = 6;\n var vPad = 0;\n var labelBounds_0 = DoubleRectangle_init(geomBounds.right + hPad, geomBounds.top - vPad, FacetGridPlotLayout$Companion_getInstance().FACET_TAB_HEIGHT - (hPad * 2 | 0), geomBounds.height - (vPad * 2 | 0));\n var rect_0 = SvgRectElement_init(labelBounds_0);\n rect_0.strokeWidth().set_11rb$(0.0);\n rect_0.fillColor().set_11rb$(theme.labelBackground());\n this.add_26jijc$(rect_0);\n var x_0 = labelBounds_0.center.x;\n var y_0 = labelBounds_0.center.y;\n var lab_0 = new TextLabel(this.myLayoutInfo_0.facetYLabel);\n lab_0.moveTo_lu1900$(x_0, y_0);\n lab_0.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE);\n lab_0.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.CENTER);\n lab_0.rotate_14dthe$(90.0);\n this.add_8icvvv$(lab_0);\n }};\n PlotTile.prototype.addAxis_0 = function (geomBounds) {\n if (this.myLayoutInfo_0.xAxisShown) {\n var axis = this.buildAxis_0(this.myScaleX_0, ensureNotNull(this.myLayoutInfo_0.xAxisInfo), this.myCoord_0, this.myTheme_0.axisX());\n axis.moveTo_gpjtzr$(new DoubleVector(geomBounds.left, geomBounds.bottom));\n this.add_8icvvv$(axis);\n }if (this.myLayoutInfo_0.yAxisShown) {\n var axis_0 = this.buildAxis_0(this.myScaleY_0, ensureNotNull(this.myLayoutInfo_0.yAxisInfo), this.myCoord_0, this.myTheme_0.axisY());\n axis_0.moveTo_gpjtzr$(geomBounds.origin);\n this.add_8icvvv$(axis_0);\n }};\n PlotTile.prototype.buildAxis_0 = function (scale, info, coord, theme) {\n var axis = new AxisComponent(info.axisLength, ensureNotNull(info.orientation));\n AxisUtil_getInstance().setBreaks_6e5l22$(axis, scale, coord, info.orientation.isHorizontal);\n AxisUtil_getInstance().applyLayoutInfo_4pg061$(axis, info);\n AxisUtil_getInstance().applyTheme_tna4q5$(axis, theme);\n if (this.isDebugDrawing_0) {\n if (info.tickLabelsBounds != null) {\n var rect = SvgRectElement_init(info.tickLabelsBounds);\n rect.strokeColor().set_11rb$(Color.Companion.GREEN);\n rect.strokeWidth().set_11rb$(1.0);\n rect.fillOpacity().set_11rb$(0.0);\n axis.add_26jijc$(rect);\n }}return axis;\n };\n PlotTile.prototype.buildGeoms_0 = function (sharedNumericMappers, overallNumericDomains, coord) {\n var tmp$;\n var layerRenderers = ArrayList_init();\n tmp$ = this.myLayers_0.iterator();\n while (tmp$.hasNext()) {\n var layer = tmp$.next();\n var rendererData = LayerRendererUtil_getInstance().createLayerRendererData_knseyn$(layer, sharedNumericMappers, overallNumericDomains);\n var aestheticMappers = rendererData.aestheticMappers;\n var aesthetics = rendererData.aesthetics;\n var targetCollector = new LayerTargetCollectorWithLocator(layer.geomKind, layer.locatorLookupSpec, layer.contextualMapping, coord);\n this.myTargetLocators_0.add_11rb$(targetCollector);\n var ctx = GeomContextBuilder_init().aesthetics_luqwb2$(aesthetics).aestheticMappers_4iu3o$(aestheticMappers).geomTargetCollector_xrq6q$(targetCollector).build();\n var pos = rendererData.pos;\n var geom = layer.geom;\n layerRenderers.add_11rb$(new SvgLayerRenderer(aesthetics, geom, pos, coord, ctx));\n }\n return layerRenderers;\n };\n PlotTile.prototype.setShowAxis_6taknv$ = function (showAxis) {\n this.myShowAxis_0 = showAxis;\n };\n PlotTile.prototype.debugDrawing = function () {\n return this.myDebugDrawing_0;\n };\n PlotTile.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotTile',\n interfaces: [SvgComponent]\n };\n function createCanvasFigure($receiver, bounds) {\n var tmp$;\n return (Kotlin.isType(tmp$ = $receiver.geom, LiveMapGeom) ? tmp$ : throwCCE()).createCanvasFigure_wthzt5$(bounds);\n }\n function PlotTooltipHelper() {\n this.myTileInfos_0 = ArrayList_init();\n }\n PlotTooltipHelper.prototype.removeAllTileInfos = function () {\n this.myTileInfos_0.clear();\n };\n PlotTooltipHelper.prototype.addTileInfo_t6qbjr$ = function (geomBounds, targetLocators) {\n var tileInfo = new PlotTooltipHelper$TileInfo(geomBounds, targetLocators);\n this.myTileInfos_0.add_11rb$(tileInfo);\n };\n PlotTooltipHelper.prototype.createTooltipSpecs_gpjtzr$ = function (plotCoord) {\n var tmp$;\n tmp$ = this.findTileInfo_0(plotCoord);\n if (tmp$ == null) {\n return emptyList();\n }var tileInfo = tmp$;\n var lookupResults = tileInfo.findTargets_xoefl8$(plotCoord);\n return this.createTooltipSpecs_0(lookupResults, tileInfo.axisOrigin_8be2vx$);\n };\n PlotTooltipHelper.prototype.getGeomBounds_gpjtzr$ = function (plotCoord) {\n var tmp$;\n tmp$ = this.findTileInfo_0(plotCoord);\n if (tmp$ == null) {\n return null;\n }var tileInfo = tmp$;\n return tileInfo.geomBounds_8be2vx$;\n };\n PlotTooltipHelper.prototype.findTileInfo_0 = function (plotCoord) {\n var tmp$;\n tmp$ = this.myTileInfos_0.iterator();\n while (tmp$.hasNext()) {\n var tileInfo = tmp$.next();\n if (tileInfo.contains_xoefl8$(plotCoord)) {\n return tileInfo;\n }}\n return null;\n };\n PlotTooltipHelper.prototype.createTooltipSpecs_0 = function (lookupResults, axisOrigin) {\n var tooltipSpecs = ArrayList_init();\n var tmp$;\n tmp$ = lookupResults.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var factory = new TooltipSpecFactory(element.contextualMapping, axisOrigin);\n var tmp$_0;\n tmp$_0 = element.targets.iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n tooltipSpecs.addAll_brywnq$(factory.create_62opr5$(element_0));\n }\n }\n return tooltipSpecs;\n };\n function PlotTooltipHelper$TileInfo(geomBounds, targetLocators) {\n this.geomBounds_8be2vx$ = geomBounds;\n var destination = ArrayList_init_1(collectionSizeOrDefault(targetLocators, 10));\n var tmp$;\n tmp$ = targetLocators.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(new PlotTooltipHelper$TileInfo$TileTargetLocator(this, item));\n }\n this.myTargetLocators_0 = destination;\n }\n Object.defineProperty(PlotTooltipHelper$TileInfo.prototype, 'axisOrigin_8be2vx$', {\n configurable: true,\n get: function () {\n return new DoubleVector(this.geomBounds_8be2vx$.left, this.geomBounds_8be2vx$.bottom);\n }\n });\n PlotTooltipHelper$TileInfo.prototype.findTargets_xoefl8$ = function (plotCoord) {\n var $receiver = new LocatedTargetsPicker();\n var tmp$;\n tmp$ = this.myTargetLocators_0.iterator();\n while (tmp$.hasNext()) {\n var locator = tmp$.next();\n var result = locator.search_gpjtzr$(plotCoord);\n if (result != null) {\n $receiver.addLookupResult_9sakjw$(result, plotCoord);\n }}\n var targetsPicker = $receiver;\n return targetsPicker.picked;\n };\n PlotTooltipHelper$TileInfo.prototype.contains_xoefl8$ = function (plotCoord) {\n return this.geomBounds_8be2vx$.contains_gpjtzr$(plotCoord);\n };\n function PlotTooltipHelper$TileInfo$TileTargetLocator($outer, locator) {\n this.$outer = $outer;\n TransformedTargetLocator.call(this, locator);\n }\n PlotTooltipHelper$TileInfo$TileTargetLocator.prototype.convertToTargetCoord_gpjtzr$ = function (coord) {\n return coord.subtract_gpjtzr$(this.$outer.geomBounds_8be2vx$.origin);\n };\n PlotTooltipHelper$TileInfo$TileTargetLocator.prototype.convertToPlotCoord_gpjtzr$ = function (coord) {\n return coord.add_gpjtzr$(this.$outer.geomBounds_8be2vx$.origin);\n };\n PlotTooltipHelper$TileInfo$TileTargetLocator.prototype.convertToPlotDistance_14dthe$ = function (distance) {\n return distance;\n };\n PlotTooltipHelper$TileInfo$TileTargetLocator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TileTargetLocator',\n interfaces: [TransformedTargetLocator]\n };\n PlotTooltipHelper$TileInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TileInfo',\n interfaces: []\n };\n PlotTooltipHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotTooltipHelper',\n interfaces: []\n };\n function PlotUtil() {\n PlotUtil_instance = this;\n }\n function PlotUtil$createLayerPos$ObjectLiteral(closure$aes) {\n this.closure$aes = closure$aes;\n this.groupCount_uijr2l$_0 = lazy(PlotUtil$createLayerPos$ObjectLiteral$groupCount$lambda(closure$aes));\n }\n Object.defineProperty(PlotUtil$createLayerPos$ObjectLiteral.prototype, 'aesthetics', {\n configurable: true,\n get: function () {\n return this.closure$aes;\n }\n });\n Object.defineProperty(PlotUtil$createLayerPos$ObjectLiteral.prototype, 'groupCount', {\n configurable: true,\n get: function () {\n return this.groupCount_uijr2l$_0.value;\n }\n });\n function PlotUtil$createLayerPos$ObjectLiteral$groupCount$lambda(closure$aes) {\n return function () {\n var set = collect.Sets.newHashSet_yl67zr$(closure$aes.groups());\n return set.size;\n };\n }\n PlotUtil$createLayerPos$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProviderContext]\n };\n PlotUtil.prototype.createLayerPos_2iooof$ = function (layer, aes) {\n return layer.createPos_q7kk9g$(new PlotUtil$createLayerPos$ObjectLiteral(aes));\n };\n PlotUtil.prototype.computeLayerDryRunXYRanges_gl53zg$ = function (layer, aes) {\n var geomCtx = GeomContextBuilder_init().aesthetics_luqwb2$(aes).build();\n var rangesAfterPosAdjustment = this.computeLayerDryRunXYRangesAfterPosAdjustment_0(layer, aes, geomCtx);\n var tmp$ = this.computeLayerDryRunXYRangesAfterSizeExpand_0(layer, aes, geomCtx);\n var xRangeAfterSizeExpand = tmp$.component1()\n , yRangeAfterSizeExpand = tmp$.component2();\n var rangeX = rangesAfterPosAdjustment.first;\n if (rangeX == null) {\n rangeX = xRangeAfterSizeExpand;\n } else if (xRangeAfterSizeExpand != null) {\n rangeX = rangeX.span_d226ot$(xRangeAfterSizeExpand);\n }var rangeY = rangesAfterPosAdjustment.second;\n if (rangeY == null) {\n rangeY = yRangeAfterSizeExpand;\n } else if (yRangeAfterSizeExpand != null) {\n rangeY = rangeY.span_d226ot$(yRangeAfterSizeExpand);\n }return new Pair(rangeX, rangeY);\n };\n PlotUtil.prototype.combineRanges_0 = function (aesList, aesthetics) {\n var tmp$, tmp$_0;\n var result = null;\n tmp$ = aesList.iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n var range = aesthetics.range_vktour$(aes);\n if (range != null) {\n result = (tmp$_0 = result != null ? result.span_d226ot$(range) : null) != null ? tmp$_0 : range;\n }}\n return result;\n };\n PlotUtil.prototype.computeLayerDryRunXYRangesAfterPosAdjustment_0 = function (layer, aes, geomCtx) {\n var tmp$, tmp$_0, tmp$_1;\n var posAesX = collect.Iterables.toList_yl67zr$(Aes.Companion.affectingScaleX_shhb9a$(layer.renderedAes()));\n var posAesY = collect.Iterables.toList_yl67zr$(Aes.Companion.affectingScaleY_shhb9a$(layer.renderedAes()));\n var pos = this.createLayerPos_2iooof$(layer, aes);\n if (pos.isIdentity) {\n var rangeX = this.combineRanges_0(posAesX, aes);\n var rangeY = this.combineRanges_0(posAesY, aes);\n return new Pair(rangeX, rangeY);\n }var adjustedMinX = 0.0;\n var adjustedMaxX = 0.0;\n var adjustedMinY = 0.0;\n var adjustedMaxY = 0.0;\n var rangesInited = false;\n var cardinality = Kotlin.imul(posAesX.size, posAesY.size);\n var px = Kotlin.newArray(cardinality, null);\n var py = Kotlin.newArray(cardinality, null);\n tmp$ = aes.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var i = -1;\n tmp$_0 = posAesX.iterator();\n while (tmp$_0.hasNext()) {\n var aesX = tmp$_0.next();\n var valX = p.numeric_vktour$(aesX);\n tmp$_1 = posAesY.iterator();\n while (tmp$_1.hasNext()) {\n var aesY = tmp$_1.next();\n var valY = p.numeric_vktour$(aesY);\n i = i + 1 | 0;\n px[i] = valX;\n py[i] = valY;\n }\n }\n while (i >= 0) {\n if (px[i] != null && py[i] != null) {\n var x = px[i];\n var y = py[i];\n if (data_0.SeriesUtil.isFinite_yrwdxb$(x) && data_0.SeriesUtil.isFinite_yrwdxb$(y)) {\n var newLoc = pos.translate_tshsjz$(new DoubleVector(ensureNotNull(x), ensureNotNull(y)), p, geomCtx);\n var adjustedX = newLoc.x;\n var adjustedY = newLoc.y;\n if (rangesInited) {\n var b = adjustedMinX;\n adjustedMinX = JsMath.min(adjustedX, b);\n var b_0 = adjustedMaxX;\n adjustedMaxX = JsMath.max(adjustedX, b_0);\n var b_1 = adjustedMinY;\n adjustedMinY = JsMath.min(adjustedY, b_1);\n var b_2 = adjustedMaxY;\n adjustedMaxY = JsMath.max(adjustedY, b_2);\n } else {\n adjustedMaxX = adjustedX;\n adjustedMinX = adjustedMaxX;\n adjustedMaxY = adjustedY;\n adjustedMinY = adjustedMaxY;\n rangesInited = true;\n }\n }}i = i - 1 | 0;\n }\n }\n var xRange = rangesInited ? new ClosedRange(adjustedMinX, adjustedMaxX) : null;\n var yRange = rangesInited ? new ClosedRange(adjustedMinY, adjustedMaxY) : null;\n return new Pair(xRange, yRange);\n };\n PlotUtil.prototype.computeLayerDryRunXYRangesAfterSizeExpand_0 = function (layer, aesthetics, geomCtx) {\n var renderedAes = layer.renderedAes();\n var computeExpandX = renderedAes.contains_11rb$(Aes.Companion.WIDTH);\n var computeExpandY = renderedAes.contains_11rb$(Aes.Companion.HEIGHT);\n var rangeX = computeExpandX ? this.computeLayerDryRunRangeAfterSizeExpand_0(Aes.Companion.X, Aes.Companion.WIDTH, aesthetics, geomCtx) : null;\n var rangeY = computeExpandY ? this.computeLayerDryRunRangeAfterSizeExpand_0(Aes.Companion.Y, Aes.Companion.HEIGHT, aesthetics, geomCtx) : null;\n return new Pair(rangeX, rangeY);\n };\n PlotUtil.prototype.computeLayerDryRunRangeAfterSizeExpand_0 = function (locationAes, sizeAes, aesthetics, geomCtx) {\n var tmp$;\n var locations = aesthetics.numericValues_vktour$(locationAes).iterator();\n var sizes = aesthetics.numericValues_vktour$(sizeAes).iterator();\n var resolution = geomCtx.getResolution_vktour$(locationAes);\n var minMax = new Float64Array([kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY, kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY]);\n tmp$ = aesthetics.dataPointCount();\n for (var i = 0; i < tmp$; i++) {\n if (!locations.hasNext()) {\n throw IllegalStateException_init('Index is out of bounds: ' + i + ' for ' + locationAes);\n }if (!sizes.hasNext()) {\n throw IllegalStateException_init('Index is out of bounds: ' + i + ' for ' + sizeAes);\n }var loc = locations.next();\n var size = sizes.next();\n if (data_0.SeriesUtil.isFinite_yrwdxb$(loc) && data_0.SeriesUtil.isFinite_yrwdxb$(size)) {\n var expand = resolution * (ensureNotNull(size) / 2);\n this.updateExpandedMinMax_0(ensureNotNull(loc), expand, minMax);\n }}\n return minMax[0] <= minMax[1] ? new ClosedRange(minMax[0], minMax[1]) : null;\n };\n PlotUtil.prototype.updateExpandedMinMax_0 = function (value, expand, expandedMinMax) {\n var a = value - expand;\n var b = expandedMinMax[0];\n expandedMinMax[0] = JsMath.min(a, b);\n var a_0 = value + expand;\n var b_0 = expandedMinMax[1];\n expandedMinMax[1] = JsMath.max(a_0, b_0);\n };\n PlotUtil.prototype.createLayerDryRunAesthetics_sqg2xh$ = function (layer) {\n var tmp$, tmp$_0, tmp$_1;\n var dryRunMapperByAes = HashMap_init();\n tmp$ = layer.renderedAes().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n if (aes.isNumeric) {\n tmp$_1 = Kotlin.isType(tmp$_0 = aes, Aes) ? tmp$_0 : throwCCE();\n var value = scale.Mappers.IDENTITY;\n dryRunMapperByAes.put_xwzc9p$(tmp$_1, value);\n }}\n var mappers = this.prepareLayerAestheticMappers_viiuew$(layer, dryRunMapperByAes);\n return this.createLayerAesthetics_kpf4gp$(layer, mappers, emptyMap());\n };\n PlotUtil.prototype.prepareLayerAestheticMappers_viiuew$ = function (layer, sharedNumericMappers) {\n var tmp$;\n var mappers = HashMap_init_0(sharedNumericMappers);\n tmp$ = layer.renderedAes().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n var tmp$_0;\n var mapper = (Kotlin.isType(tmp$_0 = sharedNumericMappers, Map) ? tmp$_0 : throwCCE()).get_11rb$(aes);\n if (mapper == null) {\n if (Aes.Companion.isPositionalX_896ixz$(aes)) {\n mapper = sharedNumericMappers.get_11rb$(Aes.Companion.X);\n } else if (Aes.Companion.isPositionalY_896ixz$(aes)) {\n mapper = sharedNumericMappers.get_11rb$(Aes.Companion.Y);\n }}if (mapper == null && layer.hasBinding_896ixz$(aes)) {\n mapper = layer.scaleMap.get_31786j$(aes).mapper;\n }if (mapper != null) {\n var value = mapper;\n mappers.put_xwzc9p$(aes, value);\n }}\n return mappers;\n };\n PlotUtil.prototype.createLayerAesthetics_kpf4gp$ = function (layer, sharedMappers, overallNumericDomains) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3;\n var aesBuilder = new AestheticsBuilder();\n aesBuilder.group_ddsh32$(layer.group);\n tmp$ = overallNumericDomains.entries.iterator();\n while (tmp$.hasNext()) {\n var tmp$_4 = tmp$.next();\n var aes = tmp$_4.key;\n var domain = tmp$_4.value;\n if ((tmp$_0 = sharedMappers.get_11rb$(aes)) != null) {\n var tmp$_5, tmp$_6;\n var range = new ClosedRange(typeof (tmp$_5 = tmp$_0(domain.lowerEnd)) === 'number' ? tmp$_5 : throwCCE(), typeof (tmp$_6 = tmp$_0(domain.upperEnd)) === 'number' ? tmp$_6 : throwCCE());\n aesBuilder.overallRange_xlyz3f$(aes, range);\n }}\n var hasPositionalConstants = false;\n tmp$_1 = layer.renderedAes().iterator();\n while (tmp$_1.hasNext()) {\n var aes_0 = tmp$_1.next();\n if (Aes.Companion.isPositional_896ixz$(aes_0) && layer.hasConstant_896ixz$(aes_0)) {\n hasPositionalConstants = true;\n break;\n }}\n var data_0 = layer.dataFrame;\n var dataPointCount = {v: null};\n tmp$_2 = layer.renderedAes().iterator();\n while (tmp$_2.hasNext()) {\n var aes_1 = tmp$_2.next();\n var aes_2 = Kotlin.isType(tmp$_3 = aes_1, Aes) ? tmp$_3 : throwCCE();\n var mapperOption = sharedMappers.get_11rb$(aes_2);\n if (layer.hasConstant_896ixz$(aes_2)) {\n var v = layer.getConstant_31786j$(aes_2);\n aesBuilder.constantAes_bbdhip$(aes_2, this.asAesValue_0(aes_2, v, mapperOption));\n } else {\n if (layer.hasBinding_896ixz$(aes_2)) {\n if (!(mapperOption != null)) {\n var message = 'No scale mapper defined for aesthetic ' + aes_2;\n throw IllegalStateException_init(message.toString());\n }var transformVar = data.DataFrameUtil.transformVarFor_896ixz$(aes_2);\n if (!data_0.has_8xm3sj$(transformVar)) {\n var message_0 = 'Undefined var ' + transformVar + ' for aesthetic ' + aes_2;\n throw IllegalStateException_init(message_0.toString());\n }var numericValues = data_0.getNumeric_8xm3sj$(transformVar);\n if (dataPointCount.v == null) {\n dataPointCount.v = numericValues.size;\n } else {\n if (!(dataPointCount.v === numericValues.size)) {\n var message_1 = '' + toString(aes_2) + ' expected data size=' + toString(dataPointCount.v) + ' was size=' + toString(numericValues.size);\n throw IllegalStateException_init(message_1.toString());\n }}\n if (dataPointCount.v === 0 && hasPositionalConstants) {\n aesBuilder.constantAes_bbdhip$(aes_2, layer.aestheticsDefaults.defaultValue_31786j$(aes_2));\n } else {\n var integerFunction = AestheticsBuilder.Companion.listMapper_sedzz5$(numericValues, mapperOption);\n aesBuilder.aes_u42xfl$(aes_2, integerFunction);\n }\n } else {\n var v_0 = layer.getDefault_31786j$(aes_2);\n aesBuilder.constantAes_bbdhip$(aes_2, this.asAesValue_0(aes_2, v_0, mapperOption));\n }\n }\n }\n if (dataPointCount.v != null && dataPointCount.v > 0) {\n aesBuilder.dataPointCount_za3lpa$(dataPointCount.v);\n } else if (hasPositionalConstants) {\n aesBuilder.dataPointCount_za3lpa$(1);\n }return aesBuilder.build();\n };\n PlotUtil.prototype.asAesValue_0 = function (aes, dataValue, mapperOption) {\n var tmp$, tmp$_0, tmp$_1;\n if (aes.isNumeric && mapperOption != null) {\n tmp$_0 = mapperOption(typeof (tmp$ = dataValue) === 'number' ? tmp$ : null);\n if (tmp$_0 == null) {\n throw IllegalArgumentException_init(\"Can't map \" + dataValue + ' to aesthetic ' + aes);\n }tmp$_1 = tmp$_0;\n } else\n tmp$_1 = dataValue;\n return tmp$_1;\n };\n PlotUtil.prototype.rangeWithExpand_cmjc6r$ = function (layer, aes, range) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (range == null)\n return null;\n var scale = layer.scaleMap.get_31786j$(aes);\n var mulExp = scale.multiplicativeExpand;\n var addExp = scale.additiveExpand;\n if (scale.isContinuousDomain) {\n tmp$_0 = Kotlin.isType(tmp$ = scale.transform, ContinuousTransform) ? tmp$ : throwCCE();\n } else {\n tmp$_0 = null;\n }\n var continuousTransform = tmp$_0;\n var lowerEndpoint = (tmp$_1 = continuousTransform != null ? continuousTransform.applyInverse_yrwdxb$(range.lowerEnd) : null) != null ? tmp$_1 : range.lowerEnd;\n var upperEndpoint = (tmp$_2 = continuousTransform != null ? continuousTransform.applyInverse_yrwdxb$(range.upperEnd) : null) != null ? tmp$_2 : range.upperEnd;\n var length = upperEndpoint - lowerEndpoint;\n var lowerExpand = addExp + length * mulExp;\n var upperExpand = lowerExpand;\n if (layer.rangeIncludesZero_896ixz$(aes)) {\n var tmp$_3 = lowerEndpoint === 0.0 || upperEndpoint === 0.0;\n if (!tmp$_3) {\n tmp$_3 = JsMath.sign(lowerEndpoint) === JsMath.sign(upperEndpoint);\n }if (tmp$_3) {\n if (lowerEndpoint >= 0) {\n lowerExpand = 0.0;\n } else {\n upperExpand = 0.0;\n }\n }}var it = lowerEndpoint - lowerExpand;\n var block$result;\n var tmp$_4;\n var transformed = (tmp$_4 = continuousTransform != null ? continuousTransform.apply_yrwdxb$(it) : null) != null ? tmp$_4 : it;\n if (isNaN_0(transformed)) {\n block$result = range.lowerEnd;\n } else {\n block$result = transformed;\n }\n var lowerEndWithExpand = block$result;\n var it_0 = upperEndpoint + upperExpand;\n var block$result_0;\n var tmp$_5;\n var transformed_0 = (tmp$_5 = continuousTransform != null ? continuousTransform.apply_yrwdxb$(it_0) : null) != null ? tmp$_5 : it_0;\n if (isNaN_0(transformed_0)) {\n block$result_0 = range.upperEnd;\n } else {\n block$result_0 = transformed_0;\n }\n var upperEndWithExpand = block$result_0;\n return new ClosedRange(lowerEndWithExpand, upperEndWithExpand);\n };\n PlotUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PlotUtil',\n interfaces: []\n };\n var PlotUtil_instance = null;\n function PlotUtil_getInstance() {\n if (PlotUtil_instance === null) {\n new PlotUtil();\n }return PlotUtil_instance;\n }\n function PosProviderContext() {\n }\n PosProviderContext.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PosProviderContext',\n interfaces: []\n };\n function SvgLayerRenderer(myAesthetics, myGeom, myPos, myCoord, myGeomContext) {\n SvgComponent.call(this);\n this.myAesthetics_0 = myAesthetics;\n this.myGeom_0 = myGeom;\n this.myPos_0 = myPos;\n this.myCoord_0 = myCoord;\n this.myGeomContext_0 = myGeomContext;\n }\n SvgLayerRenderer.prototype.buildComponent = function () {\n this.buildLayer_0();\n };\n SvgLayerRenderer.prototype.buildLayer_0 = function () {\n this.myGeom_0.build_uzv8ab$(this, this.myAesthetics_0, this.myPos_0, this.myCoord_0, this.myGeomContext_0);\n };\n SvgLayerRenderer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SvgLayerRenderer',\n interfaces: [SvgRoot, SvgComponent]\n };\n function VarBinding(variable, aes) {\n this.variable = variable;\n this.aes = aes;\n }\n VarBinding.prototype.toString = function () {\n return 'VarBinding{variable=' + this.variable + ', aes=' + this.aes;\n };\n VarBinding.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, VarBinding) ? tmp$_0 : throwCCE();\n if (!equals(this.variable, other.variable))\n return false;\n if (!equals(this.aes, other.aes))\n return false;\n return true;\n };\n VarBinding.prototype.hashCode = function () {\n var result = hashCode(this.variable);\n result = (31 * result | 0) + hashCode(this.aes) | 0;\n return result;\n };\n VarBinding.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VarBinding',\n interfaces: []\n };\n function ColorBarAssembler(legendTitle, domain, scale, theme) {\n ColorBarAssembler$Companion_getInstance();\n this.legendTitle_0 = legendTitle;\n this.domain_0 = domain;\n this.scale_0 = scale;\n this.theme_0 = theme;\n this.colorBarOptions_0 = null;\n }\n function ColorBarAssembler$createColorBar$ObjectLiteral(closure$spec, size) {\n this.closure$spec = closure$spec;\n LegendBoxInfo.call(this, size);\n }\n ColorBarAssembler$createColorBar$ObjectLiteral.prototype.createLegendBox = function () {\n var c = new ColorBarComponent(this.closure$spec);\n c.debug = ColorBarAssembler$Companion_getInstance().DEBUG_DRAWING_0;\n return c;\n };\n ColorBarAssembler$createColorBar$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [LegendBoxInfo]\n };\n ColorBarAssembler.prototype.createColorBar = function () {\n var tmp$;\n var scale_0 = this.scale_0;\n if (!scale_0.hasBreaks()) {\n scale_0 = breaks.ScaleBreaksUtil.withBreaks_qt1l9m$(scale_0, this.domain_0, 5);\n }var guideBreaks = ArrayList_init();\n var breaks_0 = scale.ScaleUtil.breaksTransformed_x4zrm4$(scale_0);\n var label = scale.ScaleUtil.labels_x4zrm4$(scale_0).iterator();\n tmp$ = breaks_0.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n guideBreaks.add_11rb$(new GuideBreak(v, label.next()));\n }\n if (guideBreaks.isEmpty()) {\n return LegendBoxInfo$Companion_getInstance().EMPTY;\n }var spec = ColorBarAssembler$Companion_getInstance().createColorBarSpec_9i99xq$(this.legendTitle_0, this.domain_0, guideBreaks, scale_0, this.theme_0, this.colorBarOptions_0);\n return new ColorBarAssembler$createColorBar$ObjectLiteral(spec, spec.size);\n };\n ColorBarAssembler.prototype.setOptions_p8ufd2$ = function (options) {\n this.colorBarOptions_0 = options;\n };\n function ColorBarAssembler$Companion() {\n ColorBarAssembler$Companion_instance = this;\n this.DEBUG_DRAWING_0 = FeatureSwitch_getInstance().LEGEND_DEBUG_DRAWING;\n }\n ColorBarAssembler$Companion.prototype.createColorBarSpec_9i99xq$ = function (title, domain, breaks, scale, theme, options) {\n if (options === void 0)\n options = null;\n var tmp$, tmp$_0;\n var legendDirection = LegendAssemblerUtil_getInstance().legendDirection_730mk3$(theme);\n var horizontal = legendDirection === LegendDirection$HORIZONTAL_getInstance();\n var width = options != null ? options.width : null;\n var height = options != null ? options.height : null;\n var barSize = ColorBarComponentSpec$Companion_getInstance().barAbsoluteSize_kkcal5$(horizontal, theme);\n if (width != null) {\n barSize = new DoubleVector(width, barSize.y);\n }if (height != null) {\n barSize = new DoubleVector(barSize.x, height);\n }var reverse = !horizontal;\n if (horizontal)\n tmp$ = ColorBarComponentLayout$Companion_getInstance().horizontal_v3yhow$(title, domain, breaks, barSize, reverse);\n else\n tmp$ = ColorBarComponentLayout$Companion_getInstance().vertical_v3yhow$(title, domain, breaks, barSize, reverse);\n var layout = tmp$;\n return new ColorBarComponentSpec(title, domain, breaks, scale, (tmp$_0 = options != null ? options.binCount : null) != null ? tmp$_0 : 20, theme, layout, reverse);\n };\n ColorBarAssembler$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorBarAssembler$Companion_instance = null;\n function ColorBarAssembler$Companion_getInstance() {\n if (ColorBarAssembler$Companion_instance === null) {\n new ColorBarAssembler$Companion();\n }return ColorBarAssembler$Companion_instance;\n }\n ColorBarAssembler.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBarAssembler',\n interfaces: []\n };\n function ColorBarOptions() {\n GuideOptions.call(this);\n this.width = null;\n this.height = null;\n this.binCount = null;\n }\n ColorBarOptions.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBarOptions',\n interfaces: [GuideOptions]\n };\n function GeomContextBuilder() {\n this.myAesthetics_0 = null;\n this.myAestheticMappers_0 = null;\n this.myGeomTargetCollector_0 = new NullGeomTargetCollector();\n }\n GeomContextBuilder.prototype.aesthetics_luqwb2$ = function (aesthetics) {\n this.myAesthetics_0 = aesthetics;\n return this;\n };\n GeomContextBuilder.prototype.aestheticMappers_4iu3o$ = function (aestheticMappers) {\n this.myAestheticMappers_0 = aestheticMappers;\n return this;\n };\n GeomContextBuilder.prototype.geomTargetCollector_xrq6q$ = function (geomTargetCollector) {\n this.myGeomTargetCollector_0 = geomTargetCollector;\n return this;\n };\n GeomContextBuilder.prototype.build = function () {\n return new GeomContextBuilder$MyGeomContext(this);\n };\n function GeomContextBuilder$MyGeomContext(b) {\n this.myAesthetics = b.myAesthetics_0;\n this.myAestheticMappers = b.myAestheticMappers_0;\n this.targetCollector_2hnek9$_0 = b.myGeomTargetCollector_0;\n }\n Object.defineProperty(GeomContextBuilder$MyGeomContext.prototype, 'targetCollector', {\n configurable: true,\n get: function () {\n return this.targetCollector_2hnek9$_0;\n }\n });\n GeomContextBuilder$MyGeomContext.prototype.getResolution_vktour$ = function (aes) {\n var resolution = 0.0;\n if (this.myAesthetics != null) {\n resolution = this.myAesthetics.resolution_594811$(aes, 0.0);\n }if (resolution <= data_0.SeriesUtil.TINY) {\n resolution = this.getUnitResolution_vktour$(aes);\n }return resolution;\n };\n GeomContextBuilder$MyGeomContext.prototype.getUnitResolution_vktour$ = function (aes) {\n var tmp$, tmp$_0, tmp$_1;\n var mapper = (tmp$_0 = (tmp$ = this.myAestheticMappers) != null ? tmp$.get_11rb$(aes) : null) != null ? tmp$_0 : scale.Mappers.IDENTITY;\n return typeof (tmp$_1 = mapper(1.0)) === 'number' ? tmp$_1 : throwCCE();\n };\n GeomContextBuilder$MyGeomContext.prototype.withTargetCollector_xrq6q$ = function (targetCollector) {\n return GeomContextBuilder_init().aesthetics_luqwb2$(this.myAesthetics).aestheticMappers_4iu3o$(this.myAestheticMappers).geomTargetCollector_xrq6q$(targetCollector).build();\n };\n GeomContextBuilder$MyGeomContext.prototype.with = function () {\n return GeomContextBuilder_init_0(this);\n };\n GeomContextBuilder$MyGeomContext.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyGeomContext',\n interfaces: [ImmutableGeomContext]\n };\n GeomContextBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomContextBuilder',\n interfaces: [ImmutableGeomContext$Builder]\n };\n function GeomContextBuilder_init($this) {\n $this = $this || Object.create(GeomContextBuilder.prototype);\n GeomContextBuilder.call($this);\n return $this;\n }\n function GeomContextBuilder_init_0(ctx, $this) {\n $this = $this || Object.create(GeomContextBuilder.prototype);\n GeomContextBuilder.call($this);\n $this.myAesthetics_0 = ctx.myAesthetics;\n $this.myAestheticMappers_0 = ctx.myAestheticMappers;\n return $this;\n }\n function GeomLayerBuilder() {\n GeomLayerBuilder$Companion_getInstance();\n this.myBindings_0 = ArrayList_init();\n this.myConstantByAes_0 = new TypedKeyHashMap();\n this.myStat_mcjcnw$_0 = this.myStat_mcjcnw$_0;\n this.myPosProvider_gzkpo7$_0 = this.myPosProvider_gzkpo7$_0;\n this.myGeomProvider_h6nr63$_0 = this.myGeomProvider_h6nr63$_0;\n this.myGroupingVarName_0 = null;\n this.myPathIdVarName_0 = null;\n this.myScaleProviderByAes_0 = HashMap_init();\n this.myDataPreprocessor_0 = null;\n this.myLocatorLookupSpec_0 = GeomTargetLocator$LookupSpec.Companion.NONE;\n this.myContextualMappingProvider_0 = ContextualMappingProvider$Companion_getInstance().NONE;\n this.myIsLegendDisabled_0 = false;\n }\n Object.defineProperty(GeomLayerBuilder.prototype, 'myStat_0', {\n configurable: true,\n get: function () {\n if (this.myStat_mcjcnw$_0 == null)\n return throwUPAE('myStat');\n return this.myStat_mcjcnw$_0;\n },\n set: function (myStat) {\n this.myStat_mcjcnw$_0 = myStat;\n }\n });\n Object.defineProperty(GeomLayerBuilder.prototype, 'myPosProvider_0', {\n configurable: true,\n get: function () {\n if (this.myPosProvider_gzkpo7$_0 == null)\n return throwUPAE('myPosProvider');\n return this.myPosProvider_gzkpo7$_0;\n },\n set: function (myPosProvider) {\n this.myPosProvider_gzkpo7$_0 = myPosProvider;\n }\n });\n Object.defineProperty(GeomLayerBuilder.prototype, 'myGeomProvider_0', {\n configurable: true,\n get: function () {\n if (this.myGeomProvider_h6nr63$_0 == null)\n return throwUPAE('myGeomProvider');\n return this.myGeomProvider_h6nr63$_0;\n },\n set: function (myGeomProvider) {\n this.myGeomProvider_h6nr63$_0 = myGeomProvider;\n }\n });\n GeomLayerBuilder.prototype.stat_qbwusa$ = function (v) {\n this.myStat_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.pos_r08v3h$ = function (v) {\n this.myPosProvider_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.geom_9dfz59$ = function (v) {\n this.myGeomProvider_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.addBinding_14cn14$ = function (v) {\n this.myBindings_0.add_11rb$(v);\n return this;\n };\n GeomLayerBuilder.prototype.groupingVar_8xm3sj$ = function (v) {\n this.myGroupingVarName_0 = v.name;\n return this;\n };\n GeomLayerBuilder.prototype.groupingVarName_61zpoe$ = function (v) {\n this.myGroupingVarName_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.pathIdVarName_61zpoe$ = function (v) {\n this.myPathIdVarName_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.addConstantAes_bbdhip$ = function (aes, v) {\n this.myConstantByAes_0.put_ev6mlr$(aes, v);\n return this;\n };\n GeomLayerBuilder.prototype.addScaleProvider_jv3qxe$ = function (aes, scaleProvider) {\n this.myScaleProviderByAes_0.put_xwzc9p$(aes, scaleProvider);\n return this;\n };\n GeomLayerBuilder.prototype.locatorLookupSpec_271kgc$ = function (v) {\n this.myLocatorLookupSpec_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.contextualMappingProvider_td8fxc$ = function (v) {\n this.myContextualMappingProvider_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.disableLegend_6taknv$ = function (v) {\n this.myIsLegendDisabled_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.build_fhj1j$ = function (data_0, scaleMap) {\n var tmp$, tmp$_0;\n var data_1 = data_0;\n if (this.myDataPreprocessor_0 != null) {\n data_1 = ensureNotNull(this.myDataPreprocessor_0)(data_1, scaleMap);\n }data_1 = DataProcessing_getInstance().transformOriginals_si9pes$(data_1, this.myBindings_0, scaleMap);\n var $receiver = this.myBindings_0;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n var tmp$_2 = destination.add_11rb$;\n var tmp$_3, tmp$_4;\n tmp$_4 = item.aes;\n if (item.variable.isOrigin) {\n var transformVar = data.DataFrameUtil.transformVarFor_896ixz$(item.aes);\n tmp$_3 = new VarBinding(transformVar, item.aes);\n } else {\n tmp$_3 = item;\n }\n tmp$_2.call(destination, to(tmp$_4, tmp$_3));\n }\n var replacementBindings = HashMap_init_0(toMap(destination));\n var bindingsToPut = ArrayList_init();\n tmp$ = replacementBindings.values.iterator();\n while (tmp$.hasNext()) {\n var binding = tmp$.next();\n var variable = binding.variable;\n if (variable.isStat) {\n var aes = binding.aes;\n var scale = scaleMap.get_31786j$(aes);\n data_1 = data.DataFrameUtil.applyTransform_xaiv89$(data_1, variable, aes, scale);\n bindingsToPut.add_11rb$(new VarBinding(data.TransformVar.forAes_896ixz$(aes), aes));\n }}\n tmp$_0 = bindingsToPut.iterator();\n while (tmp$_0.hasNext()) {\n var binding_0 = tmp$_0.next();\n var key = binding_0.aes;\n replacementBindings.put_xwzc9p$(key, binding_0);\n }\n var dataAccess = new PointDataAccess(data_1, replacementBindings, scaleMap);\n return new GeomLayerBuilder$MyGeomLayer(data_1, this.myGeomProvider_0, this.myPosProvider_0, this.myGeomProvider_0.renders(), (new GroupingContext(data_1, this.myBindings_0, this.myGroupingVarName_0, this.myPathIdVarName_0, this.handlesGroups_0())).groupMapper, replacementBindings.values, this.myConstantByAes_0, scaleMap, dataAccess, this.myLocatorLookupSpec_0, this.myContextualMappingProvider_0.createContextualMapping_8fr62e$(dataAccess, data_1), this.myIsLegendDisabled_0);\n };\n GeomLayerBuilder.prototype.handlesGroups_0 = function () {\n return this.myGeomProvider_0.handlesGroups() || this.myPosProvider_0.handlesGroups();\n };\n function GeomLayerBuilder$MyGeomLayer(dataFrame, geomProvider, myPosProvider, renderedAes, group, varBindings, constantByAes, scaleMap, dataAccess, locatorLookupSpec, contextualMapping, isLegendDisabled) {\n this.dataFrame_uc8k26$_0 = dataFrame;\n this.myPosProvider_0 = myPosProvider;\n this.group_btwr86$_0 = group;\n this.scaleMap_9lvzv7$_0 = scaleMap;\n this.dataAccess_qkhg5r$_0 = dataAccess;\n this.locatorLookupSpec_65qeye$_0 = locatorLookupSpec;\n this.contextualMapping_1qd07s$_0 = contextualMapping;\n this.isLegendDisabled_1bnyfg$_0 = isLegendDisabled;\n this.geom_ipep5v$_0 = geomProvider.createGeom();\n this.geomKind_qyi6z5$_0 = geomProvider.geomKind;\n this.aestheticsDefaults_4lnusm$_0 = null;\n this.myRenderedAes_0 = null;\n this.myConstantByAes_0 = null;\n this.myVarBindingsByAes_0 = HashMap_init();\n var tmp$, tmp$_0;\n this.myRenderedAes_0 = ArrayList_init_0(renderedAes);\n this.aestheticsDefaults_4lnusm$_0 = geomProvider.aestheticsDefaults();\n this.myConstantByAes_0 = new TypedKeyHashMap();\n tmp$ = constantByAes.keys_287e2$().iterator();\n while (tmp$.hasNext()) {\n var key = tmp$.next();\n this.myConstantByAes_0.put_ev6mlr$(key, constantByAes.get_ex36zt$(key));\n }\n tmp$_0 = varBindings.iterator();\n while (tmp$_0.hasNext()) {\n var varBinding = tmp$_0.next();\n var $receiver = this.myVarBindingsByAes_0;\n var key_0 = varBinding.aes;\n $receiver.put_xwzc9p$(key_0, varBinding);\n }\n }\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'dataFrame', {\n get: function () {\n return this.dataFrame_uc8k26$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'group', {\n get: function () {\n return this.group_btwr86$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'scaleMap', {\n get: function () {\n return this.scaleMap_9lvzv7$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'dataAccess', {\n get: function () {\n return this.dataAccess_qkhg5r$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'locatorLookupSpec', {\n get: function () {\n return this.locatorLookupSpec_65qeye$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'contextualMapping', {\n get: function () {\n return this.contextualMapping_1qd07s$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'isLegendDisabled', {\n get: function () {\n return this.isLegendDisabled_1bnyfg$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'geom', {\n configurable: true,\n get: function () {\n return this.geom_ipep5v$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'geomKind', {\n configurable: true,\n get: function () {\n return this.geomKind_qyi6z5$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'aestheticsDefaults', {\n configurable: true,\n get: function () {\n return this.aestheticsDefaults_4lnusm$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return this.geom.legendKeyElementFactory;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'isLiveMap', {\n configurable: true,\n get: function () {\n return Kotlin.isType(this.geom, LiveMapGeom);\n }\n });\n GeomLayerBuilder$MyGeomLayer.prototype.renderedAes = function () {\n return this.myRenderedAes_0;\n };\n GeomLayerBuilder$MyGeomLayer.prototype.createPos_q7kk9g$ = function (ctx) {\n return this.myPosProvider_0.createPos_q7kk9g$(ctx);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.hasBinding_896ixz$ = function (aes) {\n return this.myVarBindingsByAes_0.containsKey_11rb$(aes);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.getBinding_31786j$ = function (aes) {\n return ensureNotNull(this.myVarBindingsByAes_0.get_11rb$(aes));\n };\n GeomLayerBuilder$MyGeomLayer.prototype.hasConstant_896ixz$ = function (aes) {\n return this.myConstantByAes_0.containsKey_ex36zt$(aes);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.getConstant_31786j$ = function (aes) {\n if (!this.hasConstant_896ixz$(aes)) {\n var message = 'Constant value is not defined for aes ' + aes;\n throw IllegalArgumentException_init(message.toString());\n }return this.myConstantByAes_0.get_ex36zt$(aes);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.getDefault_31786j$ = function (aes) {\n return this.aestheticsDefaults.defaultValue_31786j$(aes);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.rangeIncludesZero_896ixz$ = function (aes) {\n return this.aestheticsDefaults.rangeIncludesZero_896ixz$(aes);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.setLiveMapProvider_kld0fp$ = function (liveMapProvider) {\n if (Kotlin.isType(this.geom, LiveMapGeom)) {\n this.geom.setLiveMapProvider_kld0fp$(liveMapProvider);\n } else {\n throw IllegalStateException_init('Not Livemap: ' + Kotlin.getKClassFromExpression(this.geom).simpleName);\n }\n };\n GeomLayerBuilder$MyGeomLayer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyGeomLayer',\n interfaces: [GeomLayer]\n };\n function GeomLayerBuilder$Companion() {\n GeomLayerBuilder$Companion_instance = this;\n }\n function GeomLayerBuilder$Companion$demoAndTest$lambda(closure$builder) {\n return function (data, scaleMap) {\n var transformedData = DataProcessing_getInstance().transformOriginals_si9pes$(data, closure$builder.myBindings_0, scaleMap);\n var stat_0 = closure$builder.myStat_0;\n if (equals(stat_0, stat.Stats.IDENTITY))\n return transformedData;\n else {\n var statCtx = new SimpleStatContext(transformedData);\n var groupingContext = new GroupingContext(transformedData, closure$builder.myBindings_0, closure$builder.myGroupingVarName_0, closure$builder.myPathIdVarName_0, true);\n var dataAndGroupingContext = DataProcessing_getInstance().buildStatData_x40e2x$(transformedData, stat_0, closure$builder.myBindings_0, scaleMap, groupingContext, PlotFacets$Companion_getInstance().undefined(), statCtx, emptyList(), emptyList(), null, getCallableRef('println', function (p1) {\n return println(p1), Unit;\n }));\n return dataAndGroupingContext.data;\n }\n };\n }\n GeomLayerBuilder$Companion.prototype.demoAndTest = function () {\n var builder = new GeomLayerBuilder();\n builder.myDataPreprocessor_0 = GeomLayerBuilder$Companion$demoAndTest$lambda(builder);\n return builder;\n };\n GeomLayerBuilder$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomLayerBuilder$Companion_instance = null;\n function GeomLayerBuilder$Companion_getInstance() {\n if (GeomLayerBuilder$Companion_instance === null) {\n new GeomLayerBuilder$Companion();\n }return GeomLayerBuilder$Companion_instance;\n }\n GeomLayerBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomLayerBuilder',\n interfaces: []\n };\n function GuideOptions() {\n GuideOptions$Companion_getInstance();\n this.isReverse = false;\n }\n function GuideOptions$Companion() {\n GuideOptions$Companion_instance = this;\n this.NONE = new GuideOptions$Companion$NONE$ObjectLiteral();\n }\n function GuideOptions$Companion$NONE$ObjectLiteral() {\n GuideOptions.call(this);\n }\n GuideOptions$Companion$NONE$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [GuideOptions]\n };\n GuideOptions$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GuideOptions$Companion_instance = null;\n function GuideOptions$Companion_getInstance() {\n if (GuideOptions$Companion_instance === null) {\n new GuideOptions$Companion();\n }return GuideOptions$Companion_instance;\n }\n GuideOptions.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GuideOptions',\n interfaces: []\n };\n function ImmutableGeomContext() {\n }\n function ImmutableGeomContext$Builder() {\n }\n ImmutableGeomContext$Builder.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Builder',\n interfaces: []\n };\n ImmutableGeomContext.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ImmutableGeomContext',\n interfaces: [GeomContext]\n };\n function LegendAssembler(legendTitle, guideOptionsMap, theme) {\n LegendAssembler$Companion_getInstance();\n this.legendTitle_0 = legendTitle;\n this.guideOptionsMap_0 = guideOptionsMap;\n this.theme_0 = theme;\n this.legendLayers_0 = ArrayList_init();\n }\n LegendAssembler.prototype.addLayer_446ka8$ = function (keyFactory, varBindings, constantByAes, aestheticsDefaults, scaleByAes, transformedDataRangeByAes) {\n this.legendLayers_0.add_11rb$(new LegendAssembler$LegendLayer(keyFactory, varBindings, constantByAes, aestheticsDefaults, scaleByAes, transformedDataRangeByAes));\n };\n function LegendAssembler$createLegend$ObjectLiteral(closure$spec, size) {\n this.closure$spec = closure$spec;\n LegendBoxInfo.call(this, size);\n }\n LegendAssembler$createLegend$ObjectLiteral.prototype.createLegendBox = function () {\n var c = new LegendComponent(this.closure$spec);\n c.debug = LegendAssembler$Companion_getInstance().DEBUG_DRAWING_0;\n return c;\n };\n LegendAssembler$createLegend$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [LegendBoxInfo]\n };\n LegendAssembler.prototype.createLegend = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n var legendBreaksByLabel = LinkedHashMap_init();\n tmp$ = this.legendLayers_0.iterator();\n while (tmp$.hasNext()) {\n var legendLayer = tmp$.next();\n var keyElementFactory = legendLayer.keyElementFactory_8be2vx$;\n var dataPoints = legendLayer.keyAesthetics_8be2vx$.dataPoints().iterator();\n tmp$_0 = legendLayer.keyLabels_8be2vx$.iterator();\n while (tmp$_0.hasNext()) {\n var label = tmp$_0.next();\n var tmp$_5;\n var value = legendBreaksByLabel.get_11rb$(label);\n if (value == null) {\n var answer = new LegendBreak(label);\n legendBreaksByLabel.put_xwzc9p$(label, answer);\n tmp$_5 = answer;\n } else {\n tmp$_5 = value;\n }\n tmp$_5.addLayer_w0u015$(dataPoints.next(), keyElementFactory);\n }\n }\n var legendBreaks = ArrayList_init();\n tmp$_1 = legendBreaksByLabel.values.iterator();\n while (tmp$_1.hasNext()) {\n var legendBreak = tmp$_1.next();\n if (legendBreak.isEmpty) {\n continue;\n }legendBreaks.add_11rb$(legendBreak);\n }\n if (legendBreaks.isEmpty()) {\n return LegendBoxInfo$Companion_getInstance().EMPTY;\n }var legendOptionsList = ArrayList_init();\n tmp$_2 = this.legendLayers_0.iterator();\n while (tmp$_2.hasNext()) {\n var legendLayer_0 = tmp$_2.next();\n var aesList = legendLayer_0.aesList_8be2vx$;\n tmp$_3 = aesList.iterator();\n while (tmp$_3.hasNext()) {\n var aes = tmp$_3.next();\n if (Kotlin.isType(this.guideOptionsMap_0.get_11rb$(aes), LegendOptions)) {\n legendOptionsList.add_11rb$(Kotlin.isType(tmp$_4 = this.guideOptionsMap_0.get_11rb$(aes), LegendOptions) ? tmp$_4 : throwCCE());\n }}\n }\n var spec = LegendAssembler$Companion_getInstance().createLegendSpec_esqxbx$(this.legendTitle_0, legendBreaks, this.theme_0, LegendOptions$Companion_getInstance().combine_pmdc6s$(legendOptionsList));\n return new LegendAssembler$createLegend$ObjectLiteral(spec, spec.size);\n };\n function LegendAssembler$LegendLayer(keyElementFactory, varBindings, constantByAes, aestheticsDefaults, scaleMap, transformedDataRangeByAes) {\n this.keyElementFactory_8be2vx$ = keyElementFactory;\n this.varBindings_0 = varBindings;\n this.constantByAes_0 = constantByAes;\n this.aestheticsDefaults_0 = aestheticsDefaults;\n this.scaleMap_0 = scaleMap;\n this.keyAesthetics_8be2vx$ = null;\n this.keyLabels_8be2vx$ = null;\n var tmp$, tmp$_0;\n var aesValuesByLabel = LinkedHashMap_init();\n tmp$ = this.varBindings_0.iterator();\n while (tmp$.hasNext()) {\n var varBinding = tmp$.next();\n var aes = varBinding.aes;\n var scale_0 = this.scaleMap_0.get_31786j$(aes);\n if (!scale_0.hasBreaks()) {\n scale_0 = breaks.ScaleBreaksUtil.withBreaks_qt1l9m$(scale_0, getValue(transformedDataRangeByAes, aes), 5);\n }if (!scale_0.hasBreaks()) {\n var message = 'No breaks were defined for scale ' + aes;\n throw IllegalStateException_init(message.toString());\n }var aesValues = scale.ScaleUtil.transformAndMap_syim1y$(scale_0.breaks, scale_0);\n var labels = scale.ScaleUtil.labels_x4zrm4$(scale_0);\n tmp$_0 = zip(labels, aesValues).iterator();\n while (tmp$_0.hasNext()) {\n var tmp$_1 = tmp$_0.next();\n var label = tmp$_1.component1()\n , aesValue = tmp$_1.component2();\n var tmp$_2;\n var value = aesValuesByLabel.get_11rb$(label);\n if (value == null) {\n var answer = HashMap_init();\n aesValuesByLabel.put_xwzc9p$(label, answer);\n tmp$_2 = answer;\n } else {\n tmp$_2 = value;\n }\n var $receiver = tmp$_2;\n var value_0 = ensureNotNull(aesValue);\n $receiver.put_xwzc9p$(aes, value_0);\n }\n }\n this.keyAesthetics_8be2vx$ = LegendAssemblerUtil_getInstance().mapToAesthetics_8kbmqf$(aesValuesByLabel.values, this.constantByAes_0, this.aestheticsDefaults_0);\n this.keyLabels_8be2vx$ = ArrayList_init_0(aesValuesByLabel.keys);\n }\n Object.defineProperty(LegendAssembler$LegendLayer.prototype, 'aesList_8be2vx$', {\n configurable: true,\n get: function () {\n var $receiver = this.varBindings_0;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(item.aes);\n }\n return destination;\n }\n });\n LegendAssembler$LegendLayer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendLayer',\n interfaces: []\n };\n function LegendAssembler$Companion() {\n LegendAssembler$Companion_instance = this;\n this.DEBUG_DRAWING_0 = FeatureSwitch_getInstance().LEGEND_DEBUG_DRAWING;\n }\n function LegendAssembler$Companion$createLegendSpec$pretty(v) {\n var margin = 1.0;\n var x = v.x / 2;\n var tmp$ = JsMath.floor(x) * 2 + 1.0 + margin;\n var x_0 = v.y / 2;\n return new DoubleVector(tmp$, JsMath.floor(x_0) * 2 + 1.0 + margin);\n }\n LegendAssembler$Companion.prototype.createLegendSpec_esqxbx$ = function (title, breaks, theme, options) {\n if (options === void 0)\n options = new LegendOptions();\n var tmp$, tmp$_0, tmp$_1;\n var legendDirection = LegendAssemblerUtil_getInstance().legendDirection_730mk3$(theme);\n var pretty = LegendAssembler$Companion$createLegendSpec$pretty;\n var keySize = new DoubleVector(theme.keySize(), theme.keySize());\n tmp$ = breaks.iterator();\n while (tmp$.hasNext()) {\n var br = tmp$.next();\n var minimumKeySize = br.minimumKeySize;\n keySize = keySize.max_gpjtzr$(pretty(minimumKeySize));\n }\n var breakCount = breaks.size;\n var colCount;\n var rowCount;\n if (options.isByRow) {\n if (options.hasColCount()) {\n var a = options.colCount;\n tmp$_0 = JsMath.min(a, breakCount);\n } else if (options.hasRowCount()) {\n var x = breakCount / options.rowCount;\n tmp$_0 = numberToInt(JsMath.ceil(x));\n } else if (legendDirection === LegendDirection$HORIZONTAL_getInstance())\n tmp$_0 = breakCount;\n else\n tmp$_0 = 1;\n colCount = tmp$_0;\n var x_0 = breakCount / colCount;\n rowCount = numberToInt(JsMath.ceil(x_0));\n } else {\n if (options.hasRowCount()) {\n var a_0 = options.rowCount;\n tmp$_1 = JsMath.min(a_0, breakCount);\n } else if (options.hasColCount()) {\n var x_1 = breakCount / options.colCount;\n tmp$_1 = numberToInt(JsMath.ceil(x_1));\n } else if (legendDirection !== LegendDirection$HORIZONTAL_getInstance())\n tmp$_1 = breakCount;\n else\n tmp$_1 = 1;\n rowCount = tmp$_1;\n var x_2 = breakCount / rowCount;\n colCount = numberToInt(JsMath.ceil(x_2));\n }\n var layout;\n if (legendDirection === LegendDirection$HORIZONTAL_getInstance()) {\n if (options.hasRowCount() || (options.hasColCount() && options.colCount < breakCount)) {\n layout = LegendComponentLayout$Companion_getInstance().horizontalMultiRow_2y8ibu$(title, breaks, keySize);\n } else {\n layout = LegendComponentLayout$Companion_getInstance().horizontal_2y8ibu$(title, breaks, keySize);\n }\n } else {\n layout = LegendComponentLayout$Companion_getInstance().vertical_2y8ibu$(title, breaks, keySize);\n }\n layout.colCount = colCount;\n layout.rowCount = rowCount;\n layout.isFillByRow = options.isByRow;\n return new LegendComponentSpec(title, breaks, theme, layout, false);\n };\n LegendAssembler$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendAssembler$Companion_instance = null;\n function LegendAssembler$Companion_getInstance() {\n if (LegendAssembler$Companion_instance === null) {\n new LegendAssembler$Companion();\n }return LegendAssembler$Companion_instance;\n }\n LegendAssembler.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendAssembler',\n interfaces: []\n };\n function LegendAssemblerUtil() {\n LegendAssemblerUtil_instance = this;\n }\n LegendAssemblerUtil.prototype.mapToAesthetics_ml5orx$ = function (valuesByAes, constantByAes, aestheticsDefaults) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var builder = new AestheticsBuilder(0);\n tmp$ = Aes.Companion.values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n builder.constantAes_bbdhip$(Kotlin.isType(tmp$_0 = aes, Aes) ? tmp$_0 : throwCCE(), aestheticsDefaults.defaultValue_31786j$(aes));\n }\n tmp$_1 = valuesByAes.keys.iterator();\n while (tmp$_1.hasNext()) {\n var aes_0 = tmp$_1.next();\n var values = ensureNotNull(valuesByAes.get_11rb$(aes_0));\n builder.aes_u42xfl$(aes_0, AestheticsBuilder.Companion.collection_mqih57$(values));\n builder.dataPointCount_za3lpa$(values.size);\n }\n tmp$_2 = constantByAes.keys.iterator();\n while (tmp$_2.hasNext()) {\n var aes_1 = tmp$_2.next();\n builder.constantAes_bbdhip$(aes_1, ensureNotNull(constantByAes.get_11rb$(aes_1)));\n }\n return builder.build();\n };\n function LegendAssemblerUtil$mapToAesthetics$lambda(closure$dataPoints, closure$aes) {\n return function (index) {\n return ensureNotNull(closure$dataPoints.get_za3lpa$(index).get_11rb$(closure$aes));\n };\n }\n LegendAssemblerUtil.prototype.mapToAesthetics_8kbmqf$ = function (valueByAesIterable, constantByAes, aestheticsDefaults) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n var dataPoints = ArrayList_init();\n tmp$ = valueByAesIterable.iterator();\n while (tmp$.hasNext()) {\n var valueByAes = tmp$.next();\n var dataPoint = HashMap_init();\n tmp$_0 = Aes.Companion.values().iterator();\n while (tmp$_0.hasNext()) {\n var aes = tmp$_0.next();\n var value = ensureNotNull(aestheticsDefaults.defaultValueInLegend_31786j$(aes));\n dataPoint.put_xwzc9p$(aes, value);\n }\n tmp$_1 = constantByAes.keys.iterator();\n while (tmp$_1.hasNext()) {\n var constantAes = tmp$_1.next();\n if (equals(constantAes, Aes.Companion.SHAPE) || equals(constantAes, Aes.Companion.COLOR) || equals(constantAes, Aes.Companion.FILL)) {\n var value_0 = ensureNotNull(constantByAes.get_11rb$(constantAes));\n dataPoint.put_xwzc9p$(constantAes, value_0);\n }}\n tmp$_2 = valueByAes.keys.iterator();\n while (tmp$_2.hasNext()) {\n var aes_0 = tmp$_2.next();\n var value_1 = ensureNotNull(valueByAes.get_11rb$(aes_0));\n dataPoint.put_xwzc9p$(aes_0, value_1);\n }\n dataPoints.add_11rb$(dataPoint);\n }\n var builder = new AestheticsBuilder(dataPoints.size);\n tmp$_3 = Aes.Companion.values().iterator();\n while (tmp$_3.hasNext()) {\n var aes_1 = tmp$_3.next();\n builder.aes_u42xfl$(Kotlin.isType(tmp$_4 = aes_1, Aes) ? tmp$_4 : throwCCE(), LegendAssemblerUtil$mapToAesthetics$lambda(dataPoints, aes_1));\n }\n return builder.build();\n };\n LegendAssemblerUtil.prototype.legendDirection_730mk3$ = function (theme) {\n var legendDirection = theme.direction();\n if (legendDirection === LegendDirection$AUTO_getInstance()) {\n var legendPosition = theme.position();\n legendDirection = legendPosition === LegendPosition$Companion_getInstance().TOP || legendPosition === LegendPosition$Companion_getInstance().BOTTOM ? LegendDirection$HORIZONTAL_getInstance() : LegendDirection$VERTICAL_getInstance();\n }return legendDirection;\n };\n LegendAssemblerUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'LegendAssemblerUtil',\n interfaces: []\n };\n var LegendAssemblerUtil_instance = null;\n function LegendAssemblerUtil_getInstance() {\n if (LegendAssemblerUtil_instance === null) {\n new LegendAssemblerUtil();\n }return LegendAssemblerUtil_instance;\n }\n function LegendOptions() {\n LegendOptions$Companion_getInstance();\n GuideOptions.call(this);\n this.myColCount_0 = null;\n this.myRowCount_0 = null;\n this.isByRow = false;\n }\n Object.defineProperty(LegendOptions.prototype, 'colCount', {\n configurable: true,\n get: function () {\n return ensureNotNull(this.myColCount_0);\n },\n set: function (colCount) {\n this.myColCount_0 = JsMath.max(1, colCount);\n }\n });\n Object.defineProperty(LegendOptions.prototype, 'rowCount', {\n configurable: true,\n get: function () {\n return ensureNotNull(this.myRowCount_0);\n },\n set: function (rowCount) {\n this.myRowCount_0 = JsMath.max(1, rowCount);\n }\n });\n LegendOptions.prototype.hasColCount = function () {\n return this.myColCount_0 != null;\n };\n LegendOptions.prototype.hasRowCount = function () {\n return this.myRowCount_0 != null;\n };\n function LegendOptions$Companion() {\n LegendOptions$Companion_instance = this;\n }\n LegendOptions$Companion.prototype.combine_pmdc6s$ = function (optionsList) {\n var tmp$;\n var result = new LegendOptions();\n tmp$ = optionsList.iterator();\n while (tmp$.hasNext()) {\n var options = tmp$.next();\n if (options.isByRow) {\n result.isByRow = true;\n }if (options.hasColCount()) {\n result.colCount = options.colCount;\n }if (options.hasRowCount()) {\n result.rowCount = options.rowCount;\n }}\n return result;\n };\n LegendOptions$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendOptions$Companion_instance = null;\n function LegendOptions$Companion_getInstance() {\n if (LegendOptions$Companion_instance === null) {\n new LegendOptions$Companion();\n }return LegendOptions$Companion_instance;\n }\n LegendOptions.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendOptions',\n interfaces: [GuideOptions]\n };\n function PlotAssembler(scaleByAes, layersByTile, myCoordProvider, myTheme) {\n PlotAssembler$Companion_getInstance();\n this.scaleByAes_0 = scaleByAes;\n this.layersByTile = layersByTile;\n this.myCoordProvider_0 = myCoordProvider;\n this.myTheme_0 = myTheme;\n this.containsLiveMap = false;\n this.facets = PlotFacets$Companion_getInstance().undefined();\n this.myTitle_0 = null;\n this.myGuideOptionsMap_0 = HashMap_init();\n this.myAxisEnabled_0 = false;\n this.myLegendsEnabled_0 = true;\n this.myInteractionsEnabled_0 = true;\n var $receiver = flatten(this.layersByTile);\n var predicate = getPropertyCallableRef('isLiveMap', 1, function ($receiver) {\n return $receiver.isLiveMap;\n });\n var any$result;\n any$break: do {\n var tmp$;\n if (Kotlin.isType($receiver, Collection) && $receiver.isEmpty()) {\n any$result = false;\n break any$break;\n }tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (predicate(element)) {\n any$result = true;\n break any$break;\n }}\n any$result = false;\n }\n while (false);\n this.containsLiveMap = any$result;\n this.myAxisEnabled_0 = !this.containsLiveMap;\n }\n PlotAssembler.prototype.setTitle_pdl1vj$ = function (title) {\n this.myTitle_0 = title;\n };\n PlotAssembler.prototype.hasLayers_0 = function () {\n var tmp$;\n tmp$ = this.layersByTile.iterator();\n while (tmp$.hasNext()) {\n var tileLayers = tmp$.next();\n if (!tileLayers.isEmpty()) {\n return true;\n }}\n return false;\n };\n PlotAssembler.prototype.createPlot = function () {\n if (!this.hasLayers_0()) {\n var message = 'No layers in plot';\n throw IllegalStateException_init(message.toString());\n }var legendsBoxInfos = this.myLegendsEnabled_0 ? PlotAssemblerUtil_getInstance().createLegends_fyi7ho$(this.layersByTile, this.myGuideOptionsMap_0, this.myTheme_0.legend()) : emptyList();\n var xScaleProto = this.scaleByAes_0.get_31786j$(Aes.Companion.X);\n var yScaleProto = this.scaleByAes_0.get_31786j$(Aes.Companion.Y);\n if (this.containsLiveMap) {\n var plotLayout = PlotAssemblerUtil_getInstance().createPlotLayout_3sq5f9$(new LiveMapTileLayout(), this.facets);\n return this.createXYPlot_0(xScaleProto, yScaleProto, plotLayout, legendsBoxInfos, true);\n }var tmp$ = PlotAssemblerUtil_getInstance().computePlotDryRunXYRanges_7yawgb$(this.layersByTile);\n var xDomain = tmp$.component1()\n , yDomain = tmp$.component2();\n var xAxisLayout;\n var yAxisLayout;\n if (this.myAxisEnabled_0) {\n xAxisLayout = PlotAxisLayout$Companion_getInstance().bottom_eknalg$(xScaleProto, xDomain, yDomain, this.myCoordProvider_0, this.myTheme_0.axisX());\n yAxisLayout = PlotAxisLayout$Companion_getInstance().left_eknalg$(yScaleProto, xDomain, yDomain, this.myCoordProvider_0, this.myTheme_0.axisY());\n } else {\n xAxisLayout = EmptyAxisLayout$Companion_getInstance().bottom_gyv40k$(xDomain, yDomain);\n yAxisLayout = EmptyAxisLayout$Companion_getInstance().left_gyv40k$(xDomain, yDomain);\n }\n var plotLayout_0 = PlotAssemblerUtil_getInstance().createPlotLayout_3sq5f9$(new XYPlotTileLayout(xAxisLayout, yAxisLayout), this.facets);\n if (!this.myAxisEnabled_0) {\n plotLayout_0.setPadding_6y0v78$(0.0, 0.0, 0.0, 0.0);\n }return this.createXYPlot_0(xScaleProto, yScaleProto, plotLayout_0, legendsBoxInfos);\n };\n PlotAssembler.prototype.createXYPlot_0 = function (xScaleProto, yScaleProto, plotLayout, legendBoxInfos, hasLiveMap) {\n if (hasLiveMap === void 0)\n hasLiveMap = false;\n var tmp$, tmp$_0;\n var plotBuilder = new PlotBuilder(this.myTheme_0);\n plotBuilder.setTitle_pdl1vj$(this.myTitle_0);\n plotBuilder.scaleXProto_iu85h4$(xScaleProto);\n plotBuilder.scaleYProto_iu85h4$(yScaleProto);\n plotBuilder.setAxisTitleBottom_61zpoe$(xScaleProto.name);\n plotBuilder.setAxisTitleLeft_61zpoe$(yScaleProto.name);\n plotBuilder.setCoordProvider_sdecqr$(this.myCoordProvider_0);\n tmp$ = legendBoxInfos.iterator();\n while (tmp$.hasNext()) {\n var legendBoxInfo = tmp$.next();\n plotBuilder.addLegendBoxInfo_29gouq$(legendBoxInfo);\n }\n tmp$_0 = this.layersByTile.iterator();\n while (tmp$_0.hasNext()) {\n var panelLayers = tmp$_0.next();\n plotBuilder.addTileLayers_relqli$(panelLayers);\n }\n plotBuilder.setPlotLayout_vjneqj$(plotLayout);\n plotBuilder.axisEnabled_6taknv$(this.myAxisEnabled_0);\n plotBuilder.interactionsEnabled_6taknv$(this.myInteractionsEnabled_0);\n plotBuilder.setLiveMap_6taknv$(hasLiveMap);\n return plotBuilder.build();\n };\n PlotAssembler.prototype.setGuideOptionsMap_qayxze$ = function (guideOptionsMap) {\n this.myGuideOptionsMap_0 = guideOptionsMap;\n };\n PlotAssembler.prototype.disableAxis = function () {\n this.myAxisEnabled_0 = false;\n };\n PlotAssembler.prototype.disableLegends = function () {\n this.myLegendsEnabled_0 = false;\n };\n PlotAssembler.prototype.disableInteractions = function () {\n this.myInteractionsEnabled_0 = false;\n };\n function PlotAssembler$Companion() {\n PlotAssembler$Companion_instance = this;\n }\n PlotAssembler$Companion.prototype.singleTile_wqghlj$ = function (scaleByAes, plotLayers, coordProvider, theme) {\n var layersByTile = ArrayList_init();\n layersByTile.add_11rb$(plotLayers);\n return this.multiTile_bm7ueq$(scaleByAes, layersByTile, coordProvider, theme);\n };\n PlotAssembler$Companion.prototype.multiTile_bm7ueq$ = function (scaleByAes, layersByTile, coordProvider, theme) {\n return new PlotAssembler(scaleByAes, layersByTile, coordProvider, theme);\n };\n PlotAssembler$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PlotAssembler$Companion_instance = null;\n function PlotAssembler$Companion_getInstance() {\n if (PlotAssembler$Companion_instance === null) {\n new PlotAssembler$Companion();\n }return PlotAssembler$Companion_instance;\n }\n PlotAssembler.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotAssembler',\n interfaces: []\n };\n function PlotAssemblerUtil() {\n PlotAssemblerUtil_instance = this;\n }\n PlotAssemblerUtil.prototype.updateAesRangeMap_0 = function (aes, range, rangeByAes) {\n var range_0 = range;\n if (range_0 != null) {\n var wasRange = rangeByAes.get_11rb$(aes);\n if (wasRange != null) {\n range_0 = wasRange.span_d226ot$(range_0);\n }var value = range_0;\n rangeByAes.put_xwzc9p$(aes, value);\n }};\n PlotAssemblerUtil.prototype.updateRange_0 = function (range, wasRange) {\n var range_0 = range;\n if (range_0 != null) {\n if (wasRange != null) {\n range_0 = wasRange.span_d226ot$(range_0);\n }return range_0;\n }return wasRange;\n };\n PlotAssemblerUtil.prototype.updateRange_1 = function (values, wasRange) {\n if (!collect.Iterables.isEmpty_fakr2g$(values)) {\n var newRange = ClosedRange.Companion.encloseAll_17hg47$(values);\n if (wasRange != null) {\n newRange = wasRange.span_d226ot$(newRange);\n }return newRange;\n }return wasRange;\n };\n PlotAssemblerUtil.prototype.createLegends_fyi7ho$ = function (layersByPanel, guideOptionsMap, theme) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var planeCount = 0;\n if (!layersByPanel.isEmpty()) {\n planeCount = layersByPanel.get_za3lpa$(0).size;\n }var stitchedLayersList = ArrayList_init();\n tmp$ = planeCount;\n for (var i = 0; i < tmp$; i++) {\n var layersOnPlane = ArrayList_init();\n tmp$_0 = layersByPanel.iterator();\n while (tmp$_0.hasNext()) {\n var panelLayers = tmp$_0.next();\n layersOnPlane.add_11rb$(panelLayers.get_za3lpa$(i));\n }\n stitchedLayersList.add_11rb$(new StitchedPlotLayers(layersOnPlane));\n }\n var transformedDataRangeByAes = HashMap_init();\n tmp$_1 = stitchedLayersList.iterator();\n while (tmp$_1.hasNext()) {\n var stitchedPlotLayers = tmp$_1.next();\n var layerTransformedDomainByAes = PlotGuidesAssemblerUtil_getInstance().guideTransformedDomainByAes_rf697z$(stitchedPlotLayers, guideOptionsMap);\n tmp$_2 = layerTransformedDomainByAes.entries.iterator();\n while (tmp$_2.hasNext()) {\n var tmp$_3 = tmp$_2.next();\n var aes = tmp$_3.key;\n var transformedDomain = tmp$_3.value;\n this.updateAesRangeMap_0(aes, transformedDomain, transformedDataRangeByAes);\n }\n }\n return this.createLegends_0(stitchedLayersList, transformedDataRangeByAes, guideOptionsMap, theme);\n };\n PlotAssemblerUtil.prototype.createLegends_0 = function (stitchedLayersList, transformedDataRangeByAes, guideOptionsMap, theme) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4, tmp$_5, tmp$_6;\n var legendAssemblerByTitle = LinkedHashMap_init();\n var colorBarAssemblerByTitle = LinkedHashMap_init();\n tmp$ = stitchedLayersList.iterator();\n while (tmp$.hasNext()) {\n var stitchedLayers = tmp$.next();\n var layerConstantByAes = HashMap_init();\n tmp$_0 = stitchedLayers.renderedAes().iterator();\n while (tmp$_0.hasNext()) {\n var aes = tmp$_0.next();\n if (stitchedLayers.hasConstant_896ixz$(aes)) {\n var value = ensureNotNull(stitchedLayers.getConstant_31786j$(aes));\n layerConstantByAes.put_xwzc9p$(aes, value);\n }}\n var layerBindingsByScaleName = LinkedHashMap_init();\n var aesList = PlotGuidesAssemblerUtil_getInstance().mappedRenderedAesToCreateGuides_rf697z$(stitchedLayers, guideOptionsMap);\n tmp$_1 = aesList.iterator();\n while (tmp$_1.hasNext()) {\n var aes_0 = tmp$_1.next();\n var colorBar = false;\n var binding = stitchedLayers.getBinding_896ixz$(aes_0);\n var scale = stitchedLayers.getScale_896ixz$(aes_0);\n var scaleName = scale.name;\n if (guideOptionsMap.containsKey_11rb$(aes_0)) {\n var guideOptions = guideOptionsMap.get_11rb$(aes_0);\n if (Kotlin.isType(guideOptions, ColorBarOptions)) {\n PlotGuidesAssemblerUtil_getInstance().checkFitsColorBar_k9b7d3$(binding.aes, scale);\n colorBar = true;\n var colorScale = Kotlin.isType(tmp$_2 = scale, Scale) ? tmp$_2 : throwCCE();\n var value_0 = PlotGuidesAssemblerUtil_getInstance().createColorBarAssembler_mzqjql$(scaleName, binding.aes, transformedDataRangeByAes, colorScale, guideOptions, theme);\n colorBarAssemblerByTitle.put_xwzc9p$(scaleName, value_0);\n }} else if (PlotGuidesAssemblerUtil_getInstance().fitsColorBar_k9b7d3$(binding.aes, scale)) {\n colorBar = true;\n var colorScale_0 = Kotlin.isType(tmp$_3 = scale, Scale) ? tmp$_3 : throwCCE();\n var value_1 = PlotGuidesAssemblerUtil_getInstance().createColorBarAssembler_mzqjql$(scaleName, binding.aes, transformedDataRangeByAes, colorScale_0, null, theme);\n colorBarAssemblerByTitle.put_xwzc9p$(scaleName, value_1);\n }if (!colorBar) {\n var tmp$_7;\n var value_2 = layerBindingsByScaleName.get_11rb$(scaleName);\n if (value_2 == null) {\n var answer = ArrayList_init();\n layerBindingsByScaleName.put_xwzc9p$(scaleName, answer);\n tmp$_7 = answer;\n } else {\n tmp$_7 = value_2;\n }\n tmp$_7.add_11rb$(binding);\n }}\n tmp$_4 = layerBindingsByScaleName.keys.iterator();\n while (tmp$_4.hasNext()) {\n var scaleName_0 = tmp$_4.next();\n var tmp$_8;\n var value_3 = legendAssemblerByTitle.get_11rb$(scaleName_0);\n if (value_3 == null) {\n var answer_0 = new LegendAssembler(scaleName_0, guideOptionsMap, theme);\n legendAssemblerByTitle.put_xwzc9p$(scaleName_0, answer_0);\n tmp$_8 = answer_0;\n } else {\n tmp$_8 = value_3;\n }\n var legendAssembler = tmp$_8;\n var varBindings = ensureNotNull(layerBindingsByScaleName.get_11rb$(scaleName_0));\n var legendKeyFactory = stitchedLayers.legendKeyElementFactory;\n var aestheticsDefaults = stitchedLayers.aestheticsDefaults;\n legendAssembler.addLayer_446ka8$(legendKeyFactory, varBindings, layerConstantByAes, aestheticsDefaults, stitchedLayers.getScaleMap(), transformedDataRangeByAes);\n }\n }\n var legendBoxInfos = ArrayList_init();\n tmp$_5 = colorBarAssemblerByTitle.keys.iterator();\n while (tmp$_5.hasNext()) {\n var legendTitle = tmp$_5.next();\n var boxInfo = ensureNotNull(colorBarAssemblerByTitle.get_11rb$(legendTitle)).createColorBar();\n if (!boxInfo.isEmpty) {\n legendBoxInfos.add_11rb$(boxInfo);\n }}\n tmp$_6 = legendAssemblerByTitle.keys.iterator();\n while (tmp$_6.hasNext()) {\n var legendTitle_0 = tmp$_6.next();\n var boxInfo_0 = ensureNotNull(legendAssemblerByTitle.get_11rb$(legendTitle_0)).createLegend();\n if (!boxInfo_0.isEmpty) {\n legendBoxInfos.add_11rb$(boxInfo_0);\n }}\n return legendBoxInfos;\n };\n PlotAssemblerUtil.prototype.createPlotLayout_3sq5f9$ = function (tileLayout, facets) {\n if (!facets.isDefined) {\n return new SingleTilePlotLayout(tileLayout);\n }return new FacetGridPlotLayout(facets, tileLayout);\n };\n function PlotAssemblerUtil$computePlotDryRunXYRanges$initialRange(this$PlotAssemblerUtil) {\n return function (scale_0) {\n var initialRange = null;\n if (scale_0.isContinuousDomain) {\n var tmp$ = this$PlotAssemblerUtil;\n var $receiver = toList(scale.ScaleUtil.transformedDefinedLimits_x4zrm4$(scale_0));\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (isFinite(element))\n destination.add_11rb$(element);\n }\n initialRange = tmp$.updateRange_1(destination, initialRange);\n }if (scale_0.hasBreaks()) {\n initialRange = this$PlotAssemblerUtil.updateRange_1(scale.ScaleUtil.breaksTransformed_x4zrm4$(scale_0), initialRange);\n }return initialRange;\n };\n }\n function PlotAssemblerUtil$computePlotDryRunXYRanges$layerRange(this$PlotAssemblerUtil) {\n return function (layer, aes, initialRange, aestheticsRange) {\n var range = this$PlotAssemblerUtil.updateRange_0(aestheticsRange, initialRange);\n range = PlotUtil_getInstance().rangeWithExpand_cmjc6r$(layer, aes, range);\n if (layer.rangeIncludesZero_896ixz$(aes)) {\n range = this$PlotAssemblerUtil.updateRange_0(ClosedRange.Companion.singleton_f1zjgi$(0.0), range);\n }return range;\n };\n }\n PlotAssemblerUtil.prototype.computePlotDryRunXYRanges_7yawgb$ = function (layersByTile) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var dryRunAestheticsByTileLayer = HashMap_init();\n tmp$ = layersByTile.iterator();\n while (tmp$.hasNext()) {\n var tileLayers = tmp$.next();\n tmp$_0 = tileLayers.iterator();\n while (tmp$_0.hasNext()) {\n var layer = tmp$_0.next();\n var aesthetics = PlotUtil_getInstance().createLayerDryRunAesthetics_sqg2xh$(layer);\n dryRunAestheticsByTileLayer.put_xwzc9p$(layer, aesthetics);\n }\n }\n var initialRange = PlotAssemblerUtil$computePlotDryRunXYRanges$initialRange(this);\n var scaleMap = layersByTile.get_za3lpa$(0).get_za3lpa$(0).scaleMap;\n var xInitialRange = initialRange(scaleMap.get_31786j$(Aes.Companion.X));\n var yInitialRange = initialRange(scaleMap.get_31786j$(Aes.Companion.Y));\n var layerRange = PlotAssemblerUtil$computePlotDryRunXYRanges$layerRange(this);\n var xRangeOverall = null;\n var yRangeOverall = null;\n tmp$_1 = layersByTile.iterator();\n while (tmp$_1.hasNext()) {\n var layers = tmp$_1.next();\n tmp$_2 = layers.iterator();\n while (tmp$_2.hasNext()) {\n var layer_0 = tmp$_2.next();\n var aesthetics_0 = getValue(dryRunAestheticsByTileLayer, layer_0);\n var xyRanges = PlotUtil_getInstance().computeLayerDryRunXYRanges_gl53zg$(layer_0, aesthetics_0);\n var xRangeLayer = layerRange(layer_0, Aes.Companion.X, xInitialRange, xyRanges.first);\n var yRangeLayer = layerRange(layer_0, Aes.Companion.Y, yInitialRange, xyRanges.second);\n xRangeOverall = this.updateRange_0(xRangeLayer, xRangeOverall);\n yRangeOverall = this.updateRange_0(yRangeLayer, yRangeOverall);\n }\n }\n xRangeOverall = data_0.SeriesUtil.ensureApplicableRange_4am1sd$(xRangeOverall);\n yRangeOverall = data_0.SeriesUtil.ensureApplicableRange_4am1sd$(yRangeOverall);\n return new Pair(xRangeOverall, yRangeOverall);\n };\n PlotAssemblerUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PlotAssemblerUtil',\n interfaces: []\n };\n var PlotAssemblerUtil_instance = null;\n function PlotAssemblerUtil_getInstance() {\n if (PlotAssemblerUtil_instance === null) {\n new PlotAssemblerUtil();\n }return PlotAssemblerUtil_instance;\n }\n function PlotFacets() {\n PlotFacets$Companion_getInstance();\n }\n function PlotFacets$Companion() {\n PlotFacets$Companion_instance = this;\n this.DEF_ORDER_DIR = 1;\n this.DEF_FORMATTER = PlotFacets$Companion$DEF_FORMATTER$lambda;\n }\n PlotFacets$Companion.prototype.undefined = function () {\n return new FacetGrid(null, null, emptyList(), emptyList(), 1, 1);\n };\n PlotFacets$Companion.prototype.dataByLevelTuple_w4sfrb$ = function (data_1, varNames, varLevels) {\n var tmp$, tmp$_0, tmp$_1;\n var nameLevelTuples = this.createNameLevelTuples_5cxrh4$(varNames, varLevels);\n var destination = ArrayList_init_1(collectionSizeOrDefault(varNames, 10));\n var tmp$_2;\n tmp$_2 = varNames.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination.add_11rb$(data.DataFrameUtil.findVariableOrFail_vede35$(data_1, item));\n }\n var vars = destination;\n var indicesByVarByLevel = HashMap_init();\n var i = 0;\n for (var tmp$_3 = vars.iterator(); tmp$_3.hasNext(); ++i) {\n var variable = tmp$_3.next();\n var tmp$_4;\n var levels = varLevels.get_za3lpa$(i);\n var indicesByLevel = HashMap_init();\n tmp$_4 = levels.iterator();\n while (tmp$_4.hasNext()) {\n var level = tmp$_4.next();\n var indices = data_0.SeriesUtil.matchingIndices_3vukww$(data_1.get_8xm3sj$(variable), level);\n indicesByLevel.put_xwzc9p$(level, indices);\n }\n var key = variable.name;\n indicesByVarByLevel.put_xwzc9p$(key, indicesByLevel);\n }\n var dataByLevelKey = ArrayList_init();\n tmp$ = nameLevelTuples.iterator();\n while (tmp$.hasNext()) {\n var nameLevelTuple = tmp$.next();\n var topName = first(nameLevelTuple).first;\n var topLevel = first(nameLevelTuple).second;\n var indices_0 = ArrayList_init_0(getValue(getValue(indicesByVarByLevel, topName), topLevel));\n tmp$_0 = nameLevelTuple.size;\n for (var i_0 = 1; i_0 < tmp$_0; i_0++) {\n var name = nameLevelTuple.get_za3lpa$(i_0).first;\n var level_0 = nameLevelTuple.get_za3lpa$(i_0).second;\n var levelIndices = getValue(getValue(indicesByVarByLevel, name), level_0);\n indices_0.retainAll_brywnq$(HashSet_init(levelIndices));\n }\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(nameLevelTuple, 10));\n var tmp$_5;\n tmp$_5 = nameLevelTuple.iterator();\n while (tmp$_5.hasNext()) {\n var item_0 = tmp$_5.next();\n destination_0.add_11rb$(item_0.second);\n }\n var levelKey = destination_0;\n var b = DataFrame$DataFrame$Builder_init();\n var variables = data_1.variables();\n tmp$_1 = variables.iterator();\n while (tmp$_1.hasNext()) {\n var variable_0 = tmp$_1.next();\n var source = data_1.get_8xm3sj$(variable_0);\n var target = data_0.SeriesUtil.pickAtIndices_ge51dg$(source, indices_0);\n b.put_2l962d$(variable_0, target);\n }\n var levelData = b.build();\n dataByLevelKey.add_11rb$(to(levelKey, levelData));\n }\n return dataByLevelKey;\n };\n PlotFacets$Companion.prototype.createNameLevelTuples_5cxrh4$ = function (varNames, varLevels) {\n if (!!varNames.isEmpty()) {\n var message = 'Empty list of facet variables.';\n throw IllegalArgumentException_init(message.toString());\n }if (!(varNames.size === distinct(varNames).size)) {\n var message_0 = 'Facet variables must be distinct, were: ' + varNames + '.';\n throw IllegalArgumentException_init(message_0.toString());\n }if (!(varNames.size === varLevels.size)) {\n var message_1 = 'Check failed.';\n throw IllegalStateException_init(message_1.toString());\n }return this.createNameLevelTuplesIntern_0(varNames, varLevels);\n };\n PlotFacets$Companion.prototype.createNameLevelTuplesIntern_0 = function (varNames, varLevels) {\n var tmp$, tmp$_0;\n var name = first(varNames);\n var levels = first(varLevels);\n var levelKeys = ArrayList_init();\n tmp$ = levels.iterator();\n while (tmp$.hasNext()) {\n var level = tmp$.next();\n if (varNames.size > 1) {\n var subKeys = this.createNameLevelTuples_5cxrh4$(varNames.subList_vux9f0$(1, varNames.size), varLevels.subList_vux9f0$(1, varLevels.size));\n tmp$_0 = subKeys.iterator();\n while (tmp$_0.hasNext()) {\n var subKey = tmp$_0.next();\n levelKeys.add_11rb$(plus(listOf(to(name, level)), subKey));\n }\n } else {\n levelKeys.add_11rb$(listOf(to(name, level)));\n }\n }\n return levelKeys;\n };\n PlotFacets$Companion.prototype.reorderLevels_dyo1lv$ = function (varNames, varLevels, ordering) {\n var orderingByFacet = toMap(zip(varNames, ordering));\n var result = ArrayList_init();\n var i = 0;\n for (var tmp$ = varNames.iterator(); tmp$.hasNext(); ++i) {\n var name = tmp$.next();\n if (i >= varLevels.size)\n break;\n result.add_11rb$(this.reorderVarLevels_pbdvt$(name, varLevels.get_za3lpa$(i), getValue(orderingByFacet, name)));\n }\n return result;\n };\n PlotFacets$Companion.prototype.reorderVarLevels_pbdvt$ = function (name, levels, order) {\n var tmp$, tmp$_0;\n if (name == null)\n return levels;\n Kotlin.isType(tmp$ = levels, List) ? tmp$ : throwCCE();\n if (order < 0)\n tmp$_0 = sortedDescending(levels);\n else\n tmp$_0 = sorted(levels);\n return tmp$_0;\n };\n function PlotFacets$Companion$DEF_FORMATTER$lambda(it) {\n return it.toString();\n }\n PlotFacets$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PlotFacets$Companion_instance = null;\n function PlotFacets$Companion_getInstance() {\n if (PlotFacets$Companion_instance === null) {\n new PlotFacets$Companion();\n }return PlotFacets$Companion_instance;\n }\n function PlotFacets$FacetTileInfo(col, row, colLabs, rowLab, xAxis, yAxis, trueIndex) {\n this.col = col;\n this.row = row;\n this.colLabs = colLabs;\n this.rowLab = rowLab;\n this.xAxis = xAxis;\n this.yAxis = yAxis;\n this.trueIndex = trueIndex;\n }\n PlotFacets$FacetTileInfo.prototype.toString = function () {\n return 'FacetTileInfo(col=' + this.col + ', row=' + this.row + ', colLabs=' + this.colLabs + ', rowLab=' + toString(this.rowLab) + ')';\n };\n PlotFacets$FacetTileInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FacetTileInfo',\n interfaces: []\n };\n PlotFacets.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotFacets',\n interfaces: []\n };\n function PlotGuidesAssemblerUtil() {\n PlotGuidesAssemblerUtil_instance = this;\n }\n PlotGuidesAssemblerUtil.prototype.mappedRenderedAesToCreateGuides_rf697z$ = function (layerTiles, guideOptionsMap) {\n var tmp$;\n if (layerTiles.isLegendDisabled) {\n return emptyList();\n }var result = ArrayList_init();\n tmp$ = layerTiles.renderedAes().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n if (Aes.Companion.noGuideNeeded_896ixz$(aes)) {\n continue;\n }if (layerTiles.hasConstant_896ixz$(aes)) {\n continue;\n }if (!layerTiles.hasBinding_896ixz$(aes)) {\n continue;\n }if (guideOptionsMap.containsKey_11rb$(aes)) {\n if (guideOptionsMap.get_11rb$(aes) === GuideOptions$Companion_getInstance().NONE) {\n continue;\n }}result.add_11rb$(aes);\n }\n return result;\n };\n PlotGuidesAssemblerUtil.prototype.guideTransformedDomainByAes_rf697z$ = function (stitchedLayers, guideOptionsMap) {\n var tmp$, tmp$_0;\n var transformedDomainByAes = HashMap_init();\n var aesSet = this.mappedRenderedAesToCreateGuides_rf697z$(stitchedLayers, guideOptionsMap);\n tmp$ = aesSet.iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n var transformVariable = stitchedLayers.getBinding_896ixz$(aes).variable;\n if (!transformVariable.isTransform) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }var transformedDataRange = stitchedLayers.getDataRange_8xm3sj$(transformVariable);\n if (transformedDataRange != null) {\n var scale_0 = stitchedLayers.getScale_896ixz$(aes);\n if (scale_0.isContinuousDomain && scale_0.hasDomainLimits()) {\n var tmp$_1 = scale.ScaleUtil.transformedDefinedLimits_x4zrm4$(scale_0);\n var scaleLower = tmp$_1.component1()\n , scaleUpper = tmp$_1.component2();\n var lowerEnd = isFinite(scaleLower) ? scaleLower : transformedDataRange.lowerEnd;\n var upperEnd = isFinite(scaleUpper) ? scaleUpper : transformedDataRange.upperEnd;\n tmp$_0 = new ClosedRange(lowerEnd, upperEnd);\n } else {\n tmp$_0 = transformedDataRange;\n }\n var transformedDomain = tmp$_0;\n transformedDomainByAes.put_xwzc9p$(aes, transformedDomain);\n }}\n return transformedDomainByAes;\n };\n PlotGuidesAssemblerUtil.prototype.createColorBarAssembler_mzqjql$ = function (scaleName, aes, dataRangeByAes, scale_0, options, theme) {\n var domain = dataRangeByAes.get_11rb$(aes);\n var domainWithLims = scale.MapperUtil.rangeWithLimitsAfterTransform_5yamkg$(data_0.SeriesUtil.ensureApplicableRange_4am1sd$(domain), scale_0.domainLimits.first, scale_0.domainLimits.second, scale_0.transform);\n var result = new ColorBarAssembler(scaleName, data_0.SeriesUtil.ensureApplicableRange_4am1sd$(domainWithLims), scale_0, theme);\n result.setOptions_p8ufd2$(options);\n return result;\n };\n PlotGuidesAssemblerUtil.prototype.fitsColorBar_k9b7d3$ = function (aes, scale) {\n return aes.isColor && scale.isContinuous;\n };\n PlotGuidesAssemblerUtil.prototype.checkFitsColorBar_k9b7d3$ = function (aes, scale) {\n if (!aes.isColor) {\n var message = 'Color-bar is not applicable to ' + aes + ' aesthetic';\n throw IllegalStateException_init(message.toString());\n }if (!scale.isContinuous) {\n var message_0 = 'Color-bar is only applicable when both domain and color palette are continuous';\n throw IllegalStateException_init(message_0.toString());\n }};\n PlotGuidesAssemblerUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PlotGuidesAssemblerUtil',\n interfaces: []\n };\n var PlotGuidesAssemblerUtil_instance = null;\n function PlotGuidesAssemblerUtil_getInstance() {\n if (PlotGuidesAssemblerUtil_instance === null) {\n new PlotGuidesAssemblerUtil();\n }return PlotGuidesAssemblerUtil_instance;\n }\n function PosProvider() {\n PosProvider$Companion_getInstance();\n }\n function PosProvider$Companion() {\n PosProvider$Companion_instance = this;\n }\n function PosProvider$Companion$wrap$ObjectLiteral(closure$pos) {\n this.closure$pos = closure$pos;\n PosProvider.call(this);\n }\n PosProvider$Companion$wrap$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n return this.closure$pos;\n };\n PosProvider$Companion$wrap$ObjectLiteral.prototype.handlesGroups = function () {\n return this.closure$pos.handlesGroups();\n };\n PosProvider$Companion$wrap$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.wrap_dkjclg$ = function (pos) {\n return new PosProvider$Companion$wrap$ObjectLiteral(pos);\n };\n function PosProvider$Companion$barStack$ObjectLiteral() {\n PosProvider.call(this);\n }\n PosProvider$Companion$barStack$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n return pos.PositionAdjustments.stack_4vnpmn$(ctx.aesthetics, PositionAdjustments$StackingStrategy.SPLIT_POSITIVE_NEGATIVE);\n };\n PosProvider$Companion$barStack$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.STACK.handlesGroups();\n };\n PosProvider$Companion$barStack$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.barStack = function () {\n return new PosProvider$Companion$barStack$ObjectLiteral();\n };\n function PosProvider$Companion$dodge$ObjectLiteral(closure$width) {\n this.closure$width = closure$width;\n PosProvider.call(this);\n }\n PosProvider$Companion$dodge$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n var aesthetics = ctx.aesthetics;\n var groupCount = ctx.groupCount;\n return pos.PositionAdjustments.dodge_vvhcz8$(aesthetics, groupCount, this.closure$width);\n };\n PosProvider$Companion$dodge$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.DODGE.handlesGroups();\n };\n PosProvider$Companion$dodge$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.dodge_yrwdxb$ = function (width) {\n if (width === void 0)\n width = null;\n return new PosProvider$Companion$dodge$ObjectLiteral(width);\n };\n function PosProvider$Companion$fill$ObjectLiteral() {\n PosProvider.call(this);\n }\n PosProvider$Companion$fill$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n return pos.PositionAdjustments.fill_m7huy5$(ctx.aesthetics);\n };\n PosProvider$Companion$fill$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.FILL.handlesGroups();\n };\n PosProvider$Companion$fill$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.fill = function () {\n return new PosProvider$Companion$fill$ObjectLiteral();\n };\n function PosProvider$Companion$jitter$ObjectLiteral(closure$width, closure$height) {\n this.closure$width = closure$width;\n this.closure$height = closure$height;\n PosProvider.call(this);\n }\n PosProvider$Companion$jitter$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n return pos.PositionAdjustments.jitter_jma9l8$(this.closure$width, this.closure$height);\n };\n PosProvider$Companion$jitter$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.JITTER.handlesGroups();\n };\n PosProvider$Companion$jitter$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.jitter_jma9l8$ = function (width, height) {\n return new PosProvider$Companion$jitter$ObjectLiteral(width, height);\n };\n function PosProvider$Companion$nudge$ObjectLiteral(closure$width, closure$height) {\n this.closure$width = closure$width;\n this.closure$height = closure$height;\n PosProvider.call(this);\n }\n PosProvider$Companion$nudge$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n return pos.PositionAdjustments.nudge_jma9l8$(this.closure$width, this.closure$height);\n };\n PosProvider$Companion$nudge$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.NUDGE.handlesGroups();\n };\n PosProvider$Companion$nudge$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.nudge_jma9l8$ = function (width, height) {\n return new PosProvider$Companion$nudge$ObjectLiteral(width, height);\n };\n function PosProvider$Companion$jitterDodge$ObjectLiteral(closure$width, closure$jitterWidth, closure$jitterHeight) {\n this.closure$width = closure$width;\n this.closure$jitterWidth = closure$jitterWidth;\n this.closure$jitterHeight = closure$jitterHeight;\n PosProvider.call(this);\n }\n PosProvider$Companion$jitterDodge$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n var aesthetics = ctx.aesthetics;\n var groupCount = ctx.groupCount;\n return pos.PositionAdjustments.jitterDodge_e2pc44$(aesthetics, groupCount, this.closure$width, this.closure$jitterWidth, this.closure$jitterHeight);\n };\n PosProvider$Companion$jitterDodge$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.JITTER_DODGE.handlesGroups();\n };\n PosProvider$Companion$jitterDodge$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.jitterDodge_xjrefz$ = function (width, jitterWidth, jitterHeight) {\n return new PosProvider$Companion$jitterDodge$ObjectLiteral(width, jitterWidth, jitterHeight);\n };\n PosProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PosProvider$Companion_instance = null;\n function PosProvider$Companion_getInstance() {\n if (PosProvider$Companion_instance === null) {\n new PosProvider$Companion();\n }return PosProvider$Companion_instance;\n }\n PosProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PosProvider',\n interfaces: []\n };\n function StitchedPlotLayers(layers) {\n this.myLayers_0 = null;\n this.myLayers_0 = ArrayList_init_0(layers);\n }\n Object.defineProperty(StitchedPlotLayers.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).legendKeyElementFactory;\n }\n });\n Object.defineProperty(StitchedPlotLayers.prototype, 'aestheticsDefaults', {\n configurable: true,\n get: function () {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).aestheticsDefaults;\n }\n });\n Object.defineProperty(StitchedPlotLayers.prototype, 'isLegendDisabled', {\n configurable: true,\n get: function () {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).isLegendDisabled;\n }\n });\n StitchedPlotLayers.prototype.renderedAes = function () {\n var tmp$;\n if (this.myLayers_0.isEmpty()) {\n tmp$ = emptyList();\n } else\n tmp$ = this.myLayers_0.get_za3lpa$(0).renderedAes();\n return tmp$;\n };\n StitchedPlotLayers.prototype.hasBinding_896ixz$ = function (aes) {\n return !this.myLayers_0.isEmpty() && this.myLayers_0.get_za3lpa$(0).hasBinding_896ixz$(aes);\n };\n StitchedPlotLayers.prototype.hasConstant_896ixz$ = function (aes) {\n return !this.myLayers_0.isEmpty() && this.myLayers_0.get_za3lpa$(0).hasConstant_896ixz$(aes);\n };\n StitchedPlotLayers.prototype.getConstant_31786j$ = function (aes) {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).getConstant_31786j$(aes);\n };\n StitchedPlotLayers.prototype.getBinding_896ixz$ = function (aes) {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).getBinding_31786j$(aes);\n };\n StitchedPlotLayers.prototype.getScale_896ixz$ = function (aes) {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).scaleMap.get_31786j$(aes);\n };\n StitchedPlotLayers.prototype.getScaleMap = function () {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).scaleMap;\n };\n StitchedPlotLayers.prototype.getDataRange_8xm3sj$ = function (var_0) {\n var tmp$;\n if (!this.isNumericData_8xm3sj$(var_0)) {\n var message = 'Not numeric data [' + var_0 + ']';\n throw IllegalStateException_init(message.toString());\n }var result = null;\n tmp$ = this.myLayers_0.iterator();\n while (tmp$.hasNext()) {\n var layer = tmp$.next();\n var range = layer.dataFrame.range_8xm3sj$(var_0);\n result = data_0.SeriesUtil.span_t7esj2$(result, range);\n }\n return result;\n };\n StitchedPlotLayers.prototype.isNumericData_8xm3sj$ = function (var_0) {\n var tmp$;\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }tmp$ = this.myLayers_0.iterator();\n while (tmp$.hasNext()) {\n var layer = tmp$.next();\n if (!layer.dataFrame.isNumeric_8xm3sj$(var_0)) {\n return false;\n }}\n return true;\n };\n StitchedPlotLayers.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StitchedPlotLayers',\n interfaces: []\n };\n function TypedScaleMap(map) {\n TypedScaleMap$Companion_getInstance();\n this.myMap_0 = toMap_0(map);\n }\n function TypedScaleMap$get$lambda$lambda(closure$message) {\n return function () {\n return closure$message;\n };\n }\n TypedScaleMap.prototype.get_31786j$ = function (aes) {\n var tmp$, tmp$_0;\n var tmp$_1;\n if ((tmp$_0 = Kotlin.isType(tmp$ = this.myMap_0.get_11rb$(aes), Scale) ? tmp$ : null) != null)\n tmp$_1 = tmp$_0;\n else {\n var message = 'No scale found for aes: ' + aes;\n TypedScaleMap$Companion_getInstance().LOG_0.error_l35kib$(IllegalStateException_init(message), TypedScaleMap$get$lambda$lambda(message));\n throw IllegalStateException_init(message.toString());\n }\n return tmp$_1;\n };\n TypedScaleMap.prototype.containsKey_896ixz$ = function (aes) {\n return this.myMap_0.containsKey_11rb$(aes);\n };\n TypedScaleMap.prototype.keySet = function () {\n return this.myMap_0.keys;\n };\n function TypedScaleMap$Companion() {\n TypedScaleMap$Companion_instance = this;\n this.LOG_0 = logging.PortableLogging.logger_xo1ogr$(getKClass(TypedScaleMap));\n }\n TypedScaleMap$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TypedScaleMap$Companion_instance = null;\n function TypedScaleMap$Companion_getInstance() {\n if (TypedScaleMap$Companion_instance === null) {\n new TypedScaleMap$Companion();\n }return TypedScaleMap$Companion_instance;\n }\n TypedScaleMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TypedScaleMap',\n interfaces: []\n };\n function TypedScaleProviderMap(map) {\n this.myMap_0 = toMap_0(map);\n }\n TypedScaleProviderMap.prototype.get_31786j$ = function (aes) {\n var tmp$;\n return Kotlin.isType(tmp$ = this.myMap_0.get_11rb$(aes), ScaleProvider) ? tmp$ : throwCCE();\n };\n TypedScaleProviderMap.prototype.containsKey_896ixz$ = function (aes) {\n return this.myMap_0.containsKey_11rb$(aes);\n };\n TypedScaleProviderMap.prototype.keySet = function () {\n return this.myMap_0.keys;\n };\n TypedScaleProviderMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TypedScaleProviderMap',\n interfaces: []\n };\n function FacetGrid(xVar, yVar, xLevels, yLevels, xOrder, yOrder, xFormatter, yFormatter) {\n if (xFormatter === void 0)\n xFormatter = PlotFacets$Companion_getInstance().DEF_FORMATTER;\n if (yFormatter === void 0)\n yFormatter = PlotFacets$Companion_getInstance().DEF_FORMATTER;\n PlotFacets.call(this);\n this.xVar_0 = xVar;\n this.yVar_0 = yVar;\n this.xFormatter_0 = xFormatter;\n this.yFormatter_0 = yFormatter;\n this.isDefined_f95yff$_0 = this.xVar_0 != null || this.yVar_0 != null;\n this.xLevels_0 = PlotFacets$Companion_getInstance().reorderVarLevels_pbdvt$(this.xVar_0, xLevels, xOrder);\n this.yLevels_0 = PlotFacets$Companion_getInstance().reorderVarLevels_pbdvt$(this.yVar_0, yLevels, yOrder);\n var b = xLevels.size;\n this.colCount_bhcvpt$_0 = JsMath.max(1, b);\n var b_0 = yLevels.size;\n this.rowCount_8ohw8b$_0 = JsMath.max(1, b_0);\n this.numTiles_kasr4x$_0 = Kotlin.imul(this.colCount, this.rowCount);\n }\n Object.defineProperty(FacetGrid.prototype, 'isDefined', {\n configurable: true,\n get: function () {\n return this.isDefined_f95yff$_0;\n }\n });\n Object.defineProperty(FacetGrid.prototype, 'colCount', {\n configurable: true,\n get: function () {\n return this.colCount_bhcvpt$_0;\n }\n });\n Object.defineProperty(FacetGrid.prototype, 'rowCount', {\n configurable: true,\n get: function () {\n return this.rowCount_8ohw8b$_0;\n }\n });\n Object.defineProperty(FacetGrid.prototype, 'numTiles', {\n configurable: true,\n get: function () {\n return this.numTiles_kasr4x$_0;\n }\n });\n Object.defineProperty(FacetGrid.prototype, 'variables', {\n configurable: true,\n get: function () {\n return listOfNotNull([this.xVar_0, this.yVar_0]);\n }\n });\n FacetGrid.prototype.dataByTile_dhhkv7$ = function (data) {\n var tmp$;\n var tmp$_0, tmp$_1, tmp$_2;\n if (!this.isDefined) {\n var message = 'dataByTile() called on Undefined plot facets.';\n throw IllegalArgumentException_init(message.toString());\n }tmp$ = listOfNotNull([this.xVar_0, this.yVar_0]);\n tmp$_0 = listOfNotNull([this.xVar_0 != null ? this.xLevels_0 : null, this.yVar_0 != null ? this.yLevels_0 : null]);\n var dataByLevelTupleList = PlotFacets$Companion_getInstance().dataByLevelTuple_w4sfrb$(data, tmp$, tmp$_0);\n var dataByLevelTuple = toMap(dataByLevelTupleList);\n var $receiver = this.xLevels_0;\n var colLevels = $receiver.isEmpty() ? listOf(null) : $receiver;\n var $receiver_0 = this.yLevels_0;\n var rowLevels = $receiver_0.isEmpty() ? listOf(null) : $receiver_0;\n var dataByTile = ArrayList_init();\n tmp$_1 = rowLevels.iterator();\n while (tmp$_1.hasNext()) {\n var rowLevel = tmp$_1.next();\n tmp$_2 = colLevels.iterator();\n while (tmp$_2.hasNext()) {\n var colLevel = tmp$_2.next();\n var levelTuple = listOfNotNull([colLevel, rowLevel]);\n var tileData = getValue(dataByLevelTuple, levelTuple);\n dataByTile.add_11rb$(tileData);\n }\n }\n return dataByTile;\n };\n FacetGrid.prototype.tileInfos = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3;\n var $receiver = this.xLevels_0;\n var $receiver_0 = $receiver.isEmpty() ? listOf(null) : $receiver;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver_0, 10));\n var tmp$_4;\n tmp$_4 = $receiver_0.iterator();\n while (tmp$_4.hasNext()) {\n var item = tmp$_4.next();\n destination.add_11rb$(item != null ? this.xFormatter_0(item) : null);\n }\n var colLabels = destination;\n var $receiver_1 = this.yLevels_0;\n var $receiver_2 = $receiver_1.isEmpty() ? listOf(null) : $receiver_1;\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault($receiver_2, 10));\n var tmp$_5;\n tmp$_5 = $receiver_2.iterator();\n while (tmp$_5.hasNext()) {\n var item_0 = tmp$_5.next();\n destination_0.add_11rb$(item_0 != null ? this.yFormatter_0(item_0) : null);\n }\n var rowLabels = destination_0;\n var infos = ArrayList_init();\n tmp$ = this.rowCount;\n for (var row = 0; row < tmp$; row++) {\n var addColLab = row === 0;\n var hasXAxis = row === (this.rowCount - 1 | 0);\n tmp$_0 = this.colCount;\n for (var col = 0; col < tmp$_0; col++) {\n var addRowLab = col === (this.colCount - 1 | 0);\n var hasYAxis = col === 0;\n if (addColLab) {\n tmp$_3 = (tmp$_2 = (tmp$_1 = colLabels.get_za3lpa$(col)) != null ? listOf(tmp$_1) : null) != null ? tmp$_2 : emptyList();\n } else {\n tmp$_3 = emptyList();\n }\n var colLabs = tmp$_3;\n infos.add_11rb$(new PlotFacets$FacetTileInfo(col, row, colLabs, addRowLab ? rowLabels.get_za3lpa$(row) : null, hasXAxis, hasYAxis, infos.size));\n }\n }\n return infos;\n };\n FacetGrid.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FacetGrid',\n interfaces: [PlotFacets]\n };\n var compareBy$lambda = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n var thenBy$lambda = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (this$thenBy, closure$selector) {\n return function (a, b) {\n var previousCompare = this$thenBy.compare(a, b);\n var tmp$;\n if (previousCompare !== 0)\n tmp$ = previousCompare;\n else {\n var selector = closure$selector;\n tmp$ = compareValues(selector(a), selector(b));\n }\n return tmp$;\n };\n };\n });\n function FacetWrap(facets, levels, nrow, ncol, direction, facetOrdering, facetFormatters) {\n FacetWrap$Companion_getInstance();\n PlotFacets.call(this);\n this.facets_0 = facets;\n this.nrow_0 = nrow;\n this.ncol_0 = ncol;\n this.direction_0 = direction;\n this.facetFormatters_0 = facetFormatters;\n this.isDefined_lws8hd$_0 = true;\n this.levels_0 = PlotFacets$Companion_getInstance().reorderLevels_dyo1lv$(this.facets_0, levels, facetOrdering);\n this.numTiles_a1ir1h$_0 = FacetWrap$Companion_getInstance().numTiles_0(this.facets_0, levels);\n this.shape_0 = FacetWrap$Companion_getInstance().shape_0(this.numTiles, this.ncol_0, this.nrow_0, this.direction_0);\n this.colCount_182vmd$_0 = this.shape_0.first;\n this.rowCount_1ks3v5$_0 = this.shape_0.second;\n this.variables_i11eyv$_0 = this.facets_0;\n }\n Object.defineProperty(FacetWrap.prototype, 'isDefined', {\n configurable: true,\n get: function () {\n return this.isDefined_lws8hd$_0;\n }\n });\n Object.defineProperty(FacetWrap.prototype, 'numTiles', {\n configurable: true,\n get: function () {\n return this.numTiles_a1ir1h$_0;\n }\n });\n Object.defineProperty(FacetWrap.prototype, 'colCount', {\n configurable: true,\n get: function () {\n return this.colCount_182vmd$_0;\n }\n });\n Object.defineProperty(FacetWrap.prototype, 'rowCount', {\n configurable: true,\n get: function () {\n return this.rowCount_1ks3v5$_0;\n }\n });\n Object.defineProperty(FacetWrap.prototype, 'variables', {\n configurable: true,\n get: function () {\n return this.variables_i11eyv$_0;\n }\n });\n FacetWrap.prototype.dataByTile_dhhkv7$ = function (data) {\n var tmp$;\n var dataByLevelTuple = PlotFacets$Companion_getInstance().dataByLevelTuple_w4sfrb$(data, this.variables, this.levels_0);\n var dataByTile = ArrayList_init();\n tmp$ = dataByLevelTuple.iterator();\n while (tmp$.hasNext()) {\n var tmp$_0 = tmp$.next();\n var tileData = tmp$_0.component2();\n dataByTile.add_11rb$(tileData);\n }\n return dataByTile;\n };\n function FacetWrap$tileInfos$toCol(this$FacetWrap) {\n return function (index) {\n var tmp$;\n switch (this$FacetWrap.direction_0.name) {\n case 'H':\n tmp$ = index % this$FacetWrap.colCount;\n break;\n case 'V':\n tmp$ = index / this$FacetWrap.rowCount | 0;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n }\n function FacetWrap$tileInfos$toRow(this$FacetWrap) {\n return function (index) {\n var tmp$;\n switch (this$FacetWrap.direction_0.name) {\n case 'H':\n tmp$ = index / this$FacetWrap.colCount | 0;\n break;\n case 'V':\n tmp$ = index % this$FacetWrap.rowCount;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n }\n function FacetWrap$tileInfos$toIndex(this$FacetWrap) {\n return function (col, row) {\n var tmp$;\n switch (this$FacetWrap.direction_0.name) {\n case 'H':\n tmp$ = Kotlin.imul(row, this$FacetWrap.colCount) + col | 0;\n break;\n case 'V':\n tmp$ = Kotlin.imul(col, this$FacetWrap.rowCount) + row | 0;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n }\n function FacetWrap$tileInfos$isBottom(closure$toIndex, this$FacetWrap) {\n return function (col, row) {\n var nextRowIndex = closure$toIndex(col, row + 1 | 0);\n return (row + 1 | 0) % this$FacetWrap.rowCount === 0 || nextRowIndex >= this$FacetWrap.numTiles;\n };\n }\n function FacetWrap$tileInfos$lambda(it) {\n return it.row;\n }\n function FacetWrap$tileInfos$lambda_0(it) {\n return it.col;\n }\n FacetWrap.prototype.tileInfos = function () {\n var levelTuples = PlotFacets$Companion_getInstance().createNameLevelTuples_5cxrh4$(this.facets_0, this.levels_0);\n var destination = ArrayList_init_1(collectionSizeOrDefault(levelTuples, 10));\n var tmp$;\n tmp$ = levelTuples.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_0 = destination.add_11rb$;\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(item, 10));\n var tmp$_1;\n tmp$_1 = item.iterator();\n while (tmp$_1.hasNext()) {\n var item_0 = tmp$_1.next();\n destination_0.add_11rb$(item_0.second);\n }\n tmp$_0.call(destination, destination_0);\n }\n var destination_1 = ArrayList_init_1(collectionSizeOrDefault(destination, 10));\n var tmp$_2;\n tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var item_1 = tmp$_2.next();\n var tmp$_3 = destination_1.add_11rb$;\n var destination_2 = ArrayList_init_1(collectionSizeOrDefault(item_1, 10));\n var tmp$_4, tmp$_0_0;\n var index = 0;\n tmp$_4 = item_1.iterator();\n while (tmp$_4.hasNext()) {\n var item_2 = tmp$_4.next();\n destination_2.add_11rb$(this.facetFormatters_0.get_za3lpa$(checkIndexOverflow((tmp$_0_0 = index, index = tmp$_0_0 + 1 | 0, tmp$_0_0)))(item_2));\n }\n tmp$_3.call(destination_1, destination_2);\n }\n var tileLabels = destination_1;\n var toCol = FacetWrap$tileInfos$toCol(this);\n var toRow = FacetWrap$tileInfos$toRow(this);\n var toIndex = FacetWrap$tileInfos$toIndex(this);\n var isBottom = FacetWrap$tileInfos$isBottom(toIndex, this);\n var infos = ArrayList_init();\n var i = 0;\n for (var tmp$_5 = tileLabels.iterator(); tmp$_5.hasNext(); ++i) {\n var tileLabelTuple = tmp$_5.next();\n var col = toCol(i);\n var row = toRow(i);\n var hasXAxis = isBottom(col, row);\n var hasYAxis = col === 0;\n infos.add_11rb$(new PlotFacets$FacetTileInfo(col, row, tileLabelTuple, null, hasXAxis, hasYAxis, i));\n }\n return sortedWith(infos, new Comparator(thenBy$lambda(new Comparator(compareBy$lambda(FacetWrap$tileInfos$lambda)), FacetWrap$tileInfos$lambda_0)));\n };\n function FacetWrap$Direction(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function FacetWrap$Direction_initFields() {\n FacetWrap$Direction_initFields = function () {\n };\n FacetWrap$Direction$H_instance = new FacetWrap$Direction('H', 0);\n FacetWrap$Direction$V_instance = new FacetWrap$Direction('V', 1);\n }\n var FacetWrap$Direction$H_instance;\n function FacetWrap$Direction$H_getInstance() {\n FacetWrap$Direction_initFields();\n return FacetWrap$Direction$H_instance;\n }\n var FacetWrap$Direction$V_instance;\n function FacetWrap$Direction$V_getInstance() {\n FacetWrap$Direction_initFields();\n return FacetWrap$Direction$V_instance;\n }\n FacetWrap$Direction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Direction',\n interfaces: [Enum]\n };\n function FacetWrap$Direction$values() {\n return [FacetWrap$Direction$H_getInstance(), FacetWrap$Direction$V_getInstance()];\n }\n FacetWrap$Direction.values = FacetWrap$Direction$values;\n function FacetWrap$Direction$valueOf(name) {\n switch (name) {\n case 'H':\n return FacetWrap$Direction$H_getInstance();\n case 'V':\n return FacetWrap$Direction$V_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.assemble.facet.FacetWrap.Direction.' + name);\n }\n }\n FacetWrap$Direction.valueOf_61zpoe$ = FacetWrap$Direction$valueOf;\n function FacetWrap$Companion() {\n FacetWrap$Companion_instance = this;\n }\n FacetWrap$Companion.prototype.numTiles_0 = function (facets, levels) {\n if (!!facets.isEmpty()) {\n var message = 'List of facets is empty.';\n throw IllegalArgumentException_init(message.toString());\n }if (!(distinct(facets).size === facets.size)) {\n var message_0 = 'Duplicated values in the facets list: ' + facets;\n throw IllegalArgumentException_init(message_0.toString());\n }if (!(facets.size === levels.size)) {\n var message_1 = 'Check failed.';\n throw IllegalStateException_init(message_1.toString());\n }return PlotFacets$Companion_getInstance().createNameLevelTuples_5cxrh4$(facets, levels).size;\n };\n function FacetWrap$Companion$shape$lambda(closure$ncol) {\n return function () {\n return \"'ncol' must be positive, was \" + toString(closure$ncol);\n };\n }\n function FacetWrap$Companion$shape$lambda_0(closure$nrow) {\n return function () {\n return \"'nrow' must be positive, was \" + toString(closure$nrow);\n };\n }\n FacetWrap$Companion.prototype.shape_0 = function (tilesCount, ncol, nrow, dir) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (!((tmp$ = ncol != null ? ncol > 0 : null) != null ? tmp$ : true)) {\n var message = FacetWrap$Companion$shape$lambda(ncol)();\n throw IllegalArgumentException_init(message.toString());\n }if (!((tmp$_0 = nrow != null ? nrow > 0 : null) != null ? tmp$_0 : true)) {\n var message_0 = FacetWrap$Companion$shape$lambda_0(nrow)();\n throw IllegalArgumentException_init(message_0.toString());\n }if (ncol != null) {\n var ncolActual = JsMath.min(ncol, tilesCount);\n var x = tilesCount / ncolActual;\n var nrowActual = numberToInt(JsMath.ceil(x));\n tmp$_1 = to(ncolActual, JsMath.max(1, nrowActual));\n } else if (nrow != null) {\n var nrowActual_0 = JsMath.min(nrow, tilesCount);\n var x_0 = tilesCount / nrowActual_0;\n var ncolActual_0 = numberToInt(JsMath.ceil(x_0));\n tmp$_1 = to(ncolActual_0, JsMath.max(1, nrowActual_0));\n } else {\n var b = tilesCount / 2 | 0;\n var b_0 = JsMath.max(1, b);\n var w = JsMath.min(4, b_0);\n var x_1 = tilesCount / w;\n var b_1 = numberToInt(JsMath.ceil(x_1));\n var h = JsMath.max(1, b_1);\n tmp$_1 = to(w, h);\n }\n var shape = tmp$_1;\n var w_0 = shape.component1()\n , h_0 = shape.component2();\n switch (dir.name) {\n case 'H':\n var x_2 = tilesCount / w_0;\n tmp$_2 = new Pair_0(w_0, numberToInt(JsMath.ceil(x_2)));\n break;\n case 'V':\n var x_3 = tilesCount / h_0;\n tmp$_2 = new Pair_0(numberToInt(JsMath.ceil(x_3)), h_0);\n break;\n default:tmp$_2 = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$_2;\n };\n FacetWrap$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var FacetWrap$Companion_instance = null;\n function FacetWrap$Companion_getInstance() {\n if (FacetWrap$Companion_instance === null) {\n new FacetWrap$Companion();\n }return FacetWrap$Companion_instance;\n }\n FacetWrap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FacetWrap',\n interfaces: [PlotFacets]\n };\n function DefaultSampling() {\n DefaultSampling_instance = this;\n this.SEED_0 = L37;\n this.SAFETY_SAMPLING = Samplings_getInstance().random_280ow0$(200000, this.SEED_0);\n this.POINT = Samplings_getInstance().random_280ow0$(50000, this.SEED_0);\n this.TILE = Samplings_getInstance().random_280ow0$(50000, this.SEED_0);\n this.BIN_2D = this.TILE;\n this.AB_LINE = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.H_LINE = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.V_LINE = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.JITTER = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.RECT = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.SEGMENT = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.TEXT = Samplings_getInstance().random_280ow0$(500, this.SEED_0);\n this.ERROR_BAR = Samplings_getInstance().random_280ow0$(500, this.SEED_0);\n this.CROSS_BAR = Samplings_getInstance().random_280ow0$(500, this.SEED_0);\n this.LINE_RANGE = Samplings_getInstance().random_280ow0$(500, this.SEED_0);\n this.POINT_RANGE = Samplings_getInstance().random_280ow0$(500, this.SEED_0);\n this.BAR = Samplings_getInstance().pick_za3lpa$(50);\n this.HISTOGRAM = Samplings_getInstance().systematic_za3lpa$(500);\n this.LINE = Samplings_getInstance().systematic_za3lpa$(5000);\n this.RIBBON = Samplings_getInstance().systematic_za3lpa$(5000);\n this.AREA = Samplings_getInstance().systematic_za3lpa$(5000);\n this.DENSITY = Samplings_getInstance().systematic_za3lpa$(5000);\n this.FREQPOLY = Samplings_getInstance().systematic_za3lpa$(5000);\n this.STEP = Samplings_getInstance().systematic_za3lpa$(5000);\n this.PATH = Samplings_getInstance().vertexDp_za3lpa$(20000);\n this.POLYGON = Samplings_getInstance().vertexDp_za3lpa$(20000);\n this.MAP = Samplings_getInstance().vertexDp_za3lpa$(20000);\n this.SMOOTH = Samplings_getInstance().systematicGroup_za3lpa$(200);\n this.CONTOUR = Samplings_getInstance().systematicGroup_za3lpa$(200);\n this.CONTOURF = Samplings_getInstance().systematicGroup_za3lpa$(200);\n this.DENSITY2D = Samplings_getInstance().systematicGroup_za3lpa$(200);\n this.DENSITY2DF = Samplings_getInstance().systematicGroup_za3lpa$(200);\n }\n DefaultSampling.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DefaultSampling',\n interfaces: []\n };\n var DefaultSampling_instance = null;\n function DefaultSampling_getInstance() {\n if (DefaultSampling_instance === null) {\n new DefaultSampling();\n }return DefaultSampling_instance;\n }\n function GeomProvider(geomKind) {\n GeomProvider$Companion_getInstance();\n this.geomKind = geomKind;\n }\n Object.defineProperty(GeomProvider.prototype, 'preferredCoordinateSystem', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('No preferred coordinate system');\n }\n });\n GeomProvider.prototype.renders = function () {\n return base_0.GeomMeta.renders_7dhqpi$(this.geomKind);\n };\n function GeomProvider$GeomProviderBuilder(myKind, myAestheticsDefaults, myHandlesGroups, myGeomSupplier) {\n this.myKind_0 = myKind;\n this.myAestheticsDefaults_0 = myAestheticsDefaults;\n this.myHandlesGroups_0 = myHandlesGroups;\n this.myGeomSupplier_0 = myGeomSupplier;\n }\n function GeomProvider$GeomProviderBuilder$build$ObjectLiteral(this$GeomProviderBuilder, geomKind) {\n this.this$GeomProviderBuilder = this$GeomProviderBuilder;\n GeomProvider.call(this, geomKind);\n }\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.prototype.createGeom = function () {\n return this.this$GeomProviderBuilder.myGeomSupplier_0();\n };\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.prototype.aestheticsDefaults = function () {\n return this.this$GeomProviderBuilder.myAestheticsDefaults_0;\n };\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.prototype.handlesGroups = function () {\n return this.this$GeomProviderBuilder.myHandlesGroups_0;\n };\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [GeomProvider]\n };\n GeomProvider$GeomProviderBuilder.prototype.build_8be2vx$ = function () {\n return new GeomProvider$GeomProviderBuilder$build$ObjectLiteral(this, this.myKind_0);\n };\n GeomProvider$GeomProviderBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomProviderBuilder',\n interfaces: []\n };\n function GeomProvider$Companion() {\n GeomProvider$Companion_instance = this;\n }\n function GeomProvider$Companion$point$lambda() {\n return new PointGeom();\n }\n GeomProvider$Companion.prototype.point = function () {\n return this.point_8j1y0m$(GeomProvider$Companion$point$lambda);\n };\n GeomProvider$Companion.prototype.point_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.POINT, AestheticsDefaults.Companion.point(), PointGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$path$lambda() {\n return new PathGeom();\n }\n GeomProvider$Companion.prototype.path = function () {\n return this.path_8j1y0m$(GeomProvider$Companion$path$lambda);\n };\n GeomProvider$Companion.prototype.path_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.PATH, AestheticsDefaults.Companion.path(), PathGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$line$lambda() {\n return new LineGeom();\n }\n GeomProvider$Companion.prototype.line = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.LINE, AestheticsDefaults.Companion.line(), LineGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$line$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$smooth$lambda() {\n return new SmoothGeom();\n }\n GeomProvider$Companion.prototype.smooth = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.SMOOTH, AestheticsDefaults.Companion.smooth(), SmoothGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$smooth$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$bar$lambda() {\n return new BarGeom();\n }\n GeomProvider$Companion.prototype.bar = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.BAR, AestheticsDefaults.Companion.bar(), BarGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$bar$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$histogram$lambda() {\n return new HistogramGeom();\n }\n GeomProvider$Companion.prototype.histogram = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.HISTOGRAM, AestheticsDefaults.Companion.histogram(), HistogramGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$histogram$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$tile$lambda() {\n return new TileGeom();\n }\n GeomProvider$Companion.prototype.tile = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.TILE, AestheticsDefaults.Companion.tile(), TileGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$tile$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$bin2d$lambda() {\n return new Bin2dGeom();\n }\n GeomProvider$Companion.prototype.bin2d = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.BIN_2D, AestheticsDefaults.Companion.bin2d(), Bin2dGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$bin2d$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$errorBar$lambda() {\n return new ErrorBarGeom();\n }\n GeomProvider$Companion.prototype.errorBar = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.ERROR_BAR, AestheticsDefaults.Companion.errorBar(), ErrorBarGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$errorBar$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.crossBar_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.CROSS_BAR, AestheticsDefaults.Companion.crossBar(), CrossBarGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$lineRange$lambda() {\n return new LineRangeGeom();\n }\n GeomProvider$Companion.prototype.lineRange = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.LINE_RANGE, AestheticsDefaults.Companion.lineRange(), LineRangeGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$lineRange$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.pointRange_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.POINT_RANGE, AestheticsDefaults.Companion.pointRange(), PointRangeGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$contour$lambda() {\n return new ContourGeom();\n }\n GeomProvider$Companion.prototype.contour = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.CONTOUR, AestheticsDefaults.Companion.contour(), ContourGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$contour$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$contourf$lambda() {\n return new ContourfGeom();\n }\n GeomProvider$Companion.prototype.contourf = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.CONTOURF, AestheticsDefaults.Companion.contourf(), ContourfGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$contourf$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$polygon$lambda() {\n return new PolygonGeom();\n }\n GeomProvider$Companion.prototype.polygon = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.POLYGON, AestheticsDefaults.Companion.polygon(), PolygonGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$polygon$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$map$lambda() {\n return new MapGeom();\n }\n GeomProvider$Companion.prototype.map = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.MAP, AestheticsDefaults.Companion.map(), MapGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$map$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$abline$lambda() {\n return new ABLineGeom();\n }\n GeomProvider$Companion.prototype.abline = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.AB_LINE, AestheticsDefaults.Companion.abline(), ABLineGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$abline$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$hline$lambda() {\n return new HLineGeom();\n }\n GeomProvider$Companion.prototype.hline = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.H_LINE, AestheticsDefaults.Companion.hline(), HLineGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$hline$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$vline$lambda() {\n return new VLineGeom();\n }\n GeomProvider$Companion.prototype.vline = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.V_LINE, AestheticsDefaults.Companion.vline(), VLineGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$vline$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.boxplot_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.BOX_PLOT, AestheticsDefaults.Companion.boxplot(), BoxplotGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$livemap$lambda(closure$options) {\n return function () {\n return new LiveMapGeom(closure$options.displayMode);\n };\n }\n GeomProvider$Companion.prototype.livemap_d2y5pu$ = function (options) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.LIVE_MAP, AestheticsDefaults.Companion.livemap_cx3y7u$(options.displayMode), LiveMapGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$livemap$lambda(options))).build_8be2vx$();\n };\n function GeomProvider$Companion$ribbon$lambda() {\n return new RibbonGeom();\n }\n GeomProvider$Companion.prototype.ribbon = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.RIBBON, AestheticsDefaults.Companion.ribbon(), RibbonGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$ribbon$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$area$lambda() {\n return new AreaGeom();\n }\n GeomProvider$Companion.prototype.area = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.AREA, AestheticsDefaults.Companion.area(), AreaGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$area$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$density$lambda() {\n return new DensityGeom();\n }\n GeomProvider$Companion.prototype.density = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.DENSITY, AestheticsDefaults.Companion.density(), DensityGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$density$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$density2d$lambda() {\n return new Density2dGeom();\n }\n GeomProvider$Companion.prototype.density2d = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.DENSITY2D, AestheticsDefaults.Companion.density2d(), Density2dGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$density2d$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$density2df$lambda() {\n return new Density2dfGeom();\n }\n GeomProvider$Companion.prototype.density2df = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.DENSITY2DF, AestheticsDefaults.Companion.density2df(), Density2dfGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$density2df$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$jitter$lambda() {\n return new JitterGeom();\n }\n GeomProvider$Companion.prototype.jitter = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.JITTER, AestheticsDefaults.Companion.jitter(), JitterGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$jitter$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$freqpoly$lambda() {\n return new FreqpolyGeom();\n }\n GeomProvider$Companion.prototype.freqpoly = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.FREQPOLY, AestheticsDefaults.Companion.freqpoly(), FreqpolyGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$freqpoly$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.step_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.STEP, AestheticsDefaults.Companion.step(), StepGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$rect$lambda() {\n return new RectGeom();\n }\n GeomProvider$Companion.prototype.rect = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.RECT, AestheticsDefaults.Companion.rect(), RectGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$rect$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.segment_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.SEGMENT, AestheticsDefaults.Companion.segment(), SegmentGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.text_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.TEXT, AestheticsDefaults.Companion.text(), TextGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$raster$lambda() {\n return new RasterGeom();\n }\n GeomProvider$Companion.prototype.raster = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.RASTER, AestheticsDefaults.Companion.raster(), RasterGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$raster$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.image_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.IMAGE, AestheticsDefaults.Companion.image(), ImageGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n GeomProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomProvider$Companion_instance = null;\n function GeomProvider$Companion_getInstance() {\n if (GeomProvider$Companion_instance === null) {\n new GeomProvider$Companion();\n }return GeomProvider$Companion_instance;\n }\n GeomProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomProvider',\n interfaces: []\n };\n function PointDataAccess(data, bindings, scaleMap) {\n this.data_0 = data;\n this.mappedAes_tolgcu$_0 = HashSet_init(bindings.keys);\n this.scaleByAes_c9kkhw$_0 = PointDataAccess$scaleByAes$lambda(scaleMap);\n this.myBindings_0 = toMap_0(bindings);\n this.myFormatters_0 = HashMap_init();\n }\n Object.defineProperty(PointDataAccess.prototype, 'mappedAes', {\n configurable: true,\n get: function () {\n return this.mappedAes_tolgcu$_0;\n }\n });\n Object.defineProperty(PointDataAccess.prototype, 'scaleByAes', {\n configurable: true,\n get: function () {\n return this.scaleByAes_c9kkhw$_0;\n }\n });\n PointDataAccess.prototype.isMapped_896ixz$ = function (aes) {\n return this.myBindings_0.containsKey_11rb$(aes);\n };\n PointDataAccess.prototype.getMappedData_pkitv1$ = function (aes, index) {\n var originalValue = this.getOriginalValue_pkitv1$(aes, index);\n var scale = this.getScale_0(aes);\n var value = this.formatter_0(aes)(originalValue);\n return new MappedDataAccess$MappedData(scale.name, value, scale.isContinuous);\n };\n PointDataAccess.prototype.getOriginalValue_pkitv1$ = function (aes, index) {\n if (!this.isMapped_896ixz$(aes)) {\n var message = 'Not mapped: ' + aes;\n throw IllegalArgumentException_init(message.toString());\n }var binding = getValue(this.myBindings_0, aes);\n var scale = this.getScale_0(aes);\n var value = this.data_0.getNumeric_8xm3sj$(binding.variable).get_za3lpa$(index);\n return scale.transform.applyInverse_yrwdxb$(value);\n };\n PointDataAccess.prototype.getMappedDataLabel_896ixz$ = function (aes) {\n return this.getScale_0(aes).name;\n };\n PointDataAccess.prototype.isMappedDataContinuous_896ixz$ = function (aes) {\n return this.getScale_0(aes).isContinuous;\n };\n PointDataAccess.prototype.getScale_0 = function (aes) {\n return this.scaleByAes(aes);\n };\n PointDataAccess.prototype.formatter_0 = function (aes) {\n var scale = this.getScale_0(aes);\n var $receiver = this.myFormatters_0;\n var tmp$;\n var value = $receiver.get_11rb$(aes);\n if (value == null) {\n var answer = this.createFormatter_0(aes, scale);\n $receiver.put_xwzc9p$(aes, answer);\n tmp$ = answer;\n } else {\n tmp$ = value;\n }\n return tmp$;\n };\n function PointDataAccess$createFormatter$lambda(closure$formatter) {\n return function (value) {\n var tmp$;\n var tmp$_0;\n tmp$_0 = value != null ? closure$formatter(value) : null;\n return (tmp$ = tmp$_0) != null ? tmp$ : 'n/a';\n };\n }\n function PointDataAccess$createFormatter$lambda_0(closure$labelsMap) {\n return function (value) {\n var tmp$;\n var tmp$_0;\n tmp$_0 = value != null ? getValue(closure$labelsMap, value) : null;\n return (tmp$ = tmp$_0) != null ? tmp$ : 'n/a';\n };\n }\n PointDataAccess.prototype.createFormatter_0 = function (aes, scale_0) {\n if (scale_0.isContinuousDomain) {\n var $receiver = getValue(this.myBindings_0, aes).variable;\n var $receiver_0 = getCallableRef('range', function ($receiver, p1) {\n return $receiver.range_8xm3sj$(p1);\n }.bind(null, this.data_0))($receiver);\n var domain = data_0.SeriesUtil.ensureApplicableRange_4am1sd$($receiver_0);\n var formatter = scale_0.breaksGenerator.labelFormatter_1tlvto$(domain, 100);\n return PointDataAccess$createFormatter$lambda(formatter);\n } else {\n var labelsMap = scale.ScaleUtil.labelByBreak_x4zrm4$(scale_0);\n return PointDataAccess$createFormatter$lambda_0(labelsMap);\n }\n };\n function PointDataAccess$scaleByAes$lambda(closure$scaleMap) {\n return function (it) {\n return closure$scaleMap.get_31786j$(it);\n };\n }\n PointDataAccess.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointDataAccess',\n interfaces: [MappedDataAccess]\n };\n function CartesianCoordProvider(xLim, yLim) {\n CoordProviderBase.call(this, xLim, yLim);\n }\n CartesianCoordProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CartesianCoordProvider',\n interfaces: [CoordProviderBase]\n };\n function CoordProvider() {\n }\n CoordProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'CoordProvider',\n interfaces: []\n };\n function CoordProviderBase(xLim, yLim) {\n CoordProviderBase$Companion_getInstance();\n this.xLim_0 = xLim;\n this.yLim_0 = yLim;\n }\n CoordProviderBase.prototype.buildAxisScaleX_hcz7zd$ = function (scaleProto, domain, axisLength, breaks) {\n return CoordProviderBase$Companion_getInstance().buildAxisScaleDefault_0(scaleProto, domain, axisLength, breaks);\n };\n CoordProviderBase.prototype.buildAxisScaleY_hcz7zd$ = function (scaleProto, domain, axisLength, breaks) {\n return CoordProviderBase$Companion_getInstance().buildAxisScaleDefault_0(scaleProto, domain, axisLength, breaks);\n };\n CoordProviderBase.prototype.createCoordinateSystem_uncllg$ = function (xDomain, xAxisLength, yDomain, yAxisLength) {\n var tmp$, tmp$_0;\n var mapperX = CoordProviderBase$Companion_getInstance().linearMapper_mdyssk$(xDomain, xAxisLength);\n var mapperY = CoordProviderBase$Companion_getInstance().linearMapper_mdyssk$(yDomain, yAxisLength);\n return coord.Coords.create_wd6eaa$(scale.MapperUtil.map_rejkqi$(xDomain, mapperX), scale.MapperUtil.map_rejkqi$(yDomain, mapperY), (tmp$ = this.xLim_0) != null ? scale.MapperUtil.map_rejkqi$(tmp$, mapperX) : null, (tmp$_0 = this.yLim_0) != null ? scale.MapperUtil.map_rejkqi$(tmp$_0, mapperY) : null);\n };\n CoordProviderBase.prototype.adjustDomains_jz8wgn$ = function (xDomain, yDomain, displaySize) {\n var tmp$, tmp$_0;\n return new Pair((tmp$ = this.xLim_0) != null ? tmp$ : xDomain, (tmp$_0 = this.yLim_0) != null ? tmp$_0 : yDomain);\n };\n function CoordProviderBase$Companion() {\n CoordProviderBase$Companion_instance = this;\n }\n CoordProviderBase$Companion.prototype.linearMapper_mdyssk$ = function (domain, axisLength) {\n return scale.Mappers.mul_mdyssk$(domain, axisLength);\n };\n CoordProviderBase$Companion.prototype.buildAxisScaleDefault_0 = function (scaleProto, domain, axisLength, breaks) {\n return this.buildAxisScaleDefault_8w5bx$(scaleProto, this.linearMapper_mdyssk$(domain, axisLength), breaks);\n };\n CoordProviderBase$Companion.prototype.buildAxisScaleDefault_8w5bx$ = function (scaleProto, axisMapper, breaks) {\n return scaleProto.with().breaks_pqjuzw$(breaks.domainValues).labels_mhpeer$(breaks.labels).mapper_1uitho$(axisMapper).build();\n };\n CoordProviderBase$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var CoordProviderBase$Companion_instance = null;\n function CoordProviderBase$Companion_getInstance() {\n if (CoordProviderBase$Companion_instance === null) {\n new CoordProviderBase$Companion();\n }return CoordProviderBase$Companion_instance;\n }\n CoordProviderBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CoordProviderBase',\n interfaces: [CoordProvider]\n };\n function CoordProviders() {\n CoordProviders_instance = this;\n }\n CoordProviders.prototype.cartesian_t7esj2$ = function (xLim, yLim) {\n if (xLim === void 0)\n xLim = null;\n if (yLim === void 0)\n yLim = null;\n return new CartesianCoordProvider(xLim, yLim);\n };\n CoordProviders.prototype.fixed_vvp5j4$ = function (ratio, xLim, yLim) {\n if (xLim === void 0)\n xLim = null;\n if (yLim === void 0)\n yLim = null;\n return new FixedRatioCoordProvider(ratio, xLim, yLim);\n };\n CoordProviders.prototype.map_t7esj2$ = function (xLim, yLim) {\n if (xLim === void 0)\n xLim = null;\n if (yLim === void 0)\n yLim = null;\n return new ProjectionCoordProvider(new MercatorProjectionX(), new MercatorProjectionY(), xLim, yLim);\n };\n CoordProviders.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'CoordProviders',\n interfaces: []\n };\n var CoordProviders_instance = null;\n function CoordProviders_getInstance() {\n if (CoordProviders_instance === null) {\n new CoordProviders();\n }return CoordProviders_instance;\n }\n function FixedRatioCoordProvider(ratio, xLim, yLim) {\n CoordProviderBase.call(this, xLim, yLim);\n this.ratio_0 = ratio;\n }\n FixedRatioCoordProvider.prototype.adjustDomains_jz8wgn$ = function (xDomain, yDomain, displaySize) {\n var adjusted = CoordProviderBase.prototype.adjustDomains_jz8wgn$.call(this, xDomain, yDomain, displaySize);\n var xDomain_0 = adjusted.first;\n var yDomain_0 = adjusted.second;\n var spanX = data_0.SeriesUtil.span_4fzjta$(xDomain_0);\n var spanY = data_0.SeriesUtil.span_4fzjta$(yDomain_0);\n if (spanX < data_0.SeriesUtil.TINY || spanY < data_0.SeriesUtil.TINY) {\n return new Pair(xDomain_0, yDomain_0);\n }var displayW = displaySize.x;\n var displayH = displaySize.y;\n if (this.ratio_0 > 1) {\n displayW *= this.ratio_0;\n } else {\n displayH *= 1 / this.ratio_0;\n }\n var ratioX = spanX / displayW;\n var ratioY = spanY / displayH;\n if (ratioX > ratioY) {\n var spanAdjusted = displayH * ratioX;\n yDomain_0 = data_0.SeriesUtil.expand_mdyssk$(yDomain_0, spanAdjusted);\n } else {\n var spanAdjusted_0 = displayW * ratioY;\n xDomain_0 = data_0.SeriesUtil.expand_mdyssk$(xDomain_0, spanAdjusted_0);\n }\n return new Pair(xDomain_0, yDomain_0);\n };\n FixedRatioCoordProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FixedRatioCoordProvider',\n interfaces: [CoordProviderBase]\n };\n function ProjectionCoordProvider(projectionX, projectionY, xLim, yLim) {\n ProjectionCoordProvider$Companion_getInstance();\n CoordProviderBase.call(this, xLim, yLim);\n this.projectionX_0 = projectionX;\n this.projectionY_0 = projectionY;\n }\n ProjectionCoordProvider.prototype.adjustDomains_jz8wgn$ = function (xDomain, yDomain, displaySize) {\n var tmp$;\n var adjusted = CoordProviderBase.prototype.adjustDomains_jz8wgn$.call(this, xDomain, yDomain, displaySize);\n var xDomain_0 = this.projectionX_0.toValidDomain_4fzjta$(adjusted.first);\n var yDomain_0 = this.projectionY_0.toValidDomain_4fzjta$(adjusted.second);\n var spanX = data_0.SeriesUtil.span_4fzjta$(xDomain_0);\n var spanY = data_0.SeriesUtil.span_4fzjta$(yDomain_0);\n if (spanX > spanY) {\n var center = xDomain_0.lowerEnd + spanX / 2;\n var halfSpan = spanY / 2;\n tmp$ = new Pair(new ClosedRange(center - halfSpan, center + halfSpan), yDomain_0);\n } else {\n var center_0 = yDomain_0.lowerEnd + spanY / 2;\n var halfSpan_0 = spanX / 2;\n tmp$ = new Pair(xDomain_0, new ClosedRange(center_0 - halfSpan_0, center_0 + halfSpan_0));\n }\n var domainSquare = tmp$;\n var projectedXMin = this.projectionX_0.apply_14dthe$(domainSquare.first.lowerEnd);\n var projectedXMax = this.projectionX_0.apply_14dthe$(domainSquare.first.upperEnd);\n var projectedYMin = this.projectionY_0.apply_14dthe$(domainSquare.second.lowerEnd);\n var projectedYMax = this.projectionY_0.apply_14dthe$(domainSquare.second.upperEnd);\n var ratio = (projectedYMax - projectedYMin) / (projectedXMax - projectedXMin);\n var fixedCoord = new FixedRatioCoordProvider(ratio, null, null);\n return fixedCoord.adjustDomains_jz8wgn$(xDomain_0, yDomain_0, displaySize);\n };\n ProjectionCoordProvider.prototype.buildAxisScaleX_hcz7zd$ = function (scaleProto, domain, axisLength, breaks) {\n var tmp$;\n if (this.projectionX_0.nonlinear) {\n tmp$ = ProjectionCoordProvider$Companion_getInstance().buildAxisScaleWithProjection_0(this.projectionX_0, scaleProto, domain, axisLength, breaks);\n } else {\n tmp$ = CoordProviderBase.prototype.buildAxisScaleX_hcz7zd$.call(this, scaleProto, domain, axisLength, breaks);\n }\n return tmp$;\n };\n ProjectionCoordProvider.prototype.buildAxisScaleY_hcz7zd$ = function (scaleProto, domain, axisLength, breaks) {\n var tmp$;\n if (this.projectionY_0.nonlinear) {\n tmp$ = ProjectionCoordProvider$Companion_getInstance().buildAxisScaleWithProjection_0(this.projectionY_0, scaleProto, domain, axisLength, breaks);\n } else {\n tmp$ = CoordProviderBase.prototype.buildAxisScaleY_hcz7zd$.call(this, scaleProto, domain, axisLength, breaks);\n }\n return tmp$;\n };\n function ProjectionCoordProvider$Companion() {\n ProjectionCoordProvider$Companion_instance = this;\n }\n ProjectionCoordProvider$Companion.prototype.buildAxisScaleWithProjection_0 = function (projection, scaleProto, domain, axisLength, breaks) {\n var validDomain = projection.toValidDomain_4fzjta$(domain);\n var validDomainProjected = new ClosedRange(projection.apply_14dthe$(validDomain.lowerEnd), projection.apply_14dthe$(validDomain.upperEnd));\n var projectionInverse = scale.Mappers.linear_1jkouz$(validDomainProjected, validDomain);\n var linearMapper = CoordProviderBase$Companion_getInstance().linearMapper_mdyssk$(domain, axisLength);\n var scaleMapper = this.twistScaleMapper_0(projection, projectionInverse, linearMapper);\n var validBreaks = this.validateBreaks_0(validDomain, breaks);\n return CoordProviderBase$Companion_getInstance().buildAxisScaleDefault_8w5bx$(scaleProto, scaleMapper, validBreaks);\n };\n ProjectionCoordProvider$Companion.prototype.validateBreaks_0 = function (validDomain, breaks) {\n var tmp$;\n var validIndices = ArrayList_init();\n var i = 0;\n tmp$ = breaks.domainValues.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (typeof v === 'number' && validDomain.contains_mef7kx$(v)) {\n validIndices.add_11rb$(i);\n }i = i + 1 | 0;\n }\n if (validIndices.size === breaks.domainValues.size) {\n return breaks;\n }var validDomainValues = data_0.SeriesUtil.pickAtIndices_ge51dg$(breaks.domainValues, validIndices);\n var validLabels = data_0.SeriesUtil.pickAtIndices_ge51dg$(breaks.labels, validIndices);\n var validTransformedValues = data_0.SeriesUtil.pickAtIndices_ge51dg$(breaks.transformedValues, validIndices);\n return new GuideBreaks(validDomainValues, validTransformedValues, validLabels);\n };\n function ProjectionCoordProvider$Companion$twistScaleMapper$lambda(closure$projection, closure$projectionInverse, closure$scaleMapper) {\n return function (v) {\n var tmp$;\n if (v != null) {\n var closure$projection_0 = closure$projection;\n var closure$projectionInverse_0 = closure$projectionInverse;\n var closure$scaleMapper_0 = closure$scaleMapper;\n var projected = closure$projection_0.apply_14dthe$(v);\n var unProjected = closure$projectionInverse_0(projected);\n tmp$ = closure$scaleMapper_0(unProjected);\n } else\n tmp$ = null;\n return tmp$;\n };\n }\n ProjectionCoordProvider$Companion.prototype.twistScaleMapper_0 = function (projection, projectionInverse, scaleMapper) {\n return ProjectionCoordProvider$Companion$twistScaleMapper$lambda(projection, projectionInverse, scaleMapper);\n };\n ProjectionCoordProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ProjectionCoordProvider$Companion_instance = null;\n function ProjectionCoordProvider$Companion_getInstance() {\n if (ProjectionCoordProvider$Companion_instance === null) {\n new ProjectionCoordProvider$Companion();\n }return ProjectionCoordProvider$Companion_instance;\n }\n ProjectionCoordProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ProjectionCoordProvider',\n interfaces: [CoordProviderBase]\n };\n function MercatorProjectionX() {\n this.nonlinear_z5go4f$_0 = false;\n }\n Object.defineProperty(MercatorProjectionX.prototype, 'nonlinear', {\n configurable: true,\n get: function () {\n return this.nonlinear_z5go4f$_0;\n }\n });\n MercatorProjectionX.prototype.apply_14dthe$ = function (v) {\n return spatial.MercatorUtils.getMercatorX_14dthe$(v);\n };\n MercatorProjectionX.prototype.toValidDomain_4fzjta$ = function (domain) {\n return domain;\n };\n MercatorProjectionX.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MercatorProjectionX',\n interfaces: [Projection]\n };\n function MercatorProjectionY() {\n this.nonlinear_x0lz9c$_0 = true;\n }\n Object.defineProperty(MercatorProjectionY.prototype, 'nonlinear', {\n configurable: true,\n get: function () {\n return this.nonlinear_x0lz9c$_0;\n }\n });\n MercatorProjectionY.prototype.apply_14dthe$ = function (v) {\n return spatial.MercatorUtils.getMercatorY_14dthe$(v);\n };\n MercatorProjectionY.prototype.toValidDomain_4fzjta$ = function (domain) {\n if (spatial.MercatorUtils.VALID_LATITUDE_RANGE.isConnected_d226ot$(domain)) {\n return spatial.MercatorUtils.VALID_LATITUDE_RANGE.intersection_d226ot$(domain);\n }throw IllegalArgumentException_init('Illegal latitude range for mercator projection: ' + domain);\n };\n MercatorProjectionY.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MercatorProjectionY',\n interfaces: [Projection]\n };\n function DataProcessing() {\n DataProcessing_instance = this;\n }\n DataProcessing.prototype.transformOriginals_si9pes$ = function (data_0, bindings, scaleMap) {\n var tmp$;\n var data_1 = data_0;\n tmp$ = bindings.iterator();\n while (tmp$.hasNext()) {\n var binding = tmp$.next();\n var variable = binding.variable;\n if (variable.isOrigin) {\n if (!data_1.has_8xm3sj$(variable)) {\n var message = 'Undefined variable ' + variable;\n throw IllegalStateException_init(message.toString());\n }data_1 = data.DataFrameUtil.applyTransform_xaiv89$(data_1, variable, binding.aes, scaleMap.get_31786j$(binding.aes));\n }}\n return data_1;\n };\n DataProcessing.prototype.buildStatData_x40e2x$ = function (data, stat_0, bindings, scaleMap, groupingContext, facets, statCtx, varsWithoutBinding, orderOptions, aggregateOperation, messageConsumer) {\n var tmp$, tmp$_0;\n if (stat_0 === stat.Stats.IDENTITY) {\n return new DataProcessing$DataAndGroupingContext(DataFrame$Builder.Companion.emptyFrame(), groupingContext);\n }var groups = groupingContext.groupMapper;\n var resultSeries;\n var groupSizeListAfterStat;\n if (groups === GroupUtil_getInstance().SINGLE_GROUP_8be2vx$) {\n var sd = this.applyStat_0(data, stat_0, bindings, scaleMap, facets, statCtx, varsWithoutBinding, messageConsumer);\n groupSizeListAfterStat = listOf(sd.rowCount());\n var $receiver = sd.variables();\n var result = LinkedHashMap_init_0(coerceAtLeast(mapCapacity(collectionSizeOrDefault($receiver, 10)), 16));\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n result.put_xwzc9p$(element, sd.get_8xm3sj$(element));\n }\n resultSeries = result;\n } else {\n var groupMerger = new GroupMerger();\n var lastStatGroupEnd = -1;\n tmp$ = this.splitByGroup_0(data, groups).iterator();\n while (tmp$.hasNext()) {\n var d = tmp$.next();\n var sd_0 = this.applyStat_0(d, stat_0, bindings, scaleMap, facets, statCtx, varsWithoutBinding, messageConsumer);\n if (sd_0.isEmpty) {\n continue;\n }groupMerger.initOrderSpecs_37be8y$(orderOptions, sd_0.variables(), bindings, aggregateOperation);\n var curGroupSizeAfterStat = sd_0.rowCount();\n if (sd_0.has_8xm3sj$(stat.Stats.GROUP)) {\n var range = sd_0.range_8xm3sj$(stat.Stats.GROUP);\n if (range != null) {\n var start = lastStatGroupEnd + 1 | 0;\n var offset = start - numberToInt(range.lowerEnd) | 0;\n lastStatGroupEnd = numberToInt(range.upperEnd) + offset | 0;\n if (offset !== 0) {\n var newG = ArrayList_init();\n tmp$_0 = sd_0.getNumeric_8xm3sj$(stat.Stats.GROUP).iterator();\n while (tmp$_0.hasNext()) {\n var g = tmp$_0.next();\n newG.add_11rb$(ensureNotNull(g) + offset);\n }\n sd_0 = sd_0.builder().putNumeric_s1rqo9$(stat.Stats.GROUP, newG).build();\n }}} else {\n var groupingVar = groupingContext.optionalGroupingVar_8be2vx$;\n if (groupingVar != null) {\n var size = sd_0.get_8xm3sj$(first_0(sd_0.variables())).size;\n var v = d.get_8xm3sj$(groupingVar).get_za3lpa$(0);\n var tmp$_2 = sd_0.builder();\n var list = ArrayList_init_1(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(v);\n }\n sd_0 = tmp$_2.put_2l962d$(groupingVar, list).build();\n }}\n groupMerger.addGroup_s4jycv$(sd_0, curGroupSizeAfterStat);\n }\n resultSeries = groupMerger.getResultSeries();\n groupSizeListAfterStat = groupMerger.getGroupSizes();\n }\n var closure$resultSeries = resultSeries;\n var $receiver_0 = DataFrame$DataFrame$Builder_init();\n var tmp$_3;\n tmp$_3 = closure$resultSeries.keys.iterator();\n while (tmp$_3.hasNext()) {\n var variable = tmp$_3.next();\n $receiver_0.put_2l962d$(variable, ensureNotNull(closure$resultSeries.get_11rb$(variable)));\n }\n var destination = ArrayList_init_1(collectionSizeOrDefault(orderOptions, 10));\n var tmp$_4;\n tmp$_4 = orderOptions.iterator();\n while (tmp$_4.hasNext()) {\n var item = tmp$_4.next();\n destination.add_11rb$(OrderOptionUtil_getInstance().createOrderSpec_e64h97$(closure$resultSeries.keys, bindings, item, aggregateOperation));\n }\n var orderSpecs = destination;\n $receiver_0.addOrderSpecs_l2t0xf$(orderSpecs);\n var dataAfterStat = $receiver_0.build();\n var groupingContextAfterStat = GroupingContext$Companion_getInstance().withOrderedGroups_vi90cb$(dataAfterStat, groupSizeListAfterStat);\n return new DataProcessing$DataAndGroupingContext(dataAfterStat, groupingContextAfterStat);\n };\n DataProcessing.prototype.findOptionalVariable_hrxl0z$ = function (data_0, name) {\n return base.Strings.isNullOrEmpty_pdl1vj$(name) ? null : data.DataFrameUtil.findVariableOrFail_vede35$(data_0, ensureNotNull(name));\n };\n DataProcessing.prototype.splitByGroup_0 = function (data, groups) {\n var $receiver = GroupUtil_getInstance().indicesByGroup_wc9gac$(data.rowCount(), groups).values;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_0 = destination.add_11rb$;\n var $receiver_0 = data.variables();\n var tmp$_1;\n var accumulator = DataFrame$DataFrame$Builder_init();\n tmp$_1 = $receiver_0.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n var b = accumulator;\n var operation$result;\n var tmp$_2;\n tmp$_2 = data.isNumeric_8xm3sj$(element);\n if (tmp$_2 === true) {\n operation$result = b.putNumeric_s1rqo9$(element, data_0.SeriesUtil.pickAtIndices_ge51dg$(data.getNumeric_8xm3sj$(element), item));\n } else if (tmp$_2 === false) {\n operation$result = b.putDiscrete_2l962d$(element, data_0.SeriesUtil.pickAtIndices_ge51dg$(data.get_8xm3sj$(element), item));\n } else {\n operation$result = Kotlin.noWhenBranchMatched();\n }\n accumulator = operation$result;\n }\n tmp$_0.call(destination, accumulator);\n }\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(destination, 10));\n var tmp$_3;\n tmp$_3 = destination.iterator();\n while (tmp$_3.hasNext()) {\n var item_0 = tmp$_3.next();\n destination_0.add_11rb$(item_0.build());\n }\n return destination_0;\n };\n function DataProcessing$applyStat$addSeriesForVariable(closure$data, closure$statDataSize, closure$newInputSeries) {\n return function (variable) {\n var tmp$, tmp$_0;\n tmp$ = closure$data.isNumeric_8xm3sj$(variable);\n if (tmp$ === true)\n tmp$_0 = data_0.SeriesUtil.mean_l4tjj7$(closure$data.getNumeric_8xm3sj$(variable), null);\n else if (tmp$ === false)\n tmp$_0 = data_0.SeriesUtil.firstNotNull_rath1t$(closure$data.get_8xm3sj$(variable), null);\n else\n tmp$_0 = Kotlin.noWhenBranchMatched();\n var value = tmp$_0;\n var size = closure$statDataSize;\n var list = ArrayList_init_1(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(value);\n }\n var newInputSerie = list;\n closure$newInputSeries.put_xwzc9p$(variable, newInputSerie);\n };\n }\n DataProcessing.prototype.applyStat_0 = function (data_0, stat_0, bindings, scaleMap, facets, statCtx, varsWithoutBinding, compMessageConsumer) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n var statData = stat_0.apply_kdy6bf$(data_0, statCtx, compMessageConsumer);\n var statVariables = statData.variables();\n if (statVariables.isEmpty()) {\n return statData;\n }var inverseTransformedStatSeries = this.inverseTransformContinuousStatData_0(statData, stat_0, bindings, scaleMap);\n var statDataSize = statData.get_8xm3sj$(statVariables.iterator().next()).size;\n var facetVars = HashSet_init_0();\n tmp$ = facets.variables.iterator();\n while (tmp$.hasNext()) {\n var facetVarName = tmp$.next();\n var facetVar = data.DataFrameUtil.findVariableOrFail_vede35$(data_0, facetVarName);\n facetVars.add_11rb$(facetVar);\n if (!data_0.get_8xm3sj$(facetVar).isEmpty()) {\n var facetLevel = data_0.get_8xm3sj$(facetVar).get_za3lpa$(0);\n var tmp$_5 = statData.builder();\n var list = ArrayList_init_1(statDataSize);\n for (var index = 0; index < statDataSize; index++) {\n list.add_11rb$(facetLevel);\n }\n statData = tmp$_5.put_2l962d$(facetVar, list).build();\n }}\n if (bindings.isEmpty()) {\n return statData;\n }var newInputSeries = HashMap_init();\n var addSeriesForVariable = DataProcessing$applyStat$addSeriesForVariable(data_0, statDataSize, newInputSeries);\n tmp$_0 = bindings.iterator();\n while (tmp$_0.hasNext()) {\n var binding = tmp$_0.next();\n var variable = binding.variable;\n if (variable.isStat || facetVars.contains_11rb$(variable)) {\n continue;\n }var aes = binding.aes;\n if (stat_0.hasDefaultMapping_896ixz$(aes)) {\n var defaultStatVar = stat_0.getDefaultMapping_896ixz$(aes);\n if (inverseTransformedStatSeries.containsKey_11rb$(defaultStatVar)) {\n tmp$_1 = getValue(inverseTransformedStatSeries, defaultStatVar);\n } else {\n var statSerie = statData.getNumeric_8xm3sj$(defaultStatVar);\n tmp$_1 = scale.ScaleUtil.inverseTransform_codrxm$(statSerie, scaleMap.get_31786j$(aes));\n }\n var newInputSerie = tmp$_1;\n newInputSeries.put_xwzc9p$(variable, newInputSerie);\n } else {\n if (!newInputSeries.containsKey_11rb$(variable)) {\n addSeriesForVariable(variable);\n }}\n }\n var predicate = getCallableRef('isStatVar', function ($receiver, p1) {\n return $receiver.isStatVar_61zpoe$(p1);\n }.bind(null, stat.Stats));\n var destination = ArrayList_init();\n var tmp$_6;\n tmp$_6 = varsWithoutBinding.iterator();\n while (tmp$_6.hasNext()) {\n var element = tmp$_6.next();\n if (!predicate(element))\n destination.add_11rb$(element);\n }\n tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var varName = tmp$_2.next();\n var variable_0 = data.DataFrameUtil.findVariableOrFail_vede35$(data_0, varName);\n if (!newInputSeries.containsKey_11rb$(variable_0)) {\n addSeriesForVariable(variable_0);\n }}\n var b = statData.builder();\n tmp$_3 = newInputSeries.keys.iterator();\n while (tmp$_3.hasNext()) {\n var variable_1 = tmp$_3.next();\n b.put_2l962d$(variable_1, getValue(newInputSeries, variable_1));\n }\n tmp$_4 = inverseTransformedStatSeries.keys.iterator();\n while (tmp$_4.hasNext()) {\n var variable_2 = tmp$_4.next();\n b.putNumeric_s1rqo9$(variable_2, getValue(inverseTransformedStatSeries, variable_2));\n }\n return b.build();\n };\n DataProcessing.prototype.inverseTransformContinuousStatData_0 = function (statData, stat, bindings, scaleMap) {\n var tmp$, tmp$_0, tmp$_1;\n var continuousScaleByAes = HashMap_init();\n var aesByMappedStatVar = HashMap_init();\n tmp$ = Aes.Companion.values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n if (stat.hasDefaultMapping_896ixz$(aes)) {\n var defaultStatVar = stat.getDefaultMapping_896ixz$(aes);\n aesByMappedStatVar.put_xwzc9p$(defaultStatVar, aes);\n }}\n tmp$_0 = bindings.iterator();\n while (tmp$_0.hasNext()) {\n var binding = tmp$_0.next();\n var aes_0 = binding.aes;\n var variable = binding.variable;\n if (variable.isStat) {\n aesByMappedStatVar.put_xwzc9p$(variable, aes_0);\n continue;\n }var scale_0 = scaleMap.get_31786j$(aes_0);\n if (scale_0.isContinuousDomain) {\n continuousScaleByAes.put_xwzc9p$(aes_0, scale_0);\n if (Aes.Companion.isPositionalX_896ixz$(aes_0) && !continuousScaleByAes.containsKey_11rb$(Aes.Companion.X)) {\n var key = Aes.Companion.X;\n continuousScaleByAes.put_xwzc9p$(key, scale_0);\n } else if (Aes.Companion.isPositionalY_896ixz$(aes_0) && !continuousScaleByAes.containsKey_11rb$(Aes.Companion.Y)) {\n var key_0 = Aes.Companion.Y;\n continuousScaleByAes.put_xwzc9p$(key_0, scale_0);\n }}}\n var inverseTransformedStatSeries = HashMap_init();\n tmp$_1 = statData.variables().iterator();\n while (tmp$_1.hasNext()) {\n var statVar = tmp$_1.next();\n if (aesByMappedStatVar.containsKey_11rb$(statVar)) {\n var aes_1 = getValue(aesByMappedStatVar, statVar);\n var scale_1 = continuousScaleByAes.get_11rb$(aes_1);\n if (scale_1 == null) {\n if (Aes.Companion.isPositionalX_896ixz$(aes_1)) {\n scale_1 = continuousScaleByAes.get_11rb$(Aes.Companion.X);\n } else if (Aes.Companion.isPositionalY_896ixz$(aes_1)) {\n scale_1 = continuousScaleByAes.get_11rb$(Aes.Companion.Y);\n }}if (scale_1 != null) {\n var statSerie = statData.getNumeric_8xm3sj$(statVar);\n var inverseTransformedStatSerie = scale.ScaleUtil.inverseTransformToContinuousDomain_codrxm$(statSerie, scale_1);\n inverseTransformedStatSeries.put_xwzc9p$(statVar, inverseTransformedStatSerie);\n }}}\n return inverseTransformedStatSeries;\n };\n DataProcessing.prototype.computeGroups_hut2k5$ = function (data, bindings, groupingVar, pathIdVar) {\n var tmp$, tmp$_0;\n var groupingVariables = plus_0(this.getGroupingVariables_0(data, bindings, groupingVar), listOfNotNull_0(pathIdVar));\n var currentGroups = {v: null};\n if (groupingVar != null) {\n currentGroups.v = this.computeGroups_0(data.get_8xm3sj$(groupingVar));\n }tmp$ = groupingVariables.iterator();\n while (tmp$.hasNext()) {\n var groupingVariable = tmp$.next();\n var values = data.get_8xm3sj$(groupingVariable);\n var groups = this.computeGroups_0(values);\n if (currentGroups.v == null) {\n currentGroups.v = groups;\n continue;\n }if (!(currentGroups.v.size === groups.size)) {\n var tmp$_1;\n var message = 'Data series used to compute groups must be equal in size (encountered sizes: ' + (toString((tmp$_1 = currentGroups.v) != null ? tmp$_1.size : null) + ', ' + groups.size + ' )');\n throw IllegalStateException_init(message.toString());\n }var dummies = this.computeDummyValues_0(currentGroups.v, groups);\n currentGroups.v = this.computeGroups_0(dummies);\n }\n if (currentGroups.v != null) {\n tmp$_0 = GroupUtil_getInstance().wrap_2wzaym$(currentGroups.v);\n } else {\n tmp$_0 = GroupUtil_getInstance().SINGLE_GROUP_8be2vx$;\n }\n return tmp$_0;\n };\n DataProcessing.prototype.computeGroups_0 = function (values) {\n var tmp$, tmp$_0;\n var groups = ArrayList_init();\n var groupByVal = HashMap_init();\n var count = 0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (!groupByVal.containsKey_11rb$(v)) {\n var value = (tmp$_0 = count, count = tmp$_0 + 1 | 0, tmp$_0);\n groupByVal.put_xwzc9p$(v, value);\n }groups.add_11rb$(ensureNotNull(groupByVal.get_11rb$(v)));\n }\n return groups;\n };\n DataProcessing.prototype.computeDummyValues_0 = function (list1, list2) {\n if (list1.isEmpty())\n return emptyList();\n var limit = 1000;\n var max = Ordering.Companion.natural_dahdeg$().max_m5x2f4$(collect.Iterables.concat_yxozss$(list1, list2));\n if (!(max < limit)) {\n var message = 'Too many groups: ' + max;\n throw IllegalStateException_init(message.toString());\n }var dummies = ArrayList_init();\n var it1 = list1.iterator();\n var it2 = list2.iterator();\n while (it1.hasNext()) {\n var v1 = it1.next();\n var v2 = it2.next();\n var dummy = Kotlin.imul(v1, limit) + v2 | 0;\n dummies.add_11rb$(dummy);\n }\n return dummies;\n };\n DataProcessing.prototype.getGroupingVariables_0 = function (data, bindings, explicitGroupingVar) {\n var tmp$;\n var result = LinkedHashSet_init();\n tmp$ = bindings.iterator();\n while (tmp$.hasNext()) {\n var binding = tmp$.next();\n var variable = binding.variable;\n if (!result.contains_11rb$(variable)) {\n if (variable.isOrigin) {\n if (equals(variable, explicitGroupingVar) || this.isDefaultGroupingVariable_0(data, binding.aes, variable)) {\n result.add_11rb$(variable);\n }}}}\n return result;\n };\n DataProcessing.prototype.isDefaultGroupingVariable_0 = function (data, aes, variable) {\n return !(Aes.Companion.isPositional_896ixz$(aes) || data.isNumeric_8xm3sj$(variable));\n };\n function DataProcessing$DataAndGroupingContext(data, groupingContext) {\n this.data = data;\n this.groupingContext = groupingContext;\n }\n DataProcessing$DataAndGroupingContext.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataAndGroupingContext',\n interfaces: []\n };\n DataProcessing.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DataProcessing',\n interfaces: []\n };\n var DataProcessing_instance = null;\n function DataProcessing_getInstance() {\n if (DataProcessing_instance === null) {\n new DataProcessing();\n }return DataProcessing_instance;\n }\n function GroupMerger() {\n this.myOrderSpecs_0 = null;\n this.myOrderedGroups_0 = ArrayList_init();\n }\n GroupMerger.prototype.initOrderSpecs_37be8y$ = function (orderOptions, variables, bindings, aggregateOperation) {\n if (this.myOrderSpecs_0 != null)\n return;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = orderOptions.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_0;\n tmp$_0 = bindings.iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n if (equals(element_0.variable.name, element.variableName) && equals(element_0.aes, Aes.Companion.X)) {\n firstOrNull$result = element_0;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n if (firstOrNull$result == null)\n destination.add_11rb$(element);\n }\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(destination, 10));\n var tmp$_1;\n tmp$_1 = destination.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n destination_0.add_11rb$(OrderOptionUtil_getInstance().createOrderSpec_e64h97$(variables, bindings, item, aggregateOperation));\n }\n this.myOrderSpecs_0 = destination_0;\n };\n GroupMerger.prototype.getResultSeries = function () {\n var resultSeries = HashMap_init();\n var tmp$;\n tmp$ = this.myOrderedGroups_0.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n tmp$_0 = element.df.variables().iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n var tmp$_1;\n var value = resultSeries.get_11rb$(element_0);\n if (value == null) {\n var answer = ArrayList_init();\n resultSeries.put_xwzc9p$(element_0, answer);\n tmp$_1 = answer;\n } else {\n tmp$_1 = value;\n }\n tmp$_1.addAll_brywnq$(element.df.get_8xm3sj$(element_0));\n }\n }\n return resultSeries;\n };\n GroupMerger.prototype.getGroupSizes = function () {\n var $receiver = this.myOrderedGroups_0;\n var transform = getPropertyCallableRef('groupSize', 1, function ($receiver) {\n return $receiver.groupSize;\n });\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(transform(item));\n }\n return destination;\n };\n function GroupMerger$Group($outer, df, groupSize) {\n this.$outer = $outer;\n this.df = df;\n this.groupSize = groupSize;\n }\n function GroupMerger$Group$compareTo$compareGroupValue(v1, v2, dir) {\n var tmp$, tmp$_0;\n if (v1 == null && v2 == null)\n return 0;\n if (v1 == null)\n return 1;\n if (v2 == null)\n return -1;\n return Kotlin.imul(compareValues(Kotlin.isComparable(tmp$ = v1) ? tmp$ : throwCCE(), Kotlin.isComparable(tmp$_0 = v2) ? tmp$_0 : throwCCE()), dir);\n }\n function GroupMerger$Group$compareTo$getValue(df, variable, aggregateOperation) {\n if (aggregateOperation === void 0)\n aggregateOperation = null;\n var tmp$;\n if (aggregateOperation != null) {\n if (!df.isNumeric_8xm3sj$(variable)) {\n var message = \"Can't apply aggregate operation to non-numeric values\";\n throw IllegalArgumentException_init(message.toString());\n }tmp$ = aggregateOperation(requireNoNulls(df.getNumeric_8xm3sj$(variable)));\n } else {\n tmp$ = firstOrNull(df.get_8xm3sj$(variable));\n }\n return tmp$;\n }\n GroupMerger$Group.prototype.compareTo_11rb$ = function (other) {\n var tmp$;\n var compareGroupValue = GroupMerger$Group$compareTo$compareGroupValue;\n var getValue = GroupMerger$Group$compareTo$getValue;\n if ((tmp$ = this.$outer.myOrderSpecs_0) != null) {\n var tmp$_0;\n tmp$_0 = tmp$.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var cmp = compareGroupValue(getValue(this.df, element.orderBy, element.aggregateOperation), getValue(other.df, element.orderBy, element.aggregateOperation), element.direction);\n if (cmp === 0) {\n cmp = compareGroupValue(getValue(this.df, element.variable), getValue(other.df, element.variable), element.direction);\n }if (cmp !== 0) {\n return cmp;\n }}\n }return 0;\n };\n GroupMerger$Group.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Group',\n interfaces: [Comparable]\n };\n GroupMerger.prototype.addGroup_s4jycv$ = function (d, groupSize) {\n var group = new GroupMerger$Group(this, d, groupSize);\n var indexToInsert = this.findIndexToInsert_0(group);\n this.myOrderedGroups_0.add_wxm5ur$(indexToInsert, group);\n };\n GroupMerger.prototype.findIndexToInsert_0 = function (group) {\n var $receiver = this.myOrderSpecs_0;\n if ($receiver == null || $receiver.isEmpty()) {\n return this.myOrderedGroups_0.size;\n }var index = binarySearch(this.myOrderedGroups_0, group);\n if (index < 0)\n index = ~index;\n return index;\n };\n GroupMerger.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupMerger',\n interfaces: []\n };\n function GroupUtil() {\n GroupUtil_instance = this;\n this.SINGLE_GROUP_8be2vx$ = GroupUtil$SINGLE_GROUP$lambda;\n }\n function GroupUtil$wrap$lambda(closure$l) {\n return function (index) {\n return index > 0 && index < closure$l.size ? numberToInt(ensureNotNull(closure$l.get_za3lpa$(index))) : 0;\n };\n }\n GroupUtil.prototype.wrap_2wzaym$ = function (l) {\n return GroupUtil$wrap$lambda(l);\n };\n function GroupUtil$wrap$lambda_0(closure$groupByPointIndex) {\n return function (it) {\n return ensureNotNull(closure$groupByPointIndex.get_11rb$(it));\n };\n }\n GroupUtil.prototype.wrap_orwq1h$ = function (groupByPointIndex) {\n return GroupUtil$wrap$lambda_0(groupByPointIndex);\n };\n GroupUtil.prototype.indicesByGroup_wc9gac$ = function (dataLength, groups) {\n var indicesByGroup = LinkedHashMap_init();\n for (var i = 0; i < dataLength; i++) {\n var group = groups(i);\n if (!indicesByGroup.containsKey_11rb$(group)) {\n var value = ArrayList_init();\n indicesByGroup.put_xwzc9p$(group, value);\n }ensureNotNull(indicesByGroup.get_11rb$(group)).add_11rb$(i);\n }\n return indicesByGroup;\n };\n function GroupUtil$SINGLE_GROUP$lambda(f) {\n return 0;\n }\n GroupUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GroupUtil',\n interfaces: []\n };\n var GroupUtil_instance = null;\n function GroupUtil_getInstance() {\n if (GroupUtil_instance === null) {\n new GroupUtil();\n }return GroupUtil_instance;\n }\n function GroupingContext(myData, bindings, groupingVarName, pathIdVarName, myExpectMultiple) {\n GroupingContext$Companion_getInstance();\n this.myData_0 = myData;\n this.myExpectMultiple_0 = myExpectMultiple;\n this.myBindings_0 = ArrayList_init_0(bindings);\n this.optionalGroupingVar_8be2vx$ = DataProcessing_getInstance().findOptionalVariable_hrxl0z$(this.myData_0, groupingVarName);\n this.pathIdVar_0 = DataProcessing_getInstance().findOptionalVariable_hrxl0z$(this.myData_0, pathIdVarName);\n this.myGroupSizeList_0 = null;\n this.myGroupMapper_0 = null;\n }\n function GroupingContext$get_GroupingContext$groupMapper$lambda(this$GroupingContext) {\n return function (index) {\n if (this$GroupingContext.myGroupMapper_0 == null) {\n this$GroupingContext.myGroupMapper_0 = this$GroupingContext.computeGroups_0();\n }return ensureNotNull(this$GroupingContext.myGroupMapper_0)(index);\n };\n }\n Object.defineProperty(GroupingContext.prototype, 'groupMapper', {\n configurable: true,\n get: function () {\n return GroupingContext$get_GroupingContext$groupMapper$lambda(this);\n }\n });\n GroupingContext.prototype.computeGroups_0 = function () {\n if (this.myData_0.has_8xm3sj$(stat.Stats.GROUP)) {\n var list = this.myData_0.getNumeric_8xm3sj$(stat.Stats.GROUP);\n return GroupUtil_getInstance().wrap_2wzaym$(list);\n } else if (this.myGroupSizeList_0 != null) {\n if (ensureNotNull(this.myGroupSizeList_0).size === this.myData_0.rowCount()) {\n return GroupUtil_getInstance().SINGLE_GROUP_8be2vx$;\n } else {\n var groupByPointIndex = GroupingContext$Companion_getInstance().toIndexMap_0(ensureNotNull(this.myGroupSizeList_0));\n return GroupUtil_getInstance().wrap_orwq1h$(groupByPointIndex);\n }\n } else if (this.myExpectMultiple_0) {\n return DataProcessing_getInstance().computeGroups_hut2k5$(this.myData_0, this.myBindings_0, this.optionalGroupingVar_8be2vx$, this.pathIdVar_0);\n }return GroupUtil_getInstance().SINGLE_GROUP_8be2vx$;\n };\n function GroupingContext$Companion() {\n GroupingContext$Companion_instance = this;\n }\n GroupingContext$Companion.prototype.withOrderedGroups_vi90cb$ = function (data, groupSizeList) {\n var groupingContext = new GroupingContext(data, emptyList(), null, null, false);\n groupingContext.myGroupSizeList_0 = ArrayList_init_0(groupSizeList);\n return groupingContext;\n };\n GroupingContext$Companion.prototype.toIndexMap_0 = function (groupSizeList) {\n var tmp$;\n var result = HashMap_init();\n var currentGroup = 0;\n var currentGroupIndexOffset = 0;\n tmp$ = groupSizeList.iterator();\n while (tmp$.hasNext()) {\n var groupSize = tmp$.next();\n for (var i = 0; i < groupSize; i++) {\n var key = currentGroupIndexOffset + i | 0;\n var value = currentGroup;\n result.put_xwzc9p$(key, value);\n }\n currentGroup = currentGroup + 1 | 0;\n currentGroupIndexOffset = currentGroupIndexOffset + groupSize | 0;\n }\n return result;\n };\n GroupingContext$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GroupingContext$Companion_instance = null;\n function GroupingContext$Companion_getInstance() {\n if (GroupingContext$Companion_instance === null) {\n new GroupingContext$Companion();\n }return GroupingContext$Companion_instance;\n }\n GroupingContext.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupingContext',\n interfaces: []\n };\n function OrderOptionUtil() {\n OrderOptionUtil_instance = this;\n }\n function OrderOptionUtil$OrderOption(variableName, byVariable, orderDir) {\n OrderOptionUtil$OrderOption$Companion_getInstance();\n this.variableName = variableName;\n this.byVariable = byVariable;\n this.orderDir_0 = orderDir;\n }\n OrderOptionUtil$OrderOption.prototype.getOrderDir = function () {\n var tmp$;\n return (tmp$ = this.orderDir_0) != null ? tmp$ : -1;\n };\n function OrderOptionUtil$OrderOption$Companion() {\n OrderOptionUtil$OrderOption$Companion_instance = this;\n }\n OrderOptionUtil$OrderOption$Companion.prototype.create_yyjhqb$ = function (variableName, orderBy, order) {\n var tmp$, tmp$_0;\n if (orderBy == null && order == null) {\n return null;\n }if (!(order == null || (Kotlin.isNumber(order) && listOf_0([-1, 1]).contains_11rb$(numberToInt(order))))) {\n var message = 'Unsupported `order` value: ' + toString(order) + '. Use 1 (ascending) or -1 (descending).';\n throw IllegalArgumentException_init(message.toString());\n }return new OrderOptionUtil$OrderOption(variableName, orderBy, (tmp$_0 = Kotlin.isNumber(tmp$ = order) ? tmp$ : null) != null ? numberToInt(tmp$_0) : null);\n };\n OrderOptionUtil$OrderOption$Companion.prototype.mergeWith_me9ya9$ = function ($receiver, other) {\n var tmp$, tmp$_0;\n if (!equals($receiver.variableName, other.variableName)) {\n var message = \"Can't merge order options for different variables: '\" + $receiver.variableName + \"' and '\" + other.variableName + \"'\";\n throw IllegalArgumentException_init(message.toString());\n }if (!($receiver.byVariable == null || other.byVariable == null || equals(other.byVariable, $receiver.byVariable))) {\n var message_0 = \"Multiple ordering options for the variable '\" + $receiver.variableName + \"' with different non-empty 'order_by' fields: '\" + toString($receiver.byVariable) + \"' and '\" + toString(other.byVariable) + \"'\";\n throw IllegalArgumentException_init(message_0.toString());\n }if (!($receiver.orderDir_0 == null || other.orderDir_0 == null || other.orderDir_0 == $receiver.orderDir_0)) {\n var message_1 = \"Multiple ordering options for the variable '\" + $receiver.variableName + \"' with different order direction: '\" + toString($receiver.orderDir_0) + \"' and '\" + toString(other.orderDir_0) + \"'\";\n throw IllegalArgumentException_init(message_1.toString());\n }return new OrderOptionUtil$OrderOption($receiver.variableName, (tmp$ = $receiver.byVariable) != null ? tmp$ : other.byVariable, (tmp$_0 = $receiver.orderDir_0) != null ? tmp$_0 : other.orderDir_0);\n };\n OrderOptionUtil$OrderOption$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var OrderOptionUtil$OrderOption$Companion_instance = null;\n function OrderOptionUtil$OrderOption$Companion_getInstance() {\n if (OrderOptionUtil$OrderOption$Companion_instance === null) {\n new OrderOptionUtil$OrderOption$Companion();\n }return OrderOptionUtil$OrderOption$Companion_instance;\n }\n OrderOptionUtil$OrderOption.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'OrderOption',\n interfaces: []\n };\n function OrderOptionUtil$createOrderSpec$getVariableByName(closure$variables) {\n return function (varName) {\n var tmp$;\n var tmp$_0;\n var $receiver = closure$variables;\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n if (equals(element.name, varName)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n if ((tmp$ = firstOrNull$result) != null)\n tmp$_0 = tmp$;\n else {\n var tmp$_2 = \"Undefined variable '\" + varName + \"' in order options. Full variable list: \";\n var $receiver_0 = closure$variables;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver_0, 10));\n var tmp$_3;\n tmp$_3 = $receiver_0.iterator();\n while (tmp$_3.hasNext()) {\n var item = tmp$_3.next();\n destination.add_11rb$(\"'\" + item.name + \"'\");\n }\n throw IllegalStateException_init((tmp$_2 + destination).toString());\n }\n return tmp$_0;\n };\n }\n OrderOptionUtil.prototype.createOrderSpec_e64h97$ = function (variables, varBindings, orderOption, aggregateOperation) {\n var tmp$, tmp$_0, tmp$_1;\n var getVariableByName = OrderOptionUtil$createOrderSpec$getVariableByName(variables);\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_2;\n tmp$_2 = varBindings.iterator();\n while (tmp$_2.hasNext()) {\n var element = tmp$_2.next();\n if (equals(element.variable.name, orderOption.variableName) && equals(element.aes, Aes.Companion.X)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n if (firstOrNull$result != null && SamplingUtil_getInstance().xVar_bbyvt0$(variables) != null) {\n tmp$ = ensureNotNull(SamplingUtil_getInstance().xVar_bbyvt0$(variables));\n } else {\n tmp$ = getVariableByName(orderOption.variableName);\n }\n var variable = tmp$;\n return new DataFrame$OrderSpec(variable, (tmp$_1 = (tmp$_0 = orderOption.byVariable) != null ? getVariableByName(tmp$_0) : null) != null ? tmp$_1 : getVariableByName(orderOption.variableName), orderOption.getOrderDir(), orderOption.byVariable != null && !equals(orderOption.byVariable, orderOption.variableName) ? aggregateOperation : null);\n };\n OrderOptionUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'OrderOptionUtil',\n interfaces: []\n };\n var OrderOptionUtil_instance = null;\n function OrderOptionUtil_getInstance() {\n if (OrderOptionUtil_instance === null) {\n new OrderOptionUtil();\n }return OrderOptionUtil_instance;\n }\n function MouseEventPeer() {\n this.myEventHandlers_0 = HashMap_init();\n this.myEventSources_0 = ArrayList_init();\n this.mySourceRegistrations_0 = HashMap_init();\n }\n function MouseEventPeer$addEventHandler$ObjectLiteral(closure$addReg, this$MouseEventPeer, closure$eventSpec) {\n this.closure$addReg = closure$addReg;\n this.this$MouseEventPeer = this$MouseEventPeer;\n this.closure$eventSpec = closure$eventSpec;\n Registration.call(this);\n }\n MouseEventPeer$addEventHandler$ObjectLiteral.prototype.doRemove = function () {\n var tmp$;\n (tmp$ = this.closure$addReg) != null ? (tmp$.remove(), Unit) : null;\n if (ensureNotNull(this.this$MouseEventPeer.myEventHandlers_0.get_11rb$(this.closure$eventSpec)).isEmpty) {\n this.this$MouseEventPeer.myEventHandlers_0.remove_11rb$(this.closure$eventSpec);\n this.this$MouseEventPeer.onRemoveSpec_0(this.closure$eventSpec);\n }};\n MouseEventPeer$addEventHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n MouseEventPeer.prototype.addEventHandler_mfdhbe$ = function (eventSpec, eventHandler) {\n var tmp$;\n if (!this.myEventHandlers_0.containsKey_11rb$(eventSpec)) {\n var $receiver = this.myEventHandlers_0;\n var value = new Listeners();\n $receiver.put_xwzc9p$(eventSpec, value);\n this.onAddSpec_0(eventSpec);\n }var addReg = (tmp$ = this.myEventHandlers_0.get_11rb$(eventSpec)) != null ? tmp$.add_11rb$(eventHandler) : null;\n return new MouseEventPeer$addEventHandler$ObjectLiteral(addReg, this, eventSpec);\n };\n function MouseEventPeer$dispatch$ObjectLiteral(closure$mouseEvent) {\n this.closure$mouseEvent = closure$mouseEvent;\n }\n MouseEventPeer$dispatch$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onEvent_11rb$(this.closure$mouseEvent);\n };\n MouseEventPeer$dispatch$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n MouseEventPeer.prototype.dispatch_w7zfbj$ = function (eventSpec, mouseEvent) {\n var tmp$;\n if (this.myEventHandlers_0.containsKey_11rb$(eventSpec)) {\n (tmp$ = this.myEventHandlers_0.get_11rb$(eventSpec)) != null ? (tmp$.fire_kucmxw$(new MouseEventPeer$dispatch$ObjectLiteral(mouseEvent)), Unit) : null;\n }};\n MouseEventPeer.prototype.addEventSource_u4bej9$ = function (eventSource) {\n var tmp$;\n tmp$ = this.myEventHandlers_0.keys.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.startHandleSpecInSource_0(eventSource, element);\n }\n this.myEventSources_0.add_11rb$(eventSource);\n };\n MouseEventPeer.prototype.onAddSpec_0 = function (eventSpec) {\n var tmp$;\n tmp$ = this.myEventSources_0.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.startHandleSpecInSource_0(element, eventSpec);\n }\n };\n function MouseEventPeer$startHandleSpecInSource$ObjectLiteral(closure$eventSpec, this$MouseEventPeer) {\n this.closure$eventSpec = closure$eventSpec;\n this.this$MouseEventPeer = this$MouseEventPeer;\n }\n MouseEventPeer$startHandleSpecInSource$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n this.this$MouseEventPeer.dispatch_w7zfbj$(this.closure$eventSpec, event);\n };\n MouseEventPeer$startHandleSpecInSource$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n MouseEventPeer.prototype.startHandleSpecInSource_0 = function (eventSource, eventSpec) {\n var tmp$;\n var registration = eventSource.addEventHandler_mfdhbe$(eventSpec, new MouseEventPeer$startHandleSpecInSource$ObjectLiteral(eventSpec, this));\n if (!this.mySourceRegistrations_0.containsKey_11rb$(eventSpec)) {\n var $receiver = this.mySourceRegistrations_0;\n var value = new CompositeRegistration([]);\n $receiver.put_xwzc9p$(eventSpec, value);\n }(tmp$ = this.mySourceRegistrations_0.get_11rb$(eventSpec)) != null ? tmp$.add_3xv6fb$(registration) : null;\n };\n MouseEventPeer.prototype.onRemoveSpec_0 = function (eventSpec) {\n var tmp$;\n if (this.mySourceRegistrations_0.containsKey_11rb$(eventSpec)) {\n (tmp$ = this.mySourceRegistrations_0.remove_11rb$(eventSpec)) != null ? (tmp$.dispose(), Unit) : null;\n }};\n MouseEventPeer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MouseEventPeer',\n interfaces: [MouseEventSource]\n };\n function AxisComponent(length, orientation) {\n SvgComponent.call(this);\n this.breaks = new ValueProperty(null);\n this.labels = new ValueProperty(null);\n this.tickLabelRotationDegree = new ValueProperty(0.0);\n this.tickLabelHorizontalAnchor = null;\n this.tickLabelVerticalAnchor = null;\n this.tickLabelSmallFont = new ValueProperty(false);\n this.tickLabelOffsets = new ValueProperty(null);\n this.gridLineColor = new ValueProperty(Color.Companion.LIGHT_GRAY);\n this.lineWidth = new ValueProperty(1.0);\n this.gridLineWidth = new ValueProperty(1.0);\n this.gridLineLength = new ValueProperty(0.0);\n this.tickMarkWidth = new ValueProperty(1.0);\n this.tickMarkLength = new ValueProperty(6.0);\n this.tickMarkPadding = new ValueProperty(3.0);\n this.length_0 = new ValueProperty(null);\n this.orientation_0 = new ValueProperty(null);\n this.myTickMarksEnabled_0 = new ValueProperty(true);\n this.myTickLabelsEnabled_0 = new ValueProperty(true);\n this.myAxisLineEnabled_0 = new ValueProperty(true);\n this.lineColor_0 = new ValueProperty(Color.Companion.BLACK);\n this.tickColor_0 = new ValueProperty(Color.Companion.BLACK);\n this.length_0.set_11rb$(length);\n this.orientation_0.set_11rb$(orientation);\n this.tickLabelHorizontalAnchor = new ValueProperty(this.defTickLabelHorizontalAnchor_0(orientation));\n this.tickLabelVerticalAnchor = new ValueProperty(this.defTickLabelVerticalAnchor_0(orientation));\n var asPropertyChangedEventSource = AxisComponent_init$asPropertyChangedEventSource;\n event.EventSources.composite_xw2ruy$([asPropertyChangedEventSource(this.length_0), asPropertyChangedEventSource(this.orientation_0), asPropertyChangedEventSource(this.breaks), asPropertyChangedEventSource(this.labels), asPropertyChangedEventSource(this.gridLineLength), asPropertyChangedEventSource(this.tickLabelOffsets), asPropertyChangedEventSource(this.tickLabelHorizontalAnchor), asPropertyChangedEventSource(this.tickLabelVerticalAnchor), asPropertyChangedEventSource(this.tickLabelRotationDegree), asPropertyChangedEventSource(this.tickLabelSmallFont)]).addHandler_gxwwpc$(this.rebuildHandler_287e2$());\n }\n AxisComponent.prototype.defTickLabelHorizontalAnchor_0 = function (orientation) {\n var tmp$;\n switch (orientation.name) {\n case 'LEFT':\n tmp$ = TextLabel$HorizontalAnchor.RIGHT;\n break;\n case 'RIGHT':\n tmp$ = TextLabel$HorizontalAnchor.LEFT;\n break;\n case 'TOP':\n case 'BOTTOM':\n tmp$ = TextLabel$HorizontalAnchor.MIDDLE;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n AxisComponent.prototype.defTickLabelVerticalAnchor_0 = function (orientation) {\n switch (orientation.name) {\n case 'LEFT':\n case 'RIGHT':\n return TextLabel$VerticalAnchor.CENTER;\n case 'TOP':\n return TextLabel$VerticalAnchor.BOTTOM;\n case 'BOTTOM':\n return TextLabel$VerticalAnchor.TOP;\n default:throw RuntimeException_init('Unexpected orientation:' + orientation);\n }\n };\n AxisComponent.prototype.buildComponent = function () {\n this.buildAxis_0();\n };\n AxisComponent.prototype.buildAxis_0 = function () {\n var tmp$, tmp$_0, tmp$_1;\n var rootElement = this.rootGroup;\n rootElement.addClass_61zpoe$(Style_getInstance().AXIS);\n if (this.tickLabelSmallFont.get()) {\n rootElement.addClass_61zpoe$(Style_getInstance().SMALL_TICK_FONT);\n }var l = ensureNotNull(this.length_0.get());\n var x1;\n var y1;\n var x2;\n var y2;\n var start;\n var end;\n tmp$ = this.orientation_0.get();\n if (equals(tmp$, Orientation$LEFT_getInstance()) || equals(tmp$, Orientation$RIGHT_getInstance())) {\n x2 = 0.0;\n x1 = x2;\n start = 0.0;\n y1 = start;\n end = l;\n y2 = end;\n } else if (equals(tmp$, Orientation$TOP_getInstance()) || equals(tmp$, Orientation$BOTTOM_getInstance())) {\n start = 0.0;\n x1 = start;\n end = l;\n x2 = end;\n y2 = 0.0;\n y1 = y2;\n } else\n throw RuntimeException_init('Unexpected orientation:' + toString(this.orientation_0.get()));\n var axisLine = null;\n if (this.axisLineEnabled().get()) {\n axisLine = SvgLineElement_init(x1, y1, x2, y2);\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.lineWidth, axisLine.strokeWidth()));\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.lineColor_0, axisLine.strokeColor()));\n }var gridLineMinPos = start + 3;\n var gridLineMaxPos = end - 3;\n if (this.breaksEnabled_0()) {\n var breaks = this.breaks.get();\n if (!(breaks == null || breaks.isEmpty())) {\n var labels = this.labels.get();\n if (labels == null || labels.isEmpty()) {\n labels = ArrayList_init();\n for (var i = 0; i !== breaks.size; ++i) {\n labels.add_11rb$('');\n }\n }var i_0 = 0;\n tmp$_0 = breaks.iterator();\n while (tmp$_0.hasNext()) {\n var br = tmp$_0.next();\n var addGridLine = br >= gridLineMinPos && br <= gridLineMaxPos;\n var label = labels.get_za3lpa$(i_0 % labels.size);\n var labelOffset = this.tickLabelOffset_0(i_0);\n i_0 = i_0 + 1 | 0;\n var group = this.buildTick_0(label, labelOffset, addGridLine ? this.gridLineLength.get() : 0.0);\n tmp$_1 = this.orientation_0.get();\n if (equals(tmp$_1, Orientation$LEFT_getInstance()) || equals(tmp$_1, Orientation$RIGHT_getInstance()))\n svg.SvgUtils.transformTranslate_pw34rw$(group, 0.0, br);\n else if (equals(tmp$_1, Orientation$TOP_getInstance()) || equals(tmp$_1, Orientation$BOTTOM_getInstance()))\n svg.SvgUtils.transformTranslate_pw34rw$(group, br, 0.0);\n else\n throw RuntimeException_init('Unexpected orientation:' + toString(this.orientation_0.get()));\n rootElement.children().add_11rb$(group);\n }\n }}if (axisLine != null) {\n rootElement.children().add_11rb$(axisLine);\n }};\n AxisComponent.prototype.buildTick_0 = function (label, labelOffset, gridLineLength) {\n var tmp$;\n var tickMark = null;\n if (this.tickMarksEnabled().get()) {\n tickMark = new SvgLineElement();\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.tickMarkWidth, tickMark.strokeWidth()));\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.tickColor_0, tickMark.strokeColor()));\n }var tickLabel = null;\n if (this.tickLabelsEnabled().get()) {\n tickLabel = new TextLabel(label);\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.tickColor_0, tickLabel.textColor()));\n }var gridLine = null;\n if (gridLineLength > 0) {\n gridLine = new SvgLineElement();\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.gridLineColor, gridLine.strokeColor()));\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.gridLineWidth, gridLine.strokeWidth()));\n }var markLength = this.tickMarkLength.get();\n tmp$ = this.orientation_0.get();\n if (equals(tmp$, Orientation$LEFT_getInstance())) {\n if (tickMark != null) {\n tickMark.x2().set_11rb$(-markLength);\n tickMark.y2().set_11rb$(0.0);\n }if (gridLine != null) {\n gridLine.x2().set_11rb$(gridLineLength);\n gridLine.y2().set_11rb$(0.0);\n }} else if (equals(tmp$, Orientation$RIGHT_getInstance())) {\n if (tickMark != null) {\n tickMark.x2().set_11rb$(markLength);\n tickMark.y2().set_11rb$(0.0);\n }if (gridLine != null) {\n gridLine.x2().set_11rb$(-gridLineLength);\n gridLine.y2().set_11rb$(0.0);\n }} else if (equals(tmp$, Orientation$TOP_getInstance())) {\n if (tickMark != null) {\n tickMark.x2().set_11rb$(0.0);\n tickMark.y2().set_11rb$(-markLength);\n }if (gridLine != null) {\n gridLine.x2().set_11rb$(0.0);\n gridLine.y2().set_11rb$(gridLineLength);\n }} else if (equals(tmp$, Orientation$BOTTOM_getInstance())) {\n if (tickMark != null) {\n tickMark.x2().set_11rb$(0.0);\n tickMark.y2().set_11rb$(markLength);\n }if (gridLine != null) {\n gridLine.x2().set_11rb$(0.0);\n gridLine.y2().set_11rb$(-gridLineLength);\n }} else\n throw RuntimeException_init('Unexpected orientation:' + toString(this.orientation_0.get()));\n var g = new SvgGElement();\n if (gridLine != null) {\n g.children().add_11rb$(gridLine);\n }if (tickMark != null) {\n g.children().add_11rb$(tickMark);\n }if (tickLabel != null) {\n tickLabel.moveTo_lu1900$(labelOffset.x, labelOffset.y);\n tickLabel.setHorizontalAnchor_ja80zo$(this.tickLabelHorizontalAnchor.get());\n tickLabel.setVerticalAnchor_yaudma$(this.tickLabelVerticalAnchor.get());\n tickLabel.rotate_14dthe$(this.tickLabelRotationDegree.get());\n g.children().add_11rb$(tickLabel.rootGroup);\n }g.addClass_61zpoe$(Style_getInstance().TICK);\n return g;\n };\n AxisComponent.prototype.tickMarkLength_0 = function () {\n var tmp$;\n if (this.myTickMarksEnabled_0.get()) {\n tmp$ = this.tickMarkLength.get();\n } else {\n tmp$ = 0.0;\n }\n return tmp$;\n };\n AxisComponent.prototype.tickLabelDistance_0 = function () {\n return this.tickMarkLength_0() + this.tickMarkPadding.get();\n };\n AxisComponent.prototype.tickLabelBaseOffset_0 = function () {\n var tmp$, tmp$_0;\n var distance = this.tickLabelDistance_0();\n tmp$ = this.orientation_0.get();\n if (equals(tmp$, Orientation$LEFT_getInstance()))\n tmp$_0 = new DoubleVector(-distance, 0.0);\n else if (equals(tmp$, Orientation$RIGHT_getInstance()))\n tmp$_0 = new DoubleVector(distance, 0.0);\n else if (equals(tmp$, Orientation$TOP_getInstance()))\n tmp$_0 = new DoubleVector(0.0, -distance);\n else if (equals(tmp$, Orientation$BOTTOM_getInstance()))\n tmp$_0 = new DoubleVector(0.0, distance);\n else\n throw RuntimeException_init('Unexpected orientation:' + toString(this.orientation_0.get()));\n return tmp$_0;\n };\n AxisComponent.prototype.tickLabelOffset_0 = function (tickIndex) {\n var additionalOffsets = this.tickLabelOffsets.get();\n var additionalOffset = additionalOffsets != null ? additionalOffsets.get_za3lpa$(tickIndex) : DoubleVector.Companion.ZERO;\n return this.tickLabelBaseOffset_0().add_gpjtzr$(additionalOffset);\n };\n AxisComponent.prototype.breaksEnabled_0 = function () {\n return this.myTickMarksEnabled_0.get() || this.myTickLabelsEnabled_0.get();\n };\n AxisComponent.prototype.tickMarksEnabled = function () {\n return this.myTickMarksEnabled_0;\n };\n AxisComponent.prototype.tickLabelsEnabled = function () {\n return this.myTickLabelsEnabled_0;\n };\n AxisComponent.prototype.axisLineEnabled = function () {\n return this.myAxisLineEnabled_0;\n };\n function AxisComponent_init$asPropertyChangedEventSource($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, EventSource) ? tmp$ : throwCCE();\n }\n AxisComponent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AxisComponent',\n interfaces: [SvgComponent]\n };\n function ColorBarComponent(spec) {\n LegendBox.call(this);\n this.spec_xr0de$_0 = spec;\n }\n Object.defineProperty(ColorBarComponent.prototype, 'spec', {\n get: function () {\n return this.spec_xr0de$_0;\n }\n });\n ColorBarComponent.prototype.appendGuideContent_26jijc$ = function (contentRoot) {\n var tmp$, tmp$_0;\n var layout = this.spec.layout;\n var guideBarGroup = new SvgGElement();\n var barBounds = layout.barBounds;\n var horizontal = layout.isHorizontal;\n this.addColorBar_0(guideBarGroup, this.spec.domain, this.spec.scale, this.spec.binCount, barBounds, layout.barLengthExpand, horizontal, this.spec.reverse);\n if (horizontal)\n tmp$ = barBounds.height;\n else\n tmp$ = barBounds.width;\n var barThickness = tmp$;\n var tickLength = barThickness / 5;\n var breakInfos = layout.breakInfos_8be2vx$.iterator();\n tmp$_0 = this.spec.breaks.iterator();\n while (tmp$_0.hasNext()) {\n var br = tmp$_0.next();\n var brInfo = breakInfos.next();\n var tickLocation = brInfo.tickLocation;\n var tickMarkPoints = ArrayList_init();\n if (horizontal) {\n var tickX = barBounds.left + tickLocation;\n tickMarkPoints.add_11rb$(new DoubleVector(tickX, barBounds.top));\n tickMarkPoints.add_11rb$(new DoubleVector(tickX, barBounds.top + tickLength));\n tickMarkPoints.add_11rb$(new DoubleVector(tickX, barBounds.bottom - tickLength));\n tickMarkPoints.add_11rb$(new DoubleVector(tickX, barBounds.bottom));\n } else {\n var tickY = barBounds.top + tickLocation;\n tickMarkPoints.add_11rb$(new DoubleVector(barBounds.left, tickY));\n tickMarkPoints.add_11rb$(new DoubleVector(barBounds.left + tickLength, tickY));\n tickMarkPoints.add_11rb$(new DoubleVector(barBounds.right - tickLength, tickY));\n tickMarkPoints.add_11rb$(new DoubleVector(barBounds.right, tickY));\n }\n this.addTickMark_0(guideBarGroup, tickMarkPoints.get_za3lpa$(0), tickMarkPoints.get_za3lpa$(1));\n this.addTickMark_0(guideBarGroup, tickMarkPoints.get_za3lpa$(2), tickMarkPoints.get_za3lpa$(3));\n var label = new TextLabel(br.label);\n label.setHorizontalAnchor_ja80zo$(brInfo.labelHorizontalAnchor);\n label.setVerticalAnchor_yaudma$(brInfo.labelVerticalAnchor);\n label.moveTo_lu1900$(brInfo.labelLocation.x, brInfo.labelLocation.y + barBounds.top);\n guideBarGroup.children().add_11rb$(label.rootGroup);\n }\n guideBarGroup.children().add_11rb$(LegendBox$Companion_getInstance().createBorder_a5dgib$(barBounds, this.spec.theme.backgroundFill(), 1.0));\n if (this.debug) {\n var graphBounds = new DoubleRectangle(DoubleVector.Companion.ZERO, layout.graphSize);\n guideBarGroup.children().add_11rb$(LegendBox$Companion_getInstance().createBorder_a5dgib$(graphBounds, Color.Companion.DARK_BLUE, 1.0));\n }contentRoot.children().add_11rb$(guideBarGroup);\n return layout.size;\n };\n ColorBarComponent.prototype.addColorBar_0 = function (g, domain, scale_0, numBins, barBounds, barLengthExpand, horizontal, reverse_0) {\n var tmp$;\n var domainSpan = data_0.SeriesUtil.span_4fzjta$(domain);\n var stepCount = JsMath.max(2, numBins);\n var step = domainSpan / stepCount;\n var v = domain.lowerEnd + step / 2;\n var domainValues = ArrayList_init();\n for (var i = 0; i < stepCount; i++) {\n domainValues.add_11rb$(v + step * i);\n }\n if (reverse_0) {\n reverse(domainValues);\n }var colors = scale.ScaleUtil.map_9ksyxk$(domainValues, scale_0);\n if (horizontal)\n tmp$ = barBounds.width;\n else\n tmp$ = barBounds.height;\n var barLength = tmp$;\n var effectiveBarLength = barLength - barLengthExpand * 2;\n var segmentStep = effectiveBarLength / stepCount;\n var segmentLeft = barBounds.left;\n var segmentRight = barBounds.right;\n var segmentBottom = barBounds.bottom;\n var segmentTop = barBounds.top;\n var i_0 = 0;\n for (var tmp$_0 = colors.iterator(); tmp$_0.hasNext(); ++i_0) {\n var color = tmp$_0.next();\n var r = SvgRectElement_init_0(segmentLeft, segmentTop, segmentRight - segmentLeft, segmentBottom - segmentTop);\n r.strokeWidth().set_11rb$(0.0);\n r.fillColor().set_11rb$(color);\n g.children().add_11rb$(r);\n if (horizontal) {\n segmentLeft += segmentStep;\n } else {\n segmentTop += segmentStep;\n }\n if (i_0 === 0) {\n if (horizontal) {\n segmentLeft += barLengthExpand;\n } else {\n segmentTop += barLengthExpand;\n }\n }}\n };\n ColorBarComponent.prototype.addTickMark_0 = function (g, p0, p1) {\n var line = SvgLineElement_init(p0.x, p0.y, p1.x, p1.y);\n line.strokeWidth().set_11rb$(1.0);\n line.strokeColor().set_11rb$(this.spec.theme.backgroundFill());\n g.children().add_11rb$(line);\n };\n ColorBarComponent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBarComponent',\n interfaces: [LegendBox]\n };\n function ColorBarComponentLayout(title, domain, breaks, guideBarSize, legendDirection, reverse) {\n ColorBarComponentLayout$Companion_getInstance();\n LegendBoxLayout.call(this, title, legendDirection);\n this.guideBarSize = guideBarSize;\n this.barBounds_qhvd9h$_0 = null;\n this.barLengthExpand = 2.0;\n this.breakInfos_8be2vx$ = null;\n var guideBarLength = this.guideBarLength;\n var targetRange = new ClosedRange(0.0 + this.barLengthExpand, guideBarLength - this.barLengthExpand);\n var mapper = scale.Mappers.linear_1jkouz$(domain, targetRange, reverse);\n var destination = ArrayList_init_1(collectionSizeOrDefault(breaks, 10));\n var tmp$;\n tmp$ = breaks.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_0 = destination.add_11rb$;\n var tickLocation = mapper(item.domainValue);\n tmp$_0.call(destination, this.createBreakInfo_14dthe$(tickLocation));\n }\n this.breakInfos_8be2vx$ = destination;\n this.barBounds = new DoubleRectangle(DoubleVector.Companion.ZERO, this.guideBarSize);\n }\n Object.defineProperty(ColorBarComponentLayout.prototype, 'barBounds', {\n configurable: true,\n get: function () {\n return this.barBounds_qhvd9h$_0;\n },\n set: function (barBounds) {\n this.barBounds_qhvd9h$_0 = barBounds;\n }\n });\n function ColorBarComponentLayout$BreakInfo(tickLocation, labelLocation, labelHorizontalAnchor, labelVerticalAnchor) {\n this.tickLocation = tickLocation;\n this.labelLocation = labelLocation;\n this.labelHorizontalAnchor = labelHorizontalAnchor;\n this.labelVerticalAnchor = labelVerticalAnchor;\n }\n ColorBarComponentLayout$BreakInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BreakInfo',\n interfaces: []\n };\n function ColorBarComponentLayout$HorizontalLayout(title, domain, breaks, barSize, reverse) {\n ColorBarComponentLayout.call(this, title, domain, breaks, barSize, LegendDirection$HORIZONTAL_getInstance(), reverse);\n this.graphSize_4lks14$_0 = null;\n this.graphSize_4lks14$_0 = new DoubleVector(this.guideBarSize.x, this.guideBarSize.y + this.labelDistance_0 + LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.height());\n }\n Object.defineProperty(ColorBarComponentLayout$HorizontalLayout.prototype, 'graphSize', {\n configurable: true,\n get: function () {\n return this.graphSize_4lks14$_0;\n }\n });\n Object.defineProperty(ColorBarComponentLayout$HorizontalLayout.prototype, 'labelDistance_0', {\n configurable: true,\n get: function () {\n return LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.height() / 3;\n }\n });\n Object.defineProperty(ColorBarComponentLayout$HorizontalLayout.prototype, 'guideBarLength', {\n configurable: true,\n get: function () {\n return this.guideBarSize.x;\n }\n });\n ColorBarComponentLayout$HorizontalLayout.prototype.createBreakInfo_14dthe$ = function (tickLocation) {\n var labelLocation = new DoubleVector(tickLocation, this.guideBarSize.y + this.labelDistance_0);\n return new ColorBarComponentLayout$BreakInfo(tickLocation, labelLocation, TextLabel$HorizontalAnchor.MIDDLE, TextLabel$VerticalAnchor.TOP);\n };\n ColorBarComponentLayout$HorizontalLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalLayout',\n interfaces: [ColorBarComponentLayout]\n };\n function ColorBarComponentLayout$VerticalLayout(title, domain, breaks, barSize, reverse) {\n ColorBarComponentLayout.call(this, title, domain, breaks, barSize, LegendDirection$VERTICAL_getInstance(), reverse);\n this.graphSize_ld8mnu$_0 = null;\n if (!!breaks.isEmpty()) {\n var message = 'Colorbar VerticalLayout received empty breaks list.';\n throw IllegalStateException_init(message.toString());\n }var destination = ArrayList_init_1(collectionSizeOrDefault(breaks, 10));\n var tmp$;\n tmp$ = breaks.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(item.label.length);\n }\n var iterator = destination.iterator();\n if (!iterator.hasNext())\n throw NoSuchElementException_init();\n var it = iterator.next();\n var maxValue = LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(it);\n while (iterator.hasNext()) {\n var it_0 = iterator.next();\n var v = LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(it_0);\n maxValue = JsMath.max(maxValue, v);\n }\n var maxLabelWidth = maxValue;\n this.graphSize_ld8mnu$_0 = new DoubleVector(this.guideBarSize.x + this.labelDistance_0 + maxLabelWidth, this.guideBarSize.y);\n }\n Object.defineProperty(ColorBarComponentLayout$VerticalLayout.prototype, 'graphSize', {\n configurable: true,\n get: function () {\n return this.graphSize_ld8mnu$_0;\n }\n });\n Object.defineProperty(ColorBarComponentLayout$VerticalLayout.prototype, 'labelDistance_0', {\n configurable: true,\n get: function () {\n return LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(1) / 2;\n }\n });\n Object.defineProperty(ColorBarComponentLayout$VerticalLayout.prototype, 'guideBarLength', {\n configurable: true,\n get: function () {\n return this.guideBarSize.y;\n }\n });\n ColorBarComponentLayout$VerticalLayout.prototype.createBreakInfo_14dthe$ = function (tickLocation) {\n var labelLocation = new DoubleVector(this.guideBarSize.x + this.labelDistance_0, tickLocation);\n return new ColorBarComponentLayout$BreakInfo(tickLocation, labelLocation, TextLabel$HorizontalAnchor.LEFT, TextLabel$VerticalAnchor.CENTER);\n };\n ColorBarComponentLayout$VerticalLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalLayout',\n interfaces: [ColorBarComponentLayout]\n };\n function ColorBarComponentLayout$Companion() {\n ColorBarComponentLayout$Companion_instance = this;\n }\n ColorBarComponentLayout$Companion.prototype.horizontal_v3yhow$ = function (title, domain, breaks, barSize, reverse) {\n return new ColorBarComponentLayout$HorizontalLayout(title, domain, breaks, barSize, reverse);\n };\n ColorBarComponentLayout$Companion.prototype.vertical_v3yhow$ = function (title, domain, breaks, barSize, reverse) {\n return new ColorBarComponentLayout$VerticalLayout(title, domain, breaks, barSize, reverse);\n };\n ColorBarComponentLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorBarComponentLayout$Companion_instance = null;\n function ColorBarComponentLayout$Companion_getInstance() {\n if (ColorBarComponentLayout$Companion_instance === null) {\n new ColorBarComponentLayout$Companion();\n }return ColorBarComponentLayout$Companion_instance;\n }\n ColorBarComponentLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBarComponentLayout',\n interfaces: [LegendBoxLayout]\n };\n function ColorBarComponentSpec(title, domain, breaks, scale, binCount, theme, layout, reverse) {\n ColorBarComponentSpec$Companion_getInstance();\n LegendBoxSpec.call(this, title, theme, reverse);\n this.domain = domain;\n this.breaks = breaks;\n this.scale = scale;\n this.binCount = binCount;\n this.layout_smwmum$_0 = layout;\n }\n Object.defineProperty(ColorBarComponentSpec.prototype, 'layout', {\n get: function () {\n return this.layout_smwmum$_0;\n }\n });\n function ColorBarComponentSpec$Companion() {\n ColorBarComponentSpec$Companion_instance = this;\n this.DEF_NUM_BIN = 20;\n this.DEF_BAR_THICKNESS_0 = 1.0;\n this.DEF_BAR_LENGTH_0 = 5.0;\n }\n ColorBarComponentSpec$Companion.prototype.barAbsoluteSize_kkcal5$ = function (horizontal, theme) {\n var tmp$;\n if (horizontal)\n tmp$ = new DoubleVector(this.DEF_BAR_LENGTH_0 * theme.keySize(), this.DEF_BAR_THICKNESS_0 * theme.keySize());\n else\n tmp$ = new DoubleVector(this.DEF_BAR_THICKNESS_0 * theme.keySize(), this.DEF_BAR_LENGTH_0 * theme.keySize());\n return tmp$;\n };\n ColorBarComponentSpec$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorBarComponentSpec$Companion_instance = null;\n function ColorBarComponentSpec$Companion_getInstance() {\n if (ColorBarComponentSpec$Companion_instance === null) {\n new ColorBarComponentSpec$Companion();\n }return ColorBarComponentSpec$Companion_instance;\n }\n ColorBarComponentSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBarComponentSpec',\n interfaces: [LegendBoxSpec]\n };\n function LegendArrangement(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LegendArrangement_initFields() {\n LegendArrangement_initFields = function () {\n };\n LegendArrangement$HORIZONTAL_instance = new LegendArrangement('HORIZONTAL', 0);\n LegendArrangement$VERTICAL_instance = new LegendArrangement('VERTICAL', 1);\n }\n var LegendArrangement$HORIZONTAL_instance;\n function LegendArrangement$HORIZONTAL_getInstance() {\n LegendArrangement_initFields();\n return LegendArrangement$HORIZONTAL_instance;\n }\n var LegendArrangement$VERTICAL_instance;\n function LegendArrangement$VERTICAL_getInstance() {\n LegendArrangement_initFields();\n return LegendArrangement$VERTICAL_instance;\n }\n LegendArrangement.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendArrangement',\n interfaces: [Enum]\n };\n function LegendArrangement$values() {\n return [LegendArrangement$HORIZONTAL_getInstance(), LegendArrangement$VERTICAL_getInstance()];\n }\n LegendArrangement.values = LegendArrangement$values;\n function LegendArrangement$valueOf(name) {\n switch (name) {\n case 'HORIZONTAL':\n return LegendArrangement$HORIZONTAL_getInstance();\n case 'VERTICAL':\n return LegendArrangement$VERTICAL_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.guide.LegendArrangement.' + name);\n }\n }\n LegendArrangement.valueOf_61zpoe$ = LegendArrangement$valueOf;\n function LegendBox() {\n LegendBox$Companion_getInstance();\n SvgComponent.call(this);\n this.debug = false;\n }\n Object.defineProperty(LegendBox.prototype, 'title_aaysjy$_0', {\n configurable: true,\n get: function () {\n return this.spec.title;\n }\n });\n Object.defineProperty(LegendBox.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.spec.size;\n }\n });\n LegendBox.prototype.hasTitle_kmjss0$_0 = function () {\n return this.spec.hasTitle();\n };\n LegendBox.prototype.buildComponent = function () {\n this.addClassName_61zpoe$(Style_getInstance().LEGEND);\n var outerBounds = new DoubleRectangle(DoubleVector.Companion.ZERO, this.spec.size);\n this.addRectangle_7omvup$(this.spec.innerBounds, this.spec.theme.backgroundFill());\n var innerGroup = new SvgGElement();\n innerGroup.transform().set_11rb$(SvgComponent.Companion.buildTransform_e1sv3v$(this.spec.contentOrigin, 0.0));\n var l = this.spec.layout;\n if (this.hasTitle_kmjss0$_0()) {\n var label = this.createTitleLabel_d65hob$_0(l.titleLocation, l.titleHorizontalAnchor, l.titleVerticalAnchor);\n innerGroup.children().add_11rb$(label.rootGroup);\n }var graphGroup = new SvgGElement();\n graphGroup.transform().set_11rb$(SvgComponent.Companion.buildTransform_e1sv3v$(l.graphOrigin, 0.0));\n this.appendGuideContent_26jijc$(graphGroup);\n innerGroup.children().add_11rb$(graphGroup);\n if (this.debug) {\n this.addBorder_a5dgib$(outerBounds, Color.Companion.CYAN, 1.0);\n var rect = SvgRectElement_init(this.spec.innerBounds);\n rect.fillColor().set_11rb$(Color.Companion.BLACK);\n rect.strokeWidth().set_11rb$(0.0);\n rect.fillOpacity().set_11rb$(0.1);\n this.add_26jijc$(rect);\n this.addBorder_a5dgib$(this.spec.contentBounds, Color.Companion.DARK_MAGENTA, 1.0);\n this.addBorder_a5dgib$(l.titleBounds.add_gpjtzr$(this.spec.contentOrigin), Color.Companion.MAGENTA, 1.0);\n }this.add_26jijc$(innerGroup);\n };\n LegendBox.prototype.addBorder_a5dgib$ = function (bounds, strokeColor, strokeWidth) {\n this.add_26jijc$(LegendBox$Companion_getInstance().createBorder_a5dgib$(bounds, strokeColor, strokeWidth));\n };\n LegendBox.prototype.addRectangle_7omvup$ = function (bounds, fillColor) {\n this.add_26jijc$(LegendBox$Companion_getInstance().createRectangle_0(bounds, fillColor));\n };\n LegendBox.prototype.createTitleLabel_d65hob$_0 = function (origin, horizontalAnchor, verticalAnchor) {\n var label = new TextLabel(this.title_aaysjy$_0);\n label.addClassName_61zpoe$(Style_getInstance().LEGEND_TITLE);\n label.setHorizontalAnchor_ja80zo$(horizontalAnchor);\n label.setVerticalAnchor_yaudma$(verticalAnchor);\n label.moveTo_gpjtzr$(origin);\n return label;\n };\n function LegendBox$Companion() {\n LegendBox$Companion_instance = this;\n }\n LegendBox$Companion.prototype.createBorder_a5dgib$ = function (bounds, strokeColor, strokeWidth) {\n var rect = SvgRectElement_init(bounds);\n rect.strokeColor().set_11rb$(strokeColor);\n rect.strokeWidth().set_11rb$(strokeWidth);\n rect.fillOpacity().set_11rb$(0.0);\n return rect;\n };\n LegendBox$Companion.prototype.createRectangle_0 = function (bounds, fillColor) {\n var rect = SvgRectElement_init(bounds);\n rect.fillColor().set_11rb$(fillColor);\n return rect;\n };\n LegendBox$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendBox$Companion_instance = null;\n function LegendBox$Companion_getInstance() {\n if (LegendBox$Companion_instance === null) {\n new LegendBox$Companion();\n }return LegendBox$Companion_instance;\n }\n LegendBox.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBox',\n interfaces: [SvgComponent]\n };\n function LegendBoxLayout(title, legendDirection) {\n LegendBoxLayout$Companion_getInstance();\n this.title_47v7cs$_0 = title;\n this.isHorizontal = legendDirection === LegendDirection$HORIZONTAL_getInstance();\n this.titleHorizontalAnchor = TextLabel$HorizontalAnchor.LEFT;\n var tmp$;\n if (this.isHorizontal) {\n tmp$ = TextLabel$VerticalAnchor.CENTER;\n } else {\n tmp$ = TextLabel$VerticalAnchor.TOP;\n }\n this.titleVerticalAnchor = tmp$;\n }\n Object.defineProperty(LegendBoxLayout.prototype, 'titleBounds', {\n configurable: true,\n get: function () {\n var origin = this.titleLocation;\n var size = LegendBoxLayout$Companion_getInstance().titleSize_0(this.title_47v7cs$_0);\n if (this.isHorizontal) {\n origin = new DoubleVector(origin.x, origin.y - size.y / 2);\n }return new DoubleRectangle(origin, size);\n }\n });\n Object.defineProperty(LegendBoxLayout.prototype, 'graphOrigin', {\n configurable: true,\n get: function () {\n if (this.isHorizontal)\n return new DoubleVector(LegendBoxLayout$Companion_getInstance().titleSize_0(this.title_47v7cs$_0).x, 0.0);\n else\n return new DoubleVector(0.0, LegendBoxLayout$Companion_getInstance().titleSize_0(this.title_47v7cs$_0).y);\n }\n });\n Object.defineProperty(LegendBoxLayout.prototype, 'size', {\n configurable: true,\n get: function () {\n var graphBounds = new DoubleRectangle(this.graphOrigin, this.graphSize);\n var titleAndContent = (new DoubleRectangle(DoubleVector.Companion.ZERO, DoubleVector.Companion.ZERO)).union_wthzt5$(this.titleBounds).union_wthzt5$(graphBounds);\n return titleAndContent.dimension;\n }\n });\n Object.defineProperty(LegendBoxLayout.prototype, 'titleLocation', {\n configurable: true,\n get: function () {\n if (this.isHorizontal) {\n var graphSize = this.graphSize;\n return new DoubleVector(0.0, graphSize.y / 2);\n } else {\n var y = -LegendBoxLayout$Companion_getInstance().TITLE_SPEC_0.height() / 3;\n return new DoubleVector(0.0, y);\n }\n }\n });\n function LegendBoxLayout$Companion() {\n LegendBoxLayout$Companion_instance = this;\n this.TITLE_SPEC_0 = PlotLabelSpec$LEGEND_TITLE_getInstance();\n this.LABEL_SPEC_8be2vx$ = PlotLabelSpec$LEGEND_ITEM_getInstance();\n }\n LegendBoxLayout$Companion.prototype.titleSize_0 = function (s) {\n var tmp$;\n if (isBlank(s))\n tmp$ = DoubleVector.Companion.ZERO;\n else\n tmp$ = this.TITLE_SPEC_0.dimensions_za3lpa$(s.length);\n return tmp$;\n };\n LegendBoxLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendBoxLayout$Companion_instance = null;\n function LegendBoxLayout$Companion_getInstance() {\n if (LegendBoxLayout$Companion_instance === null) {\n new LegendBoxLayout$Companion();\n }return LegendBoxLayout$Companion_instance;\n }\n LegendBoxLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBoxLayout',\n interfaces: []\n };\n function LegendBoxSpec(title, theme, reverse) {\n this.title = title;\n this.theme = theme;\n this.reverse = reverse;\n this.contentOrigin = null;\n this.fullContentExtend_5hau13$_0 = null;\n this.innerOrigin_3w1y5t$_0 = null;\n this.innerContentExtend_wllzuc$_0 = null;\n var contentExpand = this.theme.margin() + this.theme.padding();\n this.contentOrigin = new DoubleVector(contentExpand, contentExpand);\n this.fullContentExtend_5hau13$_0 = new DoubleVector(contentExpand * 2, contentExpand * 2);\n this.innerOrigin_3w1y5t$_0 = new DoubleVector(this.theme.margin(), this.theme.margin());\n this.innerContentExtend_wllzuc$_0 = new DoubleVector(this.theme.padding() * 2, this.theme.padding() * 2);\n }\n Object.defineProperty(LegendBoxSpec.prototype, 'contentSize_cb71ch$_0', {\n configurable: true,\n get: function () {\n return this.layout.size;\n }\n });\n Object.defineProperty(LegendBoxSpec.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.contentSize_cb71ch$_0.add_gpjtzr$(this.fullContentExtend_5hau13$_0);\n }\n });\n Object.defineProperty(LegendBoxSpec.prototype, 'innerBounds', {\n configurable: true,\n get: function () {\n return new DoubleRectangle(this.innerOrigin_3w1y5t$_0, this.contentSize_cb71ch$_0.add_gpjtzr$(this.innerContentExtend_wllzuc$_0));\n }\n });\n Object.defineProperty(LegendBoxSpec.prototype, 'contentBounds', {\n configurable: true,\n get: function () {\n return new DoubleRectangle(this.contentOrigin, this.contentSize_cb71ch$_0);\n }\n });\n LegendBoxSpec.prototype.hasTitle = function () {\n return !isBlank(this.title);\n };\n LegendBoxSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBoxSpec',\n interfaces: []\n };\n function LegendBreak(label) {\n LegendBreak$Companion_getInstance();\n this.label = label;\n this.myLayers_0 = ArrayList_init();\n }\n Object.defineProperty(LegendBreak.prototype, 'minimumKeySize', {\n configurable: true,\n get: function () {\n var tmp$;\n var minSize = DoubleVector.Companion.ZERO;\n tmp$ = this.myLayers_0.iterator();\n while (tmp$.hasNext()) {\n var layer = tmp$.next();\n var layerMinKeySize = layer.keyElementFactory.minimumKeySize_l6g9mh$(layer.dataPoint);\n minSize = minSize.max_gpjtzr$(layerMinKeySize);\n }\n return minSize;\n }\n });\n Object.defineProperty(LegendBreak.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myLayers_0.isEmpty();\n }\n });\n LegendBreak.prototype.addLayer_w0u015$ = function (dataPoint, keyElementFactory) {\n this.myLayers_0.add_11rb$(new LegendBreak$LegendBreakLayer(dataPoint, keyElementFactory));\n };\n LegendBreak.prototype.createKeyElement_gpjtzr$ = function (size) {\n var tmp$;\n var g = new SvgGElement();\n tmp$ = this.myLayers_0.iterator();\n while (tmp$.hasNext()) {\n var layer = tmp$.next();\n var keyElement = layer.keyElementFactory.createKeyElement_s1fn0c$(layer.dataPoint, size);\n g.children().add_11rb$(keyElement);\n }\n return g;\n };\n function LegendBreak$LegendBreakLayer(dataPoint, keyElementFactory) {\n this.dataPoint = dataPoint;\n this.keyElementFactory = keyElementFactory;\n }\n LegendBreak$LegendBreakLayer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBreakLayer',\n interfaces: []\n };\n function LegendBreak$Companion() {\n LegendBreak$Companion_instance = this;\n }\n LegendBreak$Companion.prototype.simple_998ysp$ = function (label, dataPoint, keyElementFactory) {\n var br = new LegendBreak(label);\n br.addLayer_w0u015$(dataPoint, keyElementFactory);\n return br;\n };\n LegendBreak$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendBreak$Companion_instance = null;\n function LegendBreak$Companion_getInstance() {\n if (LegendBreak$Companion_instance === null) {\n new LegendBreak$Companion();\n }return LegendBreak$Companion_instance;\n }\n LegendBreak.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBreak',\n interfaces: []\n };\n function LegendComponent(spec) {\n LegendBox.call(this);\n this.spec_8zhhsr$_0 = spec;\n }\n Object.defineProperty(LegendComponent.prototype, 'spec', {\n get: function () {\n return this.spec_8zhhsr$_0;\n }\n });\n LegendComponent.prototype.appendGuideContent_26jijc$ = function (contentRoot) {\n var tmp$;\n var layout = this.spec.layout;\n var keyLabelBoxes = layout.keyLabelBoxes.iterator();\n var labelBoxes = layout.labelBoxes.iterator();\n tmp$ = this.spec.breaks_8be2vx$.iterator();\n while (tmp$.hasNext()) {\n var br = tmp$.next();\n var keyLabelBox = keyLabelBoxes.next();\n var labelBox = labelBoxes.next();\n var breakElement = this.createBreakElement_0(br, layout.keySize, keyLabelBox, labelBox);\n contentRoot.children().add_11rb$(breakElement);\n }\n return layout.size;\n };\n LegendComponent.prototype.createBreakElement_0 = function (br, keySize, keyLabelBox, labelBox) {\n var breakComponent = new GroupComponent();\n breakComponent.add_26jijc$(this.createKeyElement_0(br, keySize));\n var label = new TextLabel(br.label);\n label.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.LEFT);\n label.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.CENTER);\n label.moveTo_gpjtzr$(labelBox.origin.add_gpjtzr$(new DoubleVector(0.0, labelBox.height / 2)));\n breakComponent.add_8icvvv$(label);\n breakComponent.moveTo_gpjtzr$(keyLabelBox.origin);\n return breakComponent.rootGroup;\n };\n LegendComponent.prototype.createKeyElement_0 = function (legendBreak, size) {\n var g = new SvgGElement();\n var innerSize = new DoubleVector(size.x - 2, size.y - 2);\n var backgroundFill = this.spec.theme.backgroundFill();\n var backgroundRect = SvgRectElement_init_0(1.0, 1.0, innerSize.x, innerSize.y);\n backgroundRect.strokeWidth().set_11rb$(1.0);\n backgroundRect.strokeColor().set_11rb$(backgroundFill);\n backgroundRect.fillColor().set_11rb$(backgroundFill);\n g.children().add_11rb$(backgroundRect);\n var keyElement = legendBreak.createKeyElement_gpjtzr$(innerSize);\n var keyElementTransform = SvgComponent.Companion.buildTransform_e1sv3v$(new DoubleVector(1.0, 1.0), 0.0);\n keyElement.transform().set_11rb$(keyElementTransform);\n g.children().add_11rb$(keyElement);\n var frame = SvgRectElement_init_0(0.0, 0.0, size.x, size.y);\n frame.strokeWidth().set_11rb$(1.0);\n frame.strokeColor().set_11rb$(backgroundFill);\n frame.fill().set_11rb$(SvgColors.NONE);\n g.children().add_11rb$(frame);\n return g;\n };\n LegendComponent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendComponent',\n interfaces: [LegendBox]\n };\n function LegendComponentLayout(title, breaks, keySize, legendDirection) {\n LegendComponentLayout$Companion_getInstance();\n LegendBoxLayout.call(this, title, legendDirection);\n this.breaks = breaks;\n this.keySize = keySize;\n this.myContentSize_8rvo9o$_0 = null;\n this.myKeyLabelBoxes_uk7fn2$_0 = ArrayList_init();\n this.myLabelBoxes_9jhh53$_0 = ArrayList_init();\n this.isFillByRow = false;\n this.rowCount_kvp0d1$_0 = 0;\n this.colCount_nojzuj$_0 = 0;\n }\n Object.defineProperty(LegendComponentLayout.prototype, 'rowCount', {\n configurable: true,\n get: function () {\n return this.rowCount_kvp0d1$_0;\n },\n set: function (rowCount) {\n if (!(rowCount > 0)) {\n var message = 'Row count must be greater than 0, was ' + rowCount;\n throw IllegalStateException_init(message.toString());\n }this.rowCount_kvp0d1$_0 = rowCount;\n }\n });\n Object.defineProperty(LegendComponentLayout.prototype, 'colCount', {\n configurable: true,\n get: function () {\n return this.colCount_nojzuj$_0;\n },\n set: function (colCount) {\n if (!(colCount > 0)) {\n var message = 'Col count must be greater than 0, was ' + colCount;\n throw IllegalStateException_init(message.toString());\n }this.colCount_nojzuj$_0 = colCount;\n }\n });\n Object.defineProperty(LegendComponentLayout.prototype, 'graphSize', {\n configurable: true,\n get: function () {\n this.ensureInited_chkycd$_0();\n return ensureNotNull(this.myContentSize_8rvo9o$_0);\n }\n });\n Object.defineProperty(LegendComponentLayout.prototype, 'keyLabelBoxes', {\n configurable: true,\n get: function () {\n this.ensureInited_chkycd$_0();\n return this.myKeyLabelBoxes_uk7fn2$_0;\n }\n });\n Object.defineProperty(LegendComponentLayout.prototype, 'labelBoxes', {\n configurable: true,\n get: function () {\n this.ensureInited_chkycd$_0();\n return this.myLabelBoxes_9jhh53$_0;\n }\n });\n LegendComponentLayout.prototype.ensureInited_chkycd$_0 = function () {\n if (this.myContentSize_8rvo9o$_0 == null) {\n this.doLayout_zctv6z$_0();\n }};\n LegendComponentLayout.prototype.doLayout_zctv6z$_0 = function () {\n var tmp$;\n var labelHeight = LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.height();\n var labelLeftMargin = LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(1) / 2;\n var labelHOffset = this.keySize.x + labelLeftMargin;\n var labelVOffset = (this.keySize.y - labelHeight) / 2;\n var contentOrigin = DoubleVector.Companion.ZERO;\n var breakBoxBounds = null;\n tmp$ = this.breaks;\n for (var i = 0; i !== tmp$.size; ++i) {\n var tmp$_0;\n var labelSize = this.labelSize_za3lpa$(i);\n var breakBoxSize = new DoubleVector(labelHOffset + labelSize.x, this.keySize.y);\n breakBoxBounds = new DoubleRectangle((tmp$_0 = breakBoxBounds != null ? this.breakBoxOrigin_b4d9xv$(i, breakBoxBounds) : null) != null ? tmp$_0 : contentOrigin, breakBoxSize);\n this.myKeyLabelBoxes_uk7fn2$_0.add_11rb$(breakBoxBounds);\n this.myLabelBoxes_9jhh53$_0.add_11rb$(DoubleRectangle_init(labelHOffset, labelVOffset, labelSize.x, labelSize.y));\n }\n this.myContentSize_8rvo9o$_0 = GeometryUtil_getInstance().union_a7nkjf$(new DoubleRectangle(contentOrigin, DoubleVector.Companion.ZERO), this.myKeyLabelBoxes_uk7fn2$_0).dimension;\n };\n function LegendComponentLayout$MyHorizontal(title, breaks, keySize) {\n LegendComponentLayout.call(this, title, breaks, keySize, LegendDirection$HORIZONTAL_getInstance());\n this.colCount = breaks.size;\n this.rowCount = 1;\n }\n LegendComponentLayout$MyHorizontal.prototype.breakBoxOrigin_b4d9xv$ = function (index, prevBreakBoxBounds) {\n return new DoubleVector(prevBreakBoxBounds.right, 0.0);\n };\n LegendComponentLayout$MyHorizontal.prototype.labelSize_za3lpa$ = function (index) {\n var label = this.breaks.get_za3lpa$(index).label;\n return new DoubleVector(LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(label.length), LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.height());\n };\n LegendComponentLayout$MyHorizontal.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyHorizontal',\n interfaces: [LegendComponentLayout]\n };\n function LegendComponentLayout$MyHorizontalMultiRow(title, breaks, keySize) {\n LegendComponentLayout$MyMultiRow.call(this, title, breaks, keySize, LegendDirection$HORIZONTAL_getInstance());\n this.colCount = breaks.size;\n this.rowCount = 1;\n }\n LegendComponentLayout$MyHorizontalMultiRow.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyHorizontalMultiRow',\n interfaces: [LegendComponentLayout$MyMultiRow]\n };\n function LegendComponentLayout$MyVertical(title, breaks, keySize) {\n LegendComponentLayout$MyMultiRow.call(this, title, breaks, keySize, LegendDirection$VERTICAL_getInstance());\n this.colCount = 1;\n this.rowCount = breaks.size;\n }\n LegendComponentLayout$MyVertical.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyVertical',\n interfaces: [LegendComponentLayout$MyMultiRow]\n };\n function LegendComponentLayout$MyMultiRow(title, breaks, keySize, legendDirection) {\n LegendComponentLayout.call(this, title, breaks, keySize, legendDirection);\n this.myMaxLabelWidth_0 = 0.0;\n var tmp$;\n tmp$ = breaks.iterator();\n while (tmp$.hasNext()) {\n var br = tmp$.next();\n var a = this.myMaxLabelWidth_0;\n var b = LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(br.label.length);\n this.myMaxLabelWidth_0 = JsMath.max(a, b);\n }\n }\n LegendComponentLayout$MyMultiRow.prototype.breakBoxOrigin_b4d9xv$ = function (index, prevBreakBoxBounds) {\n var tmp$, tmp$_0;\n if (this.isFillByRow) {\n if (index % this.colCount === 0) {\n tmp$ = new DoubleVector(0.0, prevBreakBoxBounds.bottom);\n } else\n tmp$ = new DoubleVector(prevBreakBoxBounds.right, prevBreakBoxBounds.top);\n return tmp$;\n }if (index % this.rowCount === 0) {\n tmp$_0 = new DoubleVector(prevBreakBoxBounds.right, 0.0);\n } else\n tmp$_0 = new DoubleVector(prevBreakBoxBounds.left, prevBreakBoxBounds.bottom);\n return tmp$_0;\n };\n LegendComponentLayout$MyMultiRow.prototype.labelSize_za3lpa$ = function (index) {\n return new DoubleVector(this.myMaxLabelWidth_0, LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.height());\n };\n LegendComponentLayout$MyMultiRow.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyMultiRow',\n interfaces: [LegendComponentLayout]\n };\n function LegendComponentLayout$Companion() {\n LegendComponentLayout$Companion_instance = this;\n }\n LegendComponentLayout$Companion.prototype.horizontal_2y8ibu$ = function (title, breaks, keySize) {\n return new LegendComponentLayout$MyHorizontal(title, breaks, keySize);\n };\n LegendComponentLayout$Companion.prototype.horizontalMultiRow_2y8ibu$ = function (title, breaks, keySize) {\n return new LegendComponentLayout$MyHorizontalMultiRow(title, breaks, keySize);\n };\n LegendComponentLayout$Companion.prototype.vertical_2y8ibu$ = function (title, breaks, keySize) {\n return new LegendComponentLayout$MyVertical(title, breaks, keySize);\n };\n LegendComponentLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendComponentLayout$Companion_instance = null;\n function LegendComponentLayout$Companion_getInstance() {\n if (LegendComponentLayout$Companion_instance === null) {\n new LegendComponentLayout$Companion();\n }return LegendComponentLayout$Companion_instance;\n }\n LegendComponentLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendComponentLayout',\n interfaces: [LegendBoxLayout]\n };\n function LegendComponentSpec(title, breaks, theme, layout, reverse) {\n LegendBoxSpec.call(this, title, theme, reverse);\n this.breaks_8be2vx$ = breaks;\n this.layout_ebqbgv$_0 = layout;\n }\n Object.defineProperty(LegendComponentSpec.prototype, 'layout', {\n get: function () {\n return this.layout_ebqbgv$_0;\n }\n });\n LegendComponentSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendComponentSpec',\n interfaces: [LegendBoxSpec]\n };\n function LegendDirection(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LegendDirection_initFields() {\n LegendDirection_initFields = function () {\n };\n LegendDirection$HORIZONTAL_instance = new LegendDirection('HORIZONTAL', 0);\n LegendDirection$VERTICAL_instance = new LegendDirection('VERTICAL', 1);\n LegendDirection$AUTO_instance = new LegendDirection('AUTO', 2);\n }\n var LegendDirection$HORIZONTAL_instance;\n function LegendDirection$HORIZONTAL_getInstance() {\n LegendDirection_initFields();\n return LegendDirection$HORIZONTAL_instance;\n }\n var LegendDirection$VERTICAL_instance;\n function LegendDirection$VERTICAL_getInstance() {\n LegendDirection_initFields();\n return LegendDirection$VERTICAL_instance;\n }\n var LegendDirection$AUTO_instance;\n function LegendDirection$AUTO_getInstance() {\n LegendDirection_initFields();\n return LegendDirection$AUTO_instance;\n }\n LegendDirection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendDirection',\n interfaces: [Enum]\n };\n function LegendDirection$values() {\n return [LegendDirection$HORIZONTAL_getInstance(), LegendDirection$VERTICAL_getInstance(), LegendDirection$AUTO_getInstance()];\n }\n LegendDirection.values = LegendDirection$values;\n function LegendDirection$valueOf(name) {\n switch (name) {\n case 'HORIZONTAL':\n return LegendDirection$HORIZONTAL_getInstance();\n case 'VERTICAL':\n return LegendDirection$VERTICAL_getInstance();\n case 'AUTO':\n return LegendDirection$AUTO_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.guide.LegendDirection.' + name);\n }\n }\n LegendDirection.valueOf_61zpoe$ = LegendDirection$valueOf;\n function LegendJustification(x, y) {\n LegendJustification$Companion_getInstance();\n this.x = x;\n this.y = y;\n }\n function LegendJustification$Companion() {\n LegendJustification$Companion_instance = this;\n this.CENTER = new LegendJustification(0.5, 0.5);\n }\n LegendJustification$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendJustification$Companion_instance = null;\n function LegendJustification$Companion_getInstance() {\n if (LegendJustification$Companion_instance === null) {\n new LegendJustification$Companion();\n }return LegendJustification$Companion_instance;\n }\n LegendJustification.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendJustification',\n interfaces: []\n };\n function LegendPosition(x, y) {\n LegendPosition$Companion_getInstance();\n this.x = x;\n this.y = y;\n }\n Object.defineProperty(LegendPosition.prototype, 'isFixed', {\n configurable: true,\n get: function () {\n return this === LegendPosition$Companion_getInstance().LEFT || this === LegendPosition$Companion_getInstance().RIGHT || this === LegendPosition$Companion_getInstance().TOP || this === LegendPosition$Companion_getInstance().BOTTOM;\n }\n });\n Object.defineProperty(LegendPosition.prototype, 'isHidden', {\n configurable: true,\n get: function () {\n return this === LegendPosition$Companion_getInstance().NONE;\n }\n });\n Object.defineProperty(LegendPosition.prototype, 'isOverlay', {\n configurable: true,\n get: function () {\n return !(this.isFixed || this.isHidden);\n }\n });\n function LegendPosition$Companion() {\n LegendPosition$Companion_instance = this;\n this.RIGHT = new LegendPosition(1.0, 0.5);\n this.LEFT = new LegendPosition(0.0, 0.5);\n this.TOP = new LegendPosition(0.5, 1.0);\n this.BOTTOM = new LegendPosition(0.5, 1.0);\n this.NONE = new LegendPosition(kotlin_js_internal_DoubleCompanionObject.NaN, kotlin_js_internal_DoubleCompanionObject.NaN);\n }\n LegendPosition$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendPosition$Companion_instance = null;\n function LegendPosition$Companion_getInstance() {\n if (LegendPosition$Companion_instance === null) {\n new LegendPosition$Companion();\n }return LegendPosition$Companion_instance;\n }\n LegendPosition.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendPosition',\n interfaces: []\n };\n function Orientation(name, ordinal, myValue) {\n Enum.call(this);\n this.myValue_3zu241$_0 = myValue;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Orientation_initFields() {\n Orientation_initFields = function () {\n };\n Orientation$LEFT_instance = new Orientation('LEFT', 0, 'LEFT');\n Orientation$RIGHT_instance = new Orientation('RIGHT', 1, 'RIGHT');\n Orientation$TOP_instance = new Orientation('TOP', 2, 'TOP');\n Orientation$BOTTOM_instance = new Orientation('BOTTOM', 3, 'BOTTOM');\n }\n var Orientation$LEFT_instance;\n function Orientation$LEFT_getInstance() {\n Orientation_initFields();\n return Orientation$LEFT_instance;\n }\n var Orientation$RIGHT_instance;\n function Orientation$RIGHT_getInstance() {\n Orientation_initFields();\n return Orientation$RIGHT_instance;\n }\n var Orientation$TOP_instance;\n function Orientation$TOP_getInstance() {\n Orientation_initFields();\n return Orientation$TOP_instance;\n }\n var Orientation$BOTTOM_instance;\n function Orientation$BOTTOM_getInstance() {\n Orientation_initFields();\n return Orientation$BOTTOM_instance;\n }\n Object.defineProperty(Orientation.prototype, 'isHorizontal', {\n configurable: true,\n get: function () {\n return this === Orientation$TOP_getInstance() || this === Orientation$BOTTOM_getInstance();\n }\n });\n Orientation.prototype.toString = function () {\n return 'Orientation{' + \"myValue='\" + this.myValue_3zu241$_0 + String.fromCharCode(39) + String.fromCharCode(125);\n };\n Orientation.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Orientation',\n interfaces: [Enum]\n };\n function Orientation$values() {\n return [Orientation$LEFT_getInstance(), Orientation$RIGHT_getInstance(), Orientation$TOP_getInstance(), Orientation$BOTTOM_getInstance()];\n }\n Orientation.values = Orientation$values;\n function Orientation$valueOf(name) {\n switch (name) {\n case 'LEFT':\n return Orientation$LEFT_getInstance();\n case 'RIGHT':\n return Orientation$RIGHT_getInstance();\n case 'TOP':\n return Orientation$TOP_getInstance();\n case 'BOTTOM':\n return Orientation$BOTTOM_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.guide.Orientation.' + name);\n }\n }\n Orientation.valueOf_61zpoe$ = Orientation$valueOf;\n function ContextualMappingProvider() {\n ContextualMappingProvider$Companion_getInstance();\n }\n function ContextualMappingProvider$Companion() {\n ContextualMappingProvider$Companion_instance = this;\n this.NONE = new ContextualMappingProvider$Companion$NONE$ObjectLiteral();\n }\n function ContextualMappingProvider$Companion$NONE$ObjectLiteral() {\n }\n ContextualMappingProvider$Companion$NONE$ObjectLiteral.prototype.createContextualMapping_8fr62e$ = function (dataAccess, dataFrame) {\n return new ContextualMapping(emptyList(), null, null, null, false, false, false, false);\n };\n ContextualMappingProvider$Companion$NONE$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ContextualMappingProvider]\n };\n ContextualMappingProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContextualMappingProvider$Companion_instance = null;\n function ContextualMappingProvider$Companion_getInstance() {\n if (ContextualMappingProvider$Companion_instance === null) {\n new ContextualMappingProvider$Companion();\n }return ContextualMappingProvider$Companion_instance;\n }\n ContextualMappingProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ContextualMappingProvider',\n interfaces: []\n };\n function GeomInteraction(builder) {\n GeomInteraction$Companion_getInstance();\n this.myLocatorLookupSpace_0 = builder.locatorLookupSpace;\n this.myLocatorLookupStrategy_0 = builder.locatorLookupStrategy;\n this.myTooltipLines_0 = builder.tooltipLines;\n this.myTooltipProperties_0 = builder.tooltipProperties;\n this.myIgnoreInvisibleTargets_0 = builder.isIgnoringInvisibleTargets();\n this.myIsCrosshairEnabled_0 = builder.isCrosshairEnabled;\n }\n GeomInteraction.prototype.createLookupSpec = function () {\n return new GeomTargetLocator$LookupSpec(this.myLocatorLookupSpace_0, this.myLocatorLookupStrategy_0);\n };\n GeomInteraction.prototype.createContextualMapping_8fr62e$ = function (dataAccess, dataFrame) {\n var tmp$ = GeomInteraction$Companion_getInstance();\n var $receiver = this.myTooltipLines_0;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(TooltipLine_init(item));\n }\n return tmp$.createContextualMapping_0(destination, dataAccess, dataFrame, this.myTooltipProperties_0, this.myIgnoreInvisibleTargets_0, this.myIsCrosshairEnabled_0);\n };\n function GeomInteraction$Companion() {\n GeomInteraction$Companion_instance = this;\n }\n GeomInteraction$Companion.prototype.createTestContextualMapping_fdc7hd$ = function (aesListForTooltip, axisAes, outliers, dataAccess, dataFrame, userDefinedValueSources) {\n if (userDefinedValueSources === void 0)\n userDefinedValueSources = null;\n var defaultTooltipLines = GeomInteractionBuilder$Companion_getInstance().defaultValueSourceTooltipLines_dnbe1t$(aesListForTooltip, axisAes, outliers, userDefinedValueSources);\n return this.createContextualMapping_0(defaultTooltipLines, dataAccess, dataFrame, TooltipSpecification$TooltipProperties$Companion_getInstance().NONE, false, false);\n };\n GeomInteraction$Companion.prototype.createContextualMapping_0 = function (tooltipLines, dataAccess, dataFrame, tooltipProperties, ignoreInvisibleTargets, isCrosshairEnabled) {\n var dataContext = new DataContext(dataFrame, dataAccess);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = tooltipLines.iterator();\n loop_label: while (tmp$.hasNext()) {\n var element = tmp$.next();\n var $receiver = element.fields;\n var destination_0 = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n if (Kotlin.isType(element_0, MappingValue))\n destination_0.add_11rb$(element_0);\n }\n var dataAesList = destination_0;\n var all$result;\n all$break: do {\n var tmp$_1;\n if (Kotlin.isType(dataAesList, Collection) && dataAesList.isEmpty()) {\n all$result = true;\n break all$break;\n }tmp$_1 = dataAesList.iterator();\n while (tmp$_1.hasNext()) {\n var element_1 = tmp$_1.next();\n if (!dataAccess.isMapped_896ixz$(element_1.aes)) {\n all$result = false;\n break all$break;\n }}\n all$result = true;\n }\n while (false);\n if (all$result)\n destination.add_11rb$(element);\n }\n var mappedTooltipLines = destination;\n var tmp$_2;\n tmp$_2 = mappedTooltipLines.iterator();\n while (tmp$_2.hasNext()) {\n var element_2 = tmp$_2.next();\n element_2.initDataContext_rxi9tf$(dataContext);\n }\n var any$result;\n any$break: do {\n var tmp$_3;\n if (Kotlin.isType(mappedTooltipLines, Collection) && mappedTooltipLines.isEmpty()) {\n any$result = false;\n break any$break;\n }tmp$_3 = mappedTooltipLines.iterator();\n loop_label: while (tmp$_3.hasNext()) {\n var element_3 = tmp$_3.next();\n var $receiver_0 = element_3.fields;\n var predicate = getPropertyCallableRef('isOutlier', 1, function ($receiver) {\n return $receiver.isOutlier;\n });\n var none$result;\n none$break: do {\n var tmp$_4;\n if (Kotlin.isType($receiver_0, Collection) && $receiver_0.isEmpty()) {\n none$result = true;\n break none$break;\n }tmp$_4 = $receiver_0.iterator();\n while (tmp$_4.hasNext()) {\n var element_4 = tmp$_4.next();\n if (predicate(element_4)) {\n none$result = false;\n break none$break;\n }}\n none$result = true;\n }\n while (false);\n if (none$result) {\n any$result = true;\n break any$break;\n }}\n any$result = false;\n }\n while (false);\n var hasGeneralTooltip = any$result;\n var any$result_0;\n any$break: do {\n var tmp$_5;\n if (Kotlin.isType(mappedTooltipLines, Collection) && mappedTooltipLines.isEmpty()) {\n any$result_0 = false;\n break any$break;\n }tmp$_5 = mappedTooltipLines.iterator();\n loop_label: while (tmp$_5.hasNext()) {\n var element_5 = tmp$_5.next();\n var $receiver_1 = element_5.fields;\n var predicate_0 = getPropertyCallableRef('isAxis', 1, function ($receiver) {\n return $receiver.isAxis;\n });\n var any$result_1;\n any$break_0: do {\n var tmp$_6;\n if (Kotlin.isType($receiver_1, Collection) && $receiver_1.isEmpty()) {\n any$result_1 = false;\n break any$break_0;\n }tmp$_6 = $receiver_1.iterator();\n while (tmp$_6.hasNext()) {\n var element_6 = tmp$_6.next();\n if (predicate_0(element_6)) {\n any$result_1 = true;\n break any$break_0;\n }}\n any$result_1 = false;\n }\n while (false);\n if (any$result_1) {\n any$result_0 = true;\n break any$break;\n }}\n any$result_0 = false;\n }\n while (false);\n var hasAxisTooltip = any$result_0;\n return new ContextualMapping(mappedTooltipLines, tooltipProperties.anchor, tooltipProperties.minWidth, tooltipProperties.color, ignoreInvisibleTargets, hasGeneralTooltip, hasAxisTooltip, isCrosshairEnabled);\n };\n GeomInteraction$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomInteraction$Companion_instance = null;\n function GeomInteraction$Companion_getInstance() {\n if (GeomInteraction$Companion_instance === null) {\n new GeomInteraction$Companion();\n }return GeomInteraction$Companion_instance;\n }\n GeomInteraction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomInteraction',\n interfaces: [ContextualMappingProvider]\n };\n function GeomInteractionBuilder(mySupportedAesList) {\n GeomInteractionBuilder$Companion_getInstance();\n this.mySupportedAesList_0 = mySupportedAesList;\n this.myIgnoreInvisibleTargets_0 = false;\n this.locatorLookupSpace_3dt62f$_0 = this.locatorLookupSpace_3dt62f$_0;\n this.locatorLookupStrategy_gpx4i$_0 = this.locatorLookupStrategy_gpx4i$_0;\n this.myAxisTooltipVisibilityFromFunctionKind_0 = false;\n this.myAxisTooltipVisibilityFromConfig_0 = null;\n this.myAxisAesFromFunctionKind_0 = null;\n this.myTooltipAxisAes_vm9teg$_0 = this.myTooltipAxisAes_vm9teg$_0;\n this.myTooltipAes_um80ux$_0 = this.myTooltipAes_um80ux$_0;\n this.myTooltipOutlierAesList_r7qit3$_0 = this.myTooltipOutlierAesList_r7qit3$_0;\n this.myTooltipConstantsAesList_0 = null;\n this.myUserTooltipSpec_0 = null;\n this.myIsCrosshairEnabled_0 = false;\n }\n Object.defineProperty(GeomInteractionBuilder.prototype, 'locatorLookupSpace', {\n configurable: true,\n get: function () {\n if (this.locatorLookupSpace_3dt62f$_0 == null)\n return throwUPAE('locatorLookupSpace');\n return this.locatorLookupSpace_3dt62f$_0;\n },\n set: function (locatorLookupSpace) {\n this.locatorLookupSpace_3dt62f$_0 = locatorLookupSpace;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'locatorLookupStrategy', {\n configurable: true,\n get: function () {\n if (this.locatorLookupStrategy_gpx4i$_0 == null)\n return throwUPAE('locatorLookupStrategy');\n return this.locatorLookupStrategy_gpx4i$_0;\n },\n set: function (locatorLookupStrategy) {\n this.locatorLookupStrategy_gpx4i$_0 = locatorLookupStrategy;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'myTooltipAxisAes_0', {\n configurable: true,\n get: function () {\n if (this.myTooltipAxisAes_vm9teg$_0 == null)\n return throwUPAE('myTooltipAxisAes');\n return this.myTooltipAxisAes_vm9teg$_0;\n },\n set: function (myTooltipAxisAes) {\n this.myTooltipAxisAes_vm9teg$_0 = myTooltipAxisAes;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'myTooltipAes_0', {\n configurable: true,\n get: function () {\n if (this.myTooltipAes_um80ux$_0 == null)\n return throwUPAE('myTooltipAes');\n return this.myTooltipAes_um80ux$_0;\n },\n set: function (myTooltipAes) {\n this.myTooltipAes_um80ux$_0 = myTooltipAes;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'myTooltipOutlierAesList_0', {\n configurable: true,\n get: function () {\n if (this.myTooltipOutlierAesList_r7qit3$_0 == null)\n return throwUPAE('myTooltipOutlierAesList');\n return this.myTooltipOutlierAesList_r7qit3$_0;\n },\n set: function (myTooltipOutlierAesList) {\n this.myTooltipOutlierAesList_r7qit3$_0 = myTooltipOutlierAesList;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'getAxisFromFunctionKind', {\n configurable: true,\n get: function () {\n var tmp$;\n return (tmp$ = this.myAxisAesFromFunctionKind_0) != null ? tmp$ : emptyList();\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'isAxisTooltipEnabled', {\n configurable: true,\n get: function () {\n return this.myAxisTooltipVisibilityFromConfig_0 == null ? this.myAxisTooltipVisibilityFromFunctionKind_0 : ensureNotNull(this.myAxisTooltipVisibilityFromConfig_0);\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'tooltipLines', {\n configurable: true,\n get: function () {\n return this.prepareTooltipValueSources_0();\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'tooltipProperties', {\n configurable: true,\n get: function () {\n var tmp$, tmp$_0;\n return (tmp$_0 = (tmp$ = this.myUserTooltipSpec_0) != null ? tmp$.tooltipProperties : null) != null ? tmp$_0 : TooltipSpecification$TooltipProperties$Companion_getInstance().NONE;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'isCrosshairEnabled', {\n configurable: true,\n get: function () {\n return this.myIsCrosshairEnabled_0;\n }\n });\n GeomInteractionBuilder.prototype.showAxisTooltip_6taknv$ = function (isTrue) {\n this.myAxisTooltipVisibilityFromConfig_0 = isTrue;\n return this;\n };\n GeomInteractionBuilder.prototype.tooltipAes_3lrecq$ = function (aes) {\n this.myTooltipAes_0 = aes;\n return this;\n };\n GeomInteractionBuilder.prototype.axisAes_3lrecq$ = function (axisAes) {\n this.myTooltipAxisAes_0 = axisAes;\n return this;\n };\n GeomInteractionBuilder.prototype.tooltipOutliers_3lrecq$ = function (aes) {\n this.myTooltipOutlierAesList_0 = aes;\n return this;\n };\n GeomInteractionBuilder.prototype.tooltipConstants_ayg7dr$ = function (constantsMap) {\n this.myTooltipConstantsAesList_0 = constantsMap;\n return this;\n };\n GeomInteractionBuilder.prototype.tooltipLinesSpec_uvmyj9$ = function (tooltipSpec) {\n this.myUserTooltipSpec_0 = tooltipSpec;\n return this;\n };\n GeomInteractionBuilder.prototype.setIsCrosshairEnabled_6taknv$ = function (isTrue) {\n this.myIsCrosshairEnabled_0 = isTrue;\n return this;\n };\n GeomInteractionBuilder.prototype.multilayerLookupStrategy = function () {\n this.locatorLookupStrategy = GeomTargetLocator$LookupStrategy.NEAREST;\n this.locatorLookupSpace = GeomTargetLocator$LookupSpace.XY;\n return this;\n };\n GeomInteractionBuilder.prototype.univariateFunction_7k7ojo$ = function (lookupStrategy) {\n this.myAxisAesFromFunctionKind_0 = GeomInteractionBuilder$Companion_getInstance().AES_X_0;\n this.locatorLookupStrategy = lookupStrategy;\n this.myAxisTooltipVisibilityFromFunctionKind_0 = true;\n this.locatorLookupSpace = GeomTargetLocator$LookupSpace.X;\n this.initDefaultTooltips_0();\n return this;\n };\n GeomInteractionBuilder.prototype.bivariateFunction_6taknv$ = function (area) {\n this.myAxisAesFromFunctionKind_0 = GeomInteractionBuilder$Companion_getInstance().AES_XY_0;\n if (area) {\n this.locatorLookupStrategy = GeomTargetLocator$LookupStrategy.HOVER;\n this.myAxisTooltipVisibilityFromFunctionKind_0 = false;\n } else {\n this.locatorLookupStrategy = GeomTargetLocator$LookupStrategy.NEAREST;\n this.myAxisTooltipVisibilityFromFunctionKind_0 = true;\n }\n this.locatorLookupSpace = GeomTargetLocator$LookupSpace.XY;\n this.initDefaultTooltips_0();\n return this;\n };\n GeomInteractionBuilder.prototype.none = function () {\n this.myAxisAesFromFunctionKind_0 = ArrayList_init_0(this.mySupportedAesList_0);\n this.locatorLookupStrategy = GeomTargetLocator$LookupStrategy.NONE;\n this.myAxisTooltipVisibilityFromFunctionKind_0 = true;\n this.locatorLookupSpace = GeomTargetLocator$LookupSpace.NONE;\n this.initDefaultTooltips_0();\n return this;\n };\n GeomInteractionBuilder.prototype.initDefaultTooltips_0 = function () {\n this.myTooltipAxisAes_0 = !this.isAxisTooltipEnabled ? emptyList() : this.getAxisFromFunctionKind;\n this.myTooltipAes_0 = minus(this.mySupportedAesList_0, this.getAxisFromFunctionKind);\n this.myTooltipOutlierAesList_0 = emptyList();\n };\n GeomInteractionBuilder.prototype.prepareTooltipValueSources_0 = function () {\n var tmp$;\n if (this.myUserTooltipSpec_0 == null)\n tmp$ = GeomInteractionBuilder$Companion_getInstance().defaultValueSourceTooltipLines_dnbe1t$(this.myTooltipAes_0, this.myTooltipAxisAes_0, this.myTooltipOutlierAesList_0, null, this.myTooltipConstantsAesList_0);\n else if (ensureNotNull(this.myUserTooltipSpec_0).tooltipLinePatterns == null)\n tmp$ = GeomInteractionBuilder$Companion_getInstance().defaultValueSourceTooltipLines_dnbe1t$(this.myTooltipAes_0, this.myTooltipAxisAes_0, this.myTooltipOutlierAesList_0, ensureNotNull(this.myUserTooltipSpec_0).valueSources, this.myTooltipConstantsAesList_0);\n else if (ensureNotNull(ensureNotNull(this.myUserTooltipSpec_0).tooltipLinePatterns).isEmpty())\n tmp$ = emptyList();\n else {\n var geomOutliers = toMutableList(this.myTooltipOutlierAesList_0);\n var tmp$_0;\n tmp$_0 = ensureNotNull(ensureNotNull(this.myUserTooltipSpec_0).tooltipLinePatterns).iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var $receiver = element.fields;\n var destination = ArrayList_init();\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n if (Kotlin.isType(element_0, MappingValue))\n destination.add_11rb$(element_0);\n }\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(destination, 10));\n var tmp$_2;\n tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination_0.add_11rb$(item.aes);\n }\n var userDataAesList = destination_0;\n geomOutliers.removeAll_brywnq$(userDataAesList);\n }\n var $receiver_0 = this.myTooltipAxisAes_0;\n var destination_1 = ArrayList_init_1(collectionSizeOrDefault($receiver_0, 10));\n var tmp$_3;\n tmp$_3 = $receiver_0.iterator();\n while (tmp$_3.hasNext()) {\n var item_0 = tmp$_3.next();\n destination_1.add_11rb$(new MappingValue(item_0, true, true));\n }\n var axisValueSources = destination_1;\n var destination_2 = ArrayList_init_1(collectionSizeOrDefault(geomOutliers, 10));\n var tmp$_4;\n tmp$_4 = geomOutliers.iterator();\n while (tmp$_4.hasNext()) {\n var item_1 = tmp$_4.next();\n var tmp$_5 = destination_2.add_11rb$;\n var tmp$_6;\n var $receiver_1 = ensureNotNull(this.myUserTooltipSpec_0).valueSources;\n var destination_3 = ArrayList_init();\n var tmp$_7;\n tmp$_7 = $receiver_1.iterator();\n while (tmp$_7.hasNext()) {\n var element_1 = tmp$_7.next();\n if (Kotlin.isType(element_1, MappingValue))\n destination_3.add_11rb$(element_1);\n }\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_8;\n tmp$_8 = destination_3.iterator();\n while (tmp$_8.hasNext()) {\n var element_2 = tmp$_8.next();\n if (equals(element_2.aes, item_1)) {\n firstOrNull$result = element_2;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n var formatted = firstOrNull$result;\n tmp$_5.call(destination_2, (tmp$_6 = formatted != null ? formatted.toOutlier() : null) != null ? tmp$_6 : new MappingValue(item_1, true));\n }\n var geomOutlierValueSources = destination_2;\n var tmp$_9 = ensureNotNull(ensureNotNull(this.myUserTooltipSpec_0).tooltipLinePatterns);\n var $receiver_2 = plus(axisValueSources, geomOutlierValueSources);\n var transform = getCallableRef('defaultLineForValueSource', function ($receiver, p1) {\n return $receiver.defaultLineForValueSource_u47np3$(p1);\n }.bind(null, TooltipLine$Companion_getInstance()));\n var destination_4 = ArrayList_init_1(collectionSizeOrDefault($receiver_2, 10));\n var tmp$_10;\n tmp$_10 = $receiver_2.iterator();\n while (tmp$_10.hasNext()) {\n var item_2 = tmp$_10.next();\n destination_4.add_11rb$(transform(item_2));\n }\n tmp$ = plus(tmp$_9, destination_4);\n }\n return tmp$;\n };\n GeomInteractionBuilder.prototype.build = function () {\n return new GeomInteraction(this);\n };\n GeomInteractionBuilder.prototype.ignoreInvisibleTargets_6taknv$ = function (isTrue) {\n this.myIgnoreInvisibleTargets_0 = isTrue;\n return this;\n };\n GeomInteractionBuilder.prototype.isIgnoringInvisibleTargets = function () {\n return this.myIgnoreInvisibleTargets_0;\n };\n function GeomInteractionBuilder$Companion() {\n GeomInteractionBuilder$Companion_instance = this;\n this.AREA_GEOM = true;\n this.NON_AREA_GEOM = false;\n this.AES_X_0 = listOf(Aes.Companion.X);\n this.AES_XY_0 = listOf_0([Aes.Companion.X, Aes.Companion.Y]);\n }\n GeomInteractionBuilder$Companion.prototype.defaultValueSourceTooltipLines_dnbe1t$ = function (aesListForTooltip, axisAes, outliers, userDefinedValueSources, constantsMap) {\n if (userDefinedValueSources === void 0)\n userDefinedValueSources = null;\n if (constantsMap === void 0)\n constantsMap = null;\n var tmp$;\n var destination = ArrayList_init_1(collectionSizeOrDefault(axisAes, 10));\n var tmp$_0;\n tmp$_0 = axisAes.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(new MappingValue(item, true, true));\n }\n var axisValueSources = destination;\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(outliers, 10));\n var tmp$_1;\n tmp$_1 = outliers.iterator();\n while (tmp$_1.hasNext()) {\n var item_0 = tmp$_1.next();\n var tmp$_2 = destination_0.add_11rb$;\n var tmp$_3, tmp$_4;\n var tmp$_5;\n if (userDefinedValueSources != null) {\n var destination_1 = ArrayList_init();\n var tmp$_6;\n tmp$_6 = userDefinedValueSources.iterator();\n while (tmp$_6.hasNext()) {\n var element = tmp$_6.next();\n if (Kotlin.isType(element, MappingValue))\n destination_1.add_11rb$(element);\n }\n tmp$_5 = destination_1;\n } else\n tmp$_5 = null;\n var tmp$_7;\n if ((tmp$_3 = tmp$_5) != null) {\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_8;\n tmp$_8 = tmp$_3.iterator();\n while (tmp$_8.hasNext()) {\n var element_0 = tmp$_8.next();\n if (equals(element_0.aes, item_0)) {\n firstOrNull$result = element_0;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n tmp$_7 = firstOrNull$result;\n } else\n tmp$_7 = null;\n var userDefined = tmp$_7;\n tmp$_2.call(destination_0, (tmp$_4 = userDefined != null ? userDefined.toOutlier() : null) != null ? tmp$_4 : new MappingValue(item_0, true));\n }\n var outlierValueSources = destination_0;\n var destination_2 = ArrayList_init_1(collectionSizeOrDefault(aesListForTooltip, 10));\n var tmp$_9;\n tmp$_9 = aesListForTooltip.iterator();\n while (tmp$_9.hasNext()) {\n var item_1 = tmp$_9.next();\n var tmp$_10 = destination_2.add_11rb$;\n var tmp$_11;\n var tmp$_12;\n if (userDefinedValueSources != null) {\n var destination_3 = ArrayList_init();\n var tmp$_13;\n tmp$_13 = userDefinedValueSources.iterator();\n while (tmp$_13.hasNext()) {\n var element_1 = tmp$_13.next();\n if (Kotlin.isType(element_1, MappingValue))\n destination_3.add_11rb$(element_1);\n }\n tmp$_12 = destination_3;\n } else\n tmp$_12 = null;\n var tmp$_14;\n if ((tmp$_11 = tmp$_12) != null) {\n var firstOrNull$result_0;\n firstOrNull$break: do {\n var tmp$_15;\n tmp$_15 = tmp$_11.iterator();\n while (tmp$_15.hasNext()) {\n var element_2 = tmp$_15.next();\n if (equals(element_2.aes, item_1)) {\n firstOrNull$result_0 = element_2;\n break firstOrNull$break;\n }}\n firstOrNull$result_0 = null;\n }\n while (false);\n tmp$_14 = firstOrNull$result_0;\n } else\n tmp$_14 = null;\n var userDefined_0 = tmp$_14;\n tmp$_10.call(destination_2, userDefined_0 != null ? userDefined_0 : new MappingValue(item_1));\n }\n var aesValueSources = destination_2;\n var tmp$_16;\n if (constantsMap != null) {\n var destination_4 = ArrayList_init_1(constantsMap.size);\n var tmp$_17;\n tmp$_17 = constantsMap.entries.iterator();\n while (tmp$_17.hasNext()) {\n var item_2 = tmp$_17.next();\n var tmp$_18 = destination_4.add_11rb$;\n var value = item_2.value;\n tmp$_18.call(destination_4, new ConstantValue(value, null));\n }\n tmp$_16 = destination_4;\n } else\n tmp$_16 = null;\n var constantValues = (tmp$ = tmp$_16) != null ? tmp$ : emptyList();\n var $receiver = plus(plus(plus(aesValueSources, axisValueSources), outlierValueSources), constantValues);\n var transform = getCallableRef('defaultLineForValueSource', function ($receiver, p1) {\n return $receiver.defaultLineForValueSource_u47np3$(p1);\n }.bind(null, TooltipLine$Companion_getInstance()));\n var destination_5 = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_19;\n tmp$_19 = $receiver.iterator();\n while (tmp$_19.hasNext()) {\n var item_3 = tmp$_19.next();\n destination_5.add_11rb$(transform(item_3));\n }\n return destination_5;\n };\n GeomInteractionBuilder$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomInteractionBuilder$Companion_instance = null;\n function GeomInteractionBuilder$Companion_getInstance() {\n if (GeomInteractionBuilder$Companion_instance === null) {\n new GeomInteractionBuilder$Companion();\n }return GeomInteractionBuilder$Companion_instance;\n }\n GeomInteractionBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomInteractionBuilder',\n interfaces: []\n };\n function MathUtil() {\n MathUtil_instance = this;\n }\n MathUtil.prototype.polygonContainsCoordinate_sz9prc$ = function (points, coord) {\n var tmp$;\n var intersectionCount = 0;\n tmp$ = points.size;\n for (var i = 1; i < tmp$; i++) {\n var start = points.get_za3lpa$(i - 1 | 0);\n var end = points.get_za3lpa$(i);\n if (start.y >= coord.y && end.y >= coord.y || (start.y < coord.y && end.y < coord.y)) {\n continue;\n }var x = start.x + (coord.y - start.y) * (end.x - start.x) / (end.y - start.y);\n if (x <= coord.x) {\n intersectionCount = intersectionCount + 1 | 0;\n }}\n return intersectionCount % 2 !== 0;\n };\n MathUtil.prototype.liesOnSegment_e9v9yt$ = function (p1, p2, c, epsilon) {\n return (new DoubleSegment(p1, p2)).distance_gpjtzr$(c) < epsilon;\n };\n MathUtil.prototype.areEqual_f1g2it$ = function (p1, p2, epsilon) {\n return p1.subtract_gpjtzr$(p2).length() < epsilon;\n };\n MathUtil.prototype.areEqual_hln2n9$ = function (a, b, epsilon) {\n var x = a - b;\n return JsMath.abs(x) < epsilon;\n };\n MathUtil.prototype.distance_l9poh5$ = function (p1, p2) {\n return (new DoubleSegment(p1, p2)).length();\n };\n MathUtil.prototype.subtractX_l3ea4i$ = function (v, x) {\n return new DoubleVector(v.x - x, v.y);\n };\n MathUtil.prototype.addX_l3ea4i$ = function (v, x) {\n return new DoubleVector(v.x + x, v.y);\n };\n MathUtil.prototype.leftEdgeOf_wthzt5$ = function (rect) {\n return new DoubleSegment(new DoubleVector(rect.left, rect.top), new DoubleVector(rect.left, rect.bottom));\n };\n MathUtil.prototype.topEdgeOf_wthzt5$ = function (rect) {\n return new DoubleSegment(new DoubleVector(rect.left, rect.top), new DoubleVector(rect.right, rect.top));\n };\n MathUtil.prototype.rightEdgeOf_wthzt5$ = function (rect) {\n return new DoubleSegment(new DoubleVector(rect.right, rect.top), new DoubleVector(rect.right, rect.bottom));\n };\n MathUtil.prototype.bottomEdgeOf_wthzt5$ = function (rect) {\n return new DoubleSegment(new DoubleVector(rect.left, rect.bottom), new DoubleVector(rect.right, rect.bottom));\n };\n function MathUtil$ClosestPointChecker(target) {\n this.target = target;\n this.distance_pberzz$_0 = -1.0;\n this.coord_ovwx85$_0 = null;\n }\n Object.defineProperty(MathUtil$ClosestPointChecker.prototype, 'distance', {\n configurable: true,\n get: function () {\n return this.distance_pberzz$_0;\n },\n set: function (distance) {\n this.distance_pberzz$_0 = distance;\n }\n });\n Object.defineProperty(MathUtil$ClosestPointChecker.prototype, 'coord', {\n configurable: true,\n get: function () {\n return this.coord_ovwx85$_0;\n },\n set: function (coord) {\n this.coord_ovwx85$_0 = coord;\n }\n });\n MathUtil$ClosestPointChecker.prototype.check_gpjtzr$ = function (coord) {\n var cmpResult = this.compare_gpjtzr$(coord);\n return cmpResult === MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance() || cmpResult === MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance();\n };\n MathUtil$ClosestPointChecker.prototype.compare_gpjtzr$ = function (coord) {\n var newDistance = MathUtil_getInstance().distance_l9poh5$(this.target, coord);\n if (this.distance < 0) {\n this.setNewClosestCoord_0(coord, newDistance);\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance();\n }if (this.distance < newDistance) {\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance();\n }if (this.distance === newDistance) {\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance();\n }this.setNewClosestCoord_0(coord, newDistance);\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance();\n };\n MathUtil$ClosestPointChecker.prototype.setNewClosestCoord_0 = function (coord, distance) {\n this.distance = distance;\n this.coord = coord;\n };\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT_initFields() {\n MathUtil$ClosestPointChecker$COMPARISON_RESULT_initFields = function () {\n };\n MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_instance = new MathUtil$ClosestPointChecker$COMPARISON_RESULT('NEW_CLOSER', 0);\n MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_instance = new MathUtil$ClosestPointChecker$COMPARISON_RESULT('NEW_FARTHER', 1);\n MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_instance = new MathUtil$ClosestPointChecker$COMPARISON_RESULT('EQUAL', 2);\n }\n var MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_instance;\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance() {\n MathUtil$ClosestPointChecker$COMPARISON_RESULT_initFields();\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_instance;\n }\n var MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_instance;\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance() {\n MathUtil$ClosestPointChecker$COMPARISON_RESULT_initFields();\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_instance;\n }\n var MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_instance;\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance() {\n MathUtil$ClosestPointChecker$COMPARISON_RESULT_initFields();\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_instance;\n }\n MathUtil$ClosestPointChecker$COMPARISON_RESULT.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'COMPARISON_RESULT',\n interfaces: [Enum]\n };\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT$values() {\n return [MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance(), MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance(), MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance()];\n }\n MathUtil$ClosestPointChecker$COMPARISON_RESULT.values = MathUtil$ClosestPointChecker$COMPARISON_RESULT$values;\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT$valueOf(name) {\n switch (name) {\n case 'NEW_CLOSER':\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance();\n case 'NEW_FARTHER':\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance();\n case 'EQUAL':\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.interact.MathUtil.ClosestPointChecker.COMPARISON_RESULT.' + name);\n }\n }\n MathUtil$ClosestPointChecker$COMPARISON_RESULT.valueOf_61zpoe$ = MathUtil$ClosestPointChecker$COMPARISON_RESULT$valueOf;\n MathUtil$ClosestPointChecker.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ClosestPointChecker',\n interfaces: []\n };\n function MathUtil$MathUtil$ClosestPointChecker_init(x, y, $this) {\n $this = $this || Object.create(MathUtil$ClosestPointChecker.prototype);\n MathUtil$ClosestPointChecker.call($this, new DoubleVector(x, y));\n return $this;\n }\n function MathUtil$DoubleRange(myStart, myLength) {\n MathUtil$DoubleRange$Companion_getInstance();\n this.myStart_0 = myStart;\n this.myLength_0 = myLength;\n if (this.myLength_0 < 0) {\n throw IllegalStateException_init('Length should be positive');\n }}\n MathUtil$DoubleRange.prototype.length = function () {\n return this.myLength_0;\n };\n MathUtil$DoubleRange.prototype.overlaps_oqgc3u$ = function (v) {\n return this.start() <= v.end() && v.start() <= this.end();\n };\n MathUtil$DoubleRange.prototype.inside_oqgc3u$ = function (v) {\n return this.start() >= v.start() && this.end() <= v.end();\n };\n MathUtil$DoubleRange.prototype.contains_14dthe$ = function (value) {\n return value >= this.start() && value <= this.end();\n };\n MathUtil$DoubleRange.prototype.start = function () {\n return this.myStart_0;\n };\n MathUtil$DoubleRange.prototype.end = function () {\n return this.myStart_0 + this.length();\n };\n MathUtil$DoubleRange.prototype.move_14dthe$ = function (delta) {\n return MathUtil$DoubleRange$Companion_getInstance().withStartAndLength_lu1900$(this.start() + delta, this.length());\n };\n MathUtil$DoubleRange.prototype.moveLeft_14dthe$ = function (delta) {\n if (delta < 0) {\n throw IllegalStateException_init('Value should be positive');\n }return MathUtil$DoubleRange$Companion_getInstance().withStartAndLength_lu1900$(this.start() - delta, this.length());\n };\n MathUtil$DoubleRange.prototype.moveRight_14dthe$ = function (delta) {\n if (delta < 0) {\n throw IllegalStateException_init('Value should be positive');\n }return MathUtil$DoubleRange$Companion_getInstance().withStartAndLength_lu1900$(this.start() + delta, this.length());\n };\n function MathUtil$DoubleRange$Companion() {\n MathUtil$DoubleRange$Companion_instance = this;\n }\n MathUtil$DoubleRange$Companion.prototype.withStartAndEnd_lu1900$ = function (start, end) {\n var rangeStart = JsMath.min(start, end);\n var rangeLength = JsMath.max(start, end) - rangeStart;\n return new MathUtil$DoubleRange(rangeStart, rangeLength);\n };\n MathUtil$DoubleRange$Companion.prototype.withStartAndLength_lu1900$ = function (start, length) {\n return new MathUtil$DoubleRange(start, length);\n };\n MathUtil$DoubleRange$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var MathUtil$DoubleRange$Companion_instance = null;\n function MathUtil$DoubleRange$Companion_getInstance() {\n if (MathUtil$DoubleRange$Companion_instance === null) {\n new MathUtil$DoubleRange$Companion();\n }return MathUtil$DoubleRange$Companion_instance;\n }\n MathUtil$DoubleRange.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleRange',\n interfaces: []\n };\n MathUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'MathUtil',\n interfaces: []\n };\n var MathUtil_instance = null;\n function MathUtil_getInstance() {\n if (MathUtil_instance === null) {\n new MathUtil();\n }return MathUtil_instance;\n }\n function TooltipSpec(layoutHint, lines, fill, isOutlier, anchor, minWidth, isCrosshairEnabled) {\n if (anchor === void 0)\n anchor = null;\n if (minWidth === void 0)\n minWidth = null;\n if (isCrosshairEnabled === void 0)\n isCrosshairEnabled = false;\n this.layoutHint = layoutHint;\n this.fill = fill;\n this.isOutlier = isOutlier;\n this.anchor = anchor;\n this.minWidth = minWidth;\n this.isCrosshairEnabled = isCrosshairEnabled;\n this.lines = ArrayList_init_0(lines);\n }\n TooltipSpec.prototype.toString = function () {\n var tmp$ = 'TooltipSpec(' + this.layoutHint + ', lines=';\n var $receiver = this.lines;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(item.toString());\n }\n return tmp$ + destination + ')';\n };\n function TooltipSpec$Line(label, value) {\n TooltipSpec$Line$Companion_getInstance();\n this.label = label;\n this.value = value;\n }\n TooltipSpec$Line.prototype.toString = function () {\n var $receiver = this.label;\n return $receiver == null || $receiver.length === 0 ? this.value : toString(this.label) + ': ' + this.value;\n };\n function TooltipSpec$Line$Companion() {\n TooltipSpec$Line$Companion_instance = this;\n }\n TooltipSpec$Line$Companion.prototype.withValue_61zpoe$ = function (value) {\n return new TooltipSpec$Line(null, value);\n };\n TooltipSpec$Line$Companion.prototype.withLabelAndValue_f5e6j7$ = function (label, value) {\n return new TooltipSpec$Line(label, value);\n };\n TooltipSpec$Line$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TooltipSpec$Line$Companion_instance = null;\n function TooltipSpec$Line$Companion_getInstance() {\n if (TooltipSpec$Line$Companion_instance === null) {\n new TooltipSpec$Line$Companion();\n }return TooltipSpec$Line$Companion_instance;\n }\n TooltipSpec$Line.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Line',\n interfaces: []\n };\n TooltipSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipSpec',\n interfaces: []\n };\n function TooltipSpecFactory(contextualMapping, axisOrigin) {\n this.contextualMapping_0 = contextualMapping;\n this.axisOrigin_0 = axisOrigin;\n }\n TooltipSpecFactory.prototype.create_62opr5$ = function (geomTarget) {\n return ArrayList_init_0((new TooltipSpecFactory$Helper(this, geomTarget)).createTooltipSpecs_8be2vx$());\n };\n function TooltipSpecFactory$Helper($outer, myGeomTarget) {\n this.$outer = $outer;\n this.myGeomTarget_0 = myGeomTarget;\n this.myDataPoints_0 = this.$outer.contextualMapping_0.getDataPoints_za3lpa$(this.hitIndex_0());\n this.myTooltipAnchor_0 = this.$outer.contextualMapping_0.tooltipAnchor;\n this.myTooltipMinWidth_0 = this.$outer.contextualMapping_0.tooltipMinWidth;\n this.myTooltipColor_0 = this.$outer.contextualMapping_0.tooltipColor;\n this.myIsCrosshairEnabled_0 = this.$outer.contextualMapping_0.isCrosshairEnabled;\n }\n TooltipSpecFactory$Helper.prototype.createTooltipSpecs_8be2vx$ = function () {\n var tooltipSpecs = ArrayList_init();\n addAll(tooltipSpecs, this.outlierTooltipSpec_0());\n addAll(tooltipSpecs, this.generalTooltipSpec_0());\n addAll(tooltipSpecs, this.axisTooltipSpec_0());\n return tooltipSpecs;\n };\n TooltipSpecFactory$Helper.prototype.hitIndex_0 = function () {\n return this.myGeomTarget_0.hitIndex;\n };\n TooltipSpecFactory$Helper.prototype.tipLayoutHint_0 = function () {\n return this.myGeomTarget_0.tipLayoutHint;\n };\n TooltipSpecFactory$Helper.prototype.outlierHints_0 = function () {\n return this.myGeomTarget_0.aesTipLayoutHints;\n };\n TooltipSpecFactory$Helper.prototype.hintColors_0 = function () {\n var $receiver = this.myGeomTarget_0.aesTipLayoutHints;\n var destination = ArrayList_init_1($receiver.size);\n var tmp$;\n tmp$ = $receiver.entries.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(to(item.key, item.value.color));\n }\n return toMap(destination);\n };\n TooltipSpecFactory$Helper.prototype.outlierTooltipSpec_0 = function () {\n var tooltipSpecs = ArrayList_init();\n var outlierDataPoints = this.outlierDataPoints_0();\n var tmp$;\n tmp$ = this.outlierHints_0().entries.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var aes = element.key;\n var hint = element.value;\n var tmp$_0;\n var destination = ArrayList_init();\n var tmp$_1;\n tmp$_1 = outlierDataPoints.iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n if (equals(aes, element_0.aes))\n destination.add_11rb$(element_0);\n }\n var transform = getPropertyCallableRef('value', 1, function ($receiver) {\n return $receiver.value;\n });\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(destination, 10));\n var tmp$_2;\n tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination_0.add_11rb$(transform(item));\n }\n var transform_0 = getCallableRef('withValue', function ($receiver, p1) {\n return $receiver.withValue_61zpoe$(p1);\n }.bind(null, TooltipSpec$Line$Companion_getInstance()));\n var destination_1 = ArrayList_init_1(collectionSizeOrDefault(destination_0, 10));\n var tmp$_3;\n tmp$_3 = destination_0.iterator();\n while (tmp$_3.hasNext()) {\n var item_0 = tmp$_3.next();\n destination_1.add_11rb$(transform_0(item_0));\n }\n var linesForAes = destination_1;\n if (!linesForAes.isEmpty()) {\n tooltipSpecs.add_11rb$(new TooltipSpec(hint, linesForAes, (tmp$_0 = hint.color) != null ? tmp$_0 : ensureNotNull(this.tipLayoutHint_0().color), true));\n }}\n return tooltipSpecs;\n };\n TooltipSpecFactory$Helper.prototype.axisTooltipSpec_0 = function () {\n var tooltipSpecs = ArrayList_init();\n var tmp$ = Aes.Companion.X;\n var $receiver = this.axisDataPoints_0();\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (equals(Aes.Companion.X, element.aes))\n destination.add_11rb$(element);\n }\n var transform = getPropertyCallableRef('value', 1, function ($receiver) {\n return $receiver.value;\n });\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(destination, 10));\n var tmp$_1;\n tmp$_1 = destination.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n destination_0.add_11rb$(transform(item));\n }\n var transform_0 = getCallableRef('withValue', function ($receiver, p1) {\n return $receiver.withValue_61zpoe$(p1);\n }.bind(null, TooltipSpec$Line$Companion_getInstance()));\n var destination_1 = ArrayList_init_1(collectionSizeOrDefault(destination_0, 10));\n var tmp$_2;\n tmp$_2 = destination_0.iterator();\n while (tmp$_2.hasNext()) {\n var item_0 = tmp$_2.next();\n destination_1.add_11rb$(transform_0(item_0));\n }\n var tmp$_3 = to(tmp$, destination_1);\n var tmp$_4 = Aes.Companion.Y;\n var $receiver_0 = this.axisDataPoints_0();\n var destination_2 = ArrayList_init();\n var tmp$_5;\n tmp$_5 = $receiver_0.iterator();\n while (tmp$_5.hasNext()) {\n var element_0 = tmp$_5.next();\n if (equals(Aes.Companion.Y, element_0.aes))\n destination_2.add_11rb$(element_0);\n }\n var transform_1 = getPropertyCallableRef('value', 1, function ($receiver) {\n return $receiver.value;\n });\n var destination_3 = ArrayList_init_1(collectionSizeOrDefault(destination_2, 10));\n var tmp$_6;\n tmp$_6 = destination_2.iterator();\n while (tmp$_6.hasNext()) {\n var item_1 = tmp$_6.next();\n destination_3.add_11rb$(transform_1(item_1));\n }\n var transform_2 = getCallableRef('withValue', function ($receiver, p1) {\n return $receiver.withValue_61zpoe$(p1);\n }.bind(null, TooltipSpec$Line$Companion_getInstance()));\n var destination_4 = ArrayList_init_1(collectionSizeOrDefault(destination_3, 10));\n var tmp$_7;\n tmp$_7 = destination_3.iterator();\n while (tmp$_7.hasNext()) {\n var item_2 = tmp$_7.next();\n destination_4.add_11rb$(transform_2(item_2));\n }\n var axis = mapOf([tmp$_3, to(tmp$_4, destination_4)]);\n var tmp$_8;\n tmp$_8 = axis.entries.iterator();\n while (tmp$_8.hasNext()) {\n var element_1 = tmp$_8.next();\n var aes = element_1.key;\n var lines = element_1.value;\n if (!lines.isEmpty()) {\n var layoutHint = this.createHintForAxis_0(aes);\n tooltipSpecs.add_11rb$(new TooltipSpec(layoutHint, lines, ensureNotNull(layoutHint.color), true));\n }}\n return tooltipSpecs;\n };\n TooltipSpecFactory$Helper.prototype.generalTooltipSpec_0 = function () {\n var tmp$, tmp$_0, tmp$_1;\n var generalDataPoints = this.generalDataPoints_0();\n var destination = ArrayList_init_1(collectionSizeOrDefault(generalDataPoints, 10));\n var tmp$_2;\n tmp$_2 = generalDataPoints.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination.add_11rb$(TooltipSpec$Line$Companion_getInstance().withLabelAndValue_f5e6j7$(item.label, item.value));\n }\n var generalLines = destination;\n var $receiver = this.hintColors_0();\n var tmp$_3;\n var result = LinkedHashMap_init();\n tmp$_3 = $receiver.entries.iterator();\n while (tmp$_3.hasNext()) {\n var entry = tmp$_3.next();\n var aes = entry.key;\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(generalDataPoints, 10));\n var tmp$_4;\n tmp$_4 = generalDataPoints.iterator();\n while (tmp$_4.hasNext()) {\n var item_0 = tmp$_4.next();\n destination_0.add_11rb$(item_0.aes);\n }\n if (destination_0.contains_11rb$(aes)) {\n result.put_xwzc9p$(entry.key, entry.value);\n }}\n var aesHintColors = result;\n var tmp$_5;\n if ((tmp$ = aesHintColors.get_11rb$(Aes.Companion.Y)) != null)\n tmp$_5 = tmp$;\n else {\n var destination_1 = ArrayList_init();\n var tmp$_6;\n tmp$_6 = aesHintColors.entries.iterator();\n while (tmp$_6.hasNext()) {\n var element = tmp$_6.next();\n var tmp$_0_0;\n if ((tmp$_0_0 = element.value) != null) {\n destination_1.add_11rb$(tmp$_0_0);\n }}\n tmp$_5 = lastOrNull(destination_1);\n }\n var colorFromHints = tmp$_5;\n if (this.myTooltipColor_0 != null)\n tmp$_0 = this.myTooltipColor_0;\n else if (colorFromHints != null)\n tmp$_0 = colorFromHints;\n else\n tmp$_0 = ensureNotNull(this.tipLayoutHint_0().color);\n var tooltipColor = tmp$_0;\n if (!generalLines.isEmpty()) {\n tmp$_1 = listOf(new TooltipSpec(this.tipLayoutHint_0(), generalLines, tooltipColor, false, this.myTooltipAnchor_0, this.myTooltipMinWidth_0, this.myIsCrosshairEnabled_0));\n } else {\n tmp$_1 = emptyList();\n }\n return tmp$_1;\n };\n TooltipSpecFactory$Helper.prototype.outlierDataPoints_0 = function () {\n var $receiver = this.myDataPoints_0;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.isOutlier && !element.isAxis)\n destination.add_11rb$(element);\n }\n return destination;\n };\n TooltipSpecFactory$Helper.prototype.axisDataPoints_0 = function () {\n var $receiver = this.myDataPoints_0;\n var predicate = getPropertyCallableRef('isAxis', 1, function ($receiver) {\n return $receiver.isAxis;\n });\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (predicate(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n TooltipSpecFactory$Helper.prototype.generalDataPoints_0 = function () {\n var $receiver = this.myDataPoints_0;\n var predicate = getPropertyCallableRef('isOutlier', 1, function ($receiver) {\n return $receiver.isOutlier;\n });\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (!predicate(element))\n destination.add_11rb$(element);\n }\n var nonOutlierDataPoints = destination;\n var $receiver_0 = this.outlierDataPoints_0();\n var transform = getPropertyCallableRef('aes', 1, function ($receiver) {\n return $receiver.aes;\n });\n var destination_0 = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver_0.iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n var tmp$_0_0;\n if ((tmp$_0_0 = transform(element_0)) != null) {\n destination_0.add_11rb$(tmp$_0_0);\n }}\n var outliers = destination_0;\n var transform_0 = getPropertyCallableRef('aes', 1, function ($receiver) {\n return $receiver.aes;\n });\n var destination_1 = ArrayList_init();\n var tmp$_1;\n tmp$_1 = nonOutlierDataPoints.iterator();\n while (tmp$_1.hasNext()) {\n var element_1 = tmp$_1.next();\n var tmp$_0_1;\n if ((tmp$_0_1 = transform_0(element_1)) != null) {\n destination_1.add_11rb$(tmp$_0_1);\n }}\n var generalAesList = minus(destination_1, outliers);\n var destination_2 = ArrayList_init();\n var tmp$_2;\n tmp$_2 = nonOutlierDataPoints.iterator();\n while (tmp$_2.hasNext()) {\n var element_2 = tmp$_2.next();\n var predicate$result;\n var tmp$_3;\n tmp$_3 = element_2.aes;\n if (tmp$_3 == null) {\n predicate$result = true;\n } else if (contains(generalAesList, tmp$_3)) {\n predicate$result = true;\n } else {\n predicate$result = false;\n }\n if (predicate$result)\n destination_2.add_11rb$(element_2);\n }\n return destination_2;\n };\n TooltipSpecFactory$Helper.prototype.createHintForAxis_0 = function (aes) {\n var tmp$;\n if (equals(aes, Aes.Companion.X))\n tmp$ = TipLayoutHint.Companion.xAxisTooltip_cgf2ia$(new DoubleVector(ensureNotNull(this.tipLayoutHint_0().coord).x, this.$outer.axisOrigin_0.y), Defaults$Common$Tooltip_getInstance().AXIS_TOOLTIP_COLOR, Defaults$Common$Tooltip_getInstance().AXIS_RADIUS);\n else if (equals(aes, Aes.Companion.Y))\n tmp$ = TipLayoutHint.Companion.yAxisTooltip_cgf2ia$(new DoubleVector(this.$outer.axisOrigin_0.x, ensureNotNull(this.tipLayoutHint_0().coord).y), Defaults$Common$Tooltip_getInstance().AXIS_TOOLTIP_COLOR, Defaults$Common$Tooltip_getInstance().AXIS_RADIUS);\n else {\n throw IllegalStateException_init(('Not an axis aes: ' + aes).toString());\n }\n return tmp$;\n };\n TooltipSpecFactory$Helper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Helper',\n interfaces: []\n };\n TooltipSpecFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipSpecFactory',\n interfaces: []\n };\n function LayerTargetCollectorWithLocator(geomKind, lookupSpec, contextualMapping, coordinateSystem) {\n this.geomKind_0 = geomKind;\n this.lookupSpec_0 = lookupSpec;\n this.contextualMapping_0 = contextualMapping;\n this.coordinateSystem_0 = coordinateSystem;\n this.myTargets_0 = ArrayList_init();\n this.myLocator_0 = null;\n }\n function LayerTargetCollectorWithLocator$addPoint$lambda(closure$index) {\n return function (it) {\n return closure$index;\n };\n }\n LayerTargetCollectorWithLocator.prototype.addPoint_cnsimy$$default = function (index, point, radius, tooltipParams, tooltipKind) {\n if (this.contextualMapping_0.ignoreInvisibleTargets) {\n if (radius === 0.0 || tooltipParams.getColor().alpha === 0) {\n return;\n }}if (!this.coordinateSystem_0.isPointInLimits_k2qmv6$(point)) {\n return;\n }this.addTarget_0(new TargetPrototype(HitShape.Companion.point_e1sv3v$(point, radius), LayerTargetCollectorWithLocator$addPoint$lambda(index), tooltipParams, tooltipKind));\n };\n function LayerTargetCollectorWithLocator$addRectangle$lambda(closure$index) {\n return function (it) {\n return closure$index;\n };\n }\n LayerTargetCollectorWithLocator.prototype.addRectangle_bxzvr8$$default = function (index, rectangle, tooltipParams, tooltipKind) {\n if (this.contextualMapping_0.ignoreInvisibleTargets) {\n if (rectangle.width === 0.0 || rectangle.height === 0.0 || tooltipParams.getColor().alpha === 0) {\n return;\n }}if (!this.coordinateSystem_0.isRectInLimits_fd842m$(rectangle)) {\n return;\n }this.addTarget_0(new TargetPrototype(HitShape.Companion.rect_wthzt5$(rectangle), LayerTargetCollectorWithLocator$addRectangle$lambda(index), tooltipParams, tooltipKind));\n };\n LayerTargetCollectorWithLocator.prototype.addPath_sa5m83$$default = function (points, localToGlobalIndex, tooltipParams, tooltipKind) {\n if (!this.coordinateSystem_0.isPathInLimits_f6t8kh$(points)) {\n return;\n }this.addTarget_0(new TargetPrototype(HitShape.Companion.path_ytws2g$(points), localToGlobalIndex, tooltipParams, tooltipKind));\n };\n LayerTargetCollectorWithLocator.prototype.addPolygon_sa5m83$$default = function (points, localToGlobalIndex, tooltipParams, tooltipKind) {\n if (!this.coordinateSystem_0.isPolygonInLimits_f6t8kh$(points)) {\n return;\n }this.addTarget_0(new TargetPrototype(HitShape.Companion.polygon_ytws2g$(points), localToGlobalIndex, tooltipParams, tooltipKind));\n };\n LayerTargetCollectorWithLocator.prototype.addTarget_0 = function (targetPrototype) {\n this.myTargets_0.add_11rb$(targetPrototype);\n this.myLocator_0 = null;\n };\n LayerTargetCollectorWithLocator.prototype.search_gpjtzr$ = function (coord) {\n if (this.myLocator_0 == null) {\n this.myLocator_0 = new LayerTargetLocator(this.geomKind_0, this.lookupSpec_0, this.contextualMapping_0, this.myTargets_0);\n }return ensureNotNull(this.myLocator_0).search_gpjtzr$(coord);\n };\n LayerTargetCollectorWithLocator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LayerTargetCollectorWithLocator',\n interfaces: [GeomTargetLocator, GeomTargetCollector]\n };\n function LayerTargetLocator(geomKind, lookupSpec, contextualMapping, targetPrototypes) {\n this.geomKind_0 = geomKind;\n this.lookupSpec_0 = lookupSpec;\n this.contextualMapping_0 = contextualMapping;\n this.myTargets_0 = ArrayList_init();\n this.myTargetDetector_0 = new TargetDetector(this.lookupSpec_0.lookupSpace, this.lookupSpec_0.lookupStrategy);\n this.mySimpleGeometry_0 = setOf([GeomKind.RECT, GeomKind.POLYGON]);\n var tmp$, tmp$_0;\n if (this.mySimpleGeometry_0.contains_11rb$(this.geomKind_0))\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance();\n else if (this.lookupSpec_0.lookupSpace === GeomTargetLocator$LookupSpace.X && this.lookupSpec_0.lookupStrategy === GeomTargetLocator$LookupStrategy.NEAREST)\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_getInstance();\n else if (this.lookupSpec_0.lookupSpace === GeomTargetLocator$LookupSpace.X)\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance();\n else if (this.lookupSpec_0.lookupStrategy === GeomTargetLocator$LookupStrategy.HOVER)\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance();\n else if (this.lookupSpec_0.lookupStrategy === GeomTargetLocator$LookupStrategy.NONE || this.lookupSpec_0.lookupSpace === GeomTargetLocator$LookupSpace.NONE)\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$IGNORE_getInstance();\n else {\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance();\n }\n this.myCollectingStrategy_0 = tmp$;\n var toProjection = LayerTargetLocator_init$toProjection(this);\n tmp$_0 = targetPrototypes.iterator();\n while (tmp$_0.hasNext()) {\n var prototype = tmp$_0.next();\n this.myTargets_0.add_11rb$(new LayerTargetLocator$Target(toProjection(prototype), prototype));\n }\n }\n LayerTargetLocator.prototype.addLookupResults_0 = function (collector, targets) {\n if (collector.size() === 0) {\n return;\n }var tmp$ = collector.collection();\n var b = collector.closestPointChecker.distance;\n targets.add_11rb$(new GeomTargetLocator$LookupResult(tmp$, JsMath.max(0.0, b), this.geomKind_0, this.contextualMapping_0, this.contextualMapping_0.isCrosshairEnabled));\n };\n LayerTargetLocator.prototype.search_gpjtzr$ = function (coord) {\n var tmp$;\n if (this.myTargets_0.isEmpty()) {\n return null;\n }var rectCollector = new LayerTargetLocator$Collector(coord, this.myCollectingStrategy_0, this.lookupSpec_0.lookupSpace);\n var pointCollector = new LayerTargetLocator$Collector(coord, this.myCollectingStrategy_0, this.lookupSpec_0.lookupSpace);\n var pathCollector = new LayerTargetLocator$Collector(coord, this.myCollectingStrategy_0, this.lookupSpec_0.lookupSpace);\n var polygonCollector = new LayerTargetLocator$Collector(coord, LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance(), this.lookupSpec_0.lookupSpace);\n tmp$ = this.myTargets_0.iterator();\n while (tmp$.hasNext()) {\n var target = tmp$.next();\n switch (target.prototype.hitShape_8be2vx$.kind.name) {\n case 'RECT':\n this.processRect_0(coord, target, rectCollector);\n break;\n case 'POINT':\n this.processPoint_0(coord, target, pointCollector);\n break;\n case 'PATH':\n this.processPath_0(coord, target, pathCollector);\n break;\n case 'POLYGON':\n this.processPolygon_0(coord, target, polygonCollector);\n break;\n }\n }\n var lookupResults = ArrayList_init();\n this.addLookupResults_0(pathCollector, lookupResults);\n this.addLookupResults_0(rectCollector, lookupResults);\n this.addLookupResults_0(pointCollector, lookupResults);\n this.addLookupResults_0(polygonCollector, lookupResults);\n return this.getClosestTarget_0(lookupResults);\n };\n LayerTargetLocator.prototype.getClosestTarget_0 = function (lookupResults) {\n var tmp$;\n if (lookupResults.isEmpty()) {\n return null;\n }var closestTargets = lookupResults.get_za3lpa$(0);\n if (!(closestTargets.distance >= 0)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }tmp$ = lookupResults.iterator();\n while (tmp$.hasNext()) {\n var lookupResult = tmp$.next();\n if (lookupResult.distance < closestTargets.distance) {\n closestTargets = lookupResult;\n }}\n return closestTargets;\n };\n LayerTargetLocator.prototype.processRect_0 = function (coord, target, resultCollector) {\n var tmp$;\n if (this.myTargetDetector_0.checkRect_fqo6rd$(coord, target.rectProjection, resultCollector.closestPointChecker)) {\n var rect = target.prototype.hitShape_8be2vx$.rect;\n if (equals(target.prototype.tooltipKind_8be2vx$, TipLayoutHint$Kind.CURSOR_TOOLTIP))\n tmp$ = rect.height / 2.0;\n else\n tmp$ = 0.0;\n var yOffset = tmp$;\n resultCollector.collect_11rb$(target.prototype.createGeomTarget_x7nr8i$(rect.origin.add_gpjtzr$(new DoubleVector(rect.width / 2, yOffset)), this.getKeyForSingleObjectGeometry_0(target.prototype)));\n }};\n LayerTargetLocator.prototype.processPolygon_0 = function (coord, target, resultCollector) {\n if (this.myTargetDetector_0.checkPolygon_q60eo3$(coord, target.polygonProjection, resultCollector.closestPointChecker)) {\n resultCollector.collect_11rb$(target.prototype.createGeomTarget_x7nr8i$(coord, this.getKeyForSingleObjectGeometry_0(target.prototype)));\n }};\n LayerTargetLocator.prototype.processPoint_0 = function (coord, target, resultCollector) {\n if (this.myTargetDetector_0.checkPoint_w0b42b$(coord, target.pointProjection, resultCollector.closestPointChecker)) {\n resultCollector.collect_11rb$(target.prototype.createGeomTarget_x7nr8i$(target.prototype.hitShape_8be2vx$.point.center, this.getKeyForSingleObjectGeometry_0(target.prototype)));\n }};\n LayerTargetLocator.prototype.processPath_0 = function (coord, target, resultCollector) {\n var pointChecker = this.myCollectingStrategy_0 === LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance() ? new MathUtil$ClosestPointChecker(coord) : resultCollector.closestPointChecker;\n var hitPoint = this.myTargetDetector_0.checkPath_z3141m$(coord, target.pathProjection, pointChecker);\n if (hitPoint != null) {\n resultCollector.collect_11rb$(target.prototype.createGeomTarget_x7nr8i$(hitPoint.originalCoord, hitPoint.index));\n }};\n LayerTargetLocator.prototype.getKeyForSingleObjectGeometry_0 = function (prototype) {\n return prototype.indexMapper_8be2vx$(0);\n };\n function LayerTargetLocator$Target(targetProjection, prototype) {\n this.targetProjection_0 = targetProjection;\n this.prototype = prototype;\n }\n Object.defineProperty(LayerTargetLocator$Target.prototype, 'pointProjection', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.targetProjection_0, PointTargetProjection) ? tmp$ : throwCCE();\n }\n });\n Object.defineProperty(LayerTargetLocator$Target.prototype, 'rectProjection', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.targetProjection_0, RectTargetProjection) ? tmp$ : throwCCE();\n }\n });\n Object.defineProperty(LayerTargetLocator$Target.prototype, 'polygonProjection', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.targetProjection_0, PolygonTargetProjection) ? tmp$ : throwCCE();\n }\n });\n Object.defineProperty(LayerTargetLocator$Target.prototype, 'pathProjection', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.targetProjection_0, PathTargetProjection) ? tmp$ : throwCCE();\n }\n });\n LayerTargetLocator$Target.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Target',\n interfaces: []\n };\n function LayerTargetLocator$Collector(cursor, myStrategy, lookupSpace) {\n this.myStrategy_0 = myStrategy;\n this.result_0 = ArrayList_init();\n var tmp$;\n if (lookupSpace === GeomTargetLocator$LookupSpace.X) {\n tmp$ = new MathUtil$ClosestPointChecker(new DoubleVector(cursor.x, 0.0));\n } else {\n tmp$ = new MathUtil$ClosestPointChecker(cursor);\n }\n this.closestPointChecker = tmp$;\n this.myLastAddedDistance_0 = -1.0;\n }\n LayerTargetLocator$Collector.prototype.collect_11rb$ = function (data) {\n switch (this.myStrategy_0.name) {\n case 'APPEND':\n this.add_0(data);\n break;\n case 'REPLACE':\n this.replace_0(data);\n break;\n case 'APPEND_IF_EQUAL':\n if (this.myLastAddedDistance_0 === this.closestPointChecker.distance) {\n this.add_0(data);\n } else {\n this.replace_0(data);\n }\n\n break;\n case 'IGNORE':\n return;\n }\n };\n LayerTargetLocator$Collector.prototype.collection = function () {\n return this.result_0;\n };\n LayerTargetLocator$Collector.prototype.size = function () {\n return this.result_0.size;\n };\n LayerTargetLocator$Collector.prototype.add_0 = function (data) {\n this.result_0.add_11rb$(data);\n this.myLastAddedDistance_0 = this.closestPointChecker.distance;\n };\n LayerTargetLocator$Collector.prototype.replace_0 = function (locationData) {\n this.result_0.clear();\n this.result_0.add_11rb$(locationData);\n this.myLastAddedDistance_0 = this.closestPointChecker.distance;\n };\n function LayerTargetLocator$Collector$CollectingStrategy(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LayerTargetLocator$Collector$CollectingStrategy_initFields() {\n LayerTargetLocator$Collector$CollectingStrategy_initFields = function () {\n };\n LayerTargetLocator$Collector$CollectingStrategy$APPEND_instance = new LayerTargetLocator$Collector$CollectingStrategy('APPEND', 0);\n LayerTargetLocator$Collector$CollectingStrategy$REPLACE_instance = new LayerTargetLocator$Collector$CollectingStrategy('REPLACE', 1);\n LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_instance = new LayerTargetLocator$Collector$CollectingStrategy('APPEND_IF_EQUAL', 2);\n LayerTargetLocator$Collector$CollectingStrategy$IGNORE_instance = new LayerTargetLocator$Collector$CollectingStrategy('IGNORE', 3);\n }\n var LayerTargetLocator$Collector$CollectingStrategy$APPEND_instance;\n function LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance() {\n LayerTargetLocator$Collector$CollectingStrategy_initFields();\n return LayerTargetLocator$Collector$CollectingStrategy$APPEND_instance;\n }\n var LayerTargetLocator$Collector$CollectingStrategy$REPLACE_instance;\n function LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance() {\n LayerTargetLocator$Collector$CollectingStrategy_initFields();\n return LayerTargetLocator$Collector$CollectingStrategy$REPLACE_instance;\n }\n var LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_instance;\n function LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_getInstance() {\n LayerTargetLocator$Collector$CollectingStrategy_initFields();\n return LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_instance;\n }\n var LayerTargetLocator$Collector$CollectingStrategy$IGNORE_instance;\n function LayerTargetLocator$Collector$CollectingStrategy$IGNORE_getInstance() {\n LayerTargetLocator$Collector$CollectingStrategy_initFields();\n return LayerTargetLocator$Collector$CollectingStrategy$IGNORE_instance;\n }\n LayerTargetLocator$Collector$CollectingStrategy.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CollectingStrategy',\n interfaces: [Enum]\n };\n function LayerTargetLocator$Collector$CollectingStrategy$values() {\n return [LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance(), LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance(), LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_getInstance(), LayerTargetLocator$Collector$CollectingStrategy$IGNORE_getInstance()];\n }\n LayerTargetLocator$Collector$CollectingStrategy.values = LayerTargetLocator$Collector$CollectingStrategy$values;\n function LayerTargetLocator$Collector$CollectingStrategy$valueOf(name) {\n switch (name) {\n case 'APPEND':\n return LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance();\n case 'REPLACE':\n return LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance();\n case 'APPEND_IF_EQUAL':\n return LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_getInstance();\n case 'IGNORE':\n return LayerTargetLocator$Collector$CollectingStrategy$IGNORE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.interact.loc.LayerTargetLocator.Collector.CollectingStrategy.' + name);\n }\n }\n LayerTargetLocator$Collector$CollectingStrategy.valueOf_61zpoe$ = LayerTargetLocator$Collector$CollectingStrategy$valueOf;\n LayerTargetLocator$Collector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Collector',\n interfaces: []\n };\n function LayerTargetLocator_init$toProjection(this$LayerTargetLocator) {\n return function (prototype) {\n var tmp$;\n switch (prototype.hitShape_8be2vx$.kind.name) {\n case 'POINT':\n tmp$ = PointTargetProjection$Companion_getInstance().create_p1yge$(prototype.hitShape_8be2vx$.point.center, this$LayerTargetLocator.lookupSpec_0.lookupSpace);\n break;\n case 'RECT':\n tmp$ = RectTargetProjection$Companion_getInstance().create_tb1cvm$(prototype.hitShape_8be2vx$.rect, this$LayerTargetLocator.lookupSpec_0.lookupSpace);\n break;\n case 'POLYGON':\n tmp$ = PolygonTargetProjection$Companion_getInstance().create_a95qp$(prototype.hitShape_8be2vx$.points, this$LayerTargetLocator.lookupSpec_0.lookupSpace);\n break;\n case 'PATH':\n tmp$ = PathTargetProjection$Companion_getInstance().create_zb7j6l$(prototype.hitShape_8be2vx$.points, prototype.indexMapper_8be2vx$, this$LayerTargetLocator.lookupSpec_0.lookupSpace);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n }\n LayerTargetLocator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LayerTargetLocator',\n interfaces: [GeomTargetLocator]\n };\n function LocatedTargetsPicker() {\n LocatedTargetsPicker$Companion_getInstance();\n this.myPicked_0 = ArrayList_init();\n this.myMinDistance_0 = 0.0;\n this.myAllLookupResults_0 = ArrayList_init();\n }\n Object.defineProperty(LocatedTargetsPicker.prototype, 'picked', {\n configurable: true,\n get: function () {\n return this.chooseBestResult_0();\n }\n });\n LocatedTargetsPicker.prototype.addLookupResult_9sakjw$ = function (result, coord) {\n if (coord === void 0)\n coord = null;\n var lookupResult = LocatedTargetsPicker$Companion_getInstance().filterResults_0(result, coord);\n var distance = LocatedTargetsPicker$Companion_getInstance().distance_0(lookupResult, coord);\n if (!lookupResult.isCrosshairEnabled && distance > LocatedTargetsPicker$Companion_getInstance().CUTOFF_DISTANCE_8be2vx$) {\n return;\n }if (this.myPicked_0.isEmpty() || this.myMinDistance_0 > distance) {\n this.myPicked_0.clear();\n this.myPicked_0.add_11rb$(lookupResult);\n this.myMinDistance_0 = distance;\n } else if (this.myMinDistance_0 === distance && LocatedTargetsPicker$Companion_getInstance().isSameUnivariateGeom_0(this.myPicked_0.get_za3lpa$(0), lookupResult))\n this.myPicked_0.add_11rb$(lookupResult);\n else if (this.myMinDistance_0 === distance) {\n this.myPicked_0.clear();\n this.myPicked_0.add_11rb$(lookupResult);\n }this.myAllLookupResults_0.add_11rb$(lookupResult);\n };\n function LocatedTargetsPicker$chooseBestResult$hasGeneralTooltip(lookupResult) {\n return lookupResult.contextualMapping.hasGeneralTooltip;\n }\n function LocatedTargetsPicker$chooseBestResult$hasAxisTooltip(lookupResult) {\n return lookupResult.contextualMapping.hasAxisTooltip || listOf_0([GeomKind.V_LINE, GeomKind.H_LINE]).contains_11rb$(lookupResult.geomKind);\n }\n LocatedTargetsPicker.prototype.chooseBestResult_0 = function () {\n var tmp$;\n var hasGeneralTooltip = LocatedTargetsPicker$chooseBestResult$hasGeneralTooltip;\n var hasAxisTooltip = LocatedTargetsPicker$chooseBestResult$hasAxisTooltip;\n var $receiver = this.myPicked_0;\n var any$result;\n any$break: do {\n var tmp$_0;\n if (Kotlin.isType($receiver, Collection) && $receiver.isEmpty()) {\n any$result = false;\n break any$break;\n }tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (hasGeneralTooltip(element) && hasAxisTooltip(element)) {\n any$result = true;\n break any$break;\n }}\n any$result = false;\n }\n while (false);\n if (any$result)\n tmp$ = this.myPicked_0;\n else {\n var $receiver_0 = this.myAllLookupResults_0;\n var none$result;\n none$break: do {\n var tmp$_1;\n if (Kotlin.isType($receiver_0, Collection) && $receiver_0.isEmpty()) {\n none$result = true;\n break none$break;\n }tmp$_1 = $receiver_0.iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n if (hasGeneralTooltip(element_0)) {\n none$result = false;\n break none$break;\n }}\n none$result = true;\n }\n while (false);\n if (none$result)\n tmp$ = this.myPicked_0;\n else {\n var $receiver_1 = this.myAllLookupResults_0;\n var any$result_0;\n any$break: do {\n var tmp$_2;\n if (Kotlin.isType($receiver_1, Collection) && $receiver_1.isEmpty()) {\n any$result_0 = false;\n break any$break;\n }tmp$_2 = $receiver_1.iterator();\n while (tmp$_2.hasNext()) {\n var element_1 = tmp$_2.next();\n if (hasGeneralTooltip(element_1) && hasAxisTooltip(element_1)) {\n any$result_0 = true;\n break any$break;\n }}\n any$result_0 = false;\n }\n while (false);\n if (any$result_0) {\n var $receiver_2 = this.myAllLookupResults_0;\n var last$result;\n last$break: do {\n var iterator = $receiver_2.listIterator_za3lpa$($receiver_2.size);\n while (iterator.hasPrevious()) {\n var element_2 = iterator.previous();\n if (hasGeneralTooltip(element_2) && hasAxisTooltip(element_2)) {\n last$result = element_2;\n break last$break;\n }}\n throw new NoSuchElementException_init_0('List contains no element matching the predicate.');\n }\n while (false);\n tmp$ = listOf(last$result);\n } else {\n var $receiver_3 = this.myAllLookupResults_0;\n var lastOrNull$result;\n lastOrNull$break: do {\n var iterator_0 = $receiver_3.listIterator_za3lpa$($receiver_3.size);\n while (iterator_0.hasPrevious()) {\n var element_3 = iterator_0.previous();\n if (hasGeneralTooltip(element_3)) {\n lastOrNull$result = element_3;\n break lastOrNull$break;\n }}\n lastOrNull$result = null;\n }\n while (false);\n var withGeneralTooltip = lastOrNull$result;\n var $receiver_4 = this.myAllLookupResults_0;\n var lastOrNull$result_0;\n lastOrNull$break: do {\n var iterator_1 = $receiver_4.listIterator_za3lpa$($receiver_4.size);\n while (iterator_1.hasPrevious()) {\n var element_4 = iterator_1.previous();\n if (hasAxisTooltip(element_4)) {\n lastOrNull$result_0 = element_4;\n break lastOrNull$break;\n }}\n lastOrNull$result_0 = null;\n }\n while (false);\n var withAxisTooltip = lastOrNull$result_0;\n tmp$ = listOfNotNull([withGeneralTooltip, withAxisTooltip]);\n }\n }\n }\n return tmp$;\n };\n function LocatedTargetsPicker$Companion() {\n LocatedTargetsPicker$Companion_instance = this;\n this.CUTOFF_DISTANCE_8be2vx$ = 30.0;\n this.FAKE_DISTANCE_8be2vx$ = 15.0;\n this.UNIVARIATE_GEOMS_0 = listOf_0([GeomKind.DENSITY, GeomKind.FREQPOLY, GeomKind.BOX_PLOT, GeomKind.HISTOGRAM, GeomKind.LINE, GeomKind.AREA, GeomKind.BAR, GeomKind.ERROR_BAR, GeomKind.CROSS_BAR, GeomKind.LINE_RANGE, GeomKind.POINT_RANGE]);\n this.UNIVARIATE_LINES_0 = listOf_0([GeomKind.DENSITY, GeomKind.FREQPOLY, GeomKind.LINE, GeomKind.AREA, GeomKind.SEGMENT]);\n }\n LocatedTargetsPicker$Companion.prototype.distance_0 = function (locatedTargetList, coord) {\n var tmp$, tmp$_0;\n var distance = locatedTargetList.distance;\n if (distance === 0.0) {\n if (!locatedTargetList.isCrosshairEnabled || coord == null) {\n tmp$_0 = this.FAKE_DISTANCE_8be2vx$;\n } else {\n var $receiver = locatedTargetList.targets;\n var destination = ArrayList_init();\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n if (element.tipLayoutHint.coord != null)\n destination.add_11rb$(element);\n }\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(destination, 10));\n var tmp$_2;\n tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination_0.add_11rb$(MathUtil_getInstance().distance_l9poh5$(coord, ensureNotNull(item.tipLayoutHint.coord)));\n }\n tmp$_0 = (tmp$ = minOrNull(destination_0)) != null ? tmp$ : this.FAKE_DISTANCE_8be2vx$;\n }\n } else {\n tmp$_0 = distance;\n }\n return tmp$_0;\n };\n LocatedTargetsPicker$Companion.prototype.isSameUnivariateGeom_0 = function (lft, rgt) {\n return lft.geomKind === rgt.geomKind && this.UNIVARIATE_GEOMS_0.contains_11rb$(rgt.geomKind);\n };\n LocatedTargetsPicker$Companion.prototype.filterResults_0 = function (lookupResult, coord) {\n if (coord == null || !this.UNIVARIATE_LINES_0.contains_11rb$(lookupResult.geomKind)) {\n return lookupResult;\n }var $receiver = lookupResult.targets;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.tipLayoutHint.coord != null)\n destination.add_11rb$(element);\n }\n var geomTargets = destination;\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(geomTargets, 10));\n var tmp$_0;\n tmp$_0 = geomTargets.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination_0.add_11rb$(ensureNotNull(item.tipLayoutHint.coord).subtract_gpjtzr$(coord).x);\n }\n var minByOrNull$result;\n minByOrNull$break: do {\n var iterator = destination_0.iterator();\n if (!iterator.hasNext()) {\n minByOrNull$result = null;\n break minByOrNull$break;\n }var minElem = iterator.next();\n if (!iterator.hasNext()) {\n minByOrNull$result = minElem;\n break minByOrNull$break;\n }var it = minElem;\n var minValue = JsMath.abs(it);\n do {\n var e = iterator.next();\n var v = JsMath.abs(e);\n if (Kotlin.compareTo(minValue, v) > 0) {\n minElem = e;\n minValue = v;\n }}\n while (iterator.hasNext());\n minByOrNull$result = minElem;\n }\n while (false);\n var minXToTarget = minByOrNull$result;\n var destination_1 = ArrayList_init();\n var tmp$_1;\n tmp$_1 = geomTargets.iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n if (ensureNotNull(element_0.tipLayoutHint.coord).subtract_gpjtzr$(coord).x === minXToTarget)\n destination_1.add_11rb$(element_0);\n }\n var tmp$_2;\n var set = HashSet_init_0();\n var list = ArrayList_init();\n tmp$_2 = destination_1.iterator();\n while (tmp$_2.hasNext()) {\n var e_0 = tmp$_2.next();\n var key = e_0.hitIndex;\n if (set.add_11rb$(key))\n list.add_11rb$(e_0);\n }\n var newTargets = list;\n return new GeomTargetLocator$LookupResult(newTargets, lookupResult.distance, lookupResult.geomKind, lookupResult.contextualMapping, lookupResult.isCrosshairEnabled);\n };\n LocatedTargetsPicker$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LocatedTargetsPicker$Companion_instance = null;\n function LocatedTargetsPicker$Companion_getInstance() {\n if (LocatedTargetsPicker$Companion_instance === null) {\n new LocatedTargetsPicker$Companion();\n }return LocatedTargetsPicker$Companion_instance;\n }\n LocatedTargetsPicker.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LocatedTargetsPicker',\n interfaces: []\n };\n function TargetDetector(locatorLookupSpace, locatorLookupStrategy) {\n TargetDetector$Companion_getInstance();\n this.locatorLookupSpace_0 = locatorLookupSpace;\n this.locatorLookupStrategy_0 = locatorLookupStrategy;\n }\n function TargetDetector$checkPath$lambda(closure$pathPoints) {\n return function (index) {\n return closure$pathPoints.get_za3lpa$(index).projection().x();\n };\n }\n TargetDetector.prototype.checkPath_z3141m$ = function (cursorCoord, pathProjection, closestPointChecker) {\n var tmp$, tmp$_0, tmp$_1;\n switch (this.locatorLookupSpace_0.name) {\n case 'X':\n if (this.locatorLookupStrategy_0 === GeomTargetLocator$LookupStrategy.NONE) {\n return null;\n }\n var pathPoints = pathProjection.points;\n if (pathPoints.isEmpty()) {\n return null;\n }\n var resultIndex = TargetDetector$Companion_getInstance().binarySearch_0(cursorCoord.x, pathPoints.size, TargetDetector$checkPath$lambda(pathPoints));\n var bestPoint = pathPoints.get_za3lpa$(resultIndex);\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n if (cursorCoord.x < pathPoints.get_za3lpa$(0).projection().x() || cursorCoord.x > pathPoints.get_za3lpa$(pathPoints.size - 1 | 0).projection().x()) {\n tmp$ = null;\n } else\n tmp$ = bestPoint;\n break;\n case 'NEAREST':\n tmp$ = bestPoint;\n break;\n default:throw IllegalStateException_init('Unknown lookup strategy: ' + this.locatorLookupStrategy_0);\n }\n\n return tmp$;\n case 'XY':\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n tmp$_0 = pathProjection.points.iterator();\n while (tmp$_0.hasNext()) {\n var pathPoint = tmp$_0.next();\n var targetPointCoord = pathPoint.projection().xy();\n if (MathUtil_getInstance().areEqual_f1g2it$(targetPointCoord, cursorCoord, TargetDetector$Companion_getInstance().POINT_AREA_EPSILON_0)) {\n return pathPoint;\n }}\n\n return null;\n case 'NEAREST':\n var nearestPoint = null;\n tmp$_1 = pathProjection.points.iterator();\n while (tmp$_1.hasNext()) {\n var pathPoint_0 = tmp$_1.next();\n var targetPointCoord_0 = pathPoint_0.projection().xy();\n if (closestPointChecker.check_gpjtzr$(targetPointCoord_0)) {\n nearestPoint = pathPoint_0;\n }}\n\n return nearestPoint;\n case 'NONE':\n return null;\n default:Kotlin.noWhenBranchMatched();\n break;\n }\n\n break;\n case 'NONE':\n return null;\n default:throw IllegalStateException_init_0();\n }\n };\n TargetDetector.prototype.checkPoint_w0b42b$ = function (cursorCoord, pointProjection, closestPointChecker) {\n var tmp$, tmp$_0;\n switch (this.locatorLookupSpace_0.name) {\n case 'X':\n var x = pointProjection.x();\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n tmp$ = MathUtil_getInstance().areEqual_hln2n9$(x, cursorCoord.x, TargetDetector$Companion_getInstance().POINT_AREA_EPSILON_0);\n break;\n case 'NEAREST':\n tmp$ = closestPointChecker.check_gpjtzr$(new DoubleVector(x, 0.0));\n break;\n case 'NONE':\n tmp$ = false;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n\n return tmp$;\n case 'XY':\n var targetPointCoord = pointProjection.xy();\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n tmp$_0 = MathUtil_getInstance().areEqual_f1g2it$(targetPointCoord, cursorCoord, TargetDetector$Companion_getInstance().POINT_AREA_EPSILON_0);\n break;\n case 'NEAREST':\n tmp$_0 = closestPointChecker.check_gpjtzr$(targetPointCoord);\n break;\n case 'NONE':\n tmp$_0 = false;\n break;\n default:tmp$_0 = Kotlin.noWhenBranchMatched();\n break;\n }\n\n return tmp$_0;\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n };\n TargetDetector.prototype.checkRect_fqo6rd$ = function (cursorCoord, rectProjection, closestPointChecker) {\n switch (this.locatorLookupSpace_0.name) {\n case 'X':\n var range = rectProjection.x();\n return this.rangeBasedLookup_0(cursorCoord, closestPointChecker, range);\n case 'XY':\n var rect = rectProjection.xy();\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n return rect.contains_gpjtzr$(cursorCoord);\n case 'NEAREST':\n if (rect.contains_gpjtzr$(cursorCoord)) {\n return closestPointChecker.check_gpjtzr$(cursorCoord);\n }\n var x = cursorCoord.x < rect.left ? rect.left : rect.right;\n var y = cursorCoord.y < rect.top ? rect.top : rect.bottom;\n x = rect.xRange().contains_mef7kx$(cursorCoord.x) ? cursorCoord.x : x;\n y = rect.yRange().contains_mef7kx$(cursorCoord.y) ? cursorCoord.y : y;\n return closestPointChecker.check_gpjtzr$(new DoubleVector(x, y));\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n };\n TargetDetector.prototype.checkPolygon_q60eo3$ = function (cursorCoord, polygonProjection, closestPointChecker) {\n var tmp$;\n switch (this.locatorLookupSpace_0.name) {\n case 'X':\n var range = polygonProjection.x();\n return this.rangeBasedLookup_0(cursorCoord, closestPointChecker, range);\n case 'XY':\n var polygon = polygonProjection.xy();\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n case 'NEAREST':\n var counter = 0;\n tmp$ = polygon.iterator();\n while (tmp$.hasNext()) {\n var ring = tmp$.next();\n if (ring.bbox.contains_gpjtzr$(cursorCoord) && MathUtil_getInstance().polygonContainsCoordinate_sz9prc$(ring.edges, cursorCoord)) {\n counter = counter + 1 | 0;\n }}\n\n return counter % 2 !== 0;\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n\n break;\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n };\n TargetDetector.prototype.rangeBasedLookup_0 = function (cursorCoord, closestPointChecker, range) {\n var tmp$;\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n return range.contains_14dthe$(cursorCoord.x);\n case 'NEAREST':\n if (!range.contains_14dthe$(cursorCoord.x - TargetDetector$Companion_getInstance().RECT_X_NEAREST_EPSILON_0) && !range.contains_14dthe$(cursorCoord.x + TargetDetector$Companion_getInstance().RECT_X_NEAREST_EPSILON_0)) {\n tmp$ = false;\n } else\n tmp$ = closestPointChecker.compare_gpjtzr$(new DoubleVector(range.start() + range.length() / 2, cursorCoord.y)) !== MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance();\n return tmp$;\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n };\n function TargetDetector$Companion() {\n TargetDetector$Companion_instance = this;\n this.POINT_AREA_EPSILON_0 = 0.1;\n this.POINT_X_NEAREST_EPSILON_0 = 2.0;\n this.RECT_X_NEAREST_EPSILON_0 = 2.0;\n }\n TargetDetector$Companion.prototype.binarySearch_0 = function (value, length, indexer) {\n var tmp$;\n if (value < indexer(0)) {\n return 0;\n }if (value > indexer(length - 1 | 0)) {\n return length - 1 | 0;\n }var lo = 0;\n var hi = length - 1 | 0;\n while (lo <= hi) {\n var mid = (hi + lo | 0) / 2 | 0;\n var midValue = indexer(mid);\n if (value < midValue)\n hi = mid - 1 | 0;\n else if (value > midValue)\n lo = mid + 1 | 0;\n else\n return mid;\n }\n if (indexer(lo) - value < value - indexer(hi)) {\n tmp$ = lo;\n } else {\n tmp$ = hi;\n }\n return tmp$;\n };\n TargetDetector$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TargetDetector$Companion_instance = null;\n function TargetDetector$Companion_getInstance() {\n if (TargetDetector$Companion_instance === null) {\n new TargetDetector$Companion();\n }return TargetDetector$Companion_instance;\n }\n TargetDetector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TargetDetector',\n interfaces: []\n };\n function TargetProjection() {\n }\n TargetProjection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TargetProjection',\n interfaces: []\n };\n function PointTargetProjection(data) {\n PointTargetProjection$Companion_getInstance();\n TargetProjection.call(this);\n this.data = data;\n }\n PointTargetProjection.prototype.x = function () {\n var tmp$;\n return typeof (tmp$ = this.data) === 'number' ? tmp$ : throwCCE();\n };\n PointTargetProjection.prototype.xy = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.data, DoubleVector) ? tmp$ : throwCCE();\n };\n function PointTargetProjection$Companion() {\n PointTargetProjection$Companion_instance = this;\n }\n PointTargetProjection$Companion.prototype.create_p1yge$ = function (p, lookupSpace) {\n var tmp$;\n switch (lookupSpace.name) {\n case 'X':\n tmp$ = new PointTargetProjection(p.x);\n break;\n case 'XY':\n tmp$ = new PointTargetProjection(p);\n break;\n case 'NONE':\n tmp$ = undefinedLookupSpaceError();\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n PointTargetProjection$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PointTargetProjection$Companion_instance = null;\n function PointTargetProjection$Companion_getInstance() {\n if (PointTargetProjection$Companion_instance === null) {\n new PointTargetProjection$Companion();\n }return PointTargetProjection$Companion_instance;\n }\n PointTargetProjection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointTargetProjection',\n interfaces: [TargetProjection]\n };\n function RectTargetProjection(data) {\n RectTargetProjection$Companion_getInstance();\n TargetProjection.call(this);\n this.data = data;\n }\n RectTargetProjection.prototype.x = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.data, MathUtil$DoubleRange) ? tmp$ : throwCCE();\n };\n RectTargetProjection.prototype.xy = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.data, DoubleRectangle) ? tmp$ : throwCCE();\n };\n function RectTargetProjection$Companion() {\n RectTargetProjection$Companion_instance = this;\n }\n RectTargetProjection$Companion.prototype.create_tb1cvm$ = function (rect, lookupSpace) {\n var tmp$;\n switch (lookupSpace.name) {\n case 'X':\n tmp$ = new RectTargetProjection(MathUtil$DoubleRange$Companion_getInstance().withStartAndEnd_lu1900$(rect.left, rect.right));\n break;\n case 'XY':\n tmp$ = new RectTargetProjection(rect);\n break;\n case 'NONE':\n tmp$ = undefinedLookupSpaceError();\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n RectTargetProjection$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RectTargetProjection$Companion_instance = null;\n function RectTargetProjection$Companion_getInstance() {\n if (RectTargetProjection$Companion_instance === null) {\n new RectTargetProjection$Companion();\n }return RectTargetProjection$Companion_instance;\n }\n RectTargetProjection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RectTargetProjection',\n interfaces: [TargetProjection]\n };\n function PolygonTargetProjection(data) {\n PolygonTargetProjection$Companion_getInstance();\n TargetProjection.call(this);\n this.data = data;\n }\n PolygonTargetProjection.prototype.x = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.data, MathUtil$DoubleRange) ? tmp$ : throwCCE();\n };\n PolygonTargetProjection.prototype.xy = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.data, List) ? tmp$ : throwCCE();\n };\n function PolygonTargetProjection$Companion() {\n PolygonTargetProjection$Companion_instance = this;\n this.AREA_LIMIT_TO_REMOVE_POLYGON_0 = 25.0;\n this.POINTS_COUNT_TO_SKIP_SIMPLIFICATION_0 = 20.0;\n this.AREA_TOLERANCE_RATIO_0 = 0.1;\n this.MAX_TOLERANCE_0 = 40.0;\n this.isLogEnabled_0 = false;\n }\n PolygonTargetProjection$Companion.prototype.create_a95qp$ = function (points, lookupSpace) {\n var tmp$;\n var rings = splitRings(points);\n switch (lookupSpace.name) {\n case 'X':\n tmp$ = new PolygonTargetProjection(this.mapToX_0(rings));\n break;\n case 'XY':\n tmp$ = new PolygonTargetProjection(this.mapToXY_0(rings));\n break;\n case 'NONE':\n tmp$ = undefinedLookupSpaceError();\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n PolygonTargetProjection$Companion.prototype.mapToX_0 = function (rings) {\n var tmp$, tmp$_0;\n var min = rings.get_za3lpa$(0).get_za3lpa$(0).x;\n var max = min;\n tmp$ = rings.iterator();\n while (tmp$.hasNext()) {\n var ring = tmp$.next();\n tmp$_0 = ring.iterator();\n while (tmp$_0.hasNext()) {\n var point = tmp$_0.next();\n var a = min;\n var b = point.x;\n min = JsMath.min(a, b);\n var a_0 = max;\n var b_0 = point.x;\n max = JsMath.max(a_0, b_0);\n }\n }\n return MathUtil$DoubleRange$Companion_getInstance().withStartAndEnd_lu1900$(min, max);\n };\n PolygonTargetProjection$Companion.prototype.mapToXY_0 = function (rings) {\n var tmp$;\n var polygon = ArrayList_init();\n tmp$ = rings.iterator();\n while (tmp$.hasNext()) {\n var ring = tmp$.next();\n if (ring.size < 4) {\n continue;\n }var bbox = geometry.DoubleRectangles.boundingBox_qdtdbw$(ring);\n var area = calculateArea(ring);\n var simplifiedRing;\n if (ring.size > this.POINTS_COUNT_TO_SKIP_SIMPLIFICATION_0) {\n var a = area * this.AREA_TOLERANCE_RATIO_0;\n var b = this.MAX_TOLERANCE_0;\n var tolerance = JsMath.min(a, b);\n simplifiedRing = PolylineSimplifier.Companion.visvalingamWhyatt_ytws2g$(ring).setWeightLimit_14dthe$(tolerance).points;\n if (this.isLogEnabled_0) {\n this.log_0('Simp: ' + toString(ring.size) + ' -> ' + toString(simplifiedRing.size) + ', tolerance=' + toString(tolerance) + ', bbox=' + toString(bbox) + ', area=' + toString(area));\n }} else {\n if (this.isLogEnabled_0) {\n this.log_0('Keep: size: ' + toString(ring.size) + ', bbox=' + toString(bbox) + ', area=' + toString(area));\n }simplifiedRing = ring;\n }\n if (simplifiedRing.size < 4) {\n continue;\n }polygon.add_11rb$(new PolygonTargetProjection$RingXY(simplifiedRing, bbox));\n }\n return polygon;\n };\n PolygonTargetProjection$Companion.prototype.log_0 = function (str) {\n println(str);\n };\n PolygonTargetProjection$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PolygonTargetProjection$Companion_instance = null;\n function PolygonTargetProjection$Companion_getInstance() {\n if (PolygonTargetProjection$Companion_instance === null) {\n new PolygonTargetProjection$Companion();\n }return PolygonTargetProjection$Companion_instance;\n }\n function PolygonTargetProjection$RingXY(edges, bbox) {\n this.edges = edges;\n this.bbox = bbox;\n }\n PolygonTargetProjection$RingXY.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RingXY',\n interfaces: []\n };\n PolygonTargetProjection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolygonTargetProjection',\n interfaces: [TargetProjection]\n };\n function PathTargetProjection(data) {\n PathTargetProjection$Companion_getInstance();\n TargetProjection.call(this);\n this.data = data;\n this.points = this.data;\n }\n function PathTargetProjection$PathPoint(myPointTargetProjection, originalCoord, index) {\n PathTargetProjection$PathPoint$Companion_getInstance();\n this.myPointTargetProjection_0 = myPointTargetProjection;\n this.originalCoord = originalCoord;\n this.index = index;\n }\n PathTargetProjection$PathPoint.prototype.projection = function () {\n return this.myPointTargetProjection_0;\n };\n function PathTargetProjection$PathPoint$Companion() {\n PathTargetProjection$PathPoint$Companion_instance = this;\n }\n PathTargetProjection$PathPoint$Companion.prototype.create_hdp8xa$ = function (p, index, lookupSpace) {\n var tmp$;\n switch (lookupSpace.name) {\n case 'X':\n tmp$ = new PathTargetProjection$PathPoint(PointTargetProjection$Companion_getInstance().create_p1yge$(p, lookupSpace), p, index);\n break;\n case 'XY':\n tmp$ = new PathTargetProjection$PathPoint(PointTargetProjection$Companion_getInstance().create_p1yge$(p, lookupSpace), p, index);\n break;\n case 'NONE':\n tmp$ = undefinedLookupSpaceError();\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n PathTargetProjection$PathPoint$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PathTargetProjection$PathPoint$Companion_instance = null;\n function PathTargetProjection$PathPoint$Companion_getInstance() {\n if (PathTargetProjection$PathPoint$Companion_instance === null) {\n new PathTargetProjection$PathPoint$Companion();\n }return PathTargetProjection$PathPoint$Companion_instance;\n }\n PathTargetProjection$PathPoint.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PathPoint',\n interfaces: []\n };\n function PathTargetProjection$Companion() {\n PathTargetProjection$Companion_instance = this;\n }\n PathTargetProjection$Companion.prototype.create_zb7j6l$ = function (points, indexMapper, lookupSpace) {\n var pointsLocation = ArrayList_init();\n var i = 0;\n for (var tmp$ = points.iterator(); tmp$.hasNext(); ++i) {\n var point = tmp$.next();\n pointsLocation.add_11rb$(PathTargetProjection$PathPoint$Companion_getInstance().create_hdp8xa$(point, indexMapper(i), lookupSpace));\n }\n return new PathTargetProjection(pointsLocation);\n };\n PathTargetProjection$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PathTargetProjection$Companion_instance = null;\n function PathTargetProjection$Companion_getInstance() {\n if (PathTargetProjection$Companion_instance === null) {\n new PathTargetProjection$Companion();\n }return PathTargetProjection$Companion_instance;\n }\n PathTargetProjection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PathTargetProjection',\n interfaces: [TargetProjection]\n };\n function undefinedLookupSpaceError() {\n throw IllegalStateException_init('Undefined geom lookup space');\n }\n function TargetPrototype(hitShape, indexMapper, tooltipParams, tooltipKind) {\n TargetPrototype$Companion_getInstance();\n this.hitShape_8be2vx$ = hitShape;\n this.indexMapper_8be2vx$ = indexMapper;\n this.tooltipParams_0 = tooltipParams;\n this.tooltipKind_8be2vx$ = tooltipKind;\n }\n TargetPrototype.prototype.createGeomTarget_x7nr8i$ = function (hitCoord, hitIndex) {\n return new GeomTarget(hitIndex, TargetPrototype$Companion_getInstance().createTipLayoutHint_17pt0e$(hitCoord, this.hitShape_8be2vx$, this.tooltipParams_0.getColor(), this.tooltipKind_8be2vx$, this.tooltipParams_0.getStemLength()), this.tooltipParams_0.getTipLayoutHints());\n };\n function TargetPrototype$Companion() {\n TargetPrototype$Companion_instance = this;\n }\n TargetPrototype$Companion.prototype.createTipLayoutHint_17pt0e$ = function (hitCoord, hitShape, fill, tooltipKind, stemLength) {\n var tmp$;\n switch (hitShape.kind.name) {\n case 'POINT':\n switch (tooltipKind.name) {\n case 'VERTICAL_TOOLTIP':\n tmp$ = TipLayoutHint.Companion.verticalTooltip_6lq1u6$(hitCoord, hitShape.point.radius, fill, stemLength);\n break;\n case 'CURSOR_TOOLTIP':\n tmp$ = TipLayoutHint.Companion.cursorTooltip_itpcqk$(hitCoord, fill, stemLength);\n break;\n default:throw IllegalStateException_init(('Wrong TipLayoutHint.kind = ' + tooltipKind + ' for POINT').toString());\n }\n\n break;\n case 'RECT':\n switch (tooltipKind.name) {\n case 'VERTICAL_TOOLTIP':\n tmp$ = TipLayoutHint.Companion.verticalTooltip_6lq1u6$(hitCoord, 0.0, fill, stemLength);\n break;\n case 'HORIZONTAL_TOOLTIP':\n tmp$ = TipLayoutHint.Companion.horizontalTooltip_6lq1u6$(hitCoord, hitShape.rect.width / 2, fill, stemLength);\n break;\n case 'CURSOR_TOOLTIP':\n tmp$ = TipLayoutHint.Companion.cursorTooltip_itpcqk$(hitCoord, fill, stemLength);\n break;\n default:throw IllegalStateException_init(('Wrong TipLayoutHint.kind = ' + tooltipKind + ' for RECT').toString());\n }\n\n break;\n case 'PATH':\n if (equals(tooltipKind, TipLayoutHint$Kind.HORIZONTAL_TOOLTIP))\n tmp$ = TipLayoutHint.Companion.horizontalTooltip_6lq1u6$(hitCoord, 0.0, fill, stemLength);\n else {\n throw IllegalStateException_init(('Wrong TipLayoutHint.kind = ' + tooltipKind + ' for PATH').toString());\n }\n\n break;\n case 'POLYGON':\n if (equals(tooltipKind, TipLayoutHint$Kind.CURSOR_TOOLTIP))\n tmp$ = TipLayoutHint.Companion.cursorTooltip_itpcqk$(hitCoord, fill, stemLength);\n else {\n throw IllegalStateException_init(('Wrong TipLayoutHint.kind = ' + tooltipKind + ' for POLYGON').toString());\n }\n\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n TargetPrototype$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TargetPrototype$Companion_instance = null;\n function TargetPrototype$Companion_getInstance() {\n if (TargetPrototype$Companion_instance === null) {\n new TargetPrototype$Companion();\n }return TargetPrototype$Companion_instance;\n }\n TargetPrototype.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TargetPrototype',\n interfaces: []\n };\n function TransformedTargetLocator(targetLocator) {\n this.targetLocator_q7bze5$_0 = targetLocator;\n }\n TransformedTargetLocator.prototype.search_gpjtzr$ = function (coord) {\n var tmp$;\n var targetCoord = this.convertToTargetCoord_gpjtzr$(coord);\n tmp$ = this.targetLocator_q7bze5$_0.search_gpjtzr$(targetCoord);\n if (tmp$ == null) {\n return null;\n }var result = tmp$;\n return this.convertLookupResult_rz45e2$_0(result);\n };\n TransformedTargetLocator.prototype.convertLookupResult_rz45e2$_0 = function (lookupResult) {\n return new GeomTargetLocator$LookupResult(this.convertGeomTargets_cu5hhh$_0(lookupResult.targets), this.convertToPlotDistance_14dthe$(lookupResult.distance), lookupResult.geomKind, lookupResult.contextualMapping, lookupResult.contextualMapping.isCrosshairEnabled);\n };\n function TransformedTargetLocator$convertGeomTargets$lambda(this$TransformedTargetLocator) {\n return function (geomTarget) {\n return new GeomTarget(geomTarget.hitIndex, this$TransformedTargetLocator.convertTipLayoutHint_jnrdzl$_0(geomTarget.tipLayoutHint), this$TransformedTargetLocator.convertTipLayoutHints_dshtp8$_0(geomTarget.aesTipLayoutHints));\n };\n }\n TransformedTargetLocator.prototype.convertGeomTargets_cu5hhh$_0 = function (geomTargets) {\n return ArrayList_init_0(collect.Lists.transform_l7riir$(geomTargets, TransformedTargetLocator$convertGeomTargets$lambda(this)));\n };\n TransformedTargetLocator.prototype.convertTipLayoutHint_jnrdzl$_0 = function (hint) {\n return new TipLayoutHint(hint.kind, ensureNotNull(this.safeConvertToPlotCoord_eoxeor$_0(hint.coord)), this.convertToPlotDistance_14dthe$(hint.objectRadius), hint.color, hint.stemLength);\n };\n TransformedTargetLocator.prototype.convertTipLayoutHints_dshtp8$_0 = function (tipLayoutHints) {\n var result = HashMap_init();\n var tmp$;\n tmp$ = tipLayoutHints.entries.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var aes = element.key;\n var hint = element.value;\n var value = this.convertTipLayoutHint_jnrdzl$_0(hint);\n result.put_xwzc9p$(aes, value);\n }\n return result;\n };\n TransformedTargetLocator.prototype.safeConvertToPlotCoord_eoxeor$_0 = function (coord) {\n return coord == null ? null : this.convertToPlotCoord_gpjtzr$(coord);\n };\n TransformedTargetLocator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TransformedTargetLocator',\n interfaces: [GeomTargetLocator]\n };\n function AxisLayout() {\n }\n AxisLayout.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'AxisLayout',\n interfaces: []\n };\n function AxisLayoutInfo(b) {\n this.axisBreaks = null;\n this.axisLength = 0;\n this.orientation = null;\n this.axisDomain = null;\n this.tickLabelsBounds = null;\n this.tickLabelRotationAngle = 0;\n this.tickLabelHorizontalAnchor = null;\n this.tickLabelVerticalAnchor = null;\n this.tickLabelAdditionalOffsets = null;\n this.tickLabelSmallFont = false;\n this.tickLabelsBoundsMax_8be2vx$ = null;\n if (!(b.myAxisBreaks != null)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }if (!(b.myOrientation != null)) {\n var message_0 = 'Failed requirement.';\n throw IllegalArgumentException_init(message_0.toString());\n }if (!(b.myTickLabelsBounds != null)) {\n var message_1 = 'Failed requirement.';\n throw IllegalArgumentException_init(message_1.toString());\n }if (!(b.myAxisDomain != null)) {\n var message_2 = 'Failed requirement.';\n throw IllegalArgumentException_init(message_2.toString());\n }this.axisBreaks = b.myAxisBreaks;\n this.axisLength = b.myAxisLength;\n this.orientation = b.myOrientation;\n this.axisDomain = b.myAxisDomain;\n this.tickLabelsBounds = b.myTickLabelsBounds;\n this.tickLabelRotationAngle = b.myTickLabelRotationAngle;\n this.tickLabelHorizontalAnchor = b.myLabelHorizontalAnchor;\n this.tickLabelVerticalAnchor = b.myLabelVerticalAnchor;\n this.tickLabelAdditionalOffsets = b.myLabelAdditionalOffsets;\n this.tickLabelSmallFont = b.myTickLabelSmallFont;\n this.tickLabelsBoundsMax_8be2vx$ = b.myMaxTickLabelsBounds;\n }\n AxisLayoutInfo.prototype.withAxisLength_14dthe$ = function (axisLength) {\n var b = new AxisLayoutInfo$Builder();\n b.myAxisBreaks = this.axisBreaks;\n b.myAxisLength = axisLength;\n b.myOrientation = this.orientation;\n b.myAxisDomain = this.axisDomain;\n b.myTickLabelsBounds = this.tickLabelsBounds;\n b.myTickLabelRotationAngle = this.tickLabelRotationAngle;\n b.myLabelHorizontalAnchor = this.tickLabelHorizontalAnchor;\n b.myLabelVerticalAnchor = this.tickLabelVerticalAnchor;\n b.myLabelAdditionalOffsets = this.tickLabelAdditionalOffsets;\n b.myTickLabelSmallFont = this.tickLabelSmallFont;\n b.myMaxTickLabelsBounds = this.tickLabelsBoundsMax_8be2vx$;\n return b;\n };\n AxisLayoutInfo.prototype.axisBounds = function () {\n return ensureNotNull(this.tickLabelsBounds).union_wthzt5$(DoubleRectangle_init(0.0, 0.0, 0.0, 0.0));\n };\n function AxisLayoutInfo$Builder() {\n this.myAxisLength = 0;\n this.myOrientation = null;\n this.myAxisDomain = null;\n this.myMaxTickLabelsBounds = null;\n this.myTickLabelSmallFont = false;\n this.myLabelAdditionalOffsets = null;\n this.myLabelHorizontalAnchor = null;\n this.myLabelVerticalAnchor = null;\n this.myTickLabelRotationAngle = 0.0;\n this.myTickLabelsBounds = null;\n this.myAxisBreaks = null;\n }\n AxisLayoutInfo$Builder.prototype.build = function () {\n return new AxisLayoutInfo(this);\n };\n AxisLayoutInfo$Builder.prototype.axisLength_14dthe$ = function (d) {\n this.myAxisLength = d;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.orientation_9y97dg$ = function (o) {\n this.myOrientation = o;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.axisDomain_4fzjta$ = function (r) {\n this.myAxisDomain = r;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelsBoundsMax_myx2hi$ = function (r) {\n this.myMaxTickLabelsBounds = r;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelSmallFont_6taknv$ = function (b) {\n this.myTickLabelSmallFont = b;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelAdditionalOffsets_eajcfd$ = function (labelAdditionalOffsets) {\n this.myLabelAdditionalOffsets = labelAdditionalOffsets;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelHorizontalAnchor_tk0ev1$ = function (labelHorizontalAnchor) {\n this.myLabelHorizontalAnchor = labelHorizontalAnchor;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelVerticalAnchor_24j3ht$ = function (labelVerticalAnchor) {\n this.myLabelVerticalAnchor = labelVerticalAnchor;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelRotationAngle_14dthe$ = function (rotationAngle) {\n this.myTickLabelRotationAngle = rotationAngle;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelsBounds_myx2hi$ = function (rectangle) {\n this.myTickLabelsBounds = rectangle;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.axisBreaks_bysjzy$ = function (breaks) {\n this.myAxisBreaks = breaks;\n return this;\n };\n AxisLayoutInfo$Builder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Builder',\n interfaces: []\n };\n AxisLayoutInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AxisLayoutInfo',\n interfaces: []\n };\n function EmptyAxisLayout(xDomain, yDomain, myOrientation) {\n EmptyAxisLayout$Companion_getInstance();\n this.myOrientation_0 = myOrientation;\n this.myAxisDomain_0 = null;\n this.myAxisDomain_0 = this.myOrientation_0.isHorizontal ? xDomain : yDomain;\n }\n EmptyAxisLayout.prototype.initialThickness = function () {\n return 0.0;\n };\n EmptyAxisLayout.prototype.doLayout_o2m17x$ = function (displaySize, maxTickLabelsBoundsStretched) {\n var axisLength = this.myOrientation_0.isHorizontal ? displaySize.x : displaySize.y;\n var tickLabelsBounds = this.myOrientation_0.isHorizontal ? DoubleRectangle_init(0.0, 0.0, axisLength, 0.0) : DoubleRectangle_init(0.0, 0.0, 0.0, axisLength);\n var breaks = new GuideBreaks(emptyList(), emptyList(), emptyList());\n var builder = (new AxisLayoutInfo$Builder()).axisBreaks_bysjzy$(breaks).axisLength_14dthe$(axisLength).orientation_9y97dg$(this.myOrientation_0).axisDomain_4fzjta$(this.myAxisDomain_0).tickLabelsBounds_myx2hi$(tickLabelsBounds);\n return builder.build();\n };\n function EmptyAxisLayout$Companion() {\n EmptyAxisLayout$Companion_instance = this;\n }\n EmptyAxisLayout$Companion.prototype.bottom_gyv40k$ = function (xDomain, yDomain) {\n return new EmptyAxisLayout(xDomain, yDomain, Orientation$BOTTOM_getInstance());\n };\n EmptyAxisLayout$Companion.prototype.left_gyv40k$ = function (xDomain, yDomain) {\n return new EmptyAxisLayout(xDomain, yDomain, Orientation$LEFT_getInstance());\n };\n EmptyAxisLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var EmptyAxisLayout$Companion_instance = null;\n function EmptyAxisLayout$Companion_getInstance() {\n if (EmptyAxisLayout$Companion_instance === null) {\n new EmptyAxisLayout$Companion();\n }return EmptyAxisLayout$Companion_instance;\n }\n EmptyAxisLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'EmptyAxisLayout',\n interfaces: [AxisLayout]\n };\n function FacetGridPlotLayout(facets, tileLayout) {\n FacetGridPlotLayout$Companion_getInstance();\n PlotLayoutBase.call(this);\n this.facets_0 = facets;\n this.tileLayout_0 = tileLayout;\n this.totalPanelHorizontalPadding_0 = FacetGridPlotLayout$Companion_getInstance().PANEL_PADDING_0 * (this.facets_0.colCount - 1 | 0);\n this.totalPanelVerticalPadding_0 = FacetGridPlotLayout$Companion_getInstance().PANEL_PADDING_0 * (this.facets_0.rowCount - 1 | 0);\n this.setPadding_6y0v78$(10.0, 10.0, 0.0, 0.0);\n if (!this.facets_0.isDefined) {\n var message = 'Undefined facets.';\n throw IllegalArgumentException_init(message.toString());\n }}\n FacetGridPlotLayout.prototype.doLayout_gpjtzr$ = function (preferredSize) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var tilesAreaSize = new DoubleVector(preferredSize.x - (this.paddingLeft_0 + this.paddingRight_0), preferredSize.y - (this.paddingTop_0 + this.paddingBottom_0));\n var facetTiles = this.facets_0.tileInfos();\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_3;\n tmp$_3 = facetTiles.iterator();\n while (tmp$_3.hasNext()) {\n var element = tmp$_3.next();\n if (!element.colLabs.isEmpty()) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n var tileColLabCounts = (tmp$_1 = (tmp$_0 = (tmp$ = firstOrNull$result) != null ? tmp$.colLabs : null) != null ? tmp$_0.size : null) != null ? tmp$_1 : 0;\n var destination = ArrayList_init();\n var tmp$_4;\n tmp$_4 = facetTiles.iterator();\n while (tmp$_4.hasNext()) {\n var element_0 = tmp$_4.next();\n if (!element_0.colLabs.isEmpty())\n destination.add_11rb$(element_0);\n }\n var tmp$_5;\n var set = HashSet_init_0();\n var list = ArrayList_init();\n tmp$_5 = destination.iterator();\n while (tmp$_5.hasNext()) {\n var e = tmp$_5.next();\n var key = e.row;\n if (set.add_11rb$(key))\n list.add_11rb$(e);\n }\n var tileWithColLabInRowCount = list.size;\n var totalAddedHeight = FacetGridPlotLayout$Companion_getInstance().facetColHeadHeight_za3lpa$(tileColLabCounts) * tileWithColLabInRowCount;\n var any$result;\n any$break: do {\n var tmp$_6;\n if (Kotlin.isType(facetTiles, Collection) && facetTiles.isEmpty()) {\n any$result = false;\n break any$break;\n }tmp$_6 = facetTiles.iterator();\n while (tmp$_6.hasNext()) {\n var element_1 = tmp$_6.next();\n if (element_1.rowLab != null) {\n any$result = true;\n break any$break;\n }}\n any$result = false;\n }\n while (false);\n var labsInRow = any$result ? 1 : 0;\n var labsTotalDim = new DoubleVector(labsInRow * FacetGridPlotLayout$Companion_getInstance().FACET_TAB_HEIGHT, totalAddedHeight);\n tilesAreaSize = tilesAreaSize.subtract_gpjtzr$(labsTotalDim);\n var tileWidth = (tilesAreaSize.x - this.totalPanelHorizontalPadding_0) / this.facets_0.colCount;\n var tileHeight = (tilesAreaSize.y - this.totalPanelVerticalPadding_0) / this.facets_0.rowCount;\n var tileInfo = this.layoutTile_0(tileWidth, tileHeight);\n for (var i = 0; i <= 1; i++) {\n var tilesAreaSizeNew = this.tilesAreaSize_0(tileInfo);\n var widthDiff = tilesAreaSize.x - tilesAreaSizeNew.x;\n var heightDiff = tilesAreaSize.y - tilesAreaSizeNew.y;\n var tmp$_7 = JsMath.abs(widthDiff) <= this.facets_0.colCount;\n if (tmp$_7) {\n tmp$_7 = JsMath.abs(heightDiff) <= this.facets_0.rowCount;\n }if (tmp$_7) {\n break;\n }var geomWidth = tileInfo.geomWidth_8be2vx$() + widthDiff / this.facets_0.colCount;\n var newPanelWidth = geomWidth + tileInfo.axisThicknessY_8be2vx$();\n var geomHeight = tileInfo.geomHeight_8be2vx$() + heightDiff / this.facets_0.rowCount;\n var newPanelHeight = geomHeight + tileInfo.axisThicknessX_8be2vx$();\n tileInfo = this.layoutTile_0(newPanelWidth, newPanelHeight);\n }\n var axisThicknessX = tileInfo.axisThicknessX_8be2vx$();\n var axisThicknessY = tileInfo.axisThicknessY_8be2vx$();\n var geomWidth_0 = tileInfo.geomWidth_8be2vx$();\n var geomHeight_0 = tileInfo.geomHeight_8be2vx$();\n var tilesAreaBounds = new DoubleRectangle(DoubleVector.Companion.ZERO, DoubleVector.Companion.ZERO);\n var tilesAreaOffset = new DoubleVector(this.paddingLeft_0, this.paddingTop_0);\n var tileInfos = ArrayList_init();\n var offsetX = 0.0;\n var offsetY = 0.0;\n var currRow = 0;\n var prevHeight = 0.0;\n tmp$_2 = facetTiles.iterator();\n while (tmp$_2.hasNext()) {\n var facetTile = tmp$_2.next();\n var width = geomWidth_0;\n var geomX = 0.0;\n if (facetTile.yAxis) {\n width += axisThicknessY;\n geomX = axisThicknessY;\n }if (facetTile.rowLab != null) {\n width += FacetGridPlotLayout$Companion_getInstance().FACET_TAB_HEIGHT;\n }var height = geomHeight_0;\n var geomY;\n if (facetTile.xAxis && facetTile.row === (this.facets_0.rowCount - 1 | 0)) {\n height += axisThicknessX;\n }var addedHeight = FacetGridPlotLayout$Companion_getInstance().facetColHeadHeight_za3lpa$(facetTile.colLabs.size);\n height += addedHeight;\n geomY = addedHeight;\n var bounds = DoubleRectangle_init(0.0, 0.0, width, height);\n var geomBounds = DoubleRectangle_init(geomX, geomY, geomWidth_0, geomHeight_0);\n var row = facetTile.row;\n if (row > currRow) {\n currRow = row;\n offsetY += prevHeight + FacetGridPlotLayout$Companion_getInstance().PANEL_PADDING_0;\n }prevHeight = height;\n var col = facetTile.col;\n if (col === 0) {\n offsetX = 0.0;\n }var offset = new DoubleVector(offsetX, offsetY);\n offsetX += width + FacetGridPlotLayout$Companion_getInstance().PANEL_PADDING_0;\n var info = TileLayoutInfo_init(bounds, geomBounds, XYPlotLayoutUtil_getInstance().clipBounds_wthzt5$(geomBounds), tileInfo.layoutInfo_8be2vx$.xAxisInfo, tileInfo.layoutInfo_8be2vx$.yAxisInfo, facetTile.xAxis, facetTile.yAxis, facetTile.trueIndex).withOffset_gpjtzr$(tilesAreaOffset.add_gpjtzr$(offset)).withFacetLabels_5hkr16$(facetTile.colLabs, facetTile.rowLab);\n tileInfos.add_11rb$(info);\n tilesAreaBounds = tilesAreaBounds.union_wthzt5$(info.getAbsoluteBounds_gpjtzr$(tilesAreaOffset));\n }\n var plotSize = new DoubleVector(tilesAreaBounds.right + this.paddingRight_0, tilesAreaBounds.height + this.paddingBottom_0);\n return new PlotLayoutInfo(tileInfos, plotSize);\n };\n FacetGridPlotLayout.prototype.layoutTile_0 = function (tileWidth, tileHeight) {\n var layoutInfo = this.tileLayout_0.doLayout_gpjtzr$(new DoubleVector(tileWidth, tileHeight));\n return new FacetGridPlotLayout$MyTileInfo(layoutInfo);\n };\n FacetGridPlotLayout.prototype.tilesAreaSize_0 = function (tileInfo) {\n var w = tileInfo.geomWidth_8be2vx$() * this.facets_0.colCount + this.totalPanelHorizontalPadding_0 + tileInfo.axisThicknessY_8be2vx$();\n var h = tileInfo.geomHeight_8be2vx$() * this.facets_0.rowCount + this.totalPanelVerticalPadding_0 + tileInfo.axisThicknessX_8be2vx$();\n return new DoubleVector(w, h);\n };\n function FacetGridPlotLayout$MyTileInfo(layoutInfo) {\n this.layoutInfo_8be2vx$ = layoutInfo;\n }\n FacetGridPlotLayout$MyTileInfo.prototype.axisThicknessX_8be2vx$ = function () {\n return this.layoutInfo_8be2vx$.bounds.bottom - this.layoutInfo_8be2vx$.geomBounds.bottom;\n };\n FacetGridPlotLayout$MyTileInfo.prototype.axisThicknessY_8be2vx$ = function () {\n return this.layoutInfo_8be2vx$.geomBounds.left - this.layoutInfo_8be2vx$.bounds.left;\n };\n FacetGridPlotLayout$MyTileInfo.prototype.geomWidth_8be2vx$ = function () {\n return this.layoutInfo_8be2vx$.geomBounds.width;\n };\n FacetGridPlotLayout$MyTileInfo.prototype.geomHeight_8be2vx$ = function () {\n return this.layoutInfo_8be2vx$.geomBounds.height;\n };\n FacetGridPlotLayout$MyTileInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyTileInfo',\n interfaces: []\n };\n function FacetGridPlotLayout$Companion() {\n FacetGridPlotLayout$Companion_instance = this;\n this.FACET_TAB_HEIGHT = 30.0;\n this.FACET_H_PADDING = 0;\n this.FACET_V_PADDING = 6;\n this.PANEL_PADDING_0 = 10.0;\n }\n FacetGridPlotLayout$Companion.prototype.facetColLabelSize_14dthe$ = function (colWidth) {\n return new DoubleVector(colWidth - 0, this.FACET_TAB_HEIGHT - 6 * 2.0);\n };\n FacetGridPlotLayout$Companion.prototype.facetColHeadHeight_za3lpa$ = function (labCount) {\n var tmp$;\n if (labCount > 0) {\n tmp$ = this.facetColLabelSize_14dthe$(0.0).y * labCount + 12;\n } else {\n tmp$ = 0.0;\n }\n return tmp$;\n };\n FacetGridPlotLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var FacetGridPlotLayout$Companion_instance = null;\n function FacetGridPlotLayout$Companion_getInstance() {\n if (FacetGridPlotLayout$Companion_instance === null) {\n new FacetGridPlotLayout$Companion();\n }return FacetGridPlotLayout$Companion_instance;\n }\n FacetGridPlotLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FacetGridPlotLayout',\n interfaces: [PlotLayoutBase]\n };\n function GeometryUtil() {\n GeometryUtil_instance = this;\n }\n GeometryUtil.prototype.union_te9coj$ = function (first, optionalSecond) {\n var tmp$;\n if (optionalSecond == null) {\n tmp$ = first;\n } else\n tmp$ = first.union_wthzt5$(optionalSecond);\n return tmp$;\n };\n GeometryUtil.prototype.union_a7nkjf$ = function (head, c) {\n var tmp$;\n var result = head;\n tmp$ = c.iterator();\n while (tmp$.hasNext()) {\n var r = tmp$.next();\n result = result.union_wthzt5$(r);\n }\n return result;\n };\n GeometryUtil.prototype.doubleRange_gyv40k$ = function (xRange, yRange) {\n var xOrigin = xRange.lowerEnd;\n var yOrigin = yRange.lowerEnd;\n var xSpan = xRange.upperEnd - xRange.lowerEnd;\n var ySpan = yRange.upperEnd - yRange.lowerEnd;\n return DoubleRectangle_init(xOrigin, yOrigin, xSpan, ySpan);\n };\n GeometryUtil.prototype.changeWidth_j6cmed$ = function (r, width) {\n return DoubleRectangle_init(r.origin.x, r.origin.y, width, r.dimension.y);\n };\n GeometryUtil.prototype.changeWidthKeepRight_j6cmed$ = function (r, width) {\n return DoubleRectangle_init(r.right - width, r.origin.y, width, r.dimension.y);\n };\n GeometryUtil.prototype.changeHeight_j6cmed$ = function (r, height) {\n return DoubleRectangle_init(r.origin.x, r.origin.y, r.dimension.x, height);\n };\n GeometryUtil.prototype.changeHeightKeepBottom_j6cmed$ = function (r, height) {\n return DoubleRectangle_init(r.origin.x, r.bottom - height, r.dimension.x, height);\n };\n GeometryUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GeometryUtil',\n interfaces: []\n };\n var GeometryUtil_instance = null;\n function GeometryUtil_getInstance() {\n if (GeometryUtil_instance === null) {\n new GeometryUtil();\n }return GeometryUtil_instance;\n }\n function LegendBoxInfo(size) {\n LegendBoxInfo$Companion_getInstance();\n this.size_8be2vx$ = size;\n }\n Object.defineProperty(LegendBoxInfo.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n function LegendBoxInfo$Companion() {\n LegendBoxInfo$Companion_instance = this;\n this.EMPTY = new LegendBoxInfo$Companion$EMPTY$ObjectLiteral(DoubleVector.Companion.ZERO);\n }\n function LegendBoxInfo$Companion$EMPTY$ObjectLiteral(size) {\n LegendBoxInfo.call(this, size);\n }\n Object.defineProperty(LegendBoxInfo$Companion$EMPTY$ObjectLiteral.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n LegendBoxInfo$Companion$EMPTY$ObjectLiteral.prototype.createLegendBox = function () {\n throw IllegalStateException_init('Empty legend box info');\n };\n LegendBoxInfo$Companion$EMPTY$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [LegendBoxInfo]\n };\n LegendBoxInfo$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendBoxInfo$Companion_instance = null;\n function LegendBoxInfo$Companion_getInstance() {\n if (LegendBoxInfo$Companion_instance === null) {\n new LegendBoxInfo$Companion();\n }return LegendBoxInfo$Companion_instance;\n }\n LegendBoxInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBoxInfo',\n interfaces: []\n };\n function LegendBoxesLayout(myPlotBounds, myTheme) {\n this.myPlotBounds_0 = myPlotBounds;\n this.myTheme_0 = myTheme;\n }\n LegendBoxesLayout.prototype.doLayout_8sg693$ = function (infos) {\n var legendPosition = this.myTheme_0.position();\n var legendJustification = this.myTheme_0.justification();\n var legendArrangement = LegendArrangement$VERTICAL_getInstance();\n var plotCenter = this.myPlotBounds_0.center;\n var plotInnerBoundsWithoutLegendBoxes = this.myPlotBounds_0;\n var boxWithLocationList = legendArrangement === LegendArrangement$VERTICAL_getInstance() ? LegendBoxesLayoutUtil_getInstance().verticalStack_8sg693$(infos) : LegendBoxesLayoutUtil_getInstance().horizontalStack_8sg693$(infos);\n var boxesSize = LegendBoxesLayoutUtil_getInstance().size_9w4uif$(boxWithLocationList);\n if (equals(legendPosition, LegendPosition$Companion_getInstance().LEFT) || equals(legendPosition, LegendPosition$Companion_getInstance().RIGHT)) {\n var b = plotInnerBoundsWithoutLegendBoxes.width - boxesSize.x;\n var plotWidth = JsMath.max(0.0, b);\n if (equals(legendPosition, LegendPosition$Companion_getInstance().LEFT)) {\n plotInnerBoundsWithoutLegendBoxes = GeometryUtil_getInstance().changeWidthKeepRight_j6cmed$(plotInnerBoundsWithoutLegendBoxes, plotWidth);\n } else {\n plotInnerBoundsWithoutLegendBoxes = GeometryUtil_getInstance().changeWidth_j6cmed$(plotInnerBoundsWithoutLegendBoxes, plotWidth);\n }\n } else if (equals(legendPosition, LegendPosition$Companion_getInstance().TOP) || equals(legendPosition, LegendPosition$Companion_getInstance().BOTTOM)) {\n var b_0 = plotInnerBoundsWithoutLegendBoxes.height - boxesSize.y;\n var plotHeight = JsMath.max(0.0, b_0);\n if (equals(legendPosition, LegendPosition$Companion_getInstance().TOP)) {\n plotInnerBoundsWithoutLegendBoxes = GeometryUtil_getInstance().changeHeightKeepBottom_j6cmed$(plotInnerBoundsWithoutLegendBoxes, plotHeight);\n } else {\n plotInnerBoundsWithoutLegendBoxes = GeometryUtil_getInstance().changeHeight_j6cmed$(plotInnerBoundsWithoutLegendBoxes, plotHeight);\n }\n }var legendOrigin;\n if (equals(legendPosition, LegendPosition$Companion_getInstance().LEFT)) {\n legendOrigin = new DoubleVector(plotInnerBoundsWithoutLegendBoxes.left - boxesSize.x, plotCenter.y - boxesSize.y / 2);\n } else if (equals(legendPosition, LegendPosition$Companion_getInstance().RIGHT)) {\n legendOrigin = new DoubleVector(plotInnerBoundsWithoutLegendBoxes.right, plotCenter.y - boxesSize.y / 2);\n } else if (equals(legendPosition, LegendPosition$Companion_getInstance().TOP)) {\n legendOrigin = new DoubleVector(plotCenter.x - boxesSize.x / 2, plotInnerBoundsWithoutLegendBoxes.top - boxesSize.y);\n } else if (equals(legendPosition, LegendPosition$Companion_getInstance().BOTTOM)) {\n legendOrigin = new DoubleVector(plotCenter.x - boxesSize.x / 2, plotInnerBoundsWithoutLegendBoxes.bottom);\n } else {\n legendOrigin = LegendBoxesLayoutUtil_getInstance().overlayLegendOrigin_tmgej$(plotInnerBoundsWithoutLegendBoxes, boxesSize, legendPosition, legendJustification);\n }\n var resultBoxWithLocationList = LegendBoxesLayoutUtil_getInstance().moveAll_cpge3q$(legendOrigin, boxWithLocationList);\n return new LegendBoxesLayout$Result(plotInnerBoundsWithoutLegendBoxes, resultBoxWithLocationList);\n };\n function LegendBoxesLayout$Result(plotInnerBoundsWithoutLegendBoxes, locations) {\n this.plotInnerBoundsWithoutLegendBoxes = plotInnerBoundsWithoutLegendBoxes;\n this.boxWithLocationList = ArrayList_init_0(locations);\n }\n LegendBoxesLayout$Result.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Result',\n interfaces: []\n };\n function LegendBoxesLayout$BoxWithLocation(legendBox, location) {\n this.legendBox = legendBox;\n this.location = location;\n }\n LegendBoxesLayout$BoxWithLocation.prototype.size_8be2vx$ = function () {\n return this.legendBox.size_8be2vx$;\n };\n LegendBoxesLayout$BoxWithLocation.prototype.bounds_8be2vx$ = function () {\n return new DoubleRectangle(this.location, this.legendBox.size_8be2vx$);\n };\n LegendBoxesLayout$BoxWithLocation.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BoxWithLocation',\n interfaces: []\n };\n LegendBoxesLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBoxesLayout',\n interfaces: []\n };\n function LegendBoxesLayoutUtil() {\n LegendBoxesLayoutUtil_instance = this;\n }\n LegendBoxesLayoutUtil.prototype.verticalStack_8sg693$ = function (boxInfos) {\n var tmp$;\n var result = ArrayList_init();\n var y = 0.0;\n tmp$ = boxInfos.iterator();\n while (tmp$.hasNext()) {\n var info = tmp$.next();\n result.add_11rb$(new LegendBoxesLayout$BoxWithLocation(info, new DoubleVector(0.0, y)));\n y += info.size_8be2vx$.y;\n }\n return result;\n };\n LegendBoxesLayoutUtil.prototype.horizontalStack_8sg693$ = function (boxInfos) {\n var tmp$;\n var result = ArrayList_init();\n var x = 0.0;\n tmp$ = boxInfos.iterator();\n while (tmp$.hasNext()) {\n var info = tmp$.next();\n result.add_11rb$(new LegendBoxesLayout$BoxWithLocation(info, new DoubleVector(x, 0.0)));\n x += info.size_8be2vx$.x;\n }\n return result;\n };\n LegendBoxesLayoutUtil.prototype.moveAll_cpge3q$ = function (delta, boxWithLocationList) {\n var tmp$;\n var result = ArrayList_init();\n tmp$ = boxWithLocationList.iterator();\n while (tmp$.hasNext()) {\n var boxWithLocation = tmp$.next();\n result.add_11rb$(new LegendBoxesLayout$BoxWithLocation(boxWithLocation.legendBox, boxWithLocation.location.add_gpjtzr$(delta)));\n }\n return result;\n };\n LegendBoxesLayoutUtil.prototype.size_9w4uif$ = function (boxWithLocationList) {\n var tmp$, tmp$_0, tmp$_1;\n var bounds = null;\n tmp$ = boxWithLocationList.iterator();\n while (tmp$.hasNext()) {\n var boxWithLocation = tmp$.next();\n bounds = (tmp$_0 = bounds != null ? bounds.union_wthzt5$(boxWithLocation.bounds_8be2vx$()) : null) != null ? tmp$_0 : boxWithLocation.bounds_8be2vx$();\n }\n return (tmp$_1 = bounds != null ? bounds.dimension : null) != null ? tmp$_1 : DoubleVector.Companion.ZERO;\n };\n LegendBoxesLayoutUtil.prototype.overlayLegendOrigin_tmgej$ = function (plotBounds, legendSize, legendPosition, legendJustification) {\n var plotSize = plotBounds.dimension;\n var absolutePosition = new DoubleVector(plotBounds.left + plotSize.x * legendPosition.x, plotBounds.bottom - plotSize.y * legendPosition.y);\n var originOffset = new DoubleVector(-legendSize.x * legendJustification.x, legendSize.y * legendJustification.y - legendSize.y);\n return absolutePosition.add_gpjtzr$(originOffset);\n };\n LegendBoxesLayoutUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'LegendBoxesLayoutUtil',\n interfaces: []\n };\n var LegendBoxesLayoutUtil_instance = null;\n function LegendBoxesLayoutUtil_getInstance() {\n if (LegendBoxesLayoutUtil_instance === null) {\n new LegendBoxesLayoutUtil();\n }return LegendBoxesLayoutUtil_instance;\n }\n function LiveMapTileLayout() {\n }\n LiveMapTileLayout.prototype.doLayout_gpjtzr$ = function (preferredSize) {\n var geomBounds = XYPlotLayoutUtil_getInstance().geomBounds_pym7oz$(0.0, 0.0, preferredSize);\n geomBounds = geomBounds.union_wthzt5$(new DoubleRectangle(geomBounds.origin, XYPlotLayoutUtil_getInstance().GEOM_MIN_SIZE));\n var geomWithAxisBounds = geomBounds;\n return TileLayoutInfo_init(geomWithAxisBounds, geomBounds, XYPlotLayoutUtil_getInstance().clipBounds_wthzt5$(geomBounds), null, null, void 0, void 0, 0);\n };\n LiveMapTileLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LiveMapTileLayout',\n interfaces: [TileLayout]\n };\n function PlotAxisLayout(scale, domainX, domainY, coordProvider, theme, orientation) {\n PlotAxisLayout$Companion_getInstance();\n this.scale_0 = scale;\n this.domainX_0 = domainX;\n this.domainY_0 = domainY;\n this.coordProvider_0 = coordProvider;\n this.theme_0 = theme;\n this.orientation_0 = orientation;\n }\n PlotAxisLayout.prototype.initialThickness = function () {\n var tmp$;\n if (this.theme_0.showTickMarks() || this.theme_0.showTickLabels()) {\n var v = this.theme_0.tickLabelDistance();\n if (this.theme_0.showTickLabels()) {\n tmp$ = v + PlotAxisLayout$Companion_getInstance().initialTickLabelSize_0(this.orientation_0);\n } else {\n tmp$ = v;\n }\n return tmp$;\n }return 0.0;\n };\n PlotAxisLayout.prototype.doLayout_o2m17x$ = function (displaySize, maxTickLabelsBoundsStretched) {\n var layouter = this.createLayouter_0(displaySize);\n return layouter.doLayout_p1d3jc$(PlotAxisLayout$Companion_getInstance().axisLength_0(displaySize, this.orientation_0), maxTickLabelsBoundsStretched);\n };\n PlotAxisLayout.prototype.createLayouter_0 = function (displaySize) {\n var domains = this.coordProvider_0.adjustDomains_jz8wgn$(this.domainX_0, this.domainY_0, displaySize);\n var axisDomain = PlotAxisLayout$Companion_getInstance().axisDomain_0(domains, this.orientation_0);\n var breaksProvider = AxisBreaksUtil_getInstance().createAxisBreaksProvider_oftday$(this.scale_0, axisDomain);\n return AxisLayouter$Companion_getInstance().create_4ebi60$(this.orientation_0, axisDomain, breaksProvider, this.theme_0);\n };\n function PlotAxisLayout$Companion() {\n PlotAxisLayout$Companion_instance = this;\n this.TICK_LABEL_SPEC_0 = PlotLabelSpec$AXIS_TICK_getInstance();\n }\n PlotAxisLayout$Companion.prototype.bottom_eknalg$ = function (scale, xDomain, yDomain, coordProvider, theme) {\n return new PlotAxisLayout(scale, xDomain, yDomain, coordProvider, theme, Orientation$BOTTOM_getInstance());\n };\n PlotAxisLayout$Companion.prototype.left_eknalg$ = function (scale, xDomain, yDomain, coordProvider, theme) {\n return new PlotAxisLayout(scale, xDomain, yDomain, coordProvider, theme, Orientation$LEFT_getInstance());\n };\n PlotAxisLayout$Companion.prototype.initialTickLabelSize_0 = function (orientation) {\n return orientation.isHorizontal ? this.TICK_LABEL_SPEC_0.height() : this.TICK_LABEL_SPEC_0.width_za3lpa$(1);\n };\n PlotAxisLayout$Companion.prototype.axisLength_0 = function (displaySize, orientation) {\n return orientation.isHorizontal ? displaySize.x : displaySize.y;\n };\n PlotAxisLayout$Companion.prototype.axisDomain_0 = function (xyDomains, orientation) {\n return orientation.isHorizontal ? xyDomains.first : xyDomains.second;\n };\n PlotAxisLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PlotAxisLayout$Companion_instance = null;\n function PlotAxisLayout$Companion_getInstance() {\n if (PlotAxisLayout$Companion_instance === null) {\n new PlotAxisLayout$Companion();\n }return PlotAxisLayout$Companion_instance;\n }\n PlotAxisLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotAxisLayout',\n interfaces: [AxisLayout]\n };\n function PlotLayout() {\n }\n PlotLayout.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PlotLayout',\n interfaces: []\n };\n function PlotLayoutBase() {\n this.paddingTop_72hspu$_0 = 0.0;\n this.paddingRight_oc6xpz$_0 = 0.0;\n this.paddingBottom_phgrg6$_0 = 0.0;\n this.paddingLeft_66kgx2$_0 = 0.0;\n }\n Object.defineProperty(PlotLayoutBase.prototype, 'paddingTop_0', {\n configurable: true,\n get: function () {\n return this.paddingTop_72hspu$_0;\n },\n set: function (paddingTop) {\n this.paddingTop_72hspu$_0 = paddingTop;\n }\n });\n Object.defineProperty(PlotLayoutBase.prototype, 'paddingRight_0', {\n configurable: true,\n get: function () {\n return this.paddingRight_oc6xpz$_0;\n },\n set: function (paddingRight) {\n this.paddingRight_oc6xpz$_0 = paddingRight;\n }\n });\n Object.defineProperty(PlotLayoutBase.prototype, 'paddingBottom_0', {\n configurable: true,\n get: function () {\n return this.paddingBottom_phgrg6$_0;\n },\n set: function (paddingBottom) {\n this.paddingBottom_phgrg6$_0 = paddingBottom;\n }\n });\n Object.defineProperty(PlotLayoutBase.prototype, 'paddingLeft_0', {\n configurable: true,\n get: function () {\n return this.paddingLeft_66kgx2$_0;\n },\n set: function (paddingLeft) {\n this.paddingLeft_66kgx2$_0 = paddingLeft;\n }\n });\n PlotLayoutBase.prototype.setPadding_6y0v78$ = function (top, right, bottom, left) {\n this.paddingTop_0 = top;\n this.paddingRight_0 = right;\n this.paddingBottom_0 = bottom;\n this.paddingLeft_0 = left;\n };\n PlotLayoutBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotLayoutBase',\n interfaces: [PlotLayout]\n };\n function PlotLayoutInfo(tiles, size) {\n this.size = size;\n this.tiles = ArrayList_init_0(tiles);\n }\n PlotLayoutInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotLayoutInfo',\n interfaces: []\n };\n function PlotLayoutUtil() {\n PlotLayoutUtil_instance = this;\n this.AXIS_TITLE_OUTER_MARGIN = 4.0;\n this.AXIS_TITLE_INNER_MARGIN = 4.0;\n this.TITLE_V_MARGIN_0 = 4.0;\n this.LIVE_MAP_PLOT_PADDING_0 = new DoubleVector(10.0, 0.0);\n this.LIVE_MAP_PLOT_MARGIN_0 = new DoubleVector(10.0, 10.0);\n }\n PlotLayoutUtil.prototype.titleDimensions_61zpoe$ = function (text) {\n if (base.Strings.isNullOrEmpty_pdl1vj$(text)) {\n return DoubleVector.Companion.ZERO;\n }var labelSpec = PlotLabelSpec$PLOT_TITLE_getInstance();\n return new DoubleVector(labelSpec.width_za3lpa$(text.length), labelSpec.height() + 2 * this.TITLE_V_MARGIN_0);\n };\n PlotLayoutUtil.prototype.axisTitleDimensions_61zpoe$ = function (text) {\n if (base.Strings.isNullOrEmpty_pdl1vj$(text)) {\n return DoubleVector.Companion.ZERO;\n }var labelSpec = PlotLabelSpec$AXIS_TITLE_getInstance();\n return new DoubleVector(labelSpec.width_za3lpa$(text.length), labelSpec.height());\n };\n PlotLayoutUtil.prototype.absoluteGeomBounds_vjhcds$ = function (origin, plotLayoutInfo) {\n var tmp$, tmp$_0;\n if (!!plotLayoutInfo.tiles.isEmpty()) {\n var message = 'Plot is empty';\n throw IllegalArgumentException_init(message.toString());\n }var result = null;\n tmp$ = plotLayoutInfo.tiles.iterator();\n while (tmp$.hasNext()) {\n var tile = tmp$.next();\n var geomBounds = tile.getAbsoluteGeomBounds_gpjtzr$(origin);\n result = (tmp$_0 = result != null ? result.union_wthzt5$(geomBounds) : null) != null ? tmp$_0 : geomBounds;\n }\n return ensureNotNull(result);\n };\n PlotLayoutUtil.prototype.liveMapBounds_wthzt5$ = function (container) {\n return new DoubleRectangle(container.origin.add_gpjtzr$(this.LIVE_MAP_PLOT_PADDING_0), container.dimension.subtract_gpjtzr$(this.LIVE_MAP_PLOT_MARGIN_0));\n };\n PlotLayoutUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PlotLayoutUtil',\n interfaces: []\n };\n var PlotLayoutUtil_instance = null;\n function PlotLayoutUtil_getInstance() {\n if (PlotLayoutUtil_instance === null) {\n new PlotLayoutUtil();\n }return PlotLayoutUtil_instance;\n }\n function SingleTilePlotLayout(myTileLayout) {\n PlotLayoutBase.call(this);\n this.myTileLayout_0 = myTileLayout;\n this.setPadding_6y0v78$(10.0, 10.0, 0.0, 0.0);\n }\n SingleTilePlotLayout.prototype.doLayout_gpjtzr$ = function (preferredSize) {\n var tilePreferredSize = new DoubleVector(preferredSize.x - (this.paddingLeft_0 + this.paddingRight_0), preferredSize.y - (this.paddingTop_0 + this.paddingBottom_0));\n var tileInfo = this.myTileLayout_0.doLayout_gpjtzr$(tilePreferredSize);\n tileInfo = tileInfo.withOffset_gpjtzr$(new DoubleVector(this.paddingLeft_0, this.paddingTop_0));\n var plotSize = tileInfo.bounds.dimension;\n plotSize = plotSize.add_gpjtzr$(new DoubleVector(this.paddingRight_0, this.paddingBottom_0));\n return new PlotLayoutInfo(listOf(tileInfo), plotSize);\n };\n SingleTilePlotLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SingleTilePlotLayout',\n interfaces: [PlotLayoutBase]\n };\n function TileLayout() {\n }\n TileLayout.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'TileLayout',\n interfaces: []\n };\n function TileLayoutInfo(plotOrigin, bounds, geomBounds, clipBounds, xAxisInfo, yAxisInfo, xAxisShown, yAxisShown, facetXLabels, facetYLabel, trueIndex) {\n this.plotOrigin = plotOrigin;\n this.bounds = bounds;\n this.geomBounds = geomBounds;\n this.clipBounds = clipBounds;\n this.xAxisInfo = xAxisInfo;\n this.yAxisInfo = yAxisInfo;\n this.facetXLabels = facetXLabels;\n this.facetYLabel = facetYLabel;\n this.trueIndex = trueIndex;\n this.xAxisShown = (this.xAxisInfo != null && xAxisShown);\n this.yAxisShown = (this.yAxisInfo != null && yAxisShown);\n }\n TileLayoutInfo.prototype.withOffset_gpjtzr$ = function (offset) {\n return new TileLayoutInfo(offset, this.bounds, this.geomBounds, this.clipBounds, this.xAxisInfo, this.yAxisInfo, this.xAxisShown, this.yAxisShown, this.facetXLabels, this.facetYLabel, this.trueIndex);\n };\n TileLayoutInfo.prototype.getAbsoluteBounds_gpjtzr$ = function (tilesOrigin) {\n var offset = tilesOrigin.add_gpjtzr$(this.plotOrigin);\n return this.bounds.add_gpjtzr$(offset);\n };\n TileLayoutInfo.prototype.getAbsoluteGeomBounds_gpjtzr$ = function (tilesOrigin) {\n var offset = tilesOrigin.add_gpjtzr$(this.plotOrigin);\n return this.geomBounds.add_gpjtzr$(offset);\n };\n TileLayoutInfo.prototype.withFacetLabels_5hkr16$ = function (xLabels, yLabel) {\n return new TileLayoutInfo(this.plotOrigin, this.bounds, this.geomBounds, this.clipBounds, this.xAxisInfo, this.yAxisInfo, this.xAxisShown, this.yAxisShown, xLabels, yLabel, this.trueIndex);\n };\n TileLayoutInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TileLayoutInfo',\n interfaces: []\n };\n function TileLayoutInfo_init(bounds, geomBounds, clipBounds, xAxisInfo, yAxisInfo, xAxisShown, yAxisShown, trueIndex, $this) {\n if (xAxisShown === void 0)\n xAxisShown = true;\n if (yAxisShown === void 0)\n yAxisShown = true;\n $this = $this || Object.create(TileLayoutInfo.prototype);\n TileLayoutInfo.call($this, DoubleVector.Companion.ZERO, bounds, geomBounds, clipBounds, xAxisInfo, yAxisInfo, xAxisShown, yAxisShown, emptyList(), null, trueIndex);\n return $this;\n }\n function XYPlotLayoutUtil() {\n XYPlotLayoutUtil_instance = this;\n this.GEOM_MARGIN = 0.0;\n this.CLIP_EXTEND_0 = 5.0;\n this.GEOM_MIN_SIZE = new DoubleVector(50.0, 50.0);\n }\n XYPlotLayoutUtil.prototype.geomBounds_pym7oz$ = function (xAxisThickness, yAxisThickness, plotSize) {\n var marginLeftTop = new DoubleVector(yAxisThickness, this.GEOM_MARGIN);\n var marginRightBottom = new DoubleVector(this.GEOM_MARGIN, xAxisThickness);\n var geomSize = plotSize.subtract_gpjtzr$(marginLeftTop).subtract_gpjtzr$(marginRightBottom);\n if (geomSize.x < this.GEOM_MIN_SIZE.x) {\n geomSize = new DoubleVector(this.GEOM_MIN_SIZE.x, geomSize.y);\n }if (geomSize.y < this.GEOM_MIN_SIZE.y) {\n geomSize = new DoubleVector(geomSize.x, this.GEOM_MIN_SIZE.y);\n }return new DoubleRectangle(marginLeftTop, geomSize);\n };\n XYPlotLayoutUtil.prototype.clipBounds_wthzt5$ = function (geomBounds) {\n return new DoubleRectangle(geomBounds.origin.subtract_gpjtzr$(new DoubleVector(this.CLIP_EXTEND_0, this.CLIP_EXTEND_0)), new DoubleVector(geomBounds.dimension.x + 2 * this.CLIP_EXTEND_0, geomBounds.dimension.y + 2 * this.CLIP_EXTEND_0));\n };\n XYPlotLayoutUtil.prototype.maxTickLabelsBounds_m3y558$ = function (axisOrientation, stretch, geomBounds, plotSize) {\n var tmp$;\n var geomPaddung = 10.0;\n var maxGeomBounds = DoubleRectangle_init(geomPaddung, geomPaddung, plotSize.x - 2 * geomPaddung, plotSize.y - 2 * geomPaddung);\n switch (axisOrientation.name) {\n case 'TOP':\n case 'BOTTOM':\n var leftSpace = geomBounds.left - maxGeomBounds.left + stretch;\n var rightSpace = maxGeomBounds.right - geomBounds.right + stretch;\n var height = 1.0E42;\n if (equals(axisOrientation, Orientation$TOP_getInstance()))\n tmp$ = -height;\n else\n tmp$ = 0.0;\n var top = tmp$;\n var left = -leftSpace;\n var width = leftSpace + rightSpace + geomBounds.width;\n return DoubleRectangle_init(left, top, width, height);\n default:throw IllegalArgumentException_init('Orientation not supported: ' + axisOrientation);\n }\n };\n XYPlotLayoutUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'XYPlotLayoutUtil',\n interfaces: []\n };\n var XYPlotLayoutUtil_instance = null;\n function XYPlotLayoutUtil_getInstance() {\n if (XYPlotLayoutUtil_instance === null) {\n new XYPlotLayoutUtil();\n }return XYPlotLayoutUtil_instance;\n }\n function XYPlotTileLayout(xAxisLayout, yAxisLayout) {\n XYPlotTileLayout$Companion_getInstance();\n this.xAxisLayout_0 = xAxisLayout;\n this.yAxisLayout_0 = yAxisLayout;\n }\n XYPlotTileLayout.prototype.doLayout_gpjtzr$ = function (preferredSize) {\n var tmp$ = XYPlotTileLayout$Companion_getInstance().computeAxisInfos_0(this.xAxisLayout_0, this.yAxisLayout_0, preferredSize);\n var xAxisInfo = {v: tmp$.component1()}\n , yAxisInfo = tmp$.component2();\n var geomBounds = {v: XYPlotLayoutUtil_getInstance().geomBounds_pym7oz$(xAxisInfo.v.axisBounds().dimension.y, yAxisInfo.axisBounds().dimension.x, preferredSize)};\n var maxTickLabelsBounds = XYPlotLayoutUtil_getInstance().maxTickLabelsBounds_m3y558$(Orientation$BOTTOM_getInstance(), 0.0, geomBounds.v, preferredSize);\n var tickLabelsBounds = xAxisInfo.v.tickLabelsBounds;\n var leftOverflow = maxTickLabelsBounds.left - ensureNotNull(tickLabelsBounds).origin.x;\n var rightOverflow = tickLabelsBounds.origin.x + tickLabelsBounds.dimension.x - maxTickLabelsBounds.right;\n if (leftOverflow > 0) {\n geomBounds.v = DoubleRectangle_init(geomBounds.v.origin.x + leftOverflow, geomBounds.v.origin.y, geomBounds.v.dimension.x - leftOverflow, geomBounds.v.dimension.y);\n }if (rightOverflow > 0) {\n geomBounds.v = DoubleRectangle_init(geomBounds.v.origin.x, geomBounds.v.origin.y, geomBounds.v.dimension.x - rightOverflow, geomBounds.v.dimension.y);\n }geomBounds.v = geomBounds.v.union_wthzt5$(new DoubleRectangle(geomBounds.v.origin, XYPlotLayoutUtil_getInstance().GEOM_MIN_SIZE));\n var geomWithAxisBounds = XYPlotTileLayout$Companion_getInstance().tileBounds_0(xAxisInfo.v.axisBounds(), yAxisInfo.axisBounds(), geomBounds.v);\n xAxisInfo.v = xAxisInfo.v.withAxisLength_14dthe$(geomBounds.v.width).build();\n yAxisInfo = yAxisInfo.withAxisLength_14dthe$(geomBounds.v.height).build();\n return TileLayoutInfo_init(geomWithAxisBounds, geomBounds.v, XYPlotLayoutUtil_getInstance().clipBounds_wthzt5$(geomBounds.v), xAxisInfo.v, yAxisInfo, void 0, void 0, 0);\n };\n function XYPlotTileLayout$Companion() {\n XYPlotTileLayout$Companion_instance = this;\n this.AXIS_STRETCH_RATIO_0 = 0.1;\n }\n XYPlotTileLayout$Companion.prototype.tileBounds_0 = function (xAxisBounds, yAxisBounds, geomBounds) {\n var leftTop = new DoubleVector(geomBounds.left - yAxisBounds.width, geomBounds.top - XYPlotLayoutUtil_getInstance().GEOM_MARGIN);\n var rightBottom = new DoubleVector(geomBounds.right + XYPlotLayoutUtil_getInstance().GEOM_MARGIN, geomBounds.bottom + xAxisBounds.height);\n return new DoubleRectangle(leftTop, rightBottom.subtract_gpjtzr$(leftTop));\n };\n XYPlotTileLayout$Companion.prototype.computeAxisInfos_0 = function (xAxisLayout, yAxisLayout, plotSize) {\n var xAxisThickness = xAxisLayout.initialThickness();\n var yAxisInfo = this.computeYAxisInfo_0(yAxisLayout, XYPlotLayoutUtil_getInstance().geomBounds_pym7oz$(xAxisThickness, yAxisLayout.initialThickness(), plotSize));\n var yAxisThickness = yAxisInfo.axisBounds().dimension.x;\n var xAxisInfo = this.computeXAxisInfo_0(xAxisLayout, plotSize, XYPlotLayoutUtil_getInstance().geomBounds_pym7oz$(xAxisThickness, yAxisThickness, plotSize));\n if (xAxisInfo.axisBounds().dimension.y > xAxisThickness) {\n yAxisInfo = this.computeYAxisInfo_0(yAxisLayout, XYPlotLayoutUtil_getInstance().geomBounds_pym7oz$(xAxisInfo.axisBounds().dimension.y, yAxisThickness, plotSize));\n }return new Pair_0(xAxisInfo, yAxisInfo);\n };\n XYPlotTileLayout$Companion.prototype.computeXAxisInfo_0 = function (axisLayout, plotSize, geomBounds) {\n var axisLength = geomBounds.dimension.x;\n var stretch = axisLength * this.AXIS_STRETCH_RATIO_0;\n var maxTickLabelsBounds = XYPlotLayoutUtil_getInstance().maxTickLabelsBounds_m3y558$(Orientation$BOTTOM_getInstance(), stretch, geomBounds, plotSize);\n return axisLayout.doLayout_o2m17x$(geomBounds.dimension, maxTickLabelsBounds);\n };\n XYPlotTileLayout$Companion.prototype.computeYAxisInfo_0 = function (axisLayout, geomBounds) {\n return axisLayout.doLayout_o2m17x$(geomBounds.dimension, null);\n };\n XYPlotTileLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var XYPlotTileLayout$Companion_instance = null;\n function XYPlotTileLayout$Companion_getInstance() {\n if (XYPlotTileLayout$Companion_instance === null) {\n new XYPlotTileLayout$Companion();\n }return XYPlotTileLayout$Companion_instance;\n }\n XYPlotTileLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'XYPlotTileLayout',\n interfaces: [TileLayout]\n };\n function AdaptableAxisBreaksProvider(domainAfterTransform, breaksGenerator) {\n this.domainAfterTransform_0 = domainAfterTransform;\n this.breaksGenerator_0 = breaksGenerator;\n }\n Object.defineProperty(AdaptableAxisBreaksProvider.prototype, 'isFixedBreaks', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(AdaptableAxisBreaksProvider.prototype, 'fixedBreaks', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Not a fixed breaks provider');\n }\n });\n AdaptableAxisBreaksProvider.prototype.getBreaks_5wr77w$ = function (targetCount, axisLength) {\n var scaleBreaks = this.breaksGenerator_0.generateBreaks_1tlvto$(this.domainAfterTransform_0, targetCount);\n return new GuideBreaks(scaleBreaks.domainValues, scaleBreaks.transformValues, scaleBreaks.labels);\n };\n AdaptableAxisBreaksProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AdaptableAxisBreaksProvider',\n interfaces: [AxisBreaksProvider]\n };\n function AxisBreaksProvider() {\n }\n AxisBreaksProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'AxisBreaksProvider',\n interfaces: []\n };\n function AxisBreaksUtil() {\n AxisBreaksUtil_instance = this;\n }\n AxisBreaksUtil.prototype.createAxisBreaksProvider_oftday$ = function (scale_0, axisDomain) {\n if (scale_0.hasBreaks())\n return new FixedAxisBreaksProvider(scale_0.breaks, scale.ScaleUtil.breaksTransformed_x4zrm4$(scale_0), scale.ScaleUtil.labels_x4zrm4$(scale_0));\n else\n return new AdaptableAxisBreaksProvider(axisDomain, scale_0.breaksGenerator);\n };\n AxisBreaksUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'AxisBreaksUtil',\n interfaces: []\n };\n var AxisBreaksUtil_instance = null;\n function AxisBreaksUtil_getInstance() {\n if (AxisBreaksUtil_instance === null) {\n new AxisBreaksUtil();\n }return AxisBreaksUtil_instance;\n }\n function AxisLayouter(orientation, domainRange, labelsLayout) {\n AxisLayouter$Companion_getInstance();\n this.orientation = orientation;\n this.domainRange = domainRange;\n this.labelsLayout = labelsLayout;\n }\n AxisLayouter.prototype.doLayout_p1d3jc$ = function (axisLength, maxTickLabelsBounds) {\n var labelsInfo = this.labelsLayout.doLayout_s0wrr0$(axisLength, this.toAxisMapper_14dthe$(axisLength), maxTickLabelsBounds);\n var labelsBounds = labelsInfo.bounds;\n var builder = (new AxisLayoutInfo$Builder()).axisBreaks_bysjzy$(labelsInfo.breaks).axisLength_14dthe$(axisLength).orientation_9y97dg$(this.orientation).axisDomain_4fzjta$(this.domainRange).tickLabelsBoundsMax_myx2hi$(maxTickLabelsBounds).tickLabelSmallFont_6taknv$(labelsInfo.smallFont).tickLabelAdditionalOffsets_eajcfd$(labelsInfo.labelAdditionalOffsets).tickLabelHorizontalAnchor_tk0ev1$(labelsInfo.labelHorizontalAnchor).tickLabelVerticalAnchor_24j3ht$(labelsInfo.labelVerticalAnchor).tickLabelRotationAngle_14dthe$(labelsInfo.labelRotationAngle).tickLabelsBounds_myx2hi$(labelsBounds);\n return builder.build();\n };\n AxisLayouter.prototype.toScaleMapper_14dthe$ = function (axisLength) {\n return scale.Mappers.mul_mdyssk$(this.domainRange, axisLength);\n };\n function AxisLayouter$Companion() {\n AxisLayouter$Companion_instance = this;\n }\n AxisLayouter$Companion.prototype.create_4ebi60$ = function (orientation, axisDomain, breaksProvider, theme) {\n if (orientation.isHorizontal) {\n var labelsLayout;\n if (breaksProvider.isFixedBreaks) {\n labelsLayout = AxisLabelsLayout$Companion_getInstance().horizontalFixedBreaks_rldrnc$(orientation, axisDomain, breaksProvider.fixedBreaks, theme);\n } else {\n labelsLayout = AxisLabelsLayout$Companion_getInstance().horizontalFlexBreaks_4ebi60$(orientation, axisDomain, breaksProvider, theme);\n }\n return new HorizontalAxisLayouter(orientation, axisDomain, labelsLayout);\n }var labelsLayout_0;\n if (breaksProvider.isFixedBreaks) {\n labelsLayout_0 = AxisLabelsLayout$Companion_getInstance().verticalFixedBreaks_rldrnc$(orientation, axisDomain, breaksProvider.fixedBreaks, theme);\n } else {\n labelsLayout_0 = AxisLabelsLayout$Companion_getInstance().verticalFlexBreaks_4ebi60$(orientation, axisDomain, breaksProvider, theme);\n }\n return new VerticalAxisLayouter(orientation, axisDomain, labelsLayout_0);\n };\n AxisLayouter$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AxisLayouter$Companion_instance = null;\n function AxisLayouter$Companion_getInstance() {\n if (AxisLayouter$Companion_instance === null) {\n new AxisLayouter$Companion();\n }return AxisLayouter$Companion_instance;\n }\n AxisLayouter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AxisLayouter',\n interfaces: []\n };\n function FixedAxisBreaksProvider(domainBreaks, transformedBreaks, labels) {\n this.fixedBreaks_cixykn$_0 = new GuideBreaks(domainBreaks, transformedBreaks, labels);\n }\n Object.defineProperty(FixedAxisBreaksProvider.prototype, 'fixedBreaks', {\n configurable: true,\n get: function () {\n return this.fixedBreaks_cixykn$_0;\n }\n });\n Object.defineProperty(FixedAxisBreaksProvider.prototype, 'isFixedBreaks', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n FixedAxisBreaksProvider.prototype.getBreaks_5wr77w$ = function (targetCount, axisLength) {\n return this.fixedBreaks;\n };\n FixedAxisBreaksProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FixedAxisBreaksProvider',\n interfaces: [AxisBreaksProvider]\n };\n function GuideBreaks(domainValues, transformedValues, labels) {\n this.domainValues = null;\n this.transformedValues = null;\n this.labels = null;\n if (!(domainValues.size === transformedValues.size)) {\n var message = 'Scale breaks size: ' + toString(domainValues.size) + ' transformed size: ' + toString(transformedValues.size) + ' but expected to be the same';\n throw IllegalArgumentException_init(message.toString());\n }if (!(domainValues.size === labels.size)) {\n var message_0 = 'Scale breaks size: ' + toString(domainValues.size) + ' labels size: ' + toString(labels.size) + ' but expected to be the same';\n throw IllegalArgumentException_init(message_0.toString());\n }this.domainValues = ArrayList_init_0(domainValues);\n this.transformedValues = ArrayList_init_0(transformedValues);\n this.labels = ArrayList_init_0(labels);\n }\n Object.defineProperty(GuideBreaks.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.transformedValues.isEmpty();\n }\n });\n GuideBreaks.prototype.size = function () {\n return this.transformedValues.size;\n };\n GuideBreaks.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GuideBreaks',\n interfaces: []\n };\n function HorizontalAxisLayouter(orientation, domainRange, labelsLayout) {\n AxisLayouter.call(this, orientation, domainRange, labelsLayout);\n }\n function HorizontalAxisLayouter$toAxisMapper$lambda(closure$scaleMapper, closure$cartesianX) {\n return function (v) {\n var mapped = closure$scaleMapper(v);\n return mapped != null ? closure$cartesianX(mapped) : null;\n };\n }\n HorizontalAxisLayouter.prototype.toAxisMapper_14dthe$ = function (axisLength) {\n var scaleMapper = this.toScaleMapper_14dthe$(axisLength);\n var cartesianX = coord.Coords.toClientOffsetX_4fzjta$(new ClosedRange(0.0, axisLength));\n return HorizontalAxisLayouter$toAxisMapper$lambda(scaleMapper, cartesianX);\n };\n HorizontalAxisLayouter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalAxisLayouter',\n interfaces: [AxisLayouter]\n };\n function VerticalAxisLayouter(orientation, domainRange, labelsLayout) {\n AxisLayouter.call(this, orientation, domainRange, labelsLayout);\n }\n function VerticalAxisLayouter$toAxisMapper$lambda(closure$scaleMapper, closure$cartesianY) {\n return function (v) {\n var mapped = closure$scaleMapper(v);\n return mapped != null ? closure$cartesianY(mapped) : null;\n };\n }\n VerticalAxisLayouter.prototype.toAxisMapper_14dthe$ = function (axisLength) {\n var scaleMapper = this.toScaleMapper_14dthe$(axisLength);\n var cartesianY = coord.Coords.toClientOffsetY_4fzjta$(new ClosedRange(0.0, axisLength));\n return VerticalAxisLayouter$toAxisMapper$lambda(scaleMapper, cartesianY);\n };\n VerticalAxisLayouter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalAxisLayouter',\n interfaces: [AxisLayouter]\n };\n function AbstractFixedBreaksLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme) {\n AbstractFixedBreaksLabelsLayout$Companion_getInstance();\n AxisLabelsLayout.call(this, orientation, axisDomain, labelSpec, theme);\n this.breaks_0 = breaks;\n }\n AbstractFixedBreaksLabelsLayout.prototype.labelBounds_0 = function (labelLocation, labelLength) {\n var dim = this.labelSpec.dimensions_za3lpa$(labelLength);\n var labelBounds = this.labelBounds_gpjtzr$(dim);\n return labelBounds.add_gpjtzr$(labelLocation);\n };\n AbstractFixedBreaksLabelsLayout.prototype.labelsBounds_c3fefx$ = function (tickPositions, tickLabels, toTickLocation) {\n var tmp$;\n var boundsList = this.labelBoundsList_c3fefx$(tickPositions, this.breaks_0.labels, toTickLocation);\n var bounds = null;\n tmp$ = boundsList.iterator();\n while (tmp$.hasNext()) {\n var labelBounds = tmp$.next();\n bounds = GeometryUtil_getInstance().union_te9coj$(labelBounds, bounds);\n }\n return bounds;\n };\n AbstractFixedBreaksLabelsLayout.prototype.labelBoundsList_c3fefx$ = function (tickPositions, tickLabels, toTickLocation) {\n var tmp$;\n var result = ArrayList_init();\n var labels = tickLabels.iterator();\n tmp$ = tickPositions.iterator();\n while (tmp$.hasNext()) {\n var pos = tmp$.next();\n var label = labels.next();\n var bounds = this.labelBounds_0(toTickLocation(pos), label.length);\n result.add_11rb$(bounds);\n }\n return result;\n };\n AbstractFixedBreaksLabelsLayout.prototype.createAxisLabelsLayoutInfoBuilder_fd842m$ = function (bounds, overlap) {\n return (new AxisLabelsLayoutInfo$Builder()).breaks_buc0yr$(this.breaks_0).bounds_wthzt5$(this.applyLabelsOffset_w7e9pi$(bounds)).smallFont_6taknv$(false).overlap_6taknv$(overlap);\n };\n AbstractFixedBreaksLabelsLayout.prototype.noLabelsLayoutInfo_c0p8fa$ = function (axisLength, orientation) {\n if (orientation.isHorizontal) {\n var bounds = DoubleRectangle_init(axisLength / 2, 0.0, 0.0, 0.0);\n bounds = this.applyLabelsOffset_w7e9pi$(bounds);\n return (new AxisLabelsLayoutInfo$Builder()).breaks_buc0yr$(this.breaks_0).bounds_wthzt5$(bounds).smallFont_6taknv$(false).overlap_6taknv$(false).labelAdditionalOffsets_eajcfd$(null).labelHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE).labelVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.TOP).build();\n }throw IllegalStateException_init('Not implemented for ' + orientation);\n };\n function AbstractFixedBreaksLabelsLayout$Companion() {\n AbstractFixedBreaksLabelsLayout$Companion_instance = this;\n this.HORIZONTAL_TICK_LOCATION = AbstractFixedBreaksLabelsLayout$Companion$HORIZONTAL_TICK_LOCATION$lambda;\n }\n function AbstractFixedBreaksLabelsLayout$Companion$HORIZONTAL_TICK_LOCATION$lambda(x) {\n return new DoubleVector(x, 0.0);\n }\n AbstractFixedBreaksLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AbstractFixedBreaksLabelsLayout$Companion_instance = null;\n function AbstractFixedBreaksLabelsLayout$Companion_getInstance() {\n if (AbstractFixedBreaksLabelsLayout$Companion_instance === null) {\n new AbstractFixedBreaksLabelsLayout$Companion();\n }return AbstractFixedBreaksLabelsLayout$Companion_instance;\n }\n AbstractFixedBreaksLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractFixedBreaksLabelsLayout',\n interfaces: [AxisLabelsLayout]\n };\n function AxisLabelsLayout(orientation, axisDomain, labelSpec, theme) {\n AxisLabelsLayout$Companion_getInstance();\n this.orientation = orientation;\n this.axisDomain = axisDomain;\n this.labelSpec = labelSpec;\n this.theme = theme;\n }\n Object.defineProperty(AxisLabelsLayout.prototype, 'isHorizontal', {\n configurable: true,\n get: function () {\n return this.orientation.isHorizontal;\n }\n });\n AxisLabelsLayout.prototype.mapToAxis_d2cc22$ = function (breaks, axisMapper) {\n return BreakLabelsLayoutUtil_getInstance().mapToAxis_lhkzxb$(breaks, this.axisDomain, axisMapper);\n };\n AxisLabelsLayout.prototype.applyLabelsOffset_w7e9pi$ = function (labelsBounds) {\n return BreakLabelsLayoutUtil_getInstance().applyLabelsOffset_tsgpmr$(labelsBounds, this.theme.tickLabelDistance(), this.orientation);\n };\n function AxisLabelsLayout$Companion() {\n AxisLabelsLayout$Companion_instance = this;\n this.TICK_LABEL_SPEC = PlotLabelSpec$AXIS_TICK_getInstance();\n this.INITIAL_TICK_LABEL_LENGTH = 4;\n this.MIN_TICK_LABEL_DISTANCE = 20.0;\n this.TICK_LABEL_SPEC_SMALL = PlotLabelSpec$AXIS_TICK_SMALL_getInstance();\n }\n AxisLabelsLayout$Companion.prototype.horizontalFlexBreaks_4ebi60$ = function (orientation, axisDomain, breaksProvider, theme) {\n if (!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }if (!!breaksProvider.isFixedBreaks) {\n var message_0 = 'fixed breaks';\n throw IllegalArgumentException_init(message_0.toString());\n }return new HorizontalFlexBreaksLabelsLayout(orientation, axisDomain, this.TICK_LABEL_SPEC, breaksProvider, theme);\n };\n AxisLabelsLayout$Companion.prototype.horizontalFixedBreaks_rldrnc$ = function (orientation, axisDomain, breaks, theme) {\n if (!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }return new HorizontalFixedBreaksLabelsLayout(orientation, axisDomain, this.TICK_LABEL_SPEC, breaks, theme);\n };\n AxisLabelsLayout$Companion.prototype.verticalFlexBreaks_4ebi60$ = function (orientation, axisDomain, breaksProvider, theme) {\n if (!!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }if (!!breaksProvider.isFixedBreaks) {\n var message_0 = 'fixed breaks';\n throw IllegalArgumentException_init(message_0.toString());\n }return new VerticalFlexBreaksLabelsLayout(orientation, axisDomain, this.TICK_LABEL_SPEC, breaksProvider, theme);\n };\n AxisLabelsLayout$Companion.prototype.verticalFixedBreaks_rldrnc$ = function (orientation, axisDomain, breaks, theme) {\n if (!!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }return new VerticalFixedBreaksLabelsLayout(orientation, axisDomain, this.TICK_LABEL_SPEC, breaks, theme);\n };\n AxisLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AxisLabelsLayout$Companion_instance = null;\n function AxisLabelsLayout$Companion_getInstance() {\n if (AxisLabelsLayout$Companion_instance === null) {\n new AxisLabelsLayout$Companion();\n }return AxisLabelsLayout$Companion_instance;\n }\n AxisLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AxisLabelsLayout',\n interfaces: []\n };\n function AxisLabelsLayoutInfo(b) {\n this.breaks = null;\n this.bounds = null;\n this.smallFont = false;\n this.labelAdditionalOffsets = null;\n this.labelHorizontalAnchor = null;\n this.labelVerticalAnchor = null;\n this.labelRotationAngle = 0;\n this.isOverlap_8be2vx$ = false;\n this.breaks = b.myBreaks_8be2vx$;\n this.smallFont = b.mySmallFont_8be2vx$;\n this.bounds = b.myBounds_8be2vx$;\n this.isOverlap_8be2vx$ = b.myOverlap_8be2vx$;\n this.labelAdditionalOffsets = b.myLabelAdditionalOffsets_8be2vx$ == null ? null : ArrayList_init_0(ensureNotNull(b.myLabelAdditionalOffsets_8be2vx$));\n this.labelHorizontalAnchor = b.myLabelHorizontalAnchor_8be2vx$;\n this.labelVerticalAnchor = b.myLabelVerticalAnchor_8be2vx$;\n this.labelRotationAngle = b.myLabelRotationAngle_8be2vx$;\n }\n function AxisLabelsLayoutInfo$Builder() {\n this.myBreaks_8be2vx$ = null;\n this.myBounds_8be2vx$ = null;\n this.mySmallFont_8be2vx$ = false;\n this.myOverlap_8be2vx$ = false;\n this.myLabelAdditionalOffsets_8be2vx$ = null;\n this.myLabelHorizontalAnchor_8be2vx$ = null;\n this.myLabelVerticalAnchor_8be2vx$ = null;\n this.myLabelRotationAngle_8be2vx$ = 0.0;\n }\n AxisLabelsLayoutInfo$Builder.prototype.breaks_buc0yr$ = function (breaks) {\n this.myBreaks_8be2vx$ = breaks;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.bounds_wthzt5$ = function (bounds) {\n this.myBounds_8be2vx$ = bounds;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.smallFont_6taknv$ = function (b) {\n this.mySmallFont_8be2vx$ = b;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.overlap_6taknv$ = function (b) {\n this.myOverlap_8be2vx$ = b;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.labelAdditionalOffsets_eajcfd$ = function (l) {\n this.myLabelAdditionalOffsets_8be2vx$ = l;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.labelHorizontalAnchor_ja80zo$ = function (anchor) {\n this.myLabelHorizontalAnchor_8be2vx$ = anchor;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.labelVerticalAnchor_yaudma$ = function (anchor) {\n this.myLabelVerticalAnchor_8be2vx$ = anchor;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.labelRotationAngle_14dthe$ = function (angle) {\n this.myLabelRotationAngle_8be2vx$ = angle;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.build = function () {\n return new AxisLabelsLayoutInfo(this);\n };\n AxisLabelsLayoutInfo$Builder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Builder',\n interfaces: []\n };\n AxisLabelsLayoutInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AxisLabelsLayoutInfo',\n interfaces: []\n };\n function BreakLabelsLayoutUtil() {\n BreakLabelsLayoutUtil_instance = this;\n }\n BreakLabelsLayoutUtil.prototype.getFlexBreaks_73ga93$ = function (breaksProvider, maxCount, axisLength) {\n if (!!breaksProvider.isFixedBreaks) {\n var message = 'fixed breaks not expected';\n throw IllegalArgumentException_init(message.toString());\n }if (!(maxCount > 0)) {\n var message_0 = 'maxCount=' + maxCount;\n throw IllegalArgumentException_init(message_0.toString());\n }var breaks = breaksProvider.getBreaks_5wr77w$(maxCount, axisLength);\n if (maxCount === 1 && !breaks.isEmpty) {\n return new GuideBreaks(breaks.domainValues.subList_vux9f0$(0, 1), breaks.transformedValues.subList_vux9f0$(0, 1), breaks.labels.subList_vux9f0$(0, 1));\n }var count = maxCount;\n while (breaks.size() > maxCount) {\n var b = (breaks.size() - maxCount | 0) / 2 | 0;\n var delta = JsMath.max(1, b);\n count = count - delta | 0;\n breaks = breaksProvider.getBreaks_5wr77w$(count, axisLength);\n }\n return breaks;\n };\n BreakLabelsLayoutUtil.prototype.maxLength_mhpeer$ = function (labels) {\n var tmp$;\n var max = 0;\n tmp$ = labels.iterator();\n while (tmp$.hasNext()) {\n var label = tmp$.next();\n var a = max;\n var b = label.length;\n max = JsMath.max(a, b);\n }\n return max;\n };\n BreakLabelsLayoutUtil.prototype.horizontalCenteredLabelBounds_gpjtzr$ = function (labelSize) {\n return DoubleRectangle_init(-labelSize.x / 2.0, 0.0, labelSize.x, labelSize.y);\n };\n BreakLabelsLayoutUtil.prototype.doLayoutVerticalAxisLabels_ii702u$ = function (orientation, breaks, axisDomain, axisMapper, theme) {\n var tmp$;\n if (theme.showTickLabels()) {\n var labelsBounds = this.verticalAxisLabelsBounds_0(breaks, axisDomain, axisMapper);\n tmp$ = this.applyLabelsOffset_tsgpmr$(labelsBounds, theme.tickLabelDistance(), orientation);\n } else if (theme.showTickMarks()) {\n var labelsBounds_0 = new DoubleRectangle(DoubleVector.Companion.ZERO, DoubleVector.Companion.ZERO);\n tmp$ = this.applyLabelsOffset_tsgpmr$(labelsBounds_0, theme.tickLabelDistance(), orientation);\n } else\n tmp$ = new DoubleRectangle(DoubleVector.Companion.ZERO, DoubleVector.Companion.ZERO);\n var axisBounds = tmp$;\n return (new AxisLabelsLayoutInfo$Builder()).breaks_buc0yr$(breaks).bounds_wthzt5$(axisBounds).build();\n };\n BreakLabelsLayoutUtil.prototype.mapToAxis_lhkzxb$ = function (breaks, axisDomain, axisMapper) {\n var tmp$;\n var axisMin = axisDomain.lowerEnd;\n var axisBreaks = ArrayList_init();\n tmp$ = breaks.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n var mapped = axisMapper(v - axisMin);\n axisBreaks.add_11rb$(ensureNotNull(mapped));\n }\n return axisBreaks;\n };\n BreakLabelsLayoutUtil.prototype.applyLabelsOffset_tsgpmr$ = function (labelsBounds, offset, orientation) {\n var tmp$;\n var labelsBounds_0 = labelsBounds;\n switch (orientation.name) {\n case 'LEFT':\n tmp$ = new DoubleVector(-offset, 0.0);\n break;\n case 'RIGHT':\n tmp$ = new DoubleVector(offset, 0.0);\n break;\n case 'TOP':\n tmp$ = new DoubleVector(0.0, -offset);\n break;\n case 'BOTTOM':\n tmp$ = new DoubleVector(0.0, offset);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n var offsetVector = tmp$;\n if (orientation === Orientation$RIGHT_getInstance() || orientation === Orientation$BOTTOM_getInstance()) {\n labelsBounds_0 = labelsBounds_0.add_gpjtzr$(offsetVector);\n } else if (orientation === Orientation$LEFT_getInstance() || orientation === Orientation$TOP_getInstance()) {\n labelsBounds_0 = labelsBounds_0.add_gpjtzr$(offsetVector).subtract_gpjtzr$(new DoubleVector(labelsBounds_0.width, 0.0));\n }return labelsBounds_0;\n };\n BreakLabelsLayoutUtil.prototype.verticalAxisLabelsBounds_0 = function (breaks, axisDomain, axisMapper) {\n var maxLength = this.maxLength_mhpeer$(breaks.labels);\n var maxLabelWidth = AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC.width_za3lpa$(maxLength);\n var y1 = 0.0;\n var y2 = 0.0;\n if (!breaks.isEmpty) {\n var axisBreaks = this.mapToAxis_lhkzxb$(breaks.transformedValues, axisDomain, axisMapper);\n var a = axisBreaks.get_za3lpa$(0);\n var b = collect.Iterables.getLast_yl67zr$(axisBreaks);\n y1 = JsMath.min(a, b);\n var a_0 = axisBreaks.get_za3lpa$(0);\n var b_0 = collect.Iterables.getLast_yl67zr$(axisBreaks);\n y2 = JsMath.max(a_0, b_0);\n y1 -= AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC.height() / 2;\n y2 += AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC.height() / 2;\n }var origin = new DoubleVector(0.0, y1);\n var dimensions = new DoubleVector(maxLabelWidth, y2 - y1);\n return new DoubleRectangle(origin, dimensions);\n };\n BreakLabelsLayoutUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'BreakLabelsLayoutUtil',\n interfaces: []\n };\n var BreakLabelsLayoutUtil_instance = null;\n function BreakLabelsLayoutUtil_getInstance() {\n if (BreakLabelsLayoutUtil_instance === null) {\n new BreakLabelsLayoutUtil();\n }return BreakLabelsLayoutUtil_instance;\n }\n function HorizontalFixedBreaksLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme) {\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, labelSpec, breaks, theme);\n if (!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }}\n HorizontalFixedBreaksLabelsLayout.prototype.overlap_0 = function (labelsInfo, maxTickLabelsBounds) {\n return labelsInfo.isOverlap_8be2vx$ || (maxTickLabelsBounds != null && !(maxTickLabelsBounds.xRange().encloses_d226ot$(ensureNotNull(labelsInfo.bounds).xRange()) && maxTickLabelsBounds.yRange().encloses_d226ot$(labelsInfo.bounds.yRange())));\n };\n HorizontalFixedBreaksLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n if (!this.theme.showTickLabels()) {\n return this.noLabelsLayoutInfo_c0p8fa$(axisLength, this.orientation);\n }var labelsInfo = this.simpleLayout_0().doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n if (this.overlap_0(labelsInfo, maxLabelsBounds)) {\n labelsInfo = this.multilineLayout_0().doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n if (this.overlap_0(labelsInfo, maxLabelsBounds)) {\n labelsInfo = this.tiltedLayout_0().doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n if (this.overlap_0(labelsInfo, maxLabelsBounds)) {\n labelsInfo = this.verticalLayout_0(this.labelSpec).doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n if (this.overlap_0(labelsInfo, maxLabelsBounds)) {\n labelsInfo = this.verticalLayout_0(AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC_SMALL).doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n }}}}return labelsInfo;\n };\n HorizontalFixedBreaksLabelsLayout.prototype.simpleLayout_0 = function () {\n return new HorizontalSimpleLabelsLayout(this.orientation, this.axisDomain, this.labelSpec, this.breaks_0, this.theme);\n };\n HorizontalFixedBreaksLabelsLayout.prototype.multilineLayout_0 = function () {\n return new HorizontalMultilineLabelsLayout(this.orientation, this.axisDomain, this.labelSpec, this.breaks_0, this.theme, 2);\n };\n HorizontalFixedBreaksLabelsLayout.prototype.tiltedLayout_0 = function () {\n return new HorizontalTiltedLabelsLayout(this.orientation, this.axisDomain, this.labelSpec, this.breaks_0, this.theme);\n };\n HorizontalFixedBreaksLabelsLayout.prototype.verticalLayout_0 = function (labelSpec) {\n return new HorizontalVerticalLabelsLayout(this.orientation, this.axisDomain, labelSpec, this.breaks_0, this.theme);\n };\n HorizontalFixedBreaksLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n throw IllegalStateException_init('Not implemented here');\n };\n HorizontalFixedBreaksLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalFixedBreaksLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function HorizontalFlexBreaksLabelsLayout(orientation, axisDomain, labelSpec, myBreaksProvider, theme) {\n AxisLabelsLayout.call(this, orientation, axisDomain, labelSpec, theme);\n this.myBreaksProvider_0 = myBreaksProvider;\n if (!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }if (!!this.myBreaksProvider_0.isFixedBreaks) {\n var message_0 = 'fixed breaks';\n throw IllegalArgumentException_init(message_0.toString());\n }}\n HorizontalFlexBreaksLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n var targetBreakCount = HorizontalSimpleLabelsLayout$Companion_getInstance().estimateBreakCountInitial_14dthe$(axisLength);\n var breaks = this.getBreaks_0(targetBreakCount, axisLength);\n var labelsInfo = this.doLayoutLabels_0(breaks, axisLength, axisMapper, maxLabelsBounds);\n while (labelsInfo.isOverlap_8be2vx$) {\n var newTargetBreakCount = HorizontalSimpleLabelsLayout$Companion_getInstance().estimateBreakCount_g5yaez$(breaks.labels, axisLength);\n if (newTargetBreakCount >= targetBreakCount) {\n break;\n }targetBreakCount = newTargetBreakCount;\n breaks = this.getBreaks_0(targetBreakCount, axisLength);\n labelsInfo = this.doLayoutLabels_0(breaks, axisLength, axisMapper, maxLabelsBounds);\n }\n return labelsInfo;\n };\n HorizontalFlexBreaksLabelsLayout.prototype.doLayoutLabels_0 = function (breaks, axisLength, axisMapper, maxLabelsBounds) {\n var layout = new HorizontalSimpleLabelsLayout(this.orientation, this.axisDomain, this.labelSpec, breaks, this.theme);\n return layout.doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n };\n HorizontalFlexBreaksLabelsLayout.prototype.getBreaks_0 = function (maxCount, axisLength) {\n return BreakLabelsLayoutUtil_getInstance().getFlexBreaks_73ga93$(this.myBreaksProvider_0, maxCount, axisLength);\n };\n HorizontalFlexBreaksLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalFlexBreaksLabelsLayout',\n interfaces: [AxisLabelsLayout]\n };\n function HorizontalMultilineLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme, myMaxLines) {\n HorizontalMultilineLabelsLayout$Companion_getInstance();\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, labelSpec, breaks, theme);\n this.myMaxLines_0 = myMaxLines;\n this.myShelfIndexForTickIndex_0 = ArrayList_init();\n }\n Object.defineProperty(HorizontalMultilineLabelsLayout.prototype, 'labelAdditionalOffsets_0', {\n configurable: true,\n get: function () {\n var tmp$;\n var h = this.labelSpec.height() * HorizontalMultilineLabelsLayout$Companion_getInstance().LINE_HEIGHT_0;\n var result = ArrayList_init();\n tmp$ = this.breaks_0.size();\n for (var i = 0; i < tmp$; i++) {\n result.add_11rb$(new DoubleVector(0.0, this.myShelfIndexForTickIndex_0.get_za3lpa$(i) * h));\n }\n return result;\n }\n });\n HorizontalMultilineLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n var tmp$, tmp$_0;\n var boundsByShelfIndex = HashMap_init();\n var ticks = this.mapToAxis_d2cc22$(this.breaks_0.transformedValues, axisMapper);\n var boundsList = this.labelBoundsList_c3fefx$(ticks, this.breaks_0.labels, AbstractFixedBreaksLabelsLayout$Companion_getInstance().HORIZONTAL_TICK_LOCATION);\n tmp$ = boundsList.iterator();\n while (tmp$.hasNext()) {\n var labelBounds = tmp$.next();\n var shelfIndex = 0;\n while (true) {\n if (!boundsByShelfIndex.containsKey_11rb$(shelfIndex)) {\n var key = shelfIndex;\n boundsByShelfIndex.put_xwzc9p$(key, labelBounds);\n this.myShelfIndexForTickIndex_0.add_11rb$(shelfIndex);\n break;\n }var shelfBounds = ensureNotNull(boundsByShelfIndex.get_11rb$(shelfIndex));\n if (!shelfBounds.xRange().isConnected_d226ot$(new ClosedRange(labelBounds.left - 60, labelBounds.right + 60))) {\n this.myShelfIndexForTickIndex_0.add_11rb$(shelfIndex);\n shelfBounds = shelfBounds.union_wthzt5$(labelBounds);\n var key_0 = shelfIndex;\n var value = shelfBounds;\n boundsByShelfIndex.put_xwzc9p$(key_0, value);\n break;\n }shelfIndex = shelfIndex + 1 | 0;\n }\n }\n var bounds = boundsByShelfIndex.isEmpty() ? new DoubleRectangle(DoubleVector.Companion.ZERO, DoubleVector.Companion.ZERO) : ensureNotNull(boundsByShelfIndex.get_11rb$(0));\n var h = this.labelSpec.height() * HorizontalMultilineLabelsLayout$Companion_getInstance().LINE_HEIGHT_0;\n tmp$_0 = boundsByShelfIndex.size;\n for (var i = 0; i < tmp$_0; i++) {\n var shelfBounds_0 = ensureNotNull(boundsByShelfIndex.get_11rb$(i));\n bounds = bounds.union_wthzt5$(shelfBounds_0.add_gpjtzr$(new DoubleVector(0.0, i * h)));\n }\n var linesCount = boundsByShelfIndex.size;\n return (new AxisLabelsLayoutInfo$Builder()).breaks_buc0yr$(this.breaks_0).bounds_wthzt5$(this.applyLabelsOffset_w7e9pi$(bounds)).smallFont_6taknv$(false).overlap_6taknv$(linesCount > this.myMaxLines_0).labelAdditionalOffsets_eajcfd$(this.labelAdditionalOffsets_0).labelHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE).labelVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.TOP).build();\n };\n HorizontalMultilineLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n return BreakLabelsLayoutUtil_getInstance().horizontalCenteredLabelBounds_gpjtzr$(labelNormalSize);\n };\n function HorizontalMultilineLabelsLayout$Companion() {\n HorizontalMultilineLabelsLayout$Companion_instance = this;\n this.LINE_HEIGHT_0 = 1.2;\n this.MIN_DISTANCE_0 = 60;\n }\n HorizontalMultilineLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HorizontalMultilineLabelsLayout$Companion_instance = null;\n function HorizontalMultilineLabelsLayout$Companion_getInstance() {\n if (HorizontalMultilineLabelsLayout$Companion_instance === null) {\n new HorizontalMultilineLabelsLayout$Companion();\n }return HorizontalMultilineLabelsLayout$Companion_instance;\n }\n HorizontalMultilineLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalMultilineLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function HorizontalSimpleLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme) {\n HorizontalSimpleLabelsLayout$Companion_getInstance();\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, labelSpec, breaks, theme);\n }\n HorizontalSimpleLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n var tmp$;\n if (this.breaks_0.isEmpty) {\n return this.noLabelsLayoutInfo_c0p8fa$(axisLength, this.orientation);\n }if (!this.theme.showTickLabels()) {\n return this.noLabelsLayoutInfo_c0p8fa$(axisLength, this.orientation);\n }var bounds = null;\n var overlap = false;\n var ticks = this.mapToAxis_d2cc22$(this.breaks_0.transformedValues, axisMapper);\n var boundsList = this.labelBoundsList_c3fefx$(ticks, this.breaks_0.labels, AbstractFixedBreaksLabelsLayout$Companion_getInstance().HORIZONTAL_TICK_LOCATION);\n tmp$ = boundsList.iterator();\n while (tmp$.hasNext()) {\n var labelBounds = tmp$.next();\n overlap = overlap || (bounds != null && bounds.xRange().isConnected_d226ot$(data_0.SeriesUtil.expand_wws5xy$(labelBounds.xRange(), AxisLabelsLayout$Companion_getInstance().MIN_TICK_LABEL_DISTANCE / 2, AxisLabelsLayout$Companion_getInstance().MIN_TICK_LABEL_DISTANCE / 2.0)));\n bounds = GeometryUtil_getInstance().union_te9coj$(labelBounds, bounds);\n }\n return (new AxisLabelsLayoutInfo$Builder()).breaks_buc0yr$(this.breaks_0).bounds_wthzt5$(this.applyLabelsOffset_w7e9pi$(ensureNotNull(bounds))).smallFont_6taknv$(false).overlap_6taknv$(overlap).labelAdditionalOffsets_eajcfd$(null).labelHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE).labelVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.TOP).build();\n };\n HorizontalSimpleLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n return BreakLabelsLayoutUtil_getInstance().horizontalCenteredLabelBounds_gpjtzr$(labelNormalSize);\n };\n function HorizontalSimpleLabelsLayout$Companion() {\n HorizontalSimpleLabelsLayout$Companion_instance = this;\n }\n HorizontalSimpleLabelsLayout$Companion.prototype.estimateBreakCountInitial_14dthe$ = function (axisLength) {\n return this.estimateBreakCount_0(AxisLabelsLayout$Companion_getInstance().INITIAL_TICK_LABEL_LENGTH, axisLength);\n };\n HorizontalSimpleLabelsLayout$Companion.prototype.estimateBreakCount_g5yaez$ = function (labels, axisLength) {\n var maxLength = BreakLabelsLayoutUtil_getInstance().maxLength_mhpeer$(labels);\n return this.estimateBreakCount_0(maxLength, axisLength);\n };\n HorizontalSimpleLabelsLayout$Companion.prototype.estimateBreakCount_0 = function (labelLength, axisLength) {\n var tickDistance = AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC.width_za3lpa$(labelLength) + AxisLabelsLayout$Companion_getInstance().MIN_TICK_LABEL_DISTANCE;\n var b = axisLength / tickDistance;\n return numberToInt(JsMath.max(1.0, b));\n };\n HorizontalSimpleLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HorizontalSimpleLabelsLayout$Companion_instance = null;\n function HorizontalSimpleLabelsLayout$Companion_getInstance() {\n if (HorizontalSimpleLabelsLayout$Companion_instance === null) {\n new HorizontalSimpleLabelsLayout$Companion();\n }return HorizontalSimpleLabelsLayout$Companion_instance;\n }\n HorizontalSimpleLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalSimpleLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function HorizontalTiltedLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme) {\n HorizontalTiltedLabelsLayout$Companion_getInstance();\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, labelSpec, breaks, theme);\n }\n Object.defineProperty(HorizontalTiltedLabelsLayout.prototype, 'labelHorizontalAnchor_0', {\n configurable: true,\n get: function () {\n if (this.orientation === Orientation$BOTTOM_getInstance()) {\n return TextLabel$HorizontalAnchor.RIGHT;\n }throw RuntimeException_init('Not implemented');\n }\n });\n Object.defineProperty(HorizontalTiltedLabelsLayout.prototype, 'labelVerticalAnchor_0', {\n configurable: true,\n get: function () {\n return TextLabel$VerticalAnchor.TOP;\n }\n });\n HorizontalTiltedLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n var height = this.labelSpec.height();\n var ticks = this.mapToAxis_d2cc22$(this.breaks_0.transformedValues, axisMapper);\n var overlap = false;\n if (this.breaks_0.size() >= 2) {\n var x = (height + HorizontalTiltedLabelsLayout$Companion_getInstance().MIN_DISTANCE_0) / HorizontalTiltedLabelsLayout$Companion_getInstance().SIN_0;\n var minTickDistance = JsMath.abs(x);\n var x_0 = ticks.get_za3lpa$(0) - ticks.get_za3lpa$(1);\n var tickDistance = JsMath.abs(x_0);\n overlap = tickDistance < minTickDistance;\n }var bounds = this.labelsBounds_c3fefx$(ticks, this.breaks_0.labels, AbstractFixedBreaksLabelsLayout$Companion_getInstance().HORIZONTAL_TICK_LOCATION);\n return this.createAxisLabelsLayoutInfoBuilder_fd842m$(ensureNotNull(bounds), overlap).labelHorizontalAnchor_ja80zo$(this.labelHorizontalAnchor_0).labelVerticalAnchor_yaudma$(this.labelVerticalAnchor_0).labelRotationAngle_14dthe$(HorizontalTiltedLabelsLayout$Companion_getInstance().ROTATION_DEGREE_0).build();\n };\n HorizontalTiltedLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n if (!(HorizontalTiltedLabelsLayout$Companion_getInstance().ROTATION_DEGREE_0 >= -90 && HorizontalTiltedLabelsLayout$Companion_getInstance().ROTATION_DEGREE_0 <= 0 && this.labelHorizontalAnchor_0 === TextLabel$HorizontalAnchor.RIGHT && this.labelVerticalAnchor_0 === TextLabel$VerticalAnchor.TOP)) {\n throw RuntimeException_init('Not implemented');\n }var x = labelNormalSize.x * HorizontalTiltedLabelsLayout$Companion_getInstance().COS_0;\n var tmp$ = JsMath.abs(x);\n var x_0 = labelNormalSize.y * HorizontalTiltedLabelsLayout$Companion_getInstance().SIN_0;\n var w = tmp$ + 2 * JsMath.abs(x_0);\n var x_1 = labelNormalSize.x * HorizontalTiltedLabelsLayout$Companion_getInstance().SIN_0;\n var tmp$_0 = JsMath.abs(x_1);\n var x_2 = labelNormalSize.y * HorizontalTiltedLabelsLayout$Companion_getInstance().COS_0;\n var h = tmp$_0 + JsMath.abs(x_2);\n var x_3 = labelNormalSize.x * HorizontalTiltedLabelsLayout$Companion_getInstance().COS_0;\n var tmp$_1 = JsMath.abs(x_3);\n var x_4 = labelNormalSize.y * HorizontalTiltedLabelsLayout$Companion_getInstance().SIN_0;\n var x_5 = -(tmp$_1 + JsMath.abs(x_4));\n var y = 0.0;\n return DoubleRectangle_init(x_5, y, w, h);\n };\n function HorizontalTiltedLabelsLayout$Companion() {\n HorizontalTiltedLabelsLayout$Companion_instance = this;\n this.MIN_DISTANCE_0 = 5.0;\n this.ROTATION_DEGREE_0 = -30.0;\n var x = toRadians(this.ROTATION_DEGREE_0);\n this.SIN_0 = JsMath.sin(x);\n var x_0 = toRadians(this.ROTATION_DEGREE_0);\n this.COS_0 = JsMath.cos(x_0);\n }\n HorizontalTiltedLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HorizontalTiltedLabelsLayout$Companion_instance = null;\n function HorizontalTiltedLabelsLayout$Companion_getInstance() {\n if (HorizontalTiltedLabelsLayout$Companion_instance === null) {\n new HorizontalTiltedLabelsLayout$Companion();\n }return HorizontalTiltedLabelsLayout$Companion_instance;\n }\n HorizontalTiltedLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalTiltedLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function HorizontalVerticalLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme) {\n HorizontalVerticalLabelsLayout$Companion_getInstance();\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, labelSpec, breaks, theme);\n }\n Object.defineProperty(HorizontalVerticalLabelsLayout.prototype, 'labelHorizontalAnchor', {\n configurable: true,\n get: function () {\n if (this.orientation === Orientation$BOTTOM_getInstance()) {\n return TextLabel$HorizontalAnchor.LEFT;\n }throw RuntimeException_init('Not implemented');\n }\n });\n Object.defineProperty(HorizontalVerticalLabelsLayout.prototype, 'labelVerticalAnchor', {\n configurable: true,\n get: function () {\n return TextLabel$VerticalAnchor.CENTER;\n }\n });\n HorizontalVerticalLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n var height = this.labelSpec.height();\n var ticks = this.mapToAxis_d2cc22$(this.breaks_0.transformedValues, axisMapper);\n var overlap = false;\n if (this.breaks_0.size() >= 2) {\n var minTickDistance = height + HorizontalVerticalLabelsLayout$Companion_getInstance().MIN_DISTANCE_0;\n var x = ticks.get_za3lpa$(0) - ticks.get_za3lpa$(1);\n var tickDistance = JsMath.abs(x);\n overlap = tickDistance < minTickDistance;\n }var bounds = this.labelsBounds_c3fefx$(ticks, this.breaks_0.labels, AbstractFixedBreaksLabelsLayout$Companion_getInstance().HORIZONTAL_TICK_LOCATION);\n return this.createAxisLabelsLayoutInfoBuilder_fd842m$(ensureNotNull(bounds), overlap).labelHorizontalAnchor_ja80zo$(this.labelHorizontalAnchor).labelVerticalAnchor_yaudma$(this.labelVerticalAnchor).labelRotationAngle_14dthe$(HorizontalVerticalLabelsLayout$Companion_getInstance().ROTATION_DEGREE_0).build();\n };\n HorizontalVerticalLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n if (!(HorizontalVerticalLabelsLayout$Companion_getInstance().ROTATION_DEGREE_0 === 90.0 && this.labelHorizontalAnchor === TextLabel$HorizontalAnchor.LEFT && this.labelVerticalAnchor === TextLabel$VerticalAnchor.CENTER)) {\n throw RuntimeException_init('Not implemented');\n }var w = labelNormalSize.y;\n var h = labelNormalSize.x;\n var x = -w / 2;\n var y = 0.0;\n return DoubleRectangle_init(x, y, w, h);\n };\n function HorizontalVerticalLabelsLayout$Companion() {\n HorizontalVerticalLabelsLayout$Companion_instance = this;\n this.MIN_DISTANCE_0 = 5.0;\n this.ROTATION_DEGREE_0 = 90.0;\n }\n HorizontalVerticalLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HorizontalVerticalLabelsLayout$Companion_instance = null;\n function HorizontalVerticalLabelsLayout$Companion_getInstance() {\n if (HorizontalVerticalLabelsLayout$Companion_instance === null) {\n new HorizontalVerticalLabelsLayout$Companion();\n }return HorizontalVerticalLabelsLayout$Companion_instance;\n }\n HorizontalVerticalLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalVerticalLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function VerticalFixedBreaksLabelsLayout(orientation, axisDomain, tickLabelSpec, breaks, theme) {\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, tickLabelSpec, breaks, theme);\n }\n VerticalFixedBreaksLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n throw IllegalStateException_init('Not implemented here');\n };\n VerticalFixedBreaksLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n return BreakLabelsLayoutUtil_getInstance().doLayoutVerticalAxisLabels_ii702u$(this.orientation, this.breaks_0, this.axisDomain, axisMapper, this.theme);\n };\n VerticalFixedBreaksLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalFixedBreaksLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function VerticalFlexBreaksLabelsLayout(orientation, axisDomain, labelSpec, myBreaksProvider, theme) {\n AxisLabelsLayout.call(this, orientation, axisDomain, labelSpec, theme);\n this.myBreaksProvider_0 = myBreaksProvider;\n if (!!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }if (!!this.myBreaksProvider_0.isFixedBreaks) {\n var message_0 = 'fixed breaks';\n throw IllegalArgumentException_init(message_0.toString());\n }}\n VerticalFlexBreaksLabelsLayout.prototype.maxTickCount_0 = function (axisLength) {\n var x = axisLength / (AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC.height() + AxisLabelsLayout$Companion_getInstance().MIN_TICK_LABEL_DISTANCE);\n return numberToInt(JsMath.ceil(x));\n };\n VerticalFlexBreaksLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n if (!(axisLength > 0)) {\n var message = 'axis length: ' + axisLength;\n throw IllegalArgumentException_init(message.toString());\n }var maxTickCount = this.maxTickCount_0(axisLength);\n var breaks = this.getBreaks_0(maxTickCount, axisLength);\n return BreakLabelsLayoutUtil_getInstance().doLayoutVerticalAxisLabels_ii702u$(this.orientation, breaks, this.axisDomain, axisMapper, this.theme);\n };\n VerticalFlexBreaksLabelsLayout.prototype.getBreaks_0 = function (maxCount, axisLength) {\n return BreakLabelsLayoutUtil_getInstance().getFlexBreaks_73ga93$(this.myBreaksProvider_0, maxCount, axisLength);\n };\n VerticalFlexBreaksLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalFlexBreaksLabelsLayout',\n interfaces: [AxisLabelsLayout]\n };\n function Defaults() {\n Defaults_instance = this;\n this.DARK_GRAY = '#3d3d3d';\n this.GRAY = Color.Companion.GRAY.toHexColor();\n this.LIGHT_GRAY = Color.Companion.LIGHT_GRAY.toHexColor();\n this.X_LIGHT_GRAY = Color.Companion.VERY_LIGHT_GRAY.toHexColor();\n this.XX_LIGHT_GRAY = '#e0e0e0';\n this.BACKDROP_COLOR = 'white';\n this.TEXT_COLOR = this.DARK_GRAY;\n this.FONT_LARGE = 16;\n this.FONT_MEDIUM = 12;\n this.FONT_SMALL = 10;\n this.FONT_X_SMALL = 8;\n this.FONT_FAMILY_NORMAL = '\"Lucida Grande\", sans-serif';\n this.FONT_FAMILY_MONOSPACED = '\"Courier New\", Courier, monospace';\n }\n function Defaults$Common() {\n }\n function Defaults$Common$Title() {\n Defaults$Common$Title_instance = this;\n this.FONT_SIZE = 16;\n this.FONT_SIZE_CSS = '' + toString(16) + 'px';\n }\n Defaults$Common$Title.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Title',\n interfaces: []\n };\n var Defaults$Common$Title_instance = null;\n function Defaults$Common$Title_getInstance() {\n if (Defaults$Common$Title_instance === null) {\n new Defaults$Common$Title();\n }return Defaults$Common$Title_instance;\n }\n function Defaults$Common$Legend() {\n Defaults$Common$Legend_instance = this;\n this.TITLE_FONT_SIZE = 12;\n this.ITEM_FONT_SIZE = 10;\n this.OUTLINE_COLOR = Color.Companion.parseHex_61zpoe$(Defaults_getInstance().XX_LIGHT_GRAY);\n }\n Defaults$Common$Legend.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Legend',\n interfaces: []\n };\n var Defaults$Common$Legend_instance = null;\n function Defaults$Common$Legend_getInstance() {\n if (Defaults$Common$Legend_instance === null) {\n new Defaults$Common$Legend();\n }return Defaults$Common$Legend_instance;\n }\n function Defaults$Common$Tooltip() {\n Defaults$Common$Tooltip_instance = this;\n this.MAX_POINTER_FOOTING_LENGTH = 12.0;\n this.POINTER_FOOTING_TO_SIDE_LENGTH_RATIO = 0.4;\n this.MARGIN_BETWEEN_TOOLTIPS = 5.0;\n this.DATA_TOOLTIP_FONT_SIZE = 12;\n this.LINE_INTERVAL = 3.0;\n this.H_CONTENT_PADDING = 4.0;\n this.V_CONTENT_PADDING = 4.0;\n this.LABEL_VALUE_INTERVAL = 8.0;\n this.BORDER_WIDTH = 4.0;\n this.DARK_TEXT_COLOR = Color.Companion.BLACK;\n this.LIGHT_TEXT_COLOR = Color.Companion.WHITE;\n this.AXIS_TOOLTIP_FONT_SIZE = 12;\n this.AXIS_TOOLTIP_COLOR = Defaults$Plot$Axis_getInstance().LINE_COLOR;\n this.AXIS_RADIUS = 1.5;\n }\n Defaults$Common$Tooltip.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Tooltip',\n interfaces: []\n };\n var Defaults$Common$Tooltip_instance = null;\n function Defaults$Common$Tooltip_getInstance() {\n if (Defaults$Common$Tooltip_instance === null) {\n new Defaults$Common$Tooltip();\n }return Defaults$Common$Tooltip_instance;\n }\n Defaults$Common.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Common',\n interfaces: []\n };\n function Defaults$Table() {\n }\n function Defaults$Table$Head() {\n Defaults$Table$Head_instance = this;\n this.FONT_SIZE = 12;\n this.FONT_SIZE_CSS = '' + toString(12) + 'px';\n }\n Defaults$Table$Head.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Head',\n interfaces: []\n };\n var Defaults$Table$Head_instance = null;\n function Defaults$Table$Head_getInstance() {\n if (Defaults$Table$Head_instance === null) {\n new Defaults$Table$Head();\n }return Defaults$Table$Head_instance;\n }\n function Defaults$Table$Data() {\n Defaults$Table$Data_instance = this;\n this.FONT_SIZE = 12;\n this.FONT_SIZE_CSS = '' + toString(12) + 'px';\n }\n Defaults$Table$Data.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Data',\n interfaces: []\n };\n var Defaults$Table$Data_instance = null;\n function Defaults$Table$Data_getInstance() {\n if (Defaults$Table$Data_instance === null) {\n new Defaults$Table$Data();\n }return Defaults$Table$Data_instance;\n }\n Defaults$Table.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Table',\n interfaces: []\n };\n function Defaults$Plot() {\n }\n function Defaults$Plot$Axis() {\n Defaults$Plot$Axis_instance = this;\n this.TITLE_FONT_SIZE = 12;\n this.TICK_FONT_SIZE = 10;\n this.TICK_FONT_SIZE_SMALL = 8;\n this.LINE_COLOR = Color.Companion.parseHex_61zpoe$(Defaults_getInstance().DARK_GRAY);\n this.TICK_COLOR = Color.Companion.parseHex_61zpoe$(Defaults_getInstance().DARK_GRAY);\n this.GRID_LINE_COLOR = Color.Companion.parseHex_61zpoe$(Defaults_getInstance().X_LIGHT_GRAY);\n this.LINE_WIDTH = 1.0;\n this.TICK_LINE_WIDTH = 1.0;\n this.GRID_LINE_WIDTH = 1.0;\n }\n Defaults$Plot$Axis.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Axis',\n interfaces: []\n };\n var Defaults$Plot$Axis_instance = null;\n function Defaults$Plot$Axis_getInstance() {\n if (Defaults$Plot$Axis_instance === null) {\n new Defaults$Plot$Axis();\n }return Defaults$Plot$Axis_instance;\n }\n Defaults$Plot.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Plot',\n interfaces: []\n };\n Defaults.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Defaults',\n interfaces: []\n };\n var Defaults_instance = null;\n function Defaults_getInstance() {\n if (Defaults_instance === null) {\n new Defaults();\n }return Defaults_instance;\n }\n function LabelCss() {\n LabelCss_instance = this;\n }\n LabelCss.prototype.get_diyz8p$ = function (labelSpec, selector) {\n var css = StringBuilder_init();\n css.append_pdl1vj$(selector).append_pdl1vj$(' {').append_pdl1vj$(labelSpec.isMonospaced ? '\\n font-family: ' + Defaults_getInstance().FONT_FAMILY_MONOSPACED + ';' : '\\n').append_pdl1vj$('\\n font-size: ').append_s8jyv4$(labelSpec.fontSize).append_pdl1vj$('px;').append_pdl1vj$(labelSpec.isBold ? '\\n font-weight: bold;' : '').append_pdl1vj$('\\n}\\n');\n return css.toString();\n };\n LabelCss.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'LabelCss',\n interfaces: []\n };\n var LabelCss_instance = null;\n function LabelCss_getInstance() {\n if (LabelCss_instance === null) {\n new LabelCss();\n }return LabelCss_instance;\n }\n function Serializable() {\n }\n Serializable.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Serializable',\n interfaces: []\n };\n function LabelMetrics() {\n LabelMetrics$Companion_getInstance();\n this.fontSize_yu4fth$_0 = 0;\n this.isBold_4ltcm$_0 = false;\n this.isMonospaced_kwm1y$_0 = false;\n }\n Object.defineProperty(LabelMetrics.prototype, 'fontSize', {\n configurable: true,\n get: function () {\n return this.fontSize_yu4fth$_0;\n }\n });\n Object.defineProperty(LabelMetrics.prototype, 'isBold', {\n configurable: true,\n get: function () {\n return this.isBold_4ltcm$_0;\n }\n });\n Object.defineProperty(LabelMetrics.prototype, 'isMonospaced', {\n configurable: true,\n get: function () {\n return this.isMonospaced_kwm1y$_0;\n }\n });\n LabelMetrics.prototype.dimensions_za3lpa$ = function (labelLength) {\n return new DoubleVector(this.width_za3lpa$(labelLength), this.height());\n };\n LabelMetrics.prototype.width_za3lpa$ = function (labelLength) {\n var tmp$;\n var ratio = LabelMetrics$Companion_getInstance().FONT_SIZE_TO_GLYPH_WIDTH_RATIO_0;\n if (this.isMonospaced) {\n ratio = LabelMetrics$Companion_getInstance().FONT_SIZE_TO_GLYPH_WIDTH_RATIO_MONOSPACED_0;\n }var width = labelLength * this.fontSize * ratio + 2 * LabelMetrics$Companion_getInstance().LABEL_PADDING_0;\n if (this.isBold) {\n tmp$ = width * LabelMetrics$Companion_getInstance().FONT_WEIGHT_BOLD_TO_NORMAL_WIDTH_RATIO_0;\n } else\n tmp$ = width;\n return tmp$;\n };\n LabelMetrics.prototype.height = function () {\n return this.fontSize + 2 * LabelMetrics$Companion_getInstance().LABEL_PADDING_0;\n };\n function LabelMetrics$Companion() {\n LabelMetrics$Companion_instance = this;\n this.FONT_SIZE_TO_GLYPH_WIDTH_RATIO_0 = 0.67;\n this.FONT_SIZE_TO_GLYPH_WIDTH_RATIO_MONOSPACED_0 = 0.6;\n this.FONT_WEIGHT_BOLD_TO_NORMAL_WIDTH_RATIO_0 = 1.075;\n this.LABEL_PADDING_0 = 0.0;\n }\n LabelMetrics$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LabelMetrics$Companion_instance = null;\n function LabelMetrics$Companion_getInstance() {\n if (LabelMetrics$Companion_instance === null) {\n new LabelMetrics$Companion();\n }return LabelMetrics$Companion_instance;\n }\n LabelMetrics.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LabelMetrics',\n interfaces: [Serializable, LabelSpec]\n };\n function LabelMetrics_init($this) {\n $this = $this || Object.create(LabelMetrics.prototype);\n LabelMetrics.call($this);\n $this.fontSize_yu4fth$_0 = 0.0;\n $this.isBold_4ltcm$_0 = false;\n $this.isMonospaced_kwm1y$_0 = false;\n return $this;\n }\n function LabelMetrics_init_0(fontSize, bold, monospaced, $this) {\n if (bold === void 0)\n bold = false;\n if (monospaced === void 0)\n monospaced = false;\n $this = $this || Object.create(LabelMetrics.prototype);\n LabelMetrics.call($this);\n $this.fontSize_yu4fth$_0 = fontSize;\n $this.isBold_4ltcm$_0 = bold;\n $this.isMonospaced_kwm1y$_0 = monospaced;\n return $this;\n }\n function LabelSpec() {\n }\n LabelSpec.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LabelSpec',\n interfaces: []\n };\n function PlotLabelSpec(name, ordinal, fontSize, bold, monospaced) {\n if (bold === void 0)\n bold = false;\n if (monospaced === void 0)\n monospaced = false;\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n this.myLabelMetrics_3i33aj$_0 = null;\n this.myLabelMetrics_3i33aj$_0 = LabelMetrics_init_0(fontSize, bold, monospaced);\n }\n function PlotLabelSpec_initFields() {\n PlotLabelSpec_initFields = function () {\n };\n PlotLabelSpec$PLOT_TITLE_instance = new PlotLabelSpec('PLOT_TITLE', 0, 16, true);\n PlotLabelSpec$AXIS_TICK_instance = new PlotLabelSpec('AXIS_TICK', 1, 10);\n PlotLabelSpec$AXIS_TICK_SMALL_instance = new PlotLabelSpec('AXIS_TICK_SMALL', 2, 8);\n PlotLabelSpec$AXIS_TITLE_instance = new PlotLabelSpec('AXIS_TITLE', 3, 12);\n PlotLabelSpec$LEGEND_TITLE_instance = new PlotLabelSpec('LEGEND_TITLE', 4, 12, true);\n PlotLabelSpec$LEGEND_ITEM_instance = new PlotLabelSpec('LEGEND_ITEM', 5, 10);\n }\n var PlotLabelSpec$PLOT_TITLE_instance;\n function PlotLabelSpec$PLOT_TITLE_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$PLOT_TITLE_instance;\n }\n var PlotLabelSpec$AXIS_TICK_instance;\n function PlotLabelSpec$AXIS_TICK_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$AXIS_TICK_instance;\n }\n var PlotLabelSpec$AXIS_TICK_SMALL_instance;\n function PlotLabelSpec$AXIS_TICK_SMALL_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$AXIS_TICK_SMALL_instance;\n }\n var PlotLabelSpec$AXIS_TITLE_instance;\n function PlotLabelSpec$AXIS_TITLE_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$AXIS_TITLE_instance;\n }\n var PlotLabelSpec$LEGEND_TITLE_instance;\n function PlotLabelSpec$LEGEND_TITLE_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$LEGEND_TITLE_instance;\n }\n var PlotLabelSpec$LEGEND_ITEM_instance;\n function PlotLabelSpec$LEGEND_ITEM_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$LEGEND_ITEM_instance;\n }\n Object.defineProperty(PlotLabelSpec.prototype, 'isBold', {\n configurable: true,\n get: function () {\n return this.myLabelMetrics_3i33aj$_0.isBold;\n }\n });\n Object.defineProperty(PlotLabelSpec.prototype, 'isMonospaced', {\n configurable: true,\n get: function () {\n return this.myLabelMetrics_3i33aj$_0.isMonospaced;\n }\n });\n Object.defineProperty(PlotLabelSpec.prototype, 'fontSize', {\n configurable: true,\n get: function () {\n return this.myLabelMetrics_3i33aj$_0.fontSize;\n }\n });\n PlotLabelSpec.prototype.dimensions_za3lpa$ = function (labelLength) {\n return this.myLabelMetrics_3i33aj$_0.dimensions_za3lpa$(labelLength);\n };\n PlotLabelSpec.prototype.width_za3lpa$ = function (labelLength) {\n return this.myLabelMetrics_3i33aj$_0.width_za3lpa$(labelLength);\n };\n PlotLabelSpec.prototype.height = function () {\n return this.myLabelMetrics_3i33aj$_0.height();\n };\n PlotLabelSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotLabelSpec',\n interfaces: [LabelSpec, Enum]\n };\n function PlotLabelSpec$values() {\n return [PlotLabelSpec$PLOT_TITLE_getInstance(), PlotLabelSpec$AXIS_TICK_getInstance(), PlotLabelSpec$AXIS_TICK_SMALL_getInstance(), PlotLabelSpec$AXIS_TITLE_getInstance(), PlotLabelSpec$LEGEND_TITLE_getInstance(), PlotLabelSpec$LEGEND_ITEM_getInstance()];\n }\n PlotLabelSpec.values = PlotLabelSpec$values;\n function PlotLabelSpec$valueOf(name) {\n switch (name) {\n case 'PLOT_TITLE':\n return PlotLabelSpec$PLOT_TITLE_getInstance();\n case 'AXIS_TICK':\n return PlotLabelSpec$AXIS_TICK_getInstance();\n case 'AXIS_TICK_SMALL':\n return PlotLabelSpec$AXIS_TICK_SMALL_getInstance();\n case 'AXIS_TITLE':\n return PlotLabelSpec$AXIS_TITLE_getInstance();\n case 'LEGEND_TITLE':\n return PlotLabelSpec$LEGEND_TITLE_getInstance();\n case 'LEGEND_ITEM':\n return PlotLabelSpec$LEGEND_ITEM_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.presentation.PlotLabelSpec.' + name);\n }\n }\n PlotLabelSpec.valueOf_61zpoe$ = PlotLabelSpec$valueOf;\n function Style() {\n Style_instance = this;\n this.JFX_PLOT_STYLESHEET = '/svgMapper/jfx/plot.css';\n this.PLOT_CONTAINER = 'plt-container';\n this.PLOT = 'plt-plot';\n this.PLOT_TITLE = 'plt-plot-title';\n this.PLOT_TRANSPARENT = 'plt-transparent';\n this.PLOT_BACKDROP = 'plt-backdrop';\n this.AXIS = 'plt-axis';\n this.AXIS_TITLE = 'plt-axis-title';\n this.TICK = 'tick';\n this.SMALL_TICK_FONT = 'small-tick-font';\n this.BACK = 'back';\n this.LEGEND = 'plt_legend';\n this.LEGEND_TITLE = 'legend-title';\n this.PLOT_DATA_TOOLTIP = 'plt-data-tooltip';\n this.PLOT_AXIS_TOOLTIP = 'plt-axis-tooltip';\n this.CSS_0 = trimMargin('\\n |.plt-container {\\n |\\tfont-family: \"Lucida Grande\", sans-serif;\\n |\\tcursor: crosshair;\\n |\\tuser-select: none;\\n |\\t-webkit-user-select: none;\\n |\\t-moz-user-select: none;\\n |\\t-ms-user-select: none;\\n |}\\n |.plt-backdrop {\\n | fill: white;\\n |}\\n |.plt-transparent .plt-backdrop {\\n | visibility: hidden;\\n |}\\n |text {\\n |\\tfont-size: 12px;\\n |\\tfill: #3d3d3d;\\n |\\t\\n |\\ttext-rendering: optimizeLegibility;\\n |}\\n |.plt-data-tooltip text {\\n |\\tfont-size: 12px;\\n |}\\n |.plt-axis-tooltip text {\\n |\\tfont-size: 12px;\\n |}\\n |.plt-axis line {\\n |\\tshape-rendering: crispedges;\\n |}\\n ');\n }\n Object.defineProperty(Style.prototype, 'css', {\n configurable: true,\n get: function () {\n var tmp$, tmp$_0;\n var css = new StringBuilder(this.CSS_0.toString());\n css.append_s8itvh$(10);\n tmp$ = PlotLabelSpec$values();\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var labelSpec = tmp$[tmp$_0];\n var selector = this.selector_0(labelSpec);\n css.append_pdl1vj$(LabelCss_getInstance().get_diyz8p$(labelSpec, selector));\n }\n return css.toString();\n }\n });\n Style.prototype.selector_0 = function (labelSpec) {\n var tmp$;\n switch (labelSpec.name) {\n case 'PLOT_TITLE':\n tmp$ = '.plt-plot-title';\n break;\n case 'AXIS_TICK':\n tmp$ = '.plt-axis .tick text';\n break;\n case 'AXIS_TICK_SMALL':\n tmp$ = '.plt-axis.small-tick-font .tick text';\n break;\n case 'AXIS_TITLE':\n tmp$ = '.plt-axis-title text';\n break;\n case 'LEGEND_TITLE':\n tmp$ = '.plt_legend .legend-title text';\n break;\n case 'LEGEND_ITEM':\n tmp$ = '.plt_legend text';\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n Style.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Style',\n interfaces: []\n };\n var Style_instance = null;\n function Style_getInstance() {\n if (Style_instance === null) {\n new Style();\n }return Style_instance;\n }\n function GroupAwareSampling() {\n }\n GroupAwareSampling.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GroupAwareSampling',\n interfaces: [Sampling]\n };\n function PointSampling() {\n }\n PointSampling.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PointSampling',\n interfaces: [Sampling]\n };\n function Sampling() {\n }\n Sampling.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Sampling',\n interfaces: []\n };\n function Samplings() {\n Samplings_instance = this;\n this.RANDOM = RandomSampling$Companion_getInstance().ALIAS;\n this.PICK = PickSampling$Companion_getInstance().ALIAS;\n this.SYSTEMATIC = SystematicSampling$Companion_getInstance().ALIAS;\n this.RANDOM_GROUP = GroupRandomSampling$Companion_getInstance().ALIAS;\n this.SYSTEMATIC_GROUP = GroupSystematicSampling$Companion_getInstance().ALIAS;\n this.RANDOM_STRATIFIED = RandomStratifiedSampling$Companion_getInstance().ALIAS_8be2vx$;\n this.VERTEX_VW = VertexSampling$VertexVwSampling$Companion_getInstance().ALIAS;\n this.VERTEX_DP = VertexSampling$VertexDpSampling$Companion_getInstance().ALIAS;\n this.NONE = new Samplings$NoneSampling();\n }\n Samplings.prototype.random_280ow0$ = function (sampleSize, seed) {\n return new RandomSampling(sampleSize, seed);\n };\n Samplings.prototype.pick_za3lpa$ = function (sampleSize) {\n return new PickSampling(sampleSize);\n };\n Samplings.prototype.vertexDp_za3lpa$ = function (sampleSize) {\n return new VertexSampling$VertexDpSampling(sampleSize);\n };\n Samplings.prototype.vertexVw_za3lpa$ = function (sampleSize) {\n return new VertexSampling$VertexVwSampling(sampleSize);\n };\n Samplings.prototype.systematic_za3lpa$ = function (sampleSize) {\n return new SystematicSampling(sampleSize);\n };\n Samplings.prototype.randomGroup_280ow0$ = function (sampleSize, seed) {\n return new GroupRandomSampling(sampleSize, seed);\n };\n Samplings.prototype.systematicGroup_za3lpa$ = function (sampleSize) {\n return new GroupSystematicSampling(sampleSize);\n };\n Samplings.prototype.randomStratified_vcwos1$ = function (sampleSize, seed, minSubSample) {\n return new RandomStratifiedSampling(sampleSize, seed, minSubSample);\n };\n function Samplings$NoneSampling() {\n }\n Object.defineProperty(Samplings$NoneSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'none';\n }\n });\n Samplings$NoneSampling.prototype.isApplicable_dhhkv7$ = function (population) {\n return false;\n };\n Samplings$NoneSampling.prototype.apply_dhhkv7$ = function (population) {\n return population;\n };\n Samplings$NoneSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NoneSampling',\n interfaces: [PointSampling]\n };\n Samplings.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Samplings',\n interfaces: []\n };\n var Samplings_instance = null;\n function Samplings_getInstance() {\n if (Samplings_instance === null) {\n new Samplings();\n }return Samplings_instance;\n }\n function GroupRandomSampling(sampleSize, mySeed) {\n GroupRandomSampling$Companion_getInstance();\n GroupSamplingBase.call(this, sampleSize);\n this.mySeed_0 = mySeed;\n }\n Object.defineProperty(GroupRandomSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + GroupRandomSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + (this.mySeed_0 != null ? ', seed=' + toString(this.mySeed_0) : '') + ')';\n }\n });\n GroupRandomSampling.prototype.apply_se5qvl$ = function (population, groupMapper) {\n if (!this.isApplicable_se5qvl$(population, groupMapper)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var distinctGroups = SamplingUtil_getInstance().distinctGroups_ejae6o$(groupMapper, population.rowCount());\n shuffle(distinctGroups, this.createRandom_0());\n var pickedGroups = toSet(take(distinctGroups, this.sampleSize));\n return this.doSelect_z69lec$(population, pickedGroups, groupMapper);\n };\n GroupRandomSampling.prototype.createRandom_0 = function () {\n var tmp$, tmp$_0;\n return (tmp$_0 = (tmp$ = this.mySeed_0) != null ? Random(tmp$) : null) != null ? tmp$_0 : Random_0.Default;\n };\n function GroupRandomSampling$Companion() {\n GroupRandomSampling$Companion_instance = this;\n this.ALIAS = 'group_random';\n }\n GroupRandomSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GroupRandomSampling$Companion_instance = null;\n function GroupRandomSampling$Companion_getInstance() {\n if (GroupRandomSampling$Companion_instance === null) {\n new GroupRandomSampling$Companion();\n }return GroupRandomSampling$Companion_instance;\n }\n GroupRandomSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupRandomSampling',\n interfaces: [GroupSamplingBase]\n };\n function GroupSamplingBase(sampleSize) {\n SamplingBase.call(this, sampleSize);\n }\n GroupSamplingBase.prototype.isApplicable_se5qvl$ = function (population, groupMapper) {\n return this.isApplicable_ijg2gx$(population, groupMapper, SamplingUtil_getInstance().groupCount_ejae6o$(groupMapper, population.rowCount()));\n };\n GroupSamplingBase.prototype.isApplicable_ijg2gx$ = function (population, groupMapper, groupCount) {\n return groupCount > this.sampleSize;\n };\n GroupSamplingBase.prototype.doSelect_z69lec$ = function (population, pickedGroups, groupMapper) {\n var tmp$;\n var indicesByGroup = GroupUtil_getInstance().indicesByGroup_wc9gac$(population.rowCount(), groupMapper);\n var pickedIndices = ArrayList_init();\n tmp$ = pickedGroups.iterator();\n while (tmp$.hasNext()) {\n var group = tmp$.next();\n pickedIndices.addAll_brywnq$(ensureNotNull(indicesByGroup.get_11rb$(group)));\n }\n return population.selectIndices_pqoyrt$(pickedIndices);\n };\n GroupSamplingBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupSamplingBase',\n interfaces: [GroupAwareSampling, SamplingBase]\n };\n function GroupSystematicSampling(sampleSize) {\n GroupSystematicSampling$Companion_getInstance();\n GroupSamplingBase.call(this, sampleSize);\n }\n Object.defineProperty(GroupSystematicSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + GroupSystematicSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + ')';\n }\n });\n GroupSystematicSampling.prototype.isApplicable_ijg2gx$ = function (population, groupMapper, groupCount) {\n return GroupSamplingBase.prototype.isApplicable_ijg2gx$.call(this, population, groupMapper, groupCount) && SystematicSampling$Companion_getInstance().computeStep_vux9f0$(groupCount, this.sampleSize) >= 2;\n };\n GroupSystematicSampling.prototype.apply_se5qvl$ = function (population, groupMapper) {\n if (!this.isApplicable_se5qvl$(population, groupMapper)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var distinctGroups = SamplingUtil_getInstance().distinctGroups_ejae6o$(groupMapper, population.rowCount());\n var step = SystematicSampling$Companion_getInstance().computeStep_vux9f0$(distinctGroups.size, this.sampleSize);\n var pickedGroups = HashSet_init_0();\n var i = 0;\n while (i < distinctGroups.size) {\n pickedGroups.add_11rb$(distinctGroups.get_za3lpa$(i));\n i = i + step | 0;\n }\n return this.doSelect_z69lec$(population, pickedGroups, groupMapper);\n };\n function GroupSystematicSampling$Companion() {\n GroupSystematicSampling$Companion_instance = this;\n this.ALIAS = 'group_systematic';\n }\n GroupSystematicSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GroupSystematicSampling$Companion_instance = null;\n function GroupSystematicSampling$Companion_getInstance() {\n if (GroupSystematicSampling$Companion_instance === null) {\n new GroupSystematicSampling$Companion();\n }return GroupSystematicSampling$Companion_instance;\n }\n GroupSystematicSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupSystematicSampling',\n interfaces: [GroupSamplingBase]\n };\n function PickSampling(sampleSize) {\n PickSampling$Companion_getInstance();\n SamplingBase.call(this, sampleSize);\n }\n Object.defineProperty(PickSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + PickSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + ')';\n }\n });\n PickSampling.prototype.apply_dhhkv7$ = function (population) {\n if (!this.isApplicable_dhhkv7$(population)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var xVar = SamplingUtil_getInstance().xVar_dhhkv7$(population);\n var xFactors = population.distinctValues_8xm3sj$(xVar);\n if (xFactors.size <= this.sampleSize) {\n return population;\n }var pickX = toSet(take(xFactors, this.sampleSize));\n var xValues = population.get_8xm3sj$(xVar);\n var pickedIndices = ArrayList_init();\n var index = 0;\n for (var tmp$ = xValues.iterator(); tmp$.hasNext(); ++index) {\n var v = tmp$.next();\n if (contains(pickX, v)) {\n pickedIndices.add_11rb$(index);\n }}\n return population.selectIndices_pqoyrt$(pickedIndices);\n };\n function PickSampling$Companion() {\n PickSampling$Companion_instance = this;\n this.ALIAS = 'pick';\n }\n PickSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PickSampling$Companion_instance = null;\n function PickSampling$Companion_getInstance() {\n if (PickSampling$Companion_instance === null) {\n new PickSampling$Companion();\n }return PickSampling$Companion_instance;\n }\n PickSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PickSampling',\n interfaces: [PointSampling, SamplingBase]\n };\n function RandomSampling(sampleSize, mySeed) {\n RandomSampling$Companion_getInstance();\n SamplingBase.call(this, sampleSize);\n this.mySeed_0 = mySeed;\n }\n Object.defineProperty(RandomSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + RandomSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + (this.mySeed_0 != null ? ', seed=' + toString(this.mySeed_0) : '') + ')';\n }\n });\n RandomSampling.prototype.apply_dhhkv7$ = function (population) {\n var tmp$, tmp$_0;\n if (!this.isApplicable_dhhkv7$(population)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var rand = (tmp$_0 = (tmp$ = this.mySeed_0) != null ? Random(tmp$) : null) != null ? tmp$_0 : Random_0.Default;\n return util.SamplingUtil.sampleWithoutReplacement_egh5ya$(this.sampleSize, rand, population);\n };\n function RandomSampling$Companion() {\n RandomSampling$Companion_instance = this;\n this.ALIAS = 'random';\n }\n RandomSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RandomSampling$Companion_instance = null;\n function RandomSampling$Companion_getInstance() {\n if (RandomSampling$Companion_instance === null) {\n new RandomSampling$Companion();\n }return RandomSampling$Companion_instance;\n }\n RandomSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RandomSampling',\n interfaces: [PointSampling, SamplingBase]\n };\n function RandomStratifiedSampling(sampleSize, mySeed, myMinSubsampleSize) {\n RandomStratifiedSampling$Companion_getInstance();\n SamplingBase.call(this, sampleSize);\n this.mySeed_0 = mySeed;\n this.myMinSubsampleSize_0 = myMinSubsampleSize;\n }\n Object.defineProperty(RandomStratifiedSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + RandomStratifiedSampling$Companion_getInstance().ALIAS_8be2vx$ + '(' + 'n=' + toString(this.sampleSize) + (this.mySeed_0 != null ? ', seed=' + toString(this.mySeed_0) : '') + (this.myMinSubsampleSize_0 != null ? ', min_subsample=' + toString(this.myMinSubsampleSize_0) : '') + ')';\n }\n });\n RandomStratifiedSampling.prototype.isApplicable_se5qvl$ = function (population, groupMapper) {\n return population.rowCount() > this.sampleSize;\n };\n function RandomStratifiedSampling$apply$lambda(closure$groupIndices) {\n return function (indexSet) {\n var $receiver = until(0, closure$groupIndices.size);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (indexSet.contains_11rb$(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n }\n function RandomStratifiedSampling$apply$lambda_0(closure$groupIndices) {\n return function (indexSet) {\n var $receiver = until(0, closure$groupIndices.size);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (!indexSet.contains_11rb$(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n }\n RandomStratifiedSampling.prototype.apply_se5qvl$ = function (population, groupMapper) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3;\n if (!this.isApplicable_se5qvl$(population, groupMapper)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var indicesByGroup = GroupUtil_getInstance().indicesByGroup_wc9gac$(population.rowCount(), groupMapper);\n var minSubSampleSize = (tmp$ = this.myMinSubsampleSize_0) != null ? tmp$ : 2;\n var b = minSubSampleSize;\n minSubSampleSize = JsMath.max(0, b);\n var popSize = population.rowCount();\n var pickIndices = ArrayList_init();\n var rand = (tmp$_1 = (tmp$_0 = this.mySeed_0) != null ? Random(tmp$_0) : null) != null ? tmp$_1 : Random_0.Default;\n tmp$_2 = indicesByGroup.keys.iterator();\n while (tmp$_2.hasNext()) {\n var group = tmp$_2.next();\n var groupIndices = ensureNotNull(indicesByGroup.get_11rb$(group));\n var stratumSize = groupIndices.size;\n var ratio = stratumSize / popSize;\n var stratumSampleSize = numberToInt(round(this.sampleSize * ratio));\n var a = stratumSampleSize;\n var b_0 = minSubSampleSize;\n stratumSampleSize = JsMath.max(a, b_0);\n if (stratumSampleSize >= stratumSize) {\n pickIndices.addAll_brywnq$(groupIndices);\n } else {\n var sampleGroupIndices = util.SamplingUtil.sampleWithoutReplacement_o7ew15$(stratumSize, stratumSampleSize, rand, RandomStratifiedSampling$apply$lambda(groupIndices), RandomStratifiedSampling$apply$lambda_0(groupIndices));\n tmp$_3 = sampleGroupIndices.iterator();\n while (tmp$_3.hasNext()) {\n var i = tmp$_3.next();\n pickIndices.add_11rb$(groupIndices.get_za3lpa$(i));\n }\n }\n }\n return population.selectIndices_pqoyrt$(pickIndices);\n };\n function RandomStratifiedSampling$Companion() {\n RandomStratifiedSampling$Companion_instance = this;\n this.ALIAS_8be2vx$ = 'random_stratified';\n this.DEF_MIN_SUBSAMPLE_SIZE_0 = 2;\n }\n RandomStratifiedSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RandomStratifiedSampling$Companion_instance = null;\n function RandomStratifiedSampling$Companion_getInstance() {\n if (RandomStratifiedSampling$Companion_instance === null) {\n new RandomStratifiedSampling$Companion();\n }return RandomStratifiedSampling$Companion_instance;\n }\n RandomStratifiedSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RandomStratifiedSampling',\n interfaces: [GroupAwareSampling, SamplingBase]\n };\n function SamplingBase(sampleSize) {\n this.sampleSize = sampleSize;\n if (!(this.sampleSize > 0)) {\n var message = 'Sample size must be greater than zero, but was: ' + toString(this.sampleSize);\n throw IllegalStateException_init(message.toString());\n }}\n SamplingBase.prototype.isApplicable_dhhkv7$ = function (population) {\n return population.rowCount() > this.sampleSize;\n };\n SamplingBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SamplingBase',\n interfaces: [Sampling]\n };\n var compareBy$lambda_0 = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function SamplingUtil() {\n SamplingUtil_instance = this;\n }\n SamplingUtil.prototype.groupCount_ejae6o$ = function (groupMapper, size) {\n var $receiver = until(0, size);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(groupMapper(item));\n }\n return distinct(destination).size;\n };\n SamplingUtil.prototype.distinctGroups_ejae6o$ = function (groupMapper, size) {\n var $receiver = until(0, size);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(groupMapper(item));\n }\n return toMutableList(distinct(destination));\n };\n SamplingUtil.prototype.xVar_bbyvt0$ = function (variables) {\n var tmp$;\n if (variables.contains_11rb$(stat.Stats.X))\n tmp$ = stat.Stats.X;\n else if (variables.contains_11rb$(data.TransformVar.X))\n tmp$ = data.TransformVar.X;\n else\n tmp$ = null;\n return tmp$;\n };\n SamplingUtil.prototype.xVar_dhhkv7$ = function (data) {\n var tmp$;\n tmp$ = this.xVar_bbyvt0$(data.variables());\n if (tmp$ == null) {\n throw IllegalStateException_init(\"Can't apply sampling: couldn't deduce the (X) variable.\");\n }return tmp$;\n };\n SamplingUtil.prototype.yVar_dhhkv7$ = function (data_0) {\n if (data_0.has_8xm3sj$(stat.Stats.Y)) {\n return stat.Stats.Y;\n } else if (data_0.has_8xm3sj$(data.TransformVar.Y)) {\n return data.TransformVar.Y;\n }throw IllegalStateException_init(\"Can't apply sampling: couldn't deduce the (Y) variable.\");\n };\n SamplingUtil.prototype.splitRings_dhhkv7$ = function (population) {\n var tmp$, tmp$_0;\n var rings = ArrayList_init();\n var lastPoint = null;\n var start = -1;\n var xValues = Kotlin.isType(tmp$ = population.get_8xm3sj$(this.xVar_dhhkv7$(population)), List) ? tmp$ : throwCCE();\n var yValues = Kotlin.isType(tmp$_0 = population.get_8xm3sj$(this.yVar_dhhkv7$(population)), List) ? tmp$_0 : throwCCE();\n var points = new VertexSampling$DoubleVectorComponentsList(xValues, yValues);\n for (var i = 0; i !== points.size; ++i) {\n var point = points.get_za3lpa$(i);\n if (start < 0) {\n start = i;\n lastPoint = point;\n } else if (equals(lastPoint, point)) {\n rings.add_11rb$(points.subList_vux9f0$(start, i + 1 | 0));\n start = -1;\n lastPoint = null;\n }}\n if (start >= 0) {\n rings.add_11rb$(points.subList_vux9f0$(start, points.size));\n }return rings;\n };\n function SamplingUtil$calculateRingLimits$lambda(closure$rings) {\n return function (it) {\n return new Pair(it, calculateArea(closure$rings.get_za3lpa$(it)));\n };\n }\n function SamplingUtil$calculateRingLimits$lambda_0(this$SamplingUtil) {\n return function (it) {\n return this$SamplingUtil.getRingArea_0(it);\n };\n }\n function SamplingUtil$calculateRingLimits$lambda_1(closure$totalArea, closure$areaProceed, closure$totalPointsLimit, closure$pointsProceed, closure$rings, this$SamplingUtil) {\n return function (p) {\n var a = roundToInt(p.second / (closure$totalArea - closure$areaProceed.get()) * (closure$totalPointsLimit - closure$pointsProceed.get() | 0));\n var b = closure$rings.get_za3lpa$(this$SamplingUtil.getRingIndex_3gcxfl$(p)).size;\n var limit = JsMath.min(a, b);\n if (limit >= 4) {\n closure$areaProceed.getAndAdd_14dthe$(this$SamplingUtil.getRingArea_0(p));\n closure$pointsProceed.getAndAdd_za3lpa$(limit);\n } else {\n limit = 0;\n }\n return new Pair(this$SamplingUtil.getRingIndex_3gcxfl$(p), limit);\n };\n }\n function SamplingUtil$calculateRingLimits$lambda_2(this$SamplingUtil) {\n return function (it) {\n return this$SamplingUtil.getRingIndex_3gcxfl$(it);\n };\n }\n function SamplingUtil$calculateRingLimits$lambda_3(this$SamplingUtil) {\n return function (it) {\n return this$SamplingUtil.getRingLimit_66os8t$(it);\n };\n }\n SamplingUtil.prototype.calculateRingLimits_rmr3bv$ = function (rings, totalPointsLimit) {\n var destination = ArrayList_init_1(collectionSizeOrDefault(rings, 10));\n var tmp$;\n tmp$ = rings.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(calculateArea(item));\n }\n var totalArea = sum(destination);\n var areaProceed = new MutableDouble(0.0);\n var pointsProceed = new MutableInteger(0);\n return toList_0(map(sortedWith_0(map(sortedWith_0(map(asSequence(get_indices(rings)), SamplingUtil$calculateRingLimits$lambda(rings)), reversed(new Comparator(compareBy$lambda_0(SamplingUtil$calculateRingLimits$lambda_0(this))))), SamplingUtil$calculateRingLimits$lambda_1(totalArea, areaProceed, totalPointsLimit, pointsProceed, rings, this)), new Comparator(compareBy$lambda_0(SamplingUtil$calculateRingLimits$lambda_2(this)))), SamplingUtil$calculateRingLimits$lambda_3(this)));\n };\n SamplingUtil.prototype.getRingIndex_3gcxfl$ = function (pair) {\n return pair.first;\n };\n SamplingUtil.prototype.getRingArea_0 = function (pair) {\n return pair.second;\n };\n SamplingUtil.prototype.getRingLimit_66os8t$ = function (pair) {\n return pair.second;\n };\n SamplingUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'SamplingUtil',\n interfaces: []\n };\n var SamplingUtil_instance = null;\n function SamplingUtil_getInstance() {\n if (SamplingUtil_instance === null) {\n new SamplingUtil();\n }return SamplingUtil_instance;\n }\n function SystematicSampling(sampleSize) {\n SystematicSampling$Companion_getInstance();\n SamplingBase.call(this, sampleSize);\n }\n Object.defineProperty(SystematicSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + SystematicSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + ')';\n }\n });\n SystematicSampling.prototype.isApplicable_dhhkv7$ = function (population) {\n return SamplingBase.prototype.isApplicable_dhhkv7$.call(this, population) && this.computeStep_0(population.rowCount()) >= 2;\n };\n SystematicSampling.prototype.apply_dhhkv7$ = function (population) {\n if (!this.isApplicable_dhhkv7$(population)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var popSize = population.rowCount();\n var step = this.computeStep_0(popSize);\n var pickedIndices = ArrayList_init();\n var i = 0;\n while (i < popSize) {\n pickedIndices.add_11rb$(i);\n i = i + step | 0;\n }\n return population.selectIndices_pqoyrt$(pickedIndices);\n };\n SystematicSampling.prototype.computeStep_0 = function (popSize) {\n return numberToInt(round(popSize / (this.sampleSize - 1 | 0)));\n };\n function SystematicSampling$Companion() {\n SystematicSampling$Companion_instance = this;\n this.ALIAS = 'systematic';\n }\n SystematicSampling$Companion.prototype.computeStep_vux9f0$ = function (popSize, sampleSize) {\n return numberToInt(round((popSize - 1 | 0) / (sampleSize - 1 | 0)));\n };\n SystematicSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SystematicSampling$Companion_instance = null;\n function SystematicSampling$Companion_getInstance() {\n if (SystematicSampling$Companion_instance === null) {\n new SystematicSampling$Companion();\n }return SystematicSampling$Companion_instance;\n }\n SystematicSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SystematicSampling',\n interfaces: [PointSampling, SamplingBase]\n };\n function VertexSampling(sampleSize) {\n VertexSampling$Companion_getInstance();\n SamplingBase.call(this, sampleSize);\n }\n VertexSampling.prototype.simplify_0 = function (points, limit) {\n var tmp$;\n if (limit === 0) {\n tmp$ = emptyList();\n } else {\n tmp$ = this.simplifyInternal_11hmxm$(points, limit);\n }\n return tmp$;\n };\n VertexSampling.prototype.apply_dhhkv7$ = function (population) {\n if (!this.isApplicable_dhhkv7$(population)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var rings = SamplingUtil_getInstance().splitRings_dhhkv7$(population);\n var limits = rings.size === 1 && !isClosed(rings.get_za3lpa$(0)) ? listOf(this.sampleSize) : SamplingUtil_getInstance().calculateRingLimits_rmr3bv$(rings, this.sampleSize);\n var indices = ArrayList_init();\n var ringBase = new MutableInteger(0);\n var $receiver = until(0, limits.size);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(new Pair(item, limits.get_za3lpa$(item)));\n }\n var tmp$_0;\n tmp$_0 = destination.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var tmp$_1;\n tmp$_1 = this.simplify_0(rings.get_za3lpa$(SamplingUtil_getInstance().getRingIndex_3gcxfl$(element)), SamplingUtil_getInstance().getRingLimit_66os8t$(element)).iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n indices.add_11rb$(ringBase.get() + element_0 | 0);\n }\n ringBase.getAndAdd_za3lpa$(rings.get_za3lpa$(SamplingUtil_getInstance().getRingIndex_3gcxfl$(element)).size);\n }\n return population.selectIndices_pqoyrt$(indices);\n };\n function VertexSampling$VertexVwSampling(sampleSize) {\n VertexSampling$VertexVwSampling$Companion_getInstance();\n VertexSampling.call(this, sampleSize);\n }\n Object.defineProperty(VertexSampling$VertexVwSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + VertexSampling$VertexVwSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + ')';\n }\n });\n VertexSampling$VertexVwSampling.prototype.simplifyInternal_11hmxm$ = function (points, limit) {\n return PolylineSimplifier.Companion.visvalingamWhyatt_ytws2g$(points).setCountLimit_za3lpa$(limit).indices;\n };\n function VertexSampling$VertexVwSampling$Companion() {\n VertexSampling$VertexVwSampling$Companion_instance = this;\n this.ALIAS = 'vertex_vw';\n }\n VertexSampling$VertexVwSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var VertexSampling$VertexVwSampling$Companion_instance = null;\n function VertexSampling$VertexVwSampling$Companion_getInstance() {\n if (VertexSampling$VertexVwSampling$Companion_instance === null) {\n new VertexSampling$VertexVwSampling$Companion();\n }return VertexSampling$VertexVwSampling$Companion_instance;\n }\n VertexSampling$VertexVwSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VertexVwSampling',\n interfaces: [VertexSampling]\n };\n function VertexSampling$VertexDpSampling(sampleSize) {\n VertexSampling$VertexDpSampling$Companion_getInstance();\n VertexSampling.call(this, sampleSize);\n }\n Object.defineProperty(VertexSampling$VertexDpSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + VertexSampling$VertexDpSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + ')';\n }\n });\n VertexSampling$VertexDpSampling.prototype.simplifyInternal_11hmxm$ = function (points, limit) {\n return PolylineSimplifier.Companion.douglasPeucker_ytws2g$(points).setCountLimit_za3lpa$(limit).indices;\n };\n function VertexSampling$VertexDpSampling$Companion() {\n VertexSampling$VertexDpSampling$Companion_instance = this;\n this.ALIAS = 'vertex_dp';\n }\n VertexSampling$VertexDpSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var VertexSampling$VertexDpSampling$Companion_instance = null;\n function VertexSampling$VertexDpSampling$Companion_getInstance() {\n if (VertexSampling$VertexDpSampling$Companion_instance === null) {\n new VertexSampling$VertexDpSampling$Companion();\n }return VertexSampling$VertexDpSampling$Companion_instance;\n }\n VertexSampling$VertexDpSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VertexDpSampling',\n interfaces: [VertexSampling]\n };\n function VertexSampling$DoubleVectorComponentsList(myXValues, myYValues) {\n AbstractList.call(this);\n this.myXValues_0 = myXValues;\n this.myYValues_0 = myYValues;\n }\n Object.defineProperty(VertexSampling$DoubleVectorComponentsList.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.myXValues_0.size;\n }\n });\n VertexSampling$DoubleVectorComponentsList.prototype.get_za3lpa$ = function (index) {\n return VertexSampling$Companion_getInstance().createPoint_0(this.myXValues_0.get_za3lpa$(index), this.myYValues_0.get_za3lpa$(index));\n };\n VertexSampling$DoubleVectorComponentsList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleVectorComponentsList',\n interfaces: [AbstractList]\n };\n function VertexSampling$Companion() {\n VertexSampling$Companion_instance = this;\n }\n VertexSampling$Companion.prototype.createPoint_0 = function (x, y) {\n var tmp$, tmp$_0;\n if (!!(typeof x === 'string' || typeof y === 'string')) {\n var message = 'String coords are not supported yet';\n throw IllegalArgumentException_init(message.toString());\n }if (!data_0.SeriesUtil.allFinite_jma9l8$(typeof (tmp$ = x) === 'number' ? tmp$ : throwCCE(), typeof (tmp$_0 = y) === 'number' ? tmp$_0 : throwCCE())) {\n var message_0 = 'Invalid coord';\n throw IllegalArgumentException_init(message_0.toString());\n }return new DoubleVector(x, y);\n };\n VertexSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var VertexSampling$Companion_instance = null;\n function VertexSampling$Companion_getInstance() {\n if (VertexSampling$Companion_instance === null) {\n new VertexSampling$Companion();\n }return VertexSampling$Companion_instance;\n }\n VertexSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VertexSampling',\n interfaces: [PointSampling, SamplingBase]\n };\n function ContinuousOnlyMapperProvider(naValue) {\n MapperProviderBase.call(this, naValue);\n }\n function ContinuousOnlyMapperProvider$createDiscreteMapper$lambda(it) {\n return \"'\" + toString(it) + \"'\";\n }\n ContinuousOnlyMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n var domainRepr = joinToString(domainValues, void 0, void 0, void 0, 3, void 0, ContinuousOnlyMapperProvider$createDiscreteMapper$lambda);\n throw IllegalStateException_init('[' + toString(Kotlin.getKClassFromExpression(this).simpleName) + \"] Can't create mapper for discrete domain: \" + domainRepr);\n };\n ContinuousOnlyMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContinuousOnlyMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function DefaultMapperProvider() {\n DefaultMapperProvider_instance = this;\n this.PROVIDER_MAP_0 = new DefaultMapperProvider$TypedMapperProviderMap();\n }\n DefaultMapperProvider.prototype.get_31786j$ = function (aes) {\n return this.PROVIDER_MAP_0.get_lkzxyg$(aes);\n };\n DefaultMapperProvider.prototype.hasDefault_5adj56$ = function (aes) {\n return this.PROVIDER_MAP_0.containsKey_5adj56$(aes);\n };\n function DefaultMapperProvider$TypedMapperProviderMap() {\n DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance();\n this.myMap_0 = HashMap_init();\n var tmp$;\n tmp$ = Aes.Companion.allPositional().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n this.put_0(aes, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_UNDEFINED_0);\n }\n this.put_0(Aes.Companion.X, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.Y, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.Z, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.YMIN, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.YMAX, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.COLOR, DefaultMapperProviderUtil_getInstance().createColorMapperProvider_8be2vx$());\n this.put_0(Aes.Companion.FILL, DefaultMapperProviderUtil_getInstance().createColorMapperProvider_8be2vx$());\n this.put_0(Aes.Companion.ALPHA, AlphaMapperProvider$Companion_getInstance().DEFAULT);\n this.put_0(Aes.Companion.SHAPE, DefaultMapperProviderUtil_getInstance().createWithDiscreteOutput_rath1t$(ShapeMapper_getInstance().allShapes(), ShapeMapper_getInstance().NA_VALUE));\n this.put_0(Aes.Companion.LINETYPE, DefaultMapperProviderUtil_getInstance().createWithDiscreteOutput_rath1t$(LineTypeMapper_getInstance().allLineTypes(), LineTypeMapper_getInstance().NA_VALUE));\n this.put_0(Aes.Companion.SIZE, SizeMapperProvider$Companion_getInstance().DEFAULT);\n this.put_0(Aes.Companion.WIDTH, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.HEIGHT, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.WEIGHT, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.INTERCEPT, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.SLOPE, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.XINTERCEPT, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.YINTERCEPT, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.LOWER, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.MIDDLE, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.UPPER, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.FRAME, DefaultMapperProviderUtil_getInstance().createStringIdentity_kc1el2$(Aes.Companion.FRAME));\n this.put_0(Aes.Companion.SPEED, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.FLOW, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.XMIN, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.XMAX, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.XEND, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.YEND, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.LABEL, DefaultMapperProviderUtil_getInstance().createObjectIdentity_bv5adw$(Aes.Companion.LABEL));\n this.put_0(Aes.Companion.FAMILY, DefaultMapperProviderUtil_getInstance().createStringIdentity_kc1el2$(Aes.Companion.FAMILY));\n this.put_0(Aes.Companion.FONTFACE, DefaultMapperProviderUtil_getInstance().createStringIdentity_kc1el2$(Aes.Companion.FONTFACE));\n this.put_0(Aes.Companion.HJUST, DefaultMapperProviderUtil_getInstance().createObjectIdentityDiscrete_e4pcbt$(Aes.Companion.HJUST));\n this.put_0(Aes.Companion.VJUST, DefaultMapperProviderUtil_getInstance().createObjectIdentityDiscrete_e4pcbt$(Aes.Companion.VJUST));\n this.put_0(Aes.Companion.ANGLE, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.SYM_X, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.SYM_Y, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n }\n DefaultMapperProvider$TypedMapperProviderMap.prototype.get_lkzxyg$ = function (aes) {\n var tmp$;\n return Kotlin.isType(tmp$ = this.myMap_0.get_11rb$(aes), MapperProvider) ? tmp$ : throwCCE();\n };\n DefaultMapperProvider$TypedMapperProviderMap.prototype.put_0 = function (aes, value) {\n this.myMap_0.put_xwzc9p$(aes, value);\n };\n DefaultMapperProvider$TypedMapperProviderMap.prototype.containsKey_5adj56$ = function (aes) {\n return this.myMap_0.containsKey_11rb$(aes);\n };\n function DefaultMapperProvider$TypedMapperProviderMap$Companion() {\n DefaultMapperProvider$TypedMapperProviderMap$Companion_instance = this;\n this.NUMERIC_UNDEFINED_0 = new DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_UNDEFINED$ObjectLiteral();\n this.NUMERIC_IDENTITY_0 = new DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_IDENTITY$ObjectLiteral();\n }\n function DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_UNDEFINED$ObjectLiteral() {\n }\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_UNDEFINED$ObjectLiteral.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return GuideMappers_getInstance().UNDEFINED;\n };\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_UNDEFINED$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return GuideMappers_getInstance().UNDEFINED;\n };\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_UNDEFINED$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [MapperProvider]\n };\n function DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_IDENTITY$ObjectLiteral() {\n }\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_IDENTITY$ObjectLiteral.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return GuideMappers_getInstance().IDENTITY;\n };\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_IDENTITY$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return GuideMappers_getInstance().IDENTITY;\n };\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_IDENTITY$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [MapperProvider]\n };\n DefaultMapperProvider$TypedMapperProviderMap$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DefaultMapperProvider$TypedMapperProviderMap$Companion_instance = null;\n function DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance() {\n if (DefaultMapperProvider$TypedMapperProviderMap$Companion_instance === null) {\n new DefaultMapperProvider$TypedMapperProviderMap$Companion();\n }return DefaultMapperProvider$TypedMapperProviderMap$Companion_instance;\n }\n DefaultMapperProvider$TypedMapperProviderMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TypedMapperProviderMap',\n interfaces: []\n };\n DefaultMapperProvider.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DefaultMapperProvider',\n interfaces: []\n };\n var DefaultMapperProvider_instance = null;\n function DefaultMapperProvider_getInstance() {\n if (DefaultMapperProvider_instance === null) {\n new DefaultMapperProvider();\n }return DefaultMapperProvider_instance;\n }\n function DefaultMapperProviderUtil() {\n DefaultMapperProviderUtil_instance = this;\n }\n function DefaultMapperProviderUtil$createColorMapperProvider$ObjectLiteral(closure$discrete, closure$continuous) {\n this.closure$discrete = closure$discrete;\n this.closure$continuous = closure$continuous;\n }\n DefaultMapperProviderUtil$createColorMapperProvider$ObjectLiteral.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return this.closure$discrete.createDiscreteMapper_7f6uoc$(domainValues);\n };\n DefaultMapperProviderUtil$createColorMapperProvider$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return this.closure$continuous.createContinuousMapper_1g0x2p$(domain, lowerLimit, upperLimit, trans);\n };\n DefaultMapperProviderUtil$createColorMapperProvider$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [MapperProvider]\n };\n DefaultMapperProviderUtil.prototype.createColorMapperProvider_8be2vx$ = function () {\n var discrete = new ColorBrewerMapperProvider(null, null, null, Color.Companion.GRAY);\n var continuous = ColorGradientMapperProvider$Companion_getInstance().DEFAULT;\n return new DefaultMapperProviderUtil$createColorMapperProvider$ObjectLiteral(discrete, continuous);\n };\n function DefaultMapperProviderUtil$createWithDiscreteOutput$ObjectLiteral(closure$outputValues, closure$naValue) {\n this.closure$outputValues = closure$outputValues;\n this.closure$naValue = closure$naValue;\n }\n DefaultMapperProviderUtil$createWithDiscreteOutput$ObjectLiteral.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return GuideMappers_getInstance().discreteToDiscrete_pkbp8v$(domainValues, this.closure$outputValues, this.closure$naValue);\n };\n DefaultMapperProviderUtil$createWithDiscreteOutput$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return GuideMappers_getInstance().continuousToDiscrete_fooeq8$(scale.MapperUtil.rangeWithLimitsAfterTransform_5yamkg$(domain, lowerLimit, upperLimit, trans), this.closure$outputValues, this.closure$naValue);\n };\n DefaultMapperProviderUtil$createWithDiscreteOutput$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [MapperProvider]\n };\n DefaultMapperProviderUtil.prototype.createWithDiscreteOutput_rath1t$ = function (outputValues, naValue) {\n return new DefaultMapperProviderUtil$createWithDiscreteOutput$ObjectLiteral(outputValues, naValue);\n };\n function DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral(inputConverter, naValue) {\n IdentityDiscreteMapperProvider.call(this, inputConverter, naValue);\n }\n function DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral$createContinuousMapper$lambda(it) {\n return it;\n }\n DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return GuideMappers_getInstance().asContinuous_rjdepr$(DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral$createContinuousMapper$lambda);\n };\n DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [IdentityDiscreteMapperProvider]\n };\n function DefaultMapperProviderUtil$createObjectIdentity$DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral_init$lambda(it) {\n return it;\n }\n DefaultMapperProviderUtil.prototype.createObjectIdentity_bv5adw$ = function (aes) {\n return new DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral(DefaultMapperProviderUtil$createObjectIdentity$DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral_init$lambda, null);\n };\n function DefaultMapperProviderUtil$createObjectIdentityDiscrete$lambda(it) {\n return it;\n }\n DefaultMapperProviderUtil.prototype.createObjectIdentityDiscrete_e4pcbt$ = function (aes) {\n var converter = DefaultMapperProviderUtil$createObjectIdentityDiscrete$lambda;\n return this.createIdentityMapperProvider_0(aes, converter, null);\n };\n function DefaultMapperProviderUtil$createStringIdentity$lambda(it) {\n return it != null ? it.toString() : null;\n }\n function DefaultMapperProviderUtil$createStringIdentity$lambda_0(it) {\n return it != null ? it.toString() : null;\n }\n DefaultMapperProviderUtil.prototype.createStringIdentity_kc1el2$ = function (aes) {\n var converter = DefaultMapperProviderUtil$createStringIdentity$lambda;\n var continuousMapper = DefaultMapperProviderUtil$createStringIdentity$lambda_0;\n return this.createIdentityMapperProvider_0(aes, converter, continuousMapper);\n };\n function DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral(closure$continuousMapper, closure$aes, inputConverter, naValue) {\n this.closure$continuousMapper = closure$continuousMapper;\n this.closure$aes = closure$aes;\n IdentityDiscreteMapperProvider.call(this, inputConverter, naValue);\n }\n DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n if (this.closure$continuousMapper != null) {\n return GuideMappers_getInstance().asContinuous_rjdepr$(this.closure$continuousMapper);\n }throw IllegalStateException_init(\"Can't create \" + this.closure$aes + ' mapper for continuous domain ' + domain);\n };\n DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [IdentityDiscreteMapperProvider]\n };\n DefaultMapperProviderUtil.prototype.createIdentityMapperProvider_0 = function (aes, converter, continuousMapper) {\n return new DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral(continuousMapper, aes, converter, DefaultNaValue_getInstance().get_31786j$(aes));\n };\n DefaultMapperProviderUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DefaultMapperProviderUtil',\n interfaces: []\n };\n var DefaultMapperProviderUtil_instance = null;\n function DefaultMapperProviderUtil_getInstance() {\n if (DefaultMapperProviderUtil_instance === null) {\n new DefaultMapperProviderUtil();\n }return DefaultMapperProviderUtil_instance;\n }\n function DefaultNaValue() {\n DefaultNaValue_instance = this;\n this.VALUE_MAP_0 = new TypedKeyHashMap();\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.X, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.Y, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.Z, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.YMIN, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.YMAX, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.COLOR, Color.Companion.GRAY);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.FILL, Color.Companion.GRAY);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.ALPHA, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SHAPE, point.TinyPointShape);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.LINETYPE, NamedLineType.SOLID);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SIZE, aes.AesScaling.sizeFromCircleDiameter_14dthe$(1.0));\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.WIDTH, 1.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.HEIGHT, 1.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.WEIGHT, 1.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.INTERCEPT, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SLOPE, 1.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.XINTERCEPT, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.YINTERCEPT, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.LOWER, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.MIDDLE, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.UPPER, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.FRAME, 'empty frame');\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SPEED, 10.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.FLOW, 0.1);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.XMIN, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.XMAX, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.XEND, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.YEND, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.LABEL, '-');\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.FAMILY, 'sans-serif');\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.FONTFACE, 'plain');\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.HJUST, 0.5);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.VJUST, 0.5);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.ANGLE, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SYM_X, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SYM_Y, 0.0);\n }\n DefaultNaValue.prototype.has_896ixz$ = function (aes) {\n return this.VALUE_MAP_0.containsKey_ex36zt$(aes);\n };\n DefaultNaValue.prototype.get_31786j$ = function (aes) {\n return this.VALUE_MAP_0.get_ex36zt$(aes);\n };\n DefaultNaValue.prototype.get_ex36zt$ = function (aes) {\n return this.VALUE_MAP_0.get_ex36zt$(aes);\n };\n DefaultNaValue.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DefaultNaValue',\n interfaces: []\n };\n var DefaultNaValue_instance = null;\n function DefaultNaValue_getInstance() {\n if (DefaultNaValue_instance === null) {\n new DefaultNaValue();\n }return DefaultNaValue_instance;\n }\n function DiscreteOnlyMapperProvider(naValue) {\n MapperProviderBase.call(this, naValue);\n }\n DiscreteOnlyMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n throw IllegalStateException_init('[' + toString(Kotlin.getKClassFromExpression(this).simpleName) + \"] Can't create mapper for continuous domain \" + domain);\n };\n DiscreteOnlyMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DiscreteOnlyMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function GuideBreak(domainValue, label) {\n this.domainValue = domainValue;\n this.label = label;\n }\n GuideBreak.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GuideBreak',\n interfaces: []\n };\n function GuideMapper() {\n }\n GuideMapper.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GuideMapper',\n interfaces: [Function]\n };\n function MapperProvider() {\n }\n MapperProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'MapperProvider',\n interfaces: []\n };\n function ScaleProvider() {\n }\n ScaleProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ScaleProvider',\n interfaces: []\n };\n function ScaleProviderBuilder(aes) {\n this.aes_0 = aes;\n this._mapperProvider_0 = null;\n this.myName_0 = null;\n this.myBreaks_0 = null;\n this.myLabels_0 = null;\n this.myLabelFormat_0 = null;\n this.myMultiplicativeExpand_0 = null;\n this.myAdditiveExpand_0 = null;\n this.myLimits_0 = null;\n this.myContinuousTransform_0 = transform.Transforms.IDENTITY;\n this.myBreaksGenerator_0 = null;\n this.myDiscreteDomain_0 = false;\n this.myDiscreteDomainReverse_0 = false;\n }\n Object.defineProperty(ScaleProviderBuilder.prototype, 'mapperProvider', {\n configurable: true,\n get: function () {\n var tmp$;\n if (this._mapperProvider_0 == null) {\n this._mapperProvider_0 = DefaultMapperProvider_getInstance().get_31786j$(this.aes_0);\n }tmp$ = this._mapperProvider_0;\n if (tmp$ == null) {\n throw AssertionError_init('Set to null by another thread');\n }return tmp$;\n },\n set: function (p) {\n this._mapperProvider_0 = p;\n }\n });\n ScaleProviderBuilder.prototype.mapperProvider_dw300d$ = function (mapperProvider) {\n this.mapperProvider = mapperProvider;\n return this;\n };\n ScaleProviderBuilder.prototype.name_61zpoe$ = function (name) {\n this.myName_0 = name;\n return this;\n };\n ScaleProviderBuilder.prototype.breaks_pqjuzw$ = function (breaks) {\n this.myBreaks_0 = breaks;\n return this;\n };\n ScaleProviderBuilder.prototype.minorBreaks_NI_d3e2cz$ = function (minorBreaks) {\n throw IllegalStateException_init('Not implemented');\n };\n ScaleProviderBuilder.prototype.labels_mhpeer$ = function (labels) {\n this.myLabels_0 = ArrayList_init_0(labels);\n return this;\n };\n ScaleProviderBuilder.prototype.labelFormat_pdl1vj$ = function (format) {\n this.myLabelFormat_0 = format;\n return this;\n };\n ScaleProviderBuilder.prototype.multiplicativeExpand_14dthe$ = function (v) {\n this.myMultiplicativeExpand_0 = v;\n return this;\n };\n ScaleProviderBuilder.prototype.additiveExpand_14dthe$ = function (v) {\n this.myAdditiveExpand_0 = v;\n return this;\n };\n ScaleProviderBuilder.prototype.limits_9ma18$ = function (v) {\n this.myLimits_0 = v;\n return this;\n };\n ScaleProviderBuilder.prototype.rescaler_NI_za3rmp$ = function (v) {\n throw IllegalStateException_init('Not implemented');\n };\n ScaleProviderBuilder.prototype.oob_NI_za3rmp$ = function (v) {\n throw IllegalStateException_init('Not implemented');\n };\n ScaleProviderBuilder.prototype.continuousTransform_gxz7zd$ = function (v) {\n this.myContinuousTransform_0 = v;\n return this;\n };\n ScaleProviderBuilder.prototype.breaksGenerator_6q5k0b$ = function (v) {\n this.myBreaksGenerator_0 = v;\n return this;\n };\n ScaleProviderBuilder.prototype.guide_NI_za3rmp$ = function (v) {\n throw IllegalStateException_init('Not implemented');\n };\n ScaleProviderBuilder.prototype.discreteDomain_6taknv$ = function (b) {\n this.myDiscreteDomain_0 = b;\n return this;\n };\n ScaleProviderBuilder.prototype.discreteDomainReverse_6taknv$ = function (b) {\n this.myDiscreteDomainReverse_0 = b;\n return this;\n };\n ScaleProviderBuilder.prototype.build = function () {\n return new ScaleProviderBuilder$MyScaleProvider(this);\n };\n function ScaleProviderBuilder$MyScaleProvider(b) {\n this.myName_0 = b.myName_0;\n var tmp$, tmp$_0, tmp$_1;\n this.myLabels_0 = (tmp$ = b.myLabels_0) != null ? ArrayList_init_0(tmp$) : null;\n this.myLabelFormat_0 = b.myLabelFormat_0;\n this.myMultiplicativeExpand_0 = b.myMultiplicativeExpand_0;\n this.myAdditiveExpand_0 = b.myAdditiveExpand_0;\n this.discreteDomainReverse_0 = b.myDiscreteDomainReverse_0;\n this.myBreaksGenerator_0 = b.myBreaksGenerator_0;\n this.myAes_0 = b.aes_0;\n this.discreteDomain_sylt8i$_0 = b.myDiscreteDomain_0;\n this.mapperProvider_yqrzmx$_0 = b.mapperProvider;\n this.breaks_h22v6v$_0 = (tmp$_0 = b.myBreaks_0) != null ? ArrayList_init_0(tmp$_0) : null;\n this.limits_hmyn8j$_0 = (tmp$_1 = b.myLimits_0) != null ? ArrayList_init_0(tmp$_1) : null;\n this.continuousTransform_hc6st8$_0 = b.myContinuousTransform_0;\n }\n Object.defineProperty(ScaleProviderBuilder$MyScaleProvider.prototype, 'discreteDomain', {\n configurable: true,\n get: function () {\n return this.discreteDomain_sylt8i$_0;\n }\n });\n Object.defineProperty(ScaleProviderBuilder$MyScaleProvider.prototype, 'mapperProvider', {\n configurable: true,\n get: function () {\n return this.mapperProvider_yqrzmx$_0;\n }\n });\n Object.defineProperty(ScaleProviderBuilder$MyScaleProvider.prototype, 'breaks', {\n configurable: true,\n get: function () {\n return this.breaks_h22v6v$_0;\n }\n });\n Object.defineProperty(ScaleProviderBuilder$MyScaleProvider.prototype, 'limits', {\n configurable: true,\n get: function () {\n return this.limits_hmyn8j$_0;\n }\n });\n Object.defineProperty(ScaleProviderBuilder$MyScaleProvider.prototype, 'continuousTransform', {\n configurable: true,\n get: function () {\n return this.continuousTransform_hc6st8$_0;\n }\n });\n ScaleProviderBuilder$MyScaleProvider.prototype.scaleName_0 = function (variable) {\n var tmp$;\n return (tmp$ = this.myName_0) != null ? tmp$ : variable.label;\n };\n ScaleProviderBuilder$MyScaleProvider.prototype.createScale_4d40sm$ = function (defaultName, discreteDomain) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var name = (tmp$ = this.myName_0) != null ? tmp$ : defaultName;\n var scale_0;\n var domainValues = filterNotNull(discreteDomain);\n if (discreteDomain.isEmpty()) {\n tmp$_0 = this.absentMapper_0(defaultName);\n } else {\n tmp$_0 = getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_11rb$(p1);\n }.bind(null, this.mapperProvider.createDiscreteMapper_7f6uoc$(domainValues)));\n }\n var mapper = tmp$_0;\n if (this.discreteDomainReverse_0) {\n domainValues = reversed_0(domainValues);\n }scale_0 = scale.Scales.discreteDomain_l9mre7$(name, domainValues, mapper);\n var tmp$_3;\n if ((tmp$_2 = (tmp$_1 = this.limits) != null ? filterNotNull(tmp$_1) : null) != null) {\n var block$result;\n if (this.discreteDomainReverse_0) {\n block$result = reversed_0(tmp$_2);\n } else {\n block$result = tmp$_2;\n }\n tmp$_3 = block$result;\n } else\n tmp$_3 = null;\n var discreteLimits = tmp$_3;\n if (discreteLimits != null) {\n scale_0 = scale_0.with().limits_pqjuzw$(discreteLimits).build();\n }return this.completeScale_0(scale_0);\n };\n function ScaleProviderBuilder$MyScaleProvider$createScale$lambda(closure$mapper) {\n return function (v) {\n return closure$mapper.apply_11rb$(v);\n };\n }\n ScaleProviderBuilder$MyScaleProvider.prototype.createScale_phlls$ = function (defaultName, continuousDomain) {\n var tmp$, tmp$_0, tmp$_1;\n var name = (tmp$ = this.myName_0) != null ? tmp$ : defaultName;\n var scale_0;\n var dataRange = data_0.SeriesUtil.ensureApplicableRange_4am1sd$(continuousDomain);\n var lowerLimit = null;\n var upperLimit = null;\n if (this.limits != null) {\n var lower = true;\n tmp$_0 = this.limits.iterator();\n while (tmp$_0.hasNext()) {\n var limit = tmp$_0.next();\n if (Kotlin.isNumber(limit)) {\n var v = numberToDouble(limit);\n if (isFinite(v)) {\n if (lower) {\n lowerLimit = v;\n } else {\n upperLimit = v;\n }\n }}lower = false;\n }\n }var mapper = this.mapperProvider.createContinuousMapper_1g0x2p$(dataRange, lowerLimit, upperLimit, this.continuousTransform);\n var continuousRange = mapper.isContinuous || this.myAes_0.isNumeric;\n scale_0 = scale.Scales.continuousDomain_lo18em$(name, ScaleProviderBuilder$MyScaleProvider$createScale$lambda(mapper), continuousRange);\n if (Kotlin.isType(mapper, WithGuideBreaks)) {\n Kotlin.isType(tmp$_1 = mapper, WithGuideBreaks) ? tmp$_1 : throwCCE();\n scale_0 = scale_0.with().breaks_pqjuzw$(mapper.breaks).labelFormatter_h0j1qz$(mapper.formatter).build();\n }scale_0 = scale_0.with().continuousTransform_gxz7zd$(this.continuousTransform).build();\n if (this.myBreaksGenerator_0 != null) {\n scale_0 = scale_0.with().breaksGenerator_6q5k0b$(this.myBreaksGenerator_0).build();\n }if (this.limits != null) {\n var with_0 = scale_0.with();\n if (lowerLimit != null) {\n with_0.lowerLimit_14dthe$(lowerLimit);\n }if (upperLimit != null) {\n with_0.upperLimit_14dthe$(upperLimit);\n }scale_0 = with_0.build();\n }return this.completeScale_0(scale_0);\n };\n ScaleProviderBuilder$MyScaleProvider.prototype.completeScale_0 = function (scale) {\n var with_0 = scale.with();\n if (this.breaks != null) {\n with_0.breaks_pqjuzw$(this.breaks);\n }if (this.myLabels_0 != null) {\n with_0.labels_mhpeer$(this.myLabels_0);\n }if (this.myLabelFormat_0 != null) {\n with_0.labelFormatter_h0j1qz$(getCallableRef('format', function ($receiver, p1) {\n return $receiver.format_za3rmp$(p1);\n }.bind(null, StringFormat.Companion.create_w8bwfu$(this.myLabelFormat_0))));\n }if (this.myMultiplicativeExpand_0 != null) {\n with_0.multiplicativeExpand_14dthe$(this.myMultiplicativeExpand_0);\n }if (this.myAdditiveExpand_0 != null) {\n with_0.additiveExpand_14dthe$(this.myAdditiveExpand_0);\n }return with_0.build();\n };\n function ScaleProviderBuilder$MyScaleProvider$absentMapper$lambda(closure$var) {\n return function (v) {\n throw IllegalStateException_init(\"Mapper for empty data series '\" + closure$var.name + \"' was invoked with arg \" + toString(v));\n };\n }\n ScaleProviderBuilder$MyScaleProvider.prototype.absentMapper_1 = function (var_0) {\n return ScaleProviderBuilder$MyScaleProvider$absentMapper$lambda(var_0);\n };\n function ScaleProviderBuilder$MyScaleProvider$absentMapper$lambda_0(closure$label) {\n return function (v) {\n throw IllegalStateException_init(\"Mapper for empty data series '\" + closure$label + \"' was invoked with arg \" + toString(v));\n };\n }\n ScaleProviderBuilder$MyScaleProvider.prototype.absentMapper_0 = function (label) {\n return ScaleProviderBuilder$MyScaleProvider$absentMapper$lambda_0(label);\n };\n ScaleProviderBuilder$MyScaleProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyScaleProvider',\n interfaces: [ScaleProvider]\n };\n ScaleProviderBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ScaleProviderBuilder',\n interfaces: []\n };\n function ScaleProviderHelper() {\n ScaleProviderHelper_instance = this;\n }\n ScaleProviderHelper.prototype.getOrCreateDefault_w8zkza$ = function (aes, providers) {\n var tmp$, tmp$_0;\n if (Aes.Companion.isPositionalX_896ixz$(aes))\n tmp$ = Aes.Companion.X;\n else if (Aes.Companion.isPositionalY_896ixz$(aes))\n tmp$ = Aes.Companion.Y;\n else\n tmp$ = aes;\n var realAes = tmp$;\n return (tmp$_0 = providers.get_11rb$(realAes)) != null ? tmp$_0 : this.createDefault_31786j$(realAes);\n };\n ScaleProviderHelper.prototype.createDefault_31786j$ = function (aes) {\n return (new ScaleProviderBuilder(aes)).build();\n };\n ScaleProviderHelper.prototype.createDefault_1va84n$ = function (aes, name) {\n return (new ScaleProviderBuilder(aes)).name_61zpoe$(name).build();\n };\n ScaleProviderHelper.prototype.create_bqnakv$ = function (name, aes, mapperProvider) {\n return (new ScaleProviderBuilder(aes)).mapperProvider_dw300d$(mapperProvider).name_61zpoe$(name).build();\n };\n ScaleProviderHelper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ScaleProviderHelper',\n interfaces: []\n };\n var ScaleProviderHelper_instance = null;\n function ScaleProviderHelper_getInstance() {\n if (ScaleProviderHelper_instance === null) {\n new ScaleProviderHelper();\n }return ScaleProviderHelper_instance;\n }\n function WithGuideBreaks() {\n }\n WithGuideBreaks.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'WithGuideBreaks',\n interfaces: []\n };\n function ColorMapper() {\n ColorMapper_instance = this;\n this.NA_VALUE = Color.Companion.GRAY;\n this.DEF_GRADIENT_LOW = Color.Companion.parseHex_61zpoe$('#132B43');\n this.DEF_GRADIENT_HIGH = Color.Companion.parseHex_61zpoe$('#56B1F7');\n }\n ColorMapper.prototype.gradientDefault_4fzjta$ = function (domain) {\n return this.gradient_e4qimg$(domain, this.DEF_GRADIENT_LOW, this.DEF_GRADIENT_HIGH, this.NA_VALUE);\n };\n ColorMapper.prototype.gradient_e4qimg$ = function (domain, low, high, naColor) {\n return this.gradientHSV_kw8gff$(domain, values.Colors.hsvFromRgb_98b62m$(low), values.Colors.hsvFromRgb_98b62m$(high), true, naColor);\n };\n ColorMapper.prototype.gradientHSV_kw8gff$ = function (domain, lowHSV, highHSV, autoHueDirection, naColor) {\n return this.gradientHSV_cr3zp$(domain, new HSV(lowHSV[0], lowHSV[1], lowHSV[2]), new HSV(highHSV[0], highHSV[1], highHSV[2]), autoHueDirection, naColor);\n };\n function ColorMapper$gradientHSV$lambda(closure$domain, closure$naColor, closure$mapperH, closure$mapperS, closure$mapperV) {\n return function (input) {\n if (input == null || !closure$domain.contains_mef7kx$(input)) {\n return closure$naColor;\n } else {\n var hue = closure$mapperH(input) % 360;\n var H = hue >= 0 ? hue : 360 + hue;\n var S = closure$mapperS(input);\n var V = closure$mapperV(input);\n return values.Colors.rgbFromHsv_yvo9jy$(H, S, V);\n }\n };\n }\n ColorMapper.prototype.gradientHSV_cr3zp$ = function (domain, lowHSV, highHSV, autoHueDirection, naColor) {\n var lowHue = lowHSV.h;\n var highHue = highHSV.h;\n var lowS = lowHSV.s;\n var highS = highHSV.s;\n if (lowS < 1.0E-4) {\n lowHue = highHue;\n }if (highS < 1.0E-4) {\n highHue = lowHue;\n }if (autoHueDirection) {\n var x = highHue - lowHue;\n var dH = JsMath.abs(x);\n if (dH > 180) {\n if (highHue >= lowHue) {\n lowHue += 360.0;\n } else {\n highHue += 360.0;\n }\n }}var mapperH = scale.Mappers.linear_yl4mmw$(domain, lowHue, highHue, kotlin_js_internal_DoubleCompanionObject.NaN);\n var mapperS = scale.Mappers.linear_yl4mmw$(domain, lowS, highS, kotlin_js_internal_DoubleCompanionObject.NaN);\n var mapperV = scale.Mappers.linear_yl4mmw$(domain, lowHSV.v, highHSV.v, kotlin_js_internal_DoubleCompanionObject.NaN);\n return ColorMapper$gradientHSV$lambda(domain, naColor, mapperH, mapperS, mapperV);\n };\n ColorMapper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ColorMapper',\n interfaces: []\n };\n var ColorMapper_instance = null;\n function ColorMapper_getInstance() {\n if (ColorMapper_instance === null) {\n new ColorMapper();\n }return ColorMapper_instance;\n }\n function GuideMapperAdapter(mapper, isContinuous) {\n this.mapper_0 = mapper;\n this.isContinuous_zgpeec$_0 = isContinuous;\n }\n Object.defineProperty(GuideMapperAdapter.prototype, 'isContinuous', {\n get: function () {\n return this.isContinuous_zgpeec$_0;\n }\n });\n GuideMapperAdapter.prototype.apply_11rb$ = function (value) {\n return this.mapper_0(value);\n };\n GuideMapperAdapter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GuideMapperAdapter',\n interfaces: [GuideMapper]\n };\n function GuideMapperWithGuideBreaks(mapper, breaks, formatter) {\n this.mapper_0 = mapper;\n this.breaks_3tqv0$_0 = breaks;\n this.formatter_dkp6z6$_0 = formatter;\n this.isContinuous_jvxsgv$_0 = false;\n }\n Object.defineProperty(GuideMapperWithGuideBreaks.prototype, 'breaks', {\n get: function () {\n return this.breaks_3tqv0$_0;\n }\n });\n Object.defineProperty(GuideMapperWithGuideBreaks.prototype, 'formatter', {\n get: function () {\n return this.formatter_dkp6z6$_0;\n }\n });\n Object.defineProperty(GuideMapperWithGuideBreaks.prototype, 'isContinuous', {\n configurable: true,\n get: function () {\n return this.isContinuous_jvxsgv$_0;\n }\n });\n GuideMapperWithGuideBreaks.prototype.apply_11rb$ = function (value) {\n return this.mapper_0(value);\n };\n GuideMapperWithGuideBreaks.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GuideMapperWithGuideBreaks',\n interfaces: [WithGuideBreaks, GuideMapper]\n };\n function GuideMappers() {\n GuideMappers_instance = this;\n this.IDENTITY = new GuideMapperAdapter(scale.Mappers.IDENTITY, false);\n this.UNDEFINED = new GuideMapperAdapter(scale.Mappers.undefined_287e2$(), false);\n }\n GuideMappers.prototype.discreteToDiscrete_udkttt$ = function (data, variable, outputValues, naValue) {\n var domainValues = data.distinctValues_8xm3sj$(variable);\n return this.discreteToDiscrete_pkbp8v$(domainValues, outputValues, naValue);\n };\n function GuideMappers$discreteToDiscrete$lambda(v) {\n return v.toString();\n }\n GuideMappers.prototype.discreteToDiscrete_pkbp8v$ = function (domainValues, outputValues, naValue) {\n var mapper = scale.Mappers.discrete_rath1t$(outputValues, naValue);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = domainValues.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n if ((tmp$_0 = element) != null) {\n destination.add_11rb$(tmp$_0);\n }}\n return new GuideMapperWithGuideBreaks(mapper, destination, GuideMappers$discreteToDiscrete$lambda);\n };\n GuideMappers.prototype.continuousToDiscrete_fooeq8$ = function (domain, outputValues, naValue) {\n var mapper = scale.Mappers.quantized_hd8s0$(domain, outputValues, naValue);\n return this.asNotContinuous_rjdepr$(mapper);\n };\n function GuideMappers$discreteToContinuous$lambda(v) {\n return v.toString();\n }\n GuideMappers.prototype.discreteToContinuous_83ntpg$ = function (domainValues, outputRange, naValue) {\n var mapper = scale.Mappers.discreteToContinuous_83ntpg$(domainValues, outputRange, naValue);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = domainValues.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n if ((tmp$_0 = element) != null) {\n destination.add_11rb$(tmp$_0);\n }}\n return new GuideMapperWithGuideBreaks(mapper, destination, GuideMappers$discreteToContinuous$lambda);\n };\n GuideMappers.prototype.continuousToContinuous_lww37m$ = function (domain, range, naValue) {\n return this.asContinuous_rjdepr$(scale.Mappers.linear_lww37m$(domain, range, naValue));\n };\n GuideMappers.prototype.asNotContinuous_rjdepr$ = function (mapper) {\n return new GuideMapperAdapter(mapper, false);\n };\n GuideMappers.prototype.asContinuous_rjdepr$ = function (mapper) {\n return new GuideMapperAdapter(mapper, true);\n };\n GuideMappers.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GuideMappers',\n interfaces: []\n };\n var GuideMappers_instance = null;\n function GuideMappers_getInstance() {\n if (GuideMappers_instance === null) {\n new GuideMappers();\n }return GuideMappers_instance;\n }\n function LineTypeMapper() {\n LineTypeMapper_instance = this;\n this.NA_VALUE = NamedLineType.SOLID;\n }\n LineTypeMapper.prototype.allLineTypes = function () {\n return listOf_0([NamedLineType.SOLID, NamedLineType.DASHED, NamedLineType.DOTTED, NamedLineType.DOTDASH, NamedLineType.LONGDASH, NamedLineType.TWODASH]);\n };\n LineTypeMapper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'LineTypeMapper',\n interfaces: []\n };\n var LineTypeMapper_instance = null;\n function LineTypeMapper_getInstance() {\n if (LineTypeMapper_instance === null) {\n new LineTypeMapper();\n }return LineTypeMapper_instance;\n }\n function ShapeMapper() {\n ShapeMapper_instance = this;\n this.NA_VALUE = point.TinyPointShape;\n }\n ShapeMapper.prototype.allShapes = function () {\n var bestSix = listOf_0([NamedShape.SOLID_CIRCLE, NamedShape.SOLID_TRIANGLE_UP, NamedShape.SOLID_SQUARE, NamedShape.STICK_PLUS, NamedShape.STICK_SQUARE_CROSS, NamedShape.STICK_STAR]);\n var theRest = LinkedHashSet_init_0(listOf_0(NamedShape$values().slice()));\n theRest.removeAll_brywnq$(bestSix);\n var shapes = ArrayList_init_0(bestSix);\n shapes.addAll_brywnq$(theRest);\n return shapes;\n };\n ShapeMapper.prototype.hollowShapes = function () {\n var tmp$;\n var bestThreeHollow = listOf_0([NamedShape.STICK_CIRCLE, NamedShape.STICK_TRIANGLE_UP, NamedShape.STICK_SQUARE]);\n var theRest = LinkedHashSet_init_0(listOf_0(NamedShape$values().slice()));\n theRest.removeAll_brywnq$(bestThreeHollow);\n var shapes = ArrayList_init_0(bestThreeHollow);\n tmp$ = theRest.iterator();\n while (tmp$.hasNext()) {\n var shape = tmp$.next();\n if (shape.isHollow) {\n shapes.add_11rb$(shape);\n }}\n return shapes;\n };\n ShapeMapper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ShapeMapper',\n interfaces: []\n };\n var ShapeMapper_instance = null;\n function ShapeMapper_getInstance() {\n if (ShapeMapper_instance === null) {\n new ShapeMapper();\n }return ShapeMapper_instance;\n }\n function AlphaMapperProvider(range, naValue) {\n AlphaMapperProvider$Companion_getInstance();\n LinearNormalizingMapperProvider.call(this, range, naValue);\n }\n function AlphaMapperProvider$Companion() {\n AlphaMapperProvider$Companion_instance = this;\n this.DEF_RANGE_0 = new ClosedRange(0.1, 1.0);\n this.DEFAULT = new AlphaMapperProvider(this.DEF_RANGE_0, DefaultNaValue_getInstance().get_31786j$(Aes.Companion.ALPHA));\n }\n AlphaMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AlphaMapperProvider$Companion_instance = null;\n function AlphaMapperProvider$Companion_getInstance() {\n if (AlphaMapperProvider$Companion_instance === null) {\n new AlphaMapperProvider$Companion();\n }return AlphaMapperProvider$Companion_instance;\n }\n AlphaMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AlphaMapperProvider',\n interfaces: [LinearNormalizingMapperProvider]\n };\n function ColorBrewerMapperProvider(paletteTypeName, paletteNameOrIndex, direction, naValue) {\n ColorBrewerMapperProvider$Companion_getInstance();\n MapperProviderBase.call(this, naValue);\n this.paletteTypeName_0 = paletteTypeName;\n this.paletteNameOrIndex_0 = paletteNameOrIndex;\n this.direction_0 = direction;\n var tmp$;\n if (!((tmp$ = this.paletteNameOrIndex_0 != null ? typeof this.paletteNameOrIndex_0 === 'string' || Kotlin.isNumber(this.paletteNameOrIndex_0) : null) != null ? tmp$ : true)) {\n var message = ColorBrewerMapperProvider_init$lambda(this)();\n throw IllegalArgumentException_init(message.toString());\n }if (Kotlin.isNumber(this.paletteNameOrIndex_0)) {\n if (!(this.paletteTypeName_0 != null)) {\n var message_0 = \"brewer palette type required: 'seq', 'div' or 'qual'.\";\n throw IllegalArgumentException_init(message_0.toString());\n }}}\n ColorBrewerMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n var colorScheme = this.colorScheme_0(true, domainValues.size);\n var colors = this.colors_0(colorScheme, domainValues.size);\n return GuideMappers_getInstance().discreteToDiscrete_pkbp8v$(domainValues, colors, this.naValue);\n };\n ColorBrewerMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var colorScheme = this.colorScheme_0(false);\n var colors = this.colors_0(colorScheme, colorScheme.maxColors);\n var domain_0 = scale.MapperUtil.rangeWithLimitsAfterTransform_5yamkg$(domain, lowerLimit, upperLimit, trans);\n return GuideMappers_getInstance().continuousToDiscrete_fooeq8$(domain_0, colors, this.naValue);\n };\n ColorBrewerMapperProvider.prototype.colors_0 = function (colorScheme, count) {\n var tmp$, tmp$_0, tmp$_1;\n var colors = color.PaletteUtil.schemeColors_7q5c77$(colorScheme, count);\n tmp$_0 = (tmp$ = this.direction_0 != null ? this.direction_0 < 0 : null) != null ? tmp$ : false;\n if (tmp$_0 === true)\n tmp$_1 = collect.Lists.reverse_bemo1h$(colors);\n else if (tmp$_0 === false)\n tmp$_1 = colors;\n else\n tmp$_1 = Kotlin.noWhenBranchMatched();\n return tmp$_1;\n };\n ColorBrewerMapperProvider.prototype.colorScheme_0 = function (discrete, colorCount) {\n if (colorCount === void 0)\n colorCount = null;\n var tmp$, tmp$_0;\n if (typeof this.paletteNameOrIndex_0 === 'string') {\n var palType = color.PaletteUtil.paletteTypeByPaletteName_61zpoe$(this.paletteNameOrIndex_0);\n if (!(palType != null)) {\n var message = ColorBrewerMapperProvider$Companion_getInstance().cantFindPaletteError_0(this.paletteNameOrIndex_0);\n throw IllegalArgumentException_init(message.toString());\n }tmp$ = palType;\n } else if (this.paletteTypeName_0 != null)\n tmp$ = ColorBrewerMapperProvider$Companion_getInstance().paletteType_0(this.paletteTypeName_0);\n else if (discrete)\n tmp$ = ColorPalette$Type.QUALITATIVE;\n else\n tmp$ = ColorPalette$Type.SEQUENTIAL;\n var paletteType = tmp$;\n if (Kotlin.isNumber(this.paletteNameOrIndex_0))\n tmp$_0 = color.PaletteUtil.colorSchemeByIndex_vfydh1$(paletteType, numberToInt(this.paletteNameOrIndex_0));\n else if (typeof this.paletteNameOrIndex_0 === 'string')\n tmp$_0 = ColorBrewerMapperProvider$Companion_getInstance().colorSchemeByName_0(paletteType, this.paletteNameOrIndex_0);\n else if (paletteType === ColorPalette$Type.QUALITATIVE)\n tmp$_0 = colorCount != null && colorCount <= ColorPalette$Qualitative.Set2.maxColors ? ColorPalette$Qualitative.Set2 : ColorPalette$Qualitative.Set3;\n else\n tmp$_0 = color.PaletteUtil.colorSchemeByIndex_vfydh1$(paletteType, 0);\n return tmp$_0;\n };\n function ColorBrewerMapperProvider$Companion() {\n ColorBrewerMapperProvider$Companion_instance = this;\n }\n ColorBrewerMapperProvider$Companion.prototype.paletteType_0 = function (name) {\n var tmp$;\n if (name == null) {\n return ColorPalette$Type.SEQUENTIAL;\n }switch (name) {\n case 'seq':\n tmp$ = ColorPalette$Type.SEQUENTIAL;\n break;\n case 'div':\n tmp$ = ColorPalette$Type.DIVERGING;\n break;\n case 'qual':\n tmp$ = ColorPalette$Type.QUALITATIVE;\n break;\n default:throw IllegalArgumentException_init(\"Palette type expected one of 'seq' (sequential), 'div' (diverging) or 'qual' (qualitative) but was: '\" + toString(name) + \"'\");\n }\n return tmp$;\n };\n ColorBrewerMapperProvider$Companion.prototype.colorSchemeByName_0 = function (paletteType, paletteName) {\n var tmp$;\n try {\n switch (paletteType.name) {\n case 'SEQUENTIAL':\n tmp$ = ColorPalette$Sequential$valueOf(paletteName);\n break;\n case 'DIVERGING':\n tmp$ = ColorPalette$Diverging$valueOf(paletteName);\n break;\n case 'QUALITATIVE':\n tmp$ = ColorPalette$Qualitative$valueOf(paletteName);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n } catch (ignore) {\n if (Kotlin.isType(ignore, IllegalArgumentException)) {\n throw IllegalArgumentException_init(this.cantFindPaletteError_0(paletteName));\n } else\n throw ignore;\n }\n };\n ColorBrewerMapperProvider$Companion.prototype.cantFindPaletteError_0 = function (paletteName) {\n return trimMargin('\\n' + \" |Brewer palette '\" + paletteName + \"' was not found. \" + '\\n' + ' |Valid palette names are: ' + '\\n' + \" | Type 'seq' (sequential): \" + '\\n' + ' | ' + this.names_0(ColorPalette$Sequential$values()) + ' ' + '\\n' + \" | Type 'div' (diverging): \" + '\\n' + ' | ' + this.names_0(ColorPalette$Diverging$values()) + ' ' + '\\n' + \" | Type 'qual' (qualitative): \" + '\\n' + ' | ' + this.names_0(ColorPalette$Qualitative$values()) + ' ' + '\\n' + ' ');\n };\n function ColorBrewerMapperProvider$Companion$names$lambda(it) {\n return \"'\" + it.name + \"'\";\n }\n ColorBrewerMapperProvider$Companion.prototype.names_0 = function (enums) {\n return joinToString_0(enums, ', ', void 0, void 0, void 0, void 0, ColorBrewerMapperProvider$Companion$names$lambda);\n };\n ColorBrewerMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorBrewerMapperProvider$Companion_instance = null;\n function ColorBrewerMapperProvider$Companion_getInstance() {\n if (ColorBrewerMapperProvider$Companion_instance === null) {\n new ColorBrewerMapperProvider$Companion();\n }return ColorBrewerMapperProvider$Companion_instance;\n }\n function ColorBrewerMapperProvider_init$lambda(this$ColorBrewerMapperProvider) {\n return function () {\n return 'palette: expected a name or index but was: ' + toString(Kotlin.getKClassFromExpression(ensureNotNull(this$ColorBrewerMapperProvider.paletteNameOrIndex_0)).simpleName);\n };\n }\n ColorBrewerMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBrewerMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function ColorGradient2MapperProvider(low, mid, high, midpoint, naValue) {\n ColorGradient2MapperProvider$Companion_getInstance();\n ContinuousOnlyMapperProvider.call(this, naValue);\n this.myLow_0 = null;\n this.myMid_0 = null;\n this.myHigh_0 = null;\n this.myMidpoint_0 = null;\n this.myLow_0 = low != null ? low : ColorGradient2MapperProvider$Companion_getInstance().DEF_GRADIENT_LOW_0;\n this.myMid_0 = mid != null ? mid : ColorGradient2MapperProvider$Companion_getInstance().DEF_GRADIENT_MID_0;\n this.myHigh_0 = high != null ? high : ColorGradient2MapperProvider$Companion_getInstance().DEF_GRADIENT_HIGH_0;\n this.myMidpoint_0 = midpoint != null ? midpoint : 0.0;\n }\n function ColorGradient2MapperProvider$createContinuousMapper$getMapper(closure$rangeMap) {\n return function (v) {\n var tmp$;\n var f_ = null;\n if (data_0.SeriesUtil.isFinite_yrwdxb$(v)) {\n var f_span = kotlin_js_internal_DoubleCompanionObject.NaN;\n tmp$ = closure$rangeMap.keys.iterator();\n while (tmp$.hasNext()) {\n var range = tmp$.next();\n if (range.contains_mef7kx$(ensureNotNull(v))) {\n var span = range.upperEnd - range.lowerEnd;\n if (f_ == null || f_span === 0.0) {\n f_ = closure$rangeMap.get_11rb$(range);\n f_span = span;\n } else if (span < f_span && span > 0) {\n f_ = closure$rangeMap.get_11rb$(range);\n f_span = span;\n }}}\n }return f_;\n };\n }\n function ColorGradient2MapperProvider$createContinuousMapper$lambda(closure$getMapper, this$ColorGradient2MapperProvider) {\n return function (input) {\n var tmp$;\n var mapper = closure$getMapper(input);\n return (tmp$ = mapper != null ? mapper(input) : null) != null ? tmp$ : this$ColorGradient2MapperProvider.naValue;\n };\n }\n ColorGradient2MapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var domain_0 = scale.MapperUtil.rangeWithLimitsAfterTransform_5yamkg$(domain, lowerLimit, upperLimit, trans);\n var tmp$ = domain_0.lowerEnd;\n var a = ensureNotNull(this.myMidpoint_0);\n var b = domain_0.lowerEnd;\n var lowDomain = new ClosedRange(tmp$, JsMath.max(a, b));\n var a_0 = this.myMidpoint_0;\n var b_0 = domain_0.upperEnd;\n var highDomain = new ClosedRange(JsMath.min(a_0, b_0), domain_0.upperEnd);\n var lowMapper = ColorMapper_getInstance().gradient_e4qimg$(lowDomain, this.myLow_0, this.myMid_0, this.naValue);\n var highMapper = ColorMapper_getInstance().gradient_e4qimg$(highDomain, this.myMid_0, this.myHigh_0, this.naValue);\n var rangeMap = mapOf([to(lowDomain, lowMapper), to(highDomain, highMapper)]);\n var getMapper = ColorGradient2MapperProvider$createContinuousMapper$getMapper(rangeMap);\n var mapperFun = ColorGradient2MapperProvider$createContinuousMapper$lambda(getMapper, this);\n return GuideMappers_getInstance().asContinuous_rjdepr$(mapperFun);\n };\n function ColorGradient2MapperProvider$Companion() {\n ColorGradient2MapperProvider$Companion_instance = this;\n this.DEF_GRADIENT_LOW_0 = Color.Companion.parseHex_61zpoe$('#964540');\n this.DEF_GRADIENT_MID_0 = Color.Companion.WHITE;\n this.DEF_GRADIENT_HIGH_0 = Color.Companion.parseHex_61zpoe$('#3B3D96');\n }\n ColorGradient2MapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorGradient2MapperProvider$Companion_instance = null;\n function ColorGradient2MapperProvider$Companion_getInstance() {\n if (ColorGradient2MapperProvider$Companion_instance === null) {\n new ColorGradient2MapperProvider$Companion();\n }return ColorGradient2MapperProvider$Companion_instance;\n }\n ColorGradient2MapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorGradient2MapperProvider',\n interfaces: [ContinuousOnlyMapperProvider]\n };\n function ColorGradientMapperProvider(low, high, naValue) {\n ColorGradientMapperProvider$Companion_getInstance();\n MapperProviderBase.call(this, naValue);\n this.low_0 = low != null ? low : ColorMapper_getInstance().DEF_GRADIENT_LOW;\n this.high_0 = high != null ? high : ColorMapper_getInstance().DEF_GRADIENT_HIGH;\n }\n ColorGradientMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n var domainValuesAsNumbers = scale.MapperUtil.mapDiscreteDomainValuesToNumbers_7f6uoc$(domainValues);\n var mapperDomain = ensureNotNull(data_0.SeriesUtil.range_l63ks6$(domainValuesAsNumbers.values));\n var gradient = ColorMapper_getInstance().gradient_e4qimg$(mapperDomain, this.low_0, this.high_0, this.naValue);\n return GuideMappers_getInstance().asNotContinuous_rjdepr$(gradient);\n };\n ColorGradientMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var domain_0 = scale.MapperUtil.rangeWithLimitsAfterTransform_5yamkg$(domain, lowerLimit, upperLimit, trans);\n var gradient = ColorMapper_getInstance().gradient_e4qimg$(domain_0, this.low_0, this.high_0, this.naValue);\n return GuideMappers_getInstance().asContinuous_rjdepr$(gradient);\n };\n function ColorGradientMapperProvider$Companion() {\n ColorGradientMapperProvider$Companion_instance = this;\n this.DEFAULT = new ColorGradientMapperProvider(null, null, ColorMapper_getInstance().NA_VALUE);\n }\n ColorGradientMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorGradientMapperProvider$Companion_instance = null;\n function ColorGradientMapperProvider$Companion_getInstance() {\n if (ColorGradientMapperProvider$Companion_instance === null) {\n new ColorGradientMapperProvider$Companion();\n }return ColorGradientMapperProvider$Companion_instance;\n }\n ColorGradientMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorGradientMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function ColorHueMapperProvider(hueRange, chroma, luminance, startHue, direction, naValue) {\n ColorHueMapperProvider$Companion_getInstance();\n HSVColorMapperProvider.call(this, naValue);\n this.myFromHSV_0 = null;\n this.myToHSV_0 = null;\n this.myHSVIntervals_0 = null;\n var tmp$;\n var hueRange_0 = ColorHueMapperProvider$Companion_getInstance().normalizeHueRange_0(hueRange);\n var clockwise = direction == null || direction !== -1.0;\n var fromHue = clockwise ? hueRange_0.lowerEnd : hueRange_0.upperEnd;\n var toHue = clockwise ? hueRange_0.upperEnd : hueRange_0.lowerEnd;\n var startHue_0 = startHue != null ? startHue : ColorHueMapperProvider$Companion_getInstance().DEF_START_HUE_0;\n if (hueRange_0.contains_mef7kx$(startHue_0) && startHue_0 - hueRange_0.lowerEnd > 1 && hueRange_0.upperEnd - startHue_0 > 1) {\n tmp$ = listOf_0([to(startHue_0, toHue), to(fromHue, startHue_0)]);\n } else {\n tmp$ = listOf(to(fromHue, toHue));\n }\n var hueIntervals = tmp$;\n var saturation = (chroma != null ? chroma % 100 : ColorHueMapperProvider$Companion_getInstance().DEF_SATURATION_0) / 100;\n var value = (luminance != null ? luminance % 100 : ColorHueMapperProvider$Companion_getInstance().DEF_VALUE_0) / 100;\n var destination = ArrayList_init_1(collectionSizeOrDefault(hueIntervals, 10));\n var tmp$_0;\n tmp$_0 = hueIntervals.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(to(new HSV(item.first, saturation, value), new HSV(item.second, saturation, value)));\n }\n this.myHSVIntervals_0 = destination;\n this.myFromHSV_0 = new HSV(fromHue, saturation, value);\n this.myToHSV_0 = new HSV(toHue, saturation, value);\n }\n ColorHueMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return this.createDiscreteMapper_q8tf2k$(domainValues, this.myFromHSV_0, this.myToHSV_0);\n };\n ColorHueMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var domain_0 = scale.MapperUtil.rangeWithLimitsAfterTransform_5yamkg$(domain, lowerLimit, upperLimit, trans);\n return this.createContinuousMapper_ytjjc$(domain_0, this.myHSVIntervals_0);\n };\n function ColorHueMapperProvider$Companion() {\n ColorHueMapperProvider$Companion_instance = this;\n this.DEF_SATURATION_0 = 50.0;\n this.DEF_VALUE_0 = 90.0;\n this.DEF_START_HUE_0 = 0.0;\n this.DEF_HUE_RANGE_0 = new ClosedRange(15.0, 375.0);\n this.DEFAULT = new ColorHueMapperProvider(null, null, null, null, null, Color.Companion.GRAY);\n }\n ColorHueMapperProvider$Companion.prototype.normalizeHueRange_0 = function (hueRange) {\n var tmp$;\n if (hueRange == null || hueRange.size !== 2) {\n tmp$ = this.DEF_HUE_RANGE_0;\n } else {\n var a = hueRange.get_za3lpa$(0);\n var b = hueRange.get_za3lpa$(1);\n var tmp$_0 = JsMath.min(a, b);\n var a_0 = hueRange.get_za3lpa$(0);\n var b_0 = hueRange.get_za3lpa$(1);\n tmp$ = new ClosedRange(tmp$_0, JsMath.max(a_0, b_0));\n }\n return tmp$;\n };\n ColorHueMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorHueMapperProvider$Companion_instance = null;\n function ColorHueMapperProvider$Companion_getInstance() {\n if (ColorHueMapperProvider$Companion_instance === null) {\n new ColorHueMapperProvider$Companion();\n }return ColorHueMapperProvider$Companion_instance;\n }\n ColorHueMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorHueMapperProvider',\n interfaces: [HSVColorMapperProvider]\n };\n function DirectlyProportionalMapperProvider(max, naValue) {\n ContinuousOnlyMapperProvider.call(this, naValue);\n this.max_ks8piw$_0 = max;\n }\n DirectlyProportionalMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var dataMax = scale.MapperUtil.rangeWithLimitsAfterTransform_5yamkg$(domain, lowerLimit, upperLimit, trans).upperEnd;\n return GuideMappers_getInstance().continuousToContinuous_lww37m$(new ClosedRange(0.0, dataMax), new ClosedRange(0.0, this.max_ks8piw$_0), this.naValue);\n };\n DirectlyProportionalMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DirectlyProportionalMapperProvider',\n interfaces: [ContinuousOnlyMapperProvider]\n };\n function GreyscaleLightnessMapperProvider(start, end, naValue) {\n GreyscaleLightnessMapperProvider$Companion_getInstance();\n HSVColorMapperProvider.call(this, naValue);\n this.myFromHSV_0 = null;\n this.myToHSV_0 = null;\n var value0 = start != null ? start : GreyscaleLightnessMapperProvider$Companion_getInstance().DEF_START_0;\n var value1 = end != null ? end : GreyscaleLightnessMapperProvider$Companion_getInstance().DEF_END_0;\n if (!rangeTo(0.0, 1.0).contains_mef7kx$(value0)) {\n var message = \"Value of 'start' must be in range: [0,1]: \" + toString(start);\n throw IllegalArgumentException_init(message.toString());\n }if (!rangeTo(0.0, 1.0).contains_mef7kx$(value1)) {\n var message_0 = \"Value of 'end' must be in range: [0,1]: \" + toString(end);\n throw IllegalArgumentException_init(message_0.toString());\n }this.myFromHSV_0 = new HSV(0.0, 0.0, value0);\n this.myToHSV_0 = new HSV(0.0, 0.0, value1);\n }\n GreyscaleLightnessMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return this.createDiscreteMapper_q8tf2k$(domainValues, this.myFromHSV_0, this.myToHSV_0);\n };\n GreyscaleLightnessMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var domain_0 = scale.MapperUtil.rangeWithLimitsAfterTransform_5yamkg$(domain, lowerLimit, upperLimit, trans);\n return this.createContinuousMapper_ytjjc$(domain_0, listOf(to(this.myFromHSV_0, this.myToHSV_0)));\n };\n function GreyscaleLightnessMapperProvider$Companion() {\n GreyscaleLightnessMapperProvider$Companion_instance = this;\n this.DEF_START_0 = 0.2;\n this.DEF_END_0 = 0.8;\n }\n GreyscaleLightnessMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GreyscaleLightnessMapperProvider$Companion_instance = null;\n function GreyscaleLightnessMapperProvider$Companion_getInstance() {\n if (GreyscaleLightnessMapperProvider$Companion_instance === null) {\n new GreyscaleLightnessMapperProvider$Companion();\n }return GreyscaleLightnessMapperProvider$Companion_instance;\n }\n GreyscaleLightnessMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GreyscaleLightnessMapperProvider',\n interfaces: [HSVColorMapperProvider]\n };\n function HSVColorMapperProvider(naValue) {\n HSVColorMapperProvider$Companion_getInstance();\n MapperProviderBase.call(this, naValue);\n }\n HSVColorMapperProvider.prototype.createDiscreteMapper_q8tf2k$ = function (domainValues, fromHSV, toHSV) {\n var domainValuesAsNumbers = scale.MapperUtil.mapDiscreteDomainValuesToNumbers_7f6uoc$(domainValues);\n var mapperDomain = data_0.SeriesUtil.ensureApplicableRange_4am1sd$(data_0.SeriesUtil.range_l63ks6$(domainValuesAsNumbers.values));\n var newFromHue = fromHSV.h;\n var newToHue = toHSV.h;\n if (domainValues.size > 1) {\n var x = toHSV.h % 360 - fromHSV.h % 360;\n var hueDiff = JsMath.abs(x);\n var step = (toHSV.h - fromHSV.h) / domainValues.size;\n if (hueDiff < JsMath.abs(step) / 2) {\n newFromHue = fromHSV.h + step / 2;\n newToHue = toHSV.h - step / 2;\n }}var gradient = ColorMapper_getInstance().gradientHSV_cr3zp$(mapperDomain, new HSV(newFromHue, fromHSV.s, fromHSV.v), new HSV(newToHue, toHSV.s, toHSV.v), false, this.naValue);\n return GuideMappers_getInstance().asNotContinuous_rjdepr$(gradient);\n };\n HSVColorMapperProvider.prototype.createContinuousMapper_ytjjc$ = function (domain, hsvIntervals) {\n var tmp$;\n switch (hsvIntervals.size) {\n case 0:\n throw IllegalArgumentException_init('Empty HSV intervals.');\n case 1:\n tmp$ = ColorMapper_getInstance().gradientHSV_cr3zp$(domain, hsvIntervals.get_za3lpa$(0).first, hsvIntervals.get_za3lpa$(0).second, false, this.naValue);\n break;\n default:tmp$ = HSVColorMapperProvider$Companion_getInstance().createCompositeColorMapper_0(domain, hsvIntervals, false, this.naValue);\n break;\n }\n var gradientMapper = tmp$;\n return GuideMappers_getInstance().asContinuous_rjdepr$(gradientMapper);\n };\n function HSVColorMapperProvider$Companion() {\n HSVColorMapperProvider$Companion_instance = this;\n }\n function HSVColorMapperProvider$Companion$createCompositeColorMapper$lambda(closure$naColor, closure$colorMappersPerSubDomain) {\n return function (v) {\n var tmp$, tmp$_0;\n if (v == null) {\n return closure$naColor;\n } else {\n var $receiver = closure$colorMappersPerSubDomain;\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n if (element.first.contains_mef7kx$(v)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n var mapper = (tmp$ = firstOrNull$result) != null ? tmp$.second : null;\n return (tmp$_0 = mapper != null ? mapper(v) : null) != null ? tmp$_0 : closure$naColor;\n }\n };\n }\n HSVColorMapperProvider$Companion.prototype.createCompositeColorMapper_0 = function (domain, hsvIntervals, autoHueDirection, naColor) {\n var colorMappersPerSubDomain = this.createColorMappersPerSubDomain_0(domain, hsvIntervals, autoHueDirection, naColor);\n return HSVColorMapperProvider$Companion$createCompositeColorMapper$lambda(naColor, colorMappersPerSubDomain);\n };\n HSVColorMapperProvider$Companion.prototype.createColorMappersPerSubDomain_0 = function (domain, hsvIntervals, autoHueDirection, naColor) {\n var subDomains = this.splitContinuousDomain_0(domain, hsvIntervals);\n var $receiver = zip(subDomains, hsvIntervals);\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var domain_0 = item.first;\n var hsvInterval = item.second;\n destination.add_11rb$(new Pair_0(domain_0, ColorMapper_getInstance().gradientHSV_cr3zp$(domain_0, hsvInterval.first, hsvInterval.second, autoHueDirection, naColor)));\n }\n return destination;\n };\n HSVColorMapperProvider$Companion.prototype.splitContinuousDomain_0 = function (domain, hsvIntervals) {\n var tmp$;\n var domainSize = domain.upperEnd - domain.lowerEnd;\n var destination = ArrayList_init_1(collectionSizeOrDefault(hsvIntervals, 10));\n var tmp$_0;\n tmp$_0 = hsvIntervals.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n var tmp$_1 = destination.add_11rb$;\n var x = item.first.h - item.second.h;\n tmp$_1.call(destination, JsMath.abs(x));\n }\n var hueIntervalSizeList = destination;\n var hueIntervalsTotalSize = sum(hueIntervalSizeList);\n var domainToHueIntevalRatio = domainSize / hueIntervalsTotalSize;\n var subDomains = ArrayList_init();\n var lowerEnd = domain.lowerEnd;\n tmp$ = hueIntervalSizeList.iterator();\n while (tmp$.hasNext()) {\n var hueIntervalSize = tmp$.next();\n var upperEnd = lowerEnd + hueIntervalSize * domainToHueIntevalRatio;\n subDomains.add_11rb$(new ClosedRange(lowerEnd, upperEnd));\n lowerEnd = upperEnd;\n }\n return subDomains;\n };\n HSVColorMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HSVColorMapperProvider$Companion_instance = null;\n function HSVColorMapperProvider$Companion_getInstance() {\n if (HSVColorMapperProvider$Companion_instance === null) {\n new HSVColorMapperProvider$Companion();\n }return HSVColorMapperProvider$Companion_instance;\n }\n HSVColorMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HSVColorMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function IdentityDiscreteMapperProvider(inputConverter, naValue) {\n DiscreteOnlyMapperProvider.call(this, naValue);\n this.inputConverter_lfub5e$_0 = inputConverter;\n }\n IdentityDiscreteMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n var tmp$, tmp$_0;\n var outputValues = ArrayList_init();\n tmp$ = domainValues.iterator();\n while (tmp$.hasNext()) {\n var inputValue = tmp$.next();\n if (inputValue == null) {\n outputValues.add_11rb$(this.naValue);\n } else {\n tmp$_0 = this.inputConverter_lfub5e$_0(inputValue);\n if (tmp$_0 == null) {\n throw IllegalStateException_init(\"Can't map input value \" + toString(inputValue) + ' to output type');\n }var outputValue = tmp$_0;\n outputValues.add_11rb$(outputValue);\n }\n }\n return GuideMappers_getInstance().discreteToDiscrete_pkbp8v$(domainValues, outputValues, this.naValue);\n };\n IdentityDiscreteMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'IdentityDiscreteMapperProvider',\n interfaces: [DiscreteOnlyMapperProvider]\n };\n function IdentityMapperProvider(discreteMapperProvider, continuousMapper) {\n this.discreteMapperProvider_0 = discreteMapperProvider;\n this.continuousMapper_0 = continuousMapper;\n }\n IdentityMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return this.discreteMapperProvider_0.createDiscreteMapper_7f6uoc$(domainValues);\n };\n IdentityMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return GuideMappers_getInstance().asContinuous_rjdepr$(this.continuousMapper_0);\n };\n IdentityMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'IdentityMapperProvider',\n interfaces: [MapperProvider]\n };\n function LinearNormalizingMapperProvider(outputRange, naValue) {\n MapperProviderBase.call(this, naValue);\n this.outputRange_73yg7w$_0 = outputRange;\n }\n LinearNormalizingMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return GuideMappers_getInstance().discreteToContinuous_83ntpg$(domainValues, this.outputRange_73yg7w$_0, this.naValue);\n };\n LinearNormalizingMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var dataRange = scale.MapperUtil.rangeWithLimitsAfterTransform_5yamkg$(domain, lowerLimit, upperLimit, trans);\n return GuideMappers_getInstance().continuousToContinuous_lww37m$(dataRange, this.outputRange_73yg7w$_0, this.naValue);\n };\n LinearNormalizingMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinearNormalizingMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function MapperProviderBase(naValue) {\n this.naValue = naValue;\n }\n MapperProviderBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MapperProviderBase',\n interfaces: [MapperProvider]\n };\n function SizeAreaMapperProvider(max, naValue) {\n SizeAreaMapperProvider$Companion_getInstance();\n DirectlyProportionalMapperProvider.call(this, max != null ? max : SizeAreaMapperProvider$Companion_getInstance().DEF_MAX, naValue);\n }\n function SizeAreaMapperProvider$Companion() {\n SizeAreaMapperProvider$Companion_instance = this;\n this.DEF_MAX = aes.AesScaling.sizeFromCircleDiameter_14dthe$(21.0);\n }\n SizeAreaMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SizeAreaMapperProvider$Companion_instance = null;\n function SizeAreaMapperProvider$Companion_getInstance() {\n if (SizeAreaMapperProvider$Companion_instance === null) {\n new SizeAreaMapperProvider$Companion();\n }return SizeAreaMapperProvider$Companion_instance;\n }\n SizeAreaMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SizeAreaMapperProvider',\n interfaces: [DirectlyProportionalMapperProvider]\n };\n function SizeMapperProvider(range, naValue) {\n SizeMapperProvider$Companion_getInstance();\n LinearNormalizingMapperProvider.call(this, range, naValue);\n }\n function SizeMapperProvider$Companion() {\n SizeMapperProvider$Companion_instance = this;\n this.DEF_RANGE_0 = new ClosedRange(aes.AesScaling.sizeFromCircleDiameter_14dthe$(3.0), aes.AesScaling.sizeFromCircleDiameter_14dthe$(21.0));\n this.DEFAULT = new SizeMapperProvider(this.DEF_RANGE_0, DefaultNaValue_getInstance().get_31786j$(Aes.Companion.SIZE));\n }\n SizeMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SizeMapperProvider$Companion_instance = null;\n function SizeMapperProvider$Companion_getInstance() {\n if (SizeMapperProvider$Companion_instance === null) {\n new SizeMapperProvider$Companion();\n }return SizeMapperProvider$Companion_instance;\n }\n SizeMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SizeMapperProvider',\n interfaces: [LinearNormalizingMapperProvider]\n };\n function AxisTheme() {\n }\n AxisTheme.prototype.tickLabelDistance = function () {\n var result = this.tickMarkPadding();\n if (this.showTickMarks()) {\n result += this.tickMarkLength();\n }return result;\n };\n AxisTheme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'AxisTheme',\n interfaces: []\n };\n function DefaultAxisTheme() {\n }\n DefaultAxisTheme.prototype.showLine = function () {\n return true;\n };\n DefaultAxisTheme.prototype.showTickMarks = function () {\n return true;\n };\n DefaultAxisTheme.prototype.showTickLabels = function () {\n return true;\n };\n DefaultAxisTheme.prototype.showTitle = function () {\n return true;\n };\n DefaultAxisTheme.prototype.showTooltip = function () {\n return true;\n };\n DefaultAxisTheme.prototype.lineWidth = function () {\n return Defaults$Plot$Axis_getInstance().LINE_WIDTH;\n };\n DefaultAxisTheme.prototype.tickMarkWidth = function () {\n return Defaults$Plot$Axis_getInstance().TICK_LINE_WIDTH;\n };\n DefaultAxisTheme.prototype.tickMarkLength = function () {\n return 6.0;\n };\n DefaultAxisTheme.prototype.tickMarkPadding = function () {\n return 3.0;\n };\n DefaultAxisTheme.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DefaultAxisTheme',\n interfaces: [AxisTheme]\n };\n function DefaultTheme() {\n DefaultTheme$Companion_getInstance();\n }\n DefaultTheme.prototype.axisX = function () {\n return DefaultTheme$Companion_getInstance().AXIS_THEME_0;\n };\n DefaultTheme.prototype.axisY = function () {\n return DefaultTheme$Companion_getInstance().AXIS_THEME_0;\n };\n DefaultTheme.prototype.legend = function () {\n return DefaultTheme$Companion_getInstance().LEGEND_THEME_0;\n };\n DefaultTheme.prototype.facets = function () {\n return DefaultTheme$Companion_getInstance().FACETS_THEME_0;\n };\n DefaultTheme.prototype.plot = function () {\n return DefaultTheme$Companion_getInstance().PLOT_THEME_0;\n };\n function DefaultTheme$multiTile$ObjectLiteral() {\n DefaultTheme.call(this);\n }\n DefaultTheme$multiTile$ObjectLiteral.prototype.axisX = function () {\n return DefaultTheme$Companion_getInstance().AXIS_THEME_MULTI_TILE_0;\n };\n DefaultTheme$multiTile$ObjectLiteral.prototype.axisY = function () {\n return DefaultTheme$Companion_getInstance().AXIS_THEME_MULTI_TILE_0;\n };\n DefaultTheme$multiTile$ObjectLiteral.prototype.plot = function () {\n return DefaultTheme$Companion_getInstance().PLOT_THEME_MULTI_TILE_0;\n };\n DefaultTheme$multiTile$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DefaultTheme]\n };\n DefaultTheme.prototype.multiTile = function () {\n return new DefaultTheme$multiTile$ObjectLiteral();\n };\n function DefaultTheme$Companion() {\n DefaultTheme$Companion_instance = this;\n this.AXIS_THEME_0 = new DefaultAxisTheme();\n this.AXIS_THEME_MULTI_TILE_0 = new DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral();\n this.LEGEND_THEME_0 = new DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral();\n this.FACETS_THEME_0 = new DefaultTheme$Companion$FACETS_THEME$ObjectLiteral();\n this.PLOT_THEME_0 = new DefaultTheme$Companion$PLOT_THEME$ObjectLiteral();\n this.PLOT_THEME_MULTI_TILE_0 = new DefaultTheme$Companion$PLOT_THEME_MULTI_TILE$ObjectLiteral();\n }\n function DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral() {\n DefaultAxisTheme.call(this);\n }\n DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral.prototype.showLine = function () {\n return false;\n };\n DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DefaultAxisTheme]\n };\n function DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral() {\n }\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.keySize = function () {\n return 23.0;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.margin = function () {\n return 5.0;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.padding = function () {\n return 5.0;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.position = function () {\n return LegendPosition$Companion_getInstance().RIGHT;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.justification = function () {\n return LegendJustification$Companion_getInstance().CENTER;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.direction = function () {\n return LegendDirection$AUTO_getInstance();\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.backgroundFill = function () {\n return Color.Companion.WHITE;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [LegendTheme]\n };\n function DefaultTheme$Companion$FACETS_THEME$ObjectLiteral() {\n }\n DefaultTheme$Companion$FACETS_THEME$ObjectLiteral.prototype.labelBackground = function () {\n return values.Colors.lighter_o14uds$(Color.Companion.VERY_LIGHT_GRAY, 0.9);\n };\n DefaultTheme$Companion$FACETS_THEME$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [FacetsTheme]\n };\n function DefaultTheme$Companion$PLOT_THEME$ObjectLiteral() {\n }\n DefaultTheme$Companion$PLOT_THEME$ObjectLiteral.prototype.showInnerFrame = function () {\n return false;\n };\n DefaultTheme$Companion$PLOT_THEME$ObjectLiteral.prototype.innerFrameColor = function () {\n throw IllegalStateException_init(\"The `innerFrameColor()` method shouldn't be used.\");\n };\n DefaultTheme$Companion$PLOT_THEME$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PlotTheme]\n };\n function DefaultTheme$Companion$PLOT_THEME_MULTI_TILE$ObjectLiteral() {\n }\n DefaultTheme$Companion$PLOT_THEME_MULTI_TILE$ObjectLiteral.prototype.showInnerFrame = function () {\n return true;\n };\n DefaultTheme$Companion$PLOT_THEME_MULTI_TILE$ObjectLiteral.prototype.innerFrameColor = function () {\n return values.Colors.lighter_o14uds$(Color.Companion.VERY_LIGHT_GRAY, 0.9);\n };\n DefaultTheme$Companion$PLOT_THEME_MULTI_TILE$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PlotTheme]\n };\n DefaultTheme$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DefaultTheme$Companion_instance = null;\n function DefaultTheme$Companion_getInstance() {\n if (DefaultTheme$Companion_instance === null) {\n new DefaultTheme$Companion();\n }return DefaultTheme$Companion_instance;\n }\n DefaultTheme.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DefaultTheme',\n interfaces: [Theme]\n };\n function FacetsTheme() {\n }\n FacetsTheme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'FacetsTheme',\n interfaces: []\n };\n function LegendTheme() {\n }\n LegendTheme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LegendTheme',\n interfaces: []\n };\n function PlotTheme() {\n }\n PlotTheme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PlotTheme',\n interfaces: []\n };\n function Theme() {\n }\n Theme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Theme',\n interfaces: []\n };\n function ConstantValue(value, format) {\n if (format === void 0)\n format = null;\n this.value_0 = value;\n this.format_0 = format;\n var tmp$;\n if (this.format_0 != null) {\n tmp$ = StringFormat.Companion.create_w8bwfu$(this.format_0).format_za3rmp$(this.value_0);\n } else {\n tmp$ = this.value_0.toString();\n }\n this.myDataValue_0 = tmp$;\n this.isOutlier_efnf0i$_0 = false;\n this.isAxis_i12u4n$_0 = false;\n }\n Object.defineProperty(ConstantValue.prototype, 'isOutlier', {\n configurable: true,\n get: function () {\n return this.isOutlier_efnf0i$_0;\n }\n });\n Object.defineProperty(ConstantValue.prototype, 'isAxis', {\n configurable: true,\n get: function () {\n return this.isAxis_i12u4n$_0;\n }\n });\n ConstantValue.prototype.initDataContext_rxi9tf$ = function (dataContext) {\n };\n ConstantValue.prototype.getDataPoint_za3lpa$ = function (index) {\n return new TooltipLineSpec$DataPoint('', this.myDataValue_0, null, false, false);\n };\n ConstantValue.prototype.copy = function () {\n return new ConstantValue(this.value_0, this.format_0);\n };\n ConstantValue.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ConstantValue',\n interfaces: [ValueSource]\n };\n function DataFrameValue(name, format) {\n if (format === void 0)\n format = null;\n this.name_0 = name;\n this.format_0 = format;\n this.myDataFrame_v9hm26$_0 = this.myDataFrame_v9hm26$_0;\n this.myVariable_u4q8p$_0 = this.myVariable_u4q8p$_0;\n this.myFormatter_0 = this.format_0 != null ? StringFormat.Companion.forOneArg_86f9bg$(this.format_0, void 0, this.name_0) : null;\n this.isOutlier_h13ss7$_0 = false;\n this.isAxis_5xgnmk$_0 = false;\n }\n Object.defineProperty(DataFrameValue.prototype, 'myDataFrame_0', {\n configurable: true,\n get: function () {\n if (this.myDataFrame_v9hm26$_0 == null)\n return throwUPAE('myDataFrame');\n return this.myDataFrame_v9hm26$_0;\n },\n set: function (myDataFrame) {\n this.myDataFrame_v9hm26$_0 = myDataFrame;\n }\n });\n Object.defineProperty(DataFrameValue.prototype, 'myVariable_0', {\n configurable: true,\n get: function () {\n if (this.myVariable_u4q8p$_0 == null)\n return throwUPAE('myVariable');\n return this.myVariable_u4q8p$_0;\n },\n set: function (myVariable) {\n this.myVariable_u4q8p$_0 = myVariable;\n }\n });\n Object.defineProperty(DataFrameValue.prototype, 'isOutlier', {\n configurable: true,\n get: function () {\n return this.isOutlier_h13ss7$_0;\n }\n });\n Object.defineProperty(DataFrameValue.prototype, 'isAxis', {\n configurable: true,\n get: function () {\n return this.isAxis_5xgnmk$_0;\n }\n });\n DataFrameValue.prototype.initDataContext_rxi9tf$ = function (dataContext) {\n if (!(this.myDataFrame_v9hm26$_0 == null)) {\n var message = 'Data context can be initialized only once';\n throw IllegalArgumentException_init(message.toString());\n }this.myDataFrame_0 = dataContext.dataFrame;\n this.myVariable_0 = data.DataFrameUtil.findVariableOrFail_vede35$(this.myDataFrame_0, this.name_0);\n };\n DataFrameValue.prototype.getDataPoint_za3lpa$ = function (index) {\n var tmp$, tmp$_0, tmp$_1;\n tmp$ = this.myDataFrame_0.get_8xm3sj$(this.myVariable_0).get_za3lpa$(index);\n if (tmp$ == null) {\n return null;\n }var originalValue = tmp$;\n return new TooltipLineSpec$DataPoint(this.name_0, (tmp$_1 = (tmp$_0 = this.myFormatter_0) != null ? tmp$_0.format_za3rmp$(originalValue) : null) != null ? tmp$_1 : originalValue.toString(), null, false, false);\n };\n DataFrameValue.prototype.copy = function () {\n return new DataFrameValue(this.name_0, this.format_0);\n };\n DataFrameValue.prototype.getVariableName = function () {\n return this.name_0;\n };\n DataFrameValue.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataFrameValue',\n interfaces: [ValueSource]\n };\n function MappingValue(aes, isOutlier, isAxis, format) {\n if (isOutlier === void 0)\n isOutlier = false;\n if (isAxis === void 0)\n isAxis = false;\n if (format === void 0)\n format = null;\n this.aes = aes;\n this.isOutlier_cyn2n6$_0 = isOutlier;\n this.isAxis_ohfp7r$_0 = isAxis;\n this.format_0 = format;\n this.myDataAccess_biypgq$_0 = this.myDataAccess_biypgq$_0;\n this.myDataLabel_0 = null;\n this.myFormatter_0 = this.format_0 != null ? StringFormat.Companion.forOneArg_86f9bg$(this.format_0, void 0, this.aes.name) : null;\n }\n Object.defineProperty(MappingValue.prototype, 'isOutlier', {\n get: function () {\n return this.isOutlier_cyn2n6$_0;\n }\n });\n Object.defineProperty(MappingValue.prototype, 'isAxis', {\n get: function () {\n return this.isAxis_ohfp7r$_0;\n }\n });\n Object.defineProperty(MappingValue.prototype, 'myDataAccess_0', {\n configurable: true,\n get: function () {\n if (this.myDataAccess_biypgq$_0 == null)\n return throwUPAE('myDataAccess');\n return this.myDataAccess_biypgq$_0;\n },\n set: function (myDataAccess) {\n this.myDataAccess_biypgq$_0 = myDataAccess;\n }\n });\n MappingValue.prototype.initDataContext_rxi9tf$ = function (dataContext) {\n var tmp$;\n if (!(this.myDataAccess_biypgq$_0 == null)) {\n var message = 'Data context can be initialized only once';\n throw IllegalArgumentException_init(message.toString());\n }this.myDataAccess_0 = dataContext.mappedDataAccess;\n if (!this.myDataAccess_0.isMapped_896ixz$(this.aes)) {\n var message_0 = this.aes.toString() + ' have to be mapped';\n throw IllegalArgumentException_init(message_0.toString());\n }var $receiver = listOf_0([Aes.Companion.X, Aes.Companion.Y]);\n var predicate = getCallableRef('isMapped', function ($receiver, p1) {\n return $receiver.isMapped_896ixz$(p1);\n }.bind(null, this.myDataAccess_0));\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (predicate(element))\n destination.add_11rb$(element);\n }\n var transform = getCallableRef('getMappedDataLabel', function ($receiver, p1) {\n return $receiver.getMappedDataLabel_896ixz$(p1);\n }.bind(null, this.myDataAccess_0));\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(destination, 10));\n var tmp$_1;\n tmp$_1 = destination.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n destination_0.add_11rb$(transform(item));\n }\n var axisLabels = destination_0;\n var dataLabel = this.myDataAccess_0.getMappedDataLabel_896ixz$(this.aes);\n if (this.isAxis)\n tmp$ = null;\n else {\n if (dataLabel.length === 0)\n tmp$ = '';\n else if (axisLabels.contains_11rb$(dataLabel))\n tmp$ = '';\n else\n tmp$ = dataLabel;\n }\n this.myDataLabel_0 = tmp$;\n };\n MappingValue.prototype.getDataPoint_za3lpa$ = function (index) {\n var tmp$, tmp$_0, tmp$_1;\n var originalValue = this.myDataAccess_0.getOriginalValue_pkitv1$(this.aes, index);\n var tmp$_2;\n if (originalValue != null) {\n var tmp$_3;\n tmp$_2 = (tmp$_3 = this.myFormatter_0) != null ? tmp$_3.format_za3rmp$(originalValue) : null;\n } else\n tmp$_2 = null;\n var formattedValue = (tmp$ = tmp$_2) != null ? tmp$ : this.myDataAccess_0.getMappedData_pkitv1$(this.aes, index).value;\n var tmp$_4 = this.isOutlier;\n if (tmp$_4) {\n var $receiver = this.myDataLabel_0;\n tmp$_4 = !($receiver == null || $receiver.length === 0);\n }if (tmp$_4 && !equals((tmp$_0 = this.myFormatter_0) != null ? tmp$_0.formatType : null, StringFormat$FormatType.STRING_FORMAT)) {\n tmp$_1 = toString(this.myDataLabel_0) + ': ' + formattedValue;\n } else {\n tmp$_1 = formattedValue;\n }\n var value = tmp$_1;\n return new TooltipLineSpec$DataPoint(this.isOutlier ? null : this.myDataLabel_0, value, this.aes, this.isAxis, this.isOutlier);\n };\n MappingValue.prototype.copy = function () {\n return new MappingValue(this.aes, this.isOutlier, this.isAxis, this.format_0);\n };\n MappingValue.prototype.toOutlier = function () {\n return new MappingValue(this.aes, true, this.isAxis, this.format_0);\n };\n MappingValue.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MappingValue',\n interfaces: [ValueSource]\n };\n function TooltipLine(label, pattern, fields) {\n TooltipLine$Companion_getInstance();\n this.label_0 = label;\n this.pattern_0 = pattern;\n this.fields = fields;\n this.myLineFormatter_0 = StringFormat.Companion.forNArgs_8vq31k$(this.pattern_0, StringFormat$FormatType.STRING_FORMAT, this.fields.size, 'fields');\n }\n TooltipLine.prototype.initDataContext_rxi9tf$ = function (dataContext) {\n var tmp$;\n tmp$ = this.fields.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n element.initDataContext_rxi9tf$(dataContext);\n }\n };\n function TooltipLine$getDataPoint$lambda(it) {\n var tmp$;\n return (tmp$ = it.label) != null ? tmp$ : '';\n }\n TooltipLine.prototype.getDataPoint_za3lpa$ = function (index) {\n var tmp$;\n var $receiver = this.fields;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n var tmp$_1 = destination.add_11rb$;\n var tmp$_2;\n tmp$_2 = item.getDataPoint_za3lpa$(index);\n if (tmp$_2 == null) {\n return null;\n }tmp$_1.call(destination, tmp$_2);\n }\n var dataValues = destination;\n if (dataValues.size === 1) {\n var dataValue = single(dataValues);\n tmp$ = new TooltipLineSpec$DataPoint(this.chooseLabel_0(dataValue.label), this.myLineFormatter_0.format_za3rmp$(dataValue.value), dataValue.aes, dataValue.isAxis, dataValue.isOutlier);\n } else {\n var tmp$_3 = this.chooseLabel_0(joinToString(dataValues, ', ', void 0, void 0, void 0, void 0, TooltipLine$getDataPoint$lambda));\n var tmp$_4 = this.myLineFormatter_0;\n var destination_0 = ArrayList_init_1(collectionSizeOrDefault(dataValues, 10));\n var tmp$_5;\n tmp$_5 = dataValues.iterator();\n while (tmp$_5.hasNext()) {\n var item_0 = tmp$_5.next();\n destination_0.add_11rb$(item_0.value);\n }\n tmp$ = new TooltipLineSpec$DataPoint(tmp$_3, tmp$_4.format_pqjuzw$(destination_0), null, false, false);\n }\n return tmp$;\n };\n TooltipLine.prototype.chooseLabel_0 = function (dataLabel) {\n var tmp$;\n if (equals(this.label_0, TooltipLine$Companion_getInstance().DEFAULT_LABEL_SPECIFIER_0))\n tmp$ = dataLabel;\n else\n tmp$ = this.label_0;\n return tmp$;\n };\n function TooltipLine$Companion() {\n TooltipLine$Companion_instance = this;\n this.DEFAULT_LABEL_SPECIFIER_0 = '@';\n }\n TooltipLine$Companion.prototype.defaultLineForValueSource_u47np3$ = function (valueSource) {\n return new TooltipLine(this.DEFAULT_LABEL_SPECIFIER_0, StringFormat.Companion.valueInLinePattern(), listOf(valueSource));\n };\n TooltipLine$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TooltipLine$Companion_instance = null;\n function TooltipLine$Companion_getInstance() {\n if (TooltipLine$Companion_instance === null) {\n new TooltipLine$Companion();\n }return TooltipLine$Companion_instance;\n }\n TooltipLine.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipLine',\n interfaces: [TooltipLineSpec]\n };\n function TooltipLine_init(other, $this) {\n $this = $this || Object.create(TooltipLine.prototype);\n var tmp$ = other.label_0;\n var tmp$_0 = other.pattern_0;\n var $receiver = other.fields;\n var destination = ArrayList_init_1(collectionSizeOrDefault($receiver, 10));\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n destination.add_11rb$(item.copy());\n }\n TooltipLine.call($this, tmp$, tmp$_0, destination);\n return $this;\n }\n function TooltipSpecification(valueSources, tooltipLinePatterns, tooltipProperties) {\n TooltipSpecification$Companion_getInstance();\n this.valueSources = valueSources;\n this.tooltipLinePatterns = tooltipLinePatterns;\n this.tooltipProperties = tooltipProperties;\n }\n function TooltipSpecification$TooltipProperties(anchor, minWidth, color) {\n TooltipSpecification$TooltipProperties$Companion_getInstance();\n this.anchor = anchor;\n this.minWidth = minWidth;\n this.color = color;\n }\n function TooltipSpecification$TooltipProperties$Companion() {\n TooltipSpecification$TooltipProperties$Companion_instance = this;\n this.NONE = new TooltipSpecification$TooltipProperties(null, null, null);\n }\n TooltipSpecification$TooltipProperties$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TooltipSpecification$TooltipProperties$Companion_instance = null;\n function TooltipSpecification$TooltipProperties$Companion_getInstance() {\n if (TooltipSpecification$TooltipProperties$Companion_instance === null) {\n new TooltipSpecification$TooltipProperties$Companion();\n }return TooltipSpecification$TooltipProperties$Companion_instance;\n }\n TooltipSpecification$TooltipProperties.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipProperties',\n interfaces: []\n };\n function TooltipSpecification$Companion() {\n TooltipSpecification$Companion_instance = this;\n }\n TooltipSpecification$Companion.prototype.withoutTooltip = function () {\n return new TooltipSpecification(emptyList(), emptyList(), TooltipSpecification$TooltipProperties$Companion_getInstance().NONE);\n };\n TooltipSpecification$Companion.prototype.defaultTooltip = function () {\n return new TooltipSpecification(emptyList(), null, TooltipSpecification$TooltipProperties$Companion_getInstance().NONE);\n };\n TooltipSpecification$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TooltipSpecification$Companion_instance = null;\n function TooltipSpecification$Companion_getInstance() {\n if (TooltipSpecification$Companion_instance === null) {\n new TooltipSpecification$Companion();\n }return TooltipSpecification$Companion_instance;\n }\n TooltipSpecification.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipSpecification',\n interfaces: []\n };\n function ValueSource() {\n }\n ValueSource.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ValueSource',\n interfaces: []\n };\n var package$jetbrains = _.jetbrains || (_.jetbrains = {});\n var package$datalore = package$jetbrains.datalore || (package$jetbrains.datalore = {});\n var package$plot = package$datalore.plot || (package$datalore.plot = {});\n Object.defineProperty(package$plot, 'FeatureSwitch', {\n get: FeatureSwitch_getInstance\n });\n var package$builder = package$plot.builder || (package$plot.builder = {});\n Object.defineProperty(package$builder, 'AxisUtil', {\n get: AxisUtil_getInstance\n });\n package$builder.BogusCoordinateSystem = BogusCoordinateSystem;\n package$builder.BogusScale = BogusScale;\n package$builder.GeomLayer = GeomLayer;\n Object.defineProperty(package$builder, 'GeomLayerListUtil', {\n get: GeomLayerListUtil_getInstance\n });\n LayerRendererUtil.prototype.LayerRendererData = LayerRendererUtil$LayerRendererData;\n Object.defineProperty(package$builder, 'LayerRendererUtil', {\n get: LayerRendererUtil_getInstance\n });\n Object.defineProperty(Plot, 'Companion', {\n get: Plot$Companion_getInstance\n });\n package$builder.Plot = Plot;\n package$builder.PlotBuilder = PlotBuilder;\n Object.defineProperty(PlotContainerPortable, 'Companion', {\n get: PlotContainerPortable$Companion_getInstance\n });\n package$builder.PlotContainerPortable = PlotContainerPortable;\n package$builder.PlotTile = PlotTile;\n package$builder.PlotTooltipHelper = PlotTooltipHelper;\n Object.defineProperty(package$builder, 'PlotUtil', {\n get: PlotUtil_getInstance\n });\n package$builder.PosProviderContext = PosProviderContext;\n package$builder.SvgLayerRenderer = SvgLayerRenderer;\n package$builder.VarBinding = VarBinding;\n Object.defineProperty(ColorBarAssembler, 'Companion', {\n get: ColorBarAssembler$Companion_getInstance\n });\n var package$assemble = package$builder.assemble || (package$builder.assemble = {});\n package$assemble.ColorBarAssembler = ColorBarAssembler;\n package$assemble.ColorBarOptions = ColorBarOptions;\n package$assemble.GeomContextBuilder_init = GeomContextBuilder_init;\n package$assemble.GeomContextBuilder = GeomContextBuilder;\n Object.defineProperty(GeomLayerBuilder, 'Companion', {\n get: GeomLayerBuilder$Companion_getInstance\n });\n package$assemble.GeomLayerBuilder = GeomLayerBuilder;\n Object.defineProperty(GuideOptions, 'Companion', {\n get: GuideOptions$Companion_getInstance\n });\n package$assemble.GuideOptions = GuideOptions;\n ImmutableGeomContext.Builder = ImmutableGeomContext$Builder;\n package$assemble.ImmutableGeomContext = ImmutableGeomContext;\n Object.defineProperty(LegendAssembler, 'Companion', {\n get: LegendAssembler$Companion_getInstance\n });\n package$assemble.LegendAssembler = LegendAssembler;\n Object.defineProperty(package$assemble, 'LegendAssemblerUtil', {\n get: LegendAssemblerUtil_getInstance\n });\n Object.defineProperty(LegendOptions, 'Companion', {\n get: LegendOptions$Companion_getInstance\n });\n package$assemble.LegendOptions = LegendOptions;\n Object.defineProperty(PlotAssembler, 'Companion', {\n get: PlotAssembler$Companion_getInstance\n });\n package$assemble.PlotAssembler = PlotAssembler;\n Object.defineProperty(package$assemble, 'PlotAssemblerUtil', {\n get: PlotAssemblerUtil_getInstance\n });\n Object.defineProperty(PlotFacets, 'Companion', {\n get: PlotFacets$Companion_getInstance\n });\n PlotFacets.FacetTileInfo = PlotFacets$FacetTileInfo;\n package$assemble.PlotFacets = PlotFacets;\n Object.defineProperty(package$assemble, 'PlotGuidesAssemblerUtil', {\n get: PlotGuidesAssemblerUtil_getInstance\n });\n Object.defineProperty(PosProvider, 'Companion', {\n get: PosProvider$Companion_getInstance\n });\n package$assemble.PosProvider = PosProvider;\n package$assemble.StitchedPlotLayers = StitchedPlotLayers;\n Object.defineProperty(TypedScaleMap, 'Companion', {\n get: TypedScaleMap$Companion_getInstance\n });\n package$assemble.TypedScaleMap = TypedScaleMap;\n package$assemble.TypedScaleProviderMap = TypedScaleProviderMap;\n var package$facet = package$assemble.facet || (package$assemble.facet = {});\n package$facet.FacetGrid = FacetGrid;\n Object.defineProperty(FacetWrap$Direction, 'H', {\n get: FacetWrap$Direction$H_getInstance\n });\n Object.defineProperty(FacetWrap$Direction, 'V', {\n get: FacetWrap$Direction$V_getInstance\n });\n FacetWrap.Direction = FacetWrap$Direction;\n Object.defineProperty(FacetWrap, 'Companion', {\n get: FacetWrap$Companion_getInstance\n });\n package$facet.FacetWrap = FacetWrap;\n var package$geom = package$assemble.geom || (package$assemble.geom = {});\n Object.defineProperty(package$geom, 'DefaultSampling', {\n get: DefaultSampling_getInstance\n });\n Object.defineProperty(GeomProvider, 'Companion', {\n get: GeomProvider$Companion_getInstance\n });\n package$geom.GeomProvider = GeomProvider;\n package$geom.PointDataAccess = PointDataAccess;\n var package$coord = package$builder.coord || (package$builder.coord = {});\n package$coord.CartesianCoordProvider = CartesianCoordProvider;\n package$coord.CoordProvider = CoordProvider;\n Object.defineProperty(CoordProviderBase, 'Companion', {\n get: CoordProviderBase$Companion_getInstance\n });\n package$coord.CoordProviderBase = CoordProviderBase;\n Object.defineProperty(package$coord, 'CoordProviders', {\n get: CoordProviders_getInstance\n });\n package$coord.FixedRatioCoordProvider = FixedRatioCoordProvider;\n Object.defineProperty(ProjectionCoordProvider, 'Companion', {\n get: ProjectionCoordProvider$Companion_getInstance\n });\n package$coord.ProjectionCoordProvider = ProjectionCoordProvider;\n var package$map = package$coord.map || (package$coord.map = {});\n package$map.MercatorProjectionX = MercatorProjectionX;\n package$map.MercatorProjectionY = MercatorProjectionY;\n DataProcessing.prototype.DataAndGroupingContext = DataProcessing$DataAndGroupingContext;\n var package$data = package$builder.data || (package$builder.data = {});\n Object.defineProperty(package$data, 'DataProcessing', {\n get: DataProcessing_getInstance\n });\n GroupMerger.Group = GroupMerger$Group;\n package$data.GroupMerger = GroupMerger;\n Object.defineProperty(package$data, 'GroupUtil', {\n get: GroupUtil_getInstance\n });\n Object.defineProperty(GroupingContext, 'Companion', {\n get: GroupingContext$Companion_getInstance\n });\n package$data.GroupingContext = GroupingContext;\n Object.defineProperty(OrderOptionUtil$OrderOption, 'Companion', {\n get: OrderOptionUtil$OrderOption$Companion_getInstance\n });\n OrderOptionUtil.prototype.OrderOption = OrderOptionUtil$OrderOption;\n Object.defineProperty(package$data, 'OrderOptionUtil', {\n get: OrderOptionUtil_getInstance\n });\n var package$event = package$builder.event || (package$builder.event = {});\n package$event.MouseEventPeer = MouseEventPeer;\n var package$guide = package$builder.guide || (package$builder.guide = {});\n package$guide.AxisComponent = AxisComponent;\n package$guide.ColorBarComponent = ColorBarComponent;\n ColorBarComponentLayout.BreakInfo = ColorBarComponentLayout$BreakInfo;\n Object.defineProperty(ColorBarComponentLayout, 'Companion', {\n get: ColorBarComponentLayout$Companion_getInstance\n });\n package$guide.ColorBarComponentLayout = ColorBarComponentLayout;\n Object.defineProperty(ColorBarComponentSpec, 'Companion', {\n get: ColorBarComponentSpec$Companion_getInstance\n });\n package$guide.ColorBarComponentSpec = ColorBarComponentSpec;\n Object.defineProperty(LegendArrangement, 'HORIZONTAL', {\n get: LegendArrangement$HORIZONTAL_getInstance\n });\n Object.defineProperty(LegendArrangement, 'VERTICAL', {\n get: LegendArrangement$VERTICAL_getInstance\n });\n package$guide.LegendArrangement = LegendArrangement;\n Object.defineProperty(LegendBox, 'Companion', {\n get: LegendBox$Companion_getInstance\n });\n package$guide.LegendBox = LegendBox;\n Object.defineProperty(LegendBoxLayout, 'Companion', {\n get: LegendBoxLayout$Companion_getInstance\n });\n package$guide.LegendBoxLayout = LegendBoxLayout;\n package$guide.LegendBoxSpec = LegendBoxSpec;\n Object.defineProperty(LegendBreak, 'Companion', {\n get: LegendBreak$Companion_getInstance\n });\n package$guide.LegendBreak = LegendBreak;\n package$guide.LegendComponent = LegendComponent;\n Object.defineProperty(LegendComponentLayout, 'Companion', {\n get: LegendComponentLayout$Companion_getInstance\n });\n package$guide.LegendComponentLayout = LegendComponentLayout;\n package$guide.LegendComponentSpec = LegendComponentSpec;\n Object.defineProperty(LegendDirection, 'HORIZONTAL', {\n get: LegendDirection$HORIZONTAL_getInstance\n });\n Object.defineProperty(LegendDirection, 'VERTICAL', {\n get: LegendDirection$VERTICAL_getInstance\n });\n Object.defineProperty(LegendDirection, 'AUTO', {\n get: LegendDirection$AUTO_getInstance\n });\n package$guide.LegendDirection = LegendDirection;\n Object.defineProperty(LegendJustification, 'Companion', {\n get: LegendJustification$Companion_getInstance\n });\n package$guide.LegendJustification = LegendJustification;\n Object.defineProperty(LegendPosition, 'Companion', {\n get: LegendPosition$Companion_getInstance\n });\n package$guide.LegendPosition = LegendPosition;\n Object.defineProperty(Orientation, 'LEFT', {\n get: Orientation$LEFT_getInstance\n });\n Object.defineProperty(Orientation, 'RIGHT', {\n get: Orientation$RIGHT_getInstance\n });\n Object.defineProperty(Orientation, 'TOP', {\n get: Orientation$TOP_getInstance\n });\n Object.defineProperty(Orientation, 'BOTTOM', {\n get: Orientation$BOTTOM_getInstance\n });\n package$guide.Orientation = Orientation;\n Object.defineProperty(ContextualMappingProvider, 'Companion', {\n get: ContextualMappingProvider$Companion_getInstance\n });\n var package$interact = package$builder.interact || (package$builder.interact = {});\n package$interact.ContextualMappingProvider = ContextualMappingProvider;\n Object.defineProperty(GeomInteraction, 'Companion', {\n get: GeomInteraction$Companion_getInstance\n });\n package$interact.GeomInteraction = GeomInteraction;\n Object.defineProperty(GeomInteractionBuilder, 'Companion', {\n get: GeomInteractionBuilder$Companion_getInstance\n });\n package$interact.GeomInteractionBuilder = GeomInteractionBuilder;\n Object.defineProperty(MathUtil$ClosestPointChecker$COMPARISON_RESULT, 'NEW_CLOSER', {\n get: MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance\n });\n Object.defineProperty(MathUtil$ClosestPointChecker$COMPARISON_RESULT, 'NEW_FARTHER', {\n get: MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance\n });\n Object.defineProperty(MathUtil$ClosestPointChecker$COMPARISON_RESULT, 'EQUAL', {\n get: MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance\n });\n MathUtil$ClosestPointChecker.COMPARISON_RESULT = MathUtil$ClosestPointChecker$COMPARISON_RESULT;\n MathUtil.prototype.ClosestPointChecker_init_lu1900$ = MathUtil$MathUtil$ClosestPointChecker_init;\n MathUtil.prototype.ClosestPointChecker = MathUtil$ClosestPointChecker;\n Object.defineProperty(MathUtil$DoubleRange, 'Companion', {\n get: MathUtil$DoubleRange$Companion_getInstance\n });\n MathUtil.prototype.DoubleRange = MathUtil$DoubleRange;\n Object.defineProperty(package$interact, 'MathUtil', {\n get: MathUtil_getInstance\n });\n Object.defineProperty(TooltipSpec$Line, 'Companion', {\n get: TooltipSpec$Line$Companion_getInstance\n });\n TooltipSpec.Line = TooltipSpec$Line;\n package$interact.TooltipSpec = TooltipSpec;\n package$interact.TooltipSpecFactory = TooltipSpecFactory;\n var package$loc = package$interact.loc || (package$interact.loc = {});\n package$loc.LayerTargetCollectorWithLocator = LayerTargetCollectorWithLocator;\n LayerTargetLocator.Target = LayerTargetLocator$Target;\n Object.defineProperty(LayerTargetLocator$Collector$CollectingStrategy, 'APPEND', {\n get: LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance\n });\n Object.defineProperty(LayerTargetLocator$Collector$CollectingStrategy, 'REPLACE', {\n get: LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance\n });\n Object.defineProperty(LayerTargetLocator$Collector$CollectingStrategy, 'APPEND_IF_EQUAL', {\n get: LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_getInstance\n });\n Object.defineProperty(LayerTargetLocator$Collector$CollectingStrategy, 'IGNORE', {\n get: LayerTargetLocator$Collector$CollectingStrategy$IGNORE_getInstance\n });\n LayerTargetLocator$Collector.CollectingStrategy = LayerTargetLocator$Collector$CollectingStrategy;\n LayerTargetLocator.Collector = LayerTargetLocator$Collector;\n package$loc.LayerTargetLocator = LayerTargetLocator;\n Object.defineProperty(LocatedTargetsPicker, 'Companion', {\n get: LocatedTargetsPicker$Companion_getInstance\n });\n package$loc.LocatedTargetsPicker = LocatedTargetsPicker;\n Object.defineProperty(TargetDetector, 'Companion', {\n get: TargetDetector$Companion_getInstance\n });\n package$loc.TargetDetector = TargetDetector;\n package$loc.TargetProjection = TargetProjection;\n Object.defineProperty(PointTargetProjection, 'Companion', {\n get: PointTargetProjection$Companion_getInstance\n });\n package$loc.PointTargetProjection = PointTargetProjection;\n Object.defineProperty(RectTargetProjection, 'Companion', {\n get: RectTargetProjection$Companion_getInstance\n });\n package$loc.RectTargetProjection = RectTargetProjection;\n Object.defineProperty(PolygonTargetProjection, 'Companion', {\n get: PolygonTargetProjection$Companion_getInstance\n });\n PolygonTargetProjection.RingXY = PolygonTargetProjection$RingXY;\n package$loc.PolygonTargetProjection = PolygonTargetProjection;\n Object.defineProperty(PathTargetProjection$PathPoint, 'Companion', {\n get: PathTargetProjection$PathPoint$Companion_getInstance\n });\n PathTargetProjection.PathPoint = PathTargetProjection$PathPoint;\n Object.defineProperty(PathTargetProjection, 'Companion', {\n get: PathTargetProjection$Companion_getInstance\n });\n package$loc.PathTargetProjection = PathTargetProjection;\n Object.defineProperty(TargetPrototype, 'Companion', {\n get: TargetPrototype$Companion_getInstance\n });\n package$loc.TargetPrototype = TargetPrototype;\n package$loc.TransformedTargetLocator = TransformedTargetLocator;\n var package$layout = package$builder.layout || (package$builder.layout = {});\n package$layout.AxisLayout = AxisLayout;\n AxisLayoutInfo.Builder = AxisLayoutInfo$Builder;\n package$layout.AxisLayoutInfo = AxisLayoutInfo;\n Object.defineProperty(EmptyAxisLayout, 'Companion', {\n get: EmptyAxisLayout$Companion_getInstance\n });\n package$layout.EmptyAxisLayout = EmptyAxisLayout;\n Object.defineProperty(FacetGridPlotLayout, 'Companion', {\n get: FacetGridPlotLayout$Companion_getInstance\n });\n package$layout.FacetGridPlotLayout = FacetGridPlotLayout;\n Object.defineProperty(package$layout, 'GeometryUtil', {\n get: GeometryUtil_getInstance\n });\n Object.defineProperty(LegendBoxInfo, 'Companion', {\n get: LegendBoxInfo$Companion_getInstance\n });\n package$layout.LegendBoxInfo = LegendBoxInfo;\n LegendBoxesLayout.Result = LegendBoxesLayout$Result;\n LegendBoxesLayout.BoxWithLocation = LegendBoxesLayout$BoxWithLocation;\n package$layout.LegendBoxesLayout = LegendBoxesLayout;\n Object.defineProperty(package$layout, 'LegendBoxesLayoutUtil', {\n get: LegendBoxesLayoutUtil_getInstance\n });\n package$layout.LiveMapTileLayout = LiveMapTileLayout;\n Object.defineProperty(PlotAxisLayout, 'Companion', {\n get: PlotAxisLayout$Companion_getInstance\n });\n package$layout.PlotAxisLayout = PlotAxisLayout;\n package$layout.PlotLayout = PlotLayout;\n package$layout.PlotLayoutBase = PlotLayoutBase;\n package$layout.PlotLayoutInfo = PlotLayoutInfo;\n Object.defineProperty(package$layout, 'PlotLayoutUtil', {\n get: PlotLayoutUtil_getInstance\n });\n package$layout.SingleTilePlotLayout = SingleTilePlotLayout;\n package$layout.TileLayout = TileLayout;\n package$layout.TileLayoutInfo_init_aeujc5$ = TileLayoutInfo_init;\n package$layout.TileLayoutInfo = TileLayoutInfo;\n Object.defineProperty(package$layout, 'XYPlotLayoutUtil', {\n get: XYPlotLayoutUtil_getInstance\n });\n Object.defineProperty(XYPlotTileLayout, 'Companion', {\n get: XYPlotTileLayout$Companion_getInstance\n });\n package$layout.XYPlotTileLayout = XYPlotTileLayout;\n var package$axis = package$layout.axis || (package$layout.axis = {});\n package$axis.AdaptableAxisBreaksProvider = AdaptableAxisBreaksProvider;\n package$axis.AxisBreaksProvider = AxisBreaksProvider;\n Object.defineProperty(package$axis, 'AxisBreaksUtil', {\n get: AxisBreaksUtil_getInstance\n });\n Object.defineProperty(AxisLayouter, 'Companion', {\n get: AxisLayouter$Companion_getInstance\n });\n package$axis.AxisLayouter = AxisLayouter;\n package$axis.FixedAxisBreaksProvider = FixedAxisBreaksProvider;\n package$axis.GuideBreaks = GuideBreaks;\n package$axis.HorizontalAxisLayouter = HorizontalAxisLayouter;\n package$axis.VerticalAxisLayouter = VerticalAxisLayouter;\n Object.defineProperty(AbstractFixedBreaksLabelsLayout, 'Companion', {\n get: AbstractFixedBreaksLabelsLayout$Companion_getInstance\n });\n var package$label = package$axis.label || (package$axis.label = {});\n package$label.AbstractFixedBreaksLabelsLayout = AbstractFixedBreaksLabelsLayout;\n Object.defineProperty(AxisLabelsLayout, 'Companion', {\n get: AxisLabelsLayout$Companion_getInstance\n });\n package$label.AxisLabelsLayout = AxisLabelsLayout;\n AxisLabelsLayoutInfo.Builder = AxisLabelsLayoutInfo$Builder;\n package$label.AxisLabelsLayoutInfo = AxisLabelsLayoutInfo;\n Object.defineProperty(package$label, 'BreakLabelsLayoutUtil', {\n get: BreakLabelsLayoutUtil_getInstance\n });\n package$label.HorizontalFixedBreaksLabelsLayout = HorizontalFixedBreaksLabelsLayout;\n package$label.HorizontalFlexBreaksLabelsLayout = HorizontalFlexBreaksLabelsLayout;\n Object.defineProperty(HorizontalMultilineLabelsLayout, 'Companion', {\n get: HorizontalMultilineLabelsLayout$Companion_getInstance\n });\n package$label.HorizontalMultilineLabelsLayout = HorizontalMultilineLabelsLayout;\n Object.defineProperty(HorizontalSimpleLabelsLayout, 'Companion', {\n get: HorizontalSimpleLabelsLayout$Companion_getInstance\n });\n package$label.HorizontalSimpleLabelsLayout = HorizontalSimpleLabelsLayout;\n Object.defineProperty(HorizontalTiltedLabelsLayout, 'Companion', {\n get: HorizontalTiltedLabelsLayout$Companion_getInstance\n });\n package$label.HorizontalTiltedLabelsLayout = HorizontalTiltedLabelsLayout;\n Object.defineProperty(HorizontalVerticalLabelsLayout, 'Companion', {\n get: HorizontalVerticalLabelsLayout$Companion_getInstance\n });\n package$label.HorizontalVerticalLabelsLayout = HorizontalVerticalLabelsLayout;\n package$label.VerticalFixedBreaksLabelsLayout = VerticalFixedBreaksLabelsLayout;\n package$label.VerticalFlexBreaksLabelsLayout = VerticalFlexBreaksLabelsLayout;\n Object.defineProperty(Defaults$Common, 'Title', {\n get: Defaults$Common$Title_getInstance\n });\n Object.defineProperty(Defaults$Common, 'Legend', {\n get: Defaults$Common$Legend_getInstance\n });\n Object.defineProperty(Defaults$Common, 'Tooltip', {\n get: Defaults$Common$Tooltip_getInstance\n });\n Defaults.prototype.Common = Defaults$Common;\n Object.defineProperty(Defaults$Table, 'Head', {\n get: Defaults$Table$Head_getInstance\n });\n Object.defineProperty(Defaults$Table, 'Data', {\n get: Defaults$Table$Data_getInstance\n });\n Defaults.prototype.Table = Defaults$Table;\n Object.defineProperty(Defaults$Plot, 'Axis', {\n get: Defaults$Plot$Axis_getInstance\n });\n Defaults.prototype.Plot = Defaults$Plot;\n var package$presentation = package$builder.presentation || (package$builder.presentation = {});\n Object.defineProperty(package$presentation, 'Defaults', {\n get: Defaults_getInstance\n });\n Object.defineProperty(package$presentation, 'LabelCss', {\n get: LabelCss_getInstance\n });\n package$presentation.Serializable = Serializable;\n Object.defineProperty(LabelMetrics, 'Companion', {\n get: LabelMetrics$Companion_getInstance\n });\n package$presentation.LabelMetrics_init = LabelMetrics_init;\n package$presentation.LabelMetrics_init_7trt9e$ = LabelMetrics_init_0;\n package$presentation.LabelMetrics = LabelMetrics;\n package$presentation.LabelSpec = LabelSpec;\n Object.defineProperty(PlotLabelSpec, 'PLOT_TITLE', {\n get: PlotLabelSpec$PLOT_TITLE_getInstance\n });\n Object.defineProperty(PlotLabelSpec, 'AXIS_TICK', {\n get: PlotLabelSpec$AXIS_TICK_getInstance\n });\n Object.defineProperty(PlotLabelSpec, 'AXIS_TICK_SMALL', {\n get: PlotLabelSpec$AXIS_TICK_SMALL_getInstance\n });\n Object.defineProperty(PlotLabelSpec, 'AXIS_TITLE', {\n get: PlotLabelSpec$AXIS_TITLE_getInstance\n });\n Object.defineProperty(PlotLabelSpec, 'LEGEND_TITLE', {\n get: PlotLabelSpec$LEGEND_TITLE_getInstance\n });\n Object.defineProperty(PlotLabelSpec, 'LEGEND_ITEM', {\n get: PlotLabelSpec$LEGEND_ITEM_getInstance\n });\n package$presentation.PlotLabelSpec = PlotLabelSpec;\n Object.defineProperty(package$presentation, 'Style', {\n get: Style_getInstance\n });\n var package$sampling = package$builder.sampling || (package$builder.sampling = {});\n package$sampling.GroupAwareSampling = GroupAwareSampling;\n package$sampling.PointSampling = PointSampling;\n package$sampling.Sampling = Sampling;\n Object.defineProperty(package$sampling, 'Samplings', {\n get: Samplings_getInstance\n });\n Object.defineProperty(GroupRandomSampling, 'Companion', {\n get: GroupRandomSampling$Companion_getInstance\n });\n var package$method = package$sampling.method || (package$sampling.method = {});\n package$method.GroupRandomSampling = GroupRandomSampling;\n package$method.GroupSamplingBase = GroupSamplingBase;\n Object.defineProperty(GroupSystematicSampling, 'Companion', {\n get: GroupSystematicSampling$Companion_getInstance\n });\n package$method.GroupSystematicSampling = GroupSystematicSampling;\n Object.defineProperty(PickSampling, 'Companion', {\n get: PickSampling$Companion_getInstance\n });\n package$method.PickSampling = PickSampling;\n Object.defineProperty(RandomSampling, 'Companion', {\n get: RandomSampling$Companion_getInstance\n });\n package$method.RandomSampling = RandomSampling;\n Object.defineProperty(RandomStratifiedSampling, 'Companion', {\n get: RandomStratifiedSampling$Companion_getInstance\n });\n package$method.RandomStratifiedSampling = RandomStratifiedSampling;\n package$method.SamplingBase = SamplingBase;\n Object.defineProperty(package$method, 'SamplingUtil', {\n get: SamplingUtil_getInstance\n });\n Object.defineProperty(SystematicSampling, 'Companion', {\n get: SystematicSampling$Companion_getInstance\n });\n package$method.SystematicSampling = SystematicSampling;\n Object.defineProperty(VertexSampling$VertexVwSampling, 'Companion', {\n get: VertexSampling$VertexVwSampling$Companion_getInstance\n });\n VertexSampling.VertexVwSampling = VertexSampling$VertexVwSampling;\n Object.defineProperty(VertexSampling$VertexDpSampling, 'Companion', {\n get: VertexSampling$VertexDpSampling$Companion_getInstance\n });\n VertexSampling.VertexDpSampling = VertexSampling$VertexDpSampling;\n VertexSampling.DoubleVectorComponentsList = VertexSampling$DoubleVectorComponentsList;\n Object.defineProperty(VertexSampling, 'Companion', {\n get: VertexSampling$Companion_getInstance\n });\n package$method.VertexSampling = VertexSampling;\n var package$scale = package$builder.scale || (package$builder.scale = {});\n package$scale.ContinuousOnlyMapperProvider = ContinuousOnlyMapperProvider;\n Object.defineProperty(package$scale, 'DefaultMapperProvider', {\n get: DefaultMapperProvider_getInstance\n });\n Object.defineProperty(package$scale, 'DefaultMapperProviderUtil', {\n get: DefaultMapperProviderUtil_getInstance\n });\n Object.defineProperty(package$scale, 'DefaultNaValue', {\n get: DefaultNaValue_getInstance\n });\n package$scale.DiscreteOnlyMapperProvider = DiscreteOnlyMapperProvider;\n package$scale.GuideBreak = GuideBreak;\n package$scale.GuideMapper = GuideMapper;\n package$scale.MapperProvider = MapperProvider;\n package$scale.ScaleProvider = ScaleProvider;\n package$scale.ScaleProviderBuilder = ScaleProviderBuilder;\n Object.defineProperty(package$scale, 'ScaleProviderHelper', {\n get: ScaleProviderHelper_getInstance\n });\n package$scale.WithGuideBreaks = WithGuideBreaks;\n var package$mapper = package$scale.mapper || (package$scale.mapper = {});\n Object.defineProperty(package$mapper, 'ColorMapper', {\n get: ColorMapper_getInstance\n });\n package$mapper.GuideMapperAdapter = GuideMapperAdapter;\n package$mapper.GuideMapperWithGuideBreaks = GuideMapperWithGuideBreaks;\n Object.defineProperty(package$mapper, 'GuideMappers', {\n get: GuideMappers_getInstance\n });\n Object.defineProperty(package$mapper, 'LineTypeMapper', {\n get: LineTypeMapper_getInstance\n });\n Object.defineProperty(package$mapper, 'ShapeMapper', {\n get: ShapeMapper_getInstance\n });\n Object.defineProperty(AlphaMapperProvider, 'Companion', {\n get: AlphaMapperProvider$Companion_getInstance\n });\n var package$provider = package$scale.provider || (package$scale.provider = {});\n package$provider.AlphaMapperProvider = AlphaMapperProvider;\n Object.defineProperty(ColorBrewerMapperProvider, 'Companion', {\n get: ColorBrewerMapperProvider$Companion_getInstance\n });\n package$provider.ColorBrewerMapperProvider = ColorBrewerMapperProvider;\n Object.defineProperty(ColorGradient2MapperProvider, 'Companion', {\n get: ColorGradient2MapperProvider$Companion_getInstance\n });\n package$provider.ColorGradient2MapperProvider = ColorGradient2MapperProvider;\n Object.defineProperty(ColorGradientMapperProvider, 'Companion', {\n get: ColorGradientMapperProvider$Companion_getInstance\n });\n package$provider.ColorGradientMapperProvider = ColorGradientMapperProvider;\n Object.defineProperty(ColorHueMapperProvider, 'Companion', {\n get: ColorHueMapperProvider$Companion_getInstance\n });\n package$provider.ColorHueMapperProvider = ColorHueMapperProvider;\n package$provider.DirectlyProportionalMapperProvider = DirectlyProportionalMapperProvider;\n Object.defineProperty(GreyscaleLightnessMapperProvider, 'Companion', {\n get: GreyscaleLightnessMapperProvider$Companion_getInstance\n });\n package$provider.GreyscaleLightnessMapperProvider = GreyscaleLightnessMapperProvider;\n Object.defineProperty(HSVColorMapperProvider, 'Companion', {\n get: HSVColorMapperProvider$Companion_getInstance\n });\n package$provider.HSVColorMapperProvider = HSVColorMapperProvider;\n package$provider.IdentityDiscreteMapperProvider = IdentityDiscreteMapperProvider;\n package$provider.IdentityMapperProvider = IdentityMapperProvider;\n package$provider.LinearNormalizingMapperProvider = LinearNormalizingMapperProvider;\n package$provider.MapperProviderBase = MapperProviderBase;\n Object.defineProperty(SizeAreaMapperProvider, 'Companion', {\n get: SizeAreaMapperProvider$Companion_getInstance\n });\n package$provider.SizeAreaMapperProvider = SizeAreaMapperProvider;\n Object.defineProperty(SizeMapperProvider, 'Companion', {\n get: SizeMapperProvider$Companion_getInstance\n });\n package$provider.SizeMapperProvider = SizeMapperProvider;\n var package$theme = package$builder.theme || (package$builder.theme = {});\n package$theme.AxisTheme = AxisTheme;\n package$theme.DefaultAxisTheme = DefaultAxisTheme;\n Object.defineProperty(DefaultTheme, 'Companion', {\n get: DefaultTheme$Companion_getInstance\n });\n package$theme.DefaultTheme = DefaultTheme;\n package$theme.FacetsTheme = FacetsTheme;\n package$theme.LegendTheme = LegendTheme;\n package$theme.PlotTheme = PlotTheme;\n package$theme.Theme = Theme;\n var package$tooltip = package$builder.tooltip || (package$builder.tooltip = {});\n package$tooltip.ConstantValue = ConstantValue;\n package$tooltip.DataFrameValue = DataFrameValue;\n package$tooltip.MappingValue = MappingValue;\n Object.defineProperty(TooltipLine, 'Companion', {\n get: TooltipLine$Companion_getInstance\n });\n package$tooltip.TooltipLine_init_3f4yhq$ = TooltipLine_init;\n package$tooltip.TooltipLine = TooltipLine;\n Object.defineProperty(TooltipSpecification$TooltipProperties, 'Companion', {\n get: TooltipSpecification$TooltipProperties$Companion_getInstance\n });\n TooltipSpecification.TooltipProperties = TooltipSpecification$TooltipProperties;\n Object.defineProperty(TooltipSpecification, 'Companion', {\n get: TooltipSpecification$Companion_getInstance\n });\n package$tooltip.TooltipSpecification = TooltipSpecification;\n package$tooltip.ValueSource = ValueSource;\n BogusCoordinateSystem.prototype.isPointInLimits_k2qmv6$ = CoordinateSystem.prototype.isPointInLimits_k2qmv6$;\n BogusCoordinateSystem.prototype.isRectInLimits_fd842m$ = CoordinateSystem.prototype.isRectInLimits_fd842m$;\n BogusCoordinateSystem.prototype.isPathInLimits_f6t8kh$ = CoordinateSystem.prototype.isPathInLimits_f6t8kh$;\n BogusCoordinateSystem.prototype.isPolygonInLimits_f6t8kh$ = CoordinateSystem.prototype.isPolygonInLimits_f6t8kh$;\n LayerTargetCollectorWithLocator.prototype.addPoint_cnsimy$ = GeomTargetCollector.prototype.addPoint_cnsimy$;\n LayerTargetCollectorWithLocator.prototype.addRectangle_bxzvr8$ = GeomTargetCollector.prototype.addRectangle_bxzvr8$;\n LayerTargetCollectorWithLocator.prototype.addPath_sa5m83$ = GeomTargetCollector.prototype.addPath_sa5m83$;\n LayerTargetCollectorWithLocator.prototype.addPolygon_sa5m83$ = GeomTargetCollector.prototype.addPolygon_sa5m83$;\n DefaultAxisTheme.prototype.tickLabelDistance = AxisTheme.prototype.tickLabelDistance;\n Kotlin.defineModule('lets-plot-plot-builder-portable', _);\n return _;\n}));\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9MZXRzUGxvdC8uL2tvdGxpbi1kY2UtZGV2L3NyYy9rb3RsaW4vdXRpbC9QcmVjb25kaXRpb25zLmt0PzlhOTUiLCJ3ZWJwYWNrOi8vTGV0c1Bsb3QvLi9rb3RsaW4tZGNlLWRldi9qcy9zcmMva290bGluL21hdGgua3Q/NzNhYiIsIndlYnBhY2s6Ly9MZXRzUGxvdC8uL2tvdGxpbi1kY2UtZGV2L2NvbW1vbi9zcmMvZ2VuZXJhdGVkL19Db2xsZWN0aW9ucy5rdD9mMDI3Iiwid2VicGFjazovL0xldHNQbG90Ly4va290bGluLWRjZS1kZXYvc3JjL2tvdGxpbi9jb2xsZWN0aW9ucy9NYXBzLmt0P2M3M2UiLCJ3ZWJwYWNrOi8vTGV0c1Bsb3QvLi9rb3RsaW4tZGNlLWRldi9zcmMva290bGluL2NvbXBhcmlzb25zL0NvbXBhcmlzb25zLmt0P2FmZWUiLCJ3ZWJwYWNrOi8vTGV0c1Bsb3QvLi4vcGxvdC1idWlsZGVyLXBvcnRhYmxlL3NyYy9jb21tb25NYWluL2tvdGxpbi9qZXRicmFpbnMvZGF0YWxvcmUvcGxvdC9idWlsZGVyL2Fzc2VtYmxlL2dlb20vRGVmYXVsdFNhbXBsaW5nLmt0Pzc3OWQiLCJ3ZWJwYWNrOi8vTGV0c1Bsb3QvLi9rb3RsaW4tZGNlLWRldi9zcmMva290bGluL2NvbGx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EuNVwiKVxuQGtvdGxpbi5pbnRlcm5hbC5JbmxpbmVPbmx5XG5wdWJsaWMgaW5saW5lIGZ1biA8VCwgUiA6IEFueT4gSXRlcmFibGU8VD4uZmlyc3ROb3ROdWxsT2ZPck51bGwodHJhbnNmb3JtOiAoVCkgLT4gUj8pOiBSPyB7XG4gICAgZm9yIChlbGVtZW50IGluIHRoaXMpIHtcbiAgICAgICAgdmFsIHJlc3VsdCA9IHRyYW5zZm9ybShlbGVtZW50KVxuICAgICAgICBpZiAocmVzdWx0ICE9IG51bGwpIHtcbiAgICAgICAgICAgIHJldHVybiByZXN1bHRcbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gbnVsbFxufVxuXG4vKipcbiAqIFJldHVybnMgdGhlIGZpcnN0IGVsZW1lbnQsIG9yIGBudWxsYCBpZiB0aGUgY29sbGVjdGlvbiBpcyBlbXB0eS5cbiAqL1xucHVibGljIGZ1biA8VD4gSXRlcmFibGU8VD4uZmlyc3RPck51bGwoKTogVD8ge1xuICAgIHdoZW4gKHRoaXMpIHtcbiAgICAgICAgaXMgTGlzdCAtPiB7XG4gICAgICAgICAgICBpZiAoaXNFbXB0eSgpKVxuICAgICAgICAgICAgICAgIHJldHVybiBudWxsXG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbMF1cbiAgICAgICAgfVxuICAgICAgICBlbHNlIC0+IHtcbiAgICAgICAgICAgIHZhbCBpdGVyYXRvciA9IGl0ZXJhdG9yKClcbiAgICAgICAgICAgIGlmICghaXRlcmF0b3IuaGFzTmV4dCgpKVxuICAgICAgICAgICAgICAgIHJldHVybiBudWxsXG4gICAgICAgICAgICByZXR1cm4gaXRlcmF0b3IubmV4dCgpXG4gICAgICAgIH1cbiAgICB9XG59XG5cbi8qKlxuICogUmV0dXJucyB0aGUgZmlyc3QgZWxlbWVudCwgb3IgYG51bGxgIGlmIHRoZSBsaXN0IGlzIGVtcHR5LlxuICovXG5wdWJsaWM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b25zLmRyb3BcbiAqL1xucHVibGljIGZ1biA8VD4gSXRlcmFibGU8VD4uZHJvcChuOiBJbnQpOiBMaXN0PFQ+IHtcbiAgICByZXF1aXJlKG4gPj0gMCkgeyBcIlJlcXVlc3RlZCBlbGVtZW50IGNvdW50ICRuIGlzIGxlc3MgdGhhbiB6ZXJvLlwiIH1cbiAgICBpZiAobiA9PSAwKSByZXR1cm4gdG9MaXN0KClcbiAgICB2YWwgbGlzdDogQXJyYXlMaXN0PFQ+XG4gICAgaWYgKHRoaXMgaXMgQ29sbGVjdGlvbjwqPikge1xuICAgICAgICB2YWwgcmVzdWx0U2l6ZSA9IHNpemUgLSBuXG4gICAgICAgIGlmIChyZXN1bHRTaXplIDw9IDApXG4gICAgICAgICAgICByZXR1cm4gZW1wdHlMaXN0KClcbiAgICAgICAgaWYgKHJlc3VsdFNpemUgPT0gMSlcbiAgICAgICAgICAgIHJldHVybiBsaXN0T2YobGFzdCgpKVxuICAgICAgICBsaXN0ID0gQXJyYXlMaXN0PFQ+KHJlc3VsdFNpemUpXG4gICAgICAgIGlmICh0aGlzIGlzIExpc3Q8VD4pIHtcbiAgICAgICAgICAgIGlmICh0aGlzIGlzIFJhbmRvbUFjY2Vzcykge1xuICAgICAgICAgICAgICAgIGZvciAoaW5kZXggaW4gbiB1bnRpbCBzaXplKVxuICAgICAgICAgICAgICAgICAgICBsaXN0LmFkZCh0aGlzW2luZGV4XSlcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgZm9yIChpdGVtIGluIGxpc3RJdGVyYXRvcihuKSlcbiAgICAgICAgICAgICAgICAgICAgbGlzdC5hZGQoaXRlbSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBsaXN0XG4gICAgICAgIH1cbiAgICB9XG4gICAgZWxzZSB7XG4gICAgICAgIGxpc3QgPSBBcnJheUxpc3Q8VD4oKVxuICAgIH1cbiAgICB2YXIgY291bnQgPSAwXG4gICAgZm9yIChpdGV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gZnVuIHRpbGVMYXllcnModGlsZUluZGV4OiBJbnQpOiBMaXN0PEdlb21MYXllcj5cblxuICAgIHByb3RlY3RlZCBhYnN0cmFjdCBmdW4gcGxvdExheW91dCgpOiBQbG90TGF5b3V0XG5cbiAgICBvdmVycmlkZSBmdW4gYnVpbGRDb21wb25lbnQoKSB7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBidWlsZFBsb3QoKVxuICAgICAgICB9IGNhdGNoIChlOiBSdW50aW1lRXhjZXB0aW9uKSB7XG4gICAgICAgICAgICBMT0cuZXJyb3IoZSkgeyBcImJ1aWxkUGxvdFwiIH1cblxuICAgICAgICAgICAgdmFsIHJvb3RDYXVzZSA9IFRocm93YWJsZXMuZ2V0Um9vdENhdXNlKGUpXG4gICAgICAgICAgICB2YWwgbWVzc2FnZXMgPSBhcnJheU9mKFxuICAgICAgICAgICAgICAgIFwiRXJyb3IgYnVpbGRpbmcgcGxvdDogXCIgKyByb290Q2F1c2U6OmNsYXNzLnNpbXBsZU5hbWUsIGlmIChyb290Q2F1c2UubWVzc2FnZSAhPSBudWxsKVxuICAgICAgICAgICAgICAgICAgICBcIidcIiArIHJvb3RDYXVzZS5tZXNzYWdlICsgXCInXCJcbiAgICAgICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgICAgIFwiPG5vIG1lc3NhZ2U+XCJcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIHZhciB5ID0gbXlQcmVmZXJyZWRTaXplLmdldCgpLnkgLyAyIC0gOFxuICAgICAgICAgICAgZm9yIChzIGluIG1lc3NhZ2VzKSB7XG4gICAgICAgICAgICAgICAgdmFsIGVycm9yTGFiZWwgPSBUZXh0TGFiZWwocylcbiAgICAgICAgICAgICAgICBlcnJvckxhYmVsLnNldEhvcml6b250YWxBbmNob3IoSG9yaXpvbnRhbEFuY2hvci5NSURETEUpXG4gICAgICAgICAgICAgICAgZXJyb3JMYWJlbC5zZXRWZXJ0aWNhbEFuY2hvcihWZXJ0aWNhbEFuY2hvci5DRU5URVIpXG4gICAgICAgICAgICAgICAgZXJyb3JMYWJlbC5tb3ZlVG8obXlQcmVmZXJyZWRTaXplLmdldCgpLnggLyAyLCB5KVxuICAgICAgICAgICAgICAgIHJvb3RHcm91cC5jaGlsZHJlbigpLmFkZChlcnJvckxhYmVsLnJvb3RHcm91cClcbiAgICAgICAgICAgICAgICB5ICs9IDE2LjBcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGJ1aWxkUGxvdCgpIHtcbiAgICAgICAgcm9vdEdyb3VwLmFkZENsYXNzKFN0eWxlLlBMT1QpXG4gICAgICAgIGJ1aWxkUGxvdENvbXBvbmVudHMoKVxuICAgICAgICByZWcobXlQcmVmZXJyZWRTaXplLmFkZEhhbmRsZXIob2JqZWN0IDogRXZlbnRIYW5kbGVyPFByb3BlcnR5Q2hhbmdlRXZlbnQ8b3V0IERvdWJsZVZlY3Rvcj4+IHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBvbkV2ZW50KGV2ZW50OiBQcm9wZXJ0eUNoYW5nZUV2ZW50PG91dCBEb3VibGVWZWN0b3I+KSB7XG4gICAgICAgICAgICAgICAgdmFsIG5ld1ZhbHVlID0gZXZlbnQubmV3VmFsdWVcbiAgICAgICAgICAgICAgICBpZiAobmV3VmFsdWUhIS54ID4gMCAmJiBuZXdWYWx1ZS55ID4gMCkge1xuICAgICAgICAgICAgICAgICAgICByZWJ1aWxkUGxvdCgpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KSlcblxuICAgICAgICByZWcob2JqZWN0IDogUmVnaXN0cmF0aW9uKCkge1xuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGRvUmVtb3ZlKCkge1xuICAgICAgICAgICAgICAgIG15VG9vbHRpcEhlbHBlci5yZW1vdmVBbGxUaWxlSW5mb3MoKVxuICAgICAgICAgICAgICAgIG15TGl2ZU1hcEZpZ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xuICAgICAgICBwbG90Qm91bmRzOiBEb3VibGVSZWN0YW5nbGUsXG4gICAgICAgIGdlb21Cb3VuZHM6IERvdWJsZVJlY3RhbmdsZVxuICAgICkge1xuICAgICAgICB2YWwgaG9yaXpvbnRhbEFuY2hvciA9IEhvcml6b250YWxBbmNob3IuTUlERExFXG4gICAgICAgIHZhbCB2ZXJ0aWNhbEFuY2hvcjogVmVydGljYWxBbmNob3IgPSB3aGVuIChvcmllbnRhdGlvbikge1xuICAgICAgICAgICAgT3JpZW50YXRpb24uTEVGVCwgT3JpZW50YXRpb24uUklHSFQsIE9yaWVudGF0aW9uLlRPUCAtPiBWZXJ0aWNhbEFuY2hvci5UT1BcbiAgICAgICAgICAgIE9yaWVudGF0aW9uLkJPVFRPTSAtPiBWZXJ0aWNhbEFuY2hvci5CT1RUT01cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCB0aXRsZUxvY2F0aW9uOiBEb3VibGVWZWN0b3JcbiAgICAgICAgdmFyIHJvdGF0aW9uID0gMC4wXG4gICAgICAgIHdoZW4gKG9yaWVudGF0aW9uKSB7XG4gICAgICAgICAgICBPcmllbnRhdGlvbi5MRUZUIC0+IHtcbiAgICAgICAgICAgICAgICB0aXRsZUxvY2F0aW9uID1cbiAgICAgICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHBsb3RCb3VuZHMubGVmdCArIFBsb3RMYXlvdXRVdGlsLkFYSVNfVElUTEVfT1VURVJfTUFSR0lOLCBnZW9tQm91bmRzLmNlbnRlci55KVxuICAgICAgICAgICAgICAgIHJvdGF0aW9uID0gLTkwLjBcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIE9yaWVudGF0aW9uLlJJR0hUIC0+IHtcbiAgICAgICAgICAgICAgICB0aXRsZUxvY2F0aW9uID1cbiAgICAgICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHBsb3RCb3VuZHMucmlnaHQgLSBQbG90TGF5b3V0VXRpbC5BWElTX1RJVExFX09VVEVSX01BUk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BsZWZ0IGF4aXMgdGl0bGUgd2lkdGhcbiAgICAgICAgdmFyIGdlb21BbmRBeGlzID0gd2l0aG91dFRpdGxlQW5kTGVnZW5kc1xuICAgICAgICBpZiAoaXNBeGlzRW5hYmxlZCkge1xuICAgICAgICAgICAgaWYgKGhhc0F4aXNUaXRsZUxlZnQoKSkge1xuICAgICAgICAgICAgICAgIHZhbCB0aXRsZVNpemUgPSBQbG90TGF5b3V0VXRpbC5heGlzVGl0bGVEaW1lbnNpb25zKGF4aXNUaXRsZUxlZnQpXG4gICAgICAgICAgICAgICAgdmFsIHRoaWNrbmVzcyA9XG4gICAgICAgICAgICAgICAgICAgIHRpdGxlU2l6ZS55ICsgUGxvdExheW91dFV0aWwuQVhJU19USVRMRV9PVVRFUl9NQVJHSU4gKyBQbG90TGF5b3V0VXRpbC5BWElTX1RJVExFX0lOTkVSX01BUkdJTlxuICAgICAgICAgICAgICAgIGdlb21BbmRBeGlzID0gRG91YmxlUmVjdGFuZ2xlKFxuICAgICAgICAgICAgICAgICAgICBnZW9tQW5kQXhpcy5sZWZ0ICsgdGhpY2tuZXNzLCBnZW9tQW5kQXhpcy50b3AsXG4gICAgICAgICAgICAgICAgICAgIGdlb21BbmRBeGlzLndpZHRoIC0gdGhpY2tuZXNzLCBnZW9tQW5kQXhpcy5oZWlnaHRcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIHN1YnRyYWN0IGJvdHRvbSBheGlzIHRpdGxlIGhlaWdodFxuICAgICAgICAgICAgaWYgKGhhc0F4aXNUaXRsZUJvdHRvbSgpKSB7XG4gICAgICAgICAgICAgICAgdmFsIHRpdGxlU2l6ZSA9IFBsb3RMYXlvdXRVdGlsLmF4aXNUaXRsZURpbWVuc2lvbnMoYXhpc1RpdGxlQm90dG9tKVxuICAgICAgICAgICAgICAgIHZhbCB0aGlja25lc3MgPVxuICAgICAgICAgICAgICAgICAgICB0aXRsZVNpemUueSArIFBsb3RMYXlv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ICAgIGJveGVzTGF5b3V0UmVzdWx0ID0gbGVnZW5kQm94ZXNMYXlvdXQuZG9MYXlvdXQobGVnZW5kQm94SW5mb3MpXG4gICAgICAgIH1cblxuICAgICAgICAvLyBidWlsZCB0aWxlc1xuICAgICAgICB2YWwgdGlsZVRoZW1lID0gaWYocGxvdEluZm8udGlsZXMuc2l6ZSA+IDEpIHtcbiAgICAgICAgICAgIHRoZW1lLm11bHRpVGlsZSgpXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGVtZVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHRpbGVzT3JpZ2luID0gZ2VvbUFuZEF4aXMub3JpZ2luXG4gICAgICAgIGZvciAodGlsZUxheW91dEluZm8gaW4gcGxvdEluZm8udGlsZXMpIHtcbi8vICAgICAgICBmb3IgKGkgaW4gcGxvdEluZm8udGlsZXMuaW5kaWNlcykge1xuLy8gICAgICAgICAgICB2YWwgdGlsZUxheW91dEluZm8gPSBwbG90SW5mby50aWxlc1tpXVxuICAgICAgICAgICAgdmFsIHRpbGVMYXllcnNJbmRleCA9IHRpbGVMYXlvdXRJbmZvLnRydWVJbmRleFxuXG4vLyAgICAgICAgICAgIHByaW50bG4oXCJwbG90IG9mZnNldDogXCIgKyB0aWxlSW5mby5wbG90T2Zmc2V0KVxuLy8gICAgICAgICAgICBwcmludGxuKFwiICAgICBib3VuZHM6IFwiICsgdGlsZUluZm8uYm91bmRzKVxuLy8gICAgICAgICAgICBwcmludGxuKFwiZ2VvbSBib3VuZHM6IFwiICsgdGlsZUluZm8uZ2VvbUJvdW5kcylcbi8vICAgICAgICAgICAgcHJpbnRsbihcImNsaXAgYm91bmRzOiBcIiArIHRpbGVJbmZvLmNsaXBCb3VuZHMpXG4gICAgICAgICAgICB2YWwgdGlsZSA9IGNyZWF0ZVRpbGUodGlsZXNPcmlnaW4sIHRpbGVMYXlvdXRJbmZvLCB0aWxlTGF5ZXJzKHRpbGVMYXllcnNJbmRleCksIHRpbGVUaG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FN0eWxlLlBMT1RfVElUTEUpXG4gICAgICAgICAgICB0aXRsZUxhYmVsLnNldEhvcml6b250YWxBbmNob3IoSG9yaXpvbnRhbEFuY2hvci5MRUZUKVxuICAgICAgICAgICAgdGl0bGVMYWJlbC5zZXRWZXJ0aWNhbEFuY2hvcihWZXJ0aWNhbEFuY2hvci5DRU5URVIpXG5cbiAgICAgICAgICAgIHZhbCB0aXRsZVNpemUgPSBQbG90TGF5b3V0VXRpbC50aXRsZURpbWVuc2lvbnModGl0bGUpXG4gICAgICAgICAgICB2YWwgdGl0bGVCb3VuZHMgPSBEb3VibGVSZWN0YW5nbGUoZ2VvbUFyZWFCb3VuZHMub3JpZ2luLngsIDAuMCwgdGl0bGVTaXplLngsIHRpdGxlU2l6ZS55KVxuICAgICAgICAgICAgdGl0bGVMYWJlbC5tb3ZlVG8oRG91YmxlVmVjdG9yKHRpdGxlQm91bmRzLmxlZnQsIHRpdGxlQm91bmRzLmNlbnRlci55KSlcbiAgICAgICAgICAgIGFkZCh0aXRsZUxhYmVsKVxuXG4gICAgICAgICAgICBAU3VwcHJlc3MoXCJDb25zdGFudENvbmRpdGlvbklmXCIpXG4gICAgICAgICAgICBpZiAoREVCVUdfRFJBV0lORykge1xuICAgICAgICAgICAgICAgIHZhbCByZWN0ID0gU3ZnUmVjdEVsZW1lbnQodGl0bGVCb3VuZHMpXG4gICAgICAgICAgICAgICAgcmVjdC5zdHJva2VDb2xvcigpLnNldChDb2xvci5CTFVFKVxuICAgICAgICAgICAgICAgIHJlY3Quc3Ryb2tlV2lkdGgoKS5zZXQoMS4wKVxuICAgICAgICAgICAgICAgIHJlY3QuZmlsbE9wYWNpdHkoKS5zZXQoMC4wKVxuICAgICAgICAgICAgICAgIGFkZChyZWN0KVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gYWRkIGF4aXMgdGl0bGVzXG4gICAgICAgIGlmIChpc0F4aXNFbmFibGVkKSB7XG4gICAgICAgICAgICBpZiAoaGFzQXhpc1RpdGxlTGVmdCgpKSB7XG4gICAgICAgICAgICAgICAgY3JlYXRlQXhpc1RpdGxlKFxuICAgICAgICAgICAgICAgICAgICBheGlzVGl0bGVMZWZ0LFxuICAgICAgICAgICAgICAgICAgICBPcmllbnRhdGlvbi5MRUZULFxuICAgICAgICAgICAgICAgICAgICB3aXRob3V0VGl0bGVBbmRMZWdlbmRzLFxuICAgICAgICAgICAgICAgICAgICBnZW9tQXJlYUJvdW5kc1xuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChoYXNBeGlzVGl0bGVCb3R0b20oKSkge1xuICAgICAgICAgICAgICAgIGNyZWF0ZUF4aXNUaXRsZShcbiAgICAgICAgICAgICAgICAgICAgYXhpc1RpdGxlQm90dG9tLFxuICAgICAgICAgICAgICAgICAgICBPcmllbnRhdGlvbi5CT1RUT00sXG4gICAgICAgICAgICAgICAgICAgIHdpdGhvdXRUaXRsZUFuZExlZ2VuZHMsXG4gICAgICAgICAgICAgICAgICAgIGdlb21BcmVhQm91bmRzXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gYWRkIGxlZ2VuZHNcbiAgICAgICAgaWYgKGJveGVzTGF5b3V0UmVzdWx0ICE9IG51bGwpIHtcbiAgICAgICAgICAgIGZvciAoYm94V2l0aExvY2F0aW9uIGluIGJveGVzTGF5b3V0UmVzdWx0LmJveFdpdGhMb2NhdGlvbkxpc3QpIHtcbiAgICAgICAgICAgICAgICB2YWwgbGVnZW5kQm94ID0gYm94V2l0aExvY2F0aW9uLmxlZ2VuZEJveC5jcmVhdGVMZWdlbmRCb3goKVxuICAgICAgICAgICAgICAgIGxlZ2VuZEJveC5tb3ZlVG8oYm94V2l0aExvY2F0aW9uLmxvY2F0aW9uKVxuICAgICAgICAgICAgICAgIGFkZChsZWdlbmRCb3gpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9X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AgICAgICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSB2YWwgbGVnZW5kQm94SW5mb3M6IExpc3Q8TGVnZW5kQm94SW5mbz5cbiAgICAgICAgICAgIGdldCgpID0gbXlMZWdlbmRCb3hJbmZvc1xuXG4gICAgICAgIGluaXQge1xuICAgICAgICAgICAgbXlMYXllcnNCeVRpbGUgPSBBcnJheUxpc3QoYi5teUxheWVyc0J5VGlsZSlcbiAgICAgICAgICAgIG15TGF5b3V0ID0gYi5teUxheW91dFxuICAgICAgICAgICAgbXlMZWdlbmRCb3hJbmZvcyA9IEFycmF5TGlzdChiLm15TGVnZW5kQm94SW5mb3MpXG5cbiAgICAgICAgICAgIGhhc0xpdmVNYXAgPSBiLmhhc0xpdmVNYXBcblxuICAgICAgICAgICAgaXNBeGlzRW5hYmxlZCA9IGIubXlBeGlzRW5hYmxlZFxuICAgICAgICAgICAgaXNJbnRlcmFjdGlvbnNFbmFibGVkID0gYi5teUludGVyYWN0aW9uc0VuYWJsZWRcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBoYXNUaXRsZSgpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiAhU3RyaW5ncy5pc051bGxPckVtcHR5KG15VGl0bGUpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaGFzQXhpc1RpdGxlTGVmdCgpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBteUF4aXNZVGl0bGVFbmFibGVkICYmICFTdHJpbmdzLmlzTnVsbE9yRW1wdHkobXlBeGlzVGl0bGVMZWZ0KVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhhc0F4aXNUaXRsZUJvdHRvbSgpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBteUF4aXNYVGl0bGVFbmFibGVkICYmICFTdHJpbmdzLmlzTnVsbE9yRW1wdHkobXlBeGlzVGl0bGVCb3R0b20pXG4gICAgICA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lsZUJvdW5kcyA9IG15TGF5b3V0SW5mby5ib3VuZHNcbiAgICAgICAgICAgIHZhbCByZWN0ID0gU3ZnUmVjdEVsZW1lbnQodGlsZUJvdW5kcylcbiAgICAgICAgICAgIHJlY3QuZmlsbENvbG9yKCkuc2V0KENvbG9yLkJMQUNLKVxuICAgICAgICAgICAgcmVjdC5zdHJva2VXaWR0aCgpLnNldCgwLjApXG4gICAgICAgICAgICByZWN0LmZpbGxPcGFjaXR5KCkuc2V0KDAuMSlcbiAgICAgICAgICAgIGFkZChyZWN0KVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGlzRGVidWdEcmF3aW5nKSB7XG4gICAgICAgICAgICB2YWwgY2xpcEJvdW5kcyA9IG15TGF5b3V0SW5mby5jbGlwQm91bmRzXG4gICAgICAgICAgICB2YWwgcmVjdCA9IFN2Z1JlY3RFbGVtZW50KGNsaXBCb3VuZHMpXG4gICAgICAgICAgICByZWN0LmZpbGxDb2xvcigpLnNldChDb2xvci5EQVJLX0dSRUVOKVxuICAgICAgICAgICAgcmVjdC5zdHJva2VXaWR0aCgpLnNldCgwLjApXG4gICAgICAgICAgICByZWN0LmZpbGxPcGFjaXR5KCkuc2V0KDAuMylcbiAgICAgICAgICAgIGFkZChyZWN0KVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGlzRGVidWdEcmF3aW5nKSB7XG4gICAgICAgICAgICB2YWwgcmVjdCA9IFN2Z1JlY3RFbGVtZW50KGdlb21Cb3VuZHMpXG4gICAgICAgICAgICByZWN0LmZpbGxDb2xvcigpLnNldChDb2xvci5QSU5LKVxuICAgICAgICAgICAgcmVjdC5zdHJva2VXaWR0aCgpLnNldCgxLjApXG4gICAgICAgICAgICByZWN0LmZpbGxPcGFjaXR5KCkuc2V0KDAuNSlcbiAgICAgICAgICAgIGFkZChyZWN0KVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gcmVuZGVyIGdlb21zXG5cbiAgICAgICAgaWYgKGxpdmVNYXBHZW9tTGF5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VvbUJvdW5kczogRG91YmxlUmVjdGFuZ2xlLCB0aGVtZTogRmFjZXRzVGhlbWUpIHtcbiAgICAgICAgLy8gZmFjZXQgWCBsYWJlbCAob24gdG9wIG9mIGdlb20gYXJlYSlcbiAgICAgICAgdmFsIHhMYWJlbHMgPSBteUxheW91dEluZm8uZmFjZXRYTGFiZWxzXG4gICAgICAgIGlmICh4TGFiZWxzLmlzTm90RW1wdHkoKSkge1xuICAgICAgICAgICAgdmFsIGxhYmVsU2l6ZSA9IGZhY2V0Q29sTGFiZWxTaXplKGdlb21Cb3VuZHMud2lkdGgpXG4gICAgICAgICAgICB2YWwgbGFiZWxPcmlnID0gRG91YmxlVmVjdG9yKFxuICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMubGVmdCArIEZBQ0VUX0hfUEFERElORyxcbiAgICAgICAgICAgICAgICBnZW9tQm91bmRzLnRvcCAtIGZhY2V0Q29sSGVhZEhlaWdodCh4TGFiZWxzLnNpemUpICsgRkFDRVRfVl9QQURESU5HXG4gICAgICAgICAgICApXG4gICAgICAgICAgICB2YXIgbGFiZWxCb3VuZHMgPSBEb3VibGVSZWN0YW5nbGUoXG4gICAgICAgICAgICAgICAgbGFiZWxPcmlnLCBsYWJlbFNpemVcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIGZvciAoeExhYmVsIGluIHhMYWJlbHMpIHtcbiAgICAgICAgICAgICAgICB2YWwgcmVjdCA9IFN2Z1JlY3RFbGVtZW50KGxhYmVsQm91bmRzKS5hcHBseSB7XG4gICAgICAgICAgICAgICAgICAgIHN0cm9rZVdpZHRoKCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICAgICAgZmlsbENvbG9yKCkuc2V0KHRoZW1lLmxhYmVsQmFja2dyb3VuZCgpKVxuXG4vLyAgICAgICAgICAgICAgICAgICAgc3Ryb2tlV2lkdGgoKS5zZXQoMS4wKVxuLy8gICAgICAgICAgICAgICAgICAgIHN0cm9rZUNvbG9yKCkuc2V0KENvbG9yLkJMQUNLKVxuLy8gICAgICAgICAgICAgICAgICAgIGZpbGxPcGFjaXR5KCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYWRkKHJlY3QpXG5cbiAgICAgICAgICAgICAgICB2YWwgeCA9IGxhYmVsQm91bmRzLmNlbnRlci54XG4gICAgICAgICAgICAgICAgdmFsIHkgPSBsYWJlbEJvdW5kcy5jZW50ZXIueVxuICAgICAgICAgICAgICAgIHZhbCBsYWIgPSBUZXh0TGFiZWwoeExhYmVsKVxuICAgICAgICAgICAgICAgIGxhYi5tb3ZlVG8oeCwgeSlcbiAgICAgICAgICAgICAgICBsYWIuc2V0SG9yaXpvbnRhbEFuY2hvcihUZXh0TGFiZWwuSG9yaXpvbnRhbEFuY2hvci5NSURETEUpXG4gICAgICAgICAgICAgICAgbGFiLnNldFZlcnRpY2FsQW5jaG9yKFRleHRMYWJlbC5WZXJ0aWNhbEFuY2hvci5DRU5URVIpXG4gICAgICAgICAgICAgICAgYWRkKGxhYilcblxuICAgICAgICAgICAgICAgIGxhYmVsQm91bmRzID0gbGFiZWxCb3VuZHMuYWRkKERvdWJsZVZlY3RvcigwLjAsIGxhYmVsU2l6ZS55KSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIC8vIGZhY2V0IFkgbGFiZWwgKHRvIHRoZSByaWdodCBmcm9tIGdlb20gYXJlYSlcbiAgICAgICAgaWYgKG15TGF5b3V0SW5mby5mYWNldFlMYWJlbCAhPSBudWxsKSB7XG5cbiAgICAgICAgICAgIHZhbCBoUGFkID0gRkFDRVRfVl9QQURESU5HXG4gICAgICAgICAgICB2YWwgdlBhZCA9IEZBQ0VUX0hfUEFERElOR1xuXG4gICAgICAgICAgICB2YWwgbGFiZWxCb3VuZHMgPSBEb3VibGVSZWN0YW5nbGUoXG4gICAgICAgICAgICAgICAgZ2VvbUJvdW5kcy5yaWdodCArIGhQYWQsIGdlb21Cb3VuZHMudG9wIC0gdlBhZ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F4aXMsIGluZm8pXG4gICAgICAgIEF4aXNVdGlsLmFwcGx5VGhlbWUoYXhpcywgdGhlbWUpXG4gICAgICAgIGlmIChpc0RlYnVnRHJhd2luZykge1xuICAgICAgICAgICAgaWYgKGluZm8udGlja0xhYmVsc0JvdW5kcyAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgdmFsIHJlY3QgPSBTdmdSZWN0RWxlbWVudChpbmZvLnRpY2tMYWJlbHNCb3VuZHMpXG4gICAgICAgICAgICAgICAgcmVjdC5zdHJva2VDb2xvcigpLnNldChDb2xvci5HUkVFTilcbiAgICAgICAgICAgICAgICByZWN0LnN0cm9rZVdpZHRoKCkuc2V0KDEuMClcbiAgICAgICAgICAgICAgICByZWN0LmZpbGxPcGFjaXR5KCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICBheGlzLmFkZChyZWN0KVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBheGlzXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gYnVpbGRHZW9tcyhcbiAgICAgICAgc2hhcmVkTnVtZXJpY01hcHBlcnM6IE1hcDxBZXM8RG91YmxlPiwgKERvdWJsZT8pIC0+IERvdWJsZT8+LFxuICAgICAgICBvdmVyYWxsTnVtZXJpY0RvbWFpbnM6IE1hcDxBZXM8RG91YmxlPiwgQ2xvc2VkUmFuZ2U8RG91YmxlPj4sXG4gICAgICAgIGNvb3JkOiBDb29yZGluYXRlU3lzdGVtXG4gICAgKTogTGlzdDxTdmdDb21wb25lbnQ+IHtcblxuICAgICAgICB2YWwgbGF5ZXJSZW5kZXJlcnMgPSBBcnJheUxpc3Q8U3ZnQ29tcG9uZW50PigpXG4gICAgICAgIGZvciAobGF5ZXIgaW4gbXlMYXllcnMpIHtcbiAgICAgICAgICAgIHZhbCByZW5kZXJlckRhdGEgPSBMYXllclJlbmRlcmVyVXRpbC5jcmVhdGVMYXllclJlbmRlcmVyRGF0YShcbiAgICAgICAgICAgICAgICBsYXllcixcbiAgICAgICAgICAgICAgICBzaGFyZWROdW1lcmljTWFwcGVycyxcbiAgICAgICAgICAgICAgICBvdmVyYWxsTnVtZXJpY0RvbWFpbnNcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgdmFsIGFlc3RoZXRpY01hcHBlcnMgPSByZW5kZXJlckRhdGEuYWVzdGhldGljTWFwcGVyc1xuICAgICAgICAgICAgdmFsIGFlc3RoZXRpY3MgPSByZW5kZXJlckRhdGEuYWVzdGhldGljc1xuXG4gICAgICAgICAgICB2YWwgdGFyZ2V0Q29sbGVjdG9yID0gTGF5ZXJUYXJnZXRDb2xsZWN0b3JXaXRoTG9jYXRvcihcbiAgICAgICAgICAgICAgICBsYXllci5nZW9tS2luZCxcbiAgICAgICAgICAgICAgICBsYXllci5sb2NhdG9yTG9va3VwU3BlYyxcbiAgICAgICAgICAgICAgICBsYXllci5jb250ZXh0dWFsTWFwcGluZyxcbiAgICAgICAgICAgICAgICBjb29yZFxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgbXlUYXJnZXRMb2NhdG9ycy5hZGQodGFyZ2V0Q29sbGVjdG9yKVxuXG4gICAgICAgICAgICB2YWwgY3R4ID0gR2VvbUNvbnRleHRCdWlsZGVyKClcbiAgICAgICAgICAgICAgICAuYWVzdGhldGljcyhhZXN0aGV0aWNzKVxuICAgICAgICAgICAgICAgIC5hZXN0aGV0aWNNYXBwZXJzKGFlc3RoZXRpY01hcHBlcnMpXG4gICAgICAgICAgICAgICAgLmdlb21UYXJnZXRDb2xsZWN0b3IodGFyZ2V0Q29sbGVjdG9yKVxuICAgICAgICAgICAgICAgIC5idWlsZCgpXG5cbiAgICAgICAgICAgIHZhbCBwb3MgPSByZW5kZXJlckRhdGEucG9zXG4gICAgICAgICAgICB2YWwgZ2VvbSA9IGxheWVyLmdlb21cblxuICAgICAgICAgICAgbGF5ZXJSZW5kZXJlcnMuYWRkKFN2Z0xheWVyUmVuZGVyZXIoYWVzdGhldGljcywgZ2VvbSw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0ID0gbG9jYXRvci5zZWFyY2gocGxvdENvb3JkKVxuICAgICAgICAgICAgICAgICAgICBpZiAocmVzdWx0ICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGFkZExvb2t1cFJlc3VsdChyZXN1bHQsIHBsb3RDb29yZClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB0YXJnZXRzUGlja2VyLnBpY2tlZFxuICAgICAgICB9XG5cbiAgICAgICAgaW50ZXJuYWwgb3BlcmF0b3IgZnVuIGNvbnRhaW5zKHBsb3RDb29yZDogRG91YmxlVmVjdG9yKTogQm9vbGVhbiB7XG4gICAgICAgICAgICByZXR1cm4gZ2VvbUJvdW5kcy5jb250YWlucyhwbG90Q29vcmQpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGlubmVyIGNsYXNzIFRpbGVUYXJnZXRMb2NhdG9yKGxvY2F0b3I6IEdlb21UYXJnZXRMb2NhdG9yKSA6IFRyYW5zZm9ybWVkVGFyZ2V0TG9jYXRvcihsb2NhdG9yKSB7XG5cbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjb252ZXJ0VG9UYXJnZXRDb29yZChjb29yZDogRG91YmxlVmVjdG9yKTogRG91YmxlVmVjdG9yIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29vcmQuc3VidHJhY3QoZ2VvbUJvdW5kcy5vcmlnaW4pXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjb252ZXJ0VG9QbG90Q29vcmQoY29vcmQ6IERvdWJsZVZlY3Rvcik6IERvdWJsZVZlY3RvciB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGNvb3JkLmFkZChnZW9tQm91bmRzLm9yaWdpbilcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGNvbnZlcnRUb1Bsb3REaXN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hbCBwb3MgPSBjcmVhdGVMYXllclBvcyhsYXllciwgYWVzKVxuICAgICAgICBpZiAocG9zLmlzSWRlbnRpdHkpIHtcbiAgICAgICAgICAgIC8vIHNpbXBsaWZpZWQgcmFuZ2VzXG4gICAgICAgICAgICB2YWwgcmFuZ2VYID0gY29tYmluZVJhbmdlcyhwb3NBZXNYLCBhZXMpXG4gICAgICAgICAgICB2YWwgcmFuZ2VZID0gY29tYmluZVJhbmdlcyhwb3NBZXNZLCBhZXMpXG4gICAgICAgICAgICByZXR1cm4gUGFpcihyYW5nZVgsIHJhbmdlWSlcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBhZGp1c3RlZE1pblggPSAwLjBcbiAgICAgICAgdmFyIGFkanVzdGVkTWF4WCA9IDAuMFxuICAgICAgICB2YXIgYWRqdXN0ZWRNaW5ZID0gMC4wXG4gICAgICAgIHZhciBhZGp1c3RlZE1heFkgPSAwLjBcbiAgICAgICAgdmFyIHJhbmdlc0luaXRlZCA9IGZhbHNlXG5cbiAgICAgICAgdmFsIGNhcmRpbmFsaXR5ID0gcG9zQWVzWC5zaXplICogcG9zQWVzWS5zaXplXG4gICAgICAgIHZhbCBweCA9IGFycmF5T2ZOdWxsczxEb3VibGU+KGNhcmRpbmFsaXR5KVxuICAgICAgICB2YWwgcHkgPSBhcnJheU9mTnVsbHM8RG91YmxlPihjYXJkaW5hbGl0eSlcbiAgICAgICAgZm9yIChwIGluIGFlcy5kYXRhUG9pbnRzKCkpIHtcbiAgICAgICAgICAgIHZhciBpID0gLTFcbiAgICAgICAgICAgIGZvciAoYWVzWCBpbiBwb3NBZXNYKSB7XG4gICAgICAgICAgICAgICAgdmFsIHZhbFggPSBwLm51bWVyaWMoYWVzWClcbiAgICAgICAgICAgICAgICBmb3IgKGFlc1kgaW4gcG9zQWVzWSkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgdmFsWSA9IHAubnVtZXJpYyhhZXNZKVxuICAgICAgICAgICAgICAgICAgICBpKytcbiAgICAgICAgICAgICAgICAgICAgcHhbaV0gPSB2YWxYXG4gICAgICAgICAgICAgICAgICAgIHB5W2ldID0gdmFsWVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgd2hpbGUgKGkgPj0gMCkge1xuICAgICAgICAgICAgICAgIGlmIChweFtpXSAhPSBudWxsICYmIHB5W2ldICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHggPSBweFtpXVxuICAgICAgICAgICAgICAgICAgICB2YWwgeSA9IHB5W2ldXG4gICAgICAgICAgICAgICAgICAgIGlmIChpc0Zpbml0ZSh4KSAmJiBpc0Zpbml0ZSh5KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIG5ld0xvYyA9IHBvcy50cmFuc2xhdGUoRG91YmxlVmVjdG9yKHghISwgeSEhKSwgcCwgZ2VvbUN0eClcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBhZGp1c3RlZFggPSBuZXdMb2MueFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIGFkanVzdGVkWSA9IG5ld0xvYy55XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocmFuZ2VzSW5pdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRqdXN0ZWRNaW5YID0gbWluKGFkanVzdGVkWCwgYWRqdXN0ZWRNaW5YKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkanVzdGVkTWF4WCA9IG1heChhZGp1c3RlZFgsIGFkanVzdGVkTWF4WClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGp1c3RlZE1pblkgPSBtaW4oYWRqdXN0ZWRZLCBhZGp1c3RlZE1pblkpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRqdXN0ZWRNYXhZID0gbWF4KGFkanVzdGVkWSwgYWRqdXN0ZWRNYXhZKVxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGp1c3RlZE1heFggPSBhZGp1c3RlZFhcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGp1c3RlZE1pblggPSBhZGp1c3RlZE1heFhcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGp1c3RlZE1heFkgPSBhZGp1c3RlZFlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGp1c3RlZE1pblkgPSBhZGp1c3RlZE1heFlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByYW5nZXNJbml0ZWQgPSB0cnVlXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaS0tXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICAvLyBYIHJhbmdlXG4gICAgICAgIHZhbCB4UmFuZ2UgPSBpZiAocmFuZ2VzSW5pdGVkKVxuICAgICAgICAgICAgQ2xvc2VkUmFuZ2UoYWRqdXN0ZWRNaW5YLCBhZGp1c3RlZE1heFgpXG4gICAgICAgIGVsc2VcbiAgICAgICAgICAgIG51bGxcblxuICAgICAgICB2YWwgeVJhbmdlID0gaWYgKHJhbmdlc0luaXRlZClcbiAgICAgICAgICAgIENsb3NlZFJhbmdlKGFkanVzdGVkTWluWSwgYWRqdXN0ZWRNYXhZKVxuICAgICAgICBlbHNlXG4gICAgICAgICAgICBudWxsXG4gICAgICAgIHJldHVybiBQYWlyKHhSYW5nZSwgeVJhbmdlKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNvbXB1dGVMYXllckRyeVJ1blhZUmFuZ2VzQWZ0ZXJTaXplRXhwYW5kKFxuICAgICAgICBsYXllcjogR2VvbUxheWVyLFxuICAgICAgICBhZXN0aGV0aWNzOiBBZXN0aGV0aWNzLFxuICAgICAgICBnZW9tQ3R4OiBHZW9tQ29udGV4dFxuICAgICk6IFBhaXI8Q2xvc2VkUmFuZ2U8RG91YmxlPj8sIENsb3NlZFJhbmdlPERvdWJsZT4/PiB7XG4gICAgICAgIHZhbCByZW5kZXJlZEFlcyA9IGxheWVyLnJlbmRlcmVkQWVzKClcbiAgICAgICAgdmFsIGNvbXB1dGVFeHBhbmRYID0gcmVuZGVyZWRBZXMuY29udGFpbnMoQWVzLldJRFRIKVxuICAgICAgICB2YWwgY29tcHV0ZUV4cGFuZFkgPSByZW5kZXJlZEFlcy5jb250YWlucyhBZXMuSEVJR0hUKVxuICAgICAgICB2YWwgcmFuZ2VYID0gaWYgKGNvbXB1dGVFeHBhbmRYKVxuICAgICAgICAgICAgY29tcHV0ZUxheWVyRHJ5UnVuUmFuZ2VBZnRlclNpemVFeHBhbmQoXG4gICAgICAgICAgICAgICAgQWVzLlgsXG4gICAgICAgICAgICAgICAgQWVzLldJRFRILFxuICAgICAgICAgICAgICAgIGFlc3RoZXRpY3MsXG4gICAgICAgICAgICAgICAgZ2VvbUN0eFxuICAgICAgICAgICAgKVxuICAgICAgICBlbHNlXG4gICAgICAgICAgICBudWxsXG4gICAgICAgIHZhbCByYW5nZVkgPSBpZiAoY29tcHV0ZUV4cGFuZFkpXG4gICAgICAgICAgICBjb21wdXRlTGF5ZXJEcnlSdW5SYW5nZUFmdGVyU2l6ZUV4cGFuZChcbiAgICAgICAgICAgICAgICBBZXMuWSxcbiAgICAgICAgICAgICAgICBBZXMuSEVJR0hULFxuICAgICAgICAgICAgICAgIGFlc3RoZXRpY3MsXG4gICAgICAgICAgICAgICAgZ2VvbUN0eFxuICAgICAgICAgICAgKVxuICAgICAgICBlbHNlXG4gICAgICAgICAgICBudWxsXG5cbiAgICAgICAgcmV0dXJuIFBhaXIocmFuZ2VYLCByYW5nZVkpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gY29tcHV0ZUxheWVyRHJ5UnVuUmFuZ2VBZnRlclNpemVFeHBhbmQoXG4gICAgICAgIGxvY2F0aW9uQWVzOiBBZXM8RG91YmxlPiwgc2l6ZUFl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gIG1hcHBlciA9IHNoYXJlZE51bWVyaWNNYXBwZXJzW0Flcy5YXVxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoQWVzLmlzUG9zaXRpb25hbFkoYWVzKSkge1xuICAgICAgICAgICAgICAgICAgICBtYXBwZXIgPSBzaGFyZWROdW1lcmljTWFwcGVyc1tBZXMuWV1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobWFwcGVyID09IG51bGwgJiYgbGF5ZXIuaGFzQmluZGluZyhhZXMpKSB7XG4gICAgICAgICAgICAgICAgbWFwcGVyID0gbGF5ZXIuc2NhbGVNYXBbYWVzXS5tYXBwZXJcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKG1hcHBlciAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgbWFwcGVyc1thZXNdID0gbWFwcGVyXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1hcHBlcnNcbiAgICB9XG5cbiAgICBpbnRlcm5hbCBmdW4gY3JlYXRlTGF5ZXJBZXN0aGV0aWNzKFxuICAgICAgICBsYXllcjogR2VvbUxheWVyLFxuICAgICAgICBzaGFyZWRNYXBwZXJzOiBNYXA8QWVzPCo+LCAoRG91YmxlPykgLT4gQW55Pz4sXG4gICAgICAgIG92ZXJhbGxOdW1lcmljRG9tYWluczogTWFwPEFlczxEb3VibGU+LCBDbG9zZWRSYW5nZTxEb3VibGU+PlxuICAgICk6IEFlc3RoZXRpY3Mge1xuXG4gICAgICAgIHZhbCBhZXNCdWlsZGVyID0gQWVzdGhldGljc0J1aWxkZXIoKVxuICAgICAgICBhZXNCdWlsZGVyLmdyb3VwKGxheWVyLmdyb3VwKVxuICAgICAgICBmb3IgKChhZXMsIGRvbWFpbikgaW4gb3ZlcmFsbE51bWVyaWNEb21haW5zKSB7XG4gICAgICAgICAgICBzaGFyZWRNYXBwZXJzW2Flc10/LmxldCB7IG1hcHBlciAtPlxuICAgICAgICAgICAgICAgIHZhbCByYW5nZSA9IENsb3NlZFJhbmdlKFxuICAgICAgICAgICAgICAgICAgICBtYXBwZXIoZG9tYWluLmxvd2VyRW5kKSBhcyBEb3VibGUsXG4gICAgICAgICAgICAgICAgICAgIG1hcHBlcihkb21haW4udXBwZXJFbmQpIGFzIERvdWJsZVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICBhZXNCdWlsZGVyLm92ZXJhbGxSYW5nZShhZXMsIHJhbmdlKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGhhc1Bvc2l0aW9uYWxDb25zdGFudHMgPSBmYWxzZVxuICAgICAgICBmb3IgKGFlcyBpbiBsYXllci5yZW5kZXJlZEFlcygpKSB7XG4gICAgICAgICAgICBpZiAoQWVzLmlzUG9zaXRpb25hbChhZXMpICYmIGxheWVyLmhhc0NvbnN0YW50KGFlcykpIHtcbiAgICAgICAgICAgICAgICBoYXNQb3NpdGlvbmFsQ29uc3RhbnRzID0gdHJ1ZVxuICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgZGF0YSA9IGxheWVyLmRhdGFGcmFtZVxuICAgICAgICB2YXIgZGF0YVBvaW50Q291bnQ6IEludD8gPSBudWxsXG4gICAgICAgIGZvciAoYWVzIGluIGxheWVyLnJlbmRlcmVkQWVzKCkpIHtcbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIlVOQ0hFQ0tFRF9DQVNUXCIsIFwiTkFNRV9TSEFET1dJTkdcIilcbiAgICAgICAgICAgIHZhbCBhZXMgPSBhZXMgYXMgQWVzPEFueT5cblxuICAgICAgICAgICAgdmFsIG1hcHBlck9wdGlvbiA9IHNoYXJlZE1hcHBlcnNbYWVzXVxuICAgICAgICAgICAgaWYgKGxheWVyLmhhc0NvbnN0YW50KGFlcykpIHtcbiAgICAgICAgICAgICAgICAvLyBDb25zdGFudCBvdmVycmlkZXMgYmluZGluZ1xuICAgICAgICAgICAgICAgIHZhbCB2ID0gbGF5ZXIuZ2V0Q29uc3RhbnQoYWVzKVxuICAgICAgICAgICAgICAgIGFlc0J1aWxkZXIuY29uc3RhbnRBZXMoYWVzLCBhc0Flc1ZhbHVlKGFlcywgdiwgbWFwcGVyT3B0aW9uKSlcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gTm8gY29uc3RhbnQgLSBsb29rLXVwIGFlcyBtYXBwaW5nXG4gICAgICAgICAgICAgICAgaWYgKGxheWVyLmhhc0JpbmRpbmcoYWVzKSkge1xuICAgICAgICAgICAgICAgICAgICBjaGVjayhtYXBwZXJPcHRpb24gIT0gbnVsbCkgeyBcIk5vIHNjYWxlIG1hcHBlciBkZWZpbmVkIGZvciBhZXN0aGV0aWMgJGFlc1wiIH1cblxuICAgICAgICAgICAgICAgICAgICAvLyB2YXJpYWJsZSBhdCB0aGlzIHBvaW50IG11c3QgYmUgZWl0aGVyIFNUQVQgb3IgVFJBTlNGT1JNIChidXQgbm90IE9SSUdJTilcbiAgICAgICAgICAgICAgICAgICAgdmFsIHRyYW5zZm9ybVZhciA9IERhdGFGcmFtZVV0aWwudHJhbnNmb3JtVmFyRm9yKGFlcylcbiAgICAgICAgICAgICAgICAgICAgY2hlY2soZGF0YS5oYXModHJhbnNmb3JtVmFyKSkgeyBcIlVuZGVmaW5lZCB2YXIgJHRyYW5zZm9ybVZhciBmb3IgYWVzdGhldGljICRhZXNcIiB9XG4gICAgICAgICAgICAgICAgICAgIHZhbCBudW1lcmljVmFsdWVzID0gZGF0YS5nZXROdW1lcmljKHRyYW5zZm9ybVZhcilcblxuICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YVBvaW50Q291bnQgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YVBvaW50Q291bnQgPSBudW1lcmljVmFsdWVzLnNpemVcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoZWNrKGRhdGFQb2ludENvdW50ID09IG51bWVyaWNWYWx1ZXMuc2l6ZSlcbiAgICAgICAgICAgICAgICAgICAgICAgIHsgXCJcIiArIGFlcyArIFwiIGV4cGVjdGVkIGRhdGEgc2l6ZT1cIiArIGRhdGFQb2ludENvdW50ICsgXCIgd2FzIHNpemU9XCIgKyBudW1lcmljVmFsdWVzLnNpemUgfVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGFQb2ludENvdW50ID09IDAgJiYgaGFzUG9zaXRpb25hbENvbnN0YW50cykge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHV0IGNvbnN0YW50IGluc3RlYWQgb2YgZW1wdHkgbGlzdFxuICAgICAgICAgICAgICAgICAgICAgICAgYWVzQnVpbGRlci5jb25zdGFudEFlcyhhZXMsIGxheWVyLmFlc3RoZXRpY3NEZWZhdWx0cy5kZWZhdWx0VmFsdWUoYWVzKSlcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBpbnRlZ2VyRnVuY3Rpb24gPSBsaXN0TWFwcGVyKG51bWVyaWNWYWx1ZXMsIG1hcHBlck9wdGlvbilcbiAgICAgICAgICAgICAgICAgICAgICAgIGFlc0J1aWxkZXIuYWVzKGFlcywgaW50ZWdlckZ1bmN0aW9uKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gYXBwbHkgZGVmYXVsdFxuICAgICAgICAgICAgICAgICAgICB2YWwgdiA9IGxheWVyLmdldERlZmF1bHQoYWVzKVxuICAgICAgICAgICAgICAgICAgICBhZXNCdWlsZGVyLmNvbnN0YW50QWVzKFxuICAgICAgICAgICAgICAgICAgICAgICAgYWVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgYXNBZXNWYWx1ZShhZXMsIHYsIG1hcHBlck9wdGlvbilcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChkYXRhUG9pbnRDb3VudCAhPSBudWxsICYmIGRhdGFQb2ludENvdW50ID4gMCkge1xuICAgICAgICAgICAgYWVzQnVpbGRlci5kYXRhUG9pbnRDb3VudChkYXRhUG9pbnRDb3VudClcbiAgICAgICAgfSBlbHNlIGlmIChoYXNQb3NpdGlvbmFsQ29uc3RhbnRzKSB7XG4gICAgICAgICAgICAvLyBzb21lIGdlb21zIChwb2ludCwgYWJsaW5lIGV0Yy4pIGNhbiBiZSBwbG90dGVkIHdpdGggb25seSBjb25zdGFudHNcbiAgICAgICAgICAgIGFlc0J1aWxkZXIuZGF0YVBvaW50Q291bnQoMSlcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBhZXNCdWlsZGVyLmJ1aWxkKClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biA8VD4gYXNBZXNWYWx1ZShhZXM6IEFlczwqPiwgZGF0YVZhbHVlOiBULCBtYXBwZXJPcHRpb246ICgoRG91YmxlPykgLT4gVD8pPyk6IFQge1xuICAgICAgICByZXR1cm4gaWYgKGFlcy5pc051bWVyaWMgJiYgbWFwcGVyT3B0aW9uICE9IG51bGwpIHtcbiAgICAgICAgICAgIG1hcHBlck9wdGlvbihkYXRhVmFsdWUgYXM/IERvdWJsZSlcbiAgICAgICAgICAgICAgICA/OiB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oXCJDYW4ndCBtYXAgJGRhdGFWYWx1ZSB0byBhZXN0aGV0aWMgJGFlc1wiKVxuICAgICAgICB9IGVsc2UgZGF0YVZhbHVlXG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogRXhwYW5kIFgvWS1yYW5nZSB0byBlbnN1cmUgdGhhdCB0aGUgZGF0YSBpcyBwbGFjZWQg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gICAgICAgICBsZWdlbmRUaXRsZSxcbiAgICAgICAgICAgIGRvbWFpbixcbiAgICAgICAgICAgIGd1aWRlQnJlYWtzLFxuICAgICAgICAgICAgc2NhbGUsXG4gICAgICAgICAgICB0aGVtZSxcbiAgICAgICAgICAgIGNvbG9yQmFyT3B0aW9uc1xuICAgICAgICApXG5cbiAgICAgICAgcmV0dXJuIG9iamVjdCA6IExlZ2VuZEJveEluZm8oc3BlYy5zaXplKSB7XG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlTGVnZW5kQm94KCk6IExlZ2VuZEJveCB7XG4gICAgICAgICAgICAgICAgdmFsIGMgPSBDb2xvckJhckNvbXBvbmVudChzcGVjKVxuICAgICAgICAgICAgICAgIGMuZGVidWcgPSBERUJVR19EUkFXSU5HXG4gICAgICAgICAgICAgICAgcmV0dXJuIGNcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGludGVybmFsIGZ1biBzZXRPcHRpb25zKG9wdGlvbnM6IENvbG9yQmFyT3B0aW9ucz8pIHtcbiAgICAgICAgY29sb3JCYXJPcHRpb25zID0gb3B0aW9uc1xuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBwcml2YXRlIGNvbnN0IHZhbCBERUJVR19EUkFXSU5HID0gamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuRmVhdHVyZVN3aXRjaC5MRUdFTkRfREVCVUdfRFJBV0lOR1xuXG4gICAgICAgIGZ1biBjcmVhdGVDb2xvckJhclNwZWMoXG4gICAgICAgICAgICB0aXRsZTogU3RyaW5nLFxuICAgICAgICAgICAgZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICAgICAgYnJlYWtzOiBMaXN0PEd1aWRlQnJlYWs8RG91YmxlPj4sXG4gICAgICAgICAgICBzY2FsZTogU2NhbGU8Q29sb3I+LFxuICAgICAgICAgICAgdGhlbWU6IExlZ2VuZFRoZW1lLFxuICAgICAgICAgICAgb3B0aW9uczogQ29sb3JCYXJPcHRpb25zPyA9IG51bGxcbiAgICAgICAgKTogQ29sb3JCYXJDb21wb25lbnRTcGVjIHtcblxuICAgICAgICAgICAgdmFsIGxlZ2VuZERpcmVjdGlvbiA9IExlZ2VuZEFzc2VtYmxlclV0aWwubGVnZW5kRGlyZWN0aW9uKHRoZW1lKVxuICAgICAgICAgICAgdmFsIGhvcml6b250YWw6IEJvb2xlYW4gPSBsZWdlbmREaXJlY3Rpb24gPT0gTGVnZW5kRGlyZWN0aW9uLkhPUklaT05UQUxcblxuICAgICAgICAgICAgdmFsIHdpZHRoID0gb3B0aW9ucz8ud2lkdGhcbiAgICAgICAgICAgIHZhbCBoZWlnaHQgPSBvcHRpb25zPy5oZWlnaHRcbiAgICAgICAgICAgIHZhciBiYXJTaXplID0gQ29sb3JCYXJDb21wb25lbnRTcGVjLmJhckFic29sdXRlU2l6ZShob3Jpem9udGFsLCB0aGVtZSlcbiAgICAgICAgICAgIGlmICh3aWR0aCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgYmFyU2l6ZSA9IERvdWJsZVZlY3Rvcih3aWR0aCwgYmFyU2l6ZS55KVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGhlaWdodCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgYmFyU2l6ZSA9IERvdWJsZVZlY3RvcihiYXJTaXplLngsIGhlaWdodClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIHJldmVyc2UgPSAhaG9yaXpvbnRhbFxuXG4gICAgICAgICAgICB2YWwgbGF5b3V0ID0gd2hlbiB7XG4gICAgICAgICAgICAgICAgaG9yaXpvbnRhbCAtPiBDb2xvckJhckNvbXBvbmVudExheW91dC5ob3Jpem9udGFsKHRpdGxlLCBkb21haW4sIGJyZWFrcywgYmFyU2l6ZSwgcmV2ZXJzZSlcbiAgICAgICAgICAgICAgICBlbHNlIC0+IENvbG9yQmFyQ29tcG9uZW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lR2VvbUNvbnRleHQge1xuICAgICAgICB2YWwgbXlBZXN0aGV0aWNzID0gYi5teUFlc3RoZXRpY3NcbiAgICAgICAgdmFsIG15QWVzdGhldGljTWFwcGVycyA9IGIubXlBZXN0aGV0aWNNYXBwZXJzXG4gICAgICAgIG92ZXJyaWRlIHZhbCB0YXJnZXRDb2xsZWN0b3IgPSBiLm15R2VvbVRhcmdldENvbGxlY3RvclxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBnZXRSZXNvbHV0aW9uKGFlczogQWVzPERvdWJsZT4pOiBEb3VibGUge1xuICAgICAgICAgICAgdmFyIHJlc29sdXRpb24gPSAwLjBcbiAgICAgICAgICAgIGlmIChteUFlc3RoZXRpY3MgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJlc29sdXRpb24gPSBteUFlc3RoZXRpY3MucmVzb2x1dGlvbihhZXMsIDAuMClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChyZXNvbHV0aW9uIDw9IFNlcmllc1V0aWwuVElOWSkge1xuICAgICAgICAgICAgICAgIHJlc29sdXRpb24gPSBnZXRVbml0UmVzb2x1dGlvbihhZXMpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiByZXNvbHV0aW9uXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gZ2V0VW5pdFJlc29sdXRpb24oYWVzOiBBZXM8RG91YmxlPik6IERvdWJsZSB7XG4gICAgICAgICAgICB2YWwgbWFwcGVyID0gbXlBZXN0aGV0aWNNYXBwZXJzPy5nZXQoYWVzKSA/OiBNYXBwZXJzLklERU5USVRZXG4gICAgICAgICAgICByZXR1cm4gbWFwcGVyKDEuMCkgYXMgRG91YmxlXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gd2l0aFRhcmdldENvbGxlY3Rvcih0YXJnZXRDb2xsZWN0b3I6IEdlb21UYXJnZXRDb2xsZWN0b3IpOiBHZW9tQ29udGV4dCB7XG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GVyIHtcbiAgICAgICAgbXlHcm91cGluZ1Zhck5hbWUgPSB2XG4gICAgICAgIHJldHVybiB0aGlzXG4gICAgfVxuXG4gICAgZnVuIHBhdGhJZFZhck5hbWUodjogU3RyaW5nKTogR2VvbUxheWVyQnVpbGRlciB7XG4gICAgICAgIG15UGF0aElkVmFyTmFtZSA9IHZcbiAgICAgICAgcmV0dXJuIHRoaXNcbiAgICB9XG5cbiAgICBmdW4gPFQ+IGFkZENvbnN0YW50QWVzKGFlczogQWVzPFQ+LCB2OiBUKTogR2VvbUxheWVyQnVpbGRlciB7XG4gICAgICAgIG15Q29uc3RhbnRCeUFlcy5wdXQoYWVzLCB2KVxuICAgICAgICByZXR1cm4gdGhpc1xuICAgIH1cblxuICAgIGZ1biA8VD4gYWRkU2NhbGVQcm92aWRlcihhZXM6IEFlczxUPiwgc2NhbGVQcm92aWRlcjogU2NhbGVQcm92aWRlcjxUPik6IEdlb21MYXllckJ1aWxkZXIge1xuICAgICAgICBteVNjYWxlUHJvdmlkZXJCeUFlc1thZXNdID0gc2NhbGVQcm92aWRlclxuICAgICAgICByZXR1cm4gdGhpc1xuICAgIH1cblxuICAgIGZ1biBsb2NhdG9yTG9va3VwU3BlYyh2OiBMb29rdXBTcGVjKTogR2VvbUxheWVyQnVpbGRlciB7XG4gICAgICAgIG15TG9jYXRvckxvb2t1cFNwZWMgPSB2XG4gICAgICAgIHJldHVybiB0aGlzXG4gICAgfVxuXG4gICAgZnVuIGNvbnRleHR1YWxNYXBwaW5nUHJvdmlkZXIodjogQ29udGV4dHVhbE1hcHBpbmdQcm92aWRlcik6IEdlb21MYXllckJ1aWxkZXIge1xuICAgICAgICBteUNvbnRleHR1YWxNYXBwaW5nUHJvdmlkZXIgPSB2XG4gICAgICAgIHJldHVybiB0aGlzXG4gICAgfVxuXG4gICAgZnVuIGRpc2FibGVMZWdlbmQodjogQm9vbGVhbik6IEdlb21MYXllckJ1aWxkZXIge1xuICAgICAgICBteUlzTGVnZW5kRGlzYW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biB2YXJCaW5kaW5ncykge1xuICAgICAgICAgICAgICAgIG15VmFyQmluZGluZ3NCeUFlc1t2YXJCaW5kaW5nLmFlc10gPSB2YXJCaW5kaW5nXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gcmVuZGVyZWRBZXMoKTogTGlzdDxBZXM8Kj4+IHtcbiAgICAgICAgICAgIHJldHVybiBteVJlbmRlcmVkQWVzXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlUG9zKGN0eDogUG9zUHJvdmlkZXJDb250ZXh0KTogUG9zaXRpb25BZGp1c3RtZW50IHtcbiAgICAgICAgICAgIHJldHVybiBteVBvc1Byb3ZpZGVyLmNyZWF0ZVBvcyhjdHgpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaGFzQmluZGluZyhhZXM6IEFlczwqPik6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIG15VmFyQmluZGluZ3NCeUFlcy5jb250YWluc0tleShhZXMpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gPFQ+IGdldEJpbmRpbmcoYWVzOiBBZXM8VD4pOiBWYXJCaW5kaW5nIHtcbiAgICAgICAgICAgIHJldHVybiBteVZhckJpbmRpbmdzQnlBZXNbYWVzXSEhXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaGFzQ29uc3RhbnQoYWVzOiBBZXM8Kj4pOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBteUNvbnN0YW50QnlBZXMuY29udGFpbnNLZXkoYWVzKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIDxUPiBnZXRDb25zdGFudChhZXM6IEFlczxUPik6IFQge1xuICAgICAgICAgICAgcmVxdWlyZShoYXNDb25zdGFudChhZXMpKSB7IFwiQ29uc3RhbnQgdmFsdWUgaXMgbm90IGRlZmluZWQgZm9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LT5cbiAgICAgICAgICAgICAgICB2YWwgdHJhbnNmb3JtZWREYXRhID0gRGF0YVByb2Nlc3NpbmcudHJhbnNmb3JtT3JpZ2luYWxzKGRhdGEsIGJ1aWxkZXIubXlCaW5kaW5ncywgc2NhbGVNYXApXG4gICAgICAgICAgICAgICAgd2hlbiAodmFsIHN0YXQgPSBidWlsZGVyLm15U3RhdCkge1xuICAgICAgICAgICAgICAgICAgICBTdGF0cy5JREVOVElUWSAtPiB0cmFuc2Zvcm1lZERhdGFcbiAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgc3RhdEN0eCA9IFNpbXBsZVN0YXRDb250ZXh0KHRyYW5zZm9ybWVkRGF0YSlcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBncm91cGluZ0NvbnRleHQgPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdyb3VwaW5nQ29udGV4dChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtZWREYXRhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLm15QmluZGluZ3MsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIubXlHcm91cGluZ1Zhck5hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIubXlQYXRoSWRWYXJOYW1lLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIGRhdGFBbmRHcm91cGluZ0NvbnRleHQgPSBEYXRhUHJvY2Vzc2luZy5idWlsZFN0YXREYXRhKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybWVkRGF0YSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIubXlCaW5kaW5ncyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY2FsZU1hcCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBncm91cGluZ0NvbnRleHQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgUGxvdEZhY2V0cy51bmRlZmluZWQoKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0Q3R4LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhcnNXaXRob3V0QmluZGluZyA9IGVtcHR5TGlzdCgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yZGVyT3B0aW9ucyA9IGVtcHR5TGlzdCgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFnZ3JlZ2F0ZU9wZXJhdGlvbiA9IG51bGwsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOjpwcmludGxuXG4gICAgICAgICAgICAgICAgICAgICAgICApXG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFBbmRHcm91cGluZ0NvbnRleHQuZGF0YVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gYnVpbGRlclxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmFzc2VtYmxlXG5cbmltcG9ydCBrb3RsaW4ubmF0aXZlLmNvbmN1cnJlbnQuVGhyZWFkTG9jYWxcblxuYWJzdHJhY3QgY2xhc3M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AgIHZhbCBhZXNMaXN0ID0gbGVnZW5kTGF5ZXIuYWVzTGlzdFxuICAgICAgICAgICAgZm9yIChhZXMgaW4gYWVzTGlzdCkge1xuICAgICAgICAgICAgICAgIGlmIChndWlkZU9wdGlvbnNNYXBbYWVzXSBpcyBMZWdlbmRPcHRpb25zKSB7XG4gICAgICAgICAgICAgICAgICAgIGxlZ2VuZE9wdGlvbnNMaXN0LmFkZChndWlkZU9wdGlvbnNNYXBbYWVzXSBhcyBMZWdlbmRPcHRpb25zKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBzcGVjID1cbiAgICAgICAgICAgIGNyZWF0ZUxlZ2VuZFNwZWMoXG4gICAgICAgICAgICAgICAgbGVnZW5kVGl0bGUsIGxlZ2VuZEJyZWFrcywgdGhlbWUsXG4gICAgICAgICAgICAgICAgTGVnZW5kT3B0aW9ucy5jb21iaW5lKFxuICAgICAgICAgICAgICAgICAgICBsZWdlbmRPcHRpb25zTGlzdFxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIClcblxuICAgICAgICByZXR1cm4gb2JqZWN0IDogTGVnZW5kQm94SW5mbyhzcGVjLnNpemUpIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVMZWdlbmRCb3goKTogTGVnZW5kQm94IHtcbiAgICAgICAgICAgICAgICB2YWwgYyA9IExlZ2VuZENvbXBvbmVudChzcGVjKVxuICAgICAgICAgICAgICAgIGMuZGVidWcgPSBERUJVR19EUkFXSU5HXG4gICAgICAgICAgICAgICAgcmV0dXJuIGNcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuXG4gICAgcHJpdmF0ZSBjbGFzcyBMZWdlbmRMYXllcihcbiAgICAgICAgaW50ZXJuYWwgdmFsIGtleUVsZW1lbnRGYWN0b3J5OiBMZWdlbmRLZXlFbGVtZW50RmFjdG9yeSxcbiAgICAgICAgcHJpdmF0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biAgICAgICAgICAgIHRpdGxlOiBTdHJpbmcsXG4gICAgICAgICAgICBicmVha3M6IExpc3Q8TGVnZW5kQnJlYWs+LFxuICAgICAgICAgICAgdGhlbWU6IExlZ2VuZFRoZW1lLFxuICAgICAgICAgICAgb3B0aW9uczogTGVnZW5kT3B0aW9ucyA9IExlZ2VuZE9wdGlvbnMoKVxuICAgICAgICApOiBMZWdlbmRDb21wb25lbnRTcGVjIHtcblxuICAgICAgICAgICAgdmFsIGxlZ2VuZERpcmVjdGlvbiA9IExlZ2VuZEFzc2VtYmxlclV0aWwubGVnZW5kRGlyZWN0aW9uKHRoZW1lKVxuXG4gICAgICAgICAgICAvLyBrZXkgc2l6ZVxuICAgICAgICAgICAgZnVuIHByZXR0eSh2OiBEb3VibGVWZWN0b3IpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICAgICAgICAgIHZhbCBtYXJnaW4gPSAxLjBcbiAgICAgICAgICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKFxuICAgICAgICAgICAgICAgICAgICBmbG9vcih2LnggLyAyKSAqIDIgKyAxLjAgKyBtYXJnaW4sXG4gICAgICAgICAgICAgICAgICAgIGZsb29yKHYueSAvIDIpICogMiArIDEuMCArIG1hcmdpblxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIGtleVNpemUgPSBEb3VibGVWZWN0b3IodGhlbWUua2V5U2l6ZSgpLCB0aGVtZS5rZXlTaXplKCkpXG4gICAgICAgICAgICBmb3IgKGJyIGluIGJyZWFrcykge1xuICAgICAgICAgICAgICAgIHZhbCBtaW5pbXVtS2V5U2l6ZSA9IGJyLm1pbmltdW1LZXlTaXplXG4gICAgICAgICAgICAgICAga2V5U2l6ZSA9IGtleVNpemUubWF4KHByZXR0eShtaW5pbXVtS2V5U2l6ZSkpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIHJvdywgY29sIGNvdW50XG4gICAgICAgICAgICB2YWwgYnJlYWtDb3VudCA9IGJyZWFrcy5zaXplXG4gICAgICAgICAgICB2YWwgY29sQ291bnQ6IEludFxuICAgICAgICAgICAgdmFsIHJvd0NvdW50OiBJbnRcbiAgICAgICAgICAgIGlmIChvcHRpb25zLmlzQnlSb3cpIHtcbiAgICAgICAgICAgICAgICBjb2xDb3VudCA9IHdoZW4ge1xuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLmhhc0NvbENvdW50KCkgLT4gbWluKG9wdGlvbnMuY29sQ291bnQsIGJyZWFrQ291bnQpXG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMuaGFzUm93Q291bnQoKSAtPiBjZWlsKGJyZWFrQ291bnQgLyBvcHRpb25zLnJvd0NvdW50LnRvRG91YmxlKCkpLnRvSW50KClcbiAgICAgICAgICAgICAgICAgICAgbGVnZW5kRGlyZWN0aW9uID09PSBMZWdlbmREaXJlY3Rpb24uSE9SSVpPTlRBTCAtPiBicmVha0NvdW50XG4gICAgICAgICAgICAgICAgICAgIGVsc2UgLT4gMVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByb3dDb3VudCA9IGNlaWwoYnJlYWtDb3VudCAvIGNvbENvdW50LnRvRG91YmxlKCkpLnRvSW50KClcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gYnkgY29sdW1uXG4gICAgICAgICAgICAgICAgcm93Q291bnQgPSB3aGVuIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5oYXNSb3dDb3VudCgpIC0+IG1pbihvcHRpb25zLnJvd0NvdW50LCBicmVha0NvdW50KVxuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLmhhc0NvbENvdW50KCkgLT4gY2VpbChicmVha0NvdW50IC8gb3B0aW9ucy5jb2xDb3VudC50b0RvdWJsZSgpKS50b0ludCgpXG4gICAgICAgICAgICAgICAgICAgIGxlZ2VuZERpcmVjdGlvbiAhPT0gTGVnZW5kRGlyZWN0aW9uLkhPUklaT05UQUwgLT4gYnJlYWtDb3VudFxuICAgICAgICAgICAgICAgICAgICBlbHNlIC0+IDFcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY29sQ291bnQgPSBjZWlsKGJyZWFrQ291bnQgLyByb3dDb3VudC50b0RvdWJsZSgpKS50b0ludCgpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbCBsYXlvdXQ6IExlZ2VuZENvbXBvbmVudExheW91dFxuICAgICAgICAgICAgQFN1cHByZXNzKFwiTGlmdFJldHVybk9yQXNzaWdubWVudFwiKVxuICAgICAgICAgICAgaWYgKGxlZ2VuZERpcmVjdGlvbiA9PT0gTGVnZW5kRGlyZWN0aW9uLkhPUklaT05UQUwpIHtcbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5oYXNSb3dDb3VudCgpIHx8IG9wdGlvbnMuaGFzQ29sQ291bnQoKSAmJiBvcHRpb25zLmNvbENvdW50IDwgYnJlYWtDb3VudCkge1xuICAgICAgICAgICAgICAgICAgICBsYXlvdXQgPSBMZWdlbmRDb21wb25lbnRMYXlvdXQuaG9yaXpvbnRhbE11bHRpUm93KFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha3MsXG4gICAgICAgICAgICAgICAgICAgICAgICBrZXlTaXplXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBsYXlvdXQgPSBMZWdlbmRDb21wb25lbnRMYXlvdXQuaG9yaXpvbnRhbCh0aXRsZSwgYnJlYWtzLCBrZXlTaXplKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbGF5b3V0ID0gTGVnZW5kQ29tcG9uZW50TGF5b3V0LnZlcnRpY2FsKHRpdGxlLCBicmVha3MsIGtleVNpemUpXG4gICAgICAgICAgICB9XG5cbiAgICA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XM8VD4oYWVzLCBjb25zdGFudEJ5QWVzW2Flc10hISlcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gYnVpbGRlci5idWlsZCgpXG4gICAgfVxuXG5cbiAgICBmdW4gbWFwVG9BZXN0aGV0aWNzKFxuICAgICAgICB2YWx1ZUJ5QWVzSXRlcmFibGU6IENvbGxlY3Rpb248TWFwPEFlczwqPiwgQW55Pj4sXG4gICAgICAgIGNvbnN0YW50QnlBZXM6IE1hcDxBZXM8Kj4sIEFueT4sXG4gICAgICAgIGFlc3RoZXRpY3NEZWZhdWx0czogQWVzdGhldGljc0RlZmF1bHRzXG4gICAgKTogQWVzdGhldGljcyB7XG4gICAgICAgIHZhbCBkYXRhUG9pbnRzID0gQXJyYXlMaXN0PE1hcDxBZXM8Kj4sIEFueT4+KClcbiAgICAgICAgZm9yICh2YWx1ZUJ5QWVzIGluIHZhbHVlQnlBZXNJdGVyYWJsZSkge1xuICAgICAgICAgICAgdmFsIGRhdGFQb2ludCA9IEhhc2hNYXA8QWVzPCo+LCBBbnk+KClcbiAgICAgICAgICAgIGZvciAoYWVzIGluIEFlcy52YWx1ZXMoKSkge1xuICAgICAgICAgICAgICAgIGRhdGFQb2ludFthZXNdID0gYWVzdGhldGljc0RlZmF1bHRzLmRlZmF1bHRWYWx1ZUluTGVnZW5kKGFlcykhIVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBEZXJpdmUgc29tZSBhZXN0aGV0aWNzIGZyb20gY29uc3RhbnRzXG4gICAgICAgICAgICBmb3IgKGNvbnN0YW50QWVzIGluIGNvbnN0YW50QnlBZXMua2V5cykge1xuICAgICAgICAgICAgICAgIHdoZW4gKGNvbnN0YW50QWVzKSB7XG4gICAgICAgICAgICAgICAgICAgIEFlcy5TSEFQRSxcbiAgICAgICAgICAgICAgICAgICAgQWVzLkNPTE9SLFxuICAgICAgICAgICAgICAgICAgICBBZXMuRklMTCAtPiBkYXRhUG9pbnRbY29uc3RhbnRBZXNdID0gY29u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NpdGlvbi5CT1RUT00pXG4gICAgICAgICAgICAgICAgICAgIExlZ2VuZERpcmVjdGlvbi5IT1JJWk9OVEFMXG4gICAgICAgICAgICAgICAgZWxzZVxuICAgICAgICAgICAgICAgICAgICBMZWdlbmREaXJlY3Rpb24uVkVSVElDQUxcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbGVnZW5kRGlyZWN0aW9uXG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmFzc2VtYmxlXG5cbmltcG9ydCBrb3RsaW4ubWF0aC5tYXhcblxuY2xhc3MgTGVnZW5kT3B0aW9ucyA6IEd1aWRlT3B0aW9ucygpIHtcblxuICAgIHByaXZhdGUgdmFyIG15Q29sQ291bnQ6IEludD8gPSBudWxsXG4gICAgcHJpdmF0ZSB2YXIgbXlSb3dDb3VudDogSW50PyA9IG51bGxcbiAgICB2YXIgaXNCeVJvdzogQm9vbGVhbiA9IGZhbHNlXG5cbiAgICB2YXIgY29sQ291bnQ6IEludFxuICAgICAgICBnZXQoKSA9IG15Q29sQ291bnQhIVxuICAgICAgICBzZXQoY29sQ291bnQpIHtcbiAgICAgICAgICAgIG15Q29sQ291bnQgPSBtYXgoMSwgY29sQ291bnQpXG4gICAgICAgIH1cblxuICAgIHZhciByb3dDb3VudDogSW50XG4gICAgICAgIGdldCgpID0gbXlSb3dDb3VudCEhXG4gICAgICAgIHNldChyb3dDb3VudCkge1xuICAgICAgICAgICAgbXlSb3dDb3VudCA9IG1heCgxLCByb3dDb3VudClcbiAgICAgICAgfVxuXG4gICAgZnVuIGhhc0NvbENvdW50KCk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gbXlDb2xDb3VudCAhPSBudWxsXG4gICAgfVxuXG4gICAgZnVuIGhhc1Jvd0NvdW50KCk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gbXlSb3dDb3VudCAhPSBudWxsXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGZ1biBjb21iaW5lKG9wdGlvbnNMaXN0OiBMaXN0PExlZ2VuZE9wdGlvbnM+KTogTGVnZW5kT3B0aW9ucyB7XG4gICAgICAgICAgICB2YWwgcmVzdWx0ID0gTGVnZW5kT3B0aW9ucygpXG4gICAgICAgICAgICBmb3IgKG9wdGlvbnMgaW4gb3B0aW9uc0xpc3QpIHtcbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5pc0J5Um93KSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdC5pc0J5Um93ID0gdHJ1ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAob3B0aW9ucy5oYXNDb2xDb3VudCgpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdC5jb2xDb3VudCA9IG9wdGlvbnMuY29sQ291bnRcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMuaGFzUm93Q291bnQoKSkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQucm93Q291bnQgPSBvcHRpb25zLnJvd0NvdW50XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5k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tcbiAgICAgICAgY2hlY2soaGFzTGF5ZXJzKCkpIHsgXCJObyBsYXllcnMgaW4gcGxvdFwiIH1cblxuICAgICAgICB2YWwgbGVnZW5kc0JveEluZm9zID0gaWYgKG15TGVnZW5kc0VuYWJsZWQpXG4gICAgICAgICAgICBQbG90QXNzZW1ibGVyVXRpbC5jcmVhdGVMZWdlbmRzKFxuICAgICAgICAgICAgICAgIGxheWVyc0J5VGlsZSxcbiAgICAgICAgICAgICAgICBteUd1aWRlT3B0aW9uc01hcCxcbiAgICAgICAgICAgICAgICBteVRoZW1lLmxlZ2VuZCgpXG4gICAgICAgICAgICApXG4gICAgICAgIGVsc2VcbiAgICAgICAgICAgIGVtcHR5TGlzdCgpXG5cbiAgICAgICAgLy8gc2hhcmUgZmlyc3QgWC9ZIHNjYWxlIGFtb25nIGFsbCBsYXllcnNcbiAgICAgICAgdmFyIHhTY2FsZVByb3RvID0gc2NhbGVCeUFlc1tBZXMuWF1cbiAgICAgICAgdmFyIHlTY2FsZVByb3RvID0gc2NhbGVCeUFlc1tBZXMuWV1cblxuICAgICAgICBpZiAoY29udGFpbnNMaXZlTWFwKSB7XG4gICAgICAgICAgICAvLyBidWlsZCAnbGl2ZSBtYXAnIHBsb3Q6XG4gICAgICAgICAgICAvLyAgLSBza2lwIFgvWSBzY2FsZSB0cmFpbmluZ1xuICAgICAgICAgICAgLy8gIC0gaWdub3JlIGNvb3JkIHByb3ZpZGVyXG4gICAgICAgICAgICAvLyAgLSBwbG90IGxheW91dCB3aXRob3V0IGF4ZXNcbiAgICAgICAgICAgIHZhbCBwbG90TGF5b3V0ID0gUGxvdEFzc2VtYmxlclV0aWwuY3JlYXRlUGxvdExheW91dChcbiAgICAgICAgICAgICAgICBMaXZlTWFwVGlsZUxheW91dCgpLFxuICAgICAgICAgICAgICAgIGZhY2V0c1xuICAgICAgICAgICAgKVxuICAgICAgICAgICAgcmV0dXJuIGNyZWF0ZVhZUGxvdCh4U2NhbGVQcm90bywgeVNjYWxlUH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WVyc0J5UGFuZWwpIHtcbiAgICAgICAgICAgICAgICBsYXllcnNPblBsYW5lLmFkZChwYW5lbExheWVyc1tpXSlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgc3RpdGNoZWRMYXllcnNMaXN0LmFkZChcbiAgICAgICAgICAgICAgICBTdGl0Y2hlZFBsb3RMYXllcnMoXG4gICAgICAgICAgICAgICAgICAgIGxheWVyc09uUGxhbmVcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgdHJhbnNmb3JtZWREYXRhUmFuZ2VCeUFlcyA9IEhhc2hNYXA8QWVzPCo+LCBDbG9zZWRSYW5nZTxEb3VibGU+PigpXG4gICAgICAgIGZvciAoc3RpdGNoZWRQbG90TGF5ZXJzIGluIHN0aXRjaGVkTGF5ZXJzTGlzdCkge1xuICAgICAgICAgICAgdmFsIGxheWVyVHJhbnNmb3JtZWREb21haW5CeUFlcyA9IGd1aWRlVHJhbnNmb3JtZWREb21haW5CeUFlcyhzdGl0Y2hlZFBsb3RMYXllcnMsIGd1aWRlT3B0aW9uc01hcClcbiAgICAgICAgICAgIGZvciAoKGFlcywgdHJhbnNmb3JtZWREb21haW4pIGluIGxheWVyVHJhbnNmb3JtZWREb21haW5CeUFlcykge1xuICAgICAgICAgICAgICAgIHVwZGF0ZUFlc1JhbmdlTWFwKFxuICAgICAgICAgICAgICAgICAgICBhZXMsXG4gICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybWVkRG9tYWluLFxuICAgICAgICAgICAgICAgICAgICB0cmFuc2Zvcm1lZERhdGFSYW5nZUJ5QWVzXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGNyZWF0ZUxlZ2VuZHMoXG4gICAgICAgICAgICBzdGl0Y2hlZExheWVyc0xpc3QsXG4gICAgICAgICAgICB0cmFuc2Zvcm1lZERhdGFSYW5nZUJ5QWVzL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gfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgbGF5ZXJCaW5kaW5nc0J5U2NhbGVOYW1lID0gTGlua2VkSGFzaE1hcDxTdHJpbmcsIE11dGFibGVMaXN0PFZhckJpbmRpbmc+PigpXG4gICAgICAgICAgICB2YWwgYWVzTGlzdCA9IG1hcHBlZFJlbmRlcmVkQWVzVG9DcmVhdGVHdWlkZXMoc3RpdGNoZWRMYXllcnMsIGd1aWRlT3B0aW9uc01hcClcbiAgICAgICAgICAgIGZvciAoYWVzIGluIGFlc0xpc3QpIHtcbiAgICAgICAgICAgICAgICB2YXIgY29sb3JCYXIgPSBmYWxzZVxuICAgICAgICAgICAgICAgIHZhbCBiaW5kaW5nID0gc3RpdGNoZWRMYXllcnMuZ2V0QmluZGluZyhhZXMpXG4gICAgICAgICAgICAgICAgdmFsIHNjYWxlID0gc3RpdGNoZWRMYXllcnMuZ2V0U2NhbGUoYWVzKVxuICAgICAgICAgICAgICAgIHZhbCBzY2FsZU5hbWUgPSBzY2FsZS5uYW1lXG4gICAgICAgICAgICAgICAgaWYgKGd1aWRlT3B0aW9uc01hcC5jb250YWluc0tleShhZXMpKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBndWlkZU9wdGlvbnMgPSBndWlkZU9wdGlvbnNNYXBbYWVzXVxuICAgICAgICAgICAgICAgICAgICBpZiAoZ3VpZGVPcHRpb25zIGlzIENvbG9yQmFyT3B0aW9ucykge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2hlY2tGaXRzQ29sb3JCYXIoYmluZGluZy5hZXMsIHNjYWxlKVxuICAgICAgICAgICAgICAgICAgICAgICAgY29sb3JCYXIgPSB0cnVlXG4gICAgICAgICAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIGNvbG9yU2NhbGUgPSBzY2FsZSBhcyBTY2FsZTxDb2xvcj5cbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbG9yQmFyQXNzZW1ibGVyQnlUaXRsZVtzY2FsZU5hbWVdID0gY3JlYXRlQ29sb3JCYXJBc3NlbWJsZXIoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NhbGVOYW1lLCBiaW5kaW5nLmFlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2Zvcm1lZERhdGFSYW5nZUJ5QWVzLCBjb2xvclNjYWxlLCBndWlkZU9wdGlvbnMsIHRoZW1lXG4gICAgICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGZpdHNDb2xvckJhcihiaW5kaW5nLmFlcywgc2NhbGUpKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbG9yQmFyID0gdHJ1ZVxuICAgICAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgICAgICB2YWwgY29sb3JTY2FsZSA9IHNjYWxlIGFzIFNjYWxlPENvbG9yPlxuICAgICAgICAgICAgICAgICAgICBjb2xvckJhckFzc2VtYmxlckJ5VGl0bGVbc2NhbGVOYW1lXSA9IGNyZWF0ZUNvbG9yQmFyQXNzZW1ibGVyKFxuICAgICAgICAgICAgICAgICAgICAgICAgc2NhbGVOYW1lLCBiaW5kaW5nLmFlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybWVkRGF0YVJhbmdlQnlBZXMsIGNvbG9yU2NhbGUsIG51bGwsIHRoZW1lXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIWNvbG9yQmFyKSB7XG4gICAgICAgICAgICAgICAgICAgIGxheWVyQmluZGluZ3NCeVNjYWxlTmFtZS5nZXRPclB1dChzY2FsZU5hbWUpIHsgQXJyYXlMaXN0KCkgfS5hZGQoYmluZGluZylcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZvciAoc2NhbGVOYW1lIGluIGxheWVyQmluZGluZ3NCeVNjYWxlTmFtZS5rZXlzKSB7XG4gICAgICAgICAgICAgICAgdmFsIGxlZ2VuZEFzc2VtYmxlciA9IGxlZ2VuZEFzc2VtYmxlckJ5VGl0bGUuZ2V0T3JQdXQoc2NhbGVOYW1lKSB7XG4gICAgICAgICAgICAgICAgICAgIExlZ2VuZEFzc2VtYmxlcihcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjYWxlTmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGd1aWRlT3B0aW9uc01hcCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoZW1lXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB2YWwgdmFyQmluZGluZ3MgPSBsYXllckJpbmRpbmdzQnlTY2FsZU5hbWVbc2NhbGVOYW1lXSEhXG4gICAgICAgICAgICAgICAgdmFsIGxlZ2VuZEtleUZhY3RvcnkgPSBzdGl0Y2hlZExheWVycy5sZWdlbmRLZXlFbGVtZW50RmFjdG9yeVxuICAgICAgICAgICAgICAgIHZhbCBhZXN0aGV0aWNzRGVmYXVsdHMgPSBzdGl0Y2hlZExheWVycy5hZXN0aGV0aWNzRGVmYXVsdHNcbiAgICAgICAgICAgICAgICBsZWdlbmRBc3NlbWJsZXIuYWRkTGF5ZXIoXG4gICAgICAgICAgICAgICAgICAgIGxlZ2VuZEtleUZhY3RvcnksXG4gICAgICAgICAgICAgICAgICAgIHZhckJpbmRpbmdzLFxuICAgICAgICAgICAgICAgICAgICBsYXllckNvbnN0YW50QnlBZXMsXG4gICAgICAgICAgICAgICAgICAgIGFlc3RoZXRpY3NEZWZhdWx0cyxcbiAgICAgICAgICAgICAgICAgICAgc3RpdGNoZWRMYXllcnMuZ2V0U2NhbGVNYXAoKSxcbiAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtZWREYXRhUmFuZ2VCeUFlc1xuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBsZWdlbmRCb3hJbmZvcyA9IEFycmF5TGlzdDxMZWdlbmRCb3hJbmZvPigpXG4gICAgICAgIGZvciAobGVnZW5kVGl0bGUgaW4gY29sb3JCYXJBc3NlbWJsZXJCeVRpdGxlLmtleXMpIHtcbiAgICAgICAgICAgIHZhbCBib3hJbmZvID0gY29sb3JCYXJBc3NlbWJsZXJCeVRpdGxlW2xlZ2VuZFRpdGxlXSEhLmNyZWF0ZUNvbG9yQmFyKClcbiAgICAgICAgICAgIGlmICghYm94SW5mby5pc0VtcHR5KSB7XG4gICAgICAgICAgICAgICAgbGVnZW5kQm94SW5mb3MuYWRkKGJveEluZm8pXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKGxlZ2VuZFRpdGxlIGluIGxlZ2VuZEFzc2VtYmxlckJ5VGl0bGUua2V5cykge1xuICAgICAgICAgICAgdmFsIGJveEluZm8gPSBsZWdlbmRBc3NlbWJsZXJCeVRpdGxlW2xlZ2VuZFRpdGxlXSEhLmNyZWF0ZUxlZ2VuZCgpXG4gICAgICAgICAgICBpZiAoIWJveEluZm8uaXNFbXB0eSkge1xuICAgICAgICAgICAgICAgIGxlZ2VuZEJveEluZm9zLmFkZChib3hJbmZvKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBsZWdlbmRCb3hJbmZvc1xuICAgIH1cblxuICAgIGZ1biBjcmVhdGVQbG90TGF5b3V0KHRpbGVMYXlvdXQ6IFRpbGVMYXlvdXQsIGZhY2V0czogUGxvdEZhY2V0cyk6IFBsb3RMYXlvdXQge1xuICAgICAgICBpZiAoIWZhY2V0cy5pc0RlZmluZWQpIHtcbiAgICAgICAgICAgIHJldHVybiBTaW5nbGVUaWxlUGxvdExheW91dCh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G51bGxcblxuICAgICAgICAgICAgLy8gVGFrZSBpbiBhY2NvdW50OlxuICAgICAgICAgICAgLy8gLSBzY2FsZXMgZG9tYWluIGlmIGRlZmluZWRcbiAgICAgICAgICAgIC8vIC0gc2NhbGVzIGJyZWFrcyBpZiBkZWZpbmVkXG4gICAgICAgICAgICBpZiAoc2NhbGUuaXNDb250aW51b3VzRG9tYWluKSB7XG4gICAgICAgICAgICAgICAgaW5pdGlhbFJhbmdlID0gdXBkYXRlUmFuZ2UoXG4gICAgICAgICAgICAgICAgICAgIFNjYWxlVXRpbC50cmFuc2Zvcm1lZERlZmluZWRMaW1pdHMoc2NhbGUpLnRvTGlzdCgpLmZpbHRlciB7IGl0LmlzRmluaXRlKCkgfSxcbiAgICAgICAgICAgICAgICAgICAgaW5pdGlhbFJhbmdlXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoc2NhbGUuaGFzQnJlYWtzKCkpIHtcbiAgICAgICAgICAgICAgICBpbml0aWFsUmFuZ2UgPSB1cGRhdGVSYW5nZShcbiAgICAgICAgICAgICAgICAgICAgU2NhbGVVdGlsLmJyZWFrc1RyYW5zZm9ybWVkKHNjYWxlKSxcbiAgICAgICAgICAgICAgICAgICAgaW5pdGlhbFJhbmdlXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGluaXRpYWxSYW5nZVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gdGhlIFwic2NhbGUgbWFwXCIgaXMgc2hhcmVkIGJ5IGFsbCBsYXllcnMuXG4gICAgICAgIHZhbCBzY2FsZU1hcCA9IGxheWVyc0J5VGlsZVswXVswXS5zY2FsZU1hcFxuICAgICAgICB2YXIgeEluaXRpYWxSYW5nZTogQ2xvc2VkUmFuZ2U8RG91YmxlPj8gPSBpbml0aWFsUmFuZ2Uoc2NhbGVNYXBbQWVzLlhdKVxuICAgICAgICB2YXIgeUluaXRpYWxSY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EudmFyaWFibGVzKClcbiAgICAgICAgICAgICAgICBmb3IgKHZhcmlhYmxlIGluIHZhcmlhYmxlcykge1xuICAgICAgICAgICAgICAgICAgICB2YWwgc291cmNlID0gZGF0YVt2YXJpYWJsZV1cbiAgICAgICAgICAgICAgICAgICAgdmFsIHRhcmdldCA9IFNlcmllc1V0aWwucGlja0F0SW5kaWNlcyhzb3VyY2UsIGluZGljZXMpXG4gICAgICAgICAgICAgICAgICAgIGIucHV0KHZhcmlhYmxlLCB0YXJnZXQpXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdmFsIGxldmVsRGF0YSA9IGIuYnVpbGQoKVxuICAgICAgICAgICAgICAgIGRhdGFCeUxldmVsS2V5LmFkZChsZXZlbEtleSB0byBsZXZlbERhdGEpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBkYXRhQnlMZXZlbEtleVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGNyZWF0ZU5hbWVMZXZlbFR1cGxlcyhcbiAgICAgICAgICAgIHZhck5hbWVzOiBMaXN0PFN0cmluZz4sXG4gICAgICAgICAgICB2YXJMZXZlbHM6IExpc3Q8TGlzdDxBbnk+PlxuICAgICAgICApOiBMaXN0PExpc3Q8UGFpcjxTdHJpbmcsIEFueT4+PiB7XG4gICAgICAgICAgICByZXF1aXJlKHZhck5hbWVzLmlzTm90RW1wdHkoKSkgeyBcIkVtcHR5IGxpc3Qgb2YgZmFjZXQgdmFyaWFibGVzLlwiIH1cbiAgICAgICAgICAgIHJlcXVpcmUodmFyTmFtZXMuc2l6ZSA9PSB2YXJOYW1lcy5kaXN0aW5jdCgpLnNpemUpIHsgXCJGYWNldCB2YXJpYWJsZXMgbXVzdCBiZSBkaXN0aW5jdCwgd2VyZTogJHZhck5hbWVzLlwiIH1cbiAgICAgICAgICAgIGNoZWNrKHZhck5hbWVzLnNpemUgPT0gdmFyTGV2ZWxzLnNpemUpXG4gICAgICAgICAgICByZXR1cm4gY3JlYXRlTmFtZUxldmVsVHVwbGVzSW50ZXJuKHZhck5hbWVzLCB2YXJMZXZlbHMpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBjcmVhdGVOYW1lTGV2ZWxUdXBsZXNJbnRlcm4oXG4gICAgICAgICAgICB2YXJOYW1lczogTGlzdDxTdHJpbmc+LFxuICAgICAgICAgICAgdmFyTGV2ZWxzOiBMaXN0PExpc3Q8QW55Pj5cbiAgICAgICAgKTogTGlzdDxMaXN0PFBhaXI8U3RyaW5nLCBBbnk+Pj4ge1xuICAgICAgICAgICAgdmFsIG5hbWUgPSB2YXJOYW1lcy5maXJzdCgpXG4gICAgICAgICAgICB2YWwgbGV2ZWxzID0gdmFyTGV2ZWxzLmZpcnN0KClcblxuICAgICAgICAgICAgdmFsIGxldmVsS2V5cyA9IEFycmF5TGlzdDxMaXN0PFBhaXI8U3RyaW5nLCBBbnk+Pj4oKVxuICAgICAgICAgICAgZm9yIChsZXZlbCBpbiBsZXZlbHMpIHtcbiAgICAgICAgICAgICAgICBpZiAodmFyTmFtZXMuc2l6ZSA+IDEpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHN1YktleXMgPSBjcmVhdGVOYW1lTGV2ZWxUdXBsZXMoXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXJOYW1lcy5zdWJMaXN0KDEsIHZhck5hbWVzLnNpemUpLFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyTGV2ZWxzLnN1Ykxpc3QoMSwgdmFyTGV2ZWxzLnNpemUpXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgZm9yIChzdWJLZXkgaW4gc3ViS2V5cykge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV2ZWxLZXlzLmFkZChsaXN0T2YobmFtZSB0byBsZXZlbCkgKyBzdWJLZXkpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAvLyBleGl0XG4gICAgICAgICAgICAgICAgICAgIGxldmVsS2V5cy5hZGQobGlzdE9mKG5hbWUgdG8gbGV2ZWwpKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIGxldmVsS2V5c1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHJlb3JkZXJMZXZlbHMoXG4gICAgICAgICAgICB2YXJOYW1lczogTGlzdDxTdHJpbmc+LFxuICAgICAgICAgICAgdmFyTGV2ZWxzOiBMaXN0PExpc3Q8QW55Pj4sXG4gICAgICAgICAgICBvcmRlcmluZzogTGlzdDxJbnQ+XG4gICAgICAgICk6IExpc3Q8TGlzdDxBbnk+PiB7XG4gICAgICAgICAgICB2YWwgb3JkZXJpbmdCeUZhY2V0ID0gdmFyTmFtZXMuemlwKG9yZGVyaW5nKS50b01hcCgpXG5cbiAgICAgICAgICAgIHZhbCByZXN1bHQgPSBBcnJheUxpc3Q8TGlzdDxBbnk+PigpXG4gICAgICAgICAgICBmb3IgKChpLCBuYW1lKSBpbiB2YXJOYW1lcy53aXRoSW5kZXgoKSkge1xuICAgICAgICAgICAgICAgIGlmIChpID49IHZhckxldmVscy5zaXplKSBicmVha1xuICAgICAgICAgICAgICAgIHJlc3VsdC5hZGQocmVvcmRlclZhckxldmVscyhuYW1lLCB2YXJMZXZlbHNbaV0sIG9yZGVyaW5nQnlGYWNldC5nZXRWYWx1ZShuYW1lKSkpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiByZXN1bHRcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biByZW9yZGVyVmFyTGV2ZWxzKFxuICAgICAgICAgICAgbmFtZTogU3RyaW5nPyxcbiAgICAgICAgICAgIGxldmVsczogTGlzdDxBbnk+LFxuICAgICAgICAgICAgb3JkZXI6IEludFxuICAgICAgICApOiBMaXN0PEFueT4ge1xuICAgICAgICAgICAgaWYgKG5hbWUgPT0gbnVsbC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IChsYXllclRpbGVzLmlzTGVnZW5kRGlzYWJsZWQpIHtcbiAgICAgICAgICAgIC8vIFRvRG86IGFkZCBzdXBwb3J0IGZvclxuICAgICAgICAgICAgLy8gc2hvd19sZWdlbmQgPSBUcnVlICAgICA6IHNob3cgYWxsIGFlc3RoZXRpY3MgaW4gbGVnZW5kXG4gICAgICAgICAgICAvLyBzaG93X2xlZ2VuZCA9IFsuLiBsaXN0IG9mIGFlc3RoZXRpY3MgdG8gc2hvdyAuLl0gICAgIDogc2hvdyBzZWxlY3RlZCBhZXN0aGV0aWNzIGluIGxlZ2VuZFxuICAgICAgICAgICAgLy8gc2VlOiBodHRwczovL2dncGxvdDIudGlkeXZlcnNlLm9yZy9yZWZlcmVuY2UvZ2VvbV9wb2ludC5odG1sXG4gICAgICAgICAgICByZXR1cm4gZW1wdHlMaXN0KClcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCByZXN1bHQgPSBBcnJheUxpc3Q8QWVzPCo+PigpXG4gICAgICAgIGZvciAoYWVzIGluIGxheWVyVGlsZXMucmVuZGVyZWRBZXMoKSkge1xuICAgICAgICAgICAgaWYgKEFlcy5ub0d1aWRlTmVlZGVkKGFlcykpIHtcbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGxheWVyVGlsZXMuaGFzQ29uc3RhbnQoYWVzKSkge1xuICAgICAgICAgICAgICAgIC8vIGNvbnN0YW50cyBtYXNrIGFlcyBtYXBwaW5nc1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIWxheWVyVGlsZXMuaGFzQmluZGluZyhhZXMpKSB7XG4gICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChndWlkZU9wdGlvbnNNYXAuY29udGFpbnNLZXkoYWVzKSkge1xuICAgICAgICAgICAgICAgIGlmIChndWlkZU9wdGlvbnNNYX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lID0gc3RpdGNoZWRMYXllcnMuZ2V0RGF0YVJhbmdlKHRyYW5zZm9ybVZhcmlhYmxlKVxuICAgICAgICAgICAgaWYgKHRyYW5zZm9ybWVkRGF0YVJhbmdlICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICB2YWwgc2NhbGUgPSBzdGl0Y2hlZExheWVycy5nZXRTY2FsZShhZXMpXG5cbiAgICAgICAgICAgICAgICB2YWwgdHJhbnNmb3JtZWREb21haW4gPVxuICAgICAgICAgICAgICAgICAgICBpZiAoc2NhbGUuaXNDb250aW51b3VzRG9tYWluICYmIHNjYWxlLmhhc0RvbWFpbkxpbWl0cygpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgKHNjYWxlTG93ZXIsIHNjYWxlVXBwZXIpID0gU2NhbGVVdGlsLnRyYW5zZm9ybWVkRGVmaW5lZExpbWl0cyhzY2FsZSlcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBsb3dlckVuZCA9IGlmIChzY2FsZUxvd2VyLmlzRmluaXRlKCkpIHNjYWxlTG93ZXIgZWxzZSB0cmFuc2Zvcm1lZERhdGFSYW5nZS5sb3dlckVuZFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHVwcGVyRW5kID0gaWYgKHNjYWxlVXBwZXIuaXNGaW5pdGUoKSkgc2NhbGVVcHBlciBlbHNlIHRyYW5zZm9ybWVkRGF0YVJhbmdlLnVwcGVyRW5kXG4gICAgICAgICAgICAgICAgICAgICAgICBDbG9zZWRSYW5nZTxEb3VibGU+KGxvd2VyRW5kLCB1cHBlckVuZClcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybWVkRGF0YVJhbmdlXG4gICAgICAgICAgICAgICAgICAgIH1cblxuXG4gICAgICAgICAgICAgICAgdHJhbnNmb3JtZWREb21haW5CeUFlc1thZXNdID0gdHJhbnNmb3JtZWREb21haW5cbiAgICAgICAgICAgIH1cb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ICAgICAgICAgICAgICAgICAgICByZXR1cm4gUG9zaXRpb25BZGp1c3RtZW50cy5zdGFjayhjdHguYWVzdGhldGljcywgUG9zaXRpb25BZGp1c3RtZW50cy5TdGFja2luZ1N0cmF0ZWd5LlNQTElUX1BPU0lUSVZFX05FR0FUSVZFKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBoYW5kbGVzR3JvdXBzKCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUG9zaXRpb25BZGp1c3RtZW50cy5NZXRhLlNUQUNLLmhhbmRsZXNHcm91cHMoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIEBKdm1PdmVybG9hZHNcbiAgICAgICAgZnVuIGRvZGdlKHdpZHRoOiBEb3VibGU/ID0gbnVsbCk6IFBvc1Byb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBQb3NQcm92aWRlcigpIHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlUG9zKGN0eDogUG9zUHJvdmlkZXJDb250ZXh0KTogUG9zaXRpb25BZGp1c3RtZW50IHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIGFlc3RoZXRpY3MgPSBjdHguYWVzdGhldGljc1xuICAgICAgICAgICAgICAgICAgICB2YWwgZ3JvdXBDb3VudCA9IGN0eC5ncm91cENvdW50XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBQb3NpdGlvbkFkanVzdG1lbnRzLmRvZGdlKGFlc3RoZXRpY3MsIGdyb3VwQ291bnQsIHdpZHRoKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBoYW5kbGVzR3JvdXBzKCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUG9zaXRpb25BZGp1c3RtZW50cy5NZXRhLkRPREdFLmhhbmRsZXNHcm91cHMoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBmaWxsKCk6IFBvc1Byb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBQb3NQcm92aWRlcigpIHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlUG9zKGN0eDogUG9zUHJvdmlkZXJDb250ZXh0KTogUG9zaXRpb25BZGp1c3RtZW50IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBvc2l0aW9uQWRqdXN0bWVudHMuZmlsbChjdHguYWVzdGhldGljcylcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gaGFuZGxlc0dyb3VwcygpOiBCb29sZWFuIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBvc2l0aW9uQWRqdXN0bWVudHMuTWV0YS5GSUxMLmhhbmRsZXNHcm91cHMoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBqaXR0ZXIod2lkdGg6IERvdWJsZT8sIGhlaWdodDogRG91YmxlPyk6IFBvc1Byb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBQb3NQcm92aWRlcigpIHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlUG9zKGN0eDogUG9zUHJvdmlkZXJDb250ZXh0KTogUG9zaXRpb25BZGp1c3RtZW50IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBvc2l0aW9uQWRqdXN0bWVudHMuaml0dGVyKHdpZHRoLCBoZWlnaHQpXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGhhbmRsZXNHcm91cHMoKTogQm9vbGVhbiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBQb3NpdGlvbkFkanVzdG1lbnRzLk1ldGEuSklUVEVSLmhhbmRsZXNHcm91cHMoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBudWRnZSh3aWR0aDogRG91YmxlPywgaGVpZ2h0OiBEb3VibGU/KTogUG9zUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IFBvc1Byb3ZpZGVyKCkge1xuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVQb3MoY3R4OiBQb3NQcm92aWRlckNvbnRleHQpOiBQb3NpdGlvbkFkanVzdG1lbnQge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUG9zaXRpb25BZGp1c3RtZW50cy5udWRnZSh3aWR0aCwgaGVpZ2h0KVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBoYW5kbGVzR3JvdXBzKCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUG9zaXRpb25BZGp1c3RtZW50cy5NZXRhLk5VREdFLmhhbmRsZXNHcm91cHMoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIC8qXG4gIHB1YmxpYyBzdGF0aWMgUG9zUHJvdmlkZXIgaml0dGVyRG9kZ2UoRG91YmxlIGppdHRlcldpZHRoLCBEb3VibGUgaml0dGVySGVpZ2h0KSB7XG4gICAgcmV0dXJuIGppdHRlckRvZGdlKG51bGwsIGppdHRlcldpZHRoLCBqaXR0ZXJIZWlnaHQpO1xuICB9XG4gICovXG5cbiAgICAgICAgZnVuIGppdHRlckRvZGdlKHdpZHRoOiBEb3VibGU/LCBqaXR0ZXJXaWR0aDogRG91YmxlPywgaml0dGVySGVpZ2h0OiBEb3VibGU/KTogUG9zUHJvdml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5pc05vdEVtcHR5KCkpXG4gICAgICAgICAgICByZXR1cm4gbXlMYXllcnNbMF0uYWVzdGhldGljc0RlZmF1bHRzXG4gICAgICAgIH1cblxuICAgIHZhbCBpc0xlZ2VuZERpc2FibGVkOiBCb29sZWFuXG4gICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgIGNoZWNrKG15TGF5ZXJzLmlzTm90RW1wdHkoKSlcbiAgICAgICAgICAgIHJldHVybiBteUxheWVyc1swXS5pc0xlZ2VuZERpc2FibGVkXG4gICAgICAgIH1cblxuICAgIGluaXQge1xuICAgICAgICBteUxheWVycyA9IEFycmF5TGlzdChsYXllcnMpXG4gICAgfVxuXG4gICAgZnVuIHJlbmRlcmVkQWVzKCk6IExpc3Q8QWVzPCo+PiB7XG4gICAgICAgIHJldHVybiBpZiAobXlMYXllcnMuaXNFbXB0eSgpKSB7XG4gICAgICAgICAgICBlbXB0eUxpc3QoKVxuICAgICAgICB9IGVsc2UgbXlMYXllcnNbMF0ucmVuZGVyZWRBZXMoKVxuICAgIH1cblxuICAgIGZ1biBoYXNCaW5kaW5nKGFlczogQWVzPCo+KTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiBteUxheWVycy5pc05vdEVtcHR5KCkgJiYgbXlMYXllcnNbMF0uaGFzQmluZGluZyhhZXMpXG4gICAgfVxuXG4gICAgZnVuIGhhc0NvbnN0YW50KGFlczogQWVzPCo+KTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiBteUxheWVycy5pc05vdEVtcHR5KCkgJiYgbXlMYXllcnNbMF0uaGFzQ29uc3RhbnQoYWVzKVxuICAgIH1cblxuICAgIGZ1biA8VD4gZ2V0Q29uc3RhbnQoYWVzOiBBZXM8VD4pOiBUIHtcbiAgICAgICAgY2hlY2sobXlMYXllcnMuaXNOb3RFbXB0eSgpKVxuICAgICAgICByZXR1cm4gbXlMYXllcnNbMF0uZ2V0Q29uc3RhbnQoYWVzKVxuICAgIH1cblxuICAgIGZ1biBnZXRCaW5ka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ICAgICAgICB2YWwgYWRkQ29sTGFiID0gcm93ID09IDBcbiAgICAgICAgICAgIHZhbCBoYXNYQXhpcyA9IHJvdyA9PSByb3dDb3VudCAtIDFcbiAgICAgICAgICAgIGZvciAoY29sIGluIDAgdW50aWwgY29sQ291bnQpIHtcbiAgICAgICAgICAgICAgICB2YWwgYWRkUm93TGFiID0gY29sID09IGNvbENvdW50IC0gMVxuICAgICAgICAgICAgICAgIHZhbCBoYXNZQXhpcyA9IGNvbCA9PSAwXG5cbiAgICAgICAgICAgICAgICB2YWwgY29sTGFicyA9IGlmIChhZGRDb2xMYWIpIHtcbiAgICAgICAgICAgICAgICAgICAgY29sTGFiZWxzW2NvbF0/LmxldCB7IGxpc3RPZihpdCkgfSA/OiBlbXB0eUxpc3QoKVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGVtcHR5TGlzdDxTdHJpbmc+KClcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpbmZvcy5hZGQoXG4gICAgICAgICAgICAgICAgICAgIEZhY2V0VGlsZUluZm8oXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2wsIHJvdyxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbExhYnMsXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYWRkUm93TGFiKSByb3dMYWJlbHNbcm93XSBlbHNlIG51bGwsXG4gICAgICAgICAgICAgICAgICAgICAgICBoYXNYQXhpcywgaGFzWUF4aXMsXG4gICAgICAgICAgICAgICAgICAgICAgICB0cnVlSW5kZXggPSBpbmZvcy5zaXplXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gaW5mb3NcbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDIxLiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcy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iAgICAgICAgICAgICAgICBEaXJlY3Rpb24uViAtPiBpbmRleCAlIHJvd0NvdW50XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdG9JbmRleChjb2w6IEludCwgcm93OiBJbnQpOiBJbnQge1xuICAgICAgICAgICAgcmV0dXJuIHdoZW4gKGRpcmVjdGlvbikge1xuICAgICAgICAgICAgICAgIERpcmVjdGlvbi5IIC0+IHJvdyAqIGNvbENvdW50ICsgY29sXG4gICAgICAgICAgICAgICAgRGlyZWN0aW9uLlYgLT4gY29sICogcm93Q291bnQgKyByb3dcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBpc0JvdHRvbShjb2w6IEludCwgcm93OiBJbnQpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHZhbCBuZXh0Um93SW5kZXggPSB0b0luZGV4KGNvbCwgcm93ICsgMSlcbiAgICAgICAgICAgIHJldHVybiAocm93ICsgMSkgJSByb3dDb3VudCA9PSAwIHx8IG5leHRSb3dJbmRleCA+PSBudW1UaWxlc1xuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGluZm9zID0gQXJyYXlMaXN0PEZhY2V0VGlsZUluZm8+KClcbiAgICAgICAgZm9yICgoaSwgdGlsZUxhYmVsVHVwbGUpIGluIHRpbGVMYWJlbHMud2l0aEluZGV4KCkpIHtcbiAgICAgICAgICAgIHZhbCBjb2wgPSB0b0NvbChpKVxuICAgICAgICAgICAgdmFsIHJvdyA9IHRvUm93KGkpXG4vLyAgICAgICAgICAgIHZhbCBuZXh0Um93SW5kZXggPSB0b0luZGV4KGNvbCwgcm93ICsgMSlcbi8vICAgICAgICAgICAgdmFsIGhhc1hBeGlzID0gbmV4dFJvd0luZGV4ID49IG51bVRpbGVzXG4gICAgICAgICAgICB2YWwgaGFzWEF4aXMgPSBpc0JvdHRvbShjb2wsIHJvdylcbiAgICAgICAgICAgIHZhbCBoYXNZQXhpcyA9IGNvbCA9PSAwXG5cbiAgICAgICAgICAgIGluZm9zLmFkZChcbiAgICAgICAgICAgICAgICBGYWNldFRpbGVJbmZvKFxuICAgICAgICAgICAgICAgICAgICBjb2wsIHJvdyxcbiAgICAgICAgICAgICAgICAgICAgY29sTGFicyA9IHRpbGVMYWJlbFR1cGxlLFxuICAgICAgICAgICAgICAgICAgICBudWxsLFxuICAgICAgICAgICAgICAgICAgICBoYXNYQXhpcywgaGFzWUF4aXMsXG4gICAgICAgICAgICAgICAgICAgIHRydWVJbmRleCA9IGlcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICAvLyBFbnVtZXJhdGlvbiBpcyBhbHdheXMgJ2J5IHJvdycuXG4gICAgICAgIHJldHVybiBpbmZvcy5zb3J0ZWRXaXRoKGNvbXBhcmVCeTxGYWNldFRpbGVJbmZvPiB7IGl0LnJvdyB9LnRoZW5CeSB7IGl0LmNvbCB9KVxuICAgIH1cblxuICAgIGVudW0gY2xhc3MgRGlyZWN0aW9uIHtcbiAgICAgICAgSCwgVlxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBwcml2YXRlIGZ1biBudW1UaWxlcyhcbiAgICAgICAgICAgIGZhY2V0czogTGlzdDxTdHJpbmc+LFxuICAgICAgICAgICAgbGV2ZWxzOiBMaXN0PExpc3Q8QW55Pj4sXG4gICAgICAgICk6IEludCB7XG4gICAgICAgICAgICByZXF1aXJlKGZhY2V0cy5pc05vdEVtcHR5KCkpIHsgXCJMaXN0IG9mIGZhY2V0cyBpcyBlbXB0eS5cIiB9XG4gICAgICAgICAgICByZXF1aXJlKGZhY2V0cy5kaXN0aW5jdCgpLnNpemUgPT0gZmFjZXRzLnNpemUpIHsgXCJEdXBsaWNhdGVkIHZhbHVlcyBpbiB0aGUgZmFjZXRzIGxpc3Q6ICRmYWNldHNcIiB9XG4gICAgICAgICAgICBjaGVjayhmYWNldHMuc2l6ZSA9PSBsZXZlbHMuc2l6ZSlcbiAgICAgICAgICAgIHJldHVybiBjcmVhdGVOYW1lTGV2ZWxUdXBsZXMoZmFjZXRzLCBsZXZlbHMpLnNpemVcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHNoYXBlKHRpbGVzQ291bnQ6IEludCwgbmNvbDogSW50PywgbnJvdzogSW50PywgZGlyOiBEaXJlY3Rpb24pOiBQYWlyPEludCwgSW50PiB7XG4gICAgICAgICAgICByZXF1aXJlKG5jb2w/LmxldCB7IG5jb2wgPiAwIH0gPzogdHJ1ZSkgeyBcIiduY29sJyBtdXN0IGJlIHBvc2l0aXZlLCB3YXMgJG5jb2xcIiB9XG4gICAgICAgICAgICByZXF1aXJlKG5yb3c/LmxldCB7IG5yb3cgPiAwIH0gPzogdHJ1ZSkgeyBcIiducm93JyBtdXN0IGJlIHBvc2l0aXZlLCB3YXMgJG5yb3dcIiB9XG4gICAgICAgICAgICB2YWwgc2hhcGUgPSB3aGVuIHtcbiAgICAgICAgICAgICAgICBuY29sICE9IG51bGwgLT4ge1xuICAgICAgICAgICAgICAgICAgICB2YWwgbmNvbEFjdHVhbCA9IG1pbihuY29sLCB0aWxlc0NvdW50KVxuICAgICAgICAgICAgICAgICAgICB2YWwgbnJvd0FjdHVhbCA9IGNlaWwodGlsZXNDb3VudC50b0RvdWJsZSgpIC8gbmNvbEFjdHVhbCkudG9JbnQoKVxuICAgICAgICAgICAgICAgICAgICBuY29sQWN0dWFsIHRvIG1heCgxLCBucm93QWN0dWFsKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBucm93ICE9IG51bGwgLT4ge1xuICAgICAgICAgICAgICAgICAgICB2YWwgbnJvd0FjdHVhbCA9IG1pbihucm93LCB0aWxlc0NvdW50KVxuICAgICAgICAgICAgICAgICAgICB2YWwgbmNvbEFjdHVhbCA9IGNlaWwodGlsZXNDb3VudC50b0RvdWJsZSgpIC8gbnJvd0FjdHVhbCkudG9JbnQoKVxuICAgICAgICAgICAgICAgICAgICBuY29sQWN0dWFsIHRvIG1heCgxLCBucm93QWN0dWFsKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBlbHNlIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHcgPSBtaW4oNCwgbWF4KDEsIHRpbGVzQ291bnQgLyAyKSlcbiAgICAgICAgICAgICAgICAgICAgdmFsIGggPSBtYXgoMSwgY2VpbCh0aWxlc0NvdW50LnRvRG91YmxlKCkgLyB3KS50b0ludCgpKVxuICAgICAgICAgICAgICAgICAgICB3IHRvIGhcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbCAodywgaCkgPSBzaGFwZVxuICAgICAgICAgICAgcmV0dXJuIHdoZW4gKGRpcikge1xuICAgICAgICAgICAgICAgIERpcmVjdGlvbi5IIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgLy8gZmlsbGluZyBieSByb3dzXG4gICAgICAgICAgICAgICAgICAgIFBhaXIoXG4gICAgICAgICAgICAgICAgICAgICAgICB3LFxuICAgICAgICAgICAgICAgICAgICAgICAgY2VpbCh0aWxlc0NvdW50LnRvRG91YmxlKCkgLyB3KS50b0ludCgpXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgRGlyZWN0aW9uLlYgLT4ge1xuICAgICAgICAgICAgICAgICAgICAvLyBmaWxsaW5nIGJ5IGNvbHNcbiAgICAgICAgICAgICAgICAgICAgUGFpcihcbiAgICAgICAgICAgICAgICAgICAgICAgIGNlaWwodGlsZXNDb3VudC50b0RvdWJsZSgpIC8gaCkudG9JbnQoKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjAuIEpldEJyYWl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ICAgICAgIH1cblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBoYW5kbGVzR3JvdXBzKCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbXlIYW5kbGVzR3JvdXBzXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG5cbiAgICAgICAgZnVuIHBvaW50KCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gcG9pbnQgeyBQb2ludEdlb20oKSB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcG9pbnQoc3VwcGxpZXI6ICgpIC0+IEdlb20pOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuUE9JTlQsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLnBvaW50KCksXG4gICAgICAgICAgICAgICAgUG9pbnRHZW9tLkhBTkRMRVNfR1JPVVBTLFxuICAgICAgICAgICAgICAgIHN1cHBsaWVyXG4gICAgICAgICAgICApLmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBwYXRoKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gcGF0aCB7IFBhdGhHZW9tKCkgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHBhdGgoc3VwcGxpZXI6ICgpIC0+IEdlb20pOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuUEFUSCxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMucGF0aCgpLFxuICAgICAgICAgICAgICAgIFBhdGhHZW9tLkhBTkRMRVNfR1JPVVBTLFxuICAgICAgICAgICAgICAgIHN1cHBsaWVyXG4gICAgICAgICAgICApLmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBsaW5lKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5MSU5FLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5saW5lKCksXG4gICAgICAgICAgICAgICAgTGluZUdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBMaW5lR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHNtb290aCgpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuU01PT1RILFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5zbW9vdGgoKSxcbiAgICAgICAgICAgICAgICBTbW9vdGhHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgU21vb3RoR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGJhcigpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuQkFSLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5iYXIoKSxcbiAgICAgICAgICAgICAgICBCYXJHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgQmFyR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGhpc3RvZ3JhbSgpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuSElTVE9HUkFNLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5oaXN0b2dyYW0oKSxcbiAgICAgICAgICAgICAgICBIaXN0b2dyYW1HZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgSGlzdG9ncmFtR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHRpbGUoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLlRJTEUsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLnRpbGUoKSxcbiAgICAgICAgICAgICAgICBUaWxlR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IFRpbGVHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYmluMmQoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkJJTl8yRCxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMuYmluMmQoKSxcbiAgICAgICAgICAgICAgICBCaW4yZEdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBCaW4yZEdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBlcnJvckJhcigpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuRVJST1JfQkFSLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5lcnJvckJhcigpLFxuICAgICAgICAgICAgICAgIEVycm9yQmFyR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IEVycm9yQmFyR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGNyb3NzQmFyKHN1cHBsaWVyOiAoKSAtPiBHZW9tKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkNST1NTX0JBUixcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMuY3Jvc3NCYXIoKSxcbiAgICAgICAgICAgICAgICBDcm9zc0Jhckdlb20uSEFORExFU19HUk9VUFMsXG4gICAgICAgICAgICAgICAgc3VwcGxpZXJcbiAgICAgICAgICAgICkuYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGxpbmVSYW5nZSgpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuTElORV9SQU5HRSxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMubGluZVJhbmdlKCksXG4gICAgICAgICAgICAgICAgTGluZVJhbmdlR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IExpbmVSYW5nZUdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBwb2ludFJhbmdlKHN1cHBsaWVyOiAoKSAtPiBHZW9tKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLlBPSU5UX1JBTkdFLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5wb2ludFJhbmdlKCksXG4gICAgICAgICAgICAgICAgUG9pbnRSYW5nZUdlb20uSEFORExFU19HUk9VUFMsXG4gICAgICAgICAgICAgICAgc3VwcGxpZXJcbiAgICAgICAgICAgICkuYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGNvbnRvdXIoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkNPTlRPVVIsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmNvbnRvdXIoKSxcbiAgICAgICAgICAgICAgICBDb250b3VyR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IENvbnRvdXJHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gY29udG91cmYoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkNPTlRPVVJGLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5jb250b3VyZigpLFxuICAgICAgICAgICAgICAgIENvbnRvdXJmR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IENvbnRvdXJmR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHBvbHlnb24oKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLlBPTFlHT04sXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLnBvbHlnb24oKSxcbiAgICAgICAgICAgICAgICBQb2x5Z29uR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IFBvbHlnb25HZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gbWFwKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5NQVAsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLm1hcCgpLFxuICAgICAgICAgICAgICAgIE1hcEdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBNYXBHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYWJsaW5lKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5BQl9MSU5FLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5hYmxpbmUoKSxcbiAgICAgICAgICAgICAgICBBQkxpbmVHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgQUJMaW5lR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGhsaW5lKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5IX0xJTkUsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmhsaW5lKCksXG4gICAgICAgICAgICAgICAgSExpbmVHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgSExpbmVHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdmxpbmUoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLlZfTElORSxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMudmxpbmUoKSxcbiAgICAgICAgICAgICAgICBWTGluZUdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBWTGluZUdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBib3hwbG90KHN1cHBsaWVyOiAoKSAtPiBHZW9tKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkJPWF9QTE9ULFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5ib3hwbG90KCksXG4gICAgICAgICAgICAgICAgQm94cGxvdEdlb20uSEFORExFU19HUk9VUFMsXG4gICAgICAgICAgICAgICAgc3VwcGxpZXJcbiAgICAgICAgICAgICkuYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGxpdmVtYXAoXG4gICAgICAgICAgICBvcHRpb25zOiBMaXZlTWFwT3B0aW9uc1xuICAgICAgICApOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuTElWRV9NQVAsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmxpdmVtYXAob3B0aW9ucy5kaXNwbGF5TW9kZSksXG4gICAgICAgICAgICAgICAgTGl2ZU1hcEdlb20uSEFORExFU19HUk9VUFMsXG4gICAgICAgICAgICAgICAgbXlHZW9tU3VwcGxpZXIgPSB7IExpdmVNYXBHZW9tKG9wdGlvbnMuZGlzcGxheU1vZGUpIH1cbiAgICAgICAgICAgICkuYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHJpYmJvbigpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuUklCQk9OLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5yaWJib24oKSxcbiAgICAgICAgICAgICAgICBSaWJib25HZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgUmliYm9uR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGFyZWEoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkFSRUEsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmFyZWEoKSxcbiAgICAgICAgICAgICAgICBBcmVhR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IEFyZWFHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZGVuc2l0eSgpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuREVOU0lUWSxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMuZGVuc2l0eSgpLFxuICAgICAgICAgICAgICAgIERlbnNpdHlHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgRGVuc2l0eUdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBkZW5zaXR5MmQoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkRFTlNJVFkyRCxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMuZGVuc2l0eTJkKCksXG4gICAgICAgICAgICAgICAgRGVuc2l0eTJkR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IERlbnNpdHkyZEdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBkZW5zaXR5MmRmKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5ERU5TSVRZMkRGLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5kZW5zaXR5MmRmKCksXG4gICAgICAgICAgICAgICAgRGVuc2l0eTJkZkdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBEZW5zaXR5MmRmR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGppdHRlcigpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuSklUVEVSLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5qaXR0ZXIoKSxcbiAgICAgICAgICAgICAgICBKaXR0ZXJHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgSml0dGVyR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGZyZXFwb2x5KCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5GUkVRUE9MWSxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMuZnJlcXBvbHkoKSxcbiAgICAgICAgICAgICAgICBGcmVxcG9seUdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBGcmVxcG9seUdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBzdGVwKHN1cHBsaWVyOiAoKSAtPiBHZW9tKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLlNURVAsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLnN0ZXAoKSxcbiAgICAgICAgICAgICAgICBTdGVwR2VvbS5IQU5ETEVTX0dST1VQUyxcbiAgICAgICAgICAgICAgICBzdXBwbGllclxuICAgICAgICAgICAgKS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcmVjdCgpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuUkVDVCxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMucmVjdCgpLFxuICAgICAgICAgICAgICAgIFJlY3RHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgUmVjdEdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBzZWdtZW50KHN1cHBsaWVyOiAoKSAtPiBHZW9tKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLlNFR01FTlQsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLnNlZ21lbnQoKSxcbiAgICAgICAgICAgICAgICBTZWdtZW50R2VvbS5IQU5ETEVTX0dST1VQUyxcbiAgICAgICAgICAgICAgICBzdXBwbGllclxuICAgICAgICAgICAgKS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdGV4dChzdXBwbGllcjogKCkgLT4gR2VvbSk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5URVhULFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy50ZXh0KCksXG4gICAgICAgICAgICAgICAgVGV4dEdlb20uSEFORExFU19HUk9VUFMsXG4gICAgICAgICAgICAgICAgc3VwcGxpZXJcbiAgICAgICAgICAgICkuYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHJhc3RlcigpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuUkFTVEVSLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5yYXN0ZXIoKSxcbiAgICAgICAgICAgICAgICBSYXN0ZXJHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgUmFzdGVyR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGltYWdlKHN1cHBsaWVyOiAoKSAtPiBHZW9tKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLklNQUdFLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5pbWFnZSgpLFxuICAgICAgICAgICAgICAgIEltYWdlR2VvbS5IQU5ETEVTX0dST1VQUyxcbiAgICAgICAgICAgICAgICBzdXBwbGllclxuICAgICAgICAgICAgKS5idWlsZCgpXG4gICAgICAgIH1cbiAgICB9XG59X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ICAgICk6IFNjYWxlPERvdWJsZT4ge1xuICAgICAgICByZXR1cm4gYnVpbGRBeGlzU2NhbGVEZWZhdWx0KFxuICAgICAgICAgICAgc2NhbGVQcm90byxcbiAgICAgICAgICAgIGRvbWFpbixcbiAgICAgICAgICAgIGF4aXNMZW5ndGgsXG4gICAgICAgICAgICBicmVha3NcbiAgICAgICAgKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVDb29yZGluYXRlU3lzdGVtKFxuICAgICAgICB4RG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICB4QXhpc0xlbmd0aDogRG91YmxlLFxuICAgICAgICB5RG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICB5QXhpc0xlbmd0aDogRG91YmxlXG4gICAgKTogQ29vcmRpbmF0ZVN5c3RlbSB7XG4gICAgICAgIHZhbCBtYXBwZXJYID0gbGluZWFyTWFwcGVyKHhEb21haW4sIHhBeGlzTGVuZ3RoKVxuICAgICAgICB2YWwgbWFwcGVyWSA9IGxpbmVhck1hcHBlcih5RG9tYWluLCB5QXhpc0xlbmd0aClcbiAgICAgICAgcmV0dXJuIENvb3Jkcy5jcmVhdGUoXG4gICAgICAgICAgICBNYXBwZXJVdGlsLm1hcChcbiAgICAgICAgICAgICAgICB4RG9tYWluLFxuICAgICAgICAgICAgICAgIG1hcHBlclhcbiAgICAgICAgICAgICksXG4gICAgICAgICAgICBNYXBwZXJVdGlsLm1hcChcbiAgICAgICAgICAgICAgICB5RG9tYWluLFxuICAgICAgICAgICAgICAgIG1hcHBlcllcbiAgICAgICAgICAgICksXG4gICAgICAgICAgICB4TGltPy5sZXQgeyBNYXBwZXJVdGlsLm1hcChpdCwgbWFwcGVyWCkgfSxcbiAgICAgICAgICAgIHlMaW0/LmxldCB7IE1hcHBlclV0aWwubWFwKGl0LCBtYXBwZXJZKSB9XG4gICAgICAgIClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gYWRqdXN0RG9tYWlucyhcbiAgICAgICAgeERvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgeURvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgZGlzcGxheVNpemU6IERvdWJsZVZlY3RvclxuICAgICk6IFBhaXI8Q2xvc2VkUmFuZ2U8RG91YmxlPiwgQ2xvc2VkUmFuZ2U8RG91YmxlPj4ge1xuICAgICAgICByZXR1cm4gUGFpcih4TGltID86IHhEb21haW4sIHlMaW0gPzogeURvbWFpbilcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgZnVuIGxpbmVhck1hcHBlcihkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sIGF4aXNMZW5ndGg6IERvdWJsZSk6IChEb3VibGU/KSAtPiBEb3VibGU/IHtcbiAgICAgICAgICAgIHJldHVybiBNYXBwZXJzLm11bChkb21haW4sIGF4aXNMZW5ndGgpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBidWlsZEF4aXNTY2FsZURlZmF1bHQoXG4gICAgICAgICAgICBzY2FsZVByb3RvOiBTY2FsZTxEb3VibGU+LFxuICAgICAgICAgICAgZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICAgICAgYXhpc0xlbmd0aDogRG91YmxlLFxuICAgICAgICAgICAgYnJlYWtzOiBHdWlkZUJyZWFrc1xuICAgICAgICApOiBTY2FsZTxEb3VibGU+IHtcbiAgICAgICAgICAgIHJldHVybiBidWlsZEF4aXNTY2FsZURlZmF1bHQoXG4gICAgICAgICAgICAgICAgc2NhbGVQcm90byxcbiAgICAgICAgICAgICAgICBsaW5lYXJNYXBwZXIoZG9tYWluLCBheGlzTGVuZ3RoKSxcbiAgICAgICAgICAgICAgICBicmVha3NcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBidWlsZEF4aXNTY2FsZURlZ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ICAgICAgdmFsIGRvbWFpblNxdWFyZTogUGFpcjxDbG9zZWRSYW5nZTxEb3VibGU+LCBDbG9zZWRSYW5nZTxEb3VibGU+PiA9XG4gICAgICAgICAgICBpZiAoc3BhblggPiBzcGFuWSkge1xuICAgICAgICAgICAgICAgIHZhbCBjZW50ZXIgPSB4RG9tYWluLmxvd2VyRW5kICsgc3BhblggLyAyXG4gICAgICAgICAgICAgICAgdmFsIGhhbGZTcGFuID0gc3BhblkgLyAyXG4gICAgICAgICAgICAgICAgUGFpcihcbiAgICAgICAgICAgICAgICAgICAgQ2xvc2VkUmFuZ2UoY2VudGVyIC0gaGFsZlNwYW4sIGNlbnRlciArIGhhbGZTcGFuKSxcbiAgICAgICAgICAgICAgICAgICAgeURvbWFpblxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdmFsIGNlbnRlciA9IHlEb21haW4ubG93ZXJFbmQgKyBzcGFuWSAvIDJcbiAgICAgICAgICAgICAgICB2YWwgaGFsZlNwYW4gPSBzcGFuWCAvIDJcbiAgICAgICAgICAgICAgICBQYWlyKFxuICAgICAgICAgICAgICAgICAgICB4RG9tYWluLFxuICAgICAgICAgICAgICAgICAgICBDbG9zZWRSYW5nZShjZW50ZXIgLSBoYWxmU3BhbiwgY2VudGVyICsgaGFsZlNwYW4pXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgIHZhbCBwcm9qZWN0ZWRYTWluID0gcHJvamVjdGlvblguYXBwbHkoZG9tYWluU3F1YXJlLmZpcnN0Lmxvd2VyRW5kKVxuICAgICAgICB2YWwgcHJvamVjdGVkWE1heCA9IHByb2plY3Rpb25YLmFwcGx5KGRvbWFpblNxdWFyZS5maXJzdC51cHBlckVuZClcbiAgICAgICAgdmFsIHByb2plY3RlZFlNaW4gPSBwcm9qZWN0aW9uWS5hcHBseShkb21haW5TcXVhcmUuc2Vjb25kLmxvd2VyRW5kKVxuICAgICAgICB2YWwgcHJvamVjdGVkWU1heCA9IHByb2plY3Rpb25ZLmFwcGx5KGRvbWFpblNxdWFyZS5zZWNvbmQudXBwZXJFbmQpXG5cbiAgICAgICAgdmFsIHJhdGlvID0gKHByb2plY3RlZFlNYXggLSBwcm9qZWN0ZWRZTWluKSAvIChwcm9qZWN0ZWRYTWF4IC0gcHJvamVjdGVkWE1pbilcbiAgICAgICAgdmFsIGZpeGVkQ29vcmQgPSBGaXhlZFJhdGlvQ29vcmRQcm92aWRlcihyYXRpbywgbnVsbCwgbnVsbClcbiAgICAgICAgcmV0dXJuIGZpeGVkQ29vcmQuYWRqdXN0RG9tYWlucyh4RG9tYWluLCB5RG9tYWluLCBkaXNwbGF5U2l6ZSlcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gYnVpbGRBeGlzU2NhbGVYKFxuICAgICAgICBzY2FsZVByb3RvOiBTY2FsZTxEb3VibGU+LFxuICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIGF4aXNMZW5ndGg6IERvdWJsZSxcbiAgICAgICAgYnJlYWtzOiBHdWlkZUJyZWFrc1xuICAgICk6IFNjYWxlPERvdWJsZT4ge1xuICAgICAgICByZXR1cm4gaWYgKHByb2plY3Rpb25YLm5vbmxpbmVhcikge1xuICAgICAgICAgICAgYnVpbGRBeGlzU2NhbGVXaXRoUHJvamVjdGlvbihcbiAgICAgICAgICAgICAgICBwcm9qZWN0aW9uWCxcbiAgICAgICAgICAgICAgICBzY2FsZVByb3RvLFxuICAgICAgICAgICAgICAgIGRvbWFpbixcbiAgICAgICAgICAgICAgICBheGlzTGVuZ3RoLFxuICAgICAgICAgICAgICAgIGJyZWFrc1xuICAgICAgICAgICAgKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgc3VwZXIuYnVpbGRBeGlzU2NhbGVYKHNjYWxlUHJvdG8sIGRvbWFpbiwgYXhpc0xlbmd0aCwgYnJlYWtzKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGJ1aWxkQXhpc1NjYWxlWShcbiAgICAgICAgc2NhbGVQcm90bzogU2NhbGU8RG91YmxlPixcbiAgICAgICAgZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICBheGlzTGVuZ3RoOiBEb3VibGUsXG4gICAgICAgIGJyZWFrczogR3VpZGVCcmVha3NcbiAgICApOiBTY2FsZTxEb3VibGU+IHtcbiAgICAgICAgcmV0dXJuIGlmIChwcm9qZWN0aW9uWS5ub25saW5lYXIpIHtcbiAgICAgICAgICAgIGJ1aWxkQXhpc1NjYWxlV2l0aFByb2plY3Rpb24oXG4gICAgICAgICAgICAgICAgcHJvamVjdGlvblksXG4gICAgICAgICAgICAgICAgc2NhbGVQcm90byxcbiAgICAgICAgICAgICAgICBkb21haW4sXG4gICAgICAgICAgICAgICAgYXhpc0xlbmd0aCxcbiAgICAgICAgICAgICAgICBicmVha3NcbiAgICAgICAgICAgIClcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHN1cGVyLmJ1aWxkQXhpc1NjYWxlWShzY2FsZVByb3RvLCBkb21haW4sIGF4aXNMZW5ndGgsIGJyZWFrcylcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBwcml2YXRlIGZ1biBidWlsZEF4aXNTY2FsZVdpdGhQcm9qZWN0aW9uKFxuICAgICAgICAgICAgcHJvamVjdGlvbjogUHJvamVjdGlvbiwgc2NhbGVQcm90bzogU2NhbGU8RG91YmxlPixcbiAgICAgICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgICAgIGF4aXNMZW5ndGg6IERvdWJsZSxcbiAgICAgICAgICAgIGJyZWFrczogR3VpZGVCcmVha3NcbiAgICAgICAgKTogU2NhbGU8RG91YmxlPiB7XG5cbiAgICAgICAgICAgIHZhbCB2YWxpZERvbWFpbiA9IHByb2plY3Rpb24udG9WYWxpZERvbWFpbihkb21haW4pXG4gICAgICAgICAgICB2YWwgdmFsaWREb21haW5Qcm9qZWN0ZWQgPSBDbG9zZWRSYW5nZShcbiAgICAgICAgICAgICAgICBwcm9qZWN0aW9uLmFwcGx5KHZhbGlkRG9tYWluLmxvd2VyRW5kKSxcbiAgICAgICAgICAgICAgICBwcm9qZWN0aW9uLmFwcGx5KHZhbGlkRG9tYWluLnVwcGVyRW5kKVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICB2YWwgcHJvamVjdGlvbkludmVyc2UgPSBNYXBwZXJzLmxpbmVhcih2YWxpZERvbWFpblByb2plY3RlZCwgdmFsaWREb21haW4pXG5cbiAgICAgICAgICAgIHZhbCBsaW5lYXJNYXBwZXIgPSBsaW5lYXJNYXBwZXIoXG4gICAgICAgICAgICAgICAgZG9tYWluLFxuICAgICAgICAgICAgICAgIGF4aXNMZW5ndGhcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIHZhbCBzY2FsZU1hcHBlciA9IHR3aXN0U2NhbGVNYXBwZXIoXG4gICAgICAgICAgICAgICAgcHJvamVjdGlvbixcbiAgICAgICAgICAgICAgICBwcm9qZWN0aW9uSW52ZXJzZSxcbiAgICAgICAgICAgICAgICBsaW5lYXJNYXBwZXJcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIHZhbCB2YWxpZEJyZWFrcyA9IHZhbGlkYXRlQnJlYWtzKFxuICAgICAgICAgICAgICAgIHZhbGlkRG9tYWluLFxuICAgICAgICAgICAgICAgIGJyZWFrc1xuICAgICAgICAgICAgKVxuICAgICAgICAgICAgcmV0dXJuIGJ1aWxkQXhpc1NjYWxlRGVmYXVsdChcbiAgICAgICAgICAgICAgICBzY2FsZVByb3RvLFxuICAgICAgICAgICAgICAgIHNjYWxlTWFwcGVyLFxuICAgICAgICAgICAgICAgIHZhbGlkQnJlYWtzXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biB2YWxpZGF0ZUJyZWFrcyh2YWxpZERvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgYnJlYWtzOiBHdWlkZUJyZWFrcyk6IEd1aWRlQnJlYWtzIHtcbiAgICAgICAgICAgIHZhbCB2YWxpZEluZGljZXMgPSBBcnJheUxpc3Q8SW50PigpXG4gICAgICAgICAgICB2YXIgaSA9IDBcbiAgICAgICAgICAgIGZvciAodiBpbiBicmVha3MuZG9tYWluVmFsdWVzKSB7XG4gICAgICAgICAgICAgICAgaWYgKHYgaXMgRG91YmxlICYmIHZhbGlkRG9tYWluLmNvbnRhaW5zKHYpKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbGlkSW5kaWNlcy5hZGQoaSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaSsrXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh2YWxpZEluZGljZXMuc2l6ZSA9PSBicmVha3MuZG9tYWluVmFsdWVzLnNpemUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gYnJlYWtzXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbCB2YWxpZERvbWFpblZhbHVlcyA9IFNlcmllc1V0aWwucGlja0F0SW5kaWNlcyhicmVha3MuZG9tYWluVmFsdWVzLCB2YWxpZEluZGljZXMpXG4gICAgICAgICAgICB2YWwgdmFsaWRMYWJlbHMgPSBTZXJpZXNVdGlsLnBpY2tBdEluZGljZXMoYnJlYWtzLmxhYmVscywgdmFsaWRJbmRpY2VzKVxuICAgICAgICAgICAgdmFsIHZhbGlkVHJhbnNmb3JtZWRWYWx1ZXMgPSBTZXJpZXNVdGlsLnBpY2tBdEluZGljZXMoYnJlYWtzLnRyYW5zZm9ybWVkVmFsdWVzLCB2YWxpZEluZGljZXMpXG4gICAgICAgICAgICByZXR1cm4gR3VpZGVCcmVha3MoXG4gICAgICAgICAgICAgICAgdmFsaWREb21haW5WYWx1ZXMsXG4gICAgICAgICAgICAgICAgdmFsaWRUcmFuc2Zvcm1lZFZhbHVlcyxcbiAgICAgICAgICAgICAgICB2YWxpZExhYmVsc1xuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gdHdpc3RTY2FsZU1hcHBlcihcbiAgICAgICAgICAgIHByb2plY3Rpb246IFByb2plY3Rpb24sIHByb2plY3Rpb25JbnZlcnNlOiAoRG91YmxlKSAtPiBEb3VibGUsXG4gICAgICAgICAgICBzY2FsZU1hcHBlcjogKERvdWJsZT8pIC0+IERvdWJsZT9cbiAgICAgICAgKTogKERvdWJsZT8pIC0+IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIHsgdiAtPlxuICAgICAgICAgICAgICAgIHY/LnJ1biB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBwcm9qZWN0ZWQgPSBwcm9qZWN0aW9uLmFwcGx5KHYpXG4gICAgICAgICAgICAgICAgICAgIHZhbCB1blByb2plY3RlZCA9IHByb2plY3Rpb25JbnZlcnNlKHByb2plY3RlZClcbiAgICAgICAgICAgICAgICAgICAgc2NhbGVNYXBwZXIodW5Qcm9qZWN0ZWQpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmNvb3JkLm1hcFxuXG5pbXBvcnQgamV0YnJhaW5zLmRhdGFsb3JlLmJhc2UuZ2NvbW1vbi5jb2xsZWN0LkNsb3NlZFJhbmdlXG5pbXBvcnQgamV0YnJha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dhdGVPcGVyYXRpb24pXG5cbiAgICAgICAgICAgICAgICB2YWwgY3VyR3JvdXBTaXplQWZ0ZXJTdGF0ID0gc2Qucm93Q291bnQoKVxuXG4gICAgICAgICAgICAgICAgLy8gdXBkYXRlICdzdGF0IGdyb3VwJyB0byBhdm9pZCBjb2xsaXNpb25zIGFzIHN0YXQgaXMgYXBwbGllZCBpbmRlcGVuZGVudGx5IHRvIGVhY2ggb3JpZ2luYWwgZGF0YSBncm91cFxuICAgICAgICAgICAgICAgIGlmIChzZC5oYXMoU3RhdHMuR1JPVVApKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCByYW5nZSA9IHNkLnJhbmdlKFN0YXRzLkdST1VQKVxuICAgICAgICAgICAgICAgICAgICBpZiAocmFuZ2UgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHN0YXJ0ID0gbGFzdFN0YXRHcm91cEVuZCArIDFcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBvZmZzZXQgPSBzdGFydCAtIHJhbmdlLmxvd2VyRW5kLnRvSW50KClcbiAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RTdGF0R3JvdXBFbmQgPSByYW5nZS51cHBlckVuZC50b0ludCgpICsgb2Zmc2V0XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAob2Zmc2V0ICE9IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWwgbmV3RyA9IEFycmF5TGlzdDxEb3VibGU+KClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGcgaW4gc2QuZ2V0TnVtZXJpYyhTdGF0cy5HUk9VUCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3Ry5hZGQoZyEhICsgb2Zmc2V0KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZCA9IHNkLmJ1aWxkZXIoKS5wdXROdW1lcmljKFN0YXRzLkdST1VQLCBuZXdHKS5idWlsZCgpXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2UgeyAvLyBpZiBzdGF0IGhhcyAuLmdyb3VwLi4gdGhlbiBncm91cGluZ1ZhciB3b24ndCBiZSBjaGVja2VkLCBzbyBubyBuZWVkIHRvIHVwZGF0ZVxuICAgICAgICAgICAgICAgICAgICB2YWwgZ3JvdXBpbmdWYXIgPSBncm91cGluZ0NvbnRleHQub3B0aW9uYWxHcm91cGluZ1ZhclxuICAgICAgICAgICAgICAgICAgICBpZiAoZ3JvdXBpbmdWYXIgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHNpemUgPSBzZFtzZC52YXJpYWJsZXMoKS5maXJzdCgpXS5zaXplXG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgdiA9IGRbZ3JvdXBpbmdWYXJdWzBdXG4gICAgICAgICAgICAgICAgICAgICAgICBzZCA9IHNkLmJ1aWxkZXIoKS5wdXQoZ3JvdXBpbmdWYXIsIExpc3Qoc2l6ZSkgeyB2IH0pLmJ1aWxkKClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIEFkZCBncm91cCdzIGRhdGFcbiAgICAgICAgICAgICAgICBncm91cE1lcmdlci5hZGRHcm91cChzZCwgY3VyR3JvdXBTaXplQWZ0ZXJTdGF0KVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gR2V0IG1lcmdlZCBzZXJpZXNcbiAgICAgICAgICAgIHJlc3VsdFNlcmllcyA9IGdyb3VwTWVyZ2VyLmdldFJlc3VsdFNlcmllcygpXG4gICAgICAgICAgICBncm91cFNpemVMaXN0QWZ0ZXJTdGF0ID0gZ3JvdXBNZXJnZXIuZ2V0R3JvdXBTaXplcygpXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgZGF0YUFm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mFyaWFibGUpIHtcbiAgICAgICAgICAgIHZhbCB2YWx1ZSA9IHdoZW4gKGRhdGEuaXNOdW1lcmljKHZhcmlhYmxlKSkge1xuICAgICAgICAgICAgICAgIHRydWUgLT4gU2VyaWVzVXRpbC5tZWFuKGRhdGEuZ2V0TnVtZXJpYyh2YXJpYWJsZSksIGRlZmF1bHRWYWx1ZSA9IG51bGwpXG4gICAgICAgICAgICAgICAgZmFsc2UgLT4gU2VyaWVzVXRpbC5maXJzdE5vdE51bGwoZGF0YVt2YXJpYWJsZV0sIGRlZmF1bHRWYWx1ZSA9IG51bGwpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YWwgbmV3SW5wdXRTZXJpZSA9IExpc3Qoc3RhdERhdGFTaXplKSB7IHZhbHVlIH1cbiAgICAgICAgICAgIG5ld0lucHV0U2VyaWVzW3ZhcmlhYmxlXSA9IG5ld0lucHV0U2VyaWVcbiAgICAgICAgfVxuXG4gICAgICAgIGZvciAoYmluZGluZyBpbiBiaW5kaW5ncykge1xuICAgICAgICAgICAgdmFsIHZhcmlhYmxlID0gYmluZGluZy52YXJpYWJsZVxuICAgICAgICAgICAgaWYgKHZhcmlhYmxlLmlzU3RhdCB8fCBmYWNldFZhcnMuY29udGFpbnModmFyaWFibGUpKSB7XG4gICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIGFlcyA9IGJpbmRpbmcuYWVzXG4gICAgICAgICAgICBpZiAoc3RhdC5oYXNEZWZhdWx0TWFwcGluZyhhZXMpKSB7XG4gICAgICAgICAgICAgICAgdmFsIGRlZmF1bHRTdGF0VmFyID0gc3RhdC5nZXREZWZhdWx0TWFwcGluZyhhZXMpXG4gICAgICAgICAgICAgICAgdmFsIG5ld0lucHV0U2VyaWU6IExpc3Q8Kj4gPVxuICAgICAgICAgICAgICAgICAgICBpZiAoaW52ZXJzZVRyYW5zZm9ybWVkU3RhdFNlcmllcy5jb250YWluc0tleShkZWZhdWx0U3RhdFZhcikpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGludmVyc2VUcmFuc2Zvcm1lZFN0YXRTZXJpZXMuZ2V0VmFsdWUoZGVmYXVsdFN0YXRWYXIpXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgc3RhdFNlcmllID0gc3RhdERhdGEuZ2V0TnVtZXJpYyhkZWZhdWx0U3RhdFZhcilcbiAgICAgICAgICAgICAgICAgICAgICAgIFNjYWxlVXRpbC5pbnZlcnNlVHJhbnNmb3JtKHN0YXRTZXJpZSwgc2NhbGVNYXBbYWVzXSlcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG5ld0lucHV0U2VyaWVzW3ZhcmlhYmxlXSA9IG5ld0lucHV0U2VyaWVcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gRG8gbm90IG92ZXJyaWRlIHNlcmllcyBvYnRhaW5lZCB2aWEgJ2RlZmF1bHQgc3RhdCB2YXInXG4gICAgICAgICAgICAgICAgaWYgKCFuZXdJbnB1dFNlcmllcy5jb250YWluc0tleSh2YXJpYWJsZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgYWRkU2VyaWVzRm9yVmFyaWFibGUodmFyaWFibGUpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC8vIHNlcmllcyBmb3IgdmFyaWFibGVzIHdpdGhvdXQgYmluZGluZ3NcbiAgICAgICAgZm9yICh2YXJOYW1lIGluIHZhcnNXaXRob3V0QmluZGluZy5maWx0ZXJOb3QoU3RhdHM6OmlzU3RhdFZhcikpIHtcbiAgICAgICAgICAgIHZhbCB2YXJpYWJsZSA9IERhdGFGcmFtZVV0aWwuZmluZFZhcmlhYmxlT3JGYWlsKGRhdGEsIHZhck5hbWUpXG4gICAgICAgICAgICBpZiAoIW5ld0lucHV0U2VyaWVzL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PigpXG4gICAgICAgIHZhbCBhZXNCeU1hcHBlZFN0YXRWYXIgPSBIYXNoTWFwPFZhcmlhYmxlLCBBZXM8Kj4+KClcbiAgICAgICAgZm9yIChhZXMgaW4gQWVzLnZhbHVlcygpKSB7XG4gICAgICAgICAgICBpZiAoc3RhdC5oYXNEZWZhdWx0TWFwcGluZyhhZXMpKSB7XG4gICAgICAgICAgICAgICAgdmFsIGRlZmF1bHRTdGF0VmFyID0gc3RhdC5nZXREZWZhdWx0TWFwcGluZyhhZXMpXG4gICAgICAgICAgICAgICAgYWVzQnlNYXBwZWRTdGF0VmFyW2RlZmF1bHRTdGF0VmFyXSA9IGFlc1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZm9yIChiaW5kaW5nIGluIGJpbmRpbmdzKSB7XG4gICAgICAgICAgICB2YWwgYWVzID0gYmluZGluZy5hZXNcbiAgICAgICAgICAgIHZhbCB2YXJpYWJsZSA9IGJpbmRpbmcudmFyaWFibGVcbiAgICAgICAgICAgIGlmICh2YXJpYWJsZS5pc1N0YXQpIHtcbiAgICAgICAgICAgICAgICBhZXNCeU1hcHBlZFN0YXRWYXJbdmFyaWFibGVdID0gYWVzXG4gICAgICAgICAgICAgICAgLy8gaWdub3JlICdzdGF0JyB2YXIgYmVjYXVlIC4uP1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbCBzY2FsZSA9IHNjYWxlTWFwW2Flc11cbiAgICAgICAgICAgIGlmIChzY2FsZS5pc0NvbnRpbnVvdXNEb21haW4pIHtcbiAgICAgICAgICAgICAgICBjb250aW51b3VzU2NhbGVCeUFlc1thZXNdID0gc2NhbGVcbiAgICAgICAgICAgICAgICBpZiAoQWVzLmlzUG9zaXRpb25hbFgoYWVzKSAmJiAhY29udGludW91c1NjYWxlQnlBZXMuY29udGFpbnNLZXkoQWVzLlgpKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVvdXNTY2FsZUJ5QWVzW0Flcy5YXSA9IHNjYWxlXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChBZXMuaXNQb3NpdGlvbmFsWShhZXMpICYmICFjb250aW51b3VzU2NhbGVCeUFlcy5jb250YWluc0tleShBZXMuWSkpIHtcbiAgICAgICAgICAgICAgICAgICAgY29udGludW91c1NjYWxlQnlBZXNbQWVzLlldID0gc2NhbGVcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgaW52ZXJzZVRyYW5zZm9ybWVkU3RhdFNlcmllcyA9IEhhc2hNYXA8VmFyaWFibGUsIExpc3Q8RG91YmxlPz4+KClcbiAgICAgICAgZm9yIChzdGF0VmFyIGluIHN0YXREYXRhLnZhcmlhYmxlcygpKSB7XG4gICAgICAgICAgICBpZiAoYWVzQnlNYXBwZWRTdGF0VmFyLmNvbnRhaW5zS2V5KHN0YXRWYXIpKSB7XG4gICAgICAgICAgICAgICAgdmFsIGFlcyA9IGFlc0J5TWFwcGVkU3RhdFZhci5nZXRWYWx1ZShzdGF0VmFyKVxuICAgICAgICAgICAgICAgIHZhciBzY2FsZTogU2NhbGU8Kj4/ID0gY29udGludW91c1NjYWxlQnlBZXNbYWVzXVxuICAgICAgICAgICAgICAgIGlmIChzY2FsZSA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChBZXMuaXNQb3NpdGlvbmFsWChhZXMpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzY2FsZSA9IGNvbnRpbnVvdXNTY2FsZUJ5QWVzW0Flcy5YXVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKEFlcy5pc1Bvc2l0aW9uYWxZKGFlcykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjYWxlID0gY29udGludW91c1NjYWxlQnlBZXNbQWVzLlldXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG5cbiA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dKVxuICAgICAgICB9XG5cbiAgICAgICAgZm9yIChncm91cGluZ1ZhcmlhYmxlIGluIGdyb3VwaW5nVmFyaWFibGVzKSB7XG4gICAgICAgICAgICB2YWwgdmFsdWVzID0gZGF0YVtncm91cGluZ1ZhcmlhYmxlXVxuICAgICAgICAgICAgdmFsIGdyb3VwcyA9IGNvbXB1dGVHcm91cHModmFsdWVzKVxuICAgICAgICAgICAgaWYgKGN1cnJlbnRHcm91cHMgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIGN1cnJlbnRHcm91cHMgPSBncm91cHNcbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBjaGVjayhjdXJyZW50R3JvdXBzLnNpemUgPT0gZ3JvdXBzLnNpemUpIHtcbiAgICAgICAgICAgICAgICBcIkRhdGEgc2VyaWVzIHVzZWQgdG8gY29tcHV0ZSBncm91cHMgbXVzdCBiZSBlcXVhbCBpbiBzaXplIChlbmNvdW50ZXJlZCBzaXplczogXCIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgXCIke2N1cnJlbnRHcm91cHM/LnNpemV9LCAke2dyb3Vwcy5zaXplfSApXCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhbCBkdW1taWVzID0gY29tcHV0ZUR1bW15VmFsdWVzKGN1cnJlbnRHcm91cHMsIGdyb3VwcylcbiAgICAgICAgICAgIGN1cnJlbnRHcm91cHMgPSBjb21wdXRlR3JvdXBzKGR1bW1pZXMpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gaWYgKGN1cnJlbnRHcm91cHMgIT0gbnVsbCkge1xuICAgICAgICAgICAgR3JvdXBVdGlsLndyYXAoY3VycmVudEdyb3VwcylcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIEdyb3VwVXRpbC5TSU5HTEVfR1JPVVBcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNvbXB1dGVHcm91cHMod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ICAgICAgICB2YWwgdjIgPSBpdDIubmV4dCgpXG4gICAgICAgICAgICB2YWwgZHVtbXkgPSB2MSAqIGxpbWl0ICsgdjJcbiAgICAgICAgICAgIGR1bW1pZXMuYWRkKGR1bW15KVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBkdW1taWVzXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gZ2V0R3JvdXBpbmdWYXJpYWJsZXMoXG4gICAgICAgIGRhdGE6IERhdGFGcmFtZSxcbiAgICAgICAgYmluZGluZ3M6IExpc3Q8VmFyQmluZGluZz4sXG4gICAgICAgIGV4cGxpY2l0R3JvdXBpbmdWYXI6IFZhcmlhYmxlP1xuICAgICk6IEl0ZXJhYmxlPFZhcmlhYmxlPiB7XG5cbiAgICAgICAgLy8gYWxsICdvcmlnaW4nIGRpc2NyZXRlIHZhcnMgKGJ1dCBub3QgcG9zaXRpb25hbCkgKyBleHBsaWNpdEdyb3VwaW5nVmFyXG4gICAgICAgIHZhbCByZXN1bHQgPSBMaW5rZWRIYXNoU2V0PFZhcmlhYmxlPigpXG4gICAgICAgIGZvciAoYmluZGluZyBpbiBiaW5kaW5ncykge1xuICAgICAgICAgICAgdmFsIHZhcmlhYmxlID0gYmluZGluZy52YXJpYWJsZVxuICAgICAgICAgICAgaWYgKCFyZXN1bHQuY29udGFpbnModmFyaWFibGUpKSB7XG4gICAgICAgICAgICAgICAgaWYgKHZhcmlhYmxlLmlzT3JpZ2luKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICh2YXJpYWJsZSA9PSBleHBsaWNpdEdyb3VwaW5nVmFyIHx8IGlzRGVmYXVsdEdyb3VwaW5nVmFyaWFibGUoZGF0YSwgYmluZGluZy5hZXMsIHZhcmlhYmxlKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LmFkZCh2YXJpYWJsZSlcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAg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b3Vwcy5mb3JFYWNoIHsgZ3JvdXAgLT5cbiAgICAgICAgICAgIGdyb3VwLmRmLnZhcmlhYmxlcygpLmZvckVhY2ggeyB2YXJpYWJsZSAtPlxuICAgICAgICAgICAgICAgIHJlc3VsdFNlcmllcy5nZXRPclB1dCh2YXJpYWJsZSwgOjpBcnJheUxpc3QpLmFkZEFsbChncm91cC5kZlt2YXJpYWJsZV0pXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3VsdFNlcmllc1xuICAgIH1cblxuICAgIGZ1biBnZXRHcm91cFNpemVzKCk6IExpc3Q8SW50PiB7XG4gICAgICAgIHJldHVybiBteU9yZGVyZWRHcm91cHMubWFwKEdyb3VwOjpncm91cFNpemUpXG4gICAgfVxuXG4gICAgaW5uZXIgY2xhc3MgR3JvdXAoXG4gICAgICAgIHZhbCBkZjogRGF0YUZyYW1lLFxuICAgICAgICB2YWwgZ3JvdXBTaXplOiBJbnRcbiAgICApIDogQ29tcGFyYWJsZTxHcm91cD4ge1xuICAgICAgICBvdmVycmlkZSBmdW4gY29tcGFyZVRvKG90aGVyOiBHcm91cCk6IEludCB7XG4gICAgICAgICAgICBmdW4gY29tcGFyZUdyb3VwVmFsdWUodjE6IEFueT8sIHYyOiBBbnk/LCBkaXI6IEludCk6IEludCB7XG4gICAgICAgICAgICAgICAgLy8gbnVsbCB2YWx1ZSBpcyBhbHdheXMgZ3JlYXRlciAtIHdpbGwgYmUgYXQgdGhlIGVuZCBvZiB0aGUgcmVzdWx0XG4gICAgICAgICAgICAgICAgaWYgKHYxID09IG51bGwgJiYgdjIgPT0gbnVsbCApIHJldHVybiAwXG4gICAgICAgICAgICAgICAgaWYgKHYxID09IG51bGwpIHJldHVybiAxXG4gICAgICAgICAgICAgICAgaWYgKHYyID09IG51bGwpIHJldHVybiAtMVxuICAgICAgICAgICAgICAgIHJldHVybiBjb21wYXJlVmFsdWVzKHYxIGFzIENvbXBhcmFibGU8Kj4sIHYyIGFzIENvbXBhcmFibGU8Kj4pICogZGlyXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBmdW4gZ2V0VmFsdWUoXG4gICAgICAgICAgICAgICAgZGY6IERhdGFGcmFtZSxcbiAgICAgICAgICAgICAgICB2YXJpYWJsZTogRGF0YUZyYW1lLlZhcmlhYmxlLFxuICAgICAgICAgICAgICAgIGFnZ3JlZ2F0ZU9wZXJhdGlvbjogKChMaXN0PERvdWJsZT8+KSAtPiBEb3VibGU/KT8gPSBudWxsXG4gICAgICAgICAgICApOiBBbnk/IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaWYgKGFnZ3JlZ2F0ZU9wZXJhdGlvbiAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoZGYuaXNOdW1lcmljKHZhcmlhYmxlKSkgeyBcIkNhbid0IGFwcGx5IGFnZ3JlZ2F0ZSBvcGVyYXRpb24gdG8gbm9uLW51bWVyaWMgdmFsdWVzXCIgfVxuICAgICAgICAgICAgICAgICAgICBhZ2dyZWdhdGVPcGVyYXRpb24uaW52b2tlKGRmLmdldE51bWVyaWModmFyaWFibGUpLnJlcXVpcmVOb051bGxzKCkpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gZ3JvdXAgaGFzIG5vIG1vcmUgdGhhbiBvbmUgdW5pcXVlIGVsZW1lbnRcbiAgICAgICAgICAgICAgICAgICAgZGZbdmFyaWFibGVdLmZpcnN0T3JOdWxsKClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG15T3JkZXJTcGVjcz8uZm9yRWFjaCB7IHNwZWMgLT5cbiAgICAgICAgICAgICAgICB2YXIgY21wID0gY29tcGFyZUdyb3VwVmFsdWUoXG4gICAgICAgICAgICAgICAgICAgIGdldFZhbHVlKGRmLCBzcGVjLm9yZGVyQnksIHNwZWMuYWdncmVnYXRlT3BlcmF0aW9uKSxcbiAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWUob3RoZXIuZGYsIHNwZWMub3JkZXJCeSwgc3BlYy5hZ2dyZWdhdGVPcGVyYXRpb24pLFxuICAgICAgICAgICAgICAgICAgICBzcGVjLmRpcmVjdGlvblxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICBpZiAoY21wID09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gZW5zdXJlIHRoZSBvcmRlciBhcyBpbiB0aGUgbGVnZW5kXG4gICAgICAgICAgICAgICAgICAgIGNtcCA9IGNvbXBhcmVHcm91cFZhbHVlKFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWUoZGYsIHNwZWMudmFyaWFibGUpLFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWUob3RoZXIuZGYsIHNwZWMudmFyaWFibGUpLFxuICAgICAgICAgICAgICAgICAgICAgICAgc3BlYy5kaXJlY3Rpb25cbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoY21wICE9IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNtcFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiAwXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gYWRkR3JvdXAoZDogRGF0YUZyYW1lLCBncm91cFNpemU6IEludCkge1xuICAgICAgICB2YWwgZ3JvdXAgPSBHcm91cChkLCBncm91cFNpemUpXG4gICAgICAgIHZhbCBpbmRleFRvSW5zZXJ0ID0gZmluZEluZGV4VG9JbnNlcnQoZ3JvdXApXG4gICAgICAgIG15T3JkZXJlZEdyb3Vwcy5hZGQoaW5kZXhUb0luc2VydCwgZ3JvdXApXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gZmluZEluZGV4VG9JbnNlcnQoZ3JvdXA6IEdyb3VwKTogSW50IHtcbiAgICAgICAgaWYgKG15T3JkZXJTcGVjcy5pc051bGxPckVtcHR5KCkpIHtcbiAgICAgICAgICAgIHJldHVybiBteU9yZGVyZWRHcm91cHMuc2l6ZVxuICAgICAgICB9XG4gICAgICAgIHZhciBpbmRleCA9IG15T3JkZXJlZEdyb3Vwcy5iaW5hcnlTZWFyY2goZ3JvdXApXG4gICAgICAgIGlmIChpbmRleCA8IDApIGluZGV4ID0gaW5kZXguaW52KClcbiAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgfVxufSIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGNhbiBiZSBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlLlxuICovXG5cbnBhY2thZ2UgamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5kYXRhXG5cbm9iamVjdCBHcm91cFV0aWwge1xuICAgIGludGVybmFsIHZhbCBTSU5HTEVfR1JPVVAgPSB7IF86IEludCAtPiAwIH1cblxuICAgIGZ1biB3cmFwKGw6IExpc3Q8TnVtYmVyPz4pOiAoSW50KSAtPiBJbnQge1xuICAgICAgICByZXR1cm4geyBpbmRleCAtPlxuICAgICAgICAgICAgaWYgKGluZGV4ID4gMCAmJiBpbmRleCA8IGwuc2l6ZSlcbiAgICAgICAgICAgICAgICBsW2luZGV4XSEhLnRvSW50KClcbiAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICAwXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gd3JhcChncm91cEJ5UG9pbnRJbmRleDogTWFwPEludCwgSW50Pik6IChJbnQpIC0+IEludCB7XG4gICAgICAgIHJldHVybiB7IGdyb3VwQnlQb2ludEluZGV4W2l0XSEhIH1cbiAgICB9XG5cbiAgICBmdW4gaW5kaWNlc0J5R3Jvd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KCkgPSB7IGluZGV4IC0+XG4gICAgICAgICAgICBpZiAobXlHcm91cE1hcHBlciA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgbXlHcm91cE1hcHBlciA9IGNvbXB1dGVHcm91cHMoKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbXlHcm91cE1hcHBlciEhKGluZGV4KVxuICAgICAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjb21wdXRlR3JvdXBzKCk6IChJbnQpIC0+IEludCB7XG4gICAgICAgIGlmIChteURhdGEuaGFzKFN0YXRzLkdST1VQKSkge1xuICAgICAgICAgICAgdmFsIGxpc3QgPSBteURhdGEuZ2V0TnVtZXJpYyhTdGF0cy5HUk9VUClcbiAgICAgICAgICAgIHJldHVybiBHcm91cFV0aWwud3JhcChsaXN0KVxuICAgICAgICB9IGVsc2UgaWYgKG15R3JvdXBTaXplTGlzdCAhPSBudWxsKSB7XG4gICAgICAgICAgICBpZiAobXlHcm91cFNpemVMaXN0ISEuc2l6ZSA9PSBteURhdGEucm93Q291bnQoKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBHcm91cFV0aWwuU0lOR0xFX0dST1VQXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHZhbCBncm91cEJ5UG9pbnRJbmRleCA9XG4gICAgICAgICAgICAgICAgICAgIHRvSW5kZXhNYXAobXlHcm91cFNpemVMaXN0ISEpXG4gICAgICAgICAgICAgICAgcmV0dXJuIEdyb3VwVXRpbC53cmFwKGdyb3VwQnlQb2ludEluZGV4KVxuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKG15RXhwZWN0TXVsdGlwbGUpIHtcbiAgICAgICAgICAgIHJldHVybiBEYXRhUHJvY2Vzc2luZy5jb21wdXRlR3JvdXBzKFxuICAgICAgICAgICAgICAgIG15RGF0YSxcbiAgICAgICAgICAgICAgICBteUJpbmRpbmdzLFxuICAgICAgICAgICAgICAgIG9wdGlvbmFsR3JvdXBpbmdWYXIsXG4gICAgICAgICAgICAgICAgcGF0aElkVmFyXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIEdyb3VwVXRpbC5TSU5HTEVfR1JPVVBcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgaW50ZXJuYWwgZnVuIHdpdGhPcmRlcmVkR3JvdXBzKGRhdGE6IERhdGFGcmFtZSwgZ3JvdXBTaXplTGlzdDogTGlzdDxJbnQ+KTogR3JvdXBpbmdDb250ZXh0IHtcbiAgICAgICAgICAgIHZhbCBncm91cGluZ0NvbnRleHQgPSBHcm91cGluZ0NvbnRleHQoZGF0YSwgZW1wdHlMaXN0KCksIG51bGwsIG51bGwsIGZhbHNlKVxuICAgICAgICAgICAgZ3JvdXBpbmdDb250ZXh0Lm15R3JvdXBTaXplTGlzdCA9IEFycmF5TGlzdChncm91cFNpemVMaXN0KVxuICAgICAgICAgICAgcmV0dXJuIGdyb3VwaW5nQ29udGV4dFxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gdG9JbmRleE1hcChncm91cFNpemVMaXN0OiBMaXN0PEludD4pOiBNYXA8SW50LCBJbnQ+IHtcbiAgICAgICAgICAgIHZhbCByZXN1bHQgPSBIYXNoTWFwPEludCwgSW50PigpXG4gICAgICAgICAgICB2YXIgY3VycmVudEdyb3VwID0gMFxuICAgICAgICAgICAgdmFyIGN1cnJlbnRHcm91cEluZGV4T2Zmc2V0ID0gMFxuICAgICAgICAgICAgZm9yIChncm91cFNpemUgaW4gZ3JvdXBTaXplTGlzdCkge1xuICAgICAgICAgICAgICAgIGZvciAoaSBpbiAwIHVudGlsIGdyb3VwU2l6ZSkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHRbY3VycmVudEdyb3VwSW5kZXhPZmZzZXQgKyBpXSA9IGN1cnJlbnRHcm91cFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjdXJyZW50R3J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BmdW4gY3JlYXRlKFxuICAgICAgICAgICAgICAgIHZhcmlhYmxlTmFtZTogU3RyaW5nLFxuICAgICAgICAgICAgICAgIG9yZGVyQnk6IFN0cmluZz8sXG4gICAgICAgICAgICAgICAgb3JkZXI6IEFueT9cbiAgICAgICAgICAgICk6IE9yZGVyT3B0aW9uPyB7XG4gICAgICAgICAgICAgICAgaWYgKG9yZGVyQnkgPT0gbnVsbCAmJiBvcmRlciA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlcXVpcmUob3JkZXIgPT0gbnVsbCB8fCAob3JkZXIgaXMgTnVtYmVyICYmIG9yZGVyLnRvSW50KCkgaW4gbGlzdE9mKC0xLCAxKSkpIHtcbiAgICAgICAgICAgICAgICAgICAgXCJVbnN1cHBvcnRlZCBgb3JkZXJgIHZhbHVlOiAkb3JkZXIuIFVzZSAxIChhc2NlbmRpbmcpIG9yIC0xIChkZXNjZW5kaW5nKS5cIlxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHJldHVybiBPcmRlck9wdGlvbih2YXJpYWJsZU5hbWUsIG9yZGVyQnksIChvcmRlciBhcz8gTnVtYmVyKT8udG9JbnQoKSlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZnVuIE9yZGVyT3B0aW9uLm1lcmdlV2l0aChvdGhlcjogT3JkZXJPcHRpb24pOiBPcmRlck9wdGlvbiB7XG4gICAgICAgICAgICAgICAgcmVxdWlyZSh2YXJpYWJsZU5hbWUgPT0gb3RoZXIudmFyaWFibGVOYW1lKSB7XG4gICAgICAgICAgICAgICAgICAgIFwiQ2FuJ3QgbWVyZ2Ugb3JkZXIgb3B0aW9ucyBmb3IgZGlmZmVyZW50IHZhcmlhYmxlczogJyR2YXJpYWJsZU5hbWUnIGFuZCAnJHtvdGhlci52YXJpYWJsZU5hbWV9J1wiXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlcXVpcmUoYnlWYXJpYWJsZSA9PSBudWxsIHx8IG90aGVyLmJ5VmFyaWFibGUgPT0gbnVsbCB8fCBvdGhlci5ieVZhcmlhYmxlID09IGJ5VmFyaWFibGUpIHtcbiAgICAgICAgICAgICAgICAgICAgXCJNdWx0aXBsZSBvcmRlcmluZyBvcHRpb25zIGZvciB0aGUgdmFyaWFibGUgJyR2YXJpYWJsZU5hbWUnIHdpdGggZGlmZmVyZW50IG5vbi1lbXB0eSAnb3JkZXJfYnknIGZpZWxkczogJyRieVZhcmlhYmxlJyBhbmQgJyR7b3RoZXIuYnlWYXJpYWJsZX0nXCJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmVxdWlyZShvcmRlckRpciA9PSBudWxsIHx8IG90aGVyLm9yZGVyRGlyID09IG51bGwgfHwgb3RoZXIub3JkZXJEaXIgPT0gb3JkZXJEaXIpIHtcbiAgICAgICAgICAgICAgICAgICAgXCJNdWx0aXBsZSBvcmRlcmluZyBvcHRpb25zIGZvciB0aGUgdmFyaWFibGUgJyR2YXJpYWJsZU5hbWUnIHdpdGggZGlmZmVyZW50IG9yZGVyIGRpcmVjdGlvbjogJyRvcmRlckRpcicgYW5kICcke290aGVyLm9yZGVyRGlyfSdcIlxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gT3JkZXJPcHRpb24oXG4gICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlTmFtZSxcbiAgICAgICAgICAgICAgICAgICAgYnlWYXJpYWJsZSA/OiBvdGhlci5ieVZhcmlhYmxlLFxuICAgICAgICAgICAgICAgICAgICBvcmRlckRpciA/OiBvdGhlci5vcmRlckRpclxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBjcmVhdGVPcmRlclNwZWMoXG4gICAgICAgIHZhcmlhYmxlczogU2V0PERhdGFGcmFtZS5WY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BpZiAoIW15RXZlbnRIYW5kbGVycy5jb250YWluc0tleShldmVudFNwZWMpKSB7XG4gICAgICAgICAgICBteUV2ZW50SGFuZGxlcnNbZXZlbnRTcGVjXSA9IExpc3RlbmVycygpXG4gICAgICAgICAgICBvbkFkZFNwZWMoZXZlbnRTcGVjKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGFkZFJlZyA9IG15RXZlbnRIYW5kbGVyc1tldmVudFNwZWNdPy5hZGQoZXZlbnRIYW5kbGVyKVxuICAgICAgICByZXR1cm4gb2JqZWN0IDogUmVnaXN0cmF0aW9uKCkge1xuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGRvUmVtb3ZlKCkge1xuICAgICAgICAgICAgICAgIGFkZFJlZz8ucmVtb3ZlKClcbiAgICAgICAgICAgICAgICBpZiAobXlFdmVudEhhbmRsZXJzW2V2ZW50U3BlY10hIS5pc0VtcHR5KSB7XG4gICAgICAgICAgICAgICAgICAgIG15RXZlbnRIYW5kbGVycy5yZW1vdmUoZXZlbnRTcGVjKVxuICAgICAgICAgICAgICAgICAgICBvblJlbW92ZVNwZWMoZXZlbnRTcGVjKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBkaXNwYXRjaChldmVudFNwZWM6IE1vdXNlRXZlbnRTcGVjLCBtb3VzZUV2ZW50OiBNb3VzZUV2ZW50KSB7XG4gICAgICAgIGlmIChteUV2ZW50SGFuZGxlcnMuY29udGFpbnNLZXkoZXZlbnRTcGVjKSkge1xuICAgICAgICAgICAgbXlFdmVudEhhbmRsZXJzW2V2ZW50U3BlY10/LmZpcmUob2JqZWN0IDogTGlzdGVuZXJDYWxsZXI8RXZlbnRIYW5kbGVyPE1vdXNlRXZlbnQ+PiB7XG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGNhbGwobDogRXZlbnRIYW5kbGVyPE1vdXNlRXZlbnQ+KSB7XG4gICAgICAgICA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H1cblxuICAgIG92ZXJyaWRlIGZ1biBidWlsZENvbXBvbmVudCgpIHtcbiAgICAgICAgYnVpbGRBeGlzKClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBidWlsZEF4aXMoKSB7XG4gICAgICAgIHZhbCByb290RWxlbWVudCA9IHJvb3RHcm91cFxuICAgICAgICByb290RWxlbWVudC5hZGRDbGFzcyhTdHlsZS5BWElTKVxuICAgICAgICBpZiAodGlja0xhYmVsU21hbGxGb250LmdldCgpKSB7XG4gICAgICAgICAgICByb290RWxlbWVudC5hZGRDbGFzcyhTdHlsZS5TTUFMTF9USUNLX0ZPTlQpXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbCA9IGxlbmd0aC5nZXQoKSEhXG4gICAgICAgIHZhbCB4MTogRG91YmxlXG4gICAgICAgIHZhbCB5MTogRG91YmxlXG4gICAgICAgIHZhbCB4MjogRG91YmxlXG4gICAgICAgIHZhbCB5MjogRG91YmxlXG4gICAgICAgIHZhbCBzdGFydDogRG91YmxlXG4gICAgICAgIHZhbCBlbmQ6IERvdWJsZVxuICAgICAgICB3aGVuIChvcmllbnRhdGlvbi5nZXQoKSkge1xuICAgICAgICAgICAgT3JpZW50YXRpb24uTEVGVCwgT3JpZW50YXRpb24uUklHSFQgLT4ge1xuICAgICAgICAgICAgICAgIHgyID0gMC4wXG4gICAgICAgICAgICAgICAgeDEgPSB4MlxuICAgICAgICAgICAgICAgIHN0YXJ0ID0gMC4wXG4gICAgICAgICAgICAgICAgeTEgPSBzdGFydFxuICAgICAgICAgICAgICAgIGVuZCA9IGxcbiAgICAgICAgICAgICAgICB5MiA9IGVuZFxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgT3JpZW50YXRpb24uVE9QLCBPcmllbnRhdGlvbi5CT1RUT00gLT4ge1xuICAgICAgICAgICAgICAgIHN0YXJ0ID0gMC4wXG4gICAgICAgICAgICAgICAgeDEgPSBzdGFydFxuICAgICAgICAgICAgICAgIGVuZCA9IGxcbiAgICAgICAgICAgICAgICB4MiA9IGVuZFxuICAgICAgICAgICAgICAgIHkyID0gMC4wXG4gICAgICAgICAgICAgICAgeTEgPSB5MlxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSAtPiB0aHJvdyBSdW50aW1lRXhjZXB0aW9uKFwiVW5leHBlY3RlZCBvcmllbnRhdGlvbjpcIiArIG9yaWVudGF0aW9uLmdldCgpKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGF4aXNMaW5lOiBTdmdMaW5lRWxlbWVudD8gPSBudWxsXG4gICAgICAgIGlmIChheGlzTGluZUVuYWJsZWQoKS5nZXQoKSkge1xuICAgICAgICAgICAgYXhpc0xpbmUgPSBTdmdMaW5lRWxlbWVudCh4MSwgeTEsIHgyLCB5MilcbiAgICAgICAgICAgIHJlZyhiaW5kT25lV2F5KGxpbmVXaWR0aCwgYXhpc0xpbmUuc3Ryb2tlV2lkdGgoKSkpXG4gICAgICAgICAgICByZWcoYmluZE9uZVdheShsaW5lQ29sb3IsIGF4aXNMaW5lLnN0cm9rZUNvbG9yKCkpKVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gZG8gbm90IGRyYXcgZ3JpZCBsaW5lcyB0aGVuIGl0J3MgdG9vIGNsb3NlIHRvIGF4aXMgZW5kcy5cbiAgICAgICAgdmFsIGdyaWRMaW5lTWluUG9zID0gc3RhcnQgKyAzXG4gICAgICAgIHZhbCBncmlkTGluZU1heFBvcyA9IGVuZCAtIDNcblxuICAgICAgICBpZiAoYnJlYWtzRW5hYmxlZCgpKSB7XG4gICAgICAgICAgICAvLyBhZGQgdGlja3MgYmVmb3JlIGF4aXMgbGluZVxuICAgICAgICAgICAgdmFsIGJyZWFrcyA9IHRoaXMuYnJlYWtzLmdldCgpXG4gICAgICAgICAgICBpZiAoIShicmVha3MgPT0gbnVsbCB8fCBicmVha3MuaXNFbXB0eSgpKSkge1xuXG4gICAgICAgICAgICAgICAgdmFyIGxhYmVsczogTGlzdDxTdHJpbmc+PyA9IHRoaXMubGFiZWxzLmdldCgpXG4gICAgICAgICAgICAgICAgaWYgKGxhYmVscyA9PSBudWxsIHx8IGxhYmVscy5pc0VtcHR5KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgbGFiZWxzID0gQXJyYXlMaXN0KClcbiAgICAgICAgICAgICAgICAgICAgZm9yIChpIGluIGJyZWFrcy5pbmRpY2VzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsYWJlbHMuYWRkKFwiXCIpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB2YXIgaSA9IDBcbiAgICAgICAgICAgICAgICBmb3IgKGJyIGluIGJyZWFrcykge1xuICAgICAgICAgICAgICAgICAgICB2YWwgYWRkR3JpZExpbmUgPSBiciA+PSBncmlkTGluZU1pblBvcyAmJiBiciA8PSBncmlkTGluZU1heFBvc1xuICAgICAgICAgICAgICAgICAgICB2YWwgbGFiZWwgPSBsYWJlbHNbaSAlIGxhYmVscy5zaXplXVxuICAgICAgICAgICAgICAgICAgICB2YWwgbGFiZWxPZmZzZXQgPSB0aWNrTGFiZWxPZmZzZXQoaSlcbiAgICAgICAgICAgICAgICAgICAgaSsrXG4gICAgICAgICAgICAgICAgICAgIHZhbCBncm91cCA9IGJ1aWxkVGljayhcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbE9mZnNldCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYWRkR3JpZExpbmUpIGdyaWRMaW5lTGVuZ3RoLmdldCgpIGVsc2UgMC4wKVxuXG4gICAgICAgICAgICAgICAgICAgIHdoZW4gKG9yaWVudGF0aW9uLmdldCgpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBPcmllbnRhdGlvbi5MRUZULCBPcmllbnRhdGlvbi5SSUdIVCAtPiB0cmFuc2Zvcm1UcmFuc2xhdGUoZ3JvdXAsIDAuMCwgYnIpXG4gICAgICAgICAgICAgICAgICAgICAgICBPcmllbnRhdGlvbi5UT1AsIE9yaWVudGF0aW9uLkJPVFRPTSAtPiB0cmFuc2Zvcm1UcmFuc2xhdGUoZ3JvdXAsIGJyLCAwLjApXG4gICAgICAgICAgICAgICAgICAgICAgICBlbHNlIC0+IHRocm93IFJ1bnRpbWVFeGNlcHRpb24oXCJVbmV4cGVjdGVkIG9yaWVudGF0aW9uOlwiICsgb3JpZW50YXRpb24uZ2V0KCkpXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICByb290RWxlbWVudC5jaGlsZHJlbigpLmFkZChncm91cClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICAvLyBheGlzIGxpbmVcbiAgICAgICAgaWYgKGF4aXNMaW5lICE9IG51bGwpIHtcbiAgICAgICAgICAgIHJvb3RFbGVtZW50LmNoaWxkcmVuKCkuYWRkKGF4aXNMaW5lKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gYnVpbGRUaWNrKGxhYmVsOiBTdHJpbmcsIGxhYmVsT2Zmc2V0OiBEb3VibGVWZWN0b3IsIGdyaWRMaW5lTGVuZ3RoOiBEb3VibGUpOiBTdmdHRWxlbWVudCB7XG5cbiAgICAgICAgdmFyIHRpY2tNYXJrOiBTdmdMaW5lRWxlbWVudD8gPSBudWxsXG4gICAgICAgIGlmICh0aWNrTWFya3NFbmFibGVkKCkuZ2V0KCkpIHtcbiAgICAgICAgICAgIHRpY2tNYXJrID0gU3ZnTGluZUVsZW1lbnQoKVxuICAgICAgICAgICAgcmVnKGJpbmRPbmVXYXkodGlja01hcmtXaWR0aCwgdGlja01hcmsuc3Ryb2tlV2lkdGgoKSkpXG4gICAgICAgICAgICByZWcoYmluZE9uZVdheSh0aWNrQ29sb3IsIHRpY2tNYXJrLnN0cm9rZUNvbG9yKCkpKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHRpY2tMYWJlbDogVGV4dExhYmVsPyA9IG51bGxcbiAgICAgICAgaWYgKHRpY2tMYWJlbHNFbmFibGVkKCkuZ2V0KCkpIHtcbiAgICAgICAgICAgIHRpY2tMYWJlbCA9IFRleHRMYWJlbChsYWJlbClcbiAgICAgICAgICAgIHJlZyhiaW5kT25lV2F5KHRpY2tDb2xvciwgdGlja0xhYmVsLnRleHRDb2xvcigpKSlcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBncmlkTGluZTogU3ZnTGluZUVsZW1lbnQ/ID0gbnVsbCAvLyBvcHRpb25hbDtcbiAgICAgICAgaWYgKGdyaWRMaW5lTGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgZ3JpZExpbmUgPSBTdmdMaW5lRWxlbWVudCgpXG4gICAgICAgICAgICByZWcoYmluZE9uZVdheShncmlkTGluZUNvbG9yLCBncmlkTGluZS5zdHJva2VDb2xvcigpKSlcbiAgICAgICAgICAgIHJlZyhiaW5kT25lV2F5KGdyaWRMaW5lV2lkdGgsIGdyaWRMaW5lLnN0cm9rZVdpZHRoKCkpKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIG1hcmtMZW5ndGggPSB0aWNrTWFya0xlbmd0aC5nZXQoKVxuICAgICAgICB3aGVuIChvcmllbnRhdGlvbi5nZXQoKSkge1xuICAgICAgICAgICAgT3JpZW50YXRpb24uTEVGVCAtPiB7XG4gICAgICAgICAgICAgICAgaWYgKHRpY2tNYXJrICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgdGlja01hcmsueDIoKS5zZXQoLW1hcmtMZW5ndGgpXG4gICAgICAgICAgICAgICAgICAgIHRpY2tNYXJrLnkyKCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGdyaWRMaW5lICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgZ3JpZExpbmUueDIoKS5zZXQoZ3JpZExpbmVMZW5ndGgpXG4gICAgICAgICAgICAgICAgICAgIGdyaWRMaW5lLnkyKCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBPcmllbnRhdGlvbi5SSUdIVCAtPiB7XG4gICAgICAgICAgICAgICAgaWYgKHRpY2tNYXJrICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgdGlja01hcmsueDIoKS5zZXQobWFya0xlbmd0aClcbiAgICAgICAgICAgICAgICAgICAgdGlja01hcmsueTIoKS5zZXQoMC4wKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoZ3JpZExpbmUgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBncmlkTGluZS54MigpLnNldCgtZ3JpZExpbmVMZW5ndGgpXG4gICAgICAgICAgICAgICAgICAgIGdyaWRMaW5lLnkyKCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBPcmllbnRhdGlvbi5UT1AgLT4ge1xuICAgICAgICAgICAgICAgIGlmICh0aWNrTWFyayAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHRpY2tNYXJrLngyKCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICAgICAgdGlja01hcmsueTIoKS5zZXQoLW1hcmtMZW5ndGgpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChncmlkTGluZSAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIGdyaWRMaW5lLngyKCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICAgICAgZ3JpZExpbmUueTIoKS5zZXQoZ3JpZExpbmVMZW5ndGgpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgT3JpZW50YXRpb24uQk9UVE9NIC0+IHtcbiAgICAgICAgICAgICAgICBpZiAodGlja01hcmsgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICB0aWNrTWFyay54MigpLnNldCgwLjApXG4gICAgICAgICAgICAgICAgICAgIHRpY2tNYXJrLnkyKCkuc2V0KG1hcmtMZW5ndGgpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChncmlkTGluZSAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIGdyaWRMaW5lLngyKCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICAgICAgZ3JpZExpbmUueTIoKS5zZXQoLWdyaWRMaW5lTGVuZ3RoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgUnVudGltZUV4Y2VwdGlvbihcIlVuZXhwZWN0ZWQgb3JpZW50YXRpb246XCIgKyBvcmllbnRhdGlvbi5nZXQoKSlcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBnID0gU3ZnR0VsZW1lbnQoKVxuICAgICAgICBpZiAoZ3JpZExpbmUgIT0gbnVsbCkge1xuICAgICAgICAgICAgZy5jaGlsZHJlbigpLmFkZChncmlkTGluZSlcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0aWNrTWFyayAhPSBudWxsKSB7XG4gICAgICAgICAgICBnLmNoaWxkcmVuKCkuYWRkKHRpY2tNYXJrKVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHRpY2tMYWJlbCAhPSBudWxsKSB7XG4gICAgICAgICAgICB0aWNrTGFiZWwubW92ZVRvKGxhYmVsT2Zmc2V0LngsIGxhYmVsT2Zmc2V0LnkpXG4gICAgICAgICAgICB0aWNrTGFiZWwuc2V0SG9yaXpvbnRhbEFuY2hvcih0aWNrTGFiZWxIb3Jpem9udGFsQW5jaG9yLmdldCgpKVxuICAgICAgICAgICAgdGlja0xhYmVsLnNldFZlcnRpY2FsQW5jaG9yKHRpY2tMYWJlbFZlcnRpY2FsQW5jaG9yLmdldCgpKVxuICAgICAgICAgICAgdGlja0xhYmVsL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F5b3V0LmJyZWFrSW5mb3MuaXRlcmF0b3IoKVxuICAgICAgICBmb3IgKGJyIGluIHNwZWMuYnJlYWtzKSB7XG4gICAgICAgICAgICB2YWwgYnJJbmZvID0gYnJlYWtJbmZvcy5uZXh0KClcblxuICAgICAgICAgICAgdmFsIHRpY2tMb2NhdGlvbiA9IGJySW5mby50aWNrTG9jYXRpb25cbiAgICAgICAgICAgIHZhbCB0aWNrTWFya1BvaW50cyA9IEFycmF5TGlzdDxEb3VibGVWZWN0b3I+KClcbiAgICAgICAgICAgIGlmIChob3Jpem9udGFsKSB7XG4gICAgICAgICAgICAgICAgdmFsIHRpY2tYID0gYmFyQm91bmRzLmxlZnQgKyB0aWNrTG9jYXRpb25cbiAgICAgICAgICAgICAgICB0aWNrTWFya1BvaW50cy5hZGQoRG91YmxlVmVjdG9yKHRpY2tYLCBiYXJCb3VuZHMudG9wKSlcbiAgICAgICAgICAgICAgICB0aWNrTWFya1BvaW50cy5hZGQoRG91YmxlVmVjdG9yKHRpY2tYLCBiYXJCb3VuZHMudG9wICsgdGlja0xlbmd0aCkpXG4gICAgICAgICAgICAgICAgdGlja01hcmtQb2ludHMuYWRkKERvdWJsZVZlY3Rvcih0aWNrWCwgYmFyQm91bmRzLmJvdHRvbSAtIHRpY2tMZW5ndGgpKVxuICAgICAgICAgICAgICAgIHRpY2tNYXJrUG9pbnRzLmFkZChEb3VibGVWZWN0b3IodGlja1gsIGJhckJvdW5kcy5ib3R0b20pKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YWwgdGlja1kgPSBiYXJCb3VuZHMudG9wICsgdGlja0xvY2F0aW9uXG4gICAgICAgICAgICAgICAgdGlja01hcmtQb2ludHMuYWRkKERvdWJsZVZlY3RvcihiYXJCb3VuZHMubGVmdCwgdGlja1kpKVxuICAgICAgICAgICAgICAgIHRpY2tNYXJrUG9pbnRzLmFkZChEb3VibGVWZWN0b3IoYmFyQm91bmRzLmxlZnQgKyB0aWNrTGVuZ3RoLCB0aWNrWSkpXG4gICAgICAgICAgICAgICAgdGlja01hcmtQb2ludHMuYWRkKERvdWJsZVZlY3RvcihiYXJCb3VuZHMucmlnaHQgLSB0aWNrTGVuZ3RoLCB0aWNrWSkpXG4gICAgICAgICAgICAgICAgdGlja01hcmtQb2ludHMuYWRkKERvdWJsZVZlY3RvcihiYXJCb3VuZHMucmlnaHQsIHRpY2tZKSlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgYWRkVGlja01hcmsoZ3VpZGVCYXJHcm91cCwgdGlja01hcmtQb2ludHNbMF0sIHRpY2tNYXJrUG9pbnRzWzFdKVxuICAgICAgICAgICAgYWRkVGlja01hcmsoZ3VpZGVCYXJHcm91cCwgdGlja01hcmtQb2ludHNbMl0sIHRpY2tNYXJrUG9pbnRzWzNdKVxuXG4gICAgICAgICAgICB2YWwgbGFiZWwgPSBUZXh0TGFiZWwoYnIubGFiZWwpXG4gICAgICAgICAgICBsYWJlbC5zZXRIb3Jpem9udGFsQW5jaG9yKGJySW5mby5sYWJlbEhvcml6b250YWxBbmNob3IpXG4gICAgICAgICAgICBsYWJlbC5zZXRWZXJ0aWNhbEFuY2hvcihickluZm8ubGFiZWxWZXJ0aWNhbEFuY2hvcilcbiAgICAgICAgICAgIGxhYmVsLm1vdmVUbyhickluZm8ubGFiZWxMb2NhdGlvbi54LCBickluZm8ubGFiZWxMb2NhdGlvbi55ICsgYmFyQm91bmRzLnRvcClcbiAgICAgICAgICAgIGd1aWRlQmFyR3JvdXAuY2hpbGRyZW4oKS5hZGQobGFiZWwucm9vdEdyb3VwKVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gYWRkIHdoaXRlIGZyYW1lXG4gICAgICAgIGd1aWRlQmFyR3JvdXAuY2hpbGRyZW4oKS5hZGQoXG4gICAgICAgICAgICBjcmVhdGVCb3JkZXIoXG4gICAgICAgICAgICAgICAgYmFyQm91bmRzLFxuICAgICAgICAgICAgICAgIHNwZWMudGhlbWUuYmFja2dyb3VuZEZpbGwoKSxcbiAgICAgICAgICAgICAgICAxLjBcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuXG4gICAgICAgIGlmIChkZWJ1Zykge1xuICAgICAgICAgICAgLy8gZnJhbWUgYmFyIGFuZCBsYWJlbHNcbiAgICAgICAgICAgIHZhbCBncmFwaEJvdW5kcyA9IERvdWJsZVJlY3RhbmdsZShEb3VibGVWZWN0b3IuWkVSTywgbGF5b3V0LmdyYXBoU2l6ZSlcbiAgICAgICAgICAgIGd1aWRlQmFyR3JvdXAuY2hpbGRyZW4oKS5hZGQoXG4gICAgICAgICAgICAgICAgY3JlYXRlQm9yZGVyKFxuICAgICAgICAgICAgICAgICAgICBncmFwaEJvdW5kcyxcbiAgICAgICAgICAgICAgICAgICAgQ29sb3IuREFSS19CTFVFLFxuICAgICAgICAgICAgICAgICAgICAxLjBcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBjb250ZW50Um9vdC5jaGlsZHJlbigpLmFkZChndWlkZUJhckdyb3VwKVxuICAgICAgICByZXR1cm4gbGF5b3V0LnNpemVcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBhZGRDb2xvckJhcihcbiAgICAgICAgZzogU3ZnR0VsZW1lbnQsXG4gICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgc2NhbGU6IFNjYWxlPENvbG9yPixcbiAgICAgICAgbnVtQmluczogSW50LFxuICAgICAgICBiYXJCb3VuZHM6IERvdWJsZVJlY3RhbmdsZSxcbiAgICAgICAgYmFyTGVuZ3RoRXhwYW5kOiBEb3VibGUsXG4gICAgICAgIGhvcml6b250YWw6IEJvb2xlYW4sXG4gICAgICAgIHJldmVyc2U6IEJvb2xlYW5cbiAgICApIHtcblxuICAgICAgICB2YWwgZG9tYWluU3BhbiA9IFNlcmllc1V0aWwuc3Bhbihkb21haW4pXG4gICAgICAgIHZhbCBzdGVwQ291bnQ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l0aEluZGV4KCkpIHtcbiAgICAgICAgICAgIHZhbCByID0gU3ZnUmVjdEVsZW1lbnQoXG4gICAgICAgICAgICAgICAgc2VnbWVudExlZnQsXG4gICAgICAgICAgICAgICAgc2VnbWVudFRvcCxcbiAgICAgICAgICAgICAgICBzZWdtZW50UmlnaHQgLSBzZWdtZW50TGVmdCxcbiAgICAgICAgICAgICAgICBzZWdtZW50Qm90dG9tIC0gc2VnbWVudFRvcFxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgci5zdHJva2VXaWR0aCgpLnNldCgwLjApXG4gICAgICAgICAgICByLmZpbGxDb2xvcigpLnNldChjb2xvcilcbiAgICAgICAgICAgIGcuY2hpbGRyZW4oKS5hZGQocilcblxuICAgICAgICAgICAgaWYgKGhvcml6b250YWwpIHtcbiAgICAgICAgICAgICAgICBzZWdtZW50TGVmdCArPSBzZWdtZW50U3RlcFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzZWdtZW50VG9wICs9IHNlZ21lbnRTdGVwXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaSA9PSAwKSB7XG4gICAgICAgICAgICAgICAgLy8gZmlyc3Qgc2VnbWVudCBpcyBhIGJpdCBsb25nZXIuXG4gICAgICAgICAgICAgICAgaWYgKGhvcml6b250YWwpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VnbWVudExlZnQgKz0gYmFyTGVuZ3RoRXhwYW5kXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc2VnbWVudFRvcCArPSBiYXJMZW5ndGhFeHBhbmRcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBhZGRUaWNrTWFyayhnOiBTdmdHRWxlbWVudCwgcDA6IERvdWJsZVZlY3RvciwgcDE6IERvdWJsZVZlY3Rvcikge1xuICAgICAgICB2YWwgbGluZSA9IFN2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AgICBjcmVhdGVCcmVha0luZm8odGlja0xvY2F0aW9uKVxuICAgICAgICB9XG4gICAgICAgIGJhckJvdW5kcyA9IERvdWJsZVJlY3RhbmdsZShEb3VibGVWZWN0b3IuWkVSTywgZ3VpZGVCYXJTaXplKVxuICAgIH1cblxuICAgIGludGVybmFsIGFic3RyYWN0IGZ1biBjcmVhdGVCcmVha0luZm8odGlja0xvY2F0aW9uOiBEb3VibGUpOiBCcmVha0luZm9cblxuICAgIGludGVybmFsIGNsYXNzIEJyZWFrSW5mbyhcbiAgICAgICAgdmFsIHRpY2tMb2NhdGlvbjogRG91YmxlLCB2YWwgbGFiZWxMb2NhdGlvbjogRG91YmxlVmVjdG9yLFxuICAgICAgICB2YWwgbGFiZWxIb3Jpem9udGFsQW5jaG9yOiBUZXh0TGFiZWwuSG9yaXpvbnRhbEFuY2hvciwgdmFsIGxhYmVsVmVydGljYWxBbmNob3I6IFRleHRMYWJlbC5WZXJ0aWNhbEFuY2hvclxuICAgIClcblxuICAgIHByaXZhdGUgY2xhc3MgSG9yaXpvbnRhbExheW91dChcbiAgICAgICAgdGl0bGU6IFN0cmluZyxcbiAgICAgICAgZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICBicmVha3M6IExpc3Q8R3VpZGVCcmVhazxEb3VibGU+PixcbiAgICAgICAgYmFyU2l6ZTogRG91YmxlVmVjdG9yLFxuICAgICAgICByZXZlcnNlOiBCb29sZWFuXG4gICAgKSA6IENvbG9yQmFyQ29tcG9uZW50TGF5b3V0KFxuICAgICAgICB0aXRsZSwgZG9tYWluLCBicmVha3MsIGJhclNpemUsXG4gICAgICAgIExlZ2VuZERpcmVjdGlvbi5IT1JJWk9OVEFMLFxuICAgICAgICByZXZlcnNlXG4gICAgKSB7XG5cbiAgICAgICAgb3ZlcnJpZGUgdmFsIGdyYXBoU2l6ZTogRG91YmxlVmVjdG9yXG4gICAgICAgIHByaXZhdGUgdmFsIGxhYmVsRGlzdGFuY2U6IERvdWJsZSBnZXQoKSA9IExBQkVMX1NQRUMuaGVpZ2h0KCkgLyAzXG4gICAgICAgIG92ZXJyaWRlIHZhbCBndWlkZUJhckxlbmd0aDogRG91YmxlIGdldCgpID0gZ3VpZGVCYXJTaXplLnhcblxuICAgICAgICBpbml0IHtcbiAgICAgICAgICAgIC8vIEJhciArIGxhYmVscyBib3VuZHNcbiAgICAgICAgICAgIGdyYXBoU2l6ZSA9IERvdWJsZVZlY3RvcihndWlkZUJhclNpemUueCwgZ3VpZGVCYXJTaXplLnkgKyBsYWJlbERpc3RhbmNlICsgTEFCRUxfU1BFQy5oZWlnaHQoKSlcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVCcmVha0luZm8odGlja0xvY2F0aW9uOiBEb3VibGUpOiBCcmVha0luZm8ge1xuICAgICAgICAgICAgdmFsIGxhYmVsTG9jYXRpb24gPSBEb3VibGVWZWN0b3IodGlja0xvY2F0aW9uLCBndWlkZUJhclNpemUueSArIGxhYmVsRGlzdGFuY2UpXG4gICAgICAgICAgICByZXR1cm4gQnJlYWtJbmZvKFxuICAgICAgICAgICAgICAgIHRpY2tMb2NhdGlvbixcbiAgICAgICAgICAgICAgICBsYWJlbExvY2F0aW9uLFxuICAgICAgICAgICAgICAgIFRleHRMYWJlbC5Ib3Jpem9udGFsQW5jaG9yLk1JRERMRSxcbiAgICAgICAgICAgICAgICBUZXh0TGFiZWwuVmVydGljYWxBbmNob3IuVE9QXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGNsYXNzIFZlcnRpY2FsTGF5b3V0KFxuICAgICAgICB0aXRsZTogU3RyaW5nLFxuICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIGJyZWFrczogTGlzdDxHdWlkZUJyZWFrPERvdWJsZT4+LFxuICAgICAgICBiYXJTaXplOiBEb3VibGVWZWN0b3IsXG4gICAgICAgIHJldmVyc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RG91YmxlVmVjdG9yKGd1aWRlQmFyU2l6ZS54ICsgbGFiZWxEaXN0YW5jZSwgdGlja0xvY2F0aW9uKVxuICAgICAgICAgICAgcmV0dXJuIEJyZWFrSW5mbyhcbiAgICAgICAgICAgICAgICB0aWNrTG9jYXRpb24sXG4gICAgICAgICAgICAgICAgbGFiZWxMb2NhdGlvbixcbiAgICAgICAgICAgICAgICBUZXh0TGFiZWwuSG9yaXpvbnRhbEFuY2hvci5MRUZULFxuICAgICAgICAgICAgICAgIFRleHRMYWJlbC5WZXJ0aWNhbEFuY2hvci5DRU5URVJcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBmdW4gaG9yaXpvbnRhbChcbiAgICAgICAgICAgIHRpdGxlOiBTdHJpbmcsXG4gICAgICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgICAgICBicmVha3M6IExpc3Q8R3VpZGVCcmVhazxEb3VibGU+PixcbiAgICAgICAgICAgIGJhclNpemU6IERvdWJsZVZlY3RvcixcbiAgICAgICAgICAgIHJldmVyc2U6IEJvb2xlYW5cbiAgICAgICAgKTogQ29sb3JCYXJDb21wb25lbnRMYXlvdXQge1xuICAgICAgICAgICAgcmV0dXJuIEhvcml6b250YWxMYXlvdXQoXG4gICAgICAgICAgICAgICAgdGl0bGUsXG4gICAgICAgICAgICAgICAgZG9tYWluLFxuICAgICAgICAgICAgICAgIGJyZWFrcyxcbiAgICAgICAgICAgICAgICBiYXJTaXplLFxuICAgICAgICAgICAgICAgIHJldmVyc2VcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB2ZXJ0aWNhbChcbiAgICAgICAgICAgIHRpdGxlOiBTdHJpbmcsXG4gICAgICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgICAgICBicmVha3M6IExpc3Q8R3VpZGVCcmVh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dCxcbiAgICByZXZlcnNlOiBCb29sZWFuXG4pIDogTGVnZW5kQm94U3BlYyh0aXRsZSwgdGhlbWUsIHJldmVyc2UpIHtcblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBjb25zdCB2YWwgREVGX05VTV9CSU4gPSAyMFxuXG4gICAgICAgIHByaXZhdGUgY29uc3QgdmFsIERFRl9CQVJfVEhJQ0tORVNTID0gMS4wICAvLyBpbiAna2V5LXNpemUnIG11bHRpcGxlc1xuICAgICAgICBwcml2YXRlIGNvbnN0IHZhbCBERUZfQkFSX0xFTkdUSCA9IDUuMCAgIC8vIGluICdrZXktc2l6ZScgbXVsdGlwbGVzXG5cbiAgICAgICAgaW50ZXJuYWwgZnVuIGJhckFic29sdXRlU2l6ZShob3Jpem9udGFsOiBCb29sZWFuLCB0aGVtZTogTGVnZW5kVGhlbWUpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICAgICAgcmV0dXJuIHdoZW4ge1xuICAgICAgICAgICAgICAgIGhvcml6b250YWwgLT4gRG91YmxlVmVjdG9yKFxuICAgICAgICAgICAgICAgICAgICBERUZfQkFSX0xFTkdUSCAqIHRoZW1lLmtleVNpemUoKSxcbiAgICAgICAgICAgICAgICAgICAgREVGX0JBUl9USElDS05FU1MgKiB0aGVtZS5rZXlTaXplKClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgZWxzZSAtPiBEb3VibGVWZWN0b3IoXG4gICAgICAgICAgICAgICAgICAgIERFRl9CQVJfVEhJQ0tORVNTICogdGhlbWUua2V5U2l6ZSgpLFxuICAgICAgICAgICAgICAgICAgICBERUZfQkFSX0xFTkdUSCAqIHRoZW1lLmtleVNpemUoKVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNv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G4gICAgICAgIGlubmVyR3JvdXAudHJhbnNmb3JtKCkuc2V0KGJ1aWxkVHJhbnNmb3JtKHNwZWMuY29udGVudE9yaWdpbiwgMC4wKSlcblxuICAgICAgICB2YWwgbCA9IHNwZWMubGF5b3V0XG4gICAgICAgIGlmIChoYXNUaXRsZSgpKSB7XG4gICAgICAgICAgICB2YWwgbGFiZWwgPSBjcmVhdGVUaXRsZUxhYmVsKFxuICAgICAgICAgICAgICAgIGwudGl0bGVMb2NhdGlvbixcbiAgICAgICAgICAgICAgICBsLnRpdGxlSG9yaXpvbnRhbEFuY2hvcixcbiAgICAgICAgICAgICAgICBsLnRpdGxlVmVydGljYWxBbmNob3JcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIGlubmVyR3JvdXAuY2hpbGRyZW4oKS5hZGQobGFiZWwucm9vdEdyb3VwKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGdyYXBoR3JvdXAgPSBTdmdHRWxlbWVudCgpXG4gICAgICAgIGdyYXBoR3JvdXAudHJhbnNmb3JtKCkuc2V0KGJ1aWxkVHJhbnNmb3JtKGwuZ3JhcGhPcmlnaW4sIDAuMCkpXG4gICAgICAgIGFwcGVuZEd1aWRlQ29udGVudChncmFwaEdyb3VwKVxuICAgICAgICBpbm5lckdyb3VwLmNoaWxkcmVuKCkuYWRkKGdyYXBoR3JvdXApXG5cbiAgICAgICAgaWYgKGRlYnVnKSB7XG4gICAgICAgICAgICBydW4ge1xuICAgICAgICAgICAgICAgIC8vIG91dGVyIGJvdW5kc1xuICAgICAgICAgICAgICAgIGFkZEJvcmRlcihvdXRlckJvdW5kcywgQ29sb3IuQ1lBTiwgMS4wKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcnVuIHtcbiAgICAgICAgICAgICAgICAvLyBpbm5lciBib3VuZHNcbiAgICAgICAgICAgICAgICB2YWwgcmVjdCA9IFN2Z1JlY3RFbGVtZW50KHNwZWMuaW5uZXJCb3VuZHMpXG4gICAgICAgICAgICAgICAgcmVjdC5maWxsQ29sb3IoKS5zZXQoQ29sb3IuQkxBQ0spXG4gICAgICAgICAgICAgICAgcmVjdC5zdHJva2VXaWR0aCgpLnNldCgwLjApXG4gICAgICAgICAgICAgICAgcmVjdC5maWxsT3BhY2l0eSgpLnNldCgwLjEpXG4gICAgICAgICAgICAgICAgYWRkKHJlY3QpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBydW4ge1xuICAgICAgICAgICAgICAgIC8vIGNvbnRlbnQgYm91bmRzXG4gICAgICAgICAgICAgICAgYWRkQm9yZGVyKHNwZWMuY29udGVudEJvdW5kcywgQ29sb3IuREFSS19NQUdFTlRBLCAxLjApXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBydW4ge1xuICAgICAgICAgICAgICAgIC8vIHRpdGxlIGJvdW5kc1xuICAgICAgICAgICAgICAgIGFkZEJvcmRlcihsLnRpdGxlQm91bmRzLmFkZChzcGVjLmNvbnRlbnRPcmlnaW4pLCBDb2xvci5NQUdFTlRBLCAxLjApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBhZGQoaW5uZXJHcm91cClcbiAgICB9XG5cbiAgICBwcm90ZWN0ZWQgZnVuIGFkZEJvcmRlcihib3VuZHM6IERvdWJsZVJlY3RhbmdsZSwgc3Ryb2tlQ29sb3I6IENvbG9yLCBzdHJva2VXaWR0aDogRG91YmxlKSB7XG4gICAgICAgIGFkZChcbiAgICAgICAgICAgIGNyZWF0ZUJvcmRlcihcbiAgICAgICAgICAgICAgICBib3VuZHMsXG4gICAgICAgICAgICAgICAgc3Ryb2tlQ29sb3IsXG4gICAgICAgICAgICAgICAgc3Ryb2tlV2lkdGhcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByb3RlY3RlZCBmdW4gYWRkUmVjdGFuZ2xlKGJvdW5kczogRG91YmxlUmVjdGFuZ2xlLCBmaWxsQ29sb3I6IENvbG9yKSB7XG4gICAgICAgIGFkZChcbiAgICAg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aE9yaWdpbjogRG91YmxlVmVjdG9yXG4gICAgICAgIGdldCgpID0gd2hlbiB7XG4gICAgICAgICAgICBpc0hvcml6b250YWwgLT5cbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IodGl0bGVTaXplKHRpdGxlKS54LCAwLjApXG4gICAgICAgICAgICBlbHNlIC0+XG4gICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKDAuMCwgdGl0bGVTaXplKHRpdGxlKS55KVxuICAgICAgICB9XG5cbiAgICB2YWwgc2l6ZTogRG91YmxlVmVjdG9yXG4gICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgIHZhbCBncmFwaEJvdW5kcyA9IERvdWJsZVJlY3RhbmdsZShncmFwaE9yaWdpbiwgZ3JhcGhTaXplKVxuICAgICAgICAgICAgdmFsIHRpdGxlQW5kQ29udGVudCA9IERvdWJsZVJlY3RhbmdsZShEb3VibGVWZWN0b3IuWkVSTywgRG91YmxlVmVjdG9yLlpFUk8pXG4gICAgICAgICAgICAgICAgLnVuaW9uKHRpdGxlQm91bmRzKVxuICAgICAgICAgICAgICAgIC51bmlvbihncmFwaEJvdW5kcylcbiAgICAgICAgICAgIHJldHVybiB0aXRsZUFuZENvbnRlbnQuZGltZW5zaW9uXG4gICAgICAgIH1cblxuICAgIHZhbCB0aXRsZUxvY2F0aW9uOiBEb3VibGVWZWN0b3JcbiAgICAgICAgZ2V0KCkgPSBpZiAoaXNIb3Jpem9udGFsKSB7XG4gICAgICAgICAgICB2YWwgZ3JhcGhTaXplID0gZ3JhcGhTaXplXG4gICAgICAgICAgICBEb3VibGVWZWN0b3IoMC4wLCBncmFwaFNpemUueSAvIDIpXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAvLyBtYWtlIHNvbWUgZGlzdGFuY2UgZnJvbSB0aGUgY29udGVudHNcbiAgICAgICAgICAgIHZhbCB5ID0gLVRJVExFX1NQRUMuaGVpZ2h0KCkgLyAzXG4gICAgICAgICAgICBEb3VibGVWZWN0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G5leHRTZWFyY2hJbmRleDogSW50ID0gY3VycmVudFN0YXJ0SW5kZXhcbiAgICAgICAgdmFyIG5leHRJdGVtOiBJbnRSYW5nZT8gPSBudWxsXG4gICAgICAgIHZhciBjb3VudGVyOiBJbnQgPSAwXG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gY2FsY05leHQoKSB7XG4gICAgICAgICAgICBpZiAobmV4dFNlYXJjaEluZGV4IDwgMCkge1xuICAgICAgICAgICAgICAgIG5leHRTdGF0ZSA9IDBcbiAgICAgICAgICAgICAgICBuZXh0SXRlbSA9IG51bGxcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKGxpbWl0ID4gMCAmJiArK2NvdW50ZXIgPj0gbGltaXQgfHwgbmV4dFNlYXJjaEluZGV4ID4gaW5wdXQubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICAgIG5leHRJdGVtID0gY3VycmVudFN0YXJ0SW5kZXguLmlucHV0Lmxhc3RJbmRleFxuICAgICAgICAgICAgICAgICAgICBuZXh0U2VhcmNoSW5kZXggPSAtMVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBtYXRjaCA9IGlucHV0LmdldE5leHRNYXRjaChuZXh0U2VhcmNoSW5kZXgpXG4gICAgICAgICAgICAgICAgICAgIGlmIChtYXRjaCA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBuZXh0SXRlbSA9IGN1cnJlbnRTdGFydEluZGV4Li5pbnB1dC5sYXN0SW5kZXhcbiAgICAgICAgICAgICAgICAgICAgICAgIG5leHRTZWFyY2hJbmRleCA9IC0xXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgKGluZGV4LCBsZW5ndGgpID0gbWF0Y2hcbiAgICAgICAgICAgICAgICAgICAgICAgIG5leHRJdGVtID0gY3VycmVudFN0YXJ0SW5kZXggdW50aWwgaW5kZXhcbiAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRTdGFydEluZGV4ID0gaW5kZXggKyBsZW5ndGhcbiAgICAgICAgICAgICAgICAgICAgICAgIG5leHRTZWFyY2hJbmRleCA9IGN1cnJlbnRTdGFydEluZGV4ICsgaWYgKGxlbmd0aCA9PSAwKSAxIGVsc2UgMFxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG5leHRTdGF0ZSA9IDFcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBuZXh0KCk6IEludFJhbmdlIHtcbiAgICAgICAgICAgIGlmIChuZXh0U3RhdGUgPT0gLTEpXG4gICAgICAgICAgICAgICAgY2FsY05leHQoKVxuICAgICAgICAgICAgaWYgKG5leHRTdGF0ZSA9PSAwKVxuICAgICAgICAgICAgICAgIHRocm93IE5vU3VjaEVsZW1lbnRFeGNlcHRpb24oKVxuICAgICAgICAgICAgdmFsIHJlc3VsdCA9IG5leHRJdGVtIGFzIEludFJhbmdlXG4gICAgICAgICAgICAvLyBDbGVhbiBuZXh0IHRvIGF2b2lkIGtlZXBpbmcgcmVmZXJlbmNlIG9uIHlpZWxkZWQgaW5zdGFuY2VcbiAgICAgICAgICAgIG5leHRJdGVtID0gbnVsbFxuICAgICAgICAgICAgbmV4dFN0YXRlID0gLTFcbiAgICAgICAgICAgIHJldHVybiByZXN1bHRcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBoYXNOZXh0KCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgaWYgKG5leHRTdGF0ZSA9PSAtMSlcbiAgICAgICAgICAgICAgICBjYWxjTmV4dCgpXG4gICAgICAgICAgICByZXR1cm4gbmV4dFN0YXRlID09IDFcbiAgICAgICAgfVxuICAgIH1cbn1cblxuLyoqXG4gKiBSZXR1cm5zIGEgc2VxdWVuY2Ugb2YgaW5kZX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aW5zLmRhdGFsb3JlLnBsb3QuYmFzZS5yZW5kZXIuTGVnZW5kS2V5RWxlbWVudEZhY3RvcnlcbmltcG9ydCBqZXRicmFpbnMuZGF0YWxvcmUudmlzLnN2Zy5TdmdHRWxlbWVudFxuXG5jbGFzcyBMZWdlbmRCcmVhayh2YWwgbGFiZWw6IFN0cmluZykge1xuICAgIHByaXZhdGUgdmFsIG15TGF5ZXJzID0gQXJyYXlMaXN0PExlZ2VuZEJyZWFrTGF5ZXI+KClcblxuICAgIHZhbCBtaW5pbXVtS2V5U2l6ZTogRG91YmxlVmVjdG9yXG4gICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgIHZhciBtaW5TaXplID0gRG91YmxlVmVjdG9yLlpFUk9cbiAgICAgICAgICAgIGZvciAobGF5ZXIgaW4gbXlMYXllcnMpIHtcbiAgICAgICAgICAgICAgICB2YWwgbGF5ZXJNaW5LZXlTaXplID0gbGF5ZXIua2V5RWxlbWVudEZhY3RvcnkubWluaW11bUtleVNpemUobGF5ZXIuZGF0YVBvaW50KVxuICAgICAgICAgICAgICAgIG1pblNpemUgPSBtaW5TaXplLm1heChsYXllck1pbktleVNpemUpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gbWluU2l6ZVxuICAgICAgICB9XG5cbiAgICB2YWwgaXNFbXB0eTogQm9vbGVhblxuICAgICAgICBnZXQoKSA9IG15TGF5ZXJzLmlzRW1wdHkoKVxuXG4gICAgZnVuIGFkZExheWVyKGRhdGFQb2ludDogRGF0YVBvaW50QWVzdGhldGljcywga2V5RWxlbWVudEZhY3Rvcnk6IExlZ2VuZEtleUVsZW1lbnRGYWN0b3J5KSB7XG4gICAgICAgIG15TGF5ZXJzLmFkZChcbiAgICAgICAgICAgIExlZ2VuZEJyZWFrTGF5ZXIoXG4gICAgICAgICAgICAgICAgZGF0YVBvaW50LFxuICAgICAgICAgICAgICAgIGtleUVsZW1lbnRGYWN0b3J5XG4gICAgICAgICAgICApXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gY3JlYXRlS2V5RWxlbWVudChzaXplOiBEb3VibGVWZWN0b3IpOiBTdmdHRWxlbWVudCB7XG4gICAgICAgIHZhbCBnID0gU3ZnR0VsZW1lbnQoKVxuXG4gICAgICAgIGZvciAobGF5ZXIgaW4gbXlMYXllcnMpIHtcbiAgICAgICAgICAgIHZhbCBrZXlFbGVtZW50ID0gbGF5ZXIua2V5RWxlbWVudEZhY3RvcnkuY3JlYXRlS2V5RWxlbWVudChsYXllci5kYXRhUG9pbnQsIHNpemUpXG4gICAgICAgICAgICBnLmNoaWxkcmVuKCkuYWRkKGtleUVsZW1lbnQpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gZ1xuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgTGVnZW5kQnJlYWtMYXllcihcbiAgICAgICAgdmFsIGRhdGFQb2ludDogRGF0YVBvaW50QWVzdGhldGljcyxcbiAgICAgICAgdmFsIGtleUVsZW1lbnRGYWN0b3J5OiBMZWdlbmRLZXlFbGVtZW50RmFjdG9yeVxuICAgIClcblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBmdW4gc2ltcGxlKFxuICAgICAgICAgICAgbGFiZWw6IFN0cmluZyxcbiAgICAgICAgICAgIGRhdGFQb2ludDogRGF0YVBvaW50QWVzdGhldGljcyxcbiAgICAgICAgICAgIGtleUVsZW1lbnRGYWN0b3J5OiBMZWdlbmRLZXlFbGVtZW50RmFjdG9yeVxuICAgICAgICApOiBMZWdlbmRCcmVhayB7XG4gICAgICAgICAgICB2YWwgYnIgPSBMZWdlbmRCcmVhayhsYWJlbClcbiAgICAgICAgICAgIGJyLmFkZExheWVyKGRhdGFQb2ludCwga2V5RWxlbWVudEZhY3RvcnkpXG4gICAgICAgICAgICByZXR1cm4gYnJcbiAgICAgICAgfVxuICAgIH1cbn0iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDIwLiBKZXRCcmFpbnMgcy5yLm8uXG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gICAgdmFyIGJyZWFrQm94Qm91bmRzOiBEb3VibGVSZWN0YW5nbGU/ID0gbnVsbFxuICAgICAgICBmb3IgKGkgaW4gYnJlYWtzLmluZGljZXMpIHtcbiAgICAgICAgICAgIHZhbCBsYWJlbFNpemUgPSBsYWJlbFNpemUoaSlcbiAgICAgICAgICAgIHZhbCBicmVha0JveFNpemUgPSBEb3VibGVWZWN0b3IobGFiZWxIT2Zmc2V0ICsgbGFiZWxTaXplLngsIGtleVNpemUueSlcbiAgICAgICAgICAgIGJyZWFrQm94Qm91bmRzID0gRG91YmxlUmVjdGFuZ2xlKFxuICAgICAgICAgICAgICAgIGJyZWFrQm94Qm91bmRzPy5sZXQgeyBicmVha0JveE9yaWdpbihpLCBpdCkgfSA/OiBjb250ZW50T3JpZ2luLFxuICAgICAgICAgICAgICAgIGJyZWFrQm94U2l6ZVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBteUtleUxhYmVsQm94ZXMuYWRkKGJyZWFrQm94Qm91bmRzKVxuICAgICAgICAgICAgbXlMYWJlbEJveGVzLmFkZChcbiAgICAgICAgICAgICAgICBEb3VibGVSZWN0YW5nbGUoXG4gICAgICAgICAgICAgICAgICAgIGxhYmVsSE9mZnNldCwgbGFiZWxWT2Zmc2V0LFxuICAgICAgICAgICAgICAgICAgICBsYWJlbFNpemUueCwgbGFiZWxTaXplLnlcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBteUNvbnRlbnRTaXplID0gR2VvbWV0cnlVdGlsLnVuaW9uKERvdWJsZVJlY3RhbmdsZShjb250ZW50T3JpZ2luLCBEb3VibGVWZWN0b3IuWkVSTyksIG15S2V5TGFiZWxCb3hlcykuZGltZW5zaW9uXG4gICAgfVxuXG4gICAgcHJvdGVjdGVkIGFic3RyYWN0IGZ1biBicmVha0JveE9yaWdpbihpbmRleDogSW50LCBwcmV2QnJlYWtCb3hCb3VuZHM6IERvdWJsZVJlY3RhbmdsZSk6IERvdWJsZVZlY3RvclxuXG4gICAgcHJvdGVjdGVkIGFic3RyYWN0IGZ1biBsYWJlbFNpemUoaW5kZXg6IEludCk6IERvdWJsZVZlY3RvclxuXG4gICAgcHJpdmF0ZSBjbGFzcyBNeUhvcml6b250YWwgaW50ZXJuYWwgY29uc3RydWN0b3IodGl0bGU6IFN0cmluZywgYnJlYWtzOiBMaXN0PExlZ2VuZEJyZWFrPiwga2V5U2l6ZTogRG91YmxlVmVjdG9yKSA6XG4gICAgICAgIExlZ2VuZENvbXBvbmVudExheW91dChcbiAgICAgICAgICAgIHRpdGxlLCBicmVha3MsIGtleVNpemUsXG4gICAgICAgICAgICBMZWdlbmREaXJlY3Rpb24uSE9SSVpPTlRBTFxuICAgICAgICApIHtcbiAgICAgICAgaW5pdCB7XG4gICAgICAgICAgICBjb2xDb3VudCA9IGJyZWFrcy5zaXplXG4gICAgICAgICAgICByb3dDb3VudCA9IDFcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBicmVha0JveE9yaWdpbihpbmRleDogSW50LCBwcmV2QnJlYWtCb3hCb3VuZHM6IERvdWJsZVJlY3RhbmdsZSk6IERvdWJsZVZlY3RvciB7XG4gICAgICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKHByZXZCcmVha0JveEJvdW5kcy5yaWdodCwgMC4wKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGxhYmVsU2l6ZShpbmRleDogSW50KTogRG91YmxlVmVjdG9yIHtcbiAgICAgICAgICAgIHZhbCBsYWJlbCA9IGJyZWFrc1tpbmRleF0ubGFiZWxcbiAgICAgICAgICAgIHJldHVybiBEb3VibGVWZWN0b3IoTEFCRUxfU1BFQy53aWR0aChsYWJlbC5sZW5ndGgpLCBMQUJFTF9TUEVDLmhlaWdodCgpKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBjbGFzcyBNeUhvcml6b250YWxNdWx0aVJvdyBpbnRlcm5hbCBjb25zdHJ1Y3RvcihcbiAgICAgICAgdGl0bGU6IFN0cmluZyxcbiAgICAgICAgYnJlYWtzOiBMaXN0PExlZ2VuZEJyZWFrPixcbiAgICAgICAga2V5U2l6ZTogRG91YmxlVmVjdG9yXG4gICAgKSA6IE15TXVsdGlSb3coXG4gICAgICAgIHRpdGxlLCBicmVha3MsIGtleVNpemUsXG4gICAgICAgIExlZ2VuZERpcmVjdGlvbi5IT1JJWk9OVEFMXG4gICAgKSB7XG4gICAgICAgIGluaXQge1xuICAgICAgICAgICAgY29sQ291bnQgPSBicmVha3Muc2l6ZVxuICAgICAgICAgICAgcm93Q291bnQgPSAxXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGNsYXNzIE15VmVydGljYWwgaW50ZXJuYWwgY29uc3RydWN0b3IodGl0bGU6IFN0cmluZywgYnJlYWtzOiBMaXN0PExlZ2VuZEJyZWFrPiwga2V5U2l6ZTogRG91YmxlVmVjdG9yKSA6XG4gICAgICAgIE15TXVsdGlSb3coXG4gICAgICAgICAgICB0aXRsZSwgYnJlYWtzLCBrZXlTaXplLFxuICAgICAgICAgICAgTGVnZW5kRGlyZWN0aW9uLlZFUlRJQ0FMXG4gICAgICAgICkge1xuICAgICAgICBpbml0IHtcbiAgICAgICAgICAgIGNvbENvdW50ID0gMVxuICAgICAgICAgICAgcm93Q291bnQgPSBicmVha3Muc2l6ZVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBhYnN0cmFjdCBjbGFzcyBNeU11bHRpUm93IGludGVybmFsIGNvbnN0cnVjdG9yKFxuICAgICAgICB0aXRsZTogU3RyaW5nLFxuICAgICAgICBicmVha3M6IExpc3Q8TGVnZW5kQnJlYWs+LFxuICAgICAgICBrZXlTaXplOiBEb3VibGVWZWN0b3IsXG4gICAgICAgIGxlZ2VuZERpcmVjdGlvbjogTGVnZW5kRGlyZWN0aW9uXG4gICAgKSA6IExlZ2VuZENvbXBvbmVudExheW91dCh0aXRsZSwgYnJlYWtzLCBrZXlTaXplLCBsZWdlbmREaXJlY3Rpb24pIHtcbiAgICAgICAgcHJpdmF0ZSB2YXIgbXlNYXhMYWJlbFdpZHRoID0gMC4wXG5cbiAgICAgICAgaW5pdCB7XG4gICAgICAgICAgICBmb3IgKGJyIGluIGJyZWFrcykge1xuICAgICAgICAgICAgICAgIG15TWF4TGFiZWxXaWR0aCA9IG1heChteU1heExhYmVsV2lkdGgsIExBQkVMX1NQRUMud2lkdGgoYnIubGFiZWwubGVuZ3RoKSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBicmVha0JveE9yaWdpbihpbmRleDogSW50LCBwcmV2QnJlYWtCb3hCb3VuZHM6IERvdWJsZVJlY3RhbmdsZSk6IERvdWJsZVZlY3RvciB7XG4gICAgICAgICAgICBpZiAoaXNGaWxsQnlSb3cpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaWYgKGluZGV4ICUgY29sQ291bnQgPT0gMCkge1xuICAgICAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IoMC4wLCBwcmV2QnJlYWtCb3hCb3VuZHMuYm90dG9tKVxuICAgICAgICAgICAgICAgIH0gZWxzZSBEb3VibGVWZWN0b3IocHJldkJyZWFrQm94Qm91bmRzLnJpZ2h0LCBwcmV2QnJlYWtCb3hCb3VuZHMudG9wKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBmaWxsIGJ5IGNvbHVtblxuICAgICAgICAgICAgcmV0dXJuIGlmIChpbmRleCAlIHJvd0NvdW50ID09IDApIHtcbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IocHJldkJyZWFrQm94Qm91bmRzLnJpZ2h0LCAwLjApXG4gICAgICAgICAgICB9IGVsc2UgRG91YmxlVmVjdG9yKHByZXZCcmVha0JveEJvdW5kcy5sZWZ0LCBwcmV2QnJlYWtCb3hCb3VuZHMuYm90dG9tKVxuXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gbGFiZWxTaXplKGluZGV4OiBJbnQpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICAgICAgcmV0dXJuIERvdWJsZVZlY3RvcihteU1heExhYmVsV2lkdGgsIExBQkVMX1NQRUMuaGVpZ2h0KCkpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgZnVuIGhvcml6b250YWwodGl0bGU6IFN0cmluZywgYnJlYWtzOiBMaXN0PExlZ2VuZEJyZWFrPiwga2V5U2l6ZTogRG91YmxlVmVjdG9yKTogTGVnZW5kQ29tcG9uZW50TGF5b3V0IHtcbiAgICAgICAgICAgIHJldHVybiBNeUhvcml6b250YWwoXG4gICAgICAgICAgICAgICAgdGl0bGUsXG4gICAgICAgICAgICAgICAgYnJlYWtzLFxuICAgICAgICAgICAgICAgIGtleVNpemVcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBob3Jpem9udGFsTXVsdGlSb3codGl0bGU6IFN0cmluZywgYnJlYWtzOiBMaXN0PExlZ2VuZEJyZWFrPiwga2V5U2l6ZTogRG91YmxlVmVjdG9yKTogTGVnZW5kQ29tcG9uZW50TGF5b3V0IHtcbiAgICAgICAgICAgIHJldHVybiBNeUhvcml6b250YWxNdWx0aVJvdyhcbiAgICAgICAgICAgICAgICB0aXRsZSxcbiAgICAgICAgICAgICAgICBicmVha3MsXG4gICAgICAgICAgICAgICAga2V5U2l6ZVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHZlcnRpY2FsKHRpdGxlOiBTdHJpbmcsIGJyZWFrczogTGlzdDxMZWdlbmRCcmVhaz4sIGtleVNpemU6IERvdWJsZVZlY3Rvcik6IExlZ2VuZENvbXBvbmVudExheW91dCB7XG4gICAgICAgICAgICByZXR1cm4gTXlWZXJ0aWNhbChcbiAgICAgICAgICAgICAgICB0aXRsZSxcbiAgICAg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nRlcmFjdC5NYXBwZWREYXRhQWNjZXNzXG5cbmludGVyZmFjZSBDb250ZXh0dWFsTWFwcGluZ1Byb3ZpZGVyIHtcbiAgICBmdW4gY3JlYXRlQ29udGV4dHVhbE1hcHBpbmcoZGF0YUFjY2VzczogTWFwcGVkRGF0YUFjY2VzcywgZGF0YUZyYW1lOiBEYXRhRnJhbWUpOiBDb250ZXh0dWFsTWFwcGluZ1xuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHZhbCBOT05FID0gb2JqZWN0IDogQ29udGV4dHVhbE1hcHBpbmdQcm92aWRlciB7XG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlQ29udGV4dHVhbE1hcHBpbmcoZGF0YUFjY2VzczogTWFwcGVkRGF0YUFjY2VzcywgZGF0YUZyYW1lOiBEYXRhRnJhbWUpOiBDb250ZXh0dWFsTWFwcGluZyB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIENvbnRleHR1YWxNYXBwaW5nKFxuICAgICAgICAgICAgICAgICAgICB0b29sdGlwTGluZXMgPSBlbXB0eUxpc3QoKSxcbiAgICAgICAgICAgICAgICAgICAgdG9vbHRpcEFuY2hvciA9IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIHRvb2x0aXBNaW5XaWR0aCA9IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIHRvb2x0aXBDb2xvciA9IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIGlnbm9yZUludmlzaWJsZVRhcmdldHMgPSBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgaGFzR2VuZXJhbFRvb2x0aXAgPSBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgaGFzQXhpc1Rvb2x0aXAgPSBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgaXNDcm9zc2hhaXJFbmFibGVkID0gZmFsc2VcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG4iLCIvK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MaXN0PFZhbHVlU291cmNlPj8gPSBudWxsXG4gICAgICAgICk6IENvbnRleHR1YWxNYXBwaW5nIHtcbiAgICAgICAgICAgIHZhbCBkZWZhdWx0VG9vbHRpcExpbmVzID0gR2VvbUludGVyYWN0aW9uQnVpbGRlci5kZWZhdWx0VmFsdWVTb3VyY2VUb29sdGlwTGluZXMoXG4gICAgICAgICAgICAgICAgYWVzTGlzdEZvclRvb2x0aXAsXG4gICAgICAgICAgICAgICAgYXhpc0FlcyxcbiAgICAgICAgICAgICAgICBvdXRsaWVycyxcbiAgICAgICAgICAgICAgICB1c2VyRGVmaW5lZFZhbHVlU291cmNlc1xuICAgICAgICAgICAgKVxuICAgICAgICAgICAgcmV0dXJuIGNyZWF0ZUNvbnRleHR1YWxNYXBwaW5nKFxuICAgICAgICAgICAgICAgIGRlZmF1bHRUb29sdGlwTGluZXMsXG4gICAgICAgICAgICAgICAgZGF0YUFjY2VzcyxcbiAgICAgICAgICAgICAgICBkYXRhRnJhbWUsXG4gICAgICAgICAgICAgICAgVG9vbHRpcFByb3BlcnRpZXMuTk9ORSxcbiAgICAgICAgICAgICAgICBpZ25vcmVJbnZpc2libGVUYXJnZXRzID0gZmFsc2UsXG4gICAgICAgICAgICAgICAgaXNDcm9zc2hhaXJFbmFibGVkID0gZmFsc2VcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGNyZWF0ZUNvbnRleHR1YWxNYXBwaW5nKFxuICAgICAgICAgICAgdG9vbHRpcExpbmVzOiBMaXN0PFRvb2x0aXBMaW5lPixcbiAgICAgICAgICAgIGRhdGFBY2Nlc3M6IE1hcHBlZERhdGFBY2Nlc3MsXG4gICAgICAgICAgICBkYXRhRnJhbWU6IERhdGFGcmFtZSxcbiAgICAgICAgICAgIHRvb2x0aXBQcm9wZXJ0aWVzOiBUb29sdGlwUHJvcGVydGllcyxcbiAgICAgICAgICAgIGlnbm9yZUludmlzaWJsZVRhcmdldHM6IEJv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gdGhpc1xuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGluaXREZWZhdWx0VG9vbHRpcHMoKSB7XG4gICAgICAgIG15VG9vbHRpcEF4aXNBZXMgPSBpZiAoIWlzQXhpc1Rvb2x0aXBFbmFibGVkKSBlbXB0eUxpc3QoKSBlbHNlIGdldEF4aXNGcm9tRnVuY3Rpb25LaW5kXG4gICAgICAgIG15VG9vbHRpcEFlcyA9IG15U3VwcG9ydGVkQWVzTGlzdCAtIGdldEF4aXNGcm9tRnVuY3Rpb25LaW5kXG4gICAgICAgIG15VG9vbHRpcE91dGxpZXJBZXNMaXN0ID0gZW1wdHlMaXN0KClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBwcmVwYXJlVG9vbHRpcFZhbHVlU291cmNlcygpOiBMaXN0PFRvb2x0aXBMaW5lPiB7XG5cbiAgICAgICAgcmV0dXJuIHdoZW4ge1xuICAgICAgICAgICAgbXlVc2VyVG9vbHRpcFNwZWMgPT0gbnVsbCAtPiB7XG4gICAgICAgICAgICAgICAgLy8gTm8gdXNlciB0b29sdGlwIHNwZWNpZmljYXRpb24gPT4gdXNlIGRlZmF1bHQgdG9vbHRpcHNcbiAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWVTb3VyY2VUb29sdGlwTGluZXMoXG4gICAgICAgICAgICAgICAgICAgIG15VG9vbHRpcEFlcyxcbiAgICAgICAgICAgICAgICAgICAgbXlUb29sdGlwQXhpc0FlcyxcbiAgICAgICAgICAgICAgICAgICAgbXlUb29sdGlwT3V0bGllckFlc0xpc3QsXG4gICAgICAgICAgICAgICAgICAgIHVzZXJEZWZpbmVkVmFsdWVTb3VyY2VzID0gbnVsbCxcbiAgICAgICAgICAgICAgICAgICAgY29uc3RhbnRzTWFwID0gbXlUb29sdGlwQ29uc3RhbnRzQWVzTGlzdFxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG15VXNlclRvb2x0aXBTcGVjISEudG9vbHRpcExpbmVQYXR0ZXJucyA9PSBudWxsIC0+IHtcbiAgICAgICAgICAgICAgICAvLyBObyB1c2VyIGxpbmUgcGF0dGVybnMgPT4gdXNlIGRlZmF1bHQgdG9vbHRpcHMgd2l0aCB0aGUgZ2l2ZW4gZm9ybWF0dGVkIHZhbHVlU291cmNlc1xuICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZVNvdXJjZVRvb2x0aXBMaW5lcyhcbiAgICAgICAgICAgICAgICAgICAgbXlUb29sdGlwQWVzLFxuICAgICAgICAgICAgICAgICAgICBteVRvb2x0aXBBeGlzQWVzLFxuICAgICAgICAgICAgICAgICAgICBteVRvb2x0aXBPdXRsaWVyQWVzTGlzdCxcbiAgICAgICAgICAgICAgICAgICAgbXlVc2VyVG9vbHRpcFNwZWMhIS52YWx1ZVNvdXJjZXMsXG4gICAgICAgICAgICAgICAgICAgIG15VG9vbHRpcENvbnN0YW50c0Flc0xpc3RcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBteVVzZXJUb29sdGlwU3BlYyEhLnRvb2x0aXBMaW5lUGF0dGVybnMhIS5pc0VtcHR5KCkgLT4ge1xuICAgICAgICAgICAgICAgIC8vIFVzZXIgbGlzdCBpcyBlbXB0eSA9PiBub3Qgc2hvdyB0b29sdGlwc1xuICAgICAgICAgICAgICAgIGVtcHR5TGlzdCgpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIC0+IHtcbiAgICAgICAgICAgICAgICAvLyBGb3JtIHZhbHVlIHNvdXJjZXM6IHVzZXIgbGlzdCArIGF4aXMgKyBvdXRsaWVyc1xuICAgICAgICAgICAgICAgIHZhbCBnZW9tT3V0bGllcnMgPSBteVRvb2x0aXBPdXRsaWVyQWVzTGlzdC50b011dGFibGVMaXN0KClcblxuICAgICAgICAgICAgICAgIC8vIFJlbW92ZSBvdXRsaWVyIHRvb2x0aXAgaWYgdGhlIG1hcHBlZEFlcyBpcyB1c2VkIGluIHRoZS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gICAgICB9XG5cbiAgICAgICAgICAgIHZhbCB4ID0gc3RhcnQueCArIChjb29yZC55IC0gc3RhcnQueSkgKiAoZW5kLnggLSBzdGFydC54KSAvIChlbmQueSAtIHN0YXJ0LnkpXG5cbiAgICAgICAgICAgIGlmICh4IDw9IGNvb3JkLngpIHtcbiAgICAgICAgICAgICAgICBpbnRlcnNlY3Rpb25Db3VudCsrXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gaW50ZXJzZWN0aW9uQ291bnQgJSAyICE9IDBcbiAgICB9XG5cbiAgICBmdW4gbGllc09uU2VnbWVudChwMTogRG91YmxlVmVjdG9yLCBwMjogRG91YmxlVmVjdG9yLCBjOiBEb3VibGVWZWN0b3IsIGVwc2lsb246IERvdWJsZSk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gRG91YmxlU2VnbWVudChwMSwgcDIpLmRpc3RhbmNlKGMpIDwgZXBzaWxvblxuICAgIH1cblxuICAgIGludGVybmFsIGZ1biBhcmVFcXVhbChwMTogRG91YmxlVmVjdG9yLCBwMjogRG91YmxlVmVjdG9yLCBlcHNpbG9uOiBEb3VibGUpOiBCb29sZWFuIHtcbiAgICAgICAgcmV0dXJuIHAxLnN1YnRyYWN0KHAyKS5sZW5ndGgoKSA8IGVwc2lsb25cbiAgICB9XG5cbiAgICBpbnRlcm5hbCBmdW4gYXJlRXF1YWwoYTogRG91YmxlLCBiOiBEb3VibGUsIGVwc2lsb246IERvdWJsZSk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gYWJzKGEgLSBiKSA8IGVwc2lsb25cbiAgICB9XG5cbiAgICBpbnRlcm5hbCBmdW4gZGlzdGFuY2UocDE6IERvdWJsZVZlY3RvciwgcDI6IERvdWJsZVZlY3Rvcik6IERvdWJsZSB7XG4gICAgICAgIHJldHVybiBEb3VibGVTZWdtZW50KHAxLCBwMikubGVuZ3RoKClcbiAgICB9XG5cbiAgICBpbnRlcm5hbCBmdW4gc3VidHJhY3RYKHY6IERvdWJsZVZlY3RvciwgeDogRG91YmxlKTogRG91YmxlVmVjdG9yIHtcbiAgICAgICAgcmV0dXJuIERvdWJsZVZlY3Rvcih2LnggLSB4LCB2LnkpXG4gICAgfVxuXG4gICAgaW50ZXJuYWwgZnVuIGFkZFgodjogRG91YmxlVmVjdG9yLCB4OiBEb3VibGUpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKHYueCArIHgsIHYueSlcbiAgICB9XG5cbiAgICBmdW4gbGVmdEVkZ2VPZihyZWN0OiBEb3VibGVSZWN0YW5nbGUpOiBEb3VibGVTZWdtZW50IHtcbiAgICAgICAgcmV0dXJuIERvdWJsZVNlZ21lbnQoXG4gICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHJlY3QubGVmdCwgcmVjdC50b3ApLFxuICAgICAgICAgICAgICAgIERvdWJsZVZlY3RvcihyZWN0LmxlZnQsIHJlY3QuYm90dG9tKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIHRvcEVkZ2VPZihyZWN0OiBEb3VibGVSZWN0YW5nbGUpOiBEb3VibGVTZWdtZW50IHtcbiAgICAgICAgcmV0dXJuIERvdWJsZVNlZ21lbnQoXG4gICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHJlY3QubGVmdCwgcmVjdC50b3ApLFxuICAgICAgICAgICAgICAgIERvdWJsZVZlY3RvcihyZWN0LnJpZ2h0LCByZWN0LnRvcClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biByaWdodEVkZ2VPZihyZWN0OiBEb3VibGVSZWN0YW5nbGUpOiBEb3VibGVTZWdtZW50IHtcbiAgICAgICAgcmV0dXJuIERvdWJsZVNlZ21lbnQoXG4gICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHJlY3QucmlnaHQsIHJlY3QudG9wKSxcbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IocmVjdC5yaWdodCwgcmVjdC5ib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QsIGNvb3JkKVxuICAgICAgICAgICAgaWYgKGRpc3RhbmNlIDwgMCkge1xuICAgICAgICAgICAgICAgIHNldE5ld0Nsb3Nlc3RDb29yZChjb29yZCwgbmV3RGlzdGFuY2UpXG4gICAgICAgICAgICAgICAgcmV0dXJuIENPTVBBUklTT05fUkVTVUxULk5FV19DTE9TRVJcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGRpc3RhbmNlIDwgbmV3RGlzdGFuY2UpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gQ09NUEFSSVNPTl9SRVNVTFQuTkVXX0ZBUlRIRVJcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGRpc3RhbmNlID09IG5ld0Rpc3RhbmNlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIENPTVBBUklTT05fUkVTVUxULkVRVUFMXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHNldE5ld0Nsb3Nlc3RDb29yZChjb29yZCwgbmV3RGlzdGFuY2UpXG4gICAgICAgICAgICByZXR1cm4gQ09NUEFSSVNPTl9SRVNVTFQuTkVXX0NMT1NFUlxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gc2V0TmV3Q2xvc2VzdENvb3JkKGNvb3JkOiBEb3VibGVWZWN0b3IsIGRpc3RhbmNlOiBEb3VibGUpIHtcbiAgICAgICAgICAgIHRoaXMuZGlzdGFuY2UgPSBkaXN0YW5jZVxuICAgICAgICAgICAgdGhpcy5jb29yZCA9IGNvb3JkXG4gICAgICAgIH1cblxuICAgICAgICBlbnVtIGNsYXNzIENPTVBBUklTT05fUkVTVUxUIHtcbiAgICAgICAgICAgIE5FV19DTE9TRVIsXG4gICAgICAgICAgICBORVdfRkFSVEhFUixcbiAgICAgICAgICAgIEVRVUFMXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjbGFzcyBEb3VibGVSYW5nZSBwcml2YXRlIGNvbnN0cnVjdG9yKHByaXZhdGUgdmFsIG15U3RhcnQ6IERvdWJsZSwgcHJpdmF0ZSB2YWwgbXlMZW5ndGg6IERvdWJsZSkge1xuXG4gICAgICAgIGluaXQge1xuICAgICAgICAgICAgaWYgKG15TGVuZ3RoIDwgMCkge1xuICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbihcIkxlbmd0aCBzaG91bGQgYmUgcG9zaXRpdmVcIilcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBsZW5ndGgoKTogRG91YmxlIHtcbiAgICAgICAgICAgIHJldHVybiBteUxlbmd0aFxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIG92ZXJsYXBzKHY6IERvdWJsZVJhbmdlKTogQm9vbGVhbiB7XG4gICAgICAgICAgICByZXR1cm4gc3RhcnQoKSA8PSB2LmVuZCgpICYmIHYuc3RhcnQoKSA8PSBlbmQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGluc2lkZSh2OiBEb3VibGVSYW5nZSk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIHN0YXJ0KCkgPj0gdi5zdGFydCgpICYmIGVuZCgpIDw9IHYuZW5kKClcbiAgICAgICAgfVxuXG4gICAgICAgIG9wZXJhdG9yIGZ1biBjb250YWlucyh2YWx1ZTogRG91YmxlKTogQm9vbGVhbiB7XG4gICAgICAgICAgICByZXR1cm4gdmFsdWUgPj0gc3RhcnQoKSAmJiB2YWx1ZSA8PSBlbmQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHN0YXJ0KCk6IERvdWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gbXlTdGFydFxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGVuZCgpOiBEb3VibGUge1xuICAgICAgICAgICAgcmV0dXJuIG15U3RhcnQgKyBsZW5ndGgoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIG1vdmUoZGVsdGE6IERvdWJsZSk6IERvdWJsZVJhbmdlIHtcbiAgICAgICAgICAgIHJldHVybiB3aXRoU3RhcnRBbmRMZW5ndGgoXG4gICAgICAgICAgICAgICAgc3RhcnQoKSArIGRlbHRhLFxuICAgICAgICAgICAgICAgIGxlbmd0aCgpXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gbW92ZUxlZnQoZGVsdGE6IERvdWJsZSk6IERvdWJsZVJhbmdlIHtcbiAgICAgICAgICAgIGlmIChkZWx0YSA8IDApIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oXCJWYWx1ZSBzaG91bGQgYmUgcG9zaXRpdmVcIilcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHdpdGhTdGFydEFuZExlbmd0aChcbiAgICAgICAgICAgICAgICBzdGFydCgpIC0gZGVsdGEsXG4gICAgICAgICAgICAgICAgbGVuZ3RoKClcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBtb3ZlUmlnaHQoZGVsdGE6IERvdWJsZSk6IERvdWJsZVJhbmdlIHtcbiAgICAgICAgICAgIGlmIChkZWx0YSA8IDApIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oXCJWYWx1ZSBzaG91bGQgYmUgcG9zaXRpdmVcIilcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHdpdGhTdGFydEFuZExlbmd0aChcbiAgICAgICAgICAgICAgICBzdGFydCgpICsgZGVsdGEsXG4gICAgICAgICAgICAgICAgbGVuZ3RoKClcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICAgICAgZnVuIHdpdGhTdGFydEFuZEVuZChzdGFydDogRG91YmxlLCBlbmQ6IERvdWJsZSk6IERvdWJsZVJhbmdlIHtcbiAgICAgICAgICAgICAgICB2YWwgc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MgKz0gZ2VuZXJhbFRvb2x0aXBTcGVjKClcbiAgICAgICAgICAgIHRvb2x0aXBTcGVjcyArPSBheGlzVG9vbHRpcFNwZWMoKVxuICAgICAgICAgICAgcmV0dXJuIHRvb2x0aXBTcGVjc1xuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gaGl0SW5kZXgoKTogSW50IHtcbiAgICAgICAgICAgIHJldHVybiBteUdlb21UYXJnZXQuaGl0SW5kZXhcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHRpcExheW91dEhpbnQoKTogVGlwTGF5b3V0SGludCB7XG4gICAgICAgICAgICByZXR1cm4gbXlHZW9tVGFyZ2V0LnRpcExheW91dEhpbnRcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIG91dGxpZXJIaW50cygpOiBNYXA8QWVzPCo+LCBUaXBMYXlvdXRIaW50PiB7XG4gICAgICAgICAgICByZXR1cm4gbXlHZW9tVGFyZ2V0LmFlc1RpcExheW91dEhpbnRzXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBoaW50Q29sb3JzKCk6IE1hcDxBZXM8Kj4sIENvbG9yPz4ge1xuICAgICAgICAgICAgcmV0dXJuIG15R2VvbVRhcmdldC5hZXNUaXBMYXlvdXRIaW50cy5tYXAgeyBpdC5rZXkgdG8gaXQudmFsdWUuY29sb3IgfS50b01hcCgpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBvdXRsaWVyVG9vbHRpcFNwZWMoKTogTGlzdDxUb29sdGlwU3BlYz4ge1xuICAgICAgICAgICAgdmFsIHRvb2x0aXBTcGVjcyA9IEFycmF5TGlzdDxUb29sdGlwU3BlYz4oKVxuICAgICAgICAgICAgdmFsIG91dGxpZXJEYXRhUG9pbnRzID0gb3V0bGllckRhdGFQb2ludHMoKVxuICAgICAgICAgICAgb3V0bGllckhpbnRzKCkuZm9yRWFjaCB7IChhZXMsIGhpbnQpIC0+XG4gICAgICAgICAgICAgICAgdmFsIGxpbmVzRm9yQWVzID0gb3V0bGllckRhdGFQb2ludHNcbiAgICAgICAgICAgICAgICAgICAgLmZpbHRlciB7IGFlcyA9PSBpdC5hZXMgfVxuICAgICAgICAgICAgICAgICAgICAubWFwKERhdGFQb2ludDo6dmFsdWUpXG4gICAgICAgICAgICAgICAgICAgIC5tYXAoVG9vbHRpcFNwZWMuTGluZS5Db21wYW5pb246OndpdGhWYWx1ZSlcbiAgICAgICAgICAgICAgICBpZiAobGluZXNGb3JBZXMuaXNOb3RFbXB0eSgpKSB7XG4gICAgICAgICAgICAgICAgICAgIHRvb2x0aXBTcGVjcy5hZGQoXG4gICAgICAgICAgICAgICAgICAgICAgICBUb29sdGlwU3BlYyhcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXlvdXRIaW50ID0gaGludCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5lcyA9IGxpbmVzRm9yQWVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGwgPSBoaW50LmNvbG9yID86IHRpcExheW91dEhpbnQoKS5jb2xvciEhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzT3V0bGllciA9IHRydWVcbiAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB0b29sdGlwU3BlY3NcbiAgICAgICAgfVxuXG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gYXhpc1Rvb2x0aXBTcGVjKCk6IExpc3Q8VG9vbHRpcFNwZWM+ICB7XG4gICAgICAgICAgICB2YWwgdG9vbHRpcFNwZWNzID0gQXJyYXlMaXN0PFRvb2x0aXBTcGVjPigpXG4gICAgICAgICAgICB2YWwgYXhpcyA9IG1hcE9mKFxuICAgICAgICAgICAgICAgIEFlcy5YIHRvIGF4aXNEYXRhUG9pbnRzKCkuZmlsdGVyIHsgQWVzLlggPT0gaXQuYWVzIH0ubWFwKERhdGFQb2ludDo6dmFsdWUpLm1hcChUb29sdGlwU3BlYy5MaW5lLkNvbXBhbmlvbjo6d2l0aFZhbHVlKSxcbiAgICAgICAgICAgICAgICBBZXMuWSB0byBheGlzRGF0YVBvaW50cygpLmZpbHRlciB7IEFlcy5ZID09IGl0LmFlcyB9Lm1hcChEYXRhUG9pbnQ6OnZhbHVlKS5tYXAoVG9vbHRpcFNwZWMuTGluZS5Db21wYW5pb246OndpdGhWYWx1ZSlcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIGF4aXMuZm9yRWFjaCB7IChhZXMsIGxpbmVzKSAtPlxuICAgICAgICAgICAgICAgIGlmIChsaW5lcy5pc05vdEVtcHR5KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIGxheW91dEhpbnQgPSBjcmVhdGVIaW50Rm9yQXhpcyhhZXMpXG4gICAgICAgICAgICAgICAgICAgIHRvb2x0aXBTcGVjcy5hZGQoXG4gICAgICAgICAgICAgICAgICAgICAgICBUb29sdGlwU3BlYyhcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXlvdXRIaW50ID0gbGF5b3V0SGludCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5lcyA9IGxpbmVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGwgPSBsYXlvdXRIaW50LmNvbG9yISEsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNPdXRsaWVyID0gdHJ1ZVxuICAgICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRvb2x0aXBTcGVjc1xuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZ2VuZXJhbFRvb2x0aXBTcGVjKCk6IExpc3Q8VG9vbHRpcFNwZWM+IHtcbiAgICAgICAgICAgIHZhbCBnZW5lcmFsRGF0YVBvaW50cyA9IGdlbmVyYWxEYXRhUG9pbnRzKClcbiAgICAgICAgICAgIHZhbCBnZW5lcmFsTGluZXMgPSBnZW5lcmFsRGF0YVBvaW50cy5tYXAgeyBUb29sdGlwU3BlYy5MaW5lLndpdGhMYWJlbEFuZFZhbHVlKGl0LmxhYmVsLCBpdC52YWx1ZSkgfVxuICAgICAgICAgICAgdmFsIGFlc0hpbnRDb2xvcnMgPSBoaW50Q29sb3JzKClcbiAgICAgICAgICAgICAgICAuZmlsdGVyS2V5cyB7IGFlcyAtPiBhZXMgaW4gZ2VuZXJhbERhdGFQb2ludHMubWFwIHsgaXQuYWVzIH0gfVxuICAgICAgICAgICAgdmFsIGNvbG9yRnJvbUhpbnRzID0gYWVzSGludENvbG9yc1tBZXMuWV0gPzogYWVzSGludENvbG9ycy5tYXBOb3ROdWxsIHsgaXQudmFsdWUgfS5sYXN0T3JOdWxsKClcbiAgICAgICAgICAgIHZhbCB0b29sdGlwQ29sb3IgPSB3aGVuIHtcbiAgICAgICAgICAgICAgICBteVRvb2x0aXBDb2xvciAhPSBudWxsIC0+IG15VG9vbHRpcENvbG9yXG4gICAgICAgICAgICAgICAgY29sb3JGcm9tSGludHMgIT0gbnVsbCAtPiBjb2xvckZyb21IaW50c1xuICAgICAgICAgICAgICAgIGVsc2UgLT4gdGlwTGF5b3V0SGludCgpLmNvbG9yISFcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBpZiAoZ2VuZXJhbExpbmVzLmlzTm90RW1wdHkoKSkge1xuICAgICAgICAgICAgICAgIGxpc3RPZihcbiAgICAgICAgICAgICAgICAgICAgVG9vbHRpcFNwZWMoXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXBMYXlvdXRIaW50KCksXG4gICAgICAgICAgICAgICAgICAgICAgICBsaW5lcyA9IGdlbmVyYWxMaW5lcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpbGwgPSB0b29sdGlwQ29sb3IsXG4gICAgICAgICAgICAgICAgICAgICAgICBpc091dGxpZXIgPSBmYWxzZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGFuY2hvciA9IG15VG9vbHRpcEFuY2hvcixcbiAgICAgICAgICAgICAgICAgICAgICAgIG1pbldpZHRoID0gbXlUb29sdGlwTWluV2lkdGgsXG4gICAgICAgICAgICAgICAgICAgICAgICBpc0Nyb3NzaGFpckVuYWJsZWQgPSBteUlzQ3Jvc3NoYWlyRW5hYmxlZFxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBlbXB0eUxpc3QoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gb3V0bGllckRhdGFQb2ludHMoKTogTGlzdDxEYXRhUG9pbnQ+IHtcbiAgICAgICAgICAgIHJldHVybiBteURhdGFQb2ludHMuZmlsdGVyIHsgaXQuaXNPdXRsaWVyICYmICFpdC5pc0F4aXMgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gYXhpc0RhdGFQb2ludHMoKTogTGlzdDxEYXRhUG9pbnQ+IHtcbiAgICAgICAgICAgIHJldHVybiBteURhdGFQb2ludHMuZmlsdGVyKERhdGFQb2ludDo6aXNBeGlzKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZ2VuZXJhbERhdGFQb2ludHMoKTogTGlzdDxEYXRhUG9pbnQ+IHtcbiAgICAgICAgICAgIHZhbCBub25PdXRsaWVyRGF0YVBvaW50cyA9IG15RGF0YVBvaW50cy5maWx0ZXJOb3QoRGF0YVBvaW50Ojppc091dGxpZXIpXG4gICAgICAgICAgICB2YWwgb3V0bGllcnMgPSBvdXRsaWVyRGF0YVBvaW50cygpLm1hcE5vdE51bGwoRGF0YVBvaW50OjphZXMpXG4gICAgICAgICAgICB2YWwgZ2VuZXJhbEFlc0xpc3QgPSBub25PdXRsaWVyRGF0YVBvaW50cy5tYXBOb3ROdWxsKERhdGFQb2ludDo6YWVzKSAtIG91dGxpZXJzXG4gICAgICAgICAgICByZXR1cm4gbm9uT3V0bGllckRhdGFQb2ludHMuZmlsdGVyIHsgZGF0YVBvaW50IC0+XG4gICAgICAgICAgICAgICAgd2hlbiAoZGF0YVBvaW50LmFlcyl7XG4gICAgICAgICAgICAgICAgICAgIG51bGwgLT4gdHJ1ZSAgICAgICAgICAgICAgICAvLyBnZXQgYWxsIG5vdCBhZXMgKHZhcmlhYmxlcywgdGV4dClcbiAgICAgICAgICAgICAgICAgICAgaW4gZ2VuZXJhbEFlc0xpc3QgLT4gdHJ1ZSAgIC8vIGdldCBhbGwgZXhpc3RlZCBpbiBwcmVwYXJlZCBhZXMgbGlzdCAobWFwcGVkIGFlcylcbiAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiBmYWxzZSAgICAgICAgICAgICAgIC8vIHNraXAgb3RoZXJzIChheGlzKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGNyZWF0ZUhpbnRGb3JBeGlzKGFlczogQWVzPCo+KTogVGlwTGF5b3V0SGludCB7XG4gICAgICAgICAgICByZXR1cm4gd2hlbihhZXMpIHtcbiAgICAgICAgICAgICAgICAgQWVzLlggLT4gVGlwTGF5b3V0SGludC54QXhpc1Rvb2x0aXAoXG4gICAgICAgICAgICAgICAgICAgICBjb29yZCA9IERvdWJsZVZlY3Rvcih0aXBMYXlvdXRIaW50KCkuY29vcmQhIS54LCBheGlzT3JpZ2luLnkpLFxuICAgICAgICAgICAgICAgICAgICAgY29sb3IgPSBBWElTX1RPT0xUSVBfQ09MT1IsXG4gICAgICAgICAgICAgICAgICAgICBheGlzUmFkaXVzID0gQVhJU19SQURJVVNcbiAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIEFlcy5ZIC0+IFR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gICAgICB9XG4gICAgICAgIGFkZFRhcmdldChcbiAgICAgICAgICAgIFRhcmdldFByb3RvdHlwZShcbiAgICAgICAgICAgICAgICBIaXRTaGFwZS5wb2ludChwb2ludCwgcmFkaXVzKSxcbiAgICAgICAgICAgICAgICB7IGluZGV4IH0sXG4gICAgICAgICAgICAgICAgdG9vbHRpcFBhcmFtcyxcbiAgICAgICAgICAgICAgICB0b29sdGlwS2luZFxuICAgICAgICAgICAgKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGFkZFJlY3RhbmdsZShcbiAgICAgICAgaW5kZXg6IEludCxcbiAgICAgICAgcmVjdGFuZ2xlOiBEb3VibGVSZWN0YW5nbGUsXG4gICAgICAgIHRvb2x0aXBQYXJhbXM6IEdlb21UYXJnZXRDb2xsZWN0b3IuVG9vbHRpcFBhcmFtcyxcbiAgICAgICAgdG9vbHRpcEtpbmQ6IFRpcExheW91dEhpbnQuS2luZFxuICAgICkge1xuICAgICAgICBpZiAoY29udGV4dHVhbE1hcHBpbmcuaWdub3JlSW52aXNpYmxlVGFyZ2V0cykge1xuICAgICAgICAgICAgaWYgKHJlY3RhbmdsZS53aWR0aCA9PSAwLjAgfHwgcmVjdGFuZ2xlLmhlaWdodCA9PSAwLjAgfHwgdG9vbHRpcFBhcmFtcy5nZXRDb2xvcigpLmFscGhhID09IDApIHtcbiAgICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoIWNvb3JkaW5hdGVTeXN0ZW0uaXNSZWN0SW5MaW1pdHMocmVjdGFuZ2xlKSkge1xuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cbiAgICAgICAgYWRkVGFyZ2V0KFxuICAgICAgICAgICAgVGFyZ2V0UHJvdG90eXBlKFxuICAgICAgICAgICAgICAgIEhpdFNoYXBlLnJlY3QocmVjdGFuZ2xlKSxcbiAgICAgICAgICAgICAgICB7IGluZGV4IH0sXG4gICAgICAgICAgICAgICAgdG9vbHRpcFBhcmFtcyxcbiAgICAgICAgICAgICAgICB0b29sdGlwS2luZFxuICAgICAgICAgICAgKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGFkZFBhdGgoXG4gICAgICAgIHBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+LFxuICAgICAgICBsb2NhbFRvR2xvYmFsSW5kZXg6IChJbnQpIC0+IEludCxcbiAgICAgICAgdG9vbHRpcFBhcmFtczogR2VvbVRhcmdldENvbGxlY3Rvci5Ub29sdGlwUGFyYW1zLFxuICAgICAgICB0b29sdGlwS2luZDogVGlwTGF5b3V0SGludC5LaW5kXG4gICAgKSB7XG4gICAgICAgIGlmICghY29vcmRpbmF0ZVN5c3RlbS5pc1BhdGhJbkxpbWl0cyhwb2ludHMpKSB7XG4gICAgICAgICAgICByZXR1cm5cbiAgICAgICAgfVxuICAgICAgICBhZGRUYXJnZXQoXG4gICAgICAgICAgICBUYXJnZXRQcm90b3R5cGUoXG4gICAgICAgICAgICAgICAgSGl0U2hhcGUucGF0aChwb2ludHMpLFxuICAgICAgICAgICAgICAgIGxvY2FsVG9HbG9iYWxJbmRleCxcbiAgICAgICAgICAgICAgICB0b29sdGlwUGFyYW1zLFxuICAgICAgICAgICAgICAgIHRvb2x0aXBLaW5kXG4gICAgICAgICAgICApXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gYWRkUG9seWdvbihcbiAgICAgICAgcG9pbnRzOiBMaXN0PERvdWJsZVZlY3Rvcj4sXG4gICAgICAgIGxvY2FsVG9HbG9iYWxJbmRleDogKEludCkgLT4gSW50LFxuICAgICAgICB0b29sdGlwUGFyYW1zOiBHZW9tVGFyZ2V0Q29sbGVjdG9yLlRvb2x0aXBQYXJhbXMsXG4gICAgICAgIHRvb2x0aXBLaW5kOiBUaXBMYXlvdXRIaW50LktpbmRcbiAgICApIHtcbiAgICAgICAgaWYgKCFjb29yZGluYXRlU3lzdGVtLmlzUG9seWdvbkluTGltaXRzKHBvaW50cykpIHtcbiAgICAgICAgICAgIHJldHVyblxuICAgICAgICB9XG4gICAgICAgIGFkZFRhcmdldChcbiAgICAgICAgICAgIFRhcmdldFByb3RvdHlwZShcbiAgICAgICAgICAgICAgICBIaXRTaGFwZS5wb2x5Z29uKHBvaW50cyksXG4gICAgICAgICAgICAgICAgbG9jYWxUb0dsb2JhbEluZGV4LFxuICAgICAgICAgICAgICAgIHRvb2x0aXBQYXJhbXMsXG4gICAgICAgICAgICAgICAgdG9vbHRpcEtpbmRcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGFkZFRhcmdldCh0YXJnZXRQcm90b3R5cGU6IFRhcmdldFByb3RvdHlwZSkge1xuICAgICAgICBteVRhcmdldHMuYWRkKHRhcmdldFByb3RvdHlwZSlcbiAgICAgICAgbXlMb2NhdG9yID0gbnVsbFxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBzZWFyY2goY29vcmQ6IERvdWJsZVZlY3Rvcik6IEdlb21UYXJnZXRMb2NhdG9yLkxvb2t1cFJlc3VsdD8ge1xuICAgICAgICBpZiAobXlMb2NhdG9yID09IG51bGwpIHtcbiAgICAgICAgICAgIG15TG9jYXRvciA9IExheWVyVGFyZ2V0TG9jYXRvcihcbiAgICAgICAgICAgICAgICBnZW9tS2luZCxcbiAgICAgICAgICAgICAgICBsb29rdXBTcGVjLFxuICAgICAgICAgICAgICAgIGNvbnRleHR1YWxNYXBwaW5nLFxuICAgICAgICAgICAgICAgIG15VGFyZ2V0c1xuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBteUxvY2F0b3IhIS5zZWFyY2goY29vcmQpXG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292Z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HRvUHJvamVjdGlvbihwcm90b3R5cGU6IFRhcmdldFByb3RvdHlwZSk6IFRhcmdldFByb2plY3Rpb24ge1xuICAgICAgICAgICAgcmV0dXJuIHdoZW4gKHByb3RvdHlwZS5oaXRTaGFwZS5raW5kKSB7XG4gICAgICAgICAgICAgICAgUE9JTlQgLT4gUG9pbnRUYXJnZXRQcm9qZWN0aW9uLmNyZWF0ZShcbiAgICAgICAgICAgICAgICAgICAgcHJvdG90eXBlLmhpdFNoYXBlLnBvaW50LmNlbnRlcixcbiAgICAgICAgICAgICAgICAgICAgbG9va3VwU3BlYy5sb29rdXBTcGFjZVxuICAgICAgICAgICAgICAgIClcblxuICAgICAgICAgICAgICAgIFJFQ1QgLT4gUmVjdFRhcmdldFByb2plY3Rpb24uY3JlYXRlKFxuICAgICAgICAgICAgICAgICAgICBwcm90b3R5cGUuaGl0U2hhcGUucmVjdCxcbiAgICAgICAgICAgICAgICAgICAgbG9va3VwU3BlYy5sb29rdXBTcGFjZVxuICAgICAgICAgICAgICAgIClcblxuICAgICAgICAgICAgICAgIFBPTFlHT04gLT4gUG9seWdvblRhcmdldFByb2plY3Rpb24uY3JlYXRlKFxuICAgICAgICAgICAgICAgICAgICBwcm90b3R5cGUuaGl0U2hhcGUucG9pbnRzLFxuICAgICAgICAgICAgICAgICAgICBsb29rdXBTcGVjLmxvb2t1cFNwYWNlXG4gICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICAgICAgUEFUSCAtPiBQYXRoVGFyZ2V0UHJvamVjdGlvbi5jcmVhdGUoXG4gICAgICAgICAgICAgICAgICAgIHByb3RvdHlwZS5oaXRTaGFwZS5wb2ludHMsXG4gICAgICAgICAgICAgICAgICAgIHByb3RvdHlwZS5pbmRleE1hcHBlcixcbiAgICAgICAgICAgICAgICAgICAgbG9va3VwU3BlYy5sb29rdXBTcGFjZVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZvciAocHJvdG90eXBlIGluIHRhcmdldFByb3RvdHlwZXMpIHtcbiAgICAgICAgICAgIG15VGFyZ2V0cy5hZGQoXG4gICAgICAgICAgICAgICAgVGFyZ2V0KFxuICAgICAgICAgICAgICAgICAgICB0b1Byb2plY3Rpb24ocHJvdG90eXBlKSxcbiAgICAgICAgICAgICAgICAgICAgcHJvdG90eXBlXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gYWRkTG9va3VwUmVzdWx0cyhcbiAgICAgICAgY29sbGVjdG9yOiBDb2xsZWN0b3I8R2VvbVRhcmdldD4sXG4gICAgICAgIHRhcmdldHM6IE11dGFibGVMaXN0PEdlb21UYXJnZXRMb2NhdG9yLkxvb2t1cFJlc3VsdD5cbiAgICApIHtcbiAgICAgICAgaWYgKGNvbGxlY3Rvci5zaXplKCkgPT0gMCkge1xuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cblxuICAgICAgICB0YXJnZXRzLmFkZChcbiAgICAgICAgICAgIEdlb21UYXJnZXRMb2NhdG9yLkxvb2t1cFJlc3VsdChcbiAgICAgICAgICAgICAgICBjb2xsZWN0b3IuY29sbGVjdGlvbigpLFxuICAgICAgICAgICAgICAgIC8vIERpc3RhbmNlIGNhbiBiZSBuZWdhdGl2ZSB3aGVuIGxvb2t1cCBzcGFjZSBpcyBYXG4gICAgICAgICAgICAgICAgLy8gSW4gdGhpcyBjYXNlIHVzZSAwLjAgYXMgYSBkaXN0YW5jZSAtIHdlIGhhdmUgYSBkaXJlY3QgaGl0LlxuICAgICAgICAgICAgICAgIG1heCgwLjAsIGNvbGxlY3Rvci5jbG9zZXN0UG9pbnRDaGVja2VyLmRpc3RhbmNlKSxcbiAgICAgICAgICAgICAgICBnZW9tS2luZCxcbiAgICAgICAgICAgICAgICBjb250ZXh0dWFsTWFwcGluZyxcbiAgICAgICAgICAgICAgICBjb250ZXh0dWFsTWFwcGluZy5pc0Nyb3NzaGFpckVuYWJsZWRcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBzZWFyY2goY29vcmQ6IERvdWJsZVZlY3Rvcik6IEdlb21UYXJnZXRMb2NhdG9yLkxvb2t1cFJlc3VsdD8ge1xuICAgICAgICBpZiAobXlUYXJnZXRzLmlzRW1wdHkoKSkge1xuICAgICAgICAgICAgcmV0dXJuIG51bGxcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCByZWN0Q29sbGVjdG9yID0gQ29sbGVjdG9yPEdlb21UYXJnZXQ+KFxuICAgICAgICAgICAgY29vcmQsXG4gICAgICAgICAgICBteUNvbGxlY3RpbmdTdHJhdGVneSxcbiAgICAgICAgICAgIGxvb2t1cFNwZWMubG9va3VwU3BhY2VcbiAgICAgICAgKVxuICAgICAgICB2YWwgcG9pbnRDb2xsZWN0b3IgPSBDb2xsZWN0b3I8R2VvbVRhcmdldD4oXG4gICAgICAgICAgICBjb29yZCxcbiAgICAgICAgICAgIG15Q29sbGVjdGluZ1N0cmF0ZWd5LFxuICAgICAgICAgICAgbG9va3VwU3BlYy5sb29rdXBTcGFjZVxuICAgICAgICApXG4gICAgICAgIHZhbCBwYXRoQ29sbGVjdG9yID0gQ29sbGVjdG9yPEdlb21UYXJnZXQ+KFxuICAgICAgICAgICAgY29vcmQsXG4gICAgICAgICAgICBteUNvbGxlY3RpbmdTdHJhdGVneSxcbiAgICAgICAgICAgIGxvb2t1cFNwZWMubG9va3VwU3BhY2VcbiAgICAgICAgKVxuXG4gICAgICAgIC8vIFNob3VsZCBhbHdheXMgcmVwbGFjZSBiZWNhdXNlIG9mIHBvbHlnb24gd2l0aCBob2xlcyAtIG9ubHkgdG9wIHNob3VsZCBoYXZlIHRvb2x0aXAuXG4gICAgICAgIHZhbCBwb2x5Z29uQ29sbGVjdG9yID0gQ29sbGVjdG9yPEdlb21UYXJnZXQ+KFxuICAgICAgICAgICAgY29vcmQsXG4gICA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nZXQucHJvdG90eXBlLmhpdFNoYXBlLnJlY3RcbiAgICAgICAgICAgIHZhbCB5T2Zmc2V0ID0gd2hlbiAodGFyZ2V0LnByb3RvdHlwZS50b29sdGlwS2luZCkge1xuICAgICAgICAgICAgICAgIENVUlNPUl9UT09MVElQIC0+IHJlY3QuaGVpZ2h0IC8gMi4wXG4gICAgICAgICAgICAgICAgZWxzZSAtPiAwLjBcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmVzdWx0Q29sbGVjdG9yLmNvbGxlY3QoXG4gICAgICAgICAgICAgICAgdGFyZ2V0LnByb3RvdHlwZS5jcmVhdGVHZW9tVGFyZ2V0KFxuICAgICAgICAgICAgICAgICAgICByZWN0Lm9yaWdpbi5hZGQoRG91YmxlVmVjdG9yKHJlY3Qud2lkdGggLyAyLCB5T2Zmc2V0KSksXG4gICAgICAgICAgICAgICAgICAgIGdldEtleUZvclNpbmdsZU9iamVjdEdlb21ldHJ5KHRhcmdldC5wcm90b3R5cGUpXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gcHJvY2Vzc1BvbHlnb24oY29vcmQ6IERvdWJsZVZlY3RvciwgdGFyZ2V0OiBUYXJnZXQsIHJlc3VsdENvbGxlY3RvcjogQ29sbGVjdG9yPEdlb21UYXJnZXQ+KSB7XG4gICAgICAgIGlmIChteVRhcmdldERldGVjdG9yLmNoZWNrUG9seWdvbihjb29yZCwgdGFyZ2V0LnBvbHlnb25Qcm9qZWN0aW9uLCByZXN1bHRDb2xsZWN0b3IuY2xvc2VzdFBvaW50Q2hlY2tlcikpIHtcblxuICAgICAgICAgICAgcmVzdWx0Q29sbGVjdG9yLmNvbGxlY3QoXG4gICAgICAgICAgICAgICAgdGFyZ2V0LnByb3RvdHlwZS5jcmVhdGVHZW9tVGFyZ2V0KFxuICAgICAgICAgICAgICAgICAgICBjb29yZCxcbiAgICAgICAgICAgICAgIC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3Nlc3RQb2ludENoZWNrZXIgPSBpZiAobG9va3VwU3BhY2UgPT0gR2VvbVRhcmdldExvY2F0b3IuTG9va3VwU3BhY2UuWCkge1xuICAgICAgICAgICAgQ2xvc2VzdFBvaW50Q2hlY2tlcihEb3VibGVWZWN0b3IoY3Vyc29yLngsIDAuMCkpXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBDbG9zZXN0UG9pbnRDaGVja2VyKGN1cnNvcilcbiAgICAgICAgfVxuICAgICAgICBwcml2YXRlIHZhciBteUxhc3RBZGRlZERpc3RhbmNlOiBEb3VibGUgPSAtMS4wXG5cbiAgICAgICAgZnVuIGNvbGxlY3QoZGF0YTogVCkge1xuICAgICAgICAgICAgd2hlbiAobXlTdHJhdGVneSkge1xuICAgICAgICAgICAgICAgIENvbGxlY3RpbmdTdHJhdGVneS5BUFBFTkQgLT4gYWRkKGRhdGEpXG4gICAgICAgICAgICAgICAgQ29sbGVjdGluZ1N0cmF0ZWd5LlJFUExBQ0UgLT4gcmVwbGFjZShkYXRhKVxuICAgICAgICAgICAgICAgIENvbGxlY3RpbmdTdHJhdGVneS5BUFBFTkRfSUZfRVFVQUwgLT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAobXlMYXN0QWRkZWREaXN0YW5jZSA9PSBjbG9zZXN0UG9pbnRDaGVja2VyLmRpc3RhbmNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBhZGQoZGF0YSlcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcGxhY2UoZGF0YSlcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBDb2xsZWN0aW5nU3RyYXRlZ3kuSUdOT1JFIC0+IHJldHVyblxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGNvbGxlY3Rpb24oKTogTGlzdDxUPiB7XG4gICAgICAgICAgICByZ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ge1xuICAgICAgICAgICAgbXlQaWNrZWQuaXNFbXB0eSgpIHx8IG15TWluRGlzdGFuY2UgPiBkaXN0YW5jZSAtPiB7XG4gICAgICAgICAgICAgICAgbXlQaWNrZWQuY2xlYXIoKVxuICAgICAgICAgICAgICAgIG15UGlja2VkLmFkZChsb29rdXBSZXN1bHQpXG4gICAgICAgICAgICAgICAgbXlNaW5EaXN0YW5jZSA9IGRpc3RhbmNlXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBteU1pbkRpc3RhbmNlID09IGRpc3RhbmNlICYmIGlzU2FtZVVuaXZhcmlhdGVHZW9tKG15UGlja2VkWzBdLCBsb29rdXBSZXN1bHQpIC0+IHtcbiAgICAgICAgICAgICAgICBteVBpY2tlZC5hZGQobG9va3VwUmVzdWx0KVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbXlNaW5EaXN0YW5jZSA9PSBkaXN0YW5jZSAtPiB7XG4gICAgICAgICAgICAgICAgbXlQaWNrZWQuY2xlYXIoKVxuICAgICAgICAgICAgICAgIG15UGlja2VkLmFkZChsb29rdXBSZXN1bHQpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgbXlBbGxMb29rdXBSZXN1bHRzLmFkZChsb29rdXBSZXN1bHQpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gY2hvb3NlQmVzdFJlc3VsdCgpOiBMaXN0PExvb2t1cFJlc3VsdD4ge1xuICAgICAgICBmdW4gaGFzR2VuZXJhbFRvb2x0aXAobG9va3VwUmVzdWx0OiBMb29rdXBSZXN1bHQpID0gbG9va3VwUmVzdWx0LmNvbnRleHR1YWxNYXBwaW5nLmhhc0dlbmVyYWxUb29sdGlwXG4gICAgICAgIGZ1biBoYXNBeGlzVG9vbHRpcChsb29rdXBSZXN1bHQ6IExvb2t1cFJlc3VsdCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIGxvb2t1cFJlc3VsdC5jb250ZXh0dWFsTWFwcGluZy5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xsKHdpdGhHZW5lcmFsVG9vbHRpcCwgd2l0aEF4aXNUb29sdGlwKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGludGVybmFsIGNvbnN0IHZhbCBDVVRPRkZfRElTVEFOQ0UgPSAzMC4wXG4gICAgICAgIGludGVybmFsIGNvbnN0IHZhbCBGQUtFX0RJU1RBTkNFID0gMTUuMFxuICAgICAgICBwcml2YXRlIHZhbCBVTklWQVJJQVRFX0dFT01TID0gbGlzdE9mKFxuICAgICAgICAgICAgR2VvbUtpbmQuREVOU0lUWSxcbiAgICAgICAgICAgIEdlb21LaW5kLkZSRVFQT0xZLFxuICAgICAgICAgICAgR2VvbUtpbmQuQk9YX1BMT1QsXG4gICAgICAgICAgICBHZW9tS2luZC5ISVNUT0dSQU0sXG4gICAgICAgICAgICBHZW9tS2luZC5MSU5FLFxuICAgICAgICAgICAgR2VvbUtpbmQuQVJFQSxcbiAgICAgICAgICAgIEdlb21LaW5kLkJBUixcbiAgICAgICAgICAgIEdlb21LaW5kLkVSUk9SX0JBUixcbiAgICAgICAgICAgIEdlb21LaW5kLkNST1NTX0JBUixcbiAgICAgICAgICAgIEdlb21LaW5kLkxJTkVfUkFOR0UsXG4gICAgICAgICAgICBHZW9tS2luZC5QT0lOVF9SQU5HRVxuICAgICAgICApXG5cbiAgICAgICAgcHJpdmF0ZSB2YWwgVU5JVkFSSUFURV9MSU5FUyA9IGxpc3RPZihcbiAgICAgICAgICAgIEdlb21LaW5kLkRFTlNJVFksXG4gICAgICAgICAgICBHZW9tS2luZC5GUkVRUE9MWSxcbiAgICAgICAgICAgIEdlb21LaW5kLkxJTkUsXG4gICAgICAgICAgICBHZW9tS2luZC5BUkVBLFxuICAgICAgICAgICAgR2VvbUtpbmQuU0VHTUVOVFxuICAgICAgICApXG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZGlzdGFuY2UobG9jYXRlZFRhcmdld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gICAgICAgICAgICAgICAgICAgICAgICAubWluT3JOdWxsKClcbiAgICAgICAgICAgICAgICAgICAgICAgID86IEZBS0VfRElTVEFOQ0VcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGRpc3RhbmNlXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBpc1NhbWVVbml2YXJpYXRlR2VvbShsZnQ6IExvb2t1cFJlc3VsdCwgcmd0OiBMb29rdXBSZXN1bHQpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBsZnQuZ2VvbUtpbmQgPT09IHJndC5nZW9tS2luZCAmJiBVTklWQVJJQVRFX0dFT01TLmNvbnRhaW5zKHJndC5nZW9tS2luZClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGZpbHRlclJlc3VsdHMobG9va3VwUmVzdWx0OiBMb29rdXBSZXN1bHQsIGNvb3JkOiBEb3VibGVWZWN0b3I/KTogTG9va3VwUmVzdWx0IHtcbiAgICAgICAgICAgIGlmIChjb29yZCA9PSBudWxsIHx8IGxvb2t1cFJlc3VsdC5nZW9tS2luZCAhaW4gVU5JVkFSSUFURV9MSU5FUykge1xuICAgICAgICAgICAgICAgIHJldHVybiBsb29rdXBSZXN1bHRcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gR2V0IGNsb3Nlc3QgdGFyZ2V0cyBhbmQgcmVtb3ZlIGR1cGxpY2F0ZXNcbiAgICAgICAgICAgIHZhbCBnZW9tVGFyZ2V0cyA9IGxvb2t1cFJlc3VsdC50YXJnZXRzLmZpbHRlciB7IGl0LnRpcExheW91dEhpbnQuY29vcmQgIT0gbnVsbCB9XG5cbiAgICAgICAgICAgIHZhbCBtaW5YVG9UYXJnZXQgPSBnZW9tVGFyZ2V0c1xuICAgICAgICAgICAgICAgIC5tYXAgeyB0YXJnZXQgLT4gdGFyZ2V0LnRpcExheW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29vcmQ6IERvdWJsZVZlY3RvciwgcGF0aFByb2plY3Rpb246IFBhdGhUYXJnZXRQcm9qZWN0aW9uLCBjbG9zZXN0UG9pbnRDaGVja2VyOiBDbG9zZXN0UG9pbnRDaGVja2VyKTogUGF0aFBvaW50PyB7XG5cbiAgICAgICAgd2hlbiAobG9jYXRvckxvb2t1cFNwYWNlKSB7XG5cbiAgICAgICAgICAgIExvb2t1cFNwYWNlLlggLT4ge1xuICAgICAgICAgICAgICAgIGlmIChsb2NhdG9yTG9va3VwU3RyYXRlZ3kgPT09IExvb2t1cFN0cmF0ZWd5Lk5PTkUpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGxcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB2YWwgcGF0aFBvaW50cyA9IHBhdGhQcm9qZWN0aW9uLnBvaW50c1xuICAgICAgICAgICAgICAgIGlmIChwYXRoUG9pbnRzLmlzRW1wdHkoKSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbFxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHZhbCByZXN1bHRJbmRleCA9IGJpbmFyeVNlYXJjaChcbiAgICAgICAgICAgICAgICAgICAgY3Vyc29yQ29vcmQueCxcbiAgICAgICAgICAgICAgICAgICAgcGF0aFBvaW50cy5zaXplXG4gICAgICAgICAgICAgICAgKSB7IGluZGV4IC0+XG4gICAgICAgICAgICAgICAgICAgIHBhdGhQb2ludHNbaW5kZXhdLnByb2plY3Rpb24oKS54KClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdmFsIGJlc3RQb2ludCA9IHBhdGhQb2ludHNbcmVzdWx0SW5kZXhdXG5cbiAgICAgICAgICAgICAgICByZXR1cm4gd2hlbiAobG9jYXRvckxvb2t1cFN0cmF0ZWd5KSB7XG4gICAgICAgICAgICAgICAgICAgIExvb2t1cFN0cmF0ZWd5LkhPVkVSIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJzb3JDb29yZC54IDwgcGF0aFBvaW50c1swXS5wcm9qZWN0aW9uKCkueCgpIHx8IGN1cnNvckNvb3JkLnggPiBwYXRoUG9pbnRzW3BhdGhQb2ludHMuc2l6ZSAtIDFdLnByb2plY3Rpb24oKS54KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgYmVzdFBvaW50XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBMb29rdXBTdHJhdGVneS5ORUFSRVNUIC0+IGJlc3RQb2ludFxuXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKFwiVW5rbm93biBsb29rdXAgc3RyYXRlZ3k6ICRsb2NhdG9yTG9va3VwU3RyYXRlZ3lcIilcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIExvb2t1cFNwYWNlLlhZIC0+IHtcbiAgICAgICAgICAgICAgICB3aGVuIChsb2NhdG9yTG9va3VwU3RyYXRlZ3kpIHtcblxuICAgICAgICAgICAgICAgICAgICBMb29rdXBTdHJhdGVneS5IT1ZFUiAtPiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHBhdGhQb2ludCBpbiBwYXRoUHJvamVjdGlvbi5wb2ludHMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWwgdGFyZ2V0UG9pbnRDb29yZCA9IHBhdGhQb2ludC5wcm9qZWN0aW9uKCkueHkoKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNYXRoVXRpbC5hcmVFcXVhbCh0YXJnZXRQb2ludENvb3JkLCBjdXJzb3JDb29yZCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBPSU5UX0FSRUFfRVBTSUxPTlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwYXRoUG9pbnRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbFxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgTG9va3VwU3RyYXRlZ3kuTkVBUkVTVCAtPiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgbmVhcmVzdFBvaW50OiBQYXRoUG9pbnQ/ID0gbnVsbFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChwYXRoUG9pbnQgaW4gcGF0aFByb2plY3Rpb24ucG9pbnRzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHRhcmdldFBvaW50Q29vcmQgPSBwYXRoUG9pbnQucHJvamVjdGlvbigpLnh5KClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2xvc2VzdFBvaW50Q2hlY2tlci5jaGVjayh0YXJnZXRQb2ludENvb3JkKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZWFyZXN0UG9pbnQgPSBwYXRoUG9pbnRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmVhcmVzdFBvaW50XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBMb29rdXBTdHJhdGVneS5OT05FIC0+IHJldHVybiBudWxsXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBMb29rdXBTcGFjZS5OT05FIC0+IHJldHVybiBudWxsXG5cbiAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1biBjaGVja1BvaW50KGN1cnNvckNvb3JkOiBEb3VibGVWZWN0b3IsIHBvaW50UHJvamVjdGlvbjogUG9pbnRUYXJnZXRQcm9qZWN0aW9uLCBjbG9zZXN0UG9pbnRDaGVja2VyOiBDbG9zZXN0UG9pbnRDaGVja2VyKTogQm9vbGVhbiB7XG4gICAgICAgIHdoZW4gKGxvY2F0b3JMb29rdXBTcGFjZSkge1xuXG4gICAgICAgICAgICBMb29rdXBTcGFjZS5YIC0+IHtcbiAgICAgICAgICAgICAgICB2YWwgeCA9IHBvaW50UHJvamVjdGlvbi54KClcbiAgICAgICAgICAgICAgICByZXR1cm4gd2hlbiAobG9jYXRvckxvb2t1cFN0cmF0ZWd5KSB7XG4gICAgICAgICAgICAgICAgICAgIExvb2t1cFN0cmF0ZWd5LkhPVkVSIC0+IE1hdGhVdGlsLmFyZUVxdWFsKHgsIGN1cnNvckNvb3JkLngsXG4gICAgICAgICAgICAgICAgICAgICAgICBQT0lOVF9BUkVBX0VQU0lMT05cbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICBMb29rdXBTdHJhdGVneS5ORUFSRVNUIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsb3Nlc3RQb2ludENoZWNrZXIuY2hlY2soRG91YmxlVmVjdG9yKHgsIDAuMCkpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgTG9va3VwU3RyYXRlZ3kuTk9ORSAtPiBmYWxzZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgTG9va3VwU3BhY2UuWFkgLT4ge1xuICAgICAgICAgICAgICAgIHZhbCB0YXJnZXRQb2ludENvb3JkID0gcG9pbnRQcm9qZWN0aW9uLnh5KClcbiAgICAgICAgICAgICAgICByZXR1cm4gd2hlbiAobG9jYXRvckxvb2t1cFN0cmF0ZWd5KSB7XG4gIC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gICAgICAgICAgICAgICAgd2hlbiAobG9jYXRvckxvb2t1cFN0cmF0ZWd5KSB7XG5cbiAgICAgICAgICAgICAgICAgICAgTG9va3VwU3RyYXRlZ3kuSE9WRVIgLT4gcmV0dXJuIHJlY3QuY29udGFpbnMoY3Vyc29yQ29vcmQpXG5cbiAgICAgICAgICAgICAgICAgICAgTG9va3VwU3RyYXRlZ3kuTkVBUkVTVCAtPiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVjdC5jb250YWlucyhjdXJzb3JDb29yZCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2xvc2VzdFBvaW50Q2hlY2tlci5jaGVjayhjdXJzb3JDb29yZClcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHggPSBpZiAoY3Vyc29yQ29vcmQueCA8IHJlY3QubGVmdCkgcmVjdC5sZWZ0IGVsc2UgcmVjdC5yaWdodFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHkgPSBpZiAoY3Vyc29yQ29vcmQueSA8IHJlY3QudG9wKSByZWN0LnRvcCBlbHNlIHJlY3QuYm90dG9tXG5cbiAgICAgICAgICAgICAgICAgICAgICAgIHggPSBpZiAocmVjdC54UmFuZ2UoKS5jb250YWlucyhjdXJzb3JDb29yZC54KSkgY3Vyc29yQ29vcmQueCBlbHNlIHhcbiAgICAgICAgICAgICAgICAgICAgICAgIHkgPSBpZiAocmVjdC55UmFuZ2UoKS5jb250YWlucyhjdXJzb3JDb29yZC55KSkgY3Vyc29yQ29vcmQueSBlbHNlIHlcblxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNsb3Nlc3RQb2ludENoZWNrZXIuY2hlY2soRG91YmxlVmVjdG9yKHgsIHkpKVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgTG9va3VwU3RyYXRlZ3kuTk9ORSAtPiByZXR1cm4gZmFsc2VcblxuICAgICAgICAgICAgICAgICAgICBlbHNlIC0+IHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBMb29rdXBTcGFjZS5OT05FIC0+IHJldHVybiBmYWxzZVxuXG4gICAgICAgICAgICBlbHNlIC0+IHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gY2hlY2tQb2x5Z29uKGN1cnNvckNvb3JkOiBEb3VibGVWZWN0b3IsIHBvbHlnb25Qcm9qZWN0aW9uOiBQb2x5Z29uVGFyZ2V0UHJvamVjdGlvbiwgY2xvc2VzdFBvaW50Q2hlY2tlcjogQ2xvc2VzdFBvaW50Q2hlY2tlcik6IEJvb2xlYW4ge1xuICAgICAgICB3aGVuIChsb2NhdG9yTG9va3VwU3BhY2UpIHtcblxuICAgICAgICAgICAgTG9va3VwU3BhY2UuWCAtPiB7XG4gICAgICAgICAgICAgICAgdmFsIHJhbmdlID0gcG9seWdvblByb2plY3Rpb24ueCgpXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJhbmdlQmFzZWRMb29rdXAoY3Vyc29yQ29vcmQsIGNsb3Nlc3RQb2ludENoZWNrZXIsIHJhbmdlKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBMb29rdXBTcGFjZS5YWSAtPiB7XG4gICAgICAgICAgICAgICAgdmFsIHBvbHlnb24gPSBwb2x5Z29uUHJvamVjdGlvbi54eSgpXG4gICAgICAgICAgICAgICAgd2hlbiAobG9jYXRvckxvb2t1cFN0cmF0ZWd5KSB7XG5cbiAgICAgICAgICAgICAgICAgICAgTG9va3VwU3RyYXRlZ3kuSE9WRVIsIExvb2t1cFN0cmF0ZWd5Lk5FQVJFU1QgLT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gRG9lc24ndCBzdXBwb3J0IG5lYXJlc3Qgc3RyYXRlZ3kuIFRhcmdldCBjYW4gYmUgZm91bmQgb25seSBieSBob3ZlcmluZyBhIGN1cnNvciBhYm92ZSB0aGUgcG9seWdvbi5cbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjb3VudGVyID0gMFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyaW5nIGluIHBvbHlnb24pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmluZy5iYm94LmNvbnRhaW5zKGN1cnNvckNvb3JkKSAmJiBNYXRoVXRpbC5wb2x5Z29uQ29udGFpbnNDb29yZGluYXRlKHJpbmcuZWRnZXMsIGN1cnNvckNvb3JkKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3VudGVyKytcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY291bnRlciAlIDIgIT0gMFxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgTG9va3VwU3RyYXRlZ3kuTk9ORSAtPiByZXR1cm4gZmFsc2VcblxuICAgICAgICAgICAgICAgICAgICBlbHNlIC0+IHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBMb29rdXBTcGFjZS5OT05FIC0+IHJldHVybiBmYWxzZVxuXG4gICAgICAgICAgICBlbHNlIC0+IHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biByYW5nZUJhc2VkTG9va3VwKGN1cnNvckNvb3JkOiBEb3VibGVWZWN0b3IsIGNsb3Nlc3RQb2ludENoZWNrZXI6IENsb3Nlc3RQb2ludENoZWNrZXIsIHJhbmdlOiBEb3VibGVSYW5nZSk6IEJvb2xlYW4ge1xu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VBTSUxPTiA9IDIuMFxuXG4gICAgICAgIHByaXZhdGUgZnVuIGJpbmFyeVNlYXJjaCh2YWx1ZTogRG91YmxlLCBsZW5ndGg6IEludCwgaW5kZXhlcjogKEludCkgLT4gRG91YmxlKTogSW50IHtcblxuICAgICAgICAgICAgaWYgKHZhbHVlIDwgaW5kZXhlcigwKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiAwXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodmFsdWUgPiBpbmRleGVyKGxlbmd0aCAtIDEpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGxlbmd0aCAtIDFcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIGxvID0gMFxuICAgICAgICAgICAgdmFyIGhpID0gbGVuZ3RoIC0gMVxuXG4gICAgICAgICAgICB3aGlsZSAobG8gPD0gaGkpIHtcbiAgICAgICAgICAgICAgICB2YWwgbWlkID0gKGhpICsgbG8pIC8gMlxuICAgICAgICAgICAgICAgIHZhbCBtaWRWYWx1ZSA9IGluZGV4ZXIobWlkKVxuXG4gICAgICAgICAgICAgICAgd2hlbiB7XG4gICAgICAgICAgICAgICAgICAgIHZhbHVlIDwgbWlkVmFsdWUgLT4gaGkgPSBtaWQgLSAxXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlID4gbWlkVmFsdWUgLT4gbG8gPSBtaWQgKyAxXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgLT4gcmV0dXJuIG1pZFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIGlmIChpbmRleGVyKGxvKSAtIHZhbHVlIDwgdmFsdWUgLSBpbmRleGVyKGhpKSkge1xuICAgICAgICAgICAgICAgIGxvXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGhpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKS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gICAgcHJpdmF0ZSBjb25zdCB2YWwgUE9JTlRTX0NPVU5UX1RPX1NLSVBfU0lNUExJRklDQVRJT04gPSAyMC4wXG4gICAgICAgIHByaXZhdGUgY29uc3QgdmFsIEFSRUFfVE9MRVJBTkNFX1JBVElPID0gMC4xXG4gICAgICAgIHByaXZhdGUgY29uc3QgdmFsIE1BWF9UT0xFUkFOQ0UgPSA0MC4wXG5cbiAgICAgICAgZnVuIGNyZWF0ZShwb2ludHM6IExpc3Q8RG91YmxlVmVjdG9yPiwgbG9va3VwU3BhY2U6IExvb2t1cFNwYWNlKTogUG9seWdvblRhcmdldFByb2plY3Rpb24ge1xuICAgICAgICAgICAgdmFsIHJpbmdzID0gc3BsaXRSaW5ncyhwb2ludHMpXG5cbiAgICAgICAgICAgIHJldHVybiB3aGVuIChsb29rdXBTcGFjZSkge1xuICAgICAgICAgICAgICAgIFggLT4gUG9seWdvblRhcmdldFByb2plY3Rpb24obWFwVG9YKHJpbmdzKSlcbiAgICAgICAgICAgICAgICBYWSAtPiBQb2x5Z29uVGFyZ2V0UHJvamVjdGlvbihtYXBUb1hZKHJpbmdzKSlcbiAgICAgICAgICAgICAgICBOT05FIC0+IHVuZGVmaW5lZExvb2t1cFNwYWNlRXJyb3IoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gbWFwVG9YKHJpbmdzOiBMaXN0PExpc3Q8RG91YmxlVmVjdG9yPj4pOiBEb3VibGVSYW5nZSB7XG4gICAgICAgICAgICB2YXIgbWluID0gcmluZ3NbMF1bMF0ueFxuICAgICAgICAgICAgdmFyIG1heCA9IG1pblxuICAgICAgICAgICAgZm9yIChyaW5nIGluIHJpbmdzKSB7XG4gICAgICAgICAgICAgICAgZm9yIChwb2ludCBpbiByaW5nKSB7XG4gICAgICAgICAgICAgICAgICAgIG1pbiA9IG1pbihtaW4sIHBvaW50LngpXG4gICAgICAgICAgICAgICAgICAgIG1heCA9IG1heChtYXgsIHBvaW50LngpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIERvdWJsZVJhbmdlLndpdGhTdGFydEFuZEVuZChtaW4sIG1heClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIG1hcFRvWFkocmluZ3M6IExpc3Q8TGlzdDxEb3VibGVWZWN0b3I+Pik6IExpc3Q8UmluZ1hZPiB7XG4gICAgICAgICAgICB2YWwgcG9seWdvbiA9IEFycmF5TGlzdDxSaW5nWFk+KClcblxuICAgICAgICAgICAgZm9yIChyaW5nIGluIHJpbmdzKSB7XG4gICAgICAgICAgICAgICAgaWYgKHJpbmcuc2l6ZSA8IDQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgICAgICB9XG5cblxuICAgICAgICAgICAgICAgIHZhbCBiYm94ID0gYm91bmRpbmdCb3gocmluZylcbiAgICAgICAgICAgICAgICB2YWwgYXJlYSA9IGNhbGN1bGF0ZUFyZWEocmluZylcblxuICAgICAgICAgICAgICAgIHZhbCBzaW1wbGlmaWVkUmluZzogTGlzdDxEb3VibGVWZWN0b3I+XG5cbiAgICAgICAgICAgICAgICBpZiAocmluZy5zaXplID4gUE9JTlRTX0NPVU5UX1RPX1NLSVBfU0lNUExJRklDQVRJT04pIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHRvbGVyYW5jZSA9IG1pbihhcmVhICogQVJFQV9UT0xFUkFOQ0VfUkFUSU8sIE1BWF9UT0xFUkFOQ0UpXG4gICAgICAgICAgICAgICAgICAgIHNpbXBsaWZpZWRSaW5nID0gUG9seWxpbmVTaW1wbGlmaWVyLnZpc3ZhbGluZ2FtV2h5YXR0KHJpbmcpLnNldFdlaWdodExpbWl0KHRvbGVyYW5jZSkucG9pbnRzXG5cbiAgICAgICAgICAgICAgICAgICAgQFN1cHByZXNzKFwiQ29uc3RhbnRDb25kaXRpb25JZlwiKVxuICAgICAgICAgICAgICAgICAgICBpZiAoaXNMb2dFbmFibGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2coXCJTaW1wOiBcIiArIHJpbmcuc2l6ZSArIFwiIC0+IFwiICsgc2ltcGxpZmllZFJpbmcuc2l6ZSArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiLCB0b2xlcmFuY2U9XCIgKyB0b2xlcmFuY2UgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiwgYmJveD1cIiArIGJib3ggK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiwgYXJlYT1cIiArIGFyZWFcbiAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIEBTdXBwcmVzcyhcIkNvbnN0YW50Q29uZGl0aW9uSWZcIilcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzTG9nRW5hYmxlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9nKFwiS2VlcDogc2l6ZTogXCIgKyByaW5nLnNpemUgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiwgYmJveD1cIiArIGJib3ggK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiwgYXJlYT1cIiArIGFyZWFcbiAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBzaW1wbGlmaWVkUmluZyA9IHJpbmdcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoc2ltcGxpZmllZFJpbmcuc2l6ZSA8IDQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBwb2x5Z29uLmFkZChSaW5nWFkoc2ltcGxpZmllZFJpbmcsIGJib3gpKVxuICAgICAgICAgIC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ICAgICAgICAgIHJldHVybiB3aGVuIChsb29rdXBTcGFjZSkge1xuICAgICAgICAgICAgICAgICAgICBYIC0+IFBhdGhQb2ludChQb2ludFRhcmdldFByb2plY3Rpb24uY3JlYXRlKHAsIGxvb2t1cFNwYWNlKSwgcCwgaW5kZXgpXG4gICAgICAgICAgICAgICAgICAgIFhZIC0+IFBhdGhQb2ludChQb2ludFRhcmdldFByb2plY3Rpb24uY3JlYXRlKHAsIGxvb2t1cFNwYWNlKSwgcCwgaW5kZXgpXG4gICAgICAgICAgICAgICAgICAgIE5PTkUgLT4gdW5kZWZpbmVkTG9va3VwU3BhY2VFcnJvcigpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGZ1biBjcmVhdGUocG9pbnRzOiBMaXN0PERvdWJsZVZlY3Rvcj4sIGluZGV4TWFwcGVyOiAoSW50KSAtPiBJbnQsIGxvb2t1cFNwYWNlOiBMb29rdXBTcGFjZSk6IFBhdGhUYXJnZXRQcm9qZWN0aW9uIHtcbiAgICAgICAgICAgIHZhbCBwb2ludHNMb2NhdGlvbiA9IEFycmF5TGlzdDxQYXRoUG9pbnQ+KClcbiAgICAgICAgICAgIGZvciAoKGksIHBvaW50KSBpbiBwb2ludHMud2l0aEluZGV4KCkpIHtcbiAgICAgICAgICAgICAgICBwb2ludHNMb2NhdGlvbi5hZGQoUGF0aFBvaW50LmNyZWF0ZShwb2ludCwgaW5kZXhNYXBwZXIoaSksIGxvb2t1cFNwYWNlKSlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIFBhdGhUYXJnZXRQcm9qZWN0aW9uKHBvaW50c0xvY2F0aW9uKVxuICAgICAgICB9XG4gICAgfVxufVxuXG5wcml2YXRlIGZ1biB1bmRlZmluZWRMb29rdXBTcGFjZUVycm9yKCk6IE5vdGhpbmcge1xuICAgIHRocm93IElsbGVnY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dGlwS2luZCkge1xuICAgICAgICAgICAgICAgICAgICBWRVJUSUNBTF9UT09MVElQIC0+IFRpcExheW91dEhpbnQudmVydGljYWxUb29sdGlwKGhpdENvb3JkLCBoaXRTaGFwZS5wb2ludC5yYWRpdXMsIGZpbGwsIHN0ZW1MZW5ndGgpXG4gICAgICAgICAgICAgICAgICAgIENVUlNPUl9UT09MVElQIC0+IFRpcExheW91dEhpbnQuY3Vyc29yVG9vbHRpcChoaXRDb29yZCwgZmlsbCwgc3RlbUxlbmd0aClcbiAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiBlcnJvcihcIldyb25nIFRpcExheW91dEhpbnQua2luZCA9ICR0b29sdGlwS2luZCBmb3IgUE9JTlRcIilcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBSRUNUIC0+IHdoZW4gKHRvb2x0aXBLaW5kKSB7XG4gICAgICAgICAgICAgICAgICAgIFZFUlRJQ0FMX1RPT0xUSVAgLT4gVGlwTGF5b3V0SGludC52ZXJ0aWNhbFRvb2x0aXAoaGl0Q29vcmQsIDAuMCwgZmlsbCwgc3RlbUxlbmd0aClcbiAgICAgICAgICAgICAgICAgICAgSE9SSVpPTlRBTF9UT09MVElQIC0+IFRpcExheW91dEhpbnQuaG9yaXpvbnRhbFRvb2x0aXAoaGl0Q29vcmQsIGhpdFNoYXBlLnJlY3Qud2lkdGggLyAyLCBmaWxsLCBzdGVtTGVuZ3RoKVxuICAgICAgICAgICAgICAgICAgICBDVVJTT1JfVE9PTFRJUCAtPiBUaXBMYXlvdXRIaW50LmN1cnNvclRvb2x0aXAoaGl0Q29vcmQsIGZpbGwsIHN0ZW1MZW5ndGgpXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgLT4gZXJyb3IoXCJXcm9uZyBUaXBMYXlvdXRIaW50LmtpbmQgPSAkdG9vbHRpcEtpbmQgZm9yIFJFQ1RcIilcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBQQVRIIC0+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Z2V0cyhsb29rdXBSZXN1bHQudGFyZ2V0cyksXG4gICAgICAgICAgICAgICAgY29udmVydFRvUGxvdERpc3RhbmNlKGxvb2t1cFJlc3VsdC5kaXN0YW5jZSksXG4gICAgICAgICAgICAgICAgbG9va3VwUmVzdWx0Lmdlb21LaW5kLFxuICAgICAgICAgICAgICAgIGxvb2t1cFJlc3VsdC5jb250ZXh0dWFsTWFwcGluZyxcbiAgICAgICAgICAgICAgICBsb29rdXBSZXN1bHQuY29udGV4dHVhbE1hcHBpbmcuaXNDcm9zc2hhaXJFbmFibGVkXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjb252ZXJ0R2VvbVRhcmdldHMoZ2VvbVRhcmdldHM6IExpc3Q8R2VvbVRhcmdldD4pOiBMaXN0PEdlb21UYXJnZXQ+IHtcbiAgICAgICAgcmV0dXJuIEFycmF5TGlzdChMaXN0cy50cmFuc2Zvcm0oZ2VvbVRhcmdldHMpIHsgZ2VvbVRhcmdldCAtPlxuICAgICAgICAgICAgR2VvbVRhcmdldChcbiAgICAgICAgICAgICAgICBnZW9tVGFyZ2V0LmhpdEluZGV4LFxuICAgICAgICAgICAgICAgIGNvbnZlcnRUaXBMYXlvdXRIaW50KGdlb21UYXJnZXQudGlwTGF5b3V0SGludCksXG4gICAgICAgICAgICAgICAgY29udmVydFRpcExheW91dEhpbnRzKGdlb21UYXJnZXQuYWVzVGlwTGF5b3V0SGludHMpXG4gICAgICAgICAgICApXG4gICAgICAgIH0pXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gY29udmVydFRpcExheW91dEhpbnQoaGludDogVGlwTGF5b3V0SGludCk6IFRpcExheW91dEhpbnQge1xuICAgICAgICByZXR1cm4gVGlwTGF5b3V0SGludChcbiAgICAgICAgICAgIGhpbnQua2luZCxcbiAgICAgICAgICAgIHNhZmVDb252ZXJ0VG9QbG90Q29vcmQoaGludC5jb29yZCkhISxcbiAgICAgICAgICAgIGNvbnZlcnRUb1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YWJlbFZlcnRpY2FsQW5jaG9yOiBUZXh0TGFiZWwuVmVydGljYWxBbmNob3I/ID0gbnVsbFxuICAgICAgICB2YXIgbXlUaWNrTGFiZWxSb3RhdGlvbkFuZ2xlID0gMC4wXG4gICAgICAgIHZhciBteVRpY2tMYWJlbHNCb3VuZHM6IERvdWJsZVJlY3RhbmdsZT8gPSBudWxsXG4gICAgICAgIHZhciBteUF4aXNCcmVha3M6IEd1aWRlQnJlYWtzPyA9IG51bGxcblxuICAgICAgICBmdW4gYnVpbGQoKTogQXhpc0xheW91dEluZm8ge1xuICAgICAgICAgICAgcmV0dXJuIEF4aXNMYXlvdXRJbmZvKHRoaXMpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYXhpc0xlbmd0aChkOiBEb3VibGUpOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIG15QXhpc0xlbmd0aCA9IGRcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gb3JpZW50YXRpb24obzogamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5ndWlkZS5PcmllbnRhdGlvbik6IEJ1aWxkZXIge1xuICAgICAgICAgICAgbXlPcmllbnRhdGlvbiA9IG9cbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYXhpc0RvbWFpbihyOiBDbG9zZWRSYW5nZTxEb3VibGU+KTogQnVpbGRlciB7XG4gICAgICAgICAgICBteUF4aXNEb21haW4gPSByXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHRpY2tMYWJlbHNCb3VuZHNNYXgocjogRG91YmxlUmVjdGFuZ2xlPyk6IEJ1aWxkZXIge1xuICAgICAgICAgICAgbXlNYXhUaWNrTGFiZWxzQm91bmRzID0gclxuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB0aWNr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WwgYnJlYWtzID0gR3VpZGVCcmVha3MoXG4gICAgICAgICAgICBlbXB0eUxpc3Q8QW55PigpLFxuICAgICAgICAgICAgZW1wdHlMaXN0KCksXG4gICAgICAgICAgICBlbXB0eUxpc3QoKVxuICAgICAgICApXG5cbiAgICAgICAgdmFsIGJ1aWxkZXIgPSBBeGlzTGF5b3V0SW5mby5CdWlsZGVyKClcbiAgICAgICAgICAgICAgICAuYXhpc0JyZWFrcyhicmVha3MpXG4gICAgICAgICAgICAgICAgLmF4aXNMZW5ndGgoYXhpc0xlbmd0aClcbiAgICAgICAgICAgICAgICAub3JpZW50YXRpb24obXlPcmllbnRhdGlvbilcbiAgICAgICAgICAgICAgICAuYXhpc0RvbWFpbihteUF4aXNEb21haW4pXG4gICAgICAgICAgICAgICAgLnRpY2tMYWJlbHNCb3VuZHModGlja0xhYmVsc0JvdW5kcylcblxuICAgICAgICByZXR1cm4gYnVpbGRlci5idWlsZCgpXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGZ1biBib3R0b20oeERvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgeURvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPik6IEF4aXNMYXlvdXQge1xuICAgICAgICAgICAgcmV0dXJuIEVtcHR5QXhpc0xheW91dChcbiAgICAgICAgICAgICAgICB4RG9tYWluLFxuICAgICAgICAgICAgICAgIHlEb21haW4sXG4gICAgICAgICAgICAgICAgamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5ndWlkZS5PcmllbnRhdGlvbi5CT1RUT01cbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBsZWZ0KHhEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sIHlEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4pOiBBeGlzTGF5b3V0IHtcbiAgICAgICAgICAgIHJldHVybiBFbXB0eUF4aXNMYXlvdXQoXG4g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JvdHRvbSByb3cgb25seVxuICAgICAgICAgICAgICAgIGhlaWdodCArPSBheGlzVGhpY2tuZXNzWFxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFsIGFkZGVkSGVpZ2h0ID0gZmFjZXRDb2xIZWFkSGVpZ2h0KGZhY2V0VGlsZS5jb2xMYWJzLnNpemUpXG4gICAgICAgICAgICBoZWlnaHQgKz0gYWRkZWRIZWlnaHRcbiAgICAgICAgICAgIGdlb21ZID0gYWRkZWRIZWlnaHRcblxuICAgICAgICAgICAgdmFsIGJvdW5kcyA9IERvdWJsZVJlY3RhbmdsZSgwLjAsIDAuMCwgd2lkdGgsIGhlaWdodClcbiAgICAgICAgICAgIHZhbCBnZW9tQm91bmRzID0gRG91YmxlUmVjdGFuZ2xlKGdlb21YLCBnZW9tWSwgZ2VvbVdpZHRoLCBnZW9tSGVpZ2h0KVxuXG4gICAgICAgICAgICB2YWwgcm93ID0gZmFjZXRUaWxlLnJvd1xuICAgICAgICAgICAgaWYgKHJvdyA+IGN1cnJSb3cpIHtcbiAgICAgICAgICAgICAgICBjdXJyUm93ID0gcm93XG4gICAgICAgICAgICAgICAgb2Zmc2V0WSArPSBwcmV2SGVpZ2h0ICsgUEFORUxfUEFERElOR1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcHJldkhlaWdodCA9IGhlaWdodFxuXG4gICAgICAgICAgICB2YWwgY29sID0gZmFjZXRUaWxlLmNvbFxuICAgICAgICAgICAgaWYgKGNvbCA9PSAwKSB7XG4gICAgICAgICAgICAgICAgb2Zmc2V0WCA9IDAuMFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgb2Zmc2V0ID0gRG91YmxlVmVjdG9yKG9mZnNldFgsIG9mZnNldFkpXG4gICAgICAgICAgICBvZmZzZXRYICs9IHdpZHRoICsgUEFORUxfUEFERElOR1xuXG4gICAgICAgICAgICB2YWwgaW5mbyA9IFRpbGVMYXlvdXRJbmZvKFxuICAgICAgICAgICAgICAgIGJvdW5kcyxcbiAgICAgICAgICAgICAgICBnZW9tQm91bmRzLFxuICAgICAgICAgICAgICAgIFhZUGxvdExheW91dFV0aWwuY2xpcEJvdW5kcyhnZW9tQm91bmRzKSxcbiAgICAgICAgICAgICAgICB0aWxlSW5mby5sYXlvdXRJbmZvLnhBeGlzSW5mbyxcbiAgICAgICAgICAgICAgICB0aWxlSW5mby5sYXlvdXRJbmZvLnlBeGlzSW5mbyxcbiAgICAgICAgICAgICAgICB4QXhpc1Nob3duID0gZmFjZXRUaWxlLnhBeGlzLFxuICAgICAgICAgICAgICAgIHlBeGlzU2hvd24gPSBmYWNldFRpbGUueUF4aXMsXG4gICAgICAgICAgICAgICAgdHJ1ZUluZGV4ID0gZmFjZXRUaWxlLnRydWVJbmRleFxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIC53aXRoT2Zmc2V0KHRpbGVzQXJlYU9mZnNldC5hZGQob2Zmc2V0KSlcbiAgICAgICAgICAgICAgICAud2l0aEZhY2V0TGFiZWxzKGZhY2V0VGlsZS5jb2xMYWJzLCBmYWNldFRpbGUucm93TGFiKVxuXG4gICAgICAgICAgICB0aWxlSW5mb3MuYWRkKGluZm8pXG5cbiAgICAgICAgICAgIHRpbGVzQXJlYUJvdW5kcyA9IHRpbGVzQXJlYUJvdW5kcy51bmlvbihpbmZvLmdldEFic29sdXRlQm91bmRzKHRpbGVzQXJlYU9mZnNldCkpXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgcGxvdFNpemUgPSBEb3VibGVWZWN0b3IoXG4gICAgICAgICAgICB0aWxlc0FyZWFCb3VuZHMucmlnaHQgKyBwYWRkaW5nUmlnaHQsXG4gICAgICAgICAgICB0aWxlc0FyZWFCb3VuZHMuaGVpZ2h0ICsgcGFkZGluZ0JvdHRvbVxuICAgICAgICApXG5cbiAgICAgICAgcmV0dXJuIFBsb3RMYXlvdXRJbmZvKHRpbGVJbmZvcywgcGxvdFNpemUpXG4gICAgfVxuXG4gICAgcHJpdmF0ZSB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ICAgICB3aWR0aCxcbiAgICAgICAgICAgICAgICByLmRpbWVuc2lvbi55XG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gY2hhbmdlSGVpZ2h0KHI6IERvdWJsZVJlY3RhbmdsZSwgaGVpZ2h0OiBEb3VibGUpOiBEb3VibGVSZWN0YW5nbGUge1xuICAgICAgICByZXR1cm4gRG91YmxlUmVjdGFuZ2xlKFxuICAgICAgICAgICAgICAgIHIub3JpZ2luLngsXG4gICAgICAgICAgICAgICAgci5vcmlnaW4ueSxcbiAgICAgICAgICAgICAgICByLmRpbWVuc2lvbi54LFxuICAgICAgICAgICAgICAgIGhlaWdodFxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIGNoYW5nZUhlaWdodEtlZXBCb3R0b20ocjogRG91YmxlUmVjdGFuZ2xlLCBoZWlnaHQ6IERvdWJsZSk6IERvdWJsZVJlY3RhbmdsZSB7XG4gICAgICAgIHJldHVybiBEb3VibGVSZWN0YW5nbGUoXG4gICAgICAgICAgICAgICAgci5vcmlnaW4ueCxcbiAgICAgICAgICAgICAgICByLmJvdHRvbSAtIGhlaWdodCxcbiAgICAgICAgICAgICAgICByLmRpbWVuc2lvbi54LFxuICAgICAgICAgICAgICAgIGhlaWdodFxuICAgICAgICApXG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmxheW91dFxuXG5pbXBvcnQgamV0YnJhaW5zLmRhdGFsb3JlLmJhc2UuZ2VvbWV0cnkuRG91YmxlVmVjdG9yXG5cbmFic3RyYWN0IGNsYXNzIExlZ2VuZEJveE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WRVJUSUNBTClcbiAgICAgICAgICAgIExlZ2VuZEJveGVzTGF5b3V0VXRpbC52ZXJ0aWNhbFN0YWNrKGluZm9zKVxuICAgICAgICBlbHNlXG4gICAgICAgICAgICBMZWdlbmRCb3hlc0xheW91dFV0aWwuaG9yaXpvbnRhbFN0YWNrKGluZm9zKVxuXG4gICAgICAgIHZhbCBib3hlc1NpemUgPVxuICAgICAgICAgICAgTGVnZW5kQm94ZXNMYXlvdXRVdGlsLnNpemUoYm94V2l0aExvY2F0aW9uTGlzdClcblxuICAgICAgICAvLyBhZGp1c3QgcGxvdCBib3VuZHNcbiAgICAgICAgaWYgKGxlZ2VuZFBvc2l0aW9uID09IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ1aWxkZXIuZ3VpZGUuTGVnZW5kUG9zaXRpb24uTEVGVCB8fCBsZWdlbmRQb3NpdGlvbiA9PSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmd1aWRlLkxlZ2VuZFBvc2l0aW9uLlJJR0hUKSB7XG4gICAgICAgICAgICB2YWwgcGxvdFdpZHRoID0gbWF4KDAuMCwgcGxvdElubmVyQm91bmRzV2l0aG91dExlZ2VuZEJveGVzLndpZHRoIC0gYm94ZXNTaXplLngpXG4gICAgICAgICAgICBpZiAobGVnZW5kUG9zaXRpb24gPT0gamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5ndWlkZS5MZWdlbmRQb3NpdGlvbi5MRUZUKSB7XG4gICAgICAgICAgICAgICAgcGxvdElubmVyQm91bmRzV2l0aG91dExlZ2VuZEJveGVzID1cbiAgICAgICAgICAgICAgICAgICAgR2VvbWV0cnlVdGlsLmNoYW5nZVdpZHRoS2VlcFJpZ2h0KFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxvdElubmVyQm91bmRzV2l0aG91dExlZ2VuZEJveGVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxvdFdpZHRoXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcGxvdElubmVyQm91bmRzV2l0aG91dExlZ2VuZEJveGVzID1cbiAgICAgICAgICAgICAgICAgICAgR2VvbWV0cnlVdGlsLmNoYW5nZVdpZHRoKFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxvdElubmVyQm91bmRzV2l0aG91dExlZ2VuZEJveGVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxvdFdpZHRoXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmIChsZWdlbmRQb3NpdGlvbiA9PSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmd1aWRlLkxlZ2VuZFBvc2l0aW9uLlRPUCB8fCBsZWdlbmRQb3NpdGlvbiA9PSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmd1aWRlLkxlZ2VuZFBvc2l0aW9uLkJPVFRPTSkge1xuICAgICAgICAgICAgdmFsIHBsb3RIZWlnaHQgPSBtYXgoMC4wLCBwbG90SW5uZXJCb3VuZHNXaXRob3V0TGVnZW5kQm94ZXMuaGVpZ2h0IC0gYm94ZXNTaXplLnkpXG4gICAgICAgICAgICBpZiAobGVnZW5kUG9zaXRpb24gPT0gamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5ndWlkZS5MZWdlbmRQb3NpdGlvbi5UT1ApIHtcbiAgICAgICAgICAgICAgICBwbG90SW5uZXJCb3VuZHNXaXRob3V0TGVnZW5kQm94ZXMgPVxuICAgICAgICAgICAgICAgICAgICBHZW9tZXRyeVV0aWwuY2hhbmdlSGVpZ2h0S2VlcEJvdHRvbShcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsb3RJbm5lckJvdW5kc1dpdGhvdXRMZWdlbmRCb3hlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsb3RIZWlnaHRcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBwbG90SW5uZXJCb3VuZHNXaXRob3V0TGVnZW5kQm94ZXMgPVxuICAgICAgICAgICAgICAgICAgICBHZW9tZXRyeVV0aWwuY2hhbmdlSGVpZ2h0KFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxvdElubmVyQm91bmRzV2l0aG91dExlZ2VuZEJveGVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxvdEhlaWdodFxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbGVnZW5kT3JpZ2luOiBEb3VibGVWZWN0b3JcbiAgICAgICAgaWYgKGxlZ2VuZFBvc2l0aW9uID09IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ1aWxkZXIuZ3VpZGUuTGVnZW5kUG9zaXRpb24uTEVGVCkge1xuICAgICAgICAgICAgbGVnZW5kT3JpZ2luID0gRG91YmxlVmVjdG9yKFxuICAgICAgICAgICAgICAgICAgICBwbG90SW5uZXJCb3VuZHNXaXRob3V0TGVnZW5kQm94ZXMubGVmdCAtIGJveGVzU2l6ZS54LFxuICAgICAgICAgICAgICAgICAgICBwbG90Q2VudGVyLnkgLSBib3hlc1NpemUueSAvIDIpXG4gICAgICAgIH0gZWxzZSBpZiAobGVnZW5kUG9zaXRpb24gPT0gamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5ndWlkZS5MZWdlbmRQb3NpdGlvbi5SSUdIVCkge1xuICAgICAgICAgICAgbGVnZW5kT3JpZ2luID0gRG91YmxlVmVjdG9yKFxuICAgICAgICAgICAgICAgICAgICBwbG90SW5uZXJCb3VuZHNXaXRob3V0TGVnZW5kQm94ZXMucmlnaHQsXG4gICAgICAgICAgICAgICAgICAgIHBsb3RDZW50ZXIueSAtIGJveGVzU2l6ZS55IC8gMilcbiAgICAgICAgfSBlbHNlIGlmIChsZWdlbmRQb3NpdGlvbiA9PSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmd1aWRlLkxlZ2VuZFBvc2l0aW9uLlRPUCkge1xuICAgICAgICAgICAgbGVnZW5kT3JpZ2luID0gRG91YmxlVmVjdG9yKFxuICAgICAgICAgICAgICAgICAgICBwbG90Q2VudGVyLnggLSBib3hlc1NpemUueCAvIDIsXG4gICAgICAgICAgICAgICAgICAgIHBsb3RJbm5lckJvdW5kc1dpdGhvdXRMZWdlbmRCb3hlcy50b3AgLSBib3hlc1NpemUueSlcbiAgICAgICAgfSBlbHNlIGlmIChsZWdlbmRQb3NpdGlvbiA9PSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmd1aWRlLkxlZ2VuZFBvc2l0aW9uLkJPVFRPTSkge1xuICAgICAgICAgICAgbGVnZW5kT3JpZ2luID0gRG91YmxlVmVjdG9yKFxuICAgICAgICAgICAgICAgICAgICBwbG90Q2VudGVyLnggLSBib3hlc1NpemUueCAvIDIsXG4gICAgICAgICAgICAgICAgICAgIHBsb3RJbm5lckJvdW5kc1dpdGhvdXRMZWdlbmRCb3hlcy5ib3R0b20pXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBsZWdlbmRPcmlnaW4gPVxuICAgICAgICAgICAgICAgIExlZ2VuZEJveGVzTGF5b3V0VXRpbC5vdmVybGF5TGVnZW5kT3JpZ2luKFxuICAgICAgICAgICAgICAgICAgICBwbG90SW5uZXJCb3VuZHNXaXRob3V0TGVnZW5kQm94ZXMsXG4gICAgICAgICAgICAgICAgICAgIGJveGVzU2l6ZSxcbiAgICAgICAgICAgICAgICAgICAgbGVnZW5kUG9zaXRpb24sXG4gICAgICAgICAgICAgICAgICAgIGxlZ2VuZEp1c3RpZmljYXRpb25cbiAgICAgICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgcmVzdWx0Qm94V2l0aExvY2F0aW9uTGlzdCA9XG4gICAgICAgICAgICBMZWdlb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kQm94ZXNMYXlvdXQuQm94V2l0aExvY2F0aW9uPiB7XG4gICAgICAgIHZhbCByZXN1bHQgPSBBcnJheUxpc3Q8TGVnZW5kQm94ZXNMYXlvdXQuQm94V2l0aExvY2F0aW9uPigpXG4gICAgICAgIHZhciB4ID0gMC4wXG4gICAgICAgIGZvciAoaW5mbyBpbiBib3hJbmZvcykge1xuICAgICAgICAgICAgcmVzdWx0LmFkZChcbiAgICAgICAgICAgICAgICBMZWdlbmRCb3hlc0xheW91dC5Cb3hXaXRoTG9jYXRpb24oXG4gICAgICAgICAgICAgICAgICAgIGluZm8sXG4gICAgICAgICAgICAgICAgICAgIERvdWJsZVZlY3Rvcih4LCAwLjApXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgeCArPSBpbmZvLnNpemUueFxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBmdW4gbW92ZUFsbChkZWx0YTogRG91YmxlVmVjdG9yLCBib3hXaXRoTG9jYXRpb25MaXN0OiBMaXN0PExlZ2VuZEJveGVzTGF5b3V0LkJveFdpdGhMb2NhdGlvbj4pOiBMaXN0PExlZ2VuZEJveGVzTGF5b3V0LkJveFdpdGhMb2NhdGlvbj4ge1xuICAgICAgICB2YWwgcmVzdWx0ID0gQXJyYXlMaXN0PExlZ2VuZEJveGVzTGF5b3V0LkJveFdpdGhMb2NhdGlvbj4oKVxuICAgICAgICBmb3IgKGJveFdpdGhMb2NhdGlvbiBpbiBib3hXaXRoTG9jYXRpb25MaXN0KSB7XG4gICAgICAgICAgICByZXN1bHQuYWRkKFxuICAgICAgICAgICAgICAgIExlZ2VuZEJveGVzTGF5b3V0LkJveFdpdGhMb2NhdGlvbihcbiAgICAgICAgICAgICAgICAgICAgYm94V2l0aExvY2F0aW9uLmxlZ2VuZEJveCxcbiAgICAgICAgICAgICAgICAgICAgYm94V2l0aExvY2F0aW9uLmxvY2F0aW9uLmFkZChkZWx0YSl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FuZ2U8RG91YmxlPixcbiAgICAgICAgICAgIGNvb3JkUHJvdmlkZXI6IENvb3JkUHJvdmlkZXIsXG4gICAgICAgICAgICB0aGVtZTogQXhpc1RoZW1lXG4gICAgICAgICk6IEF4aXNMYXlvdXQge1xuICAgICAgICAgICAgcmV0dXJuIFBsb3RBeGlzTGF5b3V0KFxuICAgICAgICAgICAgICAgIHNjYWxlLCB4RG9tYWluLCB5RG9tYWluLCBjb29yZFByb3ZpZGVyLFxuICAgICAgICAgICAgICAgIHRoZW1lLFxuICAgICAgICAgICAgICAgIE9yaWVudGF0aW9uLkJPVFRPTVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGxlZnQoXG4gICAgICAgICAgICBzY2FsZTogU2NhbGU8RG91YmxlPixcbiAgICAgICAgICAgIHhEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgICAgICB5RG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICAgICAgY29vcmRQcm92aWRlcjogQ29vcmRQcm92aWRlcixcbiAgICAgICAgICAgIHRoZW1lOiBBeGlzVGhlbWVcbiAgICAgICAgKTogQXhpc0xheW91dCB7XG4gICAgICAgICAgICByZXR1cm4gUGxvdEF4aXNMYXlvdXQoXG4gICAgICAgICAgICAgICAgc2NhbGUsIHhEb21haW4sIHlEb21haW4sIGNvb3JkUHJvdmlkZXIsXG4gICAgICAgICAgICAgICAgdGhlbWUsXG4gICAgICAgICAgICAgICAgT3JpZW50YXRpb24uTEVGVFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gaW5pdGlhbFRpY2tMYWJlbFNpemUob3JpZW50YXRpb246IE9yaWVudGF0aW9uKTogRG91YmxlIHtcbiAgICAgICAgICAgIHJldHVybiBpZiAob3JpZW50YXRpb24uaXNIb3Jpem9udGFsKVxuICAgICAgICAgICAgICAgIFRJQ0tfTEFCRUxfU1BFQy5oZ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pdmF0ZSB2YWwgTElWRV9NQVBfUExPVF9NQVJHSU4gPSBEb3VibGVWZWN0b3IoMTAuMCwgMTAuMClcblxuICAgIGZ1biB0aXRsZURpbWVuc2lvbnModGV4dDogU3RyaW5nKTogRG91YmxlVmVjdG9yIHtcbiAgICAgICAgaWYgKGlzTnVsbE9yRW1wdHkodGV4dCkpIHtcbiAgICAgICAgICAgIHJldHVybiBEb3VibGVWZWN0b3IuWkVST1xuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGxhYmVsU3BlYyA9IFBsb3RMYWJlbFNwZWMuUExPVF9USVRMRVxuICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKFxuICAgICAgICAgICAgbGFiZWxTcGVjLndpZHRoKHRleHQubGVuZ3RoKSxcbiAgICAgICAgICAgIGxhYmVsU3BlYy5oZWlnaHQoKSArIDIgKiBUSVRMRV9WX01BUkdJTlxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIGF4aXNUaXRsZURpbWVuc2lvbnModGV4dDogU3RyaW5nKTogRG91YmxlVmVjdG9yIHtcbiAgICAgICAgaWYgKGlzTnVsbE9yRW1wdHkodGV4dCkpIHtcbiAgICAgICAgICAgIHJldHVybiBEb3VibGVWZWN0b3IuWkVST1xuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGxhYmVsU3BlYyA9IFBsb3RMYWJlbFNwZWMuQVhJU19USVRMRVxuICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKFxuICAgICAgICAgICAgbGFiZWxTcGVjLndpZHRoKHRleHQubGVuZ3RoKSxcbiAgICAgICAgICAgIGxhYmVsU3BlYy5oZWlnaHQoKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIGFic29sdXRlR2VvbUJvdW5kcyhvcmlnaW46IERvdWJsZVZlY3RvciwgcGxvdExheW91dEluZm86IFBsb3RMYXlvdXRJbmZvKTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgcmVxdWlyZShwbG90TGF5b3V0SW5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gICAgICAgIHJldHVybiBEb3VibGVSZWN0YW5nbGUobWFyZ2luTGVmdFRvcCwgZ2VvbVNpemUpXG4gICAgfVxuXG4gICAgZnVuIGNsaXBCb3VuZHMoZ2VvbUJvdW5kczogRG91YmxlUmVjdGFuZ2xlKTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgcmV0dXJuIERvdWJsZVJlY3RhbmdsZShcbiAgICAgICAgICAgIGdlb21Cb3VuZHMub3JpZ2luLnN1YnRyYWN0KFxuICAgICAgICAgICAgICAgIERvdWJsZVZlY3RvcihcbiAgICAgICAgICAgICAgICAgICAgQ0xJUF9FWFRFTkQsXG4gICAgICAgICAgICAgICAgICAgIENMSVBfRVhURU5EXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKSxcbiAgICAgICAgICAgIERvdWJsZVZlY3RvcihcbiAgICAgICAgICAgICAgICBnZW9tQm91bmRzLmRpbWVuc2lvbi54ICsgMiAqIENMSVBfRVhURU5ELFxuICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMuZGltZW5zaW9uLnkgKyAyICogQ0xJUF9FWFRFTkRcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biBtYXhUaWNrTGFiZWxzQm91bmRzKFxuICAgICAgICBheGlzT3JpZW50YXRpb246IE9yaWVudGF0aW9uLFxuICAgICAgICBzdHJldGNoOiBEb3VibGUsXG4gICAgICAgIGdlb21Cb3VuZHM6IERvdWJsZVJlY3RhbmdsZSxcbiAgICAgICAgcGxvdFNpemU6IERvdWJsZVZlY3RvclxuICAgICk6IERvdWJsZVJlY3RhbmdsZSB7XG4gICAgICAgIHZhbCBnZW9tUGFkZHVuZyA9IDEwLjAgICAgICAgICAgLy8gbWluIHNwYWNlIGFyb3VuZCBnZW9tIGFyZWEgKGxhYmVscyBzaG91bGQgbm90IHRvdWNoIGdlb20gYXJlYSkuXG5cbiAgICAgICAgdmFsIG1heEdlb21Cb3VuZHMgPSBEb3VibGVSZWN0YW5nbGUoXG4gICAgICAgICAgICBnZW9tUGFkZHVuZywgZ2VvbVBhZGR1bmcsXG4gICAgICAgICAgICBwbG90U2l6ZS54IC0gMiAqIGdlb21QYWRkdW5nLFxuICAgICAgICAgICAgcGxvdFNpemUueSAtIDIgKiBnZW9tUGFkZHVuZ1xuICAgICAgICApXG4gICAgICAgIHdoZW4gKGF4aXNPcmllbnRhdGlvbikge1xuICAgICAgICAgICAgT3JpZW50YXRpb24uVE9QLFxuICAgICAgICAgICAgT3JpZW50YXRpb24uQk9UVE9NIC0+IHtcbiAgICAgICAgICAgICAgICB2YWwgbGVmdFNwYWNlID0gZ2VvbUJvdW5kcy5sZWZ0IC0gbWF4R2VvbUJvdW5kcy5sZWZ0ICsgc3RyZXRjaFxuICAgICAgICAgICAgICAgIHZhbCByaWdodFNwYWNlID0gbWF4R2VvbUJvdW5kcy5yaWdodCAtIGdlb21Cb3VuZHMucmlnaHQgKyBzdHJldGNoXG5cbiAgICAgICAgICAgICAgICB2YWwgaGVpZ2h0ID0gMUU0MiAgIC8vIGp1c3QgdmVyeSBsYXJnZSBudW1iZXJcbiAgICAgICAgICAgICAgICB2YWwgdG9wID0gd2hlbiAoYXhpc09yaWVudGF0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIE9yaWVudGF0aW9uLlRPUCAtPiAtaGVpZ2h0XG4gICAgICAgICAgICAgICAgICAgIGVsc2UgLT4gMC4wXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdmFsIGxlZnQgPSAtbGVmdFNwYWNlXG4gICAgICAgICAgICAgICAgdmFsIHdpZHRoID0gbGVmdFNwYWNlICsgcmlnaHRTcGFjZSArIGdlb21Cb3VuZHMud2lkdGhcbiAgICAgICAgICAgICAgICByZXR1cm4gRG91YmxlUmVjdGFuZ2xlKGxlZnQsIHRvcCwgd2lkdGgsIGhlaWdodClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZWxzZSAtPiB0aHJvdyBJb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tQm91bmRzLFxuICAgICAgICAgICAgICAgIHByZWZlcnJlZFNpemVcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIHZhbCB0aWNrTGFiZWxzQm91bmRzID0geEF4aXNJbmZvLnRpY2tMYWJlbHNCb3VuZHNcbiAgICAgICAgICAgIHZhbCBsZWZ0T3ZlcmZsb3cgPSBtYXhUaWNrTGFiZWxzQm91bmRzLmxlZnQgLSB0aWNrTGFiZWxzQm91bmRzISEub3JpZ2luLnhcbiAgICAgICAgICAgIHZhbCByaWdodE92ZXJmbG93ID0gdGlja0xhYmVsc0JvdW5kcy5vcmlnaW4ueCArIHRpY2tMYWJlbHNCb3VuZHMuZGltZW5zaW9uLnggLSBtYXhUaWNrTGFiZWxzQm91bmRzLnJpZ2h0XG4gICAgICAgICAgICBpZiAobGVmdE92ZXJmbG93ID4gMCkge1xuICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMgPSBEb3VibGVSZWN0YW5nbGUoXG4gICAgICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMub3JpZ2luLnggKyBsZWZ0T3ZlcmZsb3csXG4gICAgICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMub3JpZ2luLnksXG4gICAgICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMuZGltZW5zaW9uLnggLSBsZWZ0T3ZlcmZsb3csXG4gICAgICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMuZGltZW5zaW9uLnlcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAocmlnaHRPdmVyZmxvdyA+IDApIHtcbiAgICAgICAgICAgICAgICBnZW9tQm91bmRzID0gRG91YmxlUmVjdGFuZ2xlKFxuICAgICAgICAgICAgICAgICAgICBnZW9tQm91bmRzLm9yaWdpbi54LFxuICAgICAgICAgICAgICAgICAgICBnZW9tQm91bmRzLm9yaWdpbi55LFxuICAgICAgICAgICAgICAgICAgICBnZW9tQm91bmRzLmRpbWVuc2lvbi54IC0gcmlnaHRPdmVyZmxvdyxcbiAgICAgICAgICAgICAgICAgICAgZ2VvbUJvdW5kcy5kaW1lbnNpb24ueVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGdlb21Cb3VuZHMgPSBnZW9tQm91bmRzLnVuaW9uKFxuICAgICAgICAgICAgRG91YmxlUmVjdGFuZ2xlKGdlb21Cb3VuZHMub3JpZ2luLCBHRU9NX01JTl9TSVpFKVxuICAgICAgICApXG5cbiAgICAgICAgLy8gQ29tYmluZSBnZW9tIGFyZWEgYW5kIHgveSBheGlzXG4gICAgICAgIHZhbCBnZW9tV2l0aEF4aXNCb3VuZHMgPVxuICAgICAgICAgICAgdGlsZUJvdW5kcyhcbiAgICAgICAgICAgICAgICB4QXhpc0luZm8uYXhpc0JvdW5kcygpLFxuICAgICAgICAgICAgICAgIHlBeGlzSW5mby5heGlzQm91bmRzKCksXG4gICAgICAgICAgICAgICAgZ2VvbUJvdW5kc1xuICAgICAgICAgICAgKVxuXG4gICAgICAgIC8vIHN5bmMgYXhpcyBpbmZvIHdpdGggbmV3IChtYXkgYmUpIGdlb20gYXJlYSBzaXplXG4gICAgICAgIHhBeGlzSW5mbyA9IHhBeGlzSW5mby53aXRoQXhpc0xlbmd0aChnZW9tQm91bmRzLndpZHRoKS5idWlsZCgpXG4gICAgICAgIHlBeGlzSW5mbyA9IHlBeGlzSW5mby53aXRoQXhpc0xlbmd0aChnZW9tQm91bmRzLmhlaWdodCkuYnVpbGQoKVxuXG4gICAgICAgIHJldHVybiBUaWxlTGF5b3V0SW5mbyhcbiAgICAgICAgICAgIGdlb21XaXRoQXhpc0JvdW5kcyxcbiAgICAgICAgICAgIGdlb21Cb3VuZHMsXG4gICAgICAgICAgICBjbGlwQm91bmRzKGdlb21Cb3VuZHMpLFxuICAgICAgICAgICAgeEF4aXNJbmZvLFxuICAgICAgICAgICAgeUF4aXNJbmZvLFxuICAgICAgICAgICAgdHJ1ZUluZGV4ID0gMFxuICAgICAgICApXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHByaXZhdGUgY29uc3QgdmFsIEFYSVNfU1RSRVRDSF9SQVRJTyA9IDAuMSAgLy8gYWxsb3cgMTAlIGF4aXMgZmxleGliaWxpdHkgKG9uIGVhY2ggZW5kKVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHRpbGVCb3VuZHMoXG4gICAgICAgICAgICB4QXhpc0JvdW5kczogRG91YmxlUmVjdGFuZ2xlLFxuICAgICAgICAgICAgeUF4aXNCb3VuZHM6IERvdWJsZVJlY3RhbmdsZSxcbiAgICAgICAgICAgIGdlb21Cb3VuZHM6IERvdWJsZVJlY3RhbmdsZVxuICAgICAgICApOiBEb3VibGVSZWN0YW5nbGUge1xuICAgICAgICAgICAgLy8gQ2FuJ3QganVzdCB1bmlvbiBib3VuZHMgYmVjYXVzZVxuICAgICAgICAgICAgLy8geC1heGlzIGhhcyB6ZXJvIG9yaWdpblxuICAgICAgICAgICAgLy8geS1heGlzIGhhcyBuZWdhdGl2ZSBvcmlnaW5cbiAgICAgICAgICAgIHZhbCBsZWZ0VG9wID0gRG91YmxlVmVjdG9yKFxuICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMubGVmdCAtIHlBeGlzQm91bmRzLndpZHRoLFxuICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMudG9wIC0gR0VPTV9NQVJHSU5cbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIHZhbCByaWdodEJvdHRvbSA9IERvdWJsZVZlY3RvcihcbiAgICAgICAgICAgICAgICBnZW9tQm91bmRzLnJpZ2h0ICsgR0VPTV9NQVJHSU4sXG4gICAgICAgICAgICAgICAgZ2VvbUJvdW5kcy5ib3R0b20gKyB4QXhpc0JvdW5kcy5oZWlnaHRcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIHJldHVybiBEb3VibGVSZWN0YW5nbGUobGVmdFRvcCwgcmlnaHRCb3R0b20uc3VidHJhY3QobGVmdFRvcCkpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBjb21wdXRlQXhpc0luZm9zKFxuICAgICAgICAgICAgeEF4aXNMYXlvdXQ6IEF4aXNMYXlvdXQsXG4gICAgICAgICAgICB5QXhpc0xheW91dDogQXhpc0xheW91dCxcbiAgICAgICAgICAgIHBsb3RTaXplOiBEb3VibGVWZWN0b3JcbiAgICAgICAgKTogUGFpcjxBeGlzTGF5b3V0SW5mbywgQXhpc0xheW91dEluZm8+IHtcbiAgICAgICAgICAgIHZhbCB4QXhpc1RoaWNrbmVzcyA9IHhBeGlzTGF5b3V0LmluaXRpYWxUaGlja25lc3MoKVxuICAgICAgICAgICAgdmFyIHlBeGlzSW5mbyA9IGNvbXB1dGVZQXhpc0luZm8oXG4gICAgICAgICAgICAgICAgeUF4aXNMYXlvdXQsXG4gICAgICAgICAgICAgICAgZ2VvbUJvdW5kcyhcbiAgICAgICAgICAgICAgICAgICAgeEF4aXNUaGlja25lc3MsXG4gICAgICAgICAgICAgICAgICAgIHlBeGlzTGF5b3V0LmluaXRpYWxUaGlja25lc3MoKSxcbiAgICAgICAgICAgICAgICAgICAgcGxvdFNpemVcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIHZhbCB5QXhpc1RoaWNrbmVzcyA9IHlBeGlzSW5mby5heGlzQm91bmRzKCkuZGltZW5zaW9uLnhcbiAgICAgICAgICAgIHZhciB4QXhpc0luZm8gPSBjb21wdXRlWEF4aXNJbmZvKFxuICAgICAgICAgICAgICAgIHhBeGlzTGF5b3V0LFxuICAgICAgICAgICAgICAgIHBsb3RTaXplLCBnZW9tQm91bmRzKFxuICAgICAgICAgICAgICAgICAgICB4QXhpc1RoaWNrbmVzcyxcbiAgICAgICAgICAgICAgICAgICAgeUF4aXNUaGlja25lc3MsXG4gICAgICAgICAgICAgICAgICAgIHBsb3RTaXplXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICBpZiAoeEF4aXNJbmZvLmF4aXNCb3VuZHMoKS5kaW1lbnNpb24ueSA+IHhBeGlzVGhpY2tuZXNzKSB7XG4gICAgICAgICAgICAgICAgLy8gUmUtbGF5b3V0IHktYXhpcyBpZiB4LWF4aXMgYmVjYW1lIHRoaWNrZXIgdGhhbiBpdHMgJ29yaWdpbmFsIHRoaWNrbmVzcycuXG4gICAgICAgICAgICAgICAgeUF4aXNJbmZvID0gY29tcHV0ZVlBeGlzSW5mbyhcbiAgICAgICAgICAgICAgICAgICAgeUF4aXNMYXlvdXQsXG4gICAgICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMoXG4gICAgICAgICAgICAgICAgICAgICAgICB4QXhpc0luZm8uYXhpc0JvdW5kcygpLmRpbWVuc2lvbi55LFxuICAgICAgICAgICAgICAgICAgICAgICAgeUF4aXNUaGlja25lc3MsXG4gICAgICAgICAgICAgICAgICAgICAgICBwbG90U2l6ZVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gUGFpcih4QXhpc0luZm8sIHlBeGlzSW5mbylcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGNvbXB1dGVYQXhpc0luZm8oXG4gICAgICAgICAgICBheGlzTGF5b3V0OiBBeGlzTGF5b3V0LFxuICAgICAgICAgICAgcGxvdFNpemU6IERvdWJsZVZlY3RvcixcbiAgICAgICAgICAgIGdlb21Cb3VuZHM6IERvdWJsZVJlY3RhbmdsZVxuICAgICAgICApOiBBeGlzTGF5b3V0SW5mbyB7XG4gICAgICAgICAgICB2YWwgYXhpc0xlbmd0aCA9IGdlb21Cb3VuZHMuZGltZW5zaW9uLnhcbiAgICAgICAgICAgIHZhbCBzdHJldGNoID0gYXhpc0xlbmd0aCAqIEFYSVNfU1RSRVRDSF9SQVRJT1xuICAgICAgICAgICAgdmFsIG1heFRpY2tMY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bWUpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbGFiZWxzTGF5b3V0ID0gQXhpc0xhYmVsc0xheW91dC5ob3Jpem9udGFsRmxleEJyZWFrcyhvcmllbnRhdGlvbiwgYXhpc0RvbWFpbiwgYnJlYWtzUHJvdmlkZXIsIHRoZW1lKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gSG9yaXpvbnRhbEF4aXNMYXlvdXRlcihcbiAgICAgICAgICAgICAgICAgICAgb3JpZW50YXRpb24sXG4gICAgICAgICAgICAgICAgICAgIGF4aXNEb21haW4sXG4gICAgICAgICAgICAgICAgICAgIGxhYmVsc0xheW91dFxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gdmVydGljYWxcbiAgICAgICAgICAgIHZhbCBsYWJlbHNMYXlvdXQ6IEF4aXNMYWJlbHNMYXlvdXRcbiAgICAgICAgICAgIGlmIChicmVha3NQcm92aWRlci5pc0ZpeGVkQnJlYWtzKSB7XG4gICAgICAgICAgICAgICAgbGFiZWxzTGF5b3V0ID0gQXhpc0xhYmVsc0xheW91dC52ZXJ0aWNhbEZpeGVkQnJlYWtzKG9yaWVudGF0aW9uLCBheGlzRG9tYWluLCBicmVha3NQcm92aWRlci5maXhlZEJyZWFrcywgdGhlbWUpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxhYmVsc0xheW91dCA9IEF4aXNMYWJlbHNMYXlvdXQudmVydGljYWxGbGV4QnJlYWtzKG9yaWVudGF0aW9uLCBheGlzRG9tYWluLCBicmVha3NQcm92aWRlciwgdGhlbWUpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gVmVydGljYWxBeGlzTGF5b3V0ZXIoXG4gICAgICAgICAgICAgICAgb3JpZW50YXRpb24sXG4gICAgICAgICAgICAgICAgYXhpc0RvbWFpbixcbiAgICAgICAgICA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5idWlsZGVyLmd1aWRlLk9yaWVudGF0aW9uKTogQXhpc0xhYmVsc0xheW91dEluZm8ge1xuICAgICAgICBpZiAob3JpZW50YXRpb24uaXNIb3Jpem9udGFsKSB7XG4gICAgICAgICAgICB2YXIgYm91bmRzID0gRG91YmxlUmVjdGFuZ2xlKGF4aXNMZW5ndGggLyAyLCAwLjAsIDAuMCwgMC4wKSAvLyBlbXB0eSBib3VuZHMgaW4gdGhlIG1pZGRsZSBvZiB0aGUgYXhpcztcbiAgICAgICAgICAgIGJvdW5kcyA9IGFwcGx5TGFiZWxzT2Zmc2V0KGJvdW5kcylcbiAgICAgICAgICAgIHJldHVybiBBeGlzTGFiZWxzTGF5b3V0SW5mby5CdWlsZGVyKClcbiAgICAgICAgICAgICAgICAgICAgLmJyZWFrcyhicmVha3MpXG4gICAgICAgICAgICAgICAgICAgIC5ib3VuZHMoYm91bmRzKVxuICAgICAgICAgICAgICAgICAgICAuc21hbGxGb250KGZhbHNlKVxuICAgICAgICAgICAgICAgICAgICAub3ZlcmxhcChmYWxzZSlcbiAgICAgICAgICAgICAgICAgICAgLmxhYmVsQWRkaXRpb25hbE9mZnNldHMobnVsbClcbiAgICAgICAgICAgICAgICAgICAgLmxhYmVsSG9yaXpvbnRhbEFuY2hvcihUZXh0TGFiZWwuSG9yaXpvbnRhbEFuY2hvci5NSURETEUpXG4gICAgICAgICAgICAgICAgICAgIC5sYWJlbFZlcnRpY2FsQW5jaG9yKFRleHRMYWJlbC5WZXJ0aWNhbEFuY2hvci5UT1ApXG4gICAgICAgICAgICAgICAgICAgIC5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICB0aHJvdyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oXCJOb3QgaW1wbGVtZW50ZWQgZm9yICRvcmllbnRhdGlvblwiKVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICB2YWwgSE9SSVpPTlRBTF9USUNLX0xPQ0FUSU9OID0geyB4OiB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YWJlbFNwZWM6IFBsb3RMYWJlbFNwZWMsXG4gICAgdmFsIHRoZW1lOiBBeGlzVGhlbWVcbikge1xuXG4gICAgcHJvdGVjdGVkIHZhbCBpc0hvcml6b250YWw6IEJvb2xlYW5cbiAgICAgICAgZ2V0KCkgPSBvcmllbnRhdGlvbi5pc0hvcml6b250YWxcblxuICAgIGFic3RyYWN0IGZ1biBkb0xheW91dChcbiAgICAgICAgYXhpc0xlbmd0aDogRG91YmxlLFxuICAgICAgICBheGlzTWFwcGVyOiAoRG91YmxlPykgLT4gRG91YmxlPyxcbiAgICAgICAgbWF4TGFiZWxzQm91bmRzOiBEb3VibGVSZWN0YW5nbGU/XG4gICAgKTogQXhpc0xhYmVsc0xheW91dEluZm9cblxuICAgIGludGVybmFsIGZ1biBtYXBUb0F4aXMoXG4gICAgICAgIGJyZWFrczogTGlzdDxEb3VibGU+LFxuICAgICAgICBheGlzTWFwcGVyOiAoRG91YmxlPykgLT4gRG91YmxlP1xuICAgICk6IExpc3Q8RG91YmxlPiB7XG5cbiAgICAgICAgcmV0dXJuIEJyZWFrTGFiZWxzTGF5b3V0VXRpbC5tYXBUb0F4aXMoXG4gICAgICAgICAgICBicmVha3MsXG4gICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgYXhpc01hcHBlclxuICAgICAgICApXG4gICAgfVxuXG4gICAgaW50ZXJuYWwgZnVuIGFwcGx5TGFiZWxzT2Zmc2V0KGxhYmVsc0JvdW5kczogRG91YmxlUmVjdGFuZ2xlKTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgcmV0dXJuIEJyZWFrTGFiZWxzTGF5b3V0VXRpbC5hcHBseUxhYmVsc09mZnNldChcbiAgICAgICAgICAgIGxhYmVsc0JvdW5kcyxcbiAgICAgICAgICAgIHRoZW1lLnRpY2tMYWJlbERpc3RhbmNlKCksXG4gICAgICAgICAgICBvcmllbnRhdGlvblxuICAgICAgICApXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHZhbCBUSUNLX0xBQkVMX1NQRUMgPSBQbG90TGFiZWxTcGVjLkFYSVNfVElDS1xuICAgICAgICB2YWwgSU5JVElBTF9USUNLX0xBQkVMX0xFTkdUSCA9IDQgLy8gc3ltYm9sc1xuICAgICAgICB2YWwgTUlOX1RJQ0tfTEFCRUxfRElTVEFOQ0UgPSAyMC4wICAvLyBweFxuICAgICAgICB2YWwgVElDS19MQUJFTF9TUEVDX1NNQUxMID0gUGxvdExhYmVsU3BlYy5BWElTX1RJQ0tfU01BTExcblxuICAgICAgICBmdW4gaG9yaXpvbnRhbEZsZXhCcmVha3MoXG4gICAgICAgICAgICBvcmllbnRhdGlvbjogamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5ndWlkZS5PcmllbnRhdGlvbixcbiAgICAgICAgICAgIGF4aXNEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sIGJyZWFrc1Byb3ZpZGVyOiBBeGlzQnJlYWtzUHJvdmlkZXIsIHRoZW1lOiBBeGlzVGhlbWVcbiAgICAgICAgKTogQXhpc0xhYmVsc0xheW91dCB7XG5cbiAgICAgICAgICAgIHJlcXVpcmUob3JpZW50YXRpb24uaXNIb3Jpem9udGFsKSB7IG9yaWVudGF0aW9uLnRvU3RyaW5nKCkgfVxuICAgICAgICAgICAgcmVxdWlyZSghYnJlYWtzUHJvdmlkZXIuaXNGaXhlZEJyZWFrcykgeyBcImZpeGVkIGJyZWFrc1wiIH1cbiAgICAgICAgICAgIHJldHVybiBIb3Jpem9udGFsRmxleEJyZWFrc0xhYmVsc0xheW91dChcbiAgICAgICAgICAgICAgICBvcmllbnRhdGlvbixcbiAgICAgICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgICAgIFRJQ0tfTEFCRUxfU1BFQyxcbiAgICAgICAgICAgICAgICBicmVha3NQcm92aWRlcixcbiAgICAgICAgICAgICAgICB0aGVtZVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGhvcml6b250YWxGaXhlZEJyZWFrcyhcbiAgICAgICAgICAgIG9yaWVudGF0aW9uOiBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmd1aWRlLk9yaWVudGF0aW9uLFxuICAgICAgICAgICAgYXhpc0RvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgYnJlYWtzOiBHdWlkZUJyZWFrcywgdGhlbWU6IEF4aXNUaGVtZVxuICAgICAgICApOiBBeGlzTGFiZWxzTGF5b3V0IHtcblxuICAgICAgICAgICAgcmVxdWlyZShvcmllbnRhdGlvbi5pc0hvcml6b250YWwpIHsgb3JpZW50YXRpb24udG9TdHJpbmcoKSB9XG4gICAgICAgICAgICByZXR1cm4gSG9yaXpvbnRhbEZpeGVkQnJlYWtzTGFiZWxzTGF5b3V0KFxuICAgICAgICAgICAgICAgIG9yaWVudGF0aW9uLFxuICAgICAgICAgICAgICAgIGF4aXNEb21haW4sXG4gICAgICAgICAgICAgICAgVElDS19MQUJFTF9TUEVDLFxuICAgICAgICAgICAgICAgIGJyZWFrcyxcbiAgICAgICAgICAgICAgICB0aGVtZVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHZlcnRpY2FsRmxleEJyZWFrcyhcbiAgICAgICAgICAgIG9yaWVudGF0aW9uOiBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmd1aWRlLk9yaWVudGF0aW9uLFxuICAgICAgICAgICAgYXhpc0RvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgYnJlYWtzUHJvdmlkZXI6IEF4aXNCcmVha3NQcm92aWRlciwgdGhlbWU6IEF4aXNUaGVtZVxuICAgICAgICApOiBBeGlzTGFiZWxzTGF5b3V0IHtcblxuICAgICAgICAgICAgcmVxdWlyZSghb3JpZW50YXRpb24uaXNIb3Jpem9udGFsKSB7IG9yaWVudGF0aW9uLnRvU3RyaW5nKCkgfVxuICAgICAgICAgICAgcmVxdWlyZSghYnJlYWtzUHJvdmlkZXIuaXNGaXhlZEJyZWFrcykgeyBcImZpeGVkIGJyZWFrc1wiIH1cbiAgICAgICAgICAgIHJldHVybiBWZXJ0aWNhbEZsZXhCcmVha3NMYWJlbHNMYXlvdXQoXG4gICAgICAgICAgICAgICAgb3JpZW50YXRpb24sXG4gICAgICAgICAgICAgICAgYXhpc0RvbWFpbixcbiAgICAgICAgICAgICAgICBUSUNLX0xBQkVMX1NQRUMsXG4gICAgICAgICAgICAgICAgYnJlYWtzUHJvdmlkZXIsXG4gICAgICAgICAgICAgICAgdGhlbWVcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB2ZXJ0aWNhbEZpeGVkQnJlYWtzKFxuICAgICAgICAgICAgb3JpZW50YXRpb246IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ1aWxkZXIuZ3VpZGUuT3JpZW50YXRpb24sXG4gICAgICAgICAgICBheGlzRG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICAgICAgYnJlYWtzOiBHdWlkZUJyZWFrcyxcbiAgICAgICAgICAgIHRoZW1lOiBBeGlzVGhlbWVcbiAgICAgICAgKTogQXhpc0xhYmVsc0xheW91dCB7XG4gICAgICAgICAgICByZXF1aXJlKCFvcmllbnRhdGlvbi5pc0hvcml6b250YWwpIHsgb3JpZW50YXRpb24udG9TdHJpbmcoKSB9XG4gICAgICAgICAgICByZXR1cm4gVmVydGljYWxGaXhlZEJyZWFrc0xhYmVsc0xheW91dChcbiAgICAgICAgICAgICAgICBvcmllbnRhdGlvbixcbiAgICAgICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgICAgIFRJQ0tfTEFCRUxfU1BFQyxcbiAgICAgICAgICAgICAgICBicmVha3MsXG4gICAgICAgICAgICAgICAgdGhlbWVcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG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VjdG9yPj8gPSBudWxsXG4gICAgICAgIGludGVybmFsIHZhciBteUxhYmVsSG9yaXpvbnRhbEFuY2hvcjogVGV4dExhYmVsLkhvcml6b250YWxBbmNob3I/ID0gbnVsbFxuICAgICAgICBpbnRlcm5hbCB2YXIgbXlMYWJlbFZlcnRpY2FsQW5jaG9yOiBUZXh0TGFiZWwuVmVydGljYWxBbmNob3I/ID0gbnVsbFxuICAgICAgICBpbnRlcm5hbCB2YXIgbXlMYWJlbFJvdGF0aW9uQW5nbGUgPSAwLjBcblxuICAgICAgICBmdW4gYnJlYWtzKGJyZWFrczogR3VpZGVCcmVha3MpOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIG15QnJlYWtzID0gYnJlYWtzXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGJvdW5kcyhib3VuZHM6IERvdWJsZVJlY3RhbmdsZSk6IEJ1aWxkZXIge1xuICAgICAgICAgICAgbXlCb3VuZHMgPSBib3VuZHNcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gc21hbGxGb250KGI6IEJvb2xlYW4pOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIG15U21hbGxGb250ID0gYlxuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBvdmVybGFwKGI6IEJvb2xlYW4pOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIG15T3ZlcmxhcCA9IGJcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gbGFiZWxBZGRpdGlvbmFsT2Zmc2V0cyhsOiBMaXN0PERvdWJsZVZlY3Rvcj4/KTogQnVpbGRlciB7XG4gICAgICAgICAgICBteUxhYmVsQWRkaXRpb25hbE9mZnNldHMgPSBsXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAg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ZWFrcyhtYXhDb3VudCwgYXhpc0xlbmd0aClcblxuICAgICAgICBpZiAobWF4Q291bnQgPT0gMSAmJiAhYnJlYWtzLmlzRW1wdHkpIHtcbiAgICAgICAgICAgIHJldHVybiBHdWlkZUJyZWFrcyhcbiAgICAgICAgICAgICAgICBicmVha3MuZG9tYWluVmFsdWVzLnN1Ykxpc3QoXG4gICAgICAgICAgICAgICAgICAgIDAsXG4gICAgICAgICAgICAgICAgICAgIDFcbiAgICAgICAgICAgICAgICApLCBicmVha3MudHJhbnNmb3JtZWRWYWx1ZXMuc3ViTGlzdCgwLCAxKSwgYnJlYWtzLmxhYmVscy5zdWJMaXN0KDAsIDEpXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICAgICAgdmFyIGNvdW50ID0gbWF4Q291bnRcbiAgICAgICAgd2hpbGUgKGJyZWFrcy5zaXplKCkgPiBtYXhDb3VudCkge1xuICAgICAgICAgICAgdmFsIGRlbHRhID0gbWF4KDEsIChicmVha3Muc2l6ZSgpIC0gbWF4Q291bnQpIC8gMilcbiAgICAgICAgICAgIGNvdW50IC09IGRlbHRhXG4gICAgICAgICAgICBicmVha3MgPSBicmVha3NQcm92aWRlci5nZXRCcmVha3MoY291bnQsIGF4aXNMZW5ndGgpXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGJyZWFrc1xuICAgIH1cblxuICAgIGZ1biBtYXhMZW5ndGgobGFiZWxzOiBMaXN0PFN0cmluZz4pOiBJbnQge1xuICAgICAgICB2YXIgbWF4ID0gMFxuICAgICAgICBmb3IgKGxhYmVsIGluIGxhYmVscykge1xuICAgICAgICAgICAgbWF4ID0gbWF4KG1heCwgbGFiZWwubGVuZ3RoKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtYXhcbiAgICB9XG5cbiAgICBmdW4gaG9yaXpvbnRhbENlbnRlcmVkTGFiZWxCb3VuZHMobGFiZWxTaXplOiBEb3VibGVWZWN0b3IpOiBEb3VibGVSZWN0YW5nbGUge1xuICAgICAgICByZXR1cm4gRG91YmxlUmVjdGFuZ2xlKC1sYWJlbFNpemUueCAvIDIuMCwgMC4wLCBsYWJlbFNpemUueCwgbGFiZWxTaXplLnkpXG4gICAgfVxuXG4gICAgZnVuIGRvTGF5b3V0VmVydGljYWxBeGlzTGFiZWxzKFxuICAgICAgICBvcmllbnRhdGlvbjogamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5ndWlkZS5PcmllbnRhdGlvbixcbiAgICAgICAgYnJlYWtzOiBHdWlkZUJyZWFrcyxcbiAgICAgICAgYXhpc0RvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgYXhpc01hcHBlcjogKERvdWJsZT8pIC0+IERvdWJsZT8sXG4gICAgICAgIHRoZW1lOiBBeGlzVGhlbWVcbiAgICApOiBBeGlzTGFiZWxzTGF5b3V0SW5mbyB7XG5cbiAgICAgICAgdmFsIGF4aXNCb3VuZHMgPSB3aGVuIHtcbiAgICAgICAgICAgIHRoZW1lLnNob3dUaWNrTGFiZWxzKCkgLT4ge1xuICAgICAgICAgICAgICAgIHZhbCBsYWJlbHNCb3VuZHMgPVxuICAgICAgICAgICAgICAgICAgICB2ZXJ0aWNhbEF4aXNMYWJlbHNCb3VuZHMoXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha3MsXG4gICAgICAgICAgICAgICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgICAgICAgICAgICAgYXhpc01hcHBlclxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgYXBwbHlMYWJlbHNPZmZzZXQoXG4gICAgICAgICAgICAgICAgICAgIGxhYmVsc0JvdW5kcyxcbiAgICAgICAgICAgICAgICAgICAgdGhlbWUudGlja0xhYmVsRGlzdGFuY2UoKSxcbiAgICAgICAgICAgICAgICAgICAgb3JpZW50YXRpb25cbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGVtZS5zaG93VGlja01hcmtzKCkgLT4ge1xuICAgICAgICAgICAgICAgIHZhbCBsYWJlbHNCb3VuZHMgPSBEb3VibGVSZWN0YW5nbGUoRG91YmxlVmVjdG9yLlpFUk8sIERvdWJsZVZlY3Rvci5aRVJPKVxuICAgICAgICAgICAgICAgIGFwcGx5TGFiZWxzT2Zmc2V0KFxuICAgICAgICAgICAgICAgICAgICBsYWJlbHNCb3VuZHMsXG4gICAgICAgICAgICAgICAgICAgIHRoZW1lLnRpY2tMYWJlbERpc3RhbmNlKCksXG4gICAgICAgICAgICAgICAgICAgIG9yaWVudGF0aW9uXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSAtPiBEb3VibGVSZWN0YW5nbGUoRG91YmxlVmVjdG9yLlpFUk8sIERvdWJsZVZlY3Rvci5aRVJPKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIEF4aXNMYWJlbHNMYXlvdXRJbmZvLkJ1aWxkZXIoKVxuICAgICAgICAgICAgLmJyZWFrcyhicmVha3MpXG4gICAgICAgICAgICAuYm91bmRzKGF4aXNCb3VuZHMpICAgICAvLyBsYWJlbCBib3VuZHMgYWN0dWFsbHlcbiAgICAgICAgICAgIC5idWlsZCgpXG4gICAgfVxuXG4gICAgZnVuIG1hcFRvQXhpcyhcbiAgICAgICAgYnJlYWtzOiBMaXN0PERvdWJsZT4sXG4gICAgICAgIGF4aXNEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIGF4aXNNYXBwZXI6IChEb3VibGU/KSAtPiBEb3VibGU/XG4gICAgKTogTGlzdDxEb3VibGU+IHtcbiAgICAgICAgdmFsIGF4aXNNaW4gPSBheGlzRG9tYWluLmxvd2VyRW5kXG4gICAgICAgIHZhbCBheGlzQnJlYWtzID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICBmb3IgKHYgaW4gYnJlYWtzKSB7XG4gICAgICAgICAgICB2YWwgbWFwcGVkID0gYXhpc01hcHBlcih2IC0gYXhpc01pbilcbiAgICAgICAgICAgIGF4aXNCcmVha3MuYWRkKG1hcHBlZCEhKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBheGlzQnJlYWtzXG4gICAgfVxuXG4gICAgZnVuIGFwcGx5TGFiZWxzT2Zmc2V0KFxuICAgICAgICBsYWJlbHNCb3VuZHM6IERvdWJsZVJlY3RhbmdsZSxcbiAgICAgICAgb2Zmc2V0OiBEb3VibGUsXG4gICAgICAgIG9yaWVudGF0aW9uOiBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmd1aWRlLk9yaWVudGF0aW9uXG4gICAgKTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgQFN1cHByZXNzKFwiTkFNRV9TSEFET1dJTkdcIilcbiAgICAgICAgdmFyIGxhYmVsc0JvdW5kcyA9IGxhYmVsc0JvdW5kc1xuICAgICAgICB2YWwgb2Zmc2V0VmVjdG9yID0gd2hlbiAob3JpZW50YXRpb24pIHtcbiAgICAgICAgICAgIExFRlQgLT4gRG91YmxlVmVjdG9yKC1vZmZzZXQsIDAuMClcbiAgICAgICAgICAgIFJJR0hUIC0+IERvdWJsZVZlY3RvcihvZmZzZXQsIDAuMClcbiAgICAgICAgICAgIFRPUCAtPiBEb3VibGVWZWN0b3IoMC4wLCAtb2Zmc2V0KVxuICAgICAgICAgICAgQk9UVE9NIC0+IERvdWJsZVZlY3RvcigwLjAsIG9mZnNldClcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChvcmllbnRhdGlvbiA9PT0gUklHSFQgfHwgb3JpZW50YXRpb24gPT09IEJPVFRPTSkge1xuICAgICAgICAgICAgbGFiZWxzQm91bmRzID0gbGFiZWxzQm91bmRzLmFkZChvZmZzZXRWZWN0b3IpXG4gICAgICAgIH0gZWxzZSBpZiAob3JpZW50YXRpb24gPT09IExFRlQgfHwgb3JpZW50YXRpb24gPT09IFRPUCkge1xuICAgICAgICAgICAgbGFiZWxzQm91bmRzID0gbGFiZWxzQm91bmRzLmFkZChvZmZzZXRWZWN0b3IpLnN1YnRyYWN0KERvdWJsZVZlY3RvcihsYWJlbHNCb3VuZHMud2lkdGgsIDAuMCkpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbGFiZWxzQm91bmRzXG4gICAgfVxuXG5cbiAgICBwcml2YXRlIGZ1biB2ZXJ0aWNhbEF4aXNMYWJlbHNCb3VuZHMoXG4gICAgICAgIGJyZWFrczogR3VpZGVCcmVha3MsXG4gICAgICAgIGF4aXNEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIGF4aXNNYXBwZXI6IChEb3VibGU/KSAtPiBEb3VibGU/XG4gICAgKTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgdmFsIG1heExlbmd0aCA9XG4gICAgICAgICAgICBtYXhMZW5ndGgoYnJlYWtzLmxhYmVscylcbiAgICAgICAgdmFsIG1heExhYmVsV2lkdGggPSBBeGlzTGFiZWxzTGF5b3V0LlRJQ0tfTEFCRUxfU1BFQy53aWR0aChtYXhMZW5ndGgpXG4gICAgICAgIHZhciB5MSA9IDAuMFxuICAgICAgICB2YXIgeTIgPSAwLjBcbiAgICAgICAgaWYgKCFicmVha3MuaXNFbXB0eSkge1xuICAgICAgICAgICAgdmFsIGF4aXNCcmVha3MgPVxuICAgICAgICAgICAgICAgIG1hcFRvQXhpcyhcbiAgICAgICAgICAgICAgICAgICAgYnJlYWtzLnRyYW5zZm9ybWVkVmFsdWVzLFxuICAgICAgICAgICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgICAgICAgICBheGlzTWFwcGVyXG4gICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICB5MSA9IG1pbihheGlzQnJlYWtzWzBdLCBJdGVyYWJsZXMuZ2V0TGFzdChheGlzQnJlYWtzKSlcbiAgICAgICAgICAgIHkyID0gbWF4KGF4aXNCcmVha3NbMF0sIEl0ZXJhYmxlcy5nZ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bmRzKSkge1xuICAgICAgICAgICAgICAgICAgICBsYWJlbHNJbmZvID0gdmVydGljYWxMYXlvdXQobGFiZWxTcGVjKS5kb0xheW91dChheGlzTGVuZ3RoLCBheGlzTWFwcGVyLCBtYXhMYWJlbHNCb3VuZHMpXG4gICAgICAgICAgICAgICAgICAgIGlmIChvdmVybGFwKGxhYmVsc0luZm8sIG1heExhYmVsc0JvdW5kcykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsc0luZm8gPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnRpY2FsTGF5b3V0KFRJQ0tfTEFCRUxfU1BFQ19TTUFMTCkuZG9MYXlvdXQoYXhpc0xlbmd0aCwgYXhpc01hcHBlciwgbWF4TGFiZWxzQm91bmRzKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBsYWJlbHNJbmZvXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gc2ltcGxlTGF5b3V0KCk6IEF4aXNMYWJlbHNMYXlvdXQge1xuICAgICAgICByZXR1cm4gSG9yaXpvbnRhbFNpbXBsZUxhYmVsc0xheW91dChcbiAgICAgICAgICAgIG9yaWVudGF0aW9uLFxuICAgICAgICAgICAgYXhpc0RvbWFpbixcbiAgICAgICAgICAgIGxhYmVsU3BlYyxcbiAgICAgICAgICAgIGJyZWFrcyxcbiAgICAgICAgICAgIHRoZW1lXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBtdWx0aWxpbmVMYXlvdXQoKTogQXhpc0xhYmVsc0xheW91dCB7XG4gICAgICAgIHJldHVybiBIb3Jpem9udGFsTXVsdGlsaW5lTGFiZWxzTGF5b3V0KFxuICAgICAgICAgICAgb3JpZW50YXRpb24sXG4gICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgbGFiZWxTcGVjLFxuICAgICAgICAgICAgYnJlYWtzLFxuICAgICAgICAgICAgdGhlbWUsXG4gICAgICAgICAgICAyXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB0aWx0ZWRMYXlvdXQoKTogQXhpc0xhYmVsc0xheW91dCB7XG4gICAgICAgIHJldHVybiBIb3Jpem9udGFsVGlsdGVkTGFiZWxzTGF5b3V0KFxuICAgICAgICAgICAgb3JpZW50YXRpb24sXG4gICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgbGFiZWxTcGVjLFxuICAgICAgICAgICAgYnJlYWtzLFxuICAgICAgICAgICAgdGhlbWVcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHZlcnRpY2FsTGF5b3V0KGxhYmVsU3BlYzogUGxvdExhYmVsU3BlYyk6IEF4aXNMYWJlbHNMYXlvdXQge1xuICAgICAgICByZXR1cm4gSG9yaXpvbnRhbFZlcnRpY2FsTGFiZWxzTGF5b3V0KFxuICAgICAgICAgICAgb3JpZW50YXRpb24sXG4gICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgbGFiZWxTcGVjLFxuICAgICAgICAgICAgYnJlYWtzLFxuICAgICAgICAgICAgdGhlbWVcbiAgICAgICAgKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBsYWJlbEJvdW5kcyhsYWJlbE5vcm1hbFNpemU6IERvdWJsZVZlY3Rvcik6IERvdWJsZVJlY3RhbmdsZSB7XG4gICAgICAgIHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbihcIk5vdCBpbXBsZW1lbnRlZCBoZXJlXCIpXG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFT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1aXJlKG9yaWVudGF0aW9uLmlzSG9yaXpvbnRhbCkgeyBvcmllbnRhdGlvbi50b1N0cmluZygpIH1cbiAgICAgICAgcmVxdWlyZSghbXlCcmVha3NQcm92aWRlci5pc0ZpeGVkQnJlYWtzKSB7IFwiZml4ZWQgYnJlYWtzXCIgfVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBkb0xheW91dChcbiAgICAgICAgYXhpc0xlbmd0aDogRG91YmxlLFxuICAgICAgICBheGlzTWFwcGVyOiAoRG91YmxlPykgLT4gRG91YmxlPyxcbiAgICAgICAgbWF4TGFiZWxzQm91bmRzOiBEb3VibGVSZWN0YW5nbGU/XG4gICAgKTogQXhpc0xhYmVsc0xheW91dEluZm8ge1xuXG4gICAgICAgIHZhciB0YXJnZXRCcmVha0NvdW50ID1cbiAgICAgICAgICAgIEhvcml6b250YWxTaW1wbGVMYWJlbHNMYXlvdXQuZXN0aW1hdGVCcmVha0NvdW50SW5pdGlhbChcbiAgICAgICAgICAgICAgICBheGlzTGVuZ3RoXG4gICAgICAgICAgICApXG4gICAgICAgIHZhciBicmVha3MgPSBnZXRCcmVha3ModGFyZ2V0QnJlYWtDb3VudCwgYXhpc0xlbmd0aClcbiAgICAgICAgdmFyIGxhYmVsc0luZm8gPSBkb0xheW91dExhYmVscyhicmVha3MsIGF4aXNMZW5ndGgsIGF4aXNNYXBwZXIsIG1heExhYmVsc0JvdW5kcylcblxuICAgICAgICB3aGlsZSAobGFiZWxzSW5mby5pc092ZXJsYXApIHtcbiAgICAgICAgICAgIC8vIHJlZHVjZSB0aWNrIGNvdW50XG4gICAgICAgICAgICB2YWwgbmV3VGFyZ2V0QnJlYWtDb3VudCA9XG4gICAgICAgICAgICAgICAgSG9yaXpvbnRhbFNpbXBsZUxhYmVsc0xheW91dC5lc3RpbWF0ZUJyZWFrQ291bnQoXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrcy5sYWJlbHMsXG4gICAgICAgICAgICAgICAgICAgIGF4aXNMZW5ndGhcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICBpZiAobmV3VGFyZ2V0QnJlYWtDb3VudCA+PSB0YXJnZXRCcmVha0NvdW50KSB7XG4gICAgICAgICAgICAgICAgLy8gcGFyYW5vaWQgLSBoaWdobHkgaW1wb3NzaWJsZS5cbiAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGFyZ2V0QnJlYWtDb3VudCA9IG5ld1RhcmdldEJyZWFrQ291bnRcbiAgICAgICAgICAgIGJyZWFrcyA9IGdldEJyZWFrcyh0YXJnZXRCcmVha0NvdW50LCBheGlzTGVuZ3RoKVxuICAgICAgICAgICAgbGFiZWxzSW5mbyA9IGRvTGF5b3V0TGFiZWxzKGJyZWFrcywgYXhpc0xlbmd0aCwgYXhpc01hcHBlciwgbWF4TGFiZWxzQm91bmRzKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGxhYmVsc0luZm9cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBkb0xheW91dExhYmVscyhcbiAgICAgICAgYnJlYWtzOiBHdWlkZUJyZWFrcyxcbiAgICAgICAgYXhpc0xlbmd0aDogRG91YmxlLFxuICAgICAgICBheGlzTWFwcGVyOiAoRG91YmxlPykgLT4gRG91YmxlPyxcbiAgICAgICAgbWF4TGFiZWxzQm91bmRzOiBEb3VibGVSZWN0YW5nbGU/XG4gICAgKTogQXhpc0xhYmVsc0xheW91dEluZm8ge1xuXG4gICAgICAgIHZhbCBsYXlvdXQgPSBIb3Jpem9udGFsU2ltcGxlTGFiZWxzTGF5b3V0KFxuICAgICAgICAgICAgb3JpZW50YXRpb24sXG4gICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgbGFiZWxTcGVjLFxuICAgICAgICAgICAgYnJlYWtzLFxuICAgICAgICAgICAgdGhlbWVcbiAgICAgICAgKVxuICAgICAgICByZXR1cm4gbGF5b3V0LmRvTGF5b3V0KGF4aXNMZW5ndGgs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AgICB9XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBkb0xheW91dChcbiAgICAgICAgICAgIGF4aXNMZW5ndGg6IERvdWJsZSxcbiAgICAgICAgICAgIGF4aXNNYXBwZXI6IChEb3VibGU/KSAtPiBEb3VibGU/LFxuICAgICAgICAgICAgbWF4TGFiZWxzQm91bmRzOiBEb3VibGVSZWN0YW5nbGU/KTogQXhpc0xhYmVsc0xheW91dEluZm8ge1xuXG4gICAgICAgIHZhbCBib3VuZHNCeVNoZWxmSW5kZXggPSBIYXNoTWFwPEludCwgRG91YmxlUmVjdGFuZ2xlPigpXG4gICAgICAgIHZhbCB0aWNrcyA9IG1hcFRvQXhpcyhicmVha3MudHJhbnNmb3JtZWRWYWx1ZXMsIGF4aXNNYXBwZXIpXG4gICAgICAgIHZhbCBib3VuZHNMaXN0ID0gbGFiZWxCb3VuZHNMaXN0KHRpY2tzLCBicmVha3MubGFiZWxzLFxuICAgICAgICAgICAgSE9SSVpPTlRBTF9USUNLX0xPQ0FUSU9OXG4gICAgICAgIClcblxuICAgICAgICBmb3IgKGxhYmVsQm91bmRzIGluIGJvdW5kc0xpc3QpIHtcbiAgICAgICAgICAgIC8vIGZpbmQgc2hlbGYgd2l0aCBubyBvdmVybGFwXG4gICAgICAgICAgICB2YXIgc2hlbGZJbmRleCA9IDBcbiAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFib3VuZHNCeVNoZWxmSW5kZXguY29udGFpbnNLZXkoc2hlbGZJbmRleCkpIHtcbiAgICAgICAgICAgICAgICAgICAgYm91bmRzQnlTaGVsZkluZGV4W3NoZWxmSW5kZXhdID0gbGFiZWxCb3VuZHNcbiAgICAgICAgICAgICAgICAgICAgbXlTaGVsZkluZGV4Rm9yVGlja0luZGV4LmFkZChzaGVsZkluZGV4KVxuICAgICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHZhciBzaGVsZkJvdW5kcyA9IGJvdW5kc0J5U2hlbGZJbmRleFtzaGVsZkluZGV4XSEhXG4gICAgICAgICAgICAgICAgLy8gbm90IG92ZXJsYXBwZWQ/XG4gICAgICAgICAgICAgICAgaWYgKCFzaGVsZkJvdW5kcy54UmFuZ2UoKS5pc0Nvbm5lY3RlZChDbG9zZWRSYW5nZShsYWJlbEJvdW5kcy5sZWZ0IC0gTUlOX0RJU1RBTkNFLCBsYWJlbEJvdW5kcy5yaWdodCArIE1JTl9ESVNUQU5DRSkpKSB7XG4gICAgICAgICAgICAgICAgICAgIG15U2hlbGZJbmRleEZvclRpY2tJbmRleC5hZGQoc2hlbGZJbmRleClcbiAgICAgICAgICAgICAgICAgICAgc2hlbGZCb3VuZHMgPSBzaGVsZkJvdW5kcy51bmlvbihsYWJlbEJvdW5kcylcbiAgICAgICAgICAgICAgICAgICAgYm91bmRzQnlTaGVsZkluZGV4W3NoZWxmSW5kZXhdID0gc2hlbGZCb3VuZHNcbiAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBzaGVsZkluZGV4KytcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBib3VuZHMgPSBpZiAoYm91bmRzQnlTaGVsZkluZGV4LmlzRW1wdHkoKSlcbiAgICAgICAgICAgIERvdWJsZVJlY3RhbmdsZShEb3VibGVWZWN0b3IuWkVSTywgRG91YmxlVmVjdG9yLlpFUk8pXG4gICAgICAgIGVsc2VcbiAgICAgICAgICAgIGJvdW5kc0J5U2hlbGZJbmRleFswXSEhXG4gICAgICAgIHZhbCBoID0gbGFiZWxTcGVjLmhlaWdodCgpICogTElORV9IRUlHSFRcbiAgICAgICAgZm9yIChpIGluIDAgdW50aWwgYm91bmRzQnlTaGVsZkluZGV4LnNpemUpIHtcbiAgICAgICAgICAgIHZhbCBzaGVsZkJvdW5kcyA9IGJvdW5kc0J5U2hlbGZJbmRleFtpXSEhXG4gICAgICAgICAgICBib3VuZHMgPSBib3VuZHMudW5pb24oc2hlbGZCb3VuZHMuYWRkKERvdWJsZVZlY3RvcigwLjAsIGkgKiBoKSkpXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbGluZXNDb3VudCA9IGJvdW5kc0J5U2hlbGZJbmRleC5zaXplXG4gICAgICAgIHJldHVybiBBeGlzTGFiZWxzTGF5b3V0SW5mby5CdWlsZGVyKClcbiAgICAgICAgICAgICAgICAuYnJlYWtzKGJyZWFrcylcbiAgICAgICAgICAgICAgICAuYm91bmRzKGFwcGx5TGFiZWxzT2Zmc2V0KGJvdW5kcykpXG4gICAgICAgICAgICAgICAgLnNtYWxsRm9udChmYWxzZSlcbiAgICAgICAgICAgICAgICAub3ZlcmxhcChsaW5lc0NvdW50ID4gbXlNYXhMaW5lcylcbiAgICAgICAgICAgICAgICAubGFiZWxBZGRpdGlvbmFsT2Zmc2V0cyhsYWJlbEFkZGl0aW9uYWxPZmZzZXRzKVxuICAgICAgICAgICAgICAgIC5sYWJlbEhvcml6b250YWxBbmNob3IoVGV4dExhYmVsLkhvcml6b250YWxBbmNob3IuTUlERExFKVxuICAgICAgICAgICAgICAgIC5sYWJlbFZlcnRpY2FsQW5jaG9yKFRleHRMYWJlbC5WZXJ0aWNhbEFuY2hvci5UT1ApXG4gICAgICAgICAgICAgICAgLmJ1aWxkKClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gbGFiZWxCb3VuZHMobGFiZWxOb3JtYWxTaXplOiBEb3VibGVWZWN0b3IpOiBEb3VibGVSZWN0YW5nbGUge1xuICAgICAgICByZXR1cm4gQnJlYWtMYWJlbHNMYXlvdXRVdGlsLmhvcml6b250YWxDZW50ZXJlZExhYmVsQm91bmRzKFxuICAgICAgICAgICAgbGFiZWxOb3JtYWxTaXplXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHt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3RhbmdsZT8gPSBudWxsXG4gICAgICAgIHZhciBvdmVybGFwID0gZmFsc2VcbiAgICAgICAgdmFsIHRpY2tzID0gbWFwVG9BeGlzKGJyZWFrcy50cmFuc2Zvcm1lZFZhbHVlcywgYXhpc01hcHBlcilcblxuICAgICAgICB2YWwgYm91bmRzTGlzdCA9IGxhYmVsQm91bmRzTGlzdCh0aWNrcywgYnJlYWtzLmxhYmVscyxcbiAgICAgICAgICAgIEhPUklaT05UQUxfVElDS19MT0NBVElPTlxuICAgICAgICApXG4gICAgICAgIGZvciAobGFiZWxCb3VuZHMgaW4gYm91bmRzTGlzdCkge1xuICAgICAgICAgICAgb3ZlcmxhcCA9IG92ZXJsYXAgfHwgYm91bmRzICE9IG51bGwgJiYgYm91bmRzLnhSYW5nZSgpLmlzQ29ubmVjdGVkKFxuICAgICAgICAgICAgICAgICAgICBTZXJpZXNVdGlsLmV4cGFuZChsYWJlbEJvdW5kcy54UmFuZ2UoKSwgTUlOX1RJQ0tfTEFCRUxfRElTVEFOQ0UgLyAyLCBNSU5fVElDS19MQUJFTF9ESVNUQU5DRSAvIDIuMCkpXG4gICAgICAgICAgICBib3VuZHMgPSBHZW9tZXRyeVV0aWwudW5pb24obGFiZWxCb3VuZHMsIGJvdW5kcylcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBBeGlzTGFiZWxzTGF5b3V0SW5mby5CdWlsZGVyKClcbiAgICAgICAgICAgICAgICAuYnJlYWtzKGJyZWFrcylcbiAgICAgICAgICAgICAgICAuYm91bmRzKGFwcGx5TGFiZWxzT2Zmc2V0KGJvdW5kcyEhKSlcbiAgICAgICAgICAgICAgICAuc21hbGxGb250KGZhbHNlKVxuICAgICAgICAgICAgICAgIC5vdmVybGFwKG92ZXJsYXApXG4gICAgICAgICAgICAgICAgLmxhYmVsQWRkaXRpb25hbE9mZnNldHMobnVsbClcbiAgICAgICAgICAgICAgICAubGFiZWxIb3Jpem9udGFsQW5jaG9yKFRleHRMYWJlbC5Ib3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5cbiAgICBvdmVycmlkZSBmdW4gbGFiZWxCb3VuZHMobGFiZWxOb3JtYWxTaXplOiBEb3VibGVWZWN0b3IpOiBEb3VibGVSZWN0YW5nbGUge1xuICAgICAgICByZXR1cm4gQnJlYWtMYWJlbHNMYXlvdXRVdGlsLmhvcml6b250YWxDZW50ZXJlZExhYmVsQm91bmRzKFxuICAgICAgICAgICAgbGFiZWxOb3JtYWxTaXplXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgZnVuIGVzdGltYXRlQnJlYWtDb3VudEluaXRpYWwoYXhpc0xlbmd0aDogRG91YmxlKTogSW50IHtcbiAgICAgICAgICAgIHJldHVybiBlc3RpbWF0ZUJyZWFrQ291bnQoXG4gICAgICAgICAgICAgICAgSU5JVElBTF9USUNLX0xBQkVMX0xFTkdUSCxcbiAgICAgICAgICAgICAgICBheGlzTGVuZ3RoXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZXN0aW1hdGVCcmVha0NvdW50KGxhYmVsczogTGlzdDxTdHJpbmc+LCBheGlzTGVuZ3RoOiBEb3VibGUpOiBJbnQge1xuICAgICAgICAgICAgdmFsIG1heExlbmd0aCA9XG4gICAgICAgICAgICAgICAgQnJlYWtMYWJlbHNMYXlvdXRVdGlsLm1heExlbmd0aChcbiAgICAgICAgICAgICAgICAgICAgbGFiZWxzXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgcmV0dXJuIGVzdGltYXRlQnJlYWtDb3VudChcbiAgICAgICAgICAgICAgICBtYXhMZW5ndGgsXG4gICAgICAgICAgICAgICAgYXhpc0xlbmd0aFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZXN0aW1hdGVCcmVha0NvdW50KGxhYmVsTGVuZ3RoOiBJbnQsIGF4aXNMZW5ndGg6IERvdWJsZSk6IEludCB7XG4gICAgICAgICAgICB2YWwgdGl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ICAgICAgICAgLmxhYmVsVmVydGljYWxBbmNob3IobGFiZWxWZXJ0aWNhbEFuY2hvcilcbiAgICAgICAgICAgICAgICAubGFiZWxSb3RhdGlvbkFuZ2xlKFJPVEFUSU9OX0RFR1JFRSlcbiAgICAgICAgICAgICAgICAuYnVpbGQoKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBsYWJlbEJvdW5kcyhsYWJlbE5vcm1hbFNpemU6IERvdWJsZVZlY3Rvcik6IERvdWJsZVJlY3RhbmdsZSB7XG4gICAgICAgIC8vIG9ubHkgd29ya3MgZm9yIFJJR0hULVRPUCBhbmNob3IgYW5nIGFuZ2xlIDAuLi05MFxuICAgICAgICBpZiAoIShST1RBVElPTl9ERUdSRUUgPj0gLTkwICYmIFJPVEFUSU9OX0RFR1JFRSA8PSAwXG4gICAgICAgICAgICAgICAgICAgICAgICAmJiBsYWJlbEhvcml6b250YWxBbmNob3IgPT09IFRleHRMYWJlbC5Ib3Jpem9udGFsQW5jaG9yLlJJR0hUXG4gICAgICAgICAgICAgICAgICAgICAgICAmJiBsYWJlbFZlcnRpY2FsQW5jaG9yID09PSBUZXh0TGFiZWwuVmVydGljYWxBbmNob3IuVE9QKSkge1xuICAgICAgICAgICAgdGhyb3cgUnVudGltZUV4Y2VwdGlvbihcIk5vdCBpbXBsZW1lbnRlZFwiKVxuICAgICAgICB9XG5cblxuICAgICAgICB2YWwgdyA9IGFicyhsYWJlbE5vcm1hbFNpemUueCAqIENPUykgKyAyICogYWJzKGxhYmVsTm9ybWFsU2l6ZS55ICogU0lOKVxuICAgICAgICB2YWwgaCA9IGFicyhsYWJlbE5vcm1hbFNpemUueCAqIFNJTikgKyBhYnMobGFiZWxOb3JtYWxTaXplLnkgKiBDT1MpXG4gICAgICAgIHZhbCB4ID0gLShhYnMobGFiZWxOb3JtYWxTaXplLnggKiBDT1MpICsgYWJzKGxhYmVsTm9ybWFsU2l6ZS55ICogU0lOKSlcbiAgICAgICAgdmFsIHkgPSAwLjB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WJlbEhvcml6b250YWxBbmNob3IobGFiZWxIb3Jpem9udGFsQW5jaG9yKVxuICAgICAgICAgICAgICAgIC5sYWJlbFZlcnRpY2FsQW5jaG9yKGxhYmVsVmVydGljYWxBbmNob3IpXG4gICAgICAgICAgICAgICAgLmxhYmVsUm90YXRpb25BbmdsZShST1RBVElPTl9ERUdSRUUpXG4gICAgICAgICAgICAgICAgLmJ1aWxkKClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gbGFiZWxCb3VuZHMobGFiZWxOb3JtYWxTaXplOiBEb3VibGVWZWN0b3IpOiBEb3VibGVSZWN0YW5nbGUge1xuICAgICAgICBpZiAoIShST1RBVElPTl9ERUdSRUUgPT0gOTAuMFxuICAgICAgICAgICAgICAgICAgICAgICAgJiYgbGFiZWxIb3Jpem9udGFsQW5jaG9yID09PSBUZXh0TGFiZWwuSG9yaXpvbnRhbEFuY2hvci5MRUZUXG4gICAgICAgICAgICAgICAgICAgICAgICAmJiBsYWJlbFZlcnRpY2FsQW5jaG9yID09PSBUZXh0TGFiZWwuVmVydGljYWxBbmNob3IuQ0VOVEVSKSkge1xuICAgICAgICAgICAgdGhyb3cgUnVudGltZUV4Y2VwdGlvbihcIk5vdCBpbXBsZW1lbnRlZFwiKVxuICAgICAgICB9XG4gICAgICAgIHZhbCB3ID0gbGFiZWxOb3JtYWxTaXplLnlcbiAgICAgICAgdmFsIGggPSBsYWJlbE5vcm1hbFNpemUueFxuICAgICAgICB2YWwgeCA9IC13IC8gMlxuICAgICAgICB2YWwgeSA9IDAuMFxuICAgICAgICByZXR1cm4gRG91YmxlUmVjdGFuZ2xlKHgsIHksIHcsIGgpXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHByaXZhdGUgY29uc3QgdmFsIE1JTl9ESVNUQU5DRSA9IDUuMFxuICAgICAgICBwcml2YXRlIGNvbnN0IHZhbCBST1RBVElPTl9ERUdSRUUgPSA5MC4wXG4gICAgfVxufVxuIi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5cbiAgICBjb25zdCB2YWwgQkFDS0RST1BfQ09MT1IgPSBcIndoaXRlXCJcblxuICAgIGNvbnN0IHZhbCBURVhUX0NPTE9SID0gREFSS19HUkFZXG5cbiAgICBjb25zdCB2YWwgRk9OVF9MQVJHRSA9IDE2XG4gICAgY29uc3QgdmFsIEZPTlRfTUVESVVNID0gMTJcbiAgICBjb25zdCB2YWwgRk9OVF9TTUFMTCA9IDEwXG4gICAgY29uc3QgdmFsIEZPTlRfWF9TTUFMTCA9IDhcblxuICAgIGNvbnN0IHZhbCBGT05UX0ZBTUlMWV9OT1JNQUwgPSBcIlxcXCJMdWNpZGEgR3JhbmRlXFxcIiwgc2Fucy1zZXJpZlwiXG4gICAgY29uc3QgdmFsIEZPTlRfRkFNSUxZX01PTk9TUEFDRUQgPSBcIlxcXCJDb3VyaWVyIE5ld1xcXCIsIENvdXJpZXIsIG1vbm9zcGFjZVwiXG5cbiAgICBjbGFzcyBDb21tb24ge1xuICAgICAgICBvYmplY3QgVGl0bGUge1xuICAgICAgICAgICAgY29uc3QgdmFsIEZPTlRfU0laRSA9IEZPTlRfTEFSR0VcbiAgICAgICAgICAgIHZhbCBGT05UX1NJWkVfQ1NTID0gXCJcIiArIEZPTlRfU0laRSArIFwicHhcIlxuICAgICAgICB9XG5cbiAgICAgICAgb2JqZWN0IExlZ2VuZCB7XG4gICAgICAgICAgICBjb25zdCB2YWwgVElUTEVfRk9OVF9TSVpFID1cbiAgICAgICAgICAgICAgICBGT05UX01FRElVTVxuICAgICAgICAgICAgY29uc3QgdmFsIElURU1fRk9OVF9TSVpFID1cbiAgICAgICAgICAgICAgICBGT05UX1NNQUxMXG4gICAgICAgICAgICB2YWwgT1VUTElORV9DT0xPUiA9IENvbG9yLnBhcnNlSGV4KFhYX0xJR0hUX0dSQVkpXG4gICAgICAgIH1cblxuICAgICAgICBvYmplY3QgVG9vbHRpcCB7XG4gICAgICAgICAgICBjb25zdCB2YWwgTUFYX1BPSU5URVJfRk9PVElOR19MRU5HVEggPSAxMi4wXG4gICAgICAgICAgICBjb25zdCB2YWwgUE9JTlRFUl9GT09USU5HX1RPX1NJREVfTEVOR1RIX1JBVElPID0gMC40XG5cbiAgICAgICAgICAgIGNvbnN0IHZhbCBNQVJHSU5fQkVUV0VFTl9UT09MVElQUyA9IDUuMFxuICAgICAgICAgICAgY29uc3QgdmFsIERBVEFfVE9PTFRJUF9GT05UX1NJWkUgPSBGT05UX01FRElVTVxuICAgICAgICAgICAgY29uc3QgdmFsIExJTkVfSU5URVJWQUwgPSAzLjBcbiAgICAgICAgICAgIGNvbnN0IHZhbCBIX0NPTlRFTlRfUEFERElORyA9IDQuMFxuICAgICAgICAgICAgY29uc3QgdmFsIFZfQ09OVEVOVF9QQURESU5HID0gNC4wXG4gICAgICAgICAgICBjb25zdCB2YWwgTEFCRUxfVkFMVUVfSU5URVJWQUwgPSA4LjBcblxuICAgICAgICAgICAgY29uc3QgdmFsIEJPUkRFUl9XSURUSCA9IDQuMFxuXG4gICAgICAgICAgICB2YWwgREFSS19URVhUX0NPTE9SID0gQ29sb3IuQkxBQ0tcbiAgICAgICAgICAgIHZhbCBMSUdIVF9URVhUX0NPTE9SID0gQ29sb3IuV0hJVEVcblxuICAgICAgICAgICAgY29uc3QgdmFsIEFYSVNfVE9PTFRJUF9GT05UX1NJWkUgPSBEQVRBX1RPT0xUSVBfRk9OVF9TSVpFXG4gICAgICAgICAgICB2YWwgQVhJU19UT09MVElQX0NPTE9SID0gQXhpcy5MSU5FX0NPTE9SXG4gICAgICAgICAgICBjb25zdCB2YWwgQVhJU19SQURJVVMgPSAxLjUgLy8gZml4IGEgdG9vbHRpcCBib3JkZXIgb3ZlcmxhcHBpbmcgYW4gYXhpc1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgY2xhc3MgVGFibGUge1xuICAgICAgICBvYmplY3QgSGVhZCB7XG4gICAgICAgICAgICBjb25zdCB2YWwgRk9OVF9TSVpFID0gRk9OVF9NRURJVU1cbiAgICAgICAgICAgIGNvbnN0IHZhbCBGT05UX1NJWkVfQ1NTID0gXCJcIiArIEZPTlRfU0laRSArIFwicHhcIlxuICAgICAgICB9XG5cbiAgICAgICAgb2JqZWN0IERhdGEge1xuICAgICAgICAgICAgY29uc3QgdmFsIEZPTlRfU0laRSA9IEZPTlRfTUVESVVNXG4gICAgICAgICAgICBjb25zdCB2YWwgRk9OVF9TSVpFX0NTUyA9IFwiXCIgKyBGT05UX1NJWkUgKyBcInB4XCJcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNsYXNzIFBsb3Qge1xuICAgICAgICBvYmplY3QgQXhpcyB7XG4gICAgICAgICAgICBjb25zdCB2YWwgVElUTEVfRk9OVF9TSVpFID1cbiAgICAgICAgICAgICAgICBGT05UX01FRElVTVxuICAgICAgICAgICAgY29uc3QgdmFsIFRJQ0tfRk9OVF9TSVpFID1cbiAgICAgICAgICAgICAgICBGT05UX1NNQUxMXG4gICAgICAgICAgICBjb25zdCB2YWwgVElDS19GT05UX1NJWkVfU01BTEwgPVxuICAgICAgICAgICAgICAgIEZPTlRfWF9TTUFMTFxuXG4gICAgICAgICAgICB2YWwgTElORV9DT0xPUiA9IENvbG9yLnBhcnNlSGV4KERBUktfR1JBWSlcbiAgICAgICAgICAgIHZhbCBUSUNLX0NPTE9SID0gQ29sb3IucGFyc2VIZXgoREFSS19HUkFZKVxuICAgICAgICAgICAgdmFsIEdSSURfTElORV9DT0xPUiA9IENvbG9yLnBhcnNlSGV4KFhfTElHSFRfR1JBWSlcblxuICAgICAgICAgICAgLy8gQnVnIGluIFdlYktpdCAoPykgOiBjb21iaW5hdGlvbiBvZiBzdHlsZVxuICAgICAgICAgICAgLy8gICAgc2hhcGUtcmVuZGVyaW5nOiBjcmlzcGVkZ2VzO1xuICAgICAgICAgICAgLy8gYW5kIHN0cm9rZS13aWR0aCBsZXNzIHRoYW4gMVxuICAgICAgICAgICAgLy8gbWFrZXMgaG9yaXpvbnRhbCBsaW5lIGRpc2FwcGVhclxuICAgICAgICAgIC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nJvd0NvdW50KClcblxuICAgICAgICB2YWwgcGlja0luZGljZXMgPSBBcnJheUxpc3Q8SW50PigpXG4gICAgICAgIHZhbCByYW5kID0gbXlTZWVkPy5sZXQgeyBSYW5kb20oaXQpIH0gPzogUmFuZG9tLkRlZmF1bHRcbiAgICAgICAgZm9yIChncm91cCBpbiBpbmRpY2VzQnlHcm91cC5rZXlzKSB7XG4gICAgICAgICAgICB2YWwgZ3JvdXBJbmRpY2VzID0gaW5kaWNlc0J5R3JvdXBbZ3JvdXBdISFcbiAgICAgICAgICAgIHZhbCBzdHJhdHVtU2l6ZSA9IGdyb3VwSW5kaWNlcy5zaXplXG4gICAgICAgICAgICAvLyBwcm9wb3J0aW9uYXRlIGFsbG9jYXRpb25cbiAgICAgICAgICAgIHZhbCByYXRpbyA9IHN0cmF0dW1TaXplLnRvRG91YmxlKCkgLyBwb3BTaXplXG5cbiAgICAgICAgICAgIHZhciBzdHJhdHVtU2FtcGxlU2l6ZSA9IHJvdW5kKHNhbXBsZVNpemUgKiByYXRpbykudG9JbnQoKVxuICAgICAgICAgICAgc3RyYXR1bVNhbXBsZVNpemUgPSBtYXgoc3RyYXR1bVNhbXBsZVNpemUsIG1pblN1YlNhbXBsZVNpemUpXG5cbiAgICAgICAgICAgIGlmIChzdHJhdHVtU2FtcGxlU2l6ZSA+PSBzdHJhdHVtU2l6ZSkge1xuICAgICAgICAgICAgICAgIHBpY2tJbmRpY2VzLmFkZEFsbChncm91cEluZGljZXMpXG4gICAgICAgICAgICB9IGVsc2Uge1xuXG4gICAgICAgICAgICAgICAgdmFsIHNhbXBsZUdyb3VwSW5kaWNlcyA9XG4gICAgICAgICAgICAgICAgICAgIFNhbXBsaW5nVXRpbC5zYW1wbGVXaXRob3V0UmVwbGFjZW1lbnQoc3RyYXR1bVNpemUsXG4gICAgICAgICAgICAgICAgICAgICAgICBzdHJhdHVtU2FtcGxlU2l6ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJhbmQsXG4gICAgICAgICAgICAgICAgICAgICAgICB7IGluZGV4U2V0IC0+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKDAgdW50aWwgZ3JvdXBJbmRpY2VzLnNpemUpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5maWx0ZXIgeyBpbmRleFNldC5jb250YWlucyhpdCkgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHsgaW5kZXhTZXQgLT5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoMCB1bnRpbCBncm91cEluZGljZXMuc2l6ZSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmZpbHRlciB7IGkgLT4gIWluZGV4U2V0LmNvbnRhaW5zKGkpIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICBmb3IgKGkgaW4gc2FtcGxlR3JvdXBJbmRpY2VzKSB7XG4gICAgICAgICAgICAgICAgICAgIHBpY2tJbmRpY2VzLmFkZChncm91cEluZGljZXNbaV0pXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHBvcHVsYXRpb24uc2VsZWN0SW5kaWNlcyhwaWNrSW5kaWNlcylcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgaW50ZXJuYWwgY29uc3QgdmFsIEFMSUFTID0gXCJyYW5kb21fc3RyYXRpZmllZFwiXG4gICAgICAgIHByaXZhdGUgY29uc3QgdmFsIERFRl9NSU5fU1VCU0FNUExFX1NJWkUgPSAyIC8vIG1pbiBuZWVkZWQgdG8gZHJhdyBhIGxpbmVcbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgTUl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fVxuICAgICAgICB9XG4gICAgICAgIGlmIChzdGFydCA+PSAwKSB7XG4gICAgICAgICAgICAvLyBub3QgY2xvc2VkXG4gICAgICAgICAgICByaW5ncy5hZGQocG9pbnRzLnN1Ykxpc3Qoc3RhcnQsIHBvaW50cy5zaXplKSlcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmluZ3NcbiAgICB9XG5cbiAgICBmdW4gY2FsY3VsYXRlUmluZ0xpbWl0cyhyaW5nczogTGlzdDxMaXN0PERvdWJsZVZlY3Rvcj4+LCB0b3RhbFBvaW50c0xpbWl0OiBJbnQpOiBMaXN0PEludD4ge1xuICAgICAgICB2YWwgdG90YWxBcmVhID0gcmluZ3MubWFwIHsgY2FsY3VsYXRlQXJlYShpdCkgfS5zdW0oKVxuXG4gICAgICAgIHZhbCBhcmVhUHJvY2VlZCA9IE11dGFibGVEb3VibGUoMC4wKVxuICAgICAgICB2YWwgcG9pbnRzUHJvY2VlZCA9IE11dGFibGVJbnRlZ2VyKDApXG5cbiAgICAgICAgcmV0dXJuIHJpbmdzLmluZGljZXNcbiAgICAgICAgICAgIC5hc1NlcXVlbmNlKClcbiAgICAgICAgICAgIC5tYXAgeyBQYWlyKGl0LCBjYWxjdWxhdGVBcmVhKHJpbmdzW2l0XSkpIH1cbiAgICAgICAgICAgIC5zb3J0ZWRXaXRoKGNvbXBhcmVCeTxQYWlyPCosIERvdWJsZT4+IHtcbiAgICAgICAgICAgICAgICBnZXRSaW5nQXJlYShcbiAgICAgICAgICAgICAgICAgICAgaXRcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9LnJldmVyc2VkKCkpXG4gICAgICAgICAgICAubWFwIHsgcCAtPlxuICAgICAgICAgICAgICAgIHZhciBsaW1pdCA9IG1pbihcbiAgICAgICAgICAgICAgICAgICAgKHAuc2Vjb25kIC8gKHRvdGFsQXJlYSAtIGFyZWFQcm9jZWVkLmdldCgpKSAqICh0b3RhbFBvaW50c0xpbWl0IC0gcG9pbnRzUHJvY2VlZC5nZXQoKSkpLnJvdW5kVG9JbnQoKSxcbiAgICAgICAgICAgICAgICAgICAgcmluZ3NbZ2V0UmluZ0luZGV4KHApXS5zaXplXG4gICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICAgICAgaWYgKGxpbWl0ID49IDQpIHtcbiAgICAgICAgICAgICAgICAgICAgYXJlYVByb2NlZWQuZ2V0QW5kQWRkKGdldFJpbmdBcmVhKHApKVxuICAgICAgICAgICAgICAgICAgICBwb2ludHNQcm9jZWVkLmdldEFuZEFkZChsaW1pdClcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBsaW1pdCA9IDBcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBQYWlyKGdldFJpbmdJbmRleChwKSwgbGltaXQpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAuc29ydGVkV2l0aChjb21wYXJlQnkgeyBnZXRSaW5nSW5kZXgoaXQpIH0pXG4gICAgICAgICAgICAubWFwIHsgZ2V0UmluZ0xpbWl0KGl0KSB9XG4gICAgICAgICAgICAudG9MaXN0KClcbiAgICB9XG5cbiAgICBmdW4gZ2V0UmluZ0luZGV4KHBhaXI6IFBhaXI8SW50LCAqPik6IEludCB7XG4gICAgICAgIHJldHVybiBwYWlyLmZpcnN0XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gZ2V0UmluZ0FyZWEocGFpcjogUGFpcjwqLCBEb3VibGU+KTogRG91YmxlIHtcbiAgICAgICAgcmV0dXJuIHBhaXIuc2Vjb25kXG4gICAgfVxuXG4gICAgZnVuIGdldFJpbmdMaW1pdChwYWlyOiBQYWlyPCosIEludD4pOiBJbnQge1xuICAgICAgICByZXR1cm4gcGFpci5zZWNvbmRcbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSB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GVTaXplKVxuXG4gICAgICAgIHZhbCBpbmRpY2VzID0gQXJyYXlMaXN0PEludD4oKVxuICAgICAgICB2YWwgcmluZ0Jhc2UgPSBNdXRhYmxlSW50ZWdlcigwKVxuXG4gICAgICAgICgwIHVudGlsIGxpbWl0cy5zaXplKVxuICAgICAgICAgICAgICAgIC5tYXAgeyBQYWlyKGl0LCBsaW1pdHNbaXRdKSB9XG4gICAgICAgICAgICAgICAgLmZvckVhY2ggeyBwIC0+XG4gICAgICAgICAgICAgICAgICAgIHNpbXBsaWZ5KHJpbmdzW2dldFJpbmdJbmRleChwKV0sIGdldFJpbmdMaW1pdChwKSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZm9yRWFjaCB7IGluZGV4IC0+IGluZGljZXMuYWRkKHJpbmdCYXNlLmdldCgpICsgaW5kZXgpIH1cbiAgICAgICAgICAgICAgICAgICAgcmluZ0Jhc2UuZ2V0QW5kQWRkKHJpbmdzW2dldFJpbmdJbmRleChwKV0uc2l6ZSlcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHBvcHVsYXRpb24uc2VsZWN0SW5kaWNlcyhpbmRpY2VzKVxuICAgIH1cblxuICAgIGludGVybmFsIGNsYXNzIFZlcnRleFZ3U2FtcGxpbmcoc2FtcGxlU2l6ZTogSW50KSA6IFZlcnRleFNhbXBsaW5nKHNhbXBsZVNpemUpIHtcblxuICAgICAgICBvdmVycmlkZSB2YWwgZXhwcmVzc2lvblRleHQ6IFN0cmluZ1xuICAgICAgICAgICAgZ2V0KCkgPSBcInNhbXBsaW5nX1wiICsgQUxJQVMgKyBcIihcIiArXG4gICAgICAgICAgICAgICAgICAgIFwibj1cIiArIHNhbXBsZVNpemUgKyBcIilcIlxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBzaW1wbGlmeUludGVybmFsKHBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+LCBsaW1pdDogSW50KTogTGlzdDxJbnQ+IHtcbiAgICAgICAgICAgIHJldHVybiBQb2x5bGluZVNpbXBsaWZpZXIudmlzdmFsaW5nYW1XaHlhdHQocG9pbnRzKS5zZXRDb3VudExpbWl0KGxpbWl0KS5pbmRpY2VzXG4gICAgICAgIH1cblxuICAgICAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgICAgIGNvbnN0IHZhbCBBTElBUyA9IFwidmVydGV4X3Z3XCJcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGludGVybmFsIGNsYXNzIFZlcnRleERwU2FtcGxpbmcoc2FtcGxlU2l6ZTogSW50KSA6IFZlcnRleFNhbXBsaW5nKHNhbXBsZVNpemUpIHtcblxuICAgICAgICBvdmVycmlkZSB2YWwgZXhwcmVzc2lvblRleHQ6IFN0cmluZ1xuICAgICAgICAgICAgZ2V0KCkgPSBcInNhbXBsaW5nX1wiICsgQUxJQVMgKyBcIihcIiArXG4gICAgICAgICAgICAgICAgICAgIFwibj1cIiArIHNhbXBsZVNpemUgKyBcIilcIlxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBzaW1wbGlmeUludGVybmFsKHBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+LCBsaW1pdDogSW50KTogTGlzdDxJbnQ+IHtcbiAgICAgICAgICAgIHJldHVybiBQb2x5bGluZVNpbXBsaWZpZXIuZG91Z2xhc1BldWNrZXIocG9pbnRzKS5zZXRDb3VudExpbWl0KGxpbWl0KS5pbmRpY2VzXG4gICAgICAgIH1cblxuICAgICAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgICAgIGNvbnN0IHZhbCBBTElBUyA9IFwidmVydGV4X2RwXCJcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGludGVybmFsIGNsYXNzIERvdWJsZVZlY3RvckNvbXBvbmVudHNMaXN0KHByaXZhdGUgdmFsIG15WFZhbHVlczogTGlzdDxBbnk+LCBwcml2YXRlIHZhbCBteVlWYWx1ZXM6IExpc3Q8QW55PikgOiBBYnN0cmFjdExpc3Q8RG91Ymxl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gICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGNyZWF0ZUNvbnRpbnVvdXNNYXBwZXIoXG4gICAgICAgICAgICAgICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgICAgICAgICAgICAgbG93ZXJMaW1pdDogRG91YmxlPyxcbiAgICAgICAgICAgICAgICAgICAgdXBwZXJMaW1pdDogRG91YmxlPyxcbiAgICAgICAgICAgICAgICAgICAgdHJhbnM6IENvbnRpbnVvdXNUcmFuc2Zvcm1cbiAgICAgICAgICAgICAgICApOiBHdWlkZU1hcHBlcjxEb3VibGU+IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEd1aWRlTWFwcGVycy5VTkRFRklORURcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHByaXZhdGUgdmFsIE5VTUVSSUNfSURFTlRJVFk6IE1hcHBlclByb3ZpZGVyPERvdWJsZT4gPSBvYmplY3QgOiBNYXBwZXJQcm92aWRlcjxEb3VibGU+IHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlRGlzY3JldGVNYXBwZXIoZG9tYWluVmFsdWVzOiBDb2xsZWN0aW9uPCo+KTogR3VpZGVNYXBwZXI8RG91YmxlPiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBHdWlkZU1hcHBlcnMuSURFTlRJVFlcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlQ29udGludW91c01hcHBlcihcbiAgICAgICAgICAgICAgICAgICAgZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICAgICAgICAgICAgICBsb3dlckxpbWl0OiBEb3VibGU/LFxuICAgICAgICAgICAgICAgICAgICB1cHBlckxpbWl0OiBEb3VibGU/LFxuICAgICAgICAgICAgICAgICAgICB0cmFuczogQ29udG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Q29sb3I+IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gY29udGludW91cy5jcmVhdGVDb250aW51b3VzTWFwcGVyKGRvbWFpbiwgbG93ZXJMaW1pdCwgdXBwZXJMaW1pdCwgdHJhbnMpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gPFQ+IGNyZWF0ZVdpdGhEaXNjcmV0ZU91dHB1dChvdXRwdXRWYWx1ZXM6IExpc3Q8VD4sIG5hVmFsdWU6IFQpOiBNYXBwZXJQcm92aWRlcjxUPiB7XG4gICAgICAgIHJldHVybiBvYmplY3QgOiBNYXBwZXJQcm92aWRlcjxUPiB7XG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlRGlzY3JldGVNYXBwZXIoZG9tYWluVmFsdWVzOiBDb2xsZWN0aW9uPCo+KTogR3VpZGVNYXBwZXI8VD4ge1xuICAgICAgICAgICAgICAgIHJldHVybiBHdWlkZU1hcHBlcnMuZGlzY3JldGVUb0Rpc2NyZXRlKGRvbWFpblZhbHVlcywgb3V0cHV0VmFsdWVzLCBuYVZhbHVlKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlQ29udGludW91c01hcHBlcihcbiAgICAgICAgICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgICAgICAgICAgbG93ZXJMaW1pdDogRG91YmxlPyxcbiAgICAgICAgICAgICAgICB1cHBlckxpbWl0OiBEb3VibGU/LFxuICAgICAgICAgICAgICAgIHRyYW5zOiBDb250aW51b3VzVHJhbnNmb3JtXG4gICAgICAgICAgICApOiBHdWlkZU1hcHBlcjxUPiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIEd1aWRlTWFwcGVycy5jb250aW51b3VzVG9EaXNjcmV0ZShcbiAgICAgICAgICAgICAgICAgICAgTWFwcGVyVXRpbC5yYW5nZVdpdGhMaW1pdHNBZnRlclRyYW5zZm9ybShkb21haW4sIGxvd2VyTGltaXQsIHVwcGVyTGltaXQsIHRyYW5zKSxcbiAgICAgICAgICAgICAgICAgICAgb3V0cHV0VmFsdWVzLCBuYVZhbHVlXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgQFN1cHByZXNzKFwiVU5VU0VEX1BBUkFNRVRFUlwiKVxuICAgIGludGVybmFsIGZ1biBjcmVhdGVPYmplY3RJZGVudGl0eShhZXM6IEFlczxBbnk/Pik6IE1hcHBlclByb3ZpZGVyPEFueT8+IHtcbiAgICAgICAgcmV0dXJuIG9iamVjdCA6IElkZW50aXR5RGlzY3JldGVNYXBwZXJQcm92aWRlcjxBbnk/Pih7IGl0IH0sIG51bGwpIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVDb250aW51b3VzTWFwcGVyKFxuICAgICAgICAgICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgICAgICAgICBsb3dlckxpbWl0OiBEb3VibGU/LFxuICAgICAgICAgICAgICAgIHVwcGVyTGltaXQ6IERvdWJsZT8sXG4gICAgICAgICAgICAgICAgdHJhbnM6IENvbnRpbnVvdXNUcmFuc2Zvcm1cbiAgICAgICAgICAgICk6IEd1aWRlTWFwcGVyPEFueT8+IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gR3VpZGVNYXBwZXJzLmFzQ29udGludW91cyB7IGl0IH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGludGVybmFsIGZ1biBjcmVhdGVPYmplY3RJZGVudGl0eURpc2NyZXRlKGFlczogQWVzPEFueT4pOiBNYXBwZXJQcm92aWRlcjxBbnk+IHtcbiAgICAgICAgdmFsIGNvbnZlcnRlcjogKEFueT8pIC0+IEFueT8gPSB7IGl0IH1cbiAgICAgICAgcmV0dXJuIGNyZWF0ZUlkZW50aXR5TWFwcGVyUHJvdmlkZX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XR1cm4gbXlOYW1lID86IHZhcmlhYmxlLmxhYmVsXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlU2NhbGUoZGVmYXVsdE5hbWU6IFN0cmluZywgZGlzY3JldGVEb21haW46IENvbGxlY3Rpb248Kj4pOiBTY2FsZTxUPiB7XG4gICAgICAgICAgICB2YWwgbmFtZSA9IG15TmFtZSA/OiBkZWZhdWx0TmFtZVxuICAgICAgICAgICAgdmFyIHNjYWxlOiBTY2FsZTxUPlxuXG4gICAgICAgICAgICAvLyBkaXNjcmV0ZSBkb21haW5cbiAgICAgICAgICAgIHZhciBkb21haW5WYWx1ZXMgPSBkaXNjcmV0ZURvbWFpbi5maWx0ZXJOb3ROdWxsKClcblxuICAgICAgICAgICAgdmFsIG1hcHBlciA9IGlmIChkaXNjcmV0ZURvbWFpbi5pc0VtcHR5KCkpIHtcbiAgICAgICAgICAgICAgICBhYnNlbnRNYXBwZXIoZGVmYXVsdE5hbWUpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG1hcHBlclByb3ZpZGVyLmNyZWF0ZURpc2NyZXRlTWFwcGVyKGRvbWFpblZhbHVlcyk6OmFwcGx5XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChkaXNjcmV0ZURvbWFpblJldmVyc2UpIHtcbiAgICAgICAgICAgICAgICBkb21haW5WYWx1ZXMgPSBkb21haW5WYWx1ZXMucmV2ZXJzZWQoKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBzY2FsZSA9IFNjYWxlcy5kaXNjcmV0ZURvbWFpbihcbiAgICAgICAgICAgICAgICBuYW1lLFxuICAgICAgICAgICAgICAgIGRvbWFpblZhbHVlcyxcbiAgICAgICAgICAgICAgICBtYXBwZXJcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgdmFsIGRpc2NyZXRlTGltaXRzID0gbGltaXRzPy5maWx0ZXJOb3ROdWxsKCk/LmxldCB7XG4gICAgICAgICAgICAgICAgaWYgKGRpc2NyZXRlRG9tYWluUmV2ZXJzZSkge1xuICAgICAgICAgICAgICAgICAgICBpdC5yZXZlcnNlZCgpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaXRcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZGlzY3JldGVMaW1pdHMgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHNjYWxlID0gc2NhbGUud2l0aCgpXG4gICAgICAgICAgICAgICAgICAgIC5saW1pdHMoZGlzY3JldGVMaW1pdHMpXG4gICAgICAgICAgICAgICAgICAgIC5idWlsZCgpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBjb21wbGV0ZVNjYWxlKHNjYWxlKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGNyZWF0ZVNjYWxlKGRlZmF1bHROYW1lOiBTdHJpbmcsIGNvbnRpbnVvdXNEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4pOiBTY2FsZTxUPiB7XG4gICAgICAgICAgICB2YWwgbmFtZSA9IG15TmFtZSA/OiBkZWZhdWx0TmFtZVxuICAgICAgICAgICAgdmFyIHNjYWxlOiBTY2FsZTxUPlxuXG4gICAgICAgICAgICAvLyBjb250aW51b3VzIChudW1lcmljKSBkb21haW5cbiAgICAgICAgICAgIHZhbCBkYXRhUmFuZ2UgPSBlbnN1cmVBcHBsaWNhYmxlUmFuZ2UoY29udGludW91c0RvbWFpbilcblxuICAgICAgICAgICAgdmFyIGxvd2VyTGltaXQ6IERvdWJsZT8gPSBudWxsXG4gICAgICAgICAgICB2YXIgdXBwZXJMaW1pdDogRG91YmxlPyA9IG51bGxcbiAgICAgICAgICAgIGlmIChsaW1pdHMgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHZhciBsb3dlciA9IHRydWVcbiAgICAgICAgICAgICAgICBmb3IgKGxpbWl0IGluIGxpbWl0cykge1xuICAgICAgICAgICAgICAgICAgICBpZiAobGltaXQgaXMgTnVtYmVyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgdiA9IGxpbWl0LnRvRG91YmxlKClcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2LmlzRmluaXRlKCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobG93ZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG93ZXJMaW1pdCA9IHZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cHBlckxpbWl0ID0gdlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBsb3dlciA9IGZhbHNlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgbWFwcGVyID0gbWFwcGVyUHJvdmlkZXIuY3JlYXRlQ29udGludW91c01hcHBlcihcbiAgICAgICAgICAgICAgICBkYXRhUmFuZ2UsXG4gICAgICAgICAgICAgICAgbG93ZXJMaW1pdCxcbiAgICAgICAgICAgICAgICB1cHBlckxpbWl0LFxuICAgICAgICAgICAgICAgIGNvbnRpbnVvdXNUcmFuc2Zvcm1cbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIHZhbCBjb250aW51b3VzUmFuZ2UgPSBtYXBwZXIuaXNDb250aW51b3VzIHx8IG15QWVzLmlzTnVtZXJpY1xuXG4gICAgICAgICAgICBzY2FsZSA9IFNjYWxlcy5jb250aW51b3VzRG9tYWluKG5hbWUsIHsgdiAtPiBtYXBwZXIuYXBwbHkodikgfSwgY29udGludW91c1JhbmdlKVxuXG4gICAgICAgICAgICAvLyBUb0RvOiBuZWVkIHRvICdpbnZlcnNlIHRyYW5zZm9ybScgYnJlYWtzLlxuICAgICAgICAgICAgaWYgKG1hcHBlciBpcyBXaXRoR3VpZGVCcmVha3M8Kj4pIHtcbiAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgIG1hcHBlciBhcyBXaXRoR3VpZGVCcmVha3M8QW55PlxuICAgICAgICAgICAgICAgIHNjYWxlID0gc2NhbGUud2l0aCgpXG4gICAgICAgICAgICAgICAgICAgIC5icmVha3MobWFwcGVyLmJyZWFrcylcbiAgICAgICAgICAgICAgICAgICAgLmxhYmVsRm9ybWF0dGVyKG1hcHBlci5mb3JtYXR0ZXIpXG4gICAgICAgICAgICAgICAgICAgIC5idWlsZCgpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHNjYWxlID0gc2NhbGUud2l0aCgpXG4gICAgICAgICAgICAgICAgLmNvbnRpbnVvdXNUcmFuc2Zvcm0oY29udGludW91c1RyYW5zZm9ybSlcbiAgICAgICAgICAgICAgICAuYnVpbGQoKVxuXG4gICAgICAgICAgICBpZiAobXlCcmVha3NHZW5lcmF0b3IgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHNjYWxlID0gc2NhbGUud2l0aCgpXG4gICAgICAgICAgICAgICAgICAgIC5icmVha3NHZW5lcmF0b3IobXlCcmVha3NHZW5lcmF0b3IpXG4gICAgICAgICAgICAgICAgICAgIC5idWlsZCgpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChsaW1pdHMgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHZhbCB3aXRoID0gc2NhbGUud2l0aCgpXG4gICAgICAgICAgICAgICAgaWYgKGxvd2VyTGltaXQgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICB3aXRoLmxvd2VyTGltaXQobG93ZXJMaW1pdClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHVwcGVyTGltaXQgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICB3aXRoLnVwcGVyTGltaXQodXBwZXJMaW1pdClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc2NhbGUgPSB3aXRoLmJ1aWxkKClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIGNvbXBsZXRlU2NhbGUoc2NhbGUpXG4gICAgICAgIH1cblxuXG4gICAgICAgIHByaXZhdGUgZnVuIGNvbXBsZXRlU2NhbGUoc2NhbGU6IFNjYWxlPFQ+KTogU2NhbGU8VD4ge1xuICAgICAgICAgICAgdmFsIHdpdGggPSBzY2FsZS53aXRoKClcbiAgICAgICAgICAgIGlmIChicmVha3MgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHdpdGguYnJlYWtzKGJyZWFrcylcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChteUxhYmVscyAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgd2l0aC5sYWJlbHMobXlMYWJlbHMpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobXlMYWJlbEZvcm1hdCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgd2l0aC5sYWJlbEZvcm1hdHRlcihTdHJpbmdGb3JtYXQuY3JlYXRlKG15TGFiZWxGb3JtYXQpOjpmb3JtYXQpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobXlNdWx0aXBsaWNhdGl2ZUV4cGFuZCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgd2l0aC5tdWx0aXBsaWNhdGl2ZUV4cGFuZChteU11bHRpcGxpY2F0aXZlRXhwYW5kKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKG15QWRkaXRpdmVFeHBhbmQgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHdpdGguYWRkaXRpdmVFeHBhbmQobXlBZGRpdGl2ZUV4cGFuZClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICA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SElHSCA9IENvbG9yLnBhcnNlSGV4KFwiIzU2QjFGN1wiKVxuXG4gICAgZnVuIGdyYWRpZW50RGVmYXVsdChkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4pOiAoRG91YmxlPykgLT4gQ29sb3Ige1xuICAgICAgICByZXR1cm4gZ3JhZGllbnQoXG4gICAgICAgICAgICBkb21haW4sXG4gICAgICAgICAgICBERUZfR1JBRElFTlRfTE9XLFxuICAgICAgICAgICAgREVGX0dSQURJRU5UX0hJR0gsXG4gICAgICAgICAgICBOQV9WQUxVRVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIGdyYWRpZW50KGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgbG93OiBDb2xvciwgaGlnaDogQ29sb3IsIG5hQ29sb3I6IENvbG9yKTogKERvdWJsZT8pIC0+IENvbG9yIHtcbiAgICAgICAgcmV0dXJuIGdyYWRpZW50SFNWKFxuICAgICAgICAgICAgZG9tYWluLFxuICAgICAgICAgICAgQ29sb3JzLmhzdkZyb21SZ2IobG93KSxcbiAgICAgICAgICAgIENvbG9ycy5oc3ZGcm9tUmdiKGhpZ2gpLFxuICAgICAgICAgICAgdHJ1ZSxcbiAgICAgICAgICAgIG5hQ29sb3JcbiAgICAgICAgKVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEBkZXByZWNhdGVkXG4gICAgICovXG4gICAgZnVuIGdyYWRpZW50SFNWKFxuICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIGxvd0hTVjogRG91YmxlQXJyYXksXG4gICAgICAgIGhpZ2hIU1Y6IERvdWJsZUFycmF5LFxuICAgICAgICBhdXRvSHVlRGlyZWN0aW9uOiBCb29sZWFuLFxuICAgICAgICBuYUNvbG9yOiBDb2xvclxuICAgICk6IChEb3VibGU/KSAtPiBDb2xvciB7XG4gICAgICAgIHJldHVybiBncmFkaWVudEhTVihcbiAgICAgICAgICAgIGRvbWFpbixcbiAgIC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cbiAgICAgICAgICAgICAgICAgICAgbG93SHVlICs9IDM2MC4wXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaGlnaEh1ZSArPSAzNjAuMFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBtYXBwZXJIID0gTWFwcGVycy5saW5lYXIoZG9tYWluLCBsb3dIdWUsIGhpZ2hIdWUsIERvdWJsZS5OYU4pXG4gICAgICAgIHZhbCBtYXBwZXJTID0gTWFwcGVycy5saW5lYXIoZG9tYWluLCBsb3dTLCBoaWdoUywgRG91YmxlLk5hTilcbiAgICAgICAgdmFsIG1hcHBlclYgPSBNYXBwZXJzLmxpbmVhcihkb21haW4sIGxvd0hTVi52LCBoaWdoSFNWLnYsIERvdWJsZS5OYU4pXG5cbiAgICAgICAgcmV0dXJuIHsgaW5wdXQgLT5cbiAgICAgICAgICAgIGlmIChpbnB1dCA9PSBudWxsIHx8ICFkb21haW4uY29udGFpbnMoaW5wdXQpKSB7XG4gICAgICAgICAgICAgICAgbmFDb2xvclxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YWwgaHVlID0gbWFwcGVySChpbnB1dCkgJSAzNjBcbiAgICAgICAgICAgICAgICB2YWwgSCA9IGlmIChodWUgPj0gMCkgaHVlIGVsc2UgMzYwICsgaHVlXG4gICAgICAgICAgICAgICAgdmFsIFMgPSBtYXBwZXJTKGlucHV0KVxuICAgICAgICAgICAgICAgIHZhbCBWID0gbWFwcGVyVihpbnB1dClcbiAgICAgICAgICAgICAgICBDb2xvcnMucmdiRnJvbUhzdihILCBTLCBWKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQg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ClcbiAgICAgICAgICAgICAgICByZXF1aXJlKHBhbFR5cGUgIT0gbnVsbCkgeyBjYW50RmluZFBhbGV0dGVFcnJvcihwYWxldHRlTmFtZU9ySW5kZXgpIH1cbiAgICAgICAgICAgICAgICBwYWxUeXBlXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwYWxldHRlVHlwZU5hbWUgIT0gbnVsbCAtPiBwYWxldHRlVHlwZShwYWxldHRlVHlwZU5hbWUpXG4gICAgICAgICAgICBkaXNjcmV0ZSAtPiBRVUFMSVRBVElWRVxuICAgICAgICAgICAgZWxzZSAtPiBTRVFVRU5USUFMXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gd2hlbiB7XG4gICAgICAgICAgICBwYWxldHRlTmFtZU9ySW5kZXggaXMgTnVtYmVyIC0+IGNvbG9yU2NoZW1lQnlJbmRleChwYWxldHRlVHlwZSwgcGFsZXR0ZU5hbWVPckluZGV4LnRvSW50KCkpXG4gICAgICAgICAgICBwYWxldHRlTmFtZU9ySW5kZXggaXMgU3RyaW5nIC0+IGNvbG9yU2NoZW1lQnlOYW1lKHBhbGV0dGVUeXBlLCBwYWxldHRlTmFtZU9ySW5kZXgpXG4gICAgICAgICAgICBwYWxldHRlVHlwZSA9PSBRVUFMSVRBVElWRSAtPiB7XG4gICAgICAgICAgICAgICAgaWYgKGNvbG9yQ291bnQgIT0gbnVsbCAmJiBjb2xvckNvdW50IDw9IFNldDIubWF4Q29sb3JzKSBTZXQyXG4gICAgICAgICAgICAgICAgZWxzZSBTZXQzXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIC0+IGNvbG9yU2NoZW1lQnlJbmRleChwYWxldHRlVHlwZSwgMClcbiAgICAgICAgfVxuICAgIH1cblxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHByaXZhdGUgZnVuIHBhbGV0dGVUeXBlKG5hbWU6IFN0cmluZz8pOiBDb2xvclBhbGV0dGUuVHlwZSB7XG4gICAgICAgICAgICBpZiAobmFtZSA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFNFUVVFTlRJQUxcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiB3aGVuIChuYW1lKSB7XG4gICAgICAgICAgICAgICAgXCJzZXFcIiAtPiBTRVFVRU5USUFMXG4gICAgICAgICAgICAgICAgXCJkaXZcIiAtPiBESVZFUkdJTkdcbiAgICAgICAgICAgICAgICBcInF1YWxcIiAtPiBRVUFMSVRBVElWRVxuICAgICAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFxuICAgICAgICAgICAgICAgICAgICBcIlBhbGV0dGUgdHlwZSBleHBlY3RlZCBvbmUgb2YgJ3NlcScgKHNlcXVlbnRpYWwpLCAnZGl2JyAoZGl2ZXJnaW5nKSBvciAncXVhbCcgKHF1YWxpdGF0aXZlKSBidXQgd2FzOiAnJG5hbWUnXCJcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBjb2xvclNjaGVtZUJ5TmFtZShwYWxldHRlVHlwZTogQ29sb3JQYWxldHRlLlR5cGUsIHBhbGV0dGVOYW1lOiBTdHJpbmcpOiBDb2xvclNjaGVtZSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIHJldHVybiB3aGVuIChwYWxldHRlVHlwZSkge1xuICAgICAgICAgICAgICAgICAgICBTRVFVRU5USUFMIC0+IENvbG9yUGFsZXR0ZS5TZXF1ZW50aWFsLnZhbHVlT2YocGFsZXR0ZU5hbWUpXG4gICAgICAgICAgICAgICAgICAgIERJVkVSR0lORyAtPiBDb2xvclBhbGV0dGUuRGl2ZXJnaW5nLnZhbHVlT2YocGFsZXR0ZU5hbWUpXG4gICAgICAgICAgICAgICAgICAgIFFVQUxJVEFUSVZFIC0+IENvbG9yUGFsZXR0ZS5RdWFsaXRhdGl2ZS52YWx1ZU9mKHBhbGV0dGVOYW1lKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gY2F0Y2ggKGlnbm9yZTogSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKSB7XG4gICAgICAgICAgICAgICAgLy8gRW51bSB0eXBlIGhhcyBubyBjb25zdGFudCB3aXRoIHRoZSBzcGVjaWZpZWQgbmFtZSBlcnJvci5cbiAgICAgICAgICAgICAgICAvLyBSZXBsYWNlIGdlbmVyaWMgZXJyb3IgbWFzc2FnZSB3aXRoIHNwZWNpZmljIG9uZVxuICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihjYW50RmluZFBhbGV0dGVFcnJvcihwYWxldHRlTmFtZSkpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBjYW50RmluZFBhbGV0dGVFcnJvcihwYWxldHRlTmFtZTogU3RyaW5nKTogU3RyaW5nIHtcbiAgICAgICAgICAgIHJldHVybiBcIlwiXCJcbiAgICAgICAgICAgICAgICB8QnJld2VyIHBhbGV0dGUgJyRwYWxldHRlTmFtZScgd2FzIG5vdCBmb3VuZC4gXG4gICAgICAgICAgICAgICAgfFZhbGlkIHBhbGV0dGUgbmFtZXMgYXJlOiBcbiAgICAgICAgICAgICAgICB8ICAgVHlwZSAnc2VxJyAoc2VxdWVudGlhbCk6IFxuICAgICAgICAgICAgICAgIHwgICAgICAgJHtuYW1lcyhDb2xvclBhbGV0dGUuU2VxdWVudGlhbC52YWx1ZXMoKSl9ICAgICAgIFxuICAgICAgICAgICAgICAgIHwgICBUeXBlICdkaXYnIChkaXZlcmdpbmcpOiBcbiAgICAgICAgICAgICAgICB8ICAgICAgICR7bmFtZXMoQ29sb3JQYWxldHRlLkRpdmVyZ2luZy52YWx1ZXMoKSl9ICAgICAgIFxuICAgICAgICAgICAgICAgIHwgICBUeXBlICdxdWFsJyAocXVhbGl0YXRpdmUpO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gICAgaWYgKFNlcmllc1V0aWwuaXNGaW5pdGUodikpIHtcbiAgICAgICAgICAgICAgICB2YXIgZl9zcGFuID0gRG91YmxlLk5hTlxuICAgICAgICAgICAgICAgIGZvciAocmFuZ2UgaW4gcmFuZ2VNYXAua2V5cykge1xuICAgICAgICAgICAgICAgICAgICBpZiAocmFuZ2UuY29udGFpbnModiEhKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHNwYW4gPSByYW5nZS51cHBlckVuZCAtIHJhbmdlLmxvd2VyRW5kXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyB0cnkgdG8gYXZvaWQgMC1sZW5ndGggcmFuZ2VzXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBidXQgcHJlZmVyIHNob3J0ZXIgcmFuZ2VzXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZl8gPT0gbnVsbCB8fCBmX3NwYW4gPT0gMC4wKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZl8gPSByYW5nZU1hcC5nZXQocmFuZ2UpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZl9zcGFuID0gc3BhblxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzcGFuIDwgZl9zcGFuICYmIHNwYW4gPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZl8gPSByYW5nZU1hcC5nZXQocmFuZ2UpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZl9zcGFuID0gc3BhblxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGZfXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbWFwcGVyRnVuOiAoRG91YmxlPykgLT4gQ29sb3IgPSB7IGlucHV0OiBEb3VibGU/IC0+XG4gICAgICAgICAgICB2YWwgbWFwcGVyID0gZ2V0TWFwcGV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AgICAgIHZhbCBzdGVwID0gKHRvSFNWLmggLSBmcm9tSFNWLmgpIC8gZG9tYWluVmFsdWVzLnNpemVcbiAgICAgICAgICAgIGlmIChodWVEaWZmIDwgYWJzKHN0ZXApIC8gMikge1xuICAgICAgICAgICAgICAgIG5ld0Zyb21IdWUgPSBmcm9tSFNWLmggKyBzdGVwIC8gMlxuICAgICAgICAgICAgICAgIG5ld1RvSHVlID0gdG9IU1YuaCAtIHN0ZXAgLyAyXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgZ3JhZGllbnQgPSBDb2xvck1hcHBlci5ncmFkaWVudEhTVihcbiAgICAgICAgICAgIG1hcHBlckRvbWFpbixcbiAgICAgICAgICAgIEhTVihuZXdGcm9tSHVlLCBmcm9tSFNWLnMsIGZyb21IU1YudiksXG4gICAgICAgICAgICBIU1YobmV3VG9IdWUsIHRvSFNWLnMsIHRvSFNWLnYpLFxuICAgICAgICAgICAgZmFsc2UsIG5hVmFsdWVcbiAgICAgICAgKVxuICAgICAgICByZXR1cm4gR3VpZGVNYXBwZXJzLmFzTm90Q29udGludW91cyhncmFkaWVudClcbiAgICB9XG5cbiAgICBwcm90ZWN0ZWQgZnVuIGNyZWF0ZUNvbnRpbnVvdXNNYXBwZXIoXG4gICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgaHN2SW50ZXJ2YWxzOiBMaXN0PFBhaXI8SFNWLCBIU1Y+PlxuICAgICk6IEd1aWRlTWFwcGVyPENvbG9yPiB7XG4gICAgICAgIHZhbCBncmFkaWVudE1hcHBlciA9IHdoZW4gKGhzdkludGVydmFscy5zaXplKSB7XG4gICAgICAgICAgICAwIC0+IHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcIkVtcHR5IEhTViBpbnRlcnZhbHMuXCIpXG4gICAgICAgICAgICAxIC0+IENvbG9yTWFwcGVyLmdyYWRpZW50SFNWKGRvbWFpbiwgaHN2S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5jb250YWlucyh2KSB9Py5zZWNvbmRcbiAgICAgICAgICAgICAgICAgICAgbWFwcGVyPy5pbnZva2UodikgPzogbmFDb2xvclxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGNyZWF0ZUNvbG9yTWFwcGVyc1BlclN1YkRvbWFpbihcbiAgICAgICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgICAgIGhzdkludGVydmFsczogTGlzdDxQYWlyPEhTViwgSFNWPj4sXG4gICAgICAgICAgICBhdXRvSHVlRGlyZWN0aW9uOiBCb29sZWFuLFxuICAgICAgICAgICAgbmFDb2xvcjogQ29sb3JcbiAgICAgICAgKTogTGlzdDxQYWlyPENsb3NlZFJhbmdlPERvdWJsZT4sIChEb3VibGU/KSAtPiBDb2xvcj4+IHtcbiAgICAgICAgICAgIHZhbCBzdWJEb21haW5zID0gc3BsaXRDb250aW51b3VzRG9tYWluKGRvbWFpbiwgaHN2SW50ZXJ2YWxzKVxuXG4gICAgICAgICAgICByZXR1cm4gc3ViRG9tYWlucy56aXAoaHN2SW50ZXJ2YWxzKS5tYXAge1xuICAgICAgICAgICAgICAgIEBTdXBwcmVzcyhcIk5BTUVfU0hBRE9XSU5HXCIpXG4gICAgICAgICAgICAgICAgdmFsIGRvbWFpbiA9IGl0LmZpcnN0XG4gICAgICAgICAgICAgICAgdmFsIGhzdkludGVydmFsID0gaXQuc2Vjb25kXG4gICAgICAgICAgICAgICAgUGFpcihcbiAgICAgICAgICAgICAgICAgICAgZG9tYWluLFxuICAgICAgICAgICAgICAgICAgICBDb2xvck1hcHBlci5ncmFkaWVudEhTVihkb21haW4sIGhzdkludGVydmFsLmZpcnN0LCBoc3ZJbnRlcnZhbC5zZWNvbmQsIGF1dG9IdWVEaXJlY3Rpb24sIG5hQ29sb3IpXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gc3BsaXRDb250aW51b3VzRG9tYWluKFxuICAgICAgICAgICAgZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICAgICAgaHN2SW50ZXJ2YWxzOiBMaXN0PFBhaXI8SFNWLCBIU1Y+PlxuICAgICAgICApOiBMaXN0PENsb3NlZFJhbmdlPERvdWJsZT4+IHtcbiAgICAgICAgICAgIHZhbCBkb21haW5TaXplID0gZG9tYWluLnVwcGVyRW5kIC0gZG9tYWluLmxvd2VyRW5kXG4gICAgICAgICAgICB2YWwgaHVlSW50ZXJ2YWxTaXplTGlzdCA9IGhzdkludGVydmFscy5tYXAge1xuICAgICAgICAgICAgICAgIGFicyhpdC5maXJzdC5oIC0gaXQuc2Vjb25kLmgpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YWwgaHVlSW50ZXJ2YWxzVG90YWxTaXplID0gaHVlSW50ZXJ2YWxTaXplTGlzdC5zdW0oKVxuXG4gICAgICAgICAgICB2YWwgZG9tYWluVG9IdWVJbnRldmFsUmF0aW8gPSBkb21haW5TaXplIC8gaHVlSW50ZXJ2YWxzVG90YWxTaXplXG5cbiAgICAgICAgICAgIHZhbCBzdWJEb21haW5zID0gQXJyYXlMaXN0PENsb3NlZFJhbmdlPERvdWJsZT4+KClcbiAgICAgICAgICAgIHZhciBsb3dlckVuZCA9IGRvbWFpbi5sb3dlckVuZFxuICAgICAgICAgICAgZm9yIChodWVJbnRlcnZhbFNpemUgaW4gaHVlSW50ZXJ2YWxTaXplTGlzdCkge1xuICAgICAgICAgICAgICAgIHZhbCB1cHBlckVuZCA9IGxvd2VyRW5kICsgaHVlSW50ZXJ2YWxTaXplICogZG9tYWluVG9IdWVJbnRldmFsUmF0aW9cbiAgICAgICAgICAgICAgICBzdWJEb21haW5zLmFkZChDbG9zZWRSYW5nZShsb3dlckVuZCwgdXBwZXJFbmQpKVxuICAgICAgICAgICAgICAgIGxv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1bHRUaGVtZSgpIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBheGlzWCgpOiBBeGlzVGhlbWUge1xuICAgICAgICAgICAgICAgIHJldHVybiBBWElTX1RIRU1FX01VTFRJX1RJTEVcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGF4aXNZKCk6IEF4aXNUaGVtZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIEFYSVNfVEhFTUVfTVVMVElfVElMRVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gcGxvdCgpOiBQbG90VGhlbWUge1xuICAgICAgICAgICAgICAgIHJldHVybiBQTE9UX1RIRU1FX01VTFRJX1RJTEVcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBwcml2YXRlIHZhbCBBWElTX1RIRU1FID0gRGVmYXVsdEF4aXNUaGVtZSgpXG5cbiAgICAgICAgcHJpdmF0ZSB2YWwgQVhJU19USEVNRV9NVUxUSV9USUxFOiBBeGlzVGhlbWUgPSBvYmplY3QgOiBEZWZhdWx0QXhpc1RoZW1lKCkge1xuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHNob3dMaW5lKCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZSAgLy8gcmVwbGFjZWQgYnkgaW5uZXIgZnJhbWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgdmFsIExFR0VORF9USEVNRTogTGVnZW5kVGhlbWUgPSBvYmplY3QgOiBMZWdlbmRUaGVtZSB7XG4gICAgICAgICAgICBvdmVycmlkZSBmdW4ga2V5U2l6ZSgpOiBEb3VibGUge1xuICAgICAgICAgICAgICAgIHJldHVybiAyMy4wXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBtYXJnaW4oKTogRG91YmxlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gNS4wXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBwYWRkaW5nKCk6IERvdWJsZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIDUuMFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gcG9zaXRpb24oKTogTGVnZW5kUG9zaXRpb24ge1xuICAgICAgICAgICAgICAgIHJldHVybiBMZWdlbmRQb3NpdGlvbi5SSUdIVFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4ganVzdGlmaWNhdGlvbigpOiBMZWdlbmRKdXN0aWZpY2F0aW9uIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gTGVnZW5kSnVzdGlmaWNhdGlvbi5DRU5URVJcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGRpcmVjdGlvbigpOiBMZWdlbmREaXJlY3Rpb24ge1xuICAgICAgICAgICAgICAgIHJldHVybiBMZWdlbmREaXJlY3Rpb24uQVVUT1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gYmFja2dyb3VuZEZpbGwoKTogQ29sb3Ige1xuICAgICAgICAgICAgICAgIHJldHVybiBDb2xvci5XSElURVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSB2YWwgRkFDRVRTX1RIRU1FOiBGYWNldHNUaGVtZSA9IG9iamVjdCA6IEZhY2V0c1RoZW1lIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBsYWJlbEJhY2tncm91bmQoKTogQ29sb3Ige1xuICAgICAgICAgICAgICAgIHJldHVybiBDb2xvcnMubGlnaHRlcihDb2xvci5WRVJZX0xJR0hUX0dSQVksIDAuOSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgI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5mb3JFYWNoIHsgaXQuaW5pdERhdGFDb250ZXh0KGRhdGFDb250ZXh0KSB9XG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGdldERhdGFQb2ludChpbmRleDogSW50KTogRGF0YVBvaW50PyB7XG4gICAgICAgIHZhbCBkYXRhVmFsdWVzID0gZmllbGRzLm1hcCB7IGRhdGFWYWx1ZSAtPlxuICAgICAgICAgICAgZGF0YVZhbHVlLmdldERhdGFQb2ludChpbmRleCkgPzogcmV0dXJuIG51bGxcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gaWYgKGRhdGFWYWx1ZXMuc2l6ZSA9PSAxKSB7XG4gICAgICAgICAgICB2YWwgZGF0YVZhbHVlID0gZGF0YVZhbHVlcy5zaW5nbGUoKVxuICAgICAgICAgICAgRGF0YVBvaW50KFxuICAgICAgICAgICAgICAgIGxhYmVsID0gY2hvb3NlTGFiZWwoZGF0YVZhbHVlLmxhYmVsKSxcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IG15TGluZUZvcm1hdHRlci5mb3JtYXQoZGF0YVZhbHVlLnZhbHVlKSxcbiAgICAgICAgICAgICAgICBhZXMgPSBkYXRhVmFsdWUuYWVzLFxuICAgICAgICAgICAgICAgIGlzQXhpcyA9IGRhdGFWYWx1ZS5pc0F4aXMsXG4gICAgICAgICAgICAgICAgaXNPdXRsaWVyID0gZGF0YVZhbHVlLmlzT3V0bGllclxuICAgICAgICAgICAgKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgRGF0YVBvaW50KFxuICAgICAgICAgICAgICAgIGxhYmVsID0gY2hvb3NlTGFiZWwoZGF0YVZhbHVlcy5qb2luVG9TdHJpbmcoXCIsIFwiKSB7IGl0LmxhYmVsID86IFwiXCIgfSksXG4gICAgICAgICAgICAgICAgdmFsdWUgPSBteUxpbmVGb3JtYXR0ZXIuZm9ybWF0KGRhdGFWYWx1ZXMubWFwIHsgaXQudmFsdWUgfSksXG4gICAgICAgICAgICAgICAgYWV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W1wdHlMaXN0KCksXG4gICAgICAgICAgICB0b29sdGlwTGluZVBhdHRlcm5zID0gZW1wdHlMaXN0KCksXG4gICAgICAgICAgICB0b29sdGlwUHJvcGVydGllcyA9IFRvb2x0aXBQcm9wZXJ0aWVzLk5PTkVcbiAgICAgICAgKVxuXG4gICAgICAgIGZ1biBkZWZhdWx0VG9vbHRpcCgpID0gVG9vbHRpcFNwZWNpZmljYXRpb24oXG4gICAgICAgICAgICB2YWx1ZVNvdXJjZXMgPSBlbXB0eUxpc3QoKSxcbiAgICAgICAgICAgIHRvb2x0aXBMaW5lUGF0dGVybnMgPSBudWxsLFxuICAgICAgICAgICAgdG9vbHRpcFByb3BlcnRpZXMgPSBUb29sdGlwUHJvcGVydGllcy5OT05FXG4gICAgICAgIClcbiAgICB9XG59Il0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./kotlin-dce-dev/lets-plot-plot-builder-portable.js\n"); +eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) {\n if (true)\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(/*! kotlin */ \"./kotlin-dce-dev/kotlin.js\"), __webpack_require__(/*! lets-plot-plot-base-portable */ \"./kotlin-dce-dev/lets-plot-plot-base-portable.js\"), __webpack_require__(/*! lets-plot-base-portable */ \"./kotlin-dce-dev/lets-plot-base-portable.js\"), __webpack_require__(/*! lets-plot-vis-svg-portable */ \"./kotlin-dce-dev/lets-plot-vis-svg-portable.js\"), __webpack_require__(/*! lets-plot-plot-common-portable */ \"./kotlin-dce-dev/lets-plot-plot-common-portable.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n else {}\n}(this, function (_, Kotlin, $module$lets_plot_plot_base_portable, $module$lets_plot_base_portable, $module$lets_plot_vis_svg_portable, $module$lets_plot_plot_common_portable) {\n 'use strict';\n var data = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.data;\n var println = Kotlin.kotlin.io.println_s8jyv4$;\n var Kind_OBJECT = Kotlin.Kind.OBJECT;\n var scale = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.scale;\n var throwCCE = Kotlin.throwCCE;\n var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_287e2$;\n var DoubleVector = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleVector;\n var isFinite = Kotlin.kotlin.isFinite_yrwdxr$;\n var toString = Kotlin.toString;\n var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init_pdl1vj$;\n var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$;\n var ArrayList_init_0 = Kotlin.kotlin.collections.ArrayList_init_ww73n8$;\n var Kind_CLASS = Kotlin.Kind.CLASS;\n var CoordinateSystem = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.CoordinateSystem;\n var Scale = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.Scale;\n var Kind_INTERFACE = Kotlin.Kind.INTERFACE;\n var base = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.base;\n var TextLabel = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.svg.TextLabel;\n var TextLabel$HorizontalAnchor = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.svg.TextLabel.HorizontalAnchor;\n var TextLabel$VerticalAnchor = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.svg.TextLabel.VerticalAnchor;\n var RuntimeException = Kotlin.kotlin.RuntimeException;\n var ensureNotNull = Kotlin.ensureNotNull;\n var EventHandler = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event.EventHandler;\n var Registration = $module$lets_plot_base_portable.jetbrains.datalore.base.registration.Registration;\n var SvgGElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgGElement;\n var SvgEventSpec = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.event.SvgEventSpec;\n var SvgEventHandler = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.event.SvgEventHandler;\n var DoubleRectangle = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleRectangle;\n var SvgRectElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement_init_wthzt5$;\n var Color = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Color;\n var DoubleRectangle_init = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleRectangle_init_6y0v78$;\n var getCallableRef = Kotlin.getCallableRef;\n var logging = $module$lets_plot_base_portable.jetbrains.datalore.base.logging;\n var getKClass = Kotlin.getKClass;\n var SvgComponent = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.svg.SvgComponent;\n var ValueProperty = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.property.ValueProperty;\n var throwUPAE = Kotlin.throwUPAE;\n var ArrayList_init_1 = Kotlin.kotlin.collections.ArrayList_init_mqih57$;\n var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init_pdl1vj$;\n var SvgCssResource = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgCssResource;\n var SvgRectElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement;\n var CompositeRegistration = $module$lets_plot_base_portable.jetbrains.datalore.base.registration.CompositeRegistration;\n var SvgSvgElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgSvgElement;\n var Unit = Kotlin.kotlin.Unit;\n var JsMath = Math;\n var HashMap_init = Kotlin.kotlin.collections.HashMap_init_q3lmfv$;\n var Aes = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.Aes;\n var ClosedRange = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.ClosedRange;\n var LiveMapGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.LiveMapGeom;\n var emptyList = Kotlin.kotlin.collections.emptyList_287e2$;\n var collect = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect;\n var lazy = Kotlin.kotlin.lazy_klfg04$;\n var Pair = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Pair;\n var data_0 = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.data;\n var kotlin_js_internal_DoubleCompanionObject = Kotlin.kotlin.js.internal.DoubleCompanionObject;\n var emptyMap = Kotlin.kotlin.collections.emptyMap_q3lmfv$;\n var HashMap_init_0 = Kotlin.kotlin.collections.HashMap_init_73mtqc$;\n var AestheticsBuilder = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.aes.AestheticsBuilder;\n var ContinuousTransform = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.ContinuousTransform;\n var isNaN_0 = Kotlin.kotlin.isNaN_yrwdxr$;\n var Map = Kotlin.kotlin.collections.Map;\n var SvgRoot = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.SvgRoot;\n var equals = Kotlin.equals;\n var hashCode = Kotlin.hashCode;\n var breaks = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.scale.breaks;\n var NullGeomTargetCollector = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.NullGeomTargetCollector;\n var to = Kotlin.kotlin.to_ujzrz7$;\n var toMap = Kotlin.kotlin.collections.toMap_6hr0sd$;\n var TypedKeyHashMap = $module$lets_plot_base_portable.jetbrains.datalore.base.typedKey.TypedKeyHashMap;\n var stat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat;\n var SimpleStatContext = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.SimpleStatContext;\n var GeomTargetLocator$LookupSpec = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupSpec;\n var GeomContext = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.GeomContext;\n var LinkedHashMap_init = Kotlin.kotlin.collections.LinkedHashMap_init_q3lmfv$;\n var getValue = Kotlin.kotlin.collections.getValue_t9ocha$;\n var zip = Kotlin.kotlin.collections.zip_45mdf7$;\n var numberToInt = Kotlin.numberToInt;\n var flatten = Kotlin.kotlin.collections.flatten_u0ad8z$;\n var getPropertyCallableRef = Kotlin.getPropertyCallableRef;\n var Collection = Kotlin.kotlin.collections.Collection;\n var toList = Kotlin.kotlin.toList_tt9upe$;\n var first = Kotlin.kotlin.collections.first_2p1efm$;\n var HashSet_init = Kotlin.kotlin.collections.HashSet_init_mqih57$;\n var DataFrame$DataFrame$Builder_init = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.DataFrame.Builder_init;\n var distinct = Kotlin.kotlin.collections.distinct_7wnvza$;\n var listOf = Kotlin.kotlin.collections.listOf_mh5how$;\n var plus = Kotlin.kotlin.collections.plus_mydzjv$;\n var List = Kotlin.kotlin.collections.List;\n var sortedDescending = Kotlin.kotlin.collections.sortedDescending_exjks8$;\n var sorted = Kotlin.kotlin.collections.sorted_exjks8$;\n var Pair_0 = Kotlin.kotlin.Pair;\n var transform = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.scale.transform;\n var pos = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.pos;\n var PositionAdjustments$StackingStrategy = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.pos.PositionAdjustments.StackingStrategy;\n var PositionAdjustments$Meta = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.pos.PositionAdjustments.Meta;\n var toMap_0 = Kotlin.kotlin.collections.toMap_abgq59$;\n var listOfNotNull = Kotlin.kotlin.collections.listOfNotNull_jurz7g$;\n var sortedWith = Kotlin.kotlin.collections.sortedWith_eknfly$;\n var Enum = Kotlin.kotlin.Enum;\n var throwISE = Kotlin.throwISE;\n var checkIndexOverflow = Kotlin.kotlin.collections.checkIndexOverflow_za3lpa$;\n var wrapFunction = Kotlin.wrapFunction;\n var Comparator = Kotlin.kotlin.Comparator;\n var L37 = Kotlin.Long.fromInt(37);\n var base_0 = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base;\n var PointGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.PointGeom;\n var GeomKind = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.GeomKind;\n var AestheticsDefaults = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.aes.AestheticsDefaults;\n var PathGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.PathGeom;\n var LineGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.LineGeom;\n var SmoothGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.SmoothGeom;\n var BarGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.BarGeom;\n var HistogramGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.HistogramGeom;\n var TileGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.TileGeom;\n var Bin2dGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.Bin2dGeom;\n var ErrorBarGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.ErrorBarGeom;\n var CrossBarGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.CrossBarGeom;\n var LineRangeGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.LineRangeGeom;\n var PointRangeGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.PointRangeGeom;\n var ContourGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.ContourGeom;\n var ContourfGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.ContourfGeom;\n var PolygonGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.PolygonGeom;\n var MapGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.MapGeom;\n var ABLineGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.ABLineGeom;\n var HLineGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.HLineGeom;\n var VLineGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.VLineGeom;\n var BoxplotGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.BoxplotGeom;\n var RibbonGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.RibbonGeom;\n var AreaGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.AreaGeom;\n var DensityGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.DensityGeom;\n var Density2dGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.Density2dGeom;\n var Density2dfGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.Density2dfGeom;\n var JitterGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.JitterGeom;\n var FreqpolyGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.FreqpolyGeom;\n var StepGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.StepGeom;\n var RectGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.RectGeom;\n var SegmentGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.SegmentGeom;\n var TextGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.TextGeom;\n var RasterGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.RasterGeom;\n var ImageGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.ImageGeom;\n var MappedDataAccess = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.MappedDataAccess;\n var MappedDataAccess$MappedData = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.MappedDataAccess.MappedData;\n var coord = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.coord;\n var ScaleBreaks = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.scale.ScaleBreaks;\n var spatial = $module$lets_plot_base_portable.jetbrains.datalore.base.spatial;\n var Projection = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.coord.Projection;\n var DataFrame$Builder = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.DataFrame.Builder;\n var first_0 = Kotlin.kotlin.collections.first_7wnvza$;\n var HashSet_init_0 = Kotlin.kotlin.collections.HashSet_init_287e2$;\n var listOfNotNull_0 = Kotlin.kotlin.collections.listOfNotNull_issdgt$;\n var plus_0 = Kotlin.kotlin.collections.plus_q4559j$;\n var Ordering = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.Ordering;\n var LinkedHashSet_init = Kotlin.kotlin.collections.LinkedHashSet_init_287e2$;\n var mapCapacity = Kotlin.kotlin.collections.mapCapacity_za3lpa$;\n var coerceAtLeast = Kotlin.kotlin.ranges.coerceAtLeast_dqglrj$;\n var LinkedHashMap_init_0 = Kotlin.kotlin.collections.LinkedHashMap_init_bwtc7$;\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n var requireNoNulls = Kotlin.kotlin.collections.requireNoNulls_whsx6z$;\n var firstOrNull = Kotlin.kotlin.collections.firstOrNull_2p1efm$;\n var Comparable = Kotlin.kotlin.Comparable;\n var binarySearch = Kotlin.kotlin.collections.binarySearch_jhx6be$;\n var listOf_0 = Kotlin.kotlin.collections.listOf_i5x0yv$;\n var DataFrame$OrderSpec = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.DataFrame.OrderSpec;\n var Listeners = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event.Listeners;\n var ListenerCaller = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event.ListenerCaller;\n var MouseEventSource = $module$lets_plot_base_portable.jetbrains.datalore.base.event.MouseEventSource;\n var RuntimeException_init = Kotlin.kotlin.RuntimeException_init_pdl1vj$;\n var SvgLineElement_init = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgLineElement_init_6y0v78$;\n var property = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.property;\n var svg = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg;\n var SvgLineElement = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgLineElement;\n var EventSource = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event.EventSource;\n var event = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.event;\n var reverse = Kotlin.kotlin.collections.reverse_vvxzk3$;\n var SvgRectElement_init_0 = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgRectElement_init_6y0v78$;\n var NoSuchElementException_init = Kotlin.kotlin.NoSuchElementException_init;\n var isBlank = Kotlin.kotlin.text.isBlank_gw00vp$;\n var GroupComponent = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.svg.GroupComponent;\n var SvgColors = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svg.SvgColors;\n var ContextualMapping = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.ContextualMapping;\n var DataContext = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.DataContext;\n var GeomTargetLocator$LookupStrategy = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupStrategy;\n var GeomTargetLocator$LookupSpace = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupSpace;\n var minus = Kotlin.kotlin.collections.minus_q4559j$;\n var toMutableList = Kotlin.kotlin.collections.toMutableList_4c7yge$;\n var DoubleSegment = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleSegment;\n var mapOf = Kotlin.kotlin.collections.mapOf_qfcya0$;\n var lastOrNull = Kotlin.kotlin.collections.lastOrNull_2p1efm$;\n var contains = Kotlin.kotlin.collections.contains_2ws7j4$;\n var TipLayoutHint = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.TipLayoutHint;\n var addAll = Kotlin.kotlin.collections.addAll_ipc267$;\n var HitShape = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.HitShape;\n var GeomTargetCollector = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetCollector;\n var GeomTargetLocator = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetLocator;\n var GeomTargetLocator$LookupResult = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupResult;\n var TipLayoutHint$Kind = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.TipLayoutHint.Kind;\n var setOf = Kotlin.kotlin.collections.setOf_i5x0yv$;\n var minOrNull = Kotlin.kotlin.collections.minOrNull_l63kqw$;\n var NoSuchElementException_init_0 = Kotlin.kotlin.NoSuchElementException;\n var IllegalStateException_init_0 = Kotlin.kotlin.IllegalStateException_init;\n var splitRings = $module$lets_plot_base_portable.jetbrains.datalore.base.algorithms.splitRings_bemo1h$;\n var geometry = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry;\n var calculateArea = $module$lets_plot_base_portable.jetbrains.datalore.base.algorithms.calculateArea_ytws2g$;\n var PolylineSimplifier = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.geometry.PolylineSimplifier;\n var GeomTarget = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTarget;\n var toRadians = $module$lets_plot_base_portable.jetbrains.datalore.base.math.toRadians_14dthe$;\n var StringBuilder_init = Kotlin.kotlin.text.StringBuilder_init;\n var StringBuilder = Kotlin.kotlin.text.StringBuilder;\n var trimMargin = Kotlin.kotlin.text.trimMargin_rjktp$;\n var shuffle = Kotlin.kotlin.collections.shuffle_9jeydg$;\n var take = Kotlin.kotlin.collections.take_ba2ldo$;\n var toSet = Kotlin.kotlin.collections.toSet_7wnvza$;\n var Random = Kotlin.kotlin.random.Random_s8cxhz$;\n var Random_0 = Kotlin.kotlin.random.Random;\n var util = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.util;\n var round = Kotlin.kotlin.math.round_14dthe$;\n var until = Kotlin.kotlin.ranges.until_dqglrj$;\n var sum = Kotlin.kotlin.collections.sum_l63kqw$;\n var MutableDouble = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.util.MutableDouble;\n var MutableInteger = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.util.MutableInteger;\n var get_indices = Kotlin.kotlin.collections.get_indices_gzk92b$;\n var asSequence = Kotlin.kotlin.collections.asSequence_7wnvza$;\n var map = Kotlin.kotlin.sequences.map_z5avom$;\n var reversed = Kotlin.kotlin.comparisons.reversed_2avth4$;\n var sortedWith_0 = Kotlin.kotlin.sequences.sortedWith_vjgqpk$;\n var roundToInt = Kotlin.kotlin.math.roundToInt_yrwdxr$;\n var toList_0 = Kotlin.kotlin.sequences.toList_veqyi0$;\n var isClosed = $module$lets_plot_base_portable.jetbrains.datalore.base.algorithms.isClosed_2p1efm$;\n var AbstractList = Kotlin.kotlin.collections.AbstractList;\n var joinToString = Kotlin.kotlin.collections.joinToString_fmv235$;\n var point = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.point;\n var NamedLineType = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.linetype.NamedLineType;\n var aes = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.aes;\n var Function = $module$lets_plot_base_portable.jetbrains.datalore.base.function.Function;\n var AssertionError_init = Kotlin.kotlin.AssertionError_init_pdl1vj$;\n var filterNotNull = Kotlin.kotlin.collections.filterNotNull_m3lr2h$;\n var reversed_0 = Kotlin.kotlin.collections.reversed_7wnvza$;\n var numberToDouble = Kotlin.numberToDouble;\n var StringFormat = $module$lets_plot_base_portable.jetbrains.datalore.base.stringFormat.StringFormat;\n var values = $module$lets_plot_base_portable.jetbrains.datalore.base.values;\n var HSV = $module$lets_plot_base_portable.jetbrains.datalore.base.values.HSV;\n var NamedShape = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.point.NamedShape;\n var NamedShape$values = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.point.NamedShape.values;\n var LinkedHashSet_init_0 = Kotlin.kotlin.collections.LinkedHashSet_init_mqih57$;\n var color = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color;\n var ColorPalette$Type = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Type;\n var ColorPalette$Qualitative = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Qualitative;\n var ColorPalette$Sequential$valueOf = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Sequential.valueOf_61zpoe$;\n var ColorPalette$Diverging$valueOf = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Diverging.valueOf_61zpoe$;\n var ColorPalette$Qualitative$valueOf = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Qualitative.valueOf_61zpoe$;\n var IllegalArgumentException = Kotlin.kotlin.IllegalArgumentException;\n var ColorPalette$Sequential$values = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Sequential.values;\n var ColorPalette$Diverging$values = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Diverging.values;\n var ColorPalette$Qualitative$values = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.color.ColorPalette.Qualitative.values;\n var joinToString_0 = Kotlin.kotlin.collections.joinToString_cgipc5$;\n var rangeTo = Kotlin.kotlin.ranges.rangeTo_38ydlf$;\n var TooltipLineSpec$DataPoint = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.TooltipLineSpec.DataPoint;\n var StringFormat$FormatType = $module$lets_plot_base_portable.jetbrains.datalore.base.stringFormat.StringFormat.FormatType;\n var single = Kotlin.kotlin.collections.single_2p1efm$;\n var TooltipLineSpec = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.TooltipLineSpec;\n Plot$buildPlot$ObjectLiteral_0.prototype = Object.create(Registration.prototype);\n Plot$buildPlot$ObjectLiteral_0.prototype.constructor = Plot$buildPlot$ObjectLiteral_0;\n Plot.prototype = Object.create(SvgComponent.prototype);\n Plot.prototype.constructor = Plot;\n PlotBuilder$MyPlot.prototype = Object.create(Plot.prototype);\n PlotBuilder$MyPlot.prototype.constructor = PlotBuilder$MyPlot;\n PlotTile.prototype = Object.create(SvgComponent.prototype);\n PlotTile.prototype.constructor = PlotTile;\n PlotTooltipHelper$TileInfo$TileTargetLocator.prototype = Object.create(TransformedTargetLocator.prototype);\n PlotTooltipHelper$TileInfo$TileTargetLocator.prototype.constructor = PlotTooltipHelper$TileInfo$TileTargetLocator;\n SvgLayerRenderer.prototype = Object.create(SvgComponent.prototype);\n SvgLayerRenderer.prototype.constructor = SvgLayerRenderer;\n ColorBarAssembler$createColorBar$ObjectLiteral.prototype = Object.create(LegendBoxInfo.prototype);\n ColorBarAssembler$createColorBar$ObjectLiteral.prototype.constructor = ColorBarAssembler$createColorBar$ObjectLiteral;\n ColorBarOptions.prototype = Object.create(GuideOptions.prototype);\n ColorBarOptions.prototype.constructor = ColorBarOptions;\n GuideOptions$Companion$NONE$ObjectLiteral.prototype = Object.create(GuideOptions.prototype);\n GuideOptions$Companion$NONE$ObjectLiteral.prototype.constructor = GuideOptions$Companion$NONE$ObjectLiteral;\n LegendAssembler$createLegend$ObjectLiteral.prototype = Object.create(LegendBoxInfo.prototype);\n LegendAssembler$createLegend$ObjectLiteral.prototype.constructor = LegendAssembler$createLegend$ObjectLiteral;\n LegendOptions.prototype = Object.create(GuideOptions.prototype);\n LegendOptions.prototype.constructor = LegendOptions;\n PosProvider$Companion$wrap$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$wrap$ObjectLiteral.prototype.constructor = PosProvider$Companion$wrap$ObjectLiteral;\n PosProvider$Companion$barStack$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$barStack$ObjectLiteral.prototype.constructor = PosProvider$Companion$barStack$ObjectLiteral;\n PosProvider$Companion$dodge$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$dodge$ObjectLiteral.prototype.constructor = PosProvider$Companion$dodge$ObjectLiteral;\n PosProvider$Companion$fill$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$fill$ObjectLiteral.prototype.constructor = PosProvider$Companion$fill$ObjectLiteral;\n PosProvider$Companion$jitter$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$jitter$ObjectLiteral.prototype.constructor = PosProvider$Companion$jitter$ObjectLiteral;\n PosProvider$Companion$nudge$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$nudge$ObjectLiteral.prototype.constructor = PosProvider$Companion$nudge$ObjectLiteral;\n PosProvider$Companion$jitterDodge$ObjectLiteral.prototype = Object.create(PosProvider.prototype);\n PosProvider$Companion$jitterDodge$ObjectLiteral.prototype.constructor = PosProvider$Companion$jitterDodge$ObjectLiteral;\n FacetGrid.prototype = Object.create(PlotFacets.prototype);\n FacetGrid.prototype.constructor = FacetGrid;\n FacetWrap$Direction.prototype = Object.create(Enum.prototype);\n FacetWrap$Direction.prototype.constructor = FacetWrap$Direction;\n FacetWrap.prototype = Object.create(PlotFacets.prototype);\n FacetWrap.prototype.constructor = FacetWrap;\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.prototype = Object.create(GeomProvider.prototype);\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.prototype.constructor = GeomProvider$GeomProviderBuilder$build$ObjectLiteral;\n CartesianCoordProvider.prototype = Object.create(CoordProviderBase.prototype);\n CartesianCoordProvider.prototype.constructor = CartesianCoordProvider;\n FixedRatioCoordProvider.prototype = Object.create(CoordProviderBase.prototype);\n FixedRatioCoordProvider.prototype.constructor = FixedRatioCoordProvider;\n ProjectionCoordProvider.prototype = Object.create(CoordProviderBase.prototype);\n ProjectionCoordProvider.prototype.constructor = ProjectionCoordProvider;\n MouseEventPeer$addEventHandler$ObjectLiteral.prototype = Object.create(Registration.prototype);\n MouseEventPeer$addEventHandler$ObjectLiteral.prototype.constructor = MouseEventPeer$addEventHandler$ObjectLiteral;\n AxisComponent.prototype = Object.create(SvgComponent.prototype);\n AxisComponent.prototype.constructor = AxisComponent;\n LegendBox.prototype = Object.create(SvgComponent.prototype);\n LegendBox.prototype.constructor = LegendBox;\n ColorBarComponent.prototype = Object.create(LegendBox.prototype);\n ColorBarComponent.prototype.constructor = ColorBarComponent;\n ColorBarComponentLayout.prototype = Object.create(LegendBoxLayout.prototype);\n ColorBarComponentLayout.prototype.constructor = ColorBarComponentLayout;\n ColorBarComponentLayout$HorizontalLayout.prototype = Object.create(ColorBarComponentLayout.prototype);\n ColorBarComponentLayout$HorizontalLayout.prototype.constructor = ColorBarComponentLayout$HorizontalLayout;\n ColorBarComponentLayout$VerticalLayout.prototype = Object.create(ColorBarComponentLayout.prototype);\n ColorBarComponentLayout$VerticalLayout.prototype.constructor = ColorBarComponentLayout$VerticalLayout;\n ColorBarComponentSpec.prototype = Object.create(LegendBoxSpec.prototype);\n ColorBarComponentSpec.prototype.constructor = ColorBarComponentSpec;\n LegendArrangement.prototype = Object.create(Enum.prototype);\n LegendArrangement.prototype.constructor = LegendArrangement;\n LegendComponent.prototype = Object.create(LegendBox.prototype);\n LegendComponent.prototype.constructor = LegendComponent;\n LegendComponentLayout.prototype = Object.create(LegendBoxLayout.prototype);\n LegendComponentLayout.prototype.constructor = LegendComponentLayout;\n LegendComponentLayout$MyHorizontal.prototype = Object.create(LegendComponentLayout.prototype);\n LegendComponentLayout$MyHorizontal.prototype.constructor = LegendComponentLayout$MyHorizontal;\n LegendComponentLayout$MyMultiRow.prototype = Object.create(LegendComponentLayout.prototype);\n LegendComponentLayout$MyMultiRow.prototype.constructor = LegendComponentLayout$MyMultiRow;\n LegendComponentLayout$MyHorizontalMultiRow.prototype = Object.create(LegendComponentLayout$MyMultiRow.prototype);\n LegendComponentLayout$MyHorizontalMultiRow.prototype.constructor = LegendComponentLayout$MyHorizontalMultiRow;\n LegendComponentLayout$MyVertical.prototype = Object.create(LegendComponentLayout$MyMultiRow.prototype);\n LegendComponentLayout$MyVertical.prototype.constructor = LegendComponentLayout$MyVertical;\n LegendComponentSpec.prototype = Object.create(LegendBoxSpec.prototype);\n LegendComponentSpec.prototype.constructor = LegendComponentSpec;\n LegendDirection.prototype = Object.create(Enum.prototype);\n LegendDirection.prototype.constructor = LegendDirection;\n Orientation.prototype = Object.create(Enum.prototype);\n Orientation.prototype.constructor = Orientation;\n MathUtil$ClosestPointChecker$COMPARISON_RESULT.prototype = Object.create(Enum.prototype);\n MathUtil$ClosestPointChecker$COMPARISON_RESULT.prototype.constructor = MathUtil$ClosestPointChecker$COMPARISON_RESULT;\n LayerTargetLocator$Collector$CollectingStrategy.prototype = Object.create(Enum.prototype);\n LayerTargetLocator$Collector$CollectingStrategy.prototype.constructor = LayerTargetLocator$Collector$CollectingStrategy;\n PointTargetProjection.prototype = Object.create(TargetProjection.prototype);\n PointTargetProjection.prototype.constructor = PointTargetProjection;\n RectTargetProjection.prototype = Object.create(TargetProjection.prototype);\n RectTargetProjection.prototype.constructor = RectTargetProjection;\n PolygonTargetProjection.prototype = Object.create(TargetProjection.prototype);\n PolygonTargetProjection.prototype.constructor = PolygonTargetProjection;\n PathTargetProjection.prototype = Object.create(TargetProjection.prototype);\n PathTargetProjection.prototype.constructor = PathTargetProjection;\n FacetGridPlotLayout.prototype = Object.create(PlotLayoutBase.prototype);\n FacetGridPlotLayout.prototype.constructor = FacetGridPlotLayout;\n LegendBoxInfo$Companion$EMPTY$ObjectLiteral.prototype = Object.create(LegendBoxInfo.prototype);\n LegendBoxInfo$Companion$EMPTY$ObjectLiteral.prototype.constructor = LegendBoxInfo$Companion$EMPTY$ObjectLiteral;\n SingleTilePlotLayout.prototype = Object.create(PlotLayoutBase.prototype);\n SingleTilePlotLayout.prototype.constructor = SingleTilePlotLayout;\n HorizontalAxisLayouter.prototype = Object.create(AxisLayouter.prototype);\n HorizontalAxisLayouter.prototype.constructor = HorizontalAxisLayouter;\n VerticalAxisLayouter.prototype = Object.create(AxisLayouter.prototype);\n VerticalAxisLayouter.prototype.constructor = VerticalAxisLayouter;\n AbstractFixedBreaksLabelsLayout.prototype = Object.create(AxisLabelsLayout.prototype);\n AbstractFixedBreaksLabelsLayout.prototype.constructor = AbstractFixedBreaksLabelsLayout;\n HorizontalFixedBreaksLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n HorizontalFixedBreaksLabelsLayout.prototype.constructor = HorizontalFixedBreaksLabelsLayout;\n HorizontalFlexBreaksLabelsLayout.prototype = Object.create(AxisLabelsLayout.prototype);\n HorizontalFlexBreaksLabelsLayout.prototype.constructor = HorizontalFlexBreaksLabelsLayout;\n HorizontalMultilineLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n HorizontalMultilineLabelsLayout.prototype.constructor = HorizontalMultilineLabelsLayout;\n HorizontalSimpleLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n HorizontalSimpleLabelsLayout.prototype.constructor = HorizontalSimpleLabelsLayout;\n HorizontalTiltedLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n HorizontalTiltedLabelsLayout.prototype.constructor = HorizontalTiltedLabelsLayout;\n HorizontalVerticalLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n HorizontalVerticalLabelsLayout.prototype.constructor = HorizontalVerticalLabelsLayout;\n VerticalFixedBreaksLabelsLayout.prototype = Object.create(AbstractFixedBreaksLabelsLayout.prototype);\n VerticalFixedBreaksLabelsLayout.prototype.constructor = VerticalFixedBreaksLabelsLayout;\n VerticalFlexBreaksLabelsLayout.prototype = Object.create(AxisLabelsLayout.prototype);\n VerticalFlexBreaksLabelsLayout.prototype.constructor = VerticalFlexBreaksLabelsLayout;\n PlotLabelSpec.prototype = Object.create(Enum.prototype);\n PlotLabelSpec.prototype.constructor = PlotLabelSpec;\n GroupSamplingBase.prototype = Object.create(SamplingBase.prototype);\n GroupSamplingBase.prototype.constructor = GroupSamplingBase;\n GroupRandomSampling.prototype = Object.create(GroupSamplingBase.prototype);\n GroupRandomSampling.prototype.constructor = GroupRandomSampling;\n GroupSystematicSampling.prototype = Object.create(GroupSamplingBase.prototype);\n GroupSystematicSampling.prototype.constructor = GroupSystematicSampling;\n PickSampling.prototype = Object.create(SamplingBase.prototype);\n PickSampling.prototype.constructor = PickSampling;\n RandomSampling.prototype = Object.create(SamplingBase.prototype);\n RandomSampling.prototype.constructor = RandomSampling;\n RandomStratifiedSampling.prototype = Object.create(SamplingBase.prototype);\n RandomStratifiedSampling.prototype.constructor = RandomStratifiedSampling;\n SystematicSampling.prototype = Object.create(SamplingBase.prototype);\n SystematicSampling.prototype.constructor = SystematicSampling;\n VertexSampling.prototype = Object.create(SamplingBase.prototype);\n VertexSampling.prototype.constructor = VertexSampling;\n VertexSampling$VertexVwSampling.prototype = Object.create(VertexSampling.prototype);\n VertexSampling$VertexVwSampling.prototype.constructor = VertexSampling$VertexVwSampling;\n VertexSampling$VertexDpSampling.prototype = Object.create(VertexSampling.prototype);\n VertexSampling$VertexDpSampling.prototype.constructor = VertexSampling$VertexDpSampling;\n VertexSampling$DoubleVectorComponentsList.prototype = Object.create(AbstractList.prototype);\n VertexSampling$DoubleVectorComponentsList.prototype.constructor = VertexSampling$DoubleVectorComponentsList;\n ContinuousOnlyMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n ContinuousOnlyMapperProvider.prototype.constructor = ContinuousOnlyMapperProvider;\n DiscreteOnlyMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n DiscreteOnlyMapperProvider.prototype.constructor = DiscreteOnlyMapperProvider;\n IdentityDiscreteMapperProvider.prototype = Object.create(DiscreteOnlyMapperProvider.prototype);\n IdentityDiscreteMapperProvider.prototype.constructor = IdentityDiscreteMapperProvider;\n DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral.prototype = Object.create(IdentityDiscreteMapperProvider.prototype);\n DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral.prototype.constructor = DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral;\n DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral.prototype = Object.create(IdentityDiscreteMapperProvider.prototype);\n DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral.prototype.constructor = DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral;\n LinearNormalizingMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n LinearNormalizingMapperProvider.prototype.constructor = LinearNormalizingMapperProvider;\n AlphaMapperProvider.prototype = Object.create(LinearNormalizingMapperProvider.prototype);\n AlphaMapperProvider.prototype.constructor = AlphaMapperProvider;\n ColorBrewerMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n ColorBrewerMapperProvider.prototype.constructor = ColorBrewerMapperProvider;\n ColorGradient2MapperProvider.prototype = Object.create(ContinuousOnlyMapperProvider.prototype);\n ColorGradient2MapperProvider.prototype.constructor = ColorGradient2MapperProvider;\n ColorGradientMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n ColorGradientMapperProvider.prototype.constructor = ColorGradientMapperProvider;\n HSVColorMapperProvider.prototype = Object.create(MapperProviderBase.prototype);\n HSVColorMapperProvider.prototype.constructor = HSVColorMapperProvider;\n ColorHueMapperProvider.prototype = Object.create(HSVColorMapperProvider.prototype);\n ColorHueMapperProvider.prototype.constructor = ColorHueMapperProvider;\n DirectlyProportionalMapperProvider.prototype = Object.create(ContinuousOnlyMapperProvider.prototype);\n DirectlyProportionalMapperProvider.prototype.constructor = DirectlyProportionalMapperProvider;\n GreyscaleLightnessMapperProvider.prototype = Object.create(HSVColorMapperProvider.prototype);\n GreyscaleLightnessMapperProvider.prototype.constructor = GreyscaleLightnessMapperProvider;\n SizeAreaMapperProvider.prototype = Object.create(DirectlyProportionalMapperProvider.prototype);\n SizeAreaMapperProvider.prototype.constructor = SizeAreaMapperProvider;\n SizeMapperProvider.prototype = Object.create(LinearNormalizingMapperProvider.prototype);\n SizeMapperProvider.prototype.constructor = SizeMapperProvider;\n DefaultTheme$multiTile$ObjectLiteral.prototype = Object.create(DefaultTheme.prototype);\n DefaultTheme$multiTile$ObjectLiteral.prototype.constructor = DefaultTheme$multiTile$ObjectLiteral;\n DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral.prototype = Object.create(DefaultAxisTheme.prototype);\n DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral.prototype.constructor = DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral;\n function FeatureSwitch() {\n FeatureSwitch_instance = this;\n this.PLOT_DEBUG_DRAWING = false;\n this.LEGEND_DEBUG_DRAWING = false;\n this.PRINT_DEBUG_LOGS_0 = false;\n this.PRINT_ENCODED_DATA_SUMMARY_0 = false;\n this.USE_DATA_FRAME_ENCODING = true;\n }\n FeatureSwitch.prototype.printEncodedDataSummary_d0u64m$ = function (header, dataSpec) {\n if (this.PRINT_ENCODED_DATA_SUMMARY_0) {\n this.printEncodedDataSummary_0(header, data.DataFrameUtil.fromMap_bkhwtg$(dataSpec));\n }};\n FeatureSwitch.prototype.isDebugLogEnabled = function () {\n return this.PRINT_DEBUG_LOGS_0;\n };\n FeatureSwitch.prototype.printEncodedDataSummary_0 = function (header, df) {\n if (this.PRINT_ENCODED_DATA_SUMMARY_0) {\n var summary = data.DataFrameUtil.getSummaryText_dhhkv7$(df);\n println(header);\n println(summary);\n }};\n FeatureSwitch.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'FeatureSwitch',\n interfaces: []\n };\n var FeatureSwitch_instance = null;\n function FeatureSwitch_getInstance() {\n if (FeatureSwitch_instance === null) {\n new FeatureSwitch();\n }return FeatureSwitch_instance;\n }\n function AxisUtil() {\n AxisUtil_instance = this;\n }\n AxisUtil.prototype.applyLayoutInfo_4pg061$ = function (axis, info) {\n axis.tickLabelOffsets.set_11rb$(info.tickLabelAdditionalOffsets);\n axis.tickLabelRotationDegree.set_11rb$(info.tickLabelRotationAngle);\n if (info.tickLabelHorizontalAnchor != null) {\n axis.tickLabelHorizontalAnchor.set_11rb$(info.tickLabelHorizontalAnchor);\n }if (info.tickLabelVerticalAnchor != null) {\n axis.tickLabelVerticalAnchor.set_11rb$(info.tickLabelVerticalAnchor);\n }axis.tickLabelSmallFont.set_11rb$(info.tickLabelSmallFont);\n };\n AxisUtil.prototype.applyTheme_tna4q5$ = function (axis, theme) {\n axis.tickLabelsEnabled().set_11rb$(theme.showTickLabels());\n axis.tickMarksEnabled().set_11rb$(theme.showTickMarks());\n axis.axisLineEnabled().set_11rb$(theme.showLine());\n axis.lineWidth.set_11rb$(theme.lineWidth());\n axis.tickMarkLength.set_11rb$(theme.tickMarkLength());\n axis.tickMarkPadding.set_11rb$(theme.tickMarkPadding());\n axis.tickMarkWidth.set_11rb$(theme.tickMarkWidth());\n };\n AxisUtil.prototype.setBreaks_6e5l22$ = function (axis, scale, coord, horizontal) {\n var scaleBreaks = scale.getScaleBreaks();\n var mappedBreaks = this.toAxisCoord_0(scaleBreaks, scale, coord, horizontal);\n axis.breaks.set_11rb$(mappedBreaks);\n axis.labels.set_11rb$(scaleBreaks.labels);\n };\n AxisUtil.prototype.toAxisCoord_0 = function (scaleBreaks, scale_0, coord, horizontal) {\n var tmp$, tmp$_0;\n var $receiver = scale.ScaleUtil.map_9ksyxk$(scaleBreaks.transformedValues, scale_0);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n var tmp$_2;\n destination.add_11rb$(typeof (tmp$_2 = item) === 'number' ? tmp$_2 : throwCCE());\n }\n var breaksMapped = destination;\n var axisBreaks = ArrayList_init();\n tmp$ = breaksMapped.iterator();\n while (tmp$.hasNext()) {\n var br = tmp$.next();\n if (horizontal === true)\n tmp$_0 = new DoubleVector(br, 0.0);\n else if (horizontal === false)\n tmp$_0 = new DoubleVector(0.0, br);\n else\n tmp$_0 = Kotlin.noWhenBranchMatched();\n var mappedBrPoint = tmp$_0;\n var axisBrPoint = coord.toClient_gpjtzr$(mappedBrPoint);\n var axisBr = horizontal ? axisBrPoint.x : axisBrPoint.y;\n axisBreaks.add_11rb$(axisBr);\n if (!isFinite(axisBr)) {\n throw IllegalStateException_init(\"Illegal axis '\" + scale_0.name + \"' break position \" + toString(axisBr) + ' at index ' + toString(axisBreaks.size - 1 | 0) + '\\nsource breaks : ' + toString(scaleBreaks.domainValues) + '\\ntranslated breaks: ' + toString(breaksMapped) + '\\naxis breaks : ' + toString(axisBreaks));\n }}\n return axisBreaks;\n };\n AxisUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'AxisUtil',\n interfaces: []\n };\n var AxisUtil_instance = null;\n function AxisUtil_getInstance() {\n if (AxisUtil_instance === null) {\n new AxisUtil();\n }return AxisUtil_instance;\n }\n function BogusCoordinateSystem() {\n }\n BogusCoordinateSystem.prototype.toClient_gpjtzr$ = function (p) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n BogusCoordinateSystem.prototype.fromClient_gpjtzr$ = function (p) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n BogusCoordinateSystem.prototype.isPointInLimits_k2qmv6$$default = function (p, isClient) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n BogusCoordinateSystem.prototype.isRectInLimits_fd842m$$default = function (rect, isClient) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n BogusCoordinateSystem.prototype.isPathInLimits_f6t8kh$$default = function (path, isClient) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n BogusCoordinateSystem.prototype.isPolygonInLimits_f6t8kh$$default = function (polygon, isClient) {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n };\n Object.defineProperty(BogusCoordinateSystem.prototype, 'xClientLimit', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusCoordinateSystem.prototype, 'yClientLimit', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus coordinate system is not supposed to be used.');\n }\n });\n BogusCoordinateSystem.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BogusCoordinateSystem',\n interfaces: [CoordinateSystem]\n };\n function BogusScale() {\n }\n Object.defineProperty(BogusScale.prototype, 'name', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'labelFormatter', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'isContinuous', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'isContinuousDomain', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'multiplicativeExpand', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'additiveExpand', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'transform', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n Object.defineProperty(BogusScale.prototype, 'mapper', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n }\n });\n BogusScale.prototype.hasBreaks = function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.prototype.hasDomainLimits = function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.prototype.isInDomainLimits_za3rmp$ = function (v) {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.prototype.getScaleBreaks = function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.prototype.applyTransform_yzw12z$ = function (source, checkLimits) {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.prototype.getBreaksGenerator = function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.prototype.with = function () {\n throw IllegalStateException_init('Bogus scale is not supposed to be used.');\n };\n BogusScale.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BogusScale',\n interfaces: [Scale]\n };\n function GeomLayer() {\n }\n GeomLayer.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GeomLayer',\n interfaces: []\n };\n function GeomLayerListUtil() {\n GeomLayerListUtil_instance = this;\n }\n GeomLayerListUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GeomLayerListUtil',\n interfaces: []\n };\n var GeomLayerListUtil_instance = null;\n function GeomLayerListUtil_getInstance() {\n if (GeomLayerListUtil_instance === null) {\n new GeomLayerListUtil();\n }return GeomLayerListUtil_instance;\n }\n function LayerRendererUtil() {\n LayerRendererUtil_instance = this;\n }\n LayerRendererUtil.prototype.createLayerRendererData_knseyn$ = function (layer, sharedNumericMappers, overallNumericDomains) {\n var aestheticMappers = PlotUtil_getInstance().prepareLayerAestheticMappers_viiuew$(layer, sharedNumericMappers);\n var aesthetics = PlotUtil_getInstance().createLayerAesthetics_kpf4gp$(layer, aestheticMappers, overallNumericDomains);\n var pos = PlotUtil_getInstance().createLayerPos_2iooof$(layer, aesthetics);\n return new LayerRendererUtil$LayerRendererData(layer, aesthetics, aestheticMappers, pos);\n };\n function LayerRendererUtil$LayerRendererData(layer, aesthetics, aestheticMappers, pos) {\n this.aesthetics = aesthetics;\n this.aestheticMappers = aestheticMappers;\n this.pos = pos;\n this.geom = layer.geom;\n this.geomKind = layer.geomKind;\n this.dataAccess = layer.dataAccess;\n this.contextualMapping = layer.contextualMapping;\n }\n LayerRendererUtil$LayerRendererData.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LayerRendererData',\n interfaces: []\n };\n LayerRendererUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'LayerRendererUtil',\n interfaces: []\n };\n var LayerRendererUtil_instance = null;\n function LayerRendererUtil_getInstance() {\n if (LayerRendererUtil_instance === null) {\n new LayerRendererUtil();\n }return LayerRendererUtil_instance;\n }\n function Plot(theme) {\n Plot$Companion_getInstance();\n SvgComponent.call(this);\n this.theme_5sfato$_0 = theme;\n this.myPreferredSize_8a54qv$_0 = new ValueProperty(Plot$Companion_getInstance().DEF_PLOT_SIZE_0);\n this.myLaidOutSize_jqfjq$_0 = new ValueProperty(DoubleVector.Companion.ZERO);\n this.myTooltipHelper_3jkkzs$_0 = new PlotTooltipHelper();\n this.myLiveMapFigures_nd8qng$_0 = ArrayList_init();\n this.mouseEventPeer = new MouseEventPeer();\n }\n Object.defineProperty(Plot.prototype, 'liveMapFigures_8be2vx$', {\n configurable: true,\n get: function () {\n return this.myLiveMapFigures_nd8qng$_0;\n }\n });\n Plot.prototype.preferredSize_8be2vx$ = function () {\n return this.myPreferredSize_8a54qv$_0;\n };\n Plot.prototype.laidOutSize = function () {\n return this.myLaidOutSize_jqfjq$_0;\n };\n function Plot$buildComponent$lambda() {\n return 'buildPlot';\n }\n Plot.prototype.buildComponent = function () {\n var tmp$;\n try {\n this.buildPlot_wr1hxq$_0();\n } catch (e) {\n if (Kotlin.isType(e, RuntimeException)) {\n Plot$Companion_getInstance().LOG_0.error_l35kib$(e, Plot$buildComponent$lambda);\n var rootCause = base.Throwables.getRootCause_tcv7n7$(e);\n var messages = ['Error building plot: ' + Kotlin.getKClassFromExpression(rootCause).simpleName, rootCause.message != null ? \"'\" + rootCause.message + \"'\" : ''];\n var y = this.myPreferredSize_8a54qv$_0.get().y / 2 - 8;\n for (tmp$ = 0; tmp$ !== messages.length; ++tmp$) {\n var s = messages[tmp$];\n var errorLabel = new TextLabel(s);\n errorLabel.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE);\n errorLabel.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.CENTER);\n errorLabel.moveTo_lu1900$(this.myPreferredSize_8a54qv$_0.get().x / 2, y);\n this.rootGroup.children().add_11rb$(errorLabel.rootGroup);\n y += 16.0;\n }\n } else\n throw e;\n }\n };\n function Plot$buildPlot$ObjectLiteral(this$Plot) {\n this.this$Plot = this$Plot;\n }\n Plot$buildPlot$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n var newValue = event.newValue;\n if (ensureNotNull(newValue).x > 0 && newValue.y > 0) {\n this.this$Plot.rebuildPlot_v06af3$_0();\n }};\n Plot$buildPlot$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n function Plot$buildPlot$ObjectLiteral_0(this$Plot) {\n this.this$Plot = this$Plot;\n Registration.call(this);\n }\n Plot$buildPlot$ObjectLiteral_0.prototype.doRemove = function () {\n this.this$Plot.myTooltipHelper_3jkkzs$_0.removeAllTileInfos();\n this.this$Plot.myLiveMapFigures_nd8qng$_0.clear();\n };\n Plot$buildPlot$ObjectLiteral_0.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n Plot.prototype.buildPlot_wr1hxq$_0 = function () {\n this.rootGroup.addClass_61zpoe$(Style_getInstance().PLOT);\n this.buildPlotComponents_8cuv6w$_0();\n this.reg_3xv6fb$(this.myPreferredSize_8a54qv$_0.addHandler_gxwwpc$(new Plot$buildPlot$ObjectLiteral(this)));\n this.reg_3xv6fb$(new Plot$buildPlot$ObjectLiteral_0(this));\n };\n Plot.prototype.rebuildPlot_v06af3$_0 = function () {\n this.clear();\n this.buildPlot_wr1hxq$_0();\n };\n Plot.prototype.createTile_rg9gwo$_0 = function (tilesOrigin, tileInfo, tileLayers, theme) {\n var xScale;\n var yScale;\n var coord;\n if (tileInfo.xAxisInfo != null && tileInfo.yAxisInfo != null) {\n var xDomain = ensureNotNull(tileInfo.xAxisInfo.axisDomain);\n var xAxisLength = tileInfo.xAxisInfo.axisLength;\n var yDomain = ensureNotNull(tileInfo.yAxisInfo.axisDomain);\n var yAxisLength = tileInfo.yAxisInfo.axisLength;\n xScale = this.coordProvider.buildAxisScaleX_ny58zc$(this.scaleXProto, xDomain, xAxisLength, ensureNotNull(tileInfo.xAxisInfo.axisBreaks));\n yScale = this.coordProvider.buildAxisScaleY_ny58zc$(this.scaleYProto, yDomain, yAxisLength, ensureNotNull(tileInfo.yAxisInfo.axisBreaks));\n coord = this.coordProvider.createCoordinateSystem_uncllg$(xDomain, xAxisLength, yDomain, yAxisLength);\n } else {\n xScale = new BogusScale();\n yScale = new BogusScale();\n coord = new BogusCoordinateSystem();\n }\n var tile = new PlotTile(tileLayers, xScale, yScale, tilesOrigin, tileInfo, coord, theme);\n tile.setShowAxis_6taknv$(this.isAxisEnabled);\n tile.debugDrawing().set_11rb$(Plot$Companion_getInstance().DEBUG_DRAWING_0);\n return tile;\n };\n Plot.prototype.createAxisTitle_depkt8$_0 = function (text, orientation, plotBounds, geomBounds) {\n var tmp$;\n var horizontalAnchor = TextLabel$HorizontalAnchor.MIDDLE;\n switch (orientation.name) {\n case 'LEFT':\n case 'RIGHT':\n case 'TOP':\n tmp$ = TextLabel$VerticalAnchor.TOP;\n break;\n case 'BOTTOM':\n tmp$ = TextLabel$VerticalAnchor.BOTTOM;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n var verticalAnchor = tmp$;\n var titleLocation;\n var rotation = 0.0;\n switch (orientation.name) {\n case 'LEFT':\n titleLocation = new DoubleVector(plotBounds.left + PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN, geomBounds.center.y);\n rotation = -90.0;\n break;\n case 'RIGHT':\n titleLocation = new DoubleVector(plotBounds.right - PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN, geomBounds.center.y);\n rotation = 90.0;\n break;\n case 'TOP':\n titleLocation = new DoubleVector(geomBounds.center.x, plotBounds.top + PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN);\n break;\n case 'BOTTOM':\n titleLocation = new DoubleVector(geomBounds.center.x, plotBounds.bottom - PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN);\n break;\n default:Kotlin.noWhenBranchMatched();\n break;\n }\n var titleLabel = new TextLabel(text);\n titleLabel.setHorizontalAnchor_ja80zo$(horizontalAnchor);\n titleLabel.setVerticalAnchor_yaudma$(verticalAnchor);\n titleLabel.moveTo_gpjtzr$(titleLocation);\n titleLabel.rotate_14dthe$(rotation);\n var titleElement = titleLabel.rootGroup;\n titleElement.addClass_61zpoe$(Style_getInstance().AXIS_TITLE);\n var parent = new SvgGElement();\n parent.addClass_61zpoe$(Style_getInstance().AXIS);\n parent.children().add_11rb$(titleElement);\n this.add_26jijc$(parent);\n };\n function Plot$onMouseMove$ObjectLiteral(closure$message) {\n this.closure$message = closure$message;\n }\n Plot$onMouseMove$ObjectLiteral.prototype.handle_42da0z$ = function (node, e) {\n println(this.closure$message);\n };\n Plot$onMouseMove$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [SvgEventHandler]\n };\n Plot.prototype.onMouseMove_hnimoe$_0 = function (e, message) {\n e.addEventHandler_mm8kk2$(SvgEventSpec.MOUSE_MOVE, new Plot$onMouseMove$ObjectLiteral(message));\n };\n Plot.prototype.buildPlotComponents_8cuv6w$_0 = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4, tmp$_5;\n var preferredSize = this.myPreferredSize_8a54qv$_0.get();\n var overallRect = new DoubleRectangle(DoubleVector.Companion.ZERO, preferredSize);\n if (Plot$Companion_getInstance().DEBUG_DRAWING_0) {\n var rect = SvgRectElement_init(overallRect);\n rect.strokeColor().set_11rb$(Color.Companion.MAGENTA);\n rect.strokeWidth().set_11rb$(1.0);\n rect.fillOpacity().set_11rb$(0.0);\n this.onMouseMove_hnimoe$_0(rect, 'MAGENTA: preferred size: ' + overallRect);\n this.add_26jijc$(rect);\n }if (this.hasLiveMap()) {\n tmp$ = PlotLayoutUtil_getInstance().liveMapBounds_wthzt5$(overallRect);\n } else {\n tmp$ = overallRect;\n }\n var entirePlot = tmp$;\n if (this.hasTitle()) {\n var titleSize = PlotLayoutUtil_getInstance().titleDimensions_61zpoe$(this.title);\n tmp$_0 = new DoubleRectangle(entirePlot.origin.add_gpjtzr$(new DoubleVector(0.0, titleSize.y)), entirePlot.dimension.subtract_gpjtzr$(new DoubleVector(0.0, titleSize.y)));\n } else {\n tmp$_0 = entirePlot;\n }\n var withoutTitle = tmp$_0;\n var boxesLayoutResult = null;\n var legendTheme = this.theme_5sfato$_0.legend();\n if (legendTheme.position().isFixed) {\n var legendBoxesLayout = new LegendBoxesLayout(withoutTitle, legendTheme);\n boxesLayoutResult = legendBoxesLayout.doLayout_8sg693$(this.legendBoxInfos);\n tmp$_1 = boxesLayoutResult.plotInnerBoundsWithoutLegendBoxes;\n } else {\n tmp$_1 = withoutTitle;\n }\n var withoutTitleAndLegends = tmp$_1;\n if (Plot$Companion_getInstance().DEBUG_DRAWING_0) {\n var rect_0 = SvgRectElement_init(withoutTitleAndLegends);\n rect_0.strokeColor().set_11rb$(Color.Companion.BLUE);\n rect_0.strokeWidth().set_11rb$(1.0);\n rect_0.fillOpacity().set_11rb$(0.0);\n this.onMouseMove_hnimoe$_0(rect_0, 'BLUE: plot without title and legends: ' + withoutTitleAndLegends);\n this.add_26jijc$(rect_0);\n }var geomAndAxis = withoutTitleAndLegends;\n if (this.isAxisEnabled) {\n if (this.hasAxisTitleLeft()) {\n var titleSize_0 = PlotLayoutUtil_getInstance().axisTitleDimensions_61zpoe$(this.axisTitleLeft);\n var thickness = titleSize_0.y + PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN + PlotLayoutUtil_getInstance().AXIS_TITLE_INNER_MARGIN;\n geomAndAxis = DoubleRectangle_init(geomAndAxis.left + thickness, geomAndAxis.top, geomAndAxis.width - thickness, geomAndAxis.height);\n }if (this.hasAxisTitleBottom()) {\n var titleSize_1 = PlotLayoutUtil_getInstance().axisTitleDimensions_61zpoe$(this.axisTitleBottom);\n var thickness_0 = titleSize_1.y + PlotLayoutUtil_getInstance().AXIS_TITLE_OUTER_MARGIN + PlotLayoutUtil_getInstance().AXIS_TITLE_INNER_MARGIN;\n geomAndAxis = DoubleRectangle_init(geomAndAxis.left, geomAndAxis.top, geomAndAxis.width, geomAndAxis.height - thickness_0);\n }}var plotLayout = this.plotLayout();\n var plotInfo = plotLayout.doLayout_gpjtzr$(geomAndAxis.dimension);\n this.myLaidOutSize_jqfjq$_0.set_11rb$(preferredSize);\n if (plotInfo.tiles.isEmpty()) {\n return;\n }var geomAreaBounds = PlotLayoutUtil_getInstance().absoluteGeomBounds_vjhcds$(geomAndAxis.origin, plotInfo);\n if (legendTheme.position().isOverlay) {\n var legendBoxesLayout_0 = new LegendBoxesLayout(geomAreaBounds, legendTheme);\n boxesLayoutResult = legendBoxesLayout_0.doLayout_8sg693$(this.legendBoxInfos);\n }if (plotInfo.tiles.size > 1) {\n tmp$_2 = this.theme_5sfato$_0.multiTile();\n } else {\n tmp$_2 = this.theme_5sfato$_0;\n }\n var tileTheme = tmp$_2;\n var tilesOrigin = geomAndAxis.origin;\n tmp$_3 = plotInfo.tiles.iterator();\n while (tmp$_3.hasNext()) {\n var tileLayoutInfo = tmp$_3.next();\n var tileLayersIndex = tileLayoutInfo.trueIndex;\n var tile = this.createTile_rg9gwo$_0(tilesOrigin, tileLayoutInfo, this.tileLayers_za3lpa$(tileLayersIndex), tileTheme);\n var plotOriginAbsolute = tilesOrigin.add_gpjtzr$(tileLayoutInfo.plotOrigin);\n tile.moveTo_gpjtzr$(plotOriginAbsolute);\n this.add_8icvvv$(tile);\n if ((tmp$_4 = tile.liveMapFigure) != null) {\n getCallableRef('add', function ($receiver, p1) {\n return $receiver.add_11rb$(p1);\n }.bind(null, this.myLiveMapFigures_nd8qng$_0))(tmp$_4);\n }var geomBoundsAbsolute = tileLayoutInfo.geomBounds.add_gpjtzr$(plotOriginAbsolute);\n this.myTooltipHelper_3jkkzs$_0.addTileInfo_t6qbjr$(geomBoundsAbsolute, tile.targetLocators);\n }\n if (Plot$Companion_getInstance().DEBUG_DRAWING_0) {\n var rect_1 = SvgRectElement_init(geomAreaBounds);\n rect_1.strokeColor().set_11rb$(Color.Companion.RED);\n rect_1.strokeWidth().set_11rb$(1.0);\n rect_1.fillOpacity().set_11rb$(0.0);\n this.add_26jijc$(rect_1);\n }if (this.hasTitle()) {\n var titleLabel = new TextLabel(this.title);\n titleLabel.addClassName_61zpoe$(Style_getInstance().PLOT_TITLE);\n titleLabel.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.LEFT);\n titleLabel.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.CENTER);\n var titleSize_2 = PlotLayoutUtil_getInstance().titleDimensions_61zpoe$(this.title);\n var titleBounds = DoubleRectangle_init(geomAreaBounds.origin.x, 0.0, titleSize_2.x, titleSize_2.y);\n titleLabel.moveTo_gpjtzr$(new DoubleVector(titleBounds.left, titleBounds.center.y));\n this.add_8icvvv$(titleLabel);\n if (Plot$Companion_getInstance().DEBUG_DRAWING_0) {\n var rect_2 = SvgRectElement_init(titleBounds);\n rect_2.strokeColor().set_11rb$(Color.Companion.BLUE);\n rect_2.strokeWidth().set_11rb$(1.0);\n rect_2.fillOpacity().set_11rb$(0.0);\n this.add_26jijc$(rect_2);\n }}if (this.isAxisEnabled) {\n if (this.hasAxisTitleLeft()) {\n this.createAxisTitle_depkt8$_0(this.axisTitleLeft, Orientation$LEFT_getInstance(), withoutTitleAndLegends, geomAreaBounds);\n }if (this.hasAxisTitleBottom()) {\n this.createAxisTitle_depkt8$_0(this.axisTitleBottom, Orientation$BOTTOM_getInstance(), withoutTitleAndLegends, geomAreaBounds);\n }}if (boxesLayoutResult != null) {\n tmp$_5 = boxesLayoutResult.boxWithLocationList.iterator();\n while (tmp$_5.hasNext()) {\n var boxWithLocation = tmp$_5.next();\n var legendBox = boxWithLocation.legendBox.createLegendBox();\n legendBox.moveTo_gpjtzr$(boxWithLocation.location);\n this.add_8icvvv$(legendBox);\n }\n }};\n Plot.prototype.createTooltipSpecs_gpjtzr$ = function (plotCoord) {\n return this.myTooltipHelper_3jkkzs$_0.createTooltipSpecs_gpjtzr$(plotCoord);\n };\n Plot.prototype.getGeomBounds_gpjtzr$ = function (plotCoord) {\n return this.myTooltipHelper_3jkkzs$_0.getGeomBounds_gpjtzr$(plotCoord);\n };\n function Plot$Companion() {\n Plot$Companion_instance = this;\n this.LOG_0 = logging.PortableLogging.logger_xo1ogr$(getKClass(Plot));\n this.DEF_PLOT_SIZE_0 = new DoubleVector(600.0, 400.0);\n this.DEBUG_DRAWING_0 = FeatureSwitch_getInstance().PLOT_DEBUG_DRAWING;\n }\n Plot$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var Plot$Companion_instance = null;\n function Plot$Companion_getInstance() {\n if (Plot$Companion_instance === null) {\n new Plot$Companion();\n }return Plot$Companion_instance;\n }\n Plot.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Plot',\n interfaces: [SvgComponent]\n };\n function PlotBuilder(myTheme) {\n this.myTheme_0 = myTheme;\n this.myLayersByTile_0 = ArrayList_init();\n this.myTitle_0 = null;\n this.myCoordProvider_3t551e$_0 = this.myCoordProvider_3t551e$_0;\n this.myLayout_0 = null;\n this.myAxisTitleLeft_0 = null;\n this.myAxisTitleBottom_0 = null;\n this.myLegendBoxInfos_0 = ArrayList_init();\n this.myScaleXProto_s7k1di$_0 = this.myScaleXProto_s7k1di$_0;\n this.myScaleYProto_dj5r5h$_0 = this.myScaleYProto_dj5r5h$_0;\n this.myAxisEnabled_0 = true;\n this.myInteractionsEnabled_0 = true;\n this.hasLiveMap_0 = false;\n }\n Object.defineProperty(PlotBuilder.prototype, 'myCoordProvider_0', {\n configurable: true,\n get: function () {\n if (this.myCoordProvider_3t551e$_0 == null)\n return throwUPAE('myCoordProvider');\n return this.myCoordProvider_3t551e$_0;\n },\n set: function (myCoordProvider) {\n this.myCoordProvider_3t551e$_0 = myCoordProvider;\n }\n });\n Object.defineProperty(PlotBuilder.prototype, 'myScaleXProto_0', {\n configurable: true,\n get: function () {\n if (this.myScaleXProto_s7k1di$_0 == null)\n return throwUPAE('myScaleXProto');\n return this.myScaleXProto_s7k1di$_0;\n },\n set: function (myScaleXProto) {\n this.myScaleXProto_s7k1di$_0 = myScaleXProto;\n }\n });\n Object.defineProperty(PlotBuilder.prototype, 'myScaleYProto_0', {\n configurable: true,\n get: function () {\n if (this.myScaleYProto_dj5r5h$_0 == null)\n return throwUPAE('myScaleYProto');\n return this.myScaleYProto_dj5r5h$_0;\n },\n set: function (myScaleYProto) {\n this.myScaleYProto_dj5r5h$_0 = myScaleYProto;\n }\n });\n PlotBuilder.prototype.setTitle_pdl1vj$ = function (title) {\n this.myTitle_0 = title;\n };\n PlotBuilder.prototype.setAxisTitleLeft_61zpoe$ = function (v) {\n this.myAxisTitleLeft_0 = v;\n };\n PlotBuilder.prototype.setAxisTitleBottom_61zpoe$ = function (v) {\n this.myAxisTitleBottom_0 = v;\n };\n PlotBuilder.prototype.setCoordProvider_sdecqr$ = function (coordProvider) {\n this.myCoordProvider_0 = coordProvider;\n return this;\n };\n PlotBuilder.prototype.addTileLayers_relqli$ = function (tileLayers) {\n this.myLayersByTile_0.add_11rb$(ArrayList_init_1(tileLayers));\n return this;\n };\n PlotBuilder.prototype.setPlotLayout_vjneqj$ = function (layout) {\n this.myLayout_0 = layout;\n return this;\n };\n PlotBuilder.prototype.addLegendBoxInfo_29gouq$ = function (v) {\n this.myLegendBoxInfos_0.add_11rb$(v);\n return this;\n };\n PlotBuilder.prototype.scaleXProto_iu85h4$ = function (scaleXProto) {\n this.myScaleXProto_0 = scaleXProto;\n return this;\n };\n PlotBuilder.prototype.scaleYProto_iu85h4$ = function (scaleYProto) {\n this.myScaleYProto_0 = scaleYProto;\n return this;\n };\n PlotBuilder.prototype.axisEnabled_6taknv$ = function (b) {\n this.myAxisEnabled_0 = b;\n return this;\n };\n PlotBuilder.prototype.interactionsEnabled_6taknv$ = function (b) {\n this.myInteractionsEnabled_0 = b;\n return this;\n };\n PlotBuilder.prototype.setLiveMap_6taknv$ = function (b) {\n this.hasLiveMap_0 = b;\n return this;\n };\n PlotBuilder.prototype.build = function () {\n return new PlotBuilder$MyPlot(this);\n };\n function PlotBuilder$MyPlot(b) {\n Plot.call(this, b.myTheme_0);\n this.scaleXProto_rbtdab$_0 = b.myScaleXProto_0;\n this.scaleYProto_t0wegs$_0 = b.myScaleYProto_0;\n this.myTitle_0 = b.myTitle_0;\n this.myAxisTitleLeft_0 = b.myAxisTitleLeft_0;\n this.myAxisTitleBottom_0 = b.myAxisTitleBottom_0;\n this.myAxisXTitleEnabled_0 = b.myTheme_0.axisX().showTitle();\n this.myAxisYTitleEnabled_0 = b.myTheme_0.axisY().showTitle();\n this.coordProvider_o460zb$_0 = b.myCoordProvider_0;\n this.myLayersByTile_0 = null;\n this.myLayout_0 = null;\n this.myLegendBoxInfos_0 = null;\n this.hasLiveMap_0 = false;\n this.isAxisEnabled_70ondl$_0 = false;\n this.isInteractionsEnabled_dvtvmh$_0 = false;\n this.myLayersByTile_0 = ArrayList_init_1(b.myLayersByTile_0);\n this.myLayout_0 = b.myLayout_0;\n this.myLegendBoxInfos_0 = ArrayList_init_1(b.myLegendBoxInfos_0);\n this.hasLiveMap_0 = b.hasLiveMap_0;\n this.isAxisEnabled_70ondl$_0 = b.myAxisEnabled_0;\n this.isInteractionsEnabled_dvtvmh$_0 = b.myInteractionsEnabled_0;\n }\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'scaleXProto', {\n configurable: true,\n get: function () {\n return this.scaleXProto_rbtdab$_0;\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'scaleYProto', {\n configurable: true,\n get: function () {\n return this.scaleYProto_t0wegs$_0;\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'coordProvider', {\n configurable: true,\n get: function () {\n return this.coordProvider_o460zb$_0;\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'isAxisEnabled', {\n configurable: true,\n get: function () {\n return this.isAxisEnabled_70ondl$_0;\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'isInteractionsEnabled', {\n configurable: true,\n get: function () {\n return this.isInteractionsEnabled_dvtvmh$_0;\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'title', {\n configurable: true,\n get: function () {\n if (!this.hasTitle()) {\n var message = 'No title';\n throw IllegalArgumentException_init(message.toString());\n }return ensureNotNull(this.myTitle_0);\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'axisTitleLeft', {\n configurable: true,\n get: function () {\n if (!this.hasAxisTitleLeft()) {\n var message = 'No left axis title';\n throw IllegalArgumentException_init(message.toString());\n }return ensureNotNull(this.myAxisTitleLeft_0);\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'axisTitleBottom', {\n configurable: true,\n get: function () {\n if (!this.hasAxisTitleBottom()) {\n var message = 'No bottom axis title';\n throw IllegalArgumentException_init(message.toString());\n }return ensureNotNull(this.myAxisTitleBottom_0);\n }\n });\n Object.defineProperty(PlotBuilder$MyPlot.prototype, 'legendBoxInfos', {\n configurable: true,\n get: function () {\n return this.myLegendBoxInfos_0;\n }\n });\n PlotBuilder$MyPlot.prototype.hasTitle = function () {\n return !base.Strings.isNullOrEmpty_pdl1vj$(this.myTitle_0);\n };\n PlotBuilder$MyPlot.prototype.hasAxisTitleLeft = function () {\n return this.myAxisYTitleEnabled_0 && !base.Strings.isNullOrEmpty_pdl1vj$(this.myAxisTitleLeft_0);\n };\n PlotBuilder$MyPlot.prototype.hasAxisTitleBottom = function () {\n return this.myAxisXTitleEnabled_0 && !base.Strings.isNullOrEmpty_pdl1vj$(this.myAxisTitleBottom_0);\n };\n PlotBuilder$MyPlot.prototype.hasLiveMap = function () {\n return this.hasLiveMap_0;\n };\n PlotBuilder$MyPlot.prototype.tileLayers_za3lpa$ = function (tileIndex) {\n return this.myLayersByTile_0.get_za3lpa$(tileIndex);\n };\n PlotBuilder$MyPlot.prototype.plotLayout = function () {\n return ensureNotNull(this.myLayout_0);\n };\n PlotBuilder$MyPlot.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyPlot',\n interfaces: [Plot]\n };\n PlotBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotBuilder',\n interfaces: []\n };\n function PlotContainerPortable(plot, preferredSize) {\n PlotContainerPortable$Companion_getInstance();\n this.plot = plot;\n this.preferredSize_sl52i3$_0 = preferredSize;\n this.svg = new SvgSvgElement();\n this.myContentBuilt_l8hvkk$_0 = false;\n this.myRegistrations_wwtuqx$_0 = new CompositeRegistration([]);\n this.svg.addClass_61zpoe$(Style_getInstance().PLOT_CONTAINER);\n this.setSvgSize_2l8z8v$_0(this.preferredSize_sl52i3$_0.get());\n this.plot.laidOutSize().addHandler_gxwwpc$(PlotContainerPortable$Companion_getInstance().sizePropHandler_0(PlotContainerPortable_init$lambda(this)));\n this.preferredSize_sl52i3$_0.addHandler_gxwwpc$(PlotContainerPortable$Companion_getInstance().sizePropHandler_0(PlotContainerPortable_init$lambda_0(this)));\n }\n Object.defineProperty(PlotContainerPortable.prototype, 'liveMapFigures', {\n configurable: true,\n get: function () {\n return this.plot.liveMapFigures_8be2vx$;\n }\n });\n Object.defineProperty(PlotContainerPortable.prototype, 'isLiveMap', {\n configurable: true,\n get: function () {\n return !this.plot.liveMapFigures_8be2vx$.isEmpty();\n }\n });\n PlotContainerPortable.prototype.ensureContentBuilt = function () {\n if (!this.myContentBuilt_l8hvkk$_0) {\n this.buildContent();\n }};\n PlotContainerPortable.prototype.revalidateContent_r8qzcp$_0 = function () {\n if (this.myContentBuilt_l8hvkk$_0) {\n this.clearContent();\n this.buildContent();\n }};\n function PlotContainerPortable$buildContent$ObjectLiteral() {\n }\n PlotContainerPortable$buildContent$ObjectLiteral.prototype.css = function () {\n return Style_getInstance().css;\n };\n PlotContainerPortable$buildContent$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [SvgCssResource]\n };\n PlotContainerPortable.prototype.buildContent = function () {\n if (!!this.myContentBuilt_l8hvkk$_0) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }this.myContentBuilt_l8hvkk$_0 = true;\n this.svg.setStyle_i8z0m3$(new PlotContainerPortable$buildContent$ObjectLiteral());\n var backdrop = new SvgRectElement();\n backdrop.addClass_61zpoe$(Style_getInstance().PLOT_BACKDROP);\n backdrop.setAttribute_jyasbz$('width', '100%');\n backdrop.setAttribute_jyasbz$('height', '100%');\n this.svg.children().add_11rb$(backdrop);\n this.plot.preferredSize_8be2vx$().set_11rb$(this.preferredSize_sl52i3$_0.get());\n this.svg.children().add_11rb$(this.plot.rootGroup);\n };\n PlotContainerPortable.prototype.clearContent = function () {\n if (this.myContentBuilt_l8hvkk$_0) {\n this.myContentBuilt_l8hvkk$_0 = false;\n this.svg.children().clear();\n this.plot.clear();\n this.myRegistrations_wwtuqx$_0.remove();\n this.myRegistrations_wwtuqx$_0 = new CompositeRegistration([]);\n }};\n PlotContainerPortable.prototype.reg_3xv6fb$ = function (registration) {\n this.myRegistrations_wwtuqx$_0.add_3xv6fb$(registration);\n };\n PlotContainerPortable.prototype.setSvgSize_2l8z8v$_0 = function (size) {\n this.svg.width().set_11rb$(size.x);\n this.svg.height().set_11rb$(size.y);\n };\n function PlotContainerPortable$Companion() {\n PlotContainerPortable$Companion_instance = this;\n }\n function PlotContainerPortable$Companion$sizePropHandler$ObjectLiteral(closure$block) {\n this.closure$block = closure$block;\n }\n PlotContainerPortable$Companion$sizePropHandler$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n var newValue = event.newValue;\n if (newValue != null) {\n this.closure$block(newValue);\n }};\n PlotContainerPortable$Companion$sizePropHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n PlotContainerPortable$Companion.prototype.sizePropHandler_0 = function (block) {\n return new PlotContainerPortable$Companion$sizePropHandler$ObjectLiteral(block);\n };\n PlotContainerPortable$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PlotContainerPortable$Companion_instance = null;\n function PlotContainerPortable$Companion_getInstance() {\n if (PlotContainerPortable$Companion_instance === null) {\n new PlotContainerPortable$Companion();\n }return PlotContainerPortable$Companion_instance;\n }\n function PlotContainerPortable_init$lambda(this$PlotContainerPortable) {\n return function (laidOutSize) {\n var a = this$PlotContainerPortable.preferredSize_sl52i3$_0.get().x;\n var b = laidOutSize.x;\n var tmp$ = JsMath.max(a, b);\n var a_0 = this$PlotContainerPortable.preferredSize_sl52i3$_0.get().y;\n var b_0 = laidOutSize.y;\n var newSvgSize = new DoubleVector(tmp$, JsMath.max(a_0, b_0));\n this$PlotContainerPortable.setSvgSize_2l8z8v$_0(newSvgSize);\n return Unit;\n };\n }\n function PlotContainerPortable_init$lambda_0(this$PlotContainerPortable) {\n return function (newPreferredSize) {\n if (newPreferredSize.x > 0 && newPreferredSize.y > 0) {\n this$PlotContainerPortable.revalidateContent_r8qzcp$_0();\n }return Unit;\n };\n }\n PlotContainerPortable.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotContainerPortable',\n interfaces: []\n };\n function PlotTile(layers, myScaleX, myScaleY, myTilesOrigin, myLayoutInfo, myCoord, myTheme) {\n SvgComponent.call(this);\n this.myScaleX_0 = myScaleX;\n this.myScaleY_0 = myScaleY;\n this.myTilesOrigin_0 = myTilesOrigin;\n this.myLayoutInfo_0 = myLayoutInfo;\n this.myCoord_0 = myCoord;\n this.myTheme_0 = myTheme;\n this.myDebugDrawing_0 = new ValueProperty(false);\n this.myLayers_0 = null;\n this.myTargetLocators_0 = ArrayList_init();\n this.myShowAxis_0 = false;\n this.liveMapFigure_y5x745$_0 = null;\n this.myLayers_0 = ArrayList_init_1(layers);\n this.moveTo_gpjtzr$(this.myLayoutInfo_0.getAbsoluteBounds_gpjtzr$(this.myTilesOrigin_0).origin);\n }\n Object.defineProperty(PlotTile.prototype, 'liveMapFigure', {\n configurable: true,\n get: function () {\n return this.liveMapFigure_y5x745$_0;\n },\n set: function (liveMapFigure) {\n this.liveMapFigure_y5x745$_0 = liveMapFigure;\n }\n });\n Object.defineProperty(PlotTile.prototype, 'targetLocators', {\n configurable: true,\n get: function () {\n return this.myTargetLocators_0;\n }\n });\n Object.defineProperty(PlotTile.prototype, 'isDebugDrawing_0', {\n configurable: true,\n get: function () {\n return this.myDebugDrawing_0.get();\n }\n });\n PlotTile.prototype.buildComponent = function () {\n var tmp$, tmp$_0, tmp$_1;\n var geomBounds = this.myLayoutInfo_0.geomBounds;\n if (this.myTheme_0.plot().showInnerFrame()) {\n var $receiver = SvgRectElement_init(geomBounds);\n $receiver.strokeColor().set_11rb$(this.myTheme_0.plot().innerFrameColor());\n $receiver.strokeWidth().set_11rb$(1.0);\n $receiver.fillOpacity().set_11rb$(0.0);\n var rect = $receiver;\n this.add_26jijc$(rect);\n }this.addFacetLabels_0(geomBounds, this.myTheme_0.facets());\n var $receiver_0 = this.myLayers_0;\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_2;\n tmp$_2 = $receiver_0.iterator();\n while (tmp$_2.hasNext()) {\n var element = tmp$_2.next();\n if (element.isLiveMap) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n var liveMapGeomLayer = firstOrNull$result;\n if (liveMapGeomLayer == null && this.myShowAxis_0) {\n this.addAxis_0(geomBounds);\n }if (this.isDebugDrawing_0) {\n var tileBounds = this.myLayoutInfo_0.bounds;\n var rect_0 = SvgRectElement_init(tileBounds);\n rect_0.fillColor().set_11rb$(Color.Companion.BLACK);\n rect_0.strokeWidth().set_11rb$(0.0);\n rect_0.fillOpacity().set_11rb$(0.1);\n this.add_26jijc$(rect_0);\n }if (this.isDebugDrawing_0) {\n var clipBounds = this.myLayoutInfo_0.clipBounds;\n var rect_1 = SvgRectElement_init(clipBounds);\n rect_1.fillColor().set_11rb$(Color.Companion.DARK_GREEN);\n rect_1.strokeWidth().set_11rb$(0.0);\n rect_1.fillOpacity().set_11rb$(0.3);\n this.add_26jijc$(rect_1);\n }if (this.isDebugDrawing_0) {\n var rect_2 = SvgRectElement_init(geomBounds);\n rect_2.fillColor().set_11rb$(Color.Companion.PINK);\n rect_2.strokeWidth().set_11rb$(1.0);\n rect_2.fillOpacity().set_11rb$(0.5);\n this.add_26jijc$(rect_2);\n }if (liveMapGeomLayer != null) {\n var realBounds = this.myLayoutInfo_0.getAbsoluteGeomBounds_gpjtzr$(this.myTilesOrigin_0);\n var liveMapData = createCanvasFigure(liveMapGeomLayer, realBounds);\n this.liveMapFigure = liveMapData.canvasFigure;\n this.myTargetLocators_0.add_11rb$(liveMapData.targetLocator);\n } else {\n var sharedNumericMappers = HashMap_init();\n var overallNumericDomains = HashMap_init();\n var xAxisInfo = this.myLayoutInfo_0.xAxisInfo;\n var yAxisInfo = this.myLayoutInfo_0.yAxisInfo;\n var mapperX = this.myScaleX_0.mapper;\n var mapperY = this.myScaleY_0.mapper;\n var key = Aes.Companion.X;\n sharedNumericMappers.put_xwzc9p$(key, mapperX);\n var key_0 = Aes.Companion.Y;\n sharedNumericMappers.put_xwzc9p$(key_0, mapperY);\n var key_1 = Aes.Companion.SLOPE;\n var value = scale.Mappers.mul_14dthe$(ensureNotNull(mapperY(1.0)) / ensureNotNull(mapperX(1.0)));\n sharedNumericMappers.put_xwzc9p$(key_1, value);\n var key_2 = Aes.Companion.X;\n var value_0 = ensureNotNull(ensureNotNull(xAxisInfo).axisDomain);\n overallNumericDomains.put_xwzc9p$(key_2, value_0);\n var key_3 = Aes.Companion.Y;\n var value_1 = ensureNotNull(ensureNotNull(yAxisInfo).axisDomain);\n overallNumericDomains.put_xwzc9p$(key_3, value_1);\n var geomLayerComponents = this.buildGeoms_0(sharedNumericMappers, overallNumericDomains, this.myCoord_0);\n tmp$ = geomLayerComponents.iterator();\n while (tmp$.hasNext()) {\n var layerComponent = tmp$.next();\n layerComponent.moveTo_gpjtzr$(geomBounds.origin);\n var xRange = (tmp$_0 = this.myCoord_0.xClientLimit) != null ? tmp$_0 : new ClosedRange(0.0, geomBounds.width);\n var yRange = (tmp$_1 = this.myCoord_0.yClientLimit) != null ? tmp$_1 : new ClosedRange(0.0, geomBounds.height);\n var clipRect = GeometryUtil_getInstance().doubleRange_gyv40k$(xRange, yRange);\n layerComponent.clipBounds_wthzt5$(clipRect);\n this.add_8icvvv$(layerComponent);\n }\n }\n };\n PlotTile.prototype.addFacetLabels_0 = function (geomBounds, theme) {\n var tmp$;\n var xLabels = this.myLayoutInfo_0.facetXLabels;\n if (!xLabels.isEmpty()) {\n var labelSize = FacetGridPlotLayout$Companion_getInstance().facetColLabelSize_14dthe$(geomBounds.width);\n var labelOrig = new DoubleVector(geomBounds.left + 0, geomBounds.top - FacetGridPlotLayout$Companion_getInstance().facetColHeadHeight_za3lpa$(xLabels.size) + 6);\n var labelBounds = new DoubleRectangle(labelOrig, labelSize);\n tmp$ = xLabels.iterator();\n while (tmp$.hasNext()) {\n var xLabel = tmp$.next();\n var $receiver = SvgRectElement_init(labelBounds);\n $receiver.strokeWidth().set_11rb$(0.0);\n $receiver.fillColor().set_11rb$(theme.labelBackground());\n var rect = $receiver;\n this.add_26jijc$(rect);\n var x = labelBounds.center.x;\n var y = labelBounds.center.y;\n var lab = new TextLabel(xLabel);\n lab.moveTo_lu1900$(x, y);\n lab.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE);\n lab.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.CENTER);\n this.add_8icvvv$(lab);\n labelBounds = labelBounds.add_gpjtzr$(new DoubleVector(0.0, labelSize.y));\n }\n }if (this.myLayoutInfo_0.facetYLabel != null) {\n var hPad = 6;\n var vPad = 0;\n var labelBounds_0 = DoubleRectangle_init(geomBounds.right + hPad, geomBounds.top - vPad, FacetGridPlotLayout$Companion_getInstance().FACET_TAB_HEIGHT - (hPad * 2 | 0), geomBounds.height - (vPad * 2 | 0));\n var rect_0 = SvgRectElement_init(labelBounds_0);\n rect_0.strokeWidth().set_11rb$(0.0);\n rect_0.fillColor().set_11rb$(theme.labelBackground());\n this.add_26jijc$(rect_0);\n var x_0 = labelBounds_0.center.x;\n var y_0 = labelBounds_0.center.y;\n var lab_0 = new TextLabel(this.myLayoutInfo_0.facetYLabel);\n lab_0.moveTo_lu1900$(x_0, y_0);\n lab_0.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE);\n lab_0.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.CENTER);\n lab_0.rotate_14dthe$(90.0);\n this.add_8icvvv$(lab_0);\n }};\n PlotTile.prototype.addAxis_0 = function (geomBounds) {\n if (this.myLayoutInfo_0.xAxisShown) {\n var axis = this.buildAxis_0(this.myScaleX_0, ensureNotNull(this.myLayoutInfo_0.xAxisInfo), this.myCoord_0, this.myTheme_0.axisX());\n axis.moveTo_gpjtzr$(new DoubleVector(geomBounds.left, geomBounds.bottom));\n this.add_8icvvv$(axis);\n }if (this.myLayoutInfo_0.yAxisShown) {\n var axis_0 = this.buildAxis_0(this.myScaleY_0, ensureNotNull(this.myLayoutInfo_0.yAxisInfo), this.myCoord_0, this.myTheme_0.axisY());\n axis_0.moveTo_gpjtzr$(geomBounds.origin);\n this.add_8icvvv$(axis_0);\n }};\n PlotTile.prototype.buildAxis_0 = function (scale, info, coord, theme) {\n var axis = new AxisComponent(info.axisLength, ensureNotNull(info.orientation));\n AxisUtil_getInstance().setBreaks_6e5l22$(axis, scale, coord, info.orientation.isHorizontal);\n AxisUtil_getInstance().applyLayoutInfo_4pg061$(axis, info);\n AxisUtil_getInstance().applyTheme_tna4q5$(axis, theme);\n if (this.isDebugDrawing_0) {\n if (info.tickLabelsBounds != null) {\n var rect = SvgRectElement_init(info.tickLabelsBounds);\n rect.strokeColor().set_11rb$(Color.Companion.GREEN);\n rect.strokeWidth().set_11rb$(1.0);\n rect.fillOpacity().set_11rb$(0.0);\n axis.add_26jijc$(rect);\n }}return axis;\n };\n PlotTile.prototype.buildGeoms_0 = function (sharedNumericMappers, overallNumericDomains, coord) {\n var tmp$;\n var layerRenderers = ArrayList_init();\n tmp$ = this.myLayers_0.iterator();\n while (tmp$.hasNext()) {\n var layer = tmp$.next();\n var rendererData = LayerRendererUtil_getInstance().createLayerRendererData_knseyn$(layer, sharedNumericMappers, overallNumericDomains);\n var aestheticMappers = rendererData.aestheticMappers;\n var aesthetics = rendererData.aesthetics;\n var targetCollector = new LayerTargetCollectorWithLocator(layer.geomKind, layer.locatorLookupSpec, layer.contextualMapping, coord);\n this.myTargetLocators_0.add_11rb$(targetCollector);\n var ctx = GeomContextBuilder_init().aesthetics_luqwb2$(aesthetics).aestheticMappers_4iu3o$(aestheticMappers).geomTargetCollector_xrq6q$(targetCollector).build();\n var pos = rendererData.pos;\n var geom = layer.geom;\n layerRenderers.add_11rb$(new SvgLayerRenderer(aesthetics, geom, pos, coord, ctx));\n }\n return layerRenderers;\n };\n PlotTile.prototype.setShowAxis_6taknv$ = function (showAxis) {\n this.myShowAxis_0 = showAxis;\n };\n PlotTile.prototype.debugDrawing = function () {\n return this.myDebugDrawing_0;\n };\n PlotTile.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotTile',\n interfaces: [SvgComponent]\n };\n function createCanvasFigure($receiver, bounds) {\n var tmp$;\n return (Kotlin.isType(tmp$ = $receiver.geom, LiveMapGeom) ? tmp$ : throwCCE()).createCanvasFigure_wthzt5$(bounds);\n }\n function PlotTooltipHelper() {\n this.myTileInfos_0 = ArrayList_init();\n }\n PlotTooltipHelper.prototype.removeAllTileInfos = function () {\n this.myTileInfos_0.clear();\n };\n PlotTooltipHelper.prototype.addTileInfo_t6qbjr$ = function (geomBounds, targetLocators) {\n var tileInfo = new PlotTooltipHelper$TileInfo(geomBounds, targetLocators);\n this.myTileInfos_0.add_11rb$(tileInfo);\n };\n PlotTooltipHelper.prototype.createTooltipSpecs_gpjtzr$ = function (plotCoord) {\n var tmp$;\n tmp$ = this.findTileInfo_0(plotCoord);\n if (tmp$ == null) {\n return emptyList();\n }var tileInfo = tmp$;\n var lookupResults = tileInfo.findTargets_xoefl8$(plotCoord);\n return this.createTooltipSpecs_0(lookupResults, tileInfo.axisOrigin_8be2vx$);\n };\n PlotTooltipHelper.prototype.getGeomBounds_gpjtzr$ = function (plotCoord) {\n var tmp$;\n tmp$ = this.findTileInfo_0(plotCoord);\n if (tmp$ == null) {\n return null;\n }var tileInfo = tmp$;\n return tileInfo.geomBounds_8be2vx$;\n };\n PlotTooltipHelper.prototype.findTileInfo_0 = function (plotCoord) {\n var tmp$;\n tmp$ = this.myTileInfos_0.iterator();\n while (tmp$.hasNext()) {\n var tileInfo = tmp$.next();\n if (tileInfo.contains_xoefl8$(plotCoord)) {\n return tileInfo;\n }}\n return null;\n };\n PlotTooltipHelper.prototype.createTooltipSpecs_0 = function (lookupResults, axisOrigin) {\n var tooltipSpecs = ArrayList_init();\n var tmp$;\n tmp$ = lookupResults.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var factory = new TooltipSpecFactory(element.contextualMapping, axisOrigin);\n var tmp$_0;\n tmp$_0 = element.targets.iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n tooltipSpecs.addAll_brywnq$(factory.create_62opr5$(element_0));\n }\n }\n return tooltipSpecs;\n };\n function PlotTooltipHelper$TileInfo(geomBounds, targetLocators) {\n this.geomBounds_8be2vx$ = geomBounds;\n var destination = ArrayList_init_0(collectionSizeOrDefault(targetLocators, 10));\n var tmp$;\n tmp$ = targetLocators.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(new PlotTooltipHelper$TileInfo$TileTargetLocator(this, item));\n }\n this.myTargetLocators_0 = destination;\n }\n Object.defineProperty(PlotTooltipHelper$TileInfo.prototype, 'axisOrigin_8be2vx$', {\n configurable: true,\n get: function () {\n return new DoubleVector(this.geomBounds_8be2vx$.left, this.geomBounds_8be2vx$.bottom);\n }\n });\n PlotTooltipHelper$TileInfo.prototype.findTargets_xoefl8$ = function (plotCoord) {\n var $receiver = new LocatedTargetsPicker();\n var tmp$;\n tmp$ = this.myTargetLocators_0.iterator();\n while (tmp$.hasNext()) {\n var locator = tmp$.next();\n var result = locator.search_gpjtzr$(plotCoord);\n if (result != null) {\n $receiver.addLookupResult_9sakjw$(result, plotCoord);\n }}\n var targetsPicker = $receiver;\n return targetsPicker.picked;\n };\n PlotTooltipHelper$TileInfo.prototype.contains_xoefl8$ = function (plotCoord) {\n return this.geomBounds_8be2vx$.contains_gpjtzr$(plotCoord);\n };\n function PlotTooltipHelper$TileInfo$TileTargetLocator($outer, locator) {\n this.$outer = $outer;\n TransformedTargetLocator.call(this, locator);\n }\n PlotTooltipHelper$TileInfo$TileTargetLocator.prototype.convertToTargetCoord_gpjtzr$ = function (coord) {\n return coord.subtract_gpjtzr$(this.$outer.geomBounds_8be2vx$.origin);\n };\n PlotTooltipHelper$TileInfo$TileTargetLocator.prototype.convertToPlotCoord_gpjtzr$ = function (coord) {\n return coord.add_gpjtzr$(this.$outer.geomBounds_8be2vx$.origin);\n };\n PlotTooltipHelper$TileInfo$TileTargetLocator.prototype.convertToPlotDistance_14dthe$ = function (distance) {\n return distance;\n };\n PlotTooltipHelper$TileInfo$TileTargetLocator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TileTargetLocator',\n interfaces: [TransformedTargetLocator]\n };\n PlotTooltipHelper$TileInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TileInfo',\n interfaces: []\n };\n PlotTooltipHelper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotTooltipHelper',\n interfaces: []\n };\n function PlotUtil() {\n PlotUtil_instance = this;\n }\n function PlotUtil$createLayerPos$ObjectLiteral(closure$aes) {\n this.closure$aes = closure$aes;\n this.groupCount_uijr2l$_0 = lazy(PlotUtil$createLayerPos$ObjectLiteral$groupCount$lambda(closure$aes));\n }\n Object.defineProperty(PlotUtil$createLayerPos$ObjectLiteral.prototype, 'aesthetics', {\n configurable: true,\n get: function () {\n return this.closure$aes;\n }\n });\n Object.defineProperty(PlotUtil$createLayerPos$ObjectLiteral.prototype, 'groupCount', {\n configurable: true,\n get: function () {\n return this.groupCount_uijr2l$_0.value;\n }\n });\n function PlotUtil$createLayerPos$ObjectLiteral$groupCount$lambda(closure$aes) {\n return function () {\n var set = collect.Sets.newHashSet_yl67zr$(closure$aes.groups());\n return set.size;\n };\n }\n PlotUtil$createLayerPos$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProviderContext]\n };\n PlotUtil.prototype.createLayerPos_2iooof$ = function (layer, aes) {\n return layer.createPos_q7kk9g$(new PlotUtil$createLayerPos$ObjectLiteral(aes));\n };\n PlotUtil.prototype.computeLayerDryRunXYRanges_gl53zg$ = function (layer, aes) {\n var geomCtx = GeomContextBuilder_init().aesthetics_luqwb2$(aes).build();\n var rangesAfterPosAdjustment = this.computeLayerDryRunXYRangesAfterPosAdjustment_0(layer, aes, geomCtx);\n var tmp$ = this.computeLayerDryRunXYRangesAfterSizeExpand_0(layer, aes, geomCtx);\n var xRangeAfterSizeExpand = tmp$.component1()\n , yRangeAfterSizeExpand = tmp$.component2();\n var rangeX = rangesAfterPosAdjustment.first;\n if (rangeX == null) {\n rangeX = xRangeAfterSizeExpand;\n } else if (xRangeAfterSizeExpand != null) {\n rangeX = rangeX.span_d226ot$(xRangeAfterSizeExpand);\n }var rangeY = rangesAfterPosAdjustment.second;\n if (rangeY == null) {\n rangeY = yRangeAfterSizeExpand;\n } else if (yRangeAfterSizeExpand != null) {\n rangeY = rangeY.span_d226ot$(yRangeAfterSizeExpand);\n }return new Pair(rangeX, rangeY);\n };\n PlotUtil.prototype.combineRanges_0 = function (aesList, aesthetics) {\n var tmp$, tmp$_0;\n var result = null;\n tmp$ = aesList.iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n var range = aesthetics.range_vktour$(aes);\n if (range != null) {\n result = (tmp$_0 = result != null ? result.span_d226ot$(range) : null) != null ? tmp$_0 : range;\n }}\n return result;\n };\n PlotUtil.prototype.computeLayerDryRunXYRangesAfterPosAdjustment_0 = function (layer, aes, geomCtx) {\n var tmp$, tmp$_0, tmp$_1;\n var posAesX = collect.Iterables.toList_yl67zr$(Aes.Companion.affectingScaleX_shhb9a$(layer.renderedAes()));\n var posAesY = collect.Iterables.toList_yl67zr$(Aes.Companion.affectingScaleY_shhb9a$(layer.renderedAes()));\n var pos = this.createLayerPos_2iooof$(layer, aes);\n if (pos.isIdentity) {\n var rangeX = this.combineRanges_0(posAesX, aes);\n var rangeY = this.combineRanges_0(posAesY, aes);\n return new Pair(rangeX, rangeY);\n }var adjustedMinX = 0.0;\n var adjustedMaxX = 0.0;\n var adjustedMinY = 0.0;\n var adjustedMaxY = 0.0;\n var rangesInited = false;\n var cardinality = Kotlin.imul(posAesX.size, posAesY.size);\n var px = Kotlin.newArray(cardinality, null);\n var py = Kotlin.newArray(cardinality, null);\n tmp$ = aes.dataPoints().iterator();\n while (tmp$.hasNext()) {\n var p = tmp$.next();\n var i = -1;\n tmp$_0 = posAesX.iterator();\n while (tmp$_0.hasNext()) {\n var aesX = tmp$_0.next();\n var valX = p.numeric_vktour$(aesX);\n tmp$_1 = posAesY.iterator();\n while (tmp$_1.hasNext()) {\n var aesY = tmp$_1.next();\n var valY = p.numeric_vktour$(aesY);\n i = i + 1 | 0;\n px[i] = valX;\n py[i] = valY;\n }\n }\n while (i >= 0) {\n if (px[i] != null && py[i] != null) {\n var x = px[i];\n var y = py[i];\n if (data_0.SeriesUtil.isFinite_yrwdxb$(x) && data_0.SeriesUtil.isFinite_yrwdxb$(y)) {\n var newLoc = pos.translate_tshsjz$(new DoubleVector(ensureNotNull(x), ensureNotNull(y)), p, geomCtx);\n var adjustedX = newLoc.x;\n var adjustedY = newLoc.y;\n if (rangesInited) {\n var b = adjustedMinX;\n adjustedMinX = JsMath.min(adjustedX, b);\n var b_0 = adjustedMaxX;\n adjustedMaxX = JsMath.max(adjustedX, b_0);\n var b_1 = adjustedMinY;\n adjustedMinY = JsMath.min(adjustedY, b_1);\n var b_2 = adjustedMaxY;\n adjustedMaxY = JsMath.max(adjustedY, b_2);\n } else {\n adjustedMaxX = adjustedX;\n adjustedMinX = adjustedMaxX;\n adjustedMaxY = adjustedY;\n adjustedMinY = adjustedMaxY;\n rangesInited = true;\n }\n }}i = i - 1 | 0;\n }\n }\n var xRange = rangesInited ? new ClosedRange(adjustedMinX, adjustedMaxX) : null;\n var yRange = rangesInited ? new ClosedRange(adjustedMinY, adjustedMaxY) : null;\n return new Pair(xRange, yRange);\n };\n PlotUtil.prototype.computeLayerDryRunXYRangesAfterSizeExpand_0 = function (layer, aesthetics, geomCtx) {\n var renderedAes = layer.renderedAes();\n var computeExpandX = renderedAes.contains_11rb$(Aes.Companion.WIDTH);\n var computeExpandY = renderedAes.contains_11rb$(Aes.Companion.HEIGHT);\n var rangeX = computeExpandX ? this.computeLayerDryRunRangeAfterSizeExpand_0(Aes.Companion.X, Aes.Companion.WIDTH, aesthetics, geomCtx) : null;\n var rangeY = computeExpandY ? this.computeLayerDryRunRangeAfterSizeExpand_0(Aes.Companion.Y, Aes.Companion.HEIGHT, aesthetics, geomCtx) : null;\n return new Pair(rangeX, rangeY);\n };\n PlotUtil.prototype.computeLayerDryRunRangeAfterSizeExpand_0 = function (locationAes, sizeAes, aesthetics, geomCtx) {\n var tmp$;\n var locations = aesthetics.numericValues_vktour$(locationAes).iterator();\n var sizes = aesthetics.numericValues_vktour$(sizeAes).iterator();\n var resolution = geomCtx.getResolution_vktour$(locationAes);\n var minMax = new Float64Array([kotlin_js_internal_DoubleCompanionObject.POSITIVE_INFINITY, kotlin_js_internal_DoubleCompanionObject.NEGATIVE_INFINITY]);\n tmp$ = aesthetics.dataPointCount();\n for (var i = 0; i < tmp$; i++) {\n if (!locations.hasNext()) {\n throw IllegalStateException_init('Index is out of bounds: ' + i + ' for ' + locationAes);\n }if (!sizes.hasNext()) {\n throw IllegalStateException_init('Index is out of bounds: ' + i + ' for ' + sizeAes);\n }var loc = locations.next();\n var size = sizes.next();\n if (data_0.SeriesUtil.isFinite_yrwdxb$(loc) && data_0.SeriesUtil.isFinite_yrwdxb$(size)) {\n var expand = resolution * (ensureNotNull(size) / 2);\n this.updateExpandedMinMax_0(ensureNotNull(loc), expand, minMax);\n }}\n return minMax[0] <= minMax[1] ? new ClosedRange(minMax[0], minMax[1]) : null;\n };\n PlotUtil.prototype.updateExpandedMinMax_0 = function (value, expand, expandedMinMax) {\n var a = value - expand;\n var b = expandedMinMax[0];\n expandedMinMax[0] = JsMath.min(a, b);\n var a_0 = value + expand;\n var b_0 = expandedMinMax[1];\n expandedMinMax[1] = JsMath.max(a_0, b_0);\n };\n PlotUtil.prototype.createLayerDryRunAesthetics_sqg2xh$ = function (layer) {\n var tmp$, tmp$_0, tmp$_1;\n var dryRunMapperByAes = HashMap_init();\n tmp$ = layer.renderedAes().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n if (aes.isNumeric) {\n tmp$_1 = Kotlin.isType(tmp$_0 = aes, Aes) ? tmp$_0 : throwCCE();\n var value = scale.Mappers.IDENTITY;\n dryRunMapperByAes.put_xwzc9p$(tmp$_1, value);\n }}\n var mappers = this.prepareLayerAestheticMappers_viiuew$(layer, dryRunMapperByAes);\n return this.createLayerAesthetics_kpf4gp$(layer, mappers, emptyMap());\n };\n PlotUtil.prototype.prepareLayerAestheticMappers_viiuew$ = function (layer, sharedNumericMappers) {\n var tmp$;\n var mappers = HashMap_init_0(sharedNumericMappers);\n tmp$ = layer.renderedAes().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n var tmp$_0;\n var mapper = (Kotlin.isType(tmp$_0 = sharedNumericMappers, Map) ? tmp$_0 : throwCCE()).get_11rb$(aes);\n if (mapper == null) {\n if (Aes.Companion.isPositionalX_896ixz$(aes)) {\n mapper = sharedNumericMappers.get_11rb$(Aes.Companion.X);\n } else if (Aes.Companion.isPositionalY_896ixz$(aes)) {\n mapper = sharedNumericMappers.get_11rb$(Aes.Companion.Y);\n }}if (mapper == null && layer.hasBinding_896ixz$(aes)) {\n mapper = layer.scaleMap.get_31786j$(aes).mapper;\n }if (mapper != null) {\n var value = mapper;\n mappers.put_xwzc9p$(aes, value);\n }}\n return mappers;\n };\n PlotUtil.prototype.createLayerAesthetics_kpf4gp$ = function (layer, sharedMappers, overallNumericDomains) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3;\n var aesBuilder = new AestheticsBuilder();\n aesBuilder.group_ddsh32$(layer.group);\n tmp$ = overallNumericDomains.entries.iterator();\n while (tmp$.hasNext()) {\n var tmp$_4 = tmp$.next();\n var aes = tmp$_4.key;\n var domain = tmp$_4.value;\n if ((tmp$_0 = sharedMappers.get_11rb$(aes)) != null) {\n var tmp$_5, tmp$_6;\n var range = new ClosedRange(typeof (tmp$_5 = tmp$_0(domain.lowerEnd)) === 'number' ? tmp$_5 : throwCCE(), typeof (tmp$_6 = tmp$_0(domain.upperEnd)) === 'number' ? tmp$_6 : throwCCE());\n aesBuilder.overallRange_xlyz3f$(aes, range);\n }}\n var hasPositionalConstants = false;\n tmp$_1 = layer.renderedAes().iterator();\n while (tmp$_1.hasNext()) {\n var aes_0 = tmp$_1.next();\n if (Aes.Companion.isPositional_896ixz$(aes_0) && layer.hasConstant_896ixz$(aes_0)) {\n hasPositionalConstants = true;\n break;\n }}\n var data_0 = layer.dataFrame;\n var dataPointCount = {v: null};\n tmp$_2 = layer.renderedAes().iterator();\n while (tmp$_2.hasNext()) {\n var aes_1 = tmp$_2.next();\n var aes_2 = Kotlin.isType(tmp$_3 = aes_1, Aes) ? tmp$_3 : throwCCE();\n var mapperOption = sharedMappers.get_11rb$(aes_2);\n if (layer.hasConstant_896ixz$(aes_2)) {\n var v = layer.getConstant_31786j$(aes_2);\n aesBuilder.constantAes_bbdhip$(aes_2, this.asAesValue_0(aes_2, v, mapperOption));\n } else {\n if (layer.hasBinding_896ixz$(aes_2)) {\n if (!(mapperOption != null)) {\n var message = 'No scale mapper defined for aesthetic ' + aes_2;\n throw IllegalStateException_init(message.toString());\n }var transformVar = data.DataFrameUtil.transformVarFor_896ixz$(aes_2);\n if (!data_0.has_8xm3sj$(transformVar)) {\n var message_0 = 'Undefined var ' + transformVar + ' for aesthetic ' + aes_2;\n throw IllegalStateException_init(message_0.toString());\n }var numericValues = data_0.getNumeric_8xm3sj$(transformVar);\n if (dataPointCount.v == null) {\n dataPointCount.v = numericValues.size;\n } else {\n if (!(dataPointCount.v === numericValues.size)) {\n var message_1 = '' + toString(aes_2) + ' expected data size=' + toString(dataPointCount.v) + ' was size=' + toString(numericValues.size);\n throw IllegalStateException_init(message_1.toString());\n }}\n if (dataPointCount.v === 0 && hasPositionalConstants) {\n aesBuilder.constantAes_bbdhip$(aes_2, layer.aestheticsDefaults.defaultValue_31786j$(aes_2));\n } else {\n var integerFunction = AestheticsBuilder.Companion.listMapper_sedzz5$(numericValues, mapperOption);\n aesBuilder.aes_u42xfl$(aes_2, integerFunction);\n }\n } else {\n var v_0 = layer.getDefault_31786j$(aes_2);\n aesBuilder.constantAes_bbdhip$(aes_2, this.asAesValue_0(aes_2, v_0, mapperOption));\n }\n }\n }\n if (dataPointCount.v != null && dataPointCount.v > 0) {\n aesBuilder.dataPointCount_za3lpa$(dataPointCount.v);\n } else if (hasPositionalConstants) {\n aesBuilder.dataPointCount_za3lpa$(1);\n }return aesBuilder.build();\n };\n PlotUtil.prototype.asAesValue_0 = function (aes, dataValue, mapperOption) {\n var tmp$, tmp$_0, tmp$_1;\n if (aes.isNumeric && mapperOption != null) {\n tmp$_0 = mapperOption(typeof (tmp$ = dataValue) === 'number' ? tmp$ : null);\n if (tmp$_0 == null) {\n throw IllegalArgumentException_init(\"Can't map \" + dataValue + ' to aesthetic ' + aes);\n }tmp$_1 = tmp$_0;\n } else\n tmp$_1 = dataValue;\n return tmp$_1;\n };\n PlotUtil.prototype.rangeWithExpand_einsbb$ = function (range, scale, includeZero) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (range == null)\n return null;\n var mulExp = scale.multiplicativeExpand;\n var addExp = scale.additiveExpand;\n if (scale.isContinuousDomain) {\n tmp$_0 = Kotlin.isType(tmp$ = scale.transform, ContinuousTransform) ? tmp$ : throwCCE();\n } else {\n tmp$_0 = null;\n }\n var continuousTransform = tmp$_0;\n var lowerEndpoint = (tmp$_1 = continuousTransform != null ? continuousTransform.applyInverse_yrwdxb$(range.lowerEnd) : null) != null ? tmp$_1 : range.lowerEnd;\n var upperEndpoint = (tmp$_2 = continuousTransform != null ? continuousTransform.applyInverse_yrwdxb$(range.upperEnd) : null) != null ? tmp$_2 : range.upperEnd;\n var length = upperEndpoint - lowerEndpoint;\n var lowerExpand = addExp + length * mulExp;\n var upperExpand = lowerExpand;\n if (includeZero) {\n var tmp$_3 = lowerEndpoint === 0.0 || upperEndpoint === 0.0;\n if (!tmp$_3) {\n tmp$_3 = JsMath.sign(lowerEndpoint) === JsMath.sign(upperEndpoint);\n }if (tmp$_3) {\n if (lowerEndpoint >= 0) {\n lowerExpand = 0.0;\n } else {\n upperExpand = 0.0;\n }\n }}var it = lowerEndpoint - lowerExpand;\n var block$result;\n var tmp$_4;\n var transformed = (tmp$_4 = continuousTransform != null ? continuousTransform.apply_yrwdxb$(it) : null) != null ? tmp$_4 : it;\n if (isNaN_0(transformed)) {\n block$result = range.lowerEnd;\n } else {\n block$result = transformed;\n }\n var lowerEndWithExpand = block$result;\n var it_0 = upperEndpoint + upperExpand;\n var block$result_0;\n var tmp$_5;\n var transformed_0 = (tmp$_5 = continuousTransform != null ? continuousTransform.apply_yrwdxb$(it_0) : null) != null ? tmp$_5 : it_0;\n if (isNaN_0(transformed_0)) {\n block$result_0 = range.upperEnd;\n } else {\n block$result_0 = transformed_0;\n }\n var upperEndWithExpand = block$result_0;\n return new ClosedRange(lowerEndWithExpand, upperEndWithExpand);\n };\n PlotUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PlotUtil',\n interfaces: []\n };\n var PlotUtil_instance = null;\n function PlotUtil_getInstance() {\n if (PlotUtil_instance === null) {\n new PlotUtil();\n }return PlotUtil_instance;\n }\n function PosProviderContext() {\n }\n PosProviderContext.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PosProviderContext',\n interfaces: []\n };\n function SvgLayerRenderer(myAesthetics, myGeom, myPos, myCoord, myGeomContext) {\n SvgComponent.call(this);\n this.myAesthetics_0 = myAesthetics;\n this.myGeom_0 = myGeom;\n this.myPos_0 = myPos;\n this.myCoord_0 = myCoord;\n this.myGeomContext_0 = myGeomContext;\n }\n SvgLayerRenderer.prototype.buildComponent = function () {\n this.buildLayer_0();\n };\n SvgLayerRenderer.prototype.buildLayer_0 = function () {\n this.myGeom_0.build_uzv8ab$(this, this.myAesthetics_0, this.myPos_0, this.myCoord_0, this.myGeomContext_0);\n };\n SvgLayerRenderer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SvgLayerRenderer',\n interfaces: [SvgRoot, SvgComponent]\n };\n function VarBinding(variable, aes) {\n this.variable = variable;\n this.aes = aes;\n }\n VarBinding.prototype.toString = function () {\n return 'VarBinding{variable=' + this.variable + ', aes=' + this.aes;\n };\n VarBinding.prototype.equals = function (other) {\n var tmp$, tmp$_0;\n if (this === other)\n return true;\n if (other == null || !((tmp$ = Kotlin.getKClassFromExpression(this)) != null ? tmp$.equals(Kotlin.getKClassFromExpression(other)) : null))\n return false;\n Kotlin.isType(tmp$_0 = other, VarBinding) ? tmp$_0 : throwCCE();\n if (!equals(this.variable, other.variable))\n return false;\n if (!equals(this.aes, other.aes))\n return false;\n return true;\n };\n VarBinding.prototype.hashCode = function () {\n var result = hashCode(this.variable);\n result = (31 * result | 0) + hashCode(this.aes) | 0;\n return result;\n };\n VarBinding.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VarBinding',\n interfaces: []\n };\n function ColorBarAssembler(legendTitle, transformedDomain, scale, theme) {\n ColorBarAssembler$Companion_getInstance();\n this.legendTitle_0 = legendTitle;\n this.transformedDomain_0 = transformedDomain;\n this.scale_0 = scale;\n this.theme_0 = theme;\n this.colorBarOptions_0 = null;\n }\n function ColorBarAssembler$createColorBar$ObjectLiteral(closure$spec, size) {\n this.closure$spec = closure$spec;\n LegendBoxInfo.call(this, size);\n }\n ColorBarAssembler$createColorBar$ObjectLiteral.prototype.createLegendBox = function () {\n var c = new ColorBarComponent(this.closure$spec);\n c.debug = ColorBarAssembler$Companion_getInstance().DEBUG_DRAWING_0;\n return c;\n };\n ColorBarAssembler$createColorBar$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [LegendBoxInfo]\n };\n ColorBarAssembler.prototype.createColorBar = function () {\n var scale = this.scale_0;\n if (!scale.hasBreaks()) {\n scale = breaks.ScaleBreaksUtil.withBreaks_qt1l9m$(scale, this.transformedDomain_0, 5);\n }var scaleBreaks = scale.getScaleBreaks();\n if (scaleBreaks.isEmpty) {\n return LegendBoxInfo$Companion_getInstance().EMPTY;\n }var spec = ColorBarAssembler$Companion_getInstance().createColorBarSpec_6r6r64$(this.legendTitle_0, this.transformedDomain_0, scaleBreaks, scale, this.theme_0, this.colorBarOptions_0);\n return new ColorBarAssembler$createColorBar$ObjectLiteral(spec, spec.size);\n };\n ColorBarAssembler.prototype.setOptions_p8ufd2$ = function (options) {\n this.colorBarOptions_0 = options;\n };\n function ColorBarAssembler$Companion() {\n ColorBarAssembler$Companion_instance = this;\n this.DEBUG_DRAWING_0 = FeatureSwitch_getInstance().LEGEND_DEBUG_DRAWING;\n }\n ColorBarAssembler$Companion.prototype.createColorBarSpec_6r6r64$ = function (title, transformedDomain, breaks, scale, theme, options) {\n if (options === void 0)\n options = null;\n var tmp$, tmp$_0;\n var legendDirection = LegendAssemblerUtil_getInstance().legendDirection_730mk3$(theme);\n var horizontal = legendDirection === LegendDirection$HORIZONTAL_getInstance();\n var width = options != null ? options.width : null;\n var height = options != null ? options.height : null;\n var barSize = ColorBarComponentSpec$Companion_getInstance().barAbsoluteSize_kkcal5$(horizontal, theme);\n if (width != null) {\n barSize = new DoubleVector(width, barSize.y);\n }if (height != null) {\n barSize = new DoubleVector(barSize.x, height);\n }var reverse = !horizontal;\n if (horizontal)\n tmp$ = ColorBarComponentLayout$Companion_getInstance().horizontal_dwxw1i$(title, transformedDomain, breaks, barSize, reverse);\n else\n tmp$ = ColorBarComponentLayout$Companion_getInstance().vertical_dwxw1i$(title, transformedDomain, breaks, barSize, reverse);\n var layout = tmp$;\n return new ColorBarComponentSpec(title, transformedDomain, breaks, scale, (tmp$_0 = options != null ? options.binCount : null) != null ? tmp$_0 : 20, theme, layout, reverse);\n };\n ColorBarAssembler$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorBarAssembler$Companion_instance = null;\n function ColorBarAssembler$Companion_getInstance() {\n if (ColorBarAssembler$Companion_instance === null) {\n new ColorBarAssembler$Companion();\n }return ColorBarAssembler$Companion_instance;\n }\n ColorBarAssembler.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBarAssembler',\n interfaces: []\n };\n function ColorBarOptions() {\n GuideOptions.call(this);\n this.width = null;\n this.height = null;\n this.binCount = null;\n }\n ColorBarOptions.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBarOptions',\n interfaces: [GuideOptions]\n };\n function GeomContextBuilder() {\n this.myAesthetics_0 = null;\n this.myAestheticMappers_0 = null;\n this.myGeomTargetCollector_0 = new NullGeomTargetCollector();\n }\n GeomContextBuilder.prototype.aesthetics_luqwb2$ = function (aesthetics) {\n this.myAesthetics_0 = aesthetics;\n return this;\n };\n GeomContextBuilder.prototype.aestheticMappers_4iu3o$ = function (aestheticMappers) {\n this.myAestheticMappers_0 = aestheticMappers;\n return this;\n };\n GeomContextBuilder.prototype.geomTargetCollector_xrq6q$ = function (geomTargetCollector) {\n this.myGeomTargetCollector_0 = geomTargetCollector;\n return this;\n };\n GeomContextBuilder.prototype.build = function () {\n return new GeomContextBuilder$MyGeomContext(this);\n };\n function GeomContextBuilder$MyGeomContext(b) {\n this.myAesthetics = b.myAesthetics_0;\n this.myAestheticMappers = b.myAestheticMappers_0;\n this.targetCollector_2hnek9$_0 = b.myGeomTargetCollector_0;\n }\n Object.defineProperty(GeomContextBuilder$MyGeomContext.prototype, 'targetCollector', {\n configurable: true,\n get: function () {\n return this.targetCollector_2hnek9$_0;\n }\n });\n GeomContextBuilder$MyGeomContext.prototype.getResolution_vktour$ = function (aes) {\n var resolution = 0.0;\n if (this.myAesthetics != null) {\n resolution = this.myAesthetics.resolution_594811$(aes, 0.0);\n }if (resolution <= data_0.SeriesUtil.TINY) {\n resolution = this.getUnitResolution_vktour$(aes);\n }return resolution;\n };\n GeomContextBuilder$MyGeomContext.prototype.getUnitResolution_vktour$ = function (aes) {\n var tmp$, tmp$_0, tmp$_1;\n var mapper = (tmp$_0 = (tmp$ = this.myAestheticMappers) != null ? tmp$.get_11rb$(aes) : null) != null ? tmp$_0 : scale.Mappers.IDENTITY;\n return typeof (tmp$_1 = mapper(1.0)) === 'number' ? tmp$_1 : throwCCE();\n };\n GeomContextBuilder$MyGeomContext.prototype.withTargetCollector_xrq6q$ = function (targetCollector) {\n return GeomContextBuilder_init().aesthetics_luqwb2$(this.myAesthetics).aestheticMappers_4iu3o$(this.myAestheticMappers).geomTargetCollector_xrq6q$(targetCollector).build();\n };\n GeomContextBuilder$MyGeomContext.prototype.with = function () {\n return GeomContextBuilder_init_0(this);\n };\n GeomContextBuilder$MyGeomContext.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyGeomContext',\n interfaces: [ImmutableGeomContext]\n };\n GeomContextBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomContextBuilder',\n interfaces: [ImmutableGeomContext$Builder]\n };\n function GeomContextBuilder_init($this) {\n $this = $this || Object.create(GeomContextBuilder.prototype);\n GeomContextBuilder.call($this);\n return $this;\n }\n function GeomContextBuilder_init_0(ctx, $this) {\n $this = $this || Object.create(GeomContextBuilder.prototype);\n GeomContextBuilder.call($this);\n $this.myAesthetics_0 = ctx.myAesthetics;\n $this.myAestheticMappers_0 = ctx.myAestheticMappers;\n return $this;\n }\n function GeomLayerBuilder() {\n GeomLayerBuilder$Companion_getInstance();\n this.myBindings_0 = ArrayList_init();\n this.myConstantByAes_0 = new TypedKeyHashMap();\n this.myStat_mcjcnw$_0 = this.myStat_mcjcnw$_0;\n this.myPosProvider_gzkpo7$_0 = this.myPosProvider_gzkpo7$_0;\n this.myGeomProvider_h6nr63$_0 = this.myGeomProvider_h6nr63$_0;\n this.myGroupingVarName_0 = null;\n this.myPathIdVarName_0 = null;\n this.myScaleProviderByAes_0 = HashMap_init();\n this.myDataPreprocessor_0 = null;\n this.myLocatorLookupSpec_0 = GeomTargetLocator$LookupSpec.Companion.NONE;\n this.myContextualMappingProvider_0 = ContextualMappingProvider$Companion_getInstance().NONE;\n this.myIsLegendDisabled_0 = false;\n }\n Object.defineProperty(GeomLayerBuilder.prototype, 'myStat_0', {\n configurable: true,\n get: function () {\n if (this.myStat_mcjcnw$_0 == null)\n return throwUPAE('myStat');\n return this.myStat_mcjcnw$_0;\n },\n set: function (myStat) {\n this.myStat_mcjcnw$_0 = myStat;\n }\n });\n Object.defineProperty(GeomLayerBuilder.prototype, 'myPosProvider_0', {\n configurable: true,\n get: function () {\n if (this.myPosProvider_gzkpo7$_0 == null)\n return throwUPAE('myPosProvider');\n return this.myPosProvider_gzkpo7$_0;\n },\n set: function (myPosProvider) {\n this.myPosProvider_gzkpo7$_0 = myPosProvider;\n }\n });\n Object.defineProperty(GeomLayerBuilder.prototype, 'myGeomProvider_0', {\n configurable: true,\n get: function () {\n if (this.myGeomProvider_h6nr63$_0 == null)\n return throwUPAE('myGeomProvider');\n return this.myGeomProvider_h6nr63$_0;\n },\n set: function (myGeomProvider) {\n this.myGeomProvider_h6nr63$_0 = myGeomProvider;\n }\n });\n GeomLayerBuilder.prototype.stat_qbwusa$ = function (v) {\n this.myStat_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.pos_r08v3h$ = function (v) {\n this.myPosProvider_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.geom_9dfz59$ = function (v) {\n this.myGeomProvider_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.addBinding_14cn14$ = function (v) {\n this.myBindings_0.add_11rb$(v);\n return this;\n };\n GeomLayerBuilder.prototype.groupingVar_8xm3sj$ = function (v) {\n this.myGroupingVarName_0 = v.name;\n return this;\n };\n GeomLayerBuilder.prototype.groupingVarName_61zpoe$ = function (v) {\n this.myGroupingVarName_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.pathIdVarName_61zpoe$ = function (v) {\n this.myPathIdVarName_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.addConstantAes_bbdhip$ = function (aes, v) {\n this.myConstantByAes_0.put_ev6mlr$(aes, v);\n return this;\n };\n GeomLayerBuilder.prototype.addScaleProvider_jv3qxe$ = function (aes, scaleProvider) {\n this.myScaleProviderByAes_0.put_xwzc9p$(aes, scaleProvider);\n return this;\n };\n GeomLayerBuilder.prototype.locatorLookupSpec_271kgc$ = function (v) {\n this.myLocatorLookupSpec_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.contextualMappingProvider_td8fxc$ = function (v) {\n this.myContextualMappingProvider_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.disableLegend_6taknv$ = function (v) {\n this.myIsLegendDisabled_0 = v;\n return this;\n };\n GeomLayerBuilder.prototype.build_fhj1j$ = function (data_0, scaleMap) {\n var tmp$, tmp$_0;\n var data_1 = data_0;\n if (this.myDataPreprocessor_0 != null) {\n data_1 = ensureNotNull(this.myDataPreprocessor_0)(data_1, scaleMap);\n }data_1 = DataProcessing_getInstance().transformOriginals_si9pes$(data_1, this.myBindings_0, scaleMap);\n var $receiver = this.myBindings_0;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n var tmp$_2 = destination.add_11rb$;\n var tmp$_3, tmp$_4;\n tmp$_4 = item.aes;\n if (item.variable.isOrigin) {\n var transformVar = data.DataFrameUtil.transformVarFor_896ixz$(item.aes);\n tmp$_3 = new VarBinding(transformVar, item.aes);\n } else {\n tmp$_3 = item;\n }\n tmp$_2.call(destination, to(tmp$_4, tmp$_3));\n }\n var replacementBindings = HashMap_init_0(toMap(destination));\n var bindingsToPut = ArrayList_init();\n tmp$ = replacementBindings.values.iterator();\n while (tmp$.hasNext()) {\n var binding = tmp$.next();\n var variable = binding.variable;\n if (variable.isStat) {\n var aes = binding.aes;\n var scale = scaleMap.get_31786j$(aes);\n data_1 = data.DataFrameUtil.applyTransform_xaiv89$(data_1, variable, aes, scale);\n bindingsToPut.add_11rb$(new VarBinding(data.TransformVar.forAes_896ixz$(aes), aes));\n }}\n tmp$_0 = bindingsToPut.iterator();\n while (tmp$_0.hasNext()) {\n var binding_0 = tmp$_0.next();\n var key = binding_0.aes;\n replacementBindings.put_xwzc9p$(key, binding_0);\n }\n var dataAccess = new PointDataAccess(data_1, replacementBindings, scaleMap);\n return new GeomLayerBuilder$MyGeomLayer(data_1, this.myGeomProvider_0, this.myPosProvider_0, this.myGeomProvider_0.renders(), (new GroupingContext(data_1, this.myBindings_0, this.myGroupingVarName_0, this.myPathIdVarName_0, this.handlesGroups_0())).groupMapper, replacementBindings.values, this.myConstantByAes_0, scaleMap, dataAccess, this.myLocatorLookupSpec_0, this.myContextualMappingProvider_0.createContextualMapping_8fr62e$(dataAccess, data_1), this.myIsLegendDisabled_0);\n };\n GeomLayerBuilder.prototype.handlesGroups_0 = function () {\n return this.myGeomProvider_0.handlesGroups() || this.myPosProvider_0.handlesGroups();\n };\n function GeomLayerBuilder$MyGeomLayer(dataFrame, geomProvider, myPosProvider, renderedAes, group, varBindings, constantByAes, scaleMap, dataAccess, locatorLookupSpec, contextualMapping, isLegendDisabled) {\n this.dataFrame_uc8k26$_0 = dataFrame;\n this.myPosProvider_0 = myPosProvider;\n this.group_btwr86$_0 = group;\n this.scaleMap_9lvzv7$_0 = scaleMap;\n this.dataAccess_qkhg5r$_0 = dataAccess;\n this.locatorLookupSpec_65qeye$_0 = locatorLookupSpec;\n this.contextualMapping_1qd07s$_0 = contextualMapping;\n this.isLegendDisabled_1bnyfg$_0 = isLegendDisabled;\n this.geom_ipep5v$_0 = geomProvider.createGeom();\n this.geomKind_qyi6z5$_0 = geomProvider.geomKind;\n this.aestheticsDefaults_4lnusm$_0 = null;\n this.myRenderedAes_0 = null;\n this.myConstantByAes_0 = null;\n this.myVarBindingsByAes_0 = HashMap_init();\n var tmp$, tmp$_0;\n this.myRenderedAes_0 = ArrayList_init_1(renderedAes);\n this.aestheticsDefaults_4lnusm$_0 = geomProvider.aestheticsDefaults();\n this.myConstantByAes_0 = new TypedKeyHashMap();\n tmp$ = constantByAes.keys_287e2$().iterator();\n while (tmp$.hasNext()) {\n var key = tmp$.next();\n this.myConstantByAes_0.put_ev6mlr$(key, constantByAes.get_ex36zt$(key));\n }\n tmp$_0 = varBindings.iterator();\n while (tmp$_0.hasNext()) {\n var varBinding = tmp$_0.next();\n var $receiver = this.myVarBindingsByAes_0;\n var key_0 = varBinding.aes;\n $receiver.put_xwzc9p$(key_0, varBinding);\n }\n }\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'dataFrame', {\n get: function () {\n return this.dataFrame_uc8k26$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'group', {\n get: function () {\n return this.group_btwr86$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'scaleMap', {\n get: function () {\n return this.scaleMap_9lvzv7$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'dataAccess', {\n get: function () {\n return this.dataAccess_qkhg5r$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'locatorLookupSpec', {\n get: function () {\n return this.locatorLookupSpec_65qeye$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'contextualMapping', {\n get: function () {\n return this.contextualMapping_1qd07s$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'isLegendDisabled', {\n get: function () {\n return this.isLegendDisabled_1bnyfg$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'geom', {\n configurable: true,\n get: function () {\n return this.geom_ipep5v$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'geomKind', {\n configurable: true,\n get: function () {\n return this.geomKind_qyi6z5$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'aestheticsDefaults', {\n configurable: true,\n get: function () {\n return this.aestheticsDefaults_4lnusm$_0;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n return this.geom.legendKeyElementFactory;\n }\n });\n Object.defineProperty(GeomLayerBuilder$MyGeomLayer.prototype, 'isLiveMap', {\n configurable: true,\n get: function () {\n return Kotlin.isType(this.geom, LiveMapGeom);\n }\n });\n GeomLayerBuilder$MyGeomLayer.prototype.renderedAes = function () {\n return this.myRenderedAes_0;\n };\n GeomLayerBuilder$MyGeomLayer.prototype.createPos_q7kk9g$ = function (ctx) {\n return this.myPosProvider_0.createPos_q7kk9g$(ctx);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.hasBinding_896ixz$ = function (aes) {\n return this.myVarBindingsByAes_0.containsKey_11rb$(aes);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.getBinding_31786j$ = function (aes) {\n return ensureNotNull(this.myVarBindingsByAes_0.get_11rb$(aes));\n };\n GeomLayerBuilder$MyGeomLayer.prototype.hasConstant_896ixz$ = function (aes) {\n return this.myConstantByAes_0.containsKey_ex36zt$(aes);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.getConstant_31786j$ = function (aes) {\n if (!this.hasConstant_896ixz$(aes)) {\n var message = 'Constant value is not defined for aes ' + aes;\n throw IllegalArgumentException_init(message.toString());\n }return this.myConstantByAes_0.get_ex36zt$(aes);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.getDefault_31786j$ = function (aes) {\n return this.aestheticsDefaults.defaultValue_31786j$(aes);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.rangeIncludesZero_896ixz$ = function (aes) {\n return this.aestheticsDefaults.rangeIncludesZero_896ixz$(aes);\n };\n GeomLayerBuilder$MyGeomLayer.prototype.setLiveMapProvider_kld0fp$ = function (liveMapProvider) {\n if (Kotlin.isType(this.geom, LiveMapGeom)) {\n this.geom.setLiveMapProvider_kld0fp$(liveMapProvider);\n } else {\n throw IllegalStateException_init('Not Livemap: ' + Kotlin.getKClassFromExpression(this.geom).simpleName);\n }\n };\n GeomLayerBuilder$MyGeomLayer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyGeomLayer',\n interfaces: [GeomLayer]\n };\n function GeomLayerBuilder$Companion() {\n GeomLayerBuilder$Companion_instance = this;\n }\n function GeomLayerBuilder$Companion$demoAndTest$lambda(closure$builder) {\n return function (data, scaleMap) {\n var transformedData = DataProcessing_getInstance().transformOriginals_si9pes$(data, closure$builder.myBindings_0, scaleMap);\n var stat_0 = closure$builder.myStat_0;\n if (equals(stat_0, stat.Stats.IDENTITY))\n return transformedData;\n else {\n var statCtx = new SimpleStatContext(transformedData);\n var groupingContext = new GroupingContext(transformedData, closure$builder.myBindings_0, closure$builder.myGroupingVarName_0, closure$builder.myPathIdVarName_0, true);\n var dataAndGroupingContext = DataProcessing_getInstance().buildStatData_x40e2x$(transformedData, stat_0, closure$builder.myBindings_0, scaleMap, groupingContext, PlotFacets$Companion_getInstance().undefined(), statCtx, emptyList(), emptyList(), null, getCallableRef('println', function (p1) {\n return println(p1), Unit;\n }));\n return dataAndGroupingContext.data;\n }\n };\n }\n GeomLayerBuilder$Companion.prototype.demoAndTest = function () {\n var builder = new GeomLayerBuilder();\n builder.myDataPreprocessor_0 = GeomLayerBuilder$Companion$demoAndTest$lambda(builder);\n return builder;\n };\n GeomLayerBuilder$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomLayerBuilder$Companion_instance = null;\n function GeomLayerBuilder$Companion_getInstance() {\n if (GeomLayerBuilder$Companion_instance === null) {\n new GeomLayerBuilder$Companion();\n }return GeomLayerBuilder$Companion_instance;\n }\n GeomLayerBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomLayerBuilder',\n interfaces: []\n };\n function GuideOptions() {\n GuideOptions$Companion_getInstance();\n this.isReverse = false;\n }\n function GuideOptions$Companion() {\n GuideOptions$Companion_instance = this;\n this.NONE = new GuideOptions$Companion$NONE$ObjectLiteral();\n }\n function GuideOptions$Companion$NONE$ObjectLiteral() {\n GuideOptions.call(this);\n }\n GuideOptions$Companion$NONE$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [GuideOptions]\n };\n GuideOptions$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GuideOptions$Companion_instance = null;\n function GuideOptions$Companion_getInstance() {\n if (GuideOptions$Companion_instance === null) {\n new GuideOptions$Companion();\n }return GuideOptions$Companion_instance;\n }\n GuideOptions.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GuideOptions',\n interfaces: []\n };\n function ImmutableGeomContext() {\n }\n function ImmutableGeomContext$Builder() {\n }\n ImmutableGeomContext$Builder.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Builder',\n interfaces: []\n };\n ImmutableGeomContext.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ImmutableGeomContext',\n interfaces: [GeomContext]\n };\n function LegendAssembler(legendTitle, guideOptionsMap, theme) {\n LegendAssembler$Companion_getInstance();\n this.legendTitle_0 = legendTitle;\n this.guideOptionsMap_0 = guideOptionsMap;\n this.theme_0 = theme;\n this.legendLayers_0 = ArrayList_init();\n }\n LegendAssembler.prototype.addLayer_446ka8$ = function (keyFactory, varBindings, constantByAes, aestheticsDefaults, scaleByAes, transformedDomainByAes) {\n this.legendLayers_0.add_11rb$(new LegendAssembler$LegendLayer(keyFactory, varBindings, constantByAes, aestheticsDefaults, scaleByAes, transformedDomainByAes));\n };\n function LegendAssembler$createLegend$ObjectLiteral(closure$spec, size) {\n this.closure$spec = closure$spec;\n LegendBoxInfo.call(this, size);\n }\n LegendAssembler$createLegend$ObjectLiteral.prototype.createLegendBox = function () {\n var c = new LegendComponent(this.closure$spec);\n c.debug = LegendAssembler$Companion_getInstance().DEBUG_DRAWING_0;\n return c;\n };\n LegendAssembler$createLegend$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [LegendBoxInfo]\n };\n LegendAssembler.prototype.createLegend = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n var legendBreaksByLabel = LinkedHashMap_init();\n tmp$ = this.legendLayers_0.iterator();\n while (tmp$.hasNext()) {\n var legendLayer = tmp$.next();\n var keyElementFactory = legendLayer.keyElementFactory_8be2vx$;\n var dataPoints = legendLayer.keyAesthetics_8be2vx$.dataPoints().iterator();\n tmp$_0 = legendLayer.keyLabels_8be2vx$.iterator();\n while (tmp$_0.hasNext()) {\n var label = tmp$_0.next();\n var tmp$_5;\n var value = legendBreaksByLabel.get_11rb$(label);\n if (value == null) {\n var answer = new LegendBreak(label);\n legendBreaksByLabel.put_xwzc9p$(label, answer);\n tmp$_5 = answer;\n } else {\n tmp$_5 = value;\n }\n tmp$_5.addLayer_w0u015$(dataPoints.next(), keyElementFactory);\n }\n }\n var legendBreaks = ArrayList_init();\n tmp$_1 = legendBreaksByLabel.values.iterator();\n while (tmp$_1.hasNext()) {\n var legendBreak = tmp$_1.next();\n if (legendBreak.isEmpty) {\n continue;\n }legendBreaks.add_11rb$(legendBreak);\n }\n if (legendBreaks.isEmpty()) {\n return LegendBoxInfo$Companion_getInstance().EMPTY;\n }var legendOptionsList = ArrayList_init();\n tmp$_2 = this.legendLayers_0.iterator();\n while (tmp$_2.hasNext()) {\n var legendLayer_0 = tmp$_2.next();\n var aesList = legendLayer_0.aesList_8be2vx$;\n tmp$_3 = aesList.iterator();\n while (tmp$_3.hasNext()) {\n var aes = tmp$_3.next();\n if (Kotlin.isType(this.guideOptionsMap_0.get_11rb$(aes), LegendOptions)) {\n legendOptionsList.add_11rb$(Kotlin.isType(tmp$_4 = this.guideOptionsMap_0.get_11rb$(aes), LegendOptions) ? tmp$_4 : throwCCE());\n }}\n }\n var spec = LegendAssembler$Companion_getInstance().createLegendSpec_esqxbx$(this.legendTitle_0, legendBreaks, this.theme_0, LegendOptions$Companion_getInstance().combine_pmdc6s$(legendOptionsList));\n return new LegendAssembler$createLegend$ObjectLiteral(spec, spec.size);\n };\n function LegendAssembler$LegendLayer(keyElementFactory, varBindings, constantByAes, aestheticsDefaults, scaleMap, transformedDomainByAes) {\n this.keyElementFactory_8be2vx$ = keyElementFactory;\n this.varBindings_0 = varBindings;\n this.constantByAes_0 = constantByAes;\n this.aestheticsDefaults_0 = aestheticsDefaults;\n this.scaleMap_0 = scaleMap;\n this.keyAesthetics_8be2vx$ = null;\n this.keyLabels_8be2vx$ = null;\n var tmp$, tmp$_0;\n var aesValuesByLabel = LinkedHashMap_init();\n tmp$ = this.varBindings_0.iterator();\n while (tmp$.hasNext()) {\n var varBinding = tmp$.next();\n var aes = varBinding.aes;\n var scale_0 = this.scaleMap_0.get_31786j$(aes);\n if (!scale_0.hasBreaks()) {\n scale_0 = breaks.ScaleBreaksUtil.withBreaks_qt1l9m$(scale_0, getValue(transformedDomainByAes, aes), 5);\n }if (!scale_0.hasBreaks()) {\n var message = 'No breaks were defined for scale ' + aes;\n throw IllegalStateException_init(message.toString());\n }var scaleBreaks = scale_0.getScaleBreaks();\n var aesValues = scale.ScaleUtil.map_9ksyxk$(scaleBreaks.transformedValues, scale_0);\n var labels = scaleBreaks.labels;\n tmp$_0 = zip(labels, aesValues).iterator();\n while (tmp$_0.hasNext()) {\n var tmp$_1 = tmp$_0.next();\n var label = tmp$_1.component1()\n , aesValue = tmp$_1.component2();\n var tmp$_2;\n var value = aesValuesByLabel.get_11rb$(label);\n if (value == null) {\n var answer = HashMap_init();\n aesValuesByLabel.put_xwzc9p$(label, answer);\n tmp$_2 = answer;\n } else {\n tmp$_2 = value;\n }\n var $receiver = tmp$_2;\n var value_0 = ensureNotNull(aesValue);\n $receiver.put_xwzc9p$(aes, value_0);\n }\n }\n this.keyAesthetics_8be2vx$ = LegendAssemblerUtil_getInstance().mapToAesthetics_8kbmqf$(aesValuesByLabel.values, this.constantByAes_0, this.aestheticsDefaults_0);\n this.keyLabels_8be2vx$ = ArrayList_init_1(aesValuesByLabel.keys);\n }\n Object.defineProperty(LegendAssembler$LegendLayer.prototype, 'aesList_8be2vx$', {\n configurable: true,\n get: function () {\n var $receiver = this.varBindings_0;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(item.aes);\n }\n return destination;\n }\n });\n LegendAssembler$LegendLayer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendLayer',\n interfaces: []\n };\n function LegendAssembler$Companion() {\n LegendAssembler$Companion_instance = this;\n this.DEBUG_DRAWING_0 = FeatureSwitch_getInstance().LEGEND_DEBUG_DRAWING;\n }\n function LegendAssembler$Companion$createLegendSpec$pretty(v) {\n var margin = 1.0;\n var x = v.x / 2;\n var tmp$ = JsMath.floor(x) * 2 + 1.0 + margin;\n var x_0 = v.y / 2;\n return new DoubleVector(tmp$, JsMath.floor(x_0) * 2 + 1.0 + margin);\n }\n LegendAssembler$Companion.prototype.createLegendSpec_esqxbx$ = function (title, breaks, theme, options) {\n if (options === void 0)\n options = new LegendOptions();\n var tmp$, tmp$_0, tmp$_1;\n var legendDirection = LegendAssemblerUtil_getInstance().legendDirection_730mk3$(theme);\n var pretty = LegendAssembler$Companion$createLegendSpec$pretty;\n var keySize = new DoubleVector(theme.keySize(), theme.keySize());\n tmp$ = breaks.iterator();\n while (tmp$.hasNext()) {\n var br = tmp$.next();\n var minimumKeySize = br.minimumKeySize;\n keySize = keySize.max_gpjtzr$(pretty(minimumKeySize));\n }\n var breakCount = breaks.size;\n var colCount;\n var rowCount;\n if (options.isByRow) {\n if (options.hasColCount()) {\n var a = options.colCount;\n tmp$_0 = JsMath.min(a, breakCount);\n } else if (options.hasRowCount()) {\n var x = breakCount / options.rowCount;\n tmp$_0 = numberToInt(JsMath.ceil(x));\n } else if (legendDirection === LegendDirection$HORIZONTAL_getInstance())\n tmp$_0 = breakCount;\n else\n tmp$_0 = 1;\n colCount = tmp$_0;\n var x_0 = breakCount / colCount;\n rowCount = numberToInt(JsMath.ceil(x_0));\n } else {\n if (options.hasRowCount()) {\n var a_0 = options.rowCount;\n tmp$_1 = JsMath.min(a_0, breakCount);\n } else if (options.hasColCount()) {\n var x_1 = breakCount / options.colCount;\n tmp$_1 = numberToInt(JsMath.ceil(x_1));\n } else if (legendDirection !== LegendDirection$HORIZONTAL_getInstance())\n tmp$_1 = breakCount;\n else\n tmp$_1 = 1;\n rowCount = tmp$_1;\n var x_2 = breakCount / rowCount;\n colCount = numberToInt(JsMath.ceil(x_2));\n }\n var layout;\n if (legendDirection === LegendDirection$HORIZONTAL_getInstance()) {\n if (options.hasRowCount() || (options.hasColCount() && options.colCount < breakCount)) {\n layout = LegendComponentLayout$Companion_getInstance().horizontalMultiRow_2y8ibu$(title, breaks, keySize);\n } else {\n layout = LegendComponentLayout$Companion_getInstance().horizontal_2y8ibu$(title, breaks, keySize);\n }\n } else {\n layout = LegendComponentLayout$Companion_getInstance().vertical_2y8ibu$(title, breaks, keySize);\n }\n layout.colCount = colCount;\n layout.rowCount = rowCount;\n layout.isFillByRow = options.isByRow;\n return new LegendComponentSpec(title, breaks, theme, layout, false);\n };\n LegendAssembler$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendAssembler$Companion_instance = null;\n function LegendAssembler$Companion_getInstance() {\n if (LegendAssembler$Companion_instance === null) {\n new LegendAssembler$Companion();\n }return LegendAssembler$Companion_instance;\n }\n LegendAssembler.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendAssembler',\n interfaces: []\n };\n function LegendAssemblerUtil() {\n LegendAssemblerUtil_instance = this;\n }\n LegendAssemblerUtil.prototype.mapToAesthetics_ml5orx$ = function (valuesByAes, constantByAes, aestheticsDefaults) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var builder = new AestheticsBuilder(0);\n tmp$ = Aes.Companion.values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n builder.constantAes_bbdhip$(Kotlin.isType(tmp$_0 = aes, Aes) ? tmp$_0 : throwCCE(), aestheticsDefaults.defaultValue_31786j$(aes));\n }\n tmp$_1 = valuesByAes.keys.iterator();\n while (tmp$_1.hasNext()) {\n var aes_0 = tmp$_1.next();\n var values = ensureNotNull(valuesByAes.get_11rb$(aes_0));\n builder.aes_u42xfl$(aes_0, AestheticsBuilder.Companion.collection_mqih57$(values));\n builder.dataPointCount_za3lpa$(values.size);\n }\n tmp$_2 = constantByAes.keys.iterator();\n while (tmp$_2.hasNext()) {\n var aes_1 = tmp$_2.next();\n builder.constantAes_bbdhip$(aes_1, ensureNotNull(constantByAes.get_11rb$(aes_1)));\n }\n return builder.build();\n };\n function LegendAssemblerUtil$mapToAesthetics$lambda(closure$dataPoints, closure$aes) {\n return function (index) {\n return ensureNotNull(closure$dataPoints.get_za3lpa$(index).get_11rb$(closure$aes));\n };\n }\n LegendAssemblerUtil.prototype.mapToAesthetics_8kbmqf$ = function (valueByAesIterable, constantByAes, aestheticsDefaults) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n var dataPoints = ArrayList_init();\n tmp$ = valueByAesIterable.iterator();\n while (tmp$.hasNext()) {\n var valueByAes = tmp$.next();\n var dataPoint = HashMap_init();\n tmp$_0 = Aes.Companion.values().iterator();\n while (tmp$_0.hasNext()) {\n var aes = tmp$_0.next();\n var value = ensureNotNull(aestheticsDefaults.defaultValueInLegend_31786j$(aes));\n dataPoint.put_xwzc9p$(aes, value);\n }\n tmp$_1 = constantByAes.keys.iterator();\n while (tmp$_1.hasNext()) {\n var constantAes = tmp$_1.next();\n if (equals(constantAes, Aes.Companion.SHAPE) || equals(constantAes, Aes.Companion.COLOR) || equals(constantAes, Aes.Companion.FILL)) {\n var value_0 = ensureNotNull(constantByAes.get_11rb$(constantAes));\n dataPoint.put_xwzc9p$(constantAes, value_0);\n }}\n tmp$_2 = valueByAes.keys.iterator();\n while (tmp$_2.hasNext()) {\n var aes_0 = tmp$_2.next();\n var value_1 = ensureNotNull(valueByAes.get_11rb$(aes_0));\n dataPoint.put_xwzc9p$(aes_0, value_1);\n }\n dataPoints.add_11rb$(dataPoint);\n }\n var builder = new AestheticsBuilder(dataPoints.size);\n tmp$_3 = Aes.Companion.values().iterator();\n while (tmp$_3.hasNext()) {\n var aes_1 = tmp$_3.next();\n builder.aes_u42xfl$(Kotlin.isType(tmp$_4 = aes_1, Aes) ? tmp$_4 : throwCCE(), LegendAssemblerUtil$mapToAesthetics$lambda(dataPoints, aes_1));\n }\n return builder.build();\n };\n LegendAssemblerUtil.prototype.legendDirection_730mk3$ = function (theme) {\n var legendDirection = theme.direction();\n if (legendDirection === LegendDirection$AUTO_getInstance()) {\n var legendPosition = theme.position();\n legendDirection = legendPosition === LegendPosition$Companion_getInstance().TOP || legendPosition === LegendPosition$Companion_getInstance().BOTTOM ? LegendDirection$HORIZONTAL_getInstance() : LegendDirection$VERTICAL_getInstance();\n }return legendDirection;\n };\n LegendAssemblerUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'LegendAssemblerUtil',\n interfaces: []\n };\n var LegendAssemblerUtil_instance = null;\n function LegendAssemblerUtil_getInstance() {\n if (LegendAssemblerUtil_instance === null) {\n new LegendAssemblerUtil();\n }return LegendAssemblerUtil_instance;\n }\n function LegendOptions() {\n LegendOptions$Companion_getInstance();\n GuideOptions.call(this);\n this.myColCount_0 = null;\n this.myRowCount_0 = null;\n this.isByRow = false;\n }\n Object.defineProperty(LegendOptions.prototype, 'colCount', {\n configurable: true,\n get: function () {\n return ensureNotNull(this.myColCount_0);\n },\n set: function (colCount) {\n this.myColCount_0 = JsMath.max(1, colCount);\n }\n });\n Object.defineProperty(LegendOptions.prototype, 'rowCount', {\n configurable: true,\n get: function () {\n return ensureNotNull(this.myRowCount_0);\n },\n set: function (rowCount) {\n this.myRowCount_0 = JsMath.max(1, rowCount);\n }\n });\n LegendOptions.prototype.hasColCount = function () {\n return this.myColCount_0 != null;\n };\n LegendOptions.prototype.hasRowCount = function () {\n return this.myRowCount_0 != null;\n };\n function LegendOptions$Companion() {\n LegendOptions$Companion_instance = this;\n }\n LegendOptions$Companion.prototype.combine_pmdc6s$ = function (optionsList) {\n var tmp$;\n var result = new LegendOptions();\n tmp$ = optionsList.iterator();\n while (tmp$.hasNext()) {\n var options = tmp$.next();\n if (options.isByRow) {\n result.isByRow = true;\n }if (options.hasColCount()) {\n result.colCount = options.colCount;\n }if (options.hasRowCount()) {\n result.rowCount = options.rowCount;\n }}\n return result;\n };\n LegendOptions$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendOptions$Companion_instance = null;\n function LegendOptions$Companion_getInstance() {\n if (LegendOptions$Companion_instance === null) {\n new LegendOptions$Companion();\n }return LegendOptions$Companion_instance;\n }\n LegendOptions.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendOptions',\n interfaces: [GuideOptions]\n };\n function PlotAssembler(scaleByAes, layersByTile, myCoordProvider, myTheme) {\n PlotAssembler$Companion_getInstance();\n this.scaleByAes_0 = scaleByAes;\n this.layersByTile = layersByTile;\n this.myCoordProvider_0 = myCoordProvider;\n this.myTheme_0 = myTheme;\n this.containsLiveMap = false;\n this.facets = PlotFacets$Companion_getInstance().undefined();\n this.myTitle_0 = null;\n this.myGuideOptionsMap_0 = HashMap_init();\n this.myAxisEnabled_0 = false;\n this.myLegendsEnabled_0 = true;\n this.myInteractionsEnabled_0 = true;\n var $receiver = flatten(this.layersByTile);\n var predicate = getPropertyCallableRef('isLiveMap', 1, function ($receiver) {\n return $receiver.isLiveMap;\n });\n var any$result;\n any$break: do {\n var tmp$;\n if (Kotlin.isType($receiver, Collection) && $receiver.isEmpty()) {\n any$result = false;\n break any$break;\n }tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (predicate(element)) {\n any$result = true;\n break any$break;\n }}\n any$result = false;\n }\n while (false);\n this.containsLiveMap = any$result;\n this.myAxisEnabled_0 = !this.containsLiveMap;\n }\n PlotAssembler.prototype.setTitle_pdl1vj$ = function (title) {\n this.myTitle_0 = title;\n };\n PlotAssembler.prototype.hasLayers_0 = function () {\n var tmp$;\n tmp$ = this.layersByTile.iterator();\n while (tmp$.hasNext()) {\n var tileLayers = tmp$.next();\n if (!tileLayers.isEmpty()) {\n return true;\n }}\n return false;\n };\n PlotAssembler.prototype.createPlot = function () {\n if (!this.hasLayers_0()) {\n var message = 'No layers in plot';\n throw IllegalArgumentException_init(message.toString());\n }var legendsBoxInfos = this.myLegendsEnabled_0 ? PlotAssemblerUtil_getInstance().createLegends_fyi7ho$(this.layersByTile, this.myGuideOptionsMap_0, this.myTheme_0.legend()) : emptyList();\n var xScaleProto = this.scaleByAes_0.get_31786j$(Aes.Companion.X);\n var yScaleProto = this.scaleByAes_0.get_31786j$(Aes.Companion.Y);\n if (this.containsLiveMap) {\n var plotLayout = PlotAssemblerUtil_getInstance().createPlotLayout_3sq5f9$(new LiveMapTileLayout(), this.facets);\n return this.createXYPlot_0(xScaleProto, yScaleProto, plotLayout, legendsBoxInfos, true);\n }var tmp$ = PlotAssemblerUtil_getInstance().computePlotDryRunXYRanges_7yawgb$(this.layersByTile);\n var xDomain = tmp$.component1()\n , yDomain = tmp$.component2();\n var xAxisLayout;\n var yAxisLayout;\n if (this.myAxisEnabled_0) {\n xAxisLayout = PlotAxisLayout$Companion_getInstance().bottom_eknalg$(xScaleProto, xDomain, yDomain, this.myCoordProvider_0, this.myTheme_0.axisX());\n yAxisLayout = PlotAxisLayout$Companion_getInstance().left_eknalg$(yScaleProto, xDomain, yDomain, this.myCoordProvider_0, this.myTheme_0.axisY());\n } else {\n xAxisLayout = EmptyAxisLayout$Companion_getInstance().bottom_gyv40k$(xDomain, yDomain);\n yAxisLayout = EmptyAxisLayout$Companion_getInstance().left_gyv40k$(xDomain, yDomain);\n }\n var plotLayout_0 = PlotAssemblerUtil_getInstance().createPlotLayout_3sq5f9$(new XYPlotTileLayout(xAxisLayout, yAxisLayout), this.facets);\n if (!this.myAxisEnabled_0) {\n plotLayout_0.setPadding_6y0v78$(0.0, 0.0, 0.0, 0.0);\n }return this.createXYPlot_0(xScaleProto, yScaleProto, plotLayout_0, legendsBoxInfos);\n };\n PlotAssembler.prototype.createXYPlot_0 = function (xScaleProto, yScaleProto, plotLayout, legendBoxInfos, hasLiveMap) {\n if (hasLiveMap === void 0)\n hasLiveMap = false;\n var tmp$, tmp$_0;\n var plotBuilder = new PlotBuilder(this.myTheme_0);\n plotBuilder.setTitle_pdl1vj$(this.myTitle_0);\n plotBuilder.scaleXProto_iu85h4$(xScaleProto);\n plotBuilder.scaleYProto_iu85h4$(yScaleProto);\n plotBuilder.setAxisTitleBottom_61zpoe$(xScaleProto.name);\n plotBuilder.setAxisTitleLeft_61zpoe$(yScaleProto.name);\n plotBuilder.setCoordProvider_sdecqr$(this.myCoordProvider_0);\n tmp$ = legendBoxInfos.iterator();\n while (tmp$.hasNext()) {\n var legendBoxInfo = tmp$.next();\n plotBuilder.addLegendBoxInfo_29gouq$(legendBoxInfo);\n }\n tmp$_0 = this.layersByTile.iterator();\n while (tmp$_0.hasNext()) {\n var panelLayers = tmp$_0.next();\n plotBuilder.addTileLayers_relqli$(panelLayers);\n }\n plotBuilder.setPlotLayout_vjneqj$(plotLayout);\n plotBuilder.axisEnabled_6taknv$(this.myAxisEnabled_0);\n plotBuilder.interactionsEnabled_6taknv$(this.myInteractionsEnabled_0);\n plotBuilder.setLiveMap_6taknv$(hasLiveMap);\n return plotBuilder.build();\n };\n PlotAssembler.prototype.setGuideOptionsMap_qayxze$ = function (guideOptionsMap) {\n this.myGuideOptionsMap_0 = guideOptionsMap;\n };\n PlotAssembler.prototype.disableAxis = function () {\n this.myAxisEnabled_0 = false;\n };\n PlotAssembler.prototype.disableLegends = function () {\n this.myLegendsEnabled_0 = false;\n };\n PlotAssembler.prototype.disableInteractions = function () {\n this.myInteractionsEnabled_0 = false;\n };\n function PlotAssembler$Companion() {\n PlotAssembler$Companion_instance = this;\n }\n PlotAssembler$Companion.prototype.singleTile_wqghlj$ = function (scaleByAes, plotLayers, coordProvider, theme) {\n var layersByTile = ArrayList_init();\n layersByTile.add_11rb$(plotLayers);\n return this.multiTile_bm7ueq$(scaleByAes, layersByTile, coordProvider, theme);\n };\n PlotAssembler$Companion.prototype.multiTile_bm7ueq$ = function (scaleByAes, layersByTile, coordProvider, theme) {\n return new PlotAssembler(scaleByAes, layersByTile, coordProvider, theme);\n };\n PlotAssembler$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PlotAssembler$Companion_instance = null;\n function PlotAssembler$Companion_getInstance() {\n if (PlotAssembler$Companion_instance === null) {\n new PlotAssembler$Companion();\n }return PlotAssembler$Companion_instance;\n }\n PlotAssembler.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotAssembler',\n interfaces: []\n };\n function PlotAssemblerUtil() {\n PlotAssemblerUtil_instance = this;\n }\n PlotAssemblerUtil.prototype.updateAesRangeMap_0 = function (aes, range, rangeByAes) {\n var range_0 = range;\n if (range_0 != null) {\n var wasRange = rangeByAes.get_11rb$(aes);\n if (wasRange != null) {\n range_0 = wasRange.span_d226ot$(range_0);\n }var value = range_0;\n rangeByAes.put_xwzc9p$(aes, value);\n }};\n PlotAssemblerUtil.prototype.updateRange_0 = function (range, wasRange) {\n var range_0 = range;\n if (range_0 != null) {\n if (wasRange != null) {\n range_0 = wasRange.span_d226ot$(range_0);\n }return range_0;\n }return wasRange;\n };\n PlotAssemblerUtil.prototype.updateRange_1 = function (values, wasRange) {\n if (!collect.Iterables.isEmpty_fakr2g$(values)) {\n var newRange = ClosedRange.Companion.encloseAll_17hg47$(values);\n if (wasRange != null) {\n newRange = wasRange.span_d226ot$(newRange);\n }return newRange;\n }return wasRange;\n };\n PlotAssemblerUtil.prototype.createLegends_fyi7ho$ = function (layersByPanel, guideOptionsMap, theme) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var planeCount = 0;\n if (!layersByPanel.isEmpty()) {\n planeCount = layersByPanel.get_za3lpa$(0).size;\n }var stitchedLayersList = ArrayList_init();\n tmp$ = planeCount;\n for (var i = 0; i < tmp$; i++) {\n var layersOnPlane = ArrayList_init();\n tmp$_0 = layersByPanel.iterator();\n while (tmp$_0.hasNext()) {\n var panelLayers = tmp$_0.next();\n layersOnPlane.add_11rb$(panelLayers.get_za3lpa$(i));\n }\n stitchedLayersList.add_11rb$(new StitchedPlotLayers(layersOnPlane));\n }\n var transformedDomainByAes = HashMap_init();\n tmp$_1 = stitchedLayersList.iterator();\n while (tmp$_1.hasNext()) {\n var stitchedPlotLayers = tmp$_1.next();\n var layerTransformedDomainByAes = PlotGuidesAssemblerUtil_getInstance().guideTransformedDomainByAes_rf697z$(stitchedPlotLayers, guideOptionsMap);\n tmp$_2 = layerTransformedDomainByAes.entries.iterator();\n while (tmp$_2.hasNext()) {\n var tmp$_3 = tmp$_2.next();\n var aes = tmp$_3.key;\n var transformedDomain = tmp$_3.value;\n this.updateAesRangeMap_0(aes, transformedDomain, transformedDomainByAes);\n }\n }\n return this.createLegends_0(stitchedLayersList, transformedDomainByAes, guideOptionsMap, theme);\n };\n PlotAssemblerUtil.prototype.createLegends_0 = function (stitchedLayersList, transformedDomainByAes, guideOptionsMap, theme) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4, tmp$_5, tmp$_6;\n var legendAssemblerByTitle = LinkedHashMap_init();\n var colorBarAssemblerByTitle = LinkedHashMap_init();\n tmp$ = stitchedLayersList.iterator();\n while (tmp$.hasNext()) {\n var stitchedLayers = tmp$.next();\n var layerConstantByAes = HashMap_init();\n tmp$_0 = stitchedLayers.renderedAes().iterator();\n while (tmp$_0.hasNext()) {\n var aes = tmp$_0.next();\n if (stitchedLayers.hasConstant_896ixz$(aes)) {\n var value = ensureNotNull(stitchedLayers.getConstant_31786j$(aes));\n layerConstantByAes.put_xwzc9p$(aes, value);\n }}\n var layerBindingsByScaleName = LinkedHashMap_init();\n var aesList = PlotGuidesAssemblerUtil_getInstance().mappedRenderedAesToCreateGuides_rf697z$(stitchedLayers, guideOptionsMap);\n tmp$_1 = aesList.iterator();\n while (tmp$_1.hasNext()) {\n var aes_0 = tmp$_1.next();\n var colorBar = false;\n var binding = stitchedLayers.getBinding_896ixz$(aes_0);\n var scale = stitchedLayers.getScale_896ixz$(aes_0);\n var scaleName = scale.name;\n if (guideOptionsMap.containsKey_11rb$(aes_0)) {\n var guideOptions = guideOptionsMap.get_11rb$(aes_0);\n if (Kotlin.isType(guideOptions, ColorBarOptions)) {\n PlotGuidesAssemblerUtil_getInstance().checkFitsColorBar_k9b7d3$(binding.aes, scale);\n colorBar = true;\n var colorScale = Kotlin.isType(tmp$_2 = scale, Scale) ? tmp$_2 : throwCCE();\n var value_0 = PlotGuidesAssemblerUtil_getInstance().createColorBarAssembler_mzqjql$(scaleName, binding.aes, transformedDomainByAes, colorScale, guideOptions, theme);\n colorBarAssemblerByTitle.put_xwzc9p$(scaleName, value_0);\n }} else if (PlotGuidesAssemblerUtil_getInstance().fitsColorBar_k9b7d3$(binding.aes, scale)) {\n colorBar = true;\n var colorScale_0 = Kotlin.isType(tmp$_3 = scale, Scale) ? tmp$_3 : throwCCE();\n var value_1 = PlotGuidesAssemblerUtil_getInstance().createColorBarAssembler_mzqjql$(scaleName, binding.aes, transformedDomainByAes, colorScale_0, null, theme);\n colorBarAssemblerByTitle.put_xwzc9p$(scaleName, value_1);\n }if (!colorBar) {\n var tmp$_7;\n var value_2 = layerBindingsByScaleName.get_11rb$(scaleName);\n if (value_2 == null) {\n var answer = ArrayList_init();\n layerBindingsByScaleName.put_xwzc9p$(scaleName, answer);\n tmp$_7 = answer;\n } else {\n tmp$_7 = value_2;\n }\n tmp$_7.add_11rb$(binding);\n }}\n tmp$_4 = layerBindingsByScaleName.keys.iterator();\n while (tmp$_4.hasNext()) {\n var scaleName_0 = tmp$_4.next();\n var tmp$_8;\n var value_3 = legendAssemblerByTitle.get_11rb$(scaleName_0);\n if (value_3 == null) {\n var answer_0 = new LegendAssembler(scaleName_0, guideOptionsMap, theme);\n legendAssemblerByTitle.put_xwzc9p$(scaleName_0, answer_0);\n tmp$_8 = answer_0;\n } else {\n tmp$_8 = value_3;\n }\n var legendAssembler = tmp$_8;\n var varBindings = ensureNotNull(layerBindingsByScaleName.get_11rb$(scaleName_0));\n var legendKeyFactory = stitchedLayers.legendKeyElementFactory;\n var aestheticsDefaults = stitchedLayers.aestheticsDefaults;\n legendAssembler.addLayer_446ka8$(legendKeyFactory, varBindings, layerConstantByAes, aestheticsDefaults, stitchedLayers.getScaleMap(), transformedDomainByAes);\n }\n }\n var legendBoxInfos = ArrayList_init();\n tmp$_5 = colorBarAssemblerByTitle.keys.iterator();\n while (tmp$_5.hasNext()) {\n var legendTitle = tmp$_5.next();\n var boxInfo = ensureNotNull(colorBarAssemblerByTitle.get_11rb$(legendTitle)).createColorBar();\n if (!boxInfo.isEmpty) {\n legendBoxInfos.add_11rb$(boxInfo);\n }}\n tmp$_6 = legendAssemblerByTitle.keys.iterator();\n while (tmp$_6.hasNext()) {\n var legendTitle_0 = tmp$_6.next();\n var boxInfo_0 = ensureNotNull(legendAssemblerByTitle.get_11rb$(legendTitle_0)).createLegend();\n if (!boxInfo_0.isEmpty) {\n legendBoxInfos.add_11rb$(boxInfo_0);\n }}\n return legendBoxInfos;\n };\n PlotAssemblerUtil.prototype.createPlotLayout_3sq5f9$ = function (tileLayout, facets) {\n if (!facets.isDefined) {\n return new SingleTilePlotLayout(tileLayout);\n }return new FacetGridPlotLayout(facets, tileLayout);\n };\n PlotAssemblerUtil.prototype.computePlotDryRunXYRanges_7yawgb$ = function (layersByTile) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var dryRunAestheticsByTileLayer = HashMap_init();\n tmp$ = layersByTile.iterator();\n while (tmp$.hasNext()) {\n var tileLayers = tmp$.next();\n tmp$_0 = tileLayers.iterator();\n while (tmp$_0.hasNext()) {\n var layer = tmp$_0.next();\n var aesthetics = PlotUtil_getInstance().createLayerDryRunAesthetics_sqg2xh$(layer);\n dryRunAestheticsByTileLayer.put_xwzc9p$(layer, aesthetics);\n }\n }\n var layers0 = layersByTile.get_za3lpa$(0);\n var scaleMap = layers0.get_za3lpa$(0).scaleMap;\n var xScale = scaleMap.get_31786j$(Aes.Companion.X);\n var yScale = scaleMap.get_31786j$(Aes.Companion.Y);\n var xInitialRange = PlotAssemblerUtil$RangeUtil_getInstance().initialRange_iu85h4$(xScale);\n var yInitialRange = PlotAssemblerUtil$RangeUtil_getInstance().initialRange_iu85h4$(yScale);\n var xRangeOverall = null;\n var yRangeOverall = null;\n tmp$_1 = layersByTile.iterator();\n while (tmp$_1.hasNext()) {\n var tileLayers_0 = tmp$_1.next();\n tmp$_2 = tileLayers_0.iterator();\n while (tmp$_2.hasNext()) {\n var layer_0 = tmp$_2.next();\n var aesthetics_0 = getValue(dryRunAestheticsByTileLayer, layer_0);\n var xyRanges = PlotUtil_getInstance().computeLayerDryRunXYRanges_gl53zg$(layer_0, aesthetics_0);\n var xRangeLayer = this.updateRange_0(xInitialRange, xyRanges.first);\n var yRangeLayer = this.updateRange_0(yInitialRange, xyRanges.second);\n xRangeOverall = this.updateRange_0(xRangeLayer, xRangeOverall);\n yRangeOverall = this.updateRange_0(yRangeLayer, yRangeOverall);\n }\n }\n xRangeOverall = PlotAssemblerUtil$RangeUtil_getInstance().expandRange_orhr76$(xRangeOverall, Aes.Companion.X, xScale, layers0);\n yRangeOverall = PlotAssemblerUtil$RangeUtil_getInstance().expandRange_orhr76$(yRangeOverall, Aes.Companion.Y, yScale, layers0);\n xRangeOverall = data_0.SeriesUtil.ensureApplicableRange_4am1sd$(xRangeOverall);\n yRangeOverall = data_0.SeriesUtil.ensureApplicableRange_4am1sd$(yRangeOverall);\n return new Pair(xRangeOverall, yRangeOverall);\n };\n function PlotAssemblerUtil$RangeUtil() {\n PlotAssemblerUtil$RangeUtil_instance = this;\n }\n PlotAssemblerUtil$RangeUtil.prototype.initialRange_iu85h4$ = function (scale_0) {\n var initialRange = null;\n if (scale_0.isContinuousDomain) {\n var tmp$ = PlotAssemblerUtil_getInstance();\n var $receiver = toList(scale.ScaleUtil.transformedDefinedLimits_x4zrm4$(scale_0));\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (isFinite(element))\n destination.add_11rb$(element);\n }\n initialRange = tmp$.updateRange_1(destination, initialRange);\n }if (scale_0.hasBreaks()) {\n var scaleBreaks = scale_0.getScaleBreaks();\n initialRange = PlotAssemblerUtil_getInstance().updateRange_1(scaleBreaks.transformedValues, initialRange);\n }return initialRange;\n };\n PlotAssemblerUtil$RangeUtil.prototype.expandRange_orhr76$ = function (range, aes, scale, layers) {\n var tmp$;\n var any$result;\n any$break: do {\n var tmp$_0;\n if (Kotlin.isType(layers, Collection) && layers.isEmpty()) {\n any$result = false;\n break any$break;\n }tmp$_0 = layers.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (element.rangeIncludesZero_896ixz$(aes)) {\n any$result = true;\n break any$break;\n }}\n any$result = false;\n }\n while (false);\n var includeZero = any$result;\n if (includeZero === true)\n tmp$ = PlotAssemblerUtil_getInstance().updateRange_0(ClosedRange.Companion.singleton_f1zjgi$(0.0), range);\n else if (includeZero === false)\n tmp$ = range;\n else\n tmp$ = Kotlin.noWhenBranchMatched();\n var range_0 = tmp$;\n return PlotUtil_getInstance().rangeWithExpand_einsbb$(range_0, scale, includeZero);\n };\n PlotAssemblerUtil$RangeUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'RangeUtil',\n interfaces: []\n };\n var PlotAssemblerUtil$RangeUtil_instance = null;\n function PlotAssemblerUtil$RangeUtil_getInstance() {\n if (PlotAssemblerUtil$RangeUtil_instance === null) {\n new PlotAssemblerUtil$RangeUtil();\n }return PlotAssemblerUtil$RangeUtil_instance;\n }\n PlotAssemblerUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PlotAssemblerUtil',\n interfaces: []\n };\n var PlotAssemblerUtil_instance = null;\n function PlotAssemblerUtil_getInstance() {\n if (PlotAssemblerUtil_instance === null) {\n new PlotAssemblerUtil();\n }return PlotAssemblerUtil_instance;\n }\n function PlotFacets() {\n PlotFacets$Companion_getInstance();\n }\n function PlotFacets$Companion() {\n PlotFacets$Companion_instance = this;\n this.DEF_ORDER_DIR = 1;\n this.DEF_FORMATTER = PlotFacets$Companion$DEF_FORMATTER$lambda;\n }\n PlotFacets$Companion.prototype.undefined = function () {\n return new FacetGrid(null, null, emptyList(), emptyList(), 1, 1);\n };\n PlotFacets$Companion.prototype.dataByLevelTuple_w4sfrb$ = function (data, varNames, varLevels) {\n var tmp$, tmp$_0, tmp$_1;\n var nameLevelTuples = this.createNameLevelTuples_5cxrh4$(varNames, varLevels);\n var indicesByVarByLevel = this.dataIndicesByVarByLevel_0(data, varNames, varLevels);\n var dataByLevelKey = ArrayList_init();\n tmp$ = nameLevelTuples.iterator();\n while (tmp$.hasNext()) {\n var nameLevelTuple = tmp$.next();\n var topName = first(nameLevelTuple).first;\n var topLevel = first(nameLevelTuple).second;\n var indices = ArrayList_init_1(getValue(getValue(indicesByVarByLevel, topName), topLevel));\n tmp$_0 = nameLevelTuple.size;\n for (var i = 1; i < tmp$_0; i++) {\n var name = nameLevelTuple.get_za3lpa$(i).first;\n var level = nameLevelTuple.get_za3lpa$(i).second;\n var levelIndices = getValue(getValue(indicesByVarByLevel, name), level);\n indices.retainAll_brywnq$(HashSet_init(levelIndices));\n }\n var destination = ArrayList_init_0(collectionSizeOrDefault(nameLevelTuple, 10));\n var tmp$_2;\n tmp$_2 = nameLevelTuple.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination.add_11rb$(item.second);\n }\n var levelKey = destination;\n var b = DataFrame$DataFrame$Builder_init();\n var variables = data.variables();\n tmp$_1 = variables.iterator();\n while (tmp$_1.hasNext()) {\n var variable = tmp$_1.next();\n var source = data.get_8xm3sj$(variable);\n var target = data_0.SeriesUtil.pickAtIndices_ge51dg$(source, indices);\n b.put_2l962d$(variable, target);\n }\n var levelData = b.build();\n dataByLevelKey.add_11rb$(to(levelKey, levelData));\n }\n return dataByLevelKey;\n };\n PlotFacets$Companion.prototype.dataIndicesByVarByLevel_0 = function (data_1, varNames, varLevels) {\n var indicesByVarByLevel = HashMap_init();\n var i = 0;\n for (var tmp$ = varNames.iterator(); tmp$.hasNext(); ++i) {\n var varName = tmp$.next();\n var tmp$_0, tmp$_1;\n var levels = varLevels.get_za3lpa$(i);\n var indicesByLevel = HashMap_init();\n tmp$_0 = levels.iterator();\n while (tmp$_0.hasNext()) {\n var level = tmp$_0.next();\n if (data_1.isEmpty)\n tmp$_1 = emptyList();\n else {\n var variable = data.DataFrameUtil.findVariableOrFail_vede35$(data_1, varName);\n tmp$_1 = data_0.SeriesUtil.matchingIndices_3vukww$(data_1.get_8xm3sj$(variable), level);\n }\n var indices = tmp$_1;\n indicesByLevel.put_xwzc9p$(level, indices);\n }\n indicesByVarByLevel.put_xwzc9p$(varName, indicesByLevel);\n }\n return indicesByVarByLevel;\n };\n PlotFacets$Companion.prototype.createNameLevelTuples_5cxrh4$ = function (varNames, varLevels) {\n if (!!varNames.isEmpty()) {\n var message = 'Empty list of facet variables.';\n throw IllegalArgumentException_init(message.toString());\n }if (!(varNames.size === distinct(varNames).size)) {\n var message_0 = 'Facet variables must be distinct, were: ' + varNames + '.';\n throw IllegalArgumentException_init(message_0.toString());\n }if (!(varNames.size === varLevels.size)) {\n var message_1 = 'Check failed.';\n throw IllegalStateException_init(message_1.toString());\n }return this.createNameLevelTuplesIntern_0(varNames, varLevels);\n };\n PlotFacets$Companion.prototype.createNameLevelTuplesIntern_0 = function (varNames, varLevels) {\n var tmp$, tmp$_0;\n var name = first(varNames);\n var levels = first(varLevels);\n var levelKeys = ArrayList_init();\n tmp$ = levels.iterator();\n while (tmp$.hasNext()) {\n var level = tmp$.next();\n if (varNames.size > 1) {\n var subKeys = this.createNameLevelTuples_5cxrh4$(varNames.subList_vux9f0$(1, varNames.size), varLevels.subList_vux9f0$(1, varLevels.size));\n tmp$_0 = subKeys.iterator();\n while (tmp$_0.hasNext()) {\n var subKey = tmp$_0.next();\n levelKeys.add_11rb$(plus(listOf(to(name, level)), subKey));\n }\n } else {\n levelKeys.add_11rb$(listOf(to(name, level)));\n }\n }\n return levelKeys;\n };\n PlotFacets$Companion.prototype.reorderLevels_dyo1lv$ = function (varNames, varLevels, ordering) {\n var orderingByFacet = toMap(zip(varNames, ordering));\n var result = ArrayList_init();\n var i = 0;\n for (var tmp$ = varNames.iterator(); tmp$.hasNext(); ++i) {\n var name = tmp$.next();\n if (i >= varLevels.size)\n break;\n result.add_11rb$(this.reorderVarLevels_pbdvt$(name, varLevels.get_za3lpa$(i), getValue(orderingByFacet, name)));\n }\n return result;\n };\n PlotFacets$Companion.prototype.reorderVarLevels_pbdvt$ = function (name, levels, order) {\n var tmp$, tmp$_0;\n if (name == null)\n return levels;\n Kotlin.isType(tmp$ = levels, List) ? tmp$ : throwCCE();\n if (order < 0)\n tmp$_0 = sortedDescending(levels);\n else\n tmp$_0 = sorted(levels);\n return tmp$_0;\n };\n function PlotFacets$Companion$DEF_FORMATTER$lambda(it) {\n return it.toString();\n }\n PlotFacets$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PlotFacets$Companion_instance = null;\n function PlotFacets$Companion_getInstance() {\n if (PlotFacets$Companion_instance === null) {\n new PlotFacets$Companion();\n }return PlotFacets$Companion_instance;\n }\n function PlotFacets$FacetTileInfo(col, row, colLabs, rowLab, xAxis, yAxis, trueIndex) {\n this.col = col;\n this.row = row;\n this.colLabs = colLabs;\n this.rowLab = rowLab;\n this.xAxis = xAxis;\n this.yAxis = yAxis;\n this.trueIndex = trueIndex;\n }\n PlotFacets$FacetTileInfo.prototype.toString = function () {\n return 'FacetTileInfo(col=' + this.col + ', row=' + this.row + ', colLabs=' + this.colLabs + ', rowLab=' + toString(this.rowLab) + ')';\n };\n PlotFacets$FacetTileInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FacetTileInfo',\n interfaces: []\n };\n PlotFacets.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotFacets',\n interfaces: []\n };\n function PlotGuidesAssemblerUtil() {\n PlotGuidesAssemblerUtil_instance = this;\n }\n PlotGuidesAssemblerUtil.prototype.mappedRenderedAesToCreateGuides_rf697z$ = function (layerTiles, guideOptionsMap) {\n var tmp$;\n if (layerTiles.isLegendDisabled) {\n return emptyList();\n }var result = ArrayList_init();\n tmp$ = layerTiles.renderedAes().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n if (Aes.Companion.noGuideNeeded_896ixz$(aes)) {\n continue;\n }if (layerTiles.hasConstant_896ixz$(aes)) {\n continue;\n }if (!layerTiles.hasBinding_896ixz$(aes)) {\n continue;\n }if (guideOptionsMap.containsKey_11rb$(aes)) {\n if (guideOptionsMap.get_11rb$(aes) === GuideOptions$Companion_getInstance().NONE) {\n continue;\n }}result.add_11rb$(aes);\n }\n return result;\n };\n PlotGuidesAssemblerUtil.prototype.guideTransformedDomainByAes_rf697z$ = function (stitchedLayers, guideOptionsMap) {\n var tmp$;\n var transformedDomainByAes = HashMap_init();\n var aesSet = this.mappedRenderedAesToCreateGuides_rf697z$(stitchedLayers, guideOptionsMap);\n tmp$ = aesSet.iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n var transformVariable = stitchedLayers.getBinding_896ixz$(aes).variable;\n if (!transformVariable.isTransform) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }var transformedDataRange = stitchedLayers.getDataRange_8xm3sj$(transformVariable);\n var scale = stitchedLayers.getScale_896ixz$(aes);\n if (scale.isContinuousDomain) {\n var value = this.refineTransformedDataRangeForContinuousDomain_0(transformedDataRange, scale);\n transformedDomainByAes.put_xwzc9p$(aes, value);\n } else if (transformedDataRange != null) {\n transformedDomainByAes.put_xwzc9p$(aes, transformedDataRange);\n }}\n return transformedDomainByAes;\n };\n PlotGuidesAssemblerUtil.prototype.refineTransformedDataRangeForContinuousDomain_0 = function (transformedDataRange, scale_0) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3;\n if (transformedDataRange == null)\n tmp$ = new Pair_0(kotlin_js_internal_DoubleCompanionObject.NaN, kotlin_js_internal_DoubleCompanionObject.NaN);\n else\n tmp$ = new Pair_0(transformedDataRange.lowerEnd, transformedDataRange.upperEnd);\n var tmp$_4 = tmp$;\n var dataLower = tmp$_4.component1()\n , dataUpper = tmp$_4.component2();\n if (scale_0.hasDomainLimits() === true)\n tmp$_0 = scale.ScaleUtil.transformedDefinedLimits_x4zrm4$(scale_0);\n else\n tmp$_0 = new Pair_0(kotlin_js_internal_DoubleCompanionObject.NaN, kotlin_js_internal_DoubleCompanionObject.NaN);\n var tmp$_5 = tmp$_0;\n var scaleLower = tmp$_5.component1()\n , scaleUpper = tmp$_5.component2();\n var lowerEnd = isFinite(scaleLower) ? scaleLower : dataLower;\n var upperEnd = isFinite(scaleUpper) ? scaleUpper : dataUpper;\n if (isFinite(lowerEnd) && isFinite(upperEnd))\n tmp$_1 = new ClosedRange(lowerEnd, upperEnd);\n else if (isFinite(lowerEnd))\n tmp$_1 = new ClosedRange(lowerEnd, lowerEnd);\n else if (isFinite(upperEnd))\n tmp$_1 = new ClosedRange(upperEnd, upperEnd);\n else\n tmp$_1 = null;\n var newRange = tmp$_1;\n tmp$_3 = Kotlin.isType(tmp$_2 = scale_0.transform, ContinuousTransform) ? tmp$_2 : throwCCE();\n return transform.Transforms.ensureApplicableDomain_wa8y5m$(newRange, tmp$_3);\n };\n PlotGuidesAssemblerUtil.prototype.createColorBarAssembler_mzqjql$ = function (scaleName, aes, transformedDomainByAes, scale, options, theme) {\n var transformedDomain = transformedDomainByAes.get_11rb$(aes);\n if (transformedDomain == null) {\n var message = 'Domain for continuous data must not be null';\n throw IllegalStateException_init(message.toString());\n }var result = new ColorBarAssembler(scaleName, transformedDomain, scale, theme);\n result.setOptions_p8ufd2$(options);\n return result;\n };\n PlotGuidesAssemblerUtil.prototype.fitsColorBar_k9b7d3$ = function (aes, scale) {\n return aes.isColor && scale.isContinuous;\n };\n PlotGuidesAssemblerUtil.prototype.checkFitsColorBar_k9b7d3$ = function (aes, scale) {\n if (!aes.isColor) {\n var message = 'Color-bar is not applicable to ' + aes + ' aesthetic';\n throw IllegalStateException_init(message.toString());\n }if (!scale.isContinuous) {\n var message_0 = 'Color-bar is only applicable when both domain and color palette are continuous';\n throw IllegalStateException_init(message_0.toString());\n }};\n PlotGuidesAssemblerUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PlotGuidesAssemblerUtil',\n interfaces: []\n };\n var PlotGuidesAssemblerUtil_instance = null;\n function PlotGuidesAssemblerUtil_getInstance() {\n if (PlotGuidesAssemblerUtil_instance === null) {\n new PlotGuidesAssemblerUtil();\n }return PlotGuidesAssemblerUtil_instance;\n }\n function PosProvider() {\n PosProvider$Companion_getInstance();\n }\n function PosProvider$Companion() {\n PosProvider$Companion_instance = this;\n }\n function PosProvider$Companion$wrap$ObjectLiteral(closure$pos) {\n this.closure$pos = closure$pos;\n PosProvider.call(this);\n }\n PosProvider$Companion$wrap$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n return this.closure$pos;\n };\n PosProvider$Companion$wrap$ObjectLiteral.prototype.handlesGroups = function () {\n return this.closure$pos.handlesGroups();\n };\n PosProvider$Companion$wrap$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.wrap_dkjclg$ = function (pos) {\n return new PosProvider$Companion$wrap$ObjectLiteral(pos);\n };\n function PosProvider$Companion$barStack$ObjectLiteral() {\n PosProvider.call(this);\n }\n PosProvider$Companion$barStack$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n return pos.PositionAdjustments.stack_4vnpmn$(ctx.aesthetics, PositionAdjustments$StackingStrategy.SPLIT_POSITIVE_NEGATIVE);\n };\n PosProvider$Companion$barStack$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.STACK.handlesGroups();\n };\n PosProvider$Companion$barStack$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.barStack = function () {\n return new PosProvider$Companion$barStack$ObjectLiteral();\n };\n function PosProvider$Companion$dodge$ObjectLiteral(closure$width) {\n this.closure$width = closure$width;\n PosProvider.call(this);\n }\n PosProvider$Companion$dodge$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n var aesthetics = ctx.aesthetics;\n var groupCount = ctx.groupCount;\n return pos.PositionAdjustments.dodge_vvhcz8$(aesthetics, groupCount, this.closure$width);\n };\n PosProvider$Companion$dodge$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.DODGE.handlesGroups();\n };\n PosProvider$Companion$dodge$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.dodge_yrwdxb$ = function (width) {\n if (width === void 0)\n width = null;\n return new PosProvider$Companion$dodge$ObjectLiteral(width);\n };\n function PosProvider$Companion$fill$ObjectLiteral() {\n PosProvider.call(this);\n }\n PosProvider$Companion$fill$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n return pos.PositionAdjustments.fill_m7huy5$(ctx.aesthetics);\n };\n PosProvider$Companion$fill$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.FILL.handlesGroups();\n };\n PosProvider$Companion$fill$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.fill = function () {\n return new PosProvider$Companion$fill$ObjectLiteral();\n };\n function PosProvider$Companion$jitter$ObjectLiteral(closure$width, closure$height) {\n this.closure$width = closure$width;\n this.closure$height = closure$height;\n PosProvider.call(this);\n }\n PosProvider$Companion$jitter$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n return pos.PositionAdjustments.jitter_jma9l8$(this.closure$width, this.closure$height);\n };\n PosProvider$Companion$jitter$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.JITTER.handlesGroups();\n };\n PosProvider$Companion$jitter$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.jitter_jma9l8$ = function (width, height) {\n return new PosProvider$Companion$jitter$ObjectLiteral(width, height);\n };\n function PosProvider$Companion$nudge$ObjectLiteral(closure$width, closure$height) {\n this.closure$width = closure$width;\n this.closure$height = closure$height;\n PosProvider.call(this);\n }\n PosProvider$Companion$nudge$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n return pos.PositionAdjustments.nudge_jma9l8$(this.closure$width, this.closure$height);\n };\n PosProvider$Companion$nudge$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.NUDGE.handlesGroups();\n };\n PosProvider$Companion$nudge$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.nudge_jma9l8$ = function (width, height) {\n return new PosProvider$Companion$nudge$ObjectLiteral(width, height);\n };\n function PosProvider$Companion$jitterDodge$ObjectLiteral(closure$width, closure$jitterWidth, closure$jitterHeight) {\n this.closure$width = closure$width;\n this.closure$jitterWidth = closure$jitterWidth;\n this.closure$jitterHeight = closure$jitterHeight;\n PosProvider.call(this);\n }\n PosProvider$Companion$jitterDodge$ObjectLiteral.prototype.createPos_q7kk9g$ = function (ctx) {\n var aesthetics = ctx.aesthetics;\n var groupCount = ctx.groupCount;\n return pos.PositionAdjustments.jitterDodge_e2pc44$(aesthetics, groupCount, this.closure$width, this.closure$jitterWidth, this.closure$jitterHeight);\n };\n PosProvider$Companion$jitterDodge$ObjectLiteral.prototype.handlesGroups = function () {\n return PositionAdjustments$Meta.JITTER_DODGE.handlesGroups();\n };\n PosProvider$Companion$jitterDodge$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PosProvider]\n };\n PosProvider$Companion.prototype.jitterDodge_xjrefz$ = function (width, jitterWidth, jitterHeight) {\n return new PosProvider$Companion$jitterDodge$ObjectLiteral(width, jitterWidth, jitterHeight);\n };\n PosProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PosProvider$Companion_instance = null;\n function PosProvider$Companion_getInstance() {\n if (PosProvider$Companion_instance === null) {\n new PosProvider$Companion();\n }return PosProvider$Companion_instance;\n }\n PosProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PosProvider',\n interfaces: []\n };\n function StitchedPlotLayers(layers) {\n this.myLayers_0 = null;\n this.myLayers_0 = ArrayList_init_1(layers);\n }\n Object.defineProperty(StitchedPlotLayers.prototype, 'legendKeyElementFactory', {\n configurable: true,\n get: function () {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).legendKeyElementFactory;\n }\n });\n Object.defineProperty(StitchedPlotLayers.prototype, 'aestheticsDefaults', {\n configurable: true,\n get: function () {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).aestheticsDefaults;\n }\n });\n Object.defineProperty(StitchedPlotLayers.prototype, 'isLegendDisabled', {\n configurable: true,\n get: function () {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).isLegendDisabled;\n }\n });\n StitchedPlotLayers.prototype.renderedAes = function () {\n var tmp$;\n if (this.myLayers_0.isEmpty()) {\n tmp$ = emptyList();\n } else\n tmp$ = this.myLayers_0.get_za3lpa$(0).renderedAes();\n return tmp$;\n };\n StitchedPlotLayers.prototype.hasBinding_896ixz$ = function (aes) {\n return !this.myLayers_0.isEmpty() && this.myLayers_0.get_za3lpa$(0).hasBinding_896ixz$(aes);\n };\n StitchedPlotLayers.prototype.hasConstant_896ixz$ = function (aes) {\n return !this.myLayers_0.isEmpty() && this.myLayers_0.get_za3lpa$(0).hasConstant_896ixz$(aes);\n };\n StitchedPlotLayers.prototype.getConstant_31786j$ = function (aes) {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).getConstant_31786j$(aes);\n };\n StitchedPlotLayers.prototype.getBinding_896ixz$ = function (aes) {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).getBinding_31786j$(aes);\n };\n StitchedPlotLayers.prototype.getScale_896ixz$ = function (aes) {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).scaleMap.get_31786j$(aes);\n };\n StitchedPlotLayers.prototype.getScaleMap = function () {\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }return this.myLayers_0.get_za3lpa$(0).scaleMap;\n };\n StitchedPlotLayers.prototype.getDataRange_8xm3sj$ = function (variable) {\n var tmp$;\n if (!this.isNumericData_0(variable)) {\n var message = 'Not numeric data [' + variable + ']';\n throw IllegalStateException_init(message.toString());\n }var result = null;\n tmp$ = this.myLayers_0.iterator();\n while (tmp$.hasNext()) {\n var layer = tmp$.next();\n var range = layer.dataFrame.range_8xm3sj$(variable);\n result = data_0.SeriesUtil.span_t7esj2$(result, range);\n }\n return result;\n };\n StitchedPlotLayers.prototype.isNumericData_0 = function (variable) {\n var tmp$;\n if (!!this.myLayers_0.isEmpty()) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }tmp$ = this.myLayers_0.iterator();\n while (tmp$.hasNext()) {\n var layer = tmp$.next();\n if (!layer.dataFrame.isNumeric_8xm3sj$(variable)) {\n return false;\n }}\n return true;\n };\n StitchedPlotLayers.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'StitchedPlotLayers',\n interfaces: []\n };\n function TypedScaleMap(map) {\n TypedScaleMap$Companion_getInstance();\n this.myMap_0 = toMap_0(map);\n }\n function TypedScaleMap$get$lambda$lambda(closure$message) {\n return function () {\n return closure$message;\n };\n }\n TypedScaleMap.prototype.get_31786j$ = function (aes) {\n var tmp$, tmp$_0;\n var tmp$_1;\n if ((tmp$_0 = Kotlin.isType(tmp$ = this.myMap_0.get_11rb$(aes), Scale) ? tmp$ : null) != null)\n tmp$_1 = tmp$_0;\n else {\n var message = 'No scale found for aes: ' + aes;\n TypedScaleMap$Companion_getInstance().LOG_0.error_l35kib$(IllegalStateException_init(message), TypedScaleMap$get$lambda$lambda(message));\n throw IllegalStateException_init(message.toString());\n }\n return tmp$_1;\n };\n TypedScaleMap.prototype.containsKey_896ixz$ = function (aes) {\n return this.myMap_0.containsKey_11rb$(aes);\n };\n TypedScaleMap.prototype.keySet = function () {\n return this.myMap_0.keys;\n };\n function TypedScaleMap$Companion() {\n TypedScaleMap$Companion_instance = this;\n this.LOG_0 = logging.PortableLogging.logger_xo1ogr$(getKClass(TypedScaleMap));\n }\n TypedScaleMap$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TypedScaleMap$Companion_instance = null;\n function TypedScaleMap$Companion_getInstance() {\n if (TypedScaleMap$Companion_instance === null) {\n new TypedScaleMap$Companion();\n }return TypedScaleMap$Companion_instance;\n }\n TypedScaleMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TypedScaleMap',\n interfaces: []\n };\n function TypedScaleProviderMap(map) {\n this.myMap_0 = toMap_0(map);\n }\n TypedScaleProviderMap.prototype.get_31786j$ = function (aes) {\n var tmp$;\n return Kotlin.isType(tmp$ = this.myMap_0.get_11rb$(aes), ScaleProvider) ? tmp$ : throwCCE();\n };\n TypedScaleProviderMap.prototype.containsKey_896ixz$ = function (aes) {\n return this.myMap_0.containsKey_11rb$(aes);\n };\n TypedScaleProviderMap.prototype.keySet = function () {\n return this.myMap_0.keys;\n };\n TypedScaleProviderMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TypedScaleProviderMap',\n interfaces: []\n };\n function FacetGrid(xVar, yVar, xLevels, yLevels, xOrder, yOrder, xFormatter, yFormatter) {\n if (xFormatter === void 0)\n xFormatter = PlotFacets$Companion_getInstance().DEF_FORMATTER;\n if (yFormatter === void 0)\n yFormatter = PlotFacets$Companion_getInstance().DEF_FORMATTER;\n PlotFacets.call(this);\n this.xVar_0 = xVar;\n this.yVar_0 = yVar;\n this.xFormatter_0 = xFormatter;\n this.yFormatter_0 = yFormatter;\n this.isDefined_f95yff$_0 = this.xVar_0 != null || this.yVar_0 != null;\n this.xLevels_0 = PlotFacets$Companion_getInstance().reorderVarLevels_pbdvt$(this.xVar_0, xLevels, xOrder);\n this.yLevels_0 = PlotFacets$Companion_getInstance().reorderVarLevels_pbdvt$(this.yVar_0, yLevels, yOrder);\n var b = xLevels.size;\n this.colCount_bhcvpt$_0 = JsMath.max(1, b);\n var b_0 = yLevels.size;\n this.rowCount_8ohw8b$_0 = JsMath.max(1, b_0);\n this.numTiles_kasr4x$_0 = Kotlin.imul(this.colCount, this.rowCount);\n }\n Object.defineProperty(FacetGrid.prototype, 'isDefined', {\n configurable: true,\n get: function () {\n return this.isDefined_f95yff$_0;\n }\n });\n Object.defineProperty(FacetGrid.prototype, 'colCount', {\n configurable: true,\n get: function () {\n return this.colCount_bhcvpt$_0;\n }\n });\n Object.defineProperty(FacetGrid.prototype, 'rowCount', {\n configurable: true,\n get: function () {\n return this.rowCount_8ohw8b$_0;\n }\n });\n Object.defineProperty(FacetGrid.prototype, 'numTiles', {\n configurable: true,\n get: function () {\n return this.numTiles_kasr4x$_0;\n }\n });\n Object.defineProperty(FacetGrid.prototype, 'variables', {\n configurable: true,\n get: function () {\n return listOfNotNull([this.xVar_0, this.yVar_0]);\n }\n });\n FacetGrid.prototype.dataByTile_dhhkv7$ = function (data) {\n var tmp$;\n var tmp$_0, tmp$_1, tmp$_2;\n if (!this.isDefined) {\n var message = 'dataByTile() called on Undefined plot facets.';\n throw IllegalArgumentException_init(message.toString());\n }tmp$ = listOfNotNull([this.xVar_0, this.yVar_0]);\n tmp$_0 = listOfNotNull([this.xVar_0 != null ? this.xLevels_0 : null, this.yVar_0 != null ? this.yLevels_0 : null]);\n var dataByLevelTupleList = PlotFacets$Companion_getInstance().dataByLevelTuple_w4sfrb$(data, tmp$, tmp$_0);\n var dataByLevelTuple = toMap(dataByLevelTupleList);\n var $receiver = this.xLevels_0;\n var colLevels = $receiver.isEmpty() ? listOf(null) : $receiver;\n var $receiver_0 = this.yLevels_0;\n var rowLevels = $receiver_0.isEmpty() ? listOf(null) : $receiver_0;\n var dataByTile = ArrayList_init();\n tmp$_1 = rowLevels.iterator();\n while (tmp$_1.hasNext()) {\n var rowLevel = tmp$_1.next();\n tmp$_2 = colLevels.iterator();\n while (tmp$_2.hasNext()) {\n var colLevel = tmp$_2.next();\n var levelTuple = listOfNotNull([colLevel, rowLevel]);\n var tileData = getValue(dataByLevelTuple, levelTuple);\n dataByTile.add_11rb$(tileData);\n }\n }\n return dataByTile;\n };\n FacetGrid.prototype.tileInfos = function () {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3;\n var $receiver = this.xLevels_0;\n var $receiver_0 = $receiver.isEmpty() ? listOf(null) : $receiver;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver_0, 10));\n var tmp$_4;\n tmp$_4 = $receiver_0.iterator();\n while (tmp$_4.hasNext()) {\n var item = tmp$_4.next();\n destination.add_11rb$(item != null ? this.xFormatter_0(item) : null);\n }\n var colLabels = destination;\n var $receiver_1 = this.yLevels_0;\n var $receiver_2 = $receiver_1.isEmpty() ? listOf(null) : $receiver_1;\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault($receiver_2, 10));\n var tmp$_5;\n tmp$_5 = $receiver_2.iterator();\n while (tmp$_5.hasNext()) {\n var item_0 = tmp$_5.next();\n destination_0.add_11rb$(item_0 != null ? this.yFormatter_0(item_0) : null);\n }\n var rowLabels = destination_0;\n var infos = ArrayList_init();\n tmp$ = this.rowCount;\n for (var row = 0; row < tmp$; row++) {\n var addColLab = row === 0;\n var hasXAxis = row === (this.rowCount - 1 | 0);\n tmp$_0 = this.colCount;\n for (var col = 0; col < tmp$_0; col++) {\n var addRowLab = col === (this.colCount - 1 | 0);\n var hasYAxis = col === 0;\n if (addColLab) {\n tmp$_3 = (tmp$_2 = (tmp$_1 = colLabels.get_za3lpa$(col)) != null ? listOf(tmp$_1) : null) != null ? tmp$_2 : emptyList();\n } else {\n tmp$_3 = emptyList();\n }\n var colLabs = tmp$_3;\n infos.add_11rb$(new PlotFacets$FacetTileInfo(col, row, colLabs, addRowLab ? rowLabels.get_za3lpa$(row) : null, hasXAxis, hasYAxis, infos.size));\n }\n }\n return infos;\n };\n FacetGrid.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FacetGrid',\n interfaces: [PlotFacets]\n };\n var compareBy$lambda = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n var thenBy$lambda = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (this$thenBy, closure$selector) {\n return function (a, b) {\n var previousCompare = this$thenBy.compare(a, b);\n var tmp$;\n if (previousCompare !== 0)\n tmp$ = previousCompare;\n else {\n var selector = closure$selector;\n tmp$ = compareValues(selector(a), selector(b));\n }\n return tmp$;\n };\n };\n });\n function FacetWrap(facets, levels, nrow, ncol, direction, facetOrdering, facetFormatters) {\n FacetWrap$Companion_getInstance();\n PlotFacets.call(this);\n this.facets_0 = facets;\n this.nrow_0 = nrow;\n this.ncol_0 = ncol;\n this.direction_0 = direction;\n this.facetFormatters_0 = facetFormatters;\n this.isDefined_lws8hd$_0 = true;\n this.levels_0 = PlotFacets$Companion_getInstance().reorderLevels_dyo1lv$(this.facets_0, levels, facetOrdering);\n this.numTiles_a1ir1h$_0 = FacetWrap$Companion_getInstance().numTiles_0(this.facets_0, levels);\n this.shape_0 = FacetWrap$Companion_getInstance().shape_0(this.numTiles, this.ncol_0, this.nrow_0, this.direction_0);\n this.colCount_182vmd$_0 = this.shape_0.first;\n this.rowCount_1ks3v5$_0 = this.shape_0.second;\n this.variables_i11eyv$_0 = this.facets_0;\n }\n Object.defineProperty(FacetWrap.prototype, 'isDefined', {\n configurable: true,\n get: function () {\n return this.isDefined_lws8hd$_0;\n }\n });\n Object.defineProperty(FacetWrap.prototype, 'numTiles', {\n configurable: true,\n get: function () {\n return this.numTiles_a1ir1h$_0;\n }\n });\n Object.defineProperty(FacetWrap.prototype, 'colCount', {\n configurable: true,\n get: function () {\n return this.colCount_182vmd$_0;\n }\n });\n Object.defineProperty(FacetWrap.prototype, 'rowCount', {\n configurable: true,\n get: function () {\n return this.rowCount_1ks3v5$_0;\n }\n });\n Object.defineProperty(FacetWrap.prototype, 'variables', {\n configurable: true,\n get: function () {\n return this.variables_i11eyv$_0;\n }\n });\n FacetWrap.prototype.dataByTile_dhhkv7$ = function (data) {\n var tmp$;\n var dataByLevelTuple = PlotFacets$Companion_getInstance().dataByLevelTuple_w4sfrb$(data, this.variables, this.levels_0);\n var dataByTile = ArrayList_init();\n tmp$ = dataByLevelTuple.iterator();\n while (tmp$.hasNext()) {\n var tmp$_0 = tmp$.next();\n var tileData = tmp$_0.component2();\n dataByTile.add_11rb$(tileData);\n }\n return dataByTile;\n };\n function FacetWrap$tileInfos$toCol(this$FacetWrap) {\n return function (index) {\n var tmp$;\n switch (this$FacetWrap.direction_0.name) {\n case 'H':\n tmp$ = index % this$FacetWrap.colCount;\n break;\n case 'V':\n tmp$ = index / this$FacetWrap.rowCount | 0;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n }\n function FacetWrap$tileInfos$toRow(this$FacetWrap) {\n return function (index) {\n var tmp$;\n switch (this$FacetWrap.direction_0.name) {\n case 'H':\n tmp$ = index / this$FacetWrap.colCount | 0;\n break;\n case 'V':\n tmp$ = index % this$FacetWrap.rowCount;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n }\n function FacetWrap$tileInfos$toIndex(this$FacetWrap) {\n return function (col, row) {\n var tmp$;\n switch (this$FacetWrap.direction_0.name) {\n case 'H':\n tmp$ = Kotlin.imul(row, this$FacetWrap.colCount) + col | 0;\n break;\n case 'V':\n tmp$ = Kotlin.imul(col, this$FacetWrap.rowCount) + row | 0;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n }\n function FacetWrap$tileInfos$isBottom(closure$toIndex, this$FacetWrap) {\n return function (col, row) {\n var nextRowIndex = closure$toIndex(col, row + 1 | 0);\n return (row + 1 | 0) % this$FacetWrap.rowCount === 0 || nextRowIndex >= this$FacetWrap.numTiles;\n };\n }\n function FacetWrap$tileInfos$lambda(it) {\n return it.row;\n }\n function FacetWrap$tileInfos$lambda_0(it) {\n return it.col;\n }\n FacetWrap.prototype.tileInfos = function () {\n var levelTuples = PlotFacets$Companion_getInstance().createNameLevelTuples_5cxrh4$(this.facets_0, this.levels_0);\n var destination = ArrayList_init_0(collectionSizeOrDefault(levelTuples, 10));\n var tmp$;\n tmp$ = levelTuples.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_0 = destination.add_11rb$;\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(item, 10));\n var tmp$_1;\n tmp$_1 = item.iterator();\n while (tmp$_1.hasNext()) {\n var item_0 = tmp$_1.next();\n destination_0.add_11rb$(item_0.second);\n }\n tmp$_0.call(destination, destination_0);\n }\n var destination_1 = ArrayList_init_0(collectionSizeOrDefault(destination, 10));\n var tmp$_2;\n tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var item_1 = tmp$_2.next();\n var tmp$_3 = destination_1.add_11rb$;\n var destination_2 = ArrayList_init_0(collectionSizeOrDefault(item_1, 10));\n var tmp$_4, tmp$_0_0;\n var index = 0;\n tmp$_4 = item_1.iterator();\n while (tmp$_4.hasNext()) {\n var item_2 = tmp$_4.next();\n destination_2.add_11rb$(this.facetFormatters_0.get_za3lpa$(checkIndexOverflow((tmp$_0_0 = index, index = tmp$_0_0 + 1 | 0, tmp$_0_0)))(item_2));\n }\n tmp$_3.call(destination_1, destination_2);\n }\n var tileLabels = destination_1;\n var toCol = FacetWrap$tileInfos$toCol(this);\n var toRow = FacetWrap$tileInfos$toRow(this);\n var toIndex = FacetWrap$tileInfos$toIndex(this);\n var isBottom = FacetWrap$tileInfos$isBottom(toIndex, this);\n var infos = ArrayList_init();\n var i = 0;\n for (var tmp$_5 = tileLabels.iterator(); tmp$_5.hasNext(); ++i) {\n var tileLabelTuple = tmp$_5.next();\n var col = toCol(i);\n var row = toRow(i);\n var hasXAxis = isBottom(col, row);\n var hasYAxis = col === 0;\n infos.add_11rb$(new PlotFacets$FacetTileInfo(col, row, tileLabelTuple, null, hasXAxis, hasYAxis, i));\n }\n return sortedWith(infos, new Comparator(thenBy$lambda(new Comparator(compareBy$lambda(FacetWrap$tileInfos$lambda)), FacetWrap$tileInfos$lambda_0)));\n };\n function FacetWrap$Direction(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function FacetWrap$Direction_initFields() {\n FacetWrap$Direction_initFields = function () {\n };\n FacetWrap$Direction$H_instance = new FacetWrap$Direction('H', 0);\n FacetWrap$Direction$V_instance = new FacetWrap$Direction('V', 1);\n }\n var FacetWrap$Direction$H_instance;\n function FacetWrap$Direction$H_getInstance() {\n FacetWrap$Direction_initFields();\n return FacetWrap$Direction$H_instance;\n }\n var FacetWrap$Direction$V_instance;\n function FacetWrap$Direction$V_getInstance() {\n FacetWrap$Direction_initFields();\n return FacetWrap$Direction$V_instance;\n }\n FacetWrap$Direction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Direction',\n interfaces: [Enum]\n };\n function FacetWrap$Direction$values() {\n return [FacetWrap$Direction$H_getInstance(), FacetWrap$Direction$V_getInstance()];\n }\n FacetWrap$Direction.values = FacetWrap$Direction$values;\n function FacetWrap$Direction$valueOf(name) {\n switch (name) {\n case 'H':\n return FacetWrap$Direction$H_getInstance();\n case 'V':\n return FacetWrap$Direction$V_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.assemble.facet.FacetWrap.Direction.' + name);\n }\n }\n FacetWrap$Direction.valueOf_61zpoe$ = FacetWrap$Direction$valueOf;\n function FacetWrap$Companion() {\n FacetWrap$Companion_instance = this;\n }\n FacetWrap$Companion.prototype.numTiles_0 = function (facets, levels) {\n if (!!facets.isEmpty()) {\n var message = 'List of facets is empty.';\n throw IllegalArgumentException_init(message.toString());\n }if (!(distinct(facets).size === facets.size)) {\n var message_0 = 'Duplicated values in the facets list: ' + facets;\n throw IllegalArgumentException_init(message_0.toString());\n }if (!(facets.size === levels.size)) {\n var message_1 = 'Check failed.';\n throw IllegalStateException_init(message_1.toString());\n }return PlotFacets$Companion_getInstance().createNameLevelTuples_5cxrh4$(facets, levels).size;\n };\n function FacetWrap$Companion$shape$lambda(closure$ncol) {\n return function () {\n return \"'ncol' must be positive, was \" + toString(closure$ncol);\n };\n }\n function FacetWrap$Companion$shape$lambda_0(closure$nrow) {\n return function () {\n return \"'nrow' must be positive, was \" + toString(closure$nrow);\n };\n }\n FacetWrap$Companion.prototype.shape_0 = function (tilesCount, ncol, nrow, dir) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (!((tmp$ = ncol != null ? ncol > 0 : null) != null ? tmp$ : true)) {\n var message = FacetWrap$Companion$shape$lambda(ncol)();\n throw IllegalArgumentException_init(message.toString());\n }if (!((tmp$_0 = nrow != null ? nrow > 0 : null) != null ? tmp$_0 : true)) {\n var message_0 = FacetWrap$Companion$shape$lambda_0(nrow)();\n throw IllegalArgumentException_init(message_0.toString());\n }if (ncol != null) {\n var ncolActual = JsMath.min(ncol, tilesCount);\n var x = tilesCount / ncolActual;\n var nrowActual = numberToInt(JsMath.ceil(x));\n tmp$_1 = to(ncolActual, JsMath.max(1, nrowActual));\n } else if (nrow != null) {\n var nrowActual_0 = JsMath.min(nrow, tilesCount);\n var x_0 = tilesCount / nrowActual_0;\n var ncolActual_0 = numberToInt(JsMath.ceil(x_0));\n tmp$_1 = to(ncolActual_0, JsMath.max(1, nrowActual_0));\n } else {\n var b = tilesCount / 2 | 0;\n var b_0 = JsMath.max(1, b);\n var w = JsMath.min(4, b_0);\n var x_1 = tilesCount / w;\n var b_1 = numberToInt(JsMath.ceil(x_1));\n var h = JsMath.max(1, b_1);\n tmp$_1 = to(w, h);\n }\n var shape = tmp$_1;\n var w_0 = shape.component1()\n , h_0 = shape.component2();\n switch (dir.name) {\n case 'H':\n var x_2 = tilesCount / w_0;\n tmp$_2 = new Pair_0(w_0, numberToInt(JsMath.ceil(x_2)));\n break;\n case 'V':\n var x_3 = tilesCount / h_0;\n tmp$_2 = new Pair_0(numberToInt(JsMath.ceil(x_3)), h_0);\n break;\n default:tmp$_2 = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$_2;\n };\n FacetWrap$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var FacetWrap$Companion_instance = null;\n function FacetWrap$Companion_getInstance() {\n if (FacetWrap$Companion_instance === null) {\n new FacetWrap$Companion();\n }return FacetWrap$Companion_instance;\n }\n FacetWrap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FacetWrap',\n interfaces: [PlotFacets]\n };\n function DefaultSampling() {\n DefaultSampling_instance = this;\n this.SEED_0 = L37;\n this.SAFETY_SAMPLING = Samplings_getInstance().random_280ow0$(200000, this.SEED_0);\n this.POINT = Samplings_getInstance().random_280ow0$(50000, this.SEED_0);\n this.TILE = Samplings_getInstance().random_280ow0$(50000, this.SEED_0);\n this.BIN_2D = this.TILE;\n this.AB_LINE = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.H_LINE = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.V_LINE = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.JITTER = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.RECT = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.SEGMENT = Samplings_getInstance().random_280ow0$(5000, this.SEED_0);\n this.TEXT = Samplings_getInstance().random_280ow0$(500, this.SEED_0);\n this.ERROR_BAR = Samplings_getInstance().random_280ow0$(500, this.SEED_0);\n this.CROSS_BAR = Samplings_getInstance().random_280ow0$(500, this.SEED_0);\n this.LINE_RANGE = Samplings_getInstance().random_280ow0$(500, this.SEED_0);\n this.POINT_RANGE = Samplings_getInstance().random_280ow0$(500, this.SEED_0);\n this.BAR = Samplings_getInstance().pick_za3lpa$(50);\n this.HISTOGRAM = Samplings_getInstance().systematic_za3lpa$(500);\n this.LINE = Samplings_getInstance().systematic_za3lpa$(5000);\n this.RIBBON = Samplings_getInstance().systematic_za3lpa$(5000);\n this.AREA = Samplings_getInstance().systematic_za3lpa$(5000);\n this.DENSITY = Samplings_getInstance().systematic_za3lpa$(5000);\n this.FREQPOLY = Samplings_getInstance().systematic_za3lpa$(5000);\n this.STEP = Samplings_getInstance().systematic_za3lpa$(5000);\n this.PATH = Samplings_getInstance().vertexDp_za3lpa$(20000);\n this.POLYGON = Samplings_getInstance().vertexDp_za3lpa$(20000);\n this.MAP = Samplings_getInstance().vertexDp_za3lpa$(20000);\n this.SMOOTH = Samplings_getInstance().systematicGroup_za3lpa$(200);\n this.CONTOUR = Samplings_getInstance().systematicGroup_za3lpa$(200);\n this.CONTOURF = Samplings_getInstance().systematicGroup_za3lpa$(200);\n this.DENSITY2D = Samplings_getInstance().systematicGroup_za3lpa$(200);\n this.DENSITY2DF = Samplings_getInstance().systematicGroup_za3lpa$(200);\n }\n DefaultSampling.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DefaultSampling',\n interfaces: []\n };\n var DefaultSampling_instance = null;\n function DefaultSampling_getInstance() {\n if (DefaultSampling_instance === null) {\n new DefaultSampling();\n }return DefaultSampling_instance;\n }\n function GeomProvider(geomKind) {\n GeomProvider$Companion_getInstance();\n this.geomKind = geomKind;\n }\n Object.defineProperty(GeomProvider.prototype, 'preferredCoordinateSystem', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('No preferred coordinate system');\n }\n });\n GeomProvider.prototype.renders = function () {\n return base_0.GeomMeta.renders_7dhqpi$(this.geomKind);\n };\n function GeomProvider$GeomProviderBuilder(myKind, myAestheticsDefaults, myHandlesGroups, myGeomSupplier) {\n this.myKind_0 = myKind;\n this.myAestheticsDefaults_0 = myAestheticsDefaults;\n this.myHandlesGroups_0 = myHandlesGroups;\n this.myGeomSupplier_0 = myGeomSupplier;\n }\n function GeomProvider$GeomProviderBuilder$build$ObjectLiteral(this$GeomProviderBuilder, geomKind) {\n this.this$GeomProviderBuilder = this$GeomProviderBuilder;\n GeomProvider.call(this, geomKind);\n }\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.prototype.createGeom = function () {\n return this.this$GeomProviderBuilder.myGeomSupplier_0();\n };\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.prototype.aestheticsDefaults = function () {\n return this.this$GeomProviderBuilder.myAestheticsDefaults_0;\n };\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.prototype.handlesGroups = function () {\n return this.this$GeomProviderBuilder.myHandlesGroups_0;\n };\n GeomProvider$GeomProviderBuilder$build$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [GeomProvider]\n };\n GeomProvider$GeomProviderBuilder.prototype.build_8be2vx$ = function () {\n return new GeomProvider$GeomProviderBuilder$build$ObjectLiteral(this, this.myKind_0);\n };\n GeomProvider$GeomProviderBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomProviderBuilder',\n interfaces: []\n };\n function GeomProvider$Companion() {\n GeomProvider$Companion_instance = this;\n }\n function GeomProvider$Companion$point$lambda() {\n return new PointGeom();\n }\n GeomProvider$Companion.prototype.point = function () {\n return this.point_8j1y0m$(GeomProvider$Companion$point$lambda);\n };\n GeomProvider$Companion.prototype.point_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.POINT, AestheticsDefaults.Companion.point(), PointGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$path$lambda() {\n return new PathGeom();\n }\n GeomProvider$Companion.prototype.path = function () {\n return this.path_8j1y0m$(GeomProvider$Companion$path$lambda);\n };\n GeomProvider$Companion.prototype.path_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.PATH, AestheticsDefaults.Companion.path(), PathGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$line$lambda() {\n return new LineGeom();\n }\n GeomProvider$Companion.prototype.line = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.LINE, AestheticsDefaults.Companion.line(), LineGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$line$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$smooth$lambda() {\n return new SmoothGeom();\n }\n GeomProvider$Companion.prototype.smooth = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.SMOOTH, AestheticsDefaults.Companion.smooth(), SmoothGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$smooth$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$bar$lambda() {\n return new BarGeom();\n }\n GeomProvider$Companion.prototype.bar = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.BAR, AestheticsDefaults.Companion.bar(), BarGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$bar$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$histogram$lambda() {\n return new HistogramGeom();\n }\n GeomProvider$Companion.prototype.histogram = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.HISTOGRAM, AestheticsDefaults.Companion.histogram(), HistogramGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$histogram$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$tile$lambda() {\n return new TileGeom();\n }\n GeomProvider$Companion.prototype.tile = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.TILE, AestheticsDefaults.Companion.tile(), TileGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$tile$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$bin2d$lambda() {\n return new Bin2dGeom();\n }\n GeomProvider$Companion.prototype.bin2d = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.BIN_2D, AestheticsDefaults.Companion.bin2d(), Bin2dGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$bin2d$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$errorBar$lambda() {\n return new ErrorBarGeom();\n }\n GeomProvider$Companion.prototype.errorBar = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.ERROR_BAR, AestheticsDefaults.Companion.errorBar(), ErrorBarGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$errorBar$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.crossBar_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.CROSS_BAR, AestheticsDefaults.Companion.crossBar(), CrossBarGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$lineRange$lambda() {\n return new LineRangeGeom();\n }\n GeomProvider$Companion.prototype.lineRange = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.LINE_RANGE, AestheticsDefaults.Companion.lineRange(), LineRangeGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$lineRange$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.pointRange_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.POINT_RANGE, AestheticsDefaults.Companion.pointRange(), PointRangeGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$contour$lambda() {\n return new ContourGeom();\n }\n GeomProvider$Companion.prototype.contour = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.CONTOUR, AestheticsDefaults.Companion.contour(), ContourGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$contour$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$contourf$lambda() {\n return new ContourfGeom();\n }\n GeomProvider$Companion.prototype.contourf = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.CONTOURF, AestheticsDefaults.Companion.contourf(), ContourfGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$contourf$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$polygon$lambda() {\n return new PolygonGeom();\n }\n GeomProvider$Companion.prototype.polygon = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.POLYGON, AestheticsDefaults.Companion.polygon(), PolygonGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$polygon$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$map$lambda() {\n return new MapGeom();\n }\n GeomProvider$Companion.prototype.map = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.MAP, AestheticsDefaults.Companion.map(), MapGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$map$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$abline$lambda() {\n return new ABLineGeom();\n }\n GeomProvider$Companion.prototype.abline = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.AB_LINE, AestheticsDefaults.Companion.abline(), ABLineGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$abline$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$hline$lambda() {\n return new HLineGeom();\n }\n GeomProvider$Companion.prototype.hline = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.H_LINE, AestheticsDefaults.Companion.hline(), HLineGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$hline$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$vline$lambda() {\n return new VLineGeom();\n }\n GeomProvider$Companion.prototype.vline = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.V_LINE, AestheticsDefaults.Companion.vline(), VLineGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$vline$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.boxplot_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.BOX_PLOT, AestheticsDefaults.Companion.boxplot(), BoxplotGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$livemap$lambda(closure$options) {\n return function () {\n return new LiveMapGeom(closure$options.displayMode);\n };\n }\n GeomProvider$Companion.prototype.livemap_d2y5pu$ = function (options) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.LIVE_MAP, AestheticsDefaults.Companion.livemap_cx3y7u$(options.displayMode), LiveMapGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$livemap$lambda(options))).build_8be2vx$();\n };\n function GeomProvider$Companion$ribbon$lambda() {\n return new RibbonGeom();\n }\n GeomProvider$Companion.prototype.ribbon = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.RIBBON, AestheticsDefaults.Companion.ribbon(), RibbonGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$ribbon$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$area$lambda() {\n return new AreaGeom();\n }\n GeomProvider$Companion.prototype.area = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.AREA, AestheticsDefaults.Companion.area(), AreaGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$area$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$density$lambda() {\n return new DensityGeom();\n }\n GeomProvider$Companion.prototype.density = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.DENSITY, AestheticsDefaults.Companion.density(), DensityGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$density$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$density2d$lambda() {\n return new Density2dGeom();\n }\n GeomProvider$Companion.prototype.density2d = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.DENSITY2D, AestheticsDefaults.Companion.density2d(), Density2dGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$density2d$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$density2df$lambda() {\n return new Density2dfGeom();\n }\n GeomProvider$Companion.prototype.density2df = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.DENSITY2DF, AestheticsDefaults.Companion.density2df(), Density2dfGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$density2df$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$jitter$lambda() {\n return new JitterGeom();\n }\n GeomProvider$Companion.prototype.jitter = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.JITTER, AestheticsDefaults.Companion.jitter(), JitterGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$jitter$lambda)).build_8be2vx$();\n };\n function GeomProvider$Companion$freqpoly$lambda() {\n return new FreqpolyGeom();\n }\n GeomProvider$Companion.prototype.freqpoly = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.FREQPOLY, AestheticsDefaults.Companion.freqpoly(), FreqpolyGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$freqpoly$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.step_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.STEP, AestheticsDefaults.Companion.step(), StepGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$rect$lambda() {\n return new RectGeom();\n }\n GeomProvider$Companion.prototype.rect = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.RECT, AestheticsDefaults.Companion.rect(), RectGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$rect$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.segment_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.SEGMENT, AestheticsDefaults.Companion.segment(), SegmentGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.text_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.TEXT, AestheticsDefaults.Companion.text(), TextGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n function GeomProvider$Companion$raster$lambda() {\n return new RasterGeom();\n }\n GeomProvider$Companion.prototype.raster = function () {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.RASTER, AestheticsDefaults.Companion.raster(), RasterGeom.Companion.HANDLES_GROUPS, GeomProvider$Companion$raster$lambda)).build_8be2vx$();\n };\n GeomProvider$Companion.prototype.image_8j1y0m$ = function (supplier) {\n return (new GeomProvider$GeomProviderBuilder(GeomKind.IMAGE, AestheticsDefaults.Companion.image(), ImageGeom.Companion.HANDLES_GROUPS, supplier)).build_8be2vx$();\n };\n GeomProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomProvider$Companion_instance = null;\n function GeomProvider$Companion_getInstance() {\n if (GeomProvider$Companion_instance === null) {\n new GeomProvider$Companion();\n }return GeomProvider$Companion_instance;\n }\n GeomProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomProvider',\n interfaces: []\n };\n function PointDataAccess(data, bindings, scaleMap) {\n this.data_0 = data;\n this.mappedAes_tolgcu$_0 = HashSet_init(bindings.keys);\n this.scaleByAes_c9kkhw$_0 = PointDataAccess$scaleByAes$lambda(scaleMap);\n this.myBindings_0 = toMap_0(bindings);\n this.myFormatters_0 = HashMap_init();\n }\n Object.defineProperty(PointDataAccess.prototype, 'mappedAes', {\n configurable: true,\n get: function () {\n return this.mappedAes_tolgcu$_0;\n }\n });\n Object.defineProperty(PointDataAccess.prototype, 'scaleByAes', {\n configurable: true,\n get: function () {\n return this.scaleByAes_c9kkhw$_0;\n }\n });\n PointDataAccess.prototype.isMapped_896ixz$ = function (aes) {\n return this.myBindings_0.containsKey_11rb$(aes);\n };\n PointDataAccess.prototype.getMappedData_pkitv1$ = function (aes, index) {\n var originalValue = this.getOriginalValue_pkitv1$(aes, index);\n var scale = this.getScale_0(aes);\n var value = this.formatter_0(aes)(originalValue);\n return new MappedDataAccess$MappedData(scale.name, value, scale.isContinuous);\n };\n PointDataAccess.prototype.getOriginalValue_pkitv1$ = function (aes, index) {\n if (!this.isMapped_896ixz$(aes)) {\n var message = 'Not mapped: ' + aes;\n throw IllegalArgumentException_init(message.toString());\n }var binding = getValue(this.myBindings_0, aes);\n var scale = this.getScale_0(aes);\n var value = this.data_0.getNumeric_8xm3sj$(binding.variable).get_za3lpa$(index);\n return scale.transform.applyInverse_yrwdxb$(value);\n };\n PointDataAccess.prototype.getMappedDataLabel_896ixz$ = function (aes) {\n return this.getScale_0(aes).name;\n };\n PointDataAccess.prototype.isMappedDataContinuous_896ixz$ = function (aes) {\n return this.getScale_0(aes).isContinuous;\n };\n PointDataAccess.prototype.getScale_0 = function (aes) {\n return this.scaleByAes(aes);\n };\n PointDataAccess.prototype.formatter_0 = function (aes) {\n var scale = this.getScale_0(aes);\n var $receiver = this.myFormatters_0;\n var tmp$;\n var value = $receiver.get_11rb$(aes);\n if (value == null) {\n var answer = this.createFormatter_0(aes, scale);\n $receiver.put_xwzc9p$(aes, answer);\n tmp$ = answer;\n } else {\n tmp$ = value;\n }\n return tmp$;\n };\n function PointDataAccess$createFormatter$lambda(closure$formatter) {\n return function (value) {\n var tmp$;\n var tmp$_0;\n tmp$_0 = value != null ? closure$formatter(value) : null;\n return (tmp$ = tmp$_0) != null ? tmp$ : 'n/a';\n };\n }\n function PointDataAccess$createFormatter$lambda_0(closure$labelsMap) {\n return function (value) {\n var tmp$;\n var tmp$_0;\n tmp$_0 = value != null ? getValue(closure$labelsMap, value) : null;\n return (tmp$ = tmp$_0) != null ? tmp$ : 'n/a';\n };\n }\n PointDataAccess.prototype.createFormatter_0 = function (aes, scale_0) {\n if (scale_0.isContinuousDomain) {\n var $receiver = getValue(this.myBindings_0, aes).variable;\n var $receiver_0 = getCallableRef('range', function ($receiver, p1) {\n return $receiver.range_8xm3sj$(p1);\n }.bind(null, this.data_0))($receiver);\n var domain = data_0.SeriesUtil.ensureApplicableRange_4am1sd$($receiver_0);\n var formatter = scale_0.getBreaksGenerator().labelFormatter_1tlvto$(domain, 100);\n return PointDataAccess$createFormatter$lambda(formatter);\n } else {\n var labelsMap = scale.ScaleUtil.labelByBreak_x4zrm4$(scale_0);\n return PointDataAccess$createFormatter$lambda_0(labelsMap);\n }\n };\n function PointDataAccess$scaleByAes$lambda(closure$scaleMap) {\n return function (it) {\n return closure$scaleMap.get_31786j$(it);\n };\n }\n PointDataAccess.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointDataAccess',\n interfaces: [MappedDataAccess]\n };\n function CartesianCoordProvider(xLim, yLim) {\n CoordProviderBase.call(this, xLim, yLim);\n }\n CartesianCoordProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CartesianCoordProvider',\n interfaces: [CoordProviderBase]\n };\n function CoordProvider() {\n }\n CoordProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'CoordProvider',\n interfaces: []\n };\n function CoordProviderBase(xLim, yLim) {\n CoordProviderBase$Companion_getInstance();\n this.xLim_0 = xLim;\n this.yLim_0 = yLim;\n }\n CoordProviderBase.prototype.buildAxisScaleX_ny58zc$ = function (scaleProto, domain, axisLength, breaks) {\n return CoordProviderBase$Companion_getInstance().buildAxisScaleDefault_0(scaleProto, domain, axisLength, breaks);\n };\n CoordProviderBase.prototype.buildAxisScaleY_ny58zc$ = function (scaleProto, domain, axisLength, breaks) {\n return CoordProviderBase$Companion_getInstance().buildAxisScaleDefault_0(scaleProto, domain, axisLength, breaks);\n };\n CoordProviderBase.prototype.createCoordinateSystem_uncllg$ = function (xDomain, xAxisLength, yDomain, yAxisLength) {\n var tmp$, tmp$_0;\n var mapperX = CoordProviderBase$Companion_getInstance().linearMapper_mdyssk$(xDomain, xAxisLength);\n var mapperY = CoordProviderBase$Companion_getInstance().linearMapper_mdyssk$(yDomain, yAxisLength);\n return coord.Coords.create_wd6eaa$(scale.MapperUtil.map_rejkqi$(xDomain, mapperX), scale.MapperUtil.map_rejkqi$(yDomain, mapperY), (tmp$ = this.xLim_0) != null ? scale.MapperUtil.map_rejkqi$(tmp$, mapperX) : null, (tmp$_0 = this.yLim_0) != null ? scale.MapperUtil.map_rejkqi$(tmp$_0, mapperY) : null);\n };\n CoordProviderBase.prototype.adjustDomains_jz8wgn$ = function (xDomain, yDomain, displaySize) {\n var tmp$, tmp$_0;\n return new Pair((tmp$ = this.xLim_0) != null ? tmp$ : xDomain, (tmp$_0 = this.yLim_0) != null ? tmp$_0 : yDomain);\n };\n function CoordProviderBase$Companion() {\n CoordProviderBase$Companion_instance = this;\n }\n CoordProviderBase$Companion.prototype.linearMapper_mdyssk$ = function (domain, axisLength) {\n return scale.Mappers.mul_mdyssk$(domain, axisLength);\n };\n CoordProviderBase$Companion.prototype.buildAxisScaleDefault_0 = function (scaleProto, domain, axisLength, breaks) {\n return this.buildAxisScaleDefault_82iy2c$(scaleProto, this.linearMapper_mdyssk$(domain, axisLength), breaks);\n };\n CoordProviderBase$Companion.prototype.buildAxisScaleDefault_82iy2c$ = function (scaleProto, axisMapper, breaks) {\n return scaleProto.with().breaks_pqjuzw$(breaks.domainValues).labels_mhpeer$(breaks.labels).mapper_1uitho$(axisMapper).build();\n };\n CoordProviderBase$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var CoordProviderBase$Companion_instance = null;\n function CoordProviderBase$Companion_getInstance() {\n if (CoordProviderBase$Companion_instance === null) {\n new CoordProviderBase$Companion();\n }return CoordProviderBase$Companion_instance;\n }\n CoordProviderBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CoordProviderBase',\n interfaces: [CoordProvider]\n };\n function CoordProviders() {\n CoordProviders_instance = this;\n }\n CoordProviders.prototype.cartesian_t7esj2$ = function (xLim, yLim) {\n if (xLim === void 0)\n xLim = null;\n if (yLim === void 0)\n yLim = null;\n return new CartesianCoordProvider(xLim, yLim);\n };\n CoordProviders.prototype.fixed_vvp5j4$ = function (ratio, xLim, yLim) {\n if (xLim === void 0)\n xLim = null;\n if (yLim === void 0)\n yLim = null;\n return new FixedRatioCoordProvider(ratio, xLim, yLim);\n };\n CoordProviders.prototype.map_t7esj2$ = function (xLim, yLim) {\n if (xLim === void 0)\n xLim = null;\n if (yLim === void 0)\n yLim = null;\n return new ProjectionCoordProvider(new MercatorProjectionX(), new MercatorProjectionY(), xLim, yLim);\n };\n CoordProviders.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'CoordProviders',\n interfaces: []\n };\n var CoordProviders_instance = null;\n function CoordProviders_getInstance() {\n if (CoordProviders_instance === null) {\n new CoordProviders();\n }return CoordProviders_instance;\n }\n function FixedRatioCoordProvider(ratio, xLim, yLim) {\n CoordProviderBase.call(this, xLim, yLim);\n this.ratio_0 = ratio;\n }\n FixedRatioCoordProvider.prototype.adjustDomains_jz8wgn$ = function (xDomain, yDomain, displaySize) {\n var adjusted = CoordProviderBase.prototype.adjustDomains_jz8wgn$.call(this, xDomain, yDomain, displaySize);\n var xDomain_0 = adjusted.first;\n var yDomain_0 = adjusted.second;\n var spanX = data_0.SeriesUtil.span_4fzjta$(xDomain_0);\n var spanY = data_0.SeriesUtil.span_4fzjta$(yDomain_0);\n if (spanX < data_0.SeriesUtil.TINY || spanY < data_0.SeriesUtil.TINY) {\n return new Pair(xDomain_0, yDomain_0);\n }var displayW = displaySize.x;\n var displayH = displaySize.y;\n if (this.ratio_0 > 1) {\n displayW *= this.ratio_0;\n } else {\n displayH *= 1 / this.ratio_0;\n }\n var ratioX = spanX / displayW;\n var ratioY = spanY / displayH;\n if (ratioX > ratioY) {\n var spanAdjusted = displayH * ratioX;\n yDomain_0 = data_0.SeriesUtil.expand_mdyssk$(yDomain_0, spanAdjusted);\n } else {\n var spanAdjusted_0 = displayW * ratioY;\n xDomain_0 = data_0.SeriesUtil.expand_mdyssk$(xDomain_0, spanAdjusted_0);\n }\n return new Pair(xDomain_0, yDomain_0);\n };\n FixedRatioCoordProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FixedRatioCoordProvider',\n interfaces: [CoordProviderBase]\n };\n function ProjectionCoordProvider(projectionX, projectionY, xLim, yLim) {\n ProjectionCoordProvider$Companion_getInstance();\n CoordProviderBase.call(this, xLim, yLim);\n this.projectionX_0 = projectionX;\n this.projectionY_0 = projectionY;\n }\n ProjectionCoordProvider.prototype.adjustDomains_jz8wgn$ = function (xDomain, yDomain, displaySize) {\n var tmp$;\n var adjusted = CoordProviderBase.prototype.adjustDomains_jz8wgn$.call(this, xDomain, yDomain, displaySize);\n var xDomain_0 = this.projectionX_0.toValidDomain_4fzjta$(adjusted.first);\n var yDomain_0 = this.projectionY_0.toValidDomain_4fzjta$(adjusted.second);\n var spanX = data_0.SeriesUtil.span_4fzjta$(xDomain_0);\n var spanY = data_0.SeriesUtil.span_4fzjta$(yDomain_0);\n if (spanX > spanY) {\n var center = xDomain_0.lowerEnd + spanX / 2;\n var halfSpan = spanY / 2;\n tmp$ = new Pair(new ClosedRange(center - halfSpan, center + halfSpan), yDomain_0);\n } else {\n var center_0 = yDomain_0.lowerEnd + spanY / 2;\n var halfSpan_0 = spanX / 2;\n tmp$ = new Pair(xDomain_0, new ClosedRange(center_0 - halfSpan_0, center_0 + halfSpan_0));\n }\n var domainSquare = tmp$;\n var projectedXMin = this.projectionX_0.apply_14dthe$(domainSquare.first.lowerEnd);\n var projectedXMax = this.projectionX_0.apply_14dthe$(domainSquare.first.upperEnd);\n var projectedYMin = this.projectionY_0.apply_14dthe$(domainSquare.second.lowerEnd);\n var projectedYMax = this.projectionY_0.apply_14dthe$(domainSquare.second.upperEnd);\n var ratio = (projectedYMax - projectedYMin) / (projectedXMax - projectedXMin);\n var fixedCoord = new FixedRatioCoordProvider(ratio, null, null);\n return fixedCoord.adjustDomains_jz8wgn$(xDomain_0, yDomain_0, displaySize);\n };\n ProjectionCoordProvider.prototype.buildAxisScaleX_ny58zc$ = function (scaleProto, domain, axisLength, breaks) {\n var tmp$;\n if (this.projectionX_0.nonlinear) {\n tmp$ = ProjectionCoordProvider$Companion_getInstance().buildAxisScaleWithProjection_0(this.projectionX_0, scaleProto, domain, axisLength, breaks);\n } else {\n tmp$ = CoordProviderBase.prototype.buildAxisScaleX_ny58zc$.call(this, scaleProto, domain, axisLength, breaks);\n }\n return tmp$;\n };\n ProjectionCoordProvider.prototype.buildAxisScaleY_ny58zc$ = function (scaleProto, domain, axisLength, breaks) {\n var tmp$;\n if (this.projectionY_0.nonlinear) {\n tmp$ = ProjectionCoordProvider$Companion_getInstance().buildAxisScaleWithProjection_0(this.projectionY_0, scaleProto, domain, axisLength, breaks);\n } else {\n tmp$ = CoordProviderBase.prototype.buildAxisScaleY_ny58zc$.call(this, scaleProto, domain, axisLength, breaks);\n }\n return tmp$;\n };\n function ProjectionCoordProvider$Companion() {\n ProjectionCoordProvider$Companion_instance = this;\n }\n ProjectionCoordProvider$Companion.prototype.buildAxisScaleWithProjection_0 = function (projection, scaleProto, domain, axisLength, breaks) {\n var validDomain = projection.toValidDomain_4fzjta$(domain);\n var validDomainProjected = new ClosedRange(projection.apply_14dthe$(validDomain.lowerEnd), projection.apply_14dthe$(validDomain.upperEnd));\n var projectionInverse = scale.Mappers.linear_1jkouz$(validDomainProjected, validDomain);\n var linearMapper = CoordProviderBase$Companion_getInstance().linearMapper_mdyssk$(domain, axisLength);\n var scaleMapper = this.twistScaleMapper_0(projection, projectionInverse, linearMapper);\n var validBreaks = this.validateBreaks_0(validDomain, breaks);\n return CoordProviderBase$Companion_getInstance().buildAxisScaleDefault_82iy2c$(scaleProto, scaleMapper, validBreaks);\n };\n ProjectionCoordProvider$Companion.prototype.validateBreaks_0 = function (validDomain, breaks) {\n var tmp$;\n var validIndices = ArrayList_init();\n var i = 0;\n tmp$ = breaks.domainValues.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (typeof v === 'number' && validDomain.contains_mef7kx$(v)) {\n validIndices.add_11rb$(i);\n }i = i + 1 | 0;\n }\n if (validIndices.size === breaks.domainValues.size) {\n return breaks;\n }var validDomainValues = data_0.SeriesUtil.pickAtIndices_ge51dg$(breaks.domainValues, validIndices);\n var validLabels = data_0.SeriesUtil.pickAtIndices_ge51dg$(breaks.labels, validIndices);\n var validTransformedValues = data_0.SeriesUtil.pickAtIndices_ge51dg$(breaks.transformedValues, validIndices);\n return new ScaleBreaks(validDomainValues, validTransformedValues, validLabels);\n };\n function ProjectionCoordProvider$Companion$twistScaleMapper$lambda(closure$projection, closure$projectionInverse, closure$scaleMapper) {\n return function (v) {\n var tmp$;\n if (v != null) {\n var closure$projection_0 = closure$projection;\n var closure$projectionInverse_0 = closure$projectionInverse;\n var closure$scaleMapper_0 = closure$scaleMapper;\n var projected = closure$projection_0.apply_14dthe$(v);\n var unProjected = closure$projectionInverse_0(projected);\n tmp$ = closure$scaleMapper_0(unProjected);\n } else\n tmp$ = null;\n return tmp$;\n };\n }\n ProjectionCoordProvider$Companion.prototype.twistScaleMapper_0 = function (projection, projectionInverse, scaleMapper) {\n return ProjectionCoordProvider$Companion$twistScaleMapper$lambda(projection, projectionInverse, scaleMapper);\n };\n ProjectionCoordProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ProjectionCoordProvider$Companion_instance = null;\n function ProjectionCoordProvider$Companion_getInstance() {\n if (ProjectionCoordProvider$Companion_instance === null) {\n new ProjectionCoordProvider$Companion();\n }return ProjectionCoordProvider$Companion_instance;\n }\n ProjectionCoordProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ProjectionCoordProvider',\n interfaces: [CoordProviderBase]\n };\n function MercatorProjectionX() {\n this.nonlinear_z5go4f$_0 = false;\n }\n Object.defineProperty(MercatorProjectionX.prototype, 'nonlinear', {\n configurable: true,\n get: function () {\n return this.nonlinear_z5go4f$_0;\n }\n });\n MercatorProjectionX.prototype.apply_14dthe$ = function (v) {\n return spatial.MercatorUtils.getMercatorX_14dthe$(v);\n };\n MercatorProjectionX.prototype.toValidDomain_4fzjta$ = function (domain) {\n return domain;\n };\n MercatorProjectionX.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MercatorProjectionX',\n interfaces: [Projection]\n };\n function MercatorProjectionY() {\n this.nonlinear_x0lz9c$_0 = true;\n }\n Object.defineProperty(MercatorProjectionY.prototype, 'nonlinear', {\n configurable: true,\n get: function () {\n return this.nonlinear_x0lz9c$_0;\n }\n });\n MercatorProjectionY.prototype.apply_14dthe$ = function (v) {\n return spatial.MercatorUtils.getMercatorY_14dthe$(v);\n };\n MercatorProjectionY.prototype.toValidDomain_4fzjta$ = function (domain) {\n if (spatial.MercatorUtils.VALID_LATITUDE_RANGE.isConnected_d226ot$(domain)) {\n return spatial.MercatorUtils.VALID_LATITUDE_RANGE.intersection_d226ot$(domain);\n }throw IllegalArgumentException_init('Illegal latitude range for mercator projection: ' + domain);\n };\n MercatorProjectionY.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MercatorProjectionY',\n interfaces: [Projection]\n };\n function DataProcessing() {\n DataProcessing_instance = this;\n }\n DataProcessing.prototype.transformOriginals_si9pes$ = function (data_0, bindings, scaleMap) {\n var tmp$;\n var data_1 = data_0;\n tmp$ = bindings.iterator();\n while (tmp$.hasNext()) {\n var binding = tmp$.next();\n var variable = binding.variable;\n if (variable.isOrigin) {\n if (!data_1.has_8xm3sj$(variable)) {\n var message = 'Undefined variable ' + variable;\n throw IllegalStateException_init(message.toString());\n }data_1 = data.DataFrameUtil.applyTransform_xaiv89$(data_1, variable, binding.aes, scaleMap.get_31786j$(binding.aes));\n }}\n return data_1;\n };\n DataProcessing.prototype.buildStatData_x40e2x$ = function (data, stat_0, bindings, scaleMap, groupingContext, facets, statCtx, varsWithoutBinding, orderOptions, aggregateOperation, messageConsumer) {\n var tmp$, tmp$_0;\n if (stat_0 === stat.Stats.IDENTITY) {\n return new DataProcessing$DataAndGroupingContext(DataFrame$Builder.Companion.emptyFrame(), groupingContext);\n }var groups = groupingContext.groupMapper;\n var resultSeries;\n var groupSizeListAfterStat;\n if (groups === GroupUtil_getInstance().SINGLE_GROUP_8be2vx$) {\n var sd = this.applyStat_0(data, stat_0, bindings, scaleMap, facets, statCtx, varsWithoutBinding, messageConsumer);\n groupSizeListAfterStat = listOf(sd.rowCount());\n var $receiver = sd.variables();\n var result = LinkedHashMap_init_0(coerceAtLeast(mapCapacity(collectionSizeOrDefault($receiver, 10)), 16));\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n result.put_xwzc9p$(element, sd.get_8xm3sj$(element));\n }\n resultSeries = result;\n } else {\n var groupMerger = new GroupMerger();\n var lastStatGroupEnd = -1;\n tmp$ = this.splitByGroup_0(data, groups).iterator();\n while (tmp$.hasNext()) {\n var d = tmp$.next();\n var sd_0 = this.applyStat_0(d, stat_0, bindings, scaleMap, facets, statCtx, varsWithoutBinding, messageConsumer);\n if (sd_0.isEmpty) {\n continue;\n }groupMerger.initOrderSpecs_37be8y$(orderOptions, sd_0.variables(), bindings, aggregateOperation);\n var curGroupSizeAfterStat = sd_0.rowCount();\n if (sd_0.has_8xm3sj$(stat.Stats.GROUP)) {\n var range = sd_0.range_8xm3sj$(stat.Stats.GROUP);\n if (range != null) {\n var start = lastStatGroupEnd + 1 | 0;\n var offset = start - numberToInt(range.lowerEnd) | 0;\n lastStatGroupEnd = numberToInt(range.upperEnd) + offset | 0;\n if (offset !== 0) {\n var newG = ArrayList_init();\n tmp$_0 = sd_0.getNumeric_8xm3sj$(stat.Stats.GROUP).iterator();\n while (tmp$_0.hasNext()) {\n var g = tmp$_0.next();\n newG.add_11rb$(ensureNotNull(g) + offset);\n }\n sd_0 = sd_0.builder().putNumeric_s1rqo9$(stat.Stats.GROUP, newG).build();\n }}} else {\n var groupingVar = groupingContext.optionalGroupingVar_8be2vx$;\n if (groupingVar != null) {\n var size = sd_0.get_8xm3sj$(first_0(sd_0.variables())).size;\n var v = d.get_8xm3sj$(groupingVar).get_za3lpa$(0);\n var tmp$_2 = sd_0.builder();\n var list = ArrayList_init_0(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(v);\n }\n sd_0 = tmp$_2.put_2l962d$(groupingVar, list).build();\n }}\n groupMerger.addGroup_s4jycv$(sd_0, curGroupSizeAfterStat);\n }\n resultSeries = groupMerger.getResultSeries();\n groupSizeListAfterStat = groupMerger.getGroupSizes();\n }\n var closure$resultSeries = resultSeries;\n var $receiver_0 = DataFrame$DataFrame$Builder_init();\n var tmp$_3;\n tmp$_3 = closure$resultSeries.keys.iterator();\n while (tmp$_3.hasNext()) {\n var variable = tmp$_3.next();\n $receiver_0.put_2l962d$(variable, ensureNotNull(closure$resultSeries.get_11rb$(variable)));\n }\n var destination = ArrayList_init_0(collectionSizeOrDefault(orderOptions, 10));\n var tmp$_4;\n tmp$_4 = orderOptions.iterator();\n while (tmp$_4.hasNext()) {\n var item = tmp$_4.next();\n destination.add_11rb$(OrderOptionUtil_getInstance().createOrderSpec_e64h97$(closure$resultSeries.keys, bindings, item, aggregateOperation));\n }\n var orderSpecs = destination;\n $receiver_0.addOrderSpecs_l2t0xf$(orderSpecs);\n var dataAfterStat = $receiver_0.build();\n var groupingContextAfterStat = GroupingContext$Companion_getInstance().withOrderedGroups_vi90cb$(dataAfterStat, groupSizeListAfterStat);\n return new DataProcessing$DataAndGroupingContext(dataAfterStat, groupingContextAfterStat);\n };\n DataProcessing.prototype.findOptionalVariable_hrxl0z$ = function (data_0, name) {\n return base.Strings.isNullOrEmpty_pdl1vj$(name) ? null : data.DataFrameUtil.findVariableOrFail_vede35$(data_0, ensureNotNull(name));\n };\n DataProcessing.prototype.splitByGroup_0 = function (data, groups) {\n var $receiver = GroupUtil_getInstance().indicesByGroup_wc9gac$(data.rowCount(), groups).values;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_0 = destination.add_11rb$;\n var $receiver_0 = data.variables();\n var tmp$_1;\n var accumulator = DataFrame$DataFrame$Builder_init();\n tmp$_1 = $receiver_0.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n var b = accumulator;\n var operation$result;\n var tmp$_2;\n tmp$_2 = data.isNumeric_8xm3sj$(element);\n if (tmp$_2 === true) {\n operation$result = b.putNumeric_s1rqo9$(element, data_0.SeriesUtil.pickAtIndices_ge51dg$(data.getNumeric_8xm3sj$(element), item));\n } else if (tmp$_2 === false) {\n operation$result = b.putDiscrete_2l962d$(element, data_0.SeriesUtil.pickAtIndices_ge51dg$(data.get_8xm3sj$(element), item));\n } else {\n operation$result = Kotlin.noWhenBranchMatched();\n }\n accumulator = operation$result;\n }\n tmp$_0.call(destination, accumulator);\n }\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(destination, 10));\n var tmp$_3;\n tmp$_3 = destination.iterator();\n while (tmp$_3.hasNext()) {\n var item_0 = tmp$_3.next();\n destination_0.add_11rb$(item_0.build());\n }\n return destination_0;\n };\n function DataProcessing$applyStat$addSeriesForVariable(closure$data, closure$statDataSize, closure$newInputSeries) {\n return function (variable) {\n var tmp$, tmp$_0;\n tmp$ = closure$data.isNumeric_8xm3sj$(variable);\n if (tmp$ === true)\n tmp$_0 = data_0.SeriesUtil.mean_l4tjj7$(closure$data.getNumeric_8xm3sj$(variable), null);\n else if (tmp$ === false)\n tmp$_0 = data_0.SeriesUtil.firstNotNull_rath1t$(closure$data.get_8xm3sj$(variable), null);\n else\n tmp$_0 = Kotlin.noWhenBranchMatched();\n var value = tmp$_0;\n var size = closure$statDataSize;\n var list = ArrayList_init_0(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(value);\n }\n var newInputSerie = list;\n closure$newInputSeries.put_xwzc9p$(variable, newInputSerie);\n };\n }\n DataProcessing.prototype.applyStat_0 = function (data_0, stat_0, bindings, scaleMap, facets, statCtx, varsWithoutBinding, compMessageConsumer) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3, tmp$_4;\n var statData = stat_0.apply_kdy6bf$(data_0, statCtx, compMessageConsumer);\n var statVariables = statData.variables();\n if (statVariables.isEmpty()) {\n return statData;\n }var inverseTransformedStatSeries = this.inverseTransformContinuousStatData_0(statData, stat_0, bindings, scaleMap);\n var statDataSize = statData.get_8xm3sj$(statVariables.iterator().next()).size;\n var facetVars = HashSet_init_0();\n tmp$ = facets.variables.iterator();\n while (tmp$.hasNext()) {\n var facetVarName = tmp$.next();\n var facetVar = data.DataFrameUtil.findVariableOrFail_vede35$(data_0, facetVarName);\n facetVars.add_11rb$(facetVar);\n if (!data_0.get_8xm3sj$(facetVar).isEmpty()) {\n var facetLevel = data_0.get_8xm3sj$(facetVar).get_za3lpa$(0);\n var tmp$_5 = statData.builder();\n var list = ArrayList_init_0(statDataSize);\n for (var index = 0; index < statDataSize; index++) {\n list.add_11rb$(facetLevel);\n }\n statData = tmp$_5.put_2l962d$(facetVar, list).build();\n }}\n if (bindings.isEmpty()) {\n return statData;\n }var newInputSeries = HashMap_init();\n var addSeriesForVariable = DataProcessing$applyStat$addSeriesForVariable(data_0, statDataSize, newInputSeries);\n tmp$_0 = bindings.iterator();\n while (tmp$_0.hasNext()) {\n var binding = tmp$_0.next();\n var variable = binding.variable;\n if (variable.isStat || facetVars.contains_11rb$(variable)) {\n continue;\n }var aes = binding.aes;\n if (stat_0.hasDefaultMapping_896ixz$(aes)) {\n var defaultStatVar = stat_0.getDefaultMapping_896ixz$(aes);\n if (inverseTransformedStatSeries.containsKey_11rb$(defaultStatVar)) {\n tmp$_1 = getValue(inverseTransformedStatSeries, defaultStatVar);\n } else {\n var statSerie = statData.getNumeric_8xm3sj$(defaultStatVar);\n tmp$_1 = scale.ScaleUtil.inverseTransform_codrxm$(statSerie, scaleMap.get_31786j$(aes));\n }\n var newInputSerie = tmp$_1;\n newInputSeries.put_xwzc9p$(variable, newInputSerie);\n } else {\n if (!newInputSeries.containsKey_11rb$(variable)) {\n addSeriesForVariable(variable);\n }}\n }\n var predicate = getCallableRef('isStatVar', function ($receiver, p1) {\n return $receiver.isStatVar_61zpoe$(p1);\n }.bind(null, stat.Stats));\n var destination = ArrayList_init();\n var tmp$_6;\n tmp$_6 = varsWithoutBinding.iterator();\n while (tmp$_6.hasNext()) {\n var element = tmp$_6.next();\n if (!predicate(element))\n destination.add_11rb$(element);\n }\n tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var varName = tmp$_2.next();\n var variable_0 = data.DataFrameUtil.findVariableOrFail_vede35$(data_0, varName);\n if (!newInputSeries.containsKey_11rb$(variable_0)) {\n addSeriesForVariable(variable_0);\n }}\n var b = statData.builder();\n tmp$_3 = newInputSeries.keys.iterator();\n while (tmp$_3.hasNext()) {\n var variable_1 = tmp$_3.next();\n b.put_2l962d$(variable_1, getValue(newInputSeries, variable_1));\n }\n tmp$_4 = inverseTransformedStatSeries.keys.iterator();\n while (tmp$_4.hasNext()) {\n var variable_2 = tmp$_4.next();\n b.putNumeric_s1rqo9$(variable_2, getValue(inverseTransformedStatSeries, variable_2));\n }\n return b.build();\n };\n DataProcessing.prototype.inverseTransformContinuousStatData_0 = function (statData, stat, bindings, scaleMap) {\n var tmp$, tmp$_0, tmp$_1;\n var continuousScaleByAes = HashMap_init();\n var aesByMappedStatVar = HashMap_init();\n tmp$ = Aes.Companion.values().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n if (stat.hasDefaultMapping_896ixz$(aes)) {\n var defaultStatVar = stat.getDefaultMapping_896ixz$(aes);\n aesByMappedStatVar.put_xwzc9p$(defaultStatVar, aes);\n }}\n tmp$_0 = bindings.iterator();\n while (tmp$_0.hasNext()) {\n var binding = tmp$_0.next();\n var aes_0 = binding.aes;\n var variable = binding.variable;\n if (variable.isStat) {\n aesByMappedStatVar.put_xwzc9p$(variable, aes_0);\n continue;\n }var scale_0 = scaleMap.get_31786j$(aes_0);\n if (scale_0.isContinuousDomain) {\n continuousScaleByAes.put_xwzc9p$(aes_0, scale_0);\n if (Aes.Companion.isPositionalX_896ixz$(aes_0) && !continuousScaleByAes.containsKey_11rb$(Aes.Companion.X)) {\n var key = Aes.Companion.X;\n continuousScaleByAes.put_xwzc9p$(key, scale_0);\n } else if (Aes.Companion.isPositionalY_896ixz$(aes_0) && !continuousScaleByAes.containsKey_11rb$(Aes.Companion.Y)) {\n var key_0 = Aes.Companion.Y;\n continuousScaleByAes.put_xwzc9p$(key_0, scale_0);\n }}}\n var inverseTransformedStatSeries = HashMap_init();\n tmp$_1 = statData.variables().iterator();\n while (tmp$_1.hasNext()) {\n var statVar = tmp$_1.next();\n if (aesByMappedStatVar.containsKey_11rb$(statVar)) {\n var aes_1 = getValue(aesByMappedStatVar, statVar);\n var scale_1 = continuousScaleByAes.get_11rb$(aes_1);\n if (scale_1 == null) {\n if (Aes.Companion.isPositionalX_896ixz$(aes_1)) {\n scale_1 = continuousScaleByAes.get_11rb$(Aes.Companion.X);\n } else if (Aes.Companion.isPositionalY_896ixz$(aes_1)) {\n scale_1 = continuousScaleByAes.get_11rb$(Aes.Companion.Y);\n }}if (scale_1 != null) {\n var statSerie = statData.getNumeric_8xm3sj$(statVar);\n var inverseTransformedStatSerie = scale.ScaleUtil.inverseTransformToContinuousDomain_codrxm$(statSerie, scale_1);\n inverseTransformedStatSeries.put_xwzc9p$(statVar, inverseTransformedStatSerie);\n }}}\n return inverseTransformedStatSeries;\n };\n DataProcessing.prototype.computeGroups_hut2k5$ = function (data, bindings, groupingVar, pathIdVar) {\n var tmp$, tmp$_0;\n var groupingVariables = plus_0(this.getGroupingVariables_0(data, bindings, groupingVar), listOfNotNull_0(pathIdVar));\n var currentGroups = {v: null};\n if (groupingVar != null) {\n currentGroups.v = this.computeGroups_0(data.get_8xm3sj$(groupingVar));\n }tmp$ = groupingVariables.iterator();\n while (tmp$.hasNext()) {\n var groupingVariable = tmp$.next();\n var values = data.get_8xm3sj$(groupingVariable);\n var groups = this.computeGroups_0(values);\n if (currentGroups.v == null) {\n currentGroups.v = groups;\n continue;\n }if (!(currentGroups.v.size === groups.size)) {\n var tmp$_1;\n var message = 'Data series used to compute groups must be equal in size (encountered sizes: ' + (toString((tmp$_1 = currentGroups.v) != null ? tmp$_1.size : null) + ', ' + groups.size + ' )');\n throw IllegalStateException_init(message.toString());\n }var dummies = this.computeDummyValues_0(currentGroups.v, groups);\n currentGroups.v = this.computeGroups_0(dummies);\n }\n if (currentGroups.v != null) {\n tmp$_0 = GroupUtil_getInstance().wrap_2wzaym$(currentGroups.v);\n } else {\n tmp$_0 = GroupUtil_getInstance().SINGLE_GROUP_8be2vx$;\n }\n return tmp$_0;\n };\n DataProcessing.prototype.computeGroups_0 = function (values) {\n var tmp$, tmp$_0;\n var groups = ArrayList_init();\n var groupByVal = HashMap_init();\n var count = 0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (!groupByVal.containsKey_11rb$(v)) {\n var value = (tmp$_0 = count, count = tmp$_0 + 1 | 0, tmp$_0);\n groupByVal.put_xwzc9p$(v, value);\n }groups.add_11rb$(ensureNotNull(groupByVal.get_11rb$(v)));\n }\n return groups;\n };\n DataProcessing.prototype.computeDummyValues_0 = function (list1, list2) {\n if (list1.isEmpty())\n return emptyList();\n var limit = 1000;\n var max = Ordering.Companion.natural_dahdeg$().max_m5x2f4$(collect.Iterables.concat_yxozss$(list1, list2));\n if (!(max < limit)) {\n var message = 'Too many groups: ' + max;\n throw IllegalStateException_init(message.toString());\n }var dummies = ArrayList_init();\n var it1 = list1.iterator();\n var it2 = list2.iterator();\n while (it1.hasNext()) {\n var v1 = it1.next();\n var v2 = it2.next();\n var dummy = Kotlin.imul(v1, limit) + v2 | 0;\n dummies.add_11rb$(dummy);\n }\n return dummies;\n };\n DataProcessing.prototype.getGroupingVariables_0 = function (data, bindings, explicitGroupingVar) {\n var tmp$;\n var result = LinkedHashSet_init();\n tmp$ = bindings.iterator();\n while (tmp$.hasNext()) {\n var binding = tmp$.next();\n var variable = binding.variable;\n if (!result.contains_11rb$(variable)) {\n if (variable.isOrigin) {\n if (equals(variable, explicitGroupingVar) || this.isDefaultGroupingVariable_0(data, binding.aes, variable)) {\n result.add_11rb$(variable);\n }}}}\n return result;\n };\n DataProcessing.prototype.isDefaultGroupingVariable_0 = function (data, aes, variable) {\n return !(Aes.Companion.isPositional_896ixz$(aes) || data.isNumeric_8xm3sj$(variable));\n };\n function DataProcessing$DataAndGroupingContext(data, groupingContext) {\n this.data = data;\n this.groupingContext = groupingContext;\n }\n DataProcessing$DataAndGroupingContext.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataAndGroupingContext',\n interfaces: []\n };\n DataProcessing.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DataProcessing',\n interfaces: []\n };\n var DataProcessing_instance = null;\n function DataProcessing_getInstance() {\n if (DataProcessing_instance === null) {\n new DataProcessing();\n }return DataProcessing_instance;\n }\n function GroupMerger() {\n this.myOrderSpecs_0 = null;\n this.myOrderedGroups_0 = ArrayList_init();\n }\n GroupMerger.prototype.initOrderSpecs_37be8y$ = function (orderOptions, variables, bindings, aggregateOperation) {\n if (this.myOrderSpecs_0 != null)\n return;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = orderOptions.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_0;\n tmp$_0 = bindings.iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n if (equals(element_0.variable.name, element.variableName) && equals(element_0.aes, Aes.Companion.X)) {\n firstOrNull$result = element_0;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n if (firstOrNull$result == null)\n destination.add_11rb$(element);\n }\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(destination, 10));\n var tmp$_1;\n tmp$_1 = destination.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n destination_0.add_11rb$(OrderOptionUtil_getInstance().createOrderSpec_e64h97$(variables, bindings, item, aggregateOperation));\n }\n this.myOrderSpecs_0 = destination_0;\n };\n GroupMerger.prototype.getResultSeries = function () {\n var resultSeries = HashMap_init();\n var tmp$;\n tmp$ = this.myOrderedGroups_0.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n tmp$_0 = element.df.variables().iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n var tmp$_1;\n var value = resultSeries.get_11rb$(element_0);\n if (value == null) {\n var answer = ArrayList_init();\n resultSeries.put_xwzc9p$(element_0, answer);\n tmp$_1 = answer;\n } else {\n tmp$_1 = value;\n }\n tmp$_1.addAll_brywnq$(element.df.get_8xm3sj$(element_0));\n }\n }\n return resultSeries;\n };\n GroupMerger.prototype.getGroupSizes = function () {\n var $receiver = this.myOrderedGroups_0;\n var transform = getPropertyCallableRef('groupSize', 1, function ($receiver) {\n return $receiver.groupSize;\n });\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(transform(item));\n }\n return destination;\n };\n function GroupMerger$Group($outer, df, groupSize) {\n this.$outer = $outer;\n this.df = df;\n this.groupSize = groupSize;\n }\n function GroupMerger$Group$compareTo$compareGroupValue(v1, v2, dir) {\n var tmp$, tmp$_0;\n if (v1 == null && v2 == null)\n return 0;\n if (v1 == null)\n return 1;\n if (v2 == null)\n return -1;\n return Kotlin.imul(compareValues(Kotlin.isComparable(tmp$ = v1) ? tmp$ : throwCCE(), Kotlin.isComparable(tmp$_0 = v2) ? tmp$_0 : throwCCE()), dir);\n }\n function GroupMerger$Group$compareTo$getValue(df, variable, aggregateOperation) {\n if (aggregateOperation === void 0)\n aggregateOperation = null;\n var tmp$;\n if (aggregateOperation != null) {\n if (!df.isNumeric_8xm3sj$(variable)) {\n var message = \"Can't apply aggregate operation to non-numeric values\";\n throw IllegalArgumentException_init(message.toString());\n }tmp$ = aggregateOperation(requireNoNulls(df.getNumeric_8xm3sj$(variable)));\n } else {\n tmp$ = firstOrNull(df.get_8xm3sj$(variable));\n }\n return tmp$;\n }\n GroupMerger$Group.prototype.compareTo_11rb$ = function (other) {\n var tmp$;\n var compareGroupValue = GroupMerger$Group$compareTo$compareGroupValue;\n var getValue = GroupMerger$Group$compareTo$getValue;\n if ((tmp$ = this.$outer.myOrderSpecs_0) != null) {\n var tmp$_0;\n tmp$_0 = tmp$.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var cmp = compareGroupValue(getValue(this.df, element.orderBy, element.aggregateOperation), getValue(other.df, element.orderBy, element.aggregateOperation), element.direction);\n if (cmp === 0) {\n cmp = compareGroupValue(getValue(this.df, element.variable), getValue(other.df, element.variable), element.direction);\n }if (cmp !== 0) {\n return cmp;\n }}\n }return 0;\n };\n GroupMerger$Group.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Group',\n interfaces: [Comparable]\n };\n GroupMerger.prototype.addGroup_s4jycv$ = function (d, groupSize) {\n var group = new GroupMerger$Group(this, d, groupSize);\n var indexToInsert = this.findIndexToInsert_0(group);\n this.myOrderedGroups_0.add_wxm5ur$(indexToInsert, group);\n };\n GroupMerger.prototype.findIndexToInsert_0 = function (group) {\n var $receiver = this.myOrderSpecs_0;\n if ($receiver == null || $receiver.isEmpty()) {\n return this.myOrderedGroups_0.size;\n }var index = binarySearch(this.myOrderedGroups_0, group);\n if (index < 0)\n index = ~index;\n return index;\n };\n GroupMerger.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupMerger',\n interfaces: []\n };\n function GroupUtil() {\n GroupUtil_instance = this;\n this.SINGLE_GROUP_8be2vx$ = GroupUtil$SINGLE_GROUP$lambda;\n }\n function GroupUtil$wrap$lambda(closure$l) {\n return function (index) {\n return index > 0 && index < closure$l.size ? numberToInt(ensureNotNull(closure$l.get_za3lpa$(index))) : 0;\n };\n }\n GroupUtil.prototype.wrap_2wzaym$ = function (l) {\n return GroupUtil$wrap$lambda(l);\n };\n function GroupUtil$wrap$lambda_0(closure$groupByPointIndex) {\n return function (it) {\n return ensureNotNull(closure$groupByPointIndex.get_11rb$(it));\n };\n }\n GroupUtil.prototype.wrap_orwq1h$ = function (groupByPointIndex) {\n return GroupUtil$wrap$lambda_0(groupByPointIndex);\n };\n GroupUtil.prototype.indicesByGroup_wc9gac$ = function (dataLength, groups) {\n var indicesByGroup = LinkedHashMap_init();\n for (var i = 0; i < dataLength; i++) {\n var group = groups(i);\n if (!indicesByGroup.containsKey_11rb$(group)) {\n var value = ArrayList_init();\n indicesByGroup.put_xwzc9p$(group, value);\n }ensureNotNull(indicesByGroup.get_11rb$(group)).add_11rb$(i);\n }\n return indicesByGroup;\n };\n function GroupUtil$SINGLE_GROUP$lambda(f) {\n return 0;\n }\n GroupUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GroupUtil',\n interfaces: []\n };\n var GroupUtil_instance = null;\n function GroupUtil_getInstance() {\n if (GroupUtil_instance === null) {\n new GroupUtil();\n }return GroupUtil_instance;\n }\n function GroupingContext(myData, bindings, groupingVarName, pathIdVarName, myExpectMultiple) {\n GroupingContext$Companion_getInstance();\n this.myData_0 = myData;\n this.myExpectMultiple_0 = myExpectMultiple;\n this.myBindings_0 = ArrayList_init_1(bindings);\n this.optionalGroupingVar_8be2vx$ = DataProcessing_getInstance().findOptionalVariable_hrxl0z$(this.myData_0, groupingVarName);\n this.pathIdVar_0 = DataProcessing_getInstance().findOptionalVariable_hrxl0z$(this.myData_0, pathIdVarName);\n this.myGroupSizeList_0 = null;\n this.myGroupMapper_0 = null;\n }\n function GroupingContext$get_GroupingContext$groupMapper$lambda(this$GroupingContext) {\n return function (index) {\n if (this$GroupingContext.myGroupMapper_0 == null) {\n this$GroupingContext.myGroupMapper_0 = this$GroupingContext.computeGroups_0();\n }return ensureNotNull(this$GroupingContext.myGroupMapper_0)(index);\n };\n }\n Object.defineProperty(GroupingContext.prototype, 'groupMapper', {\n configurable: true,\n get: function () {\n return GroupingContext$get_GroupingContext$groupMapper$lambda(this);\n }\n });\n GroupingContext.prototype.computeGroups_0 = function () {\n if (this.myData_0.has_8xm3sj$(stat.Stats.GROUP)) {\n var list = this.myData_0.getNumeric_8xm3sj$(stat.Stats.GROUP);\n return GroupUtil_getInstance().wrap_2wzaym$(list);\n } else if (this.myGroupSizeList_0 != null) {\n if (ensureNotNull(this.myGroupSizeList_0).size === this.myData_0.rowCount()) {\n return GroupUtil_getInstance().SINGLE_GROUP_8be2vx$;\n } else {\n var groupByPointIndex = GroupingContext$Companion_getInstance().toIndexMap_0(ensureNotNull(this.myGroupSizeList_0));\n return GroupUtil_getInstance().wrap_orwq1h$(groupByPointIndex);\n }\n } else if (this.myExpectMultiple_0) {\n return DataProcessing_getInstance().computeGroups_hut2k5$(this.myData_0, this.myBindings_0, this.optionalGroupingVar_8be2vx$, this.pathIdVar_0);\n }return GroupUtil_getInstance().SINGLE_GROUP_8be2vx$;\n };\n function GroupingContext$Companion() {\n GroupingContext$Companion_instance = this;\n }\n GroupingContext$Companion.prototype.withOrderedGroups_vi90cb$ = function (data, groupSizeList) {\n var groupingContext = new GroupingContext(data, emptyList(), null, null, false);\n groupingContext.myGroupSizeList_0 = ArrayList_init_1(groupSizeList);\n return groupingContext;\n };\n GroupingContext$Companion.prototype.toIndexMap_0 = function (groupSizeList) {\n var tmp$;\n var result = HashMap_init();\n var currentGroup = 0;\n var currentGroupIndexOffset = 0;\n tmp$ = groupSizeList.iterator();\n while (tmp$.hasNext()) {\n var groupSize = tmp$.next();\n for (var i = 0; i < groupSize; i++) {\n var key = currentGroupIndexOffset + i | 0;\n var value = currentGroup;\n result.put_xwzc9p$(key, value);\n }\n currentGroup = currentGroup + 1 | 0;\n currentGroupIndexOffset = currentGroupIndexOffset + groupSize | 0;\n }\n return result;\n };\n GroupingContext$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GroupingContext$Companion_instance = null;\n function GroupingContext$Companion_getInstance() {\n if (GroupingContext$Companion_instance === null) {\n new GroupingContext$Companion();\n }return GroupingContext$Companion_instance;\n }\n GroupingContext.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupingContext',\n interfaces: []\n };\n function OrderOptionUtil() {\n OrderOptionUtil_instance = this;\n }\n function OrderOptionUtil$OrderOption(variableName, byVariable, orderDir) {\n OrderOptionUtil$OrderOption$Companion_getInstance();\n this.variableName = variableName;\n this.byVariable = byVariable;\n this.orderDir_0 = orderDir;\n }\n OrderOptionUtil$OrderOption.prototype.getOrderDir = function () {\n var tmp$;\n return (tmp$ = this.orderDir_0) != null ? tmp$ : -1;\n };\n function OrderOptionUtil$OrderOption$Companion() {\n OrderOptionUtil$OrderOption$Companion_instance = this;\n }\n OrderOptionUtil$OrderOption$Companion.prototype.create_yyjhqb$ = function (variableName, orderBy, order) {\n var tmp$, tmp$_0;\n if (orderBy == null && order == null) {\n return null;\n }if (!(order == null || (Kotlin.isNumber(order) && listOf_0([-1, 1]).contains_11rb$(numberToInt(order))))) {\n var message = 'Unsupported `order` value: ' + toString(order) + '. Use 1 (ascending) or -1 (descending).';\n throw IllegalArgumentException_init(message.toString());\n }return new OrderOptionUtil$OrderOption(variableName, orderBy, (tmp$_0 = Kotlin.isNumber(tmp$ = order) ? tmp$ : null) != null ? numberToInt(tmp$_0) : null);\n };\n OrderOptionUtil$OrderOption$Companion.prototype.mergeWith_me9ya9$ = function ($receiver, other) {\n var tmp$, tmp$_0;\n if (!equals($receiver.variableName, other.variableName)) {\n var message = \"Can't merge order options for different variables: '\" + $receiver.variableName + \"' and '\" + other.variableName + \"'\";\n throw IllegalArgumentException_init(message.toString());\n }if (!($receiver.byVariable == null || other.byVariable == null || equals(other.byVariable, $receiver.byVariable))) {\n var message_0 = \"Multiple ordering options for the variable '\" + $receiver.variableName + \"' with different non-empty 'order_by' fields: '\" + toString($receiver.byVariable) + \"' and '\" + toString(other.byVariable) + \"'\";\n throw IllegalArgumentException_init(message_0.toString());\n }if (!($receiver.orderDir_0 == null || other.orderDir_0 == null || other.orderDir_0 == $receiver.orderDir_0)) {\n var message_1 = \"Multiple ordering options for the variable '\" + $receiver.variableName + \"' with different order direction: '\" + toString($receiver.orderDir_0) + \"' and '\" + toString(other.orderDir_0) + \"'\";\n throw IllegalArgumentException_init(message_1.toString());\n }return new OrderOptionUtil$OrderOption($receiver.variableName, (tmp$ = $receiver.byVariable) != null ? tmp$ : other.byVariable, (tmp$_0 = $receiver.orderDir_0) != null ? tmp$_0 : other.orderDir_0);\n };\n OrderOptionUtil$OrderOption$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var OrderOptionUtil$OrderOption$Companion_instance = null;\n function OrderOptionUtil$OrderOption$Companion_getInstance() {\n if (OrderOptionUtil$OrderOption$Companion_instance === null) {\n new OrderOptionUtil$OrderOption$Companion();\n }return OrderOptionUtil$OrderOption$Companion_instance;\n }\n OrderOptionUtil$OrderOption.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'OrderOption',\n interfaces: []\n };\n function OrderOptionUtil$createOrderSpec$getVariableByName(closure$variables) {\n return function (varName) {\n var tmp$;\n var tmp$_0;\n var $receiver = closure$variables;\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n if (equals(element.name, varName)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n if ((tmp$ = firstOrNull$result) != null)\n tmp$_0 = tmp$;\n else {\n var tmp$_2 = \"Undefined variable '\" + varName + \"' in order options. Full variable list: \";\n var $receiver_0 = closure$variables;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver_0, 10));\n var tmp$_3;\n tmp$_3 = $receiver_0.iterator();\n while (tmp$_3.hasNext()) {\n var item = tmp$_3.next();\n destination.add_11rb$(\"'\" + item.name + \"'\");\n }\n throw IllegalStateException_init((tmp$_2 + destination).toString());\n }\n return tmp$_0;\n };\n }\n OrderOptionUtil.prototype.createOrderSpec_e64h97$ = function (variables, varBindings, orderOption, aggregateOperation) {\n var tmp$, tmp$_0, tmp$_1;\n var getVariableByName = OrderOptionUtil$createOrderSpec$getVariableByName(variables);\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_2;\n tmp$_2 = varBindings.iterator();\n while (tmp$_2.hasNext()) {\n var element = tmp$_2.next();\n if (equals(element.variable.name, orderOption.variableName) && equals(element.aes, Aes.Companion.X)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n if (firstOrNull$result != null && SamplingUtil_getInstance().xVar_bbyvt0$(variables) != null) {\n tmp$ = ensureNotNull(SamplingUtil_getInstance().xVar_bbyvt0$(variables));\n } else {\n tmp$ = getVariableByName(orderOption.variableName);\n }\n var variable = tmp$;\n return new DataFrame$OrderSpec(variable, (tmp$_1 = (tmp$_0 = orderOption.byVariable) != null ? getVariableByName(tmp$_0) : null) != null ? tmp$_1 : getVariableByName(orderOption.variableName), orderOption.getOrderDir(), orderOption.byVariable != null && !equals(orderOption.byVariable, orderOption.variableName) ? aggregateOperation : null);\n };\n OrderOptionUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'OrderOptionUtil',\n interfaces: []\n };\n var OrderOptionUtil_instance = null;\n function OrderOptionUtil_getInstance() {\n if (OrderOptionUtil_instance === null) {\n new OrderOptionUtil();\n }return OrderOptionUtil_instance;\n }\n function MouseEventPeer() {\n this.myEventHandlers_0 = HashMap_init();\n this.myEventSources_0 = ArrayList_init();\n this.mySourceRegistrations_0 = HashMap_init();\n }\n function MouseEventPeer$addEventHandler$ObjectLiteral(closure$addReg, this$MouseEventPeer, closure$eventSpec) {\n this.closure$addReg = closure$addReg;\n this.this$MouseEventPeer = this$MouseEventPeer;\n this.closure$eventSpec = closure$eventSpec;\n Registration.call(this);\n }\n MouseEventPeer$addEventHandler$ObjectLiteral.prototype.doRemove = function () {\n var tmp$;\n (tmp$ = this.closure$addReg) != null ? (tmp$.remove(), Unit) : null;\n if (ensureNotNull(this.this$MouseEventPeer.myEventHandlers_0.get_11rb$(this.closure$eventSpec)).isEmpty) {\n this.this$MouseEventPeer.myEventHandlers_0.remove_11rb$(this.closure$eventSpec);\n this.this$MouseEventPeer.onRemoveSpec_0(this.closure$eventSpec);\n }};\n MouseEventPeer$addEventHandler$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [Registration]\n };\n MouseEventPeer.prototype.addEventHandler_mfdhbe$ = function (eventSpec, eventHandler) {\n var tmp$;\n if (!this.myEventHandlers_0.containsKey_11rb$(eventSpec)) {\n var $receiver = this.myEventHandlers_0;\n var value = new Listeners();\n $receiver.put_xwzc9p$(eventSpec, value);\n this.onAddSpec_0(eventSpec);\n }var addReg = (tmp$ = this.myEventHandlers_0.get_11rb$(eventSpec)) != null ? tmp$.add_11rb$(eventHandler) : null;\n return new MouseEventPeer$addEventHandler$ObjectLiteral(addReg, this, eventSpec);\n };\n function MouseEventPeer$dispatch$ObjectLiteral(closure$mouseEvent) {\n this.closure$mouseEvent = closure$mouseEvent;\n }\n MouseEventPeer$dispatch$ObjectLiteral.prototype.call_11rb$ = function (l) {\n l.onEvent_11rb$(this.closure$mouseEvent);\n };\n MouseEventPeer$dispatch$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ListenerCaller]\n };\n MouseEventPeer.prototype.dispatch_w7zfbj$ = function (eventSpec, mouseEvent) {\n var tmp$;\n if (this.myEventHandlers_0.containsKey_11rb$(eventSpec)) {\n (tmp$ = this.myEventHandlers_0.get_11rb$(eventSpec)) != null ? (tmp$.fire_kucmxw$(new MouseEventPeer$dispatch$ObjectLiteral(mouseEvent)), Unit) : null;\n }};\n MouseEventPeer.prototype.addEventSource_u4bej9$ = function (eventSource) {\n var tmp$;\n tmp$ = this.myEventHandlers_0.keys.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.startHandleSpecInSource_0(eventSource, element);\n }\n this.myEventSources_0.add_11rb$(eventSource);\n };\n MouseEventPeer.prototype.onAddSpec_0 = function (eventSpec) {\n var tmp$;\n tmp$ = this.myEventSources_0.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.startHandleSpecInSource_0(element, eventSpec);\n }\n };\n function MouseEventPeer$startHandleSpecInSource$ObjectLiteral(closure$eventSpec, this$MouseEventPeer) {\n this.closure$eventSpec = closure$eventSpec;\n this.this$MouseEventPeer = this$MouseEventPeer;\n }\n MouseEventPeer$startHandleSpecInSource$ObjectLiteral.prototype.onEvent_11rb$ = function (event) {\n this.this$MouseEventPeer.dispatch_w7zfbj$(this.closure$eventSpec, event);\n };\n MouseEventPeer$startHandleSpecInSource$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [EventHandler]\n };\n MouseEventPeer.prototype.startHandleSpecInSource_0 = function (eventSource, eventSpec) {\n var tmp$;\n var registration = eventSource.addEventHandler_mfdhbe$(eventSpec, new MouseEventPeer$startHandleSpecInSource$ObjectLiteral(eventSpec, this));\n if (!this.mySourceRegistrations_0.containsKey_11rb$(eventSpec)) {\n var $receiver = this.mySourceRegistrations_0;\n var value = new CompositeRegistration([]);\n $receiver.put_xwzc9p$(eventSpec, value);\n }(tmp$ = this.mySourceRegistrations_0.get_11rb$(eventSpec)) != null ? tmp$.add_3xv6fb$(registration) : null;\n };\n MouseEventPeer.prototype.onRemoveSpec_0 = function (eventSpec) {\n var tmp$;\n if (this.mySourceRegistrations_0.containsKey_11rb$(eventSpec)) {\n (tmp$ = this.mySourceRegistrations_0.remove_11rb$(eventSpec)) != null ? (tmp$.dispose(), Unit) : null;\n }};\n MouseEventPeer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MouseEventPeer',\n interfaces: [MouseEventSource]\n };\n function AxisComponent(length, orientation) {\n SvgComponent.call(this);\n this.breaks = new ValueProperty(null);\n this.labels = new ValueProperty(null);\n this.tickLabelRotationDegree = new ValueProperty(0.0);\n this.tickLabelHorizontalAnchor = null;\n this.tickLabelVerticalAnchor = null;\n this.tickLabelSmallFont = new ValueProperty(false);\n this.tickLabelOffsets = new ValueProperty(null);\n this.gridLineColor = new ValueProperty(Color.Companion.LIGHT_GRAY);\n this.lineWidth = new ValueProperty(1.0);\n this.gridLineWidth = new ValueProperty(1.0);\n this.gridLineLength = new ValueProperty(0.0);\n this.tickMarkWidth = new ValueProperty(1.0);\n this.tickMarkLength = new ValueProperty(6.0);\n this.tickMarkPadding = new ValueProperty(3.0);\n this.length_0 = new ValueProperty(null);\n this.orientation_0 = new ValueProperty(null);\n this.myTickMarksEnabled_0 = new ValueProperty(true);\n this.myTickLabelsEnabled_0 = new ValueProperty(true);\n this.myAxisLineEnabled_0 = new ValueProperty(true);\n this.lineColor_0 = new ValueProperty(Color.Companion.BLACK);\n this.tickColor_0 = new ValueProperty(Color.Companion.BLACK);\n this.length_0.set_11rb$(length);\n this.orientation_0.set_11rb$(orientation);\n this.tickLabelHorizontalAnchor = new ValueProperty(this.defTickLabelHorizontalAnchor_0(orientation));\n this.tickLabelVerticalAnchor = new ValueProperty(this.defTickLabelVerticalAnchor_0(orientation));\n var asPropertyChangedEventSource = AxisComponent_init$asPropertyChangedEventSource;\n event.EventSources.composite_xw2ruy$([asPropertyChangedEventSource(this.length_0), asPropertyChangedEventSource(this.orientation_0), asPropertyChangedEventSource(this.breaks), asPropertyChangedEventSource(this.labels), asPropertyChangedEventSource(this.gridLineLength), asPropertyChangedEventSource(this.tickLabelOffsets), asPropertyChangedEventSource(this.tickLabelHorizontalAnchor), asPropertyChangedEventSource(this.tickLabelVerticalAnchor), asPropertyChangedEventSource(this.tickLabelRotationDegree), asPropertyChangedEventSource(this.tickLabelSmallFont)]).addHandler_gxwwpc$(this.rebuildHandler_287e2$());\n }\n AxisComponent.prototype.defTickLabelHorizontalAnchor_0 = function (orientation) {\n var tmp$;\n switch (orientation.name) {\n case 'LEFT':\n tmp$ = TextLabel$HorizontalAnchor.RIGHT;\n break;\n case 'RIGHT':\n tmp$ = TextLabel$HorizontalAnchor.LEFT;\n break;\n case 'TOP':\n case 'BOTTOM':\n tmp$ = TextLabel$HorizontalAnchor.MIDDLE;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n AxisComponent.prototype.defTickLabelVerticalAnchor_0 = function (orientation) {\n switch (orientation.name) {\n case 'LEFT':\n case 'RIGHT':\n return TextLabel$VerticalAnchor.CENTER;\n case 'TOP':\n return TextLabel$VerticalAnchor.BOTTOM;\n case 'BOTTOM':\n return TextLabel$VerticalAnchor.TOP;\n default:throw RuntimeException_init('Unexpected orientation:' + orientation);\n }\n };\n AxisComponent.prototype.buildComponent = function () {\n this.buildAxis_0();\n };\n AxisComponent.prototype.buildAxis_0 = function () {\n var tmp$, tmp$_0, tmp$_1;\n var rootElement = this.rootGroup;\n rootElement.addClass_61zpoe$(Style_getInstance().AXIS);\n if (this.tickLabelSmallFont.get()) {\n rootElement.addClass_61zpoe$(Style_getInstance().SMALL_TICK_FONT);\n }var l = ensureNotNull(this.length_0.get());\n var x1;\n var y1;\n var x2;\n var y2;\n var start;\n var end;\n tmp$ = this.orientation_0.get();\n if (equals(tmp$, Orientation$LEFT_getInstance()) || equals(tmp$, Orientation$RIGHT_getInstance())) {\n x2 = 0.0;\n x1 = x2;\n start = 0.0;\n y1 = start;\n end = l;\n y2 = end;\n } else if (equals(tmp$, Orientation$TOP_getInstance()) || equals(tmp$, Orientation$BOTTOM_getInstance())) {\n start = 0.0;\n x1 = start;\n end = l;\n x2 = end;\n y2 = 0.0;\n y1 = y2;\n } else\n throw RuntimeException_init('Unexpected orientation:' + toString(this.orientation_0.get()));\n var axisLine = null;\n if (this.axisLineEnabled().get()) {\n axisLine = SvgLineElement_init(x1, y1, x2, y2);\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.lineWidth, axisLine.strokeWidth()));\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.lineColor_0, axisLine.strokeColor()));\n }var gridLineMinPos = start + 3;\n var gridLineMaxPos = end - 3;\n if (this.breaksEnabled_0()) {\n var breaks = this.breaks.get();\n if (!(breaks == null || breaks.isEmpty())) {\n var labels = this.labels.get();\n if (labels == null || labels.isEmpty()) {\n labels = ArrayList_init();\n for (var i = 0; i !== breaks.size; ++i) {\n labels.add_11rb$('');\n }\n }var i_0 = 0;\n tmp$_0 = breaks.iterator();\n while (tmp$_0.hasNext()) {\n var br = tmp$_0.next();\n var addGridLine = br >= gridLineMinPos && br <= gridLineMaxPos;\n var label = labels.get_za3lpa$(i_0 % labels.size);\n var labelOffset = this.tickLabelOffset_0(i_0);\n i_0 = i_0 + 1 | 0;\n var group = this.buildTick_0(label, labelOffset, addGridLine ? this.gridLineLength.get() : 0.0);\n tmp$_1 = this.orientation_0.get();\n if (equals(tmp$_1, Orientation$LEFT_getInstance()) || equals(tmp$_1, Orientation$RIGHT_getInstance()))\n svg.SvgUtils.transformTranslate_pw34rw$(group, 0.0, br);\n else if (equals(tmp$_1, Orientation$TOP_getInstance()) || equals(tmp$_1, Orientation$BOTTOM_getInstance()))\n svg.SvgUtils.transformTranslate_pw34rw$(group, br, 0.0);\n else\n throw RuntimeException_init('Unexpected orientation:' + toString(this.orientation_0.get()));\n rootElement.children().add_11rb$(group);\n }\n }}if (axisLine != null) {\n rootElement.children().add_11rb$(axisLine);\n }};\n AxisComponent.prototype.buildTick_0 = function (label, labelOffset, gridLineLength) {\n var tmp$;\n var tickMark = null;\n if (this.tickMarksEnabled().get()) {\n tickMark = new SvgLineElement();\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.tickMarkWidth, tickMark.strokeWidth()));\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.tickColor_0, tickMark.strokeColor()));\n }var tickLabel = null;\n if (this.tickLabelsEnabled().get()) {\n tickLabel = new TextLabel(label);\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.tickColor_0, tickLabel.textColor()));\n }var gridLine = null;\n if (gridLineLength > 0) {\n gridLine = new SvgLineElement();\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.gridLineColor, gridLine.strokeColor()));\n this.reg_3xv6fb$(property.PropertyBinding.bindOneWay_2ov6i0$(this.gridLineWidth, gridLine.strokeWidth()));\n }var markLength = this.tickMarkLength.get();\n tmp$ = this.orientation_0.get();\n if (equals(tmp$, Orientation$LEFT_getInstance())) {\n if (tickMark != null) {\n tickMark.x2().set_11rb$(-markLength);\n tickMark.y2().set_11rb$(0.0);\n }if (gridLine != null) {\n gridLine.x2().set_11rb$(gridLineLength);\n gridLine.y2().set_11rb$(0.0);\n }} else if (equals(tmp$, Orientation$RIGHT_getInstance())) {\n if (tickMark != null) {\n tickMark.x2().set_11rb$(markLength);\n tickMark.y2().set_11rb$(0.0);\n }if (gridLine != null) {\n gridLine.x2().set_11rb$(-gridLineLength);\n gridLine.y2().set_11rb$(0.0);\n }} else if (equals(tmp$, Orientation$TOP_getInstance())) {\n if (tickMark != null) {\n tickMark.x2().set_11rb$(0.0);\n tickMark.y2().set_11rb$(-markLength);\n }if (gridLine != null) {\n gridLine.x2().set_11rb$(0.0);\n gridLine.y2().set_11rb$(gridLineLength);\n }} else if (equals(tmp$, Orientation$BOTTOM_getInstance())) {\n if (tickMark != null) {\n tickMark.x2().set_11rb$(0.0);\n tickMark.y2().set_11rb$(markLength);\n }if (gridLine != null) {\n gridLine.x2().set_11rb$(0.0);\n gridLine.y2().set_11rb$(-gridLineLength);\n }} else\n throw RuntimeException_init('Unexpected orientation:' + toString(this.orientation_0.get()));\n var g = new SvgGElement();\n if (gridLine != null) {\n g.children().add_11rb$(gridLine);\n }if (tickMark != null) {\n g.children().add_11rb$(tickMark);\n }if (tickLabel != null) {\n tickLabel.moveTo_lu1900$(labelOffset.x, labelOffset.y);\n tickLabel.setHorizontalAnchor_ja80zo$(this.tickLabelHorizontalAnchor.get());\n tickLabel.setVerticalAnchor_yaudma$(this.tickLabelVerticalAnchor.get());\n tickLabel.rotate_14dthe$(this.tickLabelRotationDegree.get());\n g.children().add_11rb$(tickLabel.rootGroup);\n }g.addClass_61zpoe$(Style_getInstance().TICK);\n return g;\n };\n AxisComponent.prototype.tickMarkLength_0 = function () {\n var tmp$;\n if (this.myTickMarksEnabled_0.get()) {\n tmp$ = this.tickMarkLength.get();\n } else {\n tmp$ = 0.0;\n }\n return tmp$;\n };\n AxisComponent.prototype.tickLabelDistance_0 = function () {\n return this.tickMarkLength_0() + this.tickMarkPadding.get();\n };\n AxisComponent.prototype.tickLabelBaseOffset_0 = function () {\n var tmp$, tmp$_0;\n var distance = this.tickLabelDistance_0();\n tmp$ = this.orientation_0.get();\n if (equals(tmp$, Orientation$LEFT_getInstance()))\n tmp$_0 = new DoubleVector(-distance, 0.0);\n else if (equals(tmp$, Orientation$RIGHT_getInstance()))\n tmp$_0 = new DoubleVector(distance, 0.0);\n else if (equals(tmp$, Orientation$TOP_getInstance()))\n tmp$_0 = new DoubleVector(0.0, -distance);\n else if (equals(tmp$, Orientation$BOTTOM_getInstance()))\n tmp$_0 = new DoubleVector(0.0, distance);\n else\n throw RuntimeException_init('Unexpected orientation:' + toString(this.orientation_0.get()));\n return tmp$_0;\n };\n AxisComponent.prototype.tickLabelOffset_0 = function (tickIndex) {\n var additionalOffsets = this.tickLabelOffsets.get();\n var additionalOffset = additionalOffsets != null ? additionalOffsets.get_za3lpa$(tickIndex) : DoubleVector.Companion.ZERO;\n return this.tickLabelBaseOffset_0().add_gpjtzr$(additionalOffset);\n };\n AxisComponent.prototype.breaksEnabled_0 = function () {\n return this.myTickMarksEnabled_0.get() || this.myTickLabelsEnabled_0.get();\n };\n AxisComponent.prototype.tickMarksEnabled = function () {\n return this.myTickMarksEnabled_0;\n };\n AxisComponent.prototype.tickLabelsEnabled = function () {\n return this.myTickLabelsEnabled_0;\n };\n AxisComponent.prototype.axisLineEnabled = function () {\n return this.myAxisLineEnabled_0;\n };\n function AxisComponent_init$asPropertyChangedEventSource($receiver) {\n var tmp$;\n return Kotlin.isType(tmp$ = $receiver, EventSource) ? tmp$ : throwCCE();\n }\n AxisComponent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AxisComponent',\n interfaces: [SvgComponent]\n };\n function ColorBarComponent(spec) {\n LegendBox.call(this);\n this.spec_xr0de$_0 = spec;\n }\n Object.defineProperty(ColorBarComponent.prototype, 'spec', {\n get: function () {\n return this.spec_xr0de$_0;\n }\n });\n ColorBarComponent.prototype.appendGuideContent_26jijc$ = function (contentRoot) {\n var tmp$, tmp$_0;\n var layout = this.spec.layout;\n var guideBarGroup = new SvgGElement();\n var barBounds = layout.barBounds;\n var horizontal = layout.isHorizontal;\n this.addColorBar_0(guideBarGroup, this.spec.domain, this.spec.scale, this.spec.binCount, barBounds, layout.barLengthExpand, horizontal, this.spec.reverse);\n if (horizontal)\n tmp$ = barBounds.height;\n else\n tmp$ = barBounds.width;\n var barThickness = tmp$;\n var tickLength = barThickness / 5;\n var breakInfos = layout.breakInfos_8be2vx$.iterator();\n tmp$_0 = this.spec.breaks.labels.iterator();\n while (tmp$_0.hasNext()) {\n var brLabel = tmp$_0.next();\n var brInfo = breakInfos.next();\n var tickLocation = brInfo.tickLocation;\n var tickMarkPoints = ArrayList_init();\n if (horizontal) {\n var tickX = barBounds.left + tickLocation;\n tickMarkPoints.add_11rb$(new DoubleVector(tickX, barBounds.top));\n tickMarkPoints.add_11rb$(new DoubleVector(tickX, barBounds.top + tickLength));\n tickMarkPoints.add_11rb$(new DoubleVector(tickX, barBounds.bottom - tickLength));\n tickMarkPoints.add_11rb$(new DoubleVector(tickX, barBounds.bottom));\n } else {\n var tickY = barBounds.top + tickLocation;\n tickMarkPoints.add_11rb$(new DoubleVector(barBounds.left, tickY));\n tickMarkPoints.add_11rb$(new DoubleVector(barBounds.left + tickLength, tickY));\n tickMarkPoints.add_11rb$(new DoubleVector(barBounds.right - tickLength, tickY));\n tickMarkPoints.add_11rb$(new DoubleVector(barBounds.right, tickY));\n }\n this.addTickMark_0(guideBarGroup, tickMarkPoints.get_za3lpa$(0), tickMarkPoints.get_za3lpa$(1));\n this.addTickMark_0(guideBarGroup, tickMarkPoints.get_za3lpa$(2), tickMarkPoints.get_za3lpa$(3));\n var label = new TextLabel(brLabel);\n label.setHorizontalAnchor_ja80zo$(brInfo.labelHorizontalAnchor);\n label.setVerticalAnchor_yaudma$(brInfo.labelVerticalAnchor);\n label.moveTo_lu1900$(brInfo.labelLocation.x, brInfo.labelLocation.y + barBounds.top);\n guideBarGroup.children().add_11rb$(label.rootGroup);\n }\n guideBarGroup.children().add_11rb$(LegendBox$Companion_getInstance().createBorder_a5dgib$(barBounds, this.spec.theme.backgroundFill(), 1.0));\n if (this.debug) {\n var graphBounds = new DoubleRectangle(DoubleVector.Companion.ZERO, layout.graphSize);\n guideBarGroup.children().add_11rb$(LegendBox$Companion_getInstance().createBorder_a5dgib$(graphBounds, Color.Companion.DARK_BLUE, 1.0));\n }contentRoot.children().add_11rb$(guideBarGroup);\n return layout.size;\n };\n ColorBarComponent.prototype.addColorBar_0 = function (g, domain, scale_0, numBins, barBounds, barLengthExpand, horizontal, reverse_0) {\n var tmp$;\n var domainSpan = data_0.SeriesUtil.span_4fzjta$(domain);\n var stepCount = JsMath.max(2, numBins);\n var step = domainSpan / stepCount;\n var v = domain.lowerEnd + step / 2;\n var domainValues = ArrayList_init();\n for (var i = 0; i < stepCount; i++) {\n domainValues.add_11rb$(v + step * i);\n }\n if (reverse_0) {\n reverse(domainValues);\n }var colors = scale.ScaleUtil.map_9ksyxk$(domainValues, scale_0);\n if (horizontal)\n tmp$ = barBounds.width;\n else\n tmp$ = barBounds.height;\n var barLength = tmp$;\n var effectiveBarLength = barLength - barLengthExpand * 2;\n var segmentStep = effectiveBarLength / stepCount;\n var segmentLeft = barBounds.left;\n var segmentRight = barBounds.right;\n var segmentBottom = barBounds.bottom;\n var segmentTop = barBounds.top;\n var i_0 = 0;\n for (var tmp$_0 = colors.iterator(); tmp$_0.hasNext(); ++i_0) {\n var color = tmp$_0.next();\n var r = SvgRectElement_init_0(segmentLeft, segmentTop, segmentRight - segmentLeft, segmentBottom - segmentTop);\n r.strokeWidth().set_11rb$(0.0);\n r.fillColor().set_11rb$(color);\n g.children().add_11rb$(r);\n if (horizontal) {\n segmentLeft += segmentStep;\n } else {\n segmentTop += segmentStep;\n }\n if (i_0 === 0) {\n if (horizontal) {\n segmentLeft += barLengthExpand;\n } else {\n segmentTop += barLengthExpand;\n }\n }}\n };\n ColorBarComponent.prototype.addTickMark_0 = function (g, p0, p1) {\n var line = SvgLineElement_init(p0.x, p0.y, p1.x, p1.y);\n line.strokeWidth().set_11rb$(1.0);\n line.strokeColor().set_11rb$(this.spec.theme.backgroundFill());\n g.children().add_11rb$(line);\n };\n ColorBarComponent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBarComponent',\n interfaces: [LegendBox]\n };\n function ColorBarComponentLayout(title, domain, breaks, guideBarSize, legendDirection, reverse) {\n ColorBarComponentLayout$Companion_getInstance();\n LegendBoxLayout.call(this, title, legendDirection);\n this.guideBarSize = guideBarSize;\n this.barBounds_qhvd9h$_0 = null;\n this.barLengthExpand = 2.0;\n this.breakInfos_8be2vx$ = null;\n var guideBarLength = this.guideBarLength;\n var targetRange = new ClosedRange(0.0 + this.barLengthExpand, guideBarLength - this.barLengthExpand);\n var mapper = scale.Mappers.linear_1jkouz$(domain, targetRange, reverse);\n var $receiver = breaks.transformedValues;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var tmp$_0 = destination.add_11rb$;\n var tickLocation = mapper(item);\n tmp$_0.call(destination, this.createBreakInfo_14dthe$(tickLocation));\n }\n this.breakInfos_8be2vx$ = destination;\n this.barBounds = new DoubleRectangle(DoubleVector.Companion.ZERO, this.guideBarSize);\n }\n Object.defineProperty(ColorBarComponentLayout.prototype, 'barBounds', {\n configurable: true,\n get: function () {\n return this.barBounds_qhvd9h$_0;\n },\n set: function (barBounds) {\n this.barBounds_qhvd9h$_0 = barBounds;\n }\n });\n function ColorBarComponentLayout$BreakInfo(tickLocation, labelLocation, labelHorizontalAnchor, labelVerticalAnchor) {\n this.tickLocation = tickLocation;\n this.labelLocation = labelLocation;\n this.labelHorizontalAnchor = labelHorizontalAnchor;\n this.labelVerticalAnchor = labelVerticalAnchor;\n }\n ColorBarComponentLayout$BreakInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BreakInfo',\n interfaces: []\n };\n function ColorBarComponentLayout$HorizontalLayout(title, domain, breaks, barSize, reverse) {\n ColorBarComponentLayout.call(this, title, domain, breaks, barSize, LegendDirection$HORIZONTAL_getInstance(), reverse);\n this.graphSize_4lks14$_0 = null;\n this.graphSize_4lks14$_0 = new DoubleVector(this.guideBarSize.x, this.guideBarSize.y + this.labelDistance_0 + LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.height());\n }\n Object.defineProperty(ColorBarComponentLayout$HorizontalLayout.prototype, 'graphSize', {\n configurable: true,\n get: function () {\n return this.graphSize_4lks14$_0;\n }\n });\n Object.defineProperty(ColorBarComponentLayout$HorizontalLayout.prototype, 'labelDistance_0', {\n configurable: true,\n get: function () {\n return LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.height() / 3;\n }\n });\n Object.defineProperty(ColorBarComponentLayout$HorizontalLayout.prototype, 'guideBarLength', {\n configurable: true,\n get: function () {\n return this.guideBarSize.x;\n }\n });\n ColorBarComponentLayout$HorizontalLayout.prototype.createBreakInfo_14dthe$ = function (tickLocation) {\n var labelLocation = new DoubleVector(tickLocation, this.guideBarSize.y + this.labelDistance_0);\n return new ColorBarComponentLayout$BreakInfo(tickLocation, labelLocation, TextLabel$HorizontalAnchor.MIDDLE, TextLabel$VerticalAnchor.TOP);\n };\n ColorBarComponentLayout$HorizontalLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalLayout',\n interfaces: [ColorBarComponentLayout]\n };\n function ColorBarComponentLayout$VerticalLayout(title, domain, breaks, barSize, reverse) {\n ColorBarComponentLayout.call(this, title, domain, breaks, barSize, LegendDirection$VERTICAL_getInstance(), reverse);\n this.graphSize_ld8mnu$_0 = null;\n if (!!breaks.isEmpty) {\n var message = 'Colorbar VerticalLayout received empty breaks list.';\n throw IllegalStateException_init(message.toString());\n }var $receiver = breaks.labels;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(item.length);\n }\n var iterator = destination.iterator();\n if (!iterator.hasNext())\n throw NoSuchElementException_init();\n var it = iterator.next();\n var maxValue = LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(it);\n while (iterator.hasNext()) {\n var it_0 = iterator.next();\n var v = LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(it_0);\n maxValue = JsMath.max(maxValue, v);\n }\n var maxLabelWidth = maxValue;\n this.graphSize_ld8mnu$_0 = new DoubleVector(this.guideBarSize.x + this.labelDistance_0 + maxLabelWidth, this.guideBarSize.y);\n }\n Object.defineProperty(ColorBarComponentLayout$VerticalLayout.prototype, 'graphSize', {\n configurable: true,\n get: function () {\n return this.graphSize_ld8mnu$_0;\n }\n });\n Object.defineProperty(ColorBarComponentLayout$VerticalLayout.prototype, 'labelDistance_0', {\n configurable: true,\n get: function () {\n return LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(1) / 2;\n }\n });\n Object.defineProperty(ColorBarComponentLayout$VerticalLayout.prototype, 'guideBarLength', {\n configurable: true,\n get: function () {\n return this.guideBarSize.y;\n }\n });\n ColorBarComponentLayout$VerticalLayout.prototype.createBreakInfo_14dthe$ = function (tickLocation) {\n var labelLocation = new DoubleVector(this.guideBarSize.x + this.labelDistance_0, tickLocation);\n return new ColorBarComponentLayout$BreakInfo(tickLocation, labelLocation, TextLabel$HorizontalAnchor.LEFT, TextLabel$VerticalAnchor.CENTER);\n };\n ColorBarComponentLayout$VerticalLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalLayout',\n interfaces: [ColorBarComponentLayout]\n };\n function ColorBarComponentLayout$Companion() {\n ColorBarComponentLayout$Companion_instance = this;\n }\n ColorBarComponentLayout$Companion.prototype.horizontal_dwxw1i$ = function (title, domain, breaks, barSize, reverse) {\n return new ColorBarComponentLayout$HorizontalLayout(title, domain, breaks, barSize, reverse);\n };\n ColorBarComponentLayout$Companion.prototype.vertical_dwxw1i$ = function (title, domain, breaks, barSize, reverse) {\n return new ColorBarComponentLayout$VerticalLayout(title, domain, breaks, barSize, reverse);\n };\n ColorBarComponentLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorBarComponentLayout$Companion_instance = null;\n function ColorBarComponentLayout$Companion_getInstance() {\n if (ColorBarComponentLayout$Companion_instance === null) {\n new ColorBarComponentLayout$Companion();\n }return ColorBarComponentLayout$Companion_instance;\n }\n ColorBarComponentLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBarComponentLayout',\n interfaces: [LegendBoxLayout]\n };\n function ColorBarComponentSpec(title, domain, breaks, scale, binCount, theme, layout, reverse) {\n ColorBarComponentSpec$Companion_getInstance();\n LegendBoxSpec.call(this, title, theme, reverse);\n this.domain = domain;\n this.breaks = breaks;\n this.scale = scale;\n this.binCount = binCount;\n this.layout_smwmum$_0 = layout;\n }\n Object.defineProperty(ColorBarComponentSpec.prototype, 'layout', {\n get: function () {\n return this.layout_smwmum$_0;\n }\n });\n function ColorBarComponentSpec$Companion() {\n ColorBarComponentSpec$Companion_instance = this;\n this.DEF_NUM_BIN = 20;\n this.DEF_BAR_THICKNESS_0 = 1.0;\n this.DEF_BAR_LENGTH_0 = 5.0;\n }\n ColorBarComponentSpec$Companion.prototype.barAbsoluteSize_kkcal5$ = function (horizontal, theme) {\n var tmp$;\n if (horizontal)\n tmp$ = new DoubleVector(this.DEF_BAR_LENGTH_0 * theme.keySize(), this.DEF_BAR_THICKNESS_0 * theme.keySize());\n else\n tmp$ = new DoubleVector(this.DEF_BAR_THICKNESS_0 * theme.keySize(), this.DEF_BAR_LENGTH_0 * theme.keySize());\n return tmp$;\n };\n ColorBarComponentSpec$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorBarComponentSpec$Companion_instance = null;\n function ColorBarComponentSpec$Companion_getInstance() {\n if (ColorBarComponentSpec$Companion_instance === null) {\n new ColorBarComponentSpec$Companion();\n }return ColorBarComponentSpec$Companion_instance;\n }\n ColorBarComponentSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBarComponentSpec',\n interfaces: [LegendBoxSpec]\n };\n function LegendArrangement(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LegendArrangement_initFields() {\n LegendArrangement_initFields = function () {\n };\n LegendArrangement$HORIZONTAL_instance = new LegendArrangement('HORIZONTAL', 0);\n LegendArrangement$VERTICAL_instance = new LegendArrangement('VERTICAL', 1);\n }\n var LegendArrangement$HORIZONTAL_instance;\n function LegendArrangement$HORIZONTAL_getInstance() {\n LegendArrangement_initFields();\n return LegendArrangement$HORIZONTAL_instance;\n }\n var LegendArrangement$VERTICAL_instance;\n function LegendArrangement$VERTICAL_getInstance() {\n LegendArrangement_initFields();\n return LegendArrangement$VERTICAL_instance;\n }\n LegendArrangement.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendArrangement',\n interfaces: [Enum]\n };\n function LegendArrangement$values() {\n return [LegendArrangement$HORIZONTAL_getInstance(), LegendArrangement$VERTICAL_getInstance()];\n }\n LegendArrangement.values = LegendArrangement$values;\n function LegendArrangement$valueOf(name) {\n switch (name) {\n case 'HORIZONTAL':\n return LegendArrangement$HORIZONTAL_getInstance();\n case 'VERTICAL':\n return LegendArrangement$VERTICAL_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.guide.LegendArrangement.' + name);\n }\n }\n LegendArrangement.valueOf_61zpoe$ = LegendArrangement$valueOf;\n function LegendBox() {\n LegendBox$Companion_getInstance();\n SvgComponent.call(this);\n this.debug = false;\n }\n Object.defineProperty(LegendBox.prototype, 'title_aaysjy$_0', {\n configurable: true,\n get: function () {\n return this.spec.title;\n }\n });\n Object.defineProperty(LegendBox.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.spec.size;\n }\n });\n LegendBox.prototype.hasTitle_kmjss0$_0 = function () {\n return this.spec.hasTitle();\n };\n LegendBox.prototype.buildComponent = function () {\n this.addClassName_61zpoe$(Style_getInstance().LEGEND);\n var outerBounds = new DoubleRectangle(DoubleVector.Companion.ZERO, this.spec.size);\n this.addRectangle_7omvup$(this.spec.innerBounds, this.spec.theme.backgroundFill());\n var innerGroup = new SvgGElement();\n innerGroup.transform().set_11rb$(SvgComponent.Companion.buildTransform_e1sv3v$(this.spec.contentOrigin, 0.0));\n var l = this.spec.layout;\n if (this.hasTitle_kmjss0$_0()) {\n var label = this.createTitleLabel_d65hob$_0(l.titleLocation, l.titleHorizontalAnchor, l.titleVerticalAnchor);\n innerGroup.children().add_11rb$(label.rootGroup);\n }var graphGroup = new SvgGElement();\n graphGroup.transform().set_11rb$(SvgComponent.Companion.buildTransform_e1sv3v$(l.graphOrigin, 0.0));\n this.appendGuideContent_26jijc$(graphGroup);\n innerGroup.children().add_11rb$(graphGroup);\n if (this.debug) {\n this.addBorder_a5dgib$(outerBounds, Color.Companion.CYAN, 1.0);\n var rect = SvgRectElement_init(this.spec.innerBounds);\n rect.fillColor().set_11rb$(Color.Companion.BLACK);\n rect.strokeWidth().set_11rb$(0.0);\n rect.fillOpacity().set_11rb$(0.1);\n this.add_26jijc$(rect);\n this.addBorder_a5dgib$(this.spec.contentBounds, Color.Companion.DARK_MAGENTA, 1.0);\n this.addBorder_a5dgib$(l.titleBounds.add_gpjtzr$(this.spec.contentOrigin), Color.Companion.MAGENTA, 1.0);\n }this.add_26jijc$(innerGroup);\n };\n LegendBox.prototype.addBorder_a5dgib$ = function (bounds, strokeColor, strokeWidth) {\n this.add_26jijc$(LegendBox$Companion_getInstance().createBorder_a5dgib$(bounds, strokeColor, strokeWidth));\n };\n LegendBox.prototype.addRectangle_7omvup$ = function (bounds, fillColor) {\n this.add_26jijc$(LegendBox$Companion_getInstance().createRectangle_0(bounds, fillColor));\n };\n LegendBox.prototype.createTitleLabel_d65hob$_0 = function (origin, horizontalAnchor, verticalAnchor) {\n var label = new TextLabel(this.title_aaysjy$_0);\n label.addClassName_61zpoe$(Style_getInstance().LEGEND_TITLE);\n label.setHorizontalAnchor_ja80zo$(horizontalAnchor);\n label.setVerticalAnchor_yaudma$(verticalAnchor);\n label.moveTo_gpjtzr$(origin);\n return label;\n };\n function LegendBox$Companion() {\n LegendBox$Companion_instance = this;\n }\n LegendBox$Companion.prototype.createBorder_a5dgib$ = function (bounds, strokeColor, strokeWidth) {\n var rect = SvgRectElement_init(bounds);\n rect.strokeColor().set_11rb$(strokeColor);\n rect.strokeWidth().set_11rb$(strokeWidth);\n rect.fillOpacity().set_11rb$(0.0);\n return rect;\n };\n LegendBox$Companion.prototype.createRectangle_0 = function (bounds, fillColor) {\n var rect = SvgRectElement_init(bounds);\n rect.fillColor().set_11rb$(fillColor);\n return rect;\n };\n LegendBox$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendBox$Companion_instance = null;\n function LegendBox$Companion_getInstance() {\n if (LegendBox$Companion_instance === null) {\n new LegendBox$Companion();\n }return LegendBox$Companion_instance;\n }\n LegendBox.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBox',\n interfaces: [SvgComponent]\n };\n function LegendBoxLayout(title, legendDirection) {\n LegendBoxLayout$Companion_getInstance();\n this.title_47v7cs$_0 = title;\n this.isHorizontal = legendDirection === LegendDirection$HORIZONTAL_getInstance();\n this.titleHorizontalAnchor = TextLabel$HorizontalAnchor.LEFT;\n var tmp$;\n if (this.isHorizontal) {\n tmp$ = TextLabel$VerticalAnchor.CENTER;\n } else {\n tmp$ = TextLabel$VerticalAnchor.TOP;\n }\n this.titleVerticalAnchor = tmp$;\n }\n Object.defineProperty(LegendBoxLayout.prototype, 'titleBounds', {\n configurable: true,\n get: function () {\n var origin = this.titleLocation;\n var size = LegendBoxLayout$Companion_getInstance().titleSize_0(this.title_47v7cs$_0);\n if (this.isHorizontal) {\n origin = new DoubleVector(origin.x, origin.y - size.y / 2);\n }return new DoubleRectangle(origin, size);\n }\n });\n Object.defineProperty(LegendBoxLayout.prototype, 'graphOrigin', {\n configurable: true,\n get: function () {\n if (this.isHorizontal)\n return new DoubleVector(LegendBoxLayout$Companion_getInstance().titleSize_0(this.title_47v7cs$_0).x, 0.0);\n else\n return new DoubleVector(0.0, LegendBoxLayout$Companion_getInstance().titleSize_0(this.title_47v7cs$_0).y);\n }\n });\n Object.defineProperty(LegendBoxLayout.prototype, 'size', {\n configurable: true,\n get: function () {\n var graphBounds = new DoubleRectangle(this.graphOrigin, this.graphSize);\n var titleAndContent = (new DoubleRectangle(DoubleVector.Companion.ZERO, DoubleVector.Companion.ZERO)).union_wthzt5$(this.titleBounds).union_wthzt5$(graphBounds);\n return titleAndContent.dimension;\n }\n });\n Object.defineProperty(LegendBoxLayout.prototype, 'titleLocation', {\n configurable: true,\n get: function () {\n if (this.isHorizontal) {\n var graphSize = this.graphSize;\n return new DoubleVector(0.0, graphSize.y / 2);\n } else {\n var y = -LegendBoxLayout$Companion_getInstance().TITLE_SPEC_0.height() / 3;\n return new DoubleVector(0.0, y);\n }\n }\n });\n function LegendBoxLayout$Companion() {\n LegendBoxLayout$Companion_instance = this;\n this.TITLE_SPEC_0 = PlotLabelSpec$LEGEND_TITLE_getInstance();\n this.LABEL_SPEC_8be2vx$ = PlotLabelSpec$LEGEND_ITEM_getInstance();\n }\n LegendBoxLayout$Companion.prototype.titleSize_0 = function (s) {\n var tmp$;\n if (isBlank(s))\n tmp$ = DoubleVector.Companion.ZERO;\n else\n tmp$ = this.TITLE_SPEC_0.dimensions_za3lpa$(s.length);\n return tmp$;\n };\n LegendBoxLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendBoxLayout$Companion_instance = null;\n function LegendBoxLayout$Companion_getInstance() {\n if (LegendBoxLayout$Companion_instance === null) {\n new LegendBoxLayout$Companion();\n }return LegendBoxLayout$Companion_instance;\n }\n LegendBoxLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBoxLayout',\n interfaces: []\n };\n function LegendBoxSpec(title, theme, reverse) {\n this.title = title;\n this.theme = theme;\n this.reverse = reverse;\n this.contentOrigin = null;\n this.fullContentExtend_5hau13$_0 = null;\n this.innerOrigin_3w1y5t$_0 = null;\n this.innerContentExtend_wllzuc$_0 = null;\n var contentExpand = this.theme.margin() + this.theme.padding();\n this.contentOrigin = new DoubleVector(contentExpand, contentExpand);\n this.fullContentExtend_5hau13$_0 = new DoubleVector(contentExpand * 2, contentExpand * 2);\n this.innerOrigin_3w1y5t$_0 = new DoubleVector(this.theme.margin(), this.theme.margin());\n this.innerContentExtend_wllzuc$_0 = new DoubleVector(this.theme.padding() * 2, this.theme.padding() * 2);\n }\n Object.defineProperty(LegendBoxSpec.prototype, 'contentSize_cb71ch$_0', {\n configurable: true,\n get: function () {\n return this.layout.size;\n }\n });\n Object.defineProperty(LegendBoxSpec.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.contentSize_cb71ch$_0.add_gpjtzr$(this.fullContentExtend_5hau13$_0);\n }\n });\n Object.defineProperty(LegendBoxSpec.prototype, 'innerBounds', {\n configurable: true,\n get: function () {\n return new DoubleRectangle(this.innerOrigin_3w1y5t$_0, this.contentSize_cb71ch$_0.add_gpjtzr$(this.innerContentExtend_wllzuc$_0));\n }\n });\n Object.defineProperty(LegendBoxSpec.prototype, 'contentBounds', {\n configurable: true,\n get: function () {\n return new DoubleRectangle(this.contentOrigin, this.contentSize_cb71ch$_0);\n }\n });\n LegendBoxSpec.prototype.hasTitle = function () {\n return !isBlank(this.title);\n };\n LegendBoxSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBoxSpec',\n interfaces: []\n };\n function LegendBreak(label) {\n LegendBreak$Companion_getInstance();\n this.label = label;\n this.myLayers_0 = ArrayList_init();\n }\n Object.defineProperty(LegendBreak.prototype, 'minimumKeySize', {\n configurable: true,\n get: function () {\n var tmp$;\n var minSize = DoubleVector.Companion.ZERO;\n tmp$ = this.myLayers_0.iterator();\n while (tmp$.hasNext()) {\n var layer = tmp$.next();\n var layerMinKeySize = layer.keyElementFactory.minimumKeySize_l6g9mh$(layer.dataPoint);\n minSize = minSize.max_gpjtzr$(layerMinKeySize);\n }\n return minSize;\n }\n });\n Object.defineProperty(LegendBreak.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return this.myLayers_0.isEmpty();\n }\n });\n LegendBreak.prototype.addLayer_w0u015$ = function (dataPoint, keyElementFactory) {\n this.myLayers_0.add_11rb$(new LegendBreak$LegendBreakLayer(dataPoint, keyElementFactory));\n };\n LegendBreak.prototype.createKeyElement_gpjtzr$ = function (size) {\n var tmp$;\n var g = new SvgGElement();\n tmp$ = this.myLayers_0.iterator();\n while (tmp$.hasNext()) {\n var layer = tmp$.next();\n var keyElement = layer.keyElementFactory.createKeyElement_s1fn0c$(layer.dataPoint, size);\n g.children().add_11rb$(keyElement);\n }\n return g;\n };\n function LegendBreak$LegendBreakLayer(dataPoint, keyElementFactory) {\n this.dataPoint = dataPoint;\n this.keyElementFactory = keyElementFactory;\n }\n LegendBreak$LegendBreakLayer.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBreakLayer',\n interfaces: []\n };\n function LegendBreak$Companion() {\n LegendBreak$Companion_instance = this;\n }\n LegendBreak$Companion.prototype.simple_998ysp$ = function (label, dataPoint, keyElementFactory) {\n var br = new LegendBreak(label);\n br.addLayer_w0u015$(dataPoint, keyElementFactory);\n return br;\n };\n LegendBreak$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendBreak$Companion_instance = null;\n function LegendBreak$Companion_getInstance() {\n if (LegendBreak$Companion_instance === null) {\n new LegendBreak$Companion();\n }return LegendBreak$Companion_instance;\n }\n LegendBreak.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBreak',\n interfaces: []\n };\n function LegendComponent(spec) {\n LegendBox.call(this);\n this.spec_8zhhsr$_0 = spec;\n }\n Object.defineProperty(LegendComponent.prototype, 'spec', {\n get: function () {\n return this.spec_8zhhsr$_0;\n }\n });\n LegendComponent.prototype.appendGuideContent_26jijc$ = function (contentRoot) {\n var tmp$;\n var layout = this.spec.layout;\n var keyLabelBoxes = layout.keyLabelBoxes.iterator();\n var labelBoxes = layout.labelBoxes.iterator();\n tmp$ = this.spec.breaks_8be2vx$.iterator();\n while (tmp$.hasNext()) {\n var br = tmp$.next();\n var keyLabelBox = keyLabelBoxes.next();\n var labelBox = labelBoxes.next();\n var breakElement = this.createBreakElement_0(br, layout.keySize, keyLabelBox, labelBox);\n contentRoot.children().add_11rb$(breakElement);\n }\n return layout.size;\n };\n LegendComponent.prototype.createBreakElement_0 = function (br, keySize, keyLabelBox, labelBox) {\n var breakComponent = new GroupComponent();\n breakComponent.add_26jijc$(this.createKeyElement_0(br, keySize));\n var label = new TextLabel(br.label);\n label.setHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.LEFT);\n label.setVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.CENTER);\n label.moveTo_gpjtzr$(labelBox.origin.add_gpjtzr$(new DoubleVector(0.0, labelBox.height / 2)));\n breakComponent.add_8icvvv$(label);\n breakComponent.moveTo_gpjtzr$(keyLabelBox.origin);\n return breakComponent.rootGroup;\n };\n LegendComponent.prototype.createKeyElement_0 = function (legendBreak, size) {\n var g = new SvgGElement();\n var innerSize = new DoubleVector(size.x - 2, size.y - 2);\n var backgroundFill = this.spec.theme.backgroundFill();\n var backgroundRect = SvgRectElement_init_0(1.0, 1.0, innerSize.x, innerSize.y);\n backgroundRect.strokeWidth().set_11rb$(1.0);\n backgroundRect.strokeColor().set_11rb$(backgroundFill);\n backgroundRect.fillColor().set_11rb$(backgroundFill);\n g.children().add_11rb$(backgroundRect);\n var keyElement = legendBreak.createKeyElement_gpjtzr$(innerSize);\n var keyElementTransform = SvgComponent.Companion.buildTransform_e1sv3v$(new DoubleVector(1.0, 1.0), 0.0);\n keyElement.transform().set_11rb$(keyElementTransform);\n g.children().add_11rb$(keyElement);\n var frame = SvgRectElement_init_0(0.0, 0.0, size.x, size.y);\n frame.strokeWidth().set_11rb$(1.0);\n frame.strokeColor().set_11rb$(backgroundFill);\n frame.fill().set_11rb$(SvgColors.NONE);\n g.children().add_11rb$(frame);\n return g;\n };\n LegendComponent.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendComponent',\n interfaces: [LegendBox]\n };\n function LegendComponentLayout(title, breaks, keySize, legendDirection) {\n LegendComponentLayout$Companion_getInstance();\n LegendBoxLayout.call(this, title, legendDirection);\n this.breaks = breaks;\n this.keySize = keySize;\n this.myContentSize_8rvo9o$_0 = null;\n this.myKeyLabelBoxes_uk7fn2$_0 = ArrayList_init();\n this.myLabelBoxes_9jhh53$_0 = ArrayList_init();\n this.isFillByRow = false;\n this.rowCount_kvp0d1$_0 = 0;\n this.colCount_nojzuj$_0 = 0;\n }\n Object.defineProperty(LegendComponentLayout.prototype, 'rowCount', {\n configurable: true,\n get: function () {\n return this.rowCount_kvp0d1$_0;\n },\n set: function (rowCount) {\n if (!(rowCount > 0)) {\n var message = 'Row count must be greater than 0, was ' + rowCount;\n throw IllegalStateException_init(message.toString());\n }this.rowCount_kvp0d1$_0 = rowCount;\n }\n });\n Object.defineProperty(LegendComponentLayout.prototype, 'colCount', {\n configurable: true,\n get: function () {\n return this.colCount_nojzuj$_0;\n },\n set: function (colCount) {\n if (!(colCount > 0)) {\n var message = 'Col count must be greater than 0, was ' + colCount;\n throw IllegalStateException_init(message.toString());\n }this.colCount_nojzuj$_0 = colCount;\n }\n });\n Object.defineProperty(LegendComponentLayout.prototype, 'graphSize', {\n configurable: true,\n get: function () {\n this.ensureInited_chkycd$_0();\n return ensureNotNull(this.myContentSize_8rvo9o$_0);\n }\n });\n Object.defineProperty(LegendComponentLayout.prototype, 'keyLabelBoxes', {\n configurable: true,\n get: function () {\n this.ensureInited_chkycd$_0();\n return this.myKeyLabelBoxes_uk7fn2$_0;\n }\n });\n Object.defineProperty(LegendComponentLayout.prototype, 'labelBoxes', {\n configurable: true,\n get: function () {\n this.ensureInited_chkycd$_0();\n return this.myLabelBoxes_9jhh53$_0;\n }\n });\n LegendComponentLayout.prototype.ensureInited_chkycd$_0 = function () {\n if (this.myContentSize_8rvo9o$_0 == null) {\n this.doLayout_zctv6z$_0();\n }};\n LegendComponentLayout.prototype.doLayout_zctv6z$_0 = function () {\n var tmp$;\n var labelHeight = LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.height();\n var labelLeftMargin = LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(1) / 2;\n var labelHOffset = this.keySize.x + labelLeftMargin;\n var labelVOffset = (this.keySize.y - labelHeight) / 2;\n var contentOrigin = DoubleVector.Companion.ZERO;\n var breakBoxBounds = null;\n tmp$ = this.breaks;\n for (var i = 0; i !== tmp$.size; ++i) {\n var tmp$_0;\n var labelSize = this.labelSize_za3lpa$(i);\n var breakBoxSize = new DoubleVector(labelHOffset + labelSize.x, this.keySize.y);\n breakBoxBounds = new DoubleRectangle((tmp$_0 = breakBoxBounds != null ? this.breakBoxOrigin_b4d9xv$(i, breakBoxBounds) : null) != null ? tmp$_0 : contentOrigin, breakBoxSize);\n this.myKeyLabelBoxes_uk7fn2$_0.add_11rb$(breakBoxBounds);\n this.myLabelBoxes_9jhh53$_0.add_11rb$(DoubleRectangle_init(labelHOffset, labelVOffset, labelSize.x, labelSize.y));\n }\n this.myContentSize_8rvo9o$_0 = GeometryUtil_getInstance().union_a7nkjf$(new DoubleRectangle(contentOrigin, DoubleVector.Companion.ZERO), this.myKeyLabelBoxes_uk7fn2$_0).dimension;\n };\n function LegendComponentLayout$MyHorizontal(title, breaks, keySize) {\n LegendComponentLayout.call(this, title, breaks, keySize, LegendDirection$HORIZONTAL_getInstance());\n this.colCount = breaks.size;\n this.rowCount = 1;\n }\n LegendComponentLayout$MyHorizontal.prototype.breakBoxOrigin_b4d9xv$ = function (index, prevBreakBoxBounds) {\n return new DoubleVector(prevBreakBoxBounds.right, 0.0);\n };\n LegendComponentLayout$MyHorizontal.prototype.labelSize_za3lpa$ = function (index) {\n var label = this.breaks.get_za3lpa$(index).label;\n return new DoubleVector(LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(label.length), LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.height());\n };\n LegendComponentLayout$MyHorizontal.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyHorizontal',\n interfaces: [LegendComponentLayout]\n };\n function LegendComponentLayout$MyHorizontalMultiRow(title, breaks, keySize) {\n LegendComponentLayout$MyMultiRow.call(this, title, breaks, keySize, LegendDirection$HORIZONTAL_getInstance());\n this.colCount = breaks.size;\n this.rowCount = 1;\n }\n LegendComponentLayout$MyHorizontalMultiRow.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyHorizontalMultiRow',\n interfaces: [LegendComponentLayout$MyMultiRow]\n };\n function LegendComponentLayout$MyVertical(title, breaks, keySize) {\n LegendComponentLayout$MyMultiRow.call(this, title, breaks, keySize, LegendDirection$VERTICAL_getInstance());\n this.colCount = 1;\n this.rowCount = breaks.size;\n }\n LegendComponentLayout$MyVertical.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyVertical',\n interfaces: [LegendComponentLayout$MyMultiRow]\n };\n function LegendComponentLayout$MyMultiRow(title, breaks, keySize, legendDirection) {\n LegendComponentLayout.call(this, title, breaks, keySize, legendDirection);\n this.myMaxLabelWidth_0 = 0.0;\n var tmp$;\n tmp$ = breaks.iterator();\n while (tmp$.hasNext()) {\n var br = tmp$.next();\n var a = this.myMaxLabelWidth_0;\n var b = LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.width_za3lpa$(br.label.length);\n this.myMaxLabelWidth_0 = JsMath.max(a, b);\n }\n }\n LegendComponentLayout$MyMultiRow.prototype.breakBoxOrigin_b4d9xv$ = function (index, prevBreakBoxBounds) {\n var tmp$, tmp$_0;\n if (this.isFillByRow) {\n if (index % this.colCount === 0) {\n tmp$ = new DoubleVector(0.0, prevBreakBoxBounds.bottom);\n } else\n tmp$ = new DoubleVector(prevBreakBoxBounds.right, prevBreakBoxBounds.top);\n return tmp$;\n }if (index % this.rowCount === 0) {\n tmp$_0 = new DoubleVector(prevBreakBoxBounds.right, 0.0);\n } else\n tmp$_0 = new DoubleVector(prevBreakBoxBounds.left, prevBreakBoxBounds.bottom);\n return tmp$_0;\n };\n LegendComponentLayout$MyMultiRow.prototype.labelSize_za3lpa$ = function (index) {\n return new DoubleVector(this.myMaxLabelWidth_0, LegendBoxLayout$Companion_getInstance().LABEL_SPEC_8be2vx$.height());\n };\n LegendComponentLayout$MyMultiRow.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyMultiRow',\n interfaces: [LegendComponentLayout]\n };\n function LegendComponentLayout$Companion() {\n LegendComponentLayout$Companion_instance = this;\n }\n LegendComponentLayout$Companion.prototype.horizontal_2y8ibu$ = function (title, breaks, keySize) {\n return new LegendComponentLayout$MyHorizontal(title, breaks, keySize);\n };\n LegendComponentLayout$Companion.prototype.horizontalMultiRow_2y8ibu$ = function (title, breaks, keySize) {\n return new LegendComponentLayout$MyHorizontalMultiRow(title, breaks, keySize);\n };\n LegendComponentLayout$Companion.prototype.vertical_2y8ibu$ = function (title, breaks, keySize) {\n return new LegendComponentLayout$MyVertical(title, breaks, keySize);\n };\n LegendComponentLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendComponentLayout$Companion_instance = null;\n function LegendComponentLayout$Companion_getInstance() {\n if (LegendComponentLayout$Companion_instance === null) {\n new LegendComponentLayout$Companion();\n }return LegendComponentLayout$Companion_instance;\n }\n LegendComponentLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendComponentLayout',\n interfaces: [LegendBoxLayout]\n };\n function LegendComponentSpec(title, breaks, theme, layout, reverse) {\n LegendBoxSpec.call(this, title, theme, reverse);\n this.breaks_8be2vx$ = breaks;\n this.layout_ebqbgv$_0 = layout;\n }\n Object.defineProperty(LegendComponentSpec.prototype, 'layout', {\n get: function () {\n return this.layout_ebqbgv$_0;\n }\n });\n LegendComponentSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendComponentSpec',\n interfaces: [LegendBoxSpec]\n };\n function LegendDirection(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LegendDirection_initFields() {\n LegendDirection_initFields = function () {\n };\n LegendDirection$HORIZONTAL_instance = new LegendDirection('HORIZONTAL', 0);\n LegendDirection$VERTICAL_instance = new LegendDirection('VERTICAL', 1);\n LegendDirection$AUTO_instance = new LegendDirection('AUTO', 2);\n }\n var LegendDirection$HORIZONTAL_instance;\n function LegendDirection$HORIZONTAL_getInstance() {\n LegendDirection_initFields();\n return LegendDirection$HORIZONTAL_instance;\n }\n var LegendDirection$VERTICAL_instance;\n function LegendDirection$VERTICAL_getInstance() {\n LegendDirection_initFields();\n return LegendDirection$VERTICAL_instance;\n }\n var LegendDirection$AUTO_instance;\n function LegendDirection$AUTO_getInstance() {\n LegendDirection_initFields();\n return LegendDirection$AUTO_instance;\n }\n LegendDirection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendDirection',\n interfaces: [Enum]\n };\n function LegendDirection$values() {\n return [LegendDirection$HORIZONTAL_getInstance(), LegendDirection$VERTICAL_getInstance(), LegendDirection$AUTO_getInstance()];\n }\n LegendDirection.values = LegendDirection$values;\n function LegendDirection$valueOf(name) {\n switch (name) {\n case 'HORIZONTAL':\n return LegendDirection$HORIZONTAL_getInstance();\n case 'VERTICAL':\n return LegendDirection$VERTICAL_getInstance();\n case 'AUTO':\n return LegendDirection$AUTO_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.guide.LegendDirection.' + name);\n }\n }\n LegendDirection.valueOf_61zpoe$ = LegendDirection$valueOf;\n function LegendJustification(x, y) {\n LegendJustification$Companion_getInstance();\n this.x = x;\n this.y = y;\n }\n function LegendJustification$Companion() {\n LegendJustification$Companion_instance = this;\n this.CENTER = new LegendJustification(0.5, 0.5);\n }\n LegendJustification$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendJustification$Companion_instance = null;\n function LegendJustification$Companion_getInstance() {\n if (LegendJustification$Companion_instance === null) {\n new LegendJustification$Companion();\n }return LegendJustification$Companion_instance;\n }\n LegendJustification.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendJustification',\n interfaces: []\n };\n function LegendPosition(x, y) {\n LegendPosition$Companion_getInstance();\n this.x = x;\n this.y = y;\n }\n Object.defineProperty(LegendPosition.prototype, 'isFixed', {\n configurable: true,\n get: function () {\n return this === LegendPosition$Companion_getInstance().LEFT || this === LegendPosition$Companion_getInstance().RIGHT || this === LegendPosition$Companion_getInstance().TOP || this === LegendPosition$Companion_getInstance().BOTTOM;\n }\n });\n Object.defineProperty(LegendPosition.prototype, 'isHidden', {\n configurable: true,\n get: function () {\n return this === LegendPosition$Companion_getInstance().NONE;\n }\n });\n Object.defineProperty(LegendPosition.prototype, 'isOverlay', {\n configurable: true,\n get: function () {\n return !(this.isFixed || this.isHidden);\n }\n });\n function LegendPosition$Companion() {\n LegendPosition$Companion_instance = this;\n this.RIGHT = new LegendPosition(1.0, 0.5);\n this.LEFT = new LegendPosition(0.0, 0.5);\n this.TOP = new LegendPosition(0.5, 1.0);\n this.BOTTOM = new LegendPosition(0.5, 1.0);\n this.NONE = new LegendPosition(kotlin_js_internal_DoubleCompanionObject.NaN, kotlin_js_internal_DoubleCompanionObject.NaN);\n }\n LegendPosition$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendPosition$Companion_instance = null;\n function LegendPosition$Companion_getInstance() {\n if (LegendPosition$Companion_instance === null) {\n new LegendPosition$Companion();\n }return LegendPosition$Companion_instance;\n }\n LegendPosition.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendPosition',\n interfaces: []\n };\n function Orientation(name, ordinal, myValue) {\n Enum.call(this);\n this.myValue_3zu241$_0 = myValue;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function Orientation_initFields() {\n Orientation_initFields = function () {\n };\n Orientation$LEFT_instance = new Orientation('LEFT', 0, 'LEFT');\n Orientation$RIGHT_instance = new Orientation('RIGHT', 1, 'RIGHT');\n Orientation$TOP_instance = new Orientation('TOP', 2, 'TOP');\n Orientation$BOTTOM_instance = new Orientation('BOTTOM', 3, 'BOTTOM');\n }\n var Orientation$LEFT_instance;\n function Orientation$LEFT_getInstance() {\n Orientation_initFields();\n return Orientation$LEFT_instance;\n }\n var Orientation$RIGHT_instance;\n function Orientation$RIGHT_getInstance() {\n Orientation_initFields();\n return Orientation$RIGHT_instance;\n }\n var Orientation$TOP_instance;\n function Orientation$TOP_getInstance() {\n Orientation_initFields();\n return Orientation$TOP_instance;\n }\n var Orientation$BOTTOM_instance;\n function Orientation$BOTTOM_getInstance() {\n Orientation_initFields();\n return Orientation$BOTTOM_instance;\n }\n Object.defineProperty(Orientation.prototype, 'isHorizontal', {\n configurable: true,\n get: function () {\n return this === Orientation$TOP_getInstance() || this === Orientation$BOTTOM_getInstance();\n }\n });\n Orientation.prototype.toString = function () {\n return 'Orientation{' + \"myValue='\" + this.myValue_3zu241$_0 + String.fromCharCode(39) + String.fromCharCode(125);\n };\n Orientation.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Orientation',\n interfaces: [Enum]\n };\n function Orientation$values() {\n return [Orientation$LEFT_getInstance(), Orientation$RIGHT_getInstance(), Orientation$TOP_getInstance(), Orientation$BOTTOM_getInstance()];\n }\n Orientation.values = Orientation$values;\n function Orientation$valueOf(name) {\n switch (name) {\n case 'LEFT':\n return Orientation$LEFT_getInstance();\n case 'RIGHT':\n return Orientation$RIGHT_getInstance();\n case 'TOP':\n return Orientation$TOP_getInstance();\n case 'BOTTOM':\n return Orientation$BOTTOM_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.guide.Orientation.' + name);\n }\n }\n Orientation.valueOf_61zpoe$ = Orientation$valueOf;\n function ContextualMappingProvider() {\n ContextualMappingProvider$Companion_getInstance();\n }\n function ContextualMappingProvider$Companion() {\n ContextualMappingProvider$Companion_instance = this;\n this.NONE = new ContextualMappingProvider$Companion$NONE$ObjectLiteral();\n }\n function ContextualMappingProvider$Companion$NONE$ObjectLiteral() {\n }\n ContextualMappingProvider$Companion$NONE$ObjectLiteral.prototype.createContextualMapping_8fr62e$ = function (dataAccess, dataFrame) {\n return new ContextualMapping(emptyList(), null, null, null, false, false, false, false);\n };\n ContextualMappingProvider$Companion$NONE$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [ContextualMappingProvider]\n };\n ContextualMappingProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ContextualMappingProvider$Companion_instance = null;\n function ContextualMappingProvider$Companion_getInstance() {\n if (ContextualMappingProvider$Companion_instance === null) {\n new ContextualMappingProvider$Companion();\n }return ContextualMappingProvider$Companion_instance;\n }\n ContextualMappingProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ContextualMappingProvider',\n interfaces: []\n };\n function GeomInteraction(builder) {\n GeomInteraction$Companion_getInstance();\n this.myLocatorLookupSpace_0 = builder.locatorLookupSpace;\n this.myLocatorLookupStrategy_0 = builder.locatorLookupStrategy;\n this.myTooltipLines_0 = builder.tooltipLines;\n this.myTooltipProperties_0 = builder.tooltipProperties;\n this.myIgnoreInvisibleTargets_0 = builder.isIgnoringInvisibleTargets();\n this.myIsCrosshairEnabled_0 = builder.isCrosshairEnabled;\n }\n GeomInteraction.prototype.createLookupSpec = function () {\n return new GeomTargetLocator$LookupSpec(this.myLocatorLookupSpace_0, this.myLocatorLookupStrategy_0);\n };\n GeomInteraction.prototype.createContextualMapping_8fr62e$ = function (dataAccess, dataFrame) {\n var tmp$ = GeomInteraction$Companion_getInstance();\n var $receiver = this.myTooltipLines_0;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(TooltipLine_init(item));\n }\n return tmp$.createContextualMapping_0(destination, dataAccess, dataFrame, this.myTooltipProperties_0, this.myIgnoreInvisibleTargets_0, this.myIsCrosshairEnabled_0);\n };\n function GeomInteraction$Companion() {\n GeomInteraction$Companion_instance = this;\n }\n GeomInteraction$Companion.prototype.createTestContextualMapping_fdc7hd$ = function (aesListForTooltip, axisAes, outliers, dataAccess, dataFrame, userDefinedValueSources) {\n if (userDefinedValueSources === void 0)\n userDefinedValueSources = null;\n var defaultTooltipLines = GeomInteractionBuilder$Companion_getInstance().defaultValueSourceTooltipLines_dnbe1t$(aesListForTooltip, axisAes, outliers, userDefinedValueSources);\n return this.createContextualMapping_0(defaultTooltipLines, dataAccess, dataFrame, TooltipSpecification$TooltipProperties$Companion_getInstance().NONE, false, false);\n };\n GeomInteraction$Companion.prototype.createContextualMapping_0 = function (tooltipLines, dataAccess, dataFrame, tooltipProperties, ignoreInvisibleTargets, isCrosshairEnabled) {\n var dataContext = new DataContext(dataFrame, dataAccess);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = tooltipLines.iterator();\n loop_label: while (tmp$.hasNext()) {\n var element = tmp$.next();\n var $receiver = element.fields;\n var destination_0 = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n if (Kotlin.isType(element_0, MappingValue))\n destination_0.add_11rb$(element_0);\n }\n var dataAesList = destination_0;\n var all$result;\n all$break: do {\n var tmp$_1;\n if (Kotlin.isType(dataAesList, Collection) && dataAesList.isEmpty()) {\n all$result = true;\n break all$break;\n }tmp$_1 = dataAesList.iterator();\n while (tmp$_1.hasNext()) {\n var element_1 = tmp$_1.next();\n if (!dataAccess.isMapped_896ixz$(element_1.aes)) {\n all$result = false;\n break all$break;\n }}\n all$result = true;\n }\n while (false);\n if (all$result)\n destination.add_11rb$(element);\n }\n var mappedTooltipLines = destination;\n var tmp$_2;\n tmp$_2 = mappedTooltipLines.iterator();\n while (tmp$_2.hasNext()) {\n var element_2 = tmp$_2.next();\n element_2.initDataContext_rxi9tf$(dataContext);\n }\n var any$result;\n any$break: do {\n var tmp$_3;\n if (Kotlin.isType(mappedTooltipLines, Collection) && mappedTooltipLines.isEmpty()) {\n any$result = false;\n break any$break;\n }tmp$_3 = mappedTooltipLines.iterator();\n loop_label: while (tmp$_3.hasNext()) {\n var element_3 = tmp$_3.next();\n var $receiver_0 = element_3.fields;\n var predicate = getPropertyCallableRef('isOutlier', 1, function ($receiver) {\n return $receiver.isOutlier;\n });\n var none$result;\n none$break: do {\n var tmp$_4;\n if (Kotlin.isType($receiver_0, Collection) && $receiver_0.isEmpty()) {\n none$result = true;\n break none$break;\n }tmp$_4 = $receiver_0.iterator();\n while (tmp$_4.hasNext()) {\n var element_4 = tmp$_4.next();\n if (predicate(element_4)) {\n none$result = false;\n break none$break;\n }}\n none$result = true;\n }\n while (false);\n if (none$result) {\n any$result = true;\n break any$break;\n }}\n any$result = false;\n }\n while (false);\n var hasGeneralTooltip = any$result;\n var any$result_0;\n any$break: do {\n var tmp$_5;\n if (Kotlin.isType(mappedTooltipLines, Collection) && mappedTooltipLines.isEmpty()) {\n any$result_0 = false;\n break any$break;\n }tmp$_5 = mappedTooltipLines.iterator();\n loop_label: while (tmp$_5.hasNext()) {\n var element_5 = tmp$_5.next();\n var $receiver_1 = element_5.fields;\n var predicate_0 = getPropertyCallableRef('isAxis', 1, function ($receiver) {\n return $receiver.isAxis;\n });\n var any$result_1;\n any$break_0: do {\n var tmp$_6;\n if (Kotlin.isType($receiver_1, Collection) && $receiver_1.isEmpty()) {\n any$result_1 = false;\n break any$break_0;\n }tmp$_6 = $receiver_1.iterator();\n while (tmp$_6.hasNext()) {\n var element_6 = tmp$_6.next();\n if (predicate_0(element_6)) {\n any$result_1 = true;\n break any$break_0;\n }}\n any$result_1 = false;\n }\n while (false);\n if (any$result_1) {\n any$result_0 = true;\n break any$break;\n }}\n any$result_0 = false;\n }\n while (false);\n var hasAxisTooltip = any$result_0;\n return new ContextualMapping(mappedTooltipLines, tooltipProperties.anchor, tooltipProperties.minWidth, tooltipProperties.color, ignoreInvisibleTargets, hasGeneralTooltip, hasAxisTooltip, isCrosshairEnabled);\n };\n GeomInteraction$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomInteraction$Companion_instance = null;\n function GeomInteraction$Companion_getInstance() {\n if (GeomInteraction$Companion_instance === null) {\n new GeomInteraction$Companion();\n }return GeomInteraction$Companion_instance;\n }\n GeomInteraction.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomInteraction',\n interfaces: [ContextualMappingProvider]\n };\n function GeomInteractionBuilder(mySupportedAesList) {\n GeomInteractionBuilder$Companion_getInstance();\n this.mySupportedAesList_0 = mySupportedAesList;\n this.myIgnoreInvisibleTargets_0 = false;\n this.locatorLookupSpace_3dt62f$_0 = this.locatorLookupSpace_3dt62f$_0;\n this.locatorLookupStrategy_gpx4i$_0 = this.locatorLookupStrategy_gpx4i$_0;\n this.myAxisTooltipVisibilityFromFunctionKind_0 = false;\n this.myAxisTooltipVisibilityFromConfig_0 = null;\n this.myAxisAesFromFunctionKind_0 = null;\n this.myTooltipAxisAes_vm9teg$_0 = this.myTooltipAxisAes_vm9teg$_0;\n this.myTooltipAes_um80ux$_0 = this.myTooltipAes_um80ux$_0;\n this.myTooltipOutlierAesList_r7qit3$_0 = this.myTooltipOutlierAesList_r7qit3$_0;\n this.myTooltipConstantsAesList_0 = null;\n this.myUserTooltipSpec_0 = null;\n this.myIsCrosshairEnabled_0 = false;\n }\n Object.defineProperty(GeomInteractionBuilder.prototype, 'locatorLookupSpace', {\n configurable: true,\n get: function () {\n if (this.locatorLookupSpace_3dt62f$_0 == null)\n return throwUPAE('locatorLookupSpace');\n return this.locatorLookupSpace_3dt62f$_0;\n },\n set: function (locatorLookupSpace) {\n this.locatorLookupSpace_3dt62f$_0 = locatorLookupSpace;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'locatorLookupStrategy', {\n configurable: true,\n get: function () {\n if (this.locatorLookupStrategy_gpx4i$_0 == null)\n return throwUPAE('locatorLookupStrategy');\n return this.locatorLookupStrategy_gpx4i$_0;\n },\n set: function (locatorLookupStrategy) {\n this.locatorLookupStrategy_gpx4i$_0 = locatorLookupStrategy;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'myTooltipAxisAes_0', {\n configurable: true,\n get: function () {\n if (this.myTooltipAxisAes_vm9teg$_0 == null)\n return throwUPAE('myTooltipAxisAes');\n return this.myTooltipAxisAes_vm9teg$_0;\n },\n set: function (myTooltipAxisAes) {\n this.myTooltipAxisAes_vm9teg$_0 = myTooltipAxisAes;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'myTooltipAes_0', {\n configurable: true,\n get: function () {\n if (this.myTooltipAes_um80ux$_0 == null)\n return throwUPAE('myTooltipAes');\n return this.myTooltipAes_um80ux$_0;\n },\n set: function (myTooltipAes) {\n this.myTooltipAes_um80ux$_0 = myTooltipAes;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'myTooltipOutlierAesList_0', {\n configurable: true,\n get: function () {\n if (this.myTooltipOutlierAesList_r7qit3$_0 == null)\n return throwUPAE('myTooltipOutlierAesList');\n return this.myTooltipOutlierAesList_r7qit3$_0;\n },\n set: function (myTooltipOutlierAesList) {\n this.myTooltipOutlierAesList_r7qit3$_0 = myTooltipOutlierAesList;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'getAxisFromFunctionKind', {\n configurable: true,\n get: function () {\n var tmp$;\n return (tmp$ = this.myAxisAesFromFunctionKind_0) != null ? tmp$ : emptyList();\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'isAxisTooltipEnabled', {\n configurable: true,\n get: function () {\n return this.myAxisTooltipVisibilityFromConfig_0 == null ? this.myAxisTooltipVisibilityFromFunctionKind_0 : ensureNotNull(this.myAxisTooltipVisibilityFromConfig_0);\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'tooltipLines', {\n configurable: true,\n get: function () {\n return this.prepareTooltipValueSources_0();\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'tooltipProperties', {\n configurable: true,\n get: function () {\n var tmp$, tmp$_0;\n return (tmp$_0 = (tmp$ = this.myUserTooltipSpec_0) != null ? tmp$.tooltipProperties : null) != null ? tmp$_0 : TooltipSpecification$TooltipProperties$Companion_getInstance().NONE;\n }\n });\n Object.defineProperty(GeomInteractionBuilder.prototype, 'isCrosshairEnabled', {\n configurable: true,\n get: function () {\n return this.myIsCrosshairEnabled_0;\n }\n });\n GeomInteractionBuilder.prototype.showAxisTooltip_6taknv$ = function (isTrue) {\n this.myAxisTooltipVisibilityFromConfig_0 = isTrue;\n return this;\n };\n GeomInteractionBuilder.prototype.tooltipAes_3lrecq$ = function (aes) {\n this.myTooltipAes_0 = aes;\n return this;\n };\n GeomInteractionBuilder.prototype.axisAes_3lrecq$ = function (axisAes) {\n this.myTooltipAxisAes_0 = axisAes;\n return this;\n };\n GeomInteractionBuilder.prototype.tooltipOutliers_3lrecq$ = function (aes) {\n this.myTooltipOutlierAesList_0 = aes;\n return this;\n };\n GeomInteractionBuilder.prototype.tooltipConstants_ayg7dr$ = function (constantsMap) {\n this.myTooltipConstantsAesList_0 = constantsMap;\n return this;\n };\n GeomInteractionBuilder.prototype.tooltipLinesSpec_uvmyj9$ = function (tooltipSpec) {\n this.myUserTooltipSpec_0 = tooltipSpec;\n return this;\n };\n GeomInteractionBuilder.prototype.setIsCrosshairEnabled_6taknv$ = function (isTrue) {\n this.myIsCrosshairEnabled_0 = isTrue;\n return this;\n };\n GeomInteractionBuilder.prototype.multilayerLookupStrategy = function () {\n this.locatorLookupStrategy = GeomTargetLocator$LookupStrategy.NEAREST;\n this.locatorLookupSpace = GeomTargetLocator$LookupSpace.XY;\n return this;\n };\n GeomInteractionBuilder.prototype.univariateFunction_7k7ojo$ = function (lookupStrategy) {\n this.myAxisAesFromFunctionKind_0 = GeomInteractionBuilder$Companion_getInstance().AES_X_0;\n this.locatorLookupStrategy = lookupStrategy;\n this.myAxisTooltipVisibilityFromFunctionKind_0 = true;\n this.locatorLookupSpace = GeomTargetLocator$LookupSpace.X;\n this.initDefaultTooltips_0();\n return this;\n };\n GeomInteractionBuilder.prototype.bivariateFunction_6taknv$ = function (area) {\n this.myAxisAesFromFunctionKind_0 = GeomInteractionBuilder$Companion_getInstance().AES_XY_0;\n if (area) {\n this.locatorLookupStrategy = GeomTargetLocator$LookupStrategy.HOVER;\n this.myAxisTooltipVisibilityFromFunctionKind_0 = false;\n } else {\n this.locatorLookupStrategy = GeomTargetLocator$LookupStrategy.NEAREST;\n this.myAxisTooltipVisibilityFromFunctionKind_0 = true;\n }\n this.locatorLookupSpace = GeomTargetLocator$LookupSpace.XY;\n this.initDefaultTooltips_0();\n return this;\n };\n GeomInteractionBuilder.prototype.none = function () {\n this.myAxisAesFromFunctionKind_0 = ArrayList_init_1(this.mySupportedAesList_0);\n this.locatorLookupStrategy = GeomTargetLocator$LookupStrategy.NONE;\n this.myAxisTooltipVisibilityFromFunctionKind_0 = true;\n this.locatorLookupSpace = GeomTargetLocator$LookupSpace.NONE;\n this.initDefaultTooltips_0();\n return this;\n };\n GeomInteractionBuilder.prototype.initDefaultTooltips_0 = function () {\n this.myTooltipAxisAes_0 = !this.isAxisTooltipEnabled ? emptyList() : this.getAxisFromFunctionKind;\n this.myTooltipAes_0 = minus(this.mySupportedAesList_0, this.getAxisFromFunctionKind);\n this.myTooltipOutlierAesList_0 = emptyList();\n };\n GeomInteractionBuilder.prototype.prepareTooltipValueSources_0 = function () {\n var tmp$;\n if (this.myUserTooltipSpec_0 == null)\n tmp$ = GeomInteractionBuilder$Companion_getInstance().defaultValueSourceTooltipLines_dnbe1t$(this.myTooltipAes_0, this.myTooltipAxisAes_0, this.myTooltipOutlierAesList_0, null, this.myTooltipConstantsAesList_0);\n else if (ensureNotNull(this.myUserTooltipSpec_0).tooltipLinePatterns == null)\n tmp$ = GeomInteractionBuilder$Companion_getInstance().defaultValueSourceTooltipLines_dnbe1t$(this.myTooltipAes_0, this.myTooltipAxisAes_0, this.myTooltipOutlierAesList_0, ensureNotNull(this.myUserTooltipSpec_0).valueSources, this.myTooltipConstantsAesList_0);\n else if (ensureNotNull(ensureNotNull(this.myUserTooltipSpec_0).tooltipLinePatterns).isEmpty())\n tmp$ = emptyList();\n else {\n var geomOutliers = toMutableList(this.myTooltipOutlierAesList_0);\n var tmp$_0;\n tmp$_0 = ensureNotNull(ensureNotNull(this.myUserTooltipSpec_0).tooltipLinePatterns).iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var $receiver = element.fields;\n var destination = ArrayList_init();\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n if (Kotlin.isType(element_0, MappingValue))\n destination.add_11rb$(element_0);\n }\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(destination, 10));\n var tmp$_2;\n tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination_0.add_11rb$(item.aes);\n }\n var userDataAesList = destination_0;\n geomOutliers.removeAll_brywnq$(userDataAesList);\n }\n var $receiver_0 = this.myTooltipAxisAes_0;\n var destination_1 = ArrayList_init_0(collectionSizeOrDefault($receiver_0, 10));\n var tmp$_3;\n tmp$_3 = $receiver_0.iterator();\n while (tmp$_3.hasNext()) {\n var item_0 = tmp$_3.next();\n destination_1.add_11rb$(new MappingValue(item_0, true, true));\n }\n var axisValueSources = destination_1;\n var destination_2 = ArrayList_init_0(collectionSizeOrDefault(geomOutliers, 10));\n var tmp$_4;\n tmp$_4 = geomOutliers.iterator();\n while (tmp$_4.hasNext()) {\n var item_1 = tmp$_4.next();\n var tmp$_5 = destination_2.add_11rb$;\n var tmp$_6;\n var $receiver_1 = ensureNotNull(this.myUserTooltipSpec_0).valueSources;\n var destination_3 = ArrayList_init();\n var tmp$_7;\n tmp$_7 = $receiver_1.iterator();\n while (tmp$_7.hasNext()) {\n var element_1 = tmp$_7.next();\n if (Kotlin.isType(element_1, MappingValue))\n destination_3.add_11rb$(element_1);\n }\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_8;\n tmp$_8 = destination_3.iterator();\n while (tmp$_8.hasNext()) {\n var element_2 = tmp$_8.next();\n if (equals(element_2.aes, item_1)) {\n firstOrNull$result = element_2;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n var formatted = firstOrNull$result;\n tmp$_5.call(destination_2, (tmp$_6 = formatted != null ? formatted.toOutlier() : null) != null ? tmp$_6 : new MappingValue(item_1, true));\n }\n var geomOutlierValueSources = destination_2;\n var tmp$_9 = ensureNotNull(ensureNotNull(this.myUserTooltipSpec_0).tooltipLinePatterns);\n var $receiver_2 = plus(axisValueSources, geomOutlierValueSources);\n var transform = getCallableRef('defaultLineForValueSource', function ($receiver, p1) {\n return $receiver.defaultLineForValueSource_u47np3$(p1);\n }.bind(null, TooltipLine$Companion_getInstance()));\n var destination_4 = ArrayList_init_0(collectionSizeOrDefault($receiver_2, 10));\n var tmp$_10;\n tmp$_10 = $receiver_2.iterator();\n while (tmp$_10.hasNext()) {\n var item_2 = tmp$_10.next();\n destination_4.add_11rb$(transform(item_2));\n }\n tmp$ = plus(tmp$_9, destination_4);\n }\n return tmp$;\n };\n GeomInteractionBuilder.prototype.build = function () {\n return new GeomInteraction(this);\n };\n GeomInteractionBuilder.prototype.ignoreInvisibleTargets_6taknv$ = function (isTrue) {\n this.myIgnoreInvisibleTargets_0 = isTrue;\n return this;\n };\n GeomInteractionBuilder.prototype.isIgnoringInvisibleTargets = function () {\n return this.myIgnoreInvisibleTargets_0;\n };\n function GeomInteractionBuilder$Companion() {\n GeomInteractionBuilder$Companion_instance = this;\n this.AREA_GEOM = true;\n this.NON_AREA_GEOM = false;\n this.AES_X_0 = listOf(Aes.Companion.X);\n this.AES_XY_0 = listOf_0([Aes.Companion.X, Aes.Companion.Y]);\n }\n GeomInteractionBuilder$Companion.prototype.defaultValueSourceTooltipLines_dnbe1t$ = function (aesListForTooltip, axisAes, outliers, userDefinedValueSources, constantsMap) {\n if (userDefinedValueSources === void 0)\n userDefinedValueSources = null;\n if (constantsMap === void 0)\n constantsMap = null;\n var tmp$;\n var destination = ArrayList_init_0(collectionSizeOrDefault(axisAes, 10));\n var tmp$_0;\n tmp$_0 = axisAes.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(new MappingValue(item, true, true));\n }\n var axisValueSources = destination;\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(outliers, 10));\n var tmp$_1;\n tmp$_1 = outliers.iterator();\n while (tmp$_1.hasNext()) {\n var item_0 = tmp$_1.next();\n var tmp$_2 = destination_0.add_11rb$;\n var tmp$_3, tmp$_4;\n var tmp$_5;\n if (userDefinedValueSources != null) {\n var destination_1 = ArrayList_init();\n var tmp$_6;\n tmp$_6 = userDefinedValueSources.iterator();\n while (tmp$_6.hasNext()) {\n var element = tmp$_6.next();\n if (Kotlin.isType(element, MappingValue))\n destination_1.add_11rb$(element);\n }\n tmp$_5 = destination_1;\n } else\n tmp$_5 = null;\n var tmp$_7;\n if ((tmp$_3 = tmp$_5) != null) {\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_8;\n tmp$_8 = tmp$_3.iterator();\n while (tmp$_8.hasNext()) {\n var element_0 = tmp$_8.next();\n if (equals(element_0.aes, item_0)) {\n firstOrNull$result = element_0;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n tmp$_7 = firstOrNull$result;\n } else\n tmp$_7 = null;\n var userDefined = tmp$_7;\n tmp$_2.call(destination_0, (tmp$_4 = userDefined != null ? userDefined.toOutlier() : null) != null ? tmp$_4 : new MappingValue(item_0, true));\n }\n var outlierValueSources = destination_0;\n var destination_2 = ArrayList_init_0(collectionSizeOrDefault(aesListForTooltip, 10));\n var tmp$_9;\n tmp$_9 = aesListForTooltip.iterator();\n while (tmp$_9.hasNext()) {\n var item_1 = tmp$_9.next();\n var tmp$_10 = destination_2.add_11rb$;\n var tmp$_11;\n var tmp$_12;\n if (userDefinedValueSources != null) {\n var destination_3 = ArrayList_init();\n var tmp$_13;\n tmp$_13 = userDefinedValueSources.iterator();\n while (tmp$_13.hasNext()) {\n var element_1 = tmp$_13.next();\n if (Kotlin.isType(element_1, MappingValue))\n destination_3.add_11rb$(element_1);\n }\n tmp$_12 = destination_3;\n } else\n tmp$_12 = null;\n var tmp$_14;\n if ((tmp$_11 = tmp$_12) != null) {\n var firstOrNull$result_0;\n firstOrNull$break: do {\n var tmp$_15;\n tmp$_15 = tmp$_11.iterator();\n while (tmp$_15.hasNext()) {\n var element_2 = tmp$_15.next();\n if (equals(element_2.aes, item_1)) {\n firstOrNull$result_0 = element_2;\n break firstOrNull$break;\n }}\n firstOrNull$result_0 = null;\n }\n while (false);\n tmp$_14 = firstOrNull$result_0;\n } else\n tmp$_14 = null;\n var userDefined_0 = tmp$_14;\n tmp$_10.call(destination_2, userDefined_0 != null ? userDefined_0 : new MappingValue(item_1));\n }\n var aesValueSources = destination_2;\n var tmp$_16;\n if (constantsMap != null) {\n var destination_4 = ArrayList_init_0(constantsMap.size);\n var tmp$_17;\n tmp$_17 = constantsMap.entries.iterator();\n while (tmp$_17.hasNext()) {\n var item_2 = tmp$_17.next();\n var tmp$_18 = destination_4.add_11rb$;\n var value = item_2.value;\n tmp$_18.call(destination_4, new ConstantValue(value, null));\n }\n tmp$_16 = destination_4;\n } else\n tmp$_16 = null;\n var constantValues = (tmp$ = tmp$_16) != null ? tmp$ : emptyList();\n var $receiver = plus(plus(plus(aesValueSources, axisValueSources), outlierValueSources), constantValues);\n var transform = getCallableRef('defaultLineForValueSource', function ($receiver, p1) {\n return $receiver.defaultLineForValueSource_u47np3$(p1);\n }.bind(null, TooltipLine$Companion_getInstance()));\n var destination_5 = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$_19;\n tmp$_19 = $receiver.iterator();\n while (tmp$_19.hasNext()) {\n var item_3 = tmp$_19.next();\n destination_5.add_11rb$(transform(item_3));\n }\n return destination_5;\n };\n GeomInteractionBuilder$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GeomInteractionBuilder$Companion_instance = null;\n function GeomInteractionBuilder$Companion_getInstance() {\n if (GeomInteractionBuilder$Companion_instance === null) {\n new GeomInteractionBuilder$Companion();\n }return GeomInteractionBuilder$Companion_instance;\n }\n GeomInteractionBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GeomInteractionBuilder',\n interfaces: []\n };\n function MathUtil() {\n MathUtil_instance = this;\n }\n MathUtil.prototype.polygonContainsCoordinate_sz9prc$ = function (points, coord) {\n var tmp$;\n var intersectionCount = 0;\n tmp$ = points.size;\n for (var i = 1; i < tmp$; i++) {\n var start = points.get_za3lpa$(i - 1 | 0);\n var end = points.get_za3lpa$(i);\n if (start.y >= coord.y && end.y >= coord.y || (start.y < coord.y && end.y < coord.y)) {\n continue;\n }var x = start.x + (coord.y - start.y) * (end.x - start.x) / (end.y - start.y);\n if (x <= coord.x) {\n intersectionCount = intersectionCount + 1 | 0;\n }}\n return intersectionCount % 2 !== 0;\n };\n MathUtil.prototype.liesOnSegment_e9v9yt$ = function (p1, p2, c, epsilon) {\n return (new DoubleSegment(p1, p2)).distance_gpjtzr$(c) < epsilon;\n };\n MathUtil.prototype.areEqual_f1g2it$ = function (p1, p2, epsilon) {\n return p1.subtract_gpjtzr$(p2).length() < epsilon;\n };\n MathUtil.prototype.areEqual_hln2n9$ = function (a, b, epsilon) {\n var x = a - b;\n return JsMath.abs(x) < epsilon;\n };\n MathUtil.prototype.distance_l9poh5$ = function (p1, p2) {\n return (new DoubleSegment(p1, p2)).length();\n };\n MathUtil.prototype.subtractX_l3ea4i$ = function (v, x) {\n return new DoubleVector(v.x - x, v.y);\n };\n MathUtil.prototype.addX_l3ea4i$ = function (v, x) {\n return new DoubleVector(v.x + x, v.y);\n };\n MathUtil.prototype.leftEdgeOf_wthzt5$ = function (rect) {\n return new DoubleSegment(new DoubleVector(rect.left, rect.top), new DoubleVector(rect.left, rect.bottom));\n };\n MathUtil.prototype.topEdgeOf_wthzt5$ = function (rect) {\n return new DoubleSegment(new DoubleVector(rect.left, rect.top), new DoubleVector(rect.right, rect.top));\n };\n MathUtil.prototype.rightEdgeOf_wthzt5$ = function (rect) {\n return new DoubleSegment(new DoubleVector(rect.right, rect.top), new DoubleVector(rect.right, rect.bottom));\n };\n MathUtil.prototype.bottomEdgeOf_wthzt5$ = function (rect) {\n return new DoubleSegment(new DoubleVector(rect.left, rect.bottom), new DoubleVector(rect.right, rect.bottom));\n };\n function MathUtil$ClosestPointChecker(target) {\n this.target = target;\n this.distance_pberzz$_0 = -1.0;\n this.coord_ovwx85$_0 = null;\n }\n Object.defineProperty(MathUtil$ClosestPointChecker.prototype, 'distance', {\n configurable: true,\n get: function () {\n return this.distance_pberzz$_0;\n },\n set: function (distance) {\n this.distance_pberzz$_0 = distance;\n }\n });\n Object.defineProperty(MathUtil$ClosestPointChecker.prototype, 'coord', {\n configurable: true,\n get: function () {\n return this.coord_ovwx85$_0;\n },\n set: function (coord) {\n this.coord_ovwx85$_0 = coord;\n }\n });\n MathUtil$ClosestPointChecker.prototype.check_gpjtzr$ = function (coord) {\n var cmpResult = this.compare_gpjtzr$(coord);\n return cmpResult === MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance() || cmpResult === MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance();\n };\n MathUtil$ClosestPointChecker.prototype.compare_gpjtzr$ = function (coord) {\n var newDistance = MathUtil_getInstance().distance_l9poh5$(this.target, coord);\n if (this.distance < 0) {\n this.setNewClosestCoord_0(coord, newDistance);\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance();\n }if (this.distance < newDistance) {\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance();\n }if (this.distance === newDistance) {\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance();\n }this.setNewClosestCoord_0(coord, newDistance);\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance();\n };\n MathUtil$ClosestPointChecker.prototype.setNewClosestCoord_0 = function (coord, distance) {\n this.distance = distance;\n this.coord = coord;\n };\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT_initFields() {\n MathUtil$ClosestPointChecker$COMPARISON_RESULT_initFields = function () {\n };\n MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_instance = new MathUtil$ClosestPointChecker$COMPARISON_RESULT('NEW_CLOSER', 0);\n MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_instance = new MathUtil$ClosestPointChecker$COMPARISON_RESULT('NEW_FARTHER', 1);\n MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_instance = new MathUtil$ClosestPointChecker$COMPARISON_RESULT('EQUAL', 2);\n }\n var MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_instance;\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance() {\n MathUtil$ClosestPointChecker$COMPARISON_RESULT_initFields();\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_instance;\n }\n var MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_instance;\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance() {\n MathUtil$ClosestPointChecker$COMPARISON_RESULT_initFields();\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_instance;\n }\n var MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_instance;\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance() {\n MathUtil$ClosestPointChecker$COMPARISON_RESULT_initFields();\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_instance;\n }\n MathUtil$ClosestPointChecker$COMPARISON_RESULT.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'COMPARISON_RESULT',\n interfaces: [Enum]\n };\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT$values() {\n return [MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance(), MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance(), MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance()];\n }\n MathUtil$ClosestPointChecker$COMPARISON_RESULT.values = MathUtil$ClosestPointChecker$COMPARISON_RESULT$values;\n function MathUtil$ClosestPointChecker$COMPARISON_RESULT$valueOf(name) {\n switch (name) {\n case 'NEW_CLOSER':\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance();\n case 'NEW_FARTHER':\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance();\n case 'EQUAL':\n return MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.interact.MathUtil.ClosestPointChecker.COMPARISON_RESULT.' + name);\n }\n }\n MathUtil$ClosestPointChecker$COMPARISON_RESULT.valueOf_61zpoe$ = MathUtil$ClosestPointChecker$COMPARISON_RESULT$valueOf;\n MathUtil$ClosestPointChecker.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ClosestPointChecker',\n interfaces: []\n };\n function MathUtil$MathUtil$ClosestPointChecker_init(x, y, $this) {\n $this = $this || Object.create(MathUtil$ClosestPointChecker.prototype);\n MathUtil$ClosestPointChecker.call($this, new DoubleVector(x, y));\n return $this;\n }\n function MathUtil$DoubleRange(myStart, myLength) {\n MathUtil$DoubleRange$Companion_getInstance();\n this.myStart_0 = myStart;\n this.myLength_0 = myLength;\n if (this.myLength_0 < 0) {\n throw IllegalStateException_init('Length should be positive');\n }}\n MathUtil$DoubleRange.prototype.length = function () {\n return this.myLength_0;\n };\n MathUtil$DoubleRange.prototype.overlaps_oqgc3u$ = function (v) {\n return this.start() <= v.end() && v.start() <= this.end();\n };\n MathUtil$DoubleRange.prototype.inside_oqgc3u$ = function (v) {\n return this.start() >= v.start() && this.end() <= v.end();\n };\n MathUtil$DoubleRange.prototype.contains_14dthe$ = function (value) {\n return value >= this.start() && value <= this.end();\n };\n MathUtil$DoubleRange.prototype.start = function () {\n return this.myStart_0;\n };\n MathUtil$DoubleRange.prototype.end = function () {\n return this.myStart_0 + this.length();\n };\n MathUtil$DoubleRange.prototype.move_14dthe$ = function (delta) {\n return MathUtil$DoubleRange$Companion_getInstance().withStartAndLength_lu1900$(this.start() + delta, this.length());\n };\n MathUtil$DoubleRange.prototype.moveLeft_14dthe$ = function (delta) {\n if (delta < 0) {\n throw IllegalStateException_init('Value should be positive');\n }return MathUtil$DoubleRange$Companion_getInstance().withStartAndLength_lu1900$(this.start() - delta, this.length());\n };\n MathUtil$DoubleRange.prototype.moveRight_14dthe$ = function (delta) {\n if (delta < 0) {\n throw IllegalStateException_init('Value should be positive');\n }return MathUtil$DoubleRange$Companion_getInstance().withStartAndLength_lu1900$(this.start() + delta, this.length());\n };\n function MathUtil$DoubleRange$Companion() {\n MathUtil$DoubleRange$Companion_instance = this;\n }\n MathUtil$DoubleRange$Companion.prototype.withStartAndEnd_lu1900$ = function (start, end) {\n var rangeStart = JsMath.min(start, end);\n var rangeLength = JsMath.max(start, end) - rangeStart;\n return new MathUtil$DoubleRange(rangeStart, rangeLength);\n };\n MathUtil$DoubleRange$Companion.prototype.withStartAndLength_lu1900$ = function (start, length) {\n return new MathUtil$DoubleRange(start, length);\n };\n MathUtil$DoubleRange$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var MathUtil$DoubleRange$Companion_instance = null;\n function MathUtil$DoubleRange$Companion_getInstance() {\n if (MathUtil$DoubleRange$Companion_instance === null) {\n new MathUtil$DoubleRange$Companion();\n }return MathUtil$DoubleRange$Companion_instance;\n }\n MathUtil$DoubleRange.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleRange',\n interfaces: []\n };\n MathUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'MathUtil',\n interfaces: []\n };\n var MathUtil_instance = null;\n function MathUtil_getInstance() {\n if (MathUtil_instance === null) {\n new MathUtil();\n }return MathUtil_instance;\n }\n function TooltipSpec(layoutHint, lines, fill, isOutlier, anchor, minWidth, isCrosshairEnabled) {\n if (anchor === void 0)\n anchor = null;\n if (minWidth === void 0)\n minWidth = null;\n if (isCrosshairEnabled === void 0)\n isCrosshairEnabled = false;\n this.layoutHint = layoutHint;\n this.fill = fill;\n this.isOutlier = isOutlier;\n this.anchor = anchor;\n this.minWidth = minWidth;\n this.isCrosshairEnabled = isCrosshairEnabled;\n this.lines = ArrayList_init_1(lines);\n }\n TooltipSpec.prototype.toString = function () {\n var tmp$ = 'TooltipSpec(' + this.layoutHint + ', lines=';\n var $receiver = this.lines;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(item.toString());\n }\n return tmp$ + destination + ')';\n };\n function TooltipSpec$Line(label, value) {\n TooltipSpec$Line$Companion_getInstance();\n this.label = label;\n this.value = value;\n }\n TooltipSpec$Line.prototype.toString = function () {\n var $receiver = this.label;\n return $receiver == null || $receiver.length === 0 ? this.value : toString(this.label) + ': ' + this.value;\n };\n function TooltipSpec$Line$Companion() {\n TooltipSpec$Line$Companion_instance = this;\n }\n TooltipSpec$Line$Companion.prototype.withValue_61zpoe$ = function (value) {\n return new TooltipSpec$Line(null, value);\n };\n TooltipSpec$Line$Companion.prototype.withLabelAndValue_f5e6j7$ = function (label, value) {\n return new TooltipSpec$Line(label, value);\n };\n TooltipSpec$Line$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TooltipSpec$Line$Companion_instance = null;\n function TooltipSpec$Line$Companion_getInstance() {\n if (TooltipSpec$Line$Companion_instance === null) {\n new TooltipSpec$Line$Companion();\n }return TooltipSpec$Line$Companion_instance;\n }\n TooltipSpec$Line.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Line',\n interfaces: []\n };\n TooltipSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipSpec',\n interfaces: []\n };\n function TooltipSpecFactory(contextualMapping, axisOrigin) {\n this.contextualMapping_0 = contextualMapping;\n this.axisOrigin_0 = axisOrigin;\n }\n TooltipSpecFactory.prototype.create_62opr5$ = function (geomTarget) {\n return ArrayList_init_1((new TooltipSpecFactory$Helper(this, geomTarget)).createTooltipSpecs_8be2vx$());\n };\n function TooltipSpecFactory$Helper($outer, myGeomTarget) {\n this.$outer = $outer;\n this.myGeomTarget_0 = myGeomTarget;\n this.myDataPoints_0 = this.$outer.contextualMapping_0.getDataPoints_za3lpa$(this.hitIndex_0());\n this.myTooltipAnchor_0 = this.$outer.contextualMapping_0.tooltipAnchor;\n this.myTooltipMinWidth_0 = this.$outer.contextualMapping_0.tooltipMinWidth;\n this.myTooltipColor_0 = this.$outer.contextualMapping_0.tooltipColor;\n this.myIsCrosshairEnabled_0 = this.$outer.contextualMapping_0.isCrosshairEnabled;\n }\n TooltipSpecFactory$Helper.prototype.createTooltipSpecs_8be2vx$ = function () {\n var tooltipSpecs = ArrayList_init();\n addAll(tooltipSpecs, this.outlierTooltipSpec_0());\n addAll(tooltipSpecs, this.generalTooltipSpec_0());\n addAll(tooltipSpecs, this.axisTooltipSpec_0());\n return tooltipSpecs;\n };\n TooltipSpecFactory$Helper.prototype.hitIndex_0 = function () {\n return this.myGeomTarget_0.hitIndex;\n };\n TooltipSpecFactory$Helper.prototype.tipLayoutHint_0 = function () {\n return this.myGeomTarget_0.tipLayoutHint;\n };\n TooltipSpecFactory$Helper.prototype.outlierHints_0 = function () {\n return this.myGeomTarget_0.aesTipLayoutHints;\n };\n TooltipSpecFactory$Helper.prototype.hintColors_0 = function () {\n var $receiver = this.myGeomTarget_0.aesTipLayoutHints;\n var destination = ArrayList_init_0($receiver.size);\n var tmp$;\n tmp$ = $receiver.entries.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(to(item.key, item.value.color));\n }\n return toMap(destination);\n };\n TooltipSpecFactory$Helper.prototype.outlierTooltipSpec_0 = function () {\n var tooltipSpecs = ArrayList_init();\n var outlierDataPoints = this.outlierDataPoints_0();\n var tmp$;\n tmp$ = this.outlierHints_0().entries.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var aes = element.key;\n var hint = element.value;\n var tmp$_0;\n var destination = ArrayList_init();\n var tmp$_1;\n tmp$_1 = outlierDataPoints.iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n if (equals(aes, element_0.aes))\n destination.add_11rb$(element_0);\n }\n var transform = getPropertyCallableRef('value', 1, function ($receiver) {\n return $receiver.value;\n });\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(destination, 10));\n var tmp$_2;\n tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination_0.add_11rb$(transform(item));\n }\n var transform_0 = getCallableRef('withValue', function ($receiver, p1) {\n return $receiver.withValue_61zpoe$(p1);\n }.bind(null, TooltipSpec$Line$Companion_getInstance()));\n var destination_1 = ArrayList_init_0(collectionSizeOrDefault(destination_0, 10));\n var tmp$_3;\n tmp$_3 = destination_0.iterator();\n while (tmp$_3.hasNext()) {\n var item_0 = tmp$_3.next();\n destination_1.add_11rb$(transform_0(item_0));\n }\n var linesForAes = destination_1;\n if (!linesForAes.isEmpty()) {\n tooltipSpecs.add_11rb$(new TooltipSpec(hint, linesForAes, (tmp$_0 = hint.color) != null ? tmp$_0 : ensureNotNull(this.tipLayoutHint_0().color), true));\n }}\n return tooltipSpecs;\n };\n TooltipSpecFactory$Helper.prototype.axisTooltipSpec_0 = function () {\n var tooltipSpecs = ArrayList_init();\n var tmp$ = Aes.Companion.X;\n var $receiver = this.axisDataPoints_0();\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (equals(Aes.Companion.X, element.aes))\n destination.add_11rb$(element);\n }\n var transform = getPropertyCallableRef('value', 1, function ($receiver) {\n return $receiver.value;\n });\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(destination, 10));\n var tmp$_1;\n tmp$_1 = destination.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n destination_0.add_11rb$(transform(item));\n }\n var transform_0 = getCallableRef('withValue', function ($receiver, p1) {\n return $receiver.withValue_61zpoe$(p1);\n }.bind(null, TooltipSpec$Line$Companion_getInstance()));\n var destination_1 = ArrayList_init_0(collectionSizeOrDefault(destination_0, 10));\n var tmp$_2;\n tmp$_2 = destination_0.iterator();\n while (tmp$_2.hasNext()) {\n var item_0 = tmp$_2.next();\n destination_1.add_11rb$(transform_0(item_0));\n }\n var tmp$_3 = to(tmp$, destination_1);\n var tmp$_4 = Aes.Companion.Y;\n var $receiver_0 = this.axisDataPoints_0();\n var destination_2 = ArrayList_init();\n var tmp$_5;\n tmp$_5 = $receiver_0.iterator();\n while (tmp$_5.hasNext()) {\n var element_0 = tmp$_5.next();\n if (equals(Aes.Companion.Y, element_0.aes))\n destination_2.add_11rb$(element_0);\n }\n var transform_1 = getPropertyCallableRef('value', 1, function ($receiver) {\n return $receiver.value;\n });\n var destination_3 = ArrayList_init_0(collectionSizeOrDefault(destination_2, 10));\n var tmp$_6;\n tmp$_6 = destination_2.iterator();\n while (tmp$_6.hasNext()) {\n var item_1 = tmp$_6.next();\n destination_3.add_11rb$(transform_1(item_1));\n }\n var transform_2 = getCallableRef('withValue', function ($receiver, p1) {\n return $receiver.withValue_61zpoe$(p1);\n }.bind(null, TooltipSpec$Line$Companion_getInstance()));\n var destination_4 = ArrayList_init_0(collectionSizeOrDefault(destination_3, 10));\n var tmp$_7;\n tmp$_7 = destination_3.iterator();\n while (tmp$_7.hasNext()) {\n var item_2 = tmp$_7.next();\n destination_4.add_11rb$(transform_2(item_2));\n }\n var axis = mapOf([tmp$_3, to(tmp$_4, destination_4)]);\n var tmp$_8;\n tmp$_8 = axis.entries.iterator();\n while (tmp$_8.hasNext()) {\n var element_1 = tmp$_8.next();\n var aes = element_1.key;\n var lines = element_1.value;\n if (!lines.isEmpty()) {\n var layoutHint = this.createHintForAxis_0(aes);\n tooltipSpecs.add_11rb$(new TooltipSpec(layoutHint, lines, ensureNotNull(layoutHint.color), true));\n }}\n return tooltipSpecs;\n };\n TooltipSpecFactory$Helper.prototype.generalTooltipSpec_0 = function () {\n var tmp$, tmp$_0, tmp$_1;\n var generalDataPoints = this.generalDataPoints_0();\n var destination = ArrayList_init_0(collectionSizeOrDefault(generalDataPoints, 10));\n var tmp$_2;\n tmp$_2 = generalDataPoints.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination.add_11rb$(TooltipSpec$Line$Companion_getInstance().withLabelAndValue_f5e6j7$(item.label, item.value));\n }\n var generalLines = destination;\n var $receiver = this.hintColors_0();\n var tmp$_3;\n var result = LinkedHashMap_init();\n tmp$_3 = $receiver.entries.iterator();\n while (tmp$_3.hasNext()) {\n var entry = tmp$_3.next();\n var aes = entry.key;\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(generalDataPoints, 10));\n var tmp$_4;\n tmp$_4 = generalDataPoints.iterator();\n while (tmp$_4.hasNext()) {\n var item_0 = tmp$_4.next();\n destination_0.add_11rb$(item_0.aes);\n }\n if (destination_0.contains_11rb$(aes)) {\n result.put_xwzc9p$(entry.key, entry.value);\n }}\n var aesHintColors = result;\n var tmp$_5;\n if ((tmp$ = aesHintColors.get_11rb$(Aes.Companion.Y)) != null)\n tmp$_5 = tmp$;\n else {\n var destination_1 = ArrayList_init();\n var tmp$_6;\n tmp$_6 = aesHintColors.entries.iterator();\n while (tmp$_6.hasNext()) {\n var element = tmp$_6.next();\n var tmp$_0_0;\n if ((tmp$_0_0 = element.value) != null) {\n destination_1.add_11rb$(tmp$_0_0);\n }}\n tmp$_5 = lastOrNull(destination_1);\n }\n var colorFromHints = tmp$_5;\n if (this.myTooltipColor_0 != null)\n tmp$_0 = this.myTooltipColor_0;\n else if (colorFromHints != null)\n tmp$_0 = colorFromHints;\n else\n tmp$_0 = ensureNotNull(this.tipLayoutHint_0().color);\n var tooltipColor = tmp$_0;\n if (!generalLines.isEmpty()) {\n tmp$_1 = listOf(new TooltipSpec(this.tipLayoutHint_0(), generalLines, tooltipColor, false, this.myTooltipAnchor_0, this.myTooltipMinWidth_0, this.myIsCrosshairEnabled_0));\n } else {\n tmp$_1 = emptyList();\n }\n return tmp$_1;\n };\n TooltipSpecFactory$Helper.prototype.outlierDataPoints_0 = function () {\n var $receiver = this.myDataPoints_0;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.isOutlier && !element.isAxis)\n destination.add_11rb$(element);\n }\n return destination;\n };\n TooltipSpecFactory$Helper.prototype.axisDataPoints_0 = function () {\n var $receiver = this.myDataPoints_0;\n var predicate = getPropertyCallableRef('isAxis', 1, function ($receiver) {\n return $receiver.isAxis;\n });\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (predicate(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n TooltipSpecFactory$Helper.prototype.generalDataPoints_0 = function () {\n var $receiver = this.myDataPoints_0;\n var predicate = getPropertyCallableRef('isOutlier', 1, function ($receiver) {\n return $receiver.isOutlier;\n });\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (!predicate(element))\n destination.add_11rb$(element);\n }\n var nonOutlierDataPoints = destination;\n var $receiver_0 = this.outlierDataPoints_0();\n var transform = getPropertyCallableRef('aes', 1, function ($receiver) {\n return $receiver.aes;\n });\n var destination_0 = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver_0.iterator();\n while (tmp$_0.hasNext()) {\n var element_0 = tmp$_0.next();\n var tmp$_0_0;\n if ((tmp$_0_0 = transform(element_0)) != null) {\n destination_0.add_11rb$(tmp$_0_0);\n }}\n var outliers = destination_0;\n var transform_0 = getPropertyCallableRef('aes', 1, function ($receiver) {\n return $receiver.aes;\n });\n var destination_1 = ArrayList_init();\n var tmp$_1;\n tmp$_1 = nonOutlierDataPoints.iterator();\n while (tmp$_1.hasNext()) {\n var element_1 = tmp$_1.next();\n var tmp$_0_1;\n if ((tmp$_0_1 = transform_0(element_1)) != null) {\n destination_1.add_11rb$(tmp$_0_1);\n }}\n var generalAesList = minus(destination_1, outliers);\n var destination_2 = ArrayList_init();\n var tmp$_2;\n tmp$_2 = nonOutlierDataPoints.iterator();\n while (tmp$_2.hasNext()) {\n var element_2 = tmp$_2.next();\n var predicate$result;\n var tmp$_3;\n tmp$_3 = element_2.aes;\n if (tmp$_3 == null) {\n predicate$result = true;\n } else if (contains(generalAesList, tmp$_3)) {\n predicate$result = true;\n } else {\n predicate$result = false;\n }\n if (predicate$result)\n destination_2.add_11rb$(element_2);\n }\n return destination_2;\n };\n TooltipSpecFactory$Helper.prototype.createHintForAxis_0 = function (aes) {\n var tmp$;\n if (equals(aes, Aes.Companion.X))\n tmp$ = TipLayoutHint.Companion.xAxisTooltip_cgf2ia$(new DoubleVector(ensureNotNull(this.tipLayoutHint_0().coord).x, this.$outer.axisOrigin_0.y), Defaults$Common$Tooltip_getInstance().AXIS_TOOLTIP_COLOR, Defaults$Common$Tooltip_getInstance().AXIS_RADIUS);\n else if (equals(aes, Aes.Companion.Y))\n tmp$ = TipLayoutHint.Companion.yAxisTooltip_cgf2ia$(new DoubleVector(this.$outer.axisOrigin_0.x, ensureNotNull(this.tipLayoutHint_0().coord).y), Defaults$Common$Tooltip_getInstance().AXIS_TOOLTIP_COLOR, Defaults$Common$Tooltip_getInstance().AXIS_RADIUS);\n else {\n throw IllegalStateException_init(('Not an axis aes: ' + aes).toString());\n }\n return tmp$;\n };\n TooltipSpecFactory$Helper.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Helper',\n interfaces: []\n };\n TooltipSpecFactory.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipSpecFactory',\n interfaces: []\n };\n function LayerTargetCollectorWithLocator(geomKind, lookupSpec, contextualMapping, coordinateSystem) {\n this.geomKind_0 = geomKind;\n this.lookupSpec_0 = lookupSpec;\n this.contextualMapping_0 = contextualMapping;\n this.coordinateSystem_0 = coordinateSystem;\n this.myTargets_0 = ArrayList_init();\n this.myLocator_0 = null;\n }\n function LayerTargetCollectorWithLocator$addPoint$lambda(closure$index) {\n return function (it) {\n return closure$index;\n };\n }\n LayerTargetCollectorWithLocator.prototype.addPoint_cnsimy$$default = function (index, point, radius, tooltipParams, tooltipKind) {\n if (this.contextualMapping_0.ignoreInvisibleTargets) {\n if (radius === 0.0 || tooltipParams.getColor().alpha === 0) {\n return;\n }}if (!this.coordinateSystem_0.isPointInLimits_k2qmv6$(point)) {\n return;\n }this.addTarget_0(new TargetPrototype(HitShape.Companion.point_e1sv3v$(point, radius), LayerTargetCollectorWithLocator$addPoint$lambda(index), tooltipParams, tooltipKind));\n };\n function LayerTargetCollectorWithLocator$addRectangle$lambda(closure$index) {\n return function (it) {\n return closure$index;\n };\n }\n LayerTargetCollectorWithLocator.prototype.addRectangle_bxzvr8$$default = function (index, rectangle, tooltipParams, tooltipKind) {\n if (this.contextualMapping_0.ignoreInvisibleTargets) {\n if (rectangle.width === 0.0 || rectangle.height === 0.0 || tooltipParams.getColor().alpha === 0) {\n return;\n }}if (!this.coordinateSystem_0.isRectInLimits_fd842m$(rectangle)) {\n return;\n }this.addTarget_0(new TargetPrototype(HitShape.Companion.rect_wthzt5$(rectangle), LayerTargetCollectorWithLocator$addRectangle$lambda(index), tooltipParams, tooltipKind));\n };\n LayerTargetCollectorWithLocator.prototype.addPath_sa5m83$$default = function (points, localToGlobalIndex, tooltipParams, tooltipKind) {\n if (!this.coordinateSystem_0.isPathInLimits_f6t8kh$(points)) {\n return;\n }this.addTarget_0(new TargetPrototype(HitShape.Companion.path_ytws2g$(points), localToGlobalIndex, tooltipParams, tooltipKind));\n };\n LayerTargetCollectorWithLocator.prototype.addPolygon_sa5m83$$default = function (points, localToGlobalIndex, tooltipParams, tooltipKind) {\n if (!this.coordinateSystem_0.isPolygonInLimits_f6t8kh$(points)) {\n return;\n }this.addTarget_0(new TargetPrototype(HitShape.Companion.polygon_ytws2g$(points), localToGlobalIndex, tooltipParams, tooltipKind));\n };\n LayerTargetCollectorWithLocator.prototype.addTarget_0 = function (targetPrototype) {\n this.myTargets_0.add_11rb$(targetPrototype);\n this.myLocator_0 = null;\n };\n LayerTargetCollectorWithLocator.prototype.search_gpjtzr$ = function (coord) {\n if (this.myLocator_0 == null) {\n this.myLocator_0 = new LayerTargetLocator(this.geomKind_0, this.lookupSpec_0, this.contextualMapping_0, this.myTargets_0);\n }return ensureNotNull(this.myLocator_0).search_gpjtzr$(coord);\n };\n LayerTargetCollectorWithLocator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LayerTargetCollectorWithLocator',\n interfaces: [GeomTargetLocator, GeomTargetCollector]\n };\n function LayerTargetLocator(geomKind, lookupSpec, contextualMapping, targetPrototypes) {\n this.geomKind_0 = geomKind;\n this.lookupSpec_0 = lookupSpec;\n this.contextualMapping_0 = contextualMapping;\n this.myTargets_0 = ArrayList_init();\n this.myTargetDetector_0 = new TargetDetector(this.lookupSpec_0.lookupSpace, this.lookupSpec_0.lookupStrategy);\n this.mySimpleGeometry_0 = setOf([GeomKind.RECT, GeomKind.POLYGON]);\n var tmp$, tmp$_0;\n if (this.mySimpleGeometry_0.contains_11rb$(this.geomKind_0))\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance();\n else if (this.lookupSpec_0.lookupSpace === GeomTargetLocator$LookupSpace.X && this.lookupSpec_0.lookupStrategy === GeomTargetLocator$LookupStrategy.NEAREST)\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_getInstance();\n else if (this.lookupSpec_0.lookupSpace === GeomTargetLocator$LookupSpace.X)\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance();\n else if (this.lookupSpec_0.lookupStrategy === GeomTargetLocator$LookupStrategy.HOVER)\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance();\n else if (this.lookupSpec_0.lookupStrategy === GeomTargetLocator$LookupStrategy.NONE || this.lookupSpec_0.lookupSpace === GeomTargetLocator$LookupSpace.NONE)\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$IGNORE_getInstance();\n else {\n tmp$ = LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance();\n }\n this.myCollectingStrategy_0 = tmp$;\n var toProjection = LayerTargetLocator_init$toProjection(this);\n tmp$_0 = targetPrototypes.iterator();\n while (tmp$_0.hasNext()) {\n var prototype = tmp$_0.next();\n this.myTargets_0.add_11rb$(new LayerTargetLocator$Target(toProjection(prototype), prototype));\n }\n }\n LayerTargetLocator.prototype.addLookupResults_0 = function (collector, targets) {\n if (collector.size() === 0) {\n return;\n }var tmp$ = collector.collection();\n var b = collector.closestPointChecker.distance;\n targets.add_11rb$(new GeomTargetLocator$LookupResult(tmp$, JsMath.max(0.0, b), this.geomKind_0, this.contextualMapping_0, this.contextualMapping_0.isCrosshairEnabled));\n };\n LayerTargetLocator.prototype.search_gpjtzr$ = function (coord) {\n var tmp$;\n if (this.myTargets_0.isEmpty()) {\n return null;\n }var rectCollector = new LayerTargetLocator$Collector(coord, this.myCollectingStrategy_0, this.lookupSpec_0.lookupSpace);\n var pointCollector = new LayerTargetLocator$Collector(coord, this.myCollectingStrategy_0, this.lookupSpec_0.lookupSpace);\n var pathCollector = new LayerTargetLocator$Collector(coord, this.myCollectingStrategy_0, this.lookupSpec_0.lookupSpace);\n var polygonCollector = new LayerTargetLocator$Collector(coord, LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance(), this.lookupSpec_0.lookupSpace);\n tmp$ = this.myTargets_0.iterator();\n while (tmp$.hasNext()) {\n var target = tmp$.next();\n switch (target.prototype.hitShape_8be2vx$.kind.name) {\n case 'RECT':\n this.processRect_0(coord, target, rectCollector);\n break;\n case 'POINT':\n this.processPoint_0(coord, target, pointCollector);\n break;\n case 'PATH':\n this.processPath_0(coord, target, pathCollector);\n break;\n case 'POLYGON':\n this.processPolygon_0(coord, target, polygonCollector);\n break;\n }\n }\n var lookupResults = ArrayList_init();\n this.addLookupResults_0(pathCollector, lookupResults);\n this.addLookupResults_0(rectCollector, lookupResults);\n this.addLookupResults_0(pointCollector, lookupResults);\n this.addLookupResults_0(polygonCollector, lookupResults);\n return this.getClosestTarget_0(lookupResults);\n };\n LayerTargetLocator.prototype.getClosestTarget_0 = function (lookupResults) {\n var tmp$;\n if (lookupResults.isEmpty()) {\n return null;\n }var closestTargets = lookupResults.get_za3lpa$(0);\n if (!(closestTargets.distance >= 0)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }tmp$ = lookupResults.iterator();\n while (tmp$.hasNext()) {\n var lookupResult = tmp$.next();\n if (lookupResult.distance < closestTargets.distance) {\n closestTargets = lookupResult;\n }}\n return closestTargets;\n };\n LayerTargetLocator.prototype.processRect_0 = function (coord, target, resultCollector) {\n var tmp$;\n if (this.myTargetDetector_0.checkRect_fqo6rd$(coord, target.rectProjection, resultCollector.closestPointChecker)) {\n var rect = target.prototype.hitShape_8be2vx$.rect;\n if (equals(target.prototype.tooltipKind_8be2vx$, TipLayoutHint$Kind.CURSOR_TOOLTIP))\n tmp$ = rect.height / 2.0;\n else\n tmp$ = 0.0;\n var yOffset = tmp$;\n resultCollector.collect_11rb$(target.prototype.createGeomTarget_x7nr8i$(rect.origin.add_gpjtzr$(new DoubleVector(rect.width / 2, yOffset)), this.getKeyForSingleObjectGeometry_0(target.prototype)));\n }};\n LayerTargetLocator.prototype.processPolygon_0 = function (coord, target, resultCollector) {\n if (this.myTargetDetector_0.checkPolygon_q60eo3$(coord, target.polygonProjection, resultCollector.closestPointChecker)) {\n resultCollector.collect_11rb$(target.prototype.createGeomTarget_x7nr8i$(coord, this.getKeyForSingleObjectGeometry_0(target.prototype)));\n }};\n LayerTargetLocator.prototype.processPoint_0 = function (coord, target, resultCollector) {\n if (this.myTargetDetector_0.checkPoint_w0b42b$(coord, target.pointProjection, resultCollector.closestPointChecker)) {\n resultCollector.collect_11rb$(target.prototype.createGeomTarget_x7nr8i$(target.prototype.hitShape_8be2vx$.point.center, this.getKeyForSingleObjectGeometry_0(target.prototype)));\n }};\n LayerTargetLocator.prototype.processPath_0 = function (coord, target, resultCollector) {\n var pointChecker = this.myCollectingStrategy_0 === LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance() ? new MathUtil$ClosestPointChecker(coord) : resultCollector.closestPointChecker;\n var hitPoint = this.myTargetDetector_0.checkPath_z3141m$(coord, target.pathProjection, pointChecker);\n if (hitPoint != null) {\n resultCollector.collect_11rb$(target.prototype.createGeomTarget_x7nr8i$(hitPoint.originalCoord, hitPoint.index));\n }};\n LayerTargetLocator.prototype.getKeyForSingleObjectGeometry_0 = function (prototype) {\n return prototype.indexMapper_8be2vx$(0);\n };\n function LayerTargetLocator$Target(targetProjection, prototype) {\n this.targetProjection_0 = targetProjection;\n this.prototype = prototype;\n }\n Object.defineProperty(LayerTargetLocator$Target.prototype, 'pointProjection', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.targetProjection_0, PointTargetProjection) ? tmp$ : throwCCE();\n }\n });\n Object.defineProperty(LayerTargetLocator$Target.prototype, 'rectProjection', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.targetProjection_0, RectTargetProjection) ? tmp$ : throwCCE();\n }\n });\n Object.defineProperty(LayerTargetLocator$Target.prototype, 'polygonProjection', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.targetProjection_0, PolygonTargetProjection) ? tmp$ : throwCCE();\n }\n });\n Object.defineProperty(LayerTargetLocator$Target.prototype, 'pathProjection', {\n configurable: true,\n get: function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.targetProjection_0, PathTargetProjection) ? tmp$ : throwCCE();\n }\n });\n LayerTargetLocator$Target.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Target',\n interfaces: []\n };\n function LayerTargetLocator$Collector(cursor, myStrategy, lookupSpace) {\n this.myStrategy_0 = myStrategy;\n this.result_0 = ArrayList_init();\n var tmp$;\n if (lookupSpace === GeomTargetLocator$LookupSpace.X) {\n tmp$ = new MathUtil$ClosestPointChecker(new DoubleVector(cursor.x, 0.0));\n } else {\n tmp$ = new MathUtil$ClosestPointChecker(cursor);\n }\n this.closestPointChecker = tmp$;\n this.myLastAddedDistance_0 = -1.0;\n }\n LayerTargetLocator$Collector.prototype.collect_11rb$ = function (data) {\n switch (this.myStrategy_0.name) {\n case 'APPEND':\n this.add_0(data);\n break;\n case 'REPLACE':\n this.replace_0(data);\n break;\n case 'APPEND_IF_EQUAL':\n if (this.myLastAddedDistance_0 === this.closestPointChecker.distance) {\n this.add_0(data);\n } else {\n this.replace_0(data);\n }\n\n break;\n case 'IGNORE':\n return;\n }\n };\n LayerTargetLocator$Collector.prototype.collection = function () {\n return this.result_0;\n };\n LayerTargetLocator$Collector.prototype.size = function () {\n return this.result_0.size;\n };\n LayerTargetLocator$Collector.prototype.add_0 = function (data) {\n this.result_0.add_11rb$(data);\n this.myLastAddedDistance_0 = this.closestPointChecker.distance;\n };\n LayerTargetLocator$Collector.prototype.replace_0 = function (locationData) {\n this.result_0.clear();\n this.result_0.add_11rb$(locationData);\n this.myLastAddedDistance_0 = this.closestPointChecker.distance;\n };\n function LayerTargetLocator$Collector$CollectingStrategy(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function LayerTargetLocator$Collector$CollectingStrategy_initFields() {\n LayerTargetLocator$Collector$CollectingStrategy_initFields = function () {\n };\n LayerTargetLocator$Collector$CollectingStrategy$APPEND_instance = new LayerTargetLocator$Collector$CollectingStrategy('APPEND', 0);\n LayerTargetLocator$Collector$CollectingStrategy$REPLACE_instance = new LayerTargetLocator$Collector$CollectingStrategy('REPLACE', 1);\n LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_instance = new LayerTargetLocator$Collector$CollectingStrategy('APPEND_IF_EQUAL', 2);\n LayerTargetLocator$Collector$CollectingStrategy$IGNORE_instance = new LayerTargetLocator$Collector$CollectingStrategy('IGNORE', 3);\n }\n var LayerTargetLocator$Collector$CollectingStrategy$APPEND_instance;\n function LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance() {\n LayerTargetLocator$Collector$CollectingStrategy_initFields();\n return LayerTargetLocator$Collector$CollectingStrategy$APPEND_instance;\n }\n var LayerTargetLocator$Collector$CollectingStrategy$REPLACE_instance;\n function LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance() {\n LayerTargetLocator$Collector$CollectingStrategy_initFields();\n return LayerTargetLocator$Collector$CollectingStrategy$REPLACE_instance;\n }\n var LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_instance;\n function LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_getInstance() {\n LayerTargetLocator$Collector$CollectingStrategy_initFields();\n return LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_instance;\n }\n var LayerTargetLocator$Collector$CollectingStrategy$IGNORE_instance;\n function LayerTargetLocator$Collector$CollectingStrategy$IGNORE_getInstance() {\n LayerTargetLocator$Collector$CollectingStrategy_initFields();\n return LayerTargetLocator$Collector$CollectingStrategy$IGNORE_instance;\n }\n LayerTargetLocator$Collector$CollectingStrategy.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CollectingStrategy',\n interfaces: [Enum]\n };\n function LayerTargetLocator$Collector$CollectingStrategy$values() {\n return [LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance(), LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance(), LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_getInstance(), LayerTargetLocator$Collector$CollectingStrategy$IGNORE_getInstance()];\n }\n LayerTargetLocator$Collector$CollectingStrategy.values = LayerTargetLocator$Collector$CollectingStrategy$values;\n function LayerTargetLocator$Collector$CollectingStrategy$valueOf(name) {\n switch (name) {\n case 'APPEND':\n return LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance();\n case 'REPLACE':\n return LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance();\n case 'APPEND_IF_EQUAL':\n return LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_getInstance();\n case 'IGNORE':\n return LayerTargetLocator$Collector$CollectingStrategy$IGNORE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.interact.loc.LayerTargetLocator.Collector.CollectingStrategy.' + name);\n }\n }\n LayerTargetLocator$Collector$CollectingStrategy.valueOf_61zpoe$ = LayerTargetLocator$Collector$CollectingStrategy$valueOf;\n LayerTargetLocator$Collector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Collector',\n interfaces: []\n };\n function LayerTargetLocator_init$toProjection(this$LayerTargetLocator) {\n return function (prototype) {\n var tmp$;\n switch (prototype.hitShape_8be2vx$.kind.name) {\n case 'POINT':\n tmp$ = PointTargetProjection$Companion_getInstance().create_p1yge$(prototype.hitShape_8be2vx$.point.center, this$LayerTargetLocator.lookupSpec_0.lookupSpace);\n break;\n case 'RECT':\n tmp$ = RectTargetProjection$Companion_getInstance().create_tb1cvm$(prototype.hitShape_8be2vx$.rect, this$LayerTargetLocator.lookupSpec_0.lookupSpace);\n break;\n case 'POLYGON':\n tmp$ = PolygonTargetProjection$Companion_getInstance().create_a95qp$(prototype.hitShape_8be2vx$.points, this$LayerTargetLocator.lookupSpec_0.lookupSpace);\n break;\n case 'PATH':\n tmp$ = PathTargetProjection$Companion_getInstance().create_zb7j6l$(prototype.hitShape_8be2vx$.points, prototype.indexMapper_8be2vx$, this$LayerTargetLocator.lookupSpec_0.lookupSpace);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n }\n LayerTargetLocator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LayerTargetLocator',\n interfaces: [GeomTargetLocator]\n };\n function LocatedTargetsPicker() {\n LocatedTargetsPicker$Companion_getInstance();\n this.myPicked_0 = ArrayList_init();\n this.myMinDistance_0 = 0.0;\n this.myAllLookupResults_0 = ArrayList_init();\n }\n Object.defineProperty(LocatedTargetsPicker.prototype, 'picked', {\n configurable: true,\n get: function () {\n return this.chooseBestResult_0();\n }\n });\n LocatedTargetsPicker.prototype.addLookupResult_9sakjw$ = function (result, coord) {\n if (coord === void 0)\n coord = null;\n var lookupResult = LocatedTargetsPicker$Companion_getInstance().filterResults_0(result, coord);\n var distance = LocatedTargetsPicker$Companion_getInstance().distance_0(lookupResult, coord);\n if (!lookupResult.isCrosshairEnabled && distance > LocatedTargetsPicker$Companion_getInstance().CUTOFF_DISTANCE_8be2vx$) {\n return;\n }if (this.myPicked_0.isEmpty() || this.myMinDistance_0 > distance) {\n this.myPicked_0.clear();\n this.myPicked_0.add_11rb$(lookupResult);\n this.myMinDistance_0 = distance;\n } else if (this.myMinDistance_0 === distance && LocatedTargetsPicker$Companion_getInstance().isSameUnivariateGeom_0(this.myPicked_0.get_za3lpa$(0), lookupResult))\n this.myPicked_0.add_11rb$(lookupResult);\n else if (this.myMinDistance_0 === distance) {\n this.myPicked_0.clear();\n this.myPicked_0.add_11rb$(lookupResult);\n }this.myAllLookupResults_0.add_11rb$(lookupResult);\n };\n function LocatedTargetsPicker$chooseBestResult$hasGeneralTooltip(lookupResult) {\n return lookupResult.contextualMapping.hasGeneralTooltip;\n }\n function LocatedTargetsPicker$chooseBestResult$hasAxisTooltip(lookupResult) {\n return lookupResult.contextualMapping.hasAxisTooltip || listOf_0([GeomKind.V_LINE, GeomKind.H_LINE]).contains_11rb$(lookupResult.geomKind);\n }\n LocatedTargetsPicker.prototype.chooseBestResult_0 = function () {\n var tmp$;\n var hasGeneralTooltip = LocatedTargetsPicker$chooseBestResult$hasGeneralTooltip;\n var hasAxisTooltip = LocatedTargetsPicker$chooseBestResult$hasAxisTooltip;\n var $receiver = this.myPicked_0;\n var any$result;\n any$break: do {\n var tmp$_0;\n if (Kotlin.isType($receiver, Collection) && $receiver.isEmpty()) {\n any$result = false;\n break any$break;\n }tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (hasGeneralTooltip(element) && hasAxisTooltip(element)) {\n any$result = true;\n break any$break;\n }}\n any$result = false;\n }\n while (false);\n if (any$result)\n tmp$ = this.myPicked_0;\n else {\n var $receiver_0 = this.myAllLookupResults_0;\n var none$result;\n none$break: do {\n var tmp$_1;\n if (Kotlin.isType($receiver_0, Collection) && $receiver_0.isEmpty()) {\n none$result = true;\n break none$break;\n }tmp$_1 = $receiver_0.iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n if (hasGeneralTooltip(element_0)) {\n none$result = false;\n break none$break;\n }}\n none$result = true;\n }\n while (false);\n if (none$result)\n tmp$ = this.myPicked_0;\n else {\n var $receiver_1 = this.myAllLookupResults_0;\n var any$result_0;\n any$break: do {\n var tmp$_2;\n if (Kotlin.isType($receiver_1, Collection) && $receiver_1.isEmpty()) {\n any$result_0 = false;\n break any$break;\n }tmp$_2 = $receiver_1.iterator();\n while (tmp$_2.hasNext()) {\n var element_1 = tmp$_2.next();\n if (hasGeneralTooltip(element_1) && hasAxisTooltip(element_1)) {\n any$result_0 = true;\n break any$break;\n }}\n any$result_0 = false;\n }\n while (false);\n if (any$result_0) {\n var $receiver_2 = this.myAllLookupResults_0;\n var last$result;\n last$break: do {\n var iterator = $receiver_2.listIterator_za3lpa$($receiver_2.size);\n while (iterator.hasPrevious()) {\n var element_2 = iterator.previous();\n if (hasGeneralTooltip(element_2) && hasAxisTooltip(element_2)) {\n last$result = element_2;\n break last$break;\n }}\n throw new NoSuchElementException_init_0('List contains no element matching the predicate.');\n }\n while (false);\n tmp$ = listOf(last$result);\n } else {\n var $receiver_3 = this.myAllLookupResults_0;\n var lastOrNull$result;\n lastOrNull$break: do {\n var iterator_0 = $receiver_3.listIterator_za3lpa$($receiver_3.size);\n while (iterator_0.hasPrevious()) {\n var element_3 = iterator_0.previous();\n if (hasGeneralTooltip(element_3)) {\n lastOrNull$result = element_3;\n break lastOrNull$break;\n }}\n lastOrNull$result = null;\n }\n while (false);\n var withGeneralTooltip = lastOrNull$result;\n var $receiver_4 = this.myAllLookupResults_0;\n var lastOrNull$result_0;\n lastOrNull$break: do {\n var iterator_1 = $receiver_4.listIterator_za3lpa$($receiver_4.size);\n while (iterator_1.hasPrevious()) {\n var element_4 = iterator_1.previous();\n if (hasAxisTooltip(element_4)) {\n lastOrNull$result_0 = element_4;\n break lastOrNull$break;\n }}\n lastOrNull$result_0 = null;\n }\n while (false);\n var withAxisTooltip = lastOrNull$result_0;\n tmp$ = listOfNotNull([withGeneralTooltip, withAxisTooltip]);\n }\n }\n }\n return tmp$;\n };\n function LocatedTargetsPicker$Companion() {\n LocatedTargetsPicker$Companion_instance = this;\n this.CUTOFF_DISTANCE_8be2vx$ = 30.0;\n this.FAKE_DISTANCE_8be2vx$ = 15.0;\n this.UNIVARIATE_GEOMS_0 = listOf_0([GeomKind.DENSITY, GeomKind.FREQPOLY, GeomKind.BOX_PLOT, GeomKind.HISTOGRAM, GeomKind.LINE, GeomKind.AREA, GeomKind.BAR, GeomKind.ERROR_BAR, GeomKind.CROSS_BAR, GeomKind.LINE_RANGE, GeomKind.POINT_RANGE]);\n this.UNIVARIATE_LINES_0 = listOf_0([GeomKind.DENSITY, GeomKind.FREQPOLY, GeomKind.LINE, GeomKind.AREA, GeomKind.SEGMENT]);\n }\n LocatedTargetsPicker$Companion.prototype.distance_0 = function (locatedTargetList, coord) {\n var tmp$, tmp$_0;\n var distance = locatedTargetList.distance;\n if (distance === 0.0) {\n if (!locatedTargetList.isCrosshairEnabled || coord == null) {\n tmp$_0 = this.FAKE_DISTANCE_8be2vx$;\n } else {\n var $receiver = locatedTargetList.targets;\n var destination = ArrayList_init();\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n if (element.tipLayoutHint.coord != null)\n destination.add_11rb$(element);\n }\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(destination, 10));\n var tmp$_2;\n tmp$_2 = destination.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n destination_0.add_11rb$(MathUtil_getInstance().distance_l9poh5$(coord, ensureNotNull(item.tipLayoutHint.coord)));\n }\n tmp$_0 = (tmp$ = minOrNull(destination_0)) != null ? tmp$ : this.FAKE_DISTANCE_8be2vx$;\n }\n } else {\n tmp$_0 = distance;\n }\n return tmp$_0;\n };\n LocatedTargetsPicker$Companion.prototype.isSameUnivariateGeom_0 = function (lft, rgt) {\n return lft.geomKind === rgt.geomKind && this.UNIVARIATE_GEOMS_0.contains_11rb$(rgt.geomKind);\n };\n LocatedTargetsPicker$Companion.prototype.filterResults_0 = function (lookupResult, coord) {\n if (coord == null || !this.UNIVARIATE_LINES_0.contains_11rb$(lookupResult.geomKind)) {\n return lookupResult;\n }var $receiver = lookupResult.targets;\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (element.tipLayoutHint.coord != null)\n destination.add_11rb$(element);\n }\n var geomTargets = destination;\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(geomTargets, 10));\n var tmp$_0;\n tmp$_0 = geomTargets.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination_0.add_11rb$(ensureNotNull(item.tipLayoutHint.coord).subtract_gpjtzr$(coord).x);\n }\n var minByOrNull$result;\n minByOrNull$break: do {\n var iterator = destination_0.iterator();\n if (!iterator.hasNext()) {\n minByOrNull$result = null;\n break minByOrNull$break;\n }var minElem = iterator.next();\n if (!iterator.hasNext()) {\n minByOrNull$result = minElem;\n break minByOrNull$break;\n }var it = minElem;\n var minValue = JsMath.abs(it);\n do {\n var e = iterator.next();\n var v = JsMath.abs(e);\n if (Kotlin.compareTo(minValue, v) > 0) {\n minElem = e;\n minValue = v;\n }}\n while (iterator.hasNext());\n minByOrNull$result = minElem;\n }\n while (false);\n var minXToTarget = minByOrNull$result;\n var destination_1 = ArrayList_init();\n var tmp$_1;\n tmp$_1 = geomTargets.iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n if (ensureNotNull(element_0.tipLayoutHint.coord).subtract_gpjtzr$(coord).x === minXToTarget)\n destination_1.add_11rb$(element_0);\n }\n var tmp$_2;\n var set = HashSet_init_0();\n var list = ArrayList_init();\n tmp$_2 = destination_1.iterator();\n while (tmp$_2.hasNext()) {\n var e_0 = tmp$_2.next();\n var key = e_0.hitIndex;\n if (set.add_11rb$(key))\n list.add_11rb$(e_0);\n }\n var newTargets = list;\n return new GeomTargetLocator$LookupResult(newTargets, lookupResult.distance, lookupResult.geomKind, lookupResult.contextualMapping, lookupResult.isCrosshairEnabled);\n };\n LocatedTargetsPicker$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LocatedTargetsPicker$Companion_instance = null;\n function LocatedTargetsPicker$Companion_getInstance() {\n if (LocatedTargetsPicker$Companion_instance === null) {\n new LocatedTargetsPicker$Companion();\n }return LocatedTargetsPicker$Companion_instance;\n }\n LocatedTargetsPicker.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LocatedTargetsPicker',\n interfaces: []\n };\n function TargetDetector(locatorLookupSpace, locatorLookupStrategy) {\n TargetDetector$Companion_getInstance();\n this.locatorLookupSpace_0 = locatorLookupSpace;\n this.locatorLookupStrategy_0 = locatorLookupStrategy;\n }\n function TargetDetector$checkPath$lambda(closure$pathPoints) {\n return function (index) {\n return closure$pathPoints.get_za3lpa$(index).projection().x();\n };\n }\n TargetDetector.prototype.checkPath_z3141m$ = function (cursorCoord, pathProjection, closestPointChecker) {\n var tmp$, tmp$_0, tmp$_1;\n switch (this.locatorLookupSpace_0.name) {\n case 'X':\n if (this.locatorLookupStrategy_0 === GeomTargetLocator$LookupStrategy.NONE) {\n return null;\n }\n var pathPoints = pathProjection.points;\n if (pathPoints.isEmpty()) {\n return null;\n }\n var resultIndex = TargetDetector$Companion_getInstance().binarySearch_0(cursorCoord.x, pathPoints.size, TargetDetector$checkPath$lambda(pathPoints));\n var bestPoint = pathPoints.get_za3lpa$(resultIndex);\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n if (cursorCoord.x < pathPoints.get_za3lpa$(0).projection().x() || cursorCoord.x > pathPoints.get_za3lpa$(pathPoints.size - 1 | 0).projection().x()) {\n tmp$ = null;\n } else\n tmp$ = bestPoint;\n break;\n case 'NEAREST':\n tmp$ = bestPoint;\n break;\n default:throw IllegalStateException_init('Unknown lookup strategy: ' + this.locatorLookupStrategy_0);\n }\n\n return tmp$;\n case 'XY':\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n tmp$_0 = pathProjection.points.iterator();\n while (tmp$_0.hasNext()) {\n var pathPoint = tmp$_0.next();\n var targetPointCoord = pathPoint.projection().xy();\n if (MathUtil_getInstance().areEqual_f1g2it$(targetPointCoord, cursorCoord, TargetDetector$Companion_getInstance().POINT_AREA_EPSILON_0)) {\n return pathPoint;\n }}\n\n return null;\n case 'NEAREST':\n var nearestPoint = null;\n tmp$_1 = pathProjection.points.iterator();\n while (tmp$_1.hasNext()) {\n var pathPoint_0 = tmp$_1.next();\n var targetPointCoord_0 = pathPoint_0.projection().xy();\n if (closestPointChecker.check_gpjtzr$(targetPointCoord_0)) {\n nearestPoint = pathPoint_0;\n }}\n\n return nearestPoint;\n case 'NONE':\n return null;\n default:Kotlin.noWhenBranchMatched();\n break;\n }\n\n break;\n case 'NONE':\n return null;\n default:throw IllegalStateException_init_0();\n }\n };\n TargetDetector.prototype.checkPoint_w0b42b$ = function (cursorCoord, pointProjection, closestPointChecker) {\n var tmp$, tmp$_0;\n switch (this.locatorLookupSpace_0.name) {\n case 'X':\n var x = pointProjection.x();\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n tmp$ = MathUtil_getInstance().areEqual_hln2n9$(x, cursorCoord.x, TargetDetector$Companion_getInstance().POINT_AREA_EPSILON_0);\n break;\n case 'NEAREST':\n tmp$ = closestPointChecker.check_gpjtzr$(new DoubleVector(x, 0.0));\n break;\n case 'NONE':\n tmp$ = false;\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n\n return tmp$;\n case 'XY':\n var targetPointCoord = pointProjection.xy();\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n tmp$_0 = MathUtil_getInstance().areEqual_f1g2it$(targetPointCoord, cursorCoord, TargetDetector$Companion_getInstance().POINT_AREA_EPSILON_0);\n break;\n case 'NEAREST':\n tmp$_0 = closestPointChecker.check_gpjtzr$(targetPointCoord);\n break;\n case 'NONE':\n tmp$_0 = false;\n break;\n default:tmp$_0 = Kotlin.noWhenBranchMatched();\n break;\n }\n\n return tmp$_0;\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n };\n TargetDetector.prototype.checkRect_fqo6rd$ = function (cursorCoord, rectProjection, closestPointChecker) {\n switch (this.locatorLookupSpace_0.name) {\n case 'X':\n var range = rectProjection.x();\n return this.rangeBasedLookup_0(cursorCoord, closestPointChecker, range);\n case 'XY':\n var rect = rectProjection.xy();\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n return rect.contains_gpjtzr$(cursorCoord);\n case 'NEAREST':\n if (rect.contains_gpjtzr$(cursorCoord)) {\n return closestPointChecker.check_gpjtzr$(cursorCoord);\n }\n var x = cursorCoord.x < rect.left ? rect.left : rect.right;\n var y = cursorCoord.y < rect.top ? rect.top : rect.bottom;\n x = rect.xRange().contains_mef7kx$(cursorCoord.x) ? cursorCoord.x : x;\n y = rect.yRange().contains_mef7kx$(cursorCoord.y) ? cursorCoord.y : y;\n return closestPointChecker.check_gpjtzr$(new DoubleVector(x, y));\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n };\n TargetDetector.prototype.checkPolygon_q60eo3$ = function (cursorCoord, polygonProjection, closestPointChecker) {\n var tmp$;\n switch (this.locatorLookupSpace_0.name) {\n case 'X':\n var range = polygonProjection.x();\n return this.rangeBasedLookup_0(cursorCoord, closestPointChecker, range);\n case 'XY':\n var polygon = polygonProjection.xy();\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n case 'NEAREST':\n var counter = 0;\n tmp$ = polygon.iterator();\n while (tmp$.hasNext()) {\n var ring = tmp$.next();\n if (ring.bbox.contains_gpjtzr$(cursorCoord) && MathUtil_getInstance().polygonContainsCoordinate_sz9prc$(ring.edges, cursorCoord)) {\n counter = counter + 1 | 0;\n }}\n\n return counter % 2 !== 0;\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n\n break;\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n };\n TargetDetector.prototype.rangeBasedLookup_0 = function (cursorCoord, closestPointChecker, range) {\n var tmp$;\n switch (this.locatorLookupStrategy_0.name) {\n case 'HOVER':\n return range.contains_14dthe$(cursorCoord.x);\n case 'NEAREST':\n if (!range.contains_14dthe$(cursorCoord.x - TargetDetector$Companion_getInstance().RECT_X_NEAREST_EPSILON_0) && !range.contains_14dthe$(cursorCoord.x + TargetDetector$Companion_getInstance().RECT_X_NEAREST_EPSILON_0)) {\n tmp$ = false;\n } else\n tmp$ = closestPointChecker.compare_gpjtzr$(new DoubleVector(range.start() + range.length() / 2, cursorCoord.y)) !== MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance();\n return tmp$;\n case 'NONE':\n return false;\n default:throw IllegalStateException_init_0();\n }\n };\n function TargetDetector$Companion() {\n TargetDetector$Companion_instance = this;\n this.POINT_AREA_EPSILON_0 = 0.1;\n this.POINT_X_NEAREST_EPSILON_0 = 2.0;\n this.RECT_X_NEAREST_EPSILON_0 = 2.0;\n }\n TargetDetector$Companion.prototype.binarySearch_0 = function (value, length, indexer) {\n var tmp$;\n if (value < indexer(0)) {\n return 0;\n }if (value > indexer(length - 1 | 0)) {\n return length - 1 | 0;\n }var lo = 0;\n var hi = length - 1 | 0;\n while (lo <= hi) {\n var mid = (hi + lo | 0) / 2 | 0;\n var midValue = indexer(mid);\n if (value < midValue)\n hi = mid - 1 | 0;\n else if (value > midValue)\n lo = mid + 1 | 0;\n else\n return mid;\n }\n if (indexer(lo) - value < value - indexer(hi)) {\n tmp$ = lo;\n } else {\n tmp$ = hi;\n }\n return tmp$;\n };\n TargetDetector$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TargetDetector$Companion_instance = null;\n function TargetDetector$Companion_getInstance() {\n if (TargetDetector$Companion_instance === null) {\n new TargetDetector$Companion();\n }return TargetDetector$Companion_instance;\n }\n TargetDetector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TargetDetector',\n interfaces: []\n };\n function TargetProjection() {\n }\n TargetProjection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TargetProjection',\n interfaces: []\n };\n function PointTargetProjection(data) {\n PointTargetProjection$Companion_getInstance();\n TargetProjection.call(this);\n this.data = data;\n }\n PointTargetProjection.prototype.x = function () {\n var tmp$;\n return typeof (tmp$ = this.data) === 'number' ? tmp$ : throwCCE();\n };\n PointTargetProjection.prototype.xy = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.data, DoubleVector) ? tmp$ : throwCCE();\n };\n function PointTargetProjection$Companion() {\n PointTargetProjection$Companion_instance = this;\n }\n PointTargetProjection$Companion.prototype.create_p1yge$ = function (p, lookupSpace) {\n var tmp$;\n switch (lookupSpace.name) {\n case 'X':\n tmp$ = new PointTargetProjection(p.x);\n break;\n case 'XY':\n tmp$ = new PointTargetProjection(p);\n break;\n case 'NONE':\n tmp$ = undefinedLookupSpaceError();\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n PointTargetProjection$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PointTargetProjection$Companion_instance = null;\n function PointTargetProjection$Companion_getInstance() {\n if (PointTargetProjection$Companion_instance === null) {\n new PointTargetProjection$Companion();\n }return PointTargetProjection$Companion_instance;\n }\n PointTargetProjection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PointTargetProjection',\n interfaces: [TargetProjection]\n };\n function RectTargetProjection(data) {\n RectTargetProjection$Companion_getInstance();\n TargetProjection.call(this);\n this.data = data;\n }\n RectTargetProjection.prototype.x = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.data, MathUtil$DoubleRange) ? tmp$ : throwCCE();\n };\n RectTargetProjection.prototype.xy = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.data, DoubleRectangle) ? tmp$ : throwCCE();\n };\n function RectTargetProjection$Companion() {\n RectTargetProjection$Companion_instance = this;\n }\n RectTargetProjection$Companion.prototype.create_tb1cvm$ = function (rect, lookupSpace) {\n var tmp$;\n switch (lookupSpace.name) {\n case 'X':\n tmp$ = new RectTargetProjection(MathUtil$DoubleRange$Companion_getInstance().withStartAndEnd_lu1900$(rect.left, rect.right));\n break;\n case 'XY':\n tmp$ = new RectTargetProjection(rect);\n break;\n case 'NONE':\n tmp$ = undefinedLookupSpaceError();\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n RectTargetProjection$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RectTargetProjection$Companion_instance = null;\n function RectTargetProjection$Companion_getInstance() {\n if (RectTargetProjection$Companion_instance === null) {\n new RectTargetProjection$Companion();\n }return RectTargetProjection$Companion_instance;\n }\n RectTargetProjection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RectTargetProjection',\n interfaces: [TargetProjection]\n };\n function PolygonTargetProjection(data) {\n PolygonTargetProjection$Companion_getInstance();\n TargetProjection.call(this);\n this.data = data;\n }\n PolygonTargetProjection.prototype.x = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.data, MathUtil$DoubleRange) ? tmp$ : throwCCE();\n };\n PolygonTargetProjection.prototype.xy = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = this.data, List) ? tmp$ : throwCCE();\n };\n function PolygonTargetProjection$Companion() {\n PolygonTargetProjection$Companion_instance = this;\n this.AREA_LIMIT_TO_REMOVE_POLYGON_0 = 25.0;\n this.POINTS_COUNT_TO_SKIP_SIMPLIFICATION_0 = 20.0;\n this.AREA_TOLERANCE_RATIO_0 = 0.1;\n this.MAX_TOLERANCE_0 = 40.0;\n this.isLogEnabled_0 = false;\n }\n PolygonTargetProjection$Companion.prototype.create_a95qp$ = function (points, lookupSpace) {\n var tmp$;\n var rings = splitRings(points);\n switch (lookupSpace.name) {\n case 'X':\n tmp$ = new PolygonTargetProjection(this.mapToX_0(rings));\n break;\n case 'XY':\n tmp$ = new PolygonTargetProjection(this.mapToXY_0(rings));\n break;\n case 'NONE':\n tmp$ = undefinedLookupSpaceError();\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n PolygonTargetProjection$Companion.prototype.mapToX_0 = function (rings) {\n var tmp$, tmp$_0;\n var min = rings.get_za3lpa$(0).get_za3lpa$(0).x;\n var max = min;\n tmp$ = rings.iterator();\n while (tmp$.hasNext()) {\n var ring = tmp$.next();\n tmp$_0 = ring.iterator();\n while (tmp$_0.hasNext()) {\n var point = tmp$_0.next();\n var a = min;\n var b = point.x;\n min = JsMath.min(a, b);\n var a_0 = max;\n var b_0 = point.x;\n max = JsMath.max(a_0, b_0);\n }\n }\n return MathUtil$DoubleRange$Companion_getInstance().withStartAndEnd_lu1900$(min, max);\n };\n PolygonTargetProjection$Companion.prototype.mapToXY_0 = function (rings) {\n var tmp$;\n var polygon = ArrayList_init();\n tmp$ = rings.iterator();\n while (tmp$.hasNext()) {\n var ring = tmp$.next();\n if (ring.size < 4) {\n continue;\n }var bbox = geometry.DoubleRectangles.boundingBox_qdtdbw$(ring);\n var area = calculateArea(ring);\n var simplifiedRing;\n if (ring.size > this.POINTS_COUNT_TO_SKIP_SIMPLIFICATION_0) {\n var a = area * this.AREA_TOLERANCE_RATIO_0;\n var b = this.MAX_TOLERANCE_0;\n var tolerance = JsMath.min(a, b);\n simplifiedRing = PolylineSimplifier.Companion.visvalingamWhyatt_ytws2g$(ring).setWeightLimit_14dthe$(tolerance).points;\n if (this.isLogEnabled_0) {\n this.log_0('Simp: ' + toString(ring.size) + ' -> ' + toString(simplifiedRing.size) + ', tolerance=' + toString(tolerance) + ', bbox=' + toString(bbox) + ', area=' + toString(area));\n }} else {\n if (this.isLogEnabled_0) {\n this.log_0('Keep: size: ' + toString(ring.size) + ', bbox=' + toString(bbox) + ', area=' + toString(area));\n }simplifiedRing = ring;\n }\n if (simplifiedRing.size < 4) {\n continue;\n }polygon.add_11rb$(new PolygonTargetProjection$RingXY(simplifiedRing, bbox));\n }\n return polygon;\n };\n PolygonTargetProjection$Companion.prototype.log_0 = function (str) {\n println(str);\n };\n PolygonTargetProjection$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PolygonTargetProjection$Companion_instance = null;\n function PolygonTargetProjection$Companion_getInstance() {\n if (PolygonTargetProjection$Companion_instance === null) {\n new PolygonTargetProjection$Companion();\n }return PolygonTargetProjection$Companion_instance;\n }\n function PolygonTargetProjection$RingXY(edges, bbox) {\n this.edges = edges;\n this.bbox = bbox;\n }\n PolygonTargetProjection$RingXY.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RingXY',\n interfaces: []\n };\n PolygonTargetProjection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolygonTargetProjection',\n interfaces: [TargetProjection]\n };\n function PathTargetProjection(data) {\n PathTargetProjection$Companion_getInstance();\n TargetProjection.call(this);\n this.data = data;\n this.points = this.data;\n }\n function PathTargetProjection$PathPoint(myPointTargetProjection, originalCoord, index) {\n PathTargetProjection$PathPoint$Companion_getInstance();\n this.myPointTargetProjection_0 = myPointTargetProjection;\n this.originalCoord = originalCoord;\n this.index = index;\n }\n PathTargetProjection$PathPoint.prototype.projection = function () {\n return this.myPointTargetProjection_0;\n };\n function PathTargetProjection$PathPoint$Companion() {\n PathTargetProjection$PathPoint$Companion_instance = this;\n }\n PathTargetProjection$PathPoint$Companion.prototype.create_hdp8xa$ = function (p, index, lookupSpace) {\n var tmp$;\n switch (lookupSpace.name) {\n case 'X':\n tmp$ = new PathTargetProjection$PathPoint(PointTargetProjection$Companion_getInstance().create_p1yge$(p, lookupSpace), p, index);\n break;\n case 'XY':\n tmp$ = new PathTargetProjection$PathPoint(PointTargetProjection$Companion_getInstance().create_p1yge$(p, lookupSpace), p, index);\n break;\n case 'NONE':\n tmp$ = undefinedLookupSpaceError();\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n PathTargetProjection$PathPoint$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PathTargetProjection$PathPoint$Companion_instance = null;\n function PathTargetProjection$PathPoint$Companion_getInstance() {\n if (PathTargetProjection$PathPoint$Companion_instance === null) {\n new PathTargetProjection$PathPoint$Companion();\n }return PathTargetProjection$PathPoint$Companion_instance;\n }\n PathTargetProjection$PathPoint.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PathPoint',\n interfaces: []\n };\n function PathTargetProjection$Companion() {\n PathTargetProjection$Companion_instance = this;\n }\n PathTargetProjection$Companion.prototype.create_zb7j6l$ = function (points, indexMapper, lookupSpace) {\n var pointsLocation = ArrayList_init();\n var i = 0;\n for (var tmp$ = points.iterator(); tmp$.hasNext(); ++i) {\n var point = tmp$.next();\n pointsLocation.add_11rb$(PathTargetProjection$PathPoint$Companion_getInstance().create_hdp8xa$(point, indexMapper(i), lookupSpace));\n }\n return new PathTargetProjection(pointsLocation);\n };\n PathTargetProjection$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PathTargetProjection$Companion_instance = null;\n function PathTargetProjection$Companion_getInstance() {\n if (PathTargetProjection$Companion_instance === null) {\n new PathTargetProjection$Companion();\n }return PathTargetProjection$Companion_instance;\n }\n PathTargetProjection.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PathTargetProjection',\n interfaces: [TargetProjection]\n };\n function undefinedLookupSpaceError() {\n throw IllegalStateException_init('Undefined geom lookup space');\n }\n function TargetPrototype(hitShape, indexMapper, tooltipParams, tooltipKind) {\n TargetPrototype$Companion_getInstance();\n this.hitShape_8be2vx$ = hitShape;\n this.indexMapper_8be2vx$ = indexMapper;\n this.tooltipParams_0 = tooltipParams;\n this.tooltipKind_8be2vx$ = tooltipKind;\n }\n TargetPrototype.prototype.createGeomTarget_x7nr8i$ = function (hitCoord, hitIndex) {\n return new GeomTarget(hitIndex, TargetPrototype$Companion_getInstance().createTipLayoutHint_17pt0e$(hitCoord, this.hitShape_8be2vx$, this.tooltipParams_0.getColor(), this.tooltipKind_8be2vx$, this.tooltipParams_0.getStemLength()), this.tooltipParams_0.getTipLayoutHints());\n };\n function TargetPrototype$Companion() {\n TargetPrototype$Companion_instance = this;\n }\n TargetPrototype$Companion.prototype.createTipLayoutHint_17pt0e$ = function (hitCoord, hitShape, fill, tooltipKind, stemLength) {\n var tmp$;\n switch (hitShape.kind.name) {\n case 'POINT':\n switch (tooltipKind.name) {\n case 'VERTICAL_TOOLTIP':\n tmp$ = TipLayoutHint.Companion.verticalTooltip_6lq1u6$(hitCoord, hitShape.point.radius, fill, stemLength);\n break;\n case 'CURSOR_TOOLTIP':\n tmp$ = TipLayoutHint.Companion.cursorTooltip_itpcqk$(hitCoord, fill, stemLength);\n break;\n default:throw IllegalStateException_init(('Wrong TipLayoutHint.kind = ' + tooltipKind + ' for POINT').toString());\n }\n\n break;\n case 'RECT':\n switch (tooltipKind.name) {\n case 'VERTICAL_TOOLTIP':\n tmp$ = TipLayoutHint.Companion.verticalTooltip_6lq1u6$(hitCoord, 0.0, fill, stemLength);\n break;\n case 'HORIZONTAL_TOOLTIP':\n tmp$ = TipLayoutHint.Companion.horizontalTooltip_6lq1u6$(hitCoord, hitShape.rect.width / 2, fill, stemLength);\n break;\n case 'CURSOR_TOOLTIP':\n tmp$ = TipLayoutHint.Companion.cursorTooltip_itpcqk$(hitCoord, fill, stemLength);\n break;\n default:throw IllegalStateException_init(('Wrong TipLayoutHint.kind = ' + tooltipKind + ' for RECT').toString());\n }\n\n break;\n case 'PATH':\n if (equals(tooltipKind, TipLayoutHint$Kind.HORIZONTAL_TOOLTIP))\n tmp$ = TipLayoutHint.Companion.horizontalTooltip_6lq1u6$(hitCoord, 0.0, fill, stemLength);\n else {\n throw IllegalStateException_init(('Wrong TipLayoutHint.kind = ' + tooltipKind + ' for PATH').toString());\n }\n\n break;\n case 'POLYGON':\n if (equals(tooltipKind, TipLayoutHint$Kind.CURSOR_TOOLTIP))\n tmp$ = TipLayoutHint.Companion.cursorTooltip_itpcqk$(hitCoord, fill, stemLength);\n else {\n throw IllegalStateException_init(('Wrong TipLayoutHint.kind = ' + tooltipKind + ' for POLYGON').toString());\n }\n\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n TargetPrototype$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TargetPrototype$Companion_instance = null;\n function TargetPrototype$Companion_getInstance() {\n if (TargetPrototype$Companion_instance === null) {\n new TargetPrototype$Companion();\n }return TargetPrototype$Companion_instance;\n }\n TargetPrototype.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TargetPrototype',\n interfaces: []\n };\n function TransformedTargetLocator(targetLocator) {\n this.targetLocator_q7bze5$_0 = targetLocator;\n }\n TransformedTargetLocator.prototype.search_gpjtzr$ = function (coord) {\n var tmp$;\n var targetCoord = this.convertToTargetCoord_gpjtzr$(coord);\n tmp$ = this.targetLocator_q7bze5$_0.search_gpjtzr$(targetCoord);\n if (tmp$ == null) {\n return null;\n }var result = tmp$;\n return this.convertLookupResult_rz45e2$_0(result);\n };\n TransformedTargetLocator.prototype.convertLookupResult_rz45e2$_0 = function (lookupResult) {\n return new GeomTargetLocator$LookupResult(this.convertGeomTargets_cu5hhh$_0(lookupResult.targets), this.convertToPlotDistance_14dthe$(lookupResult.distance), lookupResult.geomKind, lookupResult.contextualMapping, lookupResult.contextualMapping.isCrosshairEnabled);\n };\n function TransformedTargetLocator$convertGeomTargets$lambda(this$TransformedTargetLocator) {\n return function (geomTarget) {\n return new GeomTarget(geomTarget.hitIndex, this$TransformedTargetLocator.convertTipLayoutHint_jnrdzl$_0(geomTarget.tipLayoutHint), this$TransformedTargetLocator.convertTipLayoutHints_dshtp8$_0(geomTarget.aesTipLayoutHints));\n };\n }\n TransformedTargetLocator.prototype.convertGeomTargets_cu5hhh$_0 = function (geomTargets) {\n return ArrayList_init_1(collect.Lists.transform_l7riir$(geomTargets, TransformedTargetLocator$convertGeomTargets$lambda(this)));\n };\n TransformedTargetLocator.prototype.convertTipLayoutHint_jnrdzl$_0 = function (hint) {\n return new TipLayoutHint(hint.kind, ensureNotNull(this.safeConvertToPlotCoord_eoxeor$_0(hint.coord)), this.convertToPlotDistance_14dthe$(hint.objectRadius), hint.color, hint.stemLength);\n };\n TransformedTargetLocator.prototype.convertTipLayoutHints_dshtp8$_0 = function (tipLayoutHints) {\n var result = HashMap_init();\n var tmp$;\n tmp$ = tipLayoutHints.entries.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var aes = element.key;\n var hint = element.value;\n var value = this.convertTipLayoutHint_jnrdzl$_0(hint);\n result.put_xwzc9p$(aes, value);\n }\n return result;\n };\n TransformedTargetLocator.prototype.safeConvertToPlotCoord_eoxeor$_0 = function (coord) {\n return coord == null ? null : this.convertToPlotCoord_gpjtzr$(coord);\n };\n TransformedTargetLocator.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TransformedTargetLocator',\n interfaces: [GeomTargetLocator]\n };\n function AxisLayout() {\n }\n AxisLayout.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'AxisLayout',\n interfaces: []\n };\n function AxisLayoutInfo(b) {\n this.axisBreaks = null;\n this.axisLength = 0;\n this.orientation = null;\n this.axisDomain = null;\n this.tickLabelsBounds = null;\n this.tickLabelRotationAngle = 0;\n this.tickLabelHorizontalAnchor = null;\n this.tickLabelVerticalAnchor = null;\n this.tickLabelAdditionalOffsets = null;\n this.tickLabelSmallFont = false;\n this.tickLabelsBoundsMax_0 = null;\n if (!(b.myAxisBreaks != null)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }if (!(b.myOrientation != null)) {\n var message_0 = 'Failed requirement.';\n throw IllegalArgumentException_init(message_0.toString());\n }if (!(b.myTickLabelsBounds != null)) {\n var message_1 = 'Failed requirement.';\n throw IllegalArgumentException_init(message_1.toString());\n }if (!(b.myAxisDomain != null)) {\n var message_2 = 'Failed requirement.';\n throw IllegalArgumentException_init(message_2.toString());\n }this.axisBreaks = b.myAxisBreaks;\n this.axisLength = b.myAxisLength;\n this.orientation = b.myOrientation;\n this.axisDomain = b.myAxisDomain;\n this.tickLabelsBounds = b.myTickLabelsBounds;\n this.tickLabelRotationAngle = b.myTickLabelRotationAngle;\n this.tickLabelHorizontalAnchor = b.myLabelHorizontalAnchor;\n this.tickLabelVerticalAnchor = b.myLabelVerticalAnchor;\n this.tickLabelAdditionalOffsets = b.myLabelAdditionalOffsets;\n this.tickLabelSmallFont = b.myTickLabelSmallFont;\n this.tickLabelsBoundsMax_0 = b.myMaxTickLabelsBounds;\n }\n AxisLayoutInfo.prototype.withAxisLength_14dthe$ = function (axisLength) {\n var b = new AxisLayoutInfo$Builder();\n b.myAxisBreaks = this.axisBreaks;\n b.myAxisLength = axisLength;\n b.myOrientation = this.orientation;\n b.myAxisDomain = this.axisDomain;\n b.myTickLabelsBounds = this.tickLabelsBounds;\n b.myTickLabelRotationAngle = this.tickLabelRotationAngle;\n b.myLabelHorizontalAnchor = this.tickLabelHorizontalAnchor;\n b.myLabelVerticalAnchor = this.tickLabelVerticalAnchor;\n b.myLabelAdditionalOffsets = this.tickLabelAdditionalOffsets;\n b.myTickLabelSmallFont = this.tickLabelSmallFont;\n b.myMaxTickLabelsBounds = this.tickLabelsBoundsMax_0;\n return b;\n };\n AxisLayoutInfo.prototype.axisBounds = function () {\n return ensureNotNull(this.tickLabelsBounds).union_wthzt5$(DoubleRectangle_init(0.0, 0.0, 0.0, 0.0));\n };\n function AxisLayoutInfo$Builder() {\n this.myAxisLength = 0;\n this.myOrientation = null;\n this.myAxisDomain = null;\n this.myMaxTickLabelsBounds = null;\n this.myTickLabelSmallFont = false;\n this.myLabelAdditionalOffsets = null;\n this.myLabelHorizontalAnchor = null;\n this.myLabelVerticalAnchor = null;\n this.myTickLabelRotationAngle = 0.0;\n this.myTickLabelsBounds = null;\n this.myAxisBreaks = null;\n }\n AxisLayoutInfo$Builder.prototype.build = function () {\n return new AxisLayoutInfo(this);\n };\n AxisLayoutInfo$Builder.prototype.axisLength_14dthe$ = function (d) {\n this.myAxisLength = d;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.orientation_9y97dg$ = function (o) {\n this.myOrientation = o;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.axisDomain_4fzjta$ = function (r) {\n this.myAxisDomain = r;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelsBoundsMax_myx2hi$ = function (r) {\n this.myMaxTickLabelsBounds = r;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelSmallFont_6taknv$ = function (b) {\n this.myTickLabelSmallFont = b;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelAdditionalOffsets_eajcfd$ = function (labelAdditionalOffsets) {\n this.myLabelAdditionalOffsets = labelAdditionalOffsets;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelHorizontalAnchor_tk0ev1$ = function (labelHorizontalAnchor) {\n this.myLabelHorizontalAnchor = labelHorizontalAnchor;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelVerticalAnchor_24j3ht$ = function (labelVerticalAnchor) {\n this.myLabelVerticalAnchor = labelVerticalAnchor;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelRotationAngle_14dthe$ = function (rotationAngle) {\n this.myTickLabelRotationAngle = rotationAngle;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.tickLabelsBounds_myx2hi$ = function (rectangle) {\n this.myTickLabelsBounds = rectangle;\n return this;\n };\n AxisLayoutInfo$Builder.prototype.axisBreaks_hbp697$ = function (breaks) {\n this.myAxisBreaks = breaks;\n return this;\n };\n AxisLayoutInfo$Builder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Builder',\n interfaces: []\n };\n AxisLayoutInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AxisLayoutInfo',\n interfaces: []\n };\n function EmptyAxisLayout(xDomain, yDomain, myOrientation) {\n EmptyAxisLayout$Companion_getInstance();\n this.myOrientation_0 = myOrientation;\n this.myAxisDomain_0 = null;\n this.myAxisDomain_0 = this.myOrientation_0.isHorizontal ? xDomain : yDomain;\n }\n EmptyAxisLayout.prototype.initialThickness = function () {\n return 0.0;\n };\n EmptyAxisLayout.prototype.doLayout_o2m17x$ = function (displaySize, maxTickLabelsBoundsStretched) {\n var tmp$;\n var axisLength = this.myOrientation_0.isHorizontal ? displaySize.x : displaySize.y;\n if (this.myOrientation_0.isHorizontal) {\n tmp$ = DoubleRectangle_init(0.0, 0.0, axisLength, 0.0);\n } else {\n tmp$ = DoubleRectangle_init(0.0, 0.0, 0.0, axisLength);\n }\n var tickLabelsBounds = tmp$;\n var builder = (new AxisLayoutInfo$Builder()).axisBreaks_hbp697$(ScaleBreaks.Companion.EMPTY).axisLength_14dthe$(axisLength).orientation_9y97dg$(this.myOrientation_0).axisDomain_4fzjta$(this.myAxisDomain_0).tickLabelsBounds_myx2hi$(tickLabelsBounds);\n return builder.build();\n };\n function EmptyAxisLayout$Companion() {\n EmptyAxisLayout$Companion_instance = this;\n }\n EmptyAxisLayout$Companion.prototype.bottom_gyv40k$ = function (xDomain, yDomain) {\n return new EmptyAxisLayout(xDomain, yDomain, Orientation$BOTTOM_getInstance());\n };\n EmptyAxisLayout$Companion.prototype.left_gyv40k$ = function (xDomain, yDomain) {\n return new EmptyAxisLayout(xDomain, yDomain, Orientation$LEFT_getInstance());\n };\n EmptyAxisLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var EmptyAxisLayout$Companion_instance = null;\n function EmptyAxisLayout$Companion_getInstance() {\n if (EmptyAxisLayout$Companion_instance === null) {\n new EmptyAxisLayout$Companion();\n }return EmptyAxisLayout$Companion_instance;\n }\n EmptyAxisLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'EmptyAxisLayout',\n interfaces: [AxisLayout]\n };\n function FacetGridPlotLayout(facets, tileLayout) {\n FacetGridPlotLayout$Companion_getInstance();\n PlotLayoutBase.call(this);\n this.facets_0 = facets;\n this.tileLayout_0 = tileLayout;\n this.totalPanelHorizontalPadding_0 = FacetGridPlotLayout$Companion_getInstance().PANEL_PADDING_0 * (this.facets_0.colCount - 1 | 0);\n this.totalPanelVerticalPadding_0 = FacetGridPlotLayout$Companion_getInstance().PANEL_PADDING_0 * (this.facets_0.rowCount - 1 | 0);\n this.setPadding_6y0v78$(10.0, 10.0, 0.0, 0.0);\n if (!this.facets_0.isDefined) {\n var message = 'Undefined facets.';\n throw IllegalArgumentException_init(message.toString());\n }}\n FacetGridPlotLayout.prototype.doLayout_gpjtzr$ = function (preferredSize) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var tilesAreaSize = new DoubleVector(preferredSize.x - (this.paddingLeft_0 + this.paddingRight_0), preferredSize.y - (this.paddingTop_0 + this.paddingBottom_0));\n var facetTiles = this.facets_0.tileInfos();\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_3;\n tmp$_3 = facetTiles.iterator();\n while (tmp$_3.hasNext()) {\n var element = tmp$_3.next();\n if (!element.colLabs.isEmpty()) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n var tileColLabCounts = (tmp$_1 = (tmp$_0 = (tmp$ = firstOrNull$result) != null ? tmp$.colLabs : null) != null ? tmp$_0.size : null) != null ? tmp$_1 : 0;\n var destination = ArrayList_init();\n var tmp$_4;\n tmp$_4 = facetTiles.iterator();\n while (tmp$_4.hasNext()) {\n var element_0 = tmp$_4.next();\n if (!element_0.colLabs.isEmpty())\n destination.add_11rb$(element_0);\n }\n var tmp$_5;\n var set = HashSet_init_0();\n var list = ArrayList_init();\n tmp$_5 = destination.iterator();\n while (tmp$_5.hasNext()) {\n var e = tmp$_5.next();\n var key = e.row;\n if (set.add_11rb$(key))\n list.add_11rb$(e);\n }\n var tileWithColLabInRowCount = list.size;\n var totalAddedHeight = FacetGridPlotLayout$Companion_getInstance().facetColHeadHeight_za3lpa$(tileColLabCounts) * tileWithColLabInRowCount;\n var any$result;\n any$break: do {\n var tmp$_6;\n if (Kotlin.isType(facetTiles, Collection) && facetTiles.isEmpty()) {\n any$result = false;\n break any$break;\n }tmp$_6 = facetTiles.iterator();\n while (tmp$_6.hasNext()) {\n var element_1 = tmp$_6.next();\n if (element_1.rowLab != null) {\n any$result = true;\n break any$break;\n }}\n any$result = false;\n }\n while (false);\n var labsInRow = any$result ? 1 : 0;\n var labsTotalDim = new DoubleVector(labsInRow * FacetGridPlotLayout$Companion_getInstance().FACET_TAB_HEIGHT, totalAddedHeight);\n tilesAreaSize = tilesAreaSize.subtract_gpjtzr$(labsTotalDim);\n var tileWidth = (tilesAreaSize.x - this.totalPanelHorizontalPadding_0) / this.facets_0.colCount;\n var tileHeight = (tilesAreaSize.y - this.totalPanelVerticalPadding_0) / this.facets_0.rowCount;\n var tileInfo = this.layoutTile_0(tileWidth, tileHeight);\n for (var i = 0; i <= 1; i++) {\n var tilesAreaSizeNew = this.tilesAreaSize_0(tileInfo);\n var widthDiff = tilesAreaSize.x - tilesAreaSizeNew.x;\n var heightDiff = tilesAreaSize.y - tilesAreaSizeNew.y;\n var tmp$_7 = JsMath.abs(widthDiff) <= this.facets_0.colCount;\n if (tmp$_7) {\n tmp$_7 = JsMath.abs(heightDiff) <= this.facets_0.rowCount;\n }if (tmp$_7) {\n break;\n }var geomWidth = tileInfo.geomWidth_8be2vx$() + widthDiff / this.facets_0.colCount;\n var newPanelWidth = geomWidth + tileInfo.axisThicknessY_8be2vx$();\n var geomHeight = tileInfo.geomHeight_8be2vx$() + heightDiff / this.facets_0.rowCount;\n var newPanelHeight = geomHeight + tileInfo.axisThicknessX_8be2vx$();\n tileInfo = this.layoutTile_0(newPanelWidth, newPanelHeight);\n }\n var axisThicknessX = tileInfo.axisThicknessX_8be2vx$();\n var axisThicknessY = tileInfo.axisThicknessY_8be2vx$();\n var geomWidth_0 = tileInfo.geomWidth_8be2vx$();\n var geomHeight_0 = tileInfo.geomHeight_8be2vx$();\n var tilesAreaBounds = new DoubleRectangle(DoubleVector.Companion.ZERO, DoubleVector.Companion.ZERO);\n var tilesAreaOffset = new DoubleVector(this.paddingLeft_0, this.paddingTop_0);\n var tileInfos = ArrayList_init();\n var offsetX = 0.0;\n var offsetY = 0.0;\n var currRow = 0;\n var prevHeight = 0.0;\n tmp$_2 = facetTiles.iterator();\n while (tmp$_2.hasNext()) {\n var facetTile = tmp$_2.next();\n var width = geomWidth_0;\n var geomX = 0.0;\n if (facetTile.yAxis) {\n width += axisThicknessY;\n geomX = axisThicknessY;\n }if (facetTile.rowLab != null) {\n width += FacetGridPlotLayout$Companion_getInstance().FACET_TAB_HEIGHT;\n }var height = geomHeight_0;\n var geomY;\n if (facetTile.xAxis && facetTile.row === (this.facets_0.rowCount - 1 | 0)) {\n height += axisThicknessX;\n }var addedHeight = FacetGridPlotLayout$Companion_getInstance().facetColHeadHeight_za3lpa$(facetTile.colLabs.size);\n height += addedHeight;\n geomY = addedHeight;\n var bounds = DoubleRectangle_init(0.0, 0.0, width, height);\n var geomBounds = DoubleRectangle_init(geomX, geomY, geomWidth_0, geomHeight_0);\n var row = facetTile.row;\n if (row > currRow) {\n currRow = row;\n offsetY += prevHeight + FacetGridPlotLayout$Companion_getInstance().PANEL_PADDING_0;\n }prevHeight = height;\n var col = facetTile.col;\n if (col === 0) {\n offsetX = 0.0;\n }var offset = new DoubleVector(offsetX, offsetY);\n offsetX += width + FacetGridPlotLayout$Companion_getInstance().PANEL_PADDING_0;\n var info = TileLayoutInfo_init(bounds, geomBounds, XYPlotLayoutUtil_getInstance().clipBounds_wthzt5$(geomBounds), tileInfo.layoutInfo_8be2vx$.xAxisInfo, tileInfo.layoutInfo_8be2vx$.yAxisInfo, facetTile.xAxis, facetTile.yAxis, facetTile.trueIndex).withOffset_gpjtzr$(tilesAreaOffset.add_gpjtzr$(offset)).withFacetLabels_5hkr16$(facetTile.colLabs, facetTile.rowLab);\n tileInfos.add_11rb$(info);\n tilesAreaBounds = tilesAreaBounds.union_wthzt5$(info.getAbsoluteBounds_gpjtzr$(tilesAreaOffset));\n }\n var plotSize = new DoubleVector(tilesAreaBounds.right + this.paddingRight_0, tilesAreaBounds.height + this.paddingBottom_0);\n return new PlotLayoutInfo(tileInfos, plotSize);\n };\n FacetGridPlotLayout.prototype.layoutTile_0 = function (tileWidth, tileHeight) {\n var layoutInfo = this.tileLayout_0.doLayout_gpjtzr$(new DoubleVector(tileWidth, tileHeight));\n return new FacetGridPlotLayout$MyTileInfo(layoutInfo);\n };\n FacetGridPlotLayout.prototype.tilesAreaSize_0 = function (tileInfo) {\n var w = tileInfo.geomWidth_8be2vx$() * this.facets_0.colCount + this.totalPanelHorizontalPadding_0 + tileInfo.axisThicknessY_8be2vx$();\n var h = tileInfo.geomHeight_8be2vx$() * this.facets_0.rowCount + this.totalPanelVerticalPadding_0 + tileInfo.axisThicknessX_8be2vx$();\n return new DoubleVector(w, h);\n };\n function FacetGridPlotLayout$MyTileInfo(layoutInfo) {\n this.layoutInfo_8be2vx$ = layoutInfo;\n }\n FacetGridPlotLayout$MyTileInfo.prototype.axisThicknessX_8be2vx$ = function () {\n return this.layoutInfo_8be2vx$.bounds.bottom - this.layoutInfo_8be2vx$.geomBounds.bottom;\n };\n FacetGridPlotLayout$MyTileInfo.prototype.axisThicknessY_8be2vx$ = function () {\n return this.layoutInfo_8be2vx$.geomBounds.left - this.layoutInfo_8be2vx$.bounds.left;\n };\n FacetGridPlotLayout$MyTileInfo.prototype.geomWidth_8be2vx$ = function () {\n return this.layoutInfo_8be2vx$.geomBounds.width;\n };\n FacetGridPlotLayout$MyTileInfo.prototype.geomHeight_8be2vx$ = function () {\n return this.layoutInfo_8be2vx$.geomBounds.height;\n };\n FacetGridPlotLayout$MyTileInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyTileInfo',\n interfaces: []\n };\n function FacetGridPlotLayout$Companion() {\n FacetGridPlotLayout$Companion_instance = this;\n this.FACET_TAB_HEIGHT = 30.0;\n this.FACET_H_PADDING = 0;\n this.FACET_V_PADDING = 6;\n this.PANEL_PADDING_0 = 10.0;\n }\n FacetGridPlotLayout$Companion.prototype.facetColLabelSize_14dthe$ = function (colWidth) {\n return new DoubleVector(colWidth - 0, this.FACET_TAB_HEIGHT - 6 * 2.0);\n };\n FacetGridPlotLayout$Companion.prototype.facetColHeadHeight_za3lpa$ = function (labCount) {\n var tmp$;\n if (labCount > 0) {\n tmp$ = this.facetColLabelSize_14dthe$(0.0).y * labCount + 12;\n } else {\n tmp$ = 0.0;\n }\n return tmp$;\n };\n FacetGridPlotLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var FacetGridPlotLayout$Companion_instance = null;\n function FacetGridPlotLayout$Companion_getInstance() {\n if (FacetGridPlotLayout$Companion_instance === null) {\n new FacetGridPlotLayout$Companion();\n }return FacetGridPlotLayout$Companion_instance;\n }\n FacetGridPlotLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FacetGridPlotLayout',\n interfaces: [PlotLayoutBase]\n };\n function GeometryUtil() {\n GeometryUtil_instance = this;\n }\n GeometryUtil.prototype.union_te9coj$ = function (first, optionalSecond) {\n var tmp$;\n if (optionalSecond == null) {\n tmp$ = first;\n } else\n tmp$ = first.union_wthzt5$(optionalSecond);\n return tmp$;\n };\n GeometryUtil.prototype.union_a7nkjf$ = function (head, c) {\n var tmp$;\n var result = head;\n tmp$ = c.iterator();\n while (tmp$.hasNext()) {\n var r = tmp$.next();\n result = result.union_wthzt5$(r);\n }\n return result;\n };\n GeometryUtil.prototype.doubleRange_gyv40k$ = function (xRange, yRange) {\n var xOrigin = xRange.lowerEnd;\n var yOrigin = yRange.lowerEnd;\n var xSpan = xRange.upperEnd - xRange.lowerEnd;\n var ySpan = yRange.upperEnd - yRange.lowerEnd;\n return DoubleRectangle_init(xOrigin, yOrigin, xSpan, ySpan);\n };\n GeometryUtil.prototype.changeWidth_j6cmed$ = function (r, width) {\n return DoubleRectangle_init(r.origin.x, r.origin.y, width, r.dimension.y);\n };\n GeometryUtil.prototype.changeWidthKeepRight_j6cmed$ = function (r, width) {\n return DoubleRectangle_init(r.right - width, r.origin.y, width, r.dimension.y);\n };\n GeometryUtil.prototype.changeHeight_j6cmed$ = function (r, height) {\n return DoubleRectangle_init(r.origin.x, r.origin.y, r.dimension.x, height);\n };\n GeometryUtil.prototype.changeHeightKeepBottom_j6cmed$ = function (r, height) {\n return DoubleRectangle_init(r.origin.x, r.bottom - height, r.dimension.x, height);\n };\n GeometryUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GeometryUtil',\n interfaces: []\n };\n var GeometryUtil_instance = null;\n function GeometryUtil_getInstance() {\n if (GeometryUtil_instance === null) {\n new GeometryUtil();\n }return GeometryUtil_instance;\n }\n function LegendBoxInfo(size) {\n LegendBoxInfo$Companion_getInstance();\n this.size_8be2vx$ = size;\n }\n Object.defineProperty(LegendBoxInfo.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n function LegendBoxInfo$Companion() {\n LegendBoxInfo$Companion_instance = this;\n this.EMPTY = new LegendBoxInfo$Companion$EMPTY$ObjectLiteral(DoubleVector.Companion.ZERO);\n }\n function LegendBoxInfo$Companion$EMPTY$ObjectLiteral(size) {\n LegendBoxInfo.call(this, size);\n }\n Object.defineProperty(LegendBoxInfo$Companion$EMPTY$ObjectLiteral.prototype, 'isEmpty', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n LegendBoxInfo$Companion$EMPTY$ObjectLiteral.prototype.createLegendBox = function () {\n throw IllegalStateException_init('Empty legend box info');\n };\n LegendBoxInfo$Companion$EMPTY$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [LegendBoxInfo]\n };\n LegendBoxInfo$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LegendBoxInfo$Companion_instance = null;\n function LegendBoxInfo$Companion_getInstance() {\n if (LegendBoxInfo$Companion_instance === null) {\n new LegendBoxInfo$Companion();\n }return LegendBoxInfo$Companion_instance;\n }\n LegendBoxInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBoxInfo',\n interfaces: []\n };\n function LegendBoxesLayout(myPlotBounds, myTheme) {\n this.myPlotBounds_0 = myPlotBounds;\n this.myTheme_0 = myTheme;\n }\n LegendBoxesLayout.prototype.doLayout_8sg693$ = function (infos) {\n var legendPosition = this.myTheme_0.position();\n var legendJustification = this.myTheme_0.justification();\n var legendArrangement = LegendArrangement$VERTICAL_getInstance();\n var plotCenter = this.myPlotBounds_0.center;\n var plotInnerBoundsWithoutLegendBoxes = this.myPlotBounds_0;\n var boxWithLocationList = legendArrangement === LegendArrangement$VERTICAL_getInstance() ? LegendBoxesLayoutUtil_getInstance().verticalStack_8sg693$(infos) : LegendBoxesLayoutUtil_getInstance().horizontalStack_8sg693$(infos);\n var boxesSize = LegendBoxesLayoutUtil_getInstance().size_9w4uif$(boxWithLocationList);\n if (equals(legendPosition, LegendPosition$Companion_getInstance().LEFT) || equals(legendPosition, LegendPosition$Companion_getInstance().RIGHT)) {\n var b = plotInnerBoundsWithoutLegendBoxes.width - boxesSize.x;\n var plotWidth = JsMath.max(0.0, b);\n if (equals(legendPosition, LegendPosition$Companion_getInstance().LEFT)) {\n plotInnerBoundsWithoutLegendBoxes = GeometryUtil_getInstance().changeWidthKeepRight_j6cmed$(plotInnerBoundsWithoutLegendBoxes, plotWidth);\n } else {\n plotInnerBoundsWithoutLegendBoxes = GeometryUtil_getInstance().changeWidth_j6cmed$(plotInnerBoundsWithoutLegendBoxes, plotWidth);\n }\n } else if (equals(legendPosition, LegendPosition$Companion_getInstance().TOP) || equals(legendPosition, LegendPosition$Companion_getInstance().BOTTOM)) {\n var b_0 = plotInnerBoundsWithoutLegendBoxes.height - boxesSize.y;\n var plotHeight = JsMath.max(0.0, b_0);\n if (equals(legendPosition, LegendPosition$Companion_getInstance().TOP)) {\n plotInnerBoundsWithoutLegendBoxes = GeometryUtil_getInstance().changeHeightKeepBottom_j6cmed$(plotInnerBoundsWithoutLegendBoxes, plotHeight);\n } else {\n plotInnerBoundsWithoutLegendBoxes = GeometryUtil_getInstance().changeHeight_j6cmed$(plotInnerBoundsWithoutLegendBoxes, plotHeight);\n }\n }var legendOrigin;\n if (equals(legendPosition, LegendPosition$Companion_getInstance().LEFT)) {\n legendOrigin = new DoubleVector(plotInnerBoundsWithoutLegendBoxes.left - boxesSize.x, plotCenter.y - boxesSize.y / 2);\n } else if (equals(legendPosition, LegendPosition$Companion_getInstance().RIGHT)) {\n legendOrigin = new DoubleVector(plotInnerBoundsWithoutLegendBoxes.right, plotCenter.y - boxesSize.y / 2);\n } else if (equals(legendPosition, LegendPosition$Companion_getInstance().TOP)) {\n legendOrigin = new DoubleVector(plotCenter.x - boxesSize.x / 2, plotInnerBoundsWithoutLegendBoxes.top - boxesSize.y);\n } else if (equals(legendPosition, LegendPosition$Companion_getInstance().BOTTOM)) {\n legendOrigin = new DoubleVector(plotCenter.x - boxesSize.x / 2, plotInnerBoundsWithoutLegendBoxes.bottom);\n } else {\n legendOrigin = LegendBoxesLayoutUtil_getInstance().overlayLegendOrigin_tmgej$(plotInnerBoundsWithoutLegendBoxes, boxesSize, legendPosition, legendJustification);\n }\n var resultBoxWithLocationList = LegendBoxesLayoutUtil_getInstance().moveAll_cpge3q$(legendOrigin, boxWithLocationList);\n return new LegendBoxesLayout$Result(plotInnerBoundsWithoutLegendBoxes, resultBoxWithLocationList);\n };\n function LegendBoxesLayout$Result(plotInnerBoundsWithoutLegendBoxes, locations) {\n this.plotInnerBoundsWithoutLegendBoxes = plotInnerBoundsWithoutLegendBoxes;\n this.boxWithLocationList = ArrayList_init_1(locations);\n }\n LegendBoxesLayout$Result.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Result',\n interfaces: []\n };\n function LegendBoxesLayout$BoxWithLocation(legendBox, location) {\n this.legendBox = legendBox;\n this.location = location;\n }\n LegendBoxesLayout$BoxWithLocation.prototype.size_8be2vx$ = function () {\n return this.legendBox.size_8be2vx$;\n };\n LegendBoxesLayout$BoxWithLocation.prototype.bounds_8be2vx$ = function () {\n return new DoubleRectangle(this.location, this.legendBox.size_8be2vx$);\n };\n LegendBoxesLayout$BoxWithLocation.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'BoxWithLocation',\n interfaces: []\n };\n LegendBoxesLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LegendBoxesLayout',\n interfaces: []\n };\n function LegendBoxesLayoutUtil() {\n LegendBoxesLayoutUtil_instance = this;\n }\n LegendBoxesLayoutUtil.prototype.verticalStack_8sg693$ = function (boxInfos) {\n var tmp$;\n var result = ArrayList_init();\n var y = 0.0;\n tmp$ = boxInfos.iterator();\n while (tmp$.hasNext()) {\n var info = tmp$.next();\n result.add_11rb$(new LegendBoxesLayout$BoxWithLocation(info, new DoubleVector(0.0, y)));\n y += info.size_8be2vx$.y;\n }\n return result;\n };\n LegendBoxesLayoutUtil.prototype.horizontalStack_8sg693$ = function (boxInfos) {\n var tmp$;\n var result = ArrayList_init();\n var x = 0.0;\n tmp$ = boxInfos.iterator();\n while (tmp$.hasNext()) {\n var info = tmp$.next();\n result.add_11rb$(new LegendBoxesLayout$BoxWithLocation(info, new DoubleVector(x, 0.0)));\n x += info.size_8be2vx$.x;\n }\n return result;\n };\n LegendBoxesLayoutUtil.prototype.moveAll_cpge3q$ = function (delta, boxWithLocationList) {\n var tmp$;\n var result = ArrayList_init();\n tmp$ = boxWithLocationList.iterator();\n while (tmp$.hasNext()) {\n var boxWithLocation = tmp$.next();\n result.add_11rb$(new LegendBoxesLayout$BoxWithLocation(boxWithLocation.legendBox, boxWithLocation.location.add_gpjtzr$(delta)));\n }\n return result;\n };\n LegendBoxesLayoutUtil.prototype.size_9w4uif$ = function (boxWithLocationList) {\n var tmp$, tmp$_0, tmp$_1;\n var bounds = null;\n tmp$ = boxWithLocationList.iterator();\n while (tmp$.hasNext()) {\n var boxWithLocation = tmp$.next();\n bounds = (tmp$_0 = bounds != null ? bounds.union_wthzt5$(boxWithLocation.bounds_8be2vx$()) : null) != null ? tmp$_0 : boxWithLocation.bounds_8be2vx$();\n }\n return (tmp$_1 = bounds != null ? bounds.dimension : null) != null ? tmp$_1 : DoubleVector.Companion.ZERO;\n };\n LegendBoxesLayoutUtil.prototype.overlayLegendOrigin_tmgej$ = function (plotBounds, legendSize, legendPosition, legendJustification) {\n var plotSize = plotBounds.dimension;\n var absolutePosition = new DoubleVector(plotBounds.left + plotSize.x * legendPosition.x, plotBounds.bottom - plotSize.y * legendPosition.y);\n var originOffset = new DoubleVector(-legendSize.x * legendJustification.x, legendSize.y * legendJustification.y - legendSize.y);\n return absolutePosition.add_gpjtzr$(originOffset);\n };\n LegendBoxesLayoutUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'LegendBoxesLayoutUtil',\n interfaces: []\n };\n var LegendBoxesLayoutUtil_instance = null;\n function LegendBoxesLayoutUtil_getInstance() {\n if (LegendBoxesLayoutUtil_instance === null) {\n new LegendBoxesLayoutUtil();\n }return LegendBoxesLayoutUtil_instance;\n }\n function LiveMapTileLayout() {\n }\n LiveMapTileLayout.prototype.doLayout_gpjtzr$ = function (preferredSize) {\n var geomBounds = XYPlotLayoutUtil_getInstance().geomBounds_pym7oz$(0.0, 0.0, preferredSize);\n geomBounds = geomBounds.union_wthzt5$(new DoubleRectangle(geomBounds.origin, XYPlotLayoutUtil_getInstance().GEOM_MIN_SIZE));\n var geomWithAxisBounds = geomBounds;\n return TileLayoutInfo_init(geomWithAxisBounds, geomBounds, XYPlotLayoutUtil_getInstance().clipBounds_wthzt5$(geomBounds), null, null, void 0, void 0, 0);\n };\n LiveMapTileLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LiveMapTileLayout',\n interfaces: [TileLayout]\n };\n function PlotAxisLayout(scale, domainX, domainY, coordProvider, theme, orientation) {\n PlotAxisLayout$Companion_getInstance();\n this.scale_0 = scale;\n this.domainX_0 = domainX;\n this.domainY_0 = domainY;\n this.coordProvider_0 = coordProvider;\n this.theme_0 = theme;\n this.orientation_0 = orientation;\n }\n PlotAxisLayout.prototype.initialThickness = function () {\n var tmp$;\n if (this.theme_0.showTickMarks() || this.theme_0.showTickLabels()) {\n var v = this.theme_0.tickLabelDistance();\n if (this.theme_0.showTickLabels()) {\n tmp$ = v + PlotAxisLayout$Companion_getInstance().initialTickLabelSize_0(this.orientation_0);\n } else {\n tmp$ = v;\n }\n return tmp$;\n }return 0.0;\n };\n PlotAxisLayout.prototype.doLayout_o2m17x$ = function (displaySize, maxTickLabelsBoundsStretched) {\n var layouter = this.createLayouter_0(displaySize);\n return layouter.doLayout_p1d3jc$(PlotAxisLayout$Companion_getInstance().axisLength_0(displaySize, this.orientation_0), maxTickLabelsBoundsStretched);\n };\n PlotAxisLayout.prototype.createLayouter_0 = function (displaySize) {\n var domains = this.coordProvider_0.adjustDomains_jz8wgn$(this.domainX_0, this.domainY_0, displaySize);\n var axisDomain = PlotAxisLayout$Companion_getInstance().axisDomain_0(domains, this.orientation_0);\n var breaksProvider = AxisBreaksUtil_getInstance().createAxisBreaksProvider_oftday$(this.scale_0, axisDomain);\n return AxisLayouter$Companion_getInstance().create_4ebi60$(this.orientation_0, axisDomain, breaksProvider, this.theme_0);\n };\n function PlotAxisLayout$Companion() {\n PlotAxisLayout$Companion_instance = this;\n this.TICK_LABEL_SPEC_0 = PlotLabelSpec$AXIS_TICK_getInstance();\n }\n PlotAxisLayout$Companion.prototype.bottom_eknalg$ = function (scale, xDomain, yDomain, coordProvider, theme) {\n return new PlotAxisLayout(scale, xDomain, yDomain, coordProvider, theme, Orientation$BOTTOM_getInstance());\n };\n PlotAxisLayout$Companion.prototype.left_eknalg$ = function (scale, xDomain, yDomain, coordProvider, theme) {\n return new PlotAxisLayout(scale, xDomain, yDomain, coordProvider, theme, Orientation$LEFT_getInstance());\n };\n PlotAxisLayout$Companion.prototype.initialTickLabelSize_0 = function (orientation) {\n return orientation.isHorizontal ? this.TICK_LABEL_SPEC_0.height() : this.TICK_LABEL_SPEC_0.width_za3lpa$(1);\n };\n PlotAxisLayout$Companion.prototype.axisLength_0 = function (displaySize, orientation) {\n return orientation.isHorizontal ? displaySize.x : displaySize.y;\n };\n PlotAxisLayout$Companion.prototype.axisDomain_0 = function (xyDomains, orientation) {\n return orientation.isHorizontal ? xyDomains.first : xyDomains.second;\n };\n PlotAxisLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PlotAxisLayout$Companion_instance = null;\n function PlotAxisLayout$Companion_getInstance() {\n if (PlotAxisLayout$Companion_instance === null) {\n new PlotAxisLayout$Companion();\n }return PlotAxisLayout$Companion_instance;\n }\n PlotAxisLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotAxisLayout',\n interfaces: [AxisLayout]\n };\n function PlotLayout() {\n }\n PlotLayout.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PlotLayout',\n interfaces: []\n };\n function PlotLayoutBase() {\n this.paddingTop_72hspu$_0 = 0.0;\n this.paddingRight_oc6xpz$_0 = 0.0;\n this.paddingBottom_phgrg6$_0 = 0.0;\n this.paddingLeft_66kgx2$_0 = 0.0;\n }\n Object.defineProperty(PlotLayoutBase.prototype, 'paddingTop_0', {\n configurable: true,\n get: function () {\n return this.paddingTop_72hspu$_0;\n },\n set: function (paddingTop) {\n this.paddingTop_72hspu$_0 = paddingTop;\n }\n });\n Object.defineProperty(PlotLayoutBase.prototype, 'paddingRight_0', {\n configurable: true,\n get: function () {\n return this.paddingRight_oc6xpz$_0;\n },\n set: function (paddingRight) {\n this.paddingRight_oc6xpz$_0 = paddingRight;\n }\n });\n Object.defineProperty(PlotLayoutBase.prototype, 'paddingBottom_0', {\n configurable: true,\n get: function () {\n return this.paddingBottom_phgrg6$_0;\n },\n set: function (paddingBottom) {\n this.paddingBottom_phgrg6$_0 = paddingBottom;\n }\n });\n Object.defineProperty(PlotLayoutBase.prototype, 'paddingLeft_0', {\n configurable: true,\n get: function () {\n return this.paddingLeft_66kgx2$_0;\n },\n set: function (paddingLeft) {\n this.paddingLeft_66kgx2$_0 = paddingLeft;\n }\n });\n PlotLayoutBase.prototype.setPadding_6y0v78$ = function (top, right, bottom, left) {\n this.paddingTop_0 = top;\n this.paddingRight_0 = right;\n this.paddingBottom_0 = bottom;\n this.paddingLeft_0 = left;\n };\n PlotLayoutBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotLayoutBase',\n interfaces: [PlotLayout]\n };\n function PlotLayoutInfo(tiles, size) {\n this.size = size;\n this.tiles = ArrayList_init_1(tiles);\n }\n PlotLayoutInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotLayoutInfo',\n interfaces: []\n };\n function PlotLayoutUtil() {\n PlotLayoutUtil_instance = this;\n this.AXIS_TITLE_OUTER_MARGIN = 4.0;\n this.AXIS_TITLE_INNER_MARGIN = 4.0;\n this.TITLE_V_MARGIN_0 = 4.0;\n this.LIVE_MAP_PLOT_PADDING_0 = new DoubleVector(10.0, 0.0);\n this.LIVE_MAP_PLOT_MARGIN_0 = new DoubleVector(10.0, 10.0);\n }\n PlotLayoutUtil.prototype.titleDimensions_61zpoe$ = function (text) {\n if (base.Strings.isNullOrEmpty_pdl1vj$(text)) {\n return DoubleVector.Companion.ZERO;\n }var labelSpec = PlotLabelSpec$PLOT_TITLE_getInstance();\n return new DoubleVector(labelSpec.width_za3lpa$(text.length), labelSpec.height() + 2 * this.TITLE_V_MARGIN_0);\n };\n PlotLayoutUtil.prototype.axisTitleDimensions_61zpoe$ = function (text) {\n if (base.Strings.isNullOrEmpty_pdl1vj$(text)) {\n return DoubleVector.Companion.ZERO;\n }var labelSpec = PlotLabelSpec$AXIS_TITLE_getInstance();\n return new DoubleVector(labelSpec.width_za3lpa$(text.length), labelSpec.height());\n };\n PlotLayoutUtil.prototype.absoluteGeomBounds_vjhcds$ = function (origin, plotLayoutInfo) {\n var tmp$, tmp$_0;\n if (!!plotLayoutInfo.tiles.isEmpty()) {\n var message = 'Plot is empty';\n throw IllegalArgumentException_init(message.toString());\n }var result = null;\n tmp$ = plotLayoutInfo.tiles.iterator();\n while (tmp$.hasNext()) {\n var tile = tmp$.next();\n var geomBounds = tile.getAbsoluteGeomBounds_gpjtzr$(origin);\n result = (tmp$_0 = result != null ? result.union_wthzt5$(geomBounds) : null) != null ? tmp$_0 : geomBounds;\n }\n return ensureNotNull(result);\n };\n PlotLayoutUtil.prototype.liveMapBounds_wthzt5$ = function (container) {\n return new DoubleRectangle(container.origin.add_gpjtzr$(this.LIVE_MAP_PLOT_PADDING_0), container.dimension.subtract_gpjtzr$(this.LIVE_MAP_PLOT_MARGIN_0));\n };\n PlotLayoutUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PlotLayoutUtil',\n interfaces: []\n };\n var PlotLayoutUtil_instance = null;\n function PlotLayoutUtil_getInstance() {\n if (PlotLayoutUtil_instance === null) {\n new PlotLayoutUtil();\n }return PlotLayoutUtil_instance;\n }\n function SingleTilePlotLayout(myTileLayout) {\n PlotLayoutBase.call(this);\n this.myTileLayout_0 = myTileLayout;\n this.setPadding_6y0v78$(10.0, 10.0, 0.0, 0.0);\n }\n SingleTilePlotLayout.prototype.doLayout_gpjtzr$ = function (preferredSize) {\n var tilePreferredSize = new DoubleVector(preferredSize.x - (this.paddingLeft_0 + this.paddingRight_0), preferredSize.y - (this.paddingTop_0 + this.paddingBottom_0));\n var tileInfo = this.myTileLayout_0.doLayout_gpjtzr$(tilePreferredSize);\n tileInfo = tileInfo.withOffset_gpjtzr$(new DoubleVector(this.paddingLeft_0, this.paddingTop_0));\n var plotSize = tileInfo.bounds.dimension;\n plotSize = plotSize.add_gpjtzr$(new DoubleVector(this.paddingRight_0, this.paddingBottom_0));\n return new PlotLayoutInfo(listOf(tileInfo), plotSize);\n };\n SingleTilePlotLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SingleTilePlotLayout',\n interfaces: [PlotLayoutBase]\n };\n function TileLayout() {\n }\n TileLayout.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'TileLayout',\n interfaces: []\n };\n function TileLayoutInfo(plotOrigin, bounds, geomBounds, clipBounds, xAxisInfo, yAxisInfo, xAxisShown, yAxisShown, facetXLabels, facetYLabel, trueIndex) {\n this.plotOrigin = plotOrigin;\n this.bounds = bounds;\n this.geomBounds = geomBounds;\n this.clipBounds = clipBounds;\n this.xAxisInfo = xAxisInfo;\n this.yAxisInfo = yAxisInfo;\n this.facetXLabels = facetXLabels;\n this.facetYLabel = facetYLabel;\n this.trueIndex = trueIndex;\n this.xAxisShown = (this.xAxisInfo != null && xAxisShown);\n this.yAxisShown = (this.yAxisInfo != null && yAxisShown);\n }\n TileLayoutInfo.prototype.withOffset_gpjtzr$ = function (offset) {\n return new TileLayoutInfo(offset, this.bounds, this.geomBounds, this.clipBounds, this.xAxisInfo, this.yAxisInfo, this.xAxisShown, this.yAxisShown, this.facetXLabels, this.facetYLabel, this.trueIndex);\n };\n TileLayoutInfo.prototype.getAbsoluteBounds_gpjtzr$ = function (tilesOrigin) {\n var offset = tilesOrigin.add_gpjtzr$(this.plotOrigin);\n return this.bounds.add_gpjtzr$(offset);\n };\n TileLayoutInfo.prototype.getAbsoluteGeomBounds_gpjtzr$ = function (tilesOrigin) {\n var offset = tilesOrigin.add_gpjtzr$(this.plotOrigin);\n return this.geomBounds.add_gpjtzr$(offset);\n };\n TileLayoutInfo.prototype.withFacetLabels_5hkr16$ = function (xLabels, yLabel) {\n return new TileLayoutInfo(this.plotOrigin, this.bounds, this.geomBounds, this.clipBounds, this.xAxisInfo, this.yAxisInfo, this.xAxisShown, this.yAxisShown, xLabels, yLabel, this.trueIndex);\n };\n TileLayoutInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TileLayoutInfo',\n interfaces: []\n };\n function TileLayoutInfo_init(bounds, geomBounds, clipBounds, xAxisInfo, yAxisInfo, xAxisShown, yAxisShown, trueIndex, $this) {\n if (xAxisShown === void 0)\n xAxisShown = true;\n if (yAxisShown === void 0)\n yAxisShown = true;\n $this = $this || Object.create(TileLayoutInfo.prototype);\n TileLayoutInfo.call($this, DoubleVector.Companion.ZERO, bounds, geomBounds, clipBounds, xAxisInfo, yAxisInfo, xAxisShown, yAxisShown, emptyList(), null, trueIndex);\n return $this;\n }\n function XYPlotLayoutUtil() {\n XYPlotLayoutUtil_instance = this;\n this.GEOM_MARGIN = 0.0;\n this.CLIP_EXTEND_0 = 5.0;\n this.GEOM_MIN_SIZE = new DoubleVector(50.0, 50.0);\n }\n XYPlotLayoutUtil.prototype.geomBounds_pym7oz$ = function (xAxisThickness, yAxisThickness, plotSize) {\n var marginLeftTop = new DoubleVector(yAxisThickness, this.GEOM_MARGIN);\n var marginRightBottom = new DoubleVector(this.GEOM_MARGIN, xAxisThickness);\n var geomSize = plotSize.subtract_gpjtzr$(marginLeftTop).subtract_gpjtzr$(marginRightBottom);\n if (geomSize.x < this.GEOM_MIN_SIZE.x) {\n geomSize = new DoubleVector(this.GEOM_MIN_SIZE.x, geomSize.y);\n }if (geomSize.y < this.GEOM_MIN_SIZE.y) {\n geomSize = new DoubleVector(geomSize.x, this.GEOM_MIN_SIZE.y);\n }return new DoubleRectangle(marginLeftTop, geomSize);\n };\n XYPlotLayoutUtil.prototype.clipBounds_wthzt5$ = function (geomBounds) {\n return new DoubleRectangle(geomBounds.origin.subtract_gpjtzr$(new DoubleVector(this.CLIP_EXTEND_0, this.CLIP_EXTEND_0)), new DoubleVector(geomBounds.dimension.x + 2 * this.CLIP_EXTEND_0, geomBounds.dimension.y + 2 * this.CLIP_EXTEND_0));\n };\n XYPlotLayoutUtil.prototype.maxTickLabelsBounds_m3y558$ = function (axisOrientation, stretch, geomBounds, plotSize) {\n var tmp$;\n var geomPaddung = 10.0;\n var maxGeomBounds = DoubleRectangle_init(geomPaddung, geomPaddung, plotSize.x - 2 * geomPaddung, plotSize.y - 2 * geomPaddung);\n switch (axisOrientation.name) {\n case 'TOP':\n case 'BOTTOM':\n var leftSpace = geomBounds.left - maxGeomBounds.left + stretch;\n var rightSpace = maxGeomBounds.right - geomBounds.right + stretch;\n var height = 1.0E42;\n if (equals(axisOrientation, Orientation$TOP_getInstance()))\n tmp$ = -height;\n else\n tmp$ = 0.0;\n var top = tmp$;\n var left = -leftSpace;\n var width = leftSpace + rightSpace + geomBounds.width;\n return DoubleRectangle_init(left, top, width, height);\n default:throw IllegalArgumentException_init('Orientation not supported: ' + axisOrientation);\n }\n };\n XYPlotLayoutUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'XYPlotLayoutUtil',\n interfaces: []\n };\n var XYPlotLayoutUtil_instance = null;\n function XYPlotLayoutUtil_getInstance() {\n if (XYPlotLayoutUtil_instance === null) {\n new XYPlotLayoutUtil();\n }return XYPlotLayoutUtil_instance;\n }\n function XYPlotTileLayout(xAxisLayout, yAxisLayout) {\n XYPlotTileLayout$Companion_getInstance();\n this.xAxisLayout_0 = xAxisLayout;\n this.yAxisLayout_0 = yAxisLayout;\n }\n XYPlotTileLayout.prototype.doLayout_gpjtzr$ = function (preferredSize) {\n var tmp$ = XYPlotTileLayout$Companion_getInstance().computeAxisInfos_0(this.xAxisLayout_0, this.yAxisLayout_0, preferredSize);\n var xAxisInfo = {v: tmp$.component1()}\n , yAxisInfo = tmp$.component2();\n var geomBounds = {v: XYPlotLayoutUtil_getInstance().geomBounds_pym7oz$(xAxisInfo.v.axisBounds().dimension.y, yAxisInfo.axisBounds().dimension.x, preferredSize)};\n var maxTickLabelsBounds = XYPlotLayoutUtil_getInstance().maxTickLabelsBounds_m3y558$(Orientation$BOTTOM_getInstance(), 0.0, geomBounds.v, preferredSize);\n var tickLabelsBounds = xAxisInfo.v.tickLabelsBounds;\n var leftOverflow = maxTickLabelsBounds.left - ensureNotNull(tickLabelsBounds).origin.x;\n var rightOverflow = tickLabelsBounds.origin.x + tickLabelsBounds.dimension.x - maxTickLabelsBounds.right;\n if (leftOverflow > 0) {\n geomBounds.v = DoubleRectangle_init(geomBounds.v.origin.x + leftOverflow, geomBounds.v.origin.y, geomBounds.v.dimension.x - leftOverflow, geomBounds.v.dimension.y);\n }if (rightOverflow > 0) {\n geomBounds.v = DoubleRectangle_init(geomBounds.v.origin.x, geomBounds.v.origin.y, geomBounds.v.dimension.x - rightOverflow, geomBounds.v.dimension.y);\n }geomBounds.v = geomBounds.v.union_wthzt5$(new DoubleRectangle(geomBounds.v.origin, XYPlotLayoutUtil_getInstance().GEOM_MIN_SIZE));\n var geomWithAxisBounds = XYPlotTileLayout$Companion_getInstance().tileBounds_0(xAxisInfo.v.axisBounds(), yAxisInfo.axisBounds(), geomBounds.v);\n xAxisInfo.v = xAxisInfo.v.withAxisLength_14dthe$(geomBounds.v.width).build();\n yAxisInfo = yAxisInfo.withAxisLength_14dthe$(geomBounds.v.height).build();\n return TileLayoutInfo_init(geomWithAxisBounds, geomBounds.v, XYPlotLayoutUtil_getInstance().clipBounds_wthzt5$(geomBounds.v), xAxisInfo.v, yAxisInfo, void 0, void 0, 0);\n };\n function XYPlotTileLayout$Companion() {\n XYPlotTileLayout$Companion_instance = this;\n this.AXIS_STRETCH_RATIO_0 = 0.1;\n }\n XYPlotTileLayout$Companion.prototype.tileBounds_0 = function (xAxisBounds, yAxisBounds, geomBounds) {\n var leftTop = new DoubleVector(geomBounds.left - yAxisBounds.width, geomBounds.top - XYPlotLayoutUtil_getInstance().GEOM_MARGIN);\n var rightBottom = new DoubleVector(geomBounds.right + XYPlotLayoutUtil_getInstance().GEOM_MARGIN, geomBounds.bottom + xAxisBounds.height);\n return new DoubleRectangle(leftTop, rightBottom.subtract_gpjtzr$(leftTop));\n };\n XYPlotTileLayout$Companion.prototype.computeAxisInfos_0 = function (xAxisLayout, yAxisLayout, plotSize) {\n var xAxisThickness = xAxisLayout.initialThickness();\n var yAxisInfo = this.computeYAxisInfo_0(yAxisLayout, XYPlotLayoutUtil_getInstance().geomBounds_pym7oz$(xAxisThickness, yAxisLayout.initialThickness(), plotSize));\n var yAxisThickness = yAxisInfo.axisBounds().dimension.x;\n var xAxisInfo = this.computeXAxisInfo_0(xAxisLayout, plotSize, XYPlotLayoutUtil_getInstance().geomBounds_pym7oz$(xAxisThickness, yAxisThickness, plotSize));\n if (xAxisInfo.axisBounds().dimension.y > xAxisThickness) {\n yAxisInfo = this.computeYAxisInfo_0(yAxisLayout, XYPlotLayoutUtil_getInstance().geomBounds_pym7oz$(xAxisInfo.axisBounds().dimension.y, yAxisThickness, plotSize));\n }return new Pair_0(xAxisInfo, yAxisInfo);\n };\n XYPlotTileLayout$Companion.prototype.computeXAxisInfo_0 = function (axisLayout, plotSize, geomBounds) {\n var axisLength = geomBounds.dimension.x;\n var stretch = axisLength * this.AXIS_STRETCH_RATIO_0;\n var maxTickLabelsBounds = XYPlotLayoutUtil_getInstance().maxTickLabelsBounds_m3y558$(Orientation$BOTTOM_getInstance(), stretch, geomBounds, plotSize);\n return axisLayout.doLayout_o2m17x$(geomBounds.dimension, maxTickLabelsBounds);\n };\n XYPlotTileLayout$Companion.prototype.computeYAxisInfo_0 = function (axisLayout, geomBounds) {\n return axisLayout.doLayout_o2m17x$(geomBounds.dimension, null);\n };\n XYPlotTileLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var XYPlotTileLayout$Companion_instance = null;\n function XYPlotTileLayout$Companion_getInstance() {\n if (XYPlotTileLayout$Companion_instance === null) {\n new XYPlotTileLayout$Companion();\n }return XYPlotTileLayout$Companion_instance;\n }\n XYPlotTileLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'XYPlotTileLayout',\n interfaces: [TileLayout]\n };\n function AdaptableAxisBreaksProvider(domainAfterTransform, breaksGenerator) {\n this.domainAfterTransform_0 = domainAfterTransform;\n this.breaksGenerator_0 = breaksGenerator;\n }\n Object.defineProperty(AdaptableAxisBreaksProvider.prototype, 'isFixedBreaks', {\n configurable: true,\n get: function () {\n return false;\n }\n });\n Object.defineProperty(AdaptableAxisBreaksProvider.prototype, 'fixedBreaks', {\n configurable: true,\n get: function () {\n throw IllegalStateException_init('Not a fixed breaks provider');\n }\n });\n AdaptableAxisBreaksProvider.prototype.getBreaks_5wr77w$ = function (targetCount, axisLength) {\n var scaleBreaks = this.breaksGenerator_0.generateBreaks_1tlvto$(this.domainAfterTransform_0, targetCount);\n return scaleBreaks;\n };\n AdaptableAxisBreaksProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AdaptableAxisBreaksProvider',\n interfaces: [AxisBreaksProvider]\n };\n function AxisBreaksProvider() {\n }\n AxisBreaksProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'AxisBreaksProvider',\n interfaces: []\n };\n function AxisBreaksUtil() {\n AxisBreaksUtil_instance = this;\n }\n AxisBreaksUtil.prototype.createAxisBreaksProvider_oftday$ = function (scale, axisDomain) {\n if (scale.hasBreaks())\n return new FixedAxisBreaksProvider(scale.getScaleBreaks());\n else {\n return new AdaptableAxisBreaksProvider(axisDomain, scale.getBreaksGenerator());\n }\n };\n AxisBreaksUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'AxisBreaksUtil',\n interfaces: []\n };\n var AxisBreaksUtil_instance = null;\n function AxisBreaksUtil_getInstance() {\n if (AxisBreaksUtil_instance === null) {\n new AxisBreaksUtil();\n }return AxisBreaksUtil_instance;\n }\n function AxisLayouter(orientation, domainRange, labelsLayout) {\n AxisLayouter$Companion_getInstance();\n this.orientation = orientation;\n this.domainRange_jxchw$_0 = domainRange;\n this.labelsLayout_ft0nu6$_0 = labelsLayout;\n }\n AxisLayouter.prototype.doLayout_p1d3jc$ = function (axisLength, maxTickLabelsBounds) {\n var labelsInfo = this.labelsLayout_ft0nu6$_0.doLayout_s0wrr0$(axisLength, this.toAxisMapper_14dthe$(axisLength), maxTickLabelsBounds);\n var labelsBounds = labelsInfo.bounds;\n var builder = (new AxisLayoutInfo$Builder()).axisBreaks_hbp697$(labelsInfo.breaks).axisLength_14dthe$(axisLength).orientation_9y97dg$(this.orientation).axisDomain_4fzjta$(this.domainRange_jxchw$_0).tickLabelsBoundsMax_myx2hi$(maxTickLabelsBounds).tickLabelSmallFont_6taknv$(labelsInfo.smallFont).tickLabelAdditionalOffsets_eajcfd$(labelsInfo.labelAdditionalOffsets).tickLabelHorizontalAnchor_tk0ev1$(labelsInfo.labelHorizontalAnchor).tickLabelVerticalAnchor_24j3ht$(labelsInfo.labelVerticalAnchor).tickLabelRotationAngle_14dthe$(labelsInfo.labelRotationAngle).tickLabelsBounds_myx2hi$(labelsBounds);\n return builder.build();\n };\n AxisLayouter.prototype.toScaleMapper_14dthe$ = function (axisLength) {\n return scale.Mappers.mul_mdyssk$(this.domainRange_jxchw$_0, axisLength);\n };\n function AxisLayouter$Companion() {\n AxisLayouter$Companion_instance = this;\n }\n AxisLayouter$Companion.prototype.create_4ebi60$ = function (orientation, axisDomain, breaksProvider, theme) {\n var tmp$, tmp$_0;\n if (orientation.isHorizontal) {\n if (breaksProvider.isFixedBreaks) {\n tmp$ = AxisLabelsLayout$Companion_getInstance().horizontalFixedBreaks_3unth9$(orientation, axisDomain, breaksProvider.fixedBreaks, theme);\n } else {\n tmp$ = AxisLabelsLayout$Companion_getInstance().horizontalFlexBreaks_4ebi60$(orientation, axisDomain, breaksProvider, theme);\n }\n var labelsLayout = tmp$;\n return new HorizontalAxisLayouter(orientation, axisDomain, labelsLayout);\n }if (breaksProvider.isFixedBreaks) {\n tmp$_0 = AxisLabelsLayout$Companion_getInstance().verticalFixedBreaks_3unth9$(orientation, axisDomain, breaksProvider.fixedBreaks, theme);\n } else {\n tmp$_0 = AxisLabelsLayout$Companion_getInstance().verticalFlexBreaks_4ebi60$(orientation, axisDomain, breaksProvider, theme);\n }\n var labelsLayout_0 = tmp$_0;\n return new VerticalAxisLayouter(orientation, axisDomain, labelsLayout_0);\n };\n AxisLayouter$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AxisLayouter$Companion_instance = null;\n function AxisLayouter$Companion_getInstance() {\n if (AxisLayouter$Companion_instance === null) {\n new AxisLayouter$Companion();\n }return AxisLayouter$Companion_instance;\n }\n AxisLayouter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AxisLayouter',\n interfaces: []\n };\n function FixedAxisBreaksProvider(fixedBreaks) {\n this.fixedBreaks_cixykn$_0 = fixedBreaks;\n }\n Object.defineProperty(FixedAxisBreaksProvider.prototype, 'fixedBreaks', {\n get: function () {\n return this.fixedBreaks_cixykn$_0;\n }\n });\n Object.defineProperty(FixedAxisBreaksProvider.prototype, 'isFixedBreaks', {\n configurable: true,\n get: function () {\n return true;\n }\n });\n FixedAxisBreaksProvider.prototype.getBreaks_5wr77w$ = function (targetCount, axisLength) {\n return this.fixedBreaks;\n };\n FixedAxisBreaksProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'FixedAxisBreaksProvider',\n interfaces: [AxisBreaksProvider]\n };\n function HorizontalAxisLayouter(orientation, domainRange, labelsLayout) {\n AxisLayouter.call(this, orientation, domainRange, labelsLayout);\n }\n function HorizontalAxisLayouter$toAxisMapper$lambda(closure$scaleMapper, closure$cartesianX) {\n return function (v) {\n var mapped = closure$scaleMapper(v);\n return mapped != null ? closure$cartesianX(mapped) : null;\n };\n }\n HorizontalAxisLayouter.prototype.toAxisMapper_14dthe$ = function (axisLength) {\n var scaleMapper = this.toScaleMapper_14dthe$(axisLength);\n var cartesianX = coord.Coords.toClientOffsetX_4fzjta$(new ClosedRange(0.0, axisLength));\n return HorizontalAxisLayouter$toAxisMapper$lambda(scaleMapper, cartesianX);\n };\n HorizontalAxisLayouter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalAxisLayouter',\n interfaces: [AxisLayouter]\n };\n function VerticalAxisLayouter(orientation, domainRange, labelsLayout) {\n AxisLayouter.call(this, orientation, domainRange, labelsLayout);\n }\n function VerticalAxisLayouter$toAxisMapper$lambda(closure$scaleMapper, closure$cartesianY) {\n return function (v) {\n var mapped = closure$scaleMapper(v);\n return mapped != null ? closure$cartesianY(mapped) : null;\n };\n }\n VerticalAxisLayouter.prototype.toAxisMapper_14dthe$ = function (axisLength) {\n var scaleMapper = this.toScaleMapper_14dthe$(axisLength);\n var cartesianY = coord.Coords.toClientOffsetY_4fzjta$(new ClosedRange(0.0, axisLength));\n return VerticalAxisLayouter$toAxisMapper$lambda(scaleMapper, cartesianY);\n };\n VerticalAxisLayouter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalAxisLayouter',\n interfaces: [AxisLayouter]\n };\n function AbstractFixedBreaksLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme) {\n AbstractFixedBreaksLabelsLayout$Companion_getInstance();\n AxisLabelsLayout.call(this, orientation, axisDomain, labelSpec, theme);\n this.breaks_0 = breaks;\n }\n AbstractFixedBreaksLabelsLayout.prototype.labelBounds_0 = function (labelLocation, labelLength) {\n var dim = this.labelSpec.dimensions_za3lpa$(labelLength);\n var labelBounds = this.labelBounds_gpjtzr$(dim);\n return labelBounds.add_gpjtzr$(labelLocation);\n };\n AbstractFixedBreaksLabelsLayout.prototype.labelsBounds_c3fefx$ = function (tickPositions, tickLabels, toTickLocation) {\n var tmp$;\n var boundsList = this.labelBoundsList_c3fefx$(tickPositions, this.breaks_0.labels, toTickLocation);\n var bounds = null;\n tmp$ = boundsList.iterator();\n while (tmp$.hasNext()) {\n var labelBounds = tmp$.next();\n bounds = GeometryUtil_getInstance().union_te9coj$(labelBounds, bounds);\n }\n return bounds;\n };\n AbstractFixedBreaksLabelsLayout.prototype.labelBoundsList_c3fefx$ = function (tickPositions, tickLabels, toTickLocation) {\n var tmp$;\n var result = ArrayList_init();\n var labels = tickLabels.iterator();\n tmp$ = tickPositions.iterator();\n while (tmp$.hasNext()) {\n var pos = tmp$.next();\n var label = labels.next();\n var bounds = this.labelBounds_0(toTickLocation(pos), label.length);\n result.add_11rb$(bounds);\n }\n return result;\n };\n AbstractFixedBreaksLabelsLayout.prototype.createAxisLabelsLayoutInfoBuilder_fd842m$ = function (bounds, overlap) {\n return (new AxisLabelsLayoutInfo$Builder()).breaks_d6t06k$(this.breaks_0).bounds_wthzt5$(this.applyLabelsOffset_w7e9pi$(bounds)).smallFont_6taknv$(false).overlap_6taknv$(overlap);\n };\n AbstractFixedBreaksLabelsLayout.prototype.noLabelsLayoutInfo_c0p8fa$ = function (axisLength, orientation) {\n if (orientation.isHorizontal) {\n var bounds = DoubleRectangle_init(axisLength / 2, 0.0, 0.0, 0.0);\n bounds = this.applyLabelsOffset_w7e9pi$(bounds);\n return (new AxisLabelsLayoutInfo$Builder()).breaks_d6t06k$(this.breaks_0).bounds_wthzt5$(bounds).smallFont_6taknv$(false).overlap_6taknv$(false).labelAdditionalOffsets_eajcfd$(null).labelHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE).labelVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.TOP).build();\n }throw IllegalStateException_init('Not implemented for ' + orientation);\n };\n function AbstractFixedBreaksLabelsLayout$Companion() {\n AbstractFixedBreaksLabelsLayout$Companion_instance = this;\n this.HORIZONTAL_TICK_LOCATION = AbstractFixedBreaksLabelsLayout$Companion$HORIZONTAL_TICK_LOCATION$lambda;\n }\n function AbstractFixedBreaksLabelsLayout$Companion$HORIZONTAL_TICK_LOCATION$lambda(x) {\n return new DoubleVector(x, 0.0);\n }\n AbstractFixedBreaksLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AbstractFixedBreaksLabelsLayout$Companion_instance = null;\n function AbstractFixedBreaksLabelsLayout$Companion_getInstance() {\n if (AbstractFixedBreaksLabelsLayout$Companion_instance === null) {\n new AbstractFixedBreaksLabelsLayout$Companion();\n }return AbstractFixedBreaksLabelsLayout$Companion_instance;\n }\n AbstractFixedBreaksLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AbstractFixedBreaksLabelsLayout',\n interfaces: [AxisLabelsLayout]\n };\n function AxisLabelsLayout(orientation, axisDomain, labelSpec, theme) {\n AxisLabelsLayout$Companion_getInstance();\n this.orientation = orientation;\n this.axisDomain = axisDomain;\n this.labelSpec = labelSpec;\n this.theme = theme;\n }\n Object.defineProperty(AxisLabelsLayout.prototype, 'isHorizontal', {\n configurable: true,\n get: function () {\n return this.orientation.isHorizontal;\n }\n });\n AxisLabelsLayout.prototype.mapToAxis_d2cc22$ = function (breaks, axisMapper) {\n return BreakLabelsLayoutUtil_getInstance().mapToAxis_lhkzxb$(breaks, this.axisDomain, axisMapper);\n };\n AxisLabelsLayout.prototype.applyLabelsOffset_w7e9pi$ = function (labelsBounds) {\n return BreakLabelsLayoutUtil_getInstance().applyLabelsOffset_tsgpmr$(labelsBounds, this.theme.tickLabelDistance(), this.orientation);\n };\n function AxisLabelsLayout$Companion() {\n AxisLabelsLayout$Companion_instance = this;\n this.TICK_LABEL_SPEC = PlotLabelSpec$AXIS_TICK_getInstance();\n this.INITIAL_TICK_LABEL_LENGTH = 4;\n this.MIN_TICK_LABEL_DISTANCE = 20.0;\n this.TICK_LABEL_SPEC_SMALL = PlotLabelSpec$AXIS_TICK_SMALL_getInstance();\n }\n AxisLabelsLayout$Companion.prototype.horizontalFlexBreaks_4ebi60$ = function (orientation, axisDomain, breaksProvider, theme) {\n if (!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }if (!!breaksProvider.isFixedBreaks) {\n var message_0 = 'fixed breaks';\n throw IllegalArgumentException_init(message_0.toString());\n }return new HorizontalFlexBreaksLabelsLayout(orientation, axisDomain, this.TICK_LABEL_SPEC, breaksProvider, theme);\n };\n AxisLabelsLayout$Companion.prototype.horizontalFixedBreaks_3unth9$ = function (orientation, axisDomain, breaks, theme) {\n if (!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }return new HorizontalFixedBreaksLabelsLayout(orientation, axisDomain, this.TICK_LABEL_SPEC, breaks, theme);\n };\n AxisLabelsLayout$Companion.prototype.verticalFlexBreaks_4ebi60$ = function (orientation, axisDomain, breaksProvider, theme) {\n if (!!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }if (!!breaksProvider.isFixedBreaks) {\n var message_0 = 'fixed breaks';\n throw IllegalArgumentException_init(message_0.toString());\n }return new VerticalFlexBreaksLabelsLayout(orientation, axisDomain, this.TICK_LABEL_SPEC, breaksProvider, theme);\n };\n AxisLabelsLayout$Companion.prototype.verticalFixedBreaks_3unth9$ = function (orientation, axisDomain, breaks, theme) {\n if (!!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }return new VerticalFixedBreaksLabelsLayout(orientation, axisDomain, this.TICK_LABEL_SPEC, breaks, theme);\n };\n AxisLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AxisLabelsLayout$Companion_instance = null;\n function AxisLabelsLayout$Companion_getInstance() {\n if (AxisLabelsLayout$Companion_instance === null) {\n new AxisLabelsLayout$Companion();\n }return AxisLabelsLayout$Companion_instance;\n }\n AxisLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AxisLabelsLayout',\n interfaces: []\n };\n function AxisLabelsLayoutInfo(b) {\n this.breaks = null;\n this.bounds = null;\n this.smallFont = false;\n this.labelAdditionalOffsets = null;\n this.labelHorizontalAnchor = null;\n this.labelVerticalAnchor = null;\n this.labelRotationAngle = 0;\n this.isOverlap_8be2vx$ = false;\n this.breaks = b.myBreaks_8be2vx$;\n this.smallFont = b.mySmallFont_8be2vx$;\n this.bounds = b.myBounds_8be2vx$;\n this.isOverlap_8be2vx$ = b.myOverlap_8be2vx$;\n this.labelAdditionalOffsets = b.myLabelAdditionalOffsets_8be2vx$ == null ? null : ArrayList_init_1(ensureNotNull(b.myLabelAdditionalOffsets_8be2vx$));\n this.labelHorizontalAnchor = b.myLabelHorizontalAnchor_8be2vx$;\n this.labelVerticalAnchor = b.myLabelVerticalAnchor_8be2vx$;\n this.labelRotationAngle = b.myLabelRotationAngle_8be2vx$;\n }\n function AxisLabelsLayoutInfo$Builder() {\n this.myBreaks_8be2vx$ = null;\n this.myBounds_8be2vx$ = null;\n this.mySmallFont_8be2vx$ = false;\n this.myOverlap_8be2vx$ = false;\n this.myLabelAdditionalOffsets_8be2vx$ = null;\n this.myLabelHorizontalAnchor_8be2vx$ = null;\n this.myLabelVerticalAnchor_8be2vx$ = null;\n this.myLabelRotationAngle_8be2vx$ = 0.0;\n }\n AxisLabelsLayoutInfo$Builder.prototype.breaks_d6t06k$ = function (breaks) {\n this.myBreaks_8be2vx$ = breaks;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.bounds_wthzt5$ = function (bounds) {\n this.myBounds_8be2vx$ = bounds;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.smallFont_6taknv$ = function (b) {\n this.mySmallFont_8be2vx$ = b;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.overlap_6taknv$ = function (b) {\n this.myOverlap_8be2vx$ = b;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.labelAdditionalOffsets_eajcfd$ = function (l) {\n this.myLabelAdditionalOffsets_8be2vx$ = l;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.labelHorizontalAnchor_ja80zo$ = function (anchor) {\n this.myLabelHorizontalAnchor_8be2vx$ = anchor;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.labelVerticalAnchor_yaudma$ = function (anchor) {\n this.myLabelVerticalAnchor_8be2vx$ = anchor;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.labelRotationAngle_14dthe$ = function (angle) {\n this.myLabelRotationAngle_8be2vx$ = angle;\n return this;\n };\n AxisLabelsLayoutInfo$Builder.prototype.build = function () {\n return new AxisLabelsLayoutInfo(this);\n };\n AxisLabelsLayoutInfo$Builder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Builder',\n interfaces: []\n };\n AxisLabelsLayoutInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AxisLabelsLayoutInfo',\n interfaces: []\n };\n function BreakLabelsLayoutUtil() {\n BreakLabelsLayoutUtil_instance = this;\n }\n BreakLabelsLayoutUtil.prototype.getFlexBreaks_73ga93$ = function (breaksProvider, maxCount, axisLength) {\n if (!!breaksProvider.isFixedBreaks) {\n var message = 'fixed breaks not expected';\n throw IllegalArgumentException_init(message.toString());\n }if (!(maxCount > 0)) {\n var message_0 = 'maxCount=' + maxCount;\n throw IllegalArgumentException_init(message_0.toString());\n }var breaks = breaksProvider.getBreaks_5wr77w$(maxCount, axisLength);\n if (maxCount === 1 && !breaks.isEmpty) {\n return new ScaleBreaks(breaks.domainValues.subList_vux9f0$(0, 1), breaks.transformedValues.subList_vux9f0$(0, 1), breaks.labels.subList_vux9f0$(0, 1));\n }var count = maxCount;\n while (breaks.size > maxCount) {\n var b = (breaks.size - maxCount | 0) / 2 | 0;\n var delta = JsMath.max(1, b);\n count = count - delta | 0;\n breaks = breaksProvider.getBreaks_5wr77w$(count, axisLength);\n }\n return breaks;\n };\n BreakLabelsLayoutUtil.prototype.maxLength_mhpeer$ = function (labels) {\n var tmp$;\n var max = 0;\n tmp$ = labels.iterator();\n while (tmp$.hasNext()) {\n var label = tmp$.next();\n var a = max;\n var b = label.length;\n max = JsMath.max(a, b);\n }\n return max;\n };\n BreakLabelsLayoutUtil.prototype.horizontalCenteredLabelBounds_gpjtzr$ = function (labelSize) {\n return DoubleRectangle_init(-labelSize.x / 2.0, 0.0, labelSize.x, labelSize.y);\n };\n BreakLabelsLayoutUtil.prototype.doLayoutVerticalAxisLabels_7l1gh9$ = function (orientation, breaks, axisDomain, axisMapper, theme) {\n var tmp$;\n if (theme.showTickLabels()) {\n var labelsBounds = this.verticalAxisLabelsBounds_0(breaks, axisDomain, axisMapper);\n tmp$ = this.applyLabelsOffset_tsgpmr$(labelsBounds, theme.tickLabelDistance(), orientation);\n } else if (theme.showTickMarks()) {\n var labelsBounds_0 = new DoubleRectangle(DoubleVector.Companion.ZERO, DoubleVector.Companion.ZERO);\n tmp$ = this.applyLabelsOffset_tsgpmr$(labelsBounds_0, theme.tickLabelDistance(), orientation);\n } else\n tmp$ = new DoubleRectangle(DoubleVector.Companion.ZERO, DoubleVector.Companion.ZERO);\n var axisBounds = tmp$;\n return (new AxisLabelsLayoutInfo$Builder()).breaks_d6t06k$(breaks).bounds_wthzt5$(axisBounds).build();\n };\n BreakLabelsLayoutUtil.prototype.mapToAxis_lhkzxb$ = function (breaks, axisDomain, axisMapper) {\n var tmp$;\n var axisMin = axisDomain.lowerEnd;\n var axisBreaks = ArrayList_init();\n tmp$ = breaks.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n var mapped = axisMapper(v - axisMin);\n axisBreaks.add_11rb$(ensureNotNull(mapped));\n }\n return axisBreaks;\n };\n BreakLabelsLayoutUtil.prototype.applyLabelsOffset_tsgpmr$ = function (labelsBounds, offset, orientation) {\n var tmp$;\n var labelsBounds_0 = labelsBounds;\n switch (orientation.name) {\n case 'LEFT':\n tmp$ = new DoubleVector(-offset, 0.0);\n break;\n case 'RIGHT':\n tmp$ = new DoubleVector(offset, 0.0);\n break;\n case 'TOP':\n tmp$ = new DoubleVector(0.0, -offset);\n break;\n case 'BOTTOM':\n tmp$ = new DoubleVector(0.0, offset);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n var offsetVector = tmp$;\n if (orientation === Orientation$RIGHT_getInstance() || orientation === Orientation$BOTTOM_getInstance()) {\n labelsBounds_0 = labelsBounds_0.add_gpjtzr$(offsetVector);\n } else if (orientation === Orientation$LEFT_getInstance() || orientation === Orientation$TOP_getInstance()) {\n labelsBounds_0 = labelsBounds_0.add_gpjtzr$(offsetVector).subtract_gpjtzr$(new DoubleVector(labelsBounds_0.width, 0.0));\n }return labelsBounds_0;\n };\n BreakLabelsLayoutUtil.prototype.verticalAxisLabelsBounds_0 = function (breaks, axisDomain, axisMapper) {\n var maxLength = this.maxLength_mhpeer$(breaks.labels);\n var maxLabelWidth = AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC.width_za3lpa$(maxLength);\n var y1 = 0.0;\n var y2 = 0.0;\n if (!breaks.isEmpty) {\n var axisBreaks = this.mapToAxis_lhkzxb$(breaks.transformedValues, axisDomain, axisMapper);\n var a = axisBreaks.get_za3lpa$(0);\n var b = collect.Iterables.getLast_yl67zr$(axisBreaks);\n y1 = JsMath.min(a, b);\n var a_0 = axisBreaks.get_za3lpa$(0);\n var b_0 = collect.Iterables.getLast_yl67zr$(axisBreaks);\n y2 = JsMath.max(a_0, b_0);\n y1 -= AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC.height() / 2;\n y2 += AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC.height() / 2;\n }var origin = new DoubleVector(0.0, y1);\n var dimensions = new DoubleVector(maxLabelWidth, y2 - y1);\n return new DoubleRectangle(origin, dimensions);\n };\n BreakLabelsLayoutUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'BreakLabelsLayoutUtil',\n interfaces: []\n };\n var BreakLabelsLayoutUtil_instance = null;\n function BreakLabelsLayoutUtil_getInstance() {\n if (BreakLabelsLayoutUtil_instance === null) {\n new BreakLabelsLayoutUtil();\n }return BreakLabelsLayoutUtil_instance;\n }\n function HorizontalFixedBreaksLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme) {\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, labelSpec, breaks, theme);\n if (!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }}\n HorizontalFixedBreaksLabelsLayout.prototype.overlap_0 = function (labelsInfo, maxTickLabelsBounds) {\n return labelsInfo.isOverlap_8be2vx$ || (maxTickLabelsBounds != null && !(maxTickLabelsBounds.xRange().encloses_d226ot$(ensureNotNull(labelsInfo.bounds).xRange()) && maxTickLabelsBounds.yRange().encloses_d226ot$(labelsInfo.bounds.yRange())));\n };\n HorizontalFixedBreaksLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n if (!this.theme.showTickLabels()) {\n return this.noLabelsLayoutInfo_c0p8fa$(axisLength, this.orientation);\n }var labelsInfo = this.simpleLayout_0().doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n if (this.overlap_0(labelsInfo, maxLabelsBounds)) {\n labelsInfo = this.multilineLayout_0().doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n if (this.overlap_0(labelsInfo, maxLabelsBounds)) {\n labelsInfo = this.tiltedLayout_0().doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n if (this.overlap_0(labelsInfo, maxLabelsBounds)) {\n labelsInfo = this.verticalLayout_0(this.labelSpec).doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n if (this.overlap_0(labelsInfo, maxLabelsBounds)) {\n labelsInfo = this.verticalLayout_0(AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC_SMALL).doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n }}}}return labelsInfo;\n };\n HorizontalFixedBreaksLabelsLayout.prototype.simpleLayout_0 = function () {\n return new HorizontalSimpleLabelsLayout(this.orientation, this.axisDomain, this.labelSpec, this.breaks_0, this.theme);\n };\n HorizontalFixedBreaksLabelsLayout.prototype.multilineLayout_0 = function () {\n return new HorizontalMultilineLabelsLayout(this.orientation, this.axisDomain, this.labelSpec, this.breaks_0, this.theme, 2);\n };\n HorizontalFixedBreaksLabelsLayout.prototype.tiltedLayout_0 = function () {\n return new HorizontalTiltedLabelsLayout(this.orientation, this.axisDomain, this.labelSpec, this.breaks_0, this.theme);\n };\n HorizontalFixedBreaksLabelsLayout.prototype.verticalLayout_0 = function (labelSpec) {\n return new HorizontalVerticalLabelsLayout(this.orientation, this.axisDomain, labelSpec, this.breaks_0, this.theme);\n };\n HorizontalFixedBreaksLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n throw IllegalStateException_init('Not implemented here');\n };\n HorizontalFixedBreaksLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalFixedBreaksLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function HorizontalFlexBreaksLabelsLayout(orientation, axisDomain, labelSpec, myBreaksProvider, theme) {\n AxisLabelsLayout.call(this, orientation, axisDomain, labelSpec, theme);\n this.myBreaksProvider_0 = myBreaksProvider;\n if (!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }if (!!this.myBreaksProvider_0.isFixedBreaks) {\n var message_0 = 'fixed breaks';\n throw IllegalArgumentException_init(message_0.toString());\n }}\n HorizontalFlexBreaksLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n var targetBreakCount = HorizontalSimpleLabelsLayout$Companion_getInstance().estimateBreakCountInitial_14dthe$(axisLength);\n var breaks = this.getBreaks_0(targetBreakCount, axisLength);\n var labelsInfo = this.doLayoutLabels_0(breaks, axisLength, axisMapper, maxLabelsBounds);\n while (labelsInfo.isOverlap_8be2vx$) {\n var newTargetBreakCount = HorizontalSimpleLabelsLayout$Companion_getInstance().estimateBreakCount_g5yaez$(breaks.labels, axisLength);\n if (newTargetBreakCount >= targetBreakCount) {\n break;\n }targetBreakCount = newTargetBreakCount;\n breaks = this.getBreaks_0(targetBreakCount, axisLength);\n labelsInfo = this.doLayoutLabels_0(breaks, axisLength, axisMapper, maxLabelsBounds);\n }\n return labelsInfo;\n };\n HorizontalFlexBreaksLabelsLayout.prototype.doLayoutLabels_0 = function (breaks, axisLength, axisMapper, maxLabelsBounds) {\n var layout = new HorizontalSimpleLabelsLayout(this.orientation, this.axisDomain, this.labelSpec, breaks, this.theme);\n return layout.doLayout_s0wrr0$(axisLength, axisMapper, maxLabelsBounds);\n };\n HorizontalFlexBreaksLabelsLayout.prototype.getBreaks_0 = function (maxCount, axisLength) {\n return BreakLabelsLayoutUtil_getInstance().getFlexBreaks_73ga93$(this.myBreaksProvider_0, maxCount, axisLength);\n };\n HorizontalFlexBreaksLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalFlexBreaksLabelsLayout',\n interfaces: [AxisLabelsLayout]\n };\n function HorizontalMultilineLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme, myMaxLines) {\n HorizontalMultilineLabelsLayout$Companion_getInstance();\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, labelSpec, breaks, theme);\n this.myMaxLines_0 = myMaxLines;\n this.myShelfIndexForTickIndex_0 = ArrayList_init();\n }\n Object.defineProperty(HorizontalMultilineLabelsLayout.prototype, 'labelAdditionalOffsets_0', {\n configurable: true,\n get: function () {\n var tmp$;\n var h = this.labelSpec.height() * HorizontalMultilineLabelsLayout$Companion_getInstance().LINE_HEIGHT_0;\n var result = ArrayList_init();\n tmp$ = this.breaks_0.size;\n for (var i = 0; i < tmp$; i++) {\n result.add_11rb$(new DoubleVector(0.0, this.myShelfIndexForTickIndex_0.get_za3lpa$(i) * h));\n }\n return result;\n }\n });\n HorizontalMultilineLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n var tmp$, tmp$_0;\n var boundsByShelfIndex = HashMap_init();\n var ticks = this.mapToAxis_d2cc22$(this.breaks_0.transformedValues, axisMapper);\n var boundsList = this.labelBoundsList_c3fefx$(ticks, this.breaks_0.labels, AbstractFixedBreaksLabelsLayout$Companion_getInstance().HORIZONTAL_TICK_LOCATION);\n tmp$ = boundsList.iterator();\n while (tmp$.hasNext()) {\n var labelBounds = tmp$.next();\n var shelfIndex = 0;\n while (true) {\n if (!boundsByShelfIndex.containsKey_11rb$(shelfIndex)) {\n var key = shelfIndex;\n boundsByShelfIndex.put_xwzc9p$(key, labelBounds);\n this.myShelfIndexForTickIndex_0.add_11rb$(shelfIndex);\n break;\n }var shelfBounds = ensureNotNull(boundsByShelfIndex.get_11rb$(shelfIndex));\n if (!shelfBounds.xRange().isConnected_d226ot$(new ClosedRange(labelBounds.left - 60, labelBounds.right + 60))) {\n this.myShelfIndexForTickIndex_0.add_11rb$(shelfIndex);\n shelfBounds = shelfBounds.union_wthzt5$(labelBounds);\n var key_0 = shelfIndex;\n var value = shelfBounds;\n boundsByShelfIndex.put_xwzc9p$(key_0, value);\n break;\n }shelfIndex = shelfIndex + 1 | 0;\n }\n }\n var bounds = boundsByShelfIndex.isEmpty() ? new DoubleRectangle(DoubleVector.Companion.ZERO, DoubleVector.Companion.ZERO) : ensureNotNull(boundsByShelfIndex.get_11rb$(0));\n var h = this.labelSpec.height() * HorizontalMultilineLabelsLayout$Companion_getInstance().LINE_HEIGHT_0;\n tmp$_0 = boundsByShelfIndex.size;\n for (var i = 0; i < tmp$_0; i++) {\n var shelfBounds_0 = ensureNotNull(boundsByShelfIndex.get_11rb$(i));\n bounds = bounds.union_wthzt5$(shelfBounds_0.add_gpjtzr$(new DoubleVector(0.0, i * h)));\n }\n var linesCount = boundsByShelfIndex.size;\n return (new AxisLabelsLayoutInfo$Builder()).breaks_d6t06k$(this.breaks_0).bounds_wthzt5$(this.applyLabelsOffset_w7e9pi$(bounds)).smallFont_6taknv$(false).overlap_6taknv$(linesCount > this.myMaxLines_0).labelAdditionalOffsets_eajcfd$(this.labelAdditionalOffsets_0).labelHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE).labelVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.TOP).build();\n };\n HorizontalMultilineLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n return BreakLabelsLayoutUtil_getInstance().horizontalCenteredLabelBounds_gpjtzr$(labelNormalSize);\n };\n function HorizontalMultilineLabelsLayout$Companion() {\n HorizontalMultilineLabelsLayout$Companion_instance = this;\n this.LINE_HEIGHT_0 = 1.2;\n this.MIN_DISTANCE_0 = 60;\n }\n HorizontalMultilineLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HorizontalMultilineLabelsLayout$Companion_instance = null;\n function HorizontalMultilineLabelsLayout$Companion_getInstance() {\n if (HorizontalMultilineLabelsLayout$Companion_instance === null) {\n new HorizontalMultilineLabelsLayout$Companion();\n }return HorizontalMultilineLabelsLayout$Companion_instance;\n }\n HorizontalMultilineLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalMultilineLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function HorizontalSimpleLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme) {\n HorizontalSimpleLabelsLayout$Companion_getInstance();\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, labelSpec, breaks, theme);\n }\n HorizontalSimpleLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n var tmp$;\n if (this.breaks_0.isEmpty) {\n return this.noLabelsLayoutInfo_c0p8fa$(axisLength, this.orientation);\n }if (!this.theme.showTickLabels()) {\n return this.noLabelsLayoutInfo_c0p8fa$(axisLength, this.orientation);\n }var bounds = null;\n var overlap = false;\n var ticks = this.mapToAxis_d2cc22$(this.breaks_0.transformedValues, axisMapper);\n var boundsList = this.labelBoundsList_c3fefx$(ticks, this.breaks_0.labels, AbstractFixedBreaksLabelsLayout$Companion_getInstance().HORIZONTAL_TICK_LOCATION);\n tmp$ = boundsList.iterator();\n while (tmp$.hasNext()) {\n var labelBounds = tmp$.next();\n overlap = overlap || (bounds != null && bounds.xRange().isConnected_d226ot$(data_0.SeriesUtil.expand_wws5xy$(labelBounds.xRange(), AxisLabelsLayout$Companion_getInstance().MIN_TICK_LABEL_DISTANCE / 2, AxisLabelsLayout$Companion_getInstance().MIN_TICK_LABEL_DISTANCE / 2.0)));\n bounds = GeometryUtil_getInstance().union_te9coj$(labelBounds, bounds);\n }\n return (new AxisLabelsLayoutInfo$Builder()).breaks_d6t06k$(this.breaks_0).bounds_wthzt5$(this.applyLabelsOffset_w7e9pi$(ensureNotNull(bounds))).smallFont_6taknv$(false).overlap_6taknv$(overlap).labelAdditionalOffsets_eajcfd$(null).labelHorizontalAnchor_ja80zo$(TextLabel$HorizontalAnchor.MIDDLE).labelVerticalAnchor_yaudma$(TextLabel$VerticalAnchor.TOP).build();\n };\n HorizontalSimpleLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n return BreakLabelsLayoutUtil_getInstance().horizontalCenteredLabelBounds_gpjtzr$(labelNormalSize);\n };\n function HorizontalSimpleLabelsLayout$Companion() {\n HorizontalSimpleLabelsLayout$Companion_instance = this;\n }\n HorizontalSimpleLabelsLayout$Companion.prototype.estimateBreakCountInitial_14dthe$ = function (axisLength) {\n return this.estimateBreakCount_0(4, axisLength);\n };\n HorizontalSimpleLabelsLayout$Companion.prototype.estimateBreakCount_g5yaez$ = function (labels, axisLength) {\n var maxLength = BreakLabelsLayoutUtil_getInstance().maxLength_mhpeer$(labels);\n return this.estimateBreakCount_0(maxLength, axisLength);\n };\n HorizontalSimpleLabelsLayout$Companion.prototype.estimateBreakCount_0 = function (labelLength, axisLength) {\n var tickDistance = AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC.width_za3lpa$(labelLength) + AxisLabelsLayout$Companion_getInstance().MIN_TICK_LABEL_DISTANCE;\n var b = axisLength / tickDistance;\n return numberToInt(JsMath.max(1.0, b));\n };\n HorizontalSimpleLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HorizontalSimpleLabelsLayout$Companion_instance = null;\n function HorizontalSimpleLabelsLayout$Companion_getInstance() {\n if (HorizontalSimpleLabelsLayout$Companion_instance === null) {\n new HorizontalSimpleLabelsLayout$Companion();\n }return HorizontalSimpleLabelsLayout$Companion_instance;\n }\n HorizontalSimpleLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalSimpleLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function HorizontalTiltedLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme) {\n HorizontalTiltedLabelsLayout$Companion_getInstance();\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, labelSpec, breaks, theme);\n }\n Object.defineProperty(HorizontalTiltedLabelsLayout.prototype, 'labelHorizontalAnchor_0', {\n configurable: true,\n get: function () {\n if (this.orientation === Orientation$BOTTOM_getInstance()) {\n return TextLabel$HorizontalAnchor.RIGHT;\n }throw RuntimeException_init('Not implemented');\n }\n });\n Object.defineProperty(HorizontalTiltedLabelsLayout.prototype, 'labelVerticalAnchor_0', {\n configurable: true,\n get: function () {\n return TextLabel$VerticalAnchor.TOP;\n }\n });\n HorizontalTiltedLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n var height = this.labelSpec.height();\n var ticks = this.mapToAxis_d2cc22$(this.breaks_0.transformedValues, axisMapper);\n var overlap = false;\n if (this.breaks_0.size >= 2) {\n var x = (height + HorizontalTiltedLabelsLayout$Companion_getInstance().MIN_DISTANCE_0) / HorizontalTiltedLabelsLayout$Companion_getInstance().SIN_0;\n var minTickDistance = JsMath.abs(x);\n var x_0 = ticks.get_za3lpa$(0) - ticks.get_za3lpa$(1);\n var tickDistance = JsMath.abs(x_0);\n overlap = tickDistance < minTickDistance;\n }var bounds = this.labelsBounds_c3fefx$(ticks, this.breaks_0.labels, AbstractFixedBreaksLabelsLayout$Companion_getInstance().HORIZONTAL_TICK_LOCATION);\n return this.createAxisLabelsLayoutInfoBuilder_fd842m$(ensureNotNull(bounds), overlap).labelHorizontalAnchor_ja80zo$(this.labelHorizontalAnchor_0).labelVerticalAnchor_yaudma$(this.labelVerticalAnchor_0).labelRotationAngle_14dthe$(HorizontalTiltedLabelsLayout$Companion_getInstance().ROTATION_DEGREE_0).build();\n };\n HorizontalTiltedLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n if (!(HorizontalTiltedLabelsLayout$Companion_getInstance().ROTATION_DEGREE_0 >= -90 && HorizontalTiltedLabelsLayout$Companion_getInstance().ROTATION_DEGREE_0 <= 0 && this.labelHorizontalAnchor_0 === TextLabel$HorizontalAnchor.RIGHT && this.labelVerticalAnchor_0 === TextLabel$VerticalAnchor.TOP)) {\n throw RuntimeException_init('Not implemented');\n }var x = labelNormalSize.x * HorizontalTiltedLabelsLayout$Companion_getInstance().COS_0;\n var tmp$ = JsMath.abs(x);\n var x_0 = labelNormalSize.y * HorizontalTiltedLabelsLayout$Companion_getInstance().SIN_0;\n var w = tmp$ + 2 * JsMath.abs(x_0);\n var x_1 = labelNormalSize.x * HorizontalTiltedLabelsLayout$Companion_getInstance().SIN_0;\n var tmp$_0 = JsMath.abs(x_1);\n var x_2 = labelNormalSize.y * HorizontalTiltedLabelsLayout$Companion_getInstance().COS_0;\n var h = tmp$_0 + JsMath.abs(x_2);\n var x_3 = labelNormalSize.x * HorizontalTiltedLabelsLayout$Companion_getInstance().COS_0;\n var tmp$_1 = JsMath.abs(x_3);\n var x_4 = labelNormalSize.y * HorizontalTiltedLabelsLayout$Companion_getInstance().SIN_0;\n var x_5 = -(tmp$_1 + JsMath.abs(x_4));\n var y = 0.0;\n return DoubleRectangle_init(x_5, y, w, h);\n };\n function HorizontalTiltedLabelsLayout$Companion() {\n HorizontalTiltedLabelsLayout$Companion_instance = this;\n this.MIN_DISTANCE_0 = 5.0;\n this.ROTATION_DEGREE_0 = -30.0;\n var x = toRadians(this.ROTATION_DEGREE_0);\n this.SIN_0 = JsMath.sin(x);\n var x_0 = toRadians(this.ROTATION_DEGREE_0);\n this.COS_0 = JsMath.cos(x_0);\n }\n HorizontalTiltedLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HorizontalTiltedLabelsLayout$Companion_instance = null;\n function HorizontalTiltedLabelsLayout$Companion_getInstance() {\n if (HorizontalTiltedLabelsLayout$Companion_instance === null) {\n new HorizontalTiltedLabelsLayout$Companion();\n }return HorizontalTiltedLabelsLayout$Companion_instance;\n }\n HorizontalTiltedLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalTiltedLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function HorizontalVerticalLabelsLayout(orientation, axisDomain, labelSpec, breaks, theme) {\n HorizontalVerticalLabelsLayout$Companion_getInstance();\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, labelSpec, breaks, theme);\n }\n Object.defineProperty(HorizontalVerticalLabelsLayout.prototype, 'labelHorizontalAnchor', {\n configurable: true,\n get: function () {\n if (this.orientation === Orientation$BOTTOM_getInstance()) {\n return TextLabel$HorizontalAnchor.LEFT;\n }throw RuntimeException_init('Not implemented');\n }\n });\n Object.defineProperty(HorizontalVerticalLabelsLayout.prototype, 'labelVerticalAnchor', {\n configurable: true,\n get: function () {\n return TextLabel$VerticalAnchor.CENTER;\n }\n });\n HorizontalVerticalLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n var height = this.labelSpec.height();\n var ticks = this.mapToAxis_d2cc22$(this.breaks_0.transformedValues, axisMapper);\n var overlap = false;\n if (this.breaks_0.size >= 2) {\n var minTickDistance = height + HorizontalVerticalLabelsLayout$Companion_getInstance().MIN_DISTANCE_0;\n var x = ticks.get_za3lpa$(0) - ticks.get_za3lpa$(1);\n var tickDistance = JsMath.abs(x);\n overlap = tickDistance < minTickDistance;\n }var bounds = this.labelsBounds_c3fefx$(ticks, this.breaks_0.labels, AbstractFixedBreaksLabelsLayout$Companion_getInstance().HORIZONTAL_TICK_LOCATION);\n return this.createAxisLabelsLayoutInfoBuilder_fd842m$(ensureNotNull(bounds), overlap).labelHorizontalAnchor_ja80zo$(this.labelHorizontalAnchor).labelVerticalAnchor_yaudma$(this.labelVerticalAnchor).labelRotationAngle_14dthe$(HorizontalVerticalLabelsLayout$Companion_getInstance().ROTATION_DEGREE_0).build();\n };\n HorizontalVerticalLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n if (!(HorizontalVerticalLabelsLayout$Companion_getInstance().ROTATION_DEGREE_0 === 90.0 && this.labelHorizontalAnchor === TextLabel$HorizontalAnchor.LEFT && this.labelVerticalAnchor === TextLabel$VerticalAnchor.CENTER)) {\n throw RuntimeException_init('Not implemented');\n }var w = labelNormalSize.y;\n var h = labelNormalSize.x;\n var x = -w / 2;\n var y = 0.0;\n return DoubleRectangle_init(x, y, w, h);\n };\n function HorizontalVerticalLabelsLayout$Companion() {\n HorizontalVerticalLabelsLayout$Companion_instance = this;\n this.MIN_DISTANCE_0 = 5.0;\n this.ROTATION_DEGREE_0 = 90.0;\n }\n HorizontalVerticalLabelsLayout$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HorizontalVerticalLabelsLayout$Companion_instance = null;\n function HorizontalVerticalLabelsLayout$Companion_getInstance() {\n if (HorizontalVerticalLabelsLayout$Companion_instance === null) {\n new HorizontalVerticalLabelsLayout$Companion();\n }return HorizontalVerticalLabelsLayout$Companion_instance;\n }\n HorizontalVerticalLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HorizontalVerticalLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function VerticalFixedBreaksLabelsLayout(orientation, axisDomain, tickLabelSpec, breaks, theme) {\n AbstractFixedBreaksLabelsLayout.call(this, orientation, axisDomain, tickLabelSpec, breaks, theme);\n }\n VerticalFixedBreaksLabelsLayout.prototype.labelBounds_gpjtzr$ = function (labelNormalSize) {\n throw IllegalStateException_init('Not implemented here');\n };\n VerticalFixedBreaksLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n return BreakLabelsLayoutUtil_getInstance().doLayoutVerticalAxisLabels_7l1gh9$(this.orientation, this.breaks_0, this.axisDomain, axisMapper, this.theme);\n };\n VerticalFixedBreaksLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalFixedBreaksLabelsLayout',\n interfaces: [AbstractFixedBreaksLabelsLayout]\n };\n function VerticalFlexBreaksLabelsLayout(orientation, axisDomain, labelSpec, myBreaksProvider, theme) {\n AxisLabelsLayout.call(this, orientation, axisDomain, labelSpec, theme);\n this.myBreaksProvider_0 = myBreaksProvider;\n if (!!orientation.isHorizontal) {\n var message = orientation.toString();\n throw IllegalArgumentException_init(message.toString());\n }if (!!this.myBreaksProvider_0.isFixedBreaks) {\n var message_0 = 'fixed breaks';\n throw IllegalArgumentException_init(message_0.toString());\n }}\n VerticalFlexBreaksLabelsLayout.prototype.maxTickCount_0 = function (axisLength) {\n var x = axisLength / (AxisLabelsLayout$Companion_getInstance().TICK_LABEL_SPEC.height() + AxisLabelsLayout$Companion_getInstance().MIN_TICK_LABEL_DISTANCE);\n return numberToInt(JsMath.ceil(x));\n };\n VerticalFlexBreaksLabelsLayout.prototype.doLayout_s0wrr0$ = function (axisLength, axisMapper, maxLabelsBounds) {\n if (!(axisLength > 0)) {\n var message = 'axis length: ' + axisLength;\n throw IllegalArgumentException_init(message.toString());\n }var maxTickCount = this.maxTickCount_0(axisLength);\n var breaks = this.getBreaks_0(maxTickCount, axisLength);\n return BreakLabelsLayoutUtil_getInstance().doLayoutVerticalAxisLabels_7l1gh9$(this.orientation, breaks, this.axisDomain, axisMapper, this.theme);\n };\n VerticalFlexBreaksLabelsLayout.prototype.getBreaks_0 = function (maxCount, axisLength) {\n return BreakLabelsLayoutUtil_getInstance().getFlexBreaks_73ga93$(this.myBreaksProvider_0, maxCount, axisLength);\n };\n VerticalFlexBreaksLabelsLayout.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VerticalFlexBreaksLabelsLayout',\n interfaces: [AxisLabelsLayout]\n };\n function Defaults() {\n Defaults_instance = this;\n this.DARK_GRAY = '#3d3d3d';\n this.GRAY = Color.Companion.GRAY.toHexColor();\n this.LIGHT_GRAY = Color.Companion.LIGHT_GRAY.toHexColor();\n this.X_LIGHT_GRAY = Color.Companion.VERY_LIGHT_GRAY.toHexColor();\n this.XX_LIGHT_GRAY = '#e0e0e0';\n this.BACKDROP_COLOR = 'white';\n this.TEXT_COLOR = this.DARK_GRAY;\n this.FONT_LARGE = 16;\n this.FONT_MEDIUM = 12;\n this.FONT_SMALL = 10;\n this.FONT_X_SMALL = 8;\n this.FONT_FAMILY_NORMAL = '\"Lucida Grande\", sans-serif';\n this.FONT_FAMILY_MONOSPACED = '\"Courier New\", Courier, monospace';\n }\n function Defaults$Common() {\n }\n function Defaults$Common$Title() {\n Defaults$Common$Title_instance = this;\n this.FONT_SIZE = 16;\n this.FONT_SIZE_CSS = '' + toString(16) + 'px';\n }\n Defaults$Common$Title.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Title',\n interfaces: []\n };\n var Defaults$Common$Title_instance = null;\n function Defaults$Common$Title_getInstance() {\n if (Defaults$Common$Title_instance === null) {\n new Defaults$Common$Title();\n }return Defaults$Common$Title_instance;\n }\n function Defaults$Common$Legend() {\n Defaults$Common$Legend_instance = this;\n this.TITLE_FONT_SIZE = 12;\n this.ITEM_FONT_SIZE = 10;\n this.OUTLINE_COLOR = Color.Companion.parseHex_61zpoe$(Defaults_getInstance().XX_LIGHT_GRAY);\n }\n Defaults$Common$Legend.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Legend',\n interfaces: []\n };\n var Defaults$Common$Legend_instance = null;\n function Defaults$Common$Legend_getInstance() {\n if (Defaults$Common$Legend_instance === null) {\n new Defaults$Common$Legend();\n }return Defaults$Common$Legend_instance;\n }\n function Defaults$Common$Tooltip() {\n Defaults$Common$Tooltip_instance = this;\n this.MAX_POINTER_FOOTING_LENGTH = 12.0;\n this.POINTER_FOOTING_TO_SIDE_LENGTH_RATIO = 0.4;\n this.MARGIN_BETWEEN_TOOLTIPS = 5.0;\n this.DATA_TOOLTIP_FONT_SIZE = 12;\n this.LINE_INTERVAL = 3.0;\n this.H_CONTENT_PADDING = 4.0;\n this.V_CONTENT_PADDING = 4.0;\n this.LABEL_VALUE_INTERVAL = 8.0;\n this.BORDER_WIDTH = 4.0;\n this.DARK_TEXT_COLOR = Color.Companion.BLACK;\n this.LIGHT_TEXT_COLOR = Color.Companion.WHITE;\n this.AXIS_TOOLTIP_FONT_SIZE = 12;\n this.AXIS_TOOLTIP_COLOR = Defaults$Plot$Axis_getInstance().LINE_COLOR;\n this.AXIS_RADIUS = 1.5;\n }\n Defaults$Common$Tooltip.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Tooltip',\n interfaces: []\n };\n var Defaults$Common$Tooltip_instance = null;\n function Defaults$Common$Tooltip_getInstance() {\n if (Defaults$Common$Tooltip_instance === null) {\n new Defaults$Common$Tooltip();\n }return Defaults$Common$Tooltip_instance;\n }\n Defaults$Common.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Common',\n interfaces: []\n };\n function Defaults$Table() {\n }\n function Defaults$Table$Head() {\n Defaults$Table$Head_instance = this;\n this.FONT_SIZE = 12;\n this.FONT_SIZE_CSS = '' + toString(12) + 'px';\n }\n Defaults$Table$Head.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Head',\n interfaces: []\n };\n var Defaults$Table$Head_instance = null;\n function Defaults$Table$Head_getInstance() {\n if (Defaults$Table$Head_instance === null) {\n new Defaults$Table$Head();\n }return Defaults$Table$Head_instance;\n }\n function Defaults$Table$Data() {\n Defaults$Table$Data_instance = this;\n this.FONT_SIZE = 12;\n this.FONT_SIZE_CSS = '' + toString(12) + 'px';\n }\n Defaults$Table$Data.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Data',\n interfaces: []\n };\n var Defaults$Table$Data_instance = null;\n function Defaults$Table$Data_getInstance() {\n if (Defaults$Table$Data_instance === null) {\n new Defaults$Table$Data();\n }return Defaults$Table$Data_instance;\n }\n Defaults$Table.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Table',\n interfaces: []\n };\n function Defaults$Plot() {\n }\n function Defaults$Plot$Axis() {\n Defaults$Plot$Axis_instance = this;\n this.TITLE_FONT_SIZE = 12;\n this.TICK_FONT_SIZE = 10;\n this.TICK_FONT_SIZE_SMALL = 8;\n this.LINE_COLOR = Color.Companion.parseHex_61zpoe$(Defaults_getInstance().DARK_GRAY);\n this.TICK_COLOR = Color.Companion.parseHex_61zpoe$(Defaults_getInstance().DARK_GRAY);\n this.GRID_LINE_COLOR = Color.Companion.parseHex_61zpoe$(Defaults_getInstance().X_LIGHT_GRAY);\n this.LINE_WIDTH = 1.0;\n this.TICK_LINE_WIDTH = 1.0;\n this.GRID_LINE_WIDTH = 1.0;\n }\n Defaults$Plot$Axis.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Axis',\n interfaces: []\n };\n var Defaults$Plot$Axis_instance = null;\n function Defaults$Plot$Axis_getInstance() {\n if (Defaults$Plot$Axis_instance === null) {\n new Defaults$Plot$Axis();\n }return Defaults$Plot$Axis_instance;\n }\n Defaults$Plot.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Plot',\n interfaces: []\n };\n Defaults.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Defaults',\n interfaces: []\n };\n var Defaults_instance = null;\n function Defaults_getInstance() {\n if (Defaults_instance === null) {\n new Defaults();\n }return Defaults_instance;\n }\n function LabelCss() {\n LabelCss_instance = this;\n }\n LabelCss.prototype.get_diyz8p$ = function (labelSpec, selector) {\n var css = StringBuilder_init();\n css.append_pdl1vj$(selector).append_pdl1vj$(' {').append_pdl1vj$(labelSpec.isMonospaced ? '\\n font-family: ' + Defaults_getInstance().FONT_FAMILY_MONOSPACED + ';' : '\\n').append_pdl1vj$('\\n font-size: ').append_s8jyv4$(labelSpec.fontSize).append_pdl1vj$('px;').append_pdl1vj$(labelSpec.isBold ? '\\n font-weight: bold;' : '').append_pdl1vj$('\\n}\\n');\n return css.toString();\n };\n LabelCss.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'LabelCss',\n interfaces: []\n };\n var LabelCss_instance = null;\n function LabelCss_getInstance() {\n if (LabelCss_instance === null) {\n new LabelCss();\n }return LabelCss_instance;\n }\n function Serializable() {\n }\n Serializable.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Serializable',\n interfaces: []\n };\n function LabelMetrics() {\n LabelMetrics$Companion_getInstance();\n this.fontSize_yu4fth$_0 = 0;\n this.isBold_4ltcm$_0 = false;\n this.isMonospaced_kwm1y$_0 = false;\n }\n Object.defineProperty(LabelMetrics.prototype, 'fontSize', {\n configurable: true,\n get: function () {\n return this.fontSize_yu4fth$_0;\n }\n });\n Object.defineProperty(LabelMetrics.prototype, 'isBold', {\n configurable: true,\n get: function () {\n return this.isBold_4ltcm$_0;\n }\n });\n Object.defineProperty(LabelMetrics.prototype, 'isMonospaced', {\n configurable: true,\n get: function () {\n return this.isMonospaced_kwm1y$_0;\n }\n });\n LabelMetrics.prototype.dimensions_za3lpa$ = function (labelLength) {\n return new DoubleVector(this.width_za3lpa$(labelLength), this.height());\n };\n LabelMetrics.prototype.width_za3lpa$ = function (labelLength) {\n var tmp$;\n var ratio = LabelMetrics$Companion_getInstance().FONT_SIZE_TO_GLYPH_WIDTH_RATIO_0;\n if (this.isMonospaced) {\n ratio = LabelMetrics$Companion_getInstance().FONT_SIZE_TO_GLYPH_WIDTH_RATIO_MONOSPACED_0;\n }var width = labelLength * this.fontSize * ratio + 2 * LabelMetrics$Companion_getInstance().LABEL_PADDING_0;\n if (this.isBold) {\n tmp$ = width * LabelMetrics$Companion_getInstance().FONT_WEIGHT_BOLD_TO_NORMAL_WIDTH_RATIO_0;\n } else\n tmp$ = width;\n return tmp$;\n };\n LabelMetrics.prototype.height = function () {\n return this.fontSize + 2 * LabelMetrics$Companion_getInstance().LABEL_PADDING_0;\n };\n function LabelMetrics$Companion() {\n LabelMetrics$Companion_instance = this;\n this.FONT_SIZE_TO_GLYPH_WIDTH_RATIO_0 = 0.67;\n this.FONT_SIZE_TO_GLYPH_WIDTH_RATIO_MONOSPACED_0 = 0.6;\n this.FONT_WEIGHT_BOLD_TO_NORMAL_WIDTH_RATIO_0 = 1.075;\n this.LABEL_PADDING_0 = 0.0;\n }\n LabelMetrics$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var LabelMetrics$Companion_instance = null;\n function LabelMetrics$Companion_getInstance() {\n if (LabelMetrics$Companion_instance === null) {\n new LabelMetrics$Companion();\n }return LabelMetrics$Companion_instance;\n }\n LabelMetrics.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LabelMetrics',\n interfaces: [Serializable, LabelSpec]\n };\n function LabelMetrics_init($this) {\n $this = $this || Object.create(LabelMetrics.prototype);\n LabelMetrics.call($this);\n $this.fontSize_yu4fth$_0 = 0.0;\n $this.isBold_4ltcm$_0 = false;\n $this.isMonospaced_kwm1y$_0 = false;\n return $this;\n }\n function LabelMetrics_init_0(fontSize, bold, monospaced, $this) {\n if (bold === void 0)\n bold = false;\n if (monospaced === void 0)\n monospaced = false;\n $this = $this || Object.create(LabelMetrics.prototype);\n LabelMetrics.call($this);\n $this.fontSize_yu4fth$_0 = fontSize;\n $this.isBold_4ltcm$_0 = bold;\n $this.isMonospaced_kwm1y$_0 = monospaced;\n return $this;\n }\n function LabelSpec() {\n }\n LabelSpec.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LabelSpec',\n interfaces: []\n };\n function PlotLabelSpec(name, ordinal, fontSize, bold, monospaced) {\n if (bold === void 0)\n bold = false;\n if (monospaced === void 0)\n monospaced = false;\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n this.myLabelMetrics_3i33aj$_0 = null;\n this.myLabelMetrics_3i33aj$_0 = LabelMetrics_init_0(fontSize, bold, monospaced);\n }\n function PlotLabelSpec_initFields() {\n PlotLabelSpec_initFields = function () {\n };\n PlotLabelSpec$PLOT_TITLE_instance = new PlotLabelSpec('PLOT_TITLE', 0, 16, true);\n PlotLabelSpec$AXIS_TICK_instance = new PlotLabelSpec('AXIS_TICK', 1, 10);\n PlotLabelSpec$AXIS_TICK_SMALL_instance = new PlotLabelSpec('AXIS_TICK_SMALL', 2, 8);\n PlotLabelSpec$AXIS_TITLE_instance = new PlotLabelSpec('AXIS_TITLE', 3, 12);\n PlotLabelSpec$LEGEND_TITLE_instance = new PlotLabelSpec('LEGEND_TITLE', 4, 12, true);\n PlotLabelSpec$LEGEND_ITEM_instance = new PlotLabelSpec('LEGEND_ITEM', 5, 10);\n }\n var PlotLabelSpec$PLOT_TITLE_instance;\n function PlotLabelSpec$PLOT_TITLE_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$PLOT_TITLE_instance;\n }\n var PlotLabelSpec$AXIS_TICK_instance;\n function PlotLabelSpec$AXIS_TICK_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$AXIS_TICK_instance;\n }\n var PlotLabelSpec$AXIS_TICK_SMALL_instance;\n function PlotLabelSpec$AXIS_TICK_SMALL_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$AXIS_TICK_SMALL_instance;\n }\n var PlotLabelSpec$AXIS_TITLE_instance;\n function PlotLabelSpec$AXIS_TITLE_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$AXIS_TITLE_instance;\n }\n var PlotLabelSpec$LEGEND_TITLE_instance;\n function PlotLabelSpec$LEGEND_TITLE_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$LEGEND_TITLE_instance;\n }\n var PlotLabelSpec$LEGEND_ITEM_instance;\n function PlotLabelSpec$LEGEND_ITEM_getInstance() {\n PlotLabelSpec_initFields();\n return PlotLabelSpec$LEGEND_ITEM_instance;\n }\n Object.defineProperty(PlotLabelSpec.prototype, 'isBold', {\n configurable: true,\n get: function () {\n return this.myLabelMetrics_3i33aj$_0.isBold;\n }\n });\n Object.defineProperty(PlotLabelSpec.prototype, 'isMonospaced', {\n configurable: true,\n get: function () {\n return this.myLabelMetrics_3i33aj$_0.isMonospaced;\n }\n });\n Object.defineProperty(PlotLabelSpec.prototype, 'fontSize', {\n configurable: true,\n get: function () {\n return this.myLabelMetrics_3i33aj$_0.fontSize;\n }\n });\n PlotLabelSpec.prototype.dimensions_za3lpa$ = function (labelLength) {\n return this.myLabelMetrics_3i33aj$_0.dimensions_za3lpa$(labelLength);\n };\n PlotLabelSpec.prototype.width_za3lpa$ = function (labelLength) {\n return this.myLabelMetrics_3i33aj$_0.width_za3lpa$(labelLength);\n };\n PlotLabelSpec.prototype.height = function () {\n return this.myLabelMetrics_3i33aj$_0.height();\n };\n PlotLabelSpec.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotLabelSpec',\n interfaces: [LabelSpec, Enum]\n };\n function PlotLabelSpec$values() {\n return [PlotLabelSpec$PLOT_TITLE_getInstance(), PlotLabelSpec$AXIS_TICK_getInstance(), PlotLabelSpec$AXIS_TICK_SMALL_getInstance(), PlotLabelSpec$AXIS_TITLE_getInstance(), PlotLabelSpec$LEGEND_TITLE_getInstance(), PlotLabelSpec$LEGEND_ITEM_getInstance()];\n }\n PlotLabelSpec.values = PlotLabelSpec$values;\n function PlotLabelSpec$valueOf(name) {\n switch (name) {\n case 'PLOT_TITLE':\n return PlotLabelSpec$PLOT_TITLE_getInstance();\n case 'AXIS_TICK':\n return PlotLabelSpec$AXIS_TICK_getInstance();\n case 'AXIS_TICK_SMALL':\n return PlotLabelSpec$AXIS_TICK_SMALL_getInstance();\n case 'AXIS_TITLE':\n return PlotLabelSpec$AXIS_TITLE_getInstance();\n case 'LEGEND_TITLE':\n return PlotLabelSpec$LEGEND_TITLE_getInstance();\n case 'LEGEND_ITEM':\n return PlotLabelSpec$LEGEND_ITEM_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.builder.presentation.PlotLabelSpec.' + name);\n }\n }\n PlotLabelSpec.valueOf_61zpoe$ = PlotLabelSpec$valueOf;\n function Style() {\n Style_instance = this;\n this.JFX_PLOT_STYLESHEET = '/svgMapper/jfx/plot.css';\n this.PLOT_CONTAINER = 'plt-container';\n this.PLOT = 'plt-plot';\n this.PLOT_TITLE = 'plt-plot-title';\n this.PLOT_TRANSPARENT = 'plt-transparent';\n this.PLOT_BACKDROP = 'plt-backdrop';\n this.AXIS = 'plt-axis';\n this.AXIS_TITLE = 'plt-axis-title';\n this.TICK = 'tick';\n this.SMALL_TICK_FONT = 'small-tick-font';\n this.BACK = 'back';\n this.LEGEND = 'plt_legend';\n this.LEGEND_TITLE = 'legend-title';\n this.PLOT_DATA_TOOLTIP = 'plt-data-tooltip';\n this.PLOT_AXIS_TOOLTIP = 'plt-axis-tooltip';\n this.CSS_0 = trimMargin('\\n |.plt-container {\\n |\\tfont-family: \"Lucida Grande\", sans-serif;\\n |\\tcursor: crosshair;\\n |\\tuser-select: none;\\n |\\t-webkit-user-select: none;\\n |\\t-moz-user-select: none;\\n |\\t-ms-user-select: none;\\n |}\\n |.plt-backdrop {\\n | fill: white;\\n |}\\n |.plt-transparent .plt-backdrop {\\n | visibility: hidden;\\n |}\\n |text {\\n |\\tfont-size: 12px;\\n |\\tfill: #3d3d3d;\\n |\\t\\n |\\ttext-rendering: optimizeLegibility;\\n |}\\n |.plt-data-tooltip text {\\n |\\tfont-size: 12px;\\n |}\\n |.plt-axis-tooltip text {\\n |\\tfont-size: 12px;\\n |}\\n |.plt-axis line {\\n |\\tshape-rendering: crispedges;\\n |}\\n ');\n }\n Object.defineProperty(Style.prototype, 'css', {\n configurable: true,\n get: function () {\n var tmp$, tmp$_0;\n var css = new StringBuilder(this.CSS_0.toString());\n css.append_s8itvh$(10);\n tmp$ = PlotLabelSpec$values();\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var labelSpec = tmp$[tmp$_0];\n var selector = this.selector_0(labelSpec);\n css.append_pdl1vj$(LabelCss_getInstance().get_diyz8p$(labelSpec, selector));\n }\n return css.toString();\n }\n });\n Style.prototype.selector_0 = function (labelSpec) {\n var tmp$;\n switch (labelSpec.name) {\n case 'PLOT_TITLE':\n tmp$ = '.plt-plot-title';\n break;\n case 'AXIS_TICK':\n tmp$ = '.plt-axis .tick text';\n break;\n case 'AXIS_TICK_SMALL':\n tmp$ = '.plt-axis.small-tick-font .tick text';\n break;\n case 'AXIS_TITLE':\n tmp$ = '.plt-axis-title text';\n break;\n case 'LEGEND_TITLE':\n tmp$ = '.plt_legend .legend-title text';\n break;\n case 'LEGEND_ITEM':\n tmp$ = '.plt_legend text';\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n Style.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Style',\n interfaces: []\n };\n var Style_instance = null;\n function Style_getInstance() {\n if (Style_instance === null) {\n new Style();\n }return Style_instance;\n }\n function GroupAwareSampling() {\n }\n GroupAwareSampling.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GroupAwareSampling',\n interfaces: [Sampling]\n };\n function PointSampling() {\n }\n PointSampling.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PointSampling',\n interfaces: [Sampling]\n };\n function Sampling() {\n }\n Sampling.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Sampling',\n interfaces: []\n };\n function Samplings() {\n Samplings_instance = this;\n this.RANDOM = RandomSampling$Companion_getInstance().ALIAS;\n this.PICK = PickSampling$Companion_getInstance().ALIAS;\n this.SYSTEMATIC = SystematicSampling$Companion_getInstance().ALIAS;\n this.RANDOM_GROUP = GroupRandomSampling$Companion_getInstance().ALIAS;\n this.SYSTEMATIC_GROUP = GroupSystematicSampling$Companion_getInstance().ALIAS;\n this.RANDOM_STRATIFIED = RandomStratifiedSampling$Companion_getInstance().ALIAS_8be2vx$;\n this.VERTEX_VW = VertexSampling$VertexVwSampling$Companion_getInstance().ALIAS;\n this.VERTEX_DP = VertexSampling$VertexDpSampling$Companion_getInstance().ALIAS;\n this.NONE = new Samplings$NoneSampling();\n }\n Samplings.prototype.random_280ow0$ = function (sampleSize, seed) {\n return new RandomSampling(sampleSize, seed);\n };\n Samplings.prototype.pick_za3lpa$ = function (sampleSize) {\n return new PickSampling(sampleSize);\n };\n Samplings.prototype.vertexDp_za3lpa$ = function (sampleSize) {\n return new VertexSampling$VertexDpSampling(sampleSize);\n };\n Samplings.prototype.vertexVw_za3lpa$ = function (sampleSize) {\n return new VertexSampling$VertexVwSampling(sampleSize);\n };\n Samplings.prototype.systematic_za3lpa$ = function (sampleSize) {\n return new SystematicSampling(sampleSize);\n };\n Samplings.prototype.randomGroup_280ow0$ = function (sampleSize, seed) {\n return new GroupRandomSampling(sampleSize, seed);\n };\n Samplings.prototype.systematicGroup_za3lpa$ = function (sampleSize) {\n return new GroupSystematicSampling(sampleSize);\n };\n Samplings.prototype.randomStratified_vcwos1$ = function (sampleSize, seed, minSubSample) {\n return new RandomStratifiedSampling(sampleSize, seed, minSubSample);\n };\n function Samplings$NoneSampling() {\n }\n Object.defineProperty(Samplings$NoneSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'none';\n }\n });\n Samplings$NoneSampling.prototype.isApplicable_dhhkv7$ = function (population) {\n return false;\n };\n Samplings$NoneSampling.prototype.apply_dhhkv7$ = function (population) {\n return population;\n };\n Samplings$NoneSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'NoneSampling',\n interfaces: [PointSampling]\n };\n Samplings.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Samplings',\n interfaces: []\n };\n var Samplings_instance = null;\n function Samplings_getInstance() {\n if (Samplings_instance === null) {\n new Samplings();\n }return Samplings_instance;\n }\n function GroupRandomSampling(sampleSize, mySeed) {\n GroupRandomSampling$Companion_getInstance();\n GroupSamplingBase.call(this, sampleSize);\n this.mySeed_0 = mySeed;\n }\n Object.defineProperty(GroupRandomSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + GroupRandomSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + (this.mySeed_0 != null ? ', seed=' + toString(this.mySeed_0) : '') + ')';\n }\n });\n GroupRandomSampling.prototype.apply_se5qvl$ = function (population, groupMapper) {\n if (!this.isApplicable_se5qvl$(population, groupMapper)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var distinctGroups = SamplingUtil_getInstance().distinctGroups_ejae6o$(groupMapper, population.rowCount());\n shuffle(distinctGroups, this.createRandom_0());\n var pickedGroups = toSet(take(distinctGroups, this.sampleSize));\n return this.doSelect_z69lec$(population, pickedGroups, groupMapper);\n };\n GroupRandomSampling.prototype.createRandom_0 = function () {\n var tmp$, tmp$_0;\n return (tmp$_0 = (tmp$ = this.mySeed_0) != null ? Random(tmp$) : null) != null ? tmp$_0 : Random_0.Default;\n };\n function GroupRandomSampling$Companion() {\n GroupRandomSampling$Companion_instance = this;\n this.ALIAS = 'group_random';\n }\n GroupRandomSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GroupRandomSampling$Companion_instance = null;\n function GroupRandomSampling$Companion_getInstance() {\n if (GroupRandomSampling$Companion_instance === null) {\n new GroupRandomSampling$Companion();\n }return GroupRandomSampling$Companion_instance;\n }\n GroupRandomSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupRandomSampling',\n interfaces: [GroupSamplingBase]\n };\n function GroupSamplingBase(sampleSize) {\n SamplingBase.call(this, sampleSize);\n }\n GroupSamplingBase.prototype.isApplicable_se5qvl$ = function (population, groupMapper) {\n return this.isApplicable_ijg2gx$(population, groupMapper, SamplingUtil_getInstance().groupCount_ejae6o$(groupMapper, population.rowCount()));\n };\n GroupSamplingBase.prototype.isApplicable_ijg2gx$ = function (population, groupMapper, groupCount) {\n return groupCount > this.sampleSize;\n };\n GroupSamplingBase.prototype.doSelect_z69lec$ = function (population, pickedGroups, groupMapper) {\n var tmp$;\n var indicesByGroup = GroupUtil_getInstance().indicesByGroup_wc9gac$(population.rowCount(), groupMapper);\n var pickedIndices = ArrayList_init();\n tmp$ = pickedGroups.iterator();\n while (tmp$.hasNext()) {\n var group = tmp$.next();\n pickedIndices.addAll_brywnq$(ensureNotNull(indicesByGroup.get_11rb$(group)));\n }\n return population.selectIndices_pqoyrt$(pickedIndices);\n };\n GroupSamplingBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupSamplingBase',\n interfaces: [GroupAwareSampling, SamplingBase]\n };\n function GroupSystematicSampling(sampleSize) {\n GroupSystematicSampling$Companion_getInstance();\n GroupSamplingBase.call(this, sampleSize);\n }\n Object.defineProperty(GroupSystematicSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + GroupSystematicSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + ')';\n }\n });\n GroupSystematicSampling.prototype.isApplicable_ijg2gx$ = function (population, groupMapper, groupCount) {\n return GroupSamplingBase.prototype.isApplicable_ijg2gx$.call(this, population, groupMapper, groupCount) && SystematicSampling$Companion_getInstance().computeStep_vux9f0$(groupCount, this.sampleSize) >= 2;\n };\n GroupSystematicSampling.prototype.apply_se5qvl$ = function (population, groupMapper) {\n if (!this.isApplicable_se5qvl$(population, groupMapper)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var distinctGroups = SamplingUtil_getInstance().distinctGroups_ejae6o$(groupMapper, population.rowCount());\n var step = SystematicSampling$Companion_getInstance().computeStep_vux9f0$(distinctGroups.size, this.sampleSize);\n var pickedGroups = HashSet_init_0();\n var i = 0;\n while (i < distinctGroups.size) {\n pickedGroups.add_11rb$(distinctGroups.get_za3lpa$(i));\n i = i + step | 0;\n }\n return this.doSelect_z69lec$(population, pickedGroups, groupMapper);\n };\n function GroupSystematicSampling$Companion() {\n GroupSystematicSampling$Companion_instance = this;\n this.ALIAS = 'group_systematic';\n }\n GroupSystematicSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GroupSystematicSampling$Companion_instance = null;\n function GroupSystematicSampling$Companion_getInstance() {\n if (GroupSystematicSampling$Companion_instance === null) {\n new GroupSystematicSampling$Companion();\n }return GroupSystematicSampling$Companion_instance;\n }\n GroupSystematicSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GroupSystematicSampling',\n interfaces: [GroupSamplingBase]\n };\n function PickSampling(sampleSize) {\n PickSampling$Companion_getInstance();\n SamplingBase.call(this, sampleSize);\n }\n Object.defineProperty(PickSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + PickSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + ')';\n }\n });\n PickSampling.prototype.apply_dhhkv7$ = function (population) {\n if (!this.isApplicable_dhhkv7$(population)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var xVar = SamplingUtil_getInstance().xVar_dhhkv7$(population);\n var xFactors = population.distinctValues_8xm3sj$(xVar);\n if (xFactors.size <= this.sampleSize) {\n return population;\n }var pickX = toSet(take(xFactors, this.sampleSize));\n var xValues = population.get_8xm3sj$(xVar);\n var pickedIndices = ArrayList_init();\n var index = 0;\n for (var tmp$ = xValues.iterator(); tmp$.hasNext(); ++index) {\n var v = tmp$.next();\n if (contains(pickX, v)) {\n pickedIndices.add_11rb$(index);\n }}\n return population.selectIndices_pqoyrt$(pickedIndices);\n };\n function PickSampling$Companion() {\n PickSampling$Companion_instance = this;\n this.ALIAS = 'pick';\n }\n PickSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PickSampling$Companion_instance = null;\n function PickSampling$Companion_getInstance() {\n if (PickSampling$Companion_instance === null) {\n new PickSampling$Companion();\n }return PickSampling$Companion_instance;\n }\n PickSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PickSampling',\n interfaces: [PointSampling, SamplingBase]\n };\n function RandomSampling(sampleSize, mySeed) {\n RandomSampling$Companion_getInstance();\n SamplingBase.call(this, sampleSize);\n this.mySeed_0 = mySeed;\n }\n Object.defineProperty(RandomSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + RandomSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + (this.mySeed_0 != null ? ', seed=' + toString(this.mySeed_0) : '') + ')';\n }\n });\n RandomSampling.prototype.apply_dhhkv7$ = function (population) {\n var tmp$, tmp$_0;\n if (!this.isApplicable_dhhkv7$(population)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var rand = (tmp$_0 = (tmp$ = this.mySeed_0) != null ? Random(tmp$) : null) != null ? tmp$_0 : Random_0.Default;\n return util.SamplingUtil.sampleWithoutReplacement_egh5ya$(this.sampleSize, rand, population);\n };\n function RandomSampling$Companion() {\n RandomSampling$Companion_instance = this;\n this.ALIAS = 'random';\n }\n RandomSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RandomSampling$Companion_instance = null;\n function RandomSampling$Companion_getInstance() {\n if (RandomSampling$Companion_instance === null) {\n new RandomSampling$Companion();\n }return RandomSampling$Companion_instance;\n }\n RandomSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RandomSampling',\n interfaces: [PointSampling, SamplingBase]\n };\n function RandomStratifiedSampling(sampleSize, mySeed, myMinSubsampleSize) {\n RandomStratifiedSampling$Companion_getInstance();\n SamplingBase.call(this, sampleSize);\n this.mySeed_0 = mySeed;\n this.myMinSubsampleSize_0 = myMinSubsampleSize;\n }\n Object.defineProperty(RandomStratifiedSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + RandomStratifiedSampling$Companion_getInstance().ALIAS_8be2vx$ + '(' + 'n=' + toString(this.sampleSize) + (this.mySeed_0 != null ? ', seed=' + toString(this.mySeed_0) : '') + (this.myMinSubsampleSize_0 != null ? ', min_subsample=' + toString(this.myMinSubsampleSize_0) : '') + ')';\n }\n });\n RandomStratifiedSampling.prototype.isApplicable_se5qvl$ = function (population, groupMapper) {\n return population.rowCount() > this.sampleSize;\n };\n function RandomStratifiedSampling$apply$lambda(closure$groupIndices) {\n return function (indexSet) {\n var $receiver = until(0, closure$groupIndices.size);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (indexSet.contains_11rb$(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n }\n function RandomStratifiedSampling$apply$lambda_0(closure$groupIndices) {\n return function (indexSet) {\n var $receiver = until(0, closure$groupIndices.size);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n if (!indexSet.contains_11rb$(element))\n destination.add_11rb$(element);\n }\n return destination;\n };\n }\n RandomStratifiedSampling.prototype.apply_se5qvl$ = function (population, groupMapper) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2, tmp$_3;\n if (!this.isApplicable_se5qvl$(population, groupMapper)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var indicesByGroup = GroupUtil_getInstance().indicesByGroup_wc9gac$(population.rowCount(), groupMapper);\n var minSubSampleSize = (tmp$ = this.myMinSubsampleSize_0) != null ? tmp$ : 2;\n var b = minSubSampleSize;\n minSubSampleSize = JsMath.max(0, b);\n var popSize = population.rowCount();\n var pickIndices = ArrayList_init();\n var rand = (tmp$_1 = (tmp$_0 = this.mySeed_0) != null ? Random(tmp$_0) : null) != null ? tmp$_1 : Random_0.Default;\n tmp$_2 = indicesByGroup.keys.iterator();\n while (tmp$_2.hasNext()) {\n var group = tmp$_2.next();\n var groupIndices = ensureNotNull(indicesByGroup.get_11rb$(group));\n var stratumSize = groupIndices.size;\n var ratio = stratumSize / popSize;\n var stratumSampleSize = numberToInt(round(this.sampleSize * ratio));\n var a = stratumSampleSize;\n var b_0 = minSubSampleSize;\n stratumSampleSize = JsMath.max(a, b_0);\n if (stratumSampleSize >= stratumSize) {\n pickIndices.addAll_brywnq$(groupIndices);\n } else {\n var sampleGroupIndices = util.SamplingUtil.sampleWithoutReplacement_o7ew15$(stratumSize, stratumSampleSize, rand, RandomStratifiedSampling$apply$lambda(groupIndices), RandomStratifiedSampling$apply$lambda_0(groupIndices));\n tmp$_3 = sampleGroupIndices.iterator();\n while (tmp$_3.hasNext()) {\n var i = tmp$_3.next();\n pickIndices.add_11rb$(groupIndices.get_za3lpa$(i));\n }\n }\n }\n return population.selectIndices_pqoyrt$(pickIndices);\n };\n function RandomStratifiedSampling$Companion() {\n RandomStratifiedSampling$Companion_instance = this;\n this.ALIAS_8be2vx$ = 'random_stratified';\n this.DEF_MIN_SUBSAMPLE_SIZE_0 = 2;\n }\n RandomStratifiedSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RandomStratifiedSampling$Companion_instance = null;\n function RandomStratifiedSampling$Companion_getInstance() {\n if (RandomStratifiedSampling$Companion_instance === null) {\n new RandomStratifiedSampling$Companion();\n }return RandomStratifiedSampling$Companion_instance;\n }\n RandomStratifiedSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RandomStratifiedSampling',\n interfaces: [GroupAwareSampling, SamplingBase]\n };\n function SamplingBase(sampleSize) {\n this.sampleSize = sampleSize;\n if (!(this.sampleSize > 0)) {\n var message = 'Sample size must be greater than zero, but was: ' + toString(this.sampleSize);\n throw IllegalStateException_init(message.toString());\n }}\n SamplingBase.prototype.isApplicable_dhhkv7$ = function (population) {\n return population.rowCount() > this.sampleSize;\n };\n SamplingBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SamplingBase',\n interfaces: [Sampling]\n };\n var compareBy$lambda_0 = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function SamplingUtil() {\n SamplingUtil_instance = this;\n }\n SamplingUtil.prototype.groupCount_ejae6o$ = function (groupMapper, size) {\n var $receiver = until(0, size);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(groupMapper(item));\n }\n return distinct(destination).size;\n };\n SamplingUtil.prototype.distinctGroups_ejae6o$ = function (groupMapper, size) {\n var $receiver = until(0, size);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(groupMapper(item));\n }\n return toMutableList(distinct(destination));\n };\n SamplingUtil.prototype.xVar_bbyvt0$ = function (variables) {\n var tmp$;\n if (variables.contains_11rb$(stat.Stats.X))\n tmp$ = stat.Stats.X;\n else if (variables.contains_11rb$(data.TransformVar.X))\n tmp$ = data.TransformVar.X;\n else\n tmp$ = null;\n return tmp$;\n };\n SamplingUtil.prototype.xVar_dhhkv7$ = function (data) {\n var tmp$;\n tmp$ = this.xVar_bbyvt0$(data.variables());\n if (tmp$ == null) {\n throw IllegalStateException_init(\"Can't apply sampling: couldn't deduce the (X) variable.\");\n }return tmp$;\n };\n SamplingUtil.prototype.yVar_dhhkv7$ = function (data_0) {\n if (data_0.has_8xm3sj$(stat.Stats.Y)) {\n return stat.Stats.Y;\n } else if (data_0.has_8xm3sj$(data.TransformVar.Y)) {\n return data.TransformVar.Y;\n }throw IllegalStateException_init(\"Can't apply sampling: couldn't deduce the (Y) variable.\");\n };\n SamplingUtil.prototype.splitRings_dhhkv7$ = function (population) {\n var tmp$, tmp$_0;\n var rings = ArrayList_init();\n var lastPoint = null;\n var start = -1;\n var xValues = Kotlin.isType(tmp$ = population.get_8xm3sj$(this.xVar_dhhkv7$(population)), List) ? tmp$ : throwCCE();\n var yValues = Kotlin.isType(tmp$_0 = population.get_8xm3sj$(this.yVar_dhhkv7$(population)), List) ? tmp$_0 : throwCCE();\n var points = new VertexSampling$DoubleVectorComponentsList(xValues, yValues);\n for (var i = 0; i !== points.size; ++i) {\n var point = points.get_za3lpa$(i);\n if (start < 0) {\n start = i;\n lastPoint = point;\n } else if (equals(lastPoint, point)) {\n rings.add_11rb$(points.subList_vux9f0$(start, i + 1 | 0));\n start = -1;\n lastPoint = null;\n }}\n if (start >= 0) {\n rings.add_11rb$(points.subList_vux9f0$(start, points.size));\n }return rings;\n };\n function SamplingUtil$calculateRingLimits$lambda(closure$rings) {\n return function (it) {\n return new Pair(it, calculateArea(closure$rings.get_za3lpa$(it)));\n };\n }\n function SamplingUtil$calculateRingLimits$lambda_0(this$SamplingUtil) {\n return function (it) {\n return this$SamplingUtil.getRingArea_0(it);\n };\n }\n function SamplingUtil$calculateRingLimits$lambda_1(closure$totalArea, closure$areaProceed, closure$totalPointsLimit, closure$pointsProceed, closure$rings, this$SamplingUtil) {\n return function (p) {\n var a = roundToInt(p.second / (closure$totalArea - closure$areaProceed.get()) * (closure$totalPointsLimit - closure$pointsProceed.get() | 0));\n var b = closure$rings.get_za3lpa$(this$SamplingUtil.getRingIndex_3gcxfl$(p)).size;\n var limit = JsMath.min(a, b);\n if (limit >= 4) {\n closure$areaProceed.getAndAdd_14dthe$(this$SamplingUtil.getRingArea_0(p));\n closure$pointsProceed.getAndAdd_za3lpa$(limit);\n } else {\n limit = 0;\n }\n return new Pair(this$SamplingUtil.getRingIndex_3gcxfl$(p), limit);\n };\n }\n function SamplingUtil$calculateRingLimits$lambda_2(this$SamplingUtil) {\n return function (it) {\n return this$SamplingUtil.getRingIndex_3gcxfl$(it);\n };\n }\n function SamplingUtil$calculateRingLimits$lambda_3(this$SamplingUtil) {\n return function (it) {\n return this$SamplingUtil.getRingLimit_66os8t$(it);\n };\n }\n SamplingUtil.prototype.calculateRingLimits_rmr3bv$ = function (rings, totalPointsLimit) {\n var destination = ArrayList_init_0(collectionSizeOrDefault(rings, 10));\n var tmp$;\n tmp$ = rings.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(calculateArea(item));\n }\n var totalArea = sum(destination);\n var areaProceed = new MutableDouble(0.0);\n var pointsProceed = new MutableInteger(0);\n return toList_0(map(sortedWith_0(map(sortedWith_0(map(asSequence(get_indices(rings)), SamplingUtil$calculateRingLimits$lambda(rings)), reversed(new Comparator(compareBy$lambda_0(SamplingUtil$calculateRingLimits$lambda_0(this))))), SamplingUtil$calculateRingLimits$lambda_1(totalArea, areaProceed, totalPointsLimit, pointsProceed, rings, this)), new Comparator(compareBy$lambda_0(SamplingUtil$calculateRingLimits$lambda_2(this)))), SamplingUtil$calculateRingLimits$lambda_3(this)));\n };\n SamplingUtil.prototype.getRingIndex_3gcxfl$ = function (pair) {\n return pair.first;\n };\n SamplingUtil.prototype.getRingArea_0 = function (pair) {\n return pair.second;\n };\n SamplingUtil.prototype.getRingLimit_66os8t$ = function (pair) {\n return pair.second;\n };\n SamplingUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'SamplingUtil',\n interfaces: []\n };\n var SamplingUtil_instance = null;\n function SamplingUtil_getInstance() {\n if (SamplingUtil_instance === null) {\n new SamplingUtil();\n }return SamplingUtil_instance;\n }\n function SystematicSampling(sampleSize) {\n SystematicSampling$Companion_getInstance();\n SamplingBase.call(this, sampleSize);\n }\n Object.defineProperty(SystematicSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + SystematicSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + ')';\n }\n });\n SystematicSampling.prototype.isApplicable_dhhkv7$ = function (population) {\n return SamplingBase.prototype.isApplicable_dhhkv7$.call(this, population) && this.computeStep_0(population.rowCount()) >= 2;\n };\n SystematicSampling.prototype.apply_dhhkv7$ = function (population) {\n if (!this.isApplicable_dhhkv7$(population)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var popSize = population.rowCount();\n var step = this.computeStep_0(popSize);\n var pickedIndices = ArrayList_init();\n var i = 0;\n while (i < popSize) {\n pickedIndices.add_11rb$(i);\n i = i + step | 0;\n }\n return population.selectIndices_pqoyrt$(pickedIndices);\n };\n SystematicSampling.prototype.computeStep_0 = function (popSize) {\n return numberToInt(round(popSize / (this.sampleSize - 1 | 0)));\n };\n function SystematicSampling$Companion() {\n SystematicSampling$Companion_instance = this;\n this.ALIAS = 'systematic';\n }\n SystematicSampling$Companion.prototype.computeStep_vux9f0$ = function (popSize, sampleSize) {\n return numberToInt(round((popSize - 1 | 0) / (sampleSize - 1 | 0)));\n };\n SystematicSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SystematicSampling$Companion_instance = null;\n function SystematicSampling$Companion_getInstance() {\n if (SystematicSampling$Companion_instance === null) {\n new SystematicSampling$Companion();\n }return SystematicSampling$Companion_instance;\n }\n SystematicSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SystematicSampling',\n interfaces: [PointSampling, SamplingBase]\n };\n function VertexSampling(sampleSize) {\n VertexSampling$Companion_getInstance();\n SamplingBase.call(this, sampleSize);\n }\n VertexSampling.prototype.simplify_0 = function (points, limit) {\n var tmp$;\n if (limit === 0) {\n tmp$ = emptyList();\n } else {\n tmp$ = this.simplifyInternal_11hmxm$(points, limit);\n }\n return tmp$;\n };\n VertexSampling.prototype.apply_dhhkv7$ = function (population) {\n if (!this.isApplicable_dhhkv7$(population)) {\n var message = 'Failed requirement.';\n throw IllegalArgumentException_init(message.toString());\n }var rings = SamplingUtil_getInstance().splitRings_dhhkv7$(population);\n var limits = rings.size === 1 && !isClosed(rings.get_za3lpa$(0)) ? listOf(this.sampleSize) : SamplingUtil_getInstance().calculateRingLimits_rmr3bv$(rings, this.sampleSize);\n var indices = ArrayList_init();\n var ringBase = new MutableInteger(0);\n var $receiver = until(0, limits.size);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(new Pair(item, limits.get_za3lpa$(item)));\n }\n var tmp$_0;\n tmp$_0 = destination.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var tmp$_1;\n tmp$_1 = this.simplify_0(rings.get_za3lpa$(SamplingUtil_getInstance().getRingIndex_3gcxfl$(element)), SamplingUtil_getInstance().getRingLimit_66os8t$(element)).iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n indices.add_11rb$(ringBase.get() + element_0 | 0);\n }\n ringBase.getAndAdd_za3lpa$(rings.get_za3lpa$(SamplingUtil_getInstance().getRingIndex_3gcxfl$(element)).size);\n }\n return population.selectIndices_pqoyrt$(indices);\n };\n function VertexSampling$VertexVwSampling(sampleSize) {\n VertexSampling$VertexVwSampling$Companion_getInstance();\n VertexSampling.call(this, sampleSize);\n }\n Object.defineProperty(VertexSampling$VertexVwSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + VertexSampling$VertexVwSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + ')';\n }\n });\n VertexSampling$VertexVwSampling.prototype.simplifyInternal_11hmxm$ = function (points, limit) {\n return PolylineSimplifier.Companion.visvalingamWhyatt_ytws2g$(points).setCountLimit_za3lpa$(limit).indices;\n };\n function VertexSampling$VertexVwSampling$Companion() {\n VertexSampling$VertexVwSampling$Companion_instance = this;\n this.ALIAS = 'vertex_vw';\n }\n VertexSampling$VertexVwSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var VertexSampling$VertexVwSampling$Companion_instance = null;\n function VertexSampling$VertexVwSampling$Companion_getInstance() {\n if (VertexSampling$VertexVwSampling$Companion_instance === null) {\n new VertexSampling$VertexVwSampling$Companion();\n }return VertexSampling$VertexVwSampling$Companion_instance;\n }\n VertexSampling$VertexVwSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VertexVwSampling',\n interfaces: [VertexSampling]\n };\n function VertexSampling$VertexDpSampling(sampleSize) {\n VertexSampling$VertexDpSampling$Companion_getInstance();\n VertexSampling.call(this, sampleSize);\n }\n Object.defineProperty(VertexSampling$VertexDpSampling.prototype, 'expressionText', {\n configurable: true,\n get: function () {\n return 'sampling_' + VertexSampling$VertexDpSampling$Companion_getInstance().ALIAS + '(' + 'n=' + toString(this.sampleSize) + ')';\n }\n });\n VertexSampling$VertexDpSampling.prototype.simplifyInternal_11hmxm$ = function (points, limit) {\n return PolylineSimplifier.Companion.douglasPeucker_ytws2g$(points).setCountLimit_za3lpa$(limit).indices;\n };\n function VertexSampling$VertexDpSampling$Companion() {\n VertexSampling$VertexDpSampling$Companion_instance = this;\n this.ALIAS = 'vertex_dp';\n }\n VertexSampling$VertexDpSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var VertexSampling$VertexDpSampling$Companion_instance = null;\n function VertexSampling$VertexDpSampling$Companion_getInstance() {\n if (VertexSampling$VertexDpSampling$Companion_instance === null) {\n new VertexSampling$VertexDpSampling$Companion();\n }return VertexSampling$VertexDpSampling$Companion_instance;\n }\n VertexSampling$VertexDpSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VertexDpSampling',\n interfaces: [VertexSampling]\n };\n function VertexSampling$DoubleVectorComponentsList(myXValues, myYValues) {\n AbstractList.call(this);\n this.myXValues_0 = myXValues;\n this.myYValues_0 = myYValues;\n }\n Object.defineProperty(VertexSampling$DoubleVectorComponentsList.prototype, 'size', {\n configurable: true,\n get: function () {\n return this.myXValues_0.size;\n }\n });\n VertexSampling$DoubleVectorComponentsList.prototype.get_za3lpa$ = function (index) {\n return VertexSampling$Companion_getInstance().createPoint_0(this.myXValues_0.get_za3lpa$(index), this.myYValues_0.get_za3lpa$(index));\n };\n VertexSampling$DoubleVectorComponentsList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DoubleVectorComponentsList',\n interfaces: [AbstractList]\n };\n function VertexSampling$Companion() {\n VertexSampling$Companion_instance = this;\n }\n VertexSampling$Companion.prototype.createPoint_0 = function (x, y) {\n var tmp$, tmp$_0;\n if (!!(typeof x === 'string' || typeof y === 'string')) {\n var message = 'String coords are not supported yet';\n throw IllegalArgumentException_init(message.toString());\n }if (!data_0.SeriesUtil.allFinite_jma9l8$(typeof (tmp$ = x) === 'number' ? tmp$ : throwCCE(), typeof (tmp$_0 = y) === 'number' ? tmp$_0 : throwCCE())) {\n var message_0 = 'Invalid coord';\n throw IllegalArgumentException_init(message_0.toString());\n }return new DoubleVector(x, y);\n };\n VertexSampling$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var VertexSampling$Companion_instance = null;\n function VertexSampling$Companion_getInstance() {\n if (VertexSampling$Companion_instance === null) {\n new VertexSampling$Companion();\n }return VertexSampling$Companion_instance;\n }\n VertexSampling.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VertexSampling',\n interfaces: [PointSampling, SamplingBase]\n };\n function ContinuousOnlyMapperProvider(naValue) {\n MapperProviderBase.call(this, naValue);\n }\n function ContinuousOnlyMapperProvider$createDiscreteMapper$lambda(it) {\n return \"'\" + toString(it) + \"'\";\n }\n ContinuousOnlyMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n var domainRepr = joinToString(domainValues, void 0, void 0, void 0, 3, void 0, ContinuousOnlyMapperProvider$createDiscreteMapper$lambda);\n throw IllegalStateException_init('[' + toString(Kotlin.getKClassFromExpression(this).simpleName) + \"] Can't create mapper for discrete domain: \" + domainRepr);\n };\n ContinuousOnlyMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ContinuousOnlyMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function DefaultMapperProvider() {\n DefaultMapperProvider_instance = this;\n this.PROVIDER_MAP_0 = new DefaultMapperProvider$TypedMapperProviderMap();\n }\n DefaultMapperProvider.prototype.get_31786j$ = function (aes) {\n return this.PROVIDER_MAP_0.get_lkzxyg$(aes);\n };\n DefaultMapperProvider.prototype.hasDefault_5adj56$ = function (aes) {\n return this.PROVIDER_MAP_0.containsKey_5adj56$(aes);\n };\n function DefaultMapperProvider$TypedMapperProviderMap() {\n DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance();\n this.myMap_0 = HashMap_init();\n var tmp$;\n tmp$ = Aes.Companion.allPositional().iterator();\n while (tmp$.hasNext()) {\n var aes = tmp$.next();\n this.put_0(aes, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_UNDEFINED_0);\n }\n this.put_0(Aes.Companion.X, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.Y, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.Z, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.YMIN, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.YMAX, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.COLOR, DefaultMapperProviderUtil_getInstance().createColorMapperProvider_8be2vx$());\n this.put_0(Aes.Companion.FILL, DefaultMapperProviderUtil_getInstance().createColorMapperProvider_8be2vx$());\n this.put_0(Aes.Companion.ALPHA, AlphaMapperProvider$Companion_getInstance().DEFAULT);\n this.put_0(Aes.Companion.SHAPE, DefaultMapperProviderUtil_getInstance().createWithDiscreteOutput_rath1t$(ShapeMapper_getInstance().allShapes(), ShapeMapper_getInstance().NA_VALUE));\n this.put_0(Aes.Companion.LINETYPE, DefaultMapperProviderUtil_getInstance().createWithDiscreteOutput_rath1t$(LineTypeMapper_getInstance().allLineTypes(), LineTypeMapper_getInstance().NA_VALUE));\n this.put_0(Aes.Companion.SIZE, SizeMapperProvider$Companion_getInstance().DEFAULT);\n this.put_0(Aes.Companion.WIDTH, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.HEIGHT, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.WEIGHT, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.INTERCEPT, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.SLOPE, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.XINTERCEPT, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.YINTERCEPT, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.LOWER, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.MIDDLE, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.UPPER, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.FRAME, DefaultMapperProviderUtil_getInstance().createStringIdentity_kc1el2$(Aes.Companion.FRAME));\n this.put_0(Aes.Companion.SPEED, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.FLOW, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.XMIN, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.XMAX, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.XEND, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.YEND, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.LABEL, DefaultMapperProviderUtil_getInstance().createObjectIdentity_bv5adw$(Aes.Companion.LABEL));\n this.put_0(Aes.Companion.FAMILY, DefaultMapperProviderUtil_getInstance().createStringIdentity_kc1el2$(Aes.Companion.FAMILY));\n this.put_0(Aes.Companion.FONTFACE, DefaultMapperProviderUtil_getInstance().createStringIdentity_kc1el2$(Aes.Companion.FONTFACE));\n this.put_0(Aes.Companion.HJUST, DefaultMapperProviderUtil_getInstance().createObjectIdentityDiscrete_e4pcbt$(Aes.Companion.HJUST));\n this.put_0(Aes.Companion.VJUST, DefaultMapperProviderUtil_getInstance().createObjectIdentityDiscrete_e4pcbt$(Aes.Companion.VJUST));\n this.put_0(Aes.Companion.ANGLE, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.SYM_X, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n this.put_0(Aes.Companion.SYM_Y, DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance().NUMERIC_IDENTITY_0);\n }\n DefaultMapperProvider$TypedMapperProviderMap.prototype.get_lkzxyg$ = function (aes) {\n var tmp$;\n return Kotlin.isType(tmp$ = this.myMap_0.get_11rb$(aes), MapperProvider) ? tmp$ : throwCCE();\n };\n DefaultMapperProvider$TypedMapperProviderMap.prototype.put_0 = function (aes, value) {\n this.myMap_0.put_xwzc9p$(aes, value);\n };\n DefaultMapperProvider$TypedMapperProviderMap.prototype.containsKey_5adj56$ = function (aes) {\n return this.myMap_0.containsKey_11rb$(aes);\n };\n function DefaultMapperProvider$TypedMapperProviderMap$Companion() {\n DefaultMapperProvider$TypedMapperProviderMap$Companion_instance = this;\n this.NUMERIC_UNDEFINED_0 = new DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_UNDEFINED$ObjectLiteral();\n this.NUMERIC_IDENTITY_0 = new DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_IDENTITY$ObjectLiteral();\n }\n function DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_UNDEFINED$ObjectLiteral() {\n }\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_UNDEFINED$ObjectLiteral.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return GuideMappers_getInstance().UNDEFINED;\n };\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_UNDEFINED$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return GuideMappers_getInstance().UNDEFINED;\n };\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_UNDEFINED$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [MapperProvider]\n };\n function DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_IDENTITY$ObjectLiteral() {\n }\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_IDENTITY$ObjectLiteral.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return GuideMappers_getInstance().IDENTITY;\n };\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_IDENTITY$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return GuideMappers_getInstance().IDENTITY;\n };\n DefaultMapperProvider$TypedMapperProviderMap$Companion$NUMERIC_IDENTITY$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [MapperProvider]\n };\n DefaultMapperProvider$TypedMapperProviderMap$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DefaultMapperProvider$TypedMapperProviderMap$Companion_instance = null;\n function DefaultMapperProvider$TypedMapperProviderMap$Companion_getInstance() {\n if (DefaultMapperProvider$TypedMapperProviderMap$Companion_instance === null) {\n new DefaultMapperProvider$TypedMapperProviderMap$Companion();\n }return DefaultMapperProvider$TypedMapperProviderMap$Companion_instance;\n }\n DefaultMapperProvider$TypedMapperProviderMap.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TypedMapperProviderMap',\n interfaces: []\n };\n DefaultMapperProvider.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DefaultMapperProvider',\n interfaces: []\n };\n var DefaultMapperProvider_instance = null;\n function DefaultMapperProvider_getInstance() {\n if (DefaultMapperProvider_instance === null) {\n new DefaultMapperProvider();\n }return DefaultMapperProvider_instance;\n }\n function DefaultMapperProviderUtil() {\n DefaultMapperProviderUtil_instance = this;\n }\n function DefaultMapperProviderUtil$createColorMapperProvider$ObjectLiteral(closure$discrete, closure$continuous) {\n this.closure$discrete = closure$discrete;\n this.closure$continuous = closure$continuous;\n }\n DefaultMapperProviderUtil$createColorMapperProvider$ObjectLiteral.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return this.closure$discrete.createDiscreteMapper_7f6uoc$(domainValues);\n };\n DefaultMapperProviderUtil$createColorMapperProvider$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return this.closure$continuous.createContinuousMapper_1g0x2p$(domain, lowerLimit, upperLimit, trans);\n };\n DefaultMapperProviderUtil$createColorMapperProvider$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [MapperProvider]\n };\n DefaultMapperProviderUtil.prototype.createColorMapperProvider_8be2vx$ = function () {\n var discrete = new ColorBrewerMapperProvider(null, null, null, Color.Companion.GRAY);\n var continuous = ColorGradientMapperProvider$Companion_getInstance().DEFAULT;\n return new DefaultMapperProviderUtil$createColorMapperProvider$ObjectLiteral(discrete, continuous);\n };\n function DefaultMapperProviderUtil$createWithDiscreteOutput$ObjectLiteral(closure$outputValues, closure$naValue) {\n this.closure$outputValues = closure$outputValues;\n this.closure$naValue = closure$naValue;\n }\n DefaultMapperProviderUtil$createWithDiscreteOutput$ObjectLiteral.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return GuideMappers_getInstance().discreteToDiscrete_pkbp8v$(domainValues, this.closure$outputValues, this.closure$naValue);\n };\n DefaultMapperProviderUtil$createWithDiscreteOutput$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return GuideMappers_getInstance().continuousToDiscrete_fooeq8$(scale.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(domain, lowerLimit, upperLimit, trans), this.closure$outputValues, this.closure$naValue);\n };\n DefaultMapperProviderUtil$createWithDiscreteOutput$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [MapperProvider]\n };\n DefaultMapperProviderUtil.prototype.createWithDiscreteOutput_rath1t$ = function (outputValues, naValue) {\n return new DefaultMapperProviderUtil$createWithDiscreteOutput$ObjectLiteral(outputValues, naValue);\n };\n function DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral(inputConverter, naValue) {\n IdentityDiscreteMapperProvider.call(this, inputConverter, naValue);\n }\n function DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral$createContinuousMapper$lambda(it) {\n return it;\n }\n DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return GuideMappers_getInstance().asContinuous_rjdepr$(DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral$createContinuousMapper$lambda);\n };\n DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [IdentityDiscreteMapperProvider]\n };\n function DefaultMapperProviderUtil$createObjectIdentity$DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral_init$lambda(it) {\n return it;\n }\n DefaultMapperProviderUtil.prototype.createObjectIdentity_bv5adw$ = function (aes) {\n return new DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral(DefaultMapperProviderUtil$createObjectIdentity$DefaultMapperProviderUtil$createObjectIdentity$ObjectLiteral_init$lambda, null);\n };\n function DefaultMapperProviderUtil$createObjectIdentityDiscrete$lambda(it) {\n return it;\n }\n DefaultMapperProviderUtil.prototype.createObjectIdentityDiscrete_e4pcbt$ = function (aes) {\n var converter = DefaultMapperProviderUtil$createObjectIdentityDiscrete$lambda;\n return this.createIdentityMapperProvider_0(aes, converter, null);\n };\n function DefaultMapperProviderUtil$createStringIdentity$lambda(it) {\n return it != null ? it.toString() : null;\n }\n function DefaultMapperProviderUtil$createStringIdentity$lambda_0(it) {\n return it != null ? it.toString() : null;\n }\n DefaultMapperProviderUtil.prototype.createStringIdentity_kc1el2$ = function (aes) {\n var converter = DefaultMapperProviderUtil$createStringIdentity$lambda;\n var continuousMapper = DefaultMapperProviderUtil$createStringIdentity$lambda_0;\n return this.createIdentityMapperProvider_0(aes, converter, continuousMapper);\n };\n function DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral(closure$continuousMapper, closure$aes, inputConverter, naValue) {\n this.closure$continuousMapper = closure$continuousMapper;\n this.closure$aes = closure$aes;\n IdentityDiscreteMapperProvider.call(this, inputConverter, naValue);\n }\n DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n if (this.closure$continuousMapper != null) {\n return GuideMappers_getInstance().asContinuous_rjdepr$(this.closure$continuousMapper);\n }throw IllegalStateException_init(\"Can't create \" + this.closure$aes + ' mapper for continuous domain ' + domain);\n };\n DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [IdentityDiscreteMapperProvider]\n };\n DefaultMapperProviderUtil.prototype.createIdentityMapperProvider_0 = function (aes, converter, continuousMapper) {\n return new DefaultMapperProviderUtil$createIdentityMapperProvider$ObjectLiteral(continuousMapper, aes, converter, DefaultNaValue_getInstance().get_31786j$(aes));\n };\n DefaultMapperProviderUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DefaultMapperProviderUtil',\n interfaces: []\n };\n var DefaultMapperProviderUtil_instance = null;\n function DefaultMapperProviderUtil_getInstance() {\n if (DefaultMapperProviderUtil_instance === null) {\n new DefaultMapperProviderUtil();\n }return DefaultMapperProviderUtil_instance;\n }\n function DefaultNaValue() {\n DefaultNaValue_instance = this;\n this.VALUE_MAP_0 = new TypedKeyHashMap();\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.X, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.Y, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.Z, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.YMIN, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.YMAX, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.COLOR, Color.Companion.GRAY);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.FILL, Color.Companion.GRAY);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.ALPHA, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SHAPE, point.TinyPointShape);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.LINETYPE, NamedLineType.SOLID);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SIZE, aes.AesScaling.sizeFromCircleDiameter_14dthe$(1.0));\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.WIDTH, 1.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.HEIGHT, 1.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.WEIGHT, 1.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.INTERCEPT, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SLOPE, 1.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.XINTERCEPT, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.YINTERCEPT, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.LOWER, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.MIDDLE, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.UPPER, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.FRAME, 'empty frame');\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SPEED, 10.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.FLOW, 0.1);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.XMIN, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.XMAX, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.XEND, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.YEND, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.LABEL, '-');\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.FAMILY, 'sans-serif');\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.FONTFACE, 'plain');\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.HJUST, 0.5);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.VJUST, 0.5);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.ANGLE, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SYM_X, 0.0);\n this.VALUE_MAP_0.put_ev6mlr$(Aes.Companion.SYM_Y, 0.0);\n }\n DefaultNaValue.prototype.has_896ixz$ = function (aes) {\n return this.VALUE_MAP_0.containsKey_ex36zt$(aes);\n };\n DefaultNaValue.prototype.get_31786j$ = function (aes) {\n return this.VALUE_MAP_0.get_ex36zt$(aes);\n };\n DefaultNaValue.prototype.get_ex36zt$ = function (aes) {\n return this.VALUE_MAP_0.get_ex36zt$(aes);\n };\n DefaultNaValue.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DefaultNaValue',\n interfaces: []\n };\n var DefaultNaValue_instance = null;\n function DefaultNaValue_getInstance() {\n if (DefaultNaValue_instance === null) {\n new DefaultNaValue();\n }return DefaultNaValue_instance;\n }\n function DiscreteOnlyMapperProvider(naValue) {\n MapperProviderBase.call(this, naValue);\n }\n DiscreteOnlyMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n throw IllegalStateException_init('[' + toString(Kotlin.getKClassFromExpression(this).simpleName) + \"] Can't create mapper for continuous domain \" + domain);\n };\n DiscreteOnlyMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DiscreteOnlyMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function GuideMapper() {\n }\n GuideMapper.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'GuideMapper',\n interfaces: [Function]\n };\n function MapperProvider() {\n }\n MapperProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'MapperProvider',\n interfaces: []\n };\n function ScaleProvider() {\n }\n ScaleProvider.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ScaleProvider',\n interfaces: []\n };\n function ScaleProviderBuilder(aes) {\n this.aes_0 = aes;\n this._mapperProvider_0 = null;\n this.myName_0 = null;\n this.myBreaks_0 = null;\n this.myLabels_0 = null;\n this.myLabelFormat_0 = null;\n this.myMultiplicativeExpand_0 = null;\n this.myAdditiveExpand_0 = null;\n this.myLimits_0 = null;\n this.myContinuousTransform_0 = transform.Transforms.IDENTITY;\n this.myBreaksGenerator_0 = null;\n this.myDiscreteDomain_0 = false;\n this.myDiscreteDomainReverse_0 = false;\n }\n Object.defineProperty(ScaleProviderBuilder.prototype, 'mapperProvider', {\n configurable: true,\n get: function () {\n var tmp$;\n if (this._mapperProvider_0 == null) {\n this._mapperProvider_0 = DefaultMapperProvider_getInstance().get_31786j$(this.aes_0);\n }tmp$ = this._mapperProvider_0;\n if (tmp$ == null) {\n throw AssertionError_init('Set to null by another thread');\n }return tmp$;\n },\n set: function (p) {\n this._mapperProvider_0 = p;\n }\n });\n ScaleProviderBuilder.prototype.mapperProvider_dw300d$ = function (mapperProvider) {\n this.mapperProvider = mapperProvider;\n return this;\n };\n ScaleProviderBuilder.prototype.name_61zpoe$ = function (name) {\n this.myName_0 = name;\n return this;\n };\n ScaleProviderBuilder.prototype.breaks_pqjuzw$ = function (breaks) {\n this.myBreaks_0 = breaks;\n return this;\n };\n ScaleProviderBuilder.prototype.minorBreaks_NI_d3e2cz$ = function (minorBreaks) {\n throw IllegalStateException_init('Not implemented');\n };\n ScaleProviderBuilder.prototype.labels_mhpeer$ = function (labels) {\n this.myLabels_0 = ArrayList_init_1(labels);\n return this;\n };\n ScaleProviderBuilder.prototype.labelFormat_pdl1vj$ = function (format) {\n this.myLabelFormat_0 = format;\n return this;\n };\n ScaleProviderBuilder.prototype.multiplicativeExpand_14dthe$ = function (v) {\n this.myMultiplicativeExpand_0 = v;\n return this;\n };\n ScaleProviderBuilder.prototype.additiveExpand_14dthe$ = function (v) {\n this.myAdditiveExpand_0 = v;\n return this;\n };\n ScaleProviderBuilder.prototype.limits_9ma18$ = function (v) {\n this.myLimits_0 = v;\n return this;\n };\n ScaleProviderBuilder.prototype.rescaler_NI_za3rmp$ = function (v) {\n throw IllegalStateException_init('Not implemented');\n };\n ScaleProviderBuilder.prototype.oob_NI_za3rmp$ = function (v) {\n throw IllegalStateException_init('Not implemented');\n };\n ScaleProviderBuilder.prototype.continuousTransform_gxz7zd$ = function (v) {\n this.myContinuousTransform_0 = v;\n return this;\n };\n ScaleProviderBuilder.prototype.breaksGenerator_6q5k0b$ = function (v) {\n this.myBreaksGenerator_0 = v;\n return this;\n };\n ScaleProviderBuilder.prototype.guide_NI_za3rmp$ = function (v) {\n throw IllegalStateException_init('Not implemented');\n };\n ScaleProviderBuilder.prototype.discreteDomain_6taknv$ = function (b) {\n this.myDiscreteDomain_0 = b;\n return this;\n };\n ScaleProviderBuilder.prototype.discreteDomainReverse_6taknv$ = function (b) {\n this.myDiscreteDomainReverse_0 = b;\n return this;\n };\n ScaleProviderBuilder.prototype.build = function () {\n return new ScaleProviderBuilder$MyScaleProvider(this);\n };\n function ScaleProviderBuilder$MyScaleProvider(b) {\n this.myName_0 = b.myName_0;\n var tmp$, tmp$_0, tmp$_1;\n this.myLabels_0 = (tmp$ = b.myLabels_0) != null ? ArrayList_init_1(tmp$) : null;\n this.myLabelFormat_0 = b.myLabelFormat_0;\n this.myMultiplicativeExpand_0 = b.myMultiplicativeExpand_0;\n this.myAdditiveExpand_0 = b.myAdditiveExpand_0;\n this.discreteDomainReverse_0 = b.myDiscreteDomainReverse_0;\n this.myBreaksGenerator_0 = b.myBreaksGenerator_0;\n this.myAes_0 = b.aes_0;\n this.discreteDomain_sylt8i$_0 = b.myDiscreteDomain_0;\n this.mapperProvider_yqrzmx$_0 = b.mapperProvider;\n this.breaks_h22v6v$_0 = (tmp$_0 = b.myBreaks_0) != null ? ArrayList_init_1(tmp$_0) : null;\n this.limits_hmyn8j$_0 = (tmp$_1 = b.myLimits_0) != null ? ArrayList_init_1(tmp$_1) : null;\n this.continuousTransform_hc6st8$_0 = b.myContinuousTransform_0;\n }\n Object.defineProperty(ScaleProviderBuilder$MyScaleProvider.prototype, 'discreteDomain', {\n configurable: true,\n get: function () {\n return this.discreteDomain_sylt8i$_0;\n }\n });\n Object.defineProperty(ScaleProviderBuilder$MyScaleProvider.prototype, 'mapperProvider', {\n configurable: true,\n get: function () {\n return this.mapperProvider_yqrzmx$_0;\n }\n });\n Object.defineProperty(ScaleProviderBuilder$MyScaleProvider.prototype, 'breaks', {\n configurable: true,\n get: function () {\n return this.breaks_h22v6v$_0;\n }\n });\n Object.defineProperty(ScaleProviderBuilder$MyScaleProvider.prototype, 'limits', {\n configurable: true,\n get: function () {\n return this.limits_hmyn8j$_0;\n }\n });\n Object.defineProperty(ScaleProviderBuilder$MyScaleProvider.prototype, 'continuousTransform', {\n configurable: true,\n get: function () {\n return this.continuousTransform_hc6st8$_0;\n }\n });\n ScaleProviderBuilder$MyScaleProvider.prototype.scaleName_0 = function (variable) {\n var tmp$;\n return (tmp$ = this.myName_0) != null ? tmp$ : variable.label;\n };\n ScaleProviderBuilder$MyScaleProvider.prototype.createScale_4d40sm$ = function (defaultName, discreteDomain) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n var name = (tmp$ = this.myName_0) != null ? tmp$ : defaultName;\n var scale_0;\n var domainValues = filterNotNull(discreteDomain);\n if (discreteDomain.isEmpty()) {\n tmp$_0 = this.absentMapper_0(defaultName);\n } else {\n tmp$_0 = getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_11rb$(p1);\n }.bind(null, this.mapperProvider.createDiscreteMapper_7f6uoc$(domainValues)));\n }\n var mapper = tmp$_0;\n if (this.discreteDomainReverse_0) {\n domainValues = reversed_0(domainValues);\n }scale_0 = scale.Scales.discreteDomain_l9mre7$(name, domainValues, mapper);\n var tmp$_3;\n if ((tmp$_2 = (tmp$_1 = this.limits) != null ? filterNotNull(tmp$_1) : null) != null) {\n var block$result;\n if (this.discreteDomainReverse_0) {\n block$result = reversed_0(tmp$_2);\n } else {\n block$result = tmp$_2;\n }\n tmp$_3 = block$result;\n } else\n tmp$_3 = null;\n var discreteLimits = tmp$_3;\n if (discreteLimits != null) {\n scale_0 = scale_0.with().limits_pqjuzw$(discreteLimits).build();\n }return this.completeScale_0(scale_0);\n };\n function ScaleProviderBuilder$MyScaleProvider$createScale$lambda(closure$mapper) {\n return function (v) {\n return closure$mapper.apply_11rb$(v);\n };\n }\n ScaleProviderBuilder$MyScaleProvider.prototype.createScale_phlls$ = function (defaultName, continuousDomain) {\n var tmp$, tmp$_0, tmp$_1;\n var name = (tmp$ = this.myName_0) != null ? tmp$ : defaultName;\n var scale_0;\n var dataRange = data_0.SeriesUtil.ensureApplicableRange_4am1sd$(continuousDomain);\n var lowerLimit = null;\n var upperLimit = null;\n if (this.limits != null) {\n var lower = true;\n tmp$_0 = this.limits.iterator();\n while (tmp$_0.hasNext()) {\n var limit = tmp$_0.next();\n if (Kotlin.isNumber(limit)) {\n var v = numberToDouble(limit);\n if (isFinite(v)) {\n if (lower) {\n lowerLimit = v;\n } else {\n upperLimit = v;\n }\n }}lower = false;\n }\n }var mapper = this.mapperProvider.createContinuousMapper_1g0x2p$(dataRange, lowerLimit, upperLimit, this.continuousTransform);\n var continuousRange = mapper.isContinuous || this.myAes_0.isNumeric;\n scale_0 = scale.Scales.continuousDomain_lo18em$(name, ScaleProviderBuilder$MyScaleProvider$createScale$lambda(mapper), continuousRange);\n if (Kotlin.isType(mapper, WithGuideBreaks)) {\n Kotlin.isType(tmp$_1 = mapper, WithGuideBreaks) ? tmp$_1 : throwCCE();\n scale_0 = scale_0.with().breaks_pqjuzw$(mapper.breaks).labelFormatter_h0j1qz$(mapper.formatter).build();\n }scale_0 = scale_0.with().continuousTransform_gxz7zd$(this.continuousTransform).build();\n if (this.myBreaksGenerator_0 != null) {\n scale_0 = scale_0.with().breaksGenerator_6q5k0b$(this.myBreaksGenerator_0).build();\n }if (this.limits != null) {\n var with_0 = scale_0.with();\n if (lowerLimit != null) {\n with_0.lowerLimit_14dthe$(lowerLimit);\n }if (upperLimit != null) {\n with_0.upperLimit_14dthe$(upperLimit);\n }scale_0 = with_0.build();\n }return this.completeScale_0(scale_0);\n };\n ScaleProviderBuilder$MyScaleProvider.prototype.completeScale_0 = function (scale) {\n var with_0 = scale.with();\n if (this.breaks != null) {\n with_0.breaks_pqjuzw$(this.breaks);\n }if (this.myLabels_0 != null) {\n with_0.labels_mhpeer$(this.myLabels_0);\n }if (this.myLabelFormat_0 != null) {\n with_0.labelFormatter_h0j1qz$(getCallableRef('format', function ($receiver, p1) {\n return $receiver.format_za3rmp$(p1);\n }.bind(null, StringFormat.Companion.create_w8bwfu$(this.myLabelFormat_0))));\n }if (this.myMultiplicativeExpand_0 != null) {\n with_0.multiplicativeExpand_14dthe$(this.myMultiplicativeExpand_0);\n }if (this.myAdditiveExpand_0 != null) {\n with_0.additiveExpand_14dthe$(this.myAdditiveExpand_0);\n }return with_0.build();\n };\n function ScaleProviderBuilder$MyScaleProvider$absentMapper$lambda(closure$var) {\n return function (v) {\n throw IllegalStateException_init(\"Mapper for empty data series '\" + closure$var.name + \"' was invoked with arg \" + toString(v));\n };\n }\n ScaleProviderBuilder$MyScaleProvider.prototype.absentMapper_1 = function (var_0) {\n return ScaleProviderBuilder$MyScaleProvider$absentMapper$lambda(var_0);\n };\n function ScaleProviderBuilder$MyScaleProvider$absentMapper$lambda_0(closure$label) {\n return function (v) {\n throw IllegalStateException_init(\"Mapper for empty data series '\" + closure$label + \"' was invoked with arg \" + toString(v));\n };\n }\n ScaleProviderBuilder$MyScaleProvider.prototype.absentMapper_0 = function (label) {\n return ScaleProviderBuilder$MyScaleProvider$absentMapper$lambda_0(label);\n };\n ScaleProviderBuilder$MyScaleProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyScaleProvider',\n interfaces: [ScaleProvider]\n };\n ScaleProviderBuilder.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ScaleProviderBuilder',\n interfaces: []\n };\n function ScaleProviderHelper() {\n ScaleProviderHelper_instance = this;\n }\n ScaleProviderHelper.prototype.getOrCreateDefault_w8zkza$ = function (aes, providers) {\n var tmp$, tmp$_0;\n if (Aes.Companion.isPositionalX_896ixz$(aes))\n tmp$ = Aes.Companion.X;\n else if (Aes.Companion.isPositionalY_896ixz$(aes))\n tmp$ = Aes.Companion.Y;\n else\n tmp$ = aes;\n var realAes = tmp$;\n return (tmp$_0 = providers.get_11rb$(realAes)) != null ? tmp$_0 : this.createDefault_31786j$(realAes);\n };\n ScaleProviderHelper.prototype.createDefault_31786j$ = function (aes) {\n return (new ScaleProviderBuilder(aes)).build();\n };\n ScaleProviderHelper.prototype.createDefault_1va84n$ = function (aes, name) {\n return (new ScaleProviderBuilder(aes)).name_61zpoe$(name).build();\n };\n ScaleProviderHelper.prototype.create_bqnakv$ = function (name, aes, mapperProvider) {\n return (new ScaleProviderBuilder(aes)).mapperProvider_dw300d$(mapperProvider).name_61zpoe$(name).build();\n };\n ScaleProviderHelper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ScaleProviderHelper',\n interfaces: []\n };\n var ScaleProviderHelper_instance = null;\n function ScaleProviderHelper_getInstance() {\n if (ScaleProviderHelper_instance === null) {\n new ScaleProviderHelper();\n }return ScaleProviderHelper_instance;\n }\n function WithGuideBreaks() {\n }\n WithGuideBreaks.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'WithGuideBreaks',\n interfaces: []\n };\n function ColorMapper() {\n ColorMapper_instance = this;\n this.NA_VALUE = Color.Companion.GRAY;\n this.DEF_GRADIENT_LOW = Color.Companion.parseHex_61zpoe$('#132B43');\n this.DEF_GRADIENT_HIGH = Color.Companion.parseHex_61zpoe$('#56B1F7');\n }\n ColorMapper.prototype.gradientDefault_4fzjta$ = function (domain) {\n return this.gradient_e4qimg$(domain, this.DEF_GRADIENT_LOW, this.DEF_GRADIENT_HIGH, this.NA_VALUE);\n };\n ColorMapper.prototype.gradient_e4qimg$ = function (domain, low, high, naColor) {\n return this.gradientHSV_kw8gff$(domain, values.Colors.hsvFromRgb_98b62m$(low), values.Colors.hsvFromRgb_98b62m$(high), true, naColor);\n };\n ColorMapper.prototype.gradientHSV_kw8gff$ = function (domain, lowHSV, highHSV, autoHueDirection, naColor) {\n return this.gradientHSV_cr3zp$(domain, new HSV(lowHSV[0], lowHSV[1], lowHSV[2]), new HSV(highHSV[0], highHSV[1], highHSV[2]), autoHueDirection, naColor);\n };\n function ColorMapper$gradientHSV$lambda(closure$domain, closure$naColor, closure$mapperH, closure$mapperS, closure$mapperV) {\n return function (input) {\n if (input == null || !closure$domain.contains_mef7kx$(input)) {\n return closure$naColor;\n } else {\n var hue = closure$mapperH(input) % 360;\n var H = hue >= 0 ? hue : 360 + hue;\n var S = closure$mapperS(input);\n var V = closure$mapperV(input);\n return values.Colors.rgbFromHsv_yvo9jy$(H, S, V);\n }\n };\n }\n ColorMapper.prototype.gradientHSV_cr3zp$ = function (domain, lowHSV, highHSV, autoHueDirection, naColor) {\n var lowHue = lowHSV.h;\n var highHue = highHSV.h;\n var lowS = lowHSV.s;\n var highS = highHSV.s;\n if (lowS < 1.0E-4) {\n lowHue = highHue;\n }if (highS < 1.0E-4) {\n highHue = lowHue;\n }if (autoHueDirection) {\n var x = highHue - lowHue;\n var dH = JsMath.abs(x);\n if (dH > 180) {\n if (highHue >= lowHue) {\n lowHue += 360.0;\n } else {\n highHue += 360.0;\n }\n }}var mapperH = scale.Mappers.linear_yl4mmw$(domain, lowHue, highHue, kotlin_js_internal_DoubleCompanionObject.NaN);\n var mapperS = scale.Mappers.linear_yl4mmw$(domain, lowS, highS, kotlin_js_internal_DoubleCompanionObject.NaN);\n var mapperV = scale.Mappers.linear_yl4mmw$(domain, lowHSV.v, highHSV.v, kotlin_js_internal_DoubleCompanionObject.NaN);\n return ColorMapper$gradientHSV$lambda(domain, naColor, mapperH, mapperS, mapperV);\n };\n ColorMapper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ColorMapper',\n interfaces: []\n };\n var ColorMapper_instance = null;\n function ColorMapper_getInstance() {\n if (ColorMapper_instance === null) {\n new ColorMapper();\n }return ColorMapper_instance;\n }\n function GuideMapperAdapter(mapper, isContinuous) {\n this.mapper_0 = mapper;\n this.isContinuous_zgpeec$_0 = isContinuous;\n }\n Object.defineProperty(GuideMapperAdapter.prototype, 'isContinuous', {\n get: function () {\n return this.isContinuous_zgpeec$_0;\n }\n });\n GuideMapperAdapter.prototype.apply_11rb$ = function (value) {\n return this.mapper_0(value);\n };\n GuideMapperAdapter.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GuideMapperAdapter',\n interfaces: [GuideMapper]\n };\n function GuideMapperWithGuideBreaks(mapper, breaks, formatter) {\n this.mapper_0 = mapper;\n this.breaks_3tqv0$_0 = breaks;\n this.formatter_dkp6z6$_0 = formatter;\n this.isContinuous_jvxsgv$_0 = false;\n }\n Object.defineProperty(GuideMapperWithGuideBreaks.prototype, 'breaks', {\n get: function () {\n return this.breaks_3tqv0$_0;\n }\n });\n Object.defineProperty(GuideMapperWithGuideBreaks.prototype, 'formatter', {\n get: function () {\n return this.formatter_dkp6z6$_0;\n }\n });\n Object.defineProperty(GuideMapperWithGuideBreaks.prototype, 'isContinuous', {\n configurable: true,\n get: function () {\n return this.isContinuous_jvxsgv$_0;\n }\n });\n GuideMapperWithGuideBreaks.prototype.apply_11rb$ = function (value) {\n return this.mapper_0(value);\n };\n GuideMapperWithGuideBreaks.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GuideMapperWithGuideBreaks',\n interfaces: [WithGuideBreaks, GuideMapper]\n };\n function GuideMappers() {\n GuideMappers_instance = this;\n this.IDENTITY = new GuideMapperAdapter(scale.Mappers.IDENTITY, false);\n this.UNDEFINED = new GuideMapperAdapter(scale.Mappers.undefined_287e2$(), false);\n }\n GuideMappers.prototype.discreteToDiscrete_udkttt$ = function (data, variable, outputValues, naValue) {\n var domainValues = data.distinctValues_8xm3sj$(variable);\n return this.discreteToDiscrete_pkbp8v$(domainValues, outputValues, naValue);\n };\n function GuideMappers$discreteToDiscrete$lambda(v) {\n return v.toString();\n }\n GuideMappers.prototype.discreteToDiscrete_pkbp8v$ = function (domainValues, outputValues, naValue) {\n var mapper = scale.Mappers.discrete_rath1t$(outputValues, naValue);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = domainValues.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n if ((tmp$_0 = element) != null) {\n destination.add_11rb$(tmp$_0);\n }}\n return new GuideMapperWithGuideBreaks(mapper, destination, GuideMappers$discreteToDiscrete$lambda);\n };\n GuideMappers.prototype.continuousToDiscrete_fooeq8$ = function (domain, outputValues, naValue) {\n var mapper = scale.Mappers.quantized_hd8s0$(domain, outputValues, naValue);\n return this.asNotContinuous_rjdepr$(mapper);\n };\n function GuideMappers$discreteToContinuous$lambda(v) {\n return v.toString();\n }\n GuideMappers.prototype.discreteToContinuous_83ntpg$ = function (domainValues, outputRange, naValue) {\n var mapper = scale.Mappers.discreteToContinuous_83ntpg$(domainValues, outputRange, naValue);\n var destination = ArrayList_init();\n var tmp$;\n tmp$ = domainValues.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n var tmp$_0;\n if ((tmp$_0 = element) != null) {\n destination.add_11rb$(tmp$_0);\n }}\n return new GuideMapperWithGuideBreaks(mapper, destination, GuideMappers$discreteToContinuous$lambda);\n };\n GuideMappers.prototype.continuousToContinuous_lww37m$ = function (domain, range, naValue) {\n return this.asContinuous_rjdepr$(scale.Mappers.linear_lww37m$(domain, range, naValue));\n };\n GuideMappers.prototype.asNotContinuous_rjdepr$ = function (mapper) {\n return new GuideMapperAdapter(mapper, false);\n };\n GuideMappers.prototype.asContinuous_rjdepr$ = function (mapper) {\n return new GuideMapperAdapter(mapper, true);\n };\n GuideMappers.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'GuideMappers',\n interfaces: []\n };\n var GuideMappers_instance = null;\n function GuideMappers_getInstance() {\n if (GuideMappers_instance === null) {\n new GuideMappers();\n }return GuideMappers_instance;\n }\n function LineTypeMapper() {\n LineTypeMapper_instance = this;\n this.NA_VALUE = NamedLineType.SOLID;\n }\n LineTypeMapper.prototype.allLineTypes = function () {\n return listOf_0([NamedLineType.SOLID, NamedLineType.DASHED, NamedLineType.DOTTED, NamedLineType.DOTDASH, NamedLineType.LONGDASH, NamedLineType.TWODASH]);\n };\n LineTypeMapper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'LineTypeMapper',\n interfaces: []\n };\n var LineTypeMapper_instance = null;\n function LineTypeMapper_getInstance() {\n if (LineTypeMapper_instance === null) {\n new LineTypeMapper();\n }return LineTypeMapper_instance;\n }\n function ShapeMapper() {\n ShapeMapper_instance = this;\n this.NA_VALUE = point.TinyPointShape;\n }\n ShapeMapper.prototype.allShapes = function () {\n var bestSix = listOf_0([NamedShape.SOLID_CIRCLE, NamedShape.SOLID_TRIANGLE_UP, NamedShape.SOLID_SQUARE, NamedShape.STICK_PLUS, NamedShape.STICK_SQUARE_CROSS, NamedShape.STICK_STAR]);\n var theRest = LinkedHashSet_init_0(listOf_0(NamedShape$values().slice()));\n theRest.removeAll_brywnq$(bestSix);\n var shapes = ArrayList_init_1(bestSix);\n shapes.addAll_brywnq$(theRest);\n return shapes;\n };\n ShapeMapper.prototype.hollowShapes = function () {\n var tmp$;\n var bestThreeHollow = listOf_0([NamedShape.STICK_CIRCLE, NamedShape.STICK_TRIANGLE_UP, NamedShape.STICK_SQUARE]);\n var theRest = LinkedHashSet_init_0(listOf_0(NamedShape$values().slice()));\n theRest.removeAll_brywnq$(bestThreeHollow);\n var shapes = ArrayList_init_1(bestThreeHollow);\n tmp$ = theRest.iterator();\n while (tmp$.hasNext()) {\n var shape = tmp$.next();\n if (shape.isHollow) {\n shapes.add_11rb$(shape);\n }}\n return shapes;\n };\n ShapeMapper.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ShapeMapper',\n interfaces: []\n };\n var ShapeMapper_instance = null;\n function ShapeMapper_getInstance() {\n if (ShapeMapper_instance === null) {\n new ShapeMapper();\n }return ShapeMapper_instance;\n }\n function AlphaMapperProvider(range, naValue) {\n AlphaMapperProvider$Companion_getInstance();\n LinearNormalizingMapperProvider.call(this, range, naValue);\n }\n function AlphaMapperProvider$Companion() {\n AlphaMapperProvider$Companion_instance = this;\n this.DEF_RANGE_0 = new ClosedRange(0.1, 1.0);\n this.DEFAULT = new AlphaMapperProvider(this.DEF_RANGE_0, DefaultNaValue_getInstance().get_31786j$(Aes.Companion.ALPHA));\n }\n AlphaMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var AlphaMapperProvider$Companion_instance = null;\n function AlphaMapperProvider$Companion_getInstance() {\n if (AlphaMapperProvider$Companion_instance === null) {\n new AlphaMapperProvider$Companion();\n }return AlphaMapperProvider$Companion_instance;\n }\n AlphaMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'AlphaMapperProvider',\n interfaces: [LinearNormalizingMapperProvider]\n };\n function ColorBrewerMapperProvider(paletteTypeName, paletteNameOrIndex, direction, naValue) {\n ColorBrewerMapperProvider$Companion_getInstance();\n MapperProviderBase.call(this, naValue);\n this.paletteTypeName_0 = paletteTypeName;\n this.paletteNameOrIndex_0 = paletteNameOrIndex;\n this.direction_0 = direction;\n var tmp$;\n if (!((tmp$ = this.paletteNameOrIndex_0 != null ? typeof this.paletteNameOrIndex_0 === 'string' || Kotlin.isNumber(this.paletteNameOrIndex_0) : null) != null ? tmp$ : true)) {\n var message = ColorBrewerMapperProvider_init$lambda(this)();\n throw IllegalArgumentException_init(message.toString());\n }if (Kotlin.isNumber(this.paletteNameOrIndex_0)) {\n if (!(this.paletteTypeName_0 != null)) {\n var message_0 = \"brewer palette type required: 'seq', 'div' or 'qual'.\";\n throw IllegalArgumentException_init(message_0.toString());\n }}}\n ColorBrewerMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n var colorScheme = this.colorScheme_0(true, domainValues.size);\n var colors = this.colors_0(colorScheme, domainValues.size);\n return GuideMappers_getInstance().discreteToDiscrete_pkbp8v$(domainValues, colors, this.naValue);\n };\n ColorBrewerMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var colorScheme = this.colorScheme_0(false);\n var colors = this.colors_0(colorScheme, colorScheme.maxColors);\n var domain_0 = scale.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(domain, lowerLimit, upperLimit, trans);\n return GuideMappers_getInstance().continuousToDiscrete_fooeq8$(domain_0, colors, this.naValue);\n };\n ColorBrewerMapperProvider.prototype.colors_0 = function (colorScheme, count) {\n var tmp$, tmp$_0, tmp$_1;\n var colors = color.PaletteUtil.schemeColors_7q5c77$(colorScheme, count);\n tmp$_0 = (tmp$ = this.direction_0 != null ? this.direction_0 < 0 : null) != null ? tmp$ : false;\n if (tmp$_0 === true)\n tmp$_1 = collect.Lists.reverse_bemo1h$(colors);\n else if (tmp$_0 === false)\n tmp$_1 = colors;\n else\n tmp$_1 = Kotlin.noWhenBranchMatched();\n return tmp$_1;\n };\n ColorBrewerMapperProvider.prototype.colorScheme_0 = function (discrete, colorCount) {\n if (colorCount === void 0)\n colorCount = null;\n var tmp$, tmp$_0;\n if (typeof this.paletteNameOrIndex_0 === 'string') {\n var palType = color.PaletteUtil.paletteTypeByPaletteName_61zpoe$(this.paletteNameOrIndex_0);\n if (!(palType != null)) {\n var message = ColorBrewerMapperProvider$Companion_getInstance().cantFindPaletteError_0(this.paletteNameOrIndex_0);\n throw IllegalArgumentException_init(message.toString());\n }tmp$ = palType;\n } else if (this.paletteTypeName_0 != null)\n tmp$ = ColorBrewerMapperProvider$Companion_getInstance().paletteType_0(this.paletteTypeName_0);\n else if (discrete)\n tmp$ = ColorPalette$Type.QUALITATIVE;\n else\n tmp$ = ColorPalette$Type.SEQUENTIAL;\n var paletteType = tmp$;\n if (Kotlin.isNumber(this.paletteNameOrIndex_0))\n tmp$_0 = color.PaletteUtil.colorSchemeByIndex_vfydh1$(paletteType, numberToInt(this.paletteNameOrIndex_0));\n else if (typeof this.paletteNameOrIndex_0 === 'string')\n tmp$_0 = ColorBrewerMapperProvider$Companion_getInstance().colorSchemeByName_0(paletteType, this.paletteNameOrIndex_0);\n else if (paletteType === ColorPalette$Type.QUALITATIVE)\n tmp$_0 = colorCount != null && colorCount <= ColorPalette$Qualitative.Set2.maxColors ? ColorPalette$Qualitative.Set2 : ColorPalette$Qualitative.Set3;\n else\n tmp$_0 = color.PaletteUtil.colorSchemeByIndex_vfydh1$(paletteType, 0);\n return tmp$_0;\n };\n function ColorBrewerMapperProvider$Companion() {\n ColorBrewerMapperProvider$Companion_instance = this;\n }\n ColorBrewerMapperProvider$Companion.prototype.paletteType_0 = function (name) {\n var tmp$;\n if (name == null) {\n return ColorPalette$Type.SEQUENTIAL;\n }switch (name) {\n case 'seq':\n tmp$ = ColorPalette$Type.SEQUENTIAL;\n break;\n case 'div':\n tmp$ = ColorPalette$Type.DIVERGING;\n break;\n case 'qual':\n tmp$ = ColorPalette$Type.QUALITATIVE;\n break;\n default:throw IllegalArgumentException_init(\"Palette type expected one of 'seq' (sequential), 'div' (diverging) or 'qual' (qualitative) but was: '\" + toString(name) + \"'\");\n }\n return tmp$;\n };\n ColorBrewerMapperProvider$Companion.prototype.colorSchemeByName_0 = function (paletteType, paletteName) {\n var tmp$;\n try {\n switch (paletteType.name) {\n case 'SEQUENTIAL':\n tmp$ = ColorPalette$Sequential$valueOf(paletteName);\n break;\n case 'DIVERGING':\n tmp$ = ColorPalette$Diverging$valueOf(paletteName);\n break;\n case 'QUALITATIVE':\n tmp$ = ColorPalette$Qualitative$valueOf(paletteName);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n } catch (ignore) {\n if (Kotlin.isType(ignore, IllegalArgumentException)) {\n throw IllegalArgumentException_init(this.cantFindPaletteError_0(paletteName));\n } else\n throw ignore;\n }\n };\n ColorBrewerMapperProvider$Companion.prototype.cantFindPaletteError_0 = function (paletteName) {\n return trimMargin('\\n' + \" |Brewer palette '\" + paletteName + \"' was not found. \" + '\\n' + ' |Valid palette names are: ' + '\\n' + \" | Type 'seq' (sequential): \" + '\\n' + ' | ' + this.names_0(ColorPalette$Sequential$values()) + ' ' + '\\n' + \" | Type 'div' (diverging): \" + '\\n' + ' | ' + this.names_0(ColorPalette$Diverging$values()) + ' ' + '\\n' + \" | Type 'qual' (qualitative): \" + '\\n' + ' | ' + this.names_0(ColorPalette$Qualitative$values()) + ' ' + '\\n' + ' ');\n };\n function ColorBrewerMapperProvider$Companion$names$lambda(it) {\n return \"'\" + it.name + \"'\";\n }\n ColorBrewerMapperProvider$Companion.prototype.names_0 = function (enums) {\n return joinToString_0(enums, ', ', void 0, void 0, void 0, void 0, ColorBrewerMapperProvider$Companion$names$lambda);\n };\n ColorBrewerMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorBrewerMapperProvider$Companion_instance = null;\n function ColorBrewerMapperProvider$Companion_getInstance() {\n if (ColorBrewerMapperProvider$Companion_instance === null) {\n new ColorBrewerMapperProvider$Companion();\n }return ColorBrewerMapperProvider$Companion_instance;\n }\n function ColorBrewerMapperProvider_init$lambda(this$ColorBrewerMapperProvider) {\n return function () {\n return 'palette: expected a name or index but was: ' + toString(Kotlin.getKClassFromExpression(ensureNotNull(this$ColorBrewerMapperProvider.paletteNameOrIndex_0)).simpleName);\n };\n }\n ColorBrewerMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorBrewerMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function ColorGradient2MapperProvider(low, mid, high, midpoint, naValue) {\n ColorGradient2MapperProvider$Companion_getInstance();\n ContinuousOnlyMapperProvider.call(this, naValue);\n this.myLow_0 = null;\n this.myMid_0 = null;\n this.myHigh_0 = null;\n this.myMidpoint_0 = null;\n this.myLow_0 = low != null ? low : ColorGradient2MapperProvider$Companion_getInstance().DEF_GRADIENT_LOW_0;\n this.myMid_0 = mid != null ? mid : ColorGradient2MapperProvider$Companion_getInstance().DEF_GRADIENT_MID_0;\n this.myHigh_0 = high != null ? high : ColorGradient2MapperProvider$Companion_getInstance().DEF_GRADIENT_HIGH_0;\n this.myMidpoint_0 = midpoint != null ? midpoint : 0.0;\n }\n function ColorGradient2MapperProvider$createContinuousMapper$getMapper(closure$rangeMap) {\n return function (v) {\n var tmp$;\n var f_ = null;\n if (data_0.SeriesUtil.isFinite_yrwdxb$(v)) {\n var f_span = kotlin_js_internal_DoubleCompanionObject.NaN;\n tmp$ = closure$rangeMap.keys.iterator();\n while (tmp$.hasNext()) {\n var range = tmp$.next();\n if (range.contains_mef7kx$(ensureNotNull(v))) {\n var span = range.upperEnd - range.lowerEnd;\n if (f_ == null || f_span === 0.0) {\n f_ = closure$rangeMap.get_11rb$(range);\n f_span = span;\n } else if (span < f_span && span > 0) {\n f_ = closure$rangeMap.get_11rb$(range);\n f_span = span;\n }}}\n }return f_;\n };\n }\n function ColorGradient2MapperProvider$createContinuousMapper$lambda(closure$getMapper, this$ColorGradient2MapperProvider) {\n return function (input) {\n var tmp$;\n var mapper = closure$getMapper(input);\n return (tmp$ = mapper != null ? mapper(input) : null) != null ? tmp$ : this$ColorGradient2MapperProvider.naValue;\n };\n }\n ColorGradient2MapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var domain_0 = scale.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(domain, lowerLimit, upperLimit, trans);\n var tmp$ = domain_0.lowerEnd;\n var a = ensureNotNull(this.myMidpoint_0);\n var b = domain_0.lowerEnd;\n var lowDomain = new ClosedRange(tmp$, JsMath.max(a, b));\n var a_0 = this.myMidpoint_0;\n var b_0 = domain_0.upperEnd;\n var highDomain = new ClosedRange(JsMath.min(a_0, b_0), domain_0.upperEnd);\n var lowMapper = ColorMapper_getInstance().gradient_e4qimg$(lowDomain, this.myLow_0, this.myMid_0, this.naValue);\n var highMapper = ColorMapper_getInstance().gradient_e4qimg$(highDomain, this.myMid_0, this.myHigh_0, this.naValue);\n var rangeMap = mapOf([to(lowDomain, lowMapper), to(highDomain, highMapper)]);\n var getMapper = ColorGradient2MapperProvider$createContinuousMapper$getMapper(rangeMap);\n var mapperFun = ColorGradient2MapperProvider$createContinuousMapper$lambda(getMapper, this);\n return GuideMappers_getInstance().asContinuous_rjdepr$(mapperFun);\n };\n function ColorGradient2MapperProvider$Companion() {\n ColorGradient2MapperProvider$Companion_instance = this;\n this.DEF_GRADIENT_LOW_0 = Color.Companion.parseHex_61zpoe$('#964540');\n this.DEF_GRADIENT_MID_0 = Color.Companion.WHITE;\n this.DEF_GRADIENT_HIGH_0 = Color.Companion.parseHex_61zpoe$('#3B3D96');\n }\n ColorGradient2MapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorGradient2MapperProvider$Companion_instance = null;\n function ColorGradient2MapperProvider$Companion_getInstance() {\n if (ColorGradient2MapperProvider$Companion_instance === null) {\n new ColorGradient2MapperProvider$Companion();\n }return ColorGradient2MapperProvider$Companion_instance;\n }\n ColorGradient2MapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorGradient2MapperProvider',\n interfaces: [ContinuousOnlyMapperProvider]\n };\n function ColorGradientMapperProvider(low, high, naValue) {\n ColorGradientMapperProvider$Companion_getInstance();\n MapperProviderBase.call(this, naValue);\n this.low_0 = low != null ? low : ColorMapper_getInstance().DEF_GRADIENT_LOW;\n this.high_0 = high != null ? high : ColorMapper_getInstance().DEF_GRADIENT_HIGH;\n }\n ColorGradientMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n var domainValuesAsNumbers = scale.MapperUtil.mapDiscreteDomainValuesToNumbers_7f6uoc$(domainValues);\n var mapperDomain = ensureNotNull(data_0.SeriesUtil.range_l63ks6$(domainValuesAsNumbers.values));\n var gradient = ColorMapper_getInstance().gradient_e4qimg$(mapperDomain, this.low_0, this.high_0, this.naValue);\n return GuideMappers_getInstance().asNotContinuous_rjdepr$(gradient);\n };\n ColorGradientMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var domain_0 = scale.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(domain, lowerLimit, upperLimit, trans);\n var gradient = ColorMapper_getInstance().gradient_e4qimg$(domain_0, this.low_0, this.high_0, this.naValue);\n return GuideMappers_getInstance().asContinuous_rjdepr$(gradient);\n };\n function ColorGradientMapperProvider$Companion() {\n ColorGradientMapperProvider$Companion_instance = this;\n this.DEFAULT = new ColorGradientMapperProvider(null, null, ColorMapper_getInstance().NA_VALUE);\n }\n ColorGradientMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorGradientMapperProvider$Companion_instance = null;\n function ColorGradientMapperProvider$Companion_getInstance() {\n if (ColorGradientMapperProvider$Companion_instance === null) {\n new ColorGradientMapperProvider$Companion();\n }return ColorGradientMapperProvider$Companion_instance;\n }\n ColorGradientMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorGradientMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function ColorHueMapperProvider(hueRange, chroma, luminance, startHue, direction, naValue) {\n ColorHueMapperProvider$Companion_getInstance();\n HSVColorMapperProvider.call(this, naValue);\n this.myFromHSV_0 = null;\n this.myToHSV_0 = null;\n this.myHSVIntervals_0 = null;\n var tmp$;\n var hueRange_0 = ColorHueMapperProvider$Companion_getInstance().normalizeHueRange_0(hueRange);\n var clockwise = direction == null || direction !== -1.0;\n var fromHue = clockwise ? hueRange_0.lowerEnd : hueRange_0.upperEnd;\n var toHue = clockwise ? hueRange_0.upperEnd : hueRange_0.lowerEnd;\n var startHue_0 = startHue != null ? startHue : ColorHueMapperProvider$Companion_getInstance().DEF_START_HUE_0;\n if (hueRange_0.contains_mef7kx$(startHue_0) && startHue_0 - hueRange_0.lowerEnd > 1 && hueRange_0.upperEnd - startHue_0 > 1) {\n tmp$ = listOf_0([to(startHue_0, toHue), to(fromHue, startHue_0)]);\n } else {\n tmp$ = listOf(to(fromHue, toHue));\n }\n var hueIntervals = tmp$;\n var saturation = (chroma != null ? chroma % 100 : ColorHueMapperProvider$Companion_getInstance().DEF_SATURATION_0) / 100;\n var value = (luminance != null ? luminance % 100 : ColorHueMapperProvider$Companion_getInstance().DEF_VALUE_0) / 100;\n var destination = ArrayList_init_0(collectionSizeOrDefault(hueIntervals, 10));\n var tmp$_0;\n tmp$_0 = hueIntervals.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n destination.add_11rb$(to(new HSV(item.first, saturation, value), new HSV(item.second, saturation, value)));\n }\n this.myHSVIntervals_0 = destination;\n this.myFromHSV_0 = new HSV(fromHue, saturation, value);\n this.myToHSV_0 = new HSV(toHue, saturation, value);\n }\n ColorHueMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return this.createDiscreteMapper_q8tf2k$(domainValues, this.myFromHSV_0, this.myToHSV_0);\n };\n ColorHueMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var domain_0 = scale.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(domain, lowerLimit, upperLimit, trans);\n return this.createContinuousMapper_ytjjc$(domain_0, this.myHSVIntervals_0);\n };\n function ColorHueMapperProvider$Companion() {\n ColorHueMapperProvider$Companion_instance = this;\n this.DEF_SATURATION_0 = 50.0;\n this.DEF_VALUE_0 = 90.0;\n this.DEF_START_HUE_0 = 0.0;\n this.DEF_HUE_RANGE_0 = new ClosedRange(15.0, 375.0);\n this.DEFAULT = new ColorHueMapperProvider(null, null, null, null, null, Color.Companion.GRAY);\n }\n ColorHueMapperProvider$Companion.prototype.normalizeHueRange_0 = function (hueRange) {\n var tmp$;\n if (hueRange == null || hueRange.size !== 2) {\n tmp$ = this.DEF_HUE_RANGE_0;\n } else {\n var a = hueRange.get_za3lpa$(0);\n var b = hueRange.get_za3lpa$(1);\n var tmp$_0 = JsMath.min(a, b);\n var a_0 = hueRange.get_za3lpa$(0);\n var b_0 = hueRange.get_za3lpa$(1);\n tmp$ = new ClosedRange(tmp$_0, JsMath.max(a_0, b_0));\n }\n return tmp$;\n };\n ColorHueMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var ColorHueMapperProvider$Companion_instance = null;\n function ColorHueMapperProvider$Companion_getInstance() {\n if (ColorHueMapperProvider$Companion_instance === null) {\n new ColorHueMapperProvider$Companion();\n }return ColorHueMapperProvider$Companion_instance;\n }\n ColorHueMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ColorHueMapperProvider',\n interfaces: [HSVColorMapperProvider]\n };\n function DirectlyProportionalMapperProvider(max, naValue) {\n ContinuousOnlyMapperProvider.call(this, naValue);\n this.max_ks8piw$_0 = max;\n }\n DirectlyProportionalMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var dataMax = scale.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(domain, lowerLimit, upperLimit, trans).upperEnd;\n return GuideMappers_getInstance().continuousToContinuous_lww37m$(new ClosedRange(0.0, dataMax), new ClosedRange(0.0, this.max_ks8piw$_0), this.naValue);\n };\n DirectlyProportionalMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DirectlyProportionalMapperProvider',\n interfaces: [ContinuousOnlyMapperProvider]\n };\n function GreyscaleLightnessMapperProvider(start, end, naValue) {\n GreyscaleLightnessMapperProvider$Companion_getInstance();\n HSVColorMapperProvider.call(this, naValue);\n this.myFromHSV_0 = null;\n this.myToHSV_0 = null;\n var value0 = start != null ? start : GreyscaleLightnessMapperProvider$Companion_getInstance().DEF_START_0;\n var value1 = end != null ? end : GreyscaleLightnessMapperProvider$Companion_getInstance().DEF_END_0;\n if (!rangeTo(0.0, 1.0).contains_mef7kx$(value0)) {\n var message = \"Value of 'start' must be in range: [0,1]: \" + toString(start);\n throw IllegalArgumentException_init(message.toString());\n }if (!rangeTo(0.0, 1.0).contains_mef7kx$(value1)) {\n var message_0 = \"Value of 'end' must be in range: [0,1]: \" + toString(end);\n throw IllegalArgumentException_init(message_0.toString());\n }this.myFromHSV_0 = new HSV(0.0, 0.0, value0);\n this.myToHSV_0 = new HSV(0.0, 0.0, value1);\n }\n GreyscaleLightnessMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return this.createDiscreteMapper_q8tf2k$(domainValues, this.myFromHSV_0, this.myToHSV_0);\n };\n GreyscaleLightnessMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var domain_0 = scale.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(domain, lowerLimit, upperLimit, trans);\n return this.createContinuousMapper_ytjjc$(domain_0, listOf(to(this.myFromHSV_0, this.myToHSV_0)));\n };\n function GreyscaleLightnessMapperProvider$Companion() {\n GreyscaleLightnessMapperProvider$Companion_instance = this;\n this.DEF_START_0 = 0.2;\n this.DEF_END_0 = 0.8;\n }\n GreyscaleLightnessMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var GreyscaleLightnessMapperProvider$Companion_instance = null;\n function GreyscaleLightnessMapperProvider$Companion_getInstance() {\n if (GreyscaleLightnessMapperProvider$Companion_instance === null) {\n new GreyscaleLightnessMapperProvider$Companion();\n }return GreyscaleLightnessMapperProvider$Companion_instance;\n }\n GreyscaleLightnessMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'GreyscaleLightnessMapperProvider',\n interfaces: [HSVColorMapperProvider]\n };\n function HSVColorMapperProvider(naValue) {\n HSVColorMapperProvider$Companion_getInstance();\n MapperProviderBase.call(this, naValue);\n }\n HSVColorMapperProvider.prototype.createDiscreteMapper_q8tf2k$ = function (domainValues, fromHSV, toHSV) {\n var domainValuesAsNumbers = scale.MapperUtil.mapDiscreteDomainValuesToNumbers_7f6uoc$(domainValues);\n var mapperDomain = data_0.SeriesUtil.ensureApplicableRange_4am1sd$(data_0.SeriesUtil.range_l63ks6$(domainValuesAsNumbers.values));\n var newFromHue = fromHSV.h;\n var newToHue = toHSV.h;\n if (domainValues.size > 1) {\n var x = toHSV.h % 360 - fromHSV.h % 360;\n var hueDiff = JsMath.abs(x);\n var step = (toHSV.h - fromHSV.h) / domainValues.size;\n if (hueDiff < JsMath.abs(step) / 2) {\n newFromHue = fromHSV.h + step / 2;\n newToHue = toHSV.h - step / 2;\n }}var gradient = ColorMapper_getInstance().gradientHSV_cr3zp$(mapperDomain, new HSV(newFromHue, fromHSV.s, fromHSV.v), new HSV(newToHue, toHSV.s, toHSV.v), false, this.naValue);\n return GuideMappers_getInstance().asNotContinuous_rjdepr$(gradient);\n };\n HSVColorMapperProvider.prototype.createContinuousMapper_ytjjc$ = function (domain, hsvIntervals) {\n var tmp$;\n switch (hsvIntervals.size) {\n case 0:\n throw IllegalArgumentException_init('Empty HSV intervals.');\n case 1:\n tmp$ = ColorMapper_getInstance().gradientHSV_cr3zp$(domain, hsvIntervals.get_za3lpa$(0).first, hsvIntervals.get_za3lpa$(0).second, false, this.naValue);\n break;\n default:tmp$ = HSVColorMapperProvider$Companion_getInstance().createCompositeColorMapper_0(domain, hsvIntervals, false, this.naValue);\n break;\n }\n var gradientMapper = tmp$;\n return GuideMappers_getInstance().asContinuous_rjdepr$(gradientMapper);\n };\n function HSVColorMapperProvider$Companion() {\n HSVColorMapperProvider$Companion_instance = this;\n }\n function HSVColorMapperProvider$Companion$createCompositeColorMapper$lambda(closure$naColor, closure$colorMappersPerSubDomain) {\n return function (v) {\n var tmp$, tmp$_0;\n if (v == null) {\n return closure$naColor;\n } else {\n var $receiver = closure$colorMappersPerSubDomain;\n var firstOrNull$result;\n firstOrNull$break: do {\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n if (element.first.contains_mef7kx$(v)) {\n firstOrNull$result = element;\n break firstOrNull$break;\n }}\n firstOrNull$result = null;\n }\n while (false);\n var mapper = (tmp$ = firstOrNull$result) != null ? tmp$.second : null;\n return (tmp$_0 = mapper != null ? mapper(v) : null) != null ? tmp$_0 : closure$naColor;\n }\n };\n }\n HSVColorMapperProvider$Companion.prototype.createCompositeColorMapper_0 = function (domain, hsvIntervals, autoHueDirection, naColor) {\n var colorMappersPerSubDomain = this.createColorMappersPerSubDomain_0(domain, hsvIntervals, autoHueDirection, naColor);\n return HSVColorMapperProvider$Companion$createCompositeColorMapper$lambda(naColor, colorMappersPerSubDomain);\n };\n HSVColorMapperProvider$Companion.prototype.createColorMappersPerSubDomain_0 = function (domain, hsvIntervals, autoHueDirection, naColor) {\n var subDomains = this.splitContinuousDomain_0(domain, hsvIntervals);\n var $receiver = zip(subDomains, hsvIntervals);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n var domain_0 = item.first;\n var hsvInterval = item.second;\n destination.add_11rb$(new Pair_0(domain_0, ColorMapper_getInstance().gradientHSV_cr3zp$(domain_0, hsvInterval.first, hsvInterval.second, autoHueDirection, naColor)));\n }\n return destination;\n };\n HSVColorMapperProvider$Companion.prototype.splitContinuousDomain_0 = function (domain, hsvIntervals) {\n var tmp$;\n var domainSize = domain.upperEnd - domain.lowerEnd;\n var destination = ArrayList_init_0(collectionSizeOrDefault(hsvIntervals, 10));\n var tmp$_0;\n tmp$_0 = hsvIntervals.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n var tmp$_1 = destination.add_11rb$;\n var x = item.first.h - item.second.h;\n tmp$_1.call(destination, JsMath.abs(x));\n }\n var hueIntervalSizeList = destination;\n var hueIntervalsTotalSize = sum(hueIntervalSizeList);\n var domainToHueIntevalRatio = domainSize / hueIntervalsTotalSize;\n var subDomains = ArrayList_init();\n var lowerEnd = domain.lowerEnd;\n tmp$ = hueIntervalSizeList.iterator();\n while (tmp$.hasNext()) {\n var hueIntervalSize = tmp$.next();\n var upperEnd = lowerEnd + hueIntervalSize * domainToHueIntevalRatio;\n subDomains.add_11rb$(new ClosedRange(lowerEnd, upperEnd));\n lowerEnd = upperEnd;\n }\n return subDomains;\n };\n HSVColorMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var HSVColorMapperProvider$Companion_instance = null;\n function HSVColorMapperProvider$Companion_getInstance() {\n if (HSVColorMapperProvider$Companion_instance === null) {\n new HSVColorMapperProvider$Companion();\n }return HSVColorMapperProvider$Companion_instance;\n }\n HSVColorMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'HSVColorMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function IdentityDiscreteMapperProvider(inputConverter, naValue) {\n DiscreteOnlyMapperProvider.call(this, naValue);\n this.inputConverter_lfub5e$_0 = inputConverter;\n }\n IdentityDiscreteMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n var tmp$, tmp$_0;\n var outputValues = ArrayList_init();\n tmp$ = domainValues.iterator();\n while (tmp$.hasNext()) {\n var inputValue = tmp$.next();\n if (inputValue == null) {\n outputValues.add_11rb$(this.naValue);\n } else {\n tmp$_0 = this.inputConverter_lfub5e$_0(inputValue);\n if (tmp$_0 == null) {\n throw IllegalStateException_init(\"Can't map input value \" + toString(inputValue) + ' to output type');\n }var outputValue = tmp$_0;\n outputValues.add_11rb$(outputValue);\n }\n }\n return GuideMappers_getInstance().discreteToDiscrete_pkbp8v$(domainValues, outputValues, this.naValue);\n };\n IdentityDiscreteMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'IdentityDiscreteMapperProvider',\n interfaces: [DiscreteOnlyMapperProvider]\n };\n function IdentityMapperProvider(discreteMapperProvider, continuousMapper) {\n this.discreteMapperProvider_0 = discreteMapperProvider;\n this.continuousMapper_0 = continuousMapper;\n }\n IdentityMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return this.discreteMapperProvider_0.createDiscreteMapper_7f6uoc$(domainValues);\n };\n IdentityMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n return GuideMappers_getInstance().asContinuous_rjdepr$(this.continuousMapper_0);\n };\n IdentityMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'IdentityMapperProvider',\n interfaces: [MapperProvider]\n };\n function LinearNormalizingMapperProvider(outputRange, naValue) {\n MapperProviderBase.call(this, naValue);\n this.outputRange_73yg7w$_0 = outputRange;\n }\n LinearNormalizingMapperProvider.prototype.createDiscreteMapper_7f6uoc$ = function (domainValues) {\n return GuideMappers_getInstance().discreteToContinuous_83ntpg$(domainValues, this.outputRange_73yg7w$_0, this.naValue);\n };\n LinearNormalizingMapperProvider.prototype.createContinuousMapper_1g0x2p$ = function (domain, lowerLimit, upperLimit, trans) {\n var dataRange = scale.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(domain, lowerLimit, upperLimit, trans);\n return GuideMappers_getInstance().continuousToContinuous_lww37m$(dataRange, this.outputRange_73yg7w$_0, this.naValue);\n };\n LinearNormalizingMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'LinearNormalizingMapperProvider',\n interfaces: [MapperProviderBase]\n };\n function MapperProviderBase(naValue) {\n this.naValue = naValue;\n }\n MapperProviderBase.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MapperProviderBase',\n interfaces: [MapperProvider]\n };\n function SizeAreaMapperProvider(max, naValue) {\n SizeAreaMapperProvider$Companion_getInstance();\n DirectlyProportionalMapperProvider.call(this, max != null ? max : SizeAreaMapperProvider$Companion_getInstance().DEF_MAX, naValue);\n }\n function SizeAreaMapperProvider$Companion() {\n SizeAreaMapperProvider$Companion_instance = this;\n this.DEF_MAX = aes.AesScaling.sizeFromCircleDiameter_14dthe$(21.0);\n }\n SizeAreaMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SizeAreaMapperProvider$Companion_instance = null;\n function SizeAreaMapperProvider$Companion_getInstance() {\n if (SizeAreaMapperProvider$Companion_instance === null) {\n new SizeAreaMapperProvider$Companion();\n }return SizeAreaMapperProvider$Companion_instance;\n }\n SizeAreaMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SizeAreaMapperProvider',\n interfaces: [DirectlyProportionalMapperProvider]\n };\n function SizeMapperProvider(range, naValue) {\n SizeMapperProvider$Companion_getInstance();\n LinearNormalizingMapperProvider.call(this, range, naValue);\n }\n function SizeMapperProvider$Companion() {\n SizeMapperProvider$Companion_instance = this;\n this.DEF_RANGE_0 = new ClosedRange(aes.AesScaling.sizeFromCircleDiameter_14dthe$(3.0), aes.AesScaling.sizeFromCircleDiameter_14dthe$(21.0));\n this.DEFAULT = new SizeMapperProvider(this.DEF_RANGE_0, DefaultNaValue_getInstance().get_31786j$(Aes.Companion.SIZE));\n }\n SizeMapperProvider$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SizeMapperProvider$Companion_instance = null;\n function SizeMapperProvider$Companion_getInstance() {\n if (SizeMapperProvider$Companion_instance === null) {\n new SizeMapperProvider$Companion();\n }return SizeMapperProvider$Companion_instance;\n }\n SizeMapperProvider.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SizeMapperProvider',\n interfaces: [LinearNormalizingMapperProvider]\n };\n function AxisTheme() {\n }\n AxisTheme.prototype.tickLabelDistance = function () {\n var result = this.tickMarkPadding();\n if (this.showTickMarks()) {\n result += this.tickMarkLength();\n }return result;\n };\n AxisTheme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'AxisTheme',\n interfaces: []\n };\n function DefaultAxisTheme() {\n }\n DefaultAxisTheme.prototype.showLine = function () {\n return true;\n };\n DefaultAxisTheme.prototype.showTickMarks = function () {\n return true;\n };\n DefaultAxisTheme.prototype.showTickLabels = function () {\n return true;\n };\n DefaultAxisTheme.prototype.showTitle = function () {\n return true;\n };\n DefaultAxisTheme.prototype.showTooltip = function () {\n return true;\n };\n DefaultAxisTheme.prototype.lineWidth = function () {\n return Defaults$Plot$Axis_getInstance().LINE_WIDTH;\n };\n DefaultAxisTheme.prototype.tickMarkWidth = function () {\n return Defaults$Plot$Axis_getInstance().TICK_LINE_WIDTH;\n };\n DefaultAxisTheme.prototype.tickMarkLength = function () {\n return 6.0;\n };\n DefaultAxisTheme.prototype.tickMarkPadding = function () {\n return 3.0;\n };\n DefaultAxisTheme.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DefaultAxisTheme',\n interfaces: [AxisTheme]\n };\n function DefaultTheme() {\n DefaultTheme$Companion_getInstance();\n }\n DefaultTheme.prototype.axisX = function () {\n return DefaultTheme$Companion_getInstance().AXIS_THEME_0;\n };\n DefaultTheme.prototype.axisY = function () {\n return DefaultTheme$Companion_getInstance().AXIS_THEME_0;\n };\n DefaultTheme.prototype.legend = function () {\n return DefaultTheme$Companion_getInstance().LEGEND_THEME_0;\n };\n DefaultTheme.prototype.facets = function () {\n return DefaultTheme$Companion_getInstance().FACETS_THEME_0;\n };\n DefaultTheme.prototype.plot = function () {\n return DefaultTheme$Companion_getInstance().PLOT_THEME_0;\n };\n function DefaultTheme$multiTile$ObjectLiteral() {\n DefaultTheme.call(this);\n }\n DefaultTheme$multiTile$ObjectLiteral.prototype.axisX = function () {\n return DefaultTheme$Companion_getInstance().AXIS_THEME_MULTI_TILE_0;\n };\n DefaultTheme$multiTile$ObjectLiteral.prototype.axisY = function () {\n return DefaultTheme$Companion_getInstance().AXIS_THEME_MULTI_TILE_0;\n };\n DefaultTheme$multiTile$ObjectLiteral.prototype.plot = function () {\n return DefaultTheme$Companion_getInstance().PLOT_THEME_MULTI_TILE_0;\n };\n DefaultTheme$multiTile$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DefaultTheme]\n };\n DefaultTheme.prototype.multiTile = function () {\n return new DefaultTheme$multiTile$ObjectLiteral();\n };\n function DefaultTheme$Companion() {\n DefaultTheme$Companion_instance = this;\n this.AXIS_THEME_0 = new DefaultAxisTheme();\n this.AXIS_THEME_MULTI_TILE_0 = new DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral();\n this.LEGEND_THEME_0 = new DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral();\n this.FACETS_THEME_0 = new DefaultTheme$Companion$FACETS_THEME$ObjectLiteral();\n this.PLOT_THEME_0 = new DefaultTheme$Companion$PLOT_THEME$ObjectLiteral();\n this.PLOT_THEME_MULTI_TILE_0 = new DefaultTheme$Companion$PLOT_THEME_MULTI_TILE$ObjectLiteral();\n }\n function DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral() {\n DefaultAxisTheme.call(this);\n }\n DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral.prototype.showLine = function () {\n return false;\n };\n DefaultTheme$Companion$AXIS_THEME_MULTI_TILE$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [DefaultAxisTheme]\n };\n function DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral() {\n }\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.keySize = function () {\n return 23.0;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.margin = function () {\n return 5.0;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.padding = function () {\n return 5.0;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.position = function () {\n return LegendPosition$Companion_getInstance().RIGHT;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.justification = function () {\n return LegendJustification$Companion_getInstance().CENTER;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.direction = function () {\n return LegendDirection$AUTO_getInstance();\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.prototype.backgroundFill = function () {\n return Color.Companion.WHITE;\n };\n DefaultTheme$Companion$LEGEND_THEME$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [LegendTheme]\n };\n function DefaultTheme$Companion$FACETS_THEME$ObjectLiteral() {\n }\n DefaultTheme$Companion$FACETS_THEME$ObjectLiteral.prototype.labelBackground = function () {\n return values.Colors.lighter_o14uds$(Color.Companion.VERY_LIGHT_GRAY, 0.9);\n };\n DefaultTheme$Companion$FACETS_THEME$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [FacetsTheme]\n };\n function DefaultTheme$Companion$PLOT_THEME$ObjectLiteral() {\n }\n DefaultTheme$Companion$PLOT_THEME$ObjectLiteral.prototype.showInnerFrame = function () {\n return false;\n };\n DefaultTheme$Companion$PLOT_THEME$ObjectLiteral.prototype.innerFrameColor = function () {\n throw IllegalStateException_init(\"The `innerFrameColor()` method shouldn't be used.\");\n };\n DefaultTheme$Companion$PLOT_THEME$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PlotTheme]\n };\n function DefaultTheme$Companion$PLOT_THEME_MULTI_TILE$ObjectLiteral() {\n }\n DefaultTheme$Companion$PLOT_THEME_MULTI_TILE$ObjectLiteral.prototype.showInnerFrame = function () {\n return true;\n };\n DefaultTheme$Companion$PLOT_THEME_MULTI_TILE$ObjectLiteral.prototype.innerFrameColor = function () {\n return values.Colors.lighter_o14uds$(Color.Companion.VERY_LIGHT_GRAY, 0.9);\n };\n DefaultTheme$Companion$PLOT_THEME_MULTI_TILE$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [PlotTheme]\n };\n DefaultTheme$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var DefaultTheme$Companion_instance = null;\n function DefaultTheme$Companion_getInstance() {\n if (DefaultTheme$Companion_instance === null) {\n new DefaultTheme$Companion();\n }return DefaultTheme$Companion_instance;\n }\n DefaultTheme.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DefaultTheme',\n interfaces: [Theme]\n };\n function FacetsTheme() {\n }\n FacetsTheme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'FacetsTheme',\n interfaces: []\n };\n function LegendTheme() {\n }\n LegendTheme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'LegendTheme',\n interfaces: []\n };\n function PlotTheme() {\n }\n PlotTheme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'PlotTheme',\n interfaces: []\n };\n function Theme() {\n }\n Theme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'Theme',\n interfaces: []\n };\n function ConstantValue(value, format) {\n if (format === void 0)\n format = null;\n this.value_0 = value;\n this.format_0 = format;\n var tmp$;\n if (this.format_0 != null) {\n tmp$ = StringFormat.Companion.create_w8bwfu$(this.format_0).format_za3rmp$(this.value_0);\n } else {\n tmp$ = this.value_0.toString();\n }\n this.myDataValue_0 = tmp$;\n this.isOutlier_efnf0i$_0 = false;\n this.isAxis_i12u4n$_0 = false;\n }\n Object.defineProperty(ConstantValue.prototype, 'isOutlier', {\n configurable: true,\n get: function () {\n return this.isOutlier_efnf0i$_0;\n }\n });\n Object.defineProperty(ConstantValue.prototype, 'isAxis', {\n configurable: true,\n get: function () {\n return this.isAxis_i12u4n$_0;\n }\n });\n ConstantValue.prototype.initDataContext_rxi9tf$ = function (dataContext) {\n };\n ConstantValue.prototype.getDataPoint_za3lpa$ = function (index) {\n return new TooltipLineSpec$DataPoint('', this.myDataValue_0, null, false, false);\n };\n ConstantValue.prototype.copy = function () {\n return new ConstantValue(this.value_0, this.format_0);\n };\n ConstantValue.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'ConstantValue',\n interfaces: [ValueSource]\n };\n function DataFrameValue(name, format) {\n if (format === void 0)\n format = null;\n this.name_0 = name;\n this.format_0 = format;\n this.myDataFrame_v9hm26$_0 = this.myDataFrame_v9hm26$_0;\n this.myVariable_u4q8p$_0 = this.myVariable_u4q8p$_0;\n this.myFormatter_0 = this.format_0 != null ? StringFormat.Companion.forOneArg_86f9bg$(this.format_0, void 0, this.name_0) : null;\n this.isOutlier_h13ss7$_0 = false;\n this.isAxis_5xgnmk$_0 = false;\n }\n Object.defineProperty(DataFrameValue.prototype, 'myDataFrame_0', {\n configurable: true,\n get: function () {\n if (this.myDataFrame_v9hm26$_0 == null)\n return throwUPAE('myDataFrame');\n return this.myDataFrame_v9hm26$_0;\n },\n set: function (myDataFrame) {\n this.myDataFrame_v9hm26$_0 = myDataFrame;\n }\n });\n Object.defineProperty(DataFrameValue.prototype, 'myVariable_0', {\n configurable: true,\n get: function () {\n if (this.myVariable_u4q8p$_0 == null)\n return throwUPAE('myVariable');\n return this.myVariable_u4q8p$_0;\n },\n set: function (myVariable) {\n this.myVariable_u4q8p$_0 = myVariable;\n }\n });\n Object.defineProperty(DataFrameValue.prototype, 'isOutlier', {\n configurable: true,\n get: function () {\n return this.isOutlier_h13ss7$_0;\n }\n });\n Object.defineProperty(DataFrameValue.prototype, 'isAxis', {\n configurable: true,\n get: function () {\n return this.isAxis_5xgnmk$_0;\n }\n });\n DataFrameValue.prototype.initDataContext_rxi9tf$ = function (dataContext) {\n if (!(this.myDataFrame_v9hm26$_0 == null)) {\n var message = 'Data context can be initialized only once';\n throw IllegalArgumentException_init(message.toString());\n }this.myDataFrame_0 = dataContext.dataFrame;\n this.myVariable_0 = data.DataFrameUtil.findVariableOrFail_vede35$(this.myDataFrame_0, this.name_0);\n };\n DataFrameValue.prototype.getDataPoint_za3lpa$ = function (index) {\n var tmp$, tmp$_0, tmp$_1;\n tmp$ = this.myDataFrame_0.get_8xm3sj$(this.myVariable_0).get_za3lpa$(index);\n if (tmp$ == null) {\n return null;\n }var originalValue = tmp$;\n return new TooltipLineSpec$DataPoint(this.name_0, (tmp$_1 = (tmp$_0 = this.myFormatter_0) != null ? tmp$_0.format_za3rmp$(originalValue) : null) != null ? tmp$_1 : originalValue.toString(), null, false, false);\n };\n DataFrameValue.prototype.copy = function () {\n return new DataFrameValue(this.name_0, this.format_0);\n };\n DataFrameValue.prototype.getVariableName = function () {\n return this.name_0;\n };\n DataFrameValue.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataFrameValue',\n interfaces: [ValueSource]\n };\n function MappingValue(aes, isOutlier, isAxis, format) {\n if (isOutlier === void 0)\n isOutlier = false;\n if (isAxis === void 0)\n isAxis = false;\n if (format === void 0)\n format = null;\n this.aes = aes;\n this.isOutlier_cyn2n6$_0 = isOutlier;\n this.isAxis_ohfp7r$_0 = isAxis;\n this.format_0 = format;\n this.myDataAccess_biypgq$_0 = this.myDataAccess_biypgq$_0;\n this.myDataLabel_0 = null;\n this.myFormatter_0 = this.format_0 != null ? StringFormat.Companion.forOneArg_86f9bg$(this.format_0, void 0, this.aes.name) : null;\n }\n Object.defineProperty(MappingValue.prototype, 'isOutlier', {\n get: function () {\n return this.isOutlier_cyn2n6$_0;\n }\n });\n Object.defineProperty(MappingValue.prototype, 'isAxis', {\n get: function () {\n return this.isAxis_ohfp7r$_0;\n }\n });\n Object.defineProperty(MappingValue.prototype, 'myDataAccess_0', {\n configurable: true,\n get: function () {\n if (this.myDataAccess_biypgq$_0 == null)\n return throwUPAE('myDataAccess');\n return this.myDataAccess_biypgq$_0;\n },\n set: function (myDataAccess) {\n this.myDataAccess_biypgq$_0 = myDataAccess;\n }\n });\n MappingValue.prototype.initDataContext_rxi9tf$ = function (dataContext) {\n var tmp$;\n if (!(this.myDataAccess_biypgq$_0 == null)) {\n var message = 'Data context can be initialized only once';\n throw IllegalArgumentException_init(message.toString());\n }this.myDataAccess_0 = dataContext.mappedDataAccess;\n if (!this.myDataAccess_0.isMapped_896ixz$(this.aes)) {\n var message_0 = this.aes.toString() + ' have to be mapped';\n throw IllegalArgumentException_init(message_0.toString());\n }var $receiver = listOf_0([Aes.Companion.X, Aes.Companion.Y]);\n var predicate = getCallableRef('isMapped', function ($receiver, p1) {\n return $receiver.isMapped_896ixz$(p1);\n }.bind(null, this.myDataAccess_0));\n var destination = ArrayList_init();\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (predicate(element))\n destination.add_11rb$(element);\n }\n var transform = getCallableRef('getMappedDataLabel', function ($receiver, p1) {\n return $receiver.getMappedDataLabel_896ixz$(p1);\n }.bind(null, this.myDataAccess_0));\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(destination, 10));\n var tmp$_1;\n tmp$_1 = destination.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n destination_0.add_11rb$(transform(item));\n }\n var axisLabels = destination_0;\n var dataLabel = this.myDataAccess_0.getMappedDataLabel_896ixz$(this.aes);\n if (this.isAxis)\n tmp$ = null;\n else {\n if (dataLabel.length === 0)\n tmp$ = '';\n else if (axisLabels.contains_11rb$(dataLabel))\n tmp$ = '';\n else\n tmp$ = dataLabel;\n }\n this.myDataLabel_0 = tmp$;\n };\n MappingValue.prototype.getDataPoint_za3lpa$ = function (index) {\n var tmp$, tmp$_0, tmp$_1;\n var originalValue = this.myDataAccess_0.getOriginalValue_pkitv1$(this.aes, index);\n var tmp$_2;\n if (originalValue != null) {\n var tmp$_3;\n tmp$_2 = (tmp$_3 = this.myFormatter_0) != null ? tmp$_3.format_za3rmp$(originalValue) : null;\n } else\n tmp$_2 = null;\n var formattedValue = (tmp$ = tmp$_2) != null ? tmp$ : this.myDataAccess_0.getMappedData_pkitv1$(this.aes, index).value;\n var tmp$_4 = this.isOutlier;\n if (tmp$_4) {\n var $receiver = this.myDataLabel_0;\n tmp$_4 = !($receiver == null || $receiver.length === 0);\n }if (tmp$_4 && !equals((tmp$_0 = this.myFormatter_0) != null ? tmp$_0.formatType : null, StringFormat$FormatType.STRING_FORMAT)) {\n tmp$_1 = toString(this.myDataLabel_0) + ': ' + formattedValue;\n } else {\n tmp$_1 = formattedValue;\n }\n var value = tmp$_1;\n return new TooltipLineSpec$DataPoint(this.isOutlier ? null : this.myDataLabel_0, value, this.aes, this.isAxis, this.isOutlier);\n };\n MappingValue.prototype.copy = function () {\n return new MappingValue(this.aes, this.isOutlier, this.isAxis, this.format_0);\n };\n MappingValue.prototype.toOutlier = function () {\n return new MappingValue(this.aes, true, this.isAxis, this.format_0);\n };\n MappingValue.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MappingValue',\n interfaces: [ValueSource]\n };\n function TooltipLine(label, pattern, fields) {\n TooltipLine$Companion_getInstance();\n this.label_0 = label;\n this.pattern_0 = pattern;\n this.fields = fields;\n this.myLineFormatter_0 = StringFormat.Companion.forNArgs_8vq31k$(this.pattern_0, StringFormat$FormatType.STRING_FORMAT, this.fields.size, 'fields');\n }\n TooltipLine.prototype.initDataContext_rxi9tf$ = function (dataContext) {\n var tmp$;\n tmp$ = this.fields.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n element.initDataContext_rxi9tf$(dataContext);\n }\n };\n function TooltipLine$getDataPoint$lambda(it) {\n var tmp$;\n return (tmp$ = it.label) != null ? tmp$ : '';\n }\n TooltipLine.prototype.getDataPoint_za3lpa$ = function (index) {\n var tmp$;\n var $receiver = this.fields;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n var tmp$_1 = destination.add_11rb$;\n var tmp$_2;\n tmp$_2 = item.getDataPoint_za3lpa$(index);\n if (tmp$_2 == null) {\n return null;\n }tmp$_1.call(destination, tmp$_2);\n }\n var dataValues = destination;\n if (dataValues.size === 1) {\n var dataValue = single(dataValues);\n tmp$ = new TooltipLineSpec$DataPoint(this.chooseLabel_0(dataValue.label), this.myLineFormatter_0.format_za3rmp$(dataValue.value), dataValue.aes, dataValue.isAxis, dataValue.isOutlier);\n } else {\n var tmp$_3 = this.chooseLabel_0(joinToString(dataValues, ', ', void 0, void 0, void 0, void 0, TooltipLine$getDataPoint$lambda));\n var tmp$_4 = this.myLineFormatter_0;\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault(dataValues, 10));\n var tmp$_5;\n tmp$_5 = dataValues.iterator();\n while (tmp$_5.hasNext()) {\n var item_0 = tmp$_5.next();\n destination_0.add_11rb$(item_0.value);\n }\n tmp$ = new TooltipLineSpec$DataPoint(tmp$_3, tmp$_4.format_pqjuzw$(destination_0), null, false, false);\n }\n return tmp$;\n };\n TooltipLine.prototype.chooseLabel_0 = function (dataLabel) {\n var tmp$;\n if (equals(this.label_0, TooltipLine$Companion_getInstance().DEFAULT_LABEL_SPECIFIER_0))\n tmp$ = dataLabel;\n else\n tmp$ = this.label_0;\n return tmp$;\n };\n function TooltipLine$Companion() {\n TooltipLine$Companion_instance = this;\n this.DEFAULT_LABEL_SPECIFIER_0 = '@';\n }\n TooltipLine$Companion.prototype.defaultLineForValueSource_u47np3$ = function (valueSource) {\n return new TooltipLine(this.DEFAULT_LABEL_SPECIFIER_0, StringFormat.Companion.valueInLinePattern(), listOf(valueSource));\n };\n TooltipLine$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TooltipLine$Companion_instance = null;\n function TooltipLine$Companion_getInstance() {\n if (TooltipLine$Companion_instance === null) {\n new TooltipLine$Companion();\n }return TooltipLine$Companion_instance;\n }\n TooltipLine.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipLine',\n interfaces: [TooltipLineSpec]\n };\n function TooltipLine_init(other, $this) {\n $this = $this || Object.create(TooltipLine.prototype);\n var tmp$ = other.label_0;\n var tmp$_0 = other.pattern_0;\n var $receiver = other.fields;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var item = tmp$_1.next();\n destination.add_11rb$(item.copy());\n }\n TooltipLine.call($this, tmp$, tmp$_0, destination);\n return $this;\n }\n function TooltipSpecification(valueSources, tooltipLinePatterns, tooltipProperties) {\n TooltipSpecification$Companion_getInstance();\n this.valueSources = valueSources;\n this.tooltipLinePatterns = tooltipLinePatterns;\n this.tooltipProperties = tooltipProperties;\n }\n function TooltipSpecification$TooltipProperties(anchor, minWidth, color) {\n TooltipSpecification$TooltipProperties$Companion_getInstance();\n this.anchor = anchor;\n this.minWidth = minWidth;\n this.color = color;\n }\n function TooltipSpecification$TooltipProperties$Companion() {\n TooltipSpecification$TooltipProperties$Companion_instance = this;\n this.NONE = new TooltipSpecification$TooltipProperties(null, null, null);\n }\n TooltipSpecification$TooltipProperties$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TooltipSpecification$TooltipProperties$Companion_instance = null;\n function TooltipSpecification$TooltipProperties$Companion_getInstance() {\n if (TooltipSpecification$TooltipProperties$Companion_instance === null) {\n new TooltipSpecification$TooltipProperties$Companion();\n }return TooltipSpecification$TooltipProperties$Companion_instance;\n }\n TooltipSpecification$TooltipProperties.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipProperties',\n interfaces: []\n };\n function TooltipSpecification$Companion() {\n TooltipSpecification$Companion_instance = this;\n }\n TooltipSpecification$Companion.prototype.withoutTooltip = function () {\n return new TooltipSpecification(emptyList(), emptyList(), TooltipSpecification$TooltipProperties$Companion_getInstance().NONE);\n };\n TooltipSpecification$Companion.prototype.defaultTooltip = function () {\n return new TooltipSpecification(emptyList(), null, TooltipSpecification$TooltipProperties$Companion_getInstance().NONE);\n };\n TooltipSpecification$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TooltipSpecification$Companion_instance = null;\n function TooltipSpecification$Companion_getInstance() {\n if (TooltipSpecification$Companion_instance === null) {\n new TooltipSpecification$Companion();\n }return TooltipSpecification$Companion_instance;\n }\n TooltipSpecification.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TooltipSpecification',\n interfaces: []\n };\n function ValueSource() {\n }\n ValueSource.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ValueSource',\n interfaces: []\n };\n var package$jetbrains = _.jetbrains || (_.jetbrains = {});\n var package$datalore = package$jetbrains.datalore || (package$jetbrains.datalore = {});\n var package$plot = package$datalore.plot || (package$datalore.plot = {});\n Object.defineProperty(package$plot, 'FeatureSwitch', {\n get: FeatureSwitch_getInstance\n });\n var package$builder = package$plot.builder || (package$plot.builder = {});\n Object.defineProperty(package$builder, 'AxisUtil', {\n get: AxisUtil_getInstance\n });\n package$builder.BogusCoordinateSystem = BogusCoordinateSystem;\n package$builder.BogusScale = BogusScale;\n package$builder.GeomLayer = GeomLayer;\n Object.defineProperty(package$builder, 'GeomLayerListUtil', {\n get: GeomLayerListUtil_getInstance\n });\n LayerRendererUtil.prototype.LayerRendererData = LayerRendererUtil$LayerRendererData;\n Object.defineProperty(package$builder, 'LayerRendererUtil', {\n get: LayerRendererUtil_getInstance\n });\n Object.defineProperty(Plot, 'Companion', {\n get: Plot$Companion_getInstance\n });\n package$builder.Plot = Plot;\n package$builder.PlotBuilder = PlotBuilder;\n Object.defineProperty(PlotContainerPortable, 'Companion', {\n get: PlotContainerPortable$Companion_getInstance\n });\n package$builder.PlotContainerPortable = PlotContainerPortable;\n package$builder.PlotTile = PlotTile;\n package$builder.PlotTooltipHelper = PlotTooltipHelper;\n Object.defineProperty(package$builder, 'PlotUtil', {\n get: PlotUtil_getInstance\n });\n package$builder.PosProviderContext = PosProviderContext;\n package$builder.SvgLayerRenderer = SvgLayerRenderer;\n package$builder.VarBinding = VarBinding;\n Object.defineProperty(ColorBarAssembler, 'Companion', {\n get: ColorBarAssembler$Companion_getInstance\n });\n var package$assemble = package$builder.assemble || (package$builder.assemble = {});\n package$assemble.ColorBarAssembler = ColorBarAssembler;\n package$assemble.ColorBarOptions = ColorBarOptions;\n package$assemble.GeomContextBuilder_init = GeomContextBuilder_init;\n package$assemble.GeomContextBuilder = GeomContextBuilder;\n Object.defineProperty(GeomLayerBuilder, 'Companion', {\n get: GeomLayerBuilder$Companion_getInstance\n });\n package$assemble.GeomLayerBuilder = GeomLayerBuilder;\n Object.defineProperty(GuideOptions, 'Companion', {\n get: GuideOptions$Companion_getInstance\n });\n package$assemble.GuideOptions = GuideOptions;\n ImmutableGeomContext.Builder = ImmutableGeomContext$Builder;\n package$assemble.ImmutableGeomContext = ImmutableGeomContext;\n Object.defineProperty(LegendAssembler, 'Companion', {\n get: LegendAssembler$Companion_getInstance\n });\n package$assemble.LegendAssembler = LegendAssembler;\n Object.defineProperty(package$assemble, 'LegendAssemblerUtil', {\n get: LegendAssemblerUtil_getInstance\n });\n Object.defineProperty(LegendOptions, 'Companion', {\n get: LegendOptions$Companion_getInstance\n });\n package$assemble.LegendOptions = LegendOptions;\n Object.defineProperty(PlotAssembler, 'Companion', {\n get: PlotAssembler$Companion_getInstance\n });\n package$assemble.PlotAssembler = PlotAssembler;\n Object.defineProperty(package$assemble, 'PlotAssemblerUtil', {\n get: PlotAssemblerUtil_getInstance\n });\n Object.defineProperty(PlotFacets, 'Companion', {\n get: PlotFacets$Companion_getInstance\n });\n PlotFacets.FacetTileInfo = PlotFacets$FacetTileInfo;\n package$assemble.PlotFacets = PlotFacets;\n Object.defineProperty(package$assemble, 'PlotGuidesAssemblerUtil', {\n get: PlotGuidesAssemblerUtil_getInstance\n });\n Object.defineProperty(PosProvider, 'Companion', {\n get: PosProvider$Companion_getInstance\n });\n package$assemble.PosProvider = PosProvider;\n package$assemble.StitchedPlotLayers = StitchedPlotLayers;\n Object.defineProperty(TypedScaleMap, 'Companion', {\n get: TypedScaleMap$Companion_getInstance\n });\n package$assemble.TypedScaleMap = TypedScaleMap;\n package$assemble.TypedScaleProviderMap = TypedScaleProviderMap;\n var package$facet = package$assemble.facet || (package$assemble.facet = {});\n package$facet.FacetGrid = FacetGrid;\n Object.defineProperty(FacetWrap$Direction, 'H', {\n get: FacetWrap$Direction$H_getInstance\n });\n Object.defineProperty(FacetWrap$Direction, 'V', {\n get: FacetWrap$Direction$V_getInstance\n });\n FacetWrap.Direction = FacetWrap$Direction;\n Object.defineProperty(FacetWrap, 'Companion', {\n get: FacetWrap$Companion_getInstance\n });\n package$facet.FacetWrap = FacetWrap;\n var package$geom = package$assemble.geom || (package$assemble.geom = {});\n Object.defineProperty(package$geom, 'DefaultSampling', {\n get: DefaultSampling_getInstance\n });\n Object.defineProperty(GeomProvider, 'Companion', {\n get: GeomProvider$Companion_getInstance\n });\n package$geom.GeomProvider = GeomProvider;\n package$geom.PointDataAccess = PointDataAccess;\n var package$coord = package$builder.coord || (package$builder.coord = {});\n package$coord.CartesianCoordProvider = CartesianCoordProvider;\n package$coord.CoordProvider = CoordProvider;\n Object.defineProperty(CoordProviderBase, 'Companion', {\n get: CoordProviderBase$Companion_getInstance\n });\n package$coord.CoordProviderBase = CoordProviderBase;\n Object.defineProperty(package$coord, 'CoordProviders', {\n get: CoordProviders_getInstance\n });\n package$coord.FixedRatioCoordProvider = FixedRatioCoordProvider;\n Object.defineProperty(ProjectionCoordProvider, 'Companion', {\n get: ProjectionCoordProvider$Companion_getInstance\n });\n package$coord.ProjectionCoordProvider = ProjectionCoordProvider;\n var package$map = package$coord.map || (package$coord.map = {});\n package$map.MercatorProjectionX = MercatorProjectionX;\n package$map.MercatorProjectionY = MercatorProjectionY;\n DataProcessing.prototype.DataAndGroupingContext = DataProcessing$DataAndGroupingContext;\n var package$data = package$builder.data || (package$builder.data = {});\n Object.defineProperty(package$data, 'DataProcessing', {\n get: DataProcessing_getInstance\n });\n GroupMerger.Group = GroupMerger$Group;\n package$data.GroupMerger = GroupMerger;\n Object.defineProperty(package$data, 'GroupUtil', {\n get: GroupUtil_getInstance\n });\n Object.defineProperty(GroupingContext, 'Companion', {\n get: GroupingContext$Companion_getInstance\n });\n package$data.GroupingContext = GroupingContext;\n Object.defineProperty(OrderOptionUtil$OrderOption, 'Companion', {\n get: OrderOptionUtil$OrderOption$Companion_getInstance\n });\n OrderOptionUtil.prototype.OrderOption = OrderOptionUtil$OrderOption;\n Object.defineProperty(package$data, 'OrderOptionUtil', {\n get: OrderOptionUtil_getInstance\n });\n var package$event = package$builder.event || (package$builder.event = {});\n package$event.MouseEventPeer = MouseEventPeer;\n var package$guide = package$builder.guide || (package$builder.guide = {});\n package$guide.AxisComponent = AxisComponent;\n package$guide.ColorBarComponent = ColorBarComponent;\n ColorBarComponentLayout.BreakInfo = ColorBarComponentLayout$BreakInfo;\n Object.defineProperty(ColorBarComponentLayout, 'Companion', {\n get: ColorBarComponentLayout$Companion_getInstance\n });\n package$guide.ColorBarComponentLayout = ColorBarComponentLayout;\n Object.defineProperty(ColorBarComponentSpec, 'Companion', {\n get: ColorBarComponentSpec$Companion_getInstance\n });\n package$guide.ColorBarComponentSpec = ColorBarComponentSpec;\n Object.defineProperty(LegendArrangement, 'HORIZONTAL', {\n get: LegendArrangement$HORIZONTAL_getInstance\n });\n Object.defineProperty(LegendArrangement, 'VERTICAL', {\n get: LegendArrangement$VERTICAL_getInstance\n });\n package$guide.LegendArrangement = LegendArrangement;\n Object.defineProperty(LegendBox, 'Companion', {\n get: LegendBox$Companion_getInstance\n });\n package$guide.LegendBox = LegendBox;\n Object.defineProperty(LegendBoxLayout, 'Companion', {\n get: LegendBoxLayout$Companion_getInstance\n });\n package$guide.LegendBoxLayout = LegendBoxLayout;\n package$guide.LegendBoxSpec = LegendBoxSpec;\n Object.defineProperty(LegendBreak, 'Companion', {\n get: LegendBreak$Companion_getInstance\n });\n package$guide.LegendBreak = LegendBreak;\n package$guide.LegendComponent = LegendComponent;\n Object.defineProperty(LegendComponentLayout, 'Companion', {\n get: LegendComponentLayout$Companion_getInstance\n });\n package$guide.LegendComponentLayout = LegendComponentLayout;\n package$guide.LegendComponentSpec = LegendComponentSpec;\n Object.defineProperty(LegendDirection, 'HORIZONTAL', {\n get: LegendDirection$HORIZONTAL_getInstance\n });\n Object.defineProperty(LegendDirection, 'VERTICAL', {\n get: LegendDirection$VERTICAL_getInstance\n });\n Object.defineProperty(LegendDirection, 'AUTO', {\n get: LegendDirection$AUTO_getInstance\n });\n package$guide.LegendDirection = LegendDirection;\n Object.defineProperty(LegendJustification, 'Companion', {\n get: LegendJustification$Companion_getInstance\n });\n package$guide.LegendJustification = LegendJustification;\n Object.defineProperty(LegendPosition, 'Companion', {\n get: LegendPosition$Companion_getInstance\n });\n package$guide.LegendPosition = LegendPosition;\n Object.defineProperty(Orientation, 'LEFT', {\n get: Orientation$LEFT_getInstance\n });\n Object.defineProperty(Orientation, 'RIGHT', {\n get: Orientation$RIGHT_getInstance\n });\n Object.defineProperty(Orientation, 'TOP', {\n get: Orientation$TOP_getInstance\n });\n Object.defineProperty(Orientation, 'BOTTOM', {\n get: Orientation$BOTTOM_getInstance\n });\n package$guide.Orientation = Orientation;\n Object.defineProperty(ContextualMappingProvider, 'Companion', {\n get: ContextualMappingProvider$Companion_getInstance\n });\n var package$interact = package$builder.interact || (package$builder.interact = {});\n package$interact.ContextualMappingProvider = ContextualMappingProvider;\n Object.defineProperty(GeomInteraction, 'Companion', {\n get: GeomInteraction$Companion_getInstance\n });\n package$interact.GeomInteraction = GeomInteraction;\n Object.defineProperty(GeomInteractionBuilder, 'Companion', {\n get: GeomInteractionBuilder$Companion_getInstance\n });\n package$interact.GeomInteractionBuilder = GeomInteractionBuilder;\n Object.defineProperty(MathUtil$ClosestPointChecker$COMPARISON_RESULT, 'NEW_CLOSER', {\n get: MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_CLOSER_getInstance\n });\n Object.defineProperty(MathUtil$ClosestPointChecker$COMPARISON_RESULT, 'NEW_FARTHER', {\n get: MathUtil$ClosestPointChecker$COMPARISON_RESULT$NEW_FARTHER_getInstance\n });\n Object.defineProperty(MathUtil$ClosestPointChecker$COMPARISON_RESULT, 'EQUAL', {\n get: MathUtil$ClosestPointChecker$COMPARISON_RESULT$EQUAL_getInstance\n });\n MathUtil$ClosestPointChecker.COMPARISON_RESULT = MathUtil$ClosestPointChecker$COMPARISON_RESULT;\n MathUtil.prototype.ClosestPointChecker_init_lu1900$ = MathUtil$MathUtil$ClosestPointChecker_init;\n MathUtil.prototype.ClosestPointChecker = MathUtil$ClosestPointChecker;\n Object.defineProperty(MathUtil$DoubleRange, 'Companion', {\n get: MathUtil$DoubleRange$Companion_getInstance\n });\n MathUtil.prototype.DoubleRange = MathUtil$DoubleRange;\n Object.defineProperty(package$interact, 'MathUtil', {\n get: MathUtil_getInstance\n });\n Object.defineProperty(TooltipSpec$Line, 'Companion', {\n get: TooltipSpec$Line$Companion_getInstance\n });\n TooltipSpec.Line = TooltipSpec$Line;\n package$interact.TooltipSpec = TooltipSpec;\n package$interact.TooltipSpecFactory = TooltipSpecFactory;\n var package$loc = package$interact.loc || (package$interact.loc = {});\n package$loc.LayerTargetCollectorWithLocator = LayerTargetCollectorWithLocator;\n LayerTargetLocator.Target = LayerTargetLocator$Target;\n Object.defineProperty(LayerTargetLocator$Collector$CollectingStrategy, 'APPEND', {\n get: LayerTargetLocator$Collector$CollectingStrategy$APPEND_getInstance\n });\n Object.defineProperty(LayerTargetLocator$Collector$CollectingStrategy, 'REPLACE', {\n get: LayerTargetLocator$Collector$CollectingStrategy$REPLACE_getInstance\n });\n Object.defineProperty(LayerTargetLocator$Collector$CollectingStrategy, 'APPEND_IF_EQUAL', {\n get: LayerTargetLocator$Collector$CollectingStrategy$APPEND_IF_EQUAL_getInstance\n });\n Object.defineProperty(LayerTargetLocator$Collector$CollectingStrategy, 'IGNORE', {\n get: LayerTargetLocator$Collector$CollectingStrategy$IGNORE_getInstance\n });\n LayerTargetLocator$Collector.CollectingStrategy = LayerTargetLocator$Collector$CollectingStrategy;\n LayerTargetLocator.Collector = LayerTargetLocator$Collector;\n package$loc.LayerTargetLocator = LayerTargetLocator;\n Object.defineProperty(LocatedTargetsPicker, 'Companion', {\n get: LocatedTargetsPicker$Companion_getInstance\n });\n package$loc.LocatedTargetsPicker = LocatedTargetsPicker;\n Object.defineProperty(TargetDetector, 'Companion', {\n get: TargetDetector$Companion_getInstance\n });\n package$loc.TargetDetector = TargetDetector;\n package$loc.TargetProjection = TargetProjection;\n Object.defineProperty(PointTargetProjection, 'Companion', {\n get: PointTargetProjection$Companion_getInstance\n });\n package$loc.PointTargetProjection = PointTargetProjection;\n Object.defineProperty(RectTargetProjection, 'Companion', {\n get: RectTargetProjection$Companion_getInstance\n });\n package$loc.RectTargetProjection = RectTargetProjection;\n Object.defineProperty(PolygonTargetProjection, 'Companion', {\n get: PolygonTargetProjection$Companion_getInstance\n });\n PolygonTargetProjection.RingXY = PolygonTargetProjection$RingXY;\n package$loc.PolygonTargetProjection = PolygonTargetProjection;\n Object.defineProperty(PathTargetProjection$PathPoint, 'Companion', {\n get: PathTargetProjection$PathPoint$Companion_getInstance\n });\n PathTargetProjection.PathPoint = PathTargetProjection$PathPoint;\n Object.defineProperty(PathTargetProjection, 'Companion', {\n get: PathTargetProjection$Companion_getInstance\n });\n package$loc.PathTargetProjection = PathTargetProjection;\n Object.defineProperty(TargetPrototype, 'Companion', {\n get: TargetPrototype$Companion_getInstance\n });\n package$loc.TargetPrototype = TargetPrototype;\n package$loc.TransformedTargetLocator = TransformedTargetLocator;\n var package$layout = package$builder.layout || (package$builder.layout = {});\n package$layout.AxisLayout = AxisLayout;\n AxisLayoutInfo.Builder = AxisLayoutInfo$Builder;\n package$layout.AxisLayoutInfo = AxisLayoutInfo;\n Object.defineProperty(EmptyAxisLayout, 'Companion', {\n get: EmptyAxisLayout$Companion_getInstance\n });\n package$layout.EmptyAxisLayout = EmptyAxisLayout;\n Object.defineProperty(FacetGridPlotLayout, 'Companion', {\n get: FacetGridPlotLayout$Companion_getInstance\n });\n package$layout.FacetGridPlotLayout = FacetGridPlotLayout;\n Object.defineProperty(package$layout, 'GeometryUtil', {\n get: GeometryUtil_getInstance\n });\n Object.defineProperty(LegendBoxInfo, 'Companion', {\n get: LegendBoxInfo$Companion_getInstance\n });\n package$layout.LegendBoxInfo = LegendBoxInfo;\n LegendBoxesLayout.Result = LegendBoxesLayout$Result;\n LegendBoxesLayout.BoxWithLocation = LegendBoxesLayout$BoxWithLocation;\n package$layout.LegendBoxesLayout = LegendBoxesLayout;\n Object.defineProperty(package$layout, 'LegendBoxesLayoutUtil', {\n get: LegendBoxesLayoutUtil_getInstance\n });\n package$layout.LiveMapTileLayout = LiveMapTileLayout;\n Object.defineProperty(PlotAxisLayout, 'Companion', {\n get: PlotAxisLayout$Companion_getInstance\n });\n package$layout.PlotAxisLayout = PlotAxisLayout;\n package$layout.PlotLayout = PlotLayout;\n package$layout.PlotLayoutBase = PlotLayoutBase;\n package$layout.PlotLayoutInfo = PlotLayoutInfo;\n Object.defineProperty(package$layout, 'PlotLayoutUtil', {\n get: PlotLayoutUtil_getInstance\n });\n package$layout.SingleTilePlotLayout = SingleTilePlotLayout;\n package$layout.TileLayout = TileLayout;\n package$layout.TileLayoutInfo_init_aeujc5$ = TileLayoutInfo_init;\n package$layout.TileLayoutInfo = TileLayoutInfo;\n Object.defineProperty(package$layout, 'XYPlotLayoutUtil', {\n get: XYPlotLayoutUtil_getInstance\n });\n Object.defineProperty(XYPlotTileLayout, 'Companion', {\n get: XYPlotTileLayout$Companion_getInstance\n });\n package$layout.XYPlotTileLayout = XYPlotTileLayout;\n var package$axis = package$layout.axis || (package$layout.axis = {});\n package$axis.AdaptableAxisBreaksProvider = AdaptableAxisBreaksProvider;\n package$axis.AxisBreaksProvider = AxisBreaksProvider;\n Object.defineProperty(package$axis, 'AxisBreaksUtil', {\n get: AxisBreaksUtil_getInstance\n });\n Object.defineProperty(AxisLayouter, 'Companion', {\n get: AxisLayouter$Companion_getInstance\n });\n package$axis.AxisLayouter = AxisLayouter;\n package$axis.FixedAxisBreaksProvider = FixedAxisBreaksProvider;\n package$axis.HorizontalAxisLayouter = HorizontalAxisLayouter;\n package$axis.VerticalAxisLayouter = VerticalAxisLayouter;\n Object.defineProperty(AbstractFixedBreaksLabelsLayout, 'Companion', {\n get: AbstractFixedBreaksLabelsLayout$Companion_getInstance\n });\n var package$label = package$axis.label || (package$axis.label = {});\n package$label.AbstractFixedBreaksLabelsLayout = AbstractFixedBreaksLabelsLayout;\n Object.defineProperty(AxisLabelsLayout, 'Companion', {\n get: AxisLabelsLayout$Companion_getInstance\n });\n package$label.AxisLabelsLayout = AxisLabelsLayout;\n AxisLabelsLayoutInfo.Builder = AxisLabelsLayoutInfo$Builder;\n package$label.AxisLabelsLayoutInfo = AxisLabelsLayoutInfo;\n Object.defineProperty(package$label, 'BreakLabelsLayoutUtil', {\n get: BreakLabelsLayoutUtil_getInstance\n });\n package$label.HorizontalFixedBreaksLabelsLayout = HorizontalFixedBreaksLabelsLayout;\n package$label.HorizontalFlexBreaksLabelsLayout = HorizontalFlexBreaksLabelsLayout;\n Object.defineProperty(HorizontalMultilineLabelsLayout, 'Companion', {\n get: HorizontalMultilineLabelsLayout$Companion_getInstance\n });\n package$label.HorizontalMultilineLabelsLayout = HorizontalMultilineLabelsLayout;\n Object.defineProperty(HorizontalSimpleLabelsLayout, 'Companion', {\n get: HorizontalSimpleLabelsLayout$Companion_getInstance\n });\n package$label.HorizontalSimpleLabelsLayout = HorizontalSimpleLabelsLayout;\n Object.defineProperty(HorizontalTiltedLabelsLayout, 'Companion', {\n get: HorizontalTiltedLabelsLayout$Companion_getInstance\n });\n package$label.HorizontalTiltedLabelsLayout = HorizontalTiltedLabelsLayout;\n Object.defineProperty(HorizontalVerticalLabelsLayout, 'Companion', {\n get: HorizontalVerticalLabelsLayout$Companion_getInstance\n });\n package$label.HorizontalVerticalLabelsLayout = HorizontalVerticalLabelsLayout;\n package$label.VerticalFixedBreaksLabelsLayout = VerticalFixedBreaksLabelsLayout;\n package$label.VerticalFlexBreaksLabelsLayout = VerticalFlexBreaksLabelsLayout;\n Object.defineProperty(Defaults$Common, 'Title', {\n get: Defaults$Common$Title_getInstance\n });\n Object.defineProperty(Defaults$Common, 'Legend', {\n get: Defaults$Common$Legend_getInstance\n });\n Object.defineProperty(Defaults$Common, 'Tooltip', {\n get: Defaults$Common$Tooltip_getInstance\n });\n Defaults.prototype.Common = Defaults$Common;\n Object.defineProperty(Defaults$Table, 'Head', {\n get: Defaults$Table$Head_getInstance\n });\n Object.defineProperty(Defaults$Table, 'Data', {\n get: Defaults$Table$Data_getInstance\n });\n Defaults.prototype.Table = Defaults$Table;\n Object.defineProperty(Defaults$Plot, 'Axis', {\n get: Defaults$Plot$Axis_getInstance\n });\n Defaults.prototype.Plot = Defaults$Plot;\n var package$presentation = package$builder.presentation || (package$builder.presentation = {});\n Object.defineProperty(package$presentation, 'Defaults', {\n get: Defaults_getInstance\n });\n Object.defineProperty(package$presentation, 'LabelCss', {\n get: LabelCss_getInstance\n });\n package$presentation.Serializable = Serializable;\n Object.defineProperty(LabelMetrics, 'Companion', {\n get: LabelMetrics$Companion_getInstance\n });\n package$presentation.LabelMetrics_init = LabelMetrics_init;\n package$presentation.LabelMetrics_init_7trt9e$ = LabelMetrics_init_0;\n package$presentation.LabelMetrics = LabelMetrics;\n package$presentation.LabelSpec = LabelSpec;\n Object.defineProperty(PlotLabelSpec, 'PLOT_TITLE', {\n get: PlotLabelSpec$PLOT_TITLE_getInstance\n });\n Object.defineProperty(PlotLabelSpec, 'AXIS_TICK', {\n get: PlotLabelSpec$AXIS_TICK_getInstance\n });\n Object.defineProperty(PlotLabelSpec, 'AXIS_TICK_SMALL', {\n get: PlotLabelSpec$AXIS_TICK_SMALL_getInstance\n });\n Object.defineProperty(PlotLabelSpec, 'AXIS_TITLE', {\n get: PlotLabelSpec$AXIS_TITLE_getInstance\n });\n Object.defineProperty(PlotLabelSpec, 'LEGEND_TITLE', {\n get: PlotLabelSpec$LEGEND_TITLE_getInstance\n });\n Object.defineProperty(PlotLabelSpec, 'LEGEND_ITEM', {\n get: PlotLabelSpec$LEGEND_ITEM_getInstance\n });\n package$presentation.PlotLabelSpec = PlotLabelSpec;\n Object.defineProperty(package$presentation, 'Style', {\n get: Style_getInstance\n });\n var package$sampling = package$builder.sampling || (package$builder.sampling = {});\n package$sampling.GroupAwareSampling = GroupAwareSampling;\n package$sampling.PointSampling = PointSampling;\n package$sampling.Sampling = Sampling;\n Object.defineProperty(package$sampling, 'Samplings', {\n get: Samplings_getInstance\n });\n Object.defineProperty(GroupRandomSampling, 'Companion', {\n get: GroupRandomSampling$Companion_getInstance\n });\n var package$method = package$sampling.method || (package$sampling.method = {});\n package$method.GroupRandomSampling = GroupRandomSampling;\n package$method.GroupSamplingBase = GroupSamplingBase;\n Object.defineProperty(GroupSystematicSampling, 'Companion', {\n get: GroupSystematicSampling$Companion_getInstance\n });\n package$method.GroupSystematicSampling = GroupSystematicSampling;\n Object.defineProperty(PickSampling, 'Companion', {\n get: PickSampling$Companion_getInstance\n });\n package$method.PickSampling = PickSampling;\n Object.defineProperty(RandomSampling, 'Companion', {\n get: RandomSampling$Companion_getInstance\n });\n package$method.RandomSampling = RandomSampling;\n Object.defineProperty(RandomStratifiedSampling, 'Companion', {\n get: RandomStratifiedSampling$Companion_getInstance\n });\n package$method.RandomStratifiedSampling = RandomStratifiedSampling;\n package$method.SamplingBase = SamplingBase;\n Object.defineProperty(package$method, 'SamplingUtil', {\n get: SamplingUtil_getInstance\n });\n Object.defineProperty(SystematicSampling, 'Companion', {\n get: SystematicSampling$Companion_getInstance\n });\n package$method.SystematicSampling = SystematicSampling;\n Object.defineProperty(VertexSampling$VertexVwSampling, 'Companion', {\n get: VertexSampling$VertexVwSampling$Companion_getInstance\n });\n VertexSampling.VertexVwSampling = VertexSampling$VertexVwSampling;\n Object.defineProperty(VertexSampling$VertexDpSampling, 'Companion', {\n get: VertexSampling$VertexDpSampling$Companion_getInstance\n });\n VertexSampling.VertexDpSampling = VertexSampling$VertexDpSampling;\n VertexSampling.DoubleVectorComponentsList = VertexSampling$DoubleVectorComponentsList;\n Object.defineProperty(VertexSampling, 'Companion', {\n get: VertexSampling$Companion_getInstance\n });\n package$method.VertexSampling = VertexSampling;\n var package$scale = package$builder.scale || (package$builder.scale = {});\n package$scale.ContinuousOnlyMapperProvider = ContinuousOnlyMapperProvider;\n Object.defineProperty(package$scale, 'DefaultMapperProvider', {\n get: DefaultMapperProvider_getInstance\n });\n Object.defineProperty(package$scale, 'DefaultMapperProviderUtil', {\n get: DefaultMapperProviderUtil_getInstance\n });\n Object.defineProperty(package$scale, 'DefaultNaValue', {\n get: DefaultNaValue_getInstance\n });\n package$scale.DiscreteOnlyMapperProvider = DiscreteOnlyMapperProvider;\n package$scale.GuideMapper = GuideMapper;\n package$scale.MapperProvider = MapperProvider;\n package$scale.ScaleProvider = ScaleProvider;\n package$scale.ScaleProviderBuilder = ScaleProviderBuilder;\n Object.defineProperty(package$scale, 'ScaleProviderHelper', {\n get: ScaleProviderHelper_getInstance\n });\n package$scale.WithGuideBreaks = WithGuideBreaks;\n var package$mapper = package$scale.mapper || (package$scale.mapper = {});\n Object.defineProperty(package$mapper, 'ColorMapper', {\n get: ColorMapper_getInstance\n });\n package$mapper.GuideMapperAdapter = GuideMapperAdapter;\n package$mapper.GuideMapperWithGuideBreaks = GuideMapperWithGuideBreaks;\n Object.defineProperty(package$mapper, 'GuideMappers', {\n get: GuideMappers_getInstance\n });\n Object.defineProperty(package$mapper, 'LineTypeMapper', {\n get: LineTypeMapper_getInstance\n });\n Object.defineProperty(package$mapper, 'ShapeMapper', {\n get: ShapeMapper_getInstance\n });\n Object.defineProperty(AlphaMapperProvider, 'Companion', {\n get: AlphaMapperProvider$Companion_getInstance\n });\n var package$provider = package$scale.provider || (package$scale.provider = {});\n package$provider.AlphaMapperProvider = AlphaMapperProvider;\n Object.defineProperty(ColorBrewerMapperProvider, 'Companion', {\n get: ColorBrewerMapperProvider$Companion_getInstance\n });\n package$provider.ColorBrewerMapperProvider = ColorBrewerMapperProvider;\n Object.defineProperty(ColorGradient2MapperProvider, 'Companion', {\n get: ColorGradient2MapperProvider$Companion_getInstance\n });\n package$provider.ColorGradient2MapperProvider = ColorGradient2MapperProvider;\n Object.defineProperty(ColorGradientMapperProvider, 'Companion', {\n get: ColorGradientMapperProvider$Companion_getInstance\n });\n package$provider.ColorGradientMapperProvider = ColorGradientMapperProvider;\n Object.defineProperty(ColorHueMapperProvider, 'Companion', {\n get: ColorHueMapperProvider$Companion_getInstance\n });\n package$provider.ColorHueMapperProvider = ColorHueMapperProvider;\n package$provider.DirectlyProportionalMapperProvider = DirectlyProportionalMapperProvider;\n Object.defineProperty(GreyscaleLightnessMapperProvider, 'Companion', {\n get: GreyscaleLightnessMapperProvider$Companion_getInstance\n });\n package$provider.GreyscaleLightnessMapperProvider = GreyscaleLightnessMapperProvider;\n Object.defineProperty(HSVColorMapperProvider, 'Companion', {\n get: HSVColorMapperProvider$Companion_getInstance\n });\n package$provider.HSVColorMapperProvider = HSVColorMapperProvider;\n package$provider.IdentityDiscreteMapperProvider = IdentityDiscreteMapperProvider;\n package$provider.IdentityMapperProvider = IdentityMapperProvider;\n package$provider.LinearNormalizingMapperProvider = LinearNormalizingMapperProvider;\n package$provider.MapperProviderBase = MapperProviderBase;\n Object.defineProperty(SizeAreaMapperProvider, 'Companion', {\n get: SizeAreaMapperProvider$Companion_getInstance\n });\n package$provider.SizeAreaMapperProvider = SizeAreaMapperProvider;\n Object.defineProperty(SizeMapperProvider, 'Companion', {\n get: SizeMapperProvider$Companion_getInstance\n });\n package$provider.SizeMapperProvider = SizeMapperProvider;\n var package$theme = package$builder.theme || (package$builder.theme = {});\n package$theme.AxisTheme = AxisTheme;\n package$theme.DefaultAxisTheme = DefaultAxisTheme;\n Object.defineProperty(DefaultTheme, 'Companion', {\n get: DefaultTheme$Companion_getInstance\n });\n package$theme.DefaultTheme = DefaultTheme;\n package$theme.FacetsTheme = FacetsTheme;\n package$theme.LegendTheme = LegendTheme;\n package$theme.PlotTheme = PlotTheme;\n package$theme.Theme = Theme;\n var package$tooltip = package$builder.tooltip || (package$builder.tooltip = {});\n package$tooltip.ConstantValue = ConstantValue;\n package$tooltip.DataFrameValue = DataFrameValue;\n package$tooltip.MappingValue = MappingValue;\n Object.defineProperty(TooltipLine, 'Companion', {\n get: TooltipLine$Companion_getInstance\n });\n package$tooltip.TooltipLine_init_3f4yhq$ = TooltipLine_init;\n package$tooltip.TooltipLine = TooltipLine;\n Object.defineProperty(TooltipSpecification$TooltipProperties, 'Companion', {\n get: TooltipSpecification$TooltipProperties$Companion_getInstance\n });\n TooltipSpecification.TooltipProperties = TooltipSpecification$TooltipProperties;\n Object.defineProperty(TooltipSpecification, 'Companion', {\n get: TooltipSpecification$Companion_getInstance\n });\n package$tooltip.TooltipSpecification = TooltipSpecification;\n package$tooltip.ValueSource = ValueSource;\n BogusCoordinateSystem.prototype.isPointInLimits_k2qmv6$ = CoordinateSystem.prototype.isPointInLimits_k2qmv6$;\n BogusCoordinateSystem.prototype.isRectInLimits_fd842m$ = CoordinateSystem.prototype.isRectInLimits_fd842m$;\n BogusCoordinateSystem.prototype.isPathInLimits_f6t8kh$ = CoordinateSystem.prototype.isPathInLimits_f6t8kh$;\n BogusCoordinateSystem.prototype.isPolygonInLimits_f6t8kh$ = CoordinateSystem.prototype.isPolygonInLimits_f6t8kh$;\n LayerTargetCollectorWithLocator.prototype.addPoint_cnsimy$ = GeomTargetCollector.prototype.addPoint_cnsimy$;\n LayerTargetCollectorWithLocator.prototype.addRectangle_bxzvr8$ = GeomTargetCollector.prototype.addRectangle_bxzvr8$;\n LayerTargetCollectorWithLocator.prototype.addPath_sa5m83$ = GeomTargetCollector.prototype.addPath_sa5m83$;\n LayerTargetCollectorWithLocator.prototype.addPolygon_sa5m83$ = GeomTargetCollector.prototype.addPolygon_sa5m83$;\n DefaultAxisTheme.prototype.tickLabelDistance = AxisTheme.prototype.tickLabelDistance;\n Kotlin.defineModule('lets-plot-plot-builder-portable', _);\n return _;\n}));\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9MZXRzUGxvdC8uL2tvdGxpbi1kY2UtZG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Vha3MsXG4gICAgICAgIHNjYWxlOiBTY2FsZTxEb3VibGU+LFxuICAgICAgICBjb29yZDogQ29vcmRpbmF0ZVN5c3RlbSxcbiAgICAgICAgaG9yaXpvbnRhbDogQm9vbGVhblxuICAgICk6IExpc3Q8RG91YmxlPiB7XG4gICAgICAgIHZhbCBicmVha3NNYXBwZWQgPSBTY2FsZVV0aWwubWFwKHNjYWxlQnJlYWtzLnRyYW5zZm9ybWVkVmFsdWVzLCBzY2FsZSkubWFwIHtcbiAgICAgICAgICAgIC8vIERvbid0IGV4cGVjdCBOVUxMcy5cbiAgICAgICAgICAgIGl0IGFzIERvdWJsZVxuICAgICAgICB9XG4gICAgICAgIHZhbCBheGlzQnJlYWtzID0gQXJyYXlMaXN0PERvdWJsZT4oKVxuICAgICAgICBmb3IgKGJyIGluIGJyZWFrc01hcHBlZCkge1xuICAgICAgICAgICAgdmFsIG1hcHBlZEJyUG9pbnQgPSB3aGVuIChob3Jpem9udGFsKSB7XG4gICAgICAgICAgICAgICAgdHJ1ZSAtPiBEb3VibGVWZWN0b3IoYnIsIDAuMClcbiAgICAgICAgICAgICAgICBmYWxzZSAtPiBEb3VibGVWZWN0b3IoMC4wLCBicilcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIGF4aXNCclBvaW50ID0gY29vcmQudG9DbGllbnQobWFwcGVkQnJQb2ludClcbiAgICAgICAgICAgIHZhbCBheGlzQnIgPSBpZiAoaG9yaXpvbnRhbClcbiAgICAgICAgICAgICAgICBheGlzQnJQb2ludC54XG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgYXhpc0JyUG9pbnQueVxuXG4gICAgICAgICAgICBheGlzQnJlYWtzLmFkZChheGlzQnIpXG4gICAgICAgICAgICBpZiAoIWF4aXNCci5pc0Zpbml0ZSgpKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKFxuICAgICAgICAgICAgICAgICAgICBcIklsbGVnY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5kZXJlckRhdGEge1xuXG4gICAgICAgIHZhbCBhZXN0aGV0aWNNYXBwZXJzID1cbiAgICAgICAgICAgIFBsb3RVdGlsLnByZXBhcmVMYXllckFlc3RoZXRpY01hcHBlcnMobGF5ZXIsIHNoYXJlZE51bWVyaWNNYXBwZXJzKVxuICAgICAgICB2YWwgYWVzdGhldGljcyA9IFBsb3RVdGlsLmNyZWF0ZUxheWVyQWVzdGhldGljcyhcbiAgICAgICAgICAgIGxheWVyLFxuICAgICAgICAgICAgYWVzdGhldGljTWFwcGVycyxcbiAgICAgICAgICAgIG92ZXJhbGxOdW1lcmljRG9tYWluc1xuICAgICAgICApXG4gICAgICAgIHZhbCBwb3MgPSBQbG90VXRpbC5jcmVhdGVMYXllclBvcyhsYXllciwgYWVzdGhldGljcylcbiAgICAgICAgcmV0dXJuIExheWVyUmVuZGVyZXJEYXRhKFxuICAgICAgICAgICAgbGF5ZXIsXG4gICAgICAgICAgICBhZXN0aGV0aWNzLFxuICAgICAgICAgICAgYWVzdGhldGljTWFwcGVycyxcbiAgICAgICAgICAgIHBvc1xuICAgICAgICApXG4gICAgfVxuXG4gICAgY2xhc3MgTGF5ZXJSZW5kZXJlckRhdGEoXG4gICAgICAgIGxheWVyOiBHZW9tTGF5ZXIsXG4gICAgICAgIHZhbCBhZXN0aGV0aWNzOiBBZXN0aGV0aWNzLFxuICAgICAgICB2YWwgYWVzdGhldGljTWFwcGVyczogTWFwPEFlczwqPiwgKERvdWJsZT8pIC0+IEFueT8+LFxuICAgICAgICB2YWwgcG9zOiBQb3NpdGlvbkFkanVzdG1lbnRcbiAgICApIHtcbiAgICAgICAgdmFsIGdlb206IEdlb20gPSBsYXllci5nZW9tXG4gICAgICAgIHZhbCBnZW9tS2luZDogR2VvbUtpbmQgPSBsYXllci5nZW9tS2luZFxuICAgICAgICB2YWwgZGF0YUFjY2VzczogTWFwcGVkRGF0YUFjY2VzcyA9IGxheWVyLmRhdGFBY2Nlc3NcbiAgICAgICAgdmFsIGNv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hbWUsIGlmIChyb290Q2F1c2UubWVzc2FnZSAhPSBudWxsKVxuICAgICAgICAgICAgICAgICAgICBcIidcIiArIHJvb3RDYXVzZS5tZXNzYWdlICsgXCInXCJcbiAgICAgICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgICAgIFwiPG5vIG1lc3NhZ2U+XCJcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIHZhciB5ID0gbXlQcmVmZXJyZWRTaXplLmdldCgpLnkgLyAyIC0gOFxuICAgICAgICAgICAgZm9yIChzIGluIG1lc3NhZ2VzKSB7XG4gICAgICAgICAgICAgICAgdmFsIGVycm9yTGFiZWwgPSBUZXh0TGFiZWwocylcbiAgICAgICAgICAgICAgICBlcnJvckxhYmVsLnNldEhvcml6b250YWxBbmNob3IoSG9yaXpvbnRhbEFuY2hvci5NSURETEUpXG4gICAgICAgICAgICAgICAgZXJyb3JMYWJlbC5zZXRWZXJ0aWNhbEFuY2hvcihWZXJ0aWNhbEFuY2hvci5DRU5URVIpXG4gICAgICAgICAgICAgICAgZXJyb3JMYWJlbC5tb3ZlVG8obXlQcmVmZXJyZWRTaXplLmdldCgpLnggLyAyLCB5KVxuICAgICAgICAgICAgICAgIHJvb3RHcm91cC5jaGlsZHJlbigpLmFkZChlcnJvckxhYmVsLnJvb3RHcm91cClcbiAgICAgICAgICAgICAgICB5ICs9IDE2LjBcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGJ1aWxkUGxvdCgpIHtcbiAgICAgICAgcm9vdEdyb3VwLmFkZENsYXNzKFN0eWxlLlBMT1QpXG4gICAgICAgIGJ1aWxkUGxvdENvbXBvbmVudHMoKVxuICAgICAgICByZWcobXlQcmVmZXJyZWRTaXplLmFkZEhhbmRsZXIob2JqZWN0IDogRXZlbnRIYW5kbGVyPFByb3BlcnR5Q2hhbmdlRXZlbnQ8b3V0IERvdWJsZVZlY3Rvcj4+IHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBvbkV2ZW50KGV2ZW50OiBQcm9wZXJ0eUNoYW5nZUV2ZW50PG91dCBEb3VibGVWZWN0b3I+KSB7XG4gICAgICAgICAgICAgICAgdmFsIG5ld1ZhbHVlID0gZXZlbnQubmV3VmFsdWVcbiAgICAgICAgICAgICAgICBpZiAobmV3VmFsdWUhIS54ID4gMCAmJiBuZXdWYWx1ZS55ID4gMCkge1xuICAgICAgICAgICAgICAgICAgICByZWJ1aWxkUGxvdCgpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KSlcblxuICAgICAgICByZWcob2JqZWN0IDogUmVnaXN0cmF0aW9uKCkge1xuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGRvUmVtb3ZlKCkge1xuICAgICAgICAgICAgICAgIG15VG9vbHRpcEhlbHBlci5yZW1vdmVBbGxUaWxlSW5mb3MoKVxuICAgICAgICAgICAgICAgIG15TGl2ZU1hcEZpZ3VyZXMuY2xlYXIoKVxuICAgICAgICAgICAgfVxuICAgICAgICB9KVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHJlYnVpbGRQbG90KCkge1xuICAgICAgICBjbGVhcigpXG4gICAgICAgIGJ1aWxkUGxvdCgpXG4gICAgfVxuXG5cbiAgICBwcml2YXRlIGZ1biBjcmVhdGVUaWxlKFxuICAgICAgICB0aWxlc09yaWdpbjogRG91YmxlVmVjdG9yLFxuICAgICAgICB0aWxlSW5mbzogVGlsZUxheW91dEluZm8sXG4gICAgICAgIHRpbGVMYXllcnM6IExpc3Q8R2VvbUxheWVyPixcbiAgICAgICAgdGhlbWU6IFRoZW1lXG4gICAgKTogUGxvdFRpbGUge1xuXG4gICAgICAgIHZhbCB4U2NhbGU6IFNjYWxlPERvdWJsZT5cbiAgICAgICAgdmFsIHlTY2FsZTogU2NhbGU8RG91YmxlPlxuICAgICAgICB2YWwgY29vcmQ6IENvb3JkaW5hdGVTeXN0ZW1cbiAgICAgICAgaWYgKHR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C4wXG4gICAgICAgIHdoZW4gKG9yaWVudGF0aW9uKSB7XG4gICAgICAgICAgICBPcmllbnRhdGlvbi5MRUZUIC0+IHtcbiAgICAgICAgICAgICAgICB0aXRsZUxvY2F0aW9uID1cbiAgICAgICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHBsb3RCb3VuZHMubGVmdCArIFBsb3RMYXlvdXRVdGlsLkFYSVNfVElUTEVfT1VURVJfTUFSR0lOLCBnZW9tQm91bmRzLmNlbnRlci55KVxuICAgICAgICAgICAgICAgIHJvdGF0aW9uID0gLTkwLjBcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIE9yaWVudGF0aW9uLlJJR0hUIC0+IHtcbiAgICAgICAgICAgICAgICB0aXRsZUxvY2F0aW9uID1cbiAgICAgICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHBsb3RCb3VuZHMucmlnaHQgLSBQbG90TGF5b3V0VXRpbC5BWElTX1RJVExFX09VVEVSX01BUkdJTiwgZ2VvbUJvdW5kcy5jZW50ZXIueSlcbiAgICAgICAgICAgICAgICByb3RhdGlvbiA9IDkwLjBcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIE9yaWVudGF0aW9uLlRPUCAtPiB0aXRsZUxvY2F0aW9uID1cbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IoZ2VvbUJvdW5kcy5jZW50ZXIueCwgcGxvdEJvdW5kcy50b3AgKyBQbG90TGF5b3V0VXRpbC5BWElTX1RJVExFX09VVEVSX01BUkdJTilcbiAgICAgICAgICAgIE9yaWVudGF0aW9uLkJPVFRPTSAtPiB0aXRsZUxvY2F0aW9uID1cbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IoZ2VvbUJvdW5kcy5jZW50ZXIueCwgcGxvdEJvdW5kcy5ib3R0b20gLSBQbG90TGF5b3V0VXRpbC5BWElTX1RJVExFX09VVEVSX01BUkdJTilcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCB0aXRsZUxhYmVsID0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gICAgQFN1cHByZXNzKFwiQ29uc3RhbnRDb25kaXRpb25JZlwiKVxuICAgICAgICBpZiAoREVCVUdfRFJBV0lORykge1xuICAgICAgICAgICAgdmFsIHJlY3QgPSBTdmdSZWN0RWxlbWVudCh3aXRob3V0VGl0bGVBbmRMZWdlbmRzKVxuICAgICAgICAgICAgcmVjdC5zdHJva2VDb2xvcigpLnNldChDb2xvci5CTFVFKVxuICAgICAgICAgICAgcmVjdC5zdHJva2VXaWR0aCgpLnNldCgxLjApXG4gICAgICAgICAgICByZWN0LmZpbGxPcGFjaXR5KCkuc2V0KDAuMClcbiAgICAgICAgICAgIG9uTW91c2VNb3ZlKHJlY3QsIFwiQkxVRTogcGxvdCB3aXRob3V0IHRpdGxlIGFuZCBsZWdlbmRzOiAkd2l0aG91dFRpdGxlQW5kTGVnZW5kc1wiKVxuICAgICAgICAgICAgYWRkKHJlY3QpXG4gICAgICAgIH1cblxuICAgICAgICAvLyBzdWJ0cmFjdCBsZWZ0IGF4aXMgdGl0bGUgd2lkdGhcbiAgICAgICAgdmFyIGdlb21BbmRBeGlzID0gd2l0aG91dFRpdGxlQW5kTGVnZW5kc1xuICAgICAgICBpZiAoaXNBeGlzRW5hYmxlZCkge1xuICAgICAgICAgICAgaWYgKGhhc0F4aXNUaXRsZUxlZnQoKSkge1xuICAgICAgICAgICAgICAgIHZhbCB0aXRsZVNpemUgPSBQbG90TGF5b3V0VXRpbC5heGlzVGl0bGVEaW1lbnNpb25zKGF4aXNUaXRsZUxlZnQpXG4gICAgICAgICAgICAgICAgdmFsIHRoaWNrbmVzcyA9XG4gICAgICAgICAgICAgICAgICAgIHRpdGxlU2l6ZS55ICsgUGxvdExheW91dFV0aWwuQVhJU19USVRMRV9PVVRFUl9NQVJHSU4gKyBQbG90TGF5b3V0VXRpbC5BWElTX1RJVExFX0lOTkVSX01BUkdJTlxuICAgICAgICAgICAgICAgIGdlb21BbmRBeGlzID0gRG91YmxlUmVjdGFuZ2xlKFxuICAgICAgICAgICAgICAgICAgICBnZW9tQW5kQXhpcy5sZWZ0ICsgdGhpY2tuZXNzLCBnZW9tQW5kQXhpcy50b3AsXG4gICAgICAgICAgICAgICAgICAgIGdlb21BbmRBeGlzLndpZHRoIC0gdGhpY2tuZXNzLCBnZW9tQW5kQXhpcy5oZWlnaHRcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIHN1YnRyYWN0IGJvdHRvbSBheGlzIHRpdGxlIGhlaWdodFxuICAgICAgICAgICAgaWYgKGhhc0F4aXNUaXRsZUJvdHRvbSgpKSB7XG4gICAgICAgICAgICAgICAgdmFsIHRpdGxlU2l6ZSA9IFBsb3RMYXlvdXRVdGlsLmF4aXNUaXRsZURpbWVuc2lvbnMoYXhpc1RpdGxlQm90dG9tKVxuICAgICAgICAgICAgICAgIHZhbCB0aGlja25lc3MgPVxuICAgICAgICAgICAgICAgICAgICB0aXRsZVNpemUueSArIFBsb3RMYXlvdXRVdGlsLkFYSVNfVElUTEVfT1VURVJfTUFSR0lOICsgUGxvdExheW91dFV0aWwuQVhJU19USVRMRV9JTk5FUl9NQVJHSU5cbiAgICAgICAgICAgICAgICBnZW9tQW5kQXhpcyA9IERvdWJsZVJlY3RhbmdsZShcbiAgICAgICAgICAgICAgICAgICAgZ2VvbUFuZEF4aXMubGVmdCwgZ2VvbUFuZEF4aXMudG9wLFxuICAgICAgICAgICAgICAgICAgICBnZW9tQW5kQXhpcy53aWR0aCwgZ2VvbUFuZEF4aXMuaGVpZ2h0IC0gdGhpY2tuZXNzXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gTGF5b3V0IHBsb3QgaW5uZXJzXG4gICAgICAgIHZhbCBwbG90TGF5b3V0ID0gcGxvdExheW91dCgpXG4gICAgICAgIHZhbCBwbG90SW5mbyA9IHBsb3RMYXlvdXQuZG9MYXlvdXQoZ2VvbUFuZEF4aXMuZGltZW5zaW9uK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aXRsZUxhYmVsKVxuXG4gICAgICAgICAgICBAU3VwcHJlc3MoXCJDb25zdGFudENvbmRpdGlvbklmXCIpXG4gICAgICAgICAgICBpZiAoREVCVUdfRFJBV0lORykge1xuICAgICAgICAgICAgICAgIHZhbCByZWN0ID0gU3ZnUmVjdEVsZW1lbnQodGl0bGVCb3VuZHMpXG4gICAgICAgICAgICAgICAgcmVjdC5zdHJva2VDb2xvcigpLnNldChDb2xvci5CTFVFKVxuICAgICAgICAgICAgICAgIHJlY3Quc3Ryb2tlV2lkdGgoKS5zZXQoMS4wKVxuICAgICAgICAgICAgICAgIHJlY3QuZmlsbE9wYWNpdHkoKS5zZXQoMC4wKVxuICAgICAgICAgICAgICAgIGFkZChyZWN0KVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gYWRkIGF4aXMgdGl0bGVzXG4gICAgICAgIGlmIChpc0F4aXNFbmFibGVkKSB7XG4gICAgICAgICAgICBpZiAoaGFzQXhpc1RpdGxlTGVmdCgpKSB7XG4gICAgICAgICAgICAgICAgY3JlYXRlQXhpc1RpdGxlKFxuICAgICAgICAgICAgICAgICAgICBheGlzVGl0bGVMZWZ0LFxuICAgICAgICAgICAgICAgICAgICBPcmllbnRhdGlvbi5MRUZULFxuICAgICAgICAgICAgICAgICAgICB3aXRob3V0VGl0bGVBbmRMZWdlbmRzLFxuICAgICAgICAgICAgICAgICAgICBnZW9tQXJlYUJvdW5kc1xuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChoYXNBeGlzVGl0bGVCb3R0b20oKSkge1xuICAgICAgICAgICAgICAgIGNyZWF0ZUF4aXNUaXRsZShcbiAgICAgICAgICAgICAgICAgICAgYXhpc1RpdGxlQm90dG9tLFxuICAgICAgICAgICAgICAgICAgICBPcmllbnRhdGlvbi5CT1RUT00sXG4gICAgICAgICAgICAgICAgICAgIHdpdGhvdXRUaXRsZUFuZExlZ2VuZHMsXG4gICAgICAgICAgICAgICAgICAgIGdlb21BcmVhQm91bmRzXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gYWRkIGxlZ2VuZHNcbiAgICAgICAgaWYgKGJveGVzTGF5b3V0UmVzdWx0ICE9IG51bGwpIHtcbiAgICAgICAgICAgIGZvciAoYm94V2l0aExvY2F0aW9uIGluIGJveGVzTGF5b3V0UmVzdWx0LmJveFdpdGhMb2NhdGlvbkxpc3QpIHtcbiAgICAgICAgICAgICAgICB2YWwgbGVnZW5kQm94ID0gYm94V2l0aExvY2F0aW9uLmxlZ2VuZEJveC5jcmVhdGVMZWdlbmRCb3goKVxuICAgICAgICAgICAgICAgIGxlZ2VuZEJveC5tb3ZlVG8oYm94V2l0aExvY2F0aW9uLmxvY2F0aW9uKVxuICAgICAgICAgICAgICAgIGFkZChsZWdlbmRCb3gpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gY3JlYXRlVG9vbHRpcFNwZWNzKHBsb3RDb29yZDogRG91YmxlVmVjdG9yKTogTGlzdDxUb29sdGlwU3BlYz4ge1xuICAgICAgICByZXR1cm4gbXlUb29sdGlwSGVscGVyLmNyZWF0ZVRvb2x0aXBTcGVjcyhwbG90Q29vcmQpXG4gICAgfVxuXG4gICAgZnVuIGdldEdlb21Cb3VuZHMocGxvdENvb3JkOiBEb3VibGVWZWN0b3IpOiBEb3VibGVSZWN0YW5nbGU/IHtcbiAgICAgICAgcmV0dXJuIG15VG9vbHRpcEhlbHBlci5nZXRHZW9tQm91bmRzKHBsb3RDb29yZClcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgcHJpdmF0ZSB2YWwgTE9HID0gUG9ydGFibGVMb2dnaW5nLmxvZ2dlcihQbG90OjpjbGFzcylcblxuICAgICAgICBwcml2YXRlIHZhbCBERUZfUExPVF9TSVpFID0gRG91YmxlVmVjdG9yKDYwMC4w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uIG15VGl0bGUhIVxuICAgICAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIHZhbCBheGlzVGl0bGVMZWZ0OiBTdHJpbmdcbiAgICAgICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgICAgICByZXF1aXJlKGhhc0F4aXNUaXRsZUxlZnQoKSkgeyBcIk5vIGxlZnQgYXhpcyB0aXRsZVwiIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gbXlBeGlzVGl0bGVMZWZ0ISFcbiAgICAgICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSB2YWwgYXhpc1RpdGxlQm90dG9tOiBTdHJpbmdcbiAgICAgICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgICAgICByZXF1aXJlKGhhc0F4aXNUaXRsZUJvdHRvbSgpKSB7IFwiTm8gYm90dG9tIGF4aXMgdGl0bGVcIiB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIG15QXhpc1RpdGxlQm90dG9tISFcbiAgICAgICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSB2YWwgbGVnZW5kQm94SW5mb3M6IExpc3Q8TGVnZW5kQm94SW5mbz5cbiAgICAgICAgICAgIGdldCgpID0gbXlMZWdlbmRCb3hJbmZvc1xuXG4gICAgICAgIGluaXQge1xuICAgICAgICAgICAgbXlMYXllcnNCeVRpbGUgPSBBcnJheUxpc3QoYi5teUxheWVyc0J5VGlsZSlcbiAgICAgICAgICAgIG15TGF5b3V0ID0gYi5teUxheW91dFxuICAgICAgICAgICAgbXlMZWdlbmRCb3hJbmZvcyA9IEFycmF5TGlzdChiLm15TGVnZW5kQm94SW5mb3MpXG5cbiAgICAgICAgICAgIGhhc0xpdmVNYXAgPSBiLmhhc0xpdmVNYXBcblxuICAgICAgICAgICAgaXNBeGlzRW5hYmxlZCA9IGIubXlBeGlzRW5hYmxlZFxuICAgICAgICAgICAgaXNJbnRlcmFjdGlvbnNFbmFibGVkID0gYi5teUludGVyYWN0aW9uc0VuYWJsZWRcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBoYXNUaXRsZSgpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiAhU3RyaW5ncy5pc051bGxPckVtcHR5KG15VGl0bGUpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaGFzQXhpc1RpdGxlTGVmdCgpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBteUF4aXNZVGl0bGVFbmFibGVkICYmICFTdHJpbmdzLmlzTnVsbE9yRW1wdHkobXlBeGlzVGl0bGVMZWZ0KVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhhc0F4aXNUaXRsZUJvdHRvbSgpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBteUF4aXNYVGl0bGVFbmFibGVkICYmICFTdHJpbmdzLmlzTnVsbE9yRW1wdHkobXlBeGlzVGl0bGVCb3R0b20pXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaGFzTGl2ZU1hcCgpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBoYXNMaXZlTWFwXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gdGlsZUxheWVycyh0aWxlSW5kZXg6IEludCk6IExpc3Q8R2VvbUxheWVyPiB7XG4gICAgICAgICAgICByZXR1cm4gbXlMYXllcnNCeVRpbGVbdGlsZUluZGV4XVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIHBsb3RMYXlvdXQoKTogUGxvdExheW91dCB7XG4gICAgICAgICAgICByZXR1cm4gbXlMYXlvdXQhIVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYX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LFxuICAgICAgICAgICAgICAgIG1heChwcmVmZXJyZWRTaXplLmdldCgpLnksIGxhaWRPdXRTaXplLnkpXG4gICAgICAgICAgICApXG4gICAgICAgICAgICBzZXRTdmdTaXplKG5ld1N2Z1NpemUpXG4gICAgICAgIH0pXG5cbiAgICAgICAgcHJlZmVycmVkU2l6ZS5hZGRIYW5kbGVyKHNpemVQcm9wSGFuZGxlciB7IG5ld1ByZWZlcnJlZFNpemUgLT5cbiAgICAgICAgICAgIGlmIChuZXdQcmVmZXJyZWRTaXplLnggPiAwICYmIG5ld1ByZWZlcnJlZFNpemUueSA+IDApIHtcbiAgICAgICAgICAgICAgICByZXZhbGlkYXRlQ29udGVudCgpXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pXG4gICAgfVxuXG4gICAgZnVuIGVuc3VyZUNvbnRlbnRCdWlsdCgpIHtcbiAgICAgICAgaWYgKCFteUNvbnRlbnRCdWlsdCkge1xuICAgICAgICAgICAgYnVpbGRDb250ZW50KClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHJldmFsaWRhdGVDb250ZW50KCkge1xuICAgICAgICBpZiAobXlDb250ZW50QnVpbHQpIHtcbiAgICAgICAgICAgIGNsZWFyQ29udGVudCgpXG4gICAgICAgICAgICBidWlsZENvbnRlbnQoKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJvdGVjdGVkIG9wZW4gZnVuIGJ1aWxkQ29udGVudCgpIHtcbiAgICAgICAgY2hlY2soIW15Q29udGVudEJ1aWx0KVxuICAgICAgICBteUNvbnRlbnRCdWlsdCA9IHRydWVcblxuICAgICAgICBzdmcuc2V0U3R5bGUob2JqZWN0IDogU3ZnQ3NzUmVzb3VyY2Uge1xuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGNzcygpOiBTdHJpbmcge1xuICAgICAgICAgICAgICAgIHJldHVybiBTdHlsZS5jc3NcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSlcblxuICAgICAgICAvL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hbWVDb2xvcigpKVxuICAgICAgICAgICAgICAgIHN0cm9rZVdpZHRoKCkuc2V0KDEuMClcbiAgICAgICAgICAgICAgICBmaWxsT3BhY2l0eSgpLnNldCgwLjApXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBhZGQocmVjdClcbiAgICAgICAgfVxuXG4gICAgICAgIGFkZEZhY2V0TGFiZWxzKGdlb21Cb3VuZHMsIG15VGhlbWUuZmFjZXRzKCkpXG5cbiAgICAgICAgdmFsIGxpdmVNYXBHZW9tTGF5ZXIgPSBteUxheWVycy5maXJzdE9yTnVsbCB7IGl0LmlzTGl2ZU1hcCB9XG4gICAgICAgIGlmIChsaXZlTWFwR2VvbUxheWVyID09IG51bGwgJiYgbXlTaG93QXhpcykge1xuICAgICAgICAgICAgYWRkQXhpcyhnZW9tQm91bmRzKVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGlzRGVidWdEcmF3aW5nKSB7XG4gICAgICAgICAgICB2YWwgdGlsZUJvdW5kcyA9IG15TGF5b3V0SW5mby5ib3VuZHNcbiAgICAgICAgICAgIHZhbCByZWN0ID0gU3ZnUmVjdEVsZW1lbnQodGlsZUJvdW5kcylcbiAgICAgICAgICAgIHJlY3QuZmlsbENvbG9yKCkuc2V0KENvbG9yLkJMQUNLKVxuICAgICAgICAgICAgcmVjdC5zdHJva2VXaWR0aCgpLnNldCgwLjApXG4gICAgICAgICAgICByZWN0LmZpbGxPcGFjaXR5KCkuc2V0KDAuMSlcbiAgICAgICAgICAgIGFkZChyZWN0KVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGlzRGVidWdEcmF3aW5nKSB7XG4gICAgICAgICAgICB2YWwgY2xpcEJvdW5kcyA9IG15TGF5b3V0SW5mby5jbGlwQm91bmRzXG4gICAgICAgICAgICB2YWwgcmVjdCA9IFN2Z1JlY3RFbGVtZW50KGNsaXBCb3VuZHMpXG4gICAgICAgICAgICByZWN0LmZpbGxDb2xvcigpLnNldChDb2xvci5EQVJLX0dSRUV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mxlPz4oKVxuICAgICAgICAgICAgdmFsIG92ZXJhbGxOdW1lcmljRG9tYWlucyA9IEhhc2hNYXA8QWVzPERvdWJsZT4sIENsb3NlZFJhbmdlPERvdWJsZT4+KClcblxuICAgICAgICAgICAgdmFsIHhBeGlzSW5mbyA9IG15TGF5b3V0SW5mby54QXhpc0luZm9cbiAgICAgICAgICAgIHZhbCB5QXhpc0luZm8gPSBteUxheW91dEluZm8ueUF4aXNJbmZvXG4gICAgICAgICAgICB2YWwgbWFwcGVyWCA9IG15U2NhbGVYLm1hcHBlclxuICAgICAgICAgICAgdmFsIG1hcHBlclkgPSBteVNjYWxlWS5tYXBwZXJcblxuICAgICAgICAgICAgc2hhcmVkTnVtZXJpY01hcHBlcnNbQWVzLlhdID0gbWFwcGVyWFxuICAgICAgICAgICAgc2hhcmVkTnVtZXJpY01hcHBlcnNbQWVzLlldID0gbWFwcGVyWVxuICAgICAgICAgICAgc2hhcmVkTnVtZXJpY01hcHBlcnNbQWVzLlNMT1BFXSA9IE1hcHBlcnMubXVsKG1hcHBlclkoMS4wKSEhIC8gbWFwcGVyWCgxLjApISEpXG5cbiAgICAgICAgICAgIG92ZXJhbGxOdW1lcmljRG9tYWluc1tBZXMuWF0gPSB4QXhpc0luZm8hIS5heGlzRG9tYWluISFcbiAgICAgICAgICAgIG92ZXJhbGxOdW1lcmljRG9tYWluc1tBZXMuWV0gPSB5QXhpc0luZm8hIS5heGlzRG9tYWluISFcblxuICAgICAgICAgICAgdmFsIGdlb21MYXllckNvbXBvbmVudHMgPSBidWlsZEdlb21zKHNoYXJlZE51bWVyaWNNYXBwZXJzLCBvdmVyYWxsTnVtZXJpY0RvbWFpbnMsIG15Q29vcmQpXG4gICAgICAgICAgICBmb3IgKGxheWVyQ29tcG9uZW50IGluIGdlb21MYXllckNvbXBvbmVudHMpIHtcbiAgICAgICAgICAgICAgICBsYXllckNvbXBvbmVudC5tb3ZlVG8oZ2VvbUJvdW5kcy5vcmlnaW4pXG5cbiAgICAg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gICAgICAgICAgICApXG4gICAgICAgICAgICB2YXIgbGFiZWxCb3VuZHMgPSBEb3VibGVSZWN0YW5nbGUoXG4gICAgICAgICAgICAgICAgbGFiZWxPcmlnLCBsYWJlbFNpemVcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIGZvciAoeExhYmVsIGluIHhMYWJlbHMpIHtcbiAgICAgICAgICAgICAgICB2YWwgcmVjdCA9IFN2Z1JlY3RFbGVtZW50KGxhYmVsQm91bmRzKS5hcHBseSB7XG4gICAgICAgICAgICAgICAgICAgIHN0cm9rZVdpZHRoKCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICAgICAgZmlsbENvbG9yKCkuc2V0KHRoZW1lLmxhYmVsQmFja2dyb3VuZCgpKVxuXG4vLyAgICAgICAgICAgICAgICAgICAgc3Ryb2tlV2lkdGgoKS5zZXQoMS4wKVxuLy8gICAgICAgICAgICAgICAgICAgIHN0cm9rZUNvbG9yKCkuc2V0KENvbG9yLkJMQUNLKVxuLy8gICAgICAgICAgICAgICAgICAgIGZpbGxPcGFjaXR5KCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYWRkKHJlY3QpXG5cbiAgICAgICAgICAgICAgICB2YWwgeCA9IGxhYmVsQm91bmRzLmNlbnRlci54XG4gICAgICAgICAgICAgICAgdmFsIHkgPSBsYWJlbEJvdW5kcy5jZW50ZXIueVxuICAgICAgICAgICAgICAgIHZhbCBsYWIgPSBUZXh0TGFiZWwoeExhYmVsKVxuICAgICAgICAgICAgICAgIGxhYi5tb3ZlVG8oeCwgeSlcbiAgICAgICAgICAgICAgICBsYWIuc2V0SG9yaXpvbnRhbEFuY2hvcihUZXh0TGFiZWwuSG9yaXpvbnRhbEFuY2hvci5NSURETEUpXG4gICAgICAgICAgICAgICAgbGFiLnNldFZlcnRpY2FsQW5jaG9yKFRleHRMYWJlbC5WZXJ0aWNhbEFuY2hvci5DRU5URVIpXG4gICAgICAgICAgICAgICAgYWRkKG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AgICAgICAgICBhZGQoYXhpcylcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGJ1aWxkQXhpcyhcbiAgICAgICAgc2NhbGU6IFNjYWxlPERvdWJsZT4sXG4gICAgICAgIGluZm86IEF4aXNMYXlvdXRJbmZvLFxuICAgICAgICBjb29yZDogQ29vcmRpbmF0ZVN5c3RlbSxcbiAgICAgICAgdGhlbWU6IEF4aXNUaGVtZVxuICAgICk6IEF4aXNDb21wb25lbnQge1xuICAgICAgICB2YWwgYXhpcyA9IEF4aXNDb21wb25lbnQoaW5mby5heGlzTGVuZ3RoLCBpbmZvLm9yaWVudGF0aW9uISEpXG4gICAgICAgIEF4aXNVdGlsLnNldEJyZWFrcyhheGlzLCBzY2FsZSwgY29vcmQsIGluZm8ub3JpZW50YXRpb24uaXNIb3Jpem9udGFsKVxuICAgICAgICBBeGlzVXRpbC5hcHBseUxheW91dEluZm8oYXhpcywgaW5mbylcbiAgICAgICAgQXhpc1V0aWwuYXBwbHlUaGVtZShheGlzLCB0aGVtZSlcbiAgICAgICAgaWYgKGlzRGVidWdEcmF3aW5nKSB7XG4gICAgICAgICAgICBpZiAoaW5mby50aWNrTGFiZWxzQm91bmRzICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICB2YWwgcmVjdCA9IFN2Z1JlY3RFbGVtZW50KGluZm8udGlja0xhYmVsc0JvdW5kcylcbiAgICAgICAgICAgICAgICByZWN0LnN0cm9rZUNvbG9yKCkuc2V0KENvbG9yLkdSRUVOKVxuICAgICAgICAgICAgICAgIHJlY3Quc3Ryb2tlV2lkdGgoKS5zZXQoMS4wKVxuICAgICAgICAgICAgICAgIHJlY3QuZmlsbE9wYWNpdHkoKS5zZXQoMC4wKVxuICAgICAgICAgICAgICAgIGF4aXMuYWRkKHJlY3QpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGF4aXNcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBidWlsZEdlb21zKFxuICAgICAgICBzaGFyZWROdW1lcmljTWFwcGVyczogTWFwPEFlczxEb3VibGU+LCAoRG91YmxlPykgLT4gRG91YmxlPz4sXG4gICAgICAgIG92ZXJhbGxOdW1lcmljRG9tYWluczogTWFwPEFlczxEb3VibGU+LCBDbG9zZWRSYW5nZTxEb3VibGU+PixcbiAgICAgICAgY29vcmQ6IENvb3JkaW5hdGVTeXN0ZW1cbiAgICApOiBMaXN0PFN2Z0NvbXBvbmVudD4ge1xuXG4gICAgICAgIHZhbCBsYXllclJlbmRlcmVycyA9IEFycmF5TGlzdDxTdmdDb21wb25lbnQ+KClcbiAgICAgICAgZm9yIChsYXllciBpbiBteUxheWVycykge1xuICAgICAgICAgICAgdmFsIHJlbmRlcmVyRGF0YSA9IExheWVyUmVuZGVyZXJVdGlsLmNyZWF0ZUxheWVyUmVuZGVyZXJEYXRhKFxuICAgICAgICAgICAgICAgIGxheWVyLFxuICAgICAgICAgICAgICAgIHNoYXJlZE51bWVyaWNNYXBwZXJzLFxuICAgICAgICAgICAgICAgIG92ZXJhbGxOdW1lcmljRG9tYWluc1xuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICB2YWwgYWVzdGhldGljTWFwcGVycyA9IHJlbmRlcmVyRGF0YS5hZXN0aGV0aWNNYXBwZXJzXG4gICAgICAgICAgICB2YWwgYWVzdGhldGljcyA9IHJlbmRlcmVyRGF0YS5hZXN0aGV0aWNzXG5cbiAgICAgICAgICAgIHZhbCB0YXJnZXRDb2xsZWN0b3IgPSBMYXllclRhcmdldENvbGxlY3RvcldpdGhMb2NhdG9yKFxuICAgICAgICAgICAgICAgIGxheWVyLmdlb21LaW5kLFxuICAgICAgICAgICAgICAgIGxheWVyLmxvY2F0b3JMb29rdXBTcGVjLFxuICAgICAgICAgICAgICAgIGxheWVyLmNvbnRleHR1YWxNYXBwaW5nLFxuICAgICAgICAgICAgICAgIGNvb3JkXG4gICAgICAgICAgICApXG4gICAgICAgICAgICBteVRhcmdldExvY2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ldExvY2F0b3IoaXQpIH1cblxuICAgICAgICBpbnRlcm5hbCB2YWwgYXhpc09yaWdpbjogRG91YmxlVmVjdG9yXG4gICAgICAgICAgICBnZXQoKSA9IERvdWJsZVZlY3RvcihnZW9tQm91bmRzLmxlZnQsIGdlb21Cb3VuZHMuYm90dG9tKVxuXG4gICAgICAgIGludGVybmFsIGZ1biBmaW5kVGFyZ2V0cyhwbG90Q29vcmQ6IERvdWJsZVZlY3Rvcik6IExpc3Q8TG9va3VwUmVzdWx0PiB7XG4gICAgICAgICAgICB2YWwgdGFyZ2V0c1BpY2tlciA9IExvY2F0ZWRUYXJnZXRzUGlja2VyKCkuYXBwbHkge1xuICAgICAgICAgICAgICAgIGZvciAobG9jYXRvciBpbiBteVRhcmdldExvY2F0b3JzKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCByZXN1bHQgPSBsb2NhdG9yLnNlYXJjaChwbG90Q29vcmQpXG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXN1bHQgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgYWRkTG9va3VwUmVzdWx0KHJlc3VsdCwgcGxvdENvb3JkKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRhcmdldHNQaWNrZXIucGlja2VkXG4gICAgICAgIH1cblxuICAgICAgICBpbnRlcm5hbCBvcGVyYXRvciBmdW4gY29udGFpbnMocGxvdENvb3JkOiBEb3VibGVWZWN0b3IpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBnZW9tQm91bmRzLmNvbnRhaW5zKHBsb3RDb29yZClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgaW5uZXIgY2xhc3MgVGlsZVRhcmdldExvY2F0b3IobG9jYXRvcjogR2VvbVRhcmdldExvY2F0b3IpIDogVHJhbnNmb3JtZWRUYXJnZXRMb2NhdG9yKGxvY2F0b3IpIH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Zk51bGxzPERvdWJsZT4oY2FyZGluYWxpdHkpXG4gICAgICAgIHZhbCBweSA9IGFycmF5T2ZOdWxsczxEb3VibGU+KGNhcmRpbmFsaXR5KVxuICAgICAgICBmb3IgKHAgaW4gYWVzLmRhdGFQb2ludHMoKSkge1xuICAgICAgICAgICAgdmFyIGkgPSAtMVxuICAgICAgICAgICAgZm9yIChhZXNYIGluIHBvc0Flc1gpIHtcbiAgICAgICAgICAgICAgICB2YWwgdmFsWCA9IHAubnVtZXJpYyhhZXNYKVxuICAgICAgICAgICAgICAgIGZvciAoYWVzWSBpbiBwb3NBZXNZKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCB2YWxZID0gcC5udW1lcmljKGFlc1kpXG4gICAgICAgICAgICAgICAgICAgIGkrK1xuICAgICAgICAgICAgICAgICAgICBweFtpXSA9IHZhbFhcbiAgICAgICAgICAgICAgICAgICAgcHlbaV0gPSB2YWxZXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB3aGlsZSAoaSA+PSAwKSB7XG4gICAgICAgICAgICAgICAgaWYgKHB4W2ldICE9IG51bGwgJiYgcHlbaV0gIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgeCA9IHB4W2ldXG4gICAgICAgICAgICAgICAgICAgIHZhbCB5ID0gcHlbaV1cbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzRmluaXRlKHgpICYmIGlzRmluaXRlKHkpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgbmV3TG9jID0gcG9zLnRyYW5zbGF0ZShEb3VibGVWZWN0b3IoeCEhLCB5ISEpLCBwLCBnZW9tQ3R4KVxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIGFkanVzdGVkWCA9IG5ld0xvYy54XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgYWRqdXN0ZWRZID0gbmV3TG9jLnlcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyYW5nZXNJbml0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGp1c3RlZE1pblggPSBtaW4oYWRqdXN0ZWRYLCBhZGp1c3RlZE1pblgpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRqdXN0ZWRNYXhYID0gbWF4KGFkanVzdGVkWCwgYWRqdXN0ZWRNYXhYKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkanVzdGVkTWluWSA9IG1pbihhZGp1c3RlZFksIGFkanVzdGVkTWluWSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGp1c3RlZE1heFkgPSBtYXgoYWRqdXN0ZWRZLCBhZGp1c3RlZE1heFkpXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkanVzdGVkTWF4WCA9IGFkanVzdGVkWFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkanVzdGVkTWluWCA9IGFkanVzdGVkTWF4WFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkanVzdGVkTWF4WSA9IGFkanVzdGVkWVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkanVzdGVkTWluWSA9IGFkanVzdGVkTWF4WVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJhbmdlc0luaXRlZCA9IHRydWVcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpLS1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIC8vIFggcmFuZ2VcbiAgICAgICAgdmFsIHhSYW5nZSA9IGlmIChyYW5nZXNJbml0ZWQpXG4gICAgICAgICAgICBDbG9zZWRSYW5nZShhZGp1c3RlZE1pblgsIGFkanVzdGVkTWF4WClcbiAgICAgICAgZWxzZVxuICAgICAgICAgICAgbnVsbFxuXG4gICAgICAgIHZhbCB5U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iAgICAgICAgICAgIGNvbXB1dGVMYXllckRyeVJ1blJhbmdlQWZ0ZXJTaXplRXhwYW5kKFxuICAgICAgICAgICAgICAgIEFlcy5ZLFxuICAgICAgICAgICAgICAgIEFlcy5IRUlHSFQsXG4gICAgICAgICAgICAgICAgYWVzdGhldGljcyxcbiAgICAgICAgICAgICAgICBnZW9tQ3R4XG4gICAgICAgICAgICApXG4gICAgICAgIGVsc2VcbiAgICAgICAgICAgIG51bGxcblxuICAgICAgICByZXR1cm4gUGFpcihyYW5nZVgsIHJhbmdlWSlcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjb21wdXRlTGF5ZXJEcnlSdW5SYW5nZUFmdGVyU2l6ZUV4cGFuZChcbiAgICAgICAgbG9jYXRpb25BZXM6IEFlczxEb3VibGU+LCBzaXplQWVzOiBBZXM8RG91YmxlPiwgYWVzdGhldGljczogQWVzdGhldGljcywgZ2VvbUN0eDogR2VvbUNvbnRleHRcbiAgICApOiBDbG9zZWRSYW5nZTxEb3VibGU+PyB7XG4gICAgICAgIHZhbCBsb2NhdGlvbnMgPSBhZXN0aGV0aWNzLm51bWVyaWNWYWx1ZXMobG9jYXRpb25BZXMpLml0ZXJhdG9yKClcbiAgICAgICAgdmFsIHNpemVzID0gYWVzdGhldGljcy5udW1lcmljVmFsdWVzKHNpemVBZXMpLml0ZXJhdG9yKClcblxuICAgICAgICB2YWwgcmVzb2x1dGlvbiA9IGdlb21DdHguZ2V0UmVzb2x1dGlvbihsb2NhdGlvbkFlcylcbiAgICAgICAgdmFsIG1pbk1heCA9IGRvdWJsZUFycmF5T2YoRG91YmxlLlBPU0lUSVZFX0lORklOSVRZLCBEb3VibGUuTkVHQVRJVkVfSU5GSU5JVFkpXG5cbiAgICAgICAgZm9yIChpIGluIDAgdW50aWwgYWVzdGhldGljcy5kYXRhUG9pbnRDb3VudCgpKSB7XG4gICAgICAgICAgICBpZiAoIWxvY2F0aW9ucy5oYXNOZXh0KCkpIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oXCJJbmRleCBpcyBvdXQgb2YgYm91bmRzOiAkaSBmb3IgJGxvY2F0aW9uQWVzXCIpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoIXNpemVzLmhhc05leHQoKSkge1xuICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbihcIkluZGV4IGlzIG91dCBvZiBib3VuZHM6ICRpIGZvciAkc2l6ZUFlc1wiKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFsIGxvYyA9IGxvY2F0aW9ucy5uZXh0KClcbiAgICAgICAgICAgIHZhbCBzaXplID0gc2l6ZXMubmV4dCgpXG4gICAgICAgICAgICBpZiAoaXNGaW5pdGUobG9jKSAmJiBpc0Zpbml0ZShzaXplKSkge1xuICAgICAgICAgICAgICAgIHZhbCBleHBhbmQgPSByZXNvbHV0aW9uICogKHNpemUhISAvIDIpXG4gICAgICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRNaW5NYXgobG9jISEsIGV4cGFuZCwgbWluTWF4KVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGlmIChtaW5NYXhbMF0gPD0gbWluTWF4WzFdKVxuICAgICAgICAgICAgQ2xvc2VkUmFuZ2UobWluTWF4WzBdLCBtaW5NYXhbMV0pXG4gICAgICAgIGVsc2VcbiAgICAgICAgICAgIG51bGxcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB1cGRhdGVFeHBhbmRlZE1pbk1heCh2YWx1ZTogRG91YmxlLCBleHBhbmQ6IERvdWJsZSwgZXhwYW5kZWRNaW5NYXg6IERvdWJsZUFycmF5KSB7XG4gICAgICAgIGV4cGFuZGVkTWluTWF4WzBdID0gbWluKHZhbHVlIC0gZXhwYW5kLCBleHBhbmRlZE1pbk1heFswXSlcbiAgICAgICAgZXhwYW5kZWRNaW5NYXhbMV0gPSBtYXgodm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zID0gSGFzaE1hcDxBZXM8Kj4sIChEb3VibGU/KSAtPiBBbnk/PihzaGFyZWROdW1lcmljTWFwcGVycylcbiAgICAgICAgZm9yIChhZXMgaW4gbGF5ZXIucmVuZGVyZWRBZXMoKSkge1xuICAgICAgICAgICAgdmFyIG1hcHBlcjogKChEb3VibGU/KSAtPiBBbnk/KT8gPSBzaGFyZWROdW1lcmljTWFwcGVyc1thZXNdXG4gICAgICAgICAgICBpZiAobWFwcGVyID09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAvLyBwb3NpdGlvbmFsIGFlcyBzaGFyZSB0aGVpciBtYXBwZXJzXG4gICAgICAgICAgICAgICAgaWYgKEFlcy5pc1Bvc2l0aW9uYWxYKGFlcykpIHtcbiAgICAgICAgICAgICAgICAgICAgbWFwcGVyID0gc2hhcmVkTnVtZXJpY01hcHBlcnNbQWVzLlhdXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChBZXMuaXNQb3NpdGlvbmFsWShhZXMpKSB7XG4gICAgICAgICAgICAgICAgICAgIG1hcHBlciA9IHNoYXJlZE51bWVyaWNNYXBwZXJzW0Flcy5ZXVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChtYXBwZXIgPT0gbnVsbCAmJiBsYXllci5oYXNCaW5kaW5nKGFlcykpIHtcbiAgICAgICAgICAgICAgICBtYXBwZXIgPSBsYXllci5zY2FsZU1hcFthZXNdLm1hcHBlclxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAobWFwcGVyICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICBtYXBwZXJzW2Flc10gPSBtYXBwZXJcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbWFwcGVyc1xuICAgIH1cblxuICAgIGludGVybmFsIGZ1biBjcmVhdGVMYXllckFlc3RoZXRpY3MoXG4gICAgICAgIGxheWVyOiBHZW9tTGF5ZXIsXG4gICAgICAgIHN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yID0gRGF0YUZyYW1lVXRpbC50cmFuc2Zvcm1WYXJGb3IoYWVzKVxuICAgICAgICAgICAgICAgICAgICBjaGVjayhkYXRhLmhhcyh0cmFuc2Zvcm1WYXIpKSB7IFwiVW5kZWZpbmVkIHZhciAkdHJhbnNmb3JtVmFyIGZvciBhZXN0aGV0aWMgJGFlc1wiIH1cbiAgICAgICAgICAgICAgICAgICAgdmFsIG51bWVyaWNWYWx1ZXMgPSBkYXRhLmdldE51bWVyaWModHJhbnNmb3JtVmFyKVxuXG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhUG9pbnRDb3VudCA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhUG9pbnRDb3VudCA9IG51bWVyaWNWYWx1ZXMuc2l6ZVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2hlY2soZGF0YVBvaW50Q291bnQgPT0gbnVtZXJpY1ZhbHVlcy5zaXplKVxuICAgICAgICAgICAgICAgICAgICAgICAgeyBcIlwiICsgYWVzICsgXCIgZXhwZWN0ZWQgZGF0YSBzaXplPVwiICsgZGF0YVBvaW50Q291bnQgKyBcIiB3YXMgc2l6ZT1cIiArIG51bWVyaWNWYWx1ZXMuc2l6ZSB9XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YVBvaW50Q291bnQgPT0gMCAmJiBoYXNQb3NpdGlvbmFsQ29uc3RhbnRzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBwdXQgY29uc3RhbnQgaW5zdGVhZCBvZiBlbXB0eSBsaXN0XG4gICAgICAgICAgICAgICAgICAgICAgICBhZXNCdWlsZGVyLmNvbnN0YW50QWVzKGFlcywgbGF5ZXIuYWVzdGhldGljc0RlZmF1bHRzLmRlZmF1bHRWYWx1ZShhZXMpKVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIGludGVnZXJGdW5jdGlvbiA9IGxpc3RNYXBwZXIobnVtZXJpY1ZhbHVlcywgbWFwcGVyT3B0aW9uKVxuICAgICAgICAgICAgICAgICAgICAgICAgYWVzQnVpbGRlci5hZXMoYWVzLCBpbnRlZ2VyRnVuY3Rpb24pXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAvLyBhcHBseSBkZWZhdWx0XG4gICAgICAgICAgICAgICAgICAgIHZhbCB2ID0gbGF5ZXIuZ2V0RGVmYXVsdChhZXMpXG4gICAgICAgICAgICAgICAgICAgIGFlc0J1aWxkZXIuY29uc3RhbnRBZXMoXG4gICAgICAgICAgICAgICAgICAgICAgICBhZXMsXG4gICAgICAgICAgICAgICAgICAgICAgICBhc0Flc1ZhbHVlKGFlcywgdiwgbWFwcGVyT3B0aW9uKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGRhdGFQb2ludENvdW50ICE9IG51bGwgJiYgZGF0YVBvaW50Q291bnQgPiAwKSB7XG4gICAgICAgICAgICBhZXNCdWlsZGVyLmRhdGFQb2ludENvdW50KGRhdGFQb2ludENvdW50KVxuICAgICAgICB9IGVsc2UgaWYgKGhhc1Bvc2l0aW9uYWxDb25zdGFudHMpIHtcbiAgICAgICAgICAgIC8vIHNvbWUgZ2VvbXMgKHBvaW50LCBhYmxpbmUgZXRjLikgY2FuIGJlIHBsb3R0ZWQgd2l0aCBvbmx5IGNvbnN0YW50c1xuICAgICAgICAgICAgYWVzQnVpbGRlci5kYXRhUG9pbnRDb3VudCgxKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGFlc0J1aWxkZXIuYnVpbGQoKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIDxUPiBhc0Flc1ZhbHVlKGFlczogQWVzP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lckVuZHBvaW50ID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgbG93ZXJFeHBhbmQgPSAwLjBcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB1cHBlckV4cGFuZCA9IDAuMFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBsb3dlckVuZFdpdGhFeHBhbmQgPSAobG93ZXJFbmRwb2ludCAtIGxvd2VyRXhwYW5kKS5sZXQge1xuICAgICAgICAgICAgdmFsIHRyYW5zZm9ybWVkID0gY29udGludW91c1RyYW5zZm9ybT8uYXBwbHkoaXQpID86IGl0XG4gICAgICAgICAgICBpZiAodHJhbnNmb3JtZWQuaXNOYU4oKSkge1xuICAgICAgICAgICAgICAgIHJhbmdlLmxvd2VyRW5kXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRyYW5zZm9ybWVkXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgdmFsIHVwcGVyRW5kV2l0aEV4cGFuZCA9ICh1cHBlckVuZHBvaW50ICsgdXBwZXJFeHBhbmQpLmxldCB7XG4gICAgICAgICAgICB2YWwgdHJhbnNmb3JtZWQgPSBjb250aW51b3VzVHJhbnNmb3JtPy5hcHBseShpdCkgPzogaXRcbiAgICAgICAgICAgIGlmICh0cmFuc2Zvcm1lZC5pc05hTigpKSB7XG4gICAgICAgICAgICAgICAgcmFuZ2UudXBwZXJFbmRcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdHJhbnNmb3JtZWRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gQ2xvc2VkUmFuZ2UobG93ZXJFbmRXaXRoRXhwYW5kLCB1cHBlckVuZFdpdGhFeHBhbmQpXG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAyMDEwLTIwMTggSmV0QnJhaW5z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AgICAgICAgdmFsIHNwZWMgPSBjcmVhdGVDb2xvckJhclNwZWMoXG4gICAgICAgICAgICBsZWdlbmRUaXRsZSxcbiAgICAgICAgICAgIHRyYW5zZm9ybWVkRG9tYWluLFxuICAgICAgICAgICAgc2NhbGVCcmVha3MsXG4gICAgICAgICAgICBzY2FsZSxcbiAgICAgICAgICAgIHRoZW1lLFxuICAgICAgICAgICAgY29sb3JCYXJPcHRpb25zXG4gICAgICAgIClcblxuICAgICAgICByZXR1cm4gb2JqZWN0IDogTGVnZW5kQm94SW5mbyhzcGVjLnNpemUpIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVMZWdlbmRCb3goKTogTGVnZW5kQm94IHtcbiAgICAgICAgICAgICAgICB2YWwgYyA9IENvbG9yQmFyQ29tcG9uZW50KHNwZWMpXG4gICAgICAgICAgICAgICAgYy5kZWJ1ZyA9IERFQlVHX0RSQVdJTkdcbiAgICAgICAgICAgICAgICByZXR1cm4gY1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgaW50ZXJuYWwgZnVuIHNldE9wdGlvbnMob3B0aW9uczogQ29sb3JCYXJPcHRpb25zPykge1xuICAgICAgICBjb2xvckJhck9wdGlvbnMgPSBvcHRpb25zXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHByaXZhdGUgY29uc3QgdmFsIERFQlVHX0RSQVdJTkcgPSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5GZWF0dXJlU3dpdGNoLkxFR0VORF9ERUJVR19EUkFXSU5HXG5cbiAgICAgICAgZnVuIGNyZWF0ZUNvbG9yQmFyU3BlYyhcbiAgICAgICAgICAgIHRpdGxlOiBTdHJpbmcsXG4gICAgICAgICAgICB0cmFuc2Zvcm1lZERvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgICAgIGJyZWFrczogU2NhbGVCcmVha3MsXG4gICAgICAgICAgICBzY2FsZTogU2NhbGU8Q29sb3I+LFxuICAgICAgICAgICAgdGhlbWU6IExlZ2VuZFRoZW1lLFxuICAgICAgICAgICAgb3B0aW9uczogQ29sb3JCYXJPcHRpb25zPyA9IG51bGxcbiAgICAgICAgKTogQ29sb3JCYXJDb21wb25lbnRTcGVjIHtcblxuICAgICAgICAgICAgdmFsIGxlZ2VuZERpcmVjdGlvbiA9IExlZ2VuZEFzc2VtYmxlclV0aWwubGVnZW5kRGlyZWN0aW9uKHRoZW1lKVxuICAgICAgICAgICAgdmFsIGhvcml6b250YWw6IEJvb2xlYW4gPSBsZWdlbmREaXJlY3Rpb24gPT0gTGVnZW5kRGlyZWN0aW9uLkhPUklaT05UQUxcblxuICAgICAgICAgICAgdmFsIHdpZHRoID0gb3B0aW9ucz8ud2lkdGhcbiAgICAgICAgICAgIHZhbCBoZWlnaHQgPSBvcHRpb25zPy5oZWlnaHRcbiAgICAgICAgICAgIHZhciBiYXJTaXplID0gQ29sb3JCYXJDb21wb25lbnRTcGVjLmJhckFic29sdXRlU2l6ZShob3Jpem9udGFsLCB0aGVtZSlcbiAgICAgICAgICAgIGlmICh3aWR0aCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgYmFyU2l6ZSA9IERvdWJsZVZlY3Rvcih3aWR0aCwgYmFyU2l6ZS55KVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGhlaWdodCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgYmFyU2l6ZSA9IERvdWJsZVZlY3RvcihiYXJTaXplLngsIGhlaWdodClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIHJldmVyc2UgPSAhaG9yaXpvbnRhbFxuXG4gICAgICAgICAgICB2YWwgbGF5b3V0ID0gd2hlbiB7XG4gICAgICAgICAgICAgICAgaG9yaXpvbnRhbCAtPiBDb2xvckJhckNvbXBvbmVudExheW91dC5ob3Jpem9udGFsKHRpdGxlLCB0cmFuc2Zvcm1lZERvbWFpbiwgYnJlYWtzLCBiYXJTaXplLCByZXZlcnNlKVxuICAgICAgICAgICAgICAgIGVsc2UgLT4gQ29sb3JCYXJDb21wb25lbnRMYXlvdXQudmVydGljYWwodGl0bGUsIHRyYW5zZm9ybWVkRG9tYWluLCBicmVha3MsIGJhclNpemUsIHJldmVyc2UpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBDb2xvckJhckNvbXBvbmVudFNwZWMoXG4gICAgICAgICAgICAgICAgdGl0bGUsXG4gICAgICAgICAgICAgICAgdHJhbnNmb3JtZWREb21haW4sXG4gICAgICAgICAgICAgICAgYnJlYWtzLFxuICAgICAgICAgICAgICAgIHNjYWxlLFxuICAgICAgICAgICAgICAgIGJpbkNvdW50ID0gb3B0aW9ucz8uYmluQ291bnQgPzogREVGX05VTV9CSU4sXG4gICAgICAgICAgICAgICAgdGhlbWUsXG4gICAgICAgICAgICAgICAgbGF5b3V0LFxuICAgICAgICAgICAgICAgIHJldmVyc2VcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGNhbiBiZSBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlLlxuICovXG5cbnBhY2thZ2UgamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5hc3NlbWJsZVxuXG5jbGFzcyBDb2xvckJhck9wdGlvbnMgOiBHdWlkZU9wdGlvbnMoKSB7XG4gICAgdmFyIHdpZHRoOiBEb3VibGU/ID0gbnVsbFxuICAgIHZhciBoZWlnaHQ6IERvdWJsZT8gPSBudWxsXG4gICAgdmFyIGJpbkNvdW50OiBJbnQ/ID0gbnVsbFxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4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cblxuICAgIHByaXZhdGUgY2xhc3MgTXlHZW9tQ29udGV4dChiOiBHZW9tQ29udGV4dEJ1aWxkZXIpIDpcbiAgICAgICAgSW1tdXRhYmxlR2VvbUNvbnRleHQge1xuICAgICAgICB2YWwgbXlBZXN0aGV0aWNzID0gYi5teUFlc3RoZXRpY3NcbiAgICAgICAgdmFsIG15QWVzdGhldGljTWFwcGVycyA9IGIubXlBZXN0aGV0aWNNYXBwZXJzXG4gICAgICAgIG92ZXJyaWRlIHZhbCB0YXJnZXRDb2xsZWN0b3IgPSBiLm15R2VvbVRhcmdldENvbGxlY3RvclxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBnZXRSZXNvbHV0aW9uKGFlczogQWVzPERvdWJsZT4pOiBEb3VibGUge1xuICAgICAgICAgICAgdmFyIHJlc29sdXRpb24gPSAwLjBcbiAgICAgICAgICAgIGlmIChteUFlc3RoZXRpY3MgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJlc29sdXRpb24gPSBteUFlc3RoZXRpY3MucmVzb2x1dGlvbihhZXMsIDAuMClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChyZXNvbHV0aW9uIDw9IFNlcmllc1V0aWwuVElOWSkge1xuICAgICAgICAgICAgICAgIHJlc29sdXRpb24gPSBnZXRVbml0UmVzb2x1dGlvbihhZXMpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiByZXNvbHV0aW9uXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gZ2V0VW5pdFJlc29sdXRpb24oYWVzOiBBZXM8RG91YmxlPik6IERvdWJsZSB7XG4gICAgICAgICAgICB2YWwgbWFwcGVyID0gbXlBZXN0aGV0aWNNYXBwZXJzPy5nZXQoYWVzKSA/OiBNYXBwZXJzLklERU5USVRZXG4gICAgICAgICAgICByZXR1cm4gbWFwcGVyKDEuMCkgYXMgRG91YmxlXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmd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1WYXJGb3IoaXQuYWVzKVxuICAgICAgICAgICAgICAgICAgICBWYXJCaW5kaW5nKHRyYW5zZm9ybVZhciwgaXQuYWVzKVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGl0XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfS50b01hcCgpXG4gICAgICAgIClcblxuICAgICAgICAvLyBhZGQgJ3RyYW5zZm9ybScgdmFyaWFibGUgZm9yIGVhY2ggJ3N0YXQnIHZhcmlhYmxlXG4gICAgICAgIHZhbCBiaW5kaW5nc1RvUHV0ID0gQXJyYXlMaXN0PFZhckJpbmRpbmc+KClcbiAgICAgICAgZm9yIChiaW5kaW5nIGluIHJlcGxhY2VtZW50QmluZGluZ3MudmFsdWVzKSB7XG4gICAgICAgICAgICB2YWwgdmFyaWFibGUgPSBiaW5kaW5nLnZhcmlhYmxlXG4gICAgICAgICAgICBpZiAodmFyaWFibGUuaXNTdGF0KSB7XG4gICAgICAgICAgICAgICAgdmFsIGFlcyA9IGJpbmRpbmcuYWVzXG4gICAgICAgICAgICAgICAgdmFsIHNjYWxlID0gc2NhbGVNYXBbYWVzXVxuICAgICAgICAgICAgICAgIGRhdGEgPSBEYXRhRnJhbWVVdGlsLmFwcGx5VHJhbnNmb3JtKGRhdGEsIHZhcmlhYmxlLCBhZXMsIHNjYWxlKVxuICAgICAgICAgICAgICAgIGJpbmRpbmdzVG9QdXQuYWRkKFZhckJpbmRpbmcoVHJhbnNmb3JtVmFyLmZvckFlcyhhZXMpLCBhZXMpKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gcmVwbGFjZSAnc3RhdCcgdmFycyB3aXRoICd0cmFuc2Zvcm0nIHZhcnMgaW4gYmluZGluZ3NcbiAgICAgICAgZm9yIChiaW5kaW5nIGluIGJpbmRpbmdzVG9QdXQpIHtcbiAgICAgICAgICAgIHJlcGxhY2VtZW50QmluZGluZ3NbYmluZGluZy5hZX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RCeUFlcy5wdXQoa2V5LCBjb25zdGFudEJ5QWVzW2tleV0pXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZvciAodmFyQmluZGluZyBpbiB2YXJCaW5kaW5ncykge1xuICAgICAgICAgICAgICAgIG15VmFyQmluZGluZ3NCeUFlc1t2YXJCaW5kaW5nLmFlc10gPSB2YXJCaW5kaW5nXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gcmVuZGVyZWRBZXMoKTogTGlzdDxBZXM8Kj4+IHtcbiAgICAgICAgICAgIHJldHVybiBteVJlbmRlcmVkQWVzXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlUG9zKGN0eDogUG9zUHJvdmlkZXJDb250ZXh0KTogUG9zaXRpb25BZGp1c3RtZW50IHtcbiAgICAgICAgICAgIHJldHVybiBteVBvc1Byb3ZpZGVyLmNyZWF0ZVBvcyhjdHgpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaGFzQmluZGluZyhhZXM6IEFlczwqPik6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIG15VmFyQmluZGluZ3NCeUFlcy5jb250YWluc0tleShhZXMpXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gPFQ+IGdldEJpbmRpbmcoYWVzOiBBZXM8VD4pOiBWYXJCaW5kaW5nIHtcbiAgICAgICAgICAgIHJldHVybiBteVZhckJpbmRpbmdzQnlBZXNbYWVzXSEhXG4gICAgICAgIH1cblxuICAgICAgICBvdmVycmlkZSBmdW4gaGFzQ29uc3RhbnQoYWVzOiBBZXM8Kj4pOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBteUNvbnN0YW50QnlBZXMuY29udGFpbnNLZXkoYWVzKVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIDxUPiBnZXRDb25zdGFudChhZXM6IEFlczxUPik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ID0gR2VvbUxheWVyQnVpbGRlcigpXG4gICAgICAgICAgICBidWlsZGVyLm15RGF0YVByZXByb2Nlc3NvciA9IHsgZGF0YSwgc2NhbGVNYXAgLT5cbiAgICAgICAgICAgICAgICB2YWwgdHJhbnNmb3JtZWREYXRhID0gRGF0YVByb2Nlc3NpbmcudHJhbnNmb3JtT3JpZ2luYWxzKGRhdGEsIGJ1aWxkZXIubXlCaW5kaW5ncywgc2NhbGVNYXApXG4gICAgICAgICAgICAgICAgd2hlbiAodmFsIHN0YXQgPSBidWlsZGVyLm15U3RhdCkge1xuICAgICAgICAgICAgICAgICAgICBTdGF0cy5JREVOVElUWSAtPiB0cmFuc2Zvcm1lZERhdGFcbiAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgc3RhdEN0eCA9IFNpbXBsZVN0YXRDb250ZXh0KHRyYW5zZm9ybWVkRGF0YSlcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBncm91cGluZ0NvbnRleHQgPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdyb3VwaW5nQ29udGV4dChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtZWREYXRhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLm15QmluZGluZ3MsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIubXlHcm91cGluZ1Zhck5hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIubXlQYXRoSWRWYXJOYW1lLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVlXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIGRhdGFBbmRHcm91cGluZ0NvbnRleHQgPSBEYXRhUHJvY2Vzc2luZy5idWlsZFN0YXREYXRhKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybWVkRGF0YSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIubXlCaW5kaW5ncyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY2FsZU1hcCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBncm91cGluZ0NvbnRleHQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgUGxvdEZhY2V0cy51bmRlZmluZWQoKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0Q3R4LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhcnNXaXRob3V0QmluZGluZyA9IGVtcHR5TGlzdCgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yZGVyT3B0aW9ucyA9IGVtcHR5TGlzdCgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFnZ3JlZ2F0ZU9wZXJhdGlvbiA9IG51bGwsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOjpwcmludGxuXG4gICAgICAgICAgICAgICAgICAgICAgICApXG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFBbmRHcm91cGluZ0NvbnRleHQuZGF0YVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gYnVpbGRlclxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVy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CBMZWdlbmRCcmVhaz4oKVxuICAgICAgICBmb3IgKGxlZ2VuZExheWVyIGluIGxlZ2VuZExheWVycykge1xuICAgICAgICAgICAgdmFsIGtleUVsZW1lbnRGYWN0b3J5ID0gbGVnZW5kTGF5ZXIua2V5RWxlbWVudEZhY3RvcnlcbiAgICAgICAgICAgIHZhbCBkYXRhUG9pbnRzID0gbGVnZW5kTGF5ZXIua2V5QWVzdGhldGljcy5kYXRhUG9pbnRzKCkuaXRlcmF0b3IoKVxuICAgICAgICAgICAgZm9yIChsYWJlbCBpbiBsZWdlbmRMYXllci5rZXlMYWJlbHMpIHtcbiAgICAgICAgICAgICAgICBsZWdlbmRCcmVha3NCeUxhYmVsLmdldE9yUHV0KGxhYmVsKSB7IExlZ2VuZEJyZWFrKGxhYmVsKSB9XG4gICAgICAgICAgICAgICAgICAgIC5hZGRMYXllcihkYXRhUG9pbnRzLm5leHQoKSwga2V5RWxlbWVudEZhY3RvcnkpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbGVnZW5kQnJlYWtzID0gQXJyYXlMaXN0PExlZ2VuZEJyZWFrPigpXG4gICAgICAgIGZvciAobGVnZW5kQnJlYWsgaW4gbGVnZW5kQnJlYWtzQnlMYWJlbC52YWx1ZXMpIHtcbiAgICAgICAgICAgIGlmIChsZWdlbmRCcmVhay5pc0VtcHR5KSB7XG4gICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGxlZ2VuZEJyZWFrcy5hZGQobGVnZW5kQnJlYWspXG4gICAgICAgIH1cblxuXG4gICAgICAgIGlmIChsZWdlbmRCcmVha3MuaXNFbXB0eSgpKSB7XG4gICAgICAgICAgICByZXR1cm4gTGVnZW5kQm94SW5mby5FTVBUWVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gbGVnZW5kIG9wdGlvbnNcbiAgICAgICAgdmFsIGxlZ2VuZE9wdGlvbnNMaXN0ID0gQXJyYXlMaXN0PExlZ2VuZE9wdGlvbnM+KClcbiAgICAgICAgZm9yIChsZWdlbmRMYXllciBpbiBsZWdlbmRMYXllcnMpIHtcbiAgICAgICAgICAgIHZhbCBhZXNMaXN0ID0gbGVnZW5kTGF5ZXIuYWVzTGlzdFxuICAgICAgICAgICAgZm9yIChhZXMgaW4gYWVzTGlzdCkge1xuICAgICAgICAgICAgICAgIGlmIChndWlkZU9wdGlvbnNNYXBbYWVzXSBpcyBMZWdlbmRPcHRpb25zKSB7XG4gICAgICAgICAgICAgICAgICAgIGxlZ2VuZE9wdGlvbnNMaXN0LmFkZChndWlkZU9wdGlvbnNNYXBbYWVzXSBhcyBMZWdlbmRPcHRpb25zKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBzcGVjID1cbiAgICAgICAgICAgIGNyZWF0ZUxlZ2VuZFNwZWMoXG4gICAgICAgICAgICAgICAgbGVnZW5kVGl0bGUsIGxlZ2VuZEJyZWFrcywgdGhlbWUsXG4gICAgICAgICAgICAgICAgTGVnZW5kT3B0aW9ucy5jb21iaW5lKFxuICAgICAgICAgICAgICAgICAgICBsZWdlbmRPcHRpb25zTGlzdFxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIClcblxuICAgICAgICByZXR1cm4gb2JqZWN0IDogTGVnZW5kQm94SW5mbyhzcGVjLnNpemUpIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVMZWdlbmRCb3goKTogTGVnZW5kQm94IHtcbiAgICAgICAgICAgICAgICB2YWwgYyA9IExlZ2VuZENvbXBvbmVudChzcGVjKVxuICAgICAgICAgICAgICAgIGMuZGVidWcgPSBERUJVR19EUkFXSU5HXG4gICAgICAgICAgICAgICAgcmV0dXJuIGNcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuXG4gICAgcHJpdmF0ZSBjbGFzcyBMZWdlbmRMYXllcihcbiAgICAgICAgaW50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GV0aWNzRGVmYXVsdHMpXG4gICAgICAgICAgICBrZXlMYWJlbHMgPSBBcnJheUxpc3QoYWVzVmFsdWVzQnlMYWJlbC5rZXlzKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHByaXZhdGUgY29uc3QgdmFsIERFQlVHX0RSQVdJTkcgPSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5GZWF0dXJlU3dpdGNoLkxFR0VORF9ERUJVR19EUkFXSU5HXG5cbiAgICAgICAgZnVuIGNyZWF0ZUxlZ2VuZFNwZWMoXG4gICAgICAgICAgICB0aXRsZTogU3RyaW5nLFxuICAgICAgICAgICAgYnJlYWtzOiBMaXN0PExlZ2VuZEJyZWFrPixcbiAgICAgICAgICAgIHRoZW1lOiBMZWdlbmRUaGVtZSxcbiAgICAgICAgICAgIG9wdGlvbnM6IExlZ2VuZE9wdGlvbnMgPSBMZWdlbmRPcHRpb25zKClcbiAgICAgICAgKTogTGVnZW5kQ29tcG9uZW50U3BlYyB7XG5cbiAgICAgICAgICAgIHZhbCBsZWdlbmREaXJlY3Rpb24gPSBMZWdlbmRBc3NlbWJsZXJVdGlsLmxlZ2VuZERpcmVjdGlvbih0aGVtZSlcblxuICAgICAgICAgICAgLy8ga2V5IHNpemVcbiAgICAgICAgICAgIGZ1biBwcmV0dHkodjogRG91YmxlVmVjdG9yKTogRG91YmxlVmVjdG9yIHtcbiAgICAgICAgICAgICAgICB2YWwgbWFyZ2luID0gMS4wXG4gICAgICAgICAgICAgICAgcmV0dXJuIERvdWJsZVZlY3RvcihcbiAgICAgICAgICAgICAgICAgICAgZmxvb3Iodi54IC8gMikgKiAyICsgMS4wICsgbWFyZ2luLFxuICAgICAgICAgICAgICAgICAgICBmbG9vcih2LnkgLyAyKSAqIDIgKyAxLjAgKyBtYXJnaW5cbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBrZXlTaXplID0gRG91YmxlVmVjdG9yKHRoZW1lLmtleVNpemUoKSwgdGhlbWUua2V5U2l6ZSgpKVxuICAgICAgICAgICAgZm9yIChiciBpbiBicmVha3MpIHtcbiAgICAgICAgICAgICAgICB2YWwgbWluaW11bUtleVNpemUgPSBici5taW5pbXVtS2V5U2l6ZVxuICAgICAgICAgICAgICAgIGtleVNpemUgPSBrZXlTaXplLm1heChwcmV0dHkobWluaW11bUtleVNpemUpKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyByb3csIGNvbCBjb3VudFxuICAgICAgICAgICAgdmFsIGJyZWFrQ291bnQgPSBicmVha3Muc2l6ZVxuICAgICAgICAgICAgdmFsIGNvbENvdW50OiBJbnRcbiAgICAgICAgICAgIHZhbCByb3dDb3VudDogSW50XG4gICAgICAgICAgICBpZiAob3B0aW9ucy5pc0J5Um93KSB7XG4gICAgICAgICAgICAgICAgY29sQ291bnQgPSB3aGVuIHtcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5oYXNDb2xDb3VudCgpIC0+IG1pbihvcHRpb25zLmNvbENvdW50LCBicmVha0NvdW50KVxuICAgICAgICAgICAgICAgICAgICBvcHRpb25zLmhhc1Jvd0NvdW50KCkgLT4gY2VpbChicmVha0NvdW50IC8gb3B0aW9ucy5yb3dDb3VudC50b0RvdWJsZSgpKS50b0ludCgpXG4gICAgICAgICAgICAgICAgICAgIGxlZ2VuZERpcmVjdGlvbiA9PT0gTGVnZW5kRGlyZWN0aW9uLkhPUklaT05UQUwgLT4gYnJlYWtDb3VudFxuICAgICAgICAgICAgICAgICAgICBlbHNlIC0+IDFcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcm93Q291bnQgPSBjZWlsKGJyZWFrQ291bnQgLyBjb2xDb3VudC50b0RvdWJsZSgpKS50b0ludCgpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIGJ5IGNvbHVtblxuICAgICAgICAgICAgICAgIHJvd0NvdW50ID0gd2hlbiB7XG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnMuaGFzUm93Q291bnQoKSAtPiBtaW4ob3B0aW9ucy5yb3dDb3VudCwgYnJlYWtDb3VudClcbiAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5oYXNDb2xDb3VudCgpIC0+IGNlaWwoYnJlYWtDb3VudCAvIG9wdGlvbnMuY29sQ291bnQudG9Eb3VibGUoKSkudG9JbnQoKVxuICAgICAgICAgICAgICAgICAgICBsZWdlbmREaXJlY3Rpb24gIT09IExlZ2VuZERpcmVjdGlvbi5IT1JJWk9OVEFMIC0+IGJyZWFrQ291bnRcbiAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiAxXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbENvdW50ID0gY2VpbChicmVha0NvdW50IC8gcm93Q291bnQudG9Eb3VibGUoKSkudG9JbnQoKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgbGF5b3V0OiBMZWdlbmRDb21wb25lbnRMYXlvdXRcbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIkxpZnRSZXR1cm5PckFzc2lnbm1lbnRcIilcbiAgICAgICAgICAgIGlmIChsZWdlbmREaXJlY3Rpb24gPT09IExlZ2VuZERpcmVjdGlvbi5IT1JJWk9OVEFMKSB7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMuaGFzUm93Q291bnQoKSB8fCBvcHRpb25zLmhhc0NvbENvdW50KCkgJiYgb3B0aW9ucy5jb2xDb3VudCA8IGJyZWFrQ291bnQpIHtcbiAgICAgICAgICAgICAgICAgICAgbGF5b3V0ID0gTGVnZW5kQ29tcG9uZW50TGF5b3V0Lmhvcml6b250YWxNdWx0aVJvdyhcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlLFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtzLFxuICAgICAgICAgICAgICAgICAgICAgICAga2V5U2l6ZVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbGF5b3V0ID0gTGVnZW5kQ29tcG9uZW50TGF5b3V0Lmhvcml6b250YWwodGl0bGUsIGJyZWFrcywga2V5U2l6ZSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxheW91dCA9IExlZ2VuZENvbXBvbmVudExheW91dC52ZXJ0aWNhbCh0aXRsZSwgYnJlYWtzLCBrZXlTaXplKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBsYXlvdXQuY29sQ291bnQgPSBjb2xDb3VudFxuICAgICAgICAgICAgbGF5b3V0LnJvd0NvdW50ID0gcm93Q291bnRcbiAgICAgICAgICAgIGxheW91dC5pc0ZpbGxCeVJvdyA9IG9wdGlvbnMuaXNCeVJvd1xuXG4gICAgICAgICAgICByZXR1cm4gTGVnZW5kQ29tcG9uZW50U3BlYyhcbiAgICAgICAgICAgICAgICB0aXRsZSxcbiAgICAgICAgICAgICAgICBicmVha3MsXG4gICAgICAgICAgICAgICAgdGhlbWUsXG4gICAgICAgICAgICAgICAgbGF5b3V0LFxuICAgICAgICAgICAgICAgIHJldmVyc2UgPSBmYWxzZVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmFzc2VtYmxlXG5cbmltcG9ydCBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5iYXNlLkFlc1xuaW1wb3J0IGp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gICAgLy8gRGVyaXZlIHNvbWUgYWVzdGhldGljcyBmcm9tIGNvbnN0YW50c1xuICAgICAgICAgICAgZm9yIChjb25zdGFudEFlcyBpbiBjb25zdGFudEJ5QWVzLmtleXMpIHtcbiAgICAgICAgICAgICAgICB3aGVuIChjb25zdGFudEFlcykge1xuICAgICAgICAgICAgICAgICAgICBBZXMuU0hBUEUsXG4gICAgICAgICAgICAgICAgICAgIEFlcy5DT0xPUixcbiAgICAgICAgICAgICAgICAgICAgQWVzLkZJTEwgLT4gZGF0YVBvaW50W2NvbnN0YW50QWVzXSA9IGNvbnN0YW50QnlBZXNbY29uc3RhbnRBZXNdISFcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZvciAoYWVzIGluIHZhbHVlQnlBZXMua2V5cykge1xuICAgICAgICAgICAgICAgIGRhdGFQb2ludFthZXNdID0gdmFsdWVCeUFlc1thZXNdISFcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZGF0YVBvaW50cy5hZGQoZGF0YVBvaW50KVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGJ1aWxkZXIgPSBBZXN0aGV0aWNzQnVpbGRlcihkYXRhUG9pbnRzLnNpemUpXG4gICAgICAgIGZvciAoYWVzIGluIEFlcy52YWx1ZXMoKSkge1xuICAgICAgICAgICAgQFN1cHByZXNzKFwiVU5DSEVDS0VEX0NBU1RcIilcbiAgICAgICAgICAgIGJ1aWxkZXIuYWVzKGFlcyBhcyBBZXM8QW55PikgeyBpbmRleCAtPiBkYXRhUG9pbnRzW2luZGV4XVthZXNdISEgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBidWlsZGVyLmJ1aWxkKClcbiAgICB9XG5cbiAgICBmdW4gbGVnZW5kRGlyZWN0aW9uKHRoZW1lOiBMZWdlbmRUaGVtZSk6IExlZ2VuZERpcmVjdGlvbiB7XG4gICAgICAgIHZhciBsZWdlbmREaXJlY3Rpb24gPSB0aGVtZS5k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50OiBJbnRcbiAgICAgICAgZ2V0KCkgPSBteUNvbENvdW50ISFcbiAgICAgICAgc2V0KGNvbENvdW50KSB7XG4gICAgICAgICAgICBteUNvbENvdW50ID0gbWF4KDEsIGNvbENvdW50KVxuICAgICAgICB9XG5cbiAgICB2YXIgcm93Q291bnQ6IEludFxuICAgICAgICBnZXQoKSA9IG15Um93Q291bnQhIVxuICAgICAgICBzZXQocm93Q291bnQpIHtcbiAgICAgICAgICAgIG15Um93Q291bnQgPSBtYXgoMSwgcm93Q291bnQpXG4gICAgICAgIH1cblxuICAgIGZ1biBoYXNDb2xDb3VudCgpOiBCb29sZWFuIHtcbiAgICAgICAgcmV0dXJuIG15Q29sQ291bnQgIT0gbnVsbFxuICAgIH1cblxuICAgIGZ1biBoYXNSb3dDb3VudCgpOiBCb29sZWFuIHtcbiAgICAgICAgcmV0dXJuIG15Um93Q291bnQgIT0gbnVsbFxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBmdW4gY29tYmluZShvcHRpb25zTGlzdDogTGlzdDxMZWdlbmRPcHRpb25zPik6IExlZ2VuZE9wdGlvbnMge1xuICAgICAgICAgICAgdmFsIHJlc3VsdCA9IExlZ2VuZE9wdGlvbnMoKVxuICAgICAgICAgICAgZm9yIChvcHRpb25zIGluIG9wdGlvbnNMaXN0KSB7XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMuaXNCeVJvdykge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQuaXNCeVJvdyA9IHRydWVcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMuaGFzQ29sQ291bnQoKSkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQuY29sQ291bnQgPSBvcHRpb25zLmNvbENvdW50XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChvcHRpb25zLmhhc1Jvd0NvdW50KCkpIHtcbiAgICAgICAgICAgICAgICAgICAg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2YXRlIGZ1biBoYXNMYXllcnMoKTogQm9vbGVhbiB7XG4gICAgICAgIGZvciAodGlsZUxheWVycyBpbiBsYXllcnNCeVRpbGUpIHtcbiAgICAgICAgICAgIGlmICh0aWxlTGF5ZXJzLmlzTm90RW1wdHkoKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGZhbHNlXG4gICAgfVxuXG4gICAgZnVuIGNyZWF0ZVBsb3QoKTogUGxvdCB7XG4gICAgICAgIHJlcXVpcmUoaGFzTGF5ZXJzKCkpIHsgXCJObyBsYXllcnMgaW4gcGxvdFwiIH1cblxuICAgICAgICB2YWwgbGVnZW5kc0JveEluZm9zID0gaWYgKG15TGVnZW5kc0VuYWJsZWQpXG4gICAgICAgICAgICBQbG90QXNzZW1ibGVyVXRpbC5jcmVhdGVMZWdlbmRzKFxuICAgICAgICAgICAgICAgIGxheWVyc0J5VGlsZSxcbiAgICAgICAgICAgICAgICBteUd1aWRlT3B0aW9uc01hcCxcbiAgICAgICAgICAgICAgICBteVRoZW1lLmxlZ2VuZCgpXG4gICAgICAgICAgICApXG4gICAgICAgIGVsc2VcbiAgICAgICAgICAgIGVtcHR5TGlzdCgpXG5cbiAgICAgICAgLy8gc2hhcmUgZmlyc3QgWC9ZIHNjYWxlIGFtb25nIGFsbCBsYXllcnNcbiAgICAgICAgdmFyIHhTY2FsZVByb3RvID0gc2NhbGVCeUFlc1tBZXMuWF1cbiAgICAgICAgdmFyIHlTY2FsZVByb3RvID0gc2NhbGVCeUFlc1tBZXMuWV1cblxuICAgICAgICBpZiAoY29udGFpbnNMaXZlTWFwKSB7XG4gICAgICAgICAgICAvLyBidWlsZCAnbGl2ZSBtYXAnIHBsb3Q6XG4gICAgICAgICAgICAvLyAgLSBza2lwIFgvWSBzY2FsZSB0cmFpbmluZ1xuICAgICAgICAgICAgLy8gIC0gaWdub3JlIGNvb3JkIHByb3ZpZGVy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21haW4pXG4gICAgICAgICAgICB5QXhpc0xheW91dCA9IEVtcHR5QXhpc0xheW91dC5sZWZ0KHhEb21haW4sIHlEb21haW4pXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgcGxvdExheW91dCA9IFBsb3RBc3NlbWJsZXJVdGlsLmNyZWF0ZVBsb3RMYXlvdXQoXG4gICAgICAgICAgICBYWVBsb3RUaWxlTGF5b3V0KHhBeGlzTGF5b3V0LCB5QXhpc0xheW91dCksXG4gICAgICAgICAgICBmYWNldHNcbiAgICAgICAgKVxuICAgICAgICBpZiAoIW15QXhpc0VuYWJsZWQpIHtcbiAgICAgICAgICAgIHBsb3RMYXlvdXQuc2V0UGFkZGluZygwLjAsIDAuMCwgMC4wLCAwLjApXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gY3JlYXRlWFlQbG90KHhTY2FsZVByb3RvLCB5U2NhbGVQcm90bywgcGxvdExheW91dCwgbGVnZW5kc0JveEluZm9zKVxuICAgIH1cblxuXG4gICAgcHJpdmF0ZSBmdW4gY3JlYXRlWFlQbG90KFxuICAgICAgICB4U2NhbGVQcm90bzogU2NhbGU8RG91YmxlPixcbiAgICAgICAgeVNjYWxlUHJvdG86IFNjYWxlPERvdWJsZT4sXG4gICAgICAgIHBsb3RMYXlvdXQ6IFBsb3RMYXlvdXQsXG4gICAgICAgIGxlZ2VuZEJveEluZm9zOiBMaXN0PExlZ2VuZEJveEluZm8+LFxuICAgICAgICBoYXNMaXZlTWFwOiBCb29sZWFuID0gZmFsc2VcbiAgICApOiBQbG90IHtcblxuICAgICAgICB2YWwgcGxvdEJ1aWxkZXIgPSBQbG90QnVpbGRlcihteVRoZW1lKVxuICAgICAgICBwbG90QnVpbGRlci5zZXRUaXRsZShteVRpdGxlKVxuICAgICAgICBwbG90QnVpbGRlci5zY2FsZVhQcm90byh4U2NhbGVQcm90bylcbiAgICAgICAgcGxvdEJ1aWxkZXIuc2NhbGVZUHJvdG8oeVNjYWxlUHJvdG8pXG4gICAgICA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nVuIGRpc2FibGVMZWdlbmRzKCkge1xuICAgICAgICBteUxlZ2VuZHNFbmFibGVkID0gZmFsc2VcbiAgICB9XG5cbiAgICBmdW4gZGlzYWJsZUludGVyYWN0aW9ucygpIHtcbiAgICAgICAgbXlJbnRlcmFjdGlvbnNFbmFibGVkID0gZmFsc2VcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgZnVuIHNpbmdsZVRpbGUoXG4gICAgICAgICAgICBzY2FsZUJ5QWVzOiBUeXBlZFNjYWxlTWFwLFxuICAgICAgICAgICAgcGxvdExheWVyczogTGlzdDxHZW9tTGF5ZXI+LFxuICAgICAgICAgICAgY29vcmRQcm92aWRlcjogQ29vcmRQcm92aWRlcixcbiAgICAgICAgICAgIHRoZW1lOiBUaGVtZVxuICAgICAgICApOiBQbG90QXNzZW1ibGVyIHtcbiAgICAgICAgICAgIHZhbCBsYXllcnNCeVRpbGUgPSBBcnJheUxpc3Q8TGlzdDxHZW9tTGF5ZXI+PigpXG4gICAgICAgICAgICBsYXllcnNCeVRpbGUuYWRkKHBsb3RMYXllcnMpXG4gICAgICAgICAgICByZXR1cm4gbXVsdGlUaWxlKFxuICAgICAgICAgICAgICAgIHNjYWxlQnlBZXMsXG4gICAgICAgICAgICAgICAgbGF5ZXJzQnlUaWxlLFxuICAgICAgICAgICAgICAgIGNvb3JkUHJvdmlkZXIsXG4gICAgICAgICAgICAgICAgdGhlbWVcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBtdWx0aVRpbGUoXG4gICAgICAgICAgICBzY2FsZUJ5QWVzOiBUeXBlZFNjYWxlTWFwLFxuICAgICAgICAgICAgbGF5ZXJzQnlUaWxlOiBMaXN0PExpc3Q8R2VvbUxheWVyPj4sXG4gICAgICAgICAgICBjb29yZFByb3ZpZGVyOiBDb29yZFByb3ZpZGVyLFxuICAgICAgICAgICAgdGhlbWU6IFRoZW1lXG4gICAgICAgICk6IFBsb3RB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XllcnNMaXN0ID0gQXJyYXlMaXN0PFN0aXRjaGVkUGxvdExheWVycz4oKVxuICAgICAgICBmb3IgKGkgaW4gMCB1bnRpbCBwbGFuZUNvdW50KSB7XG4gICAgICAgICAgICB2YWwgbGF5ZXJzT25QbGFuZSA9IEFycmF5TGlzdDxHZW9tTGF5ZXI+KClcblxuICAgICAgICAgICAgLy8gY29sbGVjdCBsYXllcltpXSBjaHVua3MgZnJvbSBhbGwgcGFuZWxzXG4gICAgICAgICAgICBmb3IgKHBhbmVsTGF5ZXJzIGluIGxheWVyc0J5UGFuZWwpIHtcbiAgICAgICAgICAgICAgICBsYXllcnNPblBsYW5lLmFkZChwYW5lbExheWVyc1tpXSlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgc3RpdGNoZWRMYXllcnNMaXN0LmFkZChcbiAgICAgICAgICAgICAgICBTdGl0Y2hlZFBsb3RMYXllcnMoXG4gICAgICAgICAgICAgICAgICAgIGxheWVyc09uUGxhbmVcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgdHJhbnNmb3JtZWREb21haW5CeUFlcyA9IEhhc2hNYXA8QWVzPCo+LCBDbG9zZWRSYW5nZTxEb3VibGU+PigpXG4gICAgICAgIGZvciAoc3RpdGNoZWRQbG90TGF5ZXJzIGluIHN0aXRjaGVkTGF5ZXJzTGlzdCkge1xuICAgICAgICAgICAgdmFsIGxheWVyVHJhbnNmb3JtZWREb21haW5CeUFlcyA9IGd1aWRlVHJhbnNmb3JtZWREb21haW5CeUFlcyhzdGl0Y2hlZFBsb3RMYXllcnMsIGd1aWRlT3B0aW9uc01hcClcbiAgICAgICAgICAgIGZvciAoKGFlcywgdHJhbnNmb3JtZWREb21haW4pIGluIGxheWVyVHJhbnNmb3JtZWREb21haW5CeUFlcykge1xuICAgICAgICAgICAgICAgIHVwZGF0ZUFlc1JhbmdlTWFwKFxuICAgICAgICAgICAgICAgICAgICBhZXMsXG4gICA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ZXM8Kj4sIEFueT4oKVxuICAgICAgICAgICAgZm9yIChhZXMgaW4gc3RpdGNoZWRMYXllcnMucmVuZGVyZWRBZXMoKSkge1xuICAgICAgICAgICAgICAgIGlmIChzdGl0Y2hlZExheWVycy5oYXNDb25zdGFudChhZXMpKSB7XG4gICAgICAgICAgICAgICAgICAgIGxheWVyQ29uc3RhbnRCeUFlc1thZXNdID0gc3RpdGNoZWRMYXllcnMuZ2V0Q29uc3RhbnQoYWVzKSEhXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgbGF5ZXJCaW5kaW5nc0J5U2NhbGVOYW1lID0gTGlua2VkSGFzaE1hcDxTdHJpbmcsIE11dGFibGVMaXN0PFZhckJpbmRpbmc+PigpXG4gICAgICAgICAgICB2YWwgYWVzTGlzdCA9IG1hcHBlZFJlbmRlcmVkQWVzVG9DcmVhdGVHdWlkZXMoc3RpdGNoZWRMYXllcnMsIGd1aWRlT3B0aW9uc01hcClcbiAgICAgICAgICAgIGZvciAoYWVzIGluIGFlc0xpc3QpIHtcbiAgICAgICAgICAgICAgICB2YXIgY29sb3JCYXIgPSBmYWxzZVxuICAgICAgICAgICAgICAgIHZhbCBiaW5kaW5nID0gc3RpdGNoZWRMYXllcnMuZ2V0QmluZGluZyhhZXMpXG4gICAgICAgICAgICAgICAgdmFsIHNjYWxlID0gc3RpdGNoZWRMYXllcnMuZ2V0U2NhbGUoYWVzKVxuICAgICAgICAgICAgICAgIHZhbCBzY2FsZU5hbWUgPSBzY2FsZS5uYW1lXG4gICAgICAgICAgICAgICAgaWYgKGd1aWRlT3B0aW9uc01hcC5jb250YWluc0tleShhZXMpKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBndWlkZU9wdGlvbnMgPSBndWlkZU9wdGlvbnNNYXBbYWVzXVxuICAgICAgICAgICAgICAgICAgICBpZiAoZ3VpZGVPcHRpb25zIGlzIENvbG9yQmFyT3B0aW9ucykge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2hlY2tGaXRzQ29sb3JCYXIoYmluZGluZy5hZXMsIHNjYWxlKVxuICAgICAgICAgICAgICAgICAgICAgICAgY29sb3JCYXIgPSB0cnVlXG4gICAgICAgICAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIGNvbG9yU2NhbGUgPSBzY2FsZSBhcyBTY2FsZTxDb2xvcj5cbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbG9yQmFyQXNzZW1ibGVyQnlUaXRsZVtzY2FsZU5hbWVdID0gY3JlYXRlQ29sb3JCYXJBc3NlbWJsZXIoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NhbGVOYW1lLCBiaW5kaW5nLmFlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2Zvcm1lZERvbWFpbkJ5QWVzLCBjb2xvclNjYWxlLCBndWlkZU9wdGlvbnMsIHRoZW1lXG4gICAgICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGZpdHNDb2xvckJhcihiaW5kaW5nLmFlcywgc2NhbGUpKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbG9yQmFyID0gdHJ1ZVxuICAgICAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgICAgICB2YWwgY29sb3JTY2FsZSA9IHNjYWxlIGFzIFNjYWxlPENvbG9yPlxuICAgICAgICAgICAgICAgICAgICBjb2xvckJhckFzc2VtYmxlckJ5VGl0bGVbc2NhbGVOYW1lXSA9IGNyZWF0ZUNvbG9yQmFyQXNzZW1ibGVyKFxuICAgICAgICAgICAgICAgICAgICAgICAgc2NhbGVOYW1lLCBiaW5kaW5nLmFlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybWVkRG9tYWluQnlBZXMsIGNvbG9yU2NhbGUsIG51bGwsIHRoZW1lXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIWNvbG9yQmFyKSB7XG4gICAgICAgICAgICAgICAgICAgIGxheWVyQmluZGluZ3NCeVNjYWxlTmFtZS5nZXRPclB1dChzY2FsZU5hbWUpIHsgQXJyYXlMaXN0KCkgfS5hZGQoYmluZGluZylcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZvciAoc2NhbGVOYW1lIGluIGxheWVyQmluZGluZ3NCeVNjYWxlTmFtZS5rZXlzKSB7XG4gICAgICAgICAgICAgICAgdmFsIGxlZ2VuZEFzc2VtYmxlciA9IGxlZ2VuZEFzc2VtYmxlckJ5VGl0bGUuZ2V0T3JQdXQoc2NhbGVOYW1lKSB7XG4gICAgICAgICAgICAgICAgICAgIExlZ2VuZEFzc2VtYmxlcihcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjYWxlTmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGd1aWRlT3B0aW9uc01hcCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoZW1lXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB2YWwgdmFyQmluZGluZ3MgPSBsYXllckJpbmRpbmdzQnlTY2FsZU5hbWVbc2NhbGVOYW1lXSEhXG4gICAgICAgICAgICAgICAgdmFsIGxlZ2VuZEtleUZhY3RvcnkgPSBzdGl0Y2hlZExheWVycy5sZWdlbmRLZXlFbGVtZW50RmFjdG9yeVxuICAgICAgICAgICAgICAgIHZhbCBhZXN0aGV0aWNzRGVmYXVsdHMgPSBzdGl0Y2hlZExheWVycy5hZXN0aGV0aWNzRGVmYXVsdHNcbiAgICAgICAgICAgICAgICBsZWdlbmRBc3NlbWJsZXIuYWRkTGF5ZXIoXG4gICAgICAgICAgICAgICAgICAgIGxlZ2VuZEtleUZhY3RvcnksXG4gICAgICAgICAgICAgICAgICAgIHZhckJpbmRpbmdzLFxuICAgICAgICAgICAgICAgICAgICBsYXllckNvbnN0YW50QnlBZXMsXG4gICAgICAgICAgICAgICAgICAgIGFlc3RoZXRpY3NEZWZhdWx0cyxcbiAgICAgICAgICAgICAgICAgICAgc3RpdGNoZWRMYXllcnMuZ2V0U2NhbGVNYXAoKSxcbiAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtZWREb21haW5CeUFlc1xuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBsZWdlbmRCb3hJbmZvcyA9IEFycmF5TGlzdDxMZWdlbmRCb3hJbmZvPigpXG4gICAgICAgIGZvciAobGVnZW5kVGl0bGUgaW4gY29sb3JCYXJBc3NlbWJsZXJCeVRpdGxlLmtleXMpIHtcbiAgICAgICAgICAgIHZhbCBib3hJbmZvID0gY29sb3JCYXJBc3NlbWJsZXJCeVRpdGxlW2xlZ2VuZFRpdGxlXSEhLmNyZWF0ZUNvbG9yQmFyKClcbiAgICAgICAgICAgIGlmICghYm94SW5mby5pc0VtcHR5KSB7XG4gICAgICAgICAgICAgICAgbGVnZW5kQm94SW5mb3MuYWRkKGJveEluZm8pXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKGxlZ2VuZFRpdGxlIGluIGxlZ2VuZEFzc2VtYmxlckJ5VGl0bGUua2V5cykge1xuICAgICAgICAgICAgdmFsIGJveEluZm8gPSBsZWdlbmRBc3NlbWJsZXJCeVRpdGxlW2xlZ2VuZFRpdGxlXSEhLmNyZWF0ZUxlZ2VuZCgpXG4gICAgICAgICAgICBpZiAoIWJveEluZm8uaXNFbXB0eSkge1xuICAgICAgICAgICAgICAgIGxlZ2VuZEJveEluZm9zLmFkZChib3hJbmZvKVxuICAgICAgICAgICAgfVxuICAgIC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2UoXG4vLyAgICAgICAgICAgICAgICAgICAgU2NhbGVVdGlsLmJyZWFrc1RyYW5zZm9ybWVkKHNjYWxlKSxcbiAgICAgICAgICAgICAgICAgICAgc2NhbGVCcmVha3MudHJhbnNmb3JtZWRWYWx1ZXMsXG4gICAgICAgICAgICAgICAgICAgIGluaXRpYWxSYW5nZVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBpbml0aWFsUmFuZ2VcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBleHBhbmRSYW5nZShcbiAgICAgICAgICAgIHJhbmdlOiBDbG9zZWRSYW5nZTxEb3VibGU+PyxcbiAgICAgICAgICAgIGFlczogQWVzPERvdWJsZT4sXG4gICAgICAgICAgICBzY2FsZTogU2NhbGU8Kj4sXG4gICAgICAgICAgICBsYXllcnM6IExpc3Q8R2VvbUxheWVyPlxuICAgICAgICApOiBDbG9zZWRSYW5nZTxEb3VibGU+PyB7XG4gICAgICAgICAgICB2YWwgaW5jbHVkZVplcm8gPSBsYXllcnMuYW55IHsgaXQucmFuZ2VJbmNsdWRlc1plcm8oYWVzKSB9XG5cbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIk5BTUVfU0hBRE9XSU5HXCIpXG4gICAgICAgICAgICB2YWwgcmFuZ2UgPSB3aGVuIChpbmNsdWRlWmVybykge1xuICAgICAgICAgICAgICAgIHRydWUgLT4gdXBkYXRlUmFuZ2UoQ2xvc2VkUmFuZ2Uuc2luZ2xldG9uKDAuMCksIHJhbmdlKVxuICAgICAgICAgICAgICAgIGZhbHNlIC0+IHJhbmdlXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBQbG90VXRpbC5yYW5nZVdpdGhFeHBhbmQocmFuZ2UsIHNjYWxlLCBpbmNsdWRlWmVybylcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkuIEpldEJyYWlucyBzLn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scylcblxuICAgICAgICAgICAgdmFsIGluZGljZXNCeVZhckJ5TGV2ZWwgPSBkYXRhSW5kaWNlc0J5VmFyQnlMZXZlbChkYXRhLCB2YXJOYW1lcywgdmFyTGV2ZWxzKVxuXG4gICAgICAgICAgICB2YWwgZGF0YUJ5TGV2ZWxLZXkgPSBBcnJheUxpc3Q8UGFpcjxMaXN0PEFueT4sIERhdGFGcmFtZT4+KClcbiAgICAgICAgICAgIGZvciAobmFtZUxldmVsVHVwbGUgaW4gbmFtZUxldmVsVHVwbGVzKSB7XG4gICAgICAgICAgICAgICAgdmFsIHRvcE5hbWUgPSBuYW1lTGV2ZWxUdXBsZS5maXJzdCgpLmZpcnN0XG4gICAgICAgICAgICAgICAgdmFsIHRvcExldmVsID0gbmFtZUxldmVsVHVwbGUuZmlyc3QoKS5zZWNvbmRcbiAgICAgICAgICAgICAgICB2YWwgaW5kaWNlcyA9IEFycmF5TGlzdChpbmRpY2VzQnlWYXJCeUxldmVsLmdldFZhbHVlKHRvcE5hbWUpLmdldFZhbHVlKHRvcExldmVsKSlcbiAgICAgICAgICAgICAgICBmb3IgKGkgaW4gMSB1bnRpbCBuYW1lTGV2ZWxUdXBsZS5zaXplKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBuYW1lID0gbmFtZUxldmVsVHVwbGVbaV0uZmlyc3RcbiAgICAgICAgICAgICAgICAgICAgdmFsIGxldmVsID0gbmFtZUxldmVsVHVwbGVbaV0uc2Vjb25kXG4gICAgICAgICAgICAgICAgICAgIHZhbCBsZXZlbEluZGljZXMgPSBpbmRpY2VzQnlWYXJCeUxldmVsLmdldFZhbHVlKG5hbWUpLmdldFZhbHVlKGxldmVsKVxuICAgICAgICAgICAgICAgICAgICBpbmRpY2VzLnJldGFpbkFsbChIYXNoU2V0KGxldmVsSW5kaWNlcykpXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdmFsIGxldmVsS2V5ID0gbmFtZUxldmVsVHVwbGUubWFwIHsgaXQuc2Vjb25kIH1cblxuICAgICAgICAgICAgICAgIC8vIGJ1aWxkIHRoZSBkYXRhIHN1YnNldFxuICAgICAgICAgICAgICAgIHZhbCBiID0gRGF0YUZyYW1lLkJ1aWxkZXIoKVxuICAgICAgICAgICAgICAgIHZhbCB2YXJpYWJsZXMgPSBkYXRhLnZhcmlhYmxlcygpXG4gICAgICAgICAgICAgICAgZm9yICh2YXJpYWJsZSBpbiB2YXJpYWJsZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHNvdXJjZSA9IGRhdGFbdmFyaWFibGVdXG4gICAgICAgICAgICAgICAgICAgIHZhbCB0YXJnZXQgPSBTZXJpZXNVdGlsLnBpY2tBdEluZGljZXMoc291cmNlLCBpbmRpY2VzKVxuICAgICAgICAgICAgICAgICAgICBiLnB1dCh2YXJpYWJsZSwgdGFyZ2V0KVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHZhbCBsZXZlbERhdGEgPSBiLmJ1aWxkKClcbiAgICAgICAgICAgICAgICBkYXRhQnlMZXZlbEtleS5hZGQobGV2ZWxLZXkgdG8gbGV2ZWxEYXRhKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gZGF0YUJ5TGV2ZWxLZXlcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGRhdGFJbmRpY2VzQnlWYXJCeUxldmVsKFxuICAgICAgICAgICAgZGF0YTogRGF0YUZyYW1lLFxuICAgICAgICAgICAgdmFyTmFtZXM6IExpc3Q8U3RyaW5nPixcbiAgICAgICAgICAgIHZhckxldmVsczogTGlzdDxMaXN0PEFueT4+XG4gICAgICAgICk6IE1hcDxTdHJpbmcsIE1hcDxBbnksIExpc3Q8SW50Pj4+IHtcblxuICAgICAgICAgICAgdmFsIGluZGljZXNCeVZhckJ5TGV2ZWwgPSBIYXNoTWFwPFN0cmluZywgTWFwPEFueSwgTGlzdDxJbnQ+Pj4oKVxuICAgICAgICAgICAgZm9yICgoaSwgdmFyTmFtZSkgaW4gdmFyTmFtZXMud2l0aEluZGV4KCkpIHtcbiAgICAgICAgICAgICAgICB2YWwgbGV2ZWxzID0gdmFyTGV2ZWxzW2ldXG5cbiAgICAgICAgICAgICAgICB2YWwgaW5kaWNlc0J5TGV2ZWwgPSBIYXNoTWFwPEFueSwgTGlzdDxJbnQ+PigpXG4gICAgICAgICAgICAgICAgZm9yIChsZXZlbCBpbiBsZXZlbHMpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIGluZGljZXMgPSB3aGVuIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vICdlbXB0eScgZGF0YSBpbiBsYXllcnMgd2l0aCBubyBhZXMgbWFwcGluZyAob25seSBjb25zdGFudHMpXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhLmlzRW1wdHkgLT4gZW1wdHlMaXN0KClcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgLT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbCB2YXJpYWJsZSA9IERhdGFGcmFtZVV0aWwuZmluZFZhcmlhYmxlT3JGYWlsKGRhdGEsIHZhck5hbWUpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgU2VyaWVzVXRpbC5tYXRjaGluZ0luZGljZXMoZGF0YVt2YXJpYWJsZV0sIGxldmVsKVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGluZGljZXNCeUxldmVsW2xldmVsXSA9IGluZGljZXNcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpbmRpY2VzQnlWYXJCeUxldmVsW3Zhck5hbWVdID0gaW5kaWNlc0J5TGV2ZWxcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIGluZGljZXNCeVZhckJ5TGV2ZWxcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBjcmVhdGVOYW1lTGV2ZW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AgICAgICAgaWYgKHZhck5hbWVzLnNpemUgPiAxKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBzdWJLZXlzID0gY3JlYXRlTmFtZUxldmVsVHVwbGVzKFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyTmFtZXMuc3ViTGlzdCgxLCB2YXJOYW1lcy5zaXplKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhckxldmVscy5zdWJMaXN0KDEsIHZhckxldmVscy5zaXplKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgIGZvciAoc3ViS2V5IGluIHN1YktleXMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldmVsS2V5cy5hZGQobGlzdE9mKG5hbWUgdG8gbGV2ZWwpICsgc3ViS2V5KVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gZXhpdFxuICAgICAgICAgICAgICAgICAgICBsZXZlbEtleXMuYWRkKGxpc3RPZihuYW1lIHRvIGxldmVsKSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBsZXZlbEtleXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biByZW9yZGVyTGV2ZWxzKFxuICAgICAgICAgICAgdmFyTmFtZXM6IExpc3Q8U3RyaW5nPixcbiAgICAgICAgICAgIHZhckxldmVsczogTGlzdDxMaXN0PEFueT4+LFxuICAgICAgICAgICAgb3JkZXJpbmc6IExpc3Q8SW50PlxuICAgICAgICApOiBMaXN0PExpc3Q8QW55Pj4ge1xuICAgICAgICAgICAgdmFsIG9yZGVyaW5nQnlGYWNldCA9IHZhck5hbWVzLnppcChvcmRlcmluZykudG9NYXAoKVxuXG4gICAgICAgICAgICB2YWwgcmVzdWx0ID0gQXJyYXlMaXN0PExpc3Q8QW55Pj4oKVxuICAgICAgICAgICAgZm9yICgoaSwgbmFtZSkgaW4gdmFyTmFtZXMud2l0aEluZGV4KCkpIHtcbiAgICAgICAgICAgICAgICBpZiAoaSA+PSB2YXJMZXZlbHMuc2l6ZSkgYnJlYWtcbiAgICAgICAgICAgICAgICByZXN1bHQuYWRkKHJlb3JkZXJWYXJMZXZlbHMobmFtZSwgdmFyTGV2ZWxzW2ldLCBvcmRlcmluZ0J5RmFjZXQuZ2V0VmFsdWUobmFtZSkpKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcmVvcmRlclZhckxldmVscyhcbiAgICAgICAgICAgIG5hbWU6IFN0cmluZz8sXG4gICAgICAgICAgICBsZXZlbHM6IExpc3Q8QW55PixcbiAgICAgICAgICAgIG9yZGVyOiBJbnRcbiAgICAgICAgKTogTGlzdDxBbnk+IHtcbiAgICAgICAgICAgIGlmIChuYW1lID09IG51bGwpIHJldHVybiBsZXZlbHNcblxuICAgICAgICAgICAgLy8gV2UgZXhwZWN0IGVpdGhlciBhIGxpc3Qgb2YgRG91YmxlcyBvciBhIGxpc3Qgb2YgU3RyaW5ncy5cbiAgICAgICAgICAgIEBTdXBwcmVzcyhcIlVOQ0hFQ0tFRF9DQVNUXCIsIFwiTkFNRV9TSEFET1dJTkdcIilcbiAgICAgICAgICAgIGxldmVscyBhcyBMaXN0PENvbXBhcmFibGU8QW55Pj5cblxuICAgICAgICAgICAgcmV0dXJuIHdoZW4ge1xuICAgICAgICAgICAgICAgIG9yZGVyIDwgMCAtPiBsZXZlbHMuc29ydGVkRGVzY2VuZGluZygpXG4gICAgICAgICAgICAgICAgZWxzZSAtPiBsZXZlbHMuc29ydGVkKClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNsYXNzIEZhY2V0VGlsZUluZm8oXG4gICAgICAgIHZhbCBjb2w6IEludCxcbiAgICAgICAgdmFsIHJvdzogSW50LFxuICAgICAgICB2YWwgY29sTGFiczog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IChhZXMgaW4gbGF5ZXJUaWxlcy5yZW5kZXJlZEFlcygpKSB7XG4gICAgICAgICAgICBpZiAoQWVzLm5vR3VpZGVOZWVkZWQoYWVzKSkge1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobGF5ZXJUaWxlcy5oYXNDb25zdGFudChhZXMpKSB7XG4gICAgICAgICAgICAgICAgLy8gY29uc3RhbnRzIG1hc2sgYWVzIG1hcHBpbmdzXG4gICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICghbGF5ZXJUaWxlcy5oYXNCaW5kaW5nKGFlcykpIHtcbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGd1aWRlT3B0aW9uc01hcC5jb250YWluc0tleShhZXMpKSB7XG4gICAgICAgICAgICAgICAgaWYgKGd1aWRlT3B0aW9uc01hcFthZXNdID09PSBHdWlkZU9wdGlvbnMuTk9ORSkge1xuICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmVzdWx0LmFkZChhZXMpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgfVxuXG4gICAgZnVuIGd1aWRlVHJhbnNmb3JtZWREb21haW5CeUFlcyhcbiAgICAgICAgc3RpdGNoZWRMYXllcnM6IFN0aXRjaGVkUGxvdExheWVycyxcbiAgICAgICAgZ3VpZGVPcHRpb25zTWFwOiBNYXA8QWVzPCo+LCBHdWlkZU9wdGlvbnM+XG4gICAgKTogTWFwPEFlczwqPiwgQ2xvc2VkUmFuZ2U8RG91YmxlPj4ge1xuICAgICAgICB2YWwgdHJhbnNmb3JtZWREb21haW5CeUFlcyA9IEhhc2hNYXA8QWVzPCo+LCBDbG9zZWRSYW5nZTxEb3VibGU+PigpXG4gIC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b3JtZWREYXRhUmFuZ2UgIT0gbnVsbCkge1xuLy9cbi8vICAgICAgICAgICAgICAgIHZhbCB0cmFuc2Zvcm1lZERvbWFpbiA9XG4vLyAgICAgICAgICAgICAgICAgICAgaWYgKHNjYWxlLmlzQ29udGludW91c0RvbWFpbiAmJiBzY2FsZS5oYXNEb21haW5MaW1pdHMoKSkge1xuLy8gICAgICAgICAgICAgICAgICAgICAgICB2YWwgKHNjYWxlTG93ZXIsIHNjYWxlVXBwZXIpID0gU2NhbGVVdGlsLnRyYW5zZm9ybWVkRGVmaW5lZExpbWl0cyhzY2FsZSlcbi8vICAgICAgICAgICAgICAgICAgICAgICAgdmFsIGxvd2VyRW5kID0gaWYgKHNjYWxlTG93ZXIuaXNGaW5pdGUoKSkgc2NhbGVMb3dlciBlbHNlIHRyYW5zZm9ybWVkRGF0YVJhbmdlLmxvd2VyRW5kXG4vLyAgICAgICAgICAgICAgICAgICAgICAgIHZhbCB1cHBlckVuZCA9IGlmIChzY2FsZVVwcGVyLmlzRmluaXRlKCkpIHNjYWxlVXBwZXIgZWxzZSB0cmFuc2Zvcm1lZERhdGFSYW5nZS51cHBlckVuZFxuLy8gICAgICAgICAgICAgICAgICAgICAgICBDbG9zZWRSYW5nZTxEb3VibGU+KGxvd2VyRW5kLCB1cHBlckVuZClcbi8vICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuLy8gICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2Zvcm1lZERhdGFSYW5nZVxuLy8gICAgICAgICAgICAgICAgICAgIH1cbi8vXG4vL1xuLy8gICAgICAgICAgICAgICAgdHJhbnNmb3JtZWREb21haW5CeUFlc1thZXNdID0gdHJhbnNmb3JtZWREb21haW5cbi8vICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHRyYW5zZm9ybWVkRG9tYWluQnlBZXNcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biByZWZpbmVUcmFuc2Zvcm1lZERhdGFSYW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mlkZXIoKSB7XG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGNyZWF0ZVBvcyhjdHg6IFBvc1Byb3ZpZGVyQ29udGV4dCk6IFBvc2l0aW9uQWRqdXN0bWVudCB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBwb3NcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gaGFuZGxlc0dyb3VwcygpOiBCb29sZWFuIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBvcy5oYW5kbGVzR3JvdXBzKClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYmFyU3RhY2soKTogUG9zUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IFBvc1Byb3ZpZGVyKCkge1xuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVQb3MoY3R4OiBQb3NQcm92aWRlckNvbnRleHQpOiBQb3NpdGlvbkFkanVzdG1lbnQge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUG9zaXRpb25BZGp1c3RtZW50cy5zdGFjayhjdHguYWVzdGhldGljcywgUG9zaXRpb25BZGp1c3RtZW50cy5TdGFja2luZ1N0cmF0ZWd5LlNQTElUX1BPU0lUSVZFX05FR0FUSVZFKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBoYW5kbGVzR3JvdXBzKCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUG9zaXRpb25BZGp1c3RtZW50cy5NZXRhLlNUQUNLLmhhbmRsZXNHcm91cHMoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIEBKdm1PdmVybG9hZHNcbiAgICAgICAgZnVuIGRvZGdlKHdpZHRoOiBEb3VibGU/ID0gbnVsbCk6IFBvc1Byb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBQb3NQcm92aWRlcigpIHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlUG9zKGN0eDogUG9zUHJvdmlkZXJDb250ZXh0KTogUG9zaXRpb25BZGp1c3RtZW50IHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIGFlc3RoZXRpY3MgPSBjdHguYWVzdGhldGljc1xuICAgICAgICAgICAgICAgICAgICB2YWwgZ3JvdXBDb3VudCA9IGN0eC5ncm91cENvdW50XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBQb3NpdGlvbkFkanVzdG1lbnRzLmRvZGdlKGFlc3RoZXRpY3MsIGdyb3VwQ291bnQsIHdpZHRoKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBoYW5kbGVzR3JvdXBzKCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUG9zaXRpb25BZGp1c3RtZW50cy5NZXRhLkRPREdFLmhhbmRsZXNHcm91cHMoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBmaWxsKCk6IFBvc1Byb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBQb3NQcm92aWRlcigpIHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlUG9zKGN0eDogUG9zUHJvdmlkZXJDb250ZXh0KTogUG9zaXRpb25BZGp1c3RtZW50IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBvc2l0aW9uQWRqdXN0bWVudHMuZmlsbChjdHguYWVzdGhldGljcylcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gaGFuZGxlc0dyb3VwcygpOiBCb29sZWFuIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBvc2l0aW9uQWRqdXN0bWVudHMuTWV0YS5GSUxMLmhhbmRsZXNHcm91cHMoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBqaXR0ZXIod2lkdGg6IERvdWJsZT8sIGhlaWdodDogRG91YmxlPyk6IFBvc1Byb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBvYmplY3QgOiBQb3NQcm92aWRlcigpIHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlUG9zKGN0eDogUG9zUHJvdmlkZXJDb250ZXh0KTogUG9zaXRpb25BZGp1c3RtZW50IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBvc2l0aW9uQWRqdXN0bWVudHMuaml0dGVyKHdpZHRoLCBoZWlnaHQpXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGhhbmRsZXNHcm91cHMoKTogQm9vbGVhbiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBQb3NpdGlvbkFkanVzdG1lbnRzLk1ldGEuSklUVEVSLmhhbmRsZXNHcm91cHMoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBudWRnZSh3aWR0aDogRG91YmxlPywgaGVpZ2h0OiBEb3VibGU/KTogUG9zUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IFBvc1Byb3ZpZGVyKCkge1xuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVQb3MoY3R4OiBQb3NQcm92aWRlckNvbnRleHQpOiBQb3NpdGlvbkFkanVzdG1lbnQge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUG9zaXRpb25BZGp1c3RtZW50cy5udWRnZSh3aWR0aCwgaGVpZ2h0KVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBoYW5kbGVzR3JvdXBzKCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gUG9zaXRpb25BZGp1c3RtZW50cy5NZXRhLk5VREdFLmhhbmRsZXNHcm91cHMoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIC8qXG4gIHB1YmxpYyBzdGF0aWMgUG9zUHJvdmlkZXIgaml0dGVyRG9kZ2UoRG91YmxlIGppdHRlcldpZHRoLCBEb3VibGUgaml0dGVySGVpZ2h0KSB7XG4gICAgcmV0dXJuIGppdHRlckRvZGdlKG51bGwsIGppdHRlcldpZHRoLCBqaXR0ZXJIZWlnaHQpO1xuICB9XG4gICovXG5cbiAgICAgICAgZnVuIGppdHRlckRvZGdlKHdpZHRoOiBEb3VibGU/LCBqaXR0ZXJXaWR0aDogRG91YmxlPywgaml0dGVySGVpZ2h0OiBEb3VibGU/KTogUG9zUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IFBvc1Byb3ZpZGVyKCkge1xuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVQb3MoY3R4OiBQb3NQcm92aWRlckNvbnRleHQpOiBQb3NpdGlvbkFkanVzdG1lbnQge1xuICAgICAgICAgICAgICAgICAgICB2YWwgYWVzdGhldGljcyA9IGN0eC5hZXN0aGV0aWNzXG4gICAgICAgICAgICAgICAgICAgIHZhbCBncm91cENvdW50ID0gY3R4Lmdyb3VwQ291bnRcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBvc2l0aW9uQWRqdXN0bWVudHMuaml0dGVyRG9kZ2UoYWVzdGhldGljcywgZ3JvdXBDb3VudCwgd2lkdGgsIGppdHRlcldpZHRoLCBqaXR0ZXJIZWlnaHQpXG4gICAgICAgICAgICAgICAgfVxu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hLlNlcmllc1V0aWxcblxuaW50ZXJuYWwgY2xhc3MgU3RpdGNoZWRQbG90TGF5ZXJzKGxheWVyczogTGlzdDxqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLkdlb21MYXllcj4pIHtcbiAgICBwcml2YXRlIHZhbCBteUxheWVyczogTGlzdDxqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLkdlb21MYXllcj5cblxuICAgIHZhbCBsZWdlbmRLZXlFbGVtZW50RmFjdG9yeTogTGVnZW5kS2V5RWxlbWVudEZhY3RvcnlcbiAgICAgICAgZ2V0KCkge1xuICAgICAgICAgICAgY2hlY2sobXlMYXllcnMuaXNOb3RFbXB0eSgpKVxuICAgICAgICAgICAgcmV0dXJuIG15TGF5ZXJzWzBdLmxlZ2VuZEtleUVsZW1lbnRGYWN0b3J5XG4gICAgICAgIH1cblxuICAgIHZhbCBhZXN0aGV0aWNzRGVmYXVsdHM6IEFlc3RoZXRpY3NEZWZhdWx0c1xuICAgICAgICBnZXQoKSB7XG4gICAgICAgICAgICBjaGVjayhteUxheWVycy5pc05vdEVtcHR5KCkpXG4gICAgICAgICAgICByZXR1cm4gbXlMYXllcnNbMF0uYWVzdGhldGljc0RlZmF1bHRzXG4gICAgICAgIH1cblxuICAgIHZhbCBpc0xlZ2VuZERpc2FibGVkOiBCb29sZWFuXG4gICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgIGNoZWNrKG15TGF5ZXJzLmlzTm90RW1wdHkoKSlcbiAgICAgICAgICAgIHJldHVybiBteUxheWVyc1swXS5pc0xlZ2VuZERpc2FibGVkXG4gICAgICAgIH1cblxuICAgIGluaXQge1xuICAgICAgICBteUxheWVycyA9IEFycmF5TGlzdChsYXllcnMpXG4gICAgfVxuXG4gICAgZnVuIHJlbmRlcmVkQWVzKCk6IExpc3Q8QWVzPCo+PiB7XG4gICAgICAgIHJldHVybiBpZiAobXlMYXllcnMuaXNFbXB0eSgpKSB7XG4gICAgICAgICAgIC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RPZk5vdE51bGwoXG4gICAgICAgICAgICAgICAgeFZhcixcbiAgICAgICAgICAgICAgICB5VmFyLFxuICAgICAgICAgICAgKSxcbiAgICAgICAgICAgIGxpc3RPZk5vdE51bGwoXG4gICAgICAgICAgICAgICAgeFZhcj8ubGV0IHsgeExldmVscyB9LFxuICAgICAgICAgICAgICAgIHlWYXI/LmxldCB7IHlMZXZlbHMgfSxcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgICAgICB2YWwgZGF0YUJ5TGV2ZWxUdXBsZSA9IGRhdGFCeUxldmVsVHVwbGVMaXN0LnRvTWFwKClcblxuICAgICAgICB2YWwgY29sTGV2ZWxzID0geExldmVscy5pZkVtcHR5IHsgbGlzdE9mKG51bGwpIH1cbiAgICAgICAgdmFsIHJvd0xldmVscyA9IHlMZXZlbHMuaWZFbXB0eSB7IGxpc3RPZihudWxsKSB9XG5cbiAgICAgICAgdmFsIGRhdGFCeVRpbGU6IE11dGFibGVMaXN0PERhdGFGcmFtZT4gPSBBcnJheUxpc3QoKVxuICAgICAgICAvLyBFbnVtZXJhdGUgdGlsZXMgYnktcm93LlxuICAgICAgICBmb3IgKHJvd0xldmVsIGluIHJvd0xldmVscykge1xuICAgICAgICAgICAgZm9yIChjb2xMZXZlbCBpbiBjb2xMZXZlbHMpIHtcbiAgICAgICAgICAgICAgICB2YWwgbGV2ZWxUdXBsZSA9IGxpc3RPZk5vdE51bGwoY29sTGV2ZWwsIHJvd0xldmVsKVxuICAgICAgICAgICAgICAgIHZhbCB0aWxlRGF0YSA9IGRhdGFCeUxldmVsVHVwbGUuZ2V0VmFsdWUobGV2ZWxUdXBsZSlcbiAgICAgICAgICAgICAgICBkYXRhQnlUaWxlLmFkZCh0aWxlRGF0YSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBkYXRhQnlUaWxlXG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQHJldHVybiBMaXN0IG9mIEZhY2V0VGlsZUluZm8uXG4gICAgICogICAgICAgICAgVGlsZXMgYXJlIGVudW1lcmF0ZWQgYnkgcm93cywgaS5lLjpcbiAgICAgKiAgICAgICAgICB0aGUgaW5kZXggaXMgY29tcHV0ZWQgbGlrZTogcm93ICogbkNvbHMgKyBjb2xcbiAgICAgKi9cbiAgICBvdmVycmlkZSBmdW4gdGlsZUluZm9zKCk6IExpc3Q8RmFjZXRUaWxlSW5mbz4ge1xuICAgICAgICB2YWwgY29sTGFiZWxzID0gKHhMZXZlbHMuaWZFbXB0eSB7IGxpc3RPZihudWxsKSB9KS5tYXAge1xuICAgICAgICAgICAgaXQ/LmxldCB7IHhGb3JtYXR0ZXIoaXQpIH1cbiAgICAgICAgfVxuICAgICAgICB2YWwgcm93TGFiZWxzID0gKHlMZXZlbHMuaWZFbXB0eSB7IGxpc3RPZihudWxsKSB9KS5tYXAge1xuICAgICAgICAgICAgaXQ/LmxldCB7IHlGb3JtYXR0ZXIoaXQpIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBpbmZvcyA9IEFycmF5TGlzdDxGYWNldFRpbGVJbmZvPigpXG4gICAgICAgIGZvciAocm93IGluIDAgdW50aWwgcm93Q291bnQpIHtcbiAgICAgICAgICAgIHZhbCBhZGRDb2xMYWIgPSByb3cgPT0gMFxuICAgICAgICAgICAgdmFsIGhhc1hBeGlzID0gcm93ID09IHJvd0NvdW50IC0gMVxuICAgICAgICAgICAgZm9yIChjb2wgaW4gMCB1bnRpbCBjb2xDb3VudCkge1xuICAgICAgICAgICAgICAgIHZhbCBhZGRSb3dMYWIgPSBjb2wgPT0gY29sQ291bnQgLSAxXG4gICAgICAgICAgICAgICAgdmFsIGhhc1lBeGlzID0gY29sID09IDBcblxuICAgICAgICAgICAgICAgIHZhbCBjb2xMYWJzID0gaWYgKGFkZENvbExhYikge1xuICAgICAgICAgICAgICAgICAgICBjb2xMYWJlbHNbY29sXT8ubGV0IHsgbGlzdE9mKGl0KSB9ID86IGVtcHR5TGlzdCgpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgZW1wdHlMaXN0PFN0cmluZz4oKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGluZm9zLmFkZChcbiAgICAgICAgICAgICAgICAgICAgRmFjZXRUaWxlSW5mbyhcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbCwgcm93LFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sTGFicyxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhZGRSb3dMYWIpIHJvd0xhYmVsc1tyb3ddIGVsc2UgbnVsbCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhhc1hBeGlzLCBoYXNZQXhpcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRydWVJbmRleCA9IGluZm9zLnNpemVcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBpbmZvc1xuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjEuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGNhbiBiZSBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlLlxuICovXG5cbnBhY2thZ2UgamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5hc3NlbWJsZS5mYWNldFxuXG5pbXBvcnQgamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYmFzZS5EYXRhRnJhbWVcbmltcG9ydCBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmFzc2VtYmxlLlBsb3RGYWNldHNcbmltcG9ydCBrb3RsaW4ubWF0aC5jZWlsXG5pbXBvcnQga290bGluLm1hdGgubWF4XG5pbXBvcnQga290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ci5zZWNvbmQgfSB9ICAgICAgICAgICAgICAgICAgICAvLyBnZXQgcmlkIG9mICdwYWlyJ1xuICAgICAgICAgICAgLm1hcCB7IGl0Lm1hcEluZGV4ZWQgeyBpLCBsZXZlbCAtPiBmYWNldEZvcm1hdHRlcnNbaV0obGV2ZWwpIH0gfSAgICAgICAgICAgICAgICAvLyB0byBzdHJpbmcgdHVwbGVzXG5cbiAgICAgICAgZnVuIHRvQ29sKGluZGV4OiBJbnQpOiBJbnQge1xuICAgICAgICAgICAgcmV0dXJuIHdoZW4gKGRpcmVjdGlvbikge1xuICAgICAgICAgICAgICAgIERpcmVjdGlvbi5IIC0+IGluZGV4ICUgY29sQ291bnRcbiAgICAgICAgICAgICAgICBEaXJlY3Rpb24uViAtPiBpbmRleCAvIHJvd0NvdW50XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdG9Sb3coaW5kZXg6IEludCk6IEludCB7XG4gICAgICAgICAgICByZXR1cm4gd2hlbiAoZGlyZWN0aW9uKSB7XG4gICAgICAgICAgICAgICAgRGlyZWN0aW9uLkggLT4gaW5kZXggLyBjb2xDb3VudFxuICAgICAgICAgICAgICAgIERpcmVjdGlvbi5WIC0+IGluZGV4ICUgcm93Q291bnRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB0b0luZGV4KGNvbDogSW50LCByb3c6IEludCk6IEludCB7XG4gICAgICAgICAgICByZXR1cm4gd2hlbiAoZGlyZWN0aW9uKSB7XG4gICAgICAgICAgICAgICAgRGlyZWN0aW9uLkggLT4gcm93ICogY29sQ291bnQgKyBjb2xcbiAgICAgICAgICAgICAgICBEaXJlY3Rpb24uViAtPiBjb2wgKiByb3dDb3VudCArIHJvd1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGlzQm90dG9tKGNvbDogSW50LCByb3c6IEludCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgdmFsIG5leHRSb3dJbmRleCA9IHRvSW5kZXgoY29sLCByb3cgKyAxKVxuICAgICAgICAgICAgcmV0dXJuIChyb3cgKyAxKSAlIHJvd0NvdW50ID09IDAgfHwgbmV4dFJvd0luZGV4ID49IG51bVRpbGVzXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgaW5mb3MgPSBBcnJheUxpc3Q8RmFjZXRUaWxlSW5mbz4oKVxuICAgICAgICBmb3IgKChpLCB0aWxlTGFiZWxUdXBsZSkgaW4gdGlsZUxhYmVscy53aXRoSW5kZXgoKSkge1xuICAgICAgICAgICAgdmFsIGNvbCA9IHRvQ29sKGkpXG4gICAgICAgICAgICB2YWwgcm93ID0gdG9Sb3coaSlcbi8vICAgICAgICAgICAgdmFsIG5leHRSb3dJbmRleCA9IHRvSW5kZXgoY29sLCByb3cgKyAxKVxuLy8gICAgICAgICAgICB2YWwgaGFzWEF4aXMgPSBuZXh0Um93SW5kZXggPj0gbnVtVGlsZXNcbiAgICAgICAgICAgIHZhbCBoYXNYQXhpcyA9IGlzQm90dG9tKGNvbCwgcm93KVxuICAgICAgICAgICAgdmFsIGhhc1lBeGlzID0gY29sID09IDBcblxuICAgICAgICAgICAgaW5mb3MuYWRkKFxuICAgICAgICAgICAgICAgIEZhY2V0VGlsZUluZm8oXG4gICAgICAgICAgICAgICAgICAgIGNvbCwgcm93LFxuICAgICAgICAgICAgICAgICAgICBjb2xMYWJzID0gdGlsZUxhYmVsVHVwbGUsXG4gICAgICAgICAgICAgICAgICAgIG51bGwsXG4gICAgICAgICAgICAgICAgICAgIGhhc1hBeGlzLCBoYXNZQXhpcyxcbiAgICAgICAgICAgICAgICAgICAgdHJ1ZUluZGV4ID0gaVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEVudW1lcmF0aW9uIGlzIGFsd2F5cyAnYnkgcm93Jy5cbiAgICAgICAgcmV0dXJuIGluZm9zLnNvcnRlZFdpdGgoY29tcGFyZUJ5PEZ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11c3QgYmUgcG9zaXRpdmUsIHdhcyAkbnJvd1wiIH1cbiAgICAgICAgICAgIHZhbCBzaGFwZSA9IHdoZW4ge1xuICAgICAgICAgICAgICAgIG5jb2wgIT0gbnVsbCAtPiB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBuY29sQWN0dWFsID0gbWluKG5jb2wsIHRpbGVzQ291bnQpXG4gICAgICAgICAgICAgICAgICAgIHZhbCBucm93QWN0dWFsID0gY2VpbCh0aWxlc0NvdW50LnRvRG91YmxlKCkgLyBuY29sQWN0dWFsKS50b0ludCgpXG4gICAgICAgICAgICAgICAgICAgIG5jb2xBY3R1YWwgdG8gbWF4KDEsIG5yb3dBY3R1YWwpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG5yb3cgIT0gbnVsbCAtPiB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBucm93QWN0dWFsID0gbWluKG5yb3csIHRpbGVzQ291bnQpXG4gICAgICAgICAgICAgICAgICAgIHZhbCBuY29sQWN0dWFsID0gY2VpbCh0aWxlc0NvdW50LnRvRG91YmxlKCkgLyBucm93QWN0dWFsKS50b0ludCgpXG4gICAgICAgICAgICAgICAgICAgIG5jb2xBY3R1YWwgdG8gbWF4KDEsIG5yb3dBY3R1YWwpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2UgLT4ge1xuICAgICAgICAgICAgICAgICAgICB2YWwgdyA9IG1pbig0LCBtYXgoMSwgdGlsZXNDb3VudCAvIDIpKVxuICAgICAgICAgICAgICAgICAgICB2YWwgaCA9IG1heCgxLCBjZWlsKHRpbGVzQ291bnQudG9Eb3VibGUoKSAvIHcpLnRvSW50KCkpXG4gICAgICAgICAgICAgICAgICAgIHcgdG8gaFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsICh3LCBoKSA9IHNoYXBlXG4gICAgICAgICAgICByZXR1cm4gd2hlbiAoZGlyKSB7XG4gICAgICAgICAgICAgICAgRGlyZWN0aW9uLkggLT4ge1xuICAgICAgICAgICAgICAgICAgICAvLyBmaWxsaW5nIGJ5IHJvd3NcbiAgICAgICAgICAgICAgICAgICAgUGFpcihcbiAgICAgICAgICAgICAgICAgICAgICAgIHcsXG4gICAgICAgICAgICAgICAgICAgICAgICBjZWlsKHRpbGVzQ291bnQudG9Eb3VibGUoKSAvIHcpLnRvSW50KClcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBEaXJlY3Rpb24uViAtPiB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGZpbGxpbmcgYnkgY29sc1xuICAgICAgICAgICAgICAgICAgICBQYWlyKFxuICAgICAgICAgICAgICAgICAgICAgICAgY2VpbCh0aWxlc0NvdW50LnRvRG91YmxlKCkgLyBoKS50b0ludCgpLFxuICAgICAgICAgICAgICAgICAgICAgICAgaFxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmFzc2VtYmxlLmdlb21cblxuaW1wb3J0IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJhc2UuQWVzXG5pbXBvcnQgamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYmFzZS5HZW9tXG5pbXBvcnQgamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYmFzZS5HZW9tS2luZFxuaW1wb3J0IGpldGJyYWlucy5kYXRhbG9yZS5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ZhbCBteUFlc3RoZXRpY3NEZWZhdWx0czogQWVzdGhldGljc0RlZmF1bHRzLFxuICAgICAgICBwcml2YXRlIHZhbCBteUhhbmRsZXNHcm91cHM6IEJvb2xlYW4sXG4gICAgICAgIHByaXZhdGUgdmFsIG15R2VvbVN1cHBsaWVyOiAoKSAtPiBHZW9tXG4gICAgKSB7XG4gICAgICAgIGludGVybmFsIGZ1biBidWlsZCgpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA6IEdlb21Qcm92aWRlcihteUtpbmQpIHtcblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVHZW9tKCk6IEdlb20ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbXlHZW9tU3VwcGxpZXIoKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBhZXN0aGV0aWNzRGVmYXVsdHMoKTogQWVzdGhldGljc0RlZmF1bHRzIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG15QWVzdGhldGljc0RlZmF1bHRzXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGhhbmRsZXNHcm91cHMoKTogQm9vbGVhbiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBteUhhbmRsZXNHcm91cHNcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcblxuICAgICAgICBmdW4gcG9pbnQoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBwb2ludCB7IFBvaW50R2VvbSgpIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBwb2ludChzdXBwbGllcjogKCkgLT4gR2VvbSk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5QT0lOVCxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMucG9pbnQoKSxcbiAgICAgICAgICAgICAgICBQb2ludEdlb20uSEFORExFU19HUk9VUFMsXG4gICAgICAgICAgICAgICAgc3VwcGxpZXJcbiAgICAgICAgICAgICkuYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHBhdGgoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBwYXRoIHsgUGF0aEdlb20oKSB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcGF0aChzdXBwbGllcjogKCkgLT4gR2VvbSk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5QQVRILFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5wYXRoKCksXG4gICAgICAgICAgICAgICAgUGF0aEdlb20uSEFORExFU19HUk9VUFMsXG4gICAgICAgICAgICAgICAgc3VwcGxpZXJcbiAgICAgICAgICAgICkuYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGxpbmUoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkxJTkUsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmxpbmUoKSxcbiAgICAgICAgICAgICAgICBMaW5lR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IExpbmVHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gc21vb3RoKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5TTU9PVEgsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLnNtb290aCgpLFxuICAgICAgICAgICAgICAgIFNtb290aEdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBTbW9vdGhHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYmFyKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5CQVIsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmJhcigpLFxuICAgICAgICAgICAgICAgIEJhckdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBCYXJHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaGlzdG9ncmFtKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5ISVNUT0dSQU0sXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmhpc3RvZ3JhbSgpLFxuICAgICAgICAgICAgICAgIEhpc3RvZ3JhbUdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBIaXN0b2dyYW1HZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdGlsZSgpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuVElMRSxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMudGlsZSgpLFxuICAgICAgICAgICAgICAgIFRpbGVHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgVGlsZUdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBiaW4yZCgpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuQklOXzJELFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5iaW4yZCgpLFxuICAgICAgICAgICAgICAgIEJpbjJkR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IEJpbjJkR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGVycm9yQmFyKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5FUlJPUl9CQVIsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmVycm9yQmFyKCksXG4gICAgICAgICAgICAgICAgRXJyb3JCYXJHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgRXJyb3JCYXJHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gY3Jvc3NCYXIoc3VwcGxpZXI6ICgpIC0+IEdlb20pOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuQ1JPU1NfQkFSLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5jcm9zc0JhcigpLFxuICAgICAgICAgICAgICAgIENyb3NzQmFyR2VvbS5IQU5ETEVTX0dST1VQUyxcbiAgICAgICAgICAgICAgICBzdXBwbGllclxuICAgICAgICAgICAgKS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gbGluZVJhbmdlKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5MSU5FX1JBTkdFLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5saW5lUmFuZ2UoKSxcbiAgICAgICAgICAgICAgICBMaW5lUmFuZ2VHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgTGluZVJhbmdlR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHBvaW50UmFuZ2Uoc3VwcGxpZXI6ICgpIC0+IEdlb20pOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuUE9JTlRfUkFOR0UsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLnBvaW50UmFuZ2UoKSxcbiAgICAgICAgICAgICAgICBQb2ludFJhbmdlR2VvbS5IQU5ETEVTX0dST1VQUyxcbiAgICAgICAgICAgICAgICBzdXBwbGllclxuICAgICAgICAgICAgKS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gY29udG91cigpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuQ09OVE9VUixcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMuY29udG91cigpLFxuICAgICAgICAgICAgICAgIENvbnRvdXJHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgQ29udG91ckdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBjb250b3VyZigpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuQ09OVE9VUkYsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmNvbnRvdXJmKCksXG4gICAgICAgICAgICAgICAgQ29udG91cmZHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgQ29udG91cmZHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcG9seWdvbigpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuUE9MWUdPTixcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMucG9seWdvbigpLFxuICAgICAgICAgICAgICAgIFBvbHlnb25HZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgUG9seWdvbkdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBtYXAoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLk1BUCxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMubWFwKCksXG4gICAgICAgICAgICAgICAgTWFwR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IE1hcEdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBhYmxpbmUoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkFCX0xJTkUsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmFibGluZSgpLFxuICAgICAgICAgICAgICAgIEFCTGluZUdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBBQkxpbmVHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaGxpbmUoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkhfTElORSxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMuaGxpbmUoKSxcbiAgICAgICAgICAgICAgICBITGluZUdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBITGluZUdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB2bGluZSgpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuVl9MSU5FLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy52bGluZSgpLFxuICAgICAgICAgICAgICAgIFZMaW5lR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IFZMaW5lR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGJveHBsb3Qoc3VwcGxpZXI6ICgpIC0+IEdlb20pOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuQk9YX1BMT1QsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmJveHBsb3QoKSxcbiAgICAgICAgICAgICAgICBCb3hwbG90R2VvbS5IQU5ETEVTX0dST1VQUyxcbiAgICAgICAgICAgICAgICBzdXBwbGllclxuICAgICAgICAgICAgKS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gbGl2ZW1hcChcbiAgICAgICAgICAgIG9wdGlvbnM6IExpdmVNYXBPcHRpb25zXG4gICAgICAgICk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5MSVZFX01BUCxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMubGl2ZW1hcChvcHRpb25zLmRpc3BsYXlNb2RlKSxcbiAgICAgICAgICAgICAgICBMaXZlTWFwR2VvbS5IQU5ETEVTX0dST1VQUyxcbiAgICAgICAgICAgICAgICBteUdlb21TdXBwbGllciA9IHsgTGl2ZU1hcEdlb20ob3B0aW9ucy5kaXNwbGF5TW9kZSkgfVxuICAgICAgICAgICAgKS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcmliYm9uKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5SSUJCT04sXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLnJpYmJvbigpLFxuICAgICAgICAgICAgICAgIFJpYmJvbkdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBSaWJib25HZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYXJlYSgpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuQVJFQSxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMuYXJlYSgpLFxuICAgICAgICAgICAgICAgIEFyZWFHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgQXJlYUdlb20oKSB9LmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBkZW5zaXR5KCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5ERU5TSVRZLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5kZW5zaXR5KCksXG4gICAgICAgICAgICAgICAgRGVuc2l0eUdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBEZW5zaXR5R2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGRlbnNpdHkyZCgpOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuREVOU0lUWTJELFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5kZW5zaXR5MmQoKSxcbiAgICAgICAgICAgICAgICBEZW5zaXR5MmRHZW9tLkhBTkRMRVNfR1JPVVBTXG4gICAgICAgICAgICApIHsgRGVuc2l0eTJkR2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGRlbnNpdHkyZGYoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkRFTlNJVFkyREYsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmRlbnNpdHkyZGYoKSxcbiAgICAgICAgICAgICAgICBEZW5zaXR5MmRmR2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IERlbnNpdHkyZGZHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaml0dGVyKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5KSVRURVIsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLmppdHRlcigpLFxuICAgICAgICAgICAgICAgIEppdHRlckdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBKaXR0ZXJHZW9tKCkgfS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZnJlcXBvbHkoKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLkZSRVFQT0xZLFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5mcmVxcG9seSgpLFxuICAgICAgICAgICAgICAgIEZyZXFwb2x5R2VvbS5IQU5ETEVTX0dST1VQU1xuICAgICAgICAgICAgKSB7IEZyZXFwb2x5R2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHN0ZXAoc3VwcGxpZXI6ICgpIC0+IEdlb20pOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuU1RFUCxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMuc3RlcCgpLFxuICAgICAgICAgICAgICAgIFN0ZXBHZW9tLkhBTkRMRVNfR1JPVVBTLFxuICAgICAgICAgICAgICAgIHN1cHBsaWVyXG4gICAgICAgICAgICApLmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biByZWN0KCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbiAgICAgICAgICAgICAgICBHZW9tS2luZC5SRUNULFxuICAgICAgICAgICAgICAgIEFlc3RoZXRpY3NEZWZhdWx0cy5yZWN0KCksXG4gICAgICAgICAgICAgICAgUmVjdEdlb20uSEFORExFU19HUk9VUFNcbiAgICAgICAgICAgICkgeyBSZWN0R2VvbSgpIH0uYnVpbGQoKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHNlZ21lbnQoc3VwcGxpZXI6ICgpIC0+IEdlb20pOiBHZW9tUHJvdmlkZXIge1xuICAgICAgICAgICAgcmV0dXJuIEdlb21Qcm92aWRlckJ1aWxkZXIoXG4gICAgICAgICAgICAgICAgR2VvbUtpbmQuU0VHTUVOVCxcbiAgICAgICAgICAgICAgICBBZXN0aGV0aWNzRGVmYXVsdHMuc2VnbWVudCgpLFxuICAgICAgICAgICAgICAgIFNlZ21lbnRHZW9tLkhBTkRMRVNfR1JPVVBTLFxuICAgICAgICAgICAgICAgIHN1cHBsaWVyXG4gICAgICAgICAgICApLmJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB0ZXh0KHN1cHBsaWVyOiAoKSAtPiBHZW9tKTogR2VvbVByb3ZpZGVyIHtcbiAgICAgICAgICAgIHJldHVybiBHZW9tUHJvdmlkZXJCdWlsZGVyKFxuICAgICAgICAgICAgICAgIEdlb21LaW5kLlRFWFQsXG4gICAgICAgICAgICAgICAgQWVzdGhldGljc0RlZmF1bHRzLnRleHQoKSxcbiAgICAgICAgICAgICAgICBUZXh0R2VvbS5IQU5ETEVTX0dST1VQUyxcbiAgICAgICAgICAgICAgICBzdXBwbGllclxuICAgICAgICAgICAgKS5idWlsZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gcmFzdGVyKCk6IEdlb21Qcm92aWRlciB7XG4gICAgICAgICAgICByZXR1cm4gR2VvbVByb3ZpZGVyQnVpbGRlcihcbi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IGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgYXhpc0xlbmd0aDogRG91YmxlLFxuICAgICAgICBicmVha3M6IFNjYWxlQnJlYWtzXG4gICAgKTogU2NhbGU8RG91YmxlPiB7XG4gICAgICAgIHJldHVybiBidWlsZEF4aXNTY2FsZURlZmF1bHQoXG4gICAgICAgICAgICBzY2FsZVByb3RvLFxuICAgICAgICAgICAgZG9tYWluLFxuICAgICAgICAgICAgYXhpc0xlbmd0aCxcbiAgICAgICAgICAgIGJyZWFrc1xuICAgICAgICApXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGJ1aWxkQXhpc1NjYWxlWShcbiAgICAgICAgc2NhbGVQcm90bzogU2NhbGU8RG91YmxlPixcbiAgICAgICAgZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICBheGlzTGVuZ3RoOiBEb3VibGUsXG4gICAgICAgIGJyZWFrczogU2NhbGVCcmVha3NcbiAgICApOiBTY2FsZTxEb3VibGU+IHtcbiAgICAgICAgcmV0dXJuIGJ1aWxkQXhpc1NjYWxlRGVmYXVsdChcbiAgICAgICAgICAgIHNjYWxlUHJvdG8sXG4gICAgICAgICAgICBkb21haW4sXG4gICAgICAgICAgICBheGlzTGVuZ3RoLFxuICAgICAgICAgICAgYnJlYWtzXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gY3JlYXRlQ29vcmRpbmF0ZVN5c3RlbShcbiAgICAgICAgeERvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgeEF4aXNMZW5ndGg6IERvdWJsZSxcbiAgICAgICAgeURvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgeUF4aXNMZW5ndGg6IERvdWJsZVxuICAgICk6IENvb3JkaW5hdGVTeXN0ZW0ge1xuICAgICAgICB2YWwgbWFwcGVyWCA9IGxpbmVhck1hcHBlcih4RG9tYWluLCB4QXhpc0xlbmd0aClcbiAgICAgICAgdmFsIG1hcHBlclkgPSBsaW5lYXJNYXBwZXIoeURvbWFpbiwgeUF4aXNMZW5ndGgpXG4gICAgICAgIHJldHVybiBDb29yZHMuY3JlYXRlKFxuICAgICAgICAgICAgTWFwcGVyVXRpbC5tYXAoXG4gICAgICAgICAgICAgICAgeERvbWFpbixcbiAgICAgICAgICAgICAgICBtYXBwZXJYXG4gICAgICAgICAgICApLFxuICAgICAgICAgICAgTWFwcGVyVXRpbC5tYXAoXG4gICAgICAgICAgICAgICAgeURvbWFpbixcbiAgICAgICAgICAgICAgICBtYXBwZXJZXG4gICAgICAgICAgICApLFxuICAgICAgICAgICAgeExpbT8ubGV0IHsgTWFwcGVyVXRpbC5tYXAoaXQsIG1hcHBlclgpIH0sXG4gICAgICAgICAgICB5TGltPy5sZXQgeyBNYXBwZXJVdGlsLm1hcChpdCwgbWFwcGVyWSkgfVxuICAgICAgICApXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGFkanVzdERvbWFpbnMoXG4gICAgICAgIHhEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIHlEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIGRpc3BsYXlTaXplOiBEb3VibGVWZWN0b3JcbiAgICApOiBQYWlyPENsb3NlZFJhbmdlPERvdWJsZT4sIENsb3NlZFJhbmdlPERvdWJsZT4+IHtcbiAgICAgICAgcmV0dXJuIFBhaXIoeExpbSA/OiB4RG9tYWluLCB5TGltID86IHlEb21haW4pXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGZ1biBsaW5lYXJNYXBwZXIoZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LCBheGlzTGVuZ3RoOiBEb3VibGUpOiAoRG91YmxlPykgLT4gRG91YmxlPyB7XG4gICAgICAgICAgICByZXR1cm4gTWFwcGVycy5tdWwoZG9tYWluLCBheGlzTGVuZ3RoKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gYnVpbGRBeGlzU2NhbGVEZWZhdWx0KFxuICAgICAgICAgICAgc2NhbGVQcm90bzogU2NhbGU8RG91YmxlPixcbiAgICAgICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgICAgIGF4aXNMZW5ndGg6IERvdWJsZSxcbiAgICAgICAgICAgIGJyZWFrczogU2NhbGVCcmVha3NcbiAgICAgICAgKTogU2NhbGU8RG91YmxlPiB7XG4gICAgICAgICAgICByZXR1cm4gYnVpbGRBeGlzU2NhbGVEZWZhdWx0KFxuICAgICAgICAgICAgICAgIHNjYWxlUHJvdG8sXG4gICAgICAgICAgICAgICAgbGluZWFyTWFwcGVyKGRvbWFpbiwgYXhpc0xlbmd0aCksXG4gICAgICAgICAgICAgICAgYnJlYWtzXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gYnVpbGRBeGlzU2NhbGVEZWZhdWx0KFxuICAgICAgICAgICAgc2NhbGVQcm90bzogU2NhbGU8RG91YmxlPixcbiAgICAgICAgICAgIGF4aXNNYXBwZXI6IChEb3VibGU/KSAtPiBEb3VibGU/LFxuICAgICAgICAgICAgYnJlYWtzOiBTY2FsZUJyZWFrc1xuICAgICAgICApOiBTY2FsZTxEb3VibGU+IHtcbiAgICAgICAgICAgIHJldHVybiBzY2FsZVByb3RvLndpdGgoKVxuICAgICAgICAgICAgICAgIC5icmVha3MoYnJlYWtzLmRvbWFpblZhbHVlcylcbiAgICAgICAgICAgICAgICAubGFiZWxzKGJyZWFrcy5sYWJlbHMpXG4gICAgICAgICAgICAgICAgLm1hcHBlcihheGlzTWFwcGVyKVxuICAgICAgICAgICAgICAgIC5idWlsZCgpXG4gICAgICAgIH1cbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDIwLiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc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tYWluLCBkaXNwbGF5U2l6ZSlcblxuICAgICAgICBAU3VwcHJlc3MoXCJOQU1FX1NIQURPV0lOR1wiKVxuICAgICAgICB2YWwgeERvbWFpbiA9IHByb2plY3Rpb25YLnRvVmFsaWREb21haW4oYWRqdXN0ZWQuZmlyc3QpXG5cbiAgICAgICAgQFN1cHByZXNzKFwiTkFNRV9TSEFET1dJTkdcIilcbiAgICAgICAgdmFsIHlEb21haW4gPSBwcm9qZWN0aW9uWS50b1ZhbGlkRG9tYWluKGFkanVzdGVkLnNlY29uZClcblxuICAgICAgICAvLyBjb21wdXRlIHByb2plY3RlZCByYXRpb1xuICAgICAgICB2YWwgc3BhblggPSBTZXJpZXNVdGlsLnNwYW4oeERvbWFpbilcbiAgICAgICAgdmFsIHNwYW5ZID0gU2VyaWVzVXRpbC5zcGFuKHlEb21haW4pXG4gICAgICAgIHZhbCBkb21haW5TcXVhcmU6IFBhaXI8Q2xvc2VkUmFuZ2U8RG91YmxlPiwgQ2xvc2VkUmFuZ2U8RG91YmxlPj4gPVxuICAgICAgICAgICAgaWYgKHNwYW5YID4gc3BhblkpIHtcbiAgICAgICAgICAgICAgICB2YWwgY2VudGVyID0geERvbWFpbi5sb3dlckVuZCArIHNwYW5YIC8gMlxuICAgICAgICAgICAgICAgIHZhbCBoYWxmU3BhbiA9IHNwYW5ZIC8gMlxuICAgICAgICAgICAgICAgIFBhaXIoXG4gICAgICAgICAgICAgICAgICAgIENsb3NlZFJhbmdlKGNlbnRlciAtIGhhbGZTcGFuLCBjZW50ZXIgKyBoYWxmU3BhbiksXG4gICAgICAgICAgICAgICAgICAgIHlEb21haW5cbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHZhbCBjZW50ZXIgPSB5RG9tYWluLmxvd2VyRW5kICsgc3BhblkgLyAyXG4gICAgICAgICAgICAgICAgdmFsIGhhbGZTcGFuID0gc3BhblggLyAyXG4gICAgICAgICAgICAgICAgUGFpcihcbiAgICAgICAgICAgICAgICAgICAgeERvbWFpbixcbiAgICAgICAgICAgICAgICAgICAgQ2xvc2VkUmFuZ2UoY2VudGVyIC0gaGFsZlNwYW4sIGNlbnRlciArIGhhbGZTcGFuKVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cblxuICAgICAgICB2YWwgcHJvamVjdGVkWE1pbiA9IHByb2plY3Rpb25YLmFwcGx5KGRvbWFpblNxdWFyZS5maXJzdC5sb3dlckVuZClcbiAgICAgICAgdmFsIHByb2plY3RlZFhNYXggPSBwcm9qZWN0aW9uWC5hcHBseShkb21haW5TcXVhcmUuZmlyc3QudXBwZXJFbmQpXG4gICAgICAgIHZhbCBwcm9qZWN0ZWRZTWluID0gcHJvamVjdGlvblkuYXBwbHkoZG9tYWluU3F1YXJlLnNlY29uZC5sb3dlckVuZClcbiAgICAgICAgdmFsIHByb2plY3RlZFlNYXggPSBwcm9qZWN0aW9uWS5hcHBseShkb21haW5TcXVhcmUuc2Vjb25kLnVwcGVyRW5kKVxuXG4gICAgICAgIHZhbCByYXRpbyA9IChwcm9qZWN0ZWRZTWF4IC0gcHJvamVjdGVkWU1pbikgLyAocHJvamVjdGVkWE1heCAtIHByb2plY3RlZFhNaW4pXG4gICAgICAgIHZhbCBmaXhlZENvb3JkID0gRml4ZWRSYXRpb0Nvb3JkUHJvdmlkZXIocmF0aW8sIG51bGwsIG51bGwpXG4gICAgICAgIHJldHVybiBmaXhlZENvb3JkLmFkanVzdERvbWFpbnMoeERvbWFpbiwgeURvbWFpbiwgZGlzcGxheVNpemUpXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGJ1aWxkQXhpc1NjYWxlWChcbiAgICAgICAgc2NhbGVQcm90bzogU2NhbGU8RG91YmxlPixcbiAgICAgICAgZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICBheGlzTGVuZ3RoOiBEb3VibGUsXG4gICAgICAgIGJyZWFrczogU2NhbGVCcmVha3NcbiAgICApOiBTY2FsZTxEb3VibGU+IHtcbiAgICAgICAgcmV0dXJuIGlmIChwcm9qZWN0aW9uWC5ub25saW5lYXIpIHtcbiAgICAgICAgICAgIGJ1aWxkQXhpc1NjYWxlV2l0aFByb2plY3Rpb24oXG4gICAgICAgICAgICAgICAgcHJvamVjdGlvblgsXG4gICAgICAgICAgICAgICAgc2NhbGVQcm90byxcbiAgICAgICAgICAgICAgICBkb21haW4sXG4gICAgICAgICAgICAgICAgYXhpc0xlbmd0aCxcbiAgICAgICAgICAgICAgICBicmVha3NcbiAgICAgICAgICAgIClcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHN1cGVyLmJ1aWxkQXhpc1NjYWxlWChzY2FsZVByb3RvLCBkb21haW4sIGF4aXNMZW5ndGgsIGJyZWFrcylcbiAgICAgICAgfVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBidWlsZEF4aXNTY2FsZVkoXG4gICAgICAgIHNjYWxlUHJvdG86IFNjYWxlPERvdWJsZT4sXG4gICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgYXhpc0xlbmd0aDogRG91YmxlLFxuICAgICAgICBicmVha3M6IFNjYWxlQnJlYWtzXG4gICAgKTogU2NhbGU8RG91YmxlPiB7XG4gICAgICAgIHJldHVybiBpZiAocHJvamVjdGlvblkubm9ubGluZWFyKSB7XG4gICAgICAgICAgICBidWlsZEF4aXNTY2FsZVdpdGhQcm9qZWN0aW9uKFxuICAgICAgICAgICAgICAgIHByb2plY3Rpb25ZLFxuICAgICAgICAgICAgICAgIHNjYWxlUHJvdG8sXG4gICAgICAgICAgICAgICAgZG9tYWluLFxuICAgICAgICAgICAgICAgIGF4aXNMZW5ndGgsXG4gICAgICAgICAgICAgICAgYnJlYWtzXG4gICAgICAgICAgICApXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBzdXBlci5idWlsZEF4aXNTY2FsZVkoc2NhbGVQcm90bywgZG9tYWluLCBheGlzTGVuZ3RoLCBicmVha3MpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgcHJpdmF0ZSBmdW4gYnVpbGRBeGlzU2NhbGVXaXRoUHJvamVjdGlvbihcbiAgICAgICAgICAgIHByb2plY3Rpb246IFByb2plY3Rpb24sIHNjYWxlUHJvdG86IFNjYWxlPERvdWJsZT4sXG4gICAgICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgICAgICBheGlzTGVuZ3RoOiBEb3VibGUsXG4gICAgICAgICAgICBicmVha3M6IFNjYWxlQnJlYWtzXG4gICAgICAgICk6IFNjYWxlPERvdWJsZT4ge1xuXG4gICAgICAgICAgICB2YWwgdmFsaWREb21haW4gPSBwcm9qZWN0aW9uLnRvVmFsaWREb21haW4oZG9tYWluKVxuICAgICAgICAgICAgdmFsIHZhbGlkRG9tYWluUHJvamVjdGVkID0gQ2xvc2VkUmFuZ2UoXG4gICAgICAgICAgICAgICAgcHJvamVjdGlvbi5hcHBseSh2YWxpZERvbWFpbi5sb3dlckVuZCksXG4gICAgICAgICAgICAgICAgcHJvamVjdGlvbi5hcHBseSh2YWxpZERvbWFpbi51cHBlckVuZClcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgdmFsIHByb2plY3Rpb25JbnZlcnNlID0gTWFwcGVycy5saW5lYXIodmFsaWREb21haW5Qcm9qZWN0ZWQsIHZhbGlkRG9tYWluKVxuXG4gICAgICAgICAgICB2YWwgbGluZWFyTWFwcGVyID0gbGluZWFyTWFwcGVyKFxuICAgICAgICAgICAgICAgIGRvbWFpbixcbiAgICAgICAgICAgICAgICBheGlzTGVuZ3RoXG4gICAgICAgICAgICApXG4gICAgICAgICAgICB2YWwgc2NhbGVNYXBwZXIgPSB0d2lzdFNjYWxlTWFwcGVyKFxuICAgICAgICAgICAgICAgIHByb2plY3Rpb24sXG4gICAgICAgICAgICAgICAgcHJvamVjdGlvbkludmVyc2UsXG4gICAgICAgICAgICAgICAgbGluZWFyTWFwcGVyXG4gICAgICAgICAgICApXG4gICAgICAgICAgICB2YWwgdmFsaWRCcmVha3MgPSB2YWxpZGF0ZUJyZWFrcyh2YWxpZERvbWFpbiwgYnJlYWtzKVxuICAgICAgICAgICAgcmV0dXJuIGJ1aWxkQXhpc1NjYWxlRGVmYXVsdChcbiAgICAgICAgICAgICAgICBzY2FsZVByb3RvLFxuICAgICAgICAgICAgICAgIHNjYWxlTWFwcGVyLFxuICAgICAgICAgICAgICAgIHZhbGlkQnJlYWtzXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biB2YWxpZGF0ZUJyZWFrcyh2YWxpZERvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgYnJlYWtzOiBTY2FsZUJyZWFrcyk6IFNjYWxlQnJlYWtzIHtcbiAgICAgICAgICAgIHZhbCB2YWxpZEluZGljZXMgPSBBcnJheUxpc3Q8SW50PigpXG4gICAgICAgICAgICB2YXIgaSA9IDBcbiAgICAgICAgICAgIGZvciAodiBpbiBicmVha3MuZG9tYWluVmFsdWVzKSB7XG4gICAgICAgICAgICAgICAgaWYgKHYgaXMgRG91YmxlICYmIHZhbGlkRG9tYWluLmNvbnRhaW5zKHYpKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbGlkSW5kaWNlcy5hZGQoaSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaSsrXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICh2YWxpZEluZGljZXMuc2l6ZSA9PSBicmVha3MuZG9tYWluVmFsdWVzLnNpemUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gYnJlYWtzXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbCB2YWxpZERvbWFpblZhbHVlcyA9IFNlcmllc1V0aWwucGlja0F0SW5kaWNlcyhicmVha3MuZG9tYWluVmFsdWVzLCB2YWxpZEluZGljZXMpXG4gICAgICAgICAgICB2YWwgdmFsaWRMYWJlbHMgPSBTZXJpZXNVdGlsLnBpY2tBdEluZGljZXMoYnJlYWtzLmxhYmVscywgdmFsaWRJbmRpY2VzKVxuICAgICAgICAgICAgdmFsIHZhbGlkVHJhbnNmb3JtZWRWYWx1ZXMgPSBTZXJpZXNVdGlsLnBpY2tBdEluZGljZXMoYnJlYWtzLnRyYW5zZm9ybWVkVmFsdWVzLCB2YWxpZEluZGljZXMpXG4gICAgICAgICAgICByZXR1cm4gU2NhbGVCcmVha3MoXG4gICAgICAgICAgICAgICAgdmFsaWREb21haW5WYWx1ZXMsXG4gICAgICAgICAgICAgICAgdmFsaWRUcmFuc2Zvcm1lZFZhbHVlcyxcbiAgICAgICAgICAgICAgICB2YWxpZExhYmVsc1xuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gdHdpc3RTY2FsZU1hcHBlcihcbiAgICAgICAgICAgIHByb2plY3Rpb246IFByb2plY3Rpb24sIHByb2plY3Rpb25JbnZlcnNlOiAoRG91YmxlKSAtPiBEb3VibGUsXG4gICAgICAgICAgICBzY2FsZU1hcHBlcjogKERvdWJsZT8pIC0+IERvdWJsZT9cbiAgICAgICAgKTogKERvdWJsZT8pIC0+IERvdWJsZT8ge1xuICAgICAgICAgICAgcmV0dXJuIHsgdiAtPlxuICAgICAgICAgICAgICAgIHY/LnJ1biB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCBwcm9qZWN0ZWQgPSBwcm9qZWN0aW9uLmFwcGx5KHYpXG4gICAgICAgICAgICAgICAgICAgIHZhbCB1blByb2plY3RlZCA9IHByb2plY3Rpb25JbnZlcnNlKHByb2plY3RlZClcbiAgICAgICAgICAgICAgICAgICAgc2NhbGVNYXBwZXIodW5Qcm9qZWN0ZWQpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuI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WJsZS5pc09yaWdpbikge1xuICAgICAgICAgICAgICAgIGNoZWNrKGRhdGEuaGFzKHZhcmlhYmxlKSkgeyBcIlVuZGVmaW5lZCB2YXJpYWJsZSAkdmFyaWFibGVcIiB9XG4gICAgICAgICAgICAgICAgZGF0YSA9IERhdGFGcmFtZVV0aWwuYXBwbHlUcmFuc2Zvcm0oXG4gICAgICAgICAgICAgICAgICAgIGRhdGEsXG4gICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlLFxuICAgICAgICAgICAgICAgICAgICBiaW5kaW5nLmFlcyxcbiAgICAgICAgICAgICAgICAgICAgc2NhbGVNYXBbYmluZGluZy5hZXNdXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGRhdGFcbiAgICB9XG5cbiAgICBmdW4gYnVpbGRTdGF0RGF0YShcbiAgICAgICAgZGF0YTogRGF0YUZyYW1lLFxuICAgICAgICBzdGF0OiBTdGF0LFxuICAgICAgICBiaW5kaW5nczogTGlzdDxWYXJCaW5kaW5nPixcbiAgICAgICAgc2NhbGVNYXA6IFR5cGVkU2NhbGVNYXAsXG4gICAgICAgIGdyb3VwaW5nQ29udGV4dDogR3JvdXBpbmdDb250ZXh0LFxuICAgICAgICBmYWNldHM6IFBsb3RGYWNldHMsXG4gICAgICAgIHN0YXRDdHg6IFN0YXRDb250ZXh0LFxuICAgICAgICB2YXJzV2l0aG91dEJpbmRpbmc6IExpc3Q8U3RyaW5nPixcbiAgICAgICAgb3JkZXJPcHRpb25zOiBMaXN0PE9yZGVyT3B0aW9uVXRpbC5PcmRlck9wdGlvbj4sXG4gICAgICAgIGFnZ3JlZ2F0ZU9wZXJhdGlvbjogKChMaXN0PERvdWJsZT8+KSAtPiBEb3VibGU/KT8sXG4gICAgICAgIG1lc3NhZ2VDb25zdW1lcjogQ29uc3VtZXI8U3RyaW5nPlxuICAgICk6IERhdGFBbmRHcm91cGluZ0NvbnRleHQge1xuICAg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HtcbiAgICAgICAgICAgICAgICB2YXIgc2QgPSBhcHBseVN0YXQoZCwgc3RhdCwgYmluZGluZ3MsIHNjYWxlTWFwLCBmYWNldHMsIHN0YXRDdHgsIHZhcnNXaXRob3V0QmluZGluZywgbWVzc2FnZUNvbnN1bWVyKVxuICAgICAgICAgICAgICAgIGlmIChzZC5pc0VtcHR5KSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGdyb3VwTWVyZ2VyLmluaXRPcmRlclNwZWNzKG9yZGVyT3B0aW9ucywgc2QudmFyaWFibGVzKCksIGJpbmRpbmdzLCBhZ2dyZWdhdGVPcGVyYXRpb24pXG5cbiAgICAgICAgICAgICAgICB2YWwgY3VyR3JvdXBTaXplQWZ0ZXJTdGF0ID0gc2Qucm93Q291bnQoKVxuXG4gICAgICAgICAgICAgICAgLy8gdXBkYXRlICdzdGF0IGdyb3VwJyB0byBhdm9pZCBjb2xsaXNpb25zIGFzIHN0YXQgaXMgYXBwbGllZCBpbmRlcGVuZGVudGx5IHRvIGVhY2ggb3JpZ2luYWwgZGF0YSBncm91cFxuICAgICAgICAgICAgICAgIGlmIChzZC5oYXMoU3RhdHMuR1JPVVApKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbCByYW5nZSA9IHNkLnJhbmdlKFN0YXRzLkdST1VQKVxuICAgICAgICAgICAgICAgICAgICBpZiAocmFuZ2UgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHN0YXJ0ID0gbGFzdFN0YXRHcm91cEVuZCArIDFcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBvZmZzZXQgPSBzdGFydCAtIHJhbmdlLmxvd2VyRW5kLnRvSW50KClcbiAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RTdGF0R3JvdXBFbmQgPSByYW5nZS51cHBlckVuZC50b0ludCgpICsgb2Zmc2V0XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAob2Zmc2V0ICE9IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWwgbmV3RyA9IEFycmF5TGlzdDxEb3VibGU+KClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGcgaW4gc2QuZ2V0TnVtZXJpYyhTdGF0cy5HUk9VUCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3Ry5hZGQoZyEhICsgb2Zmc2V0KVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZCA9IHNkLmJ1aWxkZXIoKS5wdXROdW1lcmljKFN0YXRzLkdST1VQLCBuZXdHKS5idWlsZCgpXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2UgeyAvLyBpZiBzdGF0IGhhcyAuLmdyb3VwLi4gdGhlbiBncm91cGluZ1ZhciB3b24ndCBiZSBjaGVja2VkLCBzbyBubyBuZWVkIHRvIHVwZGF0ZVxuICAgICAgICAgICAgICAgICAgICB2YWwgZ3JvdXBpbmdWYXIgPSBncm91cGluZ0NvbnRleHQub3B0aW9uYWxHcm91cGluZ1ZhclxuICAgICAgICAgICAgICAgICAgICBpZiAoZ3JvdXBpbmdWYXIgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHNpemUgPSBzZFtzZC52YXJpYWJsZXMoKS5maXJzdCgpXS5zaXplXG4gICAgICAgICAgICAgICAgICAgICAgICB2YWwgdiA9IGRbZ3JvdXBpbmdWYXJdWzBdXG4gICAgICAgICAgICAgICAgICAgICAgICBzZCA9IHNkLmJ1aWxkZXIoKS5wdXQoZ3JvdXBpbmdWYXIsIExpc3Qoc2l6ZSkgeyB2IH0pLmJ1aWxkKClcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIEFkZCBncm91cCdzIGRhdGFcbiAgICAgICAgICAgICAgICBncm91cE1lcmdlci5hZGRHcm91cChzZCwgY3VyR3JvdXBTaXplQWZ0ZXJTdGF0KVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gR2V0IG1lcmdlZCBzZXJpZXNcbiAgICAgICAgICAgIHJlc3VsdFNlcmllcyA9IGdyb3VwTWVyZ2VyLmdldFJlc3VsdFNlcmllcygpXG4gICAgICAgICAgICBncm91cFNpemVMaXN0QWZ0ZXJTdGF0ID0gZ3JvdXBNZXJnZXIuZ2V0R3JvdXBTaXplcygpXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgZGF0YUFmdGVyU3RhdCA9IEJ1aWxkZXIoKS5ydW4ge1xuICAgICAgICAgICAgLy8gcHV0IHJlc3VsdHNcbiAgICAgICAgICAgIGZvciAodmFyaWFibGUgaW4gcmVzdWx0U2VyaWVzLmtleXMpIHtcbiAgICAgICAgICAgICAgICBwdXQodmFyaWFibGUsIHJlc3VsdFNlcmllc1t2YXJpYWJsZV0hISlcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gc2V0IG9yZGVyaW5nIHNwZWNpZmljYXRpb25zXG4gICAgICAgICAgICB2YWwgb3JkZXJTcGVjcyA9IG9yZGVyT3B0aW9ucy5tYXAgeyBvcmRlck9wdGlvbiAtPlxuICAgICAgICAgICAgICAgIE9yZGVyT3B0aW9uVXRpbC5jcmVhdGVPcmRlclNwZWMocmVzdWx0U2VyaWVzLmtleXMsIGJpbmRpbmdzLCBvcmRlck9wdGlvbiwgYWdncmVnYXRlT3BlcmF0aW9uKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYWRkT3JkZXJTcGVjcyhvcmRlclNwZWNzKVxuXG4gICAgICAgICAgICAvLyBidWlsZCBEYXRhRnJhbWVcbiAgICAgICAgICAgIGJ1aWxkKClcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBncm91cGluZ0NvbnRleHRBZnRlcl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lVHJhbnNmb3JtZWRTdGF0U2VyaWVzID1cbiAgICAgICAgICAgIGludmVyc2VUcmFuc2Zvcm1Db250aW51b3VzU3RhdERhdGEoXG4gICAgICAgICAgICAgICAgc3RhdERhdGEsXG4gICAgICAgICAgICAgICAgc3RhdCxcbiAgICAgICAgICAgICAgICBiaW5kaW5ncyxcbiAgICAgICAgICAgICAgICBzY2FsZU1hcFxuICAgICAgICAgICAgKVxuXG4gICAgICAgIC8vIGdlbmVyYXRlIG5ldyBzZXJpZXMgZm9yIGZhY2V0IHZhcmlhYmxlc1xuXG4gICAgICAgIHZhbCBzdGF0RGF0YVNpemUgPSBzdGF0RGF0YVtzdGF0VmFyaWFibGVzLml0ZXJhdG9yKCkubmV4dCgpXS5zaXplXG4gICAgICAgIHZhbCBmYWNldFZhcnMgPSBIYXNoU2V0PFZhcmlhYmxlPigpXG4gICAgICAgIGZvciAoZmFjZXRWYXJOYW1lIGluIGZhY2V0cy52YXJpYWJsZXMpIHtcbiAgICAgICAgICAgIHZhbCBmYWNldFZhciA9IERhdGFGcmFtZVV0aWwuZmluZFZhcmlhYmxlT3JGYWlsKGRhdGEsIGZhY2V0VmFyTmFtZSlcbiAgICAgICAgICAgIGZhY2V0VmFycy5hZGQoZmFjZXRWYXIpXG4gICAgICAgICAgICBpZiAoZGF0YVtmYWNldFZhcl0uaXNOb3RFbXB0eSgpKSB7XG4gICAgICAgICAgICAgICAgdmFsIGZhY2V0TGV2ZWwgPSBkYXRhW2ZhY2V0VmFyXVswXVxuICAgICAgICAgICAgICAgIC8vIGdlbmVyYXRlIHNlcmllcyBmb3IgJ2ZhY2V0JyB2YXJpYWJsZVxuICAgICAgICAgICAgICAgIHN0YXREYXRhID0gc3RhdERhdGFcbiAgICAgICAgICAgICAgICAgICAgLmJ1aWxkZXIoKVxuICAgICAgICAgICAgICAgICAgICAucHV0KGZhY2V0VmFyLCBMaXN0KHN0YXREYXRhU2l6ZSkgeyBmYWNldExldmVsIH0pXG4gICAgICAgICAgIC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RpbnVlXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhbCBhZXMgPSBiaW5kaW5nLmFlc1xuICAgICAgICAgICAgaWYgKHN0YXQuaGFzRGVmYXVsdE1hcHBpbmcoYWVzKSkge1xuICAgICAgICAgICAgICAgIHZhbCBkZWZhdWx0U3RhdFZhciA9IHN0YXQuZ2V0RGVmYXVsdE1hcHBpbmcoYWVzKVxuICAgICAgICAgICAgICAgIHZhbCBuZXdJbnB1dFNlcmllOiBMaXN0PCo+ID1cbiAgICAgICAgICAgICAgICAgICAgaWYgKGludmVyc2VUcmFuc2Zvcm1lZFN0YXRTZXJpZXMuY29udGFpbnNLZXkoZGVmYXVsdFN0YXRWYXIpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbnZlcnNlVHJhbnNmb3JtZWRTdGF0U2VyaWVzLmdldFZhbHVlKGRlZmF1bHRTdGF0VmFyKVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHN0YXRTZXJpZSA9IHN0YXREYXRhLmdldE51bWVyaWMoZGVmYXVsdFN0YXRWYXIpXG4gICAgICAgICAgICAgICAgICAgICAgICBTY2FsZVV0aWwuaW52ZXJzZVRyYW5zZm9ybShzdGF0U2VyaWUsIHNjYWxlTWFwW2Flc10pXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBuZXdJbnB1dFNlcmllc1t2YXJpYWJsZV0gPSBuZXdJbnB1dFNlcmllXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIERvIG5vdCBvdmVycmlkZSBzZXJpZXMgb2J0YWluZWQgdmlhICdkZWZhdWx0IHN0YXQgdmFyJ1xuICAgICAgICAgICAgICAgIGlmICghbmV3SW5wdXRTZXJpZXMuY29udGFpbnNLZXkodmFyaWFibGUpKSB7XG4gICAgICAgICAgICAgICAgICAgIGFkZFNlcmllc0ZvclZhcmlhYmxlKHZhcmlhYmxlKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvLyBzZXJpZXMgZm9yIHZhcmlhYmxlcyB3aXRob3V0IGJpbmRpbmdzXG4gICAgICAgIGZvciAodmFyTmFtZSBpbiB2YXJzV2l0aG91dEJpbmRpbmcuZmlsdGVyTm90KFN0YXRzOjppc1N0YXRWYXIpKSB7XG4gICAgICAgICAgICB2YWwgdmFyaWFibGUgPSBEYXRhRnJhbWVVdGlsLmZpbmRWYXJpYWJsZU9yRmFpbChkYXRhLCB2YXJOYW1lKVxuICAgICAgICAgICAgaWYgKCFuZXdJbnB1dFNlcmllcy5jb250YWluc0tleSh2YXJpYWJsZSkpIHtcbiAgICAgICAgICAgICAgICBhZGRTZXJpZXNGb3JWYXJpYWJsZSh2YXJpYWJsZSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBiID0gc3RhdERhdGEuYnVpbGRlcigpXG4gICAgICAgIGZvciAodmFyaWFibGUgaW4gbmV3SW5wdXRTZXJpZXMua2V5cykge1xuICAgICAgICAgICAgYi5wdXQodmFyaWFibGUsIG5ld0lucHV0U2VyaWVzLmdldFZhbHVlKHZhcmlhYmxlKSlcbiAgICAgICAgfVxuICAgICAgICAvLyBhbHNvIHVwZGF0ZSBzdGF0IHNlcmllc1xuICAgICAgICBmb3IgKHZhcmlhYmxlIGluIGludmVyc2VUcmFuc2Zvcm1lZFN0YXRTZXJpZXMua2V5cykge1xuICAgICAgICAgICAgYi5wdXROdW1lcmljKHZhcmlhYmxlLCBpbnZlcnNlVHJhbnNmb3JtZWRTdGF0U2VyaWVzLmdldFZhbHVlKHZhcmlhYmxlKSlcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBiLmJ1aWxkKClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBpbnZlcnNlVHJhbnNmb3JtQ29udGludW91c1N0YXREYXRhKFxuICAgICAgICBzdGF0RG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ICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YWwgc2NhbGUgPSBzY2FsZU1hcFthZXNdXG4gICAgICAgICAgICBpZiAoc2NhbGUuaXNDb250aW51b3VzRG9tYWluKSB7XG4gICAgICAgICAgICAgICAgY29udGludW91c1NjYWxlQnlBZXNbYWVzXSA9IHNjYWxlXG4gICAgICAgICAgICAgICAgaWYgKEFlcy5pc1Bvc2l0aW9uYWxYKGFlcykgJiYgIWNvbnRpbnVvdXNTY2FsZUJ5QWVzLmNvbnRhaW5zS2V5KEFlcy5YKSkge1xuICAgICAgICAgICAgICAgICAgICBjb250aW51b3VzU2NhbGVCeUFlc1tBZXMuWF0gPSBzY2FsZVxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoQWVzLmlzUG9zaXRpb25hbFkoYWVzKSAmJiAhY29udGludW91c1NjYWxlQnlBZXMuY29udGFpbnNLZXkoQWVzLlkpKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVvdXNTY2FsZUJ5QWVzW0Flcy5ZXSA9IHNjYWxlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGludmVyc2VUcmFuc2Zvcm1lZFN0YXRTZXJpZXMgPSBIYXNoTWFwPFZhcmlhYmxlLCBMaXN0PERvdWJsZT8+PigpXG4gICAgICAgIGZvciAoc3RhdFZhciBpbiBzdGF0RGF0YS52YXJpYWJsZXMoKSkge1xuICAgICAgICAgICAgaWYgKGFlc0J5TWFwcGVkU3RhdFZhci5jb250YWluc0tleShzdGF0VmFyKSkge1xuICAgICAgICAgICAgICAgIHZhbCBhZXMgPSBhZXNCeU1hcHBlZFN0YXRWYXIuZ2V0VmFsdWUoc3RhdFZhcilcbiAgICAgICAgICAgICAgICB2YXIgc2NhbGU6IFNjYWxlPCo+PyA9IGNvbnRpbnVvdXNTY2FsZUJ5QWVzW2Flc11cbiAgICAgICAgICAgICAgICBpZiAoc2NhbGUgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoQWVzLmlzUG9zaXRpb25hbFgoYWVzKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2NhbGUgPSBjb250aW51b3VzU2NhbGVCeUFlc1tBZXMuWF1cbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChBZXMuaXNQb3NpdGlvbmFsWShhZXMpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzY2FsZSA9IGNvbnRpbnVvdXNTY2FsZUJ5QWVzW0Flcy5ZXVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKHNjYWxlICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIHN0YXRTZXJpZSA9IHN0YXREYXRhLmdldE51bWVyaWMoc3RhdFZhcilcbiAgICAgICAgICAgICAgICAgICAgdmFsIGludmVyc2VUcmFuc2Zvcm1lZFN0YXRTZXJpZSA9IFNjYWxlVXRpbC5pbnZlcnNlVHJhbnNmb3JtVG9Db250aW51b3VzRG9tYWluKHN0YXRTZXJpZSwgc2NhbGUpXG4gICAgICAgICAgICAgICAgICAgIGludmVyc2VUcmFuc2Zvcm1lZFN0YXRTZXJpZXNbc3RhdFZhcl0gPSBpbnZlcnNlVHJhbnNmb3JtZWRTdGF0U2VyaWVcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGludmVyc2VUcmFuc2Zvcm1lZFN0YXRTZXJpZXNcbiAgICB9XG5cbiAgICBpbnRlcm5hbCBmdW4gY29tcHV0ZUdyb3VwcyhcbiAgICAgICAgZGF0YTogRGF0YUZyYW1lLFxuICAgICAgICBiaW5kaW5nczogTGlzdDxWYXJCaW5kaW5nPixcbiAgICAgICAgZ3JvdXBpbmdWYXI6IFZhcmlhYmxlPyxcbiAgICAgICAgcGF0aElkVmF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WllcyA9IGNvbXB1dGVEdW1teVZhbHVlcyhjdXJyZW50R3JvdXBzLCBncm91cHMpXG4gICAgICAgICAgICBjdXJyZW50R3JvdXBzID0gY29tcHV0ZUdyb3VwcyhkdW1taWVzKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGlmIChjdXJyZW50R3JvdXBzICE9IG51bGwpIHtcbiAgICAgICAgICAgIEdyb3VwVXRpbC53cmFwKGN1cnJlbnRHcm91cHMpXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBHcm91cFV0aWwuU0lOR0xFX0dST1VQXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjb21wdXRlR3JvdXBzKHZhbHVlczogTGlzdDwqPik6IExpc3Q8SW50PiB7XG4gICAgICAgIHZhbCBncm91cHMgPSBBcnJheUxpc3Q8SW50PigpXG4gICAgICAgIHZhbCBncm91cEJ5VmFsID0gSGFzaE1hcDxBbnk/LCBJbnQ+KClcbiAgICAgICAgdmFyIGNvdW50ID0gMFxuICAgICAgICBmb3IgKHYgaW4gdmFsdWVzKSB7XG4gICAgICAgICAgICBpZiAoIWdyb3VwQnlWYWwuY29udGFpbnNLZXkodikpIHtcbiAgICAgICAgICAgICAgICBncm91cEJ5VmFsW3ZdID0gY291bnQrK1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZ3JvdXBzLmFkZChncm91cEJ5VmFsLmdldCh2KSEhKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBncm91cHNcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjb21wdXRlRHVtbXlWYWx1ZXMobGlzdDE6IExpc3Q8SW50PiwgbGlzdDI6IExpc3Q8SW50Pik6IExpc3Q8SW50PiB7XG4gICAgICAgIGlmIChsaXN0MS5pc0VtcHR5KCkpIHJldHVybiBlbXB0eUxpc3QoKVxuXG4gICAgICAgIHZhbCBsaW1pdCA9IDEwMDBcblxuICAgICAgICB2YWwgbWF4ID0gbmF0dXJhbDxJbnQ+KCkubWF4KEl0ZXJhYmxlcy5jb25jYXQobGlzdDEsIGxpc3QyKSlcbiAgICAgICAgY2hlY2sobWF4IDwgbGltaXQpIHsgXCJUb28gbWFueSBncm91cHM6ICRtYXhcIiB9XG4gICAgICAgIHZhbCBkdW1taWVzID0gQXJyYXlMaXN0PEludD4oKVxuICAgICAgICB2YWwgaXQxID0gbGlzdDEuaXRlcmF0b3IoKVxuICAgICAgICB2YWwgaXQyID0gbGlzdDIuaXRlcmF0b3IoKVxuICAgICAgICB3aGlsZSAoaXQxLmhhc05leHQoKSkge1xuICAgICAgICAgICAgdmFsIHYxID0gaXQxLm5leHQoKVxuICAgICAgICAgICAgdmFsIHYyID0gaXQyLm5leHQoKVxuICAgICAgICAgICAgdmFsIGR1bW15ID0gdjEgKiBsaW1pdCArIHYyXG4gICAgICAgICAgICBkdW1taWVzLmFkZChkdW1teSlcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gZHVtbWllc1xuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGdldEdyb3VwaW5nVmFyaWFibGVzKFxuICAgICAgICBkYXRhOiBEYXRhRnJhbWUsXG4gICAgICAgIGJpbmRpbmdzOiBMaXN0PFZhckJpbmRpbmc+LFxuICAgICAgICBleHBsaWNpdEdyb3VwaW5nVmFyOiBWYXJpYWJsZT9cbiAgICApOiBJdGVyYWJsZTxWYXJpYWJsZT4ge1xuXG4gICAgICAgIC8vIGFsbCAnb3JpZ2luJyBkaXNjcmV0ZSB2YXJzIChidXQgbm90IHBvc2l0aW9uYWwpICsgZXhwbGljaXRHcm91cGluZ1ZhclxuICAgICAgICB2YWwgcmVzdWx0ID0gTGlua2VkSGFzaFNldDxWYXJpYWJsZT4oKVxuICAgICAgICBmb3IgKGJpbmRpbmcgaW4gYmluZGluZ3MpIHtcbiAgICAgICAgICAgIHZhbCB2YXJpYWJsZSA9IGJpbmRpbmcudmFyaWFibGVcbiAgICAgICAgICAgIGlmICghcmVzdWx0LmNvbnR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gICAgICAgICAgIC8vIG51bGwgdmFsdWUgaXMgYWx3YXlzIGdyZWF0ZXIgLSB3aWxsIGJlIGF0IHRoZSBlbmQgb2YgdGhlIHJlc3VsdFxuICAgICAgICAgICAgICAgIGlmICh2MSA9PSBudWxsICYmIHYyID09IG51bGwgKSByZXR1cm4gMFxuICAgICAgICAgICAgICAgIGlmICh2MSA9PSBudWxsKSByZXR1cm4gMVxuICAgICAgICAgICAgICAgIGlmICh2MiA9PSBudWxsKSByZXR1cm4gLTFcbiAgICAgICAgICAgICAgICByZXR1cm4gY29tcGFyZVZhbHVlcyh2MSBhcyBDb21wYXJhYmxlPCo+LCB2MiBhcyBDb21wYXJhYmxlPCo+KSAqIGRpclxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZnVuIGdldFZhbHVlKFxuICAgICAgICAgICAgICAgIGRmOiBEYXRhRnJhbWUsXG4gICAgICAgICAgICAgICAgdmFyaWFibGU6IERhdGFGcmFtZS5WYXJpYWJsZSxcbiAgICAgICAgICAgICAgICBhZ2dyZWdhdGVPcGVyYXRpb246ICgoTGlzdDxEb3VibGU/PikgLT4gRG91YmxlPyk/ID0gbnVsbFxuICAgICAgICAgICAgKTogQW55PyB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGlmIChhZ2dyZWdhdGVPcGVyYXRpb24gIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICByZXF1aXJlKGRmLmlzTnVtZXJpYyh2YXJpYWJsZSkpIHsgXCJDYW4ndCBhcHBseSBhZ2dyZWdhdGUgb3BlcmF0aW9uIHRvIG5vbi1udW1lcmljIHZhbHVlc1wiIH1cbiAgICAgICAgICAgICAgICAgICAgYWdncmVnYXRlT3BlcmF0aW9uLmludm9rZShkZi5nZXROdW1lcmljKHZhcmlhYmxlKS5yZXF1aXJlTm9OdWxscygpKVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGdyb3VwIGhhcyBubyBtb3JlIHRoYW4gb25lIHVuaXF1ZSBlbGVtZW50XG4gICAgICAgICAgICAgICAgICAgIGRmW3ZhcmlhYmxlXS5maXJzdE9yTnVsbCgpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBteU9yZGVyU3BlY3M/LmZvckVhY2ggeyBzcGVjIC0+XG4gICAgICAgICAgICAgICAgdmFyIGNtcCA9IGNvbXBhcmVHcm91cFZhbHVlKFxuICAgICAgICAgICAgICAgICAgICBnZXRWYWx1ZShkZiwgc3BlYy5vcmRlckJ5LCBzcGVjLmFnZ3JlZ2F0ZU9wZXJhdGlvbiksXG4gICAgICAgICAgICAgICAgICAgIGdldFZhbHVlKG90aGVyLmRmLCBzcGVjLm9yZGVyQnksIHNwZWMuYWdncmVnYXRlT3BlcmF0aW9uKSxcbiAgICAgICAgICAgICAgICAgICAgc3BlYy5kaXJlY3Rpb25cbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgaWYgKGNtcCA9PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGVuc3VyZSB0aGUgb3JkZXIgYXMgaW4gdGhlIGxlZ2VuZFxuICAgICAgICAgICAgICAgICAgICBjbXAgPSBjb21wYXJlR3JvdXBWYWx1ZShcbiAgICAgICAgICAgICAgICAgICAgICAgIGdldFZhbHVlKGRmLCBzcGVjLnZhcmlhYmxlKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGdldFZhbHVlKG90aGVyLmRmLCBzcGVjLnZhcmlhYmxlKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNwZWMuZGlyZWN0aW9uXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGNtcCAhPSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBjbXBcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gMFxuICAgICAgICB9XG4gICA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mV0dXJuIHsgaW5kZXggLT5cbiAgICAgICAgICAgIGlmIChpbmRleCA+IDAgJiYgaW5kZXggPCBsLnNpemUpXG4gICAgICAgICAgICAgICAgbFtpbmRleF0hIS50b0ludCgpXG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgMFxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuIHdyYXAoZ3JvdXBCeVBvaW50SW5kZXg6IE1hcDxJbnQsIEludD4pOiAoSW50KSAtPiBJbnQge1xuICAgICAgICByZXR1cm4geyBncm91cEJ5UG9pbnRJbmRleFtpdF0hISB9XG4gICAgfVxuXG4gICAgZnVuIGluZGljZXNCeUdyb3VwKGRhdGFMZW5ndGg6IEludCwgZ3JvdXBzOiAoSW50KSAtPiBJbnQpOiBNYXA8SW50LCBMaXN0PEludD4+IHtcbiAgICAgICAgdmFsIGluZGljZXNCeUdyb3VwID0gTGlua2VkSGFzaE1hcDxJbnQsIE11dGFibGVMaXN0PEludD4+KClcbiAgICAgICAgZm9yIChpIGluIDAgdW50aWwgZGF0YUxlbmd0aCkge1xuICAgICAgICAgICAgdmFsIGdyb3VwID0gZ3JvdXBzKGkpXG4gICAgICAgICAgICBpZiAoIWluZGljZXNCeUdyb3VwLmNvbnRhaW5zS2V5KGdyb3VwKSkge1xuICAgICAgICAgICAgICAgIGluZGljZXNCeUdyb3VwW2dyb3VwXSA9IEFycmF5TGlzdCgpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpbmRpY2VzQnlHcm91cFtncm91cF0hIS5hZGQoaSlcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBpbmRpY2VzQnlHcm91cFxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGNhbiBiZSBmb3VuZCB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VxuXG4gICAgcHJpdmF0ZSB2YXIgbXlHcm91cFNpemVMaXN0OiBMaXN0PEludD4/ID0gbnVsbFxuICAgIHByaXZhdGUgdmFyIG15R3JvdXBNYXBwZXI6ICgoSW50KSAtPiBJbnQpPyA9IG51bGxcblxuICAgIC8vbXlHcm91cE1hcHBlciA9IERhdGFQcm9jZXNzaW5nLmNvbXB1dGVHcm91cHMobXlEYXRhLCBteUJpbmRpbmdzLCBteU9wdGlvbmFsR3JvdXBpbmdWYXIsIG15RXhwZWN0TXVsdGlwbGUpO1xuICAgIHZhbCBncm91cE1hcHBlcjogKEludCkgLT4gSW50XG4gICAgICAgIGdldCgpID0geyBpbmRleCAtPlxuICAgICAgICAgICAgaWYgKG15R3JvdXBNYXBwZXIgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIG15R3JvdXBNYXBwZXIgPSBjb21wdXRlR3JvdXBzKClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG15R3JvdXBNYXBwZXIhIShpbmRleClcbiAgICAgICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gY29tcHV0ZUdyb3VwcygpOiAoSW50KSAtPiBJbnQge1xuICAgICAgICBpZiAobXlEYXRhLmhhcyhTdGF0cy5HUk9VUCkpIHtcbiAgICAgICAgICAgIHZhbCBsaXN0ID0gbXlEYXRhLmdldE51bWVyaWMoU3RhdHMuR1JPVVApXG4gICAgICAgICAgICByZXR1cm4gR3JvdXBVdGlsLndyYXAobGlzdClcbiAgICAgICAgfSBlbHNlIGlmIChteUdyb3VwU2l6ZUxpc3QgIT0gbnVsbCkge1xuICAgICAgICAgICAgaWYgKG15R3JvdXBTaXplTGlzdCEhLnNpemUgPT0gbXlEYXRhLnJvd0NvdW50KCkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gR3JvdXBVdGlsLlNJTkdMRV9HUk9VUFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB2YWwgZ3JvdXBCeVBvaW50SW5kZXggPVxuICAgICAgICAgICAgICAgICAgICB0b0luZGV4TWFwKG15R3JvdXBTaXplTGlzdCEhKVxuICAgICAgICAgICAgICAgIHJldHVybiBHcm91cFV0aWwud3JhcChncm91cEJ5UG9pbnRJbmRleClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmIChteUV4cGVjdE11bHRpcGxlKSB7XG4gICAgICAgICAgICByZXR1cm4gRGF0YVByb2Nlc3NpbmcuY29tcHV0ZUdyb3VwcyhcbiAgICAgICAgICAgICAgICBteURhdGEsXG4gICAgICAgICAgICAgICAgbXlCaW5kaW5ncyxcbiAgICAgICAgICAgICAgICBvcHRpb25hbEdyb3VwaW5nVmFyLFxuICAgICAgICAgICAgICAgIHBhdGhJZFZhclxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBHcm91cFV0aWwuU0lOR0xFX0dST1VQXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGludGVybmFsIGZ1biB3aXRoT3JkZXJlZEdyb3VwcyhkYXRhOiBEYXRhRnJhbWUsIGdyb3VwU2l6ZUxpc3Q6IExpc3Q8SW50Pik6IEdyb3VwaW5nQ29udGV4dCB7XG4gICAgICAgICAgICB2YWwgZ3JvdXBpbmdDb250ZXh0ID0gR3JvdXBpbmdDb250ZXh0KGRhdGEsIGVtcHR5TGlzdCgpLCBudWxsLCBudWxsLCBmYWxzZSlcbiAgICAgICAgICAgIGdyb3VwaW5nQ29udGV4dC5teUdyb3VwU2l6ZUxpc3QgPSBBcnJheUxpc3QoZ3JvdXBTaXplTGlzdClcbiAgICAgICAgICAgIHJldHVybiBncm91cGluZ0NvbnRleHRcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHRvSW5kZXhNYXAoZ3JvdXBTaXplTGlzdDogTGlzdDxJbnQ+KTogTWFwPEludCwgSW50PiB7XG4gICAgICAgICAgICB2YWwgcmVzdWx0ID0gSGFzaE1hcDxJ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5vYmplY3QgT3JkZXJPcHRpb25VdGlsIHtcbiAgICBjbGFzcyBPcmRlck9wdGlvbiBpbnRlcm5hbCBjb25zdHJ1Y3RvcihcbiAgICAgICAgdmFsIHZhcmlhYmxlTmFtZTogU3RyaW5nLFxuICAgICAgICB2YWwgYnlWYXJpYWJsZTogU3RyaW5nPyxcbiAgICAgICAgcHJpdmF0ZSB2YWwgb3JkZXJEaXI6IEludD9cbiAgICApIHtcbiAgICAgICAgZnVuIGdldE9yZGVyRGlyKCk6IEludCA9IG9yZGVyRGlyID86IC0xIC8vIGRlc2NlbmRpbmcgYnkgZGVmYXVsdFxuXG4gICAgICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICAgICAgZnVuIGNyZWF0ZShcbiAgICAgICAgICAgICAgICB2YXJpYWJsZU5hbWU6IFN0cmluZyxcbiAgICAgICAgICAgICAgICBvcmRlckJ5OiBTdHJpbmc/LFxuICAgICAgICAgICAgICAgIG9yZGVyOiBBbnk/XG4gICAgICAgICAgICApOiBPcmRlck9wdGlvbj8ge1xuICAgICAgICAgICAgICAgIGlmIChvcmRlckJ5ID09IG51bGwgJiYgb3JkZXIgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXF1aXJlKG9yZGVyID09IG51bGwgfHwgKG9yZGVyIGlzIE51bWJlciAmJiBvcmRlci50b0ludCgpIGluIGxpc3RPZigtMSwgMSkpKSB7XG4gICAgICAgICAgICAgICAgICAgIFwiVW5zdXBwb3J0ZWQgYG9yZGVyYCB2YWx1ZTogJG9yZGVyLiBVc2UgMSAoYXNjZW5kaW5nKSBvciAtMSAoZGVzY2VuZGluZykuXCJcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gT3JkZXJPcHRpb24odmFyaWFibGVOYW1lLCBvcmRlckJ5LCAob3JkZXIgYXM/IE51bWJlcik/LnRvSW50KCkpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZ1biBPcmRlck9wdGlvbi5tZXJnZVdpdGgob3RoZXI6IE9yZGVyT3B0aW9uKTogT3JkZXJPcHRpb24ge1xuICAgICAgICAgICAgICAgIHJlcXVpcmUodmFyaWFibGVOYW1lID09IG90aGVyLnZhcmlhYmxlTmFtZSkge1xuICAgICAgICAgICAgICAgICAgICBcIkNhbid0IG1lcmdlIG9yZGVyIG9wdGlvbnMgZm9yIGRpZmZlcmVudCB2YXJpYWJsZXM6ICckdmFyaWFibGVOYW1lJyBhbmQgJyR7b3RoZXIudmFyaWFibGVOYW1lfSdcIlxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXF1aXJlKGJ5VmFyaWFibGUgPT0gbnVsbCB8fCBvdGhlci5ieVZhcmlhYmxlID09IG51bGwgfHwgb3RoZXIuYnlWYXJpYWJsZSA9PSBieVZhcmlhYmxlKSB7XG4gICAgICAgICAgICAgICAgICAgIFwiTXVsdGlwbGUgb3JkZXJpbmcgb3B0aW9ucyBmb3IgdGhlIHZhcmlhYmxlICckdmFyaWFibGVOYW1lJyB3aXRoIGRpZmZlcmVudCBub24tZW1wdHkgJ29yZGVyX2J5JyBmaWVsZHM6ICckYnlWYXJpYWJsZScgYW5kICcke290aGVyLmJ5VmFyaWFibGV9J1wiXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlcXVpcmUob3JkZXJEaXIgPT0gbnVsbCB8fCBvdGhlci5vcmRlckRpciA9PSBudWxsIHx8IG90aGVyLm9yZGVyRGlyID09IG9yZGVyRGlyKSB7XG4gICAgICAgICAgICAgICAgICAgIFwiTXVsdGlwbGUgb3JkZXJpbmcgb3B0aW9ucyBmb3IgdGhlIHZhcmlhYmxlICckdmFyaWFibGVOYW1lJyB3aXRoIGRpZmZlcmVudCBvcmRlciBkaXJlY3Rpb246ICckb3JkZXJEaXInIGFuZCAnJHtvdGhlci5vcmRlckRpcn0nXCJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIE9yZGVyT3B0aW9uKFxuICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZU5hbWUsXG4gICAgICAgICAgICAgICAgICAgIGJ5VmFyaWFibGUgPzogb3RoZXIuYnlWYXJpYWJsZSxcbiAgICAgICAgICAgICAgICAgICAgb3JkZXJEaXIgPzogb3RoZXIub3JkZXJEaXJcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW4gY3JlYXRlT3JkZXJTcGVjKFxuICAgICAgICB2YXJpYWJsZXM6IFNldDxEYXRhRnJhbWUuVmFyaWFibGU+LFxuICAgICAgICB2YXJCaW5kaW5nczogTGlzdDxWYXJCaW5kaW5nPixcbiAgICAgICAgb3JkZXJPcHRpb246IE9yZGVyT3B0aW9uLFxuICAgICAgICBhZ2dyZWdhdGVPcGVyYXRpb246ICgoTGlzdDxEb3VibGU/PikgLT4gRG91YmxlPyk/XG4gICAgKTogRGF0YUZyYW1lLk9yZGVyU3BlYyB7XG4gICAgICAgIGZ1biBnZXRWYXJpYWJsZUJ5TmFtZSh2YXJOYW1lOiBTdHJpbmcpOiBEYXRhRnJhbWUuVmFyaWFibGUge1xuICAgICAgICAgICAgcmV0dXJuIHZhcmlhYmxlcy5maW5kIHsgaXQubmFtZSA9PSB2YXJOYW1lIH1cbiAgICAgICAgICAgICAgICA/OiBlcnJvcihcIlVuZGVmaW5lZCB2YXJpYWJsZSAnJHZhck5hbWUnIGluIG9yZGVyIG9wdGlvbnMuIEZ1bGwgdmFyaWFibGUgbGlzdDogJHt2YXJpYWJsZXMubWFwIHsgXCInJHtpdC5uYW1lfSdcIiB9fVwiKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHZhcmlhYmxlID1cbiAgICAgICAgICAgIGlmICh2YXJCaW5kaW5ncy5maW5kIHsgaXQudmFyaWFibGUubmFtZSA9PSBvcmRlck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IE9yaWVudGF0aW9uLlJJR0hUIC0+IHtcbiAgICAgICAgICAgICAgICB4MiA9IDAuMFxuICAgICAgICAgICAgICAgIHgxID0geDJcbiAgICAgICAgICAgICAgICBzdGFydCA9IDAuMFxuICAgICAgICAgICAgICAgIHkxID0gc3RhcnRcbiAgICAgICAgICAgICAgICBlbmQgPSBsXG4gICAgICAgICAgICAgICAgeTIgPSBlbmRcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIE9yaWVudGF0aW9uLlRPUCwgT3JpZW50YXRpb24uQk9UVE9NIC0+IHtcbiAgICAgICAgICAgICAgICBzdGFydCA9IDAuMFxuICAgICAgICAgICAgICAgIHgxID0gc3RhcnRcbiAgICAgICAgICAgICAgICBlbmQgPSBsXG4gICAgICAgICAgICAgICAgeDIgPSBlbmRcbiAgICAgICAgICAgICAgICB5MiA9IDAuMFxuICAgICAgICAgICAgICAgIHkxID0geTJcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgUnVudGltZUV4Y2VwdGlvbihcIlVuZXhwZWN0ZWQgb3JpZW50YXRpb246XCIgKyBvcmllbnRhdGlvbi5nZXQoKSlcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBheGlzTGluZTogU3ZnTGluZUVsZW1lbnQ/ID0gbnVsbFxuICAgICAgICBpZiAoYXhpc0xpbmVFbmFibGVkKCkuZ2V0KCkpIHtcbiAgICAgICAgICAgIGF4aXNMaW5lID0gU3ZnTGluZUVsZW1lbnQoeDEsIHkxLCB4MiwgeTIpXG4gICAgICAgICAgICByZWcoYmluZE9uZVdheShsaW5lV2lkdGgsIGF4aXNMaW5lLnN0cm9rZVdpZHRoKCkpKVxuICAgICAgICAgICAgcmVnKGJpbmRPbmVXYXkobGluZUNvbG9yLCBheGlzTGluZS5zdHJva2VDb2xvcigpKSlcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIGRvIG5vdCBkcmF3IGdyaWQgbGluZXMgdGhlbiBpdCdzIHRvbyBjbG9zZSB0byBheGlzIGVuZHMuXG4gICAgICAgIHZhbCBncmlkTGluZU1pblBvcyA9IHN0YXJ0ICsgM1xuICAgICAgICB2YWwgZ3JpZExpbmVNYXhQb3MgPSBlbmQgLSAzXG5cbiAgICAgICAgaWYgKGJyZWFrc0VuYWJsZWQoKSkge1xuICAgICAgICAgICAgLy8gYWRkIHRpY2tzIGJlZm9yZSBheGlzIGxpbmVcbiAgICAgICAgICAgIHZhbCBicmVha3MgPSB0aGlzLmJyZWFrcy5nZXQoKVxuICAgICAgICAgICAgaWYgKCEoYnJlYWtzID09IG51bGwgfHwgYnJlYWtzLmlzRW1wdHkoKSkpIHtcblxuICAgICAgICAgICAgICAgIHZhciBsYWJlbHM6IExpc3Q8U3RyaW5nPj8gPSB0aGlzLmxhYmVscy5nZXQoKVxuICAgICAgICAgICAgICAgIGlmIChsYWJlbHMgPT0gbnVsbCB8fCBsYWJlbHMuaXNFbXB0eSgpKSB7XG4gICAgICAgICAgICAgICAgICAgIGxhYmVscyA9IEFycmF5TGlzdCgpXG4gICAgICAgICAgICAgICAgICAgIGZvciAoaSBpbiBicmVha3MuaW5kaWNlcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWxzLmFkZChcIlwiKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdmFyIGkgPSAwXG4gICAgICAgICAgICAgICAgZm9yIChiciBpbiBicmVha3MpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIGFkZEdyaWRMaW5lID0gYnIgPj0gZ3JpZExpbmVNaW5Qb3MgJiYgYnIgPD0gZ3JpZExpbmVNYXhQb3NcbiAgICAgICAgICAgICAgICAgICAgdmFsIGxhYmVsID0gbGFiZWxzW2kgJSBsYWJlbHMuc2l6ZV1cbiAgICAgICAgICAgICAgICAgICAgdmFsIGxhYmVsT2Zmc2V0ID0gdGlja0xhYmVsT2Zmc2V0KGkpXG4gICAgICAgICAgICAgICAgICAgIGkrK1xuICAgICAgICAgICAgICAgICAgICB2YWwgZ3JvdXAgPSBidWlsZFRpY2soXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWwsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWxPZmZzZXQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFkZEdyaWRMaW5lKSBncmlkTGluZUxlbmd0aC5nZXQoKSBlbHNlIDAuMClcblxuICAgICAgICAgICAgICAgICAgICB3aGVuIChvcmllbnRhdGlvbi5nZXQoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgT3JpZW50YXRpb24uTEVGVCwgT3JpZW50YXRpb24uUklHSFQgLT4gdHJhbnNmb3JtVHJhbnNsYXRlKGdyb3VwLCAwLjAsIGJyKVxuICAgICAgICAgICAgICAgICAgICAgICAgT3JpZW50YXRpb24uVE9QLCBPcmllbnRhdGlvbi5CT1RUT00gLT4gdHJhbnNmb3JtVHJhbnNsYXRlKGdyb3VwLCBiciwgMC4wKVxuICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiB0aHJvdyBSdW50aW1lRXhjZXB0aW9uKFwiVW5leHBlY3RlZCBvcmllbnRhdGlvbjpcIiArIG9yaWVudGF0aW9uLmdldCgpKVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgcm9vdEVsZW1lbnQuY2hpbGRyZW4oKS5hZGQoZ3JvdXApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gYXhpcyBsaW5lXG4gICAgICAgIGlmIChheGlzTGluZSAhPSBudWxsKSB7XG4gICAgICAgICAgICByb290RWxlbWVudC5jaGlsZHJlbigpLmFkZChheGlzTGluZSlcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGJ1aWxkVGljayhsYWJlbDogU3RyaW5nLCBsYWJlbE9mZnNldDogRG91YmxlVmV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W5ndGguZ2V0KClcbiAgICAgICAgd2hlbiAob3JpZW50YXRpb24uZ2V0KCkpIHtcbiAgICAgICAgICAgIE9yaWVudGF0aW9uLkxFRlQgLT4ge1xuICAgICAgICAgICAgICAgIGlmICh0aWNrTWFyayAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHRpY2tNYXJrLngyKCkuc2V0KC1tYXJrTGVuZ3RoKVxuICAgICAgICAgICAgICAgICAgICB0aWNrTWFyay55MigpLnNldCgwLjApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChncmlkTGluZSAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIGdyaWRMaW5lLngyKCkuc2V0KGdyaWRMaW5lTGVuZ3RoKVxuICAgICAgICAgICAgICAgICAgICBncmlkTGluZS55MigpLnNldCgwLjApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgT3JpZW50YXRpb24uUklHSFQgLT4ge1xuICAgICAgICAgICAgICAgIGlmICh0aWNrTWFyayAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHRpY2tNYXJrLngyKCkuc2V0KG1hcmtMZW5ndGgpXG4gICAgICAgICAgICAgICAgICAgIHRpY2tNYXJrLnkyKCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGdyaWRMaW5lICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgZ3JpZExpbmUueDIoKS5zZXQoLWdyaWRMaW5lTGVuZ3RoKVxuICAgICAgICAgICAgICAgICAgICBncmlkTGluZS55MigpLnNldCgwLjApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgT3JpZW50YXRpb24uVE9QIC0+IHtcbiAgICAgICAgICAgICAgICBpZiAodGlja01hcmsgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICB0aWNrTWFyay54MigpLnNldCgwLjApXG4gICAgICAgICAgICAgICAgICAgIHRpY2tNYXJrLnkyKCkuc2V0KC1tYXJrTGVuZ3RoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoZ3JpZExpbmUgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBncmlkTGluZS54MigpLnNldCgwLjApXG4gICAgICAgICAgICAgICAgICAgIGdyaWRMaW5lLnkyKCkuc2V0KGdyaWRMaW5lTGVuZ3RoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIE9yaWVudGF0aW9uLkJPVFRPTSAtPiB7XG4gICAgICAgICAgICAgICAgaWYgKHRpY2tNYXJrICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgdGlja01hcmsueDIoKS5zZXQoMC4wKVxuICAgICAgICAgICAgICAgICAgICB0aWNrTWFyay55MigpLnNldChtYXJrTGVuZ3RoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoZ3JpZExpbmUgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBncmlkTGluZS54MigpLnNldCgwLjApXG4gICAgICAgICAgICAgICAgICAgIGdyaWRMaW5lLnkyKCkuc2V0KC1ncmlkTGluZUxlbmd0aClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIC0+IHRocm93IFJ1bnRpbWVFeGNlcHRpb24oXCJVbmV4cGVjdGVkIG9yaWVudGF0aW9uOlwiICsgb3JpZW50YXRpb24uZ2V0KCkpXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgZyA9IFN2Z0dFbGVtZW50KClcbiAgICAgICAgaWYgKGdyaWRMaW5lICE9IG51bGwpIHtcbiAgICAgICAgICAgIGcuY2hpbGRyZW4oKS5hZGQoZ3JpZExpbmUpXG4gICAgICAgIH1cblxuICAgICAgICBpZiAodGlja01hcmsgIT0gbnVsbCkge1xuICAgICAgICAgICAgZ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ICAgICBsYXlvdXQuYmFyTGVuZ3RoRXhwYW5kLFxuICAgICAgICAgICAgaG9yaXpvbnRhbCwgc3BlYy5yZXZlcnNlXG4gICAgICAgIClcblxuICAgICAgICAvLyBUaWNrcyBhbmQgbGFiZWxzXG4gICAgICAgIHZhbCBiYXJUaGlja25lc3MgPSB3aGVuIHtcbiAgICAgICAgICAgIGhvcml6b250YWwgLT4gYmFyQm91bmRzLmhlaWdodFxuICAgICAgICAgICAgZWxzZSAtPiBiYXJCb3VuZHMud2lkdGhcbiAgICAgICAgfVxuICAgICAgICB2YWwgdGlja0xlbmd0aCA9IGJhclRoaWNrbmVzcyAvIDVcblxuICAgICAgICB2YWwgYnJlYWtJbmZvcyA9IGxheW91dC5icmVha0luZm9zLml0ZXJhdG9yKClcbiAgICAgICAgZm9yIChickxhYmVsIGluIHNwZWMuYnJlYWtzLmxhYmVscykge1xuICAgICAgICAgICAgdmFsIGJySW5mbyA9IGJyZWFrSW5mb3MubmV4dCgpXG5cbiAgICAgICAgICAgIHZhbCB0aWNrTG9jYXRpb24gPSBickluZm8udGlja0xvY2F0aW9uXG4gICAgICAgICAgICB2YWwgdGlja01hcmtQb2ludHMgPSBBcnJheUxpc3Q8RG91YmxlVmVjdG9yPigpXG4gICAgICAgICAgICBpZiAoaG9yaXpvbnRhbCkge1xuICAgICAgICAgICAgICAgIHZhbCB0aWNrWCA9IGJhckJvdW5kcy5sZWZ0ICsgdGlja0xvY2F0aW9uXG4gICAgICAgICAgICAgICAgdGlja01hcmtQb2ludHMuYWRkKERvdWJsZVZlY3Rvcih0aWNrWCwgYmFyQm91bmRzLnRvcCkpXG4gICAgICAgICAgICAgICAgdGlja01hcmtQb2ludHMuYWRkKERvdWJsZVZlY3Rvcih0aWNrWCwgYmFyQm91bmRzLnRvcCArIHRpY2tMZW5ndGgpKVxuICAgICAgICAgICAgICAgIHRpY2tNYXJrUG9pbnRzLmFkZChEb3VibGVWZWN0b3IodGlja1gsIGJhckJvdW5kcy5ib3R0b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uY2hvcilcbiAgICAgICAgICAgIGxhYmVsLm1vdmVUbyhickluZm8ubGFiZWxMb2NhdGlvbi54LCBickluZm8ubGFiZWxMb2NhdGlvbi55ICsgYmFyQm91bmRzLnRvcClcbiAgICAgICAgICAgIGd1aWRlQmFyR3JvdXAuY2hpbGRyZW4oKS5hZGQobGFiZWwucm9vdEdyb3VwKVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gYWRkIHdoaXRlIGZyYW1lXG4gICAgICAgIGd1aWRlQmFyR3JvdXAuY2hpbGRyZW4oKS5hZGQoXG4gICAgICAgICAgICBjcmVhdGVCb3JkZXIoXG4gICAgICAgICAgICAgICAgYmFyQm91bmRzLFxuICAgICAgICAgICAgICAgIHNwZWMudGhlbWUuYmFja2dyb3VuZEZpbGwoKSxcbiAgICAgICAgICAgICAgICAxLjBcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuXG4gICAgICAgIGlmIChkZWJ1Zykge1xuICAgICAgICAgICAgLy8gZnJhbWUgYmFyIGFuZCBsYWJlbHNcbiAgICAgICAgICAgIHZhbCBncmFwaEJvdW5kcyA9IERvdWJsZVJlY3RhbmdsZShEb3VibGVWZWN0b3IuWkVSTywgbGF5b3V0LmdyYXBoU2l6ZSlcbiAgICAgICAgICAgIGd1aWRlQmFyR3JvdXAuY2hpbGRyZW4oKS5hZGQoXG4gICAgICAgICAgICAgICAgY3JlYXRlQm9yZGVyKFxuICAgICAgICAgICAgICAgICAgICBncmFwaEJvdW5kcyxcbiAgICAgICAgICAgICAgICAgICAgQ29sb3IuREFSS19CTFVFLFxuICAgICAgICAgICAgICAgICAgICAxLjBcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBjb250ZW50Um9vdC5jaGlsZHJlbigpLmFkZChndWlkZUJhckdyb3VwKVxuICAgICAgICByZXR1cm4gbGF5b3V0LnNpemVcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBhZGRDb2xvckJhcihcbiAgICAgICAgZzogU3ZnR0VsZW1lbnQsXG4gICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgc2NhbGU6IFNjYWxlPENvbG9yPixcbiAgICAgICAgbnVtQmluczogSW50LFxuICAgICAgICBiYXJCb3VuZHM6IERvdWJsZVJlY3RhbmdsZSxcbiAgICAgICAgYmFyTGVuZ3RoRXhwYW5kOiBEb3VibGUsXG4gICAgICAgIGhvcml6b250YWw6IEJvb2xlYW4sXG4gICAgICAgIHJldmVyc2U6IEJvb2xlYW5cbiAgICApIHtcblxuICAgICAgICB2YWwgZG9tYWluU3BhbiA9IFNlcmllc1V0aWwuc3Bhbihkb21haW4pXG4gICAgICAgIHZhbCBzdGVwQ291bnQgPSBtYXgoMiwgbnVtQmlucylcbiAgICAgICAgdmFsIHN0ZXAgPSBkb21haW5TcGFuIC8gc3RlcENvdW50XG4gICAgICAgIHZhbCB2ID0gZG9tYWluLmxvd2VyRW5kICsgc3RlcCAvIDJcbiAgICAgICAgdmFsIGRvbWFpblZhbHVlcyA9IEFycmF5TGlzdDxEb3VibGU+KClcbiAgICAgICAgZm9yIChpIGluIDAgdW50aWwgc3RlcENvdW50KSB7XG4gICAgICAgICAgICBkb21haW5WYWx1ZXMuYWRkKHYgKyBzdGVwICogaSlcbiAgICAgICAgfVxuICAgICAgICBpZiAocmV2ZXJzZSkge1xuICAgICAgICAgICAgZG9tYWluVmFsdWVzLnJldmVyc2UoKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGNvbG9ycyA9IFNjYWxlVXRpbC5tYXAoZG9tYWluVmFsdWVzLCBzY2FsZSlcbiAgICAgICAgdmFsIGJhckxlbmd0aCA9IHdoZW4ge1xuICAgICAgICAgICAgaG9yaXpvbnRhbCAtPiBiYXJCb3VuZHMud2lkdGhcbiAgICAgICAgICAgIGVsc2UgLT4gYmFyQm91bmRzLmhlaWdodFxuICAgICAgICB9XG4gICAgICAgIHZhbCBlZmZlY3RpdmVCYXJMZW5ndGggPSBiYXJMZW5ndGggLSBiYXJMZW5ndGhFeHBhbmQgKiAyXG4gICAgICAgIHZhbCBzZWdtZW50U3RlcCA9IGVmZmVjdGl2ZUJhckxlbmd0aCAvIHN0ZXBDb3VudFxuXG4gICAgICAgIHZhciBzZWdtZW50TGVmdCA9IGJhckJvdW5kcy5sZWZ0XG4gICAgICAgIHZhbCBzZWdtZW50UmlnaHQgPSBiYXJCb3VuZHMucmlnaHRcbiAgICAgICAgdmFsIHNlZ21lbnRCb3R0b20gPSBiYXJCb3VuZHMuYm90dG9tXG4gICAgICAgIHZhciBzZWdtZW50VG9wID0gYmFyQm91bmRzLnRvcFxuXG4gICAgICAgIGZvciAoKGksIGNvbG9yKSBpbiBjb2xvcnMud2l0aEluZGV4KCkpIHtcbiAgICAgICAgICAgIHZhbCByID0gU3ZnUmVjdEVsZW1lbnQoXG4gICAgICAgICAgICAgICAgc2VnbWVudExlZnQsXG4gICAgICAgICAgICAgICAgc2VnbWVudFRvcCxcbiAgICAgICAgICAgICAgICBzZWdtZW50UmlnaHQgLSBzZWdtZW50TGVmdCxcbiAgICAgICAgICAgICAgICBzZWdtZW50Qm90dG9tIC0gc2VnbWVudFRvcFxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgci5zdHJva2VXaWR0aCgpLnNldCgwLjApXG4gICAgICAgICAgICByLmZpbGxDb2xvcigpLnNldChjb2xvcilcbiAgICAgICAgICAgIGcuY2hpbGRyZW4oKS5hZGQocilcblxuICAgICAgICAgICAgaWYgKGhvcml6b250YWwpIHtcbiAgICAgICAgICAgICAgICBzZWdtZW50TGVmdCArPSBzZWdtZW50U3RlcFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzZWdtZW50VG9wICs9IHNlZ21lbnRTdGVwXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaSA9PSAwKSB7XG4gICAgICAgICAgICAgICAgLy8gZmlyc3Qgc2VnbWVudCBpcyBhIGJpdC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sXG4gICAgICAgICAgICAgICAgVGV4dExhYmVsLkhvcml6b250YWxBbmNob3IuTUlERExFLFxuICAgICAgICAgICAgICAgIFRleHRMYWJlbC5WZXJ0aWNhbEFuY2hvci5UT1BcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgVmVydGljYWxMYXlvdXQoXG4gICAgICAgIHRpdGxlOiBTdHJpbmcsXG4gICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgYnJlYWtzOiBTY2FsZUJyZWFrcyxcbiAgICAgICAgYmFyU2l6ZTogRG91YmxlVmVjdG9yLFxuICAgICAgICByZXZlcnNlOiBCb29sZWFuXG4gICAgKSA6IENvbG9yQmFyQ29tcG9uZW50TGF5b3V0KFxuICAgICAgICB0aXRsZSwgZG9tYWluLCBicmVha3MsIGJhclNpemUsXG4gICAgICAgIExlZ2VuZERpcmVjdGlvbi5WRVJUSUNBTCxcbiAgICAgICAgcmV2ZXJzZVxuICAgICkge1xuXG4gICAgICAgIG92ZXJyaWRlIHZhbCBncmFwaFNpemU6IERvdWJsZVZlY3RvclxuICAgICAgICBwcml2YXRlIHZhbCBsYWJlbERpc3RhbmNlOiBEb3VibGUgZ2V0KCkgPSBMQUJFTF9TUEVDLndpZHRoKDEpIC8gMlxuICAgICAgICBvdmVycmlkZSB2YWwgZ3VpZGVCYXJMZW5ndGg6IERvdWJsZSBnZXQoKSA9IGd1aWRlQmFyU2l6ZS55XG5cbiAgICAgICAgaW5pdCB7XG4gICAgICAgICAgICBjaGVjayghYnJlYWtzLmlzRW1wdHkpIHsgXCJDb2xvcmJhciBWZXJ0aWNhbExheW91dCByZWNlaXZlZCBlbXB0eSBicmVha3MgbGlzdC5cIiB9XG4gICAgICAgICAgICB2YWwgbWF4TGFiZWxXaWR0aDogRG91YmxlID0gYnJlYWtzLmxhYmVscy5tYXAgeyBpdC5sZW5ndGggfVxuICAgICAgICAgICAgICAgIC5tYXhPZiB7IExBQkVMX1NQRUMud2lkdGgoaXQpIH1cblxuICAgICAgICAgICAgLy8gQmFyICsgbGFiZWxzIGJvdW5kc1xuICAgICAgICAgICAgZ3JhcGhTaXplID0gRG91YmxlVmVjdG9yKGd1aWRlQmFyU2l6ZS54ICsgbGFiZWxEaXN0YW5jZSArIG1heExhYmVsV2lkdGgsIGd1aWRlQmFyU2l6ZS55KVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGNyZWF0ZUJyZWFrSW5mbyh0aWNrTG9jYXRpb246IERvdWJsZSk6IEJyZWFrSW5mbyB7XG4gICAgICAgICAgICB2YWwgbGFiZWxMb2NhdGlvbiA9IERvdWJsZVZlY3RvcihndWlkZUJhclNpemUueCArIGxhYmVsRGlzdGFuY2UsIHRpY2tMb2NhdGlvbilcbiAgICAgICAgICAgIHJldHVybiBCcmVha0luZm8oXG4gICAgICAgICAgICAgICAgdGlja0xvY2F0aW9uLFxuICAgICAgICAgICAgICAgIGxhYmVsTG9jYXRpb24sXG4gICAgICAgICAgICAgICAgVGV4dExhYmVsLkhvcml6b250YWxBbmNob3IuTEVGVCxcbiAgICAgICAgICAgICAgICBUZXh0TGFiZWwuVmVydGljYWxBbmNob3IuQ0VOVEVSXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgZnVuIGhvcml6b250YWwoXG4gICAgICAgICAgICB0aXRsZTogU3RyaW5nLFxuICAgICAgICAgICAgZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICAgICAgYnJlYWtzOiBTY2FsZUJyZWFrcyxcbiAgICAgICAgICAgIGJhclNpemU6IERvdWJsZVZlY3RvcixcbiAgICAgICAgICAgIHJldmVyc2U6IEJvb2xlYW5cbiAgICAgICAgKTogQ29sb3JCYXJDb21wb25lbnRMYXlvdXQge1xuICAgICAgICAgICAgcmV0dXJuIEhvcml6b250YWxMYXlvdXQoXG4gICAgICAgICAgICAgICAgdGl0bGUsXG4gICAgICAgICAgICAgICAgZG9tYWluLFxuICAgICAgICAgICAgICAgIGJyZWFrcyxcbiAgICAgICAgICAgICAgICBiYXJTaXplLFxuICAgICAgICAgICAgICAgIHJldmVyc2VcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB2ZXJ0aWNhbChcbiAgICAgICAgICAgIHRpdGxlOiBTdHJpbmcsXG4gICAgICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgICAgICBicmVha3M6IFNjYWxlQnJlYWtzLFxuICAgICAgICAgICAgYmFyU2l6ZTogRG91YmxlVmVjdG9yLFxuICAgICAgICAgICAgcmV2ZXJzZTogQm9vbGVhblxuICAgICAgICApOiBDb2xvckJhckNvbXBvbmVudExheW91dCB7XG4gICAgICAgICAgICByZXR1cm4gVmVydGljYWxMYXlvdXQoXG4gICAgICAgICAgICAgICAgdGl0bGUsXG4gICAgICAgICAgICAgICAgZG9tYWluLFxuICAgICAgICAgICAgICAgIGJyZWFrcyxcbiAgICAgICAgICAgICAgICBiYXJTaXplLFxuICAgICAgICAgICAgICAgIHJldmVyc2VcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgMjAxMC0yMDIxIEpldEJyYWlucyBzLnIuby4gYW5kIEtvdGxpbiBQcm9ncmFtbWluZyBMYW5ndWFnZSBjb250cmlidXRvcnMuXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgQXBhY2hlIDIuMCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBsaWNlbnNlL0xJQ0VOU0UudHh0IGZpbGUuXG4gKi9cblxucGFja2FnZSBrb3RsaW4uY29tcGFyaXNvbnNcblxuLy9cbi8vIE5PVEU6IFRISVMgRklMRS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J1biB7XG4gICAgICAgICAgICAgICAgLy8gb3V0ZXIgYm91bmRzXG4gICAgICAgICAgICAgICAgYWRkQm9yZGVyKG91dGVyQm91bmRzLCBDb2xvci5DWUFOLCAxLjApXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBydW4ge1xuICAgICAgICAgICAgICAgIC8vIGlubmVyIGJvdW5kc1xuICAgICAgICAgICAgICAgIHZhbCByZWN0ID0gU3ZnUmVjdEVsZW1lbnQoc3BlYy5pbm5lckJvdW5kcylcbiAgICAgICAgICAgICAgICByZWN0LmZpbGxDb2xvcigpLnNldChDb2xvci5CTEFDSylcbiAgICAgICAgICAgICAgICByZWN0LnN0cm9rZVdpZHRoKCkuc2V0KDAuMClcbiAgICAgICAgICAgICAgICByZWN0LmZpbGxPcGFjaXR5KCkuc2V0KDAuMSlcbiAgICAgICAgICAgICAgICBhZGQocmVjdClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJ1biB7XG4gICAgICAgICAgICAgICAgLy8gY29udGVudCBib3VuZHNcbiAgICAgICAgICAgICAgICBhZGRCb3JkZXIoc3BlYy5jb250ZW50Qm91bmRzLCBDb2xvci5EQVJLX01BR0VOVEEsIDEuMClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJ1biB7XG4gICAgICAgICAgICAgICAgLy8gdGl0bGUgYm91bmRzXG4gICAgICAgICAgICAgICAgYWRkQm9yZGVyKGwudGl0bGVCb3VuZHMuYWRkKHNwZWMuY29udGVudE9yaWdpbiksIENvbG9yLk1BR0VOVEEsIDEuMClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGFkZChpbm5lckdyb3VwKVxuICAgIH1cblxuICAgIHByb3RlY3RlZCBmdW4gYWRkQm9yZGVyKGJvdW5kczogRG91YmxlUmVjdGFuZ2xlLCBzdHJva2VDb2xvcjogQ29sb3IsIHN0cm9rZVdpZHRoOiBEb3VibGUpIHtcbiAgICAgICAgYWRkKFxuICAgICAgICAgICAgY3JlYXRlQm9yZGVyKFxuICAgICAgICAgICAgICAgIGJvdW5kcyxcbiAgICAgICAgICAgICAgICBzdHJva2VDb2xvcixcbiAgICAgICAgICAgICAgICBzdHJva2VXaWR0aFxuICAgICAgICAgICAgKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgcHJvdGVjdGVkIGZ1biBhZGRSZWN0YW5nbGUoYm91bmRzOiBEb3VibGVSZWN0YW5nbGUsIGZpbGxDb2xvcjogQ29sb3IpIHtcbiAgICAgICAgYWRkKFxuICAgICAgICAgICAgY3JlYXRlUmVjdGFuZ2xlKFxuICAgICAgICAgICAgICAgIGJvdW5kcyxcbiAgICAgICAgICAgICAgICBmaWxsQ29sb3JcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByb3RlY3RlZCBhYnN0cmFjdCBmdW4gYXBwZW5kR3VpZGVDb250ZW50KGNvbnRlbnRSb290OiBTdmdOb2RlKTogRG91YmxlVmVjdG9yXG5cbiAgICBwcml2YXRlIGZ1biBjcmVhdGVUaXRsZUxhYmVsKFxuICAgICAgICBvcmlnaW46IERvdWJsZVZlY3RvcixcbiAgICAgICAgaG9yaXpvbnRhbEFuY2hvcjogVGV4dExhYmVsLkhvcml6b250YWxBbmNob3IsXG4gICAgICAgIHZlcnRpY2FsQW5jaG9yOiBUZXh0TGFiZWwuVmVydGljYWxBbmNob3JcbiAgICApOiBUZXh0TGFiZWwge1xuICAgICAgICB2YWwgbGFiZWwgPSBUZXh0TGFiZWwodGl0bGUpXG4gICAgICAgIGxhYmVsLmFkZENsYXNzTmFtZShTdHlsZS5MRUdFTkRfVElUTEUpXG4gICAgICAgIGxhYmVsLnNldEhvcml6b250YWxBbmNob3IoaG9yaXpvbnRhbEFuY2hvcilcbiAgICAgICAgbGFiZWwuc2V0VmVydGljYWxBbmNob3IodmVydGljYWxBbmNob3IpXG4gICAgICAgIGxhYmVsLm1vdmVUbyhvcmlnaW4pXG4gICAgICAgIHJldHVybiBsYWJlbFxu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ICAgICAgdmFsIHNpemUgPSB0aXRsZVNpemUodGl0bGUpXG4gICAgICAgICAgICBpZiAoaXNIb3Jpem9udGFsKSB7XG4gICAgICAgICAgICAgICAgb3JpZ2luID0gRG91YmxlVmVjdG9yKG9yaWdpbi54LCBvcmlnaW4ueSAtIHNpemUueSAvIDIpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gRG91YmxlUmVjdGFuZ2xlKG9yaWdpbiwgc2l6ZSlcbiAgICAgICAgfVxuXG4gICAgdmFsIGdyYXBoT3JpZ2luOiBEb3VibGVWZWN0b3JcbiAgICAgICAgZ2V0KCkgPSB3aGVuIHtcbiAgICAgICAgICAgIGlzSG9yaXpvbnRhbCAtPlxuICAgICAgICAgICAgICAgIERvdWJsZVZlY3Rvcih0aXRsZVNpemUodGl0bGUpLngsIDAuMClcbiAgICAgICAgICAgIGVsc2UgLT5cbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IoMC4wLCB0aXRsZVNpemUodGl0bGUpLnkpXG4gICAgICAgIH1cblxuICAgIHZhbCBzaXplOiBEb3VibGVWZWN0b3JcbiAgICAgICAgZ2V0KCkge1xuICAgICAgICAgICAgdmFsIGdyYXBoQm91bmRzID0gRG91YmxlUmVjdGFuZ2xlKGdyYXBoT3JpZ2luLCBncmFwaFNpemUpXG4gICAgICAgICAgICB2YWwgdGl0bGVBbmRDb250ZW50ID0gRG91YmxlUmVjdGFuZ2xlKERvdWJsZVZlY3Rvci5aRVJPLCBEb3VibGVWZWN0b3IuWkVSTylcbiAgICAgICAgICAgICAgICAudW5pb24odGl0bGVCb3VuZHMpXG4gICAgICAgICAgICAgICAgLnVuaW9uKGdyYXBoQm91bmRzKVxuICAgICAgICAgICAgcmV0dXJuIHRpdGxlQW5kQ29udGVudC5kaW1lbnNpb25cbiAgICAgICAgfVxuXG4gICAgdmFsIHRpdGxlTG9jYXRpb246IERvdWJsZVZlY3RvclxuICAgICAgICBnZXQoKSA9IGlmIChpc0hvcml6b250Y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ZXh0U3RhdGU6IEludCA9IC0xIC8vIC0xIGZvciB1bmtub3duLCAwIGZvciBkb25lLCAxIGZvciBjb250aW51ZVxuICAgICAgICB2YXIgY3VycmVudFN0YXJ0SW5kZXg6IEludCA9IHN0YXJ0SW5kZXguY29lcmNlSW4oMCwgaW5wdXQubGVuZ3RoKVxuICAgICAgICB2YXIgbmV4dFNlYXJjaEluZGV4OiBJbnQgPSBjdXJyZW50U3RhcnRJbmRleFxuICAgICAgICB2YXIgbmV4dEl0ZW06IEludFJhbmdlPyA9IG51bGxcbiAgICAgICAgdmFyIGNvdW50ZXI6IEludCA9IDBcblxuICAgICAgICBwcml2YXRlIGZ1biBjYWxjTmV4dCgpIHtcbiAgICAgICAgICAgIGlmIChuZXh0U2VhcmNoSW5kZXggPCAwKSB7XG4gICAgICAgICAgICAgICAgbmV4dFN0YXRlID0gMFxuICAgICAgICAgICAgICAgIG5leHRJdGVtID0gbnVsbFxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAobGltaXQgPiAwICYmICsrY291bnRlciA+PSBsaW1pdCB8fCBuZXh0U2VhcmNoSW5kZXggPiBpbnB1dC5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgbmV4dEl0ZW0gPSBjdXJyZW50U3RhcnRJbmRleC4uaW5wdXQubGFzdEluZGV4XG4gICAgICAgICAgICAgICAgICAgIG5leHRTZWFyY2hJbmRleCA9IC0xXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIG1hdGNoID0gaW5wdXQuZ2V0TmV4dE1hdGNoKG5leHRTZWFyY2hJbmRleClcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1hdGNoID09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5leHRJdGVtID0gY3VycmVudFN0YXJ0SW5kZXguLmlucHV0Lmxhc3RJbmRleFxuICAgICAgICAgICAgICAgICAgICAgICAgbmV4dFNlYXJjaEluZGV4ID0gLTFcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCAoaW5kZXgsIGxlbmd0aCkgPSBtYXRjaFxuICAgICAgICAgICAgICAgICAgICAgICAgbmV4dEl0ZW0gPSBjdXJyZW50U3RhcnRJbmRleCB1bnRpbCBpbmRleFxuICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudFN0YXJ0SW5kZXggPSBpbmRleCArIGxlbmd0aFxuICAgICAgICAgICAgICAgICAgICAgICAgbmV4dFNlYXJjaEluZGV4ID0gY3VycmVudFN0YXJ0SW5kZXggKyBpZiAobGVuZ3RoID09IDApIDEgZWxzZSAwXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbmV4dFN0YXRlID0gMVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIG5leHQoKTogSW50UmFuZ2Uge1xuICAgICAgICAgICAgaWYgKG5leHRTdGF0ZSA9PSAtMSlcbiAgICAgICAgICAgICAgICBjYWxjTmV4dCgpXG4gICAgICAgICAgICBpZiAobmV4dFN0YXRlID09IDApXG4gICAgICAgICAgICAgICAgdGhyb3cgTm9TdWNoRWxlbWVudEV4Y2VwdGlvbigpXG4gICAgICAgICAgICB2YWwgcmVzdWx0ID0gbmV4dEl0ZW0gYXMgSW50UmFuZ2VcbiAgICAgICAgICAgIC8vIENsZWFuIG5leHQgdG8gYXZvaWQga2VlcGluZyByZWZlcmVuY2Ugb24geWllbGRlZCBpbnN0YW5jZVxuICAgICAgICAgICAgbmV4dEl0ZW0gPSBudWxsXG4gICAgICAgICAgICBuZXh0U3RhdGUgPSAtMVxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGhhc05leHQoKTogQm9vbGVhbiB7XG4gICAgICAgICAgICBpZ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XlMYXllcnMuYWRkKFxuICAgICAgICAgICAgTGVnZW5kQnJlYWtMYXllcihcbiAgICAgICAgICAgICAgICBkYXRhUG9pbnQsXG4gICAgICAgICAgICAgICAga2V5RWxlbWVudEZhY3RvcnlcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biBjcmVhdGVLZXlFbGVtZW50KHNpemU6IERvdWJsZVZlY3Rvcik6IFN2Z0dFbGVtZW50IHtcbiAgICAgICAgdmFsIGcgPSBTdmdHRWxlbWVudCgpXG5cbiAgICAgICAgZm9yIChsYXllciBpbiBteUxheWVycykge1xuICAgICAgICAgICAgdmFsIGtleUVsZW1lbnQgPSBsYXllci5rZXlFbGVtZW50RmFjdG9yeS5jcmVhdGVLZXlFbGVtZW50KGxheWVyLmRhdGFQb2ludCwgc2l6ZSlcbiAgICAgICAgICAgIGcuY2hpbGRyZW4oKS5hZGQoa2V5RWxlbWVudClcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBnXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBjbGFzcyBMZWdlbmRCcmVha0xheWVyKFxuICAgICAgICB2YWwgZGF0YVBvaW50OiBEYXRhUG9pbnRBZXN0aGV0aWNzLFxuICAgICAgICB2YWwga2V5RWxlbWVudEZhY3Rvcnk6IExlZ2VuZEtleUVsZW1lbnRGYWN0b3J5XG4gICAgKVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGZ1biBzaW1wbGUoXG4gICAgICAgICAgICBsYWJlbDogU3RyaW5nLFxuICAgICAgICAgICAgZGF0YVBvaW50OiBEYXRhUG9pbnRBZXN0aGV0aWNzLFxuICAgICAgICAgICAga2V5RWxlbWVudEZhY3Rvcnk6IExlZ2VuZEtleUVsZW1lbnRGYWN0b3J5XG4gICAgICAgICk6IExlZ2VuZEJyZWFrIHtcbiAgICAgICAgICAgIHZhbCBiciA9IExlZ2VuZEJyZWFrKGxhYmVsKVxuICAgICAgICAgICAgYnI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RlcmF0b3IoKVxuICAgICAgICB2YWwgbGFiZWxCb3hlcyA9IGxheW91dC5sYWJlbEJveGVzLml0ZXJhdG9yKClcbiAgICAgICAgZm9yIChiciBpbiBzcGVjLmJyZWFrcykge1xuICAgICAgICAgICAgdmFsIGtleUxhYmVsQm94ID0ga2V5TGFiZWxCb3hlcy5uZXh0KClcbiAgICAgICAgICAgIHZhbCBsYWJlbEJveCA9IGxhYmVsQm94ZXMubmV4dCgpXG4gICAgICAgICAgICB2YWwgYnJlYWtFbGVtZW50ID0gY3JlYXRlQnJlYWtFbGVtZW50KGJyLCBsYXlvdXQua2V5U2l6ZSwga2V5TGFiZWxCb3gsIGxhYmVsQm94KVxuICAgICAgICAgICAgY29udGVudFJvb3QuY2hpbGRyZW4oKS5hZGQoYnJlYWtFbGVtZW50KVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBsYXlvdXQuc2l6ZVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNyZWF0ZUJyZWFrRWxlbWVudChcbiAgICAgICAgYnI6IExlZ2VuZEJyZWFrLFxuICAgICAgICBrZXlTaXplOiBEb3VibGVWZWN0b3IsXG4gICAgICAgIGtleUxhYmVsQm94OiBEb3VibGVSZWN0YW5nbGUsXG4gICAgICAgIGxhYmVsQm94OiBEb3VibGVSZWN0YW5nbGVcbiAgICApOiBTdmdFbGVtZW50IHtcbiAgICAgICAgdmFsIGJyZWFrQ29tcG9uZW50ID0gR3JvdXBDb21wb25lbnQoKVxuXG4gICAgICAgIC8vIGtleSBlbGVtZW50XG4gICAgICAgIGJyZWFrQ29tcG9uZW50LmFkZChjcmVhdGVLZXlFbGVtZW50KGJyLCBrZXlTaXplKSlcblxuICAgICAgICAvLyBhZGQgbGFiZWwgYXQgcG9zaXRpb24gYXMgd2FzIGxheW91dFxuICAgICAgICB2YWwgbGFiZWwgPSBUZXh0TGFiZWwoYnIubGFiZWwpXG4gICAgICAgIGxhYmVsLnNldEhvcml6b250YWxBbmNob3IoVGV4dEx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cbiAgICAgICAgICAgIGNoZWNrKGNvbENvdW50ID4gMCkgeyBcIkNvbCBjb3VudCBtdXN0IGJlIGdyZWF0ZXIgdGhhbiAwLCB3YXMgJGNvbENvdW50XCIgfVxuICAgICAgICAgICAgZmllbGQgPSBjb2xDb3VudFxuICAgICAgICB9XG5cbiAgICBvdmVycmlkZSB2YWwgZ3JhcGhTaXplOiBEb3VibGVWZWN0b3JcbiAgICAgICAgZ2V0KCkge1xuICAgICAgICAgICAgZW5zdXJlSW5pdGVkKClcbiAgICAgICAgICAgIHJldHVybiBteUNvbnRlbnRTaXplISFcbiAgICAgICAgfVxuXG4gICAgdmFsIGtleUxhYmVsQm94ZXM6IExpc3Q8RG91YmxlUmVjdGFuZ2xlPlxuICAgICAgICBnZXQoKSB7XG4gICAgICAgICAgICBlbnN1cmVJbml0ZWQoKVxuICAgICAgICAgICAgcmV0dXJuIG15S2V5TGFiZWxCb3hlc1xuICAgICAgICB9XG5cbiAgICB2YWwgbGFiZWxCb3hlczogTGlzdDxEb3VibGVSZWN0YW5nbGU+XG4gICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgIGVuc3VyZUluaXRlZCgpXG4gICAgICAgICAgICByZXR1cm4gbXlMYWJlbEJveGVzXG4gICAgICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGVuc3VyZUluaXRlZCgpIHtcbiAgICAgICAgaWYgKG15Q29udGVudFNpemUgPT0gbnVsbCkge1xuICAgICAgICAgICAgZG9MYXlvdXQoKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gZG9MYXlvdXQoKSB7XG4gICAgICAgIHZhbCBsYWJlbEhlaWdodCA9IExBQkVMX1NQRUMuaGVpZ2h0KClcbiAgICAgICAgdmFsIGxhYmVsTGVmdE1hcmdpbiA9IExBQkVMX1NQRUMud2lkdGgoMSkgLyAyXG4gICAgICAgIHZhbCBsYWJlbEhPZmZzZXQgPSBrZXlTaXplLnggKyBsYWJlbExlZnRNYXJnaW5cbiAgICAgICAgdmFsIGxhYmVsVk9mZnNldCA9IChrZXlTaXplLnkgLSBsYWJlbEhlaWdodCkgLyAyXG5cbiAgICAgICAgdmFsIGNvbnRlbnRPcmlnaW4gPSBEb3VibGVWZWN0b3IuWkVST1xuICAgICAgICB2YXIgYnJlYWtCb3hCb3VuZHM6IERvdWJsZVJlY3RhbmdsZT8gPSBudWxsXG4gICAgICAgIGZvciAoaSBpbiBicmVha3MuaW5kaWNlcykge1xuICAgICAgICAgICAgdmFsIGxhYmVsU2l6ZSA9IGxhYmVsU2l6ZShpKVxuICAgICAgICAgICAgdmFsIGJyZWFrQm94U2l6ZSA9IERvdWJsZVZlY3RvcihsYWJlbEhPZmZzZXQgKyBsYWJlbFNpemUueCwga2V5U2l6ZS55KVxuICAgICAgICAgICAgYnJlYWtCb3hCb3VuZHMgPSBEb3VibGVSZWN0YW5nbGUoXG4gICAgICAgICAgICAgICAgYnJlYWtCb3hCb3VuZHM/LmxldCB7IGJyZWFrQm94T3JpZ2luKGksIGl0KSB9ID86IGNvbnRlbnRPcmlnaW4sXG4gICAgICAgICAgICAgICAgYnJlYWtCb3hTaXplXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIG15S2V5TGFiZWxCb3hlcy5hZGQoYnJlYWtCb3hCb3VuZHMpXG4gICAgICAgICAgICBteUxhYmVsQm94ZXMuYWRkKFxuICAgICAgICAgICAgICAgIERvdWJsZVJlY3RhbmdsZShcbiAgICAgICAgICAgICAgICAgICAgbGFiZWxIT2Zmc2V0LCBsYWJlbFZPZmZzZXQsXG4gICAgICAgICAgICAgICAgICAgIGxhYmVsU2l6ZS54LCBsYWJlbFNpemUueVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIG15Q29udGVudFNpemUgPSBHZW9tZXRyeVV0aWwudW5pb24oRG91YmxlUmVjdGFuZ2xlKGNvbnRlbnRPcmlnaW4sIERvdWJsZVZlY3Rvci5aRVJPKSwg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cmV0dXJuIERvdWJsZVZlY3RvcihMQUJFTF9TUEVDLndpZHRoKGxhYmVsLmxlbmd0aCksIExBQkVMX1NQRUMuaGVpZ2h0KCkpXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGNsYXNzIE15SG9yaXpvbnRhbE11bHRpUm93IGludGVybmFsIGNvbnN0cnVjdG9yKFxuICAgICAgICB0aXRsZTogU3RyaW5nLFxuICAgICAgICBicmVha3M6IExpc3Q8TGVnZW5kQnJlYWs+LFxuICAgICAgICBrZXlTaXplOiBEb3VibGVWZWN0b3JcbiAgICApIDogTXlNdWx0aVJvdyhcbiAgICAgICAgdGl0bGUsIGJyZWFrcywga2V5U2l6ZSxcbiAgICAgICAgTGVnZW5kRGlyZWN0aW9uLkhPUklaT05UQUxcbiAgICApIHtcbiAgICAgICAgaW5pdCB7XG4gICAgICAgICAgICBjb2xDb3VudCA9IGJyZWFrcy5zaXplXG4gICAgICAgICAgICByb3dDb3VudCA9IDFcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgTXlWZXJ0aWNhbCBpbnRlcm5hbCBjb25zdHJ1Y3Rvcih0aXRsZTogU3RyaW5nLCBicmVha3M6IExpc3Q8TGVnZW5kQnJlYWs+LCBrZXlTaXplOiBEb3VibGVWZWN0b3IpIDpcbiAgICAgICAgTXlNdWx0aVJvdyhcbiAgICAgICAgICAgIHRpdGxlLCBicmVha3MsIGtleVNpemUsXG4gICAgICAgICAgICBMZWdlbmREaXJlY3Rpb24uVkVSVElDQUxcbiAgICAgICAgKSB7XG4gICAgICAgIGluaXQge1xuICAgICAgICAgICAgY29sQ291bnQgPSAxXG4gICAgICAgICAgICByb3dDb3VudCA9IGJyZWFrcy5zaXplXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGFic3RyYWN0IGNsYXNzIE15TXVsdGlSb3cgaW50ZXJuYWwgY29uc3RydWN0b3IoXG4gICAgICAgIHRpdGxlOiBTdHJpbmcsXG4gICAgICAgIGJyZWFrczogTGlzdDxMZWdlbmRCcmVhaz4sXG4gICAgICAgIGtleVNpemU6IERvdWJsZVZlY3RvcixcbiAgICAgICAgbGVnZW5kRGlyZWN0aW9uOiBMZWdlbmREaXJlY3Rpb25cbiAgICApIDogTGVnZW5kQ29tcG9uZW50TGF5b3V0KHRpdGxlLCBicmVha3MsIGtleVNpemUsIGxlZ2VuZERpcmVjdGlvbikge1xuICAgICAgICBwcml2YXRlIHZhciBteU1heExhYmVsV2lkdGggPSAwLjBcblxuICAgICAgICBpbml0IHtcbiAgICAgICAgICAgIGZvciAoYnIgaW4gYnJlYWtzKSB7XG4gICAgICAgICAgICAgICAgbXlNYXhMYWJlbFdpZHRoID0gbWF4KG15TWF4TGFiZWxXaWR0aCwgTEFCRUxfU1BFQy53aWR0aChici5sYWJlbC5sZW5ndGgpKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGJyZWFrQm94T3JpZ2luKGluZGV4OiBJbnQsIHByZXZCcmVha0JveEJvdW5kczogRG91YmxlUmVjdGFuZ2xlKTogRG91YmxlVmVjdG9yIHtcbiAgICAgICAgICAgIGlmIChpc0ZpbGxCeVJvdykge1xuICAgICAgICAgICAgICAgIHJldHVybiBpZiAoaW5kZXggJSBjb2xDb3VudCA9PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIERvdWJsZVZlY3RvcigwLjAsIHByZXZCcmVha0JveEJvdW5kcy5ib3R0b20pXG4gICAgICAgICAgICAgICAgfSBlbHNlIERvdWJsZVZlY3RvcihwcmV2QnJlYWtCb3hCb3VuZHMucmlnaHQsIHByZXZCcmVha0JveEJvdW5kcy50b3ApXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIGZpbGwgYnkgY29sdW1uXG4gICAgICAgICAgICByZXR1cm4gaWYgKGluZGV4ICUgcm93Q291bnQgPT0gMCkge1xuICAgICAgICAgICAgICAgIERvdWJsZVZlY3RvcihwcmV2QnJlYWtCb3hCb3VuZHMucmlnaHQsIDAuMClcbiAgICAgICAgICAgIH0gZWxzZSBEb3VibGVWZWN0b3IocHJldkJyZWFrQm94Qm91bmRzLmxlZnQsIHByZXZCcmVha0JveEJvdW5kcy5ib3R0b20pXG5cbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBsYWJlbFNpemUoaW5kZXg6IEludCk6IERvdWJsZVZlY3RvciB7XG4gICAgICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKG15TWF4TGFiZWxXaWR0aCwgTEFCRUxfU1BFQy5oZWlnaHQoKSlcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBmdW4gaG9yaXpvbnRhbCh0aXRsZTogU3RyaW5nLCBicmVha3M6IExpc3Q8TGVnZW5kQnJlYWs+LCBrZXlTaXplOiBEb3VibGVWZWN0b3IpOiBMZWdlbmRDb21wb25lbnRMYXlvdXQge1xuICAgICAgICAgICAgcmV0dXJuIE15SG9yaXpvbnRhbChcbiAgICAgICAgICAgICAgICB0aXRsZSxcbiAgICAgICAgICAgICAgICBicmVha3MsXG4gICAgICAgICAgICAgICAga2V5U2l6ZVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGhvcml6b250YWxNdWx0aVJvdyh0aXRsZTogU3RyaW5nLCBicmVha3M6IExpc3Q8TGVnZW5kQnJlYWs+LCBrZXlTaXplOiBEb3VibGVWZWN0b3IpOiBMZWdlbmRDb21wb25lbnRMYXlvdXQge1xuICAgICAgICAgICAgcmV0dXJuIE15SG9yaXpvbnRhbE11bHRpUm93KFxuICAgICAgICAgICAgICAgIHRpdGxlLFxuICAgICAgICAgICAgICAgIGJyZWFrcyxcbiAgICAgICAgICAgICAgICBrZXlTaXplXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdmVydGljYWwodGl0bGU6IFN0cmluZywgYnJl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czogTGlzdDxBZXM8Kj4+LFxuICAgICAgICAgICAgZGF0YUFjY2VzczogTWFwcGVkRGF0YUFjY2VzcyxcbiAgICAgICAgICAgIGRhdGFGcmFtZTogRGF0YUZyYW1lLFxuICAgICAgICAgICAgdXNlckRlZmluZWRWYWx1ZVNvdXJjZXM6IExpc3Q8VmFsdWVTb3VyY2U+PyA9IG51bGxcbiAgICAgICAgKTogQ29udGV4dHVhbE1hcHBpbmcge1xuICAgICAgICAgICAgdmFsIGRlZmF1bHRUb29sdGlwTGluZXMgPSBHZW9tSW50ZXJhY3Rpb25CdWlsZGVyLmRlZmF1bHRWYWx1ZVNvdXJjZVRvb2x0aXBMaW5lcyhcbiAgICAgICAgICAgICAgICBhZXNMaXN0Rm9yVG9vbHRpcCxcbiAgICAgICAgICAgICAgICBheGlzQWVzLFxuICAgICAgICAgICAgICAgIG91dGxpZXJzLFxuICAgICAgICAgICAgICAgIHVzZXJEZWZpbmVkVmFsdWVTb3VyY2VzXG4gICAgICAgICAgICApXG4gICAgICAgICAgICByZXR1cm4gY3JlYXRlQ29udGV4dHVhbE1hcHBpbmcoXG4gICAgICAgICAgICAgICAgZGVmYXVsdFRvb2x0aXBMaW5lcyxcbiAgICAgICAgICAgICAgICBkYXRhQWNjZXNzLFxuICAgICAgICAgICAgICAgIGRhdGFGcmFtZSxcbiAgICAgICAgICAgICAgICBUb29sdGlwUHJvcGVydGllcy5OT05FLFxuICAgICAgICAgICAgICAgIGlnbm9yZUludmlzaWJsZVRhcmdldHMgPSBmYWxzZSxcbiAgICAgICAgICAgICAgICBpc0Nyb3NzaGFpckVuYWJsZWQgPSBmYWxzZVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gY3JlYXRlQ29udGV4dHVhbE1hcHBpbmcoXG4gICAgICAgICAgICB0b29sdGlwTGluZXM6IExpc3Q8VG9vbHRpcExpbmU+LFxuICAgICAgICAgICAgZGF0YUFjY2VzczogTWFwcGVkRG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RlZmluZWRWYWx1ZVNvdXJjZXMgPSBudWxsLFxuICAgICAgICAgICAgICAgICAgICBjb25zdGFudHNNYXAgPSBteVRvb2x0aXBDb25zdGFudHNBZXNMaXN0XG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbXlVc2VyVG9vbHRpcFNwZWMhIS50b29sdGlwTGluZVBhdHRlcm5zID09IG51bGwgLT4ge1xuICAgICAgICAgICAgICAgIC8vIE5vIHVzZXIgbGluZSBwYXR0ZXJucyA9PiB1c2UgZGVmYXVsdCB0b29sdGlwcyB3aXRoIHRoZSBnaXZlbiBmb3JtYXR0ZWQgdmFsdWVTb3VyY2VzXG4gICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlU291cmNlVG9vbHRpcExpbmVzKFxuICAgICAgICAgICAgICAgICAgICBteVRvb2x0aXBBZXMsXG4gICAgICAgICAgICAgICAgICAgIG15VG9vbHRpcEF4aXNBZXMsXG4gICAgICAgICAgICAgICAgICAgIG15VG9vbHRpcE91dGxpZXJBZXNMaXN0LFxuICAgICAgICAgICAgICAgICAgICBteVVzZXJUb29sdGlwU3BlYyEhLnZhbHVlU291cmNlcyxcbiAgICAgICAgICAgICAgICAgICAgbXlUb29sdGlwQ29uc3RhbnRzQWVzTGlzdFxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG15VXNlclRvb2x0aXBTcGVjISEudG9vbHRpcExpbmVQYXR0ZXJucyEhLmlzRW1wdHkoKSAtPiB7XG4gICAgICAgICAgICAgICAgLy8gVXNlciBsaXN0IGlzIGVtcHR5ID0+IG5vdCBzaG93IHRvb2x0aXBzXG4gICAgICAgICAgICAgICAgZW1wdHlMaXN0KClcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2UgLT4ge1xuICAgICAgICAgICAgICAgIC8vIEZvcm0gdmFsdWUgc291cmNlczogdXNlciBsaXN0ICsgYXhpcyArIG91dGxpZXJzXG4gICAgICA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B7XG4gICAgICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIHggPSBzdGFydC54ICsgKGNvb3JkLnkgLSBzdGFydC55KSAqIChlbmQueCAtIHN0YXJ0LngpIC8gKGVuZC55IC0gc3RhcnQueSlcblxuICAgICAgICAgICAgaWYgKHggPD0gY29vcmQueCkge1xuICAgICAgICAgICAgICAgIGludGVyc2VjdGlvbkNvdW50KytcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBpbnRlcnNlY3Rpb25Db3VudCAlIDIgIT0gMFxuICAgIH1cblxuICAgIGZ1biBsaWVzT25TZWdtZW50KHAxOiBEb3VibGVWZWN0b3IsIHAyOiBEb3VibGVWZWN0b3IsIGM6IERvdWJsZVZlY3RvciwgZXBzaWxvbjogRG91YmxlKTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiBEb3VibGVTZWdtZW50KHAxLCBwMikuZGlzdGFuY2UoYykgPCBlcHNpbG9uXG4gICAgfVxuXG4gICAgaW50ZXJuYWwgZnVuIGFyZUVxdWFsKHAxOiBEb3VibGVWZWN0b3IsIHAyOiBEb3VibGVWZWN0b3IsIGVwc2lsb246IERvdWJsZSk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gcDEuc3VidHJhY3QocDIpLmxlbmd0aCgpIDwgZXBzaWxvblxuICAgIH1cblxuICAgIGludGVybmFsIGZ1biBhcmVFcXVhbChhOiBEb3VibGUsIGI6IERvdWJsZSwgZXBzaWxvbjogRG91YmxlKTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiBhYnMoYSAtIGIpIDwgZXBzaWxvblxuICAgIH1cblxuICAgIGludGVybmFsIGZ1biBkaXN0YW5jZShwMTogRG91YmxlVmVjdG9yLCBwMjogRG91YmxlVmVjdG9yKTogRG91YmxlIHtcbiAgICAgICAgcmV0dXJuIERvdWJsZVNlZ21lbnQocDEsIHAyKS5sZW5ndGgoKVxuICAgIH1cblxuICAgIGludGVybmFsIGZ1biBzdWJ0cmFjdFgodjogRG91YmxlVmVjdG9yLCB4OiBEb3VibGUpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICByZXR1cm4gRG91YmxlVmVjdG9yKHYueCAtIHgsIHYueSlcbiAgICB9XG5cbiAgICBpbnRlcm5hbCBmdW4gYWRkWCh2OiBEb3VibGVWZWN0b3IsIHg6IERvdWJsZSk6IERvdWJsZVZlY3RvciB7XG4gICAgICAgIHJldHVybiBEb3VibGVWZWN0b3Iodi54ICsgeCwgdi55KVxuICAgIH1cblxuICAgIGZ1biBsZWZ0RWRnZU9mKHJlY3Q6IERvdWJsZVJlY3RhbmdsZSk6IERvdWJsZVNlZ21lbnQge1xuICAgICAgICByZXR1cm4gRG91YmxlU2VnbWVudChcbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IocmVjdC5sZWZ0LCByZWN0LnRvcCksXG4gICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHJlY3QubGVmdCwgcmVjdC5ib3R0b20pXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gdG9wRWRnZU9mKHJlY3Q6IERvdWJsZVJlY3RhbmdsZSk6IERvdWJsZVNlZ21lbnQge1xuICAgICAgICByZXR1cm4gRG91YmxlU2VnbWVudChcbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IocmVjdC5sZWZ0LCByZWN0LnRvcCksXG4gICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKHJlY3QucmlnaHQsIHJlY3QudG9wKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIHJpZ2h0RWRnZU9mKHJlY3Q6IERvdWJsZVJlY3RhbmdsZSk6IERvdWJsZVNlZ21lbnQge1xuICAgICAgICByZXR1cm4gRG91YmxlU2VnbWVudChcbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IocmVjdC5yaWdodCwgcmVjdC50b3ApLFxuICAgICAgICAgICAgICAgIERvdWJsZVZlY3RvcihyZWN0LnJpZ2h0LCByZWN0LmJvdHRvbSlcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biBib3R0b21FZGdlT2YocmVjdDogRG91YmxlUmVjdGFuZ2xlKTogRG91YmxlU2VnbWVudCB7XG4gICAgICAgIHJldHVybiBEb3VibGVTZWdtZW50KFxuICAgICAgICAgICAgICAgIERvdWJsZVZlY3RvcihyZWN0LmxlZnQsIHJlY3QuYm90dG9tKSxcbiAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IocmVjdC5yaWdodCwgcmVjdC5ib3R0b20pXG4gICAgICAgIClcbiAgICB9XG5cblxuICAgIGNsYXNzIENsb3Nlc3RQb2ludENoZWNrZXIgaW50ZXJuYWwgY29uc3RydWN0b3IodmFsIHRhcmdldDogRG91YmxlVmVjdG9yKSB7XG4gICAgICAgIHZhciBkaXN0YW5jZSA9IC0xLjBcbiAgICAgICAgICAgIHByaXZhdGUgc2V0XG4gICAgICAgIHZhciBjb29yZDogRG91YmxlVmVjdG9yPyA9IG51bGxcbiAgICAgICAgICAgIHByaXZhdGUgc2V0XG5cbiAgICAgICAgY29uc3RydWN0b3IoeDogRG91YmxlLCB5OiBEb3VibGUpIDogdGhpcyhEb3VibGVWZWN0b3IoeCwgeSkpXG5cbiAgICAgICAgZnVuIGNoZWNrKGNvb3JkOiBEb3VibGVWZWN0b3IpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHZhbCBjbXBSZXN1bHQgPSBjb21wYXJlKGNvb3JkKVxuICAgICAgICAgICAgcmV0dXJuIGNtcFJlc3VsdCA9PSBDT01QQVJJU09OX1JFU1VMVC5ORVdfQ0xPU0VSIHx8IGNtcFJlc3VsdCA9PSBDT01QQVJJU09OX1JFU1VMVC5FUVVBTFxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGNvbXBhcmUoY29vcmQ6IERvdWJsZVZlY3Rvcik6IENPTVBBUklTT05fUkVTVUxUIHtcbiAgICAgICAgICAgIHZhbCBuZXdEaXN0YW5jZSA9IGRpc3RhbmNlKHRhcmdldCwgY29vcmQpXG4gICAgICAgICAgICBpZiAoZGlzdGFuY2UgPCAwKSB7XG4gICAgICAgICAgICAgICAgc2V0TmV3Q2xvc2VzdENvb3JkKGNvb3JkLCBuZXdEaXN0YW5jZSlcbiAgICAgICAgICAgICAgICByZXR1cm4gQ09NUEFSSVNPTl9SRVNVTFQuTkVXX0NMT1NFUlxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoZGlzdGFuY2UgPCBuZXdEaXN0YW5jZSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBDT01QQVJJU09OX1JFU1VMVC5ORVdfRkFSVEhFUlxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoZGlzdGFuY2UgPT0gbmV3RGlzdGFuY2UpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gQ09NUEFSSVNPTl9SRVNVTFQuRVFVQUxcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgc2V0TmV3Q2xvc2VzdENvb3JkKGNvb3JkLCBuZXdEaXN0YW5jZSlcbiAgICAgICAgICAgIHJldHVybiBDT01QQVJJU09OX1JFU1VMVC5ORVdfQ0xPU0VSXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBzZXROZXdDbG9zZXN0Q29vcmQoY29vcmQ6IERvdWJsZVZlY3RvciwgZGlzdGFuY2U6IERvdWJsZSkge1xuICAgICAgICAgICAgdGhpcy5kaXN0YW5jZSA9IGRpc3RhbmNlXG4gICAgICAgICAgICB0aGlzLmNvb3JkID0gY29vcmRcbiAgICAgICAgfVxuXG4gICAgICAgIGVudW0gY2xhc3MgQ09NUEFSSVNPTl9SRVNVTFQge1xuICAgICAgICAgICAgTkVXX0NMT1NFUixcbiAgICAgICAgICAgIE5FV19GQVJUSEVSLFxuICAgICAgICAgICAgRVFVQUxcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNsYXNzIERvdWJsZVJhbmdlIHByaXZhdGUgY29uc3RydWN0b3IocHJpdmF0ZSB2YWwgbXlTdGFydDogRG91YmxlLCBwcml2YXRlIHZhbCBteUxlbmd0aDogRG91YmxlKSB7XG5cbiAgICAgICAgaW5pdCB7XG4gICAgICAgICAgICBpZiAobXlMZW5ndGggPCAwKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKFwiTGVuZ3RoIHNob3VsZCBiZSBwb3NpdGl2ZVwiKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGxlbmd0aCgpOiBEb3VibGUge1xuICAgICAgICAgICAgcmV0dXJuIG15TGVuZ3RoXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gb3ZlcmxhcHModjogRG91YmxlUmFuZ2UpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiBzdGFydCgpIDw9IHYuZW5kKCkgJiYgdi5zdGFydCgpIDw9IGVuZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaW5zaWRlKHY6IERvdWJsZVJhbmdlKTogQm9vbGVhbiB7XG4gICAgICAgICAgICByZXR1cm4gc3RhcnQoKSA+PSB2LnN0YXJ0KCkgJiYgZW5kKCkgPD0gdi5lbmQoKVxuICAgICAgICB9XG5cbiAgICAgICAgb3BlcmF0b3IgZnVuIGNvbnRhaW5zKHZhbHVlOiBEb3VibGUpOiBCb29sZWFuIHtcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZSA+PSBzdGFydCgpICYmIHZhbHVlIDw9IGVuZCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gc3RhcnQoKTogRG91YmxlIHtcbiAgICAgICAgICAgIHJldHVybiBteVN0YXJ0XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZW5kKCk6IERvdWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gbXlTdGFydCArIGxlbmd0aCgpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gbW92ZShkZWx0YTogRG91YmxlKTogRG91YmxlUmFuZ2Uge1xuICAgICAgICAgICAgcmV0dXJuIHdpdGhTdGFydEFuZExlbmd0aChcbiAgICAgICAgICAgICAgICBzdGFydCgpICsgZGVsdGEsXG4gICAgICAgICAgICAgICAgbGVuZ3RoKClcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBtb3ZlTGVmdChkZWx0YTogRG91YmxlKTogRG91YmxlUmFuZ2Uge1xuICAgICAgICAgICAgaWYgKGRlbHRhIDwgMCkge1xuICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbihcIlZhbHVlIHNob3VsZCBiZSBwb3NpdGl2ZVwiKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gd2l0aFN0YXJ0QW5kTGVuZ3RoKFxuICAgICAgICAgICAgICAgIHN0YXJ0KCkgLSBkZWx0YSxcbiAgICAgICAgICAgICAgICBsZW5ndGgoKVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIG1vdmVSaWdodChkZWx0YTogRG91YmxlKTogRG91YmxlUmFuZ2Uge1xuICAgICAgICAgICAgaWYgKGRlbHRhIDwgMCkge1xuICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbihcIlZhbHVlIHNob3VsZCBiZSBwb3NpdGl2ZVwiKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gd2l0aFN0YXJ0QW5kTGVuZ3RoKFxuICAgICAgICAgICAgICAgIHN0YXJ0KCkgKyBkZWx0YSxcbiAgICAgICAgICAgICAgICBsZW5ndGgoKVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgICAgICBmdW4gd2l0aFN0YXJ0QW5kRW5kKHN0YXJ0OiBEb3VibGUsIGVuZDogRG91YmxlKTogRG91YmxlUmFuZ2Uge1xuICAgICAg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HRpcFNwZWNzICs9IGF4aXNUb29sdGlwU3BlYygpXG4gICAgICAgICAgICByZXR1cm4gdG9vbHRpcFNwZWNzXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBoaXRJbmRleCgpOiBJbnQge1xuICAgICAgICAgICAgcmV0dXJuIG15R2VvbVRhcmdldC5oaXRJbmRleFxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gdGlwTGF5b3V0SGludCgpOiBUaXBMYXlvdXRIaW50IHtcbiAgICAgICAgICAgIHJldHVybiBteUdlb21UYXJnZXQudGlwTGF5b3V0SGludFxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gb3V0bGllckhpbnRzKCk6IE1hcDxBZXM8Kj4sIFRpcExheW91dEhpbnQ+IHtcbiAgICAgICAgICAgIHJldHVybiBteUdlb21UYXJnZXQuYWVzVGlwTGF5b3V0SGludHNcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGhpbnRDb2xvcnMoKTogTWFwPEFlczwqPiwgQ29sb3I/PiB7XG4gICAgICAgICAgICByZXR1cm4gbXlHZW9tVGFyZ2V0LmFlc1RpcExheW91dEhpbnRzLm1hcCB7IGl0LmtleSB0byBpdC52YWx1ZS5jb2xvciB9LnRvTWFwKClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIG91dGxpZXJUb29sdGlwU3BlYygpOiBMaXN0PFRvb2x0aXBTcGVjPiB7XG4gICAgICAgICAgICB2YWwgdG9vbHRpcFNwZWNzID0gQXJyYXlMaXN0PFRvb2x0aXBTcGVjPigpXG4gICAgICAgICAgICB2YWwgb3V0bGllckRhdGFQb2ludHMgPSBvdXRsaWVyRGF0YVBvaW50cygpXG4gICAgICAgICAgICBvdXRsaWVySGludHMoKS5mb3JFYWNoIHsgKGFlcywgaGludCkgLT5cbiAgICAgICAgICAgICAgICB2YWwgbGluZXNGb3JBZXMgPSBvdXRsaWVyRGF0YVBvaW50c1xuICAgICAgICAgICAgICAgICAgICAuZmlsdGVyIHsgYWVzID09IGl0LmFlcyB9XG4gICAgICAgICAgICAgICAgICAgIC5tYXAoRGF0YVBvaW50Ojp2YWx1ZSlcbiAgICAgICAgICAgICAgICAgICAgLm1hcChUb29sdGlwU3BlYy5MaW5lLkNvbXBhbmlvbjo6d2l0aFZhbHVlKVxuICAgICAgICAgICAgICAgIGlmIChsaW5lc0ZvckFlcy5pc05vdEVtcHR5KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdG9vbHRpcFNwZWNzLmFkZChcbiAgICAgICAgICAgICAgICAgICAgICAgIFRvb2x0aXBTcGVjKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxheW91dEhpbnQgPSBoaW50LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzID0gbGluZXNGb3JBZXMsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsbCA9IGhpbnQuY29sb3IgPzogdGlwTGF5b3V0SGludCgpLmNvbG9yISEsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNPdXRsaWVyID0gdHJ1ZVxuICAgICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRvb2x0aXBTcGVjc1xuICAgICAgICB9XG5cblxuICAgICAgICBwcml2YXRlIGZ1biBheGlzVG9vbHRpcFNwZWMoKTogTGlzdDxUb29sdGlwU3BlYz4gIHtcbiAgICAgICAgICAgIHZhbCB0b29sdGlwU3BlY3MgPSBBcnJheUxpc3Q8VG9vbHRpcFNwZWM+KClcbiAgICAgICAgICAgIHZhbCBheGlzID0gbWFwT2YoXG4gICAgICAgICAgICAgICAgQWVzLlggdG8gYXhpc0RhdGFQb2ludHMoKS5maWx0ZXIgeyBBZXMuWCA9PSBpdC5hZXMgfS5tYXAoRGF0YVBvaW50Ojp2YWx1ZSkubWFwKFRvb2x0aXBTcGVjLkxpbmUuQ29tcGFuaW9uOjp3aXRoVmFsdWUpLFxuICAgICAgICAgICAgICAgIEFlcy5ZIHRvIGF4aXNEYXRhUG9pbnRzKCkuZmlsdGVyIHsgQWVzLlkgPT0gaXQuYWVzIH0ubWFwKERhdGFQb2ludDo6dmFsdWUpLm1hcChUb29sdGlwU3BlYy5MaW5lLkNvbXBhbmlvbjo6d2l0aFZhbHVlKVxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgYXhpcy5mb3JFYWNoIHsgKGFlcywgbGluZXMpIC0+XG4gICAgICAgICAgICAgICAgaWYgKGxpbmVzLmlzTm90RW1wdHkoKSkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgbGF5b3V0SGludCA9IGNyZWF0ZUhpbnRGb3JBeGlzKGFlcylcbiAgICAgICAgICAgICAgICAgICAgdG9vbHRpcFNwZWNzLmFkZChcbiAgICAgICAgICAgICAgICAgICAgICAgIFRvb2x0aXBTcGVjKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxheW91dEhpbnQgPSBsYXlvdXRIaW50LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzID0gbGluZXMsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsbCA9IGxheW91dEhpbnQuY29sb3IhISxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc091dGxpZXIgPSB0cnVlXG4gICAgICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdG9vbHRpcFNwZWNzXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBnZW5lcmFsVG9vbHRpcFNwZWMoKTogTGlzdDxUb29sdGlwU3BlYz4ge1xuICAgICAgICAgICAgdmFsIGdlbmVyYWxEYXRhUG9pbnRzID0gZ2VuZXJhbERhdGFQb2ludHMoKVxuICAgICAgICAgICAgdmFsIGdlbmVyYWxMaW5lcyA9IGdlbmVyYWxEYXRhUG9pbnRzLm1hcCB7IFRvb2x0aXBTcGVjLkxpbmUud2l0aExhYmVsQW5kVmFsdWUoaXQubGFiZWwsIGl0LnZhbHVlKSB9XG4gICAgICAgICAgICB2YWwgYWVzSGludENvbG9ycyA9IGhpbnRDb2xvcnMoKVxuICAgICAgICAgICAgICAgIC5maWx0ZXJLZXlzIHsgYWVzIC0+IGFlcyBpbiBnZW5lcmFsRGF0YVBvaW50cy5tYXAgeyBpdC5hZXMgfSB9XG4gICAgICAgICAgICB2YWwgY29sb3JGcm9tSGludHMgPSBhZXNIaW50Q29sb3JzW0Flcy5ZXSA/OiBhZXNIaW50Q29sb3JzLm1hcE5vdE51bGwgeyBpdC52YWx1ZSB9Lmxhc3RPck51bGwoKVxuICAgICAgICAgICAgdmFsIHRvb2x0aXBDb2xvciA9IHdoZW4ge1xuICAgICAgICAgICAgICAgIG15VG9vbHRpcENvbG9yICE9IG51bGwgLT4gbXlUb29sdGlwQ29sb3JcbiAgICAgICAgICAgICAgICBjb2xvckZyb21IaW50cyAhPSBudWxsIC0+IGNvbG9yRnJvbUhpbnRzXG4gICAgICAgICAgICAgICAgZWxzZSAtPiB0aXBMYXlvdXRIaW50KCkuY29sb3IhIVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIGlmIChnZW5lcmFsTGluZXMuaXNOb3RFbXB0eSgpKSB7XG4gICAgICAgICAgICAgICAgbGlzdE9mKFxuICAgICAgICAgICAgICAgICAgICBUb29sdGlwU3BlYyhcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpcExheW91dEhpbnQoKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzID0gZ2VuZXJhbExpbmVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgZmlsbCA9IHRvb2x0aXBDb2xvcixcbiAgICAgICAgICAgICAgICAgICAgICAgIGlzT3V0bGllciA9IGZhbHNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgYW5jaG9yID0gbXlUb29sdGlwQW5jaG9yLFxuICAgICAgICAgICAgICAgICAgICAgICAgbWluV2lkdGggPSBteVRvb2x0aXBNaW5XaWR0aCxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlzQ3Jvc3NoYWlyRW5hYmxlZCA9IG15SXNDcm9zc2hhaXJFbmFibGVkXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGVtcHR5TGlzdCgpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBvdXRsaWVyRGF0YVBvaW50cygpOiBMaXN0PERhdGFQb2ludD4ge1xuICAgICAgICAgICAgcmV0dXJuIG15RGF0YVBvaW50cy5maWx0ZXIgeyBpdC5pc091dGxpZXIgJiYgIWl0LmlzQXhpcyB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBheGlzRGF0YVBvaW50cygpOiBMaXN0PERhdGFQb2ludD4ge1xuICAgICAgICAgICAgcmV0dXJuIG15RGF0YVBvaW50cy5maWx0ZXIoRGF0YVBvaW50Ojppc0F4aXMpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBnZW5lcmFsRGF0YVBvaW50cygpOiBMaXN0PERhdGFQb2ludD4ge1xuICAgICAgICAgICAgdmFsIG5vbk91dGxpZXJEYXRhUG9pbnRzID0gbXlEYXRhUG9pbnRzLmZpbHRlck5vdChEYXRhUG9pbnQ6OmlzT3V0bGllcilcbiAgICAgICAgICAgIHZhbCBvdXRsaWVycyA9IG91dGxpZXJEYXRhUG9pbnRzKCkubWFwTm90TnVsbChEYXRhUG9pbnQ6OmFlcylcbiAgICAgICAgICAgIHZhbCBnZW5lcmFsQWVzTGlzdCA9IG5vbk91dGxpZXJEYXRhUG9pbnRzLm1hcE5vdE51bGwoRGF0YVBvaW50OjphZXMpIC0gb3V0bGllcnNcbiAgICAgICAgICAgIHJldHVybiBub25PdXRsaWVyRGF0YVBvaW50cy5maWx0ZXIgeyBkYXRhUG9pbnQgLT5cbiAgICAgICAgICAgICAgICB3aGVuIChkYXRhUG9pbnQuYWVzKXtcbiAgICAgICAgICAgICAgICAgICAgbnVsbCAtPiB0cnVlICAgICAgICAgICAgICAgIC8vIGdldCBhbGwgbm90IGFlcyAodmFyaWFibGVzLCB0ZXh0KVxuICAgICAgICAgICAgICAgICAgICBpbiBnZW5lcmFsQWVzTGlzdCAtPiB0cnVlICAgLy8gZ2V0IGFsbCBleGlzdGVkIGluIHByZXBhcmVkIGFlcyBsaXN0IChtYXBwZWQgYWVzKVxuICAgICAgICAgICAgICAgICAgICBlbHNlIC0+IGZhbHNlICAgICAgICAgICAgICAgLy8gc2tpcCBvdGhlcnMgKGF4aXMpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gY3JlYXRlSGludEZvckF4aXMoYWVzOiBBZXM8Kj4pOiBUaXBMYXlvdXRIaW50IHtcbiAgICAgICAgICAgIHJldHVybiB3aGVuKGFlcykge1xuICAgICAgICAgICAgICAgICBBZXMuWCAtPiBUaXBMYXlvdXRIaW50LnhBeGlzVG9vbHRpcChcbiAgICAgICAgICAgICAgICAgICAgIGNvb3JkID0gRG91YmxlVmVjdG9yKHRpcExheW91dEhpbnQoKS5jb29yZCEhLngsIGF4aXNPcmlnaW4ueSksXG4gICAgICAgICAgICAgICAgICAgICBjb2xvciA9IEFYSVNfVE9PTFRJUF9DT0xPUixcbiAgICAgICAgICAgICAgICAgICAgIGF4aXNSYWRpdXMgPSBBWElTX1JBRElVU1xuICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgQWVzLlkgLT4gVGlwTGF5b3V0SGludC55QXhpc1Rvb2x0aXAoXG4gICAgICAgICAgICAgICAgICAgIGNvb3JkID0gRG91Ymxl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W9tVGFyZ2V0TG9jYXRvci5Mb29rdXBTcGVjLFxuICAgIHByaXZhdGUgdmFsIGNvbnRleHR1YWxNYXBwaW5nOiBDb250ZXh0dWFsTWFwcGluZyxcbiAgICBwcml2YXRlIHZhbCBjb29yZGluYXRlU3lzdGVtOiBDb29yZGluYXRlU3lzdGVtXG4pIDogR2VvbVRhcmdldENvbGxlY3RvciwgR2VvbVRhcmdldExvY2F0b3Ige1xuXG4gICAgcHJpdmF0ZSB2YWwgbXlUYXJnZXRzID0gQXJyYXlMaXN0PFRhcmdldFByb3RvdHlwZT4oKVxuICAgIHByaXZhdGUgdmFyIG15TG9jYXRvcjogR2VvbVRhcmdldExvY2F0b3I/ID0gbnVsbFxuXG4gICAgb3ZlcnJpZGUgZnVuIGFkZFBvaW50KFxuICAgICAgICBpbmRleDogSW50LFxuICAgICAgICBwb2ludDogRG91YmxlVmVjdG9yLFxuICAgICAgICByYWRpdXM6IERvdWJsZSxcbiAgICAgICAgdG9vbHRpcFBhcmFtczogR2VvbVRhcmdldENvbGxlY3Rvci5Ub29sdGlwUGFyYW1zLFxuICAgICAgICB0b29sdGlwS2luZDogVGlwTGF5b3V0SGludC5LaW5kXG4gICAgKSB7XG4gICAgICAgIGlmIChjb250ZXh0dWFsTWFwcGluZy5pZ25vcmVJbnZpc2libGVUYXJnZXRzKSB7XG4gICAgICAgICAgICBpZiAocmFkaXVzID09IDAuMCB8fCB0b29sdGlwUGFyYW1zLmdldENvbG9yKCkuYWxwaGEgPT0gMCkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoIWNvb3JkaW5hdGVTeXN0ZW0uaXNQb2ludEluTGltaXRzKHBvaW50KSkge1xuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cbiAgICAgICAgYWRkVGFyZ2V0KFxuICAgICAgICAgICAgVGFyZ2V0UHJvdG90eXBlKFxuICAgICAgICAgICAgICAgIEhpdFNoYXBlLnBvaW50KHBvaW50LCByYWRpdXMpLFxuICAgICAgICAgICAgICAgIHsgaW5kZXggfSxcbiAgICAgICAgICAgICAgICB0b29sdGlwUGFyYW1zLFxuICAgICAgICAgICAgICAgIHRvb2x0aXBLaW5kXG4gICAgICAgICAgICApXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gYWRkUmVjdGFuZ2xlKFxuICAgICAgICBpbmRleDogSW50LFxuICAgICAgICByZWN0YW5nbGU6IERvdWJsZVJlY3RhbmdsZSxcbiAgICAgICAgdG9vbHRpcFBhcmFtczogR2VvbVRhcmdldENvbGxlY3Rvci5Ub29sdGlwUGFyYW1zLFxuICAgICAgICB0b29sdGlwS2luZDogVGlwTGF5b3V0SGludC5LaW5kXG4gICAgKSB7XG4gICAgICAgIGlmIChjb250ZXh0dWFsTWFwcGluZy5pZ25vcmVJbnZpc2libGVUYXJnZXRzKSB7XG4gICAgICAgICAgICBpZiAocmVjdGFuZ2xlLndpZHRoID09IDAuMCB8fCByZWN0YW5nbGUuaGVpZ2h0ID09IDAuMCB8fCB0b29sdGlwUGFyYW1zLmdldENvbG9yKCkuYWxwaGEgPT0gMCkge1xuICAgICAgICAgICAgICAgIHJldHVyblxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICghY29vcmRpbmF0ZVN5c3RlbS5pc1JlY3RJbkxpbWl0cyhyZWN0YW5nbGUpKSB7XG4gICAgICAgICAgICByZXR1cm5cbiAgICAgICAgfVxuICAgICAgICBhZGRUYXJnZXQoXG4gICAgICAgICAgICBUYXJnZXRQcm90b3R5cGUoXG4gICAgICAgICAgICAgICAgSGl0U2hhcGUucmVjdChyZWN0YW5nbGUpLFxuICAgICAgICAgICAgICAgIHsgaW5kZXggfSxcbiAgICAgICAgICAgICAgICB0b29sdGlwUGFyYW1zLFxuICAgICAgICAgICAgICAgIHRvb2x0aXBLaW5kXG4gICAgICAgICAgICApXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gYWRkUGF0aChcbiAgICAgICAgcG9pbnRzOiBMaXN0PERvdWJsZVZlY3Rvcj4sXG4gICAgICAgIGxvY2FsVG9HbG9iYWxJbmRleDogKEludCkgLT4gSW50LFxuICAgICAgICB0b29sdGlwUGFyYW1zOiBHZW9tVGFyZ2V0Q29sbGVjdG9yLlRvb2x0aXBQYXJhbXMsXG4gICAgICAgIHRvb2x0aXBLaW5kOiBUaXBMYXlvdXRIaW50LktpbmRcbiAgICApIHtcbiAgICAgICAgaWYgKCFjb29yZGluYXRlU3lzdGVtLmlzUGF0aEluTGltaXRzKHBvaW50cykpIHtcbiAgICAgICAgICAgIHJldHVyblxuICAgICAgICB9XG4gICAgICAgIGFkZFRhcmdldChcbiAgICAgICAgICAgIFRhcmdldFByb3RvdHlwZShcbiAgICAgICAgICAgICAgICBIaXRTaGFwZS5wYXRoKHBvaW50cyksXG4gICAgICAgICAgICAgICAgbG9jYWxUb0dsb2JhbEluZGV4LFxuICAgICAgICAgICAgICAgIHRvb2x0aXBQYXJhbXMsXG4gICAgICAgICAgICAgICAgdG9vbHRpcEtpbmRcbiAgICAgICAgICAgIClcbiAgICAgICAgKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBhZGRQb2x5Z29uKFxuICAgICAgICBwb2ludHM6IExpc3Q8RG91YmxlVmVjdG9yPixcbiAgICAgICAgbG9jYWxUb0dsb2JhbEluZGV4OiAoSW50KSAtPiBJbnQsXG4gICAgICAgIHRvb2x0aXBQYXJhbXM6IEdlb21UYXJnZXRDb2xsZWN0b3IuVG9vbHRpcFBhcmFtcyxcbiAgICAgICAgdG9vbHRpcEtpbmQ6IFRpcExheW91dEhpbnQuS2luZFxuICAgICkge1xuICAgICAgICBpZiAoIWNvb3JkaW5hdGVTeXN0ZW0uaXNQb2x5Z29uSW5MaW1pdHMocG9pbnRzKSkge1xuICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cbiAgICAgICAgYWRkVGFyZ2V0KFxuICAgICAgICAgICAgVGFyZ2V0UHJvdG90eXBlKFxuICAgICAgICAgICAgICAgIEhpdFNoYXBlLnBvbHlnb24ocG9pbnRzKSxcbiAgICAgICAgICAgICAgICBsb2NhbFRvR2xvYmFsSW5kZXgsXG4gICAgICAgICAgICAgICAgdG9vbHRpcFBhcmFtcyxcbiAgICAgICAgICAgICAgICB0b29sdGlwS2luZFxuICAgICAgICAgICAgKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gYWRkVGFyZ2V0KHRhcmdldFByb3RvdHlwZTogVGFyZ2V0UHJvdG90eXBlKSB7XG4gICAgICAgIG15VGFyZ2V0cy5hZGQodGFyZ2V0UHJvdG90eXBlKVxuICAgICAgICBteUxvY2F0b3IgPSBudWxsXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIHNlYXJjaChjb29yZDogRG91YmxlVmVjdG9yKTogR2VvbVRhcmdldExvY2F0b3IuTG9va3VwUmVzdWx0PyB7XG4gICAgICAgIGlmIChteUxvY2F0b3IgPT0gbnVsbCkge1xuICAgICAgICAgICAgbXlMb2NhdG9yID0gTGF5ZXJUYXJnZXRMb2NhdG9yKFxuICAgICAgICAgICAgICAgIGdlb21LaW5kLFxuICAgICAgICAgICAgICAgIGxvb2t1cFNwZWMsXG4gICAgICAgICAgICAgICAgY29udGV4dHVhbE1hcHBpbmcsXG4gICAgICAgICAgICAgICAgbXlUYXJnZXRzXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG15TG9jYXRvciEhLnNlYXJjaChjb29yZClcbiAgICB9XG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LiBKZXRCcmFpbnMgcy5yLm8uXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgTUlUIGxpY2Vuc2UgdGhhdCBjYW4gYmUgZm91bmQgaW4gdGhlIExJQ0VOU0UgZml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AgICAgICByZXR1cm4gd2hlbiAocHJvdG90eXBlLmhpdFNoYXBlLmtpbmQpIHtcbiAgICAgICAgICAgICAgICBQT0lOVCAtPiBQb2ludFRhcmdldFByb2plY3Rpb24uY3JlYXRlKFxuICAgICAgICAgICAgICAgICAgICBwcm90b3R5cGUuaGl0U2hhcGUucG9pbnQuY2VudGVyLFxuICAgICAgICAgICAgICAgICAgICBsb29rdXBTcGVjLmxvb2t1cFNwYWNlXG4gICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICAgICAgUkVDVCAtPiBSZWN0VGFyZ2V0UHJvamVjdGlvbi5jcmVhdGUoXG4gICAgICAgICAgICAgICAgICAgIHByb3RvdHlwZS5oaXRTaGFwZS5yZWN0LFxuICAgICAgICAgICAgICAgICAgICBsb29rdXBTcGVjLmxvb2t1cFNwYWNlXG4gICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICAgICAgUE9MWUdPTiAtPiBQb2x5Z29uVGFyZ2V0UHJvamVjdGlvbi5jcmVhdGUoXG4gICAgICAgICAgICAgICAgICAgIHByb3RvdHlwZS5oaXRTaGFwZS5wb2ludHMsXG4gICAgICAgICAgICAgICAgICAgIGxvb2t1cFNwZWMubG9va3VwU3BhY2VcbiAgICAgICAgICAgICAgICApXG5cbiAgICAgICAgICAgICAgICBQQVRIIC0+IFBhdGhUYXJnZXRQcm9qZWN0aW9uLmNyZWF0ZShcbiAgICAgICAgICAgICAgICAgICAgcHJvdG90eXBlLmhpdFNoYXBlLnBvaW50cyxcbiAgICAgICAgICAgICAgICAgICAgcHJvdG90eXBlLmluZGV4TWFwcGVyLFxuICAgICAgICAgICAgICAgICAgICBsb29rdXBTcGVjLmxvb2t1cFNwYWNlXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZm9yIChwcm90b3R5cGUgaW4gdGFyZ2V0UHJvdG90eXBlcykge1xuICAgICAgICAgICAgbXlUYXJnZXRzLmFkZChcbiAgICAgICAgICAgICAgICBUYXJnZXQoXG4gICAgICAgICAgICAgICAgICAgIHRvUHJvamVjdGlvbihwcm90b3R5cGUpLFxuICAgICAgICAgICAgICAgICAgICBwcm90b3R5cGVcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBhZGRMb29rdXBSZXN1bHRzKFxuICAgICAgICBjb2xsZWN0b3I6IENvbGxlY3RvcjxHZW9tVGFyZ2V0PixcbiAgICAgICAgdGFyZ2V0czogTXV0YWJsZUxpc3Q8R2VvbVRhcmdldExvY2F0b3IuTG9va3VwUmVzdWx0PlxuICAgICkge1xuICAgICAgICBpZiAoY29sbGVjdG9yLnNpemUoKSA9PSAwKSB7XG4gICAgICAgICAgICByZXR1cm5cbiAgICAgICAgfVxuXG4gICAgICAgIHRhcmdldHMuYWRkKFxuICAgICAgICAgICAgR2VvbVRhcmdldExvY2F0b3IuTG9va3VwUmVzdWx0KFxuICAgICAgICAgICAgICAgIGNvbGxlY3Rvci5jb2xsZWN0aW9uKCksXG4gICAgICAgICAgICAgICAgLy8gRGlzdGFuY2UgY2FuIGJlIG5lZ2F0aXZlIHdoZW4gbG9va3VwIHNwYWNlIGlzIFhcbiAgICAgICAgICAgICAgICAvLyBJbiB0aGlzIGNhc2UgdXNlIDAuMCBhcyBhIGRpc3RhbmNlIC0gd2UgaGF2ZSBhIGRpcmVjdCBoaXQuXG4gICAgICAgICAgICAgICAgbWF4KDAuMCwgY29sbGVjdG9yLmNsb3Nlc3RQb2ludENoZWNrZXIuZGlzdGFuY2UpLFxuICAgICAgICAgICAgICAgIGdlb21LaW5kLFxuICAgICAgICAgICAgICAgIGNvbnRleHR1YWxNYXBwaW5nLFxuICAgICAgICAgICAgICAgIGNvbnRleHR1YWxNYXBwaW5nLmlzQ3Jvc3NoYWlyRW5hYmxlZFxuICAgICAgICAgICAgKVxuICAgICAgICApXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIHNlYXJjaChjb29yZDogRG91YmxlVmVjdG9yKTogR2VvbVRhcmdldExvY2F0b3IuTG9va3VwUmVzdWx0PyB7XG4gICAgICAgIGlmIChteVRhcmdldHMuaXNFbXB0eSgpKSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbFxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHJlY3RDb2xsZWN0b3IgPSBDb2xsZWN0b3I8R2VvbVRhcmdldD4oXG4gICAgICAgICAgICBjb29yZCxcbiAgICAgICAgICAgIG15Q29sbGVjdGluZ1N0cmF0ZWd5LFxuICAgICAgICAgICAgbG9va3VwU3BlYy5sb29rdXBTcGFjZVxuICAgICAgICApXG4gICAgICAgIHZhbCBwb2ludENvbGxlY3RvciA9IENvbGxlY3RvcjxHZW9tVGFyZ2V0PihcbiAgICAgICAgICAgIGNvb3JkLFxuICAgICAgICAgICAgbXlDb2xsZWN0aW5nU3RyYXRlZ3ksXG4gICAgICAgICAgICBsb29rdXBTcGVjLmxvb2t1cFNwYWNlXG4gICAgICAgIClcbiAgICAgICAgdmFsIHBhdGhDb2xsZWN0b3IgPSBDb2xsZWN0b3I8R2VvbVRhcmdldD4oXG4gICAgICAgICAgICBjb29yZCxcbiAgICAgICAgICAgIG15Q29sbGVjdGluZ1N0cmF0ZWd5LFxuICAgICAgICAgICAgbG9va3VwU3BlYy5sb29rdXBTcGFjZVxuICAgICAgICApXG5cbiAgICAgICAgLy8gU2hvdWxkIGFsd2F5cyByZXBsYWNlIGJlY2F1c2Ugb2YgcG9seWdvbiB3aXRoIGhvbGVzIC0gb25seSB0b3Agc2hvdWxkIGhhdmUgdG9vbHRpcC5cbiAgICAgICAgdmFsIHBvbHlnb25Db2xsZWN0b3IgPSBDb2xsZWN0b3I8R2VvbVRhcmdldD4oXG4gICAgICAgICAgICBjb29yZCxcbiAgICAgICAgICAgIENvbGxlY3Rvci5Db2xsZWN0aW5nU3RyYXRlZ3kuUkVQTEFDRSxcbiAgICAgICAgICAgIG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YXJnZXQucHJvdG90eXBlLnRvb2x0aXBLaW5kKSB7XG4gICAgICAgICAgICAgICAgQ1VSU09SX1RPT0xUSVAgLT4gcmVjdC5oZWlnaHQgLyAyLjBcbiAgICAgICAgICAgICAgICBlbHNlIC0+IDAuMFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXN1bHRDb2xsZWN0b3IuY29sbGVjdChcbiAgICAgICAgICAgICAgICB0YXJnZXQucHJvdG90eXBlLmNyZWF0ZUdlb21UYXJnZXQoXG4gICAgICAgICAgICAgICAgICAgIHJlY3Qub3JpZ2luLmFkZChEb3VibGVWZWN0b3IocmVjdC53aWR0aCAvIDIsIHlPZmZzZXQpKSxcbiAgICAgICAgICAgICAgICAgICAgZ2V0S2V5Rm9yU2luZ2xlT2JqZWN0R2VvbWV0cnkodGFyZ2V0LnByb3RvdHlwZSlcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBwcm9jZXNzUG9seWdvbihjb29yZDogRG91YmxlVmVjdG9yLCB0YXJnZXQ6IFRhcmdldCwgcmVzdWx0Q29sbGVjdG9yOiBDb2xsZWN0b3I8R2VvbVRhcmdldD4pIHtcbiAgICAgICAgaWYgKG15VGFyZ2V0RGV0ZWN0b3IuY2hlY2tQb2x5Z29uKGNvb3JkLCB0YXJnZXQucG9seWdvblByb2plY3Rpb24sIHJlc3VsdENvbGxlY3Rvci5jbG9zZXN0UG9pbnRDaGVja2VyKSkge1xuXG4gICAgICAgICAgICByZXN1bHRDb2xsZWN0b3IuY29sbGVjdChcbiAgICAgICAgICAgICAgICB0YXJnZXQucHJvdG90eXBlLmNyZWF0ZUdlb21UYXJnZXQoXG4gICAgICAgICAgICAgICAgICAgIGNvb3JkLFxuICAgICAgICAgICAgICAgICAgICBnZXRLZXlGb3JTaW5nbGVPYmplY3RHZW9tZXRyeSh0YXJnZXQucHJvdG90eXBlKVxuICAgICAgICAgICAgICA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90b3R5cGUpIHtcblxuICAgICAgICB2YWwgcG9pbnRQcm9qZWN0aW9uOiBQb2ludFRhcmdldFByb2plY3Rpb25cbiAgICAgICAgICAgIGdldCgpID0gdGFyZ2V0UHJvamVjdGlvbiBhcyBQb2ludFRhcmdldFByb2plY3Rpb25cblxuICAgICAgICB2YWwgcmVjdFByb2plY3Rpb246IFJlY3RUYXJnZXRQcm9qZWN0aW9uXG4gICAgICAgICAgICBnZXQoKSA9IHRhcmdldFByb2plY3Rpb24gYXMgUmVjdFRhcmdldFByb2plY3Rpb25cblxuICAgICAgICB2YWwgcG9seWdvblByb2plY3Rpb246IFBvbHlnb25UYXJnZXRQcm9qZWN0aW9uXG4gICAgICAgICAgICBnZXQoKSA9IHRhcmdldFByb2plY3Rpb24gYXMgUG9seWdvblRhcmdldFByb2plY3Rpb25cblxuICAgICAgICB2YWwgcGF0aFByb2plY3Rpb246IFBhdGhUYXJnZXRQcm9qZWN0aW9uXG4gICAgICAgICAgICBnZXQoKSA9IHRhcmdldFByb2plY3Rpb24gYXMgUGF0aFRhcmdldFByb2plY3Rpb25cbiAgICB9XG5cbiAgICBpbnRlcm5hbCBjbGFzcyBDb2xsZWN0b3I8VD4oXG4gICAgICAgIGN1cnNvcjogRG91YmxlVmVjdG9yLFxuICAgICAgICBwcml2YXRlIHZhbCBteVN0cmF0ZWd5OiBDb2xsZWN0aW5nU3RyYXRlZ3ksXG4gICAgICAgIGxvb2t1cFNwYWNlOiBHZW9tVGFyZ2V0TG9jYXRvci5Mb29rdXBTcGFjZVxuICAgICkge1xuICAgICAgICBwcml2YXRlIHZhbCByZXN1bHQgPSBBcnJheUxpc3Q8VD4oKVxuICAgICAgICB2YWwgY2xvc2VzdFBvaW50Q2hlY2tlcjogQ2xvc2VzdFBvaW50Q2hlY2tlciA9IGlmIChsb29rdXBTcGFjZSA9PSBHZW9tVGFyZ2V0TG9jYXRvci5Mb29rdXBTcGFjZS5YKSB7XG4gICAgICAgICAgICBDbG9zZXN0UG9pbnRDaGVja2VyKERvdWJsZVZlY3RvcihjdXJzb3IueCwgMC4wKSlcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIENsb3Nlc3RQb2ludENoZWNrZXIoY3Vyc29yKVxuICAgICAgICB9XG4gICAgICAgIHByaXZhdGUgdmFyIG15TGFzdEFkZGVkRGlzdGFuY2U6IERvdWJsZSA9IC0xLjBcblxuICAgICAgICBmdW4gY29sbGVjdChkYXRhOiBUKSB7XG4gICAgICAgICAgICB3aGVuIChteVN0cmF0ZWd5KSB7XG4gICAgICAgICAgICAgICAgQ29sbGVjdGluZ1N0cmF0ZWd5LkFQUEVORCAtPiBhZGQoZGF0YSlcbiAgICAgICAgICAgICAgICBDb2xsZWN0aW5nU3RyYXRlZ3kuUkVQTEFDRSAtPiByZXBsYWNlKGRhdGEpXG4gICAgICAgICAgICAgICAgQ29sbGVjdGluZ1N0cmF0ZWd5LkFQUEVORF9JRl9FUVVBTCAtPiB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChteUxhc3RBZGRlZERpc3RhbmNlID09IGNsb3Nlc3RQb2ludENoZWNrZXIuZGlzdGFuY2UpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGFkZChkYXRhKVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVwbGFjZShkYXRhKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIENvbGxlY3RpbmdTdHJhdGVneS5JR05PUkUgLT4gcmV0dXJuXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW4gY29sbGVjdGlvbigpOiBMaXN0PFQ+IHtcbiAgICAgICAgICAgIHJldHVybiByZXN1bHRcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBzaXplKCk6IEludCB7XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0LnNpemVcbiAgICAgICAgfVxuXG4gICAgICAg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YWwgY29uc3QgdmFsIENVVE9GRl9ESVNUQU5DRSA9IDMwLjBcbiAgICAgICAgaW50ZXJuYWwgY29uc3QgdmFsIEZBS0VfRElTVEFOQ0UgPSAxNS4wXG4gICAgICAgIHByaXZhdGUgdmFsIFVOSVZBUklBVEVfR0VPTVMgPSBsaXN0T2YoXG4gICAgICAgICAgICBHZW9tS2luZC5ERU5TSVRZLFxuICAgICAgICAgICAgR2VvbUtpbmQuRlJFUVBPTFksXG4gICAgICAgICAgICBHZW9tS2luZC5CT1hfUExPVCxcbiAgICAgICAgICAgIEdlb21LaW5kLkhJU1RPR1JBTSxcbiAgICAgICAgICAgIEdlb21LaW5kLkxJTkUsXG4gICAgICAgICAgICBHZW9tS2luZC5BUkVBLFxuICAgICAgICAgICAgR2VvbUtpbmQuQkFSLFxuICAgICAgICAgICAgR2VvbUtpbmQuRVJST1JfQkFSLFxuICAgICAgICAgICAgR2VvbUtpbmQuQ1JPU1NfQkFSLFxuICAgICAgICAgICAgR2VvbUtpbmQuTElORV9SQU5HRSxcbiAgICAgICAgICAgIEdlb21LaW5kLlBPSU5UX1JBTkdFXG4gICAgICAgIClcblxuICAgICAgICBwcml2YXRlIHZhbCBVTklWQVJJQVRFX0xJTkVTID0gbGlzdE9mKFxuICAgICAgICAgICAgR2VvbUtpbmQuREVOU0lUWSxcbiAgICAgICAgICAgIEdlb21LaW5kLkZSRVFQT0xZLFxuICAgICAgICAgICAgR2VvbUtpbmQuTElORSxcbiAgICAgICAgICAgIEdlb21LaW5kLkFSRUEsXG4gICAgICAgICAgICBHZW9tS2luZC5TRUdNRU5UXG4gICAgICAgIClcblxuICAgICAgICBwcml2YXRlIGZ1biBkaXN0YW5jZShsb2NhdGVkVGFyZ2V0TGlzdDogTG9va3VwUmVzdWx0LCBjb29yZDogRG91YmxlVmVjdG9yPyk6IERvdWJsZSB7XG4gICAgICAgICAgICB2YWwgZGlzdGFuY2UgPSBsb2NhdGVkVGFyZ2V0TGlzdC5kaXN0YW5jZVxuICAgICAgICAgICAgLy8gU3BlY2lhbCBjYXNlIGZvciBnZW9tcyBsaWtlIGhpc3RvZ3JhbSwgd2hlbiBtb3VzZSBpbnNpZGUgYSByZWN0IG9yIG9ubHkgWCBwcm9qZWN0aW9uIGlzIHVzZWQgKHNvIGEgZGlzdGFuY2VcbiAgICAgICAgICAgIC8vIGJldHdlZW4gY3Vyc29yIGlzIHplcm8pLiBGYWtlIHRoZSBkaXN0YW5jZSB0byBnaXZlIGEgY2hhbmNlIGZvciB0b29sdGlwcyBmcm9tIG90aGVyIGxheWVycy5cbiAgICAgICAgICAgIHJldHVybiBpZiAoZGlzdGFuY2UgPT0gMC4wKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFsb2NhdGVkVGFyZ2V0TGlzdC5pc0Nyb3NzaGFpckVuYWJsZWQgfHwgY29vcmQgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBGQUtFX0RJU1RBTkNFXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gdXNlIFhZIGRpc3RhbmNlIGZvciB0b29sdGlwcyB3aXRoIGNyb3NzaGFpciB0byBhdm9pZCBnaXZpbmcgdGhlbSBwcmlvcml0eVxuICAgICAgICAgICAgICAgICAgICBsb2NhdGVkVGFyZ2V0TGlzdC50YXJnZXRzXG4gICAgICAgICAgICAgICAgICAgICAgICAuZmlsdGVyIHsgaXQudGlwTGF5b3V0SGludC5jb29yZCAhPSBudWxsIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIC5tYXAgeyB0YXJnZXQgLT4gTWF0aFV0aWwuZGlzdGFuY2UoY29vcmQsIHRhcmdldC50aXBMYXlvdXRIaW50LmNvb3JkISEpIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIC5taW5Pck51bGwoKVxuICAgICAgICAgICAgICAgICAgICAgICAgPzogRkFLRV9ESVNUQU5DRVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgZGlzdGFuY2VcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGlzU2FtZVVuaXZhcmlhdGVHZW9tKGxmdDogTG9va3VwUmVzdWx0LCByZ3Q6IExvb2t1cFJlc3VsdCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgcmV0dXJuIGxmdC5nZW9tS2luZCA9PT0gcmd0Lmdlb21LaW5kICYmIFVOSVZBUklBVEVfR0VPTVMuY29udGFpbnMocmd0Lmdlb21LaW5kKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZmlsdGVyUmVzdWx0cyhsb29rdXBSZXN1bHQ6IExvb2t1cFJlc3VsdCwgY29vcmQ6IERvdWJsZVZlY3Rvcj8pOiBMb29rdXBSZXN1bHQge1xuICAgICAgICAgICAgaWYgKGNvb3JkID09IG51bGwgfHwgbG9va3VwUmVzdWx0Lmdlb21LaW5kICFpbiBVTklWQVJJQVRFX0xJTkVTKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGxvb2t1cFJlc3VsdFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBHZXQgY2xvc2VzdCB0YXJnZXRzIGFuZCByZW1vdmUgZHVwbGljYXRlc1xuICAgICAgICAgICAgdmFsIGdlb21UYXJnZXRzID0gbG9va3VwUmVzdWx0LnRhcmdldHMuZmlsdGVyIHsgaXQudGlwTGF5b3V0SGludC5jb29yZCAhPSBudWxsIH1cblxuICAgICAgICAgICAgdmFsIG1pblhUb1RhcmdldCA9IGdlb21UYXJnZXRzXG4gICAgICAgICAgICAgICAgLm1hcCB7IHRhcmdldCAtPiB0YXJnZXQudGlwTGF5b3V0SGludC5jb29yZCEhLnN1YnRyYWN0KGNvb3JkKS54IH1cbiAgICAgICAgICAgICAgICAubWluQnlPck51bGwgeyBhYnMoaXQpIH1cblxuICAgICAgICAgICAgdmFsIG5ld1RhcmdldHMgPSBnZW9tVGF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cblxuICAgICAgICB3aGVuIChsb2NhdG9yTG9va3VwU3BhY2UpIHtcblxuICAgICAgICAgICAgTG9va3VwU3BhY2UuWCAtPiB7XG4gICAgICAgICAgICAgICAgaWYgKGxvY2F0b3JMb29rdXBTdHJhdGVneSA9PT0gTG9va3VwU3RyYXRlZ3kuTk9ORSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbFxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHZhbCBwYXRoUG9pbnRzID0gcGF0aFByb2plY3Rpb24ucG9pbnRzXG4gICAgICAgICAgICAgICAgaWYgKHBhdGhQb2ludHMuaXNFbXB0eSgpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdmFsIHJlc3VsdEluZGV4ID0gYmluYXJ5U2VhcmNoKFxuICAgICAgICAgICAgICAgICAgICBjdXJzb3JDb29yZC54LFxuICAgICAgICAgICAgICAgICAgICBwYXRoUG9pbnRzLnNpemVcbiAgICAgICAgICAgICAgICApIHsgaW5kZXggLT5cbiAgICAgICAgICAgICAgICAgICAgcGF0aFBvaW50c1tpbmRleF0ucHJvamVjdGlvbigpLngoKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB2YWwgYmVzdFBvaW50ID0gcGF0aFBvaW50c1tyZXN1bHRJbmRleF1cblxuICAgICAgICAgICAgICAgIHJldHVybiB3aGVuIChsb2NhdG9yTG9va3VwU3RyYXRlZ3kpIHtcbiAgICAgICAgICAgICAgICAgICAgTG9va3VwU3RyYXRlZ3kuSE9WRVIgLT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGN1cnNvckNvb3JkLnggPCBwYXRoUG9pbnRzWzBdLnByb2plY3Rpb24oKS54KCkgfHwgY3Vyc29yQ29vcmQueCA+IHBhdGhQb2ludHNbcGF0aFBvaW50cy5zaXplIC0gMV0ucHJvamVjdGlvbigpLngoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBiZXN0UG9pbnRcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIExvb2t1cFN0cmF0ZWd5Lk5FQVJFU1QgLT4gYmVzdFBvaW50XG5cbiAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiB0aHJvdyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oXCJVbmtub3duIGxvb2t1cCBzdHJhdGVneTogJGxvY2F0b3JMb29rdXBTdHJhdGVneVwiKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgTG9va3VwU3BhY2UuWFkgLT4ge1xuICAgICAgICAgICAgICAgIHdoZW4gKGxvY2F0b3JMb29rdXBTdHJhdGVneSkge1xuXG4gICAgICAgICAgICAgICAgICAgIExvb2t1cFN0cmF0ZWd5LkhPVkVSIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocGF0aFBvaW50IGluIHBhdGhQcm9qZWN0aW9uLnBvaW50cykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbCB0YXJnZXRQb2ludENvb3JkID0gcGF0aFBvaW50LnByb2plY3Rpb24oKS54eSgpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE1hdGhVdGlsLmFyZUVxdWFsKHRhcmdldFBvaW50Q29vcmQsIGN1cnNvckNvb3JkLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUE9JTlRfQVJFQV9FUFNJTE9OXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhdGhQb2ludFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBMb29rdXBTdHJhdGVneS5ORUFSRVNUIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuZWFyZXN0UG9pbnQ6IFBhdGhQb2ludD8gPSBudWxsXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHBhdGhQb2ludCBpbiBwYXRoUHJvamVjdGlvbi5wb2ludHMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWwgdGFyZ2V0UG9pbnRDb29yZCA9IHBhdGhQb2ludC5wcm9qZWN0aW9uKCkueHkoKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjbG9zZXN0UG9pbnRDaGVja2VyLmNoZWNrKHRhcmdldFBvaW50Q29vcmQpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5lYXJlc3RQb2ludCA9IHBhdGhQb2ludFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZWFyZXN0UG9pbnRcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIExvb2t1cFN0cmF0ZWd5Lk5PTkUgLT4gcmV0dXJuIG51bGxcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIExvb2t1cFNwYWNlLk5PTkUgLT4gcmV0dXJuIG51bGxcblxuICAgICAgICAgICAgZWxzZSAtPiB0aHJvdyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuIGNoZWNrUG9pbnQoY3Vyc29yQ29vcmQ6IERvdWJsZVZlY3RvciwgcG9pbnRQcm9qZWN0aW9uOiBQb2ludFRhcmdldFByb2plY3Rpb24sIGNsb3Nlc3RQb2ludENoZWNrZXI6IENsb3Nlc3RQb2ludENoZWNrZXIpOiBCb29sZWFuIHtcbiAgICAgICAgd2hlbiAobG9jYXRvckxvb2t1cFNwYWNlKSB7XG5cbiAgICAgICAgICAgIExvb2t1cFNwYWNlLlggLT4ge1xuICAgICAgICAgICAgICAgIHZhbCB4ID0gcG9pbnRQcm9qZWN0aW9uLngoKVxuICAgICAgICAgICAgICAgIHJldHVybiB3aGVuIChsb2NhdG9yTG9va3VwU3RyYXRlZ3kpIHtcbiAgICAgICAgICAgICAgICAgICAgTG9va3VwU3RyYXRlZ3kuSE9WRVIgLT4gTWF0aFV0aWwuYXJlRXF1YWwoeCwgY3Vyc29yQ29vcmQueCxcbiAgICAgICAgICAgICAgICAgICAgICAgIFBPSU5UX0FSRUFfRVBTSUxPTlxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgIExvb2t1cFN0cmF0ZWd5Lk5FQVJFU1QgLT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xvc2VzdFBvaW50Q2hlY2tlci5jaGVjayhEb3VibGVWZWN0b3IoeCwgMC4wKSlcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBMb29rdXBTdHJhdGVneS5OT05FIC0+IGZhbHNlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBMb29rdXBTcGFjZS5YWSAtPiB7XG4gICAgICAgICAgICAgICAgdmFsIHRhcmdldFBvaW50Q29vcmQgPSBwb2ludFByb2plY3Rpb24ueHkoKVxuICAgICAgICAgICAgICAgIHJldHVybiB3aGVuIChsb2NhdG9yTG9va3VwU3RyYXRlZ3kpIHtcbiAgICAgICAgICAgICAgICAgICAgTG9va3VwU3RyYXRlZ3kuSE9WRVIgLT4gTWF0aFV0aWwuYXJlRXF1YWwodGFyZ2V0UG9pbnRDb29yZCwgY3Vyc29yQ29vcmQsIFBPSU5UX0FSRUFfRVBTSUxPTilcbiAgIC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jdXJzb3JDb29yZClcblxuICAgICAgICAgICAgICAgICAgICBMb29rdXBTdHJhdGVneS5ORUFSRVNUIC0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZWN0LmNvbnRhaW5zKGN1cnNvckNvb3JkKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjbG9zZXN0UG9pbnRDaGVja2VyLmNoZWNrKGN1cnNvckNvb3JkKVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgeCA9IGlmIChjdXJzb3JDb29yZC54IDwgcmVjdC5sZWZ0KSByZWN0LmxlZnQgZWxzZSByZWN0LnJpZ2h0XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IGlmIChjdXJzb3JDb29yZC55IDwgcmVjdC50b3ApIHJlY3QudG9wIGVsc2UgcmVjdC5ib3R0b21cblxuICAgICAgICAgICAgICAgICAgICAgICAgeCA9IGlmIChyZWN0LnhSYW5nZSgpLmNvbnRhaW5zKGN1cnNvckNvb3JkLngpKSBjdXJzb3JDb29yZC54IGVsc2UgeFxuICAgICAgICAgICAgICAgICAgICAgICAgeSA9IGlmIChyZWN0LnlSYW5nZSgpLmNvbnRhaW5zKGN1cnNvckNvb3JkLnkpKSBjdXJzb3JDb29yZC55IGVsc2UgeVxuXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2xvc2VzdFBvaW50Q2hlY2tlci5jaGVjayhEb3VibGVWZWN0b3IoeCwgeSkpXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBMb29rdXBTdHJhdGVneS5OT05FIC0+IHJldHVybiBmYWxzZVxuXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIExvb2t1cFNwYWNl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AwXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHJpbmcgaW4gcG9seWdvbikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyaW5nLmJib3guY29udGFpbnMoY3Vyc29yQ29vcmQpICYmIE1hdGhVdGlsLnBvbHlnb25Db250YWluc0Nvb3JkaW5hdGUocmluZy5lZGdlcywgY3Vyc29yQ29vcmQpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvdW50ZXIrK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb3VudGVyICUgMiAhPSAwXG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBMb29rdXBTdHJhdGVneS5OT05FIC0+IHJldHVybiBmYWxzZVxuXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIExvb2t1cFNwYWNlLk5PTkUgLT4gcmV0dXJuIGZhbHNlXG5cbiAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHJhbmdlQmFzZWRMb29rdXAoY3Vyc29yQ29vcmQ6IERvdWJsZVZlY3RvciwgY2xvc2VzdFBvaW50Q2hlY2tlcjogQ2xvc2VzdFBvaW50Q2hlY2tlciwgcmFuZ2U6IERvdWJsZVJhbmdlKTogQm9vbGVhbiB7XG4gICAgICAgIHdoZW4gKGxvY2F0b3JMb29rdXBTdHJhdGVneSkge1xuXG4gICAgICAgICAgICBMb29rdXBTdHJhdGVneS5IT1ZFUiAtPiByZXR1cm4gcmFuZ2UuY29udGFpbnMoY3V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gICAgICBpZiAodmFsdWUgPCBpbmRleGVyKDApKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIDBcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh2YWx1ZSA+IGluZGV4ZXIobGVuZ3RoIC0gMSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbGVuZ3RoIC0gMVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgbG8gPSAwXG4gICAgICAgICAgICB2YXIgaGkgPSBsZW5ndGggLSAxXG5cbiAgICAgICAgICAgIHdoaWxlIChsbyA8PSBoaSkge1xuICAgICAgICAgICAgICAgIHZhbCBtaWQgPSAoaGkgKyBsbykgLyAyXG4gICAgICAgICAgICAgICAgdmFsIG1pZFZhbHVlID0gaW5kZXhlcihtaWQpXG5cbiAgICAgICAgICAgICAgICB3aGVuIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsdWUgPCBtaWRWYWx1ZSAtPiBoaSA9IG1pZCAtIDFcbiAgICAgICAgICAgICAgICAgICAgdmFsdWUgPiBtaWRWYWx1ZSAtPiBsbyA9IG1pZCArIDFcbiAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiByZXR1cm4gbWlkXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gaWYgKGluZGV4ZXIobG8pIC0gdmFsdWUgPCB2YWx1ZSAtIGluZGV4ZXIoaGkpKSB7XG4gICAgICAgICAgICAgICAgbG9cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaGlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGNhbiBiZSBmb3VuZCB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Q0VfUkFUSU8gPSAwLjFcbiAgICAgICAgcHJpdmF0ZSBjb25zdCB2YWwgTUFYX1RPTEVSQU5DRSA9IDQwLjBcblxuICAgICAgICBmdW4gY3JlYXRlKHBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+LCBsb29rdXBTcGFjZTogTG9va3VwU3BhY2UpOiBQb2x5Z29uVGFyZ2V0UHJvamVjdGlvbiB7XG4gICAgICAgICAgICB2YWwgcmluZ3MgPSBzcGxpdFJpbmdzKHBvaW50cylcblxuICAgICAgICAgICAgcmV0dXJuIHdoZW4gKGxvb2t1cFNwYWNlKSB7XG4gICAgICAgICAgICAgICAgWCAtPiBQb2x5Z29uVGFyZ2V0UHJvamVjdGlvbihtYXBUb1gocmluZ3MpKVxuICAgICAgICAgICAgICAgIFhZIC0+IFBvbHlnb25UYXJnZXRQcm9qZWN0aW9uKG1hcFRvWFkocmluZ3MpKVxuICAgICAgICAgICAgICAgIE5PTkUgLT4gdW5kZWZpbmVkTG9va3VwU3BhY2VFcnJvcigpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBtYXBUb1gocmluZ3M6IExpc3Q8TGlzdDxEb3VibGVWZWN0b3I+Pik6IERvdWJsZVJhbmdlIHtcbiAgICAgICAgICAgIHZhciBtaW4gPSByaW5nc1swXVswXS54XG4gICAgICAgICAgICB2YXIgbWF4ID0gbWluXG4gICAgICAgICAgICBmb3IgKHJpbmcgaW4gcmluZ3MpIHtcbiAgICAgICAgICAgICAgICBmb3IgKHBvaW50IGluIHJpbmcpIHtcbiAgICAgICAgICAgICAgICAgICAgbWluID0gbWluKG1pbiwgcG9pbnQueClcbiAgICAgICAgICAgICAgICAgICAgbWF4ID0gbWF4KG1heCwgcG9pbnQueClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gRG91YmxlUmFuZ2Uud2l0aFN0YXJ0QW5kRW5kKG1pbiwgbWF4KVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gbWFwVG9YWShyaW5nczogTGlzdDxMaXN0PERvdWJsZVZlY3Rvcj4+KTogTGlzdDxSaW5nWFk+IHtcbiAgICAgICAgICAgIHZhbCBwb2x5Z29uID0gQXJyYXlMaXN0PFJpbmdYWT4oKVxuXG4gICAgICAgICAgICBmb3IgKHJpbmcgaW4gcmluZ3MpIHtcbiAgICAgICAgICAgICAgICBpZiAocmluZy5zaXplIDwgNCkge1xuICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgICAgIH1cblxuXG4gICAgICAgICAgICAgICAgdmFsIGJib3ggPSBib3VuZGluZ0JveChyaW5nKVxuICAgICAgICAgICAgICAgIHZhbCBhcmVhID0gY2FsY3VsYXRlQXJlYShyaW5nKVxuXG4gICAgICAgICAgICAgICAgdmFsIHNpbXBsaWZpZWRSaW5nOiBMaXN0PERvdWJsZVZlY3Rvcj5cblxuICAgICAgICAgICAgICAgIGlmIChyaW5nLnNpemUgPiBQT0lOVFNfQ09VTlRfVE9fU0tJUF9TSU1QTElGSUNBVElPTikge1xuICAgICAgICAgICAgICAgICAgICB2YWwgdG9sZXJhbmNlID0gbWluKGFyZWEgKiBBUkVBX1RPTEVSQU5DRV9SQVRJTywgTUFYX1RPTEVSQU5DRSlcbiAgICAgICAgICAgICAgICAgICAgc2ltcGxpZmllZFJpbmcgPSBQb2x5bGluZVNpbXBsaWZpZXIudmlzdmFsaW5nYW1XaHlhdHQocmluZykuc2V0V2VpZ2h0TGltaXQodG9sZXJhbmNlKS5wb2ludHNcblxuICAgICAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJDb25zdGFudENvbmRpdGlvbklmXCIpXG4gICAgICAgICAgICAgICAgICAgIGlmIChpc0xvZ0VuYWJsZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhcIlNpbXA6IFwiICsgcmluZy5zaXplICsgXCIgLT4gXCIgKyBzaW1wbGlmaWVkUmluZy5zaXplICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCIsIHRvbGVyYW5jZT1cIiArIHRvbGVyYW5jZSArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiLCBiYm94PVwiICsgYmJveCArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiLCBhcmVhPVwiICsgYXJlYVxuICAgICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgQFN1cHByZXNzKFwiQ29uc3RhbnRDb25kaXRpb25JZlwiKVxuICAgICAgICAgICAgICAgICAgICBpZiAoaXNMb2dFbmFibGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsb2coXCJLZWVwOiBzaXplOiBcIiArIHJpbmcuc2l6ZSArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiLCBiYm94PVwiICsgYmJveCArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiLCBhcmVhPVwiICsgYXJlYVxuICAgICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHNpbXBsaWZpZWRSaW5nID0gcmluZ1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChzaW1wbGlmaWVkUmluZy5zaXplIDwgNCkge1xuICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHBvbHlnb24uYWRkKFJpbmdYWShzaW1wbGlmaWVkUmluZywgYmJveCkpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBwb2x5Z29uXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBsb2coc3RyOiBTdHJpbmcpIHtcbiAgICAgICAgICAgIHByaW50bG4oc3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CwgbG9va3VwU3BhY2UpLCBwLCBpbmRleClcbiAgICAgICAgICAgICAgICAgICAgWFkgLT4gUGF0aFBvaW50KFBvaW50VGFyZ2V0UHJvamVjdGlvbi5jcmVhdGUocCwgbG9va3VwU3BhY2UpLCBwLCBpbmRleClcbiAgICAgICAgICAgICAgICAgICAgTk9ORSAtPiB1bmRlZmluZWRMb29rdXBTcGFjZUVycm9yKClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgZnVuIGNyZWF0ZShwb2ludHM6IExpc3Q8RG91YmxlVmVjdG9yPiwgaW5kZXhNYXBwZXI6IChJbnQpIC0+IEludCwgbG9va3VwU3BhY2U6IExvb2t1cFNwYWNlKTogUGF0aFRhcmdldFByb2plY3Rpb24ge1xuICAgICAgICAgICAgdmFsIHBvaW50c0xvY2F0aW9uID0gQXJyYXlMaXN0PFBhdGhQb2ludD4oKVxuICAgICAgICAgICAgZm9yICgoaSwgcG9pbnQpIGluIHBvaW50cy53aXRoSW5kZXgoKSkge1xuICAgICAgICAgICAgICAgIHBvaW50c0xvY2F0aW9uLmFkZChQYXRoUG9pbnQuY3JlYXRlKHBvaW50LCBpbmRleE1hcHBlcihpKSwgbG9va3VwU3BhY2UpKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gUGF0aFRhcmdldFByb2plY3Rpb24ocG9pbnRzTG9jYXRpb24pXG4gICAgICAgIH1cbiAgICB9XG59XG5cbnByaXZhdGUgZnVuIHVuZGVmaW5lZExvb2t1cFNwYWNlRXJyb3IoKTogTm90aGluZyB7XG4gICAgdGhyb3cgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKFwiVW5kZWZpbmVkIGdlb20gbG9va3VwIHNwYWNlXCIpXG59XG4iLCIvKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LiBKZXRCcmFpbnMgcy5yLm8uXG4gKi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hbCB2YWwgdG9vbHRpcEtpbmQ6IFRpcExheW91dEhpbnQuS2luZFxuKSB7XG5cbiAgICBpbnRlcm5hbCBmdW4gY3JlYXRlR2VvbVRhcmdldChoaXRDb29yZDogRG91YmxlVmVjdG9yLCBoaXRJbmRleDogSW50KTogR2VvbVRhcmdldCB7XG4gICAgICAgIHJldHVybiBHZW9tVGFyZ2V0KFxuICAgICAgICAgICAgaGl0SW5kZXgsXG4gICAgICAgICAgICBjcmVhdGVUaXBMYXlvdXRIaW50KGhpdENvb3JkLCBoaXRTaGFwZSwgdG9vbHRpcFBhcmFtcy5nZXRDb2xvcigpLCB0b29sdGlwS2luZCwgdG9vbHRpcFBhcmFtcy5nZXRTdGVtTGVuZ3RoKCkpLFxuICAgICAgICAgICAgdG9vbHRpcFBhcmFtcy5nZXRUaXBMYXlvdXRIaW50cygpXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgZnVuIGNyZWF0ZVRpcExheW91dEhpbnQoXG4gICAgICAgICAgICBoaXRDb29yZDogRG91YmxlVmVjdG9yLFxuICAgICAgICAgICAgaGl0U2hhcGU6IEhpdFNoYXBlLFxuICAgICAgICAgICAgZmlsbDogQ29sb3IsXG4gICAgICAgICAgICB0b29sdGlwS2luZDogVGlwTGF5b3V0SGludC5LaW5kLFxuICAgICAgICAgICAgc3RlbUxlbmd0aDogVGlwTGF5b3V0SGludC5TdGVtTGVuZ3RoXG4gICAgICAgICk6IFRpcExheW91dEhpbnQge1xuXG4gICAgICAgICAgICByZXR1cm4gd2hlbiAoaGl0U2hhcGUua2luZCkge1xuICAgICAgICAgICAgICAgIFBPSU5UIC0+IHdoZW4gKHRvb2x0aXBLaW5kKSB7XG4gICAgICAgICAgICAgICAgICAgIFZFUlRJQ0FMX1RPT0xUSVAgLT4gVGlwTGF5b3V0SGludC52ZXJ0aWNhbFRvb2x0aXAoaGl0Q29vcmQsIGhpdFNoYXBlLnBvaW50LnJhZGl1cywgZmlsbCwgc3RlbUxlbmd0aClcbiAgICAgICAgICAgICAgICAgICAgQ1VSU09SX1RPT0xUSVAgLT4gVGlwTGF5b3V0SGludC5jdXJzb3JUb29sdGlwKGhpdENvb3JkLCBmaWxsLCBzdGVtTGVuZ3RoKVxuICAgICAgICAgICAgICAgICAgICBlbHNlIC0+IGVycm9yKFwiV3JvbmcgVGlwTGF5b3V0SGludC5raW5kID0gJHRvb2x0aXBLaW5kIGZvciBQT0lOVFwiKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIFJFQ1QgLT4gd2hlbiAodG9vbHRpcEtpbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgVkVSVElDQUxfVE9PTFRJUCAtPiBUaXBMYXlvdXRIaW50LnZlcnRpY2FsVG9vbHRpcChoaXRDb29yZCwgMC4wLCBmaWxsLCBzdGVtTGVuZ3RoKVxuICAgICAgICAgICAgICAgICAgICBIT1JJWk9OVEFMX1RPT0xUSVAgLT4gVGlwTGF5b3V0SGludC5ob3Jpem9udGFsVG9vbHRpcChoaXRDb29yZCwgaGl0U2hhcGUucmVjdC53aWR0aCAvIDIsIGZpbGwsIHN0ZW1MZW5ndGgpXG4gICAgICAgICAgICAgICAgICAgIENVUlNPUl9UT09MVElQIC0+IFRpcExheW91dEhpbnQuY3Vyc29yVG9vbHRpcChoaXRDb29yZCwgZmlsbCwgc3RlbUxlbmd0aClcbiAgICAgICAgICAgICAgICAgICAgZWxzZSAtPiBlcnJvcihcIldyb25nIFRpcExheW91dEhpbnQua2luZCA9ICR0b29sdGlwS2luZCBmb3IgUkVDVFwiKVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIFBBVEggLT4gd2hlbiAodG9vbHRpcEtpbmQpIHtcbiAgICAgICAgICAgICAgICAgICAgSE9SSVpPTlRBTF9UT09MVElQIC0+IFRpcExheW91dEhpbnQuaG9yaXpvbnRhbFRvb2x0aXAoaGl0Q29vcmQsIDAuMCwgZmlsbCw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4gICAgICAgICAgICAgICAgbG9va3VwUmVzdWx0LmNvbnRleHR1YWxNYXBwaW5nLFxuICAgICAgICAgICAgICAgIGxvb2t1cFJlc3VsdC5jb250ZXh0dWFsTWFwcGluZy5pc0Nyb3NzaGFpckVuYWJsZWRcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNvbnZlcnRHZW9tVGFyZ2V0cyhnZW9tVGFyZ2V0czogTGlzdDxHZW9tVGFyZ2V0Pik6IExpc3Q8R2VvbVRhcmdldD4ge1xuICAgICAgICByZXR1cm4gQXJyYXlMaXN0KExpc3RzLnRyYW5zZm9ybShnZW9tVGFyZ2V0cykgeyBnZW9tVGFyZ2V0IC0+XG4gICAgICAgICAgICBHZW9tVGFyZ2V0KFxuICAgICAgICAgICAgICAgIGdlb21UYXJnZXQuaGl0SW5kZXgsXG4gICAgICAgICAgICAgICAgY29udmVydFRpcExheW91dEhpbnQoZ2VvbVRhcmdldC50aXBMYXlvdXRIaW50KSxcbiAgICAgICAgICAgICAgICBjb252ZXJ0VGlwTGF5b3V0SGludHMoZ2VvbVRhcmdldC5hZXNUaXBMYXlvdXRIaW50cylcbiAgICAgICAgICAgIClcbiAgICAgICAgfSlcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBjb252ZXJ0VGlwTGF5b3V0SGludChoaW50OiBUaXBMYXlvdXRIaW50KTogVGlwTGF5b3V0SGludCB7XG4gICAgICAgIHJldHVybiBUaXBMYXlvdXRIaW50KFxuICAgICAgICAgICAgaGludC5raW5kLFxuICAgICAgICAgICAgc2FmZUNvbnZlcnRUb1Bsb3RDb29yZChoaW50LmNvb3JkKSEhLFxuICAgICAgICAgICAgY29udmVydFRvUGxvdERpc3RhbmNlKGhpbnQub2JqZWN0UmFkaXVzKSxcbiAgICAgICAgICAgIGhpbnQuY29sb3IsXG4gICAgICAgICAgICBoaW50LnN0ZW1MZW5ndGhcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVu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SZWN0YW5nbGU/ID0gbnVsbFxuICAgICAgICB2YXIgbXlBeGlzQnJlYWtzOiBTY2FsZUJyZWFrcz8gPSBudWxsXG5cbiAgICAgICAgZnVuIGJ1aWxkKCk6IEF4aXNMYXlvdXRJbmZvIHtcbiAgICAgICAgICAgIHJldHVybiBBeGlzTGF5b3V0SW5mbyh0aGlzKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGF4aXNMZW5ndGgoZDogRG91YmxlKTogQnVpbGRlciB7XG4gICAgICAgICAgICBteUF4aXNMZW5ndGggPSBkXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIG9yaWVudGF0aW9uKG86IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ1aWxkZXIuZ3VpZGUuT3JpZW50YXRpb24pOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIG15T3JpZW50YXRpb24gPSBvXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGF4aXNEb21haW4ocjogQ2xvc2VkUmFuZ2U8RG91YmxlPik6IEJ1aWxkZXIge1xuICAgICAgICAgICAgbXlBeGlzRG9tYWluID0gclxuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB0aWNrTGFiZWxzQm91bmRzTWF4KHI6IERvdWJsZVJlY3RhbmdsZT8pOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIG15TWF4VGlja0xhYmVsc0JvdW5kcyA9IHJcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdGlja0xhYmVsU21hbGxGb250KGI6IEJvb2xlYW4pOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIG15VGlja0xhYmVsU21hbGxGb250ID0gYlxuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB0aWNrTGF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ndGgpXG4gICAgICAgICAgICAub3JpZW50YXRpb24obXlPcmllbnRhdGlvbilcbiAgICAgICAgICAgIC5heGlzRG9tYWluKG15QXhpc0RvbWFpbilcbiAgICAgICAgICAgIC50aWNrTGFiZWxzQm91bmRzKHRpY2tMYWJlbHNCb3VuZHMpXG5cbiAgICAgICAgcmV0dXJuIGJ1aWxkZXIuYnVpbGQoKVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBmdW4gYm90dG9tKHhEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sIHlEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4pOiBBeGlzTGF5b3V0IHtcbiAgICAgICAgICAgIHJldHVybiBFbXB0eUF4aXNMYXlvdXQoXG4gICAgICAgICAgICAgICAgeERvbWFpbixcbiAgICAgICAgICAgICAgICB5RG9tYWluLFxuICAgICAgICAgICAgICAgIGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ1aWxkZXIuZ3VpZGUuT3JpZW50YXRpb24uQk9UVE9NXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gbGVmdCh4RG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LCB5RG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+KTogQXhpc0xheW91dCB7XG4gICAgICAgICAgICByZXR1cm4gRW1wdHlBeGlzTGF5b3V0KFxuICAgICAgICAgICAgICAgIHhEb21haW4sXG4gICAgICAgICAgICAgICAgeURvbWFpbixcbiAgICAgICAgICAgICAgICBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmd1aWRlLk9yaWVudGF0aW9uLkxFRlRcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjAuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmV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biAgICAgICAgdmFyIG9mZnNldFggPSAwLjBcbiAgICAgICAgdmFyIG9mZnNldFkgPSAwLjBcbiAgICAgICAgdmFyIGN1cnJSb3cgPSAwXG4gICAgICAgIHZhciBwcmV2SGVpZ2h0ID0gMC4wXG5cbiAgICAgICAgZm9yIChmYWNldFRpbGUgaW4gZmFjZXRUaWxlcykge1xuICAgICAgICAgICAgdmFyIHdpZHRoID0gZ2VvbVdpZHRoXG4gICAgICAgICAgICB2YXIgZ2VvbVggPSAwLjBcbiAgICAgICAgICAgIGlmIChmYWNldFRpbGUueUF4aXMpIHtcbiAgICAgICAgICAgICAgICB3aWR0aCArPSBheGlzVGhpY2tuZXNzWVxuICAgICAgICAgICAgICAgIGdlb21YID0gYXhpc1RoaWNrbmVzc1lcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChmYWNldFRpbGUucm93TGFiICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICB3aWR0aCArPSBGQUNFVF9UQUJfSEVJR0hUXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBoZWlnaHQgPSBnZW9tSGVpZ2h0XG4gICAgICAgICAgICB2YXIgZ2VvbVk6IERvdWJsZVxuICAgICAgICAgICAgaWYgKGZhY2V0VGlsZS54QXhpcyAmJiBmYWNldFRpbGUucm93ID09IGZhY2V0cy5yb3dDb3VudCAtIDEpIHsgICAvLyBib3R0b20gcm93IG9ubHlcbiAgICAgICAgICAgICAgICBoZWlnaHQgKz0gYXhpc1RoaWNrbmVzc1hcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhbCBhZGRlZEhlaWdodCA9IGZhY2V0Q29sSGVhZEhlaWdodChmYWNldFRpbGUuY29sTGFicy5zaXplKVxuICAgICAgICAgICAgaGVpZ2h0ICs9IGFkZGVkSGVpZ2h0XG4gICAgICAgICAgICBnZW9tWSA9IGFkZGVkSGVpZ2h0XG5cbiAgICAgICAgICAgIHZhbCBib3VuZHMgPSBEb3VibGVSZWN0YW5nbGUoMC4wLCAwLjAsIHdpZHRoLCBoZWlnaHQpXG4gICAgICAgICAgICB2YWwgZ2VvbUJvdW5kcyA9IERvdWJsZVJlY3RhbmdsZShnZW9tWCwgZ2VvbVksIGdlb21XaWR0aCwgZ2VvbUhlaWdodClcblxuICAgICAgICAgICAgdmFsIHJvdyA9IGZhY2V0VGlsZS5yb3dcbiAgICAgICAgICAgIGlmIChyb3cgPiBjdXJyUm93KSB7XG4gICAgICAgICAgICAgICAgY3VyclJvdyA9IHJvd1xuICAgICAgICAgICAgICAgIG9mZnNldFkgKz0gcHJldkhlaWdodCArIFBBTkVMX1BBRERJTkdcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHByZXZIZWlnaHQgPSBoZWlnaHRcblxuICAgICAgICAgICAgdmFsIGNvbCA9IGZhY2V0VGlsZS5jb2xcbiAgICAgICAgICAgIGlmIChjb2wgPT0gMCkge1xuICAgICAgICAgICAgICAgIG9mZnNldFggPSAwLjBcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIG9mZnNldCA9IERvdWJsZVZlY3RvcihvZmZzZXRYLCBvZmZzZXRZKVxuICAgICAgICAgICAgb2Zmc2V0WCArPSB3aWR0aCArIFBBTkVMX1BBRERJTkdcblxuICAgICAgICAgICAgdmFsIGluZm8gPSBUaWxlTGF5b3V0SW5mbyhcbiAgICAgICAgICAgICAgICBib3VuZHMsXG4gICAgICAgICAgICAgICAgZ2VvbUJvdW5kcyxcbiAgICAgICAgICAgICAgICBYWVBsb3RMYXlvdXRVdGlsLmNsaXBCb3VuZHMoZ2VvbUJvdW5kcyksXG4gICAgICAgICAgICAgICAgdGlsZUluZm8ubGF5b3V0SW5mby54QXhpc0luZm8sXG4gICAgICAgICAgICAgICAgdGlsZUluZm8ubGF5b3V0SW5mby55QXhpc0luZm8sXG4gICAgICAgICAgICAgICAgeEF4aXNTaG93biA9IGZhY2V0VGlsZS54QXhpcyxcbiAgICAgICAgICAgICAgICB5QXhpc1Nob3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bmRzLmhlaWdodFxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGNvbnN0IHZhbCBGQUNFVF9UQUJfSEVJR0hUID0gMzAuMFxuICAgICAgICBjb25zdCB2YWwgRkFDRVRfSF9QQURESU5HID0gMFxuICAgICAgICBjb25zdCB2YWwgRkFDRVRfVl9QQURESU5HID0gNiAvLzVcblxuICAgICAgICBwcml2YXRlIGNvbnN0IHZhbCBQQU5FTF9QQURESU5HID0gMTAuMFxuXG4gICAgICAgIGZ1biBmYWNldENvbExhYmVsU2l6ZShjb2xXaWR0aDogRG91YmxlKTogRG91YmxlVmVjdG9yIHtcbiAgICAgICAgICAgIHJldHVybiBEb3VibGVWZWN0b3IoY29sV2lkdGggLSBGQUNFVF9IX1BBRERJTkcgKiAyLCBGQUNFVF9UQUJfSEVJR0hUIC0gRkFDRVRfVl9QQURESU5HICogMi4wKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGZhY2V0Q29sSGVhZEhlaWdodChsYWJDb3VudDogSW50KTogRG91YmxlIHtcbiAgICAgICAgICAgIHJldHVybiBpZiAobGFiQ291bnQgPiAwKSB7XG4gICAgICAgICAgICAgICAgZmFjZXRDb2xMYWJlbFNpemUoMC4wKS55ICogbGFiQ291bnQgKyBGQUNFVF9WX1BBRERJTkcgKiAyXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIDAuMFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idW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gICAgICAgIHZhbCB5U3BhbiA9IHlSYW5nZS51cHBlckVuZCAtIHlSYW5nZS5sb3dlckVuZFxuICAgICAgICByZXR1cm4gRG91YmxlUmVjdGFuZ2xlKHhPcmlnaW4sIHlPcmlnaW4sIHhTcGFuLCB5U3BhbilcbiAgICB9XG5cbiAgICBmdW4gY2hhbmdlV2lkdGgocjogRG91YmxlUmVjdGFuZ2xlLCB3aWR0aDogRG91YmxlKTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgcmV0dXJuIERvdWJsZVJlY3RhbmdsZShcbiAgICAgICAgICAgICAgICByLm9yaWdpbi54LFxuICAgICAgICAgICAgICAgIHIub3JpZ2luLnksXG4gICAgICAgICAgICAgICAgd2lkdGgsXG4gICAgICAgICAgICAgICAgci5kaW1lbnNpb24ueVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIGNoYW5nZVdpZHRoS2VlcFJpZ2h0KHI6IERvdWJsZVJlY3RhbmdsZSwgd2lkdGg6IERvdWJsZSk6IERvdWJsZVJlY3RhbmdsZSB7XG4gICAgICAgIHJldHVybiBEb3VibGVSZWN0YW5nbGUoXG4gICAgICAgICAgICAgICAgci5yaWdodCAtIHdpZHRoLFxuICAgICAgICAgICAgICAgIHIub3JpZ2luLnksXG4gICAgICAgICAgICAgICAgd2lkdGgsXG4gICAgICAgICAgICAgICAgci5kaW1lbnNpb24ueVxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIGNoYW5nZUhlaWdodChyOiBEb3VibGVSZWN0YW5nbGUsIGhlaWdodDogRG91YmxlKTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgcmV0dXJuIERvdWJsZVJlY3RhbmdsZShcbiAgICAgICAgICAgICAgICByLm9yaWdpbi54LFxuICAgICAgICAgICAgICAgIHIub3JpZ2luLnksXG4gICAgICAgICAgICAgICAgci5kaW1lbnNpb24ueCxcbiAgICAgICAgICAgICAgICBoZWlnaHRcbiAgICAgICAgKVxuICAgIH1cblxu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WxvcmUucGxvdC5idWlsZGVyLmd1aWRlLkxlZ2VuZFBvc2l0aW9uLkxFRlQgfHwgbGVnZW5kUG9zaXRpb24gPT0gamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5ndWlkZS5MZWdlbmRQb3NpdGlvbi5SSUdIVCkge1xuICAgICAgICAgICAgdmFsIHBsb3RXaWR0aCA9IG1heCgwLjAsIHBsb3RJbm5lckJvdW5kc1dpdGhvdXRMZWdlbmRCb3hlcy53aWR0aCAtIGJveGVzU2l6ZS54KVxuICAgICAgICAgICAgaWYgKGxlZ2VuZFBvc2l0aW9uID09IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ1aWxkZXIuZ3VpZGUuTGVnZW5kUG9zaXRpb24uTEVGVCkge1xuICAgICAgICAgICAgICAgIHBsb3RJbm5lckJvdW5kc1dpdGhvdXRMZWdlbmRCb3hlcyA9XG4gICAgICAgICAgICAgICAgICAgIEdlb21ldHJ5VXRpbC5jaGFuZ2VXaWR0aEtlZXBSaWdodChcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsb3RJbm5lckJvdW5kc1dpdGhvdXRMZWdlbmRCb3hlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsb3RXaWR0aFxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHBsb3RJbm5lckJvdW5kc1dpdGhvdXRMZWdlbmRCb3hlcyA9XG4gICAgICAgICAgICAgICAgICAgIEdlb21ldHJ5VXRpbC5jaGFuZ2VXaWR0aChcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsb3RJbm5lckJvdW5kc1dpdGhvdXRMZWdlbmRCb3hlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsb3RXaWR0aFxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAobGVnZW5kUG9zaXRpb24gPT0gamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5ndWlkZS5MZWdlbmRQb3NpdGlvbi5UT1AgfHwgbGVnZW5kUG9zaXRpb24gPT0gamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5ndWlkZS5MZWdlbmRQb3NpdGlvbi5CT1RUT00pIHtcbiAgICAgICAgICAgIHZhbCBwbG90SGVpZ2h0ID0gbWF4KDAuMCwgcGxvdElubmVyQm91bmRzV2l0aG91dExlZ2VuZEJveGVzLmhlaWdodCAtIGJveGVzU2l6ZS55KVxuICAgICAgICAgICAgaWYgKGxlZ2VuZFBvc2l0aW9uID09IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ1aWxkZXIuZ3VpZGUuTGVnZW5kUG9zaXRpb24uVE9QKSB7XG4gICAgICAgICAgICAgICAgcGxvdElubmVyQm91bmRzV2l0aG91dExlZ2VuZEJveGVzID1cbiAgICAgICAgICAgICAgICAgICAgR2VvbWV0cnlVdGlsLmNoYW5nZUhlaWdodEtlZXBCb3R0b20oXG4gICAgICAgICAgICAgICAgICAgICAgICBwbG90SW5uZXJCb3VuZHNXaXRob3V0TGVnZW5kQm94ZXMsXG4gICAgICAgICAgICAgICAgICAgICAgICBwbG90SGVpZ2h0XG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcGxvdElubmVyQm91bmRzV2l0aG91dExlZ2VuZEJveGVzID1cbiAgICAgICAgICAgICAgICAgICAgR2VvbWV0cnlVdGlsLmNoYW5nZUhlaWdodChcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsb3RJbm5lckJvdW5kc1dpdGhvdXRMZWdlbmRCb3hlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsb3RIZWlnaHRcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGxlZ2VuZE9yaWdpbjogRG91YmxlVmVjd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lLnBsb3QuYnVpbGRlci5ndWlkZS5MZWdlbmRQb3NpdGlvbi5CT1RUT00pIHtcbiAgICAgICAgICAgIGxlZ2VuZE9yaWdpbiA9IERvdWJsZVZlY3RvcihcbiAgICAgICAgICAgICAgICAgICAgcGxvdENlbnRlci54IC0gYm94ZXNTaXplLnggLyAyLFxuICAgICAgICAgICAgICAgICAgICBwbG90SW5uZXJCb3VuZHNXaXRob3V0TGVnZW5kQm94ZXMuYm90dG9tKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgbGVnZW5kT3JpZ2luID1cbiAgICAgICAgICAgICAgICBMZWdlbmRCb3hlc0xheW91dFV0aWwub3ZlcmxheUxlZ2VuZE9yaWdpbihcbiAgICAgICAgICAgICAgICAgICAgcGxvdElubmVyQm91bmRzV2l0aG91dExlZ2VuZEJveGVzLFxuICAgICAgICAgICAgICAgICAgICBib3hlc1NpemUsXG4gICAgICAgICAgICAgICAgICAgIGxlZ2VuZFBvc2l0aW9uLFxuICAgICAgICAgICAgICAgICAgICBsZWdlbmRKdXN0aWZpY2F0aW9uXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHJlc3VsdEJveFdpdGhMb2NhdGlvbkxpc3QgPVxuICAgICAgICAgICAgTGVnZW5kQm94ZXNMYXlvdXRVdGlsLm1vdmVBbGwoXG4gICAgICAgICAgICAgICAgbGVnZW5kT3JpZ2luLFxuICAgICAgICAgICAgICAgIGJveFdpdGhMb2NhdGlvbkxpc3RcbiAgICAgICAgICAgIClcbiAgICAgICAgcmV0dXJuIFJlc3VsdChcbiAgICAgICAgICAgIHBsb3RJbm5lckJvdW5kc1dpdGhvdXRMZWdlbmRCb3hlcyxcbiAgICAgICAgICAgIHJlc3VsdEJveFdpdGhMb2NhdGlvbkxpc3RcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGNsYXNzIFJlc3VsdCh2YWwgcGxvdElubmVyQm91bmRzV2l0aG91dExlZ2VuZEJveGVzO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aWwge1xuICAgIGZ1biB2ZXJ0aWNhbFN0YWNrKGJveEluZm9zOiBMaXN0PExlZ2VuZEJveEluZm8+KTogTGlzdDxMZWdlbmRCb3hlc0xheW91dC5Cb3hXaXRoTG9jYXRpb24+IHtcbiAgICAgICAgdmFsIHJlc3VsdCA9IEFycmF5TGlzdDxMZWdlbmRCb3hlc0xheW91dC5Cb3hXaXRoTG9jYXRpb24+KClcbiAgICAgICAgdmFyIHkgPSAwLjBcbiAgICAgICAgZm9yIChpbmZvIGluIGJveEluZm9zKSB7XG4gICAgICAgICAgICByZXN1bHQuYWRkKFxuICAgICAgICAgICAgICAgIExlZ2VuZEJveGVzTGF5b3V0LkJveFdpdGhMb2NhdGlvbihcbiAgICAgICAgICAgICAgICAgICAgaW5mbyxcbiAgICAgICAgICAgICAgICAgICAgRG91YmxlVmVjdG9yKDAuMCwgeSlcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApXG4gICAgICAgICAgICB5ICs9IGluZm8uc2l6ZS55XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgIH1cblxuICAgIGZ1biBob3Jpem9udGFsU3RhY2soYm94SW5mb3M6IExpc3Q8TGVnZW5kQm94SW5mbz4pOiBMaXN0PExlZ2VuZEJveGVzTGF5b3V0LkJveFdpdGhMb2NhdGlvbj4ge1xuICAgICAgICB2YWwgcmVzdWx0ID0gQXJyYXlMaXN0PExlZ2VuZEJveGVzTGF5b3V0LkJveFdpdGhMb2NhdGlvbj4oKVxuICAgICAgICB2YXIgeCA9IDAuMFxuICAgICAgICBmb3IgKGluZm8gaW4gYm94SW5mb3MpIHtcbiAgICAgICAgICAgIHJlc3VsdC5hZGQoXG4gICAgICAgICAgICAgICAgTGVnZW5kQm94ZXNMYXlvdXQuQm94V2l0aExvY2F0aW9uKFxuICAgICAgICAgICAgICAgICAgICBpbmZvLFxuICAgICAgICAgICAgICAgICAgICBEb3VibGVWZWN0b3IoeCwgMC4wKVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIHggKz0gaW5mby5zaXplLnhcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgfVxuXG4gICAgZnVuIG1vdmVBbGwoZGVsdGE6IERvdWJsZVZlY3RvciwgYm94V2l0aExvY2F0aW9uTGlzdDogTGlzdDxMZWdlbmRCb3hlc0xheW91dC5Cb3hXaXRoTG9jYXRpb24+KTogTGlzdDxMZWdlbmRCb3hlc0xheW91dC5Cb3hXaXRoTG9jYXRpb24+IHtcbiAgICAgICAgdmFsIHJlc3VsdCA9IEFycmF5TGlzdDxMZWdlbmRCb3hlc0xheW91dC5Cb3hXaXRoTG9jYXRpb24+KClcbiAgICAgICAgZm9yIChib3hXaXRoTG9jYXRpb24gaW4gYm94V2l0aExvY2F0aW9uTGlzdCkge1xuICAgICAgICAgICAgcmVzdWx0LmFkZChcbiAgICAgICAgICAgICAgICBMZWdlbmRCb3hlc0xheW91dC5Cb3hXaXRoTG9jYXRpb24oXG4gICAgICAgICAgICAgICAgICAgIGJveFdpdGhMb2NhdGlvbi5sZWdlbmRCb3gsXG4gICAgICAgICAgICAgICAgICAgIGJveFdpdGhMb2NhdGlvbi5sb2NhdGlvbi5hZGQoZGVsdGEpXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBmdW4gc2l6ZShib3hXaXRoTG9jYXRpb25MaXN0OiBMaXN0PExlZ2VuZEJveGVzTGF5b3V0LkJveFdpdGhMb2NhdGlvbj4pOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICB2YXIgYm91bmRzOiBEb3VibGVSZWN0YW5nbGU/ID0gbnVsbFxuICAgICAgICBmb3IgKGJveFdpdGhMb2NhdGlvbiBpbiBib3hXaXRoTG9jYXRpb25MaXN0KSB7XG4gICAgICAgICAgICBib3VuZHMgPSBib3VuZHM/LnVuaW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1RoZW1lLFxuICAgIHByaXZhdGUgdmFsIG9yaWVudGF0aW9uOiBPcmllbnRhdGlvblxuKSA6IEF4aXNMYXlvdXQge1xuXG4gICAgb3ZlcnJpZGUgZnVuIGluaXRpYWxUaGlja25lc3MoKTogRG91YmxlIHtcbiAgICAgICAgaWYgKHRoZW1lLnNob3dUaWNrTWFya3MoKSB8fCB0aGVtZS5zaG93VGlja0xhYmVscygpKSB7XG4gICAgICAgICAgICB2YWwgdiA9IHRoZW1lLnRpY2tMYWJlbERpc3RhbmNlKClcbiAgICAgICAgICAgIHJldHVybiBpZiAodGhlbWUuc2hvd1RpY2tMYWJlbHMoKSkge1xuICAgICAgICAgICAgICAgIHYgKyBpbml0aWFsVGlja0xhYmVsU2l6ZShvcmllbnRhdGlvbilcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdlxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiAwLjBcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gZG9MYXlvdXQoZGlzcGxheVNpemU6IERvdWJsZVZlY3RvciwgbWF4VGlja0xhYmVsc0JvdW5kc1N0cmV0Y2hlZDogRG91YmxlUmVjdGFuZ2xlPyk6IEF4aXNMYXlvdXRJbmZvIHtcbiAgICAgICAgdmFsIGxheW91dGVyID0gY3JlYXRlTGF5b3V0ZXIoZGlzcGxheVNpemUpXG4gICAgICAgIHJldHVybiBsYXlvdXRlci5kb0xheW91dChcbiAgICAgICAgICAgIGF4aXNMZW5ndGgoZGlzcGxheVNpemUsIG9yaWVudGF0aW9uKSxcbiAgICAgICAgICAgIG1heFRpY2tMYWJlbHNCb3VuZHNTdHJldGNoZWRcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGNyZWF0ZUxheW91dGVyKGRpc3BsYXlTaXplOiBEb3VibGVWZWN0b3IpOiBBeGlzTGF5b3V0ZXIge1xuICAgICAgICB2YWwgZG9tYWlucyA9IGNvb3JkUHJvdmlkZXIuYWRqdXN0RG9tYWlucyhkb21haW5YLCBkb21haW5ZLCBkaXNwbGF5U2l6ZSlcbiAgICAgICAgdmFsIGF4aXNEb21haW4gPSBheGlzRG9tYWluKFxuICAgICAgICAgICAgZG9tYWlucyxcbiAgICAgICAgICAgIG9yaWVudGF0aW9uXG4gICAgICAgIClcblxuICAgICAgICB2YWwgYnJlYWtzUHJvdmlkZXIgPSBBeGlzQnJlYWtzVXRpbC5jcmVhdGVBeGlzQnJlYWtzUHJvdmlkZXIoc2NhbGUsIGF4aXNEb21haW4pXG4gICAgICAgIHJldHVybiBBeGlzTGF5b3V0ZXIuY3JlYXRlKG9yaWVudGF0aW9uLCBheGlzRG9tYWluLCBicmVha3NQcm92aWRlciwgdGhlbWUpXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHByaXZhdGUgdmFsIFRJQ0tfTEFCRUxfU1BFQyA9IFBsb3RMYWJlbFNwZWMuQVhJU19USUNLXG5cbiAgICAgICAgZnVuIGJvdHRvbShcbiAgICAgICAgICAgIHNjYWxlOiBTY2FsZTxEb3VibGU+LFxuICAgICAgICAgICAgeERvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgICAgIHlEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgICAgICBjb29yZFByb3ZpZGVyOiBDb29yZFByb3ZpZGVyLFxuICAgICAgICAgICAgdGhlbWU6IEF4aXNUaGVtZVxuICAgICAgICApOiBBeGlzTGF5b3V0IHtcbiAgICAgICAgICAgIHJldHVybiBQbG90QXhpc0xheW91dChcbiAgICAgICAgICAgICAgICBzY2FsZSwgeERvbWFpbiwgeURvbWFpbiwgY29vcmRQcm92aWRlcixcbiAgICAgICAgICAgICAgICB0aGVtZSxcbiAgICAgICAgICAgICAgICBPcmllbnRhdGlvbi5CT1RUT01cbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBsZWZ0KFxuICAgICAgICAgICAgc2NhbGU6IFNjYWxlPERvdWJsZT4sXG4gICAgICAgICAgICB4RG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICAgICAgeURvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgICAgIGNvb3JkUHJvdmlkZXI6IENvb3JkUHJvdmlkZXIsXG4gICAgICAgICAgICB0aGVtZTogQXhpc1RoZW1lXG4gICAgICAgICk6IEF4aXNMYXlvdXQge1xuICAgICAgICAgICAgcmV0dXJuIFBsb3RBeGlzTGF5b3V0KFxuICAgICAgICAgICAgICAgIHNjYWxlLCB4RG9tYWluLCB5RG9tYWluLCBjb29yZFByb3ZpZGVyLFxuICAgICAgICAgICAgICAgIHRoZW1lLFxuICAgICAgICAgICAgICAgIE9yaWVudGF0aW9uLkxFRlRcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGluaXRpYWxUaWNrTGFiZWxTaXplKG9yaWVudGF0aW9uOiBPcmllbnRhdGlvbik6IERvdWJsZSB7XG4gICAgICAgICAgICByZXR1cm4gaWYgKG9yaWVudGF0aW9uLmlzSG9yaXpvbnRhbClcbiAgICAgICAgICAgICAgICBUSUNLX0xBQkVMX1NQRUMuaGVpZ2h0KClcbiAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICBUSUNLX0xBQkVMX1NQRUMud2lkdGgoMSlcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGF4aXNMZW5ndGgoZGlzcGxheVNpemU6IERvdWJsZVZlY3Rvciwgb3JpZW50YXRpb246IE9yaWVudGF0aW9uKTogRG91YmxlIHtcbiAgICAgICAgICAgIHJldHVybiBpZiAob3JpZW50YXRpb24uaXNIb3Jpem9udGFsKVxuICAgICAgICAgICAgICAgIGRpc3BsYXlTaXplLnhcbiAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICBkaXNwbGF5U2l6ZS55XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBheGlzRG9tYWluKFxuICAgICAgICAgICAgeHlEb21haW5zOiBQYWlyPENsb3NlZFJhbmdlPERvdWJsZT4sIENsb3NlZFJhbmdlPERvdWJsZT4+LFxuICAgICAgICAgICAgb3JpZW50YXRpb246IE9yaWVudGF0aW9uXG4gICAgICAgICk6IENsb3NlZFJhbmdlPERvdWJsZT4ge1xuICAgICAgICAgICAgcmV0dXJuIGlmIChvcmllbnRhdGlvbi5pc0hvcml6b250YWwpXG4gICAgICAgICAgICAgICAgeHlEb21haW5zLmZpcnN0XG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgeHlEb21haW5zLnNlY29uZFxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmxheW91dFxuXG5pbnRlcm5hbCBhYnN0cmFjdCBjbGFzcyBQbG90TGF5b3V0QmFzZSA6IFBsb3RMYXlvdXQge1xuICAgIHByb3RlY3RlZCB2YXIgcGFkZGluZ1RvcDogRG91YmxlID0gMC4wXG4gICAgICAgIHByaXZhdGUgc2V0XG4gICAgcHJvdGVjdGVkIHZhciBwYWRkaW5nUmlnaHQ6IERvdWJsZSA9IDAuMFxuICAgICAgICBwcml2YXRlIHNldFxuICAgIHByb3RlY3RlZCB2YXIgcGFkZGluZ0JvdHRvbTogRG91YmxlID0gMC4wXG4gICAgICAgIHByaXZhdGUgc2V0XG4gICAgcHJvdGVjdGVkIHZhciBwYWRkaW5nTGVmdDogRG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gICAgIENMSVBfRVhURU5ELFxuICAgICAgICAgICAgICAgICAgICBDTElQX0VYVEVORFxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICksXG4gICAgICAgICAgICBEb3VibGVWZWN0b3IoXG4gICAgICAgICAgICAgICAgZ2VvbUJvdW5kcy5kaW1lbnNpb24ueCArIDIgKiBDTElQX0VYVEVORCxcbiAgICAgICAgICAgICAgICBnZW9tQm91bmRzLmRpbWVuc2lvbi55ICsgMiAqIENMSVBfRVhURU5EXG4gICAgICAgICAgICApXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBmdW4gbWF4VGlja0xhYmVsc0JvdW5kcyhcbiAgICAgICAgYXhpc09yaWVudGF0aW9uOiBPcmllbnRhdGlvbixcbiAgICAgICAgc3RyZXRjaDogRG91YmxlLFxuICAgICAgICBnZW9tQm91bmRzOiBEb3VibGVSZWN0YW5nbGUsXG4gICAgICAgIHBsb3RTaXplOiBEb3VibGVWZWN0b3JcbiAgICApOiBEb3VibGVSZWN0YW5nbGUge1xuICAgICAgICB2YWwgZ2VvbVBhZGR1bmcgPSAxMC4wICAgICAgICAgIC8vIG1pbiBzcGFjZSBhcm91bmQgZ2VvbSBhcmVhIChsYWJlbHMgc2hvdWxkIG5vdCB0b3VjaCBnZW9tIGFyZWEpLlxuXG4gICAgICAgIHZhbCBtYXhHZW9tQm91bmRzID0gRG91YmxlUmVjdGFuZ2xlKFxuICAgICAgICAgICAgZ2VvbVBhZGR1bmcsIGdlb21QYWRkdW5nLFxuICAgICAgICAgICAgcGxvdFNpemUueCAtIDIgKiBnZW9tUGFkZHVuZyxcbiAgICAgICAgICAgIHBsb3RTaXplLnkgLSAyICogZ2VvbVBhZGR1bmdcbiAgICAgICAgKVxuICAgICAgICB3aGVuIChheGlzT3JpZW50YXRpb24pIHtcbiAgICAgICAgICAgIE9yaWVudGF0aW9uLlRPUCxcbiAgICAgICAgICAgIE9yaWVudGF0aW9uLkJPVFRPTSAtPiB7XG4gICAgICAgICAgICAg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blxuICAgICAgICB2YXIgKHhBeGlzSW5mbywgeUF4aXNJbmZvKSA9IGNvbXB1dGVBeGlzSW5mb3MoXG4gICAgICAgICAgICB4QXhpc0xheW91dCxcbiAgICAgICAgICAgIHlBeGlzTGF5b3V0LFxuICAgICAgICAgICAgcHJlZmVycmVkU2l6ZVxuICAgICAgICApXG5cbiAgICAgICAgdmFyIGdlb21Cb3VuZHMgPSBnZW9tQm91bmRzKFxuICAgICAgICAgICAgeEF4aXNUaGlja25lc3MgPSB4QXhpc0luZm8uYXhpc0JvdW5kcygpLmRpbWVuc2lvbi55LFxuICAgICAgICAgICAgeUF4aXNUaGlja25lc3MgPSB5QXhpc0luZm8uYXhpc0JvdW5kcygpLmRpbWVuc2lvbi54LFxuICAgICAgICAgICAgcHJlZmVycmVkU2l6ZVxuICAgICAgICApXG5cbiAgICAgICAgLy8gWC1heGlzIGxhYmVscyBib3VuZHMgbWF5IGV4Y2VlZCBheGlzIGxlbmd0aCAtIGFkanVzdFxuICAgICAgICBydW4ge1xuICAgICAgICAgICAgdmFsIG1heFRpY2tMYWJlbHNCb3VuZHMgPSBtYXhUaWNrTGFiZWxzQm91bmRzKFxuICAgICAgICAgICAgICAgIE9yaWVudGF0aW9uLkJPVFRPTSxcbiAgICAgICAgICAgICAgICAwLjAsXG4gICAgICAgICAgICAgICAgZ2VvbUJvdW5kcyxcbiAgICAgICAgICAgICAgICBwcmVmZXJyZWRTaXplXG4gICAgICAgICAgICApXG4gICAgICAgICAgICB2YWwgdGlja0xhYmVsc0JvdW5kcyA9IHhBeGlzSW5mby50aWNrTGFiZWxzQm91bmRzXG4gICAgICAgICAgICB2YWwgbGVmdE92ZXJmbG93ID0gbWF4VGlja0xhYmVsc0JvdW5kcy5sZWZ0IC0gdGlja0xhYmVsc0JvdW5kcyEhLm9yaWdpbi54XG4gICAgICAgICAgICB2YWwgcmlnaHRPdmVyZmxvdyA9IHRpY2tMYWJlbHNCb3VuZHMub3JpZ2luLnggKyB0aWNrTGFiZWxzQm91bmRzLmRpbWVuc2lvbi54IC0gbWF4VGlja0xhYmVsc0JvdW5kcy5yaWdodFxuICAgICAgICAgICAgaWYgKGxlZnRPdmVyZmxvdyA+IDApIHtcbiAgICAgICAgICAgICAgICBnZW9tQm91bmRzID0gRG91YmxlUmVjdGFuZ2xlKFxuICAgICAgICAgICAgICAgICAgICBnZW9tQm91bmRzLm9yaWdpbi54ICsgbGVmdE92ZXJmbG93LFxuICAgICAgICAgICAgICAgICAgICBnZW9tQm91bmRzLm9yaWdpbi55LFxuICAgICAgICAgICAgICAgICAgICBnZW9tQm91bmRzLmRpbWVuc2lvbi54IC0gbGVmdE92ZXJmbG93LFxuICAgICAgICAgICAgICAgICAgICBnZW9tQm91bmRzLmRpbWVuc2lvbi55XG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHJpZ2h0T3ZlcmZsb3cgPiAwKSB7XG4gICAgICAgICAgICAgICAgZ2VvbUJvdW5kcyA9IERvdWJsZVJlY3RhbmdsZShcbiAgICAgICAgICAgICAgICAgICAgZ2VvbUJvdW5kcy5vcmlnaW4ueCxcbiAgICAgICAgICAgICAgICAgICAgZ2VvbUJvdW5kcy5vcmlnaW4ueSxcbiAgICAgICAgICAgICAgICAgICAgZ2VvbUJvdW5kcy5kaW1lbnNpb24ueCAtIHJpZ2h0T3ZlcmZsb3csXG4gICAgICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMuZGltZW5zaW9uLnlcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBnZW9tQm91bmRzID0gZ2VvbUJvdW5kcy51bmlvbihcbiAgICAgICAgICAgIERvdWJsZVJlY3RhbmdsZShnZW9tQm91bmRzLm9yaWdpbiwgR0VPTV9NSU5fU0laRSlcbiAgICAgICAgKVxuXG4gICAgICAgIC8vIENvbWJpbmUgZ2VvbSBhcmVhIGFuZCB4L3kgYXhpc1xuICAgICAgICB2YWwg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G4gICAgICAgICAgICBnZW9tQm91bmRzOiBEb3VibGVSZWN0YW5nbGVcbiAgICAgICAgKTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgICAgIC8vIENhbid0IGp1c3QgdW5pb24gYm91bmRzIGJlY2F1c2VcbiAgICAgICAgICAgIC8vIHgtYXhpcyBoYXMgemVybyBvcmlnaW5cbiAgICAgICAgICAgIC8vIHktYXhpcyBoYXMgbmVnYXRpdmUgb3JpZ2luXG4gICAgICAgICAgICB2YWwgbGVmdFRvcCA9IERvdWJsZVZlY3RvcihcbiAgICAgICAgICAgICAgICBnZW9tQm91bmRzLmxlZnQgLSB5QXhpc0JvdW5kcy53aWR0aCxcbiAgICAgICAgICAgICAgICBnZW9tQm91bmRzLnRvcCAtIEdFT01fTUFSR0lOXG4gICAgICAgICAgICApXG4gICAgICAgICAgICB2YWwgcmlnaHRCb3R0b20gPSBEb3VibGVWZWN0b3IoXG4gICAgICAgICAgICAgICAgZ2VvbUJvdW5kcy5yaWdodCArIEdFT01fTUFSR0lOLFxuICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMuYm90dG9tICsgeEF4aXNCb3VuZHMuaGVpZ2h0XG4gICAgICAgICAgICApXG4gICAgICAgICAgICByZXR1cm4gRG91YmxlUmVjdGFuZ2xlKGxlZnRUb3AsIHJpZ2h0Qm90dG9tLnN1YnRyYWN0KGxlZnRUb3ApKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gY29tcHV0ZUF4aXNJbmZvcyhcbiAgICAgICAgICAgIHhBeGlzTGF5b3V0OiBBeGlzTGF5b3V0LFxuICAgICAgICAgICAgeUF4aXNMYXlvdXQ6IEF4aXNMYXlvdXQsXG4gICAgICAgICAgICBwbG90U2l6ZTogRG91YmxlVmVjdG9yXG4gICAgICAgICk6IFBhaXI8QXhpc0xheW91dEluZm8sIEF4aXNMYXlvdXRJbmZvPiB7XG4gICAgICAgICAgICB2YWwgeEF4aXNUaGlja25lc3MgPSB4QXhpc0xheW91dC5pbml0aWFsVGhpY2tuZXNzKClcbiAgICAgICAgICAgIHZhciB5QXhpc0luZm8gPSBjb21wdXRlWUF4aXNJbmZvKFxuICAgICAgICAgICAgICAgIHlBeGlzTGF5b3V0LFxuICAgICAgICAgICAgICAgIGdlb21Cb3VuZHMoXG4gICAgICAgICAgICAgICAgICAgIHhBeGlzVGhpY2tuZXNzLFxuICAgICAgICAgICAgICAgICAgICB5QXhpc0xheW91dC5pbml0aWFsVGhpY2tuZXNzKCksXG4gICAgICAgICAgICAgICAgICAgIHBsb3RTaXplXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICB2YWwgeUF4aXNUaGlja25lc3MgPSB5QXhpc0luZm8uYXhpc0JvdW5kcygpLmRpbWVuc2lvbi54XG4gICAgICAgICAgICB2YXIgeEF4aXNJbmZvID0gY29tcHV0ZVhBeGlzSW5mbyhcbiAgICAgICAgICAgICAgICB4QXhpc0xheW91dCxcbiAgICAgICAgICAgICAgICBwbG90U2l6ZSwgZ2VvbUJvdW5kcyhcbiAgICAgICAgICAgICAgICAgICAgeEF4aXNUaGlja25lc3MsXG4gICAgICAgICAgICAgICAgICAgIHlBeGlzVGhpY2tuZXNzLFxuICAgICAgICAgICAgICAgICAgICBwbG90U2l6ZVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIClcblxuICAgICAgICAgICAgaWYgKHhBeGlzSW5mby5heGlzQm91bmRzKCkuZGltZW5zaW9uLnkgPiB4QXhpc1RoaWNrbmVzcykge1xuICAgICAgICAgICAgICAgIC8vIFJlLWxheW91dCB5LWF4aXMgaWYgeC1heGlzIGJlY2FtZSB0aGlja2VyIHRoYW4gaXRzICdvcmlnaW5hbCB0aGlja25lc3MnLlxuICAgICAgICAgICAgICAgIHlBeGlzSW5mbyA9IGNvbXB1dGVZQXhpc0luZm8oXG4gICAgICAgICAgICAgICAgICAgIHlBeGlzTGF5b3V0LFxuICAgICAgICAgICAgICAgICAgICBnZW9tQm91bmRzKFxuICAgICAgICAgICAgICAgICAgICAgICAgeEF4aXNJbmZvLmF4aXNCb3VuZHMoKS5kaW1lbnNpb24ueSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHlBeGlzVGhpY2tuZXNzLFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxvdFNpemVcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIFBhaXIoeEF4aXNJbmZvLCB5QXhpc0luZm8pXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBjb21wdXRlWEF4aXNJbmZvKFxuICAgICAgICAgICAgYXhpc0xheW91dDogQXhpc0xheW91dCxcbiAgICAgICAgICAgIHBsb3RTaXplOiBEb3VibGVWZWN0b3IsXG4gICAgICAgICAgICBnZW9tQm91bmRzOiBEb3VibGVSZWN0YW5nbGVcbiAgICAgICAgKTogQXhpc0xheW91dEluZm8ge1xuICAgICAgICAgICAgdmFsIGF4aXNMZW5ndGggPSBnZW9tQm91bmRzLmRpbWVuc2lvbi54XG4gICAgICAgICAgICB2YWwgc3RyZXRjaCA9IGF4aXNMZW5ndGggKiBBWElTX1NUUkVUQ0hfUkFUSU9cbiAgICAgICAgICAgIHZhbCBtYXhUaWNrTGFiZWxzQm91bmRzID0gbWF4VGlja0xhYmVsc0JvdW5kcyhcbiAgICAgICAgICAgICAgICBPcmllbnRhdGlvbi5CT1RUT00sXG4gICAgICAgICAgICAgICAgc3RyZXRjaCxcbiAgICAgICAgICAgICAgICBnZW9tQm91bmRzLFxuICAgICAgICAgICAgICAgIHBsb3RTaXplXG4gICAgICAgICAgICApXG4gICAgICAgICAgICByZXR1cm4gYXhpc0xheW91dC5kb0xheW91dChnZW9tQm91bmRzLmRpbWVuc2lvbiwgbWF4VGlja0xhYmVsc0JvdW5kcylcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGNv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GVuZ3RoKVxuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBmdW4gY3JlYXRlKFxuICAgICAgICAgICAgb3JpZW50YXRpb246IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ1aWxkZXIuZ3VpZGUuT3JpZW50YXRpb24sXG4gICAgICAgICAgICBheGlzRG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LCBicmVha3NQcm92aWRlcjogQXhpc0JyZWFrc1Byb3ZpZGVyLCB0aGVtZTogQXhpc1RoZW1lXG4gICAgICAgICk6IEF4aXNMYXlvdXRlciB7XG5cbiAgICAgICAgICAgIGlmIChvcmllbnRhdGlvbi5pc0hvcml6b250YWwpIHtcbiAgICAgICAgICAgICAgICB2YWwgbGFiZWxzTGF5b3V0OiBBeGlzTGFiZWxzTGF5b3V0ID0gaWYgKGJyZWFrc1Byb3ZpZGVyLmlzRml4ZWRCcmVha3MpIHtcbiAgICAgICAgICAgICAgICAgICAgQXhpc0xhYmVsc0xheW91dC5ob3Jpem9udGFsRml4ZWRCcmVha3MoXG4gICAgICAgICAgICAgICAgICAgICAgICBvcmllbnRhdGlvbixcbiAgICAgICAgICAgICAgICAgICAgICAgIGF4aXNEb21haW4sXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha3NQcm92aWRlci5maXhlZEJyZWFrcyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoZW1lXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBBeGlzTGFiZWxzTGF5b3V0Lmhvcml6b250YWxGbGV4QnJlYWtzKG9yaWVudGF0aW9uLCBheGlzRG9tYWluLCBicmVha3NQcm92aWRlciwgdGhlbWUpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBIb3Jpem9udGFsQXhpc0xheW91dGVyKFxuICAgICAgICAgICAgICAgICAgICBvcmllbnRhdGlvbixcbiAgICAgICAgICAgICAgICAgICAgYXhpc0RvbWFpbixcbiAgICAgICAgICAgICAgICAgICAgbGFiZWxzTGF5b3V0XG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyB2ZXJ0aWNhbFxuICAgICAgICAgICAgdmFsIGxhYmVsc0xheW91dDogQXhpc0xhYmVsc0xheW91dCA9IGlmIChicmVha3NQcm92aWRlci5pc0ZpeGVkQnJlYWtzKSB7XG4gICAgICAgICAgICAgICAgQXhpc0xhYmVsc0xheW91dC52ZXJ0aWNhbEZpeGVkQnJlYWtzKG9yaWVudGF0aW9uLCBheGlzRG9tYWluLCBicmVha3NQcm92aWRlci5maXhlZEJyZWFrcywgdGhlbWUpXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIEF4aXNMYWJlbHNMYXlvdXQudmVydGljYWxGbGV4QnJlYWtzKG9yaWVudGF0aW9uLCBheGlzRG9tYWluLCBicmVha3NQcm92aWRlciwgdGhlbWUpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gVmVydGljYWxBeGlzTGF5b3V0ZXIoXG4gICAgICAgICAgICAgICAgb3JpZW50YXRpb24sXG4gICAgICAgICAgICAgICAgYXhpc0RvbWFpbixcbiAgICAgICAgICAgICAgICBsYWJlbHNMYXlvdXRcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjAuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IHRoZSBNSVQgbGljZW5zZSB0aGF0IGNhbiBiZSBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlLlxuICovXG5cbnBhY2thZ2UgamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5sYXlvdXQuYXhpc1xuXG5pbXBvcnQgamV0Yn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pXG4gICAgICAgICAgICByZXN1bHQuYWRkKGJvdW5kcylcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgfVxuXG5cbiAgICBmdW4gY3JlYXRlQXhpc0xhYmVsc0xheW91dEluZm9CdWlsZGVyKGJvdW5kczogRG91YmxlUmVjdGFuZ2xlLCBvdmVybGFwOiBCb29sZWFuKTogQXhpc0xhYmVsc0xheW91dEluZm8uQnVpbGRlciB7XG4gICAgICAgIHJldHVybiBBeGlzTGFiZWxzTGF5b3V0SW5mby5CdWlsZGVyKClcbiAgICAgICAgICAgIC5icmVha3MoYnJlYWtzKVxuICAgICAgICAgICAgLmJvdW5kcyhhcHBseUxhYmVsc09mZnNldChib3VuZHMpKVxuICAgICAgICAgICAgLnNtYWxsRm9udChmYWxzZSlcbiAgICAgICAgICAgIC5vdmVybGFwKG92ZXJsYXApXG4gICAgfVxuXG4gICAgZnVuIG5vTGFiZWxzTGF5b3V0SW5mbyhcbiAgICAgICAgYXhpc0xlbmd0aDogRG91YmxlLFxuICAgICAgICBvcmllbnRhdGlvbjogamV0YnJhaW5zLmRhdGFsb3JlLnBsb3QuYnVpbGRlci5ndWlkZS5PcmllbnRhdGlvblxuICAgICk6IEF4aXNMYWJlbHNMYXlvdXRJbmZvIHtcbiAgICAgICAgaWYgKG9yaWVudGF0aW9uLmlzSG9yaXpvbnRhbCkge1xuICAgICAgICAgICAgdmFyIGJvdW5kcyA9IERvdWJsZVJlY3RhbmdsZShheGlzTGVuZ3RoIC8gMiwgMC4wLCAwLjAsIDAuMCkgLy8gZW1wdHkgYm91bmRzIGluIHRoZSBtaWRkbGUgb2YgdGhlIGF4aXM7XG4gICAgICAgICAgICBib3VuZHMgPSBhcHBseUxhYmVsc09mZnNldChib3VuZHMpXG4gICAgICAgICAgICByZXR1cm4gQXhpc0xhYmVsc0xheW91dEluZm8uQnVpbGRlcigpXG4gICAgICAgICAgICAgICAgLmJyZWFrcyhicmVha3MpXG4gICAgICAgICAgICA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k9yaWVudGF0aW9uLFxuICAgICAgICAgICAgYXhpc0RvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPiwgYnJlYWtzUHJvdmlkZXI6IEF4aXNCcmVha3NQcm92aWRlciwgdGhlbWU6IEF4aXNUaGVtZVxuICAgICAgICApOiBBeGlzTGFiZWxzTGF5b3V0IHtcblxuICAgICAgICAgICAgcmVxdWlyZShvcmllbnRhdGlvbi5pc0hvcml6b250YWwpIHsgb3JpZW50YXRpb24udG9TdHJpbmcoKSB9XG4gICAgICAgICAgICByZXF1aXJlKCFicmVha3NQcm92aWRlci5pc0ZpeGVkQnJlYWtzKSB7IFwiZml4ZWQgYnJlYWtzXCIgfVxuICAgICAgICAgICAgcmV0dXJuIEhvcml6b250YWxGbGV4QnJlYWtzTGFiZWxzTGF5b3V0KFxuICAgICAgICAgICAgICAgIG9yaWVudGF0aW9uLFxuICAgICAgICAgICAgICAgIGF4aXNEb21haW4sXG4gICAgICAgICAgICAgICAgVElDS19MQUJFTF9TUEVDLFxuICAgICAgICAgICAgICAgIGJyZWFrc1Byb3ZpZGVyLFxuICAgICAgICAgICAgICAgIHRoZW1lXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaG9yaXpvbnRhbEZpeGVkQnJlYWtzKFxuICAgICAgICAgICAgb3JpZW50YXRpb246IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ1aWxkZXIuZ3VpZGUuT3JpZW50YXRpb24sXG4gICAgICAgICAgICBheGlzRG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LCBicmVha3M6IFNjYWxlQnJlYWtzLCB0aGVtZTogQXhpc1RoZW1lXG4gICAgICAgICk6IEF4aXNMYWJlbHNMYXlvdXQge1xuXG4gICAgICAgICAgICByZXF1aXJlKG9yaWVudGF0aW9uLmlzSG9yaXpvbnRhbCkgeyBvcmllbnRhdGlvbi50b1N0cmluZygpIH1cbiAgICAgICAgICAgIHJldHVybiBIb3Jpem9udGFsRml4ZWRCcmVha3NMYWJlbHNMYXlvdXQoXG4gICAgICAgICAgICAgICAgb3JpZW50YXRpb24sXG4gICAgICAgICAgICAgICAgYXhpc0RvbWFpbixcbiAgICAgICAgICAgICAgICBUSUNLX0xBQkVMX1NQRUMsXG4gICAgICAgICAgICAgICAgYnJlYWtzLFxuICAgICAgICAgICAgICAgIHRoZW1lXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdmVydGljYWxGbGV4QnJlYWtzKFxuICAgICAgICAgICAgb3JpZW50YXRpb246IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ1aWxkZXIuZ3VpZGUuT3JpZW50YXRpb24sXG4gICAgICAgICAgICBheGlzRG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LCBicmVha3NQcm92aWRlcjogQXhpc0JyZWFrc1Byb3ZpZGVyLCB0aGVtZTogQXhpc1RoZW1lXG4gICAgICAgICk6IEF4aXNMYWJlbHNMYXlvdXQge1xuXG4gICAgICAgICAgICByZXF1aXJlKCFvcmllbnRhdGlvbi5pc0hvcml6b250YWwpIHsgb3JpZW50YXRpb24udG9TdHJpbmcoKSB9XG4gICAgICAgICAgICByZXF1aXJlKCFicmVha3NQcm92aWRlci5pc0ZpeGVkQnJlYWtzKSB7IFwiZml4ZWQgYnJlYWtzXCIgfVxuICAgICAgICAgICAgcmV0dXJuIFZlcnRpY2FsRmxleEJyZWFrc0xhYmVsc0xheW91dChcbiAgICAgICAgICAgICAgICBvcmllbnRhdGlvbixcbiAgICAgICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgICAgIFRJQ0tfTEFCRUxfU1BFQyxcbiAgICAgICAgICAgICAgICBicmVha3NQcm92aWRlcixcbiAgICAgICAgICAgICAgICB0aGVtZVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHZlcnRpY2FsRml4ZWRCcmVha3MoXG4gICAgICAgICAgICBvcmllbnRhdGlvbjogamV0Y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JvdW5kczogRG91YmxlUmVjdGFuZ2xlKTogQnVpbGRlciB7XG4gICAgICAgICAgICBteUJvdW5kcyA9IGJvdW5kc1xuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBzbWFsbEZvbnQoYjogQm9vbGVhbik6IEJ1aWxkZXIge1xuICAgICAgICAgICAgbXlTbWFsbEZvbnQgPSBiXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIG92ZXJsYXAoYjogQm9vbGVhbik6IEJ1aWxkZXIge1xuICAgICAgICAgICAgbXlPdmVybGFwID0gYlxuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBsYWJlbEFkZGl0aW9uYWxPZmZzZXRzKGw6IExpc3Q8RG91YmxlVmVjdG9yPj8pOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIG15TGFiZWxBZGRpdGlvbmFsT2Zmc2V0cyA9IGxcbiAgICAgICAgICAgIHJldHVybiB0aGlzXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gbGFiZWxIb3Jpem9udGFsQW5jaG9yKGFuY2hvcjogVGV4dExhYmVsLkhvcml6b250YWxBbmNob3IpOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIG15TGFiZWxIb3Jpem9udGFsQW5jaG9yID0gYW5jaG9yXG4gICAgICAgICAgICByZXR1cm4gdGhpc1xuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGxhYmVsVmVydGljYWxBbmNob3IoYW5jaG9yOiBUZXh0TGFiZWwuVmVydGljYWxBbmNob3IpOiBCdWlsZGVyIHtcbiAgICAgICAgICAgIG15TGFiZWxWZXJ0aWNhbEFuY2hvciA9IGFuY2hvclxuICAgICAgICAgICAgcmV0dXJuIHRoaXNcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBsYWJlbFJvdGF0aW9uQW5nbGUoYW5nbGU6IERvdWJsZ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W91dC5heGlzLkF4aXNCcmVha3NQcm92aWRlclxuaW1wb3J0IGpldGJyYWlucy5kYXRhbG9yZS5wbG90LmJ1aWxkZXIudGhlbWUuQXhpc1RoZW1lXG5pbXBvcnQga290bGluLm1hdGgubWF4XG5pbXBvcnQga290bGluLm1hdGgubWluXG5cbmludGVybmFsIG9iamVjdCBCcmVha0xhYmVsc0xheW91dFV0aWwge1xuXG4gICAgZnVuIGdldEZsZXhCcmVha3MoYnJlYWtzUHJvdmlkZXI6IEF4aXNCcmVha3NQcm92aWRlciwgbWF4Q291bnQ6IEludCwgYXhpc0xlbmd0aDogRG91YmxlKTogU2NhbGVCcmVha3Mge1xuICAgICAgICByZXF1aXJlKCFicmVha3NQcm92aWRlci5pc0ZpeGVkQnJlYWtzKSB7IFwiZml4ZWQgYnJlYWtzIG5vdCBleHBlY3RlZFwiIH1cbiAgICAgICAgcmVxdWlyZShtYXhDb3VudCA+IDApIHsgXCJtYXhDb3VudD0kbWF4Q291bnRcIiB9XG4gICAgICAgIHZhciBicmVha3MgPSBicmVha3NQcm92aWRlci5nZXRCcmVha3MobWF4Q291bnQsIGF4aXNMZW5ndGgpXG5cbiAgICAgICAgaWYgKG1heENvdW50ID09IDEgJiYgIWJyZWFrcy5pc0VtcHR5KSB7XG4gICAgICAgICAgICByZXR1cm4gU2NhbGVCcmVha3MoXG4gICAgICAgICAgICAgICAgYnJlYWtzLmRvbWFpblZhbHVlcy5zdWJMaXN0KDAsIDEpLFxuICAgICAgICAgICAgICAgIGJyZWFrcy50cmFuc2Zvcm1lZFZhbHVlcy5zdWJMaXN0KDAsIDEpLFxuICAgICAgICAgICAgICAgIGJyZWFrcy5sYWJlbHMuc3ViTGlzdCgwLCAxKVxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgICAgIHZhciBjb3VudCA9IG1heENvdW50XG4gICAgICAgIHdoaWxlIChicmVha3Muc2l6ZSA+IG1heENvdW50KSB7XG4gICAgICAgICAgICB2YWwgZGVsdGEgPSBt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aGVuIHtcbiAgICAgICAgICAgIHRoZW1lLnNob3dUaWNrTGFiZWxzKCkgLT4ge1xuICAgICAgICAgICAgICAgIHZhbCBsYWJlbHNCb3VuZHMgPVxuICAgICAgICAgICAgICAgICAgICB2ZXJ0aWNhbEF4aXNMYWJlbHNCb3VuZHMoXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha3MsXG4gICAgICAgICAgICAgICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgICAgICAgICAgICAgYXhpc01hcHBlclxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgYXBwbHlMYWJlbHNPZmZzZXQoXG4gICAgICAgICAgICAgICAgICAgIGxhYmVsc0JvdW5kcyxcbiAgICAgICAgICAgICAgICAgICAgdGhlbWUudGlja0xhYmVsRGlzdGFuY2UoKSxcbiAgICAgICAgICAgICAgICAgICAgb3JpZW50YXRpb25cbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGVtZS5zaG93VGlja01hcmtzKCkgLT4ge1xuICAgICAgICAgICAgICAgIHZhbCBsYWJlbHNCb3VuZHMgPSBEb3VibGVSZWN0YW5nbGUoRG91YmxlVmVjdG9yLlpFUk8sIERvdWJsZVZlY3Rvci5aRVJPKVxuICAgICAgICAgICAgICAgIGFwcGx5TGFiZWxzT2Zmc2V0KFxuICAgICAgICAgICAgICAgICAgICBsYWJlbHNCb3VuZHMsXG4gICAgICAgICAgICAgICAgICAgIHRoZW1lLnRpY2tMYWJlbERpc3RhbmNlKCksXG4gICAgICAgICAgICAgICAgICAgIG9yaWVudGF0aW9uXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSAtPiBEb3VibGVSZWN0YW5nbGUoRG91YmxlVmVjdG9yLlpFUk8sIERvdWJsZVZlY3Rvci5aRVJPKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIEF4aXNMYWJlbHNMYXlvdXR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VjdG9yID0gd2hlbiAob3JpZW50YXRpb24pIHtcbiAgICAgICAgICAgIExFRlQgLT4gRG91YmxlVmVjdG9yKC1vZmZzZXQsIDAuMClcbiAgICAgICAgICAgIFJJR0hUIC0+IERvdWJsZVZlY3RvcihvZmZzZXQsIDAuMClcbiAgICAgICAgICAgIFRPUCAtPiBEb3VibGVWZWN0b3IoMC4wLCAtb2Zmc2V0KVxuICAgICAgICAgICAgQk9UVE9NIC0+IERvdWJsZVZlY3RvcigwLjAsIG9mZnNldClcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChvcmllbnRhdGlvbiA9PT0gUklHSFQgfHwgb3JpZW50YXRpb24gPT09IEJPVFRPTSkge1xuICAgICAgICAgICAgbGFiZWxzQm91bmRzID0gbGFiZWxzQm91bmRzLmFkZChvZmZzZXRWZWN0b3IpXG4gICAgICAgIH0gZWxzZSBpZiAob3JpZW50YXRpb24gPT09IExFRlQgfHwgb3JpZW50YXRpb24gPT09IFRPUCkge1xuICAgICAgICAgICAgbGFiZWxzQm91bmRzID0gbGFiZWxzQm91bmRzLmFkZChvZmZzZXRWZWN0b3IpLnN1YnRyYWN0KERvdWJsZVZlY3RvcihsYWJlbHNCb3VuZHMud2lkdGgsIDAuMCkpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbGFiZWxzQm91bmRzXG4gICAgfVxuXG5cbiAgICBwcml2YXRlIGZ1biB2ZXJ0aWNhbEF4aXNMYWJlbHNCb3VuZHMoXG4gICAgICAgIGJyZWFrczogU2NhbGVCcmVha3MsXG4gICAgICAgIGF4aXNEb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIGF4aXNNYXBwZXI6IChEb3VibGU/KSAtPiBEb3VibGU/XG4gICAgKTogRG91YmxlUmVjdGFuZ2xlIHtcbiAgICAgICAgdmFsIG1heExlbmd0aCA9XG4gICAgICAgICAgICBtYXhMZW5ndGgoYnJlYWtzLmxhYmVscylcbiAgICAgICAgdmFsIG1heExhYmVs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2ltcGxlTGF5b3V0KCkuZG9MYXlvdXQoYXhpc0xlbmd0aCwgYXhpc01hcHBlciwgbWF4TGFiZWxzQm91bmRzKVxuICAgICAgICBpZiAob3ZlcmxhcChsYWJlbHNJbmZvLCBtYXhMYWJlbHNCb3VuZHMpKSB7XG4gICAgICAgICAgICBsYWJlbHNJbmZvID0gbXVsdGlsaW5lTGF5b3V0KCkuZG9MYXlvdXQoYXhpc0xlbmd0aCwgYXhpc01hcHBlciwgbWF4TGFiZWxzQm91bmRzKVxuICAgICAgICAgICAgaWYgKG92ZXJsYXAobGFiZWxzSW5mbywgbWF4TGFiZWxzQm91bmRzKSkge1xuICAgICAgICAgICAgICAgIGxhYmVsc0luZm8gPSB0aWx0ZWRMYXlvdXQoKS5kb0xheW91dChheGlzTGVuZ3RoLCBheGlzTWFwcGVyLCBtYXhMYWJlbHNCb3VuZHMpXG4gICAgICAgICAgICAgICAgaWYgKG92ZXJsYXAobGFiZWxzSW5mbywgbWF4TGFiZWxzQm91bmRzKSkge1xuICAgICAgICAgICAgICAgICAgICBsYWJlbHNJbmZvID0gdmVydGljYWxMYXlvdXQobGFiZWxTcGVjKS5kb0xheW91dChheGlzTGVuZ3RoLCBheGlzTWFwcGVyLCBtYXhMYWJlbHNCb3VuZHMpXG4gICAgICAgICAgICAgICAgICAgIGlmIChvdmVybGFwKGxhYmVsc0luZm8sIG1heExhYmVsc0JvdW5kcykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsc0luZm8gPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnRpY2FsTGF5b3V0KFRJQ0tfTEFCRUxfU1BFQ19TTUFMTCkuZG9MYXlvdXQoYXhpc0xlbmd0aCwgYXhpc01hcHBlciwgbWF4TGFiZWxzQm91bmRzKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBsYWJlbHNJbmZvXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gc2ltcGxlTGF5b3V0KCk6IEF4aXNMYWJlbHNMYXlvdXQge1xuICAgICAgICByZXR1cm4gSG9yaXpvbnRhbFNpbXBsZUxhYmVsc0xheW91dChcbiAgICAgICAgICAgIG9yaWVudGF0aW9uLFxuICAgICAgICAgICAgYXhpc0RvbWFpbixcbiAgICAgICAgICAgIGxhYmVsU3BlYyxcbiAgICAgICAgICAgIGJyZWFrcyxcbiAgICAgICAgICAgIHRoZW1lXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBtdWx0aWxpbmVMYXlvdXQoKTogQXhpc0xhYmVsc0xheW91dCB7XG4gICAgICAgIHJldHVybiBIb3Jpem9udGFsTXVsdGlsaW5lTGFiZWxzTGF5b3V0KFxuICAgICAgICAgICAgb3JpZW50YXRpb24sXG4gICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgbGFiZWxTcGVjLFxuICAgICAgICAgICAgYnJlYWtzLFxuICAgICAgICAgICAgdGhlbWUsXG4gICAgICAgICAgICAyXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB0aWx0ZWRMYXlvdXQoKTogQXhpc0xhYmVsc0xheW91dCB7XG4gICAgICAgIHJldHVybiBIb3Jpem9udGFsVGlsdGVkTGFiZWxzTGF5b3V0KFxuICAgICAgICAgICAgb3JpZW50YXRpb24sXG4gICAgICAgICAgICBheGlzRG9tYWluLFxuICAgICAgICAgICAgbGFiZWxTcGVjLFxuICAgICAgICAgICAgYnJlYWtzLFxuICAgICAgICAgICAgdGhlbWVcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHZlcnRpY2FsTGF5b3V0KGxhYmVsU3BlYzogUGxvdExhYmVsU3BlYyk6IEF4aXNMYWJlbHNMYXlvdXQge1xuICAgICAgICByZXR1cm4gSG9yaXpvbnRhbFZlcnRpY2FsTGFiZWxzTGF5b3V0KFxuICA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gICAgICAgICBheGlzTGVuZ3RoXG4gICAgICAgICAgICApXG4gICAgICAgIHZhciBicmVha3MgPSBnZXRCcmVha3ModGFyZ2V0QnJlYWtDb3VudCwgYXhpc0xlbmd0aClcbiAgICAgICAgdmFyIGxhYmVsc0luZm8gPSBkb0xheW91dExhYmVscyhicmVha3MsIGF4aXNMZW5ndGgsIGF4aXNNYXBwZXIsIG1heExhYmVsc0JvdW5kcylcblxuICAgICAgICB3aGlsZSAobGFiZWxzSW5mby5pc092ZXJsYXApIHtcbiAgICAgICAgICAgIC8vIHJlZHVjZSB0aWNrIGNvdW50XG4gICAgICAgICAgICB2YWwgbmV3VGFyZ2V0QnJlYWtDb3VudCA9XG4gICAgICAgICAgICAgICAgSG9yaXpvbnRhbFNpbXBsZUxhYmVsc0xheW91dC5lc3RpbWF0ZUJyZWFrQ291bnQoXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrcy5sYWJlbHMsXG4gICAgICAgICAgICAgICAgICAgIGF4aXNMZW5ndGhcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICBpZiAobmV3VGFyZ2V0QnJlYWtDb3VudCA+PSB0YXJnZXRCcmVha0NvdW50KSB7XG4gICAgICAgICAgICAgICAgLy8gcGFyYW5vaWQgLSBoaWdobHkgaW1wb3NzaWJsZS5cbiAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGFyZ2V0QnJlYWtDb3VudCA9IG5ld1RhcmdldEJyZWFrQ291bnRcbiAgICAgICAgICAgIGJyZWFrcyA9IGdldEJyZWFrcyh0YXJnZXRCcmVha0NvdW50LCBheGlzTGVuZ3RoKVxuICAgICAgICAgICAgbGFiZWxzSW5mbyA9IGRvTGF5b3V0TGFiZWxzKGJyZWFrcywgYXhpc0xlbmd0aCwgYXhpc01hcHBlciwgbWF4TGFiZWxzQm91bmRzKVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGxhYmVsc0luZm9cbiAgICB9XG5cbiA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oXG4gICAgICAgICAgICB0aWNrcywgYnJlYWtzLmxhYmVscyxcbiAgICAgICAgICAgIEhPUklaT05UQUxfVElDS19MT0NBVElPTlxuICAgICAgICApXG5cbiAgICAgICAgZm9yIChsYWJlbEJvdW5kcyBpbiBib3VuZHNMaXN0KSB7XG4gICAgICAgICAgICAvLyBmaW5kIHNoZWxmIHdpdGggbm8gb3ZlcmxhcFxuICAgICAgICAgICAgdmFyIHNoZWxmSW5kZXggPSAwXG4gICAgICAgICAgICB3aGlsZSAodHJ1ZSkge1xuICAgICAgICAgICAgICAgIGlmICghYm91bmRzQnlTaGVsZkluZGV4LmNvbnRhaW5zS2V5KHNoZWxmSW5kZXgpKSB7XG4gICAgICAgICAgICAgICAgICAgIGJvdW5kc0J5U2hlbGZJbmRleFtzaGVsZkluZGV4XSA9IGxhYmVsQm91bmRzXG4gICAgICAgICAgICAgICAgICAgIG15U2hlbGZJbmRleEZvclRpY2tJbmRleC5hZGQoc2hlbGZJbmRleClcbiAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB2YXIgc2hlbGZCb3VuZHMgPSBib3VuZHNCeVNoZWxmSW5kZXhbc2hlbGZJbmRleF0hIVxuICAgICAgICAgICAgICAgIC8vIG5vdCBvdmVybGFwcGVkP1xuICAgICAgICAgICAgICAgIGlmICghc2hlbGZCb3VuZHMueFJhbmdlKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5pc0Nvbm5lY3RlZChDbG9zZWRSYW5nZShsYWJlbEJvdW5kcy5sZWZ0IC0gTUlOX0RJU1RBTkNFLCBsYWJlbEJvdW5kcy5yaWdodCArIE1JTl9ESVNUQU5DRSkpXG4gICAgICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgICAgIG15U2hlbGZJbmRleEZvclRpY2tJbmRleC5hZGQoc2hlbGZJbmRleClcbiAgICAgICAgICAgICAgICAgICAgc2hlbGZCb3VuZHMgPSBzaGVsZkJvdW5kcy51bmlvbihsYWJlbEJvdW5kcylcbiAgICAgICAgICAgICAgICAgICAgYm91bmRzQnlTaGVsZkluZGV4W3NoZWxmSW5kZXhdID0gc2hlbGZCb3VuZHNcbiAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBzaGVsZkluZGV4KytcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBib3VuZHMgPSBpZiAoYm91bmRzQnlTaGVsZkluZGV4LmlzRW1wdHkoKSlcbiAgICAgICAgICAgIERvdWJsZVJlY3RhbmdsZShEb3VibGVWZWN0b3IuWkVSTywgRG91YmxlVmVjdG9yLlpFUk8pXG4gICAgICAgIGVsc2VcbiAgICAgICAgICAgIGJvdW5kc0J5U2hlbGZJbmRleFswXSEhXG4gICAgICAgIHZhbCBoID0gbGFiZWxTcGVjLmhlaWdodCgpICogTElORV9IRUlHSFRcbiAgICAgICAgZm9yIChpIGluIDAgdW50aWwgYm91bmRzQnlTaGVsZkluZGV4LnNpemUpIHtcbiAgICAgICAgICAgIHZhbCBzaGVsZkJvdW5kcyA9IGJvdW5kc0J5U2hlbGZJbmRleFtpXSEhXG4gICAgICAgICAgICBib3VuZHMgPSBib3VuZHMudW5pb24oc2hlbGZCb3VuZHMuYWRkKERvdWJsZVZlY3RvcigwLjAsIGkgKiBoKSkpXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbGluZXNDb3VudCA9IGJvdW5kc0J5U2hlbGZJbmRleC5zaXplXG4gICAgICAgIHJldHVybiBBeGlzTGFiZWxzTGF5b3V0SW5mby5CdWlsZGVyKClcbiAgICAgICAgICAgIC5icmVha3MoYnJlYWtzKVxuICAgICAgICAgICAgLmJvdW5kcyhhcHBseUxhYmVsc09mZnNldChib3VuZHMpKVxuICAgICAgICAgICAgLnNtYWxsRm9udChmYWxzZSlcbiAgICAgICAgICAgIC5vdmVybGFwKGxpbmVzQ291bnQgPiBte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Chib3VuZHMsIG15VGhlbWUudGlja0xhYmVsRGlzdGFuY2UoKSwgZ2V0T3JpZW50YXRpb24oKSk7XG4gICAgcmV0dXJuIG5ldyBBeGlzTGFiZWxzTGF5b3V0SW5mby5CdWlsZGVyKClcbiAgICAgICAgLmJyZWFrcyhnZXRCcmVha3MoKSlcbiAgICAgICAgLy8uYm91bmRzKGFwcGx5TGFiZWxzT2Zmc2V0KGJvdW5kcykpXG4gICAgICAgIC5ib3VuZHMoYm91bmRzKVxuICAgICAgICAuc21hbGxGb250KGZhbHNlKVxuICAgICAgICAub3ZlcmxhcChmYWxzZSlcbiAgICAgICAgLmxhYmVsQWRkaXRpb25hbE9mZnNldHMobnVsbClcbiAgICAgICAgLmxhYmVsSG9yaXpvbnRhbEFuY2hvcihUZXh0TGFiZWwuSG9yaXpvbnRhbEFuY2hvci5NSURETEUpXG4gICAgICAgIC5sYWJlbFZlcnRpY2FsQW5jaG9yKFRleHRMYWJlbC5WZXJ0aWNhbEFuY2hvci5UT1ApXG4gICAgICAgIC5idWlsZCgpO1xuICB9XG4gICovXG5cbiAgICBvdmVycmlkZSBmdW4gbGFiZWxCb3VuZHMobGFiZWxOb3JtYWxTaXplOiBEb3VibGVWZWN0b3IpOiBEb3VibGVSZWN0YW5nbGUge1xuICAgICAgICByZXR1cm4gQnJlYWtMYWJlbHNMYXlvdXRVdGlsLmhvcml6b250YWxDZW50ZXJlZExhYmVsQm91bmRzKFxuICAgICAgICAgICAgbGFiZWxOb3JtYWxTaXplXG4gICAgICAgIClcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgZnVuIGVzdGltYXRlQnJlYWtDb3VudEluaXRpYWwoYXhpc0xlbmd0aDogRG91YmxlKTogSW50IHtcbiAgICAgICAgICAgIHJldHVybiBlc3RpbWF0ZUJyZWFrQ291bnQoXG4gICAgICAgICAgICAgICAgSU5JVElBTF9USUNLX0xBQkVMX0xFTkdUSCxcbiAgICAgICAgICAgICAgICBheGlzTGVuZ3RoXG4gICAgICAgICAgICApXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZXN0aW1hdGVCcmVha0NvdW50KGxhYmVsczogTGlzdDxTdHJpbmc+LCBheGlzTGVuZ3RoOiBEb3VibGUpOiBJbnQge1xuICAgICAgICAgICAgdmFsIG1heExlbmd0aCA9XG4gICAgICAgICAgICAgICAgQnJlYWtMYWJlbHNMYXlvdXRVdGlsLm1heExlbmd0aChcbiAgICAgICAgICAgICAgICAgICAgbGFiZWxzXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgcmV0dXJuIGVzdGltYXRlQnJlYWtDb3VudChcbiAgICAgICAgICAgICAgICBtYXhMZW5ndGgsXG4gICAgICAgICAgICAgICAgYXhpc0xlbmd0aFxuICAgICAgICAgICAgKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gZXN0aW1hdGVCcmVha0NvdW50KGxhYmVsTGVuZ3RoOiBJbnQsIGF4aXNMZW5ndGg6IERvdWJsZSk6IEludCB7XG4gICAgICAgICAgICB2YWwgdGlja0Rpc3RhbmNlID0gVElDS19MQUJFTF9TUEVDLndpZHRoKGxhYmVsTGVuZ3RoKSArIE1JTl9USUNLX0xBQkVMX0RJU1RBTkNFXG4gICAgICAgICAgICByZXR1cm4gbWF4KDEuMCwgYXhpc0xlbmd0aCAvIHRpY2tEaXN0YW5jZSkudG9JbnQoKVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLmxheW91dC5heGlzLmxhYmVsXG5cbmltcG9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49IDIpIHtcbiAgICAgICAgICAgIHZhbCBtaW5UaWNrRGlzdGFuY2UgPSBhYnMoKGhlaWdodCArIE1JTl9ESVNUQU5DRSkgLyBTSU4pXG4gICAgICAgICAgICB2YWwgdGlja0Rpc3RhbmNlID0gYWJzKHRpY2tzWzBdIC0gdGlja3NbMV0pXG4gICAgICAgICAgICBvdmVybGFwID0gdGlja0Rpc3RhbmNlIDwgbWluVGlja0Rpc3RhbmNlXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgYm91bmRzID0gbGFiZWxzQm91bmRzKFxuICAgICAgICAgICAgdGlja3MsIGJyZWFrcy5sYWJlbHMsXG4gICAgICAgICAgICBIT1JJWk9OVEFMX1RJQ0tfTE9DQVRJT05cbiAgICAgICAgKVxuICAgICAgICByZXR1cm4gY3JlYXRlQXhpc0xhYmVsc0xheW91dEluZm9CdWlsZGVyKGJvdW5kcyEhLCBvdmVybGFwKVxuICAgICAgICAgICAgLmxhYmVsSG9yaXpvbnRhbEFuY2hvcihsYWJlbEhvcml6b250YWxBbmNob3IpXG4gICAgICAgICAgICAubGFiZWxWZXJ0aWNhbEFuY2hvcihsYWJlbFZlcnRpY2FsQW5jaG9yKVxuICAgICAgICAgICAgLmxhYmVsUm90YXRpb25BbmdsZShST1RBVElPTl9ERUdSRUUpXG4gICAgICAgICAgICAuYnVpbGQoKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBsYWJlbEJvdW5kcyhsYWJlbE5vcm1hbFNpemU6IERvdWJsZVZlY3Rvcik6IERvdWJsZVJlY3RhbmdsZSB7XG4gICAgICAgIC8vIG9ubHkgd29ya3MgZm9yIFJJR0hULVRPUCBhbmNob3IgYW5nIGFuZ2xlIDAuLi4tOTBcbiAgICAgICAgaWYgKCEoUk9UQVRJT05fREVHUkVFID49IC05MCAmJiBST1RBVElPTl9ERUdSRUUgPD0gMFxuICAgICAgICAgICAgICAgICAgICAmJiBsYWJlbEhvcml6b250YWxBbmNob3IgPT09IFRleHRMYWJl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gICAgdmFyIG92ZXJsYXAgPSBmYWxzZVxuICAgICAgICBpZiAoYnJlYWtzLnNpemUgPj0gMikge1xuICAgICAgICAgICAgdmFsIG1pblRpY2tEaXN0YW5jZSA9IGhlaWdodCArIE1JTl9ESVNUQU5DRVxuICAgICAgICAgICAgdmFsIHRpY2tEaXN0YW5jZSA9IGFicyh0aWNrc1swXSAtIHRpY2tzWzFdKVxuICAgICAgICAgICAgb3ZlcmxhcCA9IHRpY2tEaXN0YW5jZSA8IG1pblRpY2tEaXN0YW5jZVxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIGJvdW5kcyA9IGxhYmVsc0JvdW5kcyhcbiAgICAgICAgICAgIHRpY2tzLCBicmVha3MubGFiZWxzLFxuICAgICAgICAgICAgSE9SSVpPTlRBTF9USUNLX0xPQ0FUSU9OXG4gICAgICAgIClcbiAgICAgICAgcmV0dXJuIGNyZWF0ZUF4aXNMYWJlbHNMYXlvdXRJbmZvQnVpbGRlcihib3VuZHMhISwgb3ZlcmxhcClcbiAgICAgICAgICAgIC5sYWJlbEhvcml6b250YWxBbmNob3IobGFiZWxIb3Jpem9udGFsQW5jaG9yKVxuICAgICAgICAgICAgLmxhYmVsVmVydGljYWxBbmNob3IobGFiZWxWZXJ0aWNhbEFuY2hvcilcbiAgICAgICAgICAgIC5sYWJlbFJvdGF0aW9uQW5nbGUoUk9UQVRJT05fREVHUkVFKVxuICAgICAgICAgICAgLmJ1aWxkKClcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gbGFiZWxCb3VuZHMobGFiZWxOb3JtYWxTaXplOiBEb3VibGVWZWN0b3IpOiBEb3VibGVSZWN0YW5nbGUge1xuICAgICAgICBpZiAoIShST1RBVElPTl9ERUdSRUUgPT0gOTAuMFxuICAgICAgICAgICAgICAgICAgICAmJiBsYWJlbEhvcml6b250YWxBbmNob3IgPT09IFRleHRMYWJlbC5Ib3Jpem9udGFsQW5jaG9yLkxFRlRcbiAgICAgICAgICAgICAgICAgICAgJiYg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Db21tb24ge1xuICAgICAgICBvYmplY3QgVGl0bGUge1xuICAgICAgICAgICAgY29uc3QgdmFsIEZPTlRfU0laRSA9IEZPTlRfTEFSR0VcbiAgICAgICAgICAgIHZhbCBGT05UX1NJWkVfQ1NTID0gXCJcIiArIEZPTlRfU0laRSArIFwicHhcIlxuICAgICAgICB9XG5cbiAgICAgICAgb2JqZWN0IExlZ2VuZCB7XG4gICAgICAgICAgICBjb25zdCB2YWwgVElUTEVfRk9OVF9TSVpFID1cbiAgICAgICAgICAgICAgICBGT05UX01FRElVTVxuICAgICAgICAgICAgY29uc3QgdmFsIElURU1fRk9OVF9TSVpFID1cbiAgICAgICAgICAgICAgICBGT05UX1NNQUxMXG4gICAgICAgICAgICB2YWwgT1VUTElORV9DT0xPUiA9IENvbG9yLnBhcnNlSGV4KFhYX0xJR0hUX0dSQVkpXG4gICAgICAgIH1cblxuICAgICAgICBvYmplY3QgVG9vbHRpcCB7XG4gICAgICAgICAgICBjb25zdCB2YWwgTUFYX1BPSU5URVJfRk9PVElOR19MRU5HVEggPSAxMi4wXG4gICAgICAgICAgICBjb25zdCB2YWwgUE9JTlRFUl9GT09USU5HX1RPX1NJREVfTEVOR1RIX1JBVElPID0gMC40XG5cbiAgICAgICAgICAgIGNvbnN0IHZhbCBNQVJHSU5fQkVUV0VFTl9UT09MVElQUyA9IDUuMFxuICAgICAgICAgICAgY29uc3QgdmFsIERBVEFfVE9PTFRJUF9GT05UX1NJWkUgPSBGT05UX01FRElVTVxuICAgICAgICAgICAgY29uc3QgdmFsIExJTkVfSU5URVJWQUwgPSAzLjBcbiAgICAgICAgICAgIGNvbnN0IHZhbCBIX0NPTlRFTlRfUEFERElORyA9IDQuMFxuICAgICAgICAgICAgY29uc3QgdmFsIFZfQ09OVEVOVF9QQURESU5HID0gNC4wXG4gICAgICAgICAgICBjb25zdCB2YWwgTEFCRUxfVkFMVUVfSU5URVJWQUwgPSA4LjBcblxuICAgICAgICAgICAgY29uc3QgdmFsIEJPUkRFUl9XSURUSCA9IDQuMFxuXG4gICAgICAgICAgICB2YWwgREFSS19URVhUX0NPTE9SID0gQ29sb3IuQkxBQ0tcbiAgICAgICAgICAgIHZhbCBMSUdIVF9URVhUX0NPTE9SID0gQ29sb3IuV0hJVEVcblxuICAgICAgICAgICAgY29uc3QgdmFsIEFYSVNfVE9PTFRJUF9GT05UX1NJWkUgPSBEQVRBX1RPT0xUSVBfRk9OVF9TSVpFXG4gICAgICAgICAgICB2YWwgQVhJU19UT09MVElQX0NPTE9SID0gQXhpcy5MSU5FX0NPTE9SXG4gICAgICAgICAgICBjb25zdCB2YWwgQVhJU19SQURJVVMgPSAxLjUgLy8gZml4IGEgdG9vbHRpcCBib3JkZXIgb3ZlcmxhcHBpbmcgYW4gYXhpc1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgY2xhc3MgVGFibGUge1xuICAgICAgICBvYmplY3QgSGVhZCB7XG4gICAgICAgICAgICBjb25zdCB2YWwgRk9OVF9TSVpFID0gRk9OVF9NRURJVU1cbiAgICAgICAgICAgIGNvbnN0IHZhbCBGT05UX1NJWkVfQ1NTID0gXCJcIiArIEZPTlRfU0laRSArIFwicHhcIlxuICAgICAgICB9XG5cbiAgICAgICAgb2JqZWN0IERhdGEge1xuICAgICAgICAgICAgY29uc3QgdmFsIEZPTlRfU0laRSA9IEZPTlRfTUVESVVNXG4gICAgICAgICAgICBjb25zdCB2YWwgRk9OVF9TSVpFX0NTUyA9IFwiXCIgKyBGT05UX1NJWkUgKyBcInB4XCJcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGNsYXNzIFBsb3Qge1xuICAgICAgICBvYmplY3QgQXhpcyB7XG4gICAgICAgICAgICBjb25zdCB2YWwgVElUTEVfRk9OVF9TSVpFID1cbiAgICAgICAgICAgICAgICBGT05UX01FRElVTVxuICAgICAgICAgICAgY29uc3QgdmFsIFRJQ0tfRk9OVF9TSVpFID1cbiAgICAgICAgICAgICAgICBGT05UX1NNQUxMXG4gICAgICAgICAgICBjb25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9vbGVhbiA9IGZhbHNlKSB7XG4gICAgICAgIHRoaXMuZm9udFNpemUgPSBmb250U2l6ZVxuICAgICAgICBpc0JvbGQgPSBib2xkXG4gICAgICAgIGlzTW9ub3NwYWNlZCA9IG1vbm9zcGFjZWRcbiAgICB9XG5cbiAgICBvdmVycmlkZSBmdW4gZGltZW5zaW9ucyhsYWJlbExlbmd0aDogSW50KTogRG91YmxlVmVjdG9yIHtcbiAgICAgICAgcmV0dXJuIERvdWJsZVZlY3Rvcih3aWR0aChsYWJlbExlbmd0aCksIGhlaWdodCgpKVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biB3aWR0aChsYWJlbExlbmd0aDogSW50KTogRG91YmxlIHtcbiAgICAgICAgdmFyIHJhdGlvID1cbiAgICAgICAgICAgIEZPTlRfU0laRV9UT19HTFlQSF9XSURUSF9SQVRJT1xuICAgICAgICBpZiAoaXNNb25vc3BhY2VkKSB7XG4gICAgICAgICAgICByYXRpbyA9XG4gICAgICAgICAgICAgICAgRk9OVF9TSVpFX1RPX0dMWVBIX1dJRFRIX1JBVElPX01PTk9TUEFDRURcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCB3aWR0aCA9IGxhYmVsTGVuZ3RoLnRvRG91YmxlKCkgKiBmb250U2l6ZSAqIHJhdGlvICsgMiAqIExBQkVMX1BBRERJTkdcbiAgICAgICAgcmV0dXJuIGlmIChpc0JvbGQpIHtcbiAgICAgICAgICAgIHdpZHRoICogRk9OVF9XRUlHSFRfQk9MRF9UT19OT1JNQUxfV0lEVEhfUkFUSU9cbiAgICAgICAgfSBlbHNlIHdpZHRoXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIGhlaWdodCgpOiBEb3VibGUge1xuICAgICAgICByZXR1cm4gZm9udFNpemUgKyAyICogTEFCRUxfUEFERElOR1xuICAgIH1cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBwcml2YXRlIGNvbnN0IHZhbCBGT05UX1NJWkVfVE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hY2NvdW50IGZvciBncm91cGluZylcbiAqL1xuaW50ZXJuYWwgY2xhc3MgUGlja1NhbXBsaW5nKHNhbXBsZVNpemU6IEludCkgOiBTYW1wbGluZ0Jhc2Uoc2FtcGxlU2l6ZSksXG4gICAgUG9pbnRTYW1wbGluZyB7XG5cbiAgICBvdmVycmlkZSB2YWwgZXhwcmVzc2lvblRleHQ6IFN0cmluZ1xuICAgICAgICBnZXQoKSA9IFwic2FtcGxpbmdfXCIgKyBBTElBUyArIFwiKFwiICtcbiAgICAgICAgICAgICAgICBcIm49XCIgKyBzYW1wbGVTaXplICsgXCIpXCJcblxuICAgIG92ZXJyaWRlIGZ1biBhcHBseShwb3B1bGF0aW9uOiBEYXRhRnJhbWUpOiBEYXRhRnJhbWUge1xuICAgICAgICByZXF1aXJlKGlzQXBwbGljYWJsZShwb3B1bGF0aW9uKSlcblxuICAgICAgICB2YWwgeFZhciA9IHhWYXIocG9wdWxhdGlvbilcbiAgICAgICAgdmFsIHhGYWN0b3JzID0gcG9wdWxhdGlvbi5kaXN0aW5jdFZhbHVlcyh4VmFyKVxuICAgICAgICBpZiAoeEZhY3RvcnMuc2l6ZSA8PSBzYW1wbGVTaXplKSB7XG4gICAgICAgICAgICByZXR1cm4gcG9wdWxhdGlvblxuICAgICAgICB9XG5cbiAgICAgICAgdmFsIHBpY2tYID0geEZhY3RvcnMudGFrZShzYW1wbGVTaXplKS50b1NldCgpXG5cbiAgICAgICAgdmFsIHhWYWx1ZXMgPSBwb3B1bGF0aW9uW3hWYXJdXG4gICAgICAgIHZhbCBwaWNrZWRJbmRpY2VzID0gQXJyYXlMaXN0PEludD4oKVxuICAgICAgICBmb3IgKChpbmRleCwgdikgaW4geFZhbHVlcy53aXRoSW5kZXgoKSkge1xuICAgICAgICAgICAgaWYgKHYgaW4gcGlja1gpIHtcbiAgICAgICAgICAgICAgICBwaWNrZWRJbmRpY2VzLmFkZChpbmRleClcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICA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2FtcGxlU2l6ZSA9IHJvdW5kKHNhbXBsZVNpemUgKiByYXRpbykudG9JbnQoKVxuICAgICAgICAgICAgc3RyYXR1bVNhbXBsZVNpemUgPSBtYXgoc3RyYXR1bVNhbXBsZVNpemUsIG1pblN1YlNhbXBsZVNpemUpXG5cbiAgICAgICAgICAgIGlmIChzdHJhdHVtU2FtcGxlU2l6ZSA+PSBzdHJhdHVtU2l6ZSkge1xuICAgICAgICAgICAgICAgIHBpY2tJbmRpY2VzLmFkZEFsbChncm91cEluZGljZXMpXG4gICAgICAgICAgICB9IGVsc2Uge1xuXG4gICAgICAgICAgICAgICAgdmFsIHNhbXBsZUdyb3VwSW5kaWNlcyA9XG4gICAgICAgICAgICAgICAgICAgIFNhbXBsaW5nVXRpbC5zYW1wbGVXaXRob3V0UmVwbGFjZW1lbnQoc3RyYXR1bVNpemUsXG4gICAgICAgICAgICAgICAgICAgICAgICBzdHJhdHVtU2FtcGxlU2l6ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJhbmQsXG4gICAgICAgICAgICAgICAgICAgICAgICB7IGluZGV4U2V0IC0+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKDAgdW50aWwgZ3JvdXBJbmRpY2VzLnNpemUpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5maWx0ZXIgeyBpbmRleFNldC5jb250YWlucyhpdCkgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHsgaW5kZXhTZXQgLT5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoMCB1bnRpbCBncm91cEluZGljZXMuc2l6ZSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmZpbHRlciB7IGkgLT4gIWluZGV4U2V0LmNvbnRhaW5zKGkpIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgICBmb3IgKGkgaW4gc2FtcGxlR3JvdXBJbmRpY2VzK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PSBwb3B1bGF0aW9uW3lWYXIocG9wdWxhdGlvbildIGFzIExpc3Q8QW55PlxuICAgICAgICB2YWwgcG9pbnRzID0gRG91YmxlVmVjdG9yQ29tcG9uZW50c0xpc3QoeFZhbHVlcywgeVZhbHVlcylcbiAgICAgICAgZm9yIChpIGluIHBvaW50cy5pbmRpY2VzKSB7XG4gICAgICAgICAgICB2YWwgcG9pbnQgPSBwb2ludHNbaV1cbiAgICAgICAgICAgIGlmIChzdGFydCA8IDApIHtcbiAgICAgICAgICAgICAgICBzdGFydCA9IGlcbiAgICAgICAgICAgICAgICBsYXN0UG9pbnQgPSBwb2ludFxuICAgICAgICAgICAgfSBlbHNlIGlmIChsYXN0UG9pbnQgPT0gcG9pbnQpIHtcbiAgICAgICAgICAgICAgICByaW5ncy5hZGQocG9pbnRzLnN1Ykxpc3Qoc3RhcnQsIGkgKyAxKSlcbiAgICAgICAgICAgICAgICBzdGFydCA9IC0xXG4gICAgICAgICAgICAgICAgbGFzdFBvaW50ID0gbnVsbFxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChzdGFydCA+PSAwKSB7XG4gICAgICAgICAgICAvLyBub3QgY2xvc2VkXG4gICAgICAgICAgICByaW5ncy5hZGQocG9pbnRzLnN1Ykxpc3Qoc3RhcnQsIHBvaW50cy5zaXplKSlcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmluZ3NcbiAgICB9XG5cbiAgICBmdW4gY2FsY3VsYXRlUmluZ0xpbWl0cyhyaW5nczogTGlzdDxMaXN0PERvdWJsZVZlY3Rvcj4+LCB0b3RhbFBvaW50c0xpbWl0OiBJbnQpOiBMaXN0PEludD4ge1xuICAgICAgICB2YWwgdG90YWxBcmVhID0gcmluZ3MubWFwIHsgY2FsY3VsYXRlQXJlYShpdCkgfS5zdW0oKVxuXG4gICAgICAgIHZhbCBhcmVhUHJvY2VlZCA9IE11dGFibGVEb3VibGUoMC4wKVxuICAgICAgICB2YWwgcG9pbnRzUHJvY2VlZCA9IE11dGFibGVJbnRlZ2VyKDApXG5cbiAgICAgICAgcmV0dXJuIHJpbmdzLmluZGljZXNcbiAgICAgICAgICAgIC5hc1NlcXVlbmNlKClcbiAgICAgICAgICAgIC5tYXAgeyBQYWlyKGl0LCBjYWxjdWxhdGVBcmVhKHJpbmdzW2l0XSkpIH1cbiAgICAgICAgICAgIC5zb3J0ZWRXaXRoKGNvbXBhcmVCeTxQYWlyPCosIERvdWJsZT4+IHtcbiAgICAgICAgICAgICAgICBnZXRSaW5nQXJlYShcbiAgICAgICAgICAgICAgICAgICAgaXRcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICB9LnJldmVyc2VkKCkpXG4gICAgICAgICAgICAubWFwIHsgcCAtPlxuICAgICAgICAgICAgICAgIHZhciBsaW1pdCA9IG1pbihcbiAgICAgICAgICAgICAgICAgICAgKHAuc2Vjb25kIC8gKHRvdGFsQXJlYSAtIGFyZWFQcm9jZWVkLmdldCgpKSAqICh0b3RhbFBvaW50c0xpbWl0IC0gcG9pbnRzUHJvY2VlZC5nZXQoKSkpLnJvdW5kVG9JbnQoKSxcbiAgICAgICAgICAgICAgICAgICAgcmluZ3NbZ2V0UmluZ0luZGV4KHApXS5zaXplXG4gICAgICAgICAgICAgICAgKVxuXG4gICAgICAgICAgICAgICAgaWYgKGxpbWl0ID49IDQpIHtcbiAgICAgICAgICAgICAgICAgICAgYXJlYVByb2NlZWQuZ2V0QW5kQWRkKGdldFJpbmdBcmVhKHApKVxuICAgICAgICAgICAgICAgICAgICBwb2ludHNQcm9jZWVkLmdldEFuZEFkZChsaW1pdClcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBsaW1pdCA9IDBcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBQYWlyKGdldFJpbmdJbmRleChwKSwgbGltaXQpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAuc29ydGVkV2l0aChjb21wYXJlQnkgeyBn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JuYWwocG9pbnRzLCBsaW1pdClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGludGVybmFsIGFic3RyYWN0IGZ1biBzaW1wbGlmeUludGVybmFsKHBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+LCBsaW1pdDogSW50KTogTGlzdDxJbnQ+XG5cbiAgICBvdmVycmlkZSBmdW4gYXBwbHkocG9wdWxhdGlvbjogRGF0YUZyYW1lKTogRGF0YUZyYW1lIHtcbiAgICAgICAgcmVxdWlyZShpc0FwcGxpY2FibGUocG9wdWxhdGlvbikpXG5cbiAgICAgICAgdmFsIHJpbmdzID0gc3BsaXRSaW5ncyhwb3B1bGF0aW9uKVxuICAgICAgICB2YWwgbGltaXRzID0gaWYgKHJpbmdzLnNpemUgPT0gMSAmJiAhcmluZ3NbMF0uaXNDbG9zZWQoKSlcbiAgICAgICAgICAgIGxpc3RPZihzYW1wbGVTaXplKVxuICAgICAgICBlbHNlXG4gICAgICAgICAgICBjYWxjdWxhdGVSaW5nTGltaXRzKHJpbmdzLCBzYW1wbGVTaXplKVxuXG4gICAgICAgIHZhbCBpbmRpY2VzID0gQXJyYXlMaXN0PEludD4oKVxuICAgICAgICB2YWwgcmluZ0Jhc2UgPSBNdXRhYmxlSW50ZWdlcigwKVxuXG4gICAgICAgICgwIHVudGlsIGxpbWl0cy5zaXplKVxuICAgICAgICAgICAgICAgIC5tYXAgeyBQYWlyKGl0LCBsaW1pdHNbaXRdKSB9XG4gICAgICAgICAgICAgICAgLmZvckVhY2ggeyBwIC0+XG4gICAgICAgICAgICAgICAgICAgIHNpbXBsaWZ5KHJpbmdzW2dldFJpbmdJbmRleChwKV0sIGdldFJpbmdMaW1pdChwKSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZm9yRWFjaCB7IGluZGV4IC0+IGluZGljZXMuYWRkKHJpbmdCYXNlLmdldCgpICsgaW5kZXgpIH1cbiAgICAgICAgICAgICAgICAgICAgcmluZ0Jhc2UuZ2V0QW5kQWRkKHJpbmdzW2dldFJpbmdJbmRleChwKV0uc2l6ZSlcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHBvcHVsYXRpb24uc2VsZWN0SW5kaWNlcyhpbmRpY2VzKVxuICAgIH1cblxuICAgIGludGVybmFsIGNsYXNzIFZlcnRleFZ3U2FtcGxpbmcoc2FtcGxlU2l6ZTogSW50KSA6IFZlcnRleFNhbXBsaW5nKHNhbXBsZVNpemUpIHtcblxuICAgICAgICBvdmVycmlkZSB2YWwgZXhwcmVzc2lvblRleHQ6IFN0cmluZ1xuICAgICAgICAgICAgZ2V0KCkgPSBcInNhbXBsaW5nX1wiICsgQUxJQVMgKyBcIihcIiArXG4gICAgICAgICAgICAgICAgICAgIFwibj1cIiArIHNhbXBsZVNpemUgKyBcIilcIlxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBzaW1wbGlmeUludGVybmFsKHBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+LCBsaW1pdDogSW50KTogTGlzdDxJbnQ+IHtcbiAgICAgICAgICAgIHJldHVybiBQb2x5bGluZVNpbXBsaWZpZXIudmlzdmFsaW5nYW1XaHlhdHQocG9pbnRzKS5zZXRDb3VudExpbWl0KGxpbWl0KS5pbmRpY2VzXG4gICAgICAgIH1cblxuICAgICAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgICAgIGNvbnN0IHZhbCBBTElBUyA9IFwidmVydGV4X3Z3XCJcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGludGVybmFsIGNsYXNzIFZlcnRleERwU2FtcGxpbmcoc2FtcGxlU2l6ZTogSW50KSA6IFZlcnRleFNhbXBsaW5nKHNhbXBsZVNpemUpIHtcblxuICAgICAgICBvdmVycmlkZSB2YWwgZXhwcmVzc2lvblRleHQ6IFN0cmluZ1xuICAgICAgICAgICAgZ2V0KCkgPSBcInNhbXBsaW5nX1wiICsgQUxJQVMgKyBcIihcIiArXG4gICAgICAgICAgICAgICAgICAgIFwibj1cIiArIHNhbXBsZVNpemUgKyBcIilcIlxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBzaW1wbGlmeUludGVybmFsKHBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+LCBsaW1pdDogSW50KTogTGlzdDxJbnQ+IHtcbiAgICAgICAgICAgIHJldHVybiBQb2x5bGluZVNpbXBsaWZpZXIuZG91Z2xhc1BldWNrZXIocG9pbnRzKS5zZXRDb3VudExpbWl0KGxpbWl0KS5pbmRpY2VzXG4gICAgICAgIH1cblxuICAgICAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgICAgIGNvbnN0IHZhbCBBTElBUyA9IFwidmVydGV4X2RwXCJcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGludGVybmFsIGNsYXNzIERvdWJsZVZlY3RvckNvbXBvbmVudHNMaXN0KHByaXZhdGUgdmFsIG15WFZhbHVlczogTGlzdDxBbnk+LCBwcml2YXRlIHZhbCBteVlWYWx1ZXM6IExpc3Q8QW55PikgOiBBYnN0cmFjdExpc3Q8RG91YmxlVmVjdG9yPigpIHtcbiAgICAgICAgb3ZlcnJpZGUgdmFsIHNpemU6IEludFxuICAgICAgICAgICAgZ2V0KCkgPSBteVhWYWx1ZXMuc2l6ZVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBnZXQoaW5kZXg6IEludCk6IERvdWJsZVZlY3RvciB7XG4gICAgICAgICAgICByZXR1cm4gY3JlYXRlUG9pbnQoXG4gICAgICAgICAgICAgICAgbXlYVmFsdWVzW2luZGV4XSxcbiAgICAgICAgICAgICAgICBteVlWYWx1ZXNbaW5kZXhdXG4gICAgICAgICAgICApXG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgcHJpdmF0ZSBmdW4gY3JlYXRlUG9pbnQoeDogQW55LCB5OiBBbnkpOiBEb3VibGVWZWN0b3Ige1xuICAgICAgICAgICAgcmVxdWlyZSghKHggaXMgU3RyaW5nIHx8IHkg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vbiBvYmplY3Qge1xuICAgICAgICAgICAgLy8gRm9yIG1vc3Qgb2YgbnVtZXJpYyAocG9zaXRpb25hbCkgYWVzdGhldGljcyB0aGUgaW5pdGlhbCBtYXBwZXIgaXMgVU5ERUZJTkVEIG1hcHBlciBhcyB3ZSBkb24ndCB5ZXQga25vdyB0aGUgcmFuZ2Ugb2YgcG9zaXRpb25hbCBhZXN0aGV0aWNzLlxuICAgICAgICAgICAgcHJpdmF0ZSB2YWwgTlVNRVJJQ19VTkRFRklORUQ6IE1hcHBlclByb3ZpZGVyPERvdWJsZT4gPSBvYmplY3QgOiBNYXBwZXJQcm92aWRlcjxEb3VibGU+IHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlRGlzY3JldGVNYXBwZXIoZG9tYWluVmFsdWVzOiBDb2xsZWN0aW9uPCo+KTogR3VpZGVNYXBwZXI8RG91YmxlPiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBHdWlkZU1hcHBlcnMuVU5ERUZJTkVEXG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGNyZWF0ZUNvbnRpbnVvdXNNYXBwZXIoXG4gICAgICAgICAgICAgICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgICAgICAgICAgICAgbG93ZXJMaW1pdDogRG91YmxlPyxcbiAgICAgICAgICAgICAgICAgICAgdXBwZXJMaW1pdDogRG91YmxlPyxcbiAgICAgICAgICAgICAgICAgICAgdHJhbnM6IENvbnRpbnVvdXNUcmFuc2Zvcm1cbiAgICAgICAgICAgICAgICApOiBHdWlkZU1hcHBlcjxEb3VibGU+IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEd1aWRlTWFwcGVycy5VTkRFRklORURcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHByaXZhdGUgdmFsIE5VTUVSSUNfSURFTlRJVFk6IE1hcHBlclByb3ZpZGVyPERvdWJsZT4gPSBvYmplY3QgOiBNYXBwZXJQcm92aWRlcjxEb3VibGU+IHtcbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlRGlzY3JldGVNYXBwZXIoZG9tYWluVmFsdWVzOiBDb2xsZWN0aW9uPCo+KTogR3VpZGVNYXBwZXI8RG91YmxlPiB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBHdWlkZU1hcHBlcnMuSURFTlRJVFlcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlQ29udGludW91c01hcHBlcihcbiAgICAgICAgICAgICAgICAgICAgZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICAgICAgICAgICAgICBsb3dlckxpbWl0OiBEb3VibGU/LFxuICAgICAgICAgICAgICAgICAgICB1cHBlckxpbWl0OiBEb3VibGU/LFxuICAgICAgICAgICAgICAgICAgICB0cmFuczogQ29udGludW91c1RyYW5zZm9ybVxuICAgICAgICAgICAgICAgICk6IEd1aWRlTWFwcGVyPERvdWJsZT4ge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gR3VpZGVNYXBwZXJzLklERU5USVRZXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5idWlsZGVyLnNjYWxlXG5cbmltcG9ydCBqZXRicmFpbnMuZGF0YWxvcmUuYmFzZS5nY29tbW9uLm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ybiBHdWlkZU1hcHBlcnMuZGlzY3JldGVUb0Rpc2NyZXRlKGRvbWFpblZhbHVlcywgb3V0cHV0VmFsdWVzLCBuYVZhbHVlKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gY3JlYXRlQ29udGludW91c01hcHBlcihcbiAgICAgICAgICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgICAgICAgICAgbG93ZXJMaW1pdDogRG91YmxlPyxcbiAgICAgICAgICAgICAgICB1cHBlckxpbWl0OiBEb3VibGU/LFxuICAgICAgICAgICAgICAgIHRyYW5zOiBDb250aW51b3VzVHJhbnNmb3JtXG4gICAgICAgICAgICApOiBHdWlkZU1hcHBlcjxUPiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIEd1aWRlTWFwcGVycy5jb250aW51b3VzVG9EaXNjcmV0ZShcbiAgICAgICAgICAgICAgICAgICAgTWFwcGVyVXRpbC5yYW5nZVdpdGhMaW1pdHNBZnRlclRyYW5zZm9ybShkb21haW4sIGxvd2VyTGltaXQsIHVwcGVyTGltaXQsIHRyYW5zKSxcbiAgICAgICAgICAgICAgICAgICAgb3V0cHV0VmFsdWVzLCBuYVZhbHVlXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgQFN1cHByZXNzKFwiVU5VU0VEX1BBUkFNRVRFUlwiKVxuICAgIGludGVybmFsIGZ1biBjcmVhdGVPYmplY3RJZGVudGl0eShhZXM6IEFlczxBbnk/Pik6IE1hcHBlclByb3ZpZGVyPEFueT8+IHtcbiAgICAgICAgcmV0dXJuIG9iamVjdCA6IElkZW50aXR5RGlzY3JldGVNYXBwZXJQcm92aWRlcjxBbnk/Pih7IGl0IH0sIG51bGwpIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVDb250aW51b3VzTWFwcGVyKFxuICAgICAgICAgICAgICAgIGRvbWFpb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UPiBjcmVhdGVJZGVudGl0eU1hcHBlclByb3ZpZGVyKFxuICAgICAgICBhZXM6IEFlczxUPixcbiAgICAgICAgY29udmVydGVyOiAoQW55PykgLT4gVD8sXG4gICAgICAgIGNvbnRpbnVvdXNNYXBwZXI6ICgoRG91YmxlPykgLT4gVD8pP1xuICAgICk6IE1hcHBlclByb3ZpZGVyPFQ+IHtcbiAgICAgICAgcmV0dXJuIG9iamVjdCA6IElkZW50aXR5RGlzY3JldGVNYXBwZXJQcm92aWRlcjxUPihjb252ZXJ0ZXIsIERlZmF1bHROYVZhbHVlW2Flc10pIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVDb250aW51b3VzTWFwcGVyKFxuICAgICAgICAgICAgICAgIGRvbWFpbjogQ2xvc2VkUmFuZ2U8RG91YmxlPixcbiAgICAgICAgICAgICAgICBsb3dlckxpbWl0OiBEb3VibGU/LFxuICAgICAgICAgICAgICAgIHVwcGVyTGltaXQ6IERvdWJsZT8sXG4gICAgICAgICAgICAgICAgdHJhbnM6IENvbnRpbnVvdXNUcmFuc2Zvcm1cbiAgICAgICAgICAgICk6IEd1aWRlTWFwcGVyPFQ+IHtcbiAgICAgICAgICAgICAgICBpZiAoY29udGludW91c01hcHBlciAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBHdWlkZU1hcHBlcnMuYXNDb250aW51b3VzKGNvbnRpbnVvdXNNYXBwZXIpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRocm93IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbihcIkNhbid0IGNyZWF0ZSAkYWVzIG1hcHBlciBmb3IgY29udGludW91cyBkb21haW4gJGRvbWFpblwiKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUga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ludW91c1RyYW5zZm9ybTogQ29udGludW91c1RyYW5zZm9ybSA9IGIubXlDb250aW51b3VzVHJhbnNmb3JtXG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gc2NhbGVOYW1lKHZhcmlhYmxlOiBEYXRhRnJhbWUuVmFyaWFibGUpOiBTdHJpbmcge1xuICAgICAgICAgICAgcmV0dXJuIG15TmFtZSA/OiB2YXJpYWJsZS5sYWJlbFxuICAgICAgICB9XG5cbiAgICAgICAgb3ZlcnJpZGUgZnVuIGNyZWF0ZVNjYWxlKGRlZmF1bHROYW1lOiBTdHJpbmcsIGRpc2NyZXRlRG9tYWluOiBDb2xsZWN0aW9uPCo+KTogU2NhbGU8VD4ge1xuICAgICAgICAgICAgdmFsIG5hbWUgPSBteU5hbWUgPzogZGVmYXVsdE5hbWVcbiAgICAgICAgICAgIHZhciBzY2FsZTogU2NhbGU8VD5cblxuICAgICAgICAgICAgLy8gZGlzY3JldGUgZG9tYWluXG4gICAgICAgICAgICB2YXIgZG9tYWluVmFsdWVzID0gZGlzY3JldGVEb21haW4uZmlsdGVyTm90TnVsbCgpXG5cbiAgICAgICAgICAgIHZhbCBtYXBwZXIgPSBpZiAoZGlzY3JldGVEb21haW4uaXNFbXB0eSgpKSB7XG4gICAgICAgICAgICAgICAgYWJzZW50TWFwcGVyKGRlZmF1bHROYW1lKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBtYXBwZXJQcm92aWRlci5jcmVhdGVEaXNjcmV0ZU1hcHBlcihkb21haW5WYWx1ZXMpOjphcHBseVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoZGlzY3JldGVEb21haW5SZXZlcnNlKSB7XG4gICAgICAgICAgICAgICAgZG9tYWluVmFsdWVzID0gZG9tYWluVmFsdWVzLnJldmVyc2VkKClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgc2NhbGUgPSBTY2FsZXMuZGlzY3JldGVEb21haW4oXG4gICAgICAgICAgICAgICAgbmFtZSxcbiAgICAgICAgICAgICAgICBkb21haW5WYWx1ZXMsXG4gICAgICAgICAgICAgICAgbWFwcGVyXG4gICAgICAgICAgICApXG5cbiAgICAgICAgICAgIHZhbCBkaXNjcmV0ZUxpbWl0cyA9IGxpbWl0cz8uZmlsdGVyTm90TnVsbCgpPy5sZXQge1xuICAgICAgICAgICAgICAgIGlmIChkaXNjcmV0ZURvbWFpblJldmVyc2UpIHtcbiAgICAgICAgICAgICAgICAgICAgaXQucmV2ZXJzZWQoKVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGl0XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGRpc2NyZXRlTGltaXRzICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICBzY2FsZSA9IHNjYWxlLndpdGgoKVxuICAgICAgICAgICAgICAgICAgICAubGltaXRzKGRpc2NyZXRlTGltaXRzKVxuICAgICAgICAgICAgICAgICAgICAuYnVpbGQoKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gY29tcGxldGVTY2FsZShzY2FsZSlcbiAgICAgICAgfVxuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBjcmVhdGVTY2FsZShkZWZhdWx0TmFtZTogU3RyaW5nLCBjb250aW51b3VzRG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+KTogU2NhbGU8VD4ge1xuICAgICAgICAgICAgdmFsIG5hbWUgPSBteU5hbWUgPzogZGVmYXVsdE5hbWVcbiAgICAgICAgICAgIHZhciBzY2FsZTogU2NhbGU8VD5cblxuICAgICAgICAgICAgLy8gY29udGludW91cyAobnVtZXJpYykgZG9tYWluXG4gICAgICAgICAgICB2YWwgZGF0YVJhbmdlID0gZW5zdXJlQXBwbGljYWJsZVJhbmdlKGNvbnRpbnVvdXNEb21haW4pXG5cbiAgICAgICAgICAgIHZhciBsb3dlckxpbWl0OiBEb3VibGU/ID0gbnVsbFxuICAgICAgICAgICAgdmFyIHVwcGVyTGltaXQ6IERvdWJsZT8gPSBudWxsXG4gICAgICAgICAgICBpZiAobGltaXRzICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICB2YXIgbG93ZXIgPSB0cnVlXG4gICAgICAgICAgICAgICAgZm9yIChsaW1pdCBpbiBsaW1pdHMpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxpbWl0IGlzIE51bWJlcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFsIHYgPSBsaW1pdC50b0RvdWJsZSgpXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodi5pc0Zpbml0ZSgpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxvd2VyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvd2VyTGltaXQgPSB2XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBwZXJMaW1pdCA9IHZcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbG93ZXIgPSBmYWxzZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIG1hcHBlciA9IG1hcHBlclByb3ZpZGVyLmNyZWF0ZUNvbnRpbnVvdXNNYXBwZXIoXG4gICAgICAgICAgICAgICAgZGF0YVJhbmdlLFxuICAgICAgICAgICAgICAgIGxvd2VyTGltaXQsXG4gICAgICAgICAgICAgICAgdXBwZXJMaW1pdCxcbiAgICAgICAgICAgICAgICBjb250aW51b3VzVHJhbnNmb3JtXG4gICAgICAgICAgICApXG4gICAgICAgICAgICB2YWwgY29udGludW91c1JhbmdlID0gbWFwcGVyLmlzQ29udGludW91cyB8fCBteUFlcy5pc051bWVyaWNcblxuICAgICAgICAgICAgc2NhbGUgPSBTY2FsZXMuY29udGludW91c0RvbWFpbihuYW1lLCB7IHYgLT4gbWFwcGVyLmFwcGx5KHYpIH0sIGNvbnRpbnVvdXNSYW5nZSlcblxuICAgICAgICAgICAgLy8gVG9EbzogbmVlZCB0byAnaW52ZXJzZSB0cmFuc2Zvcm0nIGJyZWFrcy5cbiAgICAgICAgICAgIGlmIChtYXBwZXIgaXMgV2l0aEd1aWRlQnJlYWtzPCo+KSB7XG4gICAgICAgICAgICAgICAgQFN1cHByZXNzKFwiVU5DSEVDS0VEX0NBU1RcIilcbiAgICAgICAgICAgICAgICBtYXBwZXIgYXMgV2l0aEd1aWRlQnJlYWtzPEFueT5cbiAgICAgICAgICAgICAgICBzY2FsZSA9IHNjYWxlLndpdGgoKVxuICAgICAgICAgICAgICAgICAgICAuYnJlYWtzKG1hcHBlci5icmVha3MpXG4gICAgICAgICAgICAgICAgICAgIC5sYWJlbEZvcm1hdHRlcihtYXBwZXIuZm9ybWF0dGVyKVxuICAgICAgICAgICAgICAgICAgICAuYnVpbGQoKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBzY2FsZSA9IHNjYWxlLndpdGgoKVxuICAgICAgICAgICAgICAgIC5jb250aW51b3VzVHJhbnNmb3JtKGNvbnRpbnVvdXNUcmFuc2Zvcm0pXG4gICAgICAgICAgICAgICAgLmJ1aWxkKClcblxuICAgICAgICAgICAgaWYgKG15QnJlYWtzR2VuZXJhdG9yICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICBzY2FsZSA9IHNjYWxlLndpdGgoKVxuICAgICAgICAgICAgICAgICAgICAuYnJlYWtzR2VuZXJhdG9yKG15QnJlYWtzR2VuZXJhdG9yKVxuICAgICAgICAgICAgICAgICAgICAuYnVpbGQoKVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAobGltaXRzICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICB2YWwgd2l0aCA9IHNjYWxlLndpdGgoKVxuICAgICAgICAgICAgICAgIGlmIChsb3dlckxpbWl0ICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgd2l0aC5sb3dlckxpbWl0KGxvd2VyTGltaXQpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICh1cHBlckxpbWl0ICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgd2l0aC51cHBlckxpbWl0KHVwcGVyTGltaXQpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHNjYWxlID0gd2l0aC5idWlsZCgpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBjb21wbGV0ZVNjYWxlKHNjYWxlKVxuICAgICAgICB9XG5cblxuICAgICAgICBwcml2YXRlIGZ1biBjb21wbGV0ZVNjYWxlKHNjYWxlOiBTY2FsZTxUPik6IFNjYWxlPFQ+IHtcbiAgICAgICAgICAgIHZhbCB3aXRoID0gc2NhbGUud2l0aCgpXG4gICAgICAgICAgICBpZiAoYnJlYWtzICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICB3aXRoLmJyZWFrcyhicmVha3MpXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobXlMYWJlbHMgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHdpdGgubGFiZWxzKG15TGFiZWxzKVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKG15TGFiZWxGb3JtYXQgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHdpdGgubGFiZWxGb3JtYXR0ZXIoU3RyaW5nRm9ybWF0LmNyZWF0ZShteUxhYmVsRm9ybWF0KTo6Zm9ybWF0KVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKG15TXVsdGlwbGljYXRpdmVFeHBhbmQgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHdpdGgubXVsdGlwbGljYXRpdmVFeHBhbmQobXlNdWx0aXBsaWNhdGl2ZUV4cGFu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VxuXG4gICAgLy8gaHR0cHM6Ly9nZ3Bsb3QyLnRpZHl2ZXJzZS5vcmcvY3VycmVudC9zY2FsZV9ncmFkaWVudC5odG1sXG4gICAgdmFsIERFRl9HUkFESUVOVF9MT1cgPSBDb2xvci5wYXJzZUhleChcIiMxMzJCNDNcIilcbiAgICB2YWwgREVGX0dSQURJRU5UX0hJR0ggPSBDb2xvci5wYXJzZUhleChcIiM1NkIxRjdcIilcblxuICAgIGZ1biBncmFkaWVudERlZmF1bHQoZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+KTogKERvdWJsZT8pIC0+IENvbG9yIHtcbiAgICAgICAgcmV0dXJuIGdyYWRpZW50KFxuICAgICAgICAgICAgZG9tYWluLFxuICAgICAgICAgICAgREVGX0dSQURJRU5UX0xPVyxcbiAgICAgICAgICAgIERFRl9HUkFESUVOVF9ISUdILFxuICAgICAgICAgICAgTkFfVkFMVUVcbiAgICAgICAgKVxuICAgIH1cblxuICAgIGZ1biBncmFkaWVudChkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sIGxvdzogQ29sb3IsIGhpZ2g6IENvbG9yLCBuYUNvbG9yOiBDb2xvcik6IChEb3VibGU/KSAtPiBDb2xvciB7XG4gICAgICAgIHJldHVybiBncmFkaWVudEhTVihcbiAgICAgICAgICAgIGRvbWFpbixcbiAgICAgICAgICAgIENvbG9ycy5oc3ZGcm9tUmdiKGxvdyksXG4gICAgICAgICAgICBDb2xvcnMuaHN2RnJvbVJnYihoaWdoKSxcbiAgICAgICAgICAgIHRydWUsXG4gICAgICAgICAgICBuYUNvbG9yXG4gICAgICAgIClcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBAZGVwcmVjYXRlZFxuICAgICAqL1xuICAgIGZ1biBncmFkaWVudEhTVihcbiAgICAgICAgZG9tYWluOiBDbG9zZWRSYW5nZTxEb3VibGU+LFxuICAgICAgICBsb3dIU1Y6IERvdWJsZUFycmF5LFxuICAgICAgICBoaWdoSFNWOiBEb3VibGVBcnJheSxcbiAgICAgICAgYXV0b0h1ZURpcmVjdGlvbjogQm9vbGVhbixcbiAgICAgICAgbmFDb2xvcjogQ29sb3JcbiAgICApOiAoRG91YmxlPykgLT4gQ29sb3Ige1xuICAgICAgICByZXR1cm4gZ3JhZGllbnRIU1YoXG4gICAgICAgICAgICBkb21haW4sXG4gICAgICAgICAgICBIU1YobG93SFNWWzBdLCBsb3dIU1ZbMV0sIGxvd0hTVlsyXSksXG4gICAgICAgICAgICBIU1YoaGlnaEhTVlswXSwgaGlnaEhTVlsxXSwgaGlnaEhTVlsyXSksXG4gICAgICAgICAgICBhdXRvSHVlRGlyZWN0aW9uLFxuICAgICAgICAgICAgbmFDb2xvclxuICAgICAgICApXG4gICAgfVxuXG4gICAgZnVuIGdyYWRpZW50SFNWKFxuICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgIGxvd0hTVjogSFNWLFxuICAgICAgICBoaWdoSFNWOiBIU1YsXG4gICAgICAgIGF1dG9IdWVEaXJlY3Rpb246IEJvb2xlYW4sXG4gICAgICAgIG5hQ29sb3I6IENvbG9yXG4gICAgKTogKERvdWJsZT8pIC0+IENvbG9yIHtcblxuICAgICAgICB2YXIgbG93SHVlID0gbG93SFNWLmhcbiAgICAgICAgdmFyIGhpZ2hIdWUgPSBoaWdoSFNWLmhcblxuICAgICAgICB2YWwgbG93UyA9IGxvd0hTVi5zXG4gICAgICAgIHZhbCBoaWdoUyA9IGhpZ2hIU1Yuc1xuXG4gICAgICAgIC8vIE5vIGh1ZSBpZiBzYXR1cmF0aW9uIGlzIG5lYXIgemVyb1xuICAgICAgICBpZiAobG93UyA8IDAuMDAwMSkge1xuICAgICAgICAgICAgbG93SHVlID0gaGlnaEh1ZVxuICAgICAgICB9XG4gICAgICAgIGlmIChoaWdoUyA8IDAuMDAwMSkge1xuICAgICAgICAgICAgaGlnaEh1ZSA9IGxvd0h1ZVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGF1dG9IdWVEaXJlY3Rpb24pIHtcbiAgICAgICAgICAgIHZhbCBkSCA9IGFicyhoaWdoSHVlIC0gbG93SHVlKVxuICAgICAgICAgICAgaWYgKGRIID4gMTgwKSB7XG4gICAgICAgICAgICAgICAgaWYgKGhpZ2hIdWUgPj0gbG93SHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIGxvd0h1ZSArPSAzNjAuMFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGhpZ2hIdWUgKz0gMzYwLjBcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YWwgbWFwcGVySCA9IE1hcHBlcnMubGluZWFyKGRvbWFpbiwgbG93SHVlLCBoaWdoSHVlLCBEb3VibGUuTmFOKVxuICAgICAgICB2YWwgbWFwcGVyUyA9IE1hcHBlcnMubGluZWFyKGRvbWFpbiwgbG93UywgaGlnaFMsIERvdWJsZS5OYU4pXG4gICAgICAgIHZhbCBtYXBwZXJWID0gTWFwcGVycy5saW5lYXIoZG9tYWluLCBsb3dIU1YudiwgaGlnaEhTVi52LCBEb3VibGUuTmFOKVxuXG4gICAgICAgIHJldHVybiB7IGlucHV0IC0+XG4gICAgICAgICAgICBpZiAoaW5wdXQgPT0gbnVsbCB8fCAhZG9tYWluLmNvbnRhaW5zKGlucHV0KSkge1xuICAgICAgICAgICAgICAgIG5hQ29sb3JcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdmFsIGh1ZSA9IG1hcHBlckgoaW5wdXQpICUgMzYwXG4gICAgICAgICAgICAgICAgdmFsIEggPSBpZiAoaHVlID49IDApIGh1ZSBlbHNlIDM2MCArIGh1ZVxuICAgICAgICAgICAgICAgIHZhbCBTID0gbWFwcGVyUyhpbnB1dClcbiAgICAgICAgICAgICAgICB2YWwgViA9IG1hcHBlclYoaW5wdXQpXG4gICAgICAgICAgICAgICAgQ29sb3JzLnJnYkZy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gIH1cbiAgICB9XG5cblxuICAgIGNvbXBhbmlvbiBvYmplY3Qge1xuICAgICAgICBwcml2YXRlIGZ1biBwYWxldHRlVHlwZShuYW1lOiBTdHJpbmc/KTogQ29sb3JQYWxldHRlLlR5cGUge1xuICAgICAgICAgICAgaWYgKG5hbWUgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBTRVFVRU5USUFMXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gd2hlbiAobmFtZSkge1xuICAgICAgICAgICAgICAgIFwic2VxXCIgLT4gU0VRVUVOVElBTFxuICAgICAgICAgICAgICAgIFwiZGl2XCIgLT4gRElWRVJHSU5HXG4gICAgICAgICAgICAgICAgXCJxdWFsXCIgLT4gUVVBTElUQVRJVkVcbiAgICAgICAgICAgICAgICBlbHNlIC0+IHRocm93IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbihcbiAgICAgICAgICAgICAgICAgICAgXCJQYWxldHRlIHR5cGUgZXhwZWN0ZWQgb25lIG9mICdzZXEnIChzZXF1ZW50aWFsKSwgJ2RpdicgKGRpdmVyZ2luZykgb3IgJ3F1YWwnIChxdWFsaXRhdGl2ZSkgYnV0IHdhczogJyRuYW1lJ1wiXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gY29sb3JTY2hlbWVCeU5hbWUocGFsZXR0ZVR5cGU6IENvbG9yUGFsZXR0ZS5UeXBlLCBwYWxldHRlTmFtZTogU3RyaW5nKTogQ29sb3JTY2hlbWUge1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gd2hlbiAocGFsZXR0ZVR5cGUpIHtcbiAgICAgICAgICAgICAgICAgICAgU0VRVUVOVElBTCAtPiBDb2xvclBhbGV0dGUuU2VxdWVudGlhbC52YWx1ZU9mKHBhbGV0dGVOYW1lKVxuICAgICAgICAgICAgICAgICAgICBESVZFUk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ZXJcbiAgICAgICAgKVxuXG4gICAgICAgIGZ1biBnZXRNYXBwZXIodjogRG91YmxlPyk6ICgoRG91YmxlPykgLT4gQ29sb3IpPyB7XG4gICAgICAgICAgICB2YXIgZl86ICgoRG91YmxlPykgLT4gQ29sb3IpPyA9IG51bGxcbiAgICAgICAgICAgIGlmIChTZXJpZXNVdGlsLmlzRmluaXRlKHYpKSB7XG4gICAgICAgICAgICAgICAgdmFyIGZfc3BhbiA9IERvdWJsZS5OYU5cbiAgICAgICAgICAgICAgICBmb3IgKHJhbmdlIGluIHJhbmdlTWFwLmtleXMpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJhbmdlLmNvbnRhaW5zKHYhISkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbCBzcGFuID0gcmFuZ2UudXBwZXJFbmQgLSByYW5nZS5sb3dlckVuZFxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gdHJ5IHRvIGF2b2lkIDAtbGVuZ3RoIHJhbmdlc1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gYnV0IHByZWZlciBzaG9ydGVyIHJhbmdlc1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZfID09IG51bGwgfHwgZl9zcGFuID09IDAuMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZfID0gcmFuZ2VNYXAuZ2V0KHJhbmdlKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZfc3BhbiA9IHNwYW5cbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3BhbiA8IGZfc3BhbiAmJiBzcGFuID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZfID0gcmFuZ2VNYXAuZ2V0KHJhbmdlKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZfc3BhbiA9IHNwYW5cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiA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ICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdmFsIG1hcHBlciA9IGNvbG9yTWFwcGVyc1BlclN1YkRvbWFpbi5maW5kIHsgaXQuZmlyc3QuY29udGFpbnModikgfT8uc2Vjb25kXG4gICAgICAgICAgICAgICAgICAgIG1hcHBlcj8uaW52b2tlKHYpID86IG5hQ29sb3JcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBjcmVhdGVDb2xvck1hcHBlcnNQZXJTdWJEb21haW4oXG4gICAgICAgICAgICBkb21haW46IENsb3NlZFJhbmdlPERvdWJsZT4sXG4gICAgICAgICAgICBoc3ZJbnRlcnZhbHM6IExpc3Q8UGFpcjxIU1YsIEhTVj4+LFxuICAgICAgICAgICAgYXV0b0h1ZURpcmVjdGlvbjogQm9vbGVhbixcbiAgICAgICAgICAgIG5hQ29sb3I6IENvbG9yXG4gICAgICAgICk6IExpc3Q8UGFpcjxDbG9zZWRSYW5nZTxEb3VibGU+LCAoRG91YmxlPykgLT4gQ29sb3I+PiB7XG4gICAgICAgICAgICB2YWwgc3ViRG9tYWlucyA9IHNwbGl0Q29udGludW91c0RvbWFpbihkb21haW4sIGhzdkludGVydmFscylcblxuICAgICAgICAgICAgcmV0dXJuIHN1YkRvbWFpbnMuemlwKGhzdkludGVydmFscykubWFwIHtcbiAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJOQU1FX1NIQURPV0lOR1wiKVxuICAgICAgICAgICAgICAgIHZhbCBkb21haW4gPSBpdC5maXJzdFxuICAgICAgICAgICAgICAgIHZhbCBoc3ZJbnRlcnZhbCA9IGl0LnNlY29uZFxuICAgICAgICAgICAgICAgIFBhaXIoXG4gICAgICAgICAgICAgICAgICAgIGRvbWFpbixcbiAgICAgICAgICAgICAgICAgICAgQ29sb3JNYXBwZXIuZ3JhZGllbnRIU1YoZG9tYWluLCBoc3ZJbnRlcnZhb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G4gICAgICAgIHJldHVybiBQTE9UX1RIRU1FXG4gICAgfVxuXG4gICAgb3ZlcnJpZGUgZnVuIG11bHRpVGlsZSgpOiBUaGVtZSB7XG4gICAgICAgIHJldHVybiBvYmplY3QgOiBEZWZhdWx0VGhlbWUoKSB7XG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gYXhpc1goKTogQXhpc1RoZW1lIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gQVhJU19USEVNRV9NVUxUSV9USUxFXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBheGlzWSgpOiBBeGlzVGhlbWUge1xuICAgICAgICAgICAgICAgIHJldHVybiBBWElTX1RIRU1FX01VTFRJX1RJTEVcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHBsb3QoKTogUGxvdFRoZW1lIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gUExPVF9USEVNRV9NVUxUSV9USUxFXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgcHJpdmF0ZSB2YWwgQVhJU19USEVNRSA9IERlZmF1bHRBeGlzVGhlbWUoKVxuXG4gICAgICAgIHByaXZhdGUgdmFsIEFYSVNfVEhFTUVfTVVMVElfVElMRTogQXhpc1RoZW1lID0gb2JqZWN0IDogRGVmYXVsdEF4aXNUaGVtZSgpIHtcbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBzaG93TGluZSgpOiBCb29sZWFuIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2UgIC8vIHJlcGxhY2VkIGJ5IGlubmVyIGZyYW1lXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIHZhbCBMRUdFTkRfVEhFTUU6IExlZ2VuZFRoZW1lID0gb2JqZWN0IDogTGVnZW5kVGhlbWUge1xuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGtleVNpemUoKTogRG91YmxlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gMjMuMFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gbWFyZ2luKCk6IERvdWJsZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIDUuMFxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gcGFkZGluZygpOiBEb3VibGUge1xuICAgICAgICAgICAgICAgIHJldHVybiA1LjBcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHBvc2l0aW9uKCk6IExlZ2VuZFBvc2l0aW9uIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gTGVnZW5kUG9zaXRpb24uUklHSFRcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGp1c3RpZmljYXRpb24oKTogTGVnZW5kSnVzdGlmaWNhdGlvbiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIExlZ2VuZEp1c3RpZmljYXRpb24uQ0VOVEVSXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG92ZXJyaWRlIGZ1biBkaXJlY3Rpb24oKTogTGVnZW5kRGlyZWN0aW9uIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gTGVnZW5kRGlyZWN0aW9uLkFVVE9cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGJhY2tncm91bmRGaWxsKCk6IENvbG9yIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gQ29sb3IuV0hJVEVcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgdmFsIEZBQ0VUU19USEVNRTogRmFjZXRzVGhlbWUgPSBvYmplY3QgOiBGYWNldHNUaGVtZSB7XG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gbGFiZWxCYWNrZ3JvdW5kKCk6IENvbG9yIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gQ29sb3JzLmxpZ2h0ZXIoQ29sb3IuVkVSWV9MSUdIVF9HUkFZLCAwLjkpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIHZhbCBQTE9UX1RIRU1FOiBQbG90VGhlbWUgPSBvYmplY3QgOiBQbG90VGhlbWUge1xuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIHNob3dJbm5lckZyYW1lKCk6IEJvb2xlYW4ge1xuICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gaW5uZXJGcmFtZUNvbG9yKCk6IENvbG9yIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oXCJUaGUgYGlubmVyRnJhbWVDb2xvcigpYCBtZXRob2Qgc2hvdWxkbid0IGJlIHVzZWQuXCIpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIHZhbCBQTE9UX1RIRU1FX01VTFRJX1RJTEU6IFBsb3RUaGVtZSA9IG9iamVjdCA6IFBsb3RUaGVtZSB7XG4gICAgICAgICAgICBvdmVycmlkZSBmdW4gc2hvd0lubmVyRnJhbWUoKTogQm9vbGVhbiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWVcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgb3ZlcnJpZGUgZnVuIGlubmVyRnJhbWVDb2xvcigpOiBDb2xvciB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIENvbG9ycy5saWdodGVyKENvbG9yLlZFUllfTElHSFRfR1JBWSwgMC45KVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAyMC4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNv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CwgZmllbGRzLnNpemUsIFwiZmllbGRzXCIpXG5cbiAgICBmdW4gaW5pdERhdGFDb250ZXh0KGRhdGFDb250ZXh0OiBEYXRhQ29udGV4dCkge1xuICAgICAgICBmaWVsZHMuZm9yRWFjaCB7IGl0LmluaXREYXRhQ29udGV4dChkYXRhQ29udGV4dCkgfVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBnZXREYXRhUG9pbnQoaW5kZXg6IEludCk6IERhdGFQb2ludD8ge1xuICAgICAgICB2YWwgZGF0YVZhbHVlcyA9IGZpZWxkcy5tYXAgeyBkYXRhVmFsdWUgLT5cbiAgICAgICAgICAgIGRhdGFWYWx1ZS5nZXREYXRhUG9pbnQoaW5kZXgpID86IHJldHVybiBudWxsXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGlmIChkYXRhVmFsdWVzLnNpemUgPT0gMSkge1xuICAgICAgICAgICAgdmFsIGRhdGFWYWx1ZSA9IGRhdGFWYWx1ZXMuc2luZ2xlKClcbiAgICAgICAgICAgIERhdGFQb2ludChcbiAgICAgICAgICAgICAgICBsYWJlbCA9IGNob29zZUxhYmVsKGRhdGFWYWx1ZS5sYWJlbCksXG4gICAgICAgICAgICAgICAgdmFsdWUgPSBteUxpbmVGb3JtYXR0ZXIuZm9ybWF0KGRhdGFWYWx1ZS52YWx1ZSksXG4gICAgICAgICAgICAgICAgYWVzID0gZGF0YVZhbHVlLmFlcyxcbiAgICAgICAgICAgICAgICBpc0F4aXMgPSBkYXRhVmFsdWUuaXNBeGlzLFxuICAgICAgICAgICAgICAgIGlzT3V0bGllciA9IGRhdGFWYWx1ZS5pc091dGxpZXJcbiAgICAgICAgICAgIClcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIERhdGFQb2ludChcbiAgICAgICAgICAgICAgICBsYWJlbCA9IGNob29zZUxhYmVsKGRhdGFWYWx1ZXMuam9pblRvU3RyaW5nKFwiLCBcIikgeyBpdC5sYWJlbCA/OiBcIlwiIH0pL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AgICAgZnVuIHdpdGhvdXRUb29sdGlwKCkgPSBUb29sdGlwU3BlY2lmaWNhdGlvbihcbiAgICAgICAgICAgIHZhbHVlU291cmNlcyA9IGVtcHR5TGlzdCgpLFxuICAgICAgICAgICAgdG9vbHRpcExpbmVQYXR0ZXJucyA9IGVtcHR5TGlzdCgpLFxuICAgICAgICAgICAgdG9vbHRpcFByb3BlcnRpZXMgPSBUb29sdGlwUHJvcGVydGllcy5OT05FXG4gICAgICAgIClcblxuICAgICAgICBmdW4gZGVmYXVsdFRvb2x0aXAoKSA9IFRvb2x0aXBTcGVjaWZpY2F0aW9uKFxuICAgICAgICAgICAgdmFsdWVTb3VyY2VzID0gZW1wdHlMaXN0KCksXG4gICAgICAgICAgICB0b29sdGlwTGluZVBhdHRlcm5zID0gbnVsbCxcbiAgICAgICAgICAgIHRvb2x0aXBQcm9wZXJ0aWVzID0gVG9vbHRpcFByb3BlcnRpZXMuTk9ORVxuICAgICAgICApXG4gICAgfVxufSJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./kotlin-dce-dev/lets-plot-plot-builder-portable.js\n"); /***/ }), @@ -185,7 +185,7 @@ eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPAC \**********************************************************/ /***/ (function(module, exports, __webpack_require__) { -eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) {\n if (true)\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(/*! kotlin */ \"./kotlin-dce-dev/kotlin.js\"), __webpack_require__(/*! lets-plot-base-portable */ \"./kotlin-dce-dev/lets-plot-base-portable.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n else {}\n}(this, function (_, Kotlin, $module$lets_plot_base_portable) {\n 'use strict';\n var Enum = Kotlin.kotlin.Enum;\n var Kind_CLASS = Kotlin.Kind.CLASS;\n var throwISE = Kotlin.throwISE;\n var Kind_OBJECT = Kotlin.Kind.OBJECT;\n var JsMath = Math;\n var Kind_INTERFACE = Kotlin.Kind.INTERFACE;\n var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_287e2$;\n var ArrayList_init_0 = Kotlin.kotlin.collections.ArrayList_init_ww73n8$;\n var Color = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Color;\n var collect = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect;\n var Exception = Kotlin.kotlin.Exception;\n var throwCCE = Kotlin.throwCCE;\n var setOf = Kotlin.kotlin.collections.setOf_i5x0yv$;\n var HashMap_init = Kotlin.kotlin.collections.HashMap_init_q3lmfv$;\n var numberToInt = Kotlin.numberToInt;\n var ensureNotNull = Kotlin.ensureNotNull;\n var ClosedRange = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.ClosedRange;\n var Ordering = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.Ordering;\n var isFinite = Kotlin.kotlin.isFinite_yrwdxr$;\n var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init_pdl1vj$;\n var take = Kotlin.kotlin.collections.take_ba2ldo$;\n var toList = Kotlin.kotlin.collections.toList_7wnvza$;\n var List = Kotlin.kotlin.collections.List;\n var listOf = Kotlin.kotlin.collections.listOf_i5x0yv$;\n var Iterable = Kotlin.kotlin.collections.Iterable;\n var isInfinite = Kotlin.kotlin.isInfinite_yrwdxr$;\n var equals = Kotlin.equals;\n var contains = Kotlin.kotlin.collections.contains_2ws7j4$;\n var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init_pdl1vj$;\n var Stack = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.Stack;\n var kotlin_js_internal_DoubleCompanionObject = Kotlin.kotlin.js.internal.DoubleCompanionObject;\n var Pair = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Pair;\n var DoubleSegment = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleSegment;\n var until = Kotlin.kotlin.ranges.until_dqglrj$;\n var isNaN_0 = Kotlin.kotlin.isNaN_yrwdxr$;\n var reversed = Kotlin.kotlin.comparisons.reversed_2avth4$;\n var sortedWith = Kotlin.kotlin.collections.sortedWith_eknfly$;\n var sorted = Kotlin.kotlin.collections.sorted_exjks8$;\n var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$;\n var wrapFunction = Kotlin.wrapFunction;\n var Comparator = Kotlin.kotlin.Comparator;\n var binarySearch = Kotlin.kotlin.collections.binarySearch_vikexg$;\n var Format_init = $module$lets_plot_base_portable.jetbrains.datalore.base.dateFormat.Format_init_61zpoe$;\n var numberToLong = Kotlin.numberToLong;\n var Instant = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.Instant;\n var getCallableRef = Kotlin.getCallableRef;\n var TimeZone = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.tz.TimeZone;\n var NumberFormat_init = $module$lets_plot_base_portable.jetbrains.datalore.base.numberFormat.NumberFormat_init_61zpoe$;\n var roundToLong = Kotlin.kotlin.math.roundToLong_yrwdxr$;\n var RuntimeException = Kotlin.kotlin.RuntimeException;\n var Date_0 = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.Date;\n var DateTime = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.DateTime;\n var Duration = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.Duration;\n var RuntimeException_init = Kotlin.kotlin.RuntimeException_init_pdl1vj$;\n var Month = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.Month;\n var UnsupportedOperationException_init = Kotlin.kotlin.UnsupportedOperationException_init;\n var startsWith = Kotlin.kotlin.text.startsWith_7epoxm$;\n var toInt = Kotlin.kotlin.text.toInt_pdl1vz$;\n var NumberFormatException = Kotlin.kotlin.NumberFormatException;\n ColorPalette$Type.prototype = Object.create(Enum.prototype);\n ColorPalette$Type.prototype.constructor = ColorPalette$Type;\n ColorPalette$Sequential.prototype = Object.create(Enum.prototype);\n ColorPalette$Sequential.prototype.constructor = ColorPalette$Sequential;\n ColorPalette$Diverging.prototype = Object.create(Enum.prototype);\n ColorPalette$Diverging.prototype.constructor = ColorPalette$Diverging;\n ColorPalette$Qualitative.prototype = Object.create(Enum.prototype);\n ColorPalette$Qualitative.prototype.constructor = ColorPalette$Qualitative;\n DataType.prototype = Object.create(Enum.prototype);\n DataType.prototype.constructor = DataType;\n RegularMeshDetector$MyRowDetector.prototype = Object.create(RegularMeshDetector.prototype);\n RegularMeshDetector$MyRowDetector.prototype.constructor = RegularMeshDetector$MyRowDetector;\n RegularMeshDetector$MyColumnDetector.prototype = Object.create(RegularMeshDetector.prototype);\n RegularMeshDetector$MyColumnDetector.prototype.constructor = RegularMeshDetector$MyColumnDetector;\n RegularMeshDetector$Companion$NO_MESH$ObjectLiteral.prototype = Object.create(RegularMeshDetector.prototype);\n RegularMeshDetector$Companion$NO_MESH$ObjectLiteral.prototype.constructor = RegularMeshDetector$Companion$NO_MESH$ObjectLiteral;\n SeriesUtil$CheckedDoubleList.prototype = Object.create(SeriesUtil$CheckedDoubleIterable.prototype);\n SeriesUtil$CheckedDoubleList.prototype.constructor = SeriesUtil$CheckedDoubleList;\n DurationInterval.prototype = Object.create(TimeInterval.prototype);\n DurationInterval.prototype.constructor = DurationInterval;\n MeasuredInDays.prototype = Object.create(TimeInterval.prototype);\n MeasuredInDays.prototype.constructor = MeasuredInDays;\n MonthInterval.prototype = Object.create(MeasuredInDays.prototype);\n MonthInterval.prototype.constructor = MonthInterval;\n QuarterInterval.prototype = Object.create(TimeInterval.prototype);\n QuarterInterval.prototype.constructor = QuarterInterval;\n SemesterInterval.prototype = Object.create(TimeInterval.prototype);\n SemesterInterval.prototype.constructor = SemesterInterval;\n YearInterval.prototype = Object.create(MeasuredInDays.prototype);\n YearInterval.prototype.constructor = YearInterval;\n function ColorPalette() {\n ColorPalette_instance = this;\n this.MIN_COLOR_SET_SIZE_0 = 3;\n }\n ColorPalette.prototype.colors_0 = function (scheme, count) {\n var count_0 = count;\n var b = count_0;\n count_0 = JsMath.max(3, b);\n var a = scheme.maxColors;\n var b_0 = count_0;\n count_0 = JsMath.min(a, b_0);\n return scheme.colorSet[count_0 - 3 | 0];\n };\n ColorPalette.prototype.maxColorSetSize_0 = function (scheme) {\n var colorSet = scheme.colorSet;\n return colorSet[colorSet.length - 1 | 0].length;\n };\n function ColorPalette$Type(name, ordinal, myPresentation) {\n Enum.call(this);\n this.myPresentation_6glhnl$_0 = myPresentation;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ColorPalette$Type_initFields() {\n ColorPalette$Type_initFields = function () {\n };\n ColorPalette$Type$SEQUENTIAL_instance = new ColorPalette$Type('SEQUENTIAL', 0, 'sequential');\n ColorPalette$Type$DIVERGING_instance = new ColorPalette$Type('DIVERGING', 1, 'diverging');\n ColorPalette$Type$QUALITATIVE_instance = new ColorPalette$Type('QUALITATIVE', 2, 'qualitative');\n }\n var ColorPalette$Type$SEQUENTIAL_instance;\n function ColorPalette$Type$SEQUENTIAL_getInstance() {\n ColorPalette$Type_initFields();\n return ColorPalette$Type$SEQUENTIAL_instance;\n }\n var ColorPalette$Type$DIVERGING_instance;\n function ColorPalette$Type$DIVERGING_getInstance() {\n ColorPalette$Type_initFields();\n return ColorPalette$Type$DIVERGING_instance;\n }\n var ColorPalette$Type$QUALITATIVE_instance;\n function ColorPalette$Type$QUALITATIVE_getInstance() {\n ColorPalette$Type_initFields();\n return ColorPalette$Type$QUALITATIVE_instance;\n }\n ColorPalette$Type.prototype.toString = function () {\n return this.myPresentation_6glhnl$_0;\n };\n ColorPalette$Type.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Type',\n interfaces: [Enum]\n };\n function ColorPalette$Type$values() {\n return [ColorPalette$Type$SEQUENTIAL_getInstance(), ColorPalette$Type$DIVERGING_getInstance(), ColorPalette$Type$QUALITATIVE_getInstance()];\n }\n ColorPalette$Type.values = ColorPalette$Type$values;\n function ColorPalette$Type$valueOf(name) {\n switch (name) {\n case 'SEQUENTIAL':\n return ColorPalette$Type$SEQUENTIAL_getInstance();\n case 'DIVERGING':\n return ColorPalette$Type$DIVERGING_getInstance();\n case 'QUALITATIVE':\n return ColorPalette$Type$QUALITATIVE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Type.' + name);\n }\n }\n ColorPalette$Type.valueOf_61zpoe$ = ColorPalette$Type$valueOf;\n function ColorPalette$Sequential(name, ordinal, myPresentation, colorSet) {\n Enum.call(this);\n this.myPresentation_w2uxp8$_0 = myPresentation;\n this.colorSet_b1v09h$_0 = colorSet;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ColorPalette$Sequential_initFields() {\n ColorPalette$Sequential_initFields = function () {\n };\n ColorPalette$Sequential$Blues_instance = new ColorPalette$Sequential('Blues', 0, 'blues', ColorSets_getInstance().BLUES);\n ColorPalette$Sequential$BuGn_instance = new ColorPalette$Sequential('BuGn', 1, 'blue-green', ColorSets_getInstance().BU_GN);\n ColorPalette$Sequential$BuPu_instance = new ColorPalette$Sequential('BuPu', 2, 'blue-purple', ColorSets_getInstance().BU_PU);\n ColorPalette$Sequential$GnBu_instance = new ColorPalette$Sequential('GnBu', 3, 'green-blue', ColorSets_getInstance().GN_BU);\n ColorPalette$Sequential$Greens_instance = new ColorPalette$Sequential('Greens', 4, 'greens', ColorSets_getInstance().GREENS);\n ColorPalette$Sequential$Greys_instance = new ColorPalette$Sequential('Greys', 5, 'greys', ColorSets_getInstance().GREYS);\n ColorPalette$Sequential$Oranges_instance = new ColorPalette$Sequential('Oranges', 6, 'oranges', ColorSets_getInstance().ORANGES);\n ColorPalette$Sequential$OrRd_instance = new ColorPalette$Sequential('OrRd', 7, 'orange-red', ColorSets_getInstance().OR_RD);\n ColorPalette$Sequential$PuBu_instance = new ColorPalette$Sequential('PuBu', 8, 'purple-blue', ColorSets_getInstance().PU_BU);\n ColorPalette$Sequential$PuBuGn_instance = new ColorPalette$Sequential('PuBuGn', 9, 'purple-blue-green', ColorSets_getInstance().PU_BU_GN);\n ColorPalette$Sequential$PuRd_instance = new ColorPalette$Sequential('PuRd', 10, 'purple-red', ColorSets_getInstance().PU_RD);\n ColorPalette$Sequential$Purples_instance = new ColorPalette$Sequential('Purples', 11, 'purples', ColorSets_getInstance().PURPLES);\n ColorPalette$Sequential$RdPu_instance = new ColorPalette$Sequential('RdPu', 12, 'red-purple', ColorSets_getInstance().RD_PU);\n ColorPalette$Sequential$Reds_instance = new ColorPalette$Sequential('Reds', 13, 'reds', ColorSets_getInstance().REDS);\n ColorPalette$Sequential$YlGn_instance = new ColorPalette$Sequential('YlGn', 14, 'yellow-green', ColorSets_getInstance().YL_GN);\n ColorPalette$Sequential$YlGnBu_instance = new ColorPalette$Sequential('YlGnBu', 15, 'yellow-green-blue', ColorSets_getInstance().YL_GN_BU);\n ColorPalette$Sequential$YlOrBr_instance = new ColorPalette$Sequential('YlOrBr', 16, 'yellow-orange-brown', ColorSets_getInstance().YL_OR_BR);\n ColorPalette$Sequential$YlOrRd_instance = new ColorPalette$Sequential('YlOrRd', 17, 'yellow-orange-red', ColorSets_getInstance().YL_OR_RD);\n }\n Object.defineProperty(ColorPalette$Sequential.prototype, 'colorSet', {\n get: function () {\n return this.colorSet_b1v09h$_0;\n }\n });\n var ColorPalette$Sequential$Blues_instance;\n function ColorPalette$Sequential$Blues_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Blues_instance;\n }\n var ColorPalette$Sequential$BuGn_instance;\n function ColorPalette$Sequential$BuGn_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$BuGn_instance;\n }\n var ColorPalette$Sequential$BuPu_instance;\n function ColorPalette$Sequential$BuPu_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$BuPu_instance;\n }\n var ColorPalette$Sequential$GnBu_instance;\n function ColorPalette$Sequential$GnBu_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$GnBu_instance;\n }\n var ColorPalette$Sequential$Greens_instance;\n function ColorPalette$Sequential$Greens_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Greens_instance;\n }\n var ColorPalette$Sequential$Greys_instance;\n function ColorPalette$Sequential$Greys_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Greys_instance;\n }\n var ColorPalette$Sequential$Oranges_instance;\n function ColorPalette$Sequential$Oranges_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Oranges_instance;\n }\n var ColorPalette$Sequential$OrRd_instance;\n function ColorPalette$Sequential$OrRd_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$OrRd_instance;\n }\n var ColorPalette$Sequential$PuBu_instance;\n function ColorPalette$Sequential$PuBu_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$PuBu_instance;\n }\n var ColorPalette$Sequential$PuBuGn_instance;\n function ColorPalette$Sequential$PuBuGn_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$PuBuGn_instance;\n }\n var ColorPalette$Sequential$PuRd_instance;\n function ColorPalette$Sequential$PuRd_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$PuRd_instance;\n }\n var ColorPalette$Sequential$Purples_instance;\n function ColorPalette$Sequential$Purples_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Purples_instance;\n }\n var ColorPalette$Sequential$RdPu_instance;\n function ColorPalette$Sequential$RdPu_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$RdPu_instance;\n }\n var ColorPalette$Sequential$Reds_instance;\n function ColorPalette$Sequential$Reds_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Reds_instance;\n }\n var ColorPalette$Sequential$YlGn_instance;\n function ColorPalette$Sequential$YlGn_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$YlGn_instance;\n }\n var ColorPalette$Sequential$YlGnBu_instance;\n function ColorPalette$Sequential$YlGnBu_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$YlGnBu_instance;\n }\n var ColorPalette$Sequential$YlOrBr_instance;\n function ColorPalette$Sequential$YlOrBr_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$YlOrBr_instance;\n }\n var ColorPalette$Sequential$YlOrRd_instance;\n function ColorPalette$Sequential$YlOrRd_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$YlOrRd_instance;\n }\n Object.defineProperty(ColorPalette$Sequential.prototype, 'type', {\n configurable: true,\n get: function () {\n return ColorPalette$Type$SEQUENTIAL_getInstance();\n }\n });\n Object.defineProperty(ColorPalette$Sequential.prototype, 'maxColors', {\n configurable: true,\n get: function () {\n return ColorPalette_getInstance().maxColorSetSize_0(this);\n }\n });\n ColorPalette$Sequential.prototype.getColors_za3lpa$ = function (count) {\n return ColorPalette_getInstance().colors_0(this, count);\n };\n ColorPalette$Sequential.prototype.toString = function () {\n return this.myPresentation_w2uxp8$_0;\n };\n ColorPalette$Sequential.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Sequential',\n interfaces: [ColorScheme, Enum]\n };\n function ColorPalette$Sequential$values() {\n return [ColorPalette$Sequential$Blues_getInstance(), ColorPalette$Sequential$BuGn_getInstance(), ColorPalette$Sequential$BuPu_getInstance(), ColorPalette$Sequential$GnBu_getInstance(), ColorPalette$Sequential$Greens_getInstance(), ColorPalette$Sequential$Greys_getInstance(), ColorPalette$Sequential$Oranges_getInstance(), ColorPalette$Sequential$OrRd_getInstance(), ColorPalette$Sequential$PuBu_getInstance(), ColorPalette$Sequential$PuBuGn_getInstance(), ColorPalette$Sequential$PuRd_getInstance(), ColorPalette$Sequential$Purples_getInstance(), ColorPalette$Sequential$RdPu_getInstance(), ColorPalette$Sequential$Reds_getInstance(), ColorPalette$Sequential$YlGn_getInstance(), ColorPalette$Sequential$YlGnBu_getInstance(), ColorPalette$Sequential$YlOrBr_getInstance(), ColorPalette$Sequential$YlOrRd_getInstance()];\n }\n ColorPalette$Sequential.values = ColorPalette$Sequential$values;\n function ColorPalette$Sequential$valueOf(name) {\n switch (name) {\n case 'Blues':\n return ColorPalette$Sequential$Blues_getInstance();\n case 'BuGn':\n return ColorPalette$Sequential$BuGn_getInstance();\n case 'BuPu':\n return ColorPalette$Sequential$BuPu_getInstance();\n case 'GnBu':\n return ColorPalette$Sequential$GnBu_getInstance();\n case 'Greens':\n return ColorPalette$Sequential$Greens_getInstance();\n case 'Greys':\n return ColorPalette$Sequential$Greys_getInstance();\n case 'Oranges':\n return ColorPalette$Sequential$Oranges_getInstance();\n case 'OrRd':\n return ColorPalette$Sequential$OrRd_getInstance();\n case 'PuBu':\n return ColorPalette$Sequential$PuBu_getInstance();\n case 'PuBuGn':\n return ColorPalette$Sequential$PuBuGn_getInstance();\n case 'PuRd':\n return ColorPalette$Sequential$PuRd_getInstance();\n case 'Purples':\n return ColorPalette$Sequential$Purples_getInstance();\n case 'RdPu':\n return ColorPalette$Sequential$RdPu_getInstance();\n case 'Reds':\n return ColorPalette$Sequential$Reds_getInstance();\n case 'YlGn':\n return ColorPalette$Sequential$YlGn_getInstance();\n case 'YlGnBu':\n return ColorPalette$Sequential$YlGnBu_getInstance();\n case 'YlOrBr':\n return ColorPalette$Sequential$YlOrBr_getInstance();\n case 'YlOrRd':\n return ColorPalette$Sequential$YlOrRd_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Sequential.' + name);\n }\n }\n ColorPalette$Sequential.valueOf_61zpoe$ = ColorPalette$Sequential$valueOf;\n function ColorPalette$Diverging(name, ordinal, myPresentation, colorSet) {\n Enum.call(this);\n this.myPresentation_im16qo$_0 = myPresentation;\n this.colorSet_las6nb$_0 = colorSet;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ColorPalette$Diverging_initFields() {\n ColorPalette$Diverging_initFields = function () {\n };\n ColorPalette$Diverging$BrBG_instance = new ColorPalette$Diverging('BrBG', 0, 'brown-blue/green', ColorSets_getInstance().BR_BG);\n ColorPalette$Diverging$PiYG_instance = new ColorPalette$Diverging('PiYG', 1, 'pink-yellow/green', ColorSets_getInstance().PI_YG);\n ColorPalette$Diverging$PRGn_instance = new ColorPalette$Diverging('PRGn', 2, 'purple/red-green', ColorSets_getInstance().PR_GN);\n ColorPalette$Diverging$PuOr_instance = new ColorPalette$Diverging('PuOr', 3, 'purple-orange', ColorSets_getInstance().PU_OR);\n ColorPalette$Diverging$RdBu_instance = new ColorPalette$Diverging('RdBu', 4, 'red-blue', ColorSets_getInstance().RD_BU);\n ColorPalette$Diverging$RdGy_instance = new ColorPalette$Diverging('RdGy', 5, 'red-grey', ColorSets_getInstance().RD_GY);\n ColorPalette$Diverging$RdYlBu_instance = new ColorPalette$Diverging('RdYlBu', 6, 'red-yellow-blue', ColorSets_getInstance().RD_YL_BU);\n ColorPalette$Diverging$RdYlGn_instance = new ColorPalette$Diverging('RdYlGn', 7, 'red-yellow-green', ColorSets_getInstance().RD_YL_GN);\n ColorPalette$Diverging$Spectral_instance = new ColorPalette$Diverging('Spectral', 8, 'spectral', ColorSets_getInstance().SPECTRAL);\n }\n Object.defineProperty(ColorPalette$Diverging.prototype, 'colorSet', {\n get: function () {\n return this.colorSet_las6nb$_0;\n }\n });\n var ColorPalette$Diverging$BrBG_instance;\n function ColorPalette$Diverging$BrBG_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$BrBG_instance;\n }\n var ColorPalette$Diverging$PiYG_instance;\n function ColorPalette$Diverging$PiYG_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$PiYG_instance;\n }\n var ColorPalette$Diverging$PRGn_instance;\n function ColorPalette$Diverging$PRGn_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$PRGn_instance;\n }\n var ColorPalette$Diverging$PuOr_instance;\n function ColorPalette$Diverging$PuOr_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$PuOr_instance;\n }\n var ColorPalette$Diverging$RdBu_instance;\n function ColorPalette$Diverging$RdBu_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$RdBu_instance;\n }\n var ColorPalette$Diverging$RdGy_instance;\n function ColorPalette$Diverging$RdGy_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$RdGy_instance;\n }\n var ColorPalette$Diverging$RdYlBu_instance;\n function ColorPalette$Diverging$RdYlBu_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$RdYlBu_instance;\n }\n var ColorPalette$Diverging$RdYlGn_instance;\n function ColorPalette$Diverging$RdYlGn_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$RdYlGn_instance;\n }\n var ColorPalette$Diverging$Spectral_instance;\n function ColorPalette$Diverging$Spectral_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$Spectral_instance;\n }\n Object.defineProperty(ColorPalette$Diverging.prototype, 'type', {\n configurable: true,\n get: function () {\n return ColorPalette$Type$DIVERGING_getInstance();\n }\n });\n Object.defineProperty(ColorPalette$Diverging.prototype, 'maxColors', {\n configurable: true,\n get: function () {\n return ColorPalette_getInstance().maxColorSetSize_0(this);\n }\n });\n ColorPalette$Diverging.prototype.getColors_za3lpa$ = function (count) {\n return ColorPalette_getInstance().colors_0(this, count);\n };\n ColorPalette$Diverging.prototype.toString = function () {\n return this.myPresentation_im16qo$_0;\n };\n ColorPalette$Diverging.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Diverging',\n interfaces: [ColorScheme, Enum]\n };\n function ColorPalette$Diverging$values() {\n return [ColorPalette$Diverging$BrBG_getInstance(), ColorPalette$Diverging$PiYG_getInstance(), ColorPalette$Diverging$PRGn_getInstance(), ColorPalette$Diverging$PuOr_getInstance(), ColorPalette$Diverging$RdBu_getInstance(), ColorPalette$Diverging$RdGy_getInstance(), ColorPalette$Diverging$RdYlBu_getInstance(), ColorPalette$Diverging$RdYlGn_getInstance(), ColorPalette$Diverging$Spectral_getInstance()];\n }\n ColorPalette$Diverging.values = ColorPalette$Diverging$values;\n function ColorPalette$Diverging$valueOf(name) {\n switch (name) {\n case 'BrBG':\n return ColorPalette$Diverging$BrBG_getInstance();\n case 'PiYG':\n return ColorPalette$Diverging$PiYG_getInstance();\n case 'PRGn':\n return ColorPalette$Diverging$PRGn_getInstance();\n case 'PuOr':\n return ColorPalette$Diverging$PuOr_getInstance();\n case 'RdBu':\n return ColorPalette$Diverging$RdBu_getInstance();\n case 'RdGy':\n return ColorPalette$Diverging$RdGy_getInstance();\n case 'RdYlBu':\n return ColorPalette$Diverging$RdYlBu_getInstance();\n case 'RdYlGn':\n return ColorPalette$Diverging$RdYlGn_getInstance();\n case 'Spectral':\n return ColorPalette$Diverging$Spectral_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Diverging.' + name);\n }\n }\n ColorPalette$Diverging.valueOf_61zpoe$ = ColorPalette$Diverging$valueOf;\n function ColorPalette$Qualitative(name, ordinal, myPresentation, colorSet) {\n Enum.call(this);\n this.myPresentation_av4sq6$_0 = myPresentation;\n this.colorSet_cgz7kp$_0 = colorSet;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ColorPalette$Qualitative_initFields() {\n ColorPalette$Qualitative_initFields = function () {\n };\n ColorPalette$Qualitative$Accent_instance = new ColorPalette$Qualitative('Accent', 0, 'accent', ColorSets_getInstance().ACCENT);\n ColorPalette$Qualitative$Dark2_instance = new ColorPalette$Qualitative('Dark2', 1, 'dark 2', ColorSets_getInstance().DARK_2);\n ColorPalette$Qualitative$Paired_instance = new ColorPalette$Qualitative('Paired', 2, 'paired', ColorSets_getInstance().PAIRED);\n ColorPalette$Qualitative$Pastel1_instance = new ColorPalette$Qualitative('Pastel1', 3, 'pastel 1', ColorSets_getInstance().PASTEL_1);\n ColorPalette$Qualitative$Pastel2_instance = new ColorPalette$Qualitative('Pastel2', 4, 'pastel 2', ColorSets_getInstance().PASTEL_2);\n ColorPalette$Qualitative$Set1_instance = new ColorPalette$Qualitative('Set1', 5, 'set 1', ColorSets_getInstance().SET_1);\n ColorPalette$Qualitative$Set2_instance = new ColorPalette$Qualitative('Set2', 6, 'set 2', ColorSets_getInstance().SET_2);\n ColorPalette$Qualitative$Set3_instance = new ColorPalette$Qualitative('Set3', 7, 'set 3', ColorSets_getInstance().SET_3);\n }\n Object.defineProperty(ColorPalette$Qualitative.prototype, 'colorSet', {\n get: function () {\n return this.colorSet_cgz7kp$_0;\n }\n });\n var ColorPalette$Qualitative$Accent_instance;\n function ColorPalette$Qualitative$Accent_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Accent_instance;\n }\n var ColorPalette$Qualitative$Dark2_instance;\n function ColorPalette$Qualitative$Dark2_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Dark2_instance;\n }\n var ColorPalette$Qualitative$Paired_instance;\n function ColorPalette$Qualitative$Paired_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Paired_instance;\n }\n var ColorPalette$Qualitative$Pastel1_instance;\n function ColorPalette$Qualitative$Pastel1_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Pastel1_instance;\n }\n var ColorPalette$Qualitative$Pastel2_instance;\n function ColorPalette$Qualitative$Pastel2_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Pastel2_instance;\n }\n var ColorPalette$Qualitative$Set1_instance;\n function ColorPalette$Qualitative$Set1_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Set1_instance;\n }\n var ColorPalette$Qualitative$Set2_instance;\n function ColorPalette$Qualitative$Set2_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Set2_instance;\n }\n var ColorPalette$Qualitative$Set3_instance;\n function ColorPalette$Qualitative$Set3_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Set3_instance;\n }\n Object.defineProperty(ColorPalette$Qualitative.prototype, 'type', {\n configurable: true,\n get: function () {\n return ColorPalette$Type$QUALITATIVE_getInstance();\n }\n });\n Object.defineProperty(ColorPalette$Qualitative.prototype, 'maxColors', {\n configurable: true,\n get: function () {\n return ColorPalette_getInstance().maxColorSetSize_0(this);\n }\n });\n ColorPalette$Qualitative.prototype.getColors_za3lpa$ = function (count) {\n return ColorPalette_getInstance().colors_0(this, count);\n };\n ColorPalette$Qualitative.prototype.toString = function () {\n return this.myPresentation_av4sq6$_0;\n };\n ColorPalette$Qualitative.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Qualitative',\n interfaces: [ColorScheme, Enum]\n };\n function ColorPalette$Qualitative$values() {\n return [ColorPalette$Qualitative$Accent_getInstance(), ColorPalette$Qualitative$Dark2_getInstance(), ColorPalette$Qualitative$Paired_getInstance(), ColorPalette$Qualitative$Pastel1_getInstance(), ColorPalette$Qualitative$Pastel2_getInstance(), ColorPalette$Qualitative$Set1_getInstance(), ColorPalette$Qualitative$Set2_getInstance(), ColorPalette$Qualitative$Set3_getInstance()];\n }\n ColorPalette$Qualitative.values = ColorPalette$Qualitative$values;\n function ColorPalette$Qualitative$valueOf(name) {\n switch (name) {\n case 'Accent':\n return ColorPalette$Qualitative$Accent_getInstance();\n case 'Dark2':\n return ColorPalette$Qualitative$Dark2_getInstance();\n case 'Paired':\n return ColorPalette$Qualitative$Paired_getInstance();\n case 'Pastel1':\n return ColorPalette$Qualitative$Pastel1_getInstance();\n case 'Pastel2':\n return ColorPalette$Qualitative$Pastel2_getInstance();\n case 'Set1':\n return ColorPalette$Qualitative$Set1_getInstance();\n case 'Set2':\n return ColorPalette$Qualitative$Set2_getInstance();\n case 'Set3':\n return ColorPalette$Qualitative$Set3_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Qualitative.' + name);\n }\n }\n ColorPalette$Qualitative.valueOf_61zpoe$ = ColorPalette$Qualitative$valueOf;\n ColorPalette.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ColorPalette',\n interfaces: []\n };\n var ColorPalette_instance = null;\n function ColorPalette_getInstance() {\n if (ColorPalette_instance === null) {\n new ColorPalette();\n }return ColorPalette_instance;\n }\n function ColorScheme() {\n }\n ColorScheme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ColorScheme',\n interfaces: []\n };\n function ColorSets() {\n ColorSets_instance = this;\n this.BU_GN_3 = ['#e5f5f9', '#99d8c9', '#2ca25f'];\n this.BU_GN_4 = ['#edf8fb', '#b2e2e2', '#66c2a4', '#238b45'];\n this.BU_GN_5 = ['#edf8fb', '#b2e2e2', '#66c2a4', '#2ca25f', '#006d2c'];\n this.BU_GN_6 = ['#edf8fb', '#ccece6', '#99d8c9', '#66c2a4', '#2ca25f', '#006d2c'];\n this.BU_GN_7 = ['#edf8fb', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#005824'];\n this.BU_GN_8 = ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#005824'];\n this.BU_GN_9 = ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'];\n this.BU_PU_3 = ['#e0ecf4', '#9ebcda', '#8856a7'];\n this.BU_PU_4 = ['#edf8fb', '#b3cde3', '#8c96c6', '#88419d'];\n this.BU_PU_5 = ['#edf8fb', '#b3cde3', '#8c96c6', '#8856a7', '#810f7c'];\n this.BU_PU_6 = ['#edf8fb', '#bfd3e6', '#9ebcda', '#8c96c6', '#8856a7', '#810f7c'];\n this.BU_PU_7 = ['#edf8fb', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#6e016b'];\n this.BU_PU_8 = ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#6e016b'];\n this.BU_PU_9 = ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'];\n this.GN_BU_3 = ['#e0f3db', '#a8ddb5', '#43a2ca'];\n this.GN_BU_4 = ['#f0f9e8', '#bae4bc', '#7bccc4', '#2b8cbe'];\n this.GN_BU_5 = ['#f0f9e8', '#bae4bc', '#7bccc4', '#43a2ca', '#0868ac'];\n this.GN_BU_6 = ['#f0f9e8', '#ccebc5', '#a8ddb5', '#7bccc4', '#43a2ca', '#0868ac'];\n this.GN_BU_7 = ['#f0f9e8', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e'];\n this.GN_BU_8 = ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e'];\n this.GN_BU_9 = ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'];\n this.OR_RD_3 = ['#fee8c8', '#fdbb84', '#e34a33'];\n this.OR_RD_4 = ['#fef0d9', '#fdcc8a', '#fc8d59', '#d7301f'];\n this.OR_RD_5 = ['#fef0d9', '#fdcc8a', '#fc8d59', '#e34a33', '#b30000'];\n this.OR_RD_6 = ['#fef0d9', '#fdd49e', '#fdbb84', '#fc8d59', '#e34a33', '#b30000'];\n this.OR_RD_7 = ['#fef0d9', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#990000'];\n this.OR_RD_8 = ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#990000'];\n this.OR_RD_9 = ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'];\n this.PU_BU_3 = ['#ece7f2', '#a6bddb', '#2b8cbe'];\n this.PU_BU_4 = ['#f1eef6', '#bdc9e1', '#74a9cf', '#0570b0'];\n this.PU_BU_5 = ['#f1eef6', '#bdc9e1', '#74a9cf', '#2b8cbe', '#045a8d'];\n this.PU_BU_6 = ['#f1eef6', '#d0d1e6', '#a6bddb', '#74a9cf', '#2b8cbe', '#045a8d'];\n this.PU_BU_7 = ['#f1eef6', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b'];\n this.PU_BU_8 = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b'];\n this.PU_BU_9 = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'];\n this.PU_BU_GN_3 = ['#ece2f0', '#a6bddb', '#1c9099'];\n this.PU_BU_GN_4 = ['#f6eff7', '#bdc9e1', '#67a9cf', '#02818a'];\n this.PU_BU_GN_5 = ['#f6eff7', '#bdc9e1', '#67a9cf', '#1c9099', '#016c59'];\n this.PU_BU_GN_6 = ['#f6eff7', '#d0d1e6', '#a6bddb', '#67a9cf', '#1c9099', '#016c59'];\n this.PU_BU_GN_7 = ['#f6eff7', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016450'];\n this.PU_BU_GN_8 = ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016450'];\n this.PU_BU_GN_9 = ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'];\n this.PU_RD_3 = ['#e7e1ef', '#c994c7', '#dd1c77'];\n this.PU_RD_4 = ['#f1eef6', '#d7b5d8', '#df65b0', '#ce1256'];\n this.PU_RD_5 = ['#f1eef6', '#d7b5d8', '#df65b0', '#dd1c77', '#980043'];\n this.PU_RD_6 = ['#f1eef6', '#d4b9da', '#c994c7', '#df65b0', '#dd1c77', '#980043'];\n this.PU_RD_7 = ['#f1eef6', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#91003f'];\n this.PU_RD_8 = ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#91003f'];\n this.PU_RD_9 = ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'];\n this.RD_PU_3 = ['#fde0dd', '#fa9fb5', '#c51b8a'];\n this.RD_PU_4 = ['#feebe2', '#fbb4b9', '#f768a1', '#ae017e'];\n this.RD_PU_5 = ['#feebe2', '#fbb4b9', '#f768a1', '#c51b8a', '#7a0177'];\n this.RD_PU_6 = ['#feebe2', '#fcc5c0', '#fa9fb5', '#f768a1', '#c51b8a', '#7a0177'];\n this.RD_PU_7 = ['#feebe2', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177'];\n this.RD_PU_8 = ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177'];\n this.RD_PU_9 = ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'];\n this.YL_GN_3 = ['#f7fcb9', '#addd8e', '#31a354'];\n this.YL_GN_4 = ['#ffffcc', '#c2e699', '#78c679', '#238443'];\n this.YL_GN_5 = ['#ffffcc', '#c2e699', '#78c679', '#31a354', '#006837'];\n this.YL_GN_6 = ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#31a354', '#006837'];\n this.YL_GN_7 = ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'];\n this.YL_GN_8 = ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'];\n this.YL_GN_9 = ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'];\n this.YL_GN_BU_3 = ['#edf8b1', '#7fcdbb', '#2c7fb8'];\n this.YL_GN_BU_4 = ['#ffffcc', '#a1dab4', '#41b6c4', '#225ea8'];\n this.YL_GN_BU_5 = ['#ffffcc', '#a1dab4', '#41b6c4', '#2c7fb8', '#253494'];\n this.YL_GN_BU_6 = ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#2c7fb8', '#253494'];\n this.YL_GN_BU_7 = ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'];\n this.YL_GN_BU_8 = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'];\n this.YL_GN_BU_9 = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'];\n this.YL_OR_BR_3 = ['#fff7bc', '#fec44f', '#d95f0e'];\n this.YL_OR_BR_4 = ['#ffffd4', '#fed98e', '#fe9929', '#cc4c02'];\n this.YL_OR_BR_5 = ['#ffffd4', '#fed98e', '#fe9929', '#d95f0e', '#993404'];\n this.YL_OR_BR_6 = ['#ffffd4', '#fee391', '#fec44f', '#fe9929', '#d95f0e', '#993404'];\n this.YL_OR_BR_7 = ['#ffffd4', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#8c2d04'];\n this.YL_OR_BR_8 = ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#8c2d04'];\n this.YL_OR_BR_9 = ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'];\n this.YL_OR_RD_3 = ['#ffeda0', '#feb24c', '#f03b20'];\n this.YL_OR_RD_4 = ['#ffffb2', '#fecc5c', '#fd8d3c', '#e31a1c'];\n this.YL_OR_RD_5 = ['#ffffb2', '#fecc5c', '#fd8d3c', '#f03b20', '#bd0026'];\n this.YL_OR_RD_6 = ['#ffffb2', '#fed976', '#feb24c', '#fd8d3c', '#f03b20', '#bd0026'];\n this.YL_OR_RD_7 = ['#ffffb2', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#b10026'];\n this.YL_OR_RD_8 = ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#b10026'];\n this.YL_OR_RD_9 = ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'];\n this.BU_GN = [this.BU_GN_3, this.BU_GN_4, this.BU_GN_5, this.BU_GN_6, this.BU_GN_7, this.BU_GN_8, this.BU_GN_9];\n this.BU_PU = [this.BU_PU_3, this.BU_PU_4, this.BU_PU_5, this.BU_PU_6, this.BU_PU_7, this.BU_PU_8, this.BU_PU_9];\n this.GN_BU = [this.GN_BU_3, this.GN_BU_4, this.GN_BU_5, this.GN_BU_6, this.GN_BU_7, this.GN_BU_8, this.GN_BU_9];\n this.OR_RD = [this.OR_RD_3, this.OR_RD_4, this.OR_RD_5, this.OR_RD_6, this.OR_RD_7, this.OR_RD_8, this.OR_RD_9];\n this.PU_BU = [this.PU_BU_3, this.PU_BU_4, this.PU_BU_5, this.PU_BU_6, this.PU_BU_7, this.PU_BU_8, this.PU_BU_9];\n this.PU_BU_GN = [this.PU_BU_GN_3, this.PU_BU_GN_4, this.PU_BU_GN_5, this.PU_BU_GN_6, this.PU_BU_GN_7, this.PU_BU_GN_8, this.PU_BU_GN_9];\n this.PU_RD = [this.PU_RD_3, this.PU_RD_4, this.PU_RD_5, this.PU_RD_6, this.PU_RD_7, this.PU_RD_8, this.PU_RD_9];\n this.RD_PU = [this.RD_PU_3, this.RD_PU_4, this.RD_PU_5, this.RD_PU_6, this.RD_PU_7, this.RD_PU_8, this.RD_PU_9];\n this.YL_GN = [this.YL_GN_3, this.YL_GN_4, this.YL_GN_5, this.YL_GN_6, this.YL_GN_7, this.YL_GN_8, this.YL_GN_9];\n this.YL_GN_BU = [this.YL_GN_BU_3, this.YL_GN_BU_4, this.YL_GN_BU_5, this.YL_GN_BU_6, this.YL_GN_BU_7, this.YL_GN_BU_8, this.YL_GN_BU_9];\n this.YL_OR_BR = [this.YL_OR_BR_3, this.YL_OR_BR_4, this.YL_OR_BR_5, this.YL_OR_BR_6, this.YL_OR_BR_7, this.YL_OR_BR_8, this.YL_OR_BR_9];\n this.YL_OR_RD = [this.YL_OR_RD_3, this.YL_OR_RD_4, this.YL_OR_RD_5, this.YL_OR_RD_6, this.YL_OR_RD_7, this.YL_OR_RD_8, this.YL_OR_RD_9];\n this.BLUES_3 = ['#deebf7', '#9ecae1', '#3182bd'];\n this.BLUES_4 = ['#eff3ff', '#bdd7e7', '#6baed6', '#2171b5'];\n this.BLUES_5 = ['#eff3ff', '#bdd7e7', '#6baed6', '#3182bd', '#08519c'];\n this.BLUES_6 = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#3182bd', '#08519c'];\n this.BLUES_7 = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'];\n this.BLUES_8 = ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'];\n this.BLUES_9 = ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'];\n this.GREENS_3 = ['#e5f5e0', '#a1d99b', '#31a354'];\n this.GREENS_4 = ['#edf8e9', '#bae4b3', '#74c476', '#238b45'];\n this.GREENS_5 = ['#edf8e9', '#bae4b3', '#74c476', '#31a354', '#006d2c'];\n this.GREENS_6 = ['#edf8e9', '#c7e9c0', '#a1d99b', '#74c476', '#31a354', '#006d2c'];\n this.GREENS_7 = ['#edf8e9', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#005a32'];\n this.GREENS_8 = ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#005a32'];\n this.GREENS_9 = ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'];\n this.GREYS_3 = ['#f0f0f0', '#bdbdbd', '#636363'];\n this.GREYS_4 = ['#f7f7f7', '#cccccc', '#969696', '#525252'];\n this.GREYS_5 = ['#f7f7f7', '#cccccc', '#969696', '#636363', '#252525'];\n this.GREYS_6 = ['#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696', '#636363', '#252525'];\n this.GREYS_7 = ['#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525'];\n this.GREYS_8 = ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525'];\n this.GREYS_9 = ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'];\n this.ORANGES_3 = ['#fee6ce', '#fdae6b', '#e6550d'];\n this.ORANGES_4 = ['#feedde', '#fdbe85', '#fd8d3c', '#d94701'];\n this.ORANGES_5 = ['#feedde', '#fdbe85', '#fd8d3c', '#e6550d', '#a63603'];\n this.ORANGES_6 = ['#feedde', '#fdd0a2', '#fdae6b', '#fd8d3c', '#e6550d', '#a63603'];\n this.ORANGES_7 = ['#feedde', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#8c2d04'];\n this.ORANGES_8 = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#8c2d04'];\n this.ORANGES_9 = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'];\n this.PURPLES_3 = ['#efedf5', '#bcbddc', '#756bb1'];\n this.PURPLES_4 = ['#f2f0f7', '#cbc9e2', '#9e9ac8', '#6a51a3'];\n this.PURPLES_5 = ['#f2f0f7', '#cbc9e2', '#9e9ac8', '#756bb1', '#54278f'];\n this.PURPLES_6 = ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#756bb1', '#54278f'];\n this.PURPLES_7 = ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#4a1486'];\n this.PURPLES_8 = ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#4a1486'];\n this.PURPLES_9 = ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'];\n this.REDS_3 = ['#fee0d2', '#fc9272', '#de2d26'];\n this.REDS_4 = ['#fee5d9', '#fcae91', '#fb6a4a', '#cb181d'];\n this.REDS_5 = ['#fee5d9', '#fcae91', '#fb6a4a', '#de2d26', '#a50f15'];\n this.REDS_6 = ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#de2d26', '#a50f15'];\n this.REDS_7 = ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#99000d'];\n this.REDS_8 = ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#99000d'];\n this.REDS_9 = ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'];\n this.BLUES = [this.BLUES_3, this.BLUES_4, this.BLUES_5, this.BLUES_6, this.BLUES_7, this.BLUES_8, this.BLUES_9];\n this.GREENS = [this.GREENS_3, this.GREENS_4, this.GREENS_5, this.GREENS_6, this.GREENS_7, this.GREENS_8, this.GREENS_9];\n this.GREYS = [this.GREYS_3, this.GREYS_4, this.GREYS_5, this.GREYS_6, this.GREYS_7, this.GREYS_8, this.GREYS_9];\n this.ORANGES = [this.ORANGES_3, this.ORANGES_4, this.ORANGES_5, this.ORANGES_6, this.ORANGES_7, this.ORANGES_8, this.ORANGES_9];\n this.PURPLES = [this.PURPLES_3, this.PURPLES_4, this.PURPLES_5, this.PURPLES_6, this.PURPLES_7, this.PURPLES_8, this.PURPLES_9];\n this.REDS = [this.REDS_3, this.REDS_4, this.REDS_5, this.REDS_6, this.REDS_7, this.REDS_8, this.REDS_9];\n this.BR_BG_3 = ['#d8b365', '#f5f5f5', '#5ab4ac'];\n this.BR_BG_4 = ['#a6611a', '#dfc27d', '#80cdc1', '#018571'];\n this.BR_BG_5 = ['#a6611a', '#dfc27d', '#f5f5f5', '#80cdc1', '#018571'];\n this.BR_BG_6 = ['#8c510a', '#d8b365', '#f6e8c3', '#c7eae5', '#5ab4ac', '#01665e'];\n this.BR_BG_7 = ['#8c510a', '#d8b365', '#f6e8c3', '#f5f5f5', '#c7eae5', '#5ab4ac', '#01665e'];\n this.BR_BG_8 = ['#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#c7eae5', '#80cdc1', '#35978f', '#01665e'];\n this.BR_BG_9 = ['#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e'];\n this.BR_BG_10 = ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'];\n this.BR_BG_11 = ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'];\n this.PI_YG_3 = ['#e9a3c9', '#f7f7f7', '#a1d76a'];\n this.PI_YG_4 = ['#d01c8b', '#f1b6da', '#b8e186', '#4dac26'];\n this.PI_YG_5 = ['#d01c8b', '#f1b6da', '#f7f7f7', '#b8e186', '#4dac26'];\n this.PI_YG_6 = ['#c51b7d', '#e9a3c9', '#fde0ef', '#e6f5d0', '#a1d76a', '#4d9221'];\n this.PI_YG_7 = ['#c51b7d', '#e9a3c9', '#fde0ef', '#f7f7f7', '#e6f5d0', '#a1d76a', '#4d9221'];\n this.PI_YG_8 = ['#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221'];\n this.PI_YG_9 = ['#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221'];\n this.PI_YG_10 = ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'];\n this.PI_YG_11 = ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'];\n this.PR_GN_3 = ['#af8dc3', '#f7f7f7', '#7fbf7b'];\n this.PR_GN_4 = ['#7b3294', '#c2a5cf', '#a6dba0', '#008837'];\n this.PR_GN_5 = ['#7b3294', '#c2a5cf', '#f7f7f7', '#a6dba0', '#008837'];\n this.PR_GN_6 = ['#762a83', '#af8dc3', '#e7d4e8', '#d9f0d3', '#7fbf7b', '#1b7837'];\n this.PR_GN_7 = ['#762a83', '#af8dc3', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#7fbf7b', '#1b7837'];\n this.PR_GN_8 = ['#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837'];\n this.PR_GN_9 = ['#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837'];\n this.PR_GN_10 = ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'];\n this.PR_GN_11 = ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'];\n this.PU_OR_3 = ['#f1a340', '#f7f7f7', '#998ec3'];\n this.PU_OR_4 = ['#e66101', '#fdb863', '#b2abd2', '#5e3c99'];\n this.PU_OR_5 = ['#e66101', '#fdb863', '#f7f7f7', '#b2abd2', '#5e3c99'];\n this.PU_OR_6 = ['#b35806', '#f1a340', '#fee0b6', '#d8daeb', '#998ec3', '#542788'];\n this.PU_OR_7 = ['#b35806', '#f1a340', '#fee0b6', '#f7f7f7', '#d8daeb', '#998ec3', '#542788'];\n this.PU_OR_8 = ['#b35806', '#e08214', '#fdb863', '#fee0b6', '#d8daeb', '#b2abd2', '#8073ac', '#542788'];\n this.PU_OR_9 = ['#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788'];\n this.PU_OR_10 = ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'];\n this.PU_OR_11 = ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'];\n this.RD_BU_3 = ['#ef8a62', '#f7f7f7', '#67a9cf'];\n this.RD_BU_4 = ['#ca0020', '#f4a582', '#92c5de', '#0571b0'];\n this.RD_BU_5 = ['#ca0020', '#f4a582', '#f7f7f7', '#92c5de', '#0571b0'];\n this.RD_BU_6 = ['#b2182b', '#ef8a62', '#fddbc7', '#d1e5f0', '#67a9cf', '#2166ac'];\n this.RD_BU_7 = ['#b2182b', '#ef8a62', '#fddbc7', '#f7f7f7', '#d1e5f0', '#67a9cf', '#2166ac'];\n this.RD_BU_8 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac'];\n this.RD_BU_9 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac'];\n this.RD_BU_10 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'];\n this.RD_BU_11 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'];\n this.RD_GY_3 = ['#ef8a62', '#ffffff', '#999999'];\n this.RD_GY_4 = ['#ca0020', '#f4a582', '#bababa', '#404040'];\n this.RD_GY_5 = ['#ca0020', '#f4a582', '#ffffff', '#bababa', '#404040'];\n this.RD_GY_6 = ['#b2182b', '#ef8a62', '#fddbc7', '#e0e0e0', '#999999', '#4d4d4d'];\n this.RD_GY_7 = ['#b2182b', '#ef8a62', '#fddbc7', '#ffffff', '#e0e0e0', '#999999', '#4d4d4d'];\n this.RD_GY_8 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#e0e0e0', '#bababa', '#878787', '#4d4d4d'];\n this.RD_GY_9 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d'];\n this.RD_GY_10 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'];\n this.RD_GY_11 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'];\n this.RD_YL_BU_3 = ['#fc8d59', '#ffffbf', '#91bfdb'];\n this.RD_YL_BU_4 = ['#d7191c', '#fdae61', '#abd9e9', '#2c7bb6'];\n this.RD_YL_BU_5 = ['#d7191c', '#fdae61', '#ffffbf', '#abd9e9', '#2c7bb6'];\n this.RD_YL_BU_6 = ['#d73027', '#fc8d59', '#fee090', '#e0f3f8', '#91bfdb', '#4575b4'];\n this.RD_YL_BU_7 = ['#d73027', '#fc8d59', '#fee090', '#ffffbf', '#e0f3f8', '#91bfdb', '#4575b4'];\n this.RD_YL_BU_8 = ['#d73027', '#f46d43', '#fdae61', '#fee090', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4'];\n this.RD_YL_BU_9 = ['#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4'];\n this.RD_YL_BU_10 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'];\n this.RD_YL_BU_11 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'];\n this.RD_YL_GN_3 = ['#fc8d59', '#ffffbf', '#91cf60'];\n this.RD_YL_GN_4 = ['#d7191c', '#fdae61', '#a6d96a', '#1a9641'];\n this.RD_YL_GN_5 = ['#d7191c', '#fdae61', '#ffffbf', '#a6d96a', '#1a9641'];\n this.RD_YL_GN_6 = ['#d73027', '#fc8d59', '#fee08b', '#d9ef8b', '#91cf60', '#1a9850'];\n this.RD_YL_GN_7 = ['#d73027', '#fc8d59', '#fee08b', '#ffffbf', '#d9ef8b', '#91cf60', '#1a9850'];\n this.RD_YL_GN_8 = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'];\n this.RD_YL_GN_9 = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'];\n this.RD_YL_GN_10 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'];\n this.RD_YL_GN_11 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'];\n this.SPECTRAL_3 = ['#fc8d59', '#ffffbf', '#99d594'];\n this.SPECTRAL_4 = ['#d7191c', '#fdae61', '#abdda4', '#2b83ba'];\n this.SPECTRAL_5 = ['#d7191c', '#fdae61', '#ffffbf', '#abdda4', '#2b83ba'];\n this.SPECTRAL_6 = ['#d53e4f', '#fc8d59', '#fee08b', '#e6f598', '#99d594', '#3288bd'];\n this.SPECTRAL_7 = ['#d53e4f', '#fc8d59', '#fee08b', '#ffffbf', '#e6f598', '#99d594', '#3288bd'];\n this.SPECTRAL_8 = ['#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#e6f598', '#abdda4', '#66c2a5', '#3288bd'];\n this.SPECTRAL_9 = ['#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd'];\n this.SPECTRAL_10 = ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'];\n this.SPECTRAL_11 = ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'];\n this.BR_BG = [this.BR_BG_3, this.BR_BG_4, this.BR_BG_5, this.BR_BG_6, this.BR_BG_7, this.BR_BG_8, this.BR_BG_9, this.BR_BG_10, this.BR_BG_11];\n this.PI_YG = [this.PI_YG_3, this.PI_YG_4, this.PI_YG_5, this.PI_YG_6, this.PI_YG_7, this.PI_YG_8, this.PI_YG_9, this.PI_YG_10, this.PI_YG_11];\n this.PR_GN = [this.PR_GN_3, this.PR_GN_4, this.PR_GN_5, this.PR_GN_6, this.PR_GN_7, this.PR_GN_8, this.PR_GN_9, this.PR_GN_10, this.PR_GN_11];\n this.PU_OR = [this.PU_OR_3, this.PU_OR_4, this.PU_OR_5, this.PU_OR_6, this.PU_OR_7, this.PU_OR_8, this.PU_OR_9, this.PU_OR_10, this.PU_OR_11];\n this.RD_BU = [this.RD_BU_3, this.RD_BU_4, this.RD_BU_5, this.RD_BU_6, this.RD_BU_7, this.RD_BU_8, this.RD_BU_9, this.RD_BU_10, this.RD_BU_11];\n this.RD_GY = [this.RD_GY_3, this.RD_GY_4, this.RD_GY_5, this.RD_GY_6, this.RD_GY_7, this.RD_GY_8, this.RD_GY_9, this.RD_GY_10, this.RD_GY_11];\n this.RD_YL_BU = [this.RD_YL_BU_3, this.RD_YL_BU_4, this.RD_YL_BU_5, this.RD_YL_BU_6, this.RD_YL_BU_7, this.RD_YL_BU_8, this.RD_YL_BU_9, this.RD_YL_BU_10, this.RD_YL_BU_11];\n this.RD_YL_GN = [this.RD_YL_GN_3, this.RD_YL_GN_4, this.RD_YL_GN_5, this.RD_YL_GN_6, this.RD_YL_GN_7, this.RD_YL_GN_8, this.RD_YL_GN_9, this.RD_YL_GN_10, this.RD_YL_GN_11];\n this.SPECTRAL = [this.SPECTRAL_3, this.SPECTRAL_4, this.SPECTRAL_5, this.SPECTRAL_6, this.SPECTRAL_7, this.SPECTRAL_8, this.SPECTRAL_9, this.SPECTRAL_10, this.SPECTRAL_11];\n this.ACCENT_3 = ['#7fc97f', '#beaed4', '#fdc086'];\n this.ACCENT_4 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99'];\n this.ACCENT_5 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0'];\n this.ACCENT_6 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f'];\n this.ACCENT_7 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17'];\n this.ACCENT_8 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'];\n this.DARK_2_3 = ['#1b9e77', '#d95f02', '#7570b3'];\n this.DARK_2_4 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a'];\n this.DARK_2_5 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e'];\n this.DARK_2_6 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02'];\n this.DARK_2_7 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d'];\n this.DARK_2_8 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'];\n this.PAIRED_3 = ['#a6cee3', '#1f78b4', '#b2df8a'];\n this.PAIRED_4 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c'];\n this.PAIRED_5 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99'];\n this.PAIRED_6 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c'];\n this.PAIRED_7 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f'];\n this.PAIRED_8 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00'];\n this.PAIRED_9 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6'];\n this.PAIRED_10 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a'];\n this.PAIRED_11 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99'];\n this.PAIRED_12 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'];\n this.PASTEL_1_3 = ['#fbb4ae', '#b3cde3', '#ccebc5'];\n this.PASTEL_1_4 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4'];\n this.PASTEL_1_5 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6'];\n this.PASTEL_1_6 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc'];\n this.PASTEL_1_7 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd'];\n this.PASTEL_1_8 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec'];\n this.PASTEL_1_9 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2'];\n this.PASTEL_2_3 = ['#b3e2cd', '#fdcdac', '#cbd5e8'];\n this.PASTEL_2_4 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4'];\n this.PASTEL_2_5 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9'];\n this.PASTEL_2_6 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae'];\n this.PASTEL_2_7 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc'];\n this.PASTEL_2_8 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'];\n this.SET_1_3 = ['#e41a1c', '#377eb8', '#4daf4a'];\n this.SET_1_4 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3'];\n this.SET_1_5 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00'];\n this.SET_1_6 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33'];\n this.SET_1_7 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628'];\n this.SET_1_8 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf'];\n this.SET_1_9 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'];\n this.SET_2_3 = ['#66c2a5', '#fc8d62', '#8da0cb'];\n this.SET_2_4 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3'];\n this.SET_2_5 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854'];\n this.SET_2_6 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f'];\n this.SET_2_7 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494'];\n this.SET_2_8 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'];\n this.SET_3_3 = ['#8dd3c7', '#ffffb3', '#bebada'];\n this.SET_3_4 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072'];\n this.SET_3_5 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3'];\n this.SET_3_6 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462'];\n this.SET_3_7 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69'];\n this.SET_3_8 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5'];\n this.SET_3_9 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9'];\n this.SET_3_10 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd'];\n this.SET_3_11 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5'];\n this.SET_3_12 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'];\n this.ACCENT = [this.ACCENT_3, this.ACCENT_4, this.ACCENT_5, this.ACCENT_6, this.ACCENT_7, this.ACCENT_8];\n this.DARK_2 = [this.DARK_2_3, this.DARK_2_4, this.DARK_2_5, this.DARK_2_6, this.DARK_2_7, this.DARK_2_8];\n this.PAIRED = [this.PAIRED_3, this.PAIRED_4, this.PAIRED_5, this.PAIRED_6, this.PAIRED_7, this.PAIRED_8, this.PAIRED_9, this.PAIRED_10, this.PAIRED_11, this.PAIRED_12];\n this.PASTEL_1 = [this.PASTEL_1_3, this.PASTEL_1_4, this.PASTEL_1_5, this.PASTEL_1_6, this.PASTEL_1_7, this.PASTEL_1_8, this.PASTEL_1_9];\n this.PASTEL_2 = [this.PASTEL_2_3, this.PASTEL_2_4, this.PASTEL_2_5, this.PASTEL_2_6, this.PASTEL_2_7, this.PASTEL_2_8];\n this.SET_1 = [this.SET_1_3, this.SET_1_4, this.SET_1_5, this.SET_1_6, this.SET_1_7, this.SET_1_8, this.SET_1_9];\n this.SET_2 = [this.SET_2_3, this.SET_2_4, this.SET_2_5, this.SET_2_6, this.SET_2_7, this.SET_2_8];\n this.SET_3 = [this.SET_3_3, this.SET_3_4, this.SET_3_5, this.SET_3_6, this.SET_3_7, this.SET_3_8, this.SET_3_9, this.SET_3_10, this.SET_3_11, this.SET_3_12];\n }\n ColorSets.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ColorSets',\n interfaces: []\n };\n var ColorSets_instance = null;\n function ColorSets_getInstance() {\n if (ColorSets_instance === null) {\n new ColorSets();\n }return ColorSets_instance;\n }\n function ColorUtil() {\n ColorUtil_instance = this;\n }\n ColorUtil.prototype.genColors_2c6x13$ = function (count, baseColors) {\n var tmp$;\n var rValues = ArrayList_init();\n var gValues = ArrayList_init();\n var bValues = ArrayList_init();\n tmp$ = baseColors.iterator();\n while (tmp$.hasNext()) {\n var baseColor = tmp$.next();\n rValues.add_11rb$(baseColor.red);\n gValues.add_11rb$(baseColor.green);\n bValues.add_11rb$(baseColor.blue);\n }\n var rChannelGen = new RGBChannelGen(rValues);\n var gChannelGen = new RGBChannelGen(gValues);\n var bChannelGen = new RGBChannelGen(bValues);\n var rValuesGen = rChannelGen.generate_za3lpa$(count).iterator();\n var gValuesGen = gChannelGen.generate_za3lpa$(count).iterator();\n var bValuesGen = bChannelGen.generate_za3lpa$(count).iterator();\n var colorsGen = ArrayList_init_0(count);\n while (rValuesGen.hasNext() && gValuesGen.hasNext() && bValuesGen.hasNext()) {\n var colorGen = new Color(rValuesGen.next(), gValuesGen.next(), bValuesGen.next());\n colorsGen.add_11rb$(colorGen);\n }\n return colorsGen;\n };\n ColorUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ColorUtil',\n interfaces: []\n };\n var ColorUtil_instance = null;\n function ColorUtil_getInstance() {\n if (ColorUtil_instance === null) {\n new ColorUtil();\n }return ColorUtil_instance;\n }\n function PaletteUtil() {\n PaletteUtil_instance = this;\n this.NULL_COLOR = Color.Companion.LIGHT_GRAY;\n this.EXTENSIBLE_COLOR_SCHEMES_0 = setOf([ColorPalette$Qualitative$Accent_getInstance(), ColorPalette$Qualitative$Dark2_getInstance(), ColorPalette$Qualitative$Pastel1_getInstance(), ColorPalette$Qualitative$Pastel2_getInstance(), ColorPalette$Qualitative$Set1_getInstance(), ColorPalette$Qualitative$Set2_getInstance(), ColorPalette$Qualitative$Set3_getInstance()]);\n this.PAL_TYPE_BY_PAL_NAME_0 = null;\n var map = HashMap_init();\n var $receiver = ColorPalette$Sequential$values();\n var destination = ArrayList_init_0($receiver.length);\n var tmp$;\n for (tmp$ = 0; tmp$ !== $receiver.length; ++tmp$) {\n var item = $receiver[tmp$];\n destination.add_11rb$(item.name);\n }\n var tmp$_0;\n tmp$_0 = destination.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var value = ColorPalette$Type$SEQUENTIAL_getInstance();\n map.put_xwzc9p$(element, value);\n }\n var $receiver_0 = ColorPalette$Diverging$values();\n var destination_0 = ArrayList_init_0($receiver_0.length);\n var tmp$_1;\n for (tmp$_1 = 0; tmp$_1 !== $receiver_0.length; ++tmp$_1) {\n var item_0 = $receiver_0[tmp$_1];\n destination_0.add_11rb$(item_0.name);\n }\n var tmp$_2;\n tmp$_2 = destination_0.iterator();\n while (tmp$_2.hasNext()) {\n var element_0 = tmp$_2.next();\n var value_0 = ColorPalette$Type$DIVERGING_getInstance();\n map.put_xwzc9p$(element_0, value_0);\n }\n var $receiver_1 = ColorPalette$Qualitative$values();\n var destination_1 = ArrayList_init_0($receiver_1.length);\n var tmp$_3;\n for (tmp$_3 = 0; tmp$_3 !== $receiver_1.length; ++tmp$_3) {\n var item_1 = $receiver_1[tmp$_3];\n destination_1.add_11rb$(item_1.name);\n }\n var tmp$_4;\n tmp$_4 = destination_1.iterator();\n while (tmp$_4.hasNext()) {\n var element_1 = tmp$_4.next();\n var value_1 = ColorPalette$Type$QUALITATIVE_getInstance();\n map.put_xwzc9p$(element_1, value_1);\n }\n this.PAL_TYPE_BY_PAL_NAME_0 = map;\n }\n PaletteUtil.prototype.isExtensibleScheme_0 = function (colorScheme) {\n return this.EXTENSIBLE_COLOR_SCHEMES_0.contains_11rb$(colorScheme);\n };\n PaletteUtil.prototype.schemeColors_7q5c77$ = function (colorScheme, colorCount) {\n var colorsHex = colorScheme.getColors_za3lpa$(colorCount);\n var colors = this.fromColorsHex_0(colorsHex);\n if (colorsHex.length < colorCount && this.isExtensibleScheme_0(colorScheme)) {\n var addColors = ColorUtil_getInstance().genColors_2c6x13$(colorCount - colorsHex.length | 0, colors);\n return collect.Iterables.toList_yl67zr$(collect.Iterables.concat_yxozss$(colors, addColors));\n }return colors;\n };\n PaletteUtil.prototype.fromColorsHex_0 = function (hexColors) {\n var tmp$;\n var colors = ArrayList_init();\n for (tmp$ = 0; tmp$ !== hexColors.length; ++tmp$) {\n var hexColor = hexColors[tmp$];\n try {\n colors.add_11rb$(Color.Companion.parseHex_61zpoe$(hexColor));\n } catch (e) {\n if (!Kotlin.isType(e, Exception))\n throw e;\n }\n }\n return colors;\n };\n PaletteUtil.prototype.paletteTypeByPaletteName_61zpoe$ = function (paletteName) {\n return this.PAL_TYPE_BY_PAL_NAME_0.get_11rb$(paletteName);\n };\n PaletteUtil.prototype.colorSchemeByIndex_vfydh1$ = function (paletteType, index) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n switch (paletteType.name) {\n case 'SEQUENTIAL':\n tmp$_2 = Kotlin.isArray(tmp$ = ColorPalette$Sequential$values()) ? tmp$ : throwCCE();\n break;\n case 'DIVERGING':\n tmp$_2 = Kotlin.isArray(tmp$_0 = ColorPalette$Diverging$values()) ? tmp$_0 : throwCCE();\n break;\n case 'QUALITATIVE':\n tmp$_2 = Kotlin.isArray(tmp$_1 = ColorPalette$Qualitative$values()) ? tmp$_1 : throwCCE();\n break;\n default:tmp$_2 = Kotlin.noWhenBranchMatched();\n break;\n }\n var values = tmp$_2;\n return values[index % values.length];\n };\n PaletteUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PaletteUtil',\n interfaces: []\n };\n var PaletteUtil_instance = null;\n function PaletteUtil_getInstance() {\n if (PaletteUtil_instance === null) {\n new PaletteUtil();\n }return PaletteUtil_instance;\n }\n function RGBChannelGen(myBaseValues) {\n RGBChannelGen$Companion_getInstance();\n this.myBaseValues_0 = myBaseValues;\n this.myRange_0 = null;\n var tmp$, tmp$_0;\n var min = Ordering.Companion.natural_dahdeg$().min_m5x2f4$(this.myBaseValues_0);\n var max = Ordering.Companion.natural_dahdeg$().max_m5x2f4$(this.myBaseValues_0);\n tmp$ = RGBChannelGen$Companion_getInstance().RANGES_0;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var r = tmp$[tmp$_0];\n if (r.contains_mef7kx$(min) || r.contains_mef7kx$(max)) {\n if (this.myRange_0 == null) {\n this.myRange_0 = r;\n } else {\n this.myRange_0 = ensureNotNull(this.myRange_0).span_d226ot$(r);\n }\n }}\n }\n RGBChannelGen.prototype.generate_za3lpa$ = function (maxCount) {\n var tmp$;\n var x = maxCount / this.myBaseValues_0.size;\n var genPerBaseValue = numberToInt(JsMath.ceil(x));\n var a = this.maxValueCount_0() - 1 | 0;\n var b = genPerBaseValue;\n genPerBaseValue = JsMath.min(a, b);\n var x_0 = this.maxValueCount_0() / (genPerBaseValue + 1 | 0);\n var inc = numberToInt(JsMath.floor(x_0));\n var b_0 = numberToInt(inc * 1.33);\n inc = JsMath.max(1, b_0);\n var values = ArrayList_init_0(maxCount);\n var baseValues = this.myBaseValues_0;\n while (values.size < maxCount) {\n var nextBaseValues = ArrayList_init();\n tmp$ = baseValues.iterator();\n while (tmp$.hasNext()) {\n var baseValue = tmp$.next();\n var genValue = baseValue + inc | 0;\n if (!ensureNotNull(this.myRange_0).contains_mef7kx$(genValue)) {\n genValue = ensureNotNull(this.myRange_0).lowerEnd + (genValue - ensureNotNull(this.myRange_0).upperEnd) | 0;\n }values.add_11rb$(genValue);\n nextBaseValues.add_11rb$(genValue);\n if (values.size === maxCount) {\n break;\n }}\n baseValues = nextBaseValues;\n }\n return values;\n };\n RGBChannelGen.prototype.maxValueCount_0 = function () {\n return ensureNotNull(this.myRange_0).upperEnd - ensureNotNull(this.myRange_0).lowerEnd + 1 | 0;\n };\n function RGBChannelGen$Companion() {\n RGBChannelGen$Companion_instance = this;\n this.RANGES_0 = [new ClosedRange(0, 37), new ClosedRange(38, 97), new ClosedRange(98, 157), new ClosedRange(158, 217), new ClosedRange(218, 255)];\n }\n RGBChannelGen$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RGBChannelGen$Companion_instance = null;\n function RGBChannelGen$Companion_getInstance() {\n if (RGBChannelGen$Companion_instance === null) {\n new RGBChannelGen$Companion();\n }return RGBChannelGen$Companion_instance;\n }\n RGBChannelGen.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RGBChannelGen',\n interfaces: []\n };\n function DataType(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function DataType_initFields() {\n DataType_initFields = function () {\n };\n DataType$NUMBER_instance = new DataType('NUMBER', 0);\n DataType$STRING_instance = new DataType('STRING', 1);\n DataType$INSTANT_instance = new DataType('INSTANT', 2);\n DataType$INSTANT_OF_DAY_instance = new DataType('INSTANT_OF_DAY', 3);\n DataType$INSTANT_OF_MONTH_instance = new DataType('INSTANT_OF_MONTH', 4);\n DataType$INSTANT_OF_QUARTER_instance = new DataType('INSTANT_OF_QUARTER', 5);\n DataType$INSTANT_OF_HALF_YEAR_instance = new DataType('INSTANT_OF_HALF_YEAR', 6);\n DataType$INSTANT_OF_YEAR_instance = new DataType('INSTANT_OF_YEAR', 7);\n }\n var DataType$NUMBER_instance;\n function DataType$NUMBER_getInstance() {\n DataType_initFields();\n return DataType$NUMBER_instance;\n }\n var DataType$STRING_instance;\n function DataType$STRING_getInstance() {\n DataType_initFields();\n return DataType$STRING_instance;\n }\n var DataType$INSTANT_instance;\n function DataType$INSTANT_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_instance;\n }\n var DataType$INSTANT_OF_DAY_instance;\n function DataType$INSTANT_OF_DAY_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_OF_DAY_instance;\n }\n var DataType$INSTANT_OF_MONTH_instance;\n function DataType$INSTANT_OF_MONTH_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_OF_MONTH_instance;\n }\n var DataType$INSTANT_OF_QUARTER_instance;\n function DataType$INSTANT_OF_QUARTER_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_OF_QUARTER_instance;\n }\n var DataType$INSTANT_OF_HALF_YEAR_instance;\n function DataType$INSTANT_OF_HALF_YEAR_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_OF_HALF_YEAR_instance;\n }\n var DataType$INSTANT_OF_YEAR_instance;\n function DataType$INSTANT_OF_YEAR_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_OF_YEAR_instance;\n }\n Object.defineProperty(DataType.prototype, 'isTime', {\n configurable: true,\n get: function () {\n return this === DataType$INSTANT_getInstance() || this.isTimeInterval;\n }\n });\n Object.defineProperty(DataType.prototype, 'isTimeInterval', {\n configurable: true,\n get: function () {\n return this === DataType$INSTANT_OF_DAY_getInstance() || this === DataType$INSTANT_OF_MONTH_getInstance() || this === DataType$INSTANT_OF_QUARTER_getInstance() || this === DataType$INSTANT_OF_HALF_YEAR_getInstance() || this === DataType$INSTANT_OF_YEAR_getInstance();\n }\n });\n Object.defineProperty(DataType.prototype, 'isString', {\n configurable: true,\n get: function () {\n return this === DataType$STRING_getInstance();\n }\n });\n Object.defineProperty(DataType.prototype, 'isNumber', {\n configurable: true,\n get: function () {\n return this === DataType$NUMBER_getInstance();\n }\n });\n DataType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataType',\n interfaces: [Enum]\n };\n function DataType$values() {\n return [DataType$NUMBER_getInstance(), DataType$STRING_getInstance(), DataType$INSTANT_getInstance(), DataType$INSTANT_OF_DAY_getInstance(), DataType$INSTANT_OF_MONTH_getInstance(), DataType$INSTANT_OF_QUARTER_getInstance(), DataType$INSTANT_OF_HALF_YEAR_getInstance(), DataType$INSTANT_OF_YEAR_getInstance()];\n }\n DataType.values = DataType$values;\n function DataType$valueOf(name) {\n switch (name) {\n case 'NUMBER':\n return DataType$NUMBER_getInstance();\n case 'STRING':\n return DataType$STRING_getInstance();\n case 'INSTANT':\n return DataType$INSTANT_getInstance();\n case 'INSTANT_OF_DAY':\n return DataType$INSTANT_OF_DAY_getInstance();\n case 'INSTANT_OF_MONTH':\n return DataType$INSTANT_OF_MONTH_getInstance();\n case 'INSTANT_OF_QUARTER':\n return DataType$INSTANT_OF_QUARTER_getInstance();\n case 'INSTANT_OF_HALF_YEAR':\n return DataType$INSTANT_OF_HALF_YEAR_getInstance();\n case 'INSTANT_OF_YEAR':\n return DataType$INSTANT_OF_YEAR_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.common.data.DataType.' + name);\n }\n }\n DataType.valueOf_61zpoe$ = DataType$valueOf;\n function RegularMeshDetector(myError) {\n RegularMeshDetector$Companion_getInstance();\n this.myError_xmg86j$_0 = myError;\n this.isMesh_gozhck$_0 = false;\n this.resolution_byvhl$_0 = 0;\n }\n Object.defineProperty(RegularMeshDetector.prototype, 'isMesh', {\n configurable: true,\n get: function () {\n return this.isMesh_gozhck$_0;\n },\n set: function (isMesh) {\n this.isMesh_gozhck$_0 = isMesh;\n }\n });\n Object.defineProperty(RegularMeshDetector.prototype, 'resolution', {\n configurable: true,\n get: function () {\n if (!this.isMesh) {\n var message = 'Not a mesh';\n throw IllegalStateException_init(message.toString());\n }return this.resolution_byvhl$_0;\n },\n set: function (resolution) {\n this.resolution_byvhl$_0 = resolution;\n }\n });\n RegularMeshDetector.prototype.equalsEnough_lu1900$ = function (d1, d2) {\n var tmp$ = d1 === d2;\n if (!tmp$) {\n var x = d1 - d2;\n tmp$ = JsMath.abs(x) <= this.myError_xmg86j$_0;\n }return tmp$;\n };\n RegularMeshDetector.prototype.nearZero_14dthe$ = function (d) {\n return JsMath.abs(d) <= this.myError_xmg86j$_0;\n };\n function RegularMeshDetector$MyRowDetector(myMinRowSize, error, values) {\n RegularMeshDetector.call(this, error);\n this.myMinRowSize_0 = myMinRowSize;\n this.init_0(values);\n }\n RegularMeshDetector$MyRowDetector.prototype.init_0 = function (values) {\n var tmp$;\n this.isMesh = false;\n var distance = 0.0;\n var distanceInitialized = false;\n var prevValue = null;\n var count = this.myMinRowSize_0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var value = tmp$.next();\n if (!SeriesUtil_getInstance().isFinite_yrwdxb$(value)) {\n return;\n }if (prevValue != null) {\n var dist = ensureNotNull(value) - prevValue;\n if (this.nearZero_14dthe$(dist)) {\n return;\n }if (distanceInitialized) {\n if (!this.equalsEnough_lu1900$(dist, distance)) {\n return;\n }} else {\n distance = dist;\n distanceInitialized = true;\n }\n }prevValue = value;\n if ((count = count - 1 | 0, count) === 0) {\n break;\n }}\n if (distanceInitialized && count === 0) {\n var x = distance;\n this.resolution = JsMath.abs(x);\n this.isMesh = true;\n }};\n RegularMeshDetector$MyRowDetector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyRowDetector',\n interfaces: [RegularMeshDetector]\n };\n function RegularMeshDetector$MyColumnDetector(myMinRowSize, error, values) {\n RegularMeshDetector.call(this, error);\n this.myMinRowSize_0 = myMinRowSize;\n this.init_0(values);\n }\n RegularMeshDetector$MyColumnDetector.prototype.init_0 = function (values) {\n var tmp$;\n this.isMesh = false;\n var rowSize = new Int32Array([0, 0]);\n var rowValue = [null, null];\n var rowIndex = 0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var value = tmp$.next();\n if (!SeriesUtil_getInstance().isFinite_yrwdxb$(value)) {\n break;\n }if (rowValue[rowIndex] == null) {\n rowValue[rowIndex] = value;\n rowSize[rowIndex] = rowSize[rowIndex] + 1 | 0;\n } else if (this.equalsEnough_lu1900$(ensureNotNull(rowValue[rowIndex]), ensureNotNull(value))) {\n rowSize[rowIndex] = rowSize[rowIndex] + 1 | 0;\n } else {\n if (rowIndex === 0) {\n rowIndex = rowIndex + 1 | 0;\n rowValue[rowIndex] = value;\n rowSize[rowIndex] = rowSize[rowIndex] + 1 | 0;\n } else {\n break;\n }\n }\n }\n if (rowSize[0] === rowSize[1] && rowSize[0] >= this.myMinRowSize_0) {\n this.isMesh = true;\n var x = ensureNotNull(rowValue[1]) - ensureNotNull(rowValue[0]);\n this.resolution = JsMath.abs(x);\n }};\n RegularMeshDetector$MyColumnDetector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyColumnDetector',\n interfaces: [RegularMeshDetector]\n };\n function RegularMeshDetector$Companion() {\n RegularMeshDetector$Companion_instance = this;\n this.NO_MESH_0 = new RegularMeshDetector$Companion$NO_MESH$ObjectLiteral(0.0);\n }\n RegularMeshDetector$Companion.prototype.tryRow_l63ks6$ = function (values) {\n var v0 = collect.Iterables.get_dhabsj$(values, 0, null);\n var v1 = collect.Iterables.get_dhabsj$(values, 1, null);\n if (v0 == null || v1 == null) {\n return this.NO_MESH_0;\n }var x = v1 - v0;\n var delta = JsMath.abs(x);\n if (!isFinite(delta)) {\n return this.NO_MESH_0;\n }var error = delta / 10000.0;\n return this.tryRow_4sxsdq$(50, error, values);\n };\n RegularMeshDetector$Companion.prototype.tryRow_4sxsdq$ = function (minRowSize, error, values) {\n return new RegularMeshDetector$MyRowDetector(minRowSize, error, values);\n };\n RegularMeshDetector$Companion.prototype.tryColumn_l63ks6$ = function (values) {\n return this.tryColumn_4sxsdq$(50, SeriesUtil_getInstance().TINY, values);\n };\n RegularMeshDetector$Companion.prototype.tryColumn_4sxsdq$ = function (minRowSize, error, values) {\n return new RegularMeshDetector$MyColumnDetector(minRowSize, error, values);\n };\n function RegularMeshDetector$Companion$NO_MESH$ObjectLiteral(myError) {\n RegularMeshDetector.call(this, myError);\n }\n Object.defineProperty(RegularMeshDetector$Companion$NO_MESH$ObjectLiteral.prototype, 'isMesh', {\n configurable: true,\n get: function () {\n return false;\n },\n set: function (value) {\n Kotlin.callSetter(this, RegularMeshDetector.prototype, 'isMesh', value);\n }\n });\n RegularMeshDetector$Companion$NO_MESH$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [RegularMeshDetector]\n };\n RegularMeshDetector$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RegularMeshDetector$Companion_instance = null;\n function RegularMeshDetector$Companion_getInstance() {\n if (RegularMeshDetector$Companion_instance === null) {\n new RegularMeshDetector$Companion();\n }return RegularMeshDetector$Companion_instance;\n }\n RegularMeshDetector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RegularMeshDetector',\n interfaces: []\n };\n function SeriesUtil() {\n SeriesUtil_instance = this;\n this.TINY = 1.0E-50;\n this.REAL_NUMBER_0 = SeriesUtil$REAL_NUMBER$lambda(this);\n this.NEGATIVE_NUMBER = SeriesUtil$NEGATIVE_NUMBER$lambda;\n }\n SeriesUtil.prototype.isSubTiny_14dthe$ = function (value) {\n return value < this.TINY;\n };\n SeriesUtil.prototype.isSubTiny_4fzjta$ = function (range) {\n return this.isFinite_4fzjta$(range) && this.span_4fzjta$(range) < this.TINY;\n };\n SeriesUtil.prototype.checkedDoubles_fakr2g$ = function (values) {\n return new SeriesUtil$CheckedDoubleIterable(values);\n };\n SeriesUtil.prototype.checkedDoubles_9ma18$ = function (values) {\n return new SeriesUtil$CheckedDoubleList(values);\n };\n SeriesUtil.prototype.isFinite_yrwdxb$ = function (v) {\n return v != null && isFinite(v);\n };\n SeriesUtil.prototype.asFinite_z03gcz$ = function (v, defaultValue) {\n return v != null && isFinite(v) ? v : defaultValue;\n };\n SeriesUtil.prototype.isFinite_14dthe$ = function (v) {\n return isFinite(v);\n };\n SeriesUtil.prototype.allFinite_jma9l8$ = function (v0, v1) {\n return this.isFinite_yrwdxb$(v0) && this.isFinite_yrwdxb$(v1);\n };\n SeriesUtil.prototype.allFinite_xjrefz$ = function (v0, v1, v2) {\n return this.allFinite_jma9l8$(v0, v1) && this.isFinite_yrwdxb$(v2);\n };\n SeriesUtil.prototype.allFinite_rd1tgs$ = function (v0, v1, v2, v3) {\n return this.allFinite_xjrefz$(v0, v1, v2) && this.isFinite_yrwdxb$(v3);\n };\n SeriesUtil.prototype.filterFinite_10sy24$ = function (l0, l1) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (!(l0.size === l1.size)) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }var l0Copy = ArrayList_init();\n var l1Copy = ArrayList_init();\n var copy = false;\n var i = 0;\n for (var tmp$_3 = l0.iterator(); tmp$_3.hasNext(); ++i) {\n var v0 = tmp$_3.next();\n var tmp$_4, tmp$_5, tmp$_6, tmp$_7;\n var v1 = l1.get_za3lpa$(i);\n if (!this.allFinite_jma9l8$(v0, v1)) {\n if (!copy) {\n l0Copy.addAll_brywnq$(Kotlin.isType(tmp$_4 = toList(take(l0, i)), List) ? tmp$_4 : throwCCE());\n l1Copy.addAll_brywnq$(Kotlin.isType(tmp$_5 = toList(take(l1, i)), List) ? tmp$_5 : throwCCE());\n copy = true;\n }continue;\n }if (copy) {\n l0Copy.add_11rb$(typeof (tmp$_6 = v0) === 'number' ? tmp$_6 : throwCCE());\n l1Copy.add_11rb$(typeof (tmp$_7 = v1) === 'number' ? tmp$_7 : throwCCE());\n }}\n tmp$ = copy;\n if (tmp$ === true)\n tmp$_2 = listOf([l0Copy, l1Copy]);\n else if (tmp$ === false) {\n tmp$_2 = listOf([Kotlin.isType(tmp$_0 = l0, List) ? tmp$_0 : throwCCE(), Kotlin.isType(tmp$_1 = l1, List) ? tmp$_1 : throwCCE()]);\n } else\n tmp$_2 = Kotlin.noWhenBranchMatched();\n return tmp$_2;\n };\n SeriesUtil.prototype.range_l63ks6$ = function (values) {\n var tmp$;\n var min = 0.0;\n var max = 0.0;\n var inited = false;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (this.isFinite_yrwdxb$(v)) {\n if (inited) {\n var a = min;\n var b = ensureNotNull(v);\n min = JsMath.min(a, b);\n var a_0 = max;\n max = JsMath.max(a_0, v);\n } else {\n max = ensureNotNull(v);\n min = max;\n inited = true;\n }\n }}\n return inited ? new ClosedRange(min, max) : null;\n };\n SeriesUtil.prototype.resolution_u62iiw$ = function (values, naValue) {\n var tmp$;\n var rowDetector = RegularMeshDetector$Companion_getInstance().tryRow_l63ks6$(values);\n if (rowDetector.isMesh) {\n return rowDetector.resolution;\n }var columnDetector = RegularMeshDetector$Companion_getInstance().tryColumn_l63ks6$(values);\n if (columnDetector.isMesh) {\n tmp$ = columnDetector.resolution;\n } else {\n tmp$ = this.resolutionFullScan_0(values, naValue);\n }\n return tmp$;\n };\n SeriesUtil.prototype.resolutionFullScan_0 = function (values, naValue) {\n var tmp$;\n var goodDataVector = Kotlin.isType(tmp$ = collect.Iterables.filter_fpit1u$(values, this.REAL_NUMBER_0), Iterable) ? tmp$ : throwCCE();\n if (collect.Iterables.isEmpty_fakr2g$(goodDataVector)) {\n return naValue;\n }var copy = Ordering.Companion.natural_dahdeg$().sortedCopy_m5x2f4$(goodDataVector);\n if (copy.size < 2) {\n return naValue;\n }var it = copy.iterator();\n var resolution = naValue;\n var allZero = true;\n var prev = it.next();\n while (it.hasNext()) {\n var curr = it.next();\n var dist = curr - prev;\n if (dist > 0 && (dist < resolution || allZero)) {\n allZero = false;\n resolution = dist;\n }prev = curr;\n }\n return resolution;\n };\n SeriesUtil.prototype.ensureApplicableRange_4am1sd$ = function (range) {\n if (range == null) {\n return new ClosedRange(-0.5, 0.5);\n }if (this.isSubTiny_4fzjta$(range)) {\n var median = range.lowerEnd;\n return new ClosedRange(median - 0.5, median + 0.5);\n }return range;\n };\n SeriesUtil.prototype.span_4fzjta$ = function (range) {\n if (!this.isFinite_4fzjta$(range)) {\n var message = 'range must be finite: ' + range;\n throw IllegalArgumentException_init(message.toString());\n }return range.upperEnd - range.lowerEnd;\n };\n SeriesUtil.prototype.span_t7esj2$ = function (range0, range1) {\n if (range0 == null)\n return range1;\n return range1 == null ? range0 : range0.span_d226ot$(range1);\n };\n SeriesUtil.prototype.expand_mdyssk$ = function (range, newSpan) {\n var expand = (newSpan - this.span_4fzjta$(range)) / 2;\n return this.expand_wws5xy$(range, expand, expand);\n };\n SeriesUtil.prototype.expand_wws5xy$ = function (range, lowerExpand, upperExpand) {\n return new ClosedRange(range.lowerEnd - lowerExpand, range.upperEnd + upperExpand);\n };\n SeriesUtil.prototype.isFinite_4fzjta$ = function (range) {\n return !(isInfinite(range.lowerEnd) || isInfinite(range.upperEnd));\n };\n SeriesUtil.prototype.matchingIndices_3vukww$ = function (list, matchedValue) {\n var result = ArrayList_init();\n for (var i = 0; i !== list.size; ++i) {\n if (equals(matchedValue, list.get_za3lpa$(i))) {\n result.add_11rb$(i);\n }}\n return result;\n };\n SeriesUtil.prototype.matchingIndices_ut89is$ = function (list, matchedValues) {\n var result = ArrayList_init();\n for (var i = 0; i !== list.size; ++i) {\n if (contains(matchedValues, list.get_za3lpa$(i))) {\n result.add_11rb$(i);\n }}\n return result;\n };\n SeriesUtil.prototype.pickAtIndices_ge51dg$ = function (list, indices) {\n var tmp$;\n var initialCapacity = indices.size > 10 ? indices.size : 10;\n var result = ArrayList_init_0(initialCapacity);\n tmp$ = indices.iterator();\n while (tmp$.hasNext()) {\n var index = tmp$.next();\n if (index < list.size) {\n result.add_11rb$(list.get_za3lpa$(index));\n }}\n return result;\n };\n SeriesUtil.prototype.pickAtIndices_jlfzfq$ = function (list, indices) {\n var result = ArrayList_init_0(list.size);\n for (var i = 0; i !== list.size; ++i) {\n if (indices.contains_11rb$(i)) {\n result.add_11rb$(list.get_za3lpa$(i));\n }}\n return result;\n };\n SeriesUtil.prototype.skipAtIndices_jlfzfq$ = function (list, indices) {\n var result = ArrayList_init_0(list.size);\n for (var i = 0; i !== list.size; ++i) {\n if (!indices.contains_11rb$(i)) {\n result.add_11rb$(list.get_za3lpa$(i));\n }}\n return result;\n };\n SeriesUtil.prototype.firstNotNull_rath1t$ = function (list, defaultValue) {\n var tmp$;\n tmp$ = list.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (v != null) {\n return v;\n }}\n return defaultValue;\n };\n SeriesUtil.prototype.mean_l4tjj7$ = function (values, defaultValue) {\n var tmp$;\n var result = 0.0;\n var i = -1.0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var value = tmp$.next();\n if (value != null && isFinite(value)) {\n i = i + 1;\n result = value / (i + 1) + result * (i / (i + 1));\n }}\n return i >= 0 ? result : defaultValue;\n };\n SeriesUtil.prototype.sum_k9kaly$ = function (values) {\n var tmp$;\n var result = 0.0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var value = tmp$.next();\n if (value != null && isFinite(value)) {\n result += value;\n }}\n return result;\n };\n SeriesUtil.prototype.toDoubleList_8a6n3n$ = function (l) {\n return l == null ? null : (new SeriesUtil$CheckedDoubleList(l)).cast();\n };\n function SeriesUtil$CheckedDoubleList(list) {\n SeriesUtil$CheckedDoubleIterable.call(this, list);\n }\n SeriesUtil$CheckedDoubleList.prototype.cast = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = SeriesUtil$CheckedDoubleIterable.prototype.cast.call(this), List) ? tmp$ : throwCCE();\n };\n SeriesUtil$CheckedDoubleList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CheckedDoubleList',\n interfaces: [SeriesUtil$CheckedDoubleIterable]\n };\n function SeriesUtil$CheckedDoubleIterable(myIterable) {\n this.myIterable_n2c9gl$_0 = myIterable;\n this.myEmpty_3k4vh6$_0 = collect.Iterables.isEmpty_fakr2g$(this.myIterable_n2c9gl$_0);\n this.myCanBeCast_310oqz$_0 = false;\n var tmp$;\n if (this.myEmpty_3k4vh6$_0) {\n tmp$ = true;\n } else {\n tmp$ = collect.Iterables.all_fpit1u$(collect.Iterables.filter_fpit1u$(this.myIterable_n2c9gl$_0, SeriesUtil$SeriesUtil$CheckedDoubleIterable_init$lambda), SeriesUtil$SeriesUtil$CheckedDoubleIterable_init$lambda_0);\n }\n this.myCanBeCast_310oqz$_0 = tmp$;\n }\n SeriesUtil$CheckedDoubleIterable.prototype.notEmptyAndCanBeCast = function () {\n return !this.myEmpty_3k4vh6$_0 && this.myCanBeCast_310oqz$_0;\n };\n SeriesUtil$CheckedDoubleIterable.prototype.canBeCast = function () {\n return this.myCanBeCast_310oqz$_0;\n };\n SeriesUtil$CheckedDoubleIterable.prototype.cast = function () {\n var tmp$;\n if (!this.myCanBeCast_310oqz$_0) {\n var message = \"Can't cast to a collection of Double(s)\";\n throw IllegalStateException_init(message.toString());\n }return Kotlin.isType(tmp$ = this.myIterable_n2c9gl$_0, Iterable) ? tmp$ : throwCCE();\n };\n function SeriesUtil$SeriesUtil$CheckedDoubleIterable_init$lambda(it) {\n return it != null;\n }\n function SeriesUtil$SeriesUtil$CheckedDoubleIterable_init$lambda_0(input) {\n return typeof input === 'number';\n }\n SeriesUtil$CheckedDoubleIterable.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CheckedDoubleIterable',\n interfaces: []\n };\n function SeriesUtil$REAL_NUMBER$lambda(this$SeriesUtil) {\n return function (it) {\n return this$SeriesUtil.isFinite_yrwdxb$(it);\n };\n }\n function SeriesUtil$NEGATIVE_NUMBER$lambda(input) {\n return input < 0;\n }\n SeriesUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'SeriesUtil',\n interfaces: []\n };\n var SeriesUtil_instance = null;\n function SeriesUtil_getInstance() {\n if (SeriesUtil_instance === null) {\n new SeriesUtil();\n }return SeriesUtil_instance;\n }\n function DouglasPeuckerSimplification() {\n this.myEpsilon_0 = kotlin_js_internal_DoubleCompanionObject.MIN_VALUE;\n }\n function DouglasPeuckerSimplification$calculateWeights$lambda(closure$points, closure$startIndex) {\n return function (p) {\n return (new DoubleSegment(closure$points.get_za3lpa$(closure$startIndex), p)).length();\n };\n }\n function DouglasPeuckerSimplification$calculateWeights$lambda_0(closure$doubleSegment) {\n return function (it) {\n return closure$doubleSegment.distance_gpjtzr$(it);\n };\n }\n DouglasPeuckerSimplification.prototype.calculateWeights_0 = function (points) {\n var stack = new Stack();\n var size = points.size;\n var list = ArrayList_init_0(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n }\n var weights = list;\n weights.set_wxm5ur$(0, kotlin_js_internal_DoubleCompanionObject.MAX_VALUE);\n weights.set_wxm5ur$(points.size - 1 | 0, kotlin_js_internal_DoubleCompanionObject.MAX_VALUE);\n stack.push_11rb$(new Pair(0, points.size - 1 | 0));\n while (!stack.empty()) {\n var startIndex = ensureNotNull(stack.peek()).first;\n var endIndex = ensureNotNull(stack.peek()).second;\n stack.pop();\n var dMax = 0.0;\n var index_0 = startIndex;\n var doubleSegment = new DoubleSegment(points.get_za3lpa$(startIndex), points.get_za3lpa$(endIndex));\n var distance;\n if (doubleSegment.length() === 0.0) {\n distance = DouglasPeuckerSimplification$calculateWeights$lambda(points, startIndex);\n } else {\n distance = DouglasPeuckerSimplification$calculateWeights$lambda_0(doubleSegment);\n }\n var i = startIndex + 1 | 0;\n while (i < endIndex) {\n var d = distance(points.get_za3lpa$(i));\n if (d > dMax) {\n index_0 = i;\n dMax = d;\n }i = i + 1 | 0;\n }\n if (dMax >= this.myEpsilon_0) {\n stack.push_11rb$(new Pair(startIndex, index_0));\n stack.push_11rb$(new Pair(index_0, endIndex));\n weights.set_wxm5ur$(index_0, dMax);\n }}\n return weights;\n };\n DouglasPeuckerSimplification.prototype.getWeights_ytws2g$ = function (points) {\n return this.calculateWeights_0(points);\n };\n DouglasPeuckerSimplification.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DouglasPeuckerSimplification',\n interfaces: [PolylineSimplifier$RankingStrategy]\n };\n var compareBy$lambda = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function PolylineSimplifier(myPoints, strategy) {\n PolylineSimplifier$Companion_getInstance();\n this.myPoints_0 = myPoints;\n this.myWeights_0 = null;\n this.myWeightLimit_0 = kotlin_js_internal_DoubleCompanionObject.NaN;\n this.myCountLimit_0 = -1;\n this.myWeights_0 = strategy.getWeights_ytws2g$(this.myPoints_0);\n }\n Object.defineProperty(PolylineSimplifier.prototype, 'points', {\n configurable: true,\n get: function () {\n var $receiver = this.indices;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(this.myPoints_0.get_za3lpa$(item));\n }\n return destination;\n }\n });\n function PolylineSimplifier$get_PolylineSimplifier$indices$lambda(this$PolylineSimplifier) {\n return function (it) {\n return this$PolylineSimplifier.getWeight_0(it);\n };\n }\n Object.defineProperty(PolylineSimplifier.prototype, 'indices', {\n configurable: true,\n get: function () {\n var $receiver = until(0, this.myPoints_0.size);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(new Pair(item, this.myWeights_0.get_za3lpa$(item)));\n }\n var destination_0 = ArrayList_init();\n var tmp$_0;\n tmp$_0 = destination.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (!isNaN_0(this.getWeight_0(element)))\n destination_0.add_11rb$(element);\n }\n var sorted_0 = sortedWith(destination_0, reversed(new Comparator(compareBy$lambda(PolylineSimplifier$get_PolylineSimplifier$indices$lambda(this)))));\n var filtered;\n if (this.isWeightLimitSet_0) {\n var destination_1 = ArrayList_init();\n var tmp$_1;\n tmp$_1 = sorted_0.iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n if (this.getWeight_0(element_0) > this.myWeightLimit_0)\n destination_1.add_11rb$(element_0);\n }\n filtered = destination_1;\n } else {\n filtered = take(sorted_0, this.myCountLimit_0);\n }\n var $receiver_0 = filtered;\n var destination_2 = ArrayList_init_0(collectionSizeOrDefault($receiver_0, 10));\n var tmp$_2;\n tmp$_2 = $receiver_0.iterator();\n while (tmp$_2.hasNext()) {\n var item_0 = tmp$_2.next();\n destination_2.add_11rb$(this.getIndex_0(item_0));\n }\n return sorted(destination_2);\n }\n });\n Object.defineProperty(PolylineSimplifier.prototype, 'isWeightLimitSet_0', {\n configurable: true,\n get: function () {\n return !isNaN_0(this.myWeightLimit_0);\n }\n });\n PolylineSimplifier.prototype.setWeightLimit_14dthe$ = function (weightLimit) {\n this.myWeightLimit_0 = weightLimit;\n this.myCountLimit_0 = -1;\n return this;\n };\n PolylineSimplifier.prototype.setCountLimit_za3lpa$ = function (countLimit) {\n this.myWeightLimit_0 = kotlin_js_internal_DoubleCompanionObject.NaN;\n this.myCountLimit_0 = countLimit;\n return this;\n };\n PolylineSimplifier.prototype.getWeight_0 = function (p) {\n return p.second;\n };\n PolylineSimplifier.prototype.getIndex_0 = function (p) {\n return p.first;\n };\n function PolylineSimplifier$RankingStrategy() {\n }\n PolylineSimplifier$RankingStrategy.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'RankingStrategy',\n interfaces: []\n };\n function PolylineSimplifier$Companion() {\n PolylineSimplifier$Companion_instance = this;\n }\n PolylineSimplifier$Companion.prototype.visvalingamWhyatt_ytws2g$ = function (points) {\n return new PolylineSimplifier(points, new VisvalingamWhyattSimplification());\n };\n PolylineSimplifier$Companion.prototype.douglasPeucker_ytws2g$ = function (points) {\n return new PolylineSimplifier(points, new DouglasPeuckerSimplification());\n };\n PolylineSimplifier$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PolylineSimplifier$Companion_instance = null;\n function PolylineSimplifier$Companion_getInstance() {\n if (PolylineSimplifier$Companion_instance === null) {\n new PolylineSimplifier$Companion();\n }return PolylineSimplifier$Companion_instance;\n }\n PolylineSimplifier.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolylineSimplifier',\n interfaces: []\n };\n var compareBy$lambda_0 = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function VisvalingamWhyattSimplification() {\n VisvalingamWhyattSimplification$Companion_getInstance();\n this.myVerticesToRemove_0 = ArrayList_init();\n this.myTriangles_0 = null;\n }\n Object.defineProperty(VisvalingamWhyattSimplification.prototype, 'isSimplificationDone_0', {\n configurable: true,\n get: function () {\n return this.isEmpty_0;\n }\n });\n Object.defineProperty(VisvalingamWhyattSimplification.prototype, 'isEmpty_0', {\n configurable: true,\n get: function () {\n return ensureNotNull(this.myTriangles_0).isEmpty();\n }\n });\n VisvalingamWhyattSimplification.prototype.getWeights_ytws2g$ = function (points) {\n this.myTriangles_0 = ArrayList_init_0(points.size - 2 | 0);\n this.initTriangles_0(points);\n var size = points.size;\n var list = ArrayList_init_0(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(VisvalingamWhyattSimplification$Companion_getInstance().INITIAL_AREA_0);\n }\n var weights = list;\n var lastRemovedVertexArea = 0.0;\n while (!this.isSimplificationDone_0) {\n var triangle = this.takeTriangle_0();\n lastRemovedVertexArea = triangle.area > lastRemovedVertexArea ? triangle.area : lastRemovedVertexArea;\n weights.set_wxm5ur$(triangle.currentVertex, lastRemovedVertexArea);\n var next = triangle.next;\n if (next != null) {\n next.takePrevFrom_em8fn6$(triangle);\n this.update_0(next);\n }var prev = triangle.prev;\n if (prev != null) {\n prev.takeNextFrom_em8fn6$(triangle);\n this.update_0(prev);\n }this.myVerticesToRemove_0.add_11rb$(triangle.currentVertex);\n }\n return weights;\n };\n VisvalingamWhyattSimplification.prototype.initTriangles_0 = function (points) {\n var triangles = ArrayList_init_0(points.size - 2 | 0);\n var i = 1;\n var n = points.size - 1 | 0;\n while (i < n) {\n triangles.add_11rb$(new VisvalingamWhyattSimplification$Triangle(i, points));\n i = i + 1 | 0;\n }\n var i_0 = 1;\n var n_0 = triangles.size - 1 | 0;\n while (i_0 < n_0) {\n triangles.get_za3lpa$(i_0).next = triangles.get_za3lpa$(i_0 + 1 | 0);\n triangles.get_za3lpa$(i_0).prev = triangles.get_za3lpa$(i_0 - 1 | 0);\n i_0 = i_0 + 1 | 0;\n }\n var tmp$;\n tmp$ = triangles.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.add_0(element);\n }\n };\n VisvalingamWhyattSimplification.prototype.takeTriangle_0 = function () {\n var minimalTriangle = this.poll_0();\n this.myVerticesToRemove_0.add_11rb$(minimalTriangle.currentVertex);\n return minimalTriangle;\n };\n VisvalingamWhyattSimplification.prototype.add_0 = function (triangle) {\n var index = this.getIndex_0(triangle);\n ensureNotNull(this.myTriangles_0).add_wxm5ur$(index, triangle);\n };\n function VisvalingamWhyattSimplification$getIndex$lambda(it) {\n return it.area;\n }\n VisvalingamWhyattSimplification.prototype.getIndex_0 = function (triangle) {\n var index = binarySearch(ensureNotNull(this.myTriangles_0), triangle, new Comparator(compareBy$lambda_0(VisvalingamWhyattSimplification$getIndex$lambda)));\n if (index < 0) {\n index = ~index;\n }return index;\n };\n VisvalingamWhyattSimplification.prototype.peek_0 = function () {\n return ensureNotNull(this.myTriangles_0).get_za3lpa$(0);\n };\n VisvalingamWhyattSimplification.prototype.poll_0 = function () {\n var triangle = this.peek_0();\n ensureNotNull(this.myTriangles_0).remove_11rb$(triangle);\n return triangle;\n };\n VisvalingamWhyattSimplification.prototype.update_0 = function (triangle) {\n ensureNotNull(this.myTriangles_0).remove_11rb$(triangle);\n ensureNotNull(this.myTriangles_0).add_11rb$(triangle);\n };\n function VisvalingamWhyattSimplification$Triangle(currentVertex, myPoints) {\n this.currentVertex = currentVertex;\n this.myPoints_0 = myPoints;\n this.area_nqp3v0$_0 = 0;\n this.prevVertex_0 = 0;\n this.nextVertex_0 = 0;\n this.prev = null;\n this.next = null;\n this.prevVertex_0 = this.currentVertex - 1 | 0;\n this.nextVertex_0 = this.currentVertex + 1 | 0;\n this.area = this.calculateArea_0();\n }\n Object.defineProperty(VisvalingamWhyattSimplification$Triangle.prototype, 'area', {\n configurable: true,\n get: function () {\n return this.area_nqp3v0$_0;\n },\n set: function (area) {\n this.area_nqp3v0$_0 = area;\n }\n });\n VisvalingamWhyattSimplification$Triangle.prototype.takeNextFrom_em8fn6$ = function (triangle) {\n this.next = triangle.next;\n this.nextVertex_0 = triangle.nextVertex_0;\n this.area = this.calculateArea_0();\n };\n VisvalingamWhyattSimplification$Triangle.prototype.takePrevFrom_em8fn6$ = function (triangle) {\n this.prev = triangle.prev;\n this.prevVertex_0 = triangle.prevVertex_0;\n this.area = this.calculateArea_0();\n };\n VisvalingamWhyattSimplification$Triangle.prototype.calculateArea_0 = function () {\n var a = this.myPoints_0.get_za3lpa$(this.prevVertex_0);\n var b = this.myPoints_0.get_za3lpa$(this.currentVertex);\n var c = this.myPoints_0.get_za3lpa$(this.nextVertex_0);\n var x = ((b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y)) / 2.0;\n return JsMath.abs(x);\n };\n VisvalingamWhyattSimplification$Triangle.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Triangle',\n interfaces: []\n };\n function VisvalingamWhyattSimplification$Companion() {\n VisvalingamWhyattSimplification$Companion_instance = this;\n this.INITIAL_AREA_0 = kotlin_js_internal_DoubleCompanionObject.MAX_VALUE;\n }\n VisvalingamWhyattSimplification$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var VisvalingamWhyattSimplification$Companion_instance = null;\n function VisvalingamWhyattSimplification$Companion_getInstance() {\n if (VisvalingamWhyattSimplification$Companion_instance === null) {\n new VisvalingamWhyattSimplification$Companion();\n }return VisvalingamWhyattSimplification$Companion_instance;\n }\n VisvalingamWhyattSimplification.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VisvalingamWhyattSimplification',\n interfaces: [PolylineSimplifier$RankingStrategy]\n };\n function DateTimeFormatUtil() {\n DateTimeFormatUtil_instance = this;\n }\n DateTimeFormatUtil.prototype.formatDateUTC_xfy9o8$ = function (instant, pattern) {\n var format = Format_init(pattern);\n var $receiver = new Instant(numberToLong(instant));\n var $receiver_0 = getCallableRef('toDateTime', function ($receiver, p1) {\n return $receiver.toDateTime_x2y23v$(p1);\n }.bind(null, TimeZone.Companion.UTC))($receiver);\n return getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_amwj4p$(p1);\n }.bind(null, format))($receiver_0);\n };\n DateTimeFormatUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DateTimeFormatUtil',\n interfaces: []\n };\n var DateTimeFormatUtil_instance = null;\n function DateTimeFormatUtil_getInstance() {\n if (DateTimeFormatUtil_instance === null) {\n new DateTimeFormatUtil();\n }return DateTimeFormatUtil_instance;\n }\n function Formatter() {\n Formatter_instance = this;\n this.YEAR_0 = '%b %Y';\n this.YEAR_QUARTER_0 = 'Q %y';\n this.YEAR_MONTH_0 = '%B %Y';\n this.DATE_MEDIUM_0 = '%a, %b %e, %Y';\n this.DATE_MEDIUM_TIME_SHORT_0 = '%a, %b %e, %Y %l:%M %p';\n this.DEF_NUMBER_FORMAT_0 = NumberFormat_init(',g');\n this.DEF_NUMBER_FORMATTER_0 = Formatter$DEF_NUMBER_FORMATTER$lambda(this);\n }\n function Formatter$time$lambda(closure$pattern) {\n return function (input) {\n var tmp$;\n return DateTimeFormatUtil_getInstance().formatDateUTC_xfy9o8$(Kotlin.isNumber(tmp$ = input) ? tmp$ : throwCCE(), closure$pattern);\n };\n }\n Formatter.prototype.time_61zpoe$ = function (pattern) {\n return Formatter$time$lambda(pattern);\n };\n Formatter.prototype.tooltip_w817vg$ = function (dataType) {\n return this.nullable_0(this.tooltipImpl_0(dataType), 'null');\n };\n function Formatter$tooltipImpl$lambda(it) {\n return it.toString();\n }\n Formatter.prototype.tooltipImpl_0 = function (dataType) {\n var tmp$;\n switch (dataType.name) {\n case 'NUMBER':\n tmp$ = this.DEF_NUMBER_FORMATTER_0;\n break;\n case 'STRING':\n tmp$ = Formatter$tooltipImpl$lambda;\n break;\n case 'INSTANT':\n tmp$ = this.time_61zpoe$(this.DATE_MEDIUM_TIME_SHORT_0);\n break;\n case 'INSTANT_OF_DAY':\n tmp$ = this.time_61zpoe$(this.DATE_MEDIUM_0);\n break;\n case 'INSTANT_OF_MONTH':\n tmp$ = this.time_61zpoe$(this.YEAR_MONTH_0);\n break;\n case 'INSTANT_OF_QUARTER':\n case 'INSTANT_OF_HALF_YEAR':\n tmp$ = this.time_61zpoe$(this.YEAR_QUARTER_0);\n break;\n case 'INSTANT_OF_YEAR':\n tmp$ = this.time_61zpoe$(this.YEAR_0);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n Formatter.prototype.tableCell_w817vg$ = function (dataType) {\n return this.tableCell_0(dataType, 'null');\n };\n Formatter.prototype.tableCell_0 = function (dataType, nullString) {\n return this.nullable_0(this.tableCellImpl_0(dataType), nullString);\n };\n function Formatter$tableCellImpl$lambda(it) {\n return it.toString();\n }\n Formatter.prototype.tableCellImpl_0 = function (dataType) {\n switch (dataType.name) {\n case 'NUMBER':\n return this.DEF_NUMBER_FORMATTER_0;\n case 'STRING':\n return Formatter$tableCellImpl$lambda;\n case 'INSTANT':\n return this.time_61zpoe$(\"%a, %b %e, '%y\");\n default:if (dataType.isTimeInterval) {\n var timeInterval = TimeInterval$Companion_getInstance().fromIntervalDataType_w817vg$(dataType);\n return timeInterval.tickFormatter;\n }\n break;\n }\n throw IllegalArgumentException_init(\"Can't create formatter for data type \" + dataType);\n };\n function Formatter$nullable$lambda(closure$nullString, closure$f) {\n return function (input) {\n return input == null ? closure$nullString : closure$f(input);\n };\n }\n Formatter.prototype.nullable_0 = function (f, nullString) {\n return Formatter$nullable$lambda(nullString, f);\n };\n function Formatter$DEF_NUMBER_FORMATTER$lambda(this$Formatter) {\n return function (input) {\n var tmp$;\n return this$Formatter.DEF_NUMBER_FORMAT_0.apply_3p81yu$(Kotlin.isNumber(tmp$ = input) ? tmp$ : throwCCE());\n };\n }\n Formatter.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Formatter',\n interfaces: []\n };\n var Formatter_instance = null;\n function Formatter_getInstance() {\n if (Formatter_instance === null) {\n new Formatter();\n }return Formatter_instance;\n }\n function TimeUtil() {\n TimeUtil_instance = this;\n }\n TimeUtil.prototype.asDateTimeUTC_14dthe$ = function (instant) {\n try {\n return TimeZone.Companion.UTC.toDateTime_x2y23v$(new Instant(roundToLong(instant)));\n } catch (ignored) {\n if (Kotlin.isType(ignored, RuntimeException)) {\n throw IllegalArgumentException_init(\"Can't create DateTime from instant \" + instant);\n } else\n throw ignored;\n }\n };\n TimeUtil.prototype.asInstantUTC_amwj4p$ = function (dateTime) {\n return TimeZone.Companion.UTC.toInstant_amwj4p$(dateTime).timeSinceEpoch;\n };\n TimeUtil.prototype.yearStart_za3lpa$ = function (year) {\n return new DateTime(Date_0.Companion.firstDayOf_8fsw02$(year));\n };\n TimeUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'TimeUtil',\n interfaces: []\n };\n var TimeUtil_instance = null;\n function TimeUtil_getInstance() {\n if (TimeUtil_instance === null) {\n new TimeUtil();\n }return TimeUtil_instance;\n }\n function DurationInterval(myDuration, count) {\n TimeInterval.call(this, count);\n this.myDuration_0 = myDuration;\n if (!this.myDuration_0.isPositive) {\n throw RuntimeException_init('Duration must be positive');\n }}\n Object.defineProperty(DurationInterval.prototype, 'tickFormatPattern', {\n configurable: true,\n get: function () {\n var duration = this.myDuration_0.duration;\n if (duration.compareTo_11rb$(Duration.Companion.SECOND.duration) < 0) {\n return '%S';\n } else if (duration.compareTo_11rb$(Duration.Companion.MINUTE.duration) < 0) {\n return '%S';\n } else if (duration.compareTo_11rb$(Duration.Companion.HOUR.duration) < 0) {\n return '%M';\n } else if (duration.compareTo_11rb$(Duration.Companion.DAY.duration) < 0) {\n return '%H:%M';\n } else if (duration.compareTo_11rb$(Duration.Companion.WEEK.duration) < 0) {\n return '%b %e';\n }return '%b %e';\n }\n });\n DurationInterval.prototype.range_lu1900$ = function (start, end) {\n var step = this.myDuration_0.duration.multiply(Kotlin.Long.fromInt(this.count)).toNumber();\n var x = start / step;\n var tick = JsMath.ceil(x) * step;\n var result = ArrayList_init();\n while (tick <= end) {\n result.add_11rb$(tick);\n tick += step;\n }\n return result;\n };\n DurationInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DurationInterval',\n interfaces: [TimeInterval]\n };\n function MeasuredInDays(count) {\n TimeInterval.call(this, count);\n }\n MeasuredInDays.prototype.range_lu1900$ = function (start, end) {\n if (start > end) {\n throw RuntimeException_init('Duration must be positive');\n }var dateTimeStart = TimeUtil_getInstance().asDateTimeUTC_14dthe$(start);\n var dateStart = this.getFirstDayContaining_amwj4p$(dateTimeStart);\n var dateTimeTick = new DateTime(dateStart);\n if (dateTimeTick.compareTo_11rb$(dateTimeStart) < 0) {\n dateTimeTick = this.addInterval_amwj4p$(dateTimeTick);\n }var result = ArrayList_init();\n var tick = TimeUtil_getInstance().asInstantUTC_amwj4p$(dateTimeTick).toNumber();\n while (tick <= end) {\n result.add_11rb$(tick);\n dateTimeTick = this.addInterval_amwj4p$(dateTimeTick);\n tick = TimeUtil_getInstance().asInstantUTC_amwj4p$(dateTimeTick).toNumber();\n }\n return result;\n };\n MeasuredInDays.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MeasuredInDays',\n interfaces: [TimeInterval]\n };\n function MonthInterval(count) {\n MeasuredInDays.call(this, count);\n }\n Object.defineProperty(MonthInterval.prototype, 'tickFormatPattern', {\n configurable: true,\n get: function () {\n return '%b';\n }\n });\n MonthInterval.prototype.getFirstDayContaining_amwj4p$ = function (instant) {\n var firstDay = instant.date;\n firstDay = Date_0.Companion.firstDayOf_8fsw02$(firstDay.year, firstDay.month);\n return firstDay;\n };\n MonthInterval.prototype.addInterval_amwj4p$ = function (toInstant) {\n var tmp$;\n var result = toInstant;\n tmp$ = this.count;\n for (var i = 0; i < tmp$; i++) {\n result = this.addMonth_0(result);\n }\n return result;\n };\n MonthInterval.prototype.addMonth_0 = function (toInstant) {\n var year = toInstant.year;\n var month = toInstant.month;\n var next = ensureNotNull(month).next();\n if (next == null) {\n next = Month.Companion.JANUARY;\n year = year + 1 | 0;\n }return new DateTime(Date_0.Companion.firstDayOf_8fsw02$(year, next));\n };\n MonthInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MonthInterval',\n interfaces: [MeasuredInDays]\n };\n function NiceTimeInterval() {\n NiceTimeInterval_instance = this;\n this.AUTO_STEPS_MS_0 = new Float64Array([1000.0, 5000.0, 15000.0, 30000.0, 60000.0, 5 * 60000.0, 15 * 60000.0, 30 * 60000.0, 3600000.0, 3 * 3600000.0, 6 * 3600000.0, 12 * 3600000.0, 8.64E7, 2 * 8.64E7, 6.048E8, 2.592E9, 3 * 2.592E9, YearInterval$Companion_getInstance().MS]);\n this.AUTO_INTERVALS_0 = [TimeInterval$Companion_getInstance().seconds_za3lpa$(1), TimeInterval$Companion_getInstance().seconds_za3lpa$(5), TimeInterval$Companion_getInstance().seconds_za3lpa$(15), TimeInterval$Companion_getInstance().seconds_za3lpa$(30), TimeInterval$Companion_getInstance().minutes_za3lpa$(1), TimeInterval$Companion_getInstance().minutes_za3lpa$(5), TimeInterval$Companion_getInstance().minutes_za3lpa$(15), TimeInterval$Companion_getInstance().minutes_za3lpa$(30), TimeInterval$Companion_getInstance().hours_za3lpa$(1), TimeInterval$Companion_getInstance().hours_za3lpa$(3), TimeInterval$Companion_getInstance().hours_za3lpa$(6), TimeInterval$Companion_getInstance().hours_za3lpa$(12), TimeInterval$Companion_getInstance().days_za3lpa$(1), TimeInterval$Companion_getInstance().days_za3lpa$(2), TimeInterval$Companion_getInstance().weeks_za3lpa$(1), TimeInterval$Companion_getInstance().months_za3lpa$(1), TimeInterval$Companion_getInstance().months_za3lpa$(3), TimeInterval$Companion_getInstance().years_za3lpa$(1)];\n }\n NiceTimeInterval.prototype.forMillis_14dthe$ = function (interval) {\n var tmp$;\n if (interval <= this.AUTO_STEPS_MS_0[0]) {\n return this.AUTO_INTERVALS_0[0];\n }var result = this.AUTO_INTERVALS_0[this.AUTO_STEPS_MS_0.length - 1 | 0];\n tmp$ = this.AUTO_STEPS_MS_0.length;\n for (var i = 1; i < tmp$; i++) {\n if (this.AUTO_STEPS_MS_0[i] >= interval) {\n var deltaDown = interval - this.AUTO_STEPS_MS_0[i - 1 | 0];\n var deltaUp = this.AUTO_STEPS_MS_0[i] - interval;\n if (deltaDown < deltaUp) {\n result = this.AUTO_INTERVALS_0[i - 1 | 0];\n } else {\n result = this.AUTO_INTERVALS_0[i];\n }\n break;\n }}\n return result;\n };\n NiceTimeInterval.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'NiceTimeInterval',\n interfaces: []\n };\n var NiceTimeInterval_instance = null;\n function NiceTimeInterval_getInstance() {\n if (NiceTimeInterval_instance === null) {\n new NiceTimeInterval();\n }return NiceTimeInterval_instance;\n }\n function QuarterInterval(count) {\n TimeInterval.call(this, count);\n }\n Object.defineProperty(QuarterInterval.prototype, 'tickFormatPattern', {\n configurable: true,\n get: function () {\n return 'Q';\n }\n });\n QuarterInterval.prototype.range_lu1900$ = function (start, end) {\n throw UnsupportedOperationException_init();\n };\n QuarterInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'QuarterInterval',\n interfaces: [TimeInterval]\n };\n function SemesterInterval(count) {\n SemesterInterval$Companion_getInstance();\n TimeInterval.call(this, count);\n }\n Object.defineProperty(SemesterInterval.prototype, 'tickFormatPattern', {\n configurable: true,\n get: function () {\n throw UnsupportedOperationException_init();\n }\n });\n Object.defineProperty(SemesterInterval.prototype, 'tickFormatter', {\n configurable: true,\n get: function () {\n return SemesterInterval$Companion_getInstance().TIME_FORMAT_FUNCTION_0;\n }\n });\n SemesterInterval.prototype.range_lu1900$ = function (start, end) {\n throw UnsupportedOperationException_init();\n };\n function SemesterInterval$Companion() {\n SemesterInterval$Companion_instance = this;\n this.TIME_FORMAT_FUNCTION_0 = SemesterInterval$Companion$TIME_FORMAT_FUNCTION$lambda;\n }\n function SemesterInterval$Companion$TIME_FORMAT_FUNCTION$lambda(input) {\n var tmp$;\n var result = DateTimeFormatUtil_getInstance().formatDateUTC_xfy9o8$(Kotlin.isNumber(tmp$ = input) ? tmp$ : throwCCE(), 'Q');\n if (result.length === 2 && startsWith(result, 'Q')) {\n try {\n var quarterNum = toInt(result.substring(1));\n var semesterNumber = (quarterNum + 1 | 0) / 2 | 0;\n if (semesterNumber === 1 || semesterNumber === 2) {\n result = 'Semester ' + semesterNumber;\n }} catch (ignored) {\n if (!Kotlin.isType(ignored, NumberFormatException))\n throw ignored;\n }\n }return result;\n }\n SemesterInterval$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SemesterInterval$Companion_instance = null;\n function SemesterInterval$Companion_getInstance() {\n if (SemesterInterval$Companion_instance === null) {\n new SemesterInterval$Companion();\n }return SemesterInterval$Companion_instance;\n }\n SemesterInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SemesterInterval',\n interfaces: [TimeInterval]\n };\n function TimeInterval(count) {\n TimeInterval$Companion_getInstance();\n this.count = count;\n }\n Object.defineProperty(TimeInterval.prototype, 'tickFormatter', {\n configurable: true,\n get: function () {\n return Formatter_getInstance().time_61zpoe$(this.tickFormatPattern);\n }\n });\n function TimeInterval$Companion() {\n TimeInterval$Companion_instance = this;\n }\n TimeInterval$Companion.prototype.milliseconds_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.MS, count);\n };\n TimeInterval$Companion.prototype.seconds_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.SECOND, count);\n };\n TimeInterval$Companion.prototype.minutes_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.MINUTE, count);\n };\n TimeInterval$Companion.prototype.hours_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.HOUR, count);\n };\n TimeInterval$Companion.prototype.days_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.DAY, count);\n };\n TimeInterval$Companion.prototype.weeks_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.WEEK, count);\n };\n TimeInterval$Companion.prototype.months_za3lpa$ = function (count) {\n return new MonthInterval(count);\n };\n TimeInterval$Companion.prototype.quarter_0 = function (count) {\n return new QuarterInterval(count);\n };\n TimeInterval$Companion.prototype.semester_0 = function (count) {\n return new SemesterInterval(count);\n };\n TimeInterval$Companion.prototype.years_za3lpa$ = function (count) {\n return new YearInterval(count);\n };\n TimeInterval$Companion.prototype.fromIntervalDataType_w817vg$ = function (dataType) {\n var tmp$;\n switch (dataType.name) {\n case 'INSTANT_OF_DAY':\n tmp$ = this.days_za3lpa$(1);\n break;\n case 'INSTANT_OF_MONTH':\n tmp$ = this.months_za3lpa$(1);\n break;\n case 'INSTANT_OF_QUARTER':\n tmp$ = this.quarter_0(1);\n break;\n case 'INSTANT_OF_HALF_YEAR':\n tmp$ = this.semester_0(1);\n break;\n case 'INSTANT_OF_YEAR':\n tmp$ = this.years_za3lpa$(1);\n break;\n default:throw IllegalArgumentException_init(\"Can't create interval from data type: \" + dataType);\n }\n return tmp$;\n };\n TimeInterval$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TimeInterval$Companion_instance = null;\n function TimeInterval$Companion_getInstance() {\n if (TimeInterval$Companion_instance === null) {\n new TimeInterval$Companion();\n }return TimeInterval$Companion_instance;\n }\n TimeInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TimeInterval',\n interfaces: []\n };\n function YearInterval(count) {\n YearInterval$Companion_getInstance();\n MeasuredInDays.call(this, count);\n this.tickFormatPattern_1ltjii$_0 = YearInterval$Companion_getInstance().TICK_FORMAT;\n }\n Object.defineProperty(YearInterval.prototype, 'tickFormatPattern', {\n configurable: true,\n get: function () {\n return this.tickFormatPattern_1ltjii$_0;\n }\n });\n YearInterval.prototype.getFirstDayContaining_amwj4p$ = function (instant) {\n return Date_0.Companion.firstDayOf_8fsw02$(instant.year);\n };\n YearInterval.prototype.addInterval_amwj4p$ = function (toInstant) {\n var tmp$;\n var result = toInstant;\n tmp$ = this.count;\n for (var i = 0; i < tmp$; i++) {\n result = this.addYear_0(result);\n }\n return result;\n };\n YearInterval.prototype.addYear_0 = function (toInstant) {\n var year = toInstant.year;\n return new DateTime(Date_0.Companion.firstDayOf_8fsw02$(year + 1 | 0));\n };\n function YearInterval$Companion() {\n YearInterval$Companion_instance = this;\n this.TICK_FORMAT = '%Y';\n this.MS = 3.1536E10;\n this.TICK_FORMATTER = Formatter_getInstance().time_61zpoe$(this.TICK_FORMAT);\n }\n YearInterval$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var YearInterval$Companion_instance = null;\n function YearInterval$Companion_getInstance() {\n if (YearInterval$Companion_instance === null) {\n new YearInterval$Companion();\n }return YearInterval$Companion_instance;\n }\n YearInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'YearInterval',\n interfaces: [MeasuredInDays]\n };\n Object.defineProperty(ColorPalette$Type, 'SEQUENTIAL', {\n get: ColorPalette$Type$SEQUENTIAL_getInstance\n });\n Object.defineProperty(ColorPalette$Type, 'DIVERGING', {\n get: ColorPalette$Type$DIVERGING_getInstance\n });\n Object.defineProperty(ColorPalette$Type, 'QUALITATIVE', {\n get: ColorPalette$Type$QUALITATIVE_getInstance\n });\n ColorPalette.prototype.Type = ColorPalette$Type;\n Object.defineProperty(ColorPalette$Sequential, 'Blues', {\n get: ColorPalette$Sequential$Blues_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'BuGn', {\n get: ColorPalette$Sequential$BuGn_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'BuPu', {\n get: ColorPalette$Sequential$BuPu_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'GnBu', {\n get: ColorPalette$Sequential$GnBu_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'Greens', {\n get: ColorPalette$Sequential$Greens_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'Greys', {\n get: ColorPalette$Sequential$Greys_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'Oranges', {\n get: ColorPalette$Sequential$Oranges_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'OrRd', {\n get: ColorPalette$Sequential$OrRd_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'PuBu', {\n get: ColorPalette$Sequential$PuBu_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'PuBuGn', {\n get: ColorPalette$Sequential$PuBuGn_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'PuRd', {\n get: ColorPalette$Sequential$PuRd_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'Purples', {\n get: ColorPalette$Sequential$Purples_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'RdPu', {\n get: ColorPalette$Sequential$RdPu_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'Reds', {\n get: ColorPalette$Sequential$Reds_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'YlGn', {\n get: ColorPalette$Sequential$YlGn_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'YlGnBu', {\n get: ColorPalette$Sequential$YlGnBu_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'YlOrBr', {\n get: ColorPalette$Sequential$YlOrBr_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'YlOrRd', {\n get: ColorPalette$Sequential$YlOrRd_getInstance\n });\n ColorPalette.prototype.Sequential = ColorPalette$Sequential;\n Object.defineProperty(ColorPalette$Diverging, 'BrBG', {\n get: ColorPalette$Diverging$BrBG_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'PiYG', {\n get: ColorPalette$Diverging$PiYG_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'PRGn', {\n get: ColorPalette$Diverging$PRGn_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'PuOr', {\n get: ColorPalette$Diverging$PuOr_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'RdBu', {\n get: ColorPalette$Diverging$RdBu_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'RdGy', {\n get: ColorPalette$Diverging$RdGy_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'RdYlBu', {\n get: ColorPalette$Diverging$RdYlBu_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'RdYlGn', {\n get: ColorPalette$Diverging$RdYlGn_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'Spectral', {\n get: ColorPalette$Diverging$Spectral_getInstance\n });\n ColorPalette.prototype.Diverging = ColorPalette$Diverging;\n Object.defineProperty(ColorPalette$Qualitative, 'Accent', {\n get: ColorPalette$Qualitative$Accent_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Dark2', {\n get: ColorPalette$Qualitative$Dark2_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Paired', {\n get: ColorPalette$Qualitative$Paired_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Pastel1', {\n get: ColorPalette$Qualitative$Pastel1_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Pastel2', {\n get: ColorPalette$Qualitative$Pastel2_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Set1', {\n get: ColorPalette$Qualitative$Set1_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Set2', {\n get: ColorPalette$Qualitative$Set2_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Set3', {\n get: ColorPalette$Qualitative$Set3_getInstance\n });\n ColorPalette.prototype.Qualitative = ColorPalette$Qualitative;\n var package$jetbrains = _.jetbrains || (_.jetbrains = {});\n var package$datalore = package$jetbrains.datalore || (package$jetbrains.datalore = {});\n var package$plot = package$datalore.plot || (package$datalore.plot = {});\n var package$common = package$plot.common || (package$plot.common = {});\n var package$color = package$common.color || (package$common.color = {});\n Object.defineProperty(package$color, 'ColorPalette', {\n get: ColorPalette_getInstance\n });\n package$color.ColorScheme = ColorScheme;\n Object.defineProperty(package$color, 'ColorSets', {\n get: ColorSets_getInstance\n });\n Object.defineProperty(package$color, 'ColorUtil', {\n get: ColorUtil_getInstance\n });\n Object.defineProperty(package$color, 'PaletteUtil', {\n get: PaletteUtil_getInstance\n });\n Object.defineProperty(RGBChannelGen, 'Companion', {\n get: RGBChannelGen$Companion_getInstance\n });\n package$color.RGBChannelGen = RGBChannelGen;\n Object.defineProperty(DataType, 'NUMBER', {\n get: DataType$NUMBER_getInstance\n });\n Object.defineProperty(DataType, 'STRING', {\n get: DataType$STRING_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT', {\n get: DataType$INSTANT_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT_OF_DAY', {\n get: DataType$INSTANT_OF_DAY_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT_OF_MONTH', {\n get: DataType$INSTANT_OF_MONTH_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT_OF_QUARTER', {\n get: DataType$INSTANT_OF_QUARTER_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT_OF_HALF_YEAR', {\n get: DataType$INSTANT_OF_HALF_YEAR_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT_OF_YEAR', {\n get: DataType$INSTANT_OF_YEAR_getInstance\n });\n var package$data = package$common.data || (package$common.data = {});\n package$data.DataType = DataType;\n Object.defineProperty(RegularMeshDetector, 'Companion', {\n get: RegularMeshDetector$Companion_getInstance\n });\n package$data.RegularMeshDetector = RegularMeshDetector;\n SeriesUtil.prototype.CheckedDoubleList = SeriesUtil$CheckedDoubleList;\n SeriesUtil.prototype.CheckedDoubleIterable = SeriesUtil$CheckedDoubleIterable;\n Object.defineProperty(package$data, 'SeriesUtil', {\n get: SeriesUtil_getInstance\n });\n var package$geometry = package$common.geometry || (package$common.geometry = {});\n package$geometry.DouglasPeuckerSimplification = DouglasPeuckerSimplification;\n PolylineSimplifier.RankingStrategy = PolylineSimplifier$RankingStrategy;\n Object.defineProperty(PolylineSimplifier, 'Companion', {\n get: PolylineSimplifier$Companion_getInstance\n });\n package$geometry.PolylineSimplifier = PolylineSimplifier;\n Object.defineProperty(VisvalingamWhyattSimplification, 'Companion', {\n get: VisvalingamWhyattSimplification$Companion_getInstance\n });\n package$geometry.VisvalingamWhyattSimplification = VisvalingamWhyattSimplification;\n var package$text = package$common.text || (package$common.text = {});\n Object.defineProperty(package$text, 'DateTimeFormatUtil', {\n get: DateTimeFormatUtil_getInstance\n });\n Object.defineProperty(package$text, 'Formatter', {\n get: Formatter_getInstance\n });\n var package$time = package$common.time || (package$common.time = {});\n Object.defineProperty(package$time, 'TimeUtil', {\n get: TimeUtil_getInstance\n });\n var package$interval = package$time.interval || (package$time.interval = {});\n package$interval.DurationInterval = DurationInterval;\n package$interval.MeasuredInDays = MeasuredInDays;\n package$interval.MonthInterval = MonthInterval;\n Object.defineProperty(package$interval, 'NiceTimeInterval', {\n get: NiceTimeInterval_getInstance\n });\n package$interval.QuarterInterval = QuarterInterval;\n Object.defineProperty(SemesterInterval, 'Companion', {\n get: SemesterInterval$Companion_getInstance\n });\n package$interval.SemesterInterval = SemesterInterval;\n Object.defineProperty(TimeInterval, 'Companion', {\n get: TimeInterval$Companion_getInstance\n });\n package$interval.TimeInterval = TimeInterval;\n Object.defineProperty(YearInterval, 'Companion', {\n get: YearInterval$Companion_getInstance\n });\n package$interval.YearInterval = YearInterval;\n Kotlin.defineModule('lets-plot-plot-common-portable', _);\n return _;\n}));\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9MZXRzUGxvdC8uL2tvdGxpbi1kY2UtZGV2L2pzL3NyYy9rb3RsaW4vbWF0a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mxlPFQ+LmRyb3AobjogSW50KTogTGlzdDxUPiB7XG4gICAgcmVxdWlyZShuID49IDApIHsgXCJSZXF1ZXN0ZWQgZWxlbWVudCBjb3VudCAkbiBpcyBsZXNzIHRoYW4gemVyby5cIiB9XG4gICAgaWYgKG4gPT0gMCkgcmV0dXJuIHRvTGlzdCgpXG4gICAgdmFsIGxpc3Q6IEFycmF5TGlzdDxUPlxuICAgIGlmICh0aGlzIGlzIENvbGxlY3Rpb248Kj4pIHtcbiAgICAgICAgdmFsIHJlc3VsdFNpemUgPSBzaXplIC0gblxuICAgICAgICBpZiAocmVzdWx0U2l6ZSA8PSAwKVxuICAgICAgICAgICAgcmV0dXJuIGVtcHR5TGlzdCgpXG4gICAgICAgIGlmIChyZXN1bHRTaXplID09IDEpXG4gICAgICAgICAgICByZXR1cm4gbGlzdE9mKGxhc3QoKSlcbiAgICAgICAgbGlzdCA9IEFycmF5TGlzdDxUPihyZXN1bHRTaXplKVxuICAgICAgICBpZiAodGhpcyBpcyBMaXN0PFQ+KSB7XG4gICAgICAgICAgICBpZiAodGhpcyBpcyBSYW5kb21BY2Nlc3MpIHtcbiAgICAgICAgICAgICAgICBmb3IgKGluZGV4IGluIG4gdW50aWwgc2l6ZSlcbiAgICAgICAgICAgICAgICAgICAgbGlzdC5hZGQodGhpc1tpbmRleF0pXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGZvciAoaXRlbSBpbiBsaXN0SXRlcmF0b3IobikpXG4gICAgICAgICAgICAgICAgICAgIGxpc3QuYWRkKGl0ZW0pXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gbGlzdFxuICAgICAgICB9XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgICBsaXN0ID0gQXJyYXlMaXN0PFQ+KClcbiAgICB9XG4gICAgdmFyIGNvdW50ID0gMFxuICAgIGZvciAoaXRlbSBpbiB0aGlzKSB7XG4gICAgICAgIGlmIChjb3VudCA+PSBuKSBsaX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UyYVwiLCBcIiNlMzFhMWNcIiwgXCIjYmQwMDI2XCIsIFwiIzgwMDAyNlwiKVxuXG5cbiAgICB2YWwgQlVfR04gPSBhcnJheU9mKFxuICAgICAgICBCVV9HTl8zLFxuICAgICAgICBCVV9HTl80LFxuICAgICAgICBCVV9HTl81LFxuICAgICAgICBCVV9HTl82LFxuICAgICAgICBCVV9HTl83LFxuICAgICAgICBCVV9HTl84LFxuICAgICAgICBCVV9HTl85XG4gICAgKVxuICAgIHZhbCBCVV9QVSA9IGFycmF5T2YoXG4gICAgICAgIEJVX1BVXzMsXG4gICAgICAgIEJVX1BVXzQsXG4gICAgICAgIEJVX1BVXzUsXG4gICAgICAgIEJVX1BVXzYsXG4gICAgICAgIEJVX1BVXzcsXG4gICAgICAgIEJVX1BVXzgsXG4gICAgICAgIEJVX1BVXzlcbiAgICApXG4gICAgdmFsIEdOX0JVID0gYXJyYXlPZihcbiAgICAgICAgR05fQlVfMyxcbiAgICAgICAgR05fQlVfNCxcbiAgICAgICAgR05fQlVfNSxcbiAgICAgICAgR05fQlVfNixcbiAgICAgICAgR05fQlVfNyxcbiAgICAgICAgR05fQlVfOCxcbiAgICAgICAgR05fQlVfOVxuICAgIClcbiAgICB2YWwgT1JfUkQgPSBhcnJheU9mKFxuICAgICAgICBPUl9SRF8zLFxuICAgICAgICBPUl9SRF80LFxuICAgICAgICBPUl9SRF81LFxuICAgICAgICBPUl9SRF82LFxuICAgICAgICBPUl9SRF83LFxuICAgICAgICBPUl9SRF84LFxuICAgICAgICBPUl9SRF85XG4gICAgKVxuICAgIHZhbCBQVV9CVSA9IGFycmF5T2YoXG4gICAgICAgIFBVX0JVXzMsXG4gICAgICAgIFBVX0JVXzQsXG4gICAgICAgIFBVX0JVXzUsXG4gICAgICAgIFBVX0JVXzYsXG4gICAgICAgIFBVX0JVXzcsXG4gICAgICAgIFBVX0JVXzgsXG4gICAgICAgIFBVX0JVXzlcbiAgICApXG4gICAgdmFsIFBVX0JVX0dOID0gYXJyYXlPZihcbiAgICAgICAgUFVfQlVfR05fMyxcbiAgICAgICAgUFVfQlVfR05fNCxcbiAgICAgICAgUFVfQlVfR05fNSxcbiAgICAgICAgUFVfQlVfR05fNixcbiAgICAgICAgUFVfQlVfR05fNyxcbiAgICAgICAgUFVfQlVfR05fOCxcbiAgICAgICAgUFVfQlVfR05fOVxuICAgIClcbiAgICB2YWwgUFVfUkQgPSBhcnJheU9mKFxuICAgICAgICBQVV9SRF8zLFxuICAgICAgICBQVV9SRF80LFxuICAgICAgICBQVV9SRF81LFxuICAgICAgICBQVV9SRF82LFxuICAgICAgICBQVV9SRF83LFxuICAgICAgICBQVV9SRF84LFxuICAgICAgICBQVV9SRF85XG4gICAgKVxuICAgIHZhbCBSRF9QVSA9IGFycmF5T2YoXG4gICAgICAgIFJEX1BVXzMsXG4gICAgICAgIFJEX1BVXzQsXG4gICAgICAgIFJEX1BVXzUsXG4gICAgICAgIFJEX1BVXzYsXG4gICAgICAgIFJEX1BVXzcsXG4gICAgICAgIFJEX1BVXzgsXG4gICAgICAgIFJEX1BVXzlcbiAgICApXG4gICAgdmFsIFlMX0dOID0gYXJyYXlPZihcbiAgICAgICAgWUxfR05fMyxcbiAgICAgICAgWUxfR05fNCxcbiAgICAgICAgWUxfR05fNSxcbiAgICAgICAgWUxfR05fNixcbiAgICAgICAgWUxfR05fNyxcbiAgICAgICAgWUxfR05fOCxcbiAgICAgICAgWUxfR05fOVxuICAgIClcbiAgICB2YWwgWUxfR05fQlUgPSBhcnJheU9mKFxuICAgICAgICBZTF9HTl9CVV8zLFxuICAgICAgICBZTF9HTl9CVV80LFxuICAgICAgICBZTF9HTl9CVV81LFxuICAgICAgICBZTF9HTl9CVV82LFxuICAgICAgICBZTF9HTl9CVV83LFxuICAgICAgICBZTF9HTl9CVV84LFxuICAgICAgICBZTF9HTl9CVV85XG4gICAgKVxuICAgIHZhbCBZTF9PUl9CUiA9IGFycmF5T2YoXG4gICAgICAgIFlMX09SX0JSXzMsXG4gICAgIC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cbiAgICApXG4gICAgdmFsIFBVX09SID0gYXJyYXlPZihcbiAgICAgICAgUFVfT1JfMyxcbiAgICAgICAgUFVfT1JfNCxcbiAgICAgICAgUFVfT1JfNSxcbiAgICAgICAgUFVfT1JfNixcbiAgICAgICAgUFVfT1JfNyxcbiAgICAgICAgUFVfT1JfOCxcbiAgICAgICAgUFVfT1JfOSxcbiAgICAgICAgUFVfT1JfMTAsXG4gICAgICAgIFBVX09SXzExXG4gICAgKVxuICAgIHZhbCBSRF9CVSA9IGFycmF5T2YoXG4gICAgICAgIFJEX0JVXzMsXG4gICAgICAgIFJEX0JVXzQsXG4gICAgICAgIFJEX0JVXzUsXG4gICAgICAgIFJEX0JVXzYsXG4gICAgICAgIFJEX0JVXzcsXG4gICAgICAgIFJEX0JVXzgsXG4gICAgICAgIFJEX0JVXzksXG4gICAgICAgIFJEX0JVXzEwLFxuICAgICAgICBSRF9CVV8xMVxuICAgIClcbiAgICB2YWwgUkRfR1kgPSBhcnJheU9mKFxuICAgICAgICBSRF9HWV8zLFxuICAgICAgICBSRF9HWV80LFxuICAgICAgICBSRF9HWV81LFxuICAgICAgICBSRF9HWV82LFxuICAgICAgICBSRF9HWV83LFxuICAgICAgICBSRF9HWV84LFxuICAgICAgICBSRF9HWV85LFxuICAgICAgICBSRF9HWV8xMCxcbiAgICAgICAgUkRfR1lfMTFcbiAgICApXG4gICAgdmFsIFJEX1lMX0JVID0gYXJyYXlPZihcbiAgICAgICAgUkRfWUxfQlVfMyxcbiAgICAgICAgUkRfWUxfQlVfNCxcbiAgICAgICAgUkRfWUxfQlVfNSxcbiAgICAgICAgUkRfWUxfQlVfNixcbiAgICAgICAgUkRfWUxfQlVfNyxcbiAgICAgICAgUkRfWUxfQlVfOCxcbiAgICAgICAgUkRfWUxfQlVfOSxcbiAgICAgICAgUkRfWUxfQlVfMTAsXG4gICAgICAgIFJEX1lMX0JVXzExXG4gICAgKVxuICAgIHZhbCBSRF9ZTF9HTiA9IGFycmF5T2YoXG4g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ilcblxuICAgIHZhbCBBQ0NFTlQgPSBhcnJheU9mKFxuICAgICAgICBBQ0NFTlRfMyxcbiAgICAgICAgQUNDRU5UXzQsXG4gICAgICAgIEFDQ0VOVF81LFxuICAgICAgICBBQ0NFTlRfNixcbiAgICAgICAgQUNDRU5UXzcsXG4gICAgICAgIEFDQ0VOVF84XG4gICAgKVxuICAgIHZhbCBEQVJLXzIgPSBhcnJheU9mKFxuICAgICAgICBEQVJLXzJfMyxcbiAgICAgICAgREFSS18yXzQsXG4gICAgICAgIERBUktfMl81LFxuICAgICAgICBEQVJLXzJfNixcbiAgICAgICAgREFSS18yXzcsXG4gICAgICAgIERBUktfMl84XG4gICAgKVxuICAgIHZhbCBQQUlSRUQgPSBhcnJheU9mKFxuICAgICAgICBQQUlSRURfMyxcbiAgICAgICAgUEFJUkVEXzQsXG4gICAgICAgIFBBSVJFRF81LFxuICAgICAgICBQQUlSRURfNixcbiAgICAgICAgUEFJUkVEXzcsXG4gICAgICAgIFBBSVJFRF84LFxuICAgICAgICBQQUlSRURfOSxcbiAgICAgICAgUEFJUkVEXzEwLFxuICAgICAgICBQQUlSRURfMTEsXG4gICAgICAgIFBBSVJFRF8xMlxuICAgIClcbiAgICB2YWwgUEFTVEVMXzEgPSBhcnJheU9mKFxuICAgICAgICBQQVNURUxfMV8zLFxuICAgICAgICBQQVNURUxfMV80LFxuICAgICAgICBQQVNURUxfMV81LFxuICAgICAgICBQQVNURUxfMV82LFxuICAgICAgICBQQVNURUxfMV83LFxuICAgICAgICBQQVNURUxfMV84LFxuICAgICAgICBQQVNURUxfMV85XG4gICAgKVxuICAgIHZhbCBQQVNURUxfMiA9IGFycmF5T2YoXG4gICAgICAgIFBBU1RFTF8yXzMsXG4gICAgICAgIFBBU1RFTF8yXzQsXG4gICAgICAgIFBBU1RFTF8yXzUsXG4gICAgICAgIFBBU1RFTF8yXzYsXG4gICAgICAgIFBBU1RFTF8yXzcsXG4gICAgICAgIFBBU1RFTF8yXzhcbiAgICApXG4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TEVfQ09MT1JfU0NIRU1FUy5jb250YWlucyhjb2xvclNjaGVtZSlcbiAgICB9XG5cbiAgICBmdW4gc2NoZW1lQ29sb3JzKGNvbG9yU2NoZW1lOiBDb2xvclNjaGVtZSwgY29sb3JDb3VudDogSW50KTogTGlzdDxDb2xvcj4ge1xuICAgICAgICB2YWwgY29sb3JzSGV4ID0gY29sb3JTY2hlbWUuZ2V0Q29sb3JzKGNvbG9yQ291bnQpXG4gICAgICAgIHZhbCBjb2xvcnMgPSBmcm9tQ29sb3JzSGV4KGNvbG9yc0hleClcbiAgICAgICAgaWYgKGNvbG9yc0hleC5zaXplIDwgY29sb3JDb3VudCAmJiBpc0V4dGVuc2libGVTY2hlbWUoXG4gICAgICAgICAgICAgICAgY29sb3JTY2hlbWVcbiAgICAgICAgICAgIClcbiAgICAgICAgKSB7XG4gICAgICAgICAgICB2YWwgYWRkQ29sb3JzID1cbiAgICAgICAgICAgICAgICBDb2xvclV0aWwuZ2VuQ29sb3JzKGNvbG9yQ291bnQgLSBjb2xvcnNIZXguc2l6ZSwgY29sb3JzKVxuICAgICAgICAgICAgcmV0dXJuIEl0ZXJhYmxlcy50b0xpc3QoY29uY2F0KGNvbG9ycywgYWRkQ29sb3JzKSlcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY29sb3JzXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gZnJvbUNvbG9yc0hleChoZXhDb2xvcnM6IEFycmF5PFN0cmluZz4pOiBMaXN0PENvbG9yPiB7XG4gICAgICAgIHZhbCBjb2xvcnMgPSBBcnJheUxpc3Q8Q29sb3I+KClcbiAgICAgICAgZm9yIChoZXhDb2xvciBpbiBoZXhDb2xvcnMpIHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgY29sb3JzLmFkZChDb2xvci5wYXJzZUhleChoZXhDb2xvcikpXG4gICAgICAgICAgICB9IGNhdGNoIChlOiBFeGNlcHRpb24pIHtcbiAgICAgICAgICAgICAgICAv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kgZ2V0KGluZGV4KSBlbHNlIG51bGxcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGZpcnN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biA8QGtvdGxpbi5pbnRlcm5hbC5Pbmx5SW5wdXRUeXBlcyBUPiBBcnJheTxvdXQgVD4uaW5kZXhPZihlbGVtZW50OiBUKTogSW50IHtcbiAgICBpZiAoZWxlbWVudCA9PSBudWxsKSB7XG4gICAgICAgIGZvciAoaW5kZXggaW4gaW5kaWNlcykge1xuICAgICAgICAgICAgaWYgKHRoaXNbaW5kZXhdID09IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICAgIGZvciAoaW5kZXggaW4gaW5kaWNlcykge1xuICAgICAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gLTFcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGZpcnN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBCeXRlQXJyYXkuaW5kZXhPZihlbGVtZW50OiBCeXRlKTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMpIHtcbiAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgZmlyc3QgaW5kZXggb2YgW2VsZW1lbnRdLCBvciAtMSBpZiB0aGUgYXJyYXkgZG9lcyBub3QgY29udGFpbiBlbGVtZW50LlxuICovXG5wdWJsaWMgZnVuIFNob3J0QXJyYXkuaW5kZXhPZihlbGVtZW50OiBTaG9ydCk6IEludCB7XG4gICAgZm9yIChpbmRleCBpbiBpbmRpY2VzKSB7XG4gICAgICAgIGlmIChlbGVtZW50ID09IHRoaXNbaW5kZXhdKSB7XG4gICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gLTFcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGZpcnN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBJbnRBcnJheS5pbmRleE9mKGVsZW1lbnQ6IEludCk6IEludCB7XG4gICAgZm9yIChpbmRleCBpbiBpbmRpY2VzKSB7XG4gICAgICAgIGlmIChlbGVtZW50ID09IHRoaXNbaW5kZXhdKSB7XG4gICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gLTFcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGZpcnN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBMb25nQXJyYXkuaW5kZXhPZihlbGVtZW50OiBMb25nKTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMpIHtcbiAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgZmlyc3QgaW5kZXggb2YgW2VsZW1lbnR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XJyYXk8b3V0IFQ+Lmxhc3RJbmRleE9mKGVsZW1lbnQ6IFQpOiBJbnQge1xuICAgIGlmIChlbGVtZW50ID09IG51bGwpIHtcbiAgICAgICAgZm9yIChpbmRleCBpbiBpbmRpY2VzLnJldmVyc2VkKCkpIHtcbiAgICAgICAgICAgIGlmICh0aGlzW2luZGV4XSA9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgICBmb3IgKGluZGV4IGluIGluZGljZXMucmV2ZXJzZWQoKSkge1xuICAgICAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gLTFcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGxhc3QgaW5kZXggb2YgW2VsZW1lbnRdLCBvciAtMSBpZiB0aGUgYXJyYXkgZG9lcyBub3QgY29udGFpbiBlbGVtZW50LlxuICovXG5wdWJsaWMgZnVuIEJ5dGVBcnJheS5sYXN0SW5kZXhPZihlbGVtZW50OiBCeXRlKTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMucmV2ZXJzZWQoKSkge1xuICAgICAgICBpZiAoZWxlbWVudCA9PSB0aGlzW2luZGV4XSkge1xuICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIC0xXG59XG5cbi8qKlxuICogUmV0dXJucyBsYXN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBTaG9ydEFycmF5Lmxhc3RJbmRleE9mKGVsZW1lbnQ6IFNob3J0KTogSW50IHtcbiAgICBmb3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ZVxufVxuXG4vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIFNob3J0QXJyYXkuY291bnQoKTogSW50IHtcbiAgICByZXR1cm4gc2l6ZVxufVxuXG4vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIEludEFycmF5LmNvdW50KCk6IEludCB7XG4gICAgcmV0dXJuIHNpemVcbn1cblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBudW1iZXIgb2YgZWxlbWVudHMgaW4gdGhpcyBhcnJheS5cbiAqL1xuQGtvdGxpbi5pbnRlcm5hbC5JbmxpbmVPbmx5XG5wdWJsaWMgaW5saW5lIGZ1biBMb25nQXJyYXkuY291bnQoKTogSW50IHtcbiAgICByZXR1cm4gc2l6ZVxufVxuXG4vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIEZsb2F0QXJyYXkuY291bnQoKTogSW50IHtcbiAgICByZXR1cm4gc2l6ZVxufVxuXG4vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIERvdWJsZUFycmF5LmNvdW50KCk6IEludCB7XG4gICAgcmV0dXJuIHNpemVcbn1cblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBudW1iZXIgb2YgZWxlbWVudHMgaW4gdGhpcyBhcnJheS5cbiAqL1xuQGtvdGxpb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BteVJhbmdlOiBDbG9zZWRSYW5nZTxJbnQ+PyA9IG51bGxcblxuICAgIGluaXQge1xuICAgICAgICB2YWwgbWluID0gbmF0dXJhbDxJbnQ+KCkubWluKG15QmFzZVZhbHVlcylcbiAgICAgICAgdmFsIG1heCA9IG5hdHVyYWw8SW50PigpLm1heChteUJhc2VWYWx1ZXMpXG4gICAgICAgIGZvciAociBpbiBSQU5HRVMpIHtcbiAgICAgICAgICAgIGlmIChyLmNvbnRhaW5zKG1pbikgfHwgci5jb250YWlucyhtYXgpKSB7XG4gICAgICAgICAgICAgICAgaWYgKG15UmFuZ2UgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBteVJhbmdlID0gclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIG15UmFuZ2UgPSBteVJhbmdlISEuc3BhbihyKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEBwYXJhbSBtYXhDb3VudCAtIGNvdW50IG9mIG5ldyB2YWx1ZXMgcmVxdWlyZWRcbiAgICAgKiBAcmV0dXJuIExpc3Qgb2YgZ2VuZXJhdGVkIHZhbHVlLCBzaXplIG1heSBiZSBkaWZmZXJlbnQgdGhhbiBtYXhDb3VudFxuICAgICAqL1xuICAgIGZ1biBnZW5lcmF0ZShtYXhDb3VudDogSW50KTogTGlzdDxJbnQ+IHtcbiAgICAgICAgdmFyIGdlblBlckJhc2VWYWx1ZSA9IGNlaWwobWF4Q291bnQudG9Eb3VibGUoKSAvIG15QmFzZVZhbHVlcy5zaXplKS50b0ludCgpXG4gICAgICAgIGdlblBlckJhc2VWYWx1ZSA9IG1pbihtYXhWYWx1ZUNvdW50KCkgLSAxLCBnZW5QZXJCYXNlVmFsdWUpXG5cbiAgICAgICAgdmFyIGluYyA9IGZsb29yKG1heFZhbHVlQ291bnQoKS50b0RvdWJsZSgpIC8gKGdlblBlckJhc2VWYWx1ZSArIDEpKS50b0ludCgpXG4gICAgICAgIC8vIG1ha2UgaW5jcmVtZW50IGEgYml0IGxlc3MgcmVndWxhclxuICAgICAgICBpbmMgPSBtYXgoMSwgKGluYyAqIDEuMzMpLnRvSW50KCkpXG5cbiAgICAgICAgdmFsIHZhbHVlcyA9IEFycmF5TGlzdDxJbnQ+KG1heENvdW50KVxuICAgICAgICB2YXIgYmFzZVZhbHVlcyA9IG15QmFzZVZhbHVlc1xuICAgICAgICB3aGlsZSAodmFsdWVzLnNpemUgPCBtYXhDb3VudCkge1xuICAgICAgICAgICAgdmFsIG5leHRCYXNlVmFsdWVzID0gQXJyYXlMaXN0PEludD4oKVxuICAgICAgICAgICAgZm9yIChiYXNlVmFsdWUgaW4gYmFzZVZhbHVlcykge1xuICAgICAgICAgICAgICAgIHZhciBnZW5WYWx1ZSA9IGJhc2VWYWx1ZSArIGluY1xuICAgICAgICAgICAgICAgIGlmICghbXlSYW5nZSEhLmNvbnRhaW5zKGdlblZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICBnZW5WYWx1ZSA9IG15UmFuZ2UhIS5sb3dlckVuZCArIChnZW5WYWx1ZSAtIG15UmFuZ2UhIS51cHBlckVuZClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdmFsdWVzLmFkZChnZW5WYWx1ZSlcbiAgICAgICAgICAgICAgICBuZXh0QmFzZVZhbHVlcy5hZGQoZ2VuVmFsdWUpXG4gICAgICAgICAgICAgICAgaWYgKHZhbHVlcy5zaXplID09IG1heENvdW50KSB7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBiYXNlVmFsdWVzID0gbmV4dEJhc2VWYWx1ZXNcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB2YWx1ZXNcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBtYXhWYWx1ZUNvdW50KCk6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Pikge1xuICAgICAgICAgICAgLy8gY2hlY2sgaWYgZmlyc3QgTiBlbGVtZW50cyBhcmUgZXF1YWxseSBzcGFjZWRcbiAgICAgICAgICAgIGlzTWVzaCA9IGZhbHNlXG4gICAgICAgICAgICB2YXIgZGlzdGFuY2UgPSAwLjBcbiAgICAgICAgICAgIHZhciBkaXN0YW5jZUluaXRpYWxpemVkID0gZmFsc2VcbiAgICAgICAgICAgIHZhciBwcmV2VmFsdWU6IERvdWJsZT8gPSBudWxsXG4gICAgICAgICAgICB2YXIgY291bnQgPSBteU1pblJvd1NpemVcbiAgICAgICAgICAgIGZvciAodmFsdWUgaW4gdmFsdWVzKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFpc0Zpbml0ZSh2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChwcmV2VmFsdWUgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgZGlzdCA9IHZhbHVlISEgLSBwcmV2VmFsdWVcbiAgICAgICAgICAgICAgICAgICAgaWYgKG5lYXJaZXJvKGRpc3QpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAoZGlzdGFuY2VJbml0aWFsaXplZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlcXVhbHNFbm91Z2goZGlzdCwgZGlzdGFuY2UpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkaXN0YW5jZSA9IGRpc3RcbiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3RhbmNlSW5pdGlhbGl6ZWQgPSB0cnVlXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBwcmV2VmFsdWUgPSB2YWx1ZVxuICAgICAgICAgICAgICAgIGlmICgtLWNvdW50ID09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChkaXN0YW5jZUluaXRpYWxpemVkICYmIGNvdW50ID09IDApIHtcbiAgICAgICAgICAgICAgICByZXNvbHV0aW9uID0gYWJzKGRpc3RhbmNlKVxuICAgICAgICAgICAgICAgIGlzTWVzaCA9IHRydWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgTXlDb2x1bW5EZXRlY3RvciBpbnRlcm5hbCBjb25zdHJ1Y3RvcihcbiAgICAgICAgcHJpdmF0ZSB2YWwgbXlNaW5Sb3dTaXplOiBJbnQsXG4gICAgICAgIGVycm9yOiBEb3VibGUsXG4gICAgICAgIHZhbHVlczogSXRlcmFibGU8RG91YmxlPz5cbiAgICApIDogUmVndWxhck1lc2hEZXRlY3RvcihlcnJvcikge1xuXG4gICAgICAgIGluaXQge1xuICAgICAgICAgICAgaW5pdCh2YWx1ZXMpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBpbml0KHZhbHVlczogSXRlcmFibGU8RG91YmxlPz4pIHtcbiAgICAgICAgICAgIC8vIGNoZWNrIGlmIHRoZXJlIGFyZSBhdCBsZWFzdCAyIHNldHMgb2YgZWxlbWVudHMgd2hlcmU6XG4gICAgICAgICAgICAvLyAxLiBzZXRzIGFyZSBlcXVhbCBpbiBzaXplO1xuICAgICAgICAgICAgLy8gMi4gYWxsIGVsZW1lbnRzIGluIGVhY2ggc2V0IGFyZSBlcXVhbFxuICAgICAgICAgICAgaXNNZXNoID0gZmFsc2VcbiAgICAgICAgICAgIHZhbCByb3dTaXplID0gaW50QXJyYXlPZigwLCAwKVxuICAgICAgICAgICAgdmFsIHJvd1ZhbHVlID0gYXJyYXlPZjxEb3VibGU/PihudWxsLCBudWxsKVxuICAgICAgICAgICAgdmFyIHJvd0luZGV4ID0gMFxuICAgICAgICAgICAgZm9yICh2YWx1ZSBpbiB2YWx1ZXMpIHtcbiAgICAgICAgICAgICAgICBpZiAoIWlzRmluaXRlKHZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAocm93VmFsdWVbcm93SW5kZXhdID09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgcm93VmFsdWVbcm93SW5kZXhdID0gdmFsdWVcbiAgICAgICAgICAgICAgICAgICAgcm93U2l6ZVtyb3dJbmRleF0rK1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZXF1YWxzRW5vdWdoKHJvd1ZhbHVlW3Jvd0luZGV4XSEhLCB2YWx1ZSEhKSkge1xuICAgICAgICAgICAgICAgICAgICByb3dTaXplW3Jvd0luZGV4XSsrXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJvd0luZGV4ID09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJvd0luZGV4KysgLy8gbmV4dCByb3dcbiAgICAgICAgICAgICAgICAgICAgICAgIHJvd1ZhbHVlW3Jvd0luZGV4XSA9IHZhbHVlXG4gICAgICAgICAgICAgICAgICAgICAgICByb3dTaXplW3Jvd0luZGV4XSsrXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBjaGVjayByZXN1bHRzXG4gICAgICAgICAgICBpZiAocm93U2l6ZVswXSA9PSByb3dTaXplWzFdICYmIHJvd1NpemVbMF0gPj0gbXlNaW5Sb3dTaXplKSB7XG4gICAgICAgICAgICAgICAgaXNNZXNoID0gdHJ1ZVxuICAgICAgICAgICAgICAgIHJlc29sdXRpb24gPSBhYnMocm93VmFsdWVbMV0hISAtIHJvd1ZhbHVlWzBdISEpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgcHJpdmF0ZSB2YWwgTk9fTUVTSDogUmVndWxhck1lc2hEZXRlY3RvciA9IG9iamVjdCA6IFJlZ3VsYXJNZXNoRGV0ZWN0b3IoMC4wKSB7XG4gICAgICAgICAgICBvdmVycmlkZSB2YXIgaXNNZXNoOiBCb29sZWFuXG4gICAgICAgICAgICAgICAgZ2V0KCkgPSBmYWxzZVxuICAgICAgICAgICAgICAgIHNldCh2YWx1ZTogQm9vbGVhbikge1xuICAgICAgICAgICAgICAgICAgICBzdXBlci5pc01lc2ggPSB2YWx1ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB0cnlSb3codmFsdWVzOiBJdGVyYWJsZTxEb3VibGU/Pik6IFJlZ3VsYXJNZXNoRGV0ZWN0b3Ige1xuICAgICAgICAgICAgLy8gY2hvb3NlICdlcnJvcicgdmFsdWVcbiAgICAgICAgICAgIHZhbCB2MCA9IEl0ZXJhYmxlc1t2YWx1ZXMsIDAsIG51bGxdXG4gICAgICAgICAgICB2YWwgdjEgPSBJdGVyYWJsZXNbdmFsdWVzLCAxLCBudWxsXVxuICAgICAgICAgICAgaWYgKHYwID09IG51bGwgfHwgdjEgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBOT19NRVNIXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YWwgZGVsdGEgPSBhYnModjEgLSB2MClcbiAgICAgICAgICAgIGlmICghZGVsdGEuaXNGaW5pdGUoKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBOT19NRVNIXG4gICAgIC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XRlcmFibGU8Kj4pOiBDaGVja2VkRG91YmxlSXRlcmFibGUge1xuICAgICAgICByZXR1cm4gQ2hlY2tlZERvdWJsZUl0ZXJhYmxlKHZhbHVlcylcbiAgICB9XG5cbiAgICBmdW4gY2hlY2tlZERvdWJsZXModmFsdWVzOiBMaXN0PCo+KTogQ2hlY2tlZERvdWJsZUxpc3Qge1xuICAgICAgICByZXR1cm4gQ2hlY2tlZERvdWJsZUxpc3QodmFsdWVzKVxuICAgIH1cblxuICAgIGZ1biBpc0Zpbml0ZSh2OiBEb3VibGU/KTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiB2ICE9IG51bGwgJiYgdi5pc0Zpbml0ZSgpXG4gICAgfVxuXG4gICAgZnVuIGFzRmluaXRlKHY6IERvdWJsZT8sIGRlZmF1bHRWYWx1ZTogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgcmV0dXJuIGlmICh2ICE9IG51bGwgJiYgdi5pc0Zpbml0ZSgpKVxuICAgICAgICAgICAgdlxuICAgICAgICBlbHNlXG4gICAgICAgICAgICBkZWZhdWx0VmFsdWVcbiAgICB9XG5cbiAgICBmdW4gaXNGaW5pdGUodjogRG91YmxlKTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiB2LmlzRmluaXRlKClcbiAgICB9XG5cbiAgICBmdW4gYWxsRmluaXRlKHYwOiBEb3VibGU/LCB2MTogRG91YmxlPyk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gaXNGaW5pdGUodjApICYmIGlzRmluaXRlKHYxKVxuICAgIH1cblxuICAgIGZ1biBhbGxGaW5pdGUodjA6IERvdWJsZT8sIHYxOiBEb3VibGU/LCB2MjogRG91YmxlPyk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gYWxsRmluaXRlKFxuICAgICAgICAgICAgdjAsXG4gICAgICAgICAgICB2MVxuICAgICAgICApICYmIGlzRmluaXRlKHYyKVxuICAgIH1cblxuICAgIGZ1biBhbGxGaW5pdGUodjA6IERvdWJsZT8sIHYxOiBEb3VibGU/LCB2MjogRG91YmxlPywgdjM6IERvdWJsZT8pOiBCb29sZWFuIHtcbiAgICAgICAgcmV0dXJuIGFsbEZpbml0ZShcbiAgICAgICAgICAgIHYwLFxuICAgICAgICAgICAgdjEsXG4gICAgICAgICAgICB2MlxuICAgICAgICApICYmIGlzRmluaXRlKHYzKVxuICAgIH1cblxuICAgIGZ1biBmaWx0ZXJGaW5pdGUobDA6IExpc3Q8RG91YmxlPz4sIGwxOiBMaXN0PERvdWJsZT8+KTogTGlzdDxMaXN0PERvdWJsZT4+IHtcbiAgICAgICAgY2hlY2sobDAuc2l6ZSA9PSBsMS5zaXplKVxuXG4gICAgICAgIHZhbCBsMENvcHkgPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgIHZhbCBsMUNvcHkgPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgIHZhciBjb3B5ID0gZmFsc2VcbiAgICAgICAgZm9yICgoaSwgdjApIGluIGwwLndpdGhJbmRleCgpKSB7XG4gICAgICAgICAgICB2YWwgdjEgPSBsMVtpXVxuICAgICAgICAgICAgaWYgKCFhbGxGaW5pdGUodjAsIHYxKSkge1xuICAgICAgICAgICAgICAgIGlmICghY29weSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBjb3B5IGFscmVhZHkgY2hlY2tlZCBlbGVtZW50c1xuICAgICAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgICAgICBsMENvcHkuYWRkQWxsKGwwLnRha2UoaSkudG9MaXN0KCkgYXMgTGlzdDxEb3VibGU+KVxuICAgICAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgICAgICBsMUNvcHkuYWRkQWxsKGwxLnRha2UoaSkudG9MaXN0KCkgYXMgTGlzdDxEb3VibGU+KVxuICAgICAgICAgICAgICAgICAgICBjb3B5ID0gdHJ1ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoY29weSkge1xuICAgICAgICAgICAgICAgIGwwQ29weS5hZGQodjAgYXMgRG91YmxlKVxuICAgICAgICAgICAgICAgIGwxQ29weS5hZGQodjEgYXMgRG91YmxlKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgQFN1cHByZXNzKFwiVU5DSEVDS0VEX0NBU1RcIilcbiAgICAgICAgcmV0dXJuIHdoZW4gKGNvcHkpIHtcbiAgICAgICAgICAgIHRydWUgLT4gbGlzdE9mKGwwQ29weSwgbDFDb3B5KVxuICAgICAgICAgICAgZmFsc2UgLT4gbGlzdE9mKGwwIGFzIExpc3Q8RG91YmxlPiwgbDEgYXMgTGlzdDxEb3VibGU+KVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuIHJhbmdlKHZhbHVlczogSXRlcmFibGU8RG91YmxlPz4pOiBDbG9zZWRSYW5nZTxEb3VibGU+PyB7XG4gICAgICAgIHZhciBtaW4gPSAwLjBcbiAgICAgICAgdmFyIG1heCA9IDAuMFxuICAgICAgICB2YXIgaW5pdGVkID0gZmFsc2VcbiAgICAgICAgZm9yICh2IGluIHZhbHVlcykge1xuICAgICAgICAgICAgaWYgKGlzRmluaXRlKHYpKSB7XG4gICAgICAgICAgICAgICAgaWYgKGluaXRlZCkge1xuICAgICAgICAgICAgICAgICAgICBtaW4gPSBtaW4obWluLCB2ISEpXG4gICAgICAgICAgICAgICAgICAgIG1heCA9IG1heChtYXgsIHYpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbWF4ID0gdiEhXG4gICAgICAgICAgICAgICAgICAgIG1pbiA9IG1heFxuICAgICAgICAgICAgICAgICAgICBpbml0ZWQgPSB0cnVlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxu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KTogRG91YmxlIHtcbiAgICAgICAgQFN1cHByZXNzKFwiVU5DSEVDS0VEX0NBU1RcIilcbiAgICAgICAgdmFsIGdvb2REYXRhVmVjdG9yID0gZmlsdGVyKHZhbHVlcywgUkVBTF9OVU1CRVIpIGFzIEl0ZXJhYmxlPERvdWJsZT5cbiAgICAgICAgaWYgKEl0ZXJhYmxlcy5pc0VtcHR5KGdvb2REYXRhVmVjdG9yKSkge1xuICAgICAgICAgICAgcmV0dXJuIG5hVmFsdWVcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBjb3B5ID0gT3JkZXJpbmcubmF0dXJhbDxEb3VibGU+KCkuc29ydGVkQ29weShnb29kRGF0YVZlY3RvcilcbiAgICAgICAgaWYgKGNvcHkuc2l6ZSA8IDIpIHtcbiAgICAgICAgICAgIHJldHVybiBuYVZhbHVlXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgaXQgPSBjb3B5Lml0ZXJhdG9yKClcbiAgICAgICAgdmFyIHJlc29sdXRpb24gPSBuYVZhbHVlXG4gICAgICAgIHZhciBhbGxaZXJvID0gdHJ1ZVxuICAgICAgICB2YXIgcHJldiA9IGl0Lm5leHQoKVxuICAgICAgICB3aGlsZSAoaXQuaGFzTmV4dCgpKSB7XG4gICAgICAgICAgICB2YWwgY3VyciA9IGl0Lm5leHQoKVxuICAgICAgICAgICAgdmFsIGRpc3QgPSBjdXJyIC0gcHJldlxuICAgICAgICAgICAgaWYgKGRpc3QgPiAwICYmIChkaXN0IDwgcmVzb2x1dGlvbiB8fCBhbGxaZXJvKSkge1xuICAgICAgICAgICAgICAgIGFsbFplcm8gPSBmYWxzZVxuICAgICAgICAgICAgICAgIHJlc29sdXRpb24gPSBkaXN0XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHByZXYgPSBjdXJyXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVzb2x1dGlvblxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRvRG86IFVzZSB3aXRoIG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ciAoaSBpbiBsaXN0LmluZGljZXMpIHtcbiAgICAgICAgICAgIGlmIChpbmRpY2VzLmNvbnRhaW5zKGkpKSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0LmFkZChsaXN0W2ldKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBmdW4gPFQ+IHNraXBBdEluZGljZXMobGlzdDogTGlzdDxUPiwgaW5kaWNlczogU2V0PEludD4pOiBMaXN0PFQ+IHtcbiAgICAgICAgdmFsIHJlc3VsdCA9IEFycmF5TGlzdDxUPihsaXN0LnNpemUpXG4gICAgICAgIGZvciAoaSBpbiBsaXN0LmluZGljZXMpIHtcbiAgICAgICAgICAgIGlmICghaW5kaWNlcy5jb250YWlucyhpKSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5hZGQobGlzdFtpXSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0XG4gICAgfVxuXG4gICAgZnVuIDxUPiBmaXJzdE5vdE51bGwobGlzdDogTGlzdDxUPiwgZGVmYXVsdFZhbHVlOiBUKTogVCB7XG4gICAgICAgIGZvciAodiBpbiBsaXN0KSB7XG4gICAgICAgICAgICBpZiAodiAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHZcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gZGVmYXVsdFZhbHVlXG4gICAgfVxuXG4gICAgZnVuIG1lYW4odmFsdWVzOiBMaXN0PERvdWJsZT8+LCBkZWZhdWx0VmFsdWU6IERvdWJsZT8pOiBEb3VibGU/IHtcbiAgICAgICAgdmFyIHJlc3VsdCA9IDAuMFxuICAgICAgICB2YXIgaSA9IC0xLjBcbiAgICAgICAgZm9yICh2YWx1ZSBpbiB2YWx1ZXMpIHtcbiAgICAgICAgICAgIGlmICh2YWx1ZSAhPSBudWxsICYmIHZhbHVlLmlzRmluaXRlKCkpIHtcbiAgICAgICAgICAgICAgICBpKytcbiAgICAgICAgICAgICAgICByZXN1bHQgPSB2YWx1ZSAvIChpICsgMSkgKyByZXN1bHQgKiAoaSAvIChpICsgMSkpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGlmIChpID49IDApIHJlc3VsdCBlbHNlIGRlZmF1bHRWYWx1ZVxuICAgIH1cblxuICAgIGZ1biBzdW0odmFsdWVzOiBMaXN0PERvdWJsZT8+KTogRG91YmxlIHtcbiAgICAgICAgdmFyIHJlc3VsdCA9IDAuMFxuICAgICAgICBmb3IgKHZhbHVlIGluIHZhbHVlcykge1xuICAgICAgICAgICAgaWYgKHZhbHVlICE9IG51bGwgJiYgdmFsdWUuaXNGaW5pdGUoKSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdCArPSB2YWx1ZVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBmdW4gdG9Eb3VibGVMaXN0KGw6IExpc3Q8Kj4/KTogTGlzdDxEb3VibGU/Pj8ge1xuICAgICAgICByZXR1cm4gaWYgKGwgPT0gbnVsbClcbiAgICAgICAgICAgIG51bGxcbiAgICAgICAgZWxzZVxuICAgICAgICAgICAgQ2hlY2tlZERvdWJsZUxpc3QobCkuY2FzdCgpXG4gICAgfVxuXG4gICAgY2xhc3MgQ2hlY2tlZERvdWJsZUxpc3QobGlzdDogTGlzdDwqPikgOiBDaGVja2VkRG91YmxlSXRlcmFibGUobGlzdCkge1xuXG4gICAgICAgIG92ZXJyaWRlIGZ1biBjYXN0KCk6IExpc3Q8RG91YmxlPz4ge1xuICAgICAgICAgICAgcmV0dXJuIHN1cGVyLmNhc3QoKSBhcyBMaXN0PERvdWJsZT8+XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBvcGVuIGNsYXNzIENoZWNrZWREb3VibGVJdGVyYWJsZShwcml2YXRlIHZhbCBteUl0ZXJ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UuTUFYX1ZBTFVFXG4gICAgICAgIHdlaWdodHNbcG9pbnRzLnNpemUgLSAxXSA9IERvdWJsZS5NQVhfVkFMVUVcbiAgICAgICAgc3RhY2sucHVzaChQYWlyKDAsIHBvaW50cy5zaXplIC0gMSkpXG5cbiAgICAgICAgd2hpbGUgKCFzdGFjay5lbXB0eSgpKSB7XG4gICAgICAgICAgICB2YWwgc3RhcnRJbmRleCA9IHN0YWNrLnBlZWsoKSEhLmZpcnN0XG4gICAgICAgICAgICB2YWwgZW5kSW5kZXggPSBzdGFjay5wZWVrKCkhIS5zZWNvbmRcbiAgICAgICAgICAgIHN0YWNrLnBvcCgpXG5cbiAgICAgICAgICAgIHZhciBkTWF4ID0gMC4wXG4gICAgICAgICAgICB2YXIgaW5kZXggPSBzdGFydEluZGV4XG4gICAgICAgICAgICB2YWwgZG91YmxlU2VnbWVudCA9IERvdWJsZVNlZ21lbnQocG9pbnRzW3N0YXJ0SW5kZXhdLCBwb2ludHNbZW5kSW5kZXhdKVxuICAgICAgICAgICAgdmFsIGRpc3RhbmNlOiAoRG91YmxlVmVjdG9yKSAtPiBEb3VibGVcblxuICAgICAgICAgICAgaWYgKGRvdWJsZVNlZ21lbnQubGVuZ3RoKCkgPT0gMC4wKSB7XG4gICAgICAgICAgICAgICAgZGlzdGFuY2UgPSB7IHAgLT4gRG91YmxlU2VnbWVudChwb2ludHNbc3RhcnRJbmRleF0sIHApLmxlbmd0aCgpIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgZGlzdGFuY2UgPSB7IGRvdWJsZVNlZ21lbnQuZGlzdGFuY2UoaXQpIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIGkgPSBzdGFydEluZGV4ICsgMVxuICAgICAgICAgICAgd2hpbGUgKGkgPCBlbmRJbmRleCkge1xuICAgICAgICAgICAgICAgIHZhbCBkID0gZGlzdGFuY2UocG9pbnRzW2ldKVxuICAgICAgICAgICAgICAgIGlmIChkID4gZE1heCkge1xuICAgICAgICAgICAgICAgICAgICBpbmRleCA9IGlcbiAgICAgICAgICAgICAgICAgICAgZE1heCA9IGRcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgKytpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChkTWF4ID49IG15RXBzaWxvbikge1xuICAgICAgICAgICAgICAgIHN0YWNrLnB1c2goUGFpcihzdGFydEluZGV4LCBpbmRleCkpXG4gICAgICAgICAgICAgICAgc3RhY2sucHVzaChQYWlyKGluZGV4LCBlbmRJbmRleCkpXG4gICAgICAgICAgICAgICAgd2VpZ2h0c1tpbmRleF0gPSBkTWF4XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gd2VpZ2h0c1xuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBnZXRXZWlnaHRzKHBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+KTogTGlzdDxEb3VibGU+IHtcbiAgICAgICAgcmV0dXJuIGNhbGN1bGF0ZVdlaWdodHMocG9pbnRzKVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgMjAxMC0yMDIwIEpldEJyYWlucyBzLnIuby4gYW5kIEtvdGxpbiBQcm9ncmFtbWluZyBMYW5ndWFnZSBjb250cmlidXRvcnMuXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSB0aGUgQXBhY2hlIDIuMCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBsaWNlbnNlL0xJQ0VOU0UudHh0IGZpbGUuXG4gKi9cblxuQGZpbGU6a290bGluLmp2bS5Kdm1NdWx0aWZpbGVDbGFzc1xuQGZpbGU6a290bGluLmp2bS5Kdm1OYW1lKFwiQ29sbGVjdGlvbnNLdFwiKVxuQGZpbGU6T3B0SW4oa290bGluLmV4cGVyaW1lbnRhbC5FeHBlcmltZW50YWxUeXBlSW5mZ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IChpc1dlaWdodExpbWl0U2V0KSB7XG4gICAgICAgICAgICAgICAgZmlsdGVyZWQgPSBzb3J0ZWQuZmlsdGVyIHsgcCAtPiBnZXRXZWlnaHQocCkgPiBteVdlaWdodExpbWl0IH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgZmlsdGVyZWQgPSBzb3J0ZWQudGFrZShteUNvdW50TGltaXQpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBmaWx0ZXJlZFxuICAgICAgICAgICAgICAgICAgICAubWFwIHsgdGhpcy5nZXRJbmRleChpdCkgfVxuICAgICAgICAgICAgICAgICAgICAuc29ydGVkKClcbiAgICAgICAgfVxuXG4gICAgcHJpdmF0ZSB2YWwgaXNXZWlnaHRMaW1pdFNldDogQm9vbGVhblxuICAgICAgICBnZXQoKSA9ICFteVdlaWdodExpbWl0LmlzTmFOKClcblxuICAgIGluaXQge1xuICAgICAgICBteVdlaWdodHMgPSBzdHJhdGVneS5nZXRXZWlnaHRzKG15UG9pbnRzKVxuICAgIH1cblxuICAgIGZ1biBzZXRXZWlnaHRMaW1pdCh3ZWlnaHRMaW1pdDogRG91YmxlKTogUG9seWxpbmVTaW1wbGlmaWVyIHtcbiAgICAgICAgbXlXZWlnaHRMaW1pdCA9IHdlaWdodExpbWl0XG4gICAgICAgIG15Q291bnRMaW1pdCA9IC0xXG4gICAgICAgIHJldHVybiB0aGlzXG4gICAgfVxuXG4gICAgZnVuIHNldENvdW50TGltaXQoY291bnRMaW1pdDogSW50KTogUG9seWxpbmVTaW1wbGlmaWVyIHtcbiAgICAgICAgbXlXZWlnaHRMaW1pdCA9IERvdWJsZS5OYU5cbiAgICAgICAgbXlDb3VudExpbWl0ID0gY291bnRMaW1pdFxuICAgICAgICByZXR1cm4gdGhpc1xuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGdldFdlaWdodChwOiBQYWlyPEludCwgRG91YmxlPik6IERvdWJsZSB7XG4gICAgICAgIH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wb2ludHMuc2l6ZSkgeyBJTklUSUFMX0FSRUEgfVxuICAgICAgICB2YXIgbGFzdFJlbW92ZWRWZXJ0ZXhBcmVhID0gMC4wXG4gICAgICAgIHdoaWxlICghaXNTaW1wbGlmaWNhdGlvbkRvbmUpIHtcbiAgICAgICAgICAgIHZhbCB0cmlhbmdsZSA9IHRha2VUcmlhbmdsZSgpXG5cbiAgICAgICAgICAgIGxhc3RSZW1vdmVkVmVydGV4QXJlYSA9IGlmICh0cmlhbmdsZS5hcmVhID4gbGFzdFJlbW92ZWRWZXJ0ZXhBcmVhKVxuICAgICAgICAgICAgICAgIHRyaWFuZ2xlLmFyZWFcbiAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICBsYXN0UmVtb3ZlZFZlcnRleEFyZWFcblxuICAgICAgICAgICAgd2VpZ2h0c1t0cmlhbmdsZS5jdXJyZW50VmVydGV4XSA9IGxhc3RSZW1vdmVkVmVydGV4QXJlYVxuXG4gICAgICAgICAgICB2YWwgbmV4dCA9IHRyaWFuZ2xlLm5leHRcbiAgICAgICAgICAgIGlmIChuZXh0ICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICBuZXh0LnRha2VQcmV2RnJvbSh0cmlhbmdsZSlcbiAgICAgICAgICAgICAgICB1cGRhdGUobmV4dClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFsIHByZXYgPSB0cmlhbmdsZS5wcmV2XG4gICAgICAgICAgICBpZiAocHJldiAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgcHJldi50YWtlTmV4dEZyb20odHJpYW5nbGUpXG4gICAgICAgICAgICAgICAgdXBkYXRlKHByZXYpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIG15VmVydGljZXNUb1JlbW92ZS5hZGQodHJpYW5nbGUuY3VycmVudFZlcnRleClcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB3ZWlnaHRzXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gaW5pdFRyaWFuZ2xlcyhwb2ludHM6IExpc3Q8RG91YmxlVmVjdG9yPikge1xuICAgICAgICB2YWwgdHJpYW5nbGVzID0gQXJyYXlMaXN0PFRyaWFuZ2xlPihwb2ludHMuc2l6ZSAtIDIpXG5cbiAgICAgICAgcnVuIHtcbiAgICAgICAgICAgIHZhciBpID0gMVxuICAgICAgICAgICAgdmFsIG4gPSBwb2ludHMuc2l6ZSAtIDFcbiAgICAgICAgICAgIHdoaWxlIChpIDwgbikge1xuICAgICAgICAgICAgICAgIHRyaWFuZ2xlcy5hZGQoXG4gICAgICAgICAgICAgICAgICAgIFRyaWFuZ2xlKFxuICAgICAgICAgICAgICAgICAgICAgICAgaSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50c1xuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICsraVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGkgPSAxXG4gICAgICAgIHZhbCBuID0gdHJpYW5nbGVzLnNpemUgLSAxXG4gICAgICAgIHdoaWxlIChpIDwgbikge1xuICAgICAgICAgICAgdHJpYW5nbGVzW2ldLm5leHQgPSB0cmlhbmdsZXNbaSArIDFdXG4gICAgICAgICAgICB0cmlhbmdsZXNbaV0ucHJldiA9IHRyaWFuZ2xlc1tpIC0gMV1cbiAgICAgICAgICAgIGkrK1xuICAgICAgICB9XG5cbiAgICAgICAgdHJpYW5nbGVzLmZvckVhY2ggeyB0aGlzLmFkZChpdCkgfVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHRha2VUcmlhbmdsZSgpOiBUcmlhbmdsZSB7XG4gICAgICAgIHZhbCBtaW5pbWFsVHJpYW5nbGUgPSBwb2xsKClcbiAgICAgICAgbXlWZXJ0aWNlc1RvUmVtb3ZlLmFkZChtaW5pbWFsVHJpYW5nbGUuY3VycmVudFZlcnRleClcbiAgICAgICAgcmV0dXJuIG1pbmltYWxUcmlhbm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CBteVBvaW50czogTGlzdDxEb3VibGVWZWN0b3I+KSB7XG4gICAgICAgIHZhciBhcmVhOiBEb3VibGUgPSAwLnRvRG91YmxlKClcbiAgICAgICAgICAgIHByaXZhdGUgc2V0XG4gICAgICAgIHByaXZhdGUgdmFyIHByZXZWZXJ0ZXg6IEludCA9IDBcbiAgICAgICAgcHJpdmF0ZSB2YXIgbmV4dFZlcnRleDogSW50ID0gMFxuICAgICAgICB2YXIgcHJldjogVHJpYW5nbGU/ID0gbnVsbFxuICAgICAgICB2YXIgbmV4dDogVHJpYW5nbGU/ID0gbnVsbFxuXG4gICAgICAgIGluaXQge1xuICAgICAgICAgICAgcHJldlZlcnRleCA9IGN1cnJlbnRWZXJ0ZXggLSAxXG4gICAgICAgICAgICBuZXh0VmVydGV4ID0gY3VycmVudFZlcnRleCArIDFcbiAgICAgICAgICAgIGFyZWEgPSBjYWxjdWxhdGVBcmVhKClcbiAgICAgICAgfVxuXG4gICAgICAgIGludGVybmFsIGZ1biB0YWtlTmV4dEZyb20odHJpYW5nbGU6IFRyaWFuZ2xlKSB7XG4gICAgICAgICAgICBuZXh0ID0gdHJpYW5nbGUubmV4dFxuICAgICAgICAgICAgbmV4dFZlcnRleCA9IHRyaWFuZ2xlLm5leHRWZXJ0ZXhcbiAgICAgICAgICAgIGFyZWEgPSBjYWxjdWxhdGVBcmVhKClcbiAgICAgICAgfVxuXG4gICAgICAgIGludGVybmFsIGZ1biB0YWtlUHJldkZyb20odHJpYW5nbGU6IFRyaWFuZ2xlKSB7XG4gICAgICAgICAgICBwcmV2ID0gdHJpYW5nbGUucHJldlxuICAgICAgICAgICAgcHJldlZlcnRleCA9IHRyaWFuZ2xlLnByZXZWZXJ0ZXhcbiAgICAgICAgICAgIGFyZWEgPSBjYWxjdWxhdGVBcmVhKClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGNhbGN1bGF0ZUFyZWEoKTogRG91YmxlIHtcbiAgICAgICAgICAgIHZhbCBhID0g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wSW1wbChcbiAgICAgICAgICAgICAgICBkYXRhVHlwZVxuICAgICAgICAgICAgKSwgXCJudWxsXCJcbiAgICAgICAgKVxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIHRvb2x0aXBJbXBsKGRhdGFUeXBlOiBEYXRhVHlwZSk6IChBbnkpIC0+IFN0cmluZyB7XG4gICAgICAgIHJldHVybiB3aGVuIChkYXRhVHlwZSkge1xuICAgICAgICAgICAgRGF0YVR5cGUuTlVNQkVSIC0+IERFRl9OVU1CRVJfRk9STUFUVEVSXG4gICAgICAgICAgICBEYXRhVHlwZS5TVFJJTkcgLT4geyBpdCAtPiBpdC50b1N0cmluZygpIH0gLy8gbm8gZm9ybWF0dGluZyByZWFsbHkgKHRvU3RpbmcpXG4gICAgICAgICAgICBEYXRhVHlwZS5JTlNUQU5UIC0+IHRpbWUoXG4gICAgICAgICAgICAgICAgREFURV9NRURJVU1fVElNRV9TSE9SVFxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgRGF0YVR5cGUuSU5TVEFOVF9PRl9EQVkgLT4gdGltZShcbiAgICAgICAgICAgICAgICBEQVRFX01FRElVTVxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgRGF0YVR5cGUuSU5TVEFOVF9PRl9NT05USCAtPiB0aW1lKFxuICAgICAgICAgICAgICAgIFlFQVJfTU9OVEhcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIERhdGFUeXBlLklOU1RBTlRfT0ZfUVVBUlRFUiwgRGF0YVR5cGUuSU5TVEFOVF9PRl9IQUxGX1lFQVIgLT4gdGltZShcbiAgICAgICAgICAgICAgICBZRUFSX1FVQVJURVJcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIERhdGFUeXBlLklOU1RBTlRfT0ZfWUVBUiAtPiB0aW1lKFxuICAgICAgICAgICAgICAgIFlFQVJcbiAgICAgICAgICAgIClcbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8vIFRvRG86IHJlbW92ZSAtIG9ubHkgdXNlZCBpbiB0ZXN0cyAoPylcbiAgICBmdW4gdGFibGVDZWxsKGRhdGFUeXBlOiBEYXRhVHlwZSk6IChBbnk/KSAtPiBTdHJpbmcge1xuICAgICAgICByZXR1cm4gdGFibGVDZWxsKGRhdGFUeXBlLCBcIm51bGxcIilcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biB0YWJsZUNlbGwoZGF0YVR5cGU6IERhdGFUeXBlLCBudWxsU3RyaW5nOiBTdHJpbmcpOiAoQW55PykgLT4gU3RyaW5nIHtcbiAgICAgICAgcmV0dXJuIG51bGxhYmxlKFxuICAgICAgICAgICAgdGFibGVDZWxsSW1wbChcbiAgICAgICAgICAgICAgICBkYXRhVHlwZVxuICAgICAgICAgICAgKSwgbnVsbFN0cmluZ1xuICAgICAgICApXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gdGFibGVDZWxsSW1wbChkYXRhVHlwZTogRGF0YVR5cGUpOiAoQW55KSAtPiBTdHJpbmcge1xuICAgICAgICB3aGVuIChkYXRhVHlwZSkge1xuICAgICAgICAgICAgRGF0YVR5cGUuTlVNQkVSIC0+IHJldHVybiBERUZfTlVNQkVSX0ZPUk1BVFRFUlxuICAgICAgICAgICAgRGF0YVR5cGUuU1RSSU5HIC0+IHJldHVybiB7IGl0LnRvU3RyaW5nKCkgfSAvLyBubyBmb3JtYXR0aW5nIHJlYWxseSAodG9TdGluZylcbiAgICAgICAgICAgIERhdGFUeXBlLklOU1RBTlQgLT4gcmV0dXJuIHRpbWUoXCIlYSwgJWIgJWUsICcleVwiKVxuICAgICAgICAgICAgZWxzZSAtPiBpZiAoZGF0YVR5cGUuaXNUaW1lSW50ZXJ2YWwpIHtcbiAgICAgICAgICAgICAgICB2YWwgdGltZUludGVydmFsID0gVGltZUludGVydmFsLmZyb21JbnRlcnZhbERhdGFUeXBlKGRhdGFUeXBlKVxuICAgICAgICAgICAgICAgIHJldHVybiB0aW1lSW50ZXJ2YWwudGlja0Zvcm1hdHRlclxuICAgICAgICAgIC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pbi5tYXRoLmNlaWxcblxuaW50ZXJuYWwgY2xhc3MgRHVyYXRpb25JbnRlcnZhbChwcml2YXRlIHZhbCBteUR1cmF0aW9uOiBEdXJhdGlvbiwgY291bnQ6IEludCkgOiBUaW1lSW50ZXJ2YWwoY291bnQpIHtcblxuICAgIG92ZXJyaWRlLy8gbWlsbGlzZWNvbmRzXG4gICAgLy8gZnJhY3Rpb25hbCBzZWNvbmRzXG4gICAgLy8gc2Vjb25kc1xuICAgIC8vIG1pbnV0ZXNcbiAgICAvLyBob3Vyc1xuICAgIC8vIGRheXNcbiAgICAvLyB3ZWVrc1xuICAgIHZhbCB0aWNrRm9ybWF0UGF0dGVybjogU3RyaW5nXG4gICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgIHZhbCBkdXJhdGlvbiA9IG15RHVyYXRpb24uZHVyYXRpb25cbiAgICAgICAgICAgIGlmIChkdXJhdGlvbiA8IER1cmF0aW9uLlNFQ09ORC5kdXJhdGlvbikge1xuICAgICAgICAgICAgICAgIHJldHVybiBcIiVTXCJcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoZHVyYXRpb24gPCBEdXJhdGlvbi5NSU5VVEUuZHVyYXRpb24pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gXCIlU1wiXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGR1cmF0aW9uIDwgRHVyYXRpb24uSE9VUi5kdXJhdGlvbikge1xuICAgICAgICAgICAgICAgIHJldHVybiBcIiVNXCJcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoZHVyYXRpb24gPCBEdXJhdGlvbi5EQVkuZHVyYXRpb24pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gXCIlSDolTVwiXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGR1cmF0aW9uIDwgRHVyYXRpb24uV0VFSy5kdXJhdGlvbikge1xuICAgICAgICAgICAgICAgIHJldHVybiBcIiViICVlXCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybi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lcygxNSksXG4gICAgICAgIFRpbWVJbnRlcnZhbC5taW51dGVzKDMwKSxcblxuICAgICAgICBUaW1lSW50ZXJ2YWwuaG91cnMoMSksXG4gICAgICAgIFRpbWVJbnRlcnZhbC5ob3VycygzKSxcbiAgICAgICAgVGltZUludGVydmFsLmhvdXJzKDYpLFxuICAgICAgICBUaW1lSW50ZXJ2YWwuaG91cnMoMTIpLFxuXG4gICAgICAgIFRpbWVJbnRlcnZhbC5kYXlzKDEpLFxuICAgICAgICBUaW1lSW50ZXJ2YWwuZGF5cygyKSxcblxuICAgICAgICBUaW1lSW50ZXJ2YWwud2Vla3MoMSksXG5cbiAgICAgICAgVGltZUludGVydmFsLm1vbnRocygxKSxcbiAgICAgICAgVGltZUludGVydmFsLm1vbnRocygzKSxcblxuICAgICAgICBUaW1lSW50ZXJ2YWwueWVhcnMoMSlcbiAgICApXG5cbiAgICBmdW4gZm9yTWlsbGlzKGludGVydmFsOiBEb3VibGUpOiBUaW1lSW50ZXJ2YWwge1xuICAgICAgICBpZiAoaW50ZXJ2YWwgPD0gQVVUT19TVEVQU19NU1swXSkge1xuICAgICAgICAgICAgcmV0dXJuIEFVVE9fSU5URVJWQUxTWzBdXG4gICAgICAgIH1cblxuICAgICAgICB2YXIgcmVzdWx0ID0gQVVUT19JTlRFUlZBTFNbQVVUT19TVEVQU19NUy5zaXplIC0gMV1cbiAgICAgICAgZm9yIChpIGluIDEgdW50aWwgQVVUT19TVEVQU19NUy5zaXplKSB7XG4gICAgICAgICAgICBpZiAoQVVUT19TVEVQU19NU1tpXSA+PSBpbnRlcnZhbCkge1xuICAgICAgICAgICAgICAgIHZhbCBkZWx0YURvd24gPSBpbnRlcnZhbCAtIEFVVE9fU1RFUFNfTVNbaSAtIDFdXG4gICAgICAgICAgICAgICAgdmFsIGRlbHRhVXAgPSBBVVRPX1NURVBTX01TW2ldIC0gaW50ZXJ2YWxcbiAgICAgICAgICAgICAgICBpZiAoZGVsdGFEb3duIDwgZGVsdGFVcCk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luY2VLb3RsaW4oXCIxLjJcIilcbkBTdXBwcmVzcyhcIkFDVFVBTF9GVU5DVElPTl9XSVRIX0RFRkFVTFRfQVJHVU1FTlRTXCIpXG5wdWJsaWMgYWN0dWFsIGZ1biBTdHJpbmcuY29tcGFyZVRvKG90aGVyOiBTdHJpbmcsIGlnbm9yZUNhc2U6IEJvb2xlYW4gPSBmYWxzZSk6IEludCB7XG4gICAgaWYgKGlnbm9yZUNhc2UpIHtcbiAgICAgICAgdmFsIG4xID0gdGhpcy5sZW5ndGhcbiAgICAgICAgdmFsIG4yID0gb3RoZXIubGVuZ3RoXG4gICAgICAgIHZhbCBtaW4gPSBtaW5PZihuMSwgbjIpXG4gICAgICAgIGlmIChtaW4gPT0gMCkgcmV0dXJuIG4xIC0gbjJcbiAgICAgICAgdmFyIHN0YXJ0ID0gMFxuICAgICAgICB3aGlsZSAodHJ1ZSkge1xuICAgICAgICAgICAgdmFsIGVuZCA9IG1pbk9mKHN0YXJ0ICsgMTYsIG1pbilcbiAgICAgICAgICAgIHZhciBzMSA9IHRoaXMuc3Vic3RyaW5nKHN0YXJ0LCBlbmQpXG4gICAgICAgICAgICB2YXIgczIgPSBvdGhlci5zdWJzdHJpbmcoc3RhcnQsIGVuZClcbiAgICAgICAgICAgIGlmIChzMSAhPSBzMikge1xuICAgICAgICAgICAgICAgIHMxID0gczEudXBwZXJjYXNlKClcbiAgICAgICAgICAgICAgICBzMiA9IHMyLnVwcGVyY2FzZSgpXG4gICAgICAgICAgICAgICAgaWYgKHMxICE9IHMyKSB7XG4gICAgICAgICAgICAgICAgICAgIHMxID0gczEubG93ZXJjYXNlKClcbiAgICAgICAgICAgICAgICAgICAgczIgPSBzMi5sb3dlcmNhc2UoKVxuICAgICAgICAgICAgICAgICAgICBpZiAoczEgIT0gczIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzMS5jb21wYXJlVG8oczIpXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgIC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XG5cbiAgICAgICAgZnVuIG1pbnV0ZXMoY291bnQ6IEludCk6IFRpbWVJbnRlcnZhbCB7XG4gICAgICAgICAgICByZXR1cm4gRHVyYXRpb25JbnRlcnZhbChEdXJhdGlvbi5NSU5VVEUsIGNvdW50KVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIGhvdXJzKGNvdW50OiBJbnQpOiBUaW1lSW50ZXJ2YWwge1xuICAgICAgICAgICAgcmV0dXJuIER1cmF0aW9uSW50ZXJ2YWwoRHVyYXRpb24uSE9VUiwgY291bnQpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZGF5cyhjb3VudDogSW50KTogVGltZUludGVydmFsIHtcbiAgICAgICAgICAgIHJldHVybiBEdXJhdGlvbkludGVydmFsKER1cmF0aW9uLkRBWSwgY291bnQpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gd2Vla3MoY291bnQ6IEludCk6IFRpbWVJbnRlcnZhbCB7XG4gICAgICAgICAgICByZXR1cm4gRHVyYXRpb25JbnRlcnZhbChEdXJhdGlvbi5XRUVLLCBjb3VudClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBtb250aHMoY291bnQ6IEludCk6IFRpbWVJbnRlcnZhbCB7XG4gICAgICAgICAgICByZXR1cm4gTW9udGhJbnRlcnZhbChjb3VudClcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIHF1YXJ0ZXIoY291bnQ6IEludCk6IFRpbWVJbnRlcnZhbCB7XG4gICAgICAgICAgICByZXR1cm4gUXVhcnRlckludGVydmFsKGNvdW50KVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gc2VtZXN0ZXIoY291bnQ6IEludCk6IFRpbWVJbnRlcnZhbCB7XG4gICAgICAgICAgICByZXR1cm4gU2VtZXN0ZXJJbnRlcnZhbChjb3VudClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB5ZWFycyhjb3VudDogSW50KTogVGltZUludGVydmFsIHtcbiAgICAgICAgICAgIHJldHVybiBZZWFySW50ZXJ2YWwoY291bnQpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gZnJvbUludGVydmFsRGF0YVR5cGUoZGF0YVR5cGU6IERhdGFUeXBlKTogVGltZUludGVydmFsIHtcbiAgICAgICAgICAgIHJldHVybiB3aGVuIChkYXRhVHlwZSkge1xuICAgICAgICAgICAgICAgIERhdGFUeXBlLklOU1RBTlRfT0ZfREFZIC0+IGRheXMoXG4gICAgICAgICAgICAgICAgICAgIDFcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgRGF0YVR5cGUuSU5TVEFOVF9PRl9NT05USCAtPiBtb250aHMoXG4gICAgICAgICAgICAgICAgICAgIDFcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgRGF0YVR5cGUuSU5TVEFOVF9PRl9RVUFSVEVSIC0+IHF1YXJ0ZXIoXG4gICAgICAgICAgICAgICAgICAgIDFcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgRGF0YVR5cGUuSU5TVEFOVF9PRl9IQUxGX1lFQVIgLT4gc2VtZXN0ZXIoXG4gICAgICAgICAgICAgICAgICAgIDFcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgRGF0YVR5cGUuSU5TVEFOVF9PRl9ZRUFSIC0+IHllYXJzKFxuICAgICAgICAgICAgICAgICAgICAxXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIGVsc2UgLT4gdGhyb3cgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKFwiQ2FuJ3QgY3JlYXRlIGludGVydmFsIGZyb20gZGF0YSB0eXBlOiAkZGF0YVR5cGVcIilcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIi8qXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkuIEpldEJyYWlucyBzLnIuby5cbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmV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0YW50LnllYXJcbiAgICAgICAgcmV0dXJuIERhdGVUaW1lKERhdGUuZmlyc3REYXlPZih5ZWFyICsgMSkpXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIGNvbnN0IHZhbCBUSUNLX0ZPUk1BVCA9IFwiJVlcIlxuICAgICAgICBjb25zdCB2YWwgTVMgPSAzMTUzNmU2XG4gICAgICAgIHZhbCBUSUNLX0ZPUk1BVFRFUiA9IEZvcm1hdHRlci50aW1lKFRJQ0tfRk9STUFUKVxuICAgIH1cbn1cbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./kotlin-dce-dev/lets-plot-plot-common-portable.js\n"); +eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) {\n if (true)\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(/*! kotlin */ \"./kotlin-dce-dev/kotlin.js\"), __webpack_require__(/*! lets-plot-base-portable */ \"./kotlin-dce-dev/lets-plot-base-portable.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n else {}\n}(this, function (_, Kotlin, $module$lets_plot_base_portable) {\n 'use strict';\n var Enum = Kotlin.kotlin.Enum;\n var Kind_CLASS = Kotlin.Kind.CLASS;\n var throwISE = Kotlin.throwISE;\n var Kind_OBJECT = Kotlin.Kind.OBJECT;\n var JsMath = Math;\n var Kind_INTERFACE = Kotlin.Kind.INTERFACE;\n var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_287e2$;\n var ArrayList_init_0 = Kotlin.kotlin.collections.ArrayList_init_ww73n8$;\n var Color = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Color;\n var collect = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect;\n var Exception = Kotlin.kotlin.Exception;\n var throwCCE = Kotlin.throwCCE;\n var setOf = Kotlin.kotlin.collections.setOf_i5x0yv$;\n var HashMap_init = Kotlin.kotlin.collections.HashMap_init_q3lmfv$;\n var numberToInt = Kotlin.numberToInt;\n var ensureNotNull = Kotlin.ensureNotNull;\n var ClosedRange = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.ClosedRange;\n var Ordering = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.Ordering;\n var isFinite = Kotlin.kotlin.isFinite_yrwdxr$;\n var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init_pdl1vj$;\n var take = Kotlin.kotlin.collections.take_ba2ldo$;\n var toList = Kotlin.kotlin.collections.toList_7wnvza$;\n var List = Kotlin.kotlin.collections.List;\n var listOf = Kotlin.kotlin.collections.listOf_i5x0yv$;\n var Iterable = Kotlin.kotlin.collections.Iterable;\n var isInfinite = Kotlin.kotlin.isInfinite_yrwdxr$;\n var equals = Kotlin.equals;\n var contains = Kotlin.kotlin.collections.contains_2ws7j4$;\n var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init_pdl1vj$;\n var Stack = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.Stack;\n var kotlin_js_internal_DoubleCompanionObject = Kotlin.kotlin.js.internal.DoubleCompanionObject;\n var Pair = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Pair;\n var DoubleSegment = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleSegment;\n var until = Kotlin.kotlin.ranges.until_dqglrj$;\n var isNaN_0 = Kotlin.kotlin.isNaN_yrwdxr$;\n var reversed = Kotlin.kotlin.comparisons.reversed_2avth4$;\n var sortedWith = Kotlin.kotlin.collections.sortedWith_eknfly$;\n var sorted = Kotlin.kotlin.collections.sorted_exjks8$;\n var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$;\n var wrapFunction = Kotlin.wrapFunction;\n var Comparator = Kotlin.kotlin.Comparator;\n var binarySearch = Kotlin.kotlin.collections.binarySearch_vikexg$;\n var Format_init = $module$lets_plot_base_portable.jetbrains.datalore.base.dateFormat.Format_init_61zpoe$;\n var numberToLong = Kotlin.numberToLong;\n var Instant = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.Instant;\n var getCallableRef = Kotlin.getCallableRef;\n var TimeZone = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.tz.TimeZone;\n var NumberFormat_init = $module$lets_plot_base_portable.jetbrains.datalore.base.numberFormat.NumberFormat_init_61zpoe$;\n var roundToLong = Kotlin.kotlin.math.roundToLong_yrwdxr$;\n var RuntimeException = Kotlin.kotlin.RuntimeException;\n var Date_0 = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.Date;\n var DateTime = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.DateTime;\n var Duration = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.Duration;\n var RuntimeException_init = Kotlin.kotlin.RuntimeException_init_pdl1vj$;\n var Month = $module$lets_plot_base_portable.jetbrains.datalore.base.datetime.Month;\n var UnsupportedOperationException_init = Kotlin.kotlin.UnsupportedOperationException_init;\n var startsWith = Kotlin.kotlin.text.startsWith_7epoxm$;\n var toInt = Kotlin.kotlin.text.toInt_pdl1vz$;\n var NumberFormatException = Kotlin.kotlin.NumberFormatException;\n ColorPalette$Type.prototype = Object.create(Enum.prototype);\n ColorPalette$Type.prototype.constructor = ColorPalette$Type;\n ColorPalette$Sequential.prototype = Object.create(Enum.prototype);\n ColorPalette$Sequential.prototype.constructor = ColorPalette$Sequential;\n ColorPalette$Diverging.prototype = Object.create(Enum.prototype);\n ColorPalette$Diverging.prototype.constructor = ColorPalette$Diverging;\n ColorPalette$Qualitative.prototype = Object.create(Enum.prototype);\n ColorPalette$Qualitative.prototype.constructor = ColorPalette$Qualitative;\n DataType.prototype = Object.create(Enum.prototype);\n DataType.prototype.constructor = DataType;\n RegularMeshDetector$MyRowDetector.prototype = Object.create(RegularMeshDetector.prototype);\n RegularMeshDetector$MyRowDetector.prototype.constructor = RegularMeshDetector$MyRowDetector;\n RegularMeshDetector$MyColumnDetector.prototype = Object.create(RegularMeshDetector.prototype);\n RegularMeshDetector$MyColumnDetector.prototype.constructor = RegularMeshDetector$MyColumnDetector;\n RegularMeshDetector$Companion$NO_MESH$ObjectLiteral.prototype = Object.create(RegularMeshDetector.prototype);\n RegularMeshDetector$Companion$NO_MESH$ObjectLiteral.prototype.constructor = RegularMeshDetector$Companion$NO_MESH$ObjectLiteral;\n SeriesUtil$CheckedDoubleList.prototype = Object.create(SeriesUtil$CheckedDoubleIterable.prototype);\n SeriesUtil$CheckedDoubleList.prototype.constructor = SeriesUtil$CheckedDoubleList;\n DurationInterval.prototype = Object.create(TimeInterval.prototype);\n DurationInterval.prototype.constructor = DurationInterval;\n MeasuredInDays.prototype = Object.create(TimeInterval.prototype);\n MeasuredInDays.prototype.constructor = MeasuredInDays;\n MonthInterval.prototype = Object.create(MeasuredInDays.prototype);\n MonthInterval.prototype.constructor = MonthInterval;\n QuarterInterval.prototype = Object.create(TimeInterval.prototype);\n QuarterInterval.prototype.constructor = QuarterInterval;\n SemesterInterval.prototype = Object.create(TimeInterval.prototype);\n SemesterInterval.prototype.constructor = SemesterInterval;\n YearInterval.prototype = Object.create(MeasuredInDays.prototype);\n YearInterval.prototype.constructor = YearInterval;\n function ColorPalette() {\n ColorPalette_instance = this;\n this.MIN_COLOR_SET_SIZE_0 = 3;\n }\n ColorPalette.prototype.colors_0 = function (scheme, count) {\n var count_0 = count;\n var b = count_0;\n count_0 = JsMath.max(3, b);\n var a = scheme.maxColors;\n var b_0 = count_0;\n count_0 = JsMath.min(a, b_0);\n return scheme.colorSet[count_0 - 3 | 0];\n };\n ColorPalette.prototype.maxColorSetSize_0 = function (scheme) {\n var colorSet = scheme.colorSet;\n return colorSet[colorSet.length - 1 | 0].length;\n };\n function ColorPalette$Type(name, ordinal, myPresentation) {\n Enum.call(this);\n this.myPresentation_6glhnl$_0 = myPresentation;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ColorPalette$Type_initFields() {\n ColorPalette$Type_initFields = function () {\n };\n ColorPalette$Type$SEQUENTIAL_instance = new ColorPalette$Type('SEQUENTIAL', 0, 'sequential');\n ColorPalette$Type$DIVERGING_instance = new ColorPalette$Type('DIVERGING', 1, 'diverging');\n ColorPalette$Type$QUALITATIVE_instance = new ColorPalette$Type('QUALITATIVE', 2, 'qualitative');\n }\n var ColorPalette$Type$SEQUENTIAL_instance;\n function ColorPalette$Type$SEQUENTIAL_getInstance() {\n ColorPalette$Type_initFields();\n return ColorPalette$Type$SEQUENTIAL_instance;\n }\n var ColorPalette$Type$DIVERGING_instance;\n function ColorPalette$Type$DIVERGING_getInstance() {\n ColorPalette$Type_initFields();\n return ColorPalette$Type$DIVERGING_instance;\n }\n var ColorPalette$Type$QUALITATIVE_instance;\n function ColorPalette$Type$QUALITATIVE_getInstance() {\n ColorPalette$Type_initFields();\n return ColorPalette$Type$QUALITATIVE_instance;\n }\n ColorPalette$Type.prototype.toString = function () {\n return this.myPresentation_6glhnl$_0;\n };\n ColorPalette$Type.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Type',\n interfaces: [Enum]\n };\n function ColorPalette$Type$values() {\n return [ColorPalette$Type$SEQUENTIAL_getInstance(), ColorPalette$Type$DIVERGING_getInstance(), ColorPalette$Type$QUALITATIVE_getInstance()];\n }\n ColorPalette$Type.values = ColorPalette$Type$values;\n function ColorPalette$Type$valueOf(name) {\n switch (name) {\n case 'SEQUENTIAL':\n return ColorPalette$Type$SEQUENTIAL_getInstance();\n case 'DIVERGING':\n return ColorPalette$Type$DIVERGING_getInstance();\n case 'QUALITATIVE':\n return ColorPalette$Type$QUALITATIVE_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Type.' + name);\n }\n }\n ColorPalette$Type.valueOf_61zpoe$ = ColorPalette$Type$valueOf;\n function ColorPalette$Sequential(name, ordinal, myPresentation, colorSet) {\n Enum.call(this);\n this.myPresentation_w2uxp8$_0 = myPresentation;\n this.colorSet_b1v09h$_0 = colorSet;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ColorPalette$Sequential_initFields() {\n ColorPalette$Sequential_initFields = function () {\n };\n ColorPalette$Sequential$Blues_instance = new ColorPalette$Sequential('Blues', 0, 'blues', ColorSets_getInstance().BLUES);\n ColorPalette$Sequential$BuGn_instance = new ColorPalette$Sequential('BuGn', 1, 'blue-green', ColorSets_getInstance().BU_GN);\n ColorPalette$Sequential$BuPu_instance = new ColorPalette$Sequential('BuPu', 2, 'blue-purple', ColorSets_getInstance().BU_PU);\n ColorPalette$Sequential$GnBu_instance = new ColorPalette$Sequential('GnBu', 3, 'green-blue', ColorSets_getInstance().GN_BU);\n ColorPalette$Sequential$Greens_instance = new ColorPalette$Sequential('Greens', 4, 'greens', ColorSets_getInstance().GREENS);\n ColorPalette$Sequential$Greys_instance = new ColorPalette$Sequential('Greys', 5, 'greys', ColorSets_getInstance().GREYS);\n ColorPalette$Sequential$Oranges_instance = new ColorPalette$Sequential('Oranges', 6, 'oranges', ColorSets_getInstance().ORANGES);\n ColorPalette$Sequential$OrRd_instance = new ColorPalette$Sequential('OrRd', 7, 'orange-red', ColorSets_getInstance().OR_RD);\n ColorPalette$Sequential$PuBu_instance = new ColorPalette$Sequential('PuBu', 8, 'purple-blue', ColorSets_getInstance().PU_BU);\n ColorPalette$Sequential$PuBuGn_instance = new ColorPalette$Sequential('PuBuGn', 9, 'purple-blue-green', ColorSets_getInstance().PU_BU_GN);\n ColorPalette$Sequential$PuRd_instance = new ColorPalette$Sequential('PuRd', 10, 'purple-red', ColorSets_getInstance().PU_RD);\n ColorPalette$Sequential$Purples_instance = new ColorPalette$Sequential('Purples', 11, 'purples', ColorSets_getInstance().PURPLES);\n ColorPalette$Sequential$RdPu_instance = new ColorPalette$Sequential('RdPu', 12, 'red-purple', ColorSets_getInstance().RD_PU);\n ColorPalette$Sequential$Reds_instance = new ColorPalette$Sequential('Reds', 13, 'reds', ColorSets_getInstance().REDS);\n ColorPalette$Sequential$YlGn_instance = new ColorPalette$Sequential('YlGn', 14, 'yellow-green', ColorSets_getInstance().YL_GN);\n ColorPalette$Sequential$YlGnBu_instance = new ColorPalette$Sequential('YlGnBu', 15, 'yellow-green-blue', ColorSets_getInstance().YL_GN_BU);\n ColorPalette$Sequential$YlOrBr_instance = new ColorPalette$Sequential('YlOrBr', 16, 'yellow-orange-brown', ColorSets_getInstance().YL_OR_BR);\n ColorPalette$Sequential$YlOrRd_instance = new ColorPalette$Sequential('YlOrRd', 17, 'yellow-orange-red', ColorSets_getInstance().YL_OR_RD);\n }\n Object.defineProperty(ColorPalette$Sequential.prototype, 'colorSet', {\n get: function () {\n return this.colorSet_b1v09h$_0;\n }\n });\n var ColorPalette$Sequential$Blues_instance;\n function ColorPalette$Sequential$Blues_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Blues_instance;\n }\n var ColorPalette$Sequential$BuGn_instance;\n function ColorPalette$Sequential$BuGn_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$BuGn_instance;\n }\n var ColorPalette$Sequential$BuPu_instance;\n function ColorPalette$Sequential$BuPu_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$BuPu_instance;\n }\n var ColorPalette$Sequential$GnBu_instance;\n function ColorPalette$Sequential$GnBu_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$GnBu_instance;\n }\n var ColorPalette$Sequential$Greens_instance;\n function ColorPalette$Sequential$Greens_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Greens_instance;\n }\n var ColorPalette$Sequential$Greys_instance;\n function ColorPalette$Sequential$Greys_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Greys_instance;\n }\n var ColorPalette$Sequential$Oranges_instance;\n function ColorPalette$Sequential$Oranges_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Oranges_instance;\n }\n var ColorPalette$Sequential$OrRd_instance;\n function ColorPalette$Sequential$OrRd_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$OrRd_instance;\n }\n var ColorPalette$Sequential$PuBu_instance;\n function ColorPalette$Sequential$PuBu_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$PuBu_instance;\n }\n var ColorPalette$Sequential$PuBuGn_instance;\n function ColorPalette$Sequential$PuBuGn_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$PuBuGn_instance;\n }\n var ColorPalette$Sequential$PuRd_instance;\n function ColorPalette$Sequential$PuRd_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$PuRd_instance;\n }\n var ColorPalette$Sequential$Purples_instance;\n function ColorPalette$Sequential$Purples_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Purples_instance;\n }\n var ColorPalette$Sequential$RdPu_instance;\n function ColorPalette$Sequential$RdPu_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$RdPu_instance;\n }\n var ColorPalette$Sequential$Reds_instance;\n function ColorPalette$Sequential$Reds_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$Reds_instance;\n }\n var ColorPalette$Sequential$YlGn_instance;\n function ColorPalette$Sequential$YlGn_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$YlGn_instance;\n }\n var ColorPalette$Sequential$YlGnBu_instance;\n function ColorPalette$Sequential$YlGnBu_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$YlGnBu_instance;\n }\n var ColorPalette$Sequential$YlOrBr_instance;\n function ColorPalette$Sequential$YlOrBr_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$YlOrBr_instance;\n }\n var ColorPalette$Sequential$YlOrRd_instance;\n function ColorPalette$Sequential$YlOrRd_getInstance() {\n ColorPalette$Sequential_initFields();\n return ColorPalette$Sequential$YlOrRd_instance;\n }\n Object.defineProperty(ColorPalette$Sequential.prototype, 'type', {\n configurable: true,\n get: function () {\n return ColorPalette$Type$SEQUENTIAL_getInstance();\n }\n });\n Object.defineProperty(ColorPalette$Sequential.prototype, 'maxColors', {\n configurable: true,\n get: function () {\n return ColorPalette_getInstance().maxColorSetSize_0(this);\n }\n });\n ColorPalette$Sequential.prototype.getColors_za3lpa$ = function (count) {\n return ColorPalette_getInstance().colors_0(this, count);\n };\n ColorPalette$Sequential.prototype.toString = function () {\n return this.myPresentation_w2uxp8$_0;\n };\n ColorPalette$Sequential.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Sequential',\n interfaces: [ColorScheme, Enum]\n };\n function ColorPalette$Sequential$values() {\n return [ColorPalette$Sequential$Blues_getInstance(), ColorPalette$Sequential$BuGn_getInstance(), ColorPalette$Sequential$BuPu_getInstance(), ColorPalette$Sequential$GnBu_getInstance(), ColorPalette$Sequential$Greens_getInstance(), ColorPalette$Sequential$Greys_getInstance(), ColorPalette$Sequential$Oranges_getInstance(), ColorPalette$Sequential$OrRd_getInstance(), ColorPalette$Sequential$PuBu_getInstance(), ColorPalette$Sequential$PuBuGn_getInstance(), ColorPalette$Sequential$PuRd_getInstance(), ColorPalette$Sequential$Purples_getInstance(), ColorPalette$Sequential$RdPu_getInstance(), ColorPalette$Sequential$Reds_getInstance(), ColorPalette$Sequential$YlGn_getInstance(), ColorPalette$Sequential$YlGnBu_getInstance(), ColorPalette$Sequential$YlOrBr_getInstance(), ColorPalette$Sequential$YlOrRd_getInstance()];\n }\n ColorPalette$Sequential.values = ColorPalette$Sequential$values;\n function ColorPalette$Sequential$valueOf(name) {\n switch (name) {\n case 'Blues':\n return ColorPalette$Sequential$Blues_getInstance();\n case 'BuGn':\n return ColorPalette$Sequential$BuGn_getInstance();\n case 'BuPu':\n return ColorPalette$Sequential$BuPu_getInstance();\n case 'GnBu':\n return ColorPalette$Sequential$GnBu_getInstance();\n case 'Greens':\n return ColorPalette$Sequential$Greens_getInstance();\n case 'Greys':\n return ColorPalette$Sequential$Greys_getInstance();\n case 'Oranges':\n return ColorPalette$Sequential$Oranges_getInstance();\n case 'OrRd':\n return ColorPalette$Sequential$OrRd_getInstance();\n case 'PuBu':\n return ColorPalette$Sequential$PuBu_getInstance();\n case 'PuBuGn':\n return ColorPalette$Sequential$PuBuGn_getInstance();\n case 'PuRd':\n return ColorPalette$Sequential$PuRd_getInstance();\n case 'Purples':\n return ColorPalette$Sequential$Purples_getInstance();\n case 'RdPu':\n return ColorPalette$Sequential$RdPu_getInstance();\n case 'Reds':\n return ColorPalette$Sequential$Reds_getInstance();\n case 'YlGn':\n return ColorPalette$Sequential$YlGn_getInstance();\n case 'YlGnBu':\n return ColorPalette$Sequential$YlGnBu_getInstance();\n case 'YlOrBr':\n return ColorPalette$Sequential$YlOrBr_getInstance();\n case 'YlOrRd':\n return ColorPalette$Sequential$YlOrRd_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Sequential.' + name);\n }\n }\n ColorPalette$Sequential.valueOf_61zpoe$ = ColorPalette$Sequential$valueOf;\n function ColorPalette$Diverging(name, ordinal, myPresentation, colorSet) {\n Enum.call(this);\n this.myPresentation_im16qo$_0 = myPresentation;\n this.colorSet_las6nb$_0 = colorSet;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ColorPalette$Diverging_initFields() {\n ColorPalette$Diverging_initFields = function () {\n };\n ColorPalette$Diverging$BrBG_instance = new ColorPalette$Diverging('BrBG', 0, 'brown-blue/green', ColorSets_getInstance().BR_BG);\n ColorPalette$Diverging$PiYG_instance = new ColorPalette$Diverging('PiYG', 1, 'pink-yellow/green', ColorSets_getInstance().PI_YG);\n ColorPalette$Diverging$PRGn_instance = new ColorPalette$Diverging('PRGn', 2, 'purple/red-green', ColorSets_getInstance().PR_GN);\n ColorPalette$Diverging$PuOr_instance = new ColorPalette$Diverging('PuOr', 3, 'purple-orange', ColorSets_getInstance().PU_OR);\n ColorPalette$Diverging$RdBu_instance = new ColorPalette$Diverging('RdBu', 4, 'red-blue', ColorSets_getInstance().RD_BU);\n ColorPalette$Diverging$RdGy_instance = new ColorPalette$Diverging('RdGy', 5, 'red-grey', ColorSets_getInstance().RD_GY);\n ColorPalette$Diverging$RdYlBu_instance = new ColorPalette$Diverging('RdYlBu', 6, 'red-yellow-blue', ColorSets_getInstance().RD_YL_BU);\n ColorPalette$Diverging$RdYlGn_instance = new ColorPalette$Diverging('RdYlGn', 7, 'red-yellow-green', ColorSets_getInstance().RD_YL_GN);\n ColorPalette$Diverging$Spectral_instance = new ColorPalette$Diverging('Spectral', 8, 'spectral', ColorSets_getInstance().SPECTRAL);\n }\n Object.defineProperty(ColorPalette$Diverging.prototype, 'colorSet', {\n get: function () {\n return this.colorSet_las6nb$_0;\n }\n });\n var ColorPalette$Diverging$BrBG_instance;\n function ColorPalette$Diverging$BrBG_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$BrBG_instance;\n }\n var ColorPalette$Diverging$PiYG_instance;\n function ColorPalette$Diverging$PiYG_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$PiYG_instance;\n }\n var ColorPalette$Diverging$PRGn_instance;\n function ColorPalette$Diverging$PRGn_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$PRGn_instance;\n }\n var ColorPalette$Diverging$PuOr_instance;\n function ColorPalette$Diverging$PuOr_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$PuOr_instance;\n }\n var ColorPalette$Diverging$RdBu_instance;\n function ColorPalette$Diverging$RdBu_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$RdBu_instance;\n }\n var ColorPalette$Diverging$RdGy_instance;\n function ColorPalette$Diverging$RdGy_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$RdGy_instance;\n }\n var ColorPalette$Diverging$RdYlBu_instance;\n function ColorPalette$Diverging$RdYlBu_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$RdYlBu_instance;\n }\n var ColorPalette$Diverging$RdYlGn_instance;\n function ColorPalette$Diverging$RdYlGn_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$RdYlGn_instance;\n }\n var ColorPalette$Diverging$Spectral_instance;\n function ColorPalette$Diverging$Spectral_getInstance() {\n ColorPalette$Diverging_initFields();\n return ColorPalette$Diverging$Spectral_instance;\n }\n Object.defineProperty(ColorPalette$Diverging.prototype, 'type', {\n configurable: true,\n get: function () {\n return ColorPalette$Type$DIVERGING_getInstance();\n }\n });\n Object.defineProperty(ColorPalette$Diverging.prototype, 'maxColors', {\n configurable: true,\n get: function () {\n return ColorPalette_getInstance().maxColorSetSize_0(this);\n }\n });\n ColorPalette$Diverging.prototype.getColors_za3lpa$ = function (count) {\n return ColorPalette_getInstance().colors_0(this, count);\n };\n ColorPalette$Diverging.prototype.toString = function () {\n return this.myPresentation_im16qo$_0;\n };\n ColorPalette$Diverging.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Diverging',\n interfaces: [ColorScheme, Enum]\n };\n function ColorPalette$Diverging$values() {\n return [ColorPalette$Diverging$BrBG_getInstance(), ColorPalette$Diverging$PiYG_getInstance(), ColorPalette$Diverging$PRGn_getInstance(), ColorPalette$Diverging$PuOr_getInstance(), ColorPalette$Diverging$RdBu_getInstance(), ColorPalette$Diverging$RdGy_getInstance(), ColorPalette$Diverging$RdYlBu_getInstance(), ColorPalette$Diverging$RdYlGn_getInstance(), ColorPalette$Diverging$Spectral_getInstance()];\n }\n ColorPalette$Diverging.values = ColorPalette$Diverging$values;\n function ColorPalette$Diverging$valueOf(name) {\n switch (name) {\n case 'BrBG':\n return ColorPalette$Diverging$BrBG_getInstance();\n case 'PiYG':\n return ColorPalette$Diverging$PiYG_getInstance();\n case 'PRGn':\n return ColorPalette$Diverging$PRGn_getInstance();\n case 'PuOr':\n return ColorPalette$Diverging$PuOr_getInstance();\n case 'RdBu':\n return ColorPalette$Diverging$RdBu_getInstance();\n case 'RdGy':\n return ColorPalette$Diverging$RdGy_getInstance();\n case 'RdYlBu':\n return ColorPalette$Diverging$RdYlBu_getInstance();\n case 'RdYlGn':\n return ColorPalette$Diverging$RdYlGn_getInstance();\n case 'Spectral':\n return ColorPalette$Diverging$Spectral_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Diverging.' + name);\n }\n }\n ColorPalette$Diverging.valueOf_61zpoe$ = ColorPalette$Diverging$valueOf;\n function ColorPalette$Qualitative(name, ordinal, myPresentation, colorSet) {\n Enum.call(this);\n this.myPresentation_av4sq6$_0 = myPresentation;\n this.colorSet_cgz7kp$_0 = colorSet;\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function ColorPalette$Qualitative_initFields() {\n ColorPalette$Qualitative_initFields = function () {\n };\n ColorPalette$Qualitative$Accent_instance = new ColorPalette$Qualitative('Accent', 0, 'accent', ColorSets_getInstance().ACCENT);\n ColorPalette$Qualitative$Dark2_instance = new ColorPalette$Qualitative('Dark2', 1, 'dark 2', ColorSets_getInstance().DARK_2);\n ColorPalette$Qualitative$Paired_instance = new ColorPalette$Qualitative('Paired', 2, 'paired', ColorSets_getInstance().PAIRED);\n ColorPalette$Qualitative$Pastel1_instance = new ColorPalette$Qualitative('Pastel1', 3, 'pastel 1', ColorSets_getInstance().PASTEL_1);\n ColorPalette$Qualitative$Pastel2_instance = new ColorPalette$Qualitative('Pastel2', 4, 'pastel 2', ColorSets_getInstance().PASTEL_2);\n ColorPalette$Qualitative$Set1_instance = new ColorPalette$Qualitative('Set1', 5, 'set 1', ColorSets_getInstance().SET_1);\n ColorPalette$Qualitative$Set2_instance = new ColorPalette$Qualitative('Set2', 6, 'set 2', ColorSets_getInstance().SET_2);\n ColorPalette$Qualitative$Set3_instance = new ColorPalette$Qualitative('Set3', 7, 'set 3', ColorSets_getInstance().SET_3);\n }\n Object.defineProperty(ColorPalette$Qualitative.prototype, 'colorSet', {\n get: function () {\n return this.colorSet_cgz7kp$_0;\n }\n });\n var ColorPalette$Qualitative$Accent_instance;\n function ColorPalette$Qualitative$Accent_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Accent_instance;\n }\n var ColorPalette$Qualitative$Dark2_instance;\n function ColorPalette$Qualitative$Dark2_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Dark2_instance;\n }\n var ColorPalette$Qualitative$Paired_instance;\n function ColorPalette$Qualitative$Paired_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Paired_instance;\n }\n var ColorPalette$Qualitative$Pastel1_instance;\n function ColorPalette$Qualitative$Pastel1_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Pastel1_instance;\n }\n var ColorPalette$Qualitative$Pastel2_instance;\n function ColorPalette$Qualitative$Pastel2_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Pastel2_instance;\n }\n var ColorPalette$Qualitative$Set1_instance;\n function ColorPalette$Qualitative$Set1_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Set1_instance;\n }\n var ColorPalette$Qualitative$Set2_instance;\n function ColorPalette$Qualitative$Set2_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Set2_instance;\n }\n var ColorPalette$Qualitative$Set3_instance;\n function ColorPalette$Qualitative$Set3_getInstance() {\n ColorPalette$Qualitative_initFields();\n return ColorPalette$Qualitative$Set3_instance;\n }\n Object.defineProperty(ColorPalette$Qualitative.prototype, 'type', {\n configurable: true,\n get: function () {\n return ColorPalette$Type$QUALITATIVE_getInstance();\n }\n });\n Object.defineProperty(ColorPalette$Qualitative.prototype, 'maxColors', {\n configurable: true,\n get: function () {\n return ColorPalette_getInstance().maxColorSetSize_0(this);\n }\n });\n ColorPalette$Qualitative.prototype.getColors_za3lpa$ = function (count) {\n return ColorPalette_getInstance().colors_0(this, count);\n };\n ColorPalette$Qualitative.prototype.toString = function () {\n return this.myPresentation_av4sq6$_0;\n };\n ColorPalette$Qualitative.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Qualitative',\n interfaces: [ColorScheme, Enum]\n };\n function ColorPalette$Qualitative$values() {\n return [ColorPalette$Qualitative$Accent_getInstance(), ColorPalette$Qualitative$Dark2_getInstance(), ColorPalette$Qualitative$Paired_getInstance(), ColorPalette$Qualitative$Pastel1_getInstance(), ColorPalette$Qualitative$Pastel2_getInstance(), ColorPalette$Qualitative$Set1_getInstance(), ColorPalette$Qualitative$Set2_getInstance(), ColorPalette$Qualitative$Set3_getInstance()];\n }\n ColorPalette$Qualitative.values = ColorPalette$Qualitative$values;\n function ColorPalette$Qualitative$valueOf(name) {\n switch (name) {\n case 'Accent':\n return ColorPalette$Qualitative$Accent_getInstance();\n case 'Dark2':\n return ColorPalette$Qualitative$Dark2_getInstance();\n case 'Paired':\n return ColorPalette$Qualitative$Paired_getInstance();\n case 'Pastel1':\n return ColorPalette$Qualitative$Pastel1_getInstance();\n case 'Pastel2':\n return ColorPalette$Qualitative$Pastel2_getInstance();\n case 'Set1':\n return ColorPalette$Qualitative$Set1_getInstance();\n case 'Set2':\n return ColorPalette$Qualitative$Set2_getInstance();\n case 'Set3':\n return ColorPalette$Qualitative$Set3_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Qualitative.' + name);\n }\n }\n ColorPalette$Qualitative.valueOf_61zpoe$ = ColorPalette$Qualitative$valueOf;\n ColorPalette.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ColorPalette',\n interfaces: []\n };\n var ColorPalette_instance = null;\n function ColorPalette_getInstance() {\n if (ColorPalette_instance === null) {\n new ColorPalette();\n }return ColorPalette_instance;\n }\n function ColorScheme() {\n }\n ColorScheme.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'ColorScheme',\n interfaces: []\n };\n function ColorSets() {\n ColorSets_instance = this;\n this.BU_GN_3 = ['#e5f5f9', '#99d8c9', '#2ca25f'];\n this.BU_GN_4 = ['#edf8fb', '#b2e2e2', '#66c2a4', '#238b45'];\n this.BU_GN_5 = ['#edf8fb', '#b2e2e2', '#66c2a4', '#2ca25f', '#006d2c'];\n this.BU_GN_6 = ['#edf8fb', '#ccece6', '#99d8c9', '#66c2a4', '#2ca25f', '#006d2c'];\n this.BU_GN_7 = ['#edf8fb', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#005824'];\n this.BU_GN_8 = ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#005824'];\n this.BU_GN_9 = ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'];\n this.BU_PU_3 = ['#e0ecf4', '#9ebcda', '#8856a7'];\n this.BU_PU_4 = ['#edf8fb', '#b3cde3', '#8c96c6', '#88419d'];\n this.BU_PU_5 = ['#edf8fb', '#b3cde3', '#8c96c6', '#8856a7', '#810f7c'];\n this.BU_PU_6 = ['#edf8fb', '#bfd3e6', '#9ebcda', '#8c96c6', '#8856a7', '#810f7c'];\n this.BU_PU_7 = ['#edf8fb', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#6e016b'];\n this.BU_PU_8 = ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#6e016b'];\n this.BU_PU_9 = ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'];\n this.GN_BU_3 = ['#e0f3db', '#a8ddb5', '#43a2ca'];\n this.GN_BU_4 = ['#f0f9e8', '#bae4bc', '#7bccc4', '#2b8cbe'];\n this.GN_BU_5 = ['#f0f9e8', '#bae4bc', '#7bccc4', '#43a2ca', '#0868ac'];\n this.GN_BU_6 = ['#f0f9e8', '#ccebc5', '#a8ddb5', '#7bccc4', '#43a2ca', '#0868ac'];\n this.GN_BU_7 = ['#f0f9e8', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e'];\n this.GN_BU_8 = ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e'];\n this.GN_BU_9 = ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'];\n this.OR_RD_3 = ['#fee8c8', '#fdbb84', '#e34a33'];\n this.OR_RD_4 = ['#fef0d9', '#fdcc8a', '#fc8d59', '#d7301f'];\n this.OR_RD_5 = ['#fef0d9', '#fdcc8a', '#fc8d59', '#e34a33', '#b30000'];\n this.OR_RD_6 = ['#fef0d9', '#fdd49e', '#fdbb84', '#fc8d59', '#e34a33', '#b30000'];\n this.OR_RD_7 = ['#fef0d9', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#990000'];\n this.OR_RD_8 = ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#990000'];\n this.OR_RD_9 = ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'];\n this.PU_BU_3 = ['#ece7f2', '#a6bddb', '#2b8cbe'];\n this.PU_BU_4 = ['#f1eef6', '#bdc9e1', '#74a9cf', '#0570b0'];\n this.PU_BU_5 = ['#f1eef6', '#bdc9e1', '#74a9cf', '#2b8cbe', '#045a8d'];\n this.PU_BU_6 = ['#f1eef6', '#d0d1e6', '#a6bddb', '#74a9cf', '#2b8cbe', '#045a8d'];\n this.PU_BU_7 = ['#f1eef6', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b'];\n this.PU_BU_8 = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b'];\n this.PU_BU_9 = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'];\n this.PU_BU_GN_3 = ['#ece2f0', '#a6bddb', '#1c9099'];\n this.PU_BU_GN_4 = ['#f6eff7', '#bdc9e1', '#67a9cf', '#02818a'];\n this.PU_BU_GN_5 = ['#f6eff7', '#bdc9e1', '#67a9cf', '#1c9099', '#016c59'];\n this.PU_BU_GN_6 = ['#f6eff7', '#d0d1e6', '#a6bddb', '#67a9cf', '#1c9099', '#016c59'];\n this.PU_BU_GN_7 = ['#f6eff7', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016450'];\n this.PU_BU_GN_8 = ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016450'];\n this.PU_BU_GN_9 = ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'];\n this.PU_RD_3 = ['#e7e1ef', '#c994c7', '#dd1c77'];\n this.PU_RD_4 = ['#f1eef6', '#d7b5d8', '#df65b0', '#ce1256'];\n this.PU_RD_5 = ['#f1eef6', '#d7b5d8', '#df65b0', '#dd1c77', '#980043'];\n this.PU_RD_6 = ['#f1eef6', '#d4b9da', '#c994c7', '#df65b0', '#dd1c77', '#980043'];\n this.PU_RD_7 = ['#f1eef6', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#91003f'];\n this.PU_RD_8 = ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#91003f'];\n this.PU_RD_9 = ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'];\n this.RD_PU_3 = ['#fde0dd', '#fa9fb5', '#c51b8a'];\n this.RD_PU_4 = ['#feebe2', '#fbb4b9', '#f768a1', '#ae017e'];\n this.RD_PU_5 = ['#feebe2', '#fbb4b9', '#f768a1', '#c51b8a', '#7a0177'];\n this.RD_PU_6 = ['#feebe2', '#fcc5c0', '#fa9fb5', '#f768a1', '#c51b8a', '#7a0177'];\n this.RD_PU_7 = ['#feebe2', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177'];\n this.RD_PU_8 = ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177'];\n this.RD_PU_9 = ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'];\n this.YL_GN_3 = ['#f7fcb9', '#addd8e', '#31a354'];\n this.YL_GN_4 = ['#ffffcc', '#c2e699', '#78c679', '#238443'];\n this.YL_GN_5 = ['#ffffcc', '#c2e699', '#78c679', '#31a354', '#006837'];\n this.YL_GN_6 = ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#31a354', '#006837'];\n this.YL_GN_7 = ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'];\n this.YL_GN_8 = ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'];\n this.YL_GN_9 = ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'];\n this.YL_GN_BU_3 = ['#edf8b1', '#7fcdbb', '#2c7fb8'];\n this.YL_GN_BU_4 = ['#ffffcc', '#a1dab4', '#41b6c4', '#225ea8'];\n this.YL_GN_BU_5 = ['#ffffcc', '#a1dab4', '#41b6c4', '#2c7fb8', '#253494'];\n this.YL_GN_BU_6 = ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#2c7fb8', '#253494'];\n this.YL_GN_BU_7 = ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'];\n this.YL_GN_BU_8 = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'];\n this.YL_GN_BU_9 = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'];\n this.YL_OR_BR_3 = ['#fff7bc', '#fec44f', '#d95f0e'];\n this.YL_OR_BR_4 = ['#ffffd4', '#fed98e', '#fe9929', '#cc4c02'];\n this.YL_OR_BR_5 = ['#ffffd4', '#fed98e', '#fe9929', '#d95f0e', '#993404'];\n this.YL_OR_BR_6 = ['#ffffd4', '#fee391', '#fec44f', '#fe9929', '#d95f0e', '#993404'];\n this.YL_OR_BR_7 = ['#ffffd4', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#8c2d04'];\n this.YL_OR_BR_8 = ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#8c2d04'];\n this.YL_OR_BR_9 = ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'];\n this.YL_OR_RD_3 = ['#ffeda0', '#feb24c', '#f03b20'];\n this.YL_OR_RD_4 = ['#ffffb2', '#fecc5c', '#fd8d3c', '#e31a1c'];\n this.YL_OR_RD_5 = ['#ffffb2', '#fecc5c', '#fd8d3c', '#f03b20', '#bd0026'];\n this.YL_OR_RD_6 = ['#ffffb2', '#fed976', '#feb24c', '#fd8d3c', '#f03b20', '#bd0026'];\n this.YL_OR_RD_7 = ['#ffffb2', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#b10026'];\n this.YL_OR_RD_8 = ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#b10026'];\n this.YL_OR_RD_9 = ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'];\n this.BU_GN = [this.BU_GN_3, this.BU_GN_4, this.BU_GN_5, this.BU_GN_6, this.BU_GN_7, this.BU_GN_8, this.BU_GN_9];\n this.BU_PU = [this.BU_PU_3, this.BU_PU_4, this.BU_PU_5, this.BU_PU_6, this.BU_PU_7, this.BU_PU_8, this.BU_PU_9];\n this.GN_BU = [this.GN_BU_3, this.GN_BU_4, this.GN_BU_5, this.GN_BU_6, this.GN_BU_7, this.GN_BU_8, this.GN_BU_9];\n this.OR_RD = [this.OR_RD_3, this.OR_RD_4, this.OR_RD_5, this.OR_RD_6, this.OR_RD_7, this.OR_RD_8, this.OR_RD_9];\n this.PU_BU = [this.PU_BU_3, this.PU_BU_4, this.PU_BU_5, this.PU_BU_6, this.PU_BU_7, this.PU_BU_8, this.PU_BU_9];\n this.PU_BU_GN = [this.PU_BU_GN_3, this.PU_BU_GN_4, this.PU_BU_GN_5, this.PU_BU_GN_6, this.PU_BU_GN_7, this.PU_BU_GN_8, this.PU_BU_GN_9];\n this.PU_RD = [this.PU_RD_3, this.PU_RD_4, this.PU_RD_5, this.PU_RD_6, this.PU_RD_7, this.PU_RD_8, this.PU_RD_9];\n this.RD_PU = [this.RD_PU_3, this.RD_PU_4, this.RD_PU_5, this.RD_PU_6, this.RD_PU_7, this.RD_PU_8, this.RD_PU_9];\n this.YL_GN = [this.YL_GN_3, this.YL_GN_4, this.YL_GN_5, this.YL_GN_6, this.YL_GN_7, this.YL_GN_8, this.YL_GN_9];\n this.YL_GN_BU = [this.YL_GN_BU_3, this.YL_GN_BU_4, this.YL_GN_BU_5, this.YL_GN_BU_6, this.YL_GN_BU_7, this.YL_GN_BU_8, this.YL_GN_BU_9];\n this.YL_OR_BR = [this.YL_OR_BR_3, this.YL_OR_BR_4, this.YL_OR_BR_5, this.YL_OR_BR_6, this.YL_OR_BR_7, this.YL_OR_BR_8, this.YL_OR_BR_9];\n this.YL_OR_RD = [this.YL_OR_RD_3, this.YL_OR_RD_4, this.YL_OR_RD_5, this.YL_OR_RD_6, this.YL_OR_RD_7, this.YL_OR_RD_8, this.YL_OR_RD_9];\n this.BLUES_3 = ['#deebf7', '#9ecae1', '#3182bd'];\n this.BLUES_4 = ['#eff3ff', '#bdd7e7', '#6baed6', '#2171b5'];\n this.BLUES_5 = ['#eff3ff', '#bdd7e7', '#6baed6', '#3182bd', '#08519c'];\n this.BLUES_6 = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#3182bd', '#08519c'];\n this.BLUES_7 = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'];\n this.BLUES_8 = ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'];\n this.BLUES_9 = ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'];\n this.GREENS_3 = ['#e5f5e0', '#a1d99b', '#31a354'];\n this.GREENS_4 = ['#edf8e9', '#bae4b3', '#74c476', '#238b45'];\n this.GREENS_5 = ['#edf8e9', '#bae4b3', '#74c476', '#31a354', '#006d2c'];\n this.GREENS_6 = ['#edf8e9', '#c7e9c0', '#a1d99b', '#74c476', '#31a354', '#006d2c'];\n this.GREENS_7 = ['#edf8e9', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#005a32'];\n this.GREENS_8 = ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#005a32'];\n this.GREENS_9 = ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'];\n this.GREYS_3 = ['#f0f0f0', '#bdbdbd', '#636363'];\n this.GREYS_4 = ['#f7f7f7', '#cccccc', '#969696', '#525252'];\n this.GREYS_5 = ['#f7f7f7', '#cccccc', '#969696', '#636363', '#252525'];\n this.GREYS_6 = ['#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696', '#636363', '#252525'];\n this.GREYS_7 = ['#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525'];\n this.GREYS_8 = ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525'];\n this.GREYS_9 = ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'];\n this.ORANGES_3 = ['#fee6ce', '#fdae6b', '#e6550d'];\n this.ORANGES_4 = ['#feedde', '#fdbe85', '#fd8d3c', '#d94701'];\n this.ORANGES_5 = ['#feedde', '#fdbe85', '#fd8d3c', '#e6550d', '#a63603'];\n this.ORANGES_6 = ['#feedde', '#fdd0a2', '#fdae6b', '#fd8d3c', '#e6550d', '#a63603'];\n this.ORANGES_7 = ['#feedde', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#8c2d04'];\n this.ORANGES_8 = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#8c2d04'];\n this.ORANGES_9 = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'];\n this.PURPLES_3 = ['#efedf5', '#bcbddc', '#756bb1'];\n this.PURPLES_4 = ['#f2f0f7', '#cbc9e2', '#9e9ac8', '#6a51a3'];\n this.PURPLES_5 = ['#f2f0f7', '#cbc9e2', '#9e9ac8', '#756bb1', '#54278f'];\n this.PURPLES_6 = ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#756bb1', '#54278f'];\n this.PURPLES_7 = ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#4a1486'];\n this.PURPLES_8 = ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#4a1486'];\n this.PURPLES_9 = ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'];\n this.REDS_3 = ['#fee0d2', '#fc9272', '#de2d26'];\n this.REDS_4 = ['#fee5d9', '#fcae91', '#fb6a4a', '#cb181d'];\n this.REDS_5 = ['#fee5d9', '#fcae91', '#fb6a4a', '#de2d26', '#a50f15'];\n this.REDS_6 = ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#de2d26', '#a50f15'];\n this.REDS_7 = ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#99000d'];\n this.REDS_8 = ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#99000d'];\n this.REDS_9 = ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'];\n this.BLUES = [this.BLUES_3, this.BLUES_4, this.BLUES_5, this.BLUES_6, this.BLUES_7, this.BLUES_8, this.BLUES_9];\n this.GREENS = [this.GREENS_3, this.GREENS_4, this.GREENS_5, this.GREENS_6, this.GREENS_7, this.GREENS_8, this.GREENS_9];\n this.GREYS = [this.GREYS_3, this.GREYS_4, this.GREYS_5, this.GREYS_6, this.GREYS_7, this.GREYS_8, this.GREYS_9];\n this.ORANGES = [this.ORANGES_3, this.ORANGES_4, this.ORANGES_5, this.ORANGES_6, this.ORANGES_7, this.ORANGES_8, this.ORANGES_9];\n this.PURPLES = [this.PURPLES_3, this.PURPLES_4, this.PURPLES_5, this.PURPLES_6, this.PURPLES_7, this.PURPLES_8, this.PURPLES_9];\n this.REDS = [this.REDS_3, this.REDS_4, this.REDS_5, this.REDS_6, this.REDS_7, this.REDS_8, this.REDS_9];\n this.BR_BG_3 = ['#d8b365', '#f5f5f5', '#5ab4ac'];\n this.BR_BG_4 = ['#a6611a', '#dfc27d', '#80cdc1', '#018571'];\n this.BR_BG_5 = ['#a6611a', '#dfc27d', '#f5f5f5', '#80cdc1', '#018571'];\n this.BR_BG_6 = ['#8c510a', '#d8b365', '#f6e8c3', '#c7eae5', '#5ab4ac', '#01665e'];\n this.BR_BG_7 = ['#8c510a', '#d8b365', '#f6e8c3', '#f5f5f5', '#c7eae5', '#5ab4ac', '#01665e'];\n this.BR_BG_8 = ['#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#c7eae5', '#80cdc1', '#35978f', '#01665e'];\n this.BR_BG_9 = ['#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e'];\n this.BR_BG_10 = ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'];\n this.BR_BG_11 = ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'];\n this.PI_YG_3 = ['#e9a3c9', '#f7f7f7', '#a1d76a'];\n this.PI_YG_4 = ['#d01c8b', '#f1b6da', '#b8e186', '#4dac26'];\n this.PI_YG_5 = ['#d01c8b', '#f1b6da', '#f7f7f7', '#b8e186', '#4dac26'];\n this.PI_YG_6 = ['#c51b7d', '#e9a3c9', '#fde0ef', '#e6f5d0', '#a1d76a', '#4d9221'];\n this.PI_YG_7 = ['#c51b7d', '#e9a3c9', '#fde0ef', '#f7f7f7', '#e6f5d0', '#a1d76a', '#4d9221'];\n this.PI_YG_8 = ['#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221'];\n this.PI_YG_9 = ['#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221'];\n this.PI_YG_10 = ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'];\n this.PI_YG_11 = ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'];\n this.PR_GN_3 = ['#af8dc3', '#f7f7f7', '#7fbf7b'];\n this.PR_GN_4 = ['#7b3294', '#c2a5cf', '#a6dba0', '#008837'];\n this.PR_GN_5 = ['#7b3294', '#c2a5cf', '#f7f7f7', '#a6dba0', '#008837'];\n this.PR_GN_6 = ['#762a83', '#af8dc3', '#e7d4e8', '#d9f0d3', '#7fbf7b', '#1b7837'];\n this.PR_GN_7 = ['#762a83', '#af8dc3', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#7fbf7b', '#1b7837'];\n this.PR_GN_8 = ['#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837'];\n this.PR_GN_9 = ['#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837'];\n this.PR_GN_10 = ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'];\n this.PR_GN_11 = ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'];\n this.PU_OR_3 = ['#f1a340', '#f7f7f7', '#998ec3'];\n this.PU_OR_4 = ['#e66101', '#fdb863', '#b2abd2', '#5e3c99'];\n this.PU_OR_5 = ['#e66101', '#fdb863', '#f7f7f7', '#b2abd2', '#5e3c99'];\n this.PU_OR_6 = ['#b35806', '#f1a340', '#fee0b6', '#d8daeb', '#998ec3', '#542788'];\n this.PU_OR_7 = ['#b35806', '#f1a340', '#fee0b6', '#f7f7f7', '#d8daeb', '#998ec3', '#542788'];\n this.PU_OR_8 = ['#b35806', '#e08214', '#fdb863', '#fee0b6', '#d8daeb', '#b2abd2', '#8073ac', '#542788'];\n this.PU_OR_9 = ['#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788'];\n this.PU_OR_10 = ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'];\n this.PU_OR_11 = ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'];\n this.RD_BU_3 = ['#ef8a62', '#f7f7f7', '#67a9cf'];\n this.RD_BU_4 = ['#ca0020', '#f4a582', '#92c5de', '#0571b0'];\n this.RD_BU_5 = ['#ca0020', '#f4a582', '#f7f7f7', '#92c5de', '#0571b0'];\n this.RD_BU_6 = ['#b2182b', '#ef8a62', '#fddbc7', '#d1e5f0', '#67a9cf', '#2166ac'];\n this.RD_BU_7 = ['#b2182b', '#ef8a62', '#fddbc7', '#f7f7f7', '#d1e5f0', '#67a9cf', '#2166ac'];\n this.RD_BU_8 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac'];\n this.RD_BU_9 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac'];\n this.RD_BU_10 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'];\n this.RD_BU_11 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'];\n this.RD_GY_3 = ['#ef8a62', '#ffffff', '#999999'];\n this.RD_GY_4 = ['#ca0020', '#f4a582', '#bababa', '#404040'];\n this.RD_GY_5 = ['#ca0020', '#f4a582', '#ffffff', '#bababa', '#404040'];\n this.RD_GY_6 = ['#b2182b', '#ef8a62', '#fddbc7', '#e0e0e0', '#999999', '#4d4d4d'];\n this.RD_GY_7 = ['#b2182b', '#ef8a62', '#fddbc7', '#ffffff', '#e0e0e0', '#999999', '#4d4d4d'];\n this.RD_GY_8 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#e0e0e0', '#bababa', '#878787', '#4d4d4d'];\n this.RD_GY_9 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d'];\n this.RD_GY_10 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'];\n this.RD_GY_11 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'];\n this.RD_YL_BU_3 = ['#fc8d59', '#ffffbf', '#91bfdb'];\n this.RD_YL_BU_4 = ['#d7191c', '#fdae61', '#abd9e9', '#2c7bb6'];\n this.RD_YL_BU_5 = ['#d7191c', '#fdae61', '#ffffbf', '#abd9e9', '#2c7bb6'];\n this.RD_YL_BU_6 = ['#d73027', '#fc8d59', '#fee090', '#e0f3f8', '#91bfdb', '#4575b4'];\n this.RD_YL_BU_7 = ['#d73027', '#fc8d59', '#fee090', '#ffffbf', '#e0f3f8', '#91bfdb', '#4575b4'];\n this.RD_YL_BU_8 = ['#d73027', '#f46d43', '#fdae61', '#fee090', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4'];\n this.RD_YL_BU_9 = ['#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4'];\n this.RD_YL_BU_10 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'];\n this.RD_YL_BU_11 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'];\n this.RD_YL_GN_3 = ['#fc8d59', '#ffffbf', '#91cf60'];\n this.RD_YL_GN_4 = ['#d7191c', '#fdae61', '#a6d96a', '#1a9641'];\n this.RD_YL_GN_5 = ['#d7191c', '#fdae61', '#ffffbf', '#a6d96a', '#1a9641'];\n this.RD_YL_GN_6 = ['#d73027', '#fc8d59', '#fee08b', '#d9ef8b', '#91cf60', '#1a9850'];\n this.RD_YL_GN_7 = ['#d73027', '#fc8d59', '#fee08b', '#ffffbf', '#d9ef8b', '#91cf60', '#1a9850'];\n this.RD_YL_GN_8 = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'];\n this.RD_YL_GN_9 = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'];\n this.RD_YL_GN_10 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'];\n this.RD_YL_GN_11 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'];\n this.SPECTRAL_3 = ['#fc8d59', '#ffffbf', '#99d594'];\n this.SPECTRAL_4 = ['#d7191c', '#fdae61', '#abdda4', '#2b83ba'];\n this.SPECTRAL_5 = ['#d7191c', '#fdae61', '#ffffbf', '#abdda4', '#2b83ba'];\n this.SPECTRAL_6 = ['#d53e4f', '#fc8d59', '#fee08b', '#e6f598', '#99d594', '#3288bd'];\n this.SPECTRAL_7 = ['#d53e4f', '#fc8d59', '#fee08b', '#ffffbf', '#e6f598', '#99d594', '#3288bd'];\n this.SPECTRAL_8 = ['#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#e6f598', '#abdda4', '#66c2a5', '#3288bd'];\n this.SPECTRAL_9 = ['#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd'];\n this.SPECTRAL_10 = ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'];\n this.SPECTRAL_11 = ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'];\n this.BR_BG = [this.BR_BG_3, this.BR_BG_4, this.BR_BG_5, this.BR_BG_6, this.BR_BG_7, this.BR_BG_8, this.BR_BG_9, this.BR_BG_10, this.BR_BG_11];\n this.PI_YG = [this.PI_YG_3, this.PI_YG_4, this.PI_YG_5, this.PI_YG_6, this.PI_YG_7, this.PI_YG_8, this.PI_YG_9, this.PI_YG_10, this.PI_YG_11];\n this.PR_GN = [this.PR_GN_3, this.PR_GN_4, this.PR_GN_5, this.PR_GN_6, this.PR_GN_7, this.PR_GN_8, this.PR_GN_9, this.PR_GN_10, this.PR_GN_11];\n this.PU_OR = [this.PU_OR_3, this.PU_OR_4, this.PU_OR_5, this.PU_OR_6, this.PU_OR_7, this.PU_OR_8, this.PU_OR_9, this.PU_OR_10, this.PU_OR_11];\n this.RD_BU = [this.RD_BU_3, this.RD_BU_4, this.RD_BU_5, this.RD_BU_6, this.RD_BU_7, this.RD_BU_8, this.RD_BU_9, this.RD_BU_10, this.RD_BU_11];\n this.RD_GY = [this.RD_GY_3, this.RD_GY_4, this.RD_GY_5, this.RD_GY_6, this.RD_GY_7, this.RD_GY_8, this.RD_GY_9, this.RD_GY_10, this.RD_GY_11];\n this.RD_YL_BU = [this.RD_YL_BU_3, this.RD_YL_BU_4, this.RD_YL_BU_5, this.RD_YL_BU_6, this.RD_YL_BU_7, this.RD_YL_BU_8, this.RD_YL_BU_9, this.RD_YL_BU_10, this.RD_YL_BU_11];\n this.RD_YL_GN = [this.RD_YL_GN_3, this.RD_YL_GN_4, this.RD_YL_GN_5, this.RD_YL_GN_6, this.RD_YL_GN_7, this.RD_YL_GN_8, this.RD_YL_GN_9, this.RD_YL_GN_10, this.RD_YL_GN_11];\n this.SPECTRAL = [this.SPECTRAL_3, this.SPECTRAL_4, this.SPECTRAL_5, this.SPECTRAL_6, this.SPECTRAL_7, this.SPECTRAL_8, this.SPECTRAL_9, this.SPECTRAL_10, this.SPECTRAL_11];\n this.ACCENT_3 = ['#7fc97f', '#beaed4', '#fdc086'];\n this.ACCENT_4 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99'];\n this.ACCENT_5 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0'];\n this.ACCENT_6 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f'];\n this.ACCENT_7 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17'];\n this.ACCENT_8 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'];\n this.DARK_2_3 = ['#1b9e77', '#d95f02', '#7570b3'];\n this.DARK_2_4 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a'];\n this.DARK_2_5 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e'];\n this.DARK_2_6 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02'];\n this.DARK_2_7 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d'];\n this.DARK_2_8 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'];\n this.PAIRED_3 = ['#a6cee3', '#1f78b4', '#b2df8a'];\n this.PAIRED_4 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c'];\n this.PAIRED_5 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99'];\n this.PAIRED_6 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c'];\n this.PAIRED_7 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f'];\n this.PAIRED_8 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00'];\n this.PAIRED_9 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6'];\n this.PAIRED_10 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a'];\n this.PAIRED_11 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99'];\n this.PAIRED_12 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'];\n this.PASTEL_1_3 = ['#fbb4ae', '#b3cde3', '#ccebc5'];\n this.PASTEL_1_4 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4'];\n this.PASTEL_1_5 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6'];\n this.PASTEL_1_6 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc'];\n this.PASTEL_1_7 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd'];\n this.PASTEL_1_8 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec'];\n this.PASTEL_1_9 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2'];\n this.PASTEL_2_3 = ['#b3e2cd', '#fdcdac', '#cbd5e8'];\n this.PASTEL_2_4 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4'];\n this.PASTEL_2_5 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9'];\n this.PASTEL_2_6 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae'];\n this.PASTEL_2_7 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc'];\n this.PASTEL_2_8 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'];\n this.SET_1_3 = ['#e41a1c', '#377eb8', '#4daf4a'];\n this.SET_1_4 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3'];\n this.SET_1_5 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00'];\n this.SET_1_6 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33'];\n this.SET_1_7 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628'];\n this.SET_1_8 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf'];\n this.SET_1_9 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'];\n this.SET_2_3 = ['#66c2a5', '#fc8d62', '#8da0cb'];\n this.SET_2_4 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3'];\n this.SET_2_5 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854'];\n this.SET_2_6 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f'];\n this.SET_2_7 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494'];\n this.SET_2_8 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'];\n this.SET_3_3 = ['#8dd3c7', '#ffffb3', '#bebada'];\n this.SET_3_4 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072'];\n this.SET_3_5 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3'];\n this.SET_3_6 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462'];\n this.SET_3_7 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69'];\n this.SET_3_8 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5'];\n this.SET_3_9 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9'];\n this.SET_3_10 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd'];\n this.SET_3_11 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5'];\n this.SET_3_12 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'];\n this.ACCENT = [this.ACCENT_3, this.ACCENT_4, this.ACCENT_5, this.ACCENT_6, this.ACCENT_7, this.ACCENT_8];\n this.DARK_2 = [this.DARK_2_3, this.DARK_2_4, this.DARK_2_5, this.DARK_2_6, this.DARK_2_7, this.DARK_2_8];\n this.PAIRED = [this.PAIRED_3, this.PAIRED_4, this.PAIRED_5, this.PAIRED_6, this.PAIRED_7, this.PAIRED_8, this.PAIRED_9, this.PAIRED_10, this.PAIRED_11, this.PAIRED_12];\n this.PASTEL_1 = [this.PASTEL_1_3, this.PASTEL_1_4, this.PASTEL_1_5, this.PASTEL_1_6, this.PASTEL_1_7, this.PASTEL_1_8, this.PASTEL_1_9];\n this.PASTEL_2 = [this.PASTEL_2_3, this.PASTEL_2_4, this.PASTEL_2_5, this.PASTEL_2_6, this.PASTEL_2_7, this.PASTEL_2_8];\n this.SET_1 = [this.SET_1_3, this.SET_1_4, this.SET_1_5, this.SET_1_6, this.SET_1_7, this.SET_1_8, this.SET_1_9];\n this.SET_2 = [this.SET_2_3, this.SET_2_4, this.SET_2_5, this.SET_2_6, this.SET_2_7, this.SET_2_8];\n this.SET_3 = [this.SET_3_3, this.SET_3_4, this.SET_3_5, this.SET_3_6, this.SET_3_7, this.SET_3_8, this.SET_3_9, this.SET_3_10, this.SET_3_11, this.SET_3_12];\n }\n ColorSets.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ColorSets',\n interfaces: []\n };\n var ColorSets_instance = null;\n function ColorSets_getInstance() {\n if (ColorSets_instance === null) {\n new ColorSets();\n }return ColorSets_instance;\n }\n function ColorUtil() {\n ColorUtil_instance = this;\n }\n ColorUtil.prototype.genColors_2c6x13$ = function (count, baseColors) {\n var tmp$;\n var rValues = ArrayList_init();\n var gValues = ArrayList_init();\n var bValues = ArrayList_init();\n tmp$ = baseColors.iterator();\n while (tmp$.hasNext()) {\n var baseColor = tmp$.next();\n rValues.add_11rb$(baseColor.red);\n gValues.add_11rb$(baseColor.green);\n bValues.add_11rb$(baseColor.blue);\n }\n var rChannelGen = new RGBChannelGen(rValues);\n var gChannelGen = new RGBChannelGen(gValues);\n var bChannelGen = new RGBChannelGen(bValues);\n var rValuesGen = rChannelGen.generate_za3lpa$(count).iterator();\n var gValuesGen = gChannelGen.generate_za3lpa$(count).iterator();\n var bValuesGen = bChannelGen.generate_za3lpa$(count).iterator();\n var colorsGen = ArrayList_init_0(count);\n while (rValuesGen.hasNext() && gValuesGen.hasNext() && bValuesGen.hasNext()) {\n var colorGen = new Color(rValuesGen.next(), gValuesGen.next(), bValuesGen.next());\n colorsGen.add_11rb$(colorGen);\n }\n return colorsGen;\n };\n ColorUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'ColorUtil',\n interfaces: []\n };\n var ColorUtil_instance = null;\n function ColorUtil_getInstance() {\n if (ColorUtil_instance === null) {\n new ColorUtil();\n }return ColorUtil_instance;\n }\n function PaletteUtil() {\n PaletteUtil_instance = this;\n this.NULL_COLOR = Color.Companion.LIGHT_GRAY;\n this.EXTENSIBLE_COLOR_SCHEMES_0 = setOf([ColorPalette$Qualitative$Accent_getInstance(), ColorPalette$Qualitative$Dark2_getInstance(), ColorPalette$Qualitative$Pastel1_getInstance(), ColorPalette$Qualitative$Pastel2_getInstance(), ColorPalette$Qualitative$Set1_getInstance(), ColorPalette$Qualitative$Set2_getInstance(), ColorPalette$Qualitative$Set3_getInstance()]);\n this.PAL_TYPE_BY_PAL_NAME_0 = null;\n var map = HashMap_init();\n var $receiver = ColorPalette$Sequential$values();\n var destination = ArrayList_init_0($receiver.length);\n var tmp$;\n for (tmp$ = 0; tmp$ !== $receiver.length; ++tmp$) {\n var item = $receiver[tmp$];\n destination.add_11rb$(item.name);\n }\n var tmp$_0;\n tmp$_0 = destination.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n var value = ColorPalette$Type$SEQUENTIAL_getInstance();\n map.put_xwzc9p$(element, value);\n }\n var $receiver_0 = ColorPalette$Diverging$values();\n var destination_0 = ArrayList_init_0($receiver_0.length);\n var tmp$_1;\n for (tmp$_1 = 0; tmp$_1 !== $receiver_0.length; ++tmp$_1) {\n var item_0 = $receiver_0[tmp$_1];\n destination_0.add_11rb$(item_0.name);\n }\n var tmp$_2;\n tmp$_2 = destination_0.iterator();\n while (tmp$_2.hasNext()) {\n var element_0 = tmp$_2.next();\n var value_0 = ColorPalette$Type$DIVERGING_getInstance();\n map.put_xwzc9p$(element_0, value_0);\n }\n var $receiver_1 = ColorPalette$Qualitative$values();\n var destination_1 = ArrayList_init_0($receiver_1.length);\n var tmp$_3;\n for (tmp$_3 = 0; tmp$_3 !== $receiver_1.length; ++tmp$_3) {\n var item_1 = $receiver_1[tmp$_3];\n destination_1.add_11rb$(item_1.name);\n }\n var tmp$_4;\n tmp$_4 = destination_1.iterator();\n while (tmp$_4.hasNext()) {\n var element_1 = tmp$_4.next();\n var value_1 = ColorPalette$Type$QUALITATIVE_getInstance();\n map.put_xwzc9p$(element_1, value_1);\n }\n this.PAL_TYPE_BY_PAL_NAME_0 = map;\n }\n PaletteUtil.prototype.isExtensibleScheme_0 = function (colorScheme) {\n return this.EXTENSIBLE_COLOR_SCHEMES_0.contains_11rb$(colorScheme);\n };\n PaletteUtil.prototype.schemeColors_7q5c77$ = function (colorScheme, colorCount) {\n var colorsHex = colorScheme.getColors_za3lpa$(colorCount);\n var colors = this.fromColorsHex_0(colorsHex);\n if (colorsHex.length < colorCount && this.isExtensibleScheme_0(colorScheme)) {\n var addColors = ColorUtil_getInstance().genColors_2c6x13$(colorCount - colorsHex.length | 0, colors);\n return collect.Iterables.toList_yl67zr$(collect.Iterables.concat_yxozss$(colors, addColors));\n }return colors;\n };\n PaletteUtil.prototype.fromColorsHex_0 = function (hexColors) {\n var tmp$;\n var colors = ArrayList_init();\n for (tmp$ = 0; tmp$ !== hexColors.length; ++tmp$) {\n var hexColor = hexColors[tmp$];\n try {\n colors.add_11rb$(Color.Companion.parseHex_61zpoe$(hexColor));\n } catch (e) {\n if (!Kotlin.isType(e, Exception))\n throw e;\n }\n }\n return colors;\n };\n PaletteUtil.prototype.paletteTypeByPaletteName_61zpoe$ = function (paletteName) {\n return this.PAL_TYPE_BY_PAL_NAME_0.get_11rb$(paletteName);\n };\n PaletteUtil.prototype.colorSchemeByIndex_vfydh1$ = function (paletteType, index) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n switch (paletteType.name) {\n case 'SEQUENTIAL':\n tmp$_2 = Kotlin.isArray(tmp$ = ColorPalette$Sequential$values()) ? tmp$ : throwCCE();\n break;\n case 'DIVERGING':\n tmp$_2 = Kotlin.isArray(tmp$_0 = ColorPalette$Diverging$values()) ? tmp$_0 : throwCCE();\n break;\n case 'QUALITATIVE':\n tmp$_2 = Kotlin.isArray(tmp$_1 = ColorPalette$Qualitative$values()) ? tmp$_1 : throwCCE();\n break;\n default:tmp$_2 = Kotlin.noWhenBranchMatched();\n break;\n }\n var values = tmp$_2;\n return values[index % values.length];\n };\n PaletteUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'PaletteUtil',\n interfaces: []\n };\n var PaletteUtil_instance = null;\n function PaletteUtil_getInstance() {\n if (PaletteUtil_instance === null) {\n new PaletteUtil();\n }return PaletteUtil_instance;\n }\n function RGBChannelGen(myBaseValues) {\n RGBChannelGen$Companion_getInstance();\n this.myBaseValues_0 = myBaseValues;\n this.myRange_0 = null;\n var tmp$, tmp$_0;\n var min = Ordering.Companion.natural_dahdeg$().min_m5x2f4$(this.myBaseValues_0);\n var max = Ordering.Companion.natural_dahdeg$().max_m5x2f4$(this.myBaseValues_0);\n tmp$ = RGBChannelGen$Companion_getInstance().RANGES_0;\n for (tmp$_0 = 0; tmp$_0 !== tmp$.length; ++tmp$_0) {\n var r = tmp$[tmp$_0];\n if (r.contains_mef7kx$(min) || r.contains_mef7kx$(max)) {\n if (this.myRange_0 == null) {\n this.myRange_0 = r;\n } else {\n this.myRange_0 = ensureNotNull(this.myRange_0).span_d226ot$(r);\n }\n }}\n }\n RGBChannelGen.prototype.generate_za3lpa$ = function (maxCount) {\n var tmp$;\n var x = maxCount / this.myBaseValues_0.size;\n var genPerBaseValue = numberToInt(JsMath.ceil(x));\n var a = this.maxValueCount_0() - 1 | 0;\n var b = genPerBaseValue;\n genPerBaseValue = JsMath.min(a, b);\n var x_0 = this.maxValueCount_0() / (genPerBaseValue + 1 | 0);\n var inc = numberToInt(JsMath.floor(x_0));\n var b_0 = numberToInt(inc * 1.33);\n inc = JsMath.max(1, b_0);\n var values = ArrayList_init_0(maxCount);\n var baseValues = this.myBaseValues_0;\n while (values.size < maxCount) {\n var nextBaseValues = ArrayList_init();\n tmp$ = baseValues.iterator();\n while (tmp$.hasNext()) {\n var baseValue = tmp$.next();\n var genValue = baseValue + inc | 0;\n if (!ensureNotNull(this.myRange_0).contains_mef7kx$(genValue)) {\n genValue = ensureNotNull(this.myRange_0).lowerEnd + (genValue - ensureNotNull(this.myRange_0).upperEnd) | 0;\n }values.add_11rb$(genValue);\n nextBaseValues.add_11rb$(genValue);\n if (values.size === maxCount) {\n break;\n }}\n baseValues = nextBaseValues;\n }\n return values;\n };\n RGBChannelGen.prototype.maxValueCount_0 = function () {\n return ensureNotNull(this.myRange_0).upperEnd - ensureNotNull(this.myRange_0).lowerEnd + 1 | 0;\n };\n function RGBChannelGen$Companion() {\n RGBChannelGen$Companion_instance = this;\n this.RANGES_0 = [new ClosedRange(0, 37), new ClosedRange(38, 97), new ClosedRange(98, 157), new ClosedRange(158, 217), new ClosedRange(218, 255)];\n }\n RGBChannelGen$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RGBChannelGen$Companion_instance = null;\n function RGBChannelGen$Companion_getInstance() {\n if (RGBChannelGen$Companion_instance === null) {\n new RGBChannelGen$Companion();\n }return RGBChannelGen$Companion_instance;\n }\n RGBChannelGen.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RGBChannelGen',\n interfaces: []\n };\n function DataType(name, ordinal) {\n Enum.call(this);\n this.name$ = name;\n this.ordinal$ = ordinal;\n }\n function DataType_initFields() {\n DataType_initFields = function () {\n };\n DataType$NUMBER_instance = new DataType('NUMBER', 0);\n DataType$STRING_instance = new DataType('STRING', 1);\n DataType$INSTANT_instance = new DataType('INSTANT', 2);\n DataType$INSTANT_OF_DAY_instance = new DataType('INSTANT_OF_DAY', 3);\n DataType$INSTANT_OF_MONTH_instance = new DataType('INSTANT_OF_MONTH', 4);\n DataType$INSTANT_OF_QUARTER_instance = new DataType('INSTANT_OF_QUARTER', 5);\n DataType$INSTANT_OF_HALF_YEAR_instance = new DataType('INSTANT_OF_HALF_YEAR', 6);\n DataType$INSTANT_OF_YEAR_instance = new DataType('INSTANT_OF_YEAR', 7);\n }\n var DataType$NUMBER_instance;\n function DataType$NUMBER_getInstance() {\n DataType_initFields();\n return DataType$NUMBER_instance;\n }\n var DataType$STRING_instance;\n function DataType$STRING_getInstance() {\n DataType_initFields();\n return DataType$STRING_instance;\n }\n var DataType$INSTANT_instance;\n function DataType$INSTANT_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_instance;\n }\n var DataType$INSTANT_OF_DAY_instance;\n function DataType$INSTANT_OF_DAY_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_OF_DAY_instance;\n }\n var DataType$INSTANT_OF_MONTH_instance;\n function DataType$INSTANT_OF_MONTH_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_OF_MONTH_instance;\n }\n var DataType$INSTANT_OF_QUARTER_instance;\n function DataType$INSTANT_OF_QUARTER_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_OF_QUARTER_instance;\n }\n var DataType$INSTANT_OF_HALF_YEAR_instance;\n function DataType$INSTANT_OF_HALF_YEAR_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_OF_HALF_YEAR_instance;\n }\n var DataType$INSTANT_OF_YEAR_instance;\n function DataType$INSTANT_OF_YEAR_getInstance() {\n DataType_initFields();\n return DataType$INSTANT_OF_YEAR_instance;\n }\n Object.defineProperty(DataType.prototype, 'isTime', {\n configurable: true,\n get: function () {\n return this === DataType$INSTANT_getInstance() || this.isTimeInterval;\n }\n });\n Object.defineProperty(DataType.prototype, 'isTimeInterval', {\n configurable: true,\n get: function () {\n return this === DataType$INSTANT_OF_DAY_getInstance() || this === DataType$INSTANT_OF_MONTH_getInstance() || this === DataType$INSTANT_OF_QUARTER_getInstance() || this === DataType$INSTANT_OF_HALF_YEAR_getInstance() || this === DataType$INSTANT_OF_YEAR_getInstance();\n }\n });\n Object.defineProperty(DataType.prototype, 'isString', {\n configurable: true,\n get: function () {\n return this === DataType$STRING_getInstance();\n }\n });\n Object.defineProperty(DataType.prototype, 'isNumber', {\n configurable: true,\n get: function () {\n return this === DataType$NUMBER_getInstance();\n }\n });\n DataType.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DataType',\n interfaces: [Enum]\n };\n function DataType$values() {\n return [DataType$NUMBER_getInstance(), DataType$STRING_getInstance(), DataType$INSTANT_getInstance(), DataType$INSTANT_OF_DAY_getInstance(), DataType$INSTANT_OF_MONTH_getInstance(), DataType$INSTANT_OF_QUARTER_getInstance(), DataType$INSTANT_OF_HALF_YEAR_getInstance(), DataType$INSTANT_OF_YEAR_getInstance()];\n }\n DataType.values = DataType$values;\n function DataType$valueOf(name) {\n switch (name) {\n case 'NUMBER':\n return DataType$NUMBER_getInstance();\n case 'STRING':\n return DataType$STRING_getInstance();\n case 'INSTANT':\n return DataType$INSTANT_getInstance();\n case 'INSTANT_OF_DAY':\n return DataType$INSTANT_OF_DAY_getInstance();\n case 'INSTANT_OF_MONTH':\n return DataType$INSTANT_OF_MONTH_getInstance();\n case 'INSTANT_OF_QUARTER':\n return DataType$INSTANT_OF_QUARTER_getInstance();\n case 'INSTANT_OF_HALF_YEAR':\n return DataType$INSTANT_OF_HALF_YEAR_getInstance();\n case 'INSTANT_OF_YEAR':\n return DataType$INSTANT_OF_YEAR_getInstance();\n default:throwISE('No enum constant jetbrains.datalore.plot.common.data.DataType.' + name);\n }\n }\n DataType.valueOf_61zpoe$ = DataType$valueOf;\n function RegularMeshDetector(myError) {\n RegularMeshDetector$Companion_getInstance();\n this.myError_xmg86j$_0 = myError;\n this.isMesh_gozhck$_0 = false;\n this.resolution_byvhl$_0 = 0;\n }\n Object.defineProperty(RegularMeshDetector.prototype, 'isMesh', {\n configurable: true,\n get: function () {\n return this.isMesh_gozhck$_0;\n },\n set: function (isMesh) {\n this.isMesh_gozhck$_0 = isMesh;\n }\n });\n Object.defineProperty(RegularMeshDetector.prototype, 'resolution', {\n configurable: true,\n get: function () {\n if (!this.isMesh) {\n var message = 'Not a mesh';\n throw IllegalStateException_init(message.toString());\n }return this.resolution_byvhl$_0;\n },\n set: function (resolution) {\n this.resolution_byvhl$_0 = resolution;\n }\n });\n RegularMeshDetector.prototype.equalsEnough_lu1900$ = function (d1, d2) {\n var tmp$ = d1 === d2;\n if (!tmp$) {\n var x = d1 - d2;\n tmp$ = JsMath.abs(x) <= this.myError_xmg86j$_0;\n }return tmp$;\n };\n RegularMeshDetector.prototype.nearZero_14dthe$ = function (d) {\n return JsMath.abs(d) <= this.myError_xmg86j$_0;\n };\n function RegularMeshDetector$MyRowDetector(myMinRowSize, error, values) {\n RegularMeshDetector.call(this, error);\n this.myMinRowSize_0 = myMinRowSize;\n this.init_0(values);\n }\n RegularMeshDetector$MyRowDetector.prototype.init_0 = function (values) {\n var tmp$;\n this.isMesh = false;\n var distance = 0.0;\n var distanceInitialized = false;\n var prevValue = null;\n var count = this.myMinRowSize_0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var value = tmp$.next();\n if (!SeriesUtil_getInstance().isFinite_yrwdxb$(value)) {\n return;\n }if (prevValue != null) {\n var dist = ensureNotNull(value) - prevValue;\n if (this.nearZero_14dthe$(dist)) {\n return;\n }if (distanceInitialized) {\n if (!this.equalsEnough_lu1900$(dist, distance)) {\n return;\n }} else {\n distance = dist;\n distanceInitialized = true;\n }\n }prevValue = value;\n if ((count = count - 1 | 0, count) === 0) {\n break;\n }}\n if (distanceInitialized && count === 0) {\n var x = distance;\n this.resolution = JsMath.abs(x);\n this.isMesh = true;\n }};\n RegularMeshDetector$MyRowDetector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyRowDetector',\n interfaces: [RegularMeshDetector]\n };\n function RegularMeshDetector$MyColumnDetector(myMinRowSize, error, values) {\n RegularMeshDetector.call(this, error);\n this.myMinRowSize_0 = myMinRowSize;\n this.init_0(values);\n }\n RegularMeshDetector$MyColumnDetector.prototype.init_0 = function (values) {\n var tmp$;\n this.isMesh = false;\n var rowSize = new Int32Array([0, 0]);\n var rowValue = [null, null];\n var rowIndex = 0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var value = tmp$.next();\n if (!SeriesUtil_getInstance().isFinite_yrwdxb$(value)) {\n break;\n }if (rowValue[rowIndex] == null) {\n rowValue[rowIndex] = value;\n rowSize[rowIndex] = rowSize[rowIndex] + 1 | 0;\n } else if (this.equalsEnough_lu1900$(ensureNotNull(rowValue[rowIndex]), ensureNotNull(value))) {\n rowSize[rowIndex] = rowSize[rowIndex] + 1 | 0;\n } else {\n if (rowIndex === 0) {\n rowIndex = rowIndex + 1 | 0;\n rowValue[rowIndex] = value;\n rowSize[rowIndex] = rowSize[rowIndex] + 1 | 0;\n } else {\n break;\n }\n }\n }\n if (rowSize[0] === rowSize[1] && rowSize[0] >= this.myMinRowSize_0) {\n this.isMesh = true;\n var x = ensureNotNull(rowValue[1]) - ensureNotNull(rowValue[0]);\n this.resolution = JsMath.abs(x);\n }};\n RegularMeshDetector$MyColumnDetector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MyColumnDetector',\n interfaces: [RegularMeshDetector]\n };\n function RegularMeshDetector$Companion() {\n RegularMeshDetector$Companion_instance = this;\n this.NO_MESH_0 = new RegularMeshDetector$Companion$NO_MESH$ObjectLiteral(0.0);\n }\n RegularMeshDetector$Companion.prototype.tryRow_l63ks6$ = function (values) {\n var v0 = collect.Iterables.get_dhabsj$(values, 0, null);\n var v1 = collect.Iterables.get_dhabsj$(values, 1, null);\n if (v0 == null || v1 == null) {\n return this.NO_MESH_0;\n }var x = v1 - v0;\n var delta = JsMath.abs(x);\n if (!isFinite(delta)) {\n return this.NO_MESH_0;\n }var error = delta / 10000.0;\n return this.tryRow_4sxsdq$(50, error, values);\n };\n RegularMeshDetector$Companion.prototype.tryRow_4sxsdq$ = function (minRowSize, error, values) {\n return new RegularMeshDetector$MyRowDetector(minRowSize, error, values);\n };\n RegularMeshDetector$Companion.prototype.tryColumn_l63ks6$ = function (values) {\n return this.tryColumn_4sxsdq$(50, SeriesUtil_getInstance().TINY, values);\n };\n RegularMeshDetector$Companion.prototype.tryColumn_4sxsdq$ = function (minRowSize, error, values) {\n return new RegularMeshDetector$MyColumnDetector(minRowSize, error, values);\n };\n function RegularMeshDetector$Companion$NO_MESH$ObjectLiteral(myError) {\n RegularMeshDetector.call(this, myError);\n }\n Object.defineProperty(RegularMeshDetector$Companion$NO_MESH$ObjectLiteral.prototype, 'isMesh', {\n configurable: true,\n get: function () {\n return false;\n },\n set: function (value) {\n Kotlin.callSetter(this, RegularMeshDetector.prototype, 'isMesh', value);\n }\n });\n RegularMeshDetector$Companion$NO_MESH$ObjectLiteral.$metadata$ = {\n kind: Kind_CLASS,\n interfaces: [RegularMeshDetector]\n };\n RegularMeshDetector$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var RegularMeshDetector$Companion_instance = null;\n function RegularMeshDetector$Companion_getInstance() {\n if (RegularMeshDetector$Companion_instance === null) {\n new RegularMeshDetector$Companion();\n }return RegularMeshDetector$Companion_instance;\n }\n RegularMeshDetector.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'RegularMeshDetector',\n interfaces: []\n };\n function SeriesUtil() {\n SeriesUtil_instance = this;\n this.TINY = 1.0E-50;\n this.REAL_NUMBER_0 = SeriesUtil$REAL_NUMBER$lambda(this);\n this.NEGATIVE_NUMBER = SeriesUtil$NEGATIVE_NUMBER$lambda;\n }\n SeriesUtil.prototype.isSubTiny_14dthe$ = function (value) {\n return value < this.TINY;\n };\n SeriesUtil.prototype.isSubTiny_4fzjta$ = function (range) {\n return this.isFinite_4fzjta$(range) && this.span_4fzjta$(range) < this.TINY;\n };\n SeriesUtil.prototype.checkedDoubles_fakr2g$ = function (values) {\n return new SeriesUtil$CheckedDoubleIterable(values);\n };\n SeriesUtil.prototype.checkedDoubles_9ma18$ = function (values) {\n return new SeriesUtil$CheckedDoubleList(values);\n };\n SeriesUtil.prototype.isFinite_yrwdxb$ = function (v) {\n return v != null && isFinite(v);\n };\n SeriesUtil.prototype.asFinite_z03gcz$ = function (v, defaultValue) {\n return v != null && isFinite(v) ? v : defaultValue;\n };\n SeriesUtil.prototype.isFinite_14dthe$ = function (v) {\n return isFinite(v);\n };\n SeriesUtil.prototype.allFinite_jma9l8$ = function (v0, v1) {\n return this.isFinite_yrwdxb$(v0) && this.isFinite_yrwdxb$(v1);\n };\n SeriesUtil.prototype.allFinite_xjrefz$ = function (v0, v1, v2) {\n return this.allFinite_jma9l8$(v0, v1) && this.isFinite_yrwdxb$(v2);\n };\n SeriesUtil.prototype.allFinite_rd1tgs$ = function (v0, v1, v2, v3) {\n return this.allFinite_xjrefz$(v0, v1, v2) && this.isFinite_yrwdxb$(v3);\n };\n SeriesUtil.prototype.filterFinite_10sy24$ = function (l0, l1) {\n var tmp$, tmp$_0, tmp$_1, tmp$_2;\n if (!(l0.size === l1.size)) {\n var message = 'Check failed.';\n throw IllegalStateException_init(message.toString());\n }var l0Copy = ArrayList_init();\n var l1Copy = ArrayList_init();\n var copy = false;\n var i = 0;\n for (var tmp$_3 = l0.iterator(); tmp$_3.hasNext(); ++i) {\n var v0 = tmp$_3.next();\n var tmp$_4, tmp$_5, tmp$_6, tmp$_7;\n var v1 = l1.get_za3lpa$(i);\n if (!this.allFinite_jma9l8$(v0, v1)) {\n if (!copy) {\n l0Copy.addAll_brywnq$(Kotlin.isType(tmp$_4 = toList(take(l0, i)), List) ? tmp$_4 : throwCCE());\n l1Copy.addAll_brywnq$(Kotlin.isType(tmp$_5 = toList(take(l1, i)), List) ? tmp$_5 : throwCCE());\n copy = true;\n }continue;\n }if (copy) {\n l0Copy.add_11rb$(typeof (tmp$_6 = v0) === 'number' ? tmp$_6 : throwCCE());\n l1Copy.add_11rb$(typeof (tmp$_7 = v1) === 'number' ? tmp$_7 : throwCCE());\n }}\n tmp$ = copy;\n if (tmp$ === true)\n tmp$_2 = listOf([l0Copy, l1Copy]);\n else if (tmp$ === false) {\n tmp$_2 = listOf([Kotlin.isType(tmp$_0 = l0, List) ? tmp$_0 : throwCCE(), Kotlin.isType(tmp$_1 = l1, List) ? tmp$_1 : throwCCE()]);\n } else\n tmp$_2 = Kotlin.noWhenBranchMatched();\n return tmp$_2;\n };\n SeriesUtil.prototype.range_l63ks6$ = function (values) {\n var tmp$;\n var min = 0.0;\n var max = 0.0;\n var inited = false;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (this.isFinite_yrwdxb$(v)) {\n if (inited) {\n var a = min;\n var b = ensureNotNull(v);\n min = JsMath.min(a, b);\n var a_0 = max;\n max = JsMath.max(a_0, v);\n } else {\n max = ensureNotNull(v);\n min = max;\n inited = true;\n }\n }}\n return inited ? new ClosedRange(min, max) : null;\n };\n SeriesUtil.prototype.resolution_u62iiw$ = function (values, naValue) {\n var tmp$;\n var rowDetector = RegularMeshDetector$Companion_getInstance().tryRow_l63ks6$(values);\n if (rowDetector.isMesh) {\n return rowDetector.resolution;\n }var columnDetector = RegularMeshDetector$Companion_getInstance().tryColumn_l63ks6$(values);\n if (columnDetector.isMesh) {\n tmp$ = columnDetector.resolution;\n } else {\n tmp$ = this.resolutionFullScan_0(values, naValue);\n }\n return tmp$;\n };\n SeriesUtil.prototype.resolutionFullScan_0 = function (values, naValue) {\n var tmp$;\n var goodDataVector = Kotlin.isType(tmp$ = collect.Iterables.filter_fpit1u$(values, this.REAL_NUMBER_0), Iterable) ? tmp$ : throwCCE();\n if (collect.Iterables.isEmpty_fakr2g$(goodDataVector)) {\n return naValue;\n }var copy = Ordering.Companion.natural_dahdeg$().sortedCopy_m5x2f4$(goodDataVector);\n if (copy.size < 2) {\n return naValue;\n }var it = copy.iterator();\n var resolution = naValue;\n var allZero = true;\n var prev = it.next();\n while (it.hasNext()) {\n var curr = it.next();\n var dist = curr - prev;\n if (dist > 0 && (dist < resolution || allZero)) {\n allZero = false;\n resolution = dist;\n }prev = curr;\n }\n return resolution;\n };\n SeriesUtil.prototype.ensureApplicableRange_4am1sd$ = function (range) {\n if (range == null) {\n return new ClosedRange(-0.5, 0.5);\n }if (this.isSubTiny_4fzjta$(range)) {\n var median = range.lowerEnd;\n return new ClosedRange(median - 0.5, median + 0.5);\n }return range;\n };\n SeriesUtil.prototype.span_4fzjta$ = function (range) {\n if (!this.isFinite_4fzjta$(range)) {\n var message = 'range must be finite: ' + range;\n throw IllegalArgumentException_init(message.toString());\n }return range.upperEnd - range.lowerEnd;\n };\n SeriesUtil.prototype.span_t7esj2$ = function (range0, range1) {\n if (range0 == null)\n return range1;\n return range1 == null ? range0 : range0.span_d226ot$(range1);\n };\n SeriesUtil.prototype.expand_mdyssk$ = function (range, newSpan) {\n var expand = (newSpan - this.span_4fzjta$(range)) / 2;\n return this.expand_wws5xy$(range, expand, expand);\n };\n SeriesUtil.prototype.expand_wws5xy$ = function (range, lowerExpand, upperExpand) {\n return new ClosedRange(range.lowerEnd - lowerExpand, range.upperEnd + upperExpand);\n };\n SeriesUtil.prototype.isFinite_4fzjta$ = function (range) {\n return !(isInfinite(range.lowerEnd) || isInfinite(range.upperEnd));\n };\n SeriesUtil.prototype.matchingIndices_3vukww$ = function (list, matchedValue) {\n var result = ArrayList_init();\n for (var i = 0; i !== list.size; ++i) {\n if (equals(matchedValue, list.get_za3lpa$(i))) {\n result.add_11rb$(i);\n }}\n return result;\n };\n SeriesUtil.prototype.matchingIndices_ut89is$ = function (list, matchedValues) {\n var result = ArrayList_init();\n for (var i = 0; i !== list.size; ++i) {\n if (contains(matchedValues, list.get_za3lpa$(i))) {\n result.add_11rb$(i);\n }}\n return result;\n };\n SeriesUtil.prototype.pickAtIndices_ge51dg$ = function (list, indices) {\n var tmp$;\n var initialCapacity = indices.size > 10 ? indices.size : 10;\n var result = ArrayList_init_0(initialCapacity);\n tmp$ = indices.iterator();\n while (tmp$.hasNext()) {\n var index = tmp$.next();\n if (index < list.size) {\n result.add_11rb$(list.get_za3lpa$(index));\n }}\n return result;\n };\n SeriesUtil.prototype.pickAtIndices_jlfzfq$ = function (list, indices) {\n var result = ArrayList_init_0(list.size);\n for (var i = 0; i !== list.size; ++i) {\n if (indices.contains_11rb$(i)) {\n result.add_11rb$(list.get_za3lpa$(i));\n }}\n return result;\n };\n SeriesUtil.prototype.skipAtIndices_jlfzfq$ = function (list, indices) {\n var result = ArrayList_init_0(list.size);\n for (var i = 0; i !== list.size; ++i) {\n if (!indices.contains_11rb$(i)) {\n result.add_11rb$(list.get_za3lpa$(i));\n }}\n return result;\n };\n SeriesUtil.prototype.firstNotNull_rath1t$ = function (list, defaultValue) {\n var tmp$;\n tmp$ = list.iterator();\n while (tmp$.hasNext()) {\n var v = tmp$.next();\n if (v != null) {\n return v;\n }}\n return defaultValue;\n };\n SeriesUtil.prototype.mean_l4tjj7$ = function (values, defaultValue) {\n var tmp$;\n var result = 0.0;\n var i = -1.0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var value = tmp$.next();\n if (value != null && isFinite(value)) {\n i = i + 1;\n result = value / (i + 1) + result * (i / (i + 1));\n }}\n return i >= 0 ? result : defaultValue;\n };\n SeriesUtil.prototype.sum_k9kaly$ = function (values) {\n var tmp$;\n var result = 0.0;\n tmp$ = values.iterator();\n while (tmp$.hasNext()) {\n var value = tmp$.next();\n if (value != null && isFinite(value)) {\n result += value;\n }}\n return result;\n };\n SeriesUtil.prototype.toDoubleList_8a6n3n$ = function (l) {\n return l == null ? null : (new SeriesUtil$CheckedDoubleList(l)).cast();\n };\n function SeriesUtil$CheckedDoubleList(list) {\n SeriesUtil$CheckedDoubleIterable.call(this, list);\n }\n SeriesUtil$CheckedDoubleList.prototype.cast = function () {\n var tmp$;\n return Kotlin.isType(tmp$ = SeriesUtil$CheckedDoubleIterable.prototype.cast.call(this), List) ? tmp$ : throwCCE();\n };\n SeriesUtil$CheckedDoubleList.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CheckedDoubleList',\n interfaces: [SeriesUtil$CheckedDoubleIterable]\n };\n function SeriesUtil$CheckedDoubleIterable(myIterable) {\n this.myIterable_n2c9gl$_0 = myIterable;\n this.myEmpty_3k4vh6$_0 = collect.Iterables.isEmpty_fakr2g$(this.myIterable_n2c9gl$_0);\n this.myCanBeCast_310oqz$_0 = false;\n var tmp$;\n if (this.myEmpty_3k4vh6$_0) {\n tmp$ = true;\n } else {\n tmp$ = collect.Iterables.all_fpit1u$(collect.Iterables.filter_fpit1u$(this.myIterable_n2c9gl$_0, SeriesUtil$SeriesUtil$CheckedDoubleIterable_init$lambda), SeriesUtil$SeriesUtil$CheckedDoubleIterable_init$lambda_0);\n }\n this.myCanBeCast_310oqz$_0 = tmp$;\n }\n SeriesUtil$CheckedDoubleIterable.prototype.notEmptyAndCanBeCast = function () {\n return !this.myEmpty_3k4vh6$_0 && this.myCanBeCast_310oqz$_0;\n };\n SeriesUtil$CheckedDoubleIterable.prototype.canBeCast = function () {\n return this.myCanBeCast_310oqz$_0;\n };\n SeriesUtil$CheckedDoubleIterable.prototype.cast = function () {\n var tmp$;\n if (!this.myCanBeCast_310oqz$_0) {\n var message = \"Can't cast to a collection of Double(s)\";\n throw IllegalStateException_init(message.toString());\n }return Kotlin.isType(tmp$ = this.myIterable_n2c9gl$_0, Iterable) ? tmp$ : throwCCE();\n };\n function SeriesUtil$SeriesUtil$CheckedDoubleIterable_init$lambda(it) {\n return it != null;\n }\n function SeriesUtil$SeriesUtil$CheckedDoubleIterable_init$lambda_0(input) {\n return typeof input === 'number';\n }\n SeriesUtil$CheckedDoubleIterable.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'CheckedDoubleIterable',\n interfaces: []\n };\n function SeriesUtil$REAL_NUMBER$lambda(this$SeriesUtil) {\n return function (it) {\n return this$SeriesUtil.isFinite_yrwdxb$(it);\n };\n }\n function SeriesUtil$NEGATIVE_NUMBER$lambda(input) {\n return input < 0;\n }\n SeriesUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'SeriesUtil',\n interfaces: []\n };\n var SeriesUtil_instance = null;\n function SeriesUtil_getInstance() {\n if (SeriesUtil_instance === null) {\n new SeriesUtil();\n }return SeriesUtil_instance;\n }\n function DouglasPeuckerSimplification() {\n this.myEpsilon_0 = kotlin_js_internal_DoubleCompanionObject.MIN_VALUE;\n }\n function DouglasPeuckerSimplification$calculateWeights$lambda(closure$points, closure$startIndex) {\n return function (p) {\n return (new DoubleSegment(closure$points.get_za3lpa$(closure$startIndex), p)).length();\n };\n }\n function DouglasPeuckerSimplification$calculateWeights$lambda_0(closure$doubleSegment) {\n return function (it) {\n return closure$doubleSegment.distance_gpjtzr$(it);\n };\n }\n DouglasPeuckerSimplification.prototype.calculateWeights_0 = function (points) {\n var stack = new Stack();\n var size = points.size;\n var list = ArrayList_init_0(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(kotlin_js_internal_DoubleCompanionObject.NaN);\n }\n var weights = list;\n weights.set_wxm5ur$(0, kotlin_js_internal_DoubleCompanionObject.MAX_VALUE);\n weights.set_wxm5ur$(points.size - 1 | 0, kotlin_js_internal_DoubleCompanionObject.MAX_VALUE);\n stack.push_11rb$(new Pair(0, points.size - 1 | 0));\n while (!stack.empty()) {\n var startIndex = ensureNotNull(stack.peek()).first;\n var endIndex = ensureNotNull(stack.peek()).second;\n stack.pop();\n var dMax = 0.0;\n var index_0 = startIndex;\n var doubleSegment = new DoubleSegment(points.get_za3lpa$(startIndex), points.get_za3lpa$(endIndex));\n var distance;\n if (doubleSegment.length() === 0.0) {\n distance = DouglasPeuckerSimplification$calculateWeights$lambda(points, startIndex);\n } else {\n distance = DouglasPeuckerSimplification$calculateWeights$lambda_0(doubleSegment);\n }\n var i = startIndex + 1 | 0;\n while (i < endIndex) {\n var d = distance(points.get_za3lpa$(i));\n if (d > dMax) {\n index_0 = i;\n dMax = d;\n }i = i + 1 | 0;\n }\n if (dMax >= this.myEpsilon_0) {\n stack.push_11rb$(new Pair(startIndex, index_0));\n stack.push_11rb$(new Pair(index_0, endIndex));\n weights.set_wxm5ur$(index_0, dMax);\n }}\n return weights;\n };\n DouglasPeuckerSimplification.prototype.getWeights_ytws2g$ = function (points) {\n return this.calculateWeights_0(points);\n };\n DouglasPeuckerSimplification.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DouglasPeuckerSimplification',\n interfaces: [PolylineSimplifier$RankingStrategy]\n };\n var compareBy$lambda = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function PolylineSimplifier(myPoints, strategy) {\n PolylineSimplifier$Companion_getInstance();\n this.myPoints_0 = myPoints;\n this.myWeights_0 = null;\n this.myWeightLimit_0 = kotlin_js_internal_DoubleCompanionObject.NaN;\n this.myCountLimit_0 = -1;\n this.myWeights_0 = strategy.getWeights_ytws2g$(this.myPoints_0);\n }\n Object.defineProperty(PolylineSimplifier.prototype, 'points', {\n configurable: true,\n get: function () {\n var $receiver = this.indices;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(this.myPoints_0.get_za3lpa$(item));\n }\n return destination;\n }\n });\n function PolylineSimplifier$get_PolylineSimplifier$indices$lambda(this$PolylineSimplifier) {\n return function (it) {\n return this$PolylineSimplifier.getWeight_0(it);\n };\n }\n Object.defineProperty(PolylineSimplifier.prototype, 'indices', {\n configurable: true,\n get: function () {\n var $receiver = until(0, this.myPoints_0.size);\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$;\n tmp$ = $receiver.iterator();\n while (tmp$.hasNext()) {\n var item = tmp$.next();\n destination.add_11rb$(new Pair(item, this.myWeights_0.get_za3lpa$(item)));\n }\n var destination_0 = ArrayList_init();\n var tmp$_0;\n tmp$_0 = destination.iterator();\n while (tmp$_0.hasNext()) {\n var element = tmp$_0.next();\n if (!isNaN_0(this.getWeight_0(element)))\n destination_0.add_11rb$(element);\n }\n var sorted_0 = sortedWith(destination_0, reversed(new Comparator(compareBy$lambda(PolylineSimplifier$get_PolylineSimplifier$indices$lambda(this)))));\n var filtered;\n if (this.isWeightLimitSet_0) {\n var destination_1 = ArrayList_init();\n var tmp$_1;\n tmp$_1 = sorted_0.iterator();\n while (tmp$_1.hasNext()) {\n var element_0 = tmp$_1.next();\n if (this.getWeight_0(element_0) > this.myWeightLimit_0)\n destination_1.add_11rb$(element_0);\n }\n filtered = destination_1;\n } else {\n filtered = take(sorted_0, this.myCountLimit_0);\n }\n var $receiver_0 = filtered;\n var destination_2 = ArrayList_init_0(collectionSizeOrDefault($receiver_0, 10));\n var tmp$_2;\n tmp$_2 = $receiver_0.iterator();\n while (tmp$_2.hasNext()) {\n var item_0 = tmp$_2.next();\n destination_2.add_11rb$(this.getIndex_0(item_0));\n }\n return sorted(destination_2);\n }\n });\n Object.defineProperty(PolylineSimplifier.prototype, 'isWeightLimitSet_0', {\n configurable: true,\n get: function () {\n return !isNaN_0(this.myWeightLimit_0);\n }\n });\n PolylineSimplifier.prototype.setWeightLimit_14dthe$ = function (weightLimit) {\n this.myWeightLimit_0 = weightLimit;\n this.myCountLimit_0 = -1;\n return this;\n };\n PolylineSimplifier.prototype.setCountLimit_za3lpa$ = function (countLimit) {\n this.myWeightLimit_0 = kotlin_js_internal_DoubleCompanionObject.NaN;\n this.myCountLimit_0 = countLimit;\n return this;\n };\n PolylineSimplifier.prototype.getWeight_0 = function (p) {\n return p.second;\n };\n PolylineSimplifier.prototype.getIndex_0 = function (p) {\n return p.first;\n };\n function PolylineSimplifier$RankingStrategy() {\n }\n PolylineSimplifier$RankingStrategy.$metadata$ = {\n kind: Kind_INTERFACE,\n simpleName: 'RankingStrategy',\n interfaces: []\n };\n function PolylineSimplifier$Companion() {\n PolylineSimplifier$Companion_instance = this;\n }\n PolylineSimplifier$Companion.prototype.visvalingamWhyatt_ytws2g$ = function (points) {\n return new PolylineSimplifier(points, new VisvalingamWhyattSimplification());\n };\n PolylineSimplifier$Companion.prototype.douglasPeucker_ytws2g$ = function (points) {\n return new PolylineSimplifier(points, new DouglasPeuckerSimplification());\n };\n PolylineSimplifier$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var PolylineSimplifier$Companion_instance = null;\n function PolylineSimplifier$Companion_getInstance() {\n if (PolylineSimplifier$Companion_instance === null) {\n new PolylineSimplifier$Companion();\n }return PolylineSimplifier$Companion_instance;\n }\n PolylineSimplifier.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PolylineSimplifier',\n interfaces: []\n };\n var compareBy$lambda_0 = wrapFunction(function () {\n var compareValues = Kotlin.kotlin.comparisons.compareValues_s00gnj$;\n return function (closure$selector) {\n return function (a, b) {\n var selector = closure$selector;\n return compareValues(selector(a), selector(b));\n };\n };\n });\n function VisvalingamWhyattSimplification() {\n VisvalingamWhyattSimplification$Companion_getInstance();\n this.myVerticesToRemove_0 = ArrayList_init();\n this.myTriangles_0 = null;\n }\n Object.defineProperty(VisvalingamWhyattSimplification.prototype, 'isSimplificationDone_0', {\n configurable: true,\n get: function () {\n return this.isEmpty_0;\n }\n });\n Object.defineProperty(VisvalingamWhyattSimplification.prototype, 'isEmpty_0', {\n configurable: true,\n get: function () {\n return ensureNotNull(this.myTriangles_0).isEmpty();\n }\n });\n VisvalingamWhyattSimplification.prototype.getWeights_ytws2g$ = function (points) {\n this.myTriangles_0 = ArrayList_init_0(points.size - 2 | 0);\n this.initTriangles_0(points);\n var size = points.size;\n var list = ArrayList_init_0(size);\n for (var index = 0; index < size; index++) {\n list.add_11rb$(VisvalingamWhyattSimplification$Companion_getInstance().INITIAL_AREA_0);\n }\n var weights = list;\n var lastRemovedVertexArea = 0.0;\n while (!this.isSimplificationDone_0) {\n var triangle = this.takeTriangle_0();\n lastRemovedVertexArea = triangle.area > lastRemovedVertexArea ? triangle.area : lastRemovedVertexArea;\n weights.set_wxm5ur$(triangle.currentVertex, lastRemovedVertexArea);\n var next = triangle.next;\n if (next != null) {\n next.takePrevFrom_em8fn6$(triangle);\n this.update_0(next);\n }var prev = triangle.prev;\n if (prev != null) {\n prev.takeNextFrom_em8fn6$(triangle);\n this.update_0(prev);\n }this.myVerticesToRemove_0.add_11rb$(triangle.currentVertex);\n }\n return weights;\n };\n VisvalingamWhyattSimplification.prototype.initTriangles_0 = function (points) {\n var triangles = ArrayList_init_0(points.size - 2 | 0);\n var i = 1;\n var n = points.size - 1 | 0;\n while (i < n) {\n triangles.add_11rb$(new VisvalingamWhyattSimplification$Triangle(i, points));\n i = i + 1 | 0;\n }\n var i_0 = 1;\n var n_0 = triangles.size - 1 | 0;\n while (i_0 < n_0) {\n triangles.get_za3lpa$(i_0).next = triangles.get_za3lpa$(i_0 + 1 | 0);\n triangles.get_za3lpa$(i_0).prev = triangles.get_za3lpa$(i_0 - 1 | 0);\n i_0 = i_0 + 1 | 0;\n }\n var tmp$;\n tmp$ = triangles.iterator();\n while (tmp$.hasNext()) {\n var element = tmp$.next();\n this.add_0(element);\n }\n };\n VisvalingamWhyattSimplification.prototype.takeTriangle_0 = function () {\n var minimalTriangle = this.poll_0();\n this.myVerticesToRemove_0.add_11rb$(minimalTriangle.currentVertex);\n return minimalTriangle;\n };\n VisvalingamWhyattSimplification.prototype.add_0 = function (triangle) {\n var index = this.getIndex_0(triangle);\n ensureNotNull(this.myTriangles_0).add_wxm5ur$(index, triangle);\n };\n function VisvalingamWhyattSimplification$getIndex$lambda(it) {\n return it.area;\n }\n VisvalingamWhyattSimplification.prototype.getIndex_0 = function (triangle) {\n var index = binarySearch(ensureNotNull(this.myTriangles_0), triangle, new Comparator(compareBy$lambda_0(VisvalingamWhyattSimplification$getIndex$lambda)));\n if (index < 0) {\n index = ~index;\n }return index;\n };\n VisvalingamWhyattSimplification.prototype.peek_0 = function () {\n return ensureNotNull(this.myTriangles_0).get_za3lpa$(0);\n };\n VisvalingamWhyattSimplification.prototype.poll_0 = function () {\n var triangle = this.peek_0();\n ensureNotNull(this.myTriangles_0).remove_11rb$(triangle);\n return triangle;\n };\n VisvalingamWhyattSimplification.prototype.update_0 = function (triangle) {\n ensureNotNull(this.myTriangles_0).remove_11rb$(triangle);\n ensureNotNull(this.myTriangles_0).add_11rb$(triangle);\n };\n function VisvalingamWhyattSimplification$Triangle(currentVertex, myPoints) {\n this.currentVertex = currentVertex;\n this.myPoints_0 = myPoints;\n this.area_nqp3v0$_0 = 0;\n this.prevVertex_0 = 0;\n this.nextVertex_0 = 0;\n this.prev = null;\n this.next = null;\n this.prevVertex_0 = this.currentVertex - 1 | 0;\n this.nextVertex_0 = this.currentVertex + 1 | 0;\n this.area = this.calculateArea_0();\n }\n Object.defineProperty(VisvalingamWhyattSimplification$Triangle.prototype, 'area', {\n configurable: true,\n get: function () {\n return this.area_nqp3v0$_0;\n },\n set: function (area) {\n this.area_nqp3v0$_0 = area;\n }\n });\n VisvalingamWhyattSimplification$Triangle.prototype.takeNextFrom_em8fn6$ = function (triangle) {\n this.next = triangle.next;\n this.nextVertex_0 = triangle.nextVertex_0;\n this.area = this.calculateArea_0();\n };\n VisvalingamWhyattSimplification$Triangle.prototype.takePrevFrom_em8fn6$ = function (triangle) {\n this.prev = triangle.prev;\n this.prevVertex_0 = triangle.prevVertex_0;\n this.area = this.calculateArea_0();\n };\n VisvalingamWhyattSimplification$Triangle.prototype.calculateArea_0 = function () {\n var a = this.myPoints_0.get_za3lpa$(this.prevVertex_0);\n var b = this.myPoints_0.get_za3lpa$(this.currentVertex);\n var c = this.myPoints_0.get_za3lpa$(this.nextVertex_0);\n var x = ((b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y)) / 2.0;\n return JsMath.abs(x);\n };\n VisvalingamWhyattSimplification$Triangle.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Triangle',\n interfaces: []\n };\n function VisvalingamWhyattSimplification$Companion() {\n VisvalingamWhyattSimplification$Companion_instance = this;\n this.INITIAL_AREA_0 = kotlin_js_internal_DoubleCompanionObject.MAX_VALUE;\n }\n VisvalingamWhyattSimplification$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var VisvalingamWhyattSimplification$Companion_instance = null;\n function VisvalingamWhyattSimplification$Companion_getInstance() {\n if (VisvalingamWhyattSimplification$Companion_instance === null) {\n new VisvalingamWhyattSimplification$Companion();\n }return VisvalingamWhyattSimplification$Companion_instance;\n }\n VisvalingamWhyattSimplification.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'VisvalingamWhyattSimplification',\n interfaces: [PolylineSimplifier$RankingStrategy]\n };\n function DateTimeFormatUtil() {\n DateTimeFormatUtil_instance = this;\n }\n DateTimeFormatUtil.prototype.formatDateUTC_xfy9o8$ = function (instant, pattern) {\n var format = Format_init(pattern);\n var $receiver = new Instant(numberToLong(instant));\n var $receiver_0 = getCallableRef('toDateTime', function ($receiver, p1) {\n return $receiver.toDateTime_x2y23v$(p1);\n }.bind(null, TimeZone.Companion.UTC))($receiver);\n return getCallableRef('apply', function ($receiver, p1) {\n return $receiver.apply_amwj4p$(p1);\n }.bind(null, format))($receiver_0);\n };\n DateTimeFormatUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'DateTimeFormatUtil',\n interfaces: []\n };\n var DateTimeFormatUtil_instance = null;\n function DateTimeFormatUtil_getInstance() {\n if (DateTimeFormatUtil_instance === null) {\n new DateTimeFormatUtil();\n }return DateTimeFormatUtil_instance;\n }\n function Formatter() {\n Formatter_instance = this;\n this.YEAR_0 = '%b %Y';\n this.YEAR_QUARTER_0 = 'Q %y';\n this.YEAR_MONTH_0 = '%B %Y';\n this.DATE_MEDIUM_0 = '%a, %b %e, %Y';\n this.DATE_MEDIUM_TIME_SHORT_0 = '%a, %b %e, %Y %l:%M %p';\n this.DEF_NUMBER_FORMAT_0 = NumberFormat_init(',g');\n this.DEF_NUMBER_FORMATTER_0 = Formatter$DEF_NUMBER_FORMATTER$lambda(this);\n }\n function Formatter$time$lambda(closure$pattern) {\n return function (input) {\n var tmp$;\n return DateTimeFormatUtil_getInstance().formatDateUTC_xfy9o8$(Kotlin.isNumber(tmp$ = input) ? tmp$ : throwCCE(), closure$pattern);\n };\n }\n Formatter.prototype.time_61zpoe$ = function (pattern) {\n return Formatter$time$lambda(pattern);\n };\n Formatter.prototype.tooltip_w817vg$ = function (dataType) {\n return this.nullable_0(this.tooltipImpl_0(dataType), 'null');\n };\n function Formatter$tooltipImpl$lambda(it) {\n return it.toString();\n }\n Formatter.prototype.tooltipImpl_0 = function (dataType) {\n var tmp$;\n switch (dataType.name) {\n case 'NUMBER':\n tmp$ = this.DEF_NUMBER_FORMATTER_0;\n break;\n case 'STRING':\n tmp$ = Formatter$tooltipImpl$lambda;\n break;\n case 'INSTANT':\n tmp$ = this.time_61zpoe$(this.DATE_MEDIUM_TIME_SHORT_0);\n break;\n case 'INSTANT_OF_DAY':\n tmp$ = this.time_61zpoe$(this.DATE_MEDIUM_0);\n break;\n case 'INSTANT_OF_MONTH':\n tmp$ = this.time_61zpoe$(this.YEAR_MONTH_0);\n break;\n case 'INSTANT_OF_QUARTER':\n case 'INSTANT_OF_HALF_YEAR':\n tmp$ = this.time_61zpoe$(this.YEAR_QUARTER_0);\n break;\n case 'INSTANT_OF_YEAR':\n tmp$ = this.time_61zpoe$(this.YEAR_0);\n break;\n default:tmp$ = Kotlin.noWhenBranchMatched();\n break;\n }\n return tmp$;\n };\n Formatter.prototype.tableCell_w817vg$ = function (dataType) {\n return this.tableCell_0(dataType, 'null');\n };\n Formatter.prototype.tableCell_0 = function (dataType, nullString) {\n return this.nullable_0(this.tableCellImpl_0(dataType), nullString);\n };\n function Formatter$tableCellImpl$lambda(it) {\n return it.toString();\n }\n Formatter.prototype.tableCellImpl_0 = function (dataType) {\n switch (dataType.name) {\n case 'NUMBER':\n return this.DEF_NUMBER_FORMATTER_0;\n case 'STRING':\n return Formatter$tableCellImpl$lambda;\n case 'INSTANT':\n return this.time_61zpoe$(\"%a, %b %e, '%y\");\n default:if (dataType.isTimeInterval) {\n var timeInterval = TimeInterval$Companion_getInstance().fromIntervalDataType_w817vg$(dataType);\n return timeInterval.tickFormatter;\n }\n break;\n }\n throw IllegalArgumentException_init(\"Can't create formatter for data type \" + dataType);\n };\n function Formatter$nullable$lambda(closure$nullString, closure$f) {\n return function (input) {\n return input == null ? closure$nullString : closure$f(input);\n };\n }\n Formatter.prototype.nullable_0 = function (f, nullString) {\n return Formatter$nullable$lambda(nullString, f);\n };\n function Formatter$DEF_NUMBER_FORMATTER$lambda(this$Formatter) {\n return function (input) {\n var tmp$;\n return this$Formatter.DEF_NUMBER_FORMAT_0.apply_3p81yu$(Kotlin.isNumber(tmp$ = input) ? tmp$ : throwCCE());\n };\n }\n Formatter.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Formatter',\n interfaces: []\n };\n var Formatter_instance = null;\n function Formatter_getInstance() {\n if (Formatter_instance === null) {\n new Formatter();\n }return Formatter_instance;\n }\n function TimeUtil() {\n TimeUtil_instance = this;\n }\n TimeUtil.prototype.asDateTimeUTC_14dthe$ = function (instant) {\n try {\n return TimeZone.Companion.UTC.toDateTime_x2y23v$(new Instant(roundToLong(instant)));\n } catch (ignored) {\n if (Kotlin.isType(ignored, RuntimeException)) {\n throw IllegalArgumentException_init(\"Can't create DateTime from instant \" + instant);\n } else\n throw ignored;\n }\n };\n TimeUtil.prototype.asInstantUTC_amwj4p$ = function (dateTime) {\n return TimeZone.Companion.UTC.toInstant_amwj4p$(dateTime).timeSinceEpoch;\n };\n TimeUtil.prototype.yearStart_za3lpa$ = function (year) {\n return new DateTime(Date_0.Companion.firstDayOf_8fsw02$(year));\n };\n TimeUtil.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'TimeUtil',\n interfaces: []\n };\n var TimeUtil_instance = null;\n function TimeUtil_getInstance() {\n if (TimeUtil_instance === null) {\n new TimeUtil();\n }return TimeUtil_instance;\n }\n function DurationInterval(myDuration, count) {\n TimeInterval.call(this, count);\n this.myDuration_0 = myDuration;\n if (!this.myDuration_0.isPositive) {\n throw RuntimeException_init('Duration must be positive');\n }}\n Object.defineProperty(DurationInterval.prototype, 'tickFormatPattern', {\n configurable: true,\n get: function () {\n var duration = this.myDuration_0.duration;\n if (duration.compareTo_11rb$(Duration.Companion.SECOND.duration) < 0) {\n return '%S';\n } else if (duration.compareTo_11rb$(Duration.Companion.MINUTE.duration) < 0) {\n return '%S';\n } else if (duration.compareTo_11rb$(Duration.Companion.HOUR.duration) < 0) {\n return '%M';\n } else if (duration.compareTo_11rb$(Duration.Companion.DAY.duration) < 0) {\n return '%H:%M';\n } else if (duration.compareTo_11rb$(Duration.Companion.WEEK.duration) < 0) {\n return '%b %e';\n }return '%b %e';\n }\n });\n DurationInterval.prototype.range_lu1900$ = function (start, end) {\n var step = this.myDuration_0.duration.multiply(Kotlin.Long.fromInt(this.count)).toNumber();\n var x = start / step;\n var tick = JsMath.ceil(x) * step;\n var result = ArrayList_init();\n while (tick <= end) {\n result.add_11rb$(tick);\n tick += step;\n }\n return result;\n };\n DurationInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'DurationInterval',\n interfaces: [TimeInterval]\n };\n function MeasuredInDays(count) {\n TimeInterval.call(this, count);\n }\n MeasuredInDays.prototype.range_lu1900$ = function (start, end) {\n if (start > end) {\n throw RuntimeException_init('Duration must be positive');\n }var dateTimeStart = TimeUtil_getInstance().asDateTimeUTC_14dthe$(start);\n var dateStart = this.getFirstDayContaining_amwj4p$(dateTimeStart);\n var dateTimeTick = new DateTime(dateStart);\n if (dateTimeTick.compareTo_11rb$(dateTimeStart) < 0) {\n dateTimeTick = this.addInterval_amwj4p$(dateTimeTick);\n }var result = ArrayList_init();\n var tick = TimeUtil_getInstance().asInstantUTC_amwj4p$(dateTimeTick).toNumber();\n while (tick <= end) {\n result.add_11rb$(tick);\n dateTimeTick = this.addInterval_amwj4p$(dateTimeTick);\n tick = TimeUtil_getInstance().asInstantUTC_amwj4p$(dateTimeTick).toNumber();\n }\n return result;\n };\n MeasuredInDays.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MeasuredInDays',\n interfaces: [TimeInterval]\n };\n function MonthInterval(count) {\n MeasuredInDays.call(this, count);\n }\n Object.defineProperty(MonthInterval.prototype, 'tickFormatPattern', {\n configurable: true,\n get: function () {\n return '%b';\n }\n });\n MonthInterval.prototype.getFirstDayContaining_amwj4p$ = function (instant) {\n var firstDay = instant.date;\n firstDay = Date_0.Companion.firstDayOf_8fsw02$(firstDay.year, firstDay.month);\n return firstDay;\n };\n MonthInterval.prototype.addInterval_amwj4p$ = function (toInstant) {\n var tmp$;\n var result = toInstant;\n tmp$ = this.count;\n for (var i = 0; i < tmp$; i++) {\n result = this.addMonth_0(result);\n }\n return result;\n };\n MonthInterval.prototype.addMonth_0 = function (toInstant) {\n var year = toInstant.year;\n var month = toInstant.month;\n var next = ensureNotNull(month).next();\n if (next == null) {\n next = Month.Companion.JANUARY;\n year = year + 1 | 0;\n }return new DateTime(Date_0.Companion.firstDayOf_8fsw02$(year, next));\n };\n MonthInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'MonthInterval',\n interfaces: [MeasuredInDays]\n };\n function NiceTimeInterval() {\n NiceTimeInterval_instance = this;\n this.AUTO_STEPS_MS_0 = new Float64Array([1000.0, 5000.0, 15000.0, 30000.0, 60000.0, 5 * 60000.0, 15 * 60000.0, 30 * 60000.0, 3600000.0, 3 * 3600000.0, 6 * 3600000.0, 12 * 3600000.0, 8.64E7, 2 * 8.64E7, 6.048E8, 2.592E9, 3 * 2.592E9, YearInterval$Companion_getInstance().MS]);\n this.AUTO_INTERVALS_0 = [TimeInterval$Companion_getInstance().seconds_za3lpa$(1), TimeInterval$Companion_getInstance().seconds_za3lpa$(5), TimeInterval$Companion_getInstance().seconds_za3lpa$(15), TimeInterval$Companion_getInstance().seconds_za3lpa$(30), TimeInterval$Companion_getInstance().minutes_za3lpa$(1), TimeInterval$Companion_getInstance().minutes_za3lpa$(5), TimeInterval$Companion_getInstance().minutes_za3lpa$(15), TimeInterval$Companion_getInstance().minutes_za3lpa$(30), TimeInterval$Companion_getInstance().hours_za3lpa$(1), TimeInterval$Companion_getInstance().hours_za3lpa$(3), TimeInterval$Companion_getInstance().hours_za3lpa$(6), TimeInterval$Companion_getInstance().hours_za3lpa$(12), TimeInterval$Companion_getInstance().days_za3lpa$(1), TimeInterval$Companion_getInstance().days_za3lpa$(2), TimeInterval$Companion_getInstance().weeks_za3lpa$(1), TimeInterval$Companion_getInstance().months_za3lpa$(1), TimeInterval$Companion_getInstance().months_za3lpa$(3), TimeInterval$Companion_getInstance().years_za3lpa$(1)];\n }\n NiceTimeInterval.prototype.forMillis_14dthe$ = function (interval) {\n var tmp$;\n if (interval <= this.AUTO_STEPS_MS_0[0]) {\n return this.AUTO_INTERVALS_0[0];\n }var result = this.AUTO_INTERVALS_0[this.AUTO_STEPS_MS_0.length - 1 | 0];\n tmp$ = this.AUTO_STEPS_MS_0.length;\n for (var i = 1; i < tmp$; i++) {\n if (this.AUTO_STEPS_MS_0[i] >= interval) {\n var deltaDown = interval - this.AUTO_STEPS_MS_0[i - 1 | 0];\n var deltaUp = this.AUTO_STEPS_MS_0[i] - interval;\n if (deltaDown < deltaUp) {\n result = this.AUTO_INTERVALS_0[i - 1 | 0];\n } else {\n result = this.AUTO_INTERVALS_0[i];\n }\n break;\n }}\n return result;\n };\n NiceTimeInterval.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'NiceTimeInterval',\n interfaces: []\n };\n var NiceTimeInterval_instance = null;\n function NiceTimeInterval_getInstance() {\n if (NiceTimeInterval_instance === null) {\n new NiceTimeInterval();\n }return NiceTimeInterval_instance;\n }\n function QuarterInterval(count) {\n TimeInterval.call(this, count);\n }\n Object.defineProperty(QuarterInterval.prototype, 'tickFormatPattern', {\n configurable: true,\n get: function () {\n return 'Q';\n }\n });\n QuarterInterval.prototype.range_lu1900$ = function (start, end) {\n throw UnsupportedOperationException_init();\n };\n QuarterInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'QuarterInterval',\n interfaces: [TimeInterval]\n };\n function SemesterInterval(count) {\n SemesterInterval$Companion_getInstance();\n TimeInterval.call(this, count);\n }\n Object.defineProperty(SemesterInterval.prototype, 'tickFormatPattern', {\n configurable: true,\n get: function () {\n throw UnsupportedOperationException_init();\n }\n });\n Object.defineProperty(SemesterInterval.prototype, 'tickFormatter', {\n configurable: true,\n get: function () {\n return SemesterInterval$Companion_getInstance().TIME_FORMAT_FUNCTION_0;\n }\n });\n SemesterInterval.prototype.range_lu1900$ = function (start, end) {\n throw UnsupportedOperationException_init();\n };\n function SemesterInterval$Companion() {\n SemesterInterval$Companion_instance = this;\n this.TIME_FORMAT_FUNCTION_0 = SemesterInterval$Companion$TIME_FORMAT_FUNCTION$lambda;\n }\n function SemesterInterval$Companion$TIME_FORMAT_FUNCTION$lambda(input) {\n var tmp$;\n var result = DateTimeFormatUtil_getInstance().formatDateUTC_xfy9o8$(Kotlin.isNumber(tmp$ = input) ? tmp$ : throwCCE(), 'Q');\n if (result.length === 2 && startsWith(result, 'Q')) {\n try {\n var quarterNum = toInt(result.substring(1));\n var semesterNumber = (quarterNum + 1 | 0) / 2 | 0;\n if (semesterNumber === 1 || semesterNumber === 2) {\n result = 'Semester ' + semesterNumber;\n }} catch (ignored) {\n if (!Kotlin.isType(ignored, NumberFormatException))\n throw ignored;\n }\n }return result;\n }\n SemesterInterval$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var SemesterInterval$Companion_instance = null;\n function SemesterInterval$Companion_getInstance() {\n if (SemesterInterval$Companion_instance === null) {\n new SemesterInterval$Companion();\n }return SemesterInterval$Companion_instance;\n }\n SemesterInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'SemesterInterval',\n interfaces: [TimeInterval]\n };\n function TimeInterval(count) {\n TimeInterval$Companion_getInstance();\n this.count = count;\n }\n Object.defineProperty(TimeInterval.prototype, 'tickFormatter', {\n configurable: true,\n get: function () {\n return Formatter_getInstance().time_61zpoe$(this.tickFormatPattern);\n }\n });\n function TimeInterval$Companion() {\n TimeInterval$Companion_instance = this;\n }\n TimeInterval$Companion.prototype.milliseconds_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.MS, count);\n };\n TimeInterval$Companion.prototype.seconds_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.SECOND, count);\n };\n TimeInterval$Companion.prototype.minutes_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.MINUTE, count);\n };\n TimeInterval$Companion.prototype.hours_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.HOUR, count);\n };\n TimeInterval$Companion.prototype.days_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.DAY, count);\n };\n TimeInterval$Companion.prototype.weeks_za3lpa$ = function (count) {\n return new DurationInterval(Duration.Companion.WEEK, count);\n };\n TimeInterval$Companion.prototype.months_za3lpa$ = function (count) {\n return new MonthInterval(count);\n };\n TimeInterval$Companion.prototype.quarter_0 = function (count) {\n return new QuarterInterval(count);\n };\n TimeInterval$Companion.prototype.semester_0 = function (count) {\n return new SemesterInterval(count);\n };\n TimeInterval$Companion.prototype.years_za3lpa$ = function (count) {\n return new YearInterval(count);\n };\n TimeInterval$Companion.prototype.fromIntervalDataType_w817vg$ = function (dataType) {\n var tmp$;\n switch (dataType.name) {\n case 'INSTANT_OF_DAY':\n tmp$ = this.days_za3lpa$(1);\n break;\n case 'INSTANT_OF_MONTH':\n tmp$ = this.months_za3lpa$(1);\n break;\n case 'INSTANT_OF_QUARTER':\n tmp$ = this.quarter_0(1);\n break;\n case 'INSTANT_OF_HALF_YEAR':\n tmp$ = this.semester_0(1);\n break;\n case 'INSTANT_OF_YEAR':\n tmp$ = this.years_za3lpa$(1);\n break;\n default:throw IllegalArgumentException_init(\"Can't create interval from data type: \" + dataType);\n }\n return tmp$;\n };\n TimeInterval$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var TimeInterval$Companion_instance = null;\n function TimeInterval$Companion_getInstance() {\n if (TimeInterval$Companion_instance === null) {\n new TimeInterval$Companion();\n }return TimeInterval$Companion_instance;\n }\n TimeInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'TimeInterval',\n interfaces: []\n };\n function YearInterval(count) {\n YearInterval$Companion_getInstance();\n MeasuredInDays.call(this, count);\n this.tickFormatPattern_1ltjii$_0 = YearInterval$Companion_getInstance().TICK_FORMAT;\n }\n Object.defineProperty(YearInterval.prototype, 'tickFormatPattern', {\n configurable: true,\n get: function () {\n return this.tickFormatPattern_1ltjii$_0;\n }\n });\n YearInterval.prototype.getFirstDayContaining_amwj4p$ = function (instant) {\n return Date_0.Companion.firstDayOf_8fsw02$(instant.year);\n };\n YearInterval.prototype.addInterval_amwj4p$ = function (toInstant) {\n var tmp$;\n var result = toInstant;\n tmp$ = this.count;\n for (var i = 0; i < tmp$; i++) {\n result = this.addYear_0(result);\n }\n return result;\n };\n YearInterval.prototype.addYear_0 = function (toInstant) {\n var year = toInstant.year;\n return new DateTime(Date_0.Companion.firstDayOf_8fsw02$(year + 1 | 0));\n };\n function YearInterval$Companion() {\n YearInterval$Companion_instance = this;\n this.TICK_FORMAT = '%Y';\n this.MS = 3.1536E10;\n this.TICK_FORMATTER = Formatter_getInstance().time_61zpoe$(this.TICK_FORMAT);\n }\n YearInterval$Companion.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'Companion',\n interfaces: []\n };\n var YearInterval$Companion_instance = null;\n function YearInterval$Companion_getInstance() {\n if (YearInterval$Companion_instance === null) {\n new YearInterval$Companion();\n }return YearInterval$Companion_instance;\n }\n YearInterval.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'YearInterval',\n interfaces: [MeasuredInDays]\n };\n Object.defineProperty(ColorPalette$Type, 'SEQUENTIAL', {\n get: ColorPalette$Type$SEQUENTIAL_getInstance\n });\n Object.defineProperty(ColorPalette$Type, 'DIVERGING', {\n get: ColorPalette$Type$DIVERGING_getInstance\n });\n Object.defineProperty(ColorPalette$Type, 'QUALITATIVE', {\n get: ColorPalette$Type$QUALITATIVE_getInstance\n });\n ColorPalette.prototype.Type = ColorPalette$Type;\n Object.defineProperty(ColorPalette$Sequential, 'Blues', {\n get: ColorPalette$Sequential$Blues_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'BuGn', {\n get: ColorPalette$Sequential$BuGn_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'BuPu', {\n get: ColorPalette$Sequential$BuPu_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'GnBu', {\n get: ColorPalette$Sequential$GnBu_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'Greens', {\n get: ColorPalette$Sequential$Greens_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'Greys', {\n get: ColorPalette$Sequential$Greys_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'Oranges', {\n get: ColorPalette$Sequential$Oranges_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'OrRd', {\n get: ColorPalette$Sequential$OrRd_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'PuBu', {\n get: ColorPalette$Sequential$PuBu_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'PuBuGn', {\n get: ColorPalette$Sequential$PuBuGn_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'PuRd', {\n get: ColorPalette$Sequential$PuRd_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'Purples', {\n get: ColorPalette$Sequential$Purples_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'RdPu', {\n get: ColorPalette$Sequential$RdPu_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'Reds', {\n get: ColorPalette$Sequential$Reds_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'YlGn', {\n get: ColorPalette$Sequential$YlGn_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'YlGnBu', {\n get: ColorPalette$Sequential$YlGnBu_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'YlOrBr', {\n get: ColorPalette$Sequential$YlOrBr_getInstance\n });\n Object.defineProperty(ColorPalette$Sequential, 'YlOrRd', {\n get: ColorPalette$Sequential$YlOrRd_getInstance\n });\n ColorPalette.prototype.Sequential = ColorPalette$Sequential;\n Object.defineProperty(ColorPalette$Diverging, 'BrBG', {\n get: ColorPalette$Diverging$BrBG_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'PiYG', {\n get: ColorPalette$Diverging$PiYG_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'PRGn', {\n get: ColorPalette$Diverging$PRGn_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'PuOr', {\n get: ColorPalette$Diverging$PuOr_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'RdBu', {\n get: ColorPalette$Diverging$RdBu_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'RdGy', {\n get: ColorPalette$Diverging$RdGy_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'RdYlBu', {\n get: ColorPalette$Diverging$RdYlBu_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'RdYlGn', {\n get: ColorPalette$Diverging$RdYlGn_getInstance\n });\n Object.defineProperty(ColorPalette$Diverging, 'Spectral', {\n get: ColorPalette$Diverging$Spectral_getInstance\n });\n ColorPalette.prototype.Diverging = ColorPalette$Diverging;\n Object.defineProperty(ColorPalette$Qualitative, 'Accent', {\n get: ColorPalette$Qualitative$Accent_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Dark2', {\n get: ColorPalette$Qualitative$Dark2_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Paired', {\n get: ColorPalette$Qualitative$Paired_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Pastel1', {\n get: ColorPalette$Qualitative$Pastel1_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Pastel2', {\n get: ColorPalette$Qualitative$Pastel2_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Set1', {\n get: ColorPalette$Qualitative$Set1_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Set2', {\n get: ColorPalette$Qualitative$Set2_getInstance\n });\n Object.defineProperty(ColorPalette$Qualitative, 'Set3', {\n get: ColorPalette$Qualitative$Set3_getInstance\n });\n ColorPalette.prototype.Qualitative = ColorPalette$Qualitative;\n var package$jetbrains = _.jetbrains || (_.jetbrains = {});\n var package$datalore = package$jetbrains.datalore || (package$jetbrains.datalore = {});\n var package$plot = package$datalore.plot || (package$datalore.plot = {});\n var package$common = package$plot.common || (package$plot.common = {});\n var package$color = package$common.color || (package$common.color = {});\n Object.defineProperty(package$color, 'ColorPalette', {\n get: ColorPalette_getInstance\n });\n package$color.ColorScheme = ColorScheme;\n Object.defineProperty(package$color, 'ColorSets', {\n get: ColorSets_getInstance\n });\n Object.defineProperty(package$color, 'ColorUtil', {\n get: ColorUtil_getInstance\n });\n Object.defineProperty(package$color, 'PaletteUtil', {\n get: PaletteUtil_getInstance\n });\n Object.defineProperty(RGBChannelGen, 'Companion', {\n get: RGBChannelGen$Companion_getInstance\n });\n package$color.RGBChannelGen = RGBChannelGen;\n Object.defineProperty(DataType, 'NUMBER', {\n get: DataType$NUMBER_getInstance\n });\n Object.defineProperty(DataType, 'STRING', {\n get: DataType$STRING_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT', {\n get: DataType$INSTANT_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT_OF_DAY', {\n get: DataType$INSTANT_OF_DAY_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT_OF_MONTH', {\n get: DataType$INSTANT_OF_MONTH_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT_OF_QUARTER', {\n get: DataType$INSTANT_OF_QUARTER_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT_OF_HALF_YEAR', {\n get: DataType$INSTANT_OF_HALF_YEAR_getInstance\n });\n Object.defineProperty(DataType, 'INSTANT_OF_YEAR', {\n get: DataType$INSTANT_OF_YEAR_getInstance\n });\n var package$data = package$common.data || (package$common.data = {});\n package$data.DataType = DataType;\n Object.defineProperty(RegularMeshDetector, 'Companion', {\n get: RegularMeshDetector$Companion_getInstance\n });\n package$data.RegularMeshDetector = RegularMeshDetector;\n SeriesUtil.prototype.CheckedDoubleList = SeriesUtil$CheckedDoubleList;\n SeriesUtil.prototype.CheckedDoubleIterable = SeriesUtil$CheckedDoubleIterable;\n Object.defineProperty(package$data, 'SeriesUtil', {\n get: SeriesUtil_getInstance\n });\n var package$geometry = package$common.geometry || (package$common.geometry = {});\n package$geometry.DouglasPeuckerSimplification = DouglasPeuckerSimplification;\n PolylineSimplifier.RankingStrategy = PolylineSimplifier$RankingStrategy;\n Object.defineProperty(PolylineSimplifier, 'Companion', {\n get: PolylineSimplifier$Companion_getInstance\n });\n package$geometry.PolylineSimplifier = PolylineSimplifier;\n Object.defineProperty(VisvalingamWhyattSimplification, 'Companion', {\n get: VisvalingamWhyattSimplification$Companion_getInstance\n });\n package$geometry.VisvalingamWhyattSimplification = VisvalingamWhyattSimplification;\n var package$text = package$common.text || (package$common.text = {});\n Object.defineProperty(package$text, 'DateTimeFormatUtil', {\n get: DateTimeFormatUtil_getInstance\n });\n Object.defineProperty(package$text, 'Formatter', {\n get: Formatter_getInstance\n });\n var package$time = package$common.time || (package$common.time = {});\n Object.defineProperty(package$time, 'TimeUtil', {\n get: TimeUtil_getInstance\n });\n var package$interval = package$time.interval || (package$time.interval = {});\n package$interval.DurationInterval = DurationInterval;\n package$interval.MeasuredInDays = MeasuredInDays;\n package$interval.MonthInterval = MonthInterval;\n Object.defineProperty(package$interval, 'NiceTimeInterval', {\n get: NiceTimeInterval_getInstance\n });\n package$interval.QuarterInterval = QuarterInterval;\n Object.defineProperty(SemesterInterval, 'Companion', {\n get: SemesterInterval$Companion_getInstance\n });\n package$interval.SemesterInterval = SemesterInterval;\n Object.defineProperty(TimeInterval, 'Companion', {\n get: TimeInterval$Companion_getInstance\n });\n package$interval.TimeInterval = TimeInterval;\n Object.defineProperty(YearInterval, 'Companion', {\n get: YearInterval$Companion_getInstance\n });\n package$interval.YearInterval = YearInterval;\n Kotlin.defineModule('lets-plot-plot-common-portable', _);\n return _;\n}));\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9MZXRzUGxvdC8uL2tvdGxpbi1kY2UtZGV2L2pzL3NyYy9rb3RsaW4vbWF0aC5rdD83M2FiIiwid2VicGFjazovL0xldHNQbG90Ly4va290bGluLWRjZS1kZXYvc3JjL2tvdGxpbi91dGlsL1ByZWNvbmRpdGlvbnMua3Q/OWE5NSIsIndlYnBhY2s6Ly9MZXRzUGxvdC8uL2tvdGxpbi1kY2UtZGV2L2NvbW1vbi9zcmMvZ2VuZXJhdGVkL19Db2xsZWN0aW9ucy5rdD9mMDI3Iiwid2VicGFjazovL0xldHNQbG90Ly4va290bGluLWRjZS1kZXYvc3JjL2tvdGxpbi9jb21wYXJpc29ucy9Db21wYXJpc29ucy5rdD9hZmVlIiwid2VicGFjazovL0xldHNQbG90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wKVxuICAgICAgICAgICAgcmV0dXJuIGVtcHR5TGlzdCgpXG4gICAgICAgIGlmIChyZXN1bHRTaXplID09IDEpXG4gICAgICAgICAgICByZXR1cm4gbGlzdE9mKGxhc3QoKSlcbiAgICAgICAgbGlzdCA9IEFycmF5TGlzdDxUPihyZXN1bHRTaXplKVxuICAgICAgICBpZiAodGhpcyBpcyBMaXN0PFQ+KSB7XG4gICAgICAgICAgICBpZiAodGhpcyBpcyBSYW5kb21BY2Nlc3MpIHtcbiAgICAgICAgICAgICAgICBmb3IgKGluZGV4IGluIG4gdW50aWwgc2l6ZSlcbiAgICAgICAgICAgICAgICAgICAgbGlzdC5hZGQodGhpc1tpbmRleF0pXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGZvciAoaXRlbSBpbiBsaXN0SXRlcmF0b3IobikpXG4gICAgICAgICAgICAgICAgICAgIGxpc3QuYWRkKGl0ZW0pXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gbGlzdFxuICAgICAgICB9XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgICBsaXN0ID0gQXJyYXlMaXN0PFQ+KClcbiAgICB9XG4gICAgdmFyIGNvdW50ID0gMFxuICAgIGZvciAoaXRlbSBpbiB0aGlzKSB7XG4gICAgICAgIGlmIChjb3VudCA+PSBuKSBsaXN0LmFkZChpdGVtKSBlbHNlICsrY291bnRcbiAgICB9XG4gICAgcmV0dXJuIGxpc3Qub3B0aW1pemVSZWFkT25seUxpc3QoKVxufVxuXG4vKipcbiAqIFJldHVybnMgYSBsaXN0IGNvbnRhaW5pbmcgYWxsIGVsZW1lbnRzIGV4Y2VwdCBsYXN0IFtuXSBlbGVtZW50cy5cbiAqIFxuICogQHRocm93cyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gaWYgW25dIGlzIG5lZ2F0aXZlLlxuICogXG4gKiBAc2FtcGxlIHNhbXBsZXMuY29sbGVjdGlvbnMuQ29sbGVjdGlvbn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gICAgIEJVX1BVXzUsXG4gICAgICAgIEJVX1BVXzYsXG4gICAgICAgIEJVX1BVXzcsXG4gICAgICAgIEJVX1BVXzgsXG4gICAgICAgIEJVX1BVXzlcbiAgICApXG4gICAgdmFsIEdOX0JVID0gYXJyYXlPZihcbiAgICAgICAgR05fQlVfMyxcbiAgICAgICAgR05fQlVfNCxcbiAgICAgICAgR05fQlVfNSxcbiAgICAgICAgR05fQlVfNixcbiAgICAgICAgR05fQlVfNyxcbiAgICAgICAgR05fQlVfOCxcbiAgICAgICAgR05fQlVfOVxuICAgIClcbiAgICB2YWwgT1JfUkQgPSBhcnJheU9mKFxuICAgICAgICBPUl9SRF8zLFxuICAgICAgICBPUl9SRF80LFxuICAgICAgICBPUl9SRF81LFxuICAgICAgICBPUl9SRF82LFxuICAgICAgICBPUl9SRF83LFxuICAgICAgICBPUl9SRF84LFxuICAgICAgICBPUl9SRF85XG4gICAgKVxuICAgIHZhbCBQVV9CVSA9IGFycmF5T2YoXG4gICAgICAgIFBVX0JVXzMsXG4gICAgICAgIFBVX0JVXzQsXG4gICAgICAgIFBVX0JVXzUsXG4gICAgICAgIFBVX0JVXzYsXG4gICAgICAgIFBVX0JVXzcsXG4gICAgICAgIFBVX0JVXzgsXG4gICAgICAgIFBVX0JVXzlcbiAgICApXG4gICAgdmFsIFBVX0JVX0dOID0gYXJyYXlPZihcbiAgICAgICAgUFVfQlVfR05fMyxcbiAgICAgICAgUFVfQlVfR05fNCxcbiAgICAgICAgUFVfQlVfR05fNSxcbiAgICAgICAgUFVfQlVfR05fNixcbiAgICAgICAgUFVfQlVfR05fNyxcbiAgICAgICAgUFVfQlVfR05fOCxcbiAgICAgICAgUFVfQlVfR05fOVxuICAgIClcbiAgICB2YWwgUFVfUkQgPSBhcnJheU9mKFxuICAgICAgICBQVV9SRF8zLFxuICAgICAgICBQVV9SRF80LFxuICAgICAgICBQVV9SRF81LFxuICAgICAgICBQVV9SRF82LFxuICAgICAgICBQVV9SRF83LFxuICAgICAgICBQVV9SRF84LFxuICAgICAgICBQVV9SRF85XG4gICAgKVxuICAgIHZhbCBSRF9QVSA9IGFycmF5T2YoXG4gICAgICAgIFJEX1BVXzMsXG4gICAgICAgIFJEX1BVXzQsXG4gICAgICAgIFJEX1BVXzUsXG4gICAgICAgIFJEX1BVXzYsXG4gICAgICAgIFJEX1BVXzcsXG4gICAgICAgIFJEX1BVXzgsXG4gICAgICAgIFJEX1BVXzlcbiAgICApXG4gICAgdmFsIFlMX0dOID0gYXJyYXlPZihcbiAgICAgICAgWUxfR05fMyxcbiAgICAgICAgWUxfR05fNCxcbiAgICAgICAgWUxfR05fNSxcbiAgICAgICAgWUxfR05fNixcbiAgICAgICAgWUxfR05fNyxcbiAgICAgICAgWUxfR05fOCxcbiAgICAgICAgWUxfR05fOVxuICAgIClcbiAgICB2YWwgWUxfR05fQlUgPSBhcnJheU9mKFxuICAgICAgICBZTF9HTl9CVV8zLFxuICAgICAgICBZTF9HTl9CVV80LFxuICAgICAgICBZTF9HTl9CVV81LFxuICAgICAgICBZTF9HTl9CVV82LFxuICAgICAgICBZTF9HTl9CVV83LFxuICAgICAgICBZTF9HTl9CVV84LFxuICAgICAgICBZTF9HTl9CVV85XG4gICAgKVxuICAgIHZhbCBZTF9PUl9CUiA9IGFycmF5T2YoXG4gICAgICAgIFlMX09SX0JSXzMsXG4gICAgICAgIFlMX09SX0JSXzQsXG4gICAgICAgIFlMX09SX0JSXzUsXG4gICAgICAgIFlMX09SX0JSXzYsXG4gICAgICAgIFlMX09SX0JSXzcsXG4gICAgICAgIFlMX09SX0JSXzgsXG4gICAgICAgIFlMX09SX0JSXzlcbiAgICApXG4gICAgdmFsIFlMX09SX1JEID0gYXJyYXlPZihcbiAgICAgICAgWUxfT1JfUkRfMyxcbiAgICAgICAgWUxfT1JfUkRfNCxcbiAgICAgICAgWUxfT1JfUkRfNSxcbiAgICAgICAgWUxfT1JfUkRfNixcbiAgICAgICAgWUxfT1JfUkRfNyxcbiAgICAgICAgWUxf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IGFycmF5T2YoXG4gICAgICAgIEJMVUVTXzMsXG4gICAgICAgIEJMVUVTXzQsXG4gICAgICAgIEJMVUVTXzUsXG4gICAgICAgIEJMVUVTXzYsXG4gICAgICAgIEJMVUVTXzcsXG4gICAgICAgIEJMVUVTXzgsXG4gICAgICAgIEJMVUVTXzlcbiAgICApXG4gICAgdmFsIEdSRUVOUyA9IGFycmF5T2YoXG4gICAgICAgIEdSRUVOU18zLFxuICAgICAgICBHUkVFTlNfNCxcbiAgICAgICAgR1JFRU5TXzUsXG4gICAgICAgIEdSRUVOU182LFxuICAgICAgICBHUkVFTlNfNyxcbiAgICAgICAgR1JFRU5TXzgsXG4gICAgICAgIEdSRUVOU185XG4gICAgKVxuICAgIHZhbCBHUkVZUyA9IGFycmF5T2YoXG4gICAgICAgIEdSRVlTXzMsXG4gICAgICAgIEdSRVlTXzQsXG4gICAgICAgIEdSRVlTXzUsXG4gICAgICAgIEdSRVlTXzYsXG4gICAgICAgIEdSRVlTXzcsXG4gICAgICAgIEdSRVlTXzgsXG4gICAgICAgIEdSRVlTXzlcbiAgICApXG4gICAgdmFsIE9SQU5HRVMgPSBhcnJheU9mKFxuICAgICAgICBPUkFOR0VTXzMsXG4gICAgICAgIE9SQU5HRVNfNCxcbiAgICAgICAgT1JBTkdFU181LFxuICAgICAgICBPUkFOR0VTXzYsXG4gICAgICAgIE9SQU5HRVNfNyxcbiAgICAgICAgT1JBTkdFU184LFxuICAgICAgICBPUkFOR0VTXzlcbiAgICApXG4gICAgdmFsIFBVUlBMRVMgPSBhcnJheU9mKFxuICAgICAgICBQVVJQTEVTXzMsXG4gICAgICAgIFBVUlBMRVNfNCxcbiAgICAgICAgUFVSUExFU181LFxuICAgICAgICBQVVJQTEVTXzYsXG4gICAgICAgIFBVUlBMRVNfNyxcbiAgICAgICAgUFVSUExFU184LFxuICAgICAgICBQVVJQTEVTXzlcbiAgICApXG4gICAgdmFsIFJFRFMgPSBhcnJheU9mKFxuICAgICAgICBSRURTXzMsX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iKVxuXG4gICAgdmFsIEJSX0JHID0gYXJyYXlPZihcbiAgICAgICAgQlJfQkdfMyxcbiAgICAgICAgQlJfQkdfNCxcbiAgICAgICAgQlJfQkdfNSxcbiAgICAgICAgQlJfQkdfNixcbiAgICAgICAgQlJfQkdfNyxcbiAgICAgICAgQlJfQkdfOCxcbiAgICAgICAgQlJfQkdfOSxcbiAgICAgICAgQlJfQkdfMTAsXG4gICAgICAgIEJSX0JHXzExXG4gICAgKVxuICAgIHZhbCBQSV9ZRyA9IGFycmF5T2YoXG4gICAgICAgIFBJX1lHXzMsXG4gICAgICAgIFBJX1lHXzQsXG4gICAgICAgIFBJX1lHXzUsXG4gICAgICAgIFBJX1lHXzYsXG4gICAgICAgIFBJX1lHXzcsXG4gICAgICAgIFBJX1lHXzgsXG4gICAgICAgIFBJX1lHXzksXG4gICAgICAgIFBJX1lHXzEwLFxuICAgICAgICBQSV9ZR18xMVxuICAgIClcbiAgICB2YWwgUFJfR04gPSBhcnJheU9mKFxuICAgICAgICBQUl9HTl8zLFxuICAgICAgICBQUl9HTl80LFxuICAgICAgICBQUl9HTl81LFxuICAgICAgICBQUl9HTl82LFxuICAgICAgICBQUl9HTl83LFxuICAgICAgICBQUl9HTl84LFxuICAgICAgICBQUl9HTl85LFxuICAgICAgICBQUl9HTl8xMCxcbiAgICAgICAgUFJfR05fMTFcbiAgICApXG4gICAgdmFsIFBVX09SID0gYXJyYXlPZihcbiAgICAgICAgUFVfT1JfMyxcbiAgICAgICAgUFVfT1JfNCxcbiAgICAgICAgUFVfT1JfNSxcbiAgICAgICAgUFVfT1JfNixcbiAgICAgICAgUFVfT1JfNyxcbiAgICAgICAgUFVfT1JfOCxcbiAgICAgICAgUFVfT1JfOSxcbiAgICAgICAgUFVfT1JfMTAsXG4gICAgICAgIFBVX09SXzExXG4gICAgKVxuICAgIHZhbCBSRF9CVSA9IGFycmF5T2YoXG4gICAgICAgIFJEX0JVXzMsXG4gICAgICAgIFJEX0JVXzQsXG4gICAgICAgIFJEX0JVXzUsXG4gICAgICAgIFJEX0JVXzYsXG4gICAgICAgIFJEX0JVXzcsXG4gICAgICAgIFJEX0JVXzgsXG4gICAgICAgIFJEX0JVXzksXG4gICAgICAgIFJEX0JVXzEwLFxuICAgICAgICBSRF9CVV8xMVxuICAgIClcbiAgICB2YWwgUkRfR1kgPSBhcnJheU9mKFxuICAgICAgICBSRF9HWV8zLFxuICAgICAgICBSRF9HWV80LFxuICAgICAgICBSRF9HWV81LFxuICAgICAgICBSRF9HWV82LFxuICAgICAgICBSRF9HWV83LFxuICAgICAgICBSRF9HWV84LFxuICAgICAgICBSRF9HWV85LFxuICAgICAgICBSRF9HWV8xMCxcbiAgICAgICAgUkRfR1lfMTFcbiAgICApXG4gICAgdmFsIFJEX1lMX0JVID0gYXJyYXlPZihcbiAgICAgICAgUkRfWUxfQlVfMyxcbiAgICAgICAgUkRfWUxfQlVfNCxcbiAgICAgICAgUkRfWUxfQlVfNSxcbiAgICAgICAgUkRfWUxfQlVfNixcbiAgICAgICAgUkRfWUxfQlVfNyxcbiAgICAgICAgUkRfWUxfQlVfOCxcbiAgICAgICAgUkRfWUxfQlVfOSxcbiAgICAgICAgUkRfWUxfQlVfMTAsXG4gICAgICAgIFJEX1lMX0JVXzExXG4gICAgKVxuICAgIHZhbCBSRF9ZTF9HTiA9IGFycmF5T2YoXG4gICAgICAgIFJEX1lMX0dOXzMsXG4gICAgICAgIFJEX1lMX0dOXzQsXG4gICAgICAgIFJEX1lMX0dOXzUsXG4gICAgICAgIFJEX1lMX0dOXzYsXG4gICAgICAgIFJEX1lMX0dOXzcsXG4gICAgICAgIFJEX1lMX0dOXzgsXG4gICAgICAgIFJEX1lMX0dOXzksXG4gICAgICAgIFJEX1lMX0dOXzEwLFxuICAgICAgICBSRF9ZTF9HTl8xMVxuICAgIClcbiAgICB2YWwgU1BFQ1RSQUwgPSBhcnJheU9mKFxuICAgICAgICBTUEVDVFJBTF8zLFxuICAgICAgICBTUEVDVFJBTF80LFxu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gICAgICAgIERBUktfMl84XG4gICAgKVxuICAgIHZhbCBQQUlSRUQgPSBhcnJheU9mKFxuICAgICAgICBQQUlSRURfMyxcbiAgICAgICAgUEFJUkVEXzQsXG4gICAgICAgIFBBSVJFRF81LFxuICAgICAgICBQQUlSRURfNixcbiAgICAgICAgUEFJUkVEXzcsXG4gICAgICAgIFBBSVJFRF84LFxuICAgICAgICBQQUlSRURfOSxcbiAgICAgICAgUEFJUkVEXzEwLFxuICAgICAgICBQQUlSRURfMTEsXG4gICAgICAgIFBBSVJFRF8xMlxuICAgIClcbiAgICB2YWwgUEFTVEVMXzEgPSBhcnJheU9mKFxuICAgICAgICBQQVNURUxfMV8zLFxuICAgICAgICBQQVNURUxfMV80LFxuICAgICAgICBQQVNURUxfMV81LFxuICAgICAgICBQQVNURUxfMV82LFxuICAgICAgICBQQVNURUxfMV83LFxuICAgICAgICBQQVNURUxfMV84LFxuICAgICAgICBQQVNURUxfMV85XG4gICAgKVxuICAgIHZhbCBQQVNURUxfMiA9IGFycmF5T2YoXG4gICAgICAgIFBBU1RFTF8yXzMsXG4gICAgICAgIFBBU1RFTF8yXzQsXG4gICAgICAgIFBBU1RFTF8yXzUsXG4gICAgICAgIFBBU1RFTF8yXzYsXG4gICAgICAgIFBBU1RFTF8yXzcsXG4gICAgICAgIFBBU1RFTF8yXzhcbiAgICApXG4gICAgdmFsIFNFVF8xID0gYXJyYXlPZihcbiAgICAgICAgU0VUXzFfMyxcbiAgICAgICAgU0VUXzFfNCxcbiAgICAgICAgU0VUXzFfNSxcbiAgICAgICAgU0VUXzFfNixcbiAgICAgICAgU0VUXzFfNyxcbiAgICAgICAgU0VUXzFfOCxcbiAgICAgICAgU0VUXzFfOVxuICAgIClcbiAgICB2YWwgU0VUXzIgPSBhcnJheU9mKFxuICAgICAgICBTRVRfMl8zLFxuICAgICAgICBTRVRfMl80LFxuICAgICAgICBTRVRfMl81LFxuICAgICAgICBTRVRfMl82LFxuICAgICAgICBTRVRfMl83LFxuICAg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5kaWNlcykge1xuICAgICAgICAgICAgaWYgKHRoaXNbaW5kZXhdID09IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICAgIGZvciAoaW5kZXggaW4gaW5kaWNlcykge1xuICAgICAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gLTFcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGZpcnN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBCeXRlQXJyYXkuaW5kZXhPZihlbGVtZW50OiBCeXRlKTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMpIHtcbiAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgIHJldHVybiBpbmRleFxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiAtMVxufVxuXG4vKipcbiAqIFJldHVybnMgZmlyc3QgaW5kZXggb2YgW2VsZW1lbnRdLCBvciAtMSBpZiB0aGUgYXJyYXkgZG9lcyBub3QgY29udGFpbiBlbGVtZW50LlxuICovXG5wdWJsaWMgZnVuIFNob3J0QXJyYXkuaW5kZXhPZihlbGVtZW50OiBTaG9ydCk6IEludCB7XG4gICAgZm9yIChpbmRleCBpbiBpbmRpY2VzKSB7XG4gICAgICAgIGlmIChlbGVtZW50ID09IHRoaXNbaW5kZXhdKSB7XG4gICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gLTFcbn1cblxuLyoqXG4gKiBSZXR1cm5zIG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ICAgICAgICAgICAgaWYgKGVsZW1lbnQgPT0gdGhpc1tpbmRleF0pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXhcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gLTFcbn1cblxuLyoqXG4gKiBSZXR1cm5zIGxhc3QgaW5kZXggb2YgW2VsZW1lbnRdLCBvciAtMSBpZiB0aGUgYXJyYXkgZG9lcyBub3QgY29udGFpbiBlbGVtZW50LlxuICovXG5wdWJsaWMgZnVuIEJ5dGVBcnJheS5sYXN0SW5kZXhPZihlbGVtZW50OiBCeXRlKTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMucmV2ZXJzZWQoKSkge1xuICAgICAgICBpZiAoZWxlbWVudCA9PSB0aGlzW2luZGV4XSkge1xuICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIC0xXG59XG5cbi8qKlxuICogUmV0dXJucyBsYXN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBTaG9ydEFycmF5Lmxhc3RJbmRleE9mKGVsZW1lbnQ6IFNob3J0KTogSW50IHtcbiAgICBmb3IgKGluZGV4IGluIGluZGljZXMucmV2ZXJzZWQoKSkge1xuICAgICAgICBpZiAoZWxlbWVudCA9PSB0aGlzW2luZGV4XSkge1xuICAgICAgICAgICAgcmV0dXJuIGluZGV4XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIC0xXG59XG5cbi8qKlxuICogUmV0dXJucyBsYXN0IGluZGV4IG9mIFtlbGVtZW50XSwgb3IgLTEgaWYgdGhlIGFycmF5IGRvZXMgbm90IGNvbnRhaW4gZWxlbWVudC5cbiAqL1xucHVibGljIGZ1biBJbnRBcnJheS5sYXN0SW5kZXhPZihlbGVtZW50OiBJ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VxuXG4vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIEludEFycmF5LmNvdW50KCk6IEludCB7XG4gICAgcmV0dXJuIHNpemVcbn1cblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBudW1iZXIgb2YgZWxlbWVudHMgaW4gdGhpcyBhcnJheS5cbiAqL1xuQGtvdGxpbi5pbnRlcm5hbC5JbmxpbmVPbmx5XG5wdWJsaWMgaW5saW5lIGZ1biBMb25nQXJyYXkuY291bnQoKTogSW50IHtcbiAgICByZXR1cm4gc2l6ZVxufVxuXG4vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIEZsb2F0QXJyYXkuY291bnQoKTogSW50IHtcbiAgICByZXR1cm4gc2l6ZVxufVxuXG4vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa290bGluLmludGVybmFsLklubGluZU9ubHlcbnB1YmxpYyBpbmxpbmUgZnVuIERvdWJsZUFycmF5LmNvdW50KCk6IEludCB7XG4gICAgcmV0dXJuIHNpemVcbn1cblxuLyoqXG4gKiBSZXR1cm5zIHRoZSBudW1iZXIgb2YgZWxlbWVudHMgaW4gdGhpcyBhcnJheS5cbiAqL1xuQGtvdGxpbi5pbnRlcm5hbC5JbmxpbmVPbmx5XG5wdWJsaWMgaW5saW5lIGZ1biBCb29sZWFuQXJyYXkuY291bnQoKTogSW50IHtcbiAgICByZXR1cm4gc2l6ZVxufVxuXG4vKipcbiAqIFJldHVybnMgdGhlIG51bWJlciBvZiBlbGVtZW50cyBpbiB0aGlzIGFycmF5LlxuICovXG5Aa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gICAgIGZvciAociBpbiBSQU5HRVMpIHtcbiAgICAgICAgICAgIGlmIChyLmNvbnRhaW5zKG1pbikgfHwgci5jb250YWlucyhtYXgpKSB7XG4gICAgICAgICAgICAgICAgaWYgKG15UmFuZ2UgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBteVJhbmdlID0gclxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIG15UmFuZ2UgPSBteVJhbmdlISEuc3BhbihyKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEBwYXJhbSBtYXhDb3VudCAtIGNvdW50IG9mIG5ldyB2YWx1ZXMgcmVxdWlyZWRcbiAgICAgKiBAcmV0dXJuIExpc3Qgb2YgZ2VuZXJhdGVkIHZhbHVlLCBzaXplIG1heSBiZSBkaWZmZXJlbnQgdGhhbiBtYXhDb3VudFxuICAgICAqL1xuICAgIGZ1biBnZW5lcmF0ZShtYXhDb3VudDogSW50KTogTGlzdDxJbnQ+IHtcbiAgICAgICAgdmFyIGdlblBlckJhc2VWYWx1ZSA9IGNlaWwobWF4Q291bnQudG9Eb3VibGUoKSAvIG15QmFzZVZhbHVlcy5zaXplKS50b0ludCgpXG4gICAgICAgIGdlblBlckJhc2VWYWx1ZSA9IG1pbihtYXhWYWx1ZUNvdW50KCkgLSAxLCBnZW5QZXJCYXNlVmFsdWUpXG5cbiAgICAgICAgdmFyIGluYyA9IGZsb29yKG1heFZhbHVlQ291bnQoKS50b0RvdWJsZSgpIC8gKGdlblBlckJhc2VWYWx1ZSArIDEpKS50b0ludCgpXG4gICAgICAgIC8vIG1ha2UgaW5jcmVtZW50IGEgYml0IGxlc3MgcmVndWxhclxuICAgICAgICBpbmMgPSBtYXgoMSwgKGluYyAqIDEuMzMpLnRvSW50KCkpXG5cbiAgICAgICAgdmFsIHZhbHVlcyA9IEFycmF5TGlzdDxJbnQ+KG1heENvdW50KVxuICAgICAgICB2YXIgYmFzZVZhbHVlcyA9IG15QmFzZVZhbHVlc1xuICAgICAgICB3aGlsZSAodmFsdWVzLnNpemUgPCBtYXhDb3VudCkge1xuICAgICAgICAgICAgdmFsIG5leHRCYXNlVmFsdWVzID0gQXJyYXlMaXN0PEludD4oKVxuICAgICAgICAgICAgZm9yIChiYXNlVmFsdWUgaW4gYmFzZVZhbHVlcykge1xuICAgICAgICAgICAgICAgIHZhciBnZW5WYWx1ZSA9IGJhc2VWYWx1ZSArIGluY1xuICAgICAgICAgICAgICAgIGlmICghbXlSYW5nZSEhLmNvbnRhaW5zKGdlblZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICBnZW5WYWx1ZSA9IG15UmFuZ2UhIS5sb3dlckVuZCArIChnZW5WYWx1ZSAtIG15UmFuZ2UhIS51cHBlckVuZClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdmFsdWVzLmFkZChnZW5WYWx1ZSlcbiAgICAgICAgICAgICAgICBuZXh0QmFzZVZhbHVlcy5hZGQoZ2VuVmFsdWUpXG4gICAgICAgICAgICAgICAgaWYgKHZhbHVlcy5zaXplID09IG1heENvdW50KSB7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBiYXNlVmFsdWVzID0gbmV4dEJhc2VWYWx1ZXNcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB2YWx1ZXNcbiAgICB9XG5cbiAgICBwcml2YXRlIGZ1biBtYXhWYWx1ZUNvdW50KCk6IEludCB7XG4gICAgICAgIHJldHVybiBteVJhbmdlISEudXBwZXJFbmQgLSBteVJhbmdlISEubG93ZXJFbmQgKyAxXG4gICAgfVxuXG4gICAgY29tcGFuaW9uIG9iamVjdCB7XG4gICAgICAgIHByaXZhdGUgdmFsIFJBTkdFUyA9IGFycmF5T2YoXG4gICAgICAgICAgICAgICAgQ2xv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zZXRcbiAgICB2YXIgcmVzb2x1dGlvbjogRG91YmxlID0gMC50b0RvdWJsZSgpXG4gICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgIGNoZWNrKGlzTWVzaCkgeyBcIk5vdCBhIG1lc2hcIiB9XG4gICAgICAgICAgICByZXR1cm4gZmllbGRcbiAgICAgICAgfVxuICAgICAgICBwcm90ZWN0ZWQgc2V0XG5cbiAgICBwcm90ZWN0ZWQgZnVuIGVxdWFsc0Vub3VnaChkMTogRG91YmxlLCBkMjogRG91YmxlKTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiBkMSA9PSBkMiB8fCBhYnMoZDEgLSBkMikgPD0gbXlFcnJvclxuICAgIH1cblxuICAgIHByb3RlY3RlZCBmdW4gbmVhclplcm8oZDogRG91YmxlKTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiBhYnMoZCkgPD0gbXlFcnJvclxuICAgIH1cblxuXG4gICAgcHJpdmF0ZSBjbGFzcyBNeVJvd0RldGVjdG9yIGludGVybmFsIGNvbnN0cnVjdG9yKFxuICAgICAgICBwcml2YXRlIHZhbCBteU1pblJvd1NpemU6IEludCxcbiAgICAgICAgZXJyb3I6IERvdWJsZSxcbiAgICAgICAgdmFsdWVzOiBJdGVyYWJsZTxEb3VibGU/PlxuICAgICkgOiBSZWd1bGFyTWVzaERldGVjdG9yKGVycm9yKSB7XG5cbiAgICAgICAgaW5pdCB7XG4gICAgICAgICAgICBpbml0KHZhbHVlcylcbiAgICAgICAgfVxuXG4gICAgICAgIHByaXZhdGUgZnVuIGluaXQodmFsdWVzOiBJdGVyYWJsZTxEb3VibGU/Pikge1xuICAgICAgICAgICAgLy8gY2hlY2sgaWYgZmlyc3QgTiBlbGVtZW50cyBhcmUgZXF1YWxseSBzcGFjZWRcbiAgICAgICAgICAgIGlzTWVzaCA9IGZhbHNlXG4gICAgICAgICAgICB2YXIgZGlzdGFuY2UgPSAwLjBcbiAgICAgICAgICAgIHZhciBkaXN0YW5jZUluaXRpYWxpemVkID0gZmFsc2VcbiAgICAgICAgICAgIHZhciBwcmV2VmFsdWU6IERvdWJsZT8gPSBudWxsXG4gICAgICAgICAgICB2YXIgY291bnQgPSBteU1pblJvd1NpemVcbiAgICAgICAgICAgIGZvciAodmFsdWUgaW4gdmFsdWVzKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFpc0Zpbml0ZSh2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChwcmV2VmFsdWUgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICB2YWwgZGlzdCA9IHZhbHVlISEgLSBwcmV2VmFsdWVcbiAgICAgICAgICAgICAgICAgICAgaWYgKG5lYXJaZXJvKGRpc3QpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm5cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAoZGlzdGFuY2VJbml0aWFsaXplZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlcXVhbHNFbm91Z2goZGlzdCwgZGlzdGFuY2UpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkaXN0YW5jZSA9IGRpc3RcbiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3RhbmNlSW5pdGlhbGl6ZWQgPSB0cnVlXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBwcmV2VmFsdWUgPSB2YWx1ZVxuICAgICAgICAgICAgICAgIGlmICgtLWNvdW50ID09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChkaXN0YW5jZUluaXRpYWxpemVkICYmIGNvdW50ID09IDApIHtcbiAgICAgICAgICAgICAgICByZXNvbHV0aW9uID0gYWJzKGRpc3RhbmNlKVxuICAgICAgICAgICAgICAgIGlzTWVzaCA9IHRydWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIHByaXZhdGUgY2xhc3MgTXlDb2x1bW5EZXRlY3RvciBpbnRlcm5hbCBjb25zdHJ1Y3RvcihcbiAgICAgICAgcHJpdmF0ZSB2YWwgbXlNaW5Sb3dTaXplOiBJbnQsXG4gICAgICAgIGVycm9yOiBEb3VibGUsXG4gICAgICAgIHZhbHVlczogSXRlcmFibGU8RG91YmxlPz5cbiAgICApIDogUmVndWxhck1lc2hEZXRlY3RvcihlcnJvcikge1xuXG4gICAgICAgIGluaXQge1xuICAgICAgICAgICAgaW5pdCh2YWx1ZXMpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBpbml0KHZhbHVlczogSXRlcmFibGU8RG91YmxlPz4pIHtcbiAgICAgICAgICAgIC8vIGNoZWNrIGlmIHRoZXJlIGFyZSBhdCBsZWFzdCAyIHNldHMgb2YgZWxlbWVudHMgd2hlcmU6XG4gICAgICAgICAgICAvLyAxLiBzZXRzIGFyZSBlcXVhbCBpbiBzaXplO1xuICAgICAgICAgICAgLy8gMi4gYWxsIGVsZW1lbnRzIGluIGVhY2ggc2V0IGFyZSBlcXVhbFxuICAgICAgICAgICAgaXNNZXNoID0gZmFsc2VcbiAgICAgICAgICAgIHZhbCByb3dTaXplID0gaW50QXJyYXlPZigwLCAwKVxuICAgICAgICAgICAgdmFsIHJvd1ZhbHVlID0gYXJyYXlPZjxEb3VibGU/PihudWxsLCBudWxsKVxuICAgICAgICAgICAgdmFyIHJvd0luZGV4ID0gMFxuICAgICAgICAgICAgZm9yICh2YWx1ZSBpbiB2YWx1ZXMpIHtcbiAgICAgICAgICAgICAgICBpZiAoIWlzRmluaXRlKHZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAocm93VmFsdWVbcm93SW5kZXhdID09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgcm93VmFsdWVbcm93SW5kZXhdID0gdmFsdWVcbiAgICAgICAgICAgICAgICAgICAgcm93U2l6ZVtyb3dJbmRleF0rK1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZXF1YWxzRW5vdWdoKHJvd1ZhbHVlW3Jvd0luZGV4XSEhLCB2YWx1ZSEhKSkge1xuICAgICAgICAgICAgICAgICAgICByb3dTaXplW3Jvd0luZGV4XSsrXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJvd0luZGV4ID09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJvd0luZGV4KysgLy8gbmV4dCByb3dcbiAgICAgICAgICAgICAgICAgICAgICAgIHJvd1ZhbHVlW3Jvd0luZGV4XSA9IHZhbHVlXG4gICAgICAgICAgICAgICAgICAgICAgICByb3dTaXplW3Jvd0luZGV4XSsrXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBjaGVjayByZXN1bHRzXG4gICAgICAgICAgICBpZiAocm93U2l6ZVswXSA9PSByb3dTaXplWzFdICYmIHJvd1NpemVbMF0gPj0gbXlNaW5Sb3dTaXplKSB7XG4gICAgICAgICAgICAgICAgaXNNZXNoID0gdHJ1ZVxuICAgICAgICAgICAgICAgIHJlc29sdXRpb24gPSBhYnMocm93VmFsdWVbMV0hISAtIHJvd1ZhbHVlWzBdISEpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgcHJpdmF0ZSB2YWwgTk9fTUVTSDogUmVndWxhck1lc2hEZXRlY3RvciA9IG9iamVjdCA6IFJlZ3VsYXJNZXNoRGV0ZWN0b3IoMC4wKSB7XG4gICAgICAgICAgICBvdmVycmlkZSB2YXIgaXNNZXNoOiBCb29sZWFuXG4gICAgICAgICAgICAgICAgZ2V0KCkgPSBmYWxzZVxuICAgICAgICAgICAgICAgIHNldCh2YWx1ZTogQm9vbGVhbikge1xuICAgICAgICAgICAgICAgICAgICBzdXBlci5pc01lc2ggPSB2YWx1ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB0cnlSb3codmFsdWVzOiBJdGVyYWJsZTxEb3VibGU/Pik6IFJlZ3VsYXJNZXNoRGV0ZWN0b3Ige1xuICAgICAgICAgICAgLy8gY2hvb3NlICdlcnJvcicgdmFsdWVcbiAgICAgICAgICAgIHZhbCB2MCA9IEl0ZXJhYmxlc1t2YWx1ZXMsIDAsIG51bGxdXG4gICAgICAgICAgICB2YWwgdjEgPSBJdGVyYWJsZXNbdmFsdWVzLCAxLCBudWxsXVxuICAgICAgICAgICAgaWYgKHYwID09IG51bGwgfHwgdjEgPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBOT19NRVNIXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YWwgZGVsdGEgPSBhYnModjEgLSB2MClcbiAgICAgICAgICAgIGlmICghZGVsdGEuaXNGaW5pdGUoKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBOT19NRVNIXG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YWwgZXJyb3IgPSBkZWx0YSAvIDEwMDAwLjBcbiAgICAgICAgICAgIHJldHVybiB0cnlSb3coNTAsIGVycm9yLCB2YWx1ZXMpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gdHJ5Um93KG1pblJvd1NpemU6IEludCwgZXJyb3I6IERvdWJsZ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qge1xuICAgICAgICByZXR1cm4gQ2hlY2tlZERvdWJsZUxpc3QodmFsdWVzKVxuICAgIH1cblxuICAgIGZ1biBpc0Zpbml0ZSh2OiBEb3VibGU/KTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiB2ICE9IG51bGwgJiYgdi5pc0Zpbml0ZSgpXG4gICAgfVxuXG4gICAgZnVuIGFzRmluaXRlKHY6IERvdWJsZT8sIGRlZmF1bHRWYWx1ZTogRG91YmxlKTogRG91YmxlIHtcbiAgICAgICAgcmV0dXJuIGlmICh2ICE9IG51bGwgJiYgdi5pc0Zpbml0ZSgpKVxuICAgICAgICAgICAgdlxuICAgICAgICBlbHNlXG4gICAgICAgICAgICBkZWZhdWx0VmFsdWVcbiAgICB9XG5cbiAgICBmdW4gaXNGaW5pdGUodjogRG91YmxlKTogQm9vbGVhbiB7XG4gICAgICAgIHJldHVybiB2LmlzRmluaXRlKClcbiAgICB9XG5cbiAgICBmdW4gYWxsRmluaXRlKHYwOiBEb3VibGU/LCB2MTogRG91YmxlPyk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gaXNGaW5pdGUodjApICYmIGlzRmluaXRlKHYxKVxuICAgIH1cblxuICAgIGZ1biBhbGxGaW5pdGUodjA6IERvdWJsZT8sIHYxOiBEb3VibGU/LCB2MjogRG91YmxlPyk6IEJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gYWxsRmluaXRlKFxuICAgICAgICAgICAgdjAsXG4gICAgICAgICAgICB2MVxuICAgICAgICApICYmIGlzRmluaXRlKHYyKVxuICAgIH1cblxuICAgIGZ1biBhbGxGaW5pdGUodjA6IERvdWJsZT8sIHYxOiBEb3VibGU/LCB2MjogRG91YmxlPywgdjM6IERvdWJsZT8pOiBCb29sZWFuIHtcbiAgICAgICAgcmV0dXJuIGFsbEZpbml0ZShcbiAgICAgICAgICAgIHYwLFxuICAgICAgICAgICAgdjEsXG4gICAgICAgICAgICB2MlxuICAgICAgICApICYmIGlzRmluaXRlKHYzKVxuICAgIH1cblxuICAgIGZ1biBmaWx0ZXJGaW5pdGUobDA6IExpc3Q8RG91YmxlPz4sIGwxOiBMaXN0PERvdWJsZT8+KTogTGlzdDxMaXN0PERvdWJsZT4+IHtcbiAgICAgICAgY2hlY2sobDAuc2l6ZSA9PSBsMS5zaXplKVxuXG4gICAgICAgIHZhbCBsMENvcHkgPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgIHZhbCBsMUNvcHkgPSBBcnJheUxpc3Q8RG91YmxlPigpXG4gICAgICAgIHZhciBjb3B5ID0gZmFsc2VcbiAgICAgICAgZm9yICgoaSwgdjApIGluIGwwLndpdGhJbmRleCgpKSB7XG4gICAgICAgICAgICB2YWwgdjEgPSBsMVtpXVxuICAgICAgICAgICAgaWYgKCFhbGxGaW5pdGUodjAsIHYxKSkge1xuICAgICAgICAgICAgICAgIGlmICghY29weSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBjb3B5IGFscmVhZHkgY2hlY2tlZCBlbGVtZW50c1xuICAgICAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgICAgICBsMENvcHkuYWRkQWxsKGwwLnRha2UoaSkudG9MaXN0KCkgYXMgTGlzdDxEb3VibGU+KVxuICAgICAgICAgICAgICAgICAgICBAU3VwcHJlc3MoXCJVTkNIRUNLRURfQ0FTVFwiKVxuICAgICAgICAgICAgICAgICAgICBsMUNvcHkuYWRkQWxsKGwxLnRha2UoaSkudG9MaXN0KCkgYXMgTGlzdDxEb3VibGU+KVxuICAgICAgICAgICAgICAgICAgICBjb3B5ID0gdHJ1ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoY29weSkge1xuICAgICAgICAgICAgICAgIGwwQ29weS5hZGQodjAgYXMgRG91YmxlKVxuICAgICAgICAgICAgICAgIGwxQ29weS5hZGQodjEgYXMgRG91YmxlKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgQFN1cHByZXNzKFwiVU5DSEVDS0VEX0NBU1RcIilcbiAgICAgICAgcmV0dXJuIHdoZW4gKGNvcHkpIHtcbiAgICAgICAgICAgIHRydWUgLT4gbGlzdE9mKGwwQ29weSwgbDFDb3B5KVxuICAgICAgICAgICAgZmFsc2UgLT4gbGlzdE9mKGwwIGFzIExpc3Q8RG91YmxlPiwgbDEgYXMgTGlzdDxEb3VibGU+KVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuIHJhbmdlKHZhbHVlczogSXRlcmFibGU8RG91YmxlPz4pOiBDbG9zZWRSYW5nZTxEb3VibGU+PyB7XG4gICAgICAgIHZhciBtaW4gPSAwLjBcbiAgICAgICAgdmFyIG1heCA9IDAuMFxuICAgICAgICB2YXIgaW5pdGVkID0gZmFsc2VcbiAgICAgICAgZm9yICh2IGluIHZhbHVlcykge1xuICAgICAgICAgICAgaWYgKGlzRmluaXRlKHYpKSB7XG4gICAgICAgICAgICAgICAgaWYgKGluaXRlZCkge1xuICAgICAgICAgICAgICAgICAgICBtaW4gPSBtaW4obWluLCB2ISEpXG4gICAgICAgICAgICAgICAgICAgIG1heCA9IG1heChtYXgsIHYpXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbWF4ID0gdiEhXG4gICAgICAgICAgICAgICAgICAgIG1pbiA9IG1heFxuICAgICAgICAgICAgICAgICAgICBpbml0ZWQgPSB0cnVlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBpZiAoaW5pdGVkKVxuICAgICAgICAgICAgQ2xvc2VkUmFuZ2UobWluLCBtYXgpXG4gICAgICAgIGVsc2VcbiAgICAgICAgICAgIG51bGxcbiAgICB9XG5cbiAgICBmdW4gcmVzb2x1dGlvbih2YWx1ZXM6IEl0ZXJhYmxlPERvdWJ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cy5pc0VtcHR5KGdvb2REYXRhVmVjdG9yKSkge1xuICAgICAgICAgICAgcmV0dXJuIG5hVmFsdWVcbiAgICAgICAgfVxuXG4gICAgICAgIHZhbCBjb3B5ID0gT3JkZXJpbmcubmF0dXJhbDxEb3VibGU+KCkuc29ydGVkQ29weShnb29kRGF0YVZlY3RvcilcbiAgICAgICAgaWYgKGNvcHkuc2l6ZSA8IDIpIHtcbiAgICAgICAgICAgIHJldHVybiBuYVZhbHVlXG4gICAgICAgIH1cblxuICAgICAgICB2YWwgaXQgPSBjb3B5Lml0ZXJhdG9yKClcbiAgICAgICAgdmFyIHJlc29sdXRpb24gPSBuYVZhbHVlXG4gICAgICAgIHZhciBhbGxaZXJvID0gdHJ1ZVxuICAgICAgICB2YXIgcHJldiA9IGl0Lm5leHQoKVxuICAgICAgICB3aGlsZSAoaXQuaGFzTmV4dCgpKSB7XG4gICAgICAgICAgICB2YWwgY3VyciA9IGl0Lm5leHQoKVxuICAgICAgICAgICAgdmFsIGRpc3QgPSBjdXJyIC0gcHJldlxuICAgICAgICAgICAgaWYgKGRpc3QgPiAwICYmIChkaXN0IDwgcmVzb2x1dGlvbiB8fCBhbGxaZXJvKSkge1xuICAgICAgICAgICAgICAgIGFsbFplcm8gPSBmYWxzZVxuICAgICAgICAgICAgICAgIHJlc29sdXRpb24gPSBkaXN0XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHByZXYgPSBjdXJyXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVzb2x1dGlvblxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRvRG86IFVzZSB3aXRoIGNhdXRpb24uXG4gICAgICogVG9EbzogVGhlIGNvcnJlY3QgbWV0aG9kIG9mIGRvbWFpbiB2YWxpZGF0aW9uIGlzIHRlbXBvcmFyaWx5IGluICdUcmFuc2Zvcm1zLmVuc3VyZUFwcGxpY2FibGVEb21haW4nLlxuICAgICAqL1xuICAgIGZ1biBlbnN1cmVBcHBsaWNhYm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BcnJheUxpc3Q8SW50PigpXG4gICAgICAgIGZvciAoaSBpbiBsaXN0LmluZGljZXMpIHtcbiAgICAgICAgICAgIGlmIChtYXRjaGVkVmFsdWVzLmNvbnRhaW5zKGxpc3RbaV0pKSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0LmFkZChpKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBmdW4gPFQ+IHBpY2tBdEluZGljZXMobGlzdDogTGlzdDxUPiwgaW5kaWNlczogTGlzdDxJbnQ+KTogTGlzdDxUPiB7XG4gICAgICAgIHZhbCBpbml0aWFsQ2FwYWNpdHkgPSBpZiAoaW5kaWNlcy5zaXplID4gMTApIGluZGljZXMuc2l6ZSBlbHNlIDEwXG4gICAgICAgIHZhbCByZXN1bHQgPSBBcnJheUxpc3Q8VD4oaW5pdGlhbENhcGFjaXR5KVxuICAgICAgICBmb3IgKGluZGV4IGluIGluZGljZXMpIHtcbiAgICAgICAgICAgIGlmIChpbmRleCA8IGxpc3Quc2l6ZSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5hZGQobGlzdFtpbmRleF0pXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgIH1cblxuICAgIGZ1biA8VD4gcGlja0F0SW5kaWNlcyhsaXN0OiBMaXN0PFQ+LCBpbmRpY2VzOiBTZXQ8SW50Pik6IExpc3Q8VD4ge1xuICAgICAgICB2YWwgcmVzdWx0ID0gQXJyYXlMaXN0PFQ+KGxpc3Quc2l6ZSlcbiAgICAgICAgZm9yIChpIGluIGxpc3QuaW5kaWNlcykge1xuICAgICAgICAgICAgaWYgKGluZGljZXMuY29udGFpbnMoaSkpIHtcbiAgICAgICAgICAgICAgICByZXN1bHQuYWRkKGxpc3RbaV0pXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgIH1cblxuICAgIGZ1biA8VD4gc2tpcEF0SW5kaWNlcyhsaXN0OiBMaXN0PFQ+LCBpbmRpY2VzOiBTZXQ8SW50Pik6IExpc3Q8VD4ge1xuICAgICAgICB2YWwgcmVzdWx0ID0gQXJyYXlMaXN0PFQ+KGxpc3Quc2l6ZSlcbiAgICAgICAgZm9yIChpIGluIGxpc3QuaW5kaWNlcykge1xuICAgICAgICAgICAgaWYgKCFpbmRpY2VzLmNvbnRhaW5zKGkpKSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0LmFkZChsaXN0W2ldKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXN1bHRcbiAgICB9XG5cbiAgICBmdW4gPFQ+IGZpcnN0Tm90TnVsbChsaXN0OiBMaXN0PFQ+LCBkZWZhdWx0VmFsdWU6IFQpOiBUIHtcbiAgICAgICAgZm9yICh2IGluIGxpc3QpIHtcbiAgICAgICAgICAgIGlmICh2ICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdlxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBkZWZhdWx0VmFsdWVcbiAgICB9XG5cbiAgICBmdW4gbWVhbih2YWx1ZXM6IExpc3Q8RG91YmxlPz4sIGRlZmF1bHRWYWx1ZTogRG91YmxlPyk6IERvdWJsZT8ge1xuICAgICAgICB2YXIgcmVzdWx0ID0gMC4wXG4gICAgICAgIHZhciBpID0gLTEuMFxuICAgICAgICBmb3IgKHZhbHVlIGluIHZhbHVlcykge1xuICAgICAgICAgICAgaWYgKHZhbHVlICE9IG51bGwgJiYgdmFsdWUuaXNGaW5pdGUoKSkge1xuICAgICAgICAgICAgICAgIGkrK1xuICAgICAgICAgICAgICAgIHJlc3VsdCA9IHZhbHVlIC8gKGkgKyAxKSArIHJlc3VsdCAqIChpIC8gKGkgKyAxKSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gaWYgKGkg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AxKSlcblxuICAgICAgICB3aGlsZSAoIXN0YWNrLmVtcHR5KCkpIHtcbiAgICAgICAgICAgIHZhbCBzdGFydEluZGV4ID0gc3RhY2sucGVlaygpISEuZmlyc3RcbiAgICAgICAgICAgIHZhbCBlbmRJbmRleCA9IHN0YWNrLnBlZWsoKSEhLnNlY29uZFxuICAgICAgICAgICAgc3RhY2sucG9wKClcblxuICAgICAgICAgICAgdmFyIGRNYXggPSAwLjBcbiAgICAgICAgICAgIHZhciBpbmRleCA9IHN0YXJ0SW5kZXhcbiAgICAgICAgICAgIHZhbCBkb3VibGVTZWdtZW50ID0gRG91YmxlU2VnbWVudChwb2ludHNbc3RhcnRJbmRleF0sIHBvaW50c1tlbmRJbmRleF0pXG4gICAgICAgICAgICB2YWwgZGlzdGFuY2U6IChEb3VibGVWZWN0b3IpIC0+IERvdWJsZVxuXG4gICAgICAgICAgICBpZiAoZG91YmxlU2VnbWVudC5sZW5ndGgoKSA9PSAwLjApIHtcbiAgICAgICAgICAgICAgICBkaXN0YW5jZSA9IHsgcCAtPiBEb3VibGVTZWdtZW50KHBvaW50c1tzdGFydEluZGV4XSwgcCkubGVuZ3RoKCkgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBkaXN0YW5jZSA9IHsgZG91YmxlU2VnbWVudC5kaXN0YW5jZShpdCkgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgaSA9IHN0YXJ0SW5kZXggKyAxXG4gICAgICAgICAgICB3aGlsZSAoaSA8IGVuZEluZGV4KSB7XG4gICAgICAgICAgICAgICAgdmFsIGQgPSBkaXN0YW5jZShwb2ludHNbaV0pXG4gICAgICAgICAgICAgICAgaWYgKGQgPiBkTWF4KSB7XG4gICAgICAgICAgICAgICAgICAgIGluZGV4ID0gaVxuICAgICAgICAgICAgICAgICAgICBkTWF4ID0gZFxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICArK2lcbiAgICAgICAgICAgIH1c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2VpZ2h0TGltaXQgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBmaWx0ZXJlZCA9IHNvcnRlZC50YWtlKG15Q291bnRMaW1pdClcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIGZpbHRlcmVkXG4gICAgICAgICAgICAgICAgICAgIC5tYXAgeyB0aGlzLmdldEluZGV4KGl0KSB9XG4gICAgICAgICAgICAgICAgICAgIC5zb3J0ZWQoKVxuICAgICAgICB9XG5cbiAgICBwcml2YXRlIHZhbCBpc1dlaWdodExpbWl0U2V0OiBCb29sZWFuXG4gICAgICAgIGdldCgpID0gIW15V2VpZ2h0TGltaXQuaXNOYU4oKVxuXG4gICAgaW5pdCB7XG4gICAgICAgIG15V2VpZ2h0cyA9IHN0cmF0ZWd5LmdldFdlaWdodHMobXlQb2ludHMpXG4gICAgfVxuXG4gICAgZnVuIHNldFdlaWdodExpbWl0KHdlaWdodExpbWl0OiBEb3VibGUpOiBQb2x5bGluZVNpbXBsaWZpZXIge1xuICAgICAgICBteVdlaWdodExpbWl0ID0gd2VpZ2h0TGltaXRcbiAgICAgICAgbXlDb3VudExpbWl0ID0gLTFcbiAgICAgICAgcmV0dXJuIHRoaXNcbiAgICB9XG5cbiAgICBmdW4gc2V0Q291bnRMaW1pdChjb3VudExpbWl0OiBJbnQpOiBQb2x5bGluZVNpbXBsaWZpZXIge1xuICAgICAgICBteVdlaWdodExpbWl0ID0gRG91YmxlLk5hTlxuICAgICAgICBteUNvdW50TGltaXQgPSBjb3VudExpbWl0XG4gICAgICAgIHJldHVybiB0aGlzXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gZ2V0V2VpZ2h0KHA6IFBhaXI8SW50LCBEb3VibGU+KTogRG91YmxlIHtcbiAgICAgICAgcmV0dXJuIHAuc2Vjb25kXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gZ2V0SW5kZXgocDogUGFpcjxJbnQsIERvdWJsZT4pOi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PSBBcnJheUxpc3Q8VHJpYW5nbGU+KHBvaW50cy5zaXplIC0gMilcblxuICAgICAgICBydW4ge1xuICAgICAgICAgICAgdmFyIGkgPSAxXG4gICAgICAgICAgICB2YWwgbiA9IHBvaW50cy5zaXplIC0gMVxuICAgICAgICAgICAgd2hpbGUgKGkgPCBuKSB7XG4gICAgICAgICAgICAgICAgdHJpYW5nbGVzLmFkZChcbiAgICAgICAgICAgICAgICAgICAgVHJpYW5nbGUoXG4gICAgICAgICAgICAgICAgICAgICAgICBpLFxuICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRzXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgKytpXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgaSA9IDFcbiAgICAgICAgdmFsIG4gPSB0cmlhbmdsZXMuc2l6ZSAtIDFcbiAgICAgICAgd2hpbGUgKGkgPCBuKSB7XG4gICAgICAgICAgICB0cmlhbmdsZXNbaV0ubmV4dCA9IHRyaWFuZ2xlc1tpICsgMV1cbiAgICAgICAgICAgIHRyaWFuZ2xlc1tpXS5wcmV2ID0gdHJpYW5nbGVzW2kgLSAxXVxuICAgICAgICAgICAgaSsrXG4gICAgICAgIH1cblxuICAgICAgICB0cmlhbmdsZXMuZm9yRWFjaCB7IHRoaXMuYWRkKGl0KSB9XG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gdGFrZVRyaWFuZ2xlKCk6IFRyaWFuZ2xlIHtcbiAgICAgICAgdmFsIG1pbmltYWxUcmlhbmdsZSA9IHBvbGwoKVxuICAgICAgICBteVZlcnRpY2VzVG9SZW1vdmUuYWRkKG1pbmltYWxUcmlhbmdsZS5jdXJyZW50VmVydGV4KVxuICAgICAgICByZXR1cm4gbWluaW1hbFRyaWFuZ2xlXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gYWRkKHRyaWFuZ2xlOiBUcmlhbmdsZSkge1xu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G9Eb3VibGUoKVxuICAgICAgICAgICAgcHJpdmF0ZSBzZXRcbiAgICAgICAgcHJpdmF0ZSB2YXIgcHJldlZlcnRleDogSW50ID0gMFxuICAgICAgICBwcml2YXRlIHZhciBuZXh0VmVydGV4OiBJbnQgPSAwXG4gICAgICAgIHZhciBwcmV2OiBUcmlhbmdsZT8gPSBudWxsXG4gICAgICAgIHZhciBuZXh0OiBUcmlhbmdsZT8gPSBudWxsXG5cbiAgICAgICAgaW5pdCB7XG4gICAgICAgICAgICBwcmV2VmVydGV4ID0gY3VycmVudFZlcnRleCAtIDFcbiAgICAgICAgICAgIG5leHRWZXJ0ZXggPSBjdXJyZW50VmVydGV4ICsgMVxuICAgICAgICAgICAgYXJlYSA9IGNhbGN1bGF0ZUFyZWEoKVxuICAgICAgICB9XG5cbiAgICAgICAgaW50ZXJuYWwgZnVuIHRha2VOZXh0RnJvbSh0cmlhbmdsZTogVHJpYW5nbGUpIHtcbiAgICAgICAgICAgIG5leHQgPSB0cmlhbmdsZS5uZXh0XG4gICAgICAgICAgICBuZXh0VmVydGV4ID0gdHJpYW5nbGUubmV4dFZlcnRleFxuICAgICAgICAgICAgYXJlYSA9IGNhbGN1bGF0ZUFyZWEoKVxuICAgICAgICB9XG5cbiAgICAgICAgaW50ZXJuYWwgZnVuIHRha2VQcmV2RnJvbSh0cmlhbmdsZTogVHJpYW5nbGUpIHtcbiAgICAgICAgICAgIHByZXYgPSB0cmlhbmdsZS5wcmV2XG4gICAgICAgICAgICBwcmV2VmVydGV4ID0gdHJpYW5nbGUucHJldlZlcnRleFxuICAgICAgICAgICAgYXJlYSA9IGNhbGN1bGF0ZUFyZWEoKVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gY2FsY3VsYXRlQXJlYSgpOiBEb3VibGUge1xuICAgICAgICAgICAgdmFsIGEgPSBteVBvaW50c1twcmV2VmVydGV4XVxuICAgICAgICAgICAgdmFsIGIgPSBteVBvaW50c1tjdXJyZW50VmVydG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gICAgICApXG4gICAgfVxuXG4gICAgcHJpdmF0ZSBmdW4gdG9vbHRpcEltcGwoZGF0YVR5cGU6IERhdGFUeXBlKTogKEFueSkgLT4gU3RyaW5nIHtcbiAgICAgICAgcmV0dXJuIHdoZW4gKGRhdGFUeXBlKSB7XG4gICAgICAgICAgICBEYXRhVHlwZS5OVU1CRVIgLT4gREVGX05VTUJFUl9GT1JNQVRURVJcbiAgICAgICAgICAgIERhdGFUeXBlLlNUUklORyAtPiB7IGl0IC0+IGl0LnRvU3RyaW5nKCkgfSAvLyBubyBmb3JtYXR0aW5nIHJlYWxseSAodG9TdGluZylcbiAgICAgICAgICAgIERhdGFUeXBlLklOU1RBTlQgLT4gdGltZShcbiAgICAgICAgICAgICAgICBEQVRFX01FRElVTV9USU1FX1NIT1JUXG4gICAgICAgICAgICApXG4gICAgICAgICAgICBEYXRhVHlwZS5JTlNUQU5UX09GX0RBWSAtPiB0aW1lKFxuICAgICAgICAgICAgICAgIERBVEVfTUVESVVNXG4gICAgICAgICAgICApXG4gICAgICAgICAgICBEYXRhVHlwZS5JTlNUQU5UX09GX01PTlRIIC0+IHRpbWUoXG4gICAgICAgICAgICAgICAgWUVBUl9NT05USFxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgRGF0YVR5cGUuSU5TVEFOVF9PRl9RVUFSVEVSLCBEYXRhVHlwZS5JTlNUQU5UX09GX0hBTEZfWUVBUiAtPiB0aW1lKFxuICAgICAgICAgICAgICAgIFlFQVJfUVVBUlRFUlxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgRGF0YVR5cGUuSU5TVEFOVF9PRl9ZRUFSIC0+IHRpbWUoXG4gICAgICAgICAgICAgICAgWUVBUlxuICAgICAgICAgICAgKVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgLy8gVG9EbzogcmVtb3ZlIC0gb25seSB1c2VkIGluIHRlc3RzICg/KVxuICAgIGZ1biB0YWJsZUNlbGwoZGF0YVR5cGU6IERhdGFUeXBlKTogKEFueT8p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ludGVydmFsKHByaXZhdGUgdmFsIG15RHVyYXRpb246IER1cmF0aW9uLCBjb3VudDogSW50KSA6IFRpbWVJbnRlcnZhbChjb3VudCkge1xuXG4gICAgb3ZlcnJpZGUvLyBtaWxsaXNlY29uZHNcbiAgICAvLyBmcmFjdGlvbmFsIHNlY29uZHNcbiAgICAvLyBzZWNvbmRzXG4gICAgLy8gbWludXRlc1xuICAgIC8vIGhvdXJzXG4gICAgLy8gZGF5c1xuICAgIC8vIHdlZWtzXG4gICAgdmFsIHRpY2tGb3JtYXRQYXR0ZXJuOiBTdHJpbmdcbiAgICAgICAgZ2V0KCkge1xuICAgICAgICAgICAgdmFsIGR1cmF0aW9uID0gbXlEdXJhdGlvbi5kdXJhdGlvblxuICAgICAgICAgICAgaWYgKGR1cmF0aW9uIDwgRHVyYXRpb24uU0VDT05ELmR1cmF0aW9uKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFwiJVNcIlxuICAgICAgICAgICAgfSBlbHNlIGlmIChkdXJhdGlvbiA8IER1cmF0aW9uLk1JTlVURS5kdXJhdGlvbikge1xuICAgICAgICAgICAgICAgIHJldHVybiBcIiVTXCJcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoZHVyYXRpb24gPCBEdXJhdGlvbi5IT1VSLmR1cmF0aW9uKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFwiJU1cIlxuICAgICAgICAgICAgfSBlbHNlIGlmIChkdXJhdGlvbiA8IER1cmF0aW9uLkRBWS5kdXJhdGlvbikge1xuICAgICAgICAgICAgICAgIHJldHVybiBcIiVIOiVNXCJcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoZHVyYXRpb24gPCBEdXJhdGlvbi5XRUVLLmR1cmF0aW9uKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFwiJWIgJWVcIlxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIFwiJWIgJWVcIlxuICAgICAgICB9XG5cbiAgICBpbml0IHtcbiAgICAg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pbnN0YW50LmRhdGVcbiAgICAgICAgZmlyc3REYXkgPSBEYXRlLmZpcnN0RGF5T2YoZmlyc3REYXkueWVhciwgZmlyc3REYXkubW9udGgpXG4gICAgICAgIHJldHVybiBmaXJzdERheVxuICAgIH1cblxuICAgIG92ZXJyaWRlIGZ1biBhZGRJbnRlcnZhbCh0b0luc3RhbnQ6IERhdGVUaW1lKTogRGF0ZVRpbWUge1xuICAgICAgICB2YXIgcmVzdWx0ID0gdG9JbnN0YW50XG4gICAgICAgIGZvciAoaSBpbiAwIHVudGlsIGNvdW50KSB7XG4gICAgICAgICAgICByZXN1bHQgPSBhZGRNb250aChyZXN1bHQpXG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3VsdFxuICAgIH1cblxuICAgIHByaXZhdGUgZnVuIGFkZE1vbnRoKHRvSW5zdGFudDogRGF0ZVRpbWUpOiBEYXRlVGltZSB7XG4gICAgICAgIHZhciB5ZWFyID0gdG9JbnN0YW50LnllYXJcbiAgICAgICAgdmFsIG1vbnRoID0gdG9JbnN0YW50Lm1vbnRoXG4gICAgICAgIHZhciBuZXh0ID0gbW9udGghIS5uZXh0KClcbiAgICAgICAgaWYgKG5leHQgPT0gbnVsbCkge1xuICAgICAgICAgICAgbmV4dCA9IE1vbnRoLkpBTlVBUllcbiAgICAgICAgICAgIHllYXIrK1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBEYXRlVGltZShEYXRlLmZpcnN0RGF5T2YoeWVhciwgbmV4dCkpXG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuXG4gKi9cblxucGFja2FnZSBqZXRicmFpbnMuZGF0YWxvcmUucGxvdC5jb21tb24udGltZ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MzApLFxuXG4gICAgICAgIFRpbWVJbnRlcnZhbC5ob3VycygxKSxcbiAgICAgICAgVGltZUludGVydmFsLmhvdXJzKDMpLFxuICAgICAgICBUaW1lSW50ZXJ2YWwuaG91cnMoNiksXG4gICAgICAgIFRpbWVJbnRlcnZhbC5ob3VycygxMiksXG5cbiAgICAgICAgVGltZUludGVydmFsLmRheXMoMSksXG4gICAgICAgIFRpbWVJbnRlcnZhbC5kYXlzKDIpLFxuXG4gICAgICAgIFRpbWVJbnRlcnZhbC53ZWVrcygxKSxcblxuICAgICAgICBUaW1lSW50ZXJ2YWwubW9udGhzKDEpLFxuICAgICAgICBUaW1lSW50ZXJ2YWwubW9udGhzKDMpLFxuXG4gICAgICAgIFRpbWVJbnRlcnZhbC55ZWFycygxKVxuICAgIClcblxuICAgIGZ1biBmb3JNaWxsaXMoaW50ZXJ2YWw6IERvdWJsZSk6IFRpbWVJbnRlcnZhbCB7XG4gICAgICAgIGlmIChpbnRlcnZhbCA8PSBBVVRPX1NURVBTX01TWzBdKSB7XG4gICAgICAgICAgICByZXR1cm4gQVVUT19JTlRFUlZBTFNbMF1cbiAgICAgICAgfVxuXG4gICAgICAgIHZhciByZXN1bHQgPSBBVVRPX0lOVEVSVkFMU1tBVVRPX1NURVBTX01TLnNpemUgLSAxXVxuICAgICAgICBmb3IgKGkgaW4gMSB1bnRpbCBBVVRPX1NURVBTX01TLnNpemUpIHtcbiAgICAgICAgICAgIGlmIChBVVRPX1NURVBTX01TW2ldID49IGludGVydmFsKSB7XG4gICAgICAgICAgICAgICAgdmFsIGRlbHRhRG93biA9IGludGVydmFsIC0gQVVUT19TVEVQU19NU1tpIC0gMV1cbiAgICAgICAgICAgICAgICB2YWwgZGVsdGFVcCA9IEFVVE9fU1RFUFNfTVNbaV0gLSBpbnRlcnZhbFxuICAgICAgICAgICAgICAgIGlmIChkZWx0YURvd24gPCBkZWx0YVVwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IEFVVE9fSU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dGxpbihcIjEuMlwiKVxuQFN1cHByZXNzKFwiQUNUVUFMX0ZVTkNUSU9OX1dJVEhfREVGQVVMVF9BUkdVTUVOVFNcIilcbnB1YmxpYyBhY3R1YWwgZnVuIFN0cmluZy5jb21wYXJlVG8ob3RoZXI6IFN0cmluZywgaWdub3JlQ2FzZTogQm9vbGVhbiA9IGZhbHNlKTogSW50IHtcbiAgICBpZiAoaWdub3JlQ2FzZSkge1xuICAgICAgICB2YWwgbjEgPSB0aGlzLmxlbmd0aFxuICAgICAgICB2YWwgbjIgPSBvdGhlci5sZW5ndGhcbiAgICAgICAgdmFsIG1pbiA9IG1pbk9mKG4xLCBuMilcbiAgICAgICAgaWYgKG1pbiA9PSAwKSByZXR1cm4gbjEgLSBuMlxuICAgICAgICB2YXIgc3RhcnQgPSAwXG4gICAgICAgIHdoaWxlICh0cnVlKSB7XG4gICAgICAgICAgICB2YWwgZW5kID0gbWluT2Yoc3RhcnQgKyAxNiwgbWluKVxuICAgICAgICAgICAgdmFyIHMxID0gdGhpcy5zdWJzdHJpbmcoc3RhcnQsIGVuZClcbiAgICAgICAgICAgIHZhciBzMiA9IG90aGVyLnN1YnN0cmluZyhzdGFydCwgZW5kKVxuICAgICAgICAgICAgaWYgKHMxICE9IHMyKSB7XG4gICAgICAgICAgICAgICAgczEgPSBzMS51cHBlcmNhc2UoKVxuICAgICAgICAgICAgICAgIHMyID0gczIudXBwZXJjYXNlKClcbiAgICAgICAgICAgICAgICBpZiAoczEgIT0gczIpIHtcbiAgICAgICAgICAgICAgICAgICAgczEgPSBzMS5sb3dlcmNhc2UoKVxuICAgICAgICAgICAgICAgICAgICBzMiA9IHMyLmxvd2VyY2FzZSgpXG4gICAgICAgICAgICAgICAgICAgIGlmIChzMSAhPSBzMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMxLmNvbXBhcmVUbyhzMilcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAg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ludXRlcyhjb3VudDogSW50KTogVGltZUludGVydmFsIHtcbiAgICAgICAgICAgIHJldHVybiBEdXJhdGlvbkludGVydmFsKER1cmF0aW9uLk1JTlVURSwgY291bnQpXG4gICAgICAgIH1cblxuICAgICAgICBmdW4gaG91cnMoY291bnQ6IEludCk6IFRpbWVJbnRlcnZhbCB7XG4gICAgICAgICAgICByZXR1cm4gRHVyYXRpb25JbnRlcnZhbChEdXJhdGlvbi5IT1VSLCBjb3VudClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBkYXlzKGNvdW50OiBJbnQpOiBUaW1lSW50ZXJ2YWwge1xuICAgICAgICAgICAgcmV0dXJuIER1cmF0aW9uSW50ZXJ2YWwoRHVyYXRpb24uREFZLCBjb3VudClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biB3ZWVrcyhjb3VudDogSW50KTogVGltZUludGVydmFsIHtcbiAgICAgICAgICAgIHJldHVybiBEdXJhdGlvbkludGVydmFsKER1cmF0aW9uLldFRUssIGNvdW50KVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIG1vbnRocyhjb3VudDogSW50KTogVGltZUludGVydmFsIHtcbiAgICAgICAgICAgIHJldHVybiBNb250aEludGVydmFsKGNvdW50KVxuICAgICAgICB9XG5cbiAgICAgICAgcHJpdmF0ZSBmdW4gcXVhcnRlcihjb3VudDogSW50KTogVGltZUludGVydmFsIHtcbiAgICAgICAgICAgIHJldHVybiBRdWFydGVySW50ZXJ2YWwoY291bnQpXG4gICAgICAgIH1cblxuICAgICAgICBwcml2YXRlIGZ1biBzZW1lc3Rlcihjb3VudDogSW50KTogVGltZUludGVydmFsIHtcbiAgICAgICAgICAgIHJldHVybiBTZW1lc3RlckludGVydmFsKGNvdW50KVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuIHllYXJzKGNvdW50OiBJbnQpOiBUaW1lSW50ZXJ2YWwge1xuICAgICAgICAgICAgcmV0dXJuIFllYXJJbnRlcnZhbChjb3VudClcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1biBmcm9tSW50ZXJ2YWxEYXRhVHlwZShkYXRhVHlwZTogRGF0YVR5cGUpOiBUaW1lSW50ZXJ2YWwge1xuICAgICAgICAgICAgcmV0dXJuIHdoZW4gKGRhdGFUeXBlKSB7XG4gICAgICAgICAgICAgICAgRGF0YVR5cGUuSU5TVEFOVF9PRl9EQVkgLT4gZGF5cyhcbiAgICAgICAgICAgICAgICAgICAgMVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICBEYXRhVHlwZS5JTlNUQU5UX09GX01PTlRIIC0+IG1vbnRocyhcbiAgICAgICAgICAgICAgICAgICAgMVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICBEYXRhVHlwZS5JTlNUQU5UX09GX1FVQVJURVIgLT4gcXVhcnRlcihcbiAgICAgICAgICAgICAgICAgICAgMVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICBEYXRhVHlwZS5JTlNUQU5UX09GX0hBTEZfWUVBUiAtPiBzZW1lc3RlcihcbiAgICAgICAgICAgICAgICAgICAgMVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICBEYXRhVHlwZS5JTlNUQU5UX09GX1lFQVIgLT4geWVhcnMoXG4gICAgICAgICAgICAgICAgICAgIDFcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgZWxzZSAtPiB0aHJvdyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oXCJDYW4ndCBjcmVhdGUgaW50ZXJ2YWwgZnJvbSBkYXRhIHR5cGU6ICRkYXRhVHlwZVwiKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuIiwiLypcbiAqIENvcHlyaWdodCAoYykgMjAxOS4gSmV0QnJhaW5zIHMuci5vLlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgdGhlIE1JVCBsaWNlbnNlIHRoYXQgY2FuIGJlIGZvdW5k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ZS5maXJzdERheU9mKHllYXIgKyAxKSlcbiAgICB9XG5cbiAgICBjb21wYW5pb24gb2JqZWN0IHtcbiAgICAgICAgY29uc3QgdmFsIFRJQ0tfRk9STUFUID0gXCIlWVwiXG4gICAgICAgIGNvbnN0IHZhbCBNUyA9IDMxNTM2ZTZcbiAgICAgICAgdmFsIFRJQ0tfRk9STUFUVEVSID0gRm9ybWF0dGVyLnRpbWUoVElDS19GT1JNQVQpXG4gICAgfVxufVxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./kotlin-dce-dev/lets-plot-plot-common-portable.js\n"); /***/ }), @@ -205,7 +205,7 @@ eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPAC \**********************************************************/ /***/ (function(module, exports, __webpack_require__) { -eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) {\n if (true)\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(/*! kotlin */ \"./kotlin-dce-dev/kotlin.js\"), __webpack_require__(/*! lets-plot-base-portable */ \"./kotlin-dce-dev/lets-plot-base-portable.js\"), __webpack_require__(/*! lets-plot-plot-builder-portable */ \"./kotlin-dce-dev/lets-plot-plot-builder-portable.js\"), __webpack_require__(/*! lets-plot-vis-svg-portable */ \"./kotlin-dce-dev/lets-plot-vis-svg-portable.js\"), __webpack_require__(/*! lets-plot-plot-base-portable */ \"./kotlin-dce-dev/lets-plot-plot-base-portable.js\"), __webpack_require__(/*! lets-plot-plot-common-portable */ \"./kotlin-dce-dev/lets-plot-plot-common-portable.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n else {}\n}(this, function (_, Kotlin, $module$lets_plot_base_portable, $module$lets_plot_plot_builder_portable, $module$lets_plot_vis_svg_portable, $module$lets_plot_plot_base_portable, $module$lets_plot_plot_common_portable) {\n 'use strict';\n var $$importsForInline$$ = _.$$importsForInline$$ || (_.$$importsForInline$$ = {});\n var replace = Kotlin.kotlin.text.replace_680rmw$;\n var json = $module$lets_plot_base_portable.jetbrains.datalore.base.json;\n var MutableMap = Kotlin.kotlin.collections.MutableMap;\n var throwCCE = Kotlin.throwCCE;\n var RuntimeException_init = Kotlin.kotlin.RuntimeException_init_pdl1vj$;\n var PlotContainerPortable = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.PlotContainerPortable;\n var listOf = Kotlin.kotlin.collections.listOf_mh5how$;\n var toString = Kotlin.toString;\n var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_287e2$;\n var DoubleVector = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleVector;\n var Unit = Kotlin.kotlin.Unit;\n var ValueProperty = $module$lets_plot_base_portable.jetbrains.datalore.base.observable.property.ValueProperty;\n var Kind_CLASS = Kotlin.Kind.CLASS;\n var DoubleRectangle = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleRectangle;\n var Kind_OBJECT = Kotlin.Kind.OBJECT;\n var addAll = Kotlin.kotlin.collections.addAll_ipc267$;\n var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$;\n var ArrayList_init_0 = Kotlin.kotlin.collections.ArrayList_init_ww73n8$;\n var trimMargin = Kotlin.kotlin.text.trimMargin_rjktp$;\n var round = Kotlin.kotlin.math.round_14dthe$;\n var numberToInt = Kotlin.numberToInt;\n var joinToString = Kotlin.kotlin.collections.joinToString_fmv235$;\n var trimIndent = Kotlin.kotlin.text.trimIndent_pdl1vz$;\n var RuntimeException = Kotlin.kotlin.RuntimeException;\n var contains = Kotlin.kotlin.text.contains_li3zpu$;\n var random = $module$lets_plot_base_portable.jetbrains.datalore.base.random;\n var jsObject = $module$lets_plot_base_portable.jetbrains.datalore.base.jsObject;\n var IllegalArgumentException_init = Kotlin.kotlin.IllegalArgumentException_init_pdl1vj$;\n var PlotFacets = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.PlotFacets;\n var Map = Kotlin.kotlin.collections.Map;\n var Regex_init = Kotlin.kotlin.text.Regex_init_61zpoe$;\n var ensureNotNull = Kotlin.ensureNotNull;\n var toDouble = Kotlin.kotlin.text.toDouble_pdl1vz$;\n var JsMath = Math;\n var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init_pdl1vj$;\n var zip = Kotlin.kotlin.collections.zip_45mdf7$;\n var DoubleRectangle_init = $module$lets_plot_base_portable.jetbrains.datalore.base.geometry.DoubleRectangle_init_6y0v78$;\n var split = Kotlin.kotlin.text.split_ip8yn$;\n var indexOf = Kotlin.kotlin.text.indexOf_l5u8uk$;\n var Pair = Kotlin.kotlin.Pair;\n var logging = $module$lets_plot_base_portable.jetbrains.datalore.base.logging;\n var getKClass = Kotlin.getKClass;\n var SvgToString = $module$lets_plot_vis_svg_portable.jetbrains.datalore.vis.svgToString.SvgToString;\n var ArrowSpec$End = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.util.ArrowSpec.End;\n var ArrowSpec$Type = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.util.ArrowSpec.Type;\n var toRadians = $module$lets_plot_base_portable.jetbrains.datalore.base.math.toRadians_14dthe$;\n var ArrowSpec = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.util.ArrowSpec;\n var equals = Kotlin.equals;\n var DataFrame$Builder = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.DataFrame.Builder;\n var data = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.data;\n var until = Kotlin.kotlin.ranges.until_dqglrj$;\n var toSet = Kotlin.kotlin.collections.toSet_7wnvza$;\n var HashMap_init = Kotlin.kotlin.collections.HashMap_init_q3lmfv$;\n var filterNotNull = Kotlin.kotlin.collections.filterNotNull_m3lr2h$;\n var toMutableSet = Kotlin.kotlin.collections.toMutableSet_7wnvza$;\n var DataFrame$DataFrame$Builder_init = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.DataFrame.Builder_init;\n var emptyMap = Kotlin.kotlin.collections.emptyMap_q3lmfv$;\n var List = Kotlin.kotlin.collections.List;\n var numberToDouble = Kotlin.numberToDouble;\n var Iterable = Kotlin.kotlin.collections.Iterable;\n var NumberFormatException = Kotlin.kotlin.NumberFormatException;\n var checkIndexOverflow = Kotlin.kotlin.collections.checkIndexOverflow_za3lpa$;\n var coord = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.coord;\n var startsWith = Kotlin.kotlin.text.startsWith_7epoxm$;\n var removePrefix = Kotlin.kotlin.text.removePrefix_gsj5wt$;\n var emptyList = Kotlin.kotlin.collections.emptyList_287e2$;\n var to = Kotlin.kotlin.to_ujzrz7$;\n var getCallableRef = Kotlin.getCallableRef;\n var emptySet = Kotlin.kotlin.collections.emptySet_287e2$;\n var flatten = Kotlin.kotlin.collections.flatten_u0ad8z$;\n var plus = Kotlin.kotlin.collections.plus_mydzjv$;\n var mutableMapOf = Kotlin.kotlin.collections.mutableMapOf_qfcya0$;\n var DataFrame$DataFrame$Builder_init_0 = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.DataFrame.Builder_init_dhhkv7$;\n var contains_0 = Kotlin.kotlin.collections.contains_2ws7j4$;\n var minus = Kotlin.kotlin.collections.minus_khz7k3$;\n var plus_0 = Kotlin.kotlin.collections.plus_khz7k3$;\n var plus_1 = Kotlin.kotlin.collections.plus_iwxh38$;\n var OrderOptionUtil$OrderOption = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.data.OrderOptionUtil.OrderOption;\n var mapCapacity = Kotlin.kotlin.collections.mapCapacity_za3lpa$;\n var coerceAtLeast = Kotlin.kotlin.ranges.coerceAtLeast_dqglrj$;\n var LinkedHashMap_init = Kotlin.kotlin.collections.LinkedHashMap_init_bwtc7$;\n var LinkedHashMap_init_0 = Kotlin.kotlin.collections.LinkedHashMap_init_q3lmfv$;\n var LinkedHashSet_init = Kotlin.kotlin.collections.LinkedHashSet_init_287e2$;\n var ArrayList_init_1 = Kotlin.kotlin.collections.ArrayList_init_mqih57$;\n var FacetGrid = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.facet.FacetGrid;\n var HashSet_init = Kotlin.kotlin.collections.HashSet_init_287e2$;\n var toList = Kotlin.kotlin.collections.toList_7wnvza$;\n var take = Kotlin.kotlin.collections.take_ba2ldo$;\n var FacetWrap = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.facet.FacetWrap;\n var FacetWrap$Direction = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.facet.FacetWrap.Direction;\n var StringFormat = $module$lets_plot_base_portable.jetbrains.datalore.base.stringFormat.StringFormat;\n var base = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.base;\n var IllegalStateException = Kotlin.kotlin.IllegalStateException;\n var IllegalArgumentException = Kotlin.kotlin.IllegalArgumentException;\n var isBlank = Kotlin.kotlin.text.isBlank_gw00vp$;\n var Aes = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.Aes;\n var spatial = $module$lets_plot_base_portable.jetbrains.datalore.base.spatial;\n var DataFrame$Variable = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.DataFrame.Variable;\n var SimpleFeature$Consumer = $module$lets_plot_base_portable.jetbrains.datalore.base.spatial.SimpleFeature.Consumer;\n var firstOrNull = Kotlin.kotlin.collections.firstOrNull_7wnvza$;\n var asSequence = Kotlin.kotlin.collections.asSequence_7wnvza$;\n var flatten_0 = Kotlin.kotlin.sequences.flatten_d9bjs1$;\n var union = $module$lets_plot_base_portable.jetbrains.datalore.base.spatial.union_86o20w$;\n var convertToGeoRectangle = $module$lets_plot_base_portable.jetbrains.datalore.base.spatial.convertToGeoRectangle_i3vl8m$;\n var boundingBox = $module$lets_plot_base_portable.jetbrains.datalore.base.typedGeometry.boundingBox_gyuce3$;\n var limit = $module$lets_plot_base_portable.jetbrains.datalore.base.typedGeometry.limit_106pae$;\n var limit_0 = $module$lets_plot_base_portable.jetbrains.datalore.base.typedGeometry.limit_lddjmn$;\n var get_left = $module$lets_plot_base_portable.jetbrains.datalore.base.typedGeometry.get_left_h9e6jg$;\n var get_right = $module$lets_plot_base_portable.jetbrains.datalore.base.typedGeometry.get_right_h9e6jg$;\n var get_top = $module$lets_plot_base_portable.jetbrains.datalore.base.typedGeometry.get_top_h9e6jg$;\n var get_bottom = $module$lets_plot_base_portable.jetbrains.datalore.base.typedGeometry.get_bottom_h9e6jg$;\n var mapOf = Kotlin.kotlin.collections.mapOf_qfcya0$;\n var Result = Kotlin.kotlin.Result;\n var Throwable = Error;\n var createFailure = Kotlin.kotlin.createFailure_tcv7n7$;\n var Any = Object;\n var Collection = Kotlin.kotlin.collections.Collection;\n var minus_0 = Kotlin.kotlin.collections.minus_q4559j$;\n var GeomKind = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.GeomKind;\n var listOf_0 = Kotlin.kotlin.collections.listOf_i5x0yv$;\n var base_0 = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base;\n var removeAll = Kotlin.kotlin.collections.removeAll_qafx1e$;\n var GeomInteractionBuilder = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.interact.GeomInteractionBuilder;\n var GeomTargetLocator$LookupStrategy = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupStrategy;\n var geom = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.geom;\n var sampling = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.sampling;\n var PosProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.PosProvider;\n var pos = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.pos;\n var mapOf_0 = Kotlin.kotlin.collections.mapOf_x2b85n$;\n var GeomKind$values = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.GeomKind.values;\n var GeomProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.geom.GeomProvider;\n var CrossBarGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.CrossBarGeom;\n var PointRangeGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.PointRangeGeom;\n var BoxplotGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.BoxplotGeom;\n var StepGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.StepGeom;\n var SegmentGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.SegmentGeom;\n var PathGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.PathGeom;\n var PointGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.PointGeom;\n var TextGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.TextGeom;\n var ImageGeom = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.geom.ImageGeom;\n var GuideOptions = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.GuideOptions;\n var LegendOptions = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.LegendOptions;\n var Runnable = $module$lets_plot_base_portable.jetbrains.datalore.base.function.Runnable;\n var ColorBarOptions = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.ColorBarOptions;\n var data_0 = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.data;\n var HashSet_init_0 = Kotlin.kotlin.collections.HashSet_init_mqih57$;\n var stat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat;\n var minus_1 = Kotlin.kotlin.collections.minus_uk696c$;\n var TooltipSpecification = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.tooltip.TooltipSpecification;\n var getPropertyCallableRef = Kotlin.getPropertyCallableRef;\n var data_1 = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.data;\n var Grouping = Kotlin.kotlin.collections.Grouping;\n var VarBinding = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.VarBinding;\n var first = Kotlin.kotlin.collections.first_2p1efm$;\n var LivemapConstants$DisplayMode = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.livemap.LivemapConstants.DisplayMode;\n var LivemapConstants$Projection = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.livemap.LivemapConstants.Projection;\n var LiveMapOptions = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.livemap.LiveMapOptions;\n var joinToString_0 = Kotlin.kotlin.collections.joinToString_cgipc5$;\n var LivemapConstants$DisplayMode$valueOf = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.livemap.LivemapConstants.DisplayMode.valueOf_61zpoe$;\n var LivemapConstants$DisplayMode$values = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.livemap.LivemapConstants.DisplayMode.values;\n var Exception = Kotlin.kotlin.Exception;\n var LivemapConstants$Projection$valueOf = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.livemap.LivemapConstants.Projection.valueOf_61zpoe$;\n var LivemapConstants$Projection$values = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.livemap.LivemapConstants.Projection.values;\n var checkCountOverflow = Kotlin.kotlin.collections.checkCountOverflow_za3lpa$;\n var last = Kotlin.kotlin.collections.last_2p1efm$;\n var ClosedRange = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect.ClosedRange;\n var numberToLong = Kotlin.numberToLong;\n var firstOrNull_0 = Kotlin.kotlin.collections.firstOrNull_2p1efm$;\n var dropLast = Kotlin.kotlin.collections.dropLast_8ujjk8$;\n var last_0 = Kotlin.kotlin.collections.last_us0mfu$;\n var toList_0 = Kotlin.kotlin.collections.toList_us0mfu$;\n var MutableList = Kotlin.kotlin.collections.MutableList;\n var PlotAssembler = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.PlotAssembler;\n var GeomLayerBuilder = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.GeomLayerBuilder;\n var distinct = Kotlin.kotlin.collections.distinct_7wnvza$;\n var collect = $module$lets_plot_base_portable.jetbrains.datalore.base.gcommon.collect;\n var setOf = Kotlin.kotlin.collections.setOf_i5x0yv$;\n var scale = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale;\n var toMap = Kotlin.kotlin.collections.toMap_6hr0sd$;\n var getValue = Kotlin.kotlin.collections.getValue_t9ocha$;\n var DiscreteTransform = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.DiscreteTransform;\n var transform = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.scale.transform;\n var ContinuousTransform = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.ContinuousTransform;\n var TypedScaleMap = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.assemble.TypedScaleMap;\n var DiscreteOnlyMapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.DiscreteOnlyMapperProvider;\n var ContinuousOnlyMapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.ContinuousOnlyMapperProvider;\n var HashMap_init_0 = Kotlin.kotlin.collections.HashMap_init_73mtqc$;\n var mapper = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.mapper;\n var AlphaMapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.provider.AlphaMapperProvider;\n var SizeMapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.provider.SizeMapperProvider;\n var Color = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Color;\n var ColorGradientMapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.provider.ColorGradientMapperProvider;\n var ColorGradient2MapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.provider.ColorGradient2MapperProvider;\n var ColorHueMapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.provider.ColorHueMapperProvider;\n var GreyscaleLightnessMapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.provider.GreyscaleLightnessMapperProvider;\n var ColorBrewerMapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.provider.ColorBrewerMapperProvider;\n var SizeAreaMapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.provider.SizeAreaMapperProvider;\n var ScaleProviderBuilder = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.ScaleProviderBuilder;\n var MapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.MapperProvider;\n var text = $module$lets_plot_plot_common_portable.jetbrains.datalore.plot.common.text;\n var DateTimeBreaksGen = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.scale.transform.DateTimeBreaksGen;\n var IdentityDiscreteMapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.provider.IdentityDiscreteMapperProvider;\n var scale_0 = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.scale;\n var IdentityMapperProvider = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.scale.provider.IdentityMapperProvider;\n var Enum = Kotlin.kotlin.Enum;\n var throwISE = Kotlin.throwISE;\n var EnumInfoImpl_init = $module$lets_plot_base_portable.jetbrains.datalore.base.enums.EnumInfoImpl;\n var Bin2dStat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.Bin2dStat;\n var ContourStat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.ContourStat;\n var ContourfStat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.ContourfStat;\n var BoxplotStat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.BoxplotStat;\n var SmoothStat$Method = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.SmoothStat.Method;\n var SmoothStat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.SmoothStat;\n var SmoothStat$Companion$DEF_SAMPLING_SEED = Kotlin.Long.fromInt(37);\n var CorrelationStat$Method = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.CorrelationStat.Method;\n var CorrelationStat$Type = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.CorrelationStat.Type;\n var CorrelationStat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.CorrelationStat;\n var DensityStat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.DensityStat;\n var AbstractDensity2dStat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.AbstractDensity2dStat;\n var Density2dfStat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.Density2dfStat;\n var Density2dStat = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.stat.Density2dStat;\n var TooltipSpecification$TooltipProperties = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.tooltip.TooltipSpecification.TooltipProperties;\n var substringAfter = Kotlin.kotlin.text.substringAfter_j4ogox$;\n var TooltipLine = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.tooltip.TooltipLine;\n var DataFrameValue = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.tooltip.DataFrameValue;\n var MappingValue = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.tooltip.MappingValue;\n var ConstantValue = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.tooltip.ConstantValue;\n var toList_1 = Kotlin.kotlin.collections.toList_abgq59$;\n var removeSurrounding = Kotlin.kotlin.text.removeSurrounding_90ijwr$;\n var substringBefore = Kotlin.kotlin.text.substringBefore_j4ogox$;\n var TooltipAnchor$VerticalAnchor = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.TooltipAnchor.VerticalAnchor;\n var TooltipAnchor$HorizontalAnchor = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.TooltipAnchor.HorizontalAnchor;\n var TooltipAnchor = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.interact.TooltipAnchor;\n var values = $module$lets_plot_base_portable.jetbrains.datalore.base.values;\n var toMutableMap = Kotlin.kotlin.collections.toMutableMap_abgq59$;\n var StringBuilder_init = Kotlin.kotlin.text.StringBuilder_init_za3lpa$;\n var trim = Kotlin.kotlin.text.trim_gw00vp$;\n var Function = $module$lets_plot_base_portable.jetbrains.datalore.base.function.Function;\n var NamedLineType = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.linetype.NamedLineType;\n var LineType = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.linetype.LineType;\n var NamedLineType$values = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.linetype.NamedLineType.values;\n var PointShape = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.point.PointShape;\n var point = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.point;\n var NamedShape = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.point.NamedShape;\n var NamedShape$values = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.render.point.NamedShape.values;\n var roundToInt = Kotlin.kotlin.math.roundToInt_yrwdxr$;\n var abs = Kotlin.kotlin.math.abs_za3lpa$;\n var AxisTheme = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.theme.AxisTheme;\n var LegendPosition = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.guide.LegendPosition;\n var LegendJustification = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.guide.LegendJustification;\n var LegendDirection = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.guide.LegendDirection;\n var LegendTheme = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.theme.LegendTheme;\n var Theme = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.theme.Theme;\n var DefaultTheme = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.theme.DefaultTheme;\n var Kind_INTERFACE = Kotlin.Kind.INTERFACE;\n var hashCode = Kotlin.hashCode;\n var copyToArray = Kotlin.kotlin.collections.copyToArray;\n var kotlin_js_internal_DoubleCompanionObject = Kotlin.kotlin.js.internal.DoubleCompanionObject;\n var isFinite = Kotlin.kotlin.isFinite_yrwdxr$;\n var StatContext = $module$lets_plot_plot_base_portable.jetbrains.datalore.plot.base.StatContext;\n var Pair_0 = $module$lets_plot_base_portable.jetbrains.datalore.base.values.Pair;\n var GroupingContext = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.data.GroupingContext;\n var plus_2 = Kotlin.kotlin.collections.plus_xfiyik$;\n var listOfNotNull = Kotlin.kotlin.collections.listOfNotNull_issdgt$;\n var PointSampling = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.sampling.PointSampling;\n var GroupAwareSampling = $module$lets_plot_plot_builder_portable.jetbrains.datalore.plot.builder.sampling.GroupAwareSampling;\n var Set = Kotlin.kotlin.collections.Set;\n MonolithicCommon$PlotsBuildResult$Error.prototype = Object.create(MonolithicCommon$PlotsBuildResult.prototype);\n MonolithicCommon$PlotsBuildResult$Error.prototype.constructor = MonolithicCommon$PlotsBuildResult$Error;\n MonolithicCommon$PlotsBuildResult$Success.prototype = Object.create(MonolithicCommon$PlotsBuildResult.prototype);\n MonolithicCommon$PlotsBuildResult$Success.prototype.constructor = MonolithicCommon$PlotsBuildResult$Success;\n ArrowSpecConfig.prototype = Object.create(OptionsAccessor.prototype);\n ArrowSpecConfig.prototype.constructor = ArrowSpecConfig;\n BunchConfig.prototype = Object.create(OptionsAccessor.prototype);\n BunchConfig.prototype.constructor = BunchConfig;\n CoordConfig.prototype = Object.create(OptionsAccessor.prototype);\n CoordConfig.prototype.constructor = CoordConfig;\n FacetConfig.prototype = Object.create(OptionsAccessor.prototype);\n FacetConfig.prototype.constructor = FacetConfig;\n CoordinatesCollector$PointCoordinatesCollector.prototype = Object.create(CoordinatesCollector.prototype);\n CoordinatesCollector$PointCoordinatesCollector.prototype.constructor = CoordinatesCollector$PointCoordinatesCollector;\n CoordinatesCollector$PathCoordinatesCollector.prototype = Object.create(CoordinatesCollector.prototype);\n CoordinatesCollector$PathCoordinatesCollector.prototype.constructor = CoordinatesCollector$PathCoordinatesCollector;\n CoordinatesCollector$BoundaryCoordinatesCollector.prototype = Object.create(CoordinatesCollector.prototype);\n CoordinatesCollector$BoundaryCoordinatesCollector.prototype.constructor = CoordinatesCollector$BoundaryCoordinatesCollector;\n CoordinatesCollector$BboxCoordinatesCollector.prototype = Object.create(CoordinatesCollector.prototype);\n CoordinatesCollector$BboxCoordinatesCollector.prototype.constructor = CoordinatesCollector$BboxCoordinatesCollector;\n GeomProtoClientSide.prototype = Object.create(GeomProto.prototype);\n GeomProtoClientSide.prototype.constructor = GeomProtoClientSide;\n GuideConfig.prototype = Object.create(OptionsAccessor.prototype);\n GuideConfig.prototype.constructor = GuideConfig;\n GuideConfig$GuideNoneConfig.prototype = Object.create(GuideConfig.prototype);\n GuideConfig$GuideNoneConfig.prototype.constructor = GuideConfig$GuideNoneConfig;\n GuideConfig$LegendConfig.prototype = Object.create(GuideConfig.prototype);\n GuideConfig$LegendConfig.prototype.constructor = GuideConfig$LegendConfig;\n GuideConfig$ColorBarConfig.prototype = Object.create(GuideConfig.prototype);\n GuideConfig$ColorBarConfig.prototype.constructor = GuideConfig$ColorBarConfig;\n LayerConfig.prototype = Object.create(OptionsAccessor.prototype);\n LayerConfig.prototype.constructor = LayerConfig;\n PlotConfig.prototype = Object.create(OptionsAccessor.prototype);\n PlotConfig.prototype.constructor = PlotConfig;\n PlotConfigClientSide.prototype = Object.create(PlotConfig.prototype);\n PlotConfigClientSide.prototype.constructor = PlotConfigClientSide;\n PosConfig.prototype = Object.create(OptionsAccessor.prototype);\n PosConfig.prototype.constructor = PosConfig;\n ScaleConfig.prototype = Object.create(OptionsAccessor.prototype);\n ScaleConfig.prototype.constructor = ScaleConfig;\n StatKind.prototype = Object.create(Enum.prototype);\n StatKind.prototype.constructor = StatKind;\n TooltipConfig.prototype = Object.create(OptionsAccessor.prototype);\n TooltipConfig.prototype.constructor = TooltipConfig;\n AxisThemeConfig.prototype = Object.create(OptionsAccessor.prototype);\n AxisThemeConfig.prototype.constructor = AxisThemeConfig;\n LegendThemeConfig.prototype = Object.create(OptionsAccessor.prototype);\n LegendThemeConfig.prototype.constructor = LegendThemeConfig;\n ThemeConfig$OneTileTheme.prototype = Object.create(ThemeConfig$ConfiguredTheme.prototype);\n ThemeConfig$OneTileTheme.prototype.constructor = ThemeConfig$OneTileTheme;\n ThemeConfig$MultiTileTheme.prototype = Object.create(ThemeConfig$ConfiguredTheme.prototype);\n ThemeConfig$MultiTileTheme.prototype.constructor = ThemeConfig$MultiTileTheme;\n ViewElementConfig.prototype = Object.create(OptionsAccessor.prototype);\n ViewElementConfig.prototype.constructor = ViewElementConfig;\n PlotSpecTransformUtil$TargetSpec.prototype = Object.create(Enum.prototype);\n PlotSpecTransformUtil$TargetSpec.prototype.constructor = PlotSpecTransformUtil$TargetSpec;\n PlotConfigServerSide.prototype = Object.create(PlotConfig.prototype);\n PlotConfigServerSide.prototype.constructor = PlotConfigServerSide;\n function parsePlotSpec(spec) {\n var it = replace(spec, \"'\", '\"');\n var tmp$;\n return Kotlin.isType(tmp$ = json.JsonSupport.parseJson_61zpoe$(it), MutableMap) ? tmp$ : throwCCE();\n }\n function MonolithicCommon() {\n MonolithicCommon_instance = this;\n }\n MonolithicCommon.prototype.buildSvgImagesFromRawSpecs_k2v8cf$ = function (plotSpec, plotSize, svgToString, computationMessagesHandler) {\n var tmp$, tmp$_0;\n var plotSpec_0 = this.processRawSpecs_lqxyja$(plotSpec, false);\n var buildResult = this.buildPlotsFromProcessedSpecs_rim63o$(plotSpec_0, plotSize, null);\n if (buildResult.isError) {\n var errorMessage = (Kotlin.isType(tmp$ = buildResult, MonolithicCommon$PlotsBuildResult$Error) ? tmp$ : throwCCE()).error;\n throw RuntimeException_init(errorMessage);\n }var success = Kotlin.isType(tmp$_0 = buildResult, MonolithicCommon$PlotsBuildResult$Success) ? tmp$_0 : throwCCE();\n var $receiver = success.buildInfos;\n var destination = ArrayList_init();\n var tmp$_1;\n tmp$_1 = $receiver.iterator();\n while (tmp$_1.hasNext()) {\n var element = tmp$_1.next();\n var list = element.computationMessages;\n addAll(destination, list);\n }\n var computationMessages = destination;\n if (!computationMessages.isEmpty()) {\n computationMessagesHandler(computationMessages);\n }var $receiver_0 = success.buildInfos;\n var destination_0 = ArrayList_init_0(collectionSizeOrDefault($receiver_0, 10));\n var tmp$_2;\n tmp$_2 = $receiver_0.iterator();\n while (tmp$_2.hasNext()) {\n var item = tmp$_2.next();\n var tmp$_3 = destination_0.add_11rb$;\n var assembler = item.plotAssembler;\n var plot = assembler.createPlot();\n var plotContainer = new PlotContainerPortable(plot, item.size);\n plotContainer.ensureContentBuilt();\n tmp$_3.call(destination_0, plotContainer.svg);\n }\n var destination_1 = ArrayList_init_0(collectionSizeOrDefault(destination_0, 10));\n var tmp$_4;\n tmp$_4 = destination_0.iterator();\n while (tmp$_4.hasNext()) {\n var item_0 = tmp$_4.next();\n destination_1.add_11rb$(svgToString.render_5lup6a$(item_0));\n }\n return destination_1;\n };\n MonolithicCommon.prototype.buildPlotsFromProcessedSpecs_rim63o$ = function (plotSpec, plotSize, plotMaxWidth) {\n var tmp$;\n this.throwTestingErrors_0();\n PlotConfig$Companion_getInstance().assertPlotSpecOrErrorMessage_x7u0o8$(plotSpec);\n if (PlotConfig$Companion_getInstance().isFailure_x7u0o8$(plotSpec)) {\n var errorMessage = PlotConfig$Companion_getInstance().getErrorMessage_x7u0o8$(plotSpec);\n return new MonolithicCommon$PlotsBuildResult$Error(errorMessage);\n }if (PlotConfig$Companion_getInstance().isPlotSpec_bkhwtg$(plotSpec))\n tmp$ = new MonolithicCommon$PlotsBuildResult$Success(listOf(this.buildSinglePlotFromProcessedSpecs_0(plotSpec, plotSize, plotMaxWidth)));\n else if (PlotConfig$Companion_getInstance().isGGBunchSpec_bkhwtg$(plotSpec))\n tmp$ = this.buildGGBunchFromProcessedSpecs_0(plotSpec);\n else\n throw RuntimeException_init('Unexpected plot spec kind: ' + toString(PlotConfig$Companion_getInstance().specKind_bkhwtg$(plotSpec)));\n return tmp$;\n };\n MonolithicCommon.prototype.buildGGBunchFromProcessedSpecs_0 = function (bunchSpec) {\n var tmp$, tmp$_0;\n var bunchConfig = new BunchConfig(bunchSpec);\n if (bunchConfig.bunchItems.isEmpty())\n return new MonolithicCommon$PlotsBuildResult$Error('No plots in the bunch');\n var buildInfos = ArrayList_init();\n tmp$ = bunchConfig.bunchItems.iterator();\n while (tmp$.hasNext()) {\n var bunchItem = tmp$.next();\n var plotSpec = Kotlin.isType(tmp$_0 = bunchItem.featureSpec, MutableMap) ? tmp$_0 : throwCCE();\n var buildInfo = this.buildSinglePlotFromProcessedSpecs_0(plotSpec, PlotSizeHelper_getInstance().bunchItemSize_6ixfn5$(bunchItem), null);\n buildInfo = new MonolithicCommon$PlotBuildInfo(buildInfo.plotAssembler, buildInfo.processedPlotSpec, new DoubleVector(bunchItem.x, bunchItem.y), buildInfo.size, buildInfo.computationMessages);\n buildInfos.add_11rb$(buildInfo);\n }\n return new MonolithicCommon$PlotsBuildResult$Success(buildInfos);\n };\n function MonolithicCommon$buildSinglePlotFromProcessedSpecs$lambda(closure$computationMessages) {\n return function (it) {\n closure$computationMessages.addAll_brywnq$(it);\n return Unit;\n };\n }\n MonolithicCommon.prototype.buildSinglePlotFromProcessedSpecs_0 = function (plotSpec, plotSize, plotMaxWidth) {\n var computationMessages = ArrayList_init();\n var config = PlotConfigClientSide$Companion_getInstance().create_vb0rb2$(plotSpec, MonolithicCommon$buildSinglePlotFromProcessedSpecs$lambda(computationMessages));\n var preferredSize = new ValueProperty(PlotSizeHelper_getInstance().singlePlotSize_k8r1k3$(plotSpec, plotSize, plotMaxWidth, config.facets, config.containsLiveMap));\n var assembler = this.createPlotAssembler_rwfsgt$(config);\n return new MonolithicCommon$PlotBuildInfo(assembler, plotSpec, DoubleVector.Companion.ZERO, preferredSize, computationMessages);\n };\n MonolithicCommon.prototype.createPlotAssembler_rwfsgt$ = function (config) {\n return PlotConfigClientSideUtil_getInstance().createPlotAssembler_6u1zvq$(config);\n };\n MonolithicCommon.prototype.throwTestingErrors_0 = function () {\n };\n MonolithicCommon.prototype.processRawSpecs_lqxyja$ = function (plotSpec, frontendOnly) {\n var tmp$;\n PlotConfig$Companion_getInstance().assertPlotSpecOrErrorMessage_x7u0o8$(plotSpec);\n if (PlotConfig$Companion_getInstance().isFailure_x7u0o8$(plotSpec)) {\n return plotSpec;\n }if (frontendOnly) {\n tmp$ = plotSpec;\n } else {\n tmp$ = PlotConfigServerSide$Companion_getInstance().processTransform_2wxo1b$(plotSpec);\n }\n var plotSpec_0 = tmp$;\n if (PlotConfig$Companion_getInstance().isFailure_x7u0o8$(plotSpec_0)) {\n return plotSpec_0;\n }return PlotConfigClientSide$Companion_getInstance().processTransform_2wxo1b$(plotSpec_0);\n };\n function MonolithicCommon$PlotsBuildResult() {\n this.isError = Kotlin.isType(this, MonolithicCommon$PlotsBuildResult$Error);\n }\n function MonolithicCommon$PlotsBuildResult$Error(error) {\n MonolithicCommon$PlotsBuildResult.call(this);\n this.error = error;\n }\n MonolithicCommon$PlotsBuildResult$Error.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Error',\n interfaces: [MonolithicCommon$PlotsBuildResult]\n };\n function MonolithicCommon$PlotsBuildResult$Success(buildInfos) {\n MonolithicCommon$PlotsBuildResult.call(this);\n this.buildInfos = buildInfos;\n }\n MonolithicCommon$PlotsBuildResult$Success.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'Success',\n interfaces: [MonolithicCommon$PlotsBuildResult]\n };\n MonolithicCommon$PlotsBuildResult.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotsBuildResult',\n interfaces: []\n };\n function MonolithicCommon$PlotBuildInfo(plotAssembler, processedPlotSpec, origin, size, computationMessages) {\n this.plotAssembler = plotAssembler;\n this.processedPlotSpec = processedPlotSpec;\n this.origin = origin;\n this.size = size;\n this.computationMessages = computationMessages;\n }\n MonolithicCommon$PlotBuildInfo.prototype.bounds = function () {\n return new DoubleRectangle(this.origin, this.size.get());\n };\n MonolithicCommon$PlotBuildInfo.$metadata$ = {\n kind: Kind_CLASS,\n simpleName: 'PlotBuildInfo',\n interfaces: []\n };\n MonolithicCommon.$metadata$ = {\n kind: Kind_OBJECT,\n simpleName: 'MonolithicCommon',\n interfaces: []\n };\n var MonolithicCommon_instance = null;\n function MonolithicCommon_getInstance() {\n if (MonolithicCommon_instance === null) {\n new MonolithicCommon();\n }return MonolithicCommon_instance;\n }\n function PlotHtmlExport() {\n PlotHtmlExport_instance = this;\n }\n PlotHtmlExport.prototype.buildHtmlFromRawSpecs_dmb0ma$ = function (plotSpec, scriptUrl, iFrame, plotSize) {\n if (iFrame === void 0)\n iFrame = false;\n if (plotSize === void 0)\n plotSize = null;\n var tmp$, tmp$_0;\n var configureHtml = PlotHtmlHelper_getInstance().getStaticConfigureHtml_61zpoe$(scriptUrl);\n var displayHtml = PlotHtmlHelper_getInstance().getStaticDisplayHtmlForRawSpec_xfa7ld$(plotSpec, plotSize);\n if (iFrame) {\n tmp$ = '\\n \n '),E('\n |\n |'+Wp+'\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | Lunch\n | \n | \n | \n | \n | \n | \n | \n | \n | Dinner\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | 0.0\n | \n | \n | \n | \n | \n | \n | \n | \n | 0.5\n | \n | \n | \n | \n | \n | \n | \n | \n | 1.0\n | \n | \n | \n | \n | \n | \n | \n | \n | 1.5\n | \n | \n | \n | \n | \n | \n | \n | \n | 2.0\n | \n | \n | \n | \n | \n | \n | \n | \n | 2.5\n | \n | \n | \n | \n | \n | \n | \n | \n | 3.0\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | count\n | \n | \n | \n | \n | \n | \n | time\n | \n | \n | \n | \n |\n '),E('\n |\n |\n |\n | \n | \n | \n | \n | \n | \n | \n | 1\n | \n | \n | \n | \n | \n | \n | \n | \n | 2\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | 0\n | \n | \n | \n | \n | \n | \n | \n | \n | 1\n | \n | \n | \n | \n | \n | \n | \n | \n | 2\n | \n | \n | \n | \n | \n | \n | \n | \n | 3\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | b\n | \n | \n | \n | \n | \n | \n | a\n | \n | \n | \n | \n |\n |\n | \n | \n | \n | \n | \n | \n | \n | 1\n | \n | \n | \n | \n | \n | \n | \n | \n | 2\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | 0\n | \n | \n | \n | \n | \n | \n | \n | \n | 1\n | \n | \n | \n | \n | \n | \n | \n | \n | 2\n | \n | \n | \n | \n | \n | \n | \n | \n | 3\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | b\n | \n | \n | \n | \n | \n | \n | a\n | \n | \n | \n | \n |\n |\n '),t})?i.apply(e,r):i)||(t.exports=o)},698:function(t,e,n){var i,r,o;r=[e,n(421),n(770),n(767),n(836),n(52),n(958),n(623)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o,a,s){"use strict";e.kotlin.io.println_s8jyv4$,e.kotlin.Unit;var l=n.jetbrains.datalore.plot.config.PlotConfig,u=e.kotlin.IllegalArgumentException_init_pdl1vj$,c=n.jetbrains.datalore.plot.config.PlotConfigClientSide,p=(n.jetbrains.datalore.plot.config,n.jetbrains.datalore.plot.server.config.PlotConfigServerSide,i.jetbrains.datalore.base.geometry.DoubleVector,e.kotlin.collections.ArrayList_init_287e2$),h=e.kotlin.collections.HashMap_init_q3lmfv$,_=e.kotlin.collections.Map,f=(e.kotlin.collections.emptyMap_q3lmfv$,e.Kind.OBJECT),d=e.Kind.CLASS,m=n.jetbrains.datalore.plot.config.transform.SpecChange,y=r.jetbrains.datalore.plot.base.data,$=e.kotlin.collections.List,v=e.throwCCE,g=r.jetbrains.datalore.plot.base.DataFrame.Builder_init,b=o.jetbrains.datalore.plot.common.base64,w=e.kotlin.collections.ArrayList_init_mqih57$,x=e.kotlin.Comparator,k=e.kotlin.collections.sortWith_nqfjgj$,E=e.kotlin.collections.sort_4wi501$,C=a.jetbrains.datalore.plot.common.data,S=n.jetbrains.datalore.plot.config.transform,T=n.jetbrains.datalore.plot.config.Option,O=n.jetbrains.datalore.plot.config.transform.PlotSpecTransform,N=s.jetbrains.datalore.plot;function P(){}function A(){}function j(){R=this,this.DATA_FRAME_KEY_0="__data_frame_encoded",this.DATA_SPEC_KEY_0="__data_spec_encoded"}function L(t,n){return e.compareTo(t.name,n.name)}P.prototype.isApplicable_x7u0o8$=function(t){return I().isEncodedDataSpec_za3rmp$(t)},P.prototype.apply_il3x6g$=function(t,e){var n;n=I().decode1_6uu7i0$(t),t.clear(),t.putAll_a2k3zr$(n)},P.$metadata$={kind:d,simpleName:"ClientSideDecodeChange",interfaces:[m]},A.prototype.isApplicable_x7u0o8$=function(t){return I().isEncodedDataFrame_bkhwtg$(t)},A.prototype.apply_il3x6g$=function(t,e){var n=I().decode_bkhwtg$(t);t.clear(),t.putAll_a2k3zr$(y.DataFrameUtil.toMap_dhhkv7$(n))},A.$metadata$={kind:d,simpleName:"ClientSideDecodeOldStyleChange",interfaces:[m]},j.prototype.isEncodedDataFrame_bkhwtg$=function(t){var n=1===t.size;if(n){var i,r=this.DATA_FRAME_KEY_0;n=(e.isType(i=t,_)?i:v()).containsKey_11rb$(r)}return n},j.prototype.isEncodedDataSpec_za3rmp$=function(t){var n;if(e.isType(t,_)){var i=1===t.size;if(i){var r,o=this.DATA_SPEC_KEY_0;i=(e.isType(r=t,_)?r:v()).containsKey_11rb$(o)}n=i}else n=!1;return n},j.prototype.decode_bkhwtg$=function(t){var n,i,r,o;if(!this.isEncodedDataFrame_bkhwtg$(t))throw u("Not a data frame".toString());for(var a,s=this.DATA_FRAME_KEY_0,l=e.isType(n=(e.isType(a=t,_)?a:v()).get_11rb$(s),$)?n:v(),c=e.isType(i=l.get_za3lpa$(0),$)?i:v(),p=e.isType(r=l.get_za3lpa$(1),$)?r:v(),h=e.isType(o=l.get_za3lpa$(2),$)?o:v(),f=g(),d=0;d!==c.size;++d){var m,w,x,k,E,C="string"==typeof(m=c.get_za3lpa$(d))?m:v(),S="string"==typeof(w=p.get_za3lpa$(d))?w:v(),T="boolean"==typeof(x=h.get_za3lpa$(d))?x:v(),O=y.DataFrameUtil.createVariable_puj7f4$(C,S),N=l.get_za3lpa$(3+d|0);if(T){var P=b.BinaryUtil.decodeList_61zpoe$("string"==typeof(k=N)?k:v());f.putNumeric_s1rqo9$(O,P)}else f.put_2l962d$(O,e.isType(E=N,$)?E:v())}return f.build()},j.prototype.decode1_6uu7i0$=function(t){var n,i,r;if(!this.isEncodedDataSpec_za3rmp$(t))throw u("Not an encoded data spec".toString());for(var o=e.isType(n=t.get_11rb$(this.DATA_SPEC_KEY_0),$)?n:v(),a=e.isType(i=o.get_za3lpa$(0),$)?i:v(),s=e.isType(r=o.get_za3lpa$(1),$)?r:v(),l=h(),c=0;c!==a.size;++c){var p,_,f,d,m="string"==typeof(p=a.get_za3lpa$(c))?p:v(),y="boolean"==typeof(_=s.get_za3lpa$(c))?_:v(),g=o.get_za3lpa$(2+c|0),w=y?b.BinaryUtil.decodeList_61zpoe$("string"==typeof(f=g)?f:v()):e.isType(d=g,$)?d:v();l.put_xwzc9p$(m,w)}return l},j.prototype.encode_dhhkv7$=function(t){var n,i,r=h(),o=p(),a=this.DATA_FRAME_KEY_0;r.put_xwzc9p$(a,o);var s=p(),l=p(),u=p();o.add_11rb$(s),o.add_11rb$(l),o.add_11rb$(u);var c=w(t.variables());for(k(c,new x(L)),n=c.iterator();n.hasNext();){var _=n.next();s.add_11rb$(_.name),l.add_11rb$(_.label);var f=t.isNumeric_8xm3sj$(_);u.add_11rb$(f);var d=t.get_8xm3sj$(_);if(f){var m=b.BinaryUtil.encodeList_k9kaly$(e.isType(i=d,$)?i:v());o.add_11rb$(m)}else o.add_11rb$(d)}return r},j.prototype.encode1_x7u0o8$=function(t){var n,i=h(),r=p(),o=this.DATA_SPEC_KEY_0;i.put_xwzc9p$(o,r);var a=p(),s=p();r.add_11rb$(a),r.add_11rb$(s);var l=w(t.keys);for(E(l),n=l.iterator();n.hasNext();){var u=n.next(),c=t.get_11rb$(u);if(e.isType(c,$)){var _=C.SeriesUtil.checkedDoubles_9ma18$(c),f=_.notEmptyAndCanBeCast();if(a.add_11rb$(u),s.add_11rb$(f),f){var d=b.BinaryUtil.encodeList_k9kaly$(_.cast());r.add_11rb$(d)}else r.add_11rb$(c)}}return i},j.$metadata$={kind:f,simpleName:"DataFrameEncoding",interfaces:[]};var R=null;function I(){return null===R&&new j,R}function z(){D=this}z.prototype.addDataChanges_0=function(t,e,n){var i;for(i=S.PlotSpecTransformUtil.getPlotAndLayersSpecSelectors_esgbho$(n,[T.PlotBase.DATA]).iterator();i.hasNext();){var r=i.next();t.change_t6n62v$(r,e)}return t},z.prototype.clientSideDecode_6taknv$=function(t){var e=O.Companion.builderForRawSpec();return this.addDataChanges_0(e,new P,t),this.addDataChanges_0(e,new A,t),e.build()},z.prototype.serverSideEncode_6taknv$=function(t){var e;return e=t?O.Companion.builderForRawSpec():O.Companion.builderForCleanSpec(),this.addDataChanges_0(e,new B,!1).build()},z.$metadata$={kind:f,simpleName:"DataSpecEncodeTransforms",interfaces:[]};var D=null;function M(){return null===D&&new z,D}function B(){}function U(){F=this}B.prototype.apply_il3x6g$=function(t,e){if(N.FeatureSwitch.printEncodedDataSummary_d0u64m$("DataFrameOptionHelper.encodeUpdateOption",t),N.FeatureSwitch.USE_DATA_FRAME_ENCODING){var n=I().encode1_x7u0o8$(t);t.clear(),t.putAll_a2k3zr$(n)}},B.$metadata$={kind:d,simpleName:"ServerSideEncodeChange",interfaces:[m]},U.prototype.processTransform_2wxo1b$=function(t){var e=l.Companion.isGGBunchSpec_bkhwtg$(t),n=M().clientSideDecode_6taknv$(e).apply_i49brq$(t);return c.Companion.processTransform_2wxo1b$(n)},U.$metadata$={kind:f,simpleName:"PlotConfigClientSideJvmJs",interfaces:[]};var F=null;var q=t.jetbrains||(t.jetbrains={}),G=q.datalore||(q.datalore={}),H=G.plot||(G.plot={}),Y=H.config||(H.config={}),V=Y.transform||(Y.transform={}),K=V.encode||(V.encode={});K.ClientSideDecodeChange=P,K.ClientSideDecodeOldStyleChange=A,Object.defineProperty(K,"DataFrameEncoding",{get:I}),Object.defineProperty(K,"DataSpecEncodeTransforms",{get:M}),K.ServerSideEncodeChange=B;var W=H.server||(H.server={}),X=W.config||(W.config={});return Object.defineProperty(X,"PlotConfigClientSideJvmJs",{get:function(){return null===F&&new U,F}}),B.prototype.isApplicable_x7u0o8$=m.prototype.isApplicable_x7u0o8$,t})?i.apply(e,r):i)||(t.exports=o)},362:function(t,e,n){var i,r,o;r=[e,n(421),n(521),n(836),n(958),n(767),n(770),n(564),n(623)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o,a,s,l){"use strict";var u=n.jetbrains.livemap.ui.CursorService,c=e.Kind.CLASS,p=e.kotlin.IllegalArgumentException_init_pdl1vj$,h=e.numberToInt,_=e.toString,f=i.jetbrains.datalore.plot.base.geom.PathGeom,d=i.jetbrains.datalore.plot.base.geom.util,m=e.kotlin.collections.ArrayList_init_287e2$,y=e.getCallableRef,$=i.jetbrains.datalore.plot.base.geom.SegmentGeom,v=e.kotlin.collections.ArrayList_init_ww73n8$,g=r.jetbrains.datalore.plot.common.data,b=e.ensureNotNull,w=e.kotlin.collections.emptyList_287e2$,x=o.jetbrains.datalore.base.geometry.DoubleVector,k=e.kotlin.collections.listOf_i5x0yv$,E=e.kotlin.collections.toList_7wnvza$,C=e.equals,S=i.jetbrains.datalore.plot.base.geom.PointGeom,T=o.jetbrains.datalore.base.typedGeometry.explicitVec_y7b45i$,O=Math,N=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,P=i.jetbrains.datalore.plot.base.aes,A=i.jetbrains.datalore.plot.base.Aes,j=e.kotlin.IllegalStateException_init_pdl1vj$,L=e.throwUPAE,R=a.jetbrains.datalore.plot.config.Option.Geom.LiveMap,I=e.throwCCE,z=e.kotlin.Unit,D=n.jetbrains.livemap.config.DevParams,M=n.jetbrains.livemap.config.LiveMapSpec,B=e.kotlin.ranges.IntRange,U=e.Kind.OBJECT,F=e.kotlin.collections.List,q=s.jetbrains.gis.geoprotocol.MapRegion,G=o.jetbrains.datalore.base.spatial.convertToGeoRectangle_i3vl8m$,H=n.jetbrains.livemap.core.projections.ProjectionType,Y=e.kotlin.collections.HashMap_init_q3lmfv$,V=e.kotlin.collections.Map,K=n.jetbrains.livemap.MapLocation,W=n.jetbrains.livemap.tiles,X=o.jetbrains.datalore.base.values.Color,Z=a.jetbrains.datalore.plot.config.getString_wpa7aq$,J=s.jetbrains.gis.tileprotocol.TileService.Theme.valueOf_61zpoe$,Q=n.jetbrains.livemap.api.liveMapVectorTiles_jo61jr$,tt=e.unboxChar,et=e.kotlin.collections.listOf_mh5how$,nt=e.kotlin.ranges.CharRange,it=n.jetbrains.livemap.api.liveMapGeocoding_leryx0$,rt=n.jetbrains.livemap.api,ot=e.kotlin.collections.setOf_i5x0yv$,at=o.jetbrains.datalore.base.spatial,st=o.jetbrains.datalore.base.spatial.pointsBBox_2r9fhj$,lt=o.jetbrains.datalore.base.spatial.makeSegments_8o5yvy$,ut=e.kotlin.collections.checkIndexOverflow_za3lpa$,ct=e.kotlin.collections.Collection,pt=e.kotlin.text.get_indices_gw00vp$,ht=e.toBoxedChar,_t=e.kotlin.ranges.reversed_zf1xzc$,ft=e.kotlin.text.iterator_gw00vp$,dt=i.jetbrains.datalore.plot.base.interact.GeomTargetLocator,mt=i.jetbrains.datalore.plot.base.interact.TipLayoutHint,yt=e.kotlin.collections.emptyMap_q3lmfv$,$t=i.jetbrains.datalore.plot.base.interact.GeomTarget,vt=i.jetbrains.datalore.plot.base.GeomKind,gt=e.kotlin.to_ujzrz7$,bt=i.jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupResult,wt=e.getPropertyCallableRef,xt=e.kotlin.collections.first_2p1efm$,kt=n.jetbrains.livemap.api.point_4sq48w$,Et=n.jetbrains.livemap.api.points_5t73na$,Ct=n.jetbrains.livemap.api.polygon_z7sk6d$,St=n.jetbrains.livemap.api.polygons_6q4rqs$,Tt=n.jetbrains.livemap.api.path_noshw0$,Ot=n.jetbrains.livemap.api.paths_dvul77$,Nt=n.jetbrains.livemap.api.line_us2cr2$,Pt=n.jetbrains.livemap.api.vLines_t2cee4$,At=n.jetbrains.livemap.api.hLines_t2cee4$,jt=n.jetbrains.livemap.api.text_od6cu8$,Lt=n.jetbrains.livemap.api.texts_mbu85n$,Rt=n.jetbrains.livemap.api.pie_m5p8e8$,It=n.jetbrains.livemap.api.pies_vquu0q$,zt=n.jetbrains.livemap.api.bar_1evwdj$,Dt=n.jetbrains.livemap.api.bars_q7kt7x$,Mt=n.jetbrains.livemap.config.LiveMapFactory,Bt=n.jetbrains.livemap.config.LiveMapCanvasFigure,Ut=o.jetbrains.datalore.base.geometry.Rectangle_init_tjonv8$,Ft=i.jetbrains.datalore.plot.base.geom.LiveMapProvider.LiveMapData,qt=l.jetbrains.datalore.plot.builder,Gt=e.kotlin.collections.drop_ba2ldo$,Ht=n.jetbrains.livemap.ui,Yt=n.jetbrains.livemap.LiveMapLocation,Vt=i.jetbrains.datalore.plot.base.geom.LiveMapProvider,Kt=e.kotlin.collections.checkCountOverflow_za3lpa$,Wt=o.jetbrains.datalore.base.gcommon.collect,Xt=e.kotlin.collections.ArrayList_init_mqih57$,Zt=l.jetbrains.datalore.plot.builder.scale,Jt=i.jetbrains.datalore.plot.base.geom.util.GeomHelper,Qt=i.jetbrains.datalore.plot.base.render.svg.TextLabel.HorizontalAnchor,te=i.jetbrains.datalore.plot.base.render.svg.TextLabel.VerticalAnchor,ee=n.jetbrains.livemap.api.limitCoord_now9aw$,ne=n.jetbrains.livemap.api.geometry_5qim13$,ie=e.kotlin.Enum,re=e.throwISE,oe=e.kotlin.collections.get_lastIndex_55thoc$,ae=e.kotlin.collections.sortedWith_eknfly$,se=e.wrapFunction,le=e.kotlin.Comparator;function ue(){this.cursorService=new u}function ce(t){this.myGeodesic_0=t}function pe(t,e){this.myPointFeatureConverter_0=new de(this,t),this.mySinglePathFeatureConverter_0=new fe(this,t,e),this.myMultiPathFeatureConverter_0=new _e(this,t,e)}function he(t,e,n){this.$outer=t,this.aesthetics_8be2vx$=e,this.myGeodesic_0=n,this.myArrowSpec_0=null,this.myAnimation_0=null}function _e(t,e,n){this.$outer=t,he.call(this,this.$outer,e,n)}function fe(t,e,n){this.$outer=t,he.call(this,this.$outer,e,n)}function de(t,e){this.$outer=t,this.myAesthetics_0=e,this.myAnimation_0=null}function me(t,e){this.myAesthetics_0=t,this.myLayerKind_0=this.getLayerKind_0(e.displayMode),this.myGeodesic_0=e.geodesic,this.myFrameSpecified_0=this.allAesMatch_0(this.myAesthetics_0,y("isFrameSet",function(t,e){return t.isFrameSet_0(e)}.bind(null,this)))}function ye(t,e,n){this.geom=t,this.geomKind=e,this.aesthetics=n}function $e(){Ce(),this.myAesthetics_rxz54u$_0=this.myAesthetics_rxz54u$_0,this.myLayers_u9pl8d$_0=this.myLayers_u9pl8d$_0,this.myLiveMapOptions_92ydlj$_0=this.myLiveMapOptions_92ydlj$_0,this.myDataAccess_85d5nb$_0=this.myDataAccess_85d5nb$_0,this.mySize_1s22w4$_0=this.mySize_1s22w4$_0,this.myDevParams_rps7kc$_0=this.myDevParams_rps7kc$_0,this.myMapLocationConsumer_hhmy08$_0=this.myMapLocationConsumer_hhmy08$_0,this.myCursorService_1uez3k$_0=this.myCursorService_1uez3k$_0,this.minZoom_0=1,this.maxZoom_0=15}function ve(){Ee=this,this.REGION_TYPE_0="type",this.REGION_DATA_0="data",this.REGION_TYPE_NAME_0="region_name",this.REGION_TYPE_IDS_0="region_ids",this.REGION_TYPE_COORDINATES_0="coordinates",this.REGION_TYPE_DATAFRAME_0="data_frame",this.POINT_X_0="lon",this.POINT_Y_0="lat",this.RECT_XMIN_0="lonmin",this.RECT_XMAX_0="lonmax",this.RECT_YMIN_0="latmin",this.RECT_YMAX_0="latmax",this.DEFAULT_SHOW_TILES_0=!0,this.DEFAULT_LOOP_Y_0=!1,this.CYLINDRICAL_PROJECTIONS_0=ot([H.GEOGRAPHIC,H.MERCATOR])}function ge(){be=this,this.URL="url"}_e.prototype=Object.create(he.prototype),_e.prototype.constructor=_e,fe.prototype=Object.create(he.prototype),fe.prototype.constructor=fe,Xe.prototype=Object.create(ie.prototype),Xe.prototype.constructor=Xe,dn.prototype=Object.create(ie.prototype),dn.prototype.constructor=dn,ue.prototype.defaultSetter_o14v8n$=function(t){this.cursorService.default=t},ue.prototype.pointerSetter_o14v8n$=function(t){this.cursorService.pointer=t},ue.$metadata$={kind:c,simpleName:"CursorServiceConfig",interfaces:[]},ce.prototype.createConfigurator_blfxhp$=function(t,e){var n,i,r,o=e.geomKind,a=new pe(e.aesthetics,this.myGeodesic_0);switch(o.name){case"POINT":n=a.toPoint_qbow5e$(e.geom),i=Je();break;case"H_LINE":n=a.toHorizontalLine(),i=en();break;case"V_LINE":n=a.toVerticalLine(),i=nn();break;case"SEGMENT":n=a.toSegment_qbow5e$(e.geom),i=tn();break;case"RECT":n=a.toRect(),i=Qe();break;case"TILE":case"BIN_2D":n=a.toTile(),i=Qe();break;case"DENSITY2D":case"CONTOUR":case"PATH":n=a.toPath_qbow5e$(e.geom),i=tn();break;case"TEXT":n=a.toText(),i=rn();break;case"DENSITY2DF":case"CONTOURF":case"POLYGON":case"MAP":n=a.toPolygon(),i=Qe();break;default:throw p("Layer '"+o.name+"' is not supported on Live Map.")}for(r=n.iterator();r.hasNext();)r.next().layerIndex=t+1|0;return Ye().createLayersConfigurator_7kwpjf$(i,n)},pe.prototype.toPoint_qbow5e$=function(t){return this.myPointFeatureConverter_0.point_n4jwzf$(t)},pe.prototype.toHorizontalLine=function(){return this.myPointFeatureConverter_0.hLine_8be2vx$()},pe.prototype.toVerticalLine=function(){return this.myPointFeatureConverter_0.vLine_8be2vx$()},pe.prototype.toSegment_qbow5e$=function(t){return this.mySinglePathFeatureConverter_0.segment_n4jwzf$(t)},pe.prototype.toRect=function(){return this.myMultiPathFeatureConverter_0.rect_8be2vx$()},pe.prototype.toTile=function(){return this.mySinglePathFeatureConverter_0.tile_8be2vx$()},pe.prototype.toPath_qbow5e$=function(t){return this.myMultiPathFeatureConverter_0.path_n4jwzf$(t)},pe.prototype.toPolygon=function(){return this.myMultiPathFeatureConverter_0.polygon_8be2vx$()},pe.prototype.toText=function(){return this.myPointFeatureConverter_0.text_8be2vx$()},he.prototype.parsePathAnimation_0=function(t){if(null==t)return null;if(e.isNumber(t))return h(t);if("string"==typeof t)switch(t){case"dash":return 1;case"plane":return 2;case"circle":return 3}throw p("Unknown path animation: '"+_(t)+"'")},he.prototype.pathToBuilder_zbovrq$=function(t,e,n){return Ke(t,this.getRender_0(n)).setGeometryData_5qim13$(e,n,this.myGeodesic_0).setArrowSpec_la4xi3$(this.myArrowSpec_0).setAnimation_s8ev37$(this.myAnimation_0)},he.prototype.getRender_0=function(t){return t?Qe():tn()},he.prototype.setArrowSpec_28xgda$=function(t){this.myArrowSpec_0=t},he.prototype.setAnimation_8ea4ql$=function(t){this.myAnimation_0=this.parsePathAnimation_0(t)},he.$metadata$={kind:c,simpleName:"PathFeatureConverterBase",interfaces:[]},_e.prototype.path_n4jwzf$=function(t){return this.setAnimation_8ea4ql$(e.isType(t,f)?t.animation:null),this.process_0(this.multiPointDataByGroup_0(d.MultiPointDataConstructor.singlePointAppender_v9bvvf$(d.GeomUtil.TO_LOCATION_X_Y)),!1)},_e.prototype.polygon_8be2vx$=function(){return this.process_0(this.multiPointDataByGroup_0(d.MultiPointDataConstructor.singlePointAppender_v9bvvf$(d.GeomUtil.TO_LOCATION_X_Y)),!0)},_e.prototype.rect_8be2vx$=function(){return this.process_0(this.multiPointDataByGroup_0(d.MultiPointDataConstructor.multiPointAppender_t2aup3$(d.GeomUtil.TO_RECTANGLE)),!0)},_e.prototype.multiPointDataByGroup_0=function(t){return d.MultiPointDataConstructor.createMultiPointDataByGroup_ugj9hh$(this.aesthetics_8be2vx$.dataPoints(),t,d.MultiPointDataConstructor.collector())},_e.prototype.process_0=function(t,e){var n,i=m();for(n=t.iterator();n.hasNext();){var r=n.next(),o=this.pathToBuilder_zbovrq$(r.aes,this.$outer.toVecs_0(r.points),e);y("add",function(t,e){return t.add_11rb$(e)}.bind(null,i))(o)}return i},_e.$metadata$={kind:c,simpleName:"MultiPathFeatureConverter",interfaces:[he]},fe.prototype.tile_8be2vx$=function(){return this.process_0(!0,this.tileGeometryGenerator_0())},fe.prototype.segment_n4jwzf$=function(t){return this.setArrowSpec_28xgda$(e.isType(t,$)?t.arrowSpec:null),this.setAnimation_8ea4ql$(e.isType(t,$)?t.animation:null),this.process_0(!1,y("pointToSegmentGeometry",function(t,e){return t.pointToSegmentGeometry_0(e)}.bind(null,this)))},fe.prototype.process_0=function(t,e){var n,i=v(this.aesthetics_8be2vx$.dataPointCount());for(n=this.aesthetics_8be2vx$.dataPoints().iterator();n.hasNext();){var r=n.next(),o=e(r);if(!o.isEmpty()){var a=this.pathToBuilder_zbovrq$(r,this.$outer.toVecs_0(o),t);y("add",function(t,e){return t.add_11rb$(e)}.bind(null,i))(a)}}return i.trimToSize(),i},fe.prototype.tileGeometryGenerator_0=function(){return t=this.getMinXYNonZeroDistance_0(this.aesthetics_8be2vx$),e=this,function(n){if(g.SeriesUtil.allFinite_rd1tgs$(n.x(),n.y(),n.width(),n.height())){var i=e.nonZero_0(b(n.width())*t.x,1),r=e.nonZero_0(b(n.height())*t.y,1);return d.GeomUtil.rectToGeometry_6y0v78$(b(n.x())-i/2,b(n.y())-r/2,b(n.x())+i/2,b(n.y())+r/2)}return w()};var t,e},fe.prototype.pointToSegmentGeometry_0=function(t){return g.SeriesUtil.allFinite_rd1tgs$(t.x(),t.y(),t.xend(),t.yend())?k([new x(b(t.x()),b(t.y())),new x(b(t.xend()),b(t.yend()))]):w()},fe.prototype.nonZero_0=function(t,e){return 0===t?e:t},fe.prototype.getMinXYNonZeroDistance_0=function(t){var e=E(t.dataPoints());if(e.size<2)return x.Companion.ZERO;for(var n=0,i=0,r=0,o=e.size-1|0;rh)throw p("Error parsing subdomains: wrong brackets order");var _,f=l+1|0,d=t.substring(f,h);if(0===d.length)throw p("Empty subdomains list");t:do{var m;for(m=ft(d);m.hasNext();){var y=tt(m.next()),$=ht(y),g=new nt(97,122),b=tt($);if(!g.contains_mef7kx$(String.fromCharCode(b).toLowerCase().charCodeAt(0))){_=!0;break t}}_=!1}while(0);if(_)throw p("subdomain list contains non-letter symbols");var w,x=t.substring(0,l),k=h+1|0,E=t.length,C=t.substring(k,E),S=v(d.length);for(w=ft(d);w.hasNext();){var T=tt(w.next()),O=S.add_11rb$,N=ht(T);O.call(S,x+String.fromCharCode(N)+C)}return S},ve.prototype.createGeocodingService_0=function(t){var n,i,r,o,a=we().URL;return null!=(i=null!=(n=(e.isType(r=t,V)?r:I()).get_11rb$(a))?it((o=n,function(t){var e;return t.url="string"==typeof(e=o)?e:I(),z})):null)?i:rt.Services.bogusGeocodingService()},ve.$metadata$={kind:U,simpleName:"Companion",interfaces:[]};var Ee=null;function Ce(){return null===Ee&&new ve,Ee}function Se(){Te=this}Se.prototype.calculateBoundingBox_d3e2cz$=function(t){return st(at.BBOX_CALCULATOR,t)},Se.prototype.calculateBoundingBox_2a5262$=function(t,e){if(t.size!==e.size)throw p("Longitude list count is not equal Latitude list count.".toString());return at.BBOX_CALCULATOR.calculateBoundingBox_qpfwx8$(lt(y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,t)),y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,t)),t.size),lt(y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,e)),y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,e)),t.size))},Se.prototype.calculateBoundingBox_55b83s$=function(t,e,n,i){var r=t.size;if(e.size!==r||n.size!==r||i.size!==r)throw p("Counts of 'minLongitudes', 'minLatitudes', 'maxLongitudes', 'maxLatitudes' lists are not equal.".toString());return at.BBOX_CALCULATOR.calculateBoundingBox_qpfwx8$(lt(y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,t)),y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,n)),r),lt(y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,e)),y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,i)),r))},Se.$metadata$={kind:U,simpleName:"BboxUtil",interfaces:[]};var Te=null;function Oe(){return null===Te&&new Se,Te}function Ne(t,e){var n;this.myTargetSource_0=e,this.myLiveMap_0=null,t.map_2o04qz$((n=this,function(t){return n.myLiveMap_0=t,z}))}function Pe(){He=this}function Ae(t,e){return function(n){switch(t.name){case"POINT":Et(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toPointBuilder())&&y("point",function(t,e){return kt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"POLYGON":St(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i=n.next();Ct(e,i.createPolygonConfigurator())}return z}}(e));break;case"PATH":Ot(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toPathBuilder())&&y("path",function(t,e){return Tt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"V_LINE":Pt(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toLineBuilder())&&y("line",function(t,e){return Nt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"H_LINE":At(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toLineBuilder())&&y("line",function(t,e){return Nt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"TEXT":Lt(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toTextBuilder())&&y("text",function(t,e){return jt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"PIE":It(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toChartBuilder())&&y("pie",function(t,e){return Rt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"BAR":Dt(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toChartBuilder())&&y("bar",function(t,e){return zt(t,e),z}.bind(null,e))(i)}return z}}(e));break;default:throw j(("Unsupported layer kind: "+t).toString())}return z}}function je(t,e,n){if(this.myLiveMapOptions_0=e,this.liveMapSpecBuilder_0=null,this.myTargetSource_0=Y(),t.isEmpty())throw p("Failed requirement.".toString());if(!xt(t).isLiveMap)throw p("geom_livemap have to be the very first geom after ggplot()".toString());var i,r,o,a=Le,s=v(N(t,10));for(i=t.iterator();i.hasNext();){var l=i.next();s.add_11rb$(a(l))}var u=0;for(r=s.iterator();r.hasNext();){var c,h=r.next(),_=ut((u=(o=u)+1|0,o));for(c=h.aesthetics.dataPoints().iterator();c.hasNext();){var f=c.next(),d=this.myTargetSource_0,m=gt(_,f.index()),y=h.contextualMapping;d.put_xwzc9p$(m,y)}}var $,g=Gt(t,1),b=v(N(g,10));for($=g.iterator();$.hasNext();){var w=$.next();b.add_11rb$(a(w))}var x,k=v(N(b,10));for(x=b.iterator();x.hasNext();){var E=x.next();k.add_11rb$(new ye(E.geom,E.geomKind,E.aesthetics))}var C=k,S=a(xt(t));this.liveMapSpecBuilder_0=(new $e).liveMapOptions_d2y5pu$(this.myLiveMapOptions_0).aesthetics_m7huy5$(S.aesthetics).dataAccess_c3j6od$(S.dataAccess).layers_ipzze3$(C).devParams_5pp8sb$(new D(this.myLiveMapOptions_0.devParams)).mapLocationConsumer_te0ohe$(Re).cursorService_kmk1wb$(n)}function Le(t){return qt.LayerRendererUtil.createLayerRendererData_knseyn$(t,yt(),yt())}function Re(t){return Ht.Clipboard.copy_61zpoe$(Yt.Companion.getLocationString_wthzt5$(t)),z}$e.$metadata$={kind:c,simpleName:"LiveMapSpecBuilder",interfaces:[]},Ne.prototype.search_gpjtzr$=function(t){var e,n,i;if(null!=(n=null!=(e=this.myLiveMap_0)?e.searchResult():null)){var r,o,a;if(r=et(new $t(n.index,mt.Companion.cursorTooltip_itpcqk$(t,n.color),yt())),o=vt.LIVE_MAP,null==(a=this.myTargetSource_0.get_11rb$(gt(n.layerIndex,n.index))))throw j("Can't find target.".toString());i=new bt(r,0,o,a,!1)}else i=null;return i},Ne.$metadata$={kind:c,simpleName:"LiveMapTargetLocator",interfaces:[dt]},Pe.prototype.injectLiveMapProvider_q1corz$=function(t,n,i){var r;for(r=t.iterator();r.hasNext();){var o,a=r.next(),s=wt("isLiveMap",1,(function(t){return t.isLiveMap}));t:do{var l;if(e.isType(a,ct)&&a.isEmpty()){o=!1;break t}for(l=a.iterator();l.hasNext();)if(s(l.next())){o=!0;break t}o=!1}while(0);if(o){var u,c=wt("isLiveMap",1,(function(t){return t.isLiveMap}));t:do{var h;if(e.isType(a,ct)&&a.isEmpty()){u=0;break t}var _=0;for(h=a.iterator();h.hasNext();)c(h.next())&&Kt(_=_+1|0);u=_}while(0);if(1!==u)throw p("Failed requirement.".toString());if(!xt(a).isLiveMap)throw p("Failed requirement.".toString());xt(a).setLiveMapProvider_kld0fp$(new je(a,n,i.cursorService))}}},Pe.prototype.createLayersConfigurator_7kwpjf$=function(t,e){return Ae(t,e)},je.prototype.createLiveMap_wthzt5$=function(t){var e=new Mt(this.liveMapSpecBuilder_0.size_gpjtzr$(t.dimension).build()).createLiveMap(),n=new Bt(e);return n.setBounds_vfns7u$(Ut(h(t.origin.x),h(t.origin.y),h(t.dimension.x),h(t.dimension.y))),new Ft(n,new Ne(e,this.myTargetSource_0))},je.$metadata$={kind:c,simpleName:"MyLiveMapProvider",interfaces:[Vt]},Pe.$metadata$={kind:U,simpleName:"LiveMapUtil",interfaces:[]};var Ie,ze,De,Me,Be,Ue,Fe,qe,Ge,He=null;function Ye(){return null===He&&new Pe,He}function Ve(){this.myP_0=null,this.indices_0=w(),this.myArrowSpec_0=null,this.myValueArray_0=w(),this.myColorArray_0=w(),this.myLayerKind=null,this.geometry=null,this.point=null,this.animation=0,this.geodesic=!1,this.layerIndex=null}function Ke(t,e,n){return n=n||Object.create(Ve.prototype),Ve.call(n),n.myLayerKind=e,n.myP_0=t,n}function We(t,e,n){return n=n||Object.create(Ve.prototype),Ve.call(n),n.myLayerKind=e,n.myP_0=t.aes,n.indices_0=t.indices,n.myValueArray_0=t.values,n.myColorArray_0=t.colors,n}function Xe(t,e){ie.call(this),this.name$=t,this.ordinal$=e}function Ze(){Ze=function(){},Ie=new Xe("POINT",0),ze=new Xe("POLYGON",1),De=new Xe("PATH",2),Me=new Xe("H_LINE",3),Be=new Xe("V_LINE",4),Ue=new Xe("TEXT",5),Fe=new Xe("PIE",6),qe=new Xe("BAR",7),Ge=new Xe("HEATMAP",8)}function Je(){return Ze(),Ie}function Qe(){return Ze(),ze}function tn(){return Ze(),De}function en(){return Ze(),Me}function nn(){return Ze(),Be}function rn(){return Ze(),Ue}function on(){return Ze(),Fe}function an(){return Ze(),qe}function sn(){return Ze(),Ge}Object.defineProperty(Ve.prototype,"index",{configurable:!0,get:function(){return this.myP_0.index()}}),Object.defineProperty(Ve.prototype,"shape",{configurable:!0,get:function(){return b(this.myP_0.shape()).code}}),Object.defineProperty(Ve.prototype,"size",{configurable:!0,get:function(){return P.AestheticsUtil.textSize_l6g9mh$(this.myP_0)}}),Object.defineProperty(Ve.prototype,"speed",{configurable:!0,get:function(){return b(this.myP_0.speed())}}),Object.defineProperty(Ve.prototype,"flow",{configurable:!0,get:function(){return b(this.myP_0.flow())}}),Object.defineProperty(Ve.prototype,"fillColor",{configurable:!0,get:function(){return this.colorWithAlpha_0(b(this.myP_0.fill()))}}),Object.defineProperty(Ve.prototype,"strokeColor",{configurable:!0,get:function(){return C(this.myLayerKind,Qe())?b(this.myP_0.color()):this.colorWithAlpha_0(b(this.myP_0.color()))}}),Object.defineProperty(Ve.prototype,"label",{configurable:!0,get:function(){var t,e;return null!=(e=null!=(t=this.myP_0.label())?t.toString():null)?e:"n/a"}}),Object.defineProperty(Ve.prototype,"family",{configurable:!0,get:function(){return this.myP_0.family()}}),Object.defineProperty(Ve.prototype,"hjust",{configurable:!0,get:function(){return this.hjust_0(this.myP_0.hjust())}}),Object.defineProperty(Ve.prototype,"vjust",{configurable:!0,get:function(){return this.vjust_0(this.myP_0.vjust())}}),Object.defineProperty(Ve.prototype,"angle",{configurable:!0,get:function(){return b(this.myP_0.angle())}}),Object.defineProperty(Ve.prototype,"fontface",{configurable:!0,get:function(){var t=this.myP_0.fontface();return C(t,P.AesInitValue.get_31786j$(A.Companion.FONTFACE))?"":t}}),Object.defineProperty(Ve.prototype,"radius",{configurable:!0,get:function(){switch(this.myLayerKind.name){case"POLYGON":case"PATH":case"H_LINE":case"V_LINE":case"POINT":case"PIE":case"BAR":var t=b(this.myP_0.shape()).size_l6g9mh$(this.myP_0)/2;return O.ceil(t);case"HEATMAP":return b(this.myP_0.size());case"TEXT":return 0;default:return e.noWhenBranchMatched()}}}),Object.defineProperty(Ve.prototype,"strokeWidth",{configurable:!0,get:function(){switch(this.myLayerKind.name){case"POLYGON":case"PATH":case"H_LINE":case"V_LINE":return P.AestheticsUtil.strokeWidth_l6g9mh$(this.myP_0);case"POINT":case"PIE":case"BAR":return 1;case"TEXT":case"HEATMAP":return 0;default:return e.noWhenBranchMatched()}}}),Object.defineProperty(Ve.prototype,"lineDash",{configurable:!0,get:function(){var t=this.myP_0.lineType();if(t.isSolid||t.isBlank)return w();var e,n=P.AestheticsUtil.strokeWidth_l6g9mh$(this.myP_0);return Xt(Wt.Lists.transform_l7riir$(t.dashArray,(e=n,function(t){return t*e})))}}),Object.defineProperty(Ve.prototype,"colorArray_0",{configurable:!0,get:function(){return this.myLayerKind===on()&&this.allZeroes_0(this.myValueArray_0)?this.createNaColorList_0(this.myValueArray_0.size):this.myColorArray_0}}),Ve.prototype.allZeroes_0=function(t){var n,i=y("equals",function(t,e){return C(t,e)}.bind(null,0));t:do{var r;if(e.isType(t,ct)&&t.isEmpty()){n=!0;break t}for(r=t.iterator();r.hasNext();)if(!i(r.next())){n=!1;break t}n=!0}while(0);return n},Ve.prototype.createNaColorList_0=function(t){for(var e=v(t),n=0;n0&&(a=a+"/"+l);var u=a;return d(o).replaceFirst_x2uqeu$(t,u)},le.prototype.scaleFontValue_0=function(t,e){return null==t?"":(t*e).toString()+"px"},le.$metadata$={kind:s,simpleName:"CssStyleUtil",interfaces:[]};var ue=null;function ce(){this.myLastTick_0=g,this.myDt_0=g}function pe(){}function he(t,e){return function(n){return e.schedule_klfg04$(function(t,e){return function(){return t.success_11rb$(e),w}}(t,n)),w}}function _e(t,e){return function(n){return e.schedule_klfg04$(function(t,e){return function(){return t.failure_tcv7n7$(e),w}}(t,n)),w}}function fe(t){this.myEventHandlers_51nth5$_0=E()}function de(t,e,n){this.closure$addReg=t,this.this$EventPeer=e,this.closure$eventSpec=n}function me(t){this.closure$event=t}function ye(t,e,n){this.size_mf5u5r$_0=e,this.context2d_imt5ib$_0=1===n?t:new $e(t,n)}function $e(t,e){this.myContext2d_0=t,this.myScale_0=e}function ve(t){this.myCanvasControl_0=t,this.canvas=null,this.canvas=this.myCanvasControl_0.createCanvas_119tl4$(this.myCanvasControl_0.size),this.myCanvasControl_0.addChild_eqkm0m$(this.canvas)}function ge(){}function be(){this.myHandle_0=null,this.myIsStarted_0=!1,this.myIsStarted_0=!1}function we(t,n,i){var r;Ce(),ye.call(this,new Pe(e.isType(r=t.getContext("2d"),CanvasRenderingContext2D)?r:$()),n,i),this.canvasElement=t,N(this.canvasElement.style,n.x),P(this.canvasElement.style,n.y);var o=this.canvasElement,a=n.x*i;o.width=A(j.ceil(a));var s=this.canvasElement,l=n.y*i;s.height=A(j.ceil(l))}function xe(t){this.$outer=t}function ke(){Ee=this,this.DEVICE_PIXEL_RATIO=window.devicePixelRatio}ce.prototype.tick_s8cxhz$=function(t){return this.myLastTick_0.toNumber()>0&&(this.myDt_0=t.subtract(this.myLastTick_0)),this.myLastTick_0=t,this.myDt_0},ce.prototype.dt=function(){return this.myDt_0},ce.$metadata$={kind:a,simpleName:"DeltaTime",interfaces:[]},pe.$metadata$={kind:o,simpleName:"Dispatcher",interfaces:[]},de.prototype.dispose=function(){this.closure$addReg.remove(),u(this.this$EventPeer.myEventHandlers_51nth5$_0.get_11rb$(this.closure$eventSpec)).isEmpty&&(this.this$EventPeer.myEventHandlers_51nth5$_0.remove_11rb$(this.closure$eventSpec),this.this$EventPeer.onSpecRemoved_1gkqfp$(this.closure$eventSpec))},de.$metadata$={kind:a,interfaces:[p]},fe.prototype.addEventHandler_b14a3c$=function(t,e){if(!this.myEventHandlers_51nth5$_0.containsKey_11rb$(t)){var n=this.myEventHandlers_51nth5$_0,i=new x;n.put_xwzc9p$(t,i),this.onSpecAdded_1gkqfp$(t)}var r=u(this.myEventHandlers_51nth5$_0.get_11rb$(t)).add_11rb$(e);return c.Companion.from_gg3y3y$(new de(r,this,t))},me.prototype.call_11rb$=function(t){t.onEvent_11rb$(this.closure$event)},me.$metadata$={kind:a,interfaces:[k]},fe.prototype.dispatch_b6y3vz$=function(t,e){var n;null!=(n=this.myEventHandlers_51nth5$_0.get_11rb$(t))&&n.fire_kucmxw$(new me(e))},fe.$metadata$={kind:a,simpleName:"EventPeer",interfaces:[]},Object.defineProperty(ye.prototype,"size",{get:function(){return this.size_mf5u5r$_0}}),Object.defineProperty(ye.prototype,"context2d",{configurable:!0,get:function(){return this.context2d_imt5ib$_0}}),ye.$metadata$={kind:a,simpleName:"ScaledCanvas",interfaces:[Q]},$e.prototype.scaled_0=function(t){return this.myScale_0*t},$e.prototype.descaled_0=function(t){return t/this.myScale_0},$e.prototype.scaled_1=function(t){if(1===this.myScale_0)return t;for(var e=new Float64Array(t.length),n=0;n!==t.length;++n)e[n]=this.scaled_0(t[n]);return e},$e.prototype.scaled_2=function(t){return t.copy_edneyn$(void 0,void 0,t.fontSize*this.myScale_0)},$e.prototype.drawImage_xo47pw$=function(t,e,n){this.myContext2d_0.drawImage_xo47pw$(t,this.scaled_0(e),this.scaled_0(n))},$e.prototype.drawImage_nks7bk$=function(t,e,n,i,r){this.myContext2d_0.drawImage_nks7bk$(t,this.scaled_0(e),this.scaled_0(n),this.scaled_0(i),this.scaled_0(r))},$e.prototype.drawImage_urnjjc$=function(t,e,n,i,r,o,a,s,l){this.myContext2d_0.drawImage_urnjjc$(t,this.scaled_0(e),this.scaled_0(n),this.scaled_0(i),this.scaled_0(r),this.scaled_0(o),this.scaled_0(a),this.scaled_0(s),this.scaled_0(l))},$e.prototype.beginPath=function(){this.myContext2d_0.beginPath()},$e.prototype.closePath=function(){this.myContext2d_0.closePath()},$e.prototype.stroke=function(){this.myContext2d_0.stroke()},$e.prototype.fill=function(){this.myContext2d_0.fill()},$e.prototype.fillRect_6y0v78$=function(t,e,n,i){this.myContext2d_0.fillRect_6y0v78$(this.scaled_0(t),this.scaled_0(e),this.scaled_0(n),this.scaled_0(i))},$e.prototype.moveTo_lu1900$=function(t,e){this.myContext2d_0.moveTo_lu1900$(this.scaled_0(t),this.scaled_0(e))},$e.prototype.lineTo_lu1900$=function(t,e){this.myContext2d_0.lineTo_lu1900$(this.scaled_0(t),this.scaled_0(e))},$e.prototype.arc_6p3vsx$$default=function(t,e,n,i,r,o){this.myContext2d_0.arc_6p3vsx$(this.scaled_0(t),this.scaled_0(e),this.scaled_0(n),i,r,o)},$e.prototype.save=function(){this.myContext2d_0.save()},$e.prototype.restore=function(){this.myContext2d_0.restore()},$e.prototype.setFillStyle_2160e9$=function(t){this.myContext2d_0.setFillStyle_2160e9$(t)},$e.prototype.setStrokeStyle_2160e9$=function(t){this.myContext2d_0.setStrokeStyle_2160e9$(t)},$e.prototype.setGlobalAlpha_14dthe$=function(t){this.myContext2d_0.setGlobalAlpha_14dthe$(t)},$e.prototype.setFont_ov8mpe$=function(t){this.myContext2d_0.setFont_ov8mpe$(this.scaled_2(t))},$e.prototype.setLineWidth_14dthe$=function(t){this.myContext2d_0.setLineWidth_14dthe$(this.scaled_0(t))},$e.prototype.strokeRect_6y0v78$=function(t,e,n,i){this.myContext2d_0.strokeRect_6y0v78$(this.scaled_0(t),this.scaled_0(e),this.scaled_0(n),this.scaled_0(i))},$e.prototype.strokeText_ai6r6m$=function(t,e,n){this.myContext2d_0.strokeText_ai6r6m$(t,this.scaled_0(e),this.scaled_0(n))},$e.prototype.fillText_ai6r6m$=function(t,e,n){this.myContext2d_0.fillText_ai6r6m$(t,this.scaled_0(e),this.scaled_0(n))},$e.prototype.scale_lu1900$=function(t,e){this.myContext2d_0.scale_lu1900$(t,e)},$e.prototype.rotate_14dthe$=function(t){this.myContext2d_0.rotate_14dthe$(t)},$e.prototype.translate_lu1900$=function(t,e){this.myContext2d_0.translate_lu1900$(this.scaled_0(t),this.scaled_0(e))},$e.prototype.transform_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.transform_15yvbs$(t,e,n,i,this.scaled_0(r),this.scaled_0(o))},$e.prototype.bezierCurveTo_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.bezierCurveTo_15yvbs$(this.scaled_0(t),this.scaled_0(e),this.scaled_0(n),this.scaled_0(i),this.scaled_0(r),this.scaled_0(o))},$e.prototype.setLineJoin_v2gigt$=function(t){this.myContext2d_0.setLineJoin_v2gigt$(t)},$e.prototype.setLineCap_useuqn$=function(t){this.myContext2d_0.setLineCap_useuqn$(t)},$e.prototype.setTextBaseline_5cz80h$=function(t){this.myContext2d_0.setTextBaseline_5cz80h$(t)},$e.prototype.setTextAlign_iwro1z$=function(t){this.myContext2d_0.setTextAlign_iwro1z$(t)},$e.prototype.setTransform_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.setTransform_15yvbs$(t,e,n,i,this.scaled_0(r),this.scaled_0(o))},$e.prototype.fillEvenOdd=function(){this.myContext2d_0.fillEvenOdd()},$e.prototype.setLineDash_gf7tl1$=function(t){this.myContext2d_0.setLineDash_gf7tl1$(this.scaled_1(t))},$e.prototype.measureText_61zpoe$=function(t){return this.descaled_0(this.myContext2d_0.measureText_61zpoe$(t))},$e.prototype.clearRect_wthzt5$=function(t){this.myContext2d_0.clearRect_wthzt5$(new C(t.origin.mul_14dthe$(2),t.dimension.mul_14dthe$(2)))},$e.$metadata$={kind:a,simpleName:"ScaledContext2d",interfaces:[kt]},Object.defineProperty(ve.prototype,"context",{configurable:!0,get:function(){return this.canvas.context2d}}),Object.defineProperty(ve.prototype,"size",{configurable:!0,get:function(){return this.myCanvasControl_0.size}}),ve.prototype.createCanvas=function(){return this.myCanvasControl_0.createCanvas_119tl4$(this.myCanvasControl_0.size)},ve.prototype.dispose=function(){this.myCanvasControl_0.removeChild_eqkm0m$(this.canvas)},ve.$metadata$={kind:a,simpleName:"SingleCanvasControl",interfaces:[]},ge.$metadata$={kind:o,simpleName:"CanvasFigure",interfaces:[S]},be.prototype.start=function(){this.myIsStarted_0||(this.myIsStarted_0=!0,this.requestNextFrame_0())},be.prototype.stop=function(){this.myIsStarted_0&&(this.myIsStarted_0=!1,window.cancelAnimationFrame(u(this.myHandle_0)))},be.prototype.execute_0=function(t){this.myIsStarted_0&&(this.handle_s8cxhz$(e.Long.fromNumber(t)),this.requestNextFrame_0())},be.prototype.requestNextFrame_0=function(){var t;this.myHandle_0=window.requestAnimationFrame((t=this,function(e){return t.execute_0(e),w}))},be.$metadata$={kind:a,simpleName:"DomAnimationTimer",interfaces:[V]},we.prototype.takeSnapshot=function(){return O.Asyncs.constant_mh5how$(new xe(this))},Object.defineProperty(xe.prototype,"canvasElement",{configurable:!0,get:function(){return this.$outer.canvasElement}}),xe.$metadata$={kind:a,simpleName:"DomSnapshot",interfaces:[tt]},ke.prototype.create_duqvgq$=function(t,n){var i;return new we(e.isType(i=document.createElement("canvas"),HTMLCanvasElement)?i:$(),t,n)},ke.$metadata$={kind:s,simpleName:"Companion",interfaces:[]};var Ee=null;function Ce(){return null===Ee&&new ke,Ee}function Se(t,e,n){this.myRootElement_0=t,this.size_malc5o$_0=e,this.myEventPeer_0=n}function Te(t){this.closure$eventHandler=t,be.call(this)}function Oe(t,n,i,r){return function(o){var a,s,l;if(null!=t){var u,c=t;l=e.isType(u=n.createCanvas_119tl4$(c),we)?u:$()}else l=null;var p=null!=(a=l)?a:Ce().create_duqvgq$(new M(i.width,i.height),1);return(e.isType(s=p.canvasElement.getContext("2d"),CanvasRenderingContext2D)?s:$()).drawImage(i,0,0,p.canvasElement.width,p.canvasElement.height),p.takeSnapshot().onSuccess_qlkmfe$(function(t){return function(e){return t(e),w}}(r))}}function Ne(t,e){var n;fe.call(this,q(G)),this.myEventTarget_0=t,this.myTargetBounds_0=e,this.myButtonPressed_0=!1,this.myWasDragged_0=!1,this.myButtonPressCoord_0=null,this.myDragToleranceDistance_0=3,this.handle_0(U.Companion.MOUSE_ENTER,(n=this,function(t){if(n.isHitOnTarget_0(t))return n.dispatch_b6y3vz$(G.MOUSE_ENTERED,n.translate_0(t)),w})),this.handle_0(U.Companion.MOUSE_LEAVE,function(t){return function(e){if(t.isHitOnTarget_0(e))return t.dispatch_b6y3vz$(G.MOUSE_LEFT,t.translate_0(e)),w}}(this)),this.handle_0(U.Companion.CLICK,function(t){return function(e){if(!t.myWasDragged_0){if(!t.isHitOnTarget_0(e))return;t.dispatch_b6y3vz$(G.MOUSE_CLICKED,t.translate_0(e))}return t.myWasDragged_0=!1,w}}(this)),this.handle_0(U.Companion.DOUBLE_CLICK,function(t){return function(e){if(t.isHitOnTarget_0(e))return t.dispatch_b6y3vz$(G.MOUSE_DOUBLE_CLICKED,t.translate_0(e)),w}}(this)),this.handle_0(U.Companion.MOUSE_DOWN,function(t){return function(e){if(t.isHitOnTarget_0(e))return t.myButtonPressed_0=!0,t.myButtonPressCoord_0=new M(A(e.x),A(e.y)),t.dispatch_b6y3vz$(G.MOUSE_PRESSED,F.DomEventUtil.translateInPageCoord_tfvzir$(e)),w}}(this)),this.handle_0(U.Companion.MOUSE_UP,function(t){return function(e){return t.myButtonPressed_0=!1,t.myButtonPressCoord_0=null,t.dispatch_b6y3vz$(G.MOUSE_RELEASED,t.translate_0(e)),w}}(this)),this.handle_0(U.Companion.MOUSE_MOVE,function(t){return function(e){var n,i,r;if(t.myWasDragged_0)t.dispatch_b6y3vz$(G.MOUSE_DRAGGED,F.DomEventUtil.translateInPageCoord_tfvzir$(e));else if(t.myButtonPressed_0&&!t.myWasDragged_0)(null!=(r=null!=(i=null!=(n=t.myButtonPressCoord_0)?n.sub_119tl4$(new M(A(e.x),A(e.y))):null)?i.length():null)?r:0)>t.myDragToleranceDistance_0&&(t.myWasDragged_0=!0,t.dispatch_b6y3vz$(G.MOUSE_DRAGGED,F.DomEventUtil.translateInPageCoord_tfvzir$(e)));else if(!t.myButtonPressed_0&&!t.myWasDragged_0){if(!t.isHitOnTarget_0(e))return;t.dispatch_b6y3vz$(G.MOUSE_MOVED,t.translate_0(e))}return w}}(this))}function Pe(t){this.myContext2d_0=t}we.$metadata$={kind:a,simpleName:"DomCanvas",interfaces:[ye]},Object.defineProperty(Se.prototype,"size",{get:function(){return this.size_malc5o$_0}}),Te.prototype.handle_s8cxhz$=function(t){this.closure$eventHandler.onEvent_s8cxhz$(t)},Te.$metadata$={kind:a,interfaces:[be]},Se.prototype.createAnimationTimer_ckdfex$=function(t){return new Te(t)},Se.prototype.addEventHandler_mfdhbe$=function(t,e){return this.myEventPeer_0.addEventHandler_b14a3c$(t,L((n=e,function(t){return n.onEvent_11rb$(t),w})));var n},Se.prototype.createCanvas_119tl4$=function(t){var e=Ce().create_duqvgq$(t,Ce().DEVICE_PIXEL_RATIO);return I(e.canvasElement.style,R.ABSOLUTE),e},Se.prototype.createSnapshot_61zpoe$=function(t){return this.createSnapshotAsync_0(t,null)},Se.prototype.createSnapshot_50eegg$=function(t,e){var n={type:"image/png"};return this.createSnapshotAsync_0(URL.createObjectURL(new Blob([t],n)),e)},Se.prototype.createSnapshotAsync_0=function(t,e){void 0===e&&(e=null);var n=new z,i=new Image;return i.onload=this.onLoad_0(i,e,D("success",function(t,e){return t.success_11rb$(e),w}.bind(null,n))),i.src=t,n},Se.prototype.onLoad_0=function(t,e,n){return Oe(e,this,t,n)},Se.prototype.addChild_eqkm0m$=function(t){var n;this.myRootElement_0.appendChild((e.isType(n=t,we)?n:$()).canvasElement)},Se.prototype.addChild_fwfip8$=function(t,n){var i;this.myRootElement_0.insertBefore((e.isType(i=n,we)?i:$()).canvasElement,this.myRootElement_0.childNodes[t])},Se.prototype.removeChild_eqkm0m$=function(t){var n;this.myRootElement_0.removeChild((e.isType(n=t,we)?n:$()).canvasElement)},Se.prototype.schedule_klfg04$=function(t){t()},Ne.prototype.handle_0=function(t,e){var n;this.targetNode_0(t).addEventListener(t.name,new B((n=e,function(t){return n(t),!1})))},Ne.prototype.targetNode_0=function(t){return T(t,U.Companion.MOUSE_MOVE)||T(t,U.Companion.MOUSE_UP)?document:this.myEventTarget_0},Ne.prototype.onSpecAdded_1gkqfp$=function(t){},Ne.prototype.onSpecRemoved_1gkqfp$=function(t){},Ne.prototype.isHitOnTarget_0=function(t){return this.myTargetBounds_0.contains_119tl4$(new M(A(t.offsetX),A(t.offsetY)))},Ne.prototype.translate_0=function(t){return F.DomEventUtil.translateInTargetCoordWithOffset_6zzdys$(t,this.myEventTarget_0,this.myTargetBounds_0.origin)},Ne.$metadata$={kind:a,simpleName:"DomEventPeer",interfaces:[fe]},Se.$metadata$={kind:a,simpleName:"DomCanvasControl",interfaces:[et]},Pe.prototype.convertLineJoin_0=function(t){var n;switch(t.name){case"BEVEL":n="bevel";break;case"MITER":n="miter";break;case"ROUND":n="round";break;default:n=e.noWhenBranchMatched()}return n},Pe.prototype.convertLineCap_0=function(t){var n;switch(t.name){case"BUTT":n="butt";break;case"ROUND":n="round";break;case"SQUARE":n="square";break;default:n=e.noWhenBranchMatched()}return n},Pe.prototype.convertTextBaseline_0=function(t){var n;switch(t.name){case"ALPHABETIC":n="alphabetic";break;case"BOTTOM":n="bottom";break;case"MIDDLE":n="middle";break;case"TOP":n="top";break;default:n=e.noWhenBranchMatched()}return n},Pe.prototype.convertTextAlign_0=function(t){var n;switch(t.name){case"CENTER":n="center";break;case"END":n="end";break;case"START":n="start";break;default:n=e.noWhenBranchMatched()}return n},Pe.prototype.drawImage_xo47pw$=function(t,n,i){var r,o=e.isType(r=t,xe)?r:$();this.myContext2d_0.drawImage(o.canvasElement,n,i)},Pe.prototype.drawImage_nks7bk$=function(t,n,i,r,o){var a,s=e.isType(a=t,xe)?a:$();this.myContext2d_0.drawImage(s.canvasElement,n,i,r,o)},Pe.prototype.drawImage_urnjjc$=function(t,n,i,r,o,a,s,l,u){var c,p=e.isType(c=t,xe)?c:$();this.myContext2d_0.drawImage(p.canvasElement,n,i,r,o,a,s,l,u)},Pe.prototype.beginPath=function(){this.myContext2d_0.beginPath()},Pe.prototype.closePath=function(){this.myContext2d_0.closePath()},Pe.prototype.stroke=function(){this.myContext2d_0.stroke()},Pe.prototype.fill=function(){this.myContext2d_0.fill("nonzero")},Pe.prototype.fillEvenOdd=function(){this.myContext2d_0.fill("evenodd")},Pe.prototype.fillRect_6y0v78$=function(t,e,n,i){this.myContext2d_0.fillRect(t,e,n,i)},Pe.prototype.moveTo_lu1900$=function(t,e){this.myContext2d_0.moveTo(t,e)},Pe.prototype.lineTo_lu1900$=function(t,e){this.myContext2d_0.lineTo(t,e)},Pe.prototype.arc_6p3vsx$$default=function(t,e,n,i,r,o){this.myContext2d_0.arc(t,e,n,i,r,o)},Pe.prototype.save=function(){this.myContext2d_0.save()},Pe.prototype.restore=function(){this.myContext2d_0.restore()},Pe.prototype.setFillStyle_2160e9$=function(t){this.myContext2d_0.fillStyle=null!=t?t.toCssColor():null},Pe.prototype.setStrokeStyle_2160e9$=function(t){this.myContext2d_0.strokeStyle=null!=t?t.toCssColor():null},Pe.prototype.setGlobalAlpha_14dthe$=function(t){this.myContext2d_0.globalAlpha=t},Pe.prototype.toCssString_0=function(t){var n,i;switch(t.fontWeight.name){case"NORMAL":n="normal";break;case"BOLD":n="bold";break;default:n=e.noWhenBranchMatched()}var r=n;switch(t.fontStyle.name){case"NORMAL":i="normal";break;case"ITALIC":i="italic";break;default:i=e.noWhenBranchMatched()}return i+" "+r+" "+t.fontSize+"px "+t.fontFamily},Pe.prototype.setFont_ov8mpe$=function(t){this.myContext2d_0.font=this.toCssString_0(t)},Pe.prototype.setLineWidth_14dthe$=function(t){this.myContext2d_0.lineWidth=t},Pe.prototype.strokeRect_6y0v78$=function(t,e,n,i){this.myContext2d_0.strokeRect(t,e,n,i)},Pe.prototype.strokeText_ai6r6m$=function(t,e,n){this.myContext2d_0.strokeText(t,e,n)},Pe.prototype.fillText_ai6r6m$=function(t,e,n){this.myContext2d_0.fillText(t,e,n)},Pe.prototype.scale_lu1900$=function(t,e){this.myContext2d_0.scale(t,e)},Pe.prototype.rotate_14dthe$=function(t){this.myContext2d_0.rotate(t)},Pe.prototype.translate_lu1900$=function(t,e){this.myContext2d_0.translate(t,e)},Pe.prototype.transform_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.transform(t,e,n,i,r,o)},Pe.prototype.bezierCurveTo_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.bezierCurveTo(t,e,n,i,r,o)},Pe.prototype.setLineJoin_v2gigt$=function(t){this.myContext2d_0.lineJoin=this.convertLineJoin_0(t)},Pe.prototype.setLineCap_useuqn$=function(t){this.myContext2d_0.lineCap=this.convertLineCap_0(t)},Pe.prototype.setTextBaseline_5cz80h$=function(t){this.myContext2d_0.textBaseline=this.convertTextBaseline_0(t)},Pe.prototype.setTextAlign_iwro1z$=function(t){this.myContext2d_0.textAlign=this.convertTextAlign_0(t)},Pe.prototype.setTransform_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.setTransform(t,e,n,i,r,o)},Pe.prototype.setLineDash_gf7tl1$=function(t){this.myContext2d_0.setLineDash(H(t))},Pe.prototype.measureText_61zpoe$=function(t){return this.myContext2d_0.measureText(t).width},Pe.prototype.clearRect_wthzt5$=function(t){this.myContext2d_0.clearRect(t.left,t.top,t.width,t.height)},Pe.$metadata$={kind:a,simpleName:"DomContext2d",interfaces:[kt]},Y.AnimationTimer=V,Object.defineProperty(K,"Companion",{get:J}),Y.AnimationEventHandler=K;var Ae=t.jetbrains||(t.jetbrains={}),je=Ae.datalore||(Ae.datalore={}),Le=je.vis||(je.vis={}),Re=Le.canvas||(Le.canvas={});Re.AnimationProvider=Y,Q.Snapshot=tt,Re.Canvas=Q,Re.CanvasControl=et,Object.defineProperty(Re,"CanvasControlUtil",{get:function(){return null===wt&&new nt,wt}}),Re.CanvasProvider=xt,Object.defineProperty(Et,"BEVEL",{get:St}),Object.defineProperty(Et,"MITER",{get:Tt}),Object.defineProperty(Et,"ROUND",{get:Ot}),kt.LineJoin=Et,Object.defineProperty(Nt,"BUTT",{get:At}),Object.defineProperty(Nt,"ROUND",{get:jt}),Object.defineProperty(Nt,"SQUARE",{get:Lt}),kt.LineCap=Nt,Object.defineProperty(Rt,"ALPHABETIC",{get:zt}),Object.defineProperty(Rt,"BOTTOM",{get:Dt}),Object.defineProperty(Rt,"MIDDLE",{get:Mt}),Object.defineProperty(Rt,"TOP",{get:Bt}),kt.TextBaseline=Rt,Object.defineProperty(Ut,"CENTER",{get:qt}),Object.defineProperty(Ut,"END",{get:Gt}),Object.defineProperty(Ut,"START",{get:Ht}),kt.TextAlign=Ut,Object.defineProperty(Vt,"NORMAL",{get:Wt}),Object.defineProperty(Vt,"ITALIC",{get:Xt}),Yt.FontStyle=Vt,Object.defineProperty(Zt,"NORMAL",{get:Qt}),Object.defineProperty(Zt,"BOLD",{get:te}),Yt.FontWeight=Zt,Object.defineProperty(Yt,"Companion",{get:ie}),kt.Font_init_1nsek9$=function(t,e,n,i,r){return r=r||Object.create(Yt.prototype),Yt.call(r,null!=t?t:Wt(),null!=e?e:Qt(),null!=n?n:ie().DEFAULT_SIZE,null!=i?i:ie().DEFAULT_FAMILY),r},kt.Font=Yt,Re.Context2d=kt,Object.defineProperty(re,"Companion",{get:se}),Re.CssFontParser=re,Object.defineProperty(Re,"CssStyleUtil",{get:function(){return null===ue&&new le,ue}}),Re.DeltaTime=ce,Re.Dispatcher=pe,Re.scheduleAsync_ebnxch$=function(t,e){var n=new b;return e.onResult_m8e4a6$(he(n,t),_e(n,t)),n},Re.EventPeer=fe,Re.ScaledCanvas=ye,Re.ScaledContext2d=$e,Re.SingleCanvasControl=ve,(Le.canvasFigure||(Le.canvasFigure={})).CanvasFigure=ge;var Ie=Re.dom||(Re.dom={});return Ie.DomAnimationTimer=be,we.DomSnapshot=xe,Object.defineProperty(we,"Companion",{get:Ce}),Ie.DomCanvas=we,Se.DomEventPeer=Ne,Ie.DomCanvasControl=Se,Ie.DomContext2d=Pe,$e.prototype.arc_6p3vsx$=kt.prototype.arc_6p3vsx$,Pe.prototype.arc_6p3vsx$=kt.prototype.arc_6p3vsx$,t})?i.apply(e,r):i)||(t.exports=o)},179:function(t,e,n){var i,r,o;r=[e,n(421),n(331),n(799),n(767),n(602)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o){"use strict";var a=e.kotlin.collections.ArrayList_init_287e2$,s=n.jetbrains.datalore.vis.svg.slim.SvgSlimNode,l=e.toString,u=e.ensureNotNull,c=n.jetbrains.datalore.vis.svg.SvgElement,p=n.jetbrains.datalore.vis.svg.SvgTextNode,h=e.kotlin.IllegalStateException_init_pdl1vj$,_=n.jetbrains.datalore.vis.svg.slim,f=e.equals,d=e.Kind.CLASS,m=i.jetbrains.datalore.mapper.core.Synchronizer,y=e.kotlin.IllegalArgumentException_init_pdl1vj$,$=e.Kind.INTERFACE,v=(n.jetbrains.datalore.vis.svg.SvgNodeContainer,e.Kind.OBJECT),g=e.throwCCE,b=r.jetbrains.datalore.base.registration.CompositeRegistration,w=o.jetbrains.datalore.base.js.dom.DomEventType,x=o.jetbrains.datalore.base.event.dom,k=r.jetbrains.datalore.base.event.MouseEvent,E=r.jetbrains.datalore.base.registration.Registration,C=n.jetbrains.datalore.vis.svg.SvgImageElementEx.RGBEncoder,S=n.jetbrains.datalore.vis.svg.SvgNode,T=r.jetbrains.datalore.base.geometry.DoubleVector,O=r.jetbrains.datalore.base.geometry.DoubleRectangle_init_6y0v78$,N=e.kotlin.collections.HashMap_init_q3lmfv$,P=n.jetbrains.datalore.vis.svg.SvgPlatformPeer,A=n.jetbrains.datalore.vis.svg.SvgElementListener,j=i.jetbrains.datalore.mapper.core,L=n.jetbrains.datalore.vis.svg.event.SvgEventSpec.values,R=e.kotlin.IllegalStateException_init,I=r.jetbrains.datalore.base.function.Function,z=r.jetbrains.datalore.base.observable.property.WritableProperty,D=e.numberToInt,M=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,B=i.jetbrains.datalore.mapper.core.Mapper,U=n.jetbrains.datalore.vis.svg.SvgImageElementEx,F=n.jetbrains.datalore.vis.svg.SvgImageElement,q=i.jetbrains.datalore.mapper.core.MapperFactory,G=n.jetbrains.datalore.vis.svg,H=(e.defineInlineFunction,e.kotlin.Unit),Y=e.kotlin.collections.AbstractMutableList,V=r.jetbrains.datalore.base.function.Value,K=r.jetbrains.datalore.base.observable.property.PropertyChangeEvent,W=r.jetbrains.datalore.base.observable.event.ListenerCaller,X=r.jetbrains.datalore.base.observable.event.Listeners,Z=r.jetbrains.datalore.base.observable.property.Property,J=e.kotlinx.dom.addClass_hhb33f$,Q=e.kotlinx.dom.removeClass_hhb33f$,tt=r.jetbrains.datalore.base.geometry.Vector,et=r.jetbrains.datalore.base.function.Supplier,nt=o.jetbrains.datalore.base.observable.property.UpdatableProperty,it=n.jetbrains.datalore.vis.svg.SvgEllipseElement,rt=n.jetbrains.datalore.vis.svg.SvgCircleElement,ot=n.jetbrains.datalore.vis.svg.SvgRectElement,at=n.jetbrains.datalore.vis.svg.SvgTextElement,st=n.jetbrains.datalore.vis.svg.SvgPathElement,lt=n.jetbrains.datalore.vis.svg.SvgLineElement,ut=n.jetbrains.datalore.vis.svg.SvgSvgElement,ct=n.jetbrains.datalore.vis.svg.SvgGElement,pt=n.jetbrains.datalore.vis.svg.SvgStyleElement,ht=n.jetbrains.datalore.vis.svg.SvgTSpanElement,_t=n.jetbrains.datalore.vis.svg.SvgDefsElement,ft=n.jetbrains.datalore.vis.svg.SvgClipPathElement;function dt(t,e,n){this.source_0=t,this.target_0=e,this.targetPeer_0=n,this.myHandlersRegs_0=null}function mt(){}function yt(){}function $t(t,e){this.closure$source=t,this.closure$spec=e}function vt(t,e,n){this.closure$target=t,this.closure$eventType=e,this.closure$listener=n,E.call(this)}function gt(){}function bt(){this.myMappingMap_0=N()}function wt(t,e,n){St.call(this,t,e,n),this.myPeer_0=n,this.myHandlersRegs_0=null}function xt(t){this.this$SvgElementMapper=t,this.myReg_0=null}function kt(t){this.this$SvgElementMapper=t}function Et(t){this.this$SvgElementMapper=t}function Ct(t,e){this.this$SvgElementMapper=t,this.closure$spec=e}function St(t,e,n){B.call(this,t,e),this.peer_cyou3s$_0=n}function Tt(t){this.myPeer_0=t}function Ot(t){At(),B.call(this,t,At().createDocument_0()),this.myRootMapper_0=null}function Nt(){Pt=this}vt.prototype=Object.create(E.prototype),vt.prototype.constructor=vt,St.prototype=Object.create(B.prototype),St.prototype.constructor=St,wt.prototype=Object.create(St.prototype),wt.prototype.constructor=wt,Ot.prototype=Object.create(B.prototype),Ot.prototype.constructor=Ot,jt.prototype=Object.create(St.prototype),jt.prototype.constructor=jt,Ft.prototype=Object.create(E.prototype),Ft.prototype.constructor=Ft,Qt.prototype=Object.create(Y.prototype),Qt.prototype.constructor=Qt,te.prototype=Object.create(Y.prototype),te.prototype.constructor=te,re.prototype=Object.create(E.prototype),re.prototype.constructor=re,oe.prototype=Object.create(E.prototype),oe.prototype.constructor=oe,pe.prototype=Object.create(nt.prototype),pe.prototype.constructor=pe,dt.prototype.attach_1rog5x$=function(t){if(this.myHandlersRegs_0=a(),e.isType(this.source_0,s)){var n="Slim SVG node is not expected: "+l(e.getKClassFromExpression(this.source_0).simpleName);throw y(n.toString())}this.targetPeer_0.appendChild_xwzc9q$(this.target_0,this.generateNode_0(this.source_0))},dt.prototype.detach=function(){var t;for(t=u(this.myHandlersRegs_0).iterator();t.hasNext();)t.next().remove();this.myHandlersRegs_0=null,this.targetPeer_0.removeAllChildren_11rb$(this.target_0)},dt.prototype.generateNode_0=function(t){if(e.isType(t,s))return this.generateSlimNode_0(t);if(e.isType(t,c))return this.generateElement_0(t);if(e.isType(t,p))return this.generateTextNode_0(t);throw h("Can't generate dom for svg node "+e.getKClassFromExpression(t).simpleName)},dt.prototype.generateElement_0=function(t){var e,n,i=this.targetPeer_0.newSvgElement_b1cgbq$(t);for(e=t.attributeKeys.iterator();e.hasNext();){var r=e.next();this.targetPeer_0.setAttribute_ohl585$(i,r.name,l(t.getAttribute_61zpoe$(r.name).get()))}var o=t.handlersSet().get();for(o.isEmpty()||this.targetPeer_0.hookEventHandlers_ewuthb$(t,i,o),n=t.children().iterator();n.hasNext();){var a=n.next();this.targetPeer_0.appendChild_xwzc9q$(i,this.generateNode_0(a))}return i},dt.prototype.generateTextNode_0=function(t){return this.targetPeer_0.newSvgTextNode_tginx7$(t)},dt.prototype.generateSlimNode_0=function(t){var e,n,i=this.targetPeer_0.newSvgSlimNode_qwqme8$(t);if(f(t.elementName,_.SvgSlimElements.GROUP))for(e=t.slimChildren.iterator();e.hasNext();){var r=e.next();this.targetPeer_0.appendChild_xwzc9q$(i,this.generateSlimNode_0(r))}for(n=t.attributes.iterator();n.hasNext();){var o=n.next();this.targetPeer_0.setAttribute_ohl585$(i,o.key,o.value)}return i},dt.$metadata$={kind:d,simpleName:"SvgNodeSubtreeGeneratingSynchronizer",interfaces:[m]},mt.$metadata$={kind:$,simpleName:"TargetPeer",interfaces:[]},yt.prototype.appendChild_xwzc9q$=function(t,e){t.appendChild(e)},yt.prototype.removeAllChildren_11rb$=function(t){if(t.hasChildNodes())for(var e=t.firstChild;null!=e;){var n=e.nextSibling;t.removeChild(e),e=n}},yt.prototype.newSvgElement_b1cgbq$=function(t){return _e().generateElement_b1cgbq$(t)},yt.prototype.newSvgTextNode_tginx7$=function(t){var e=document.createTextNode("");return e.nodeValue=t.textContent().get(),e},yt.prototype.newSvgSlimNode_qwqme8$=function(t){return _e().generateSlimNode_qwqme8$(t)},yt.prototype.setAttribute_ohl585$=function(t,n,i){var r;(e.isType(r=t,Element)?r:g()).setAttribute(n,i)},yt.prototype.hookEventHandlers_ewuthb$=function(t,n,i){var r,o,a,s=new b([]);for(r=i.iterator();r.hasNext();){var l=r.next();switch(l.name){case"MOUSE_CLICKED":o=w.Companion.CLICK;break;case"MOUSE_PRESSED":o=w.Companion.MOUSE_DOWN;break;case"MOUSE_RELEASED":o=w.Companion.MOUSE_UP;break;case"MOUSE_OVER":o=w.Companion.MOUSE_OVER;break;case"MOUSE_MOVE":o=w.Companion.MOUSE_MOVE;break;case"MOUSE_OUT":o=w.Companion.MOUSE_OUT;break;default:throw y("unexpected event spec "+l)}var u=o;s.add_3xv6fb$(this.addMouseHandler_0(t,e.isType(a=n,EventTarget)?a:g(),l,u.name))}return s},$t.prototype.handleEvent=function(t){var n;t.stopPropagation();var i=e.isType(n=t,MouseEvent)?n:g(),r=new k(i.clientX,i.clientY,x.DomEventUtil.getButton_tfvzir$(i),x.DomEventUtil.getModifiers_tfvzir$(i));this.closure$source.dispatch_lgzia2$(this.closure$spec,r)},$t.$metadata$={kind:d,interfaces:[]},vt.prototype.doRemove=function(){this.closure$target.removeEventListener(this.closure$eventType,this.closure$listener,!1)},vt.$metadata$={kind:d,interfaces:[E]},yt.prototype.addMouseHandler_0=function(t,e,n,i){var r=new $t(t,n);return e.addEventListener(i,r,!1),new vt(e,i,r)},yt.$metadata$={kind:d,simpleName:"DomTargetPeer",interfaces:[mt]},gt.prototype.toDataUrl_nps3vt$=function(t,n,i){var r,o,a=null==(r=document.createElement("canvas"))||e.isType(r,HTMLCanvasElement)?r:g();if(null==a)throw h("Canvas is not supported.");a.width=t,a.height=n;for(var s=e.isType(o=a.getContext("2d"),CanvasRenderingContext2D)?o:g(),l=s.createImageData(t,n),u=l.data,c=0;c>24&255,t,e),Vt(i,r,n>>16&255,t,e),Yt(i,r,n>>8&255,t,e),Ht(i,r,255&n,t,e)},gt.$metadata$={kind:d,simpleName:"RGBEncoderDom",interfaces:[C]},bt.prototype.ensureSourceRegistered_0=function(t){if(!this.myMappingMap_0.containsKey_11rb$(t))throw h("Trying to call platform peer method of unmapped node")},bt.prototype.registerMapper_dxg7rd$=function(t,e){this.myMappingMap_0.put_xwzc9p$(t,e)},bt.prototype.unregisterMapper_26jijc$=function(t){this.myMappingMap_0.remove_11rb$(t)},bt.prototype.getComputedTextLength_u60gfq$=function(t){var n,i;this.ensureSourceRegistered_0(e.isType(n=t,S)?n:g());var r=u(this.myMappingMap_0.get_11rb$(t)).target;return(e.isType(i=r,SVGTextContentElement)?i:g()).getComputedTextLength()},bt.prototype.transformCoordinates_1=function(t,n,i){var r,o;this.ensureSourceRegistered_0(e.isType(r=t,S)?r:g());var a=u(this.myMappingMap_0.get_11rb$(t)).target;return this.transformCoordinates_0(e.isType(o=a,SVGElement)?o:g(),n.x,n.y,i)},bt.prototype.transformCoordinates_0=function(t,n,i,r){var o,a=(e.isType(o=t,SVGGraphicsElement)?o:g()).getCTM();r&&(a=u(a).inverse());var s=u(t.ownerSVGElement).createSVGPoint();s.x=n,s.y=i;var l=s.matrixTransform(u(a));return new T(l.x,l.y)},bt.prototype.inverseScreenTransform_ljxa03$=function(t,n){var i,r=t.ownerSvgElement;this.ensureSourceRegistered_0(u(r));var o=u(this.myMappingMap_0.get_11rb$(r)).target;return this.inverseScreenTransform_0(e.isType(i=o,SVGSVGElement)?i:g(),n.x,n.y)},bt.prototype.inverseScreenTransform_0=function(t,e,n){var i=u(t.getScreenCTM()).inverse(),r=t.createSVGPoint();return r.x=e,r.y=n,r=r.matrixTransform(i),new T(r.x,r.y)},bt.prototype.invertTransform_12yub8$=function(t,e){return this.transformCoordinates_1(t,e,!0)},bt.prototype.applyTransform_12yub8$=function(t,e){return this.transformCoordinates_1(t,e,!1)},bt.prototype.getBBox_7snaev$=function(t){var n;this.ensureSourceRegistered_0(e.isType(n=t,S)?n:g());var i=u(this.myMappingMap_0.get_11rb$(t)).target;return this.getBoundingBox_0(i)},bt.prototype.getBoundingBox_0=function(t){var n,i=(e.isType(n=t,SVGGraphicsElement)?n:g()).getBBox();return O(i.x,i.y,i.width,i.height)},bt.$metadata$={kind:d,simpleName:"SvgDomPeer",interfaces:[P]},kt.prototype.onAttrSet_ud3ldc$=function(t){null==t.newValue&&this.this$SvgElementMapper.target.removeAttribute(t.attrSpec.name),this.this$SvgElementMapper.target.setAttribute(t.attrSpec.name,l(t.newValue))},kt.$metadata$={kind:d,interfaces:[A]},xt.prototype.attach_1rog5x$=function(t){var e;for(this.myReg_0=this.this$SvgElementMapper.source.addListener_e4m8w6$(new kt(this.this$SvgElementMapper)),e=this.this$SvgElementMapper.source.attributeKeys.iterator();e.hasNext();){var n=e.next(),i=n.name,r=l(this.this$SvgElementMapper.source.getAttribute_61zpoe$(i).get());n.hasNamespace()?this.this$SvgElementMapper.target.setAttributeNS(n.namespaceUri,i,r):this.this$SvgElementMapper.target.setAttribute(i,r)}},xt.prototype.detach=function(){u(this.myReg_0).remove()},xt.$metadata$={kind:d,interfaces:[m]},Ct.prototype.apply_11rb$=function(t){if(e.isType(t,MouseEvent)){var n=this.this$SvgElementMapper.createMouseEvent_0(t);return this.this$SvgElementMapper.source.dispatch_lgzia2$(this.closure$spec,n),!0}return!1},Ct.$metadata$={kind:d,interfaces:[I]},Et.prototype.set_11rb$=function(t){var e,n,i;for(null==this.this$SvgElementMapper.myHandlersRegs_0&&(this.this$SvgElementMapper.myHandlersRegs_0=M()),e=L(),n=0;n!==e.length;++n){var r=e[n];if(!u(t).contains_11rb$(r)&&u(this.this$SvgElementMapper.myHandlersRegs_0).containsKey_11rb$(r)&&u(u(this.this$SvgElementMapper.myHandlersRegs_0).remove_11rb$(r)).dispose(),t.contains_11rb$(r)&&!u(this.this$SvgElementMapper.myHandlersRegs_0).containsKey_11rb$(r)){switch(r.name){case"MOUSE_CLICKED":i=w.Companion.CLICK;break;case"MOUSE_PRESSED":i=w.Companion.MOUSE_DOWN;break;case"MOUSE_RELEASED":i=w.Companion.MOUSE_UP;break;case"MOUSE_OVER":i=w.Companion.MOUSE_OVER;break;case"MOUSE_MOVE":i=w.Companion.MOUSE_MOVE;break;case"MOUSE_OUT":i=w.Companion.MOUSE_OUT;break;default:throw R()}var o=i,a=u(this.this$SvgElementMapper.myHandlersRegs_0),s=Ut(this.this$SvgElementMapper.target,o,new Ct(this.this$SvgElementMapper,r));a.put_xwzc9p$(r,s)}}},Et.$metadata$={kind:d,interfaces:[z]},wt.prototype.registerSynchronizers_jp3a7u$=function(t){St.prototype.registerSynchronizers_jp3a7u$.call(this,t),t.add_te27wm$(new xt(this)),t.add_te27wm$(j.Synchronizers.forPropsOneWay_2ov6i0$(this.source.handlersSet(),new Et(this)))},wt.prototype.onDetach=function(){var t;if(St.prototype.onDetach.call(this),null!=this.myHandlersRegs_0){for(t=u(this.myHandlersRegs_0).values.iterator();t.hasNext();)t.next().dispose();u(this.myHandlersRegs_0).clear()}},wt.prototype.createMouseEvent_0=function(t){t.stopPropagation();var e=this.myPeer_0.inverseScreenTransform_ljxa03$(this.source,new T(t.clientX,t.clientY));return new k(D(e.x),D(e.y),x.DomEventUtil.getButton_tfvzir$(t),x.DomEventUtil.getModifiers_tfvzir$(t))},wt.$metadata$={kind:d,simpleName:"SvgElementMapper",interfaces:[St]},St.prototype.registerSynchronizers_jp3a7u$=function(t){B.prototype.registerSynchronizers_jp3a7u$.call(this,t),this.source.isPrebuiltSubtree?t.add_te27wm$(new dt(this.source,this.target,new yt)):t.add_te27wm$(j.Synchronizers.forObservableRole_umd8ru$(this,this.source.children(),_e().nodeChildren_b3w3xb$(this.target),new Tt(this.peer_cyou3s$_0)))},St.prototype.onAttach_8uof53$=function(t){B.prototype.onAttach_8uof53$.call(this,t),this.peer_cyou3s$_0.registerMapper_dxg7rd$(this.source,this)},St.prototype.onDetach=function(){B.prototype.onDetach.call(this),this.peer_cyou3s$_0.unregisterMapper_26jijc$(this.source)},St.$metadata$={kind:d,simpleName:"SvgNodeMapper",interfaces:[B]},Tt.prototype.createMapper_11rb$=function(t){if(e.isType(t,F)){var n=t;return e.isType(n,U)&&(n=n.asImageElement_xhdger$(new gt)),new wt(n,_e().generateElement_b1cgbq$(t),this.myPeer_0)}if(e.isType(t,c))return new wt(t,_e().generateElement_b1cgbq$(t),this.myPeer_0);if(e.isType(t,p))return new jt(t,_e().generateTextElement_tginx7$(t),this.myPeer_0);if(e.isType(t,s))return new St(t,_e().generateSlimNode_qwqme8$(t),this.myPeer_0);throw h("Unsupported SvgNode "+e.getKClassFromExpression(t))},Tt.$metadata$={kind:d,simpleName:"SvgNodeMapperFactory",interfaces:[q]},Nt.prototype.createDocument_0=function(){var t;return e.isType(t=document.createElementNS(G.XmlNamespace.SVG_NAMESPACE_URI,"svg"),SVGSVGElement)?t:g()},Nt.$metadata$={kind:v,simpleName:"Companion",interfaces:[]};var Pt=null;function At(){return null===Pt&&new Nt,Pt}function jt(t,e,n){St.call(this,t,e,n)}function Lt(t){this.this$SvgTextNodeMapper=t}function Rt(){It=this,this.DEFAULT="default",this.NONE="none",this.BLOCK="block",this.FLEX="flex",this.GRID="grid",this.INLINE_BLOCK="inline-block"}Ot.prototype.onAttach_8uof53$=function(t){if(B.prototype.onAttach_8uof53$.call(this,t),!this.source.isAttached())throw h("Element must be attached");var e=new bt;this.source.container().setPeer_kqs5uc$(e),this.myRootMapper_0=new wt(this.source,this.target,e),this.target.setAttribute("shape-rendering","geometricPrecision"),u(this.myRootMapper_0).attachRoot_8uof53$()},Ot.prototype.onDetach=function(){u(this.myRootMapper_0).detachRoot(),this.myRootMapper_0=null,this.source.isAttached()&&this.source.container().setPeer_kqs5uc$(null),B.prototype.onDetach.call(this)},Ot.$metadata$={kind:d,simpleName:"SvgRootDocumentMapper",interfaces:[B]},Lt.prototype.set_11rb$=function(t){this.this$SvgTextNodeMapper.target.nodeValue=t},Lt.$metadata$={kind:d,interfaces:[z]},jt.prototype.registerSynchronizers_jp3a7u$=function(t){St.prototype.registerSynchronizers_jp3a7u$.call(this,t),t.add_te27wm$(j.Synchronizers.forPropsOneWay_2ov6i0$(this.source.textContent(),new Lt(this)))},jt.$metadata$={kind:d,simpleName:"SvgTextNodeMapper",interfaces:[St]},Rt.$metadata$={kind:v,simpleName:"CssDisplay",interfaces:[]};var It=null;function zt(){return null===It&&new Rt,It}function Dt(t,e){return t.removeProperty(e),t}function Mt(t){return Dt(t,"display")}function Bt(t){this.closure$handler=t}function Ut(t,e,n){return qt(t,e,new Bt(n),!1)}function Ft(t,e,n){this.closure$type=t,this.closure$listener=e,this.this$onEvent=n,E.call(this)}function qt(t,e,n,i){return t.addEventListener(e.name,n,i),new Ft(e,n,t)}function Gt(t,e,n,i,r){Kt(t,e,n,i,r,3)}function Ht(t,e,n,i,r){Kt(t,e,n,i,r,2)}function Yt(t,e,n,i,r){Kt(t,e,n,i,r,1)}function Vt(t,e,n,i,r){Kt(t,e,n,i,r,0)}function Kt(t,n,i,r,o,a){n[(4*(r+e.imul(o,t.width)|0)|0)+a|0]=i}function Wt(t){return t.childNodes.length}function Xt(t,e){return t.insertBefore(e,t.firstChild)}function Zt(t,e,n){var i=null!=n?n.nextSibling:null;null==i?t.appendChild(e):t.insertBefore(e,i)}function Jt(){he=this}function Qt(t){this.closure$n=t,Y.call(this)}function te(t,e){this.closure$items=t,this.closure$base=e,Y.call(this)}function ee(t){this.closure$e=t}function ne(t){this.closure$element=t,this.myTimerRegistration_0=null,this.myListeners_0=new X}function ie(t,e){this.closure$value=t,this.closure$currentValue=e}function re(t){this.closure$timer=t,E.call(this)}function oe(t,e){this.closure$reg=t,this.this$=e,E.call(this)}function ae(t,e){this.closure$el=t,this.closure$cls=e,this.myValue_0=null}function se(t,e){this.closure$el=t,this.closure$attr=e}function le(t,e,n){this.closure$el=t,this.closure$attr=e,this.closure$attrValue=n}function ue(t){this.closure$el=t}function ce(t){this.closure$el=t}function pe(t,e){this.closure$period=t,this.closure$supplier=e,nt.call(this),this.myTimer_0=-1}Bt.prototype.handleEvent=function(t){this.closure$handler.apply_11rb$(t)||(t.preventDefault(),t.stopPropagation())},Bt.$metadata$={kind:d,interfaces:[]},Ft.prototype.doRemove=function(){this.this$onEvent.removeEventListener(this.closure$type.name,this.closure$listener)},Ft.$metadata$={kind:d,interfaces:[E]},Jt.prototype.elementChildren_2rdptt$=function(t){return this.nodeChildren_b3w3xb$(t)},Object.defineProperty(Qt.prototype,"size",{configurable:!0,get:function(){return Wt(this.closure$n)}}),Qt.prototype.get_za3lpa$=function(t){return this.closure$n.childNodes[t]},Qt.prototype.set_wxm5ur$=function(t,e){if(null!=u(e).parentNode)throw R();var n=u(this.get_za3lpa$(t));return this.closure$n.replaceChild(n,e),n},Qt.prototype.add_wxm5ur$=function(t,e){if(null!=u(e).parentNode)throw R();if(0===t)Xt(this.closure$n,e);else{var n=t-1|0,i=this.closure$n.childNodes[n];Zt(this.closure$n,e,i)}},Qt.prototype.removeAt_za3lpa$=function(t){var e=u(this.closure$n.childNodes[t]);return this.closure$n.removeChild(e),e},Qt.$metadata$={kind:d,interfaces:[Y]},Jt.prototype.nodeChildren_b3w3xb$=function(t){return new Qt(t)},Object.defineProperty(te.prototype,"size",{configurable:!0,get:function(){return this.closure$items.size}}),te.prototype.get_za3lpa$=function(t){return this.closure$items.get_za3lpa$(t)},te.prototype.set_wxm5ur$=function(t,e){var n=this.closure$items.set_wxm5ur$(t,e);return this.closure$base.set_wxm5ur$(t,u(n).getElement()),n},te.prototype.add_wxm5ur$=function(t,e){this.closure$items.add_wxm5ur$(t,e),this.closure$base.add_wxm5ur$(t,u(e).getElement())},te.prototype.removeAt_za3lpa$=function(t){var e=this.closure$items.removeAt_za3lpa$(t);return this.closure$base.removeAt_za3lpa$(t),e},te.$metadata$={kind:d,interfaces:[Y]},Jt.prototype.withElementChildren_9w66cp$=function(t){return new te(a(),t)},ee.prototype.set_11rb$=function(t){this.closure$e.innerHTML=t},ee.$metadata$={kind:d,interfaces:[z]},Jt.prototype.innerTextOf_2rdptt$=function(t){return new ee(t)},Object.defineProperty(ne.prototype,"propExpr",{configurable:!0,get:function(){return"checkbox("+this.closure$element+")"}}),ne.prototype.get=function(){return this.closure$element.checked},ne.prototype.set_11rb$=function(t){this.closure$element.checked=t},ie.prototype.call_11rb$=function(t){t.onEvent_11rb$(new K(this.closure$value.get(),this.closure$currentValue))},ie.$metadata$={kind:d,interfaces:[W]},re.prototype.doRemove=function(){window.clearInterval(this.closure$timer)},re.$metadata$={kind:d,interfaces:[E]},oe.prototype.doRemove=function(){this.closure$reg.remove(),this.this$.myListeners_0.isEmpty&&(u(this.this$.myTimerRegistration_0).remove(),this.this$.myTimerRegistration_0=null)},oe.$metadata$={kind:d,interfaces:[E]},ne.prototype.addHandler_gxwwpc$=function(t){if(this.myListeners_0.isEmpty){var e=new V(this.closure$element.checked),n=window.setInterval((i=this.closure$element,r=e,o=this,function(){var t=i.checked;return t!==r.get()&&(o.myListeners_0.fire_kucmxw$(new ie(r,t)),r.set_11rb$(t)),H}));this.myTimerRegistration_0=new re(n)}var i,r,o;return new oe(this.myListeners_0.add_11rb$(t),this)},ne.$metadata$={kind:d,interfaces:[Z]},Jt.prototype.checkbox_36rv4q$=function(t){return new ne(t)},ae.prototype.set_11rb$=function(t){this.myValue_0!==t&&(t?J(this.closure$el,[this.closure$cls]):Q(this.closure$el,[this.closure$cls]),this.myValue_0=t)},ae.$metadata$={kind:d,interfaces:[z]},Jt.prototype.hasClass_t9mn69$=function(t,e){return new ae(t,e)},se.prototype.set_11rb$=function(t){this.closure$el.setAttribute(this.closure$attr,t)},se.$metadata$={kind:d,interfaces:[z]},Jt.prototype.attribute_t9mn69$=function(t,e){return new se(t,e)},le.prototype.set_11rb$=function(t){t?this.closure$el.setAttribute(this.closure$attr,this.closure$attrValue):this.closure$el.removeAttribute(this.closure$attr)},le.$metadata$={kind:d,interfaces:[z]},Jt.prototype.hasAttribute_1x5wil$=function(t,e,n){return new le(t,e,n)},ue.prototype.set_11rb$=function(t){t?Mt(this.closure$el.style):this.closure$el.style.display=zt().NONE},ue.$metadata$={kind:d,interfaces:[z]},Jt.prototype.visibilityOf_lt8gi4$=function(t){return new ue(t)},ce.prototype.get=function(){return new tt(this.closure$el.clientWidth,this.closure$el.clientHeight)},ce.$metadata$={kind:d,interfaces:[et]},Jt.prototype.dimension_2rdptt$=function(t){return this.timerBasedProperty_ndenup$(new ce(t),200)},pe.prototype.doAddListeners=function(){var t;this.myTimer_0=window.setInterval((t=this,function(){return t.update(),H}),this.closure$period)},pe.prototype.doRemoveListeners=function(){window.clearInterval(this.myTimer_0)},pe.prototype.doGet=function(){return this.closure$supplier.get()},pe.$metadata$={kind:d,interfaces:[nt]},Jt.prototype.timerBasedProperty_ndenup$=function(t,e){return new pe(e,t)},Jt.prototype.generateElement_b1cgbq$=function(t){if(e.isType(t,it))return this.createSVGElement_0("ellipse");if(e.isType(t,rt))return this.createSVGElement_0("circle");if(e.isType(t,ot))return this.createSVGElement_0("rect");if(e.isType(t,at))return this.createSVGElement_0("text");if(e.isType(t,st))return this.createSVGElement_0("path");if(e.isType(t,lt))return this.createSVGElement_0("line");if(e.isType(t,ut))return this.createSVGElement_0("svg");if(e.isType(t,ct))return this.createSVGElement_0("g");if(e.isType(t,pt))return this.createSVGElement_0("style");if(e.isType(t,ht))return this.createSVGElement_0("tspan");if(e.isType(t,_t))return this.createSVGElement_0("defs");if(e.isType(t,ft))return this.createSVGElement_0("clipPath");if(e.isType(t,F))return this.createSVGElement_0("image");throw h("Unsupported svg element "+l(e.getKClassFromExpression(t).simpleName))},Jt.prototype.generateSlimNode_qwqme8$=function(t){switch(t.elementName){case"g":return this.createSVGElement_0("g");case"line":return this.createSVGElement_0("line");case"circle":return this.createSVGElement_0("circle");case"rect":return this.createSVGElement_0("rect");case"path":return this.createSVGElement_0("path");default:throw h("Unsupported SvgSlimNode "+e.getKClassFromExpression(t))}},Jt.prototype.generateTextElement_tginx7$=function(t){return document.createTextNode("")},Jt.prototype.createSVGElement_0=function(t){var n;return e.isType(n=document.createElementNS(G.XmlNamespace.SVG_NAMESPACE_URI,t),SVGElement)?n:g()},Jt.$metadata$={kind:v,simpleName:"DomUtil",interfaces:[]};var he=null;function _e(){return null===he&&new Jt,he}var fe=t.jetbrains||(t.jetbrains={}),de=fe.datalore||(fe.datalore={}),me=de.vis||(de.vis={}),ye=me.svgMapper||(me.svgMapper={});ye.SvgNodeSubtreeGeneratingSynchronizer=dt,ye.TargetPeer=mt;var $e=ye.dom||(ye.dom={});$e.DomTargetPeer=yt,$e.RGBEncoderDom=gt,$e.SvgDomPeer=bt,$e.SvgElementMapper=wt,$e.SvgNodeMapper=St,$e.SvgNodeMapperFactory=Tt,Object.defineProperty(Ot,"Companion",{get:At}),$e.SvgRootDocumentMapper=Ot,$e.SvgTextNodeMapper=jt;var ve=$e.css||($e.css={});Object.defineProperty(ve,"CssDisplay",{get:zt});var ge=$e.domExtensions||($e.domExtensions={});ge.clearProperty_77nir7$=Dt,ge.clearDisplay_b8w5wr$=Mt,ge.on_wkfwsw$=Ut,ge.onEvent_jxnl6r$=qt,ge.setAlphaAt_h5k0c3$=Gt,ge.setBlueAt_h5k0c3$=Ht,ge.setGreenAt_h5k0c3$=Yt,ge.setRedAt_h5k0c3$=Vt,ge.setColorAt_z0tnfj$=Kt,ge.get_childCount_asww5s$=Wt,ge.insertFirst_fga9sf$=Xt,ge.insertAfter_5a54o3$=Zt;var be=$e.domUtil||($e.domUtil={});return Object.defineProperty(be,"DomUtil",{get:_e}),t})?i.apply(e,r):i)||(t.exports=o)},331:function(t,e,n){var i,r,o;r=[e,n(421),n(767)],void 0===(o="function"==typeof(i=function(t,e,n){"use strict";var i=e.Kind.OBJECT,r=e.hashCode,o=e.throwCCE,a=e.equals,s=e.Kind.CLASS,l=e.ensureNotNull,u=e.kotlin.Enum,c=e.throwISE,p=e.Kind.INTERFACE,h=e.kotlin.collections.HashMap_init_q3lmfv$,_=e.kotlin.IllegalArgumentException_init,f=Object,d=n.jetbrains.datalore.base.observable.property.PropertyChangeEvent,m=n.jetbrains.datalore.base.observable.property.Property,y=n.jetbrains.datalore.base.observable.event.ListenerCaller,$=n.jetbrains.datalore.base.observable.event.Listeners,v=n.jetbrains.datalore.base.registration.Registration,g=n.jetbrains.datalore.base.listMap.ListMap,b=e.kotlin.collections.emptySet_287e2$,w=e.kotlin.text.StringBuilder_init,x=n.jetbrains.datalore.base.observable.property.ReadableProperty,k=(e.kotlin.Unit,e.kotlin.IllegalStateException_init_pdl1vj$),E=n.jetbrains.datalore.base.observable.collections.list.ObservableList,C=n.jetbrains.datalore.base.observable.children.ChildList,S=n.jetbrains.datalore.base.observable.children.SimpleComposite,T=e.kotlin.text.StringBuilder,O=n.jetbrains.datalore.base.observable.property.ValueProperty,N=e.toBoxedChar,P=e.kotlin.text.uppercaseChar_myv2d0$,A=e.getKClass,j=e.toString,L=e.kotlin.IllegalArgumentException_init_pdl1vj$,R=e.unboxChar,I=e.kotlin.collections.ArrayList_init_ww73n8$,z=e.kotlin.collections.ArrayList_init_287e2$,D=n.jetbrains.datalore.base.geometry.DoubleVector,M=e.kotlin.collections.ArrayList_init_mqih57$,B=Math,U=e.kotlin.text.split_ip8yn$,F=e.kotlin.text.contains_li3zpu$,q=n.jetbrains.datalore.base.observable.property.WritableProperty,G=e.kotlin.UnsupportedOperationException_init_pdl1vj$,H=n.jetbrains.datalore.base.observable.collections.list.ObservableArrayList,Y=e.numberToInt,V=n.jetbrains.datalore.base.event.Event,K=(e.numberToDouble,e.kotlin.text.toDouble_pdl1vz$,e.kotlin.collections.filterNotNull_m3lr2h$),W=e.kotlin.collections.emptyList_287e2$,X=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$;function Z(t,e){tt(),this.name=t,this.namespaceUri=e}function J(){Q=this}Is.prototype=Object.create(S.prototype),Is.prototype.constructor=Is,la.prototype=Object.create(Is.prototype),la.prototype.constructor=la,Al.prototype=Object.create(la.prototype),Al.prototype.constructor=Al,Oa.prototype=Object.create(Al.prototype),Oa.prototype.constructor=Oa,et.prototype=Object.create(Oa.prototype),et.prototype.constructor=et,Qn.prototype=Object.create(u.prototype),Qn.prototype.constructor=Qn,ot.prototype=Object.create(Oa.prototype),ot.prototype.constructor=ot,ri.prototype=Object.create(u.prototype),ri.prototype.constructor=ri,sa.prototype=Object.create(Oa.prototype),sa.prototype.constructor=sa,da.prototype=Object.create(v.prototype),da.prototype.constructor=da,$a.prototype=Object.create(Oa.prototype),$a.prototype.constructor=$a,ka.prototype=Object.create(v.prototype),ka.prototype.constructor=ka,Ea.prototype=Object.create(v.prototype),Ea.prototype.constructor=Ea,Ta.prototype=Object.create(Oa.prototype),Ta.prototype.constructor=Ta,Va.prototype=Object.create(u.prototype),Va.prototype.constructor=Va,os.prototype=Object.create(u.prototype),os.prototype.constructor=os,hs.prototype=Object.create(Oa.prototype),hs.prototype.constructor=hs,ys.prototype=Object.create(hs.prototype),ys.prototype.constructor=ys,bs.prototype=Object.create(Oa.prototype),bs.prototype.constructor=bs,zs.prototype=Object.create(C.prototype),zs.prototype.constructor=zs,Fs.prototype=Object.create(O.prototype),Fs.prototype.constructor=Fs,Gs.prototype=Object.create(u.prototype),Gs.prototype.constructor=Gs,_l.prototype=Object.create(u.prototype),_l.prototype.constructor=_l,$l.prototype=Object.create(Oa.prototype),$l.prototype.constructor=$l,xl.prototype=Object.create(Oa.prototype),xl.prototype.constructor=xl,Il.prototype=Object.create(la.prototype),Il.prototype.constructor=Il,zl.prototype=Object.create(Al.prototype),zl.prototype.constructor=zl,Gl.prototype=Object.create(la.prototype),Gl.prototype.constructor=Gl,Ql.prototype=Object.create(Oa.prototype),Ql.prototype.constructor=Ql,ou.prototype=Object.create(H.prototype),ou.prototype.constructor=ou,iu.prototype=Object.create(Is.prototype),iu.prototype.constructor=iu,Nu.prototype=Object.create(V.prototype),Nu.prototype.constructor=Nu,Au.prototype=Object.create(u.prototype),Au.prototype.constructor=Au,Bu.prototype=Object.create(Is.prototype),Bu.prototype.constructor=Bu,Uu.prototype=Object.create(Yu.prototype),Uu.prototype.constructor=Uu,Gu.prototype=Object.create(Bu.prototype),Gu.prototype.constructor=Gu,qu.prototype=Object.create(Uu.prototype),qu.prototype.constructor=qu,J.prototype.createSpec_ytbaoo$=function(t){return new Z(t,null)},J.prototype.createSpecNS_wswq18$=function(t,e,n){return new Z(e+":"+t,n)},J.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Q=null;function tt(){return null===Q&&new J,Q}function et(){rt(),Oa.call(this),this.elementName_4ww0r9$_0="circle"}function nt(){it=this,this.CX=tt().createSpec_ytbaoo$("cx"),this.CY=tt().createSpec_ytbaoo$("cy"),this.R=tt().createSpec_ytbaoo$("r")}Z.prototype.hasNamespace=function(){return null!=this.namespaceUri},Z.prototype.toString=function(){return this.name},Z.prototype.hashCode=function(){return r(this.name)},Z.prototype.equals=function(t){var n;return this===t||!(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))&&(e.isType(t,Z)||o(),!!a(this.name,t.name))},Z.$metadata$={kind:s,simpleName:"SvgAttributeSpec",interfaces:[]},nt.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var it=null;function rt(){return null===it&&new nt,it}function ot(){Jn(),Oa.call(this)}function at(){Zn=this,this.CLIP_PATH_UNITS_0=tt().createSpec_ytbaoo$("clipPathUnits")}Object.defineProperty(et.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_4ww0r9$_0}}),Object.defineProperty(et.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),et.prototype.cx=function(){return this.getAttribute_mumjwj$(rt().CX)},et.prototype.cy=function(){return this.getAttribute_mumjwj$(rt().CY)},et.prototype.r=function(){return this.getAttribute_mumjwj$(rt().R)},et.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},et.prototype.fill=function(){return this.getAttribute_mumjwj$(Pl().FILL)},et.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},et.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Pl().FILL_OPACITY)},et.prototype.stroke=function(){return this.getAttribute_mumjwj$(Pl().STROKE)},et.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},et.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Pl().STROKE_OPACITY)},et.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Pl().STROKE_WIDTH)},et.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},et.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},et.$metadata$={kind:s,simpleName:"SvgCircleElement",interfaces:[Tl,_u,Oa]},at.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var st,lt,ut,ct,pt,ht,_t,ft,dt,mt,yt,$t,vt,gt,bt,wt,xt,kt,Et,Ct,St,Tt,Ot,Nt,Pt,At,jt,Lt,Rt,It,zt,Dt,Mt,Bt,Ut,Ft,qt,Gt,Ht,Yt,Vt,Kt,Wt,Xt,Zt,Jt,Qt,te,ee,ne,ie,re,oe,ae,se,le,ue,ce,pe,he,_e,fe,de,me,ye,$e,ve,ge,be,we,xe,ke,Ee,Ce,Se,Te,Oe,Ne,Pe,Ae,je,Le,Re,Ie,ze,De,Me,Be,Ue,Fe,qe,Ge,He,Ye,Ve,Ke,We,Xe,Ze,Je,Qe,tn,en,nn,rn,on,an,sn,ln,un,cn,pn,hn,_n,fn,dn,mn,yn,$n,vn,gn,bn,wn,xn,kn,En,Cn,Sn,Tn,On,Nn,Pn,An,jn,Ln,Rn,In,zn,Dn,Mn,Bn,Un,Fn,qn,Gn,Hn,Yn,Vn,Kn,Wn,Xn,Zn=null;function Jn(){return null===Zn&&new at,Zn}function Qn(t,e,n){u.call(this),this.myAttributeString_ss0dpy$_0=n,this.name$=t,this.ordinal$=e}function ti(){ti=function(){},st=new Qn("USER_SPACE_ON_USE",0,"userSpaceOnUse"),lt=new Qn("OBJECT_BOUNDING_BOX",1,"objectBoundingBox")}function ei(){return ti(),st}function ni(){return ti(),lt}function ii(){}function ri(t,e,n){u.call(this),this.literal_7kwssz$_0=n,this.name$=t,this.ordinal$=e}function oi(){oi=function(){},ut=new ri("ALICE_BLUE",0,"aliceblue"),ct=new ri("ANTIQUE_WHITE",1,"antiquewhite"),pt=new ri("AQUA",2,"aqua"),ht=new ri("AQUAMARINE",3,"aquamarine"),_t=new ri("AZURE",4,"azure"),ft=new ri("BEIGE",5,"beige"),dt=new ri("BISQUE",6,"bisque"),mt=new ri("BLACK",7,"black"),yt=new ri("BLANCHED_ALMOND",8,"blanchedalmond"),$t=new ri("BLUE",9,"blue"),vt=new ri("BLUE_VIOLET",10,"blueviolet"),gt=new ri("BROWN",11,"brown"),bt=new ri("BURLY_WOOD",12,"burlywood"),wt=new ri("CADET_BLUE",13,"cadetblue"),xt=new ri("CHARTREUSE",14,"chartreuse"),kt=new ri("CHOCOLATE",15,"chocolate"),Et=new ri("CORAL",16,"coral"),Ct=new ri("CORNFLOWER_BLUE",17,"cornflowerblue"),St=new ri("CORNSILK",18,"cornsilk"),Tt=new ri("CRIMSON",19,"crimson"),Ot=new ri("CYAN",20,"cyan"),Nt=new ri("DARK_BLUE",21,"darkblue"),Pt=new ri("DARK_CYAN",22,"darkcyan"),At=new ri("DARK_GOLDEN_ROD",23,"darkgoldenrod"),jt=new ri("DARK_GRAY",24,"darkgray"),Lt=new ri("DARK_GREEN",25,"darkgreen"),Rt=new ri("DARK_GREY",26,"darkgrey"),It=new ri("DARK_KHAKI",27,"darkkhaki"),zt=new ri("DARK_MAGENTA",28,"darkmagenta"),Dt=new ri("DARK_OLIVE_GREEN",29,"darkolivegreen"),Mt=new ri("DARK_ORANGE",30,"darkorange"),Bt=new ri("DARK_ORCHID",31,"darkorchid"),Ut=new ri("DARK_RED",32,"darkred"),Ft=new ri("DARK_SALMON",33,"darksalmon"),qt=new ri("DARK_SEA_GREEN",34,"darkseagreen"),Gt=new ri("DARK_SLATE_BLUE",35,"darkslateblue"),Ht=new ri("DARK_SLATE_GRAY",36,"darkslategray"),Yt=new ri("DARK_SLATE_GREY",37,"darkslategrey"),Vt=new ri("DARK_TURQUOISE",38,"darkturquoise"),Kt=new ri("DARK_VIOLET",39,"darkviolet"),Wt=new ri("DEEP_PINK",40,"deeppink"),Xt=new ri("DEEP_SKY_BLUE",41,"deepskyblue"),Zt=new ri("DIM_GRAY",42,"dimgray"),Jt=new ri("DIM_GREY",43,"dimgrey"),Qt=new ri("DODGER_BLUE",44,"dodgerblue"),te=new ri("FIRE_BRICK",45,"firebrick"),ee=new ri("FLORAL_WHITE",46,"floralwhite"),ne=new ri("FOREST_GREEN",47,"forestgreen"),ie=new ri("FUCHSIA",48,"fuchsia"),re=new ri("GAINSBORO",49,"gainsboro"),oe=new ri("GHOST_WHITE",50,"ghostwhite"),ae=new ri("GOLD",51,"gold"),se=new ri("GOLDEN_ROD",52,"goldenrod"),le=new ri("GRAY",53,"gray"),ue=new ri("GREY",54,"grey"),ce=new ri("GREEN",55,"green"),pe=new ri("GREEN_YELLOW",56,"greenyellow"),he=new ri("HONEY_DEW",57,"honeydew"),_e=new ri("HOT_PINK",58,"hotpink"),fe=new ri("INDIAN_RED",59,"indianred"),de=new ri("INDIGO",60,"indigo"),me=new ri("IVORY",61,"ivory"),ye=new ri("KHAKI",62,"khaki"),$e=new ri("LAVENDER",63,"lavender"),ve=new ri("LAVENDER_BLUSH",64,"lavenderblush"),ge=new ri("LAWN_GREEN",65,"lawngreen"),be=new ri("LEMON_CHIFFON",66,"lemonchiffon"),we=new ri("LIGHT_BLUE",67,"lightblue"),xe=new ri("LIGHT_CORAL",68,"lightcoral"),ke=new ri("LIGHT_CYAN",69,"lightcyan"),Ee=new ri("LIGHT_GOLDEN_ROD_YELLOW",70,"lightgoldenrodyellow"),Ce=new ri("LIGHT_GRAY",71,"lightgray"),Se=new ri("LIGHT_GREEN",72,"lightgreen"),Te=new ri("LIGHT_GREY",73,"lightgrey"),Oe=new ri("LIGHT_PINK",74,"lightpink"),Ne=new ri("LIGHT_SALMON",75,"lightsalmon"),Pe=new ri("LIGHT_SEA_GREEN",76,"lightseagreen"),Ae=new ri("LIGHT_SKY_BLUE",77,"lightskyblue"),je=new ri("LIGHT_SLATE_GRAY",78,"lightslategray"),Le=new ri("LIGHT_SLATE_GREY",79,"lightslategrey"),Re=new ri("LIGHT_STEEL_BLUE",80,"lightsteelblue"),Ie=new ri("LIGHT_YELLOW",81,"lightyellow"),ze=new ri("LIME",82,"lime"),De=new ri("LIME_GREEN",83,"limegreen"),Me=new ri("LINEN",84,"linen"),Be=new ri("MAGENTA",85,"magenta"),Ue=new ri("MAROON",86,"maroon"),Fe=new ri("MEDIUM_AQUA_MARINE",87,"mediumaquamarine"),qe=new ri("MEDIUM_BLUE",88,"mediumblue"),Ge=new ri("MEDIUM_ORCHID",89,"mediumorchid"),He=new ri("MEDIUM_PURPLE",90,"mediumpurple"),Ye=new ri("MEDIUM_SEAGREEN",91,"mediumseagreen"),Ve=new ri("MEDIUM_SLATE_BLUE",92,"mediumslateblue"),Ke=new ri("MEDIUM_SPRING_GREEN",93,"mediumspringgreen"),We=new ri("MEDIUM_TURQUOISE",94,"mediumturquoise"),Xe=new ri("MEDIUM_VIOLET_RED",95,"mediumvioletred"),Ze=new ri("MIDNIGHT_BLUE",96,"midnightblue"),Je=new ri("MINT_CREAM",97,"mintcream"),Qe=new ri("MISTY_ROSE",98,"mistyrose"),tn=new ri("MOCCASIN",99,"moccasin"),en=new ri("NAVAJO_WHITE",100,"navajowhite"),nn=new ri("NAVY",101,"navy"),rn=new ri("OLD_LACE",102,"oldlace"),on=new ri("OLIVE",103,"olive"),an=new ri("OLIVE_DRAB",104,"olivedrab"),sn=new ri("ORANGE",105,"orange"),ln=new ri("ORANGE_RED",106,"orangered"),un=new ri("ORCHID",107,"orchid"),cn=new ri("PALE_GOLDEN_ROD",108,"palegoldenrod"),pn=new ri("PALE_GREEN",109,"palegreen"),hn=new ri("PALE_TURQUOISE",110,"paleturquoise"),_n=new ri("PALE_VIOLET_RED",111,"palevioletred"),fn=new ri("PAPAYA_WHIP",112,"papayawhip"),dn=new ri("PEACH_PUFF",113,"peachpuff"),mn=new ri("PERU",114,"peru"),yn=new ri("PINK",115,"pink"),$n=new ri("PLUM",116,"plum"),vn=new ri("POWDER_BLUE",117,"powderblue"),gn=new ri("PURPLE",118,"purple"),bn=new ri("RED",119,"red"),wn=new ri("ROSY_BROWN",120,"rosybrown"),xn=new ri("ROYAL_BLUE",121,"royalblue"),kn=new ri("SADDLE_BROWN",122,"saddlebrown"),En=new ri("SALMON",123,"salmon"),Cn=new ri("SANDY_BROWN",124,"sandybrown"),Sn=new ri("SEA_GREEN",125,"seagreen"),Tn=new ri("SEASHELL",126,"seashell"),On=new ri("SIENNA",127,"sienna"),Nn=new ri("SILVER",128,"silver"),Pn=new ri("SKY_BLUE",129,"skyblue"),An=new ri("SLATE_BLUE",130,"slateblue"),jn=new ri("SLATE_GRAY",131,"slategray"),Ln=new ri("SLATE_GREY",132,"slategrey"),Rn=new ri("SNOW",133,"snow"),In=new ri("SPRING_GREEN",134,"springgreen"),zn=new ri("STEEL_BLUE",135,"steelblue"),Dn=new ri("TAN",136,"tan"),Mn=new ri("TEAL",137,"teal"),Bn=new ri("THISTLE",138,"thistle"),Un=new ri("TOMATO",139,"tomato"),Fn=new ri("TURQUOISE",140,"turquoise"),qn=new ri("VIOLET",141,"violet"),Gn=new ri("WHEAT",142,"wheat"),Hn=new ri("WHITE",143,"white"),Yn=new ri("WHITE_SMOKE",144,"whitesmoke"),Vn=new ri("YELLOW",145,"yellow"),Kn=new ri("YELLOW_GREEN",146,"yellowgreen"),Wn=new ri("NONE",147,"none"),Xn=new ri("CURRENT_COLOR",148,"currentColor"),Zo()}function ai(){return oi(),ut}function si(){return oi(),ct}function li(){return oi(),pt}function ui(){return oi(),ht}function ci(){return oi(),_t}function pi(){return oi(),ft}function hi(){return oi(),dt}function _i(){return oi(),mt}function fi(){return oi(),yt}function di(){return oi(),$t}function mi(){return oi(),vt}function yi(){return oi(),gt}function $i(){return oi(),bt}function vi(){return oi(),wt}function gi(){return oi(),xt}function bi(){return oi(),kt}function wi(){return oi(),Et}function xi(){return oi(),Ct}function ki(){return oi(),St}function Ei(){return oi(),Tt}function Ci(){return oi(),Ot}function Si(){return oi(),Nt}function Ti(){return oi(),Pt}function Oi(){return oi(),At}function Ni(){return oi(),jt}function Pi(){return oi(),Lt}function Ai(){return oi(),Rt}function ji(){return oi(),It}function Li(){return oi(),zt}function Ri(){return oi(),Dt}function Ii(){return oi(),Mt}function zi(){return oi(),Bt}function Di(){return oi(),Ut}function Mi(){return oi(),Ft}function Bi(){return oi(),qt}function Ui(){return oi(),Gt}function Fi(){return oi(),Ht}function qi(){return oi(),Yt}function Gi(){return oi(),Vt}function Hi(){return oi(),Kt}function Yi(){return oi(),Wt}function Vi(){return oi(),Xt}function Ki(){return oi(),Zt}function Wi(){return oi(),Jt}function Xi(){return oi(),Qt}function Zi(){return oi(),te}function Ji(){return oi(),ee}function Qi(){return oi(),ne}function tr(){return oi(),ie}function er(){return oi(),re}function nr(){return oi(),oe}function ir(){return oi(),ae}function rr(){return oi(),se}function or(){return oi(),le}function ar(){return oi(),ue}function sr(){return oi(),ce}function lr(){return oi(),pe}function ur(){return oi(),he}function cr(){return oi(),_e}function pr(){return oi(),fe}function hr(){return oi(),de}function _r(){return oi(),me}function fr(){return oi(),ye}function dr(){return oi(),$e}function mr(){return oi(),ve}function yr(){return oi(),ge}function $r(){return oi(),be}function vr(){return oi(),we}function gr(){return oi(),xe}function br(){return oi(),ke}function wr(){return oi(),Ee}function xr(){return oi(),Ce}function kr(){return oi(),Se}function Er(){return oi(),Te}function Cr(){return oi(),Oe}function Sr(){return oi(),Ne}function Tr(){return oi(),Pe}function Or(){return oi(),Ae}function Nr(){return oi(),je}function Pr(){return oi(),Le}function Ar(){return oi(),Re}function jr(){return oi(),Ie}function Lr(){return oi(),ze}function Rr(){return oi(),De}function Ir(){return oi(),Me}function zr(){return oi(),Be}function Dr(){return oi(),Ue}function Mr(){return oi(),Fe}function Br(){return oi(),qe}function Ur(){return oi(),Ge}function Fr(){return oi(),He}function qr(){return oi(),Ye}function Gr(){return oi(),Ve}function Hr(){return oi(),Ke}function Yr(){return oi(),We}function Vr(){return oi(),Xe}function Kr(){return oi(),Ze}function Wr(){return oi(),Je}function Xr(){return oi(),Qe}function Zr(){return oi(),tn}function Jr(){return oi(),en}function Qr(){return oi(),nn}function to(){return oi(),rn}function eo(){return oi(),on}function no(){return oi(),an}function io(){return oi(),sn}function ro(){return oi(),ln}function oo(){return oi(),un}function ao(){return oi(),cn}function so(){return oi(),pn}function lo(){return oi(),hn}function uo(){return oi(),_n}function co(){return oi(),fn}function po(){return oi(),dn}function ho(){return oi(),mn}function _o(){return oi(),yn}function fo(){return oi(),$n}function mo(){return oi(),vn}function yo(){return oi(),gn}function $o(){return oi(),bn}function vo(){return oi(),wn}function go(){return oi(),xn}function bo(){return oi(),kn}function wo(){return oi(),En}function xo(){return oi(),Cn}function ko(){return oi(),Sn}function Eo(){return oi(),Tn}function Co(){return oi(),On}function So(){return oi(),Nn}function To(){return oi(),Pn}function Oo(){return oi(),An}function No(){return oi(),jn}function Po(){return oi(),Ln}function Ao(){return oi(),Rn}function jo(){return oi(),In}function Lo(){return oi(),zn}function Ro(){return oi(),Dn}function Io(){return oi(),Mn}function zo(){return oi(),Bn}function Do(){return oi(),Un}function Mo(){return oi(),Fn}function Bo(){return oi(),qn}function Uo(){return oi(),Gn}function Fo(){return oi(),Hn}function qo(){return oi(),Yn}function Go(){return oi(),Vn}function Ho(){return oi(),Kn}function Yo(){return oi(),Wn}function Vo(){return oi(),Xn}function Ko(){Xo=this,this.svgColorList_0=this.createSvgColorList_0()}function Wo(t,e,n){this.myR_0=t,this.myG_0=e,this.myB_0=n}Object.defineProperty(ot.prototype,"elementName",{configurable:!0,get:function(){return"clipPath"}}),Object.defineProperty(ot.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),ot.prototype.clipPathUnits=function(){return this.getAttribute_mumjwj$(Jn().CLIP_PATH_UNITS_0)},ot.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},ot.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},ot.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},Qn.prototype.toString=function(){return this.myAttributeString_ss0dpy$_0},Qn.$metadata$={kind:s,simpleName:"ClipPathUnits",interfaces:[u]},Qn.values=function(){return[ei(),ni()]},Qn.valueOf_61zpoe$=function(t){switch(t){case"USER_SPACE_ON_USE":return ei();case"OBJECT_BOUNDING_BOX":return ni();default:c("No enum constant jetbrains.datalore.vis.svg.SvgClipPathElement.ClipPathUnits."+t)}},ot.$metadata$={kind:s,simpleName:"SvgClipPathElement",interfaces:[_u,Oa]},ii.$metadata$={kind:p,simpleName:"SvgColor",interfaces:[]},ri.prototype.toString=function(){return this.literal_7kwssz$_0},Ko.prototype.createSvgColorList_0=function(){var t,e=h(),n=Jo();for(t=0;t!==n.length;++t){var i=n[t],r=i.toString().toLowerCase();e.put_xwzc9p$(r,i)}return e},Ko.prototype.isColorName_61zpoe$=function(t){return this.svgColorList_0.containsKey_11rb$(t.toLowerCase())},Ko.prototype.forName_61zpoe$=function(t){var e;if(null==(e=this.svgColorList_0.get_11rb$(t.toLowerCase())))throw _();return e},Ko.prototype.create_qt1dr2$=function(t,e,n){return new Wo(t,e,n)},Ko.prototype.create_2160e9$=function(t){return null==t?Yo():new Wo(t.red,t.green,t.blue)},Wo.prototype.toString=function(){return"rgb("+this.myR_0+","+this.myG_0+","+this.myB_0+")"},Wo.$metadata$={kind:s,simpleName:"SvgColorRgb",interfaces:[ii]},Wo.prototype.component1_0=function(){return this.myR_0},Wo.prototype.component2_0=function(){return this.myG_0},Wo.prototype.component3_0=function(){return this.myB_0},Wo.prototype.copy_qt1dr2$=function(t,e,n){return new Wo(void 0===t?this.myR_0:t,void 0===e?this.myG_0:e,void 0===n?this.myB_0:n)},Wo.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*t+e.hashCode(this.myR_0)|0)+e.hashCode(this.myG_0)|0)+e.hashCode(this.myB_0)|0},Wo.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.myR_0,t.myR_0)&&e.equals(this.myG_0,t.myG_0)&&e.equals(this.myB_0,t.myB_0)},Ko.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Xo=null;function Zo(){return oi(),null===Xo&&new Ko,Xo}function Jo(){return[ai(),si(),li(),ui(),ci(),pi(),hi(),_i(),fi(),di(),mi(),yi(),$i(),vi(),gi(),bi(),wi(),xi(),ki(),Ei(),Ci(),Si(),Ti(),Oi(),Ni(),Pi(),Ai(),ji(),Li(),Ri(),Ii(),zi(),Di(),Mi(),Bi(),Ui(),Fi(),qi(),Gi(),Hi(),Yi(),Vi(),Ki(),Wi(),Xi(),Zi(),Ji(),Qi(),tr(),er(),nr(),ir(),rr(),or(),ar(),sr(),lr(),ur(),cr(),pr(),hr(),_r(),fr(),dr(),mr(),yr(),$r(),vr(),gr(),br(),wr(),xr(),kr(),Er(),Cr(),Sr(),Tr(),Or(),Nr(),Pr(),Ar(),jr(),Lr(),Rr(),Ir(),zr(),Dr(),Mr(),Br(),Ur(),Fr(),qr(),Gr(),Hr(),Yr(),Vr(),Kr(),Wr(),Xr(),Zr(),Jr(),Qr(),to(),eo(),no(),io(),ro(),oo(),ao(),so(),lo(),uo(),co(),po(),ho(),_o(),fo(),mo(),yo(),$o(),vo(),go(),bo(),wo(),xo(),ko(),Eo(),Co(),So(),To(),Oo(),No(),Po(),Ao(),jo(),Lo(),Ro(),Io(),zo(),Do(),Mo(),Bo(),Uo(),Fo(),qo(),Go(),Ho(),Yo(),Vo()]}function Qo(){ta=this,this.WIDTH="width",this.HEIGHT="height",this.SVG_TEXT_ANCHOR_ATTRIBUTE="text-anchor",this.SVG_STROKE_DASHARRAY_ATTRIBUTE="stroke-dasharray",this.SVG_STYLE_ATTRIBUTE="style",this.SVG_TEXT_DY_ATTRIBUTE="dy",this.SVG_TEXT_ANCHOR_START="start",this.SVG_TEXT_ANCHOR_MIDDLE="middle",this.SVG_TEXT_ANCHOR_END="end",this.SVG_TEXT_DY_TOP="0.7em",this.SVG_TEXT_DY_CENTER="0.35em"}ri.$metadata$={kind:s,simpleName:"SvgColors",interfaces:[ii,u]},ri.values=Jo,ri.valueOf_61zpoe$=function(t){switch(t){case"ALICE_BLUE":return ai();case"ANTIQUE_WHITE":return si();case"AQUA":return li();case"AQUAMARINE":return ui();case"AZURE":return ci();case"BEIGE":return pi();case"BISQUE":return hi();case"BLACK":return _i();case"BLANCHED_ALMOND":return fi();case"BLUE":return di();case"BLUE_VIOLET":return mi();case"BROWN":return yi();case"BURLY_WOOD":return $i();case"CADET_BLUE":return vi();case"CHARTREUSE":return gi();case"CHOCOLATE":return bi();case"CORAL":return wi();case"CORNFLOWER_BLUE":return xi();case"CORNSILK":return ki();case"CRIMSON":return Ei();case"CYAN":return Ci();case"DARK_BLUE":return Si();case"DARK_CYAN":return Ti();case"DARK_GOLDEN_ROD":return Oi();case"DARK_GRAY":return Ni();case"DARK_GREEN":return Pi();case"DARK_GREY":return Ai();case"DARK_KHAKI":return ji();case"DARK_MAGENTA":return Li();case"DARK_OLIVE_GREEN":return Ri();case"DARK_ORANGE":return Ii();case"DARK_ORCHID":return zi();case"DARK_RED":return Di();case"DARK_SALMON":return Mi();case"DARK_SEA_GREEN":return Bi();case"DARK_SLATE_BLUE":return Ui();case"DARK_SLATE_GRAY":return Fi();case"DARK_SLATE_GREY":return qi();case"DARK_TURQUOISE":return Gi();case"DARK_VIOLET":return Hi();case"DEEP_PINK":return Yi();case"DEEP_SKY_BLUE":return Vi();case"DIM_GRAY":return Ki();case"DIM_GREY":return Wi();case"DODGER_BLUE":return Xi();case"FIRE_BRICK":return Zi();case"FLORAL_WHITE":return Ji();case"FOREST_GREEN":return Qi();case"FUCHSIA":return tr();case"GAINSBORO":return er();case"GHOST_WHITE":return nr();case"GOLD":return ir();case"GOLDEN_ROD":return rr();case"GRAY":return or();case"GREY":return ar();case"GREEN":return sr();case"GREEN_YELLOW":return lr();case"HONEY_DEW":return ur();case"HOT_PINK":return cr();case"INDIAN_RED":return pr();case"INDIGO":return hr();case"IVORY":return _r();case"KHAKI":return fr();case"LAVENDER":return dr();case"LAVENDER_BLUSH":return mr();case"LAWN_GREEN":return yr();case"LEMON_CHIFFON":return $r();case"LIGHT_BLUE":return vr();case"LIGHT_CORAL":return gr();case"LIGHT_CYAN":return br();case"LIGHT_GOLDEN_ROD_YELLOW":return wr();case"LIGHT_GRAY":return xr();case"LIGHT_GREEN":return kr();case"LIGHT_GREY":return Er();case"LIGHT_PINK":return Cr();case"LIGHT_SALMON":return Sr();case"LIGHT_SEA_GREEN":return Tr();case"LIGHT_SKY_BLUE":return Or();case"LIGHT_SLATE_GRAY":return Nr();case"LIGHT_SLATE_GREY":return Pr();case"LIGHT_STEEL_BLUE":return Ar();case"LIGHT_YELLOW":return jr();case"LIME":return Lr();case"LIME_GREEN":return Rr();case"LINEN":return Ir();case"MAGENTA":return zr();case"MAROON":return Dr();case"MEDIUM_AQUA_MARINE":return Mr();case"MEDIUM_BLUE":return Br();case"MEDIUM_ORCHID":return Ur();case"MEDIUM_PURPLE":return Fr();case"MEDIUM_SEAGREEN":return qr();case"MEDIUM_SLATE_BLUE":return Gr();case"MEDIUM_SPRING_GREEN":return Hr();case"MEDIUM_TURQUOISE":return Yr();case"MEDIUM_VIOLET_RED":return Vr();case"MIDNIGHT_BLUE":return Kr();case"MINT_CREAM":return Wr();case"MISTY_ROSE":return Xr();case"MOCCASIN":return Zr();case"NAVAJO_WHITE":return Jr();case"NAVY":return Qr();case"OLD_LACE":return to();case"OLIVE":return eo();case"OLIVE_DRAB":return no();case"ORANGE":return io();case"ORANGE_RED":return ro();case"ORCHID":return oo();case"PALE_GOLDEN_ROD":return ao();case"PALE_GREEN":return so();case"PALE_TURQUOISE":return lo();case"PALE_VIOLET_RED":return uo();case"PAPAYA_WHIP":return co();case"PEACH_PUFF":return po();case"PERU":return ho();case"PINK":return _o();case"PLUM":return fo();case"POWDER_BLUE":return mo();case"PURPLE":return yo();case"RED":return $o();case"ROSY_BROWN":return vo();case"ROYAL_BLUE":return go();case"SADDLE_BROWN":return bo();case"SALMON":return wo();case"SANDY_BROWN":return xo();case"SEA_GREEN":return ko();case"SEASHELL":return Eo();case"SIENNA":return Co();case"SILVER":return So();case"SKY_BLUE":return To();case"SLATE_BLUE":return Oo();case"SLATE_GRAY":return No();case"SLATE_GREY":return Po();case"SNOW":return Ao();case"SPRING_GREEN":return jo();case"STEEL_BLUE":return Lo();case"TAN":return Ro();case"TEAL":return Io();case"THISTLE":return zo();case"TOMATO":return Do();case"TURQUOISE":return Mo();case"VIOLET":return Bo();case"WHEAT":return Uo();case"WHITE":return Fo();case"WHITE_SMOKE":return qo();case"YELLOW":return Go();case"YELLOW_GREEN":return Ho();case"NONE":return Yo();case"CURRENT_COLOR":return Vo();default:c("No enum constant jetbrains.datalore.vis.svg.SvgColors."+t)}},Qo.$metadata$={kind:i,simpleName:"SvgConstants",interfaces:[]};var ta=null;function ea(){return null===ta&&new Qo,ta}function na(){oa()}function ia(){ra=this,this.OPACITY=tt().createSpec_ytbaoo$("opacity"),this.CLIP_PATH=tt().createSpec_ytbaoo$("clip-path")}ia.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var ra=null;function oa(){return null===ra&&new ia,ra}function aa(){}function sa(){Oa.call(this),this.elementName_ohv755$_0="defs"}function la(){pa(),Is.call(this),this.myAttributes_9lwppr$_0=new ma(this),this.myListeners_acqj1r$_0=null,this.myEventPeer_bxokaa$_0=new wa}function ua(){ca=this,this.ID_0=tt().createSpec_ytbaoo$("id")}na.$metadata$={kind:p,simpleName:"SvgContainer",interfaces:[]},aa.$metadata$={kind:p,simpleName:"SvgCssResource",interfaces:[]},Object.defineProperty(sa.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_ohv755$_0}}),Object.defineProperty(sa.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),sa.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},sa.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},sa.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},sa.$metadata$={kind:s,simpleName:"SvgDefsElement",interfaces:[_u,na,Oa]},ua.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var ca=null;function pa(){return null===ca&&new ua,ca}function ha(t,e){this.closure$spec=t,this.this$SvgElement=e}function _a(t,e){this.closure$spec=t,this.closure$handler=e}function fa(t){this.closure$event=t}function da(t,e){this.closure$reg=t,this.this$SvgElement=e,v.call(this)}function ma(t){this.$outer=t,this.myAttrs_0=null}function ya(){}function $a(){ba(),Oa.call(this),this.elementName_psynub$_0="ellipse"}function va(){ga=this,this.CX=tt().createSpec_ytbaoo$("cx"),this.CY=tt().createSpec_ytbaoo$("cy"),this.RX=tt().createSpec_ytbaoo$("rx"),this.RY=tt().createSpec_ytbaoo$("ry")}Object.defineProperty(la.prototype,"ownerSvgElement",{configurable:!0,get:function(){for(var t,n=this;null!=n&&!e.isType(n,zl);)n=n.parentProperty().get();return null!=n?null==(t=n)||e.isType(t,zl)?t:o():null}}),Object.defineProperty(la.prototype,"attributeKeys",{configurable:!0,get:function(){return this.myAttributes_9lwppr$_0.keySet()}}),la.prototype.id=function(){return this.getAttribute_mumjwj$(pa().ID_0)},la.prototype.handlersSet=function(){return this.myEventPeer_bxokaa$_0.handlersSet()},la.prototype.addEventHandler_mm8kk2$=function(t,e){return this.myEventPeer_bxokaa$_0.addEventHandler_mm8kk2$(t,e)},la.prototype.dispatch_lgzia2$=function(t,n){var i;this.myEventPeer_bxokaa$_0.dispatch_2raoxs$(t,n,this),null!=this.parentProperty().get()&&!n.isConsumed&&e.isType(this.parentProperty().get(),la)&&(e.isType(i=this.parentProperty().get(),la)?i:o()).dispatch_lgzia2$(t,n)},la.prototype.getSpecByName_o4z2a7$_0=function(t){return tt().createSpec_ytbaoo$(t)},Object.defineProperty(ha.prototype,"propExpr",{configurable:!0,get:function(){return this.toString()+"."+this.closure$spec}}),ha.prototype.get=function(){return this.this$SvgElement.myAttributes_9lwppr$_0.get_mumjwj$(this.closure$spec)},ha.prototype.set_11rb$=function(t){this.this$SvgElement.myAttributes_9lwppr$_0.set_qdh7ux$(this.closure$spec,t)},_a.prototype.onAttrSet_ud3ldc$=function(t){var n,i;if(this.closure$spec===t.attrSpec){var r=null==(n=t.oldValue)||e.isType(n,f)?n:o(),a=null==(i=t.newValue)||e.isType(i,f)?i:o();this.closure$handler.onEvent_11rb$(new d(r,a))}},_a.$metadata$={kind:s,interfaces:[ya]},ha.prototype.addHandler_gxwwpc$=function(t){return this.this$SvgElement.addListener_e4m8w6$(new _a(this.closure$spec,t))},ha.$metadata$={kind:s,interfaces:[m]},la.prototype.getAttribute_mumjwj$=function(t){return new ha(t,this)},la.prototype.getAttribute_61zpoe$=function(t){var e=this.getSpecByName_o4z2a7$_0(t);return this.getAttribute_mumjwj$(e)},la.prototype.setAttribute_qdh7ux$=function(t,e){this.getAttribute_mumjwj$(t).set_11rb$(e)},la.prototype.setAttribute_jyasbz$=function(t,e){this.getAttribute_61zpoe$(t).set_11rb$(e)},fa.prototype.call_11rb$=function(t){t.onAttrSet_ud3ldc$(this.closure$event)},fa.$metadata$={kind:s,interfaces:[y]},la.prototype.onAttributeChanged_2oaikr$_0=function(t){null!=this.myListeners_acqj1r$_0&&l(this.myListeners_acqj1r$_0).fire_kucmxw$(new fa(t)),this.isAttached()&&this.container().attributeChanged_1u4bot$(this,t)},da.prototype.doRemove=function(){this.closure$reg.remove(),l(this.this$SvgElement.myListeners_acqj1r$_0).isEmpty&&(this.this$SvgElement.myListeners_acqj1r$_0=null)},da.$metadata$={kind:s,interfaces:[v]},la.prototype.addListener_e4m8w6$=function(t){return null==this.myListeners_acqj1r$_0&&(this.myListeners_acqj1r$_0=new $),new da(l(this.myListeners_acqj1r$_0).add_11rb$(t),this)},la.prototype.toString=function(){return"<"+this.elementName+" "+this.myAttributes_9lwppr$_0.toSvgString_8be2vx$()+">"},Object.defineProperty(ma.prototype,"isEmpty",{configurable:!0,get:function(){return null==this.myAttrs_0||l(this.myAttrs_0).isEmpty}}),ma.prototype.size=function(){return null==this.myAttrs_0?0:l(this.myAttrs_0).size()},ma.prototype.containsKey_p8ci7$=function(t){return null!=this.myAttrs_0&&l(this.myAttrs_0).containsKey_11rb$(t)},ma.prototype.get_mumjwj$=function(t){var n;return null!=this.myAttrs_0&&l(this.myAttrs_0).containsKey_11rb$(t)?null==(n=l(this.myAttrs_0).get_11rb$(t))||e.isType(n,f)?n:o():null},ma.prototype.set_qdh7ux$=function(t,n){var i,r;null==this.myAttrs_0&&(this.myAttrs_0=new g);var s=null==n?null==(i=l(this.myAttrs_0).remove_11rb$(t))||e.isType(i,f)?i:o():null==(r=l(this.myAttrs_0).put_xwzc9p$(t,n))||e.isType(r,f)?r:o();if(!a(n,s)){var u=new Nu(t,s,n);this.$outer.onAttributeChanged_2oaikr$_0(u)}return s},ma.prototype.remove_mumjwj$=function(t){return this.set_qdh7ux$(t,null)},ma.prototype.keySet=function(){return null==this.myAttrs_0?b():l(this.myAttrs_0).keySet()},ma.prototype.toSvgString_8be2vx$=function(){var t,e=w();for(t=this.keySet().iterator();t.hasNext();){var n=t.next();e.append_pdl1vj$(n.name).append_pdl1vj$('="').append_s8jyv4$(this.get_mumjwj$(n)).append_pdl1vj$('" ')}return e.toString()},ma.prototype.toString=function(){return this.toSvgString_8be2vx$()},ma.$metadata$={kind:s,simpleName:"AttributeMap",interfaces:[]},la.$metadata$={kind:s,simpleName:"SvgElement",interfaces:[Is]},ya.$metadata$={kind:p,simpleName:"SvgElementListener",interfaces:[]},va.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var ga=null;function ba(){return null===ga&&new va,ga}function wa(){this.myEventHandlers_0=null,this.myListeners_0=null}function xa(t){this.this$SvgEventPeer=t}function ka(t,e){this.closure$addReg=t,this.this$SvgEventPeer=e,v.call(this)}function Ea(t,e,n,i){this.closure$addReg=t,this.closure$specListeners=e,this.closure$eventHandlers=n,this.closure$spec=i,v.call(this)}function Ca(t,e){this.closure$oldHandlersSet=t,this.this$SvgEventPeer=e}function Sa(t,e){this.closure$event=t,this.closure$target=e}function Ta(){Oa.call(this),this.elementName_84zyy2$_0="g"}function Oa(){Ya(),Al.call(this)}function Na(){Ha=this,this.POINTER_EVENTS_0=tt().createSpec_ytbaoo$("pointer-events"),this.OPACITY=tt().createSpec_ytbaoo$("opacity"),this.VISIBILITY=tt().createSpec_ytbaoo$("visibility"),this.CLIP_PATH=tt().createSpec_ytbaoo$("clip-path"),this.CLIP_BOUNDS_JFX=tt().createSpec_ytbaoo$("clip-bounds-jfx")}Object.defineProperty($a.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_psynub$_0}}),Object.defineProperty($a.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),$a.prototype.cx=function(){return this.getAttribute_mumjwj$(ba().CX)},$a.prototype.cy=function(){return this.getAttribute_mumjwj$(ba().CY)},$a.prototype.rx=function(){return this.getAttribute_mumjwj$(ba().RX)},$a.prototype.ry=function(){return this.getAttribute_mumjwj$(ba().RY)},$a.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},$a.prototype.fill=function(){return this.getAttribute_mumjwj$(Pl().FILL)},$a.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},$a.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Pl().FILL_OPACITY)},$a.prototype.stroke=function(){return this.getAttribute_mumjwj$(Pl().STROKE)},$a.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},$a.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Pl().STROKE_OPACITY)},$a.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Pl().STROKE_WIDTH)},$a.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},$a.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},$a.$metadata$={kind:s,simpleName:"SvgEllipseElement",interfaces:[Tl,_u,Oa]},Object.defineProperty(xa.prototype,"propExpr",{configurable:!0,get:function(){return this.toString()+".handlersProp"}}),xa.prototype.get=function(){return this.this$SvgEventPeer.handlersKeySet_0()},ka.prototype.doRemove=function(){this.closure$addReg.remove(),l(this.this$SvgEventPeer.myListeners_0).isEmpty&&(this.this$SvgEventPeer.myListeners_0=null)},ka.$metadata$={kind:s,interfaces:[v]},xa.prototype.addHandler_gxwwpc$=function(t){return null==this.this$SvgEventPeer.myListeners_0&&(this.this$SvgEventPeer.myListeners_0=new $),new ka(l(this.this$SvgEventPeer.myListeners_0).add_11rb$(t),this.this$SvgEventPeer)},xa.$metadata$={kind:s,interfaces:[x]},wa.prototype.handlersSet=function(){return new xa(this)},wa.prototype.handlersKeySet_0=function(){return null==this.myEventHandlers_0?b():l(this.myEventHandlers_0).keys},Ea.prototype.doRemove=function(){this.closure$addReg.remove(),this.closure$specListeners.isEmpty&&this.closure$eventHandlers.remove_11rb$(this.closure$spec)},Ea.$metadata$={kind:s,interfaces:[v]},Ca.prototype.call_11rb$=function(t){t.onEvent_11rb$(new d(this.closure$oldHandlersSet,this.this$SvgEventPeer.handlersKeySet_0()))},Ca.$metadata$={kind:s,interfaces:[y]},wa.prototype.addEventHandler_mm8kk2$=function(t,e){var n;null==this.myEventHandlers_0&&(this.myEventHandlers_0=h());var i=l(this.myEventHandlers_0);if(!i.containsKey_11rb$(t)){var r=new $;i.put_xwzc9p$(t,r)}var o=i.keys,a=l(i.get_11rb$(t)),s=new Ea(a.add_11rb$(e),a,i,t);return null!=(n=this.myListeners_0)&&n.fire_kucmxw$(new Ca(o,this)),s},Sa.prototype.call_11rb$=function(t){var n;this.closure$event.isConsumed||(e.isType(n=t,Pu)?n:o()).handle_42da0z$(this.closure$target,this.closure$event)},Sa.$metadata$={kind:s,interfaces:[y]},wa.prototype.dispatch_2raoxs$=function(t,e,n){null!=this.myEventHandlers_0&&l(this.myEventHandlers_0).containsKey_11rb$(t)&&l(l(this.myEventHandlers_0).get_11rb$(t)).fire_kucmxw$(new Sa(e,n))},wa.$metadata$={kind:s,simpleName:"SvgEventPeer",interfaces:[]},Object.defineProperty(Ta.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_84zyy2$_0}}),Object.defineProperty(Ta.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),Ta.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},Ta.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},Ta.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},Ta.$metadata$={kind:s,simpleName:"SvgGElement",interfaces:[na,_u,Oa]},Na.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Pa,Aa,ja,La,Ra,Ia,za,Da,Ma,Ba,Ua,Fa,qa,Ga,Ha=null;function Ya(){return null===Ha&&new Na,Ha}function Va(t,e,n){u.call(this),this.myAttributeString_wpy0pw$_0=n,this.name$=t,this.ordinal$=e}function Ka(){Ka=function(){},Pa=new Va("VISIBLE_PAINTED",0,"visiblePainted"),Aa=new Va("VISIBLE_FILL",1,"visibleFill"),ja=new Va("VISIBLE_STROKE",2,"visibleStroke"),La=new Va("VISIBLE",3,"visible"),Ra=new Va("PAINTED",4,"painted"),Ia=new Va("FILL",5,"fill"),za=new Va("STROKE",6,"stroke"),Da=new Va("ALL",7,"all"),Ma=new Va("NONE",8,"none"),Ba=new Va("INHERIT",9,"inherit")}function Wa(){return Ka(),Pa}function Xa(){return Ka(),Aa}function Za(){return Ka(),ja}function Ja(){return Ka(),La}function Qa(){return Ka(),Ra}function ts(){return Ka(),Ia}function es(){return Ka(),za}function ns(){return Ka(),Da}function is(){return Ka(),Ma}function rs(){return Ka(),Ba}function os(t,e,n){u.call(this),this.myAttrString_w3r471$_0=n,this.name$=t,this.ordinal$=e}function as(){as=function(){},Ua=new os("VISIBLE",0,"visible"),Fa=new os("HIDDEN",1,"hidden"),qa=new os("COLLAPSE",2,"collapse"),Ga=new os("INHERIT",3,"inherit")}function ss(){return as(),Ua}function ls(){return as(),Fa}function us(){return as(),qa}function cs(){return as(),Ga}function ps(t){this.myElementId_0=t}function hs(){ds(),Oa.call(this),this.elementName_r17hoq$_0="image",this.setAttribute_qdh7ux$(ds().PRESERVE_ASPECT_RATIO,"none"),this.setAttribute_jyasbz$(ea().SVG_STYLE_ATTRIBUTE,"image-rendering: pixelated;image-rendering: crisp-edges;")}function _s(){fs=this,this.X=tt().createSpec_ytbaoo$("x"),this.Y=tt().createSpec_ytbaoo$("y"),this.WIDTH=tt().createSpec_ytbaoo$(ea().WIDTH),this.HEIGHT=tt().createSpec_ytbaoo$(ea().HEIGHT),this.HREF=tt().createSpecNS_wswq18$("href",Ou().XLINK_PREFIX,Ou().XLINK_NAMESPACE_URI),this.PRESERVE_ASPECT_RATIO=tt().createSpec_ytbaoo$("preserveAspectRatio")}Oa.prototype.pointerEvents=function(){return this.getAttribute_mumjwj$(Ya().POINTER_EVENTS_0)},Oa.prototype.opacity=function(){return this.getAttribute_mumjwj$(Ya().OPACITY)},Oa.prototype.visibility=function(){return this.getAttribute_mumjwj$(Ya().VISIBILITY)},Oa.prototype.clipPath=function(){return this.getAttribute_mumjwj$(Ya().CLIP_PATH)},Va.prototype.toString=function(){return this.myAttributeString_wpy0pw$_0},Va.$metadata$={kind:s,simpleName:"PointerEvents",interfaces:[u]},Va.values=function(){return[Wa(),Xa(),Za(),Ja(),Qa(),ts(),es(),ns(),is(),rs()]},Va.valueOf_61zpoe$=function(t){switch(t){case"VISIBLE_PAINTED":return Wa();case"VISIBLE_FILL":return Xa();case"VISIBLE_STROKE":return Za();case"VISIBLE":return Ja();case"PAINTED":return Qa();case"FILL":return ts();case"STROKE":return es();case"ALL":return ns();case"NONE":return is();case"INHERIT":return rs();default:c("No enum constant jetbrains.datalore.vis.svg.SvgGraphicsElement.PointerEvents."+t)}},os.prototype.toString=function(){return this.myAttrString_w3r471$_0},os.$metadata$={kind:s,simpleName:"Visibility",interfaces:[u]},os.values=function(){return[ss(),ls(),us(),cs()]},os.valueOf_61zpoe$=function(t){switch(t){case"VISIBLE":return ss();case"HIDDEN":return ls();case"COLLAPSE":return us();case"INHERIT":return cs();default:c("No enum constant jetbrains.datalore.vis.svg.SvgGraphicsElement.Visibility."+t)}},Oa.$metadata$={kind:s,simpleName:"SvgGraphicsElement",interfaces:[Al]},ps.prototype.toString=function(){return"url(#"+this.myElementId_0+")"},ps.$metadata$={kind:s,simpleName:"SvgIRI",interfaces:[]},_s.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var fs=null;function ds(){return null===fs&&new _s,fs}function ms(t,e,n,i,r){return r=r||Object.create(hs.prototype),hs.call(r),r.setAttribute_qdh7ux$(ds().X,t),r.setAttribute_qdh7ux$(ds().Y,e),r.setAttribute_qdh7ux$(ds().WIDTH,n),r.setAttribute_qdh7ux$(ds().HEIGHT,i),r}function ys(t,e,n,i,r){ms(t,e,n,i,this),this.myBitmap_0=r}function $s(t,e){this.closure$hrefProp=t,this.this$SvgImageElementEx=e}function vs(){}function gs(t,e,n){this.width=t,this.height=e,this.argbValues=n.slice()}function bs(){Ls(),Oa.call(this),this.elementName_7igd9t$_0="line"}function ws(){js=this,this.X1=tt().createSpec_ytbaoo$("x1"),this.Y1=tt().createSpec_ytbaoo$("y1"),this.X2=tt().createSpec_ytbaoo$("x2"),this.Y2=tt().createSpec_ytbaoo$("y2")}Object.defineProperty(hs.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_r17hoq$_0}}),Object.defineProperty(hs.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),hs.prototype.x=function(){return this.getAttribute_mumjwj$(ds().X)},hs.prototype.y=function(){return this.getAttribute_mumjwj$(ds().Y)},hs.prototype.width=function(){return this.getAttribute_mumjwj$(ds().WIDTH)},hs.prototype.height=function(){return this.getAttribute_mumjwj$(ds().HEIGHT)},hs.prototype.href=function(){return this.getAttribute_mumjwj$(ds().HREF)},hs.prototype.preserveAspectRatio=function(){return this.getAttribute_mumjwj$(ds().PRESERVE_ASPECT_RATIO)},hs.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},hs.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},hs.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},hs.$metadata$={kind:s,simpleName:"SvgImageElement",interfaces:[_u,Oa]},Object.defineProperty($s.prototype,"propExpr",{configurable:!0,get:function(){return this.closure$hrefProp.propExpr}}),$s.prototype.get=function(){return this.closure$hrefProp.get()},$s.prototype.addHandler_gxwwpc$=function(t){return this.closure$hrefProp.addHandler_gxwwpc$(t)},$s.prototype.set_11rb$=function(t){throw k("href property is read-only in "+e.getKClassFromExpression(this.this$SvgImageElementEx).simpleName)},$s.$metadata$={kind:s,interfaces:[m]},ys.prototype.href=function(){return new $s(hs.prototype.href.call(this),this)},ys.prototype.asImageElement_xhdger$=function(t){var e=new hs;gu().copyAttributes_azdp7k$(this,e);var n=t.toDataUrl_nps3vt$(this.myBitmap_0.width,this.myBitmap_0.height,this.myBitmap_0.argbValues);return e.href().set_11rb$(n),e},vs.$metadata$={kind:p,simpleName:"RGBEncoder",interfaces:[]},gs.$metadata$={kind:s,simpleName:"Bitmap",interfaces:[]},ys.$metadata$={kind:s,simpleName:"SvgImageElementEx",interfaces:[hs]},ws.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var xs,ks,Es,Cs,Ss,Ts,Os,Ns,Ps,As,js=null;function Ls(){return null===js&&new ws,js}function Rs(){}function Is(){S.call(this),this.myContainer_rnn3uj$_0=null,this.myChildren_jvkzg9$_0=null,this.isPrebuiltSubtree=!1}function zs(t,e){this.$outer=t,C.call(this,e)}function Ds(t){this.mySvgRoot_0=new Fs(this,t),this.myListeners_0=new $,this.myPeer_0=null,this.mySvgRoot_0.get().attach_1gwaml$(this)}function Ms(t,e){this.closure$element=t,this.closure$event=e}function Bs(t){this.closure$node=t}function Us(t){this.closure$node=t}function Fs(t,e){this.this$SvgNodeContainer=t,O.call(this,e)}function qs(t){pl(),this.myPathData_0=t}function Gs(t,e,n){u.call(this),this.myChar_90i289$_0=n,this.name$=t,this.ordinal$=e}function Hs(){Hs=function(){},xs=new Gs("MOVE_TO",0,109),ks=new Gs("LINE_TO",1,108),Es=new Gs("HORIZONTAL_LINE_TO",2,104),Cs=new Gs("VERTICAL_LINE_TO",3,118),Ss=new Gs("CURVE_TO",4,99),Ts=new Gs("SMOOTH_CURVE_TO",5,115),Os=new Gs("QUADRATIC_BEZIER_CURVE_TO",6,113),Ns=new Gs("SMOOTH_QUADRATIC_BEZIER_CURVE_TO",7,116),Ps=new Gs("ELLIPTICAL_ARC",8,97),As=new Gs("CLOSE_PATH",9,122),rl()}function Ys(){return Hs(),xs}function Vs(){return Hs(),ks}function Ks(){return Hs(),Es}function Ws(){return Hs(),Cs}function Xs(){return Hs(),Ss}function Zs(){return Hs(),Ts}function Js(){return Hs(),Os}function Qs(){return Hs(),Ns}function tl(){return Hs(),Ps}function el(){return Hs(),As}function nl(){var t,e;for(il=this,this.MAP_0=h(),t=ol(),e=0;e!==t.length;++e){var n=t[e],i=this.MAP_0,r=n.absoluteCmd();i.put_xwzc9p$(r,n);var o=this.MAP_0,a=n.relativeCmd();o.put_xwzc9p$(a,n)}}Object.defineProperty(bs.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_7igd9t$_0}}),Object.defineProperty(bs.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),bs.prototype.x1=function(){return this.getAttribute_mumjwj$(Ls().X1)},bs.prototype.y1=function(){return this.getAttribute_mumjwj$(Ls().Y1)},bs.prototype.x2=function(){return this.getAttribute_mumjwj$(Ls().X2)},bs.prototype.y2=function(){return this.getAttribute_mumjwj$(Ls().Y2)},bs.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},bs.prototype.fill=function(){return this.getAttribute_mumjwj$(Pl().FILL)},bs.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},bs.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Pl().FILL_OPACITY)},bs.prototype.stroke=function(){return this.getAttribute_mumjwj$(Pl().STROKE)},bs.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},bs.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Pl().STROKE_OPACITY)},bs.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Pl().STROKE_WIDTH)},bs.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},bs.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},bs.$metadata$={kind:s,simpleName:"SvgLineElement",interfaces:[Tl,_u,Oa]},Rs.$metadata$={kind:p,simpleName:"SvgLocatable",interfaces:[]},Is.prototype.isAttached=function(){return null!=this.myContainer_rnn3uj$_0},Is.prototype.container=function(){return l(this.myContainer_rnn3uj$_0)},Is.prototype.children=function(){var t;return null==this.myChildren_jvkzg9$_0&&(this.myChildren_jvkzg9$_0=new zs(this,this)),e.isType(t=this.myChildren_jvkzg9$_0,E)?t:o()},Is.prototype.attach_1gwaml$=function(t){var e;if(this.isAttached())throw k("Svg element is already attached");for(e=this.children().iterator();e.hasNext();)e.next().attach_1gwaml$(t);this.myContainer_rnn3uj$_0=t,l(this.myContainer_rnn3uj$_0).svgNodeAttached_vvfmut$(this)},Is.prototype.detach_8be2vx$=function(){var t;if(!this.isAttached())throw k("Svg element is not attached");for(t=this.children().iterator();t.hasNext();)t.next().detach_8be2vx$();l(this.myContainer_rnn3uj$_0).svgNodeDetached_vvfmut$(this),this.myContainer_rnn3uj$_0=null},zs.prototype.beforeItemAdded_wxm5ur$=function(t,e){this.$outer.isAttached()&&e.attach_1gwaml$(this.$outer.container()),C.prototype.beforeItemAdded_wxm5ur$.call(this,t,e)},zs.prototype.beforeItemSet_hu11d4$=function(t,e,n){this.$outer.isAttached()&&(e.detach_8be2vx$(),n.attach_1gwaml$(this.$outer.container())),C.prototype.beforeItemSet_hu11d4$.call(this,t,e,n)},zs.prototype.beforeItemRemoved_wxm5ur$=function(t,e){this.$outer.isAttached()&&e.detach_8be2vx$(),C.prototype.beforeItemRemoved_wxm5ur$.call(this,t,e)},zs.$metadata$={kind:s,simpleName:"SvgChildList",interfaces:[C]},Is.$metadata$={kind:s,simpleName:"SvgNode",interfaces:[S]},Ds.prototype.setPeer_kqs5uc$=function(t){this.myPeer_0=t},Ds.prototype.getPeer=function(){return this.myPeer_0},Ds.prototype.root=function(){return this.mySvgRoot_0},Ds.prototype.addListener_6zkzfn$=function(t){return this.myListeners_0.add_11rb$(t)},Ms.prototype.call_11rb$=function(t){t.onAttributeSet_os9wmi$(this.closure$element,this.closure$event)},Ms.$metadata$={kind:s,interfaces:[y]},Ds.prototype.attributeChanged_1u4bot$=function(t,e){this.myListeners_0.fire_kucmxw$(new Ms(t,e))},Bs.prototype.call_11rb$=function(t){t.onNodeAttached_26jijc$(this.closure$node)},Bs.$metadata$={kind:s,interfaces:[y]},Ds.prototype.svgNodeAttached_vvfmut$=function(t){this.myListeners_0.fire_kucmxw$(new Bs(t))},Us.prototype.call_11rb$=function(t){t.onNodeDetached_26jijc$(this.closure$node)},Us.$metadata$={kind:s,interfaces:[y]},Ds.prototype.svgNodeDetached_vvfmut$=function(t){this.myListeners_0.fire_kucmxw$(new Us(t))},Fs.prototype.set_11rb$=function(t){this.get().detach_8be2vx$(),O.prototype.set_11rb$.call(this,t),t.attach_1gwaml$(this.this$SvgNodeContainer)},Fs.$metadata$={kind:s,interfaces:[O]},Ds.$metadata$={kind:s,simpleName:"SvgNodeContainer",interfaces:[]},Gs.prototype.relativeCmd=function(){return N(this.myChar_90i289$_0)},Gs.prototype.absoluteCmd=function(){return N(P(this.myChar_90i289$_0))},nl.prototype.get_s8itvh$=function(t){if(this.MAP_0.containsKey_11rb$(N(t)))return l(this.MAP_0.get_11rb$(N(t)));throw L("No enum constant "+j(A(Gs))+"@myChar."+String.fromCharCode(N(t)))},nl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var il=null;function rl(){return Hs(),null===il&&new nl,il}function ol(){return[Ys(),Vs(),Ks(),Ws(),Xs(),Zs(),Js(),Qs(),tl(),el()]}function al(){cl=this,this.EMPTY=new qs("")}Gs.$metadata$={kind:s,simpleName:"Action",interfaces:[u]},Gs.values=ol,Gs.valueOf_61zpoe$=function(t){switch(t){case"MOVE_TO":return Ys();case"LINE_TO":return Vs();case"HORIZONTAL_LINE_TO":return Ks();case"VERTICAL_LINE_TO":return Ws();case"CURVE_TO":return Xs();case"SMOOTH_CURVE_TO":return Zs();case"QUADRATIC_BEZIER_CURVE_TO":return Js();case"SMOOTH_QUADRATIC_BEZIER_CURVE_TO":return Qs();case"ELLIPTICAL_ARC":return tl();case"CLOSE_PATH":return el();default:c("No enum constant jetbrains.datalore.vis.svg.SvgPathData.Action."+t)}},qs.prototype.toString=function(){return this.myPathData_0},al.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var sl,ll,ul,cl=null;function pl(){return null===cl&&new al,cl}function hl(t){void 0===t&&(t=!0),this.myDefaultAbsolute_0=t,this.myStringBuilder_0=null,this.myTension_0=.7,this.myStringBuilder_0=w()}function _l(t,e){u.call(this),this.name$=t,this.ordinal$=e}function fl(){fl=function(){},sl=new _l("LINEAR",0),ll=new _l("CARDINAL",1),ul=new _l("MONOTONE",2)}function dl(){return fl(),sl}function ml(){return fl(),ll}function yl(){return fl(),ul}function $l(){bl(),Oa.call(this),this.elementName_d87la8$_0="path"}function vl(){gl=this,this.D=tt().createSpec_ytbaoo$("d")}qs.$metadata$={kind:s,simpleName:"SvgPathData",interfaces:[]},_l.$metadata$={kind:s,simpleName:"Interpolation",interfaces:[u]},_l.values=function(){return[dl(),ml(),yl()]},_l.valueOf_61zpoe$=function(t){switch(t){case"LINEAR":return dl();case"CARDINAL":return ml();case"MONOTONE":return yl();default:c("No enum constant jetbrains.datalore.vis.svg.SvgPathDataBuilder.Interpolation."+t)}},hl.prototype.build=function(){return new qs(this.myStringBuilder_0.toString())},hl.prototype.addAction_0=function(t,e,n){var i;for(e?this.myStringBuilder_0.append_s8itvh$(R(t.absoluteCmd())):this.myStringBuilder_0.append_s8itvh$(R(t.relativeCmd())),i=0;i!==n.length;++i){var r=n[i];this.myStringBuilder_0.append_s8jyv4$(r).append_s8itvh$(32)}},hl.prototype.addActionWithStringTokens_0=function(t,e,n){var i;for(e?this.myStringBuilder_0.append_s8itvh$(R(t.absoluteCmd())):this.myStringBuilder_0.append_s8itvh$(R(t.relativeCmd())),i=0;i!==n.length;++i){var r=n[i];this.myStringBuilder_0.append_pdl1vj$(r).append_s8itvh$(32)}},hl.prototype.moveTo_przk3b$=function(t,e,n){return void 0===n&&(n=this.myDefaultAbsolute_0),this.addAction_0(Ys(),n,new Float64Array([t,e])),this},hl.prototype.moveTo_k2qmv6$=function(t,e){return this.moveTo_przk3b$(t.x,t.y,e)},hl.prototype.moveTo_gpjtzr$=function(t){return this.moveTo_przk3b$(t.x,t.y)},hl.prototype.lineTo_przk3b$=function(t,e,n){return void 0===n&&(n=this.myDefaultAbsolute_0),this.addAction_0(Vs(),n,new Float64Array([t,e])),this},hl.prototype.lineTo_k2qmv6$=function(t,e){return this.lineTo_przk3b$(t.x,t.y,e)},hl.prototype.lineTo_gpjtzr$=function(t){return this.lineTo_przk3b$(t.x,t.y)},hl.prototype.horizontalLineTo_8555vt$=function(t,e){return void 0===e&&(e=this.myDefaultAbsolute_0),this.addAction_0(Ks(),e,new Float64Array([t])),this},hl.prototype.verticalLineTo_8555vt$=function(t,e){return void 0===e&&(e=this.myDefaultAbsolute_0),this.addAction_0(Ws(),e,new Float64Array([t])),this},hl.prototype.curveTo_igz2nj$=function(t,e,n,i,r,o,a){return void 0===a&&(a=this.myDefaultAbsolute_0),this.addAction_0(Xs(),a,new Float64Array([t,e,n,i,r,o])),this},hl.prototype.curveTo_d4nu7w$=function(t,e,n,i){return this.curveTo_igz2nj$(t.x,t.y,e.x,e.y,n.x,n.y,i)},hl.prototype.curveTo_fkixjx$=function(t,e,n){return this.curveTo_igz2nj$(t.x,t.y,e.x,e.y,n.x,n.y)},hl.prototype.smoothCurveTo_84c9il$=function(t,e,n,i,r){return void 0===r&&(r=this.myDefaultAbsolute_0),this.addAction_0(Zs(),r,new Float64Array([t,e,n,i])),this},hl.prototype.smoothCurveTo_sosulb$=function(t,e,n){return this.smoothCurveTo_84c9il$(t.x,t.y,e.x,e.y,n)},hl.prototype.smoothCurveTo_qt8ska$=function(t,e){return this.smoothCurveTo_84c9il$(t.x,t.y,e.x,e.y)},hl.prototype.quadraticBezierCurveTo_84c9il$=function(t,e,n,i,r){return void 0===r&&(r=this.myDefaultAbsolute_0),this.addAction_0(Js(),r,new Float64Array([t,e,n,i])),this},hl.prototype.quadraticBezierCurveTo_sosulb$=function(t,e,n){return this.quadraticBezierCurveTo_84c9il$(t.x,t.y,e.x,e.y,n)},hl.prototype.quadraticBezierCurveTo_qt8ska$=function(t,e){return this.quadraticBezierCurveTo_84c9il$(t.x,t.y,e.x,e.y)},hl.prototype.smoothQuadraticBezierCurveTo_przk3b$=function(t,e,n){return void 0===n&&(n=this.myDefaultAbsolute_0),this.addAction_0(Qs(),n,new Float64Array([t,e])),this},hl.prototype.smoothQuadraticBezierCurveTo_k2qmv6$=function(t,e){return this.smoothQuadraticBezierCurveTo_przk3b$(t.x,t.y,e)},hl.prototype.smoothQuadraticBezierCurveTo_gpjtzr$=function(t){return this.smoothQuadraticBezierCurveTo_przk3b$(t.x,t.y)},hl.prototype.ellipticalArc_d37okh$=function(t,e,n,i,r,o,a,s){return void 0===s&&(s=this.myDefaultAbsolute_0),this.addActionWithStringTokens_0(tl(),s,[t.toString(),e.toString(),n.toString(),i?"1":"0",r?"1":"0",o.toString(),a.toString()]),this},hl.prototype.ellipticalArc_dcaprc$=function(t,e,n,i,r,o,a){return this.ellipticalArc_d37okh$(t,e,n,i,r,o.x,o.y,a)},hl.prototype.ellipticalArc_gc0whr$=function(t,e,n,i,r,o){return this.ellipticalArc_d37okh$(t,e,n,i,r,o.x,o.y)},hl.prototype.closePath=function(){return this.addAction_0(el(),this.myDefaultAbsolute_0,new Float64Array([])),this},hl.prototype.setTension_14dthe$=function(t){if(0>t||t>1)throw L("Tension should be within [0, 1] interval");this.myTension_0=t},hl.prototype.lineSlope_0=function(t,e){return(e.y-t.y)/(e.x-t.x)},hl.prototype.finiteDifferences_0=function(t){var e,n=I(t.size),i=this.lineSlope_0(t.get_za3lpa$(0),t.get_za3lpa$(1));n.add_11rb$(i),e=t.size-1|0;for(var r=1;r1){a=e.get_za3lpa$(1),r=t.get_za3lpa$(s),s=s+1|0,this.curveTo_igz2nj$(i.x+o.x,i.y+o.y,r.x-a.x,r.y-a.y,r.x,r.y,!0);for(var l=2;l9){var l=s;s=3*r/B.sqrt(l),n.set_wxm5ur$(i,s*o),n.set_wxm5ur$(i+1|0,s*a)}}}for(var u=z(),c=0;c!==t.size;++c){var p=c+1|0,h=t.size-1|0,_=c-1|0,f=(t.get_za3lpa$(B.min(p,h)).x-t.get_za3lpa$(B.max(_,0)).x)/(6*(1+n.get_za3lpa$(c)*n.get_za3lpa$(c)));u.add_11rb$(new D(f,n.get_za3lpa$(c)*f))}return u},hl.prototype.interpolatePoints_3g1a62$=function(t,e,n){if(t.size!==e.size)throw L("Sizes of xs and ys must be equal");for(var i=I(t.size),r=M(t),o=M(e),a=0;a!==t.size;++a)i.add_11rb$(new D(r.get_za3lpa$(a),o.get_za3lpa$(a)));switch(n.name){case"LINEAR":this.doLinearInterpolation_0(i);break;case"CARDINAL":i.size<3?this.doLinearInterpolation_0(i):this.doCardinalInterpolation_0(i);break;case"MONOTONE":i.size<3?this.doLinearInterpolation_0(i):this.doHermiteInterpolation_0(i,this.monotoneTangents_0(i))}return this},hl.prototype.interpolatePoints_1ravjc$=function(t,e){var n,i=I(t.size),r=I(t.size);for(n=t.iterator();n.hasNext();){var o=n.next();i.add_11rb$(o.x),r.add_11rb$(o.y)}return this.interpolatePoints_3g1a62$(i,r,e)},hl.$metadata$={kind:s,simpleName:"SvgPathDataBuilder",interfaces:[]},vl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var gl=null;function bl(){return null===gl&&new vl,gl}function wl(){}function xl(){Cl(),Oa.call(this),this.elementName_sgtow1$_0="rect"}function kl(){El=this,this.X=tt().createSpec_ytbaoo$("x"),this.Y=tt().createSpec_ytbaoo$("y"),this.WIDTH=tt().createSpec_ytbaoo$(ea().WIDTH),this.HEIGHT=tt().createSpec_ytbaoo$(ea().HEIGHT)}Object.defineProperty($l.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_d87la8$_0}}),Object.defineProperty($l.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),$l.prototype.d=function(){return this.getAttribute_mumjwj$(bl().D)},$l.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},$l.prototype.fill=function(){return this.getAttribute_mumjwj$(Pl().FILL)},$l.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},$l.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Pl().FILL_OPACITY)},$l.prototype.stroke=function(){return this.getAttribute_mumjwj$(Pl().STROKE)},$l.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},$l.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Pl().STROKE_OPACITY)},$l.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Pl().STROKE_WIDTH)},$l.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},$l.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},$l.$metadata$={kind:s,simpleName:"SvgPathElement",interfaces:[Tl,_u,Oa]},wl.$metadata$={kind:p,simpleName:"SvgPlatformPeer",interfaces:[]},kl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var El=null;function Cl(){return null===El&&new kl,El}function Sl(t,e,n,i,r){return r=r||Object.create(xl.prototype),xl.call(r),r.setAttribute_qdh7ux$(Cl().X,t),r.setAttribute_qdh7ux$(Cl().Y,e),r.setAttribute_qdh7ux$(Cl().HEIGHT,i),r.setAttribute_qdh7ux$(Cl().WIDTH,n),r}function Tl(){Pl()}function Ol(){Nl=this,this.FILL=tt().createSpec_ytbaoo$("fill"),this.FILL_OPACITY=tt().createSpec_ytbaoo$("fill-opacity"),this.STROKE=tt().createSpec_ytbaoo$("stroke"),this.STROKE_OPACITY=tt().createSpec_ytbaoo$("stroke-opacity"),this.STROKE_WIDTH=tt().createSpec_ytbaoo$("stroke-width")}Object.defineProperty(xl.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_sgtow1$_0}}),Object.defineProperty(xl.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),xl.prototype.x=function(){return this.getAttribute_mumjwj$(Cl().X)},xl.prototype.y=function(){return this.getAttribute_mumjwj$(Cl().Y)},xl.prototype.height=function(){return this.getAttribute_mumjwj$(Cl().HEIGHT)},xl.prototype.width=function(){return this.getAttribute_mumjwj$(Cl().WIDTH)},xl.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},xl.prototype.fill=function(){return this.getAttribute_mumjwj$(Pl().FILL)},xl.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},xl.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Pl().FILL_OPACITY)},xl.prototype.stroke=function(){return this.getAttribute_mumjwj$(Pl().STROKE)},xl.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},xl.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Pl().STROKE_OPACITY)},xl.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Pl().STROKE_WIDTH)},xl.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},xl.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},xl.$metadata$={kind:s,simpleName:"SvgRectElement",interfaces:[Tl,_u,Oa]},Ol.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Nl=null;function Pl(){return null===Nl&&new Ol,Nl}function Al(){Rl(),la.call(this)}function jl(){Ll=this,this.CLASS=tt().createSpec_ytbaoo$("class")}Tl.$metadata$={kind:p,simpleName:"SvgShape",interfaces:[]},jl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Ll=null;function Rl(){return null===Ll&&new jl,Ll}function Il(t){la.call(this),this.resource=t,this.elementName_1a5z8g$_0="style",this.setContent_61zpoe$(this.resource.css())}function zl(){Bl(),Al.call(this),this.elementName_9c3al$_0="svg"}function Dl(){Ml=this,this.X=tt().createSpec_ytbaoo$("x"),this.Y=tt().createSpec_ytbaoo$("y"),this.WIDTH=tt().createSpec_ytbaoo$(ea().WIDTH),this.HEIGHT=tt().createSpec_ytbaoo$(ea().HEIGHT),this.VIEW_BOX=tt().createSpec_ytbaoo$("viewBox")}Al.prototype.classAttribute=function(){return this.getAttribute_mumjwj$(Rl().CLASS)},Al.prototype.addClass_61zpoe$=function(t){this.validateClassName_rb6n0l$_0(t);var e=this.classAttribute();return null==e.get()?(e.set_11rb$(t),!0):!U(l(e.get()),[" "]).contains_11rb$(t)&&(e.set_11rb$(e.get()+" "+t),!0)},Al.prototype.removeClass_61zpoe$=function(t){this.validateClassName_rb6n0l$_0(t);var e=this.classAttribute();if(null==e.get())return!1;var n=M(U(l(e.get()),[" "])),i=n.remove_11rb$(t);return i&&e.set_11rb$(this.buildClassString_fbk06u$_0(n)),i},Al.prototype.replaceClass_puj7f4$=function(t,e){this.validateClassName_rb6n0l$_0(t),this.validateClassName_rb6n0l$_0(e);var n=this.classAttribute();if(null==n.get())throw k("Trying to replace class when class is empty");var i=U(l(n.get()),[" "]);if(!i.contains_11rb$(t))throw k("Class attribute does not contain specified oldClass");for(var r=i.size,o=I(r),a=0;a0&&n.append_s8itvh$(32),n.append_pdl1vj$(i)}return n.toString()},Al.prototype.validateClassName_rb6n0l$_0=function(t){if(F(t," "))throw L("Class name cannot contain spaces")},Al.$metadata$={kind:s,simpleName:"SvgStylableElement",interfaces:[la]},Object.defineProperty(Il.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_1a5z8g$_0}}),Il.prototype.setContent_61zpoe$=function(t){for(var e=this.children();!e.isEmpty();)e.removeAt_za3lpa$(0);var n=new iu(t);e.add_11rb$(n),this.setAttribute_jyasbz$("type","text/css")},Il.$metadata$={kind:s,simpleName:"SvgStyleElement",interfaces:[la]},Dl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Ml=null;function Bl(){return null===Ml&&new Dl,Ml}function Ul(t){this.this$SvgSvgElement=t}function Fl(){this.myX_0=0,this.myY_0=0,this.myWidth_0=0,this.myHeight_0=0}function ql(t,e){return e=e||Object.create(Fl.prototype),Fl.call(e),e.myX_0=t.origin.x,e.myY_0=t.origin.y,e.myWidth_0=t.dimension.x,e.myHeight_0=t.dimension.y,e}function Gl(){Vl(),la.call(this),this.elementName_7co8y5$_0="tspan"}function Hl(){Yl=this,this.X_0=tt().createSpec_ytbaoo$("x"),this.Y_0=tt().createSpec_ytbaoo$("y")}Object.defineProperty(zl.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_9c3al$_0}}),Object.defineProperty(zl.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),zl.prototype.setStyle_i8z0m3$=function(t){this.children().add_11rb$(new Il(t))},zl.prototype.x=function(){return this.getAttribute_mumjwj$(Bl().X)},zl.prototype.y=function(){return this.getAttribute_mumjwj$(Bl().Y)},zl.prototype.width=function(){return this.getAttribute_mumjwj$(Bl().WIDTH)},zl.prototype.height=function(){return this.getAttribute_mumjwj$(Bl().HEIGHT)},zl.prototype.viewBox=function(){return this.getAttribute_mumjwj$(Bl().VIEW_BOX)},Ul.prototype.set_11rb$=function(t){this.this$SvgSvgElement.viewBox().set_11rb$(ql(t))},Ul.$metadata$={kind:s,interfaces:[q]},zl.prototype.viewBoxRect=function(){return new Ul(this)},zl.prototype.opacity=function(){return this.getAttribute_mumjwj$(oa().OPACITY)},zl.prototype.clipPath=function(){return this.getAttribute_mumjwj$(oa().CLIP_PATH)},zl.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},zl.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},Fl.prototype.toString=function(){return this.myX_0.toString()+" "+this.myY_0+" "+this.myWidth_0+" "+this.myHeight_0},Fl.$metadata$={kind:s,simpleName:"ViewBoxRectangle",interfaces:[]},zl.$metadata$={kind:s,simpleName:"SvgSvgElement",interfaces:[Rs,na,Al]},Hl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Yl=null;function Vl(){return null===Yl&&new Hl,Yl}function Kl(t,e){return e=e||Object.create(Gl.prototype),Gl.call(e),e.setText_61zpoe$(t),e}function Wl(){Jl()}function Xl(){Zl=this,this.FILL=tt().createSpec_ytbaoo$("fill"),this.FILL_OPACITY=tt().createSpec_ytbaoo$("fill-opacity"),this.STROKE=tt().createSpec_ytbaoo$("stroke"),this.STROKE_OPACITY=tt().createSpec_ytbaoo$("stroke-opacity"),this.STROKE_WIDTH=tt().createSpec_ytbaoo$("stroke-width"),this.TEXT_ANCHOR=tt().createSpec_ytbaoo$(ea().SVG_TEXT_ANCHOR_ATTRIBUTE),this.TEXT_DY=tt().createSpec_ytbaoo$(ea().SVG_TEXT_DY_ATTRIBUTE)}Object.defineProperty(Gl.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_7co8y5$_0}}),Object.defineProperty(Gl.prototype,"computedTextLength",{configurable:!0,get:function(){return l(this.container().getPeer()).getComputedTextLength_u60gfq$(this)}}),Gl.prototype.x=function(){return this.getAttribute_mumjwj$(Vl().X_0)},Gl.prototype.y=function(){return this.getAttribute_mumjwj$(Vl().Y_0)},Gl.prototype.setText_61zpoe$=function(t){this.children().clear(),this.addText_61zpoe$(t)},Gl.prototype.addText_61zpoe$=function(t){var e=new iu(t);this.children().add_11rb$(e)},Gl.prototype.fill=function(){return this.getAttribute_mumjwj$(Jl().FILL)},Gl.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},Gl.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Jl().FILL_OPACITY)},Gl.prototype.stroke=function(){return this.getAttribute_mumjwj$(Jl().STROKE)},Gl.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},Gl.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Jl().STROKE_OPACITY)},Gl.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Jl().STROKE_WIDTH)},Gl.prototype.textAnchor=function(){return this.getAttribute_mumjwj$(Jl().TEXT_ANCHOR)},Gl.prototype.textDy=function(){return this.getAttribute_mumjwj$(Jl().TEXT_DY)},Gl.$metadata$={kind:s,simpleName:"SvgTSpanElement",interfaces:[Wl,la]},Xl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Zl=null;function Jl(){return null===Zl&&new Xl,Zl}function Ql(){nu(),Oa.call(this),this.elementName_s70iuw$_0="text"}function tu(){eu=this,this.X=tt().createSpec_ytbaoo$("x"),this.Y=tt().createSpec_ytbaoo$("y")}Wl.$metadata$={kind:p,simpleName:"SvgTextContent",interfaces:[]},tu.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var eu=null;function nu(){return null===eu&&new tu,eu}function iu(t){su(),Is.call(this),this.myContent_0=null,this.myContent_0=new O(t)}function ru(){au=this,this.NO_CHILDREN_LIST_0=new ou}function ou(){H.call(this)}Object.defineProperty(Ql.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_s70iuw$_0}}),Object.defineProperty(Ql.prototype,"computedTextLength",{configurable:!0,get:function(){return l(this.container().getPeer()).getComputedTextLength_u60gfq$(this)}}),Object.defineProperty(Ql.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),Ql.prototype.x=function(){return this.getAttribute_mumjwj$(nu().X)},Ql.prototype.y=function(){return this.getAttribute_mumjwj$(nu().Y)},Ql.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},Ql.prototype.setTextNode_61zpoe$=function(t){this.children().clear(),this.addTextNode_61zpoe$(t)},Ql.prototype.addTextNode_61zpoe$=function(t){var e=new iu(t);this.children().add_11rb$(e)},Ql.prototype.setTSpan_ddcap8$=function(t){this.children().clear(),this.addTSpan_ddcap8$(t)},Ql.prototype.setTSpan_61zpoe$=function(t){this.children().clear(),this.addTSpan_61zpoe$(t)},Ql.prototype.addTSpan_ddcap8$=function(t){this.children().add_11rb$(t)},Ql.prototype.addTSpan_61zpoe$=function(t){this.children().add_11rb$(Kl(t))},Ql.prototype.fill=function(){return this.getAttribute_mumjwj$(Jl().FILL)},Ql.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},Ql.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Jl().FILL_OPACITY)},Ql.prototype.stroke=function(){return this.getAttribute_mumjwj$(Jl().STROKE)},Ql.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},Ql.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Jl().STROKE_OPACITY)},Ql.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Jl().STROKE_WIDTH)},Ql.prototype.textAnchor=function(){return this.getAttribute_mumjwj$(Jl().TEXT_ANCHOR)},Ql.prototype.textDy=function(){return this.getAttribute_mumjwj$(Jl().TEXT_DY)},Ql.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},Ql.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},Ql.$metadata$={kind:s,simpleName:"SvgTextElement",interfaces:[Wl,_u,Oa]},iu.prototype.textContent=function(){return this.myContent_0},iu.prototype.children=function(){return su().NO_CHILDREN_LIST_0},iu.prototype.toString=function(){return this.textContent().get()},ou.prototype.checkAdd_wxm5ur$=function(t,e){throw G("Cannot add children to SvgTextNode")},ou.prototype.checkRemove_wxm5ur$=function(t,e){throw G("Cannot remove children from SvgTextNode")},ou.$metadata$={kind:s,interfaces:[H]},ru.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var au=null;function su(){return null===au&&new ru,au}function lu(t){pu(),this.myTransform_0=t}function uu(){cu=this,this.EMPTY=new lu(""),this.MATRIX="matrix",this.ROTATE="rotate",this.SCALE="scale",this.SKEW_X="skewX",this.SKEW_Y="skewY",this.TRANSLATE="translate"}iu.$metadata$={kind:s,simpleName:"SvgTextNode",interfaces:[Is]},lu.prototype.toString=function(){return this.myTransform_0},uu.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var cu=null;function pu(){return null===cu&&new uu,cu}function hu(){this.myStringBuilder_0=w()}function _u(){mu()}function fu(){du=this,this.TRANSFORM=tt().createSpec_ytbaoo$("transform")}lu.$metadata$={kind:s,simpleName:"SvgTransform",interfaces:[]},hu.prototype.build=function(){return new lu(this.myStringBuilder_0.toString())},hu.prototype.addTransformation_0=function(t,e){var n;for(this.myStringBuilder_0.append_pdl1vj$(t).append_s8itvh$(40),n=0;n!==e.length;++n){var i=e[n];this.myStringBuilder_0.append_s8jyv4$(i).append_s8itvh$(32)}return this.myStringBuilder_0.append_pdl1vj$(") "),this},hu.prototype.matrix_15yvbs$=function(t,e,n,i,r,o){return this.addTransformation_0(pu().MATRIX,new Float64Array([t,e,n,i,r,o]))},hu.prototype.translate_lu1900$=function(t,e){return this.addTransformation_0(pu().TRANSLATE,new Float64Array([t,e]))},hu.prototype.translate_gpjtzr$=function(t){return this.translate_lu1900$(t.x,t.y)},hu.prototype.translate_14dthe$=function(t){return this.addTransformation_0(pu().TRANSLATE,new Float64Array([t]))},hu.prototype.scale_lu1900$=function(t,e){return this.addTransformation_0(pu().SCALE,new Float64Array([t,e]))},hu.prototype.scale_14dthe$=function(t){return this.addTransformation_0(pu().SCALE,new Float64Array([t]))},hu.prototype.rotate_yvo9jy$=function(t,e,n){return this.addTransformation_0(pu().ROTATE,new Float64Array([t,e,n]))},hu.prototype.rotate_jx7lbv$=function(t,e){return this.rotate_yvo9jy$(t,e.x,e.y)},hu.prototype.rotate_14dthe$=function(t){return this.addTransformation_0(pu().ROTATE,new Float64Array([t]))},hu.prototype.skewX_14dthe$=function(t){return this.addTransformation_0(pu().SKEW_X,new Float64Array([t]))},hu.prototype.skewY_14dthe$=function(t){return this.addTransformation_0(pu().SKEW_Y,new Float64Array([t]))},hu.$metadata$={kind:s,simpleName:"SvgTransformBuilder",interfaces:[]},fu.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var du=null;function mu(){return null===du&&new fu,du}function yu(){vu=this,this.OPACITY_TABLE_0=new Float64Array(256);for(var t=0;t<=255;t++)this.OPACITY_TABLE_0[t]=t/255}function $u(t,e){this.closure$color=t,this.closure$opacity=e}_u.$metadata$={kind:p,simpleName:"SvgTransformable",interfaces:[Rs]},yu.prototype.opacity_98b62m$=function(t){return this.OPACITY_TABLE_0[t.alpha]},yu.prototype.alpha2opacity_za3lpa$=function(t){return this.OPACITY_TABLE_0[t]},yu.prototype.toARGB_98b62m$=function(t){return this.toARGB_tjonv8$(t.red,t.green,t.blue,t.alpha)},yu.prototype.toARGB_o14uds$=function(t,e){var n=t.red,i=t.green,r=t.blue,o=255*e,a=B.min(255,o);return this.toARGB_tjonv8$(n,i,r,Y(B.max(0,a)))},yu.prototype.toARGB_tjonv8$=function(t,e,n,i){return(i<<24)+((t<<16)+(e<<8)+n|0)|0},$u.prototype.set_11rb$=function(t){this.closure$color.set_11rb$(Zo().create_2160e9$(t)),null!=t?this.closure$opacity.set_11rb$(gu().opacity_98b62m$(t)):this.closure$opacity.set_11rb$(1)},$u.$metadata$={kind:s,interfaces:[q]},yu.prototype.colorAttributeTransform_dc5zq8$=function(t,e){return new $u(t,e)},yu.prototype.transformMatrix_98ex5o$=function(t,e,n,i,r,o,a){t.transform().set_11rb$((new hu).matrix_15yvbs$(e,n,i,r,o,a).build())},yu.prototype.transformTranslate_pw34rw$=function(t,e,n){t.transform().set_11rb$((new hu).translate_lu1900$(e,n).build())},yu.prototype.transformTranslate_cbcjvx$=function(t,e){this.transformTranslate_pw34rw$(t,e.x,e.y)},yu.prototype.transformTranslate_wl99a6$=function(t,e){t.transform().set_11rb$((new hu).translate_14dthe$(e).build())},yu.prototype.transformScale_pw34rw$=function(t,e,n){t.transform().set_11rb$((new hu).scale_lu1900$(e,n).build())},yu.prototype.transformScale_wl99a6$=function(t,e){t.transform().set_11rb$((new hu).scale_14dthe$(e).build())},yu.prototype.transformRotate_tk1esa$=function(t,e,n,i){t.transform().set_11rb$((new hu).rotate_yvo9jy$(e,n,i).build())},yu.prototype.transformRotate_wl99a6$=function(t,e){t.transform().set_11rb$((new hu).rotate_14dthe$(e).build())},yu.prototype.transformSkewX_wl99a6$=function(t,e){t.transform().set_11rb$((new hu).skewX_14dthe$(e).build())},yu.prototype.transformSkewY_wl99a6$=function(t,e){t.transform().set_11rb$((new hu).skewY_14dthe$(e).build())},yu.prototype.copyAttributes_azdp7k$=function(t,n){var i,r;for(i=t.attributeKeys.iterator();i.hasNext();){var a=i.next(),s=e.isType(r=a,Z)?r:o();n.setAttribute_qdh7ux$(s,t.getAttribute_mumjwj$(a).get())}},yu.prototype.pngDataURI_61zpoe$=function(t){return new T("data:image/png;base64,").append_pdl1vj$(t).toString()},yu.$metadata$={kind:i,simpleName:"SvgUtils",interfaces:[]};var vu=null;function gu(){return null===vu&&new yu,vu}function bu(){Tu=this,this.SVG_NAMESPACE_URI="http://www.w3.org/2000/svg",this.XLINK_NAMESPACE_URI="http://www.w3.org/1999/xlink",this.XLINK_PREFIX="xlink"}bu.$metadata$={kind:i,simpleName:"XmlNamespace",interfaces:[]};var wu,xu,ku,Eu,Cu,Su,Tu=null;function Ou(){return null===Tu&&new bu,Tu}function Nu(t,e,n){V.call(this),this.attrSpec=t,this.oldValue=e,this.newValue=n}function Pu(){}function Au(t,e){u.call(this),this.name$=t,this.ordinal$=e}function ju(){ju=function(){},wu=new Au("MOUSE_CLICKED",0),xu=new Au("MOUSE_PRESSED",1),ku=new Au("MOUSE_RELEASED",2),Eu=new Au("MOUSE_OVER",3),Cu=new Au("MOUSE_MOVE",4),Su=new Au("MOUSE_OUT",5)}function Lu(){return ju(),wu}function Ru(){return ju(),xu}function Iu(){return ju(),ku}function zu(){return ju(),Eu}function Du(){return ju(),Cu}function Mu(){return ju(),Su}function Bu(){Is.call(this),this.isPrebuiltSubtree=!0}function Uu(t){Yu.call(this,t),this.myAttributes_0=e.newArray(Wu().ATTR_COUNT_8be2vx$,null)}function Fu(t,e){this.closure$key=t,this.closure$value=e}function qu(t){Uu.call(this,Ju().GROUP),this.myChildren_0=I(t)}function Gu(t){Bu.call(this),this.myGroup_0=t}function Hu(t,e,n){return n=n||Object.create(qu.prototype),qu.call(n,t),n.setAttribute_vux3hl$(19,e),n}function Yu(t){Wu(),this.elementName=t}function Vu(){Ku=this,this.fill_8be2vx$=0,this.fillOpacity_8be2vx$=1,this.stroke_8be2vx$=2,this.strokeOpacity_8be2vx$=3,this.strokeWidth_8be2vx$=4,this.strokeTransform_8be2vx$=5,this.classes_8be2vx$=6,this.x1_8be2vx$=7,this.y1_8be2vx$=8,this.x2_8be2vx$=9,this.y2_8be2vx$=10,this.cx_8be2vx$=11,this.cy_8be2vx$=12,this.r_8be2vx$=13,this.x_8be2vx$=14,this.y_8be2vx$=15,this.height_8be2vx$=16,this.width_8be2vx$=17,this.pathData_8be2vx$=18,this.transform_8be2vx$=19,this.ATTR_KEYS_8be2vx$=["fill","fill-opacity","stroke","stroke-opacity","stroke-width","transform","classes","x1","y1","x2","y2","cx","cy","r","x","y","height","width","d","transform"],this.ATTR_COUNT_8be2vx$=this.ATTR_KEYS_8be2vx$.length}Nu.$metadata$={kind:s,simpleName:"SvgAttributeEvent",interfaces:[V]},Pu.$metadata$={kind:p,simpleName:"SvgEventHandler",interfaces:[]},Au.$metadata$={kind:s,simpleName:"SvgEventSpec",interfaces:[u]},Au.values=function(){return[Lu(),Ru(),Iu(),zu(),Du(),Mu()]},Au.valueOf_61zpoe$=function(t){switch(t){case"MOUSE_CLICKED":return Lu();case"MOUSE_PRESSED":return Ru();case"MOUSE_RELEASED":return Iu();case"MOUSE_OVER":return zu();case"MOUSE_MOVE":return Du();case"MOUSE_OUT":return Mu();default:c("No enum constant jetbrains.datalore.vis.svg.event.SvgEventSpec."+t)}},Bu.prototype.children=function(){var t=Is.prototype.children.call(this);if(!t.isEmpty())throw k("Can't have children");return t},Bu.$metadata$={kind:s,simpleName:"DummySvgNode",interfaces:[Is]},Object.defineProperty(Fu.prototype,"key",{configurable:!0,get:function(){return this.closure$key}}),Object.defineProperty(Fu.prototype,"value",{configurable:!0,get:function(){return this.closure$value.toString()}}),Fu.$metadata$={kind:s,interfaces:[ec]},Object.defineProperty(Uu.prototype,"attributes",{configurable:!0,get:function(){var t,e,n=this.myAttributes_0,i=I(n.length),r=0;for(t=0;t!==n.length;++t){var o,a=n[t],s=i.add_11rb$,l=(r=(e=r)+1|0,e),u=Wu().ATTR_KEYS_8be2vx$[l];o=null==a?null:new Fu(u,a),s.call(i,o)}return K(i)}}),Object.defineProperty(Uu.prototype,"slimChildren",{configurable:!0,get:function(){return W()}}),Uu.prototype.setAttribute_vux3hl$=function(t,e){this.myAttributes_0[t]=e},Uu.prototype.hasAttribute_za3lpa$=function(t){return null!=this.myAttributes_0[t]},Uu.prototype.getAttribute_za3lpa$=function(t){return this.myAttributes_0[t]},Uu.prototype.appendTo_i2myw1$=function(t){var n;(e.isType(n=t,qu)?n:o()).addChild_3o5936$(this)},Uu.$metadata$={kind:s,simpleName:"ElementJava",interfaces:[tc,Yu]},Object.defineProperty(qu.prototype,"slimChildren",{configurable:!0,get:function(){var t,e=this.myChildren_0,n=I(X(e,10));for(t=e.iterator();t.hasNext();){var i=t.next();n.add_11rb$(i)}return n}}),qu.prototype.addChild_3o5936$=function(t){this.myChildren_0.add_11rb$(t)},qu.prototype.asDummySvgNode=function(){return new Gu(this)},Object.defineProperty(Gu.prototype,"elementName",{configurable:!0,get:function(){return this.myGroup_0.elementName}}),Object.defineProperty(Gu.prototype,"attributes",{configurable:!0,get:function(){return this.myGroup_0.attributes}}),Object.defineProperty(Gu.prototype,"slimChildren",{configurable:!0,get:function(){return this.myGroup_0.slimChildren}}),Gu.$metadata$={kind:s,simpleName:"MyDummySvgNode",interfaces:[tc,Bu]},qu.$metadata$={kind:s,simpleName:"GroupJava",interfaces:[Qu,Uu]},Vu.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Ku=null;function Wu(){return null===Ku&&new Vu,Ku}function Xu(){Zu=this,this.GROUP="g",this.LINE="line",this.CIRCLE="circle",this.RECT="rect",this.PATH="path"}Yu.prototype.setFill_o14uds$=function(t,e){this.setAttribute_vux3hl$(0,t.toHexColor()),e<1&&this.setAttribute_vux3hl$(1,e.toString())},Yu.prototype.setStroke_o14uds$=function(t,e){this.setAttribute_vux3hl$(2,t.toHexColor()),e<1&&this.setAttribute_vux3hl$(3,e.toString())},Yu.prototype.setStrokeWidth_14dthe$=function(t){this.setAttribute_vux3hl$(4,t.toString())},Yu.prototype.setAttribute_7u9h3l$=function(t,e){this.setAttribute_vux3hl$(t,e.toString())},Yu.$metadata$={kind:s,simpleName:"SlimBase",interfaces:[ic]},Xu.prototype.createElement_0=function(t){return new Uu(t)},Xu.prototype.g_za3lpa$=function(t){return new qu(t)},Xu.prototype.g_vux3hl$=function(t,e){return Hu(t,e)},Xu.prototype.line_6y0v78$=function(t,e,n,i){var r=this.createElement_0(this.LINE);return r.setAttribute_7u9h3l$(7,t),r.setAttribute_7u9h3l$(8,e),r.setAttribute_7u9h3l$(9,n),r.setAttribute_7u9h3l$(10,i),r},Xu.prototype.circle_yvo9jy$=function(t,e,n){var i=this.createElement_0(this.CIRCLE);return i.setAttribute_7u9h3l$(11,t),i.setAttribute_7u9h3l$(12,e),i.setAttribute_7u9h3l$(13,n),i},Xu.prototype.rect_6y0v78$=function(t,e,n,i){var r=this.createElement_0(this.RECT);return r.setAttribute_7u9h3l$(14,t),r.setAttribute_7u9h3l$(15,e),r.setAttribute_7u9h3l$(17,n),r.setAttribute_7u9h3l$(16,i),r},Xu.prototype.path_za3rmp$=function(t){var e=this.createElement_0(this.PATH);return e.setAttribute_vux3hl$(18,t.toString()),e},Xu.$metadata$={kind:i,simpleName:"SvgSlimElements",interfaces:[]};var Zu=null;function Ju(){return null===Zu&&new Xu,Zu}function Qu(){}function tc(){}function ec(){}function nc(){}function ic(){}Qu.$metadata$={kind:p,simpleName:"SvgSlimGroup",interfaces:[nc]},ec.$metadata$={kind:p,simpleName:"Attr",interfaces:[]},tc.$metadata$={kind:p,simpleName:"SvgSlimNode",interfaces:[]},nc.$metadata$={kind:p,simpleName:"SvgSlimObject",interfaces:[]},ic.$metadata$={kind:p,simpleName:"SvgSlimShape",interfaces:[nc]},Object.defineProperty(Z,"Companion",{get:tt});var rc=t.jetbrains||(t.jetbrains={}),oc=rc.datalore||(rc.datalore={}),ac=oc.vis||(oc.vis={}),sc=ac.svg||(ac.svg={});sc.SvgAttributeSpec=Z,Object.defineProperty(et,"Companion",{get:rt}),sc.SvgCircleElement=et,Object.defineProperty(ot,"Companion",{get:Jn}),Object.defineProperty(Qn,"USER_SPACE_ON_USE",{get:ei}),Object.defineProperty(Qn,"OBJECT_BOUNDING_BOX",{get:ni}),ot.ClipPathUnits=Qn,sc.SvgClipPathElement=ot,sc.SvgColor=ii,Object.defineProperty(ri,"ALICE_BLUE",{get:ai}),Object.defineProperty(ri,"ANTIQUE_WHITE",{get:si}),Object.defineProperty(ri,"AQUA",{get:li}),Object.defineProperty(ri,"AQUAMARINE",{get:ui}),Object.defineProperty(ri,"AZURE",{get:ci}),Object.defineProperty(ri,"BEIGE",{get:pi}),Object.defineProperty(ri,"BISQUE",{get:hi}),Object.defineProperty(ri,"BLACK",{get:_i}),Object.defineProperty(ri,"BLANCHED_ALMOND",{get:fi}),Object.defineProperty(ri,"BLUE",{get:di}),Object.defineProperty(ri,"BLUE_VIOLET",{get:mi}),Object.defineProperty(ri,"BROWN",{get:yi}),Object.defineProperty(ri,"BURLY_WOOD",{get:$i}),Object.defineProperty(ri,"CADET_BLUE",{get:vi}),Object.defineProperty(ri,"CHARTREUSE",{get:gi}),Object.defineProperty(ri,"CHOCOLATE",{get:bi}),Object.defineProperty(ri,"CORAL",{get:wi}),Object.defineProperty(ri,"CORNFLOWER_BLUE",{get:xi}),Object.defineProperty(ri,"CORNSILK",{get:ki}),Object.defineProperty(ri,"CRIMSON",{get:Ei}),Object.defineProperty(ri,"CYAN",{get:Ci}),Object.defineProperty(ri,"DARK_BLUE",{get:Si}),Object.defineProperty(ri,"DARK_CYAN",{get:Ti}),Object.defineProperty(ri,"DARK_GOLDEN_ROD",{get:Oi}),Object.defineProperty(ri,"DARK_GRAY",{get:Ni}),Object.defineProperty(ri,"DARK_GREEN",{get:Pi}),Object.defineProperty(ri,"DARK_GREY",{get:Ai}),Object.defineProperty(ri,"DARK_KHAKI",{get:ji}),Object.defineProperty(ri,"DARK_MAGENTA",{get:Li}),Object.defineProperty(ri,"DARK_OLIVE_GREEN",{get:Ri}),Object.defineProperty(ri,"DARK_ORANGE",{get:Ii}),Object.defineProperty(ri,"DARK_ORCHID",{get:zi}),Object.defineProperty(ri,"DARK_RED",{get:Di}),Object.defineProperty(ri,"DARK_SALMON",{get:Mi}),Object.defineProperty(ri,"DARK_SEA_GREEN",{get:Bi}),Object.defineProperty(ri,"DARK_SLATE_BLUE",{get:Ui}),Object.defineProperty(ri,"DARK_SLATE_GRAY",{get:Fi}),Object.defineProperty(ri,"DARK_SLATE_GREY",{get:qi}),Object.defineProperty(ri,"DARK_TURQUOISE",{get:Gi}),Object.defineProperty(ri,"DARK_VIOLET",{get:Hi}),Object.defineProperty(ri,"DEEP_PINK",{get:Yi}),Object.defineProperty(ri,"DEEP_SKY_BLUE",{get:Vi}),Object.defineProperty(ri,"DIM_GRAY",{get:Ki}),Object.defineProperty(ri,"DIM_GREY",{get:Wi}),Object.defineProperty(ri,"DODGER_BLUE",{get:Xi}),Object.defineProperty(ri,"FIRE_BRICK",{get:Zi}),Object.defineProperty(ri,"FLORAL_WHITE",{get:Ji}),Object.defineProperty(ri,"FOREST_GREEN",{get:Qi}),Object.defineProperty(ri,"FUCHSIA",{get:tr}),Object.defineProperty(ri,"GAINSBORO",{get:er}),Object.defineProperty(ri,"GHOST_WHITE",{get:nr}),Object.defineProperty(ri,"GOLD",{get:ir}),Object.defineProperty(ri,"GOLDEN_ROD",{get:rr}),Object.defineProperty(ri,"GRAY",{get:or}),Object.defineProperty(ri,"GREY",{get:ar}),Object.defineProperty(ri,"GREEN",{get:sr}),Object.defineProperty(ri,"GREEN_YELLOW",{get:lr}),Object.defineProperty(ri,"HONEY_DEW",{get:ur}),Object.defineProperty(ri,"HOT_PINK",{get:cr}),Object.defineProperty(ri,"INDIAN_RED",{get:pr}),Object.defineProperty(ri,"INDIGO",{get:hr}),Object.defineProperty(ri,"IVORY",{get:_r}),Object.defineProperty(ri,"KHAKI",{get:fr}),Object.defineProperty(ri,"LAVENDER",{get:dr}),Object.defineProperty(ri,"LAVENDER_BLUSH",{get:mr}),Object.defineProperty(ri,"LAWN_GREEN",{get:yr}),Object.defineProperty(ri,"LEMON_CHIFFON",{get:$r}),Object.defineProperty(ri,"LIGHT_BLUE",{get:vr}),Object.defineProperty(ri,"LIGHT_CORAL",{get:gr}),Object.defineProperty(ri,"LIGHT_CYAN",{get:br}),Object.defineProperty(ri,"LIGHT_GOLDEN_ROD_YELLOW",{get:wr}),Object.defineProperty(ri,"LIGHT_GRAY",{get:xr}),Object.defineProperty(ri,"LIGHT_GREEN",{get:kr}),Object.defineProperty(ri,"LIGHT_GREY",{get:Er}),Object.defineProperty(ri,"LIGHT_PINK",{get:Cr}),Object.defineProperty(ri,"LIGHT_SALMON",{get:Sr}),Object.defineProperty(ri,"LIGHT_SEA_GREEN",{get:Tr}),Object.defineProperty(ri,"LIGHT_SKY_BLUE",{get:Or}),Object.defineProperty(ri,"LIGHT_SLATE_GRAY",{get:Nr}),Object.defineProperty(ri,"LIGHT_SLATE_GREY",{get:Pr}),Object.defineProperty(ri,"LIGHT_STEEL_BLUE",{get:Ar}),Object.defineProperty(ri,"LIGHT_YELLOW",{get:jr}),Object.defineProperty(ri,"LIME",{get:Lr}),Object.defineProperty(ri,"LIME_GREEN",{get:Rr}),Object.defineProperty(ri,"LINEN",{get:Ir}),Object.defineProperty(ri,"MAGENTA",{get:zr}),Object.defineProperty(ri,"MAROON",{get:Dr}),Object.defineProperty(ri,"MEDIUM_AQUA_MARINE",{get:Mr}),Object.defineProperty(ri,"MEDIUM_BLUE",{get:Br}),Object.defineProperty(ri,"MEDIUM_ORCHID",{get:Ur}),Object.defineProperty(ri,"MEDIUM_PURPLE",{get:Fr}),Object.defineProperty(ri,"MEDIUM_SEAGREEN",{get:qr}),Object.defineProperty(ri,"MEDIUM_SLATE_BLUE",{get:Gr}),Object.defineProperty(ri,"MEDIUM_SPRING_GREEN",{get:Hr}),Object.defineProperty(ri,"MEDIUM_TURQUOISE",{get:Yr}),Object.defineProperty(ri,"MEDIUM_VIOLET_RED",{get:Vr}),Object.defineProperty(ri,"MIDNIGHT_BLUE",{get:Kr}),Object.defineProperty(ri,"MINT_CREAM",{get:Wr}),Object.defineProperty(ri,"MISTY_ROSE",{get:Xr}),Object.defineProperty(ri,"MOCCASIN",{get:Zr}),Object.defineProperty(ri,"NAVAJO_WHITE",{get:Jr}),Object.defineProperty(ri,"NAVY",{get:Qr}),Object.defineProperty(ri,"OLD_LACE",{get:to}),Object.defineProperty(ri,"OLIVE",{get:eo}),Object.defineProperty(ri,"OLIVE_DRAB",{get:no}),Object.defineProperty(ri,"ORANGE",{get:io}),Object.defineProperty(ri,"ORANGE_RED",{get:ro}),Object.defineProperty(ri,"ORCHID",{get:oo}),Object.defineProperty(ri,"PALE_GOLDEN_ROD",{get:ao}),Object.defineProperty(ri,"PALE_GREEN",{get:so}),Object.defineProperty(ri,"PALE_TURQUOISE",{get:lo}),Object.defineProperty(ri,"PALE_VIOLET_RED",{get:uo}),Object.defineProperty(ri,"PAPAYA_WHIP",{get:co}),Object.defineProperty(ri,"PEACH_PUFF",{get:po}),Object.defineProperty(ri,"PERU",{get:ho}),Object.defineProperty(ri,"PINK",{get:_o}),Object.defineProperty(ri,"PLUM",{get:fo}),Object.defineProperty(ri,"POWDER_BLUE",{get:mo}),Object.defineProperty(ri,"PURPLE",{get:yo}),Object.defineProperty(ri,"RED",{get:$o}),Object.defineProperty(ri,"ROSY_BROWN",{get:vo}),Object.defineProperty(ri,"ROYAL_BLUE",{get:go}),Object.defineProperty(ri,"SADDLE_BROWN",{get:bo}),Object.defineProperty(ri,"SALMON",{get:wo}),Object.defineProperty(ri,"SANDY_BROWN",{get:xo}),Object.defineProperty(ri,"SEA_GREEN",{get:ko}),Object.defineProperty(ri,"SEASHELL",{get:Eo}),Object.defineProperty(ri,"SIENNA",{get:Co}),Object.defineProperty(ri,"SILVER",{get:So}),Object.defineProperty(ri,"SKY_BLUE",{get:To}),Object.defineProperty(ri,"SLATE_BLUE",{get:Oo}),Object.defineProperty(ri,"SLATE_GRAY",{get:No}),Object.defineProperty(ri,"SLATE_GREY",{get:Po}),Object.defineProperty(ri,"SNOW",{get:Ao}),Object.defineProperty(ri,"SPRING_GREEN",{get:jo}),Object.defineProperty(ri,"STEEL_BLUE",{get:Lo}),Object.defineProperty(ri,"TAN",{get:Ro}),Object.defineProperty(ri,"TEAL",{get:Io}),Object.defineProperty(ri,"THISTLE",{get:zo}),Object.defineProperty(ri,"TOMATO",{get:Do}),Object.defineProperty(ri,"TURQUOISE",{get:Mo}),Object.defineProperty(ri,"VIOLET",{get:Bo}),Object.defineProperty(ri,"WHEAT",{get:Uo}),Object.defineProperty(ri,"WHITE",{get:Fo}),Object.defineProperty(ri,"WHITE_SMOKE",{get:qo}),Object.defineProperty(ri,"YELLOW",{get:Go}),Object.defineProperty(ri,"YELLOW_GREEN",{get:Ho}),Object.defineProperty(ri,"NONE",{get:Yo}),Object.defineProperty(ri,"CURRENT_COLOR",{get:Vo}),Object.defineProperty(ri,"Companion",{get:Zo}),sc.SvgColors=ri,Object.defineProperty(sc,"SvgConstants",{get:ea}),Object.defineProperty(na,"Companion",{get:oa}),sc.SvgContainer=na,sc.SvgCssResource=aa,sc.SvgDefsElement=sa,Object.defineProperty(la,"Companion",{get:pa}),sc.SvgElement=la,sc.SvgElementListener=ya,Object.defineProperty($a,"Companion",{get:ba}),sc.SvgEllipseElement=$a,sc.SvgEventPeer=wa,sc.SvgGElement=Ta,Object.defineProperty(Oa,"Companion",{get:Ya}),Object.defineProperty(Va,"VISIBLE_PAINTED",{get:Wa}),Object.defineProperty(Va,"VISIBLE_FILL",{get:Xa}),Object.defineProperty(Va,"VISIBLE_STROKE",{get:Za}),Object.defineProperty(Va,"VISIBLE",{get:Ja}),Object.defineProperty(Va,"PAINTED",{get:Qa}),Object.defineProperty(Va,"FILL",{get:ts}),Object.defineProperty(Va,"STROKE",{get:es}),Object.defineProperty(Va,"ALL",{get:ns}),Object.defineProperty(Va,"NONE",{get:is}),Object.defineProperty(Va,"INHERIT",{get:rs}),Oa.PointerEvents=Va,Object.defineProperty(os,"VISIBLE",{get:ss}),Object.defineProperty(os,"HIDDEN",{get:ls}),Object.defineProperty(os,"COLLAPSE",{get:us}),Object.defineProperty(os,"INHERIT",{get:cs}),Oa.Visibility=os,sc.SvgGraphicsElement=Oa,sc.SvgIRI=ps,Object.defineProperty(hs,"Companion",{get:ds}),sc.SvgImageElement_init_6y0v78$=ms,sc.SvgImageElement=hs,ys.RGBEncoder=vs,ys.Bitmap=gs,sc.SvgImageElementEx=ys,Object.defineProperty(bs,"Companion",{get:Ls}),sc.SvgLineElement_init_6y0v78$=function(t,e,n,i,r){return r=r||Object.create(bs.prototype),bs.call(r),r.setAttribute_qdh7ux$(Ls().X1,t),r.setAttribute_qdh7ux$(Ls().Y1,e),r.setAttribute_qdh7ux$(Ls().X2,n),r.setAttribute_qdh7ux$(Ls().Y2,i),r},sc.SvgLineElement=bs,sc.SvgLocatable=Rs,sc.SvgNode=Is,sc.SvgNodeContainer=Ds,Object.defineProperty(Gs,"MOVE_TO",{get:Ys}),Object.defineProperty(Gs,"LINE_TO",{get:Vs}),Object.defineProperty(Gs,"HORIZONTAL_LINE_TO",{get:Ks}),Object.defineProperty(Gs,"VERTICAL_LINE_TO",{get:Ws}),Object.defineProperty(Gs,"CURVE_TO",{get:Xs}),Object.defineProperty(Gs,"SMOOTH_CURVE_TO",{get:Zs}),Object.defineProperty(Gs,"QUADRATIC_BEZIER_CURVE_TO",{get:Js}),Object.defineProperty(Gs,"SMOOTH_QUADRATIC_BEZIER_CURVE_TO",{get:Qs}),Object.defineProperty(Gs,"ELLIPTICAL_ARC",{get:tl}),Object.defineProperty(Gs,"CLOSE_PATH",{get:el}),Object.defineProperty(Gs,"Companion",{get:rl}),qs.Action=Gs,Object.defineProperty(qs,"Companion",{get:pl}),sc.SvgPathData=qs,Object.defineProperty(_l,"LINEAR",{get:dl}),Object.defineProperty(_l,"CARDINAL",{get:ml}),Object.defineProperty(_l,"MONOTONE",{get:yl}),hl.Interpolation=_l,sc.SvgPathDataBuilder=hl,Object.defineProperty($l,"Companion",{get:bl}),sc.SvgPathElement_init_7jrsat$=function(t,e){return e=e||Object.create($l.prototype),$l.call(e),e.setAttribute_qdh7ux$(bl().D,t),e},sc.SvgPathElement=$l,sc.SvgPlatformPeer=wl,Object.defineProperty(xl,"Companion",{get:Cl}),sc.SvgRectElement_init_6y0v78$=Sl,sc.SvgRectElement_init_wthzt5$=function(t,e){return e=e||Object.create(xl.prototype),Sl(t.origin.x,t.origin.y,t.dimension.x,t.dimension.y,e),e},sc.SvgRectElement=xl,Object.defineProperty(Tl,"Companion",{get:Pl}),sc.SvgShape=Tl,Object.defineProperty(Al,"Companion",{get:Rl}),sc.SvgStylableElement=Al,sc.SvgStyleElement=Il,Object.defineProperty(zl,"Companion",{get:Bl}),zl.ViewBoxRectangle_init_6y0v78$=function(t,e,n,i,r){return r=r||Object.create(Fl.prototype),Fl.call(r),r.myX_0=t,r.myY_0=e,r.myWidth_0=n,r.myHeight_0=i,r},zl.ViewBoxRectangle_init_wthzt5$=ql,zl.ViewBoxRectangle=Fl,sc.SvgSvgElement=zl,Object.defineProperty(Gl,"Companion",{get:Vl}),sc.SvgTSpanElement_init_61zpoe$=Kl,sc.SvgTSpanElement=Gl,Object.defineProperty(Wl,"Companion",{get:Jl}),sc.SvgTextContent=Wl,Object.defineProperty(Ql,"Companion",{get:nu}),sc.SvgTextElement_init_61zpoe$=function(t,e){return e=e||Object.create(Ql.prototype),Ql.call(e),e.setTextNode_61zpoe$(t),e},sc.SvgTextElement=Ql,Object.defineProperty(iu,"Companion",{get:su}),sc.SvgTextNode=iu,Object.defineProperty(lu,"Companion",{get:pu}),sc.SvgTransform=lu,sc.SvgTransformBuilder=hu,Object.defineProperty(_u,"Companion",{get:mu}),sc.SvgTransformable=_u,Object.defineProperty(sc,"SvgUtils",{get:gu}),Object.defineProperty(sc,"XmlNamespace",{get:Ou});var lc=sc.event||(sc.event={});lc.SvgAttributeEvent=Nu,lc.SvgEventHandler=Pu,Object.defineProperty(Au,"MOUSE_CLICKED",{get:Lu}),Object.defineProperty(Au,"MOUSE_PRESSED",{get:Ru}),Object.defineProperty(Au,"MOUSE_RELEASED",{get:Iu}),Object.defineProperty(Au,"MOUSE_OVER",{get:zu}),Object.defineProperty(Au,"MOUSE_MOVE",{get:Du}),Object.defineProperty(Au,"MOUSE_OUT",{get:Mu}),lc.SvgEventSpec=Au;var uc=sc.slim||(sc.slim={});return uc.DummySvgNode=Bu,uc.ElementJava=Uu,uc.GroupJava_init_vux3hl$=Hu,uc.GroupJava=qu,Object.defineProperty(Yu,"Companion",{get:Wu}),uc.SlimBase=Yu,Object.defineProperty(uc,"SvgSlimElements",{get:Ju}),uc.SvgSlimGroup=Qu,tc.Attr=ec,uc.SvgSlimNode=tc,uc.SvgSlimObject=nc,uc.SvgSlimShape=ic,t})?i.apply(e,r):i)||(t.exports=o)},975:t=>{function e(t){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}e.keys=()=>[],e.resolve=e,e.id=975,t.exports=e}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i=n(837);window.LetsPlot=i})(); +(()=>{var t={73:function(t,e,n){var i,r,o;r=[e,n(421)],void 0===(o="function"==typeof(i=function(t,e){"use strict";e.defineInlineFunction,e.wrapFunction;var n=e.Kind.INTERFACE,i=e.Kind.OBJECT,r=e.toString,o=e.equals,a=e.kotlin.Exception,s=e.kotlin.js.get_js_1yb8b7$,l=e.kotlin.Enum,u=e.Kind.CLASS,c=e.throwISE,p=e.kotlin.Unit,h=e.getCallableRef;function _(){}function f(){d=this}A.prototype=Object.create(l.prototype),A.prototype.constructor=A,_.$metadata$={kind:n,simpleName:"Appender",interfaces:[]},f.prototype.trace_s8jyv4$=function(t){console.log(t)},f.prototype.debug_s8jyv4$=function(t){console.log(t)},f.prototype.info_s8jyv4$=function(t){console.info(t)},f.prototype.warn_s8jyv4$=function(t){console.warn(t)},f.prototype.error_s8jyv4$=function(t){console.error(t)},f.$metadata$={kind:i,simpleName:"ConsoleOutputAppender",interfaces:[_]};var d=null;function m(){return null===d&&new f,d}function y(){$=this}y.prototype.formatMessage_pijeg6$=function(t,n,i){var o,s=t.name+": ["+n+"] ";try{o=r(i())}catch(t){if(!e.isType(t,a))throw t;o=H.ErrorMessageProducer.getErrorLog_3lhtaa$(t)}return s+o},y.prototype.formatMessage_hqgb2y$=function(t,n,i,o){var s,l=t.name+": ["+n+"] ";try{s=r(o())}catch(t){if(!e.isType(t,a))throw t;s=H.ErrorMessageProducer.getErrorLog_3lhtaa$(t)}return l+s+this.throwableToString_0(i)},y.prototype.formatMessage_i9qi47$=function(t,n,i,o){var s,l=t.name+": ["+n+"] "+r(null!=i?i.getName():null)+" ";try{s=r(o())}catch(t){if(!e.isType(t,a))throw t;s=H.ErrorMessageProducer.getErrorLog_3lhtaa$(t)}return l+s},y.prototype.formatMessage_fud0c7$=function(t,n,i,o,s){var l,u=t.name+": ["+n+"] "+r(null!=i?i.getName():null)+" ";try{l=r(s())}catch(t){if(!e.isType(t,a))throw t;l=H.ErrorMessageProducer.getErrorLog_3lhtaa$(t)}return u+l+this.throwableToString_0(o)},y.prototype.throwableToString_0=function(t){if(null==t)return"";for(var e="",n=t;null!=n&&!o(n.cause,n);)e+=", Caused by: '"+r(n.message)+"'",n=n.cause;return e},y.$metadata$={kind:i,simpleName:"DefaultMessageFormatter",interfaces:[g]};var $=null;function v(){return null===$&&new y,$}function g(){}function b(){}function w(){x=this}g.$metadata$={kind:n,simpleName:"Formatter",interfaces:[]},b.$metadata$={kind:n,simpleName:"KLogger",interfaces:[]},w.prototype.logger_o14v8n$=function(t){return new F(s(e.getKClassFromExpression(t)).name)},w.prototype.logger_61zpoe$=function(t){return new F(t)},w.$metadata$={kind:i,simpleName:"KotlinLogging",interfaces:[]};var x=null;function k(){N=this,this.LOG_LEVEL=I(),this.APPENDER=m(),this.FORMATTER=v()}k.$metadata$={kind:i,simpleName:"KotlinLoggingConfiguration",interfaces:[]};var E,C,S,T,O,N=null;function P(){return null===N&&new k,N}function A(t,e){l.call(this),this.name$=t,this.ordinal$=e}function j(){j=function(){},E=new A("TRACE",0),C=new A("DEBUG",1),S=new A("INFO",2),T=new A("WARN",3),O=new A("ERROR",4)}function L(){return j(),E}function R(){return j(),C}function I(){return j(),S}function z(){return j(),T}function D(){return j(),O}function M(t){return t.ordinal>=P().LOG_LEVEL.ordinal}function B(){U=this}A.$metadata$={kind:u,simpleName:"KotlinLoggingLevel",interfaces:[l]},A.values=function(){return[L(),R(),I(),z(),D()]},A.valueOf_61zpoe$=function(t){switch(t){case"TRACE":return L();case"DEBUG":return R();case"INFO":return I();case"WARN":return z();case"ERROR":return D();default:c("No enum constant mu.KotlinLoggingLevel."+t)}},B.prototype.getErrorLog_3lhtaa$=function(t){return"Log message invocation failed: "+t},B.$metadata$={kind:i,simpleName:"ErrorMessageProducer",interfaces:[]};var U=null;function F(t){this.loggerName_0=t}function q(){return"exit()"}F.prototype.trace_nq59yw$=function(t){this.logIfEnabled_0(L(),t,h("trace",function(t,e){return t.trace_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.debug_nq59yw$=function(t){this.logIfEnabled_0(R(),t,h("debug",function(t,e){return t.debug_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.info_nq59yw$=function(t){this.logIfEnabled_0(I(),t,h("info",function(t,e){return t.info_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.warn_nq59yw$=function(t){this.logIfEnabled_0(z(),t,h("warn",function(t,e){return t.warn_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.error_nq59yw$=function(t){this.logIfEnabled_0(D(),t,h("error",function(t,e){return t.error_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.trace_ca4k3s$=function(t,e){this.logIfEnabled_1(L(),e,t,h("trace",function(t,e){return t.trace_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.debug_ca4k3s$=function(t,e){this.logIfEnabled_1(R(),e,t,h("debug",function(t,e){return t.debug_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.info_ca4k3s$=function(t,e){this.logIfEnabled_1(I(),e,t,h("info",function(t,e){return t.info_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.warn_ca4k3s$=function(t,e){this.logIfEnabled_1(z(),e,t,h("warn",function(t,e){return t.warn_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.error_ca4k3s$=function(t,e){this.logIfEnabled_1(D(),e,t,h("error",function(t,e){return t.error_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.trace_8jakm3$=function(t,e){this.logIfEnabled_2(L(),t,e,h("trace",function(t,e){return t.trace_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.debug_8jakm3$=function(t,e){this.logIfEnabled_2(R(),t,e,h("debug",function(t,e){return t.debug_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.info_8jakm3$=function(t,e){this.logIfEnabled_2(I(),t,e,h("info",function(t,e){return t.info_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.warn_8jakm3$=function(t,e){this.logIfEnabled_2(z(),t,e,h("warn",function(t,e){return t.warn_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.error_8jakm3$=function(t,e){this.logIfEnabled_2(D(),t,e,h("error",function(t,e){return t.error_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.trace_o4svvp$=function(t,e,n){this.logIfEnabled_3(L(),t,n,e,h("trace",function(t,e){return t.trace_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.debug_o4svvp$=function(t,e,n){this.logIfEnabled_3(R(),t,n,e,h("debug",function(t,e){return t.debug_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.info_o4svvp$=function(t,e,n){this.logIfEnabled_3(I(),t,n,e,h("info",function(t,e){return t.info_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.warn_o4svvp$=function(t,e,n){this.logIfEnabled_3(z(),t,n,e,h("warn",function(t,e){return t.warn_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.error_o4svvp$=function(t,e,n){this.logIfEnabled_3(D(),t,n,e,h("error",function(t,e){return t.error_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.logIfEnabled_0=function(t,e,n){M(t)&&n(P().FORMATTER.formatMessage_pijeg6$(t,this.loggerName_0,e))},F.prototype.logIfEnabled_1=function(t,e,n,i){M(t)&&i(P().FORMATTER.formatMessage_hqgb2y$(t,this.loggerName_0,n,e))},F.prototype.logIfEnabled_2=function(t,e,n,i){M(t)&&i(P().FORMATTER.formatMessage_i9qi47$(t,this.loggerName_0,e,n))},F.prototype.logIfEnabled_3=function(t,e,n,i,r){M(t)&&r(P().FORMATTER.formatMessage_fud0c7$(t,this.loggerName_0,e,i,n))},F.prototype.entry_yhszz7$=function(t){var e;this.logIfEnabled_0(L(),(e=t,function(){return"entry("+e+")"}),h("trace",function(t,e){return t.trace_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.exit=function(){this.logIfEnabled_0(L(),q,h("trace",function(t,e){return t.trace_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.prototype.exit_mh5how$=function(t){return this.logIfEnabled_0(L(),(e=t,function(){return"exit("+e+")"}),h("trace",function(t,e){return t.trace_s8jyv4$(e),p}.bind(null,P().APPENDER))),t;var e},F.prototype.throwing_849n7l$=function(t){return this.logIfEnabled_1(D(),(e=t,function(){return"throwing("+e}),t,h("error",function(t,e){return t.error_s8jyv4$(e),p}.bind(null,P().APPENDER))),t;var e},F.prototype.catching_849n7l$=function(t){var e;this.logIfEnabled_1(D(),(e=t,function(){return"catching("+e}),t,h("error",function(t,e){return t.error_s8jyv4$(e),p}.bind(null,P().APPENDER)))},F.$metadata$={kind:u,simpleName:"KLoggerJS",interfaces:[b]};var G=t.mu||(t.mu={}),H=G.internal||(G.internal={});return G.Appender=_,Object.defineProperty(G,"ConsoleOutputAppender",{get:m}),Object.defineProperty(G,"DefaultMessageFormatter",{get:v}),G.Formatter=g,G.KLogger=b,Object.defineProperty(G,"KotlinLogging",{get:function(){return null===x&&new w,x}}),Object.defineProperty(G,"KotlinLoggingConfiguration",{get:P}),Object.defineProperty(A,"TRACE",{get:L}),Object.defineProperty(A,"DEBUG",{get:R}),Object.defineProperty(A,"INFO",{get:I}),Object.defineProperty(A,"WARN",{get:z}),Object.defineProperty(A,"ERROR",{get:D}),G.KotlinLoggingLevel=A,G.isLoggingEnabled_pm19j7$=M,Object.defineProperty(H,"ErrorMessageProducer",{get:function(){return null===U&&new B,U}}),H.KLoggerJS=F,t})?i.apply(e,r):i)||(t.exports=o)},421:function(t,e){var n,i;void 0===(i="function"==typeof(n=function(t){var e=t;t.isBooleanArray=function(t){return(Array.isArray(t)||t instanceof Int8Array)&&"BooleanArray"===t.$type$},t.isByteArray=function(t){return t instanceof Int8Array&&"BooleanArray"!==t.$type$},t.isShortArray=function(t){return t instanceof Int16Array},t.isCharArray=function(t){return t instanceof Uint16Array&&"CharArray"===t.$type$},t.isIntArray=function(t){return t instanceof Int32Array},t.isFloatArray=function(t){return t instanceof Float32Array},t.isDoubleArray=function(t){return t instanceof Float64Array},t.isLongArray=function(t){return Array.isArray(t)&&"LongArray"===t.$type$},t.isArray=function(t){return Array.isArray(t)&&!t.$type$},t.isArrayish=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)},t.arrayToString=function(e){if(null===e)return"null";var n=t.isCharArray(e)?String.fromCharCode:t.toString;return"["+Array.prototype.map.call(e,(function(t){return n(t)})).join(", ")+"]"},t.arrayEquals=function(e,n){if(e===n)return!0;if(null===e||null===n||!t.isArrayish(n)||e.length!==n.length)return!1;for(var i=0,r=e.length;i>16},t.toByte=function(t){return(255&t)<<24>>24},t.toChar=function(t){return 65535&t},t.numberToLong=function(e){return e instanceof t.Long?e:t.Long.fromNumber(e)},t.numberToInt=function(e){return e instanceof t.Long?e.toInt():t.doubleToInt(e)},t.numberToDouble=function(t){return+t},t.doubleToInt=function(t){return t>2147483647?2147483647:t<-2147483648?-2147483648:0|t},t.toBoxedChar=function(e){return null==e||e instanceof t.BoxedChar?e:new t.BoxedChar(e)},t.unboxChar=function(e){return null==e?e:t.toChar(e)},t.equals=function(t,e){return null==t?null==e:null!=e&&(t!=t?e!=e:"object"==typeof t&&"function"==typeof t.equals?t.equals(e):"number"==typeof t&&"number"==typeof e?t===e&&(0!==t||1/t==1/e):t===e)},t.hashCode=function(e){if(null==e)return 0;var n=typeof e;return"object"===n?"function"==typeof e.hashCode?e.hashCode():h(e):"function"===n?h(e):"number"===n?t.numberHashCode(e):"boolean"===n?Number(e):function(t){for(var e=0,n=0;n=t.Long.TWO_PWR_63_DBL_?t.Long.MAX_VALUE:e<0?t.Long.fromNumber(-e).negate():new t.Long(e%t.Long.TWO_PWR_32_DBL_|0,e/t.Long.TWO_PWR_32_DBL_|0)},t.Long.fromBits=function(e,n){return new t.Long(e,n)},t.Long.fromString=function(e,n){if(0==e.length)throw Error("number format error: empty string");var i=n||10;if(i<2||36=0)throw Error('number format error: interior "-" character: '+e);for(var r=t.Long.fromNumber(Math.pow(i,8)),o=t.Long.ZERO,a=0;a=0?this.low_:t.Long.TWO_PWR_32_DBL_+this.low_},t.Long.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equalsLong(t.Long.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var e=0!=this.high_?this.high_:this.low_,n=31;n>0&&0==(e&1<0},t.Long.prototype.greaterThanOrEqual=function(t){return this.compare(t)>=0},t.Long.prototype.compare=function(t){if(this.equalsLong(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.subtract(t).isNegative()?-1:1},t.Long.prototype.negate=function(){return this.equalsLong(t.Long.MIN_VALUE)?t.Long.MIN_VALUE:this.not().add(t.Long.ONE)},t.Long.prototype.add=function(e){var n=this.high_>>>16,i=65535&this.high_,r=this.low_>>>16,o=65535&this.low_,a=e.high_>>>16,s=65535&e.high_,l=e.low_>>>16,u=0,c=0,p=0,h=0;return p+=(h+=o+(65535&e.low_))>>>16,h&=65535,c+=(p+=r+l)>>>16,p&=65535,u+=(c+=i+s)>>>16,c&=65535,u+=n+a,u&=65535,t.Long.fromBits(p<<16|h,u<<16|c)},t.Long.prototype.subtract=function(t){return this.add(t.negate())},t.Long.prototype.multiply=function(e){if(this.isZero())return t.Long.ZERO;if(e.isZero())return t.Long.ZERO;if(this.equalsLong(t.Long.MIN_VALUE))return e.isOdd()?t.Long.MIN_VALUE:t.Long.ZERO;if(e.equalsLong(t.Long.MIN_VALUE))return this.isOdd()?t.Long.MIN_VALUE:t.Long.ZERO;if(this.isNegative())return e.isNegative()?this.negate().multiply(e.negate()):this.negate().multiply(e).negate();if(e.isNegative())return this.multiply(e.negate()).negate();if(this.lessThan(t.Long.TWO_PWR_24_)&&e.lessThan(t.Long.TWO_PWR_24_))return t.Long.fromNumber(this.toNumber()*e.toNumber());var n=this.high_>>>16,i=65535&this.high_,r=this.low_>>>16,o=65535&this.low_,a=e.high_>>>16,s=65535&e.high_,l=e.low_>>>16,u=65535&e.low_,c=0,p=0,h=0,_=0;return h+=(_+=o*u)>>>16,_&=65535,p+=(h+=r*u)>>>16,h&=65535,p+=(h+=o*l)>>>16,h&=65535,c+=(p+=i*u)>>>16,p&=65535,c+=(p+=r*l)>>>16,p&=65535,c+=(p+=o*s)>>>16,p&=65535,c+=n*u+i*l+r*s+o*a,c&=65535,t.Long.fromBits(h<<16|_,c<<16|p)},t.Long.prototype.div=function(e){if(e.isZero())throw Error("division by zero");if(this.isZero())return t.Long.ZERO;if(this.equalsLong(t.Long.MIN_VALUE)){if(e.equalsLong(t.Long.ONE)||e.equalsLong(t.Long.NEG_ONE))return t.Long.MIN_VALUE;if(e.equalsLong(t.Long.MIN_VALUE))return t.Long.ONE;if((r=this.shiftRight(1).div(e).shiftLeft(1)).equalsLong(t.Long.ZERO))return e.isNegative()?t.Long.ONE:t.Long.NEG_ONE;var n=this.subtract(e.multiply(r));return r.add(n.div(e))}if(e.equalsLong(t.Long.MIN_VALUE))return t.Long.ZERO;if(this.isNegative())return e.isNegative()?this.negate().div(e.negate()):this.negate().div(e).negate();if(e.isNegative())return this.div(e.negate()).negate();var i=t.Long.ZERO;for(n=this;n.greaterThanOrEqual(e);){for(var r=Math.max(1,Math.floor(n.toNumber()/e.toNumber())),o=Math.ceil(Math.log(r)/Math.LN2),a=o<=48?1:Math.pow(2,o-48),s=t.Long.fromNumber(r),l=s.multiply(e);l.isNegative()||l.greaterThan(n);)r-=a,l=(s=t.Long.fromNumber(r)).multiply(e);s.isZero()&&(s=t.Long.ONE),i=i.add(s),n=n.subtract(l)}return i},t.Long.prototype.modulo=function(t){return this.subtract(this.div(t).multiply(t))},t.Long.prototype.not=function(){return t.Long.fromBits(~this.low_,~this.high_)},t.Long.prototype.and=function(e){return t.Long.fromBits(this.low_&e.low_,this.high_&e.high_)},t.Long.prototype.or=function(e){return t.Long.fromBits(this.low_|e.low_,this.high_|e.high_)},t.Long.prototype.xor=function(e){return t.Long.fromBits(this.low_^e.low_,this.high_^e.high_)},t.Long.prototype.shiftLeft=function(e){if(0==(e&=63))return this;var n=this.low_;if(e<32){var i=this.high_;return t.Long.fromBits(n<>>32-e)}return t.Long.fromBits(0,n<>>e|n<<32-e,n>>e)}return t.Long.fromBits(n>>e-32,n>=0?0:-1)},t.Long.prototype.shiftRightUnsigned=function(e){if(0==(e&=63))return this;var n=this.high_;if(e<32){var i=this.low_;return t.Long.fromBits(i>>>e|n<<32-e,n>>>e)}return 32==e?t.Long.fromBits(n,0):t.Long.fromBits(n>>>e-32,0)},t.Long.prototype.equals=function(e){return e instanceof t.Long&&this.equalsLong(e)},t.Long.prototype.compareTo_11rb$=t.Long.prototype.compare,t.Long.prototype.inc=function(){return this.add(t.Long.ONE)},t.Long.prototype.dec=function(){return this.add(t.Long.NEG_ONE)},t.Long.prototype.valueOf=function(){return this.toNumber()},t.Long.prototype.unaryPlus=function(){return this},t.Long.prototype.unaryMinus=t.Long.prototype.negate,t.Long.prototype.inv=t.Long.prototype.not,t.Long.prototype.rangeTo=function(e){return new t.kotlin.ranges.LongRange(this,e)},t.defineInlineFunction=function(t,e){return e},t.wrapFunction=function(t){var e=function(){return(e=t()).apply(this,arguments)};return function(){return e.apply(this,arguments)}},t.suspendCall=function(t){return t},t.coroutineResult=function(t){_()},t.coroutineReceiver=function(t){_()},t.setCoroutineResult=function(t,e){_()},t.getReifiedTypeParameterKType=function(t){_()},t.compareTo=function(e,n){var i=typeof e;return"number"===i?"number"==typeof n?t.doubleCompareTo(e,n):t.primitiveCompareTo(e,n):"string"===i||"boolean"===i?t.primitiveCompareTo(e,n):e.compareTo_11rb$(n)},t.primitiveCompareTo=function(t,e){return te?1:0},t.doubleCompareTo=function(t,e){if(te)return 1;if(t===e){if(0!==t)return 0;var n=1/t;return n===1/e?0:n<0?-1:1}return t!=t?e!=e?0:1:-1},t.charInc=function(e){return t.toChar(e+1)},t.imul=Math.imul||f,t.imulEmulated=f,i=new ArrayBuffer(8),r=new Float64Array(i),o=new Float32Array(i),a=new Int32Array(i),s=0,l=1,r[0]=-1,0!==a[s]&&(s=1,l=0),t.doubleToBits=function(e){return t.doubleToRawBits(isNaN(e)?NaN:e)},t.doubleToRawBits=function(e){return r[0]=e,t.Long.fromBits(a[s],a[l])},t.doubleFromBits=function(t){return a[s]=t.low_,a[l]=t.high_,r[0]},t.floatToBits=function(e){return t.floatToRawBits(isNaN(e)?NaN:e)},t.floatToRawBits=function(t){return o[0]=t,a[0]},t.floatFromBits=function(t){return a[0]=t,o[0]},t.numberHashCode=function(t){return(0|t)===t?0|t:(r[0]=t,(31*a[l]|0)+a[s]|0)},t.ensureNotNull=function(e){return null!=e?e:t.throwNPE()},void 0===String.prototype.startsWith&&Object.defineProperty(String.prototype,"startsWith",{value:function(t,e){return e=e||0,this.lastIndexOf(t,e)===e}}),void 0===String.prototype.endsWith&&Object.defineProperty(String.prototype,"endsWith",{value:function(t,e){var n=this.toString();(void 0===e||e>n.length)&&(e=n.length),e-=t.length;var i=n.indexOf(t,e);return-1!==i&&i===e}}),void 0===Math.sign&&(Math.sign=function(t){return 0==(t=+t)||isNaN(t)?Number(t):t>0?1:-1}),void 0===Math.trunc&&(Math.trunc=function(t){return isNaN(t)?NaN:t>0?Math.floor(t):Math.ceil(t)}),function(){var t=Math.sqrt(2220446049250313e-31),e=Math.sqrt(t),n=1/t,i=1/e;if(void 0===Math.sinh&&(Math.sinh=function(n){if(Math.abs(n)t&&(i+=n*n*n/6),i}var r=Math.exp(n),o=1/r;return isFinite(r)?isFinite(o)?(r-o)/2:-Math.exp(-n-Math.LN2):Math.exp(n-Math.LN2)}),void 0===Math.cosh&&(Math.cosh=function(t){var e=Math.exp(t),n=1/e;return isFinite(e)&&isFinite(n)?(e+n)/2:Math.exp(Math.abs(t)-Math.LN2)}),void 0===Math.tanh&&(Math.tanh=function(n){if(Math.abs(n)t&&(i-=n*n*n/3),i}var r=Math.exp(+n),o=Math.exp(-n);return r===1/0?1:o===1/0?-1:(r-o)/(r+o)}),void 0===Math.asinh){var r=function(o){if(o>=+e)return o>i?o>n?Math.log(o)+Math.LN2:Math.log(2*o+1/(2*o)):Math.log(o+Math.sqrt(o*o+1));if(o<=-e)return-r(-o);var a=o;return Math.abs(o)>=t&&(a-=o*o*o/6),a};Math.asinh=r}void 0===Math.acosh&&(Math.acosh=function(i){if(i<1)return NaN;if(i-1>=e)return i>n?Math.log(i)+Math.LN2:Math.log(i+Math.sqrt(i*i-1));var r=Math.sqrt(i-1),o=r;return r>=t&&(o-=r*r*r/12),Math.sqrt(2)*o}),void 0===Math.atanh&&(Math.atanh=function(n){if(Math.abs(n)t&&(i+=n*n*n/3),i}return Math.log((1+n)/(1-n))/2}),void 0===Math.log1p&&(Math.log1p=function(t){if(Math.abs(t)>>0;return 0===e?32:31-(u(e)/c|0)|0})),void 0===ArrayBuffer.isView&&(ArrayBuffer.isView=function(t){return null!=t&&null!=t.__proto__&&t.__proto__.__proto__===Int8Array.prototype.__proto__}),void 0===Array.prototype.fill&&Object.defineProperty(Array.prototype,"fill",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");for(var e=Object(this),n=e.length>>>0,i=arguments[1]>>0,r=i<0?Math.max(n+i,0):Math.min(i,n),o=arguments[2],a=void 0===o?n:o>>0,s=a<0?Math.max(n+a,0):Math.min(a,n);re)return 1;if(t===e){if(0!==t)return 0;var n=1/t;return n===1/e?0:n<0?-1:1}return t!=t?e!=e?0:1:-1};for(i=0;i=0}function U(t,e){return q(t,e)>=0}function F(t,e){if(null==e){for(var n=0;n!==t.length;++n)if(null==t[n])return n}else for(var i=0;i!==t.length;++i)if(o(e,t[i]))return i;return-1}function q(t,e){for(var n=0;n!==t.length;++n)if(e===t[n])return n;return-1}function G(t,e){var n,i;if(null==e)for(n=Nt(W(t)).iterator();n.hasNext();){var r=n.next();if(null==t[r])return r}else for(i=Nt(W(t)).iterator();i.hasNext();){var a=i.next();if(o(e,t[a]))return a}return-1}function H(t){var e;switch(t.length){case 0:throw new Xn("Array is empty.");case 1:e=t[0];break;default:throw Mn("Array has more than one element.")}return e}function Y(t){return V(t,Ki())}function V(t,e){var n;for(n=0;n!==t.length;++n){var i=t[n];null!=i&&e.add_11rb$(i)}return e}function K(t,e){var n;if(!(e>=0))throw Mn(("Requested element count "+e+" is less than zero.").toString());if(0===e)return $s();if(e>=t.length)return Q(t);if(1===e)return ki(t[0]);var i=0,r=Wi(e);for(n=0;n!==t.length;++n){var o=t[n];if(r.add_11rb$(o),(i=i+1|0)===e)break}return r}function W(t){return new qe(0,X(t))}function X(t){return t.length-1|0}function Z(t){return t.length-1|0}function J(t,e){var n;for(n=0;n!==t.length;++n){var i=t[n];e.add_11rb$(i)}return e}function Q(t){var e;switch(t.length){case 0:e=$s();break;case 1:e=ki(t[0]);break;default:e=tt(t)}return e}function tt(t){return Xi(ms(t))}function et(t){var e;switch(t.length){case 0:e=Dl();break;case 1:e=Ei(t[0]);break;default:e=J(t,Dr(t.length))}return e}function nt(t,e,n,i,r,o,a,s){var l;void 0===n&&(n=", "),void 0===i&&(i=""),void 0===r&&(r=""),void 0===o&&(o=-1),void 0===a&&(a="..."),void 0===s&&(s=null),e.append_gw00v9$(i);var u=0;for(l=0;l!==t.length;++l){var c=t[l];if((u=u+1|0)>1&&e.append_gw00v9$(n),!(o<0||u<=o))break;ic(e,c,s)}return o>=0&&u>o&&e.append_gw00v9$(a),e.append_gw00v9$(r),e}function it(e){return 0===e.length?ll():new M((n=e,function(){return t.arrayIterator(n)}));var n}function rt(t){this.closure$iterator=t}function ot(e,n){return t.isType(e,ee)?e.contains_11rb$(n):ct(e,n)>=0}function at(e,n){return t.isType(e,ie)?e.get_za3lpa$(n):st(e,n,(i=n,function(t){throw new Fn("Collection doesn't contain element at index "+i+".")}));var i}function st(e,n,i){var r;if(t.isType(e,ie))return n>=0&&n<=ws(e)?e.get_za3lpa$(n):i(n);if(n<0)return i(n);for(var o=e.iterator(),a=0;o.hasNext();){var s=o.next();if(n===(a=(r=a)+1|0,r))return s}return i(n)}function lt(e){if(t.isType(e,ie))return ut(e);var n=e.iterator();if(!n.hasNext())throw new Xn("Collection is empty.");return n.next()}function ut(t){if(t.isEmpty())throw new Xn("List is empty.");return t.get_za3lpa$(0)}function ct(e,n){var i;if(t.isType(e,ie))return e.indexOf_11rb$(n);var r=0;for(i=e.iterator();i.hasNext();){var a=i.next();if(Pi(r),o(n,a))return r;r=r+1|0}return-1}function pt(e){if(t.isType(e,ie))return ht(e);var n=e.iterator();if(!n.hasNext())throw new Xn("Collection is empty.");for(var i=n.next();n.hasNext();)i=n.next();return i}function ht(t){if(t.isEmpty())throw new Xn("List is empty.");return t.get_za3lpa$(ws(t))}function _t(e){if(t.isType(e,ie))return ft(e);var n=e.iterator();if(!n.hasNext())throw new Xn("Collection is empty.");var i=n.next();if(n.hasNext())throw Mn("Collection has more than one element.");return i}function ft(t){var e;switch(t.size){case 0:throw new Xn("List is empty.");case 1:e=t.get_za3lpa$(0);break;default:throw Mn("List has more than one element.")}return e}function dt(t,e){var n;for(n=t.iterator();n.hasNext();){var i=n.next();null!=i&&e.add_11rb$(i)}return e}function mt(t,e){for(var n=ws(t);n>=1;n--){var i=e.nextInt_za3lpa$(n+1|0);t.set_wxm5ur$(i,t.set_wxm5ur$(n,t.get_za3lpa$(i)))}}function yt(e,n){var i;if(t.isType(e,ee)){if(e.size<=1)return gt(e);var r=t.isArray(i=bi(e))?i:Yr();return pi(r,n),ai(r)}var o=bt(e);return Ti(o,n),o}function $t(t,e){var n;for(n=t.iterator();n.hasNext();){var i=n.next();e.add_11rb$(i)}return e}function vt(t){return $t(t,gr(Ps(t,12)))}function gt(e){var n;if(t.isType(e,ee)){switch(e.size){case 0:n=$s();break;case 1:n=ki(t.isType(e,ie)?e.get_za3lpa$(0):e.iterator().next());break;default:n=wt(e)}return n}return xs(bt(e))}function bt(e){return t.isType(e,ee)?wt(e):$t(e,Ki())}function wt(t){return Xi(t)}function xt(e){var n;if(t.isType(e,ee)){switch(e.size){case 0:n=Dl();break;case 1:n=Ei(t.isType(e,ie)?e.get_za3lpa$(0):e.iterator().next());break;default:n=$t(e,Dr(e.size))}return n}return Bl($t(e,Rr()))}function kt(e){return t.isType(e,ee)?Ir(e):$t(e,Rr())}function Et(e,n){if(t.isType(n,ee)){var i=Wi(e.size+n.size|0);return i.addAll_brywnq$(e),i.addAll_brywnq$(n),i}var r=Xi(e);return Ws(r,n),r}function Ct(t,e,n,i,r,o,a,s){var l;void 0===n&&(n=", "),void 0===i&&(i=""),void 0===r&&(r=""),void 0===o&&(o=-1),void 0===a&&(a="..."),void 0===s&&(s=null),e.append_gw00v9$(i);var u=0;for(l=t.iterator();l.hasNext();){var c=l.next();if((u=u+1|0)>1&&e.append_gw00v9$(n),!(o<0||u<=o))break;ic(e,c,s)}return o>=0&&u>o&&e.append_gw00v9$(a),e.append_gw00v9$(r),e}function St(t,e,n,i,r,o,a){return void 0===e&&(e=", "),void 0===n&&(n=""),void 0===i&&(i=""),void 0===r&&(r=-1),void 0===o&&(o="..."),void 0===a&&(a=null),Ct(t,Qo(),e,n,i,r,o,a).toString()}function Tt(t){return new rt((e=t,function(){return e.iterator()}));var e}function Ot(t,e){return je().fromClosedRange_qt1dr2$(t,e,-1)}function Nt(t){return je().fromClosedRange_qt1dr2$(t.last,t.first,0|-t.step)}function Pt(t,e){return e<=-2147483648?Ye().EMPTY:new qe(t,e-1|0)}function At(t,e){return te?e:t}function Lt(t,e,n){if(e>n)throw Mn("Cannot coerce value to an empty range: maximum "+n+" is less than minimum "+e+".");return tn?n:t}function Rt(t){this.closure$iterator=t}function It(t,e){return new yl(t,!1,e)}function zt(t){return null==t}function Dt(e){var n;return t.isType(n=It(e,zt),nl)?n:Yr()}function Mt(e,n){if(!(n>=0))throw Mn(("Requested element count "+n+" is less than zero.").toString());return 0===n?ll():t.isType(e,El)?e.take_za3lpa$(n):new Tl(e,n)}function Bt(t,e){this.this$sortedWith=t,this.closure$comparator=e}function Ut(t,e){var n;for(n=t.iterator();n.hasNext();){var i=n.next();e.add_11rb$(i)}return e}function Ft(t){return xs(qt(t))}function qt(t){return Ut(t,Ki())}function Gt(t,e){return new vl(t,e)}function Ht(t,e,n,i){return void 0===n&&(n=1),void 0===i&&(i=!1),ql(t,e,n,i,!1)}function Yt(t,e){return cp(t,e)}function Vt(t,e,n,i,r,o,a,s){var l;void 0===n&&(n=", "),void 0===i&&(i=""),void 0===r&&(r=""),void 0===o&&(o=-1),void 0===a&&(a="..."),void 0===s&&(s=null),e.append_gw00v9$(i);var u=0;for(l=t.iterator();l.hasNext();){var c=l.next();if((u=u+1|0)>1&&e.append_gw00v9$(n),!(o<0||u<=o))break;ic(e,c,s)}return o>=0&&u>o&&e.append_gw00v9$(a),e.append_gw00v9$(r),e}function Kt(t){return new Rt((e=t,function(){return e.iterator()}));var e}function Wt(t){this.closure$iterator=t}function Xt(t,e){if(!(e>=0))throw Mn(("Requested character count "+e+" is less than zero.").toString());return t.substring(0,jt(e,t.length))}function Zt(){}function Jt(){}function Qt(){}function te(){}function ee(){}function ne(){}function ie(){}function re(){}function oe(){}function ae(){}function se(){}function le(){}function ue(){}function ce(){}function pe(){}function he(){}function _e(){}function fe(){}function de(){}function me(){}function ye(){}function $e(){}function ve(){}function ge(){}function be(){}function we(){}function xe(t,e,n){me.call(this),this.step=n,this.finalElement_0=0|e,this.hasNext_0=this.step>0?t<=e:t>=e,this.next_0=this.hasNext_0?0|t:this.finalElement_0}function ke(t,e,n){$e.call(this),this.step=n,this.finalElement_0=e,this.hasNext_0=this.step>0?t<=e:t>=e,this.next_0=this.hasNext_0?t:this.finalElement_0}function Ee(t,e,n){ve.call(this),this.step=n,this.finalElement_0=e,this.hasNext_0=this.step.toNumber()>0?t.compareTo_11rb$(e)<=0:t.compareTo_11rb$(e)>=0,this.next_0=this.hasNext_0?t:this.finalElement_0}function Ce(t,e,n){if(Oe(),0===n)throw Mn("Step must be non-zero.");if(-2147483648===n)throw Mn("Step must be greater than Int.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=h(on(0|t,0|e,n)),this.step=n}function Se(){Te=this}Rn.prototype=Object.create(T.prototype),Rn.prototype.constructor=Rn,In.prototype=Object.create(Rn.prototype),In.prototype.constructor=In,xe.prototype=Object.create(me.prototype),xe.prototype.constructor=xe,ke.prototype=Object.create($e.prototype),ke.prototype.constructor=ke,Ee.prototype=Object.create(ve.prototype),Ee.prototype.constructor=Ee,Me.prototype=Object.create(Ce.prototype),Me.prototype.constructor=Me,qe.prototype=Object.create(Ne.prototype),qe.prototype.constructor=qe,Ve.prototype=Object.create(Le.prototype),Ve.prototype.constructor=Ve,ln.prototype=Object.create(we.prototype),ln.prototype.constructor=ln,cn.prototype=Object.create(de.prototype),cn.prototype.constructor=cn,hn.prototype=Object.create(ye.prototype),hn.prototype.constructor=hn,fn.prototype=Object.create(me.prototype),fn.prototype.constructor=fn,mn.prototype=Object.create($e.prototype),mn.prototype.constructor=mn,$n.prototype=Object.create(ge.prototype),$n.prototype.constructor=$n,gn.prototype=Object.create(be.prototype),gn.prototype.constructor=gn,wn.prototype=Object.create(ve.prototype),wn.prototype.constructor=wn,jn.prototype=Object.create(T.prototype),jn.prototype.constructor=jn,Dn.prototype=Object.create(In.prototype),Dn.prototype.constructor=Dn,Bn.prototype=Object.create(In.prototype),Bn.prototype.constructor=Bn,Fn.prototype=Object.create(In.prototype),Fn.prototype.constructor=Fn,qn.prototype=Object.create(In.prototype),qn.prototype.constructor=qn,Yn.prototype=Object.create(Dn.prototype),Yn.prototype.constructor=Yn,Vn.prototype=Object.create(In.prototype),Vn.prototype.constructor=Vn,Kn.prototype=Object.create(In.prototype),Kn.prototype.constructor=Kn,Wn.prototype=Object.create(jn.prototype),Wn.prototype.constructor=Wn,Xn.prototype=Object.create(In.prototype),Xn.prototype.constructor=Xn,Jn.prototype=Object.create(In.prototype),Jn.prototype.constructor=Jn,Qn.prototype=Object.create(In.prototype),Qn.prototype.constructor=Qn,ei.prototype=Object.create(In.prototype),ei.prototype.constructor=ei,Ha.prototype=Object.create(za.prototype),Ha.prototype.constructor=Ha,Li.prototype=Object.create(za.prototype),Li.prototype.constructor=Li,zi.prototype=Object.create(Ii.prototype),zi.prototype.constructor=zi,Ri.prototype=Object.create(Li.prototype),Ri.prototype.constructor=Ri,Di.prototype=Object.create(Ri.prototype),Di.prototype.constructor=Di,Yi.prototype=Object.create(Li.prototype),Yi.prototype.constructor=Yi,Ui.prototype=Object.create(Yi.prototype),Ui.prototype.constructor=Ui,Fi.prototype=Object.create(Yi.prototype),Fi.prototype.constructor=Fi,Gi.prototype=Object.create(Li.prototype),Gi.prototype.constructor=Gi,Mi.prototype=Object.create(Ja.prototype),Mi.prototype.constructor=Mi,Vi.prototype=Object.create(Ri.prototype),Vi.prototype.constructor=Vi,hr.prototype=Object.create(Ui.prototype),hr.prototype.constructor=hr,pr.prototype=Object.create(Mi.prototype),pr.prototype.constructor=pr,yr.prototype=Object.create(Yi.prototype),yr.prototype.constructor=yr,Sr.prototype=Object.create(Bi.prototype),Sr.prototype.constructor=Sr,Tr.prototype=Object.create(Ui.prototype),Tr.prototype.constructor=Tr,Cr.prototype=Object.create(pr.prototype),Cr.prototype.constructor=Cr,Lr.prototype=Object.create(yr.prototype),Lr.prototype.constructor=Lr,Ur.prototype=Object.create(Br.prototype),Ur.prototype.constructor=Ur,Fr.prototype=Object.create(Br.prototype),Fr.prototype.constructor=Fr,qr.prototype=Object.create(Fr.prototype),qr.prototype.constructor=qr,ro.prototype=Object.create(io.prototype),ro.prototype.constructor=ro,oo.prototype=Object.create(io.prototype),oo.prototype.constructor=oo,ao.prototype=Object.create(io.prototype),ao.prototype.constructor=ao,sa.prototype=Object.create(x.prototype),sa.prototype.constructor=sa,ka.prototype=Object.create(Ha.prototype),ka.prototype.constructor=ka,Ea.prototype=Object.create(za.prototype),Ea.prototype.constructor=Ea,Da.prototype=Object.create(x.prototype),Da.prototype.constructor=Da,Ya.prototype=Object.create(Ha.prototype),Ya.prototype.constructor=Ya,Ka.prototype=Object.create(Va.prototype),Ka.prototype.constructor=Ka,as.prototype=Object.create(za.prototype),as.prototype.constructor=as,Qa.prototype=Object.create(as.prototype),Qa.prototype.constructor=Qa,es.prototype=Object.create(za.prototype),es.prototype.constructor=es,el.prototype=Object.create(Ha.prototype),el.prototype.constructor=el,al.prototype=Object.create(ol.prototype),al.prototype.constructor=al,Vl.prototype=Object.create(Ga.prototype),Vl.prototype.constructor=Vl,Yl.prototype=Object.create(Ha.prototype),Yl.prototype.constructor=Yl,Tu.prototype=Object.create(x.prototype),Tu.prototype.constructor=Tu,Lu.prototype=Object.create(ju.prototype),Lu.prototype.constructor=Lu,Yu.prototype=Object.create(ju.prototype),Yu.prototype.constructor=Yu,yc.prototype=Object.create(me.prototype),yc.prototype.constructor=yc,Hc.prototype=Object.create(x.prototype),Hc.prototype.constructor=Hc,lp.prototype=Object.create(jn.prototype),lp.prototype.constructor=lp,gp.prototype=Object.create(kp.prototype),gp.prototype.constructor=gp,Tp.prototype=Object.create(Op.prototype),Tp.prototype.constructor=Tp,Rp.prototype=Object.create(Mp.prototype),Rp.prototype.constructor=Rp,qp.prototype=Object.create(Np.prototype),qp.prototype.constructor=qp,M.prototype.iterator=function(){return this.closure$iterator()},M.$metadata$={kind:p,interfaces:[nl]},rt.prototype.iterator=function(){return this.closure$iterator()},rt.$metadata$={kind:p,interfaces:[nl]},Rt.prototype.iterator=function(){return this.closure$iterator()},Rt.$metadata$={kind:p,interfaces:[Qt]},Bt.prototype.iterator=function(){var t=qt(this.this$sortedWith);return Ti(t,this.closure$comparator),t.iterator()},Bt.$metadata$={kind:p,interfaces:[nl]},Wt.prototype.iterator=function(){return this.closure$iterator()},Wt.$metadata$={kind:p,interfaces:[nl]},Zt.$metadata$={kind:g,simpleName:"Annotation",interfaces:[]},Jt.$metadata$={kind:g,simpleName:"CharSequence",interfaces:[]},Qt.$metadata$={kind:g,simpleName:"Iterable",interfaces:[]},te.$metadata$={kind:g,simpleName:"MutableIterable",interfaces:[Qt]},ee.$metadata$={kind:g,simpleName:"Collection",interfaces:[Qt]},ne.$metadata$={kind:g,simpleName:"MutableCollection",interfaces:[te,ee]},ie.$metadata$={kind:g,simpleName:"List",interfaces:[ee]},re.$metadata$={kind:g,simpleName:"MutableList",interfaces:[ne,ie]},oe.$metadata$={kind:g,simpleName:"Set",interfaces:[ee]},ae.$metadata$={kind:g,simpleName:"MutableSet",interfaces:[ne,oe]},se.prototype.getOrDefault_xwzc9p$=function(t,e){throw new lp},le.$metadata$={kind:g,simpleName:"Entry",interfaces:[]},se.$metadata$={kind:g,simpleName:"Map",interfaces:[]},ue.prototype.remove_xwzc9p$=function(t,e){return!0},ce.$metadata$={kind:g,simpleName:"MutableEntry",interfaces:[le]},ue.$metadata$={kind:g,simpleName:"MutableMap",interfaces:[se]},pe.$metadata$={kind:g,simpleName:"Iterator",interfaces:[]},he.$metadata$={kind:g,simpleName:"MutableIterator",interfaces:[pe]},_e.$metadata$={kind:g,simpleName:"ListIterator",interfaces:[pe]},fe.$metadata$={kind:g,simpleName:"MutableListIterator",interfaces:[he,_e]},de.prototype.next=function(){return this.nextByte()},de.$metadata$={kind:p,simpleName:"ByteIterator",interfaces:[pe]},me.prototype.next=function(){return a(this.nextChar())},me.$metadata$={kind:p,simpleName:"CharIterator",interfaces:[pe]},ye.prototype.next=function(){return this.nextShort()},ye.$metadata$={kind:p,simpleName:"ShortIterator",interfaces:[pe]},$e.prototype.next=function(){return this.nextInt()},$e.$metadata$={kind:p,simpleName:"IntIterator",interfaces:[pe]},ve.prototype.next=function(){return this.nextLong()},ve.$metadata$={kind:p,simpleName:"LongIterator",interfaces:[pe]},ge.prototype.next=function(){return this.nextFloat()},ge.$metadata$={kind:p,simpleName:"FloatIterator",interfaces:[pe]},be.prototype.next=function(){return this.nextDouble()},be.$metadata$={kind:p,simpleName:"DoubleIterator",interfaces:[pe]},we.prototype.next=function(){return this.nextBoolean()},we.$metadata$={kind:p,simpleName:"BooleanIterator",interfaces:[pe]},xe.prototype.hasNext=function(){return this.hasNext_0},xe.prototype.nextChar=function(){var t=this.next_0;if(t===this.finalElement_0){if(!this.hasNext_0)throw Zn();this.hasNext_0=!1}else this.next_0=this.next_0+this.step|0;return h(t)},xe.$metadata$={kind:p,simpleName:"CharProgressionIterator",interfaces:[me]},ke.prototype.hasNext=function(){return this.hasNext_0},ke.prototype.nextInt=function(){var t=this.next_0;if(t===this.finalElement_0){if(!this.hasNext_0)throw Zn();this.hasNext_0=!1}else this.next_0=this.next_0+this.step|0;return t},ke.$metadata$={kind:p,simpleName:"IntProgressionIterator",interfaces:[$e]},Ee.prototype.hasNext=function(){return this.hasNext_0},Ee.prototype.nextLong=function(){var t=this.next_0;if(o(t,this.finalElement_0)){if(!this.hasNext_0)throw Zn();this.hasNext_0=!1}else this.next_0=this.next_0.add(this.step);return t},Ee.$metadata$={kind:p,simpleName:"LongProgressionIterator",interfaces:[ve]},Ce.prototype.iterator=function(){return new xe(this.first,this.last,this.step)},Ce.prototype.isEmpty=function(){return this.step>0?this.first>this.last:this.first0?String.fromCharCode(this.first)+".."+String.fromCharCode(this.last)+" step "+this.step:String.fromCharCode(this.first)+" downTo "+String.fromCharCode(this.last)+" step "+(0|-this.step)},Se.prototype.fromClosedRange_ayra44$=function(t,e,n){return new Ce(t,e,n)},Se.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Te=null;function Oe(){return null===Te&&new Se,Te}function Ne(t,e,n){if(je(),0===n)throw Mn("Step must be non-zero.");if(-2147483648===n)throw Mn("Step must be greater than Int.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=on(t,e,n),this.step=n}function Pe(){Ae=this}Ce.$metadata$={kind:p,simpleName:"CharProgression",interfaces:[Qt]},Ne.prototype.iterator=function(){return new ke(this.first,this.last,this.step)},Ne.prototype.isEmpty=function(){return this.step>0?this.first>this.last:this.first0?this.first.toString()+".."+this.last+" step "+this.step:this.first.toString()+" downTo "+this.last+" step "+(0|-this.step)},Pe.prototype.fromClosedRange_qt1dr2$=function(t,e,n){return new Ne(t,e,n)},Pe.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Ae=null;function je(){return null===Ae&&new Pe,Ae}function Le(t,e,n){if(ze(),o(n,u))throw Mn("Step must be non-zero.");if(o(n,m))throw Mn("Step must be greater than Long.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=an(t,e,n),this.step=n}function Re(){Ie=this}Ne.$metadata$={kind:p,simpleName:"IntProgression",interfaces:[Qt]},Le.prototype.iterator=function(){return new Ee(this.first,this.last,this.step)},Le.prototype.isEmpty=function(){return this.step.toNumber()>0?this.first.compareTo_11rb$(this.last)>0:this.first.compareTo_11rb$(this.last)<0},Le.prototype.equals=function(e){return t.isType(e,Le)&&(this.isEmpty()&&e.isEmpty()||o(this.first,e.first)&&o(this.last,e.last)&&o(this.step,e.step))},Le.prototype.hashCode=function(){return this.isEmpty()?-1:t.Long.fromInt(31).multiply(t.Long.fromInt(31).multiply(this.first.xor(this.first.shiftRightUnsigned(32))).add(this.last.xor(this.last.shiftRightUnsigned(32)))).add(this.step.xor(this.step.shiftRightUnsigned(32))).toInt()},Le.prototype.toString=function(){return this.step.toNumber()>0?this.first.toString()+".."+this.last.toString()+" step "+this.step.toString():this.first.toString()+" downTo "+this.last.toString()+" step "+this.step.unaryMinus().toString()},Re.prototype.fromClosedRange_b9bd0d$=function(t,e,n){return new Le(t,e,n)},Re.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Ie=null;function ze(){return null===Ie&&new Re,Ie}function De(){}function Me(t,e){Fe(),Ce.call(this,t,e,1)}function Be(){Ue=this,this.EMPTY=new Me(h(1),h(0))}Le.$metadata$={kind:p,simpleName:"LongProgression",interfaces:[Qt]},De.prototype.contains_mef7kx$=function(e){return t.compareTo(e,this.start)>=0&&t.compareTo(e,this.endInclusive)<=0},De.prototype.isEmpty=function(){return t.compareTo(this.start,this.endInclusive)>0},De.$metadata$={kind:g,simpleName:"ClosedRange",interfaces:[]},Object.defineProperty(Me.prototype,"start",{configurable:!0,get:function(){return a(this.first)}}),Object.defineProperty(Me.prototype,"endInclusive",{configurable:!0,get:function(){return a(this.last)}}),Me.prototype.contains_mef7kx$=function(t){return this.first<=t&&t<=this.last},Me.prototype.isEmpty=function(){return this.first>this.last},Me.prototype.equals=function(e){return t.isType(e,Me)&&(this.isEmpty()&&e.isEmpty()||this.first===e.first&&this.last===e.last)},Me.prototype.hashCode=function(){return this.isEmpty()?-1:(31*(0|this.first)|0)+(0|this.last)|0},Me.prototype.toString=function(){return String.fromCharCode(this.first)+".."+String.fromCharCode(this.last)},Be.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Ue=null;function Fe(){return null===Ue&&new Be,Ue}function qe(t,e){Ye(),Ne.call(this,t,e,1)}function Ge(){He=this,this.EMPTY=new qe(1,0)}Me.$metadata$={kind:p,simpleName:"CharRange",interfaces:[De,Ce]},Object.defineProperty(qe.prototype,"start",{configurable:!0,get:function(){return this.first}}),Object.defineProperty(qe.prototype,"endInclusive",{configurable:!0,get:function(){return this.last}}),qe.prototype.contains_mef7kx$=function(t){return this.first<=t&&t<=this.last},qe.prototype.isEmpty=function(){return this.first>this.last},qe.prototype.equals=function(e){return t.isType(e,qe)&&(this.isEmpty()&&e.isEmpty()||this.first===e.first&&this.last===e.last)},qe.prototype.hashCode=function(){return this.isEmpty()?-1:(31*this.first|0)+this.last|0},qe.prototype.toString=function(){return this.first.toString()+".."+this.last},Ge.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var He=null;function Ye(){return null===He&&new Ge,He}function Ve(t,e){Xe(),Le.call(this,t,e,w)}function Ke(){We=this,this.EMPTY=new Ve(w,u)}qe.$metadata$={kind:p,simpleName:"IntRange",interfaces:[De,Ne]},Object.defineProperty(Ve.prototype,"start",{configurable:!0,get:function(){return this.first}}),Object.defineProperty(Ve.prototype,"endInclusive",{configurable:!0,get:function(){return this.last}}),Ve.prototype.contains_mef7kx$=function(t){return this.first.compareTo_11rb$(t)<=0&&t.compareTo_11rb$(this.last)<=0},Ve.prototype.isEmpty=function(){return this.first.compareTo_11rb$(this.last)>0},Ve.prototype.equals=function(e){return t.isType(e,Ve)&&(this.isEmpty()&&e.isEmpty()||o(this.first,e.first)&&o(this.last,e.last))},Ve.prototype.hashCode=function(){return this.isEmpty()?-1:t.Long.fromInt(31).multiply(this.first.xor(this.first.shiftRightUnsigned(32))).add(this.last.xor(this.last.shiftRightUnsigned(32))).toInt()},Ve.prototype.toString=function(){return this.first.toString()+".."+this.last.toString()},Ke.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var We=null;function Xe(){return null===We&&new Ke,We}function Ze(){Je=this}Ve.$metadata$={kind:p,simpleName:"LongRange",interfaces:[De,Le]},Ze.prototype.toString=function(){return"kotlin.Unit"},Ze.$metadata$={kind:b,simpleName:"Unit",interfaces:[]};var Je=null;function Qe(){return null===Je&&new Ze,Je}function tn(t,e){var n=t%e;return n>=0?n:n+e|0}function en(t,e){var n=t.modulo(e);return n.toNumber()>=0?n:n.add(e)}function nn(t,e,n){return tn(tn(t,n)-tn(e,n)|0,n)}function rn(t,e,n){return en(en(t,n).subtract(en(e,n)),n)}function on(t,e,n){if(n>0)return t>=e?e:e-nn(e,t,n)|0;if(n<0)return t<=e?e:e+nn(t,e,0|-n)|0;throw Mn("Step is zero.")}function an(t,e,n){if(n.toNumber()>0)return t.compareTo_11rb$(e)>=0?e:e.subtract(rn(e,t,n));if(n.toNumber()<0)return t.compareTo_11rb$(e)<=0?e:e.add(rn(t,e,n.unaryMinus()));throw Mn("Step is zero.")}function sn(t){this.closure$arr=t,this.index=0}function ln(t){this.closure$array=t,we.call(this),this.index=0}function un(t){return new ln(t)}function cn(t){this.closure$array=t,de.call(this),this.index=0}function pn(t){return new cn(t)}function hn(t){this.closure$array=t,ye.call(this),this.index=0}function _n(t){return new hn(t)}function fn(t){this.closure$array=t,me.call(this),this.index=0}function dn(t){return new fn(t)}function mn(t){this.closure$array=t,$e.call(this),this.index=0}function yn(t){return new mn(t)}function $n(t){this.closure$array=t,ge.call(this),this.index=0}function vn(t){return new $n(t)}function gn(t){this.closure$array=t,be.call(this),this.index=0}function bn(t){return new gn(t)}function wn(t){this.closure$array=t,ve.call(this),this.index=0}function xn(t){return new wn(t)}function kn(t){this.c=t}function En(t){this.resultContinuation_0=t,this.state_0=0,this.exceptionState_0=0,this.result_0=null,this.exception_0=null,this.finallyPath_0=null,this.context_hxcuhl$_0=this.resultContinuation_0.context,this.intercepted__0=null}function Cn(){Sn=this}sn.prototype.hasNext=function(){return this.indexo)for(r.length=e;o=0))throw Mn(("Invalid new array size: "+e+".").toString());return ri(t,e,null)}function li(t,e,n){return Za().checkRangeIndexes_cub51b$(e,n,t.length),t.slice(e,n)}function ui(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=t.length),Za().checkRangeIndexes_cub51b$(n,i,t.length),t.fill(e,n,i)}function ci(t){t.length>1&&Qi(t)}function pi(t,e){t.length>1&&Zi(t,e)}function hi(t){var e=(t.size/2|0)-1|0;if(!(e<0))for(var n=ws(t),i=0;i<=e;i++){var r=t.get_za3lpa$(i);t.set_wxm5ur$(i,t.get_za3lpa$(n)),t.set_wxm5ur$(n,r),n=n-1|0}}function _i(){di=this,this.rangeStart_8be2vx$=new Int32Array([48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296])}On.prototype=Object.create(En.prototype),On.prototype.constructor=On,On.prototype.doResume=function(){var t;if(null!=(t=this.exception_0))throw t;return this.closure$block()},On.$metadata$={kind:p,interfaces:[En]},Object.defineProperty(jn.prototype,"message",{get:function(){return this.message_q7r8iu$_0}}),Object.defineProperty(jn.prototype,"cause",{get:function(){return this.cause_us9j0c$_0}}),jn.$metadata$={kind:p,simpleName:"Error",interfaces:[T]},Object.defineProperty(Rn.prototype,"message",{get:function(){return this.message_8yp7un$_0}}),Object.defineProperty(Rn.prototype,"cause",{get:function(){return this.cause_th0jdv$_0}}),Rn.$metadata$={kind:p,simpleName:"Exception",interfaces:[T]},In.$metadata$={kind:p,simpleName:"RuntimeException",interfaces:[Rn]},Dn.$metadata$={kind:p,simpleName:"IllegalArgumentException",interfaces:[In]},Bn.$metadata$={kind:p,simpleName:"IllegalStateException",interfaces:[In]},Fn.$metadata$={kind:p,simpleName:"IndexOutOfBoundsException",interfaces:[In]},qn.$metadata$={kind:p,simpleName:"UnsupportedOperationException",interfaces:[In]},Yn.$metadata$={kind:p,simpleName:"NumberFormatException",interfaces:[Dn]},Vn.$metadata$={kind:p,simpleName:"NullPointerException",interfaces:[In]},Kn.$metadata$={kind:p,simpleName:"ClassCastException",interfaces:[In]},Wn.$metadata$={kind:p,simpleName:"AssertionError",interfaces:[jn]},Xn.$metadata$={kind:p,simpleName:"NoSuchElementException",interfaces:[In]},Jn.$metadata$={kind:p,simpleName:"ArithmeticException",interfaces:[In]},Qn.$metadata$={kind:p,simpleName:"NoWhenBranchMatchedException",interfaces:[In]},ei.$metadata$={kind:p,simpleName:"UninitializedPropertyAccessException",interfaces:[In]},_i.$metadata$={kind:b,simpleName:"Digit",interfaces:[]};var fi,di=null;function mi(){return null===di&&new _i,di}function yi(t,e){for(var n=0,i=t.length-1|0,r=-1,o=0;n<=i;)if(e>(o=t[r=(n+i|0)/2|0]))n=r+1|0;else{if(e===o)return r;i=r-1|0}return r-(e4096&&(5760===e||8192<=e&&e<=8202||8232===e||8233===e||8239===e||8287===e||12288===e)}function gi(t){this.function$=t}function bi(t){return void 0!==t.toArray?t.toArray():wi(t)}function wi(t){for(var e=[],n=t.iterator();n.hasNext();)e.push(n.next());return e}function xi(t,e){var n;if(e.length=0;l--)e[n+l|0]=t[i+l|0]}function Pi(t){return t<0&&Es(),t}function Ai(t){return t<0&&Cs(),t}function ji(t){return t}function Li(){za.call(this)}function Ri(){Li.call(this),this.modCount=0}function Ii(t){this.$outer=t,this.index_0=0,this.last_0=-1}function zi(t,e){this.$outer=t,Ii.call(this,this.$outer),Za().checkPositionIndex_6xvm5r$(e,this.$outer.size),this.index_0=e}function Di(t,e,n){Ri.call(this),this.list_0=t,this.fromIndex_0=e,this._size_0=0,Za().checkRangeIndexes_cub51b$(this.fromIndex_0,n,this.list_0.size),this._size_0=n-this.fromIndex_0|0}function Mi(){Ja.call(this),this._keys_qe2m0n$_0=null,this._values_kxdlqh$_0=null}function Bi(t,e){this.key_5xhq3d$_0=t,this._value_0=e}function Ui(){Yi.call(this)}function Fi(t){this.this$AbstractMutableMap=t,Yi.call(this)}function qi(t){this.closure$entryIterator=t}function Gi(t){this.this$AbstractMutableMap=t,Li.call(this)}function Hi(t){this.closure$entryIterator=t}function Yi(){Li.call(this)}function Vi(t){Ri.call(this),this.array_hd7ov6$_0=t,this.isReadOnly_dbt2oh$_0=!1}function Ki(t){return t=t||Object.create(Vi.prototype),Vi.call(t,[]),t}function Wi(t,e){return void 0===t&&(t=0),e=e||Object.create(Vi.prototype),Vi.call(e,[]),e}function Xi(t,e){return e=e||Object.create(Vi.prototype),Vi.call(e,bi(t)),e}function Zi(t,e){if(er()){var n=(i=e,function(t,e){return i.compare(t,e)});t.sort(n)}else nr(t,0,X(t),e);var i}function Ji(e,n){return t.compareTo(e,n)}function Qi(t){if(er()){var e=Ji;t.sort(e)}else nr(t,0,X(t),Xl())}function tr(t,e){return(3&t)-(3&e)|0}function er(){if(null!=fi)return fi;fi=!1;for(var t=[],e=0;e<600;e++)t.push(e);var n=tr;t.sort(n);for(var i=1;i=o)return!1}return fi=!0,!0}function nr(e,n,i,r){var o=ir(e,t.newArray(e.length,null),n,i,r);if(o!==e)for(var a=n;a<=i;a++)e[a]=o[a]}function ir(t,e,n,i,r){if(n===i)return t;for(var o=(n+i|0)/2|0,a=ir(t,e,n,o,r),s=ir(t,e,o+1|0,i,r),l=a===e?t:e,u=n,c=o+1|0,p=n;p<=i;p++)if(u<=o&&c<=i){var h=a[u],_=s[c];r.compare(h,_)<=0?(l[p]=h,u=u+1|0):(l[p]=_,c=c+1|0)}else u<=o?(l[p]=a[u],u=u+1|0):(l[p]=s[c],c=c+1|0);return l}function rr(){}function or(){ur=this}gi.prototype.compare=function(t,e){return this.function$(t,e)},gi.$metadata$={kind:g,simpleName:"Comparator",interfaces:[]},Li.prototype.remove_11rb$=function(t){this.checkIsMutable();for(var e=this.iterator();e.hasNext();)if(o(e.next(),t))return e.remove(),!0;return!1},Li.prototype.addAll_brywnq$=function(t){var e;this.checkIsMutable();var n=!1;for(e=t.iterator();e.hasNext();){var i=e.next();this.add_11rb$(i)&&(n=!0)}return n},Li.prototype.removeAll_brywnq$=function(e){var n;return this.checkIsMutable(),Js(t.isType(this,te)?this:Yr(),(n=e,function(t){return n.contains_11rb$(t)}))},Li.prototype.retainAll_brywnq$=function(e){var n;return this.checkIsMutable(),Js(t.isType(this,te)?this:Yr(),(n=e,function(t){return!n.contains_11rb$(t)}))},Li.prototype.clear=function(){this.checkIsMutable();for(var t=this.iterator();t.hasNext();)t.next(),t.remove()},Li.prototype.toJSON=function(){return this.toArray()},Li.prototype.checkIsMutable=function(){},Li.$metadata$={kind:p,simpleName:"AbstractMutableCollection",interfaces:[ne,za]},Ri.prototype.add_11rb$=function(t){return this.checkIsMutable(),this.add_wxm5ur$(this.size,t),!0},Ri.prototype.addAll_u57x28$=function(t,e){var n,i;this.checkIsMutable();var r=t,o=!1;for(n=e.iterator();n.hasNext();){var a=n.next();this.add_wxm5ur$((r=(i=r)+1|0,i),a),o=!0}return o},Ri.prototype.clear=function(){this.checkIsMutable(),this.removeRange_vux9f0$(0,this.size)},Ri.prototype.removeAll_brywnq$=function(t){return this.checkIsMutable(),tl(this,(e=t,function(t){return e.contains_11rb$(t)}));var e},Ri.prototype.retainAll_brywnq$=function(t){return this.checkIsMutable(),tl(this,(e=t,function(t){return!e.contains_11rb$(t)}));var e},Ri.prototype.iterator=function(){return new Ii(this)},Ri.prototype.contains_11rb$=function(t){return this.indexOf_11rb$(t)>=0},Ri.prototype.indexOf_11rb$=function(t){var e;e=ws(this);for(var n=0;n<=e;n++)if(o(this.get_za3lpa$(n),t))return n;return-1},Ri.prototype.lastIndexOf_11rb$=function(t){for(var e=ws(this);e>=0;e--)if(o(this.get_za3lpa$(e),t))return e;return-1},Ri.prototype.listIterator=function(){return this.listIterator_za3lpa$(0)},Ri.prototype.listIterator_za3lpa$=function(t){return new zi(this,t)},Ri.prototype.subList_vux9f0$=function(t,e){return new Di(this,t,e)},Ri.prototype.removeRange_vux9f0$=function(t,e){for(var n=this.listIterator_za3lpa$(t),i=e-t|0,r=0;r0},zi.prototype.nextIndex=function(){return this.index_0},zi.prototype.previous=function(){if(!this.hasPrevious())throw Zn();return this.last_0=(this.index_0=this.index_0-1|0,this.index_0),this.$outer.get_za3lpa$(this.last_0)},zi.prototype.previousIndex=function(){return this.index_0-1|0},zi.prototype.add_11rb$=function(t){this.$outer.add_wxm5ur$(this.index_0,t),this.index_0=this.index_0+1|0,this.last_0=-1},zi.prototype.set_11rb$=function(t){if(-1===this.last_0)throw Un("Call next() or previous() before updating element value with the iterator.".toString());this.$outer.set_wxm5ur$(this.last_0,t)},zi.$metadata$={kind:p,simpleName:"ListIteratorImpl",interfaces:[fe,Ii]},Di.prototype.add_wxm5ur$=function(t,e){Za().checkPositionIndex_6xvm5r$(t,this._size_0),this.list_0.add_wxm5ur$(this.fromIndex_0+t|0,e),this._size_0=this._size_0+1|0},Di.prototype.get_za3lpa$=function(t){return Za().checkElementIndex_6xvm5r$(t,this._size_0),this.list_0.get_za3lpa$(this.fromIndex_0+t|0)},Di.prototype.removeAt_za3lpa$=function(t){Za().checkElementIndex_6xvm5r$(t,this._size_0);var e=this.list_0.removeAt_za3lpa$(this.fromIndex_0+t|0);return this._size_0=this._size_0-1|0,e},Di.prototype.set_wxm5ur$=function(t,e){return Za().checkElementIndex_6xvm5r$(t,this._size_0),this.list_0.set_wxm5ur$(this.fromIndex_0+t|0,e)},Object.defineProperty(Di.prototype,"size",{configurable:!0,get:function(){return this._size_0}}),Di.prototype.checkIsMutable=function(){this.list_0.checkIsMutable()},Di.$metadata$={kind:p,simpleName:"SubList",interfaces:[Mr,Ri]},Ri.$metadata$={kind:p,simpleName:"AbstractMutableList",interfaces:[re,Li]},Object.defineProperty(Bi.prototype,"key",{get:function(){return this.key_5xhq3d$_0}}),Object.defineProperty(Bi.prototype,"value",{configurable:!0,get:function(){return this._value_0}}),Bi.prototype.setValue_11rc$=function(t){var e=this._value_0;return this._value_0=t,e},Bi.prototype.hashCode=function(){return os().entryHashCode_9fthdn$(this)},Bi.prototype.toString=function(){return os().entryToString_9fthdn$(this)},Bi.prototype.equals=function(t){return os().entryEquals_js7fox$(this,t)},Bi.$metadata$={kind:p,simpleName:"SimpleEntry",interfaces:[ce]},Ui.prototype.contains_11rb$=function(t){return this.containsEntry_kw6fkd$(t)},Ui.prototype.remove_11rb$=function(t){return this.removeEntry_kw6fkd$(t)},Ui.$metadata$={kind:p,simpleName:"AbstractEntrySet",interfaces:[Yi]},Mi.prototype.clear=function(){this.entries.clear()},Fi.prototype.add_11rb$=function(t){throw Hn("Add is not supported on keys")},Fi.prototype.clear=function(){this.this$AbstractMutableMap.clear()},Fi.prototype.contains_11rb$=function(t){return this.this$AbstractMutableMap.containsKey_11rb$(t)},qi.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},qi.prototype.next=function(){return this.closure$entryIterator.next().key},qi.prototype.remove=function(){this.closure$entryIterator.remove()},qi.$metadata$={kind:p,interfaces:[he]},Fi.prototype.iterator=function(){return new qi(this.this$AbstractMutableMap.entries.iterator())},Fi.prototype.remove_11rb$=function(t){return this.checkIsMutable(),!!this.this$AbstractMutableMap.containsKey_11rb$(t)&&(this.this$AbstractMutableMap.remove_11rb$(t),!0)},Object.defineProperty(Fi.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMutableMap.size}}),Fi.prototype.checkIsMutable=function(){this.this$AbstractMutableMap.checkIsMutable()},Fi.$metadata$={kind:p,interfaces:[Yi]},Object.defineProperty(Mi.prototype,"keys",{configurable:!0,get:function(){return null==this._keys_qe2m0n$_0&&(this._keys_qe2m0n$_0=new Fi(this)),E(this._keys_qe2m0n$_0)}}),Mi.prototype.putAll_a2k3zr$=function(t){var e;for(this.checkIsMutable(),e=t.entries.iterator();e.hasNext();){var n=e.next(),i=n.key,r=n.value;this.put_xwzc9p$(i,r)}},Gi.prototype.add_11rb$=function(t){throw Hn("Add is not supported on values")},Gi.prototype.clear=function(){this.this$AbstractMutableMap.clear()},Gi.prototype.contains_11rb$=function(t){return this.this$AbstractMutableMap.containsValue_11rc$(t)},Hi.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},Hi.prototype.next=function(){return this.closure$entryIterator.next().value},Hi.prototype.remove=function(){this.closure$entryIterator.remove()},Hi.$metadata$={kind:p,interfaces:[he]},Gi.prototype.iterator=function(){return new Hi(this.this$AbstractMutableMap.entries.iterator())},Object.defineProperty(Gi.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMutableMap.size}}),Gi.prototype.equals=function(e){return this===e||!!t.isType(e,ee)&&Za().orderedEquals_e92ka7$(this,e)},Gi.prototype.hashCode=function(){return Za().orderedHashCode_nykoif$(this)},Gi.prototype.checkIsMutable=function(){this.this$AbstractMutableMap.checkIsMutable()},Gi.$metadata$={kind:p,interfaces:[Li]},Object.defineProperty(Mi.prototype,"values",{configurable:!0,get:function(){return null==this._values_kxdlqh$_0&&(this._values_kxdlqh$_0=new Gi(this)),E(this._values_kxdlqh$_0)}}),Mi.prototype.remove_11rb$=function(t){this.checkIsMutable();for(var e=this.entries.iterator();e.hasNext();){var n=e.next(),i=n.key;if(o(t,i)){var r=n.value;return e.remove(),r}}return null},Mi.prototype.checkIsMutable=function(){},Mi.$metadata$={kind:p,simpleName:"AbstractMutableMap",interfaces:[ue,Ja]},Yi.prototype.equals=function(e){return e===this||!!t.isType(e,oe)&&us().setEquals_y8f7en$(this,e)},Yi.prototype.hashCode=function(){return us().unorderedHashCode_nykoif$(this)},Yi.$metadata$={kind:p,simpleName:"AbstractMutableSet",interfaces:[ae,Li]},Vi.prototype.build=function(){return this.checkIsMutable(),this.isReadOnly_dbt2oh$_0=!0,this},Vi.prototype.trimToSize=function(){},Vi.prototype.ensureCapacity_za3lpa$=function(t){},Object.defineProperty(Vi.prototype,"size",{configurable:!0,get:function(){return this.array_hd7ov6$_0.length}}),Vi.prototype.get_za3lpa$=function(e){var n;return null==(n=this.array_hd7ov6$_0[this.rangeCheck_xcmk5o$_0(e)])||t.isType(n,C)?n:Yr()},Vi.prototype.set_wxm5ur$=function(e,n){var i;this.checkIsMutable(),this.rangeCheck_xcmk5o$_0(e);var r=this.array_hd7ov6$_0[e];return this.array_hd7ov6$_0[e]=n,null==(i=r)||t.isType(i,C)?i:Yr()},Vi.prototype.add_11rb$=function(t){return this.checkIsMutable(),this.array_hd7ov6$_0.push(t),this.modCount=this.modCount+1|0,!0},Vi.prototype.add_wxm5ur$=function(t,e){this.checkIsMutable(),this.array_hd7ov6$_0.splice(this.insertionRangeCheck_xwivfl$_0(t),0,e),this.modCount=this.modCount+1|0},Vi.prototype.addAll_brywnq$=function(t){return this.checkIsMutable(),!t.isEmpty()&&(this.array_hd7ov6$_0=this.array_hd7ov6$_0.concat(bi(t)),this.modCount=this.modCount+1|0,!0)},Vi.prototype.addAll_u57x28$=function(t,e){return this.checkIsMutable(),this.insertionRangeCheck_xwivfl$_0(t),t===this.size?this.addAll_brywnq$(e):!e.isEmpty()&&(t===this.size?this.addAll_brywnq$(e):(this.array_hd7ov6$_0=0===t?bi(e).concat(this.array_hd7ov6$_0):li(this.array_hd7ov6$_0,0,t).concat(bi(e),li(this.array_hd7ov6$_0,t,this.size)),this.modCount=this.modCount+1|0,!0))},Vi.prototype.removeAt_za3lpa$=function(t){return this.checkIsMutable(),this.rangeCheck_xcmk5o$_0(t),this.modCount=this.modCount+1|0,t===ws(this)?this.array_hd7ov6$_0.pop():this.array_hd7ov6$_0.splice(t,1)[0]},Vi.prototype.remove_11rb$=function(t){var e;this.checkIsMutable(),e=this.array_hd7ov6$_0;for(var n=0;n!==e.length;++n)if(o(this.array_hd7ov6$_0[n],t))return this.array_hd7ov6$_0.splice(n,1),this.modCount=this.modCount+1|0,!0;return!1},Vi.prototype.removeRange_vux9f0$=function(t,e){this.checkIsMutable(),this.modCount=this.modCount+1|0,this.array_hd7ov6$_0.splice(t,e-t|0)},Vi.prototype.clear=function(){this.checkIsMutable(),this.array_hd7ov6$_0=[],this.modCount=this.modCount+1|0},Vi.prototype.indexOf_11rb$=function(t){return F(this.array_hd7ov6$_0,t)},Vi.prototype.lastIndexOf_11rb$=function(t){return G(this.array_hd7ov6$_0,t)},Vi.prototype.toString=function(){return O(this.array_hd7ov6$_0)},Vi.prototype.toArray_ro6dgy$=function(e){var n,i;if(e.lengththis.size&&(e[this.size]=null==null||t.isType(null,C)?null:Yr()),e},Vi.prototype.toArray=function(){return[].slice.call(this.array_hd7ov6$_0)},Vi.prototype.checkIsMutable=function(){if(this.isReadOnly_dbt2oh$_0)throw Gn()},Vi.prototype.rangeCheck_xcmk5o$_0=function(t){return Za().checkElementIndex_6xvm5r$(t,this.size),t},Vi.prototype.insertionRangeCheck_xwivfl$_0=function(t){return Za().checkPositionIndex_6xvm5r$(t,this.size),t},Vi.$metadata$={kind:p,simpleName:"ArrayList",interfaces:[Mr,Ri,re]},or.prototype.equals_oaftn8$=function(t,e){return o(t,e)},or.prototype.getHashCode_s8jyv4$=function(t){var e;return null!=(e=null!=t?N(t):null)?e:0},or.$metadata$={kind:b,simpleName:"HashCode",interfaces:[rr]};var ar,sr,lr,ur=null;function cr(){return null===ur&&new or,ur}function pr(){this.internalMap_uxhen5$_0=null,this.equality_vgh6cm$_0=null,this._entries_7ih87x$_0=null}function hr(t){this.$outer=t,Ui.call(this)}function _r(t,e){return e=e||Object.create(pr.prototype),Mi.call(e),pr.call(e),e.internalMap_uxhen5$_0=t,e.equality_vgh6cm$_0=t.equality,e}function fr(t){return t=t||Object.create(pr.prototype),_r(new wr(cr()),t),t}function dr(t,e,n){if(void 0===e&&(e=0),fr(n=n||Object.create(pr.prototype)),!(t>=0))throw Mn(("Negative initial capacity: "+t).toString());if(!(e>=0))throw Mn(("Non-positive load factor: "+e).toString());return n}function mr(t,e){return dr(t,0,e=e||Object.create(pr.prototype)),e}function yr(){this.map_8be2vx$=null}function $r(t){return t=t||Object.create(yr.prototype),Yi.call(t),yr.call(t),t.map_8be2vx$=fr(),t}function vr(t,e,n){return void 0===e&&(e=0),n=n||Object.create(yr.prototype),Yi.call(n),yr.call(n),n.map_8be2vx$=dr(t,e),n}function gr(t,e){return vr(t,0,e=e||Object.create(yr.prototype)),e}function br(t,e){return e=e||Object.create(yr.prototype),Yi.call(e),yr.call(e),e.map_8be2vx$=t,e}function wr(t){this.equality_mamlu8$_0=t,this.backingMap_0=this.createJsMap(),this.size_x3bm7r$_0=0}function xr(t){this.this$InternalHashCodeMap=t,this.state=-1,this.keys=Object.keys(t.backingMap_0),this.keyIndex=-1,this.chainOrEntry=null,this.isChain=!1,this.itemIndex=-1,this.lastEntry=null}function kr(){}function Er(t){this.equality_qma612$_0=t,this.backingMap_0=this.createJsMap(),this.size_6u3ykz$_0=0}function Cr(){this.head_1lr44l$_0=null,this.map_97q5dv$_0=null,this.isReadOnly_uhyvn5$_0=!1}function Sr(t,e,n){this.$outer=t,Bi.call(this,e,n),this.next_8be2vx$=null,this.prev_8be2vx$=null}function Tr(t){this.$outer=t,Ui.call(this)}function Or(t){this.$outer=t,this.last_0=null,this.next_0=null,this.next_0=this.$outer.$outer.head_1lr44l$_0}function Nr(t){return fr(t=t||Object.create(Cr.prototype)),Cr.call(t),t.map_97q5dv$_0=fr(),t}function Pr(t,e,n){return void 0===e&&(e=0),dr(t,e,n=n||Object.create(Cr.prototype)),Cr.call(n),n.map_97q5dv$_0=fr(),n}function Ar(t,e){return Pr(t,0,e=e||Object.create(Cr.prototype)),e}function jr(t,e){return fr(e=e||Object.create(Cr.prototype)),Cr.call(e),e.map_97q5dv$_0=fr(),e.putAll_a2k3zr$(t),e}function Lr(){}function Rr(t){return t=t||Object.create(Lr.prototype),br(Nr(),t),Lr.call(t),t}function Ir(t,e){return e=e||Object.create(Lr.prototype),br(Nr(),e),Lr.call(e),e.addAll_brywnq$(t),e}function zr(t,e,n){return void 0===e&&(e=0),n=n||Object.create(Lr.prototype),br(Pr(t,e),n),Lr.call(n),n}function Dr(t,e){return zr(t,0,e=e||Object.create(Lr.prototype)),e}function Mr(){}function Br(){}function Ur(t){Br.call(this),this.outputStream=t}function Fr(){Br.call(this),this.buffer=""}function qr(){Fr.call(this)}function Gr(t,e){this.delegate_0=t,this.result_0=e}function Hr(t,e){this.closure$context=t,this.closure$resumeWith=e}function Yr(){throw new Kn("Illegal cast")}function Vr(t){throw Un(t)}function Kr(){}function Wr(e){if(Xr(e)||e===l.NEGATIVE_INFINITY)return e;if(0===e)return-l.MIN_VALUE;var n=P(e).add(t.Long.fromInt(e>0?-1:1));return t.doubleFromBits(n)}function Xr(t){return t!=t}function Zr(t){return t===l.POSITIVE_INFINITY||t===l.NEGATIVE_INFINITY}function Jr(t){return!Zr(t)&&!Xr(t)}function Qr(){return Mu(Math.random()*Math.pow(2,32)|0)}function to(t,e){return t*sr+e*lr}function eo(){}function no(){}function io(t){this.jClass_1ppatx$_0=t}function ro(t){var e;io.call(this,t),this.simpleName_m7mxi0$_0=null!=(e=t.$metadata$)?e.simpleName:null}function oo(t,e,n){io.call(this,t),this.givenSimpleName_0=e,this.isInstanceFunction_0=n}function ao(){so=this,io.call(this,Object),this.simpleName_lnzy73$_0="Nothing"}rr.$metadata$={kind:g,simpleName:"EqualityComparator",interfaces:[]},hr.prototype.add_11rb$=function(t){throw Hn("Add is not supported on entries")},hr.prototype.clear=function(){this.$outer.clear()},hr.prototype.containsEntry_kw6fkd$=function(t){return this.$outer.containsEntry_8hxqw4$(t)},hr.prototype.iterator=function(){return this.$outer.internalMap_uxhen5$_0.iterator()},hr.prototype.removeEntry_kw6fkd$=function(t){return!!ot(this,t)&&(this.$outer.remove_11rb$(t.key),!0)},Object.defineProperty(hr.prototype,"size",{configurable:!0,get:function(){return this.$outer.size}}),hr.$metadata$={kind:p,simpleName:"EntrySet",interfaces:[Ui]},pr.prototype.clear=function(){this.internalMap_uxhen5$_0.clear()},pr.prototype.containsKey_11rb$=function(t){return this.internalMap_uxhen5$_0.contains_11rb$(t)},pr.prototype.containsValue_11rc$=function(e){var n,i=this.internalMap_uxhen5$_0;t:do{var r;if(t.isType(i,ee)&&i.isEmpty()){n=!1;break t}for(r=i.iterator();r.hasNext();){var o=r.next();if(this.equality_vgh6cm$_0.equals_oaftn8$(o.value,e)){n=!0;break t}}n=!1}while(0);return n},Object.defineProperty(pr.prototype,"entries",{configurable:!0,get:function(){return null==this._entries_7ih87x$_0&&(this._entries_7ih87x$_0=this.createEntrySet()),E(this._entries_7ih87x$_0)}}),pr.prototype.createEntrySet=function(){return new hr(this)},pr.prototype.get_11rb$=function(t){return this.internalMap_uxhen5$_0.get_11rb$(t)},pr.prototype.put_xwzc9p$=function(t,e){return this.internalMap_uxhen5$_0.put_xwzc9p$(t,e)},pr.prototype.remove_11rb$=function(t){return this.internalMap_uxhen5$_0.remove_11rb$(t)},Object.defineProperty(pr.prototype,"size",{configurable:!0,get:function(){return this.internalMap_uxhen5$_0.size}}),pr.$metadata$={kind:p,simpleName:"HashMap",interfaces:[Mi,ue]},yr.prototype.add_11rb$=function(t){return null==this.map_8be2vx$.put_xwzc9p$(t,this)},yr.prototype.clear=function(){this.map_8be2vx$.clear()},yr.prototype.contains_11rb$=function(t){return this.map_8be2vx$.containsKey_11rb$(t)},yr.prototype.isEmpty=function(){return this.map_8be2vx$.isEmpty()},yr.prototype.iterator=function(){return this.map_8be2vx$.keys.iterator()},yr.prototype.remove_11rb$=function(t){return null!=this.map_8be2vx$.remove_11rb$(t)},Object.defineProperty(yr.prototype,"size",{configurable:!0,get:function(){return this.map_8be2vx$.size}}),yr.$metadata$={kind:p,simpleName:"HashSet",interfaces:[Yi,ae]},Object.defineProperty(wr.prototype,"equality",{get:function(){return this.equality_mamlu8$_0}}),Object.defineProperty(wr.prototype,"size",{configurable:!0,get:function(){return this.size_x3bm7r$_0},set:function(t){this.size_x3bm7r$_0=t}}),wr.prototype.put_xwzc9p$=function(e,n){var i=this.equality.getHashCode_s8jyv4$(e),r=this.getChainOrEntryOrNull_0(i);if(null==r)this.backingMap_0[i]=new Bi(e,n);else{if(!t.isArray(r)){var o=r;return this.equality.equals_oaftn8$(o.key,e)?o.setValue_11rc$(n):(this.backingMap_0[i]=[o,new Bi(e,n)],this.size=this.size+1|0,null)}var a=r,s=this.findEntryInChain_0(a,e);if(null!=s)return s.setValue_11rc$(n);a.push(new Bi(e,n))}return this.size=this.size+1|0,null},wr.prototype.remove_11rb$=function(e){var n,i=this.equality.getHashCode_s8jyv4$(e);if(null==(n=this.getChainOrEntryOrNull_0(i)))return null;var r=n;if(!t.isArray(r)){var o=r;return this.equality.equals_oaftn8$(o.key,e)?(delete this.backingMap_0[i],this.size=this.size-1|0,o.value):null}for(var a=r,s=0;s!==a.length;++s){var l=a[s];if(this.equality.equals_oaftn8$(e,l.key))return 1===a.length?(a.length=0,delete this.backingMap_0[i]):a.splice(s,1),this.size=this.size-1|0,l.value}return null},wr.prototype.clear=function(){this.backingMap_0=this.createJsMap(),this.size=0},wr.prototype.contains_11rb$=function(t){return null!=this.getEntry_0(t)},wr.prototype.get_11rb$=function(t){var e;return null!=(e=this.getEntry_0(t))?e.value:null},wr.prototype.getEntry_0=function(e){var n;if(null==(n=this.getChainOrEntryOrNull_0(this.equality.getHashCode_s8jyv4$(e))))return null;var i=n;if(t.isArray(i)){var r=i;return this.findEntryInChain_0(r,e)}var o=i;return this.equality.equals_oaftn8$(o.key,e)?o:null},wr.prototype.findEntryInChain_0=function(t,e){var n;t:do{var i;for(i=0;i!==t.length;++i){var r=t[i];if(this.equality.equals_oaftn8$(r.key,e)){n=r;break t}}n=null}while(0);return n},xr.prototype.computeNext_0=function(){if(null!=this.chainOrEntry&&this.isChain){var e=this.chainOrEntry.length;if(this.itemIndex=this.itemIndex+1|0,this.itemIndex=0&&(this.buffer=this.buffer+e.substring(0,n),this.flush(),e=e.substring(n+1|0)),this.buffer=this.buffer+e},qr.prototype.flush=function(){console.log(this.buffer),this.buffer=""},qr.$metadata$={kind:p,simpleName:"BufferedOutputToConsoleLog",interfaces:[Fr]},Object.defineProperty(Gr.prototype,"context",{configurable:!0,get:function(){return this.delegate_0.context}}),Gr.prototype.resumeWith_tl1gpc$=function(t){var e=this.result_0;if(e===Pu())this.result_0=t.value;else{if(e!==Su())throw Un("Already resumed");this.result_0=Au(),this.delegate_0.resumeWith_tl1gpc$(t)}},Gr.prototype.getOrThrow=function(){var e;if(this.result_0===Pu())return this.result_0=Su(),Su();var n=this.result_0;if(n===Au())e=Su();else{if(t.isType(n,op))throw n.exception;e=n}return e},Gr.$metadata$={kind:p,simpleName:"SafeContinuation",interfaces:[ou]},Object.defineProperty(Hr.prototype,"context",{configurable:!0,get:function(){return this.closure$context}}),Hr.prototype.resumeWith_tl1gpc$=function(t){this.closure$resumeWith(t)},Hr.$metadata$={kind:p,interfaces:[ou]},Kr.$metadata$={kind:g,simpleName:"Serializable",interfaces:[]},eo.$metadata$={kind:g,simpleName:"KCallable",interfaces:[]},no.$metadata$={kind:g,simpleName:"KClass",interfaces:[nc]},Object.defineProperty(io.prototype,"jClass",{get:function(){return this.jClass_1ppatx$_0}}),Object.defineProperty(io.prototype,"qualifiedName",{configurable:!0,get:function(){throw new lp}}),io.prototype.equals=function(e){return t.isType(e,io)&&o(this.jClass,e.jClass)},io.prototype.hashCode=function(){var t,e;return null!=(e=null!=(t=this.simpleName)?N(t):null)?e:0},io.prototype.toString=function(){return"class "+$(this.simpleName)},io.$metadata$={kind:p,simpleName:"KClassImpl",interfaces:[no]},Object.defineProperty(ro.prototype,"simpleName",{configurable:!0,get:function(){return this.simpleName_m7mxi0$_0}}),ro.prototype.isInstance_s8jyv4$=function(e){var n=this.jClass;return t.isType(e,n)},ro.$metadata$={kind:p,simpleName:"SimpleKClassImpl",interfaces:[io]},oo.prototype.equals=function(e){return!!t.isType(e,oo)&&io.prototype.equals.call(this,e)&&o(this.givenSimpleName_0,e.givenSimpleName_0)},Object.defineProperty(oo.prototype,"simpleName",{configurable:!0,get:function(){return this.givenSimpleName_0}}),oo.prototype.isInstance_s8jyv4$=function(t){return this.isInstanceFunction_0(t)},oo.$metadata$={kind:p,simpleName:"PrimitiveKClassImpl",interfaces:[io]},Object.defineProperty(ao.prototype,"simpleName",{configurable:!0,get:function(){return this.simpleName_lnzy73$_0}}),ao.prototype.isInstance_s8jyv4$=function(t){return!1},Object.defineProperty(ao.prototype,"jClass",{configurable:!0,get:function(){throw Hn("There's no native JS class for Nothing type")}}),ao.prototype.equals=function(t){return t===this},ao.prototype.hashCode=function(){return 0},ao.$metadata$={kind:b,simpleName:"NothingKClassImpl",interfaces:[io]};var so=null;function lo(){return null===so&&new ao,so}function uo(){}function co(){}function po(){}function ho(){}function _o(){}function fo(){}function mo(){}function yo(){}function $o(t,e,n){this.classifier_50lv52$_0=t,this.arguments_lev63t$_0=e,this.isMarkedNullable_748rxs$_0=n}function vo(e){switch(e.name){case"INVARIANT":return"";case"IN":return"in ";case"OUT":return"out ";default:return t.noWhenBranchMatched()}}function go(){qo=this,this.anyClass=new oo(Object,"Any",bo),this.numberClass=new oo(Number,"Number",wo),this.nothingClass=lo(),this.booleanClass=new oo(Boolean,"Boolean",xo),this.byteClass=new oo(Number,"Byte",ko),this.shortClass=new oo(Number,"Short",Eo),this.intClass=new oo(Number,"Int",Co),this.floatClass=new oo(Number,"Float",So),this.doubleClass=new oo(Number,"Double",To),this.arrayClass=new oo(Array,"Array",Oo),this.stringClass=new oo(String,"String",No),this.throwableClass=new oo(Error,"Throwable",Po),this.booleanArrayClass=new oo(Array,"BooleanArray",Ao),this.charArrayClass=new oo(Uint16Array,"CharArray",jo),this.byteArrayClass=new oo(Int8Array,"ByteArray",Lo),this.shortArrayClass=new oo(Int16Array,"ShortArray",Ro),this.intArrayClass=new oo(Int32Array,"IntArray",Io),this.longArrayClass=new oo(Array,"LongArray",zo),this.floatArrayClass=new oo(Float32Array,"FloatArray",Do),this.doubleArrayClass=new oo(Float64Array,"DoubleArray",Mo)}function bo(e){return t.isType(e,C)}function wo(e){return t.isNumber(e)}function xo(t){return"boolean"==typeof t}function ko(t){return"number"==typeof t}function Eo(t){return"number"==typeof t}function Co(t){return"number"==typeof t}function So(t){return"number"==typeof t}function To(t){return"number"==typeof t}function Oo(e){return t.isArray(e)}function No(t){return"string"==typeof t}function Po(e){return t.isType(e,T)}function Ao(e){return t.isBooleanArray(e)}function jo(e){return t.isCharArray(e)}function Lo(e){return t.isByteArray(e)}function Ro(e){return t.isShortArray(e)}function Io(e){return t.isIntArray(e)}function zo(e){return t.isLongArray(e)}function Do(e){return t.isFloatArray(e)}function Mo(e){return t.isDoubleArray(e)}Object.defineProperty(uo.prototype,"simpleName",{configurable:!0,get:function(){throw Un("Unknown simpleName for ErrorKClass".toString())}}),Object.defineProperty(uo.prototype,"qualifiedName",{configurable:!0,get:function(){throw Un("Unknown qualifiedName for ErrorKClass".toString())}}),uo.prototype.isInstance_s8jyv4$=function(t){throw Un("Can's check isInstance on ErrorKClass".toString())},uo.prototype.equals=function(t){return t===this},uo.prototype.hashCode=function(){return 0},uo.$metadata$={kind:p,simpleName:"ErrorKClass",interfaces:[no]},co.$metadata$={kind:g,simpleName:"KProperty",interfaces:[eo]},po.$metadata$={kind:g,simpleName:"KMutableProperty",interfaces:[co]},ho.$metadata$={kind:g,simpleName:"KProperty0",interfaces:[co]},_o.$metadata$={kind:g,simpleName:"KMutableProperty0",interfaces:[po,ho]},fo.$metadata$={kind:g,simpleName:"KProperty1",interfaces:[co]},mo.$metadata$={kind:g,simpleName:"KMutableProperty1",interfaces:[po,fo]},yo.$metadata$={kind:g,simpleName:"KType",interfaces:[]},Object.defineProperty($o.prototype,"classifier",{get:function(){return this.classifier_50lv52$_0}}),Object.defineProperty($o.prototype,"arguments",{get:function(){return this.arguments_lev63t$_0}}),Object.defineProperty($o.prototype,"isMarkedNullable",{get:function(){return this.isMarkedNullable_748rxs$_0}}),$o.prototype.equals=function(e){return t.isType(e,$o)&&o(this.classifier,e.classifier)&&o(this.arguments,e.arguments)&&this.isMarkedNullable===e.isMarkedNullable},$o.prototype.hashCode=function(){return(31*((31*N(this.classifier)|0)+N(this.arguments)|0)|0)+N(this.isMarkedNullable)|0},$o.prototype.toString=function(){var e,n,i=t.isType(e=this.classifier,no)?e:null;return(null==i?this.classifier.toString():null!=i.simpleName?i.simpleName:"(non-denotable type)")+(this.arguments.isEmpty()?"":St(this.arguments,", ","<",">",void 0,void 0,(n=this,function(t){return n.asString_0(t)})))+(this.isMarkedNullable?"?":"")},$o.prototype.asString_0=function(t){return null==t.variance?"*":vo(t.variance)+$(t.type)},$o.$metadata$={kind:p,simpleName:"KTypeImpl",interfaces:[yo]},go.prototype.functionClass=function(t){var e,n,i;if(null!=(e=Bo[t]))n=e;else{var r=new oo(Function,"Function"+t,(i=t,function(t){return"function"==typeof t&&t.length===i}));Bo[t]=r,n=r}return n},go.$metadata$={kind:b,simpleName:"PrimitiveClasses",interfaces:[]};var Bo,Uo,Fo,qo=null;function Go(){return null===qo&&new go,qo}function Ho(t){return Array.isArray(t)?Yo(t):Vo(t)}function Yo(t){switch(t.length){case 1:return Vo(t[0]);case 0:return lo();default:return new uo}}function Vo(t){var e;if(t===String)return Go().stringClass;var n=t.$metadata$;if(null!=n)if(null==n.$kClass$){var i=new ro(t);n.$kClass$=i,e=i}else e=n.$kClass$;else e=new ro(t);return e}function Ko(t){t.lastIndex=0}function Wo(){}function Xo(t){this.string_0=void 0!==t?t:""}function Zo(t,e){return Qo(e=e||Object.create(Xo.prototype)),e}function Jo(t,e){return e=e||Object.create(Xo.prototype),Xo.call(e,t.toString()),e}function Qo(t){return t=t||Object.create(Xo.prototype),Xo.call(t,""),t}function ta(t){var e=String.fromCharCode(t).toUpperCase();return e.length>1?t:e.charCodeAt(0)}function ea(t){return new Me(A.MIN_HIGH_SURROGATE,A.MAX_HIGH_SURROGATE).contains_mef7kx$(t)}function na(t){return new Me(A.MIN_LOW_SURROGATE,A.MAX_LOW_SURROGATE).contains_mef7kx$(t)}function ia(t){return vi(t)}function ra(t){switch(t.toLowerCase()){case"nan":case"+nan":case"-nan":return!0;default:return!1}}function oa(t){if(!(2<=t&&t<=36))throw Mn("radix "+t+" was not in valid range 2..36");return t}function aa(t,e){var n;return(n=t>=48&&t<=57?t-48:t>=65&&t<=90?t-65+10|0:t>=97&&t<=122?t-97+10|0:t<128?-1:t>=65313&&t<=65338?t-65313+10|0:t>=65345&&t<=65370?t-65345+10|0:$i(t))>=e?-1:n}function sa(t,e,n){x.call(this),this.value=n,this.name$=t,this.ordinal$=e}function la(){la=function(){},Uo=new sa("IGNORE_CASE",0,"i"),Fo=new sa("MULTILINE",1,"m")}function ua(){return la(),Uo}function ca(){return la(),Fo}function pa(t){this.value=t}function ha(t,e){ga(),this.pattern=t,this.options=xt(e),this.nativePattern_0=new RegExp(t,St(e,"","gu",void 0,void 0,void 0,ba))}function _a(t){return t.next()}function fa(){va=this,this.patternEscape_0=new RegExp("[\\\\^$*+?.()|[\\]{}]","g"),this.replacementEscape_0=new RegExp("\\$","g")}Wo.$metadata$={kind:g,simpleName:"Appendable",interfaces:[]},Object.defineProperty(Xo.prototype,"length",{configurable:!0,get:function(){return this.string_0.length}}),Xo.prototype.charCodeAt=function(t){var e=this.string_0;if(!(t>=0&&t<=gc(e)))throw new Fn("index: "+t+", length: "+this.length+"}");return e.charCodeAt(t)},Xo.prototype.subSequence_vux9f0$=function(t,e){return this.string_0.substring(t,e)},Xo.prototype.append_s8itvh$=function(t){return this.string_0+=String.fromCharCode(t),this},Xo.prototype.append_gw00v9$=function(t){return this.string_0+=$(t),this},Xo.prototype.append_ezbsdh$=function(t,e,n){return this.appendRange_3peag4$(null!=t?t:"null",e,n)},Xo.prototype.reverse=function(){for(var t,e,n="",i=this.string_0.length-1|0;i>=0;){var r=this.string_0.charCodeAt((i=(t=i)-1|0,t));if(na(r)&&i>=0){var o=this.string_0.charCodeAt((i=(e=i)-1|0,e));n=ea(o)?n+String.fromCharCode(a(o))+String.fromCharCode(a(r)):n+String.fromCharCode(a(r))+String.fromCharCode(a(o))}else n+=String.fromCharCode(r)}return this.string_0=n,this},Xo.prototype.append_s8jyv4$=function(t){return this.string_0+=$(t),this},Xo.prototype.append_6taknv$=function(t){return this.string_0+=t,this},Xo.prototype.append_4hbowm$=function(t){return this.string_0+=Sa(t),this},Xo.prototype.append_61zpoe$=function(t){return this.append_pdl1vj$(t)},Xo.prototype.append_pdl1vj$=function(t){return this.string_0=this.string_0+(null!=t?t:"null"),this},Xo.prototype.capacity=function(){return this.length},Xo.prototype.ensureCapacity_za3lpa$=function(t){},Xo.prototype.indexOf_61zpoe$=function(t){return this.string_0.indexOf(t)},Xo.prototype.indexOf_bm4lxs$=function(t,e){return this.string_0.indexOf(t,e)},Xo.prototype.lastIndexOf_61zpoe$=function(t){return this.string_0.lastIndexOf(t)},Xo.prototype.lastIndexOf_bm4lxs$=function(t,e){return 0===t.length&&e<0?-1:this.string_0.lastIndexOf(t,e)},Xo.prototype.insert_fzusl$=function(t,e){return Za().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+$(e)+this.string_0.substring(t),this},Xo.prototype.insert_6t1mh3$=function(t,e){return Za().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+String.fromCharCode(a(e))+this.string_0.substring(t),this},Xo.prototype.insert_7u455s$=function(t,e){return Za().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+Sa(e)+this.string_0.substring(t),this},Xo.prototype.insert_1u9bqd$=function(t,e){return Za().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+$(e)+this.string_0.substring(t),this},Xo.prototype.insert_6t2rgq$=function(t,e){return Za().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+$(e)+this.string_0.substring(t),this},Xo.prototype.insert_19mbxw$=function(t,e){return this.insert_vqvrqt$(t,e)},Xo.prototype.insert_vqvrqt$=function(t,e){Za().checkPositionIndex_6xvm5r$(t,this.length);var n=null!=e?e:"null";return this.string_0=this.string_0.substring(0,t)+n+this.string_0.substring(t),this},Xo.prototype.setLength_za3lpa$=function(t){if(t<0)throw Mn("Negative new length: "+t+".");if(t<=this.length)this.string_0=this.string_0.substring(0,t);else for(var e=this.length;en)throw new Fn("startIndex: "+t+", length: "+n);if(t>e)throw Mn("startIndex("+t+") > endIndex("+e+")")},Xo.prototype.deleteAt_za3lpa$=function(t){return Za().checkElementIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+this.string_0.substring(t+1|0),this},Xo.prototype.deleteRange_vux9f0$=function(t,e){return this.checkReplaceRange_0(t,e,this.length),this.string_0=this.string_0.substring(0,t)+this.string_0.substring(e),this},Xo.prototype.toCharArray_pqkatk$=function(t,e,n,i){var r;void 0===e&&(e=0),void 0===n&&(n=0),void 0===i&&(i=this.length),Za().checkBoundsIndexes_cub51b$(n,i,this.length),Za().checkBoundsIndexes_cub51b$(e,e+i-n|0,t.length);for(var o=e,a=n;at.length)throw new Fn("Start index out of bounds: "+e+", input length: "+t.length);return Ca(this.nativePattern_0,t.toString(),e)},ha.prototype.findAll_905azu$=function(t,e){if(void 0===e&&(e=0),e<0||e>t.length)throw new Fn("Start index out of bounds: "+e+", input length: "+t.length);return Ll((n=t,i=e,r=this,function(){return r.find_905azu$(n,i)}),_a);var n,i,r},ha.prototype.matchEntire_6bul2c$=function(e){return kc(this.pattern,94)&&Ec(this.pattern,36)?this.find_905azu$(e):new ha("^"+_c(hc(this.pattern,t.charArrayOf(94)),t.charArrayOf(36))+"$",this.options).find_905azu$(e)},ha.prototype.replace_x2uqeu$=function(t,e){return t.toString().replace(this.nativePattern_0,e)},ha.prototype.replace_20wsma$=i("kotlin.kotlin.text.Regex.replace_20wsma$",r((function(){var n=e.kotlin.text.StringBuilder_init_za3lpa$,i=t.ensureNotNull;return function(t,e){var r=this.find_905azu$(t);if(null==r)return t.toString();var o=0,a=t.length,s=n(a);do{var l=i(r);s.append_ezbsdh$(t,o,l.range.start),s.append_gw00v9$(e(l)),o=l.range.endInclusive+1|0,r=l.next()}while(o=0))throw Mn(("Limit must be non-negative, but was "+n).toString());var r=this.findAll_905azu$(e),o=0===n?r:Mt(r,n-1|0),a=Ki(),s=0;for(i=o.iterator();i.hasNext();){var l=i.next();a.add_11rb$(t.subSequence(e,s,l.range.start).toString()),s=l.range.endInclusive+1|0}return a.add_11rb$(t.subSequence(e,s,e.length).toString()),a},ha.prototype.toString=function(){return this.nativePattern_0.toString()},fa.prototype.fromLiteral_61zpoe$=function(t){return wa(this.escape_61zpoe$(t))},fa.prototype.escape_61zpoe$=function(t){return t.replace(this.patternEscape_0,"\\$&")},fa.prototype.escapeReplacement_61zpoe$=function(t){return t.replace(this.replacementEscape_0,"$$$$")},fa.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var da,ma,ya,$a,va=null;function ga(){return null===va&&new fa,va}function ba(t){return t.value}function wa(t,e){return e=e||Object.create(ha.prototype),ha.call(e,t,Dl()),e}function xa(t,e,n,i){this.closure$match=t,this.this$findNext=e,this.closure$input=n,this.closure$range=i,this.range_co6b9w$_0=i,this.groups_qcaztb$_0=new Ea(t),this.groupValues__0=null}function ka(t){this.closure$match=t,Ha.call(this)}function Ea(t){this.closure$match=t,za.call(this)}function Ca(t,e,n){t.lastIndex=n;var i=t.exec(e);return null==i?null:new xa(i,t,e,new qe(i.index,t.lastIndex-1|0))}function Sa(t){var e,n="";for(e=0;e!==t.length;++e){var i=s(t[e]);n+=String.fromCharCode(i)}return n}function Ta(t,e,n){void 0===e&&(e=0),void 0===n&&(n=t.length),Za().checkBoundsIndexes_cub51b$(e,n,t.length);for(var i="",r=e;r0},Ka.prototype.nextIndex=function(){return this.index_0},Ka.prototype.previous=function(){if(!this.hasPrevious())throw Zn();return this.$outer.get_za3lpa$((this.index_0=this.index_0-1|0,this.index_0))},Ka.prototype.previousIndex=function(){return this.index_0-1|0},Ka.$metadata$={kind:p,simpleName:"ListIteratorImpl",interfaces:[_e,Va]},Wa.prototype.checkElementIndex_6xvm5r$=function(t,e){if(t<0||t>=e)throw new Fn("index: "+t+", size: "+e)},Wa.prototype.checkPositionIndex_6xvm5r$=function(t,e){if(t<0||t>e)throw new Fn("index: "+t+", size: "+e)},Wa.prototype.checkRangeIndexes_cub51b$=function(t,e,n){if(t<0||e>n)throw new Fn("fromIndex: "+t+", toIndex: "+e+", size: "+n);if(t>e)throw Mn("fromIndex: "+t+" > toIndex: "+e)},Wa.prototype.checkBoundsIndexes_cub51b$=function(t,e,n){if(t<0||e>n)throw new Fn("startIndex: "+t+", endIndex: "+e+", size: "+n);if(t>e)throw Mn("startIndex: "+t+" > endIndex: "+e)},Wa.prototype.orderedHashCode_nykoif$=function(t){var e,n,i=1;for(e=t.iterator();e.hasNext();){var r=e.next();i=(31*i|0)+(null!=(n=null!=r?N(r):null)?n:0)|0}return i},Wa.prototype.orderedEquals_e92ka7$=function(t,e){var n;if(t.size!==e.size)return!1;var i=e.iterator();for(n=t.iterator();n.hasNext();){var r=n.next(),a=i.next();if(!o(r,a))return!1}return!0},Wa.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Xa=null;function Za(){return null===Xa&&new Wa,Xa}function Ja(){os(),this._keys_up5z3z$_0=null,this._values_6nw1f1$_0=null}function Qa(t){this.this$AbstractMap=t,as.call(this)}function ts(t){this.closure$entryIterator=t}function es(t){this.this$AbstractMap=t,za.call(this)}function ns(t){this.closure$entryIterator=t}function is(){rs=this}Ha.$metadata$={kind:p,simpleName:"AbstractList",interfaces:[ie,za]},Ja.prototype.containsKey_11rb$=function(t){return null!=this.implFindEntry_8k1i24$_0(t)},Ja.prototype.containsValue_11rc$=function(e){var n,i=this.entries;t:do{var r;if(t.isType(i,ee)&&i.isEmpty()){n=!1;break t}for(r=i.iterator();r.hasNext();){var a=r.next();if(o(a.value,e)){n=!0;break t}}n=!1}while(0);return n},Ja.prototype.containsEntry_8hxqw4$=function(e){if(!t.isType(e,le))return!1;var n=e.key,i=e.value,r=(t.isType(this,se)?this:S()).get_11rb$(n);if(!o(i,r))return!1;var a=null==r;return a&&(a=!(t.isType(this,se)?this:S()).containsKey_11rb$(n)),!a},Ja.prototype.equals=function(e){if(e===this)return!0;if(!t.isType(e,se))return!1;if(this.size!==e.size)return!1;var n,i=e.entries;t:do{var r;if(t.isType(i,ee)&&i.isEmpty()){n=!0;break t}for(r=i.iterator();r.hasNext();){var o=r.next();if(!this.containsEntry_8hxqw4$(o)){n=!1;break t}}n=!0}while(0);return n},Ja.prototype.get_11rb$=function(t){var e;return null!=(e=this.implFindEntry_8k1i24$_0(t))?e.value:null},Ja.prototype.hashCode=function(){return N(this.entries)},Ja.prototype.isEmpty=function(){return 0===this.size},Object.defineProperty(Ja.prototype,"size",{configurable:!0,get:function(){return this.entries.size}}),Qa.prototype.contains_11rb$=function(t){return this.this$AbstractMap.containsKey_11rb$(t)},ts.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},ts.prototype.next=function(){return this.closure$entryIterator.next().key},ts.$metadata$={kind:p,interfaces:[pe]},Qa.prototype.iterator=function(){return new ts(this.this$AbstractMap.entries.iterator())},Object.defineProperty(Qa.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMap.size}}),Qa.$metadata$={kind:p,interfaces:[as]},Object.defineProperty(Ja.prototype,"keys",{configurable:!0,get:function(){return null==this._keys_up5z3z$_0&&(this._keys_up5z3z$_0=new Qa(this)),E(this._keys_up5z3z$_0)}}),Ja.prototype.toString=function(){return St(this.entries,", ","{","}",void 0,void 0,(t=this,function(e){return t.toString_55he67$_0(e)}));var t},Ja.prototype.toString_55he67$_0=function(t){return this.toString_kthv8s$_0(t.key)+"="+this.toString_kthv8s$_0(t.value)},Ja.prototype.toString_kthv8s$_0=function(t){return t===this?"(this Map)":$(t)},es.prototype.contains_11rb$=function(t){return this.this$AbstractMap.containsValue_11rc$(t)},ns.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},ns.prototype.next=function(){return this.closure$entryIterator.next().value},ns.$metadata$={kind:p,interfaces:[pe]},es.prototype.iterator=function(){return new ns(this.this$AbstractMap.entries.iterator())},Object.defineProperty(es.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMap.size}}),es.$metadata$={kind:p,interfaces:[za]},Object.defineProperty(Ja.prototype,"values",{configurable:!0,get:function(){return null==this._values_6nw1f1$_0&&(this._values_6nw1f1$_0=new es(this)),E(this._values_6nw1f1$_0)}}),Ja.prototype.implFindEntry_8k1i24$_0=function(t){var e,n=this.entries;t:do{var i;for(i=n.iterator();i.hasNext();){var r=i.next();if(o(r.key,t)){e=r;break t}}e=null}while(0);return e},is.prototype.entryHashCode_9fthdn$=function(t){var e,n,i,r;return(null!=(n=null!=(e=t.key)?N(e):null)?n:0)^(null!=(r=null!=(i=t.value)?N(i):null)?r:0)},is.prototype.entryToString_9fthdn$=function(t){return $(t.key)+"="+$(t.value)},is.prototype.entryEquals_js7fox$=function(e,n){return!!t.isType(n,le)&&o(e.key,n.key)&&o(e.value,n.value)},is.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var rs=null;function os(){return null===rs&&new is,rs}function as(){us(),za.call(this)}function ss(){ls=this}Ja.$metadata$={kind:p,simpleName:"AbstractMap",interfaces:[se]},as.prototype.equals=function(e){return e===this||!!t.isType(e,oe)&&us().setEquals_y8f7en$(this,e)},as.prototype.hashCode=function(){return us().unorderedHashCode_nykoif$(this)},ss.prototype.unorderedHashCode_nykoif$=function(t){var e,n=0;for(e=t.iterator();e.hasNext();){var i,r=e.next();n=n+(null!=(i=null!=r?N(r):null)?i:0)|0}return n},ss.prototype.setEquals_y8f7en$=function(t,e){return t.size===e.size&&t.containsAll_brywnq$(e)},ss.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var ls=null;function us(){return null===ls&&new ss,ls}function cs(){ps=this}as.$metadata$={kind:p,simpleName:"AbstractSet",interfaces:[oe,za]},cs.prototype.hasNext=function(){return!1},cs.prototype.hasPrevious=function(){return!1},cs.prototype.nextIndex=function(){return 0},cs.prototype.previousIndex=function(){return-1},cs.prototype.next=function(){throw Zn()},cs.prototype.previous=function(){throw Zn()},cs.$metadata$={kind:b,simpleName:"EmptyIterator",interfaces:[_e]};var ps=null;function hs(){return null===ps&&new cs,ps}function _s(){fs=this,this.serialVersionUID_0=j}_s.prototype.equals=function(e){return t.isType(e,ie)&&e.isEmpty()},_s.prototype.hashCode=function(){return 1},_s.prototype.toString=function(){return"[]"},Object.defineProperty(_s.prototype,"size",{configurable:!0,get:function(){return 0}}),_s.prototype.isEmpty=function(){return!0},_s.prototype.contains_11rb$=function(t){return!1},_s.prototype.containsAll_brywnq$=function(t){return t.isEmpty()},_s.prototype.get_za3lpa$=function(t){throw new Fn("Empty list doesn't contain element at index "+t+".")},_s.prototype.indexOf_11rb$=function(t){return-1},_s.prototype.lastIndexOf_11rb$=function(t){return-1},_s.prototype.iterator=function(){return hs()},_s.prototype.listIterator=function(){return hs()},_s.prototype.listIterator_za3lpa$=function(t){if(0!==t)throw new Fn("Index: "+t);return hs()},_s.prototype.subList_vux9f0$=function(t,e){if(0===t&&0===e)return this;throw new Fn("fromIndex: "+t+", toIndex: "+e)},_s.prototype.readResolve_0=function(){return ds()},_s.$metadata$={kind:b,simpleName:"EmptyList",interfaces:[Mr,Kr,ie]};var fs=null;function ds(){return null===fs&&new _s,fs}function ms(t){return new ys(t,!1)}function ys(t,e){this.values=t,this.isVarargs=e}function $s(){return ds()}function vs(t){return t.length>0?ai(t):$s()}function gs(t){return 0===t.length?Ki():Xi(new ys(t,!0))}function bs(t){return new qe(0,t.size-1|0)}function ws(t){return t.size-1|0}function xs(t){switch(t.size){case 0:return $s();case 1:return ki(t.get_za3lpa$(0));default:return t}}function ks(t,e,n){if(e>n)throw Mn("fromIndex ("+e+") is greater than toIndex ("+n+").");if(e<0)throw new Fn("fromIndex ("+e+") is less than zero.");if(n>t)throw new Fn("toIndex ("+n+") is greater than size ("+t+").")}function Es(){throw new Jn("Index overflow has happened.")}function Cs(){throw new Jn("Count overflow has happened.")}function Ss(){}function Ts(t,e){this.index=t,this.value=e}function Os(t){this.iteratorFactory_0=t}function Ns(e){return t.isType(e,ee)?e.size:null}function Ps(e,n){return t.isType(e,ee)?e.size:n}function As(e,n){return t.isType(e,oe)?e:t.isType(e,ee)?t.isType(n,ee)&&n.size<2?e:function(e){return e.size>2&&t.isType(e,Vi)}(e)?vt(e):e:vt(e)}function js(t){this.iterator_0=t,this.index_0=0}function Ls(e,n){if(t.isType(e,Rs))return e.getOrImplicitDefault_11rb$(n);var i,r=e.get_11rb$(n);if(null==r&&!e.containsKey_11rb$(n))throw new Xn("Key "+n+" is missing in the map.");return null==(i=r)||t.isType(i,C)?i:S()}function Rs(){}function Is(){}function zs(t,e){this.map_a09uzx$_0=t,this.default_0=e}function Ds(){Ms=this,this.serialVersionUID_0=L}Object.defineProperty(ys.prototype,"size",{configurable:!0,get:function(){return this.values.length}}),ys.prototype.isEmpty=function(){return 0===this.values.length},ys.prototype.contains_11rb$=function(t){return B(this.values,t)},ys.prototype.containsAll_brywnq$=function(e){var n;t:do{var i;if(t.isType(e,ee)&&e.isEmpty()){n=!0;break t}for(i=e.iterator();i.hasNext();){var r=i.next();if(!this.contains_11rb$(r)){n=!1;break t}}n=!0}while(0);return n},ys.prototype.iterator=function(){return t.arrayIterator(this.values)},ys.prototype.toArray=function(){var t=this.values;return this.isVarargs?t:t.slice()},ys.$metadata$={kind:p,simpleName:"ArrayAsCollection",interfaces:[ee]},Ss.$metadata$={kind:g,simpleName:"Grouping",interfaces:[]},Ts.$metadata$={kind:p,simpleName:"IndexedValue",interfaces:[]},Ts.prototype.component1=function(){return this.index},Ts.prototype.component2=function(){return this.value},Ts.prototype.copy_wxm5ur$=function(t,e){return new Ts(void 0===t?this.index:t,void 0===e?this.value:e)},Ts.prototype.toString=function(){return"IndexedValue(index="+t.toString(this.index)+", value="+t.toString(this.value)+")"},Ts.prototype.hashCode=function(){var e=0;return 31*(e=31*e+t.hashCode(this.index)|0)+t.hashCode(this.value)|0},Ts.prototype.equals=function(e){return this===e||null!==e&&"object"==typeof e&&Object.getPrototypeOf(this)===Object.getPrototypeOf(e)&&t.equals(this.index,e.index)&&t.equals(this.value,e.value)},Os.prototype.iterator=function(){return new js(this.iteratorFactory_0())},Os.$metadata$={kind:p,simpleName:"IndexingIterable",interfaces:[Qt]},js.prototype.hasNext=function(){return this.iterator_0.hasNext()},js.prototype.next=function(){var t;return new Ts(Pi((t=this.index_0,this.index_0=t+1|0,t)),this.iterator_0.next())},js.$metadata$={kind:p,simpleName:"IndexingIterator",interfaces:[pe]},Rs.$metadata$={kind:g,simpleName:"MapWithDefault",interfaces:[se]},Ds.prototype.equals=function(e){return t.isType(e,se)&&e.isEmpty()},Ds.prototype.hashCode=function(){return 0},Ds.prototype.toString=function(){return"{}"},Object.defineProperty(Ds.prototype,"size",{configurable:!0,get:function(){return 0}}),Ds.prototype.isEmpty=function(){return!0},Ds.prototype.containsKey_11rb$=function(t){return!1},Ds.prototype.containsValue_11rc$=function(t){return!1},Ds.prototype.get_11rb$=function(t){return null},Object.defineProperty(Ds.prototype,"entries",{configurable:!0,get:function(){return zl()}}),Object.defineProperty(Ds.prototype,"keys",{configurable:!0,get:function(){return zl()}}),Object.defineProperty(Ds.prototype,"values",{configurable:!0,get:function(){return ds()}}),Ds.prototype.readResolve_0=function(){return Bs()},Ds.$metadata$={kind:b,simpleName:"EmptyMap",interfaces:[Kr,se]};var Ms=null;function Bs(){return null===Ms&&new Ds,Ms}function Us(){var e;return t.isType(e=Bs(),se)?e:Yr()}function Fs(t){var e=mr(t.length);return qs(e,t),e}function qs(t,e){var n;for(n=0;n!==e.length;++n){var i=e[n],r=i.component1(),o=i.component2();t.put_xwzc9p$(r,o)}}function Gs(t,e){var n;for(n=e.iterator();n.hasNext();){var i=n.next(),r=i.component1(),o=i.component2();t.put_xwzc9p$(r,o)}}function Hs(t,e){return Gs(e,t),e}function Ys(t,e){return qs(e,t),e}function Vs(t){return jr(t)}function Ks(t){switch(t.size){case 0:return Us();case 1:default:return t}}function Ws(e,n){var i;if(t.isType(n,ee))return e.addAll_brywnq$(n);var r=!1;for(i=n.iterator();i.hasNext();){var o=i.next();e.add_11rb$(o)&&(r=!0)}return r}function Xs(e,n){var i,r=As(n,e);return(t.isType(i=e,ne)?i:S()).removeAll_brywnq$(r)}function Zs(e,n){var i,r=As(n,e);return(t.isType(i=e,ne)?i:S()).retainAll_brywnq$(r)}function Js(t,e){return Qs(t,e,!0)}function Qs(t,e,n){for(var i={v:!1},r=t.iterator();r.hasNext();)e(r.next())===n&&(r.remove(),i.v=!0);return i.v}function tl(e,n){return function(e,n,i){var r,o,a;if(!t.isType(e,Mr))return Qs(t.isType(r=e,te)?r:Yr(),n,i);var s=0;o=ws(e);for(var l=0;l<=o;l++){var u=e.get_za3lpa$(l);n(u)!==i&&(s!==l&&e.set_wxm5ur$(s,u),s=s+1|0)}if(s=a;c--)e.removeAt_za3lpa$(c);return!0}return!1}(e,n,!0)}function el(t){Ha.call(this),this.delegate_0=t}function nl(){}function il(t){this.closure$iterator=t}function rl(t){var e=new al;return e.nextStep=Pn(t,e,e),e}function ol(){}function al(){ol.call(this),this.state_0=0,this.nextValue_0=null,this.nextIterator_0=null,this.nextStep=null}function sl(t){return 0===t.length?ll():it(t)}function ll(){return pl()}function ul(){cl=this}Object.defineProperty(el.prototype,"size",{configurable:!0,get:function(){return this.delegate_0.size}}),el.prototype.get_za3lpa$=function(t){return this.delegate_0.get_za3lpa$(function(t,e){var n;if(n=ws(t),0<=e&&e<=n)return ws(t)-e|0;throw new Fn("Element index "+e+" must be in range ["+new qe(0,ws(t))+"].")}(this,t))},el.$metadata$={kind:p,simpleName:"ReversedListReadOnly",interfaces:[Ha]},nl.$metadata$={kind:g,simpleName:"Sequence",interfaces:[]},il.prototype.iterator=function(){return this.closure$iterator()},il.$metadata$={kind:p,interfaces:[nl]},ol.prototype.yieldAll_p1ys8y$=function(e,n){if(!t.isType(e,ee)||!e.isEmpty())return this.yieldAll_1phuh2$(e.iterator(),n)},ol.prototype.yieldAll_swo9gw$=function(t,e){return this.yieldAll_1phuh2$(t.iterator(),e)},ol.$metadata$={kind:p,simpleName:"SequenceScope",interfaces:[]},al.prototype.hasNext=function(){for(;;){switch(this.state_0){case 0:break;case 1:if(E(this.nextIterator_0).hasNext())return this.state_0=2,!0;this.nextIterator_0=null;break;case 4:return!1;case 3:case 2:return!0;default:throw this.exceptionalState_0()}this.state_0=5;var t=E(this.nextStep);this.nextStep=null,t.resumeWith_tl1gpc$(new ep(Qe()))}},al.prototype.next=function(){var e;switch(this.state_0){case 0:case 1:return this.nextNotReady_0();case 2:return this.state_0=1,E(this.nextIterator_0).next();case 3:this.state_0=0;var n=null==(e=this.nextValue_0)||t.isType(e,C)?e:Yr();return this.nextValue_0=null,n;default:throw this.exceptionalState_0()}},al.prototype.nextNotReady_0=function(){if(this.hasNext())return this.next();throw Zn()},al.prototype.exceptionalState_0=function(){switch(this.state_0){case 4:return Zn();case 5:return Un("Iterator has failed.");default:return Un("Unexpected state of the iterator: "+this.state_0)}},al.prototype.yield_11rb$=function(t,e){return this.nextValue_0=t,this.state_0=3,(n=this,function(t){return n.nextStep=t,Su()})(e);var n},al.prototype.yieldAll_1phuh2$=function(t,e){if(t.hasNext())return this.nextIterator_0=t,this.state_0=2,(n=this,function(t){return n.nextStep=t,Su()})(e);var n},al.prototype.resumeWith_tl1gpc$=function(e){var n;sp(e),null==(n=e.value)||t.isType(n,C)||S(),this.state_0=4},Object.defineProperty(al.prototype,"context",{configurable:!0,get:function(){return $u()}}),al.$metadata$={kind:p,simpleName:"SequenceBuilderIterator",interfaces:[ou,pe,ol]},ul.prototype.iterator=function(){return hs()},ul.prototype.drop_za3lpa$=function(t){return pl()},ul.prototype.take_za3lpa$=function(t){return pl()},ul.$metadata$={kind:b,simpleName:"EmptySequence",interfaces:[El,nl]};var cl=null;function pl(){return null===cl&&new ul,cl}function hl(t){return t.iterator()}function _l(t){return ml(t,hl)}function fl(t){return t.iterator()}function dl(t){return t}function ml(e,n){var i;return t.isType(e,vl)?(t.isType(i=e,vl)?i:Yr()).flatten_1tglza$(n):new xl(e,dl,n)}function yl(t,e,n){void 0===e&&(e=!0),this.sequence_0=t,this.sendWhen_0=e,this.predicate_0=n}function $l(t){this.this$FilteringSequence=t,this.iterator=t.sequence_0.iterator(),this.nextState=-1,this.nextItem=null}function vl(t,e){this.sequence_0=t,this.transformer_0=e}function gl(t){this.this$TransformingSequence=t,this.iterator=t.sequence_0.iterator()}function bl(t,e,n){this.sequence1_0=t,this.sequence2_0=e,this.transform_0=n}function wl(t){this.this$MergingSequence=t,this.iterator1=t.sequence1_0.iterator(),this.iterator2=t.sequence2_0.iterator()}function xl(t,e,n){this.sequence_0=t,this.transformer_0=e,this.iterator_0=n}function kl(t){this.this$FlatteningSequence=t,this.iterator=t.sequence_0.iterator(),this.itemIterator=null}function El(){}function Cl(t,e,n){if(this.sequence_0=t,this.startIndex_0=e,this.endIndex_0=n,!(this.startIndex_0>=0))throw Mn(("startIndex should be non-negative, but is "+this.startIndex_0).toString());if(!(this.endIndex_0>=0))throw Mn(("endIndex should be non-negative, but is "+this.endIndex_0).toString());if(!(this.endIndex_0>=this.startIndex_0))throw Mn(("endIndex should be not less than startIndex, but was "+this.endIndex_0+" < "+this.startIndex_0).toString())}function Sl(t){this.this$SubSequence=t,this.iterator=t.sequence_0.iterator(),this.position=0}function Tl(t,e){if(this.sequence_0=t,this.count_0=e,!(this.count_0>=0))throw Mn(("count must be non-negative, but was "+this.count_0+".").toString())}function Ol(t){this.left=t.count_0,this.iterator=t.sequence_0.iterator()}function Nl(t,e){if(this.sequence_0=t,this.count_0=e,!(this.count_0>=0))throw Mn(("count must be non-negative, but was "+this.count_0+".").toString())}function Pl(t){this.iterator=t.sequence_0.iterator(),this.left=t.count_0}function Al(t,e){this.getInitialValue_0=t,this.getNextValue_0=e}function jl(t){this.this$GeneratorSequence=t,this.nextItem=null,this.nextState=-2}function Ll(t,e){return new Al(t,e)}function Rl(){Il=this,this.serialVersionUID_0=R}$l.prototype.calcNext_0=function(){for(;this.iterator.hasNext();){var t=this.iterator.next();if(this.this$FilteringSequence.predicate_0(t)===this.this$FilteringSequence.sendWhen_0)return this.nextItem=t,void(this.nextState=1)}this.nextState=0},$l.prototype.next=function(){var e;if(-1===this.nextState&&this.calcNext_0(),0===this.nextState)throw Zn();var n=this.nextItem;return this.nextItem=null,this.nextState=-1,null==(e=n)||t.isType(e,C)?e:Yr()},$l.prototype.hasNext=function(){return-1===this.nextState&&this.calcNext_0(),1===this.nextState},$l.$metadata$={kind:p,interfaces:[pe]},yl.prototype.iterator=function(){return new $l(this)},yl.$metadata$={kind:p,simpleName:"FilteringSequence",interfaces:[nl]},gl.prototype.next=function(){return this.this$TransformingSequence.transformer_0(this.iterator.next())},gl.prototype.hasNext=function(){return this.iterator.hasNext()},gl.$metadata$={kind:p,interfaces:[pe]},vl.prototype.iterator=function(){return new gl(this)},vl.prototype.flatten_1tglza$=function(t){return new xl(this.sequence_0,this.transformer_0,t)},vl.$metadata$={kind:p,simpleName:"TransformingSequence",interfaces:[nl]},wl.prototype.next=function(){return this.this$MergingSequence.transform_0(this.iterator1.next(),this.iterator2.next())},wl.prototype.hasNext=function(){return this.iterator1.hasNext()&&this.iterator2.hasNext()},wl.$metadata$={kind:p,interfaces:[pe]},bl.prototype.iterator=function(){return new wl(this)},bl.$metadata$={kind:p,simpleName:"MergingSequence",interfaces:[nl]},kl.prototype.next=function(){if(!this.ensureItemIterator_0())throw Zn();return E(this.itemIterator).next()},kl.prototype.hasNext=function(){return this.ensureItemIterator_0()},kl.prototype.ensureItemIterator_0=function(){var t;for(!1===(null!=(t=this.itemIterator)?t.hasNext():null)&&(this.itemIterator=null);null==this.itemIterator;){if(!this.iterator.hasNext())return!1;var e=this.iterator.next(),n=this.this$FlatteningSequence.iterator_0(this.this$FlatteningSequence.transformer_0(e));if(n.hasNext())return this.itemIterator=n,!0}return!0},kl.$metadata$={kind:p,interfaces:[pe]},xl.prototype.iterator=function(){return new kl(this)},xl.$metadata$={kind:p,simpleName:"FlatteningSequence",interfaces:[nl]},El.$metadata$={kind:g,simpleName:"DropTakeSequence",interfaces:[nl]},Object.defineProperty(Cl.prototype,"count_0",{configurable:!0,get:function(){return this.endIndex_0-this.startIndex_0|0}}),Cl.prototype.drop_za3lpa$=function(t){return t>=this.count_0?ll():new Cl(this.sequence_0,this.startIndex_0+t|0,this.endIndex_0)},Cl.prototype.take_za3lpa$=function(t){return t>=this.count_0?this:new Cl(this.sequence_0,this.startIndex_0,this.startIndex_0+t|0)},Sl.prototype.drop_0=function(){for(;this.position=this.this$SubSequence.endIndex_0)throw Zn();return this.position=this.position+1|0,this.iterator.next()},Sl.$metadata$={kind:p,interfaces:[pe]},Cl.prototype.iterator=function(){return new Sl(this)},Cl.$metadata$={kind:p,simpleName:"SubSequence",interfaces:[El,nl]},Tl.prototype.drop_za3lpa$=function(t){return t>=this.count_0?ll():new Cl(this.sequence_0,t,this.count_0)},Tl.prototype.take_za3lpa$=function(t){return t>=this.count_0?this:new Tl(this.sequence_0,t)},Ol.prototype.next=function(){if(0===this.left)throw Zn();return this.left=this.left-1|0,this.iterator.next()},Ol.prototype.hasNext=function(){return this.left>0&&this.iterator.hasNext()},Ol.$metadata$={kind:p,interfaces:[pe]},Tl.prototype.iterator=function(){return new Ol(this)},Tl.$metadata$={kind:p,simpleName:"TakeSequence",interfaces:[El,nl]},Nl.prototype.drop_za3lpa$=function(t){var e=this.count_0+t|0;return e<0?new Nl(this,t):new Nl(this.sequence_0,e)},Nl.prototype.take_za3lpa$=function(t){var e=this.count_0+t|0;return e<0?new Tl(this,t):new Cl(this.sequence_0,this.count_0,e)},Pl.prototype.drop_0=function(){for(;this.left>0&&this.iterator.hasNext();)this.iterator.next(),this.left=this.left-1|0},Pl.prototype.next=function(){return this.drop_0(),this.iterator.next()},Pl.prototype.hasNext=function(){return this.drop_0(),this.iterator.hasNext()},Pl.$metadata$={kind:p,interfaces:[pe]},Nl.prototype.iterator=function(){return new Pl(this)},Nl.$metadata$={kind:p,simpleName:"DropSequence",interfaces:[El,nl]},jl.prototype.calcNext_0=function(){this.nextItem=-2===this.nextState?this.this$GeneratorSequence.getInitialValue_0():this.this$GeneratorSequence.getNextValue_0(E(this.nextItem)),this.nextState=null==this.nextItem?0:1},jl.prototype.next=function(){var e;if(this.nextState<0&&this.calcNext_0(),0===this.nextState)throw Zn();var n=t.isType(e=this.nextItem,C)?e:Yr();return this.nextState=-1,n},jl.prototype.hasNext=function(){return this.nextState<0&&this.calcNext_0(),1===this.nextState},jl.$metadata$={kind:p,interfaces:[pe]},Al.prototype.iterator=function(){return new jl(this)},Al.$metadata$={kind:p,simpleName:"GeneratorSequence",interfaces:[nl]},Rl.prototype.equals=function(e){return t.isType(e,oe)&&e.isEmpty()},Rl.prototype.hashCode=function(){return 0},Rl.prototype.toString=function(){return"[]"},Object.defineProperty(Rl.prototype,"size",{configurable:!0,get:function(){return 0}}),Rl.prototype.isEmpty=function(){return!0},Rl.prototype.contains_11rb$=function(t){return!1},Rl.prototype.containsAll_brywnq$=function(t){return t.isEmpty()},Rl.prototype.iterator=function(){return hs()},Rl.prototype.readResolve_0=function(){return zl()},Rl.$metadata$={kind:b,simpleName:"EmptySet",interfaces:[Kr,oe]};var Il=null;function zl(){return null===Il&&new Rl,Il}function Dl(){return zl()}function Ml(t){return J(t,gr(t.length))}function Bl(t){switch(t.size){case 0:return Dl();case 1:return Ei(t.iterator().next());default:return t}}function Ul(t){this.closure$iterator=t}function Fl(t,e){if(!(t>0&&e>0))throw Mn((t!==e?"Both size "+t+" and step "+e+" must be greater than zero.":"size "+t+" must be greater than zero.").toString())}function ql(t,e,n,i,r){return Fl(e,n),new Ul((o=t,a=e,s=n,l=i,u=r,function(){return Hl(o.iterator(),a,s,l,u)}));var o,a,s,l,u}function Gl(t,e,n,i,r,o,a,s){En.call(this,s),this.$controller=a,this.exceptionState_0=1,this.local$closure$size=t,this.local$closure$step=e,this.local$closure$iterator=n,this.local$closure$reuseBuffer=i,this.local$closure$partialWindows=r,this.local$tmp$=void 0,this.local$tmp$_0=void 0,this.local$gap=void 0,this.local$buffer=void 0,this.local$skip=void 0,this.local$e=void 0,this.local$buffer_0=void 0,this.local$$receiver=o}function Hl(t,e,n,i,r){return t.hasNext()?rl((o=e,a=n,s=t,l=r,u=i,function(t,e,n){var i=new Gl(o,a,s,l,u,t,this,e);return n?i:i.doResume(null)})):hs();var o,a,s,l,u}function Yl(t,e){if(Ha.call(this),this.buffer_0=t,!(e>=0))throw Mn(("ring buffer filled size should not be negative but it is "+e).toString());if(!(e<=this.buffer_0.length))throw Mn(("ring buffer filled size: "+e+" cannot be larger than the buffer size: "+this.buffer_0.length).toString());this.capacity_0=this.buffer_0.length,this.startIndex_0=0,this.size_4goa01$_0=e}function Vl(t){this.this$RingBuffer=t,Ga.call(this),this.count_0=t.size,this.index_0=t.startIndex_0}function Kl(e,n){var i;return e===n?0:null==e?-1:null==n?1:t.compareTo(t.isComparable(i=e)?i:Yr(),n)}function Wl(t){return function(e,n){return function(t,e,n){var i;for(i=0;i!==n.length;++i){var r=n[i],o=Kl(r(t),r(e));if(0!==o)return o}return 0}(e,n,t)}}function Xl(){var e;return t.isType(e=eu(),gi)?e:Yr()}function Zl(){var e;return t.isType(e=ru(),gi)?e:Yr()}function Jl(t){this.comparator=t}function Ql(){tu=this}Ul.prototype.iterator=function(){return this.closure$iterator()},Ul.$metadata$={kind:p,interfaces:[nl]},Gl.$metadata$={kind:t.Kind.CLASS,simpleName:null,interfaces:[En]},Gl.prototype=Object.create(En.prototype),Gl.prototype.constructor=Gl,Gl.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var e=jt(this.local$closure$size,1024);if(this.local$gap=this.local$closure$step-this.local$closure$size|0,this.local$gap>=0){this.local$buffer=Wi(e),this.local$skip=0,this.local$tmp$=this.local$closure$iterator,this.state_0=13;continue}this.local$buffer_0=(i=e,r=(r=void 0)||Object.create(Yl.prototype),Yl.call(r,t.newArray(i,null),0),r),this.local$tmp$_0=this.local$closure$iterator,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(!this.local$tmp$_0.hasNext()){this.state_0=6;continue}var n=this.local$tmp$_0.next();if(this.local$buffer_0.add_11rb$(n),this.local$buffer_0.isFull()){if(this.local$buffer_0.size0){this.local$skip=this.local$skip-1|0,this.state_0=13;continue}this.state_0=14;continue;case 14:if(this.local$buffer.add_11rb$(this.local$e),this.local$buffer.size===this.local$closure$size){if(this.state_0=15,this.result_0=this.local$$receiver.yield_11rb$(this.local$buffer,this),this.result_0===Su())return Su();continue}this.state_0=16;continue;case 15:this.local$closure$reuseBuffer?this.local$buffer.clear():this.local$buffer=Wi(this.local$closure$size),this.local$skip=this.local$gap,this.state_0=16;continue;case 16:this.state_0=13;continue;case 17:if(this.local$buffer.isEmpty()){this.state_0=20;continue}if(this.local$closure$partialWindows||this.local$buffer.size===this.local$closure$size){if(this.state_0=18,this.result_0=this.local$$receiver.yield_11rb$(this.local$buffer,this),this.result_0===Su())return Su();continue}this.state_0=19;continue;case 18:return Ze;case 19:this.state_0=20;continue;case 20:this.state_0=21;continue;case 21:return Ze;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var i,r},Object.defineProperty(Yl.prototype,"size",{configurable:!0,get:function(){return this.size_4goa01$_0},set:function(t){this.size_4goa01$_0=t}}),Yl.prototype.get_za3lpa$=function(e){var n;return Za().checkElementIndex_6xvm5r$(e,this.size),null==(n=this.buffer_0[(this.startIndex_0+e|0)%this.capacity_0])||t.isType(n,C)?n:Yr()},Yl.prototype.isFull=function(){return this.size===this.capacity_0},Vl.prototype.computeNext=function(){var e;0===this.count_0?this.done():(this.setNext_11rb$(null==(e=this.this$RingBuffer.buffer_0[this.index_0])||t.isType(e,C)?e:Yr()),this.index_0=(this.index_0+1|0)%this.this$RingBuffer.capacity_0,this.count_0=this.count_0-1|0)},Vl.$metadata$={kind:p,interfaces:[Ga]},Yl.prototype.iterator=function(){return new Vl(this)},Yl.prototype.toArray_ro6dgy$=function(e){for(var n,i,r,o,a=e.lengththis.size&&(a[this.size]=null),t.isArray(o=a)?o:Yr()},Yl.prototype.toArray=function(){return this.toArray_ro6dgy$(t.newArray(this.size,null))},Yl.prototype.expanded_za3lpa$=function(e){var n=jt(this.capacity_0+(this.capacity_0>>1)+1|0,e);return new Yl(0===this.startIndex_0?si(this.buffer_0,n):this.toArray_ro6dgy$(t.newArray(n,null)),this.size)},Yl.prototype.add_11rb$=function(t){if(this.isFull())throw Un("ring buffer is full");this.buffer_0[(this.startIndex_0+this.size|0)%this.capacity_0]=t,this.size=this.size+1|0},Yl.prototype.removeFirst_za3lpa$=function(t){if(!(t>=0))throw Mn(("n shouldn't be negative but it is "+t).toString());if(!(t<=this.size))throw Mn(("n shouldn't be greater than the buffer size: n = "+t+", size = "+this.size).toString());if(t>0){var e=this.startIndex_0,n=(e+t|0)%this.capacity_0;e>n?(ui(this.buffer_0,null,e,this.capacity_0),ui(this.buffer_0,null,0,n)):ui(this.buffer_0,null,e,n),this.startIndex_0=n,this.size=this.size-t|0}},Yl.prototype.forward_0=function(t,e){return(t+e|0)%this.capacity_0},Yl.$metadata$={kind:p,simpleName:"RingBuffer",interfaces:[Mr,Ha]},Jl.prototype.compare=function(t,e){return this.comparator.compare(e,t)},Jl.prototype.reversed=function(){return this.comparator},Jl.$metadata$={kind:p,simpleName:"ReversedComparator",interfaces:[gi]},Ql.prototype.compare=function(e,n){return t.compareTo(e,n)},Ql.prototype.reversed=function(){return ru()},Ql.$metadata$={kind:b,simpleName:"NaturalOrderComparator",interfaces:[gi]};var tu=null;function eu(){return null===tu&&new Ql,tu}function nu(){iu=this}nu.prototype.compare=function(e,n){return t.compareTo(n,e)},nu.prototype.reversed=function(){return eu()},nu.$metadata$={kind:b,simpleName:"ReverseOrderComparator",interfaces:[gi]};var iu=null;function ru(){return null===iu&&new nu,iu}function ou(){}function au(){uu()}function su(){lu=this}ou.$metadata$={kind:g,simpleName:"Continuation",interfaces:[]},i("kotlin.kotlin.coroutines.suspendCoroutine_922awp$",r((function(){var n=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,i=e.kotlin.coroutines.SafeContinuation_init_wj8d80$;return function(e,r){return t.suspendCall((o=e,function(t){var e=i(n(t));return o(e),e.getOrThrow()})(t.coroutineReceiver())),t.coroutineResult(t.coroutineReceiver());var o}}))),su.$metadata$={kind:b,simpleName:"Key",interfaces:[hu]};var lu=null;function uu(){return null===lu&&new su,lu}function cu(){}function pu(t,e){var n=t.minusKey_yeqjby$(e.key);if(n===$u())return e;var i=n.get_j3r2sn$(uu());if(null==i)return new vu(n,e);var r=n.minusKey_yeqjby$(uu());return r===$u()?new vu(e,i):new vu(new vu(r,e),i)}function hu(){}function _u(){}function fu(t){this.key_no4tas$_0=t}function du(e,n){this.safeCast_9rw4bk$_0=n,this.topmostKey_3x72pn$_0=t.isType(e,du)?e.topmostKey_3x72pn$_0:e}function mu(){yu=this,this.serialVersionUID_0=u}au.prototype.releaseInterceptedContinuation_k98bjh$=function(t){},au.prototype.get_j3r2sn$=function(e){var n;return t.isType(e,du)?e.isSubKey_i2ksv9$(this.key)&&t.isType(n=e.tryCast_m1180o$(this),_u)?n:null:uu()===e?t.isType(this,_u)?this:Yr():null},au.prototype.minusKey_yeqjby$=function(e){return t.isType(e,du)?e.isSubKey_i2ksv9$(this.key)&&null!=e.tryCast_m1180o$(this)?$u():this:uu()===e?$u():this},au.$metadata$={kind:g,simpleName:"ContinuationInterceptor",interfaces:[_u]},cu.prototype.plus_1fupul$=function(t){return t===$u()?this:t.fold_3cc69b$(this,pu)},hu.$metadata$={kind:g,simpleName:"Key",interfaces:[]},_u.prototype.get_j3r2sn$=function(e){return o(this.key,e)?t.isType(this,_u)?this:Yr():null},_u.prototype.fold_3cc69b$=function(t,e){return e(t,this)},_u.prototype.minusKey_yeqjby$=function(t){return o(this.key,t)?$u():this},_u.$metadata$={kind:g,simpleName:"Element",interfaces:[cu]},cu.$metadata$={kind:g,simpleName:"CoroutineContext",interfaces:[]},Object.defineProperty(fu.prototype,"key",{get:function(){return this.key_no4tas$_0}}),fu.$metadata$={kind:p,simpleName:"AbstractCoroutineContextElement",interfaces:[_u]},du.prototype.tryCast_m1180o$=function(t){return this.safeCast_9rw4bk$_0(t)},du.prototype.isSubKey_i2ksv9$=function(t){return t===this||this.topmostKey_3x72pn$_0===t},du.$metadata$={kind:p,simpleName:"AbstractCoroutineContextKey",interfaces:[hu]},mu.prototype.readResolve_0=function(){return $u()},mu.prototype.get_j3r2sn$=function(t){return null},mu.prototype.fold_3cc69b$=function(t,e){return t},mu.prototype.plus_1fupul$=function(t){return t},mu.prototype.minusKey_yeqjby$=function(t){return this},mu.prototype.hashCode=function(){return 0},mu.prototype.toString=function(){return"EmptyCoroutineContext"},mu.$metadata$={kind:b,simpleName:"EmptyCoroutineContext",interfaces:[Kr,cu]};var yu=null;function $u(){return null===yu&&new mu,yu}function vu(t,e){this.left_0=t,this.element_0=e}function gu(t,e){return 0===t.length?e.toString():t+", "+e}function bu(t){null===Cu&&new wu,this.elements=t}function wu(){Cu=this,this.serialVersionUID_0=u}vu.prototype.get_j3r2sn$=function(e){for(var n,i=this;;){if(null!=(n=i.element_0.get_j3r2sn$(e)))return n;var r=i.left_0;if(!t.isType(r,vu))return r.get_j3r2sn$(e);i=r}},vu.prototype.fold_3cc69b$=function(t,e){return e(this.left_0.fold_3cc69b$(t,e),this.element_0)},vu.prototype.minusKey_yeqjby$=function(t){if(null!=this.element_0.get_j3r2sn$(t))return this.left_0;var e=this.left_0.minusKey_yeqjby$(t);return e===this.left_0?this:e===$u()?this.element_0:new vu(e,this.element_0)},vu.prototype.size_0=function(){for(var e,n,i=this,r=2;;){if(null==(n=t.isType(e=i.left_0,vu)?e:null))return r;i=n,r=r+1|0}},vu.prototype.contains_0=function(t){return o(this.get_j3r2sn$(t.key),t)},vu.prototype.containsAll_0=function(e){for(var n,i=e;;){if(!this.contains_0(i.element_0))return!1;var r=i.left_0;if(!t.isType(r,vu))return this.contains_0(t.isType(n=r,_u)?n:Yr());i=r}},vu.prototype.equals=function(e){return this===e||t.isType(e,vu)&&e.size_0()===this.size_0()&&e.containsAll_0(this)},vu.prototype.hashCode=function(){return N(this.left_0)+N(this.element_0)|0},vu.prototype.toString=function(){return"["+this.fold_3cc69b$("",gu)+"]"},vu.prototype.writeReplace_0=function(){var e,n,i,r=this.size_0(),o=t.newArray(r,null),a={v:0};if(this.fold_3cc69b$(Qe(),(n=o,i=a,function(t,e){var r;return n[(r=i.v,i.v=r+1|0,r)]=e,Ze})),a.v!==r)throw Un("Check failed.".toString());return new bu(t.isArray(e=o)?e:Yr())},wu.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var xu,ku,Eu,Cu=null;function Su(){return Nu()}function Tu(t,e){x.call(this),this.name$=t,this.ordinal$=e}function Ou(){Ou=function(){},xu=new Tu("COROUTINE_SUSPENDED",0),ku=new Tu("UNDECIDED",1),Eu=new Tu("RESUMED",2)}function Nu(){return Ou(),xu}function Pu(){return Ou(),ku}function Au(){return Ou(),Eu}function ju(){Du()}function Lu(){zu=this,ju.call(this),this.defaultRandom_0=Qr()}function Ru(){Iu=this,this.serialVersionUID_0=u}bu.prototype.readResolve_0=function(){var t,e=this.elements,n=$u();for(t=0;t!==e.length;++t){var i=e[t];n=n.plus_1fupul$(i)}return n},bu.$metadata$={kind:p,simpleName:"Serialized",interfaces:[Kr]},vu.$metadata$={kind:p,simpleName:"CombinedContext",interfaces:[Kr,cu]},i("kotlin.kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn_zb0pmy$",r((function(){var t=e.kotlin.NotImplementedError;return function(e,n){throw new t("Implementation of suspendCoroutineUninterceptedOrReturn is intrinsic")}}))),Tu.$metadata$={kind:p,simpleName:"CoroutineSingletons",interfaces:[x]},Tu.values=function(){return[Nu(),Pu(),Au()]},Tu.valueOf_61zpoe$=function(t){switch(t){case"COROUTINE_SUSPENDED":return Nu();case"UNDECIDED":return Pu();case"RESUMED":return Au();default:Vr("No enum constant kotlin.coroutines.intrinsics.CoroutineSingletons."+t)}},ju.prototype.nextInt=function(){return this.nextBits_za3lpa$(32)},ju.prototype.nextInt_za3lpa$=function(t){return this.nextInt_vux9f0$(0,t)},ju.prototype.nextInt_vux9f0$=function(t,e){var n;Fu(t,e);var i=e-t|0;if(i>0||-2147483648===i){if((i&(0|-i))===i){var r=Bu(i);n=this.nextBits_za3lpa$(r)}else{var o;do{var a=this.nextInt()>>>1;o=a%i}while((a-o+(i-1)|0)<0);n=o}return t+n|0}for(;;){var s=this.nextInt();if(t<=s&&s0){var a;if(o(r.and(r.unaryMinus()),r)){var s=r.toInt(),l=r.shiftRightUnsigned(32).toInt();if(0!==s){var u=Bu(s);i=t.Long.fromInt(this.nextBits_za3lpa$(u)).and(v)}else if(1===l)i=t.Long.fromInt(this.nextInt()).and(v);else{var c=Bu(l);i=t.Long.fromInt(this.nextBits_za3lpa$(c)).shiftLeft(32).add(t.Long.fromInt(this.nextInt()))}a=i}else{var p;do{var h=this.nextLong().shiftRightUnsigned(1);p=h.modulo(r)}while(h.subtract(p).add(r.subtract(t.Long.fromInt(1))).toNumber()<0);a=p}return e.add(a)}for(;;){var _=this.nextLong();if(e.lessThanOrEqual(_)&&_.lessThan(n))return _}},ju.prototype.nextBoolean=function(){return 0!==this.nextBits_za3lpa$(1)},ju.prototype.nextDouble=function(){return to(this.nextBits_za3lpa$(26),this.nextBits_za3lpa$(27))},ju.prototype.nextDouble_14dthe$=function(t){return this.nextDouble_lu1900$(0,t)},ju.prototype.nextDouble_lu1900$=function(t,e){var n;Gu(t,e);var i=e-t;if(Zr(i)&&Jr(t)&&Jr(e)){var r=this.nextDouble()*(e/2-t/2);n=t+r+r}else n=t+this.nextDouble()*i;var o=n;return o>=e?Wr(e):o},ju.prototype.nextFloat=function(){return this.nextBits_za3lpa$(24)/16777216},ju.prototype.nextBytes_mj6st8$$default=function(t,e,n){if(!(0<=e&&e<=t.length&&0<=n&&n<=t.length))throw Mn((i=e,r=n,o=t,function(){return"fromIndex ("+i+") or toIndex ("+r+") are out of range: 0.."+o.length+"."})().toString());var i,r,o;if(!(e<=n))throw Mn(("fromIndex ("+e+") must be not greater than toIndex ("+n+").").toString());for(var a=(n-e|0)/4|0,s={v:e},l=0;l>>8),t[s.v+2|0]=f(u>>>16),t[s.v+3|0]=f(u>>>24),s.v=s.v+4|0}for(var c=n-s.v|0,p=this.nextBits_za3lpa$(8*c|0),h=0;h>>(8*h|0));return t},ju.prototype.nextBytes_mj6st8$=function(t,e,n,i){return void 0===e&&(e=0),void 0===n&&(n=t.length),i?i(t,e,n):this.nextBytes_mj6st8$$default(t,e,n)},ju.prototype.nextBytes_fqrh44$=function(t){return this.nextBytes_mj6st8$(t,0,t.length)},ju.prototype.nextBytes_za3lpa$=function(t){return this.nextBytes_fqrh44$(new Int8Array(t))},Ru.prototype.readResolve_0=function(){return Du()},Ru.$metadata$={kind:b,simpleName:"Serialized",interfaces:[Kr]};var Iu=null;Lu.prototype.writeReplace_0=function(){return null===Iu&&new Ru,Iu},Lu.prototype.nextBits_za3lpa$=function(t){return this.defaultRandom_0.nextBits_za3lpa$(t)},Lu.prototype.nextInt=function(){return this.defaultRandom_0.nextInt()},Lu.prototype.nextInt_za3lpa$=function(t){return this.defaultRandom_0.nextInt_za3lpa$(t)},Lu.prototype.nextInt_vux9f0$=function(t,e){return this.defaultRandom_0.nextInt_vux9f0$(t,e)},Lu.prototype.nextLong=function(){return this.defaultRandom_0.nextLong()},Lu.prototype.nextLong_s8cxhz$=function(t){return this.defaultRandom_0.nextLong_s8cxhz$(t)},Lu.prototype.nextLong_3pjtqy$=function(t,e){return this.defaultRandom_0.nextLong_3pjtqy$(t,e)},Lu.prototype.nextBoolean=function(){return this.defaultRandom_0.nextBoolean()},Lu.prototype.nextDouble=function(){return this.defaultRandom_0.nextDouble()},Lu.prototype.nextDouble_14dthe$=function(t){return this.defaultRandom_0.nextDouble_14dthe$(t)},Lu.prototype.nextDouble_lu1900$=function(t,e){return this.defaultRandom_0.nextDouble_lu1900$(t,e)},Lu.prototype.nextFloat=function(){return this.defaultRandom_0.nextFloat()},Lu.prototype.nextBytes_fqrh44$=function(t){return this.defaultRandom_0.nextBytes_fqrh44$(t)},Lu.prototype.nextBytes_za3lpa$=function(t){return this.defaultRandom_0.nextBytes_za3lpa$(t)},Lu.prototype.nextBytes_mj6st8$$default=function(t,e,n){return this.defaultRandom_0.nextBytes_mj6st8$(t,e,n)},Lu.$metadata$={kind:b,simpleName:"Default",interfaces:[Kr,ju]};var zu=null;function Du(){return null===zu&&new Lu,zu}function Mu(t){return Ju(t,t>>31)}function Bu(t){return 31-c.clz32(t)|0}function Uu(t,e){return t>>>32-e&(0|-e)>>31}function Fu(t,e){if(!(e>t))throw Mn(Hu(t,e).toString())}function qu(t,e){if(!(e.compareTo_11rb$(t)>0))throw Mn(Hu(t,e).toString())}function Gu(t,e){if(!(e>t))throw Mn(Hu(t,e).toString())}function Hu(t,e){return"Random range is empty: ["+t.toString()+", "+e.toString()+")."}function Yu(t,e,n,i,r,o){if(null===Zu&&new Vu,ju.call(this),this.x_0=t,this.y_0=e,this.z_0=n,this.w_0=i,this.v_0=r,this.addend_0=o,0==(this.x_0|this.y_0|this.z_0|this.w_0|this.v_0))throw Mn("Initial state must have at least one non-zero element.".toString());for(var a=0;a<64;a++)this.nextInt()}function Vu(){Zu=this,this.serialVersionUID_0=u}ju.$metadata$={kind:p,simpleName:"Random",interfaces:[]},Yu.prototype.nextInt=function(){var t=this.x_0;t^=t>>>2,this.x_0=this.y_0,this.y_0=this.z_0,this.z_0=this.w_0;var e=this.v_0;return this.w_0=e,t=t^t<<1^e^e<<4,this.v_0=t,this.addend_0=this.addend_0+362437|0,t+this.addend_0|0},Yu.prototype.nextBits_za3lpa$=function(t){return Uu(this.nextInt(),t)},Vu.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Ku,Wu,Xu,Zu=null;function Ju(t,e,n){return n=n||Object.create(Yu.prototype),Yu.call(n,t,e,0,0,~t,t<<10^e>>>4),n}function Qu(t,e){this.start_p1gsmm$_0=t,this.endInclusive_jj4lf7$_0=e}function tc(){}function ec(t,e){this._start_0=t,this._endInclusive_0=e}function nc(){}function ic(e,n,i){null!=i?e.append_gw00v9$(i(n)):null==n||t.isCharSequence(n)?e.append_gw00v9$(n):t.isChar(n)?e.append_s8itvh$(s(n)):e.append_gw00v9$($(n))}function rc(t,e,n){if(void 0===n&&(n=!1),t===e)return!0;if(!n)return!1;var i=ta(t),r=ta(e),o=i===r;return o||(o=String.fromCharCode(i).toLowerCase().charCodeAt(0)===String.fromCharCode(r).toLowerCase().charCodeAt(0)),o}function oc(e,n,i){if(void 0===n&&(n=""),void 0===i&&(i="|"),La(i))throw Mn("marginPrefix must be non-blank string.".toString());var r,o,l,u,c=Bc(e),p=(e.length,t.imul(n.length,c.size),0===(l=n).length?ac:(u=l,function(t){return u+t})),h=ws(c),_=Ki(),f=0;for(r=c.iterator();r.hasNext();){var d,m,y,$,v=r.next(),g=Pi((f=(o=f)+1|0,o));if(0!==g&&g!==h||!La(v)){var b;t:do{var w,x,k,E;x=(w=vc(v)).first,k=w.last,E=w.step;for(var C=x;C<=k;C+=E)if(!ia(s(a(v.charCodeAt(C))))){b=C;break t}b=-1}while(0);var S=b;$=null!=(y=null!=(m=-1===S?null:Pa(v,i,S)?v.substring(S+i.length|0):null)?p(m):null)?y:v}else $=null;null!=(d=$)&&_.add_11rb$(d)}return Ct(_,Zo(),"\n").toString()}function ac(t){return t}function sc(t){return lc(t,10)}function lc(e,n){oa(n);var i,r,o,a=e.length;if(0===a)return null;var s=e.charCodeAt(0);if(s<48){if(1===a)return null;if(i=1,45===s)r=!0,o=-2147483648;else{if(43!==s)return null;r=!1,o=-2147483647}}else i=0,r=!1,o=-2147483647;for(var l=-59652323,u=l,c=0,p=i;p(t.length-r|0)||i>(n.length-r|0))return!1;for(var a=0;a0&&rc(t.charCodeAt(0),e,n)}function Ec(t,e,n){return void 0===n&&(n=!1),t.length>0&&rc(t.charCodeAt(gc(t)),e,n)}function Cc(t,e,n){return void 0===n&&(n=!1),n||"string"!=typeof t||"string"!=typeof e?xc(t,0,e,0,e.length,n):Na(t,e)}function Sc(t,e,n){return void 0===n&&(n=!1),n||"string"!=typeof t||"string"!=typeof e?xc(t,t.length-e.length|0,e,0,e.length,n):Aa(t,e)}function Tc(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=!1),!i&&1===e.length&&"string"==typeof t){var l=H(e);return t.indexOf(String.fromCharCode(l),n)}r=At(n,0),o=gc(t);for(var u=r;u<=o;u++){var c,p=t.charCodeAt(u);t:do{var h;for(h=0;h!==e.length;++h){var _=s(e[h]);if(rc(s(a(_)),p,i)){c=!0;break t}}c=!1}while(0);if(c)return u}return-1}function Oc(t,e,n,i){if(void 0===n&&(n=gc(t)),void 0===i&&(i=!1),!i&&1===e.length&&"string"==typeof t){var r=H(e);return t.lastIndexOf(String.fromCharCode(r),n)}for(var o=jt(n,gc(t));o>=0;o--){var l,u=t.charCodeAt(o);t:do{var c;for(c=0;c!==e.length;++c){var p=s(e[c]);if(rc(s(a(p)),u,i)){l=!0;break t}}l=!1}while(0);if(l)return o}return-1}function Nc(t,e,n,i,r,o){var a,s;void 0===o&&(o=!1);var l=o?Ot(jt(n,gc(t)),At(i,0)):new qe(At(n,0),jt(i,t.length));if("string"==typeof t&&"string"==typeof e)for(a=l.iterator();a.hasNext();){var u=a.next();if(Ra(e,0,t,u,e.length,r))return u}else for(s=l.iterator();s.hasNext();){var c=s.next();if(xc(e,0,t,c,e.length,r))return c}return-1}function Pc(e,n,i,r){return void 0===i&&(i=0),void 0===r&&(r=!1),r||"string"!=typeof e?Tc(e,t.charArrayOf(n),i,r):e.indexOf(String.fromCharCode(n),i)}function Ac(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=!1),i||"string"!=typeof t?Nc(t,e,n,t.length,i):t.indexOf(e,n)}function jc(t,e,n,i){return void 0===n&&(n=gc(t)),void 0===i&&(i=!1),i||"string"!=typeof t?Nc(t,e,n,0,i,!0):t.lastIndexOf(e,n)}function Lc(t,e,n,i){this.input_0=t,this.startIndex_0=e,this.limit_0=n,this.getNextMatch_0=i}function Rc(t){this.this$DelimitedRangesSequence=t,this.nextState=-1,this.currentStartIndex=Lt(t.startIndex_0,0,t.input_0.length),this.nextSearchIndex=this.currentStartIndex,this.nextItem=null,this.counter=0}function Ic(t,e){return function(n,i){var r;return null!=(r=function(t,e,n,i,r){var o,a;if(!i&&1===e.size){var s=_t(e),l=r?jc(t,s,n):Ac(t,s,n);return l<0?null:cp(l,s)}var u=r?Ot(jt(n,gc(t)),0):new qe(At(n,0),t.length);if("string"==typeof t)for(o=u.iterator();o.hasNext();){var c,p=o.next();t:do{var h;for(h=e.iterator();h.hasNext();){var _=h.next();if(Ra(_,0,t,p,_.length,i)){c=_;break t}}c=null}while(0);if(null!=c)return cp(p,c)}else for(a=u.iterator();a.hasNext();){var f,d=a.next();t:do{var m;for(m=e.iterator();m.hasNext();){var y=m.next();if(xc(y,0,t,d,y.length,i)){f=y;break t}}f=null}while(0);if(null!=f)return cp(d,f)}return null}(n,t,i,e,!1))?cp(r.first,r.second.length):null}}function zc(t,e,n,i,r){if(void 0===n&&(n=0),void 0===i&&(i=!1),void 0===r&&(r=0),!(r>=0))throw Mn(("Limit must be non-negative, but was "+r+".").toString());return new Lc(t,n,r,Ic(ai(e),i))}function Dc(t,e,n,i){return void 0===n&&(n=!1),void 0===i&&(i=0),Gt(zc(t,e,void 0,n,i),(r=t,function(t){return wc(r,t)}));var r}function Mc(t){return Dc(t,["\r\n","\n","\r"])}function Bc(t){return Ft(Mc(t))}function Uc(){}function Fc(){}function qc(t){this.match=t}function Gc(){}function Hc(t,e){x.call(this),this.name$=t,this.ordinal$=e}function Yc(){Yc=function(){},Ku=new Hc("SYNCHRONIZED",0),Wu=new Hc("PUBLICATION",1),Xu=new Hc("NONE",2)}function Vc(){return Yc(),Ku}function Kc(){return Yc(),Wu}function Wc(){return Yc(),Xu}function Xc(){Zc=this}Yu.$metadata$={kind:p,simpleName:"XorWowRandom",interfaces:[Kr,ju]},tc.prototype.contains_mef7kx$=function(t){return this.lessThanOrEquals_n65qkk$(this.start,t)&&this.lessThanOrEquals_n65qkk$(t,this.endInclusive)},tc.prototype.isEmpty=function(){return!this.lessThanOrEquals_n65qkk$(this.start,this.endInclusive)},tc.$metadata$={kind:g,simpleName:"ClosedFloatingPointRange",interfaces:[De]},Object.defineProperty(ec.prototype,"start",{configurable:!0,get:function(){return this._start_0}}),Object.defineProperty(ec.prototype,"endInclusive",{configurable:!0,get:function(){return this._endInclusive_0}}),ec.prototype.lessThanOrEquals_n65qkk$=function(t,e){return t<=e},ec.prototype.contains_mef7kx$=function(t){return t>=this._start_0&&t<=this._endInclusive_0},ec.prototype.isEmpty=function(){return!(this._start_0<=this._endInclusive_0)},ec.prototype.equals=function(e){return t.isType(e,ec)&&(this.isEmpty()&&e.isEmpty()||this._start_0===e._start_0&&this._endInclusive_0===e._endInclusive_0)},ec.prototype.hashCode=function(){return this.isEmpty()?-1:(31*N(this._start_0)|0)+N(this._endInclusive_0)|0},ec.prototype.toString=function(){return this._start_0.toString()+".."+this._endInclusive_0},ec.$metadata$={kind:p,simpleName:"ClosedDoubleRange",interfaces:[tc]},nc.$metadata$={kind:g,simpleName:"KClassifier",interfaces:[]},yc.prototype.nextChar=function(){var t,e;return t=this.index_0,this.index_0=t+1|0,e=t,this.this$iterator.charCodeAt(e)},yc.prototype.hasNext=function(){return this.index_00&&(this.counter=this.counter+1|0,this.counter>=this.this$DelimitedRangesSequence.limit_0)||this.nextSearchIndex>this.this$DelimitedRangesSequence.input_0.length)this.nextItem=new qe(this.currentStartIndex,gc(this.this$DelimitedRangesSequence.input_0)),this.nextSearchIndex=-1;else{var t=this.this$DelimitedRangesSequence.getNextMatch_0(this.this$DelimitedRangesSequence.input_0,this.nextSearchIndex);if(null==t)this.nextItem=new qe(this.currentStartIndex,gc(this.this$DelimitedRangesSequence.input_0)),this.nextSearchIndex=-1;else{var e=t.component1(),n=t.component2();this.nextItem=Pt(this.currentStartIndex,e),this.currentStartIndex=e+n|0,this.nextSearchIndex=this.currentStartIndex+(0===n?1:0)|0}}this.nextState=1}},Rc.prototype.next=function(){var e;if(-1===this.nextState&&this.calcNext_0(),0===this.nextState)throw Zn();var n=t.isType(e=this.nextItem,qe)?e:Yr();return this.nextItem=null,this.nextState=-1,n},Rc.prototype.hasNext=function(){return-1===this.nextState&&this.calcNext_0(),1===this.nextState},Rc.$metadata$={kind:p,interfaces:[pe]},Lc.prototype.iterator=function(){return new Rc(this)},Lc.$metadata$={kind:p,simpleName:"DelimitedRangesSequence",interfaces:[nl]},Uc.$metadata$={kind:g,simpleName:"MatchGroupCollection",interfaces:[ee]},Object.defineProperty(Fc.prototype,"destructured",{configurable:!0,get:function(){return new qc(this)}}),qc.prototype.component1=i("kotlin.kotlin.text.MatchResult.Destructured.component1",(function(){return this.match.groupValues.get_za3lpa$(1)})),qc.prototype.component2=i("kotlin.kotlin.text.MatchResult.Destructured.component2",(function(){return this.match.groupValues.get_za3lpa$(2)})),qc.prototype.component3=i("kotlin.kotlin.text.MatchResult.Destructured.component3",(function(){return this.match.groupValues.get_za3lpa$(3)})),qc.prototype.component4=i("kotlin.kotlin.text.MatchResult.Destructured.component4",(function(){return this.match.groupValues.get_za3lpa$(4)})),qc.prototype.component5=i("kotlin.kotlin.text.MatchResult.Destructured.component5",(function(){return this.match.groupValues.get_za3lpa$(5)})),qc.prototype.component6=i("kotlin.kotlin.text.MatchResult.Destructured.component6",(function(){return this.match.groupValues.get_za3lpa$(6)})),qc.prototype.component7=i("kotlin.kotlin.text.MatchResult.Destructured.component7",(function(){return this.match.groupValues.get_za3lpa$(7)})),qc.prototype.component8=i("kotlin.kotlin.text.MatchResult.Destructured.component8",(function(){return this.match.groupValues.get_za3lpa$(8)})),qc.prototype.component9=i("kotlin.kotlin.text.MatchResult.Destructured.component9",(function(){return this.match.groupValues.get_za3lpa$(9)})),qc.prototype.component10=i("kotlin.kotlin.text.MatchResult.Destructured.component10",(function(){return this.match.groupValues.get_za3lpa$(10)})),qc.prototype.toList=function(){return this.match.groupValues.subList_vux9f0$(1,this.match.groupValues.size)},qc.$metadata$={kind:p,simpleName:"Destructured",interfaces:[]},Fc.$metadata$={kind:g,simpleName:"MatchResult",interfaces:[]},Gc.$metadata$={kind:g,simpleName:"Lazy",interfaces:[]},Hc.$metadata$={kind:p,simpleName:"LazyThreadSafetyMode",interfaces:[x]},Hc.values=function(){return[Vc(),Kc(),Wc()]},Hc.valueOf_61zpoe$=function(t){switch(t){case"SYNCHRONIZED":return Vc();case"PUBLICATION":return Kc();case"NONE":return Wc();default:Vr("No enum constant kotlin.LazyThreadSafetyMode."+t)}},Xc.$metadata$={kind:b,simpleName:"UNINITIALIZED_VALUE",interfaces:[]};var Zc=null;function Jc(){return null===Zc&&new Xc,Zc}function Qc(t){this.initializer_0=t,this._value_0=Jc()}function tp(t){this.value_7taq70$_0=t}function ep(t){rp(),this.value=t}function np(){ip=this}Object.defineProperty(Qc.prototype,"value",{configurable:!0,get:function(){var e;return this._value_0===Jc()&&(this._value_0=E(this.initializer_0)(),this.initializer_0=null),null==(e=this._value_0)||t.isType(e,C)?e:Yr()}}),Qc.prototype.isInitialized=function(){return this._value_0!==Jc()},Qc.prototype.toString=function(){return this.isInitialized()?$(this.value):"Lazy value not initialized yet."},Qc.prototype.writeReplace_0=function(){return new tp(this.value)},Qc.$metadata$={kind:p,simpleName:"UnsafeLazyImpl",interfaces:[Kr,Gc]},Object.defineProperty(tp.prototype,"value",{get:function(){return this.value_7taq70$_0}}),tp.prototype.isInitialized=function(){return!0},tp.prototype.toString=function(){return $(this.value)},tp.$metadata$={kind:p,simpleName:"InitializedLazyImpl",interfaces:[Kr,Gc]},Object.defineProperty(ep.prototype,"isSuccess",{configurable:!0,get:function(){return!t.isType(this.value,op)}}),Object.defineProperty(ep.prototype,"isFailure",{configurable:!0,get:function(){return t.isType(this.value,op)}}),ep.prototype.getOrNull=i("kotlin.kotlin.Result.getOrNull",r((function(){var e=Object,n=t.throwCCE;return function(){var i;return this.isFailure?null:null==(i=this.value)||t.isType(i,e)?i:n()}}))),ep.prototype.exceptionOrNull=function(){return t.isType(this.value,op)?this.value.exception:null},ep.prototype.toString=function(){return t.isType(this.value,op)?this.value.toString():"Success("+$(this.value)+")"},np.prototype.success_mh5how$=i("kotlin.kotlin.Result.Companion.success_mh5how$",r((function(){var t=e.kotlin.Result;return function(e){return new t(e)}}))),np.prototype.failure_lsqlk3$=i("kotlin.kotlin.Result.Companion.failure_lsqlk3$",r((function(){var t=e.kotlin.createFailure_tcv7n7$,n=e.kotlin.Result;return function(e){return new n(t(e))}}))),np.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var ip=null;function rp(){return null===ip&&new np,ip}function op(t){this.exception=t}function ap(t){return new op(t)}function sp(e){if(t.isType(e.value,op))throw e.value.exception}function lp(t){void 0===t&&(t="An operation is not implemented."),Ln(t,this),this.name="NotImplementedError"}function up(t,e){this.first=t,this.second=e}function cp(t,e){return new up(t,e)}function pp(t,e,n){this.first=t,this.second=e,this.third=n}function hp(t){dp(),this.data=t}function _p(){fp=this,this.MIN_VALUE=new hp(0),this.MAX_VALUE=new hp(-1),this.SIZE_BYTES=1,this.SIZE_BITS=8}op.prototype.equals=function(e){return t.isType(e,op)&&o(this.exception,e.exception)},op.prototype.hashCode=function(){return N(this.exception)},op.prototype.toString=function(){return"Failure("+this.exception+")"},op.$metadata$={kind:p,simpleName:"Failure",interfaces:[Kr]},ep.$metadata$={kind:p,simpleName:"Result",interfaces:[Kr]},ep.prototype.unbox=function(){return this.value},ep.prototype.hashCode=function(){var e=0;return 31*e+t.hashCode(this.value)|0},ep.prototype.equals=function(e){return this===e||null!==e&&"object"==typeof e&&Object.getPrototypeOf(this)===Object.getPrototypeOf(e)&&t.equals(this.value,e.value)},lp.$metadata$={kind:p,simpleName:"NotImplementedError",interfaces:[jn]},up.prototype.toString=function(){return"("+this.first+", "+this.second+")"},up.$metadata$={kind:p,simpleName:"Pair",interfaces:[Kr]},up.prototype.component1=function(){return this.first},up.prototype.component2=function(){return this.second},up.prototype.copy_xwzc9p$=function(t,e){return new up(void 0===t?this.first:t,void 0===e?this.second:e)},up.prototype.hashCode=function(){var e=0;return 31*(e=31*e+t.hashCode(this.first)|0)+t.hashCode(this.second)|0},up.prototype.equals=function(e){return this===e||null!==e&&"object"==typeof e&&Object.getPrototypeOf(this)===Object.getPrototypeOf(e)&&t.equals(this.first,e.first)&&t.equals(this.second,e.second)},pp.prototype.toString=function(){return"("+this.first+", "+this.second+", "+this.third+")"},pp.$metadata$={kind:p,simpleName:"Triple",interfaces:[Kr]},pp.prototype.component1=function(){return this.first},pp.prototype.component2=function(){return this.second},pp.prototype.component3=function(){return this.third},pp.prototype.copy_1llc0w$=function(t,e,n){return new pp(void 0===t?this.first:t,void 0===e?this.second:e,void 0===n?this.third:n)},pp.prototype.hashCode=function(){var e=0;return 31*(e=31*(e=31*e+t.hashCode(this.first)|0)+t.hashCode(this.second)|0)+t.hashCode(this.third)|0},pp.prototype.equals=function(e){return this===e||null!==e&&"object"==typeof e&&Object.getPrototypeOf(this)===Object.getPrototypeOf(e)&&t.equals(this.first,e.first)&&t.equals(this.second,e.second)&&t.equals(this.third,e.third)},_p.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var fp=null;function dp(){return null===fp&&new _p,fp}function mp(t){vp(),this.data=t}function yp(){$p=this,this.MIN_VALUE=new mp(0),this.MAX_VALUE=new mp(-1),this.SIZE_BYTES=4,this.SIZE_BITS=32}hp.prototype.compareTo_11rb$=i("kotlin.kotlin.UByte.compareTo_11rb$",(function(e){return t.primitiveCompareTo(255&this.data,255&e.data)})),hp.prototype.compareTo_6hrhkk$=i("kotlin.kotlin.UByte.compareTo_6hrhkk$",(function(e){return t.primitiveCompareTo(255&this.data,65535&e.data)})),hp.prototype.compareTo_s87ys9$=i("kotlin.kotlin.UByte.compareTo_s87ys9$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintCompare_vux9f0$;return function(e){return n(new t(255&this.data).data,e.data)}}))),hp.prototype.compareTo_mpgczg$=i("kotlin.kotlin.UByte.compareTo_mpgczg$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong,r=e.kotlin.ulongCompare_3pjtqy$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)).data,e.data)}}))),hp.prototype.plus_mpmjao$=i("kotlin.kotlin.UByte.plus_mpmjao$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(255&this.data).data+new t(255&e.data).data|0)}}))),hp.prototype.plus_6hrhkk$=i("kotlin.kotlin.UByte.plus_6hrhkk$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(255&this.data).data+new t(65535&e.data).data|0)}}))),hp.prototype.plus_s87ys9$=i("kotlin.kotlin.UByte.plus_s87ys9$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(255&this.data).data+e.data|0)}}))),hp.prototype.plus_mpgczg$=i("kotlin.kotlin.UByte.plus_mpgczg$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong;return function(e){return new i(new i(t.Long.fromInt(this.data).and(n)).data.add(e.data))}}))),hp.prototype.minus_mpmjao$=i("kotlin.kotlin.UByte.minus_mpmjao$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(255&this.data).data-new t(255&e.data).data|0)}}))),hp.prototype.minus_6hrhkk$=i("kotlin.kotlin.UByte.minus_6hrhkk$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(255&this.data).data-new t(65535&e.data).data|0)}}))),hp.prototype.minus_s87ys9$=i("kotlin.kotlin.UByte.minus_s87ys9$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(255&this.data).data-e.data|0)}}))),hp.prototype.minus_mpgczg$=i("kotlin.kotlin.UByte.minus_mpgczg$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong;return function(e){return new i(new i(t.Long.fromInt(this.data).and(n)).data.subtract(e.data))}}))),hp.prototype.times_mpmjao$=i("kotlin.kotlin.UByte.times_mpmjao$",r((function(){var n=e.kotlin.UInt;return function(e){return new n(t.imul(new n(255&this.data).data,new n(255&e.data).data))}}))),hp.prototype.times_6hrhkk$=i("kotlin.kotlin.UByte.times_6hrhkk$",r((function(){var n=e.kotlin.UInt;return function(e){return new n(t.imul(new n(255&this.data).data,new n(65535&e.data).data))}}))),hp.prototype.times_s87ys9$=i("kotlin.kotlin.UByte.times_s87ys9$",r((function(){var n=e.kotlin.UInt;return function(e){return new n(t.imul(new n(255&this.data).data,e.data))}}))),hp.prototype.times_mpgczg$=i("kotlin.kotlin.UByte.times_mpgczg$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong;return function(e){return new i(new i(t.Long.fromInt(this.data).and(n)).data.multiply(e.data))}}))),hp.prototype.div_mpmjao$=i("kotlin.kotlin.UByte.div_mpmjao$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(255&this.data),new t(255&e.data))}}))),hp.prototype.div_6hrhkk$=i("kotlin.kotlin.UByte.div_6hrhkk$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(255&this.data),new t(65535&e.data))}}))),hp.prototype.div_s87ys9$=i("kotlin.kotlin.UByte.div_s87ys9$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(255&this.data),e)}}))),hp.prototype.div_mpgczg$=i("kotlin.kotlin.UByte.div_mpgczg$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),hp.prototype.rem_mpmjao$=i("kotlin.kotlin.UByte.rem_mpmjao$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintRemainder_oqfnby$;return function(e){return n(new t(255&this.data),new t(255&e.data))}}))),hp.prototype.rem_6hrhkk$=i("kotlin.kotlin.UByte.rem_6hrhkk$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintRemainder_oqfnby$;return function(e){return n(new t(255&this.data),new t(65535&e.data))}}))),hp.prototype.rem_s87ys9$=i("kotlin.kotlin.UByte.rem_s87ys9$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintRemainder_oqfnby$;return function(e){return n(new t(255&this.data),e)}}))),hp.prototype.rem_mpgczg$=i("kotlin.kotlin.UByte.rem_mpgczg$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),hp.prototype.floorDiv_mpmjao$=i("kotlin.kotlin.UByte.floorDiv_mpmjao$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(255&this.data),new t(255&e.data))}}))),hp.prototype.floorDiv_6hrhkk$=i("kotlin.kotlin.UByte.floorDiv_6hrhkk$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(255&this.data),new t(65535&e.data))}}))),hp.prototype.floorDiv_s87ys9$=i("kotlin.kotlin.UByte.floorDiv_s87ys9$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(255&this.data),e)}}))),hp.prototype.floorDiv_mpgczg$=i("kotlin.kotlin.UByte.floorDiv_mpgczg$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),hp.prototype.mod_mpmjao$=i("kotlin.kotlin.UByte.mod_mpmjao$",r((function(){var n=e.kotlin.UInt,i=e.kotlin.uintRemainder_oqfnby$,r=t.toByte,o=e.kotlin.UByte;return function(t){return new o(r(i(new n(255&this.data),new n(255&t.data)).data))}}))),hp.prototype.mod_6hrhkk$=i("kotlin.kotlin.UByte.mod_6hrhkk$",r((function(){var n=e.kotlin.UInt,i=e.kotlin.uintRemainder_oqfnby$,r=t.toShort,o=e.kotlin.UShort;return function(t){return new o(r(i(new n(255&this.data),new n(65535&t.data)).data))}}))),hp.prototype.mod_s87ys9$=i("kotlin.kotlin.UByte.mod_s87ys9$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintRemainder_oqfnby$;return function(e){return n(new t(255&this.data),e)}}))),hp.prototype.mod_mpgczg$=i("kotlin.kotlin.UByte.mod_mpgczg$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),hp.prototype.inc=i("kotlin.kotlin.UByte.inc",r((function(){var n=t.toByte,i=e.kotlin.UByte;return function(){return new i(n(this.data+1))}}))),hp.prototype.dec=i("kotlin.kotlin.UByte.dec",r((function(){var n=t.toByte,i=e.kotlin.UByte;return function(){return new i(n(this.data-1))}}))),hp.prototype.rangeTo_mpmjao$=i("kotlin.kotlin.UByte.rangeTo_mpmjao$",r((function(){var t=e.kotlin.ranges.UIntRange,n=e.kotlin.UInt;return function(e){return new t(new n(255&this.data),new n(255&e.data))}}))),hp.prototype.and_mpmjao$=i("kotlin.kotlin.UByte.and_mpmjao$",r((function(){var n=e.kotlin.UByte,i=t.toByte;return function(t){return new n(i(this.data&t.data))}}))),hp.prototype.or_mpmjao$=i("kotlin.kotlin.UByte.or_mpmjao$",r((function(){var n=e.kotlin.UByte,i=t.toByte;return function(t){return new n(i(this.data|t.data))}}))),hp.prototype.xor_mpmjao$=i("kotlin.kotlin.UByte.xor_mpmjao$",r((function(){var n=e.kotlin.UByte,i=t.toByte;return function(t){return new n(i(this.data^t.data))}}))),hp.prototype.inv=i("kotlin.kotlin.UByte.inv",r((function(){var n=e.kotlin.UByte,i=t.toByte;return function(){return new n(i(~this.data))}}))),hp.prototype.toByte=i("kotlin.kotlin.UByte.toByte",(function(){return this.data})),hp.prototype.toShort=i("kotlin.kotlin.UByte.toShort",r((function(){var e=t.toShort;return function(){return e(255&this.data)}}))),hp.prototype.toInt=i("kotlin.kotlin.UByte.toInt",(function(){return 255&this.data})),hp.prototype.toLong=i("kotlin.kotlin.UByte.toLong",r((function(){var e=t.Long.fromInt(255);return function(){return t.Long.fromInt(this.data).and(e)}}))),hp.prototype.toUByte=i("kotlin.kotlin.UByte.toUByte",(function(){return this})),hp.prototype.toUShort=i("kotlin.kotlin.UByte.toUShort",r((function(){var n=e.kotlin.UShort,i=t.toShort;return function(){return new n(i(255&this.data))}}))),hp.prototype.toUInt=i("kotlin.kotlin.UByte.toUInt",r((function(){var t=e.kotlin.UInt;return function(){return new t(255&this.data)}}))),hp.prototype.toULong=i("kotlin.kotlin.UByte.toULong",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong;return function(){return new i(t.Long.fromInt(this.data).and(n))}}))),hp.prototype.toFloat=i("kotlin.kotlin.UByte.toFloat",(function(){return 255&this.data})),hp.prototype.toDouble=i("kotlin.kotlin.UByte.toDouble",(function(){return 255&this.data})),hp.prototype.toString=function(){return(255&this.data).toString()},hp.$metadata$={kind:p,simpleName:"UByte",interfaces:[k]},hp.prototype.unbox=function(){return this.data},hp.prototype.hashCode=function(){var e=0;return 31*e+t.hashCode(this.data)|0},hp.prototype.equals=function(e){return this===e||null!==e&&"object"==typeof e&&Object.getPrototypeOf(this)===Object.getPrototypeOf(e)&&t.equals(this.data,e.data)},yp.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var $p=null;function vp(){return null===$p&&new yp,$p}function gp(t,e){xp(),kp.call(this,t,e,1)}function bp(){wp=this,this.EMPTY=new gp(vp().MAX_VALUE,vp().MIN_VALUE)}mp.prototype.compareTo_mpmjao$=i("kotlin.kotlin.UInt.compareTo_mpmjao$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintCompare_vux9f0$;return function(e){return n(this.data,new t(255&e.data).data)}}))),mp.prototype.compareTo_6hrhkk$=i("kotlin.kotlin.UInt.compareTo_6hrhkk$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintCompare_vux9f0$;return function(e){return n(this.data,new t(65535&e.data).data)}}))),mp.prototype.compareTo_11rb$=i("kotlin.kotlin.UInt.compareTo_11rb$",r((function(){var t=e.kotlin.uintCompare_vux9f0$;return function(e){return t(this.data,e.data)}}))),mp.prototype.compareTo_mpgczg$=i("kotlin.kotlin.UInt.compareTo_mpgczg$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong,r=e.kotlin.ulongCompare_3pjtqy$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)).data,e.data)}}))),mp.prototype.plus_mpmjao$=i("kotlin.kotlin.UInt.plus_mpmjao$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(this.data+new t(255&e.data).data|0)}}))),mp.prototype.plus_6hrhkk$=i("kotlin.kotlin.UInt.plus_6hrhkk$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(this.data+new t(65535&e.data).data|0)}}))),mp.prototype.plus_s87ys9$=i("kotlin.kotlin.UInt.plus_s87ys9$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(this.data+e.data|0)}}))),mp.prototype.plus_mpgczg$=i("kotlin.kotlin.UInt.plus_mpgczg$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong;return function(e){return new i(new i(t.Long.fromInt(this.data).and(n)).data.add(e.data))}}))),mp.prototype.minus_mpmjao$=i("kotlin.kotlin.UInt.minus_mpmjao$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(this.data-new t(255&e.data).data|0)}}))),mp.prototype.minus_6hrhkk$=i("kotlin.kotlin.UInt.minus_6hrhkk$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(this.data-new t(65535&e.data).data|0)}}))),mp.prototype.minus_s87ys9$=i("kotlin.kotlin.UInt.minus_s87ys9$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(this.data-e.data|0)}}))),mp.prototype.minus_mpgczg$=i("kotlin.kotlin.UInt.minus_mpgczg$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong;return function(e){return new i(new i(t.Long.fromInt(this.data).and(n)).data.subtract(e.data))}}))),mp.prototype.times_mpmjao$=i("kotlin.kotlin.UInt.times_mpmjao$",r((function(){var n=e.kotlin.UInt;return function(e){return new n(t.imul(this.data,new n(255&e.data).data))}}))),mp.prototype.times_6hrhkk$=i("kotlin.kotlin.UInt.times_6hrhkk$",r((function(){var n=e.kotlin.UInt;return function(e){return new n(t.imul(this.data,new n(65535&e.data).data))}}))),mp.prototype.times_s87ys9$=i("kotlin.kotlin.UInt.times_s87ys9$",r((function(){var n=e.kotlin.UInt;return function(e){return new n(t.imul(this.data,e.data))}}))),mp.prototype.times_mpgczg$=i("kotlin.kotlin.UInt.times_mpgczg$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong;return function(e){return new i(new i(t.Long.fromInt(this.data).and(n)).data.multiply(e.data))}}))),mp.prototype.div_mpmjao$=i("kotlin.kotlin.UInt.div_mpmjao$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(this,new t(255&e.data))}}))),mp.prototype.div_6hrhkk$=i("kotlin.kotlin.UInt.div_6hrhkk$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(this,new t(65535&e.data))}}))),mp.prototype.div_s87ys9$=i("kotlin.kotlin.UInt.div_s87ys9$",r((function(){var t=e.kotlin.uintDivide_oqfnby$;return function(e){return t(this,e)}}))),mp.prototype.div_mpgczg$=i("kotlin.kotlin.UInt.div_mpgczg$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),mp.prototype.rem_mpmjao$=i("kotlin.kotlin.UInt.rem_mpmjao$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintRemainder_oqfnby$;return function(e){return n(this,new t(255&e.data))}}))),mp.prototype.rem_6hrhkk$=i("kotlin.kotlin.UInt.rem_6hrhkk$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintRemainder_oqfnby$;return function(e){return n(this,new t(65535&e.data))}}))),mp.prototype.rem_s87ys9$=i("kotlin.kotlin.UInt.rem_s87ys9$",r((function(){var t=e.kotlin.uintRemainder_oqfnby$;return function(e){return t(this,e)}}))),mp.prototype.rem_mpgczg$=i("kotlin.kotlin.UInt.rem_mpgczg$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),mp.prototype.floorDiv_mpmjao$=i("kotlin.kotlin.UInt.floorDiv_mpmjao$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(this,new t(255&e.data))}}))),mp.prototype.floorDiv_6hrhkk$=i("kotlin.kotlin.UInt.floorDiv_6hrhkk$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(this,new t(65535&e.data))}}))),mp.prototype.floorDiv_s87ys9$=i("kotlin.kotlin.UInt.floorDiv_s87ys9$",r((function(){var t=e.kotlin.uintDivide_oqfnby$;return function(e){return t(this,e)}}))),mp.prototype.floorDiv_mpgczg$=i("kotlin.kotlin.UInt.floorDiv_mpgczg$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),mp.prototype.mod_mpmjao$=i("kotlin.kotlin.UInt.mod_mpmjao$",r((function(){var n=e.kotlin.UInt,i=e.kotlin.uintRemainder_oqfnby$,r=t.toByte,o=e.kotlin.UByte;return function(t){return new o(r(i(this,new n(255&t.data)).data))}}))),mp.prototype.mod_6hrhkk$=i("kotlin.kotlin.UInt.mod_6hrhkk$",r((function(){var n=e.kotlin.UInt,i=e.kotlin.uintRemainder_oqfnby$,r=t.toShort,o=e.kotlin.UShort;return function(t){return new o(r(i(this,new n(65535&t.data)).data))}}))),mp.prototype.mod_s87ys9$=i("kotlin.kotlin.UInt.mod_s87ys9$",r((function(){var t=e.kotlin.uintRemainder_oqfnby$;return function(e){return t(this,e)}}))),mp.prototype.mod_mpgczg$=i("kotlin.kotlin.UInt.mod_mpgczg$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),mp.prototype.inc=i("kotlin.kotlin.UInt.inc",r((function(){var t=e.kotlin.UInt;return function(){return new t(this.data+1|0)}}))),mp.prototype.dec=i("kotlin.kotlin.UInt.dec",r((function(){var t=e.kotlin.UInt;return function(){return new t(this.data-1|0)}}))),mp.prototype.rangeTo_s87ys9$=i("kotlin.kotlin.UInt.rangeTo_s87ys9$",r((function(){var t=e.kotlin.ranges.UIntRange;return function(e){return new t(this,e)}}))),mp.prototype.shl_za3lpa$=i("kotlin.kotlin.UInt.shl_za3lpa$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(this.data<>>e)}}))),mp.prototype.and_s87ys9$=i("kotlin.kotlin.UInt.and_s87ys9$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(this.data&e.data)}}))),mp.prototype.or_s87ys9$=i("kotlin.kotlin.UInt.or_s87ys9$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(this.data|e.data)}}))),mp.prototype.xor_s87ys9$=i("kotlin.kotlin.UInt.xor_s87ys9$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(this.data^e.data)}}))),mp.prototype.inv=i("kotlin.kotlin.UInt.inv",r((function(){var t=e.kotlin.UInt;return function(){return new t(~this.data)}}))),mp.prototype.toByte=i("kotlin.kotlin.UInt.toByte",r((function(){var e=t.toByte;return function(){return e(this.data)}}))),mp.prototype.toShort=i("kotlin.kotlin.UInt.toShort",r((function(){var e=t.toShort;return function(){return e(this.data)}}))),mp.prototype.toInt=i("kotlin.kotlin.UInt.toInt",(function(){return this.data})),mp.prototype.toLong=i("kotlin.kotlin.UInt.toLong",r((function(){var e=new t.Long(-1,0);return function(){return t.Long.fromInt(this.data).and(e)}}))),mp.prototype.toUByte=i("kotlin.kotlin.UInt.toUByte",r((function(){var n=t.toByte,i=e.kotlin.UByte;return function(){return new i(n(this.data))}}))),mp.prototype.toUShort=i("kotlin.kotlin.UInt.toUShort",r((function(){var n=t.toShort,i=e.kotlin.UShort;return function(){return new i(n(this.data))}}))),mp.prototype.toUInt=i("kotlin.kotlin.UInt.toUInt",(function(){return this})),mp.prototype.toULong=i("kotlin.kotlin.UInt.toULong",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong;return function(){return new i(t.Long.fromInt(this.data).and(n))}}))),mp.prototype.toFloat=i("kotlin.kotlin.UInt.toFloat",r((function(){var t=e.kotlin.uintToDouble_za3lpa$;return function(){return t(this.data)}}))),mp.prototype.toDouble=i("kotlin.kotlin.UInt.toDouble",r((function(){var t=e.kotlin.uintToDouble_za3lpa$;return function(){return t(this.data)}}))),mp.prototype.toString=function(){return t.Long.fromInt(this.data).and(v).toString()},mp.$metadata$={kind:p,simpleName:"UInt",interfaces:[k]},mp.prototype.unbox=function(){return this.data},mp.prototype.hashCode=function(){var e=0;return 31*e+t.hashCode(this.data)|0},mp.prototype.equals=function(e){return this===e||null!==e&&"object"==typeof e&&Object.getPrototypeOf(this)===Object.getPrototypeOf(e)&&t.equals(this.data,e.data)},Object.defineProperty(gp.prototype,"start",{configurable:!0,get:function(){return this.first}}),Object.defineProperty(gp.prototype,"endInclusive",{configurable:!0,get:function(){return this.last}}),gp.prototype.contains_mef7kx$=function(t){var e=Jp(this.first.data,t.data)<=0;return e&&(e=Jp(t.data,this.last.data)<=0),e},gp.prototype.isEmpty=function(){return Jp(this.first.data,this.last.data)>0},gp.prototype.equals=function(e){var n,i;return t.isType(e,gp)&&(this.isEmpty()&&e.isEmpty()||(null!=(n=this.first)?n.equals(e.first):null)&&(null!=(i=this.last)?i.equals(e.last):null))},gp.prototype.hashCode=function(){return this.isEmpty()?-1:(31*this.first.data|0)+this.last.data|0},gp.prototype.toString=function(){return this.first.toString()+".."+this.last},bp.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var wp=null;function xp(){return null===wp&&new bp,wp}function kp(t,e,n){if(Sp(),0===n)throw Mn("Step must be non-zero.");if(-2147483648===n)throw Mn("Step must be greater than Int.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=Yp(t,e,n),this.step=n}function Ep(){Cp=this}gp.$metadata$={kind:p,simpleName:"UIntRange",interfaces:[De,kp]},kp.prototype.iterator=function(){return new Tp(this.first,this.last,this.step)},kp.prototype.isEmpty=function(){return this.step>0?Jp(this.first.data,this.last.data)>0:Jp(this.first.data,this.last.data)<0},kp.prototype.equals=function(e){var n,i;return t.isType(e,kp)&&(this.isEmpty()&&e.isEmpty()||(null!=(n=this.first)?n.equals(e.first):null)&&(null!=(i=this.last)?i.equals(e.last):null)&&this.step===e.step)},kp.prototype.hashCode=function(){return this.isEmpty()?-1:(31*((31*this.first.data|0)+this.last.data|0)|0)+this.step|0},kp.prototype.toString=function(){return this.step>0?this.first.toString()+".."+this.last+" step "+this.step:this.first.toString()+" downTo "+this.last+" step "+(0|-this.step)},Ep.prototype.fromClosedRange_fjk8us$=function(t,e,n){return new kp(t,e,n)},Ep.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Cp=null;function Sp(){return null===Cp&&new Ep,Cp}function Tp(t,e,n){Op.call(this),this.finalElement_0=e,this.hasNext_0=n>0?Jp(t.data,e.data)<=0:Jp(t.data,e.data)>=0,this.step_0=new mp(n),this.next_0=this.hasNext_0?t:this.finalElement_0}function Op(){}function Np(){}function Pp(t){Lp(),this.data=t}function Ap(){jp=this,this.MIN_VALUE=new Pp(u),this.MAX_VALUE=new Pp(_),this.SIZE_BYTES=8,this.SIZE_BITS=64}kp.$metadata$={kind:p,simpleName:"UIntProgression",interfaces:[Qt]},Tp.prototype.hasNext=function(){return this.hasNext_0},Tp.prototype.nextUInt=function(){var t=this.next_0;if(null!=t&&t.equals(this.finalElement_0)){if(!this.hasNext_0)throw Zn();this.hasNext_0=!1}else this.next_0=new mp(this.next_0.data+this.step_0.data|0);return t},Tp.$metadata$={kind:p,simpleName:"UIntProgressionIterator",interfaces:[Op]},Op.prototype.next=function(){return this.nextUInt()},Op.$metadata$={kind:p,simpleName:"UIntIterator",interfaces:[pe]},Np.prototype.next=function(){return this.nextULong()},Np.$metadata$={kind:p,simpleName:"ULongIterator",interfaces:[pe]},Ap.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var jp=null;function Lp(){return null===jp&&new Ap,jp}function Rp(t,e){Dp(),Mp.call(this,t,e,w)}function Ip(){zp=this,this.EMPTY=new Rp(Lp().MAX_VALUE,Lp().MIN_VALUE)}Pp.prototype.compareTo_mpmjao$=i("kotlin.kotlin.ULong.compareTo_mpmjao$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong,r=e.kotlin.ulongCompare_3pjtqy$;return function(e){return r(this.data,new i(t.Long.fromInt(e.data).and(n)).data)}}))),Pp.prototype.compareTo_6hrhkk$=i("kotlin.kotlin.ULong.compareTo_6hrhkk$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong,r=e.kotlin.ulongCompare_3pjtqy$;return function(e){return r(this.data,new i(t.Long.fromInt(e.data).and(n)).data)}}))),Pp.prototype.compareTo_s87ys9$=i("kotlin.kotlin.ULong.compareTo_s87ys9$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong,r=e.kotlin.ulongCompare_3pjtqy$;return function(e){return r(this.data,new i(t.Long.fromInt(e.data).and(n)).data)}}))),Pp.prototype.compareTo_11rb$=i("kotlin.kotlin.ULong.compareTo_11rb$",r((function(){var t=e.kotlin.ulongCompare_3pjtqy$;return function(e){return t(this.data,e.data)}}))),Pp.prototype.plus_mpmjao$=i("kotlin.kotlin.ULong.plus_mpmjao$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong;return function(e){return new i(this.data.add(new i(t.Long.fromInt(e.data).and(n)).data))}}))),Pp.prototype.plus_6hrhkk$=i("kotlin.kotlin.ULong.plus_6hrhkk$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong;return function(e){return new i(this.data.add(new i(t.Long.fromInt(e.data).and(n)).data))}}))),Pp.prototype.plus_s87ys9$=i("kotlin.kotlin.ULong.plus_s87ys9$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong;return function(e){return new i(this.data.add(new i(t.Long.fromInt(e.data).and(n)).data))}}))),Pp.prototype.plus_mpgczg$=i("kotlin.kotlin.ULong.plus_mpgczg$",r((function(){var t=e.kotlin.ULong;return function(e){return new t(this.data.add(e.data))}}))),Pp.prototype.minus_mpmjao$=i("kotlin.kotlin.ULong.minus_mpmjao$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong;return function(e){return new i(this.data.subtract(new i(t.Long.fromInt(e.data).and(n)).data))}}))),Pp.prototype.minus_6hrhkk$=i("kotlin.kotlin.ULong.minus_6hrhkk$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong;return function(e){return new i(this.data.subtract(new i(t.Long.fromInt(e.data).and(n)).data))}}))),Pp.prototype.minus_s87ys9$=i("kotlin.kotlin.ULong.minus_s87ys9$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong;return function(e){return new i(this.data.subtract(new i(t.Long.fromInt(e.data).and(n)).data))}}))),Pp.prototype.minus_mpgczg$=i("kotlin.kotlin.ULong.minus_mpgczg$",r((function(){var t=e.kotlin.ULong;return function(e){return new t(this.data.subtract(e.data))}}))),Pp.prototype.times_mpmjao$=i("kotlin.kotlin.ULong.times_mpmjao$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong;return function(e){return new i(this.data.multiply(new i(t.Long.fromInt(e.data).and(n)).data))}}))),Pp.prototype.times_6hrhkk$=i("kotlin.kotlin.ULong.times_6hrhkk$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong;return function(e){return new i(this.data.multiply(new i(t.Long.fromInt(e.data).and(n)).data))}}))),Pp.prototype.times_s87ys9$=i("kotlin.kotlin.ULong.times_s87ys9$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong;return function(e){return new i(this.data.multiply(new i(t.Long.fromInt(e.data).and(n)).data))}}))),Pp.prototype.times_mpgczg$=i("kotlin.kotlin.ULong.times_mpgczg$",r((function(){var t=e.kotlin.ULong;return function(e){return new t(this.data.multiply(e.data))}}))),Pp.prototype.div_mpmjao$=i("kotlin.kotlin.ULong.div_mpmjao$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(this,new i(t.Long.fromInt(e.data).and(n)))}}))),Pp.prototype.div_6hrhkk$=i("kotlin.kotlin.ULong.div_6hrhkk$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(this,new i(t.Long.fromInt(e.data).and(n)))}}))),Pp.prototype.div_s87ys9$=i("kotlin.kotlin.ULong.div_s87ys9$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(this,new i(t.Long.fromInt(e.data).and(n)))}}))),Pp.prototype.div_mpgczg$=i("kotlin.kotlin.ULong.div_mpgczg$",r((function(){var t=e.kotlin.ulongDivide_jpm79w$;return function(e){return t(this,e)}}))),Pp.prototype.rem_mpmjao$=i("kotlin.kotlin.ULong.rem_mpmjao$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$;return function(e){return r(this,new i(t.Long.fromInt(e.data).and(n)))}}))),Pp.prototype.rem_6hrhkk$=i("kotlin.kotlin.ULong.rem_6hrhkk$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$;return function(e){return r(this,new i(t.Long.fromInt(e.data).and(n)))}}))),Pp.prototype.rem_s87ys9$=i("kotlin.kotlin.ULong.rem_s87ys9$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$;return function(e){return r(this,new i(t.Long.fromInt(e.data).and(n)))}}))),Pp.prototype.rem_mpgczg$=i("kotlin.kotlin.ULong.rem_mpgczg$",r((function(){var t=e.kotlin.ulongRemainder_jpm79w$;return function(e){return t(this,e)}}))),Pp.prototype.floorDiv_mpmjao$=i("kotlin.kotlin.ULong.floorDiv_mpmjao$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(this,new i(t.Long.fromInt(e.data).and(n)))}}))),Pp.prototype.floorDiv_6hrhkk$=i("kotlin.kotlin.ULong.floorDiv_6hrhkk$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(this,new i(t.Long.fromInt(e.data).and(n)))}}))),Pp.prototype.floorDiv_s87ys9$=i("kotlin.kotlin.ULong.floorDiv_s87ys9$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(this,new i(t.Long.fromInt(e.data).and(n)))}}))),Pp.prototype.floorDiv_mpgczg$=i("kotlin.kotlin.ULong.floorDiv_mpgczg$",r((function(){var t=e.kotlin.ulongDivide_jpm79w$;return function(e){return t(this,e)}}))),Pp.prototype.mod_mpmjao$=i("kotlin.kotlin.ULong.mod_mpmjao$",r((function(){var n=t.Long.fromInt(255),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$,o=t.toByte,a=e.kotlin.UByte;return function(e){return new a(o(r(this,new i(t.Long.fromInt(e.data).and(n))).data.toInt()))}}))),Pp.prototype.mod_6hrhkk$=i("kotlin.kotlin.ULong.mod_6hrhkk$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$,o=t.toShort,a=e.kotlin.UShort;return function(e){return new a(o(r(this,new i(t.Long.fromInt(e.data).and(n))).data.toInt()))}}))),Pp.prototype.mod_s87ys9$=i("kotlin.kotlin.ULong.mod_s87ys9$",r((function(){var n=new t.Long(-1,0),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$,o=e.kotlin.UInt;return function(e){return new o(r(this,new i(t.Long.fromInt(e.data).and(n))).data.toInt())}}))),Pp.prototype.mod_mpgczg$=i("kotlin.kotlin.ULong.mod_mpgczg$",r((function(){var t=e.kotlin.ulongRemainder_jpm79w$;return function(e){return t(this,e)}}))),Pp.prototype.inc=i("kotlin.kotlin.ULong.inc",r((function(){var t=e.kotlin.ULong;return function(){return new t(this.data.inc())}}))),Pp.prototype.dec=i("kotlin.kotlin.ULong.dec",r((function(){var t=e.kotlin.ULong;return function(){return new t(this.data.dec())}}))),Pp.prototype.rangeTo_mpgczg$=i("kotlin.kotlin.ULong.rangeTo_mpgczg$",r((function(){var t=e.kotlin.ranges.ULongRange;return function(e){return new t(this,e)}}))),Pp.prototype.shl_za3lpa$=i("kotlin.kotlin.ULong.shl_za3lpa$",r((function(){var t=e.kotlin.ULong;return function(e){return new t(this.data.shiftLeft(e))}}))),Pp.prototype.shr_za3lpa$=i("kotlin.kotlin.ULong.shr_za3lpa$",r((function(){var t=e.kotlin.ULong;return function(e){return new t(this.data.shiftRightUnsigned(e))}}))),Pp.prototype.and_mpgczg$=i("kotlin.kotlin.ULong.and_mpgczg$",r((function(){var t=e.kotlin.ULong;return function(e){return new t(this.data.and(e.data))}}))),Pp.prototype.or_mpgczg$=i("kotlin.kotlin.ULong.or_mpgczg$",r((function(){var t=e.kotlin.ULong;return function(e){return new t(this.data.or(e.data))}}))),Pp.prototype.xor_mpgczg$=i("kotlin.kotlin.ULong.xor_mpgczg$",r((function(){var t=e.kotlin.ULong;return function(e){return new t(this.data.xor(e.data))}}))),Pp.prototype.inv=i("kotlin.kotlin.ULong.inv",r((function(){var t=e.kotlin.ULong;return function(){return new t(this.data.inv())}}))),Pp.prototype.toByte=i("kotlin.kotlin.ULong.toByte",r((function(){var e=t.toByte;return function(){return e(this.data.toInt())}}))),Pp.prototype.toShort=i("kotlin.kotlin.ULong.toShort",r((function(){var e=t.toShort;return function(){return e(this.data.toInt())}}))),Pp.prototype.toInt=i("kotlin.kotlin.ULong.toInt",(function(){return this.data.toInt()})),Pp.prototype.toLong=i("kotlin.kotlin.ULong.toLong",(function(){return this.data})),Pp.prototype.toUByte=i("kotlin.kotlin.ULong.toUByte",r((function(){var n=t.toByte,i=e.kotlin.UByte;return function(){return new i(n(this.data.toInt()))}}))),Pp.prototype.toUShort=i("kotlin.kotlin.ULong.toUShort",r((function(){var n=t.toShort,i=e.kotlin.UShort;return function(){return new i(n(this.data.toInt()))}}))),Pp.prototype.toUInt=i("kotlin.kotlin.ULong.toUInt",r((function(){var t=e.kotlin.UInt;return function(){return new t(this.data.toInt())}}))),Pp.prototype.toULong=i("kotlin.kotlin.ULong.toULong",(function(){return this})),Pp.prototype.toFloat=i("kotlin.kotlin.ULong.toFloat",r((function(){var t=e.kotlin.ulongToDouble_s8cxhz$;return function(){return t(this.data)}}))),Pp.prototype.toDouble=i("kotlin.kotlin.ULong.toDouble",r((function(){var t=e.kotlin.ulongToDouble_s8cxhz$;return function(){return t(this.data)}}))),Pp.prototype.toString=function(){return nh(this.data)},Pp.$metadata$={kind:p,simpleName:"ULong",interfaces:[k]},Pp.prototype.unbox=function(){return this.data},Pp.prototype.hashCode=function(){var e=0;return 31*e+t.hashCode(this.data)|0},Pp.prototype.equals=function(e){return this===e||null!==e&&"object"==typeof e&&Object.getPrototypeOf(this)===Object.getPrototypeOf(e)&&t.equals(this.data,e.data)},Object.defineProperty(Rp.prototype,"start",{configurable:!0,get:function(){return this.first}}),Object.defineProperty(Rp.prototype,"endInclusive",{configurable:!0,get:function(){return this.last}}),Rp.prototype.contains_mef7kx$=function(t){var e=Qp(this.first.data,t.data)<=0;return e&&(e=Qp(t.data,this.last.data)<=0),e},Rp.prototype.isEmpty=function(){return Qp(this.first.data,this.last.data)>0},Rp.prototype.equals=function(e){var n,i;return t.isType(e,Rp)&&(this.isEmpty()&&e.isEmpty()||(null!=(n=this.first)?n.equals(e.first):null)&&(null!=(i=this.last)?i.equals(e.last):null))},Rp.prototype.hashCode=function(){return this.isEmpty()?-1:(31*new Pp(this.first.data.xor(new Pp(this.first.data.shiftRightUnsigned(32)).data)).data.toInt()|0)+new Pp(this.last.data.xor(new Pp(this.last.data.shiftRightUnsigned(32)).data)).data.toInt()|0},Rp.prototype.toString=function(){return this.first.toString()+".."+this.last},Ip.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var zp=null;function Dp(){return null===zp&&new Ip,zp}function Mp(t,e,n){if(Fp(),o(n,u))throw Mn("Step must be non-zero.");if(o(n,m))throw Mn("Step must be greater than Long.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=Vp(t,e,n),this.step=n}function Bp(){Up=this}Rp.$metadata$={kind:p,simpleName:"ULongRange",interfaces:[De,Mp]},Mp.prototype.iterator=function(){return new qp(this.first,this.last,this.step)},Mp.prototype.isEmpty=function(){return this.step.toNumber()>0?Qp(this.first.data,this.last.data)>0:Qp(this.first.data,this.last.data)<0},Mp.prototype.equals=function(e){var n,i;return t.isType(e,Mp)&&(this.isEmpty()&&e.isEmpty()||(null!=(n=this.first)?n.equals(e.first):null)&&(null!=(i=this.last)?i.equals(e.last):null)&&o(this.step,e.step))},Mp.prototype.hashCode=function(){return this.isEmpty()?-1:(31*((31*new Pp(this.first.data.xor(new Pp(this.first.data.shiftRightUnsigned(32)).data)).data.toInt()|0)+new Pp(this.last.data.xor(new Pp(this.last.data.shiftRightUnsigned(32)).data)).data.toInt()|0)|0)+this.step.xor(this.step.shiftRightUnsigned(32)).toInt()|0},Mp.prototype.toString=function(){return this.step.toNumber()>0?this.first.toString()+".."+this.last+" step "+this.step.toString():this.first.toString()+" downTo "+this.last+" step "+this.step.unaryMinus().toString()},Bp.prototype.fromClosedRange_15zasp$=function(t,e,n){return new Mp(t,e,n)},Bp.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Up=null;function Fp(){return null===Up&&new Bp,Up}function qp(t,e,n){Np.call(this),this.finalElement_0=e,this.hasNext_0=n.toNumber()>0?Qp(t.data,e.data)<=0:Qp(t.data,e.data)>=0,this.step_0=new Pp(n),this.next_0=this.hasNext_0?t:this.finalElement_0}function Gp(t,e,n){var i=th(t,n),r=th(e,n);return Jp(i.data,r.data)>=0?new mp(i.data-r.data|0):new mp(new mp(i.data-r.data|0).data+n.data|0)}function Hp(t,e,n){var i=eh(t,n),r=eh(e,n);return Qp(i.data,r.data)>=0?new Pp(i.data.subtract(r.data)):new Pp(new Pp(i.data.subtract(r.data)).data.add(n.data))}function Yp(t,e,n){if(n>0)return Jp(t.data,e.data)>=0?e:new mp(e.data-Gp(e,t,new mp(n)).data|0);if(n<0)return Jp(t.data,e.data)<=0?e:new mp(e.data+Gp(t,e,new mp(0|-n)).data|0);throw Mn("Step is zero.")}function Vp(t,e,n){if(n.toNumber()>0)return Qp(t.data,e.data)>=0?e:new Pp(e.data.subtract(Hp(e,t,new Pp(n)).data));if(n.toNumber()<0)return Qp(t.data,e.data)<=0?e:new Pp(e.data.add(Hp(t,e,new Pp(n.unaryMinus())).data));throw Mn("Step is zero.")}function Kp(t){Zp(),this.data=t}function Wp(){Xp=this,this.MIN_VALUE=new Kp(0),this.MAX_VALUE=new Kp(-1),this.SIZE_BYTES=2,this.SIZE_BITS=16}Mp.$metadata$={kind:p,simpleName:"ULongProgression",interfaces:[Qt]},qp.prototype.hasNext=function(){return this.hasNext_0},qp.prototype.nextULong=function(){var t=this.next_0;if(null!=t&&t.equals(this.finalElement_0)){if(!this.hasNext_0)throw Zn();this.hasNext_0=!1}else this.next_0=new Pp(this.next_0.data.add(this.step_0.data));return t},qp.$metadata$={kind:p,simpleName:"ULongProgressionIterator",interfaces:[Np]},Wp.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Xp=null;function Zp(){return null===Xp&&new Wp,Xp}function Jp(e,n){return t.primitiveCompareTo(-2147483648^e,-2147483648^n)}function Qp(t,e){return t.xor(m).compareTo_11rb$(e.xor(m))}function th(e,n){return new mp(t.Long.fromInt(e.data).and(v).modulo(t.Long.fromInt(n.data).and(v)).toInt())}function eh(t,e){var n=t.data,i=e.data;if(i.toNumber()<0)return Qp(t.data,e.data)<0?t:new Pp(t.data.subtract(e.data));if(n.toNumber()>=0)return new Pp(n.modulo(i));var r=n.shiftRightUnsigned(1).div(i).shiftLeft(1),o=n.subtract(r.multiply(i));return new Pp(o.subtract(Qp(new Pp(o).data,new Pp(i).data)>=0?i:u))}function nh(t){return ih(t,10)}function ih(e,n){if(e.toNumber()>=0)return oi(e,n);var i=e.shiftRightUnsigned(1).div(t.Long.fromInt(n)).shiftLeft(1),r=e.subtract(i.multiply(t.Long.fromInt(n)));return r.toNumber()>=n&&(r=r.subtract(t.Long.fromInt(n)),i=i.add(t.Long.fromInt(1))),oi(i,n)+oi(r,n)}Kp.prototype.compareTo_mpmjao$=i("kotlin.kotlin.UShort.compareTo_mpmjao$",(function(e){return t.primitiveCompareTo(65535&this.data,255&e.data)})),Kp.prototype.compareTo_11rb$=i("kotlin.kotlin.UShort.compareTo_11rb$",(function(e){return t.primitiveCompareTo(65535&this.data,65535&e.data)})),Kp.prototype.compareTo_s87ys9$=i("kotlin.kotlin.UShort.compareTo_s87ys9$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintCompare_vux9f0$;return function(e){return n(new t(65535&this.data).data,e.data)}}))),Kp.prototype.compareTo_mpgczg$=i("kotlin.kotlin.UShort.compareTo_mpgczg$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong,r=e.kotlin.ulongCompare_3pjtqy$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)).data,e.data)}}))),Kp.prototype.plus_mpmjao$=i("kotlin.kotlin.UShort.plus_mpmjao$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(65535&this.data).data+new t(255&e.data).data|0)}}))),Kp.prototype.plus_6hrhkk$=i("kotlin.kotlin.UShort.plus_6hrhkk$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(65535&this.data).data+new t(65535&e.data).data|0)}}))),Kp.prototype.plus_s87ys9$=i("kotlin.kotlin.UShort.plus_s87ys9$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(65535&this.data).data+e.data|0)}}))),Kp.prototype.plus_mpgczg$=i("kotlin.kotlin.UShort.plus_mpgczg$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong;return function(e){return new i(new i(t.Long.fromInt(this.data).and(n)).data.add(e.data))}}))),Kp.prototype.minus_mpmjao$=i("kotlin.kotlin.UShort.minus_mpmjao$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(65535&this.data).data-new t(255&e.data).data|0)}}))),Kp.prototype.minus_6hrhkk$=i("kotlin.kotlin.UShort.minus_6hrhkk$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(65535&this.data).data-new t(65535&e.data).data|0)}}))),Kp.prototype.minus_s87ys9$=i("kotlin.kotlin.UShort.minus_s87ys9$",r((function(){var t=e.kotlin.UInt;return function(e){return new t(new t(65535&this.data).data-e.data|0)}}))),Kp.prototype.minus_mpgczg$=i("kotlin.kotlin.UShort.minus_mpgczg$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong;return function(e){return new i(new i(t.Long.fromInt(this.data).and(n)).data.subtract(e.data))}}))),Kp.prototype.times_mpmjao$=i("kotlin.kotlin.UShort.times_mpmjao$",r((function(){var n=e.kotlin.UInt;return function(e){return new n(t.imul(new n(65535&this.data).data,new n(255&e.data).data))}}))),Kp.prototype.times_6hrhkk$=i("kotlin.kotlin.UShort.times_6hrhkk$",r((function(){var n=e.kotlin.UInt;return function(e){return new n(t.imul(new n(65535&this.data).data,new n(65535&e.data).data))}}))),Kp.prototype.times_s87ys9$=i("kotlin.kotlin.UShort.times_s87ys9$",r((function(){var n=e.kotlin.UInt;return function(e){return new n(t.imul(new n(65535&this.data).data,e.data))}}))),Kp.prototype.times_mpgczg$=i("kotlin.kotlin.UShort.times_mpgczg$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong;return function(e){return new i(new i(t.Long.fromInt(this.data).and(n)).data.multiply(e.data))}}))),Kp.prototype.div_mpmjao$=i("kotlin.kotlin.UShort.div_mpmjao$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(65535&this.data),new t(255&e.data))}}))),Kp.prototype.div_6hrhkk$=i("kotlin.kotlin.UShort.div_6hrhkk$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(65535&this.data),new t(65535&e.data))}}))),Kp.prototype.div_s87ys9$=i("kotlin.kotlin.UShort.div_s87ys9$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(65535&this.data),e)}}))),Kp.prototype.div_mpgczg$=i("kotlin.kotlin.UShort.div_mpgczg$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),Kp.prototype.rem_mpmjao$=i("kotlin.kotlin.UShort.rem_mpmjao$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintRemainder_oqfnby$;return function(e){return n(new t(65535&this.data),new t(255&e.data))}}))),Kp.prototype.rem_6hrhkk$=i("kotlin.kotlin.UShort.rem_6hrhkk$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintRemainder_oqfnby$;return function(e){return n(new t(65535&this.data),new t(65535&e.data))}}))),Kp.prototype.rem_s87ys9$=i("kotlin.kotlin.UShort.rem_s87ys9$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintRemainder_oqfnby$;return function(e){return n(new t(65535&this.data),e)}}))),Kp.prototype.rem_mpgczg$=i("kotlin.kotlin.UShort.rem_mpgczg$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),Kp.prototype.floorDiv_mpmjao$=i("kotlin.kotlin.UShort.floorDiv_mpmjao$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(65535&this.data),new t(255&e.data))}}))),Kp.prototype.floorDiv_6hrhkk$=i("kotlin.kotlin.UShort.floorDiv_6hrhkk$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(65535&this.data),new t(65535&e.data))}}))),Kp.prototype.floorDiv_s87ys9$=i("kotlin.kotlin.UShort.floorDiv_s87ys9$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintDivide_oqfnby$;return function(e){return n(new t(65535&this.data),e)}}))),Kp.prototype.floorDiv_mpgczg$=i("kotlin.kotlin.UShort.floorDiv_mpgczg$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong,r=e.kotlin.ulongDivide_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),Kp.prototype.mod_mpmjao$=i("kotlin.kotlin.UShort.mod_mpmjao$",r((function(){var n=e.kotlin.UInt,i=e.kotlin.uintRemainder_oqfnby$,r=t.toByte,o=e.kotlin.UByte;return function(t){return new o(r(i(new n(65535&this.data),new n(255&t.data)).data))}}))),Kp.prototype.mod_6hrhkk$=i("kotlin.kotlin.UShort.mod_6hrhkk$",r((function(){var n=e.kotlin.UInt,i=e.kotlin.uintRemainder_oqfnby$,r=t.toShort,o=e.kotlin.UShort;return function(t){return new o(r(i(new n(65535&this.data),new n(65535&t.data)).data))}}))),Kp.prototype.mod_s87ys9$=i("kotlin.kotlin.UShort.mod_s87ys9$",r((function(){var t=e.kotlin.UInt,n=e.kotlin.uintRemainder_oqfnby$;return function(e){return n(new t(65535&this.data),e)}}))),Kp.prototype.mod_mpgczg$=i("kotlin.kotlin.UShort.mod_mpgczg$",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong,r=e.kotlin.ulongRemainder_jpm79w$;return function(e){return r(new i(t.Long.fromInt(this.data).and(n)),e)}}))),Kp.prototype.inc=i("kotlin.kotlin.UShort.inc",r((function(){var n=t.toShort,i=e.kotlin.UShort;return function(){return new i(n(this.data+1))}}))),Kp.prototype.dec=i("kotlin.kotlin.UShort.dec",r((function(){var n=t.toShort,i=e.kotlin.UShort;return function(){return new i(n(this.data-1))}}))),Kp.prototype.rangeTo_6hrhkk$=i("kotlin.kotlin.UShort.rangeTo_6hrhkk$",r((function(){var t=e.kotlin.ranges.UIntRange,n=e.kotlin.UInt;return function(e){return new t(new n(65535&this.data),new n(65535&e.data))}}))),Kp.prototype.and_6hrhkk$=i("kotlin.kotlin.UShort.and_6hrhkk$",r((function(){var n=e.kotlin.UShort,i=t.toShort;return function(t){return new n(i(this.data&t.data))}}))),Kp.prototype.or_6hrhkk$=i("kotlin.kotlin.UShort.or_6hrhkk$",r((function(){var n=e.kotlin.UShort,i=t.toShort;return function(t){return new n(i(this.data|t.data))}}))),Kp.prototype.xor_6hrhkk$=i("kotlin.kotlin.UShort.xor_6hrhkk$",r((function(){var n=e.kotlin.UShort,i=t.toShort;return function(t){return new n(i(this.data^t.data))}}))),Kp.prototype.inv=i("kotlin.kotlin.UShort.inv",r((function(){var n=e.kotlin.UShort,i=t.toShort;return function(){return new n(i(~this.data))}}))),Kp.prototype.toByte=i("kotlin.kotlin.UShort.toByte",r((function(){var e=t.toByte;return function(){return e(this.data)}}))),Kp.prototype.toShort=i("kotlin.kotlin.UShort.toShort",(function(){return this.data})),Kp.prototype.toInt=i("kotlin.kotlin.UShort.toInt",(function(){return 65535&this.data})),Kp.prototype.toLong=i("kotlin.kotlin.UShort.toLong",r((function(){var e=t.Long.fromInt(65535);return function(){return t.Long.fromInt(this.data).and(e)}}))),Kp.prototype.toUByte=i("kotlin.kotlin.UShort.toUByte",r((function(){var n=t.toByte,i=e.kotlin.UByte;return function(){return new i(n(this.data))}}))),Kp.prototype.toUShort=i("kotlin.kotlin.UShort.toUShort",(function(){return this})),Kp.prototype.toUInt=i("kotlin.kotlin.UShort.toUInt",r((function(){var t=e.kotlin.UInt;return function(){return new t(65535&this.data)}}))),Kp.prototype.toULong=i("kotlin.kotlin.UShort.toULong",r((function(){var n=t.Long.fromInt(65535),i=e.kotlin.ULong;return function(){return new i(t.Long.fromInt(this.data).and(n))}}))),Kp.prototype.toFloat=i("kotlin.kotlin.UShort.toFloat",(function(){return 65535&this.data})),Kp.prototype.toDouble=i("kotlin.kotlin.UShort.toDouble",(function(){return 65535&this.data})),Kp.prototype.toString=function(){return(65535&this.data).toString()},Kp.$metadata$={kind:p,simpleName:"UShort",interfaces:[k]},Kp.prototype.unbox=function(){return this.data},Kp.prototype.hashCode=function(){var e=0;return 31*e+t.hashCode(this.data)|0},Kp.prototype.equals=function(e){return this===e||null!==e&&"object"==typeof e&&Object.getPrototypeOf(this)===Object.getPrototypeOf(e)&&t.equals(this.data,e.data)};var rh=e.kotlin||(e.kotlin={}),oh=rh.collections||(rh.collections={});oh.contains_mjy6jw$=B,oh.contains_o2f9me$=U,oh.get_lastIndex_m7z4lg$=X,oh.get_lastIndex_bvy38s$=Z,oh.indexOf_mjy6jw$=F,oh.indexOf_o2f9me$=q,oh.get_indices_m7z4lg$=W;var ah=rh.ranges||(rh.ranges={});ah.reversed_zf1xzc$=Nt,oh.get_indices_bvy38s$=function(t){return new qe(0,Z(t))},oh.last_us0mfu$=function(t){if(0===t.length)throw new Xn("Array is empty.");return t[X(t)]},oh.lastIndexOf_mjy6jw$=G;var sh=rh.random||(rh.random={});sh.Random=ju,oh.single_355ntz$=H,rh.IllegalArgumentException_init_pdl1vj$=Mn,oh.dropLast_8ujjk8$=function(t,e){if(!(e>=0))throw Mn(("Requested element count "+e+" is less than zero.").toString());return K(t,At(t.length-e|0,0))},oh.take_8ujjk8$=K,oh.emptyList_287e2$=$s,oh.ArrayList_init_287e2$=Ki,oh.filterNotNull_emfgvx$=Y,oh.filterNotNullTo_hhiqfl$=V,oh.toList_us0mfu$=Q,oh.sortWith_iwcb0m$=pi,oh.mapCapacity_za3lpa$=ji,ah.coerceAtLeast_dqglrj$=At,oh.LinkedHashMap_init_bwtc7$=Ar,ah.coerceAtMost_dqglrj$=jt,oh.toCollection_5n4o2z$=J,oh.toMutableList_us0mfu$=tt,oh.toMutableList_bvy38s$=function(t){var e,n=Wi(t.length);for(e=0;e!==t.length;++e){var i=t[e];n.add_11rb$(i)}return n},oh.toSet_us0mfu$=et,oh.addAll_ipc267$=Ws,oh.LinkedHashMap_init_q3lmfv$=Nr,oh.Grouping=Ss,oh.ArrayList_init_ww73n8$=Wi,oh.HashSet_init_287e2$=$r,rh.NoSuchElementException_init=Zn,rh.UnsupportedOperationException_init_pdl1vj$=Hn,oh.listOf_mh5how$=ki,oh.collectionSizeOrDefault_ba2ldo$=Ps,oh.zip_pmvpm9$=function(t,e){for(var n=c.min(t.length,e.length),i=Wi(n),r=0;r=0&&e<=ws(t)?t.get_za3lpa$(e):null},oh.first_7wnvza$=lt,oh.first_2p1efm$=ut,oh.firstOrNull_7wnvza$=function(e){if(t.isType(e,ie))return e.isEmpty()?null:e.get_za3lpa$(0);var n=e.iterator();return n.hasNext()?n.next():null},oh.firstOrNull_2p1efm$=function(t){return t.isEmpty()?null:t.get_za3lpa$(0)},oh.indexOf_2ws7j4$=ct,oh.checkIndexOverflow_za3lpa$=Pi,oh.last_7wnvza$=pt,oh.last_2p1efm$=ht,oh.lastOrNull_2p1efm$=function(t){return t.isEmpty()?null:t.get_za3lpa$(t.size-1|0)},oh.random_iscd7z$=function(t,e){if(t.isEmpty())throw new Xn("Collection is empty.");return at(t,e.nextInt_za3lpa$(t.size))},oh.single_7wnvza$=_t,oh.single_2p1efm$=ft,oh.drop_ba2ldo$=function(e,n){var i,r,o,a;if(!(n>=0))throw Mn(("Requested element count "+n+" is less than zero.").toString());if(0===n)return gt(e);if(t.isType(e,ee)){var s=e.size-n|0;if(s<=0)return $s();if(1===s)return ki(pt(e));if(a=Wi(s),t.isType(e,ie)){if(t.isType(e,Mr)){i=e.size;for(var l=n;l=n?a.add_11rb$(p):c=c+1|0}return xs(a)},oh.take_ba2ldo$=function(e,n){var i;if(!(n>=0))throw Mn(("Requested element count "+n+" is less than zero.").toString());if(0===n)return $s();if(t.isType(e,ee)){if(n>=e.size)return gt(e);if(1===n)return ki(lt(e))}var r=0,o=Wi(n);for(i=e.iterator();i.hasNext();){var a=i.next();if(o.add_11rb$(a),(r=r+1|0)===n)break}return xs(o)},oh.filterNotNull_m3lr2h$=function(t){return dt(t,Ki())},oh.filterNotNullTo_u9kwcl$=dt,oh.toList_7wnvza$=gt,oh.reversed_7wnvza$=function(e){if(t.isType(e,ee)&&e.size<=1)return gt(e);var n=bt(e);return hi(n),n},oh.shuffle_9jeydg$=mt,oh.sortWith_nqfjgj$=Ti,oh.sorted_exjks8$=function(e){var n;if(t.isType(e,ee)){if(e.size<=1)return gt(e);var i=t.isArray(n=bi(e))?n:Yr();return ci(i),ai(i)}var r=bt(e);return Si(r),r},oh.sortedWith_eknfly$=yt,oh.sortedDescending_exjks8$=function(t){return yt(t,Zl())},oh.toByteArray_kdx1v$=function(t){var e,n,i=new Int8Array(t.size),r=0;for(e=t.iterator();e.hasNext();){var o=e.next();i[(n=r,r=n+1|0,n)]=o}return i},oh.toDoubleArray_tcduak$=function(t){var e,n,i=new Float64Array(t.size),r=0;for(e=t.iterator();e.hasNext();){var o=e.next();i[(n=r,r=n+1|0,n)]=o}return i},oh.toLongArray_558emf$=function(e){var n,i,r=t.longArray(e.size),o=0;for(n=e.iterator();n.hasNext();){var a=n.next();r[(i=o,o=i+1|0,i)]=a}return r},oh.toCollection_5cfyqp$=$t,oh.toHashSet_7wnvza$=vt,oh.toMutableList_7wnvza$=bt,oh.toMutableList_4c7yge$=wt,oh.toSet_7wnvza$=xt,oh.withIndex_7wnvza$=function(t){return new Os((e=t,function(){return e.iterator()}));var e},oh.distinct_7wnvza$=function(t){return gt(kt(t))},oh.intersect_q4559j$=function(t,e){var n=kt(t);return Zs(n,e),n},oh.subtract_q4559j$=function(t,e){var n=kt(t);return Xs(n,e),n},oh.toMutableSet_7wnvza$=kt,oh.Collection=ee,oh.count_7wnvza$=function(e){var n;if(t.isType(e,ee))return e.size;var i=0;for(n=e.iterator();n.hasNext();)n.next(),Ai(i=i+1|0);return i},oh.checkCountOverflow_za3lpa$=Ai,oh.maxOrNull_l63kqw$=function(t){var e=t.iterator();if(!e.hasNext())return null;for(var n=e.next();e.hasNext();){var i=e.next();n=c.max(n,i)}return n},oh.minOrNull_l63kqw$=function(t){var e=t.iterator();if(!e.hasNext())return null;for(var n=e.next();e.hasNext();){var i=e.next();n=c.min(n,i)}return n},oh.requireNoNulls_whsx6z$=function(e){var n,i;for(n=e.iterator();n.hasNext();)if(null==n.next())throw Mn("null element found in "+e+".");return t.isType(i=e,ie)?i:Yr()},oh.minus_q4559j$=function(t,e){var n=As(e,t);if(n.isEmpty())return gt(t);var i,r=Ki();for(i=t.iterator();i.hasNext();){var o=i.next();n.contains_11rb$(o)||r.add_11rb$(o)}return r},oh.plus_qloxvw$=function(t,e){var n=Wi(t.size+1|0);return n.addAll_brywnq$(t),n.add_11rb$(e),n},oh.plus_q4559j$=function(e,n){if(t.isType(e,ee))return Et(e,n);var i=Ki();return Ws(i,e),Ws(i,n),i},oh.plus_mydzjv$=Et,oh.windowed_vo9c23$=function(e,n,i,r){var o;if(void 0===i&&(i=1),void 0===r&&(r=!1),Fl(n,i),t.isType(e,Mr)&&t.isType(e,ie)){for(var a=e.size,s=Wi((a/i|0)+(a%i==0?0:1)|0),l={v:0};0<=(o=l.v)&&o0?e:t},ah.coerceAtMost_38ydlf$=function(t,e){return t>e?e:t},ah.coerceIn_e4yvb3$=Lt,ah.coerceIn_ekzx8g$=function(t,e,n){if(e.compareTo_11rb$(n)>0)throw Mn("Cannot coerce value to an empty range: maximum "+n.toString()+" is less than minimum "+e.toString()+".");return t.compareTo_11rb$(e)<0?e:t.compareTo_11rb$(n)>0?n:t},ah.coerceIn_nig4hr$=function(t,e,n){if(e>n)throw Mn("Cannot coerce value to an empty range: maximum "+n+" is less than minimum "+e+".");return tn?n:t};var ch=rh.sequences||(rh.sequences={});ch.first_veqyi0$=function(t){var e=t.iterator();if(!e.hasNext())throw new Xn("Sequence is empty.");return e.next()},ch.firstOrNull_veqyi0$=function(t){var e=t.iterator();return e.hasNext()?e.next():null},ch.drop_wuwhe2$=function(e,n){if(!(n>=0))throw Mn(("Requested element count "+n+" is less than zero.").toString());return 0===n?e:t.isType(e,El)?e.drop_za3lpa$(n):new Nl(e,n)},ch.filter_euau3h$=function(t,e){return new yl(t,!0,e)},ch.Sequence=nl,ch.filterNot_euau3h$=It,ch.filterNotNull_q2m9h7$=Dt,ch.take_wuwhe2$=Mt,ch.sortedWith_vjgqpk$=function(t,e){return new Bt(t,e)},ch.toCollection_gtszxp$=Ut,ch.toHashSet_veqyi0$=function(t){return Ut(t,$r())},ch.toList_veqyi0$=Ft,ch.toMutableList_veqyi0$=qt,ch.toSet_veqyi0$=function(t){return Bl(Ut(t,Rr()))},ch.map_z5avom$=Gt,ch.mapNotNull_qpz9h9$=function(t,e){return Dt(new vl(t,e))},ch.count_veqyi0$=function(t){var e,n=0;for(e=t.iterator();e.hasNext();)e.next(),Ai(n=n+1|0);return n},ch.maxOrNull_1bslqu$=function(t){var e=t.iterator();if(!e.hasNext())return null;for(var n=e.next();e.hasNext();){var i=e.next();n=c.max(n,i)}return n},ch.minOrNull_1bslqu$=function(t){var e=t.iterator();if(!e.hasNext())return null;for(var n=e.next();e.hasNext();){var i=e.next();n=c.min(n,i)}return n},ch.chunked_wuwhe2$=function(t,e){return Ht(t,e,e,!0)},ch.plus_v0iwhp$=function(t,e){return _l(sl([t,e]))},ch.windowed_1ll6yl$=Ht,ch.zip_r7q3s9$=function(t,e){return new bl(t,e,Yt)},ch.joinTo_q99qgx$=Vt,ch.joinToString_853xkz$=function(t,e,n,i,r,o,a){return void 0===e&&(e=", "),void 0===n&&(n=""),void 0===i&&(i=""),void 0===r&&(r=-1),void 0===o&&(o="..."),void 0===a&&(a=null),Vt(t,Qo(),e,n,i,r,o,a).toString()},ch.asIterable_veqyi0$=Kt,oh.minus_khz7k3$=function(e,n){var i=As(n,e);if(i.isEmpty())return xt(e);if(t.isType(i,oe)){var r,o=Rr();for(r=e.iterator();r.hasNext();){var a=r.next();i.contains_11rb$(a)||o.add_11rb$(a)}return o}var s=Ir(e);return s.removeAll_brywnq$(i),s},oh.plus_xfiyik$=function(t,e){var n=Dr(t.size+1|0);return n.addAll_brywnq$(t),n.add_11rb$(e),n},oh.plus_khz7k3$=function(t,e){var n,i,r=Dr(null!=(i=null!=(n=Ns(e))?t.size+n|0:null)?i:2*t.size|0);return r.addAll_brywnq$(t),Ws(r,e),r},uh.get_lastIndex_gw00vp$=gc,uh.iterator_gw00vp$=$c,uh.get_indices_gw00vp$=vc,uh.dropLast_6ic1pp$=function(t,e){if(!(e>=0))throw Mn(("Requested character count "+e+" is less than zero.").toString());return Xt(t,At(t.length-e|0,0))},uh.StringBuilder_init=Qo,uh.slice_fc3b62$=function(t,e){return e.isEmpty()?"":bc(t,e)},uh.take_6ic1pp$=Xt,uh.reversed_gw00vp$=function(t){return Jo(t).reverse()},uh.asSequence_gw00vp$=function(t){var e,n="string"==typeof t;return n&&(n=0===t.length),n?ll():new Wt((e=t,function(){return $c(e)}))},rh.UInt=mp,rh.ULong=Pp,rh.UByte=hp,rh.UShort=Kp,oh.copyOf_mrm5p$=function(t,e){if(!(e>=0))throw Mn(("Invalid new array size: "+e+".").toString());return ii(t,new Int8Array(e))},oh.copyOfRange_ietg8x$=function(t,e,n){return Za().checkRangeIndexes_cub51b$(e,n,t.length),t.slice(e,n)};var ph=rh.js||(rh.js={}),hh=rh.math||(rh.math={});Object.defineProperty(hh,"PI",{get:function(){return n}}),rh.Annotation=Zt,rh.CharSequence=Jt,oh.Iterable=Qt,oh.MutableIterable=te,oh.MutableCollection=ne,oh.List=ie,oh.MutableList=re,oh.Set=oe,oh.MutableSet=ae,se.Entry=le,oh.Map=se,ue.MutableEntry=ce,oh.MutableMap=ue,oh.Iterator=pe,oh.MutableIterator=he,oh.ListIterator=_e,oh.MutableListIterator=fe,oh.ByteIterator=de,oh.CharIterator=me,oh.ShortIterator=ye,oh.IntIterator=$e,oh.LongIterator=ve,oh.FloatIterator=ge,oh.DoubleIterator=be,oh.BooleanIterator=we,ah.CharProgressionIterator=xe,ah.IntProgressionIterator=ke,ah.LongProgressionIterator=Ee,Object.defineProperty(Ce,"Companion",{get:Oe}),ah.CharProgression=Ce,Object.defineProperty(Ne,"Companion",{get:je}),ah.IntProgression=Ne,Object.defineProperty(Le,"Companion",{get:ze}),ah.LongProgression=Le,ah.ClosedRange=De,Object.defineProperty(Me,"Companion",{get:Fe}),ah.CharRange=Me,Object.defineProperty(qe,"Companion",{get:Ye}),ah.IntRange=qe,Object.defineProperty(Ve,"Companion",{get:Xe}),ah.LongRange=Ve,Object.defineProperty(rh,"Unit",{get:Qe});var _h=rh.internal||(rh.internal={});_h.getProgressionLastElement_qt1dr2$=on,_h.getProgressionLastElement_b9bd0d$=an,e.arrayIterator=function(t,e){if(null==e)return new sn(t);switch(e){case"BooleanArray":return un(t);case"ByteArray":return pn(t);case"ShortArray":return _n(t);case"CharArray":return dn(t);case"IntArray":return yn(t);case"LongArray":return xn(t);case"FloatArray":return vn(t);case"DoubleArray":return bn(t);default:throw Un("Unsupported type argument for arrayIterator: "+$(e))}},e.booleanArrayIterator=un,e.byteArrayIterator=pn,e.shortArrayIterator=_n,e.charArrayIterator=dn,e.intArrayIterator=yn,e.floatArrayIterator=vn,e.doubleArrayIterator=bn,e.longArrayIterator=xn,e.noWhenBranchMatched=function(){throw ti()},e.subSequence=function(t,e,n){return"string"==typeof t?t.substring(e,n):t.subSequence_vux9f0$(e,n)},e.captureStack=function(t,e){Error.captureStackTrace?Error.captureStackTrace(e):e.stack=(new Error).stack},e.newThrowable=function(t,e){var n,i=new Error;return n=o(typeof t,"undefined")?null!=e?e.toString():null:t,i.message=n,i.cause=e,i.name="Throwable",i},e.BoxedChar=kn,e.charArrayOf=function(){var t="CharArray",e=new Uint16Array([].slice.call(arguments));return e.$type$=t,e};var fh=rh.coroutines||(rh.coroutines={});fh.CoroutineImpl=En,Object.defineProperty(fh,"CompletedContinuation",{get:Tn});var dh=fh.intrinsics||(fh.intrinsics={});dh.createCoroutineUnintercepted_x18nsh$=Nn,dh.createCoroutineUnintercepted_3a617i$=Pn,dh.intercepted_f9mg25$=An,rh.Error_init_pdl1vj$=Ln,rh.Error=jn,rh.Exception_init_pdl1vj$=function(t,e){return e=e||Object.create(Rn.prototype),Rn.call(e,t,null),e},rh.Exception=Rn,rh.RuntimeException_init=function(t){return t=t||Object.create(In.prototype),In.call(t,null,null),t},rh.RuntimeException_init_pdl1vj$=zn,rh.RuntimeException=In,rh.IllegalArgumentException_init=function(t){return t=t||Object.create(Dn.prototype),Dn.call(t,null,null),t},rh.IllegalArgumentException=Dn,rh.IllegalStateException_init=function(t){return t=t||Object.create(Bn.prototype),Bn.call(t,null,null),t},rh.IllegalStateException_init_pdl1vj$=Un,rh.IllegalStateException=Bn,rh.IndexOutOfBoundsException_init=function(t){return t=t||Object.create(Fn.prototype),Fn.call(t,null),t},rh.IndexOutOfBoundsException=Fn,rh.UnsupportedOperationException_init=Gn,rh.UnsupportedOperationException=qn,rh.NumberFormatException=Yn,rh.NullPointerException=Vn,rh.ClassCastException=Kn,rh.AssertionError_init_pdl1vj$=function(t,e){return e=e||Object.create(Wn.prototype),Wn.call(e,t,null),e},rh.AssertionError=Wn,rh.NoSuchElementException=Xn,rh.ArithmeticException=Jn,rh.NoWhenBranchMatchedException_init=ti,rh.NoWhenBranchMatchedException=Qn,rh.UninitializedPropertyAccessException_init_pdl1vj$=ni,rh.UninitializedPropertyAccessException=ei,rh.lazy_klfg04$=function(t){return new Qc(t)},rh.lazy_kls4a0$=function(t,e){return new Qc(e)},rh.fillFrom_dgzutr$=ii,rh.arrayCopyResize_xao4iu$=ri,uh.toString_if0zpk$=oi,oh.asList_us0mfu$=ai,oh.arrayCopy=Ni,oh.copyOf_8ujjk8$=si,oh.copyOfRange_5f8l3u$=li,oh.fill_jfbbbd$=ui,oh.fill_x4f2cq$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=t.length),Za().checkRangeIndexes_cub51b$(n,i,t.length),t.fill(e,n,i)},oh.sort_pbinho$=ci,oh.toTypedArray_964n91$=function(t){return[].slice.call(t)},oh.toTypedArray_bvy38s$=function(t){return[].slice.call(t)},oh.reverse_vvxzk3$=hi,uh.binarySearchRange_wmnbas$=yi,uh.digitToIntImpl_nupfqh$=$i,uh.isWhitespaceImpl_nupfqh$=vi,rh.Comparator=gi,oh.copyToArray=bi,oh.copyToArrayImpl=wi,oh.copyToExistingArrayImpl=xi,oh.setOf_mh5how$=Ei,oh.LinkedHashSet_init_287e2$=Rr,oh.LinkedHashSet_init_ww73n8$=Dr,oh.mapOf_x2b85n$=Ci,oh.shuffle_vvxzk3$=function(t){mt(t,Du())},oh.sort_4wi501$=Si,oh.toMutableMap_abgq59$=Vs,oh.AbstractMutableCollection=Li,oh.AbstractMutableList=Ri,Mi.SimpleEntry_init_trwmqg$=function(t,e){return e=e||Object.create(Bi.prototype),Bi.call(e,t.key,t.value),e},Mi.SimpleEntry=Bi,Mi.AbstractEntrySet=Ui,oh.AbstractMutableMap=Mi,oh.AbstractMutableSet=Yi,oh.ArrayList_init_mqih57$=Xi,oh.ArrayList=Vi,oh.sortArrayWith_6xblhi$=Zi,oh.sortArray_5zbtrs$=Qi,Object.defineProperty(rr,"HashCode",{get:cr}),oh.EqualityComparator=rr,oh.HashMap_init_va96d4$=_r,oh.HashMap_init_q3lmfv$=fr,oh.HashMap_init_xf5xz2$=dr,oh.HashMap_init_bwtc7$=mr,oh.HashMap_init_73mtqc$=function(t,e){return fr(e=e||Object.create(pr.prototype)),e.putAll_a2k3zr$(t),e},oh.HashMap=pr,oh.HashSet_init_mqih57$=function(t,e){return e=e||Object.create(yr.prototype),Yi.call(e),yr.call(e),e.map_8be2vx$=mr(t.size),e.addAll_brywnq$(t),e},oh.HashSet_init_2wofer$=vr,oh.HashSet_init_ww73n8$=gr,oh.HashSet_init_nn01ho$=br,oh.HashSet=yr,oh.InternalHashCodeMap=wr,oh.InternalMap=kr,oh.InternalStringMap=Er,oh.LinkedHashMap_init_xf5xz2$=Pr,oh.LinkedHashMap_init_73mtqc$=jr,oh.LinkedHashMap=Cr,oh.LinkedHashSet_init_mqih57$=Ir,oh.LinkedHashSet_init_2wofer$=zr,oh.LinkedHashSet=Lr,oh.RandomAccess=Mr;var mh=rh.io||(rh.io={});mh.BaseOutput=Br,mh.NodeJsOutput=Ur,mh.BufferedOutput=Fr,mh.BufferedOutputToConsoleLog=qr,mh.println_s8jyv4$=function(t){ar.println_s8jyv4$(t)},fh.SafeContinuation_init_wj8d80$=function(t,e){return e=e||Object.create(Gr.prototype),Gr.call(e,t,Pu()),e},fh.SafeContinuation=Gr;var yh=e.kotlinx||(e.kotlinx={}),$h=yh.dom||(yh.dom={});$h.createElement_7cgwi1$=function(t,e,n){var i=t.createElement(e);return n(i),i},$h.hasClass_46n0ku$=Ia,$h.addClass_hhb33f$=function(e,n){var i,r=Ki();for(i=0;i!==n.length;++i){var o=n[i];Ia(e,o)||r.add_11rb$(o)}var a=r;if(!a.isEmpty()){var s,l=fc(t.isCharSequence(s=e.className)?s:S()).toString(),u=Qo();return u.append_pdl1vj$(l),0!==l.length&&u.append_pdl1vj$(" "),Ct(a,u," "),e.className=u.toString(),!0}return!1},$h.removeClass_hhb33f$=function(e,n){var i;t:do{var r;for(r=0;r!==n.length;++r)if(Ia(e,n[r])){i=!0;break t}i=!1}while(0);if(i){var o,a,s=et(n),l=fc(t.isCharSequence(o=e.className)?o:S()).toString(),u=wa("\\s+").split_905azu$(l,0),c=Ki();for(a=u.iterator();a.hasNext();){var p=a.next();s.contains_11rb$(p)||c.add_11rb$(p)}return e.className=St(c," "),!0}return!1},ph.iterator_s8jyvk$=function(e){var n,i=e;return null!=e.iterator?e.iterator():t.isArrayish(i)?t.arrayIterator(i):(t.isType(n=i,Qt)?n:Yr()).iterator()},e.throwNPE=function(t){throw new Vn(t)},e.throwCCE=Yr,e.throwISE=Vr,e.throwUPAE=function(t){throw ni("lateinit property "+t+" has not been initialized")},mh.Serializable=Kr,hh.round_14dthe$=function(t){if(t%.5!=0)return Math.round(t);var e=c.floor(t);return e%2==0?e:c.ceil(t)},hh.nextDown_yrwdxr$=Wr,hh.roundToInt_yrwdxr$=function(t){if(Xr(t))throw Mn("Cannot round NaN value.");return t>2147483647?2147483647:t<-2147483648?-2147483648:d(Math.round(t))},hh.roundToLong_yrwdxr$=function(e){if(Xr(e))throw Mn("Cannot round NaN value.");return e>y.toNumber()?y:e0?1:0},hh.abs_s8cxhz$=function(t){return t.toNumber()<0?t.unaryMinus():t},rh.isNaN_yrwdxr$=Xr,rh.isNaN_81szk$=function(t){return t!=t},rh.isInfinite_yrwdxr$=Zr,rh.isFinite_yrwdxr$=Jr,sh.defaultPlatformRandom_8be2vx$=Qr,sh.doubleFromParts_6xvm5r$=to;var vh=rh.reflect||(rh.reflect={});ph.get_js_1yb8b7$=function(e){var n;return(t.isType(n=e,io)?n:Yr()).jClass},vh.KCallable=eo,vh.KClass=no;var gh=vh.js||(vh.js={}),bh=gh.internal||(gh.internal={});bh.KClassImpl=io,bh.SimpleKClassImpl=ro,bh.PrimitiveKClassImpl=oo,Object.defineProperty(bh,"NothingKClassImpl",{get:lo}),bh.ErrorKClass=uo,vh.KProperty=co,vh.KMutableProperty=po,vh.KProperty0=ho,vh.KMutableProperty0=_o,vh.KProperty1=fo,vh.KMutableProperty1=mo,vh.KType=yo,e.createKType=function(t,e,n){return new $o(t,ai(e),n)},bh.KTypeImpl=$o,bh.prefixString_knho38$=vo,Object.defineProperty(bh,"PrimitiveClasses",{get:Go}),e.getKClass=Ho,e.getKClassM=Yo,e.getKClassFromExpression=function(e){var n;switch(typeof e){case"string":n=Go().stringClass;break;case"number":n=(0|e)===e?Go().intClass:Go().doubleClass;break;case"boolean":n=Go().booleanClass;break;case"function":n=Go().functionClass(e.length);break;default:if(t.isBooleanArray(e))n=Go().booleanArrayClass;else if(t.isCharArray(e))n=Go().charArrayClass;else if(t.isByteArray(e))n=Go().byteArrayClass;else if(t.isShortArray(e))n=Go().shortArrayClass;else if(t.isIntArray(e))n=Go().intArrayClass;else if(t.isLongArray(e))n=Go().longArrayClass;else if(t.isFloatArray(e))n=Go().floatArrayClass;else if(t.isDoubleArray(e))n=Go().doubleArrayClass;else if(t.isType(e,no))n=Ho(no);else if(t.isArray(e))n=Go().arrayClass;else{var i=Object.getPrototypeOf(e).constructor;n=i===Object?Go().anyClass:i===Error?Go().throwableClass:Vo(i)}}return n},e.getKClass1=Vo,ph.reset_xjqeni$=Ko,uh.Appendable=Wo,uh.StringBuilder_init_za3lpa$=Zo,uh.StringBuilder_init_6bul2c$=Jo,uh.StringBuilder=Xo,uh.uppercaseChar_myv2d0$=ta,uh.isHighSurrogate_myv2d0$=ea,uh.isLowSurrogate_myv2d0$=na,uh.isWhitespace_myv2d0$=ia,uh.toBoolean_5cw0du$=function(t){var e=null!=t;return e&&(e=o(t.toLowerCase(),"true")),e},uh.toInt_pdl1vz$=function(t){var e;return null!=(e=sc(t))?e:pc(t)},uh.toInt_6ic1pp$=function(t,e){var n;return null!=(n=lc(t,e))?n:pc(t)},uh.toLong_pdl1vz$=function(t){var e;return null!=(e=uc(t))?e:pc(t)},uh.toDouble_pdl1vz$=function(t){var e=+t;return(Xr(e)&&!ra(t)||0===e&&La(t))&&pc(t),e},uh.toDoubleOrNull_pdl1vz$=function(t){var e=+t;return Xr(e)&&!ra(t)||0===e&&La(t)?null:e},uh.toString_dqglrj$=function(t,e){return t.toString(oa(e))},uh.checkRadix_za3lpa$=oa,uh.digitOf_xvg9q0$=aa,Object.defineProperty(sa,"IGNORE_CASE",{get:ua}),Object.defineProperty(sa,"MULTILINE",{get:ca}),uh.RegexOption=sa,uh.MatchGroup=pa,Object.defineProperty(ha,"Companion",{get:ga}),uh.Regex_init_sb3q2$=function(t,e,n){return n=n||Object.create(ha.prototype),ha.call(n,t,Ei(e)),n},uh.Regex_init_61zpoe$=wa,uh.Regex=ha,uh.String_4hbowm$=function(t){var e,n="";for(e=0;e!==t.length;++e){var i=s(t[e]);n+=String.fromCharCode(i)}return n},uh.concatToString_355ntz$=Sa,uh.concatToString_wlitf7$=Ta,uh.compareTo_7epoxm$=Oa,uh.startsWith_7epoxm$=Na,uh.startsWith_3azpy2$=Pa,uh.endsWith_7epoxm$=Aa,uh.matches_rjktp$=ja,uh.isBlank_gw00vp$=La,uh.equals_igcy3c$=function(t,e,n){if(void 0===n&&(n=!1),null==t)return null==e;if(n){if(null==e)return!1;var i=t.toLowerCase(),r=e.toLowerCase(),a=o(i,r);return a||(a=o(i.toUpperCase(),r.toUpperCase())),a}return o(t,e)},uh.regionMatches_h3ii2q$=Ra,uh.repeat_94bcnn$=function(t,e){var n;if(!(e>=0))throw Mn(("Count 'n' must be non-negative, but was "+e+".").toString());switch(e){case 0:n="";break;case 1:n=t.toString();break;default:var i="";if(0!==t.length)for(var r=t.toString(),o=e;1==(1&o)&&(i+=r),0!=(o>>>=1);)r+=r;return i}return n},uh.replace_680rmw$=function(t,e,n,i){return void 0===i&&(i=!1),t.replace(new RegExp(ga().escape_61zpoe$(e),i?"gui":"gu"),ga().escapeReplacement_61zpoe$(n))},uh.replace_r2fvfm$=function(t,e,n,i){return void 0===i&&(i=!1),t.replace(new RegExp(ga().escape_61zpoe$(String.fromCharCode(e)),i?"gui":"gu"),String.fromCharCode(n))},oh.AbstractCollection=za,oh.AbstractIterator=Ga,Object.defineProperty(Ha,"Companion",{get:Za}),oh.AbstractList=Ha,Object.defineProperty(Ja,"Companion",{get:os}),oh.AbstractMap=Ja,Object.defineProperty(as,"Companion",{get:us}),oh.AbstractSet=as,Object.defineProperty(oh,"EmptyIterator",{get:hs}),Object.defineProperty(oh,"EmptyList",{get:ds}),oh.asCollection_vj43ah$=ms,oh.listOf_i5x0yv$=vs,oh.arrayListOf_i5x0yv$=gs,oh.listOfNotNull_issdgt$=function(t){return null!=t?ki(t):$s()},oh.listOfNotNull_jurz7g$=function(t){return Y(t)},oh.get_indices_gzk92b$=bs,oh.optimizeReadOnlyList_qzupvv$=xs,oh.binarySearch_jhx6be$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=t.size),ks(t.size,n,i);for(var r=n,o=i-1|0;r<=o;){var a=r+o>>>1,s=Kl(t.get_za3lpa$(a),e);if(s<0)r=a+1|0;else{if(!(s>0))return a;o=a-1|0}}return 0|-(r+1|0)},oh.binarySearch_vikexg$=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=t.size),ks(t.size,i,r);for(var o=i,a=r-1|0;o<=a;){var s=o+a>>>1,l=t.get_za3lpa$(s),u=n.compare(l,e);if(u<0)o=s+1|0;else{if(!(u>0))return s;a=s-1|0}}return 0|-(o+1|0)},lh.compareValues_s00gnj$=Kl,oh.throwIndexOverflow=Es,oh.throwCountOverflow=Cs,oh.IndexedValue=Ts,oh.IndexingIterable=Os,oh.collectionSizeOrNull_7wnvza$=Ns,oh.convertToSetForSetOperationWith_wo44v8$=As,oh.flatten_u0ad8z$=function(t){var e,n=Ki();for(e=t.iterator();e.hasNext();)Ws(n,e.next());return n},oh.unzip_6hr0sd$=function(t){var e,n=Ps(t,10),i=Wi(n),r=Wi(n);for(e=t.iterator();e.hasNext();){var o=e.next();i.add_11rb$(o.first),r.add_11rb$(o.second)}return cp(i,r)},oh.IndexingIterator=js,oh.getOrImplicitDefault_t9ocha$=Ls,oh.emptyMap_q3lmfv$=Us,oh.mapOf_qfcya0$=function(t){return t.length>0?Ys(t,Ar(t.length)):Us()},oh.mutableMapOf_qfcya0$=function(t){var e=Ar(t.length);return qs(e,t),e},oh.hashMapOf_qfcya0$=Fs,oh.getValue_t9ocha$=function(t,e){return Ls(t,e)},oh.putAll_5gv49o$=qs,oh.putAll_cweazw$=Gs,oh.toMap_6hr0sd$=function(e){var n;if(t.isType(e,ee)){switch(e.size){case 0:n=Us();break;case 1:n=Ci(t.isType(e,ie)?e.get_za3lpa$(0):e.iterator().next());break;default:n=Hs(e,Ar(e.size))}return n}return Ks(Hs(e,Nr()))},oh.toMap_jbpz7q$=Hs,oh.toMap_ujwnei$=Ys,oh.toMap_abgq59$=function(t){switch(t.size){case 0:return Us();case 1:default:return Vs(t)}},oh.plus_iwxh38$=function(t,e){var n=jr(t);return n.putAll_a2k3zr$(e),n},oh.minus_uk696c$=function(t,e){var n=Vs(t);return Xs(n.keys,e),Ks(n)},oh.removeAll_ipc267$=Xs,oh.optimizeReadOnlyMap_1vp4qn$=Ks,oh.retainAll_ipc267$=Zs,oh.removeAll_uhyeqt$=Js,oh.removeAll_qafx1e$=tl,oh.asReversed_2p1efm$=function(t){return new el(t)},ch.sequence_o0x0bg$=function(t){return new il((e=t,function(){return rl(e)}));var e},ch.iterator_o0x0bg$=rl,ch.SequenceScope=ol,ch.sequenceOf_i5x0yv$=sl,ch.emptySequence_287e2$=ll,ch.flatten_41nmvn$=_l,ch.flatten_d9bjs1$=function(t){return ml(t,fl)},ch.FilteringSequence=yl,ch.TransformingSequence=vl,ch.MergingSequence=bl,ch.FlatteningSequence=xl,ch.DropTakeSequence=El,ch.SubSequence=Cl,ch.TakeSequence=Tl,ch.DropSequence=Nl,ch.generateSequence_c6s9hp$=Ll,Object.defineProperty(oh,"EmptySet",{get:zl}),oh.emptySet_287e2$=Dl,oh.setOf_i5x0yv$=function(t){return t.length>0?et(t):Dl()},oh.mutableSetOf_i5x0yv$=function(t){return J(t,Dr(t.length))},oh.hashSetOf_i5x0yv$=Ml,oh.optimizeReadOnlySet_94kdbt$=Bl,oh.checkWindowSizeStep_6xvm5r$=Fl,oh.windowedSequence_38k18b$=ql,oh.windowedIterator_4ozct4$=Hl,lh.compareBy_bvgy4j$=function(t){if(!(t.length>0))throw Mn("Failed requirement.".toString());return new gi(Wl(t))},lh.naturalOrder_dahdeg$=Xl,lh.reverseOrder_dahdeg$=Zl,lh.reversed_2avth4$=function(e){var n,i;return t.isType(e,Jl)?e.comparator:o(e,eu())?t.isType(n=ru(),gi)?n:Yr():o(e,ru())?t.isType(i=eu(),gi)?i:Yr():new Jl(e)},fh.Continuation=ou,rh.Result=ep,fh.startCoroutine_x18nsh$=function(t,e){An(Nn(t,e)).resumeWith_tl1gpc$(new ep(Qe()))},fh.startCoroutine_3a617i$=function(t,e,n){An(Pn(t,e,n)).resumeWith_tl1gpc$(new ep(Qe()))},dh.get_COROUTINE_SUSPENDED=Su,Object.defineProperty(au,"Key",{get:uu}),fh.ContinuationInterceptor=au,cu.Key=hu,cu.Element=_u,fh.CoroutineContext=cu,fh.AbstractCoroutineContextElement=fu,fh.AbstractCoroutineContextKey=du,Object.defineProperty(fh,"EmptyCoroutineContext",{get:$u}),fh.CombinedContext=vu,Object.defineProperty(dh,"COROUTINE_SUSPENDED",{get:Su}),Object.defineProperty(Tu,"COROUTINE_SUSPENDED",{get:Nu}),Object.defineProperty(Tu,"UNDECIDED",{get:Pu}),Object.defineProperty(Tu,"RESUMED",{get:Au}),dh.CoroutineSingletons=Tu,Object.defineProperty(ju,"Default",{get:Du}),sh.Random_za3lpa$=Mu,sh.Random_s8cxhz$=function(t){return Ju(t.toInt(),t.shiftRight(32).toInt())},sh.fastLog2_kcn2v3$=Bu,sh.takeUpperBits_b6l1hq$=Uu,sh.checkRangeBounds_6xvm5r$=Fu,sh.checkRangeBounds_cfj5zr$=qu,sh.checkRangeBounds_sdh6z7$=Gu,sh.boundsErrorMessage_dgzutr$=Hu,sh.XorWowRandom_init_6xvm5r$=Ju,sh.XorWowRandom=Yu,ah.ClosedFloatingPointRange=tc,ah.rangeTo_38ydlf$=function(t,e){return new ec(t,e)},vh.KClassifier=nc,uh.appendElement_k2zgzt$=ic,uh.equals_4lte5s$=rc,uh.trimMargin_rjktp$=function(t,e){return void 0===e&&(e="|"),oc(t,"",e)},uh.replaceIndentByMargin_j4ogox$=oc,uh.toIntOrNull_pdl1vz$=sc,uh.toIntOrNull_6ic1pp$=lc,uh.toLongOrNull_pdl1vz$=uc,uh.toLongOrNull_6ic1pp$=cc,uh.numberFormatError_y4putb$=pc,uh.trimStart_wqw3xr$=hc,uh.trimEnd_wqw3xr$=_c,uh.trim_gw00vp$=fc,uh.padStart_yk9sg4$=dc,uh.padStart_vrc1nu$=function(e,n,i){var r;return void 0===i&&(i=32),dc(t.isCharSequence(r=e)?r:Yr(),n,i).toString()},uh.padEnd_yk9sg4$=mc,uh.padEnd_vrc1nu$=function(e,n,i){var r;return void 0===i&&(i=32),mc(t.isCharSequence(r=e)?r:Yr(),n,i).toString()},uh.substring_fc3b62$=bc,uh.substring_i511yc$=wc,uh.substringBefore_j4ogox$=function(t,e,n){void 0===n&&(n=t);var i=Ac(t,e);return-1===i?n:t.substring(0,i)},uh.substringAfter_j4ogox$=function(t,e,n){void 0===n&&(n=t);var i=Ac(t,e);return-1===i?n:t.substring(i+e.length|0,t.length)},uh.removePrefix_gsj5wt$=function(t,e){return Cc(t,e)?t.substring(e.length):t},uh.removeSurrounding_90ijwr$=function(t,e,n){return t.length>=(e.length+n.length|0)&&Cc(t,e)&&Sc(t,n)?t.substring(e.length,t.length-n.length|0):t},uh.regionMatchesImpl_4c7s8r$=xc,uh.startsWith_sgbm27$=kc,uh.endsWith_sgbm27$=Ec,uh.startsWith_li3zpu$=Cc,uh.endsWith_li3zpu$=Sc,uh.indexOfAny_junqau$=Tc,uh.lastIndexOfAny_junqau$=Oc,uh.indexOf_8eortd$=Pc,uh.indexOf_l5u8uk$=Ac,uh.lastIndexOf_8eortd$=function(e,n,i,r){return void 0===i&&(i=gc(e)),void 0===r&&(r=!1),r||"string"!=typeof e?Oc(e,t.charArrayOf(n),i,r):e.lastIndexOf(String.fromCharCode(n),i)},uh.lastIndexOf_l5u8uk$=jc,uh.contains_li3zpu$=function(t,e,n){return void 0===n&&(n=!1),"string"==typeof e?Ac(t,e,void 0,n)>=0:Nc(t,e,0,t.length,n)>=0},uh.contains_sgbm27$=function(t,e,n){return void 0===n&&(n=!1),Pc(t,e,void 0,n)>=0},uh.splitToSequence_ip8yn$=Dc,uh.split_ip8yn$=function(e,n,i,r){if(void 0===i&&(i=!1),void 0===r&&(r=0),1===n.length){var o=n[0];if(0!==o.length)return function(e,n,i,r){if(!(r>=0))throw Mn(("Limit must be non-negative, but was "+r+".").toString());var o=0,a=Ac(e,n,o,i);if(-1===a||1===r)return ki(e.toString());var s=r>0,l=Wi(s?jt(r,10):10);do{if(l.add_11rb$(t.subSequence(e,o,a).toString()),o=a+n.length|0,s&&l.size===(r-1|0))break;a=Ac(e,n,o,i)}while(-1!==a);return l.add_11rb$(t.subSequence(e,o,e.length).toString()),l}(e,o,i,r)}var a,s=Kt(zc(e,n,void 0,i,r)),l=Wi(Ps(s,10));for(a=s.iterator();a.hasNext();){var u=a.next();l.add_11rb$(wc(e,u))}return l},uh.lineSequence_gw00vp$=Mc,uh.lines_gw00vp$=Bc,uh.MatchGroupCollection=Uc,Fc.Destructured=qc,uh.MatchResult=Fc,rh.Lazy=Gc,Object.defineProperty(Hc,"SYNCHRONIZED",{get:Vc}),Object.defineProperty(Hc,"PUBLICATION",{get:Kc}),Object.defineProperty(Hc,"NONE",{get:Wc}),rh.LazyThreadSafetyMode=Hc,Object.defineProperty(rh,"UNINITIALIZED_VALUE",{get:Jc}),rh.UnsafeLazyImpl=Qc,rh.InitializedLazyImpl=tp,rh.createFailure_tcv7n7$=ap,Object.defineProperty(ep,"Companion",{get:rp}),ep.Failure=op,rh.throwOnFailure_iacion$=sp,rh.NotImplementedError=lp,rh.Pair=up,rh.to_ujzrz7$=cp,rh.toList_tt9upe$=function(t){return vs([t.first,t.second])},rh.Triple=pp,Object.defineProperty(hp,"Companion",{get:dp}),Object.defineProperty(mp,"Companion",{get:vp}),rh.uintCompare_vux9f0$=Jp,rh.uintDivide_oqfnby$=function(e,n){return new mp(t.Long.fromInt(e.data).and(v).div(t.Long.fromInt(n.data).and(v)).toInt())},rh.uintRemainder_oqfnby$=th,rh.uintToDouble_za3lpa$=function(t){return(2147483647&t)+2*(t>>>31<<30)},Object.defineProperty(gp,"Companion",{get:xp}),ah.UIntRange=gp,Object.defineProperty(kp,"Companion",{get:Sp}),ah.UIntProgression=kp,oh.UIntIterator=Op,oh.ULongIterator=Np,Object.defineProperty(Pp,"Companion",{get:Lp}),rh.ulongCompare_3pjtqy$=Qp,rh.ulongDivide_jpm79w$=function(e,n){var i=e.data,r=n.data;if(r.toNumber()<0)return Qp(e.data,n.data)<0?new Pp(u):new Pp(w);if(i.toNumber()>=0)return new Pp(i.div(r));var o=i.shiftRightUnsigned(1).div(r).shiftLeft(1),a=i.subtract(o.multiply(r));return new Pp(o.add(t.Long.fromInt(Qp(new Pp(a).data,new Pp(r).data)>=0?1:0)))},rh.ulongRemainder_jpm79w$=eh,rh.ulongToDouble_s8cxhz$=function(t){return 2048*t.shiftRightUnsigned(11).toNumber()+t.and(D).toNumber()},Object.defineProperty(Rp,"Companion",{get:Dp}),ah.ULongRange=Rp,Object.defineProperty(Mp,"Companion",{get:Fp}),ah.ULongProgression=Mp,_h.getProgressionLastElement_fjk8us$=Yp,_h.getProgressionLastElement_15zasp$=Vp,Object.defineProperty(Kp,"Companion",{get:Zp}),rh.ulongToString_8e33dg$=nh,rh.ulongToString_plstum$=ih,ue.prototype.getOrDefault_xwzc9p$=se.prototype.getOrDefault_xwzc9p$,Ja.prototype.getOrDefault_xwzc9p$=se.prototype.getOrDefault_xwzc9p$,Mi.prototype.remove_xwzc9p$=ue.prototype.remove_xwzc9p$,wr.prototype.createJsMap=kr.prototype.createJsMap,Er.prototype.createJsMap=kr.prototype.createJsMap,Object.defineProperty(xa.prototype,"destructured",Object.getOwnPropertyDescriptor(Fc.prototype,"destructured")),Rs.prototype.getOrDefault_xwzc9p$=se.prototype.getOrDefault_xwzc9p$,Is.prototype.remove_xwzc9p$=ue.prototype.remove_xwzc9p$,Is.prototype.getOrDefault_xwzc9p$=ue.prototype.getOrDefault_xwzc9p$,Rs.prototype.getOrDefault_xwzc9p$,zs.prototype.remove_xwzc9p$=Is.prototype.remove_xwzc9p$,zs.prototype.getOrDefault_xwzc9p$=Is.prototype.getOrDefault_xwzc9p$,Ds.prototype.getOrDefault_xwzc9p$=se.prototype.getOrDefault_xwzc9p$,_u.prototype.plus_1fupul$=cu.prototype.plus_1fupul$,au.prototype.fold_3cc69b$=_u.prototype.fold_3cc69b$,au.prototype.plus_1fupul$=_u.prototype.plus_1fupul$,fu.prototype.get_j3r2sn$=_u.prototype.get_j3r2sn$,fu.prototype.fold_3cc69b$=_u.prototype.fold_3cc69b$,fu.prototype.minusKey_yeqjby$=_u.prototype.minusKey_yeqjby$,fu.prototype.plus_1fupul$=_u.prototype.plus_1fupul$,vu.prototype.plus_1fupul$=cu.prototype.plus_1fupul$,Qu.prototype.contains_mef7kx$=De.prototype.contains_mef7kx$,Qu.prototype.isEmpty=De.prototype.isEmpty,n=3.141592653589793,fi=null;var wh="undefined"!=typeof process&&process.versions&&!!process.versions.node;ar=wh?new Ur(process.stdout):new qr,new Hr($u(),(function(e){var n;return sp(e),null==(n=e.value)||t.isType(n,C)||S(),Ze})),sr=c.pow(2,-26),lr=c.pow(2,-53),Bo=t.newArray(0,null),new gi((function(t,e){return Oa(t,e,!0)})),new Int8Array([f(239),f(191),f(189)]),new ep(Su())}()})?n.apply(e,[e]):n)||(t.exports=i)},197:function(t,e,n){var i,r,o;r=[e,n(421)],void 0===(o="function"==typeof(i=function(t,e){"use strict";var n,i=Object,r=e.throwCCE,o=e.Kind.CLASS,a=e.kotlin.coroutines.Continuation,s=(e.kotlin.Annotation,e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED),l=e.kotlin.coroutines.CoroutineImpl,u=(e.kotlin.collections.emptyList_287e2$,e.kotlin.Unit),c=e.throwUPAE,p=(e.kotlin.collections.copyToArray,e.kotlin.coroutines.intrinsics.intercepted_f9mg25$),h=e.kotlin.collections.ArrayList_init_ww73n8$,_=e.kotlin.Result,f=e.kotlin.coroutines,d=e.kotlin.coroutines.intrinsics.createCoroutineUnintercepted_3a617i$,m=e.kotlin.coroutines.ContinuationInterceptor,y=e.equals,$=e.defineInlineFunction,v=e.wrapFunction,g=e.kotlin.IllegalStateException_init_pdl1vj$,b=e.Kind.INTERFACE,w=Error,x=e.toString,k=e.Kind.OBJECT,E=e.kotlin.createFailure_tcv7n7$,C=e.kotlin.coroutines.AbstractCoroutineContextElement,S=e.kotlin.RuntimeException,T=e.kotlin.coroutines.CoroutineContext.Key,O=e.kotlin.coroutines.CoroutineContext.Element,N=e.kotlin.coroutines.startCoroutine_x18nsh$,P=e.kotlin.coroutines.startCoroutine_3a617i$,A=e.kotlin.Enum,j=e.throwISE,L=e.Long.MAX_VALUE,R=e.Long.ZERO,I=new e.Long(0,1),z=e.Long.ONE,D=(e.Long.fromInt(1e6),new e.Long(2077252342,2147),new e.Long(-1,1073741823),e.kotlin.ranges.coerceAtLeast_2p08ub$,e.ensureNotNull),M=(e.kotlin.Comparable,e.kotlin.IllegalArgumentException_init_pdl1vj$),B=e.kotlin.Error,U=e.kotlin.IllegalStateException,F=e.kotlin.sequences.sequence_o0x0bg$,q=e.kotlin.collections.ArrayList,G=e.kotlin.text.StringBuilder_init,H=e.kotlin.UnsupportedOperationException_init_pdl1vj$,Y=(e.kotlin.sequences.emptySequence_287e2$,Function),V=(e.kotlin.ranges.coerceAtMost_2p08ub$,Math),K=e.kotlin.NoSuchElementException,W=e.hashCode,X=(e.kotlin.collections.IndexedValue,e.kotlin.IndexOutOfBoundsException,e.kotlin.collections.LinkedHashMap_init_q3lmfv$,e.kotlin.collections.ArrayList_init_287e2$),Z=(e.kotlin.collections.HashSet_init_287e2$,e.kotlin.collections.LinkedHashSet_init_287e2$,e.kotlin.Pair,e.kotlin.to_ujzrz7$,e.kotlin.collections.indexOf_mjy6jw$,e.kotlin.collections.arrayCopy),J=(e.kotlin.ArithmeticException,new e.Long(0,805306368),e.Long.fromInt(1073741823),new e.Long(-1073741824,268435455),new e.Long(0,268435456),new e.Long(0,536870912),e.kotlin.text.toLongOrNull_pdl1vz$),Q=(e.kotlin.collections.fill_jfbbbd$,e.kotlin.collections.copyOf_8ujjk8$,e.kotlin.coroutines.intrinsics.createCoroutineUnintercepted_x18nsh$),tt=e.kotlin.collections.shuffle_vvxzk3$,et=e.Long.fromInt(2147483647),nt=e.kotlin.ranges.coerceIn_ekzx8g$,it=e.kotlin.collections.HashSet_init_ww73n8$,rt=(e.kotlin.collections.get_lastIndex_55thoc$,e.kotlin.NoSuchElementException_init,e.kotlin.collections.MutableIterator,e.kotlin.collections.AbstractMutableList,e.kotlin.UnsupportedOperationException_init);function ot(t,e){void 0===e&&(e=!0),Me.call(this,e),this.parentContext=t,this.context_p8rm81$_0=this.parentContext.plus_1fupul$(this)}function at(t,e){ot.call(this,t,e)}function st(t,e){l.call(this,e),this.exceptionState_0=1,this.$this=t}function lt(t,e){at.call(this,t,!1),this.continuation_0=d(e,this,this)}function ut(t,e){ot.call(this,t,e)}function ct(t,e){ut.call(this,t,!1),this.continuation_0=d(e,this,this)}function pt(t,e){Qi.call(this,t,e)}function ht(t,e){Qi.call(this,t,e),this._decision_0=0}function _t(){}function ft(t){var n,i;return e.isType(t,Gi)?null==(i=null!=(n=t.claimReusableCancellableContinuation())&&n.resetState_8be2vx$()?n:null)?new vt(t,0):i:new vt(t,0)}function dt(t,e){t.invokeOnCancellation_f05bi3$(new yt(e))}function mt(t,e){t.invokeOnCancellation_f05bi3$(new $t(e))}function yt(t){kt.call(this),this.node_0=t}function $t(t){kt.call(this),this.handle_0=t}function vt(t,e){Wi.call(this,e),this.delegate_dhbmku$_0=t,this.context_xycjfy$_0=this.delegate.context,this._decision_0=0,this._state_0=xt(),this._parentHandle_0=null}function gt(){}function bt(){wt=this}ot.prototype=Object.create(Me.prototype),ot.prototype.constructor=ot,kt.prototype=Object.create(Sr.prototype),kt.prototype.constructor=kt,Cr.prototype=Object.create(mo.prototype),Cr.prototype.constructor=Cr,Ze.prototype=Object.create(Cr.prototype),Ze.prototype.constructor=Ze,at.prototype=Object.create(ot.prototype),at.prototype.constructor=at,lt.prototype=Object.create(at.prototype),lt.prototype.constructor=lt,ut.prototype=Object.create(ot.prototype),ut.prototype.constructor=ut,ct.prototype=Object.create(ut.prototype),ct.prototype.constructor=ct,Qi.prototype=Object.create(ot.prototype),Qi.prototype.constructor=Qi,pt.prototype=Object.create(Qi.prototype),pt.prototype.constructor=pt,ht.prototype=Object.create(Qi.prototype),ht.prototype.constructor=ht,yt.prototype=Object.create(kt.prototype),yt.prototype.constructor=yt,$t.prototype=Object.create(kt.prototype),$t.prototype.constructor=$t,Wi.prototype=Object.create(co.prototype),Wi.prototype.constructor=Wi,vt.prototype=Object.create(Wi.prototype),vt.prototype.constructor=vt,Et.prototype=Object.create(kt.prototype),Et.prototype.constructor=Et,Ot.prototype=Object.create(Me.prototype),Ot.prototype.constructor=Ot,It.prototype=Object.create(Rt.prototype),It.prototype.constructor=It,zt.prototype=Object.create(C.prototype),zt.prototype.constructor=zt,Gt.prototype=Object.create(C.prototype),Gt.prototype.constructor=Gt,ne.prototype=Object.create(A.prototype),ne.prototype.constructor=ne,_e.prototype=Object.create(zt.prototype),_e.prototype.constructor=_e,Gr.prototype=Object.create(_e.prototype),Gr.prototype.constructor=Gr,ye.prototype=Object.create(Gr.prototype),$e.prototype=Object.create(S.prototype),$e.prototype.constructor=$e,ve.prototype=Object.create(B.prototype),ve.prototype.constructor=ve,qe.prototype=Object.create(Ze.prototype),qe.prototype.constructor=qe,Ge.prototype=Object.create(vt.prototype),Ge.prototype.constructor=Ge,We.prototype=Object.create(Me.prototype),We.prototype.constructor=We,bo.prototype=Object.create(mo.prototype),bo.prototype.constructor=bo,Je.prototype=Object.create(bo.prototype),Je.prototype.constructor=Je,tn.prototype=Object.create(Ze.prototype),tn.prototype.constructor=tn,en.prototype=Object.create(Ze.prototype),en.prototype.constructor=en,nn.prototype=Object.create(Ze.prototype),nn.prototype.constructor=nn,rn.prototype=Object.create(Ze.prototype),rn.prototype.constructor=rn,on.prototype=Object.create(Ze.prototype),on.prototype.constructor=on,an.prototype=Object.create(Ze.prototype),an.prototype.constructor=an,sn.prototype=Object.create(an.prototype),sn.prototype.constructor=sn,ln.prototype=Object.create(an.prototype),ln.prototype.constructor=ln,un.prototype=Object.create(an.prototype),un.prototype.constructor=un,cn.prototype=Object.create(zt.prototype),cn.prototype.constructor=cn,pn.prototype=Object.create(C.prototype),hn.prototype=Object.create(We.prototype),hn.prototype.constructor=hn,Yr.prototype=Object.create(U.prototype),Yr.prototype.constructor=Yr,_n.prototype=Object.create(Yr.prototype),_n.prototype.constructor=_n,fn.prototype=Object.create(zt.prototype),fn.prototype.constructor=fn,yn.prototype=Object.create(C.prototype),yn.prototype.constructor=yn,vo.prototype=Object.create(qi.prototype),vo.prototype.constructor=vo,yo.prototype=Object.create(vo.prototype),yo.prototype.constructor=yo,Nn.prototype=Object.create(yo.prototype),Nn.prototype.constructor=Nn,Pn.prototype=Object.create(Nn.prototype),Pn.prototype.constructor=Pn,$o.prototype=Object.create(vo.prototype),$o.prototype.constructor=$o,Ln.prototype=Object.create($o.prototype),Ln.prototype.constructor=Ln,Wn.prototype=Object.create(mo.prototype),Wn.prototype.constructor=Wn,In.prototype=Object.create(Wn.prototype),In.prototype.constructor=In,zn.prototype=Object.create(Wn.prototype),zn.prototype.constructor=zn,Bn.prototype=Object.create($o.prototype),Bn.prototype.constructor=Bn,Gn.prototype=Object.create(kt.prototype),Gn.prototype.constructor=Gn,Qn.prototype=Object.create(mo.prototype),Qn.prototype.constructor=Qn,Yn.prototype=Object.create(Qn.prototype),Yn.prototype.constructor=Yn,Vn.prototype=Object.create(Qn.prototype),Vn.prototype.constructor=Vn,Kn.prototype=Object.create(Qn.prototype),Kn.prototype.constructor=Kn,Dn.prototype=Object.create(On.prototype),Dn.prototype.constructor=Dn,Zn.prototype=Object.create(Wn.prototype),Zn.prototype.constructor=Zn,Jn.prototype=Object.create(Wn.prototype),Jn.prototype.constructor=Jn,ti.prototype=Object.create(Dn.prototype),ti.prototype.constructor=ti,ei.prototype=Object.create(ot.prototype),Pi.prototype=Object.create(U.prototype),Pi.prototype.constructor=Pi,Ai.prototype=Object.create(K.prototype),Ai.prototype.constructor=Ai,ji.prototype=Object.create(ot.prototype),Ri.prototype=Object.create(Dn.prototype),Ri.prototype.constructor=Ri,Ii.prototype=Object.create(Dn.prototype),Ii.prototype.constructor=Ii,Di.prototype=Object.create(Dn.prototype),Di.prototype.constructor=Di,Fi.prototype=Object.create(Ui.prototype),Fi.prototype.constructor=Fi,Gi.prototype=Object.create(Wi.prototype),Gi.prototype.constructor=Gi,gr.prototype=Object.create(an.prototype),gr.prototype.constructor=gr,br.prototype=Object.create(Ui.prototype),br.prototype.constructor=br,wr.prototype=Object.create(Fi.prototype),wr.prototype.constructor=wr,xr.prototype=Object.create(mo.prototype),xr.prototype.constructor=xr,vr.prototype=Object.create(bo.prototype),vr.prototype.constructor=vr,Ur.prototype=Object.create(cn.prototype),Ur.prototype.constructor=Ur,qr.prototype=Object.create(_e.prototype),qr.prototype.constructor=qr,Kr.prototype=Object.create(Yr.prototype),Kr.prototype.constructor=Kr,lo.prototype=Object.create(Bi.prototype),lo.prototype.constructor=lo,Zr.prototype=Object.create(lo.prototype),Zr.prototype.constructor=Zr,Xr.prototype=Object.create(zt.prototype),Xr.prototype.constructor=Xr,Jr.prototype=Object.create(Xr.prototype),Jr.prototype.constructor=Jr,eo.prototype=Object.create(Xr.prototype),eo.prototype.constructor=eo,ro.prototype=Object.create(kt.prototype),ro.prototype.constructor=ro,oo.prototype=Object.create(zt.prototype),oo.prototype.constructor=oo,so.prototype=Object.create(lo.prototype),so.prototype.constructor=so,go.prototype=Object.create(Ui.prototype),go.prototype.constructor=go,Object.defineProperty(ot.prototype,"context",{get:function(){return this.context_p8rm81$_0}}),Object.defineProperty(ot.prototype,"coroutineContext",{get:function(){return this.context}}),Object.defineProperty(ot.prototype,"isActive",{get:function(){return e.callGetter(this,Me.prototype,"isActive")}}),ot.prototype.initParentJob_8be2vx$=function(){this.initParentJobInternal_8vd9i7$(this.parentContext.get_j3r2sn$(xe()))},ot.prototype.onStart=function(){},ot.prototype.onStartInternal=function(){this.onStart()},ot.prototype.onCompleted_11rb$=function(t){},ot.prototype.onCancelled_z1nxw$=function(t,e){},ot.prototype.cancellationExceptionMessage=function(){return Ir(this)+" was cancelled"},ot.prototype.onCompletionInternal_s8jyv4$=function(t){var n;e.isType(t,Rt)?this.onCancelled_z1nxw$(t.cause,t.handled):this.onCompleted_11rb$(null==(n=t)||e.isType(n,i)?n:r())},ot.prototype.resumeWith_tl1gpc$=function(t){var e=this.makeCompletingOnce_8ea4ql$(At(t));e!==Pe&&this.afterResume_s8jyv4$(e)},ot.prototype.afterResume_s8jyv4$=function(t){this.afterCompletion_s8jyv4$(t)},ot.prototype.handleOnCompletionException_tcv7n7$=function(t){Dt(this.context,t)},ot.prototype.nameString=function(){var t;return null==(this.context,t=null)?Me.prototype.nameString.call(this):'"'+t+'":'+Me.prototype.nameString.call(this)},ot.prototype.start_cfq2d3$=function(t,e){this.initParentJob_8be2vx$(),t.invoke_810yno$(e,this)},ot.prototype.start_b5ul0p$=function(t,e,n){this.initParentJob_8be2vx$(),t.invoke_3o0yor$(n,e,this)},ot.$metadata$={kind:o,simpleName:"AbstractCoroutine",interfaces:[Kt,a,Me,ge]},at.prototype.getCompleted=function(){var t;return null==(t=this.getCompletedInternal_8be2vx$())||e.isType(t,i)?t:r()},st.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[l]},st.prototype=Object.create(l.prototype),st.prototype.constructor=st,st.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.awaitInternal_8be2vx$(this),this.result_0===s)return s;continue;case 1:throw this.exception_0;case 2:return null==(t=this.result_0)||e.isType(t,i)?t:r();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},at.prototype.await=function(t,e){var n=new st(this,t);return e?n:n.doResume(null)},Object.defineProperty(at.prototype,"onAwait",{get:function(){return this}}),at.prototype.registerSelectClause1_o3xas4$=function(t,e){this.registerSelectClause1Internal_u6kgbh$(t,e)},at.$metadata$={kind:o,simpleName:"DeferredCoroutine",interfaces:[dr,ue,ot]},lt.prototype.onStart=function(){ar(this.continuation_0,this)},lt.$metadata$={kind:o,simpleName:"LazyDeferredCoroutine",interfaces:[at]},$("kotlinx-coroutines-core.kotlinx.coroutines.invoke_5xrhu2$",v((function(){var n=t.kotlinx.coroutines.withContext_i5cbzn$;return function(t,i,r){return e.suspendCall(n(t,i,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),ut.prototype.handleJobException_tcv7n7$=function(t){return Dt(this.context,t),!0},ut.$metadata$={kind:o,simpleName:"StandaloneCoroutine",interfaces:[ot]},ct.prototype.onStart=function(){ar(this.continuation_0,this)},ct.$metadata$={kind:o,simpleName:"LazyStandaloneCoroutine",interfaces:[ut]},pt.prototype.afterResume_s8jyv4$=function(t){var e=Lt(t,this.uCont);this.uCont.context,this.uCont.resumeWith_tl1gpc$(e)},pt.$metadata$={kind:o,simpleName:"UndispatchedCoroutine",interfaces:[Qi]},ht.prototype.trySuspend_0=function(){for(this._decision_0;;)switch(this._decision_0){case 0:if(0===this._decision_0&&(this._decision_0=1,1))return!0;break;case 2:return!1;default:throw g("Already suspended".toString())}},ht.prototype.tryResume_0=function(){for(this._decision_0;;)switch(this._decision_0){case 0:if(0===this._decision_0&&(this._decision_0=2,1))return!0;break;case 1:return!1;default:throw g("Already resumed".toString())}},ht.prototype.afterCompletion_s8jyv4$=function(t){this.afterResume_s8jyv4$(t)},ht.prototype.afterResume_s8jyv4$=function(t){this.tryResume_0()||Hi(p(this.uCont),Lt(t,this.uCont))},ht.prototype.getResult=function(){var t;if(this.trySuspend_0())return s;var n=Ve(this.state_8be2vx$);if(e.isType(n,Rt))throw n.cause;return null==(t=n)||e.isType(t,i)?t:r()},ht.$metadata$={kind:o,simpleName:"DispatchedCoroutine",interfaces:[Qi]},_t.prototype.tryResume_19pj23$=function(t,e,n){return void 0===e&&(e=null),n?n(t,e):this.tryResume_19pj23$$default(t,e)},_t.prototype.cancel_dbl4no$=function(t,e){return void 0===t&&(t=null),e?e(t):this.cancel_dbl4no$$default(t)},_t.$metadata$={kind:b,simpleName:"CancellableContinuation",interfaces:[a]},$("kotlinx-coroutines-core.kotlinx.coroutines.suspendCancellableCoroutine_o6sdx9$",v((function(){var n=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,i=t.kotlinx.coroutines.CancellableContinuationImpl;return function(t,r){return e.suspendCall((o=t,function(t){var e=new i(n(t),1);return o(e),e.getResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());var o}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.suspendAtomicCancellableCoroutine_o6sdx9$",v((function(){var n=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,i=t.kotlinx.coroutines.CancellableContinuationImpl;return function(t,r){return e.suspendCall((o=t,function(t){var e=new i(n(t),0);return o(e),e.getResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());var o}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.suspendAtomicCancellableCoroutineReusable_mkkzkw$",v((function(){var n=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,i=t.kotlinx.coroutines.getOrCreateCancellableContinuation_3j0xf1$;return function(t,r){return e.suspendCall((o=t,function(t){var e=i(n(t));return o(e),e.getResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());var o}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.suspendAtomicCancellableCoroutine_i8nyj0$",v((function(){var n=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,i=t.kotlinx.coroutines.CancellableContinuationImpl;return function(t,r,o){return void 0===t&&(t=!1),e.suspendCall((a=r,function(t){var e=new i(n(t),0);return a(e),e.getResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());var a}}))),yt.prototype.invoke=function(t){this.node_0.remove()},yt.prototype.toString=function(){return"RemoveOnCancel["+this.node_0+"]"},yt.$metadata$={kind:o,simpleName:"RemoveOnCancel",interfaces:[kt]},$t.prototype.invoke=function(t){this.handle_0.dispose()},$t.prototype.toString=function(){return"DisposeOnCancel["+this.handle_0+"]"},$t.$metadata$={kind:o,simpleName:"DisposeOnCancel",interfaces:[kt]},Object.defineProperty(vt.prototype,"delegate",{get:function(){return this.delegate_dhbmku$_0}}),Object.defineProperty(vt.prototype,"context",{get:function(){return this.context_xycjfy$_0}}),Object.defineProperty(vt.prototype,"parentHandle_0",{get:function(){return this._parentHandle_0},set:function(t){this._parentHandle_0=t}}),Object.defineProperty(vt.prototype,"state_8be2vx$",{get:function(){return this._state_0}}),Object.defineProperty(vt.prototype,"isActive",{get:function(){return e.isType(this.state_8be2vx$,gt)}}),Object.defineProperty(vt.prototype,"isCompleted",{get:function(){return!e.isType(this.state_8be2vx$,gt)}}),Object.defineProperty(vt.prototype,"isCancelled",{get:function(){return e.isType(this.state_8be2vx$,It)}}),vt.prototype.initCancellability=function(){},vt.prototype.isReusable_0=function(){return e.isType(this.delegate,Gi)&&this.delegate.isReusable},vt.prototype.resetState_8be2vx$=function(){var t=this._state_0;return e.isType(t,Ct)?(this.detachChild_8be2vx$(),!1):(this._decision_0=0,this._state_0=xt(),!0)},vt.prototype.setupCancellation_0=function(){var t;if(!this.checkCompleted_0()&&null===this.parentHandle_0&&null!=(t=this.delegate.context.get_j3r2sn$(xe()))){var e=t;e.start();var n=e.invokeOnCompletion_ct2b2z$(!0,void 0,new un(e,this));this.parentHandle_0=n,this.isCompleted&&!this.isReusable_0()&&(n.dispose(),this.parentHandle_0=De())}},vt.prototype.checkCompleted_0=function(){var t,n,i,r=this.isCompleted;if(0!==this.resumeMode)return r;if(null==(n=e.isType(t=this.delegate,Gi)?t:null))return r;if(null==(i=n.checkPostponedCancellation_jp3215$(this)))return r;var o=i;return r||this.cancel_dbl4no$(o),!0},Object.defineProperty(vt.prototype,"callerFrame",{get:function(){var t;return e.isType(t=this.delegate,Eo)?t:null}}),vt.prototype.getStackTraceElement=function(){return null},vt.prototype.takeState=function(){return this.state_8be2vx$},vt.prototype.cancelResult_83a7kv$=function(t,n){if(e.isType(t,St))try{t.onCancellation(n)}catch(t){if(!e.isType(t,w))throw t;Dt(this.context,new $e("Exception in cancellation handler for "+this,t))}},vt.prototype.cancelLater_0=function(t){var n,i;return 0===this.resumeMode&&null!=(i=e.isType(n=this.delegate,Gi)?n:null)&&i.postponeCancellation_tcv7n7$(t)},vt.prototype.cancel_dbl4no$$default=function(t){for(this._state_0;;){var n=this._state_0;t:do{if(!e.isType(n,gt))return!1;var i=new It(this,t,e.isType(n,kt));if(this._state_0!==n||(this._state_0=i,0))break t;if(e.isType(n,kt))try{n.invoke(t)}catch(t){if(!e.isType(t,w))throw t;Dt(this.context,new $e("Exception in cancellation handler for "+this,t))}return this.detachChildIfNonResuable_0(),this.dispatchResume_0(0),!0}while(0)}},vt.prototype.parentCancelled_8o0b5c$=function(t){this.cancelLater_0(t)||(this.cancel_dbl4no$(t),this.detachChildIfNonResuable_0())},vt.prototype.invokeHandlerSafely_0=function(t){try{t()}catch(t){if(!e.isType(t,w))throw t;Dt(this.context,new $e("Exception in cancellation handler for "+this,t))}},vt.prototype.getContinuationCancellationCause_dqr1mp$=function(t){return t.getCancellationException()},vt.prototype.trySuspend_0=function(){for(this._decision_0;;)switch(this._decision_0){case 0:if(0===this._decision_0&&(this._decision_0=1,1))return!0;break;case 2:return!1;default:throw g("Already suspended".toString())}},vt.prototype.tryResume_0=function(){for(this._decision_0;;)switch(this._decision_0){case 0:if(0===this._decision_0&&(this._decision_0=2,1))return!0;break;case 1:return!1;default:throw g("Already resumed".toString())}},vt.prototype.getResult=function(){if(this.setupCancellation_0(),this.trySuspend_0())return s;var t=this.state_8be2vx$;if(e.isType(t,Rt))throw wo(t.cause);if(1===this.resumeMode){var n=this.context.get_j3r2sn$(xe());if(null!=n&&!n.isActive){var i=n.getCancellationException();throw this.cancelResult_83a7kv$(t,i),wo(i)}}return this.getSuccessfulResult_tpy1pm$(t)},vt.prototype.resumeWith_tl1gpc$=function(t){this.resumeImpl_0(jt(t,this),this.resumeMode)},vt.prototype.resume_qnlsu9$=function(t,n){var i=this.resumeImpl_0(new St(t,n),this.resumeMode);if(null!=i)try{n(i.cause)}catch(t){if(!e.isType(t,w))throw t;Dt(this.context,new $e("Exception in cancellation handler for "+this,t))}},vt.prototype.invokeOnCancellation_f05bi3$=function(t){var n={v:null};for(this._state_0;;){var i,r=this._state_0;if(e.isType(r,bt)){var o;if(null!=(i=n.v))o=i;else{var a=this.makeHandler_0(t);n.v=a,o=a}var s=o;if(this._state_0===r&&(this._state_0=s,1))return}else{if(!e.isType(r,kt)){if(e.isType(r,It)){r.makeHandled()||this.multipleHandlersError_0(t,r);try{var l,u;Tr(t,null!=(u=e.isType(l=r,Rt)?l:null)?u.cause:null)}catch(t){if(!e.isType(t,w))throw t;Dt(this.context,new $e("Exception in cancellation handler for "+this,t))}return}return}this.multipleHandlersError_0(t,r)}}},vt.prototype.multipleHandlersError_0=function(t,e){throw g(("It's prohibited to register multiple handlers, tried to register "+t+", already has "+x(e)).toString())},vt.prototype.makeHandler_0=function(t){return e.isType(t,kt)?t:new Et(t)},vt.prototype.dispatchResume_0=function(t){this.tryResume_0()||Xi(this,t)},vt.prototype.resumeImpl_0=function(t,n){for(this._state_0;;){var i=this._state_0;t:do{if(e.isType(i,gt)){if(this._state_0!==i||(this._state_0=t,0))break t;return this.detachChildIfNonResuable_0(),this.dispatchResume_0(n),null}if(e.isType(i,It)&&i.makeResumed())return i;this.alreadyResumedError_0(t)}while(0)}},vt.prototype.alreadyResumedError_0=function(t){throw g(("Already resumed, but proposed with update "+x(t)).toString())},vt.prototype.detachChildIfNonResuable_0=function(){this.isReusable_0()||this.detachChild_8be2vx$()},vt.prototype.detachChild_8be2vx$=function(){var t=this.parentHandle_0;null!=t&&t.dispose(),this.parentHandle_0=De()},vt.prototype.tryResume_19pj23$$default=function(t,i){for(this._state_0;;){var r=this._state_0;t:do{if(e.isType(r,gt)){var o=null==i?t:new Ct(i,t);if(this._state_0!==r||(this._state_0=o,0))break t;return this.detachChildIfNonResuable_0(),n}return e.isType(r,Ct)&&r.idempotentResume===i?n:null}while(0)}},vt.prototype.tryResumeWithException_tcv7n7$=function(t){for(this._state_0;;){var i=this._state_0;t:do{if(e.isType(i,gt)){var r=new Rt(t);if(this._state_0!==i||(this._state_0=r,0))break t;return this.detachChildIfNonResuable_0(),n}return null}while(0)}},vt.prototype.completeResume_za3rmp$=function(t){this.dispatchResume_0(this.resumeMode)},vt.prototype.resumeUndispatched_hyuxa3$=function(t,n){var i,r=e.isType(i=this.delegate,Gi)?i:null;this.resumeImpl_0(n,(null!=r?r.dispatcher:null)===t?2:this.resumeMode)},vt.prototype.resumeUndispatchedWithException_gd0rtt$=function(t,n){var i,r=e.isType(i=this.delegate,Gi)?i:null;this.resumeImpl_0(new Rt(n),(null!=r?r.dispatcher:null)===t?2:this.resumeMode)},vt.prototype.getSuccessfulResult_tpy1pm$=function(t){var n,o,a;return e.isType(t,Ct)?null==(n=t.result)||e.isType(n,i)?n:r():e.isType(t,St)?null==(o=t.result)||e.isType(o,i)?o:r():null==(a=t)||e.isType(a,i)?a:r()},vt.prototype.toString=function(){return this.nameString()+"("+Ar(this.delegate)+"){"+x(this.state_8be2vx$)+"}@"+Rr(this)},vt.prototype.nameString=function(){return"CancellableContinuation"},vt.$metadata$={kind:o,simpleName:"CancellableContinuationImpl",interfaces:[Eo,_t,Wi]},gt.$metadata$={kind:b,simpleName:"NotCompleted",interfaces:[]},bt.prototype.toString=function(){return"Active"},bt.$metadata$={kind:k,simpleName:"Active",interfaces:[gt]};var wt=null;function xt(){return null===wt&&new bt,wt}function kt(){Sr.call(this)}function Et(t){kt.call(this),this.handler_0=t}function Ct(t,e){this.idempotentResume=t,this.result=e}function St(t,e){this.result=t,this.onCancellation=e}function Tt(){}function Ot(t){Me.call(this,!0),this.initParentJobInternal_8vd9i7$(t)}function Nt(t,e){l.call(this,e),this.exceptionState_0=1,this.$this=t}function Pt(){}function At(t){var n,o=t.exceptionOrNull();return null==o?null==(n=t.value)||e.isType(n,i)?n:r():new Rt(o)}function jt(t,n){var o,a=t.exceptionOrNull();return null==a?null==(o=t.value)||e.isType(o,i)?o:r():new Rt(wo(a))}function Lt(t,n){var o;return e.isType(t,Rt)?new _(E(wo(t.cause))):(_.Companion,new _(null==(o=t)||e.isType(o,i)?o:r()))}function Rt(t,e){void 0===e&&(e=!1),this.cause=t,this._handled_0=e}function It(t,e,n){Rt.call(this,null!=e?e:Vr("Continuation "+t+" was cancelled normally"),n),this._resumed_0=!1}function zt(){C.call(this,m.Key)}function Dt(t,n){var i;try{if(null!=(i=t.get_j3r2sn$(qt())))return void i.handleException_1ur55u$(t,n)}catch(t){if(e.isType(t,w))return void Lr(0,Mt(n,t));throw t}Lr(0,n)}function Mt(t,e){return t===e?t:new S("Exception while trying to handle coroutine exception",e)}function Bt(){qt()}function Ut(){Ft=this}kt.$metadata$={kind:o,simpleName:"CancelHandler",interfaces:[gt,Sr]},Et.prototype.invoke=function(t){this.handler_0(t)},Et.prototype.toString=function(){return"InvokeOnCancel["+Ir(this.handler_0)+"@"+Rr(this)+"]"},Et.$metadata$={kind:o,simpleName:"InvokeOnCancel",interfaces:[kt]},Ct.prototype.toString=function(){return"CompletedIdempotentResult["+x(this.result)+"]"},Ct.$metadata$={kind:o,simpleName:"CompletedIdempotentResult",interfaces:[]},St.prototype.toString=function(){return"CompletedWithCancellation["+x(this.result)+"]"},St.$metadata$={kind:o,simpleName:"CompletedWithCancellation",interfaces:[]},Tt.$metadata$={kind:b,simpleName:"CompletableDeferred",interfaces:[ue]},Object.defineProperty(Ot.prototype,"onCancelComplete",{get:function(){return!0}}),Ot.prototype.getCompleted=function(){var t;return null==(t=this.getCompletedInternal_8be2vx$())||e.isType(t,i)?t:r()},Nt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[l]},Nt.prototype=Object.create(l.prototype),Nt.prototype.constructor=Nt,Nt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.awaitInternal_8be2vx$(this),this.result_0===s)return s;continue;case 1:throw this.exception_0;case 2:return null==(t=this.result_0)||e.isType(t,i)?t:r();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.await=function(t,e){var n=new Nt(this,t);return e?n:n.doResume(null)},Object.defineProperty(Ot.prototype,"onAwait",{get:function(){return this}}),Ot.prototype.registerSelectClause1_o3xas4$=function(t,e){this.registerSelectClause1Internal_u6kgbh$(t,e)},Ot.prototype.complete_11rb$=function(t){return this.makeCompleting_8ea4ql$(t)},Ot.prototype.completeExceptionally_tcv7n7$=function(t){return this.makeCompleting_8ea4ql$(new Rt(t))},Ot.$metadata$={kind:o,simpleName:"CompletableDeferredImpl",interfaces:[dr,Tt,Me]},Pt.$metadata$={kind:b,simpleName:"CompletableJob",interfaces:[ge]},Object.defineProperty(Rt.prototype,"handled",{get:function(){return this._handled_0}}),Rt.prototype.makeHandled=function(){return!1===this._handled_0&&(this._handled_0=!0,!0)},Rt.prototype.toString=function(){return Ir(this)+"["+this.cause+"]"},Rt.$metadata$={kind:o,simpleName:"CompletedExceptionally",interfaces:[]},It.prototype.makeResumed=function(){return!1===this._resumed_0&&(this._resumed_0=!0,!0)},It.$metadata$={kind:o,simpleName:"CancelledContinuation",interfaces:[Rt]},zt.prototype.isDispatchNeeded_1fupul$=function(t){return!0},zt.prototype.dispatchYield_5bn72i$=function(t,e){this.dispatch_5bn72i$(t,e)},zt.prototype.interceptContinuation_wj8d80$=function(t){return new Gi(this,t)},zt.prototype.releaseInterceptedContinuation_k98bjh$=function(t){var n,i;null!=(i=(e.isType(n=t,Gi)?n:r()).reusableCancellableContinuation)&&i.detachChild_8be2vx$()},zt.prototype.plus_9wrrq5$=function(t){return t},zt.prototype.toString=function(){return Ir(this)+"@"+Rr(this)},zt.$metadata$={kind:o,simpleName:"CoroutineDispatcher",interfaces:[m,C]},Ut.$metadata$={kind:k,simpleName:"Key",interfaces:[T]};var Ft=null;function qt(){return null===Ft&&new Ut,Ft}function Gt(t){Vt(),C.call(this,Vt()),this.name=t}function Ht(){Yt=this}Bt.$metadata$={kind:b,simpleName:"CoroutineExceptionHandler",interfaces:[O]},Ht.$metadata$={kind:k,simpleName:"Key",interfaces:[T]};var Yt=null;function Vt(){return null===Yt&&new Ht,Yt}function Kt(){}function Wt(){te=this}Gt.prototype.toString=function(){return"CoroutineName("+this.name+")"},Gt.$metadata$={kind:o,simpleName:"CoroutineName",interfaces:[C]},Gt.prototype.component1=function(){return this.name},Gt.prototype.copy_61zpoe$=function(t){return new Gt(void 0===t?this.name:t)},Gt.prototype.hashCode=function(){var t=0;return 31*t+e.hashCode(this.name)|0},Gt.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)},Kt.$metadata$={kind:b,simpleName:"CoroutineScope",interfaces:[]},Object.defineProperty(Wt.prototype,"coroutineContext",{get:function(){return f.EmptyCoroutineContext}}),Wt.$metadata$={kind:k,simpleName:"GlobalScope",interfaces:[Kt]};var Xt,Zt,Jt,Qt,te=null;function ee(t,e){var n;if(void 0===e&&(e=null),null==(n=t.coroutineContext.get_j3r2sn$(xe())))throw g(("Scope cannot be cancelled because it does not have a job: "+t).toString());n.cancel_m4sck1$(e)}function ne(t,e){A.call(this),this.name$=t,this.ordinal$=e}function ie(){ie=function(){},Xt=new ne("DEFAULT",0),Zt=new ne("LAZY",1),Jt=new ne("ATOMIC",2),Qt=new ne("UNDISPATCHED",3)}function re(){return ie(),Xt}function oe(){return ie(),Zt}function ae(){return ie(),Jt}function se(){return ie(),Qt}function le(){}function ue(){}function ce(t){return function(e){var n=new vt(p(e),1);return t(n),n.getResult()}}function pe(){}function he(t){var n,i;return null!=(i=e.isType(n=t.get_j3r2sn$(m.Key),pe)?n:null)?i:Nr()}function _e(){zt.call(this),this.useCount_0=R,this.shared_0=!1,this.unconfinedQueue_0=null}function fe(){de=this,this.ref_0=new Oo}ne.prototype.invoke_810yno$=function(t,n){switch(this.name){case"DEFAULT":rr(t,n);break;case"ATOMIC":N(t,n);break;case"UNDISPATCHED":ur(t,n);break;case"LAZY":break;default:e.noWhenBranchMatched()}},ne.prototype.invoke_3o0yor$=function(t,n,i){switch(this.name){case"DEFAULT":or(t,n,i);break;case"ATOMIC":P(t,n,i);break;case"UNDISPATCHED":cr(t,n,i);break;case"LAZY":break;default:e.noWhenBranchMatched()}},Object.defineProperty(ne.prototype,"isLazy",{get:function(){return this===oe()}}),ne.$metadata$={kind:o,simpleName:"CoroutineStart",interfaces:[A]},ne.values=function(){return[re(),oe(),ae(),se()]},ne.valueOf_61zpoe$=function(t){switch(t){case"DEFAULT":return re();case"LAZY":return oe();case"ATOMIC":return ae();case"UNDISPATCHED":return se();default:j("No enum constant kotlinx.coroutines.CoroutineStart."+t)}},le.$metadata$={kind:b,simpleName:"CopyableThrowable",interfaces:[]},ue.$metadata$={kind:b,simpleName:"Deferred",interfaces:[ge]},pe.prototype.delay_s8cxhz$=function(t,e){if(!(t.toNumber()<=0))return ce((n=t,i=this,function(t){return i.scheduleResumeAfterDelay_egqmvs$(n,t),u}))(e);var n,i},pe.prototype.invokeOnTimeout_8irseu$=function(t,e){return Nr().invokeOnTimeout_8irseu$(t,e)},pe.$metadata$={kind:b,simpleName:"Delay",interfaces:[]},_e.prototype.processNextEvent=function(){return this.processUnconfinedEvent()?this.nextTime:L},Object.defineProperty(_e.prototype,"isEmpty",{get:function(){return this.isUnconfinedQueueEmpty}}),Object.defineProperty(_e.prototype,"nextTime",{get:function(){var t;return null==(t=this.unconfinedQueue_0)||t.isEmpty?L:R}}),_e.prototype.processUnconfinedEvent=function(){var t,e;return null!=(t=this.unconfinedQueue_0)&&null!=(e=t.removeFirstOrNull())&&(e.run(),!0)},_e.prototype.shouldBeProcessedFromContext=function(){return!1},_e.prototype.dispatchUnconfined_4avnfa$=function(t){var e,n;if(null!=(e=this.unconfinedQueue_0))n=e;else{var i=new Bi;this.unconfinedQueue_0=i,n=i}n.addLast_trkh7z$(t)},Object.defineProperty(_e.prototype,"isActive",{get:function(){return this.useCount_0.toNumber()>0}}),Object.defineProperty(_e.prototype,"isUnconfinedLoopActive",{get:function(){return this.useCount_0.compareTo_11rb$(this.delta_0(!0))>=0}}),Object.defineProperty(_e.prototype,"isUnconfinedQueueEmpty",{get:function(){var t,e;return null==(e=null!=(t=this.unconfinedQueue_0)?t.isEmpty:null)||e}}),_e.prototype.delta_0=function(t){return t?I:z},_e.prototype.incrementUseCount_6taknv$=function(t){void 0===t&&(t=!1),this.useCount_0=this.useCount_0.add(this.delta_0(t)),t||(this.shared_0=!0)},_e.prototype.decrementUseCount_6taknv$=function(t){void 0===t&&(t=!1),this.useCount_0=this.useCount_0.subtract(this.delta_0(t)),this.useCount_0.toNumber()>0||this.shared_0&&this.shutdown()},_e.prototype.shutdown=function(){},_e.$metadata$={kind:o,simpleName:"EventLoop",interfaces:[zt]},Object.defineProperty(fe.prototype,"eventLoop_8be2vx$",{get:function(){var t,e;if(null!=(t=this.ref_0.get()))e=t;else{var n=Fr();this.ref_0.set_11rb$(n),e=n}return e}}),fe.prototype.currentOrNull_8be2vx$=function(){return this.ref_0.get()},fe.prototype.resetEventLoop_8be2vx$=function(){this.ref_0.set_11rb$(null)},fe.prototype.setEventLoop_13etkv$=function(t){this.ref_0.set_11rb$(t)},fe.$metadata$={kind:k,simpleName:"ThreadLocalEventLoop",interfaces:[]};var de=null;function me(){return null===de&&new fe,de}function ye(){Gr.call(this),this._queue_0=null,this._delayed_0=null,this._isCompleted_0=!1}function $e(t,e){S.call(this,t,e),this.name="CompletionHandlerException"}function ve(t,e){B.call(this,t,e),this.name="CoroutinesInternalError"}function ge(){xe()}function be(){we=this,qt()}$e.$metadata$={kind:o,simpleName:"CompletionHandlerException",interfaces:[S]},ve.$metadata$={kind:o,simpleName:"CoroutinesInternalError",interfaces:[B]},be.$metadata$={kind:k,simpleName:"Key",interfaces:[T]};var we=null;function xe(){return null===we&&new be,we}function ke(t){return void 0===t&&(t=null),new We(t)}function Ee(){}function Ce(){}function Se(){}function Te(){}function Oe(){ze=this}ge.prototype.cancel_m4sck1$=function(t,e){void 0===t&&(t=null),e?e(t):this.cancel_m4sck1$$default(t)},ge.prototype.cancel=function(){this.cancel_m4sck1$(null)},ge.prototype.cancel_dbl4no$=function(t,e){return void 0===t&&(t=null),e?e(t):this.cancel_dbl4no$$default(t)},ge.prototype.invokeOnCompletion_ct2b2z$=function(t,e,n,i){return void 0===t&&(t=!1),void 0===e&&(e=!0),i?i(t,e,n):this.invokeOnCompletion_ct2b2z$$default(t,e,n)},ge.prototype.plus_dqr1mp$=function(t){return t},ge.$metadata$={kind:b,simpleName:"Job",interfaces:[O]},Ee.$metadata$={kind:b,simpleName:"DisposableHandle",interfaces:[]},Ce.$metadata$={kind:b,simpleName:"ChildJob",interfaces:[ge]},Se.$metadata$={kind:b,simpleName:"ParentJob",interfaces:[ge]},Te.$metadata$={kind:b,simpleName:"ChildHandle",interfaces:[Ee]},Oe.prototype.dispose=function(){},Oe.prototype.childCancelled_tcv7n7$=function(t){return!1},Oe.prototype.toString=function(){return"NonDisposableHandle"},Oe.$metadata$={kind:k,simpleName:"NonDisposableHandle",interfaces:[Te,Ee]};var Ne,Pe,Ae,je,Le,Re,Ie,ze=null;function De(){return null===ze&&new Oe,ze}function Me(t){this._state_v70vig$_0=t?Ie:Re,this._parentHandle_acgcx5$_0=null}function Be(t,e){return function(){return t.state_8be2vx$===e}}function Ue(t,e,n,i){l.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$this$JobSupport=t,this.local$tmp$=void 0,this.local$tmp$_0=void 0,this.local$cur=void 0,this.local$$receiver=e}function Fe(t,e,n){this.list_m9wkmb$_0=t,this._isCompleting_0=e,this._rootCause_0=n,this._exceptionsHolder_0=null}function qe(t,e,n,i){Ze.call(this,n.childJob),this.parent_0=t,this.state_0=e,this.child_0=n,this.proposedUpdate_0=i}function Ge(t,e){vt.call(this,t,1),this.job_0=e}function He(t){this.state=t}function Ye(t){return e.isType(t,Xe)?new He(t):t}function Ve(t){var n,i,r;return null!=(r=null!=(i=e.isType(n=t,He)?n:null)?i.state:null)?r:t}function Ke(t){this.isActive_hyoax9$_0=t}function We(t){Me.call(this,!0),this.initParentJobInternal_8vd9i7$(t),this.handlesException_fejgjb$_0=this.handlesExceptionF()}function Xe(){}function Ze(t){Cr.call(this),this.job=t}function Je(){bo.call(this)}function Qe(t){this.list_afai45$_0=t}function tn(t,e){Ze.call(this,t),this.handler_0=e}function en(t,e){Ze.call(this,t),this.continuation_0=e}function nn(t,e){Ze.call(this,t),this.continuation_0=e}function rn(t,e,n){Ze.call(this,t),this.select_0=e,this.block_0=n}function on(t,e,n){Ze.call(this,t),this.select_0=e,this.block_0=n}function an(t){Ze.call(this,t)}function sn(t,e){an.call(this,t),this.handler_0=e,this._invoked_0=0}function ln(t,e){an.call(this,t),this.childJob=e}function un(t,e){an.call(this,t),this.child=e}function cn(){zt.call(this)}function pn(){C.call(this,xe())}function hn(t){We.call(this,t)}function _n(t,e){Vr(t,this),this.coroutine_8be2vx$=e,this.name="TimeoutCancellationException"}function fn(){dn=this,zt.call(this)}Object.defineProperty(Me.prototype,"key",{get:function(){return xe()}}),Object.defineProperty(Me.prototype,"parentHandle_8be2vx$",{get:function(){return this._parentHandle_acgcx5$_0},set:function(t){this._parentHandle_acgcx5$_0=t}}),Me.prototype.initParentJobInternal_8vd9i7$=function(t){if(null!=t){t.start();var e=t.attachChild_kx8v25$(this);this.parentHandle_8be2vx$=e,this.isCompleted&&(e.dispose(),this.parentHandle_8be2vx$=De())}else this.parentHandle_8be2vx$=De()},Object.defineProperty(Me.prototype,"state_8be2vx$",{get:function(){for(this._state_v70vig$_0;;){var t=this._state_v70vig$_0;if(!e.isType(t,Ui))return t;t.perform_s8jyv4$(this)}}}),Me.prototype.loopOnState_46ivxf$_0=function(t){for(;;)t(this.state_8be2vx$)},Object.defineProperty(Me.prototype,"isActive",{get:function(){var t=this.state_8be2vx$;return e.isType(t,Xe)&&t.isActive}}),Object.defineProperty(Me.prototype,"isCompleted",{get:function(){return!e.isType(this.state_8be2vx$,Xe)}}),Object.defineProperty(Me.prototype,"isCancelled",{get:function(){var t=this.state_8be2vx$;return e.isType(t,Rt)||e.isType(t,Fe)&&t.isCancelling}}),Me.prototype.finalizeFinishingState_10mr1z$_0=function(t,n){var i,o,a,s=null!=(o=e.isType(i=n,Rt)?i:null)?o.cause:null,l={v:!1};l.v=t.isCancelling;var u=t.sealLocked_dbl4no$(s),c=this.getFinalRootCause_3zkch4$_0(t,u);null!=c&&this.addSuppressedExceptions_85dgeo$_0(c,u);var p=c,h=null==p||p===s?n:new Rt(p);return null!=p&&(this.cancelParent_7dutpz$_0(p)||this.handleJobException_tcv7n7$(p))&&(e.isType(a=h,Rt)?a:r()).makeHandled(),l.v||this.onCancelling_dbl4no$(p),this.onCompletionInternal_s8jyv4$(h),this._state_v70vig$_0===t&&(this._state_v70vig$_0=Ye(h)),this.completeStateFinalization_a4ilmi$_0(t,h),h},Me.prototype.getFinalRootCause_3zkch4$_0=function(t,n){if(n.isEmpty())return t.isCancelling?new Kr(this.cancellationExceptionMessage(),null,this):null;var i;t:do{var r;for(r=n.iterator();r.hasNext();){var o=r.next();if(!e.isType(o,Yr)){i=o;break t}}i=null}while(0);if(null!=i)return i;var a=n.get_za3lpa$(0);if(e.isType(a,_n)){var s;t:do{var l;for(l=n.iterator();l.hasNext();){var u=l.next();if(u!==a&&e.isType(u,_n)){s=u;break t}}s=null}while(0);if(null!=s)return s}return a},Me.prototype.addSuppressedExceptions_85dgeo$_0=function(t,n){var i;if(!(n.size<=1)){var r=fo(n.size),o=t;for(i=n.iterator();i.hasNext();){var a=i.next();a!==t&&a!==o&&!e.isType(a,Yr)&&r.add_11rb$(a)}}},Me.prototype.tryFinalizeSimpleState_5emg4m$_0=function(t,e){return this._state_v70vig$_0===t&&(this._state_v70vig$_0=Ye(e),!0)&&(this.onCancelling_dbl4no$(null),this.onCompletionInternal_s8jyv4$(e),this.completeStateFinalization_a4ilmi$_0(t,e),!0)},Me.prototype.completeStateFinalization_a4ilmi$_0=function(t,n){var i,r,o,a;null!=(i=this.parentHandle_8be2vx$)&&(i.dispose(),this.parentHandle_8be2vx$=De());var s=null!=(o=e.isType(r=n,Rt)?r:null)?o.cause:null;if(e.isType(t,Ze))try{t.invoke(s)}catch(n){if(!e.isType(n,w))throw n;this.handleOnCompletionException_tcv7n7$(new $e("Exception in completion handler "+t+" for "+this,n))}else null!=(a=t.list)&&this.notifyCompletion_mgxta4$_0(a,s)},Me.prototype.notifyCancelling_xkpzb8$_0=function(t,n){var i;this.onCancelling_dbl4no$(n);for(var r={v:null},o=t._next;!y(o,t);){if(e.isType(o,an)){var a,s=o;try{s.invoke(n)}catch(t){if(!e.isType(t,w))throw t;null==(null!=(a=r.v)?a:null)&&(r.v=new $e("Exception in completion handler "+s+" for "+this,t))}}o=o._next}null!=(i=r.v)&&this.handleOnCompletionException_tcv7n7$(i),this.cancelParent_7dutpz$_0(n)},Me.prototype.cancelParent_7dutpz$_0=function(t){if(this.isScopedCoroutine)return!0;var n=e.isType(t,Yr),i=this.parentHandle_8be2vx$;return null===i||i===De()?n:i.childCancelled_tcv7n7$(t)||n},Me.prototype.notifyCompletion_mgxta4$_0=function(t,n){for(var i,r={v:null},o=t._next;!y(o,t);){if(e.isType(o,Ze)){var a,s=o;try{s.invoke(n)}catch(t){if(!e.isType(t,w))throw t;null==(null!=(a=r.v)?a:null)&&(r.v=new $e("Exception in completion handler "+s+" for "+this,t))}}o=o._next}null!=(i=r.v)&&this.handleOnCompletionException_tcv7n7$(i)},Me.prototype.notifyHandlers_alhslr$_0=v((function(){var t=e.equals;return function(n,i,r,o){for(var a,s={v:null},l=r._next;!t(l,r);){if(i(l)){var u,c=l;try{c.invoke(o)}catch(t){if(!e.isType(t,w))throw t;null==(null!=(u=s.v)?u:null)&&(s.v=new $e("Exception in completion handler "+c+" for "+this,t))}}l=l._next}null!=(a=s.v)&&this.handleOnCompletionException_tcv7n7$(a)}})),Me.prototype.start=function(){for(;;)switch(this.startInternal_tp1bqd$_0(this.state_8be2vx$)){case 0:return!1;case 1:return!0}},Me.prototype.startInternal_tp1bqd$_0=function(t){return e.isType(t,Ke)?t.isActive?0:this._state_v70vig$_0!==t||(this._state_v70vig$_0=Ie,0)?-1:(this.onStartInternal(),1):e.isType(t,Qe)?function(e){return e._state_v70vig$_0===t&&(e._state_v70vig$_0=t.list,!0)}(this)?(this.onStartInternal(),1):-1:0},Me.prototype.onStartInternal=function(){},Me.prototype.getCancellationException=function(){var t,n,i=this.state_8be2vx$;if(e.isType(i,Fe)){if(null==(n=null!=(t=i.rootCause)?this.toCancellationException_rg9tb7$(t,Ir(this)+" is cancelling"):null))throw g(("Job is still new or active: "+this).toString());return n}if(e.isType(i,Xe))throw g(("Job is still new or active: "+this).toString());return e.isType(i,Rt)?this.toCancellationException_rg9tb7$(i.cause):new Kr(Ir(this)+" has completed normally",null,this)},Me.prototype.toCancellationException_rg9tb7$=function(t,n){var i,r;return void 0===n&&(n=null),null!=(r=e.isType(i=t,Yr)?i:null)?r:new Kr(null!=n?n:this.cancellationExceptionMessage(),t,this)},Object.defineProperty(Me.prototype,"completionCause",{get:function(){var t,n=this.state_8be2vx$;if(e.isType(n,Fe)){if(null==(t=n.rootCause))throw g(("Job is still new or active: "+this).toString());return t}if(e.isType(n,Xe))throw g(("Job is still new or active: "+this).toString());return e.isType(n,Rt)?n.cause:null}}),Object.defineProperty(Me.prototype,"completionCauseHandled",{get:function(){var t=this.state_8be2vx$;return e.isType(t,Rt)&&t.handled}}),Me.prototype.invokeOnCompletion_f05bi3$=function(t){return this.invokeOnCompletion_ct2b2z$(!1,!0,t)},Me.prototype.invokeOnCompletion_ct2b2z$$default=function(t,n,i){for(var o={v:null};;){var a=this.state_8be2vx$;t:do{var s,l,u,c,p;if(e.isType(a,Ke))if(a.isActive){var h;if(null!=(s=o.v))h=s;else{var _=this.makeNode_9qhc1i$_0(i,t);o.v=_,h=_}var f=h;if(this._state_v70vig$_0===a&&(this._state_v70vig$_0=f,1))return f}else this.promoteEmptyToNodeList_lchanx$_0(a);else{if(!e.isType(a,Xe))return n&&Tr(i,null!=(p=e.isType(c=a,Rt)?c:null)?p.cause:null),De();var d=a.list;if(null==d)this.promoteSingleToNodeList_ft43ca$_0(e.isType(l=a,Ze)?l:r());else{var m,y={v:null},$={v:De()};if(t&&e.isType(a,Fe)){var v;y.v=a.rootCause;var g=null==y.v;if(g||(g=e.isType(i,ln)&&!a.isCompleting),g){var b;if(null!=(v=o.v))b=v;else{var w=this.makeNode_9qhc1i$_0(i,t);o.v=w,b=w}var x=b;if(!this.addLastAtomic_qayz7c$_0(a,d,x))break t;if(null==y.v)return x;$.v=x}}if(null!=y.v)return n&&Tr(i,y.v),$.v;if(null!=(u=o.v))m=u;else{var k=this.makeNode_9qhc1i$_0(i,t);o.v=k,m=k}var E=m;if(this.addLastAtomic_qayz7c$_0(a,d,E))return E}}}while(0)}},Me.prototype.makeNode_9qhc1i$_0=function(t,n){var i,r,o,a,s,l;return n?null!=(o=null!=(r=e.isType(i=t,an)?i:null)?r:null)?o:new sn(this,t):null!=(l=null!=(s=e.isType(a=t,Ze)?a:null)?s:null)?l:new tn(this,t)},Me.prototype.addLastAtomic_qayz7c$_0=function(t,e,n){var i;t:do{if(!Be(this,t)()){i=!1;break t}e.addLast_l2j9rm$(n),i=!0}while(0);return i},Me.prototype.promoteEmptyToNodeList_lchanx$_0=function(t){var e=new Je,n=t.isActive?e:new Qe(e);this._state_v70vig$_0===t&&(this._state_v70vig$_0=n)},Me.prototype.promoteSingleToNodeList_ft43ca$_0=function(t){t.addOneIfEmpty_l2j9rm$(new Je);var e=t._next;this._state_v70vig$_0===t&&(this._state_v70vig$_0=e)},Me.prototype.join=function(t){if(this.joinInternal_ta6o25$_0())return this.joinSuspend_kfh5g8$_0(t);Sn(t.context)},Me.prototype.joinInternal_ta6o25$_0=function(){for(;;){var t=this.state_8be2vx$;if(!e.isType(t,Xe))return!1;if(this.startInternal_tp1bqd$_0(t)>=0)return!0}},Me.prototype.joinSuspend_kfh5g8$_0=function(t){return(n=this,e=function(t){return mt(t,n.invokeOnCompletion_f05bi3$(new en(n,t))),u},function(t){var n=new vt(p(t),1);return e(n),n.getResult()})(t);var e,n},Object.defineProperty(Me.prototype,"onJoin",{get:function(){return this}}),Me.prototype.registerSelectClause0_s9h9qd$=function(t,n){for(;;){var i=this.state_8be2vx$;if(t.isSelected)return;if(!e.isType(i,Xe))return void(t.trySelect()&&sr(n,t.completion));if(0===this.startInternal_tp1bqd$_0(i))return void t.disposeOnSelect_rvfg84$(this.invokeOnCompletion_f05bi3$(new rn(this,t,n)))}},Me.prototype.removeNode_nxb11s$=function(t){for(;;){var n=this.state_8be2vx$;if(!e.isType(n,Ze))return e.isType(n,Xe)?void(null!=n.list&&t.remove()):void 0;if(n!==t)return;if(this._state_v70vig$_0===n&&(this._state_v70vig$_0=Ie,1))return}},Object.defineProperty(Me.prototype,"onCancelComplete",{get:function(){return!1}}),Me.prototype.cancel_m4sck1$$default=function(t){this.cancelInternal_tcv7n7$(null!=t?t:new Kr(this.cancellationExceptionMessage(),null,this))},Me.prototype.cancellationExceptionMessage=function(){return"Job was cancelled"},Me.prototype.cancel_dbl4no$$default=function(t){var e;return this.cancelInternal_tcv7n7$(null!=(e=null!=t?this.toCancellationException_rg9tb7$(t):null)?e:new Kr(this.cancellationExceptionMessage(),null,this)),!0},Me.prototype.cancelInternal_tcv7n7$=function(t){this.cancelImpl_8ea4ql$(t)},Me.prototype.parentCancelled_pv1t6x$=function(t){this.cancelImpl_8ea4ql$(t)},Me.prototype.childCancelled_tcv7n7$=function(t){return!!e.isType(t,Yr)||this.cancelImpl_8ea4ql$(t)&&this.handlesException},Me.prototype.cancelCoroutine_dbl4no$=function(t){return this.cancelImpl_8ea4ql$(t)},Me.prototype.cancelImpl_8ea4ql$=function(t){var e,n=Ne;return!(!this.onCancelComplete||(n=this.cancelMakeCompleting_z3ww04$_0(t))!==Pe)||(n===Ne&&(n=this.makeCancelling_xjon1g$_0(t)),n===Ne||n===Pe?e=!0:n===je?e=!1:(this.afterCompletion_s8jyv4$(n),e=!0),e)},Me.prototype.cancelMakeCompleting_z3ww04$_0=function(t){for(;;){var n=this.state_8be2vx$;if(!e.isType(n,Xe)||e.isType(n,Fe)&&n.isCompleting)return Ne;var i=new Rt(this.createCauseException_kfrsk8$_0(t)),r=this.tryMakeCompleting_w5s53t$_0(n,i);if(r!==Ae)return r}},Me.prototype.defaultCancellationException_6umzry$=$("kotlinx-coroutines-core.kotlinx.coroutines.JobSupport.defaultCancellationException_6umzry$",v((function(){var e=t.kotlinx.coroutines.JobCancellationException;return function(t,n){return void 0===t&&(t=null),void 0===n&&(n=null),new e(null!=t?t:this.cancellationExceptionMessage(),n,this)}}))),Me.prototype.getChildJobCancellationCause=function(){var t,n,i,r=this.state_8be2vx$;if(e.isType(r,Fe))t=r.rootCause;else if(e.isType(r,Rt))t=r.cause;else{if(e.isType(r,Xe))throw g(("Cannot be cancelling child in this state: "+x(r)).toString());t=null}var o=t;return null!=(i=e.isType(n=o,Yr)?n:null)?i:new Kr("Parent job is "+this.stateString_u2sjqg$_0(r),o,this)},Me.prototype.createCauseException_kfrsk8$_0=function(t){var n;return null==t||e.isType(t,w)?null!=t?t:new Kr(this.cancellationExceptionMessage(),null,this):(e.isType(n=t,Se)?n:r()).getChildJobCancellationCause()},Me.prototype.makeCancelling_xjon1g$_0=function(t){for(var n={v:null};;){var i,r,o=this.state_8be2vx$;if(e.isType(o,Fe)){var a;if(o.isSealed)return je;var s=o.isCancelling;if(null!=t||!s){var l;if(null!=(a=n.v))l=a;else{var u=this.createCauseException_kfrsk8$_0(t);n.v=u,l=u}var c=l;o.addExceptionLocked_tcv7n7$(c)}var p=o.rootCause,h=s?null:p;return null!=h&&this.notifyCancelling_xkpzb8$_0(o.list,h),Ne}if(!e.isType(o,Xe))return je;if(null!=(i=n.v))r=i;else{var _=this.createCauseException_kfrsk8$_0(t);n.v=_,r=_}var f=r;if(o.isActive){if(this.tryMakeCancelling_v0qvyy$_0(o,f))return Ne}else{var d=this.tryMakeCompleting_w5s53t$_0(o,new Rt(f));if(d===Ne)throw g(("Cannot happen in "+x(o)).toString());if(d!==Ae)return d}}},Me.prototype.getOrPromoteCancellingList_dmij2j$_0=function(t){var n,i;if(null==(i=t.list)){if(e.isType(t,Ke))n=new Je;else{if(!e.isType(t,Ze))throw g(("State should have list: "+t).toString());this.promoteSingleToNodeList_ft43ca$_0(t),n=null}i=n}return i},Me.prototype.tryMakeCancelling_v0qvyy$_0=function(t,e){var n;if(null==(n=this.getOrPromoteCancellingList_dmij2j$_0(t)))return!1;var i=n,r=new Fe(i,!1,e);return this._state_v70vig$_0===t&&(this._state_v70vig$_0=r,!0)&&(this.notifyCancelling_xkpzb8$_0(i,e),!0)},Me.prototype.makeCompleting_8ea4ql$=function(t){for(;;){var e=this.tryMakeCompleting_w5s53t$_0(this.state_8be2vx$,t);if(e===Ne)return!1;if(e===Pe)return!0;if(e!==Ae)return this.afterCompletion_s8jyv4$(e),!0}},Me.prototype.makeCompletingOnce_8ea4ql$=function(t){for(;;){var e=this.tryMakeCompleting_w5s53t$_0(this.state_8be2vx$,t);if(e===Ne)throw new U("Job "+this+" is already complete or completing, but is being completed with "+x(t),this.get_exceptionOrNull_ejijbb$_0(t));if(e!==Ae)return e}},Me.prototype.tryMakeCompleting_w5s53t$_0=function(t,n){return e.isType(t,Xe)?!e.isType(t,Ke)&&!e.isType(t,Ze)||e.isType(t,ln)||e.isType(n,Rt)?this.tryMakeCompletingSlowPath_uh1ctj$_0(t,n):this.tryFinalizeSimpleState_5emg4m$_0(t,n)?n:Ae:Ne},Me.prototype.tryMakeCompletingSlowPath_uh1ctj$_0=function(t,n){var i,r,o,a;if(null==(i=this.getOrPromoteCancellingList_dmij2j$_0(t)))return Ae;var s,l,u=i,c=null!=(o=e.isType(r=t,Fe)?r:null)?o:new Fe(u,!1,null),p={v:null};if(c.isCompleting)return Ne;if(c.isCompleting=!0,c!==t&&(this._state_v70vig$_0!==t||(this._state_v70vig$_0=c,0)))return Ae;var h=c.isCancelling;null!=(l=e.isType(s=n,Rt)?s:null)&&c.addExceptionLocked_tcv7n7$(l.cause);var _=c.rootCause;p.v=h?null:_,null!=(a=p.v)&&this.notifyCancelling_xkpzb8$_0(u,a);var f=this.firstChild_15hr5g$_0(t);return null!=f&&this.tryWaitForChild_dzo3im$_0(c,f,n)?Pe:this.finalizeFinishingState_10mr1z$_0(c,n)},Me.prototype.get_exceptionOrNull_ejijbb$_0=function(t){var n,i;return null!=(i=e.isType(n=t,Rt)?n:null)?i.cause:null},Me.prototype.firstChild_15hr5g$_0=function(t){var n,i,r;return null!=(r=e.isType(n=t,ln)?n:null)?r:null!=(i=t.list)?this.nextChild_n2no7k$_0(i):null},Me.prototype.tryWaitForChild_dzo3im$_0=function(t,e,n){var i;if(e.childJob.invokeOnCompletion_ct2b2z$(void 0,!1,new qe(this,t,e,n))!==De())return!0;if(null==(i=this.nextChild_n2no7k$_0(e)))return!1;var r=i;return this.tryWaitForChild_dzo3im$_0(t,r,n)},Me.prototype.continueCompleting_vth2d4$_0=function(t,e,n){var i=this.nextChild_n2no7k$_0(e);if(null==i||!this.tryWaitForChild_dzo3im$_0(t,i,n)){var r=this.finalizeFinishingState_10mr1z$_0(t,n);this.afterCompletion_s8jyv4$(r)}},Me.prototype.nextChild_n2no7k$_0=function(t){for(var n=t;n._removed;)n=n._prev;for(;;)if(!(n=n._next)._removed){if(e.isType(n,ln))return n;if(e.isType(n,Je))return null}},Ue.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[l]},Ue.prototype=Object.create(l.prototype),Ue.prototype.constructor=Ue,Ue.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=this.local$this$JobSupport.state_8be2vx$;if(e.isType(t,ln)){if(this.state_0=8,this.result_0=this.local$$receiver.yield_11rb$(t.childJob,this),this.result_0===s)return s;continue}if(e.isType(t,Xe)){if(null!=(this.local$tmp$=t.list)){this.local$cur=this.local$tmp$._next,this.state_0=2;continue}this.local$tmp$_0=null,this.state_0=6;continue}this.state_0=7;continue;case 1:throw this.exception_0;case 2:if(y(this.local$cur,this.local$tmp$)){this.state_0=5;continue}if(e.isType(this.local$cur,ln)){if(this.state_0=3,this.result_0=this.local$$receiver.yield_11rb$(this.local$cur.childJob,this),this.result_0===s)return s;continue}this.state_0=4;continue;case 3:this.state_0=4;continue;case 4:this.local$cur=this.local$cur._next,this.state_0=2;continue;case 5:this.local$tmp$_0=u,this.state_0=6;continue;case 6:return this.local$tmp$_0;case 7:this.state_0=9;continue;case 8:return this.result_0;case 9:return u;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(Me.prototype,"children",{get:function(){return F((t=this,function(e,n,i){var r=new Ue(t,e,this,n);return i?r:r.doResume(null)}));var t}}),Me.prototype.attachChild_kx8v25$=function(t){var n;return e.isType(n=this.invokeOnCompletion_ct2b2z$(!0,void 0,new ln(this,t)),Te)?n:r()},Me.prototype.handleOnCompletionException_tcv7n7$=function(t){throw t},Me.prototype.onCancelling_dbl4no$=function(t){},Object.defineProperty(Me.prototype,"isScopedCoroutine",{get:function(){return!1}}),Object.defineProperty(Me.prototype,"handlesException",{get:function(){return!0}}),Me.prototype.handleJobException_tcv7n7$=function(t){return!1},Me.prototype.onCompletionInternal_s8jyv4$=function(t){},Me.prototype.afterCompletion_s8jyv4$=function(t){},Me.prototype.toString=function(){return this.toDebugString()+"@"+Rr(this)},Me.prototype.toDebugString=function(){return this.nameString()+"{"+this.stateString_u2sjqg$_0(this.state_8be2vx$)+"}"},Me.prototype.nameString=function(){return Ir(this)},Me.prototype.stateString_u2sjqg$_0=function(t){return e.isType(t,Fe)?t.isCancelling?"Cancelling":t.isCompleting?"Completing":"Active":e.isType(t,Xe)?t.isActive?"Active":"New":e.isType(t,Rt)?"Cancelled":"Completed"},Object.defineProperty(Fe.prototype,"list",{get:function(){return this.list_m9wkmb$_0}}),Object.defineProperty(Fe.prototype,"isCompleting",{get:function(){return this._isCompleting_0},set:function(t){this._isCompleting_0=t}}),Object.defineProperty(Fe.prototype,"rootCause",{get:function(){return this._rootCause_0},set:function(t){this._rootCause_0=t}}),Object.defineProperty(Fe.prototype,"exceptionsHolder_0",{get:function(){return this._exceptionsHolder_0},set:function(t){this._exceptionsHolder_0=t}}),Object.defineProperty(Fe.prototype,"isSealed",{get:function(){return this.exceptionsHolder_0===Le}}),Object.defineProperty(Fe.prototype,"isCancelling",{get:function(){return null!=this.rootCause}}),Object.defineProperty(Fe.prototype,"isActive",{get:function(){return null==this.rootCause}}),Fe.prototype.sealLocked_dbl4no$=function(t){var n,i,o=this.exceptionsHolder_0;if(null==o)i=this.allocateList_0();else if(e.isType(o,w)){var a=this.allocateList_0();a.add_11rb$(o),i=a}else{if(!e.isType(o,q))throw g(("State is "+x(o)).toString());i=e.isType(n=o,q)?n:r()}var s=i,l=this.rootCause;return null!=l&&s.add_wxm5ur$(0,l),null==t||y(t,l)||s.add_11rb$(t),this.exceptionsHolder_0=Le,s},Fe.prototype.addExceptionLocked_tcv7n7$=function(t){var n,i=this.rootCause;if(null!=i){if(t!==i){var o=this.exceptionsHolder_0;if(null==o)this.exceptionsHolder_0=t;else if(e.isType(o,w)){if(t===o)return;var a=this.allocateList_0();a.add_11rb$(o),a.add_11rb$(t),this.exceptionsHolder_0=a}else{if(!e.isType(o,q))throw g(("State is "+x(o)).toString());(e.isType(n=o,q)?n:r()).add_11rb$(t)}}}else this.rootCause=t},Fe.prototype.allocateList_0=function(){return h(4)},Fe.prototype.toString=function(){return"Finishing[cancelling="+this.isCancelling+", completing="+this.isCompleting+", rootCause="+x(this.rootCause)+", exceptions="+x(this.exceptionsHolder_0)+", list="+this.list+"]"},Fe.$metadata$={kind:o,simpleName:"Finishing",interfaces:[Xe]},Me.prototype.get_isCancelling_dpdoz8$_0=function(t){return e.isType(t,Fe)&&t.isCancelling},qe.prototype.invoke=function(t){this.parent_0.continueCompleting_vth2d4$_0(this.state_0,this.child_0,this.proposedUpdate_0)},qe.prototype.toString=function(){return"ChildCompletion["+this.child_0+", "+x(this.proposedUpdate_0)+"]"},qe.$metadata$={kind:o,simpleName:"ChildCompletion",interfaces:[Ze]},Ge.prototype.getContinuationCancellationCause_dqr1mp$=function(t){var n,i=this.job_0.state_8be2vx$;return e.isType(i,Fe)&&null!=(n=i.rootCause)?n:e.isType(i,Rt)?i.cause:t.getCancellationException()},Ge.prototype.nameString=function(){return"AwaitContinuation"},Ge.$metadata$={kind:o,simpleName:"AwaitContinuation",interfaces:[vt]},Object.defineProperty(Me.prototype,"isCompletedExceptionally",{get:function(){return e.isType(this.state_8be2vx$,Rt)}}),Me.prototype.getCompletionExceptionOrNull=function(){var t=this.state_8be2vx$;if(e.isType(t,Xe))throw g("This job has not completed yet".toString());return this.get_exceptionOrNull_ejijbb$_0(t)},Me.prototype.getCompletedInternal_8be2vx$=function(){var t=this.state_8be2vx$;if(e.isType(t,Xe))throw g("This job has not completed yet".toString());if(e.isType(t,Rt))throw t.cause;return Ve(t)},Me.prototype.awaitInternal_8be2vx$=function(t){for(;;){var n=this.state_8be2vx$;if(!e.isType(n,Xe)){if(e.isType(n,Rt))throw n.cause;return Ve(n)}if(this.startInternal_tp1bqd$_0(n)>=0)break}return this.awaitSuspend_ixl9xw$_0(t)},Me.prototype.awaitSuspend_ixl9xw$_0=function(t){return(e=this,function(t){var n=new Ge(p(t),e);return mt(n,e.invokeOnCompletion_f05bi3$(new nn(e,n))),n.getResult()})(t);var e},Me.prototype.registerSelectClause1Internal_u6kgbh$=function(t,n){for(;;){var o,a=this.state_8be2vx$;if(t.isSelected)return;if(!e.isType(a,Xe))return void(t.trySelect()&&(e.isType(a,Rt)?t.resumeSelectWithException_tcv7n7$(a.cause):lr(n,null==(o=Ve(a))||e.isType(o,i)?o:r(),t.completion)));if(0===this.startInternal_tp1bqd$_0(a))return void t.disposeOnSelect_rvfg84$(this.invokeOnCompletion_f05bi3$(new on(this,t,n)))}},Me.prototype.selectAwaitCompletion_u6kgbh$=function(t,n){var o,a=this.state_8be2vx$;e.isType(a,Rt)?t.resumeSelectWithException_tcv7n7$(a.cause):or(n,null==(o=Ve(a))||e.isType(o,i)?o:r(),t.completion)},Me.$metadata$={kind:o,simpleName:"JobSupport",interfaces:[fr,Se,Ce,ge]},He.$metadata$={kind:o,simpleName:"IncompleteStateBox",interfaces:[]},Object.defineProperty(Ke.prototype,"isActive",{get:function(){return this.isActive_hyoax9$_0}}),Object.defineProperty(Ke.prototype,"list",{get:function(){return null}}),Ke.prototype.toString=function(){return"Empty{"+(this.isActive?"Active":"New")+"}"},Ke.$metadata$={kind:o,simpleName:"Empty",interfaces:[Xe]},Object.defineProperty(We.prototype,"onCancelComplete",{get:function(){return!0}}),Object.defineProperty(We.prototype,"handlesException",{get:function(){return this.handlesException_fejgjb$_0}}),We.prototype.complete=function(){return this.makeCompleting_8ea4ql$(u)},We.prototype.completeExceptionally_tcv7n7$=function(t){return this.makeCompleting_8ea4ql$(new Rt(t))},We.prototype.handlesExceptionF=function(){var t,n,i,r,o,a;if(null==(i=null!=(n=e.isType(t=this.parentHandle_8be2vx$,ln)?t:null)?n.job:null))return!1;for(var s=i;;){if(s.handlesException)return!0;if(null==(a=null!=(o=e.isType(r=s.parentHandle_8be2vx$,ln)?r:null)?o.job:null))return!1;s=a}},We.$metadata$={kind:o,simpleName:"JobImpl",interfaces:[Pt,Me]},Xe.$metadata$={kind:b,simpleName:"Incomplete",interfaces:[]},Object.defineProperty(Ze.prototype,"isActive",{get:function(){return!0}}),Object.defineProperty(Ze.prototype,"list",{get:function(){return null}}),Ze.prototype.dispose=function(){var t;(e.isType(t=this.job,Me)?t:r()).removeNode_nxb11s$(this)},Ze.$metadata$={kind:o,simpleName:"JobNode",interfaces:[Xe,Ee,Cr]},Object.defineProperty(Je.prototype,"isActive",{get:function(){return!0}}),Object.defineProperty(Je.prototype,"list",{get:function(){return this}}),Je.prototype.getString_61zpoe$=function(t){var n=G();n.append_gw00v9$("List{"),n.append_gw00v9$(t),n.append_gw00v9$("}[");for(var i={v:!0},r=this._next;!y(r,this);){if(e.isType(r,Ze)){var o=r;i.v?i.v=!1:n.append_gw00v9$(", "),n.append_s8jyv4$(o)}r=r._next}return n.append_gw00v9$("]"),n.toString()},Je.prototype.toString=function(){return Ti?this.getString_61zpoe$("Active"):bo.prototype.toString.call(this)},Je.$metadata$={kind:o,simpleName:"NodeList",interfaces:[Xe,bo]},Object.defineProperty(Qe.prototype,"list",{get:function(){return this.list_afai45$_0}}),Object.defineProperty(Qe.prototype,"isActive",{get:function(){return!1}}),Qe.prototype.toString=function(){return Ti?this.list.getString_61zpoe$("New"):i.prototype.toString.call(this)},Qe.$metadata$={kind:o,simpleName:"InactiveNodeList",interfaces:[Xe]},tn.prototype.invoke=function(t){this.handler_0(t)},tn.prototype.toString=function(){return"InvokeOnCompletion["+Ir(this)+"@"+Rr(this)+"]"},tn.$metadata$={kind:o,simpleName:"InvokeOnCompletion",interfaces:[Ze]},en.prototype.invoke=function(t){this.continuation_0.resumeWith_tl1gpc$(new _(u))},en.prototype.toString=function(){return"ResumeOnCompletion["+this.continuation_0+"]"},en.$metadata$={kind:o,simpleName:"ResumeOnCompletion",interfaces:[Ze]},nn.prototype.invoke=function(t){var n,o,a=this.job.state_8be2vx$;if(e.isType(a,Rt)){var s=this.continuation_0,l=a.cause;s.resumeWith_tl1gpc$(new _(E(l)))}else{o=this.continuation_0;var u=null==(n=Ve(a))||e.isType(n,i)?n:r();o.resumeWith_tl1gpc$(new _(u))}},nn.prototype.toString=function(){return"ResumeAwaitOnCompletion["+this.continuation_0+"]"},nn.$metadata$={kind:o,simpleName:"ResumeAwaitOnCompletion",interfaces:[Ze]},rn.prototype.invoke=function(t){this.select_0.trySelect()&&rr(this.block_0,this.select_0.completion)},rn.prototype.toString=function(){return"SelectJoinOnCompletion["+this.select_0+"]"},rn.$metadata$={kind:o,simpleName:"SelectJoinOnCompletion",interfaces:[Ze]},on.prototype.invoke=function(t){this.select_0.trySelect()&&this.job.selectAwaitCompletion_u6kgbh$(this.select_0,this.block_0)},on.prototype.toString=function(){return"SelectAwaitOnCompletion["+this.select_0+"]"},on.$metadata$={kind:o,simpleName:"SelectAwaitOnCompletion",interfaces:[Ze]},an.$metadata$={kind:o,simpleName:"JobCancellingNode",interfaces:[Ze]},sn.prototype.invoke=function(t){0===this._invoked_0&&(this._invoked_0=1,1)&&this.handler_0(t)},sn.prototype.toString=function(){return"InvokeOnCancelling["+Ir(this)+"@"+Rr(this)+"]"},sn.$metadata$={kind:o,simpleName:"InvokeOnCancelling",interfaces:[an]},ln.prototype.invoke=function(t){this.childJob.parentCancelled_pv1t6x$(this.job)},ln.prototype.childCancelled_tcv7n7$=function(t){return this.job.childCancelled_tcv7n7$(t)},ln.prototype.toString=function(){return"ChildHandle["+this.childJob+"]"},ln.$metadata$={kind:o,simpleName:"ChildHandleNode",interfaces:[Te,an]},un.prototype.invoke=function(t){this.child.parentCancelled_8o0b5c$(this.child.getContinuationCancellationCause_dqr1mp$(this.job))},un.prototype.toString=function(){return"ChildContinuation["+this.child+"]"},un.$metadata$={kind:o,simpleName:"ChildContinuation",interfaces:[an]},cn.$metadata$={kind:o,simpleName:"MainCoroutineDispatcher",interfaces:[zt]},hn.prototype.childCancelled_tcv7n7$=function(t){return!1},hn.$metadata$={kind:o,simpleName:"SupervisorJobImpl",interfaces:[We]},_n.prototype.createCopy=function(){var t,e=new _n(null!=(t=this.message)?t:"",this.coroutine_8be2vx$);return e},_n.$metadata$={kind:o,simpleName:"TimeoutCancellationException",interfaces:[le,Yr]},fn.prototype.isDispatchNeeded_1fupul$=function(t){return!1},fn.prototype.dispatch_5bn72i$=function(t,e){var n=t.get_j3r2sn$(En());if(null==n)throw H("Dispatchers.Unconfined.dispatch function can only be used by the yield function. If you wrap Unconfined dispatcher in your code, make sure you properly delegate isDispatchNeeded and dispatch calls.");n.dispatcherWasUnconfined=!0},fn.prototype.toString=function(){return"Unconfined"},fn.$metadata$={kind:k,simpleName:"Unconfined",interfaces:[zt]};var dn=null;function mn(){return null===dn&&new fn,dn}function yn(){En(),C.call(this,En()),this.dispatcherWasUnconfined=!1}function $n(){kn=this}$n.$metadata$={kind:k,simpleName:"Key",interfaces:[T]};var vn,gn,bn,wn,xn,kn=null;function En(){return null===kn&&new $n,kn}function Cn(t){return function(t){var n,i,r=t.context;if(Sn(r),null==(i=e.isType(n=p(t),Gi)?n:null))return u;var o=i;if(o.dispatcher.isDispatchNeeded_1fupul$(r))o.dispatchYield_6v298r$(r,u);else{var a=new yn;if(o.dispatchYield_6v298r$(r.plus_1fupul$(a),u),a.dispatcherWasUnconfined)return Yi(o)?s:u}return s}(t)}function Sn(t){var e=t.get_j3r2sn$(xe());if(null!=e&&!e.isActive)throw e.getCancellationException()}function Tn(t){return function(e){var n=ft(p(e));return t(n),n.getResult()}}function On(){this.queue_0=new bo,this.onCloseHandler_0=null}function Nn(t,e){yo.call(this,t,new zn(e))}function Pn(t,e){Nn.call(this,t,e)}function An(t,e,n){l.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$element=e}function jn(t){return function(){return t.isBufferFull}}function Ln(t,e){$o.call(this,e),this.element=t}function Rn(t){this.this$AbstractSendChannel=t}function In(t,e,n,i){Wn.call(this),this.pollResult_m5nr4l$_0=t,this.channel=e,this.select=n,this.block=i}function zn(t){Wn.call(this),this.element=t}function Dn(){On.call(this)}function Mn(t){return function(){return t.isBufferEmpty}}function Bn(t){$o.call(this,t)}function Un(t){this.this$AbstractChannel=t}function Fn(t){this.this$AbstractChannel=t}function qn(t){this.this$AbstractChannel=t}function Gn(t,e){this.$outer=t,kt.call(this),this.receive_0=e}function Hn(t){this.channel=t,this.result=bn}function Yn(t,e){Qn.call(this),this.cont=t,this.receiveMode=e}function Vn(t,e){Qn.call(this),this.iterator=t,this.cont=e}function Kn(t,e,n,i){Qn.call(this),this.channel=t,this.select=e,this.block=n,this.receiveMode=i}function Wn(){mo.call(this)}function Xn(){}function Zn(t,e){Wn.call(this),this.pollResult_vo6xxe$_0=t,this.cont=e}function Jn(t){Wn.call(this),this.closeCause=t}function Qn(){mo.call(this)}function ti(t){if(Dn.call(this),this.capacity=t,!(this.capacity>=1)){var n="ArrayChannel capacity must be at least 1, but "+this.capacity+" was specified";throw M(n.toString())}this.lock_0=new _o;var i=this.capacity;this.buffer_0=e.newArray(V.min(i,8),null),this.head_0=0,this.size_0=0}function ei(t,e,n){ot.call(this,t,n),this._channel_0=e}function ni(){}function ii(){}function ri(){}function oi(t){ui(),this.holder_0=t}function ai(t){this.cause=t}function si(){li=this}yn.$metadata$={kind:o,simpleName:"YieldContext",interfaces:[C]},On.prototype.offerInternal_11rb$=function(t){for(var e;;){if(null==(e=this.takeFirstReceiveOrPeekClosed()))return gn;var n=e;if(null!=n.tryResumeReceive_j43gjz$(t,null))return n.completeResumeReceive_11rb$(t),n.offerResult}},On.prototype.offerSelectInternal_ys5ufj$=function(t,e){var n=this.describeTryOffer_0(t),i=e.performAtomicTrySelect_6q0pxr$(n);if(null!=i)return i;var r=n.result;return r.completeResumeReceive_11rb$(t),r.offerResult},Object.defineProperty(On.prototype,"closedForSend_0",{get:function(){var t,n,i;return null!=(n=e.isType(t=this.queue_0._prev,Jn)?t:null)?(this.helpClose_0(n),i=n):i=null,i}}),Object.defineProperty(On.prototype,"closedForReceive_0",{get:function(){var t,n,i;return null!=(n=e.isType(t=this.queue_0._next,Jn)?t:null)?(this.helpClose_0(n),i=n):i=null,i}}),On.prototype.takeFirstSendOrPeekClosed_0=function(){var t,n=this.queue_0;t:do{var i=n._next;if(i===n){t=null;break t}if(!e.isType(i,Wn)){t=null;break t}if(e.isType(i,Jn)){t=i;break t}if(!i.remove())throw g("Should remove".toString());t=i}while(0);return t},On.prototype.sendBuffered_0=function(t){var n=this.queue_0,i=new zn(t),r=n._prev;return e.isType(r,Xn)?r:(n.addLast_l2j9rm$(i),null)},On.prototype.describeSendBuffered_0=function(t){return new Nn(this.queue_0,t)},Nn.prototype.failure_l2j9rm$=function(t){return e.isType(t,Jn)?t:e.isType(t,Xn)?gn:null},Nn.$metadata$={kind:o,simpleName:"SendBufferedDesc",interfaces:[yo]},On.prototype.describeSendConflated_0=function(t){return new Pn(this.queue_0,t)},Pn.prototype.finishOnSuccess_bpl3tg$=function(t,n){var i,r;Nn.prototype.finishOnSuccess_bpl3tg$.call(this,t,n),null!=(r=e.isType(i=t,zn)?i:null)&&r.remove()},Pn.$metadata$={kind:o,simpleName:"SendConflatedDesc",interfaces:[Nn]},Object.defineProperty(On.prototype,"isClosedForSend",{get:function(){return null!=this.closedForSend_0}}),Object.defineProperty(On.prototype,"isFull",{get:function(){return this.full_0}}),Object.defineProperty(On.prototype,"full_0",{get:function(){return!e.isType(this.queue_0._next,Xn)&&this.isBufferFull}}),On.prototype.send_11rb$=function(t,e){if(this.offerInternal_11rb$(t)!==vn)return this.sendSuspend_0(t,e)},An.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[l]},An.prototype=Object.create(l.prototype),An.prototype.constructor=An,An.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.offerInternal_11rb$(this.local$element)===vn){if(this.state_0=2,this.result_0=Cn(this),this.result_0===s)return s;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:return;case 3:if(this.state_0=4,this.result_0=this.$this.sendSuspend_0(this.local$element,this),this.result_0===s)return s;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},On.prototype.sendFair_1c3m6u$=function(t,e,n){var i=new An(this,t,e);return n?i:i.doResume(null)},On.prototype.offer_11rb$=function(t){var n,i=this.offerInternal_11rb$(t);if(i!==vn){if(i===gn){if(null==(n=this.closedForSend_0))return!1;throw this.helpCloseAndGetSendException_0(n)}throw e.isType(i,Jn)?this.helpCloseAndGetSendException_0(i):g(("offerInternal returned "+i.toString()).toString())}return!0},On.prototype.helpCloseAndGetSendException_0=function(t){return this.helpClose_0(t),t.sendException},On.prototype.sendSuspend_0=function(t,n){return Tn((i=this,r=t,function(t){for(;;){if(i.full_0){var n=new Zn(r,t),o=i.enqueueSend_0(n);if(null==o)return void dt(t,n);if(e.isType(o,Jn))return void i.helpCloseAndResumeWithSendException_0(t,o);if(o!==wn&&!e.isType(o,Qn))throw g(("enqueueSend returned "+x(o)).toString())}var a=i.offerInternal_11rb$(r);if(a===vn)return void t.resumeWith_tl1gpc$(new _(u));if(a!==gn){if(e.isType(a,Jn))return void i.helpCloseAndResumeWithSendException_0(t,a);throw g(("offerInternal returned "+a.toString()).toString())}}}))(n);var i,r},On.prototype.helpCloseAndResumeWithSendException_0=function(t,e){this.helpClose_0(e);var n=e.sendException;t.resumeWith_tl1gpc$(new _(E(n)))},On.prototype.enqueueSend_0=function(t){if(this.isBufferAlwaysFull){var n=this.queue_0,i=n._prev;if(e.isType(i,Xn))return i;n.addLast_l2j9rm$(t)}else{var r,o=this.queue_0;t:do{var a=o._prev;if(e.isType(a,Xn))return a;if(!jn(this)()){r=!1;break t}o.addLast_l2j9rm$(t),r=!0}while(0);if(!r)return wn}return null},On.prototype.close_dbl4no$$default=function(t){var n,i,o=new Jn(t),a=this.queue_0;t:do{if(e.isType(a._prev,Jn)){i=!1;break t}a.addLast_l2j9rm$(o),i=!0}while(0);var s=i,l=s?o:e.isType(n=this.queue_0._prev,Jn)?n:r();return this.helpClose_0(l),s&&this.invokeOnCloseHandler_0(t),s},On.prototype.invokeOnCloseHandler_0=function(t){var e,n,i=this.onCloseHandler_0;null!==i&&i!==xn&&(n=this).onCloseHandler_0===i&&(n.onCloseHandler_0=xn,1)&&("function"==typeof(e=i)?e:r())(t)},On.prototype.invokeOnClose_f05bi3$=function(t){if(null!=this.onCloseHandler_0||(this.onCloseHandler_0=t,0)){var e=this.onCloseHandler_0;if(e===xn)throw g("Another handler was already registered and successfully invoked");throw g("Another handler was already registered: "+x(e))}var n=this.closedForSend_0;null!=n&&function(e){return e.onCloseHandler_0===t&&(e.onCloseHandler_0=xn,!0)}(this)&&t(n.closeCause)},On.prototype.helpClose_0=function(t){for(var n,o,a=new Ji;null!=(o=e.isType(n=t._prev,Qn)?n:null);){var s=o;s.remove()?a=a.plus_11rb$(s):s.helpRemove()}var l,u,c,p=a;if(null!=(l=p.holder_0))if(e.isType(l,q))for(var h=e.isType(c=p.holder_0,q)?c:r(),_=h.size-1|0;_>=0;_--)h.get_za3lpa$(_).resumeReceiveClosed_1zqbm$(t);else(null==(u=p.holder_0)||e.isType(u,i)?u:r()).resumeReceiveClosed_1zqbm$(t);this.onClosedIdempotent_l2j9rm$(t)},On.prototype.onClosedIdempotent_l2j9rm$=function(t){},On.prototype.takeFirstReceiveOrPeekClosed=function(){var t,n=this.queue_0;t:do{var i=n._next;if(i===n){t=null;break t}if(!e.isType(i,Xn)){t=null;break t}if(e.isType(i,Jn)){t=i;break t}if(!i.remove())throw g("Should remove".toString());t=i}while(0);return t},On.prototype.describeTryOffer_0=function(t){return new Ln(t,this.queue_0)},Ln.prototype.failure_l2j9rm$=function(t){return e.isType(t,Jn)?t:e.isType(t,Xn)?null:gn},Ln.prototype.onPrepare_xe32vn$=function(t){var n,i;return null==(i=(e.isType(n=t.affected,Xn)?n:r()).tryResumeReceive_j43gjz$(this.element,t))?vi:i===mi?mi:null},Ln.$metadata$={kind:o,simpleName:"TryOfferDesc",interfaces:[$o]},Rn.prototype.registerSelectClause2_rol3se$=function(t,e,n){this.this$AbstractSendChannel.registerSelectSend_0(t,e,n)},Rn.$metadata$={kind:o,interfaces:[mr]},Object.defineProperty(On.prototype,"onSend",{get:function(){return new Rn(this)}}),On.prototype.registerSelectSend_0=function(t,n,i){for(;;){if(t.isSelected)return;if(this.full_0){var r=new In(n,this,t,i),o=this.enqueueSend_0(r);if(null==o)return void t.disposeOnSelect_rvfg84$(r);if(e.isType(o,Jn))throw this.helpCloseAndGetSendException_0(o);if(o!==wn&&!e.isType(o,Qn))throw g(("enqueueSend returned "+x(o)+" ").toString())}var a=this.offerSelectInternal_ys5ufj$(n,t);if(a===gi)return;if(a!==gn&&a!==mi){if(a===vn)return void lr(i,this,t.completion);throw e.isType(a,Jn)?this.helpCloseAndGetSendException_0(a):g(("offerSelectInternal returned "+a.toString()).toString())}}},On.prototype.toString=function(){return Ir(this)+"@"+Rr(this)+"{"+this.queueDebugStateString_0+"}"+this.bufferDebugString},Object.defineProperty(On.prototype,"queueDebugStateString_0",{get:function(){var t=this.queue_0._next;if(t===this.queue_0)return"EmptyQueue";var n=e.isType(t,Jn)?t.toString():e.isType(t,Qn)?"ReceiveQueued":e.isType(t,Wn)?"SendQueued":"UNEXPECTED:"+t,i=this.queue_0._prev;return i!==t&&(n+=",queueSize="+this.countQueueSize_0(),e.isType(i,Jn)&&(n+=",closedForSend="+i)),n}}),On.prototype.countQueueSize_0=function(){for(var t={v:0},n=this.queue_0,i=n._next;!y(i,n);)e.isType(i,mo)&&(t.v=t.v+1|0),i=i._next;return t.v},Object.defineProperty(On.prototype,"bufferDebugString",{get:function(){return""}}),Object.defineProperty(In.prototype,"pollResult",{get:function(){return this.pollResult_m5nr4l$_0}}),In.prototype.tryResumeSend_uc1cc4$=function(t){var n;return null==(n=this.select.trySelectOther_uc1cc4$(t))||e.isType(n,er)?n:r()},In.prototype.completeResumeSend=function(){P(this.block,this.channel,this.select.completion)},In.prototype.dispose=function(){this.remove()},In.prototype.resumeSendClosed_1zqbm$=function(t){this.select.trySelect()&&this.select.resumeSelectWithException_tcv7n7$(t.sendException)},In.prototype.toString=function(){return"SendSelect@"+Rr(this)+"("+x(this.pollResult)+")["+this.channel+", "+this.select+"]"},In.$metadata$={kind:o,simpleName:"SendSelect",interfaces:[Ee,Wn]},Object.defineProperty(zn.prototype,"pollResult",{get:function(){return this.element}}),zn.prototype.tryResumeSend_uc1cc4$=function(t){return null!=t&&t.finishPrepare(),n},zn.prototype.completeResumeSend=function(){},zn.prototype.resumeSendClosed_1zqbm$=function(t){},zn.prototype.toString=function(){return"SendBuffered@"+Rr(this)+"("+this.element+")"},zn.$metadata$={kind:o,simpleName:"SendBuffered",interfaces:[Wn]},On.$metadata$={kind:o,simpleName:"AbstractSendChannel",interfaces:[ii]},Dn.prototype.pollInternal=function(){for(var t;;){if(null==(t=this.takeFirstSendOrPeekClosed_0()))return bn;var e=t;if(null!=e.tryResumeSend_uc1cc4$(null))return e.completeResumeSend(),e.pollResult}},Dn.prototype.pollSelectInternal_y5yyj0$=function(t){var e=this.describeTryPoll_0(),n=t.performAtomicTrySelect_6q0pxr$(e);return null!=n?n:(e.result.completeResumeSend(),e.result.pollResult)},Object.defineProperty(Dn.prototype,"hasReceiveOrClosed_0",{get:function(){return e.isType(this.queue_0._next,Xn)}}),Object.defineProperty(Dn.prototype,"isClosedForReceive",{get:function(){return null!=this.closedForReceive_0&&this.isBufferEmpty}}),Object.defineProperty(Dn.prototype,"isEmpty",{get:function(){return!e.isType(this.queue_0._next,Wn)&&this.isBufferEmpty}}),Dn.prototype.receive=function(t){var n,o=this.pollInternal();return o===bn||e.isType(o,Jn)?this.receiveSuspend_0(0,t):null==(n=o)||e.isType(n,i)?n:r()},Dn.prototype.receiveSuspend_0=function(t,n){return Tn((o=t,a=this,function(t){for(var n,s,l=new Yn(e.isType(n=t,_t)?n:r(),o);;){if(a.enqueueReceive_0(l))return void a.removeReceiveOnCancel_0(t,l);var c=a.pollInternal();if(e.isType(c,Jn))return void l.resumeReceiveClosed_1zqbm$(c);if(c!==bn){var p=l.resumeValue_11rb$(null==(s=c)||e.isType(s,i)?s:r());return void t.resumeWith_tl1gpc$(new _(p))}}return u}))(n);var o,a},Dn.prototype.enqueueReceive_0=function(t){var n;if(this.isBufferAlwaysEmpty){var i,r=this.queue_0;t:do{if(e.isType(r._prev,Wn)){i=!1;break t}r.addLast_l2j9rm$(t),i=!0}while(0);n=i}else{var o,a=this.queue_0;t:do{if(e.isType(a._prev,Wn)){o=!1;break t}if(!Mn(this)()){o=!1;break t}a.addLast_l2j9rm$(t),o=!0}while(0);n=o}var s=n;return s&&this.onReceiveEnqueued(),s},Dn.prototype.receiveOrNull=function(t){var n,o=this.pollInternal();return o===bn||e.isType(o,Jn)?this.receiveSuspend_0(1,t):null==(n=o)||e.isType(n,i)?n:r()},Dn.prototype.receiveOrNullResult_0=function(t){var n;if(e.isType(t,Jn)){if(null!=t.closeCause)throw t.closeCause;return null}return null==(n=t)||e.isType(n,i)?n:r()},Dn.prototype.receiveOrClosed=function(t){var n,o,a=this.pollInternal();return a!==bn?(e.isType(a,Jn)?n=new oi(new ai(a.closeCause)):(ui(),n=new oi(null==(o=a)||e.isType(o,i)?o:r())),n):this.receiveSuspend_0(2,t)},Dn.prototype.poll=function(){var t=this.pollInternal();return t===bn?null:this.receiveOrNullResult_0(t)},Dn.prototype.cancel_dbl4no$$default=function(t){return this.cancelInternal_fg6mcv$(t)},Dn.prototype.cancel_m4sck1$$default=function(t){this.cancelInternal_fg6mcv$(null!=t?t:Vr(Ir(this)+" was cancelled"))},Dn.prototype.cancelInternal_fg6mcv$=function(t){var e=this.close_dbl4no$(t);return this.onCancelIdempotent_6taknv$(e),e},Dn.prototype.onCancelIdempotent_6taknv$=function(t){var n;if(null==(n=this.closedForSend_0))throw g("Cannot happen".toString());for(var o=n,a=new Ji;;){var s,l=o._prev;if(e.isType(l,bo))break;l.remove()?a=a.plus_11rb$(e.isType(s=l,Wn)?s:r()):l.helpRemove()}var u,c,p,h=a;if(null!=(u=h.holder_0))if(e.isType(u,q))for(var _=e.isType(p=h.holder_0,q)?p:r(),f=_.size-1|0;f>=0;f--)_.get_za3lpa$(f).resumeSendClosed_1zqbm$(o);else(null==(c=h.holder_0)||e.isType(c,i)?c:r()).resumeSendClosed_1zqbm$(o)},Dn.prototype.iterator=function(){return new Hn(this)},Dn.prototype.describeTryPoll_0=function(){return new Bn(this.queue_0)},Bn.prototype.failure_l2j9rm$=function(t){return e.isType(t,Jn)?t:e.isType(t,Wn)?null:bn},Bn.prototype.onPrepare_xe32vn$=function(t){var n,i;return null==(i=(e.isType(n=t.affected,Wn)?n:r()).tryResumeSend_uc1cc4$(t))?vi:i===mi?mi:null},Bn.$metadata$={kind:o,simpleName:"TryPollDesc",interfaces:[$o]},Un.prototype.registerSelectClause1_o3xas4$=function(t,n){var i,o;o=e.isType(i=n,Y)?i:r(),this.this$AbstractChannel.registerSelectReceiveMode_0(t,0,o)},Un.$metadata$={kind:o,interfaces:[dr]},Object.defineProperty(Dn.prototype,"onReceive",{get:function(){return new Un(this)}}),Fn.prototype.registerSelectClause1_o3xas4$=function(t,n){var i,o;o=e.isType(i=n,Y)?i:r(),this.this$AbstractChannel.registerSelectReceiveMode_0(t,1,o)},Fn.$metadata$={kind:o,interfaces:[dr]},Object.defineProperty(Dn.prototype,"onReceiveOrNull",{get:function(){return new Fn(this)}}),qn.prototype.registerSelectClause1_o3xas4$=function(t,n){var i,o;o=e.isType(i=n,Y)?i:r(),this.this$AbstractChannel.registerSelectReceiveMode_0(t,2,o)},qn.$metadata$={kind:o,interfaces:[dr]},Object.defineProperty(Dn.prototype,"onReceiveOrClosed",{get:function(){return new qn(this)}}),Dn.prototype.registerSelectReceiveMode_0=function(t,e,n){for(;;){if(t.isSelected)return;if(this.isEmpty){if(this.enqueueReceiveSelect_0(t,n,e))return}else{var i=this.pollSelectInternal_y5yyj0$(t);if(i===gi)return;i!==bn&&i!==mi&&this.tryStartBlockUnintercepted_0(n,t,e,i)}}},Dn.prototype.tryStartBlockUnintercepted_0=function(t,n,o,a){var s,l;if(e.isType(a,Jn))switch(o){case 0:throw a.receiveException;case 2:if(!n.trySelect())return;lr(t,new oi(new ai(a.closeCause)),n.completion);break;case 1:if(null!=a.closeCause)throw a.receiveException;if(!n.trySelect())return;lr(t,null,n.completion)}else 2===o?(e.isType(a,Jn)?s=new oi(new ai(a.closeCause)):(ui(),s=new oi(null==(l=a)||e.isType(l,i)?l:r())),lr(t,s,n.completion)):lr(t,a,n.completion)},Dn.prototype.enqueueReceiveSelect_0=function(t,e,n){var i=new Kn(this,t,e,n),r=this.enqueueReceive_0(i);return r&&t.disposeOnSelect_rvfg84$(i),r},Dn.prototype.takeFirstReceiveOrPeekClosed=function(){var t=On.prototype.takeFirstReceiveOrPeekClosed.call(this);return null==t||e.isType(t,Jn)||this.onReceiveDequeued(),t},Dn.prototype.onReceiveEnqueued=function(){},Dn.prototype.onReceiveDequeued=function(){},Dn.prototype.removeReceiveOnCancel_0=function(t,e){t.invokeOnCancellation_f05bi3$(new Gn(this,e))},Gn.prototype.invoke=function(t){this.receive_0.remove()&&this.$outer.onReceiveDequeued()},Gn.prototype.toString=function(){return"RemoveReceiveOnCancel["+this.receive_0+"]"},Gn.$metadata$={kind:o,simpleName:"RemoveReceiveOnCancel",interfaces:[kt]},Hn.prototype.hasNext=function(t){return this.result!==bn?this.hasNextResult_0(this.result):(this.result=this.channel.pollInternal(),this.result!==bn?this.hasNextResult_0(this.result):this.hasNextSuspend_0(t))},Hn.prototype.hasNextResult_0=function(t){if(e.isType(t,Jn)){if(null!=t.closeCause)throw t.receiveException;return!1}return!0},Hn.prototype.hasNextSuspend_0=function(t){return Tn((n=this,function(t){for(var i=new Vn(n,t);;){if(n.channel.enqueueReceive_0(i))return void n.channel.removeReceiveOnCancel_0(t,i);var r=n.channel.pollInternal();if(n.result=r,e.isType(r,Jn)){if(null==r.closeCause)t.resumeWith_tl1gpc$(new _(!1));else{var o=r.receiveException;t.resumeWith_tl1gpc$(new _(E(o)))}return}if(r!==bn)return void t.resumeWith_tl1gpc$(new _(!0))}return u}))(t);var n},Hn.prototype.next=function(){var t,n=this.result;if(e.isType(n,Jn))throw n.receiveException;if(n!==bn)return this.result=bn,null==(t=n)||e.isType(t,i)?t:r();throw g("'hasNext' should be called prior to 'next' invocation")},Hn.$metadata$={kind:o,simpleName:"Itr",interfaces:[ci]},Yn.prototype.resumeValue_11rb$=function(t){return 2===this.receiveMode?new oi(t):t},Yn.prototype.tryResumeReceive_j43gjz$=function(t,e){return null==this.cont.tryResume_19pj23$(this.resumeValue_11rb$(t),null!=e?e.desc:null)?null:(null!=e&&e.finishPrepare(),n)},Yn.prototype.completeResumeReceive_11rb$=function(t){this.cont.completeResume_za3rmp$(n)},Yn.prototype.resumeReceiveClosed_1zqbm$=function(t){if(1===this.receiveMode&&null==t.closeCause)this.cont.resumeWith_tl1gpc$(new _(null));else if(2===this.receiveMode){var e=this.cont,n=new oi(new ai(t.closeCause));e.resumeWith_tl1gpc$(new _(n))}else{var i=this.cont,r=t.receiveException;i.resumeWith_tl1gpc$(new _(E(r)))}},Yn.prototype.toString=function(){return"ReceiveElement@"+Rr(this)+"[receiveMode="+this.receiveMode+"]"},Yn.$metadata$={kind:o,simpleName:"ReceiveElement",interfaces:[Qn]},Vn.prototype.tryResumeReceive_j43gjz$=function(t,e){return null==this.cont.tryResume_19pj23$(!0,null!=e?e.desc:null)?null:(null!=e&&e.finishPrepare(),n)},Vn.prototype.completeResumeReceive_11rb$=function(t){this.iterator.result=t,this.cont.completeResume_za3rmp$(n)},Vn.prototype.resumeReceiveClosed_1zqbm$=function(t){var e=null==t.closeCause?this.cont.tryResume_19pj23$(!1):this.cont.tryResumeWithException_tcv7n7$(wo(t.receiveException,this.cont));null!=e&&(this.iterator.result=t,this.cont.completeResume_za3rmp$(e))},Vn.prototype.toString=function(){return"ReceiveHasNext@"+Rr(this)},Vn.$metadata$={kind:o,simpleName:"ReceiveHasNext",interfaces:[Qn]},Kn.prototype.tryResumeReceive_j43gjz$=function(t,n){var i;return null==(i=this.select.trySelectOther_uc1cc4$(n))||e.isType(i,er)?i:r()},Kn.prototype.completeResumeReceive_11rb$=function(t){P(this.block,2===this.receiveMode?new oi(t):t,this.select.completion)},Kn.prototype.resumeReceiveClosed_1zqbm$=function(t){if(this.select.trySelect())switch(this.receiveMode){case 0:this.select.resumeSelectWithException_tcv7n7$(t.receiveException);break;case 2:P(this.block,new oi(new ai(t.closeCause)),this.select.completion);break;case 1:null==t.closeCause?P(this.block,null,this.select.completion):this.select.resumeSelectWithException_tcv7n7$(t.receiveException)}},Kn.prototype.dispose=function(){this.remove()&&this.channel.onReceiveDequeued()},Kn.prototype.toString=function(){return"ReceiveSelect@"+Rr(this)+"["+this.select+",receiveMode="+this.receiveMode+"]"},Kn.$metadata$={kind:o,simpleName:"ReceiveSelect",interfaces:[Ee,Qn]},Dn.$metadata$={kind:o,simpleName:"AbstractChannel",interfaces:[hi,On]},Wn.$metadata$={kind:o,simpleName:"Send",interfaces:[mo]},Xn.$metadata$={kind:b,simpleName:"ReceiveOrClosed",interfaces:[]},Object.defineProperty(Zn.prototype,"pollResult",{get:function(){return this.pollResult_vo6xxe$_0}}),Zn.prototype.tryResumeSend_uc1cc4$=function(t){return null==this.cont.tryResume_19pj23$(u,null!=t?t.desc:null)?null:(null!=t&&t.finishPrepare(),n)},Zn.prototype.completeResumeSend=function(){this.cont.completeResume_za3rmp$(n)},Zn.prototype.resumeSendClosed_1zqbm$=function(t){var e=this.cont,n=t.sendException;e.resumeWith_tl1gpc$(new _(E(n)))},Zn.prototype.toString=function(){return"SendElement@"+Rr(this)+"("+x(this.pollResult)+")"},Zn.$metadata$={kind:o,simpleName:"SendElement",interfaces:[Wn]},Object.defineProperty(Jn.prototype,"sendException",{get:function(){var t;return null!=(t=this.closeCause)?t:new Pi(fi)}}),Object.defineProperty(Jn.prototype,"receiveException",{get:function(){var t;return null!=(t=this.closeCause)?t:new Ai(fi)}}),Object.defineProperty(Jn.prototype,"offerResult",{get:function(){return this}}),Object.defineProperty(Jn.prototype,"pollResult",{get:function(){return this}}),Jn.prototype.tryResumeSend_uc1cc4$=function(t){return null!=t&&t.finishPrepare(),n},Jn.prototype.completeResumeSend=function(){},Jn.prototype.tryResumeReceive_j43gjz$=function(t,e){return null!=e&&e.finishPrepare(),n},Jn.prototype.completeResumeReceive_11rb$=function(t){},Jn.prototype.resumeSendClosed_1zqbm$=function(t){},Jn.prototype.toString=function(){return"Closed@"+Rr(this)+"["+x(this.closeCause)+"]"},Jn.$metadata$={kind:o,simpleName:"Closed",interfaces:[Xn,Wn]},Object.defineProperty(Qn.prototype,"offerResult",{get:function(){return vn}}),Qn.$metadata$={kind:o,simpleName:"Receive",interfaces:[Xn,mo]},Object.defineProperty(ti.prototype,"isBufferAlwaysEmpty",{get:function(){return!1}}),Object.defineProperty(ti.prototype,"isBufferEmpty",{get:function(){return 0===this.size_0}}),Object.defineProperty(ti.prototype,"isBufferAlwaysFull",{get:function(){return!1}}),Object.defineProperty(ti.prototype,"isBufferFull",{get:function(){return this.size_0===this.capacity}}),ti.prototype.offerInternal_11rb$=function(t){var n={v:null};t:do{var i,r,o=this.size_0;if(null!=(i=this.closedForSend_0))return i;if(o=this.buffer_0.length){for(var n=2*this.buffer_0.length|0,i=this.capacity,r=V.min(n,i),o=e.newArray(r,null),a=0;a0&&(l=c,u=p)}return l}catch(t){throw e.isType(t,n)?(a=t,t):t}finally{i(t,a)}}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.channels.none_4c38lx$",v((function(){var n=e.kotlin.Unit,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s=null;try{var l;for(l=t.iterator();e.suspendCall(l.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());)if(o(l.next()))return!1}catch(t){throw e.isType(t,i)?(s=t,t):t}finally{r(t,s)}return e.setCoroutineResult(n,e.coroutineReceiver()),!0}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.channels.reduce_vk3vfd$",v((function(){var n=e.kotlin.UnsupportedOperationException_init_pdl1vj$,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s=null;try{var l=t.iterator();if(e.suspendCall(l.hasNext(e.coroutineReceiver())),!e.coroutineResult(e.coroutineReceiver()))throw n("Empty channel can't be reduced.");for(var u=l.next();e.suspendCall(l.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());)u=o(u,l.next());return u}catch(t){throw e.isType(t,i)?(s=t,t):t}finally{r(t,s)}}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.channels.reduceIndexed_a6mkxp$",v((function(){var n=e.kotlin.UnsupportedOperationException_init_pdl1vj$,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s=null;try{var l,u=t.iterator();if(e.suspendCall(u.hasNext(e.coroutineReceiver())),!e.coroutineResult(e.coroutineReceiver()))throw n("Empty channel can't be reduced.");for(var c=1,p=u.next();e.suspendCall(u.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());)p=o((c=(l=c)+1|0,l),p,u.next());return p}catch(t){throw e.isType(t,i)?(s=t,t):t}finally{r(t,s)}}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.channels.sumBy_fl2dz0$",v((function(){var n=e.kotlin.Unit,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s={v:0},l=null;try{var u;for(u=t.iterator();e.suspendCall(u.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());){var c=u.next();s.v=s.v+o(c)|0}}catch(t){throw e.isType(t,i)?(l=t,t):t}finally{r(t,l)}return e.setCoroutineResult(n,e.coroutineReceiver()),s.v}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.channels.sumByDouble_jy8qhg$",v((function(){var n=e.kotlin.Unit,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s={v:0},l=null;try{var u;for(u=t.iterator();e.suspendCall(u.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());){var c=u.next();s.v+=o(c)}}catch(t){throw e.isType(t,i)?(l=t,t):t}finally{r(t,l)}return e.setCoroutineResult(n,e.coroutineReceiver()),s.v}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.channels.partition_4c38lx$",v((function(){var n=e.kotlin.collections.ArrayList_init_287e2$,i=e.kotlin.Unit,r=e.kotlin.Pair,o=Error,a=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,s,l){var u=n(),c=n(),p=null;try{var h;for(h=t.iterator();e.suspendCall(h.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());){var _=h.next();s(_)?u.add_11rb$(_):c.add_11rb$(_)}}catch(t){throw e.isType(t,o)?(p=t,t):t}finally{a(t,p)}return e.setCoroutineResult(i,e.coroutineReceiver()),new r(u,c)}}))),Object.defineProperty(Ri.prototype,"isBufferAlwaysEmpty",{get:function(){return!0}}),Object.defineProperty(Ri.prototype,"isBufferEmpty",{get:function(){return!0}}),Object.defineProperty(Ri.prototype,"isBufferAlwaysFull",{get:function(){return!1}}),Object.defineProperty(Ri.prototype,"isBufferFull",{get:function(){return!1}}),Ri.prototype.onClosedIdempotent_l2j9rm$=function(t){var n,i;null!=(i=e.isType(n=t._prev,zn)?n:null)&&this.conflatePreviousSendBuffered_0(i)},Ri.prototype.sendConflated_0=function(t){var n=new zn(t),i=this.queue_0,r=i._prev;return e.isType(r,Xn)?r:(i.addLast_l2j9rm$(n),this.conflatePreviousSendBuffered_0(n),null)},Ri.prototype.conflatePreviousSendBuffered_0=function(t){for(var n=t._prev;e.isType(n,zn);)n.remove()||n.helpRemove(),n=n._prev},Ri.prototype.offerInternal_11rb$=function(t){for(;;){var n=Dn.prototype.offerInternal_11rb$.call(this,t);if(n===vn)return vn;if(n!==gn){if(e.isType(n,Jn))return n;throw g(("Invalid offerInternal result "+n.toString()).toString())}var i=this.sendConflated_0(t);if(null==i)return vn;if(e.isType(i,Jn))return i}},Ri.prototype.offerSelectInternal_ys5ufj$=function(t,n){for(var i;;){var r=this.hasReceiveOrClosed_0?Dn.prototype.offerSelectInternal_ys5ufj$.call(this,t,n):null!=(i=n.performAtomicTrySelect_6q0pxr$(this.describeSendConflated_0(t)))?i:vn;if(r===gi)return gi;if(r===vn)return vn;if(r!==gn&&r!==mi){if(e.isType(r,Jn))return r;throw g(("Invalid result "+r.toString()).toString())}}},Ri.$metadata$={kind:o,simpleName:"ConflatedChannel",interfaces:[Dn]},Object.defineProperty(Ii.prototype,"isBufferAlwaysEmpty",{get:function(){return!0}}),Object.defineProperty(Ii.prototype,"isBufferEmpty",{get:function(){return!0}}),Object.defineProperty(Ii.prototype,"isBufferAlwaysFull",{get:function(){return!1}}),Object.defineProperty(Ii.prototype,"isBufferFull",{get:function(){return!1}}),Ii.prototype.offerInternal_11rb$=function(t){for(;;){var n=Dn.prototype.offerInternal_11rb$.call(this,t);if(n===vn)return vn;if(n!==gn){if(e.isType(n,Jn))return n;throw g(("Invalid offerInternal result "+n.toString()).toString())}var i=this.sendBuffered_0(t);if(null==i)return vn;if(e.isType(i,Jn))return i}},Ii.prototype.offerSelectInternal_ys5ufj$=function(t,n){for(var i;;){var r=this.hasReceiveOrClosed_0?Dn.prototype.offerSelectInternal_ys5ufj$.call(this,t,n):null!=(i=n.performAtomicTrySelect_6q0pxr$(this.describeSendBuffered_0(t)))?i:vn;if(r===gi)return gi;if(r===vn)return vn;if(r!==gn&&r!==mi){if(e.isType(r,Jn))return r;throw g(("Invalid result "+r.toString()).toString())}}},Ii.$metadata$={kind:o,simpleName:"LinkedListChannel",interfaces:[Dn]},Object.defineProperty(Di.prototype,"isBufferAlwaysEmpty",{get:function(){return!0}}),Object.defineProperty(Di.prototype,"isBufferEmpty",{get:function(){return!0}}),Object.defineProperty(Di.prototype,"isBufferAlwaysFull",{get:function(){return!0}}),Object.defineProperty(Di.prototype,"isBufferFull",{get:function(){return!0}}),Di.$metadata$={kind:o,simpleName:"RendezvousChannel",interfaces:[Dn]},Mi.$metadata$={kind:b,simpleName:"FlowCollector",interfaces:[]},$("kotlinx-coroutines-core.kotlinx.coroutines.flow.collect_706ovd$",v((function(){var n=e.Kind.CLASS,i=t.kotlinx.coroutines.flow.FlowCollector;function r(t){this.closure$action=t}return r.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},r.$metadata$={kind:n,interfaces:[i]},function(t,n,i){return e.suspendCall(t.collect_42ocv1$(new r(n),e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.flow.collectIndexed_57beod$",v((function(){var n=e.Kind.CLASS,i=t.kotlinx.coroutines.flow.FlowCollector,r=e.kotlin.ArithmeticException;function o(t){this.closure$action=t,this.index_0=0}return o.prototype.emit_11rb$=function(t,e){var n,i;i=this.closure$action;var o=(n=this.index_0,this.index_0=n+1|0,n);if(o<0)throw new r("Index overflow has happened");return i(o,t,e)},o.$metadata$={kind:n,interfaces:[i]},function(t,n,i){return e.suspendCall(t.collect_42ocv1$(new o(n),e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.flow.emitAll_c14n1u$",(function(t,n,i){return e.suspendCall(n.collect_42ocv1$(t,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())})),$("kotlinx-coroutines-core.kotlinx.coroutines.flow.fold_usjyvu$",v((function(){var n=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,i=e.kotlin.coroutines.CoroutineImpl,r=e.kotlin.Unit,o=e.Kind.CLASS,a=t.kotlinx.coroutines.flow.FlowCollector;function s(t){this.closure$action=t}function l(t,e,n,r){i.call(this,r),this.exceptionState_0=1,this.local$closure$operation=t,this.local$closure$accumulator=e,this.local$value=n}return s.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},s.$metadata$={kind:o,interfaces:[a]},l.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[i]},l.prototype=Object.create(i.prototype),l.prototype.constructor=l,l.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$operation(this.local$closure$accumulator.v,this.local$value,this),this.result_0===n)return n;continue;case 1:throw this.exception_0;case 2:return this.local$closure$accumulator.v=this.result_0,r;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},function(t,n,i,r){var o,a,u={v:n};return e.suspendCall(t.collect_42ocv1$(new s((o=i,a=u,function(t,e,n){var i=new l(o,a,t,e);return n?i:i.doResume(null)})),e.coroutineReceiver())),u.v}}))),Object.defineProperty(Bi.prototype,"isEmpty",{get:function(){return this.head_0===this.tail_0}}),Bi.prototype.addLast_trkh7z$=function(t){this.elements_0[this.tail_0]=t,this.tail_0=this.tail_0+1&this.elements_0.length-1,this.tail_0===this.head_0&&this.ensureCapacity_0()},Bi.prototype.removeFirstOrNull=function(){var t;if(this.head_0===this.tail_0)return null;var n=this.elements_0[this.head_0];return this.elements_0[this.head_0]=null,this.head_0=this.head_0+1&this.elements_0.length-1,e.isType(t=n,i)?t:r()},Bi.prototype.clear=function(){this.head_0=0,this.tail_0=0,this.elements_0=e.newArray(this.elements_0.length,null)},Bi.prototype.ensureCapacity_0=function(){var t=this.elements_0.length,n=t<<1,i=e.newArray(n,null),r=this.elements_0;Z(r,i,0,this.head_0,r.length),Z(this.elements_0,i,this.elements_0.length-this.head_0|0,0,this.head_0),this.elements_0=i,this.head_0=0,this.tail_0=t},Bi.$metadata$={kind:o,simpleName:"ArrayQueue",interfaces:[]},Ui.prototype.toString=function(){return Ir(this)+"@"+Rr(this)},Ui.prototype.isEarlierThan_bfmzsr$=function(t){var e,n;if(null==(e=this.atomicOp))return!1;var i=e;if(null==(n=t.atomicOp))return!1;var r=n;return i.opSequence.compareTo_11rb$(r.opSequence)<0},Ui.$metadata$={kind:o,simpleName:"OpDescriptor",interfaces:[]},Object.defineProperty(Fi.prototype,"isDecided",{get:function(){return this._consensus_c6dvpx$_0!==di}}),Object.defineProperty(Fi.prototype,"opSequence",{get:function(){return R}}),Object.defineProperty(Fi.prototype,"atomicOp",{get:function(){return this}}),Fi.prototype.decide_s8jyv4$=function(t){var e=this._consensus_c6dvpx$_0;return e!==di?e:this._consensus_c6dvpx$_0===di&&(this._consensus_c6dvpx$_0=t,1)?t:this._consensus_c6dvpx$_0},Fi.prototype.perform_s8jyv4$=function(t){var n,o,a=this._consensus_c6dvpx$_0;return a===di&&(a=this.decide_s8jyv4$(this.prepare_11rb$(null==(n=t)||e.isType(n,i)?n:r()))),this.complete_19pj23$(null==(o=t)||e.isType(o,i)?o:r(),a),a},Fi.$metadata$={kind:o,simpleName:"AtomicOp",interfaces:[Ui]},Object.defineProperty(qi.prototype,"atomicOp",{get:function(){return null==this.atomicOp_ss7ttb$_0?c("atomicOp"):this.atomicOp_ss7ttb$_0},set:function(t){this.atomicOp_ss7ttb$_0=t}}),qi.$metadata$={kind:o,simpleName:"AtomicDesc",interfaces:[]},Object.defineProperty(Gi.prototype,"callerFrame",{get:function(){return this.callerFrame_w1cgfa$_0}}),Gi.prototype.getStackTraceElement=function(){return null},Object.defineProperty(Gi.prototype,"reusableCancellableContinuation",{get:function(){var t;return e.isType(t=this._reusableCancellableContinuation_0,vt)?t:null}}),Object.defineProperty(Gi.prototype,"isReusable",{get:function(){return null!=this._reusableCancellableContinuation_0}}),Gi.prototype.claimReusableCancellableContinuation=function(){for(this._reusableCancellableContinuation_0;;){var t,n=this._reusableCancellableContinuation_0;if(null===n)return this._reusableCancellableContinuation_0=$i,null;if(!e.isType(n,vt))throw g(("Inconsistent state "+x(n)).toString());if(this._reusableCancellableContinuation_0===n&&(this._reusableCancellableContinuation_0=$i,1))return e.isType(t=n,vt)?t:r()}},Gi.prototype.checkPostponedCancellation_jp3215$=function(t){for(this._reusableCancellableContinuation_0;;){var n=this._reusableCancellableContinuation_0;if(n!==$i){if(null===n)return null;if(e.isType(n,w)){if(!function(t){return t._reusableCancellableContinuation_0===n&&(t._reusableCancellableContinuation_0=null,!0)}(this))throw M("Failed requirement.".toString());return n}throw g(("Inconsistent state "+x(n)).toString())}if(this._reusableCancellableContinuation_0===$i&&(this._reusableCancellableContinuation_0=t,1))return null}},Gi.prototype.postponeCancellation_tcv7n7$=function(t){for(this._reusableCancellableContinuation_0;;){var n=this._reusableCancellableContinuation_0;if(y(n,$i)){if(this._reusableCancellableContinuation_0===$i&&(this._reusableCancellableContinuation_0=t,1))return!0}else{if(e.isType(n,w))return!0;if(function(t){return t._reusableCancellableContinuation_0===n&&(t._reusableCancellableContinuation_0=null,!0)}(this))return!1}}},Gi.prototype.takeState=function(){var t=this._state_8be2vx$;return this._state_8be2vx$=yi,t},Object.defineProperty(Gi.prototype,"delegate",{get:function(){return this}}),Gi.prototype.resumeWith_tl1gpc$=function(t){var n=this.continuation.context,i=At(t);if(this.dispatcher.isDispatchNeeded_1fupul$(n))this._state_8be2vx$=i,this.resumeMode=0,this.dispatcher.dispatch_5bn72i$(n,this);else{var r=me().eventLoop_8be2vx$;if(r.isUnconfinedLoopActive)this._state_8be2vx$=i,this.resumeMode=0,r.dispatchUnconfined_4avnfa$(this);else{r.incrementUseCount_6taknv$(!0);try{for(this.context,this.continuation.resumeWith_tl1gpc$(t);r.processUnconfinedEvent(););}catch(t){if(!e.isType(t,w))throw t;this.handleFatalException_mseuzz$(t,null)}finally{r.decrementUseCount_6taknv$(!0)}}}},Gi.prototype.resumeCancellableWith_tl1gpc$=$("kotlinx-coroutines-core.kotlinx.coroutines.DispatchedContinuation.resumeCancellableWith_tl1gpc$",v((function(){var n=t.kotlinx.coroutines.toState_dwruuz$,i=e.kotlin.Unit,r=e.wrapFunction,o=Error,a=t.kotlinx.coroutines.Job,s=e.kotlin.Result,l=e.kotlin.createFailure_tcv7n7$;return r((function(){var n=t.kotlinx.coroutines.Job,r=e.kotlin.Result,o=e.kotlin.createFailure_tcv7n7$;return function(t,e){return function(){var a,s=t;t:do{var l=s.context.get_j3r2sn$(n.Key);if(null!=l&&!l.isActive){var u=l.getCancellationException();s.resumeWith_tl1gpc$(new r(o(u))),a=!0;break t}a=!1}while(0);if(!a){var c=t,p=e;c.context,c.continuation.resumeWith_tl1gpc$(p)}return i}}})),function(t){var i=n(t);if(this.dispatcher.isDispatchNeeded_1fupul$(this.context))this._state_8be2vx$=i,this.resumeMode=1,this.dispatcher.dispatch_5bn72i$(this.context,this);else{var r=me().eventLoop_8be2vx$;if(r.isUnconfinedLoopActive)this._state_8be2vx$=i,this.resumeMode=1,r.dispatchUnconfined_4avnfa$(this);else{r.incrementUseCount_6taknv$(!0);try{var u;t:do{var c=this.context.get_j3r2sn$(a.Key);if(null!=c&&!c.isActive){var p=c.getCancellationException();this.resumeWith_tl1gpc$(new s(l(p))),u=!0;break t}u=!1}while(0);for(u||(this.context,this.continuation.resumeWith_tl1gpc$(t));r.processUnconfinedEvent(););}catch(t){if(!e.isType(t,o))throw t;this.handleFatalException_mseuzz$(t,null)}finally{r.decrementUseCount_6taknv$(!0)}}}}}))),Gi.prototype.resumeCancelled=$("kotlinx-coroutines-core.kotlinx.coroutines.DispatchedContinuation.resumeCancelled",v((function(){var n=t.kotlinx.coroutines.Job,i=e.kotlin.Result,r=e.kotlin.createFailure_tcv7n7$;return function(){var t=this.context.get_j3r2sn$(n.Key);if(null!=t&&!t.isActive){var e=t.getCancellationException();return this.resumeWith_tl1gpc$(new i(r(e))),!0}return!1}}))),Gi.prototype.resumeUndispatchedWith_tl1gpc$=$("kotlinx-coroutines-core.kotlinx.coroutines.DispatchedContinuation.resumeUndispatchedWith_tl1gpc$",(function(t){this.context,this.continuation.resumeWith_tl1gpc$(t)})),Gi.prototype.dispatchYield_6v298r$=function(t,e){this._state_8be2vx$=e,this.resumeMode=1,this.dispatcher.dispatchYield_5bn72i$(t,this)},Gi.prototype.toString=function(){return"DispatchedContinuation["+this.dispatcher+", "+Ar(this.continuation)+"]"},Object.defineProperty(Gi.prototype,"context",{get:function(){return this.continuation.context}}),Gi.$metadata$={kind:o,simpleName:"DispatchedContinuation",interfaces:[a,Eo,Wi]},Wi.prototype.cancelResult_83a7kv$=function(t,e){},Wi.prototype.getSuccessfulResult_tpy1pm$=function(t){var n;return null==(n=t)||e.isType(n,i)?n:r()},Wi.prototype.getExceptionalResult_8ea4ql$=function(t){var n,i;return null!=(i=e.isType(n=t,Rt)?n:null)?i.cause:null},Wi.prototype.run=function(){var t,n=null;try{var i=(e.isType(t=this.delegate,Gi)?t:r()).continuation,o=i.context,a=this.takeState(),s=this.getExceptionalResult_8ea4ql$(a),l=Vi(this.resumeMode)?o.get_j3r2sn$(xe()):null;if(null!=s||null==l||l.isActive)if(null!=s)i.resumeWith_tl1gpc$(new _(E(s)));else{var c=this.getSuccessfulResult_tpy1pm$(a);i.resumeWith_tl1gpc$(new _(c))}else{var p=l.getCancellationException();this.cancelResult_83a7kv$(a,p),i.resumeWith_tl1gpc$(new _(E(wo(p))))}}catch(t){if(!e.isType(t,w))throw t;n=t}finally{var h;try{h=new _(u)}catch(t){if(!e.isType(t,w))throw t;h=new _(E(t))}var f=h;this.handleFatalException_mseuzz$(n,f.exceptionOrNull())}},Wi.prototype.handleFatalException_mseuzz$=function(t,e){if(null!==t||null!==e){var n=new ve("Fatal exception in coroutines machinery for "+this+". Please read KDoc to 'handleFatalException' method and report this incident to maintainers",D(null!=t?t:e));Dt(this.delegate.context,n)}},Wi.$metadata$={kind:o,simpleName:"DispatchedTask",interfaces:[co]},Ji.prototype.plus_11rb$=function(t){var n,o,a,s;if(null==(n=this.holder_0))s=new Ji(t);else if(e.isType(n,q))(e.isType(o=this.holder_0,q)?o:r()).add_11rb$(t),s=new Ji(this.holder_0);else{var l=h(4);l.add_11rb$(null==(a=this.holder_0)||e.isType(a,i)?a:r()),l.add_11rb$(t),s=new Ji(l)}return s},Ji.prototype.forEachReversed_qlkmfe$=$("kotlinx-coroutines-core.kotlinx.coroutines.internal.InlineList.forEachReversed_qlkmfe$",v((function(){var t=Object,n=e.throwCCE,i=e.kotlin.collections.ArrayList;return function(r){var o,a,s;if(null!=(o=this.holder_0))if(e.isType(o,i))for(var l=e.isType(s=this.holder_0,i)?s:n(),u=l.size-1|0;u>=0;u--)r(l.get_za3lpa$(u));else r(null==(a=this.holder_0)||e.isType(a,t)?a:n())}}))),Ji.$metadata$={kind:o,simpleName:"InlineList",interfaces:[]},Ji.prototype.unbox=function(){return this.holder_0},Ji.prototype.toString=function(){return"InlineList(holder="+e.toString(this.holder_0)+")"},Ji.prototype.hashCode=function(){var t=0;return 31*t+e.hashCode(this.holder_0)|0},Ji.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.holder_0,t.holder_0)},Object.defineProperty(Qi.prototype,"callerFrame",{get:function(){var t;return null==(t=this.uCont)||e.isType(t,Eo)?t:r()}}),Qi.prototype.getStackTraceElement=function(){return null},Object.defineProperty(Qi.prototype,"isScopedCoroutine",{get:function(){return!0}}),Object.defineProperty(Qi.prototype,"parent_8be2vx$",{get:function(){return this.parentContext.get_j3r2sn$(xe())}}),Qi.prototype.afterCompletion_s8jyv4$=function(t){Hi(p(this.uCont),Lt(t,this.uCont))},Qi.prototype.afterResume_s8jyv4$=function(t){this.uCont.resumeWith_tl1gpc$(Lt(t,this.uCont))},Qi.$metadata$={kind:o,simpleName:"ScopeCoroutine",interfaces:[Eo,ot]},Object.defineProperty(tr.prototype,"coroutineContext",{get:function(){return this.coroutineContext_glfhxt$_0}}),tr.prototype.toString=function(){return"CoroutineScope(coroutineContext="+this.coroutineContext+")"},tr.$metadata$={kind:o,simpleName:"ContextScope",interfaces:[Kt]},er.prototype.toString=function(){return this.symbol},er.prototype.unbox_tpy1pm$=$("kotlinx-coroutines-core.kotlinx.coroutines.internal.Symbol.unbox_tpy1pm$",v((function(){var t=Object,n=e.throwCCE;return function(i){var r;return i===this?null==null||e.isType(null,t)?null:n():null==(r=i)||e.isType(r,t)?r:n()}}))),er.$metadata$={kind:o,simpleName:"Symbol",interfaces:[]},hr.prototype.run=function(){this.closure$block()},hr.$metadata$={kind:o,interfaces:[uo]},_r.prototype.invoke_en0wgx$=function(t,e){this.invoke_ha2bmj$(t,null,e)},_r.$metadata$={kind:b,simpleName:"SelectBuilder",interfaces:[]},fr.$metadata$={kind:b,simpleName:"SelectClause0",interfaces:[]},dr.$metadata$={kind:b,simpleName:"SelectClause1",interfaces:[]},mr.$metadata$={kind:b,simpleName:"SelectClause2",interfaces:[]},yr.$metadata$={kind:b,simpleName:"SelectInstance",interfaces:[]},$("kotlinx-coroutines-core.kotlinx.coroutines.selects.select_wd2ujs$",v((function(){var n=t.kotlinx.coroutines.selects.SelectBuilderImpl,i=Error;return function(t,r){return e.suspendCall((o=t,function(t){var r=new n(t);try{o(r)}catch(t){if(!e.isType(t,i))throw t;r.handleBuilderException_tcv7n7$(t)}return r.getResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());var o}}))),$r.prototype.next=function(){return(t=this).number_0=t.number_0.inc();var t},$r.$metadata$={kind:o,simpleName:"SeqNumber",interfaces:[]},Object.defineProperty(vr.prototype,"callerFrame",{get:function(){var t;return e.isType(t=this.uCont_0,Eo)?t:null}}),vr.prototype.getStackTraceElement=function(){return null},Object.defineProperty(vr.prototype,"parentHandle_0",{get:function(){return this._parentHandle_0},set:function(t){this._parentHandle_0=t}}),Object.defineProperty(vr.prototype,"context",{get:function(){return this.uCont_0.context}}),Object.defineProperty(vr.prototype,"completion",{get:function(){return this}}),vr.prototype.doResume_0=function(t,e){for(this._result_0;;){var n=this._result_0;if(n===bi){if(this._result_0===bi&&(this._result_0=t(),1))return}else{if(n!==s)throw g("Already resumed");if(function(t){return t._result_0===s&&(t._result_0=wi,!0)}(this))return void e()}}},vr.prototype.resumeWith_tl1gpc$=function(t){t:do{for(this._result_0;;){var e=this._result_0;if(e===bi){if(this._result_0===bi&&(this._result_0=At(t),1))break t}else{if(e!==s)throw g("Already resumed");if(function(t){return t._result_0===s&&(t._result_0=wi,!0)}(this)){if(t.isFailure){var n=this.uCont_0;n.resumeWith_tl1gpc$(new _(E(wo(D(t.exceptionOrNull())))))}else this.uCont_0.resumeWith_tl1gpc$(t);break t}}}}while(0)},vr.prototype.resumeSelectWithException_tcv7n7$=function(t){t:do{for(this._result_0;;){var e=this._result_0;if(e===bi){if((n=this)._result_0===bi&&function(){return n._result_0=new Rt(wo(t,this.uCont_0)),!0}())break t}else{if(e!==s)throw g("Already resumed");if(function(t){return t._result_0===s&&(t._result_0=wi,!0)}(this)){p(this.uCont_0).resumeWith_tl1gpc$(new _(E(t)));break t}}}}while(0);var n},vr.prototype.getResult=function(){this.isSelected||this.initCancellability_0();var t=this._result_0;if(t===bi){if(this._result_0===bi&&(this._result_0=s,1))return s;t=this._result_0}if(t===wi)throw g("Already resumed");if(e.isType(t,Rt))throw t.cause;return t},vr.prototype.initCancellability_0=function(){var t;if(null!=(t=this.context.get_j3r2sn$(xe()))){var e=t,n=e.invokeOnCompletion_ct2b2z$(!0,void 0,new gr(this,e));this.parentHandle_0=n,this.isSelected&&n.dispose()}},gr.prototype.invoke=function(t){this.$outer.trySelect()&&this.$outer.resumeSelectWithException_tcv7n7$(this.job.getCancellationException())},gr.prototype.toString=function(){return"SelectOnCancelling["+this.$outer+"]"},gr.$metadata$={kind:o,simpleName:"SelectOnCancelling",interfaces:[an]},vr.prototype.handleBuilderException_tcv7n7$=function(t){if(this.trySelect())this.resumeWith_tl1gpc$(new _(E(t)));else if(!e.isType(t,Yr)){var n=this.getResult();e.isType(n,Rt)&&n.cause===t||Dt(this.context,t)}},Object.defineProperty(vr.prototype,"isSelected",{get:function(){for(this._state_0;;){var t=this._state_0;if(t===this)return!1;if(!e.isType(t,Ui))return!0;t.perform_s8jyv4$(this)}}}),vr.prototype.disposeOnSelect_rvfg84$=function(t){var e=new xr(t);(this.isSelected||(this.addLast_l2j9rm$(e),this.isSelected))&&t.dispose()},vr.prototype.doAfterSelect_0=function(){var t;null!=(t=this.parentHandle_0)&&t.dispose();for(var n=this._next;!y(n,this);)e.isType(n,xr)&&n.handle.dispose(),n=n._next},vr.prototype.trySelect=function(){var t,e=this.trySelectOther_uc1cc4$(null);if(e===n)t=!0;else{if(null!=e)throw g(("Unexpected trySelectIdempotent result "+x(e)).toString());t=!1}return t},vr.prototype.trySelectOther_uc1cc4$=function(t){for(this._state_0;;){var i=this._state_0;t:do{if(i===this){if(null==t){if(this._state_0!==this||(this._state_0=null,0))break t}else{var r=new br(t);if(!function(t){return t._state_0===t&&(t._state_0=r,!0)}(this))break t;var o=r.perform_s8jyv4$(this);if(null!==o)return o}return this.doAfterSelect_0(),n}if(!e.isType(i,Ui))return null==t?null:i===t.desc?n:null;if(null!=t){var a=t.atomicOp;if(e.isType(a,wr)&&a.impl===this)throw g("Cannot use matching select clauses on the same object".toString());if(a.isEarlierThan_bfmzsr$(i))return mi}i.perform_s8jyv4$(this)}while(0)}},br.prototype.perform_s8jyv4$=function(t){var n,i=e.isType(n=t,vr)?n:r();this.otherOp.finishPrepare();var o=this.otherOp.atomicOp.decide_s8jyv4$(null),a=null==o?this.otherOp.desc:i;return this,i._state_0===this&&(i._state_0=a),o},Object.defineProperty(br.prototype,"atomicOp",{get:function(){return this.otherOp.atomicOp}}),br.$metadata$={kind:o,simpleName:"PairSelectOp",interfaces:[Ui]},vr.prototype.performAtomicTrySelect_6q0pxr$=function(t){return new wr(this,t).perform_s8jyv4$(null)},vr.prototype.toString=function(){var t=this._state_0;return"SelectInstance(state="+(t===this?"this":x(t))+", result="+x(this._result_0)+")"},Object.defineProperty(wr.prototype,"opSequence",{get:function(){return this.opSequence_oe6pw4$_0}}),wr.prototype.prepare_11rb$=function(t){var n;if(null==t&&null!=(n=this.prepareSelectOp_0()))return n;try{return this.desc.prepare_4uxf5b$(this)}catch(n){throw e.isType(n,w)?(null==t&&this.undoPrepare_0(),n):n}},wr.prototype.complete_19pj23$=function(t,e){this.completeSelect_0(e),this.desc.complete_ayrq83$(this,e)},wr.prototype.prepareSelectOp_0=function(){var t;for(this.impl._state_0;;){var n=this.impl._state_0;if(n===this)return null;if(e.isType(n,Ui))n.perform_s8jyv4$(this.impl);else{if(n!==this.impl)return gi;if((t=this).impl._state_0===t.impl&&(t.impl._state_0=t,1))return null}}},wr.prototype.undoPrepare_0=function(){var t;(t=this).impl._state_0===t&&(t.impl._state_0=t.impl)},wr.prototype.completeSelect_0=function(t){var e=null==t,n=e?null:this.impl;this.impl._state_0===this&&(this.impl._state_0=n,1)&&e&&this.impl.doAfterSelect_0()},wr.prototype.toString=function(){return"AtomicSelectOp(sequence="+this.opSequence.toString()+")"},wr.$metadata$={kind:o,simpleName:"AtomicSelectOp",interfaces:[Fi]},vr.prototype.invoke_nd4vgy$=function(t,e){t.registerSelectClause0_s9h9qd$(this,e)},vr.prototype.invoke_veq140$=function(t,e){t.registerSelectClause1_o3xas4$(this,e)},vr.prototype.invoke_ha2bmj$=function(t,e,n){t.registerSelectClause2_rol3se$(this,e,n)},vr.prototype.onTimeout_7xvrws$=function(t,e){if(t.compareTo_11rb$(R)<=0)this.trySelect()&&sr(e,this.completion);else{var n=new hr((i=this,r=e,function(){return i.trySelect()&&rr(r,i.completion),u}));this.disposeOnSelect_rvfg84$(he(this.context).invokeOnTimeout_8irseu$(t,n))}var i,r},xr.$metadata$={kind:o,simpleName:"DisposeNode",interfaces:[mo]},vr.$metadata$={kind:o,simpleName:"SelectBuilderImpl",interfaces:[Eo,a,yr,_r,bo]},$("kotlinx-coroutines-core.kotlinx.coroutines.selects.selectUnbiased_wd2ujs$",v((function(){var n=t.kotlinx.coroutines.selects.UnbiasedSelectBuilderImpl,i=Error;return function(t,r){return e.suspendCall((o=t,function(t){var r=new n(t);try{o(r)}catch(t){if(!e.isType(t,i))throw t;r.handleBuilderException_tcv7n7$(t)}return r.initSelectResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());var o}}))),kr.prototype.handleBuilderException_tcv7n7$=function(t){this.instance.handleBuilderException_tcv7n7$(t)},kr.prototype.initSelectResult=function(){if(!this.instance.isSelected)try{var t;for(tt(this.clauses),t=this.clauses.iterator();t.hasNext();)t.next()()}catch(t){if(!e.isType(t,w))throw t;this.instance.handleBuilderException_tcv7n7$(t)}return this.instance.getResult()},kr.prototype.invoke_nd4vgy$=function(t,e){var n,i,r;this.clauses.add_11rb$((n=this,i=e,r=t,function(){return r.registerSelectClause0_s9h9qd$(n.instance,i),u}))},kr.prototype.invoke_veq140$=function(t,e){var n,i,r;this.clauses.add_11rb$((n=this,i=e,r=t,function(){return r.registerSelectClause1_o3xas4$(n.instance,i),u}))},kr.prototype.invoke_ha2bmj$=function(t,e,n){var i,r,o,a;this.clauses.add_11rb$((i=this,r=e,o=n,a=t,function(){return a.registerSelectClause2_rol3se$(i.instance,r,o),u}))},kr.prototype.onTimeout_7xvrws$=function(t,e){var n,i,r;this.clauses.add_11rb$((n=this,i=t,r=e,function(){return n.instance.onTimeout_7xvrws$(i,r),u}))},kr.$metadata$={kind:o,simpleName:"UnbiasedSelectBuilderImpl",interfaces:[_r]},$("kotlinx-coroutines-core.kotlinx.coroutines.selects.whileSelect_vmyjlh$",v((function(){var n=t.kotlinx.coroutines.selects.SelectBuilderImpl,i=Error;function r(t){return function(r){var o=new n(r);try{t(o)}catch(t){if(!e.isType(t,i))throw t;o.handleBuilderException_tcv7n7$(t)}return o.getResult()}}return function(t,n){for(;e.suspendCall(r(t)(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver()););}}))),$("kotlinx-coroutines-core.kotlinx.coroutines.sync.withLock_8701tb$",(function(t,n,i,r){void 0===n&&(n=null),e.suspendCall(t.lock_s8jyv4$(n,e.coroutineReceiver()));try{return i()}finally{t.unlock_s8jyv4$(n)}})),Er.prototype.toString=function(){return"Empty["+this.locked.toString()+"]"},Er.$metadata$={kind:o,simpleName:"Empty",interfaces:[]},$("kotlinx-coroutines-core.kotlinx.coroutines.sync.withPermit_103m5a$",(function(t,n,i){e.suspendCall(t.acquire(e.coroutineReceiver()));try{return n()}finally{t.release()}})),Cr.$metadata$={kind:o,simpleName:"CompletionHandlerBase",interfaces:[mo]},Sr.$metadata$={kind:o,simpleName:"CancelHandlerBase",interfaces:[]},zr.$metadata$={kind:k,simpleName:"Dispatchers",interfaces:[]};var Dr,Mr=null;function Br(){return null===Mr&&new zr,Mr}function Ur(t){cn.call(this),this.delegate=t}function Fr(){return new qr}function qr(){_e.call(this)}function Gr(){_e.call(this)}function Hr(){throw H("runBlocking event loop is not supported")}function Yr(t,e){U.call(this,t,e),this.name="CancellationException"}function Vr(t,e){return e=e||Object.create(Yr.prototype),Yr.call(e,t,null),e}function Kr(t,e,n){Yr.call(this,t,e),this.job_8be2vx$=n,this.name="JobCancellationException"}function Wr(t){return nt(t,R,Dr).toInt()}function Xr(){zt.call(this),this.messageQueue_8be2vx$=new Zr(this)}function Zr(t){var e;this.$outer=t,lo.call(this),this.processQueue_8be2vx$=(e=this,function(){return e.process(),u})}function Jr(){Qr=this,Xr.call(this)}Object.defineProperty(Ur.prototype,"immediate",{get:function(){throw H("Immediate dispatching is not supported on JS")}}),Ur.prototype.dispatch_5bn72i$=function(t,e){this.delegate.dispatch_5bn72i$(t,e)},Ur.prototype.isDispatchNeeded_1fupul$=function(t){return this.delegate.isDispatchNeeded_1fupul$(t)},Ur.prototype.dispatchYield_5bn72i$=function(t,e){this.delegate.dispatchYield_5bn72i$(t,e)},Ur.prototype.toString=function(){return this.delegate.toString()},Ur.$metadata$={kind:o,simpleName:"JsMainDispatcher",interfaces:[cn]},qr.prototype.dispatch_5bn72i$=function(t,e){Hr()},qr.$metadata$={kind:o,simpleName:"UnconfinedEventLoop",interfaces:[_e]},Gr.prototype.unpark_0=function(){Hr()},Gr.prototype.reschedule_0=function(t,e){Hr()},Gr.$metadata$={kind:o,simpleName:"EventLoopImplPlatform",interfaces:[_e]},Yr.$metadata$={kind:o,simpleName:"CancellationException",interfaces:[U]},Kr.prototype.toString=function(){return Yr.prototype.toString.call(this)+"; job="+this.job_8be2vx$},Kr.prototype.equals=function(t){return t===this||e.isType(t,Kr)&&y(t.message,this.message)&&y(t.job_8be2vx$,this.job_8be2vx$)&&y(t.cause,this.cause)},Kr.prototype.hashCode=function(){var t,e;return(31*((31*W(D(this.message))|0)+W(this.job_8be2vx$)|0)|0)+(null!=(e=null!=(t=this.cause)?W(t):null)?e:0)|0},Kr.$metadata$={kind:o,simpleName:"JobCancellationException",interfaces:[Yr]},Zr.prototype.schedule=function(){this.$outer.scheduleQueueProcessing()},Zr.prototype.reschedule=function(){setTimeout(this.processQueue_8be2vx$,0)},Zr.$metadata$={kind:o,simpleName:"ScheduledMessageQueue",interfaces:[lo]},Xr.prototype.dispatch_5bn72i$=function(t,e){this.messageQueue_8be2vx$.enqueue_771g0p$(e)},Xr.prototype.invokeOnTimeout_8irseu$=function(t,e){return new ro(setTimeout((n=e,function(){return n.run(),u}),Wr(t)));var n},Xr.prototype.scheduleResumeAfterDelay_egqmvs$=function(t,e){var n,i,r=setTimeout((n=e,i=this,function(){return n.resumeUndispatched_hyuxa3$(i,u),u}),Wr(t));e.invokeOnCancellation_f05bi3$(new ro(r))},Xr.$metadata$={kind:o,simpleName:"SetTimeoutBasedDispatcher",interfaces:[pe,zt]},Jr.prototype.scheduleQueueProcessing=function(){process.nextTick(this.messageQueue_8be2vx$.processQueue_8be2vx$)},Jr.$metadata$={kind:k,simpleName:"NodeDispatcher",interfaces:[Xr]};var Qr=null;function to(){return null===Qr&&new Jr,Qr}function eo(){no=this,Xr.call(this)}eo.prototype.scheduleQueueProcessing=function(){setTimeout(this.messageQueue_8be2vx$.processQueue_8be2vx$,0)},eo.$metadata$={kind:k,simpleName:"SetTimeoutDispatcher",interfaces:[Xr]};var no=null;function io(){return null===no&&new eo,no}function ro(t){kt.call(this),this.handle_0=t}function oo(t){zt.call(this),this.window_0=t,this.queue_0=new so(this.window_0)}function ao(t,e){this.this$WindowDispatcher=t,this.closure$handle=e}function so(t){var e;lo.call(this),this.window_0=t,this.messageName_0="dispatchCoroutine",this.window_0.addEventListener("message",(e=this,function(t){return t.source==e.window_0&&t.data==e.messageName_0&&(t.stopPropagation(),e.process()),u}),!0)}function lo(){Bi.call(this),this.yieldEvery=16,this.scheduled_0=!1}function uo(){}function co(){}function po(t){}function ho(t){var e,n;if(null!=(e=t.coroutineDispatcher))n=e;else{var i=new oo(t);t.coroutineDispatcher=i,n=i}return n}function _o(){}function fo(t){return it(t)}function mo(){this._next=this,this._prev=this,this._removed=!1}function yo(t,e){vo.call(this),this.queue=t,this.node=e}function $o(t){vo.call(this),this.queue=t,this.affectedNode_rjf1fm$_0=this.queue._next}function vo(){qi.call(this)}function go(t,e,n){Ui.call(this),this.affected=t,this.desc=e,this.atomicOp_khy6pf$_0=n}function bo(){mo.call(this)}function wo(t,e){return t}function xo(t){return t}function ko(t){return t}function Eo(){}function Co(t,e){}function So(t){return null}function To(t){return 0}function Oo(){this.value_0=null}ro.prototype.dispose=function(){clearTimeout(this.handle_0)},ro.prototype.invoke=function(t){this.dispose()},ro.prototype.toString=function(){return"ClearTimeout["+this.handle_0+"]"},ro.$metadata$={kind:o,simpleName:"ClearTimeout",interfaces:[Ee,kt]},oo.prototype.dispatch_5bn72i$=function(t,e){this.queue_0.enqueue_771g0p$(e)},oo.prototype.scheduleResumeAfterDelay_egqmvs$=function(t,e){var n,i;this.window_0.setTimeout((n=e,i=this,function(){return n.resumeUndispatched_hyuxa3$(i,u),u}),Wr(t))},ao.prototype.dispose=function(){this.this$WindowDispatcher.window_0.clearTimeout(this.closure$handle)},ao.$metadata$={kind:o,interfaces:[Ee]},oo.prototype.invokeOnTimeout_8irseu$=function(t,e){return new ao(this,this.window_0.setTimeout((n=e,function(){return n.run(),u}),Wr(t)));var n},oo.$metadata$={kind:o,simpleName:"WindowDispatcher",interfaces:[pe,zt]},so.prototype.schedule=function(){var t;Promise.resolve(u).then((t=this,function(e){return t.process(),u}))},so.prototype.reschedule=function(){this.window_0.postMessage(this.messageName_0,"*")},so.$metadata$={kind:o,simpleName:"WindowMessageQueue",interfaces:[lo]},lo.prototype.enqueue_771g0p$=function(t){this.addLast_trkh7z$(t),this.scheduled_0||(this.scheduled_0=!0,this.schedule())},lo.prototype.process=function(){try{for(var t=this.yieldEvery,e=0;e "+n+"\n |with response from "+na(t).url+":\n |status: "+t.status+"\n |response headers: \n |"+I(R(t.headers),void 0,void 0,void 0,void 0,void 0,Bn)+"\n ")}function Bn(t){return t.component1()+": "+t.component2()+"\n"}function Un(t){Cn.call(this,t)}function Fn(t,e){this.call_k7cxor$_0=t,this.$delegate_k8mkjd$_0=e}function qn(t,e,n){ea.call(this),this.call_tbj7t5$_0=t,this.status_i2dvkt$_0=n.status,this.version_ol3l9j$_0=n.version,this.requestTime_3msfjx$_0=n.requestTime,this.responseTime_xhbsdj$_0=n.responseTime,this.headers_w25qx3$_0=n.headers,this.coroutineContext_pwmz9e$_0=n.coroutineContext,this.content_mzxkbe$_0=U(e)}function Gn(t,e){_.call(this,e),this.exceptionState_0=1,this.local$$receiver_0=void 0,this.local$$receiver=t}function Hn(t,e,n){var i=new Gn(t,e);return n?i:i.doResume(null)}function Yn(t,e,n){void 0===n&&(n=null),this.type=t,this.reifiedType=e,this.kotlinType=n}function Vn(t){w("Failed to write body: "+e.getKClassFromExpression(t),this),this.name="UnsupportedContentTypeException"}function Kn(t){G("Unsupported upgrade protocol exception: "+t,this),this.name="UnsupportedUpgradeProtocolException"}function Wn(t,e,n){_.call(this,n),this.$controller=e,this.exceptionState_0=1}function Xn(t,e,n){var i=new Wn(t,this,e);return n?i:i.doResume(null)}function Zn(t,e,n){_.call(this,n),this.$controller=e,this.exceptionState_0=1}function Jn(t,e,n){var i=new Zn(t,this,e);return n?i:i.doResume(null)}function Qn(t){return function(e){if(null!=e)return t.cancel_m4sck1$(J(e.message)),u}}function ti(t){return function(e){return t.dispose(),u}}function ei(){}function ni(t,e,n,i,r,o){_.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$this$HttpClientEngine=t,this.local$closure$client=e,this.local$requestData=void 0,this.local$$receiver=n,this.local$content=i}function ii(t,e,n,i,r){_.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$this$HttpClientEngine=t,this.local$closure$requestData=e}function ri(t,e){return function(n,i,r){var o=new ii(t,e,n,this,i);return r?o:o.doResume(null)}}function oi(t,e,n){_.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$requestData=e}function ai(){}function si(t){return u}function li(t){var e,n=t.headers;for(e=X.HttpHeaders.UnsafeHeadersList.iterator();e.hasNext();){var i=e.next();if(n.contains_61zpoe$(i))throw new Z(i)}}function ui(t){var e;this.engineName_n0bloo$_0=t,this.coroutineContext_huxu0y$_0=tt((e=this,function(){return Q().plus_1fupul$(e.dispatcher).plus_1fupul$(new Y(e.engineName_n0bloo$_0+"-context"))}))}function ci(t){return function(n){return function(t){var n,i;try{null!=(i=e.isType(n=t,m)?n:null)&&i.close()}catch(t){if(e.isType(t,T))return u;throw t}}(t.dispatcher),u}}function pi(t){void 0===t&&(t=null),w("Client already closed",this),this.cause_om4vf0$_0=t,this.name="ClientEngineClosedException"}function hi(){}function _i(){this.threadsCount=4,this.pipelining=!1,this.proxy=null}function fi(t,e,n){var i,r,o,a,s,l,c;La((l=t,c=e,function(t){return t.appendAll_hb0ubp$(l),t.appendAll_hb0ubp$(c.headers),u})).forEach_ubvtmq$((s=n,function(t,e){if(!nt(X.HttpHeaders.ContentLength,t)&&!nt(X.HttpHeaders.ContentType,t))return s(t,I(e,";")),u})),null==t.get_61zpoe$(X.HttpHeaders.UserAgent)&&null==e.headers.get_61zpoe$(X.HttpHeaders.UserAgent)&&!ot.PlatformUtils.IS_BROWSER&&n(X.HttpHeaders.UserAgent,Pn);var p=null!=(r=null!=(i=e.contentType)?i.toString():null)?r:e.headers.get_61zpoe$(X.HttpHeaders.ContentType),h=null!=(a=null!=(o=e.contentLength)?o.toString():null)?a:e.headers.get_61zpoe$(X.HttpHeaders.ContentLength);null!=p&&n(X.HttpHeaders.ContentType,p),null!=h&&n(X.HttpHeaders.ContentLength,h)}function di(t){return p(t.context.get_j3r2sn$(gi())).callContext}function mi(t){gi(),this.callContext=t}function yi(){vi=this}Cn.$metadata$={kind:g,simpleName:"HttpClientCall",interfaces:[b]},Ln.$metadata$={kind:g,simpleName:"HttpEngineCall",interfaces:[]},Ln.prototype.component1=function(){return this.request},Ln.prototype.component2=function(){return this.response},Ln.prototype.copy_ukxvzw$=function(t,e){return new Ln(void 0===t?this.request:t,void 0===e?this.response:e)},Ln.prototype.toString=function(){return"HttpEngineCall(request="+e.toString(this.request)+", response="+e.toString(this.response)+")"},Ln.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.request)|0)+e.hashCode(this.response)|0},Ln.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.request,t.request)&&e.equals(this.response,t.response)},Rn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Rn.prototype=Object.create(_.prototype),Rn.prototype.constructor=Rn,Rn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return u;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},N("ktor-ktor-client-core.io.ktor.client.call.receive_8ov3cv$",P((function(){var n=e.getReifiedTypeParameterKType,i=e.throwCCE,r=e.getKClass,o=t.io.ktor.client.call,a=t.io.ktor.client.call.TypeInfo;return function(t,s,l,u){var c,p;t:do{try{p=new a(r(t),o.JsType,n(t))}catch(e){p=new a(r(t),o.JsType);break t}}while(0);return e.suspendCall(l.receive_jo9acv$(p,e.coroutineReceiver())),s(c=e.coroutineResult(e.coroutineReceiver()))?c:i()}}))),N("ktor-ktor-client-core.io.ktor.client.call.receive_5sqbag$",P((function(){var n=e.getReifiedTypeParameterKType,i=e.throwCCE,r=e.getKClass,o=t.io.ktor.client.call,a=t.io.ktor.client.call.TypeInfo;return function(t,s,l,u){var c,p,h=l.call;t:do{try{p=new a(r(t),o.JsType,n(t))}catch(e){p=new a(r(t),o.JsType);break t}}while(0);return e.suspendCall(h.receive_jo9acv$(p,e.coroutineReceiver())),s(c=e.coroutineResult(e.coroutineReceiver()))?c:i()}}))),Object.defineProperty(zn.prototype,"message",{get:function(){return this.message_eo7lbx$_0}}),zn.$metadata$={kind:g,simpleName:"DoubleReceiveException",interfaces:[j]},Object.defineProperty(Dn.prototype,"cause",{get:function(){return this.cause_xlcv2q$_0}}),Dn.$metadata$={kind:g,simpleName:"ReceivePipelineException",interfaces:[j]},Object.defineProperty(Mn.prototype,"message",{get:function(){return this.message_gd84kd$_0}}),Mn.$metadata$={kind:g,simpleName:"NoTransformationFoundException",interfaces:[D]},Un.$metadata$={kind:g,simpleName:"SavedHttpCall",interfaces:[Cn]},Object.defineProperty(Fn.prototype,"call",{get:function(){return this.call_k7cxor$_0}}),Object.defineProperty(Fn.prototype,"attributes",{get:function(){return this.$delegate_k8mkjd$_0.attributes}}),Object.defineProperty(Fn.prototype,"content",{get:function(){return this.$delegate_k8mkjd$_0.content}}),Object.defineProperty(Fn.prototype,"coroutineContext",{get:function(){return this.$delegate_k8mkjd$_0.coroutineContext}}),Object.defineProperty(Fn.prototype,"executionContext",{get:function(){return this.$delegate_k8mkjd$_0.executionContext}}),Object.defineProperty(Fn.prototype,"headers",{get:function(){return this.$delegate_k8mkjd$_0.headers}}),Object.defineProperty(Fn.prototype,"method",{get:function(){return this.$delegate_k8mkjd$_0.method}}),Object.defineProperty(Fn.prototype,"url",{get:function(){return this.$delegate_k8mkjd$_0.url}}),Fn.$metadata$={kind:g,simpleName:"SavedHttpRequest",interfaces:[Eo]},Object.defineProperty(qn.prototype,"call",{get:function(){return this.call_tbj7t5$_0}}),Object.defineProperty(qn.prototype,"status",{get:function(){return this.status_i2dvkt$_0}}),Object.defineProperty(qn.prototype,"version",{get:function(){return this.version_ol3l9j$_0}}),Object.defineProperty(qn.prototype,"requestTime",{get:function(){return this.requestTime_3msfjx$_0}}),Object.defineProperty(qn.prototype,"responseTime",{get:function(){return this.responseTime_xhbsdj$_0}}),Object.defineProperty(qn.prototype,"headers",{get:function(){return this.headers_w25qx3$_0}}),Object.defineProperty(qn.prototype,"coroutineContext",{get:function(){return this.coroutineContext_pwmz9e$_0}}),Object.defineProperty(qn.prototype,"content",{get:function(){return this.content_mzxkbe$_0}}),qn.$metadata$={kind:g,simpleName:"SavedHttpResponse",interfaces:[ea]},Gn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Gn.prototype=Object.create(_.prototype),Gn.prototype.constructor=Gn,Gn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$$receiver_0=new Un(this.local$$receiver.client),this.state_0=2,this.result_0=F(this.local$$receiver.response.content,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return this.local$$receiver_0.request=new Fn(this.local$$receiver_0,this.local$$receiver.request),this.local$$receiver_0.response=new qn(this.local$$receiver_0,q(t),this.local$$receiver.response),this.local$$receiver_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Yn.$metadata$={kind:g,simpleName:"TypeInfo",interfaces:[]},Yn.prototype.component1=function(){return this.type},Yn.prototype.component2=function(){return this.reifiedType},Yn.prototype.component3=function(){return this.kotlinType},Yn.prototype.copy_zg9ia4$=function(t,e,n){return new Yn(void 0===t?this.type:t,void 0===e?this.reifiedType:e,void 0===n?this.kotlinType:n)},Yn.prototype.toString=function(){return"TypeInfo(type="+e.toString(this.type)+", reifiedType="+e.toString(this.reifiedType)+", kotlinType="+e.toString(this.kotlinType)+")"},Yn.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*t+e.hashCode(this.type)|0)+e.hashCode(this.reifiedType)|0)+e.hashCode(this.kotlinType)|0},Yn.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.type,t.type)&&e.equals(this.reifiedType,t.reifiedType)&&e.equals(this.kotlinType,t.kotlinType)},Vn.$metadata$={kind:g,simpleName:"UnsupportedContentTypeException",interfaces:[j]},Kn.$metadata$={kind:g,simpleName:"UnsupportedUpgradeProtocolException",interfaces:[H]},Wn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Wn.prototype=Object.create(_.prototype),Wn.prototype.constructor=Wn,Wn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return u;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Zn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Zn.prototype=Object.create(_.prototype),Zn.prototype.constructor=Zn,Zn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return u;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(ei.prototype,"supportedCapabilities",{get:function(){return V()}}),Object.defineProperty(ei.prototype,"closed_yj5g8o$_0",{get:function(){var t,e;return!(null!=(e=null!=(t=this.coroutineContext.get_j3r2sn$(c.Key))?t.isActive:null)&&e)}}),ni.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ni.prototype=Object.create(_.prototype),ni.prototype.constructor=ni,ni.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=new Co;if(t.takeFrom_s9rlw$(this.local$$receiver.context),t.body=this.local$content,this.local$requestData=t.build(),li(this.local$requestData),this.local$this$HttpClientEngine.checkExtensions_1320zn$_0(this.local$requestData),this.state_0=2,this.result_0=this.local$this$HttpClientEngine.executeWithinCallContext_2kaaho$_0(this.local$requestData,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:var e=this.result_0,n=En(this.local$closure$client,this.local$requestData,e);if(this.state_0=3,this.result_0=this.local$$receiver.proceedWith_trkh7z$(n,this),this.result_0===h)return h;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ei.prototype.install_k5i6f8$=function(t){var e,n;t.sendPipeline.intercept_h71y74$(Go().Engine,(e=this,n=t,function(t,i,r,o){var a=new ni(e,n,t,i,this,r);return o?a:a.doResume(null)}))},ii.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ii.prototype=Object.create(_.prototype),ii.prototype.constructor=ii,ii.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$this$HttpClientEngine.closed_yj5g8o$_0)throw new pi;if(this.state_0=2,this.result_0=this.local$this$HttpClientEngine.execute_dkgphz$(this.local$closure$requestData,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},oi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},oi.prototype=Object.create(_.prototype),oi.prototype.constructor=oi,oi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.createCallContext_bk2bfg$_0(this.local$requestData.executionContext,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;if(this.state_0=3,this.result_0=K(this.$this,t.plus_1fupul$(new mi(t)),void 0,ri(this.$this,this.local$requestData)).await(this),this.result_0===h)return h;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ei.prototype.executeWithinCallContext_2kaaho$_0=function(t,e,n){var i=new oi(this,t,e);return n?i:i.doResume(null)},ei.prototype.checkExtensions_1320zn$_0=function(t){var e;for(e=t.requiredCapabilities_8be2vx$.iterator();e.hasNext();){var n=e.next();if(!this.supportedCapabilities.contains_11rb$(n))throw G(("Engine doesn't support "+n).toString())}},ei.prototype.createCallContext_bk2bfg$_0=function(t,e){var n=$(t),i=this.coroutineContext.plus_1fupul$(n).plus_1fupul$(On);t:do{var r;if(null==(r=e.context.get_j3r2sn$(c.Key)))break t;var o=r.invokeOnCompletion_ct2b2z$(!0,void 0,Qn(n));n.invokeOnCompletion_f05bi3$(ti(o))}while(0);return i},ei.$metadata$={kind:W,simpleName:"HttpClientEngine",interfaces:[m,b]},ai.prototype.create_dxyxif$=function(t,e){return void 0===t&&(t=si),e?e(t):this.create_dxyxif$$default(t)},ai.$metadata$={kind:W,simpleName:"HttpClientEngineFactory",interfaces:[]},Object.defineProperty(ui.prototype,"coroutineContext",{get:function(){return this.coroutineContext_huxu0y$_0.value}}),ui.prototype.close=function(){var t,n=e.isType(t=this.coroutineContext.get_j3r2sn$(c.Key),y)?t:f();n.complete(),n.invokeOnCompletion_f05bi3$(ci(this))},ui.$metadata$={kind:g,simpleName:"HttpClientEngineBase",interfaces:[ei]},Object.defineProperty(pi.prototype,"cause",{get:function(){return this.cause_om4vf0$_0}}),pi.$metadata$={kind:g,simpleName:"ClientEngineClosedException",interfaces:[j]},hi.$metadata$={kind:W,simpleName:"HttpClientEngineCapability",interfaces:[]},Object.defineProperty(_i.prototype,"response",{get:function(){throw w("Unbound [HttpClientCall] is deprecated. Consider using [request(block)] in instead.".toString())}}),_i.$metadata$={kind:g,simpleName:"HttpClientEngineConfig",interfaces:[]},Object.defineProperty(mi.prototype,"key",{get:function(){return gi()}}),yi.$metadata$={kind:O,simpleName:"Companion",interfaces:[it]};var $i,vi=null;function gi(){return null===vi&&new yi,vi}function bi(t,e){_.call(this,e),this.exceptionState_0=1,this.local$statusCode=void 0,this.local$originCall=void 0,this.local$response=t}function wi(t,e,n){var i=new bi(t,e);return n?i:i.doResume(null)}function xi(t){return t.validateResponse_d4bkoy$(wi),u}function ki(t){Ki(t,xi)}function Ei(t){w("Bad response: "+t,this),this.response=t,this.name="ResponseException"}function Ci(t){Ei.call(this,t),this.name="RedirectResponseException",this.message_rcd2w9$_0="Unhandled redirect: "+t.call.request.url+". Status: "+t.status}function Si(t){Ei.call(this,t),this.name="ServerResponseException",this.message_3dyog2$_0="Server error("+t.call.request.url+": "+t.status+"."}function Ti(t){Ei.call(this,t),this.name="ClientRequestException",this.message_mrabda$_0="Client request("+t.call.request.url+") invalid: "+t.status}function Oi(t){this.closure$body=t,lt.call(this),this.contentLength_ca0n1g$_0=e.Long.fromInt(t.length)}function Ni(t){this.closure$body=t,ut.call(this)}function Pi(t,e,n,i){_.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$$receiver=t,this.local$body=e}function Ai(t,e,n,i){var r=new Pi(t,e,this,n);return i?r:r.doResume(null)}function ji(t,e,n,i,r){_.call(this,r),this.$controller=i,this.exceptionState_0=10,this.local$closure$body=t,this.local$closure$response=e,this.local$$receiver=n}function Li(t,e){return function(n,i,r){var o=new ji(t,e,n,this,i);return r?o:o.doResume(null)}}function Ri(t,e,n,i){_.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$info=void 0,this.local$body=void 0,this.local$$receiver=t,this.local$f=e}function Ii(t,e,n,i){var r=new Ri(t,e,this,n);return i?r:r.doResume(null)}function zi(t){t.requestPipeline.intercept_h71y74$(Mo().Render,Ai),t.responsePipeline.intercept_h71y74$(sa().Parse,Ii)}function Di(t,e){Vi(),this.responseValidators_0=t,this.callExceptionHandlers_0=e}function Mi(t,e,n){_.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$response=e}function Bi(t,e,n){_.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$cause=e}function Ui(){this.responseValidators_8be2vx$=St(),this.responseExceptionHandlers_8be2vx$=St()}function Fi(){Yi=this,this.key_uukd7r$_0=new d("HttpResponseValidator")}function qi(t,e,n,i,r){_.call(this,r),this.$controller=i,this.exceptionState_0=6,this.local$closure$feature=t,this.local$cause=void 0,this.local$$receiver=e,this.local$it=n}function Gi(t,e,n,i,r){_.call(this,r),this.$controller=i,this.exceptionState_0=7,this.local$closure$feature=t,this.local$cause=void 0,this.local$$receiver=e,this.local$container=n}mi.$metadata$={kind:g,simpleName:"KtorCallContextElement",interfaces:[rt]},N("ktor-ktor-client-core.io.ktor.client.engine.attachToUserJob_mmkme6$",P((function(){var n=t.$$importsForInline$$["kotlinx-coroutines-core"].kotlinx.coroutines.Job,i=t.$$importsForInline$$["kotlinx-coroutines-core"].kotlinx.coroutines.CancellationException_init_pdl1vj$,r=e.kotlin.Unit;return function(t,o){var a,s,l;if(null!=(a=e.coroutineReceiver().context.get_j3r2sn$(n.Key))){var u=a.invokeOnCompletion_ct2b2z$(!0,void 0,(l=t,function(t){if(null!=t)return l.cancel_m4sck1$(i(t.message)),r}));t.invokeOnCompletion_f05bi3$((s=u,function(t){return s.dispose(),r}))}}}))),bi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},bi.prototype=Object.create(_.prototype),bi.prototype.constructor=bi,bi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$statusCode=this.local$response.status.value,this.local$originCall=this.local$response.call,this.local$statusCode<300||this.local$originCall.attributes.contains_w48dwb$($i))return;this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=Hn(this.local$originCall,this),this.result_0===h)return h;continue;case 3:var t=this.result_0;t.attributes.put_uuntuo$($i,u);var e=t.response;throw this.local$statusCode>=300&&this.local$statusCode<=399?new Ci(e):this.local$statusCode>=400&&this.local$statusCode<=499?new Ti(e):this.local$statusCode>=500&&this.local$statusCode<=599?new Si(e):new Ei(e);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ei.$metadata$={kind:g,simpleName:"ResponseException",interfaces:[j]},Object.defineProperty(Ci.prototype,"message",{get:function(){return this.message_rcd2w9$_0}}),Ci.$metadata$={kind:g,simpleName:"RedirectResponseException",interfaces:[Ei]},Object.defineProperty(Si.prototype,"message",{get:function(){return this.message_3dyog2$_0}}),Si.$metadata$={kind:g,simpleName:"ServerResponseException",interfaces:[Ei]},Object.defineProperty(Ti.prototype,"message",{get:function(){return this.message_mrabda$_0}}),Ti.$metadata$={kind:g,simpleName:"ClientRequestException",interfaces:[Ei]},Object.defineProperty(Oi.prototype,"contentLength",{get:function(){return this.contentLength_ca0n1g$_0}}),Oi.prototype.bytes=function(){return this.closure$body},Oi.$metadata$={kind:g,interfaces:[lt]},Ni.prototype.readFrom=function(){return this.closure$body},Ni.$metadata$={kind:g,interfaces:[ut]},Pi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Pi.prototype=Object.create(_.prototype),Pi.prototype.constructor=Pi,Pi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n;if(null==this.local$$receiver.context.headers.get_61zpoe$(X.HttpHeaders.Accept)&&this.local$$receiver.context.headers.append_puj7f4$(X.HttpHeaders.Accept,"*/*"),"string"==typeof this.local$body){var i;null!=(t=this.local$$receiver.context.headers.get_61zpoe$(X.HttpHeaders.ContentType))?(this.local$$receiver.context.headers.remove_61zpoe$(X.HttpHeaders.ContentType),i=at.Companion.parse_61zpoe$(t)):i=null;var r=null!=(n=i)?n:at.Text.Plain;if(this.state_0=6,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new st(this.local$body,r),this),this.result_0===h)return h;continue}if(e.isByteArray(this.local$body)){if(this.state_0=4,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Oi(this.local$body),this),this.result_0===h)return h;continue}if(e.isType(this.local$body,E)){if(this.state_0=2,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ni(this.local$body),this),this.result_0===h)return h;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:return this.result_0;case 3:this.state_0=5;continue;case 4:return this.result_0;case 5:this.state_0=7;continue;case 6:return this.result_0;case 7:return u;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ji.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ji.prototype=Object.create(_.prototype),ji.prototype.constructor=ji,ji.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=3,this.state_0=1,this.result_0=gt(this.local$closure$body,this.local$$receiver.channel,pt,this),this.result_0===h)return h;continue;case 1:this.exceptionState_0=10,this.finallyPath_0=[2],this.state_0=8,this.$returnValue=this.result_0;continue;case 2:return this.$returnValue;case 3:this.finallyPath_0=[10],this.exceptionState_0=8;var t=this.exception_0;if(e.isType(t,wt)){this.exceptionState_0=10,this.finallyPath_0=[6],this.state_0=8,this.$returnValue=(bt(this.local$closure$response,t),u);continue}if(e.isType(t,T)){this.exceptionState_0=10,this.finallyPath_0=[4],this.state_0=8,this.$returnValue=(S(this.local$closure$response,"Receive failed",t),u);continue}throw t;case 4:return this.$returnValue;case 5:this.state_0=7;continue;case 6:return this.$returnValue;case 7:this.finallyPath_0=[9],this.state_0=8;continue;case 8:this.exceptionState_0=10,ia(this.local$closure$response),this.state_0=this.finallyPath_0.shift();continue;case 9:return;case 10:throw this.exception_0;default:throw this.state_0=10,new Error("State Machine Unreachable execution")}}catch(t){if(10===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ri.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Ri.prototype=Object.create(_.prototype),Ri.prototype.constructor=Ri,Ri.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i;if(this.local$info=this.local$f.component1(),this.local$body=this.local$f.component2(),e.isType(this.local$body,E)){this.state_0=2;continue}return;case 1:throw this.exception_0;case 2:var r=this.local$$receiver.context.response,o=null!=(n=null!=(t=r.headers.get_61zpoe$(X.HttpHeaders.ContentLength))?ct(t):null)?n:pt;if(i=this.local$info.type,nt(i,B(Object.getPrototypeOf(_t.Unit).constructor))){if(ht(this.local$body),this.state_0=16,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new fa(this.local$info,u),this),this.result_0===h)return h;continue}if(nt(i,dt)){if(this.state_0=13,this.result_0=F(this.local$body,this),this.result_0===h)return h;continue}if(nt(i,B(mt))||nt(i,B(yt))){if(this.state_0=10,this.result_0=F(this.local$body,this),this.result_0===h)return h;continue}if(nt(i,vt)){if(this.state_0=7,this.result_0=$t(this.local$body,o,this),this.result_0===h)return h;continue}if(nt(i,B(E))){var a=xt(this.local$$receiver,void 0,void 0,Li(this.local$body,r)).channel;if(this.state_0=5,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new fa(this.local$info,a),this),this.result_0===h)return h;continue}if(nt(i,B(kt))){if(ht(this.local$body),this.state_0=3,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new fa(this.local$info,r.status),this),this.result_0===h)return h;continue}this.state_0=4;continue;case 3:return this.result_0;case 4:this.state_0=6;continue;case 5:return this.result_0;case 6:this.state_0=9;continue;case 7:var s=this.result_0;if(this.state_0=8,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new fa(this.local$info,q(s)),this),this.result_0===h)return h;continue;case 8:return this.result_0;case 9:this.state_0=12;continue;case 10:if(this.state_0=11,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new fa(this.local$info,this.result_0),this),this.result_0===h)return h;continue;case 11:return this.result_0;case 12:this.state_0=15;continue;case 13:if(this.state_0=14,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new fa(this.local$info,ft(this.result_0.readText_vux9f0$())),this),this.result_0===h)return h;continue;case 14:return this.result_0;case 15:this.state_0=17;continue;case 16:return this.result_0;case 17:return u;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Mi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Mi.prototype=Object.create(_.prototype),Mi.prototype.constructor=Mi,Mi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$tmp$=this.$this.responseValidators_0.iterator(),this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(!this.local$tmp$.hasNext()){this.state_0=4;continue}var t=this.local$tmp$.next();if(this.state_0=3,this.result_0=t(this.local$response,this),this.result_0===h)return h;continue;case 3:this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Di.prototype.validateResponse_0=function(t,e,n){var i=new Mi(this,t,e);return n?i:i.doResume(null)},Bi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Bi.prototype=Object.create(_.prototype),Bi.prototype.constructor=Bi,Bi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$tmp$=this.$this.callExceptionHandlers_0.iterator(),this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(!this.local$tmp$.hasNext()){this.state_0=4;continue}var t=this.local$tmp$.next();if(this.state_0=3,this.result_0=t(this.local$cause,this),this.result_0===h)return h;continue;case 3:this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Di.prototype.processException_0=function(t,e,n){var i=new Bi(this,t,e);return n?i:i.doResume(null)},Ui.prototype.handleResponseException_9rdja$=function(t){this.responseExceptionHandlers_8be2vx$.add_11rb$(t)},Ui.prototype.validateResponse_d4bkoy$=function(t){this.responseValidators_8be2vx$.add_11rb$(t)},Ui.$metadata$={kind:g,simpleName:"Config",interfaces:[]},Object.defineProperty(Fi.prototype,"key",{get:function(){return this.key_uukd7r$_0}}),Fi.prototype.prepare_oh3mgy$$default=function(t){var e=new Ui;t(e);var n=e;return Et(n.responseValidators_8be2vx$),Et(n.responseExceptionHandlers_8be2vx$),new Di(n.responseValidators_8be2vx$,n.responseExceptionHandlers_8be2vx$)},qi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},qi.prototype=Object.create(_.prototype),qi.prototype.constructor=qi,qi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=2,this.state_0=1,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$it,this),this.result_0===h)return h;continue;case 1:return this.result_0;case 2:if(this.exceptionState_0=6,this.local$cause=this.exception_0,e.isType(this.local$cause,T)){if(this.state_0=3,this.result_0=this.local$closure$feature.processException_0(this.local$cause,this),this.result_0===h)return h;continue}throw this.local$cause;case 3:throw this.local$cause;case 4:this.state_0=5;continue;case 5:return;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Gi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Gi.prototype=Object.create(_.prototype),Gi.prototype.constructor=Gi,Gi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=3,this.state_0=1,this.result_0=this.local$closure$feature.validateResponse_0(this.local$$receiver.context.response,this),this.result_0===h)return h;continue;case 1:if(this.state_0=2,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$container,this),this.result_0===h)return h;continue;case 2:return this.result_0;case 3:if(this.exceptionState_0=7,this.local$cause=this.exception_0,e.isType(this.local$cause,T)){if(this.state_0=4,this.result_0=this.local$closure$feature.processException_0(this.local$cause,this),this.result_0===h)return h;continue}throw this.local$cause;case 4:throw this.local$cause;case 5:this.state_0=6;continue;case 6:return;case 7:throw this.exception_0;default:throw this.state_0=7,new Error("State Machine Unreachable execution")}}catch(t){if(7===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Fi.prototype.install_wojrb5$=function(t,e){var n,i=new Ct("BeforeReceive");e.responsePipeline.insertPhaseBefore_b9zzbm$(sa().Receive,i),e.requestPipeline.intercept_h71y74$(Mo().Before,(n=t,function(t,e,i,r){var o=new qi(n,t,e,this,i);return r?o:o.doResume(null)})),e.responsePipeline.intercept_h71y74$(i,function(t){return function(e,n,i,r){var o=new Gi(t,e,n,this,i);return r?o:o.doResume(null)}}(t))},Fi.$metadata$={kind:O,simpleName:"Companion",interfaces:[Wi]};var Hi,Yi=null;function Vi(){return null===Yi&&new Fi,Yi}function Ki(t,e){t.install_xlxg29$(Vi(),e)}function Wi(){}function Xi(t){return u}function Zi(t,e){var n;return null!=(n=t.attributes.getOrNull_yzaw86$(Hi))?n.getOrNull_yzaw86$(e.key):null}function Ji(t){this.closure$comparison=t}Di.$metadata$={kind:g,simpleName:"HttpCallValidator",interfaces:[]},Wi.prototype.prepare_oh3mgy$=function(t,e){return void 0===t&&(t=Xi),e?e(t):this.prepare_oh3mgy$$default(t)},Wi.$metadata$={kind:W,simpleName:"HttpClientFeature",interfaces:[]},Ji.prototype.compare=function(t,e){return this.closure$comparison(t,e)},Ji.$metadata$={kind:g,interfaces:[Ut]};var Qi=P((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(i),r(n))}}}));function tr(t){this.closure$comparison=t}tr.prototype.compare=function(t,e){return this.closure$comparison(t,e)},tr.$metadata$={kind:g,interfaces:[Ut]};var er=P((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(n),r(i))}}}));function nr(t,e,n,i){var r,o,a;ur(),this.responseCharsetFallback_0=i,this.requestCharset_0=null,this.acceptCharsetHeader_0=null;var s,l=Bt(zt(e),new Ji(Qi(cr))),u=St();for(s=t.iterator();s.hasNext();){var c=s.next();e.containsKey_11rb$(c)||u.add_11rb$(c)}var p,h,_=Bt(u,new tr(er(pr))),f=Ft();for(p=_.iterator();p.hasNext();){var d=p.next();f.length>0&&f.append_gw00v9$(","),f.append_gw00v9$(Dt(d))}for(h=l.iterator();h.hasNext();){var m=h.next(),y=m.component1(),$=m.component2();if(f.length>0&&f.append_gw00v9$(","),!Ot(Tt(0,1),$))throw w("Check failed.".toString());var v=qt(100*$)/100;f.append_gw00v9$(Dt(y)+";q="+v)}0===f.length&&f.append_gw00v9$(Dt(this.responseCharsetFallback_0)),this.acceptCharsetHeader_0=f.toString(),this.requestCharset_0=null!=(a=null!=(o=null!=n?n:Mt(_))?o:null!=(r=Mt(l))?r.first:null)?a:Nt.Charsets.UTF_8}function ir(){this.charsets_8be2vx$=Gt(),this.charsetQuality_8be2vx$=k(),this.sendCharset=null,this.responseCharsetFallback=Nt.Charsets.UTF_8,this.defaultCharset=Nt.Charsets.UTF_8}function rr(){lr=this,this.key_wkh146$_0=new d("HttpPlainText")}function or(t,e,n,i,r){_.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$feature=t,this.local$contentType=void 0,this.local$$receiver=e,this.local$content=n}function ar(t,e,n,i,r){_.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$feature=t,this.local$info=void 0,this.local$body=void 0,this.local$tmp$_0=void 0,this.local$$receiver=e,this.local$f=n}ir.prototype.register_qv516$=function(t,e){if(void 0===e&&(e=null),null!=e&&!Ot(Tt(0,1),e))throw w("Check failed.".toString());this.charsets_8be2vx$.add_11rb$(t),null==e?this.charsetQuality_8be2vx$.remove_11rb$(t):this.charsetQuality_8be2vx$.put_xwzc9p$(t,e)},ir.$metadata$={kind:g,simpleName:"Config",interfaces:[]},Object.defineProperty(rr.prototype,"key",{get:function(){return this.key_wkh146$_0}}),rr.prototype.prepare_oh3mgy$$default=function(t){var e=new ir;t(e);var n=e;return new nr(n.charsets_8be2vx$,n.charsetQuality_8be2vx$,n.sendCharset,n.responseCharsetFallback)},or.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},or.prototype=Object.create(_.prototype),or.prototype.constructor=or,or.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$closure$feature.addCharsetHeaders_jc2hdt$(this.local$$receiver.context),"string"!=typeof this.local$content)return;this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$contentType=Pt(this.local$$receiver.context),null==this.local$contentType||nt(this.local$contentType.contentType,at.Text.Plain.contentType)){this.state_0=3;continue}return;case 3:var t=null!=this.local$contentType?At(this.local$contentType):null;if(this.state_0=4,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$closure$feature.wrapContent_0(this.local$content,t),this),this.result_0===h)return h;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ar.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ar.prototype=Object.create(_.prototype),ar.prototype.constructor=ar,ar.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n;if(this.local$info=this.local$f.component1(),this.local$body=this.local$f.component2(),null!=(t=this.local$info.type)&&t.equals(jt)&&e.isType(this.local$body,E)){this.state_0=2;continue}return;case 1:throw this.exception_0;case 2:if(this.local$tmp$_0=this.local$$receiver.context,this.state_0=3,this.result_0=F(this.local$body,this),this.result_0===h)return h;continue;case 3:n=this.result_0;var i=this.local$closure$feature.read_r18uy3$(this.local$tmp$_0,n);if(this.state_0=4,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new fa(this.local$info,i),this),this.result_0===h)return h;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},rr.prototype.install_wojrb5$=function(t,e){var n;e.requestPipeline.intercept_h71y74$(Mo().Render,(n=t,function(t,e,i,r){var o=new or(n,t,e,this,i);return r?o:o.doResume(null)})),e.responsePipeline.intercept_h71y74$(sa().Parse,function(t){return function(e,n,i,r){var o=new ar(t,e,n,this,i);return r?o:o.doResume(null)}}(t))},rr.$metadata$={kind:O,simpleName:"Feature",interfaces:[Wi]};var sr,lr=null;function ur(){return null===lr&&new rr,lr}function cr(t){return t.second}function pr(t){return Dt(t)}function hr(){yr(),this.checkHttpMethod=!0,this.allowHttpsDowngrade=!1}function _r(){mr=this,this.key_oxn36d$_0=new d("HttpRedirect")}function fr(t,e,n,i,r,o,a){_.call(this,a),this.$controller=o,this.exceptionState_0=1,this.local$closure$feature=t,this.local$this$HttpRedirect$=e,this.local$$receiver=n,this.local$origin=i,this.local$context=r}function dr(t,e,n,i,r,o){_.call(this,o),this.exceptionState_0=1,this.$this=t,this.local$call=void 0,this.local$originProtocol=void 0,this.local$originAuthority=void 0,this.local$$receiver=void 0,this.local$$receiver_0=e,this.local$context=n,this.local$origin=i,this.local$allowHttpsDowngrade=r}nr.prototype.wrapContent_0=function(t,e){var n=null!=e?e:this.requestCharset_0;return new st(t,Lt(at.Text.Plain,n))},nr.prototype.read_r18uy3$=function(t,e){var n,i=null!=(n=Rt(t.response))?n:this.responseCharsetFallback_0;return It(e,i)},nr.prototype.addCharsetHeaders_jc2hdt$=function(t){null==t.headers.get_61zpoe$(X.HttpHeaders.AcceptCharset)&&t.headers.set_puj7f4$(X.HttpHeaders.AcceptCharset,this.acceptCharsetHeader_0)},Object.defineProperty(nr.prototype,"defaultCharset",{get:function(){throw w("defaultCharset is deprecated".toString())},set:function(t){throw w("defaultCharset is deprecated".toString())}}),nr.$metadata$={kind:g,simpleName:"HttpPlainText",interfaces:[]},Object.defineProperty(_r.prototype,"key",{get:function(){return this.key_oxn36d$_0}}),_r.prototype.prepare_oh3mgy$$default=function(t){var e=new hr;return t(e),e},fr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},fr.prototype=Object.create(_.prototype),fr.prototype.constructor=fr,fr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$closure$feature.checkHttpMethod&&!sr.contains_11rb$(this.local$origin.request.method))return this.local$origin;this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.local$this$HttpRedirect$.handleCall_0(this.local$$receiver,this.local$context,this.local$origin,this.local$closure$feature.allowHttpsDowngrade,this),this.result_0===h)return h;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},_r.prototype.install_wojrb5$=function(t,e){var n,i;p(Zi(e,Pr())).intercept_vsqnz3$((n=t,i=this,function(t,e,r,o,a){var s=new fr(n,i,t,e,r,this,o);return a?s:s.doResume(null)}))},dr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},dr.prototype=Object.create(_.prototype),dr.prototype.constructor=dr,dr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if($r(this.local$origin.response.status)){this.state_0=2;continue}return this.local$origin;case 1:throw this.exception_0;case 2:this.local$call={v:this.local$origin},this.local$originProtocol=this.local$origin.request.url.protocol,this.local$originAuthority=Vt(this.local$origin.request.url),this.state_0=3;continue;case 3:var t=this.local$call.v.response.headers.get_61zpoe$(X.HttpHeaders.Location);if(this.local$$receiver=new Co,this.local$$receiver.takeFrom_s9rlw$(this.local$context),this.local$$receiver.url.parameters.clear(),null!=t&&Kt(this.local$$receiver.url,t),this.local$allowHttpsDowngrade||!Wt(this.local$originProtocol)||Wt(this.local$$receiver.url.protocol)){this.state_0=4;continue}return this.local$call.v;case 4:nt(this.local$originAuthority,Xt(this.local$$receiver.url))||this.local$$receiver.headers.remove_61zpoe$(X.HttpHeaders.Authorization);var e=this.local$$receiver;if(this.state_0=5,this.result_0=this.local$$receiver_0.execute_s9rlw$(e,this),this.result_0===h)return h;continue;case 5:if(this.local$call.v=this.result_0,$r(this.local$call.v.response.status)){this.state_0=6;continue}return this.local$call.v;case 6:this.state_0=3;continue;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},_r.prototype.handleCall_0=function(t,e,n,i,r,o){var a=new dr(this,t,e,n,i,r);return o?a:a.doResume(null)},_r.$metadata$={kind:O,simpleName:"Feature",interfaces:[Wi]};var mr=null;function yr(){return null===mr&&new _r,mr}function $r(t){var e;return(e=t.value)===kt.Companion.MovedPermanently.value||e===kt.Companion.Found.value||e===kt.Companion.TemporaryRedirect.value||e===kt.Companion.PermanentRedirect.value}function vr(){kr()}function gr(){xr=this,this.key_livr7a$_0=new d("RequestLifecycle")}function br(t,e,n,i){_.call(this,i),this.$controller=n,this.exceptionState_0=6,this.local$executionContext=void 0,this.local$$receiver=t}function wr(t,e,n,i){var r=new br(t,e,this,n);return i?r:r.doResume(null)}hr.$metadata$={kind:g,simpleName:"HttpRedirect",interfaces:[]},Object.defineProperty(gr.prototype,"key",{get:function(){return this.key_livr7a$_0}}),gr.prototype.prepare_oh3mgy$$default=function(t){return new vr},br.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},br.prototype=Object.create(_.prototype),br.prototype.constructor=br,br.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$executionContext=$(this.local$$receiver.context.executionContext),n=this.local$$receiver,i=this.local$executionContext,r=void 0,r=i.invokeOnCompletion_f05bi3$(function(t){return function(n){var i;return null!=n?Zt(t.context.executionContext,"Engine failed",n):(e.isType(i=t.context.executionContext.get_j3r2sn$(c.Key),y)?i:f()).complete(),u}}(n)),p(n.context.executionContext.get_j3r2sn$(c.Key)).invokeOnCompletion_f05bi3$(function(t){return function(e){return t.dispose(),u}}(r)),this.exceptionState_0=3,this.local$$receiver.context.executionContext=this.local$executionContext,this.state_0=1,this.result_0=this.local$$receiver.proceed(this),this.result_0===h)return h;continue;case 1:this.exceptionState_0=6,this.finallyPath_0=[2],this.state_0=4,this.$returnValue=this.result_0;continue;case 2:return this.$returnValue;case 3:this.finallyPath_0=[6],this.exceptionState_0=4;var t=this.exception_0;throw e.isType(t,T)?(this.local$executionContext.completeExceptionally_tcv7n7$(t),t):t;case 4:this.exceptionState_0=6,this.local$executionContext.complete(),this.state_0=this.finallyPath_0.shift();continue;case 5:return;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var n,i,r},gr.prototype.install_wojrb5$=function(t,e){e.requestPipeline.intercept_h71y74$(Mo().Before,wr)},gr.$metadata$={kind:O,simpleName:"Feature",interfaces:[Wi]};var xr=null;function kr(){return null===xr&&new gr,xr}function Er(){}function Cr(t){Pr(),void 0===t&&(t=20),this.maxSendCount=t,this.interceptors_0=St()}function Sr(t,e,n,i,r,o){_.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$block=t,this.local$$receiver=e,this.local$call=n}function Tr(){Nr=this,this.key_x494tl$_0=new d("HttpSend")}function Or(t,e,n,i,r,o){_.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$feature=t,this.local$closure$scope=e,this.local$tmp$=void 0,this.local$sender=void 0,this.local$currentCall=void 0,this.local$callChanged=void 0,this.local$transformed=void 0,this.local$$receiver=n,this.local$content=i}vr.$metadata$={kind:g,simpleName:"HttpRequestLifecycle",interfaces:[]},Er.$metadata$={kind:W,simpleName:"Sender",interfaces:[]},Cr.prototype.intercept_vsqnz3$=function(t){this.interceptors_0.add_11rb$(t)},Sr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Sr.prototype=Object.create(_.prototype),Sr.prototype.constructor=Sr,Sr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$block(this.local$$receiver,this.local$call,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Cr.prototype.intercept_efqc3v$=function(t){var e;this.interceptors_0.add_11rb$((e=t,function(t,n,i,r,o){var a=new Sr(e,t,n,i,this,r);return o?a:a.doResume(null)}))},Object.defineProperty(Tr.prototype,"key",{get:function(){return this.key_x494tl$_0}}),Tr.prototype.prepare_oh3mgy$$default=function(t){var e=new Cr;return t(e),e},Or.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Or.prototype=Object.create(_.prototype),Or.prototype.constructor=Or,Or.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(!e.isType(this.local$content,Jt)){var t="Fail to send body. Content has type: "+e.getKClassFromExpression(this.local$content)+", but OutgoingContent expected.";throw w(t.toString())}if(this.local$$receiver.context.body=this.local$content,this.local$sender=new Ar(this.local$closure$feature.maxSendCount,this.local$closure$scope),this.state_0=2,this.result_0=this.local$sender.execute_s9rlw$(this.local$$receiver.context,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:this.local$currentCall=this.result_0,this.state_0=3;continue;case 3:this.local$callChanged=!1,this.local$tmp$=this.local$closure$feature.interceptors_0.iterator(),this.state_0=4;continue;case 4:if(!this.local$tmp$.hasNext()){this.state_0=7;continue}var n=this.local$tmp$.next();if(this.state_0=5,this.result_0=n(this.local$sender,this.local$currentCall,this.local$$receiver.context,this),this.result_0===h)return h;continue;case 5:if(this.local$transformed=this.result_0,this.local$transformed===this.local$currentCall){this.state_0=4;continue}this.state_0=6;continue;case 6:this.local$currentCall=this.local$transformed,this.local$callChanged=!0,this.state_0=7;continue;case 7:if(!this.local$callChanged){this.state_0=8;continue}this.state_0=3;continue;case 8:if(this.state_0=9,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$currentCall,this),this.result_0===h)return h;continue;case 9:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Tr.prototype.install_wojrb5$=function(t,e){var n,i;e.requestPipeline.intercept_h71y74$(Mo().Send,(n=t,i=e,function(t,e,r,o){var a=new Or(n,i,t,e,this,r);return o?a:a.doResume(null)}))},Tr.$metadata$={kind:O,simpleName:"Feature",interfaces:[Wi]};var Nr=null;function Pr(){return null===Nr&&new Tr,Nr}function Ar(t,e){this.maxSendCount_0=t,this.client_0=e,this.sentCount_0=0,this.currentCall_0=null}function jr(t,e,n){_.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$requestBuilder=e}function Lr(t){w(t,this),this.name="SendCountExceedException"}function Rr(t,e,n){Kr(),this.requestTimeoutMillis_0=t,this.connectTimeoutMillis_0=e,this.socketTimeoutMillis_0=n}function Ir(){Mr(),this.requestTimeoutMillis_9n7r3q$_0=null,this.connectTimeoutMillis_v2k54f$_0=null,this.socketTimeoutMillis_tzgsjy$_0=null}function zr(){Dr=this,this.key=new d("TimeoutConfiguration")}jr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},jr.prototype=Object.create(_.prototype),jr.prototype.constructor=jr,jr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i;if(null!=(t=this.$this.currentCall_0)&&bt(t),this.$this.sentCount_0>=this.$this.maxSendCount_0)throw new Lr("Max send count "+this.$this.maxSendCount_0+" exceeded");if(this.$this.sentCount_0=this.$this.sentCount_0+1|0,this.state_0=2,this.result_0=this.$this.client_0.sendPipeline.execute_8pmvt0$(this.local$requestBuilder,this.local$requestBuilder.body,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:var r=this.result_0;if(null==(i=e.isType(n=r,Cn)?n:null))throw w(("Failed to execute send pipeline. Expected to got [HttpClientCall], but received "+r.toString()).toString());var o=i;return this.$this.currentCall_0=o,o;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ar.prototype.execute_s9rlw$=function(t,e,n){var i=new jr(this,t,e);return n?i:i.doResume(null)},Ar.$metadata$={kind:g,simpleName:"DefaultSender",interfaces:[Er]},Cr.$metadata$={kind:g,simpleName:"HttpSend",interfaces:[]},Lr.$metadata$={kind:g,simpleName:"SendCountExceedException",interfaces:[j]},Object.defineProperty(Ir.prototype,"requestTimeoutMillis",{get:function(){return this.requestTimeoutMillis_9n7r3q$_0},set:function(t){this.requestTimeoutMillis_9n7r3q$_0=this.checkTimeoutValue_0(t)}}),Object.defineProperty(Ir.prototype,"connectTimeoutMillis",{get:function(){return this.connectTimeoutMillis_v2k54f$_0},set:function(t){this.connectTimeoutMillis_v2k54f$_0=this.checkTimeoutValue_0(t)}}),Object.defineProperty(Ir.prototype,"socketTimeoutMillis",{get:function(){return this.socketTimeoutMillis_tzgsjy$_0},set:function(t){this.socketTimeoutMillis_tzgsjy$_0=this.checkTimeoutValue_0(t)}}),Ir.prototype.build_8be2vx$=function(){return new Rr(this.requestTimeoutMillis,this.connectTimeoutMillis,this.socketTimeoutMillis)},Ir.prototype.checkTimeoutValue_0=function(t){if(!(null==t||t.toNumber()>0))throw G("Only positive timeout values are allowed, for infinite timeout use HttpTimeout.INFINITE_TIMEOUT_MS".toString());return t},zr.$metadata$={kind:O,simpleName:"Companion",interfaces:[]};var Dr=null;function Mr(){return null===Dr&&new zr,Dr}function Br(t,e,n,i){return void 0===t&&(t=null),void 0===e&&(e=null),void 0===n&&(n=null),i=i||Object.create(Ir.prototype),Ir.call(i),i.requestTimeoutMillis=t,i.connectTimeoutMillis=e,i.socketTimeoutMillis=n,i}function Ur(){Vr=this,this.key_g1vqj4$_0=new d("TimeoutFeature"),this.INFINITE_TIMEOUT_MS=pt}function Fr(t,e,n,i,r,o){_.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$requestTimeout=t,this.local$closure$executionContext=e,this.local$this$=n}function qr(t,e,n){return function(i,r,o){var a=new Fr(t,e,n,i,this,r);return o?a:a.doResume(null)}}function Gr(t){return function(e){return t.cancel_m4sck1$(),u}}function Hr(t,e,n,i,r,o,a){_.call(this,a),this.$controller=o,this.exceptionState_0=1,this.local$closure$feature=t,this.local$this$HttpTimeout$=e,this.local$closure$scope=n,this.local$$receiver=i}Ir.$metadata$={kind:g,simpleName:"HttpTimeoutCapabilityConfiguration",interfaces:[]},Rr.prototype.hasNotNullTimeouts_0=function(){return null!=this.requestTimeoutMillis_0||null!=this.connectTimeoutMillis_0||null!=this.socketTimeoutMillis_0},Object.defineProperty(Ur.prototype,"key",{get:function(){return this.key_g1vqj4$_0}}),Ur.prototype.prepare_oh3mgy$$default=function(t){var e=Br();return t(e),e.build_8be2vx$()},Fr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Fr.prototype=Object.create(_.prototype),Fr.prototype.constructor=Fr,Fr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Qt(this.local$closure$requestTimeout,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return this.local$closure$executionContext.cancel_m4sck1$(new Wr(this.local$this$.context)),u;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Hr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Hr.prototype=Object.create(_.prototype),Hr.prototype.constructor=Hr,Hr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e=this.local$$receiver.context.getCapabilityOrNull_i25mbv$(Kr());if(null==e&&this.local$closure$feature.hasNotNullTimeouts_0()&&(e=Br(),this.local$$receiver.context.setCapability_wfl2px$(Kr(),e)),null!=e){var n=e,i=this.local$closure$feature,r=this.local$this$HttpTimeout$,o=this.local$closure$scope;t:do{var a,s,l,u;n.connectTimeoutMillis=null!=(a=n.connectTimeoutMillis)?a:i.connectTimeoutMillis_0,n.socketTimeoutMillis=null!=(s=n.socketTimeoutMillis)?s:i.socketTimeoutMillis_0,n.requestTimeoutMillis=null!=(l=n.requestTimeoutMillis)?l:i.requestTimeoutMillis_0;var c=null!=(u=n.requestTimeoutMillis)?u:i.requestTimeoutMillis_0;if(null==c||nt(c,r.INFINITE_TIMEOUT_MS))break t;var p=this.local$$receiver.context.executionContext,h=te(o,void 0,void 0,qr(c,p,this.local$$receiver));this.local$$receiver.context.executionContext.invokeOnCompletion_f05bi3$(Gr(h))}while(0);t=n}else t=null;return t;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ur.prototype.install_wojrb5$=function(t,e){var n,i,r;e.requestPipeline.intercept_h71y74$(Mo().Before,(n=t,i=this,r=e,function(t,e,o,a){var s=new Hr(n,i,r,t,e,this,o);return a?s:s.doResume(null)}))},Ur.$metadata$={kind:O,simpleName:"Feature",interfaces:[hi,Wi]};var Yr,Vr=null;function Kr(){return null===Vr&&new Ur,Vr}function Wr(t){var e,n;J("Request timeout has been expired [url="+t.url.buildString()+", request_timeout="+(null!=(n=null!=(e=t.getCapabilityOrNull_i25mbv$(Kr()))?e.requestTimeoutMillis:null)?n:"unknown").toString()+" ms]",this),this.name="HttpRequestTimeoutException"}function Xr(){}function Zr(t,e){this.call_e1jkgq$_0=t,this.$delegate_wwo9g4$_0=e}function Jr(t,e){this.call_8myheh$_0=t,this.$delegate_46xi97$_0=e}function Qr(){bo.call(this);var t=Ft(),e=pe(16);t.append_gw00v9$(he(e)),this.nonce_0=t.toString();var n=new re;n.append_puj7f4$(X.HttpHeaders.Upgrade,"websocket"),n.append_puj7f4$(X.HttpHeaders.Connection,"upgrade"),n.append_puj7f4$(X.HttpHeaders.SecWebSocketKey,this.nonce_0),n.append_puj7f4$(X.HttpHeaders.SecWebSocketVersion,Yr),this.headers_mq8s01$_0=n.build()}function to(t,e){ao(),void 0===t&&(t=de),void 0===e&&(e=me),this.pingInterval=t,this.maxFrameSize=e}function eo(){oo=this,this.key_9eo0u2$_0=new d("Websocket")}function no(t,e,n,i){_.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$$receiver=t}function io(t,e,n,i){var r=new no(t,e,this,n);return i?r:r.doResume(null)}function ro(t,e,n,i,r){_.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$feature=t,this.local$info=void 0,this.local$session=void 0,this.local$$receiver=e,this.local$f=n}Rr.$metadata$={kind:g,simpleName:"HttpTimeout",interfaces:[]},Wr.$metadata$={kind:g,simpleName:"HttpRequestTimeoutException",interfaces:[wt]},Xr.$metadata$={kind:W,simpleName:"ClientWebSocketSession",interfaces:[le]},Object.defineProperty(Zr.prototype,"call",{get:function(){return this.call_e1jkgq$_0}}),Object.defineProperty(Zr.prototype,"closeReason",{get:function(){return this.$delegate_wwo9g4$_0.closeReason}}),Object.defineProperty(Zr.prototype,"coroutineContext",{get:function(){return this.$delegate_wwo9g4$_0.coroutineContext}}),Object.defineProperty(Zr.prototype,"incoming",{get:function(){return this.$delegate_wwo9g4$_0.incoming}}),Object.defineProperty(Zr.prototype,"outgoing",{get:function(){return this.$delegate_wwo9g4$_0.outgoing}}),Zr.prototype.flush=function(t){return this.$delegate_wwo9g4$_0.flush(t)},Zr.prototype.send_x9o3m3$=function(t,e){return this.$delegate_wwo9g4$_0.send_x9o3m3$(t,e)},Zr.prototype.terminate=function(){return this.$delegate_wwo9g4$_0.terminate()},Zr.$metadata$={kind:g,simpleName:"DefaultClientWebSocketSession",interfaces:[ue,Xr]},Object.defineProperty(Jr.prototype,"call",{get:function(){return this.call_8myheh$_0}}),Object.defineProperty(Jr.prototype,"coroutineContext",{get:function(){return this.$delegate_46xi97$_0.coroutineContext}}),Object.defineProperty(Jr.prototype,"incoming",{get:function(){return this.$delegate_46xi97$_0.incoming}}),Object.defineProperty(Jr.prototype,"outgoing",{get:function(){return this.$delegate_46xi97$_0.outgoing}}),Jr.prototype.flush=function(t){return this.$delegate_46xi97$_0.flush(t)},Jr.prototype.send_x9o3m3$=function(t,e){return this.$delegate_46xi97$_0.send_x9o3m3$(t,e)},Jr.prototype.terminate=function(){return this.$delegate_46xi97$_0.terminate()},Jr.$metadata$={kind:g,simpleName:"DelegatingClientWebSocketSession",interfaces:[Xr,le]},Object.defineProperty(Qr.prototype,"headers",{get:function(){return this.headers_mq8s01$_0}}),Qr.prototype.verify_fkh4uy$=function(t){var e;if(null==(e=t.get_61zpoe$(X.HttpHeaders.SecWebSocketAccept)))throw w("Server should specify header Sec-WebSocket-Accept".toString());var n=e,i=ce(this.nonce_0);if(!nt(i,n))throw w(("Failed to verify server accept header. Expected: "+i+", received: "+n).toString())},Qr.prototype.toString=function(){return"WebSocketContent"},Qr.$metadata$={kind:g,simpleName:"WebSocketContent",interfaces:[bo]},Object.defineProperty(eo.prototype,"key",{get:function(){return this.key_9eo0u2$_0}}),eo.prototype.prepare_oh3mgy$$default=function(t){return new to},no.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},no.prototype=Object.create(_.prototype),no.prototype.constructor=no,no.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(_e(this.local$$receiver.context.url.protocol)){this.state_0=2;continue}return;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Qr,this),this.result_0===h)return h;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ro.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ro.prototype=Object.create(_.prototype),ro.prototype.constructor=ro,ro.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.local$info=this.local$f.component1(),this.local$session=this.local$f.component2(),e.isType(this.local$session,le)){this.state_0=2;continue}return;case 1:throw this.exception_0;case 2:if(null!=(t=this.local$info.type)&&t.equals(B(Zr))){var n=this.local$closure$feature,i=new Zr(this.local$$receiver.context,n.asDefault_0(this.local$session));if(this.state_0=3,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new fa(this.local$info,i),this),this.result_0===h)return h;continue}this.state_0=4;continue;case 3:return;case 4:var r=new fa(this.local$info,new Jr(this.local$$receiver.context,this.local$session));if(this.state_0=5,this.result_0=this.local$$receiver.proceedWith_trkh7z$(r,this),this.result_0===h)return h;continue;case 5:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},eo.prototype.install_wojrb5$=function(t,e){var n;e.requestPipeline.intercept_h71y74$(Mo().Render,io),e.responsePipeline.intercept_h71y74$(sa().Transform,(n=t,function(t,e,i,r){var o=new ro(n,t,e,this,i);return r?o:o.doResume(null)}))},eo.$metadata$={kind:O,simpleName:"Feature",interfaces:[Wi]};var oo=null;function ao(){return null===oo&&new eo,oo}function so(t){w(t,this),this.name="WebSocketException"}function lo(t,e){return t.protocol=ye.Companion.WS,t.port=t.protocol.defaultPort,u}function uo(t,e,n){_.call(this,n),this.exceptionState_0=7,this.local$closure$block=t,this.local$it=e}function co(t){return function(e,n,i){var r=new uo(t,e,n);return i?r:r.doResume(null)}}function po(t,e,n,i){_.call(this,i),this.exceptionState_0=16,this.local$response=void 0,this.local$session=void 0,this.local$response_0=void 0,this.local$$receiver=t,this.local$request=e,this.local$block=n}function ho(t,e,n,i,r){var o=new po(t,e,n,i);return r?o:o.doResume(null)}function _o(t){return u}function fo(t,e,n,i,r){return function(o){return o.method=t,Lo(o,"ws",e,n,i),r(o),u}}function mo(t,e,n,i,r,o,a,s){_.call(this,s),this.exceptionState_0=1,this.local$$receiver=t,this.local$method=e,this.local$host=n,this.local$port=i,this.local$path=r,this.local$request=o,this.local$block=a}function yo(t,e,n,i,r,o,a,s,l){var u=new mo(t,e,n,i,r,o,a,s);return l?u:u.doResume(null)}function $o(t){return u}function vo(t,e){return function(n){return n.url.protocol=ye.Companion.WS,n.url.port=Qo(n),Kt(n.url,t),e(n),u}}function go(t,e,n,i,r){_.call(this,r),this.exceptionState_0=1,this.local$$receiver=t,this.local$urlString=e,this.local$request=n,this.local$block=i}function bo(){ne.call(this),this.content_1mwwgv$_xt2h6t$_0=tt(xo)}function wo(t,e,n){_.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$output=e}function xo(){return be()}function ko(t,e){this.call_bo7spw$_0=t,this.method_c5x7eh$_0=e.method,this.url_9j6cnp$_0=e.url,this.content_jw4yw1$_0=e.body,this.headers_atwsac$_0=e.headers,this.attributes_el41s3$_0=e.attributes}function Eo(){}function Co(){No(),this.url=new ae,this.method=Ht.Companion.Get,this.headers_nor9ye$_0=new re,this.body=Ea(),this.executionContext_h6ms6p$_0=$(),this.attributes=v(!0)}function So(){return k()}function To(){Oo=this}to.prototype.asDefault_0=function(t){return e.isType(t,ue)?t:fe(t,this.pingInterval,this.maxFrameSize)},to.$metadata$={kind:g,simpleName:"WebSockets",interfaces:[]},so.$metadata$={kind:g,simpleName:"WebSocketException",interfaces:[j]},uo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},uo.prototype=Object.create(_.prototype),uo.prototype.constructor=uo,uo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=4,this.state_0=1,this.result_0=this.local$closure$block(this.local$it,this),this.result_0===h)return h;continue;case 1:this.exceptionState_0=7,this.finallyPath_0=[2],this.state_0=5,this.$returnValue=this.result_0;continue;case 2:return this.$returnValue;case 3:return;case 4:this.finallyPath_0=[7],this.state_0=5;continue;case 5:if(this.exceptionState_0=7,this.state_0=6,this.result_0=ve(this.local$it,void 0,this),this.result_0===h)return h;continue;case 6:this.state_0=this.finallyPath_0.shift();continue;case 7:throw this.exception_0;default:throw this.state_0=7,new Error("State Machine Unreachable execution")}}catch(t){if(7===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},po.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},po.prototype=Object.create(_.prototype),po.prototype.constructor=po,po.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=new Co;t.url_6yzzjr$(lo),this.local$request(t);var n,i,r,o=new da(t,this.local$$receiver);if(n=B(da),nt(n,B(da))){this.result_0=e.isType(i=o,da)?i:f(),this.state_0=8;continue}if(nt(n,B(ea))){if(this.state_0=6,this.result_0=o.execute(this),this.result_0===h)return h;continue}if(this.state_0=1,this.result_0=o.executeUnsafe(this),this.result_0===h)return h;continue;case 1:var a;this.local$response=this.result_0,this.exceptionState_0=4;var s,l=this.local$response.call;t:do{try{s=new Yn(B(da),js.JsType,$e(B(da),[],!1))}catch(t){s=new Yn(B(da),js.JsType);break t}}while(0);if(this.state_0=2,this.result_0=l.receive_jo9acv$(s,this),this.result_0===h)return h;continue;case 2:this.result_0=e.isType(a=this.result_0,da)?a:f(),this.exceptionState_0=16,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=7;continue;case 4:this.finallyPath_0=[16],this.state_0=5;continue;case 5:this.exceptionState_0=16,ia(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:this.result_0=e.isType(r=this.result_0,da)?r:f(),this.state_0=7;continue;case 7:this.state_0=8;continue;case 8:if(this.local$session=this.result_0,this.state_0=9,this.result_0=this.local$session.executeUnsafe(this),this.result_0===h)return h;continue;case 9:var u;this.local$response_0=this.result_0,this.exceptionState_0=13;var c,p=this.local$response_0.call;t:do{try{c=new Yn(B(Zr),js.JsType,$e(B(Zr),[],!1))}catch(t){c=new Yn(B(Zr),js.JsType);break t}}while(0);if(this.state_0=10,this.result_0=p.receive_jo9acv$(c,this),this.result_0===h)return h;continue;case 10:this.result_0=e.isType(u=this.result_0,Zr)?u:f();var _=this.result_0;if(this.state_0=11,this.result_0=co(this.local$block)(_,this),this.result_0===h)return h;continue;case 11:this.exceptionState_0=16,this.finallyPath_0=[12],this.state_0=14;continue;case 12:return;case 13:this.finallyPath_0=[16],this.state_0=14;continue;case 14:if(this.exceptionState_0=16,this.state_0=15,this.result_0=this.local$session.cleanup_abn2de$(this.local$response_0,this),this.result_0===h)return h;continue;case 15:this.state_0=this.finallyPath_0.shift();continue;case 16:throw this.exception_0;default:throw this.state_0=16,new Error("State Machine Unreachable execution")}}catch(t){if(16===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},mo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},mo.prototype=Object.create(_.prototype),mo.prototype.constructor=mo,mo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(void 0===this.local$method&&(this.local$method=Ht.Companion.Get),void 0===this.local$host&&(this.local$host="localhost"),void 0===this.local$port&&(this.local$port=0),void 0===this.local$path&&(this.local$path="/"),void 0===this.local$request&&(this.local$request=_o),this.state_0=2,this.result_0=ho(this.local$$receiver,fo(this.local$method,this.local$host,this.local$port,this.local$path,this.local$request),this.local$block,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},go.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},go.prototype=Object.create(_.prototype),go.prototype.constructor=go,go.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(void 0===this.local$request&&(this.local$request=$o),this.state_0=2,this.result_0=yo(this.local$$receiver,Ht.Companion.Get,"localhost",0,"/",vo(this.local$urlString,this.local$request),this.local$block,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(bo.prototype,"content_1mwwgv$_0",{get:function(){return this.content_1mwwgv$_xt2h6t$_0.value}}),Object.defineProperty(bo.prototype,"output",{get:function(){return this.content_1mwwgv$_0}}),wo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},wo.prototype=Object.create(_.prototype),wo.prototype.constructor=wo,wo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=ge(this.$this.content_1mwwgv$_0,this.local$output,void 0,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bo.prototype.pipeTo_h3x4ir$=function(t,e,n){var i=new wo(this,t,e);return n?i:i.doResume(null)},bo.$metadata$={kind:g,simpleName:"ClientUpgradeContent",interfaces:[ne]},Object.defineProperty(ko.prototype,"call",{get:function(){return this.call_bo7spw$_0}}),Object.defineProperty(ko.prototype,"coroutineContext",{get:function(){return this.call.coroutineContext}}),Object.defineProperty(ko.prototype,"method",{get:function(){return this.method_c5x7eh$_0}}),Object.defineProperty(ko.prototype,"url",{get:function(){return this.url_9j6cnp$_0}}),Object.defineProperty(ko.prototype,"content",{get:function(){return this.content_jw4yw1$_0}}),Object.defineProperty(ko.prototype,"headers",{get:function(){return this.headers_atwsac$_0}}),Object.defineProperty(ko.prototype,"attributes",{get:function(){return this.attributes_el41s3$_0}}),ko.$metadata$={kind:g,simpleName:"DefaultHttpRequest",interfaces:[Eo]},Object.defineProperty(Eo.prototype,"coroutineContext",{get:function(){return this.call.coroutineContext}}),Object.defineProperty(Eo.prototype,"executionContext",{get:function(){return p(this.coroutineContext.get_j3r2sn$(c.Key))}}),Eo.$metadata$={kind:W,simpleName:"HttpRequest",interfaces:[b,we]},Object.defineProperty(Co.prototype,"headers",{get:function(){return this.headers_nor9ye$_0}}),Object.defineProperty(Co.prototype,"executionContext",{get:function(){return this.executionContext_h6ms6p$_0},set:function(t){this.executionContext_h6ms6p$_0=t}}),Co.prototype.url_6yzzjr$=function(t){t(this.url,this.url)},Co.prototype.build=function(){var t,n,i,r,o;if(t=this.url.build(),n=this.method,i=this.headers.build(),null==(o=e.isType(r=this.body,Jt)?r:null))throw w(("No request transformation found: "+this.body.toString()).toString());return new Po(t,n,i,o,this.executionContext,this.attributes)},Co.prototype.setAttributes_yhh5ns$=function(t){t(this.attributes)},Co.prototype.takeFrom_s9rlw$=function(t){var n;for(this.executionContext=t.executionContext,this.method=t.method,this.body=t.body,xe(this.url,t.url),this.url.encodedPath=oe(this.url.encodedPath)?"/":this.url.encodedPath,ke(this.headers,t.headers),n=t.attributes.allKeys.iterator();n.hasNext();){var i,r=n.next();this.attributes.put_uuntuo$(e.isType(i=r,d)?i:f(),t.attributes.get_yzaw86$(r))}return this},Co.prototype.setCapability_wfl2px$=function(t,e){this.attributes.computeIfAbsent_u4q9l2$(Nn,So).put_xwzc9p$(t,e)},Co.prototype.getCapabilityOrNull_i25mbv$=function(t){var n,i;return null==(i=null!=(n=this.attributes.getOrNull_yzaw86$(Nn))?n.get_11rb$(t):null)||e.isType(i,x)?i:f()},To.$metadata$={kind:O,simpleName:"Companion",interfaces:[]};var Oo=null;function No(){return null===Oo&&new To,Oo}function Po(t,e,n,i,r,o){var a,s;this.url=t,this.method=e,this.headers=n,this.body=i,this.executionContext=r,this.attributes=o,this.requiredCapabilities_8be2vx$=null!=(s=null!=(a=this.attributes.getOrNull_yzaw86$(Nn))?a.keys:null)?s:V()}function Ao(t,e,n,i,r,o){this.statusCode=t,this.requestTime=e,this.headers=n,this.version=i,this.body=r,this.callContext=o,this.responseTime=ie()}function jo(t){return u}function Lo(t,e,n,i,r,o){void 0===e&&(e="http"),void 0===n&&(n="localhost"),void 0===i&&(i=0),void 0===r&&(r="/"),void 0===o&&(o=jo);var a=t.url;a.protocol=ye.Companion.createOrDefault_61zpoe$(e),a.host=n,a.port=i,a.encodedPath=r,o(t.url)}function Ro(t){return e.isType(t.body,bo)}function Io(){Mo(),Se.call(this,[Mo().Before,Mo().State,Mo().Transform,Mo().Render,Mo().Send])}function zo(){Do=this,this.Before=new Ct("Before"),this.State=new Ct("State"),this.Transform=new Ct("Transform"),this.Render=new Ct("Render"),this.Send=new Ct("Send")}Co.$metadata$={kind:g,simpleName:"HttpRequestBuilder",interfaces:[Ee]},Po.prototype.getCapabilityOrNull_1sr7de$=function(t){var n,i;return null==(i=null!=(n=this.attributes.getOrNull_yzaw86$(Nn))?n.get_11rb$(t):null)||e.isType(i,x)?i:f()},Po.prototype.toString=function(){return"HttpRequestData(url="+this.url+", method="+this.method+")"},Po.$metadata$={kind:g,simpleName:"HttpRequestData",interfaces:[]},Ao.prototype.toString=function(){return"HttpResponseData=(statusCode="+this.statusCode+")"},Ao.$metadata$={kind:g,simpleName:"HttpResponseData",interfaces:[]},zo.$metadata$={kind:O,simpleName:"Phases",interfaces:[]};var Do=null;function Mo(){return null===Do&&new zo,Do}function Bo(){Go(),Se.call(this,[Go().Before,Go().State,Go().Monitoring,Go().Engine,Go().Receive])}function Uo(){qo=this,this.Before=new Ct("Before"),this.State=new Ct("State"),this.Monitoring=new Ct("Monitoring"),this.Engine=new Ct("Engine"),this.Receive=new Ct("Receive")}Io.$metadata$={kind:g,simpleName:"HttpRequestPipeline",interfaces:[Se]},Uo.$metadata$={kind:O,simpleName:"Phases",interfaces:[]};var Fo,qo=null;function Go(){return null===qo&&new Uo,qo}function Ho(t){lt.call(this),this.formData=t;var n=Te(this.formData);this.content_0=Fe(Nt.Charsets.UTF_8.newEncoder(),n,0,n.length),this.contentLength_f2tvnf$_0=e.Long.fromInt(this.content_0.length),this.contentType_gyve29$_0=Lt(at.Application.FormUrlEncoded,Nt.Charsets.UTF_8)}function Yo(t){Pe.call(this),this.boundary_0=function(){for(var t=Ft(),e=0;e<32;e++)t.append_gw00v9$(Me(De.Default.nextInt(),16));return Be(t.toString(),70)}();var n="--"+this.boundary_0+"\r\n";this.BOUNDARY_BYTES_0=Fe(Nt.Charsets.UTF_8.newEncoder(),n,0,n.length);var i="--"+this.boundary_0+"--\r\n\r\n";this.LAST_BOUNDARY_BYTES_0=Fe(Nt.Charsets.UTF_8.newEncoder(),i,0,i.length),this.BODY_OVERHEAD_SIZE_0=(2*Fo.length|0)+this.LAST_BOUNDARY_BYTES_0.length|0,this.PART_OVERHEAD_SIZE_0=(2*Fo.length|0)+this.BOUNDARY_BYTES_0.length|0;var r,o=se(qe(t,10));for(r=t.iterator();r.hasNext();){var a,s,l,u,c,p=r.next(),h=o.add_11rb$,_=Ae();for(s=p.headers.entries().iterator();s.hasNext();){var f=s.next(),d=f.key,m=f.value;je(_,d+": "+I(m,"; ")),Le(_,Fo)}var y=null!=(l=p.headers.get_61zpoe$(X.HttpHeaders.ContentLength))?ct(l):null;if(e.isType(p,Re)){var $=q(_.build()),v=null!=(u=null!=y?y.add(e.Long.fromInt(this.PART_OVERHEAD_SIZE_0)):null)?u.add(e.Long.fromInt($.length)):null;a=new Wo($,p.provider,v)}else if(e.isType(p,Ie)){var g=q(_.build()),b=null!=(c=null!=y?y.add(e.Long.fromInt(this.PART_OVERHEAD_SIZE_0)):null)?c.add(e.Long.fromInt(g.length)):null;a=new Wo(g,p.provider,b)}else if(e.isType(p,ze)){var w,x=Ae(0);try{je(x,p.value),w=x.build()}catch(t){throw e.isType(t,T)?(x.release(),t):t}var k=q(w),E=Ko(k);null==y&&(je(_,X.HttpHeaders.ContentLength+": "+k.length),Le(_,Fo));var C=q(_.build()),S=k.length+this.PART_OVERHEAD_SIZE_0+C.length|0;a=new Wo(C,E,e.Long.fromInt(S))}else a=e.noWhenBranchMatched();h.call(o,a)}this.rawParts_0=o,this.contentLength_egukxp$_0=null,this.contentType_azd2en$_0=at.MultiPart.FormData.withParameter_puj7f4$("boundary",this.boundary_0);var O,N=this.rawParts_0,P=ee;for(O=N.iterator();O.hasNext();){var A=P,j=O.next().size;P=null!=A&&null!=j?A.add(j):null}var L=P;null==L||nt(L,ee)||(L=L.add(e.Long.fromInt(this.BODY_OVERHEAD_SIZE_0))),this.contentLength_egukxp$_0=L}function Vo(t,e,n){_.call(this,n),this.exceptionState_0=18,this.$this=t,this.local$tmp$=void 0,this.local$part=void 0,this.local$$receiver=void 0,this.local$channel=e}function Ko(t){return function(){var n,i=Ae(0);try{Le(i,t),n=i.build()}catch(t){throw e.isType(t,T)?(i.release(),t):t}return n}}function Wo(t,e,n){this.headers=t,this.provider=e,this.size=n}function Xo(t,e,n,i){_.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$this$copyTo=t,this.local$size=void 0,this.local$$receiver=e}function Zo(t){return function(e,n,i){var r=new Xo(t,e,this,n);return i?r:r.doResume(null)}}function Jo(t,e,n){_.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$channel=e}function Qo(t){return t.url.port}function ta(t,n){var i,r;ea.call(this),this.call_9p3cfk$_0=t,this.coroutineContext_5l7f2v$_0=n.callContext,this.status_gsg6kc$_0=n.statusCode,this.version_vctfwy$_0=n.version,this.requestTime_34y64q$_0=n.requestTime,this.responseTime_u9wao0$_0=n.responseTime,this.content_7wqjir$_0=null!=(r=e.isType(i=n.body,E)?i:null)?r:E.Companion.Empty,this.headers_gyyq4g$_0=n.headers}function ea(){}function na(t){return t.call.request}function ia(t){var n;(e.isType(n=p(t.coroutineContext.get_j3r2sn$(c.Key)),y)?n:f()).complete()}function ra(){sa(),Se.call(this,[sa().Receive,sa().Parse,sa().Transform,sa().State,sa().After])}function oa(){aa=this,this.Receive=new Ct("Receive"),this.Parse=new Ct("Parse"),this.Transform=new Ct("Transform"),this.State=new Ct("State"),this.After=new Ct("After")}Bo.$metadata$={kind:g,simpleName:"HttpSendPipeline",interfaces:[Se]},N("ktor-ktor-client-core.io.ktor.client.request.request_ixrg4t$",P((function(){var n=t.io.ktor.client.request.HttpRequestBuilder,i=t.io.ktor.client.statement.HttpStatement,r=e.getReifiedTypeParameterKType,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,u=t.io.ktor.client.statement.complete_abn2de$,c=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,_,f,d){void 0===f&&(f=new n);var m,y,$,v=new i(f,_);if(m=o(t),s(m,o(i)))e.setCoroutineResult(h(y=v)?y:a(),e.coroutineReceiver());else if(s(m,o(l)))e.suspendCall(v.execute(e.coroutineReceiver())),e.setCoroutineResult(h($=e.coroutineResult(e.coroutineReceiver()))?$:a(),e.coroutineReceiver());else{e.suspendCall(v.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,x=g.call;t:do{try{w=new p(o(t),c.JsType,r(t))}catch(e){w=new p(o(t),c.JsType);break t}}while(0);e.suspendCall(x.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{u(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.request_g0tv8i$",P((function(){var n=t.io.ktor.client.request.HttpRequestBuilder,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,u=t.io.ktor.client.statement.complete_abn2de$,c=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,_,f,d){var m=new n;f(m);var y,$,v,g=new r(m,_);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h($=g)?$:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall(g.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall(g.executeUnsafe(e.coroutineReceiver()));var b=e.coroutineResult(e.coroutineReceiver());try{var w,x,k=b.call;t:do{try{x=new p(o(t),c.JsType,i(t))}catch(e){x=new p(o(t),c.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(x,e.coroutineReceiver())),e.setCoroutineResult(h(w=e.coroutineResult(e.coroutineReceiver()))?w:a(),e.coroutineReceiver())}finally{u(b)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.request_hf8dw$",P((function(){var n=e.kotlin.Unit,i=t.io.ktor.client.request.HttpRequestBuilder,r=t.io.ktor.client.request.url_g8iu3v$,o=e.getReifiedTypeParameterKType,a=t.io.ktor.client.statement.HttpStatement,s=e.getKClass,l=e.throwCCE,u=e.equals,c=t.io.ktor.client.statement.HttpResponse,p=t.io.ktor.client.statement.complete_abn2de$,h=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function f(t){return n}return function(t,n,d,m,y,$){void 0===y&&(y=f);var v=new i;r(v,m),y(v);var g,b,w,x=new a(v,d);if(g=s(t),u(g,s(a)))e.setCoroutineResult(n(b=x)?b:l(),e.coroutineReceiver());else if(u(g,s(c)))e.suspendCall(x.execute(e.coroutineReceiver())),e.setCoroutineResult(n(w=e.coroutineResult(e.coroutineReceiver()))?w:l(),e.coroutineReceiver());else{e.suspendCall(x.executeUnsafe(e.coroutineReceiver()));var k=e.coroutineResult(e.coroutineReceiver());try{var E,C,S=k.call;t:do{try{C=new _(s(t),h.JsType,o(t))}catch(e){C=new _(s(t),h.JsType);break t}}while(0);e.suspendCall(S.receive_jo9acv$(C,e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:l(),e.coroutineReceiver())}finally{p(k)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.request_2swosf$",P((function(){var n=e.kotlin.Unit,i=t.io.ktor.client.request.HttpRequestBuilder,r=t.io.ktor.client.request.url_qpqkqe$,o=e.getReifiedTypeParameterKType,a=t.io.ktor.client.statement.HttpStatement,s=e.getKClass,l=e.throwCCE,u=e.equals,c=t.io.ktor.client.statement.HttpResponse,p=t.io.ktor.client.statement.complete_abn2de$,h=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function f(t){return n}return function(t,n,d,m,y,$){void 0===y&&(y=f);var v=new i;r(v,m),y(v);var g,b,w,x=new a(v,d);if(g=s(t),u(g,s(a)))e.setCoroutineResult(n(b=x)?b:l(),e.coroutineReceiver());else if(u(g,s(c)))e.suspendCall(x.execute(e.coroutineReceiver())),e.setCoroutineResult(n(w=e.coroutineResult(e.coroutineReceiver()))?w:l(),e.coroutineReceiver());else{e.suspendCall(x.executeUnsafe(e.coroutineReceiver()));var k=e.coroutineResult(e.coroutineReceiver());try{var E,C,S=k.call;t:do{try{C=new _(s(t),h.JsType,o(t))}catch(e){C=new _(s(t),h.JsType);break t}}while(0);e.suspendCall(S.receive_jo9acv$(C,e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:l(),e.coroutineReceiver())}finally{p(k)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.get_ixrg4t$",P((function(){var n=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,u=t.io.ktor.client.statement.complete_abn2de$,c=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,_,f,d){f.method=n.Companion.Get;var m,y,$,v=new r(f,_);if(m=o(t),s(m,o(r)))e.setCoroutineResult(h(y=v)?y:a(),e.coroutineReceiver());else if(s(m,o(l)))e.suspendCall(v.execute(e.coroutineReceiver())),e.setCoroutineResult(h($=e.coroutineResult(e.coroutineReceiver()))?$:a(),e.coroutineReceiver());else{e.suspendCall(v.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,x=g.call;t:do{try{w=new p(o(t),c.JsType,i(t))}catch(e){w=new p(o(t),c.JsType);break t}}while(0);e.suspendCall(x.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{u(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.post_ixrg4t$",P((function(){var n=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,u=t.io.ktor.client.statement.complete_abn2de$,c=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,_,f,d){f.method=n.Companion.Post;var m,y,$,v=new r(f,_);if(m=o(t),s(m,o(r)))e.setCoroutineResult(h(y=v)?y:a(),e.coroutineReceiver());else if(s(m,o(l)))e.suspendCall(v.execute(e.coroutineReceiver())),e.setCoroutineResult(h($=e.coroutineResult(e.coroutineReceiver()))?$:a(),e.coroutineReceiver());else{e.suspendCall(v.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,x=g.call;t:do{try{w=new p(o(t),c.JsType,i(t))}catch(e){w=new p(o(t),c.JsType);break t}}while(0);e.suspendCall(x.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{u(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.put_ixrg4t$",P((function(){var n=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,u=t.io.ktor.client.statement.complete_abn2de$,c=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,_,f,d){f.method=n.Companion.Put;var m,y,$,v=new r(f,_);if(m=o(t),s(m,o(r)))e.setCoroutineResult(h(y=v)?y:a(),e.coroutineReceiver());else if(s(m,o(l)))e.suspendCall(v.execute(e.coroutineReceiver())),e.setCoroutineResult(h($=e.coroutineResult(e.coroutineReceiver()))?$:a(),e.coroutineReceiver());else{e.suspendCall(v.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,x=g.call;t:do{try{w=new p(o(t),c.JsType,i(t))}catch(e){w=new p(o(t),c.JsType);break t}}while(0);e.suspendCall(x.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{u(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.delete_ixrg4t$",P((function(){var n=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,u=t.io.ktor.client.statement.complete_abn2de$,c=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,_,f,d){f.method=n.Companion.Delete;var m,y,$,v=new r(f,_);if(m=o(t),s(m,o(r)))e.setCoroutineResult(h(y=v)?y:a(),e.coroutineReceiver());else if(s(m,o(l)))e.suspendCall(v.execute(e.coroutineReceiver())),e.setCoroutineResult(h($=e.coroutineResult(e.coroutineReceiver()))?$:a(),e.coroutineReceiver());else{e.suspendCall(v.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,x=g.call;t:do{try{w=new p(o(t),c.JsType,i(t))}catch(e){w=new p(o(t),c.JsType);break t}}while(0);e.suspendCall(x.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{u(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.options_ixrg4t$",P((function(){var n=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,u=t.io.ktor.client.statement.complete_abn2de$,c=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,_,f,d){f.method=n.Companion.Options;var m,y,$,v=new r(f,_);if(m=o(t),s(m,o(r)))e.setCoroutineResult(h(y=v)?y:a(),e.coroutineReceiver());else if(s(m,o(l)))e.suspendCall(v.execute(e.coroutineReceiver())),e.setCoroutineResult(h($=e.coroutineResult(e.coroutineReceiver()))?$:a(),e.coroutineReceiver());else{e.suspendCall(v.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,x=g.call;t:do{try{w=new p(o(t),c.JsType,i(t))}catch(e){w=new p(o(t),c.JsType);break t}}while(0);e.suspendCall(x.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{u(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.patch_ixrg4t$",P((function(){var n=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,u=t.io.ktor.client.statement.complete_abn2de$,c=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,_,f,d){f.method=n.Companion.Patch;var m,y,$,v=new r(f,_);if(m=o(t),s(m,o(r)))e.setCoroutineResult(h(y=v)?y:a(),e.coroutineReceiver());else if(s(m,o(l)))e.suspendCall(v.execute(e.coroutineReceiver())),e.setCoroutineResult(h($=e.coroutineResult(e.coroutineReceiver()))?$:a(),e.coroutineReceiver());else{e.suspendCall(v.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,x=g.call;t:do{try{w=new p(o(t),c.JsType,i(t))}catch(e){w=new p(o(t),c.JsType);break t}}while(0);e.suspendCall(x.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{u(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.head_ixrg4t$",P((function(){var n=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,u=t.io.ktor.client.statement.complete_abn2de$,c=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,_,f,d){f.method=n.Companion.Head;var m,y,$,v=new r(f,_);if(m=o(t),s(m,o(r)))e.setCoroutineResult(h(y=v)?y:a(),e.coroutineReceiver());else if(s(m,o(l)))e.suspendCall(v.execute(e.coroutineReceiver())),e.setCoroutineResult(h($=e.coroutineResult(e.coroutineReceiver()))?$:a(),e.coroutineReceiver());else{e.suspendCall(v.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,x=g.call;t:do{try{w=new p(o(t),c.JsType,i(t))}catch(e){w=new p(o(t),c.JsType);break t}}while(0);e.suspendCall(x.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{u(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.get_xwttm9$",P((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,c=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,_=t.io.ktor.client.statement.complete_abn2de$,f=t.io.ktor.client.call,d=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,y,$,v,g,b,w,x,k){void 0===$&&($="http"),void 0===v&&(v="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===x&&(x=m);var E=new s;r(E,$,v,g,b),E.method=o.Companion.Get,E.body=w,x(E);var C,S,T,O=new l(E,y);if(C=u(t),p(C,u(l)))e.setCoroutineResult(i(S=O)?S:c(),e.coroutineReceiver());else if(p(C,u(h)))e.suspendCall(O.execute(e.coroutineReceiver())),e.setCoroutineResult(i(T=e.coroutineResult(e.coroutineReceiver()))?T:c(),e.coroutineReceiver());else{e.suspendCall(O.executeUnsafe(e.coroutineReceiver()));var N=e.coroutineResult(e.coroutineReceiver());try{var P,A,j=N.call;t:do{try{A=new d(u(t),f.JsType,a(t))}catch(e){A=new d(u(t),f.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(A,e.coroutineReceiver())),e.setCoroutineResult(i(P=e.coroutineResult(e.coroutineReceiver()))?P:c(),e.coroutineReceiver())}finally{_(N)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.post_xwttm9$",P((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,c=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,_=t.io.ktor.client.statement.complete_abn2de$,f=t.io.ktor.client.call,d=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,y,$,v,g,b,w,x,k){void 0===$&&($="http"),void 0===v&&(v="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===x&&(x=m);var E=new s;r(E,$,v,g,b),E.method=o.Companion.Post,E.body=w,x(E);var C,S,T,O=new l(E,y);if(C=u(t),p(C,u(l)))e.setCoroutineResult(i(S=O)?S:c(),e.coroutineReceiver());else if(p(C,u(h)))e.suspendCall(O.execute(e.coroutineReceiver())),e.setCoroutineResult(i(T=e.coroutineResult(e.coroutineReceiver()))?T:c(),e.coroutineReceiver());else{e.suspendCall(O.executeUnsafe(e.coroutineReceiver()));var N=e.coroutineResult(e.coroutineReceiver());try{var P,A,j=N.call;t:do{try{A=new d(u(t),f.JsType,a(t))}catch(e){A=new d(u(t),f.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(A,e.coroutineReceiver())),e.setCoroutineResult(i(P=e.coroutineResult(e.coroutineReceiver()))?P:c(),e.coroutineReceiver())}finally{_(N)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.put_xwttm9$",P((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,c=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,_=t.io.ktor.client.statement.complete_abn2de$,f=t.io.ktor.client.call,d=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,y,$,v,g,b,w,x,k){void 0===$&&($="http"),void 0===v&&(v="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===x&&(x=m);var E=new s;r(E,$,v,g,b),E.method=o.Companion.Put,E.body=w,x(E);var C,S,T,O=new l(E,y);if(C=u(t),p(C,u(l)))e.setCoroutineResult(i(S=O)?S:c(),e.coroutineReceiver());else if(p(C,u(h)))e.suspendCall(O.execute(e.coroutineReceiver())),e.setCoroutineResult(i(T=e.coroutineResult(e.coroutineReceiver()))?T:c(),e.coroutineReceiver());else{e.suspendCall(O.executeUnsafe(e.coroutineReceiver()));var N=e.coroutineResult(e.coroutineReceiver());try{var P,A,j=N.call;t:do{try{A=new d(u(t),f.JsType,a(t))}catch(e){A=new d(u(t),f.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(A,e.coroutineReceiver())),e.setCoroutineResult(i(P=e.coroutineResult(e.coroutineReceiver()))?P:c(),e.coroutineReceiver())}finally{_(N)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.delete_xwttm9$",P((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,c=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,_=t.io.ktor.client.statement.complete_abn2de$,f=t.io.ktor.client.call,d=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,y,$,v,g,b,w,x,k){void 0===$&&($="http"),void 0===v&&(v="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===x&&(x=m);var E=new s;r(E,$,v,g,b),E.method=o.Companion.Delete,E.body=w,x(E);var C,S,T,O=new l(E,y);if(C=u(t),p(C,u(l)))e.setCoroutineResult(i(S=O)?S:c(),e.coroutineReceiver());else if(p(C,u(h)))e.suspendCall(O.execute(e.coroutineReceiver())),e.setCoroutineResult(i(T=e.coroutineResult(e.coroutineReceiver()))?T:c(),e.coroutineReceiver());else{e.suspendCall(O.executeUnsafe(e.coroutineReceiver()));var N=e.coroutineResult(e.coroutineReceiver());try{var P,A,j=N.call;t:do{try{A=new d(u(t),f.JsType,a(t))}catch(e){A=new d(u(t),f.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(A,e.coroutineReceiver())),e.setCoroutineResult(i(P=e.coroutineResult(e.coroutineReceiver()))?P:c(),e.coroutineReceiver())}finally{_(N)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.patch_xwttm9$",P((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,c=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,_=t.io.ktor.client.statement.complete_abn2de$,f=t.io.ktor.client.call,d=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,y,$,v,g,b,w,x,k){void 0===$&&($="http"),void 0===v&&(v="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===x&&(x=m);var E=new s;r(E,$,v,g,b),E.method=o.Companion.Patch,E.body=w,x(E);var C,S,T,O=new l(E,y);if(C=u(t),p(C,u(l)))e.setCoroutineResult(i(S=O)?S:c(),e.coroutineReceiver());else if(p(C,u(h)))e.suspendCall(O.execute(e.coroutineReceiver())),e.setCoroutineResult(i(T=e.coroutineResult(e.coroutineReceiver()))?T:c(),e.coroutineReceiver());else{e.suspendCall(O.executeUnsafe(e.coroutineReceiver()));var N=e.coroutineResult(e.coroutineReceiver());try{var P,A,j=N.call;t:do{try{A=new d(u(t),f.JsType,a(t))}catch(e){A=new d(u(t),f.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(A,e.coroutineReceiver())),e.setCoroutineResult(i(P=e.coroutineResult(e.coroutineReceiver()))?P:c(),e.coroutineReceiver())}finally{_(N)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.head_xwttm9$",P((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,c=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,_=t.io.ktor.client.statement.complete_abn2de$,f=t.io.ktor.client.call,d=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,y,$,v,g,b,w,x,k){void 0===$&&($="http"),void 0===v&&(v="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===x&&(x=m);var E=new s;r(E,$,v,g,b),E.method=o.Companion.Head,E.body=w,x(E);var C,S,T,O=new l(E,y);if(C=u(t),p(C,u(l)))e.setCoroutineResult(i(S=O)?S:c(),e.coroutineReceiver());else if(p(C,u(h)))e.suspendCall(O.execute(e.coroutineReceiver())),e.setCoroutineResult(i(T=e.coroutineResult(e.coroutineReceiver()))?T:c(),e.coroutineReceiver());else{e.suspendCall(O.executeUnsafe(e.coroutineReceiver()));var N=e.coroutineResult(e.coroutineReceiver());try{var P,A,j=N.call;t:do{try{A=new d(u(t),f.JsType,a(t))}catch(e){A=new d(u(t),f.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(A,e.coroutineReceiver())),e.setCoroutineResult(i(P=e.coroutineResult(e.coroutineReceiver()))?P:c(),e.coroutineReceiver())}finally{_(N)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.options_xwttm9$",P((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,c=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,_=t.io.ktor.client.statement.complete_abn2de$,f=t.io.ktor.client.call,d=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,y,$,v,g,b,w,x,k){void 0===$&&($="http"),void 0===v&&(v="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===x&&(x=m);var E=new s;r(E,$,v,g,b),E.method=o.Companion.Options,E.body=w,x(E);var C,S,T,O=new l(E,y);if(C=u(t),p(C,u(l)))e.setCoroutineResult(i(S=O)?S:c(),e.coroutineReceiver());else if(p(C,u(h)))e.suspendCall(O.execute(e.coroutineReceiver())),e.setCoroutineResult(i(T=e.coroutineResult(e.coroutineReceiver()))?T:c(),e.coroutineReceiver());else{e.suspendCall(O.executeUnsafe(e.coroutineReceiver()));var N=e.coroutineResult(e.coroutineReceiver());try{var P,A,j=N.call;t:do{try{A=new d(u(t),f.JsType,a(t))}catch(e){A=new d(u(t),f.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(A,e.coroutineReceiver())),e.setCoroutineResult(i(P=e.coroutineResult(e.coroutineReceiver()))?P:c(),e.coroutineReceiver())}finally{_(N)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.get_hf8dw$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Get,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.post_hf8dw$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Post,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.put_hf8dw$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Put,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.delete_hf8dw$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Delete,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.options_hf8dw$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Options,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.patch_hf8dw$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Patch,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.head_hf8dw$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Head,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.get_2swosf$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Get,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.post_2swosf$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Post,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.put_2swosf$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Put,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.patch_2swosf$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Patch,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.options_2swosf$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Options,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.head_2swosf$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Head,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.delete_2swosf$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,$,v,g,b){var w;void 0===g&&(g=y),w=o.EmptyContent;var x=new l;a(x,"http","localhost",0,"/"),x.method=s.Companion.Delete,x.body=w,i(x.url,v),g(x);var k,E,C,S=new u(x,$);if(k=c(t),h(k,c(u)))e.setCoroutineResult(n(E=S)?E:p(),e.coroutineReceiver());else if(h(k,c(_)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var O,N,P=T.call;t:do{try{N=new m(c(t),d.JsType,r(t))}catch(e){N=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver())}finally{f(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),Object.defineProperty(Ho.prototype,"contentLength",{get:function(){return this.contentLength_f2tvnf$_0}}),Object.defineProperty(Ho.prototype,"contentType",{get:function(){return this.contentType_gyve29$_0}}),Ho.prototype.bytes=function(){return this.content_0},Ho.$metadata$={kind:g,simpleName:"FormDataContent",interfaces:[lt]},Object.defineProperty(Yo.prototype,"contentLength",{get:function(){return this.contentLength_egukxp$_0}}),Object.defineProperty(Yo.prototype,"contentType",{get:function(){return this.contentType_azd2en$_0}}),Vo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Vo.prototype=Object.create(_.prototype),Vo.prototype.constructor=Vo,Vo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=14,this.$this.rawParts_0.isEmpty()){this.exceptionState_0=18,this.finallyPath_0=[1],this.state_0=17;continue}this.state_0=2;continue;case 1:return;case 2:if(this.state_0=3,this.result_0=Oe(this.local$channel,Fo,this),this.result_0===h)return h;continue;case 3:if(this.state_0=4,this.result_0=Oe(this.local$channel,Fo,this),this.result_0===h)return h;continue;case 4:this.local$tmp$=this.$this.rawParts_0.iterator(),this.state_0=5;continue;case 5:if(!this.local$tmp$.hasNext()){this.state_0=15;continue}if(this.local$part=this.local$tmp$.next(),this.state_0=6,this.result_0=Oe(this.local$channel,this.$this.BOUNDARY_BYTES_0,this),this.result_0===h)return h;continue;case 6:if(this.state_0=7,this.result_0=Oe(this.local$channel,this.local$part.headers,this),this.result_0===h)return h;continue;case 7:if(this.state_0=8,this.result_0=Oe(this.local$channel,Fo,this),this.result_0===h)return h;continue;case 8:if(this.local$$receiver=this.local$part.provider(),this.exceptionState_0=12,this.state_0=9,this.result_0=(n=this.local$$receiver,i=this.local$channel,r=void 0,o=void 0,o=new Jo(n,i,this),r?o:o.doResume(null)),this.result_0===h)return h;continue;case 9:this.exceptionState_0=14,this.finallyPath_0=[10],this.state_0=13;continue;case 10:if(this.state_0=11,this.result_0=Oe(this.local$channel,Fo,this),this.result_0===h)return h;continue;case 11:this.state_0=5;continue;case 12:this.finallyPath_0=[14],this.state_0=13;continue;case 13:this.exceptionState_0=14,this.local$$receiver.close(),this.state_0=this.finallyPath_0.shift();continue;case 14:this.finallyPath_0=[18],this.exceptionState_0=17;var t=this.exception_0;if(!e.isType(t,T))throw t;this.local$channel.close_dbl4no$(t),this.finallyPath_0=[19],this.state_0=17;continue;case 15:if(this.state_0=16,this.result_0=Oe(this.local$channel,this.$this.LAST_BOUNDARY_BYTES_0,this),this.result_0===h)return h;continue;case 16:this.exceptionState_0=18,this.finallyPath_0=[19],this.state_0=17;continue;case 17:this.exceptionState_0=18,Ne(this.local$channel),this.state_0=this.finallyPath_0.shift();continue;case 18:throw this.exception_0;case 19:return;default:throw this.state_0=18,new Error("State Machine Unreachable execution")}}catch(t){if(18===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var n,i,r,o},Yo.prototype.writeTo_h3x4ir$=function(t,e,n){var i=new Vo(this,t,e);return n?i:i.doResume(null)},Yo.$metadata$={kind:g,simpleName:"MultiPartFormDataContent",interfaces:[Pe]},Wo.$metadata$={kind:g,simpleName:"PreparedPart",interfaces:[]},Xo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Xo.prototype=Object.create(_.prototype),Xo.prototype.constructor=Xo,Xo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$this$copyTo.endOfInput){this.state_0=5;continue}if(this.state_0=3,this.result_0=this.local$$receiver.tryAwait_za3lpa$(1,this),this.result_0===h)return h;continue;case 3:var t=p(this.local$$receiver.request_za3lpa$(1));if(this.local$size=Ue(this.local$this$copyTo,t),this.local$size<0){this.state_0=2;continue}this.state_0=4;continue;case 4:this.local$$receiver.written_za3lpa$(this.local$size),this.state_0=2;continue;case 5:return u;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Jo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Jo.prototype=Object.create(_.prototype),Jo.prototype.constructor=Jo,Jo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(e.isType(this.local$$receiver,mt)){if(this.state_0=2,this.result_0=this.local$channel.writePacket_3uq2w4$(this.local$$receiver,this),this.result_0===h)return h;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:return;case 3:if(this.state_0=4,this.result_0=this.local$channel.writeSuspendSession_8dv01$(Zo(this.local$$receiver),this),this.result_0===h)return h;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},N("ktor-ktor-client-core.io.ktor.client.request.forms.submitForm_k24olv$",P((function(){var n=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.Parameters,i=e.kotlin.Unit,r=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,o=t.io.ktor.client.request.forms.FormDataContent,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,c=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,_=t.io.ktor.client.statement.complete_abn2de$,f=t.io.ktor.client.call,d=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,y,$,v,g,b){void 0===$&&($=n.Companion.Empty),void 0===v&&(v=!1),void 0===g&&(g=m);var w=new s;v?(w.method=r.Companion.Get,w.url.parameters.appendAll_hb0ubp$($)):(w.method=r.Companion.Post,w.body=new o($)),g(w);var x,k,E,C=new l(w,y);if(x=u(t),p(x,u(l)))e.setCoroutineResult(i(k=C)?k:c(),e.coroutineReceiver());else if(p(x,u(h)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(i(E=e.coroutineResult(e.coroutineReceiver()))?E:c(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var S=e.coroutineResult(e.coroutineReceiver());try{var T,O,N=S.call;t:do{try{O=new d(u(t),f.JsType,a(t))}catch(e){O=new d(u(t),f.JsType);break t}}while(0);e.suspendCall(N.receive_jo9acv$(O,e.coroutineReceiver())),e.setCoroutineResult(i(T=e.coroutineResult(e.coroutineReceiver()))?T:c(),e.coroutineReceiver())}finally{_(S)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.forms.submitForm_32veqj$",P((function(){var n=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.Parameters,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_g8iu3v$,o=e.getReifiedTypeParameterKType,a=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,s=t.io.ktor.client.request.forms.FormDataContent,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,$,v,g,b,w,x){void 0===g&&(g=n.Companion.Empty),void 0===b&&(b=!1),void 0===w&&(w=y);var k=new l;b?(k.method=a.Companion.Get,k.url.parameters.appendAll_hb0ubp$(g)):(k.method=a.Companion.Post,k.body=new s(g)),r(k,v),w(k);var E,C,S,T=new u(k,$);if(E=c(t),h(E,c(u)))e.setCoroutineResult(i(C=T)?C:p(),e.coroutineReceiver());else if(h(E,c(_)))e.suspendCall(T.execute(e.coroutineReceiver())),e.setCoroutineResult(i(S=e.coroutineResult(e.coroutineReceiver()))?S:p(),e.coroutineReceiver());else{e.suspendCall(T.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,P,A=O.call;t:do{try{P=new m(c(t),d.JsType,o(t))}catch(e){P=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(A.receive_jo9acv$(P,e.coroutineReceiver())),e.setCoroutineResult(i(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{f(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.forms.submitFormWithBinaryData_k1tmp5$",P((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,r=t.io.ktor.client.request.forms.MultiPartFormDataContent,o=e.getReifiedTypeParameterKType,a=t.io.ktor.client.request.HttpRequestBuilder,s=t.io.ktor.client.statement.HttpStatement,l=e.getKClass,u=e.throwCCE,c=e.equals,p=t.io.ktor.client.statement.HttpResponse,h=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,f=t.io.ktor.client.call.TypeInfo;function d(t){return n}return function(t,n,m,y,$,v){void 0===$&&($=d);var g=new a;g.method=i.Companion.Post,g.body=new r(y),$(g);var b,w,x,k=new s(g,m);if(b=l(t),c(b,l(s)))e.setCoroutineResult(n(w=k)?w:u(),e.coroutineReceiver());else if(c(b,l(p)))e.suspendCall(k.execute(e.coroutineReceiver())),e.setCoroutineResult(n(x=e.coroutineResult(e.coroutineReceiver()))?x:u(),e.coroutineReceiver());else{e.suspendCall(k.executeUnsafe(e.coroutineReceiver()));var E=e.coroutineResult(e.coroutineReceiver());try{var C,S,T=E.call;t:do{try{S=new f(l(t),_.JsType,o(t))}catch(e){S=new f(l(t),_.JsType);break t}}while(0);e.suspendCall(T.receive_jo9acv$(S,e.coroutineReceiver())),e.setCoroutineResult(n(C=e.coroutineResult(e.coroutineReceiver()))?C:u(),e.coroutineReceiver())}finally{h(E)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.forms.submitFormWithBinaryData_i2k1l1$",P((function(){var n=e.kotlin.Unit,i=t.io.ktor.client.request.url_g8iu3v$,r=e.getReifiedTypeParameterKType,o=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,a=t.io.ktor.client.request.forms.MultiPartFormDataContent,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,c=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,_=t.io.ktor.client.statement.complete_abn2de$,f=t.io.ktor.client.call,d=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,y,$,v,g,b){void 0===g&&(g=m);var w=new s;w.method=o.Companion.Post,w.body=new a(v),i(w,$),g(w);var x,k,E,C=new l(w,y);if(x=u(t),p(x,u(l)))e.setCoroutineResult(n(k=C)?k:c(),e.coroutineReceiver());else if(p(x,u(h)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:c(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var S=e.coroutineResult(e.coroutineReceiver());try{var T,O,N=S.call;t:do{try{O=new d(u(t),f.JsType,r(t))}catch(e){O=new d(u(t),f.JsType);break t}}while(0);e.suspendCall(N.receive_jo9acv$(O,e.coroutineReceiver())),e.setCoroutineResult(n(T=e.coroutineResult(e.coroutineReceiver()))?T:c(),e.coroutineReceiver())}finally{_(S)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.forms.submitForm_ejo4ot$",P((function(){var n=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.Parameters,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=e.getReifiedTypeParameterKType,a=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,s=t.io.ktor.client.request.forms.FormDataContent,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,$,v,g,b,w,x,k,E,C){void 0===v&&(v="http"),void 0===g&&(g="localhost"),void 0===b&&(b=80),void 0===w&&(w="/"),void 0===x&&(x=n.Companion.Empty),void 0===k&&(k=!1),void 0===E&&(E=y);var S=new l;k?(S.method=a.Companion.Get,S.url.parameters.appendAll_hb0ubp$(x)):(S.method=a.Companion.Post,S.body=new s(x)),r(S,v,g,b,w),E(S);var T,O,N,P=new u(S,$);if(T=c(t),h(T,c(u)))e.setCoroutineResult(i(O=P)?O:p(),e.coroutineReceiver());else if(h(T,c(_)))e.suspendCall(P.execute(e.coroutineReceiver())),e.setCoroutineResult(i(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver());else{e.suspendCall(P.executeUnsafe(e.coroutineReceiver()));var A=e.coroutineResult(e.coroutineReceiver());try{var j,L,R=A.call;t:do{try{L=new m(c(t),d.JsType,o(t))}catch(e){L=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(R.receive_jo9acv$(L,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:p(),e.coroutineReceiver())}finally{f(A)}}return e.coroutineResult(e.coroutineReceiver())}}))),N("ktor-ktor-client-core.io.ktor.client.request.forms.submitFormWithBinaryData_vcnbbn$",P((function(){var n=e.kotlin.collections.emptyList_287e2$,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=e.getReifiedTypeParameterKType,a=t.$$importsForInline$$["ktor-ktor-http"].io.ktor.http.HttpMethod,s=t.io.ktor.client.request.forms.MultiPartFormDataContent,l=t.io.ktor.client.request.HttpRequestBuilder,u=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,p=e.throwCCE,h=e.equals,_=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,m=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,$,v,g,b,w,x,k,E){void 0===v&&(v="http"),void 0===g&&(g="localhost"),void 0===b&&(b=80),void 0===w&&(w="/"),void 0===x&&(x=n()),void 0===k&&(k=y);var C=new l;C.method=a.Companion.Post,C.body=new s(x),r(C,v,g,b,w),k(C);var S,T,O,N=new u(C,$);if(S=c(t),h(S,c(u)))e.setCoroutineResult(i(T=N)?T:p(),e.coroutineReceiver());else if(h(S,c(_)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:p(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var P=e.coroutineResult(e.coroutineReceiver());try{var A,j,L=P.call;t:do{try{j=new m(c(t),d.JsType,o(t))}catch(e){j=new m(c(t),d.JsType);break t}}while(0);e.suspendCall(L.receive_jo9acv$(j,e.coroutineReceiver())),e.setCoroutineResult(i(A=e.coroutineResult(e.coroutineReceiver()))?A:p(),e.coroutineReceiver())}finally{f(P)}}return e.coroutineResult(e.coroutineReceiver())}}))),Object.defineProperty(ta.prototype,"call",{get:function(){return this.call_9p3cfk$_0}}),Object.defineProperty(ta.prototype,"coroutineContext",{get:function(){return this.coroutineContext_5l7f2v$_0}}),Object.defineProperty(ta.prototype,"status",{get:function(){return this.status_gsg6kc$_0}}),Object.defineProperty(ta.prototype,"version",{get:function(){return this.version_vctfwy$_0}}),Object.defineProperty(ta.prototype,"requestTime",{get:function(){return this.requestTime_34y64q$_0}}),Object.defineProperty(ta.prototype,"responseTime",{get:function(){return this.responseTime_u9wao0$_0}}),Object.defineProperty(ta.prototype,"content",{get:function(){return this.content_7wqjir$_0}}),Object.defineProperty(ta.prototype,"headers",{get:function(){return this.headers_gyyq4g$_0}}),ta.$metadata$={kind:g,simpleName:"DefaultHttpResponse",interfaces:[ea]},ea.prototype.toString=function(){return"HttpResponse["+na(this).url+", "+this.status+"]"},ea.$metadata$={kind:g,simpleName:"HttpResponse",interfaces:[b,we]},oa.$metadata$={kind:O,simpleName:"Phases",interfaces:[]};var aa=null;function sa(){return null===aa&&new oa,aa}function la(){_a(),Se.call(this,[_a().Before,_a().State,_a().After])}function ua(){ha=this,this.Before=new Ct("Before"),this.State=new Ct("State"),this.After=new Ct("After")}ra.$metadata$={kind:g,simpleName:"HttpResponsePipeline",interfaces:[Se]},ua.$metadata$={kind:O,simpleName:"Phases",interfaces:[]};var ca,pa,ha=null;function _a(){return null===ha&&new ua,ha}function fa(t,e){this.expectedType=t,this.response=e}function da(t,e){this.builder_0=t,this.client_0=e,this.checkCapabilities_0()}function ma(t,e,n){_.call(this,n),this.exceptionState_0=8,this.$this=t,this.local$response=void 0,this.local$block=e}function ya(t,e){_.call(this,e),this.exceptionState_0=1,this.local$it=t}function $a(t,e,n){var i=new ya(t,e);return n?i:i.doResume(null)}function va(t,e,n,i){_.call(this,i),this.exceptionState_0=7,this.$this=t,this.local$response=void 0,this.local$T_0=e,this.local$isT=n}function ga(t,e,n,i,r){_.call(this,r),this.exceptionState_0=9,this.$this=t,this.local$response=void 0,this.local$T_0=e,this.local$isT=n,this.local$block=i}function ba(t,e){_.call(this,e),this.exceptionState_0=1,this.$this=t}function wa(t,e,n){_.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$$receiver=e}function xa(){ka=this,ne.call(this),this.contentLength_89rfwp$_0=ee}la.$metadata$={kind:g,simpleName:"HttpReceivePipeline",interfaces:[Se]},fa.$metadata$={kind:g,simpleName:"HttpResponseContainer",interfaces:[]},fa.prototype.component1=function(){return this.expectedType},fa.prototype.component2=function(){return this.response},fa.prototype.copy_ju9ok$=function(t,e){return new fa(void 0===t?this.expectedType:t,void 0===e?this.response:e)},fa.prototype.toString=function(){return"HttpResponseContainer(expectedType="+e.toString(this.expectedType)+", response="+e.toString(this.response)+")"},fa.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.expectedType)|0)+e.hashCode(this.response)|0},fa.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.expectedType,t.expectedType)&&e.equals(this.response,t.response)},ma.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ma.prototype=Object.create(_.prototype),ma.prototype.constructor=ma,ma.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=1,this.result_0=this.$this.executeUnsafe(this),this.result_0===h)return h;continue;case 1:if(this.local$response=this.result_0,this.exceptionState_0=5,this.state_0=2,this.result_0=this.local$block(this.local$response,this),this.result_0===h)return h;continue;case 2:this.exceptionState_0=8,this.finallyPath_0=[3],this.state_0=6,this.$returnValue=this.result_0;continue;case 3:return this.$returnValue;case 4:return;case 5:this.finallyPath_0=[8],this.state_0=6;continue;case 6:if(this.exceptionState_0=8,this.state_0=7,this.result_0=this.$this.cleanup_abn2de$(this.local$response,this),this.result_0===h)return h;continue;case 7:this.state_0=this.finallyPath_0.shift();continue;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},da.prototype.execute_2rh6on$=function(t,e,n){var i=new ma(this,t,e);return n?i:i.doResume(null)},ya.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ya.prototype=Object.create(_.prototype),ya.prototype.constructor=ya,ya.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Hn(this.local$it.call,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return this.result_0.response;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},da.prototype.execute=function(t){return this.execute_2rh6on$($a,t)},va.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},va.prototype=Object.create(_.prototype),va.prototype.constructor=va,va.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e,n;if(t=B(this.local$T_0),nt(t,B(da)))return this.local$isT(e=this.$this)?e:f();if(nt(t,B(ea))){if(this.state_0=8,this.result_0=this.$this.execute(this),this.result_0===h)return h;continue}if(this.state_0=1,this.result_0=this.$this.executeUnsafe(this),this.result_0===h)return h;continue;case 1:var i;this.local$response=this.result_0,this.exceptionState_0=5;var r,o=this.local$response.call;t:do{try{r=new Yn(B(this.local$T_0),js.JsType,M(this.local$T_0))}catch(t){r=new Yn(B(this.local$T_0),js.JsType);break t}}while(0);if(this.state_0=2,this.result_0=o.receive_jo9acv$(r,this),this.result_0===h)return h;continue;case 2:this.result_0=this.local$isT(i=this.result_0)?i:f(),this.exceptionState_0=7,this.finallyPath_0=[3],this.state_0=6,this.$returnValue=this.result_0;continue;case 3:return this.$returnValue;case 4:this.state_0=9;continue;case 5:this.finallyPath_0=[7],this.state_0=6;continue;case 6:this.exceptionState_0=7,ia(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 7:throw this.exception_0;case 8:return this.local$isT(n=this.result_0)?n:f();case 9:this.state_0=10;continue;case 10:return;default:throw this.state_0=7,new Error("State Machine Unreachable execution")}}catch(t){if(7===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},da.prototype.receive_287e2$=function(t,e,n,i){var r=new va(this,t,e,n);return i?r:r.doResume(null)},N("ktor-ktor-client-core.io.ktor.client.statement.HttpStatement.receive_287e2$",P((function(){var n=e.getKClass,i=e.throwCCE,r=t.io.ktor.client.statement.HttpStatement,o=e.equals,a=t.io.ktor.client.statement.HttpResponse,s=e.getReifiedTypeParameterKType,l=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,c=t.io.ktor.client.call.TypeInfo;return function(t,p,h){var _,f;if(_=n(t),o(_,n(r)))return p(this)?this:i();if(o(_,n(a)))return e.suspendCall(this.execute(e.coroutineReceiver())),p(f=e.coroutineResult(e.coroutineReceiver()))?f:i();e.suspendCall(this.executeUnsafe(e.coroutineReceiver()));var d=e.coroutineResult(e.coroutineReceiver());try{var m,y,$=d.call;t:do{try{y=new c(n(t),u.JsType,s(t))}catch(e){y=new c(n(t),u.JsType);break t}}while(0);return e.suspendCall($.receive_jo9acv$(y,e.coroutineReceiver())),e.setCoroutineResult(p(m=e.coroutineResult(e.coroutineReceiver()))?m:i(),e.coroutineReceiver()),e.coroutineResult(e.coroutineReceiver())}finally{l(d)}}}))),ga.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ga.prototype=Object.create(_.prototype),ga.prototype.constructor=ga,ga.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=1,this.result_0=this.$this.executeUnsafe(this),this.result_0===h)return h;continue;case 1:var t;this.local$response=this.result_0,this.exceptionState_0=6;var e,n=this.local$response.call;t:do{try{e=new Yn(B(this.local$T_0),js.JsType,M(this.local$T_0))}catch(t){e=new Yn(B(this.local$T_0),js.JsType);break t}}while(0);if(this.state_0=2,this.result_0=n.receive_jo9acv$(e,this),this.result_0===h)return h;continue;case 2:this.result_0=this.local$isT(t=this.result_0)?t:f();var i=this.result_0;if(this.state_0=3,this.result_0=this.local$block(i,this),this.result_0===h)return h;continue;case 3:this.exceptionState_0=9,this.finallyPath_0=[4],this.state_0=7,this.$returnValue=this.result_0;continue;case 4:return this.$returnValue;case 5:return;case 6:this.finallyPath_0=[9],this.state_0=7;continue;case 7:if(this.exceptionState_0=9,this.state_0=8,this.result_0=this.$this.cleanup_abn2de$(this.local$response,this),this.result_0===h)return h;continue;case 8:this.state_0=this.finallyPath_0.shift();continue;case 9:throw this.exception_0;default:throw this.state_0=9,new Error("State Machine Unreachable execution")}}catch(t){if(9===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},da.prototype.receive_yswr0a$=function(t,e,n,i,r){var o=new ga(this,t,e,n,i);return r?o:o.doResume(null)},N("ktor-ktor-client-core.io.ktor.client.statement.HttpStatement.receive_yswr0a$",P((function(){var n=e.getReifiedTypeParameterKType,i=e.throwCCE,r=e.getKClass,o=t.io.ktor.client.call,a=t.io.ktor.client.call.TypeInfo;return function(t,s,l,u){e.suspendCall(this.executeUnsafe(e.coroutineReceiver()));var c=e.coroutineResult(e.coroutineReceiver());try{var p,h,_=c.call;t:do{try{h=new a(r(t),o.JsType,n(t))}catch(e){h=new a(r(t),o.JsType);break t}}while(0);e.suspendCall(_.receive_jo9acv$(h,e.coroutineReceiver())),e.setCoroutineResult(s(p=e.coroutineResult(e.coroutineReceiver()))?p:i(),e.coroutineReceiver());var f=e.coroutineResult(e.coroutineReceiver());return e.suspendCall(l(f,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}finally{e.suspendCall(this.cleanup_abn2de$(c,e.coroutineReceiver()))}}}))),ba.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ba.prototype=Object.create(_.prototype),ba.prototype.constructor=ba,ba.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=(new Co).takeFrom_s9rlw$(this.$this.builder_0);if(this.state_0=2,this.result_0=this.$this.client_0.execute_s9rlw$(t,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return this.result_0.response;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},da.prototype.executeUnsafe=function(t,e){var n=new ba(this,t);return e?n:n.doResume(null)},wa.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},wa.prototype=Object.create(_.prototype),wa.prototype.constructor=wa,wa.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=e.isType(t=p(this.local$$receiver.coroutineContext.get_j3r2sn$(c.Key)),y)?t:f();n.complete();try{ht(this.local$$receiver.content)}catch(t){if(!e.isType(t,T))throw t}if(this.state_0=2,this.result_0=n.join(this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},da.prototype.cleanup_abn2de$=function(t,e,n){var i=new wa(this,t,e);return n?i:i.doResume(null)},da.prototype.checkCapabilities_0=function(){var t,n,i,r,o;if(null!=(n=null!=(t=this.builder_0.attributes.getOrNull_yzaw86$(Nn))?t.keys:null)){var a,s=St();for(a=n.iterator();a.hasNext();){var l=a.next();e.isType(l,Wi)&&s.add_11rb$(l)}r=s}else r=null;if(null!=(i=r))for(o=i.iterator();o.hasNext();){var u,c=o.next();if(null==Zi(this.client_0,e.isType(u=c,Wi)?u:f()))throw G(("Consider installing "+c+" feature because the request requires it to be installed").toString())}},da.prototype.toString=function(){return"HttpStatement["+this.builder_0.url.buildString()+"]"},da.$metadata$={kind:g,simpleName:"HttpStatement",interfaces:[]},Object.defineProperty(xa.prototype,"contentLength",{get:function(){return this.contentLength_89rfwp$_0}}),xa.prototype.toString=function(){return"EmptyContent"},xa.$metadata$={kind:O,simpleName:"EmptyContent",interfaces:[ne]};var ka=null;function Ea(){return null===ka&&new xa,ka}function Ca(t,e){this.this$wrapHeaders=t,ne.call(this),this.headers_byaa2p$_0=e(t.headers)}function Sa(t,e){this.this$wrapHeaders=t,ut.call(this),this.headers_byaa2p$_0=e(t.headers)}function Ta(t,e){this.this$wrapHeaders=t,Pe.call(this),this.headers_byaa2p$_0=e(t.headers)}function Oa(t,e){this.this$wrapHeaders=t,lt.call(this),this.headers_byaa2p$_0=e(t.headers)}function Na(t,e){this.this$wrapHeaders=t,He.call(this),this.headers_byaa2p$_0=e(t.headers)}function Pa(){Aa=this,this.MAX_AGE="max-age",this.MIN_FRESH="min-fresh",this.ONLY_IF_CACHED="only-if-cached",this.MAX_STALE="max-stale",this.NO_CACHE="no-cache",this.NO_STORE="no-store",this.NO_TRANSFORM="no-transform",this.MUST_REVALIDATE="must-revalidate",this.PUBLIC="public",this.PRIVATE="private",this.PROXY_REVALIDATE="proxy-revalidate",this.S_MAX_AGE="s-maxage"}Object.defineProperty(Ca.prototype,"contentLength",{get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(Ca.prototype,"contentType",{get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(Ca.prototype,"status",{get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(Ca.prototype,"headers",{get:function(){return this.headers_byaa2p$_0}}),Ca.$metadata$={kind:g,interfaces:[ne]},Object.defineProperty(Sa.prototype,"contentLength",{get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(Sa.prototype,"contentType",{get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(Sa.prototype,"status",{get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(Sa.prototype,"headers",{get:function(){return this.headers_byaa2p$_0}}),Sa.prototype.readFrom=function(){return this.this$wrapHeaders.readFrom()},Sa.prototype.readFrom_6z6t3e$=function(t){return this.this$wrapHeaders.readFrom_6z6t3e$(t)},Sa.$metadata$={kind:g,interfaces:[ut]},Object.defineProperty(Ta.prototype,"contentLength",{get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(Ta.prototype,"contentType",{get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(Ta.prototype,"status",{get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(Ta.prototype,"headers",{get:function(){return this.headers_byaa2p$_0}}),Ta.prototype.writeTo_h3x4ir$=function(t,e){return this.this$wrapHeaders.writeTo_h3x4ir$(t,e)},Ta.$metadata$={kind:g,interfaces:[Pe]},Object.defineProperty(Oa.prototype,"contentLength",{get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(Oa.prototype,"contentType",{get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(Oa.prototype,"status",{get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(Oa.prototype,"headers",{get:function(){return this.headers_byaa2p$_0}}),Oa.prototype.bytes=function(){return this.this$wrapHeaders.bytes()},Oa.$metadata$={kind:g,interfaces:[lt]},Object.defineProperty(Na.prototype,"contentLength",{get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(Na.prototype,"contentType",{get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(Na.prototype,"headers",{get:function(){return this.headers_byaa2p$_0}}),Na.prototype.upgrade_h1mv0l$=function(t,e,n,i,r){return this.this$wrapHeaders.upgrade_h1mv0l$(t,e,n,i,r)},Na.$metadata$={kind:g,interfaces:[He]},Pa.prototype.getMAX_AGE=function(){return this.MAX_AGE},Pa.prototype.getMIN_FRESH=function(){return this.MIN_FRESH},Pa.prototype.getONLY_IF_CACHED=function(){return this.ONLY_IF_CACHED},Pa.prototype.getMAX_STALE=function(){return this.MAX_STALE},Pa.prototype.getNO_CACHE=function(){return this.NO_CACHE},Pa.prototype.getNO_STORE=function(){return this.NO_STORE},Pa.prototype.getNO_TRANSFORM=function(){return this.NO_TRANSFORM},Pa.prototype.getMUST_REVALIDATE=function(){return this.MUST_REVALIDATE},Pa.prototype.getPUBLIC=function(){return this.PUBLIC},Pa.prototype.getPRIVATE=function(){return this.PRIVATE},Pa.prototype.getPROXY_REVALIDATE=function(){return this.PROXY_REVALIDATE},Pa.prototype.getS_MAX_AGE=function(){return this.S_MAX_AGE},Pa.$metadata$={kind:O,simpleName:"CacheControl",interfaces:[]};var Aa=null;function ja(t){return u}function La(t){void 0===t&&(t=ja);var e=new re;return t(e),e.build()}function Ra(t){return u}function Ia(){}function za(){Da=this}Ia.$metadata$={kind:W,simpleName:"Type",interfaces:[]},za.$metadata$={kind:O,simpleName:"JsType",interfaces:[Ia]};var Da=null;function Ma(t,e){return e.isInstance_s8jyv4$(t)}function Ba(){Ua=this}Ba.prototype.create_dxyxif$$default=function(t){var e=new _i;return t(e),new Ha(e)},Ba.$metadata$={kind:O,simpleName:"Js",interfaces:[ai]};var Ua=null;function Fa(){return null===Ua&&new Ba,Ua}function qa(){return Fa()}function Ga(t){return function(e){var n=new tn(Qe(e),1);return t(n),n.getResult()}}function Ha(t){if(ui.call(this,"ktor-js"),this.config_2md4la$_0=t,this.dispatcher_j9yf5v$_0=Xe.Dispatchers.Default,this.supportedCapabilities_380cpg$_0=et(Kr()),null!=this.config.proxy)throw w("Proxy unsupported in Js engine.".toString())}function Ya(t,e,n){_.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$callContext=void 0,this.local$requestTime=void 0,this.local$data=e}function Va(t,e,n,i){_.call(this,i),this.exceptionState_0=4,this.$this=t,this.local$requestTime=void 0,this.local$urlString=void 0,this.local$socket=void 0,this.local$request=e,this.local$callContext=n}function Ka(t){return function(e){if(!e.isCancelled){var n=function(t,e){return function(n){switch(n.type){case"open":var i=e;t.resumeWith_tl1gpc$(new Ze(i));break;case"error":var r=t,o=new so(JSON.stringify(n));r.resumeWith_tl1gpc$(new Ze(Je(o)))}return u}}(e,t);return t.addEventListener("open",n),t.addEventListener("error",n),e.invokeOnCancellation_f05bi3$(function(t,e){return function(n){return e.removeEventListener("open",t),e.removeEventListener("error",t),null!=n&&e.close(),u}}(n,t)),u}}}function Wa(t,e){_.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function Xa(t){return function(e){return t.forEach((n=e,function(t,e){return n.append_puj7f4$(e,t),u})),u;var n}}function Za(t){T.call(this),this.message_9vnttw$_0="Error from javascript["+t.toString()+"].",this.cause_kdow7y$_0=null,this.origin=t,e.captureStack(T,this),this.name="JsError"}function Ja(t){return function(e,n){return t[e]=n,u}}function Qa(t,e,n,i){_.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$closure$content=t,this.local$$receiver=e}function ts(t){return function(e,n,i){var r=new Qa(t,e,this,n);return i?r:r.doResume(null)}}function es(t,e,n){return function(i){return i.method=t.method.value,i.headers=e,i.redirect="follow",null!=n&&(i.body=new Uint8Array(en(n))),u}}function ns(t,e,n){_.call(this,n),this.exceptionState_0=1,this.local$tmp$=void 0,this.local$jsHeaders=void 0,this.local$$receiver=t,this.local$callContext=e}function is(t,e,n,i){var r=new ns(t,e,n);return i?r:r.doResume(null)}function rs(t){var n,i=null==(n={})||e.isType(n,x)?n:f();return t(i),i}function os(t){return function(e){var n=new tn(Qe(e),1);return t(n),n.getResult()}}function as(t){return function(e){return t.read().then((n=e,function(t){var e=t.value,i=t.done||null==e?null:e;return n.resumeWith_tl1gpc$(new Ze(i)),u})).catch(function(t){return function(e){return t.resumeWith_tl1gpc$(new Ze(Je(e))),u}}(e)),u;var n}}function ss(t,e){_.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function ls(t,e,n){var i=new ss(t,e);return n?i:i.doResume(null)}function us(t){return new Int8Array(t.buffer,t.byteOffset,t.length)}function cs(t,n){var i,r;if(null==(r=e.isType(i=n.body,Object)?i:null))throw w(("Fail to obtain native stream: "+n.toString()).toString());return hs(t,r)}function ps(t,e,n,i){_.call(this,i),this.$controller=n,this.exceptionState_0=8,this.local$closure$stream=t,this.local$tmp$=void 0,this.local$reader=void 0,this.local$$receiver=e}function hs(t,e){return xt(t,void 0,void 0,(n=e,function(t,e,i){var r=new ps(n,t,this,e);return i?r:r.doResume(null)})).channel;var n}function _s(t){return function(e){var n=new tn(Qe(e),1);return t(n),n.getResult()}}function fs(t,e){return function(i){var r,o,a=ys();return t.signal=a.signal,i.invokeOnCancellation_f05bi3$((o=a,function(t){return o.abort(),u})),(ot.PlatformUtils.IS_NODE?function(t){try{return n(975)(t)}catch(e){throw rn("Error loading module '"+t+"': "+e.toString())}}("node-fetch")(e,t):fetch(e,t)).then((r=i,function(t){return r.resumeWith_tl1gpc$(new Ze(t)),u}),function(t){return function(e){return t.resumeWith_tl1gpc$(new Ze(Je(new nn("Fail to fetch",e)))),u}}(i)),u}}function ds(t,e,n){_.call(this,n),this.exceptionState_0=1,this.local$input=t,this.local$init=e}function ms(t,e,n,i){var r=new ds(t,e,n);return i?r:r.doResume(null)}function ys(){return ot.PlatformUtils.IS_NODE?new(n(Object(function(){var t=new Error("Cannot find module 'abort-controller'");throw t.code="MODULE_NOT_FOUND",t}()))):new AbortController}function $s(t,e){return ot.PlatformUtils.IS_NODE?xs(t,e):cs(t,e)}function vs(t,e){return function(n){return t.offer_11rb$(us(new Uint8Array(n))),e.pause()}}function gs(t,e){return function(n){var i=new Za(n);return t.close_dbl4no$(i),e.channel.close_dbl4no$(i)}}function bs(t){return function(){return t.close_dbl4no$()}}function ws(t,e,n,i){_.call(this,i),this.$controller=n,this.exceptionState_0=8,this.local$closure$response=t,this.local$tmp$_0=void 0,this.local$body=void 0,this.local$$receiver=e}function xs(t,e){return xt(t,void 0,void 0,(n=e,function(t,e,i){var r=new ws(n,t,this,e);return i?r:r.doResume(null)})).channel;var n}function ks(t){}function Es(t,e){var n,i,r;this.coroutineContext_x6mio4$_0=t,this.websocket_0=e,this._closeReason_0=an(),this._incoming_0=on(2147483647),this._outgoing_0=on(2147483647),this.incoming_115vn1$_0=this._incoming_0,this.outgoing_ex3pqx$_0=this._outgoing_0,this.closeReason_n5pjc5$_0=this._closeReason_0,this.websocket_0.binaryType="arraybuffer",this.websocket_0.addEventListener("message",(r=this,function(t){return te(r,void 0,void 0,(e=t,n=r,function(t,i,r){var o=new Cs(e,n,t,this,i);return r?o:o.doResume(null)})),u;var e,n})),this.websocket_0.addEventListener("error",function(t){return function(e){var n=new so(e.toString());return t._closeReason_0.completeExceptionally_tcv7n7$(n),t._incoming_0.close_dbl4no$(n),t._outgoing_0.cancel_m4sck1$(),u}}(this)),this.websocket_0.addEventListener("close",function(t){return function(e){return te(t,void 0,void 0,(n=e,i=t,function(t,e,r){var o=new Ss(n,i,t,this,e);return r?o:o.doResume(null)})),u;var n,i}}(this)),te(this,void 0,void 0,(i=this,function(t,e,n){var r=new Ts(i,t,this,e);return n?r:r.doResume(null)})),null!=(n=this.coroutineContext.get_j3r2sn$(c.Key))&&n.invokeOnCompletion_f05bi3$(function(t){return function(e){return null==e?t.websocket_0.close():t.websocket_0.close(_n.INTERNAL_ERROR.code,"Client failed"),u}}(this))}function Cs(t,e,n,i,r){_.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$event=t,this.local$this$JsWebSocketSession=e}function Ss(t,e,n,i,r){_.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$event=t,this.local$this$JsWebSocketSession=e}function Ts(t,e,n,i){_.call(this,i),this.$controller=n,this.exceptionState_0=8,this.local$this$JsWebSocketSession=t,this.local$$receiver=void 0,this.local$cause=void 0,this.local$tmp$=void 0}function Os(t){this._value_0=t}Object.defineProperty(Ha.prototype,"config",{get:function(){return this.config_2md4la$_0}}),Object.defineProperty(Ha.prototype,"dispatcher",{get:function(){return this.dispatcher_j9yf5v$_0}}),Object.defineProperty(Ha.prototype,"supportedCapabilities",{get:function(){return this.supportedCapabilities_380cpg$_0}}),Ya.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Ya.prototype=Object.create(_.prototype),Ya.prototype.constructor=Ya,Ya.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=di(this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:if(this.local$callContext=this.result_0,Ro(this.local$data)){if(this.state_0=3,this.result_0=this.$this.executeWebSocketRequest_0(this.local$data,this.local$callContext,this),this.result_0===h)return h;continue}this.state_0=4;continue;case 3:return this.result_0;case 4:if(this.local$requestTime=ie(),this.state_0=5,this.result_0=is(this.local$data,this.local$callContext,this),this.result_0===h)return h;continue;case 5:var t=this.result_0;if(this.state_0=6,this.result_0=ms(this.local$data.url.toString(),t,this),this.result_0===h)return h;continue;case 6:var e=this.result_0,n=new kt(Ye(e.status),e.statusText),i=La(Xa(e.headers)),r=Ve.Companion.HTTP_1_1,o=$s(Ke(this.local$callContext),e);return new Ao(n,this.local$requestTime,i,r,o,this.local$callContext);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ha.prototype.execute_dkgphz$=function(t,e,n){var i=new Ya(this,t,e);return n?i:i.doResume(null)},Va.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Va.prototype=Object.create(_.prototype),Va.prototype.constructor=Va,Va.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.local$requestTime=ie(),this.local$urlString=this.local$request.url.toString(),t=ot.PlatformUtils.IS_NODE?new(n(Object(function(){var t=new Error("Cannot find module 'ws'");throw t.code="MODULE_NOT_FOUND",t}())))(this.local$urlString):new WebSocket(this.local$urlString),this.local$socket=t,this.exceptionState_0=2,this.state_0=1,this.result_0=(o=this.local$socket,a=void 0,s=void 0,s=new Wa(o,this),a?s:s.doResume(null)),this.result_0===h)return h;continue;case 1:this.exceptionState_0=4,this.state_0=3;continue;case 2:this.exceptionState_0=4;var i=this.exception_0;throw e.isType(i,T)?(We(this.local$callContext,new wt("Failed to connect to "+this.local$urlString,i)),i):i;case 3:var r=new Es(this.local$callContext,this.local$socket);return new Ao(kt.Companion.OK,this.local$requestTime,Ge.Companion.Empty,Ve.Companion.HTTP_1_1,r,this.local$callContext);case 4:throw this.exception_0;default:throw this.state_0=4,new Error("State Machine Unreachable execution")}}catch(t){if(4===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var o,a,s},Ha.prototype.executeWebSocketRequest_0=function(t,e,n,i){var r=new Va(this,t,e,n);return i?r:r.doResume(null)},Ha.$metadata$={kind:g,simpleName:"JsClientEngine",interfaces:[ui]},Wa.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Wa.prototype=Object.create(_.prototype),Wa.prototype.constructor=Wa,Wa.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Ga(Ka(this.local$$receiver))(this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return this.result_0,this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(Za.prototype,"message",{get:function(){return this.message_9vnttw$_0}}),Object.defineProperty(Za.prototype,"cause",{get:function(){return this.cause_kdow7y$_0}}),Za.$metadata$={kind:g,simpleName:"JsError",interfaces:[T]},Qa.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Qa.prototype=Object.create(_.prototype),Qa.prototype.constructor=Qa,Qa.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$content.writeTo_h3x4ir$(this.local$$receiver.channel,this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ns.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ns.prototype=Object.create(_.prototype),ns.prototype.constructor=ns,ns.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$jsHeaders={},fi(this.local$$receiver.headers,this.local$$receiver.body,Ja(this.local$jsHeaders));var t=this.local$$receiver.body;if(e.isType(t,lt)){this.local$tmp$=t.bytes(),this.state_0=6;continue}if(e.isType(t,ut)){if(this.state_0=4,this.result_0=F(t.readFrom(),this),this.result_0===h)return h;continue}if(e.isType(t,Pe)){if(this.state_0=2,this.result_0=F(xt(Xe.GlobalScope,this.local$callContext,void 0,ts(t)).channel,this),this.result_0===h)return h;continue}this.local$tmp$=null,this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=q(this.result_0),this.state_0=3;continue;case 3:this.state_0=5;continue;case 4:this.local$tmp$=q(this.result_0),this.state_0=5;continue;case 5:this.state_0=6;continue;case 6:var n=this.local$tmp$;return rs(es(this.local$$receiver,this.local$jsHeaders,n));default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ss.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ss.prototype=Object.create(_.prototype),ss.prototype.constructor=ss,ss.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=os(as(this.local$$receiver))(this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return this.result_0,this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ps.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ps.prototype=Object.create(_.prototype),ps.prototype.constructor=ps,ps.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$reader=this.local$closure$stream.getReader(),this.state_0=1;continue;case 1:if(this.exceptionState_0=6,this.state_0=2,this.result_0=ls(this.local$reader,this),this.result_0===h)return h;continue;case 2:if(this.local$tmp$=this.result_0,null==this.local$tmp$){this.exceptionState_0=6,this.state_0=5;continue}this.state_0=3;continue;case 3:var t=this.local$tmp$;if(this.state_0=4,this.result_0=Oe(this.local$$receiver.channel,us(t),this),this.result_0===h)return h;continue;case 4:this.exceptionState_0=8,this.state_0=7;continue;case 5:return u;case 6:this.exceptionState_0=8;var n=this.exception_0;throw e.isType(n,T)?(this.local$reader.cancel(n),n):n;case 7:this.state_0=1;continue;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ds.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ds.prototype=Object.create(_.prototype),ds.prototype.constructor=ds,ds.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=_s(fs(this.local$init,this.local$input))(this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return this.result_0,this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ws.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},ws.prototype=Object.create(_.prototype),ws.prototype.constructor=ws,ws.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n;if(null==(t=this.local$closure$response.body))throw w("Fail to get body".toString());n=t,this.local$body=n;var i=on(1);this.local$body.on("data",vs(i,this.local$body)),this.local$body.on("error",gs(i,this.local$$receiver)),this.local$body.on("end",bs(i)),this.exceptionState_0=6,this.local$tmp$_0=i.iterator(),this.state_0=1;continue;case 1:if(this.state_0=2,this.result_0=this.local$tmp$_0.hasNext(this),this.result_0===h)return h;continue;case 2:if(this.result_0){this.state_0=3;continue}this.state_0=5;continue;case 3:var r=this.local$tmp$_0.next();if(this.state_0=4,this.result_0=Oe(this.local$$receiver.channel,r,this),this.result_0===h)return h;continue;case 4:this.local$body.resume(),this.state_0=1;continue;case 5:this.exceptionState_0=8,this.state_0=7;continue;case 6:this.exceptionState_0=8;var o=this.exception_0;throw e.isType(o,T)?(this.local$body.destroy(o),o):o;case 7:return u;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(Es.prototype,"coroutineContext",{get:function(){return this.coroutineContext_x6mio4$_0}}),Object.defineProperty(Es.prototype,"incoming",{get:function(){return this.incoming_115vn1$_0}}),Object.defineProperty(Es.prototype,"outgoing",{get:function(){return this.outgoing_ex3pqx$_0}}),Object.defineProperty(Es.prototype,"closeReason",{get:function(){return this.closeReason_n5pjc5$_0}}),Es.prototype.flush=function(t){},Es.prototype.terminate=function(){this._incoming_0.cancel_m4sck1$(),this._outgoing_0.cancel_m4sck1$(),Zt(this._closeReason_0,"WebSocket terminated"),this.websocket_0.close()},Cs.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Cs.prototype=Object.create(_.prototype),Cs.prototype.constructor=Cs,Cs.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.local$closure$event.data;if(e.isType(n,ArrayBuffer))t=new sn(!1,new Int8Array(n));else{if("string"!=typeof n){var i=w("Unknown frame type: "+this.local$closure$event.type);throw this.local$this$JsWebSocketSession._closeReason_0.completeExceptionally_tcv7n7$(i),i}t=ln(n)}var r=t;return this.local$this$JsWebSocketSession._incoming_0.offer_11rb$(r);case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ss.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Ss.prototype=Object.create(_.prototype),Ss.prototype.constructor=Ss,Ss.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e,n=new un("number"==typeof(t=this.local$closure$event.code)?t:f(),"string"==typeof(e=this.local$closure$event.reason)?e:f());if(this.local$this$JsWebSocketSession._closeReason_0.complete_11rb$(n),this.state_0=2,this.result_0=this.local$this$JsWebSocketSession._incoming_0.send_11rb$(cn(n),this),this.result_0===h)return h;continue;case 1:throw this.exception_0;case 2:return this.local$this$JsWebSocketSession._incoming_0.close_dbl4no$(),this.local$this$JsWebSocketSession._outgoing_0.cancel_m4sck1$(),u;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ts.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[_]},Ts.prototype=Object.create(_.prototype),Ts.prototype.constructor=Ts,Ts.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$$receiver=this.local$this$JsWebSocketSession._outgoing_0,this.local$cause=null,this.exceptionState_0=5,this.local$tmp$=this.local$$receiver.iterator(),this.state_0=1;continue;case 1:if(this.state_0=2,this.result_0=this.local$tmp$.hasNext(this),this.result_0===h)return h;continue;case 2:if(this.result_0){this.state_0=3;continue}this.state_0=4;continue;case 3:var t,n=this.local$tmp$.next(),i=this.local$this$JsWebSocketSession;switch(n.frameType.name){case"TEXT":var r=n.data;i.websocket_0.send(pn(r));break;case"BINARY":var o=e.isType(t=n.data,Int8Array)?t:f(),a=o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength|0);i.websocket_0.send(a);break;case"CLOSE":var s,l=Ae(0);try{Le(l,n.data),s=l.build()}catch(t){throw e.isType(t,T)?(l.release(),t):t}var c=s,p=hn(c),_=c.readText_vux9f0$();i._closeReason_0.complete_11rb$(new un(p,_)),i.websocket_0.close(p,_)}this.state_0=1;continue;case 4:this.exceptionState_0=8,this.finallyPath_0=[7],this.state_0=6;continue;case 5:this.finallyPath_0=[8],this.exceptionState_0=6;var d=this.exception_0;throw e.isType(d,T)?(this.local$cause=d,d):d;case 6:this.exceptionState_0=8,fn(this.local$$receiver,this.local$cause),this.state_0=this.finallyPath_0.shift();continue;case 7:return this.result_0=u,this.result_0;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Es.$metadata$={kind:g,simpleName:"JsWebSocketSession",interfaces:[ue]},Object.defineProperty(Os.prototype,"value",{get:function(){return this._value_0}}),Os.prototype.compareAndSet_dqye30$=function(t,e){return this._value_0===t&&(this._value_0=e,!0)},Os.$metadata$={kind:g,simpleName:"AtomicBoolean",interfaces:[]};var Ns=t.io||(t.io={}),Ps=Ns.ktor||(Ns.ktor={}),As=Ps.client||(Ps.client={});As.HttpClient_744i18$=mn,As.HttpClient=yn,As.HttpClientConfig=bn;var js=As.call||(As.call={});js.HttpClientCall_iofdyz$=En,Object.defineProperty(Cn,"Companion",{get:jn}),js.HttpClientCall=Cn,js.HttpEngineCall=Ln,js.call_htnejk$=function(t,e,n){throw void 0===e&&(e=In),w("Unbound [HttpClientCall] is deprecated. Consider using [request(block)] in instead.".toString())},js.DoubleReceiveException=zn,js.ReceivePipelineException=Dn,js.NoTransformationFoundException=Mn,js.SavedHttpCall=Un,js.SavedHttpRequest=Fn,js.SavedHttpResponse=qn,js.save_iicrl5$=Hn,js.TypeInfo=Yn,js.UnsupportedContentTypeException=Vn,js.UnsupportedUpgradeProtocolException=Kn,js.call_30bfl5$=function(t,e,n){throw w("Unbound [HttpClientCall] is deprecated. Consider using [request(builder)] instead.".toString())},js.call_1t1q32$=function(t,e,n,i){throw void 0===n&&(n=Xn),w("Unbound [HttpClientCall] is deprecated. Consider using [request(urlString, block)] instead.".toString())},js.call_p7i9r1$=function(t,e,n,i){throw void 0===n&&(n=Jn),w("Unbound [HttpClientCall] is deprecated. Consider using [request(url, block)] instead.".toString())};var Ls=As.engine||(As.engine={});Ls.HttpClientEngine=ei,Ls.HttpClientEngineFactory=ai,Ls.HttpClientEngineBase=ui,Ls.ClientEngineClosedException=pi,Ls.HttpClientEngineCapability=hi,Ls.HttpClientEngineConfig=_i,Ls.mergeHeaders_kqv6tz$=fi,Ls.callContext=di,Object.defineProperty(mi,"Companion",{get:gi}),Ls.KtorCallContextElement=mi,l["kotlinx-coroutines-core"]=i;var Rs=As.features||(As.features={});Rs.addDefaultResponseValidation_bbdm9p$=ki,Rs.ResponseException=Ei,Rs.RedirectResponseException=Ci,Rs.ServerResponseException=Si,Rs.ClientRequestException=Ti,Rs.defaultTransformers_ejcypf$=zi,Di.Config=Ui,Object.defineProperty(Di,"Companion",{get:Vi}),Rs.HttpCallValidator=Di,Rs.HttpResponseValidator_jqt3w2$=Ki,Rs.HttpClientFeature=Wi,Rs.feature_ccg70z$=Zi,nr.Config=ir,Object.defineProperty(nr,"Feature",{get:ur}),Rs.HttpPlainText=nr,Object.defineProperty(hr,"Feature",{get:yr}),Rs.HttpRedirect=hr,Object.defineProperty(vr,"Feature",{get:kr}),Rs.HttpRequestLifecycle=vr,Rs.Sender=Er,Object.defineProperty(Cr,"Feature",{get:Pr}),Rs.HttpSend=Cr,Rs.SendCountExceedException=Lr,Object.defineProperty(Ir,"Companion",{get:Mr}),Rr.HttpTimeoutCapabilityConfiguration_init_oq4a4q$=Br,Rr.HttpTimeoutCapabilityConfiguration=Ir,Object.defineProperty(Rr,"Feature",{get:Kr}),Rs.HttpTimeout=Rr,Rs.HttpRequestTimeoutException=Wr,l["ktor-ktor-http"]=a,l["ktor-ktor-utils"]=r;var Is=Rs.websocket||(Rs.websocket={});Is.ClientWebSocketSession=Xr,Is.DefaultClientWebSocketSession=Zr,Is.DelegatingClientWebSocketSession=Jr,Is.WebSocketContent=Qr,Object.defineProperty(to,"Feature",{get:ao}),Is.WebSockets=to,Is.WebSocketException=so,Is.webSocket_5f0jov$=ho,Is.webSocket_c3wice$=yo,Is.webSocket_xhesox$=function(t,e,n,i,r,o){var a=new go(t,e,n,i,r);return o?a:a.doResume(null)};var zs=As.request||(As.request={});zs.ClientUpgradeContent=bo,zs.DefaultHttpRequest=ko,zs.HttpRequest=Eo,Object.defineProperty(Co,"Companion",{get:No}),zs.HttpRequestBuilder=Co,zs.HttpRequestData=Po,zs.HttpResponseData=Ao,zs.url_3rzbk2$=Lo,zs.url_g8iu3v$=function(t,e){Kt(t.url,e)},zs.isUpgradeRequest_5kadeu$=Ro,Object.defineProperty(Io,"Phases",{get:Mo}),zs.HttpRequestPipeline=Io,Object.defineProperty(Bo,"Phases",{get:Go}),zs.HttpSendPipeline=Bo,zs.url_qpqkqe$=function(t,e){Ce(t.url,e)};var Ds=As.utils||(As.utils={});l["ktor-ktor-io"]=o;var Ms=zs.forms||(zs.forms={});Ms.FormDataContent=Ho,Ms.MultiPartFormDataContent=Yo,zs.get_port_ocert9$=Qo;var Bs=As.statement||(As.statement={});Bs.DefaultHttpResponse=ta,Bs.HttpResponse=ea,Bs.get_request_abn2de$=na,Bs.complete_abn2de$=ia,Object.defineProperty(ra,"Phases",{get:sa}),Bs.HttpResponsePipeline=ra,Object.defineProperty(la,"Phases",{get:_a}),Bs.HttpReceivePipeline=la,Bs.HttpResponseContainer=fa,Bs.HttpStatement=da,Object.defineProperty(Ds,"DEFAULT_HTTP_POOL_SIZE",{get:function(){return ca}}),Object.defineProperty(Ds,"DEFAULT_HTTP_BUFFER_SIZE",{get:function(){return pa}}),Object.defineProperty(Ds,"EmptyContent",{get:Ea}),Ds.wrapHeaders_j1n6iz$=function(t,n){return e.isType(t,ne)?new Ca(t,n):e.isType(t,ut)?new Sa(t,n):e.isType(t,Pe)?new Ta(t,n):e.isType(t,lt)?new Oa(t,n):e.isType(t,He)?new Na(t,n):e.noWhenBranchMatched()},Object.defineProperty(Ds,"CacheControl",{get:function(){return null===Aa&&new Pa,Aa}}),Ds.buildHeaders_g6xk4w$=La,As.HttpClient_f0veat$=function(t){return void 0===t&&(t=Ra),mn(qa(),t)},js.Type=Ia,Object.defineProperty(js,"JsType",{get:function(){return null===Da&&new za,Da}}),js.instanceOf_ofcvxk$=Ma;var Us=Ls.js||(Ls.js={});Object.defineProperty(Us,"Js",{get:Fa}),Us.JsClient=qa,Us.JsClientEngine=Ha,Us.JsError=Za,Us.toRaw_lu1yd6$=is,Us.buildObject_ymnom6$=rs,Us.readChunk_pggmy1$=ls,Us.asByteArray_es0py6$=us;var Fs=Us.browser||(Us.browser={});Fs.readBodyBrowser_katr0q$=cs,Fs.channelFromStream_xaoqny$=hs;var qs=Us.compatibility||(Us.compatibility={});return qs.commonFetch_gzh8gj$=ms,qs.AbortController_8be2vx$=ys,qs.readBody_katr0q$=$s,(Us.node||(Us.node={})).readBodyNode_katr0q$=xs,Rs.platformDefaultTransformers_h1fxjk$=ks,Is.JsWebSocketSession=Es,Ds.AtomicBoolean=Os,ai.prototype.create_dxyxif$,Object.defineProperty(ui.prototype,"supportedCapabilities",Object.getOwnPropertyDescriptor(ei.prototype,"supportedCapabilities")),Object.defineProperty(ui.prototype,"closed_yj5g8o$_0",Object.getOwnPropertyDescriptor(ei.prototype,"closed_yj5g8o$_0")),ui.prototype.install_k5i6f8$=ei.prototype.install_k5i6f8$,ui.prototype.executeWithinCallContext_2kaaho$_0=ei.prototype.executeWithinCallContext_2kaaho$_0,ui.prototype.checkExtensions_1320zn$_0=ei.prototype.checkExtensions_1320zn$_0,ui.prototype.createCallContext_bk2bfg$_0=ei.prototype.createCallContext_bk2bfg$_0,mi.prototype.fold_3cc69b$=rt.prototype.fold_3cc69b$,mi.prototype.get_j3r2sn$=rt.prototype.get_j3r2sn$,mi.prototype.minusKey_yeqjby$=rt.prototype.minusKey_yeqjby$,mi.prototype.plus_1fupul$=rt.prototype.plus_1fupul$,Wi.prototype.prepare_oh3mgy$,Wi.prototype.prepare_oh3mgy$,Fi.prototype.prepare_oh3mgy$=Wi.prototype.prepare_oh3mgy$,rr.prototype.prepare_oh3mgy$=Wi.prototype.prepare_oh3mgy$,_r.prototype.prepare_oh3mgy$=Wi.prototype.prepare_oh3mgy$,gr.prototype.prepare_oh3mgy$=Wi.prototype.prepare_oh3mgy$,Tr.prototype.prepare_oh3mgy$=Wi.prototype.prepare_oh3mgy$,Ur.prototype.prepare_oh3mgy$=Wi.prototype.prepare_oh3mgy$,Wi.prototype.prepare_oh3mgy$,Wi.prototype.prepare_oh3mgy$,Wi.prototype.prepare_oh3mgy$,Wi.prototype.prepare_oh3mgy$,Xr.prototype.send_x9o3m3$=le.prototype.send_x9o3m3$,eo.prototype.prepare_oh3mgy$=Wi.prototype.prepare_oh3mgy$,Object.defineProperty(ko.prototype,"executionContext",Object.getOwnPropertyDescriptor(Eo.prototype,"executionContext")),Ba.prototype.create_dxyxif$=ai.prototype.create_dxyxif$,Object.defineProperty(Ha.prototype,"closed_yj5g8o$_0",Object.getOwnPropertyDescriptor(ei.prototype,"closed_yj5g8o$_0")),Ha.prototype.executeWithinCallContext_2kaaho$_0=ei.prototype.executeWithinCallContext_2kaaho$_0,Ha.prototype.checkExtensions_1320zn$_0=ei.prototype.checkExtensions_1320zn$_0,Ha.prototype.createCallContext_bk2bfg$_0=ei.prototype.createCallContext_bk2bfg$_0,Es.prototype.send_x9o3m3$=ue.prototype.send_x9o3m3$,On=new Y("call-context"),Nn=new d("EngineCapabilities"),et(Kr()),Pn="Ktor client",$i=new d("ValidateMark"),Hi=new d("ApplicationFeatureRegistry"),sr=Yt([Ht.Companion.Get,Ht.Companion.Head]),Yr="13",Fo=Fe(Nt.Charsets.UTF_8.newEncoder(),"\r\n",0,"\r\n".length),ca=1e3,pa=4096,t})?i.apply(e,r):i)||(t.exports=o)},804:function(t,e,n){var i,r,o;r=[e,n(421),n(267),n(276),n(197)],void 0===(o="function"==typeof(i=function(t,e,n,i,r){"use strict";var o=t.$$importsForInline$$||(t.$$importsForInline$$={}),a=(e.kotlin.sequences.map_z5avom$,e.kotlin.sequences.toList_veqyi0$,e.kotlin.ranges.until_dqglrj$,e.kotlin.collections.toSet_7wnvza$,e.kotlin.collections.listOf_mh5how$,e.Kind.CLASS),s=(e.kotlin.collections.Map.Entry,e.kotlin.LazyThreadSafetyMode),l=(e.kotlin.collections.LinkedHashSet_init_ww73n8$,e.kotlin.lazy_kls4a0$),u=n.io.ktor.http.Headers,c=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,p=e.kotlin.collections.ArrayList_init_ww73n8$,h=e.kotlin.text.StringBuilder_init_za3lpa$,_=(e.kotlin.Unit,i.io.ktor.utils.io.pool.DefaultPool),f=e.Long.NEG_ONE,d=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,m=e.kotlin.coroutines.CoroutineImpl,y=(i.io.ktor.utils.io.writer_x9a1ni$,e.Long.ZERO,i.io.ktor.utils.io.errors.EOFException,e.equals,i.io.ktor.utils.io.cancel_3dmw3p$,i.io.ktor.utils.io.copyTo_47ygvz$,Error),$=(i.io.ktor.utils.io.close_x5qia6$,r.kotlinx.coroutines,i.io.ktor.utils.io.reader_ps9zta$,i.io.ktor.utils.io.core.IoBuffer,i.io.ktor.utils.io.writeFully_4scpqu$,i.io.ktor.utils.io.core.Buffer,e.throwCCE,i.io.ktor.utils.io.core.writeShort_cx5lgg$,i.io.ktor.utils.io.charsets),v=i.io.ktor.utils.io.charsets.encodeToByteArray_fj4osb$,g=e.kotlin.collections.ArrayList_init_287e2$,b=e.kotlin.collections.emptyList_287e2$,w=(e.kotlin.to_ujzrz7$,e.kotlin.collections.listOf_i5x0yv$),x=e.toBoxedChar,k=e.Kind.OBJECT,E=(e.kotlin.collections.joinTo_gcc71v$,e.hashCode,e.kotlin.text.StringBuilder_init,n.io.ktor.http.HttpMethod),C=(e.toString,e.kotlin.IllegalStateException_init_pdl1vj$),S=(e.Long.MAX_VALUE,e.kotlin.sequences.filter_euau3h$,e.kotlin.NotImplementedError,e.kotlin.IllegalArgumentException_init_pdl1vj$),T=(e.kotlin.Exception_init_pdl1vj$,e.kotlin.Exception,e.unboxChar),O=(e.kotlin.ranges.CharRange,e.kotlin.NumberFormatException,e.kotlin.text.contains_sgbm27$,i.io.ktor.utils.io.core.Closeable,e.kotlin.NoSuchElementException),N=Array,P=e.toChar,A=e.kotlin.collections.Collection,j=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,L=e.ensureNotNull,R=(e.kotlin.CharSequence,e.kotlin.IndexOutOfBoundsException,e.kotlin.text.Appendable,Math,e.kotlin.ranges.IntRange),I=e.Long.fromInt(48),z=e.Long.fromInt(97),D=e.Long.fromInt(102),M=e.Long.fromInt(65),B=e.Long.fromInt(70),U=e.kotlin.collections.toLongArray_558emf$,F=e.toByte,q=e.kotlin.collections.toByteArray_kdx1v$,G=e.kotlin.Enum,H=e.throwISE,Y=e.kotlin.collections.mapCapacity_za3lpa$,V=e.kotlin.ranges.coerceAtLeast_dqglrj$,K=e.kotlin.collections.LinkedHashMap_init_bwtc7$,W=i.io.ktor.utils.io.core.writeFully_i6snlg$,X=i.io.ktor.utils.io.charsets.decode_lb8wo3$,Z=(i.io.ktor.utils.io.core.readShort_7wsnj1$,r.kotlinx.coroutines.DisposableHandle),J=i.io.ktor.utils.io.core.BytePacketBuilder_za3lpa$,Q=e.kotlin.collections.get_lastIndex_m7z4lg$,tt=(e.defineInlineFunction,e.wrapFunction,e.kotlin.Annotation,r.kotlinx.coroutines.CancellationException,e.Kind.INTERFACE),et=i.io.ktor.utils.io.core.readBytes_xc9h3n$,nt=i.io.ktor.utils.io.core.writeShort_9kfkzl$,it=r.kotlinx.coroutines.CoroutineScope;function rt(t){this.headers_0=t,this.names_pj02dq$_0=l(s.NONE,CIOHeaders$names$lambda(this))}function ot(t){_.call(this,t)}function at(t){_.call(this,t)}function st(t){kt(),this.root=t}function lt(t,e,n){this.ch=x(t),this.exact=e,this.children=n;var i,r=N(256);i=r.length-1|0;for(var o=0;o<=i;o++){var a,s=this.children;t:do{var l,u=null,c=!1;for(l=s.iterator();l.hasNext();){var p=l.next();if((0|T(p.ch))===o){if(c){a=null;break t}u=p,c=!0}}if(!c){a=null;break t}a=u}while(0);r[o]=a}this.array=r}function ut(){xt=this}function ct(t){return t.length}function pt(t,e){return x(t.charCodeAt(e))}ot.prototype=Object.create(_.prototype),ot.prototype.constructor=ot,at.prototype=Object.create(_.prototype),at.prototype.constructor=at,Et.prototype=Object.create(_.prototype),Et.prototype.constructor=Et,St.prototype=Object.create(G.prototype),St.prototype.constructor=St,Qt.prototype=Object.create(G.prototype),Qt.prototype.constructor=Qt,_e.prototype=Object.create(he.prototype),_e.prototype.constructor=_e,fe.prototype=Object.create(he.prototype),fe.prototype.constructor=fe,de.prototype=Object.create(he.prototype),de.prototype.constructor=de,$e.prototype=Object.create(he.prototype),$e.prototype.constructor=$e,ve.prototype=Object.create(he.prototype),ve.prototype.constructor=ve,ot.prototype.produceInstance=function(){return h(128)},ot.prototype.clearInstance_trkh7z$=function(t){return t.clear(),t},ot.$metadata$={kind:a,interfaces:[_]},at.prototype.produceInstance=function(){return new Int32Array(512)},at.$metadata$={kind:a,interfaces:[_]},lt.$metadata$={kind:a,simpleName:"Node",interfaces:[]},st.prototype.search_5wmzmj$=function(t,e,n,i,r){var o,a;if(void 0===e&&(e=0),void 0===n&&(n=t.length),void 0===i&&(i=!1),0===t.length)throw S("Couldn't search in char tree for empty string");for(var s=this.root,l=e;l$&&b.add_11rb$(w)}this.build_0(v,b,n,$,r,o),v.trimToSize();var x,k=g();for(x=y.iterator();x.hasNext();){var E=x.next();r(E)===$&&k.add_11rb$(E)}t.add_11rb$(new lt(m,k,v))}},ut.$metadata$={kind:k,simpleName:"Companion",interfaces:[]};var ht,_t,ft,dt,mt,yt,$t,vt,gt,bt,wt,xt=null;function kt(){return null===xt&&new ut,xt}function Et(t){_.call(this,t)}function Ct(t,e){this.code=t,this.message=e}function St(t,e,n){G.call(this),this.code=n,this.name$=t,this.ordinal$=e}function Tt(){Tt=function(){},ht=new St("NORMAL",0,1e3),_t=new St("GOING_AWAY",1,1001),ft=new St("PROTOCOL_ERROR",2,1002),dt=new St("CANNOT_ACCEPT",3,1003),mt=new St("NOT_CONSISTENT",4,1007),yt=new St("VIOLATED_POLICY",5,1008),$t=new St("TOO_BIG",6,1009),vt=new St("NO_EXTENSION",7,1010),gt=new St("INTERNAL_ERROR",8,1011),bt=new St("SERVICE_RESTART",9,1012),wt=new St("TRY_AGAIN_LATER",10,1013),Ft()}function Ot(){return Tt(),ht}function Nt(){return Tt(),_t}function Pt(){return Tt(),ft}function At(){return Tt(),dt}function jt(){return Tt(),mt}function Lt(){return Tt(),yt}function Rt(){return Tt(),$t}function It(){return Tt(),vt}function zt(){return Tt(),gt}function Dt(){return Tt(),bt}function Mt(){return Tt(),wt}function Bt(){Ut=this;var t,e=qt(),n=V(Y(e.length),16),i=K(n);for(t=0;t!==e.length;++t){var r=e[t];i.put_xwzc9p$(r.code,r)}this.byCodeMap_0=i,this.UNEXPECTED_CONDITION=zt()}st.$metadata$={kind:a,simpleName:"AsciiCharTree",interfaces:[]},Et.prototype.produceInstance=function(){return e.charArray(2048)},Et.$metadata$={kind:a,interfaces:[_]},Object.defineProperty(Ct.prototype,"knownReason",{get:function(){return Ft().byCode_mq22fl$(this.code)}}),Ct.prototype.toString=function(){var t;return"CloseReason(reason="+(null!=(t=this.knownReason)?t:this.code).toString()+", message="+this.message+")"},Bt.prototype.byCode_mq22fl$=function(t){return this.byCodeMap_0.get_11rb$(t)},Bt.$metadata$={kind:k,simpleName:"Companion",interfaces:[]};var Ut=null;function Ft(){return Tt(),null===Ut&&new Bt,Ut}function qt(){return[Ot(),Nt(),Pt(),At(),jt(),Lt(),Rt(),It(),zt(),Dt(),Mt()]}function Gt(t,e,n){return n=n||Object.create(Ct.prototype),Ct.call(n,t.code,e),n}function Ht(){Zt=this}St.$metadata$={kind:a,simpleName:"Codes",interfaces:[G]},St.values=qt,St.valueOf_61zpoe$=function(t){switch(t){case"NORMAL":return Ot();case"GOING_AWAY":return Nt();case"PROTOCOL_ERROR":return Pt();case"CANNOT_ACCEPT":return At();case"NOT_CONSISTENT":return jt();case"VIOLATED_POLICY":return Lt();case"TOO_BIG":return Rt();case"NO_EXTENSION":return It();case"INTERNAL_ERROR":return zt();case"SERVICE_RESTART":return Dt();case"TRY_AGAIN_LATER":return Mt();default:H("No enum constant io.ktor.http.cio.websocket.CloseReason.Codes."+t)}},Ct.$metadata$={kind:a,simpleName:"CloseReason",interfaces:[]},Ct.prototype.component1=function(){return this.code},Ct.prototype.component2=function(){return this.message},Ct.prototype.copy_qid81t$=function(t,e){return new Ct(void 0===t?this.code:t,void 0===e?this.message:e)},Ct.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.code)|0)+e.hashCode(this.message)|0},Ct.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.code,t.code)&&e.equals(this.message,t.message)},Ht.prototype.dispose=function(){},Ht.prototype.toString=function(){return"NonDisposableHandle"},Ht.$metadata$={kind:k,simpleName:"NonDisposableHandle",interfaces:[Z]};var Yt,Vt,Kt,Wt,Xt,Zt=null;function Jt(){return null===Zt&&new Ht,Zt}function Qt(t,e,n,i){G.call(this),this.controlFrame=n,this.opcode=i,this.name$=t,this.ordinal$=e}function te(){te=function(){},Yt=new Qt("TEXT",0,!1,1),Vt=new Qt("BINARY",1,!1,2),Kt=new Qt("CLOSE",2,!0,8),Wt=new Qt("PING",3,!0,9),Xt=new Qt("PONG",4,!0,10),le()}function ee(){return te(),Yt}function ne(){return te(),Vt}function ie(){return te(),Kt}function re(){return te(),Wt}function oe(){return te(),Xt}function ae(){se=this;var t,n=ue();t:do{if(0===n.length){t=null;break t}var i=n[0],r=Q(n);if(0===r){t=i;break t}for(var o=i.opcode,a=1;a<=r;a++){var s=n[a],l=s.opcode;e.compareTo(o,l)<0&&(i=s,o=l)}t=i}while(0);this.maxOpcode_0=L(t).opcode;var u,c=N(this.maxOpcode_0+1|0);u=c.length-1|0;for(var p=0;p<=u;p++){var h,_=ue();t:do{var f,d=null,m=!1;for(f=0;f!==_.length;++f){var y=_[f];if(y.opcode===p){if(m){h=null;break t}d=y,m=!0}}if(!m){h=null;break t}h=d}while(0);c[p]=h}this.byOpcodeArray_0=c}ae.prototype.get_za3lpa$=function(t){var e;return e=this.maxOpcode_0,0<=t&&t<=e?this.byOpcodeArray_0[t]:null},ae.$metadata$={kind:k,simpleName:"Companion",interfaces:[]};var se=null;function le(){return te(),null===se&&new ae,se}function ue(){return[ee(),ne(),ie(),re(),oe()]}function ce(t,e,n){m.call(this,n),this.exceptionState_0=5,this.local$$receiver=t,this.local$reason=e}function pe(){}function he(t,e,n,i){we(),void 0===i&&(i=Jt()),this.fin=t,this.frameType=e,this.data=n,this.disposableHandle=i}function _e(t,e){he.call(this,t,ne(),e)}function fe(t,e){he.call(this,t,ee(),e)}function de(t){he.call(this,!0,ie(),t)}function me(t,n){var i;n=n||Object.create(de.prototype);var r=J(0);try{nt(r,t.code),r.writeStringUtf8_61zpoe$(t.message),i=r.build()}catch(t){throw e.isType(t,y)?(r.release(),t):t}return ye(i,n),n}function ye(t,e){return e=e||Object.create(de.prototype),de.call(e,et(t)),e}function $e(t){he.call(this,!0,re(),t)}function ve(t,e){void 0===e&&(e=Jt()),he.call(this,!0,oe(),t,e)}function ge(){be=this,this.Empty_0=new Int8Array(0)}Qt.$metadata$={kind:a,simpleName:"FrameType",interfaces:[G]},Qt.values=ue,Qt.valueOf_61zpoe$=function(t){switch(t){case"TEXT":return ee();case"BINARY":return ne();case"CLOSE":return ie();case"PING":return re();case"PONG":return oe();default:H("No enum constant io.ktor.http.cio.websocket.FrameType."+t)}},ce.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ce.prototype=Object.create(m.prototype),ce.prototype.constructor=ce,ce.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(void 0===this.local$reason&&(this.local$reason=Gt(Ot(),"")),this.exceptionState_0=3,this.state_0=1,this.result_0=this.local$$receiver.send_x9o3m3$(me(this.local$reason),this),this.result_0===d)return d;continue;case 1:if(this.state_0=2,this.result_0=this.local$$receiver.flush(this),this.result_0===d)return d;continue;case 2:this.exceptionState_0=5,this.state_0=4;continue;case 3:this.exceptionState_0=5;var t=this.exception_0;if(!e.isType(t,y))throw t;this.state_0=4;continue;case 4:return;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},pe.$metadata$={kind:tt,simpleName:"DefaultWebSocketSession",interfaces:[xe]},_e.$metadata$={kind:a,simpleName:"Binary",interfaces:[he]},fe.$metadata$={kind:a,simpleName:"Text",interfaces:[he]},de.$metadata$={kind:a,simpleName:"Close",interfaces:[he]},$e.$metadata$={kind:a,simpleName:"Ping",interfaces:[he]},ve.$metadata$={kind:a,simpleName:"Pong",interfaces:[he]},he.prototype.toString=function(){return"Frame "+this.frameType+" (fin="+this.fin+", buffer len = "+this.data.length+")"},he.prototype.copy=function(){return we().byType_8ejoj4$(this.fin,this.frameType,this.data.slice())},ge.prototype.byType_8ejoj4$=function(t,n,i){switch(n.name){case"BINARY":return new _e(t,i);case"TEXT":return new fe(t,i);case"CLOSE":return new de(i);case"PING":return new $e(i);case"PONG":return new ve(i);default:return e.noWhenBranchMatched()}},ge.$metadata$={kind:k,simpleName:"Companion",interfaces:[]};var be=null;function we(){return null===be&&new ge,be}function xe(){}function ke(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$frame=e}he.$metadata$={kind:a,simpleName:"Frame",interfaces:[]},ke.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ke.prototype=Object.create(m.prototype),ke.prototype.constructor=ke,ke.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.outgoing.send_11rb$(this.local$frame,this),this.result_0===d)return d;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},xe.prototype.send_x9o3m3$=function(t,e,n){var i=new ke(this,t,e);return n?i:i.doResume(null)},xe.$metadata$={kind:tt,simpleName:"WebSocketSession",interfaces:[it]};var Ee=t.io||(t.io={}),Ce=Ee.ktor||(Ee.ktor={}),Se=Ce.http||(Ce.http={}),Te=Se.cio||(Se.cio={});Te.CIOHeaders=rt,o["ktor-ktor-io"]=i,st.Node=lt,Object.defineProperty(st,"Companion",{get:kt}),(Te.internals||(Te.internals={})).AsciiCharTree=st,Object.defineProperty(St,"NORMAL",{get:Ot}),Object.defineProperty(St,"GOING_AWAY",{get:Nt}),Object.defineProperty(St,"PROTOCOL_ERROR",{get:Pt}),Object.defineProperty(St,"CANNOT_ACCEPT",{get:At}),Object.defineProperty(St,"NOT_CONSISTENT",{get:jt}),Object.defineProperty(St,"VIOLATED_POLICY",{get:Lt}),Object.defineProperty(St,"TOO_BIG",{get:Rt}),Object.defineProperty(St,"NO_EXTENSION",{get:It}),Object.defineProperty(St,"INTERNAL_ERROR",{get:zt}),Object.defineProperty(St,"SERVICE_RESTART",{get:Dt}),Object.defineProperty(St,"TRY_AGAIN_LATER",{get:Mt}),Object.defineProperty(St,"Companion",{get:Ft}),Ct.Codes=St;var Oe=Te.websocket||(Te.websocket={});Oe.CloseReason_init_ia8ci6$=Gt,Oe.CloseReason=Ct,Oe.readText_2pdr7t$=function(t){if(!t.fin)throw S("Text could be only extracted from non-fragmented frame".toString());var n,i=$.Charsets.UTF_8.newDecoder(),r=J(0);try{W(r,t.data),n=r.build()}catch(t){throw e.isType(t,y)?(r.release(),t):t}return X(i,n)},Oe.readBytes_y4xpne$=function(t){return t.data.slice()},Object.defineProperty(Oe,"NonDisposableHandle",{get:Jt}),Object.defineProperty(Qt,"TEXT",{get:ee}),Object.defineProperty(Qt,"BINARY",{get:ne}),Object.defineProperty(Qt,"CLOSE",{get:ie}),Object.defineProperty(Qt,"PING",{get:re}),Object.defineProperty(Qt,"PONG",{get:oe}),Object.defineProperty(Qt,"Companion",{get:le}),Oe.FrameType=Qt,Oe.close_icv0wc$=function(t,e,n,i){var r=new ce(t,e,n);return i?r:r.doResume(null)},Oe.DefaultWebSocketSession=pe,Oe.DefaultWebSocketSession_23cfxb$=function(t,e,n){throw C("There is no CIO js websocket implementation. Consider using platform default.".toString())},he.Binary_init_cqnnqj$=function(t,e,n){return n=n||Object.create(_e.prototype),_e.call(n,t,et(e)),n},he.Binary=_e,he.Text_init_61zpoe$=function(t,e){return e=e||Object.create(fe.prototype),fe.call(e,!0,v($.Charsets.UTF_8.newEncoder(),t,0,t.length)),e},he.Text_init_cqnnqj$=function(t,e,n){return n=n||Object.create(fe.prototype),fe.call(n,t,et(e)),n},he.Text=fe,he.Close_init_p695es$=me,he.Close_init_3uq2w4$=ye,he.Close_init=function(t){return t=t||Object.create(de.prototype),de.call(t,we().Empty_0),t},he.Close=de,he.Ping_init_3uq2w4$=function(t,e){return e=e||Object.create($e.prototype),$e.call(e,et(t)),e},he.Ping=$e,he.Pong_init_3uq2w4$=function(t,e){return e=e||Object.create(ve.prototype),ve.call(e,et(t)),e},he.Pong=ve,Object.defineProperty(he,"Companion",{get:we}),Oe.Frame=he,Oe.WebSocketSession=xe,rt.prototype.contains_61zpoe$=u.prototype.contains_61zpoe$,rt.prototype.contains_puj7f4$=u.prototype.contains_puj7f4$,rt.prototype.forEach_ubvtmq$=u.prototype.forEach_ubvtmq$,pe.prototype.send_x9o3m3$=xe.prototype.send_x9o3m3$,new ot(2048),v($.Charsets.UTF_8.newEncoder(),"\r\n",0,"\r\n".length);var Ne="0\r\n\r\n";v($.Charsets.UTF_8.newEncoder(),Ne,0,Ne.length),new Int32Array(0),new at(1e3),kt().build_mowv1r$(w(["HTTP/1.0","HTTP/1.1"])),new Et(4096),kt().build_za6fmz$(E.Companion.DefaultMethods,(function(t){return t.value.length}),(function(t,e){return x(t.value.charCodeAt(e))}));var Pe,Ae=new R(0,255),je=p(c(Ae,10));for(Pe=Ae.iterator();Pe.hasNext();){var Le,Re=Pe.next(),Ie=je.add_11rb$;Le=48<=Re&&Re<=57?e.Long.fromInt(Re).subtract(I):Re>=z.toNumber()&&Re<=D.toNumber()?e.Long.fromInt(Re).subtract(z).add(e.Long.fromInt(10)):Re>=M.toNumber()&&Re<=B.toNumber()?e.Long.fromInt(Re).subtract(M).add(e.Long.fromInt(10)):f,Ie.call(je,Le)}U(je);var ze,De=new R(0,15),Me=p(c(De,10));for(ze=De.iterator();ze.hasNext();){var Be=ze.next();Me.add_11rb$(F(Be<10?48+Be|0:0|P(P(97+Be)-10)))}return q(Me),t})?i.apply(e,r):i)||(t.exports=o)},267:function(t,e,n){var i,r,o;r=[e,n(421),n(276),n(94),n(197)],void 0===(o="function"==typeof(i=function(t,e,n,i,r){"use strict";var o,a,s,l,u,c,p=t.$$importsForInline$$||(t.$$importsForInline$$={}),h=(e.kotlin.Enum,e.Kind.CLASS),_=(e.throwISE,e.kotlin.collections.ArrayList_init_ww73n8$),f=e.toString,d=e.kotlin.collections.joinToString_fmv235$,m=e.kotlin.ranges.CharRange,y=e.kotlin.collections.plus_q4559j$,$=e.kotlin.collections.plus_mydzjv$,v=e.unboxChar,g=e.toByte,b=e.toBoxedChar,w=e.kotlin.collections.listOf_i5x0yv$,x=n.io.ktor.utils.io.charsets,k=n.io.ktor.utils.io.charsets.encode_fj4osb$,E=e.toChar,C=e.kotlin.Unit,S=e.kotlin.text.StringBuilder_init_za3lpa$,T=n.io.ktor.utils.io.core.String_xge8xe$,O=e.kotlin.Exception_init_pdl1vj$,N=e.kotlin.Exception,P=e.kotlin.text.StringBuilder_init,A=n.io.ktor.utils.io.core.internal.prepareReadFirstHead_j319xh$,j=n.io.ktor.utils.io.core.internal.prepareReadNextHead_x2nit9$,L=n.io.ktor.utils.io.core.internal.completeReadHead_x2nit9$,R=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,I=e.kotlin.collections.plus_qloxvw$,z=e.equals,D=e.hashCode,M=e.Kind.OBJECT,B=e.kotlin.collections.emptyList_287e2$,U=e.kotlin.collections.single_2p1efm$,F=e.kotlin.text.equals_igcy3c$,q=e.kotlin.text.indexOf_8eortd$,G=e.kotlin.text.contains_sgbm27$,H=n.io.ktor.utils.io.charsets.get_name_2sg7fd$,Y=n.io.ktor.utils.io.charsets.Charset,V=e.kotlin.collections.Collection,K=e.throwCCE,W=e.kotlin.text.trim_gw00vp$,X=e.kotlin.collections.emptyMap_q3lmfv$,Z=e.kotlin.collections.setOf_i5x0yv$,J=e.kotlin.text.startsWith_7epoxm$,Q=i.io.ktor.util.toLowerCasePreservingASCIIRules_pdl1vz$,tt=e.kotlin.text.toInt_pdl1vz$,et=e.kotlin.to_ujzrz7$,nt=e.kotlin.sequences.map_z5avom$,it=(e.kotlin.sequences.filter_euau3h$,e.kotlin.text.endsWith_7epoxm$,e.kotlin.IllegalArgumentException_init_pdl1vj$),rt=e.kotlin.text.isWhitespace_myv2d0$,ot=(e.kotlin.NoSuchElementException,e.kotlin.collections.mapCapacity_za3lpa$),at=e.kotlin.collections.LinkedHashMap_init_bwtc7$,st=e.kotlin.collections.Map,lt=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,ut=e.kotlin.collections.ArrayList_init_287e2$,ct=e.kotlin.text.iterator_gw00vp$,pt=e.kotlin.text.Regex_init_61zpoe$,ht=e.defineInlineFunction,_t=e.wrapFunction,ft=(i.io.ktor.util.date.Month.values,e.ensureNotNull),dt=(e.kotlin.ranges.IntRange,e.kotlin.IllegalStateException_init_pdl1vj$),mt=e.kotlin.IllegalStateException,yt=(e.kotlin.text.padStart_vrc1nu$,i.io.ktor.util.toCharArray_pdl1vz$),$t=(e.kotlin.text.lastIndexOfAny_junqau$,e.kotlin.text.removePrefix_gsj5wt$),vt=(e.kotlin.text.substringAfter_j4ogox$,i.io.ktor.util.caseInsensitiveMap_287e2$),gt=e.kotlin.collections.asSequence_7wnvza$,bt=e.kotlin.lazy_klfg04$,wt=e.kotlin.collections.firstOrNull_2p1efm$,xt=e.kotlin.IllegalArgumentException,kt=Error,Et=e.Kind.INTERFACE,Ct=i.io.ktor.util.StringValues,St=i.io.ktor.util.StringValuesBuilder,Tt=e.kotlin.collections.emptySet_287e2$,Ot=e.kotlin.collections.listOf_mh5how$,Nt=e.kotlin.collections.asList_us0mfu$,Pt=(e.kotlin.collections.toMap_6hr0sd$,i.io.ktor.util.StringValuesImpl),At=e.kotlin.text.toDoubleOrNull_pdl1vz$,jt=e.kotlin.ranges.rangeTo_38ydlf$,Lt=(e.kotlin.collections.sortedWith_eknfly$,e.kotlin.LazyThreadSafetyMode),Rt=e.kotlin.lazy_kls4a0$,It=e.kotlin.text.get_lastIndex_gw00vp$,zt=(e.kotlin.Comparator,e.kotlin.text.split_ip8yn$),Dt=(e.kotlin.text.toLong_pdl1vz$,Array),Mt=(e.kotlin.text.substringBefore_j4ogox$,e.kotlin.collections.joinTo_gcc71v$),Bt=e.kotlin.collections.addAll_ipc267$,Ut=(e.kotlin.collections.joinToString_cgipc5$,e.kotlin.text.lineSequence_gw00vp$),Ft=e.kotlin.sequences.mapNotNull_qpz9h9$,qt=e.kotlin.sequences.toList_veqyi0$,Gt=(e.kotlin.ranges.coerceAtMost_2p08ub$,e.Long.ZERO,e.kotlin.ranges.coerceAtLeast_2p08ub$,e.kotlin.collections.last_2p1efm$,e.kotlin.collections.get_lastIndex_55thoc$,e.kotlin.collections.filterNotNull_emfgvx$,e.kotlin.text.indexOf_l5u8uk$,e.kotlin.text.indexOfAny_junqau$),Ht=e.kotlin.text.lastIndexOf_8eortd$,Yt=e.kotlin.text.get_indices_gw00vp$,Vt=e.kotlin.ranges.reversed_zf1xzc$,Kt=i.io.ktor.util.isLowerCase_myv2d0$,Wt=e.kotlin.ranges.coerceAtLeast_dqglrj$,Xt=i.io.ktor.util.appendAll_k10e8h$,Zt=e.kotlin.text.isBlank_gw00vp$,Jt=(i.io.ktor.util,i.io.ktor.util.generateNonce,e.kotlin.text.startsWith_sgbm27$,e.kotlin.text.endsWith_sgbm27$,i.io.ktor.util.AttributeKey),Qt=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,te=e.kotlin.coroutines.CoroutineImpl,ee=i.io.ktor.util.AttributesJsFn,ne=n.io.ktor.utils.io.ByteReadChannel,ie=r.kotlinx.coroutines,re=n.io.ktor.utils.io.copyTo_47ygvz$,oe=n.io.ktor.utils.io.writer_x9a1ni$,ae=e.kotlin.text.take_6ic1pp$,se=n.io.ktor.utils.io.charsets.encodeToByteArray_fj4osb$,le=e.kotlin.text.Regex,ue=(e.kotlin.text.repeat_94bcnn$,e.kotlin.io.println_s8jyv4$,e.kotlin.collections.first_2p1efm$,e.kotlin.collections.checkIndexOverflow_za3lpa$),ce=i.io.ktor.util.sha1_fqrh44$,pe=i.io.ktor.util.encodeBase64_964n91$;function he(t,e,n,i){void 0===e&&(e=!1),void 0===n&&(n=!1),void 0===i&&(i=x.Charsets.UTF_8);var r,a,s,u=P();return we(k(i.newEncoder(),t),(r=n,a=u,s=e,function(t){return t===g(32)?r?a.append_s8itvh$(43):a.append_gw00v9$("%20"):o.contains_11rb$(t)||!s&&l.contains_11rb$(t)?a.append_s8itvh$(E(t)):a.append_gw00v9$(ve(t)),C})),u.toString()}function _e(t){return function(e){return t.append_gw00v9$(ve(e)),C}}function fe(t){for(var e=P(),n=x.Charsets.UTF_8,i=0;i255?l/3|0:l);r>n&&u.append_ezbsdh$(t,n,r);for(var c=r,p=null;c=i){var f,d=c;throw f=t.length,new $e("Incomplete trailing HEX escape: "+e.subSequence(t,d,f).toString()+", in "+t+" at "+c)}var m=ge(t.charCodeAt(c+1|0)),y=ge(t.charCodeAt(c+2|0));if(-1===m||-1===y)throw new $e("Wrong HEX escape: %"+String.fromCharCode(t.charCodeAt(c+1|0))+String.fromCharCode(t.charCodeAt(c+2|0))+", in "+t+", at "+c);p[(s=_,_=s+1|0,s)]=g((16*m|0)+y|0),c=c+3|0}u.append_gw00v9$(T(p,0,_,a))}else u.append_s8itvh$(h),c=c+1|0}return u.toString()}function $e(t){O(t,this),this.name="URLDecodeException"}function ve(t){var e=S(3),n=255&t;return e.append_s8itvh$(37),e.append_s8itvh$(be(n>>4)),e.append_s8itvh$(be(15&n)),e.toString()}function ge(t){return new m(48,57).contains_mef7kx$(t)?t-48:new m(65,70).contains_mef7kx$(t)?t-65+10|0:new m(97,102).contains_mef7kx$(t)?t-97+10|0:-1}function be(t){return E(t>=0&&t<=9?48+t:E(65+t)-10)}function we(t,e){t:do{var n,i,r=!0;if(null==(n=A(t,1)))break t;var o=n;try{for(;;){for(var a=o;a.writePosition>a.readPosition;)e(a.readByte());if(r=!1,null==(i=j(t,o)))break;o=i,r=!0}}finally{r&&L(t,o)}}while(0)}function xe(t,e){Ce(),void 0===e&&(e=B()),tn.call(this,t,e)}function ke(){Ee=this,this.File=new xe("file"),this.Mixed=new xe("mixed"),this.Attachment=new xe("attachment"),this.Inline=new xe("inline")}$e.prototype=Object.create(N.prototype),$e.prototype.constructor=$e,xe.prototype=Object.create(tn.prototype),xe.prototype.constructor=xe,Ne.prototype=Object.create(tn.prototype),Ne.prototype.constructor=Ne,We.prototype=Object.create(N.prototype),We.prototype.constructor=We,pn.prototype=Object.create(St.prototype),pn.prototype.constructor=pn,dn.prototype=Object.create(Pt.prototype),dn.prototype.constructor=dn,Pn.prototype=Object.create(xt.prototype),Pn.prototype.constructor=Pn,An.prototype=Object.create(xt.prototype),An.prototype.constructor=An,jn.prototype=Object.create(xt.prototype),jn.prototype.constructor=jn,ui.prototype=Object.create(St.prototype),ui.prototype.constructor=ui,_i.prototype=Object.create(Pt.prototype),_i.prototype.constructor=_i,Oi.prototype=Object.create(mt.prototype),Oi.prototype.constructor=Oi,Ji.prototype=Object.create(Vi.prototype),Ji.prototype.constructor=Ji,Gi.prototype=Object.create(qi.prototype),Gi.prototype.constructor=Gi,Hi.prototype=Object.create(qi.prototype),Hi.prototype.constructor=Hi,Yi.prototype=Object.create(qi.prototype),Yi.prototype.constructor=Yi,Ki.prototype=Object.create(Vi.prototype),Ki.prototype.constructor=Ki,Wi.prototype=Object.create(Vi.prototype),Wi.prototype.constructor=Wi,Zi.prototype=Object.create(Vi.prototype),Zi.prototype.constructor=Zi,Qi.prototype=Object.create(Vi.prototype),Qi.prototype.constructor=Qi,tr.prototype=Object.create(Ji.prototype),tr.prototype.constructor=tr,ar.prototype=Object.create(ir.prototype),ar.prototype.constructor=ar,sr.prototype=Object.create(ir.prototype),sr.prototype.constructor=sr,lr.prototype=Object.create(ir.prototype),lr.prototype.constructor=lr,ur.prototype=Object.create(ir.prototype),ur.prototype.constructor=ur,cr.prototype=Object.create(ir.prototype),cr.prototype.constructor=cr,pr.prototype=Object.create(ir.prototype),pr.prototype.constructor=pr,hr.prototype=Object.create(ir.prototype),hr.prototype.constructor=hr,_r.prototype=Object.create(ir.prototype),_r.prototype.constructor=_r,fr.prototype=Object.create(ir.prototype),fr.prototype.constructor=fr,dr.prototype=Object.create(ir.prototype),dr.prototype.constructor=dr,$e.$metadata$={kind:h,simpleName:"URLDecodeException",interfaces:[N]},Object.defineProperty(xe.prototype,"disposition",{get:function(){return this.content}}),Object.defineProperty(xe.prototype,"name",{get:function(){return this.parameter_61zpoe$(Oe().Name)}}),xe.prototype.withParameter_puj7f4$=function(t,e){return new xe(this.disposition,I(this.parameters,new mn(t,e)))},xe.prototype.withParameters_1wyvw$=function(t){return new xe(this.disposition,$(this.parameters,t))},xe.prototype.equals=function(t){return e.isType(t,xe)&&z(this.disposition,t.disposition)&&z(this.parameters,t.parameters)},xe.prototype.hashCode=function(){return(31*D(this.disposition)|0)+D(this.parameters)|0},ke.prototype.parse_61zpoe$=function(t){var e=U($n(t));return new xe(e.value,e.params)},ke.$metadata$={kind:M,simpleName:"Companion",interfaces:[]};var Ee=null;function Ce(){return null===Ee&&new ke,Ee}function Se(){Te=this,this.FileName="filename",this.FileNameAsterisk="filename*",this.Name="name",this.CreationDate="creation-date",this.ModificationDate="modification-date",this.ReadDate="read-date",this.Size="size",this.Handling="handling"}Se.$metadata$={kind:M,simpleName:"Parameters",interfaces:[]};var Te=null;function Oe(){return null===Te&&new Se,Te}function Ne(t,e,n,i){je(),void 0===i&&(i=B()),tn.call(this,n,i),this.contentType=t,this.contentSubtype=e}function Pe(){Ae=this,this.Any=Ke("*","*")}xe.$metadata$={kind:h,simpleName:"ContentDisposition",interfaces:[tn]},Ne.prototype.withParameter_puj7f4$=function(t,e){return this.hasParameter_0(t,e)?this:new Ne(this.contentType,this.contentSubtype,this.content,I(this.parameters,new mn(t,e)))},Ne.prototype.hasParameter_0=function(t,n){switch(this.parameters.size){case 0:return!1;case 1:var i=this.parameters.get_za3lpa$(0);return F(i.name,t,!0)&&F(i.value,n,!0);default:var r,o=this.parameters;t:do{var a;if(e.isType(o,V)&&o.isEmpty()){r=!1;break t}for(a=o.iterator();a.hasNext();){var s=a.next();if(F(s.name,t,!0)&&F(s.value,n,!0)){r=!0;break t}}r=!1}while(0);return r}},Ne.prototype.withoutParameters=function(){return Ke(this.contentType,this.contentSubtype)},Ne.prototype.match_9v5yzd$=function(t){var n,i;if(!z(t.contentType,"*")&&!F(t.contentType,this.contentType,!0))return!1;if(!z(t.contentSubtype,"*")&&!F(t.contentSubtype,this.contentSubtype,!0))return!1;for(n=t.parameters.iterator();n.hasNext();){var r=n.next(),o=r.component1(),a=r.component2();if(z(o,"*"))if(z(a,"*"))i=!0;else{var s,l=this.parameters;t:do{var u;if(e.isType(l,V)&&l.isEmpty()){s=!1;break t}for(u=l.iterator();u.hasNext();){var c=u.next();if(F(c.value,a,!0)){s=!0;break t}}s=!1}while(0);i=s}else{var p=this.parameter_61zpoe$(o);i=z(a,"*")?null!=p:F(p,a,!0)}if(!i)return!1}return!0},Ne.prototype.match_61zpoe$=function(t){return this.match_9v5yzd$(je().parse_61zpoe$(t))},Ne.prototype.equals=function(t){return e.isType(t,Ne)&&F(this.contentType,t.contentType,!0)&&F(this.contentSubtype,t.contentSubtype,!0)&&z(this.parameters,t.parameters)},Ne.prototype.hashCode=function(){var t=D(this.contentType.toLowerCase());return(t=t+((31*t|0)+D(this.contentSubtype.toLowerCase()))|0)+(31*D(this.parameters)|0)|0},Pe.prototype.parse_61zpoe$=function(t){var n=U($n(t)),i=n.value,r=n.params,o=q(i,47);if(-1===o){var a;if(z(W(e.isCharSequence(a=i)?a:K()).toString(),"*"))return this.Any;throw new We(t)}var s,l=i.substring(0,o),u=W(e.isCharSequence(s=l)?s:K()).toString();if(0===u.length)throw new We(t);var c,p=o+1|0,h=i.substring(p),_=W(e.isCharSequence(c=h)?c:K()).toString();if(0===_.length||G(_,47))throw new We(t);return Ke(u,_,r)},Pe.$metadata$={kind:M,simpleName:"Companion",interfaces:[]};var Ae=null;function je(){return null===Ae&&new Pe,Ae}function Le(){Re=this,this.Any=Ke("application","*"),this.Atom=Ke("application","atom+xml"),this.Json=Ke("application","json"),this.JavaScript=Ke("application","javascript"),this.OctetStream=Ke("application","octet-stream"),this.FontWoff=Ke("application","font-woff"),this.Rss=Ke("application","rss+xml"),this.Xml=Ke("application","xml"),this.Xml_Dtd=Ke("application","xml-dtd"),this.Zip=Ke("application","zip"),this.GZip=Ke("application","gzip"),this.FormUrlEncoded=Ke("application","x-www-form-urlencoded"),this.Pdf=Ke("application","pdf"),this.Wasm=Ke("application","wasm"),this.ProblemJson=Ke("application","problem+json"),this.ProblemXml=Ke("application","problem+xml")}Le.$metadata$={kind:M,simpleName:"Application",interfaces:[]};var Re=null;function Ie(){ze=this,this.Any=Ke("audio","*"),this.MP4=Ke("audio","mp4"),this.MPEG=Ke("audio","mpeg"),this.OGG=Ke("audio","ogg")}Ie.$metadata$={kind:M,simpleName:"Audio",interfaces:[]};var ze=null;function De(){Me=this,this.Any=Ke("image","*"),this.GIF=Ke("image","gif"),this.JPEG=Ke("image","jpeg"),this.PNG=Ke("image","png"),this.SVG=Ke("image","svg+xml"),this.XIcon=Ke("image","x-icon")}De.$metadata$={kind:M,simpleName:"Image",interfaces:[]};var Me=null;function Be(){Ue=this,this.Any=Ke("message","*"),this.Http=Ke("message","http")}Be.$metadata$={kind:M,simpleName:"Message",interfaces:[]};var Ue=null;function Fe(){qe=this,this.Any=Ke("multipart","*"),this.Mixed=Ke("multipart","mixed"),this.Alternative=Ke("multipart","alternative"),this.Related=Ke("multipart","related"),this.FormData=Ke("multipart","form-data"),this.Signed=Ke("multipart","signed"),this.Encrypted=Ke("multipart","encrypted"),this.ByteRanges=Ke("multipart","byteranges")}Fe.$metadata$={kind:M,simpleName:"MultiPart",interfaces:[]};var qe=null;function Ge(){He=this,this.Any=Ke("text","*"),this.Plain=Ke("text","plain"),this.CSS=Ke("text","css"),this.CSV=Ke("text","csv"),this.Html=Ke("text","html"),this.JavaScript=Ke("text","javascript"),this.VCard=Ke("text","vcard"),this.Xml=Ke("text","xml"),this.EventStream=Ke("text","event-stream")}Ge.$metadata$={kind:M,simpleName:"Text",interfaces:[]};var He=null;function Ye(){Ve=this,this.Any=Ke("video","*"),this.MPEG=Ke("video","mpeg"),this.MP4=Ke("video","mp4"),this.OGG=Ke("video","ogg"),this.QuickTime=Ke("video","quicktime")}Ye.$metadata$={kind:M,simpleName:"Video",interfaces:[]};var Ve=null;function Ke(t,e,n,i){return void 0===n&&(n=B()),i=i||Object.create(Ne.prototype),Ne.call(i,t,e,t+"/"+e,n),i}function We(t){O("Bad Content-Type format: "+t,this),this.name="BadContentTypeFormatException"}function Xe(t){var e;return null!=(e=t.parameter_61zpoe$("charset"))?Y.Companion.forName_61zpoe$(e):null}function Ze(t){var e=t.component1(),n=t.component2();return et(n,e)}function Je(t){var e,n=lt();for(e=t.iterator();e.hasNext();){var i,r=e.next(),o=r.first,a=n.get_11rb$(o);if(null==a){var s=ut();n.put_xwzc9p$(o,s),i=s}else i=a;i.add_11rb$(r)}var l,u=at(ot(n.size));for(l=n.entries.iterator();l.hasNext();){var c,p=l.next(),h=u.put_xwzc9p$,f=p.key,d=p.value,m=_(R(d,10));for(c=d.iterator();c.hasNext();){var y=c.next();m.add_11rb$(y.second)}h.call(u,f,m)}return u}function Qe(t){try{return je().parse_61zpoe$(t)}catch(n){throw e.isType(n,kt)?new xt("Failed to parse "+t,n):n}}function tn(t,e){rn(),void 0===e&&(e=B()),this.content=t,this.parameters=e}function en(){nn=this}Ne.$metadata$={kind:h,simpleName:"ContentType",interfaces:[tn]},We.$metadata$={kind:h,simpleName:"BadContentTypeFormatException",interfaces:[N]},tn.prototype.parameter_61zpoe$=function(t){var e,n,i=this.parameters;t:do{var r;for(r=i.iterator();r.hasNext();){var o=r.next();if(F(o.name,t,!0)){n=o;break t}}n=null}while(0);return null!=(e=n)?e.value:null},tn.prototype.toString=function(){if(this.parameters.isEmpty())return this.content;var t,e=this.content.length,n=0;for(t=this.parameters.iterator();t.hasNext();){var i=t.next();n=n+(i.name.length+i.value.length+3|0)|0}var r,o=S(e+n|0);o.append_gw00v9$(this.content),r=this.parameters.size;for(var a=0;a?@[\\]{}',t)}function Rn(){}function In(){}function zn(t){var e;return null!=(e=t.headers.get_61zpoe$(Nn().ContentType))?je().parse_61zpoe$(e):null}function Dn(t){Un(),this.value=t}function Mn(){Bn=this,this.Get=new Dn("GET"),this.Post=new Dn("POST"),this.Put=new Dn("PUT"),this.Patch=new Dn("PATCH"),this.Delete=new Dn("DELETE"),this.Head=new Dn("HEAD"),this.Options=new Dn("OPTIONS"),this.DefaultMethods=w([this.Get,this.Post,this.Put,this.Patch,this.Delete,this.Head,this.Options])}Pn.$metadata$={kind:h,simpleName:"UnsafeHeaderException",interfaces:[xt]},An.$metadata$={kind:h,simpleName:"IllegalHeaderNameException",interfaces:[xt]},jn.$metadata$={kind:h,simpleName:"IllegalHeaderValueException",interfaces:[xt]},Rn.$metadata$={kind:Et,simpleName:"HttpMessage",interfaces:[]},In.$metadata$={kind:Et,simpleName:"HttpMessageBuilder",interfaces:[]},Mn.prototype.parse_61zpoe$=function(t){return z(t,this.Get.value)?this.Get:z(t,this.Post.value)?this.Post:z(t,this.Put.value)?this.Put:z(t,this.Patch.value)?this.Patch:z(t,this.Delete.value)?this.Delete:z(t,this.Head.value)?this.Head:z(t,this.Options.value)?this.Options:new Dn(t)},Mn.$metadata$={kind:M,simpleName:"Companion",interfaces:[]};var Bn=null;function Un(){return null===Bn&&new Mn,Bn}function Fn(t,e,n){Hn(),this.name=t,this.major=e,this.minor=n}function qn(){Gn=this,this.HTTP_2_0=new Fn("HTTP",2,0),this.HTTP_1_1=new Fn("HTTP",1,1),this.HTTP_1_0=new Fn("HTTP",1,0),this.SPDY_3=new Fn("SPDY",3,0),this.QUIC=new Fn("QUIC",1,0)}Dn.$metadata$={kind:h,simpleName:"HttpMethod",interfaces:[]},Dn.prototype.component1=function(){return this.value},Dn.prototype.copy_61zpoe$=function(t){return new Dn(void 0===t?this.value:t)},Dn.prototype.toString=function(){return"HttpMethod(value="+e.toString(this.value)+")"},Dn.prototype.hashCode=function(){var t=0;return 31*t+e.hashCode(this.value)|0},Dn.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.value,t.value)},qn.prototype.fromValue_3m52m6$=function(t,e,n){return z(t,"HTTP")&&1===e&&1===n?this.HTTP_1_1:z(t,"HTTP")&&2===e&&0===n?this.HTTP_2_0:new Fn(t,e,n)},qn.prototype.parse_6bul2c$=function(t){var e=zt(t,["/","."]);if(3!==e.size)throw dt(("Failed to parse HttpProtocolVersion. Expected format: protocol/major.minor, but actual: "+t).toString());var n=e.get_za3lpa$(0),i=e.get_za3lpa$(1),r=e.get_za3lpa$(2);return this.fromValue_3m52m6$(n,tt(i),tt(r))},qn.$metadata$={kind:M,simpleName:"Companion",interfaces:[]};var Gn=null;function Hn(){return null===Gn&&new qn,Gn}function Yn(t,e){Xn(),this.value=t,this.description=e}function Vn(){Wn=this,this.Continue=new Yn(100,"Continue"),this.SwitchingProtocols=new Yn(101,"Switching Protocols"),this.Processing=new Yn(102,"Processing"),this.OK=new Yn(200,"OK"),this.Created=new Yn(201,"Created"),this.Accepted=new Yn(202,"Accepted"),this.NonAuthoritativeInformation=new Yn(203,"Non-Authoritative Information"),this.NoContent=new Yn(204,"No Content"),this.ResetContent=new Yn(205,"Reset Content"),this.PartialContent=new Yn(206,"Partial Content"),this.MultiStatus=new Yn(207,"Multi-Status"),this.MultipleChoices=new Yn(300,"Multiple Choices"),this.MovedPermanently=new Yn(301,"Moved Permanently"),this.Found=new Yn(302,"Found"),this.SeeOther=new Yn(303,"See Other"),this.NotModified=new Yn(304,"Not Modified"),this.UseProxy=new Yn(305,"Use Proxy"),this.SwitchProxy=new Yn(306,"Switch Proxy"),this.TemporaryRedirect=new Yn(307,"Temporary Redirect"),this.PermanentRedirect=new Yn(308,"Permanent Redirect"),this.BadRequest=new Yn(400,"Bad Request"),this.Unauthorized=new Yn(401,"Unauthorized"),this.PaymentRequired=new Yn(402,"Payment Required"),this.Forbidden=new Yn(403,"Forbidden"),this.NotFound=new Yn(404,"Not Found"),this.MethodNotAllowed=new Yn(405,"Method Not Allowed"),this.NotAcceptable=new Yn(406,"Not Acceptable"),this.ProxyAuthenticationRequired=new Yn(407,"Proxy Authentication Required"),this.RequestTimeout=new Yn(408,"Request Timeout"),this.Conflict=new Yn(409,"Conflict"),this.Gone=new Yn(410,"Gone"),this.LengthRequired=new Yn(411,"Length Required"),this.PreconditionFailed=new Yn(412,"Precondition Failed"),this.PayloadTooLarge=new Yn(413,"Payload Too Large"),this.RequestURITooLong=new Yn(414,"Request-URI Too Long"),this.UnsupportedMediaType=new Yn(415,"Unsupported Media Type"),this.RequestedRangeNotSatisfiable=new Yn(416,"Requested Range Not Satisfiable"),this.ExpectationFailed=new Yn(417,"Expectation Failed"),this.UnprocessableEntity=new Yn(422,"Unprocessable Entity"),this.Locked=new Yn(423,"Locked"),this.FailedDependency=new Yn(424,"Failed Dependency"),this.UpgradeRequired=new Yn(426,"Upgrade Required"),this.TooManyRequests=new Yn(429,"Too Many Requests"),this.RequestHeaderFieldTooLarge=new Yn(431,"Request Header Fields Too Large"),this.InternalServerError=new Yn(500,"Internal Server Error"),this.NotImplemented=new Yn(501,"Not Implemented"),this.BadGateway=new Yn(502,"Bad Gateway"),this.ServiceUnavailable=new Yn(503,"Service Unavailable"),this.GatewayTimeout=new Yn(504,"Gateway Timeout"),this.VersionNotSupported=new Yn(505,"HTTP Version Not Supported"),this.VariantAlsoNegotiates=new Yn(506,"Variant Also Negotiates"),this.InsufficientStorage=new Yn(507,"Insufficient Storage"),this.allStatusCodes=Zn();var t,e=Dt(1e3);t=e.length-1|0;for(var n=0;n<=t;n++){var i,r=this.allStatusCodes;t:do{var o;for(o=r.iterator();o.hasNext();){var a=o.next();if(a.value===n){i=a;break t}}i=null}while(0);e[n]=i}this.byValue_0=e}Fn.prototype.toString=function(){return this.name+"/"+this.major+"."+this.minor},Fn.$metadata$={kind:h,simpleName:"HttpProtocolVersion",interfaces:[]},Fn.prototype.component1=function(){return this.name},Fn.prototype.component2=function(){return this.major},Fn.prototype.component3=function(){return this.minor},Fn.prototype.copy_3m52m6$=function(t,e,n){return new Fn(void 0===t?this.name:t,void 0===e?this.major:e,void 0===n?this.minor:n)},Fn.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*t+e.hashCode(this.name)|0)+e.hashCode(this.major)|0)+e.hashCode(this.minor)|0},Fn.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)&&e.equals(this.major,t.major)&&e.equals(this.minor,t.minor)},Yn.prototype.toString=function(){return this.value.toString()+" "+this.description},Yn.prototype.equals=function(t){return e.isType(t,Yn)&&t.value===this.value},Yn.prototype.hashCode=function(){return D(this.value)},Yn.prototype.description_61zpoe$=function(t){return this.copy_19mbxw$(void 0,t)},Vn.prototype.fromValue_za3lpa$=function(t){var e=1<=t&&t<1e3?this.byValue_0[t]:null;return null!=e?e:new Yn(t,"Unknown Status Code")},Vn.$metadata$={kind:M,simpleName:"Companion",interfaces:[]};var Kn,Wn=null;function Xn(){return null===Wn&&new Vn,Wn}function Zn(){return w([Xn().Continue,Xn().SwitchingProtocols,Xn().Processing,Xn().OK,Xn().Created,Xn().Accepted,Xn().NonAuthoritativeInformation,Xn().NoContent,Xn().ResetContent,Xn().PartialContent,Xn().MultiStatus,Xn().MultipleChoices,Xn().MovedPermanently,Xn().Found,Xn().SeeOther,Xn().NotModified,Xn().UseProxy,Xn().SwitchProxy,Xn().TemporaryRedirect,Xn().PermanentRedirect,Xn().BadRequest,Xn().Unauthorized,Xn().PaymentRequired,Xn().Forbidden,Xn().NotFound,Xn().MethodNotAllowed,Xn().NotAcceptable,Xn().ProxyAuthenticationRequired,Xn().RequestTimeout,Xn().Conflict,Xn().Gone,Xn().LengthRequired,Xn().PreconditionFailed,Xn().PayloadTooLarge,Xn().RequestURITooLong,Xn().UnsupportedMediaType,Xn().RequestedRangeNotSatisfiable,Xn().ExpectationFailed,Xn().UnprocessableEntity,Xn().Locked,Xn().FailedDependency,Xn().UpgradeRequired,Xn().TooManyRequests,Xn().RequestHeaderFieldTooLarge,Xn().InternalServerError,Xn().NotImplemented,Xn().BadGateway,Xn().ServiceUnavailable,Xn().GatewayTimeout,Xn().VersionNotSupported,Xn().VariantAlsoNegotiates,Xn().InsufficientStorage])}function Jn(t){var e=P();return ti(t,e),e.toString()}function Qn(t){var e=de(t.first,!0);return null==t.second?e:e+"="+de(f(t.second),!0)}function ti(t,e){Mt(t,e,"&",void 0,void 0,void 0,void 0,Qn)}function ei(t,e){var n,i=t.entries(),r=ut();for(n=i.iterator();n.hasNext();){var o,a=n.next();if(a.value.isEmpty())o=Ot(et(a.key,null));else{var s,l=a.value,u=_(R(l,10));for(s=l.iterator();s.hasNext();){var c=s.next();u.add_11rb$(et(a.key,c))}o=u}Bt(r,o)}ti(r,e)}function ni(t){var n,i=W(e.isCharSequence(n=t)?n:K()).toString();if(0===i.length)return null;var r=q(i,44),o=i.substring(0,r),a=r+1|0,s=i.substring(a);return et(Q($t(o,".")),Qe(s))}function ii(){return qt(Ft(Ut("\n.123,application/vnd.lotus-1-2-3\n.3dmf,x-world/x-3dmf\n.3dml,text/vnd.in3d.3dml\n.3dm,x-world/x-3dmf\n.3g2,video/3gpp2\n.3gp,video/3gpp\n.7z,application/x-7z-compressed\n.aab,application/x-authorware-bin\n.aac,audio/aac\n.aam,application/x-authorware-map\n.a,application/octet-stream\n.aas,application/x-authorware-seg\n.abc,text/vnd.abc\n.abw,application/x-abiword\n.ac,application/pkix-attr-cert\n.acc,application/vnd.americandynamics.acc\n.ace,application/x-ace-compressed\n.acgi,text/html\n.acu,application/vnd.acucobol\n.adp,audio/adpcm\n.aep,application/vnd.audiograph\n.afl,video/animaflex\n.afp,application/vnd.ibm.modcap\n.ahead,application/vnd.ahead.space\n.ai,application/postscript\n.aif,audio/aiff\n.aifc,audio/aiff\n.aiff,audio/aiff\n.aim,application/x-aim\n.aip,text/x-audiosoft-intra\n.air,application/vnd.adobe.air-application-installer-package+zip\n.ait,application/vnd.dvb.ait\n.ami,application/vnd.amiga.ami\n.ani,application/x-navi-animation\n.aos,application/x-nokia-9000-communicator-add-on-software\n.apk,application/vnd.android.package-archive\n.application,application/x-ms-application\n,application/pgp-encrypted\n.apr,application/vnd.lotus-approach\n.aps,application/mime\n.arc,application/octet-stream\n.arj,application/arj\n.arj,application/octet-stream\n.art,image/x-jg\n.asf,video/x-ms-asf\n.asm,text/x-asm\n.aso,application/vnd.accpac.simply.aso\n.asp,text/asp\n.asx,application/x-mplayer2\n.asx,video/x-ms-asf\n.asx,video/x-ms-asf-plugin\n.atc,application/vnd.acucorp\n.atomcat,application/atomcat+xml\n.atomsvc,application/atomsvc+xml\n.atom,application/atom+xml\n.atx,application/vnd.antix.game-component\n.au,audio/basic\n.au,audio/x-au\n.avi,video/avi\n.avi,video/msvideo\n.avi,video/x-msvideo\n.avs,video/avs-video\n.aw,application/applixware\n.azf,application/vnd.airzip.filesecure.azf\n.azs,application/vnd.airzip.filesecure.azs\n.azw,application/vnd.amazon.ebook\n.bcpio,application/x-bcpio\n.bdf,application/x-font-bdf\n.bdm,application/vnd.syncml.dm+wbxml\n.bed,application/vnd.realvnc.bed\n.bh2,application/vnd.fujitsu.oasysprs\n.bin,application/macbinary\n.bin,application/mac-binary\n.bin,application/octet-stream\n.bin,application/x-binary\n.bin,application/x-macbinary\n.bmi,application/vnd.bmi\n.bm,image/bmp\n.bmp,image/bmp\n.bmp,image/x-windows-bmp\n.boo,application/book\n.book,application/book\n.box,application/vnd.previewsystems.box\n.boz,application/x-bzip2\n.bsh,application/x-bsh\n.btif,image/prs.btif\n.bz2,application/x-bzip2\n.bz,application/x-bzip\n.c11amc,application/vnd.cluetrust.cartomobile-config\n.c11amz,application/vnd.cluetrust.cartomobile-config-pkg\n.c4g,application/vnd.clonk.c4group\n.cab,application/vnd.ms-cab-compressed\n.car,application/vnd.curl.car\n.cat,application/vnd.ms-pki.seccat\n.ccad,application/clariscad\n.cco,application/x-cocoa\n.cc,text/plain\n.cc,text/x-c\n.ccxml,application/ccxml+xml,\n.cdbcmsg,application/vnd.contact.cmsg\n.cdf,application/cdf\n.cdf,application/x-cdf\n.cdf,application/x-netcdf\n.cdkey,application/vnd.mediastation.cdkey\n.cdmia,application/cdmi-capability\n.cdmic,application/cdmi-container\n.cdmid,application/cdmi-domain\n.cdmio,application/cdmi-object\n.cdmiq,application/cdmi-queue\n.cdx,chemical/x-cdx\n.cdxml,application/vnd.chemdraw+xml\n.cdy,application/vnd.cinderella\n.cer,application/pkix-cert\n.cgm,image/cgm\n.cha,application/x-chat\n.chat,application/x-chat\n.chm,application/vnd.ms-htmlhelp\n.chrt,application/vnd.kde.kchart\n.cif,chemical/x-cif\n.cii,application/vnd.anser-web-certificate-issue-initiation\n.cil,application/vnd.ms-artgalry\n.cla,application/vnd.claymore\n.class,application/java\n.class,application/java-byte-code\n.class,application/java-vm\n.class,application/x-java-class\n.clkk,application/vnd.crick.clicker.keyboard\n.clkp,application/vnd.crick.clicker.palette\n.clkt,application/vnd.crick.clicker.template\n.clkw,application/vnd.crick.clicker.wordbank\n.clkx,application/vnd.crick.clicker\n.clp,application/x-msclip\n.cmc,application/vnd.cosmocaller\n.cmdf,chemical/x-cmdf\n.cml,chemical/x-cml\n.cmp,application/vnd.yellowriver-custom-menu\n.cmx,image/x-cmx\n.cod,application/vnd.rim.cod\n.com,application/octet-stream\n.com,text/plain\n.conf,text/plain\n.cpio,application/x-cpio\n.cpp,text/x-c\n.cpt,application/mac-compactpro\n.cpt,application/x-compactpro\n.cpt,application/x-cpt\n.crd,application/x-mscardfile\n.crl,application/pkcs-crl\n.crl,application/pkix-crl\n.crt,application/pkix-cert\n.crt,application/x-x509-ca-cert\n.crt,application/x-x509-user-cert\n.cryptonote,application/vnd.rig.cryptonote\n.csh,application/x-csh\n.csh,text/x-script.csh\n.csml,chemical/x-csml\n.csp,application/vnd.commonspace\n.css,text/css\n.csv,text/csv\n.c,text/plain\n.c++,text/plain\n.c,text/x-c\n.cu,application/cu-seeme\n.curl,text/vnd.curl\n.cww,application/prs.cww\n.cxx,text/plain\n.dat,binary/octet-stream\n.dae,model/vnd.collada+xml\n.daf,application/vnd.mobius.daf\n.davmount,application/davmount+xml\n.dcr,application/x-director\n.dcurl,text/vnd.curl.dcurl\n.dd2,application/vnd.oma.dd2+xml\n.ddd,application/vnd.fujixerox.ddd\n.deb,application/x-debian-package\n.deepv,application/x-deepv\n.def,text/plain\n.der,application/x-x509-ca-cert\n.dfac,application/vnd.dreamfactory\n.dif,video/x-dv\n.dir,application/x-director\n.dis,application/vnd.mobius.dis\n.djvu,image/vnd.djvu\n.dl,video/dl\n.dl,video/x-dl\n.dna,application/vnd.dna\n.doc,application/msword\n.docm,application/vnd.ms-word.document.macroenabled.12\n.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document\n.dot,application/msword\n.dotm,application/vnd.ms-word.template.macroenabled.12\n.dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template\n.dp,application/commonground\n.dp,application/vnd.osgi.dp\n.dpg,application/vnd.dpgraph\n.dra,audio/vnd.dra\n.drw,application/drafting\n.dsc,text/prs.lines.tag\n.dssc,application/dssc+der\n.dtb,application/x-dtbook+xml\n.dtd,application/xml-dtd\n.dts,audio/vnd.dts\n.dtshd,audio/vnd.dts.hd\n.dump,application/octet-stream\n.dvi,application/x-dvi\n.dv,video/x-dv\n.dwf,drawing/x-dwf (old)\n.dwf,model/vnd.dwf\n.dwg,application/acad\n.dwg,image/vnd.dwg\n.dwg,image/x-dwg\n.dxf,application/dxf\n.dxf,image/vnd.dwg\n.dxf,image/vnd.dxf\n.dxf,image/x-dwg\n.dxp,application/vnd.spotfire.dxp\n.dxr,application/x-director\n.ecelp4800,audio/vnd.nuera.ecelp4800\n.ecelp7470,audio/vnd.nuera.ecelp7470\n.ecelp9600,audio/vnd.nuera.ecelp9600\n.edm,application/vnd.novadigm.edm\n.edx,application/vnd.novadigm.edx\n.efif,application/vnd.picsel\n.ei6,application/vnd.pg.osasli\n.elc,application/x-bytecode.elisp (compiled elisp)\n.elc,application/x-elc\n.el,text/x-script.elisp\n.eml,message/rfc822\n.emma,application/emma+xml\n.env,application/x-envoy\n.eol,audio/vnd.digital-winds\n.eot,application/vnd.ms-fontobject\n.eps,application/postscript\n.epub,application/epub+zip\n.es3,application/vnd.eszigno3+xml\n.es,application/ecmascript\n.es,application/x-esrehber\n.esf,application/vnd.epson.esf\n.etx,text/x-setext\n.evy,application/envoy\n.evy,application/x-envoy\n.exe,application/octet-stream\n.exe,application/x-msdownload\n.exi,application/exi\n.ext,application/vnd.novadigm.ext\n.ez2,application/vnd.ezpix-album\n.ez3,application/vnd.ezpix-package\n.f4v,video/x-f4v\n.f77,text/x-fortran\n.f90,text/plain\n.f90,text/x-fortran\n.fbs,image/vnd.fastbidsheet\n.fcs,application/vnd.isac.fcs\n.fdf,application/vnd.fdf\n.fe_launch,application/vnd.denovo.fcselayout-link\n.fg5,application/vnd.fujitsu.oasysgp\n.fh,image/x-freehand\n.fif,application/fractals\n.fif,image/fif\n.fig,application/x-xfig\n.fli,video/fli\n.fli,video/x-fli\n.flo,application/vnd.micrografx.flo\n.flo,image/florian\n.flv,video/x-flv\n.flw,application/vnd.kde.kivio\n.flx,text/vnd.fmi.flexstor\n.fly,text/vnd.fly\n.fm,application/vnd.framemaker\n.fmf,video/x-atomic3d-feature\n.fnc,application/vnd.frogans.fnc\n.for,text/plain\n.for,text/x-fortran\n.fpx,image/vnd.fpx\n.fpx,image/vnd.net-fpx\n.frl,application/freeloader\n.fsc,application/vnd.fsc.weblaunch\n.fst,image/vnd.fst\n.ftc,application/vnd.fluxtime.clip\n.f,text/plain\n.f,text/x-fortran\n.fti,application/vnd.anser-web-funds-transfer-initiation\n.funk,audio/make\n.fvt,video/vnd.fvt\n.fxp,application/vnd.adobe.fxp\n.fzs,application/vnd.fuzzysheet\n.g2w,application/vnd.geoplan\n.g3,image/g3fax\n.g3w,application/vnd.geospace\n.gac,application/vnd.groove-account\n.gdl,model/vnd.gdl\n.geo,application/vnd.dynageo\n.gex,application/vnd.geometry-explorer\n.ggb,application/vnd.geogebra.file\n.ggt,application/vnd.geogebra.tool\n.ghf,application/vnd.groove-help\n.gif,image/gif\n.gim,application/vnd.groove-identity-message\n.gl,video/gl\n.gl,video/x-gl\n.gmx,application/vnd.gmx\n.gnumeric,application/x-gnumeric\n.gph,application/vnd.flographit\n.gqf,application/vnd.grafeq\n.gram,application/srgs\n.grv,application/vnd.groove-injector\n.grxml,application/srgs+xml\n.gsd,audio/x-gsm\n.gsf,application/x-font-ghostscript\n.gsm,audio/x-gsm\n.gsp,application/x-gsp\n.gss,application/x-gss\n.gtar,application/x-gtar\n.g,text/plain\n.gtm,application/vnd.groove-tool-message\n.gtw,model/vnd.gtw\n.gv,text/vnd.graphviz\n.gxt,application/vnd.geonext\n.gz,application/x-compressed\n.gz,application/x-gzip\n.gzip,application/x-gzip\n.gzip,multipart/x-gzip\n.h261,video/h261\n.h263,video/h263\n.h264,video/h264\n.hal,application/vnd.hal+xml\n.hbci,application/vnd.hbci\n.hdf,application/x-hdf\n.help,application/x-helpfile\n.hgl,application/vnd.hp-hpgl\n.hh,text/plain\n.hh,text/x-h\n.hlb,text/x-script\n.hlp,application/hlp\n.hlp,application/winhlp\n.hlp,application/x-helpfile\n.hlp,application/x-winhelp\n.hpg,application/vnd.hp-hpgl\n.hpgl,application/vnd.hp-hpgl\n.hpid,application/vnd.hp-hpid\n.hps,application/vnd.hp-hps\n.hqx,application/binhex\n.hqx,application/binhex4\n.hqx,application/mac-binhex\n.hqx,application/mac-binhex40\n.hqx,application/x-binhex40\n.hqx,application/x-mac-binhex40\n.hta,application/hta\n.htc,text/x-component\n.h,text/plain\n.h,text/x-h\n.htke,application/vnd.kenameaapp\n.htmls,text/html\n.html,text/html\n.htm,text/html\n.htt,text/webviewhtml\n.htx,text/html\n.hvd,application/vnd.yamaha.hv-dic\n.hvp,application/vnd.yamaha.hv-voice\n.hvs,application/vnd.yamaha.hv-script\n.i2g,application/vnd.intergeo\n.icc,application/vnd.iccprofile\n.ice,x-conference/x-cooltalk\n.ico,image/x-icon\n.ics,text/calendar\n.idc,text/plain\n.ief,image/ief\n.iefs,image/ief\n.iff,application/iff\n.ifm,application/vnd.shana.informed.formdata\n.iges,application/iges\n.iges,model/iges\n.igl,application/vnd.igloader\n.igm,application/vnd.insors.igm\n.igs,application/iges\n.igs,model/iges\n.igx,application/vnd.micrografx.igx\n.iif,application/vnd.shana.informed.interchange\n.ima,application/x-ima\n.imap,application/x-httpd-imap\n.imp,application/vnd.accpac.simply.imp\n.ims,application/vnd.ms-ims\n.inf,application/inf\n.ins,application/x-internett-signup\n.ip,application/x-ip2\n.ipfix,application/ipfix\n.ipk,application/vnd.shana.informed.package\n.irm,application/vnd.ibm.rights-management\n.irp,application/vnd.irepository.package+xml\n.isu,video/x-isvideo\n.it,audio/it\n.itp,application/vnd.shana.informed.formtemplate\n.iv,application/x-inventor\n.ivp,application/vnd.immervision-ivp\n.ivr,i-world/i-vrml\n.ivu,application/vnd.immervision-ivu\n.ivy,application/x-livescreen\n.jad,text/vnd.sun.j2me.app-descriptor\n.jam,application/vnd.jam\n.jam,audio/x-jam\n.jar,application/java-archive\n.java,text/plain\n.java,text/x-java-source\n.jav,text/plain\n.jav,text/x-java-source\n.jcm,application/x-java-commerce\n.jfif,image/jpeg\n.jfif,image/pjpeg\n.jfif-tbnl,image/jpeg\n.jisp,application/vnd.jisp\n.jlt,application/vnd.hp-jlyt\n.jnlp,application/x-java-jnlp-file\n.joda,application/vnd.joost.joda-archive\n.jpeg,image/jpeg\n.jpe,image/jpeg\n.jpg,image/jpeg\n.jpgv,video/jpeg\n.jpm,video/jpm\n.jps,image/x-jps\n.js,application/javascript\n.json,application/json\n.jut,image/jutvision\n.kar,audio/midi\n.karbon,application/vnd.kde.karbon\n.kar,music/x-karaoke\n.key,application/pgp-keys\n.keychain,application/octet-stream\n.kfo,application/vnd.kde.kformula\n.kia,application/vnd.kidspiration\n.kml,application/vnd.google-earth.kml+xml\n.kmz,application/vnd.google-earth.kmz\n.kne,application/vnd.kinar\n.kon,application/vnd.kde.kontour\n.kpr,application/vnd.kde.kpresenter\n.ksh,application/x-ksh\n.ksh,text/x-script.ksh\n.ksp,application/vnd.kde.kspread\n.ktx,image/ktx\n.ktz,application/vnd.kahootz\n.kwd,application/vnd.kde.kword\n.la,audio/nspaudio\n.la,audio/x-nspaudio\n.lam,audio/x-liveaudio\n.lasxml,application/vnd.las.las+xml\n.latex,application/x-latex\n.lbd,application/vnd.llamagraphics.life-balance.desktop\n.lbe,application/vnd.llamagraphics.life-balance.exchange+xml\n.les,application/vnd.hhe.lesson-player\n.lha,application/lha\n.lha,application/x-lha\n.link66,application/vnd.route66.link66+xml\n.list,text/plain\n.lma,audio/nspaudio\n.lma,audio/x-nspaudio\n.log,text/plain\n.lrm,application/vnd.ms-lrm\n.lsp,application/x-lisp\n.lsp,text/x-script.lisp\n.lst,text/plain\n.lsx,text/x-la-asf\n.ltf,application/vnd.frogans.ltf\n.ltx,application/x-latex\n.lvp,audio/vnd.lucent.voice\n.lwp,application/vnd.lotus-wordpro\n.lzh,application/octet-stream\n.lzh,application/x-lzh\n.lzx,application/lzx\n.lzx,application/octet-stream\n.lzx,application/x-lzx\n.m1v,video/mpeg\n.m21,application/mp21\n.m2a,audio/mpeg\n.m2v,video/mpeg\n.m3u8,application/vnd.apple.mpegurl\n.m3u,audio/x-mpegurl\n.m4a,audio/mp4\n.m4v,video/mp4\n.ma,application/mathematica\n.mads,application/mads+xml\n.mag,application/vnd.ecowin.chart\n.man,application/x-troff-man\n.map,application/x-navimap\n.mar,text/plain\n.mathml,application/mathml+xml\n.mbd,application/mbedlet\n.mbk,application/vnd.mobius.mbk\n.mbox,application/mbox\n.mc1,application/vnd.medcalcdata\n.mc$,application/x-magic-cap-package-1.0\n.mcd,application/mcad\n.mcd,application/vnd.mcd\n.mcd,application/x-mathcad\n.mcf,image/vasa\n.mcf,text/mcf\n.mcp,application/netmc\n.mcurl,text/vnd.curl.mcurl\n.mdb,application/x-msaccess\n.mdi,image/vnd.ms-modi\n.me,application/x-troff-me\n.meta4,application/metalink4+xml\n.mets,application/mets+xml\n.mfm,application/vnd.mfmp\n.mgp,application/vnd.osgeo.mapguide.package\n.mgz,application/vnd.proteus.magazine\n.mht,message/rfc822\n.mhtml,message/rfc822\n.mid,application/x-midi\n.mid,audio/midi\n.mid,audio/x-mid\n.midi,application/x-midi\n.midi,audio/midi\n.midi,audio/x-mid\n.midi,audio/x-midi\n.midi,music/crescendo\n.midi,x-music/x-midi\n.mid,music/crescendo\n.mid,x-music/x-midi\n.mif,application/vnd.mif\n.mif,application/x-frame\n.mif,application/x-mif\n.mime,message/rfc822\n.mime,www/mime\n.mj2,video/mj2\n.mjf,audio/x-vnd.audioexplosion.mjuicemediafile\n.mjpg,video/x-motion-jpeg\n.mkv,video/x-matroska\n.mkv,audio/x-matroska\n.mlp,application/vnd.dolby.mlp\n.mm,application/base64\n.mm,application/x-meme\n.mmd,application/vnd.chipnuts.karaoke-mmd\n.mme,application/base64\n.mmf,application/vnd.smaf\n.mmr,image/vnd.fujixerox.edmics-mmr\n.mny,application/x-msmoney\n.mod,audio/mod\n.mod,audio/x-mod\n.mods,application/mods+xml\n.moov,video/quicktime\n.movie,video/x-sgi-movie\n.mov,video/quicktime\n.mp2,audio/mpeg\n.mp2,audio/x-mpeg\n.mp2,video/mpeg\n.mp2,video/x-mpeg\n.mp2,video/x-mpeq2a\n.mp3,audio/mpeg\n.mp3,audio/mpeg3\n.mp4a,audio/mp4\n.mp4,application/mp4\n.mp4,video/mp4\n.mpa,audio/mpeg\n.mpc,application/vnd.mophun.certificate\n.mpc,application/x-project\n.mpeg,video/mpeg\n.mpe,video/mpeg\n.mpga,audio/mpeg\n.mpg,video/mpeg\n.mpg,audio/mpeg\n.mpkg,application/vnd.apple.installer+xml\n.mpm,application/vnd.blueice.multipass\n.mpn,application/vnd.mophun.application\n.mpp,application/vnd.ms-project\n.mpt,application/x-project\n.mpv,application/x-project\n.mpx,application/x-project\n.mpy,application/vnd.ibm.minipay\n.mqy,application/vnd.mobius.mqy\n.mrc,application/marc\n.mrcx,application/marcxml+xml\n.ms,application/x-troff-ms\n.mscml,application/mediaservercontrol+xml\n.mseq,application/vnd.mseq\n.msf,application/vnd.epson.msf\n.msg,application/vnd.ms-outlook\n.msh,model/mesh\n.msl,application/vnd.mobius.msl\n.msty,application/vnd.muvee.style\n.m,text/plain\n.m,text/x-m\n.mts,model/vnd.mts\n.mus,application/vnd.musician\n.musicxml,application/vnd.recordare.musicxml+xml\n.mvb,application/x-msmediaview\n.mv,video/x-sgi-movie\n.mwf,application/vnd.mfer\n.mxf,application/mxf\n.mxl,application/vnd.recordare.musicxml\n.mxml,application/xv+xml\n.mxs,application/vnd.triscape.mxs\n.mxu,video/vnd.mpegurl\n.my,audio/make\n.mzz,application/x-vnd.audioexplosion.mzz\n.n3,text/n3\nN/A,application/andrew-inset\n.nap,image/naplps\n.naplps,image/naplps\n.nbp,application/vnd.wolfram.player\n.nc,application/x-netcdf\n.ncm,application/vnd.nokia.configuration-message\n.ncx,application/x-dtbncx+xml\n.n-gage,application/vnd.nokia.n-gage.symbian.install\n.ngdat,application/vnd.nokia.n-gage.data\n.niff,image/x-niff\n.nif,image/x-niff\n.nix,application/x-mix-transfer\n.nlu,application/vnd.neurolanguage.nlu\n.nml,application/vnd.enliven\n.nnd,application/vnd.noblenet-directory\n.nns,application/vnd.noblenet-sealer\n.nnw,application/vnd.noblenet-web\n.npx,image/vnd.net-fpx\n.nsc,application/x-conference\n.nsf,application/vnd.lotus-notes\n.nvd,application/x-navidoc\n.oa2,application/vnd.fujitsu.oasys2\n.oa3,application/vnd.fujitsu.oasys3\n.o,application/octet-stream\n.oas,application/vnd.fujitsu.oasys\n.obd,application/x-msbinder\n.oda,application/oda\n.odb,application/vnd.oasis.opendocument.database\n.odc,application/vnd.oasis.opendocument.chart\n.odf,application/vnd.oasis.opendocument.formula\n.odft,application/vnd.oasis.opendocument.formula-template\n.odg,application/vnd.oasis.opendocument.graphics\n.odi,application/vnd.oasis.opendocument.image\n.odm,application/vnd.oasis.opendocument.text-master\n.odp,application/vnd.oasis.opendocument.presentation\n.ods,application/vnd.oasis.opendocument.spreadsheet\n.odt,application/vnd.oasis.opendocument.text\n.oga,audio/ogg\n.ogg,audio/ogg\n.ogv,video/ogg\n.ogx,application/ogg\n.omc,application/x-omc\n.omcd,application/x-omcdatamaker\n.omcr,application/x-omcregerator\n.onetoc,application/onenote\n.opf,application/oebps-package+xml\n.org,application/vnd.lotus-organizer\n.osf,application/vnd.yamaha.openscoreformat\n.osfpvg,application/vnd.yamaha.openscoreformat.osfpvg+xml\n.otc,application/vnd.oasis.opendocument.chart-template\n.otf,application/x-font-otf\n.otg,application/vnd.oasis.opendocument.graphics-template\n.oth,application/vnd.oasis.opendocument.text-web\n.oti,application/vnd.oasis.opendocument.image-template\n.otp,application/vnd.oasis.opendocument.presentation-template\n.ots,application/vnd.oasis.opendocument.spreadsheet-template\n.ott,application/vnd.oasis.opendocument.text-template\n.oxt,application/vnd.openofficeorg.extension\n.p10,application/pkcs10\n.p12,application/pkcs-12\n.p7a,application/x-pkcs7-signature\n.p7b,application/x-pkcs7-certificates\n.p7c,application/pkcs7-mime\n.p7m,application/pkcs7-mime\n.p7r,application/x-pkcs7-certreqresp\n.p7s,application/pkcs7-signature\n.p8,application/pkcs8\n.pages,application/vnd.apple.pages\n.part,application/pro_eng\n.par,text/plain-bas\n.pas,text/pascal\n.paw,application/vnd.pawaafile\n.pbd,application/vnd.powerbuilder6\n.pbm,image/x-portable-bitmap\n.pcf,application/x-font-pcf\n.pcl,application/vnd.hp-pcl\n.pcl,application/x-pcl\n.pclxl,application/vnd.hp-pclxl\n.pct,image/x-pict\n.pcurl,application/vnd.curl.pcurl\n.pcx,image/x-pcx\n.pdb,application/vnd.palm\n.pdb,chemical/x-pdb\n.pdf,application/pdf\n.pem,application/x-pem-file\n.pfa,application/x-font-type1\n.pfr,application/font-tdpfr\n.pfunk,audio/make\n.pfunk,audio/make.my.funk\n.pfx,application/x-pkcs12\n.pgm,image/x-portable-graymap\n.pgn,application/x-chess-pgn\n.pgp,application/pgp-signature\n.pic,image/pict\n.pict,image/pict\n.pkg,application/x-newton-compatible-pkg\n.pki,application/pkixcmp\n.pkipath,application/pkix-pkipath\n.pko,application/vnd.ms-pki.pko\n.plb,application/vnd.3gpp.pic-bw-large\n.plc,application/vnd.mobius.plc\n.plf,application/vnd.pocketlearn\n.pls,application/pls+xml\n.pl,text/plain\n.pl,text/x-script.perl\n.plx,application/x-pixclscript\n.pm4,application/x-pagemaker\n.pm5,application/x-pagemaker\n.pm,image/x-xpixmap\n.pml,application/vnd.ctc-posml\n.pm,text/x-script.perl-module\n.png,image/png\n.pnm,application/x-portable-anymap\n.pnm,image/x-portable-anymap\n.portpkg,application/vnd.macports.portpkg\n.pot,application/mspowerpoint\n.pot,application/vnd.ms-powerpoint\n.potm,application/vnd.ms-powerpoint.template.macroenabled.12\n.potx,application/vnd.openxmlformats-officedocument.presentationml.template\n.pov,model/x-pov\n.ppa,application/vnd.ms-powerpoint\n.ppam,application/vnd.ms-powerpoint.addin.macroenabled.12\n.ppd,application/vnd.cups-ppd\n.ppm,image/x-portable-pixmap\n.pps,application/mspowerpoint\n.pps,application/vnd.ms-powerpoint\n.ppsm,application/vnd.ms-powerpoint.slideshow.macroenabled.12\n.ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow\n.ppt,application/mspowerpoint\n.ppt,application/powerpoint\n.ppt,application/vnd.ms-powerpoint\n.ppt,application/x-mspowerpoint\n.pptm,application/vnd.ms-powerpoint.presentation.macroenabled.12\n.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation\n.ppz,application/mspowerpoint\n.prc,application/x-mobipocket-ebook\n.pre,application/vnd.lotus-freelance\n.pre,application/x-freelance\n.prf,application/pics-rules\n.prt,application/pro_eng\n.ps,application/postscript\n.psb,application/vnd.3gpp.pic-bw-small\n.psd,application/octet-stream\n.psd,image/vnd.adobe.photoshop\n.psf,application/x-font-linux-psf\n.pskcxml,application/pskc+xml\n.p,text/x-pascal\n.ptid,application/vnd.pvi.ptid1\n.pub,application/x-mspublisher\n.pvb,application/vnd.3gpp.pic-bw-var\n.pvu,paleovu/x-pv\n.pwn,application/vnd.3m.post-it-notes\n.pwz,application/vnd.ms-powerpoint\n.pya,audio/vnd.ms-playready.media.pya\n.pyc,applicaiton/x-bytecode.python\n.py,text/x-script.phyton\n.pyv,video/vnd.ms-playready.media.pyv\n.qam,application/vnd.epson.quickanime\n.qbo,application/vnd.intu.qbo\n.qcp,audio/vnd.qcelp\n.qd3d,x-world/x-3dmf\n.qd3,x-world/x-3dmf\n.qfx,application/vnd.intu.qfx\n.qif,image/x-quicktime\n.qps,application/vnd.publishare-delta-tree\n.qtc,video/x-qtc\n.qtif,image/x-quicktime\n.qti,image/x-quicktime\n.qt,video/quicktime\n.qxd,application/vnd.quark.quarkxpress\n.ra,audio/x-pn-realaudio\n.ra,audio/x-pn-realaudio-plugin\n.ra,audio/x-realaudio\n.ram,audio/x-pn-realaudio\n.rar,application/x-rar-compressed\n.ras,application/x-cmu-raster\n.ras,image/cmu-raster\n.ras,image/x-cmu-raster\n.rast,image/cmu-raster\n.rcprofile,application/vnd.ipunplugged.rcprofile\n.rdf,application/rdf+xml\n.rdz,application/vnd.data-vision.rdz\n.rep,application/vnd.businessobjects\n.res,application/x-dtbresource+xml\n.rexx,text/x-script.rexx\n.rf,image/vnd.rn-realflash\n.rgb,image/x-rgb\n.rif,application/reginfo+xml\n.rip,audio/vnd.rip\n.rl,application/resource-lists+xml\n.rlc,image/vnd.fujixerox.edmics-rlc\n.rld,application/resource-lists-diff+xml\n.rm,application/vnd.rn-realmedia\n.rm,audio/x-pn-realaudio\n.rmi,audio/mid\n.rmm,audio/x-pn-realaudio\n.rmp,audio/x-pn-realaudio\n.rmp,audio/x-pn-realaudio-plugin\n.rms,application/vnd.jcp.javame.midlet-rms\n.rnc,application/relax-ng-compact-syntax\n.rng,application/ringing-tones\n.rng,application/vnd.nokia.ringing-tone\n.rnx,application/vnd.rn-realplayer\n.roff,application/x-troff\n.rp9,application/vnd.cloanto.rp9\n.rp,image/vnd.rn-realpix\n.rpm,audio/x-pn-realaudio-plugin\n.rpm,application/x-rpm\n.rpss,application/vnd.nokia.radio-presets\n.rpst,application/vnd.nokia.radio-preset\n.rq,application/sparql-query\n.rs,application/rls-services+xml\n.rsd,application/rsd+xml\n.rss,application/rss+xml\n.rtf,application/rtf\n.rtf,text/rtf\n.rt,text/richtext\n.rt,text/vnd.rn-realtext\n.rtx,application/rtf\n.rtx,text/richtext\n.rv,video/vnd.rn-realvideo\n.s3m,audio/s3m\n.saf,application/vnd.yamaha.smaf-audio\n.saveme,application/octet-stream\n.sbk,application/x-tbook\n.sbml,application/sbml+xml\n.sc,application/vnd.ibm.secure-container\n.scd,application/x-msschedule\n.scm,application/vnd.lotus-screencam\n.scm,application/x-lotusscreencam\n.scm,text/x-script.guile\n.scm,text/x-script.scheme\n.scm,video/x-scm\n.scq,application/scvp-cv-request\n.scs,application/scvp-cv-response\n.scurl,text/vnd.curl.scurl\n.sda,application/vnd.stardivision.draw\n.sdc,application/vnd.stardivision.calc\n.sdd,application/vnd.stardivision.impress\n.sdf,application/octet-stream\n.sdkm,application/vnd.solent.sdkm+xml\n.sdml,text/plain\n.sdp,application/sdp\n.sdp,application/x-sdp\n.sdr,application/sounder\n.sdw,application/vnd.stardivision.writer\n.sea,application/sea\n.sea,application/x-sea\n.see,application/vnd.seemail\n.seed,application/vnd.fdsn.seed\n.sema,application/vnd.sema\n.semd,application/vnd.semd\n.semf,application/vnd.semf\n.ser,application/java-serialized-object\n.set,application/set\n.setpay,application/set-payment-initiation\n.setreg,application/set-registration-initiation\n.sfd-hdstx,application/vnd.hydrostatix.sof-data\n.sfs,application/vnd.spotfire.sfs\n.sgl,application/vnd.stardivision.writer-global\n.sgml,text/sgml\n.sgml,text/x-sgml\n.sgm,text/sgml\n.sgm,text/x-sgml\n.sh,application/x-bsh\n.sh,application/x-sh\n.sh,application/x-shar\n.shar,application/x-bsh\n.shar,application/x-shar\n.shf,application/shf+xml\n.sh,text/x-script.sh\n.shtml,text/html\n.shtml,text/x-server-parsed-html\n.sid,audio/x-psid\n.sis,application/vnd.symbian.install\n.sit,application/x-sit\n.sit,application/x-stuffit\n.sitx,application/x-stuffitx\n.skd,application/x-koan\n.skm,application/x-koan\n.skp,application/vnd.koan\n.skp,application/x-koan\n.skt,application/x-koan\n.sl,application/x-seelogo\n.sldm,application/vnd.ms-powerpoint.slide.macroenabled.12\n.sldx,application/vnd.openxmlformats-officedocument.presentationml.slide\n.slt,application/vnd.epson.salt\n.sm,application/vnd.stepmania.stepchart\n.smf,application/vnd.stardivision.math\n.smi,application/smil\n.smi,application/smil+xml\n.smil,application/smil\n.snd,audio/basic\n.snd,audio/x-adpcm\n.snf,application/x-font-snf\n.sol,application/solids\n.spc,application/x-pkcs7-certificates\n.spc,text/x-speech\n.spf,application/vnd.yamaha.smaf-phrase\n.spl,application/futuresplash\n.spl,application/x-futuresplash\n.spot,text/vnd.in3d.spot\n.spp,application/scvp-vp-response\n.spq,application/scvp-vp-request\n.spr,application/x-sprite\n.sprite,application/x-sprite\n.src,application/x-wais-source\n.srt,text/srt\n.sru,application/sru+xml\n.srx,application/sparql-results+xml\n.sse,application/vnd.kodak-descriptor\n.ssf,application/vnd.epson.ssf\n.ssi,text/x-server-parsed-html\n.ssm,application/streamingmedia\n.ssml,application/ssml+xml\n.sst,application/vnd.ms-pki.certstore\n.st,application/vnd.sailingtracker.track\n.stc,application/vnd.sun.xml.calc.template\n.std,application/vnd.sun.xml.draw.template\n.step,application/step\n.s,text/x-asm\n.stf,application/vnd.wt.stf\n.sti,application/vnd.sun.xml.impress.template\n.stk,application/hyperstudio\n.stl,application/sla\n.stl,application/vnd.ms-pki.stl\n.stl,application/x-navistyle\n.stp,application/step\n.str,application/vnd.pg.format\n.stw,application/vnd.sun.xml.writer.template\n.sub,image/vnd.dvb.subtitle\n.sus,application/vnd.sus-calendar\n.sv4cpio,application/x-sv4cpio\n.sv4crc,application/x-sv4crc\n.svc,application/vnd.dvb.service\n.svd,application/vnd.svd\n.svf,image/vnd.dwg\n.svf,image/x-dwg\n.svg,image/svg+xml\n.svr,application/x-world\n.svr,x-world/x-svr\n.swf,application/x-shockwave-flash\n.swi,application/vnd.aristanetworks.swi\n.sxc,application/vnd.sun.xml.calc\n.sxd,application/vnd.sun.xml.draw\n.sxg,application/vnd.sun.xml.writer.global\n.sxi,application/vnd.sun.xml.impress\n.sxm,application/vnd.sun.xml.math\n.sxw,application/vnd.sun.xml.writer\n.talk,text/x-speech\n.tao,application/vnd.tao.intent-module-archive\n.t,application/x-troff\n.tar,application/x-tar\n.tbk,application/toolbook\n.tbk,application/x-tbook\n.tcap,application/vnd.3gpp2.tcap\n.tcl,application/x-tcl\n.tcl,text/x-script.tcl\n.tcsh,text/x-script.tcsh\n.teacher,application/vnd.smart.teacher\n.tei,application/tei+xml\n.tex,application/x-tex\n.texi,application/x-texinfo\n.texinfo,application/x-texinfo\n.text,text/plain\n.tfi,application/thraud+xml\n.tfm,application/x-tex-tfm\n.tgz,application/gnutar\n.tgz,application/x-compressed\n.thmx,application/vnd.ms-officetheme\n.tiff,image/tiff\n.tif,image/tiff\n.tmo,application/vnd.tmobile-livetv\n.torrent,application/x-bittorrent\n.tpl,application/vnd.groove-tool-template\n.tpt,application/vnd.trid.tpt\n.tra,application/vnd.trueapp\n.tr,application/x-troff\n.trm,application/x-msterminal\n.tsd,application/timestamped-data\n.tsi,audio/tsp-audio\n.tsp,application/dsptype\n.tsp,audio/tsplayer\n.tsv,text/tab-separated-values\n.t,text/troff\n.ttf,application/x-font-ttf\n.ttl,text/turtle\n.turbot,image/florian\n.twd,application/vnd.simtech-mindmapper\n.txd,application/vnd.genomatix.tuxedo\n.txf,application/vnd.mobius.txf\n.txt,text/plain\n.ufd,application/vnd.ufdl\n.uil,text/x-uil\n.umj,application/vnd.umajin\n.unis,text/uri-list\n.uni,text/uri-list\n.unityweb,application/vnd.unity\n.unv,application/i-deas\n.uoml,application/vnd.uoml+xml\n.uris,text/uri-list\n.uri,text/uri-list\n.ustar,application/x-ustar\n.ustar,multipart/x-ustar\n.utz,application/vnd.uiq.theme\n.uu,application/octet-stream\n.uue,text/x-uuencode\n.uu,text/x-uuencode\n.uva,audio/vnd.dece.audio\n.uvh,video/vnd.dece.hd\n.uvi,image/vnd.dece.graphic\n.uvm,video/vnd.dece.mobile\n.uvp,video/vnd.dece.pd\n.uvs,video/vnd.dece.sd\n.uvu,video/vnd.uvvu.mp4\n.uvv,video/vnd.dece.video\n.vcd,application/x-cdlink\n.vcf,text/x-vcard\n.vcg,application/vnd.groove-vcard\n.vcs,text/x-vcalendar\n.vcx,application/vnd.vcx\n.vda,application/vda\n.vdo,video/vdo\n.vew,application/groupwise\n.vis,application/vnd.visionary\n.vivo,video/vivo\n.vivo,video/vnd.vivo\n.viv,video/vivo\n.viv,video/vnd.vivo\n.vmd,application/vocaltec-media-desc\n.vmf,application/vocaltec-media-file\n.vob,video/dvd\n.voc,audio/voc\n.voc,audio/x-voc\n.vos,video/vosaic\n.vox,audio/voxware\n.vqe,audio/x-twinvq-plugin\n.vqf,audio/x-twinvq\n.vql,audio/x-twinvq-plugin\n.vrml,application/x-vrml\n.vrml,model/vrml\n.vrml,x-world/x-vrml\n.vrt,x-world/x-vrt\n.vsd,application/vnd.visio\n.vsd,application/x-visio\n.vsf,application/vnd.vsf\n.vst,application/x-visio\n.vsw,application/x-visio\n.vtt,text/vtt\n.vtu,model/vnd.vtu\n.vxml,application/voicexml+xml\n.w60,application/wordperfect6.0\n.w61,application/wordperfect6.1\n.w6w,application/msword\n.wad,application/x-doom\n.war,application/zip\n.wasm,application/wasm\n.wav,audio/wav\n.wax,audio/x-ms-wax\n.wb1,application/x-qpro\n.wbmp,image/vnd.wap.wbmp\n.wbs,application/vnd.criticaltools.wbs+xml\n.wbxml,application/vnd.wap.wbxml\n.weba,audio/webm\n.web,application/vnd.xara\n.webm,video/webm\n.webp,image/webp\n.wg,application/vnd.pmi.widget\n.wgt,application/widget\n.wiz,application/msword\n.wk1,application/x-123\n.wma,audio/x-ms-wma\n.wmd,application/x-ms-wmd\n.wmf,application/x-msmetafile\n.wmf,windows/metafile\n.wmlc,application/vnd.wap.wmlc\n.wmlsc,application/vnd.wap.wmlscriptc\n.wmls,text/vnd.wap.wmlscript\n.wml,text/vnd.wap.wml\n.wm,video/x-ms-wm\n.wmv,video/x-ms-wmv\n.wmx,video/x-ms-wmx\n.wmz,application/x-ms-wmz\n.woff,application/x-font-woff\n.word,application/msword\n.wp5,application/wordperfect\n.wp5,application/wordperfect6.0\n.wp6,application/wordperfect\n.wp,application/wordperfect\n.wpd,application/vnd.wordperfect\n.wpd,application/wordperfect\n.wpd,application/x-wpwin\n.wpl,application/vnd.ms-wpl\n.wps,application/vnd.ms-works\n.wq1,application/x-lotus\n.wqd,application/vnd.wqd\n.wri,application/mswrite\n.wri,application/x-mswrite\n.wri,application/x-wri\n.wrl,application/x-world\n.wrl,model/vrml\n.wrl,x-world/x-vrml\n.wrz,model/vrml\n.wrz,x-world/x-vrml\n.wsc,text/scriplet\n.wsdl,application/wsdl+xml\n.wspolicy,application/wspolicy+xml\n.wsrc,application/x-wais-source\n.wtb,application/vnd.webturbo\n.wtk,application/x-wintalk\n.wvx,video/x-ms-wvx\n.x3d,application/vnd.hzn-3d-crossword\n.xap,application/x-silverlight-app\n.xar,application/vnd.xara\n.xbap,application/x-ms-xbap\n.xbd,application/vnd.fujixerox.docuworks.binder\n.xbm,image/xbm\n.xbm,image/x-xbitmap\n.xbm,image/x-xbm\n.xdf,application/xcap-diff+xml\n.xdm,application/vnd.syncml.dm+xml\n.xdp,application/vnd.adobe.xdp+xml\n.xdr,video/x-amt-demorun\n.xdssc,application/dssc+xml\n.xdw,application/vnd.fujixerox.docuworks\n.xenc,application/xenc+xml\n.xer,application/patch-ops-error+xml\n.xfdf,application/vnd.adobe.xfdf\n.xfdl,application/vnd.xfdl\n.xgz,xgl/drawing\n.xhtml,application/xhtml+xml\n.xif,image/vnd.xiff\n.xla,application/excel\n.xla,application/x-excel\n.xla,application/x-msexcel\n.xlam,application/vnd.ms-excel.addin.macroenabled.12\n.xl,application/excel\n.xlb,application/excel\n.xlb,application/vnd.ms-excel\n.xlb,application/x-excel\n.xlc,application/excel\n.xlc,application/vnd.ms-excel\n.xlc,application/x-excel\n.xld,application/excel\n.xld,application/x-excel\n.xlk,application/excel\n.xlk,application/x-excel\n.xll,application/excel\n.xll,application/vnd.ms-excel\n.xll,application/x-excel\n.xlm,application/excel\n.xlm,application/vnd.ms-excel\n.xlm,application/x-excel\n.xls,application/excel\n.xls,application/vnd.ms-excel\n.xls,application/x-excel\n.xls,application/x-msexcel\n.xlsb,application/vnd.ms-excel.sheet.binary.macroenabled.12\n.xlsm,application/vnd.ms-excel.sheet.macroenabled.12\n.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\n.xlt,application/excel\n.xlt,application/x-excel\n.xltm,application/vnd.ms-excel.template.macroenabled.12\n.xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template\n.xlv,application/excel\n.xlv,application/x-excel\n.xlw,application/excel\n.xlw,application/vnd.ms-excel\n.xlw,application/x-excel\n.xlw,application/x-msexcel\n.xm,audio/xm\n.xml,application/xml\n.xml,text/xml\n.xmz,xgl/movie\n.xo,application/vnd.olpc-sugar\n.xop,application/xop+xml\n.xpi,application/x-xpinstall\n.xpix,application/x-vnd.ls-xpix\n.xpm,image/xpm\n.xpm,image/x-xpixmap\n.x-png,image/png\n.xpr,application/vnd.is-xpr\n.xps,application/vnd.ms-xpsdocument\n.xpw,application/vnd.intercon.formnet\n.xslt,application/xslt+xml\n.xsm,application/vnd.syncml+xml\n.xspf,application/xspf+xml\n.xsr,video/x-amt-showrun\n.xul,application/vnd.mozilla.xul+xml\n.xwd,image/x-xwd\n.xwd,image/x-xwindowdump\n.xyz,chemical/x-pdb\n.xyz,chemical/x-xyz\n.xz,application/x-xz\n.yaml,text/yaml\n.yang,application/yang\n.yin,application/yin+xml\n.z,application/x-compress\n.z,application/x-compressed\n.zaz,application/vnd.zzazz.deck+xml\n.zip,application/zip\n.zip,application/x-compressed\n.zip,application/x-zip-compressed\n.zip,multipart/x-zip\n.zir,application/vnd.zul\n.zmm,application/vnd.handheld-entertainment+xml\n.zoo,application/octet-stream\n.zsh,text/x-script.zsh\n"),ni))}function ri(){return Kn.value}function oi(){li()}function ai(){si=this,this.Empty=hi()}Yn.$metadata$={kind:h,simpleName:"HttpStatusCode",interfaces:[]},Yn.prototype.component1=function(){return this.value},Yn.prototype.component2=function(){return this.description},Yn.prototype.copy_19mbxw$=function(t,e){return new Yn(void 0===t?this.value:t,void 0===e?this.description:e)},ai.prototype.build_itqcaa$=ht("ktor-ktor-http.io.ktor.http.Parameters.Companion.build_itqcaa$",_t((function(){var e=t.io.ktor.http.ParametersBuilder;return function(t){var n=new e;return t(n),n.build()}}))),ai.$metadata$={kind:M,simpleName:"Companion",interfaces:[]};var si=null;function li(){return null===si&&new ai,si}function ui(t){void 0===t&&(t=8),St.call(this,!0,t)}function ci(){pi=this}oi.$metadata$={kind:Et,simpleName:"Parameters",interfaces:[Ct]},ui.prototype.build=function(){if(this.built)throw it("ParametersBuilder can only build a single Parameters instance".toString());return this.built=!0,new _i(this.values)},ui.$metadata$={kind:h,simpleName:"ParametersBuilder",interfaces:[St]},Object.defineProperty(ci.prototype,"caseInsensitiveName",{get:function(){return!0}}),ci.prototype.getAll_61zpoe$=function(t){return null},ci.prototype.names=function(){return Tt()},ci.prototype.entries=function(){return Tt()},ci.prototype.isEmpty=function(){return!0},ci.prototype.toString=function(){return"Parameters "+this.entries()},ci.prototype.equals=function(t){return e.isType(t,oi)&&t.isEmpty()},ci.$metadata$={kind:M,simpleName:"EmptyParameters",interfaces:[oi]};var pi=null;function hi(){return null===pi&&new ci,pi}function _i(t){void 0===t&&(t=X()),Pt.call(this,!0,t)}function fi(t,e,n){var i;if(void 0===e&&(e=0),void 0===n&&(n=1e3),e>It(t))i=li().Empty;else{var r=new ui;(function(t,e,n,i){var r,o=0,a=n,s=-1;r=It(e);for(var l=n;l<=r;l++){if(o===i)return;switch(e.charCodeAt(l)){case 38:di(t,e,a,s,l),a=l+1|0,s=-1,o=o+1|0;break;case 61:-1===s&&(s=l)}}o!==i&&di(t,e,a,s,e.length)})(r,t,e,n),i=r.build()}return i}function di(t,e,n,i,r){if(-1===i){var o=yi(n,r,e),a=mi(o,r,e);if(a>o){var s=me(e,o,a);t.appendAll_poujtz$(s,B())}}else{var l=yi(n,i,e),u=mi(l,i,e);if(u>l){var c=me(e,l,u),p=yi(i+1|0,r,e),h=me(e,p,mi(p,r,e),!0);t.append_puj7f4$(c,h)}}}function mi(t,e,n){for(var i=e;i>t&&rt(n.charCodeAt(i-1|0));)i=i-1|0;return i}function yi(t,e,n){for(var i=t;i0&&(t.append_s8itvh$(35),t.append_gw00v9$(he(this.fragment))),t},$i.prototype.buildString=function(){return this.appendTo_0(S(256)).toString()},$i.prototype.build=function(){return new xi(this.protocol,this.host,this.port,this.encodedPath,this.parameters.build(),this.fragment,this.user,this.password,this.trailingQuery)},gi.$metadata$={kind:M,simpleName:"Companion",interfaces:[]};var bi=null;function wi(){return null===bi&&new gi,bi}function xi(t,e,n,i,r,o,a,s,l){var u;if(Ci(),this.protocol=t,this.host=e,this.specifiedPort=n,this.encodedPath=i,this.parameters=r,this.fragment=o,this.user=a,this.password=s,this.trailingQuery=l,!(1<=(u=this.specifiedPort)&&u<=65536||0===this.specifiedPort))throw it("port must be between 1 and 65536, or 0 if not set".toString())}function ki(){Ei=this}$i.$metadata$={kind:h,simpleName:"URLBuilder",interfaces:[]},Object.defineProperty(xi.prototype,"port",{get:function(){var t,e=this.specifiedPort;return null!=(t=0!==e?e:null)?t:this.protocol.defaultPort}}),xi.prototype.toString=function(){var t=P();return t.append_gw00v9$(this.protocol.name),t.append_gw00v9$("://"),t.append_gw00v9$(Si(this)),t.append_gw00v9$(Bi(this)),this.fragment.length>0&&(t.append_s8itvh$(35),t.append_gw00v9$(this.fragment)),t.toString()},ki.$metadata$={kind:M,simpleName:"Companion",interfaces:[]};var Ei=null;function Ci(){return null===Ei&&new ki,Ei}function Si(t){var e=P();return null!=t.user&&(e.append_gw00v9$(de(t.user)),null!=t.password&&(e.append_s8itvh$(58),e.append_gw00v9$(de(t.password))),e.append_s8itvh$(64)),0===t.specifiedPort?e.append_gw00v9$(t.host):e.append_gw00v9$(Ui(t)),e.toString()}function Ti(t){var e,n,i=P();return null!=(e=t.user)&&(i.append_gw00v9$(de(e)),null!=(n=t.password)&&(i.append_gw00v9$(":"),i.append_gw00v9$(de(n))),i.append_gw00v9$("@")),i.append_gw00v9$(t.host),0!==t.port&&t.port!==t.protocol.defaultPort&&(i.append_gw00v9$(":"),i.append_gw00v9$(t.port.toString())),i.toString()}function Oi(t,e){mt.call(this,"Fail to parse url: "+t,e),this.name="URLParserException"}function Ni(t,e){var n,i,r,o,a;t:do{var s,l,u,c;l=(s=Yt(e)).first,u=s.last,c=s.step;for(var p=l;p<=u;p+=c)if(!rt(v(b(e.charCodeAt(p))))){a=p;break t}a=-1}while(0);var h,_=a;t:do{var f;for(f=Vt(Yt(e)).iterator();f.hasNext();){var d=f.next();if(!rt(v(b(e.charCodeAt(d))))){h=d;break t}}h=-1}while(0);var m=h+1|0,y=function(t,e,n){for(var i=e;i0){var $=_,g=_+y|0,w=e.substring($,g);t.protocol=Mi().createOrDefault_61zpoe$(w),_=_+(y+1)|0}var x=function(t,e,n,i){for(var r=0;(e+r|0)=2)t:for(;;){var k=Gt(e,yt("@/\\?#"),_),E=null!=(n=k>0?k:null)?n:m;if(!(E=m)return t.encodedPath=47===e.charCodeAt(m-1|0)?"/":"",t;if(0===x){var P=Ht(t.encodedPath,47);if(P!==(t.encodedPath.length-1|0))if(-1!==P){var A=P+1|0;i=t.encodedPath.substring(0,A)}else i="/";else i=t.encodedPath}else i="";t.encodedPath=i;var j,L=Gt(e,yt("?#"),_),R=null!=(r=L>0?L:null)?r:m,I=_,z=e.substring(I,R);if(t.encodedPath+=fe(z),(_=R)0?D:null)?o:m,B=_+1|0;fi(e.substring(B,M)).forEach_ubvtmq$((j=t,function(t,e){return j.parameters.appendAll_poujtz$(t,e),C})),_=M}if(_0?o:null)?r:i;if(t.host=e.substring(n,a),(a+1|0)@;:/\\\\"\\[\\]\\?=\\{\\}\\s]+)\\s*(=\\s*("[^"]*"|[^;]*))?'),Z([b(59),b(44),b(34)]),w(["***, dd MMM YYYY hh:mm:ss zzz","****, dd-MMM-YYYY hh:mm:ss zzz","*** MMM d hh:mm:ss YYYY","***, dd-MMM-YYYY hh:mm:ss zzz","***, dd-MMM-YYYY hh-mm-ss zzz","***, dd MMM YYYY hh:mm:ss zzz","*** dd-MMM-YYYY hh:mm:ss zzz","*** dd MMM YYYY hh:mm:ss zzz","*** dd-MMM-YYYY hh-mm-ss zzz","***,dd-MMM-YYYY hh:mm:ss zzz","*** MMM d YYYY hh:mm:ss zzz"]),bt((function(){var t=vt();return t.putAll_a2k3zr$(Je(gt(ri()))),t})),bt((function(){return Je(nt(gt(ri()),Ze))})),Sr(vr(yr($r(yr($r(yr($r(Er(),"."),Er()),"."),Er()),"."),Er()),$r(mr("[",br(gr(kr(),":"))),"]"))),Kn=bt((function(){return ii()})),'("((\\\\.)|[^\\\\"])*")|[^\\s,]*',Ii=pt("[a-zA-Z0-9\\-._~+/]+=*"),pt("\\S+"),pt("\\s*,?\\s*("+Ii+')\\s*=\\s*(("((\\\\.)|[^\\\\"])*")|[^\\s,]*)\\s*,?\\s*'),pt("\\\\."),new Jt("Caching"),zi="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",t})?i.apply(e,r):i)||(t.exports=o)},276:function(t,e,n){var i,r,o;r=[e,n(421),n(197)],void 0===(o="function"==typeof(i=function(t,e,i){"use strict";var r=t.$$importsForInline$$||(t.$$importsForInline$$={}),o=e.Kind.INTERFACE,a=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,s=e.kotlin.coroutines.CoroutineImpl,l=e.Long.MAX_VALUE,u=e.Long.ZERO,c=e.throwCCE,p=e.Kind.CLASS,h=e.kotlin.Unit,_=e.equals,f=e.ensureNotNull,d=e.toByte,m=e.kotlin.text.StringBuilder_init,y=i.kotlinx.coroutines.CancellationException_init_pdl1vj$,$=e.Long.fromInt(4088),v=e.kotlin.ranges.coerceAtMost_2p08ub$,g=Math,b=e.kotlin.IllegalArgumentException_init_pdl1vj$,w=e.defineInlineFunction,x=e.wrapFunction,k=e.toShort,E=i.kotlinx.coroutines.CancellationException,C=Error,S=i.kotlinx.coroutines.Job,T=i.kotlinx.coroutines.CoroutineScope,O=e.kotlin.coroutines,N=i.kotlinx.coroutines,P=i.kotlinx.coroutines.newCoroutineContext_7n4184$,A=i.kotlinx.coroutines.CoroutineScope_1fupul$,j=i.kotlinx.coroutines.launch_s496o7$,L=e.kotlin.ranges.coerceAtMost_dqglrj$,R=e.kotlin.UnsupportedOperationException_init_pdl1vj$,I=e.kotlin.UShort,z=e.kotlin.UInt,D=e.kotlin.ULong,M=e.Long.fromInt(16),B=e.kotlin.IllegalStateException_init_pdl1vj$,U=e.kotlin.text.StringBuilder_init_za3lpa$,F=e.kotlin.UnsupportedOperationException_init,q=e.kotlin.text.Appendable,G=e.kotlin.ranges.coerceAtLeast_dqglrj$,H=e.unboxChar,Y=e.Kind.OBJECT,V=e.toChar,K=e.toBoxedChar,W=e.kotlin.Exception_init_pdl1vj$,X=e.kotlin.Exception,Z=e.kotlin.UByte,J=new e.Long(-1,0),Q=e.kotlin.Annotation,tt=e.Long.NEG_ONE,et=e.kotlin.ranges.until_ebnic$,nt=e.floatToRawBits,it=e.doubleToRawBits,rt=e.kotlin.text.contains_sgbm27$,ot=e.kotlin.ranges.coerceAtLeast_2p08ub$,at=e.kotlin.collections.copyOf_mrm5p$,st=e.Long.fromInt(2147483647),lt=e.kotlin.IndexOutOfBoundsException,ut=e.kotlin.CharSequence,ct=e.kotlin.text.isLowSurrogate_myv2d0$,pt=e.kotlin.text.isHighSurrogate_myv2d0$,ht=e.kotlin.Error_init_pdl1vj$,_t=e.kotlin.NotImplementedError,ft=e.toString,dt=e.hashCode,mt=e.Long.ONE,yt=e.kotlin.lazy_klfg04$,$t=e.kotlin.Result,vt=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,gt=e.kotlin.coroutines.SafeContinuation_init_wj8d80$,bt=e.kotlin.text.replace_r2fvfm$,wt=Int8Array,xt=e.kotlin.Enum,kt=e.throwISE,Et=e.kotlin.IndexOutOfBoundsException_init,Ct=Object;function St(){}function Tt(t){this.closure$message=t,Il.call(this)}function Ot(t,e,n){var i;void 0===n&&(n=Nl().Pool),this.autoFlush_tqevpj$_0=e,this.closed=!1,this.writable=new Jo(0,n),this.readable=ia(t,n),this.notFull_8be2vx$=new Bu((i=this,function(){var t=i;return(t.readable.remaining.toInt()+t.writable.size|0)<=$.toNumber()})),this.waitingForSize_acioxj$_0=1,this.atLeastNBytesAvailableForWrite_dspbt2$_0=new Bu(function(t){return function(){return t.availableForWrite>=t.waitingForSize_acioxj$_0||t.closed}}(this)),this.waitingForRead_ad5k18$_0=1,this.atLeastNBytesAvailableForRead_mdv8hx$_0=new Bu(function(t){return function(){return t.availableForRead>=t.waitingForRead_ad5k18$_0||t.closed}}(this)),this.readByteOrder_mxhhha$_0=xp(),this.writeByteOrder_nzwt0f$_0=xp(),this.closedCause_mi5adr$_0=null,this.lastReadAvailable_1j890x$_0=0,this.lastReadView_92ta1h$_0=Nl().Empty}function Nt(t,e,n,i,r){s.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$src=e,this.local$offset=n,this.local$length=i}function Pt(t,e,n){s.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$srcRemaining=void 0,this.local$size=void 0,this.local$src=e}function At(t,e,n,i,r){s.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$size=void 0,this.local$src=e,this.local$offset=n,this.local$length=i}function jt(t,e,n){s.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$visitor=e}function Lt(t){this.this$ByteChannelSequentialBase=t}function Rt(t,e,n){s.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$n=e}function It(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function zt(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t}function Dt(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Mt(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t}function Bt(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Ut(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t}function Ft(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function qt(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t}function Gt(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Ht(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t}function Yt(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Vt(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t}function Kt(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$limit=e,this.local$headerSizeHint=n}function Wt(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$builder=e,this.local$limit=n}function Xt(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$size=e,this.local$headerSizeHint=n}function Zt(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$remaining=void 0,this.local$builder=e,this.local$size=n}function Jt(t,e,n){s.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$dst=e}function Qt(t,e,n){s.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$dst=e}function te(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$n=n}function ee(t){return function(){return"Not enough space in the destination buffer to write "+t+" bytes"}}function ne(){return"n shouldn't be negative"}function ie(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$dst=e,this.local$n=n}function re(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$n=n}function oe(t,e,n,i,r){s.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function ae(t,e,n,i,r){s.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$offset=n,this.local$length=i}function se(t,e,n,i,r){s.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$rc=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function le(t,e,n,i,r){s.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$written=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function ue(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function ce(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t}function pe(t){return function(){return t.afterRead(),h}}function he(t,e,n){s.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$atLeast=e}function _e(t,e,n){s.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$max=e}function fe(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$discarded=void 0,this.local$max=e,this.local$discarded0=n}function de(t,e,n){s.call(this,n),this.exceptionState_0=5,this.$this=t,this.local$consumer=e}function me(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$this$ByteChannelSequentialBase=t,this.local$size=e}function ye(t,e,n){s.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$sb=void 0,this.local$limit=e}function $e(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$n=e,this.local$block=n}function ve(t,e,n){s.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$src=e}function ge(t,e,n,i,r){s.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$src=e,this.local$offset=n,this.local$length=i}function be(t){return function(){return t.flush(),h}}function we(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t}function xe(t,e,n,i,r,o,a,l,u){s.call(this,u),this.$controller=l,this.exceptionState_0=1,this.local$closure$min=t,this.local$closure$offset=e,this.local$closure$max=n,this.local$closure$bytesCopied=i,this.local$closure$destination=r,this.local$closure$destinationOffset=o,this.local$$receiver=a}function ke(t,e,n,i,r,o){return function(a,s,l){var u=new xe(t,e,n,i,r,o,a,this,s);return l?u:u.doResume(null)}}function Ee(t,e,n,i,r,o,a){s.call(this,a),this.exceptionState_0=1,this.$this=t,this.local$bytesCopied=void 0,this.local$destination=e,this.local$destinationOffset=n,this.local$offset=i,this.local$min=r,this.local$max=o}function Ce(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$n=e}function Se(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$dst=e,this.local$limit=n}function Te(t,e,n){return t.writeShort_mq22fl$(k(65535&e),n)}function Oe(t,e,n){return t.writeByte_s8j3t7$(d(255&e),n)}function Ne(t){return t.close_dbl4no$(null)}function Pe(t,e,n){s.call(this,n),this.exceptionState_0=5,this.local$buildPacket$result=void 0,this.local$builder=void 0,this.local$$receiver=t,this.local$builder_0=e}function Ae(t){y(t,this),this.name="ClosedWriteChannelException"}function je(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$byteOrder=e}function Le(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$byteOrder=e}function Re(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$byteOrder=e}function Ie(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$byteOrder=e}function ze(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$byteOrder=e}function De(t,e){s.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function Me(t,e){s.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function Be(t,e){s.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function Ue(t,e){s.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function Fe(t,e){s.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function qe(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$value=e,this.local$byteOrder=n}function Ge(t,e,n,i,r){var o=new qe(t,e,n,i);return r?o:o.doResume(null)}function He(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$value=e,this.local$byteOrder=n}function Ye(t,e,n,i,r){var o=new He(t,e,n,i);return r?o:o.doResume(null)}function Ve(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$value=e,this.local$byteOrder=n}function Ke(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$value=e,this.local$byteOrder=n}function We(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$value=e,this.local$byteOrder=n}function Xe(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$value=e}function Ze(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$value=e}function Je(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$value=e}function Qe(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$value=e}function tn(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$value=e}Ae.prototype=Object.create(E.prototype),Ae.prototype.constructor=Ae,pr.prototype=Object.create(X.prototype),pr.prototype.constructor=pr,Sr.prototype=Object.create(Mh.prototype),Sr.prototype.constructor=Sr,Lo.prototype=Object.create(bu.prototype),Lo.prototype.constructor=Lo,Vo.prototype=Object.create(X.prototype),Vo.prototype.constructor=Vo,Xo.prototype=Object.create(Hi.prototype),Xo.prototype.constructor=Xo,Wo.prototype=Object.create(Xo.prototype),Wo.prototype.constructor=Wo,Jo.prototype=Object.create(Wo.prototype),Jo.prototype.constructor=Jo,ks.prototype=Object.create(Mi.prototype),ks.prototype.constructor=ks,ra.prototype=Object.create(ks.prototype),ra.prototype.constructor=ra,Qo.prototype=Object.create(ra.prototype),Qo.prototype.constructor=Qo,Sl.prototype=Object.create(bu.prototype),Sl.prototype.constructor=Sl,Tl.prototype=Object.create(bu.prototype),Tl.prototype.constructor=Tl,bl.prototype=Object.create(Vi.prototype),bl.prototype.constructor=bl,ru.prototype=Object.create(X.prototype),ru.prototype.constructor=ru,Ou.prototype=Object.create(Ot.prototype),Ou.prototype.constructor=Ou,Zc.prototype=Object.create(Xc.prototype),Zc.prototype.constructor=Zc,rp.prototype=Object.create(ip.prototype),rp.prototype.constructor=rp,dp.prototype=Object.create(Hc.prototype),dp.prototype.constructor=dp,mp.prototype=Object.create(C.prototype),mp.prototype.constructor=mp,bp.prototype=Object.create(xt.prototype),bp.prototype.constructor=bp,Tp.prototype=Object.create(wu.prototype),Tp.prototype.constructor=Tp,Wp.prototype=Object.create(Mh.prototype),Wp.prototype.constructor=Wp,Zp.prototype=Object.create(bu.prototype),Zp.prototype.constructor=Zp,Hp.prototype=Object.create(bl.prototype),Hp.prototype.constructor=Hp,Ch.prototype=Object.create(X.prototype),Ch.prototype.constructor=Ch,Th.prototype=Object.create(Ch.prototype),Th.prototype.constructor=Th,St.$metadata$={kind:o,simpleName:"ByteChannel",interfaces:[Du,ju]},Tt.prototype=Object.create(Il.prototype),Tt.prototype.constructor=Tt,Tt.prototype.doFail=function(){throw b(this.closure$message())},Tt.$metadata$={kind:p,interfaces:[Il]},Object.defineProperty(Ot.prototype,"autoFlush",{get:function(){return this.autoFlush_tqevpj$_0}}),Ot.prototype.totalPending_82umvh$_0=function(){return this.readable.remaining.toInt()+this.writable.size|0},Object.defineProperty(Ot.prototype,"availableForRead",{get:function(){return this.readable.remaining.toInt()}}),Object.defineProperty(Ot.prototype,"availableForWrite",{get:function(){var t=4088-(this.readable.remaining.toInt()+this.writable.size|0)|0;return g.max(0,t)}}),Object.defineProperty(Ot.prototype,"readByteOrder",{get:function(){return this.readByteOrder_mxhhha$_0},set:function(t){this.readByteOrder_mxhhha$_0=t}}),Object.defineProperty(Ot.prototype,"writeByteOrder",{get:function(){return this.writeByteOrder_nzwt0f$_0},set:function(t){this.writeByteOrder_nzwt0f$_0=t}}),Object.defineProperty(Ot.prototype,"isClosedForRead",{get:function(){var t=this.closed;return t&&(t=this.readable.endOfInput),t}}),Object.defineProperty(Ot.prototype,"isClosedForWrite",{get:function(){return this.closed}}),Object.defineProperty(Ot.prototype,"totalBytesRead",{get:function(){return u}}),Object.defineProperty(Ot.prototype,"totalBytesWritten",{get:function(){return u}}),Object.defineProperty(Ot.prototype,"closedCause",{get:function(){return this.closedCause_mi5adr$_0},set:function(t){this.closedCause_mi5adr$_0=t}}),Ot.prototype.flush=function(){this.writable.isNotEmpty&&(au(this.readable,this.writable),this.atLeastNBytesAvailableForRead_mdv8hx$_0.signal())},Ot.prototype.ensureNotClosed_ozgwi5$_0=function(){var t;if(this.closed)throw null!=(t=this.closedCause)?t:new Ae("Channel is already closed")},Ot.prototype.ensureNotFailed_7bddlw$_0=function(){var t;if(null!=(t=this.closedCause))throw t},Ot.prototype.ensureNotFailed_2bmfsh$_0=function(t){var e;if(null!=(e=this.closedCause))throw t.release(),e},Ot.prototype.writeByte_s8j3t7$=function(t,e){return this.writable.writeByte_s8j3t7$(t),this.awaitFreeSpace(e)},Ot.prototype.reverseWrite_hkpayy$_0=function(t,e){return this.writeByteOrder===xp()?t():e()},Ot.prototype.writeShort_mq22fl$=function(t,e){return ms(this.writable,this.writeByteOrder===xp()?t:Hu(t)),this.awaitFreeSpace(e)},Ot.prototype.writeInt_za3lpa$=function(t,e){return ys(this.writable,this.writeByteOrder===xp()?t:Yu(t)),this.awaitFreeSpace(e)},Ot.prototype.writeLong_s8cxhz$=function(t,e){return gs(this.writable,this.writeByteOrder===xp()?t:Vu(t)),this.awaitFreeSpace(e)},Ot.prototype.writeFloat_mx4ult$=function(t,e){return ws(this.writable,this.writeByteOrder===xp()?t:Ku(t)),this.awaitFreeSpace(e)},Ot.prototype.writeDouble_14dthe$=function(t,e){return xs(this.writable,this.writeByteOrder===xp()?t:Wu(t)),this.awaitFreeSpace(e)},Ot.prototype.writePacket_3uq2w4$=function(t,e){return this.writable.writePacket_3uq2w4$(t),this.awaitFreeSpace(e)},Ot.prototype.writeFully_99qa0s$=function(t,n){var i;return this.writeFully_lh221x$(e.isType(i=t,Vi)?i:c(),n)},Ot.prototype.writeFully_lh221x$=function(t,e){return rs(this.writable,t),this.awaitFreeSpace(e)},Nt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Nt.prototype=Object.create(s.prototype),Nt.prototype.constructor=Nt,Nt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(Ja(this.$this.writable,this.local$src,this.local$offset,this.local$length),this.state_0=2,this.result_0=this.$this.awaitFreeSpace(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.writeFully_mj6st8$=function(t,e,n,i,r){var o=new Nt(this,t,e,n,i);return r?o:o.doResume(null)},Pt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Pt.prototype=Object.create(s.prototype),Pt.prototype.constructor=Pt,Pt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$srcRemaining=this.local$src.writePosition-this.local$src.readPosition|0,0===this.local$srcRemaining)return 0;this.state_0=2;continue;case 1:throw this.exception_0;case 2:var t=this.$this.availableForWrite;if(this.local$size=g.min(this.local$srcRemaining,t),0===this.local$size){if(this.state_0=4,this.result_0=this.$this.writeAvailableSuspend_5fukw0$_0(this.local$src,this),this.result_0===a)return a;continue}if(rs(this.$this.writable,this.local$src,this.local$size),this.state_0=3,this.result_0=this.$this.awaitFreeSpace(this),this.result_0===a)return a;continue;case 3:this.local$tmp$=this.local$size,this.state_0=5;continue;case 4:this.local$tmp$=this.result_0,this.state_0=5;continue;case 5:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.writeAvailable_99qa0s$=function(t,e,n){var i=new Pt(this,t,e);return n?i:i.doResume(null)},At.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},At.prototype=Object.create(s.prototype),At.prototype.constructor=At,At.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(0===this.local$length)return 0;this.state_0=2;continue;case 1:throw this.exception_0;case 2:var t=this.$this.availableForWrite;if(this.local$size=g.min(this.local$length,t),0===this.local$size){if(this.state_0=4,this.result_0=this.$this.writeAvailableSuspend_1zn44g$_0(this.local$src,this.local$offset,this.local$length,this),this.result_0===a)return a;continue}if(Ja(this.$this.writable,this.local$src,this.local$offset,this.local$size),this.state_0=3,this.result_0=this.$this.awaitFreeSpace(this),this.result_0===a)return a;continue;case 3:this.local$tmp$=this.local$size,this.state_0=5;continue;case 4:this.local$tmp$=this.result_0,this.state_0=5;continue;case 5:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.writeAvailable_mj6st8$=function(t,e,n,i,r){var o=new At(this,t,e,n,i);return r?o:o.doResume(null)},jt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},jt.prototype=Object.create(s.prototype),jt.prototype.constructor=jt,jt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=this.$this.beginWriteSession();if(this.state_0=2,this.result_0=this.local$visitor(t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.writeSuspendSession_8dv01$=function(t,e,n){var i=new jt(this,t,e);return n?i:i.doResume(null)},Lt.prototype.request_za3lpa$=function(t){var n;return 0===this.this$ByteChannelSequentialBase.availableForWrite?null:e.isType(n=this.this$ByteChannelSequentialBase.writable.prepareWriteHead_za3lpa$(t),Hp)?n:c()},Lt.prototype.written_za3lpa$=function(t){this.this$ByteChannelSequentialBase.writable.afterHeadWrite(),this.this$ByteChannelSequentialBase.afterWrite()},Lt.prototype.flush=function(){this.this$ByteChannelSequentialBase.flush()},Rt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Rt.prototype=Object.create(s.prototype),Rt.prototype.constructor=Rt,Rt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.this$ByteChannelSequentialBase.availableForWrite=this.local$limit.toNumber()){this.state_0=5;continue}var t=this.local$limit.subtract(e.Long.fromInt(this.local$builder.size)),n=this.$this.readable.remaining,i=t.compareTo_11rb$(n)<=0?t:n;if(this.local$builder.writePacket_pi0yjl$(this.$this.readable,i),this.$this.afterRead(),this.$this.ensureNotFailed_2bmfsh$_0(this.local$builder),_(this.$this.readable.remaining,u)&&0===this.$this.writable.size&&this.$this.closed){this.state_0=5;continue}this.state_0=3;continue;case 3:if(this.state_0=4,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===a)return a;continue;case 4:this.state_0=2;continue;case 5:return this.$this.ensureNotFailed_2bmfsh$_0(this.local$builder),this.local$builder.build();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readRemainingSuspend_gfhva8$_0=function(t,e,n,i){var r=new Wt(this,t,e,n);return i?r:r.doResume(null)},Xt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Xt.prototype=Object.create(s.prototype),Xt.prototype.constructor=Xt,Xt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=mh(this.local$headerSizeHint),n=this.local$size,i=e.Long.fromInt(n),r=this.$this.readable.remaining,o=(i.compareTo_11rb$(r)<=0?i:r).toInt();if(n=n-o|0,t.writePacket_f7stg6$(this.$this.readable,o),this.$this.afterRead(),n>0){if(this.state_0=2,this.result_0=this.$this.readPacketSuspend_2ns5o1$_0(t,n,this),this.result_0===a)return a;continue}this.local$tmp$=t.build(),this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readPacket_vux9f0$=function(t,e,n,i){var r=new Xt(this,t,e,n);return i?r:r.doResume(null)},Zt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Zt.prototype=Object.create(s.prototype),Zt.prototype.constructor=Zt,Zt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$remaining=this.local$size,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$remaining<=0){this.state_0=5;continue}var t=e.Long.fromInt(this.local$remaining),n=this.$this.readable.remaining,i=(t.compareTo_11rb$(n)<=0?t:n).toInt();if(this.local$remaining=this.local$remaining-i|0,this.local$builder.writePacket_f7stg6$(this.$this.readable,i),this.$this.afterRead(),this.local$remaining>0){if(this.state_0=3,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===a)return a;continue}this.state_0=4;continue;case 3:this.state_0=4;continue;case 4:this.state_0=2;continue;case 5:return this.local$builder.build();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readPacketSuspend_2ns5o1$_0=function(t,e,n,i){var r=new Zt(this,t,e,n);return i?r:r.doResume(null)},Ot.prototype.readAvailableClosed=function(){var t;if(null!=(t=this.closedCause))throw t;return-1},Ot.prototype.readAvailable_99qa0s$=function(t,n){var i;return this.readAvailable_lh221x$(e.isType(i=t,Vi)?i:c(),n)},Jt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Jt.prototype=Object.create(s.prototype),Jt.prototype.constructor=Jt,Jt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(null!=this.$this.closedCause)throw f(this.$this.closedCause);if(this.$this.readable.canRead()){var t=e.Long.fromInt(this.local$dst.limit-this.local$dst.writePosition|0),n=this.$this.readable.remaining,i=(t.compareTo_11rb$(n)<=0?t:n).toInt();va(this.$this.readable,this.local$dst,i),this.$this.afterRead(),this.local$tmp$=i,this.state_0=5;continue}if(this.$this.closed){this.local$tmp$=this.$this.readAvailableClosed(),this.state_0=4;continue}if(this.local$dst.limit>this.local$dst.writePosition){if(this.state_0=2,this.result_0=this.$this.readAvailableSuspend_b4eait$_0(this.local$dst,this),this.result_0===a)return a;continue}this.local$tmp$=0,this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:this.state_0=4;continue;case 4:this.state_0=5;continue;case 5:this.state_0=6;continue;case 6:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readAvailable_lh221x$=function(t,e,n){var i=new Jt(this,t,e);return n?i:i.doResume(null)},Qt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Qt.prototype=Object.create(s.prototype),Qt.prototype.constructor=Qt,Qt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.readAvailable_lh221x$(this.local$dst,this),this.result_0===a)return a;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readAvailableSuspend_b4eait$_0=function(t,e,n){var i=new Qt(this,t,e);return n?i:i.doResume(null)},te.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},te.prototype=Object.create(s.prototype),te.prototype.constructor=te,te.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.readFully_bkznnu$_0(e.isType(t=this.local$dst,Vi)?t:c(),this.local$n,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readFully_qr0era$=function(t,e,n,i){var r=new te(this,t,e,n);return i?r:r.doResume(null)},ie.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},ie.prototype=Object.create(s.prototype),ie.prototype.constructor=ie,ie.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$n<=(this.local$dst.limit-this.local$dst.writePosition|0)||new Tt(ee(this.local$n)).doFail(),this.local$n>=0||new Tt(ne).doFail(),null!=this.$this.closedCause)throw f(this.$this.closedCause);if(this.$this.readable.remaining.toNumber()>=this.local$n){var t=(va(this.$this.readable,this.local$dst,this.local$n),h);this.$this.afterRead(),this.local$tmp$=t,this.state_0=4;continue}if(this.$this.closed)throw new Th("Channel is closed and not enough bytes available: required "+this.local$n+" but "+this.$this.availableForRead+" available");if(this.state_0=2,this.result_0=this.$this.readFullySuspend_8xotw2$_0(this.local$dst,this.local$n,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:this.state_0=4;continue;case 4:this.state_0=5;continue;case 5:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readFully_bkznnu$_0=function(t,e,n,i){var r=new ie(this,t,e,n);return i?r:r.doResume(null)},re.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},re.prototype=Object.create(s.prototype),re.prototype.constructor=re,re.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(this.local$n,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.readFully_bkznnu$_0(this.local$dst,this.local$n,this),this.result_0===a)return a;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readFullySuspend_8xotw2$_0=function(t,e,n,i){var r=new re(this,t,e,n);return i?r:r.doResume(null)},oe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},oe.prototype=Object.create(s.prototype),oe.prototype.constructor=oe,oe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.readable.canRead()){var t=e.Long.fromInt(this.local$length),n=this.$this.readable.remaining,i=(t.compareTo_11rb$(n)<=0?t:n).toInt();_a(this.$this.readable,this.local$dst,this.local$offset,i),this.$this.afterRead(),this.local$tmp$=i,this.state_0=4;continue}if(this.$this.closed){this.local$tmp$=this.$this.readAvailableClosed(),this.state_0=3;continue}if(this.state_0=2,this.result_0=this.$this.readAvailableSuspend_v6ah9b$_0(this.local$dst,this.local$offset,this.local$length,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:this.state_0=4;continue;case 4:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readAvailable_mj6st8$=function(t,e,n,i,r){var o=new oe(this,t,e,n,i);return r?o:o.doResume(null)},ae.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},ae.prototype=Object.create(s.prototype),ae.prototype.constructor=ae,ae.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.readAvailable_mj6st8$(this.local$dst,this.local$offset,this.local$length,this),this.result_0===a)return a;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readAvailableSuspend_v6ah9b$_0=function(t,e,n,i,r){var o=new ae(this,t,e,n,i);return r?o:o.doResume(null)},se.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},se.prototype=Object.create(s.prototype),se.prototype.constructor=se,se.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.readAvailable_mj6st8$(this.local$dst,this.local$offset,this.local$length,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:if(this.local$rc=this.result_0,this.local$rc===this.local$length)return;this.state_0=3;continue;case 3:if(-1===this.local$rc)throw new Th("Unexpected end of stream");if(this.state_0=4,this.result_0=this.$this.readFullySuspend_ayq7by$_0(this.local$dst,this.local$offset+this.local$rc|0,this.local$length-this.local$rc|0,this),this.result_0===a)return a;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readFully_mj6st8$=function(t,e,n,i,r){var o=new se(this,t,e,n,i);return r?o:o.doResume(null)},le.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},le.prototype=Object.create(s.prototype),le.prototype.constructor=le,le.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$written=0,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$written>=this.local$length){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.readAvailable_mj6st8$(this.local$dst,this.local$offset+this.local$written|0,this.local$length-this.local$written|0,this),this.result_0===a)return a;continue;case 3:var t=this.result_0;if(-1===t)throw new Th("Unexpected end of stream");this.local$written=this.local$written+t|0,this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readFullySuspend_ayq7by$_0=function(t,e,n,i,r){var o=new le(this,t,e,n,i);return r?o:o.doResume(null)},ue.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},ue.prototype=Object.create(s.prototype),ue.prototype.constructor=ue,ue.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.readable.canRead()){var t=this.$this.readable.readByte()===d(1);this.$this.afterRead(),this.local$tmp$=t,this.state_0=3;continue}if(this.state_0=2,this.result_0=this.$this.readBooleanSlow_cbbszf$_0(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readBoolean=function(t,e){var n=new ue(this,t);return e?n:n.doResume(null)},ce.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},ce.prototype=Object.create(s.prototype),ce.prototype.constructor=ce,ce.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:if(this.$this.checkClosed_ldvyyk$_0(1),this.state_0=3,this.result_0=this.$this.readBoolean(this),this.result_0===a)return a;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readBooleanSlow_cbbszf$_0=function(t,e){var n=new ce(this,t);return e?n:n.doResume(null)},Ot.prototype.completeReading_um9rnf$_0=function(){var t=this.lastReadView_92ta1h$_0,e=t.writePosition-t.readPosition|0,n=this.lastReadAvailable_1j890x$_0-e|0;this.lastReadView_92ta1h$_0!==Xi().Empty&&lu(this.readable,this.lastReadView_92ta1h$_0),n>0&&this.afterRead(),this.lastReadAvailable_1j890x$_0=0,this.lastReadView_92ta1h$_0=Nl().Empty},Ot.prototype.await_za3lpa$$default=function(t,e){return t>=0||new Tt((n=t,function(){return"atLeast parameter shouldn't be negative: "+n})).doFail(),t<=4088||new Tt(function(t){return function(){return"atLeast parameter shouldn't be larger than max buffer size of 4088: "+t}}(t)).doFail(),this.completeReading_um9rnf$_0(),0===t?!this.isClosedForRead:this.availableForRead>=t||this.awaitSuspend_za3lpa$(t,e);var n},Ot.prototype.awaitInternalAtLeast1_8be2vx$=function(t){return!this.readable.endOfInput||this.awaitSuspend_za3lpa$(1,t)},he.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},he.prototype=Object.create(s.prototype),he.prototype.constructor=he,he.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(!(this.local$atLeast>=0))throw b("Failed requirement.".toString());if(this.$this.waitingForRead_ad5k18$_0=this.local$atLeast,this.state_0=2,this.result_0=this.$this.atLeastNBytesAvailableForRead_mdv8hx$_0.await_o14v8n$(pe(this.$this),this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:if(null!=(t=this.$this.closedCause))throw t;return!this.$this.isClosedForRead&&this.$this.availableForRead>=this.local$atLeast;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.awaitSuspend_za3lpa$=function(t,e,n){var i=new he(this,t,e);return n?i:i.doResume(null)},Ot.prototype.discard_za3lpa$=function(t){var e;if(null!=(e=this.closedCause))throw e;var n=this.readable.discard_za3lpa$(t);return this.afterRead(),n},Ot.prototype.request_za3lpa$$default=function(t){var n,i;if(null!=(n=this.closedCause))throw n;this.completeReading_um9rnf$_0();var r=null==(i=this.readable.prepareReadHead_za3lpa$(t))||e.isType(i,Hp)?i:c();return null==r?(this.lastReadView_92ta1h$_0=Nl().Empty,this.lastReadAvailable_1j890x$_0=0):(this.lastReadView_92ta1h$_0=r,this.lastReadAvailable_1j890x$_0=r.writePosition-r.readPosition|0),r},_e.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},_e.prototype=Object.create(s.prototype),_e.prototype.constructor=_e,_e.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=this.$this.readable.discard_s8cxhz$(this.local$max);if(_(t,this.local$max)||this.$this.isClosedForRead)return t;if(this.state_0=2,this.result_0=this.$this.discardSuspend_7c0j1e$_0(this.local$max,t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.discard_s8cxhz$=function(t,e,n){var i=new _e(this,t,e);return n?i:i.doResume(null)},fe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},fe.prototype=Object.create(s.prototype),fe.prototype.constructor=fe,fe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$discarded=this.local$discarded0,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.await_za3lpa$(1,this),this.result_0===a)return a;continue;case 3:if(this.result_0){this.state_0=4;continue}this.state_0=5;continue;case 4:if(this.local$discarded=this.local$discarded.add(this.$this.readable.discard_s8cxhz$(this.local$max.subtract(this.local$discarded))),this.local$discarded.compareTo_11rb$(this.local$max)>=0||this.$this.isClosedForRead){this.state_0=5;continue}this.state_0=2;continue;case 5:return this.local$discarded;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.discardSuspend_7c0j1e$_0=function(t,e,n,i){var r=new fe(this,t,e,n);return i?r:r.doResume(null)},Ot.prototype.readSession_m70re0$=function(t){try{t(this)}finally{this.completeReading_um9rnf$_0()}},Ot.prototype.startReadSession=function(){return this},Ot.prototype.endReadSession=function(){this.completeReading_um9rnf$_0()},de.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},de.prototype=Object.create(s.prototype),de.prototype.constructor=de,de.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=3,this.state_0=1,this.result_0=this.local$consumer(this.$this,this),this.result_0===a)return a;continue;case 1:this.exceptionState_0=5,this.finallyPath_0=[2],this.state_0=4;continue;case 2:return;case 3:this.finallyPath_0=[5],this.state_0=4;continue;case 4:this.exceptionState_0=5,this.$this.completeReading_um9rnf$_0(),this.state_0=this.finallyPath_0.shift();continue;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readSuspendableSession_kiqllg$=function(t,e,n){var i=new de(this,t,e);return n?i:i.doResume(null)},me.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},me.prototype=Object.create(s.prototype),me.prototype.constructor=me,me.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$this$ByteChannelSequentialBase.afterRead(),this.state_0=2,this.result_0=this.local$this$ByteChannelSequentialBase.await_za3lpa$(this.local$size,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return this.result_0?this.local$this$ByteChannelSequentialBase.readable:null;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readUTF8LineTo_yhx0yw$=function(t,e,n){if(this.isClosedForRead){var i=this.closedCause;if(null!=i)throw i;return!1}return Bl(t,e,(r=this,function(t,e,n){var i=new me(r,t,e);return n?i:i.doResume(null)}),n);var r},ye.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},ye.prototype=Object.create(s.prototype),ye.prototype.constructor=ye,ye.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$sb=m(),this.state_0=2,this.result_0=this.$this.readUTF8LineTo_yhx0yw$(this.local$sb,this.local$limit,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:if(this.result_0){this.state_0=3;continue}return null;case 3:return this.local$sb.toString();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readUTF8Line_za3lpa$=function(t,e,n){var i=new ye(this,t,e);return n?i:i.doResume(null)},Ot.prototype.cancel_dbl4no$=function(t){return null==this.closedCause&&!this.closed&&this.close_dbl4no$(null!=t?t:y("Channel cancelled"))},Ot.prototype.close_dbl4no$=function(t){return!this.closed&&null==this.closedCause&&(this.closedCause=t,this.closed=!0,null!=t?(this.readable.release(),this.writable.release()):this.flush(),this.atLeastNBytesAvailableForRead_mdv8hx$_0.signal(),this.atLeastNBytesAvailableForWrite_dspbt2$_0.signal(),this.notFull_8be2vx$.signal(),!0)},Ot.prototype.transferTo_pxvbjg$=function(t,e){var n,i=this.readable.remaining;return i.compareTo_11rb$(e)<=0?(t.writable.writePacket_3uq2w4$(this.readable),t.afterWrite(),this.afterRead(),n=i):n=u,n},$e.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},$e.prototype=Object.create(s.prototype),$e.prototype.constructor=$e,$e.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.awaitSuspend_za3lpa$(this.local$n,this),this.result_0===a)return a;continue;case 3:this.$this.readable.hasBytes_za3lpa$(this.local$n)&&this.local$block(),this.$this.checkClosed_ldvyyk$_0(this.local$n),this.state_0=2;continue;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.readNSlow_2lkm5r$_0=function(t,e,n,i){var r=new $e(this,t,e,n);return i?r:r.doResume(null)},ve.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},ve.prototype=Object.create(s.prototype),ve.prototype.constructor=ve,ve.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitFreeSpace(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.writeAvailable_99qa0s$(this.local$src,this),this.result_0===a)return a;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.writeAvailableSuspend_5fukw0$_0=function(t,e,n){var i=new ve(this,t,e);return n?i:i.doResume(null)},ge.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},ge.prototype=Object.create(s.prototype),ge.prototype.constructor=ge,ge.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitFreeSpace(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.writeAvailable_mj6st8$(this.local$src,this.local$offset,this.local$length,this),this.result_0===a)return a;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.writeAvailableSuspend_1zn44g$_0=function(t,e,n,i,r){var o=new ge(this,t,e,n,i);return r?o:o.doResume(null)},Ot.prototype.afterWrite=function(){this.closed&&(this.writable.release(),this.ensureNotClosed_ozgwi5$_0()),(this.autoFlush||0===this.availableForWrite)&&this.flush()},we.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},we.prototype=Object.create(s.prototype),we.prototype.constructor=we,we.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.afterWrite(),this.state_0=2,this.result_0=this.$this.notFull_8be2vx$.await_o14v8n$(be(this.$this),this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return void this.$this.ensureNotClosed_ozgwi5$_0();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.awaitFreeSpace=function(t,e){var n=new we(this,t);return e?n:n.doResume(null)},xe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},xe.prototype=Object.create(s.prototype),xe.prototype.constructor=xe,xe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=v(this.local$closure$min.add(this.local$closure$offset),$).toInt();if(this.state_0=2,this.result_0=this.local$$receiver.await_za3lpa$(n,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var i=null!=(t=this.local$$receiver.request_za3lpa$(1))?t:Qp().Empty;if((i.writePosition-i.readPosition|0)>this.local$closure$offset.toNumber()){la(i,this.local$closure$offset);var r=this.local$closure$bytesCopied,o=e.Long.fromInt(i.writePosition-i.readPosition|0),s=this.local$closure$max;return r.v=o.compareTo_11rb$(s)<=0?o:s,i.memory.copyTo_q2ka7j$(this.local$closure$destination,e.Long.fromInt(i.readPosition),this.local$closure$bytesCopied.v,this.local$closure$destinationOffset),h}this.state_0=3;continue;case 3:return h;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ee.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Ee.prototype=Object.create(s.prototype),Ee.prototype.constructor=Ee,Ee.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$bytesCopied={v:u},this.state_0=2,this.result_0=this.$this.readSuspendableSession_kiqllg$(ke(this.local$min,this.local$offset,this.local$max,this.local$bytesCopied,this.local$destination,this.local$destinationOffset),this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return this.local$bytesCopied.v;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.peekTo_afjyek$$default=function(t,e,n,i,r,o,a){var s=new Ee(this,t,e,n,i,r,o);return a?s:s.doResume(null)},Ot.$metadata$={kind:p,simpleName:"ByteChannelSequentialBase",interfaces:[Pn,Sn,$n,St,Du,ju]},Ce.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Ce.prototype=Object.create(s.prototype),Ce.prototype.constructor=Ce,Ce.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.discard_s8cxhz$(this.local$n,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:if(!_(this.result_0,this.local$n))throw new Th("Unable to discard "+this.local$n.toString()+" bytes");return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.discardExact_b56lbm$",x((function(){var n=e.equals,i=t.io.ktor.utils.io.errors.EOFException;return function(t,r,o){if(e.suspendCall(t.discard_s8cxhz$(r,e.coroutineReceiver())),!n(e.coroutineResult(e.coroutineReceiver()),r))throw new i("Unable to discard "+r.toString()+" bytes")}}))),Se.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Se.prototype=Object.create(s.prototype),Se.prototype.constructor=Se,Se.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(void 0===this.local$limit&&(this.local$limit=l),this.state_0=2,this.result_0=Tu(this.local$$receiver,this.local$dst,this.local$limit,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return Ne(this.local$dst),t;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.writePacket_c7ucec$",x((function(){var n=t.io.ktor.utils.io.core.BytePacketBuilder_za3lpa$,i=Error;return function(t,r,o,a){var s;void 0===r&&(r=0);var l=n(r);try{o(l),s=l.build()}catch(t){throw e.isType(t,i)?(l.release(),t):t}return e.suspendCall(t.writePacket_3uq2w4$(s,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),Pe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Pe.prototype=Object.create(s.prototype),Pe.prototype.constructor=Pe,Pe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$builder=mh(0),this.exceptionState_0=2,this.state_0=1,this.result_0=this.local$builder_0(this.local$builder,this),this.result_0===a)return a;continue;case 1:this.local$buildPacket$result=this.local$builder.build(),this.exceptionState_0=5,this.state_0=3;continue;case 2:this.exceptionState_0=5;var t=this.exception_0;throw e.isType(t,C)?(this.local$builder.release(),t):t;case 3:if(this.state_0=4,this.result_0=this.local$$receiver.writePacket_3uq2w4$(this.local$buildPacket$result,this),this.result_0===a)return a;continue;case 4:return this.result_0;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ae.$metadata$={kind:p,simpleName:"ClosedWriteChannelException",interfaces:[E]},je.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},je.prototype=Object.create(s.prototype),je.prototype.constructor=je,je.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.readShort(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return _(this.local$byteOrder,bp.BIG_ENDIAN)?t:Hu(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.readShort_e2pdtf$",x((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_5vcgdc$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readShort(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),Le.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Le.prototype=Object.create(s.prototype),Le.prototype.constructor=Le,Le.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.readInt(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return _(this.local$byteOrder,bp.BIG_ENDIAN)?t:Yu(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.readInt_e2pdtf$",x((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_s8ev3n$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readInt(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),Re.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Re.prototype=Object.create(s.prototype),Re.prototype.constructor=Re,Re.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.readLong(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return _(this.local$byteOrder,bp.BIG_ENDIAN)?t:Vu(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.readLong_e2pdtf$",x((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_mts6qi$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readLong(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),Ie.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Ie.prototype=Object.create(s.prototype),Ie.prototype.constructor=Ie,Ie.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.readFloat(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return _(this.local$byteOrder,bp.BIG_ENDIAN)?t:Ku(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.readFloat_e2pdtf$",x((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_81szk$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readFloat(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),ze.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},ze.prototype=Object.create(s.prototype),ze.prototype.constructor=ze,ze.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.readDouble(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return _(this.local$byteOrder,bp.BIG_ENDIAN)?t:Wu(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.readDouble_e2pdtf$",x((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_yrwdxr$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readDouble(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),De.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},De.prototype=Object.create(s.prototype),De.prototype.constructor=De,De.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.readShort(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return _(this.local$$receiver.readByteOrder,bp.LITTLE_ENDIAN)?t:Hu(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.readShortLittleEndian_3dmw3p$",x((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_5vcgdc$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readShort(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),Me.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Me.prototype=Object.create(s.prototype),Me.prototype.constructor=Me,Me.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.readInt(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return _(this.local$$receiver.readByteOrder,bp.LITTLE_ENDIAN)?t:Yu(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.readIntLittleEndian_3dmw3p$",x((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_s8ev3n$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readInt(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),Be.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Be.prototype=Object.create(s.prototype),Be.prototype.constructor=Be,Be.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.readLong(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return _(this.local$$receiver.readByteOrder,bp.LITTLE_ENDIAN)?t:Vu(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.readLongLittleEndian_3dmw3p$",x((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_mts6qi$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readLong(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),Ue.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Ue.prototype=Object.create(s.prototype),Ue.prototype.constructor=Ue,Ue.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.readFloat(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return _(this.local$$receiver.readByteOrder,bp.LITTLE_ENDIAN)?t:Ku(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.readFloatLittleEndian_3dmw3p$",x((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_81szk$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readFloat(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),Fe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Fe.prototype=Object.create(s.prototype),Fe.prototype.constructor=Fe,Fe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.readDouble(this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return _(this.local$$receiver.readByteOrder,bp.LITTLE_ENDIAN)?t:Wu(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.readDoubleLittleEndian_3dmw3p$",x((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_yrwdxr$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readDouble(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),qe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},qe.prototype=Object.create(s.prototype),qe.prototype.constructor=qe,qe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=_(this.local$byteOrder,bp.BIG_ENDIAN)?this.local$value:Hu(this.local$value),this.state_0=2,this.result_0=this.local$$receiver.writeShort_mq22fl$(t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},He.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},He.prototype=Object.create(s.prototype),He.prototype.constructor=He,He.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=_(this.local$byteOrder,bp.BIG_ENDIAN)?this.local$value:Yu(this.local$value),this.state_0=2,this.result_0=this.local$$receiver.writeInt_za3lpa$(t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ve.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Ve.prototype=Object.create(s.prototype),Ve.prototype.constructor=Ve,Ve.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=_(this.local$byteOrder,bp.BIG_ENDIAN)?this.local$value:Vu(this.local$value),this.state_0=2,this.result_0=this.local$$receiver.writeLong_s8cxhz$(t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ke.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Ke.prototype=Object.create(s.prototype),Ke.prototype.constructor=Ke,Ke.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=_(this.local$byteOrder,bp.BIG_ENDIAN)?this.local$value:Ku(this.local$value),this.state_0=2,this.result_0=this.local$$receiver.writeFloat_mx4ult$(t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},We.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},We.prototype=Object.create(s.prototype),We.prototype.constructor=We,We.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=_(this.local$byteOrder,bp.BIG_ENDIAN)?this.local$value:Wu(this.local$value),this.state_0=2,this.result_0=this.local$$receiver.writeDouble_14dthe$(t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Xe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Xe.prototype=Object.create(s.prototype),Xe.prototype.constructor=Xe,Xe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=_(this.local$$receiver.writeByteOrder,kp())?this.local$value:Hu(this.local$value),this.state_0=2,this.result_0=this.local$$receiver.writeShort_mq22fl$(t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ze.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Ze.prototype=Object.create(s.prototype),Ze.prototype.constructor=Ze,Ze.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=_(this.local$$receiver.writeByteOrder,kp())?this.local$value:Yu(this.local$value),this.state_0=2,this.result_0=this.local$$receiver.writeInt_za3lpa$(t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Je.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Je.prototype=Object.create(s.prototype),Je.prototype.constructor=Je,Je.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=_(this.local$$receiver.writeByteOrder,kp())?this.local$value:Vu(this.local$value),this.state_0=2,this.result_0=this.local$$receiver.writeLong_s8cxhz$(t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Qe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Qe.prototype=Object.create(s.prototype),Qe.prototype.constructor=Qe,Qe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=_(this.local$$receiver.writeByteOrder,kp())?this.local$value:Ku(this.local$value),this.state_0=2,this.result_0=this.local$$receiver.writeFloat_mx4ult$(t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},tn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},tn.prototype=Object.create(s.prototype),tn.prototype.constructor=tn,tn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=_(this.local$$receiver.writeByteOrder,kp())?this.local$value:Wu(this.local$value),this.state_0=2,this.result_0=this.local$$receiver.writeDouble_14dthe$(t,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}};var en=w("ktor-ktor-io.io.ktor.utils.io.toLittleEndian_npz7h3$",x((function(){var n=t.io.ktor.utils.io.core.ByteOrder,i=e.equals;return function(t,e,r){return i(t.readByteOrder,n.LITTLE_ENDIAN)?e:r(e)}}))),nn=w("ktor-ktor-io.io.ktor.utils.io.reverseIfNeeded_xs36oz$",x((function(){var n=t.io.ktor.utils.io.core.ByteOrder,i=e.equals;return function(t,e,r){return i(e,n.BIG_ENDIAN)?t:r(t)}})));function rn(){}function on(){}function an(){}function sn(){}function ln(t,e,n,i){return void 0===e&&(e=O.EmptyCoroutineContext),_n(t,e,n,!1,i)}function un(t,e,n,i){void 0===n&&(n=null);var r=P(N.GlobalScope,null!=n?t.plus_1fupul$(n):t);return ln(A(r),O.EmptyCoroutineContext,e,i)}function cn(t,e,n,i){return void 0===e&&(e=O.EmptyCoroutineContext),_n(t,e,n,!1,i)}function pn(t,e,n,i){void 0===n&&(n=null);var r=P(N.GlobalScope,null!=n?t.plus_1fupul$(n):t);return cn(A(r),O.EmptyCoroutineContext,e,i)}function hn(t,e,n,i,r,o){s.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$attachJob=t,this.local$closure$channel=e,this.local$closure$block=n,this.local$$receiver=i}function _n(t,e,n,i,r){var o,a,s,l,u=j(t,e,void 0,(o=i,a=n,s=r,function(t,e,n){var i=new hn(o,a,s,t,this,e);return n?i:i.doResume(null)}));return u.invokeOnCompletion_f05bi3$((l=n,function(t){return l.close_dbl4no$(t),h})),new dn(u,n)}function fn(t,e){this.channel_79cwt9$_0=e,this.$delegate_h3p63m$_0=t}function dn(t,e){this.delegate_0=t,this.channel_zg1n2y$_0=e}function mn(t,e,n,i){s.call(this,i),this.exceptionState_0=6,this.local$buffer=void 0,this.local$bytesRead=void 0,this.local$$receiver=t,this.local$desiredSize=e,this.local$block=n}function yn(){}function $n(){}function vn(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$readSession=void 0,this.local$$receiver=t,this.local$desiredSize=e}function gn(t,e,n,i){var r=new vn(t,e,n);return i?r:r.doResume(null)}function bn(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$buffer=e,this.local$bytesRead=n}function wn(t,e,n,i,r){var o=new bn(t,e,n,i);return r?o:o.doResume(null)}function xn(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$desiredSize=e}function kn(t,e,n,i){var r=new xn(t,e,n);return i?r:r.doResume(null)}function En(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$chunk=void 0,this.local$$receiver=t,this.local$desiredSize=e}function Cn(t,e,n,i){var r=new En(t,e,n);return i?r:r.doResume(null)}function Sn(){}function Tn(t,e,n,i){s.call(this,i),this.exceptionState_0=6,this.local$buffer=void 0,this.local$bytesWritten=void 0,this.local$$receiver=t,this.local$desiredSpace=e,this.local$block=n}function On(){}function Nn(){}function Pn(){}function An(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$session=void 0,this.local$$receiver=t,this.local$desiredSpace=e}function jn(t,e,n,i){var r=new An(t,e,n);return i?r:r.doResume(null)}function Ln(t,n,i,r){if(!e.isType(t,Pn))return function(t,e,n,i){var r=new Rn(t,e,n);return i?r:r.doResume(null)}(t,n,r);t.endWriteSession_za3lpa$(i)}function Rn(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$buffer=e}function In(t,e,n){s.call(this,n),this.exceptionState_0=1,this.local$session=t,this.local$desiredSpace=e}function zn(){var t=Nl().Pool.borrow();return t.resetForWrite(),t.reserveEndGap_za3lpa$(8),t}rn.$metadata$={kind:o,simpleName:"ReaderJob",interfaces:[S]},on.$metadata$={kind:o,simpleName:"WriterJob",interfaces:[S]},an.$metadata$={kind:o,simpleName:"ReaderScope",interfaces:[T]},sn.$metadata$={kind:o,simpleName:"WriterScope",interfaces:[T]},hn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},hn.prototype=Object.create(s.prototype),hn.prototype.constructor=hn,hn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.local$closure$attachJob&&this.local$closure$channel.attachJob_dqr1mp$(f(this.local$$receiver.coroutineContext.get_j3r2sn$(S.Key))),this.state_0=2,this.result_0=this.local$closure$block(e.isType(t=new fn(this.local$$receiver,this.local$closure$channel),T)?t:c(),this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(fn.prototype,"channel",{get:function(){return this.channel_79cwt9$_0}}),Object.defineProperty(fn.prototype,"coroutineContext",{get:function(){return this.$delegate_h3p63m$_0.coroutineContext}}),fn.$metadata$={kind:p,simpleName:"ChannelScope",interfaces:[sn,an,T]},Object.defineProperty(dn.prototype,"channel",{get:function(){return this.channel_zg1n2y$_0}}),dn.prototype.toString=function(){return"ChannelJob["+this.delegate_0+"]"},Object.defineProperty(dn.prototype,"children",{get:function(){return this.delegate_0.children}}),Object.defineProperty(dn.prototype,"isActive",{get:function(){return this.delegate_0.isActive}}),Object.defineProperty(dn.prototype,"isCancelled",{get:function(){return this.delegate_0.isCancelled}}),Object.defineProperty(dn.prototype,"isCompleted",{get:function(){return this.delegate_0.isCompleted}}),Object.defineProperty(dn.prototype,"key",{get:function(){return this.delegate_0.key}}),Object.defineProperty(dn.prototype,"onJoin",{get:function(){return this.delegate_0.onJoin}}),dn.prototype.attachChild_kx8v25$=function(t){return this.delegate_0.attachChild_kx8v25$(t)},dn.prototype.cancel=function(){return this.delegate_0.cancel()},dn.prototype.cancel_dbl4no$$default=function(t){return this.delegate_0.cancel_dbl4no$$default(t)},dn.prototype.cancel_m4sck1$$default=function(t){return this.delegate_0.cancel_m4sck1$$default(t)},dn.prototype.fold_3cc69b$=function(t,e){return this.delegate_0.fold_3cc69b$(t,e)},dn.prototype.get_j3r2sn$=function(t){return this.delegate_0.get_j3r2sn$(t)},dn.prototype.getCancellationException=function(){return this.delegate_0.getCancellationException()},dn.prototype.invokeOnCompletion_ct2b2z$$default=function(t,e,n){return this.delegate_0.invokeOnCompletion_ct2b2z$$default(t,e,n)},dn.prototype.invokeOnCompletion_f05bi3$=function(t){return this.delegate_0.invokeOnCompletion_f05bi3$(t)},dn.prototype.join=function(t){return this.delegate_0.join(t)},dn.prototype.minusKey_yeqjby$=function(t){return this.delegate_0.minusKey_yeqjby$(t)},dn.prototype.plus_1fupul$=function(t){return this.delegate_0.plus_1fupul$(t)},dn.prototype.plus_dqr1mp$=function(t){return this.delegate_0.plus_dqr1mp$(t)},dn.prototype.start=function(){return this.delegate_0.start()},dn.$metadata$={kind:p,simpleName:"ChannelJob",interfaces:[on,rn,S]},mn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},mn.prototype=Object.create(s.prototype),mn.prototype.constructor=mn,mn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(void 0===this.local$desiredSize&&(this.local$desiredSize=1),this.state_0=1,this.result_0=gn(this.local$$receiver,this.local$desiredSize,this),this.result_0===a)return a;continue;case 1:this.local$buffer=null!=(t=this.result_0)?t:Vi.Companion.Empty,this.local$bytesRead=0,this.exceptionState_0=2,this.local$bytesRead=this.local$block(this.local$buffer.memory,e.Long.fromInt(this.local$buffer.readPosition),e.Long.fromInt(this.local$buffer.writePosition-this.local$buffer.readPosition|0)),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=4,this.$returnValue=this.local$bytesRead;continue;case 2:this.finallyPath_0=[6],this.state_0=4;continue;case 3:return this.$returnValue;case 4:if(this.exceptionState_0=6,this.state_0=5,this.result_0=wn(this.local$$receiver,this.local$buffer,this.local$bytesRead,this),this.result_0===a)return a;continue;case 5:this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:return;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.read_ons6h$",x((function(){var n=t.io.ktor.utils.io.requestBuffer_78elpf$,i=t.io.ktor.utils.io.core.Buffer,r=t.io.ktor.utils.io.completeReadingFromBuffer_6msh3s$;return function(t,o,a,s){var l;void 0===o&&(o=1),e.suspendCall(n(t,o,e.coroutineReceiver()));var u=null!=(l=e.coroutineResult(e.coroutineReceiver()))?l:i.Companion.Empty,c=0;try{return c=a(u.memory,e.Long.fromInt(u.readPosition),e.Long.fromInt(u.writePosition-u.readPosition|0))}finally{e.suspendCall(r(t,u,c,e.coroutineReceiver()))}}}))),yn.prototype.request_za3lpa$=function(t,e){return void 0===t&&(t=1),e?e(t):this.request_za3lpa$$default(t)},yn.$metadata$={kind:o,simpleName:"ReadSession",interfaces:[]},$n.prototype.await_za3lpa$=function(t,e,n){return void 0===t&&(t=1),n?n(t,e):this.await_za3lpa$$default(t,e)},$n.$metadata$={kind:o,simpleName:"SuspendableReadSession",interfaces:[yn]},vn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},vn.prototype=Object.create(s.prototype),vn.prototype.constructor=vn,vn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=e.isType(this.local$$receiver,$n)?this.local$$receiver:e.isType(this.local$$receiver,Sn)?this.local$$receiver.startReadSession():null,this.local$readSession=t,null!=this.local$readSession){var n=this.local$readSession.request_za3lpa$(L(this.local$desiredSize,8));if(null!=n)return n;this.state_0=2;continue}this.state_0=4;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=kn(this.local$readSession,this.local$desiredSize,this),this.result_0===a)return a;continue;case 3:return this.result_0;case 4:if(this.state_0=5,this.result_0=Cn(this.local$$receiver,this.local$desiredSize,this),this.result_0===a)return a;continue;case 5:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},bn.prototype=Object.create(s.prototype),bn.prototype.constructor=bn,bn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(null!=(t=e.isType(this.local$$receiver,Sn)?this.local$$receiver.startReadSession():null))return void t.discard_za3lpa$(this.local$bytesRead);this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(e.isType(this.local$buffer,bl)){if(this.local$buffer.release_2bs5fo$(Nl().Pool),this.state_0=3,this.result_0=this.local$$receiver.discard_s8cxhz$(e.Long.fromInt(this.local$bytesRead),this),this.result_0===a)return a;continue}this.state_0=4;continue;case 3:this.state_0=4;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},xn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},xn.prototype=Object.create(s.prototype),xn.prototype.constructor=xn,xn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.await_za3lpa$(this.local$desiredSize,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return this.local$$receiver.request_za3lpa$(1);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},En.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},En.prototype=Object.create(s.prototype),En.prototype.constructor=En,En.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$chunk=Nl().Pool.borrow(),this.state_0=2,this.result_0=this.local$$receiver.peekTo_afjyek$(this.local$chunk.memory,e.Long.fromInt(this.local$chunk.writePosition),u,e.Long.fromInt(this.local$desiredSize),e.Long.fromInt(this.local$chunk.limit-this.local$chunk.writePosition|0),this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return this.local$chunk.commitWritten_za3lpa$(t.toInt()),this.local$chunk;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Sn.$metadata$={kind:o,simpleName:"HasReadSession",interfaces:[]},Tn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Tn.prototype=Object.create(s.prototype),Tn.prototype.constructor=Tn,Tn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(void 0===this.local$desiredSpace&&(this.local$desiredSpace=1),this.state_0=1,this.result_0=jn(this.local$$receiver,this.local$desiredSpace,this),this.result_0===a)return a;continue;case 1:this.local$buffer=null!=(t=this.result_0)?t:Vi.Companion.Empty,this.local$bytesWritten=0,this.exceptionState_0=2,this.local$bytesWritten=this.local$block(this.local$buffer.memory,e.Long.fromInt(this.local$buffer.writePosition),e.Long.fromInt(this.local$buffer.limit)),this.local$buffer.commitWritten_za3lpa$(this.local$bytesWritten),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=4,this.$returnValue=this.local$bytesWritten;continue;case 2:this.finallyPath_0=[6],this.state_0=4;continue;case 3:return this.$returnValue;case 4:if(this.exceptionState_0=6,this.state_0=5,this.result_0=Ln(this.local$$receiver,this.local$buffer,this.local$bytesWritten,this),this.result_0===a)return a;continue;case 5:this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:return;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io.io.ktor.utils.io.write_k0oolq$",x((function(){var n=t.io.ktor.utils.io.requestWriteBuffer_9tm6dw$,i=t.io.ktor.utils.io.core.Buffer,r=t.io.ktor.utils.io.completeWriting_oczduq$;return function(t,o,a,s){var l;void 0===o&&(o=1),e.suspendCall(n(t,o,e.coroutineReceiver()));var u=null!=(l=e.coroutineResult(e.coroutineReceiver()))?l:i.Companion.Empty,c=0;try{return c=a(u.memory,e.Long.fromInt(u.writePosition),e.Long.fromInt(u.limit)),u.commitWritten_za3lpa$(c),c}finally{e.suspendCall(r(t,u,c,e.coroutineReceiver()))}}}))),On.$metadata$={kind:o,simpleName:"WriterSession",interfaces:[]},Nn.$metadata$={kind:o,simpleName:"WriterSuspendSession",interfaces:[On]},Pn.$metadata$={kind:o,simpleName:"HasWriteSession",interfaces:[]},An.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},An.prototype=Object.create(s.prototype),An.prototype.constructor=An,An.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=e.isType(this.local$$receiver,Pn)?this.local$$receiver.beginWriteSession():null,this.local$session=t,null!=this.local$session){var n=this.local$session.request_za3lpa$(this.local$desiredSpace);if(null!=n)return n;this.state_0=2;continue}this.state_0=4;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=(i=this.local$session,r=this.local$desiredSpace,o=void 0,s=void 0,s=new In(i,r,this),o?s:s.doResume(null)),this.result_0===a)return a;continue;case 3:return this.result_0;case 4:return zn();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var i,r,o,s},Rn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Rn.prototype=Object.create(s.prototype),Rn.prototype.constructor=Rn,Rn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(e.isType(this.local$buffer,Hp)){if(this.state_0=2,this.result_0=this.local$$receiver.writeFully_99qa0s$(this.local$buffer,this),this.result_0===a)return a;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:return void this.local$buffer.release_duua06$(Qp().Pool);case 3:throw R("Only IoBuffer instance is supported.");default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},In.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},In.prototype=Object.create(s.prototype),In.prototype.constructor=In,In.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.local$session.tryAwait_za3lpa$(this.local$desiredSpace,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return null!=(t=this.local$session.request_za3lpa$(this.local$desiredSpace))?t:this.local$session.request_za3lpa$(1);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}};var Dn=w("ktor-ktor-io.io.ktor.utils.io.bits.get_highByte_5vcgdc$",x((function(){var t=e.toByte;return function(e){return t((255&e)>>8)}}))),Mn=w("ktor-ktor-io.io.ktor.utils.io.bits.get_lowByte_5vcgdc$",x((function(){var t=e.toByte;return function(e){return t(255&e)}}))),Bn=w("ktor-ktor-io.io.ktor.utils.io.bits.get_highShort_s8ev3n$",x((function(){var t=e.toShort;return function(e){return t(e>>>16)}}))),Un=w("ktor-ktor-io.io.ktor.utils.io.bits.get_lowShort_s8ev3n$",x((function(){var t=e.toShort;return function(e){return t(65535&e)}}))),Fn=w("ktor-ktor-io.io.ktor.utils.io.bits.get_highInt_mts6qi$",(function(t){return t.shiftRightUnsigned(32).toInt()})),qn=w("ktor-ktor-io.io.ktor.utils.io.bits.get_lowInt_mts6qi$",x((function(){var t=new e.Long(-1,0);return function(e){return e.and(t).toInt()}}))),Gn=w("ktor-ktor-io.io.ktor.utils.io.bits.get_ad7opl$",(function(t,e){return t.view.getInt8(e)})),Hn=w("ktor-ktor-io.io.ktor.utils.io.bits.get_xrw27i$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n){var i=t.view;return n.toNumber()>=2147483647&&e(n,"index"),i.getInt8(n.toInt())}}))),Yn=w("ktor-ktor-io.io.ktor.utils.io.bits.set_x25fc5$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n,i){var r=t.view;n.toNumber()>=2147483647&&e(n,"index"),r.setInt8(n.toInt(),i)}}))),Vn=w("ktor-ktor-io.io.ktor.utils.io.bits.set_gx2x5q$",(function(t,e,n){t.view.setInt8(e,n)})),Kn=w("ktor-ktor-io.io.ktor.utils.io.bits.storeAt_u5mcnq$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n,i){var r=i.data,o=t.view;n.toNumber()>=2147483647&&e(n,"index"),o.setInt8(n.toInt(),r)}}))),Wn=w("ktor-ktor-io.io.ktor.utils.io.bits.storeAt_r092yl$",(function(t,e,n){t.view.setInt8(e,n.data)})),Xn=w("ktor-ktor-io.io.ktor.utils.io.bits.withMemory_24cc00$",x((function(){var n=t.io.ktor.utils.io.bits;return function(t,i){var r,o=e.Long.fromInt(t),a=n.DefaultAllocator,s=a.alloc_s8cxhz$(o);try{r=i(s)}finally{a.free_vn6nzs$(s)}return r}}))),Zn=w("ktor-ktor-io.io.ktor.utils.io.bits.withMemory_ksmduh$",x((function(){var e=t.io.ktor.utils.io.bits;return function(t,n){var i,r=e.DefaultAllocator,o=r.alloc_s8cxhz$(t);try{i=n(o)}finally{r.free_vn6nzs$(o)}return i}})));function Jn(){}Jn.$metadata$={kind:o,simpleName:"Allocator",interfaces:[]};var Qn=w("ktor-ktor-io.io.ktor.utils.io.bits.loadUShortAt_ad7opl$",x((function(){var t=e.kotlin.UShort;return function(e,n){return new t(e.view.getInt16(n,!1))}}))),ti=w("ktor-ktor-io.io.ktor.utils.io.bits.loadUShortAt_xrw27i$",x((function(){var n=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$,i=e.kotlin.UShort;return function(t,e){return e.toNumber()>=2147483647&&n(e,"offset"),new i(t.view.getInt16(e.toInt(),!1))}}))),ei=w("ktor-ktor-io.io.ktor.utils.io.bits.storeUShortAt_feknxd$",(function(t,e,n){t.view.setInt16(e,n.data,!1)})),ni=w("ktor-ktor-io.io.ktor.utils.io.bits.storeUShortAt_b6qmqu$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n,i){var r=i.data,o=t.view;n.toNumber()>=2147483647&&e(n,"offset"),o.setInt16(n.toInt(),r,!1)}}))),ii=w("ktor-ktor-io.io.ktor.utils.io.bits.loadUIntAt_ad7opl$",x((function(){var t=e.kotlin.UInt;return function(e,n){return new t(e.view.getInt32(n,!1))}}))),ri=w("ktor-ktor-io.io.ktor.utils.io.bits.loadUIntAt_xrw27i$",x((function(){var n=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$,i=e.kotlin.UInt;return function(t,e){return e.toNumber()>=2147483647&&n(e,"offset"),new i(t.view.getInt32(e.toInt(),!1))}}))),oi=w("ktor-ktor-io.io.ktor.utils.io.bits.storeUIntAt_gwrs4s$",(function(t,e,n){t.view.setInt32(e,n.data,!1)})),ai=w("ktor-ktor-io.io.ktor.utils.io.bits.storeUIntAt_x1uab7$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n,i){var r=i.data,o=t.view;n.toNumber()>=2147483647&&e(n,"offset"),o.setInt32(n.toInt(),r,!1)}}))),si=w("ktor-ktor-io.io.ktor.utils.io.bits.loadULongAt_ad7opl$",x((function(){var t=e.kotlin.ULong;return function(n,i){return new t(e.Long.fromInt(n.view.getUint32(i,!1)).shiftLeft(32).or(e.Long.fromInt(n.view.getUint32(i+4|0,!1))))}}))),li=w("ktor-ktor-io.io.ktor.utils.io.bits.loadULongAt_xrw27i$",x((function(){var n=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$,i=e.kotlin.ULong;return function(t,r){r.toNumber()>=2147483647&&n(r,"offset");var o=r.toInt();return new i(e.Long.fromInt(t.view.getUint32(o,!1)).shiftLeft(32).or(e.Long.fromInt(t.view.getUint32(o+4|0,!1))))}}))),ui=w("ktor-ktor-io.io.ktor.utils.io.bits.storeULongAt_r02wnd$",x((function(){var t=new e.Long(-1,0);return function(e,n,i){var r=i.data;e.view.setInt32(n,r.shiftRight(32).toInt(),!1),e.view.setInt32(n+4|0,r.and(t).toInt(),!1)}}))),ci=w("ktor-ktor-io.io.ktor.utils.io.bits.storeULongAt_u5g6ci$",x((function(){var n=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$,i=new e.Long(-1,0);return function(t,e,r){var o=r.data;e.toNumber()>=2147483647&&n(e,"offset");var a=e.toInt();t.view.setInt32(a,o.shiftRight(32).toInt(),!1),t.view.setInt32(a+4|0,o.and(i).toInt(),!1)}}))),pi=w("ktor-ktor-io.io.ktor.utils.io.bits.loadByteArray_ngtxw7$",x((function(){var e=t.io.ktor.utils.io.bits.copyTo_tiw1kd$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.length-r|0),e(t,i,n,o,r)}}))),hi=w("ktor-ktor-io.io.ktor.utils.io.bits.loadByteArray_dy6oua$",x((function(){var e=t.io.ktor.utils.io.bits.copyTo_yqt5go$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.length-r|0),e(t,i,n,o,r)}}))),_i=w("ktor-ktor-io.io.ktor.utils.io.bits.loadUByteArray_moiot2$",x((function(){var e=t.io.ktor.utils.io.bits.copyTo_tiw1kd$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,i.storage,n,o,r)}}))),fi=w("ktor-ktor-io.io.ktor.utils.io.bits.loadUByteArray_r80dt$",x((function(){var e=t.io.ktor.utils.io.bits.copyTo_yqt5go$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,i.storage,n,o,r)}}))),di=w("ktor-ktor-io.io.ktor.utils.io.bits.loadUShortArray_fu1ix4$",x((function(){var e=t.io.ktor.utils.io.bits.loadShortArray_8jnas7$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}}))),mi=w("ktor-ktor-io.io.ktor.utils.io.bits.loadUShortArray_w2wo2p$",x((function(){var e=t.io.ktor.utils.io.bits.loadShortArray_ew3eeo$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}}))),yi=w("ktor-ktor-io.io.ktor.utils.io.bits.loadUIntArray_795lej$",x((function(){var e=t.io.ktor.utils.io.bits.loadIntArray_kz60l8$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}}))),$i=w("ktor-ktor-io.io.ktor.utils.io.bits.loadUIntArray_qcxtu4$",x((function(){var e=t.io.ktor.utils.io.bits.loadIntArray_qrle83$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}}))),vi=w("ktor-ktor-io.io.ktor.utils.io.bits.loadULongArray_1mgmjm$",x((function(){var e=t.io.ktor.utils.io.bits.loadLongArray_2ervmr$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}}))),gi=w("ktor-ktor-io.io.ktor.utils.io.bits.loadULongArray_lta2n9$",x((function(){var e=t.io.ktor.utils.io.bits.loadLongArray_z08r3q$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}}))),bi=w("ktor-ktor-io.io.ktor.utils.io.bits.storeByteArray_ngtxw7$",x((function(){var e=t.io.ktor.utils.io.bits.Memory,n=t.io.ktor.utils.io.bits.of_2z595v$;return function(t,i,r,o,a){void 0===o&&(o=0),void 0===a&&(a=r.length-o|0),n(e.Companion,r,o,a).copyTo_ubllm2$(t,0,a,i)}}))),wi=w("ktor-ktor-io.io.ktor.utils.io.bits.storeByteArray_dy6oua$",x((function(){var n=e.Long.ZERO,i=t.io.ktor.utils.io.bits.Memory,r=t.io.ktor.utils.io.bits.of_2z595v$;return function(t,o,a,s,l){void 0===s&&(s=0),void 0===l&&(l=a.length-s|0),r(i.Companion,a,s,l).copyTo_q2ka7j$(t,n,e.Long.fromInt(l),o)}}))),xi=w("ktor-ktor-io.io.ktor.utils.io.bits.storeUByteArray_moiot2$",x((function(){var e=t.io.ktor.utils.io.bits.Memory,n=t.io.ktor.utils.io.bits.of_2z595v$;return function(t,i,r,o,a){void 0===o&&(o=0),void 0===a&&(a=r.size-o|0);var s=r.storage;n(e.Companion,s,o,a).copyTo_ubllm2$(t,0,a,i)}}))),ki=w("ktor-ktor-io.io.ktor.utils.io.bits.storeUByteArray_r80dt$",x((function(){var n=e.Long.ZERO,i=t.io.ktor.utils.io.bits.Memory,r=t.io.ktor.utils.io.bits.of_2z595v$;return function(t,o,a,s,l){void 0===s&&(s=0),void 0===l&&(l=a.size-s|0);var u=a.storage;r(i.Companion,u,s,l).copyTo_q2ka7j$(t,n,e.Long.fromInt(l),o)}}))),Ei=w("ktor-ktor-io.io.ktor.utils.io.bits.storeUShortArray_fu1ix4$",x((function(){var e=t.io.ktor.utils.io.bits.storeShortArray_8jnas7$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}}))),Ci=w("ktor-ktor-io.io.ktor.utils.io.bits.storeUShortArray_w2wo2p$",x((function(){var e=t.io.ktor.utils.io.bits.storeShortArray_ew3eeo$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}}))),Si=w("ktor-ktor-io.io.ktor.utils.io.bits.storeUIntArray_795lej$",x((function(){var e=t.io.ktor.utils.io.bits.storeIntArray_kz60l8$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}}))),Ti=w("ktor-ktor-io.io.ktor.utils.io.bits.storeUIntArray_qcxtu4$",x((function(){var e=t.io.ktor.utils.io.bits.storeIntArray_qrle83$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}}))),Oi=w("ktor-ktor-io.io.ktor.utils.io.bits.storeULongArray_1mgmjm$",x((function(){var e=t.io.ktor.utils.io.bits.storeLongArray_2ervmr$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}}))),Ni=w("ktor-ktor-io.io.ktor.utils.io.bits.storeULongArray_lta2n9$",x((function(){var e=t.io.ktor.utils.io.bits.storeLongArray_z08r3q$;return function(t,n,i,r,o){void 0===r&&(r=0),void 0===o&&(o=i.size-r|0),e(t,n,i.storage,r,o)}})));function Pi(t,e,n,i,r){var o={v:n};if(!(o.v>=i)){var a=cu(r,1,null);try{for(var s;;){var l=ji(t,e,o.v,i,a);if(!(l>=0))throw B("Check failed.".toString());if(o.v=o.v+l|0,(s=o.v>=i?0:0===l?8:1)<=0)break;a=cu(r,s,a)}}finally{pu(r,a)}Ii(t,r)}}function Ai(t,n,i){void 0===i&&(i=2147483647);var r=e.Long.fromInt(i),o=Ri(n),a=U((r.compareTo_11rb$(o)<=0?r:o).toInt());return sp(t,n,a,i),a.toString()}function ji(t,e,n,i,r){var o=i-n|0;return tp(t,new Hl(e,n,o),0,o,r)}function Li(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length);var o={v:i};if(o.v>=r)return Wl;var a=Nl().Pool.borrow();try{var s,l=tp(t,n,o.v,r,a);if(o.v=o.v+l|0,o.v===r){var u=new Int8Array(a.writePosition-a.readPosition|0);return ao(a,u),u}var c=mh(0);try{c.appendSingleChunk_pvnryh$(a.duplicate()),zi(t,c,n,o.v,r),s=c.build()}catch(t){throw e.isType(t,C)?(c.release(),t):t}return Gs(s)}finally{a.release_2bs5fo$(Nl().Pool)}}function Ri(t){if(e.isType(t,Qo))return t.remaining;if(e.isType(t,Mi)){var n=t.remaining,i=M;return n.compareTo_11rb$(i)>=0?n:i}return M}function Ii(t,e){var n={v:1},i={v:0},r=cu(e,1,null);try{for(;;){var o=r,a=o.limit-o.writePosition|0;if(n.v=0,i.v=i.v+(a-(o.limit-o.writePosition|0))|0,!(n.v>0))break;r=cu(e,1,r)}}finally{pu(e,r)}return i.v}function zi(t,e,n,i,r){var o={v:i};if(o.v>=r)return 0;var a={v:0},s=cu(e,1,null);try{for(var l;;){var u=s,c=u.limit-u.writePosition|0,p=tp(t,n,o.v,r,u);if(!(p>=0))throw B("Check failed.".toString());if(o.v=o.v+p|0,a.v=a.v+(c-(u.limit-u.writePosition|0))|0,(l=o.v>=r?0:0===p?8:1)<=0)break;s=cu(e,l,s)}}finally{pu(e,s)}return a.v=a.v+Ii(0,e)|0,a.v}function Di(t){this.closure$message=t,Il.call(this)}function Mi(t,n,i){Gi(),void 0===t&&(t=Nl().Empty),void 0===n&&(n=Fo(t)),void 0===i&&(i=Nl().Pool),this.pool=i,this._head_xb1tt$_l4zxc7$_0=t,this.headMemory=t.memory,this.headPosition=t.readPosition,this.headEndExclusive=t.writePosition,this.tailRemaining_l8ht08$_7gwoj7$_0=n.subtract(e.Long.fromInt(this.headEndExclusive-this.headPosition|0)),this.noMoreChunksAvailable_2n0tap$_0=!1}function Bi(t,e){this.closure$destination=t,this.idx_0=e}function Ui(){throw B("It should be no tail remaining bytes if current tail is EmptyBuffer")}function Fi(){qi=this}Di.prototype=Object.create(Il.prototype),Di.prototype.constructor=Di,Di.prototype.doFail=function(){throw b(this.closure$message())},Di.$metadata$={kind:p,interfaces:[Il]},Object.defineProperty(Mi.prototype,"_head_xb1tt$_0",{get:function(){return this._head_xb1tt$_l4zxc7$_0},set:function(t){this._head_xb1tt$_l4zxc7$_0=t,this.headMemory=t.memory,this.headPosition=t.readPosition,this.headEndExclusive=t.writePosition}}),Object.defineProperty(Mi.prototype,"head",{get:function(){var t=this._head_xb1tt$_0;return t.discardUntilIndex_kcn2v3$(this.headPosition),t},set:function(t){this._head_xb1tt$_0=t}}),Object.defineProperty(Mi.prototype,"headRemaining",{get:w("ktor-ktor-io.io.ktor.utils.io.core.AbstractInput.get_headRemaining",(function(){return this.headEndExclusive-this.headPosition|0})),set:function(t){this.updateHeadRemaining_za3lpa$(t)}}),Object.defineProperty(Mi.prototype,"tailRemaining_l8ht08$_0",{get:function(){return this.tailRemaining_l8ht08$_7gwoj7$_0},set:function(t){var e,n,i,r;if(t.toNumber()<0)throw B(("tailRemaining is negative: "+t.toString()).toString());if(_(t,u)){var o=null!=(n=null!=(e=this._head_xb1tt$_0.next)?Fo(e):null)?n:u;if(!_(o,u))throw B(("tailRemaining is set 0 while there is a tail of size "+o.toString()).toString())}var a=null!=(r=null!=(i=this._head_xb1tt$_0.next)?Fo(i):null)?r:u;if(!_(t,a))throw B(("tailRemaining is set to a value that is not consistent with the actual tail: "+t.toString()+" != "+a.toString()).toString());this.tailRemaining_l8ht08$_7gwoj7$_0=t}}),Object.defineProperty(Mi.prototype,"byteOrder",{get:function(){return xp()},set:function(t){if(t!==xp())throw b("Only BIG_ENDIAN is supported.")}}),Mi.prototype.prefetch_8e33dg$=function(t){if(t.toNumber()<=0)return!0;var n=this.headEndExclusive-this.headPosition|0;return n>=t.toNumber()||e.Long.fromInt(n).add(this.tailRemaining_l8ht08$_0).compareTo_11rb$(t)>=0||this.doPrefetch_15sylx$_0(t)},Mi.prototype.peekTo_afjyek$$default=function(t,n,i,r,o){var a;this.prefetch_8e33dg$(r.add(i));for(var s=this.head,l=u,c=i,p=n,h=e.Long.fromInt(t.view.byteLength).subtract(n),_=o.compareTo_11rb$(h)<=0?o:h;l.compareTo_11rb$(r)<0&&l.compareTo_11rb$(_)<0;){var f=s,d=f.writePosition-f.readPosition|0;if(d>c.toNumber()){var m=e.Long.fromInt(d).subtract(c),y=_.subtract(l),$=m.compareTo_11rb$(y)<=0?m:y;s.memory.copyTo_q2ka7j$(t,e.Long.fromInt(s.readPosition).add(c),$,p),c=u,l=l.add($),p=p.add($)}else c=c.subtract(e.Long.fromInt(d));if(null==(a=s.next))break;s=a}return l},Mi.prototype.doPrefetch_15sylx$_0=function(t){var n=Uo(this._head_xb1tt$_0),i=e.Long.fromInt(this.headEndExclusive-this.headPosition|0).add(this.tailRemaining_l8ht08$_0);do{var r=this.fill();if(null==r)return this.noMoreChunksAvailable_2n0tap$_0=!0,!1;var o=r.writePosition-r.readPosition|0;n===Nl().Empty?(this._head_xb1tt$_0=r,n=r):(n.next=r,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(e.Long.fromInt(o))),i=i.add(e.Long.fromInt(o))}while(i.compareTo_11rb$(t)<0);return!0},Object.defineProperty(Mi.prototype,"remaining",{get:function(){return e.Long.fromInt(this.headEndExclusive-this.headPosition|0).add(this.tailRemaining_l8ht08$_0)}}),Mi.prototype.canRead=function(){return this.headPosition!==this.headEndExclusive||!_(this.tailRemaining_l8ht08$_0,u)},Mi.prototype.hasBytes_za3lpa$=function(t){return e.Long.fromInt(this.headEndExclusive-this.headPosition|0).add(this.tailRemaining_l8ht08$_0).toNumber()>=t},Object.defineProperty(Mi.prototype,"isEmpty",{get:function(){return this.endOfInput}}),Object.defineProperty(Mi.prototype,"isNotEmpty",{get:function(){return Os(this)}}),Object.defineProperty(Mi.prototype,"endOfInput",{get:function(){return 0==(this.headEndExclusive-this.headPosition|0)&&_(this.tailRemaining_l8ht08$_0,u)&&(this.noMoreChunksAvailable_2n0tap$_0||null==this.doFill_nh863c$_0())}}),Mi.prototype.release=function(){var t=this.head,e=Nl().Empty;t!==e&&(this._head_xb1tt$_0=e,this.tailRemaining_l8ht08$_0=u,zo(t,this.pool))},Mi.prototype.close=function(){this.release(),this.noMoreChunksAvailable_2n0tap$_0||(this.noMoreChunksAvailable_2n0tap$_0=!0),this.closeSource()},Mi.prototype.stealAll_8be2vx$=function(){var t=this.head,e=Nl().Empty;return t===e?null:(this._head_xb1tt$_0=e,this.tailRemaining_l8ht08$_0=u,t)},Mi.prototype.steal_8be2vx$=function(){var t=this.head,n=t.next,i=Nl().Empty;return t===i?null:(null==n?(this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=u):(this._head_xb1tt$_0=n,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(n.writePosition-n.readPosition|0))),t.next=null,t)},Mi.prototype.append_pvnryh$=function(t){if(t!==Nl().Empty){var n=Fo(t);this._head_xb1tt$_0===Nl().Empty?(this._head_xb1tt$_0=t,this.tailRemaining_l8ht08$_0=n.subtract(e.Long.fromInt(this.headEndExclusive-this.headPosition|0))):(Uo(this._head_xb1tt$_0).next=t,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(n))}},Mi.prototype.tryWriteAppend_pvnryh$=function(t){var n=Uo(this.head),i=t.writePosition-t.readPosition|0,r=0===i;return r||(r=(n.limit-n.writePosition|0)=0||new Di((e=t,function(){return"Negative discard is not allowed: "+e})).doFail(),this.discardAsMuchAsPossible_3xuwvm$_0(t,0);var e},Mi.prototype.discardExact_za3lpa$=function(t){if(this.discard_za3lpa$(t)!==t)throw new Th("Unable to discard "+t+" bytes due to end of packet")},Mi.prototype.read_wbh1sp$=w("ktor-ktor-io.io.ktor.utils.io.core.AbstractInput.read_wbh1sp$",x((function(){var n=t.io.ktor.utils.io.core.prematureEndOfStream_za3lpa$,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(t){var e,r=null!=(e=this.prepareRead_za3lpa$(1))?e:n(1),o=r.readPosition;try{t(r)}finally{var a=r.readPosition;if(a0?n.tryPeekByte():_(this.tailRemaining_l8ht08$_0,u)&&this.noMoreChunksAvailable_2n0tap$_0?-1:null!=(e=null!=(t=this.prepareReadLoop_3ilf5z$_0(1,n))?t.tryPeekByte():null)?e:-1},Mi.prototype.peekTo_99qa0s$=function(t){var n,i;if(null==(n=this.prepareReadHead_za3lpa$(1)))return-1;var r=n,o=t.limit-t.writePosition|0,a=r.writePosition-r.readPosition|0,s=g.min(o,a);return No(e.isType(i=t,Vi)?i:c(),r,s),s},Mi.prototype.discard_s8cxhz$=function(t){return t.toNumber()<=0?u:this.discardAsMuchAsPossible_s35ayg$_0(t,u)},Bi.prototype.append_s8itvh$=function(t){var e;return this.closure$destination[(e=this.idx_0,this.idx_0=e+1|0,e)]=t,this},Bi.prototype.append_gw00v9$=function(t){var e,n;if("string"==typeof t)Eh(t,this.closure$destination,this.idx_0),this.idx_0=this.idx_0+t.length|0;else if(null!=t){e=t.length;for(var i=0;i=0){var r=Ws(this,this.remaining.toInt());return t.append_gw00v9$(r),r.length}return this.readASCII_ka9uwb$_0(t,n,i)},Mi.prototype.readTextExact_a5kscm$=function(t,e){this.readText_5dvtqg$(t,e,e)},Mi.prototype.readText_vux9f0$=function(t,n){if(void 0===t&&(t=0),void 0===n&&(n=2147483647),0===t&&(0===n||this.endOfInput))return"";var i=this.remaining;if(i.toNumber()>0&&e.Long.fromInt(n).compareTo_11rb$(i)>=0)return Ws(this,i.toInt());var r=U(L(G(t,16),n));return this.readASCII_ka9uwb$_0(r,t,n),r.toString()},Mi.prototype.readTextExact_za3lpa$=function(t){return this.readText_vux9f0$(t,t)},Mi.prototype.readASCII_ka9uwb$_0=function(t,e,n){if(0===n&&0===e)return 0;if(this.endOfInput){if(0===e)return 0;this.atLeastMinCharactersRequire_tmg3q9$_0(e)}else n=l)try{var h,_=s;n:do{for(var f={v:0},d={v:0},m={v:0},y=_.memory,$=_.readPosition,v=_.writePosition,g=$;g>=1,f.v=f.v+1|0;if(m.v=f.v,f.v=f.v-1|0,m.v>(v-g|0)){_.discardExact_za3lpa$(g-$|0),h=m.v;break n}}else if(d.v=d.v<<6|127&b,f.v=f.v-1|0,0===f.v){if(Ql(d.v)){var C,S=K(V(d.v));if(i.v===n?C=!1:(t.append_s8itvh$(H(S)),i.v=i.v+1|0,C=!0),!C){_.discardExact_za3lpa$(g-$-m.v+1|0),h=-1;break n}}else if(tu(d.v)){var T,O=K(V(nu(d.v)));i.v===n?T=!1:(t.append_s8itvh$(H(O)),i.v=i.v+1|0,T=!0);var N=!T;if(!N){var P,A=K(V(eu(d.v)));i.v===n?P=!1:(t.append_s8itvh$(H(A)),i.v=i.v+1|0,P=!0),N=!P}if(N){_.discardExact_za3lpa$(g-$-m.v+1|0),h=-1;break n}}else Jl(d.v);d.v=0}}var j=v-$|0;_.discardExact_za3lpa$(j),h=0}while(0);l=0===h?1:h>0?h:0}finally{var L=s;u=L.writePosition-L.readPosition|0}else u=p;if(a=!1,0===u)o=uu(this,s);else{var R=u0)}finally{a&&lu(this,s)}}while(0);return i.va?(t.releaseEndGap_8be2vx$(),this.headEndExclusive=t.writePosition,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(e.Long.fromInt(a))):(this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt((i.writePosition-i.readPosition|0)-a|0)),t.cleanNext(),t.release_2bs5fo$(this.pool))},Mi.prototype.fixGapAfterReadFallback_q485vf$_0=function(t){if(this.noMoreChunksAvailable_2n0tap$_0&&null==t.next)return this.headPosition=t.readPosition,this.headEndExclusive=t.writePosition,void(this.tailRemaining_l8ht08$_0=u);var e=t.writePosition-t.readPosition|0,n=8-(t.capacity-t.limit|0)|0,i=g.min(e,n);if(e>i)this.fixGapAfterReadFallbackUnreserved_13fwc$_0(t,e,i);else{var r=this.pool.borrow();r.reserveEndGap_za3lpa$(8),r.next=t.cleanNext(),_r(r,t,e),this._head_xb1tt$_0=r}t.release_2bs5fo$(this.pool)},Mi.prototype.fixGapAfterReadFallbackUnreserved_13fwc$_0=function(t,e,n){var i=this.pool.borrow(),r=this.pool.borrow();i.reserveEndGap_za3lpa$(8),r.reserveEndGap_za3lpa$(8),i.next=r,r.next=t.cleanNext(),_r(i,t,e-n|0),_r(r,t,n),this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=Fo(r)},Mi.prototype.ensureNext_pxb5qx$_0=function(t,n){var i;if(t===n)return this.doFill_nh863c$_0();var r=t.cleanNext();return t.release_2bs5fo$(this.pool),null==r?(this._head_xb1tt$_0=n,this.tailRemaining_l8ht08$_0=u,i=this.ensureNext_pxb5qx$_0(n,n)):r.writePosition>r.readPosition?(this._head_xb1tt$_0=r,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(r.writePosition-r.readPosition|0)),i=r):i=this.ensureNext_pxb5qx$_0(r,n),i},Mi.prototype.fill=function(){var t=this.pool.borrow();try{t.reserveEndGap_za3lpa$(8);var n=this.fill_9etqdk$(t.memory,t.writePosition,t.limit-t.writePosition|0);return 0!==n||(this.noMoreChunksAvailable_2n0tap$_0=!0,t.writePosition>t.readPosition)?(t.commitWritten_za3lpa$(n),t):(t.release_2bs5fo$(this.pool),null)}catch(n){throw e.isType(n,C)?(t.release_2bs5fo$(this.pool),n):n}},Mi.prototype.markNoMoreChunksAvailable=function(){this.noMoreChunksAvailable_2n0tap$_0||(this.noMoreChunksAvailable_2n0tap$_0=!0)},Mi.prototype.doFill_nh863c$_0=function(){if(this.noMoreChunksAvailable_2n0tap$_0)return null;var t=this.fill();return null==t?(this.noMoreChunksAvailable_2n0tap$_0=!0,null):(this.appendView_4be14h$_0(t),t)},Mi.prototype.appendView_4be14h$_0=function(t){var e,n,i=Uo(this._head_xb1tt$_0);i===Nl().Empty?(this._head_xb1tt$_0=t,_(this.tailRemaining_l8ht08$_0,u)||new Di(Ui).doFail(),this.tailRemaining_l8ht08$_0=null!=(n=null!=(e=t.next)?Fo(e):null)?n:u):(i.next=t,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(Fo(t)))},Mi.prototype.prepareRead_za3lpa$=function(t){var e=this.head;return(this.headEndExclusive-this.headPosition|0)>=t?e:this.prepareReadLoop_3ilf5z$_0(t,e)},Mi.prototype.prepareRead_cvuqs$=function(t,e){return(this.headEndExclusive-this.headPosition|0)>=t?e:this.prepareReadLoop_3ilf5z$_0(t,e)},Mi.prototype.prepareReadLoop_3ilf5z$_0=function(t,n){var i,r,o=this.headEndExclusive-this.headPosition|0;if(o>=t)return n;if(null==(r=null!=(i=n.next)?i:this.doFill_nh863c$_0()))return null;var a=r;if(0===o)return n!==Nl().Empty&&this.releaseHead_pvnryh$(n),this.prepareReadLoop_3ilf5z$_0(t,a);var s=_r(n,a,t-o|0);return this.headEndExclusive=n.writePosition,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(s)),a.writePosition>a.readPosition?a.reserveStartGap_za3lpa$(s):(n.next=null,n.next=a.cleanNext(),a.release_2bs5fo$(this.pool)),(n.writePosition-n.readPosition|0)>=t?n:(t>8&&this.minSizeIsTooBig_5ot22f$_0(t),this.prepareReadLoop_3ilf5z$_0(t,n))},Mi.prototype.minSizeIsTooBig_5ot22f$_0=function(t){throw B("minSize of "+t+" is too big (should be less than 8)")},Mi.prototype.afterRead_3wtcpm$_0=function(t){0==(t.writePosition-t.readPosition|0)&&this.releaseHead_pvnryh$(t)},Mi.prototype.releaseHead_pvnryh$=function(t){var n,i=null!=(n=t.cleanNext())?n:Nl().Empty;return this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(i.writePosition-i.readPosition|0)),t.release_2bs5fo$(this.pool),i},Fi.$metadata$={kind:Y,simpleName:"Companion",interfaces:[]};var qi=null;function Gi(){return null===qi&&new Fi,qi}function Hi(t,e){this.headerSizeHint_8gle5k$_0=t,this.pool=e,this._head_hofq54$_0=null,this._tail_hhwkug$_0=null,this.tailMemory_8be2vx$=sc().Empty,this.tailPosition_8be2vx$=0,this.tailEndExclusive_8be2vx$_yr29se$_0=0,this.tailInitialPosition_f6hjsm$_0=0,this.chainedSize_8c83kq$_0=0,this.byteOrder_t3hxpd$_0=xp()}function Yi(t,e){return e=e||Object.create(Hi.prototype),Hi.call(e,0,t),e}function Vi(t){Xi(),this.memory=t,this.readPosition_osecaz$_0=0,this.writePosition_oj9ite$_0=0,this.startGap_cakrhy$_0=0,this.limit_uf38zz$_0=this.memory.view.byteLength,this.capacity=this.memory.view.byteLength,this.attachment=null}function Ki(){Wi=this,this.ReservedSize=8}Mi.$metadata$={kind:p,simpleName:"AbstractInput",interfaces:[Np]},Object.defineProperty(Hi.prototype,"head_8be2vx$",{get:function(){var t;return null!=(t=this._head_hofq54$_0)?t:Nl().Empty}}),Object.defineProperty(Hi.prototype,"tail",{get:function(){return this.prepareWriteHead_za3lpa$(1)}}),Object.defineProperty(Hi.prototype,"currentTail",{get:function(){return this.prepareWriteHead_za3lpa$(1)},set:function(t){this.appendChain_pvnryh$(t)}}),Object.defineProperty(Hi.prototype,"tailEndExclusive_8be2vx$",{get:function(){return this.tailEndExclusive_8be2vx$_yr29se$_0},set:function(t){this.tailEndExclusive_8be2vx$_yr29se$_0=t}}),Object.defineProperty(Hi.prototype,"tailRemaining_8be2vx$",{get:w("ktor-ktor-io.io.ktor.utils.io.core.AbstractOutput.get_tailRemaining_8be2vx$",(function(){return this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0}))}),Object.defineProperty(Hi.prototype,"_size",{get:function(){return this.chainedSize_8c83kq$_0+(this.tailPosition_8be2vx$-this.tailInitialPosition_f6hjsm$_0)|0},set:function(t){}}),Object.defineProperty(Hi.prototype,"byteOrder",{get:function(){return this.byteOrder_t3hxpd$_0},set:function(t){if(this.byteOrder_t3hxpd$_0=t,t!==xp())throw b("Only BIG_ENDIAN is supported. Use corresponding functions to read/writein the little endian")}}),Hi.prototype.flush=function(){this.flushChain_iwxacw$_0()},Hi.prototype.flushChain_iwxacw$_0=function(){var t;if(null!=(t=this.stealAll_8be2vx$())){var e=t;try{for(var n,i=e;;){var r=i;if(this.flush_9etqdk$(r.memory,r.readPosition,r.writePosition-r.readPosition|0),null==(n=i.next))break;i=n}}finally{zo(e,this.pool)}}},Hi.prototype.stealAll_8be2vx$=function(){var t,e;if(null==(t=this._head_hofq54$_0))return null;var n=t;return null!=(e=this._tail_hhwkug$_0)&&e.commitWrittenUntilIndex_za3lpa$(this.tailPosition_8be2vx$),this._head_hofq54$_0=null,this._tail_hhwkug$_0=null,this.tailPosition_8be2vx$=0,this.tailEndExclusive_8be2vx$=0,this.tailInitialPosition_f6hjsm$_0=0,this.chainedSize_8c83kq$_0=0,this.tailMemory_8be2vx$=sc().Empty,n},Hi.prototype.afterBytesStolen_8be2vx$=function(){var t=this.head_8be2vx$;if(t!==Nl().Empty){if(null!=t.next)throw B("Check failed.".toString());t.resetForWrite(),t.reserveStartGap_za3lpa$(this.headerSizeHint_8gle5k$_0),t.reserveEndGap_za3lpa$(8),this.tailPosition_8be2vx$=t.writePosition,this.tailInitialPosition_f6hjsm$_0=this.tailPosition_8be2vx$,this.tailEndExclusive_8be2vx$=t.limit}},Hi.prototype.appendSingleChunk_pvnryh$=function(t){if(null!=t.next)throw B("It should be a single buffer chunk.".toString());this.appendChainImpl_gq6rjy$_0(t,t,0)},Hi.prototype.appendChain_pvnryh$=function(t){var n=Uo(t),i=Fo(t).subtract(e.Long.fromInt(n.writePosition-n.readPosition|0));i.toNumber()>=2147483647&&Ll(i,"total size increase");var r=i.toInt();this.appendChainImpl_gq6rjy$_0(t,n,r)},Hi.prototype.appendNewChunk_oskcze$_0=function(){var t=this.pool.borrow();return t.reserveEndGap_za3lpa$(8),this.appendSingleChunk_pvnryh$(t),t},Hi.prototype.appendChainImpl_gq6rjy$_0=function(t,e,n){var i=this._tail_hhwkug$_0;if(null==i)this._head_hofq54$_0=t,this.chainedSize_8c83kq$_0=0;else{i.next=t;var r=this.tailPosition_8be2vx$;i.commitWrittenUntilIndex_za3lpa$(r),this.chainedSize_8c83kq$_0=this.chainedSize_8c83kq$_0+(r-this.tailInitialPosition_f6hjsm$_0)|0}this._tail_hhwkug$_0=e,this.chainedSize_8c83kq$_0=this.chainedSize_8c83kq$_0+n|0,this.tailMemory_8be2vx$=e.memory,this.tailPosition_8be2vx$=e.writePosition,this.tailInitialPosition_f6hjsm$_0=e.readPosition,this.tailEndExclusive_8be2vx$=e.limit},Hi.prototype.writeByte_s8j3t7$=function(t){var e=this.tailPosition_8be2vx$;return e=3){var n,i=this.tailMemory_8be2vx$,r=0|t;0<=r&&r<=127?(i.view.setInt8(e,d(r)),n=1):128<=r&&r<=2047?(i.view.setInt8(e,d(192|r>>6&31)),i.view.setInt8(e+1|0,d(128|63&r)),n=2):2048<=r&&r<=65535?(i.view.setInt8(e,d(224|r>>12&15)),i.view.setInt8(e+1|0,d(128|r>>6&63)),i.view.setInt8(e+2|0,d(128|63&r)),n=3):65536<=r&&r<=1114111?(i.view.setInt8(e,d(240|r>>18&7)),i.view.setInt8(e+1|0,d(128|r>>12&63)),i.view.setInt8(e+2|0,d(128|r>>6&63)),i.view.setInt8(e+3|0,d(128|63&r)),n=4):n=Jl(r);var o=n;return this.tailPosition_8be2vx$=e+o|0,this}return this.appendCharFallback_r92zh4$_0(t),this},Hi.prototype.appendCharFallback_r92zh4$_0=function(t){var e=this.prepareWriteHead_za3lpa$(3);try{var n,i=e.memory,r=e.writePosition,o=0|t;0<=o&&o<=127?(i.view.setInt8(r,d(o)),n=1):128<=o&&o<=2047?(i.view.setInt8(r,d(192|o>>6&31)),i.view.setInt8(r+1|0,d(128|63&o)),n=2):2048<=o&&o<=65535?(i.view.setInt8(r,d(224|o>>12&15)),i.view.setInt8(r+1|0,d(128|o>>6&63)),i.view.setInt8(r+2|0,d(128|63&o)),n=3):65536<=o&&o<=1114111?(i.view.setInt8(r,d(240|o>>18&7)),i.view.setInt8(r+1|0,d(128|o>>12&63)),i.view.setInt8(r+2|0,d(128|o>>6&63)),i.view.setInt8(r+3|0,d(128|63&o)),n=4):n=Jl(o);var a=n;if(e.commitWritten_za3lpa$(a),!(a>=0))throw B("The returned value shouldn't be negative".toString())}finally{this.afterHeadWrite()}},Hi.prototype.append_gw00v9$=function(t){return null==t?this.append_ezbsdh$("null",0,4):this.append_ezbsdh$(t,0,t.length),this},Hi.prototype.append_ezbsdh$=function(t,e,n){return null==t?this.append_ezbsdh$("null",e,n):(Xs(this,t,e,n,fp().UTF_8),this)},Hi.prototype.writePacket_3uq2w4$=function(t){var e=t.stealAll_8be2vx$();if(null!=e){var n=this._tail_hhwkug$_0;null!=n?this.writePacketMerging_jurx1f$_0(n,e,t):this.appendChain_pvnryh$(e)}else t.release()},Hi.prototype.writePacketMerging_jurx1f$_0=function(t,e,n){var i;t.commitWrittenUntilIndex_za3lpa$(this.tailPosition_8be2vx$);var r=t.writePosition-t.readPosition|0,o=e.writePosition-e.readPosition|0,a=oh,s=o0;){var r=t.headEndExclusive-t.headPosition|0;if(!(r<=i.v)){var o,a=null!=(o=t.prepareRead_za3lpa$(1))?o:tl(1),s=a.readPosition;try{rs(this,a,i.v)}finally{var l=a.readPosition;if(l0;){var o=e.Long.fromInt(t.headEndExclusive-t.headPosition|0);if(!(o.compareTo_11rb$(r.v)<=0)){var a,s=null!=(a=t.prepareRead_za3lpa$(1))?a:tl(1),l=s.readPosition;try{rs(this,s,r.v.toInt())}finally{var c=s.readPosition;if(c=e)return i;for(i=n(this.prepareWriteHead_za3lpa$(1),i),this.afterHeadWrite();i2047){var i=t.memory,r=t.writePosition,o=t.limit-r|0;if(o<3)throw e("3 bytes character",3,o);var a=i,s=r;a.view.setInt8(s,d(224|n>>12&15)),a.view.setInt8(s+1|0,d(128|n>>6&63)),a.view.setInt8(s+2|0,d(128|63&n));return t.commitWritten_za3lpa$(3),3}var l=t.memory,u=t.writePosition,c=t.limit-u|0;if(c<2)throw e("2 bytes character",2,c);var p=l,h=u;p.view.setInt8(h,d(192|n>>6&31)),p.view.setInt8(h+1|0,d(128|63&n));return t.commitWritten_za3lpa$(2),2}})),Hi.prototype.release=function(){this.close()},Hi.prototype.prepareWriteHead_za3lpa$=function(t){var e;return(this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0)>=t&&null!=(e=this._tail_hhwkug$_0)?(e.commitWrittenUntilIndex_za3lpa$(this.tailPosition_8be2vx$),e):this.appendNewChunk_oskcze$_0()},Hi.prototype.afterHeadWrite=function(){var t;null!=(t=this._tail_hhwkug$_0)&&(this.tailPosition_8be2vx$=t.writePosition)},Hi.prototype.write_rtdvbs$=w("ktor-ktor-io.io.ktor.utils.io.core.AbstractOutput.write_rtdvbs$",x((function(){var t=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,n){var i=this.prepareWriteHead_za3lpa$(e);try{if(!(n(i)>=0))throw t("The returned value shouldn't be negative".toString())}finally{this.afterHeadWrite()}}}))),Hi.prototype.addSize_za3lpa$=function(t){if(!(t>=0))throw B(("It should be non-negative size increment: "+t).toString());if(!(t<=(this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0))){var e="Unable to mark more bytes than available: "+t+" > "+(this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0);throw B(e.toString())}this.tailPosition_8be2vx$=this.tailPosition_8be2vx$+t|0},Hi.prototype.last_99qa0s$=function(t){var n;this.appendSingleChunk_pvnryh$(e.isType(n=t,bl)?n:c())},Hi.prototype.appendNewBuffer=function(){var t;return e.isType(t=this.appendNewChunk_oskcze$_0(),Hp)?t:c()},Hi.prototype.reset=function(){},Hi.$metadata$={kind:p,simpleName:"AbstractOutput",interfaces:[dh,q]},Object.defineProperty(Vi.prototype,"readPosition",{get:function(){return this.readPosition_osecaz$_0},set:function(t){this.readPosition_osecaz$_0=t}}),Object.defineProperty(Vi.prototype,"writePosition",{get:function(){return this.writePosition_oj9ite$_0},set:function(t){this.writePosition_oj9ite$_0=t}}),Object.defineProperty(Vi.prototype,"startGap",{get:function(){return this.startGap_cakrhy$_0},set:function(t){this.startGap_cakrhy$_0=t}}),Object.defineProperty(Vi.prototype,"limit",{get:function(){return this.limit_uf38zz$_0},set:function(t){this.limit_uf38zz$_0=t}}),Object.defineProperty(Vi.prototype,"endGap",{get:w("ktor-ktor-io.io.ktor.utils.io.core.Buffer.get_endGap",(function(){return this.capacity-this.limit|0}))}),Object.defineProperty(Vi.prototype,"readRemaining",{get:w("ktor-ktor-io.io.ktor.utils.io.core.Buffer.get_readRemaining",(function(){return this.writePosition-this.readPosition|0}))}),Object.defineProperty(Vi.prototype,"writeRemaining",{get:w("ktor-ktor-io.io.ktor.utils.io.core.Buffer.get_writeRemaining",(function(){return this.limit-this.writePosition|0}))}),Vi.prototype.discardExact_za3lpa$=function(t){if(void 0===t&&(t=this.writePosition-this.readPosition|0),0!==t){var e=this.readPosition+t|0;(t<0||e>this.writePosition)&&nr(t,this.writePosition-this.readPosition|0),this.readPosition=e}},Vi.prototype.discard_za3lpa$=function(t){var e=this.writePosition-this.readPosition|0,n=g.min(t,e);return this.discardExact_za3lpa$(n),n},Vi.prototype.discard_s8cxhz$=function(t){var n=e.Long.fromInt(this.writePosition-this.readPosition|0),i=(t.compareTo_11rb$(n)<=0?t:n).toInt();return this.discardExact_za3lpa$(i),e.Long.fromInt(i)},Vi.prototype.commitWritten_za3lpa$=function(t){var e=this.writePosition+t|0;(t<0||e>this.limit)&&ir(t,this.limit-this.writePosition|0),this.writePosition=e},Vi.prototype.commitWrittenUntilIndex_za3lpa$=function(t){var e=this.limit;if(t=e){if(t===e)return this.writePosition=t,!1;ir(t-this.writePosition|0,this.limit-this.writePosition|0)}return this.writePosition=t,!0},Vi.prototype.discardUntilIndex_kcn2v3$=function(t){(t<0||t>this.writePosition)&&nr(t-this.readPosition|0,this.writePosition-this.readPosition|0),this.readPosition!==t&&(this.readPosition=t)},Vi.prototype.rewind_za3lpa$=function(t){void 0===t&&(t=this.readPosition-this.startGap|0);var e=this.readPosition-t|0;e=0))throw b(("startGap shouldn't be negative: "+t).toString());if(!(this.readPosition>=t))return this.readPosition===this.writePosition?(t>this.limit&&or(this,t),this.writePosition=t,this.readPosition=t,void(this.startGap=t)):void ar(this,t);this.startGap=t},Vi.prototype.reserveEndGap_za3lpa$=function(t){if(!(t>=0))throw b(("endGap shouldn't be negative: "+t).toString());var e=this.capacity-t|0;if(e>=this.writePosition)this.limit=e;else{if(e<0&&sr(this,t),e=0))throw b(("newReadPosition shouldn't be negative: "+t).toString());if(!(t<=this.readPosition)){var e="newReadPosition shouldn't be ahead of the read position: "+t+" > "+this.readPosition;throw b(e.toString())}this.readPosition=t,this.startGap>t&&(this.startGap=t)},Vi.prototype.duplicateTo_b4g5fm$=function(t){t.limit=this.limit,t.startGap=this.startGap,t.readPosition=this.readPosition,t.writePosition=this.writePosition},Vi.prototype.duplicate=function(){var t=new Vi(this.memory);return t.duplicateTo_b4g5fm$(t),t},Vi.prototype.tryPeekByte=function(){var t=this.readPosition;return t===this.writePosition?-1:255&this.memory.view.getInt8(t)},Vi.prototype.tryReadByte=function(){var t=this.readPosition;return t===this.writePosition?-1:(this.readPosition=t+1|0,255&this.memory.view.getInt8(t))},Vi.prototype.readByte=function(){var t=this.readPosition;if(t===this.writePosition)throw new Th("No readable bytes available.");return this.readPosition=t+1|0,this.memory.view.getInt8(t)},Vi.prototype.writeByte_s8j3t7$=function(t){var e=this.writePosition;if(e===this.limit)throw new pr("No free space in the buffer to write a byte");this.memory.view.setInt8(e,t),this.writePosition=e+1|0},Vi.prototype.reset=function(){this.releaseGaps_8be2vx$(),this.resetForWrite()},Vi.prototype.toString=function(){return"Buffer("+(this.writePosition-this.readPosition|0)+" used, "+(this.limit-this.writePosition|0)+" free, "+(this.startGap+(this.capacity-this.limit|0)|0)+" reserved of "+this.capacity+")"},Object.defineProperty(Ki.prototype,"Empty",{get:function(){return Qp().Empty}}),Ki.$metadata$={kind:Y,simpleName:"Companion",interfaces:[]};var Wi=null;function Xi(){return null===Wi&&new Ki,Wi}Vi.$metadata$={kind:p,simpleName:"Buffer",interfaces:[]};var Zi,Ji=w("ktor-ktor-io.io.ktor.utils.io.core.canRead_abnlgx$",(function(t){return t.writePosition>t.readPosition})),Qi=w("ktor-ktor-io.io.ktor.utils.io.core.canWrite_abnlgx$",(function(t){return t.limit>t.writePosition})),tr=w("ktor-ktor-io.io.ktor.utils.io.core.read_kmyesx$",(function(t,e){var n=e(t.memory,t.readPosition,t.writePosition);return t.discardExact_za3lpa$(n),n})),er=w("ktor-ktor-io.io.ktor.utils.io.core.write_kmyesx$",(function(t,e){var n=e(t.memory,t.writePosition,t.limit);return t.commitWritten_za3lpa$(n),n}));function nr(t,e){throw new Th("Unable to discard "+t+" bytes: only "+e+" available for reading")}function ir(t,e){throw new Th("Unable to discard "+t+" bytes: only "+e+" available for writing")}function rr(t,e){throw b("Unable to rewind "+t+" bytes: only "+e+" could be rewinded")}function or(t,e){if(e>t.capacity)throw b("Start gap "+e+" is bigger than the capacity "+t.capacity);throw B("Unable to reserve "+e+" start gap: there are already "+(t.capacity-t.limit|0)+" bytes reserved in the end")}function ar(t,e){throw B("Unable to reserve "+e+" start gap: there are already "+(t.writePosition-t.readPosition|0)+" content bytes starting at offset "+t.readPosition)}function sr(t,e){throw b("End gap "+e+" is too big: capacity is "+t.capacity)}function lr(t,e){throw b("End gap "+e+" is too big: there are already "+t.startGap+" bytes reserved in the beginning")}function ur(t,e){throw b("Unable to reserve end gap "+e+": there are already "+(t.writePosition-t.readPosition|0)+" content bytes at offset "+t.readPosition)}function cr(t,e){t.releaseStartGap_kcn2v3$(t.readPosition-e|0)}function pr(t){void 0===t&&(t="Not enough free space"),W(t,this),this.name="InsufficientSpaceException"}function hr(t,e,n,i){return i=i||Object.create(pr.prototype),pr.call(i,"Not enough free space to write "+t+" of "+e+" bytes, available "+n+" bytes."),i}function _r(t,e,n){var i=e.writePosition-e.readPosition|0,r=g.min(i,n);(t.limit-t.writePosition|0)<=r&&function(t,e){if(((t.limit-t.writePosition|0)+(t.capacity-t.limit|0)|0)0&&t.releaseEndGap_8be2vx$()}(t,r),e.memory.copyTo_ubllm2$(t.memory,e.readPosition,r,t.writePosition);var o=r;e.discardExact_za3lpa$(o);var a=o;return t.commitWritten_za3lpa$(a),a}function fr(t,e){var n=e.writePosition-e.readPosition|0,i=t.readPosition;if(i=0||new dr((i=e,function(){return"times shouldn't be negative: "+i})).doFail(),e<=(t.limit-t.writePosition|0)||new dr(function(t,e){return function(){var n=e;return"times shouldn't be greater than the write remaining space: "+t+" > "+(n.limit-n.writePosition|0)}}(e,t)).doFail(),uc(t.memory,t.writePosition,e,n),t.commitWritten_za3lpa$(e)}function yr(t,e,n){e.toNumber()>=2147483647&&Ll(e,"n"),mr(t,e.toInt(),n)}function $r(t,e,n,i){return vr(t,new Hl(e,0,e.length),n,i)}function vr(t,e,n,i){var r={v:null},o=Kl(t.memory,e,n,i,t.writePosition,t.limit);r.v=65535&new I(k(o.value>>>16)).data;var a=65535&new I(k(65535&o.value)).data;return t.commitWritten_za3lpa$(a),n+r.v|0}function gr(t,e){var n,i=t.memory,r=t.writePosition,o=t.limit,a=0|e;0<=a&&a<=127?(i.view.setInt8(r,d(a)),n=1):128<=a&&a<=2047?(i.view.setInt8(r,d(192|a>>6&31)),i.view.setInt8(r+1|0,d(128|63&a)),n=2):2048<=a&&a<=65535?(i.view.setInt8(r,d(224|a>>12&15)),i.view.setInt8(r+1|0,d(128|a>>6&63)),i.view.setInt8(r+2|0,d(128|63&a)),n=3):65536<=a&&a<=1114111?(i.view.setInt8(r,d(240|a>>18&7)),i.view.setInt8(r+1|0,d(128|a>>12&63)),i.view.setInt8(r+2|0,d(128|a>>6&63)),i.view.setInt8(r+3|0,d(128|63&a)),n=4):n=Jl(a);var s=n,l=s>(o-r|0)?wr(1):s;return t.commitWritten_za3lpa$(l),t}function br(t,e,n,i){return null==e?br(t,"null",n,i):(vr(t,e,n,i)!==i&&wr(i-n|0),t)}function wr(t){throw new Vo("Not enough free space available to write "+t+" character(s).")}pr.$metadata$={kind:p,simpleName:"InsufficientSpaceException",interfaces:[X]},dr.prototype=Object.create(Il.prototype),dr.prototype.constructor=dr,dr.prototype.doFail=function(){throw b(this.closure$message())},dr.$metadata$={kind:p,interfaces:[Il]};var xr,kr=w("ktor-ktor-io.io.ktor.utils.io.core.withBuffer_3o3i6e$",x((function(){var e=t.io.ktor.utils.io.bits,n=t.io.ktor.utils.io.core.Buffer;return function(t,i){return i(new n(e.DefaultAllocator.alloc_za3lpa$(t)))}}))),Er=w("ktor-ktor-io.io.ktor.utils.io.core.withBuffer_75fp88$",(function(t,e){var n,i=t.borrow();try{n=e(i)}finally{t.recycle_trkh7z$(i)}return n})),Cr=w("ktor-ktor-io.io.ktor.utils.io.core.withChunkBuffer_24tmir$",(function(t,e){var n,i=t.borrow();try{n=e(i)}finally{i.release_2bs5fo$(t)}return n}));function Sr(t,e,n){void 0===t&&(t=4096),void 0===e&&(e=1e3),void 0===n&&(n=ic()),Mh.call(this,e),this.bufferSize_0=t,this.allocator_0=n}function Tr(t){this.closure$message=t,Il.call(this)}function Or(t,e){return function(){throw new Th("Not enough bytes to read a "+t+" of size "+e+".")}}function Nr(t){this.closure$message=t,Il.call(this)}Sr.prototype.produceInstance=function(){return new Hp(this.allocator_0.alloc_za3lpa$(this.bufferSize_0),null)},Sr.prototype.disposeInstance_trkh7z$=function(t){this.allocator_0.free_vn6nzs$(t.memory),Mh.prototype.disposeInstance_trkh7z$.call(this,t),t.unlink_8be2vx$()},Sr.prototype.validateInstance_trkh7z$=function(t){if(Mh.prototype.validateInstance_trkh7z$.call(this,t),t===Qp().Empty)throw B("IoBuffer.Empty couldn't be recycled".toString());if(t===Qp().Empty)throw B("Empty instance couldn't be recycled".toString());if(t===Xi().Empty)throw B("Empty instance couldn't be recycled".toString());if(t===Nl().Empty)throw B("Empty instance couldn't be recycled".toString());if(0!==t.referenceCount)throw B("Unable to clear buffer: it is still in use.".toString());if(null!=t.next)throw B("Recycled instance shouldn't be a part of a chain.".toString());if(null!=t.origin)throw B("Recycled instance shouldn't be a view or another buffer.".toString())},Sr.prototype.clearInstance_trkh7z$=function(t){var e=Mh.prototype.clearInstance_trkh7z$.call(this,t);return e.unpark_8be2vx$(),e.reset(),e},Sr.$metadata$={kind:p,simpleName:"DefaultBufferPool",interfaces:[Mh]},Tr.prototype=Object.create(Il.prototype),Tr.prototype.constructor=Tr,Tr.prototype.doFail=function(){throw b(this.closure$message())},Tr.$metadata$={kind:p,interfaces:[Il]},Nr.prototype=Object.create(Il.prototype),Nr.prototype.constructor=Nr,Nr.prototype.doFail=function(){throw b(this.closure$message())},Nr.$metadata$={kind:p,interfaces:[Il]};var Pr=w("ktor-ktor-io.io.ktor.utils.io.core.forEach_13x7pp$",(function(t,e){for(var n=t.memory,i=t.readPosition,r=t.writePosition,o=i;o=2||new Tr(Or("short integer",2)).doFail(),e.v=n.view.getInt16(i,!1);return t.discardExact_za3lpa$(2),e.v}var Rr=w("ktor-ktor-io.io.ktor.utils.io.core.readShort_396eqd$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.readShort_abnlgx$;return function(t){var o;return r(e.isType(o=t,n)?o:i())}})));var Ir=w("ktor-ktor-io.io.ktor.utils.io.core.readUShort_396eqd$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.readUShort_abnlgx$;return function(t){var o;return r(e.isType(o=t,n)?o:i())}})));function zr(t){var e={v:null},n=t.memory,i=t.readPosition;(t.writePosition-i|0)>=4||new Tr(Or("regular integer",4)).doFail(),e.v=n.view.getInt32(i,!1);return t.discardExact_za3lpa$(4),e.v}var Dr=w("ktor-ktor-io.io.ktor.utils.io.core.readInt_396eqd$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.readInt_abnlgx$;return function(t){var o;return r(e.isType(o=t,n)?o:i())}})));var Mr=w("ktor-ktor-io.io.ktor.utils.io.core.readUInt_396eqd$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.readUInt_abnlgx$;return function(t){var o;return r(e.isType(o=t,n)?o:i())}})));function Br(t){var n={v:null},i=t.memory,r=t.readPosition;(t.writePosition-r|0)>=8||new Tr(Or("long integer",8)).doFail();var o=i,a=r;n.v=e.Long.fromInt(o.view.getUint32(a,!1)).shiftLeft(32).or(e.Long.fromInt(o.view.getUint32(a+4|0,!1)));return t.discardExact_za3lpa$(8),n.v}var Ur=w("ktor-ktor-io.io.ktor.utils.io.core.readLong_396eqd$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.readLong_abnlgx$;return function(t){var o;return r(e.isType(o=t,n)?o:i())}})));var Fr=w("ktor-ktor-io.io.ktor.utils.io.core.readULong_396eqd$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.readULong_abnlgx$;return function(t){var o;return r(e.isType(o=t,n)?o:i())}})));function qr(t){var e={v:null},n=t.memory,i=t.readPosition;(t.writePosition-i|0)>=4||new Tr(Or("floating point number",4)).doFail(),e.v=n.view.getFloat32(i,!1);return t.discardExact_za3lpa$(4),e.v}var Gr=w("ktor-ktor-io.io.ktor.utils.io.core.readFloat_396eqd$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.readFloat_abnlgx$;return function(t){var o;return r(e.isType(o=t,n)?o:i())}})));function Hr(t){var e={v:null},n=t.memory,i=t.readPosition;(t.writePosition-i|0)>=8||new Tr(Or("long floating point number",8)).doFail(),e.v=n.view.getFloat64(i,!1);return t.discardExact_za3lpa$(8),e.v}var Yr=w("ktor-ktor-io.io.ktor.utils.io.core.readDouble_396eqd$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.readDouble_abnlgx$;return function(t){var o;return r(e.isType(o=t,n)?o:i())}})));function Vr(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<2)throw hr("short integer",2,r);n.view.setInt16(i,e,!1);t.commitWritten_za3lpa$(2)}var Kr=w("ktor-ktor-io.io.ktor.utils.io.core.writeShort_89txly$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.writeShort_cx5lgg$;return function(t,o){var a;r(e.isType(a=t,n)?a:i(),o)}})));var Wr=w("ktor-ktor-io.io.ktor.utils.io.core.writeUShort_sa3b8p$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.writeUShort_q99vxf$;return function(t,o){var a;r(e.isType(a=t,n)?a:i(),o)}})));function Xr(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<4)throw hr("regular integer",4,r);n.view.setInt32(i,e,!1);t.commitWritten_za3lpa$(4)}var Zr=w("ktor-ktor-io.io.ktor.utils.io.core.writeInt_q5mzkd$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.writeInt_cni1rh$;return function(t,o){var a;r(e.isType(a=t,n)?a:i(),o)}})));var Jr=w("ktor-ktor-io.io.ktor.utils.io.core.writeUInt_tiqx5o$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.writeUInt_xybpjq$;return function(t,o){var a;r(e.isType(a=t,n)?a:i(),o)}})));function Qr(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<8)throw hr("long integer",8,r);var o=n,a=i;o.view.setInt32(a,e.shiftRight(32).toInt(),!1),o.view.setInt32(a+4|0,e.and(J).toInt(),!1);t.commitWritten_za3lpa$(8)}var to=w("ktor-ktor-io.io.ktor.utils.io.core.writeLong_tilyfy$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.writeLong_xy6qu0$;return function(t,o){var a;r(e.isType(a=t,n)?a:i(),o)}})));var eo=w("ktor-ktor-io.io.ktor.utils.io.core.writeULong_89885t$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.writeULong_cwjw0b$;return function(t,o){var a;r(e.isType(a=t,n)?a:i(),o)}})));function no(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<4)throw hr("floating point number",4,r);n.view.setFloat32(i,e,!1);t.commitWritten_za3lpa$(4)}var io=w("ktor-ktor-io.io.ktor.utils.io.core.writeFloat_8gwps6$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.writeFloat_d48dmo$;return function(t,o){var a;r(e.isType(a=t,n)?a:i(),o)}})));function ro(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<8)throw hr("long floating point number",8,r);n.view.setFloat64(i,e,!1);t.commitWritten_za3lpa$(8)}var oo=w("ktor-ktor-io.io.ktor.utils.io.core.writeDouble_kny06r$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.writeDouble_in4kvh$;return function(t,o){var a;r(e.isType(a=t,n)?a:i(),o)}})));function ao(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:null},o=t.memory,a=t.readPosition;(t.writePosition-a|0)>=i||new Tr(Or("byte array",i)).doFail(),lc(o,e,a,i,n),r.v=h;var s=i;t.discardExact_za3lpa$(s),r.v}var so=w("ktor-ktor-io.io.ktor.utils.io.core.readFully_ou1upd$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.readFully_7ntqvp$;return function(t,o,a,s){var l;void 0===a&&(a=0),void 0===s&&(s=o.length-a|0),r(e.isType(l=t,n)?l:i(),o,a,s)}})));function lo(t,e,n,i){if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Nr((o=n,function(){return"offset shouldn't be negative: "+o})).doFail(),i>=0||new Nr((r=i,function(){return"length shouldn't be negative: "+r})).doFail(),(n+i|0)<=e.length||new Nr(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var r,o,a=t.writePosition-t.readPosition|0,s=g.min(i,a);return ao(t,e,n,s),s}var uo=w("ktor-ktor-io.io.ktor.utils.io.core.readAvailable_ou1upd$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.readAvailable_7ntqvp$;return function(t,o,a,s){var l;return void 0===a&&(a=0),void 0===s&&(s=o.length-a|0),r(e.isType(l=t,n)?l:i(),o,a,s)}})));function co(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=t.memory,o=t.writePosition,a=t.limit-o|0;if(a=r||new Tr(Or("short integers array",r)).doFail(),Rc(a,s,e,n,i),o.v=h;var l=r;t.discardExact_za3lpa$(l),o.v}function _o(t,e,n,i){if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Nr((o=n,function(){return"offset shouldn't be negative: "+o})).doFail(),i>=0||new Nr((r=i,function(){return"length shouldn't be negative: "+r})).doFail(),(n+i|0)<=e.length||new Nr(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var r,o,a=i/2|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return ho(t,e,n,l),l}function fo(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=2*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Tr(Or("integers array",r)).doFail(),Ic(a,s,e,n,i),o.v=h;var l=r;t.discardExact_za3lpa$(l),o.v}function yo(t,e,n,i){if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Nr((o=n,function(){return"offset shouldn't be negative: "+o})).doFail(),i>=0||new Nr((r=i,function(){return"length shouldn't be negative: "+r})).doFail(),(n+i|0)<=e.length||new Nr(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var r,o,a=i/4|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return mo(t,e,n,l),l}function $o(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=4*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Tr(Or("long integers array",r)).doFail(),zc(a,s,e,n,i),o.v=h;var l=r;t.discardExact_za3lpa$(l),o.v}function go(t,e,n,i){if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Nr((o=n,function(){return"offset shouldn't be negative: "+o})).doFail(),i>=0||new Nr((r=i,function(){return"length shouldn't be negative: "+r})).doFail(),(n+i|0)<=e.length||new Nr(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var r,o,a=i/8|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return vo(t,e,n,l),l}function bo(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=8*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Tr(Or("floating point numbers array",r)).doFail(),Dc(a,s,e,n,i),o.v=h;var l=r;t.discardExact_za3lpa$(l),o.v}function xo(t,e,n,i){if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Nr((o=n,function(){return"offset shouldn't be negative: "+o})).doFail(),i>=0||new Nr((r=i,function(){return"length shouldn't be negative: "+r})).doFail(),(n+i|0)<=e.length||new Nr(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var r,o,a=i/4|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return wo(t,e,n,l),l}function ko(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=4*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Tr(Or("floating point numbers array",r)).doFail(),Mc(a,s,e,n,i),o.v=h;var l=r;t.discardExact_za3lpa$(l),o.v}function Co(t,e,n,i){if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Nr((o=n,function(){return"offset shouldn't be negative: "+o})).doFail(),i>=0||new Nr((r=i,function(){return"length shouldn't be negative: "+r})).doFail(),(n+i|0)<=e.length||new Nr(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var r,o,a=i/8|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return Eo(t,e,n,l),l}function So(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=8*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=0))throw b("Failed requirement.".toString());if(!(n<=(e.limit-e.writePosition|0)))throw b("Failed requirement.".toString());var i={v:null},r=t.memory,o=t.readPosition;(t.writePosition-o|0)>=n||new Tr(Or("buffer content",n)).doFail(),r.copyTo_ubllm2$(e.memory,o,n,e.writePosition),e.commitWritten_za3lpa$(n),i.v=h;var a=n;return t.discardExact_za3lpa$(a),i.v,n}function Oo(t,e,n){if(void 0===n&&(n=e.limit-e.writePosition|0),!(t.writePosition>t.readPosition))return-1;var i=e.limit-e.writePosition|0,r=t.writePosition-t.readPosition|0,o=g.min(i,r,n),a={v:null},s=t.memory,l=t.readPosition;(t.writePosition-l|0)>=o||new Tr(Or("buffer content",o)).doFail(),s.copyTo_ubllm2$(e.memory,l,o,e.writePosition),e.commitWritten_za3lpa$(o),a.v=h;var u=o;return t.discardExact_za3lpa$(u),a.v,o}function No(t,e,n){var i;n>=0||new Nr((i=n,function(){return"length shouldn't be negative: "+i})).doFail(),n<=(e.writePosition-e.readPosition|0)||new Nr(function(t,e){return function(){var n=e;return"length shouldn't be greater than the source read remaining: "+t+" > "+(n.writePosition-n.readPosition|0)}}(n,e)).doFail(),n<=(t.limit-t.writePosition|0)||new Nr(function(t,e){return function(){var n=e;return"length shouldn't be greater than the destination write remaining space: "+t+" > "+(n.limit-n.writePosition|0)}}(n,t)).doFail();var r=t.memory,o=t.writePosition,a=t.limit-o|0;if(a=t,c=l(e,t);return u||new o(c).doFail(),i.v=n(r,a),t}}})),function(t,e,n,i){var r={v:null},o=t.memory,a=t.readPosition;(t.writePosition-a|0)>=e||new s(l(n,e)).doFail(),r.v=i(o,a);var u=e;return t.discardExact_za3lpa$(u),r.v}}))),Ao=w("ktor-ktor-io.io.ktor.utils.io.core.writeExact_n5pafo$",x((function(){var e=t.io.ktor.utils.io.core.InsufficientSpaceException_init_3m52m6$;return function(t,n,i,r){var o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s0)throw n(i);return e.toInt()}})));function Yo(t,n,i,r,o,a){var s=e.Long.fromInt(n.view.byteLength).subtract(i),l=e.Long.fromInt(t.writePosition-t.readPosition|0),u=a.compareTo_11rb$(l)<=0?a:l,c=s.compareTo_11rb$(u)<=0?s:u;return t.memory.copyTo_q2ka7j$(n,e.Long.fromInt(t.readPosition).add(r),c,i),c}function Vo(t){W(t,this),this.name="BufferLimitExceededException"}Vo.$metadata$={kind:p,simpleName:"BufferLimitExceededException",interfaces:[X]};var Ko=w("ktor-ktor-io.io.ktor.utils.io.core.buildPacket_1pjhv2$",x((function(){var n=t.io.ktor.utils.io.core.BytePacketBuilder_za3lpa$,i=Error;return function(t,r){void 0===t&&(t=0);var o=n(t);try{return r(o),o.build()}catch(t){throw e.isType(t,i)?(o.release(),t):t}}})));function Wo(t){Xo.call(this,t)}function Xo(t){Yi(t,this)}function Zo(t){this.closure$message=t,Il.call(this)}function Jo(t,e){var n;void 0===t&&(t=0),Wo.call(this,e),this.headerSizeHint_0=t,this.headerSizeHint_0>=0||new Zo((n=this,function(){return"shouldn't be negative: headerSizeHint = "+n.headerSizeHint_0})).doFail()}function Qo(t,e,n){na(),ra.call(this,t,e,n),this.markNoMoreChunksAvailable()}function ta(){ea=this,this.Empty=new Qo(Nl().Empty,u,Nl().EmptyPool)}Wo.$metadata$={kind:p,simpleName:"BytePacketBuilderPlatformBase",interfaces:[Xo]},Xo.$metadata$={kind:p,simpleName:"BytePacketBuilderBase",interfaces:[Hi]},Zo.prototype=Object.create(Il.prototype),Zo.prototype.constructor=Zo,Zo.prototype.doFail=function(){throw b(this.closure$message())},Zo.$metadata$={kind:p,interfaces:[Il]},Object.defineProperty(Jo.prototype,"size",{get:function(){return this._size}}),Object.defineProperty(Jo.prototype,"isEmpty",{get:function(){return 0===this._size}}),Object.defineProperty(Jo.prototype,"isNotEmpty",{get:function(){return this._size>0}}),Object.defineProperty(Jo.prototype,"_pool",{get:function(){return this.pool}}),Jo.prototype.closeDestination=function(){},Jo.prototype.flush_9etqdk$=function(t,e,n){},Jo.prototype.append_s8itvh$=function(t){var n;return e.isType(n=Wo.prototype.append_s8itvh$.call(this,t),Jo)?n:c()},Jo.prototype.append_gw00v9$=function(t){var n;return e.isType(n=Wo.prototype.append_gw00v9$.call(this,t),Jo)?n:c()},Jo.prototype.append_ezbsdh$=function(t,n,i){var r;return e.isType(r=Wo.prototype.append_ezbsdh$.call(this,t,n,i),Jo)?r:c()},Jo.prototype.appendOld_s8itvh$=function(t){return this.append_s8itvh$(t)},Jo.prototype.appendOld_gw00v9$=function(t){return this.append_gw00v9$(t)},Jo.prototype.appendOld_ezbsdh$=function(t,e,n){return this.append_ezbsdh$(t,e,n)},Jo.prototype.preview_chaoki$=function(t){var e,n=Ls(this);try{e=t(n)}finally{n.release()}return e},Jo.prototype.build=function(){var t=this.size,n=this.stealAll_8be2vx$();return null==n?na().Empty:new Qo(n,e.Long.fromInt(t),this.pool)},Jo.prototype.reset=function(){this.release()},Jo.prototype.preview=function(){return Ls(this)},Jo.prototype.toString=function(){return"BytePacketBuilder("+this.size+" bytes written)"},Jo.$metadata$={kind:p,simpleName:"BytePacketBuilder",interfaces:[Wo]},Qo.prototype.copy=function(){return new Qo(Mo(this.head),this.remaining,this.pool)},Qo.prototype.fill=function(){return null},Qo.prototype.fill_9etqdk$=function(t,e,n){return 0},Qo.prototype.closeSource=function(){},Qo.prototype.toString=function(){return"ByteReadPacket("+this.remaining.toString()+" bytes remaining)"},Object.defineProperty(ta.prototype,"ReservedSize",{get:function(){return 8}}),ta.$metadata$={kind:Y,simpleName:"Companion",interfaces:[]};var ea=null;function na(){return null===ea&&new ta,ea}function ia(t,e,n){return n=n||Object.create(Qo.prototype),Qo.call(n,t,Fo(t),e),n}function ra(t,e,n){ks.call(this,t,e,n)}Qo.$metadata$={kind:p,simpleName:"ByteReadPacket",interfaces:[ra,Np]},ra.$metadata$={kind:p,simpleName:"ByteReadPacketPlatformBase",interfaces:[ks]};var oa=w("ktor-ktor-io.io.ktor.utils.io.core.ByteReadPacket_mj6st8$",x((function(){var n=e.kotlin.Unit,i=t.io.ktor.utils.io.core.ByteReadPacket_1qge3v$;function r(t){return n}return function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=t.length),i(t,e,n,r)}}))),aa=w("ktor-ktor-io.io.ktor.utils.io.core.use_jh8f9t$",x((function(){var n=t.io.ktor.utils.io.core.addSuppressedInternal_oh0dqn$,i=Error;return function(t,r){var o,a=!1;try{o=r(t)}catch(r){if(e.isType(r,i)){try{a=!0,t.close()}catch(t){if(!e.isType(t,i))throw t;n(r,t)}throw r}throw r}finally{a||t.close()}return o}})));function sa(){}function la(t,e){var n=t.discard_s8cxhz$(e);if(!_(n,e))throw B("Only "+n.toString()+" bytes were discarded of "+e.toString()+" requested")}function ua(t,n){la(t,e.Long.fromInt(n))}sa.$metadata$={kind:p,simpleName:"ExperimentalIoApi",interfaces:[Q]};var ca=w("ktor-ktor-io.io.ktor.utils.io.core.takeWhile_nkhzd2$",x((function(){var e=t.io.ktor.utils.io.core.internal.prepareReadFirstHead_j319xh$,n=t.io.ktor.utils.io.core.internal.prepareReadNextHead_x2nit9$,i=t.io.ktor.utils.io.core.internal.completeReadHead_x2nit9$;return function(t,r){var o,a,s=!0;if(null!=(o=e(t,1))){var l=o;try{for(;r(l)&&(s=!1,null!=(a=n(t,l)));)l=a,s=!0}finally{s&&i(t,l)}}}}))),pa=w("ktor-ktor-io.io.ktor.utils.io.core.takeWhileSize_y109dn$",x((function(){var e=t.io.ktor.utils.io.core.internal.prepareReadFirstHead_j319xh$,n=t.io.ktor.utils.io.core.internal.prepareReadNextHead_x2nit9$,i=t.io.ktor.utils.io.core.internal.completeReadHead_x2nit9$;return function(t,r,o){var a,s;void 0===r&&(r=1);var l=!0;if(null!=(a=e(t,r))){var u=a,c=r;try{do{var p,h=u,_=h.writePosition-h.readPosition|0;if(_>=c)try{c=o(u)}finally{var f=u;p=f.writePosition-f.readPosition|0}else p=_;if(l=!1,0===p)s=n(t,u);else{var d=p0)}finally{l&&i(t,u)}}}})));var ha=w("ktor-ktor-io.io.ktor.utils.io.core.forEach_xalon3$",x((function(){var e=t.io.ktor.utils.io.core.internal.prepareReadFirstHead_j319xh$,n=t.io.ktor.utils.io.core.internal.prepareReadNextHead_x2nit9$,i=t.io.ktor.utils.io.core.internal.completeReadHead_x2nit9$;return function(t,r){t:do{var o,a,s=!0;if(null==(o=e(t,1)))break t;var l=o;try{for(;;){for(var u=l,c=u.memory,p=u.readPosition,h=u.writePosition,_=p;_0))break;if(l=!1,null==(s=uu(t,u)))break;u=s,l=!0}}finally{l&&lu(t,u)}}while(0);var f=r.v;f>0&&tl(f)}function fa(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a,c=1;try{do{var p,h=u,_=h.writePosition-h.readPosition|0;if(_>=c)try{var f=u,d=r.v,m=(f.writePosition-f.readPosition|0)/2|0,y=g.min(d,m);ho(f,e,o.v,y),r.v=r.v-y|0,o.v=o.v+y|0,c=r.v>0?2:0}finally{var $=u;p=$.writePosition-$.readPosition|0}else p=_;if(l=!1,0===p)s=uu(t,u);else{var v=p0)}finally{l&&lu(t,u)}}while(0);var x=r.v;x>0&&tl(x)}function da(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a,c=1;try{do{var p,h=u,_=h.writePosition-h.readPosition|0;if(_>=c)try{var f=u,d=r.v,m=(f.writePosition-f.readPosition|0)/4|0,y=g.min(d,m);mo(f,e,o.v,y),r.v=r.v-y|0,o.v=o.v+y|0,c=r.v>0?4:0}finally{var $=u;p=$.writePosition-$.readPosition|0}else p=_;if(l=!1,0===p)s=uu(t,u);else{var v=p0)}finally{l&&lu(t,u)}}while(0);var x=r.v;x>0&&tl(x)}function ma(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a,c=1;try{do{var p,h=u,_=h.writePosition-h.readPosition|0;if(_>=c)try{var f=u,d=r.v,m=(f.writePosition-f.readPosition|0)/8|0,y=g.min(d,m);vo(f,e,o.v,y),r.v=r.v-y|0,o.v=o.v+y|0,c=r.v>0?8:0}finally{var $=u;p=$.writePosition-$.readPosition|0}else p=_;if(l=!1,0===p)s=uu(t,u);else{var v=p0)}finally{l&&lu(t,u)}}while(0);var x=r.v;x>0&&tl(x)}function ya(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a,c=1;try{do{var p,h=u,_=h.writePosition-h.readPosition|0;if(_>=c)try{var f=u,d=r.v,m=(f.writePosition-f.readPosition|0)/4|0,y=g.min(d,m);wo(f,e,o.v,y),r.v=r.v-y|0,o.v=o.v+y|0,c=r.v>0?4:0}finally{var $=u;p=$.writePosition-$.readPosition|0}else p=_;if(l=!1,0===p)s=uu(t,u);else{var v=p0)}finally{l&&lu(t,u)}}while(0);var x=r.v;x>0&&tl(x)}function $a(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a,c=1;try{do{var p,h=u,_=h.writePosition-h.readPosition|0;if(_>=c)try{var f=u,d=r.v,m=(f.writePosition-f.readPosition|0)/8|0,y=g.min(d,m);Eo(f,e,o.v,y),r.v=r.v-y|0,o.v=o.v+y|0,c=r.v>0?8:0}finally{var $=u;p=$.writePosition-$.readPosition|0}else p=_;if(l=!1,0===p)s=uu(t,u);else{var v=p0)}finally{l&&lu(t,u)}}while(0);var x=r.v;x>0&&tl(x)}function va(t,e,n){void 0===n&&(n=e.limit-e.writePosition|0);var i={v:n},r={v:0};t:do{var o,a,s=!0;if(null==(o=su(t,1)))break t;var l=o;try{for(;;){var u=l,c=i.v,p=u.writePosition-u.readPosition|0,h=g.min(c,p);if(To(u,e,h),i.v=i.v-h|0,r.v=r.v+h|0,!(i.v>0))break;if(s=!1,null==(a=uu(t,l)))break;l=a,s=!0}}finally{s&&lu(t,l)}}while(0);var _=i.v;_>0&&tl(_)}function ga(t,e,n,i){_(Ta(t,e,n,i),i)||el(i)}function ba(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a;try{for(;;){var c=u,p=r.v,h=c.writePosition-c.readPosition|0,_=g.min(p,h);if(ao(c,e,o.v,_),r.v=r.v-_|0,o.v=o.v+_|0,!(r.v>0))break;if(l=!1,null==(s=uu(t,u)))break;u=s,l=!0}}finally{l&&lu(t,u)}}while(0);return i-r.v|0}function wa(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a,c=1;try{do{var p,h=u,_=h.writePosition-h.readPosition|0;if(_>=c)try{var f=u,d=r.v,m=(f.writePosition-f.readPosition|0)/2|0,y=g.min(d,m);ho(f,e,o.v,y),r.v=r.v-y|0,o.v=o.v+y|0,c=r.v>0?2:0}finally{var $=u;p=$.writePosition-$.readPosition|0}else p=_;if(l=!1,0===p)s=uu(t,u);else{var v=p0)}finally{l&&lu(t,u)}}while(0);return i-r.v|0}function xa(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a,c=1;try{do{var p,h=u,_=h.writePosition-h.readPosition|0;if(_>=c)try{var f=u,d=r.v,m=(f.writePosition-f.readPosition|0)/4|0,y=g.min(d,m);mo(f,e,o.v,y),r.v=r.v-y|0,o.v=o.v+y|0,c=r.v>0?4:0}finally{var $=u;p=$.writePosition-$.readPosition|0}else p=_;if(l=!1,0===p)s=uu(t,u);else{var v=p0)}finally{l&&lu(t,u)}}while(0);return i-r.v|0}function ka(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a,c=1;try{do{var p,h=u,_=h.writePosition-h.readPosition|0;if(_>=c)try{var f=u,d=r.v,m=(f.writePosition-f.readPosition|0)/8|0,y=g.min(d,m);vo(f,e,o.v,y),r.v=r.v-y|0,o.v=o.v+y|0,c=r.v>0?8:0}finally{var $=u;p=$.writePosition-$.readPosition|0}else p=_;if(l=!1,0===p)s=uu(t,u);else{var v=p0)}finally{l&&lu(t,u)}}while(0);return i-r.v|0}function Ea(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a,c=1;try{do{var p,h=u,_=h.writePosition-h.readPosition|0;if(_>=c)try{var f=u,d=r.v,m=(f.writePosition-f.readPosition|0)/4|0,y=g.min(d,m);wo(f,e,o.v,y),r.v=r.v-y|0,o.v=o.v+y|0,c=r.v>0?4:0}finally{var $=u;p=$.writePosition-$.readPosition|0}else p=_;if(l=!1,0===p)s=uu(t,u);else{var v=p0)}finally{l&&lu(t,u)}}while(0);return i-r.v|0}function Ca(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a,c=1;try{do{var p,h=u,_=h.writePosition-h.readPosition|0;if(_>=c)try{var f=u,d=r.v,m=(f.writePosition-f.readPosition|0)/8|0,y=g.min(d,m);Eo(f,e,o.v,y),r.v=r.v-y|0,o.v=o.v+y|0,c=r.v>0?8:0}finally{var $=u;p=$.writePosition-$.readPosition|0}else p=_;if(l=!1,0===p)s=uu(t,u);else{var v=p0)}finally{l&&lu(t,u)}}while(0);return i-r.v|0}function Sa(t,e,n){void 0===n&&(n=e.limit-e.writePosition|0);var i={v:n},r={v:0};t:do{var o,a,s=!0;if(null==(o=su(t,1)))break t;var l=o;try{for(;;){var u=l,c=i.v,p=u.writePosition-u.readPosition|0,h=g.min(c,p);if(To(u,e,h),i.v=i.v-h|0,r.v=r.v+h|0,!(i.v>0))break;if(s=!1,null==(a=uu(t,l)))break;l=a,s=!0}}finally{s&&lu(t,l)}}while(0);return n-i.v|0}function Ta(t,n,i,r){var o={v:r},a={v:i};t:do{var s,l,c=!0;if(null==(s=su(t,1)))break t;var p=s;try{for(;;){var h=p,f=o.v,d=e.Long.fromInt(h.writePosition-h.readPosition|0),m=(f.compareTo_11rb$(d)<=0?f:d).toInt(),y=h.memory,$=e.Long.fromInt(h.readPosition),v=a.v;if(y.copyTo_q2ka7j$(n,$,e.Long.fromInt(m),v),h.discardExact_za3lpa$(m),o.v=o.v.subtract(e.Long.fromInt(m)),a.v=a.v.add(e.Long.fromInt(m)),!(o.v.toNumber()>0))break;if(c=!1,null==(l=uu(t,p)))break;p=l,c=!0}}finally{c&&lu(t,p)}}while(0);var g=o.v,b=r.subtract(g);return _(b,u)&&t.endOfInput?tt:b}function Oa(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),fa(t,e,n,i);for(var r=n+i-1|0,o=n;o<=r;o++)e[o]=Hu(e[o])}function Na(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),da(t,e,n,i);for(var r=n+i-1|0,o=n;o<=r;o++)e[o]=Yu(e[o])}function Pa(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),ma(t,e,n,i);for(var r=n+i-1|0,o=n;o<=r;o++)e[o]=Vu(e[o])}function Aa(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=wa(t,e,n,i);if(r>0)for(var o=n+r-1|0,a=n;a<=o;a++)e[a]=Hu(e[a]);return r}function ja(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=xa(t,e,n,i);if(r>0)for(var o=n+r-1|0,a=n;a<=o;a++)e[a]=Yu(e[a]);return r}function La(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=ka(t,e,n,i);if(r>0)for(var o=n+r-1|0,a=n;a<=o;a++)e[a]=Vu(e[a]);return r}function Ra(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),ho(t,e,n,i);for(var r=n+i-1|0,o=n;o<=r;o++)e[o]=Hu(e[o])}function Ia(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),mo(t,e,n,i);for(var r=n+i-1|0,o=n;o<=r;o++)e[o]=Yu(e[o])}function za(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),vo(t,e,n,i);for(var r=n+i-1|0,o=n;o<=r;o++)e[o]=Vu(e[o])}function Da(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);for(var r=_o(t,e,n,i),o=n+r-1|0,a=n;a<=o;a++)e[a]=Hu(e[a]);return r}function Ma(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);for(var r=yo(t,e,n,i),o=n+r-1|0,a=n;a<=o;a++)e[a]=Yu(e[a]);return r}function Ba(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=go(t,e,n,i);if(r>0)for(var o=n+r-1|0,a=n;a<=o;a++)e[a]=Vu(e[a]);return r}function Ua(t,n,i,r,o){void 0===i&&(i=0),void 0===r&&(r=1),void 0===o&&(o=2147483647),_u(n,i,r,o);var a=t.peekTo_afjyek$(n.memory,e.Long.fromInt(n.writePosition),e.Long.fromInt(i),e.Long.fromInt(r),e.Long.fromInt(L(o,n.limit-n.writePosition|0))).toInt();return n.commitWritten_za3lpa$(a),a}function Fa(t){var n;t:do{var i=e.isType(t,Mi);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>2),i){var r=t.headPosition;t.headPosition=r+2|0,n=t.headMemory.view.getInt16(r,!1);break t}n=qa(t)}while(0);return n}function qa(t){var e,n=null!=(e=su(t,2))?e:tl(2),i=Lr(n);return lu(t,n),i}function Ga(t){var n;t:do{var i=e.isType(t,Mi);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>4),i){var r=t.headPosition;t.headPosition=r+4|0,n=t.headMemory.view.getInt32(r,!1);break t}n=Ha(t)}while(0);return n}function Ha(t){var e,n=null!=(e=su(t,4))?e:tl(4),i=zr(n);return lu(t,n),i}function Ya(t){var n;t:do{var i=e.isType(t,Mi);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>8),i){var r=t.headPosition;t.headPosition=r+8|0;var o=t.headMemory;n=e.Long.fromInt(o.view.getUint32(r,!1)).shiftLeft(32).or(e.Long.fromInt(o.view.getUint32(r+4|0,!1)));break t}n=Va(t)}while(0);return n}function Va(t){var e,n=null!=(e=su(t,8))?e:tl(8),i=Br(n);return lu(t,n),i}function Ka(t){var n;t:do{var i=e.isType(t,Mi);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>4),i){var r=t.headPosition;t.headPosition=r+4|0,n=t.headMemory.view.getFloat32(r,!1);break t}n=Wa(t)}while(0);return n}function Wa(t){var e,n=null!=(e=su(t,4))?e:tl(4),i=qr(n);return lu(t,n),i}function Xa(t){var n;t:do{var i=e.isType(t,Mi);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>8),i){var r=t.headPosition;t.headPosition=r+8|0,n=t.headMemory.view.getFloat64(r,!1);break t}n=Za(t)}while(0);return n}function Za(t){var e,n=null!=(e=su(t,8))?e:tl(8),i=Hr(n);return lu(t,n),i}function Ja(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:n},o={v:i},a=cu(t,1,null);try{for(;;){var s=a,l=o.v,u=s.limit-s.writePosition|0,c=g.min(l,u);if(co(s,e,r.v,c),r.v=r.v+c|0,o.v=o.v-c|0,!(o.v>0))break;a=cu(t,1,a)}}finally{pu(t,a)}}function Qa(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=cu(t,2,null);try{for(var l;;){var u=s,c=a.v,p=u.limit-u.writePosition|0,h=g.min(c,p);if(fo(u,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,2))<=0)break;s=cu(t,l,s)}}finally{pu(t,s)}}function ts(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=cu(t,4,null);try{for(var l;;){var u=s,c=a.v,p=u.limit-u.writePosition|0,h=g.min(c,p);if($o(u,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,4))<=0)break;s=cu(t,l,s)}}finally{pu(t,s)}}function es(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=cu(t,8,null);try{for(var l;;){var u=s,c=a.v,p=u.limit-u.writePosition|0,h=g.min(c,p);if(bo(u,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,8))<=0)break;s=cu(t,l,s)}}finally{pu(t,s)}}function ns(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=cu(t,4,null);try{for(var l;;){var u=s,c=a.v,p=u.limit-u.writePosition|0,h=g.min(c,p);if(ko(u,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,4))<=0)break;s=cu(t,l,s)}}finally{pu(t,s)}}function is(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=cu(t,8,null);try{for(var l;;){var u=s,c=a.v,p=u.limit-u.writePosition|0,h=g.min(c,p);if(So(u,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,8))<=0)break;s=cu(t,l,s)}}finally{pu(t,s)}}function rs(t,e,n){void 0===n&&(n=e.writePosition-e.readPosition|0);var i={v:0},r={v:n},o=cu(t,1,null);try{for(;;){var a=o,s=r.v,l=a.limit-a.writePosition|0,u=g.min(s,l);if(No(a,e,u),i.v=i.v+u|0,r.v=r.v-u|0,!(r.v>0))break;o=cu(t,1,o)}}finally{pu(t,o)}}function os(t,n,i,r){var o={v:i},a={v:r},s=cu(t,1,null);try{for(;;){var l=s,u=a.v,c=e.Long.fromInt(l.limit-l.writePosition|0),p=u.compareTo_11rb$(c)<=0?u:c;if(n.copyTo_q2ka7j$(l.memory,o.v,p,e.Long.fromInt(l.writePosition)),l.commitWritten_za3lpa$(p.toInt()),o.v=o.v.add(p),a.v=a.v.subtract(p),!(a.v.toNumber()>0))break;s=cu(t,1,s)}}finally{pu(t,s)}}function as(t,n,i){if(void 0===i&&(i=0),e.isType(t,Hi)){var r={v:u},o=cu(t,1,null);try{for(;;){var a=o,s=e.Long.fromInt(a.limit-a.writePosition|0),l=n.subtract(r.v),c=(s.compareTo_11rb$(l)<=0?s:l).toInt();if(mr(a,c,i),r.v=r.v.add(e.Long.fromInt(c)),!(r.v.compareTo_11rb$(n)<0))break;o=cu(t,1,o)}}finally{pu(t,o)}}else!function(t,e,n){var i;for(i=et(0,e).iterator();i.hasNext();)i.next(),t.writeByte_s8j3t7$(n)}(t,n,i)}var ss=w("ktor-ktor-io.io.ktor.utils.io.core.writeWhile_rh5n47$",x((function(){var e=t.io.ktor.utils.io.core.internal.prepareWriteHead_6z8r11$,n=t.io.ktor.utils.io.core.internal.afterHeadWrite_z1cqja$;return function(t,i){var r=e(t,1,null);try{for(;i(r);)r=e(t,1,r)}finally{n(t,r)}}}))),ls=w("ktor-ktor-io.io.ktor.utils.io.core.writeWhileSize_cmxbvc$",x((function(){var e=t.io.ktor.utils.io.core.internal.prepareWriteHead_6z8r11$,n=t.io.ktor.utils.io.core.internal.afterHeadWrite_z1cqja$;return function(t,i,r){void 0===i&&(i=1);var o=e(t,i,null);try{for(var a;!((a=r(o))<=0);)o=e(t,a,o)}finally{n(t,o)}}})));function us(t,n){if(e.isType(t,Xo))t.writePacket_3uq2w4$(n);else t:do{var i,r,o=!0;if(null==(i=su(n,1)))break t;var a=i;try{for(;rs(t,a),o=!1,null!=(r=uu(n,a));)a=r,o=!0}finally{o&&lu(n,a)}}while(0)}function cs(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=n+i|0,o={v:n},a=cu(t,2,null);try{for(var s;;){for(var l=a,u=(l.limit-l.writePosition|0)/2|0,c=r-o.v|0,p=g.min(u,c),h=o.v+p-1|0,_=o.v;_<=h;_++)Vr(l,Hu(e[_]));if(o.v=o.v+p|0,(s=o.v2){t.tailPosition_8be2vx$=r+2|0,t.tailMemory_8be2vx$.view.setInt16(r,n,!1),i=!0;break t}}i=!1}while(0);i||function(t,n){var i;t:do{if(e.isType(t,Hi)){Vr(t.prepareWriteHead_za3lpa$(2),n),t.afterHeadWrite(),i=!0;break t}i=!1}while(0);i||(t.writeByte_s8j3t7$(d((255&n)>>8)),t.writeByte_s8j3t7$(d(255&n)))}(t,n)}function ys(t,n){var i;t:do{if(e.isType(t,Hi)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>4){t.tailPosition_8be2vx$=r+4|0,t.tailMemory_8be2vx$.view.setInt32(r,n,!1),i=!0;break t}}i=!1}while(0);i||$s(t,n)}function $s(t,n){var i;t:do{if(e.isType(t,Hi)){Xr(t.prepareWriteHead_za3lpa$(4),n),t.afterHeadWrite(),i=!0;break t}i=!1}while(0);i||vs(t,n)}function vs(t,e){var n=k(e>>>16);t.writeByte_s8j3t7$(d((255&n)>>8)),t.writeByte_s8j3t7$(d(255&n));var i=k(65535&e);t.writeByte_s8j3t7$(d((255&i)>>8)),t.writeByte_s8j3t7$(d(255&i))}function gs(t,n){var i;t:do{if(e.isType(t,Hi)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>8){t.tailPosition_8be2vx$=r+8|0;var o=t.tailMemory_8be2vx$;o.view.setInt32(r,n.shiftRight(32).toInt(),!1),o.view.setInt32(r+4|0,n.and(J).toInt(),!1),i=!0;break t}}i=!1}while(0);i||bs(t,n)}function bs(t,n){var i;t:do{if(e.isType(t,Hi)){Qr(t.prepareWriteHead_za3lpa$(8),n),t.afterHeadWrite(),i=!0;break t}i=!1}while(0);i||(vs(t,n.shiftRightUnsigned(32).toInt()),vs(t,n.and(J).toInt()))}function ws(t,n){var i;t:do{if(e.isType(t,Hi)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>4){t.tailPosition_8be2vx$=r+4|0,t.tailMemory_8be2vx$.view.setFloat32(r,n,!1),i=!0;break t}}i=!1}while(0);i||$s(t,nt(n))}function xs(t,n){var i;t:do{if(e.isType(t,Hi)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>8){t.tailPosition_8be2vx$=r+8|0,t.tailMemory_8be2vx$.view.setFloat64(r,n,!1),i=!0;break t}}i=!1}while(0);i||bs(t,it(n))}function ks(t,e,n){Ss(),Mi.call(this,t,e,n)}function Es(){Cs=this}Object.defineProperty(Es.prototype,"Empty",{get:function(){return na().Empty}}),Es.$metadata$={kind:Y,simpleName:"Companion",interfaces:[]};var Cs=null;function Ss(){return null===Cs&&new Es,Cs}ks.$metadata$={kind:p,simpleName:"ByteReadPacketBase",interfaces:[Mi]};var Ts=w("ktor-ktor-io.io.ktor.utils.io.core.get_isEmpty_7wsnj1$",(function(t){return t.endOfInput}));function Os(t){var e;return!t.endOfInput&&null!=(e=su(t,1))&&(lu(t,e),!0)}var Ns=w("ktor-ktor-io.io.ktor.utils.io.core.get_isEmpty_mlrm9h$",(function(t){return t.endOfInput})),Ps=w("ktor-ktor-io.io.ktor.utils.io.core.get_isNotEmpty_mlrm9h$",(function(t){return!t.endOfInput})),As=w("ktor-ktor-io.io.ktor.utils.io.core.read_q4ikbw$",x((function(){var n=t.io.ktor.utils.io.core.prematureEndOfStream_za3lpa$,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(t,e,r){var o;void 0===e&&(e=1);var a=null!=(o=t.prepareRead_za3lpa$(e))?o:n(e),s=a.readPosition;try{r(a)}finally{var l=a.readPosition;if(l0;if(_&&(_=!(p.writePosition>p.readPosition)),!_)break;if(u=!1,null==(l=uu(t,c)))break;c=l,u=!0}}finally{u&&lu(t,c)}}while(0);return o.v-i|0}function Is(t,n,i){var r={v:u};t:do{var o,a,s=!0;if(null==(o=su(t,1)))break t;var l=o;try{for(;;){var c=l,p=wh(c,n,i);if(r.v=r.v.add(e.Long.fromInt(p)),c.writePosition>c.readPosition)break;if(s=!1,null==(a=uu(t,l)))break;l=a,s=!0}}finally{s&&lu(t,l)}}while(0);return r.v}function zs(t,n,i,r){var o={v:u};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var c=a;try{for(;;){var p=c,h=xh(p,n,i,r);if(o.v=o.v.add(e.Long.fromInt(h)),p.writePosition>p.readPosition)break;if(l=!1,null==(s=uu(t,c)))break;c=s,l=!0}}finally{l&&lu(t,c)}}while(0);return o.v}var Ds=w("ktor-ktor-io.io.ktor.utils.io.core.copyUntil_31bg9c$",x((function(){var e=Math,n=t.io.ktor.utils.io.bits.copyTo_tiw1kd$;return function(t,i,r,o,a){var s,l=t.readPosition,u=t.writePosition,c=l+a|0,p=e.min(u,c),h=t.memory;s=p;for(var _=l;_=p)try{var d,m=c,y={v:0};n:do{for(var $={v:0},v={v:0},g={v:0},b=m.memory,w=m.readPosition,x=m.writePosition,k=w;k>=1,$.v=$.v+1|0;if(g.v=$.v,$.v=$.v-1|0,g.v>(x-k|0)){m.discardExact_za3lpa$(k-w|0),d=g.v;break n}}else if(v.v=v.v<<6|127&E,$.v=$.v-1|0,0===$.v){if(Ql(v.v)){var N,P=K(V(v.v));i:do{switch(H(P)){case 13:if(o.v){a.v=!0,N=!1;break i}o.v=!0,N=!0;break i;case 10:a.v=!0,y.v=1,N=!1;break i;default:if(o.v){a.v=!0,N=!1;break i}i.v===n&&Qs(n),i.v=i.v+1|0,e.append_s8itvh$(H(P)),N=!0;break i}}while(0);if(!N){m.discardExact_za3lpa$(k-w-g.v+1|0),d=-1;break n}}else if(tu(v.v)){var A,j=K(V(nu(v.v)));i:do{switch(H(j)){case 13:if(o.v){a.v=!0,A=!1;break i}o.v=!0,A=!0;break i;case 10:a.v=!0,y.v=1,A=!1;break i;default:if(o.v){a.v=!0,A=!1;break i}i.v===n&&Qs(n),i.v=i.v+1|0,e.append_s8itvh$(H(j)),A=!0;break i}}while(0);var L=!A;if(!L){var R,I=K(V(eu(v.v)));i:do{switch(H(I)){case 13:if(o.v){a.v=!0,R=!1;break i}o.v=!0,R=!0;break i;case 10:a.v=!0,y.v=1,R=!1;break i;default:if(o.v){a.v=!0,R=!1;break i}i.v===n&&Qs(n),i.v=i.v+1|0,e.append_s8itvh$(H(I)),R=!0;break i}}while(0);L=!R}if(L){m.discardExact_za3lpa$(k-w-g.v+1|0),d=-1;break n}}else Jl(v.v);v.v=0}}var z=x-w|0;m.discardExact_za3lpa$(z),d=0}while(0);r.v=d,y.v>0&&m.discardExact_za3lpa$(y.v),p=a.v?0:G(r.v,1)}finally{var D=c;h=D.writePosition-D.readPosition|0}else h=f;if(u=!1,0===h)l=uu(t,c);else{var M=h0)}finally{u&&lu(t,c)}}while(0);return r.v>1&&tl(r.v),i.v>0||!t.endOfInput}function Fs(t,e,n,i){void 0===i&&(i=2147483647);var r={v:0},o={v:!1};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a;try{e:for(;;){var c,p=u;n:do{for(var h=p.memory,_=p.readPosition,f=p.writePosition,d=_;d=p)try{var d,m=c;n:do{for(var y={v:0},$={v:0},v={v:0},g=m.memory,b=m.readPosition,w=m.writePosition,x=b;x>=1,y.v=y.v+1|0;if(v.v=y.v,y.v=y.v-1|0,v.v>(w-x|0)){m.discardExact_za3lpa$(x-b|0),d=v.v;break n}}else if($.v=$.v<<6|127&k,y.v=y.v-1|0,0===y.v){if(Ql($.v)){var O,N=K(V($.v));if(rt(n,H(N))?O=!1:(o.v===i&&Qs(i),o.v=o.v+1|0,e.append_s8itvh$(H(N)),O=!0),!O){m.discardExact_za3lpa$(x-b-v.v+1|0),d=-1;break n}}else if(tu($.v)){var P,A=K(V(nu($.v)));rt(n,H(A))?P=!1:(o.v===i&&Qs(i),o.v=o.v+1|0,e.append_s8itvh$(H(A)),P=!0);var j=!P;if(!j){var L,R=K(V(eu($.v)));rt(n,H(R))?L=!1:(o.v===i&&Qs(i),o.v=o.v+1|0,e.append_s8itvh$(H(R)),L=!0),j=!L}if(j){m.discardExact_za3lpa$(x-b-v.v+1|0),d=-1;break n}}else Jl($.v);$.v=0}}var I=w-b|0;m.discardExact_za3lpa$(I),d=0}while(0);a.v=d,a.v=-1===a.v?0:G(a.v,1),p=a.v}finally{var z=c;h=z.writePosition-z.readPosition|0}else h=f;if(u=!1,0===h)l=uu(t,c);else{var D=h0)}finally{u&&lu(t,c)}}while(0);return a.v>1&&tl(a.v),o.v}(t,e,n,i,r.v)),r.v}function qs(t,e,n,i){void 0===i&&(i=2147483647);var r=n.length,o=1===r;if(o&&(o=(0|n.charCodeAt(0))<=127),o)return Is(t,d(0|n.charCodeAt(0)),e).toInt();var a=2===r;a&&(a=(0|n.charCodeAt(0))<=127);var s=a;return s&&(s=(0|n.charCodeAt(1))<=127),s?zs(t,d(0|n.charCodeAt(0)),d(0|n.charCodeAt(1)),e).toInt():function(t,e,n,i){var r={v:0},o={v:!1};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a;try{e:for(;;){var c,p=u,h=p.writePosition-p.readPosition|0;n:do{for(var _=p.memory,f=p.readPosition,d=p.writePosition,m=f;m0&&(p.rewind_za3lpa$(w),rs(i,p,w)),!b)break e;if(l=!1,null==(s=uu(t,u)))break e;u=s,l=!0}}finally{l&&lu(t,u)}}while(0);return o.v||t.endOfInput||(r.v=function(t,e,n,i,r){var o={v:r},a={v:1};t:do{var s,l,u=!0;if(null==(s=su(t,1)))break t;var c=s,p=1;try{e:do{var h,_=c,f=_.writePosition-_.readPosition|0;if(f>=p)try{var d,m=c,y=m.writePosition-m.readPosition|0;n:do{for(var $={v:0},v={v:0},g={v:0},b=m.memory,w=m.readPosition,x=m.writePosition,k=w;k>=1,$.v=$.v+1|0;if(g.v=$.v,$.v=$.v-1|0,g.v>(x-k|0)){m.discardExact_za3lpa$(k-w|0),d=g.v;break n}}else if(v.v=v.v<<6|127&C,$.v=$.v-1|0,0===$.v){var O;if(Ql(v.v)){if(rt(n,H(K(V(v.v))))?O=!1:(o.v===i&&Qs(i),o.v=o.v+1|0,O=!0),!O){m.discardExact_za3lpa$(k-w-g.v+1|0),d=-1;break n}}else if(tu(v.v)){var N;rt(n,H(K(V(nu(v.v)))))?N=!1:(o.v===i&&Qs(i),o.v=o.v+1|0,N=!0);var P,A=!N;if(A||(rt(n,H(K(V(eu(v.v)))))?P=!1:(o.v===i&&Qs(i),o.v=o.v+1|0,P=!0),A=!P),A){m.discardExact_za3lpa$(k-w-g.v+1|0),d=-1;break n}}else Jl(v.v);v.v=0}}var j=x-w|0;m.discardExact_za3lpa$(j),d=0}while(0);a.v=d;var L=y-(m.writePosition-m.readPosition|0)|0;L>0&&(m.rewind_za3lpa$(L),rs(e,m,L)),a.v=-1===a.v?0:G(a.v,1),p=a.v}finally{var R=c;h=R.writePosition-R.readPosition|0}else h=f;if(u=!1,0===h)l=uu(t,c);else{var I=h0)}finally{u&&lu(t,c)}}while(0);return a.v>1&&tl(a.v),o.v}(t,i,e,n,r.v)),r.v}(t,n,i,e)}function Gs(t,e){if(void 0===e){var n=t.remaining;if(n.compareTo_11rb$(st)>0)throw b("Unable to convert to a ByteArray: packet is too big");e=n.toInt()}if(0!==e){var i=new Int8Array(e);return _a(t,i,0,e),i}return Wl}function Hs(t,n,i){if(void 0===n&&(n=0),void 0===i&&(i=2147483647),n===i&&0===n)return Wl;if(n===i){var r=new Int8Array(n);return _a(t,r,0,n),r}for(var o=new Int8Array(ot(v(e.Long.fromInt(i),Ri(t)),e.Long.fromInt(n)).toInt()),a=0;a>>16)),_=new I(k(65535&p.value));if(r.v=r.v+(65535&h.data)|0,s.commitWritten_za3lpa$(65535&_.data),(a=0==(65535&h.data)&&r.v0)throw B("This instance is already in use but somehow appeared in the pool.");if(this.refCount_yk3bl6$_0===t&&(this.refCount_yk3bl6$_0=1,1))break t}}while(0)},bl.prototype.release_8be2vx$=function(){var t;this.refCount_yk3bl6$_0;t:do{for(;;){var e=this.refCount_yk3bl6$_0;if(e<=0)throw B("Unable to release: it is already released.");var n=e-1|0;if(this.refCount_yk3bl6$_0===e&&(this.refCount_yk3bl6$_0=n,1)){t=n;break t}}}while(0);return 0===t},bl.prototype.reset=function(){null!=this.origin&&new gl(wl).doFail(),Vi.prototype.reset.call(this),this.attachment=null,this.nextRef_43oo9e$_0=null},Object.defineProperty(xl.prototype,"Empty",{get:function(){return Qp().Empty}}),Object.defineProperty(kl.prototype,"capacity",{get:function(){return xr.capacity}}),kl.prototype.borrow=function(){return xr.borrow()},kl.prototype.recycle_trkh7z$=function(t){if(!e.isType(t,Hp))throw b("Only IoBuffer instances can be recycled.");xr.recycle_trkh7z$(t)},kl.prototype.dispose=function(){xr.dispose()},kl.$metadata$={kind:p,interfaces:[gu]},Object.defineProperty(El.prototype,"capacity",{get:function(){return 1}}),El.prototype.borrow=function(){return Nl().Empty},El.prototype.recycle_trkh7z$=function(t){t!==Nl().Empty&&new gl(Cl).doFail()},El.prototype.dispose=function(){},El.$metadata$={kind:p,interfaces:[gu]},Sl.prototype.borrow=function(){return new Hp(ic().alloc_za3lpa$(4096),null)},Sl.prototype.recycle_trkh7z$=function(t){if(!e.isType(t,Hp))throw b("Only IoBuffer instances can be recycled.");ic().free_vn6nzs$(t.memory)},Sl.$metadata$={kind:p,interfaces:[bu]},Tl.prototype.borrow=function(){throw R("This pool doesn't support borrow")},Tl.prototype.recycle_trkh7z$=function(t){},Tl.$metadata$={kind:p,interfaces:[bu]},xl.$metadata$={kind:Y,simpleName:"Companion",interfaces:[]};var Ol=null;function Nl(){return null===Ol&&new xl,Ol}function Pl(){return"A chunk couldn't be a view of itself."}function Al(t){return 1===t.referenceCount}bl.$metadata$={kind:p,simpleName:"ChunkBuffer",interfaces:[Vi]};var jl=w("ktor-ktor-io.io.ktor.utils.io.core.internal.toIntOrFail_z7h088$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n){return t.toNumber()>=2147483647&&e(t,n),t.toInt()}})));function Ll(t,e){throw b("Long value "+t.toString()+" of "+e+" doesn't fit into 32-bit integer")}var Rl=w("ktor-ktor-io.io.ktor.utils.io.core.internal.require_87ejdh$",x((function(){var n=e.kotlin.IllegalArgumentException_init_pdl1vj$,i=t.io.ktor.utils.io.core.internal.RequireFailureCapture,r=e.Kind.CLASS;function o(t){this.closure$message=t,i.call(this)}return o.prototype=Object.create(i.prototype),o.prototype.constructor=o,o.prototype.doFail=function(){throw n(this.closure$message())},o.$metadata$={kind:r,interfaces:[i]},function(t,e){t||new o(e).doFail()}})));function Il(){}function zl(t){this.closure$message=t,Il.call(this)}Il.$metadata$={kind:p,simpleName:"RequireFailureCapture",interfaces:[]},zl.prototype=Object.create(Il.prototype),zl.prototype.constructor=zl,zl.prototype.doFail=function(){throw b(this.closure$message())},zl.$metadata$={kind:p,interfaces:[Il]};var Dl=w("ktor-ktor-io.io.ktor.utils.io.core.internal.decodeASCII_j5qx8u$",x((function(){var t=e.toChar,n=e.toBoxedChar;return function(e,i){for(var r=e.memory,o=e.readPosition,a=e.writePosition,s=o;s>=1,e=e+1|0;return e}Ml.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Ml.prototype=Object.create(s.prototype),Ml.prototype.constructor=Ml,Ml.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$decoded={v:0},this.local$size={v:1},this.local$cr={v:!1},this.local$end={v:!1},this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$end.v||0===this.local$size.v){this.state_0=5;continue}if(this.state_0=3,this.result_0=this.local$nextChunk(this.local$size.v,this),this.result_0===a)return a;continue;case 3:if(this.local$tmp$=this.result_0,null==this.local$tmp$){this.state_0=5;continue}this.state_0=4;continue;case 4:var t=this.local$tmp$;t:do{var e,n,i=!0;if(null==(e=su(t,1)))break t;var r=e,o=1;try{e:do{var s,l=r,u=l.writePosition-l.readPosition|0;if(u>=o)try{var c,p=r,h={v:0};n:do{for(var _={v:0},f={v:0},d={v:0},m=p.memory,y=p.readPosition,$=p.writePosition,v=y;v<$;v++){var g=255&m.view.getInt8(v);if(0==(128&g)){0!==_.v&&Zl(_.v);var b,w=K(V(g));i:do{switch(H(w)){case 13:if(this.local$cr.v){this.local$end.v=!0,b=!1;break i}this.local$cr.v=!0,b=!0;break i;case 10:this.local$end.v=!0,h.v=1,b=!1;break i;default:if(this.local$cr.v){this.local$end.v=!0,b=!1;break i}if(this.local$decoded.v===this.local$limit)throw new Vo("Too many characters in line: limit "+this.local$limit+" exceeded");this.local$decoded.v=this.local$decoded.v+1|0,this.local$out.append_s8itvh$(H(w)),b=!0;break i}}while(0);if(!b){p.discardExact_za3lpa$(v-y|0),c=-1;break n}}else if(0===_.v){var x=128;f.v=g;for(var k=1;k<=6&&0!=(f.v&x);k++)f.v=f.v&~x,x>>=1,_.v=_.v+1|0;if(d.v=_.v,_.v=_.v-1|0,d.v>($-v|0)){p.discardExact_za3lpa$(v-y|0),c=d.v;break n}}else if(f.v=f.v<<6|127&g,_.v=_.v-1|0,0===_.v){if(Ql(f.v)){var E,C=K(V(f.v));i:do{switch(H(C)){case 13:if(this.local$cr.v){this.local$end.v=!0,E=!1;break i}this.local$cr.v=!0,E=!0;break i;case 10:this.local$end.v=!0,h.v=1,E=!1;break i;default:if(this.local$cr.v){this.local$end.v=!0,E=!1;break i}if(this.local$decoded.v===this.local$limit)throw new Vo("Too many characters in line: limit "+this.local$limit+" exceeded");this.local$decoded.v=this.local$decoded.v+1|0,this.local$out.append_s8itvh$(H(C)),E=!0;break i}}while(0);if(!E){p.discardExact_za3lpa$(v-y-d.v+1|0),c=-1;break n}}else if(tu(f.v)){var S,T=K(V(nu(f.v)));i:do{switch(H(T)){case 13:if(this.local$cr.v){this.local$end.v=!0,S=!1;break i}this.local$cr.v=!0,S=!0;break i;case 10:this.local$end.v=!0,h.v=1,S=!1;break i;default:if(this.local$cr.v){this.local$end.v=!0,S=!1;break i}if(this.local$decoded.v===this.local$limit)throw new Vo("Too many characters in line: limit "+this.local$limit+" exceeded");this.local$decoded.v=this.local$decoded.v+1|0,this.local$out.append_s8itvh$(H(T)),S=!0;break i}}while(0);var O=!S;if(!O){var N,P=K(V(eu(f.v)));i:do{switch(H(P)){case 13:if(this.local$cr.v){this.local$end.v=!0,N=!1;break i}this.local$cr.v=!0,N=!0;break i;case 10:this.local$end.v=!0,h.v=1,N=!1;break i;default:if(this.local$cr.v){this.local$end.v=!0,N=!1;break i}if(this.local$decoded.v===this.local$limit)throw new Vo("Too many characters in line: limit "+this.local$limit+" exceeded");this.local$decoded.v=this.local$decoded.v+1|0,this.local$out.append_s8itvh$(H(P)),N=!0;break i}}while(0);O=!N}if(O){p.discardExact_za3lpa$(v-y-d.v+1|0),c=-1;break n}}else Jl(f.v);f.v=0}}var A=$-y|0;p.discardExact_za3lpa$(A),c=0}while(0);this.local$size.v=c,h.v>0&&p.discardExact_za3lpa$(h.v),this.local$size.v=this.local$end.v?0:G(this.local$size.v,1),o=this.local$size.v}finally{var j=r;s=j.writePosition-j.readPosition|0}else s=u;if(i=!1,0===s)n=uu(t,r);else{var L=s0)}finally{i&&lu(t,r)}}while(0);this.state_0=2;continue;case 5:return this.local$size.v>1&&Ul(this.local$size.v),this.local$cr.v&&(this.local$end.v=!0),this.local$decoded.v>0||this.local$end.v;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}};var ql=w("ktor-ktor-io.io.ktor.utils.io.core.internal.decodeUTF8_cise53$",x((function(){var n=t.io.ktor.utils.io.core.Buffer,i=e.throwCCE,r=t.io.ktor.utils.io.core.internal.malformedByteCount_za3lpa$,o=e.toChar,a=e.toBoxedChar,s=t.io.ktor.utils.io.core.internal.isBmpCodePoint_za3lpa$,l=t.io.ktor.utils.io.core.internal.isValidCodePoint_za3lpa$,u=t.io.ktor.utils.io.core.internal.malformedCodePoint_za3lpa$,c=t.io.ktor.utils.io.core.internal.highSurrogate_za3lpa$,p=t.io.ktor.utils.io.core.internal.lowSurrogate_za3lpa$;return function(t,h){var _,f,d=e.isType(_=t,n)?_:i();t:do{for(var m={v:0},y={v:0},$={v:0},v=d.memory,g=d.readPosition,b=d.writePosition,w=g;w>=1,m.v=m.v+1|0;if($.v=m.v,m.v=m.v-1|0,$.v>(b-w|0)){d.discardExact_za3lpa$(w-g|0),f=$.v;break t}}else if(y.v=y.v<<6|127&x,m.v=m.v-1|0,0===m.v){if(s(y.v)){if(!h(a(o(y.v)))){d.discardExact_za3lpa$(w-g-$.v+1|0),f=-1;break t}}else if(l(y.v)){if(!h(a(o(c(y.v))))||!h(a(o(p(y.v))))){d.discardExact_za3lpa$(w-g-$.v+1|0),f=-1;break t}}else u(y.v);y.v=0}}var C=b-g|0;d.discardExact_za3lpa$(C),f=0}while(0);return f}}))),Gl=w("ktor-ktor-io.io.ktor.utils.io.core.internal.decodeUTF8_dce4k1$",x((function(){var n=t.io.ktor.utils.io.core.internal.malformedByteCount_za3lpa$,i=e.toChar,r=e.toBoxedChar,o=t.io.ktor.utils.io.core.internal.isBmpCodePoint_za3lpa$,a=t.io.ktor.utils.io.core.internal.isValidCodePoint_za3lpa$,s=t.io.ktor.utils.io.core.internal.malformedCodePoint_za3lpa$,l=t.io.ktor.utils.io.core.internal.highSurrogate_za3lpa$,u=t.io.ktor.utils.io.core.internal.lowSurrogate_za3lpa$;return function(t,e){for(var c={v:0},p={v:0},h={v:0},_=t.memory,f=t.readPosition,d=t.writePosition,m=f;m>=1,c.v=c.v+1|0;if(h.v=c.v,c.v=c.v-1|0,h.v>(d-m|0))return t.discardExact_za3lpa$(m-f|0),h.v}else if(p.v=p.v<<6|127&y,c.v=c.v-1|0,0===c.v){if(o(p.v)){if(!e(r(i(p.v))))return t.discardExact_za3lpa$(m-f-h.v+1|0),-1}else if(a(p.v)){if(!e(r(i(l(p.v))))||!e(r(i(u(p.v)))))return t.discardExact_za3lpa$(m-f-h.v+1|0),-1}else s(p.v);p.v=0}}var g=d-f|0;return t.discardExact_za3lpa$(g),0}})));function Hl(t,e,n){this.array_0=t,this.offset_0=e,this.length_xy9hzd$_0=n}function Yl(t){this.value=t}function Vl(t,e,n){return n=n||Object.create(Yl.prototype),Yl.call(n,(65535&t.data)<<16|65535&e.data),n}function Kl(t,e,n,i,r,o){for(var a,s,l=n+(65535&I.Companion.MAX_VALUE.data)|0,u=g.min(i,l),c=L(o,65535&I.Companion.MAX_VALUE.data),p=r,h=n;;){if(p>=c||h>=u)return Vl(new I(k(h-n|0)),new I(k(p-r|0)));var _=65535&(0|e.charCodeAt((h=(a=h)+1|0,a)));if(0!=(65408&_))break;t.view.setInt8((p=(s=p)+1|0,s),d(_))}return function(t,e,n,i,r,o,a,s){for(var l,u,c=n,p=o,h=a-3|0;!((h-p|0)<=0||c>=i);){var _,f=e.charCodeAt((c=(l=c)+1|0,l)),m=pt(f)?c!==i&&ct(e.charCodeAt(c))?iu(f,e.charCodeAt((c=(u=c)+1|0,u))):63:0|f,y=p;0<=m&&m<=127?(t.view.setInt8(y,d(m)),_=1):128<=m&&m<=2047?(t.view.setInt8(y,d(192|m>>6&31)),t.view.setInt8(y+1|0,d(128|63&m)),_=2):2048<=m&&m<=65535?(t.view.setInt8(y,d(224|m>>12&15)),t.view.setInt8(y+1|0,d(128|m>>6&63)),t.view.setInt8(y+2|0,d(128|63&m)),_=3):65536<=m&&m<=1114111?(t.view.setInt8(y,d(240|m>>18&7)),t.view.setInt8(y+1|0,d(128|m>>12&63)),t.view.setInt8(y+2|0,d(128|m>>6&63)),t.view.setInt8(y+3|0,d(128|63&m)),_=4):_=Jl(m),p=p+_|0}return p===h?function(t,e,n,i,r,o,a,s){for(var l,u,c=n,p=o;;){var h=a-p|0;if(h<=0||c>=i)break;var _=e.charCodeAt((c=(l=c)+1|0,l)),f=pt(_)?c!==i&&ct(e.charCodeAt(c))?iu(_,e.charCodeAt((c=(u=c)+1|0,u))):63:0|_;if((1<=f&&f<=127?1:128<=f&&f<=2047?2:2048<=f&&f<=65535?3:65536<=f&&f<=1114111?4:Jl(f))>h){c=c-1|0;break}var m,y=p;0<=f&&f<=127?(t.view.setInt8(y,d(f)),m=1):128<=f&&f<=2047?(t.view.setInt8(y,d(192|f>>6&31)),t.view.setInt8(y+1|0,d(128|63&f)),m=2):2048<=f&&f<=65535?(t.view.setInt8(y,d(224|f>>12&15)),t.view.setInt8(y+1|0,d(128|f>>6&63)),t.view.setInt8(y+2|0,d(128|63&f)),m=3):65536<=f&&f<=1114111?(t.view.setInt8(y,d(240|f>>18&7)),t.view.setInt8(y+1|0,d(128|f>>12&63)),t.view.setInt8(y+2|0,d(128|f>>6&63)),t.view.setInt8(y+3|0,d(128|63&f)),m=4):m=Jl(f),p=p+m|0}return Vl(new I(k(c-r|0)),new I(k(p-s|0)))}(t,e,c,i,r,p,a,s):Vl(new I(k(c-r|0)),new I(k(p-s|0)))}(t,e,h=h-1|0,u,n,p,c,r)}Object.defineProperty(Hl.prototype,"length",{get:function(){return this.length_xy9hzd$_0}}),Hl.prototype.charCodeAt=function(t){return t>=this.length&&this.indexOutOfBounds_0(t),this.array_0[t+this.offset_0|0]},Hl.prototype.subSequence_vux9f0$=function(t,e){return t>=0||new zl((r=t,function(){return"startIndex shouldn't be negative: "+r})).doFail(),t<=this.length||new zl(function(t,e){return function(){return"startIndex is too large: "+t+" > "+e.length}}(t,this)).doFail(),(t+e|0)<=this.length||new zl((n=e,i=this,function(){return"endIndex is too large: "+n+" > "+i.length})).doFail(),e>=t||new zl(function(t,e){return function(){return"endIndex should be greater or equal to startIndex: "+t+" > "+e}}(t,e)).doFail(),new Hl(this.array_0,this.offset_0+t|0,e-t|0);var n,i,r},Hl.prototype.indexOutOfBounds_0=function(t){throw new lt("String index out of bounds: "+t+" > "+this.length)},Hl.$metadata$={kind:p,simpleName:"CharArraySequence",interfaces:[ut]},Object.defineProperty(Yl.prototype,"characters",{get:w("ktor-ktor-io.io.ktor.utils.io.core.internal.EncodeResult.get_characters",x((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(this.value>>>16))}})))}),Object.defineProperty(Yl.prototype,"bytes",{get:w("ktor-ktor-io.io.ktor.utils.io.core.internal.EncodeResult.get_bytes",x((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(65535&this.value))}})))}),Yl.prototype.component1=w("ktor-ktor-io.io.ktor.utils.io.core.internal.EncodeResult.component1",x((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(this.value>>>16))}}))),Yl.prototype.component2=w("ktor-ktor-io.io.ktor.utils.io.core.internal.EncodeResult.component2",x((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(65535&this.value))}}))),Yl.$metadata$={kind:p,simpleName:"EncodeResult",interfaces:[]},Yl.prototype.unbox=function(){return this.value},Yl.prototype.toString=function(){return"EncodeResult(value="+e.toString(this.value)+")"},Yl.prototype.hashCode=function(){var t=0;return 31*t+e.hashCode(this.value)|0},Yl.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.value,t.value)};var Wl,Xl=w("ktor-ktor-io.io.ktor.utils.io.core.internal.putUtf8Char_9qn7ci$",x((function(){var n=e.toByte,i=t.io.ktor.utils.io.core.internal.malformedCodePoint_za3lpa$;return function(t,e,r){return 0<=r&&r<=127?(t.view.setInt8(e,n(r)),1):128<=r&&r<=2047?(t.view.setInt8(e,n(192|r>>6&31)),t.view.setInt8(e+1|0,n(128|63&r)),2):2048<=r&&r<=65535?(t.view.setInt8(e,n(224|r>>12&15)),t.view.setInt8(e+1|0,n(128|r>>6&63)),t.view.setInt8(e+2|0,n(128|63&r)),3):65536<=r&&r<=1114111?(t.view.setInt8(e,n(240|r>>18&7)),t.view.setInt8(e+1|0,n(128|r>>12&63)),t.view.setInt8(e+2|0,n(128|r>>6&63)),t.view.setInt8(e+3|0,n(128|63&r)),4):i(r)}})));function Zl(t){throw new ru("Expected "+t+" more character bytes")}function Jl(t){throw b("Malformed code-point "+t+" found")}function Ql(t){return t>>>16==0}function tu(t){return t<=1114111}function eu(t){return 56320+(1023&t)|0}function nu(t){return 55232+(t>>>10)|0}function iu(t,e){return((0|t)-55232|0)<<10|(0|e)-56320|0}function ru(t){W(t,this),this.name="MalformedUTF8InputException"}function ou(){}function au(t,e){var n;if(null!=(n=e.stealAll_8be2vx$())){var i=n;e.size<=oh&&null==i.next&&t.tryWriteAppend_pvnryh$(i)?e.afterBytesStolen_8be2vx$():t.append_pvnryh$(i)}}function su(t,n){return e.isType(t,Mi)?t.prepareReadHead_za3lpa$(n):e.isType(t,bl)?t.writePosition>t.readPosition?t:null:function(t,n){if(t.endOfInput)return null;var i=Nl().Pool.borrow(),r=t.peekTo_afjyek$(i.memory,e.Long.fromInt(i.writePosition),u,e.Long.fromInt(n),e.Long.fromInt(i.limit-i.writePosition|0)).toInt();return i.commitWritten_za3lpa$(r),rn.readPosition?(n.capacity-n.limit|0)<8?t.fixGapAfterRead_j2u0py$(n):t.headPosition=n.readPosition:t.ensureNext_j2u0py$(n):function(t,e){ua(t,e.capacity-(e.limit-e.writePosition|0)-(e.writePosition-e.readPosition|0)|0),e.release_2bs5fo$(Nl().Pool)}(t,n))}function uu(t,n){return n===t?t.writePosition>t.readPosition?t:null:e.isType(t,Mi)?t.ensureNextHead_j2u0py$(n):function(t,e){return ua(t,e.capacity-(e.limit-e.writePosition|0)-(e.writePosition-e.readPosition|0)|0),e.resetForWrite(),t.endOfInput||Ua(t,e)<=0?(e.release_2bs5fo$(Nl().Pool),null):e}(t,n)}function cu(t,n,i){return e.isType(t,Hi)?(null!=i&&t.afterHeadWrite(),t.prepareWriteHead_za3lpa$(n)):function(t,e){return null!=e?(rs(t,e),e.resetForWrite(),e):Nl().Pool.borrow()}(t,i)}function pu(t,n){if(e.isType(t,Hi))return t.afterHeadWrite();!function(t,e){rs(t,e),e.release_2bs5fo$(Nl().Pool)}(t,n)}function hu(t){this.closure$message=t,Il.call(this)}function _u(t,e,n,i){var r,o;e>=0||new hu((o=e,function(){return"offset shouldn't be negative: "+o+"."})).doFail(),n>=0||new hu((r=n,function(){return"min shouldn't be negative: "+r+"."})).doFail(),i>=n||new hu(function(t,e){return function(){return"max should't be less than min: max = "+t+", min = "+e+"."}}(i,n)).doFail(),n<=(t.limit-t.writePosition|0)||new hu(function(t,e){return function(){var n=e;return"Not enough free space in the destination buffer to write the specified minimum number of bytes: min = "+t+", free = "+(n.limit-n.writePosition|0)+"."}}(n,t)).doFail()}function fu(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$dst=e,this.local$closeOnEnd=n}function du(t,e,n,i,r){var o=new fu(t,e,n,i);return r?o:o.doResume(null)}function mu(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.local$tmp$=void 0,this.local$remainingLimit=void 0,this.local$transferred=void 0,this.local$tail=void 0,this.local$$receiver=t,this.local$dst=e,this.local$limit=n}function yu(t,e,n,i,r){var o=new mu(t,e,n,i);return r?o:o.doResume(null)}function $u(t,e,n,i){s.call(this,i),this.exceptionState_0=9,this.local$lastPiece=void 0,this.local$rc=void 0,this.local$$receiver=t,this.local$dst=e,this.local$limit=n}function vu(t,e,n,i,r){var o=new $u(t,e,n,i);return r?o:o.doResume(null)}function gu(){}function bu(){}function wu(){this.borrowed_m1d2y6$_0=0,this.disposed_rxrbhb$_0=!1,this.instance_vlsx8v$_0=null}ru.$metadata$={kind:p,simpleName:"MalformedUTF8InputException",interfaces:[X]},ou.$metadata$={kind:p,simpleName:"DangerousInternalIoApi",interfaces:[Q]},hu.prototype=Object.create(Il.prototype),hu.prototype.constructor=hu,hu.prototype.doFail=function(){throw b(this.closure$message())},hu.$metadata$={kind:p,interfaces:[Il]},fu.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},fu.prototype=Object.create(s.prototype),fu.prototype.constructor=fu,fu.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=yu(this.local$$receiver,this.local$dst,l,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return void(this.local$closeOnEnd&&Ne(this.local$dst));default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},mu.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},mu.prototype=Object.create(s.prototype),mu.prototype.constructor=mu,mu.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$$receiver===this.local$dst)throw b("Failed requirement.".toString());this.local$remainingLimit=this.local$limit,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.local$$receiver.awaitInternalAtLeast1_8be2vx$(this),this.result_0===a)return a;continue;case 3:if(this.result_0){this.state_0=4;continue}this.state_0=10;continue;case 4:if(this.local$transferred=this.local$$receiver.transferTo_pxvbjg$(this.local$dst,this.local$remainingLimit),_(this.local$transferred,u)){if(this.state_0=7,this.result_0=vu(this.local$$receiver,this.local$dst,this.local$remainingLimit,this),this.result_0===a)return a;continue}if(0===this.local$dst.availableForWrite){if(this.state_0=5,this.result_0=this.local$dst.notFull_8be2vx$.await(this),this.result_0===a)return a;continue}this.state_0=6;continue;case 5:this.state_0=6;continue;case 6:this.local$tmp$=this.local$transferred,this.state_0=9;continue;case 7:if(this.local$tail=this.result_0,_(this.local$tail,u)){this.state_0=10;continue}this.state_0=8;continue;case 8:this.local$tmp$=this.local$tail,this.state_0=9;continue;case 9:var t=this.local$tmp$;this.local$remainingLimit=this.local$remainingLimit.subtract(t),this.state_0=2;continue;case 10:return this.local$limit.subtract(this.local$remainingLimit);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},$u.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},$u.prototype=Object.create(s.prototype),$u.prototype.constructor=$u,$u.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$lastPiece=Nl().Pool.borrow(),this.exceptionState_0=7,this.local$lastPiece.resetForWrite_za3lpa$(v(this.local$limit,e.Long.fromInt(this.local$lastPiece.capacity)).toInt()),this.state_0=1,this.result_0=this.local$$receiver.readAvailable_lh221x$(this.local$lastPiece,this),this.result_0===a)return a;continue;case 1:if(this.local$rc=this.result_0,-1===this.local$rc){this.local$lastPiece.release_2bs5fo$(Nl().Pool),this.exceptionState_0=9,this.finallyPath_0=[2],this.state_0=8,this.$returnValue=u;continue}this.state_0=3;continue;case 2:return this.$returnValue;case 3:if(this.state_0=4,this.result_0=this.local$dst.writeFully_lh221x$(this.local$lastPiece,this),this.result_0===a)return a;continue;case 4:this.exceptionState_0=9,this.finallyPath_0=[5],this.state_0=8,this.$returnValue=e.Long.fromInt(this.local$rc);continue;case 5:return this.$returnValue;case 6:return;case 7:this.finallyPath_0=[9],this.state_0=8;continue;case 8:this.exceptionState_0=9,this.local$lastPiece.release_2bs5fo$(Nl().Pool),this.state_0=this.finallyPath_0.shift();continue;case 9:throw this.exception_0;default:throw this.state_0=9,new Error("State Machine Unreachable execution")}}catch(t){if(9===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},gu.prototype.close=function(){this.dispose()},gu.$metadata$={kind:o,simpleName:"ObjectPool",interfaces:[Op]},Object.defineProperty(bu.prototype,"capacity",{get:function(){return 0}}),bu.prototype.recycle_trkh7z$=function(t){},bu.prototype.dispose=function(){},bu.$metadata$={kind:p,simpleName:"NoPoolImpl",interfaces:[gu]},Object.defineProperty(wu.prototype,"capacity",{get:function(){return 1}}),wu.prototype.borrow=function(){this.borrowed_m1d2y6$_0;t:do{for(;;){var t=this.borrowed_m1d2y6$_0;if(0!==t)throw B("Instance is already consumed");if(this.borrowed_m1d2y6$_0===t&&(this.borrowed_m1d2y6$_0=1,1))break t}}while(0);var e=this.produceInstance();return this.instance_vlsx8v$_0=e,e},wu.prototype.recycle_trkh7z$=function(t){if(this.instance_vlsx8v$_0!==t){if(null==this.instance_vlsx8v$_0&&0!==this.borrowed_m1d2y6$_0)throw B("Already recycled or an irrelevant instance tried to be recycled");throw B("Unable to recycle irrelevant instance")}if(this.instance_vlsx8v$_0=null,!1!==this.disposed_rxrbhb$_0||(this.disposed_rxrbhb$_0=!0,0))throw B("An instance is already disposed");this.disposeInstance_trkh7z$(t)},wu.prototype.dispose=function(){var t;if(!1===this.disposed_rxrbhb$_0&&(this.disposed_rxrbhb$_0=!0,1)){if(null==(t=this.instance_vlsx8v$_0))return;var e=t;this.instance_vlsx8v$_0=null,this.disposeInstance_trkh7z$(e)}},wu.$metadata$={kind:p,simpleName:"SingleInstancePool",interfaces:[gu]};var xu=w("ktor-ktor-io.io.ktor.utils.io.pool.useBorrowed_ufoqs6$",(function(t,e){var n,i=t.borrow();try{n=e(i)}finally{t.recycle_trkh7z$(i)}return n})),ku=w("ktor-ktor-io.io.ktor.utils.io.pool.useInstance_ufoqs6$",(function(t,e){var n=t.borrow();try{return e(n)}finally{t.recycle_trkh7z$(n)}}));function Eu(t){return void 0===t&&(t=!1),new Ou(Qp().Empty,t)}function Cu(t,n,i){var r;if(void 0===n&&(n=0),void 0===i&&(i=t.length),0===t.length)return zu().Empty;for(var o=Qp().Pool.borrow(),a=o,s=n,l=s+i|0;;){a.reserveEndGap_za3lpa$(8);var u=l-s|0,p=a,h=p.limit-p.writePosition|0,_=g.min(u,h);if(co(e.isType(r=a,Vi)?r:c(),t,s,_),(s=s+_|0)===l)break;var f=a;a=Qp().Pool.borrow(),f.next=a}var d=new Ou(o,!1);return Ne(d),d}function Su(t,e,n,i){s.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$dst=e,this.local$closeOnEnd=n}function Tu(t,n,i,r){var o,a;return void 0===i&&(i=l),yu(e.isType(o=t,Ot)?o:c(),e.isType(a=n,Ot)?a:c(),i,r)}function Ou(t,e){Ot.call(this,t,e),this.attachedJob_0=null}function Nu(t,e,n,i,r){s.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$tmp$_0=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function Pu(t,e,n,i,r){s.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$offset=n,this.local$length=i}function Au(t,e,n,i,r){s.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$start=void 0,this.local$end=void 0,this.local$remaining=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function ju(){zu()}function Lu(){Iu=this,this.Empty_wsx8uv$_0=yt(Ru)}function Ru(){var t=new Ou(Qp().Empty,!1);return t.close_dbl4no$(null),t}Su.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Su.prototype=Object.create(s.prototype),Su.prototype.constructor=Su,Su.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n;if(this.state_0=2,this.result_0=du(e.isType(t=this.local$$receiver,Ot)?t:c(),e.isType(n=this.local$dst,Ot)?n:c(),this.local$closeOnEnd,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ou.prototype.attachJob_dqr1mp$=function(t){var e,n;null!=(e=this.attachedJob_0)&&e.cancel_m4sck1$(),this.attachedJob_0=t,t.invokeOnCompletion_ct2b2z$(!0,void 0,(n=this,function(t){return n.attachedJob_0=null,null!=t&&n.cancel_dbl4no$(y("Channel closed due to job failure: "+ft(t))),h}))},Nu.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Nu.prototype=Object.create(s.prototype),Nu.prototype.constructor=Nu,Nu.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.$this.readable.endOfInput){if(this.state_0=2,this.result_0=this.$this.readAvailableSuspend_0(this.local$dst,this.local$offset,this.local$length,this),this.result_0===a)return a;continue}if(null!=(t=this.$this.closedCause))throw t;this.local$tmp$_0=Fp(this.$this.readable,this.local$dst,this.local$offset,this.local$length),this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$_0=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ou.prototype.readAvailable_qmgm5g$=function(t,e,n,i,r){var o=new Nu(this,t,e,n,i);return r?o:o.doResume(null)},Pu.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Pu.prototype=Object.create(s.prototype),Pu.prototype.constructor=Pu,Pu.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.await_za3lpa$(1,this),this.result_0===a)return a;continue;case 1:throw this.exception_0;case 2:if(this.result_0){this.state_0=3;continue}return-1;case 3:if(this.state_0=4,this.result_0=this.$this.readAvailable_qmgm5g$(this.local$dst,this.local$offset,this.local$length,this),this.result_0===a)return a;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ou.prototype.readAvailableSuspend_0=function(t,e,n,i,r){var o=new Pu(this,t,e,n,i);return r?o:o.doResume(null)},Ou.prototype.readFully_qmgm5g$=function(t,e,n,i){var r;if(!(this.availableForRead>=n))return this.readFullySuspend_0(t,e,n,i);if(null!=(r=this.closedCause))throw r;Mp(this.readable,t,e,n)},Au.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Au.prototype=Object.create(s.prototype),Au.prototype.constructor=Au,Au.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$start=this.local$offset,this.local$end=this.local$offset+this.local$length|0,this.local$remaining=this.local$length,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$start>=this.local$end){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.readAvailable_qmgm5g$(this.local$dst,this.local$start,this.local$remaining,this),this.result_0===a)return a;continue;case 3:var t=this.result_0;if(-1===t)throw new Th("Premature end of stream: required "+this.local$remaining+" more bytes");this.local$start=this.local$start+t|0,this.local$remaining=this.local$remaining-t|0,this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ou.prototype.readFullySuspend_0=function(t,e,n,i,r){var o=new Au(this,t,e,n,i);return r?o:o.doResume(null)},Ou.prototype.toString=function(){return"ByteChannel["+ft(this.attachedJob_0)+", "+dt(this)+"]"},Ou.$metadata$={kind:p,simpleName:"ByteChannelJS",interfaces:[Ot]},ju.prototype.peekTo_afjyek$=function(t,e,n,i,r,o,a){return void 0===n&&(n=u),void 0===i&&(i=mt),void 0===r&&(r=l),a?a(t,e,n,i,r,o):this.peekTo_afjyek$$default(t,e,n,i,r,o)},Object.defineProperty(Lu.prototype,"Empty",{get:function(){return this.Empty_wsx8uv$_0.value}}),Lu.$metadata$={kind:Y,simpleName:"Companion",interfaces:[]};var Iu=null;function zu(){return null===Iu&&new Lu,Iu}function Du(){}function Mu(t){return function(e){var n=gt(vt(e));return t(n),n.getOrThrow()}}function Bu(t){this.predicate=t,this.cont_0=null}function Uu(t,e){return function(n){return t.cont_0=n,e(),h}}function Fu(t,e,n){s.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$block=e}function qu(t){return function(e){return t.cont_0=e,h}}function Gu(t,e){s.call(this,e),this.exceptionState_0=1,this.$this=t}function Hu(t){return k((255&t)<<8|(65535&t)>>>8)}function Yu(t){var e=k(65535&t),n=k((255&e)<<8|(65535&e)>>>8)<<16,i=k(t>>>16);return n|65535&k((255&i)<<8|(65535&i)>>>8)}function Vu(t){var n=t.and(J).toInt(),i=k(65535&n),r=k((255&i)<<8|(65535&i)>>>8)<<16,o=k(n>>>16),a=e.Long.fromInt(r|65535&k((255&o)<<8|(65535&o)>>>8)).shiftLeft(32),s=t.shiftRightUnsigned(32).toInt(),l=k(65535&s),u=k((255&l)<<8|(65535&l)>>>8)<<16,c=k(s>>>16);return a.or(e.Long.fromInt(u|65535&k((255&c)<<8|(65535&c)>>>8)).and(J))}function Ku(t){var n=nt(t),i=k(65535&n),r=k((255&i)<<8|(65535&i)>>>8)<<16,o=k(n>>>16),a=r|65535&k((255&o)<<8|(65535&o)>>>8);return e.floatFromBits(a)}function Wu(t){var n=it(t),i=n.and(J).toInt(),r=k(65535&i),o=k((255&r)<<8|(65535&r)>>>8)<<16,a=k(i>>>16),s=e.Long.fromInt(o|65535&k((255&a)<<8|(65535&a)>>>8)).shiftLeft(32),l=n.shiftRightUnsigned(32).toInt(),u=k(65535&l),c=k((255&u)<<8|(65535&u)>>>8)<<16,p=k(l>>>16),h=s.or(e.Long.fromInt(c|65535&k((255&p)<<8|(65535&p)>>>8)).and(J));return e.doubleFromBits(h)}ju.$metadata$={kind:o,simpleName:"ByteReadChannel",interfaces:[]},Du.$metadata$={kind:o,simpleName:"ByteWriteChannel",interfaces:[]},Bu.prototype.check=function(){return this.predicate()},Bu.prototype.signal=function(){var t=this.cont_0;null!=t&&this.predicate()&&(this.cont_0=null,t.resumeWith_tl1gpc$(new $t(h)))},Fu.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Fu.prototype=Object.create(s.prototype),Fu.prototype.constructor=Fu,Fu.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.predicate())return;this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=Mu(Uu(this.$this,this.local$block))(this),this.result_0===a)return a;continue;case 3:return this.result_0,this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Bu.prototype.await_o14v8n$=function(t,e,n){var i=new Fu(this,t,e);return n?i:i.doResume(null)},Gu.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[s]},Gu.prototype=Object.create(s.prototype),Gu.prototype.constructor=Gu,Gu.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.predicate())return;this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=Mu(qu(this.$this))(this),this.result_0===a)return a;continue;case 3:return this.result_0,this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Bu.prototype.await=function(t,e){var n=new Gu(this,t);return e?n:n.doResume(null)},Bu.$metadata$={kind:p,simpleName:"Condition",interfaces:[]};var Xu=w("ktor-ktor-io.io.ktor.utils.io.bits.useMemory_jjtqwx$",x((function(){var e=t.io.ktor.utils.io.bits.Memory,n=t.io.ktor.utils.io.bits.of_2z595v$;return function(t,i,r,o){return void 0===i&&(i=0),o(n(e.Companion,t,i,r))}})));function Zu(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=e;return tc(sc(),r,n,i)}function Ju(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0),new rc(new DataView(e,n,i))}function Qu(t,e){return new rc(e)}function tc(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.byteLength),Ju(sc(),e.buffer,e.byteOffset+n|0,i)}function ec(){nc=this}ec.prototype.alloc_za3lpa$=function(t){return new rc(new DataView(new ArrayBuffer(t)))},ec.prototype.alloc_s8cxhz$=function(t){return t.toNumber()>=2147483647&&Ll(t,"size"),new rc(new DataView(new ArrayBuffer(t.toInt())))},ec.prototype.free_vn6nzs$=function(t){},ec.$metadata$={kind:Y,simpleName:"DefaultAllocator",interfaces:[Jn]};var nc=null;function ic(){return null===nc&&new ec,nc}function rc(t){sc(),this.view=t}function oc(){ac=this,this.Empty=new rc(new DataView(new ArrayBuffer(0)))}Object.defineProperty(rc.prototype,"size",{get:w("ktor-ktor-io.io.ktor.utils.io.bits.Memory.get_size",(function(){return e.Long.fromInt(this.view.byteLength)}))}),Object.defineProperty(rc.prototype,"size32",{get:w("ktor-ktor-io.io.ktor.utils.io.bits.Memory.get_size32",(function(){return this.view.byteLength}))}),rc.prototype.loadAt_za3lpa$=w("ktor-ktor-io.io.ktor.utils.io.bits.Memory.loadAt_za3lpa$",(function(t){return this.view.getInt8(t)})),rc.prototype.loadAt_s8cxhz$=w("ktor-ktor-io.io.ktor.utils.io.bits.Memory.loadAt_s8cxhz$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t){var n=this.view;return t.toNumber()>=2147483647&&e(t,"index"),n.getInt8(t.toInt())}}))),rc.prototype.storeAt_6t1wet$=w("ktor-ktor-io.io.ktor.utils.io.bits.Memory.storeAt_6t1wet$",(function(t,e){this.view.setInt8(t,e)})),rc.prototype.storeAt_3pq026$=w("ktor-ktor-io.io.ktor.utils.io.bits.Memory.storeAt_3pq026$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n){var i=this.view;t.toNumber()>=2147483647&&e(t,"index"),i.setInt8(t.toInt(),n)}}))),rc.prototype.slice_vux9f0$=function(t,n){if(!(t>=0))throw b(("offset shouldn't be negative: "+t).toString());if(!(n>=0))throw b(("length shouldn't be negative: "+n).toString());if((t+n|0)>e.Long.fromInt(this.view.byteLength).toNumber())throw new lt("offset + length > size: "+t+" + "+n+" > "+e.Long.fromInt(this.view.byteLength).toString());return new rc(new DataView(this.view.buffer,this.view.byteOffset+t|0,n))},rc.prototype.slice_3pjtqy$=function(t,e){t.toNumber()>=2147483647&&Ll(t,"offset");var n=t.toInt();return e.toNumber()>=2147483647&&Ll(e,"length"),this.slice_vux9f0$(n,e.toInt())},rc.prototype.copyTo_ubllm2$=function(t,e,n,i){var r=new Int8Array(this.view.buffer,this.view.byteOffset+e|0,n);new Int8Array(t.view.buffer,t.view.byteOffset+i|0,n).set(r)},rc.prototype.copyTo_q2ka7j$=function(t,e,n,i){e.toNumber()>=2147483647&&Ll(e,"offset");var r=e.toInt();n.toNumber()>=2147483647&&Ll(n,"length");var o=n.toInt();i.toNumber()>=2147483647&&Ll(i,"destinationOffset"),this.copyTo_ubllm2$(t,r,o,i.toInt())},oc.$metadata$={kind:Y,simpleName:"Companion",interfaces:[]};var ac=null;function sc(){return null===ac&&new oc,ac}function lc(t,e,n,i,r){void 0===r&&(r=0);var o=e,a=new Int8Array(t.view.buffer,t.view.byteOffset+n|0,i);o.set(a,r)}function uc(t,e,n,i){var r;r=e+n|0;for(var o=e;o=2147483647&&e(n,"offset"),t.view.getInt16(n.toInt(),!1)}}))),yc=w("ktor-ktor-io.io.ktor.utils.io.bits.loadIntAt_ad7opl$",(function(t,e){return t.view.getInt32(e,!1)})),$c=w("ktor-ktor-io.io.ktor.utils.io.bits.loadIntAt_xrw27i$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n){return n.toNumber()>=2147483647&&e(n,"offset"),t.view.getInt32(n.toInt(),!1)}}))),vc=w("ktor-ktor-io.io.ktor.utils.io.bits.loadLongAt_ad7opl$",(function(t,n){return e.Long.fromInt(t.view.getUint32(n,!1)).shiftLeft(32).or(e.Long.fromInt(t.view.getUint32(n+4|0,!1)))})),gc=w("ktor-ktor-io.io.ktor.utils.io.bits.loadLongAt_xrw27i$",x((function(){var n=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,i){i.toNumber()>=2147483647&&n(i,"offset");var r=i.toInt();return e.Long.fromInt(t.view.getUint32(r,!1)).shiftLeft(32).or(e.Long.fromInt(t.view.getUint32(r+4|0,!1)))}}))),bc=w("ktor-ktor-io.io.ktor.utils.io.bits.loadFloatAt_ad7opl$",(function(t,e){return t.view.getFloat32(e,!1)})),wc=w("ktor-ktor-io.io.ktor.utils.io.bits.loadFloatAt_xrw27i$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n){return n.toNumber()>=2147483647&&e(n,"offset"),t.view.getFloat32(n.toInt(),!1)}}))),xc=w("ktor-ktor-io.io.ktor.utils.io.bits.loadDoubleAt_ad7opl$",(function(t,e){return t.view.getFloat64(e,!1)})),kc=w("ktor-ktor-io.io.ktor.utils.io.bits.loadDoubleAt_xrw27i$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n){return n.toNumber()>=2147483647&&e(n,"offset"),t.view.getFloat64(n.toInt(),!1)}}))),Ec=w("ktor-ktor-io.io.ktor.utils.io.bits.storeIntAt_vj6iol$",(function(t,e,n){t.view.setInt32(e,n,!1)})),Cc=w("ktor-ktor-io.io.ktor.utils.io.bits.storeIntAt_qfgmm4$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n,i){var r=t.view;n.toNumber()>=2147483647&&e(n,"offset"),r.setInt32(n.toInt(),i,!1)}}))),Sc=w("ktor-ktor-io.io.ktor.utils.io.bits.storeShortAt_r0om3i$",(function(t,e,n){t.view.setInt16(e,n,!1)})),Tc=w("ktor-ktor-io.io.ktor.utils.io.bits.storeShortAt_u61vsn$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n,i){var r=t.view;n.toNumber()>=2147483647&&e(n,"offset"),r.setInt16(n.toInt(),i,!1)}}))),Oc=w("ktor-ktor-io.io.ktor.utils.io.bits.storeLongAt_gwwqui$",x((function(){var t=new e.Long(-1,0);return function(e,n,i){e.view.setInt32(n,i.shiftRight(32).toInt(),!1),e.view.setInt32(n+4|0,i.and(t).toInt(),!1)}}))),Nc=w("ktor-ktor-io.io.ktor.utils.io.bits.storeLongAt_x1z90x$",x((function(){var n=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$,i=new e.Long(-1,0);return function(t,e,r){e.toNumber()>=2147483647&&n(e,"offset");var o=e.toInt();t.view.setInt32(o,r.shiftRight(32).toInt(),!1),t.view.setInt32(o+4|0,r.and(i).toInt(),!1)}}))),Pc=w("ktor-ktor-io.io.ktor.utils.io.bits.storeFloatAt_r7re9q$",(function(t,e,n){t.view.setFloat32(e,n,!1)})),Ac=w("ktor-ktor-io.io.ktor.utils.io.bits.storeFloatAt_ud4nyv$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n,i){var r=t.view;n.toNumber()>=2147483647&&e(n,"offset"),r.setFloat32(n.toInt(),i,!1)}}))),jc=w("ktor-ktor-io.io.ktor.utils.io.bits.storeDoubleAt_7sfcvf$",(function(t,e,n){t.view.setFloat64(e,n,!1)})),Lc=w("ktor-ktor-io.io.ktor.utils.io.bits.storeDoubleAt_isvxss$",x((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n,i){var r=t.view;n.toNumber()>=2147483647&&e(n,"offset"),r.setFloat64(n.toInt(),i,!1)}})));function Rc(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o=new Int16Array(t.view.buffer,t.view.byteOffset+e|0,r);if(fc)for(var a=0;a0;){var u=r-s|0,c=l/6|0,p=G(g.min(u,c),1),h=pt(n.charCodeAt(s+p-1|0)),f=h&&1===p?s+2|0:h?s+p-1|0:s+p|0,d=s,m=a.encode(e.subSequence(n,d,f).toString());if(m.length>l)break;rh(o,m),s=f,l=l-m.length|0}return s-i|0}function ep(t,e,n){if(Jc(t)!==fp().UTF_8)throw b("Failed requirement.".toString());us(n,e)}function np(t,e){return!0}function ip(t){this._charset_8be2vx$=t}function rp(t){ip.call(this,t),this.charset_0=t}function op(t){return t._charset_8be2vx$}function ap(t,e,n,i,r){if(void 0===r&&(r=2147483647),0===r)return 0;var o=Oh(Wc(op(t))),a={v:null},s=e.memory,l=e.readPosition,u=e.writePosition,c=$p(new wt(s.view.buffer,s.view.byteOffset+l|0,u-l|0),o,r);n.append_gw00v9$(c.charactersDecoded),a.v=c.bytesConsumed;var p=c.bytesConsumed;return e.discardExact_za3lpa$(p),a.v}function sp(t,n,i,r){var o=Oh(Wc(op(t)),!0),a={v:0};t:do{var s,l,u=!0;if(null==(s=su(n,1)))break t;var c=s,p=1;try{e:do{var h,_=c,f=_.writePosition-_.readPosition|0;if(f>=p)try{var d,m=c;n:do{var y,$=r-a.v|0,v=m.writePosition-m.readPosition|0;if($0&&m.rewind_za3lpa$(v),d=0}else d=a.v0)}finally{u&&lu(n,c)}}while(0);if(a.v=M)try{var q=D,G=q.memory,H=q.readPosition,Y=q.writePosition,V=$p(new wt(G.view.buffer,G.view.byteOffset+H|0,Y-H|0),o,r-a.v|0);i.append_gw00v9$(V.charactersDecoded),a.v=a.v+V.charactersDecoded.length|0;var K=V.bytesConsumed;q.discardExact_za3lpa$(K),K>0?L.v=1:8===L.v?L.v=0:L.v=L.v+1|0,M=L.v}finally{var W=D;B=W.writePosition-W.readPosition|0}else B=F;if(z=!1,0===B)I=uu(n,D);else{var X=B0)}finally{z&&lu(n,D)}}while(0)}return a.v}function lp(t,n,i){if(0===i)return"";var r=e.isType(n,Mi);if(r&&(r=(n.headEndExclusive-n.headPosition|0)>=i),r){var o,a,s=Oh(op(t)._name_8be2vx$,!0),l=n.head,u=n.headMemory.view;try{var c=0===l.readPosition&&i===u.byteLength?u:new DataView(u.buffer,u.byteOffset+l.readPosition|0,i);o=s.decode(c)}catch(t){throw e.isType(t,C)?new mp("Failed to decode bytes: "+(null!=(a=t.message)?a:"no cause provided")):t}var p=o;return n.discardExact_za3lpa$(i),p}return function(t,n,i){var r,o=Oh(Wc(op(t)),!0),a={v:i},s=U(i);try{t:do{var l,u,c=!0;if(null==(l=su(n,6)))break t;var p=l,h=6;try{do{var _,f=p,d=f.writePosition-f.readPosition|0;if(d>=h)try{var m,y=p,$=y.writePosition-y.readPosition|0,v=a.v,b=g.min($,v);if(0===y.readPosition&&y.memory.view.byteLength===b){var w,x,k=y.memory.view;try{w=o.decode(k,uh)}catch(t){throw e.isType(t,C)?new mp("Failed to decode bytes: "+(null!=(x=t.message)?x:"no cause provided")):t}m=w}else{var E,S,T=new Int8Array(y.memory.view.buffer,y.memory.view.byteOffset+y.readPosition|0,b);try{E=o.decode(T,uh)}catch(t){throw e.isType(t,C)?new mp("Failed to decode bytes: "+(null!=(S=t.message)?S:"no cause provided")):t}m=E}var O=m;s.append_gw00v9$(O),y.discardExact_za3lpa$(b),a.v=a.v-b|0,h=a.v>0?6:0}finally{var N=p;_=N.writePosition-N.readPosition|0}else _=d;if(c=!1,0===_)u=uu(n,p);else{var P=_0)}finally{c&&lu(n,p)}}while(0);if(a.v>0)t:do{var L,R,I=!0;if(null==(L=su(n,1)))break t;var z=L;try{for(;;){var D,M=z,B=M.writePosition-M.readPosition|0,F=a.v,q=g.min(B,F);if(0===M.readPosition&&M.memory.view.byteLength===q)D=o.decode(M.memory.view);else{var G,H,Y=new Int8Array(M.memory.view.buffer,M.memory.view.byteOffset+M.readPosition|0,q);try{G=o.decode(Y,uh)}catch(t){throw e.isType(t,C)?new mp("Failed to decode bytes: "+(null!=(H=t.message)?H:"no cause provided")):t}D=G}var V=D;if(s.append_gw00v9$(V),M.discardExact_za3lpa$(q),a.v=a.v-q|0,I=!1,null==(R=uu(n,z)))break;z=R,I=!0}}finally{I&&lu(n,z)}}while(0);s.append_gw00v9$(o.decode())}catch(t){throw e.isType(t,C)?new mp("Failed to decode bytes: "+(null!=(r=t.message)?r:"no cause provided")):t}return s.toString()}(t,n,i)}function up(){_p=this,this.UTF_8=new dp("UTF-8"),this.ISO_8859_1=new dp("ISO-8859-1")}Hc.$metadata$={kind:p,simpleName:"Charset",interfaces:[]},Xc.$metadata$={kind:p,simpleName:"CharsetEncoder",interfaces:[]},Zc.$metadata$={kind:p,simpleName:"CharsetEncoderImpl",interfaces:[Xc]},Zc.prototype.component1_0=function(){return this.charset_0},Zc.prototype.copy_6ypavq$=function(t){return new Zc(void 0===t?this.charset_0:t)},Zc.prototype.toString=function(){return"CharsetEncoderImpl(charset="+e.toString(this.charset_0)+")"},Zc.prototype.hashCode=function(){var t=0;return 31*t+e.hashCode(this.charset_0)|0},Zc.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.charset_0,t.charset_0)},ip.$metadata$={kind:p,simpleName:"CharsetDecoder",interfaces:[]},rp.$metadata$={kind:p,simpleName:"CharsetDecoderImpl",interfaces:[ip]},rp.prototype.component1_0=function(){return this.charset_0},rp.prototype.copy_6ypavq$=function(t){return new rp(void 0===t?this.charset_0:t)},rp.prototype.toString=function(){return"CharsetDecoderImpl(charset="+e.toString(this.charset_0)+")"},rp.prototype.hashCode=function(){var t=0;return 31*t+e.hashCode(this.charset_0)|0},rp.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.charset_0,t.charset_0)},up.$metadata$={kind:Y,simpleName:"Charsets",interfaces:[]};var cp,pp,hp,_p=null;function fp(){return null===_p&&new up,_p}function dp(t){Hc.call(this,t),this.name=t}function mp(t){C.call(this),this.message_dl21pz$_0=t,this.cause_5de4tn$_0=null,e.captureStack(C,this),this.name="MalformedInputException"}function yp(t,e){this.charactersDecoded=t,this.bytesConsumed=e}function $p(t,n,i){if(0===i)return new yp("",0);try{var r=L(i,t.byteLength),o=n.decode(t.subarray(0,r));if(o.length<=i)return new yp(o,r)}catch(t){}return function(t,n,i){for(var r,o=L(i>=268435455?2147483647:8*i|0,t.byteLength);o>8;){try{var a=n.decode(t.subarray(0,o));if(a.length<=i)return new yp(a,o)}catch(t){}o=o/2|0}for(o=8;o>0;){try{var s=n.decode(t.subarray(0,o));if(s.length<=i)return new yp(s,o)}catch(t){}o=o-1|0}try{n.decode(t)}catch(t){throw e.isType(t,C)?new mp("Failed to decode bytes: "+(null!=(r=t.message)?r:"no cause provided")):t}throw new mp("Unable to decode buffer")}(t,n,i)}function vp(t,e,n,i){if(e>=n)return 0;for(var r,o=i.writePosition,a=i.memory.slice_vux9f0$(o,i.limit-o|0).view,s=new Int8Array(a.buffer,a.byteOffset,a.byteLength),l=0,u=e;u255&&gp(c),s[(r=l,l=r+1|0,r)]=d(c)}var p=l;return i.commitWritten_za3lpa$(p),n-e|0}function gp(t){throw new mp("The character with unicode point "+t+" couldn't be mapped to ISO-8859-1 character")}function bp(t,e){xt.call(this),this.name$=t,this.ordinal$=e}function wp(){wp=function(){},pp=new bp("BIG_ENDIAN",0),hp=new bp("LITTLE_ENDIAN",1),Sp()}function xp(){return wp(),pp}function kp(){return wp(),hp}function Ep(){Cp=this,this.native_0=null;var t=new ArrayBuffer(4),e=new Int32Array(t),n=new DataView(t);e[0]=287454020,this.native_0=287454020===n.getInt32(0,!0)?kp():xp()}dp.prototype.newEncoder=function(){return new Zc(this)},dp.prototype.newDecoder=function(){return new rp(this)},dp.$metadata$={kind:p,simpleName:"CharsetImpl",interfaces:[Hc]},dp.prototype.component1=function(){return this.name},dp.prototype.copy_61zpoe$=function(t){return new dp(void 0===t?this.name:t)},dp.prototype.toString=function(){return"CharsetImpl(name="+e.toString(this.name)+")"},dp.prototype.hashCode=function(){var t=0;return 31*t+e.hashCode(this.name)|0},dp.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)},Object.defineProperty(mp.prototype,"message",{get:function(){return this.message_dl21pz$_0}}),Object.defineProperty(mp.prototype,"cause",{get:function(){return this.cause_5de4tn$_0}}),mp.$metadata$={kind:p,simpleName:"MalformedInputException",interfaces:[C]},yp.$metadata$={kind:p,simpleName:"DecodeBufferResult",interfaces:[]},yp.prototype.component1=function(){return this.charactersDecoded},yp.prototype.component2=function(){return this.bytesConsumed},yp.prototype.copy_bm4lxs$=function(t,e){return new yp(void 0===t?this.charactersDecoded:t,void 0===e?this.bytesConsumed:e)},yp.prototype.toString=function(){return"DecodeBufferResult(charactersDecoded="+e.toString(this.charactersDecoded)+", bytesConsumed="+e.toString(this.bytesConsumed)+")"},yp.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.charactersDecoded)|0)+e.hashCode(this.bytesConsumed)|0},yp.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.charactersDecoded,t.charactersDecoded)&&e.equals(this.bytesConsumed,t.bytesConsumed)},Ep.prototype.nativeOrder=function(){return this.native_0},Ep.$metadata$={kind:Y,simpleName:"Companion",interfaces:[]};var Cp=null;function Sp(){return wp(),null===Cp&&new Ep,Cp}function Tp(t,e,n){this.closure$sub=t,this.closure$block=e,this.closure$array=n,wu.call(this)}function Op(){}function Np(){}function Pp(t){this.closure$message=t,Il.call(this)}function Ap(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.isType(t,Mi))return Dp(t,n,i,r);Rp(t,n,i,r)!==r&&tl(r)}function jp(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.byteLength-i|0),e.isType(t,Mi))return Mp(t,n,i,r);Ip(t,n,i,r)!==r&&tl(r)}function Lp(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.byteLength-i|0),e.isType(t,Mi))return Bp(t,n,i,r);zp(t,n,i,r)!==r&&tl(r)}function Rp(t,n,i,r){var o;return void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.isType(t,Mi)?Up(t,n,i,r):zp(t,e.isType(o=n,Object)?o:c(),i,r)}function Ip(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.byteLength-i|0),e.isType(t,Mi))return Fp(t,n,i,r);var o={v:0};t:do{var a,s,l=!0;if(null==(a=su(t,1)))break t;var u=a;try{for(;;){var c=u,p=c.writePosition-c.readPosition|0,h=r-o.v|0,_=g.min(p,h);if(cc(c.memory,n,c.readPosition,_,o.v),o.v=o.v+_|0,!(o.v0&&(r.v=r.v+u|0),!(r.vt.byteLength)throw b("Destination buffer overflow: length = "+i+", buffer capacity "+t.byteLength);n>=0||new Gp(Yp).doFail(),(n+i|0)<=t.byteLength||new Gp(Vp).doFail(),th(e.isType(this,Vi)?this:c(),t.buffer,t.byteOffset+n|0,i)},Hp.prototype.readAvailable_p0d4q1$=function(t,n,i){var r=this.writePosition-this.readPosition|0;if(0===r)return-1;var o=g.min(i,r);return eh(e.isType(this,Vi)?this:c(),t,n,o),o},Hp.prototype.readFully_gsnag5$=function(t,n,i){eh(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readAvailable_gsnag5$=function(t,n,i){return ih(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readFully_qr0era$=function(t,n){To(e.isType(this,Vi)?this:c(),t,n)},Hp.prototype.append_ezbsdh$=function(t,e,n){if(vr(this,null!=t?t:"null",e,n)!==n)throw B("Not enough free space to append char sequence");return this},Hp.prototype.append_gw00v9$=function(t){return null==t?this.append_gw00v9$("null"):this.append_ezbsdh$(t,0,t.length)},Hp.prototype.append_8chfmy$=function(t,e,n){if($r(this,t,e,n)!==n)throw B("Not enough free space to append char sequence");return this},Hp.prototype.append_s8itvh$=function(t){return gr(e.isType(this,Vi)?this:c(),t),this},Hp.prototype.write_mj6st8$=function(t,n,i){co(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.write_gsnag5$=function(t,n,i){rh(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readShort=function(){return Lr(e.isType(this,Vi)?this:c())},Hp.prototype.readInt=function(){return zr(e.isType(this,Vi)?this:c())},Hp.prototype.readFloat=function(){return qr(e.isType(this,Vi)?this:c())},Hp.prototype.readDouble=function(){return Hr(e.isType(this,Vi)?this:c())},Hp.prototype.readFully_mj6st8$=function(t,n,i){ao(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readFully_359eei$=function(t,n,i){ho(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readFully_nd5v6f$=function(t,n,i){mo(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readFully_rfv6wg$=function(t,n,i){vo(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readFully_kgymra$=function(t,n,i){wo(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readFully_6icyh1$=function(t,n,i){Eo(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readAvailable_mj6st8$=function(t,n,i){return lo(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readAvailable_359eei$=function(t,n,i){return _o(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readAvailable_nd5v6f$=function(t,n,i){return yo(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readAvailable_rfv6wg$=function(t,n,i){return go(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readAvailable_kgymra$=function(t,n,i){return xo(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.readAvailable_6icyh1$=function(t,n,i){return Co(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.peekTo_99qa0s$=function(t){return Ua(e.isType(this,Np)?this:c(),t)},Hp.prototype.readLong=function(){return Br(e.isType(this,Vi)?this:c())},Hp.prototype.writeShort_mq22fl$=function(t){Vr(e.isType(this,Vi)?this:c(),t)},Hp.prototype.writeInt_za3lpa$=function(t){Xr(e.isType(this,Vi)?this:c(),t)},Hp.prototype.writeFloat_mx4ult$=function(t){no(e.isType(this,Vi)?this:c(),t)},Hp.prototype.writeDouble_14dthe$=function(t){ro(e.isType(this,Vi)?this:c(),t)},Hp.prototype.writeFully_mj6st8$=function(t,n,i){co(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.writeFully_359eei$=function(t,n,i){fo(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.writeFully_nd5v6f$=function(t,n,i){$o(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.writeFully_rfv6wg$=function(t,n,i){bo(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.writeFully_kgymra$=function(t,n,i){ko(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.writeFully_6icyh1$=function(t,n,i){So(e.isType(this,Vi)?this:c(),t,n,i)},Hp.prototype.writeFully_qr0era$=function(t,n){No(e.isType(this,Vi)?this:c(),t,n)},Hp.prototype.fill_3pq026$=function(t,n){yr(e.isType(this,Vi)?this:c(),t,n)},Hp.prototype.writeLong_s8cxhz$=function(t){Qr(e.isType(this,Vi)?this:c(),t)},Hp.prototype.writeBuffer_qr0era$=function(t,n){return No(e.isType(this,Vi)?this:c(),t,n),n},Hp.prototype.flush=function(){},Hp.prototype.readableView=function(){var t=this.readPosition,e=this.writePosition;return t===e?Qp().EmptyDataView_0:0===t&&e===this.content_0.byteLength?this.memory.view:new DataView(this.content_0,t,e-t|0)},Hp.prototype.writableView=function(){var t=this.writePosition,e=this.limit;return t===e?Qp().EmptyDataView_0:0===t&&e===this.content_0.byteLength?this.memory.view:new DataView(this.content_0,t,e-t|0)},Hp.prototype.readDirect_5b066c$=w("ktor-ktor-io.io.ktor.utils.io.core.IoBuffer.readDirect_5b066c$",x((function(){var t=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e){var n=e(this.readableView());if(!(n>=0))throw t(("The returned value from block function shouldn't be negative: "+n).toString());return this.discard_za3lpa$(n),n}}))),Hp.prototype.writeDirect_5b066c$=w("ktor-ktor-io.io.ktor.utils.io.core.IoBuffer.writeDirect_5b066c$",x((function(){var t=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e){var n=e(this.writableView());if(!(n>=0))throw t(("The returned value from block function shouldn't be negative: "+n).toString());if(!(n<=(this.limit-this.writePosition|0))){var i="The returned value from block function is too big: "+n+" > "+(this.limit-this.writePosition|0);throw t(i.toString())}return this.commitWritten_za3lpa$(n),n}}))),Hp.prototype.release_duua06$=function(t){jo(this,t)},Hp.prototype.close=function(){throw R("close for buffer view is not supported")},Hp.prototype.toString=function(){return"Buffer[readable = "+(this.writePosition-this.readPosition|0)+", writable = "+(this.limit-this.writePosition|0)+", startGap = "+this.startGap+", endGap = "+(this.capacity-this.limit|0)+"]"},Object.defineProperty(Kp.prototype,"ReservedSize",{get:function(){return 8}}),Wp.prototype.produceInstance=function(){return new Hp(ic().alloc_za3lpa$(4096),null)},Wp.prototype.clearInstance_trkh7z$=function(t){var e=Mh.prototype.clearInstance_trkh7z$.call(this,t);return e.unpark_8be2vx$(),e.reset(),e},Wp.prototype.validateInstance_trkh7z$=function(t){var e;Mh.prototype.validateInstance_trkh7z$.call(this,t),0!==t.referenceCount&&new Gp((e=t,function(){return"unable to recycle buffer: buffer view is in use (refCount = "+e.referenceCount+")"})).doFail(),null!=t.origin&&new Gp(Xp).doFail()},Wp.prototype.disposeInstance_trkh7z$=function(t){ic().free_vn6nzs$(t.memory),t.unlink_8be2vx$()},Wp.$metadata$={kind:p,interfaces:[Mh]},Zp.prototype.borrow=function(){return new Hp(ic().alloc_za3lpa$(4096),null)},Zp.prototype.recycle_trkh7z$=function(t){ic().free_vn6nzs$(t.memory)},Zp.$metadata$={kind:p,interfaces:[bu]},Kp.$metadata$={kind:Y,simpleName:"Companion",interfaces:[]};var Jp=null;function Qp(){return null===Jp&&new Kp,Jp}function th(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0);var r=t.memory,o=t.readPosition;if((t.writePosition-o|0)t.readPosition))return-1;var r=t.writePosition-t.readPosition|0,o=g.min(i,r);return th(t,e,n,o),o}function ih(t,e,n,i){if(void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0),!(t.writePosition>t.readPosition))return-1;var r=t.writePosition-t.readPosition|0,o=g.min(i,r);return eh(t,e,n,o),o}function rh(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0);var r=t.memory,o=t.writePosition;if((t.limit-o|0)=0))throw B("Check failed.".toString());if(!(o>=0))throw B("Check failed.".toString());if(!((r+o|0)<=i.length))throw B("Check failed.".toString());for(var s=yh(t.memory),l=t.readPosition,u=l,p=u,h=t.writePosition-t.readPosition|0,_=p+g.min(o,h)|0;;){var f=u<_;if(f&&(f=!(s[u]===n)),!f)break;u=u+1|0}var d=u-l|0;return(e.isType(a=i,Int8Array)?a:c()).set(s.subarray(l,_),r),t.discardUntilIndex_kcn2v3$(u),d}function bh(t,n,i,r,o,a){var s;if(!(o>=0))throw B("Check failed.".toString());if(!(a>=0))throw B("Check failed.".toString());if(!((o+a|0)<=r.length))throw B("Check failed.".toString());if(n===i)throw B("Check failed.".toString());for(var l=yh(t.memory),u=t.readPosition,p=u,h=p,_=t.writePosition-t.readPosition|0,f=h+g.min(a,_)|0;;){var d=p=0))throw new lt("offset ("+t+") shouldn't be negative");if(!(e>=0))throw new lt("length ("+e+") shouldn't be negative");if(!((t+e|0)<=n.length))throw new lt("offset ("+t+") + length ("+e+") > bytes.size ("+n.length+")");throw Et()}function Eh(t,e,n){var i,r=t.length;if(!((n+r|0)<=e.length))throw b("Failed requirement.".toString());for(var o=n,a=0;a0)throw b("Unable to make a new ArrayBuffer: packet is too big");e=n.toInt()}var i=new ArrayBuffer(e);return Mp(t,i,0,e),i}function Rh(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);for(var r={v:0},o={v:i};o.v>0;){var a=t.prepareWriteHead_za3lpa$(1);try{var s=a.limit-a.writePosition|0,l=o.v,u=g.min(s,l);if(rh(a,e,r.v+n|0,u),r.v=r.v+u|0,o.v=o.v-u|0,!(u>=0))throw B("The returned value shouldn't be negative".toString())}finally{t.afterHeadWrite()}}}var Ih=w("ktor-ktor-io.io.ktor.utils.io.js.sendPacket_3qvznb$",x((function(){var n=t.io.ktor.utils.io.js.sendPacket_ac3gnr$,i=t.io.ktor.utils.io.core.BytePacketBuilder_za3lpa$,r=Error;return function(t,o){var a,s=i(0);try{o(s),a=s.build()}catch(t){throw e.isType(t,r)?(s.release(),t):t}n(t,a)}}))),zh=w("ktor-ktor-io.io.ktor.utils.io.js.packet_lwnq0v$",x((function(){var n=t.io.ktor.utils.io.bits.Memory,i=DataView,r=e.throwCCE,o=t.io.ktor.utils.io.bits.of_qdokgt$,a=t.io.ktor.utils.io.core.IoBuffer,s=t.io.ktor.utils.io.core.internal.ChunkBuffer,l=t.io.ktor.utils.io.core.ByteReadPacket_init_mfe2hi$;return function(t){var u;return l(new a(o(n.Companion,e.isType(u=t.data,i)?u:r()),null),s.Companion.NoPool_8be2vx$)}}))),Dh=w("ktor-ktor-io.io.ktor.utils.io.js.sendPacket_xzmm9y$",x((function(){var n=t.io.ktor.utils.io.js.sendPacket_f89g06$,i=t.io.ktor.utils.io.core.BytePacketBuilder_za3lpa$,r=Error;return function(t,o){var a,s=i(0);try{o(s),a=s.build()}catch(t){throw e.isType(t,r)?(s.release(),t):t}n(t,a)}})));function Mh(t){this.capacity_7nvyry$_0=t,this.instances_j5hzgy$_0=e.newArray(this.capacity,null),this.size_p9jgx3$_0=0}Object.defineProperty(Mh.prototype,"capacity",{get:function(){return this.capacity_7nvyry$_0}}),Mh.prototype.disposeInstance_trkh7z$=function(t){},Mh.prototype.clearInstance_trkh7z$=function(t){return t},Mh.prototype.validateInstance_trkh7z$=function(t){},Mh.prototype.borrow=function(){var t;if(0===this.size_p9jgx3$_0)return this.produceInstance();var n=(this.size_p9jgx3$_0=this.size_p9jgx3$_0-1|0,this.size_p9jgx3$_0),i=e.isType(t=this.instances_j5hzgy$_0[n],Ct)?t:c();return this.instances_j5hzgy$_0[n]=null,this.clearInstance_trkh7z$(i)},Mh.prototype.recycle_trkh7z$=function(t){var e;this.validateInstance_trkh7z$(t),this.size_p9jgx3$_0===this.capacity?this.disposeInstance_trkh7z$(t):this.instances_j5hzgy$_0[(e=this.size_p9jgx3$_0,this.size_p9jgx3$_0=e+1|0,e)]=t},Mh.prototype.dispose=function(){var t,n;t=this.size_p9jgx3$_0;for(var i=0;i=2147483647&&Ll(n,"offset"),lc(t,e,n.toInt(),i,r)},Hh.loadByteArray_dy6oua$=hi,Hh.loadUByteArray_moiot2$=_i,Hh.loadUByteArray_r80dt$=fi,Hh.loadShortArray_8jnas7$=Rc,Hh.loadUShortArray_fu1ix4$=di,Hh.loadShortArray_ew3eeo$=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.toNumber()>=2147483647&&Ll(e,"offset"),Rc(t,e.toInt(),n,i,r)},Hh.loadUShortArray_w2wo2p$=mi,Hh.loadIntArray_kz60l8$=Ic,Hh.loadUIntArray_795lej$=yi,Hh.loadIntArray_qrle83$=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.toNumber()>=2147483647&&Ll(e,"offset"),Ic(t,e.toInt(),n,i,r)},Hh.loadUIntArray_qcxtu4$=$i,Hh.loadLongArray_2ervmr$=zc,Hh.loadULongArray_1mgmjm$=vi,Hh.loadLongArray_z08r3q$=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.toNumber()>=2147483647&&Ll(e,"offset"),zc(t,e.toInt(),n,i,r)},Hh.loadULongArray_lta2n9$=gi,Hh.useMemory_jjtqwx$=Xu,Hh.storeByteArray_ngtxw7$=bi,Hh.storeByteArray_dy6oua$=wi,Hh.storeUByteArray_moiot2$=xi,Hh.storeUByteArray_r80dt$=ki,Hh.storeShortArray_8jnas7$=Bc,Hh.storeUShortArray_fu1ix4$=Ei,Hh.storeShortArray_ew3eeo$=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.toNumber()>=2147483647&&Ll(e,"offset"),Bc(t,e.toInt(),n,i,r)},Hh.storeUShortArray_w2wo2p$=Ci,Hh.storeIntArray_kz60l8$=Uc,Hh.storeUIntArray_795lej$=Si,Hh.storeIntArray_qrle83$=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.toNumber()>=2147483647&&Ll(e,"offset"),Uc(t,e.toInt(),n,i,r)},Hh.storeUIntArray_qcxtu4$=Ti,Hh.storeLongArray_2ervmr$=Fc,Hh.storeULongArray_1mgmjm$=Oi,Hh.storeLongArray_z08r3q$=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.toNumber()>=2147483647&&Ll(e,"offset"),Fc(t,e.toInt(),n,i,r)},Hh.storeULongArray_lta2n9$=Ni;var Yh=qh.charsets||(qh.charsets={});Yh.encode_6xuvjk$=function(t,e,n,i,r){zi(t,r,e,n,i)},Yh.encodeToByteArrayImpl_fj4osb$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.length),Qc(t,e,n,i)},Yh.encode_fj4osb$=function(t,n,i,r){var o;void 0===i&&(i=0),void 0===r&&(r=n.length);var a=mh(0);try{zi(t,a,n,i,r),o=a.build()}catch(t){throw e.isType(t,C)?(a.release(),t):t}return o},Yh.encodeUTF8_45773h$=function(t,n){var i,r=mh(0);try{ep(t,n,r),i=r.build()}catch(t){throw e.isType(t,C)?(r.release(),t):t}return i},Yh.encode_ufq2gc$=Pi,Yh.decode_lb8wo3$=Ai,Yh.encodeArrayImpl_bptnt4$=ji,Yh.encodeToByteArrayImpl1_5lnu54$=Li,Yh.sizeEstimate_i9ek5c$=Ri,Yh.encodeToImpl_nctdml$=zi,Gh.read_q4ikbw$=As,Object.defineProperty(Mi,"Companion",{get:Gi}),Gh.AbstractInput_init_njy0gf$=function(t,n,i,r){var o;return void 0===t&&(t=Qp().Empty),void 0===n&&(n=Fo(t)),void 0===i&&(i=Nl().Pool),r=r||Object.create(Mi.prototype),Mi.call(r,e.isType(o=t,bl)?o:c(),n,i),r},Gh.AbstractInput=Mi,Gh.AbstractOutput_init_2bs5fo$=Yi,Gh.AbstractOutput_init=function(t){return t=t||Object.create(Hi.prototype),Yi(Nl().Pool,t),t},Gh.AbstractOutput=Hi,Object.defineProperty(Vi,"Companion",{get:Xi}),Gh.canRead_abnlgx$=Ji,Gh.canWrite_abnlgx$=Qi,Gh.read_kmyesx$=tr,Gh.write_kmyesx$=er,Gh.discardFailed_6xvm5r$=nr,Gh.commitWrittenFailed_6xvm5r$=ir,Gh.rewindFailed_6xvm5r$=rr,Gh.startGapReservationFailedDueToLimit_g087h2$=or,Gh.startGapReservationFailed_g087h2$=ar,Gh.endGapReservationFailedDueToCapacity_g087h2$=sr,Gh.endGapReservationFailedDueToStartGap_g087h2$=lr,Gh.endGapReservationFailedDueToContent_g087h2$=ur,Gh.restoreStartGap_g087h2$=cr,Gh.InsufficientSpaceException_init_vux9f0$=function(t,e,n){return n=n||Object.create(pr.prototype),pr.call(n,"Not enough free space to write "+t+" bytes, available "+e+" bytes."),n},Gh.InsufficientSpaceException_init_3m52m6$=hr,Gh.InsufficientSpaceException_init_3pjtqy$=function(t,e,n){return n=n||Object.create(pr.prototype),pr.call(n,"Not enough free space to write "+t.toString()+" bytes, available "+e.toString()+" bytes."),n},Gh.InsufficientSpaceException=pr,Gh.writeBufferAppend_eajdjw$=_r,Gh.writeBufferPrepend_tfs7w2$=fr,Gh.fill_ffmap0$=mr,Gh.fill_j129ft$=function(t,e,n){mr(t,e,n.data)},Gh.fill_cz5x29$=yr,Gh.pushBack_cni1rh$=function(t,e){t.rewind_za3lpa$(e)},Gh.makeView_abnlgx$=function(t){return t.duplicate()},Gh.makeView_n6y6i3$=function(t){return t.duplicate()},Gh.flush_abnlgx$=function(t){},Gh.appendChars_uz44xi$=$r,Gh.appendChars_ske834$=vr,Gh.append_xy0ugi$=gr,Gh.append_mhxg24$=function t(e,n){return null==n?t(e,"null"):br(e,n,0,n.length)},Gh.append_j2nfp0$=br,Gh.append_luj41z$=function(t,e,n,i){return br(t,new Hl(e,0,e.length),n,i)},Gh.readText_ky2b9g$=function(t,e,n,i,r){return void 0===r&&(r=2147483647),ap(e,t,n,0,r)},Gh.release_3omthh$=function(t,n){var i,r;(e.isType(i=t,bl)?i:c()).release_2bs5fo$(e.isType(r=n,gu)?r:c())},Gh.tryPeek_abnlgx$=function(t){return t.tryPeekByte()},Gh.readFully_e6hzc$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=t.memory,o=t.readPosition;if((t.writePosition-o|0)=2||new Tr(Or("short unsigned integer",2)).doFail(),e.v=new I(n.view.getInt16(i,!1)),t.discardExact_za3lpa$(2),e.v},Gh.readUShort_396eqd$=Ir,Gh.readInt_abnlgx$=zr,Gh.readInt_396eqd$=Dr,Gh.readUInt_abnlgx$=function(t){var e={v:null},n=t.memory,i=t.readPosition;return(t.writePosition-i|0)>=4||new Tr(Or("regular unsigned integer",4)).doFail(),e.v=new z(n.view.getInt32(i,!1)),t.discardExact_za3lpa$(4),e.v},Gh.readUInt_396eqd$=Mr,Gh.readLong_abnlgx$=Br,Gh.readLong_396eqd$=Ur,Gh.readULong_abnlgx$=function(t){var n={v:null},i=t.memory,r=t.readPosition;(t.writePosition-r|0)>=8||new Tr(Or("long unsigned integer",8)).doFail();var o=i,a=r;return n.v=new D(e.Long.fromInt(o.view.getUint32(a,!1)).shiftLeft(32).or(e.Long.fromInt(o.view.getUint32(a+4|0,!1)))),t.discardExact_za3lpa$(8),n.v},Gh.readULong_396eqd$=Fr,Gh.readFloat_abnlgx$=qr,Gh.readFloat_396eqd$=Gr,Gh.readDouble_abnlgx$=Hr,Gh.readDouble_396eqd$=Yr,Gh.writeShort_cx5lgg$=Vr,Gh.writeShort_89txly$=Kr,Gh.writeUShort_q99vxf$=function(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<2)throw hr("short unsigned integer",2,r);n.view.setInt16(i,e.data,!1),t.commitWritten_za3lpa$(2)},Gh.writeUShort_sa3b8p$=Wr,Gh.writeInt_cni1rh$=Xr,Gh.writeInt_q5mzkd$=Zr,Gh.writeUInt_xybpjq$=function(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<4)throw hr("regular unsigned integer",4,r);n.view.setInt32(i,e.data,!1),t.commitWritten_za3lpa$(4)},Gh.writeUInt_tiqx5o$=Jr,Gh.writeLong_xy6qu0$=Qr,Gh.writeLong_tilyfy$=to,Gh.writeULong_cwjw0b$=function(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<8)throw hr("long unsigned integer",8,r);var o=n,a=i,s=e.data;o.view.setInt32(a,s.shiftRight(32).toInt(),!1),o.view.setInt32(a+4|0,s.and(J).toInt(),!1),t.commitWritten_za3lpa$(8)},Gh.writeULong_89885t$=eo,Gh.writeFloat_d48dmo$=no,Gh.writeFloat_8gwps6$=io,Gh.writeDouble_in4kvh$=ro,Gh.writeDouble_kny06r$=oo,Gh.readFully_7ntqvp$=ao,Gh.readFully_ou1upd$=so,Gh.readFully_tx517c$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),ao(t,e.storage,n,i)},Gh.readAvailable_7ntqvp$=lo,Gh.readAvailable_ou1upd$=uo,Gh.readAvailable_tx517c$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),lo(t,e.storage,n,i)},Gh.writeFully_7ntqvp$=co,Gh.writeFully_ou1upd$=po,Gh.writeFully_tx517c$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),co(t,e.storage,n,i)},Gh.readFully_fs9n6h$=ho,Gh.readFully_4i50ju$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),ho(t,e.storage,n,i)},Gh.readAvailable_fs9n6h$=_o,Gh.readAvailable_4i50ju$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),_o(t,e.storage,n,i)},Gh.writeFully_fs9n6h$=fo,Gh.writeFully_4i50ju$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),fo(t,e.storage,n,i)},Gh.readFully_lhisoq$=mo,Gh.readFully_n25sf1$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),mo(t,e.storage,n,i)},Gh.readAvailable_lhisoq$=yo,Gh.readAvailable_n25sf1$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),yo(t,e.storage,n,i)},Gh.writeFully_lhisoq$=$o,Gh.writeFully_n25sf1$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),$o(t,e.storage,n,i)},Gh.readFully_de8bdr$=vo,Gh.readFully_8v2yxw$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),vo(t,e.storage,n,i)},Gh.readAvailable_de8bdr$=go,Gh.readAvailable_8v2yxw$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),go(t,e.storage,n,i)},Gh.writeFully_de8bdr$=bo,Gh.writeFully_8v2yxw$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),bo(t,e.storage,n,i)},Gh.readFully_7tydzb$=wo,Gh.readAvailable_7tydzb$=xo,Gh.writeFully_7tydzb$=ko,Gh.readFully_u5abqk$=Eo,Gh.readAvailable_u5abqk$=Co,Gh.writeFully_u5abqk$=So,Gh.readFully_i3yunz$=To,Gh.readAvailable_i3yunz$=Oo,Gh.writeFully_kxmhld$=function(t,e){var n=e.writePosition-e.readPosition|0,i=t.memory,r=t.writePosition,o=t.limit-r|0;if(o0)&&(null==(n=e.next)||t(n))},Gh.coerceAtMostMaxInt_nzsbcz$=Go,Gh.coerceAtMostMaxIntOrFail_z4ke79$=Ho,Gh.peekTo_twshuo$=Yo,Gh.BufferLimitExceededException=Vo,Gh.BytePacketBuilder_za3lpa$=mh,Gh.reset_en5wxq$=function(t){t.release()},Gh.BytePacketBuilderPlatformBase=Wo,Gh.BytePacketBuilderBase=Xo,Gh.BytePacketBuilder=Jo,Object.defineProperty(Qo,"Companion",{get:na}),Gh.ByteReadPacket_init_mfe2hi$=ia,Gh.ByteReadPacket_init_bioeb0$=function(t,e,n){return n=n||Object.create(Qo.prototype),Qo.call(n,t,Fo(t),e),n},Gh.ByteReadPacket=Qo,Gh.ByteReadPacketPlatformBase_init_njy0gf$=function(t,n,i,r){var o;return r=r||Object.create(ra.prototype),ra.call(r,e.isType(o=t,bl)?o:c(),n,i),r},Gh.ByteReadPacketPlatformBase=ra,Gh.ByteReadPacket_1qge3v$=function(t,n,i,r){var o;void 0===n&&(n=0),void 0===i&&(i=t.length);var a=e.isType(o=t,Int8Array)?o:c(),s=new Tp(0===n&&i===t.length?a.buffer:a.buffer.slice(n,n+i|0),r,t),l=s.borrow();return l.resetForRead(),ia(l,s)},Gh.ByteReadPacket_mj6st8$=oa,Gh.addSuppressedInternal_oh0dqn$=function(t,e){},Gh.use_jh8f9t$=aa,Gh.copyTo_tc38ta$=function(t,n){if(!e.isType(t,Mi)||!e.isType(n,Hi))return function(t,n){var i=Nl().Pool.borrow(),r=u;try{for(;;){i.resetForWrite();var o=Sa(t,i);if(-1===o)break;r=r.add(e.Long.fromInt(o)),rs(n,i)}return r}finally{i.release_2bs5fo$(Nl().Pool)}}(t,n);for(var i=u;;){var r=t.stealAll_8be2vx$();if(null!=r)i=i.add(Fo(r)),n.appendChain_pvnryh$(r);else if(null==t.prepareRead_za3lpa$(1))break}return i},Gh.ExperimentalIoApi=sa,Gh.discard_7wsnj1$=function(t){return t.discard_s8cxhz$(l)},Gh.discardExact_nd91nq$=la,Gh.discardExact_j319xh$=ua,Vh.prepareReadFirstHead_j319xh$=su,Vh.prepareReadNextHead_x2nit9$=uu,Vh.completeReadHead_x2nit9$=lu,Gh.takeWhile_nkhzd2$=ca,Gh.takeWhileSize_y109dn$=pa,Gh.peekCharUtf8_7wsnj1$=function(t){var e=t.tryPeek();if(0==(128&e))return V(e);if(-1===e)throw new Th("Failed to peek a char: end of input");return function(t,e){var n={v:63},i={v:!1},r=Fl(e);t:do{var o,a,s=!0;if(null==(o=su(t,r)))break t;var l=o,u=r;try{e:do{var c,p=l,h=p.writePosition-p.readPosition|0;if(h>=u)try{var _,f=l;n:do{for(var d={v:0},m={v:0},y={v:0},$=f.memory,v=f.readPosition,g=f.writePosition,b=v;b>=1,d.v=d.v+1|0;if(y.v=d.v,d.v=d.v-1|0,y.v>(g-b|0)){f.discardExact_za3lpa$(b-v|0),_=y.v;break n}}else if(m.v=m.v<<6|127&w,d.v=d.v-1|0,0===d.v){if(Ql(m.v)){var C=K(V(m.v));i.v=!0,n.v=H(C),f.discardExact_za3lpa$(b-v-y.v+1|0),_=-1;break n}if(tu(m.v)){var S=K(V(nu(m.v)));i.v=!0,n.v=H(S);var T=!0;if(!T){var O=K(V(eu(m.v)));i.v=!0,n.v=H(O),T=!0}if(T){f.discardExact_za3lpa$(b-v-y.v+1|0),_=-1;break n}}else Jl(m.v);m.v=0}}var N=g-v|0;f.discardExact_za3lpa$(N),_=0}while(0);u=_}finally{var P=l;c=P.writePosition-P.readPosition|0}else c=h;if(s=!1,0===c)a=uu(t,l);else{var A=c0)}finally{s&&lu(t,l)}}while(0);if(!i.v)throw new ru("No UTF-8 character found");return n.v}(t,e)},Gh.forEach_xalon3$=ha,Gh.readAvailable_tx93nr$=function(t,e,n){return void 0===n&&(n=e.limit-e.writePosition|0),Sa(t,e,n)},Gh.readAvailableOld_ja303r$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),ba(t,e,n,i)},Gh.readAvailableOld_ksob8n$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),wa(t,e,n,i)},Gh.readAvailableOld_8ob2ms$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),xa(t,e,n,i)},Gh.readAvailableOld_1rz25p$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),ka(t,e,n,i)},Gh.readAvailableOld_2tjpx5$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),Ea(t,e,n,i)},Gh.readAvailableOld_rlf4bm$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),Ca(t,e,n,i)},Gh.readFully_tx93nr$=function(t,e,n){void 0===n&&(n=e.limit-e.writePosition|0),va(t,e,n)},Gh.readFullyOld_ja303r$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),_a(t,e,n,i)},Gh.readFullyOld_ksob8n$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),fa(t,e,n,i)},Gh.readFullyOld_8ob2ms$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),da(t,e,n,i)},Gh.readFullyOld_1rz25p$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),ma(t,e,n,i)},Gh.readFullyOld_2tjpx5$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),ya(t,e,n,i)},Gh.readFullyOld_rlf4bm$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),$a(t,e,n,i)},Gh.readFully_ja303r$=_a,Gh.readFully_ksob8n$=fa,Gh.readFully_8ob2ms$=da,Gh.readFully_1rz25p$=ma,Gh.readFully_2tjpx5$=ya,Gh.readFully_rlf4bm$=$a,Gh.readFully_n4diq5$=va,Gh.readFully_em5cpx$=function(t,n,i,r){ga(t,n,e.Long.fromInt(i),e.Long.fromInt(r))},Gh.readFully_czhrh1$=ga,Gh.readAvailable_ja303r$=ba,Gh.readAvailable_ksob8n$=wa,Gh.readAvailable_8ob2ms$=xa,Gh.readAvailable_1rz25p$=ka,Gh.readAvailable_2tjpx5$=Ea,Gh.readAvailable_rlf4bm$=Ca,Gh.readAvailable_n4diq5$=Sa,Gh.readAvailable_em5cpx$=function(t,n,i,r){return Ta(t,n,e.Long.fromInt(i),e.Long.fromInt(r)).toInt()},Gh.readAvailable_czhrh1$=Ta,Gh.readShort_l8hihx$=function(t,e){return _(e,xp())?Fa(t):Hu(Fa(t))},Gh.readInt_l8hihx$=function(t,e){return _(e,xp())?Ga(t):Yu(Ga(t))},Gh.readLong_l8hihx$=function(t,e){return _(e,xp())?Ya(t):Vu(Ya(t))},Gh.readFloat_l8hihx$=function(t,e){return _(e,xp())?Ka(t):Ku(Ka(t))},Gh.readDouble_l8hihx$=function(t,e){return _(e,xp())?Xa(t):Wu(Xa(t))},Gh.readShortLittleEndian_7wsnj1$=function(t){return Hu(Fa(t))},Gh.readIntLittleEndian_7wsnj1$=function(t){return Yu(Ga(t))},Gh.readLongLittleEndian_7wsnj1$=function(t){return Vu(Ya(t))},Gh.readFloatLittleEndian_7wsnj1$=function(t){return Ku(Ka(t))},Gh.readDoubleLittleEndian_7wsnj1$=function(t){return Wu(Xa(t))},Gh.readShortLittleEndian_abnlgx$=function(t){return Hu(Lr(t))},Gh.readIntLittleEndian_abnlgx$=function(t){return Yu(zr(t))},Gh.readLongLittleEndian_abnlgx$=function(t){return Vu(Br(t))},Gh.readFloatLittleEndian_abnlgx$=function(t){return Ku(qr(t))},Gh.readDoubleLittleEndian_abnlgx$=function(t){return Wu(Hr(t))},Gh.readFullyLittleEndian_8s9ld4$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),Oa(t,e.storage,n,i)},Gh.readFullyLittleEndian_ksob8n$=Oa,Gh.readFullyLittleEndian_bfwj6z$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),Na(t,e.storage,n,i)},Gh.readFullyLittleEndian_8ob2ms$=Na,Gh.readFullyLittleEndian_dvhn02$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),Pa(t,e.storage,n,i)},Gh.readFullyLittleEndian_1rz25p$=Pa,Gh.readFullyLittleEndian_2tjpx5$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),ya(t,e,n,i);for(var r=n+i-1|0,o=n;o<=r;o++)e[o]=Ku(e[o])},Gh.readFullyLittleEndian_rlf4bm$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),$a(t,e,n,i);for(var r=n+i-1|0,o=n;o<=r;o++)e[o]=Wu(e[o])},Gh.readAvailableLittleEndian_8s9ld4$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),Aa(t,e.storage,n,i)},Gh.readAvailableLittleEndian_ksob8n$=Aa,Gh.readAvailableLittleEndian_bfwj6z$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),ja(t,e.storage,n,i)},Gh.readAvailableLittleEndian_8ob2ms$=ja,Gh.readAvailableLittleEndian_dvhn02$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),La(t,e.storage,n,i)},Gh.readAvailableLittleEndian_1rz25p$=La,Gh.readAvailableLittleEndian_2tjpx5$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=Ea(t,e,n,i);if(r>0)for(var o=n+r-1|0,a=n;a<=o;a++)e[a]=Ku(e[a]);return r},Gh.readAvailableLittleEndian_rlf4bm$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=Ca(t,e,n,i);if(r>0)for(var o=n+r-1|0,a=n;a<=o;a++)e[a]=Wu(e[a]);return r},Gh.readFullyLittleEndian_4i50ju$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),Ra(t,e.storage,n,i)},Gh.readFullyLittleEndian_fs9n6h$=Ra,Gh.readFullyLittleEndian_n25sf1$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),Ia(t,e.storage,n,i)},Gh.readFullyLittleEndian_lhisoq$=Ia,Gh.readFullyLittleEndian_8v2yxw$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),za(t,e.storage,n,i)},Gh.readFullyLittleEndian_de8bdr$=za,Gh.readFullyLittleEndian_7tydzb$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),wo(t,e,n,i);for(var r=n+i-1|0,o=n;o<=r;o++)e[o]=Ku(e[o])},Gh.readFullyLittleEndian_u5abqk$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),Eo(t,e,n,i);for(var r=n+i-1|0,o=n;o<=r;o++)e[o]=Wu(e[o])},Gh.readAvailableLittleEndian_4i50ju$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),Da(t,e.storage,n,i)},Gh.readAvailableLittleEndian_fs9n6h$=Da,Gh.readAvailableLittleEndian_n25sf1$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),Ma(t,e.storage,n,i)},Gh.readAvailableLittleEndian_lhisoq$=Ma,Gh.readAvailableLittleEndian_8v2yxw$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),Ba(t,e.storage,n,i)},Gh.readAvailableLittleEndian_de8bdr$=Ba,Gh.readAvailableLittleEndian_7tydzb$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=xo(t,e,n,i);if(r>0)for(var o=n+r-1|0,a=n;a<=o;a++)e[a]=Ku(e[a]);return r},Gh.readAvailableLittleEndian_u5abqk$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=Co(t,e,n,i);if(r>0)for(var o=n+r-1|0,a=n;a<=o;a++)e[a]=Wu(e[a]);return r},Gh.peekTo_cg8jeh$=function(t,n,i,r,o){var a;return void 0===i&&(i=0),void 0===r&&(r=1),void 0===o&&(o=2147483647),Ua(t,e.isType(a=n,Vi)?a:c(),i,r,o)},Gh.peekTo_6v858t$=Ua,Gh.readShort_7wsnj1$=Fa,Gh.readInt_7wsnj1$=Ga,Gh.readLong_7wsnj1$=Ya,Gh.readFloat_7wsnj1$=Ka,Gh.readFloatFallback_7wsnj1$=Wa,Gh.readDouble_7wsnj1$=Xa,Gh.readDoubleFallback_7wsnj1$=Za,Gh.append_a2br84$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.length),t.append_ezbsdh$(e,n,i)},Gh.append_wdi0rq$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.length),t.append_8chfmy$(e,n,i)},Gh.writeFully_i6snlg$=Ja,Gh.writeFully_d18giu$=Qa,Gh.writeFully_yw8055$=ts,Gh.writeFully_2v9eo0$=es,Gh.writeFully_ydnkai$=ns,Gh.writeFully_avy7cl$=is,Gh.writeFully_ke2xza$=function(t,n,i){var r;void 0===i&&(i=n.writePosition-n.readPosition|0),rs(t,e.isType(r=n,Vi)?r:c(),i)},Gh.writeFully_apj91c$=rs,Gh.writeFully_35rta0$=function(t,n,i,r){os(t,n,e.Long.fromInt(i),e.Long.fromInt(r))},Gh.writeFully_bch96q$=os,Gh.fill_g2e272$=as,Vh.prepareWriteHead_6z8r11$=cu,Vh.afterHeadWrite_z1cqja$=pu,Gh.writeWhile_rh5n47$=ss,Gh.writeWhileSize_cmxbvc$=ls,Gh.writePacket_we8ufg$=us,Gh.writeShort_hklg1n$=function(t,e,n){ms(t,_(n,xp())?e:Hu(e))},Gh.writeInt_uvxpoy$=function(t,e,n){ys(t,_(n,xp())?e:Yu(e))},Gh.writeLong_5y1ywb$=function(t,e,n){gs(t,_(n,xp())?e:Vu(e))},Gh.writeFloat_gulwb$=function(t,e,n){ws(t,_(n,xp())?e:Ku(e))},Gh.writeDouble_1z13h2$=function(t,e,n){xs(t,_(n,xp())?e:Wu(e))},Gh.writeShortLittleEndian_9kfkzl$=function(t,e){ms(t,Hu(e))},Gh.writeIntLittleEndian_qu9kum$=function(t,e){ys(t,Yu(e))},Gh.writeLongLittleEndian_kb5mzd$=function(t,e){gs(t,Vu(e))},Gh.writeFloatLittleEndian_9rid5t$=function(t,e){ws(t,Ku(e))},Gh.writeDoubleLittleEndian_jgp4k2$=function(t,e){xs(t,Wu(e))},Gh.writeFullyLittleEndian_phqic5$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),cs(t,e.storage,n,i)},Gh.writeShortLittleEndian_cx5lgg$=function(t,e){Vr(t,Hu(e))},Gh.writeIntLittleEndian_cni1rh$=function(t,e){Xr(t,Yu(e))},Gh.writeLongLittleEndian_xy6qu0$=function(t,e){Qr(t,Vu(e))},Gh.writeFloatLittleEndian_d48dmo$=function(t,e){no(t,Ku(e))},Gh.writeDoubleLittleEndian_in4kvh$=function(t,e){ro(t,Wu(e))},Gh.writeFullyLittleEndian_4i50ju$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),_s(t,e.storage,n,i)},Gh.writeFullyLittleEndian_d18giu$=cs,Gh.writeFullyLittleEndian_cj6vpa$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),ps(t,e.storage,n,i)},Gh.writeFullyLittleEndian_yw8055$=ps,Gh.writeFullyLittleEndian_jyf4rf$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.size-n|0),hs(t,e.storage,n,i)},Gh.writeFullyLittleEndian_2v9eo0$=hs,Gh.writeFullyLittleEndian_ydnkai$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=n+i|0,o={v:n},a=cu(t,4,null);try{for(var s;;){for(var l=a,u=(l.limit-l.writePosition|0)/4|0,c=r-o.v|0,p=g.min(u,c),h=o.v+p-1|0,_=o.v;_<=h;_++)no(l,Ku(e[_]));if(o.v=o.v+p|0,(s=o.v0;if(p&&(p=!(l.writePosition>l.readPosition)),!p)break;if(a=!1,null==(o=uu(t,s)))break;s=o,a=!0}}finally{a&&lu(t,s)}}while(0);return i.v},Gh.discardUntilDelimiters_16hsaj$=function(t,n,i){var r={v:u};t:do{var o,a,s=!0;if(null==(o=su(t,1)))break t;var l=o;try{for(;;){var c=l,p=vh(c,n,i);r.v=r.v.add(e.Long.fromInt(p));var h=p>0;if(h&&(h=!(c.writePosition>c.readPosition)),!h)break;if(s=!1,null==(a=uu(t,l)))break;l=a,s=!0}}finally{s&&lu(t,l)}}while(0);return r.v},Gh.readUntilDelimiter_47qg82$=Rs,Gh.readUntilDelimiters_3dgv7v$=function(t,e,n,i,r,o){if(void 0===r&&(r=0),void 0===o&&(o=i.length),e===n)return Rs(t,e,i,r,o);var a={v:r},s={v:o};t:do{var l,u,c=!0;if(null==(l=su(t,1)))break t;var p=l;try{for(;;){var h=p,_=bh(h,e,n,i,a.v,s.v);if(a.v=a.v+_|0,s.v=s.v-_|0,h.writePosition>h.readPosition||!(s.v>0))break;if(c=!1,null==(u=uu(t,p)))break;p=u,c=!0}}finally{c&&lu(t,p)}}while(0);return a.v-r|0},Gh.readUntilDelimiter_75zcs9$=Is,Gh.readUntilDelimiters_gcjxsg$=zs,Gh.discardUntilDelimiterImplMemory_7fe9ek$=function(t,e){for(var n=t.readPosition,i=n,r=t.writePosition,o=t.memory;i=2147483647&&Ll(e,"offset");var r=e.toInt();n.toNumber()>=2147483647&&Ll(n,"count"),uc(t,r,n.toInt(),i)},Hh.copyTo_1uvjz5$=cc,Hh.copyTo_duys70$=pc,Hh.copyTo_3wm8wl$=hc,Hh.copyTo_vnj7g0$=_c,Hh.get_Int8ArrayView_ktv2uy$=function(t){return new Int8Array(t.view.buffer,t.view.byteOffset,t.view.byteLength)},Hh.loadFloatAt_ad7opl$=bc,Hh.loadFloatAt_xrw27i$=wc,Hh.loadDoubleAt_ad7opl$=xc,Hh.loadDoubleAt_xrw27i$=kc,Hh.storeFloatAt_r7re9q$=Pc,Hh.storeFloatAt_ud4nyv$=Ac,Hh.storeDoubleAt_7sfcvf$=jc,Hh.storeDoubleAt_isvxss$=Lc,Hh.loadFloatArray_f2kqdl$=Dc,Hh.loadFloatArray_wismeo$=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.toNumber()>=2147483647&&Ll(e,"offset"),Dc(t,e.toInt(),n,i,r)},Hh.loadDoubleArray_itdtda$=Mc,Hh.loadDoubleArray_2kio7p$=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.toNumber()>=2147483647&&Ll(e,"offset"),Mc(t,e.toInt(),n,i,r)},Hh.storeFloatArray_f2kqdl$=qc,Hh.storeFloatArray_wismeo$=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.toNumber()>=2147483647&&Ll(e,"offset"),qc(t,e.toInt(),n,i,r)},Hh.storeDoubleArray_itdtda$=Gc,Hh.storeDoubleArray_2kio7p$=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.toNumber()>=2147483647&&Ll(e,"offset"),Gc(t,e.toInt(),n,i,r)},Object.defineProperty(Hc,"Companion",{get:Kc}),Yh.Charset=Hc,Yh.get_name_2sg7fd$=Wc,Yh.CharsetEncoder=Xc,Yh.get_charset_x4isqx$=Jc,Yh.encodeImpl_edsj0y$=tp,Yh.encodeUTF8_sbvn4u$=ep,Yh.encodeComplete_5txte2$=np,Yh.CharsetDecoder=ip,Yh.get_charset_e9jvmp$=op,Yh.decodeBuffer_eccjnr$=ap,Yh.decode_eyhcpn$=sp,Yh.decodeExactBytes_lb8wo3$=lp,Object.defineProperty(Yh,"Charsets",{get:fp}),Yh.MalformedInputException=mp,Object.defineProperty(Yh,"MAX_CHARACTERS_SIZE_IN_BYTES_8be2vx$",{get:function(){return cp}}),Yh.DecodeBufferResult=yp,Yh.decodeBufferImpl_do9qbo$=$p,Yh.encodeISO88591_4e1bz1$=vp,Object.defineProperty(bp,"BIG_ENDIAN",{get:xp}),Object.defineProperty(bp,"LITTLE_ENDIAN",{get:kp}),Object.defineProperty(bp,"Companion",{get:Sp}),Gh.Closeable=Op,Gh.Input=Np,Gh.readFully_nu5h60$=Ap,Gh.readFully_7dohgh$=jp,Gh.readFully_hqska$=Lp,Gh.readAvailable_nu5h60$=Rp,Gh.readAvailable_7dohgh$=Ip,Gh.readAvailable_hqska$=zp,Gh.readFully_56hr53$=Dp,Gh.readFully_xvjntq$=Mp,Gh.readFully_28a27b$=Bp,Gh.readAvailable_56hr53$=Up,Gh.readAvailable_xvjntq$=Fp,Gh.readAvailable_28a27b$=qp,Object.defineProperty(Hp,"Companion",{get:Qp}),Gh.IoBuffer=Hp,Gh.readFully_xbe0h9$=th,Gh.readFully_agdgmg$=eh,Gh.readAvailable_xbe0h9$=nh,Gh.readAvailable_agdgmg$=ih,Gh.writeFully_xbe0h9$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.byteLength);var r=t.memory,o=t.writePosition;if((t.limit-o|0)t.length)&&kh(e,n,t);var r=t,o=r.byteOffset+e|0,a=r.buffer.slice(o,o+n|0),s=new Hp(Ju(sc(),a),null);s.resetForRead();var l=ia(s,Nl().NoPoolManuallyManaged_8be2vx$);return Ai(i.newDecoder(),l,2147483647)},Gh.checkIndices_khgzz8$=kh,Gh.getCharsInternal_8t7fl6$=Eh,Kh.IOException_init_61zpoe$=Sh,Kh.IOException=Ch,Kh.EOFException=Th;var Zh,Jh=qh.js||(qh.js={});Jh.readText_fwlggr$=function(t,e,n){return void 0===n&&(n=2147483647),Vs(t,Kc().forName_61zpoe$(e),n)},Jh.readText_4pep7x$=function(t,e,n,i){return void 0===e&&(e="UTF-8"),void 0===i&&(i=2147483647),Ys(t,n,Kc().forName_61zpoe$(e),i)},Jh.TextDecoderFatal_t8jjq2$=Oh,Jh.decodeWrap_i3ch5z$=Ah,Jh.decodeStream_n9pbvr$=Nh,Jh.decodeStream_6h85h0$=Ph,Jh.TextEncoderCtor_8be2vx$=jh,Jh.readArrayBuffer_xc9h3n$=Lh,Jh.writeFully_uphcrm$=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0),Rh(t,new Int8Array(e),n,i)},Jh.writeFully_xn6cfb$=Rh,Jh.sendPacket_ac3gnr$=function(t,e){t.send(Lh(e))},Jh.sendPacket_3qvznb$=Ih,Jh.packet_lwnq0v$=zh,Jh.sendPacket_f89g06$=function(t,e){t.send(Lh(e))},Jh.sendPacket_xzmm9y$=Dh,Jh.responsePacket_rezk82$=function(t){var n,i;if(n=t.responseType,_(n,"arraybuffer"))return ia(new Hp(Qu(sc(),e.isType(i=t.response,DataView)?i:c()),null),Nl().NoPoolManuallyManaged_8be2vx$);if(_(n,""))return na().Empty;throw B("Incompatible type "+t.responseType+": only ARRAYBUFFER and EMPTY are supported")},Xh.DefaultPool=Mh,St.prototype.peekTo_afjyek$=ju.prototype.peekTo_afjyek$,$n.prototype.request_za3lpa$=yn.prototype.request_za3lpa$,Ot.prototype.await_za3lpa$=$n.prototype.await_za3lpa$,Ot.prototype.request_za3lpa$=$n.prototype.request_za3lpa$,Ot.prototype.peekTo_afjyek$=St.prototype.peekTo_afjyek$,rn.prototype.cancel=S.prototype.cancel,rn.prototype.fold_3cc69b$=S.prototype.fold_3cc69b$,rn.prototype.get_j3r2sn$=S.prototype.get_j3r2sn$,rn.prototype.minusKey_yeqjby$=S.prototype.minusKey_yeqjby$,rn.prototype.plus_dqr1mp$=S.prototype.plus_dqr1mp$,rn.prototype.plus_1fupul$=S.prototype.plus_1fupul$,rn.prototype.cancel_dbl4no$=S.prototype.cancel_dbl4no$,rn.prototype.cancel_m4sck1$=S.prototype.cancel_m4sck1$,rn.prototype.invokeOnCompletion_ct2b2z$=S.prototype.invokeOnCompletion_ct2b2z$,on.prototype.cancel=S.prototype.cancel,on.prototype.fold_3cc69b$=S.prototype.fold_3cc69b$,on.prototype.get_j3r2sn$=S.prototype.get_j3r2sn$,on.prototype.minusKey_yeqjby$=S.prototype.minusKey_yeqjby$,on.prototype.plus_dqr1mp$=S.prototype.plus_dqr1mp$,on.prototype.plus_1fupul$=S.prototype.plus_1fupul$,on.prototype.cancel_dbl4no$=S.prototype.cancel_dbl4no$,on.prototype.cancel_m4sck1$=S.prototype.cancel_m4sck1$,on.prototype.invokeOnCompletion_ct2b2z$=S.prototype.invokeOnCompletion_ct2b2z$,dn.prototype.cancel_dbl4no$=rn.prototype.cancel_dbl4no$,dn.prototype.cancel_m4sck1$=rn.prototype.cancel_m4sck1$,dn.prototype.invokeOnCompletion_ct2b2z$=rn.prototype.invokeOnCompletion_ct2b2z$,Mi.prototype.readFully_359eei$=Np.prototype.readFully_359eei$,Mi.prototype.readFully_nd5v6f$=Np.prototype.readFully_nd5v6f$,Mi.prototype.readFully_rfv6wg$=Np.prototype.readFully_rfv6wg$,Mi.prototype.readFully_kgymra$=Np.prototype.readFully_kgymra$,Mi.prototype.readFully_6icyh1$=Np.prototype.readFully_6icyh1$,Mi.prototype.readFully_qr0era$=Np.prototype.readFully_qr0era$,Mi.prototype.readFully_gsnag5$=Np.prototype.readFully_gsnag5$,Mi.prototype.readFully_qmgm5g$=Np.prototype.readFully_qmgm5g$,Mi.prototype.readFully_p0d4q1$=Np.prototype.readFully_p0d4q1$,Mi.prototype.readAvailable_mj6st8$=Np.prototype.readAvailable_mj6st8$,Mi.prototype.readAvailable_359eei$=Np.prototype.readAvailable_359eei$,Mi.prototype.readAvailable_nd5v6f$=Np.prototype.readAvailable_nd5v6f$,Mi.prototype.readAvailable_rfv6wg$=Np.prototype.readAvailable_rfv6wg$,Mi.prototype.readAvailable_kgymra$=Np.prototype.readAvailable_kgymra$,Mi.prototype.readAvailable_6icyh1$=Np.prototype.readAvailable_6icyh1$,Mi.prototype.readAvailable_qr0era$=Np.prototype.readAvailable_qr0era$,Mi.prototype.readAvailable_gsnag5$=Np.prototype.readAvailable_gsnag5$,Mi.prototype.readAvailable_qmgm5g$=Np.prototype.readAvailable_qmgm5g$,Mi.prototype.readAvailable_p0d4q1$=Np.prototype.readAvailable_p0d4q1$,Mi.prototype.peekTo_afjyek$=Np.prototype.peekTo_afjyek$,Hi.prototype.writeShort_mq22fl$=dh.prototype.writeShort_mq22fl$,Hi.prototype.writeInt_za3lpa$=dh.prototype.writeInt_za3lpa$,Hi.prototype.writeLong_s8cxhz$=dh.prototype.writeLong_s8cxhz$,Hi.prototype.writeFloat_mx4ult$=dh.prototype.writeFloat_mx4ult$,Hi.prototype.writeDouble_14dthe$=dh.prototype.writeDouble_14dthe$,Hi.prototype.writeFully_mj6st8$=dh.prototype.writeFully_mj6st8$,Hi.prototype.writeFully_359eei$=dh.prototype.writeFully_359eei$,Hi.prototype.writeFully_nd5v6f$=dh.prototype.writeFully_nd5v6f$,Hi.prototype.writeFully_rfv6wg$=dh.prototype.writeFully_rfv6wg$,Hi.prototype.writeFully_kgymra$=dh.prototype.writeFully_kgymra$,Hi.prototype.writeFully_6icyh1$=dh.prototype.writeFully_6icyh1$,Hi.prototype.writeFully_qr0era$=dh.prototype.writeFully_qr0era$,Hi.prototype.fill_3pq026$=dh.prototype.fill_3pq026$,Mh.prototype.close=gu.prototype.close,bu.prototype.close=gu.prototype.close,kl.prototype.close=gu.prototype.close,El.prototype.close=gu.prototype.close,wu.prototype.close=gu.prototype.close,Hp.prototype.peekTo_afjyek$=Np.prototype.peekTo_afjyek$,Zi=4096,xr=new Sr,Wl=new Int8Array(0),fc=Sp().nativeOrder()===kp(),cp=8,oh=200,ah=100,sh=4096,lh="boolean"==typeof(Zh="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node)?Zh:c();var Qh=new Ct;Qh.stream=!0,uh=Qh;var t_=new Ct;return t_.fatal=!0,ch=t_,t})?i.apply(e,r):i)||(t.exports=o)},94:function(t,e,n){var i,r,o;r=[e,n(421),n(276),n(197)],void 0===(o="function"==typeof(i=function(t,e,i,r){"use strict";var o,a,s,l=t.$$importsForInline$$||(t.$$importsForInline$$={}),u=e.Kind.CLASS,c=(e.kotlin.Annotation,Object),p=e.kotlin.IllegalStateException_init_pdl1vj$,h=e.Kind.INTERFACE,_=e.toChar,f=e.kotlin.text.indexOf_8eortd$,d=i.io.ktor.utils.io.core.writeText_t153jy$,m=i.io.ktor.utils.io.core.writeFully_i6snlg$,y=i.io.ktor.utils.io.core.readAvailable_ja303r$,$=(i.io.ktor.utils.io.charsets,i.io.ktor.utils.io.core.String_xge8xe$,e.unboxChar),v=(i.io.ktor.utils.io.core.readBytes_7wsnj1$,e.toByte,i.io.ktor.utils.io.core.readText_1lnizf$,e.kotlin.ranges.until_dqglrj$),g=i.io.ktor.utils.io.core.BytePacketBuilder_za3lpa$,b=Error,w=e.kotlin.text.StringBuilder_init,x=e.kotlin.text.get_lastIndex_gw00vp$,k=e.toBoxedChar,E=(e.Long.fromInt(4096),i.io.ktor.utils.io.ByteChannel_6taknv$,i.io.ktor.utils.io.readRemaining_b56lbm$,e.kotlin.Unit),C=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,S=e.kotlin.coroutines.CoroutineImpl,T=(r.kotlinx.coroutines.async_pda6u4$,e.kotlin.collections.listOf_i5x0yv$,i.io.ktor.utils.io.close_x5qia6$,r.kotlinx.coroutines.launch_s496o7$,e.kotlin.to_ujzrz7$),O=(r.kotlinx.coroutines,i.io.ktor.utils.io.readRemaining_3dmw3p$,i.io.ktor.utils.io.core.readBytes_xc9h3n$),N=(e.toShort,e.equals),P=e.hashCode,A=e.kotlin.collections.MutableMap,j=e.ensureNotNull,L=e.kotlin.collections.Map.Entry,R=e.kotlin.collections.MutableMap.MutableEntry,I=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,z=e.kotlin.collections.MutableSet,D=e.kotlin.collections.addAll_ipc267$,M=e.kotlin.collections.Map,B=e.throwCCE,U=e.charArray,F=(e.kotlin.text.repeat_94bcnn$,e.toString),q=(e.kotlin.io.println_s8jyv4$,r.kotlinx.coroutines.SupervisorJob_5dx9e$),G=e.kotlin.coroutines.AbstractCoroutineContextElement,H=r.kotlinx.coroutines.CoroutineExceptionHandler,Y=e.kotlin.text.String_4hbowm$,V=(e.kotlin.text.toInt_6ic1pp$,i.io.ktor.utils.io.charsets.encodeToByteArray_fj4osb$,e.kotlin.collections.MutableIterator),K=e.kotlin.collections.Set,W=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,X=e.kotlin.collections.ArrayList_init_ww73n8$,Z=e.Kind.OBJECT,J=(e.kotlin.collections.toList_us0mfu$,e.defineInlineFunction),Q=(e.kotlin.UnsupportedOperationException_init_pdl1vj$,e.Long.ZERO),tt=(e.kotlin.ranges.coerceAtLeast_2p08ub$,e.wrapFunction),et=e.kotlin.collections.firstOrNull_2p1efm$,nt=e.kotlin.text.equals_igcy3c$,it=(e.kotlin.collections.setOf_mh5how$,e.kotlin.collections.emptyMap_q3lmfv$),rt=e.kotlin.collections.toMap_abgq59$,ot=e.kotlin.lazy_klfg04$,at=e.kotlin.collections.Collection,st=e.kotlin.collections.toSet_7wnvza$,lt=e.kotlin.collections.emptySet_287e2$,ut=e.kotlin.collections.LinkedHashMap_init_bwtc7$,ct=(e.kotlin.collections.asList_us0mfu$,e.kotlin.collections.toMap_6hr0sd$,e.kotlin.collections.listOf_mh5how$,e.kotlin.collections.single_7wnvza$,e.kotlin.collections.toList_7wnvza$),pt=e.kotlin.collections.ArrayList_init_287e2$,ht=e.kotlin.IllegalArgumentException_init_pdl1vj$,_t=e.kotlin.ranges.CharRange,ft=e.kotlin.text.StringBuilder_init_za3lpa$,dt=e.kotlin.text.get_indices_gw00vp$,mt=(i.io.ktor.utils.io.errors.IOException,e.kotlin.collections.MutableCollection,e.kotlin.collections.LinkedHashSet_init_287e2$,e.kotlin.Enum),yt=e.throwISE,$t=e.kotlin.Comparable,vt=(e.kotlin.text.toInt_pdl1vz$,e.throwUPAE,e.kotlin.IllegalStateException),gt=(e.kotlin.text.iterator_gw00vp$,e.kotlin.collections.ArrayList_init_mqih57$),bt=e.kotlin.collections.ArrayList,wt=e.kotlin.collections.emptyList_287e2$,xt=e.kotlin.collections.get_lastIndex_55thoc$,kt=e.kotlin.collections.MutableList,Et=e.kotlin.collections.last_2p1efm$,Ct=r.kotlinx.coroutines.CoroutineScope,St=e.kotlin.Result,Tt=e.kotlin.coroutines.Continuation,Ot=e.kotlin.collections.List,Nt=e.kotlin.createFailure_tcv7n7$,Pt=r.kotlinx.coroutines.internal.recoverStackTrace_ak2v6d$,At=e.kotlin.isNaN_yrwdxr$;function jt(t){this.name=t}function Lt(){}function Rt(t){for(var e=w(),n=new Int8Array(3);t.remaining.toNumber()>0;){var i=y(t,n);It(n,i);for(var r=(8*(n.length-i|0)|0)/6|0,o=(255&n[0])<<16|(255&n[1])<<8|255&n[2],s=n.length;s>=r;s--){var l=o>>(6*s|0)&63;e.append_s8itvh$(zt(l))}for(var u=0;u>4],r[(i=o,o=i+1|0,i)]=a[15&u]}return Y(r)}function Wt(t,e,n){this.delegate_0=t,this.convertTo_0=e,this.convert_0=n,this.size_uukmxx$_0=this.delegate_0.size}function Xt(t){this.this$DelegatingMutableSet=t,this.delegateIterator=t.delegate_0.iterator()}function Zt(){se()}function Jt(){ae=this,this.Empty=new le}_e.prototype=Object.create(mt.prototype),_e.prototype.constructor=_e,De.prototype=Object.create(mt.prototype),De.prototype.constructor=De,fn.prototype=Object.create(_n.prototype),fn.prototype.constructor=fn,dn.prototype=Object.create(_n.prototype),dn.prototype.constructor=dn,mn.prototype=Object.create(_n.prototype),mn.prototype.constructor=mn,Tn.prototype=Object.create(b.prototype),Tn.prototype.constructor=Tn,Mn.prototype=Object.create(vt.prototype),Mn.prototype.constructor=Mn,jt.prototype.toString=function(){return 0===this.name.length?c.prototype.toString.call(this):"AttributeKey: "+this.name},jt.$metadata$={kind:u,simpleName:"AttributeKey",interfaces:[]},Lt.prototype.get_yzaw86$=function(t){var e;if(null==(e=this.getOrNull_yzaw86$(t)))throw p("No instance for key "+t);return e},Lt.prototype.take_yzaw86$=function(t){var e=this.get_yzaw86$(t);return this.remove_yzaw86$(t),e},Lt.prototype.takeOrNull_yzaw86$=function(t){var e=this.getOrNull_yzaw86$(t);return this.remove_yzaw86$(t),e},Lt.$metadata$={kind:h,simpleName:"Attributes",interfaces:[]},Object.defineProperty(Dt.prototype,"size",{get:function(){return this.delegate_0.size}}),Dt.prototype.containsKey_11rb$=function(t){return this.delegate_0.containsKey_11rb$(new he(t))},Dt.prototype.containsValue_11rc$=function(t){return this.delegate_0.containsValue_11rc$(t)},Dt.prototype.get_11rb$=function(t){return this.delegate_0.get_11rb$(pe(t))},Dt.prototype.isEmpty=function(){return this.delegate_0.isEmpty()},Dt.prototype.clear=function(){this.delegate_0.clear()},Dt.prototype.put_xwzc9p$=function(t,e){return this.delegate_0.put_xwzc9p$(pe(t),e)},Dt.prototype.putAll_a2k3zr$=function(t){var e;for(e=t.entries.iterator();e.hasNext();){var n=e.next(),i=n.key,r=n.value;this.put_xwzc9p$(i,r)}},Dt.prototype.remove_11rb$=function(t){return this.delegate_0.remove_11rb$(pe(t))},Object.defineProperty(Dt.prototype,"keys",{get:function(){return new Wt(this.delegate_0.keys,Mt,Bt)}}),Object.defineProperty(Dt.prototype,"entries",{get:function(){return new Wt(this.delegate_0.entries,Ut,Ft)}}),Object.defineProperty(Dt.prototype,"values",{get:function(){return this.delegate_0.values}}),Dt.prototype.equals=function(t){return!(null==t||!e.isType(t,Dt))&&N(t.delegate_0,this.delegate_0)},Dt.prototype.hashCode=function(){return P(this.delegate_0)},Dt.$metadata$={kind:u,simpleName:"CaseInsensitiveMap",interfaces:[A]},Object.defineProperty(qt.prototype,"key",{get:function(){return this.key_3iz5qv$_0}}),Object.defineProperty(qt.prototype,"value",{get:function(){return this.value_p1xw47$_0},set:function(t){this.value_p1xw47$_0=t}}),qt.prototype.setValue_11rc$=function(t){return this.value=t,this.value},qt.prototype.hashCode=function(){return 527+P(j(this.key))+P(j(this.value))|0},qt.prototype.equals=function(t){return!(null==t||!e.isType(t,L))&&N(t.key,this.key)&&N(t.value,this.value)},qt.prototype.toString=function(){return this.key.toString()+"="+this.value},qt.$metadata$={kind:u,simpleName:"Entry",interfaces:[R]},Yt.prototype=Object.create(G.prototype),Yt.prototype.constructor=Yt,Yt.prototype.handleException_1ur55u$=function(t,e){this.closure$handler(t,e)},Yt.$metadata$={kind:u,interfaces:[H,G]},Wt.prototype.convert_9xhtru$=function(t){var e,n=X(W(t,10));for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(this.convert_0(i))}return n},Wt.prototype.convertTo_9xhuij$=function(t){var e,n=X(W(t,10));for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(this.convertTo_0(i))}return n},Object.defineProperty(Wt.prototype,"size",{get:function(){return this.size_uukmxx$_0}}),Wt.prototype.add_11rb$=function(t){return this.delegate_0.add_11rb$(this.convert_0(t))},Wt.prototype.addAll_brywnq$=function(t){return this.delegate_0.addAll_brywnq$(this.convert_9xhtru$(t))},Wt.prototype.clear=function(){this.delegate_0.clear()},Wt.prototype.remove_11rb$=function(t){return this.delegate_0.remove_11rb$(this.convert_0(t))},Wt.prototype.removeAll_brywnq$=function(t){return this.delegate_0.removeAll_brywnq$(this.convert_9xhtru$(t))},Wt.prototype.retainAll_brywnq$=function(t){return this.delegate_0.retainAll_brywnq$(this.convert_9xhtru$(t))},Wt.prototype.contains_11rb$=function(t){return this.delegate_0.contains_11rb$(this.convert_0(t))},Wt.prototype.containsAll_brywnq$=function(t){return this.delegate_0.containsAll_brywnq$(this.convert_9xhtru$(t))},Wt.prototype.isEmpty=function(){return this.delegate_0.isEmpty()},Xt.prototype.hasNext=function(){return this.delegateIterator.hasNext()},Xt.prototype.next=function(){return this.this$DelegatingMutableSet.convertTo_0(this.delegateIterator.next())},Xt.prototype.remove=function(){this.delegateIterator.remove()},Xt.$metadata$={kind:u,interfaces:[V]},Wt.prototype.iterator=function(){return new Xt(this)},Wt.prototype.hashCode=function(){return P(this.delegate_0)},Wt.prototype.equals=function(t){if(null==t||!e.isType(t,K))return!1;var n=this.convertTo_9xhuij$(this.delegate_0),i=t.containsAll_brywnq$(n);return i&&(i=n.containsAll_brywnq$(t)),i},Wt.prototype.toString=function(){return this.convertTo_9xhuij$(this.delegate_0).toString()},Wt.$metadata$={kind:u,simpleName:"DelegatingMutableSet",interfaces:[z]},Jt.prototype.build_o7hlrk$=J("ktor-ktor-utils.io.ktor.util.StringValues.Companion.build_o7hlrk$",tt((function(){var e=t.io.ktor.util.StringValuesBuilder;return function(t,n){void 0===t&&(t=!1);var i=new e(t);return n(i),i.build()}}))),Jt.$metadata$={kind:Z,simpleName:"Companion",interfaces:[]};var Qt,te,ee,ne,ie,re,oe,ae=null;function se(){return null===ae&&new Jt,ae}function le(t,e){var n,i;void 0===t&&(t=!1),void 0===e&&(e=it()),this.caseInsensitiveName_w2tiaf$_0=t,this.values_x1t64x$_0=ot((n=this,i=e,function(){var t;if(n.caseInsensitiveName){var e=Ht();e.putAll_a2k3zr$(i),t=e}else t=rt(i);return t}))}function ue(t,e){void 0===t&&(t=!1),void 0===e&&(e=8),this.caseInsensitiveName=t,this.values=this.caseInsensitiveName?Ht():ut(e),this.built=!1}function ce(t){return new _t(65,90).contains_mef7kx$(t)?_(t+32):new _t(0,127).contains_mef7kx$(t)?t:_(String.fromCharCode(0|t).toLowerCase().charCodeAt(0))}function pe(t){return new he(t)}function he(t){this.content=t,this.hash_0=P(this.content.toLowerCase())}function _e(t,e,n){mt.call(this),this.value=n,this.name$=t,this.ordinal$=e}function fe(){fe=function(){},Qt=new _e("MONDAY",0,"Mon"),te=new _e("TUESDAY",1,"Tue"),ee=new _e("WEDNESDAY",2,"Wed"),ne=new _e("THURSDAY",3,"Thu"),ie=new _e("FRIDAY",4,"Fri"),re=new _e("SATURDAY",5,"Sat"),oe=new _e("SUNDAY",6,"Sun"),Ie()}function de(){return fe(),Qt}function me(){return fe(),te}function ye(){return fe(),ee}function $e(){return fe(),ne}function ve(){return fe(),ie}function ge(){return fe(),re}function be(){return fe(),oe}function we(){Re=this}Zt.prototype.get_61zpoe$=function(t){var e;return null!=(e=this.getAll_61zpoe$(t))?et(e):null},Zt.prototype.contains_61zpoe$=function(t){return null!=this.getAll_61zpoe$(t)},Zt.prototype.contains_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.getAll_61zpoe$(t))?n.contains_11rb$(e):null)&&i},Zt.prototype.forEach_ubvtmq$=function(t){var e;for(e=this.entries().iterator();e.hasNext();){var n=e.next();t(n.key,n.value)}},Zt.$metadata$={kind:h,simpleName:"StringValues",interfaces:[]},Object.defineProperty(le.prototype,"caseInsensitiveName",{get:function(){return this.caseInsensitiveName_w2tiaf$_0}}),Object.defineProperty(le.prototype,"values",{get:function(){return this.values_x1t64x$_0.value}}),le.prototype.get_61zpoe$=function(t){var e;return null!=(e=this.listForKey_6rkiov$_0(t))?et(e):null},le.prototype.getAll_61zpoe$=function(t){return this.listForKey_6rkiov$_0(t)},le.prototype.contains_61zpoe$=function(t){return null!=this.listForKey_6rkiov$_0(t)},le.prototype.contains_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.listForKey_6rkiov$_0(t))?n.contains_11rb$(e):null)&&i},le.prototype.names=function(){return this.values.keys},le.prototype.isEmpty=function(){return this.values.isEmpty()},le.prototype.entries=function(){return this.values.entries},le.prototype.forEach_ubvtmq$=function(t){var e;for(e=this.values.entries.iterator();e.hasNext();){var n=e.next();t(n.key,n.value)}},le.prototype.listForKey_6rkiov$_0=function(t){return this.values.get_11rb$(t)},le.prototype.toString=function(){return"StringValues(case="+!this.caseInsensitiveName+") "+this.entries()},le.prototype.equals=function(t){return this===t||!!e.isType(t,Zt)&&this.caseInsensitiveName===t.caseInsensitiveName&&(n=this.entries(),i=t.entries(),N(n,i));var n,i},le.prototype.hashCode=function(){return t=this.entries(),(31*(31*P(this.caseInsensitiveName)|0)|0)+P(t)|0;var t},le.$metadata$={kind:u,simpleName:"StringValuesImpl",interfaces:[Zt]},ue.prototype.getAll_61zpoe$=function(t){return this.values.get_11rb$(t)},ue.prototype.contains_61zpoe$=function(t){var n,i=this.values;return(e.isType(n=i,M)?n:B()).containsKey_11rb$(t)},ue.prototype.contains_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.values.get_11rb$(t))?n.contains_11rb$(e):null)&&i},ue.prototype.names=function(){return this.values.keys},ue.prototype.isEmpty=function(){return this.values.isEmpty()},ue.prototype.entries=function(){return this.values.entries},ue.prototype.set_puj7f4$=function(t,e){this.validateValue_61zpoe$(e);var n=this.ensureListForKey_fsrbb4$_0(t,1);n.clear(),n.add_11rb$(e)},ue.prototype.get_61zpoe$=function(t){var e;return null!=(e=this.getAll_61zpoe$(t))?et(e):null},ue.prototype.append_puj7f4$=function(t,e){this.validateValue_61zpoe$(e),this.ensureListForKey_fsrbb4$_0(t,1).add_11rb$(e)},ue.prototype.appendAll_hb0ubp$=function(t){var e;t.forEach_ubvtmq$((e=this,function(t,n){return e.appendAll_poujtz$(t,n),E}))},ue.prototype.appendMissing_hb0ubp$=function(t){var e;t.forEach_ubvtmq$((e=this,function(t,n){return e.appendMissing_poujtz$(t,n),E}))},ue.prototype.appendAll_poujtz$=function(t,n){var i,r,o,a,s=this.ensureListForKey_fsrbb4$_0(t,null!=(o=null!=(r=e.isType(i=n,at)?i:null)?r.size:null)?o:2);for(a=n.iterator();a.hasNext();){var l=a.next();this.validateValue_61zpoe$(l),s.add_11rb$(l)}},ue.prototype.appendMissing_poujtz$=function(t,e){var n,i,r,o=null!=(i=null!=(n=this.values.get_11rb$(t))?st(n):null)?i:lt(),a=pt();for(r=e.iterator();r.hasNext();){var s=r.next();o.contains_11rb$(s)||a.add_11rb$(s)}this.appendAll_poujtz$(t,a)},ue.prototype.remove_61zpoe$=function(t){this.values.remove_11rb$(t)},ue.prototype.removeKeysWithNoEntries=function(){var t,e,n=this.values,i=I();for(e=n.entries.iterator();e.hasNext();){var r=e.next();r.value.isEmpty()&&i.put_xwzc9p$(r.key,r.value)}for(t=i.entries.iterator();t.hasNext();){var o=t.next().key;this.remove_61zpoe$(o)}},ue.prototype.remove_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.values.get_11rb$(t))?n.remove_11rb$(e):null)&&i},ue.prototype.clear=function(){this.values.clear()},ue.prototype.build=function(){if(this.built)throw ht("ValueMapBuilder can only build a single ValueMap".toString());return this.built=!0,new le(this.caseInsensitiveName,this.values)},ue.prototype.validateName_61zpoe$=function(t){},ue.prototype.validateValue_61zpoe$=function(t){},ue.prototype.ensureListForKey_fsrbb4$_0=function(t,e){var n,i;if(this.built)throw p("Cannot modify a builder when final structure has already been built");if(null!=(n=this.values.get_11rb$(t)))i=n;else{var r=X(e);this.validateName_61zpoe$(t),this.values.put_xwzc9p$(t,r),i=r}return i},ue.$metadata$={kind:u,simpleName:"StringValuesBuilder",interfaces:[]},he.prototype.equals=function(t){var n,i,r;return!0===(null!=(r=null!=(i=e.isType(n=t,he)?n:null)?i.content:null)?nt(r,this.content,!0):null)},he.prototype.hashCode=function(){return this.hash_0},he.prototype.toString=function(){return this.content},he.$metadata$={kind:u,simpleName:"CaseInsensitiveString",interfaces:[]},we.prototype.from_za3lpa$=function(t){return ze()[t]},we.prototype.from_61zpoe$=function(t){var e,n,i=ze();t:do{var r;for(r=0;r!==i.length;++r){var o=i[r];if(N(o.value,t)){n=o;break t}}n=null}while(0);if(null==(e=n))throw p(("Invalid day of week: "+t).toString());return e},we.$metadata$={kind:Z,simpleName:"Companion",interfaces:[]};var xe,ke,Ee,Ce,Se,Te,Oe,Ne,Pe,Ae,je,Le,Re=null;function Ie(){return fe(),null===Re&&new we,Re}function ze(){return[de(),me(),ye(),$e(),ve(),ge(),be()]}function De(t,e,n){mt.call(this),this.value=n,this.name$=t,this.ordinal$=e}function Me(){Me=function(){},xe=new De("JANUARY",0,"Jan"),ke=new De("FEBRUARY",1,"Feb"),Ee=new De("MARCH",2,"Mar"),Ce=new De("APRIL",3,"Apr"),Se=new De("MAY",4,"May"),Te=new De("JUNE",5,"Jun"),Oe=new De("JULY",6,"Jul"),Ne=new De("AUGUST",7,"Aug"),Pe=new De("SEPTEMBER",8,"Sep"),Ae=new De("OCTOBER",9,"Oct"),je=new De("NOVEMBER",10,"Nov"),Le=new De("DECEMBER",11,"Dec"),tn()}function Be(){return Me(),xe}function Ue(){return Me(),ke}function Fe(){return Me(),Ee}function qe(){return Me(),Ce}function Ge(){return Me(),Se}function He(){return Me(),Te}function Ye(){return Me(),Oe}function Ve(){return Me(),Ne}function Ke(){return Me(),Pe}function We(){return Me(),Ae}function Xe(){return Me(),je}function Ze(){return Me(),Le}function Je(){Qe=this}_e.$metadata$={kind:u,simpleName:"WeekDay",interfaces:[mt]},_e.values=ze,_e.valueOf_61zpoe$=function(t){switch(t){case"MONDAY":return de();case"TUESDAY":return me();case"WEDNESDAY":return ye();case"THURSDAY":return $e();case"FRIDAY":return ve();case"SATURDAY":return ge();case"SUNDAY":return be();default:yt("No enum constant io.ktor.util.date.WeekDay."+t)}},Je.prototype.from_za3lpa$=function(t){return en()[t]},Je.prototype.from_61zpoe$=function(t){var e,n,i=en();t:do{var r;for(r=0;r!==i.length;++r){var o=i[r];if(N(o.value,t)){n=o;break t}}n=null}while(0);if(null==(e=n))throw p(("Invalid month: "+t).toString());return e},Je.$metadata$={kind:Z,simpleName:"Companion",interfaces:[]};var Qe=null;function tn(){return Me(),null===Qe&&new Je,Qe}function en(){return[Be(),Ue(),Fe(),qe(),Ge(),He(),Ye(),Ve(),Ke(),We(),Xe(),Ze()]}function nn(t,e,n,i,r,o,a,s,l){an(),this.seconds=t,this.minutes=e,this.hours=n,this.dayOfWeek=i,this.dayOfMonth=r,this.dayOfYear=o,this.month=a,this.year=s,this.timestamp=l}function rn(){on=this,this.START=Dn(Q)}De.$metadata$={kind:u,simpleName:"Month",interfaces:[mt]},De.values=en,De.valueOf_61zpoe$=function(t){switch(t){case"JANUARY":return Be();case"FEBRUARY":return Ue();case"MARCH":return Fe();case"APRIL":return qe();case"MAY":return Ge();case"JUNE":return He();case"JULY":return Ye();case"AUGUST":return Ve();case"SEPTEMBER":return Ke();case"OCTOBER":return We();case"NOVEMBER":return Xe();case"DECEMBER":return Ze();default:yt("No enum constant io.ktor.util.date.Month."+t)}},nn.prototype.compareTo_11rb$=function(t){return this.timestamp.compareTo_11rb$(t.timestamp)},rn.$metadata$={kind:Z,simpleName:"Companion",interfaces:[]};var on=null;function an(){return null===on&&new rn,on}function sn(t){this.attributes=Nn();var e,n=X(t.length+1|0);for(e=0;e!==t.length;++e){var i=t[e];n.add_11rb$(i)}this.phasesRaw_hnbfpg$_0=n,this.interceptorsQuantity_zh48jz$_0=0,this.interceptors_dzu4x2$_0=null,this.interceptorsListShared_q9lih5$_0=!1,this.interceptorsListSharedPhase_9t9y1q$_0=null}function ln(t,e,n){pn(),this.phase=t,this.relation=e,this.interceptors_0=n,this.shared=!0}function un(){cn=this,this.SharedArrayList=X(0)}nn.$metadata$={kind:u,simpleName:"GMTDate",interfaces:[$t]},nn.prototype.component1=function(){return this.seconds},nn.prototype.component2=function(){return this.minutes},nn.prototype.component3=function(){return this.hours},nn.prototype.component4=function(){return this.dayOfWeek},nn.prototype.component5=function(){return this.dayOfMonth},nn.prototype.component6=function(){return this.dayOfYear},nn.prototype.component7=function(){return this.month},nn.prototype.component8=function(){return this.year},nn.prototype.component9=function(){return this.timestamp},nn.prototype.copy_j9f46j$=function(t,e,n,i,r,o,a,s,l){return new nn(void 0===t?this.seconds:t,void 0===e?this.minutes:e,void 0===n?this.hours:n,void 0===i?this.dayOfWeek:i,void 0===r?this.dayOfMonth:r,void 0===o?this.dayOfYear:o,void 0===a?this.month:a,void 0===s?this.year:s,void 0===l?this.timestamp:l)},nn.prototype.toString=function(){return"GMTDate(seconds="+e.toString(this.seconds)+", minutes="+e.toString(this.minutes)+", hours="+e.toString(this.hours)+", dayOfWeek="+e.toString(this.dayOfWeek)+", dayOfMonth="+e.toString(this.dayOfMonth)+", dayOfYear="+e.toString(this.dayOfYear)+", month="+e.toString(this.month)+", year="+e.toString(this.year)+", timestamp="+e.toString(this.timestamp)+")"},nn.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*(t=31*(t=31*(t=31*(t=31*(t=31*(t=31*t+e.hashCode(this.seconds)|0)+e.hashCode(this.minutes)|0)+e.hashCode(this.hours)|0)+e.hashCode(this.dayOfWeek)|0)+e.hashCode(this.dayOfMonth)|0)+e.hashCode(this.dayOfYear)|0)+e.hashCode(this.month)|0)+e.hashCode(this.year)|0)+e.hashCode(this.timestamp)|0},nn.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.seconds,t.seconds)&&e.equals(this.minutes,t.minutes)&&e.equals(this.hours,t.hours)&&e.equals(this.dayOfWeek,t.dayOfWeek)&&e.equals(this.dayOfMonth,t.dayOfMonth)&&e.equals(this.dayOfYear,t.dayOfYear)&&e.equals(this.month,t.month)&&e.equals(this.year,t.year)&&e.equals(this.timestamp,t.timestamp)},sn.prototype.execute_8pmvt0$=function(t,e,n){return this.createContext_xnqwxl$(t,e).execute_11rb$(e,n)},sn.prototype.createContext_xnqwxl$=function(t,e){return kn(t,this.sharedInterceptorsList_8aep55$_0(),e)},Object.defineProperty(ln.prototype,"isEmpty",{get:function(){return this.interceptors_0.isEmpty()}}),Object.defineProperty(ln.prototype,"size",{get:function(){return this.interceptors_0.size}}),ln.prototype.addInterceptor_mx8w25$=function(t){this.shared&&this.copyInterceptors_0(),this.interceptors_0.add_11rb$(t)},ln.prototype.addTo_vaasg2$=function(t){var e,n=this.interceptors_0;t.ensureCapacity_za3lpa$(t.size+n.size|0),e=n.size;for(var i=0;i0){var c=new wn(w(t,b(i.v,s)));n.add_11rb$(c)}n.add_11rb$(new xn(o)),i.v=l+1|0}if(i.v=ki().CACHE_DAYS_0&&r===ki().EPOCH.year&&(r=ki().CACHE_STAMP_0.year,i=ki().CACHE_STAMP_0.month,n=ki().CACHE_STAMP_0.day,e=e-ki().CACHE_DAYS_0|0);e>0;){var a=i.getDaysInYear_za3lpa$(r)-n+1|0;if(e=s?(n=1,i=Ui().JANUARY,r=r+1|0,e=e-s|0):(i=N(i.next()),n=1,e=e-a|0,o=!0)}}return new bi(n,i,r)},bi.prototype.nextDate=function(){return this.addDays_za3lpa$(1)},bi.prototype.prevDate=function(){return this.subtractDays_za3lpa$(1)},bi.prototype.subtractDays_za3lpa$=function(t){if(t<0)throw O();if(0===t)return this;if(te?ki().lastDayOf_8fsw02$(this.year-1|0).subtractDays_za3lpa$(t-e-1|0):ki().lastDayOf_8fsw02$(this.year,N(this.month.prev())).subtractDays_za3lpa$(t-this.day|0)},bi.prototype.compareTo_11rb$=function(t){return this.year!==t.year?this.year-t.year|0:this.month.ordinal()!==t.month.ordinal()?this.month.ordinal()-t.month.ordinal()|0:this.day-t.day|0},bi.prototype.equals=function(t){var n;if(!e.isType(t,bi))return!1;var i=null==(n=t)||e.isType(n,bi)?n:E();return N(i).year===this.year&&i.month===this.month&&i.day===this.day},bi.prototype.hashCode=function(){return(239*this.year|0)+(31*P(this.month)|0)+this.day|0},bi.prototype.toString=function(){var t=A();return t.append_s8jyv4$(this.year),this.appendMonth_0(t),this.appendDay_0(t),t.toString()},bi.prototype.appendDay_0=function(t){this.day<10&&t.append_pdl1vj$("0"),t.append_s8jyv4$(this.day)},bi.prototype.appendMonth_0=function(t){var e=this.month.ordinal()+1|0;e<10&&t.append_pdl1vj$("0"),t.append_s8jyv4$(e)},bi.prototype.toPrettyString=function(){var t=A();return this.appendDay_0(t),t.append_pdl1vj$("."),this.appendMonth_0(t),t.append_pdl1vj$("."),t.append_s8jyv4$(this.year),t.toString()},wi.prototype.parse_61zpoe$=function(t){if(8!==t.length)throw j();var e=L(t.substring(0,4)),n=L(t.substring(4,6));return new bi(L(t.substring(6,8)),Ui().values()[n-1|0],e)},wi.prototype.firstDayOf_8fsw02$=function(t,e){return void 0===e&&(e=Ui().JANUARY),new bi(1,e,t)},wi.prototype.lastDayOf_8fsw02$=function(t,e){return void 0===e&&(e=Ui().DECEMBER),new bi(e.days,e,t)},wi.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var xi=null;function ki(){return null===xi&&new wi,xi}function Ei(t,e){Ti(),void 0===e&&(e=Ji().DAY_START),this.date=t,this.time=e}function Ci(){Si=this}bi.$metadata$={kind:$,simpleName:"Date",interfaces:[R]},Object.defineProperty(Ei.prototype,"year",{configurable:!0,get:function(){return this.date.year}}),Object.defineProperty(Ei.prototype,"month",{configurable:!0,get:function(){return this.date.month}}),Object.defineProperty(Ei.prototype,"day",{configurable:!0,get:function(){return this.date.day}}),Object.defineProperty(Ei.prototype,"weekDay",{configurable:!0,get:function(){return this.date.weekDay}}),Object.defineProperty(Ei.prototype,"hours",{configurable:!0,get:function(){return this.time.hours}}),Object.defineProperty(Ei.prototype,"minutes",{configurable:!0,get:function(){return this.time.minutes}}),Object.defineProperty(Ei.prototype,"seconds",{configurable:!0,get:function(){return this.time.seconds}}),Object.defineProperty(Ei.prototype,"milliseconds",{configurable:!0,get:function(){return this.time.milliseconds}}),Ei.prototype.changeDate_z9gqti$=function(t){return new Ei(t,this.time)},Ei.prototype.changeTime_z96d9j$=function(t){return new Ei(this.date,t)},Ei.prototype.add_27523k$=function(t){var e=$r().UTC.toInstant_amwj4p$(this);return $r().UTC.toDateTime_x2y23v$(e.add_27523k$(t))},Ei.prototype.to_amwj4p$=function(t){var e=$r().UTC.toInstant_amwj4p$(this),n=$r().UTC.toInstant_amwj4p$(t);return e.to_x2y23v$(n)},Ei.prototype.isBefore_amwj4p$=function(t){return this.compareTo_11rb$(t)<0},Ei.prototype.isAfter_amwj4p$=function(t){return this.compareTo_11rb$(t)>0},Ei.prototype.hashCode=function(){return(31*this.date.hashCode()|0)+this.time.hashCode()|0},Ei.prototype.equals=function(t){var n,i,r;if(!e.isType(t,Ei))return!1;var o=null==(n=t)||e.isType(n,Ei)?n:E();return(null!=(i=this.date)?i.equals(N(o).date):null)&&(null!=(r=this.time)?r.equals(o.time):null)},Ei.prototype.compareTo_11rb$=function(t){var e=this.date.compareTo_11rb$(t.date);return 0!==e?e:this.time.compareTo_11rb$(t.time)},Ei.prototype.toString=function(){return this.date.toString()+"T"+I(this.time)},Ei.prototype.toPrettyString=function(){return this.time.toPrettyHMString()+" "+this.date.toPrettyString()},Ci.prototype.parse_61zpoe$=function(t){if(t.length<15)throw O();return new Ei(ki().parse_61zpoe$(t.substring(0,8)),Ji().parse_61zpoe$(t.substring(9)))},Ci.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var Si=null;function Ti(){return null===Si&&new Ci,Si}function Oi(){var t,e;Ni=this,this.BASE_YEAR=1900,this.MAX_SUPPORTED_YEAR=2100,this.MIN_SUPPORTED_YEAR_8be2vx$=1970,this.DAYS_IN_YEAR_8be2vx$=0,this.DAYS_IN_LEAP_YEAR_8be2vx$=0,this.LEAP_YEARS_FROM_1969_8be2vx$=new Int32Array([477,477,477,478,478,478,478,479,479,479,479,480,480,480,480,481,481,481,481,482,482,482,482,483,483,483,483,484,484,484,484,485,485,485,485,486,486,486,486,487,487,487,487,488,488,488,488,489,489,489,489,490,490,490,490,491,491,491,491,492,492,492,492,493,493,493,493,494,494,494,494,495,495,495,495,496,496,496,496,497,497,497,497,498,498,498,498,499,499,499,499,500,500,500,500,501,501,501,501,502,502,502,502,503,503,503,503,504,504,504,504,505,505,505,505,506,506,506,506,507,507,507,507,508,508,508,508,509,509,509,509,509]);var n=0,i=0;for(t=Ui().values(),e=0;e!==t.length;++e){var r=t[e];n=n+r.getDaysInLeapYear()|0,i=i+r.days|0}this.DAYS_IN_YEAR_8be2vx$=i,this.DAYS_IN_LEAP_YEAR_8be2vx$=n}Ei.$metadata$={kind:$,simpleName:"DateTime",interfaces:[R]},Oi.prototype.isLeap_kcn2v3$=function(t){return this.checkYear_0(t),1==(this.LEAP_YEARS_FROM_1969_8be2vx$[t-1970+1|0]-this.LEAP_YEARS_FROM_1969_8be2vx$[t-1970|0]|0)},Oi.prototype.leapYearsBetween_6xvm5r$=function(t,e){if(t>e)throw O();return this.checkYear_0(t),this.checkYear_0(e),this.LEAP_YEARS_FROM_1969_8be2vx$[e-1970|0]-this.LEAP_YEARS_FROM_1969_8be2vx$[t-1970|0]|0},Oi.prototype.leapYearsFromZero_0=function(t){return(t/4|0)-(t/100|0)+(t/400|0)|0},Oi.prototype.checkYear_0=function(t){if(t>2100||t<1970)throw v(t.toString()+"")},Oi.$metadata$={kind:y,simpleName:"DateTimeUtil",interfaces:[]};var Ni=null;function Pi(){return null===Ni&&new Oi,Ni}function Ai(t){Ri(),this.duration=t}function ji(){Li=this,this.MS=new Ai(D),this.SECOND=this.MS.mul_s8cxhz$(M),this.MINUTE=this.SECOND.mul_s8cxhz$(B),this.HOUR=this.MINUTE.mul_s8cxhz$(B),this.DAY=this.HOUR.mul_s8cxhz$(U),this.WEEK=this.DAY.mul_s8cxhz$(F)}Object.defineProperty(Ai.prototype,"isPositive",{configurable:!0,get:function(){return this.duration.toNumber()>0}}),Ai.prototype.mul_s8cxhz$=function(t){return new Ai(this.duration.multiply(t))},Ai.prototype.add_27523k$=function(t){return new Ai(this.duration.add(t.duration))},Ai.prototype.sub_27523k$=function(t){return new Ai(this.duration.subtract(t.duration))},Ai.prototype.div_27523k$=function(t){return this.duration.toNumber()/t.duration.toNumber()},Ai.prototype.compareTo_11rb$=function(t){var e=this.duration.subtract(t.duration);return e.toNumber()>0?1:l(e,z)?0:-1},Ai.prototype.hashCode=function(){return this.duration.toInt()},Ai.prototype.equals=function(t){return!!e.isType(t,Ai)&&l(this.duration,t.duration)},Ai.prototype.toString=function(){return"Duration : "+I(this.duration)+"ms"},ji.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var Li=null;function Ri(){return null===Li&&new ji,Li}function Ii(t){this.timeSinceEpoch=t}function zi(t,e,n){Ui(),this.days=t,this.myOrdinal_hzcl1t$_0=e,this.myName_s01cg9$_0=n}function Di(t,e,n,i){zi.call(this,t,n,i),this.myDaysInLeapYear_0=e}function Mi(){Bi=this,this.JANUARY=new zi(31,0,"January"),this.FEBRUARY=new Di(28,29,1,"February"),this.MARCH=new zi(31,2,"March"),this.APRIL=new zi(30,3,"April"),this.MAY=new zi(31,4,"May"),this.JUNE=new zi(30,5,"June"),this.JULY=new zi(31,6,"July"),this.AUGUST=new zi(31,7,"August"),this.SEPTEMBER=new zi(30,8,"September"),this.OCTOBER=new zi(31,9,"October"),this.NOVEMBER=new zi(30,10,"November"),this.DECEMBER=new zi(31,11,"December"),this.VALUES_0=[this.JANUARY,this.FEBRUARY,this.MARCH,this.APRIL,this.MAY,this.JUNE,this.JULY,this.AUGUST,this.SEPTEMBER,this.OCTOBER,this.NOVEMBER,this.DECEMBER]}Ai.$metadata$={kind:$,simpleName:"Duration",interfaces:[R]},Ii.prototype.add_27523k$=function(t){return new Ii(this.timeSinceEpoch.add(t.duration))},Ii.prototype.sub_27523k$=function(t){return new Ii(this.timeSinceEpoch.subtract(t.duration))},Ii.prototype.to_x2y23v$=function(t){return new Ai(t.timeSinceEpoch.subtract(this.timeSinceEpoch))},Ii.prototype.compareTo_11rb$=function(t){var e=this.timeSinceEpoch.subtract(t.timeSinceEpoch);return e.toNumber()>0?1:l(e,z)?0:-1},Ii.prototype.hashCode=function(){return this.timeSinceEpoch.toInt()},Ii.prototype.toString=function(){return""+I(this.timeSinceEpoch)},Ii.prototype.equals=function(t){return!!e.isType(t,Ii)&&l(this.timeSinceEpoch,t.timeSinceEpoch)},Ii.$metadata$={kind:$,simpleName:"Instant",interfaces:[R]},zi.prototype.ordinal=function(){return this.myOrdinal_hzcl1t$_0},zi.prototype.getDaysInYear_za3lpa$=function(t){return this.days},zi.prototype.getDaysInLeapYear=function(){return this.days},zi.prototype.prev=function(){return 0===this.myOrdinal_hzcl1t$_0?null:Ui().values()[this.myOrdinal_hzcl1t$_0-1|0]},zi.prototype.next=function(){var t=Ui().values();return this.myOrdinal_hzcl1t$_0===(t.length-1|0)?null:t[this.myOrdinal_hzcl1t$_0+1|0]},zi.prototype.toString=function(){return this.myName_s01cg9$_0},Di.prototype.getDaysInLeapYear=function(){return this.myDaysInLeapYear_0},Di.prototype.getDaysInYear_za3lpa$=function(t){return Pi().isLeap_kcn2v3$(t)?this.getDaysInLeapYear():this.days},Di.$metadata$={kind:$,simpleName:"VarLengthMonth",interfaces:[zi]},Mi.prototype.values=function(){return this.VALUES_0},Mi.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var Bi=null;function Ui(){return null===Bi&&new Mi,Bi}function Fi(t,e,n,i){if(Ji(),void 0===n&&(n=0),void 0===i&&(i=0),this.hours=t,this.minutes=e,this.seconds=n,this.milliseconds=i,this.hours<0||this.hours>24)throw O();if(24===this.hours&&(0!==this.minutes||0!==this.seconds))throw O();if(this.minutes<0||this.minutes>=60)throw O();if(this.seconds<0||this.seconds>=60)throw O()}function qi(){Zi=this,this.DELIMITER_0=58,this.DAY_START=new Fi(0,0),this.DAY_END=new Fi(24,0)}zi.$metadata$={kind:$,simpleName:"Month",interfaces:[]},Fi.prototype.compareTo_11rb$=function(t){var e=this.hours-t.hours|0;return 0!==e||0!=(e=this.minutes-t.minutes|0)||0!=(e=this.seconds-t.seconds|0)?e:this.milliseconds-t.milliseconds|0},Fi.prototype.hashCode=function(){return(239*this.hours|0)+(491*this.minutes|0)+(41*this.seconds|0)+this.milliseconds|0},Fi.prototype.equals=function(t){var n;return!!e.isType(t,Fi)&&0===this.compareTo_11rb$(N(null==(n=t)||e.isType(n,Fi)?n:E()))},Fi.prototype.toString=function(){var t=A();return this.hours<10&&t.append_pdl1vj$("0"),t.append_s8jyv4$(this.hours),this.minutes<10&&t.append_pdl1vj$("0"),t.append_s8jyv4$(this.minutes),this.seconds<10&&t.append_pdl1vj$("0"),t.append_s8jyv4$(this.seconds),t.toString()},Fi.prototype.toPrettyHMString=function(){var t=A();return this.hours<10&&t.append_pdl1vj$("0"),t.append_s8jyv4$(this.hours).append_s8itvh$(Ji().DELIMITER_0),this.minutes<10&&t.append_pdl1vj$("0"),t.append_s8jyv4$(this.minutes),t.toString()},qi.prototype.parse_61zpoe$=function(t){if(t.length<6)throw O();return new Fi(L(t.substring(0,2)),L(t.substring(2,4)),L(t.substring(4,6)))},qi.prototype.fromPrettyHMString_61zpoe$=function(t){var n=this.DELIMITER_0;if(!q(t,String.fromCharCode(n)+""))throw O();var i=t.length;if(5!==i&&4!==i)throw O();var r=4===i?1:2;try{var o=L(t.substring(0,r)),a=r+1|0;return new Fi(o,L(t.substring(a,i)),0)}catch(t){throw e.isType(t,G)?O():t}},qi.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var Gi,Hi,Yi,Vi,Ki,Wi,Xi,Zi=null;function Ji(){return null===Zi&&new qi,Zi}function Qi(t,e,n,i){C.call(this),this.abbreviation=n,this.isWeekend=i,this.name$=t,this.ordinal$=e}function tr(){tr=function(){},Gi=new Qi("MONDAY",0,"MO",!1),Hi=new Qi("TUESDAY",1,"TU",!1),Yi=new Qi("WEDNESDAY",2,"WE",!1),Vi=new Qi("THURSDAY",3,"TH",!1),Ki=new Qi("FRIDAY",4,"FR",!1),Wi=new Qi("SATURDAY",5,"SA",!0),Xi=new Qi("SUNDAY",6,"SU",!0)}function er(){return tr(),Gi}function nr(){return tr(),Hi}function ir(){return tr(),Yi}function rr(){return tr(),Vi}function or(){return tr(),Ki}function ar(){return tr(),Wi}function sr(){return tr(),Xi}function lr(){return[er(),nr(),ir(),rr(),or(),ar(),sr()]}function ur(){}function cr(){_r=this}function pr(t,e){this.closure$weekDay=t,this.closure$month=e}function hr(t,e,n){this.closure$number=t,this.closure$weekDay=e,this.closure$month=n}Fi.$metadata$={kind:$,simpleName:"Time",interfaces:[R]},Qi.$metadata$={kind:$,simpleName:"WeekDay",interfaces:[C]},Qi.values=lr,Qi.valueOf_61zpoe$=function(t){switch(t){case"MONDAY":return er();case"TUESDAY":return nr();case"WEDNESDAY":return ir();case"THURSDAY":return rr();case"FRIDAY":return or();case"SATURDAY":return ar();case"SUNDAY":return sr();default:S("No enum constant jetbrains.datalore.base.datetime.WeekDay."+t)}},ur.$metadata$={kind:H,simpleName:"DateSpec",interfaces:[]},Object.defineProperty(pr.prototype,"rRule",{configurable:!0,get:function(){return"RRULE:FREQ=YEARLY;BYDAY=-1"+this.closure$weekDay.abbreviation+";BYMONTH="+I(this.closure$month.ordinal()+1|0)}}),pr.prototype.getDate_za3lpa$=function(t){for(var e=this.closure$month.getDaysInYear_za3lpa$(t);e>=1;e--){var n=new bi(e,this.closure$month,t);if(n.weekDay===this.closure$weekDay)return n}throw j()},pr.$metadata$={kind:$,interfaces:[ur]},cr.prototype.last_kvq57g$=function(t,e){return new pr(t,e)},Object.defineProperty(hr.prototype,"rRule",{configurable:!0,get:function(){return"RRULE:FREQ=YEARLY;BYDAY="+I(this.closure$number)+this.closure$weekDay.abbreviation+";BYMONTH="+I(this.closure$month.ordinal()+1|0)}}),hr.prototype.getDate_za3lpa$=function(t){for(var n=e.imul(this.closure$number-1|0,lr().length)+1|0,i=this.closure$month.getDaysInYear_za3lpa$(t),r=n;r<=i;r++){var o=new bi(r,this.closure$month,t);if(o.weekDay===this.closure$weekDay)return o}throw j()},hr.$metadata$={kind:$,interfaces:[ur]},cr.prototype.first_t96ihi$=function(t,e,n){return void 0===n&&(n=1),new hr(n,t,e)},cr.$metadata$={kind:y,simpleName:"DateSpecs",interfaces:[]};var _r=null;function fr(){return null===_r&&new cr,_r}function dr(t){$r(),this.id=t}function mr(){yr=this,this.UTC=ra().utc(),this.BERLIN=ra().withEuSummerTime_rwkwum$("Europe/Berlin",Ri().HOUR.mul_s8cxhz$(D)),this.MOSCOW=new vr,this.NY=ra().withUsSummerTime_rwkwum$("America/New_York",Ri().HOUR.mul_s8cxhz$(Y))}dr.prototype.convertTo_8hfrhi$=function(t,e){return e===this?t:e.toDateTime_x2y23v$(this.toInstant_amwj4p$(t))},dr.prototype.convertTimeAtDay_aopdye$=function(t,e,n){var i=new Ei(e,t),r=this.convertTo_8hfrhi$(i,n),o=e.compareTo_11rb$(r.date);return 0!==o&&(i=new Ei(o>0?e.nextDate():e.prevDate(),t),r=this.convertTo_8hfrhi$(i,n)),r.time},dr.prototype.getTimeZoneShift_x2y23v$=function(t){var e=this.toDateTime_x2y23v$(t);return t.to_x2y23v$($r().UTC.toInstant_amwj4p$(e))},dr.prototype.toString=function(){return N(this.id)},mr.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var yr=null;function $r(){return null===yr&&new mr,yr}function vr(){wr(),dr.call(this,wr().ID_0),this.myOldOffset_0=Ri().HOUR.mul_s8cxhz$(V),this.myNewOffset_0=Ri().HOUR.mul_s8cxhz$(K),this.myOldTz_0=ra().offset_nf4kng$(null,this.myOldOffset_0,$r().UTC),this.myNewTz_0=ra().offset_nf4kng$(null,this.myNewOffset_0,$r().UTC),this.myOffsetChangeTime_0=new Ei(new bi(26,Ui().OCTOBER,2014),new Fi(2,0)),this.myOffsetChangeInstant_0=this.myOldTz_0.toInstant_amwj4p$(this.myOffsetChangeTime_0)}function gr(){br=this,this.ID_0="Europe/Moscow"}dr.$metadata$={kind:$,simpleName:"TimeZone",interfaces:[]},vr.prototype.toDateTime_x2y23v$=function(t){return t.compareTo_11rb$(this.myOffsetChangeInstant_0)>=0?this.myNewTz_0.toDateTime_x2y23v$(t):this.myOldTz_0.toDateTime_x2y23v$(t)},vr.prototype.toInstant_amwj4p$=function(t){return t.compareTo_11rb$(this.myOffsetChangeTime_0)>=0?this.myNewTz_0.toInstant_amwj4p$(t):this.myOldTz_0.toInstant_amwj4p$(t)},gr.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var br=null;function wr(){return null===br&&new gr,br}function xr(){ia=this,this.MILLIS_IN_SECOND_0=M,this.MILLIS_IN_MINUTE_0=W,this.MILLIS_IN_HOUR_0=X,this.MILLIS_IN_DAY_0=Z}function kr(t){dr.call(this,t)}function Er(t,e,n){this.closure$base=t,this.closure$offset=e,dr.call(this,n)}function Cr(t,e,n,i,r){this.closure$startSpec=t,this.closure$utcChangeTime=e,this.closure$endSpec=n,Tr.call(this,i,r)}function Sr(t,e,n,i,r){this.closure$startSpec=t,this.closure$offset=e,this.closure$endSpec=n,Tr.call(this,i,r)}function Tr(t,e){dr.call(this,t),this.myTz_0=ra().offset_nf4kng$(null,e,$r().UTC),this.mySummerTz_0=ra().offset_nf4kng$(null,e.add_27523k$(Ri().HOUR),$r().UTC)}vr.$metadata$={kind:$,simpleName:"TimeZoneMoscow",interfaces:[dr]},xr.prototype.toDateTime_0=function(t,e){var n=t,i=(n=n.add_27523k$(e)).timeSinceEpoch.div(this.MILLIS_IN_DAY_0).toInt(),r=ki().EPOCH.addDays_za3lpa$(i),o=n.timeSinceEpoch.modulo(this.MILLIS_IN_DAY_0);return new Ei(r,new Fi(o.div(this.MILLIS_IN_HOUR_0).toInt(),(o=o.modulo(this.MILLIS_IN_HOUR_0)).div(this.MILLIS_IN_MINUTE_0).toInt(),(o=o.modulo(this.MILLIS_IN_MINUTE_0)).div(this.MILLIS_IN_SECOND_0).toInt(),(o=o.modulo(this.MILLIS_IN_SECOND_0)).modulo(this.MILLIS_IN_SECOND_0).toInt()))},xr.prototype.toInstant_0=function(t,e){return new Ii(this.toMillis_0(t.date).add(this.toMillis_1(t.time))).sub_27523k$(e)},xr.prototype.toMillis_1=function(t){return e.Long.fromInt(t.hours).multiply(B).add(e.Long.fromInt(t.minutes)).multiply(e.Long.fromInt(60)).add(e.Long.fromInt(t.seconds)).multiply(e.Long.fromInt(1e3)).add(e.Long.fromInt(t.milliseconds))},xr.prototype.toMillis_0=function(t){return e.Long.fromInt(t.daysFrom_z9gqti$(ki().EPOCH)).multiply(this.MILLIS_IN_DAY_0)},kr.prototype.toDateTime_x2y23v$=function(t){return ra().toDateTime_0(t,new Ai(z))},kr.prototype.toInstant_amwj4p$=function(t){return ra().toInstant_0(t,new Ai(z))},kr.$metadata$={kind:$,interfaces:[dr]},xr.prototype.utc=function(){return new kr("UTC")},Er.prototype.toDateTime_x2y23v$=function(t){return this.closure$base.toDateTime_x2y23v$(t.add_27523k$(this.closure$offset))},Er.prototype.toInstant_amwj4p$=function(t){return this.closure$base.toInstant_amwj4p$(t).sub_27523k$(this.closure$offset)},Er.$metadata$={kind:$,interfaces:[dr]},xr.prototype.offset_nf4kng$=function(t,e,n){return new Er(n,e,t)},Cr.prototype.getStartInstant_za3lpa$=function(t){return $r().UTC.toInstant_amwj4p$(new Ei(this.closure$startSpec.getDate_za3lpa$(t),this.closure$utcChangeTime))},Cr.prototype.getEndInstant_za3lpa$=function(t){return $r().UTC.toInstant_amwj4p$(new Ei(this.closure$endSpec.getDate_za3lpa$(t),this.closure$utcChangeTime))},Cr.$metadata$={kind:$,interfaces:[Tr]},xr.prototype.withEuSummerTime_rwkwum$=function(t,e){var n=fr().last_kvq57g$(sr(),Ui().MARCH),i=fr().last_kvq57g$(sr(),Ui().OCTOBER);return new Cr(n,new Fi(1,0),i,t,e)},Sr.prototype.getStartInstant_za3lpa$=function(t){return $r().UTC.toInstant_amwj4p$(new Ei(this.closure$startSpec.getDate_za3lpa$(t),new Fi(2,0))).sub_27523k$(this.closure$offset)},Sr.prototype.getEndInstant_za3lpa$=function(t){return $r().UTC.toInstant_amwj4p$(new Ei(this.closure$endSpec.getDate_za3lpa$(t),new Fi(2,0))).sub_27523k$(this.closure$offset.add_27523k$(Ri().HOUR))},Sr.$metadata$={kind:$,interfaces:[Tr]},xr.prototype.withUsSummerTime_rwkwum$=function(t,e){return new Sr(fr().first_t96ihi$(sr(),Ui().MARCH,2),e,fr().first_t96ihi$(sr(),Ui().NOVEMBER),t,e)},Tr.prototype.toDateTime_x2y23v$=function(t){var e=this.myTz_0.toDateTime_x2y23v$(t),n=this.getStartInstant_za3lpa$(e.year),i=this.getEndInstant_za3lpa$(e.year);return t.compareTo_11rb$(n)>0&&t.compareTo_11rb$(i)<0?this.mySummerTz_0.toDateTime_x2y23v$(t):e},Tr.prototype.toInstant_amwj4p$=function(t){var e=this.toDateTime_x2y23v$(this.getStartInstant_za3lpa$(t.year)),n=this.toDateTime_x2y23v$(this.getEndInstant_za3lpa$(t.year));return t.compareTo_11rb$(e)>0&&t.compareTo_11rb$(n)<0?this.mySummerTz_0.toInstant_amwj4p$(t):this.myTz_0.toInstant_amwj4p$(t)},Tr.$metadata$={kind:$,simpleName:"DSTimeZone",interfaces:[dr]},xr.$metadata$={kind:y,simpleName:"TimeZones",interfaces:[]};var Or,Nr,Pr,Ar,jr,Lr,Rr,Ir,zr,Dr,Mr,Br,Ur,Fr,qr,Gr,Hr,Yr,Vr,Kr,Wr,Xr,Zr,Jr,Qr,to,eo,no,io,ro,oo,ao,so,lo,uo,co,po,ho,_o,fo,mo,yo,$o,vo,go,bo,wo,xo,ko,Eo,Co,So,To,Oo,No,Po,Ao,jo,Lo,Ro,Io,zo,Do,Mo,Bo,Uo,Fo,qo,Go,Ho,Yo,Vo,Ko,Wo,Xo,Zo,Jo,Qo,ta,ea,na,ia=null;function ra(){return null===ia&&new xr,ia}function oa(){}function aa(t){var e;this.myNormalizedValueMap_0=null,this.myOriginalNames_0=null;var n=t.length,i=tt(n),r=h(n);for(e=0;e!==t.length;++e){var o=t[e],a=o.toString();r.add_11rb$(a);var s=this.toNormalizedName_0(a),l=i.put_xwzc9p$(s,o);if(null!=l)throw v("duplicate values: '"+o+"', '"+I(l)+"'")}this.myOriginalNames_0=r,this.myNormalizedValueMap_0=i}function sa(t,e){C.call(this),this.name$=t,this.ordinal$=e}function la(){la=function(){},Or=new sa("NONE",0),Nr=new sa("LEFT",1),Pr=new sa("MIDDLE",2),Ar=new sa("RIGHT",3)}function ua(){return la(),Or}function ca(){return la(),Nr}function pa(){return la(),Pr}function ha(){return la(),Ar}function _a(){this.eventContext_qzl3re$_d6nbbo$_0=null,this.isConsumed_gb68t5$_0=!1}function fa(t,e,n){C.call(this),this.myValue_n4kdnj$_0=n,this.name$=t,this.ordinal$=e}function da(){da=function(){},jr=new fa("A",0,"A"),Lr=new fa("B",1,"B"),Rr=new fa("C",2,"C"),Ir=new fa("D",3,"D"),zr=new fa("E",4,"E"),Dr=new fa("F",5,"F"),Mr=new fa("G",6,"G"),Br=new fa("H",7,"H"),Ur=new fa("I",8,"I"),Fr=new fa("J",9,"J"),qr=new fa("K",10,"K"),Gr=new fa("L",11,"L"),Hr=new fa("M",12,"M"),Yr=new fa("N",13,"N"),Vr=new fa("O",14,"O"),Kr=new fa("P",15,"P"),Wr=new fa("Q",16,"Q"),Xr=new fa("R",17,"R"),Zr=new fa("S",18,"S"),Jr=new fa("T",19,"T"),Qr=new fa("U",20,"U"),to=new fa("V",21,"V"),eo=new fa("W",22,"W"),no=new fa("X",23,"X"),io=new fa("Y",24,"Y"),ro=new fa("Z",25,"Z"),oo=new fa("DIGIT_0",26,"0"),ao=new fa("DIGIT_1",27,"1"),so=new fa("DIGIT_2",28,"2"),lo=new fa("DIGIT_3",29,"3"),uo=new fa("DIGIT_4",30,"4"),co=new fa("DIGIT_5",31,"5"),po=new fa("DIGIT_6",32,"6"),ho=new fa("DIGIT_7",33,"7"),_o=new fa("DIGIT_8",34,"8"),fo=new fa("DIGIT_9",35,"9"),mo=new fa("LEFT_BRACE",36,"["),yo=new fa("RIGHT_BRACE",37,"]"),$o=new fa("UP",38,"Up"),vo=new fa("DOWN",39,"Down"),go=new fa("LEFT",40,"Left"),bo=new fa("RIGHT",41,"Right"),wo=new fa("PAGE_UP",42,"Page Up"),xo=new fa("PAGE_DOWN",43,"Page Down"),ko=new fa("ESCAPE",44,"Escape"),Eo=new fa("ENTER",45,"Enter"),Co=new fa("HOME",46,"Home"),So=new fa("END",47,"End"),To=new fa("TAB",48,"Tab"),Oo=new fa("SPACE",49,"Space"),No=new fa("INSERT",50,"Insert"),Po=new fa("DELETE",51,"Delete"),Ao=new fa("BACKSPACE",52,"Backspace"),jo=new fa("EQUALS",53,"Equals"),Lo=new fa("BACK_QUOTE",54,"`"),Ro=new fa("PLUS",55,"Plus"),Io=new fa("MINUS",56,"Minus"),zo=new fa("SLASH",57,"Slash"),Do=new fa("CONTROL",58,"Ctrl"),Mo=new fa("META",59,"Meta"),Bo=new fa("ALT",60,"Alt"),Uo=new fa("SHIFT",61,"Shift"),Fo=new fa("UNKNOWN",62,"?"),qo=new fa("F1",63,"F1"),Go=new fa("F2",64,"F2"),Ho=new fa("F3",65,"F3"),Yo=new fa("F4",66,"F4"),Vo=new fa("F5",67,"F5"),Ko=new fa("F6",68,"F6"),Wo=new fa("F7",69,"F7"),Xo=new fa("F8",70,"F8"),Zo=new fa("F9",71,"F9"),Jo=new fa("F10",72,"F10"),Qo=new fa("F11",73,"F11"),ta=new fa("F12",74,"F12"),ea=new fa("COMMA",75,","),na=new fa("PERIOD",76,".")}function ma(){return da(),jr}function ya(){return da(),Lr}function $a(){return da(),Rr}function va(){return da(),Ir}function ga(){return da(),zr}function ba(){return da(),Dr}function wa(){return da(),Mr}function xa(){return da(),Br}function ka(){return da(),Ur}function Ea(){return da(),Fr}function Ca(){return da(),qr}function Sa(){return da(),Gr}function Ta(){return da(),Hr}function Oa(){return da(),Yr}function Na(){return da(),Vr}function Pa(){return da(),Kr}function Aa(){return da(),Wr}function ja(){return da(),Xr}function La(){return da(),Zr}function Ra(){return da(),Jr}function Ia(){return da(),Qr}function za(){return da(),to}function Da(){return da(),eo}function Ma(){return da(),no}function Ba(){return da(),io}function Ua(){return da(),ro}function Fa(){return da(),oo}function qa(){return da(),ao}function Ga(){return da(),so}function Ha(){return da(),lo}function Ya(){return da(),uo}function Va(){return da(),co}function Ka(){return da(),po}function Wa(){return da(),ho}function Xa(){return da(),_o}function Za(){return da(),fo}function Ja(){return da(),mo}function Qa(){return da(),yo}function ts(){return da(),$o}function es(){return da(),vo}function ns(){return da(),go}function is(){return da(),bo}function rs(){return da(),wo}function os(){return da(),xo}function as(){return da(),ko}function ss(){return da(),Eo}function ls(){return da(),Co}function us(){return da(),So}function cs(){return da(),To}function ps(){return da(),Oo}function hs(){return da(),No}function _s(){return da(),Po}function fs(){return da(),Ao}function ds(){return da(),jo}function ms(){return da(),Lo}function ys(){return da(),Ro}function $s(){return da(),Io}function vs(){return da(),zo}function gs(){return da(),Do}function bs(){return da(),Mo}function ws(){return da(),Bo}function xs(){return da(),Uo}function ks(){return da(),Fo}function Es(){return da(),qo}function Cs(){return da(),Go}function Ss(){return da(),Ho}function Ts(){return da(),Yo}function Os(){return da(),Vo}function Ns(){return da(),Ko}function Ps(){return da(),Wo}function As(){return da(),Xo}function js(){return da(),Zo}function Ls(){return da(),Jo}function Rs(){return da(),Qo}function Is(){return da(),ta}function zs(){return da(),ea}function Ds(){return da(),na}function Ms(){this.keyStroke=null,this.keyChar=null}function Bs(t,e,n,i){return i=i||Object.create(Ms.prototype),_a.call(i),Ms.call(i),i.keyStroke=Vs(t,n),i.keyChar=e,i}function Us(t,e,n,i){Gs(),this.isCtrl=t,this.isAlt=e,this.isShift=n,this.isMeta=i}function Fs(){var t;qs=this,this.EMPTY_MODIFIERS_0=(t=t||Object.create(Us.prototype),Us.call(t,!1,!1,!1,!1),t)}oa.$metadata$={kind:H,simpleName:"EnumInfo",interfaces:[]},Object.defineProperty(aa.prototype,"originalNames",{configurable:!0,get:function(){return this.myOriginalNames_0}}),aa.prototype.toNormalizedName_0=function(t){return t.toUpperCase()},aa.prototype.safeValueOf_7po0m$=function(t,e){var n=this.safeValueOf_pdl1vj$(t);return null!=n?n:e},aa.prototype.safeValueOf_pdl1vj$=function(t){return this.hasValue_pdl1vj$(t)?this.myNormalizedValueMap_0.get_11rb$(this.toNormalizedName_0(N(t))):null},aa.prototype.hasValue_pdl1vj$=function(t){return null!=t&&this.myNormalizedValueMap_0.containsKey_11rb$(this.toNormalizedName_0(t))},aa.prototype.unsafeValueOf_61zpoe$=function(t){var e;if(null==(e=this.safeValueOf_pdl1vj$(t)))throw v("name not found: '"+t+"'");return e},aa.$metadata$={kind:$,simpleName:"EnumInfoImpl",interfaces:[oa]},sa.$metadata$={kind:$,simpleName:"Button",interfaces:[C]},sa.values=function(){return[ua(),ca(),pa(),ha()]},sa.valueOf_61zpoe$=function(t){switch(t){case"NONE":return ua();case"LEFT":return ca();case"MIDDLE":return pa();case"RIGHT":return ha();default:S("No enum constant jetbrains.datalore.base.event.Button."+t)}},Object.defineProperty(_a.prototype,"eventContext_qzl3re$_0",{configurable:!0,get:function(){return this.eventContext_qzl3re$_d6nbbo$_0},set:function(t){if(null!=this.eventContext_qzl3re$_0)throw _("Already set "+I(N(this.eventContext_qzl3re$_0)));if(this.isConsumed)throw _("Can't set a context to the consumed event");if(null==t)throw v("Can't set null context");this.eventContext_qzl3re$_d6nbbo$_0=t}}),Object.defineProperty(_a.prototype,"isConsumed",{configurable:!0,get:function(){return this.isConsumed_gb68t5$_0},set:function(t){this.isConsumed_gb68t5$_0=t}}),_a.prototype.consume=function(){this.doConsume_smptag$_0()},_a.prototype.doConsume_smptag$_0=function(){if(this.isConsumed)throw et();this.isConsumed=!0},_a.prototype.ensureConsumed=function(){this.isConsumed||this.consume()},_a.$metadata$={kind:$,simpleName:"Event",interfaces:[]},fa.prototype.toString=function(){return this.myValue_n4kdnj$_0},fa.$metadata$={kind:$,simpleName:"Key",interfaces:[C]},fa.values=function(){return[ma(),ya(),$a(),va(),ga(),ba(),wa(),xa(),ka(),Ea(),Ca(),Sa(),Ta(),Oa(),Na(),Pa(),Aa(),ja(),La(),Ra(),Ia(),za(),Da(),Ma(),Ba(),Ua(),Fa(),qa(),Ga(),Ha(),Ya(),Va(),Ka(),Wa(),Xa(),Za(),Ja(),Qa(),ts(),es(),ns(),is(),rs(),os(),as(),ss(),ls(),us(),cs(),ps(),hs(),_s(),fs(),ds(),ms(),ys(),$s(),vs(),gs(),bs(),ws(),xs(),ks(),Es(),Cs(),Ss(),Ts(),Os(),Ns(),Ps(),As(),js(),Ls(),Rs(),Is(),zs(),Ds()]},fa.valueOf_61zpoe$=function(t){switch(t){case"A":return ma();case"B":return ya();case"C":return $a();case"D":return va();case"E":return ga();case"F":return ba();case"G":return wa();case"H":return xa();case"I":return ka();case"J":return Ea();case"K":return Ca();case"L":return Sa();case"M":return Ta();case"N":return Oa();case"O":return Na();case"P":return Pa();case"Q":return Aa();case"R":return ja();case"S":return La();case"T":return Ra();case"U":return Ia();case"V":return za();case"W":return Da();case"X":return Ma();case"Y":return Ba();case"Z":return Ua();case"DIGIT_0":return Fa();case"DIGIT_1":return qa();case"DIGIT_2":return Ga();case"DIGIT_3":return Ha();case"DIGIT_4":return Ya();case"DIGIT_5":return Va();case"DIGIT_6":return Ka();case"DIGIT_7":return Wa();case"DIGIT_8":return Xa();case"DIGIT_9":return Za();case"LEFT_BRACE":return Ja();case"RIGHT_BRACE":return Qa();case"UP":return ts();case"DOWN":return es();case"LEFT":return ns();case"RIGHT":return is();case"PAGE_UP":return rs();case"PAGE_DOWN":return os();case"ESCAPE":return as();case"ENTER":return ss();case"HOME":return ls();case"END":return us();case"TAB":return cs();case"SPACE":return ps();case"INSERT":return hs();case"DELETE":return _s();case"BACKSPACE":return fs();case"EQUALS":return ds();case"BACK_QUOTE":return ms();case"PLUS":return ys();case"MINUS":return $s();case"SLASH":return vs();case"CONTROL":return gs();case"META":return bs();case"ALT":return ws();case"SHIFT":return xs();case"UNKNOWN":return ks();case"F1":return Es();case"F2":return Cs();case"F3":return Ss();case"F4":return Ts();case"F5":return Os();case"F6":return Ns();case"F7":return Ps();case"F8":return As();case"F9":return js();case"F10":return Ls();case"F11":return Rs();case"F12":return Is();case"COMMA":return zs();case"PERIOD":return Ds();default:S("No enum constant jetbrains.datalore.base.event.Key."+t)}},Object.defineProperty(Ms.prototype,"key",{configurable:!0,get:function(){return this.keyStroke.key}}),Object.defineProperty(Ms.prototype,"modifiers",{configurable:!0,get:function(){return this.keyStroke.modifiers}}),Ms.prototype.is_ji7i3y$=function(t,e){return this.keyStroke.is_ji7i3y$(t,e.slice())},Ms.prototype.is_c4rqdo$=function(t){var e;for(e=0;e!==t.length;++e)if(t[e].matches_l9pgtg$(this.keyStroke))return!0;return!1},Ms.prototype.is_4t3vif$=function(t){var e;for(e=0;e!==t.length;++e)if(t[e].matches_l9pgtg$(this.keyStroke))return!0;return!1},Ms.prototype.has_hny0b7$=function(t){return this.keyStroke.has_hny0b7$(t)},Ms.prototype.copy=function(){return Bs(this.key,nt(this.keyChar),this.modifiers)},Ms.prototype.toString=function(){return this.keyStroke.toString()},Ms.$metadata$={kind:$,simpleName:"KeyEvent",interfaces:[_a]},Fs.prototype.emptyModifiers=function(){return this.EMPTY_MODIFIERS_0},Fs.prototype.withShift=function(){return new Us(!1,!1,!0,!1)},Fs.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var qs=null;function Gs(){return null===qs&&new Fs,qs}function Hs(){this.key=null,this.modifiers=null}function Ys(t,e,n){return n=n||Object.create(Hs.prototype),Vs(t,at(e),n),n}function Vs(t,e,n){return n=n||Object.create(Hs.prototype),Hs.call(n),n.key=t,n.modifiers=ot(e),n}function Ks(){this.myKeyStrokes_0=null}function Ws(t,e,n){return n=n||Object.create(Ks.prototype),Ks.call(n),n.myKeyStrokes_0=[Ys(t,e.slice())],n}function Xs(t,e){return e=e||Object.create(Ks.prototype),Ks.call(e),e.myKeyStrokes_0=lt(t),e}function Zs(t,e){return e=e||Object.create(Ks.prototype),Ks.call(e),e.myKeyStrokes_0=t.slice(),e}function Js(){il=this,this.COPY=this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$($a(),[]),Ws(hs(),[al()])]),this.CUT=this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Ma(),[]),Ws(_s(),[ll()])]),this.PASTE=this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(za(),[]),Ws(hs(),[ll()])]),this.UNDO=this.ctrlOrMeta_ji7i3y$(Ua(),[]),this.REDO=this.UNDO.with_hny0b7$(ll()),this.COMPLETE=Ws(ps(),[al()]),this.SHOW_DOC=this.composite_c4rqdo$([Ws(Es(),[]),this.ctrlOrMeta_ji7i3y$(Ea(),[])]),this.HELP=this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(ka(),[]),this.ctrlOrMeta_ji7i3y$(Es(),[])]),this.HOME=this.composite_4t3vif$([Ys(ls(),[]),Ys(ns(),[ul()])]),this.END=this.composite_4t3vif$([Ys(us(),[]),Ys(is(),[ul()])]),this.FILE_HOME=this.ctrlOrMeta_ji7i3y$(ls(),[]),this.FILE_END=this.ctrlOrMeta_ji7i3y$(us(),[]),this.PREV_WORD=this.ctrlOrAlt_ji7i3y$(ns(),[]),this.NEXT_WORD=this.ctrlOrAlt_ji7i3y$(is(),[]),this.NEXT_EDITABLE=this.ctrlOrMeta_ji7i3y$(is(),[sl()]),this.PREV_EDITABLE=this.ctrlOrMeta_ji7i3y$(ns(),[sl()]),this.SELECT_ALL=this.ctrlOrMeta_ji7i3y$(ma(),[]),this.SELECT_FILE_HOME=this.FILE_HOME.with_hny0b7$(ll()),this.SELECT_FILE_END=this.FILE_END.with_hny0b7$(ll()),this.SELECT_HOME=this.HOME.with_hny0b7$(ll()),this.SELECT_END=this.END.with_hny0b7$(ll()),this.SELECT_WORD_FORWARD=this.NEXT_WORD.with_hny0b7$(ll()),this.SELECT_WORD_BACKWARD=this.PREV_WORD.with_hny0b7$(ll()),this.SELECT_LEFT=Ws(ns(),[ll()]),this.SELECT_RIGHT=Ws(is(),[ll()]),this.SELECT_UP=Ws(ts(),[ll()]),this.SELECT_DOWN=Ws(es(),[ll()]),this.INCREASE_SELECTION=Ws(ts(),[sl()]),this.DECREASE_SELECTION=Ws(es(),[sl()]),this.INSERT_BEFORE=this.composite_4t3vif$([Vs(ss(),this.add_0(ul(),[])),Ys(hs(),[]),Vs(ss(),this.add_0(al(),[]))]),this.INSERT_AFTER=Ws(ss(),[]),this.INSERT=this.composite_c4rqdo$([this.INSERT_BEFORE,this.INSERT_AFTER]),this.DUPLICATE=this.ctrlOrMeta_ji7i3y$(va(),[]),this.DELETE_CURRENT=this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(fs(),[]),this.ctrlOrMeta_ji7i3y$(_s(),[])]),this.DELETE_TO_WORD_START=Ws(fs(),[sl()]),this.MATCHING_CONSTRUCTS=this.composite_c4rqdo$([this.ctrlOrMeta_ji7i3y$(Ja(),[sl()]),this.ctrlOrMeta_ji7i3y$(Qa(),[sl()])]),this.NAVIGATE=this.ctrlOrMeta_ji7i3y$(ya(),[]),this.NAVIGATE_BACK=this.ctrlOrMeta_ji7i3y$(Ja(),[]),this.NAVIGATE_FORWARD=this.ctrlOrMeta_ji7i3y$(Qa(),[])}Us.$metadata$={kind:$,simpleName:"KeyModifiers",interfaces:[]},Hs.prototype.has_hny0b7$=function(t){return this.modifiers.contains_11rb$(t)},Hs.prototype.is_ji7i3y$=function(t,e){return this.matches_l9pgtg$(Ys(t,e.slice()))},Hs.prototype.matches_l9pgtg$=function(t){return this.equals(t)},Hs.prototype.with_hny0b7$=function(t){var e=ot(this.modifiers);return e.add_11rb$(t),Vs(this.key,e)},Hs.prototype.hashCode=function(){return(31*this.key.hashCode()|0)+P(this.modifiers)|0},Hs.prototype.equals=function(t){var n;if(!e.isType(t,Hs))return!1;var i=null==(n=t)||e.isType(n,Hs)?n:E();return this.key===N(i).key&&l(this.modifiers,N(i).modifiers)},Hs.prototype.toString=function(){return this.key.toString()+" "+this.modifiers},Hs.$metadata$={kind:$,simpleName:"KeyStroke",interfaces:[]},Object.defineProperty(Ks.prototype,"keyStrokes",{configurable:!0,get:function(){return st(this.myKeyStrokes_0.slice())}}),Object.defineProperty(Ks.prototype,"isEmpty",{configurable:!0,get:function(){return 0===this.myKeyStrokes_0.length}}),Ks.prototype.matches_l9pgtg$=function(t){var e,n;for(e=this.myKeyStrokes_0,n=0;n!==e.length;++n)if(e[n].matches_l9pgtg$(t))return!0;return!1},Ks.prototype.with_hny0b7$=function(t){var e,n,i=u();for(e=this.myKeyStrokes_0,n=0;n!==e.length;++n){var r=e[n];i.add_11rb$(r.with_hny0b7$(t))}return Xs(i)},Ks.prototype.equals=function(t){var n,i;if(this===t)return!0;if(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))return!1;var r=null==(i=t)||e.isType(i,Ks)?i:E();return l(this.keyStrokes,N(r).keyStrokes)},Ks.prototype.hashCode=function(){return P(this.keyStrokes)},Ks.prototype.toString=function(){return this.keyStrokes.toString()},Ks.$metadata$={kind:$,simpleName:"KeyStrokeSpec",interfaces:[]},Js.prototype.ctrlOrMeta_ji7i3y$=function(t,e){return this.composite_4t3vif$([Vs(t,this.add_0(al(),e.slice())),Vs(t,this.add_0(ul(),e.slice()))])},Js.prototype.ctrlOrAlt_ji7i3y$=function(t,e){return this.composite_4t3vif$([Vs(t,this.add_0(al(),e.slice())),Vs(t,this.add_0(sl(),e.slice()))])},Js.prototype.add_0=function(t,e){var n=ot(at(e));return n.add_11rb$(t),n},Js.prototype.composite_c4rqdo$=function(t){var e,n,i=ut();for(e=0;e!==t.length;++e)for(n=t[e].keyStrokes.iterator();n.hasNext();){var r=n.next();i.add_11rb$(r)}return Xs(i)},Js.prototype.composite_4t3vif$=function(t){return Zs(t.slice())},Js.prototype.withoutShift_b0jlop$=function(t){var e,n=t.keyStrokes.iterator().next(),i=n.modifiers,r=ut();for(e=i.iterator();e.hasNext();){var o=e.next();o!==ll()&&r.add_11rb$(o)}return Bs(n.key,it(0),r)},Js.$metadata$={kind:y,simpleName:"KeyStrokeSpecs",interfaces:[]};var Qs,tl,el,nl,il=null;function rl(t,e){C.call(this),this.name$=t,this.ordinal$=e}function ol(){ol=function(){},Qs=new rl("CONTROL",0),tl=new rl("ALT",1),el=new rl("SHIFT",2),nl=new rl("META",3)}function al(){return ol(),Qs}function sl(){return ol(),tl}function ll(){return ol(),el}function ul(){return ol(),nl}function cl(t,e,n,i){if(bl(),Ll.call(this,t,e),this.button=n,this.modifiers=i,null==this.button)throw v("Null button".toString())}function pl(){gl=this}rl.$metadata$={kind:$,simpleName:"ModifierKey",interfaces:[C]},rl.values=function(){return[al(),sl(),ll(),ul()]},rl.valueOf_61zpoe$=function(t){switch(t){case"CONTROL":return al();case"ALT":return sl();case"SHIFT":return ll();case"META":return ul();default:S("No enum constant jetbrains.datalore.base.event.ModifierKey."+t)}},pl.prototype.noButton_119tl4$=function(t){return wl(t,ua(),Gs().emptyModifiers())},pl.prototype.leftButton_119tl4$=function(t){return wl(t,ca(),Gs().emptyModifiers())},pl.prototype.middleButton_119tl4$=function(t){return wl(t,pa(),Gs().emptyModifiers())},pl.prototype.rightButton_119tl4$=function(t){return wl(t,ha(),Gs().emptyModifiers())},pl.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var hl,_l,fl,dl,ml,yl,$l,vl,gl=null;function bl(){return null===gl&&new pl,gl}function wl(t,e,n,i){return i=i||Object.create(cl.prototype),cl.call(i,t.x,t.y,e,n),i}function xl(){}function kl(t,e){C.call(this),this.name$=t,this.ordinal$=e}function El(){El=function(){},hl=new kl("MOUSE_ENTERED",0),_l=new kl("MOUSE_LEFT",1),fl=new kl("MOUSE_MOVED",2),dl=new kl("MOUSE_DRAGGED",3),ml=new kl("MOUSE_CLICKED",4),yl=new kl("MOUSE_DOUBLE_CLICKED",5),$l=new kl("MOUSE_PRESSED",6),vl=new kl("MOUSE_RELEASED",7)}function Cl(){return El(),hl}function Sl(){return El(),_l}function Tl(){return El(),fl}function Ol(){return El(),dl}function Nl(){return El(),ml}function Pl(){return El(),yl}function Al(){return El(),$l}function jl(){return El(),vl}function Ll(t,e){_a.call(this),this.x=t,this.y=e}function Rl(){}function Il(){Hl=this,this.TRUE_PREDICATE_0=Ul,this.FALSE_PREDICATE_0=Fl,this.NULL_PREDICATE_0=ql,this.NOT_NULL_PREDICATE_0=Gl}function zl(t){this.closure$value=t}function Dl(t){return t}function Ml(t){this.closure$lambda=t}function Bl(t){this.mySupplier_0=t,this.myCachedValue_0=null,this.myCached_0=!1}function Ul(t){return!0}function Fl(t){return!1}function ql(t){return null==t}function Gl(t){return null!=t}cl.$metadata$={kind:$,simpleName:"MouseEvent",interfaces:[Ll]},xl.$metadata$={kind:H,simpleName:"MouseEventSource",interfaces:[]},kl.$metadata$={kind:$,simpleName:"MouseEventSpec",interfaces:[C]},kl.values=function(){return[Cl(),Sl(),Tl(),Ol(),Nl(),Pl(),Al(),jl()]},kl.valueOf_61zpoe$=function(t){switch(t){case"MOUSE_ENTERED":return Cl();case"MOUSE_LEFT":return Sl();case"MOUSE_MOVED":return Tl();case"MOUSE_DRAGGED":return Ol();case"MOUSE_CLICKED":return Nl();case"MOUSE_DOUBLE_CLICKED":return Pl();case"MOUSE_PRESSED":return Al();case"MOUSE_RELEASED":return jl();default:S("No enum constant jetbrains.datalore.base.event.MouseEventSpec."+t)}},Object.defineProperty(Ll.prototype,"location",{configurable:!0,get:function(){return new Iu(this.x,this.y)}}),Ll.prototype.toString=function(){return"{x="+this.x+",y="+this.y+"}"},Ll.$metadata$={kind:$,simpleName:"PointEvent",interfaces:[_a]},Rl.$metadata$={kind:H,simpleName:"Function",interfaces:[]},zl.prototype.get=function(){return this.closure$value},zl.$metadata$={kind:$,interfaces:[Vl]},Il.prototype.constantSupplier_mh5how$=function(t){return new zl(t)},Il.prototype.memorize_kji2v1$=function(t){return new Bl(t)},Il.prototype.alwaysTrue_287e2$=function(){return this.TRUE_PREDICATE_0},Il.prototype.alwaysFalse_287e2$=function(){return this.FALSE_PREDICATE_0},Il.prototype.constant_jkq9vw$=function(t){return e=t,function(t){return e};var e},Il.prototype.isNull_287e2$=function(){return this.NULL_PREDICATE_0},Il.prototype.isNotNull_287e2$=function(){return this.NOT_NULL_PREDICATE_0},Il.prototype.identity_287e2$=function(){return Dl},Il.prototype.same_tpy1pm$=function(t){return e=t,function(t){return t===e};var e},Ml.prototype.apply_11rb$=function(t){return this.closure$lambda(t)},Ml.$metadata$={kind:$,interfaces:[Rl]},Il.prototype.funcOf_7h29gk$=function(t){return new Ml(t)},Bl.prototype.get=function(){return this.myCached_0||(this.myCachedValue_0=this.mySupplier_0.get(),this.myCached_0=!0),N(this.myCachedValue_0)},Bl.$metadata$={kind:$,simpleName:"Memo",interfaces:[Vl]},Il.$metadata$={kind:y,simpleName:"Functions",interfaces:[]};var Hl=null;function Yl(){}function Vl(){}function Kl(t){this.myValue_0=t}function Wl(){Xl=this}Yl.$metadata$={kind:H,simpleName:"Runnable",interfaces:[]},Vl.$metadata$={kind:H,simpleName:"Supplier",interfaces:[]},Kl.prototype.get=function(){return this.myValue_0},Kl.prototype.set_11rb$=function(t){this.myValue_0=t},Kl.prototype.toString=function(){return""+I(this.myValue_0)},Kl.$metadata$={kind:$,simpleName:"Value",interfaces:[Vl]},Wl.prototype.isNullOrEmpty_pdl1vj$=function(t){var e=null==t;return e||(e=0===t.length),e},Wl.prototype.nullToEmpty_pdl1vj$=function(t){return null!=t?t:""},Wl.prototype.repeat_bm4lxs$=function(t,e){for(var n=A(),i=0;i=0?t:n},iu.prototype.lse_sdesaw$=function(t,n){return e.compareTo(t,n)<=0},iu.prototype.gte_sdesaw$=function(t,n){return e.compareTo(t,n)>=0},iu.prototype.ls_sdesaw$=function(t,n){return e.compareTo(t,n)<0},iu.prototype.gt_sdesaw$=function(t,n){return e.compareTo(t,n)>0},iu.$metadata$={kind:y,simpleName:"Comparables",interfaces:[]};var ru=null;function ou(){return null===ru&&new iu,ru}function au(t){hu.call(this),this.myComparator_0=t}function su(){lu=this}au.prototype.compare=function(t,e){return this.myComparator_0.compare(t,e)},au.$metadata$={kind:$,simpleName:"ComparatorOrdering",interfaces:[hu]},su.prototype.checkNonNegative_0=function(t){if(t<0)throw new _t(t.toString())},su.prototype.toList_yl67zr$=function(t){return ft(t)},su.prototype.size_fakr2g$=function(t){return dt(t)},su.prototype.isEmpty_fakr2g$=function(t){var n,i,r;return null!=(r=null!=(i=e.isType(n=t,mt)?n:null)?i.isEmpty():null)?r:!t.iterator().hasNext()},su.prototype.filter_fpit1u$=function(t,e){var n,i=u();for(n=t.iterator();n.hasNext();){var r=n.next();e(r)&&i.add_11rb$(r)}return i},su.prototype.all_fpit1u$=function(t,n){var i;t:do{var r;if(e.isType(t,mt)&&t.isEmpty()){i=!0;break t}for(r=t.iterator();r.hasNext();)if(!n(r.next())){i=!1;break t}i=!0}while(0);return i},su.prototype.concat_yxozss$=function(t,e){return yt(t,e)},su.prototype.get_7iig3d$=function(t,n){var i;if(this.checkNonNegative_0(n),e.isType(t,$t))return(e.isType(i=t,$t)?i:E()).get_za3lpa$(n);for(var r=t.iterator(),o=0;o<=n;o++){if(o===n)return r.next();r.next()}throw new _t(n.toString())},su.prototype.get_dhabsj$=function(t,n,i){var r;if(this.checkNonNegative_0(n),e.isType(t,$t)){var o=e.isType(r=t,$t)?r:E();return n0)return!1;n=i}return!0},_u.prototype.compare=function(t,e){return this.this$Ordering.compare(t,e)},_u.$metadata$={kind:$,interfaces:[wt]},hu.prototype.sortedCopy_m5x2f4$=function(t){var n,i=e.isArray(n=uu().toArray_hjktyj$(t))?n:E();return xt(i,new _u(this)),kt(i)},hu.prototype.reverse=function(){return new au(Et(this))},hu.prototype.min_t5quzl$=function(t,e){return this.compare(t,e)<=0?t:e},hu.prototype.min_m5x2f4$=function(t){return this.min_x5a2gs$(t.iterator())},hu.prototype.min_x5a2gs$=function(t){for(var e=t.next();t.hasNext();)e=this.min_t5quzl$(e,t.next());return e},hu.prototype.max_t5quzl$=function(t,e){return this.compare(t,e)>=0?t:e},hu.prototype.max_m5x2f4$=function(t){return this.max_x5a2gs$(t.iterator())},hu.prototype.max_x5a2gs$=function(t){for(var e=t.next();t.hasNext();)e=this.max_t5quzl$(e,t.next());return e},fu.prototype.from_iajr8b$=function(t){var n;return e.isType(t,hu)?e.isType(n=t,hu)?n:E():new au(t)},fu.prototype.natural_dahdeg$=function(){return new au(Ct())},fu.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var du=null;function mu(){return null===du&&new fu,du}function yu(){$u=this}hu.$metadata$={kind:$,simpleName:"Ordering",interfaces:[wt]},yu.prototype.newHashSet_yl67zr$=function(t){var n;if(e.isType(t,mt)){var i=e.isType(n=t,mt)?n:E();return ot(i)}return this.newHashSet_0(t.iterator())},yu.prototype.newHashSet_0=function(t){for(var e=ut();t.hasNext();)e.add_11rb$(t.next());return e},yu.$metadata$={kind:y,simpleName:"Sets",interfaces:[]};var $u=null;function vu(){this.elements_0=u()}function gu(){this.sortedKeys_0=u(),this.map_0=Ot()}function bu(t,e){ku(),this.origin=t,this.dimension=e}function wu(){xu=this}vu.prototype.empty=function(){return this.elements_0.isEmpty()},vu.prototype.push_11rb$=function(t){return this.elements_0.add_11rb$(t)},vu.prototype.pop=function(){return this.elements_0.isEmpty()?null:this.elements_0.removeAt_za3lpa$(this.elements_0.size-1|0)},vu.prototype.peek=function(){return St(this.elements_0)},vu.$metadata$={kind:$,simpleName:"Stack",interfaces:[]},Object.defineProperty(gu.prototype,"values",{configurable:!0,get:function(){return this.map_0.values}}),gu.prototype.get_mef7kx$=function(t){return this.map_0.get_11rb$(t)},gu.prototype.put_ncwa5f$=function(t,e){var n=Tt(this.sortedKeys_0,t);return n<0?this.sortedKeys_0.add_wxm5ur$(~n,t):this.sortedKeys_0.set_wxm5ur$(n,t),this.map_0.put_xwzc9p$(t,e)},gu.prototype.containsKey_mef7kx$=function(t){return this.map_0.containsKey_11rb$(t)},gu.prototype.floorKey_mef7kx$=function(t){var e=Tt(this.sortedKeys_0,t);return e<0&&(e=~e-1|0)<0?null:this.sortedKeys_0.get_za3lpa$(e)},gu.prototype.ceilingKey_mef7kx$=function(t){var e=Tt(this.sortedKeys_0,t);return e<0&&(e=~e)===this.sortedKeys_0.size?null:this.sortedKeys_0.get_za3lpa$(e)},gu.$metadata$={kind:$,simpleName:"TreeMap",interfaces:[]},Object.defineProperty(bu.prototype,"center",{configurable:!0,get:function(){return this.origin.add_gpjtzr$(this.dimension.mul_14dthe$(.5))}}),Object.defineProperty(bu.prototype,"left",{configurable:!0,get:function(){return this.origin.x}}),Object.defineProperty(bu.prototype,"right",{configurable:!0,get:function(){return this.origin.x+this.dimension.x}}),Object.defineProperty(bu.prototype,"top",{configurable:!0,get:function(){return this.origin.y}}),Object.defineProperty(bu.prototype,"bottom",{configurable:!0,get:function(){return this.origin.y+this.dimension.y}}),Object.defineProperty(bu.prototype,"width",{configurable:!0,get:function(){return this.dimension.x}}),Object.defineProperty(bu.prototype,"height",{configurable:!0,get:function(){return this.dimension.y}}),Object.defineProperty(bu.prototype,"parts",{configurable:!0,get:function(){var t=u();return t.add_11rb$(new Ou(this.origin,this.origin.add_gpjtzr$(new Nu(this.dimension.x,0)))),t.add_11rb$(new Ou(this.origin,this.origin.add_gpjtzr$(new Nu(0,this.dimension.y)))),t.add_11rb$(new Ou(this.origin.add_gpjtzr$(this.dimension),this.origin.add_gpjtzr$(new Nu(this.dimension.x,0)))),t.add_11rb$(new Ou(this.origin.add_gpjtzr$(this.dimension),this.origin.add_gpjtzr$(new Nu(0,this.dimension.y)))),t}}),bu.prototype.xRange=function(){return new Ql(this.origin.x,this.origin.x+this.dimension.x)},bu.prototype.yRange=function(){return new Ql(this.origin.y,this.origin.y+this.dimension.y)},bu.prototype.contains_gpjtzr$=function(t){return this.origin.x<=t.x&&this.origin.x+this.dimension.x>=t.x&&this.origin.y<=t.y&&this.origin.y+this.dimension.y>=t.y},bu.prototype.union_wthzt5$=function(t){var e=this.origin.min_gpjtzr$(t.origin),n=this.origin.add_gpjtzr$(this.dimension),i=t.origin.add_gpjtzr$(t.dimension);return new bu(e,n.max_gpjtzr$(i).subtract_gpjtzr$(e))},bu.prototype.intersects_wthzt5$=function(t){var e=this.origin,n=this.origin.add_gpjtzr$(this.dimension),i=t.origin,r=t.origin.add_gpjtzr$(t.dimension);return r.x>=e.x&&n.x>=i.x&&r.y>=e.y&&n.y>=i.y},bu.prototype.intersect_wthzt5$=function(t){var e=this.origin,n=this.origin.add_gpjtzr$(this.dimension),i=t.origin,r=t.origin.add_gpjtzr$(t.dimension),o=e.max_gpjtzr$(i),a=n.min_gpjtzr$(r).subtract_gpjtzr$(o);return a.x<0||a.y<0?null:new bu(o,a)},bu.prototype.add_gpjtzr$=function(t){return new bu(this.origin.add_gpjtzr$(t),this.dimension)},bu.prototype.subtract_gpjtzr$=function(t){return new bu(this.origin.subtract_gpjtzr$(t),this.dimension)},bu.prototype.distance_gpjtzr$=function(t){var e,n=0,i=!1;for(e=this.parts.iterator();e.hasNext();){var r=e.next();if(i){var o=r.distance_gpjtzr$(t);o=0&&n.dotProduct_gpjtzr$(r)>=0},Ou.prototype.intersection_69p9e5$=function(t){var e=this.start,n=t.start,i=this.end.subtract_gpjtzr$(this.start),r=t.end.subtract_gpjtzr$(t.start),o=i.dotProduct_gpjtzr$(r.orthogonal());if(0===o)return null;var a=n.subtract_gpjtzr$(e).dotProduct_gpjtzr$(r.orthogonal())/o;if(a<0||a>1)return null;var s=r.dotProduct_gpjtzr$(i.orthogonal()),l=e.subtract_gpjtzr$(n).dotProduct_gpjtzr$(i.orthogonal())/s;return l<0||l>1?null:e.add_gpjtzr$(i.mul_14dthe$(a))},Ou.prototype.length=function(){return this.start.subtract_gpjtzr$(this.end).length()},Ou.prototype.equals=function(t){var n;if(!e.isType(t,Ou))return!1;var i=null==(n=t)||e.isType(n,Ou)?n:E();return N(i).start.equals(this.start)&&i.end.equals(this.end)},Ou.prototype.hashCode=function(){return(31*this.start.hashCode()|0)+this.end.hashCode()|0},Ou.prototype.toString=function(){return"["+this.start+" -> "+this.end+"]"},Ou.$metadata$={kind:$,simpleName:"DoubleSegment",interfaces:[]},Nu.prototype.add_gpjtzr$=function(t){return new Nu(this.x+t.x,this.y+t.y)},Nu.prototype.subtract_gpjtzr$=function(t){return new Nu(this.x-t.x,this.y-t.y)},Nu.prototype.max_gpjtzr$=function(t){var e=this.x,n=t.x,i=f.max(e,n),r=this.y,o=t.y;return new Nu(i,f.max(r,o))},Nu.prototype.min_gpjtzr$=function(t){var e=this.x,n=t.x,i=f.min(e,n),r=this.y,o=t.y;return new Nu(i,f.min(r,o))},Nu.prototype.mul_14dthe$=function(t){return new Nu(this.x*t,this.y*t)},Nu.prototype.dotProduct_gpjtzr$=function(t){return this.x*t.x+this.y*t.y},Nu.prototype.negate=function(){return new Nu(-this.x,-this.y)},Nu.prototype.orthogonal=function(){return new Nu(-this.y,this.x)},Nu.prototype.length=function(){var t=this.x*this.x+this.y*this.y;return f.sqrt(t)},Nu.prototype.normalize=function(){return this.mul_14dthe$(1/this.length())},Nu.prototype.rotate_14dthe$=function(t){return new Nu(this.x*f.cos(t)-this.y*f.sin(t),this.x*f.sin(t)+this.y*f.cos(t))},Nu.prototype.equals=function(t){var n;if(!e.isType(t,Nu))return!1;var i=null==(n=t)||e.isType(n,Nu)?n:E();return N(i).x===this.x&&i.y===this.y},Nu.prototype.hashCode=function(){return P(this.x)+(31*P(this.y)|0)|0},Nu.prototype.toString=function(){return"("+this.x+", "+this.y+")"},Pu.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var Au=null;function ju(){return null===Au&&new Pu,Au}function Lu(t,e){this.origin=t,this.dimension=e}function Ru(t,e){this.start=t,this.end=e}function Iu(t,e){Mu(),this.x=t,this.y=e}function zu(){Du=this,this.ZERO=new Iu(0,0)}Nu.$metadata$={kind:$,simpleName:"DoubleVector",interfaces:[]},Object.defineProperty(Lu.prototype,"boundSegments",{configurable:!0,get:function(){var t=this.boundPoints_0;return[new Ru(t[0],t[1]),new Ru(t[1],t[2]),new Ru(t[2],t[3]),new Ru(t[3],t[0])]}}),Object.defineProperty(Lu.prototype,"boundPoints_0",{configurable:!0,get:function(){return[this.origin,this.origin.add_119tl4$(new Iu(this.dimension.x,0)),this.origin.add_119tl4$(this.dimension),this.origin.add_119tl4$(new Iu(0,this.dimension.y))]}}),Lu.prototype.add_119tl4$=function(t){return new Lu(this.origin.add_119tl4$(t),this.dimension)},Lu.prototype.sub_119tl4$=function(t){return new Lu(this.origin.sub_119tl4$(t),this.dimension)},Lu.prototype.contains_vfns7u$=function(t){return this.contains_119tl4$(t.origin)&&this.contains_119tl4$(t.origin.add_119tl4$(t.dimension))},Lu.prototype.contains_119tl4$=function(t){return this.origin.x<=t.x&&(this.origin.x+this.dimension.x|0)>=t.x&&this.origin.y<=t.y&&(this.origin.y+this.dimension.y|0)>=t.y},Lu.prototype.union_vfns7u$=function(t){var e=this.origin.min_119tl4$(t.origin),n=this.origin.add_119tl4$(this.dimension),i=t.origin.add_119tl4$(t.dimension);return new Lu(e,n.max_119tl4$(i).sub_119tl4$(e))},Lu.prototype.intersects_vfns7u$=function(t){var e=this.origin,n=this.origin.add_119tl4$(this.dimension),i=t.origin,r=t.origin.add_119tl4$(t.dimension);return r.x>=e.x&&n.x>=i.x&&r.y>=e.y&&n.y>=i.y},Lu.prototype.intersect_vfns7u$=function(t){if(!this.intersects_vfns7u$(t))throw _("rectangle ["+this+"] doesn't intersect ["+t+"]");var e=this.origin.add_119tl4$(this.dimension),n=t.origin.add_119tl4$(t.dimension),i=e.min_119tl4$(n),r=this.origin.max_119tl4$(t.origin);return new Lu(r,i.sub_119tl4$(r))},Lu.prototype.innerIntersects_vfns7u$=function(t){var e=this.origin,n=this.origin.add_119tl4$(this.dimension),i=t.origin,r=t.origin.add_119tl4$(t.dimension);return r.x>e.x&&n.x>i.x&&r.y>e.y&&n.y>i.y},Lu.prototype.changeDimension_119tl4$=function(t){return new Lu(this.origin,t)},Lu.prototype.distance_119tl4$=function(t){return this.toDoubleRectangle_0().distance_gpjtzr$(t.toDoubleVector())},Lu.prototype.xRange=function(){return new Ql(this.origin.x,this.origin.x+this.dimension.x|0)},Lu.prototype.yRange=function(){return new Ql(this.origin.y,this.origin.y+this.dimension.y|0)},Lu.prototype.hashCode=function(){return(31*this.origin.hashCode()|0)+this.dimension.hashCode()|0},Lu.prototype.equals=function(t){var n,i,r;if(!e.isType(t,Lu))return!1;var o=null==(n=t)||e.isType(n,Lu)?n:E();return(null!=(i=this.origin)?i.equals(N(o).origin):null)&&(null!=(r=this.dimension)?r.equals(o.dimension):null)},Lu.prototype.toDoubleRectangle_0=function(){return new bu(this.origin.toDoubleVector(),this.dimension.toDoubleVector())},Lu.prototype.center=function(){return this.origin.add_119tl4$(new Iu(this.dimension.x/2|0,this.dimension.y/2|0))},Lu.prototype.toString=function(){return this.origin.toString()+" - "+this.dimension},Lu.$metadata$={kind:$,simpleName:"Rectangle",interfaces:[]},Ru.prototype.distance_119tl4$=function(t){var n=this.start.sub_119tl4$(t),i=this.end.sub_119tl4$(t);if(this.isDistanceToLineBest_0(t))return Nt(e.imul(n.x,i.y)-e.imul(n.y,i.x)|0)/this.length();var r=n.toDoubleVector().length(),o=i.toDoubleVector().length();return f.min(r,o)},Ru.prototype.isDistanceToLineBest_0=function(t){var e=this.start.sub_119tl4$(this.end),n=e.negate(),i=t.sub_119tl4$(this.end),r=t.sub_119tl4$(this.start);return e.dotProduct_119tl4$(i)>=0&&n.dotProduct_119tl4$(r)>=0},Ru.prototype.toDoubleSegment=function(){return new Ou(this.start.toDoubleVector(),this.end.toDoubleVector())},Ru.prototype.intersection_51grtu$=function(t){return this.toDoubleSegment().intersection_69p9e5$(t.toDoubleSegment())},Ru.prototype.length=function(){return this.start.sub_119tl4$(this.end).length()},Ru.prototype.contains_119tl4$=function(t){var e=t.sub_119tl4$(this.start),n=t.sub_119tl4$(this.end);return!!e.isParallel_119tl4$(n)&&e.dotProduct_119tl4$(n)<=0},Ru.prototype.equals=function(t){var n,i,r;if(!e.isType(t,Ru))return!1;var o=null==(n=t)||e.isType(n,Ru)?n:E();return(null!=(i=N(o).start)?i.equals(this.start):null)&&(null!=(r=o.end)?r.equals(this.end):null)},Ru.prototype.hashCode=function(){return(31*this.start.hashCode()|0)+this.end.hashCode()|0},Ru.prototype.toString=function(){return"["+this.start+" -> "+this.end+"]"},Ru.$metadata$={kind:$,simpleName:"Segment",interfaces:[]},zu.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var Du=null;function Mu(){return null===Du&&new zu,Du}function Bu(){this.myArray_0=null}function Uu(t){return t=t||Object.create(Bu.prototype),Hu.call(t),Bu.call(t),t.myArray_0=u(),t}function Fu(t,e){return e=e||Object.create(Bu.prototype),Hu.call(e),Bu.call(e),e.myArray_0=gt(t),e}function qu(){this.myObj_0=null}function Gu(t,n){var i;return n=n||Object.create(qu.prototype),Hu.call(n),qu.call(n),n.myObj_0=Rt(e.isType(i=t,k)?i:E()),n}function Hu(){}function Yu(){this.buffer_suueb3$_0=this.buffer_suueb3$_0}function Vu(t){ec(),this.input_0=t,this.i_0=0,this.tokenStart_0=0,this.currentToken_dslfm7$_0=null,this.nextToken()}function Ku(t){return Ut(nt(t))}function Wu(t){return ec().isDigit_0(nt(t))}function Xu(t){return ec().isDigit_0(nt(t))}function Zu(t){return ec().isDigit_0(nt(t))}function Ju(){return Pt}function Qu(){tc=this,this.digits_0=new Gt(48,57)}Iu.prototype.add_119tl4$=function(t){return new Iu(this.x+t.x|0,this.y+t.y|0)},Iu.prototype.sub_119tl4$=function(t){return this.add_119tl4$(t.negate())},Iu.prototype.negate=function(){return new Iu(0|-this.x,0|-this.y)},Iu.prototype.max_119tl4$=function(t){var e=this.x,n=t.x,i=f.max(e,n),r=this.y,o=t.y;return new Iu(i,f.max(r,o))},Iu.prototype.min_119tl4$=function(t){var e=this.x,n=t.x,i=f.min(e,n),r=this.y,o=t.y;return new Iu(i,f.min(r,o))},Iu.prototype.mul_za3lpa$=function(t){return new Iu(e.imul(this.x,t),e.imul(this.y,t))},Iu.prototype.div_za3lpa$=function(t){return new Iu(this.x/t|0,this.y/t|0)},Iu.prototype.dotProduct_119tl4$=function(t){return e.imul(this.x,t.x)+e.imul(this.y,t.y)|0},Iu.prototype.length=function(){var t=e.imul(this.x,this.x)+e.imul(this.y,this.y)|0;return f.sqrt(t)},Iu.prototype.toDoubleVector=function(){return new Nu(this.x,this.y)},Iu.prototype.abs=function(){return new Iu(Nt(this.x),Nt(this.y))},Iu.prototype.isParallel_119tl4$=function(t){return 0==(e.imul(this.x,t.y)-e.imul(t.x,this.y)|0)},Iu.prototype.orthogonal=function(){return new Iu(0|-this.y,this.x)},Iu.prototype.equals=function(t){var n;if(!e.isType(t,Iu))return!1;var i=null==(n=t)||e.isType(n,Iu)?n:E();return this.x===N(i).x&&this.y===i.y},Iu.prototype.hashCode=function(){return(31*this.x|0)+this.y|0},Iu.prototype.toString=function(){return"("+this.x+", "+this.y+")"},Iu.$metadata$={kind:$,simpleName:"Vector",interfaces:[]},Bu.prototype.getDouble_za3lpa$=function(t){var e;return"number"==typeof(e=this.myArray_0.get_za3lpa$(t))?e:E()},Bu.prototype.add_pdl1vj$=function(t){return this.myArray_0.add_11rb$(t),this},Bu.prototype.add_yrwdxb$=function(t){return this.myArray_0.add_11rb$(t),this},Bu.prototype.addStrings_d294za$=function(t){return this.myArray_0.addAll_brywnq$(t),this},Bu.prototype.addAll_5ry1at$=function(t){var e;for(e=t.iterator();e.hasNext();){var n=e.next();this.myArray_0.add_11rb$(n.get())}return this},Bu.prototype.addAll_m5dwgt$=function(t){return this.addAll_5ry1at$(st(t.slice())),this},Bu.prototype.stream=function(){return Rc(this.myArray_0)},Bu.prototype.objectStream=function(){return zc(this.myArray_0)},Bu.prototype.fluentObjectStream=function(){return jt(zc(this.myArray_0),At("FluentObject",(function(t){return Gu(t)})))},Bu.prototype.get=function(){return this.myArray_0},Bu.$metadata$={kind:$,simpleName:"FluentArray",interfaces:[Hu]},qu.prototype.getArr_0=function(t){var n;return e.isType(n=this.myObj_0.get_11rb$(t),$t)?n:E()},qu.prototype.getObj_0=function(t){var n;return e.isType(n=this.myObj_0.get_11rb$(t),k)?n:E()},qu.prototype.get=function(){return this.myObj_0},qu.prototype.contains_61zpoe$=function(t){return this.myObj_0.containsKey_11rb$(t)},qu.prototype.containsNotNull_0=function(t){return this.contains_61zpoe$(t)&&null!=this.myObj_0.get_11rb$(t)},qu.prototype.put_wxs67v$=function(t,e){var n=this.myObj_0,i=null!=e?e.get():null;return n.put_xwzc9p$(t,i),this},qu.prototype.put_jyasbz$=function(t,e){return this.myObj_0.put_xwzc9p$(t,e),this},qu.prototype.put_hzlfav$=function(t,e){return this.myObj_0.put_xwzc9p$(t,e),this},qu.prototype.put_h92gdm$=function(t,e){return this.myObj_0.put_xwzc9p$(t,e),this},qu.prototype.put_snuhza$=function(t,e){var n=this.myObj_0,i=null!=e?Bc(e):null;return n.put_xwzc9p$(t,i),this},qu.prototype.getInt_61zpoe$=function(t){return Lt(Uc(this.myObj_0,t))},qu.prototype.getDouble_61zpoe$=function(t){return Fc(this.myObj_0,t)},qu.prototype.getBoolean_61zpoe$=function(t){var e;return"boolean"==typeof(e=this.myObj_0.get_11rb$(t))?e:E()},qu.prototype.getString_61zpoe$=function(t){var e;return"string"==typeof(e=this.myObj_0.get_11rb$(t))?e:E()},qu.prototype.getStrings_61zpoe$=function(t){var e,n=this.getArr_0(t),i=h(p(n,10));for(e=n.iterator();e.hasNext();){var r=e.next();i.add_11rb$(Dc(r))}return i},qu.prototype.getEnum_xwn52g$=function(t,e){var n;return Mc("string"==typeof(n=this.myObj_0.get_11rb$(t))?n:E(),e)},qu.prototype.getEnum_a9gw98$=J("lets-plot-base-portable.jetbrains.datalore.base.json.FluentObject.getEnum_a9gw98$",(function(t,e,n){return this.getEnum_xwn52g$(n,t.values())})),qu.prototype.getArray_61zpoe$=function(t){return Fu(this.getArr_0(t))},qu.prototype.getObject_61zpoe$=function(t){return Gu(this.getObj_0(t))},qu.prototype.getInt_qoz5hj$=function(t,e){return e(this.getInt_61zpoe$(t)),this},qu.prototype.getDouble_l47sdb$=function(t,e){return e(this.getDouble_61zpoe$(t)),this},qu.prototype.getBoolean_48wr2m$=function(t,e){return e(this.getBoolean_61zpoe$(t)),this},qu.prototype.getString_hyc7mn$=function(t,e){return e(this.getString_61zpoe$(t)),this},qu.prototype.getStrings_lpk3a7$=function(t,e){return e(this.getStrings_61zpoe$(t)),this},qu.prototype.getEnum_651ru9$=function(t,e,n){return e(this.getEnum_xwn52g$(t,n)),this},qu.prototype.getArray_nhu1ij$=function(t,e){return e(this.getArray_61zpoe$(t)),this},qu.prototype.getObject_6k19qz$=function(t,e){return e(this.getObject_61zpoe$(t)),this},qu.prototype.putRemovable_wxs67v$=function(t,e){return null!=e&&this.put_wxs67v$(t,e),this},qu.prototype.putRemovable_snuhza$=function(t,e){return null!=e&&this.put_snuhza$(t,e),this},qu.prototype.forEntries_ophlsb$=function(t){var e;for(e=this.myObj_0.keys.iterator();e.hasNext();){var n=e.next();t(n,this.myObj_0.get_11rb$(n))}return this},qu.prototype.forObjEntries_izf7h5$=function(t){var n;for(n=this.myObj_0.keys.iterator();n.hasNext();){var i,r=n.next();t(r,e.isType(i=this.myObj_0.get_11rb$(r),k)?i:E())}return this},qu.prototype.forArrEntries_2wy1dl$=function(t){var n;for(n=this.myObj_0.keys.iterator();n.hasNext();){var i,r=n.next();t(r,e.isType(i=this.myObj_0.get_11rb$(r),$t)?i:E())}return this},qu.prototype.accept_ysf37t$=function(t){return t(this),this},qu.prototype.forStrings_2by8ig$=function(t,e){var n,i,r=qc(this.myObj_0,t),o=h(p(r,10));for(n=r.iterator();n.hasNext();){var a=n.next();o.add_11rb$(Dc(a))}for(i=o.iterator();i.hasNext();)e(i.next());return this},qu.prototype.getExistingDouble_l47sdb$=function(t,e){return this.containsNotNull_0(t)&&this.getDouble_l47sdb$(t,e),this},qu.prototype.getOptionalStrings_jpy86i$=function(t,e){return this.containsNotNull_0(t)?e(this.getStrings_61zpoe$(t)):e(null),this},qu.prototype.getExistingString_hyc7mn$=function(t,e){return this.containsNotNull_0(t)&&this.getString_hyc7mn$(t,e),this},qu.prototype.forExistingStrings_hyc7mn$=function(t,e){return this.containsNotNull_0(t)&&this.forStrings_2by8ig$(t,(n=e,function(t){return n(N(t)),Pt})),this;var n},qu.prototype.getExistingObject_6k19qz$=function(t,e){if(this.containsNotNull_0(t)){var n=this.getObject_61zpoe$(t);n.myObj_0.keys.isEmpty()||e(n)}return this},qu.prototype.getExistingArray_nhu1ij$=function(t,e){return this.containsNotNull_0(t)&&e(this.getArray_61zpoe$(t)),this},qu.prototype.forObjects_6k19qz$=function(t,e){var n;for(n=this.getArray_61zpoe$(t).fluentObjectStream().iterator();n.hasNext();)e(n.next());return this},qu.prototype.getOptionalInt_w5p0jm$=function(t,e){return this.containsNotNull_0(t)?e(this.getInt_61zpoe$(t)):e(null),this},qu.prototype.getIntOrDefault_u1i54l$=function(t,e,n){return this.containsNotNull_0(t)?e(this.getInt_61zpoe$(t)):e(n),this},qu.prototype.forEnums_651ru9$=function(t,e,n){var i;for(i=this.getArr_0(t).iterator();i.hasNext();){var r;e(Mc("string"==typeof(r=i.next())?r:E(),n))}return this},qu.prototype.getOptionalEnum_651ru9$=function(t,e,n){return this.containsNotNull_0(t)?e(this.getEnum_xwn52g$(t,n)):e(null),this},qu.$metadata$={kind:$,simpleName:"FluentObject",interfaces:[Hu]},Hu.$metadata$={kind:$,simpleName:"FluentValue",interfaces:[]},Object.defineProperty(Yu.prototype,"buffer_0",{configurable:!0,get:function(){return null==this.buffer_suueb3$_0?It("buffer"):this.buffer_suueb3$_0},set:function(t){this.buffer_suueb3$_0=t}}),Yu.prototype.formatJson_za3rmp$=function(t){return this.buffer_0=A(),this.handleValue_0(t),this.buffer_0.toString()},Yu.prototype.handleList_0=function(t){var e;this.append_0("["),this.headTail_0(t,At("handleValue",function(t,e){return t.handleValue_0(e),Pt}.bind(null,this)),(e=this,function(t){var n;for(n=t.iterator();n.hasNext();){var i=n.next(),r=e;r.append_0(","),r.handleValue_0(i)}return Pt})),this.append_0("]")},Yu.prototype.handleMap_0=function(t){var e;this.append_0("{"),this.headTail_0(t.entries,At("handlePair",function(t,e){return t.handlePair_0(e),Pt}.bind(null,this)),(e=this,function(t){var n;for(n=t.iterator();n.hasNext();){var i=n.next(),r=e;r.append_0(",\n"),r.handlePair_0(i)}return Pt})),this.append_0("}")},Yu.prototype.handleValue_0=function(t){if(null==t)this.append_0("null");else if("string"==typeof t)this.handleString_0(t);else if(e.isNumber(t)||l(t,zt))this.append_0(t.toString());else if(e.isArray(t))this.handleList_0(at(t));else if(e.isType(t,$t))this.handleList_0(t);else{if(!e.isType(t,k))throw v("Can't serialize object "+I(t));this.handleMap_0(t)}},Yu.prototype.handlePair_0=function(t){this.handleString_0(t.key),this.append_0(":"),this.handleValue_0(t.value)},Yu.prototype.handleString_0=function(t){if(null!=t){if("string"!=typeof t)throw v("Expected a string, but got '"+I(e.getKClassFromExpression(t).simpleName)+"'");this.append_0('"'+jc(t)+'"')}},Yu.prototype.append_0=function(t){return this.buffer_0.append_pdl1vj$(t)},Yu.prototype.headTail_0=function(t,e,n){t.isEmpty()||(e(Dt(t)),n(Bt(Mt(t),1)))},Yu.$metadata$={kind:$,simpleName:"JsonFormatter",interfaces:[]},Object.defineProperty(Vu.prototype,"currentToken",{configurable:!0,get:function(){return this.currentToken_dslfm7$_0},set:function(t){this.currentToken_dslfm7$_0=t}}),Object.defineProperty(Vu.prototype,"currentChar_0",{configurable:!0,get:function(){return this.input_0.charCodeAt(this.i_0)}}),Vu.prototype.nextToken=function(){var t;if(this.advanceWhile_0(Ku),!this.isFinished()){if(123===this.currentChar_0){var e=wc();this.advance_0(),t=e}else if(125===this.currentChar_0){var n=xc();this.advance_0(),t=n}else if(91===this.currentChar_0){var i=kc();this.advance_0(),t=i}else if(93===this.currentChar_0){var r=Ec();this.advance_0(),t=r}else if(44===this.currentChar_0){var o=Cc();this.advance_0(),t=o}else if(58===this.currentChar_0){var a=Sc();this.advance_0(),t=a}else if(116===this.currentChar_0){var s=Nc();this.read_0("true"),t=s}else if(102===this.currentChar_0){var l=Pc();this.read_0("false"),t=l}else if(110===this.currentChar_0){var u=Ac();this.read_0("null"),t=u}else if(34===this.currentChar_0){var c=Tc();this.readString_0(),t=c}else{if(!this.readNumber_0())throw _((this.i_0.toString()+":"+String.fromCharCode(this.currentChar_0)+" - unkown token").toString());t=Oc()}this.currentToken=t}},Vu.prototype.tokenValue=function(){var t=this.input_0,e=this.tokenStart_0,n=this.i_0;return t.substring(e,n)},Vu.prototype.readString_0=function(){for(this.startToken_0(),this.advance_0();34!==this.currentChar_0;)if(92===this.currentChar_0)if(this.advance_0(),117===this.currentChar_0){this.advance_0();for(var t=0;t<4;t++){if(!ec().isHex_0(this.currentChar_0))throw v("Failed requirement.".toString());this.advance_0()}}else{var n,i=mc,r=Ft(this.currentChar_0);if(!(e.isType(n=i,k)?n:E()).containsKey_11rb$(r))throw _("Invalid escape sequence".toString());this.advance_0()}else this.advance_0();this.advance_0()},Vu.prototype.readNumber_0=function(){return!(!ec().isDigit_0(this.currentChar_0)&&45!==this.currentChar_0||(this.startToken_0(),this.advanceIfCurrent_0(e.charArrayOf(45)),this.advanceWhile_0(Wu),this.advanceIfCurrent_0(e.charArrayOf(46),(t=this,function(){if(!ec().isDigit_0(t.currentChar_0))throw v("Number should have decimal part".toString());return t.advanceWhile_0(Xu),Pt})),this.advanceIfCurrent_0(e.charArrayOf(101,69),function(t){return function(){return t.advanceIfCurrent_0(e.charArrayOf(43,45)),t.advanceWhile_0(Zu),Pt}}(this)),0));var t},Vu.prototype.isFinished=function(){return this.i_0===this.input_0.length},Vu.prototype.startToken_0=function(){this.tokenStart_0=this.i_0},Vu.prototype.advance_0=function(){this.i_0=this.i_0+1|0},Vu.prototype.read_0=function(t){var e;for(e=Ht(t);e.hasNext();){var n=nt(e.next()),i=Ft(n);if(this.currentChar_0!==nt(i))throw v(("Wrong data: "+t).toString());if(this.isFinished())throw v("Unexpected end of string".toString());this.advance_0()}},Vu.prototype.advanceWhile_0=function(t){for(;!this.isFinished()&&t(Ft(this.currentChar_0));)this.advance_0()},Vu.prototype.advanceIfCurrent_0=function(t,e){void 0===e&&(e=Ju),!this.isFinished()&&qt(t,this.currentChar_0)&&(this.advance_0(),e())},Qu.prototype.isDigit_0=function(t){var e=this.digits_0;return null!=t&&e.contains_mef7kx$(t)},Qu.prototype.isHex_0=function(t){return this.isDigit_0(t)||new Gt(97,102).contains_mef7kx$(t)||new Gt(65,70).contains_mef7kx$(t)},Qu.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var tc=null;function ec(){return null===tc&&new Qu,tc}function nc(t){this.json_0=t}function ic(t){Vt(t,this),this.name="JsonParser$JsonException"}function rc(){$c=this}Vu.$metadata$={kind:$,simpleName:"JsonLexer",interfaces:[]},nc.prototype.parseJson=function(){var t=new Vu(this.json_0);return this.parseValue_0(t)},nc.prototype.parseValue_0=function(t){var e,n;if(e=t.currentToken,l(e,Tc())){var i=Lc(t.tokenValue());t.nextToken(),n=i}else if(l(e,Oc())){var r=Yt(t.tokenValue());t.nextToken(),n=r}else if(l(e,Pc()))t.nextToken(),n=!1;else if(l(e,Nc()))t.nextToken(),n=!0;else if(l(e,Ac()))t.nextToken(),n=null;else if(l(e,wc()))n=this.parseObject_0(t);else{if(!l(e,kc()))throw _(("Invalid token: "+I(t.currentToken)).toString());n=this.parseArray_0(t)}return n},nc.prototype.parseArray_0=function(t){var e,n,i=(e=t,n=this,function(t){n.require_0(e.currentToken,t,"[Arr] ")}),r=u();for(i(kc()),t.nextToken();!l(t.currentToken,Ec());)r.isEmpty()||(i(Cc()),t.nextToken()),r.add_11rb$(this.parseValue_0(t));return i(Ec()),t.nextToken(),r},nc.prototype.parseObject_0=function(t){var e,n,i=(e=t,n=this,function(t){n.require_0(e.currentToken,t,"[Obj] ")}),r=Wt();for(i(wc()),t.nextToken();!l(t.currentToken,xc());){r.isEmpty()||(i(Cc()),t.nextToken()),i(Tc());var o=Lc(t.tokenValue());t.nextToken(),i(Sc()),t.nextToken();var a=this.parseValue_0(t);r.put_xwzc9p$(o,a)}return i(xc()),t.nextToken(),r},nc.prototype.require_0=function(t,e,n){if(void 0===n&&(n=null),!l(t,e))throw new ic(n+"Expected token: "+I(e)+", actual: "+I(t))},ic.$metadata$={kind:$,simpleName:"JsonException",interfaces:[Kt]},nc.$metadata$={kind:$,simpleName:"JsonParser",interfaces:[]},rc.prototype.parseJson_61zpoe$=function(t){var n;return e.isType(n=new nc(t).parseJson(),Xt)?n:E()},rc.prototype.formatJson_za3rmp$=function(t){return(new Yu).formatJson_za3rmp$(t)},rc.$metadata$={kind:y,simpleName:"JsonSupport",interfaces:[]};var oc,ac,sc,lc,uc,cc,pc,hc,_c,fc,dc,mc,yc,$c=null;function vc(){return null===$c&&new rc,$c}function gc(t,e){C.call(this),this.name$=t,this.ordinal$=e}function bc(){bc=function(){},oc=new gc("LEFT_BRACE",0),ac=new gc("RIGHT_BRACE",1),sc=new gc("LEFT_BRACKET",2),lc=new gc("RIGHT_BRACKET",3),uc=new gc("COMMA",4),cc=new gc("COLON",5),pc=new gc("STRING",6),hc=new gc("NUMBER",7),_c=new gc("TRUE",8),fc=new gc("FALSE",9),dc=new gc("NULL",10)}function wc(){return bc(),oc}function xc(){return bc(),ac}function kc(){return bc(),sc}function Ec(){return bc(),lc}function Cc(){return bc(),uc}function Sc(){return bc(),cc}function Tc(){return bc(),pc}function Oc(){return bc(),hc}function Nc(){return bc(),_c}function Pc(){return bc(),fc}function Ac(){return bc(),dc}function jc(t){for(var e,n,i,r={v:null},o={v:0},a=function(t,e,n){return function(i){var r,o,a=t;if(null!=(r=t.v))o=r;else{var s=n,l=e.v;o=new Jt(s.substring(0,l))}a.v=o.append_pdl1vj$(i)}}(r,o,t);o.v0;)n=n+1|0,i=i.div(e.Long.fromInt(10));return n}function lp(t){kp(),this.spec_0=t}function up(t,e,n,i,r,o,a,s,l,u){void 0===t&&(t=" "),void 0===e&&(e=">"),void 0===n&&(n="-"),void 0===o&&(o=-1),void 0===s&&(s=6),void 0===l&&(l=""),void 0===u&&(u=!1),this.fill=t,this.align=e,this.sign=n,this.symbol=i,this.zero=r,this.width=o,this.comma=a,this.precision=s,this.type=l,this.trim=u}function cp(t,n,i,r,o){fp(),void 0===t&&(t=0),void 0===n&&(n=!1),void 0===i&&(i=z),void 0===r&&(r=z),void 0===o&&(o=null),this.number=t,this.negative=n,this.integerPart=i,this.fractionalPart=r,this.exponent=o,this.fractionLeadingZeros=18-sp(this.fractionalPart)|0,this.integerLength=sp(this.integerPart),this.fractionString=de("0",this.fractionLeadingZeros)+me(this.fractionalPart.toString(),e.charArrayOf(48))}function pp(){_p=this,this.MAX_DECIMALS_0=18,this.MAX_DECIMAL_VALUE_8be2vx$=e.Long.fromNumber(f.pow(10,18))}function hp(t,n){var i=t;n>18&&(i=w(t,b(0,t.length-(n-18)|0)));var r=he(i),o=_e(18-n|0,0);return r.multiply(e.Long.fromNumber(f.pow(10,o)))}Object.defineProperty(Gc.prototype,"isEmpty",{configurable:!0,get:function(){return 0===this.size()}}),Gc.prototype.containsKey_11rb$=function(t){return this.findByKey_0(t)>=0},Gc.prototype.remove_11rb$=function(t){var n,i=this.findByKey_0(t);if(i>=0){var r=this.myData_0[i+1|0];return this.removeAt_0(i),null==(n=r)||e.isType(n,re)?n:E()}return null},Object.defineProperty(Kc.prototype,"size",{configurable:!0,get:function(){return this.this$ListMap.size()}}),Kc.prototype.add_11rb$=function(t){throw _("Not available in keySet")},Wc.prototype.get_za3lpa$=function(t){return this.this$ListMap.myData_0[t]},Wc.$metadata$={kind:$,interfaces:[np]},Kc.prototype.iterator=function(){return this.this$ListMap.mapIterator_0(new Wc(this.this$ListMap))},Kc.$metadata$={kind:$,interfaces:[oe]},Gc.prototype.keySet=function(){return new Kc(this)},Object.defineProperty(Xc.prototype,"size",{configurable:!0,get:function(){return this.this$ListMap.size()}}),Zc.prototype.get_za3lpa$=function(t){return this.this$ListMap.myData_0[t+1|0]},Zc.$metadata$={kind:$,interfaces:[np]},Xc.prototype.iterator=function(){return this.this$ListMap.mapIterator_0(new Zc(this.this$ListMap))},Xc.$metadata$={kind:$,interfaces:[ae]},Gc.prototype.values=function(){return new Xc(this)},Object.defineProperty(Jc.prototype,"size",{configurable:!0,get:function(){return this.this$ListMap.size()}}),Qc.prototype.get_za3lpa$=function(t){return new ep(this.this$ListMap,t)},Qc.$metadata$={kind:$,interfaces:[np]},Jc.prototype.iterator=function(){return this.this$ListMap.mapIterator_0(new Qc(this.this$ListMap))},Jc.$metadata$={kind:$,interfaces:[se]},Gc.prototype.entrySet=function(){return new Jc(this)},Gc.prototype.size=function(){return this.myData_0.length/2|0},Gc.prototype.put_xwzc9p$=function(t,n){var i,r=this.findByKey_0(t);if(r>=0){var o=this.myData_0[r+1|0];return this.myData_0[r+1|0]=n,null==(i=o)||e.isType(i,re)?i:E()}var a,s=ue(this.myData_0.length+2|0);a=s.length-1|0;for(var l=0;l<=a;l++)s[l]=l=18)return dp(t,he(l),z,p);if(!(p<18))throw _("Check failed.".toString());if(p<0)return dp(t,void 0,r(l+u,Nt(p)+u.length|0));if(!(p>=0&&p<=18))throw _("Check failed.".toString());if(p>=u.length)return dp(t,he(l+u+de("0",p-u.length|0)));if(!(p>=0&&p=^]))?([+ -])?([#$])?(0)?(\\d+)?(,)?(?:\\.(\\d+))?([%bcdefgosXx])?$")}function vp(t){return g(t,"")}cp.$metadata$={kind:$,simpleName:"NumberInfo",interfaces:[]},cp.prototype.component1=function(){return this.number},cp.prototype.component2=function(){return this.negative},cp.prototype.component3=function(){return this.integerPart},cp.prototype.component4=function(){return this.fractionalPart},cp.prototype.component5=function(){return this.exponent},cp.prototype.copy_xz9h4k$=function(t,e,n,i,r){return new cp(void 0===t?this.number:t,void 0===e?this.negative:e,void 0===n?this.integerPart:n,void 0===i?this.fractionalPart:i,void 0===r?this.exponent:r)},cp.prototype.toString=function(){return"NumberInfo(number="+e.toString(this.number)+", negative="+e.toString(this.negative)+", integerPart="+e.toString(this.integerPart)+", fractionalPart="+e.toString(this.fractionalPart)+", exponent="+e.toString(this.exponent)+")"},cp.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*(t=31*(t=31*t+e.hashCode(this.number)|0)+e.hashCode(this.negative)|0)+e.hashCode(this.integerPart)|0)+e.hashCode(this.fractionalPart)|0)+e.hashCode(this.exponent)|0},cp.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.number,t.number)&&e.equals(this.negative,t.negative)&&e.equals(this.integerPart,t.integerPart)&&e.equals(this.fractionalPart,t.fractionalPart)&&e.equals(this.exponent,t.exponent)},mp.$metadata$={kind:$,simpleName:"Output",interfaces:[]},mp.prototype.component1=function(){return this.body},mp.prototype.component2=function(){return this.sign},mp.prototype.component3=function(){return this.prefix},mp.prototype.component4=function(){return this.suffix},mp.prototype.component5=function(){return this.padding},mp.prototype.copy_rm1j3u$=function(t,e,n,i,r){return new mp(void 0===t?this.body:t,void 0===e?this.sign:e,void 0===n?this.prefix:n,void 0===i?this.suffix:i,void 0===r?this.padding:r)},mp.prototype.toString=function(){return"Output(body="+e.toString(this.body)+", sign="+e.toString(this.sign)+", prefix="+e.toString(this.prefix)+", suffix="+e.toString(this.suffix)+", padding="+e.toString(this.padding)+")"},mp.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*(t=31*(t=31*t+e.hashCode(this.body)|0)+e.hashCode(this.sign)|0)+e.hashCode(this.prefix)|0)+e.hashCode(this.suffix)|0)+e.hashCode(this.padding)|0},mp.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.body,t.body)&&e.equals(this.sign,t.sign)&&e.equals(this.prefix,t.prefix)&&e.equals(this.suffix,t.suffix)&&e.equals(this.padding,t.padding)},yp.prototype.toString=function(){var t,e=this.integerPart,n=kp().FRACTION_DELIMITER_0;return e+(null!=(t=this.fractionalPart.length>0?n:null)?t:"")+this.fractionalPart+this.exponentialPart},yp.$metadata$={kind:$,simpleName:"FormattedNumber",interfaces:[]},yp.prototype.component1=function(){return this.integerPart},yp.prototype.component2=function(){return this.fractionalPart},yp.prototype.component3=function(){return this.exponentialPart},yp.prototype.copy_6hosri$=function(t,e,n){return new yp(void 0===t?this.integerPart:t,void 0===e?this.fractionalPart:e,void 0===n?this.exponentialPart:n)},yp.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*t+e.hashCode(this.integerPart)|0)+e.hashCode(this.fractionalPart)|0)+e.hashCode(this.exponentialPart)|0},yp.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.integerPart,t.integerPart)&&e.equals(this.fractionalPart,t.fractionalPart)&&e.equals(this.exponentialPart,t.exponentialPart)},lp.prototype.apply_3p81yu$=function(t){var e=this.handleNonNumbers_0(t);if(null!=e)return e;var n=fp().createNumberInfo_yjmjg9$(t),i=new mp;return i=this.computeBody_0(i,n),i=this.trimFraction_0(i),i=this.computeSign_0(i,n),i=this.computePrefix_0(i),i=this.computeSuffix_0(i),this.spec_0.comma&&!this.spec_0.zero&&(i=this.applyGroup_0(i)),i=this.computePadding_0(i),this.spec_0.comma&&this.spec_0.zero&&(i=this.applyGroup_0(i)),this.getAlignedString_0(i)},lp.prototype.handleNonNumbers_0=function(t){var e=ee(t);return ye(e)?"NaN":e===$e.NEGATIVE_INFINITY?"-Infinity":e===$e.POSITIVE_INFINITY?"+Infinity":null},lp.prototype.getAlignedString_0=function(t){var e;switch(this.spec_0.align){case"<":e=t.sign+t.prefix+t.body+t.suffix+t.padding;break;case"=":e=t.sign+t.prefix+t.padding+t.body+t.suffix;break;case"^":var n=t.padding.length/2|0;e=ve(t.padding,b(0,n))+t.sign+t.prefix+t.body+t.suffix+ve(t.padding,b(n,t.padding.length));break;default:e=t.padding+t.sign+t.prefix+t.body+t.suffix}return e},lp.prototype.applyGroup_0=function(t){var e,n,i=t.padding,r=null!=(e=this.spec_0.zero?i:null)?e:"",o=t.body,a=r+o.integerPart,s=a.length/3,l=Lt(f.ceil(s)-1),u=_e(this.spec_0.width-o.fractionalLength-o.exponentialPart.length|0,o.integerPart.length+l|0);if((a=kp().group_0(a)).length>u){var c=a,p=a.length-u|0;a=c.substring(p),ge(a,44)&&(a="0"+a)}return t.copy_rm1j3u$(o.copy_6hosri$(a),void 0,void 0,void 0,null!=(n=this.spec_0.zero?"":null)?n:t.padding)},lp.prototype.computeBody_0=function(t,e){var n;switch(this.spec_0.type){case"%":n=this.toFixedFormat_0(fp().createNumberInfo_yjmjg9$(100*e.number),this.spec_0.precision);break;case"c":n=new yp(e.number.toString());break;case"d":n=this.toSimpleFormat_0(e,0);break;case"e":n=this.toSimpleFormat_0(this.toExponential_0(e,this.spec_0.precision),this.spec_0.precision);break;case"f":n=this.toFixedFormat_0(e,this.spec_0.precision);break;case"g":n=this.toPrecisionFormat_0(e,this.spec_0.precision);break;case"b":n=new yp(we(be(e.number),2));break;case"o":n=new yp(we(be(e.number),8));break;case"X":n=new yp(we(be(e.number),16).toUpperCase());break;case"x":n=new yp(we(be(e.number),16));break;case"s":n=this.toSiFormat_0(e,this.spec_0.precision);break;default:throw v("Wrong type: "+this.spec_0.type)}var i=n;return t.copy_rm1j3u$(i)},lp.prototype.toExponential_0=function(t,e){var n;void 0===e&&(e=-1);var i=t.number;if(i-1&&(s=this.roundToPrecision_0(s,e)),s.integerLength>1&&(r=r+1|0,s=fp().createNumberInfo_yjmjg9$(a/10)),s.copy_xz9h4k$(void 0,void 0,void 0,void 0,r)},lp.prototype.toPrecisionFormat_0=function(t,e){return void 0===e&&(e=-1),l(t.integerPart,z)?l(t.fractionalPart,z)?this.toFixedFormat_0(t,e-1|0):this.toFixedFormat_0(t,e+t.fractionLeadingZeros|0):t.integerLength>e?this.toSimpleFormat_0(this.toExponential_0(t,e-1|0),e-1|0):this.toFixedFormat_0(t,e-t.integerLength|0)},lp.prototype.toFixedFormat_0=function(t,e){if(void 0===e&&(e=0),e<=0)return new yp(be(t.number).toString());var n=this.roundToPrecision_0(t,e),i=t.integerLength=0?"+":"")+I(t.exponent):"",i=fp().createNumberInfo_yjmjg9$(t.integerPart.toNumber()+t.fractionalPart.toNumber()/fp().MAX_DECIMAL_VALUE_8be2vx$.toNumber());return e>-1?this.toFixedFormat_0(i,e).copy_6hosri$(void 0,void 0,n):new yp(i.integerPart.toString(),l(i.fractionalPart,z)?"":i.fractionString,n)},lp.prototype.toSiFormat_0=function(t,e){var n;void 0===e&&(e=-1);var i=(null!=(n=(null==t.exponent?this.toExponential_0(t,e-1|0):t).exponent)?n:0)/3,r=3*Lt(Ce(Ee(f.floor(i),-8),8))|0,o=fp(),a=t.number,s=0|-r,l=o.createNumberInfo_yjmjg9$(a*f.pow(10,s)),u=8+(r/3|0)|0,c=kp().SI_SUFFIXES_0[u];return this.toFixedFormat_0(l,e-l.integerLength|0).copy_6hosri$(void 0,void 0,c)},lp.prototype.roundToPrecision_0=function(t,n){var i;void 0===n&&(n=0);var r,o,a=n+(null!=(i=t.exponent)?i:0)|0;if(a<0){r=z;var s=Nt(a);o=t.integerLength<=s?z:t.integerPart.div(e.Long.fromNumber(f.pow(10,s))).multiply(e.Long.fromNumber(f.pow(10,s)))}else{var u=fp().MAX_DECIMAL_VALUE_8be2vx$.div(e.Long.fromNumber(f.pow(10,a)));r=l(u,z)?t.fractionalPart:be(t.fractionalPart.toNumber()/u.toNumber()).multiply(u),o=t.integerPart,l(r,fp().MAX_DECIMAL_VALUE_8be2vx$)&&(r=z,o=o.inc())}var c=o.toNumber()+r.toNumber()/fp().MAX_DECIMAL_VALUE_8be2vx$.toNumber();return t.copy_xz9h4k$(c,void 0,o,r)},lp.prototype.trimFraction_0=function(t){var n=!this.spec_0.trim;if(n||(n=0===t.body.fractionalPart.length),n)return t;var i=me(t.body.fractionalPart,e.charArrayOf(48));return t.copy_rm1j3u$(t.body.copy_6hosri$(void 0,i))},lp.prototype.computeSign_0=function(t,e){var n,i=t.body,r=Te(Se(i.integerPart),Se(i.fractionalPart));t:do{var o;for(o=r.iterator();o.hasNext();){var a=o.next();if(48!==nt(a)){n=!1;break t}}n=!0}while(0);var s=n,u=e.negative&&!s?"-":l(this.spec_0.sign,"-")?"":this.spec_0.sign;return t.copy_rm1j3u$(void 0,u)},lp.prototype.computePrefix_0=function(t){var e;switch(this.spec_0.symbol){case"$":e=kp().CURRENCY_0;break;case"#":e=Oe("boxX",this.spec_0.type)>-1?"0"+this.spec_0.type.toLowerCase():"";break;default:e=""}var n=e;return t.copy_rm1j3u$(void 0,void 0,n)},lp.prototype.computeSuffix_0=function(t){var e=kp().PERCENT_0,n=l(this.spec_0.type,"%")?e:null;return t.copy_rm1j3u$(void 0,void 0,void 0,null!=n?n:"")},lp.prototype.computePadding_0=function(t){var e=t.sign.length+t.prefix.length+t.body.fullLength+t.suffix.length|0,n=e",null!=(s=null!=(a=m.groups.get_za3lpa$(3))?a.value:null)?s:"-",null!=(u=null!=(l=m.groups.get_za3lpa$(4))?l.value:null)?u:"",null!=m.groups.get_za3lpa$(5),L(null!=(p=null!=(c=m.groups.get_za3lpa$(6))?c.value:null)?p:"-1"),null!=m.groups.get_za3lpa$(7),L(null!=(_=null!=(h=m.groups.get_za3lpa$(8))?h.value:null)?_:"6"),null!=(d=null!=(f=m.groups.get_za3lpa$(9))?f.value:null)?d:"")},$p.prototype.group_0=function(t){var n,i,r=Pe(jt(Ne(Se(Ae(e.isCharSequence(n=t)?n:E()).toString()),3),vp),this.COMMA_0);return Ae(e.isCharSequence(i=r)?i:E()).toString()},$p.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var gp,bp,wp,xp=null;function kp(){return null===xp&&new $p,xp}function Ep(t,e){return e=e||Object.create(lp.prototype),lp.call(e,kp().create_61zpoe$(t)),e}function Cp(t){Kp.call(this),this.myParent_2riath$_0=t,this.addListener_n5no9j$(new Op)}function Sp(t,e){this.closure$item=t,this.this$ChildList=e}function Tp(t,e){this.this$ChildList=t,this.closure$index=e}function Op(){jp.call(this)}function Np(){}function Pp(){}function Ap(){this.myParent_eaa9sw$_0=new gh,this.myPositionData_2io8uh$_0=null}function jp(){}function Lp(t,e,n,i){if(this.oldItem=t,this.newItem=e,this.index=n,this.type=i,zp()===this.type&&null!=this.oldItem||Mp()===this.type&&null!=this.newItem)throw et()}function Rp(t,e){C.call(this),this.name$=t,this.ordinal$=e}function Ip(){Ip=function(){},gp=new Rp("ADD",0),bp=new Rp("SET",1),wp=new Rp("REMOVE",2)}function zp(){return Ip(),gp}function Dp(){return Ip(),bp}function Mp(){return Ip(),wp}function Bp(){}function Up(){}function Fp(){Le.call(this),this.myListeners_ky8jhb$_0=null}function qp(t){this.closure$event=t}function Gp(t){this.closure$event=t}function Hp(t){this.closure$event=t}function Yp(t){this.this$AbstractObservableList=t,fh.call(this)}function Vp(t){this.closure$handler=t}function Kp(){Fp.call(this),this.myContainer_2lyzpq$_0=null}function Wp(){}function Xp(){this.myHandlers_0=null,this.myEventSources_0=u(),this.myRegistrations_0=u()}function Zp(t){this.this$CompositeEventSource=t,fh.call(this)}function Jp(t){this.this$CompositeEventSource=t}function Qp(t){this.closure$event=t}function th(t,e){var n;for(e=e||Object.create(Xp.prototype),Xp.call(e),n=0;n!==t.length;++n){var i=t[n];e.add_5zt0a2$(i)}return e}function eh(t,e){var n;for(e=e||Object.create(Xp.prototype),Xp.call(e),n=t.iterator();n.hasNext();){var i=n.next();e.add_5zt0a2$(i)}return e}function nh(){}function ih(){}function rh(){ph=this}function oh(t){this.closure$events=t}function ah(t,e){this.closure$source=t,this.closure$pred=e}function sh(t,e){this.closure$pred=t,this.closure$handler=e}function lh(t,e){this.closure$list=t,this.closure$selector=e}function uh(t,e,n){this.closure$itemRegs=t,this.closure$selector=e,this.closure$handler=n,jp.call(this)}function ch(t,e){this.closure$itemRegs=t,this.closure$listReg=e,Dh.call(this)}lp.$metadata$={kind:$,simpleName:"NumberFormat",interfaces:[]},Cp.prototype.checkAdd_wxm5ur$=function(t,e){if(Kp.prototype.checkAdd_wxm5ur$.call(this,t,e),null!=e.parentProperty().get())throw O()},Object.defineProperty(Tp.prototype,"role",{configurable:!0,get:function(){return this.this$ChildList}}),Tp.prototype.get=function(){return this.this$ChildList.size<=this.closure$index?null:this.this$ChildList.get_za3lpa$(this.closure$index)},Tp.$metadata$={kind:$,interfaces:[Np]},Sp.prototype.get=function(){var t=this.this$ChildList.indexOf_11rb$(this.closure$item);return new Tp(this.this$ChildList,t)},Sp.prototype.remove=function(){this.this$ChildList.remove_11rb$(this.closure$item)},Sp.$metadata$={kind:$,interfaces:[Pp]},Cp.prototype.beforeItemAdded_wxm5ur$=function(t,e){e.parentProperty().set_11rb$(this.myParent_2riath$_0),e.setPositionData_uvvaqs$(new Sp(e,this))},Cp.prototype.checkSet_hu11d4$=function(t,e,n){Kp.prototype.checkSet_hu11d4$.call(this,t,e,n),this.checkRemove_wxm5ur$(t,e),this.checkAdd_wxm5ur$(t,n)},Cp.prototype.beforeItemSet_hu11d4$=function(t,e,n){this.beforeItemAdded_wxm5ur$(t,n)},Cp.prototype.checkRemove_wxm5ur$=function(t,e){if(Kp.prototype.checkRemove_wxm5ur$.call(this,t,e),e.parentProperty().get()!==this.myParent_2riath$_0)throw O()},Op.prototype.onItemAdded_u8tacu$=function(t){N(t.newItem).parentProperty().flush()},Op.prototype.onItemRemoved_u8tacu$=function(t){var e=t.oldItem;N(e).parentProperty().set_11rb$(null),e.setPositionData_uvvaqs$(null),e.parentProperty().flush()},Op.$metadata$={kind:$,interfaces:[jp]},Cp.$metadata$={kind:$,simpleName:"ChildList",interfaces:[Kp]},Np.$metadata$={kind:H,simpleName:"Position",interfaces:[]},Pp.$metadata$={kind:H,simpleName:"PositionData",interfaces:[]},Object.defineProperty(Ap.prototype,"position",{configurable:!0,get:function(){if(null==this.myPositionData_2io8uh$_0)throw et();return N(this.myPositionData_2io8uh$_0).get()}}),Ap.prototype.removeFromParent=function(){null!=this.myPositionData_2io8uh$_0&&N(this.myPositionData_2io8uh$_0).remove()},Ap.prototype.parentProperty=function(){return this.myParent_eaa9sw$_0},Ap.prototype.setPositionData_uvvaqs$=function(t){this.myPositionData_2io8uh$_0=t},Ap.$metadata$={kind:$,simpleName:"SimpleComposite",interfaces:[]},jp.prototype.onItemAdded_u8tacu$=function(t){},jp.prototype.onItemSet_u8tacu$=function(t){this.onItemRemoved_u8tacu$(new Lp(t.oldItem,null,t.index,Mp())),this.onItemAdded_u8tacu$(new Lp(null,t.newItem,t.index,zp()))},jp.prototype.onItemRemoved_u8tacu$=function(t){},jp.$metadata$={kind:$,simpleName:"CollectionAdapter",interfaces:[Bp]},Lp.prototype.dispatch_11rb$=function(t){zp()===this.type?t.onItemAdded_u8tacu$(this):Dp()===this.type?t.onItemSet_u8tacu$(this):t.onItemRemoved_u8tacu$(this)},Lp.prototype.toString=function(){return zp()===this.type?I(this.newItem)+" added at "+I(this.index):Dp()===this.type?I(this.oldItem)+" replaced with "+I(this.newItem)+" at "+I(this.index):I(this.oldItem)+" removed at "+I(this.index)},Lp.prototype.equals=function(t){var n;return this===t||!(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))&&(e.isType(t,Lp)||E(),!!l(this.oldItem,t.oldItem)&&!!l(this.newItem,t.newItem)&&this.index===t.index&&this.type===t.type)},Lp.prototype.hashCode=function(){var t,e,n,i,r=null!=(e=null!=(t=this.oldItem)?P(t):null)?e:0;return(31*(r=(31*(r=(31*r|0)+(null!=(i=null!=(n=this.newItem)?P(n):null)?i:0)|0)|0)+this.index|0)|0)+this.type.hashCode()|0},Rp.$metadata$={kind:$,simpleName:"EventType",interfaces:[C]},Rp.values=function(){return[zp(),Dp(),Mp()]},Rp.valueOf_61zpoe$=function(t){switch(t){case"ADD":return zp();case"SET":return Dp();case"REMOVE":return Mp();default:S("No enum constant jetbrains.datalore.base.observable.collections.CollectionItemEvent.EventType."+t)}},Lp.$metadata$={kind:$,simpleName:"CollectionItemEvent",interfaces:[_h]},Bp.$metadata$={kind:H,simpleName:"CollectionListener",interfaces:[]},Up.$metadata$={kind:H,simpleName:"ObservableCollection",interfaces:[ih,je]},Fp.prototype.checkAdd_wxm5ur$=function(t,e){if(t<0||t>this.size)throw new _t("Add: index="+t+", size="+this.size)},Fp.prototype.checkSet_hu11d4$=function(t,e,n){if(t<0||t>=this.size)throw new _t("Set: index="+t+", size="+this.size)},Fp.prototype.checkRemove_wxm5ur$=function(t,e){if(t<0||t>=this.size)throw new _t("Remove: index="+t+", size="+this.size)},qp.prototype.call_11rb$=function(t){t.onItemAdded_u8tacu$(this.closure$event)},qp.$metadata$={kind:$,interfaces:[hh]},Fp.prototype.add_wxm5ur$=function(t,e){this.checkAdd_wxm5ur$(t,e),this.beforeItemAdded_wxm5ur$(t,e);var n=!1;try{if(this.doAdd_wxm5ur$(t,e),n=!0,this.onItemAdd_wxm5ur$(t,e),null!=this.myListeners_ky8jhb$_0){var i=new Lp(null,e,t,zp());N(this.myListeners_ky8jhb$_0).fire_kucmxw$(new qp(i))}}finally{this.afterItemAdded_5x52oa$(t,e,n)}},Fp.prototype.beforeItemAdded_wxm5ur$=function(t,e){},Fp.prototype.onItemAdd_wxm5ur$=function(t,e){},Fp.prototype.afterItemAdded_5x52oa$=function(t,e,n){},Gp.prototype.call_11rb$=function(t){t.onItemSet_u8tacu$(this.closure$event)},Gp.$metadata$={kind:$,interfaces:[hh]},Fp.prototype.set_wxm5ur$=function(t,e){var n=this.get_za3lpa$(t);this.checkSet_hu11d4$(t,n,e),this.beforeItemSet_hu11d4$(t,n,e);var i=!1;try{if(this.doSet_wxm5ur$(t,e),i=!0,this.onItemSet_hu11d4$(t,n,e),null!=this.myListeners_ky8jhb$_0){var r=new Lp(n,e,t,Dp());N(this.myListeners_ky8jhb$_0).fire_kucmxw$(new Gp(r))}}finally{this.afterItemSet_yk9x8x$(t,n,e,i)}return n},Fp.prototype.doSet_wxm5ur$=function(t,e){this.doRemove_za3lpa$(t),this.doAdd_wxm5ur$(t,e)},Fp.prototype.beforeItemSet_hu11d4$=function(t,e,n){},Fp.prototype.onItemSet_hu11d4$=function(t,e,n){},Fp.prototype.afterItemSet_yk9x8x$=function(t,e,n,i){},Hp.prototype.call_11rb$=function(t){t.onItemRemoved_u8tacu$(this.closure$event)},Hp.$metadata$={kind:$,interfaces:[hh]},Fp.prototype.removeAt_za3lpa$=function(t){var e=this.get_za3lpa$(t);this.checkRemove_wxm5ur$(t,e),this.beforeItemRemoved_wxm5ur$(t,e);var n=!1;try{if(this.doRemove_za3lpa$(t),n=!0,this.onItemRemove_wxm5ur$(t,e),null!=this.myListeners_ky8jhb$_0){var i=new Lp(e,null,t,Mp());N(this.myListeners_ky8jhb$_0).fire_kucmxw$(new Hp(i))}}finally{this.afterItemRemoved_5x52oa$(t,e,n)}return e},Fp.prototype.beforeItemRemoved_wxm5ur$=function(t,e){},Fp.prototype.onItemRemove_wxm5ur$=function(t,e){},Fp.prototype.afterItemRemoved_5x52oa$=function(t,e,n){},Yp.prototype.beforeFirstAdded=function(){this.this$AbstractObservableList.onListenersAdded()},Yp.prototype.afterLastRemoved=function(){this.this$AbstractObservableList.myListeners_ky8jhb$_0=null,this.this$AbstractObservableList.onListenersRemoved()},Yp.$metadata$={kind:$,interfaces:[fh]},Fp.prototype.addListener_n5no9j$=function(t){return null==this.myListeners_ky8jhb$_0&&(this.myListeners_ky8jhb$_0=new Yp(this)),N(this.myListeners_ky8jhb$_0).add_11rb$(t)},Vp.prototype.onItemAdded_u8tacu$=function(t){this.closure$handler.onEvent_11rb$(t)},Vp.prototype.onItemSet_u8tacu$=function(t){this.closure$handler.onEvent_11rb$(t)},Vp.prototype.onItemRemoved_u8tacu$=function(t){this.closure$handler.onEvent_11rb$(t)},Vp.$metadata$={kind:$,interfaces:[Bp]},Fp.prototype.addHandler_gxwwpc$=function(t){var e=new Vp(t);return this.addListener_n5no9j$(e)},Fp.prototype.onListenersAdded=function(){},Fp.prototype.onListenersRemoved=function(){},Fp.$metadata$={kind:$,simpleName:"AbstractObservableList",interfaces:[Wp,Le]},Object.defineProperty(Kp.prototype,"size",{configurable:!0,get:function(){return null==this.myContainer_2lyzpq$_0?0:N(this.myContainer_2lyzpq$_0).size}}),Kp.prototype.get_za3lpa$=function(t){if(null==this.myContainer_2lyzpq$_0)throw new _t(t.toString());return N(this.myContainer_2lyzpq$_0).get_za3lpa$(t)},Kp.prototype.doAdd_wxm5ur$=function(t,e){this.ensureContainerInitialized_mjxwec$_0(),N(this.myContainer_2lyzpq$_0).add_wxm5ur$(t,e)},Kp.prototype.doSet_wxm5ur$=function(t,e){N(this.myContainer_2lyzpq$_0).set_wxm5ur$(t,e)},Kp.prototype.doRemove_za3lpa$=function(t){N(this.myContainer_2lyzpq$_0).removeAt_za3lpa$(t),N(this.myContainer_2lyzpq$_0).isEmpty()&&(this.myContainer_2lyzpq$_0=null)},Kp.prototype.ensureContainerInitialized_mjxwec$_0=function(){null==this.myContainer_2lyzpq$_0&&(this.myContainer_2lyzpq$_0=h(1))},Kp.$metadata$={kind:$,simpleName:"ObservableArrayList",interfaces:[Fp]},Wp.$metadata$={kind:H,simpleName:"ObservableList",interfaces:[Up,Re]},Xp.prototype.add_5zt0a2$=function(t){this.myEventSources_0.add_11rb$(t)},Xp.prototype.remove_r5wlyb$=function(t){var n,i=this.myEventSources_0;(e.isType(n=i,je)?n:E()).remove_11rb$(t)},Zp.prototype.beforeFirstAdded=function(){var t;for(t=this.this$CompositeEventSource.myEventSources_0.iterator();t.hasNext();){var e=t.next();this.this$CompositeEventSource.addHandlerTo_0(e)}},Zp.prototype.afterLastRemoved=function(){var t;for(t=this.this$CompositeEventSource.myRegistrations_0.iterator();t.hasNext();)t.next().remove();this.this$CompositeEventSource.myRegistrations_0.clear(),this.this$CompositeEventSource.myHandlers_0=null},Zp.$metadata$={kind:$,interfaces:[fh]},Xp.prototype.addHandler_gxwwpc$=function(t){return null==this.myHandlers_0&&(this.myHandlers_0=new Zp(this)),N(this.myHandlers_0).add_11rb$(t)},Qp.prototype.call_11rb$=function(t){t.onEvent_11rb$(this.closure$event)},Qp.$metadata$={kind:$,interfaces:[hh]},Jp.prototype.onEvent_11rb$=function(t){N(this.this$CompositeEventSource.myHandlers_0).fire_kucmxw$(new Qp(t))},Jp.$metadata$={kind:$,interfaces:[nh]},Xp.prototype.addHandlerTo_0=function(t){this.myRegistrations_0.add_11rb$(t.addHandler_gxwwpc$(new Jp(this)))},Xp.$metadata$={kind:$,simpleName:"CompositeEventSource",interfaces:[ih]},nh.$metadata$={kind:H,simpleName:"EventHandler",interfaces:[]},ih.$metadata$={kind:H,simpleName:"EventSource",interfaces:[]},oh.prototype.addHandler_gxwwpc$=function(t){var e,n;for(e=this.closure$events,n=0;n!==e.length;++n){var i=e[n];t.onEvent_11rb$(i)}return Gh().EMPTY},oh.$metadata$={kind:$,interfaces:[ih]},rh.prototype.of_i5x0yv$=function(t){return new oh(t)},rh.prototype.empty_287e2$=function(){return this.composite_xw2ruy$([])},rh.prototype.composite_xw2ruy$=function(t){return th(t.slice())},rh.prototype.composite_3qo2qg$=function(t){return eh(t)},sh.prototype.onEvent_11rb$=function(t){this.closure$pred(t)&&this.closure$handler.onEvent_11rb$(t)},sh.$metadata$={kind:$,interfaces:[nh]},ah.prototype.addHandler_gxwwpc$=function(t){return this.closure$source.addHandler_gxwwpc$(new sh(this.closure$pred,t))},ah.$metadata$={kind:$,interfaces:[ih]},rh.prototype.filter_ff3xdm$=function(t,e){return new ah(t,e)},rh.prototype.map_9hq6p$=function(t,e){return new yh(t,e)},uh.prototype.onItemAdded_u8tacu$=function(t){this.closure$itemRegs.add_wxm5ur$(t.index,this.closure$selector(t.newItem).addHandler_gxwwpc$(this.closure$handler))},uh.prototype.onItemRemoved_u8tacu$=function(t){this.closure$itemRegs.removeAt_za3lpa$(t.index).remove()},uh.$metadata$={kind:$,interfaces:[jp]},ch.prototype.doRemove=function(){var t;for(t=this.closure$itemRegs.iterator();t.hasNext();)t.next().remove();this.closure$listReg.remove()},ch.$metadata$={kind:$,interfaces:[Dh]},lh.prototype.addHandler_gxwwpc$=function(t){var e,n=u();for(e=this.closure$list.iterator();e.hasNext();){var i=e.next();n.add_11rb$(this.closure$selector(i).addHandler_gxwwpc$(t))}return new ch(n,this.closure$list.addListener_n5no9j$(new uh(n,this.closure$selector,t)))},lh.$metadata$={kind:$,interfaces:[ih]},rh.prototype.selectList_jnjwvc$=function(t,e){return new lh(t,e)},rh.$metadata$={kind:y,simpleName:"EventSources",interfaces:[]};var ph=null;function hh(){}function _h(){}function fh(){this.myListeners_30lqoe$_0=null,this.myFireDepth_t4vnc0$_0=0,this.myListenersCount_umrzvt$_0=0}function dh(t,e){this.this$Listeners=t,this.closure$l=e,Dh.call(this)}function mh(t,e){this.listener=t,this.add=e}function yh(t,e){this.mySourceEventSource_0=t,this.myFunction_0=e}function $h(t,e){this.closure$handler=t,this.this$MappingEventSource=e}function vh(){this.propExpr_4jt19b$_0=e.getKClassFromExpression(this).toString()}function gh(t){void 0===t&&(t=null),vh.call(this),this.myValue_0=t,this.myHandlers_0=null,this.myPendingEvent_0=null}function bh(t){this.this$DelayedValueProperty=t}function wh(t){this.this$DelayedValueProperty=t,fh.call(this)}function xh(){}function kh(){Sh=this}function Eh(t){this.closure$target=t}function Ch(t,e,n,i){this.closure$syncing=t,this.closure$target=e,this.closure$source=n,this.myForward_0=i}hh.$metadata$={kind:H,simpleName:"ListenerCaller",interfaces:[]},_h.$metadata$={kind:H,simpleName:"ListenerEvent",interfaces:[]},Object.defineProperty(fh.prototype,"isEmpty",{configurable:!0,get:function(){return null==this.myListeners_30lqoe$_0||N(this.myListeners_30lqoe$_0).isEmpty()}}),dh.prototype.doRemove=function(){var t,n;this.this$Listeners.myFireDepth_t4vnc0$_0>0?N(this.this$Listeners.myListeners_30lqoe$_0).add_11rb$(new mh(this.closure$l,!1)):(N(this.this$Listeners.myListeners_30lqoe$_0).remove_11rb$(e.isType(t=this.closure$l,re)?t:E()),n=this.this$Listeners.myListenersCount_umrzvt$_0,this.this$Listeners.myListenersCount_umrzvt$_0=n-1|0),this.this$Listeners.isEmpty&&this.this$Listeners.afterLastRemoved()},dh.$metadata$={kind:$,interfaces:[Dh]},fh.prototype.add_11rb$=function(t){var n;return this.isEmpty&&this.beforeFirstAdded(),this.myFireDepth_t4vnc0$_0>0?N(this.myListeners_30lqoe$_0).add_11rb$(new mh(t,!0)):(null==this.myListeners_30lqoe$_0&&(this.myListeners_30lqoe$_0=h(1)),N(this.myListeners_30lqoe$_0).add_11rb$(e.isType(n=t,re)?n:E()),this.myListenersCount_umrzvt$_0=this.myListenersCount_umrzvt$_0+1|0),new dh(this,t)},fh.prototype.fire_kucmxw$=function(t){var n;if(!this.isEmpty){this.beforeFire_ul1jia$_0();try{for(var i=this.myListenersCount_umrzvt$_0,r=0;r "+I(this.newValue)},Th.prototype.equals=function(t){var n;return this===t||!(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))&&(e.isType(t,Th)||E(),!!l(this.oldValue,t.oldValue)&&!!l(this.newValue,t.newValue))},Th.prototype.hashCode=function(){var t,e,n,i,r=null!=(e=null!=(t=this.oldValue)?P(t):null)?e:0;return(31*r|0)+(null!=(i=null!=(n=this.newValue)?P(n):null)?i:0)|0},Th.$metadata$={kind:$,simpleName:"PropertyChangeEvent",interfaces:[]},Oh.$metadata$={kind:H,simpleName:"ReadableProperty",interfaces:[Vl,ih]},Object.defineProperty(Nh.prototype,"propExpr",{configurable:!0,get:function(){return"valueProperty()"}}),Nh.prototype.get=function(){return this.myValue_x0fqz2$_0},Nh.prototype.set_11rb$=function(t){if(!l(t,this.myValue_x0fqz2$_0)){var e=this.myValue_x0fqz2$_0;this.myValue_x0fqz2$_0=t,this.fireEvents_ym4swk$_0(e,this.myValue_x0fqz2$_0)}},Ph.prototype.call_11rb$=function(t){t.onEvent_11rb$(this.closure$event)},Ph.$metadata$={kind:$,interfaces:[hh]},Nh.prototype.fireEvents_ym4swk$_0=function(t,e){if(null!=this.myHandlers_sdxgfs$_0){var n=new Th(t,e);N(this.myHandlers_sdxgfs$_0).fire_kucmxw$(new Ph(n))}},Ah.prototype.afterLastRemoved=function(){this.this$ValueProperty.myHandlers_sdxgfs$_0=null},Ah.$metadata$={kind:$,interfaces:[fh]},Nh.prototype.addHandler_gxwwpc$=function(t){return null==this.myHandlers_sdxgfs$_0&&(this.myHandlers_sdxgfs$_0=new Ah(this)),N(this.myHandlers_sdxgfs$_0).add_11rb$(t)},Nh.$metadata$={kind:$,simpleName:"ValueProperty",interfaces:[xh,vh]},jh.$metadata$={kind:H,simpleName:"WritableProperty",interfaces:[]},Lh.prototype.randomString_za3lpa$=function(t){for(var e=ze(yt(new Gt(97,122),new Gt(65,90)),new Gt(48,57)),n=h(t),i=0;i=0;t--)this.myRegistrations_0.get_za3lpa$(t).remove();this.myRegistrations_0.clear()},Ih.$metadata$={kind:$,simpleName:"CompositeRegistration",interfaces:[Dh]},zh.$metadata$={kind:H,simpleName:"Disposable",interfaces:[]},Dh.prototype.remove=function(){if(this.myRemoved_guv51v$_0)throw _("Registration already removed");this.myRemoved_guv51v$_0=!0,this.doRemove()},Dh.prototype.dispose=function(){this.remove()},Mh.prototype.doRemove=function(){},Mh.prototype.remove=function(){},Mh.$metadata$={kind:$,simpleName:"EmptyRegistration",interfaces:[Dh]},Uh.prototype.doRemove=function(){this.closure$disposable.dispose()},Uh.$metadata$={kind:$,interfaces:[Dh]},Bh.prototype.from_gg3y3y$=function(t){return new Uh(t)},Fh.prototype.doRemove=function(){var t,e;for(t=this.closure$disposables,e=0;e!==t.length;++e)t[e].dispose()},Fh.$metadata$={kind:$,interfaces:[Dh]},Bh.prototype.from_h9hjd7$=function(t){return new Fh(t)},Bh.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var qh=null;function Gh(){return null===qh&&new Bh,qh}function Hh(){}function Yh(){Qh=this,this.instance=new Hh}Dh.$metadata$={kind:$,simpleName:"Registration",interfaces:[zh]},Hh.prototype.handle_tcv7n7$=function(t){throw t},Hh.$metadata$={kind:$,simpleName:"ThrowableHandler",interfaces:[]},Yh.$metadata$={kind:y,simpleName:"ThrowableHandlers",interfaces:[]};var Vh,Kh,Wh,Xh,Zh,Jh,Qh=null;function t_(){return null===Qh&&new Yh,Qh}var e_=Q((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(n),r(i))}}}));function n_(t){return t.first}function i_(t){return t.second}function r_(t,e,n){l_(),this.myMapRect_0=t,this.myLoopX_0=e,this.myLoopY_0=n}function o_(){s_=this}function a_(t,e){return new Ql(f.min(t,e),f.max(t,e))}r_.prototype.calculateBoundingBox_qpfwx8$=function(t,e){var n=this.calculateBoundingRange_0(t,Zf(this.myMapRect_0),this.myLoopX_0),i=this.calculateBoundingRange_0(e,Jf(this.myMapRect_0),this.myLoopY_0);return fd(n.lowerEnd,i.lowerEnd,l_().length_0(n),l_().length_0(i))},r_.prototype.calculateBoundingRange_0=function(t,e,n){return n?l_().calculateLoopLimitRange_h7l5yb$(t,e):new Ql(N(Ue(jt(t,c("start",1,(function(t){return n_(t)}))))),N(Fe(jt(t,c("end",1,(function(t){return i_(t)}))))))},o_.prototype.calculateLoopLimitRange_h7l5yb$=function(t,e){return this.normalizeCenter_0(this.invertRange_0(this.findMaxGapBetweenRanges_0(qe(jt(t,(n=e,function(t){return k_().splitSegment_6y0v78$(n_(t),i_(t),n.lowerEnd,n.upperEnd)}))),this.length_0(e)),this.length_0(e)),e);var n},o_.prototype.normalizeCenter_0=function(t,e){return e.contains_mef7kx$((t.upperEnd+t.lowerEnd)/2)?t:new Ql(t.lowerEnd-this.length_0(e),t.upperEnd-this.length_0(e))},o_.prototype.findMaxGapBetweenRanges_0=function(t,n){var i,r=Ye(t,new wt(e_(c("lowerEnd",1,(function(t){return t.lowerEnd}))))),o=c("upperEnd",1,(function(t){return t.upperEnd}));t:do{var a=r.iterator();if(!a.hasNext()){i=null;break t}var s=a.next();if(!a.hasNext()){i=s;break t}var l=o(s);do{var u=a.next(),p=o(u);e.compareTo(l,p)<0&&(s=u,l=p)}while(a.hasNext());i=s}while(0);var h=N(i).upperEnd,_=Ge(r).lowerEnd,d=n+_,m=h,y=new Ql(h,f.max(d,m)),$=r.iterator();for(h=$.next().upperEnd;$.hasNext();){var v=$.next();(_=v.lowerEnd)>h&&_-h>this.length_0(y)&&(y=new Ql(h,_));var g=h,b=v.upperEnd;h=f.max(g,b)}return y},o_.prototype.invertRange_0=function(t,e){var n=a_;return this.length_0(t)>e?new Ql(t.lowerEnd,t.lowerEnd):t.upperEnd>e?n(t.upperEnd-e,t.lowerEnd):n(t.upperEnd,e+t.lowerEnd)},o_.prototype.length_0=function(t){return t.upperEnd-t.lowerEnd},o_.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var s_=null;function l_(){return null===s_&&new o_,s_}function u_(t,e,n){return jt(Mt(b(0,n)),(i=t,r=e,function(t){return new He(i(t),r(t))}));var i,r}function c_(){m_=this,this.LON_INDEX_0=0,this.LAT_INDEX_0=1}function p_(){}function h_(t){return l(t.getString_61zpoe$("type"),"Feature")}function __(t){return t.getObject_61zpoe$("geometry")}r_.$metadata$={kind:$,simpleName:"GeoBoundingBoxCalculator",interfaces:[]},c_.prototype.parse_gdwatq$=function(t,e){var n=Gu(vc().parseJson_61zpoe$(t)),i=new G_;e(i);var r=i;(new p_).parse_m8ausf$(n,r)},c_.prototype.parse_4mzk4t$=function(t,e){var n=Gu(vc().parseJson_61zpoe$(t));(new p_).parse_m8ausf$(n,e)},p_.prototype.parse_m8ausf$=function(t,e){var n=t.getString_61zpoe$("type");switch(n){case"FeatureCollection":var i;if(!t.contains_61zpoe$("features"))throw v("GeoJson: Missing 'features' in 'FeatureCollection'".toString());for(i=jt(Ve(t.getArray_61zpoe$("features").fluentObjectStream(),h_),__).iterator();i.hasNext();){var r=i.next();this.parse_m8ausf$(r,e)}break;case"GeometryCollection":var o;if(!t.contains_61zpoe$("geometries"))throw v("GeoJson: Missing 'geometries' in 'GeometryCollection'".toString());for(o=t.getArray_61zpoe$("geometries").fluentObjectStream().iterator();o.hasNext();){var a=o.next();this.parse_m8ausf$(a,e)}break;default:if(!t.contains_61zpoe$("coordinates"))throw v(("GeoJson: Missing 'coordinates' in "+n).toString());var s=t.getArray_61zpoe$("coordinates");switch(n){case"Point":var l=this.parsePoint_0(s);At("onPoint",function(t,e){return t.onPoint_adb7pk$(e),Pt}.bind(null,e))(l);break;case"LineString":var u=this.parseLineString_0(s);At("onLineString",function(t,e){return t.onLineString_1u6eph$(e),Pt}.bind(null,e))(u);break;case"Polygon":var c=this.parsePolygon_0(s);At("onPolygon",function(t,e){return t.onPolygon_z3kb82$(e),Pt}.bind(null,e))(c);break;case"MultiPoint":var p=this.parseMultiPoint_0(s);At("onMultiPoint",function(t,e){return t.onMultiPoint_oeq1z7$(e),Pt}.bind(null,e))(p);break;case"MultiLineString":var h=this.parseMultiLineString_0(s);At("onMultiLineString",function(t,e){return t.onMultiLineString_6n275e$(e),Pt}.bind(null,e))(h);break;case"MultiPolygon":var f=this.parseMultiPolygon_0(s);At("onMultiPolygon",function(t,e){return t.onMultiPolygon_a0zxnd$(e),Pt}.bind(null,e))(f);break;default:throw _(("Not support GeoJson type: "+n).toString())}}},p_.prototype.parsePoint_0=function(t){return $d(t.getDouble_za3lpa$(0),t.getDouble_za3lpa$(1))},p_.prototype.parseLineString_0=function(t){return new ld(this.mapArray_0(t,At("parsePoint",function(t,e){return t.parsePoint_0(e)}.bind(null,this))))},p_.prototype.parseRing_0=function(t){return new dd(this.mapArray_0(t,At("parsePoint",function(t,e){return t.parsePoint_0(e)}.bind(null,this))))},p_.prototype.parseMultiPoint_0=function(t){return new cd(this.mapArray_0(t,At("parsePoint",function(t,e){return t.parsePoint_0(e)}.bind(null,this))))},p_.prototype.parsePolygon_0=function(t){return new hd(this.mapArray_0(t,At("parseRing",function(t,e){return t.parseRing_0(e)}.bind(null,this))))},p_.prototype.parseMultiLineString_0=function(t){return new ud(this.mapArray_0(t,At("parseLineString",function(t,e){return t.parseLineString_0(e)}.bind(null,this))))},p_.prototype.parseMultiPolygon_0=function(t){return new pd(this.mapArray_0(t,At("parsePolygon",function(t,e){return t.parsePolygon_0(e)}.bind(null,this))))},p_.prototype.mapArray_0=function(t,n){return Ke(jt(t.stream(),(i=n,function(t){var n;return i(Fu(e.isType(n=t,$t)?n:E()))})));var i},p_.$metadata$={kind:$,simpleName:"Parser",interfaces:[]},c_.$metadata$={kind:y,simpleName:"GeoJson",interfaces:[]};var f_,d_,m_=null;function y_(t,e,n,i){if(this.myLongitudeSegment_0=null,this.myLatitudeRange_0=null,!(e<=i))throw v(("Invalid latitude range: ["+e+".."+i+"]").toString());this.myLongitudeSegment_0=new b_(t,n),this.myLatitudeRange_0=new Ql(e,i)}function $_(t){var e=Kh,n=Wh,i=f.min(t,n);return f.max(e,i)}function v_(t){var e=Zh,n=Jh,i=f.min(t,n);return f.max(e,i)}function g_(t){var e=t-Lt(t/Xh)*Xh;return e>Wh&&(e-=Xh),e<-Wh&&(e+=Xh),e}function b_(t,e){k_(),this.myStart_0=$_(t),this.myEnd_0=$_(e)}function w_(){x_=this}Object.defineProperty(y_.prototype,"isEmpty",{configurable:!0,get:function(){return this.myLongitudeSegment_0.isEmpty&&this.latitudeRangeIsEmpty_0(this.myLatitudeRange_0)}}),y_.prototype.latitudeRangeIsEmpty_0=function(t){return t.upperEnd===t.lowerEnd},y_.prototype.startLongitude=function(){return this.myLongitudeSegment_0.start()},y_.prototype.endLongitude=function(){return this.myLongitudeSegment_0.end()},y_.prototype.minLatitude=function(){return this.myLatitudeRange_0.lowerEnd},y_.prototype.maxLatitude=function(){return this.myLatitudeRange_0.upperEnd},y_.prototype.encloses_emtjl$=function(t){return this.myLongitudeSegment_0.encloses_moa7dh$(t.myLongitudeSegment_0)&&this.myLatitudeRange_0.encloses_d226ot$(t.myLatitudeRange_0)},y_.prototype.splitByAntiMeridian=function(){var t,e=u();for(t=this.myLongitudeSegment_0.splitByAntiMeridian().iterator();t.hasNext();){var n=t.next();e.add_11rb$(Wf(new yd(n.lowerEnd,this.myLatitudeRange_0.lowerEnd),new yd(n.upperEnd,this.myLatitudeRange_0.upperEnd)))}return e},y_.prototype.equals=function(t){var n,i,r,o;if(this===t)return!0;if(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))return!1;var a=null==(i=t)||e.isType(i,y_)?i:E();return(null!=(r=this.myLongitudeSegment_0)?r.equals(N(a).myLongitudeSegment_0):null)&&(null!=(o=this.myLatitudeRange_0)?o.equals(a.myLatitudeRange_0):null)},y_.prototype.hashCode=function(){return P(st([this.myLongitudeSegment_0,this.myLatitudeRange_0]))},y_.$metadata$={kind:$,simpleName:"GeoRectangle",interfaces:[]},Object.defineProperty(b_.prototype,"isEmpty",{configurable:!0,get:function(){return this.myEnd_0===this.myStart_0}}),b_.prototype.start=function(){return this.myStart_0},b_.prototype.end=function(){return this.myEnd_0},b_.prototype.length=function(){return this.myEnd_0-this.myStart_0+(this.myEnd_0=1;o--){var a=48,s=1<0?r(t):null})));break;default:i=e.noWhenBranchMatched()}this.myNumberFormatters_0=i,this.argsNumber=this.myNumberFormatters_0.size}function pf(t,e){C.call(this),this.name$=t,this.ordinal$=e}function hf(){hf=function(){},sf=new pf("NUMBER_FORMAT",0),lf=new pf("STRING_FORMAT",1)}function _f(){return hf(),sf}function ff(){return hf(),lf}function df(){vf=this,this.BRACES_REGEX_0=T("(?![^{]|\\{\\{)(\\{([^{}]*)\\})(?=[^}]|\\}\\}|$)"),this.TEXT_IN_BRACES=2}pf.$metadata$={kind:$,simpleName:"FormatType",interfaces:[C]},pf.values=function(){return[_f(),ff()]},pf.valueOf_61zpoe$=function(t){switch(t){case"NUMBER_FORMAT":return _f();case"STRING_FORMAT":return ff();default:S("No enum constant jetbrains.datalore.base.stringFormat.StringFormat.FormatType."+t)}},cf.prototype.format_za3rmp$=function(t){return this.format_pqjuzw$(We(t))},cf.prototype.format_pqjuzw$=function(t){var n;if(this.argsNumber!==t.size)throw _(("Can't format values "+t+' with pattern "'+this.pattern_0+'"). Wrong number of arguments: expected '+this.argsNumber+" instead of "+t.size).toString());t:switch(this.formatType.name){case"NUMBER_FORMAT":if(1!==this.myNumberFormatters_0.size)throw v("Failed requirement.".toString());n=this.formatValue_0(Xe(t),Xe(this.myNumberFormatters_0));break t;case"STRING_FORMAT":var i,r={v:0},o=gf().BRACES_REGEX_0,a=this.pattern_0;e:do{var s=o.find_905azu$(a);if(null==s){i=a.toString();break e}var l=0,u=a.length,c=Je(u);do{var p=N(s);c.append_ezbsdh$(a,l,p.range.start);var h,f=c.append_gw00v9$,d=t.get_za3lpa$(r.v),m=this.myNumberFormatters_0.get_za3lpa$((h=r.v,r.v=h+1|0,h));f.call(c,this.formatValue_0(d,m)),l=p.range.endInclusive+1|0,s=p.next()}while(l0&&r.argsNumber!==i){var o,a="Wrong number of arguments in pattern '"+t+"' "+(null!=(o=null!=n?"to format '"+I(n)+"'":null)?o:"")+". Expected "+i+" "+(i>1?"arguments":"argument")+" instead of "+r.argsNumber;throw v(a.toString())}return r},df.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var mf,yf,$f,vf=null;function gf(){return null===vf&&new df,vf}function bf(t){try{return Ep(t)}catch(n){throw e.isType(n,Kt)?_(("Wrong number pattern: "+t).toString()):n}}function wf(t){return t.groupValues.get_za3lpa$(2)}function xf(t){tn.call(this),this.myGeometry_8dt6c9$_0=t}function kf(t){return mn(t,c("x",1,(function(t){return t.x})),c("y",1,(function(t){return t.y})))}function Ef(t,e,n,i){return Wf(new yd(t,e),new yd(n,i))}function Cf(t){return Tu().calculateBoundingBox_h5l7ap$(t,c("x",1,(function(t){return t.x})),c("y",1,(function(t){return t.y})),Ef)}function Sf(t){return t.origin.y+t.dimension.y}function Tf(t){return t.origin.x+t.dimension.x}function Of(t){return t.dimension.y}function Nf(t){return t.dimension.x}function Pf(t){return t.origin.y}function Af(t){return t.origin.x}function jf(t){return new md(Sf(t))}function Lf(t){return new md(Of(t))}function Rf(t){return new md(Nf(t))}function If(t){return new md(Pf(t))}function zf(t){return new md(Af(t))}function Df(t){return new md(t.x)}function Mf(t){return new md(t.y)}function Bf(t,e){return new yd(t.x+e.x,t.y+e.y)}function Uf(t,e){return new yd(t.x-e.x,t.y-e.y)}function Ff(t,e){return new yd(t.x/e,t.y/e)}function qf(t){return t}function Gf(t){return t}function Hf(t,e,n){return void 0===e&&(e=qf),void 0===n&&(n=Gf),new yd(e(Df(t)).value,n(Mf(t)).value)}function Yf(t,e){return new md(t.value+e.value)}function Vf(t,e){return new md(t.value-e.value)}function Kf(t,e){return new md(t.value/e)}function Wf(t,e){return new _d(t,Uf(e,t))}function Xf(t){return Cf(en(qe(Mt(t))))}function Zf(t){return new Ql(t.origin.x,t.origin.x+t.dimension.x)}function Jf(t){return new Ql(t.origin.y,t.origin.y+t.dimension.y)}function Qf(t,e){C.call(this),this.name$=t,this.ordinal$=e}function td(){td=function(){},mf=new Qf("MULTI_POINT",0),yf=new Qf("MULTI_LINESTRING",1),$f=new Qf("MULTI_POLYGON",2)}function ed(){return td(),mf}function nd(){return td(),yf}function id(){return td(),$f}function rd(t,e,n,i){sd(),this.type=t,this.myMultiPoint_0=e,this.myMultiLineString_0=n,this.myMultiPolygon_0=i}function od(){ad=this}cf.$metadata$={kind:$,simpleName:"StringFormat",interfaces:[]},xf.prototype.get_za3lpa$=function(t){return this.myGeometry_8dt6c9$_0.get_za3lpa$(t)},Object.defineProperty(xf.prototype,"size",{configurable:!0,get:function(){return this.myGeometry_8dt6c9$_0.size}}),xf.$metadata$={kind:$,simpleName:"AbstractGeometryList",interfaces:[tn]},Qf.$metadata$={kind:$,simpleName:"GeometryType",interfaces:[C]},Qf.values=function(){return[ed(),nd(),id()]},Qf.valueOf_61zpoe$=function(t){switch(t){case"MULTI_POINT":return ed();case"MULTI_LINESTRING":return nd();case"MULTI_POLYGON":return id();default:S("No enum constant jetbrains.datalore.base.typedGeometry.GeometryType."+t)}},Object.defineProperty(rd.prototype,"multiPoint",{configurable:!0,get:function(){var t;if(null==(t=this.myMultiPoint_0))throw _((this.type.toString()+" is not a MultiPoint").toString());return t}}),Object.defineProperty(rd.prototype,"multiLineString",{configurable:!0,get:function(){var t;if(null==(t=this.myMultiLineString_0))throw _((this.type.toString()+" is not a MultiLineString").toString());return t}}),Object.defineProperty(rd.prototype,"multiPolygon",{configurable:!0,get:function(){var t;if(null==(t=this.myMultiPolygon_0))throw _((this.type.toString()+" is not a MultiPolygon").toString());return t}}),od.prototype.createMultiPoint_xgn53i$=function(t){return new rd(ed(),t,null,null)},od.prototype.createMultiLineString_bc4hlz$=function(t){return new rd(nd(),null,t,null)},od.prototype.createMultiPolygon_8ft4gs$=function(t){return new rd(id(),null,null,t)},od.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var ad=null;function sd(){return null===ad&&new od,ad}function ld(t){xf.call(this,t)}function ud(t){xf.call(this,t)}function cd(t){xf.call(this,t)}function pd(t){xf.call(this,t)}function hd(t){xf.call(this,t)}function _d(t,e){this.origin=t,this.dimension=e}function fd(t,e,n,i,r){return r=r||Object.create(_d.prototype),_d.call(r,new yd(t,e),new yd(n,i)),r}function dd(t){xf.call(this,t)}function md(t){this.value=t}function yd(t,e){this.x=t,this.y=e}function $d(t,e){return new yd(t,e)}function vd(t,e){return new yd(t.value,e.value)}function gd(){}function bd(){this.map=Ot()}function wd(t,e,n,i){if(Ed(),void 0===i&&(i=255),this.red=t,this.green=e,this.blue=n,this.alpha=i,!(0<=this.red&&this.red<=255&&0<=this.green&&this.green<=255&&0<=this.blue&&this.blue<=255&&0<=this.alpha&&this.alpha<=255))throw v(("Color components out of range: "+this).toString())}function xd(){kd=this,this.TRANSPARENT=new wd(0,0,0,0),this.WHITE=new wd(255,255,255),this.CONSOLE_WHITE=new wd(204,204,204),this.BLACK=new wd(0,0,0),this.LIGHT_GRAY=new wd(192,192,192),this.VERY_LIGHT_GRAY=new wd(210,210,210),this.GRAY=new wd(128,128,128),this.RED=new wd(255,0,0),this.LIGHT_GREEN=new wd(210,255,210),this.GREEN=new wd(0,255,0),this.DARK_GREEN=new wd(0,128,0),this.BLUE=new wd(0,0,255),this.DARK_BLUE=new wd(0,0,128),this.LIGHT_BLUE=new wd(210,210,255),this.YELLOW=new wd(255,255,0),this.CONSOLE_YELLOW=new wd(174,174,36),this.LIGHT_YELLOW=new wd(255,255,128),this.VERY_LIGHT_YELLOW=new wd(255,255,210),this.MAGENTA=new wd(255,0,255),this.LIGHT_MAGENTA=new wd(255,210,255),this.DARK_MAGENTA=new wd(128,0,128),this.CYAN=new wd(0,255,255),this.LIGHT_CYAN=new wd(210,255,255),this.ORANGE=new wd(255,192,0),this.PINK=new wd(255,175,175),this.LIGHT_PINK=new wd(255,210,210),this.PACIFIC_BLUE=this.parseHex_61zpoe$("#118ED8"),this.RGB_0="rgb",this.COLOR_0="color",this.RGBA_0="rgba"}rd.$metadata$={kind:$,simpleName:"Geometry",interfaces:[]},ld.$metadata$={kind:$,simpleName:"LineString",interfaces:[xf]},ud.$metadata$={kind:$,simpleName:"MultiLineString",interfaces:[xf]},cd.$metadata$={kind:$,simpleName:"MultiPoint",interfaces:[xf]},pd.$metadata$={kind:$,simpleName:"MultiPolygon",interfaces:[xf]},hd.$metadata$={kind:$,simpleName:"Polygon",interfaces:[xf]},_d.$metadata$={kind:$,simpleName:"Rect",interfaces:[]},_d.prototype.component1=function(){return this.origin},_d.prototype.component2=function(){return this.dimension},_d.prototype.copy_rbt1hw$=function(t,e){return new _d(void 0===t?this.origin:t,void 0===e?this.dimension:e)},_d.prototype.toString=function(){return"Rect(origin="+e.toString(this.origin)+", dimension="+e.toString(this.dimension)+")"},_d.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.origin)|0)+e.hashCode(this.dimension)|0},_d.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.origin,t.origin)&&e.equals(this.dimension,t.dimension)},dd.$metadata$={kind:$,simpleName:"Ring",interfaces:[xf]},md.$metadata$={kind:$,simpleName:"Scalar",interfaces:[]},md.prototype.component1=function(){return this.value},md.prototype.copy_14dthe$=function(t){return new md(void 0===t?this.value:t)},md.prototype.toString=function(){return"Scalar(value="+e.toString(this.value)+")"},md.prototype.hashCode=function(){var t=0;return 31*t+e.hashCode(this.value)|0},md.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.value,t.value)},yd.$metadata$={kind:$,simpleName:"Vec",interfaces:[]},yd.prototype.component1=function(){return this.x},yd.prototype.component2=function(){return this.y},yd.prototype.copy_lu1900$=function(t,e){return new yd(void 0===t?this.x:t,void 0===e?this.y:e)},yd.prototype.toString=function(){return"Vec(x="+e.toString(this.x)+", y="+e.toString(this.y)+")"},yd.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.x)|0)+e.hashCode(this.y)|0},yd.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.x,t.x)&&e.equals(this.y,t.y)},gd.$metadata$={kind:H,simpleName:"TypedKey",interfaces:[]},bd.prototype.get_ex36zt$=function(t){var n;if(this.map.containsKey_11rb$(t))return null==(n=this.map.get_11rb$(t))||e.isType(n,re)?n:E();throw new ie("Wasn't found key "+t)},bd.prototype.set_ev6mlr$=function(t,e){this.put_ev6mlr$(t,e)},bd.prototype.put_ev6mlr$=function(t,e){null==e?this.map.remove_11rb$(t):this.map.put_xwzc9p$(t,e)},bd.prototype.contains_ku7evr$=function(t){return this.containsKey_ex36zt$(t)},bd.prototype.containsKey_ex36zt$=function(t){return this.map.containsKey_11rb$(t)},bd.prototype.keys_287e2$=function(){var t;return e.isType(t=this.map.keys,nn)?t:E()},bd.$metadata$={kind:$,simpleName:"TypedKeyHashMap",interfaces:[]},wd.prototype.changeAlpha_za3lpa$=function(t){return new wd(this.red,this.green,this.blue,t)},wd.prototype.equals=function(t){return this===t||!!e.isType(t,wd)&&this.red===t.red&&this.green===t.green&&this.blue===t.blue&&this.alpha===t.alpha},wd.prototype.toCssColor=function(){return 255===this.alpha?"rgb("+this.red+","+this.green+","+this.blue+")":"rgba("+I(this.red)+","+I(this.green)+","+I(this.blue)+","+I(this.alpha/255)+")"},wd.prototype.toHexColor=function(){return"#"+Ed().toColorPart_0(this.red)+Ed().toColorPart_0(this.green)+Ed().toColorPart_0(this.blue)},wd.prototype.hashCode=function(){var t=0;return(31*(t=(31*(t=(31*(t=(31*t|0)+this.red|0)|0)+this.green|0)|0)+this.blue|0)|0)+this.alpha|0},wd.prototype.toString=function(){return"color("+this.red+","+this.green+","+this.blue+","+this.alpha+")"},xd.prototype.parseRGB_61zpoe$=function(t){var n=this.findNext_0(t,"(",0),i=t.substring(0,n),r=this.findNext_0(t,",",n+1|0),o=this.findNext_0(t,",",r+1|0),a=-1;if(l(i,this.RGBA_0))a=this.findNext_0(t,",",o+1|0);else if(l(i,this.COLOR_0))a=Oe(t,",",o+1|0);else if(!l(i,this.RGB_0))throw v(t);for(var s,u=this.findNext_0(t,")",a+1|0),c=n+1|0,p=t.substring(c,r),h=e.isCharSequence(s=p)?s:E(),_=0,f=h.length-1|0,d=!1;_<=f;){var m=d?f:_,y=nt(Ft(h.charCodeAt(m)))<=32;if(d){if(!y)break;f=f-1|0}else y?_=_+1|0:d=!0}for(var $,g=L(e.subSequence(h,_,f+1|0).toString()),b=r+1|0,w=t.substring(b,o),x=e.isCharSequence($=w)?$:E(),k=0,C=x.length-1|0,S=!1;k<=C;){var T=S?C:k,O=nt(Ft(x.charCodeAt(T)))<=32;if(S){if(!O)break;C=C-1|0}else O?k=k+1|0:S=!0}var N,P,A=L(e.subSequence(x,k,C+1|0).toString());if(-1===a){for(var j,R=o+1|0,I=t.substring(R,u),z=e.isCharSequence(j=I)?j:E(),D=0,M=z.length-1|0,B=!1;D<=M;){var U=B?M:D,F=nt(Ft(z.charCodeAt(U)))<=32;if(B){if(!F)break;M=M-1|0}else F?D=D+1|0:B=!0}N=L(e.subSequence(z,D,M+1|0).toString()),P=255}else{for(var q,G=o+1|0,H=a,Y=t.substring(G,H),V=e.isCharSequence(q=Y)?q:E(),K=0,W=V.length-1|0,X=!1;K<=W;){var Z=X?W:K,J=nt(Ft(V.charCodeAt(Z)))<=32;if(X){if(!J)break;W=W-1|0}else J?K=K+1|0:X=!0}N=L(e.subSequence(V,K,W+1|0).toString());for(var Q,tt=a+1|0,et=t.substring(tt,u),it=e.isCharSequence(Q=et)?Q:E(),rt=0,ot=it.length-1|0,at=!1;rt<=ot;){var st=at?ot:rt,lt=nt(Ft(it.charCodeAt(st)))<=32;if(at){if(!lt)break;ot=ot-1|0}else lt?rt=rt+1|0:at=!0}P=an(255*Yt(e.subSequence(it,rt,ot+1|0).toString()))}return new wd(g,A,N,P)},xd.prototype.findNext_0=function(t,e,n){var i=Oe(t,e,n);if(-1===i)throw v("text="+t+" what="+e+" from="+n);return i},xd.prototype.parseHex_61zpoe$=function(t){var e=t;if(!on(e,"#"))throw v("Not a HEX value: "+e);if(6!==(e=e.substring(1)).length)throw v("Not a HEX value: "+e);return new wd(te(e.substring(0,2),16),te(e.substring(2,4),16),te(e.substring(4,6),16))},xd.prototype.toColorPart_0=function(t){if(t<0||t>255)throw v("RGB color part must be in range [0..255] but was "+t);var e=Qt(t,16);return 1===e.length?"0"+e:e},xd.$metadata$={kind:y,simpleName:"Companion",interfaces:[]};var kd=null;function Ed(){return null===kd&&new xd,kd}function Cd(){Sd=this,this.DEFAULT_FACTOR_0=.7,this.variantColors_0=m([d("dark_blue",Ed().DARK_BLUE),d("dark_green",Ed().DARK_GREEN),d("dark_magenta",Ed().DARK_MAGENTA),d("light_blue",Ed().LIGHT_BLUE),d("light_gray",Ed().LIGHT_GRAY),d("light_green",Ed().LIGHT_GREEN),d("light_yellow",Ed().LIGHT_YELLOW),d("light_magenta",Ed().LIGHT_MAGENTA),d("light_cyan",Ed().LIGHT_CYAN),d("light_pink",Ed().LIGHT_PINK),d("very_light_gray",Ed().VERY_LIGHT_GRAY),d("very_light_yellow",Ed().VERY_LIGHT_YELLOW)]);var t,e=ln(m([d("white",Ed().WHITE),d("black",Ed().BLACK),d("gray",Ed().GRAY),d("red",Ed().RED),d("green",Ed().GREEN),d("blue",Ed().BLUE),d("yellow",Ed().YELLOW),d("magenta",Ed().MAGENTA),d("cyan",Ed().CYAN),d("orange",Ed().ORANGE),d("pink",Ed().PINK)]),this.variantColors_0),n=this.variantColors_0,i=pn(cn(n.size));for(t=n.entries.iterator();t.hasNext();){var r=t.next();i.put_xwzc9p$(un(r.key,95,45),r.value)}var o,a=ln(e,i),s=this.variantColors_0,l=pn(cn(s.size));for(o=s.entries.iterator();o.hasNext();){var u=o.next();l.put_xwzc9p$(Ze(u.key,"_",""),u.value)}this.namedColors_0=ln(a,l)}wd.$metadata$={kind:$,simpleName:"Color",interfaces:[]},Cd.prototype.parseColor_61zpoe$=function(t){var e;if(sn(t,40)>0)e=Ed().parseRGB_61zpoe$(t);else if(on(t,"#"))e=Ed().parseHex_61zpoe$(t);else{if(!this.isColorName_61zpoe$(t))throw v("Error persing color value: "+t);e=this.forName_61zpoe$(t)}return e},Cd.prototype.isColorName_61zpoe$=function(t){return this.namedColors_0.containsKey_11rb$(t.toLowerCase())},Cd.prototype.forName_61zpoe$=function(t){var e;if(null==(e=this.namedColors_0.get_11rb$(t.toLowerCase())))throw O();return e},Cd.prototype.generateHueColor=function(){return 360*De.Default.nextDouble()},Cd.prototype.generateColor_lu1900$=function(t,e){return this.rgbFromHsv_yvo9jy$(360*De.Default.nextDouble(),t,e)},Cd.prototype.rgbFromHsv_yvo9jy$=function(t,e,n){void 0===n&&(n=1);var i=t/60,r=n*e,o=i%2-1,a=r*(1-f.abs(o)),s=0,l=0,u=0;i<1?(s=r,l=a):i<2?(s=a,l=r):i<3?(l=r,u=a):i<4?(l=a,u=r):i<5?(s=a,u=r):(s=r,u=a);var c=n-r;return new wd(Lt(255*(s+c)),Lt(255*(l+c)),Lt(255*(u+c)))},Cd.prototype.hsvFromRgb_98b62m$=function(t){var e=1/255,n=t.red*e,i=t.green*e,r=t.blue*e,o=f.min(i,r),a=f.min(n,o),s=f.max(i,r),l=f.max(n,s),u=1/(6*(l-a));return new Float64Array([360*(l===a?0:l===n?i>=r?(i-r)*u:1+(i-r)*u:l===i?1/3+(r-n)*u:2/3+(n-i)*u),0===l?0:1-a/l,l])},Cd.prototype.darker_w32t8z$=function(t,e){var n;if(void 0===e&&(e=this.DEFAULT_FACTOR_0),null!=t){var i=Lt(t.red*e),r=f.max(i,0),o=Lt(t.green*e),a=f.max(o,0),s=Lt(t.blue*e);n=new wd(r,a,f.max(s,0),t.alpha)}else n=null;return n},Cd.prototype.lighter_o14uds$=function(t,e){void 0===e&&(e=this.DEFAULT_FACTOR_0);var n=t.red,i=t.green,r=t.blue,o=t.alpha,a=Lt(1/(1-e));if(0===n&&0===i&&0===r)return new wd(a,a,a,o);n>0&&n0&&i0&&r=-.001&&e<=1.001))throw v(("HSV 'saturation' must be in range [0, 1] but was "+e).toString());if(!(n>=-.001&&n<=1.001))throw v(("HSV 'value' must be in range [0, 1] but was "+n).toString());var i=Lt(100*e)/100;this.s=f.abs(i);var r=Lt(100*n)/100;this.v=f.abs(r)}function Od(t,e){this.first=t,this.second=e}function Nd(){}function Pd(){jd=this}function Ad(t){this.closure$kl=t}Td.prototype.toString=function(){return"HSV("+this.h+", "+this.s+", "+this.v+")"},Td.$metadata$={kind:$,simpleName:"HSV",interfaces:[]},Od.prototype.equals=function(t){var n;return this===t||!(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))&&(e.isType(t,Od)||E(),!!l(this.first,t.first)&&!!l(this.second,t.second))},Od.prototype.hashCode=function(){var t,e,n,i,r=null!=(e=null!=(t=this.first)?P(t):null)?e:0;return(31*r|0)+(null!=(i=null!=(n=this.second)?P(n):null)?i:0)|0},Od.prototype.toString=function(){return"["+this.first+", "+this.second+"]"},Od.prototype.component1=function(){return this.first},Od.prototype.component2=function(){return this.second},Od.$metadata$={kind:$,simpleName:"Pair",interfaces:[]},Nd.$metadata$={kind:H,simpleName:"SomeFig",interfaces:[]},Ad.prototype.error_l35kib$=function(t,e){this.closure$kl.error_ca4k3s$(t,e)},Ad.prototype.info_h4ejuu$=function(t){this.closure$kl.info_nq59yw$(t)},Ad.$metadata$={kind:$,interfaces:[ip]},Pd.prototype.logger_xo1ogr$=function(t){var e;return new Ad(hn.KotlinLogging.logger_61zpoe$(null!=(e=t.simpleName)?e:""))},Pd.$metadata$={kind:y,simpleName:"PortableLogging",interfaces:[]};var jd=null;var Ld=t.jetbrains||(t.jetbrains={}),Rd=Ld.datalore||(Ld.datalore={}),Id=Rd.base||(Rd.base={}),zd=Id.algorithms||(Id.algorithms={});zd.splitRings_bemo1h$=_n,zd.isClosed_2p1efm$=fn,zd.calculateArea_ytws2g$=function(t){return yn(t,c("x",1,(function(t){return t.x})),c("y",1,(function(t){return t.y})))},zd.isClockwise_st9g9f$=mn,zd.calculateArea_st9g9f$=yn;var Dd=Id.dateFormat||(Id.dateFormat={});Object.defineProperty(Dd,"DateLocale",{get:gn}),bn.SpecPart=wn,bn.PatternSpecPart=xn,Object.defineProperty(bn,"Companion",{get:Yn}),Dd.Format_init_61zpoe$=function(t,e){return e=e||Object.create(bn.prototype),bn.call(e,Yn().parse_61zpoe$(t)),e},Dd.Format=bn,Object.defineProperty(Vn,"DAY_OF_WEEK_ABBR",{get:Wn}),Object.defineProperty(Vn,"DAY_OF_WEEK_FULL",{get:Xn}),Object.defineProperty(Vn,"MONTH_ABBR",{get:Zn}),Object.defineProperty(Vn,"MONTH_FULL",{get:Jn}),Object.defineProperty(Vn,"DAY_OF_MONTH_LEADING_ZERO",{get:Qn}),Object.defineProperty(Vn,"DAY_OF_MONTH",{get:ti}),Object.defineProperty(Vn,"DAY_OF_THE_YEAR",{get:ei}),Object.defineProperty(Vn,"MONTH",{get:ni}),Object.defineProperty(Vn,"DAY_OF_WEEK",{get:ii}),Object.defineProperty(Vn,"YEAR_SHORT",{get:ri}),Object.defineProperty(Vn,"YEAR_FULL",{get:oi}),Object.defineProperty(Vn,"HOUR_24",{get:ai}),Object.defineProperty(Vn,"HOUR_12_LEADING_ZERO",{get:si}),Object.defineProperty(Vn,"HOUR_12",{get:li}),Object.defineProperty(Vn,"MINUTE",{get:ui}),Object.defineProperty(Vn,"MERIDIAN_LOWER",{get:ci}),Object.defineProperty(Vn,"MERIDIAN_UPPER",{get:pi}),Object.defineProperty(Vn,"SECOND",{get:hi}),Object.defineProperty(fi,"DATE",{get:mi}),Object.defineProperty(fi,"TIME",{get:yi}),_i.prototype.Kind=fi,Object.defineProperty(Vn,"Companion",{get:vi}),Dd.Pattern=Vn,Object.defineProperty(bi,"Companion",{get:ki});var Md=Id.datetime||(Id.datetime={});Md.Date=bi,Object.defineProperty(Ei,"Companion",{get:Ti}),Md.DateTime=Ei,Object.defineProperty(Md,"DateTimeUtil",{get:Pi}),Object.defineProperty(Ai,"Companion",{get:Ri}),Md.Duration=Ai,Md.Instant=Ii,Object.defineProperty(zi,"Companion",{get:Ui}),Md.Month=zi,Object.defineProperty(Fi,"Companion",{get:Ji}),Md.Time=Fi,Object.defineProperty(Qi,"MONDAY",{get:er}),Object.defineProperty(Qi,"TUESDAY",{get:nr}),Object.defineProperty(Qi,"WEDNESDAY",{get:ir}),Object.defineProperty(Qi,"THURSDAY",{get:rr}),Object.defineProperty(Qi,"FRIDAY",{get:or}),Object.defineProperty(Qi,"SATURDAY",{get:ar}),Object.defineProperty(Qi,"SUNDAY",{get:sr}),Md.WeekDay=Qi;var Bd=Md.tz||(Md.tz={});Bd.DateSpec=ur,Object.defineProperty(Bd,"DateSpecs",{get:fr}),Object.defineProperty(dr,"Companion",{get:$r}),Bd.TimeZone=dr,Object.defineProperty(vr,"Companion",{get:wr}),Bd.TimeZoneMoscow=vr,Object.defineProperty(Bd,"TimeZones",{get:ra});var Ud=Id.enums||(Id.enums={});Ud.EnumInfo=oa,Ud.EnumInfoImpl=aa,Object.defineProperty(sa,"NONE",{get:ua}),Object.defineProperty(sa,"LEFT",{get:ca}),Object.defineProperty(sa,"MIDDLE",{get:pa}),Object.defineProperty(sa,"RIGHT",{get:ha});var Fd=Id.event||(Id.event={});Fd.Button=sa,Fd.Event=_a,Object.defineProperty(fa,"A",{get:ma}),Object.defineProperty(fa,"B",{get:ya}),Object.defineProperty(fa,"C",{get:$a}),Object.defineProperty(fa,"D",{get:va}),Object.defineProperty(fa,"E",{get:ga}),Object.defineProperty(fa,"F",{get:ba}),Object.defineProperty(fa,"G",{get:wa}),Object.defineProperty(fa,"H",{get:xa}),Object.defineProperty(fa,"I",{get:ka}),Object.defineProperty(fa,"J",{get:Ea}),Object.defineProperty(fa,"K",{get:Ca}),Object.defineProperty(fa,"L",{get:Sa}),Object.defineProperty(fa,"M",{get:Ta}),Object.defineProperty(fa,"N",{get:Oa}),Object.defineProperty(fa,"O",{get:Na}),Object.defineProperty(fa,"P",{get:Pa}),Object.defineProperty(fa,"Q",{get:Aa}),Object.defineProperty(fa,"R",{get:ja}),Object.defineProperty(fa,"S",{get:La}),Object.defineProperty(fa,"T",{get:Ra}),Object.defineProperty(fa,"U",{get:Ia}),Object.defineProperty(fa,"V",{get:za}),Object.defineProperty(fa,"W",{get:Da}),Object.defineProperty(fa,"X",{get:Ma}),Object.defineProperty(fa,"Y",{get:Ba}),Object.defineProperty(fa,"Z",{get:Ua}),Object.defineProperty(fa,"DIGIT_0",{get:Fa}),Object.defineProperty(fa,"DIGIT_1",{get:qa}),Object.defineProperty(fa,"DIGIT_2",{get:Ga}),Object.defineProperty(fa,"DIGIT_3",{get:Ha}),Object.defineProperty(fa,"DIGIT_4",{get:Ya}),Object.defineProperty(fa,"DIGIT_5",{get:Va}),Object.defineProperty(fa,"DIGIT_6",{get:Ka}),Object.defineProperty(fa,"DIGIT_7",{get:Wa}),Object.defineProperty(fa,"DIGIT_8",{get:Xa}),Object.defineProperty(fa,"DIGIT_9",{get:Za}),Object.defineProperty(fa,"LEFT_BRACE",{get:Ja}),Object.defineProperty(fa,"RIGHT_BRACE",{get:Qa}),Object.defineProperty(fa,"UP",{get:ts}),Object.defineProperty(fa,"DOWN",{get:es}),Object.defineProperty(fa,"LEFT",{get:ns}),Object.defineProperty(fa,"RIGHT",{get:is}),Object.defineProperty(fa,"PAGE_UP",{get:rs}),Object.defineProperty(fa,"PAGE_DOWN",{get:os}),Object.defineProperty(fa,"ESCAPE",{get:as}),Object.defineProperty(fa,"ENTER",{get:ss}),Object.defineProperty(fa,"HOME",{get:ls}),Object.defineProperty(fa,"END",{get:us}),Object.defineProperty(fa,"TAB",{get:cs}),Object.defineProperty(fa,"SPACE",{get:ps}),Object.defineProperty(fa,"INSERT",{get:hs}),Object.defineProperty(fa,"DELETE",{get:_s}),Object.defineProperty(fa,"BACKSPACE",{get:fs}),Object.defineProperty(fa,"EQUALS",{get:ds}),Object.defineProperty(fa,"BACK_QUOTE",{get:ms}),Object.defineProperty(fa,"PLUS",{get:ys}),Object.defineProperty(fa,"MINUS",{get:$s}),Object.defineProperty(fa,"SLASH",{get:vs}),Object.defineProperty(fa,"CONTROL",{get:gs}),Object.defineProperty(fa,"META",{get:bs}),Object.defineProperty(fa,"ALT",{get:ws}),Object.defineProperty(fa,"SHIFT",{get:xs}),Object.defineProperty(fa,"UNKNOWN",{get:ks}),Object.defineProperty(fa,"F1",{get:Es}),Object.defineProperty(fa,"F2",{get:Cs}),Object.defineProperty(fa,"F3",{get:Ss}),Object.defineProperty(fa,"F4",{get:Ts}),Object.defineProperty(fa,"F5",{get:Os}),Object.defineProperty(fa,"F6",{get:Ns}),Object.defineProperty(fa,"F7",{get:Ps}),Object.defineProperty(fa,"F8",{get:As}),Object.defineProperty(fa,"F9",{get:js}),Object.defineProperty(fa,"F10",{get:Ls}),Object.defineProperty(fa,"F11",{get:Rs}),Object.defineProperty(fa,"F12",{get:Is}),Object.defineProperty(fa,"COMMA",{get:zs}),Object.defineProperty(fa,"PERIOD",{get:Ds}),Fd.Key=fa,Fd.KeyEvent_init_m5etgt$=Bs,Fd.KeyEvent=Ms,Object.defineProperty(Us,"Companion",{get:Gs}),Fd.KeyModifiers=Us,Fd.KeyStroke_init_ji7i3y$=Ys,Fd.KeyStroke_init_812rgc$=Vs,Fd.KeyStroke=Hs,Fd.KeyStrokeSpec_init_ji7i3y$=Ws,Fd.KeyStrokeSpec_init_luoraj$=Xs,Fd.KeyStrokeSpec_init_4t3vif$=Zs,Fd.KeyStrokeSpec=Ks,Object.defineProperty(Fd,"KeyStrokeSpecs",{get:function(){return null===il&&new Js,il}}),Object.defineProperty(rl,"CONTROL",{get:al}),Object.defineProperty(rl,"ALT",{get:sl}),Object.defineProperty(rl,"SHIFT",{get:ll}),Object.defineProperty(rl,"META",{get:ul}),Fd.ModifierKey=rl,Object.defineProperty(cl,"Companion",{get:bl}),Fd.MouseEvent_init_fbovgd$=wl,Fd.MouseEvent=cl,Fd.MouseEventSource=xl,Object.defineProperty(kl,"MOUSE_ENTERED",{get:Cl}),Object.defineProperty(kl,"MOUSE_LEFT",{get:Sl}),Object.defineProperty(kl,"MOUSE_MOVED",{get:Tl}),Object.defineProperty(kl,"MOUSE_DRAGGED",{get:Ol}),Object.defineProperty(kl,"MOUSE_CLICKED",{get:Nl}),Object.defineProperty(kl,"MOUSE_DOUBLE_CLICKED",{get:Pl}),Object.defineProperty(kl,"MOUSE_PRESSED",{get:Al}),Object.defineProperty(kl,"MOUSE_RELEASED",{get:jl}),Fd.MouseEventSpec=kl,Fd.PointEvent=Ll;var qd=Id.function||(Id.function={});qd.Function=Rl,Object.defineProperty(qd,"Functions",{get:function(){return null===Hl&&new Il,Hl}}),qd.Runnable=Yl,qd.Supplier=Vl,qd.Value=Kl;var Gd=Id.gcommon||(Id.gcommon={}),Hd=Gd.base||(Gd.base={});Object.defineProperty(Hd,"Strings",{get:function(){return null===Xl&&new Wl,Xl}}),Object.defineProperty(Hd,"Throwables",{get:function(){return null===Jl&&new Zl,Jl}}),Object.defineProperty(Ql,"Companion",{get:nu});var Yd=Gd.collect||(Gd.collect={});Yd.ClosedRange=Ql,Object.defineProperty(Yd,"Comparables",{get:ou}),Yd.ComparatorOrdering=au,Object.defineProperty(Yd,"Iterables",{get:uu}),Object.defineProperty(Yd,"Lists",{get:function(){return null===pu&&new cu,pu}}),Object.defineProperty(hu,"Companion",{get:mu}),Yd.Ordering=hu,Object.defineProperty(Yd,"Sets",{get:function(){return null===$u&&new yu,$u}}),Yd.Stack=vu,Yd.TreeMap=gu,Object.defineProperty(bu,"Companion",{get:ku});var Vd=Id.geometry||(Id.geometry={});Vd.DoubleRectangle_init_6y0v78$=function(t,e,n,i,r){return r=r||Object.create(bu.prototype),bu.call(r,new Nu(t,e),new Nu(n,i)),r},Vd.DoubleRectangle=bu,Object.defineProperty(Vd,"DoubleRectangles",{get:Tu}),Vd.DoubleSegment=Ou,Object.defineProperty(Nu,"Companion",{get:ju}),Vd.DoubleVector=Nu,Vd.Rectangle_init_tjonv8$=function(t,e,n,i,r){return r=r||Object.create(Lu.prototype),Lu.call(r,new Iu(t,e),new Iu(n,i)),r},Vd.Rectangle=Lu,Vd.Segment=Ru,Object.defineProperty(Iu,"Companion",{get:Mu}),Vd.Vector=Iu;var Kd=Id.json||(Id.json={});Kd.FluentArray_init=Uu,Kd.FluentArray_init_giv38x$=Fu,Kd.FluentArray=Bu,Kd.FluentObject_init_bkhwtg$=Gu,Kd.FluentObject_init=function(t){return t=t||Object.create(qu.prototype),Hu.call(t),qu.call(t),t.myObj_0=Ot(),t},Kd.FluentObject=qu,Kd.FluentValue=Hu,Kd.JsonFormatter=Yu,Object.defineProperty(Vu,"Companion",{get:ec}),Kd.JsonLexer=Vu,nc.JsonException=ic,Kd.JsonParser=nc,Object.defineProperty(Kd,"JsonSupport",{get:vc}),Object.defineProperty(gc,"LEFT_BRACE",{get:wc}),Object.defineProperty(gc,"RIGHT_BRACE",{get:xc}),Object.defineProperty(gc,"LEFT_BRACKET",{get:kc}),Object.defineProperty(gc,"RIGHT_BRACKET",{get:Ec}),Object.defineProperty(gc,"COMMA",{get:Cc}),Object.defineProperty(gc,"COLON",{get:Sc}),Object.defineProperty(gc,"STRING",{get:Tc}),Object.defineProperty(gc,"NUMBER",{get:Oc}),Object.defineProperty(gc,"TRUE",{get:Nc}),Object.defineProperty(gc,"FALSE",{get:Pc}),Object.defineProperty(gc,"NULL",{get:Ac}),Kd.Token=gc,Kd.escape_pdl1vz$=jc,Kd.unescape_pdl1vz$=Lc,Kd.streamOf_9ma18$=Rc,Kd.objectsStreamOf_9ma18$=zc,Kd.getAsInt_s8jyv4$=function(t){var n;return Lt(e.isNumber(n=t)?n:E())},Kd.getAsString_s8jyv4$=Dc,Kd.parseEnum_xwn52g$=Mc,Kd.formatEnum_wbfx10$=Bc,Kd.put_5zytao$=function(t,e,n){var i,r=Uu(),o=h(p(n,10));for(i=n.iterator();i.hasNext();){var a=i.next();o.add_11rb$(a)}return t.put_wxs67v$(e,r.addStrings_d294za$(o))},Kd.getNumber_8dq7w5$=Uc,Kd.getDouble_8dq7w5$=Fc,Kd.getString_8dq7w5$=function(t,n){var i,r;return"string"==typeof(i=(e.isType(r=t,k)?r:E()).get_11rb$(n))?i:E()},Kd.getArr_8dq7w5$=qc,Object.defineProperty(Gc,"Companion",{get:Vc}),Gc.Entry=ep,(Id.listMap||(Id.listMap={})).ListMap=Gc;var Wd=Id.logging||(Id.logging={});Wd.Logger=ip;var Xd=Id.math||(Id.math={});Xd.toRadians_14dthe$=rp,Xd.toDegrees_14dthe$=op,Xd.round_lu1900$=function(t,e){return new Iu(Lt(pe(t)),Lt(pe(e)))},Xd.ipow_dqglrj$=ap;var Zd=Id.numberFormat||(Id.numberFormat={});Zd.length_s8cxhz$=sp,lp.Spec=up,Object.defineProperty(cp,"Companion",{get:fp}),lp.NumberInfo_init_hjbnfl$=dp,lp.NumberInfo=cp,lp.Output=mp,lp.FormattedNumber=yp,Object.defineProperty(lp,"Companion",{get:kp}),Zd.NumberFormat_init_61zpoe$=Ep,Zd.NumberFormat=lp;var Jd=Id.observable||(Id.observable={}),Qd=Jd.children||(Jd.children={});Qd.ChildList=Cp,Qd.Position=Np,Qd.PositionData=Pp,Qd.SimpleComposite=Ap;var tm=Jd.collections||(Jd.collections={});tm.CollectionAdapter=jp,Object.defineProperty(Rp,"ADD",{get:zp}),Object.defineProperty(Rp,"SET",{get:Dp}),Object.defineProperty(Rp,"REMOVE",{get:Mp}),Lp.EventType=Rp,tm.CollectionItemEvent=Lp,tm.CollectionListener=Bp,tm.ObservableCollection=Up;var em=tm.list||(tm.list={});em.AbstractObservableList=Fp,em.ObservableArrayList=Kp,em.ObservableList=Wp;var nm=Jd.event||(Jd.event={});nm.CompositeEventSource_init_xw2ruy$=th,nm.CompositeEventSource_init_3qo2qg$=eh,nm.CompositeEventSource=Xp,nm.EventHandler=nh,nm.EventSource=ih,Object.defineProperty(nm,"EventSources",{get:function(){return null===ph&&new rh,ph}}),nm.ListenerCaller=hh,nm.ListenerEvent=_h,nm.Listeners=fh,nm.MappingEventSource=yh;var im=Jd.property||(Jd.property={});im.BaseReadableProperty=vh,im.DelayedValueProperty=gh,im.Property=xh,Object.defineProperty(im,"PropertyBinding",{get:function(){return null===Sh&&new kh,Sh}}),im.PropertyChangeEvent=Th,im.ReadableProperty=Oh,im.ValueProperty=Nh,im.WritableProperty=jh;var rm=Id.random||(Id.random={});Object.defineProperty(rm,"RandomString",{get:function(){return null===Rh&&new Lh,Rh}});var om=Id.registration||(Id.registration={});om.CompositeRegistration=Ih,om.Disposable=zh,Object.defineProperty(Dh,"Companion",{get:Gh}),om.Registration=Dh;var am=om.throwableHandlers||(om.throwableHandlers={});am.ThrowableHandler=Hh,Object.defineProperty(am,"ThrowableHandlers",{get:t_});var sm=Id.spatial||(Id.spatial={});Object.defineProperty(sm,"FULL_LONGITUDE",{get:function(){return Xh}}),sm.get_start_cawtq0$=n_,sm.get_end_cawtq0$=i_,Object.defineProperty(r_,"Companion",{get:l_}),sm.GeoBoundingBoxCalculator=r_,sm.makeSegments_8o5yvy$=u_,sm.geoRectsBBox_wfabpm$=function(t,e){return t.calculateBoundingBox_qpfwx8$(u_((n=e,function(t){return n.get_za3lpa$(t).startLongitude()}),function(t){return function(e){return t.get_za3lpa$(e).endLongitude()}}(e),e.size),u_(function(t){return function(e){return t.get_za3lpa$(e).minLatitude()}}(e),function(t){return function(e){return t.get_za3lpa$(e).maxLatitude()}}(e),e.size));var n},sm.pointsBBox_2r9fhj$=function(t,e){if(e.size%2!=0)throw v("Longitude-Latitude list is not even-numbered.".toString());var n,i=(n=e,function(t){return n.get_za3lpa$(2*t|0)}),r=function(t){return function(e){return t.get_za3lpa$(1+(2*e|0)|0)}}(e),o=e.size/2|0;return t.calculateBoundingBox_qpfwx8$(u_(i,i,o),u_(r,r,o))},sm.union_86o20w$=function(t,e){return t.calculateBoundingBox_qpfwx8$(u_((n=e,function(t){return Af(n.get_za3lpa$(t))}),function(t){return function(e){return Tf(t.get_za3lpa$(e))}}(e),e.size),u_(function(t){return function(e){return Pf(t.get_za3lpa$(e))}}(e),function(t){return function(e){return Sf(t.get_za3lpa$(e))}}(e),e.size));var n},Object.defineProperty(sm,"GeoJson",{get:function(){return null===m_&&new c_,m_}}),sm.GeoRectangle=y_,sm.limitLon_14dthe$=$_,sm.limitLat_14dthe$=v_,sm.normalizeLon_14dthe$=g_,Object.defineProperty(sm,"BBOX_CALCULATOR",{get:function(){return d_}}),sm.convertToGeoRectangle_i3vl8m$=function(t){var e,n;return Nf(t)=e.x&&t.origin.y<=e.y&&t.origin.y+t.dimension.y>=e.y},lm.intersects_32samh$=function(t,e){var n=t.origin,i=Bf(t.origin,t.dimension),r=e.origin,o=Bf(e.origin,e.dimension);return o.x>=n.x&&i.x>=r.x&&o.y>=n.y&&i.y>=r.y},lm.xRange_h9e6jg$=Zf,lm.yRange_h9e6jg$=Jf,lm.limit_lddjmn$=function(t){var e,n=h(p(t,10));for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(Xf(i))}return n},Object.defineProperty(Qf,"MULTI_POINT",{get:ed}),Object.defineProperty(Qf,"MULTI_LINESTRING",{get:nd}),Object.defineProperty(Qf,"MULTI_POLYGON",{get:id}),lm.GeometryType=Qf,Object.defineProperty(rd,"Companion",{get:sd}),lm.Geometry=rd,lm.LineString=ld,lm.MultiLineString=ud,lm.MultiPoint=cd,lm.MultiPolygon=pd,lm.Polygon=hd,lm.Rect_init_94ua8u$=fd,lm.Rect=_d,lm.Ring=dd,lm.Scalar=md,lm.Vec_init_vrm8gm$=function(t,e,n){return n=n||Object.create(yd.prototype),yd.call(n,t,e),n},lm.Vec=yd,lm.explicitVec_y7b45i$=$d,lm.explicitVec_vrm8gm$=function(t,e){return new yd(t,e)},lm.newVec_4xl464$=vd;var um=Id.typedKey||(Id.typedKey={});um.TypedKey=gd,um.TypedKeyHashMap=bd,(Id.unsupported||(Id.unsupported={})).UNSUPPORTED_61zpoe$=function(t){throw rn(t)},Object.defineProperty(wd,"Companion",{get:Ed});var cm=Id.values||(Id.values={});cm.Color=wd,Object.defineProperty(cm,"Colors",{get:function(){return null===Sd&&new Cd,Sd}}),cm.HSV=Td,cm.Pair=Od,cm.SomeFig=Nd,Object.defineProperty(Wd,"PortableLogging",{get:function(){return null===jd&&new Pd,jd}}),mc=m([d(Ft(34),Ft(34)),d(Ft(92),Ft(92)),d(Ft(47),Ft(47)),d(Ft(98),Ft(8)),d(Ft(102),Ft(12)),d(Ft(110),Ft(10)),d(Ft(114),Ft(13)),d(Ft(116),Ft(9))]);var pm,hm=b(0,32),_m=h(p(hm,10));for(pm=hm.iterator();pm.hasNext();){var fm=pm.next();_m.add_11rb$(Ft(it(fm)))}return yc=Zt(_m),Vh=6378137,f_=fd(Kh=-180,Zh=-90,Xh=(Wh=180)-Kh,(Jh=90)-Zh),d_=new r_(f_,!0,!1),t})?i.apply(e,r):i)||(t.exports=o)},602:function(t,e,n){var i,r,o;r=[e,n(421),n(767),n(73)],void 0===(o="function"==typeof(i=function(t,e,n,i){"use strict";var r=e.Kind.INTERFACE,o=n.jetbrains.datalore.base.function.Value,a=e.kotlin.Unit,s=n.jetbrains.datalore.base.registration.Registration,l=Error,u=e.throwCCE,c=e.Kind.CLASS,p=e.kotlin.Exception,h=Object,_=e.kotlin.Pair,f=e.ensureNotNull,d=e.Kind.OBJECT,m=e.kotlin.collections.listOf_i5x0yv$,y=e.kotlin.collections.ArrayList_init_mqih57$,$=n.jetbrains.datalore.base.gcommon.collect.TreeMap,v=e.kotlin.collections.ArrayList_init_ww73n8$,g=e.kotlin.IllegalStateException_init_pdl1vj$,b=n.jetbrains.datalore.base.observable.event.ListenerCaller,w=n.jetbrains.datalore.base.observable.event.Listeners,x=e.kotlin.collections.ArrayList_init_287e2$,k=e.kotlin.RuntimeException,E=e.toString,C=e.kotlin.IllegalArgumentException_init_pdl1vj$,S=n.jetbrains.datalore.base.function,T=e.kotlin.collections.get_indices_gzk92b$,O=e.kotlin.ranges.reversed_zf1xzc$,N=e.kotlin.NoSuchElementException_init,P=e.kotlin.collections.Iterator,A=e.kotlin.collections.Iterable,j=Math,L=n.jetbrains.datalore.base.geometry.Vector,R=n.jetbrains.datalore.base.function.Function,I=(e.defineInlineFunction,e.wrapFunction,e.kotlin.collections.Collection,e.kotlin.collections.List,e.kotlin.collections.Set,e.kotlin.collections.Map,e.kotlin.RuntimeException_init_pdl1vj$,n.jetbrains.datalore.base.observable.collections.ObservableCollection),z=(n.jetbrains.datalore.base.observable.collections.list.ObservableArrayList,n.jetbrains.datalore.base.observable.property.WritableProperty),D=n.jetbrains.datalore.base.observable.property.PropertyChangeEvent,M=n.jetbrains.datalore.base.observable.property.Property,B=n.jetbrains.datalore.base.observable.collections.CollectionAdapter,U=(e.kotlin.UnsupportedOperationException_init,n.jetbrains.datalore.base.observable.collections.list.AbstractObservableList,e.kotlin.collections.MutableCollection,e.kotlin.IllegalStateException_init),F=(e.kotlin.math.abs_za3lpa$,e.hashCode,e.equals),q=(e.kotlin.collections.AbstractMutableList,n.jetbrains.datalore.base.observable.collections.list.ObservableList,n.jetbrains.datalore.base.observable.collections.CollectionItemEvent.EventType),G=n.jetbrains.datalore.base.observable.collections.CollectionItemEvent,H=e.kotlin.collections.MutableIterator,Y=e.kotlin.collections.AbstractMutableSet,V=e.kotlin.collections.LinkedHashSet_init_287e2$,K=e.kotlin.collections.HashSet_init_ww73n8$,W=e.kotlin.collections.MutableSet,X=n.jetbrains.datalore.base.function.Runnable,Z=n.jetbrains.datalore.base.observable.event.EventSource,J=n.jetbrains.datalore.base.observable.property.BaseReadableProperty,Q=Array,tt=(n.jetbrains.datalore.base.observable.property.ValueProperty,n.jetbrains.datalore.base.registration.Disposable,e.kotlin.text.startsWith_7epoxm$),et=n.jetbrains.datalore.base.function.Supplier,nt=n.jetbrains.datalore.base.observable.property.ReadableProperty,it=e.kotlin.text.StringBuilder_init,rt=e.kotlin.text.StringBuilder,ot=n.jetbrains.datalore.base.observable.collections.CollectionListener,at=e.kotlin.Enum,st=e.throwISE,lt=(e.kotlin.Comparator,e.kotlin.collections.HashMap_init_q3lmfv$),ut=(e.kotlin.collections.binarySearch_vikexg$,e.kotlin.collections.sortWith_nqfjgj$,e.kotlin.collections.MutableMap,e.toByte),ct=e.toChar,pt=e.kotlin.collections.HashSet_init_287e2$,ht=n.jetbrains.datalore.base.event.ModifierKey,_t=n.jetbrains.datalore.base.event.KeyEvent_init_m5etgt$,ft=n.jetbrains.datalore.base.event.Key,dt=n.jetbrains.datalore.base.event,mt=n.jetbrains.datalore.base.event.Button,yt=n.jetbrains.datalore.base.event.KeyModifiers,$t=e.numberToInt,vt=n.jetbrains.datalore.base.event.MouseEvent,gt=e.kotlin.text.equals_igcy3c$,bt=(e.toShort,e.getCallableRef,e.kotlin.random.Random,i.mu),wt=e.kotlin.js.iterator_s8jyvk$,xt=e.numberToDouble;function kt(){}function Et(){}function Ct(){Pt=this}function St(t){this.closure$value=t}function Tt(t){this.closure$t=t}function Ot(t){return a}function Nt(t){this.myAsync_0=t,this.myItem_8be2vx$=null,this.mySucceeded_8be2vx$=!1,this.myReg_0=null}Ut.prototype=Object.create(s.prototype),Ut.prototype.constructor=Ut,Ht.prototype=Object.create(s.prototype),Ht.prototype.constructor=Ht,Yt.prototype=Object.create(k.prototype),Yt.prototype.constructor=Yt,$e.prototype=Object.create(J.prototype),$e.prototype.constructor=$e,pe.prototype=Object.create(B.prototype),pe.prototype.constructor=pe,se.prototype=Object.create(Y.prototype),se.prototype.constructor=se,he.prototype=Object.create(se.prototype),he.prototype.constructor=he,ge.prototype=Object.create(w.prototype),ge.prototype.constructor=ge,be.prototype=Object.create($e.prototype),be.prototype.constructor=be,Se.prototype=Object.create(be.prototype),Se.prototype.constructor=Se,Te.prototype=Object.create(be.prototype),Te.prototype.constructor=Te,Oe.prototype=Object.create(be.prototype),Oe.prototype.constructor=Oe,Ne.prototype=Object.create(be.prototype),Ne.prototype.constructor=Ne,Pe.prototype=Object.create(be.prototype),Pe.prototype.constructor=Pe,je.prototype=Object.create($e.prototype),je.prototype.constructor=je,ze.prototype=Object.create($e.prototype),ze.prototype.constructor=ze,qe.prototype=Object.create(s.prototype),qe.prototype.constructor=qe,Ge.prototype=Object.create(be.prototype),Ge.prototype.constructor=Ge,He.prototype=Object.create(be.prototype),He.prototype.constructor=He,Ke.prototype=Object.create(J.prototype),Ke.prototype.constructor=Ke,mn.prototype=Object.create($e.prototype),mn.prototype.constructor=mn,We.prototype=Object.create(mn.prototype),We.prototype.constructor=We,Xe.prototype=Object.create(mn.prototype),Xe.prototype.constructor=Xe,Ze.prototype=Object.create($e.prototype),Ze.prototype.constructor=Ze,Qe.prototype=Object.create(B.prototype),Qe.prototype.constructor=Qe,tn.prototype=Object.create(be.prototype),tn.prototype.constructor=tn,nn.prototype=Object.create(be.prototype),nn.prototype.constructor=nn,rn.prototype=Object.create(be.prototype),rn.prototype.constructor=rn,on.prototype=Object.create(be.prototype),on.prototype.constructor=on,an.prototype=Object.create(be.prototype),an.prototype.constructor=an,sn.prototype=Object.create(be.prototype),sn.prototype.constructor=sn,pn.prototype=Object.create(B.prototype),pn.prototype.constructor=pn,hn.prototype=Object.create(be.prototype),hn.prototype.constructor=hn,_n.prototype=Object.create(be.prototype),_n.prototype.constructor=_n,$n.prototype=Object.create($e.prototype),$n.prototype.constructor=$n,Vn.prototype=Object.create(at.prototype),Vn.prototype.constructor=Vn,ui.prototype=Object.create(at.prototype),ui.prototype.constructor=ui,fi.prototype=Object.create(at.prototype),fi.prototype.constructor=fi,kt.$metadata$={kind:r,simpleName:"Async",interfaces:[]},Et.$metadata$={kind:r,simpleName:"AsyncResolver",interfaces:[]},Ct.prototype.isFinished_jdxood$=function(t){var e,n=new o(!1);return t.onResult_m8e4a6$((e=n,function(t){return e.set_11rb$(!0),a}),function(t){return function(e){return t.set_11rb$(!0),a}}(n)).remove(),n.get()},St.prototype.onSuccess_qlkmfe$=function(t){return t(this.closure$value),s.Companion.EMPTY},St.prototype.onResult_m8e4a6$=function(t,e){return this.onSuccess_qlkmfe$(t)},St.prototype.onFailure_4m4org$=function(t){return s.Companion.EMPTY},St.prototype.map_2o04qz$=function(t){var n;try{n=t(this.closure$value)}catch(t){if(e.isType(t,l))return At().failure_lsqlk3$(t);throw t}return At().constant_mh5how$(n)},St.prototype.flatMap_sqztdv$=function(t){var n,i;try{i=t(this.closure$value)}catch(t){if(e.isType(t,l))return At().failure_lsqlk3$(t);throw t}return null==i?At().constant_mh5how$(null):e.isType(n=i,kt)?n:u()},St.$metadata$={kind:c,interfaces:[kt]},Ct.prototype.constant_mh5how$=function(t){return new St(t)},Tt.prototype.onSuccess_qlkmfe$=function(t){return s.Companion.EMPTY},Tt.prototype.onResult_m8e4a6$=function(t,e){return this.onFailure_4m4org$(e)},Tt.prototype.onFailure_4m4org$=function(t){return t(this.closure$t),s.Companion.EMPTY},Tt.prototype.map_2o04qz$=function(t){return At().failure_lsqlk3$(this.closure$t)},Tt.prototype.flatMap_sqztdv$=function(t){return At().failure_lsqlk3$(this.closure$t)},Tt.$metadata$={kind:c,interfaces:[kt]},Ct.prototype.failure_lsqlk3$=function(t){return new Tt(t)},Ct.prototype.voidAsync=function(){return this.constant_mh5how$(a)},Ct.prototype.toUnit_5m6kth$=function(t){return this.map_wnedw7$(t,Ot,new Gt)},Ct.prototype.map_wnedw7$=function(t,n,i){return t.onResult_m8e4a6$((r=n,o=i,function(t){var n;try{n=r(t)}catch(t){if(e.isType(t,p))return void o.failure_tcv7n7$(t);throw t}return o.success_11rb$(n),a}),function(t){return function(e){return t.failure_tcv7n7$(e),a}}(i)),i;var r,o},Ct.prototype.select_vkqda3$=function(t,n,i){return t.onResult_m8e4a6$((r=n,o=i,s=this,function(t){var n;try{n=r(t)}catch(t){if(e.isType(t,p))return void o.failure_tcv7n7$(t);throw t}return null==n?o.success_11rb$(null):s.delegate_6j4q7x$(n,o),a}),function(t){return function(e){return t.failure_tcv7n7$(e),a}}(i)),i;var r,o,s},Ct.prototype.seq_y7kb4$=function(t,e){return this.select_vkqda3$(t,(n=e,function(t){return n}),new Gt);var n},Ct.prototype.onAnyResult_l1da99$=function(t,e){return t.onResult_m8e4a6$((n=e,function(t){return n.run(),a}),function(t){return function(e){return t.run(),a}}(e));var n},Ct.prototype.untilSuccess_qkdzg6$=function(t){var n,i,r,o,s,l=new Bt,u=(i=l,function(t){return i.success_11rb$(t),a});try{n=t.get()}catch(n){if(e.isType(n,p))return this.untilSuccess_qkdzg6$(t).onSuccess_qlkmfe$(u),l;throw n}return n.onResult_m8e4a6$(u,(r=t,o=this,s=u,function(t){return o.untilSuccess_qkdzg6$(r).onSuccess_qlkmfe$(s),a})),l},Ct.prototype.delegate_6j4q7x$=function(t,e){return t.onResult_m8e4a6$((n=e,function(t){return n.success_11rb$(t),a}),function(t){return function(e){return t.failure_tcv7n7$(e),a}}(e));var n},Ct.prototype.pair_y7kb4$=function(t,n){var i,r,o,s=new Bt,l=new Bt,c=new Nt(t),p=new Nt(n);return l.onResult_m8e4a6$((i=c,r=p,o=s,function(t){var n,s;return i.mySucceeded_8be2vx$&&r.mySucceeded_8be2vx$?o.success_11rb$(new _(null==(n=i.myItem_8be2vx$)||e.isType(n,h)?n:u(),null==(s=r.myItem_8be2vx$)||e.isType(s,h)?s:u())):o.failure_tcv7n7$(e.newThrowable("internal error in pair async")),a}),function(t){return function(e){return t.failure_tcv7n7$(e),a}}(s)),c.pair_sr8jes$(p,l),p.pair_sr8jes$(c,l),s},Nt.prototype.pair_sr8jes$=function(t,e){var n,i,r;e.hasSucceeded_8be2vx$()||e.hasFailed_8be2vx$()||(this.myReg_0=this.myAsync_0.onResult_m8e4a6$((n=this,i=t,r=e,function(t){return n.myItem_8be2vx$=t,n.mySucceeded_8be2vx$=!0,i.mySucceeded_8be2vx$&&r.success_11rb$(a),a}),function(t,e){return function(n){return null!=t.myReg_0&&f(t.myReg_0).remove(),e.failure_tcv7n7$(n),a}}(t,e)))},Nt.$metadata$={kind:c,simpleName:"PairedAsync",interfaces:[]},Ct.$metadata$={kind:d,simpleName:"Asyncs",interfaces:[]};var Pt=null;function At(){return null===Pt&&new Ct,Pt}function jt(){Dt=this}function Lt(t,e,n){return function(i){return t.set_5ltja$(e,i),n(),a}}function Rt(t,e){return function(n){return t.add_8o0b5c$(n),e(),a}}function It(){this.myLock_0=new gn,this.myMap_0=new $}function zt(){this.myLock_0=new gn,this.myThrowables_0=v(0)}jt.prototype.parallel_nq6ec4$=function(t){return this.parallel_yy0mju$(m(t.slice()))},jt.prototype.parallelResult_b5my6p$=function(t){return this.runParallel_0(t,!0)},jt.prototype.parallel_yy0mju$=function(t,e){return void 0===e&&(e=!1),At().toUnit_5m6kth$(this.runParallel_0(t,e))},jt.prototype.composite_a4rjr8$=function(t){return this.runParallel_0(t,!1)},jt.prototype.runParallel_0=function(t,e){for(var n=new Gt,i=new vn(t.size),r=new It,o=new zt,s=function(t,e,n,i,r){return function(){return t.decrementAndGet()<=0&&(e.isEmpty_8be2vx$||n?i.success_11rb$(r.get_8be2vx$()):i.failure_tcv7n7$(e.toSingleException_8be2vx$())),a}}(i,o,e,n,r),l=0,u=t.iterator();u.hasNext();++l)u.next().onResult_m8e4a6$(Lt(r,l,s),Rt(o,s));return t.isEmpty()&&s(),n},It.prototype.set_5ltja$=function(t,e){var n=this.myLock_0;try{n.lock(),this.myMap_0.put_ncwa5f$(t,e)}finally{n.unlock()}},It.prototype.get_8be2vx$=function(){var t=this.myLock_0;try{return t.lock(),y(this.myMap_0.values)}finally{t.unlock()}},It.$metadata$={kind:c,simpleName:"OrderedValues",interfaces:[]},Object.defineProperty(zt.prototype,"isEmpty_8be2vx$",{configurable:!0,get:function(){var t=this.myLock_0;try{return t.lock(),this.myThrowables_0.isEmpty()}finally{t.unlock()}}}),zt.prototype.add_8o0b5c$=function(t){var e=this.myLock_0;try{e.lock(),this.myThrowables_0.add_11rb$(t)}finally{e.unlock()}},zt.prototype.toSingleException_8be2vx$=function(){var t=this.myLock_0;try{if(t.lock(),this.myThrowables_0.isEmpty())throw g("Empty collection".toString());return 1===this.myThrowables_0.size?this.myThrowables_0.get_za3lpa$(0):Vt(y(this.myThrowables_0))}finally{t.unlock()}},zt.$metadata$={kind:c,simpleName:"ThreadSafeThrowables",interfaces:[]},jt.$metadata$={kind:d,simpleName:"PlatformAsyncs",interfaces:[]};var Dt=null;function Mt(){}function Bt(){this.mySuccessItem_0=null,this.mySucceeded_0=!1,this.myFailureThrowable_0=null,this.myFailed_0=!1,this.mySuccessHandlers_0=new w,this.myFailureHandlers_0=new w}function Ut(t,e){this.closure$successRegistration=t,this.closure$failureRegistration=e,s.call(this)}function Ft(t){this.this$SimpleAsync=t}function qt(t){this.this$SimpleAsync=t}function Gt(){this.myAsync_0=new Bt,this.lock_0=new gn}function Ht(t,e){this.this$ThreadSafeAsync=t,this.closure$r=e,s.call(this)}function Yt(){this.name="ThrowableCollectionException",this.myThrowables_0=x()}function Vt(t,e){return e=e||Object.create(Yt.prototype),k.call(e,"size="+E(t.size),t.get_za3lpa$(0)),Yt.call(e),e.myThrowables_0.addAll_brywnq$(t),e}function Kt(){ee=this,this.ourWithBounds_0=new ie(0)}function Wt(t){return t.parent}function Xt(t){return t.parent}function Zt(t){return!t.visible().get()}function Jt(t){return t.focusable().get()}function Qt(t,e){this.closure$trans=t,this.closure$initial=e}function te(t,e){this.closure$trans=t,this.myCurrent_0=e}Mt.$metadata$={kind:r,simpleName:"ResolvableAsync",interfaces:[Et,kt]},Bt.prototype.onSuccess_qlkmfe$=function(t){return this.alreadyHandled_0()?(this.mySucceeded_0&&t(f(this.mySuccessItem_0)),s.Companion.EMPTY):f(this.mySuccessHandlers_0).add_11rb$(t)},Ut.prototype.doRemove=function(){this.closure$successRegistration.remove(),this.closure$failureRegistration.remove()},Ut.$metadata$={kind:c,interfaces:[s]},Bt.prototype.onResult_m8e4a6$=function(t,e){return new Ut(this.onSuccess_qlkmfe$(t),this.onFailure_4m4org$(e))},Bt.prototype.onFailure_4m4org$=function(t){return this.alreadyHandled_0()?(this.myFailed_0&&t(f(this.myFailureThrowable_0)),s.Companion.EMPTY):f(this.myFailureHandlers_0).add_11rb$(t)},Bt.prototype.map_2o04qz$=function(t){return At().map_wnedw7$(this,t,new Bt)},Bt.prototype.flatMap_sqztdv$=function(t){return At().select_vkqda3$(this,t,new Bt)},Ft.prototype.call_11rb$=function(t){var n;t(null==(n=this.this$SimpleAsync.mySuccessItem_0)||e.isType(n,h)?n:u())},Ft.$metadata$={kind:c,interfaces:[b]},Bt.prototype.success_11rb$=function(t){if(this.alreadyHandled_0())throw g("Async already completed");this.mySuccessItem_0=t,this.mySucceeded_0=!0,f(this.mySuccessHandlers_0).fire_kucmxw$(new Ft(this)),this.clearHandlers_0()},qt.prototype.call_11rb$=function(t){t(f(this.this$SimpleAsync.myFailureThrowable_0))},qt.$metadata$={kind:c,interfaces:[b]},Bt.prototype.failure_tcv7n7$=function(t){if(this.alreadyHandled_0())throw g("Async already completed");this.myFailureThrowable_0=t,this.myFailed_0=!0,f(this.myFailureHandlers_0).fire_kucmxw$(new qt(this)),this.clearHandlers_0()},Bt.prototype.clearHandlers_0=function(){this.mySuccessHandlers_0=null,this.myFailureHandlers_0=null},Bt.prototype.alreadyHandled_0=function(){return this.mySucceeded_0||this.myFailed_0},Bt.prototype.hasSucceeded_8be2vx$=function(){return this.mySucceeded_0},Bt.prototype.hasFailed_8be2vx$=function(){return this.myFailed_0},Bt.$metadata$={kind:c,simpleName:"SimpleAsync",interfaces:[Mt]},Gt.prototype.onSuccess_qlkmfe$=function(t){var e=this.lock_0;try{return e.lock(),this.safeReg_0(this.myAsync_0.onSuccess_qlkmfe$(t))}finally{e.unlock()}},Gt.prototype.onResult_m8e4a6$=function(t,e){var n=this.lock_0;try{return n.lock(),this.safeReg_0(this.myAsync_0.onResult_m8e4a6$(t,e))}finally{n.unlock()}},Gt.prototype.onFailure_4m4org$=function(t){var e=this.lock_0;try{return e.lock(),this.safeReg_0(this.myAsync_0.onFailure_4m4org$(t))}finally{e.unlock()}},Gt.prototype.map_2o04qz$=function(t){var e=this.lock_0;try{return e.lock(),At().map_wnedw7$(this,t,new Gt)}finally{e.unlock()}},Gt.prototype.flatMap_sqztdv$=function(t){var e=this.lock_0;try{return e.lock(),At().select_vkqda3$(this,t,new Gt)}finally{e.unlock()}},Ht.prototype.doRemove=function(){var t=this.this$ThreadSafeAsync.lock_0;this.closure$r;try{t.lock(),this.closure$r.remove()}finally{t.unlock()}},Ht.$metadata$={kind:c,interfaces:[s]},Gt.prototype.safeReg_0=function(t){return new Ht(this,t)},Gt.prototype.success_11rb$=function(t){var e=this.lock_0;try{e.lock(),this.myAsync_0.success_11rb$(t)}finally{e.unlock()}},Gt.prototype.failure_tcv7n7$=function(t){var e=this.lock_0;try{e.lock(),this.myAsync_0.failure_tcv7n7$(t)}finally{e.unlock()}},Gt.$metadata$={kind:c,simpleName:"ThreadSafeAsync",interfaces:[Mt]},Object.defineProperty(Yt.prototype,"throwables",{configurable:!0,get:function(){return this.myThrowables_0}}),Yt.$metadata$={kind:c,simpleName:"ThrowableCollectionException",interfaces:[k]},Kt.prototype.removeFromParent_j88a3b$=function(t){var e;null!=(e=t.parent)&&e.children().remove_11rb$(t)},Kt.prototype.isNonCompositeChild_gv3x1o$=function(t){if(null==t.parent)return!1;if(null!=t.nextSibling())return!1;if(null!=t.prevSibling())return!1;var e=f(t.parent).children();return 1!==e.size||e.get_za3lpa$(0)!==t},Kt.prototype.nextSibling_j88a3b$=function(t){var e;if(null==(e=t.parent))return null;var n=e,i=n.children().indexOf_11rb$(t);return-1===i?null:(i+1|0)0?n.children().get_za3lpa$(i-1|0):null},Kt.prototype.firstLeaf_gv3x1o$=function(t){var e;if(null==(e=t.firstChild()))return t;var n=e;return this.firstLeaf_gv3x1o$(n)},Kt.prototype.lastLeaf_gv3x1o$=function(t){var e;if(null==(e=t.lastChild()))return t;var n=e;return this.lastLeaf_gv3x1o$(n)},Kt.prototype.nextLeaf_gv3x1o$=function(t){return this.nextLeaf_yd3t6i$(t,null)},Kt.prototype.nextLeaf_yd3t6i$=function(t,e){for(var n=t;;){var i=n.nextSibling();if(null!=i)return this.firstLeaf_gv3x1o$(i);if(this.isNonCompositeChild_gv3x1o$(n))return null;var r=n.parent;if(r===e)return null;n=f(r)}},Kt.prototype.prevLeaf_gv3x1o$=function(t){return this.prevLeaf_yd3t6i$(t,null)},Kt.prototype.prevLeaf_yd3t6i$=function(t,e){for(var n=t;;){var i=n.prevSibling();if(null!=i)return this.lastLeaf_gv3x1o$(i);if(this.isNonCompositeChild_gv3x1o$(n))return null;var r=n.parent;if(r===e)return null;n=f(r)}},Kt.prototype.root_2jhxsk$=function(t){for(var e=t;;){if(null==e.parent)return e;e=f(e.parent)}},Kt.prototype.ancestorsFrom_2jhxsk$=function(t){return this.iterateFrom_0(t,Wt)},Kt.prototype.ancestors_2jhxsk$=function(t){return this.iterate_e5aqdj$(t,Xt)},Kt.prototype.nextLeaves_gv3x1o$=function(t){return this.iterate_e5aqdj$(t,(e=this,function(t){return e.nextLeaf_gv3x1o$(t)}));var e},Kt.prototype.prevLeaves_gv3x1o$=function(t){return this.iterate_e5aqdj$(t,(e=this,function(t){return e.prevLeaf_gv3x1o$(t)}));var e},Kt.prototype.nextNavOrder_gv3x1o$=function(t){return this.iterate_e5aqdj$(t,(e=t,n=this,function(t){return n.nextNavOrder_0(e,t)}));var e,n},Kt.prototype.prevNavOrder_gv3x1o$=function(t){return this.iterate_e5aqdj$(t,(e=t,n=this,function(t){return n.prevNavOrder_0(e,t)}));var e,n},Kt.prototype.nextNavOrder_0=function(t,e){var n=e.nextSibling();if(null!=n)return this.firstLeaf_gv3x1o$(n);if(this.isNonCompositeChild_gv3x1o$(e))return null;var i=e.parent;return this.isDescendant_5jhjy8$(i,t)?this.nextNavOrder_0(t,f(i)):i},Kt.prototype.prevNavOrder_0=function(t,e){var n=e.prevSibling();if(null!=n)return this.lastLeaf_gv3x1o$(n);if(this.isNonCompositeChild_gv3x1o$(e))return null;var i=e.parent;return this.isDescendant_5jhjy8$(i,t)?this.prevNavOrder_0(t,f(i)):i},Kt.prototype.isBefore_yd3t6i$=function(t,e){if(t===e)return!1;var n=this.reverseAncestors_0(t),i=this.reverseAncestors_0(e);if(n.get_za3lpa$(0)!==i.get_za3lpa$(0))throw C("Items are in different trees");for(var r=n.size,o=i.size,a=j.min(r,o),s=1;s0}throw C("One parameter is an ancestor of the other")},Kt.prototype.deltaBetween_b8q44p$=function(t,e){for(var n=t,i=t,r=0;;){if(n===e)return 0|-r;if(i===e)return r;if(r=r+1|0,null==n&&null==i)throw g("Both left and right are null");null!=n&&(n=n.prevSibling()),null!=i&&(i=i.nextSibling())}},Kt.prototype.commonAncestor_pd1sey$=function(t,e){var n,i;if(t===e)return t;if(this.isDescendant_5jhjy8$(t,e))return t;if(this.isDescendant_5jhjy8$(e,t))return e;var r=x(),o=x();for(n=this.ancestorsFrom_2jhxsk$(t).iterator();n.hasNext();){var a=n.next();r.add_11rb$(a)}for(i=this.ancestorsFrom_2jhxsk$(e).iterator();i.hasNext();){var s=i.next();o.add_11rb$(s)}if(r.isEmpty()||o.isEmpty())return null;do{var l=r.removeAt_za3lpa$(r.size-1|0);if(l!==o.removeAt_za3lpa$(o.size-1|0))return l.parent;var u=!r.isEmpty();u&&(u=!o.isEmpty())}while(u);return null},Kt.prototype.getClosestAncestor_hpi6l0$=function(t,e,n){var i;for(i=(e?this.ancestorsFrom_2jhxsk$(t):this.ancestors_2jhxsk$(t)).iterator();i.hasNext();){var r=i.next();if(n(r))return r}return null},Kt.prototype.isDescendant_5jhjy8$=function(t,e){return null!=this.getClosestAncestor_hpi6l0$(e,!0,S.Functions.same_tpy1pm$(t))},Kt.prototype.reverseAncestors_0=function(t){var e=x();return this.collectReverseAncestors_0(t,e),e},Kt.prototype.collectReverseAncestors_0=function(t,e){var n=t.parent;null!=n&&this.collectReverseAncestors_0(n,e),e.add_11rb$(t)},Kt.prototype.toList_qkgd1o$=function(t){var e,n=x();for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(i)}return n},Kt.prototype.isLastChild_ofc81$=function(t){var e,n;if(null==(e=t.parent))return!1;var i=e.children(),r=i.indexOf_11rb$(t);for(n=i.subList_vux9f0$(r+1|0,i.size).iterator();n.hasNext();)if(n.next().visible().get())return!1;return!0},Kt.prototype.isFirstChild_ofc81$=function(t){var e,n;if(null==(e=t.parent))return!1;var i=e.children(),r=i.indexOf_11rb$(t);for(n=i.subList_vux9f0$(0,r).iterator();n.hasNext();)if(n.next().visible().get())return!1;return!0},Kt.prototype.firstFocusable_ghk449$=function(t){return this.firstFocusable_eny5bg$(t,!0)},Kt.prototype.firstFocusable_eny5bg$=function(t,e){var n;for(n=t.children().iterator();n.hasNext();){var i=n.next();if(i.visible().get()){if(!e&&i.focusable().get())return i;var r=this.firstFocusable_ghk449$(i);if(null!=r)return r}}return t.focusable().get()?t:null},Kt.prototype.lastFocusable_ghk449$=function(t){return this.lastFocusable_eny5bg$(t,!0)},Kt.prototype.lastFocusable_eny5bg$=function(t,e){var n,i=t.children();for(n=O(T(i)).iterator();n.hasNext();){var r=n.next(),o=i.get_za3lpa$(r);if(o.visible().get()){if(!e&&o.focusable().get())return o;var a=this.lastFocusable_eny5bg$(o,e);if(null!=a)return a}}return t.focusable().get()?t:null},Kt.prototype.isVisible_vv2w6c$=function(t){return null==this.getClosestAncestor_hpi6l0$(t,!0,Zt)},Kt.prototype.focusableParent_2xdot8$=function(t){return this.focusableParent_ce34rj$(t,!1)},Kt.prototype.focusableParent_ce34rj$=function(t,e){return this.getClosestAncestor_hpi6l0$(t,e,Jt)},Kt.prototype.isFocusable_c3v93w$=function(t){return t.focusable().get()&&this.isVisible_vv2w6c$(t)},Kt.prototype.next_c8h0sn$=function(t,e){var n;for(n=this.nextNavOrder_gv3x1o$(t).iterator();n.hasNext();){var i=n.next();if(e(i))return i}return null},Kt.prototype.prev_c8h0sn$=function(t,e){var n;for(n=this.prevNavOrder_gv3x1o$(t).iterator();n.hasNext();){var i=n.next();if(e(i))return i}return null},Kt.prototype.nextFocusable_l3p44k$=function(t){var e;for(e=this.nextNavOrder_gv3x1o$(t).iterator();e.hasNext();){var n=e.next();if(this.isFocusable_c3v93w$(n))return n}return null},Kt.prototype.prevFocusable_l3p44k$=function(t){var e;for(e=this.prevNavOrder_gv3x1o$(t).iterator();e.hasNext();){var n=e.next();if(this.isFocusable_c3v93w$(n))return n}return null},Kt.prototype.iterate_e5aqdj$=function(t,e){return this.iterateFrom_0(e(t),e)},te.prototype.hasNext=function(){return null!=this.myCurrent_0},te.prototype.next=function(){if(null==this.myCurrent_0)throw N();var t=this.myCurrent_0;return this.myCurrent_0=this.closure$trans(f(t)),t},te.$metadata$={kind:c,interfaces:[P]},Qt.prototype.iterator=function(){return new te(this.closure$trans,this.closure$initial)},Qt.$metadata$={kind:c,interfaces:[A]},Kt.prototype.iterateFrom_0=function(t,e){return new Qt(e,t)},Kt.prototype.allBetween_yd3t6i$=function(t,e){var n=x();return e!==t&&this.includeClosed_0(t,e,n),n},Kt.prototype.includeClosed_0=function(t,e,n){for(var i=t.nextSibling();null!=i;){if(this.includeOpen_0(i,e,n))return;i=i.nextSibling()}if(null==t.parent)throw C("Right bound not found in left's bound hierarchy. to="+e);this.includeClosed_0(f(t.parent),e,n)},Kt.prototype.includeOpen_0=function(t,e,n){var i;if(t===e)return!0;for(i=t.children().iterator();i.hasNext();){var r=i.next();if(this.includeOpen_0(r,e,n))return!0}return n.add_11rb$(t),!1},Kt.prototype.isAbove_k112ux$=function(t,e){return this.ourWithBounds_0.isAbove_k112ux$(t,e)},Kt.prototype.isBelow_k112ux$=function(t,e){return this.ourWithBounds_0.isBelow_k112ux$(t,e)},Kt.prototype.homeElement_mgqo3l$=function(t){return this.ourWithBounds_0.homeElement_mgqo3l$(t)},Kt.prototype.endElement_mgqo3l$=function(t){return this.ourWithBounds_0.endElement_mgqo3l$(t)},Kt.prototype.upperFocusable_8i9rgd$=function(t,e){return this.ourWithBounds_0.upperFocusable_8i9rgd$(t,e)},Kt.prototype.lowerFocusable_8i9rgd$=function(t,e){return this.ourWithBounds_0.lowerFocusable_8i9rgd$(t,e)},Kt.$metadata$={kind:d,simpleName:"Composites",interfaces:[]};var ee=null;function ne(){return null===ee&&new Kt,ee}function ie(t){this.myThreshold_0=t}function re(t,e){this.$outer=t,this.myInitial_0=e,this.myFirstFocusableAbove_0=null,this.myFirstFocusableAbove_0=this.firstFocusableAbove_0(this.myInitial_0)}function oe(t,e){this.$outer=t,this.myInitial_0=e,this.myFirstFocusableBelow_0=null,this.myFirstFocusableBelow_0=this.firstFocusableBelow_0(this.myInitial_0)}function ae(){}function se(){Y.call(this),this.myListeners_xjxep$_0=null}function le(t){this.closure$item=t}function ue(t,e){this.closure$iterator=t,this.this$AbstractObservableSet=e,this.myCanRemove_0=!1,this.myLastReturned_0=null}function ce(t){this.closure$item=t}function pe(t){this.closure$handler=t,B.call(this)}function he(){se.call(this),this.mySet_fvkh6y$_0=null}function _e(){}function fe(){}function de(t){this.closure$onEvent=t}function me(){this.myListeners_0=new w}function ye(t){this.closure$event=t}function $e(t){J.call(this),this.myValue_uehepj$_0=t,this.myHandlers_e7gyn7$_0=null}function ve(t){this.closure$event=t}function ge(t){this.this$BaseDerivedProperty=t,w.call(this)}function be(t,e){$e.call(this,t);var n,i=Q(e.length);n=i.length-1|0;for(var r=0;r<=n;r++)i[r]=e[r];this.myDeps_nbedfd$_0=i,this.myRegistrations_3svoxv$_0=null}function we(t){this.this$DerivedProperty=t}function xe(){fn=this,this.TRUE=this.constant_mh5how$(!0),this.FALSE=this.constant_mh5how$(!1)}function ke(t){return null==t?null:!t}function Ee(t){return null!=t}function Ce(t){return null==t}function Se(t,e,n,i){this.closure$string=t,this.closure$prefix=e,be.call(this,n,i)}function Te(t,e,n){this.closure$prop=t,be.call(this,e,n)}function Oe(t,e,n,i){this.closure$op1=t,this.closure$op2=e,be.call(this,n,i)}function Ne(t,e,n,i){this.closure$op1=t,this.closure$op2=e,be.call(this,n,i)}function Pe(t,e,n,i){this.closure$p1=t,this.closure$p2=e,be.call(this,n,i)}function Ae(t,e,n){this.closure$source=t,this.closure$nullValue=e,this.closure$fun=n}function je(t,e,n,i){this.closure$source=t,this.closure$fun=e,this.closure$calc=n,$e.call(this,i),this.myTargetProperty_0=null,this.mySourceRegistration_0=null,this.myTargetRegistration_0=null}function Le(t){this.this$=t}function Re(t,e,n,i){this.this$=t,this.closure$source=e,this.closure$fun=n,this.closure$targetHandler=i}function Ie(t,e){this.closure$source=t,this.closure$fun=e}function ze(t,e,n){this.closure$source=t,this.closure$fun=e,this.closure$calc=n,$e.call(this,n.get()),this.myTargetProperty_0=null,this.mySourceRegistration_0=null,this.myTargetRegistration_0=null}function De(t){this.this$MyProperty=t}function Me(t,e,n,i){this.this$MyProperty=t,this.closure$source=e,this.closure$fun=n,this.closure$targetHandler=i}function Be(t,e){this.closure$prop=t,this.closure$selector=e}function Ue(t,e,n,i){this.closure$esReg=t,this.closure$prop=e,this.closure$selector=n,this.closure$handler=i}function Fe(t){this.closure$update=t}function qe(t,e){this.closure$propReg=t,this.closure$esReg=e,s.call(this)}function Ge(t,e,n,i){this.closure$p1=t,this.closure$p2=e,be.call(this,n,i)}function He(t,e,n,i){this.closure$prop=t,this.closure$f=e,be.call(this,n,i)}function Ye(t,e,n){this.closure$prop=t,this.closure$sToT=e,this.closure$tToS=n}function Ve(t,e){this.closure$sToT=t,this.closure$handler=e}function Ke(t){this.closure$value=t,J.call(this)}function We(t,e,n){this.closure$collection=t,mn.call(this,e,n)}function Xe(t,e,n){this.closure$collection=t,mn.call(this,e,n)}function Ze(t,e){this.closure$collection=t,$e.call(this,e),this.myCollectionRegistration_0=null}function Je(t){this.this$=t}function Qe(t){this.closure$r=t,B.call(this)}function tn(t,e,n,i,r){this.closure$cond=t,this.closure$ifTrue=e,this.closure$ifFalse=n,be.call(this,i,r)}function en(t,e,n){this.closure$cond=t,this.closure$ifTrue=e,this.closure$ifFalse=n}function nn(t,e,n,i){this.closure$prop=t,this.closure$ifNull=e,be.call(this,n,i)}function rn(t,e,n){this.closure$values=t,be.call(this,e,n)}function on(t,e,n,i){this.closure$source=t,this.closure$validator=e,be.call(this,n,i)}function an(t,e){this.closure$source=t,this.closure$validator=e,be.call(this,null,[t]),this.myLastValid_0=null}function sn(t,e,n,i){this.closure$p=t,this.closure$nullValue=e,be.call(this,n,i)}function ln(t,e){this.closure$read=t,this.closure$write=e}function un(t){this.closure$props=t}function cn(t){this.closure$coll=t}function pn(t,e){this.closure$coll=t,this.closure$handler=e,B.call(this)}function hn(t,e,n){this.closure$props=t,be.call(this,e,n)}function _n(t,e,n){this.closure$props=t,be.call(this,e,n)}ie.prototype.isAbove_k112ux$=function(t,e){var n=f(t).bounds,i=f(e).bounds;return(n.origin.y+n.dimension.y-this.myThreshold_0|0)<=i.origin.y},ie.prototype.isBelow_k112ux$=function(t,e){return this.isAbove_k112ux$(e,t)},ie.prototype.homeElement_mgqo3l$=function(t){for(var e=t;;){var n=ne().prevFocusable_l3p44k$(e);if(null==n||this.isAbove_k112ux$(n,t))return e;e=n}},ie.prototype.endElement_mgqo3l$=function(t){for(var e=t;;){var n=ne().nextFocusable_l3p44k$(e);if(null==n||this.isBelow_k112ux$(n,t))return e;e=n}},ie.prototype.upperFocusables_mgqo3l$=function(t){var e,n=new re(this,t);return ne().iterate_e5aqdj$(t,(e=n,function(t){return e.apply_11rb$(t)}))},ie.prototype.lowerFocusables_mgqo3l$=function(t){var e,n=new oe(this,t);return ne().iterate_e5aqdj$(t,(e=n,function(t){return e.apply_11rb$(t)}))},ie.prototype.upperFocusable_8i9rgd$=function(t,e){for(var n=ne().prevFocusable_l3p44k$(t),i=null;null!=n&&(null==i||!this.isAbove_k112ux$(n,i));)null!=i?this.distanceTo_nr7zox$(i,e)>this.distanceTo_nr7zox$(n,e)&&(i=n):this.isAbove_k112ux$(n,t)&&(i=n),n=ne().prevFocusable_l3p44k$(n);return i},ie.prototype.lowerFocusable_8i9rgd$=function(t,e){for(var n=ne().nextFocusable_l3p44k$(t),i=null;null!=n&&(null==i||!this.isBelow_k112ux$(n,i));)null!=i?this.distanceTo_nr7zox$(i,e)>this.distanceTo_nr7zox$(n,e)&&(i=n):this.isBelow_k112ux$(n,t)&&(i=n),n=ne().nextFocusable_l3p44k$(n);return i},ie.prototype.distanceTo_nr7zox$=function(t,e){var n=t.bounds;return n.distance_119tl4$(new L(e,n.origin.y))},re.prototype.firstFocusableAbove_0=function(t){for(var e=ne().prevFocusable_l3p44k$(t);null!=e&&!this.$outer.isAbove_k112ux$(e,t);)e=ne().prevFocusable_l3p44k$(e);return e},re.prototype.apply_11rb$=function(t){if(t===this.myInitial_0)return this.myFirstFocusableAbove_0;var e=ne().prevFocusable_l3p44k$(t);return null==e||this.$outer.isAbove_k112ux$(e,this.myFirstFocusableAbove_0)?null:e},re.$metadata$={kind:c,simpleName:"NextUpperFocusable",interfaces:[R]},oe.prototype.firstFocusableBelow_0=function(t){for(var e=ne().nextFocusable_l3p44k$(t);null!=e&&!this.$outer.isBelow_k112ux$(e,t);)e=ne().nextFocusable_l3p44k$(e);return e},oe.prototype.apply_11rb$=function(t){if(t===this.myInitial_0)return this.myFirstFocusableBelow_0;var e=ne().nextFocusable_l3p44k$(t);return null==e||this.$outer.isBelow_k112ux$(e,this.myFirstFocusableBelow_0)?null:e},oe.$metadata$={kind:c,simpleName:"NextLowerFocusable",interfaces:[R]},ie.$metadata$={kind:c,simpleName:"CompositesWithBounds",interfaces:[]},ae.$metadata$={kind:r,simpleName:"HasParent",interfaces:[]},se.prototype.addListener_n5no9j$=function(t){return null==this.myListeners_xjxep$_0&&(this.myListeners_xjxep$_0=new w),f(this.myListeners_xjxep$_0).add_11rb$(t)},se.prototype.add_11rb$=function(t){if(this.contains_11rb$(t))return!1;this.doBeforeAdd_zcqj2i$_0(t);var e=!1;try{this.onItemAdd_11rb$(t),e=this.doAdd_11rb$(t)}finally{this.doAfterAdd_yxsu9c$_0(t,e)}return e},se.prototype.doBeforeAdd_zcqj2i$_0=function(t){this.checkAdd_11rb$(t),this.beforeItemAdded_11rb$(t)},le.prototype.call_11rb$=function(t){t.onItemAdded_u8tacu$(new G(null,this.closure$item,-1,q.ADD))},le.$metadata$={kind:c,interfaces:[b]},se.prototype.doAfterAdd_yxsu9c$_0=function(t,e){try{e&&null!=this.myListeners_xjxep$_0&&f(this.myListeners_xjxep$_0).fire_kucmxw$(new le(t))}finally{this.afterItemAdded_iuyhfk$(t,e)}},se.prototype.remove_11rb$=function(t){if(!this.contains_11rb$(t))return!1;this.doBeforeRemove_u15i8b$_0(t);var e=!1;try{this.onItemRemove_11rb$(t),e=this.doRemove_11rb$(t)}finally{this.doAfterRemove_xembz3$_0(t,e)}return e},ue.prototype.hasNext=function(){return this.closure$iterator.hasNext()},ue.prototype.next=function(){return this.myLastReturned_0=this.closure$iterator.next(),this.myCanRemove_0=!0,f(this.myLastReturned_0)},ue.prototype.remove=function(){if(!this.myCanRemove_0)throw U();this.myCanRemove_0=!1,this.this$AbstractObservableSet.doBeforeRemove_u15i8b$_0(f(this.myLastReturned_0));var t=!1;try{this.closure$iterator.remove(),t=!0}finally{this.this$AbstractObservableSet.doAfterRemove_xembz3$_0(f(this.myLastReturned_0),t)}},ue.$metadata$={kind:c,interfaces:[H]},se.prototype.iterator=function(){return 0===this.size?V().iterator():new ue(this.actualIterator,this)},se.prototype.doBeforeRemove_u15i8b$_0=function(t){this.checkRemove_11rb$(t),this.beforeItemRemoved_11rb$(t)},ce.prototype.call_11rb$=function(t){t.onItemRemoved_u8tacu$(new G(this.closure$item,null,-1,q.REMOVE))},ce.$metadata$={kind:c,interfaces:[b]},se.prototype.doAfterRemove_xembz3$_0=function(t,e){try{e&&null!=this.myListeners_xjxep$_0&&f(this.myListeners_xjxep$_0).fire_kucmxw$(new ce(t))}finally{this.afterItemRemoved_iuyhfk$(t,e)}},se.prototype.checkAdd_11rb$=function(t){},se.prototype.checkRemove_11rb$=function(t){},se.prototype.beforeItemAdded_11rb$=function(t){},se.prototype.onItemAdd_11rb$=function(t){},se.prototype.afterItemAdded_iuyhfk$=function(t,e){},se.prototype.beforeItemRemoved_11rb$=function(t){},se.prototype.onItemRemove_11rb$=function(t){},se.prototype.afterItemRemoved_iuyhfk$=function(t,e){},pe.prototype.onItemAdded_u8tacu$=function(t){this.closure$handler.onEvent_11rb$(t)},pe.prototype.onItemRemoved_u8tacu$=function(t){this.closure$handler.onEvent_11rb$(t)},pe.$metadata$={kind:c,interfaces:[B]},se.prototype.addHandler_gxwwpc$=function(t){return this.addListener_n5no9j$(new pe(t))},se.$metadata$={kind:c,simpleName:"AbstractObservableSet",interfaces:[_e,Y]},Object.defineProperty(he.prototype,"size",{configurable:!0,get:function(){var t,e;return null!=(e=null!=(t=this.mySet_fvkh6y$_0)?t.size:null)?e:0}}),Object.defineProperty(he.prototype,"actualIterator",{configurable:!0,get:function(){return f(this.mySet_fvkh6y$_0).iterator()}}),he.prototype.contains_11rb$=function(t){var e,n;return null!=(n=null!=(e=this.mySet_fvkh6y$_0)?e.contains_11rb$(t):null)&&n},he.prototype.doAdd_11rb$=function(t){return this.ensureSetInitialized_8c11ng$_0(),f(this.mySet_fvkh6y$_0).add_11rb$(t)},he.prototype.doRemove_11rb$=function(t){return f(this.mySet_fvkh6y$_0).remove_11rb$(t)},he.prototype.ensureSetInitialized_8c11ng$_0=function(){null==this.mySet_fvkh6y$_0&&(this.mySet_fvkh6y$_0=K(1))},he.$metadata$={kind:c,simpleName:"ObservableHashSet",interfaces:[se]},_e.$metadata$={kind:r,simpleName:"ObservableSet",interfaces:[I,W]},fe.$metadata$={kind:r,simpleName:"EventHandler",interfaces:[]},de.prototype.onEvent_11rb$=function(t){this.closure$onEvent(t)},de.$metadata$={kind:c,interfaces:[fe]},ye.prototype.call_11rb$=function(t){t.onEvent_11rb$(this.closure$event)},ye.$metadata$={kind:c,interfaces:[b]},me.prototype.fire_11rb$=function(t){this.myListeners_0.fire_kucmxw$(new ye(t))},me.prototype.addHandler_gxwwpc$=function(t){return this.myListeners_0.add_11rb$(t)},me.$metadata$={kind:c,simpleName:"SimpleEventSource",interfaces:[Z]},$e.prototype.get=function(){return null!=this.myHandlers_e7gyn7$_0?this.myValue_uehepj$_0:this.doGet()},ve.prototype.call_11rb$=function(t){t.onEvent_11rb$(this.closure$event)},ve.$metadata$={kind:c,interfaces:[b]},$e.prototype.somethingChanged=function(){var t=this.doGet();if(!F(this.myValue_uehepj$_0,t)){var e=new D(this.myValue_uehepj$_0,t);this.myValue_uehepj$_0=t,null!=this.myHandlers_e7gyn7$_0&&f(this.myHandlers_e7gyn7$_0).fire_kucmxw$(new ve(e))}},ge.prototype.beforeFirstAdded=function(){this.this$BaseDerivedProperty.myValue_uehepj$_0=this.this$BaseDerivedProperty.doGet(),this.this$BaseDerivedProperty.doAddListeners()},ge.prototype.afterLastRemoved=function(){this.this$BaseDerivedProperty.doRemoveListeners(),this.this$BaseDerivedProperty.myHandlers_e7gyn7$_0=null},ge.$metadata$={kind:c,interfaces:[w]},$e.prototype.addHandler_gxwwpc$=function(t){return null==this.myHandlers_e7gyn7$_0&&(this.myHandlers_e7gyn7$_0=new ge(this)),f(this.myHandlers_e7gyn7$_0).add_11rb$(t)},$e.$metadata$={kind:c,simpleName:"BaseDerivedProperty",interfaces:[J]},be.prototype.doAddListeners=function(){var t,e=Q(this.myDeps_nbedfd$_0.length);t=e.length-1|0;for(var n=0;n<=t;n++)e[n]=this.register_hhwf17$_0(this.myDeps_nbedfd$_0[n]);this.myRegistrations_3svoxv$_0=e},we.prototype.onEvent_11rb$=function(t){this.this$DerivedProperty.somethingChanged()},we.$metadata$={kind:c,interfaces:[fe]},be.prototype.register_hhwf17$_0=function(t){return t.addHandler_gxwwpc$(new we(this))},be.prototype.doRemoveListeners=function(){var t,e;for(t=f(this.myRegistrations_3svoxv$_0),e=0;e!==t.length;++e)t[e].remove();this.myRegistrations_3svoxv$_0=null},be.$metadata$={kind:c,simpleName:"DerivedProperty",interfaces:[$e]},xe.prototype.not_scsqf1$=function(t){return this.map_ohntev$(t,ke)},xe.prototype.notNull_pnjvn9$=function(t){return this.map_ohntev$(t,Ee)},xe.prototype.isNull_pnjvn9$=function(t){return this.map_ohntev$(t,Ce)},Object.defineProperty(Se.prototype,"propExpr",{configurable:!0,get:function(){return"startsWith("+this.closure$string.propExpr+", "+this.closure$prefix.propExpr+")"}}),Se.prototype.doGet=function(){return null!=this.closure$string.get()&&null!=this.closure$prefix.get()&&tt(f(this.closure$string.get()),f(this.closure$prefix.get()))},Se.$metadata$={kind:c,interfaces:[be]},xe.prototype.startsWith_258nik$=function(t,e){return new Se(t,e,!1,[t,e])},Object.defineProperty(Te.prototype,"propExpr",{configurable:!0,get:function(){return"isEmptyString("+this.closure$prop.propExpr+")"}}),Te.prototype.doGet=function(){var t=this.closure$prop.get(),e=null==t;return e||(e=0===t.length),e},Te.$metadata$={kind:c,interfaces:[be]},xe.prototype.isNullOrEmpty_zi86m3$=function(t){return new Te(t,!1,[t])},Object.defineProperty(Oe.prototype,"propExpr",{configurable:!0,get:function(){return"("+this.closure$op1.propExpr+" && "+this.closure$op2.propExpr+")"}}),Oe.prototype.doGet=function(){return dn().and_0(this.closure$op1.get(),this.closure$op2.get())},Oe.$metadata$={kind:c,interfaces:[be]},xe.prototype.and_us87nw$=function(t,e){return new Oe(t,e,null,[t,e])},xe.prototype.and_0=function(t,e){return null==t?this.andWithNull_0(e):null==e?this.andWithNull_0(t):t&&e},xe.prototype.andWithNull_0=function(t){return!(null!=t&&!t)&&null},Object.defineProperty(Ne.prototype,"propExpr",{configurable:!0,get:function(){return"("+this.closure$op1.propExpr+" || "+this.closure$op2.propExpr+")"}}),Ne.prototype.doGet=function(){return dn().or_0(this.closure$op1.get(),this.closure$op2.get())},Ne.$metadata$={kind:c,interfaces:[be]},xe.prototype.or_us87nw$=function(t,e){return new Ne(t,e,null,[t,e])},xe.prototype.or_0=function(t,e){return null==t?this.orWithNull_0(e):null==e?this.orWithNull_0(t):t||e},xe.prototype.orWithNull_0=function(t){return!(null==t||!t)||null},Object.defineProperty(Pe.prototype,"propExpr",{configurable:!0,get:function(){return"("+this.closure$p1.propExpr+" + "+this.closure$p2.propExpr+")"}}),Pe.prototype.doGet=function(){return null==this.closure$p1.get()||null==this.closure$p2.get()?null:f(this.closure$p1.get())+f(this.closure$p2.get())|0},Pe.$metadata$={kind:c,interfaces:[be]},xe.prototype.add_qmazvq$=function(t,e){return new Pe(t,e,null,[t,e])},xe.prototype.select_uirx34$=function(t,e){return this.select_phvhtn$(t,e,null)},Ae.prototype.get=function(){var t;if(null==(t=this.closure$source.get()))return this.closure$nullValue;var e=t;return this.closure$fun(e).get()},Ae.$metadata$={kind:c,interfaces:[et]},Object.defineProperty(je.prototype,"propExpr",{configurable:!0,get:function(){return"select("+this.closure$source.propExpr+", "+E(this.closure$fun)+")"}}),Le.prototype.onEvent_11rb$=function(t){this.this$.somethingChanged()},Le.$metadata$={kind:c,interfaces:[fe]},Re.prototype.onEvent_11rb$=function(t){null!=this.this$.myTargetProperty_0&&f(this.this$.myTargetRegistration_0).remove();var e=this.closure$source.get();this.this$.myTargetProperty_0=null!=e?this.closure$fun(e):null,null!=this.this$.myTargetProperty_0&&(this.this$.myTargetRegistration_0=f(this.this$.myTargetProperty_0).addHandler_gxwwpc$(this.closure$targetHandler)),this.this$.somethingChanged()},Re.$metadata$={kind:c,interfaces:[fe]},je.prototype.doAddListeners=function(){this.myTargetProperty_0=null==this.closure$source.get()?null:this.closure$fun(this.closure$source.get());var t=new Le(this),e=new Re(this,this.closure$source,this.closure$fun,t);this.mySourceRegistration_0=this.closure$source.addHandler_gxwwpc$(e),null!=this.myTargetProperty_0&&(this.myTargetRegistration_0=f(this.myTargetProperty_0).addHandler_gxwwpc$(t))},je.prototype.doRemoveListeners=function(){null!=this.myTargetProperty_0&&f(this.myTargetRegistration_0).remove(),f(this.mySourceRegistration_0).remove()},je.prototype.doGet=function(){return this.closure$calc.get()},je.$metadata$={kind:c,interfaces:[$e]},xe.prototype.select_phvhtn$=function(t,e,n){return new je(t,e,new Ae(t,n,e),null)},Ie.prototype.get=function(){var t;if(null==(t=this.closure$source.get()))return null;var e=t;return this.closure$fun(e).get()},Ie.$metadata$={kind:c,interfaces:[et]},Object.defineProperty(ze.prototype,"propExpr",{configurable:!0,get:function(){return"select("+this.closure$source.propExpr+", "+E(this.closure$fun)+")"}}),De.prototype.onEvent_11rb$=function(t){this.this$MyProperty.somethingChanged()},De.$metadata$={kind:c,interfaces:[fe]},Me.prototype.onEvent_11rb$=function(t){null!=this.this$MyProperty.myTargetProperty_0&&f(this.this$MyProperty.myTargetRegistration_0).remove();var e=this.closure$source.get();this.this$MyProperty.myTargetProperty_0=null!=e?this.closure$fun(e):null,null!=this.this$MyProperty.myTargetProperty_0&&(this.this$MyProperty.myTargetRegistration_0=f(this.this$MyProperty.myTargetProperty_0).addHandler_gxwwpc$(this.closure$targetHandler)),this.this$MyProperty.somethingChanged()},Me.$metadata$={kind:c,interfaces:[fe]},ze.prototype.doAddListeners=function(){this.myTargetProperty_0=null==this.closure$source.get()?null:this.closure$fun(this.closure$source.get());var t=new De(this),e=new Me(this,this.closure$source,this.closure$fun,t);this.mySourceRegistration_0=this.closure$source.addHandler_gxwwpc$(e),null!=this.myTargetProperty_0&&(this.myTargetRegistration_0=f(this.myTargetProperty_0).addHandler_gxwwpc$(t))},ze.prototype.doRemoveListeners=function(){null!=this.myTargetProperty_0&&f(this.myTargetRegistration_0).remove(),f(this.mySourceRegistration_0).remove()},ze.prototype.doGet=function(){return this.closure$calc.get()},ze.prototype.set_11rb$=function(t){null!=this.myTargetProperty_0&&f(this.myTargetProperty_0).set_11rb$(t)},ze.$metadata$={kind:c,simpleName:"MyProperty",interfaces:[M,$e]},xe.prototype.selectRw_dnjkuo$=function(t,e){return new ze(t,e,new Ie(t,e))},Ue.prototype.run=function(){this.closure$esReg.get().remove(),null!=this.closure$prop.get()?this.closure$esReg.set_11rb$(this.closure$selector(this.closure$prop.get()).addHandler_gxwwpc$(this.closure$handler)):this.closure$esReg.set_11rb$(s.Companion.EMPTY)},Ue.$metadata$={kind:c,interfaces:[X]},Fe.prototype.onEvent_11rb$=function(t){this.closure$update.run()},Fe.$metadata$={kind:c,interfaces:[fe]},qe.prototype.doRemove=function(){this.closure$propReg.remove(),this.closure$esReg.get().remove()},qe.$metadata$={kind:c,interfaces:[s]},Be.prototype.addHandler_gxwwpc$=function(t){var e=new o(s.Companion.EMPTY),n=new Ue(e,this.closure$prop,this.closure$selector,t);return n.run(),new qe(this.closure$prop.addHandler_gxwwpc$(new Fe(n)),e)},Be.$metadata$={kind:c,interfaces:[Z]},xe.prototype.selectEvent_mncfl5$=function(t,e){return new Be(t,e)},xe.prototype.same_xyb9ob$=function(t,e){return this.map_ohntev$(t,(n=e,function(t){return t===n}));var n},xe.prototype.equals_xyb9ob$=function(t,e){return this.map_ohntev$(t,(n=e,function(t){return F(t,n)}));var n},Object.defineProperty(Ge.prototype,"propExpr",{configurable:!0,get:function(){return"equals("+this.closure$p1.propExpr+", "+this.closure$p2.propExpr+")"}}),Ge.prototype.doGet=function(){return F(this.closure$p1.get(),this.closure$p2.get())},Ge.$metadata$={kind:c,interfaces:[be]},xe.prototype.equals_r3q8zu$=function(t,e){return new Ge(t,e,!1,[t,e])},xe.prototype.notEquals_xyb9ob$=function(t,e){return this.not_scsqf1$(this.equals_xyb9ob$(t,e))},xe.prototype.notEquals_r3q8zu$=function(t,e){return this.not_scsqf1$(this.equals_r3q8zu$(t,e))},Object.defineProperty(He.prototype,"propExpr",{configurable:!0,get:function(){return"transform("+this.closure$prop.propExpr+", "+E(this.closure$f)+")"}}),He.prototype.doGet=function(){return this.closure$f(this.closure$prop.get())},He.$metadata$={kind:c,interfaces:[be]},xe.prototype.map_ohntev$=function(t,e){return new He(t,e,e(t.get()),[t])},Object.defineProperty(Ye.prototype,"propExpr",{configurable:!0,get:function(){return"transform("+this.closure$prop.propExpr+", "+E(this.closure$sToT)+", "+E(this.closure$tToS)+")"}}),Ye.prototype.get=function(){return this.closure$sToT(this.closure$prop.get())},Ve.prototype.onEvent_11rb$=function(t){var e=this.closure$sToT(t.oldValue),n=this.closure$sToT(t.newValue);F(e,n)||this.closure$handler.onEvent_11rb$(new D(e,n))},Ve.$metadata$={kind:c,interfaces:[fe]},Ye.prototype.addHandler_gxwwpc$=function(t){return this.closure$prop.addHandler_gxwwpc$(new Ve(this.closure$sToT,t))},Ye.prototype.set_11rb$=function(t){this.closure$prop.set_11rb$(this.closure$tToS(t))},Ye.$metadata$={kind:c,simpleName:"TransformedProperty",interfaces:[M]},xe.prototype.map_6va22f$=function(t,e,n){return new Ye(t,e,n)},Object.defineProperty(Ke.prototype,"propExpr",{configurable:!0,get:function(){return"constant("+this.closure$value+")"}}),Ke.prototype.get=function(){return this.closure$value},Ke.prototype.addHandler_gxwwpc$=function(t){return s.Companion.EMPTY},Ke.$metadata$={kind:c,interfaces:[J]},xe.prototype.constant_mh5how$=function(t){return new Ke(t)},Object.defineProperty(We.prototype,"propExpr",{configurable:!0,get:function(){return"isEmpty("+this.closure$collection+")"}}),We.prototype.doGet=function(){return this.closure$collection.isEmpty()},We.$metadata$={kind:c,interfaces:[mn]},xe.prototype.isEmpty_4gck1s$=function(t){return new We(t,t,t.isEmpty())},Object.defineProperty(Xe.prototype,"propExpr",{configurable:!0,get:function(){return"size("+this.closure$collection+")"}}),Xe.prototype.doGet=function(){return this.closure$collection.size},Xe.$metadata$={kind:c,interfaces:[mn]},xe.prototype.size_4gck1s$=function(t){return new Xe(t,t,t.size)},xe.prototype.notEmpty_4gck1s$=function(t){var n;return this.not_scsqf1$(e.isType(n=this.empty_4gck1s$(t),nt)?n:u())},Object.defineProperty(Ze.prototype,"propExpr",{configurable:!0,get:function(){return"empty("+this.closure$collection+")"}}),Je.prototype.run=function(){this.this$.somethingChanged()},Je.$metadata$={kind:c,interfaces:[X]},Ze.prototype.doAddListeners=function(){this.myCollectionRegistration_0=this.closure$collection.addListener_n5no9j$(dn().simpleAdapter_0(new Je(this)))},Ze.prototype.doRemoveListeners=function(){f(this.myCollectionRegistration_0).remove()},Ze.prototype.doGet=function(){return this.closure$collection.isEmpty()},Ze.$metadata$={kind:c,interfaces:[$e]},xe.prototype.empty_4gck1s$=function(t){return new Ze(t,t.isEmpty())},Qe.prototype.onItemAdded_u8tacu$=function(t){this.closure$r.run()},Qe.prototype.onItemRemoved_u8tacu$=function(t){this.closure$r.run()},Qe.$metadata$={kind:c,interfaces:[B]},xe.prototype.simpleAdapter_0=function(t){return new Qe(t)},Object.defineProperty(tn.prototype,"propExpr",{configurable:!0,get:function(){return"if("+this.closure$cond.propExpr+", "+this.closure$ifTrue.propExpr+", "+this.closure$ifFalse.propExpr+")"}}),tn.prototype.doGet=function(){return this.closure$cond.get()?this.closure$ifTrue.get():this.closure$ifFalse.get()},tn.$metadata$={kind:c,interfaces:[be]},xe.prototype.ifProp_h6sj4s$=function(t,e,n){return new tn(t,e,n,null,[t,e,n])},xe.prototype.ifProp_2ercqg$=function(t,e,n){return this.ifProp_h6sj4s$(t,this.constant_mh5how$(e),this.constant_mh5how$(n))},en.prototype.set_11rb$=function(t){t?this.closure$cond.set_11rb$(this.closure$ifTrue):this.closure$cond.set_11rb$(this.closure$ifFalse)},en.$metadata$={kind:c,interfaces:[z]},xe.prototype.ifProp_g6gwfc$=function(t,e,n){return new en(t,e,n)},nn.prototype.doGet=function(){return null==this.closure$prop.get()?this.closure$ifNull:this.closure$prop.get()},nn.$metadata$={kind:c,interfaces:[be]},xe.prototype.withDefaultValue_xyb9ob$=function(t,e){return new nn(t,e,e,[t])},Object.defineProperty(rn.prototype,"propExpr",{configurable:!0,get:function(){var t,e,n=it();n.append_pdl1vj$("firstNotNull(");var i=!0;for(t=this.closure$values,e=0;e!==t.length;++e){var r=t[e];i?i=!1:n.append_pdl1vj$(", "),n.append_pdl1vj$(r.propExpr)}return n.append_pdl1vj$(")"),n.toString()}}),rn.prototype.doGet=function(){var t,e;for(t=this.closure$values,e=0;e!==t.length;++e){var n=t[e];if(null!=n.get())return n.get()}return null},rn.$metadata$={kind:c,interfaces:[be]},xe.prototype.firstNotNull_qrqmoy$=function(t){return new rn(t,null,t.slice())},Object.defineProperty(on.prototype,"propExpr",{configurable:!0,get:function(){return"isValid("+this.closure$source.propExpr+", "+E(this.closure$validator)+")"}}),on.prototype.doGet=function(){return this.closure$validator(this.closure$source.get())},on.$metadata$={kind:c,interfaces:[be]},xe.prototype.isPropertyValid_ngb39s$=function(t,e){return new on(t,e,!1,[t])},Object.defineProperty(an.prototype,"propExpr",{configurable:!0,get:function(){return"validated("+this.closure$source.propExpr+", "+E(this.closure$validator)+")"}}),an.prototype.doGet=function(){var t=this.closure$source.get();return this.closure$validator(t)&&(this.myLastValid_0=t),this.myLastValid_0},an.prototype.set_11rb$=function(t){this.closure$validator(t)&&this.closure$source.set_11rb$(t)},an.$metadata$={kind:c,simpleName:"ValidatedProperty",interfaces:[M,be]},xe.prototype.validatedProperty_nzo3ll$=function(t,e){return new an(t,e)},sn.prototype.doGet=function(){var t=this.closure$p.get();return null!=t?""+E(t):this.closure$nullValue},sn.$metadata$={kind:c,interfaces:[be]},xe.prototype.toStringOf_ysc3eg$=function(t,e){return void 0===e&&(e="null"),new sn(t,e,e,[t])},Object.defineProperty(ln.prototype,"propExpr",{configurable:!0,get:function(){return this.closure$read.propExpr}}),ln.prototype.get=function(){return this.closure$read.get()},ln.prototype.addHandler_gxwwpc$=function(t){return this.closure$read.addHandler_gxwwpc$(t)},ln.prototype.set_11rb$=function(t){this.closure$write.set_11rb$(t)},ln.$metadata$={kind:c,interfaces:[M]},xe.prototype.property_2ov6i0$=function(t,e){return new ln(t,e)},un.prototype.set_11rb$=function(t){var e,n;for(e=this.closure$props,n=0;n!==e.length;++n)e[n].set_11rb$(t)},un.$metadata$={kind:c,interfaces:[z]},xe.prototype.compose_qzq9dc$=function(t){return new un(t)},Object.defineProperty(cn.prototype,"propExpr",{configurable:!0,get:function(){return"singleItemCollection("+this.closure$coll+")"}}),cn.prototype.get=function(){return this.closure$coll.isEmpty()?null:this.closure$coll.iterator().next()},cn.prototype.set_11rb$=function(t){var e=this.get();F(e,t)||(this.closure$coll.clear(),null!=t&&this.closure$coll.add_11rb$(t))},pn.prototype.onItemAdded_u8tacu$=function(t){if(1!==this.closure$coll.size)throw U();this.closure$handler.onEvent_11rb$(new D(null,t.newItem))},pn.prototype.onItemSet_u8tacu$=function(t){if(0!==t.index)throw U();this.closure$handler.onEvent_11rb$(new D(t.oldItem,t.newItem))},pn.prototype.onItemRemoved_u8tacu$=function(t){if(!this.closure$coll.isEmpty())throw U();this.closure$handler.onEvent_11rb$(new D(t.oldItem,null))},pn.$metadata$={kind:c,interfaces:[B]},cn.prototype.addHandler_gxwwpc$=function(t){return this.closure$coll.addListener_n5no9j$(new pn(this.closure$coll,t))},cn.$metadata$={kind:c,interfaces:[M]},xe.prototype.forSingleItemCollection_4gck1s$=function(t){if(t.size>1)throw g("Collection "+t+" has more than one item");return new cn(t)},Object.defineProperty(hn.prototype,"propExpr",{configurable:!0,get:function(){var t,e=new rt("(");e.append_pdl1vj$(this.closure$props[0].propExpr),t=this.closure$props.length;for(var n=1;n>4)},Ke.prototype.type_kcn2v3$=function(t){return sn().fromCode_kcn2v3$(15&t)},Ke.prototype.assertNoMeta_0=function(t){if(this.isSet_0(t,3))throw P("META_EXTRA_PRECISION_BIT is not supported");if(this.isSet_0(t,1))throw P("META_SIZE_BIT is not supported");if(this.isSet_0(t,0))throw P("META_BBOX_BIT is not supported")},on.prototype.fromCode_kcn2v3$=function(t){switch(t){case 1:return Ze();case 2:return Je();case 3:return Qe();case 4:return tn();case 5:return en();case 6:return nn();case 7:return rn();default:throw j("Unkown geometry type: "+t)}},on.$metadata$={kind:m,simpleName:"Companion",interfaces:[]};var an=null;function sn(){return Xe(),null===an&&new on,an}We.$metadata$={kind:$,simpleName:"GeometryType",interfaces:[L]},We.values=function(){return[Ze(),Je(),Qe(),tn(),en(),nn(),rn()]},We.valueOf_61zpoe$=function(t){switch(t){case"POINT":return Ze();case"LINESTRING":return Je();case"POLYGON":return Qe();case"MULTI_POINT":return tn();case"MULTI_LINESTRING":return en();case"MULTI_POLYGON":return nn();case"GEOMETRY_COLLECTION":return rn();default:R("No enum constant jetbrains.gis.common.twkb.Twkb.Parser.GeometryType."+t)}},Ke.$metadata$={kind:$,simpleName:"Parser",interfaces:[]},Ve.$metadata$={kind:m,simpleName:"Twkb",interfaces:[]};var ln=null;function un(){return null===ln&&new Ve,ln}function cn(){pn=this,this.VARINT_EXPECT_NEXT_PART_0=7}cn.prototype.readVarInt_5a21t1$=function(t){var e=this.readVarUInt_t0n4v2$(t);return this.decodeZigZag_kcn2v3$(e)},cn.prototype.readVarUInt_t0n4v2$=function(t){var e,n=0,i=0;do{n|=(127&(e=t()))<>1^(0|-(1&t))},cn.$metadata$={kind:m,simpleName:"VarInt",interfaces:[]};var pn=null;function hn(){return null===pn&&new cn,pn}function _n(){yn()}function fn(){mn=this}function dn(t){this.closure$points=t}dn.prototype.asMultipolygon=function(){return this.closure$points},dn.$metadata$={kind:$,interfaces:[_n]},fn.prototype.create_8ft4gs$=function(t){return new dn(t)},fn.$metadata$={kind:m,simpleName:"Companion",interfaces:[]};var mn=null;function yn(){return null===mn&&new fn,mn}function $n(){Bn=this}function vn(t){var e;this.rawData_8be2vx$=t,this.myMultipolygon_svkeey$_0=F((e=this,function(){return e.parse_61zpoe$(e.rawData_8be2vx$)}))}function gn(t){vn.call(this,t)}function bn(t){this.closure$polygons=t}function wn(t){vn.call(this,t)}function xn(t){return function(e){return e.onPolygon=function(t){return function(e){if(null!=t.v)throw j("Failed requirement.".toString());return t.v=new E(Y(e)),g}}(t),e.onMultiPolygon=function(t){return function(e){if(null!=t.v)throw j("Failed requirement.".toString());return t.v=e,g}}(t),g}}_n.$metadata$={kind:D,simpleName:"Boundary",interfaces:[]},$n.prototype.fromTwkb_61zpoe$=function(t){return new gn(t)},$n.prototype.fromGeoJson_61zpoe$=function(t){return new wn(t)},$n.prototype.getRawData_riekmd$=function(t){var n;return(e.isType(n=t,vn)?n:M()).rawData_8be2vx$},Object.defineProperty(vn.prototype,"myMultipolygon_0",{configurable:!0,get:function(){return this.myMultipolygon_svkeey$_0.value}}),vn.prototype.asMultipolygon=function(){return this.myMultipolygon_0},vn.prototype.hashCode=function(){return B(this.rawData_8be2vx$)},vn.prototype.equals=function(t){var n;return this===t||!(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))&&(e.isType(t,vn)||M(),!!U(this.rawData_8be2vx$,t.rawData_8be2vx$))},vn.$metadata$={kind:$,simpleName:"StringBoundary",interfaces:[_n]},bn.prototype.onPolygon_z3kb82$=function(t){this.closure$polygons.add_11rb$(t)},bn.prototype.onMultiPolygon_a0zxnd$=function(t){this.closure$polygons.addAll_brywnq$(t)},bn.$metadata$={kind:$,interfaces:[G]},gn.prototype.parse_61zpoe$=function(t){var e=z();return un().parse_gqqjn5$(q.Base64.decode_61zpoe$(t),new bn(e)),new E(e)},gn.$metadata$={kind:$,simpleName:"TinyBoundary",interfaces:[vn]},wn.prototype.parse_61zpoe$=function(t){var e,n={v:null};return H.GeoJson.parse_gdwatq$(t,xn(n)),null!=(e=n.v)?e:new E(V())},wn.$metadata$={kind:$,simpleName:"GeoJsonBoundary",interfaces:[vn]},$n.$metadata$={kind:m,simpleName:"Boundaries",interfaces:[]};var kn,En,Cn,Sn,Tn,On,Nn,Pn,An,jn,Ln,Rn,In,zn,Dn,Mn,Bn=null;function Un(){return null===Bn&&new $n,Bn}function Fn(t,e){L.call(this),this.name$=t,this.ordinal$=e}function qn(){qn=function(){},kn=new Fn("COUNTRY",0),En=new Fn("MACRO_STATE",1),Cn=new Fn("STATE",2),Sn=new Fn("MACRO_COUNTY",3),Tn=new Fn("COUNTY",4),On=new Fn("CITY",5)}function Gn(){return qn(),kn}function Hn(){return qn(),En}function Yn(){return qn(),Cn}function Vn(){return qn(),Sn}function Kn(){return qn(),Tn}function Wn(){return qn(),On}function Xn(){return[Gn(),Hn(),Yn(),Vn(),Kn(),Wn()]}function Zn(t,e){var n,i;this.key=t,this.boundaries=e,this.multiPolygon=null;var r=z();for(n=this.boundaries.iterator();n.hasNext();)for(i=n.next().asMultipolygon().iterator();i.hasNext();){var o=i.next();o.isEmpty()||r.add_11rb$(o)}this.multiPolygon=new E(r)}function Jn(){}function Qn(t,e,n){L.call(this),this.myValue_l7uf9u$_0=n,this.name$=t,this.ordinal$=e}function ti(){ti=function(){},Nn=new Qn("HIGHLIGHTS",0,"highlights"),Pn=new Qn("POSITION",1,"position"),An=new Qn("CENTROID",2,"centroid"),jn=new Qn("LIMIT",3,"limit"),Ln=new Qn("BOUNDARY",4,"boundary"),Rn=new Qn("FRAGMENTS",5,"tiles")}function ei(){return ti(),Nn}function ni(){return ti(),Pn}function ii(){return ti(),An}function ri(){return ti(),jn}function oi(){return ti(),Ln}function ai(){return ti(),Rn}function si(){}function li(){}function ui(t,e,n){$i(),this.ignoringStrategy=t,this.closestCoord=e,this.box=n}function ci(t,e){L.call(this),this.name$=t,this.ordinal$=e}function pi(){pi=function(){},In=new ci("SKIP_ALL",0),zn=new ci("SKIP_MISSING",1),Dn=new ci("SKIP_NAMESAKES",2),Mn=new ci("TAKE_NAMESAKES",3)}function hi(){return pi(),In}function _i(){return pi(),zn}function fi(){return pi(),Dn}function di(){return pi(),Mn}function mi(){yi=this}Fn.$metadata$={kind:$,simpleName:"FeatureLevel",interfaces:[L]},Fn.values=Xn,Fn.valueOf_61zpoe$=function(t){switch(t){case"COUNTRY":return Gn();case"MACRO_STATE":return Hn();case"STATE":return Yn();case"MACRO_COUNTY":return Vn();case"COUNTY":return Kn();case"CITY":return Wn();default:R("No enum constant jetbrains.gis.geoprotocol.FeatureLevel."+t)}},Zn.$metadata$={kind:$,simpleName:"Fragment",interfaces:[]},Qn.prototype.toString=function(){return this.myValue_l7uf9u$_0},Qn.$metadata$={kind:$,simpleName:"FeatureOption",interfaces:[L]},Qn.values=function(){return[ei(),ni(),ii(),ri(),oi(),ai()]},Qn.valueOf_61zpoe$=function(t){switch(t){case"HIGHLIGHTS":return ei();case"POSITION":return ni();case"CENTROID":return ii();case"LIMIT":return ri();case"BOUNDARY":return oi();case"FRAGMENTS":return ai();default:R("No enum constant jetbrains.gis.geoprotocol.GeoRequest.FeatureOption."+t)}},si.$metadata$={kind:D,simpleName:"ExplicitSearchRequest",interfaces:[Jn]},Object.defineProperty(ui.prototype,"isEmpty",{configurable:!0,get:function(){return null==this.closestCoord&&null==this.ignoringStrategy&&null==this.box}}),ci.$metadata$={kind:$,simpleName:"IgnoringStrategy",interfaces:[L]},ci.values=function(){return[hi(),_i(),fi(),di()]},ci.valueOf_61zpoe$=function(t){switch(t){case"SKIP_ALL":return hi();case"SKIP_MISSING":return _i();case"SKIP_NAMESAKES":return fi();case"TAKE_NAMESAKES":return di();default:R("No enum constant jetbrains.gis.geoprotocol.GeoRequest.GeocodingSearchRequest.AmbiguityResolver.IgnoringStrategy."+t)}},mi.prototype.ignoring_6lwvuf$=function(t){return new ui(t,null,null)},mi.prototype.closestTo_gpjtzr$=function(t){return new ui(null,t,null)},mi.prototype.within_wthzt5$=function(t){return new ui(null,null,t)},mi.prototype.empty=function(){return new ui(null,null,null)},mi.$metadata$={kind:m,simpleName:"Companion",interfaces:[]};var yi=null;function $i(){return null===yi&&new mi,yi}function vi(t,e,n){this.names=t,this.parent=e,this.ambiguityResolver=n}function gi(){}function bi(){Di=this,this.PARENT_KIND_ID_0=!0}function wi(){this.mySelf_r0smt8$_2fjbkj$_0=this.mySelf_r0smt8$_2fjbkj$_0,this.features=W(),this.fragments_n0offn$_0=null,this.levelOfDetails_31v9rh$_0=null}function xi(){wi.call(this),this.mode_17k92x$_0=lr(),this.coordinates_fjgqzn$_0=this.coordinates_fjgqzn$_0,this.level_y4w9sc$_0=this.level_y4w9sc$_0,this.parent_0=null,wi.prototype.setSelf_8auog8$.call(this,this)}function ki(t,e,n,i,r,o){Ai.call(this,t,e,n),this.coordinates_ulu2p5$_0=i,this.level_m6ep8g$_0=r,this.parent_xyqqdi$_0=o}function Ei(){Oi(),wi.call(this),this.mode_lc8f7p$_0=sr(),this.featureLevel_0=null,this.namesakeExampleLimit_0=10,this.regionQueries_0=z(),wi.prototype.setSelf_8auog8$.call(this,this)}function Ci(t,e,n,i,r,o){Ai.call(this,i,r,o),this.queries_kc4mug$_0=t,this.level_kybz0a$_0=e,this.namesakeExampleLimit_diu8fm$_0=n}function Si(){Ti=this,this.DEFAULT_NAMESAKE_EXAMPLE_LIMIT_0=10}ui.$metadata$={kind:$,simpleName:"AmbiguityResolver",interfaces:[]},ui.prototype.component1=function(){return this.ignoringStrategy},ui.prototype.component2=function(){return this.closestCoord},ui.prototype.component3=function(){return this.box},ui.prototype.copy_ixqc52$=function(t,e,n){return new ui(void 0===t?this.ignoringStrategy:t,void 0===e?this.closestCoord:e,void 0===n?this.box:n)},ui.prototype.toString=function(){return"AmbiguityResolver(ignoringStrategy="+e.toString(this.ignoringStrategy)+", closestCoord="+e.toString(this.closestCoord)+", box="+e.toString(this.box)+")"},ui.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*t+e.hashCode(this.ignoringStrategy)|0)+e.hashCode(this.closestCoord)|0)+e.hashCode(this.box)|0},ui.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.ignoringStrategy,t.ignoringStrategy)&&e.equals(this.closestCoord,t.closestCoord)&&e.equals(this.box,t.box)},vi.$metadata$={kind:$,simpleName:"RegionQuery",interfaces:[]},vi.prototype.component1=function(){return this.names},vi.prototype.component2=function(){return this.parent},vi.prototype.component3=function(){return this.ambiguityResolver},vi.prototype.copy_mlden1$=function(t,e,n){return new vi(void 0===t?this.names:t,void 0===e?this.parent:e,void 0===n?this.ambiguityResolver:n)},vi.prototype.toString=function(){return"RegionQuery(names="+e.toString(this.names)+", parent="+e.toString(this.parent)+", ambiguityResolver="+e.toString(this.ambiguityResolver)+")"},vi.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*t+e.hashCode(this.names)|0)+e.hashCode(this.parent)|0)+e.hashCode(this.ambiguityResolver)|0},vi.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.names,t.names)&&e.equals(this.parent,t.parent)&&e.equals(this.ambiguityResolver,t.ambiguityResolver)},li.$metadata$={kind:D,simpleName:"GeocodingSearchRequest",interfaces:[Jn]},gi.$metadata$={kind:D,simpleName:"ReverseGeocodingSearchRequest",interfaces:[Jn]},Jn.$metadata$={kind:D,simpleName:"GeoRequest",interfaces:[]},Object.defineProperty(wi.prototype,"mySelf_r0smt8$_0",{configurable:!0,get:function(){return null==this.mySelf_r0smt8$_2fjbkj$_0?C("mySelf"):this.mySelf_r0smt8$_2fjbkj$_0},set:function(t){this.mySelf_r0smt8$_2fjbkj$_0=t}}),Object.defineProperty(wi.prototype,"fragments",{configurable:!0,get:function(){return this.fragments_n0offn$_0},set:function(t){this.fragments_n0offn$_0=t}}),Object.defineProperty(wi.prototype,"levelOfDetails",{configurable:!0,get:function(){return this.levelOfDetails_31v9rh$_0},set:function(t){this.levelOfDetails_31v9rh$_0=t}}),wi.prototype.setSelf_8auog8$=function(t){this.mySelf_r0smt8$_0=t},wi.prototype.setResolution_s8ev37$=function(t){return this.levelOfDetails=null!=t?io().fromResolution_za3lpa$(t):null,this.mySelf_r0smt8$_0},wi.prototype.setFragments_g9b45l$=function(t){return this.fragments=null!=t?K(t):null,this.mySelf_r0smt8$_0},wi.prototype.addFragments_8j3uov$=function(t,e){return null==this.fragments&&(this.fragments=Z()),A(this.fragments).put_xwzc9p$(t,e),this.mySelf_r0smt8$_0},wi.prototype.addFeature_bdjexh$=function(t){return this.features.add_11rb$(t),this.mySelf_r0smt8$_0},wi.prototype.setFeatures_kzd2fe$=function(t){return this.features.clear(),this.features.addAll_brywnq$(t),this.mySelf_r0smt8$_0},wi.$metadata$={kind:$,simpleName:"RequestBuilderBase",interfaces:[]},Object.defineProperty(xi.prototype,"mode",{configurable:!0,get:function(){return this.mode_17k92x$_0}}),Object.defineProperty(xi.prototype,"coordinates_0",{configurable:!0,get:function(){return null==this.coordinates_fjgqzn$_0?C("coordinates"):this.coordinates_fjgqzn$_0},set:function(t){this.coordinates_fjgqzn$_0=t}}),Object.defineProperty(xi.prototype,"level_0",{configurable:!0,get:function(){return null==this.level_y4w9sc$_0?C("level"):this.level_y4w9sc$_0},set:function(t){this.level_y4w9sc$_0=t}}),xi.prototype.setCoordinates_ytws2g$=function(t){return this.coordinates_0=t,this},xi.prototype.setLevel_5pii6g$=function(t){return this.level_0=t,this},xi.prototype.setParent_acwriv$=function(t){return this.parent_0=t,this},xi.prototype.build=function(){return new ki(this.features,this.fragments,this.levelOfDetails,this.coordinates_0,this.level_0,this.parent_0)},Object.defineProperty(ki.prototype,"coordinates",{get:function(){return this.coordinates_ulu2p5$_0}}),Object.defineProperty(ki.prototype,"level",{get:function(){return this.level_m6ep8g$_0}}),Object.defineProperty(ki.prototype,"parent",{get:function(){return this.parent_xyqqdi$_0}}),ki.$metadata$={kind:$,simpleName:"MyReverseGeocodingSearchRequest",interfaces:[gi,Ai]},xi.$metadata$={kind:$,simpleName:"ReverseGeocodingRequestBuilder",interfaces:[wi]},Object.defineProperty(Ei.prototype,"mode",{configurable:!0,get:function(){return this.mode_lc8f7p$_0}}),Ei.prototype.addQuery_71f1k8$=function(t){return this.regionQueries_0.add_11rb$(t),this},Ei.prototype.setLevel_ywpjnb$=function(t){return this.featureLevel_0=t,this},Ei.prototype.setNamesakeExampleLimit_za3lpa$=function(t){return this.namesakeExampleLimit_0=t,this},Ei.prototype.build=function(){return new Ci(this.regionQueries_0,this.featureLevel_0,this.namesakeExampleLimit_0,this.features,this.fragments,this.levelOfDetails)},Object.defineProperty(Ci.prototype,"queries",{get:function(){return this.queries_kc4mug$_0}}),Object.defineProperty(Ci.prototype,"level",{get:function(){return this.level_kybz0a$_0}}),Object.defineProperty(Ci.prototype,"namesakeExampleLimit",{get:function(){return this.namesakeExampleLimit_diu8fm$_0}}),Ci.$metadata$={kind:$,simpleName:"MyGeocodingSearchRequest",interfaces:[li,Ai]},Si.$metadata$={kind:m,simpleName:"Companion",interfaces:[]};var Ti=null;function Oi(){return null===Ti&&new Si,Ti}function Ni(){wi.call(this),this.mode_73qlis$_0=ar(),this.ids_kuk605$_0=this.ids_kuk605$_0,wi.prototype.setSelf_8auog8$.call(this,this)}function Pi(t,e,n,i){Ai.call(this,e,n,i),this.ids_uekfos$_0=t}function Ai(t,e,n){this.features_o650gb$_0=t,this.fragments_gwv6hr$_0=e,this.levelOfDetails_6xp3yt$_0=n}function ji(){this.values_dve3y8$_0=this.values_dve3y8$_0,this.kind_0=Mi().PARENT_KIND_ID_0}function Li(){this.parent_0=null,this.names_0=z(),this.ambiguityResolver_0=$i().empty()}Ei.$metadata$={kind:$,simpleName:"GeocodingRequestBuilder",interfaces:[wi]},Object.defineProperty(Ni.prototype,"mode",{configurable:!0,get:function(){return this.mode_73qlis$_0}}),Object.defineProperty(Ni.prototype,"ids_0",{configurable:!0,get:function(){return null==this.ids_kuk605$_0?C("ids"):this.ids_kuk605$_0},set:function(t){this.ids_kuk605$_0=t}}),Ni.prototype.setIds_mhpeer$=function(t){return this.ids_0=t,this},Ni.prototype.build=function(){return new Pi(this.ids_0,this.features,this.fragments,this.levelOfDetails)},Object.defineProperty(Pi.prototype,"ids",{get:function(){return this.ids_uekfos$_0}}),Pi.$metadata$={kind:$,simpleName:"MyExplicitSearchRequest",interfaces:[si,Ai]},Ni.$metadata$={kind:$,simpleName:"ExplicitRequestBuilder",interfaces:[wi]},Object.defineProperty(Ai.prototype,"features",{get:function(){return this.features_o650gb$_0}}),Object.defineProperty(Ai.prototype,"fragments",{get:function(){return this.fragments_gwv6hr$_0}}),Object.defineProperty(Ai.prototype,"levelOfDetails",{get:function(){return this.levelOfDetails_6xp3yt$_0}}),Ai.$metadata$={kind:$,simpleName:"MyGeoRequestBase",interfaces:[Jn]},Object.defineProperty(ji.prototype,"values_0",{configurable:!0,get:function(){return null==this.values_dve3y8$_0?C("values"):this.values_dve3y8$_0},set:function(t){this.values_dve3y8$_0=t}}),ji.prototype.setParentValues_mhpeer$=function(t){return this.values_0=t,this},ji.prototype.setParentKind_6taknv$=function(t){return this.kind_0=t,this},ji.prototype.build=function(){return this.kind_0===Mi().PARENT_KIND_ID_0?ho().withIdList_mhpeer$(this.values_0):ho().withName_61zpoe$(this.values_0.get_za3lpa$(0))},ji.$metadata$={kind:$,simpleName:"MapRegionBuilder",interfaces:[]},Li.prototype.setQueryNames_mhpeer$=function(t){return this.names_0=t,this},Li.prototype.setQueryNames_vqirvp$=function(t){return this.names_0=X(t.slice()),this},Li.prototype.setParent_acwriv$=function(t){return this.parent_0=t,this},Li.prototype.setIgnoringStrategy_880qs6$=function(t){return null!=t&&(this.ambiguityResolver_0=$i().ignoring_6lwvuf$(t)),this},Li.prototype.setClosestObject_ksafwq$=function(t){return null!=t&&(this.ambiguityResolver_0=$i().closestTo_gpjtzr$(t)),this},Li.prototype.setBox_myx2hi$=function(t){return null!=t&&(this.ambiguityResolver_0=$i().within_wthzt5$(t)),this},Li.prototype.setAmbiguityResolver_pqmad5$=function(t){return this.ambiguityResolver_0=t,this},Li.prototype.build=function(){return new vi(this.names_0,this.parent_0,this.ambiguityResolver_0)},Li.$metadata$={kind:$,simpleName:"RegionQueryBuilder",interfaces:[]},bi.$metadata$={kind:m,simpleName:"GeoRequestBuilder",interfaces:[]};var Ri,Ii,zi,Di=null;function Mi(){return null===Di&&new bi,Di}function Bi(){}function Ui(t,e){this.features=t,this.featureLevel=e}function Fi(t,e,n,i,r,o,a,s,l){this.request=t,this.id=e,this.name=n,this.centroid=i,this.position=r,this.limit=o,this.boundary=a,this.highlights=s,this.fragments=l}function qi(t){this.message=t}function Gi(t,e){this.features=t,this.featureLevel=e}function Hi(t,e,n){this.request=t,this.namesakeCount=e,this.namesakes=n}function Yi(t,e){this.name=t,this.parents=e}function Vi(t,e){this.name=t,this.level=e}function Ki(){}function Wi(){this.geocodedFeatures_0=z(),this.featureLevel_0=null}function Xi(){this.ambiguousFeatures_0=z(),this.featureLevel_0=null}function Zi(){this.query_g4upvu$_0=this.query_g4upvu$_0,this.id_jdni55$_0=this.id_jdni55$_0,this.name_da6rd5$_0=this.name_da6rd5$_0,this.centroid_0=null,this.limit_0=null,this.position_0=null,this.boundary_0=null,this.highlights_0=z(),this.fragments_0=z()}function Ji(){this.query_lkdzx6$_0=this.query_lkdzx6$_0,this.totalNamesakeCount_0=0,this.namesakeExamples_0=z()}function Qi(){this.name_xd6cda$_0=this.name_xd6cda$_0,this.parentNames_0=z(),this.parentLevels_0=z()}function tr(){}function er(t){this.myUrl_0=t,this.myClient_0=lt()}function nr(t){return function(e){var n=t,i=y("format",function(t,e){return t.format_2yxzh4$(e)}.bind(null,vo()))(n);return e.body=y("formatJson",function(t,e){return t.formatJson_za3rmp$(e)}.bind(null,et.JsonSupport))(i),g}}function ir(t,e,n,i,r,o){at.call(this,o),this.$controller=r,this.exceptionState_0=12,this.local$this$GeoTransportImpl=t,this.local$closure$request=e,this.local$closure$async=n,this.local$response=void 0}function rr(t,e,n){L.call(this),this.myValue_dowh1b$_0=n,this.name$=t,this.ordinal$=e}function or(){or=function(){},Ri=new rr("BY_ID",0,"by_id"),Ii=new rr("BY_NAME",1,"by_geocoding"),zi=new rr("REVERSE",2,"reverse")}function ar(){return or(),Ri}function sr(){return or(),Ii}function lr(){return or(),zi}function ur(t){dr(),this.myTransport_0=t}function cr(t){return t.features}function pr(t,e){return U(e.request,t)}function hr(){fr=this}function _r(t){return t.name}Fi.$metadata$={kind:$,simpleName:"GeocodedFeature",interfaces:[]},Fi.prototype.component1=function(){return this.request},Fi.prototype.component2=function(){return this.id},Fi.prototype.component3=function(){return this.name},Fi.prototype.component4=function(){return this.centroid},Fi.prototype.component5=function(){return this.position},Fi.prototype.component6=function(){return this.limit},Fi.prototype.component7=function(){return this.boundary},Fi.prototype.component8=function(){return this.highlights},Fi.prototype.component9=function(){return this.fragments},Fi.prototype.copy_4mpox9$=function(t,e,n,i,r,o,a,s,l){return new Fi(void 0===t?this.request:t,void 0===e?this.id:e,void 0===n?this.name:n,void 0===i?this.centroid:i,void 0===r?this.position:r,void 0===o?this.limit:o,void 0===a?this.boundary:a,void 0===s?this.highlights:s,void 0===l?this.fragments:l)},Fi.prototype.toString=function(){return"GeocodedFeature(request="+e.toString(this.request)+", id="+e.toString(this.id)+", name="+e.toString(this.name)+", centroid="+e.toString(this.centroid)+", position="+e.toString(this.position)+", limit="+e.toString(this.limit)+", boundary="+e.toString(this.boundary)+", highlights="+e.toString(this.highlights)+", fragments="+e.toString(this.fragments)+")"},Fi.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*(t=31*(t=31*(t=31*(t=31*(t=31*(t=31*t+e.hashCode(this.request)|0)+e.hashCode(this.id)|0)+e.hashCode(this.name)|0)+e.hashCode(this.centroid)|0)+e.hashCode(this.position)|0)+e.hashCode(this.limit)|0)+e.hashCode(this.boundary)|0)+e.hashCode(this.highlights)|0)+e.hashCode(this.fragments)|0},Fi.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.request,t.request)&&e.equals(this.id,t.id)&&e.equals(this.name,t.name)&&e.equals(this.centroid,t.centroid)&&e.equals(this.position,t.position)&&e.equals(this.limit,t.limit)&&e.equals(this.boundary,t.boundary)&&e.equals(this.highlights,t.highlights)&&e.equals(this.fragments,t.fragments)},Ui.$metadata$={kind:$,simpleName:"SuccessGeoResponse",interfaces:[Bi]},Ui.prototype.component1=function(){return this.features},Ui.prototype.component2=function(){return this.featureLevel},Ui.prototype.copy_xn8lgx$=function(t,e){return new Ui(void 0===t?this.features:t,void 0===e?this.featureLevel:e)},Ui.prototype.toString=function(){return"SuccessGeoResponse(features="+e.toString(this.features)+", featureLevel="+e.toString(this.featureLevel)+")"},Ui.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.features)|0)+e.hashCode(this.featureLevel)|0},Ui.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.features,t.features)&&e.equals(this.featureLevel,t.featureLevel)},qi.$metadata$={kind:$,simpleName:"ErrorGeoResponse",interfaces:[Bi]},qi.prototype.component1=function(){return this.message},qi.prototype.copy_61zpoe$=function(t){return new qi(void 0===t?this.message:t)},qi.prototype.toString=function(){return"ErrorGeoResponse(message="+e.toString(this.message)+")"},qi.prototype.hashCode=function(){var t=0;return 31*t+e.hashCode(this.message)|0},qi.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.message,t.message)},Hi.$metadata$={kind:$,simpleName:"AmbiguousFeature",interfaces:[]},Hi.prototype.component1=function(){return this.request},Hi.prototype.component2=function(){return this.namesakeCount},Hi.prototype.component3=function(){return this.namesakes},Hi.prototype.copy_ckeskw$=function(t,e,n){return new Hi(void 0===t?this.request:t,void 0===e?this.namesakeCount:e,void 0===n?this.namesakes:n)},Hi.prototype.toString=function(){return"AmbiguousFeature(request="+e.toString(this.request)+", namesakeCount="+e.toString(this.namesakeCount)+", namesakes="+e.toString(this.namesakes)+")"},Hi.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*t+e.hashCode(this.request)|0)+e.hashCode(this.namesakeCount)|0)+e.hashCode(this.namesakes)|0},Hi.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.request,t.request)&&e.equals(this.namesakeCount,t.namesakeCount)&&e.equals(this.namesakes,t.namesakes)},Yi.$metadata$={kind:$,simpleName:"Namesake",interfaces:[]},Yi.prototype.component1=function(){return this.name},Yi.prototype.component2=function(){return this.parents},Yi.prototype.copy_5b6i1g$=function(t,e){return new Yi(void 0===t?this.name:t,void 0===e?this.parents:e)},Yi.prototype.toString=function(){return"Namesake(name="+e.toString(this.name)+", parents="+e.toString(this.parents)+")"},Yi.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.name)|0)+e.hashCode(this.parents)|0},Yi.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)&&e.equals(this.parents,t.parents)},Vi.$metadata$={kind:$,simpleName:"NamesakeParent",interfaces:[]},Vi.prototype.component1=function(){return this.name},Vi.prototype.component2=function(){return this.level},Vi.prototype.copy_3i9pe2$=function(t,e){return new Vi(void 0===t?this.name:t,void 0===e?this.level:e)},Vi.prototype.toString=function(){return"NamesakeParent(name="+e.toString(this.name)+", level="+e.toString(this.level)+")"},Vi.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.name)|0)+e.hashCode(this.level)|0},Vi.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)&&e.equals(this.level,t.level)},Gi.$metadata$={kind:$,simpleName:"AmbiguousGeoResponse",interfaces:[Bi]},Gi.prototype.component1=function(){return this.features},Gi.prototype.component2=function(){return this.featureLevel},Gi.prototype.copy_i46hsw$=function(t,e){return new Gi(void 0===t?this.features:t,void 0===e?this.featureLevel:e)},Gi.prototype.toString=function(){return"AmbiguousGeoResponse(features="+e.toString(this.features)+", featureLevel="+e.toString(this.featureLevel)+")"},Gi.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.features)|0)+e.hashCode(this.featureLevel)|0},Gi.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.features,t.features)&&e.equals(this.featureLevel,t.featureLevel)},Bi.$metadata$={kind:D,simpleName:"GeoResponse",interfaces:[]},Wi.prototype.addGeocodedFeature_sv8o3d$=function(t){return this.geocodedFeatures_0.add_11rb$(t),this},Wi.prototype.setLevel_ywpjnb$=function(t){return this.featureLevel_0=t,this},Wi.prototype.build=function(){return new Ui(this.geocodedFeatures_0,this.featureLevel_0)},Wi.$metadata$={kind:$,simpleName:"SuccessResponseBuilder",interfaces:[]},Xi.prototype.addAmbiguousFeature_1j15ng$=function(t){return this.ambiguousFeatures_0.add_11rb$(t),this},Xi.prototype.setLevel_ywpjnb$=function(t){return this.featureLevel_0=t,this},Xi.prototype.build=function(){return new Gi(this.ambiguousFeatures_0,this.featureLevel_0)},Xi.$metadata$={kind:$,simpleName:"AmbiguousResponseBuilder",interfaces:[]},Object.defineProperty(Zi.prototype,"query_0",{configurable:!0,get:function(){return null==this.query_g4upvu$_0?C("query"):this.query_g4upvu$_0},set:function(t){this.query_g4upvu$_0=t}}),Object.defineProperty(Zi.prototype,"id_0",{configurable:!0,get:function(){return null==this.id_jdni55$_0?C("id"):this.id_jdni55$_0},set:function(t){this.id_jdni55$_0=t}}),Object.defineProperty(Zi.prototype,"name_0",{configurable:!0,get:function(){return null==this.name_da6rd5$_0?C("name"):this.name_da6rd5$_0},set:function(t){this.name_da6rd5$_0=t}}),Zi.prototype.setQuery_61zpoe$=function(t){return this.query_0=t,this},Zi.prototype.setId_61zpoe$=function(t){return this.id_0=t,this},Zi.prototype.setName_61zpoe$=function(t){return this.name_0=t,this},Zi.prototype.setBoundary_dfy5bc$=function(t){return this.boundary_0=t,this},Zi.prototype.setCentroid_o5m5pd$=function(t){return this.centroid_0=t,this},Zi.prototype.setLimit_emtjl$=function(t){return this.limit_0=t,this},Zi.prototype.setPosition_emtjl$=function(t){return this.position_0=t,this},Zi.prototype.addHighlight_61zpoe$=function(t){return this.highlights_0.add_11rb$(t),this},Zi.prototype.addFragment_1ve0tm$=function(t){return this.fragments_0.add_11rb$(t),this},Zi.prototype.build=function(){var t=this.highlights_0,e=this.fragments_0;return new Fi(this.query_0,this.id_0,this.name_0,this.centroid_0,this.position_0,this.limit_0,this.boundary_0,t.isEmpty()?null:t,e.isEmpty()?null:e)},Zi.$metadata$={kind:$,simpleName:"GeocodedFeatureBuilder",interfaces:[]},Object.defineProperty(Ji.prototype,"query_0",{configurable:!0,get:function(){return null==this.query_lkdzx6$_0?C("query"):this.query_lkdzx6$_0},set:function(t){this.query_lkdzx6$_0=t}}),Ji.prototype.setQuery_61zpoe$=function(t){return this.query_0=t,this},Ji.prototype.addNamesakeExample_ulfa63$=function(t){return this.namesakeExamples_0.add_11rb$(t),this},Ji.prototype.setTotalNamesakeCount_za3lpa$=function(t){return this.totalNamesakeCount_0=t,this},Ji.prototype.build=function(){return new Hi(this.query_0,this.totalNamesakeCount_0,this.namesakeExamples_0)},Ji.$metadata$={kind:$,simpleName:"AmbiguousFeatureBuilder",interfaces:[]},Object.defineProperty(Qi.prototype,"name_0",{configurable:!0,get:function(){return null==this.name_xd6cda$_0?C("name"):this.name_xd6cda$_0},set:function(t){this.name_xd6cda$_0=t}}),Qi.prototype.setName_61zpoe$=function(t){return this.name_0=t,this},Qi.prototype.addParentName_61zpoe$=function(t){return this.parentNames_0.add_11rb$(t),this},Qi.prototype.addParentLevel_5pii6g$=function(t){return this.parentLevels_0.add_11rb$(t),this},Qi.prototype.build=function(){if(this.parentNames_0.size!==this.parentLevels_0.size)throw d();for(var t=this.name_0,e=this.parentNames_0,n=this.parentLevels_0,i=e.iterator(),r=n.iterator(),o=S(I.min(Q(e,10),Q(n,10)));i.hasNext()&&r.hasNext();)o.add_11rb$(new Vi(i.next(),r.next()));return new Yi(t,J(o))},Qi.$metadata$={kind:$,simpleName:"NamesakeBuilder",interfaces:[]},tr.$metadata$={kind:D,simpleName:"GeoTransport",interfaces:[]},ir.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[at]},ir.prototype=Object.create(at.prototype),ir.prototype.constructor=ir,ir.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.exceptionState_0=9;var t,n=this.local$this$GeoTransportImpl.myClient_0,i=this.local$this$GeoTransportImpl.myUrl_0,r=nr(this.local$closure$request);"localhost",t=ct.EmptyContent;var o=new _t;pt(o,"http","localhost",0,"/"),o.method=ht.Companion.Post,o.body=t,ut(o.url,i),r(o);var a,s,l,u=new ft(o,n);if(U(a=nt,dt(ft))){this.result_0="string"==typeof(s=u)?s:M(),this.state_0=8;continue}if(U(a,dt(mt))){if(this.state_0=6,this.result_0=u.execute(this),this.result_0===ot)return ot;continue}if(this.state_0=1,this.result_0=u.executeUnsafe(this),this.result_0===ot)return ot;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var p,h=this.local$response.call;t:do{try{p=new vt(nt,$t.JsType,it(nt,[],!1))}catch(t){p=new vt(nt,$t.JsType);break t}}while(0);if(this.state_0=2,this.result_0=h.receive_jo9acv$(p,this),this.result_0===ot)return ot;continue;case 2:this.result_0="string"==typeof(c=this.result_0)?c:M(),this.exceptionState_0=9,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=7;continue;case 4:this.finallyPath_0=[9],this.state_0=5;continue;case 5:this.exceptionState_0=9,yt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:this.result_0="string"==typeof(l=this.result_0)?l:M(),this.state_0=7;continue;case 7:this.state_0=8;continue;case 8:this.result_0;var _=this.result_0,f=y("parseJson",function(t,e){return t.parseJson_61zpoe$(e)}.bind(null,et.JsonSupport))(_),d=y("parse",function(t,e){return t.parse_bkhwtg$(e)}.bind(null,Ao()))(f);return y("success",function(t,e){return t.success_11rb$(e),g}.bind(null,this.local$closure$async))(d);case 9:this.exceptionState_0=12;var m=this.exception_0;if(e.isType(m,rt))return this.local$closure$async.failure_tcv7n7$(m),g;throw m;case 10:this.state_0=11;continue;case 11:return;case 12:throw this.exception_0;default:throw this.state_0=12,new Error("State Machine Unreachable execution")}}catch(t){if(12===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},er.prototype.send_2yxzh4$=function(t){var e,n,i,r=new tt;return st(this.myClient_0,void 0,void 0,(e=this,n=t,i=r,function(t,r,o){var a=new ir(e,n,i,t,this,r);return o?a:a.doResume(null)})),r},er.$metadata$={kind:$,simpleName:"GeoTransportImpl",interfaces:[tr]},rr.prototype.toString=function(){return this.myValue_dowh1b$_0},rr.$metadata$={kind:$,simpleName:"GeocodingMode",interfaces:[L]},rr.values=function(){return[ar(),sr(),lr()]},rr.valueOf_61zpoe$=function(t){switch(t){case"BY_ID":return ar();case"BY_NAME":return sr();case"REVERSE":return lr();default:R("No enum constant jetbrains.gis.geoprotocol.GeocodingMode."+t)}},ur.prototype.execute_2yxzh4$=function(t){var n;if(e.isType(t,si))n=t.ids;else if(e.isType(t,li)){var i,r=t.queries,o=z();for(i=r.iterator();i.hasNext();){var a=i.next().names;Et(o,a)}n=o}else{if(!e.isType(t,gi))return bt.Asyncs.failure_lsqlk3$(P("Unknown request type: "+t));n=V()}var s,l,u,c=n,p=c.isEmpty()?cr:(s=c,l=this,function(t){return l.leftJoin_0(s,t.features,pr)});return this.myTransport_0.send_2yxzh4$(t).map_2o04qz$((u=p,function(t){if(e.isType(t,Ui))return u(t);throw e.isType(t,Gi)?gt(dr().createAmbiguousMessage_z3t9ig$(t.features)):e.isType(t,qi)?gt("GIS error: "+t.message):P("Unknown response status: "+t)}))},ur.prototype.leftJoin_0=function(t,e,n){var i,r=z();for(i=t.iterator();i.hasNext();){var o,a,s=i.next();t:do{var l;for(l=e.iterator();l.hasNext();){var u=l.next();if(n(s,u)){a=u;break t}}a=null}while(0);null!=(o=a)&&r.add_11rb$(o)}return r},hr.prototype.createAmbiguousMessage_z3t9ig$=function(t){var e,n=wt().append_pdl1vj$("Geocoding errors:\n");for(e=t.iterator();e.hasNext();){var i=e.next();if(1!==i.namesakeCount)if(i.namesakeCount>1){n.append_pdl1vj$("Multiple objects ("+i.namesakeCount).append_pdl1vj$(") were found for '"+i.request+"'").append_pdl1vj$(i.namesakes.isEmpty()?".":":");var r,o,a=i.namesakes,s=S(Q(a,10));for(r=a.iterator();r.hasNext();){var l=r.next(),u=s.add_11rb$,c=l.component1(),p=l.component2();u.call(s,"- "+c+xt(p,void 0,"(",")",void 0,void 0,_r))}for(o=kt(s).iterator();o.hasNext();){var h=o.next();n.append_pdl1vj$("\n"+h)}}else n.append_pdl1vj$("No objects were found for '"+i.request+"'.");n.append_pdl1vj$("\n")}return n.toString()},hr.$metadata$={kind:m,simpleName:"Companion",interfaces:[]};var fr=null;function dr(){return null===fr&&new hr,fr}function mr(){Lr=this}function yr(t){return t.origin}function $r(t){return Ot(t.origin,t.dimension)}ur.$metadata$={kind:$,simpleName:"GeocodingService",interfaces:[]},mr.prototype.bbox_8ft4gs$=function(t){var e=Ct(t);return e.isEmpty()?null:jt(At(Pt(Nt([Tt(St(e),yr),Tt(St(e),$r)]))))},mr.prototype.asLineString_8ft4gs$=function(t){return new b(t.get_za3lpa$(0).get_za3lpa$(0))},mr.$metadata$={kind:m,simpleName:"GeometryUtil",interfaces:[]};var vr,gr,br,wr,xr,kr,Er,Cr,Sr,Tr,Or,Nr,Pr,Ar,jr,Lr=null;function Rr(t,e){L.call(this),this.name$=t,this.ordinal$=e}function Ir(){Ir=function(){},vr=new Rr("CITY_HIGH",0),gr=new Rr("CITY_MEDIUM",1),br=new Rr("CITY_LOW",2),wr=new Rr("COUNTY_HIGH",3),xr=new Rr("COUNTY_MEDIUM",4),kr=new Rr("COUNTY_LOW",5),Er=new Rr("STATE_HIGH",6),Cr=new Rr("STATE_MEDIUM",7),Sr=new Rr("STATE_LOW",8),Tr=new Rr("COUNTRY_HIGH",9),Or=new Rr("COUNTRY_MEDIUM",10),Nr=new Rr("COUNTRY_LOW",11),Pr=new Rr("WORLD_HIGH",12),Ar=new Rr("WORLD_MEDIUM",13),jr=new Rr("WORLD_LOW",14),io()}function zr(){return Ir(),vr}function Dr(){return Ir(),gr}function Mr(){return Ir(),br}function Br(){return Ir(),wr}function Ur(){return Ir(),xr}function Fr(){return Ir(),kr}function qr(){return Ir(),Er}function Gr(){return Ir(),Cr}function Hr(){return Ir(),Sr}function Yr(){return Ir(),Tr}function Vr(){return Ir(),Or}function Kr(){return Ir(),Nr}function Wr(){return Ir(),Pr}function Xr(){return Ir(),Ar}function Zr(){return Ir(),jr}function Jr(t,e){this.resolution_8be2vx$=t,this.level_8be2vx$=e}function Qr(){no=this;var t,e=ro(),n=S(e.length);for(t=0;t!==e.length;++t){var i=e[t];n.add_11rb$(new Jr(i.toResolution(),i))}this.LOD_RANGES_0=n}Jr.$metadata$={kind:$,simpleName:"Lod",interfaces:[]},Rr.prototype.toResolution=function(){return 15-this.ordinal|0},Qr.prototype.fromResolution_za3lpa$=function(t){var e;for(e=this.LOD_RANGES_0.iterator();e.hasNext();){var n=e.next();if(t>=n.resolution_8be2vx$)return n.level_8be2vx$}return Zr()},Qr.$metadata$={kind:m,simpleName:"Companion",interfaces:[]};var to,eo,no=null;function io(){return Ir(),null===no&&new Qr,no}function ro(){return[zr(),Dr(),Mr(),Br(),Ur(),Fr(),qr(),Gr(),Hr(),Yr(),Vr(),Kr(),Wr(),Xr(),Zr()]}function oo(t,e){ho(),this.myKind_0=t,this.myValueList_0=null,this.myValueList_0=Rt(e)}function ao(t,e){L.call(this),this.name$=t,this.ordinal$=e}function so(){so=function(){},to=new ao("MAP_REGION_KIND_ID",0),eo=new ao("MAP_REGION_KIND_NAME",1)}function lo(){return so(),to}function uo(){return so(),eo}function co(){po=this,this.US_48_NAME_0="us-48",this.US_48_0=new oo(uo(),Y(this.US_48_NAME_0)),this.US_48_PARENT_NAME_0="United States of America",this.US_48_PARENT=new oo(uo(),Y(this.US_48_PARENT_NAME_0))}Rr.$metadata$={kind:$,simpleName:"LevelOfDetails",interfaces:[L]},Rr.values=ro,Rr.valueOf_61zpoe$=function(t){switch(t){case"CITY_HIGH":return zr();case"CITY_MEDIUM":return Dr();case"CITY_LOW":return Mr();case"COUNTY_HIGH":return Br();case"COUNTY_MEDIUM":return Ur();case"COUNTY_LOW":return Fr();case"STATE_HIGH":return qr();case"STATE_MEDIUM":return Gr();case"STATE_LOW":return Hr();case"COUNTRY_HIGH":return Yr();case"COUNTRY_MEDIUM":return Vr();case"COUNTRY_LOW":return Kr();case"WORLD_HIGH":return Wr();case"WORLD_MEDIUM":return Xr();case"WORLD_LOW":return Zr();default:R("No enum constant jetbrains.gis.geoprotocol.LevelOfDetails."+t)}},Object.defineProperty(oo.prototype,"idList",{configurable:!0,get:function(){if(!this.containsId())throw j("Can't get ids from MapRegion with name".toString());return this.myValueList_0}}),Object.defineProperty(oo.prototype,"name",{configurable:!0,get:function(){if(!this.containsName())throw j("Can't get name from MapRegion with ids".toString());if(1!==this.myValueList_0.size)throw j("MapRegion should contain one name".toString());return this.myValueList_0.get_za3lpa$(0)}}),oo.prototype.containsId=function(){return this.myKind_0===lo()},oo.prototype.containsName=function(){return this.myKind_0===uo()},oo.prototype.equals=function(t){var n;return this===t||!(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))&&(e.isType(t,oo)||M(),this.myKind_0===t.myKind_0&&!!U(this.myValueList_0,t.myValueList_0))},oo.prototype.hashCode=function(){var t=this.myKind_0.hashCode();return(31*t|0)+B(this.myValueList_0)|0},ao.$metadata$={kind:$,simpleName:"MapRegionKind",interfaces:[L]},ao.values=function(){return[lo(),uo()]},ao.valueOf_61zpoe$=function(t){switch(t){case"MAP_REGION_KIND_ID":return lo();case"MAP_REGION_KIND_NAME":return uo();default:R("No enum constant jetbrains.gis.geoprotocol.MapRegion.MapRegionKind."+t)}},co.prototype.withIdList_mhpeer$=function(t){return new oo(lo(),t)},co.prototype.withId_61zpoe$=function(t){return new oo(lo(),Y(t))},co.prototype.withName_61zpoe$=function(t){return Lt(this.US_48_NAME_0,t,!0)?this.US_48_0:new oo(uo(),Y(t))},co.$metadata$={kind:m,simpleName:"Companion",interfaces:[]};var po=null;function ho(){return null===po&&new co,po}function _o(){fo=this,this.MIN_LON_0="min_lon",this.MIN_LAT_0="min_lat",this.MAX_LON_0="max_lon",this.MAX_LAT_0="max_lat"}oo.$metadata$={kind:$,simpleName:"MapRegion",interfaces:[]},_o.prototype.parseGeoRectangle_bkhwtg$=function(t){return new zt(It(t,this.MIN_LON_0),It(t,this.MIN_LAT_0),It(t,this.MAX_LON_0),It(t,this.MAX_LAT_0))},_o.prototype.formatGeoRectangle_emtjl$=function(t){return Dt().put_hzlfav$(this.MIN_LON_0,t.startLongitude()).put_hzlfav$(this.MIN_LAT_0,t.minLatitude()).put_hzlfav$(this.MAX_LAT_0,t.maxLatitude()).put_hzlfav$(this.MAX_LON_0,t.endLongitude())},_o.$metadata$={kind:m,simpleName:"ProtocolJsonHelper",interfaces:[]};var fo=null;function mo(){return null===fo&&new _o,fo}function yo(){$o=this,this.PARENT_KIND_ID_0=!0,this.PARENT_KIND_NAME_0=!1}yo.prototype.format_2yxzh4$=function(t){var n;if(e.isType(t,li))n=this.geocoding_0(t);else if(e.isType(t,si))n=this.explicit_0(t);else{if(!e.isType(t,gi))throw P("Unknown request: "+e.getKClassFromExpression(t).toString());n=this.reverse_0(t)}return n},yo.prototype.geocoding_0=function(t){var e,n=this.common_0(t,sr()).put_snuhza$(wo().LEVEL,t.level).put_hzlfav$(wo().NAMESAKE_EXAMPLE_LIMIT,t.namesakeExampleLimit),i=wo().REGION_QUERIES,r=Mt(),o=t.queries,a=S(Q(o,10));for(e=o.iterator();e.hasNext();){var s,l=e.next();a.add_11rb$(Bt(Dt(),wo().REGION_QUERY_NAMES,l.names).put_wxs67v$(wo().REGION_QUERY_PARENT,this.formatMapRegion_0(l.parent)).put_wxs67v$(wo().AMBIGUITY_RESOLVER,Dt().put_snuhza$(wo().AMBIGUITY_IGNORING_STRATEGY,l.ambiguityResolver.ignoringStrategy).put_wxs67v$(wo().AMBIGUITY_CLOSEST_COORD,this.formatCoord_0(l.ambiguityResolver.closestCoord)).put_wxs67v$(wo().AMBIGUITY_BOX,null!=(s=l.ambiguityResolver.box)?this.formatRect_0(s):null)))}return n.put_wxs67v$(i,r.addAll_5ry1at$(a)).get()},yo.prototype.explicit_0=function(t){return Bt(this.common_0(t,ar()),wo().IDS,t.ids).get()},yo.prototype.reverse_0=function(t){var e,n=this.common_0(t,lr()).put_wxs67v$(wo().REVERSE_PARENT,this.formatMapRegion_0(t.parent)),i=wo().REVERSE_COORDINATES,r=Mt(),o=t.coordinates,a=S(Q(o,10));for(e=o.iterator();e.hasNext();){var s=e.next();a.add_11rb$(Mt().add_yrwdxb$(s.x).add_yrwdxb$(s.y))}return n.put_wxs67v$(i,r.addAll_5ry1at$(a)).put_snuhza$(wo().REVERSE_LEVEL,t.level).get()},yo.prototype.formatRect_0=function(t){var e=Dt().put_hzlfav$(wo().LON_MIN,t.left),n=wo().LAT_MIN,i=t.top,r=t.bottom,o=e.put_hzlfav$(n,I.min(i,r)).put_hzlfav$(wo().LON_MAX,t.right),a=wo().LAT_MAX,s=t.top,l=t.bottom;return o.put_hzlfav$(a,I.max(s,l))},yo.prototype.formatCoord_0=function(t){return null!=t?Mt().add_yrwdxb$(t.x).add_yrwdxb$(t.y):null},yo.prototype.common_0=function(t,e){var n,i,r,o,a,s,l=Dt().put_hzlfav$(wo().VERSION,2).put_snuhza$(wo().MODE,e).put_hzlfav$(wo().RESOLUTION,null!=(n=t.levelOfDetails)?n.toResolution():null),u=wo().FEATURE_OPTIONS,c=t.features,p=S(Q(c,10));for(a=c.iterator();a.hasNext();){var h=a.next();p.add_11rb$(Ut(h))}if(o=Bt(l,u,p),i=wo().FRAGMENTS,null!=(r=t.fragments)){var _,f=Dt(),d=S(r.size);for(_=r.entries.iterator();_.hasNext();){var m,y=_.next(),$=d.add_11rb$,v=y.key,g=y.value,b=Ft("key",1,(function(t){return t.key})),w=S(Q(g,10));for(m=g.iterator();m.hasNext();){var x=m.next();w.add_11rb$(b(x))}$.call(d,Bt(f,v,w))}s=f}else s=null;return o.putRemovable_wxs67v$(i,s)},yo.prototype.formatMapRegion_0=function(t){var e;if(null!=t){var n=t.containsId()?this.PARENT_KIND_ID_0:this.PARENT_KIND_NAME_0,i=t.containsId()?t.idList:Y(t.name);e=Bt(Dt().put_h92gdm$(wo().MAP_REGION_KIND,n),wo().MAP_REGION_VALUES,i)}else e=null;return e},yo.$metadata$={kind:m,simpleName:"RequestJsonFormatter",interfaces:[]};var $o=null;function vo(){return null===$o&&new yo,$o}function go(){bo=this,this.PROTOCOL_VERSION=2,this.VERSION="version",this.MODE="mode",this.RESOLUTION="resolution",this.FEATURE_OPTIONS="feature_options",this.IDS="ids",this.REGION_QUERIES="region_queries",this.REGION_QUERY_NAMES="region_query_names",this.REGION_QUERY_PARENT="region_query_parent",this.LEVEL="level",this.MAP_REGION_KIND="kind",this.MAP_REGION_VALUES="values",this.NAMESAKE_EXAMPLE_LIMIT="namesake_example_limit",this.FRAGMENTS="tiles",this.AMBIGUITY_RESOLVER="ambiguity_resolver",this.AMBIGUITY_IGNORING_STRATEGY="ambiguity_resolver_ignoring_strategy",this.AMBIGUITY_CLOSEST_COORD="ambiguity_resolver_closest_coord",this.AMBIGUITY_BOX="ambiguity_resolver_box",this.REVERSE_LEVEL="level",this.REVERSE_COORDINATES="reverse_coordinates",this.REVERSE_PARENT="reverse_parent",this.COORDINATE_LON=0,this.COORDINATE_LAT=1,this.LON_MIN="min_lon",this.LAT_MIN="min_lat",this.LON_MAX="max_lon",this.LAT_MAX="max_lat"}go.$metadata$={kind:m,simpleName:"RequestKeys",interfaces:[]};var bo=null;function wo(){return null===bo&&new go,bo}function xo(){Po=this}function ko(t,e){return function(n){return n.forArrEntries_2wy1dl$(function(t,e){return function(n,i){var r,o=t,a=new Ht(n),s=S(Q(i,10));for(r=i.iterator();r.hasNext();){var l,u=r.next();s.add_11rb$(e.readBoundary_0("string"==typeof(l=A(u))?l:M()))}return o.addFragment_1ve0tm$(new Zn(a,s)),g}}(t,e)),g}}function Eo(t,e){return function(n){var i,r=new Zi;return n.getString_hyc7mn$(Do().QUERY,(i=r,function(t){return i.setQuery_61zpoe$(t),g})).getString_hyc7mn$(Do().ID,function(t){return function(e){return t.setId_61zpoe$(e),g}}(r)).getString_hyc7mn$(Do().NAME,function(t){return function(e){return t.setName_61zpoe$(e),g}}(r)).forExistingStrings_hyc7mn$(Do().HIGHLIGHTS,function(t){return function(e){return t.addHighlight_61zpoe$(e),g}}(r)).getExistingString_hyc7mn$(Do().BOUNDARY,function(t,e){return function(n){return t.setBoundary_dfy5bc$(e.readGeometry_0(n)),g}}(r,t)).getExistingObject_6k19qz$(Do().CENTROID,function(t,e){return function(n){return t.setCentroid_o5m5pd$(e.parseCentroid_0(n)),g}}(r,t)).getExistingObject_6k19qz$(Do().LIMIT,function(t,e){return function(n){return t.setLimit_emtjl$(e.parseGeoRectangle_0(n)),g}}(r,t)).getExistingObject_6k19qz$(Do().POSITION,function(t,e){return function(n){return t.setPosition_emtjl$(e.parseGeoRectangle_0(n)),g}}(r,t)).getExistingObject_6k19qz$(Do().FRAGMENTS,ko(r,t)),e.addGeocodedFeature_sv8o3d$(r.build()),g}}function Co(t,e){return function(n){return n.getOptionalEnum_651ru9$(Do().LEVEL,function(t){return function(e){return t.setLevel_ywpjnb$(e),g}}(t),Xn()).forObjects_6k19qz$(Do().FEATURES,Eo(e,t)),g}}function So(t){return function(e){return e.getString_hyc7mn$(Do().NAMESAKE_NAME,function(t){return function(e){return t.addParentName_61zpoe$(e),g}}(t)).getEnum_651ru9$(Do().LEVEL,function(t){return function(e){return t.addParentLevel_5pii6g$(e),g}}(t),Xn()),g}}function To(t){return function(e){var n,i=new Qi;return e.getString_hyc7mn$(Do().NAMESAKE_NAME,(n=i,function(t){return n.setName_61zpoe$(t),g})).forObjects_6k19qz$(Do().NAMESAKE_PARENTS,So(i)),t.addNamesakeExample_ulfa63$(i.build()),g}}function Oo(t){return function(e){var n,i=new Ji;return e.getString_hyc7mn$(Do().QUERY,(n=i,function(t){return n.setQuery_61zpoe$(t),g})).getInt_qoz5hj$(Do().NAMESAKE_COUNT,function(t){return function(e){return t.setTotalNamesakeCount_za3lpa$(e),g}}(i)).forObjects_6k19qz$(Do().NAMESAKE_EXAMPLES,To(i)),t.addAmbiguousFeature_1j15ng$(i.build()),g}}function No(t){return function(e){return e.getOptionalEnum_651ru9$(Do().LEVEL,function(t){return function(e){return t.setLevel_ywpjnb$(e),g}}(t),Xn()).forObjects_6k19qz$(Do().FEATURES,Oo(t)),g}}xo.prototype.parse_bkhwtg$=function(t){var e,n=qt(t),i=n.getEnum_xwn52g$(Do().STATUS,Go());switch(i.name){case"SUCCESS":e=this.success_0(n);break;case"AMBIGUOUS":e=this.ambiguous_0(n);break;case"ERROR":e=this.error_0(n);break;default:throw P("Unknown response status: "+i)}return e},xo.prototype.success_0=function(t){var e=new Wi;return t.getObject_6k19qz$(Do().DATA,Co(e,this)),e.build()},xo.prototype.ambiguous_0=function(t){var e=new Xi;return t.getObject_6k19qz$(Do().DATA,No(e)),e.build()},xo.prototype.error_0=function(t){return new qi(t.getString_61zpoe$(Do().MESSAGE))},xo.prototype.parseCentroid_0=function(t){return v(t.getDouble_61zpoe$(Do().LON),t.getDouble_61zpoe$(Do().LAT))},xo.prototype.readGeometry_0=function(t){return Un().fromGeoJson_61zpoe$(t)},xo.prototype.readBoundary_0=function(t){return Un().fromTwkb_61zpoe$(t)},xo.prototype.parseGeoRectangle_0=function(t){return mo().parseGeoRectangle_bkhwtg$(t.get())},xo.$metadata$={kind:m,simpleName:"ResponseJsonParser",interfaces:[]};var Po=null;function Ao(){return null===Po&&new xo,Po}function jo(){zo=this,this.STATUS="status",this.MESSAGE="message",this.DATA="data",this.FEATURES="features",this.LEVEL="level",this.QUERY="query",this.ID="id",this.NAME="name",this.HIGHLIGHTS="highlights",this.BOUNDARY="boundary",this.FRAGMENTS="tiles",this.LIMIT="limit",this.CENTROID="centroid",this.POSITION="position",this.LON="lon",this.LAT="lat",this.NAMESAKE_COUNT="total_namesake_count",this.NAMESAKE_EXAMPLES="namesake_examples",this.NAMESAKE_NAME="name",this.NAMESAKE_PARENTS="parents"}jo.$metadata$={kind:m,simpleName:"ResponseKeys",interfaces:[]};var Lo,Ro,Io,zo=null;function Do(){return null===zo&&new jo,zo}function Mo(t,e){L.call(this),this.name$=t,this.ordinal$=e}function Bo(){Bo=function(){},Lo=new Mo("SUCCESS",0),Ro=new Mo("AMBIGUOUS",1),Io=new Mo("ERROR",2)}function Uo(){return Bo(),Lo}function Fo(){return Bo(),Ro}function qo(){return Bo(),Io}function Go(){return[Uo(),Fo(),qo()]}function Ho(t){ea(),this.myTwkb_mge4rt$_0=t}function Yo(){ta=this}Mo.$metadata$={kind:$,simpleName:"ResponseStatus",interfaces:[L]},Mo.values=Go,Mo.valueOf_61zpoe$=function(t){switch(t){case"SUCCESS":return Uo();case"AMBIGUOUS":return Fo();case"ERROR":return qo();default:R("No enum constant jetbrains.gis.geoprotocol.json.ResponseStatus."+t)}},Yo.prototype.createEmpty=function(){return new Ho(new Int8Array(0))},Yo.$metadata$={kind:m,simpleName:"Companion",interfaces:[]};var Vo,Ko,Wo,Xo,Zo,Jo,Qo,ta=null;function ea(){return null===ta&&new Yo,ta}function na(){}function ia(t){na.call(this),this.styleName=t}function ra(t,e,n){na.call(this),this.key=t,this.zoom=e,this.bbox=n}function oa(t){na.call(this),this.coordinates=t}function aa(t,e,n){this.x=t,this.y=e,this.z=n}function sa(t){this.myGeometryConsumer_0=new la,this.myParser_0=un().parser_gqqjn5$(t.asTwkb(),this.myGeometryConsumer_0)}function la(){this.myTileGeometries_0=z()}function ua(t,e,n,i,r,o,a){this.name=t,this.geometryCollection=e,this.kinds=n,this.subs=i,this.labels=r,this.shorts=o,this.size=a}function ca(){this.name="NoName",this.geometryCollection=ea().createEmpty(),this.kinds=V(),this.subs=V(),this.labels=V(),this.shorts=V(),this.layerSize=0}function pa(t,e){this.myTheme_fy5ei1$_0=e,this.mySocket_8l2uvz$_0=t.build_korocx$(new ss(new xa(this),ie.ThrowableHandlers.instance)),this.myMessageQueue_ew5tg6$_0=new Ea,this.pendingRequests_jgnyu1$_0=new ka,this.mapConfig_7r1z1y$_0=null,this.myIncrement_xi5m5t$_0=0,this.myStatus_68s9dq$_0=va()}function ha(t,e){L.call(this),this.name$=t,this.ordinal$=e}function _a(){_a=function(){},Vo=new ha("COLOR",0),Ko=new ha("LIGHT",1),Wo=new ha("DARK",2)}function fa(){return _a(),Vo}function da(){return _a(),Ko}function ma(){return _a(),Wo}function ya(t,e){L.call(this),this.name$=t,this.ordinal$=e}function $a(){$a=function(){},Xo=new ya("NOT_CONNECTED",0),Zo=new ya("CONFIGURED",1),Jo=new ya("CONNECTING",2),Qo=new ya("ERROR",3)}function va(){return $a(),Xo}function ga(){return $a(),Zo}function ba(){return $a(),Jo}function wa(){return $a(),Qo}function xa(t){this.$outer=t}function ka(){this.lock_0=new ne,this.myAsyncMap_0=Z()}function Ea(){this.myList_0=z(),this.myLock_0=new ne}function Ca(t){this.bytes_0=t,this.count_0=this.bytes_0.length,this.position_0=0}function Sa(t){this.byteArrayStream_0=new Ca(t),this.key_0=this.readString_0(),this.tileLayers_0=this.readLayers_0()}function Ta(){this.myClient_0=lt()}function Oa(t,e,n,i,r,o){at.call(this,o),this.$controller=r,this.exceptionState_0=13,this.local$this$HttpTileTransport=t,this.local$closure$url=e,this.local$closure$async=n,this.local$response=void 0}function Na(){Ra=this,this.MIN_ZOOM_FIELD_0="minZoom",this.MAX_ZOOM_FIELD_0="maxZoom",this.ZOOMS_0="zooms",this.LAYERS_0="layers",this.BORDER_0="border",this.TABLE_0="table",this.COLUMNS_0="columns",this.ORDER_0="order",this.COLORS_0="colors",this.STYLES_0="styles",this.TILE_SHEETS_0="tiles",this.BACKGROUND_0="background",this.FILTER_0="filter",this.GT_0="$gt",this.GTE_0="$gte",this.LT_0="$lt",this.LTE_0="$lte",this.SYMBOLIZER_0="symbolizer",this.TYPE_0="type",this.FILL_0="fill",this.STROKE_0="stroke",this.STROKE_WIDTH_0="stroke-width",this.LINE_CAP_0="stroke-linecap",this.LINE_JOIN_0="stroke-linejoin",this.LABEL_FIELD_0="label",this.FONT_STYLE_0="fontStyle",this.FONT_FACE_0="fontface",this.TEXT_TRANSFORM_0="text-transform",this.SIZE_0="size",this.WRAP_WIDTH_0="wrap-width",this.MINIMUM_PADDING_0="minimum-padding",this.REPEAT_DISTANCE_0="repeat-distance",this.SHIELD_CORNER_RADIUS_0="shield-corner-radius",this.SHIELD_FILL_COLOR_0="shield-fill-color",this.SHIELD_STROKE_COLOR_0="shield-stroke-color",this.MIN_ZOOM_0=1,this.MAX_ZOOM_0=15}function Pa(t){var e;return"string"==typeof(e=t)?e:M()}function Aa(t,n){return function(i){return i.forEntries_ophlsb$(function(t,n){return function(i,r){var o,a,s,l,u,c;if(e.isType(r,Gt)){var p,h=S(Q(r,10));for(p=r.iterator();p.hasNext();){var _=p.next();h.add_11rb$(_e(_))}l=h,o=function(t){return l.contains_11rb$(t)}}else if(e.isNumber(r))s=_e(r),o=function(t){return t===s};else{if(!e.isType(r,ce))throw P("Unsupported filter type.");o=t.makeCompareFunctions_0(qt(r))}return a=o,n.addFilterFunction_xmiwn3$((u=a,c=i,function(t){return u(t.getFieldValue_61zpoe$(c))})),g}}(t,n)),g}}function ja(t,e,n){return function(i){var r,o=new as;return i.getExistingString_hyc7mn$(t.TYPE_0,(r=o,function(t){return r.type=t,g})).getExistingString_hyc7mn$(t.FILL_0,function(t,e){return function(n){return e.fill=t.get_11rb$(n),g}}(e,o)).getExistingString_hyc7mn$(t.STROKE_0,function(t,e){return function(n){return e.stroke=t.get_11rb$(n),g}}(e,o)).getExistingDouble_l47sdb$(t.STROKE_WIDTH_0,function(t){return function(e){return t.strokeWidth=e,g}}(o)).getExistingString_hyc7mn$(t.LINE_CAP_0,function(t){return function(e){return t.lineCap=e,g}}(o)).getExistingString_hyc7mn$(t.LINE_JOIN_0,function(t){return function(e){return t.lineJoin=e,g}}(o)).getExistingString_hyc7mn$(t.LABEL_FIELD_0,function(t){return function(e){return t.labelField=e,g}}(o)).getExistingString_hyc7mn$(t.FONT_STYLE_0,function(t){return function(e){return t.fontStyle=e,g}}(o)).getExistingString_hyc7mn$(t.FONT_FACE_0,function(t){return function(e){return t.fontFamily=e,g}}(o)).getExistingString_hyc7mn$(t.TEXT_TRANSFORM_0,function(t){return function(e){return t.textTransform=e,g}}(o)).getExistingDouble_l47sdb$(t.SIZE_0,function(t){return function(e){return t.size=e,g}}(o)).getExistingDouble_l47sdb$(t.WRAP_WIDTH_0,function(t){return function(e){return t.wrapWidth=e,g}}(o)).getExistingDouble_l47sdb$(t.MINIMUM_PADDING_0,function(t){return function(e){return t.minimumPadding=e,g}}(o)).getExistingDouble_l47sdb$(t.REPEAT_DISTANCE_0,function(t){return function(e){return t.repeatDistance=e,g}}(o)).getExistingDouble_l47sdb$(t.SHIELD_CORNER_RADIUS_0,function(t){return function(e){return t.shieldCornerRadius=e,g}}(o)).getExistingString_hyc7mn$(t.SHIELD_FILL_COLOR_0,function(t,e){return function(n){return e.shieldFillColor=t.get_11rb$(n),g}}(e,o)).getExistingString_hyc7mn$(t.SHIELD_STROKE_COLOR_0,function(t,e){return function(n){return e.shieldStrokeColor=t.get_11rb$(n),g}}(e,o)),n.style_wyrdse$(o),g}}function La(t,e){return function(n){var i=Z();return n.forArrEntries_2wy1dl$(function(t,e){return function(n,i){var r,o=e,a=S(Q(i,10));for(r=i.iterator();r.hasNext();){var s,l=r.next();a.add_11rb$(he(t,"string"==typeof(s=l)?s:M()))}return o.put_xwzc9p$(n,a),g}}(t,i)),e.rulesByTileSheet=i,g}}Ho.prototype.asTwkb=function(){return this.myTwkb_mge4rt$_0},Ho.prototype.equals=function(t){var n;return this===t||!(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))&&(e.isType(t,Ho)||M(),!!Vt(this.myTwkb_mge4rt$_0,t.myTwkb_mge4rt$_0))},Ho.prototype.hashCode=function(){return Kt(this.myTwkb_mge4rt$_0)},Ho.prototype.toString=function(){return"GeometryCollection(myTwkb="+this.myTwkb_mge4rt$_0+")"},Ho.$metadata$={kind:$,simpleName:"GeometryCollection",interfaces:[]},ia.$metadata$={kind:$,simpleName:"ConfigureConnectionRequest",interfaces:[na]},ra.$metadata$={kind:$,simpleName:"GetBinaryGeometryRequest",interfaces:[na]},oa.$metadata$={kind:$,simpleName:"CancelBinaryTileRequest",interfaces:[na]},na.$metadata$={kind:$,simpleName:"Request",interfaces:[]},aa.prototype.toString=function(){return this.z.toString()+"-"+this.x+"-"+this.y},aa.prototype.equals=function(t){var n;return this===t||!(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))&&(e.isType(t,aa)||M(),this.x===t.x&&this.y===t.y&&this.z===t.z)},aa.prototype.hashCode=function(){var t=this.x;return(31*(t=(31*t|0)+this.y|0)|0)+this.z|0},aa.$metadata$={kind:$,simpleName:"TileCoordinates",interfaces:[]},Object.defineProperty(sa.prototype,"geometries",{configurable:!0,get:function(){return this.myGeometryConsumer_0.tileGeometries}}),sa.prototype.resume=function(){return this.myParser_0.next()},Object.defineProperty(la.prototype,"tileGeometries",{configurable:!0,get:function(){return this.myTileGeometries_0}}),la.prototype.onPoint_adb7pk$=function(t){this.myTileGeometries_0.add_11rb$(Wt.Companion.createMultiPoint_xgn53i$(new x(Y(Xt(t)))))},la.prototype.onLineString_1u6eph$=function(t){this.myTileGeometries_0.add_11rb$(Wt.Companion.createMultiLineString_bc4hlz$(new k(Y(Zt(t)))))},la.prototype.onPolygon_z3kb82$=function(t){this.myTileGeometries_0.add_11rb$(Wt.Companion.createMultiPolygon_8ft4gs$(new E(Y(Jt(t)))))},la.prototype.onMultiPoint_oeq1z7$=function(t){this.myTileGeometries_0.add_11rb$(Wt.Companion.createMultiPoint_xgn53i$(Qt(t)))},la.prototype.onMultiLineString_6n275e$=function(t){this.myTileGeometries_0.add_11rb$(Wt.Companion.createMultiLineString_bc4hlz$(te(t)))},la.prototype.onMultiPolygon_a0zxnd$=function(t){this.myTileGeometries_0.add_11rb$(Wt.Companion.createMultiPolygon_8ft4gs$(ee(t)))},la.$metadata$={kind:$,simpleName:"MyGeometryConsumer",interfaces:[G]},sa.$metadata$={kind:$,simpleName:"TileGeometryParser",interfaces:[]},ua.$metadata$={kind:$,simpleName:"TileLayer",interfaces:[]},ua.prototype.component1=function(){return this.name},ua.prototype.component2=function(){return this.geometryCollection},ua.prototype.component3=function(){return this.kinds},ua.prototype.component4=function(){return this.subs},ua.prototype.component5=function(){return this.labels},ua.prototype.component6=function(){return this.shorts},ua.prototype.component7=function(){return this.size},ua.prototype.copy_4csmna$=function(t,e,n,i,r,o,a){return new ua(void 0===t?this.name:t,void 0===e?this.geometryCollection:e,void 0===n?this.kinds:n,void 0===i?this.subs:i,void 0===r?this.labels:r,void 0===o?this.shorts:o,void 0===a?this.size:a)},ua.prototype.toString=function(){return"TileLayer(name="+e.toString(this.name)+", geometryCollection="+e.toString(this.geometryCollection)+", kinds="+e.toString(this.kinds)+", subs="+e.toString(this.subs)+", labels="+e.toString(this.labels)+", shorts="+e.toString(this.shorts)+", size="+e.toString(this.size)+")"},ua.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*(t=31*(t=31*(t=31*(t=31*t+e.hashCode(this.name)|0)+e.hashCode(this.geometryCollection)|0)+e.hashCode(this.kinds)|0)+e.hashCode(this.subs)|0)+e.hashCode(this.labels)|0)+e.hashCode(this.shorts)|0)+e.hashCode(this.size)|0},ua.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)&&e.equals(this.geometryCollection,t.geometryCollection)&&e.equals(this.kinds,t.kinds)&&e.equals(this.subs,t.subs)&&e.equals(this.labels,t.labels)&&e.equals(this.shorts,t.shorts)&&e.equals(this.size,t.size)},ca.prototype.build=function(){return new ua(this.name,this.geometryCollection,this.kinds,this.subs,this.labels,this.shorts,this.layerSize)},ca.$metadata$={kind:$,simpleName:"TileLayerBuilder",interfaces:[]},ha.$metadata$={kind:$,simpleName:"Theme",interfaces:[L]},ha.values=function(){return[fa(),da(),ma()]},ha.valueOf_61zpoe$=function(t){switch(t){case"COLOR":return fa();case"LIGHT":return da();case"DARK":return ma();default:R("No enum constant jetbrains.gis.tileprotocol.TileService.Theme."+t)}},Object.defineProperty(pa.prototype,"mapConfig",{configurable:!0,get:function(){return this.mapConfig_7r1z1y$_0},set:function(t){this.mapConfig_7r1z1y$_0=t}}),pa.prototype.getTileData_h9hod0$=function(t,n){var i,r=(i=this.myIncrement_xi5m5t$_0,this.myIncrement_xi5m5t$_0=i+1|0,i).toString(),o=new tt;this.pendingRequests_jgnyu1$_0.put_9yqal7$(r,o);try{var a=new ra(r,n,t),s=y("format",function(t,e){return t.format_scn9es$(e)}.bind(null,Ma()))(a),l=y("formatJson",function(t,e){return t.formatJson_za3rmp$(e)}.bind(null,et.JsonSupport))(s);y("sendGeometryRequest",function(t,e){return t.sendGeometryRequest_rzspr3$_0(e),g}.bind(null,this))(l)}catch(t){if(!e.isType(t,rt))throw t;this.pendingRequests_jgnyu1$_0.poll_61zpoe$(r).failure_tcv7n7$(t)}return o},pa.prototype.sendGeometryRequest_rzspr3$_0=function(t){switch(this.myStatus_68s9dq$_0.name){case"NOT_CONNECTED":this.myMessageQueue_ew5tg6$_0.add_11rb$(t),this.myStatus_68s9dq$_0=ba(),this.mySocket_8l2uvz$_0.connect();break;case"CONFIGURED":this.mySocket_8l2uvz$_0.send_61zpoe$(t);break;case"CONNECTING":this.myMessageQueue_ew5tg6$_0.add_11rb$(t);break;case"ERROR":throw P("Socket error")}},pa.prototype.sendInitMessage_n8ehnp$_0=function(){var t=new ia(this.myTheme_fy5ei1$_0.name.toLowerCase()),e=y("format",function(t,e){return t.format_scn9es$(e)}.bind(null,Ma()))(t),n=et.JsonSupport.formatJson_za3rmp$(e);y("send",function(t,e){return t.send_61zpoe$(e),g}.bind(null,this.mySocket_8l2uvz$_0))(n)},ya.$metadata$={kind:$,simpleName:"SocketStatus",interfaces:[L]},ya.values=function(){return[va(),ga(),ba(),wa()]},ya.valueOf_61zpoe$=function(t){switch(t){case"NOT_CONNECTED":return va();case"CONFIGURED":return ga();case"CONNECTING":return ba();case"ERROR":return wa();default:R("No enum constant jetbrains.gis.tileprotocol.TileService.SocketStatus."+t)}},xa.prototype.onOpen=function(){this.$outer.sendInitMessage_n8ehnp$_0()},xa.prototype.onClose_61zpoe$=function(t){this.$outer.myMessageQueue_ew5tg6$_0.add_11rb$(t),this.$outer.myStatus_68s9dq$_0===ga()&&(this.$outer.myStatus_68s9dq$_0=ba(),this.$outer.mySocket_8l2uvz$_0.connect())},xa.prototype.onError_tcv7n7$=function(t){this.$outer.myStatus_68s9dq$_0=wa(),this.failPending_0(t)},xa.prototype.onTextMessage_61zpoe$=function(t){null==this.$outer.mapConfig&&(this.$outer.mapConfig=Ia().parse_jbvn2s$(et.JsonSupport.parseJson_61zpoe$(t))),this.$outer.myStatus_68s9dq$_0=ga();var e=this.$outer.myMessageQueue_ew5tg6$_0;this.$outer;var n=this.$outer;e.forEach_qlkmfe$(y("send",function(t,e){return t.send_61zpoe$(e),g}.bind(null,n.mySocket_8l2uvz$_0))),e.clear()},xa.prototype.onBinaryMessage_fqrh44$=function(t){try{var n=new Sa(t);this.$outer;var i=this.$outer,r=n.component1(),o=n.component2();i.pendingRequests_jgnyu1$_0.poll_61zpoe$(r).success_11rb$(o)}catch(t){if(!e.isType(t,rt))throw t;this.failPending_0(t)}},xa.prototype.failPending_0=function(t){var e;for(e=this.$outer.pendingRequests_jgnyu1$_0.pollAll().values.iterator();e.hasNext();)e.next().failure_tcv7n7$(t)},xa.$metadata$={kind:$,simpleName:"TileSocketHandler",interfaces:[ps]},ka.prototype.put_9yqal7$=function(t,e){var n=this.lock_0;try{n.lock(),this.myAsyncMap_0.put_xwzc9p$(t,e)}finally{n.unlock()}},ka.prototype.pollAll=function(){var t=this.lock_0;try{t.lock();var e=K(this.myAsyncMap_0);return this.myAsyncMap_0.clear(),e}finally{t.unlock()}},ka.prototype.poll_61zpoe$=function(t){var e=this.lock_0;try{return e.lock(),A(this.myAsyncMap_0.remove_11rb$(t))}finally{e.unlock()}},ka.$metadata$={kind:$,simpleName:"RequestMap",interfaces:[]},Ea.prototype.add_11rb$=function(t){var e=this.myLock_0;try{e.lock(),this.myList_0.add_11rb$(t)}finally{e.unlock()}},Ea.prototype.forEach_qlkmfe$=function(t){var e=this.myLock_0;try{var n;for(e.lock(),n=this.myList_0.iterator();n.hasNext();)t(n.next())}finally{e.unlock()}},Ea.prototype.clear=function(){var t=this.myLock_0;try{t.lock(),this.myList_0.clear()}finally{t.unlock()}},Ea.$metadata$={kind:$,simpleName:"ThreadSafeMessageQueue",interfaces:[]},pa.$metadata$={kind:$,simpleName:"TileService",interfaces:[]},Ca.prototype.available=function(){return this.count_0-this.position_0|0},Ca.prototype.read=function(){var t;if(this.position_0=this.count_0)throw P("Array size exceeded.");if(t>this.available())throw P("Expected to read "+t+" bytea, but read "+this.available());if(t<=0)return new Int8Array(0);var e=this.position_0;return this.position_0=this.position_0+t|0,re(this.bytes_0,e,this.position_0)},Ca.$metadata$={kind:$,simpleName:"ByteArrayStream",interfaces:[]},Sa.prototype.readLayers_0=function(){var t=z();do{var e=this.byteArrayStream_0.available(),n=new ca;n.name=this.readString_0();var i=hn().readVarUInt_t0n4v2$(y("readByte",function(t){return t.readByte_0()}.bind(null,this)));n.geometryCollection=new Ho(y("read",function(t,e){return t.read_za3lpa$(e)}.bind(null,this.byteArrayStream_0))(i)),n.kinds=this.readInts_0(),n.subs=this.readInts_0(),n.labels=this.readStrings_0(),n.shorts=this.readStrings_0(),n.layerSize=e-this.byteArrayStream_0.available()|0;var r=n.build();y("add",function(t,e){return t.add_11rb$(e)}.bind(null,t))(r)}while(this.byteArrayStream_0.available()>0);return t},Sa.prototype.readInts_0=function(){var t,e=hn().readVarUInt_t0n4v2$(y("readByte",function(t){return t.readByte_0()}.bind(null,this)));if(e>0){var n,i=oe(0,e),r=S(Q(i,10));for(n=i.iterator();n.hasNext();)n.next(),r.add_11rb$(hn().readVarUInt_t0n4v2$(y("readByte",function(t){return t.readByte_0()}.bind(null,this))));t=r}else{if(0!==e)throw d();t=V()}return t},Sa.prototype.readStrings_0=function(){var t,e=hn().readVarUInt_t0n4v2$(y("readByte",function(t){return t.readByte_0()}.bind(null,this)));if(e>0){var n,i=oe(0,e),r=S(Q(i,10));for(n=i.iterator();n.hasNext();)n.next(),r.add_11rb$(this.readString_0());t=r}else{if(0!==e)throw d();t=V()}return t},Sa.prototype.readString_0=function(){var t,e=hn().readVarUInt_t0n4v2$(y("readByte",function(t){return t.readByte_0()}.bind(null,this)));if(e>0)t=(new ae).decode_fqrh44$(this.byteArrayStream_0.read_za3lpa$(e));else{if(0!==e)throw d();t=""}return t},Sa.prototype.readByte_0=function(){return this.byteArrayStream_0.read()},Sa.prototype.component1=function(){return this.key_0},Sa.prototype.component2=function(){return this.tileLayers_0},Sa.$metadata$={kind:$,simpleName:"ResponseTileDecoder",interfaces:[]},Oa.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[at]},Oa.prototype=Object.create(at.prototype),Oa.prototype.constructor=Oa,Oa.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.exceptionState_0=9;var t,n=this.local$this$HttpTileTransport.myClient_0,i=this.local$closure$url;"localhost",t=ct.EmptyContent;var r=new _t;pt(r,"http","localhost",0,"/"),r.method=ht.Companion.Get,r.body=t,ut(r.url,i);var o,a,s,l=new ft(r,n);if(U(o=se,dt(ft))){this.result_0=e.isByteArray(a=l)?a:M(),this.state_0=8;continue}if(U(o,dt(mt))){if(this.state_0=6,this.result_0=l.execute(this),this.result_0===ot)return ot;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===ot)return ot;continue;case 1:var u;this.local$response=this.result_0,this.exceptionState_0=4;var c,p=this.local$response.call;t:do{try{c=new vt(se,$t.JsType,it(se,[],!1))}catch(t){c=new vt(se,$t.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(c,this),this.result_0===ot)return ot;continue;case 2:this.result_0=e.isByteArray(u=this.result_0)?u:M(),this.exceptionState_0=9,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=7;continue;case 4:this.finallyPath_0=[9],this.state_0=5;continue;case 5:this.exceptionState_0=9,yt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:this.result_0=e.isByteArray(s=this.result_0)?s:M(),this.state_0=7;continue;case 7:this.state_0=8;continue;case 8:this.result_0;var h=this.result_0;return this.local$closure$async.success_11rb$(h),g;case 9:this.exceptionState_0=13;var _=this.exception_0;if(e.isType(_,ue))return this.local$closure$async.failure_tcv7n7$(le(_.response.status.toString())),g;if(e.isType(_,rt))return this.local$closure$async.failure_tcv7n7$(_),g;throw _;case 10:this.state_0=11;continue;case 11:this.state_0=12;continue;case 12:return;case 13:throw this.exception_0;default:throw this.state_0=13,new Error("State Machine Unreachable execution")}}catch(t){if(13===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ta.prototype.get_61zpoe$=function(t){var e,n,i,r=new tt;return st(this.myClient_0,void 0,void 0,(e=this,n=t,i=r,function(t,r,o){var a=new Oa(e,n,i,t,this,r);return o?a:a.doResume(null)})),r},Ta.$metadata$={kind:$,simpleName:"HttpTileTransport",interfaces:[]},Na.prototype.parse_jbvn2s$=function(t){var e=qt(t),n=this.readColors_0(e.getObject_61zpoe$(this.COLORS_0)),i=this.readStyles_0(e.getObject_61zpoe$(this.STYLES_0),n);return(new ns).tileSheetBackgrounds_5rxuhj$(this.readTileSheets_0(e.getObject_61zpoe$(this.TILE_SHEETS_0),n)).colors_5rxuhj$(n).layerNamesByZoom_qqdhea$(this.readZooms_0(e.getObject_61zpoe$(this.ZOOMS_0))).layers_c08aqx$(this.readLayers_0(e.getObject_61zpoe$(this.LAYERS_0),i)).build()},Na.prototype.readStyles_0=function(t,n){var i,r,o,a=Z();return t.forArrEntries_2wy1dl$((i=n,r=this,o=a,function(t,n){var a,s=o,l=S(Q(n,10));for(a=n.iterator();a.hasNext();){var u,c=a.next(),p=l.add_11rb$,h=i;p.call(l,r.readRule_0(qt(e.isType(u=c,ce)?u:M()),h))}return s.put_xwzc9p$(t,l),g})),a},Na.prototype.readZooms_0=function(t){for(var e=Z(),n=1;n<=15;n++){var i=Yt(Tt(t.getArray_61zpoe$(n.toString()).stream(),Pa));e.put_xwzc9p$(n,i)}return e},Na.prototype.readLayers_0=function(t,e){var n,i,r,o=Z();return t.forObjEntries_izf7h5$((n=e,i=this,r=o,function(t,e){var o=r,a=i.parseLayerConfig_0(t,qt(e),n);return o.put_xwzc9p$(t,a),g})),o},Na.prototype.readColors_0=function(t){var e,n,i=Z();return t.forEntries_ophlsb$((e=this,n=i,function(t,i){var r,o;o="string"==typeof(r=i)?r:M();var a=n,s=e.parseHexWithAlpha_0(o);return a.put_xwzc9p$(t,s),g})),i},Na.prototype.readTileSheets_0=function(t,e){var n,i,r,o=Z();return t.forObjEntries_izf7h5$((n=e,i=this,r=o,function(t,e){var o=r,a=he(n,pe(e,i.BACKGROUND_0));return o.put_xwzc9p$(t,a),g})),o},Na.prototype.readRule_0=function(t,e){var n=new os;return t.getIntOrDefault_u1i54l$(this.MIN_ZOOM_FIELD_0,y("minZoom",function(t,e){return t.minZoom_za3lpa$(e),g}.bind(null,n)),1).getIntOrDefault_u1i54l$(this.MAX_ZOOM_FIELD_0,y("maxZoom",function(t,e){return t.maxZoom_za3lpa$(e),g}.bind(null,n)),15).getExistingObject_6k19qz$(this.FILTER_0,Aa(this,n)).getExistingObject_6k19qz$(this.SYMBOLIZER_0,ja(this,e,n)),n.build()},Na.prototype.makeCompareFunctions_0=function(t){if(t.contains_61zpoe$(this.GT_0))return e=t.getInt_61zpoe$(this.GT_0),function(t){return t>e};var e;if(t.contains_61zpoe$(this.GTE_0))return function(t){return function(e){return e>=t}}(t.getInt_61zpoe$(this.GTE_0));if(t.contains_61zpoe$(this.LT_0))return function(t){return function(e){return ee)return!1;for(n=this.filters.iterator();n.hasNext();)if(!n.next()(t))return!1;return!0},Object.defineProperty(os.prototype,"style_0",{configurable:!0,get:function(){return null==this.style_czizc7$_0?C("style"):this.style_czizc7$_0},set:function(t){this.style_czizc7$_0=t}}),os.prototype.minZoom_za3lpa$=function(t){this.minZoom_0=t},os.prototype.maxZoom_za3lpa$=function(t){this.maxZoom_0=t},os.prototype.style_wyrdse$=function(t){this.style_0=t},os.prototype.addFilterFunction_xmiwn3$=function(t){this.filters_0.add_11rb$(t)},os.prototype.build=function(){return new rs(A(this.minZoom_0),A(this.maxZoom_0),this.filters_0,this.style_0)},os.$metadata$={kind:$,simpleName:"RuleBuilder",interfaces:[]},rs.$metadata$={kind:$,simpleName:"Rule",interfaces:[]},as.$metadata$={kind:$,simpleName:"Style",interfaces:[]},ss.prototype.safeRun_0=function(t){try{t()}catch(t){if(!e.isType(t,rt))throw t;this.myThrowableHandler_0.handle_tcv7n7$(t)}},ss.prototype.onClose_61zpoe$=function(t){var e,n;this.safeRun_0((e=this,n=t,function(){return e.myHandler_0.onClose_61zpoe$(n),g}))},ss.prototype.onError_tcv7n7$=function(t){var e,n;this.safeRun_0((e=this,n=t,function(){return e.myHandler_0.onError_tcv7n7$(n),g}))},ss.prototype.onTextMessage_61zpoe$=function(t){var e,n;this.safeRun_0((e=this,n=t,function(){return e.myHandler_0.onTextMessage_61zpoe$(n),g}))},ss.prototype.onBinaryMessage_fqrh44$=function(t){var e,n;this.safeRun_0((e=this,n=t,function(){return e.myHandler_0.onBinaryMessage_fqrh44$(n),g}))},ss.prototype.onOpen=function(){var t;this.safeRun_0((t=this,function(){return t.myHandler_0.onOpen(),g}))},ss.$metadata$={kind:$,simpleName:"SafeSocketHandler",interfaces:[ps]},ls.$metadata$={kind:D,simpleName:"Socket",interfaces:[]},cs.$metadata$={kind:$,simpleName:"BaseSocketBuilder",interfaces:[us]},us.$metadata$={kind:D,simpleName:"SocketBuilder",interfaces:[]},ps.$metadata$={kind:D,simpleName:"SocketHandler",interfaces:[]},_s.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[at]},_s.prototype=Object.create(at.prototype),_s.prototype.constructor=_s,_s.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$this$TileWebSocket.mySession_0=this.local$$receiver,this.local$this$TileWebSocket.myHandler_0.onOpen(),this.local$tmp$=this.local$$receiver.incoming.iterator(),this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.local$tmp$.hasNext(this),this.result_0===ot)return ot;continue;case 3:if(this.result_0){this.state_0=4;continue}this.state_0=5;continue;case 4:var t=this.local$tmp$.next();e.isType(t,Ee)?this.local$this$TileWebSocket.myHandler_0.onTextMessage_61zpoe$(ke(t)):e.isType(t,Se)&&this.local$this$TileWebSocket.myHandler_0.onBinaryMessage_fqrh44$(Ce(t)),this.state_0=2;continue;case 5:return g;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ds.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[at]},ds.prototype=Object.create(at.prototype),ds.prototype.constructor=ds,ds.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Te(this.local$this$,this.local$this$TileWebSocket.myUrl_0,void 0,fs(this.local$this$TileWebSocket),this),this.result_0===ot)return ot;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},hs.prototype.connect=function(){var t,e,n=this.myClient_0;st(n,void 0,void 0,(t=this,e=n,function(n,i,r){var o=new ds(t,e,n,this,i);return r?o:o.doResume(null)}))},ms.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[at]},ms.prototype=Object.create(at.prototype),ms.prototype.constructor=ms,ms.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(null!=(t=this.local$this$TileWebSocket.mySession_0)){if(this.state_0=2,this.result_0=Pe(t,Ne(Oe.NORMAL,"Close session"),this),this.result_0===ot)return ot;continue}this.result_0=null,this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.result_0=g,this.state_0=3;continue;case 3:return this.local$this$TileWebSocket.mySession_0=null,g;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},hs.prototype.close=function(){var t;st(this.myClient_0,void 0,void 0,(t=this,function(e,n,i){var r=new ms(t,e,this,n);return i?r:r.doResume(null)}))},ys.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[at]},ys.prototype=Object.create(at.prototype),ys.prototype.constructor=ys,ys.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(null!=(t=this.local$this$TileWebSocket.mySession_0)){if(this.local$closure$msg_0=this.local$closure$msg,this.local$this$TileWebSocket_0=this.local$this$TileWebSocket,this.exceptionState_0=2,this.state_0=1,this.result_0=t.outgoing.send_11rb$(Ae(this.local$closure$msg_0),this),this.result_0===ot)return ot;continue}this.local$tmp$=null,this.state_0=4;continue;case 1:this.exceptionState_0=5,this.state_0=3;continue;case 2:this.exceptionState_0=5;var n=this.exception_0;if(!e.isType(n,rt))throw n;this.local$this$TileWebSocket_0.myHandler_0.onClose_61zpoe$(this.local$closure$msg_0),this.state_0=3;continue;case 3:this.local$tmp$=g,this.state_0=4;continue;case 4:return this.local$tmp$;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},hs.prototype.send_61zpoe$=function(t){var e,n;st(this.myClient_0,void 0,void 0,(e=this,n=t,function(t,i,r){var o=new ys(e,n,t,this,i);return r?o:o.doResume(null)}))},hs.$metadata$={kind:$,simpleName:"TileWebSocket",interfaces:[ls]},$s.prototype.build_korocx$=function(t){return new hs(Re(je.Js,vs),t,this.myUrl_0)},$s.$metadata$={kind:$,simpleName:"TileWebSocketBuilder",interfaces:[us]};var gs=t.jetbrains||(t.jetbrains={}),bs=gs.gis||(gs.gis={}),ws=bs.common||(bs.common={}),xs=ws.twkb||(ws.twkb={});xs.InputBuffer=Ie,xs.SimpleFeatureParser=ze,Object.defineProperty(We,"POINT",{get:Ze}),Object.defineProperty(We,"LINESTRING",{get:Je}),Object.defineProperty(We,"POLYGON",{get:Qe}),Object.defineProperty(We,"MULTI_POINT",{get:tn}),Object.defineProperty(We,"MULTI_LINESTRING",{get:en}),Object.defineProperty(We,"MULTI_POLYGON",{get:nn}),Object.defineProperty(We,"GEOMETRY_COLLECTION",{get:rn}),Object.defineProperty(We,"Companion",{get:sn}),Ke.GeometryType=We,Ve.prototype.Parser=Ke,Object.defineProperty(xs,"Twkb",{get:un}),Object.defineProperty(xs,"VarInt",{get:hn}),Object.defineProperty(_n,"Companion",{get:yn});var ks=bs.geoprotocol||(bs.geoprotocol={});ks.Boundary=_n,Object.defineProperty(ks,"Boundaries",{get:Un}),Object.defineProperty(Fn,"COUNTRY",{get:Gn}),Object.defineProperty(Fn,"MACRO_STATE",{get:Hn}),Object.defineProperty(Fn,"STATE",{get:Yn}),Object.defineProperty(Fn,"MACRO_COUNTY",{get:Vn}),Object.defineProperty(Fn,"COUNTY",{get:Kn}),Object.defineProperty(Fn,"CITY",{get:Wn}),ks.FeatureLevel=Fn,ks.Fragment=Zn,Object.defineProperty(Qn,"HIGHLIGHTS",{get:ei}),Object.defineProperty(Qn,"POSITION",{get:ni}),Object.defineProperty(Qn,"CENTROID",{get:ii}),Object.defineProperty(Qn,"LIMIT",{get:ri}),Object.defineProperty(Qn,"BOUNDARY",{get:oi}),Object.defineProperty(Qn,"FRAGMENTS",{get:ai}),Jn.FeatureOption=Qn,Jn.ExplicitSearchRequest=si,Object.defineProperty(ci,"SKIP_ALL",{get:hi}),Object.defineProperty(ci,"SKIP_MISSING",{get:_i}),Object.defineProperty(ci,"SKIP_NAMESAKES",{get:fi}),Object.defineProperty(ci,"TAKE_NAMESAKES",{get:di}),ui.IgnoringStrategy=ci,Object.defineProperty(ui,"Companion",{get:$i}),li.AmbiguityResolver=ui,li.RegionQuery=vi,Jn.GeocodingSearchRequest=li,Jn.ReverseGeocodingSearchRequest=gi,ks.GeoRequest=Jn,bi.prototype.RequestBuilderBase=wi,xi.MyReverseGeocodingSearchRequest=ki,bi.prototype.ReverseGeocodingRequestBuilder=xi,Ei.MyGeocodingSearchRequest=Ci,Object.defineProperty(Ei,"Companion",{get:Oi}),bi.prototype.GeocodingRequestBuilder=Ei,Ni.MyExplicitSearchRequest=Pi,bi.prototype.ExplicitRequestBuilder=Ni,bi.prototype.MyGeoRequestBase=Ai,bi.prototype.MapRegionBuilder=ji,bi.prototype.RegionQueryBuilder=Li,Object.defineProperty(ks,"GeoRequestBuilder",{get:Mi}),Ui.GeocodedFeature=Fi,Bi.SuccessGeoResponse=Ui,Bi.ErrorGeoResponse=qi,Gi.AmbiguousFeature=Hi,Gi.Namesake=Yi,Gi.NamesakeParent=Vi,Bi.AmbiguousGeoResponse=Gi,ks.GeoResponse=Bi,Ki.prototype.SuccessResponseBuilder=Wi,Ki.prototype.AmbiguousResponseBuilder=Xi,Ki.prototype.GeocodedFeatureBuilder=Zi,Ki.prototype.AmbiguousFeatureBuilder=Ji,Ki.prototype.NamesakeBuilder=Qi,ks.GeoTransport=tr,f["ktor-ktor-client-core"]=r,ks.GeoTransportImpl=er,Object.defineProperty(rr,"BY_ID",{get:ar}),Object.defineProperty(rr,"BY_NAME",{get:sr}),Object.defineProperty(rr,"REVERSE",{get:lr}),ks.GeocodingMode=rr,Object.defineProperty(ur,"Companion",{get:dr}),ks.GeocodingService=ur,Object.defineProperty(ks,"GeometryUtil",{get:function(){return null===Lr&&new mr,Lr}}),Object.defineProperty(Rr,"CITY_HIGH",{get:zr}),Object.defineProperty(Rr,"CITY_MEDIUM",{get:Dr}),Object.defineProperty(Rr,"CITY_LOW",{get:Mr}),Object.defineProperty(Rr,"COUNTY_HIGH",{get:Br}),Object.defineProperty(Rr,"COUNTY_MEDIUM",{get:Ur}),Object.defineProperty(Rr,"COUNTY_LOW",{get:Fr}),Object.defineProperty(Rr,"STATE_HIGH",{get:qr}),Object.defineProperty(Rr,"STATE_MEDIUM",{get:Gr}),Object.defineProperty(Rr,"STATE_LOW",{get:Hr}),Object.defineProperty(Rr,"COUNTRY_HIGH",{get:Yr}),Object.defineProperty(Rr,"COUNTRY_MEDIUM",{get:Vr}),Object.defineProperty(Rr,"COUNTRY_LOW",{get:Kr}),Object.defineProperty(Rr,"WORLD_HIGH",{get:Wr}),Object.defineProperty(Rr,"WORLD_MEDIUM",{get:Xr}),Object.defineProperty(Rr,"WORLD_LOW",{get:Zr}),Object.defineProperty(Rr,"Companion",{get:io}),ks.LevelOfDetails=Rr,Object.defineProperty(oo,"Companion",{get:ho}),ks.MapRegion=oo;var Es=ks.json||(ks.json={});Object.defineProperty(Es,"ProtocolJsonHelper",{get:mo}),Object.defineProperty(Es,"RequestJsonFormatter",{get:vo}),Object.defineProperty(Es,"RequestKeys",{get:wo}),Object.defineProperty(Es,"ResponseJsonParser",{get:Ao}),Object.defineProperty(Es,"ResponseKeys",{get:Do}),Object.defineProperty(Mo,"SUCCESS",{get:Uo}),Object.defineProperty(Mo,"AMBIGUOUS",{get:Fo}),Object.defineProperty(Mo,"ERROR",{get:qo}),Es.ResponseStatus=Mo,Object.defineProperty(Ho,"Companion",{get:ea});var Cs=bs.tileprotocol||(bs.tileprotocol={});Cs.GeometryCollection=Ho,na.ConfigureConnectionRequest=ia,na.GetBinaryGeometryRequest=ra,na.CancelBinaryTileRequest=oa,Cs.Request=na,Cs.TileCoordinates=aa,Cs.TileGeometryParser=sa,Cs.TileLayer=ua,Cs.TileLayerBuilder=ca,Object.defineProperty(ha,"COLOR",{get:fa}),Object.defineProperty(ha,"LIGHT",{get:da}),Object.defineProperty(ha,"DARK",{get:ma}),pa.Theme=ha,pa.TileSocketHandler=xa,f["lets-plot-base"]=i,pa.RequestMap=ka,pa.ThreadSafeMessageQueue=Ea,Cs.TileService=pa;var Ss=Cs.binary||(Cs.binary={});Ss.ByteArrayStream=Ca,Ss.ResponseTileDecoder=Sa,(Cs.http||(Cs.http={})).HttpTileTransport=Ta;var Ts=Cs.json||(Cs.json={});Object.defineProperty(Ts,"MapStyleJsonParser",{get:Ia}),Object.defineProperty(Ts,"RequestFormatter",{get:Ma}),f["lets-plot-base-portable"]=n,Object.defineProperty(Ts,"RequestJsonParser",{get:Fa}),Object.defineProperty(Ts,"RequestKeys",{get:Ka}),Object.defineProperty(Wa,"CONFIGURE_CONNECTION",{get:Za}),Object.defineProperty(Wa,"GET_BINARY_TILE",{get:Ja}),Object.defineProperty(Wa,"CANCEL_BINARY_TILE",{get:Qa}),Ts.RequestTypes=Wa;var Os=Cs.mapConfig||(Cs.mapConfig={});Os.LayerConfig=ts,es.MapConfigBuilder=ns,Os.MapConfig=es,Os.TilePredicate=is,rs.RuleBuilder=os,Os.Rule=rs,Os.Style=as;var Ns=Cs.socket||(Cs.socket={});return Ns.SafeSocketHandler=ss,Ns.Socket=ls,us.BaseSocketBuilder=cs,Ns.SocketBuilder=us,Ns.SocketHandler=ps,Ns.TileWebSocket=hs,Ns.TileWebSocketBuilder=$s,bn.prototype.onLineString_1u6eph$=G.prototype.onLineString_1u6eph$,bn.prototype.onMultiLineString_6n275e$=G.prototype.onMultiLineString_6n275e$,bn.prototype.onMultiPoint_oeq1z7$=G.prototype.onMultiPoint_oeq1z7$,bn.prototype.onPoint_adb7pk$=G.prototype.onPoint_adb7pk$,t})?i.apply(e,r):i)||(t.exports=o)},837:function(t,e,n){var i,r,o;r=[e,n(421),n(73),n(602),n(770),n(767),n(623),n(362),n(232),n(179),n(331),n(330),n(698)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o,a,s,l,u,c,p,h){"use strict";var _,f=n.mu,d=e.kotlin.Unit,m=i.jetbrains.datalore.base.jsObject.dynamicObjectToMap_za3rmp$,y=r.jetbrains.datalore.plot.config.PlotConfig,$=e.kotlin.RuntimeException,v=o.jetbrains.datalore.base.geometry.DoubleVector,g=r.jetbrains.datalore.plot,b=r.jetbrains.datalore.plot.MonolithicCommon.PlotsBuildResult.Error,w=e.throwCCE,x=r.jetbrains.datalore.plot.MonolithicCommon.PlotsBuildResult.Success,k=e.ensureNotNull,E=e.kotlinx.dom.createElement_7cgwi1$,C=o.jetbrains.datalore.base.geometry.DoubleRectangle,S=a.jetbrains.datalore.plot.builder.presentation,T=s.jetbrains.datalore.plot.livemap.CursorServiceConfig,O=l.jetbrains.datalore.plot.builder.PlotContainer,N=i.jetbrains.datalore.base.js.css.enumerables.CssCursor,P=i.jetbrains.datalore.base.js.css.setCursor_1m07bc$,A=r.jetbrains.datalore.plot.config.LiveMapOptionsParser,j=s.jetbrains.datalore.plot.livemap,L=u.jetbrains.datalore.vis.svgMapper.dom.SvgRootDocumentMapper,R=c.jetbrains.datalore.vis.svg.SvgNodeContainer,I=i.jetbrains.datalore.base.js.css.enumerables.CssPosition,z=i.jetbrains.datalore.base.js.css.setPosition_h2yxxn$,D=i.jetbrains.datalore.base.js.dom.DomEventType,M=o.jetbrains.datalore.base.event.MouseEventSpec,B=i.jetbrains.datalore.base.event.dom,U=p.jetbrains.datalore.vis.canvasFigure.CanvasFigure,F=i.jetbrains.datalore.base.js.css.setLeft_1gtuon$,q=i.jetbrains.datalore.base.js.css.setTop_1gtuon$,G=i.jetbrains.datalore.base.js.css.setWidth_o105z1$,H=p.jetbrains.datalore.vis.canvas.dom.DomCanvasControl,Y=p.jetbrains.datalore.vis.canvas.dom.DomCanvasControl.DomEventPeer,V=r.jetbrains.datalore.plot.config,K=r.jetbrains.datalore.plot.server.config.PlotConfigServerSide,W=h.jetbrains.datalore.plot.server.config,X=e.kotlin.collections.ArrayList_init_287e2$,Z=e.kotlin.collections.addAll_ipc267$,J=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,Q=e.kotlin.collections.ArrayList_init_ww73n8$,tt=e.kotlin.collections.Collection,et=e.kotlin.text.isBlank_gw00vp$;function nt(t,n,i,r){var o,a,s=n>0&&i>0?new v(n,i):null,l=r.clientWidth,u=g.MonolithicCommon.buildPlotsFromProcessedSpecs_rim63o$(t,s,l);if(u.isError)ut((e.isType(o=u,b)?o:w()).error,r);else{var c,p,h=e.isType(a=u,x)?a:w(),_=h.buildInfos,f=X();for(c=_.iterator();c.hasNext();){var d=c.next().computationMessages;Z(f,d)}for(p=f.iterator();p.hasNext();)ct(p.next(),r);1===h.buildInfos.size?ot(h.buildInfos.get_za3lpa$(0),r):rt(h.buildInfos,r)}}function it(t){return function(e){return e.setAttribute("style","position: absolute; left: "+t.origin.x+"px; top: "+t.origin.y+"px;"),d}}function rt(t,n){var i,r;for(i=t.iterator();i.hasNext();){var o=i.next(),a=e.isType(r=E(k(n.ownerDocument),"div",it(o)),HTMLElement)?r:w();n.appendChild(a),ot(o,a)}var s,l,u=Q(J(t,10));for(s=t.iterator();s.hasNext();){var c=s.next();u.add_11rb$(c.bounds())}var p=new C(v.Companion.ZERO,v.Companion.ZERO);for(l=u.iterator();l.hasNext();){var h=l.next();p=p.union_wthzt5$(h)}var _,f=p,d="position: relative; width: "+f.width+"px; height: "+f.height+"px;";t:do{var m;if(e.isType(t,tt)&&t.isEmpty()){_=!1;break t}for(m=t.iterator();m.hasNext();)if(m.next().plotAssembler.containsLiveMap){_=!0;break t}_=!1}while(0);_||(d=d+" background-color: "+S.Defaults.BACKDROP_COLOR+";"),n.setAttribute("style",d)}function ot(t,n){var i=t.plotAssembler,r=new T;!function(t,e,n){var i;null!=(i=A.Companion.parseFromPlotSpec_x7u0o8$(e))&&j.LiveMapUtil.injectLiveMapProvider_q1corz$(t.layersByTile,i,n)}(i,t.processedPlotSpec,r);var o,a=i.createPlot(),s=function(t,n){t.ensureContentBuilt();var i,r=t.svg,o=new L(r);for(new R(r),o.attachRoot_8uof53$(),t.isLiveMap&&(r.addClass_61zpoe$(S.Style.PLOT_TRANSPARENT),z(o.target.style,I.RELATIVE)),n.addEventListener(D.Companion.MOUSE_DOWN.name,at),n.addEventListener(D.Companion.MOUSE_MOVE.name,function(t,n){return function(i){var r;return t.mouseEventPeer.dispatch_w7zfbj$(M.MOUSE_MOVED,B.DomEventUtil.translateInTargetCoord_iyxqrk$(e.isType(r=i,MouseEvent)?r:w(),n.target)),d}}(t,o)),n.addEventListener(D.Companion.MOUSE_LEAVE.name,function(t,n){return function(i){var r;return t.mouseEventPeer.dispatch_w7zfbj$(M.MOUSE_LEFT,B.DomEventUtil.translateInTargetCoord_iyxqrk$(e.isType(r=i,MouseEvent)?r:w(),n.target)),d}}(t,o)),i=t.liveMapFigures.iterator();i.hasNext();){var a,s,l=i.next(),u=(e.isType(a=l,U)?a:w()).bounds().get(),c=e.isType(s=document.createElement("div"),HTMLElement)?s:w(),p=c.style;F(p,u.origin.x),q(p,u.origin.y),G(p,u.dimension.x),z(p,I.RELATIVE);var h=new H(c,u.dimension,new Y(o.target,u));l.mapToCanvas_49gm0j$(h),n.appendChild(c)}return o.target}(new O(a,t.size),n);r.defaultSetter_o14v8n$((o=s,function(){return P(o.style,N.CROSSHAIR),d})),r.pointerSetter_o14v8n$(function(t){return function(){return P(t.style,N.POINTER),d}}(s)),n.appendChild(s)}function at(t){return t.preventDefault(),d}function st(){return d}function lt(t,e){var n=V.FailureHandler.failureInfo_j5jy6c$(t);ut(n.message,e),n.isInternalError&&_.error_ca4k3s$(t,st)}function ut(t,e){pt(t,"lets-plot-message-error","color:darkred;",e)}function ct(t,e){pt(t,"lets-plot-message-info","color:darkblue;",e)}function pt(t,n,i,r){var o,a=e.isType(o=k(r.ownerDocument).createElement("p"),HTMLParagraphElement)?o:w();et(i)||a.setAttribute("style",i),a.textContent=t,a.className=n,r.appendChild(a)}function ht(t,e){if(y.Companion.assertPlotSpecOrErrorMessage_x7u0o8$(t),y.Companion.isFailure_x7u0o8$(t))return t;var n=e?t:K.Companion.processTransform_2wxo1b$(t);return y.Companion.isFailure_x7u0o8$(n)?n:W.PlotConfigClientSideJvmJs.processTransform_2wxo1b$(n)}return t.buildPlotFromRawSpecs=function(t,n,i,r){try{var o=m(t);y.Companion.assertPlotSpecOrErrorMessage_x7u0o8$(o),nt(ht(o,!1),n,i,r)}catch(t){if(!e.isType(t,$))throw t;lt(t,r)}},t.buildPlotFromProcessedSpecs=function(t,n,i,r){try{nt(ht(m(t),!0),n,i,r)}catch(t){if(!e.isType(t,$))throw t;lt(t,r)}},t.buildGGBunchComponent_w287e$=rt,_=f.KotlinLogging.logger_o14v8n$((function(){return d})),t})?i.apply(e,r):i)||(t.exports=o)},521:function(t,e,n){var i,r,o;r=[e,n(421),n(767),n(330),n(602),n(564)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o){"use strict";var a=t.$$importsForInline$$||(t.$$importsForInline$$={}),s=e.ensureNotNull,l=e.toString,u=e.Long.ZERO,c=e.Kind.CLASS,p=e.getKClass,h=e.kotlin.sequences.map_z5avom$,_=e.kotlin.sequences.toSet_veqyi0$,f=e.kotlin.collections.intersect_q4559j$,d=e.getPropertyCallableRef,m=e.kotlin.collections.joinToString_fmv235$,y=e.kotlin.sequences.filter_euau3h$,$=e.kotlin.sequences.count_veqyi0$,v=e.Kind.INTERFACE,g=e.numberToInt,b=e.Kind.OBJECT,w=e.kotlin.collections.ArrayList_init_287e2$,x=e.kotlin.collections.listOf_i5x0yv$,k=n.jetbrains.datalore.base.values.Color,E=n.jetbrains.datalore.base.geometry.DoubleVector,C=e.throwCCE,S=e.kotlin.IllegalStateException_init_pdl1vj$,T=e.throwUPAE,O=n.jetbrains.datalore.base.observable.event.EventHandler,N=e.kotlin.Unit,P=i.jetbrains.datalore.vis.canvas.AnimationProvider.AnimationEventHandler,A=e.getCallableRef,j=i.jetbrains.datalore.vis.canvas,L=n.jetbrains.datalore.base.typedGeometry.plus_cg1mpz$,R=n.jetbrains.datalore.base.typedGeometry.div_4nb5xq$,I=n.jetbrains.datalore.base.geometry.Vector,z=i.jetbrains.datalore.vis.canvas.DeltaTime,D=n.jetbrains.datalore.base.registration.Registration,M=r.jetbrains.datalore.base.observable.event.SimpleEventSource,B=n.jetbrains.datalore.base.observable.property.ValueProperty,U=n.jetbrains.datalore.base.registration.Disposable,F=n.jetbrains.datalore.base.spatial.GeoRectangle,q=n.jetbrains.datalore.base.geometry.DoubleRectangle_init_6y0v78$,G=n.jetbrains.datalore.base.spatial,H=n.jetbrains.datalore.base.typedGeometry.explicitVec_y7b45i$,Y=n.jetbrains.datalore.base.typedGeometry.get_scalarX_xocuba$,V=n.jetbrains.datalore.base.typedGeometry.minus_qnxb21$,K=n.jetbrains.datalore.base.typedGeometry.transform_nj6yk8$,W=n.jetbrains.datalore.base.typedGeometry.plus_qnxb21$,X=e.kotlin.math.round_14dthe$,Z=Math,J=r.jetbrains.datalore.base.async,Q=e.kotlin.collections.asSequence_7wnvza$,tt=e.kotlin.sequences.mapNotNull_qpz9h9$,et=e.kotlin.sequences.flatten_d9bjs1$,nt=e.kotlin.sequences.maxOrNull_1bslqu$,it=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,rt=e.kotlin.collections.ArrayList_init_ww73n8$,ot=e.kotlin.collections.checkIndexOverflow_za3lpa$,at=(e.kotlin.Annotation,e.kotlin.collections.emptyList_287e2$),st=e.kotlin.collections.HashMap_init_q3lmfv$,lt=n.jetbrains.datalore.base.typedGeometry.createMultiPolygon_hv912c$,ut=n.jetbrains.datalore.base.typedGeometry.Ring,ct=e.kotlin.collections.listOf_mh5how$,pt=n.jetbrains.datalore.base.typedGeometry.Polygon,ht=n.jetbrains.datalore.base.typedGeometry.MultiPolygon,_t=n.jetbrains.datalore.base.spatial.limitLon_14dthe$,ft=n.jetbrains.datalore.base.spatial.limitLat_14dthe$,dt=(o.jetbrains.gis.geoprotocol.MapRegion,o.jetbrains.gis.tileprotocol.socket.TileWebSocketBuilder),mt=o.jetbrains.gis.tileprotocol.TileService,yt=o.jetbrains.gis.tileprotocol.TileService.Theme,$t=o.jetbrains.gis.geoprotocol.GeoTransportImpl,vt=o.jetbrains.gis.geoprotocol.GeocodingService,gt=o.jetbrains.gis.geoprotocol,bt=e.kotlin.collections.toDoubleArray_tcduak$,wt=e.kotlin.math,xt=e.kotlin.collections.addAll_ipc267$,kt=e.kotlin.js.internal.DoubleCompanionObject,Et=e.kotlin.RuntimeException_init_pdl1vj$,Ct=o.jetbrains.gis.geoprotocol.GeoTransport,St=n.jetbrains.datalore.base.unsupported.UNSUPPORTED_61zpoe$,Tt=o.jetbrains.gis.tileprotocol.socket.Socket,Ot=o.jetbrains.gis.tileprotocol.socket.SocketBuilder,Nt=e.kotlin.collections.sum_l63kqw$,Pt=n.jetbrains.datalore.base.typedGeometry.get_scalarLeft_xdjzag$,At=n.jetbrains.datalore.base.typedGeometry.get_scalarRight_xdjzag$,jt=n.jetbrains.datalore.base.typedGeometry.get_scalarTop_xdjzag$,Lt=n.jetbrains.datalore.base.typedGeometry.get_scalarBottom_xdjzag$,Rt=n.jetbrains.datalore.base.typedGeometry.get_left_h9e6jg$,It=n.jetbrains.datalore.base.typedGeometry.get_width_h9e6jg$,zt=n.jetbrains.datalore.base.typedGeometry.Rect,Dt=n.jetbrains.datalore.base.typedGeometry.get_top_h9e6jg$,Mt=n.jetbrains.datalore.base.typedGeometry.get_height_h9e6jg$,Bt=e.equals,Ut=n.jetbrains.datalore.base.typedGeometry.minus_cg1mpz$,Ft=e.kotlin.sequences.toList_veqyi0$,qt=n.jetbrains.datalore.base.spatial.GeoBoundingBoxCalculator,Gt=n.jetbrains.datalore.base.spatial.union_86o20w$,Ht=n.jetbrains.datalore.base.typedGeometry.get_right_h9e6jg$,Yt=n.jetbrains.datalore.base.typedGeometry.get_bottom_h9e6jg$,Vt=n.jetbrains.datalore.base.typedGeometry.xRange_h9e6jg$,Kt=n.jetbrains.datalore.base.typedGeometry.yRange_h9e6jg$,Wt=n.jetbrains.datalore.base.spatial.QuadKey,Xt=n.jetbrains.datalore.base.spatial.calculateQuadKeys_a35lcs$,Zt=e.kotlin.collections.flatten_u0ad8z$,Jt=e.kotlin.collections.toSet_7wnvza$,Qt=n.jetbrains.datalore.base.gcommon.collect.ClosedRange,te=n.jetbrains.datalore.base.typedGeometry.Rect_init_94ua8u$,ee=i.jetbrains.datalore.vis.canvas.scheduleAsync_ebnxch$,ne=n.jetbrains.datalore.base.observable.property,ie=r.jetbrains.datalore.base.observable.property,re=i.jetbrains.datalore.vis.canvas.SingleCanvasControl,oe=e.kotlin.text.split_ip8yn$,ae=i.jetbrains.datalore.vis.canvas.Context2d.TextBaseline,se=i.jetbrains.datalore.vis.canvas.Context2d.TextAlign,le=i.jetbrains.datalore.vis.canvas.Context2d.Font,ue=e.kotlin.collections.get_indices_gzk92b$,ce=e.Long.fromInt(1e3),pe=e.kotlin.collections.HashSet_init_287e2$,he=e.kotlin.IllegalStateException_init,_e=n.jetbrains.datalore.base.spatial.computeRect_v4gkf3$,fe=n.jetbrains.datalore.base.spatial.calculateQuadKeys_h9hod0$,de=e.kotlin.collections.minus_khz7k3$,me=e.kotlin.Enum,ye=e.throwISE,$e=e.numberToDouble,ve=e.kotlin.IllegalArgumentException_init,ge=e.kotlin.text.toBoolean_5cw0du$,be=e.kotlin.text.equals_igcy3c$,we=e.kotlin.Pair,xe=e.kotlin.collections.Map,ke=n.jetbrains.datalore.base.geometry.Rectangle_init_tjonv8$,Ee=i.jetbrains.datalore.vis.canvasFigure.CanvasFigure,Ce=n.jetbrains.datalore.base.typedGeometry.get_center_xdjzag$,Se=e.kotlin.IndexOutOfBoundsException_init,Te=e.kotlin.collections.AbstractIterator,Oe=e.kotlin.collections.MutableIterator,Ne=e.kotlin.collections.MutableIterable,Pe=e.kotlin.collections.binarySearch_vikexg$,Ae=e.kotlin.collections.AbstractCollection,je=e.kotlin.comparisons.reversed_2avth4$,Le=e.wrapFunction,Re=e.kotlin.Comparator,Ie=e.kotlin.collections.ArrayList,ze=e.kotlin.collections.ArrayList_init_mqih57$,De=e.defineInlineFunction,Me=e.kotlin.collections.emptySet_287e2$,Be=e.kotlin.collections.emptyMap_q3lmfv$,Ue=e.kotlin.collections.first_7wnvza$,Fe=e.kotlin.sequences.firstOrNull_veqyi0$,qe=e.kotlin.sequences.filterNot_euau3h$,Ge=e.kotlin.IllegalArgumentException_init_pdl1vj$,He=n.jetbrains.datalore.base.geometry.DoubleRectangle,Ye=n.jetbrains.datalore.base.event.MouseEventSpec,Ve=r.jetbrains.datalore.base.observable.event.handler_7qq44f$,Ke=n.jetbrains.datalore.base.event.Button,We=n.jetbrains.datalore.base.registration.CompositeRegistration,Xe=e.kotlin.sequences.toHashSet_veqyi0$,Ze=e.kotlin.collections.get_lastIndex_55thoc$,Je=e.kotlin.collections.last_2p1efm$,Qe=n.jetbrains.datalore.base.math.toRadians_14dthe$,tn=n.jetbrains.datalore.base.math.toDegrees_14dthe$,en=n.jetbrains.datalore.base.typedGeometry.Scalar,nn=n.jetbrains.datalore.base.typedGeometry.unaryMinus_cr59ze$,rn=n.jetbrains.datalore.base.typedGeometry.newVec_4xl464$,on=n.jetbrains.datalore.base.typedGeometry.newSpanRectangle_2d1svq$,an=n.jetbrains.datalore.base.typedGeometry.get_scalarY_xocuba$,sn=n.jetbrains.datalore.base.typedGeometry.compareTo_85q7fw$,ln=n.jetbrains.datalore.base.spatial.normalizeLon_14dthe$,un=n.jetbrains.datalore.base.typedGeometry.get_scalarWidth_xdjzag$,cn=n.jetbrains.datalore.base.typedGeometry.get_scalarHeight_xdjzag$,pn=n.jetbrains.datalore.base.typedGeometry.boundingBox_gyuce3$,hn=e.kotlin.isNaN_yrwdxr$,_n=e.kotlin.to_ujzrz7$,fn=e.kotlin.collections.hashMapOf_qfcya0$,dn=e.kotlin.collections.Collection,mn=e.kotlin.collections.toList_us0mfu$,yn=e.kotlin.collections.binarySearch_jhx6be$,$n=e.kotlin.collections.distinct_7wnvza$,vn=o.jetbrains.gis.geoprotocol.GeoRequestBuilder.ExplicitRequestBuilder,gn=o.jetbrains.gis.geoprotocol.GeoRequest.FeatureOption,bn=e.kotlin.collections.mapCapacity_za3lpa$,wn=e.kotlin.ranges.coerceAtLeast_dqglrj$,xn=e.kotlin.collections.LinkedHashMap_init_bwtc7$,kn=n.jetbrains.datalore.base.typedGeometry.reinterpret_q42o9k$,En=n.jetbrains.datalore.base.typedGeometry.limit_lddjmn$,Cn=n.jetbrains.datalore.base.typedGeometry.Geometry,Sn=n.jetbrains.datalore.base.typedGeometry.LineString,Tn=n.jetbrains.datalore.base.typedGeometry.MultiLineString,On=e.kotlin.io.println_s8jyv4$,Nn=e.kotlin.RuntimeException,Pn=n.jetbrains.datalore.base.typedGeometry.MultiPoint,An=e.kotlin.text.dropLast_6ic1pp$,jn=n.jetbrains.datalore.base.typedGeometry.Vec_init_vrm8gm$,Ln=n.jetbrains.datalore.base.typedGeometry.times_4nb5xq$,Rn=n.jetbrains.datalore.base.typedGeometry.Vec,In=e.kotlin.collections.HashMap_init_73mtqc$,zn=e.kotlin.collections.HashSet_init_ww73n8$,Dn=e.kotlin.collections.subtract_q4559j$,Mn=o.jetbrains.gis.geoprotocol.Fragment,Bn=r.jetbrains.datalore.base.concurrent.Lock,Un=n.jetbrains.datalore.base.typedGeometry.reinterpret_dg847r$,Fn=n.jetbrains.datalore.base.spatial.zoom_c2pv3p$,qn=n.jetbrains.datalore.base.spatial.computeRect_c2pv3p$,Gn=n.jetbrains.datalore.base.typedGeometry.intersects_32samh$,Hn=e.kotlin.collections.HashSet_init_mqih57$,Yn=e.kotlin.collections.removeAll_uhyeqt$,Vn=n.jetbrains.datalore.base.typedGeometry.unaryMinus_e0pgg$,Kn=e.kotlin.collections.drop_ba2ldo$,Wn=i.jetbrains.datalore.vis.canvas.Context2d.LineJoin,Xn=n.jetbrains.datalore.base.typedGeometry.contains_h8bixx$,Zn=n.jetbrains.datalore.base.typedGeometry.explicitVec_vrm8gm$,Jn=e.kotlin.sequences.sortedWith_vjgqpk$,Qn=n.jetbrains.datalore.base.typedGeometry.limit_106pae$,ti=e.kotlin.collections.toList_7wnvza$,ei=e.kotlin.collections.single_2p1efm$,ni=o.jetbrains.gis.geoprotocol.GeoRequestBuilder.GeocodingRequestBuilder,ii=o.jetbrains.gis.geoprotocol.GeoRequestBuilder.RegionQueryBuilder,ri=e.kotlin.ranges.rangeTo_38ydlf$,oi=e.kotlin.text.startsWith_7epoxm$,ai=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,si=e.kotlin.collections.removeAll_qafx1e$,li=n.jetbrains.datalore.base.spatial.projectRect_cub2h3$,ui=n.jetbrains.datalore.base.spatial.projectOrigin_cub2h3$,ci=e.kotlin.text.replace_680rmw$,pi=e.kotlin.math.roundToInt_yrwdxr$,hi=o.jetbrains.gis.tileprotocol.http.HttpTileTransport,_i=(e.kotlin.random.Random,i.jetbrains.datalore.vis.canvas.Context2d.Font_init_1nsek9$),fi=i.jetbrains.datalore.vis.canvas.Context2d.LineCap,di=e.kotlin.text.get_indices_gw00vp$,mi=e.kotlin.text.indexOf_8eortd$,yi=n.jetbrains.datalore.base.spatial.convertToGeoRectangle_i3vl8m$,$i=n.jetbrains.datalore.base.spatial.geoRectsBBox_wfabpm$,vi=o.jetbrains.gis.tileprotocol.TileGeometryParser,gi=e.kotlin.collections.getOrNull_yzln2o$,bi=o.jetbrains.gis.tileprotocol.mapConfig.TilePredicate,wi=n.jetbrains.datalore.base.math.round_lu1900$,xi=e.kotlin.collections.setOf_i5x0yv$,ki=e.kotlin.text.Regex_init_61zpoe$;function Ei(){}function Ci(t,e,n,i,r,o){Fi(),Ei.call(this),this.dirtyLayers_0=e,this.schedulerSystem_0=n,this.debugService_0=i,this.registry_0=o,this.diagnostics_0=w(),this.deltaTime_0=u,this.metrics_0=null,this.diagnostics_0.addAll_brywnq$(x([new Si(this),new Ti(this),new Ni(this),new Pi(this),new Ai(this),new ji(this),new Li(this),new Ri(this),new Di(this,t)])),this.debugService_0.setValuesOrder_mhpeer$(x([Fi().TIMER_TICK_0,Fi().SYSTEMS_UPDATE_TIME_0,Fi().ENTITIES_COUNT_0,Fi().SLOWEST_SYSTEM_0,Fi().FREEZING_SYSTEM_0,Fi().SCHEDULER_SYSTEM_0,Fi().DIRTY_LAYERS_0,Fi().STREAMING_FRAGMENTS_0,Fi().DOWNLOADING_FRAGMENTS_0,Fi().FRAGMENTS_CACHE_0,Fi().DOWNLOADING_TILES_0,Fi().IS_LOADING_0]));var a=new hp;a.color=k.Companion.DARK_GREEN,a.fontFamily="Courier New",a.fontSize=12,this.metrics_0=a;var s=new ap(new E(0,150),this.metrics_0);s.padding=4,s.background=k.Companion.WHITE;var l=s;r.addRenderable_pshs1s$(l)}function Si(t){this.$outer=t,this.timeToShowLeft_0=u,this.freezeTime_0=0,this.message_0="",this.timeToShow_0=7e3}function Ti(t){this.$outer=t}function Oi(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(mc)))||e.isType(n,mc)?n:C()))throw S("Component "+p(mc).simpleName+" is not found");return i.canvasLayer}function Ni(t){this.$outer=t}function Pi(t){this.$outer=t}function Ai(t){this.$outer=t}function ji(t){this.$outer=t}function Li(t){this.$outer=t}function Ri(t){this.$outer=t}function Ii(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(hy)))||e.isType(n,hy)?n:C()))throw S("Component "+p(hy).simpleName+" is not found");return null==i.tileData}function zi(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(km)))||e.isType(n,km)?n:C()))throw S("Component "+p(km).simpleName+" is not found");return null==i.imageData}function Di(t,e){this.$outer=t,this.isLoading_0=e}function Mi(){}function Bi(){Ui=this,this.TIMER_TICK_0="timer_tick",this.SYSTEMS_UPDATE_TIME_0="systems_update_time",this.ENTITIES_COUNT_0="entities_count",this.SLOWEST_SYSTEM_0="slow_system",this.FREEZING_SYSTEM_0="freezing_system",this.SCHEDULER_SYSTEM_0="scheduler_load",this.DIRTY_LAYERS_0="dirty_layers",this.STREAMING_FRAGMENTS_0="streaming_fragments",this.DOWNLOADING_FRAGMENTS_0="downloading_fragments",this.DOWNLOADING_TILES_0="downloading_tiles",this.FRAGMENTS_CACHE_0="fragments_cache",this.IS_LOADING_0="is_loading"}Ci.prototype=Object.create(Ei.prototype),Ci.prototype.constructor=Ci,Xi.prototype=Object.create(Ws.prototype),Xi.prototype.constructor=Xi,Hr.prototype=Object.create(mt.prototype),Hr.prototype.constructor=Hr,_o.prototype=Object.create(Bs.prototype),_o.prototype.constructor=_o,mo.prototype=Object.create(Bs.prototype),mo.prototype.constructor=mo,go.prototype=Object.create(Bs.prototype),go.prototype.constructor=go,Po.prototype=Object.create(Bs.prototype),Po.prototype.constructor=Po,Jo.prototype=Object.create(Bs.prototype),Jo.prototype.constructor=Jo,da.prototype=Object.create(me.prototype),da.prototype.constructor=da,xa.prototype=Object.create(me.prototype),xa.prototype.constructor=xa,Ga.prototype=Object.create(Te.prototype),Ga.prototype.constructor=Ga,Za.prototype=Object.create(Te.prototype),Za.prototype.constructor=Za,Xa.prototype=Object.create(Ae.prototype),Xa.prototype.constructor=Xa,es.prototype=Object.create(me.prototype),es.prototype.constructor=es,os.prototype=Object.create(me.prototype),os.prototype.constructor=os,ts.prototype=Object.create(Bs.prototype),ts.prototype.constructor=ts,ys.prototype=Object.create(me.prototype),ys.prototype.constructor=ys,ws.prototype=Object.create(me.prototype),ws.prototype.constructor=ws,qs.prototype=Object.create(Bs.prototype),qs.prototype.constructor=qs,Gs.prototype=Object.create(Bs.prototype),Gs.prototype.constructor=Gs,Zs.prototype=Object.create(tl.prototype),Zs.prototype.constructor=Zs,rl.prototype=Object.create(me.prototype),rl.prototype.constructor=rl,sl.prototype=Object.create(Bs.prototype),sl.prototype.constructor=sl,ml.prototype=Object.create(me.prototype),ml.prototype.constructor=ml,xl.prototype=Object.create(Bs.prototype),xl.prototype.constructor=xl,Tl.prototype=Object.create(Bs.prototype),Tl.prototype.constructor=Tl,Yl.prototype=Object.create(Bs.prototype),Yl.prototype.constructor=Yl,Ql.prototype=Object.create(Wl.prototype),Ql.prototype.constructor=Ql,tu.prototype=Object.create(Wl.prototype),tu.prototype.constructor=tu,ju.prototype=Object.create(me.prototype),ju.prototype.constructor=ju,ec.prototype=Object.create(me.prototype),ec.prototype.constructor=ec,ac.prototype=Object.create(me.prototype),ac.prototype.constructor=ac,Cc.prototype=Object.create(me.prototype),Cc.prototype.constructor=Cc,Yc.prototype=Object.create(Bs.prototype),Yc.prototype.constructor=Yc,Kc.prototype=Object.create(me.prototype),Kc.prototype.constructor=Kc,fp.prototype=Object.create(Bs.prototype),fp.prototype.constructor=fp,wp.prototype=Object.create(Bs.prototype),wp.prototype.constructor=wp,Sp.prototype=Object.create(Bs.prototype),Sp.prototype.constructor=Sp,Ap.prototype=Object.create(Bs.prototype),Ap.prototype.constructor=Ap,ah.prototype=Object.create(Bs.prototype),ah.prototype.constructor=ah,ch.prototype=Object.create(Bs.prototype),ch.prototype.constructor=ch,ph.prototype=Object.create(Bs.prototype),ph.prototype.constructor=ph,yh.prototype=Object.create(Bs.prototype),yh.prototype.constructor=yh,Sh.prototype=Object.create(Bs.prototype),Sh.prototype.constructor=Sh,Lh.prototype=Object.create(Bs.prototype),Lh.prototype.constructor=Lh,Hh.prototype=Object.create(me.prototype),Hh.prototype.constructor=Hh,t_.prototype=Object.create(Bs.prototype),t_.prototype.constructor=t_,r_.prototype=Object.create(Bs.prototype),r_.prototype.constructor=r_,l_.prototype=Object.create(Bs.prototype),l_.prototype.constructor=l_,I_.prototype=Object.create(Bs.prototype),I_.prototype.constructor=I_,D_.prototype=Object.create(Bs.prototype),D_.prototype.constructor=D_,G_.prototype=Object.create(Bs.prototype),G_.prototype.constructor=G_,W_.prototype=Object.create(Bs.prototype),W_.prototype.constructor=W_,X_.prototype=Object.create(Bs.prototype),X_.prototype.constructor=X_,gf.prototype=Object.create(Bs.prototype),gf.prototype.constructor=gf,Gf.prototype=Object.create(Bs.prototype),Gf.prototype.constructor=Gf,td.prototype=Object.create(Bs.prototype),td.prototype.constructor=td,nm.prototype=Object.create(Bs.prototype),nm.prototype.constructor=nm,rm.prototype=Object.create(Bs.prototype),rm.prototype.constructor=rm,dm.prototype=Object.create(Bs.prototype),dm.prototype.constructor=dm,Em.prototype=Object.create(Bs.prototype),Em.prototype.constructor=Em,Jm.prototype=Object.create(me.prototype),Jm.prototype.constructor=Jm,ny.prototype=Object.create(Bs.prototype),ny.prototype.constructor=ny,yy.prototype=Object.create(Bs.prototype),yy.prototype.constructor=yy,Ry.prototype=Object.create(Ly.prototype),Ry.prototype.constructor=Ry,Iy.prototype=Object.create(Ly.prototype),Iy.prototype.constructor=Iy,Ay.prototype=Object.create(Bs.prototype),Ay.prototype.constructor=Ay,qy.prototype=Object.create(Bs.prototype),qy.prototype.constructor=qy,Ei.prototype.update_s8cxhz$=function(t){},Object.defineProperty(Ci.prototype,"slowestSystemType_0",{configurable:!0,get:function(){var t;return e.getKClassFromExpression(s(null!=(t=this.debugService_0.slowestSystem())?t.first:null)).simpleName}}),Object.defineProperty(Ci.prototype,"slowestSystemTime_0",{configurable:!0,get:function(){var t,e;return null!=(e=null!=(t=this.debugService_0.slowestSystem())?t.second:null)?e:0}}),Ci.prototype.update_s8cxhz$=function(t){var e;for(this.deltaTime_0=t,this.debugService_0.setValue_puj7f4$(Fi().TIMER_TICK_0,"Timer tick: "+this.deltaTime_0.toString()),this.debugService_0.setValue_puj7f4$(Fi().SYSTEMS_UPDATE_TIME_0,"Systems update: "+this.formatDouble_0(this.debugService_0.totalUpdateTime,1)),this.debugService_0.setValue_puj7f4$(Fi().ENTITIES_COUNT_0,"Entities count: "+this.registry_0.entitiesCount),e=this.diagnostics_0.iterator();e.hasNext();)e.next().update();this.metrics_0.text=this.debugService_0.values},Si.prototype.update=function(){this.$outer.slowestSystemTime_0>16?this.$outer.slowestSystemTime_0>this.freezeTime_0&&(this.timeToShowLeft_0=e.Long.fromInt(this.timeToShow_0),this.message_0="Freezed by: "+this.$outer.formatDouble_0(this.$outer.slowestSystemTime_0,1)+" "+l(this.$outer.slowestSystemType_0),this.freezeTime_0=this.$outer.slowestSystemTime_0):this.timeToShowLeft_0.toNumber()>0?this.timeToShowLeft_0=this.timeToShowLeft_0.subtract(this.$outer.deltaTime_0):this.timeToShowLeft_0.toNumber()<0&&(this.message_0="",this.timeToShowLeft_0=u,this.freezeTime_0=0),this.$outer.debugService_0.setValue_puj7f4$(Fi().FREEZING_SYSTEM_0,this.message_0)},Si.$metadata$={kind:c,simpleName:"FreezingSystemDiagnostic",interfaces:[Mi]},Ti.prototype.update=function(){var t,n,i=_(h(this.$outer.registry_0.getEntitiesById_wlb8mv$(this.$outer.dirtyLayers_0),Oi)),r=this.$outer.registry_0.getSingletonEntity_9u06oy$(p(dc));if(null==(n=null==(t=r.componentManager.getComponents_ahlfl2$(r).get_11rb$(p(dc)))||e.isType(t,dc)?t:C()))throw S("Component "+p(dc).simpleName+" is not found");var o=m(f(i,n.canvasLayers),void 0,void 0,void 0,void 0,void 0,d("name",1,(function(t){return t.name})));this.$outer.debugService_0.setValue_puj7f4$(Fi().DIRTY_LAYERS_0,"Dirty layers: "+o)},Ti.$metadata$={kind:c,simpleName:"DirtyLayersDiagnostic",interfaces:[Mi]},Ni.prototype.update=function(){this.$outer.debugService_0.setValue_puj7f4$(Fi().SLOWEST_SYSTEM_0,"Slowest update: "+(this.$outer.slowestSystemTime_0>2?this.$outer.formatDouble_0(this.$outer.slowestSystemTime_0,1)+" "+l(this.$outer.slowestSystemType_0):"-"))},Ni.$metadata$={kind:c,simpleName:"SlowestSystemDiagnostic",interfaces:[Mi]},Pi.prototype.update=function(){var t=this.$outer.registry_0.count_9u06oy$(p(Gl));this.$outer.debugService_0.setValue_puj7f4$(Fi().SCHEDULER_SYSTEM_0,"Micro threads: "+t+", "+this.$outer.schedulerSystem_0.loading.toString())},Pi.$metadata$={kind:c,simpleName:"SchedulerSystemDiagnostic",interfaces:[Mi]},Ai.prototype.update=function(){var t,n,i,r,o=this.$outer.registry_0;t:do{if(o.containsEntity_9u06oy$(p(x_))){var a,s,l=o.getSingletonEntity_9u06oy$(p(x_));if(null==(s=null==(a=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(x_)))||e.isType(a,x_)?a:C()))throw S("Component "+p(x_).simpleName+" is not found");r=s;break t}r=null}while(0);var u=null!=(i=null!=(n=null!=(t=r)?t.keys():null)?n.size:null)?i:0;this.$outer.debugService_0.setValue_puj7f4$(Fi().FRAGMENTS_CACHE_0,"Fragments cache: "+u)},Ai.$metadata$={kind:c,simpleName:"FragmentsCacheDiagnostic",interfaces:[Mi]},ji.prototype.update=function(){var t,n,i,r,o=this.$outer.registry_0;t:do{if(o.containsEntity_9u06oy$(p(R_))){var a,s,l=o.getSingletonEntity_9u06oy$(p(R_));if(null==(s=null==(a=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(R_)))||e.isType(a,R_)?a:C()))throw S("Component "+p(R_).simpleName+" is not found");r=s;break t}r=null}while(0);var u=null!=(i=null!=(n=null!=(t=r)?t.keys():null)?n.size:null)?i:0;this.$outer.debugService_0.setValue_puj7f4$(Fi().STREAMING_FRAGMENTS_0,"Streaming fragments: "+u)},ji.$metadata$={kind:c,simpleName:"StreamingFragmentsDiagnostic",interfaces:[Mi]},Li.prototype.update=function(){var t,n,i,r,o=this.$outer.registry_0;t:do{if(o.containsEntity_9u06oy$(p(N_))){var a,s,l=o.getSingletonEntity_9u06oy$(p(N_));if(null==(s=null==(a=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(N_)))||e.isType(a,N_)?a:C()))throw S("Component "+p(N_).simpleName+" is not found");r=s;break t}r=null}while(0);if(null!=(t=r)){var u,c="D: "+t.downloading.size+" Q: ",h=t.queue.values,_=d("size",1,(function(t){return t.size})),f=0;for(u=h.iterator();u.hasNext();)f=f+_(u.next())|0;i=c+f}else i=null;var m=null!=(n=i)?n:"D: 0 Q: 0";this.$outer.debugService_0.setValue_puj7f4$(Fi().DOWNLOADING_FRAGMENTS_0,"Downloading fragments: "+m)},Li.$metadata$={kind:c,simpleName:"DownloadingFragmentsDiagnostic",interfaces:[Mi]},Ri.prototype.update=function(){var t=$(y(this.$outer.registry_0.getEntities_9u06oy$(p(hy)),Ii)),e=$(y(this.$outer.registry_0.getEntities_9u06oy$(p(km)),zi));this.$outer.debugService_0.setValue_puj7f4$(Fi().DOWNLOADING_TILES_0,"Downloading tiles: V: "+t+", R: "+e)},Ri.$metadata$={kind:c,simpleName:"DownloadingTilesDiagnostic",interfaces:[Mi]},Di.prototype.update=function(){this.$outer.debugService_0.setValue_puj7f4$(Fi().IS_LOADING_0,"Is loading: "+this.isLoading_0.get())},Di.$metadata$={kind:c,simpleName:"IsLoadingDiagnostic",interfaces:[Mi]},Mi.$metadata$={kind:v,simpleName:"Diagnostic",interfaces:[]},Ci.prototype.formatDouble_0=function(t,e){var n=g(t),i=g(10*(t-n)*e);return n.toString()+"."+i},Bi.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Ui=null;function Fi(){return null===Ui&&new Bi,Ui}function qi(t,e,n,i,r,o,a,s,l,u,c,p,h){this.myMapRuler_0=t,this.myMapProjection_0=e,this.viewport_0=n,this.layers_0=i,this.myTileSystemProvider_0=r,this.myFragmentProvider_0=o,this.myDevParams_0=a,this.myMapLocationConsumer_0=s,this.myGeocodingService_0=l,this.myMapLocationRect_0=u,this.myZoom_0=c,this.myAttribution_0=p,this.myCursorService_0=h,this.myRenderTarget_0=this.myDevParams_0.read_m9w1rv$(Da().RENDER_TARGET),this.myTimerReg_0=D.Companion.EMPTY,this.myInitialized_0=!1,this.myEcsController_wurexj$_0=this.myEcsController_wurexj$_0,this.myContext_l6buwl$_0=this.myContext_l6buwl$_0,this.myLayerRenderingSystem_rw6iwg$_0=this.myLayerRenderingSystem_rw6iwg$_0,this.myLayerManager_n334qq$_0=this.myLayerManager_n334qq$_0,this.myDiagnostics_hj908e$_0=this.myDiagnostics_hj908e$_0,this.mySchedulerSystem_xjqp68$_0=this.mySchedulerSystem_xjqp68$_0,this.myUiService_gvbha1$_0=this.myUiService_gvbha1$_0,this.errorEvent_0=new M,this.isLoading=new B(!0),this.myComponentManager_0=new Vs}function Gi(t){this.closure$handler=t}function Hi(t,e){return function(n){return t.schedule_klfg04$(function(t,e){return function(){return t.errorEvent_0.fire_11rb$(e),N}}(e,n)),N}}function Yi(t,e,n){this.timePredicate_0=t,this.skipTime_0=e,this.animationMultiplier_0=n,this.deltaTime_0=new z,this.currentTime_0=u}function Vi(){Ki=this,this.MIN_ZOOM=1,this.MAX_ZOOM=15,this.DEFAULT_LOCATION=new F(-124.76,25.52,-66.94,49.39),this.TILE_PIXEL_SIZE=256}Ci.$metadata$={kind:c,simpleName:"LiveMapDiagnostics",interfaces:[Ei]},Ei.$metadata$={kind:c,simpleName:"Diagnostics",interfaces:[]},Object.defineProperty(qi.prototype,"myEcsController_0",{configurable:!0,get:function(){return null==this.myEcsController_wurexj$_0?T("myEcsController"):this.myEcsController_wurexj$_0},set:function(t){this.myEcsController_wurexj$_0=t}}),Object.defineProperty(qi.prototype,"myContext_0",{configurable:!0,get:function(){return null==this.myContext_l6buwl$_0?T("myContext"):this.myContext_l6buwl$_0},set:function(t){this.myContext_l6buwl$_0=t}}),Object.defineProperty(qi.prototype,"myLayerRenderingSystem_0",{configurable:!0,get:function(){return null==this.myLayerRenderingSystem_rw6iwg$_0?T("myLayerRenderingSystem"):this.myLayerRenderingSystem_rw6iwg$_0},set:function(t){this.myLayerRenderingSystem_rw6iwg$_0=t}}),Object.defineProperty(qi.prototype,"myLayerManager_0",{configurable:!0,get:function(){return null==this.myLayerManager_n334qq$_0?T("myLayerManager"):this.myLayerManager_n334qq$_0},set:function(t){this.myLayerManager_n334qq$_0=t}}),Object.defineProperty(qi.prototype,"myDiagnostics_0",{configurable:!0,get:function(){return null==this.myDiagnostics_hj908e$_0?T("myDiagnostics"):this.myDiagnostics_hj908e$_0},set:function(t){this.myDiagnostics_hj908e$_0=t}}),Object.defineProperty(qi.prototype,"mySchedulerSystem_0",{configurable:!0,get:function(){return null==this.mySchedulerSystem_xjqp68$_0?T("mySchedulerSystem"):this.mySchedulerSystem_xjqp68$_0},set:function(t){this.mySchedulerSystem_xjqp68$_0=t}}),Object.defineProperty(qi.prototype,"myUiService_0",{configurable:!0,get:function(){return null==this.myUiService_gvbha1$_0?T("myUiService"):this.myUiService_gvbha1$_0},set:function(t){this.myUiService_gvbha1$_0=t}}),Gi.prototype.onEvent_11rb$=function(t){this.closure$handler(t)},Gi.$metadata$={kind:c,interfaces:[O]},qi.prototype.addErrorHandler_4m4org$=function(t){return this.errorEvent_0.addHandler_gxwwpc$(new Gi(t))},qi.prototype.draw_49gm0j$=function(t){var n=new ho(this.myComponentManager_0);n.requestZoom_14dthe$(this.viewport_0.zoom),n.requestPosition_c01uj8$(this.viewport_0.position);var i=n;this.myContext_0=new Xi(this.myMapProjection_0,t,new cr(this.viewport_0,t),Hi(t,this),i),this.myUiService_0=new Hy(this.myComponentManager_0,new By(this.myContext_0.mapRenderContext.canvasProvider)),this.myLayerManager_0=Hc().createLayerManager_ju5hjs$(this.myComponentManager_0,this.myRenderTarget_0,t);var r,o=new Yi((r=this,function(t){return r.animationHandler_0(r.myComponentManager_0,t)}),e.Long.fromInt(this.myDevParams_0.read_zgynif$(Da().UPDATE_PAUSE_MS)),this.myDevParams_0.read_366xgz$(Da().UPDATE_TIME_MULTIPLIER));this.myTimerReg_0=j.CanvasControlUtil.setAnimationHandler_1ixrg0$(t,P.Companion.toHandler_qm21m0$(A("onTime",function(t,e){return t.onTime_8e33dg$(e)}.bind(null,o))))},qi.prototype.searchResult=function(){if(!this.myInitialized_0)return null;var t,n,i=this.myComponentManager_0.getSingletonEntity_9u06oy$(p(Qf));if(null==(n=null==(t=i.componentManager.getComponents_ahlfl2$(i).get_11rb$(p(Qf)))||e.isType(t,Qf)?t:C()))throw S("Component "+p(Qf).simpleName+" is not found");return n.searchResult},qi.prototype.animationHandler_0=function(t,e){return this.myInitialized_0||(this.init_0(t),this.myInitialized_0=!0),this.myEcsController_0.update_14dthe$(e.toNumber()),this.myDiagnostics_0.update_s8cxhz$(e),!this.myLayerRenderingSystem_0.dirtyLayers.isEmpty()},qi.prototype.init_0=function(t){var e;this.initLayers_0(t),this.initSystems_0(t),this.initCamera_0(t),e=this.myDevParams_0.isSet_1a54na$(Da().PERF_STATS)?new Ci(this.isLoading,this.myLayerRenderingSystem_0.dirtyLayers,this.mySchedulerSystem_0,this.myContext_0.metricsService,this.myUiService_0,t):new Ei,this.myDiagnostics_0=e},qi.prototype.initSystems_0=function(t){var n,i;switch(this.myDevParams_0.read_m9w1rv$(Da().MICRO_TASK_EXECUTOR).name){case"UI_THREAD":n=new Ll(this.myContext_0,e.Long.fromInt(this.myDevParams_0.read_zgynif$(Da().COMPUTATION_FRAME_TIME)));break;case"AUTO":case"BACKGROUND":n=Xy().create();break;default:n=e.noWhenBranchMatched()}var r=null!=n?n:new Ll(this.myContext_0,e.Long.fromInt(this.myDevParams_0.read_zgynif$(Da().COMPUTATION_FRAME_TIME)));this.myLayerRenderingSystem_0=this.myLayerManager_0.createLayerRenderingSystem(),this.mySchedulerSystem_0=new Yl(r,t),this.myEcsController_0=new Xs(t,this.myContext_0,x([new Tl(t),new xl(t),new _o(t),new go(t),new sl(t,this.myCursorService_0),new Lh(t,this.myMapProjection_0,this.viewport_0),new Ap(t,this.myGeocodingService_0),new Sp(t,this.myGeocodingService_0),new ch(t,null==this.myMapLocationRect_0),new ph(t,this.myGeocodingService_0),new ah(this.myMapRuler_0,t),new yh(t,null!=(i=this.myZoom_0)?i:null,this.myMapLocationRect_0),new wp(t),new Gf(t),new qs(t),new Gs(t),new Po(t),new Ay(this.myUiService_0,t,this.myMapLocationConsumer_0,this.myLayerManager_0,this.myAttribution_0),new Jo(t),new rm(t),this.myTileSystemProvider_0.create_v8qzyl$(t),new nm(this.myDevParams_0.read_zgynif$(Da().TILE_CACHE_LIMIT),t),new yy(t),new G_(t),new I_(this.myDevParams_0.read_zgynif$(Da().FRAGMENT_ACTIVE_DOWNLOADS_LIMIT),this.myFragmentProvider_0,t),new D_(this.myDevParams_0.read_zgynif$(Da().COMPUTATION_PROJECTION_QUANT),t),new X_(t),new W_(this.myDevParams_0.read_zgynif$(Da().FRAGMENT_CACHE_LIMIT),t),new r_(t),new l_(t),new Sh(this.myDevParams_0.read_zgynif$(Da().COMPUTATION_PROJECTION_QUANT),t),new t_(t),new td(t),new gf(t),new ts(t,this.myUiService_0),new qy(t),this.myLayerRenderingSystem_0,this.mySchedulerSystem_0,new fp(t),new mo(t)]))},qi.prototype.initCamera_0=function(t){var n,i,r=new fl,o=Qs(t.getSingletonEntity_9u06oy$(p(ko)),(n=this,i=r,function(t){t.unaryPlus_jixjl7$(new wl);var e=new up,r=n;return e.rect=d_(f_().ZERO_CLIENT_POINT,r.viewport_0.size),t.unaryPlus_jixjl7$(new nl(e)),t.unaryPlus_jixjl7$(i),N}));r.addDoubleClickListener_abz6et$(function(t,n){return function(i){var r=t.contains_9u06oy$(p(yo));if(!r){var o,a,s=t;if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(ko)))||e.isType(o,ko)?o:C()))throw S("Component "+p(ko).simpleName+" is not found");r=a.zoom===n.viewport_0.maxZoom}if(!r){var l=m_(i.location),u=n.viewport_0.getMapCoord_5wcbfv$(R(L(l,n.viewport_0.center),2));return vo().setAnimation_egeizv$(t,l,u,1),N}}}(o,this))},qi.prototype.initLayers_0=function(t){var e;Qs(t.createEntity_61zpoe$("layers_order"),(e=this,function(t){return t.unaryPlus_jixjl7$(e.myLayerManager_0.createLayersOrderComponent()),N})),this.myTileSystemProvider_0.isVector?Qs(t.createEntity_61zpoe$("vector_layer_ground"),function(t){return function(e){return e.unaryPlus_jixjl7$(new _a(ya())),e.unaryPlus_jixjl7$(new lf),e.unaryPlus_jixjl7$(t.myLayerManager_0.addLayer_kqh14j$("ground",Tc())),N}}(this)):Qs(t.createEntity_61zpoe$("raster_layer_ground"),function(t){return function(e){return e.unaryPlus_jixjl7$(new _a(ga())),e.unaryPlus_jixjl7$(new fm),e.unaryPlus_jixjl7$(new lf),e.unaryPlus_jixjl7$(t.myLayerManager_0.addLayer_kqh14j$("http_ground",Tc())),N}}(this));var n,i=new dr(t,this.myLayerManager_0,this.myMapProjection_0,this.myMapRuler_0,this.myDevParams_0.isSet_1a54na$(Da().POINT_SCALING),new pc(this.myContext_0.mapRenderContext.canvasProvider.createCanvas_119tl4$(I.Companion.ZERO).context2d));for(n=this.layers_0.iterator();n.hasNext();)n.next()(i);this.myTileSystemProvider_0.isVector&&Qs(t.createEntity_61zpoe$("vector_layer_labels"),function(t){return function(e){return e.unaryPlus_jixjl7$(new _a($a())),e.unaryPlus_jixjl7$(new lf),e.unaryPlus_jixjl7$(t.myLayerManager_0.addLayer_kqh14j$("labels",Nc())),N}}(this)),this.myDevParams_0.isSet_1a54na$(Da().DEBUG_GRID)&&Qs(t.createEntity_61zpoe$("cell_layer_debug"),function(t){return function(e){return e.unaryPlus_jixjl7$(new _a(va())),e.unaryPlus_jixjl7$(new fa),e.unaryPlus_jixjl7$(new lf),e.unaryPlus_jixjl7$(t.myLayerManager_0.addLayer_kqh14j$("debug",Nc())),N}}(this)),Qs(t.createEntity_61zpoe$("layer_ui"),function(t){return function(e){return e.unaryPlus_jixjl7$(new Gy),e.unaryPlus_jixjl7$(t.myLayerManager_0.addLayer_kqh14j$("ui",Pc())),N}}(this))},qi.prototype.dispose=function(){this.myTimerReg_0.dispose(),this.myEcsController_0.dispose()},Yi.prototype.onTime_8e33dg$=function(t){var n=this.deltaTime_0.tick_s8cxhz$(t);return this.currentTime_0=this.currentTime_0.add(n),this.currentTime_0.compareTo_11rb$(this.skipTime_0)>0&&(this.currentTime_0=u,this.timePredicate_0(e.Long.fromNumber(n.toNumber()*this.animationMultiplier_0)))},Yi.$metadata$={kind:c,simpleName:"UpdateController",interfaces:[]},qi.$metadata$={kind:c,simpleName:"LiveMap",interfaces:[U]},Vi.$metadata$={kind:b,simpleName:"LiveMapConstants",interfaces:[]};var Ki=null;function Wi(){return null===Ki&&new Vi,Ki}function Xi(t,e,n,i,r){Ws.call(this,e),this.mapProjection_mgrs6g$_0=t,this.mapRenderContext_uxh8yk$_0=n,this.errorHandler_6fxwnz$_0=i,this.camera_b2oksc$_0=r}function Zi(t,e){tr(),this.myViewport_0=t,this.myMapProjection_0=e}function Ji(){Qi=this}Object.defineProperty(Xi.prototype,"mapProjection",{get:function(){return this.mapProjection_mgrs6g$_0}}),Object.defineProperty(Xi.prototype,"mapRenderContext",{get:function(){return this.mapRenderContext_uxh8yk$_0}}),Object.defineProperty(Xi.prototype,"camera",{get:function(){return this.camera_b2oksc$_0}}),Xi.prototype.raiseError_tcv7n7$=function(t){this.errorHandler_6fxwnz$_0(t)},Xi.$metadata$={kind:c,simpleName:"LiveMapContext",interfaces:[Ws]},Object.defineProperty(Zi.prototype,"viewLonLatRect",{configurable:!0,get:function(){var t=this.myViewport_0.window,e=this.worldToLonLat_0(t.origin),n=this.worldToLonLat_0(L(t.origin,t.dimension));return q(e.x,n.y,n.x-e.x,e.y-n.y)}}),Zi.prototype.worldToLonLat_0=function(t){var e,n,i,r=this.myMapProjection_0.mapRect.dimension;return t.x>r.x?(n=H(G.FULL_LONGITUDE,0),e=K(t,(i=r,function(t){return V(t,Y(i))}))):t.x<0?(n=H(-G.FULL_LONGITUDE,0),e=K(r,function(t){return function(e){return W(e,Y(t))}}(r))):(n=H(0,0),e=t),L(n,this.myMapProjection_0.invert_11rc$(e))},Ji.prototype.getLocationString_wthzt5$=function(t){var e=t.dimension.mul_14dthe$(.05);return"location = ["+l(this.round_0(t.left+e.x,6))+", "+l(this.round_0(t.top+e.y,6))+", "+l(this.round_0(t.right-e.x,6))+", "+l(this.round_0(t.bottom-e.y,6))+"]"},Ji.prototype.round_0=function(t,e){var n=Z.pow(10,e);return X(t*n)/n},Ji.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Qi=null;function tr(){return null===Qi&&new Ji,Qi}function er(){ur()}function nr(){lr=this}function ir(t){this.closure$geoRectangle=t}function rr(t){this.closure$mapRegion=t}Zi.$metadata$={kind:c,simpleName:"LiveMapLocation",interfaces:[]},ir.prototype.getBBox_p5tkbv$=function(t){return J.Asyncs.constant_mh5how$(t.calculateBBoxOfGeoRect_emtjl$(this.closure$geoRectangle))},ir.$metadata$={kind:c,interfaces:[er]},nr.prototype.create_emtjl$=function(t){return new ir(t)},rr.prototype.getBBox_p5tkbv$=function(t){return t.geocodeMapRegion_4x05nu$(this.closure$mapRegion)},rr.$metadata$={kind:c,interfaces:[er]},nr.prototype.create_4x05nu$=function(t){return new rr(t)},nr.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var or,ar,sr,lr=null;function ur(){return null===lr&&new nr,lr}function cr(t,e){this.viewport_j7tkex$_0=t,this.canvasProvider=e}function pr(t){this.barsFactory=new hr(t)}function hr(t){this.myFactory_0=t,this.myItems_0=w()}function _r(t,e,n){return function(i,r,o,a){var l;if(null==n.point)throw S("Can't create bar entity. Coord is null.".toString());return l=so(e.myFactory_0,"map_ent_s_bar",s(n.point)),t.add_11rb$(uo(l,function(t,e,n,i,r){return function(o,a){var s;null!=(s=t.layerIndex)&&o.unaryPlus_jixjl7$(new Xf(s,e)),o.unaryPlus_jixjl7$(new sf(new jf)),o.unaryPlus_jixjl7$(new qh(a)),o.unaryPlus_jixjl7$(new Gh),o.unaryPlus_jixjl7$(new Jh);var l=new Qh;l.offset=n,o.unaryPlus_jixjl7$(l);var u=new Zh;u.dimension=i,o.unaryPlus_jixjl7$(u);var c=new hf,p=t;return ff(c,r),df(c,p.strokeColor),mf(c,p.strokeWidth),o.unaryPlus_jixjl7$(c),o.unaryPlus_jixjl7$(new Zf(new Wf)),N}}(n,i,r,o,a))),N}}function fr(t,e,n){var i,r=t.values,o=rt(it(r,10));for(i=r.iterator();i.hasNext();){var a,s=i.next(),l=o.add_11rb$,u=0===e?0:s/e;a=Z.abs(u)>=or?u:Z.sign(u)*or,l.call(o,a)}var c,p,h=o,_=2*t.radius/t.values.size,f=0;for(c=h.iterator();c.hasNext();){var d=c.next(),m=ot((f=(p=f)+1|0,p)),y=H(_,t.radius*Z.abs(d)),$=H(_*m-t.radius,d>0?-y.y:0);n(t.indices.get_za3lpa$(m),$,y,t.colors.get_za3lpa$(m))}}function dr(t,e,n,i,r,o){this.myComponentManager=t,this.layerManager=e,this.mapProjection=n,this.mapRuler=i,this.pointScaling=r,this.textMeasurer=o}function mr(){this.layerIndex=null,this.point=null,this.radius=0,this.strokeColor=k.Companion.BLACK,this.strokeWidth=0,this.indices=at(),this.values=at(),this.colors=at()}function yr(t,e,n){var i,r,o=rt(it(t,10));for(r=t.iterator();r.hasNext();){var a=r.next();o.add_11rb$($r(a))}var s=o;if(e)i=lt(s);else{var l,u=vr(n?_u(s):s),c=rt(it(u,10));for(l=u.iterator();l.hasNext();){var p=l.next();c.add_11rb$(new pt(ct(new ut(p))))}i=new ht(c)}return i}function $r(t){return H(_t(t.x),ft(t.y))}function vr(t){var e,n=w(),i=w();if(!t.isEmpty()){i.add_11rb$(t.get_za3lpa$(0)),e=t.size;for(var r=1;rar-l){var u=o.x<0?-1:1,c=o.x-u*sr,p=a.x+u*sr,h=(a.y-o.y)*(p===c?.5:c/(c-p))+o.y;i.add_11rb$(H(u*sr,h)),n.add_11rb$(i),(i=w()).add_11rb$(H(-u*sr,h))}i.add_11rb$(a)}}return n.add_11rb$(i),n}function gr(){this.url_6i03cv$_0=this.url_6i03cv$_0,this.theme=yt.COLOR}function br(){this.url_u3glsy$_0=this.url_u3glsy$_0}function wr(t,e,n){return Qs(t.createEntity_61zpoe$(n),(i=e,function(t){return t.unaryPlus_jixjl7$(i),t.unaryPlus_jixjl7$(new xo),t.unaryPlus_jixjl7$(new wo),t.unaryPlus_jixjl7$(new bo),N}));var i}function xr(t){var n,i;if(this.myComponentManager_0=t.componentManager,this.myParentLayerComponent_0=new yc(t.id_8be2vx$),null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(lf)))||e.isType(n,lf)?n:C()))throw S("Component "+p(lf).simpleName+" is not found");this.myLayerEntityComponent_0=i}function kr(t){var e=new gr;return t(e),e.build()}function Er(t){var e=new br;return t(e),e.build()}function Cr(t,e,n){this.factory=t,this.mapProjection=e,this.horizontal=n}function Sr(t,e,n){var i;n(new Cr(new xr(Qs(t.myComponentManager.createEntity_61zpoe$("map_layer_line"),(i=t,function(t){return t.unaryPlus_jixjl7$(i.layerManager.addLayer_kqh14j$("geom_line",Oc())),t.unaryPlus_jixjl7$(new lf),N}))),t.mapProjection,e))}function Tr(t,e){this.myFactory_0=t,this.myMapProjection_0=e,this.point=null,this.lineDash=at(),this.strokeColor=k.Companion.BLACK,this.strokeWidth=1}function Or(t,e){this.factory=t,this.mapProjection=e}function Nr(t,e){this.myFactory_0=t,this.myMapProjection_0=e,this.layerIndex=null,this.index=null,this.regionId="",this.lineDash=at(),this.strokeColor=k.Companion.BLACK,this.strokeWidth=1,this.multiPolygon_cwupzr$_0=this.multiPolygon_cwupzr$_0,this.animation=0,this.speed=0,this.flow=0}function Pr(t){return t.duration=5e3,t.easingFunction=zs().LINEAR,t.direction=vs(),t.loop=Cs(),N}function Ar(t,e,n){t.multiPolygon=yr(e,!1,n)}function jr(t){this.piesFactory=new Lr(t)}function Lr(t){this.myFactory_0=t,this.myItems_0=w()}function Rr(t,e,n,i){return function(r,o){null!=t.layerIndex&&r.unaryPlus_jixjl7$(new Xf(s(t.layerIndex),t.indices.get_za3lpa$(e))),r.unaryPlus_jixjl7$(new sf(new Rf)),r.unaryPlus_jixjl7$(new qh(o));var a=new pf,l=t,u=n,c=i;a.radius=l.radius,a.startAngle=u,a.endAngle=c,r.unaryPlus_jixjl7$(a);var p=new hf,h=t;return ff(p,h.colors.get_za3lpa$(e)),df(p,h.strokeColor),mf(p,h.strokeWidth),r.unaryPlus_jixjl7$(p),r.unaryPlus_jixjl7$(new Zh),r.unaryPlus_jixjl7$(new Gh),r.unaryPlus_jixjl7$(new Jh),r.unaryPlus_jixjl7$(new Zf(new cd)),N}}function Ir(t,e,n,i){this.factory=t,this.mapProjection=e,this.pointScaling=n,this.animationBuilder=i}function zr(t){this.myFactory_0=t,this.layerIndex=null,this.index=null,this.point=null,this.radius=4,this.fillColor=k.Companion.WHITE,this.strokeColor=k.Companion.BLACK,this.strokeWidth=1,this.animation=0,this.label="",this.shape=1}function Dr(t,e,n,i,r,o){return function(a,l){var u;null!=t.layerIndex&&null!=t.index&&a.unaryPlus_jixjl7$(new Xf(s(t.layerIndex),s(t.index)));var c=new uf;if(c.shape=t.shape,a.unaryPlus_jixjl7$(c),a.unaryPlus_jixjl7$(t.createStyle_0()),e)u=new Fh(H(n,n));else{var p=new Zh,h=n;p.dimension=H(h,h),u=p}if(a.unaryPlus_jixjl7$(u),a.unaryPlus_jixjl7$(new qh(l)),a.unaryPlus_jixjl7$(new sf(new Of)),a.unaryPlus_jixjl7$(new Gh),a.unaryPlus_jixjl7$(new Jh),i||a.unaryPlus_jixjl7$(new Zf(new fd)),2===t.animation){var _=new hc,f=new Ts(0,1,function(t,e){return function(n){return t.scale=n,kc().tagDirtyParentLayer_ahlfl2$(e),N}}(_,r));o.addAnimator_i7e8zu$(f),a.unaryPlus_jixjl7$(_)}return N}}function Mr(t,e,n){this.factory=t,this.mapProjection=e,this.mapRuler=n}function Br(t,e,n){this.myFactory_0=t,this.myMapProjection_0=e,this.myMapRuler_0=n,this.layerIndex=null,this.index=null,this.lineDash=at(),this.strokeColor=k.Companion.BLACK,this.strokeWidth=0,this.fillColor=k.Companion.GREEN,this.multiPolygon=null}function Ur(){Zr=this}function Fr(){}function qr(){}function Gr(){}function Hr(t,e){mt.call(this,t,e)}function Yr(t){return t.url="http://10.0.0.127:3020/map_data/geocoding",N}function Vr(t){return t.url="https://geo2.datalore.jetbrains.com",N}function Kr(t){return t.url="ws://10.0.0.127:3933",N}function Wr(t){return t.url="wss://tiles.datalore.jetbrains.com",N}er.$metadata$={kind:v,simpleName:"MapLocation",interfaces:[]},Object.defineProperty(cr.prototype,"viewport",{get:function(){return this.viewport_j7tkex$_0}}),cr.prototype.draw_5xkfq8$=function(t,e,n){this.draw_4xlq28$_0(t,e.x,e.y,n)},cr.prototype.draw_28t4fw$=function(t,e,n){this.draw_4xlq28$_0(t,e.x,e.y,n)},cr.prototype.draw_4xlq28$_0=function(t,e,n,i){t.save(),t.translate_lu1900$(e,n),i.render_pzzegf$(t),t.restore()},cr.$metadata$={kind:c,simpleName:"MapRenderContext",interfaces:[]},pr.$metadata$={kind:c,simpleName:"Bars",interfaces:[]},hr.prototype.add_ltb8x$=function(t){this.myItems_0.add_11rb$(t)},hr.prototype.produce=function(){var t;if(null==(t=nt(h(et(tt(Q(this.myItems_0),d("values",1,(function(t){return t.values}),(function(t,e){t.values=e})))),A("abs",(function(t){return Z.abs(t)}))))))throw S("Failed to calculate maxAbsValue.".toString());var e,n=t,i=w();for(e=this.myItems_0.iterator();e.hasNext();){var r=e.next();fr(r,n,_r(i,this,r))}return i},hr.$metadata$={kind:c,simpleName:"BarsFactory",interfaces:[]},dr.$metadata$={kind:c,simpleName:"LayersBuilder",interfaces:[]},mr.$metadata$={kind:c,simpleName:"ChartSource",interfaces:[]},Object.defineProperty(gr.prototype,"url",{configurable:!0,get:function(){return null==this.url_6i03cv$_0?T("url"):this.url_6i03cv$_0},set:function(t){this.url_6i03cv$_0=t}}),gr.prototype.build=function(){return new mt(new dt(this.url),this.theme)},gr.$metadata$={kind:c,simpleName:"LiveMapTileServiceBuilder",interfaces:[]},Object.defineProperty(br.prototype,"url",{configurable:!0,get:function(){return null==this.url_u3glsy$_0?T("url"):this.url_u3glsy$_0},set:function(t){this.url_u3glsy$_0=t}}),br.prototype.build=function(){return new vt(new $t(this.url))},br.$metadata$={kind:c,simpleName:"LiveMapGeocodingServiceBuilder",interfaces:[]},xr.prototype.createMapEntity_61zpoe$=function(t){var e=wr(this.myComponentManager_0,this.myParentLayerComponent_0,t);return this.myLayerEntityComponent_0.add_za3lpa$(e.id_8be2vx$),e},xr.$metadata$={kind:c,simpleName:"MapEntityFactory",interfaces:[]},Cr.$metadata$={kind:c,simpleName:"Lines",interfaces:[]},Tr.prototype.build_6taknv$=function(t){if(null==this.point)throw S("Can't create line entity. Coord is null.".toString());var e,n,i=uo(lo(this.myFactory_0,"map_ent_s_line",s(this.point)),(e=t,n=this,function(t,i){var r=ro(i,e,n.myMapProjection_0.mapRect),o=oo(i,n.strokeWidth,e,n.myMapProjection_0.mapRect);t.unaryPlus_jixjl7$(new sf(new Pf)),t.unaryPlus_jixjl7$(new qh(o.origin));var a=new Ah;a.geometry=r,t.unaryPlus_jixjl7$(a),t.unaryPlus_jixjl7$(new Fh(o.dimension)),t.unaryPlus_jixjl7$(new Gh),t.unaryPlus_jixjl7$(new Jh);var s=new hf,l=n;return df(s,l.strokeColor),mf(s,l.strokeWidth),_f(s,l.lineDash),t.unaryPlus_jixjl7$(s),N}));return i.removeComponent_9u06oy$(p(Fp)),i.removeComponent_9u06oy$(p(Wp)),i.removeComponent_9u06oy$(p(Hp)),i},Tr.$metadata$={kind:c,simpleName:"LineBuilder",interfaces:[]},Or.$metadata$={kind:c,simpleName:"Paths",interfaces:[]},Object.defineProperty(Nr.prototype,"multiPolygon",{configurable:!0,get:function(){return null==this.multiPolygon_cwupzr$_0?T("multiPolygon"):this.multiPolygon_cwupzr$_0},set:function(t){this.multiPolygon_cwupzr$_0=t}}),Nr.prototype.build_6taknv$=function(t){var e;void 0===t&&(t=!1);var n,i,r,o,a,l=Qu().transformMultiPolygon_c0yqik$(this.multiPolygon,A("project",function(t,e){return t.project_11rb$(e)}.bind(null,this.myMapProjection_0)));if(null!=(e=gt.GeometryUtil.bbox_8ft4gs$(l))){var u=Qs(this.myFactory_0.createMapEntity_61zpoe$("map_ent_path"),(i=this,r=e,o=l,a=t,function(t){null!=i.layerIndex&&null!=i.index&&t.unaryPlus_jixjl7$(new Xf(s(i.layerIndex),s(i.index))),t.unaryPlus_jixjl7$(new sf(new Pf)),t.unaryPlus_jixjl7$(new qh(r.origin));var e=new Ah;e.geometry=o,t.unaryPlus_jixjl7$(e),t.unaryPlus_jixjl7$(new Fh(r.dimension)),t.unaryPlus_jixjl7$(new Gh),t.unaryPlus_jixjl7$(new Jh);var n=new hf,l=i;return df(n,l.strokeColor),n.strokeWidth=l.strokeWidth,n.lineDash=bt(l.lineDash),t.unaryPlus_jixjl7$(n),t.unaryPlus_jixjl7$(Gp()),t.unaryPlus_jixjl7$(Zp()),a||t.unaryPlus_jixjl7$(new Zf(new ad)),N}));if(2===this.animation){var c=this.addAnimationComponent_0(u.componentManager.createEntity_61zpoe$("map_ent_path_animation"),Pr);this.addGrowingPathEffectComponent_0(u.setComponent_qqqpmc$(new sf(new vp)),(n=c,function(t){return t.animationId=n.id_8be2vx$,N}))}return u}return null},Nr.prototype.addAnimationComponent_0=function(t,e){var n=new Us;return e(n),t.add_57nep2$(n)},Nr.prototype.addGrowingPathEffectComponent_0=function(t,e){var n=new $p;return e(n),t.add_57nep2$(n)},Nr.$metadata$={kind:c,simpleName:"PathBuilder",interfaces:[]},jr.$metadata$={kind:c,simpleName:"Pies",interfaces:[]},Lr.prototype.add_ltb8x$=function(t){this.myItems_0.add_11rb$(t)},Lr.prototype.produce=function(){var t,e=this.myItems_0,n=w();for(t=e.iterator();t.hasNext();){var i=t.next(),r=this.splitMapPieChart_0(i);xt(n,r)}return n},Lr.prototype.splitMapPieChart_0=function(t){for(var e=w(),n=to(t.values),i=-wt.PI/2,r=0;r!==n.size;++r){var o,a=i,l=i+n.get_za3lpa$(r);if(null==t.point)throw S("Can't create pieSector entity. Coord is null.".toString());o=so(this.myFactory_0,"map_ent_s_pie_sector",s(t.point)),e.add_11rb$(uo(o,Rr(t,r,a,l))),i=l}return e},Lr.$metadata$={kind:c,simpleName:"PiesFactory",interfaces:[]},Ir.$metadata$={kind:c,simpleName:"Points",interfaces:[]},zr.prototype.build_h0uvfn$=function(t,e,n){var i;void 0===n&&(n=!1);var r=2*this.radius;if(null==this.point)throw S("Can't create point entity. Coord is null.".toString());return uo(i=so(this.myFactory_0,"map_ent_s_point",s(this.point)),Dr(this,t,r,n,i,e))},zr.prototype.createStyle_0=function(){var t,e;if((t=this.shape)>=1&&t<=14){var n=new hf;df(n,this.strokeColor),n.strokeWidth=this.strokeWidth,e=n}else if(t>=15&&t<=18||20===t){var i=new hf;ff(i,this.strokeColor),i.strokeWidth=kt.NaN,e=i}else if(19===t){var r=new hf;ff(r,this.strokeColor),df(r,this.strokeColor),r.strokeWidth=this.strokeWidth,e=r}else{if(!(t>=21&&t<=25))throw S(("Not supported shape: "+this.shape).toString());var o=new hf;ff(o,this.fillColor),df(o,this.strokeColor),o.strokeWidth=this.strokeWidth,e=o}return e},zr.$metadata$={kind:c,simpleName:"PointBuilder",interfaces:[]},Mr.$metadata$={kind:c,simpleName:"Polygons",interfaces:[]},Br.prototype.build=function(){return null!=this.multiPolygon?this.createStaticEntity_0():null},Br.prototype.createStaticEntity_0=function(){var t,e=s(this.multiPolygon),n=Qu().transformMultiPolygon_c0yqik$(e,A("project",function(t,e){return t.project_11rb$(e)}.bind(null,this.myMapProjection_0)));if(null==(t=gt.GeometryUtil.bbox_8ft4gs$(n)))throw S("Polygon bbox can't be null".toString());var i,r,o,a=t;return Qs(this.myFactory_0.createMapEntity_61zpoe$("map_ent_s_polygon"),(i=this,r=a,o=n,function(t){null!=i.layerIndex&&null!=i.index&&t.unaryPlus_jixjl7$(new Xf(s(i.layerIndex),s(i.index))),t.unaryPlus_jixjl7$(new sf(new Nf)),t.unaryPlus_jixjl7$(new qh(r.origin));var e=new Ah;e.geometry=o,t.unaryPlus_jixjl7$(e),t.unaryPlus_jixjl7$(new Fh(r.dimension)),t.unaryPlus_jixjl7$(new Gh),t.unaryPlus_jixjl7$(new Jh),t.unaryPlus_jixjl7$(new qf);var n=new hf,a=i;return ff(n,a.fillColor),df(n,a.strokeColor),mf(n,a.strokeWidth),t.unaryPlus_jixjl7$(n),t.unaryPlus_jixjl7$(Gp()),t.unaryPlus_jixjl7$(Zp()),t.unaryPlus_jixjl7$(new Zf(new $d)),N}))},Br.$metadata$={kind:c,simpleName:"PolygonsBuilder",interfaces:[]},Fr.prototype.send_2yxzh4$=function(t){return J.Asyncs.failure_lsqlk3$(Et("Geocoding is disabled."))},Fr.$metadata$={kind:c,interfaces:[Ct]},Ur.prototype.bogusGeocodingService=function(){return new vt(new Fr)},Gr.prototype.connect=function(){St("DummySocketBuilder.connect")},Gr.prototype.close=function(){St("DummySocketBuilder.close")},Gr.prototype.send_61zpoe$=function(t){St("DummySocketBuilder.send")},Gr.$metadata$={kind:c,interfaces:[Tt]},qr.prototype.build_korocx$=function(t){return new Gr},qr.$metadata$={kind:c,simpleName:"DummySocketBuilder",interfaces:[Ot]},Hr.prototype.getTileData_h9hod0$=function(t,e){return J.Asyncs.constant_mh5how$(at())},Hr.$metadata$={kind:c,interfaces:[mt]},Ur.prototype.bogusTileProvider=function(){return new Hr(new qr,yt.COLOR)},Ur.prototype.devGeocodingService=function(){return Er(Yr)},Ur.prototype.jetbrainsGeocodingService=function(){return Er(Vr)},Ur.prototype.devTileProvider=function(){return kr(Kr)},Ur.prototype.jetbrainsTileProvider=function(){return kr(Wr)},Ur.$metadata$={kind:b,simpleName:"Services",interfaces:[]};var Xr,Zr=null;function Jr(t,e){this.factory=t,this.textMeasurer=e}function Qr(t){this.myFactory_0=t,this.index=0,this.point=null,this.fillColor=k.Companion.BLACK,this.strokeColor=k.Companion.TRANSPARENT,this.strokeWidth=0,this.label="",this.size=10,this.family="Arial",this.fontface="",this.hjust=0,this.vjust=0,this.angle=0}function to(t){var e,n,i=rt(it(t,10));for(n=t.iterator();n.hasNext();){var r=n.next();i.add_11rb$(Z.abs(r))}var o=Nt(i);if(0===o){for(var a=t.size,s=rt(a),l=0;ln&&(a-=o),athis.limit_0&&null!=(i=this.tail_0)&&(this.tail_0=i.myPrev_8be2vx$,s(this.tail_0).myNext_8be2vx$=null,this.map_0.remove_11rb$(i.myKey_8be2vx$))},Ya.prototype.getOrPut_kpg1aj$=function(t,e){var n,i=this.get_11rb$(t);if(null!=i)n=i;else{var r=e();this.put_xwzc9p$(t,r),n=r}return n},Ya.prototype.containsKey_11rb$=function(t){return this.map_0.containsKey_11rb$(t)},Va.$metadata$={kind:c,simpleName:"Node",interfaces:[]},Ya.$metadata$={kind:c,simpleName:"LruCache",interfaces:[]},Ka.prototype.add_11rb$=function(t){var e=Pe(this.queue_0,t,this.comparator_0);e<0&&(e=(0|-e)-1|0),this.queue_0.add_wxm5ur$(e,t)},Ka.prototype.peek=function(){return this.queue_0.isEmpty()?null:this.queue_0.get_za3lpa$(0)},Ka.prototype.clear=function(){this.queue_0.clear()},Ka.prototype.toArray=function(){return this.queue_0},Ka.$metadata$={kind:c,simpleName:"PriorityQueue",interfaces:[]},Object.defineProperty(Xa.prototype,"size",{configurable:!0,get:function(){return 1}}),Xa.prototype.iterator=function(){return new Za(this.item_0)},Za.prototype.computeNext=function(){var t;!1===(t=this.requested_0)?this.setNext_11rb$(this.value_0):!0===t&&this.done(),this.requested_0=!0},Za.$metadata$={kind:c,simpleName:"SingleItemIterator",interfaces:[Te]},Xa.$metadata$={kind:c,simpleName:"SingletonCollection",interfaces:[Ae]},Ja.$metadata$={kind:c,simpleName:"BusyStateComponent",interfaces:[Ys]},Qa.$metadata$={kind:c,simpleName:"BusyMarkerComponent",interfaces:[Ys]},Object.defineProperty(ts.prototype,"spinnerGraphics_0",{configurable:!0,get:function(){return null==this.spinnerGraphics_692qlm$_0?T("spinnerGraphics"):this.spinnerGraphics_692qlm$_0},set:function(t){this.spinnerGraphics_692qlm$_0=t}}),ts.prototype.initImpl_4pvjek$=function(t){var e=new E(14,169),n=new E(26,26),i=new ep;i.origin=E.Companion.ZERO,i.dimension=n,i.fillColor=k.Companion.WHITE,i.strokeColor=k.Companion.LIGHT_GRAY,i.strokeWidth=1;var r=new ep;r.origin=new E(4,4),r.dimension=new E(18,18),r.fillColor=k.Companion.TRANSPARENT,r.strokeColor=k.Companion.LIGHT_GRAY,r.strokeWidth=2;var o=this.mySpinnerArc_0;o.origin=new E(4,4),o.dimension=new E(18,18),o.strokeColor=k.Companion.parseHex_61zpoe$("#70a7e3"),o.strokeWidth=2,o.angle=wt.PI/4,this.spinnerGraphics_0=new np(e,x([i,r,o]))},ts.prototype.updateImpl_og8vrq$=function(t,e){var n,i,r,o=is(),a=null!=(n=this.componentManager.count_9u06oy$(p(Ja))>0?o:null)?n:rs(),l=ss(),u=null!=(i=this.componentManager.count_9u06oy$(p(Qa))>0?l:null)?i:ls();r=new we(a,u),Bt(r,new we(rs(),ls()))||(Bt(r,new we(rs(),ss()))?s(this.spinnerEntity_0).remove():Bt(r,new we(is(),ss()))?(this.myStartAngle_0+=2*wt.PI*e/1e3,this.mySpinnerArc_0.startAngle=this.myStartAngle_0):Bt(r,new we(is(),ls()))&&(this.spinnerEntity_0=this.uiService_0.addRenderable_pshs1s$(this.spinnerGraphics_0,"ui_busy_marker").add_57nep2$(new Qa)),this.uiService_0.repaint())},es.$metadata$={kind:c,simpleName:"EntitiesState",interfaces:[me]},es.values=function(){return[is(),rs()]},es.valueOf_61zpoe$=function(t){switch(t){case"BUSY":return is();case"NOT_BUSY":return rs();default:ye("No enum constant jetbrains.livemap.core.BusyStateSystem.EntitiesState."+t)}},os.$metadata$={kind:c,simpleName:"MarkerState",interfaces:[me]},os.values=function(){return[ss(),ls()]},os.valueOf_61zpoe$=function(t){switch(t){case"SHOWING":return ss();case"NOT_SHOWING":return ls();default:ye("No enum constant jetbrains.livemap.core.BusyStateSystem.MarkerState."+t)}},ts.$metadata$={kind:c,simpleName:"BusyStateSystem",interfaces:[Bs]};var us,cs,ps,hs,_s,fs=Le((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(n),r(i))}}}));function ds(t){this.mySystemTime_0=t,this.myMeasures_0=new Ka(je(new Re(fs(d("second",1,(function(t){return t.second})))))),this.myBeginTime_0=u,this.totalUpdateTime_581y0z$_0=0,this.myValuesMap_0=st(),this.myValuesOrder_0=w()}function ms(){}function ys(t,e){me.call(this),this.name$=t,this.ordinal$=e}function $s(){$s=function(){},us=new ys("FORWARD",0),cs=new ys("BACK",1)}function vs(){return $s(),us}function gs(){return $s(),cs}function bs(){return[vs(),gs()]}function ws(t,e){me.call(this),this.name$=t,this.ordinal$=e}function xs(){xs=function(){},ps=new ws("DISABLED",0),hs=new ws("SWITCH_DIRECTION",1),_s=new ws("KEEP_DIRECTION",2)}function ks(){return xs(),ps}function Es(){return xs(),hs}function Cs(){return xs(),_s}function Ss(){Is=this,this.LINEAR=As,this.EASE_IN_QUAD=js,this.EASE_OUT_QUAD=Ls}function Ts(t,e,n){this.start_0=t,this.length_0=e,this.consumer_0=n}function Os(t,e,n){this.start_0=t,this.length_0=e,this.consumer_0=n}function Ns(t){this.duration_0=t,this.easingFunction_0=zs().LINEAR,this.loop_0=ks(),this.direction_0=vs(),this.animators_0=w()}function Ps(t,e,n){this.timeState_0=t,this.easingFunction_0=e,this.animators_0=n,this.time_kdbqol$_0=0}function As(t){return t}function js(t){return t*t}function Ls(t){return t*(2-t)}Object.defineProperty(ds.prototype,"totalUpdateTime",{configurable:!0,get:function(){return this.totalUpdateTime_581y0z$_0},set:function(t){this.totalUpdateTime_581y0z$_0=t}}),Object.defineProperty(ds.prototype,"values",{configurable:!0,get:function(){var t,e,n=w();for(t=this.myValuesOrder_0.iterator();t.hasNext();){var i=t.next();null!=(e=this.myValuesMap_0.get_11rb$(i))&&e.length>0&&n.add_11rb$(e)}return n}}),ds.prototype.beginMeasureUpdate=function(){this.myBeginTime_0=this.mySystemTime_0.getTimeMs()},ds.prototype.endMeasureUpdate_ha9gfm$=function(t){var e=this.mySystemTime_0.getTimeMs().subtract(this.myBeginTime_0);this.myMeasures_0.add_11rb$(new we(t,e.toNumber())),this.totalUpdateTime=this.totalUpdateTime+e},ds.prototype.reset=function(){this.myMeasures_0.clear(),this.totalUpdateTime=0},ds.prototype.slowestSystem=function(){return this.myMeasures_0.peek()},ds.prototype.setValue_puj7f4$=function(t,e){this.myValuesMap_0.put_xwzc9p$(t,e)},ds.prototype.setValuesOrder_mhpeer$=function(t){this.myValuesOrder_0=t},ds.$metadata$={kind:c,simpleName:"MetricsService",interfaces:[]},ys.$metadata$={kind:c,simpleName:"Direction",interfaces:[me]},ys.values=bs,ys.valueOf_61zpoe$=function(t){switch(t){case"FORWARD":return vs();case"BACK":return gs();default:ye("No enum constant jetbrains.livemap.core.animation.Animation.Direction."+t)}},ws.$metadata$={kind:c,simpleName:"Loop",interfaces:[me]},ws.values=function(){return[ks(),Es(),Cs()]},ws.valueOf_61zpoe$=function(t){switch(t){case"DISABLED":return ks();case"SWITCH_DIRECTION":return Es();case"KEEP_DIRECTION":return Cs();default:ye("No enum constant jetbrains.livemap.core.animation.Animation.Loop."+t)}},ms.$metadata$={kind:v,simpleName:"Animation",interfaces:[]},Ts.prototype.doAnimation_14dthe$=function(t){this.consumer_0(this.start_0+t*this.length_0)},Ts.$metadata$={kind:c,simpleName:"DoubleAnimator",interfaces:[Ds]},Os.prototype.doAnimation_14dthe$=function(t){this.consumer_0(this.start_0.add_gpjtzr$(this.length_0.mul_14dthe$(t)))},Os.$metadata$={kind:c,simpleName:"DoubleVectorAnimator",interfaces:[Ds]},Ns.prototype.setEasingFunction_7fnk9s$=function(t){return this.easingFunction_0=t,this},Ns.prototype.setLoop_tfw1f3$=function(t){return this.loop_0=t,this},Ns.prototype.setDirection_aylh82$=function(t){return this.direction_0=t,this},Ns.prototype.setAnimator_i7e8zu$=function(t){var n;return this.animators_0=e.isType(n=ct(t),Ie)?n:C(),this},Ns.prototype.setAnimators_1h9huh$=function(t){return this.animators_0=ze(t),this},Ns.prototype.addAnimator_i7e8zu$=function(t){return this.animators_0.add_11rb$(t),this},Ns.prototype.build=function(){return new Ps(new Ms(this.duration_0,this.loop_0,this.direction_0),this.easingFunction_0,this.animators_0)},Ns.$metadata$={kind:c,simpleName:"AnimationBuilder",interfaces:[]},Object.defineProperty(Ps.prototype,"isFinished",{configurable:!0,get:function(){return this.timeState_0.isFinished}}),Object.defineProperty(Ps.prototype,"duration",{configurable:!0,get:function(){return this.timeState_0.duration}}),Object.defineProperty(Ps.prototype,"time",{configurable:!0,get:function(){return this.time_kdbqol$_0},set:function(t){this.time_kdbqol$_0=this.timeState_0.calcTime_tq0o01$(t)}}),Ps.prototype.animate=function(){var t,e=this.progress_0;for(t=this.animators_0.iterator();t.hasNext();)t.next().doAnimation_14dthe$(e)},Object.defineProperty(Ps.prototype,"progress_0",{configurable:!0,get:function(){if(0===this.duration)return 1;var t=this.easingFunction_0(this.time/this.duration);return this.timeState_0.direction===vs()?t:1-t}}),Ps.$metadata$={kind:c,simpleName:"SimpleAnimation",interfaces:[ms]},Ss.$metadata$={kind:b,simpleName:"Animations",interfaces:[]};var Rs,Is=null;function zs(){return null===Is&&new Ss,Is}function Ds(){}function Ms(t,e,n){this.duration=t,this.loop_0=e,this.direction=n,this.isFinished_wap2n$_0=!1}function Bs(t){this.componentManager=t,this.myTasks_osfxy5$_0=w()}function Us(){this.time=0,this.duration=0,this.finished=!1,this.progress=0,this.easingFunction_heah4c$_0=this.easingFunction_heah4c$_0,this.loop_zepar7$_0=this.loop_zepar7$_0,this.direction_vdy4gu$_0=this.direction_vdy4gu$_0}function Fs(t){this.animation=t}function qs(t){Bs.call(this,t)}function Gs(t){Bs.call(this,t)}function Hs(){}function Ys(){}function Vs(){this.myEntityById_0=st(),this.myComponentsByEntity_0=st(),this.myEntitiesByComponent_0=st(),this.myRemovedEntities_0=w(),this.myIdGenerator_0=0,this.entities_8be2vx$=this.myComponentsByEntity_0.keys}function Ks(t){return t.hasRemoveFlag()}function Ws(t){this.eventSource=t,this.systemTime_kac7b8$_0=new Yy,this.frameStartTimeMs_fwcob4$_0=u,this.metricsService=new ds(this.systemTime),this.tick=u}function Xs(t,e,n){var i;for(this.myComponentManager_0=t,this.myContext_0=e,this.mySystems_0=n,this.myDebugService_0=this.myContext_0.metricsService,i=this.mySystems_0.iterator();i.hasNext();)i.next().init_c257f0$(this.myContext_0)}function Zs(t,e,n){tl.call(this),this.id_8be2vx$=t,this.name=e,this.componentManager=n,this.componentsMap_8be2vx$=st()}function Js(){this.components=w()}function Qs(t,e){var n,i=new Js;for(e(i),n=i.components.iterator();n.hasNext();){var r=n.next();t.componentManager.addComponent_pw9baj$(t,r)}return t}function tl(){this.removeFlag_krvsok$_0=!1}function el(){}function nl(t){this.myRenderBox_0=t}function il(t){this.cursorStyle=t}function rl(t,e){me.call(this),this.name$=t,this.ordinal$=e}function ol(){ol=function(){},Rs=new rl("POINTER",0)}function al(){return ol(),Rs}function sl(t,e){_l(),Bs.call(this,t),this.myCursorService_0=e,this.myInput_0=new wl}function ll(){hl=this,this.COMPONENT_TYPES_0=x([p(il),p(nl)])}Ds.$metadata$={kind:v,simpleName:"Animator",interfaces:[]},Object.defineProperty(Ms.prototype,"isFinished",{configurable:!0,get:function(){return this.isFinished_wap2n$_0},set:function(t){this.isFinished_wap2n$_0=t}}),Ms.prototype.calcTime_tq0o01$=function(t){var e;if(t>this.duration){if(this.loop_0===ks())e=this.duration,this.isFinished=!0;else if(e=t%this.duration,this.loop_0===Es()){var n=g(this.direction.ordinal+t/this.duration)%2;this.direction=bs()[n]}}else e=t;return e},Ms.$metadata$={kind:c,simpleName:"TimeState",interfaces:[]},Bs.prototype.init_c257f0$=function(t){var n;this.initImpl_4pvjek$(e.isType(n=t,Ws)?n:C())},Bs.prototype.update_tqyjj6$=function(t,n){var i;this.executeTasks_t289vu$_0(),this.updateImpl_og8vrq$(e.isType(i=t,Ws)?i:C(),n)},Bs.prototype.destroy=function(){},Bs.prototype.initImpl_4pvjek$=function(t){},Bs.prototype.updateImpl_og8vrq$=function(t,e){},Bs.prototype.getEntities_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.AbstractSystem.getEntities_s66lbm$",Le((function(){var t=e.getKClass;return function(e,n){return this.componentManager.getEntities_9u06oy$(t(e))}}))),Bs.prototype.getEntities_9u06oy$=function(t){return this.componentManager.getEntities_9u06oy$(t)},Bs.prototype.getEntities_38uplf$=function(t){return this.componentManager.getEntities_tv8pd9$(t)},Bs.prototype.getMutableEntities_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.AbstractSystem.getMutableEntities_s66lbm$",Le((function(){var t=e.getKClass,n=e.kotlin.sequences.toList_veqyi0$;return function(e,i){return n(this.componentManager.getEntities_9u06oy$(t(e)))}}))),Bs.prototype.getMutableEntities_38uplf$=function(t){return Ft(this.componentManager.getEntities_tv8pd9$(t))},Bs.prototype.getEntityById_za3lpa$=function(t){return this.componentManager.getEntityById_za3lpa$(t)},Bs.prototype.getEntitiesById_wlb8mv$=function(t){return this.componentManager.getEntitiesById_wlb8mv$(t)},Bs.prototype.getSingletonEntity_9u06oy$=function(t){return this.componentManager.getSingletonEntity_9u06oy$(t)},Bs.prototype.containsEntity_9u06oy$=function(t){return this.componentManager.containsEntity_9u06oy$(t)},Bs.prototype.getSingleton_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.AbstractSystem.getSingleton_s66lbm$",Le((function(){var t=e.getKClass,n=e.throwCCE,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,r){var o,a,s=this.componentManager.getSingletonEntity_9u06oy$(t(e));if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(t(e)))||r(o)?o:n()))throw i("Component "+t(e).simpleName+" is not found");return a}}))),Bs.prototype.getSingletonEntity_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.AbstractSystem.getSingletonEntity_s66lbm$",Le((function(){var t=e.getKClass;return function(e,n){return this.componentManager.getSingletonEntity_9u06oy$(t(e))}}))),Bs.prototype.getSingletonEntity_38uplf$=function(t){return this.componentManager.getSingletonEntity_tv8pd9$(t)},Bs.prototype.createEntity_61zpoe$=function(t){return this.componentManager.createEntity_61zpoe$(t)},Bs.prototype.runLaterBySystem_ayosff$=function(t,e){var n,i,r;this.myTasks_osfxy5$_0.add_11rb$((n=this,i=t,r=e,function(){return n.componentManager.containsEntity_ahlfl2$(i)&&r(i),N}))},Bs.prototype.fetchTasks_u1j879$_0=function(){if(this.myTasks_osfxy5$_0.isEmpty())return at();var t=ze(this.myTasks_osfxy5$_0);return this.myTasks_osfxy5$_0.clear(),t},Bs.prototype.executeTasks_t289vu$_0=function(){var t;for(t=this.fetchTasks_u1j879$_0().iterator();t.hasNext();)t.next()()},Bs.$metadata$={kind:c,simpleName:"AbstractSystem",interfaces:[el]},Object.defineProperty(Us.prototype,"easingFunction",{configurable:!0,get:function(){return null==this.easingFunction_heah4c$_0?T("easingFunction"):this.easingFunction_heah4c$_0},set:function(t){this.easingFunction_heah4c$_0=t}}),Object.defineProperty(Us.prototype,"loop",{configurable:!0,get:function(){return null==this.loop_zepar7$_0?T("loop"):this.loop_zepar7$_0},set:function(t){this.loop_zepar7$_0=t}}),Object.defineProperty(Us.prototype,"direction",{configurable:!0,get:function(){return null==this.direction_vdy4gu$_0?T("direction"):this.direction_vdy4gu$_0},set:function(t){this.direction_vdy4gu$_0=t}}),Us.$metadata$={kind:c,simpleName:"AnimationComponent",interfaces:[Ys]},Fs.$metadata$={kind:c,simpleName:"AnimationObjectComponent",interfaces:[Ys]},qs.prototype.init_c257f0$=function(t){},qs.prototype.update_tqyjj6$=function(t,n){var i;for(i=this.getEntities_9u06oy$(p(Fs)).iterator();i.hasNext();){var r,o,a=i.next();if(null==(o=null==(r=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(Fs)))||e.isType(r,Fs)?r:C()))throw S("Component "+p(Fs).simpleName+" is not found");var s=o.animation;s.time=s.time+n,s.animate(),s.isFinished&&a.removeComponent_9u06oy$(p(Fs))}},qs.$metadata$={kind:c,simpleName:"AnimationObjectSystem",interfaces:[Bs]},Gs.prototype.updateProgress_0=function(t){var e;e=t.direction===vs()?this.progress_0(t):1-this.progress_0(t),t.progress=e},Gs.prototype.progress_0=function(t){return t.easingFunction(t.time/t.duration)},Gs.prototype.updateTime_0=function(t,e){var n,i=t.time+e,r=t.duration,o=t.loop;if(i>r){if(o===ks())n=r,t.finished=!0;else if(n=i%r,o===Es()){var a=g(t.direction.ordinal+i/r)%2;t.direction=bs()[a]}}else n=i;t.time=n},Gs.prototype.updateImpl_og8vrq$=function(t,n){var i;for(i=this.getEntities_9u06oy$(p(Us)).iterator();i.hasNext();){var r,o,a=i.next();if(null==(o=null==(r=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(Us)))||e.isType(r,Us)?r:C()))throw S("Component "+p(Us).simpleName+" is not found");var s=o;this.updateTime_0(s,n),this.updateProgress_0(s)}},Gs.$metadata$={kind:c,simpleName:"AnimationSystem",interfaces:[Bs]},Hs.$metadata$={kind:v,simpleName:"EcsClock",interfaces:[]},Ys.$metadata$={kind:v,simpleName:"EcsComponent",interfaces:[]},Object.defineProperty(Vs.prototype,"entitiesCount",{configurable:!0,get:function(){return this.myComponentsByEntity_0.size}}),Vs.prototype.createEntity_61zpoe$=function(t){var e,n=new Zs((e=this.myIdGenerator_0,this.myIdGenerator_0=e+1|0,e),t,this),i=this.myComponentsByEntity_0,r=n.componentsMap_8be2vx$;i.put_xwzc9p$(n,r);var o=this.myEntityById_0,a=n.id_8be2vx$;return o.put_xwzc9p$(a,n),n},Vs.prototype.getEntityById_za3lpa$=function(t){var e;return s(null!=(e=this.myEntityById_0.get_11rb$(t))?e.hasRemoveFlag()?null:e:null)},Vs.prototype.getEntitiesById_wlb8mv$=function(t){return this.notRemoved_0(tt(Q(t),(e=this,function(t){return e.myEntityById_0.get_11rb$(t)})));var e},Vs.prototype.getEntities_9u06oy$=function(t){var e;return this.notRemoved_1(null!=(e=this.myEntitiesByComponent_0.get_11rb$(t))?e:Me())},Vs.prototype.addComponent_pw9baj$=function(t,n){var i=this.myComponentsByEntity_0.get_11rb$(t);if(null==i)throw Ge("addComponent to non existing entity".toString());var r,o=e.getKClassFromExpression(n);if((e.isType(r=i,xe)?r:C()).containsKey_11rb$(o)){var a="Entity already has component with the type "+l(e.getKClassFromExpression(n));throw Ge(a.toString())}var s=e.getKClassFromExpression(n);i.put_xwzc9p$(s,n);var u,c=this.myEntitiesByComponent_0,p=e.getKClassFromExpression(n),h=c.get_11rb$(p);if(null==h){var _=pe();c.put_xwzc9p$(p,_),u=_}else u=h;u.add_11rb$(t)},Vs.prototype.getComponents_ahlfl2$=function(t){var e;return t.hasRemoveFlag()?Be():null!=(e=this.myComponentsByEntity_0.get_11rb$(t))?e:Be()},Vs.prototype.count_9u06oy$=function(t){var e,n,i;return null!=(i=null!=(n=null!=(e=this.myEntitiesByComponent_0.get_11rb$(t))?this.notRemoved_1(e):null)?$(n):null)?i:0},Vs.prototype.containsEntity_9u06oy$=function(t){return this.myEntitiesByComponent_0.containsKey_11rb$(t)},Vs.prototype.containsEntity_ahlfl2$=function(t){return!t.hasRemoveFlag()&&this.myComponentsByEntity_0.containsKey_11rb$(t)},Vs.prototype.getEntities_tv8pd9$=function(t){return y(this.getEntities_9u06oy$(Ue(t)),(e=t,function(t){return t.contains_tv8pd9$(e)}));var e},Vs.prototype.tryGetSingletonEntity_tv8pd9$=function(t){var e=this.getEntities_tv8pd9$(t);if(!($(e)<=1))throw S(("Entity with specified components is not a singleton: "+t).toString());return Fe(e)},Vs.prototype.getSingletonEntity_tv8pd9$=function(t){var e=this.tryGetSingletonEntity_tv8pd9$(t);if(null==e)throw S(("Entity with specified components does not exist: "+t).toString());return e},Vs.prototype.getSingletonEntity_9u06oy$=function(t){return this.getSingletonEntity_tv8pd9$(Wa(t))},Vs.prototype.getEntity_9u06oy$=function(t){var e;if(null==(e=Fe(this.getEntities_9u06oy$(t))))throw S(("Entity with specified component does not exist: "+t).toString());return e},Vs.prototype.getSingleton_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.EcsComponentManager.getSingleton_s66lbm$",Le((function(){var t=e.getKClass,n=e.throwCCE,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,r){var o,a,s=this.getSingletonEntity_9u06oy$(t(e));if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(t(e)))||r(o)?o:n()))throw i("Component "+t(e).simpleName+" is not found");return a}}))),Vs.prototype.tryGetSingleton_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.EcsComponentManager.tryGetSingleton_s66lbm$",Le((function(){var t=e.getKClass,n=e.throwCCE,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,r){if(this.containsEntity_9u06oy$(t(e))){var o,a,s=this.getSingletonEntity_9u06oy$(t(e));if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(t(e)))||r(o)?o:n()))throw i("Component "+t(e).simpleName+" is not found");return a}return null}}))),Vs.prototype.count_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.EcsComponentManager.count_s66lbm$",Le((function(){var t=e.getKClass;return function(e,n){return this.count_9u06oy$(t(e))}}))),Vs.prototype.removeEntity_ag9c8t$=function(t){var e=this.myRemovedEntities_0;t.setRemoveFlag(),e.add_11rb$(t)},Vs.prototype.removeComponent_mfvtx1$=function(t,e){var n;this.removeEntityFromComponents_0(t,e),null!=(n=this.getComponentsWithRemoved_0(t))&&n.remove_11rb$(e)},Vs.prototype.getComponentsWithRemoved_0=function(t){return this.myComponentsByEntity_0.get_11rb$(t)},Vs.prototype.doRemove_8be2vx$=function(){var t;for(t=this.myRemovedEntities_0.iterator();t.hasNext();){var e,n,i=t.next();if(null!=(e=this.getComponentsWithRemoved_0(i)))for(n=e.entries.iterator();n.hasNext();){var r=n.next().key;this.removeEntityFromComponents_0(i,r)}this.myComponentsByEntity_0.remove_11rb$(i),this.myEntityById_0.remove_11rb$(i.id_8be2vx$)}this.myRemovedEntities_0.clear()},Vs.prototype.removeEntityFromComponents_0=function(t,e){var n;null!=(n=this.myEntitiesByComponent_0.get_11rb$(e))&&(n.remove_11rb$(t),n.isEmpty()&&this.myEntitiesByComponent_0.remove_11rb$(e))},Vs.prototype.notRemoved_1=function(t){return qe(Q(t),A("hasRemoveFlag",(function(t){return t.hasRemoveFlag()})))},Vs.prototype.notRemoved_0=function(t){return qe(t,Ks)},Vs.$metadata$={kind:c,simpleName:"EcsComponentManager",interfaces:[]},Object.defineProperty(Ws.prototype,"systemTime",{configurable:!0,get:function(){return this.systemTime_kac7b8$_0}}),Object.defineProperty(Ws.prototype,"frameStartTimeMs",{configurable:!0,get:function(){return this.frameStartTimeMs_fwcob4$_0},set:function(t){this.frameStartTimeMs_fwcob4$_0=t}}),Object.defineProperty(Ws.prototype,"frameDurationMs",{configurable:!0,get:function(){return this.systemTime.getTimeMs().subtract(this.frameStartTimeMs)}}),Ws.prototype.startFrame_8be2vx$=function(){this.tick=this.tick.inc(),this.frameStartTimeMs=this.systemTime.getTimeMs()},Ws.$metadata$={kind:c,simpleName:"EcsContext",interfaces:[Hs]},Xs.prototype.update_14dthe$=function(t){var e;for(this.myContext_0.startFrame_8be2vx$(),this.myDebugService_0.reset(),e=this.mySystems_0.iterator();e.hasNext();){var n=e.next();this.myDebugService_0.beginMeasureUpdate(),n.update_tqyjj6$(this.myContext_0,t),this.myDebugService_0.endMeasureUpdate_ha9gfm$(n)}this.myComponentManager_0.doRemove_8be2vx$()},Xs.prototype.dispose=function(){var t;for(t=this.mySystems_0.iterator();t.hasNext();)t.next().destroy()},Xs.$metadata$={kind:c,simpleName:"EcsController",interfaces:[U]},Object.defineProperty(Zs.prototype,"components_0",{configurable:!0,get:function(){return this.componentsMap_8be2vx$.values}}),Zs.prototype.toString=function(){return this.name},Zs.prototype.add_57nep2$=function(t){return this.componentManager.addComponent_pw9baj$(this,t),this},Zs.prototype.get_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.EcsEntity.get_s66lbm$",Le((function(){var t=e.getKClass,n=e.throwCCE,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,r){var o,a;if(null==(a=null==(o=this.componentManager.getComponents_ahlfl2$(this).get_11rb$(t(e)))||r(o)?o:n()))throw i("Component "+t(e).simpleName+" is not found");return a}}))),Zs.prototype.tryGet_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.EcsEntity.tryGet_s66lbm$",Le((function(){var t=e.getKClass,n=e.throwCCE,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,r){if(this.contains_9u06oy$(t(e))){var o,a;if(null==(a=null==(o=this.componentManager.getComponents_ahlfl2$(this).get_11rb$(t(e)))||r(o)?o:n()))throw i("Component "+t(e).simpleName+" is not found");return a}return null}}))),Zs.prototype.provide_fpbork$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.EcsEntity.provide_fpbork$",Le((function(){var t=e.getKClass,n=e.throwCCE,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,r,o){if(this.contains_9u06oy$(t(e))){var a,s;if(null==(s=null==(a=this.componentManager.getComponents_ahlfl2$(this).get_11rb$(t(e)))||r(a)?a:n()))throw i("Component "+t(e).simpleName+" is not found");return s}var l=o();return this.add_57nep2$(l),l}}))),Zs.prototype.addComponent_qqqpmc$=function(t){return this.componentManager.addComponent_pw9baj$(this,t),this},Zs.prototype.setComponent_qqqpmc$=function(t){return this.contains_9u06oy$(e.getKClassFromExpression(t))&&this.componentManager.removeComponent_mfvtx1$(this,e.getKClassFromExpression(t)),this.componentManager.addComponent_pw9baj$(this,t),this},Zs.prototype.removeComponent_9u06oy$=function(t){this.componentManager.removeComponent_mfvtx1$(this,t)},Zs.prototype.remove=function(){this.componentManager.removeEntity_ag9c8t$(this)},Zs.prototype.contains_9u06oy$=function(t){return this.componentManager.getComponents_ahlfl2$(this).containsKey_11rb$(t)},Zs.prototype.contains_tv8pd9$=function(t){return this.componentManager.getComponents_ahlfl2$(this).keys.containsAll_brywnq$(t)},Zs.prototype.getComponent_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.EcsEntity.getComponent_s66lbm$",Le((function(){var t=e.getKClass,n=e.throwCCE,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,r){var o,a;if(null==(a=null==(o=this.componentManager.getComponents_ahlfl2$(this).get_11rb$(t(e)))||r(o)?o:n()))throw i("Component "+t(e).simpleName+" is not found");return a}}))),Zs.prototype.contains_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.EcsEntity.contains_s66lbm$",Le((function(){var t=e.getKClass;return function(e,n){return this.contains_9u06oy$(t(e))}}))),Zs.prototype.remove_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.EcsEntity.remove_s66lbm$",Le((function(){var t=e.getKClass;return function(e,n){return this.removeComponent_9u06oy$(t(e)),this}}))),Zs.prototype.tag_fpbork$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.EcsEntity.tag_fpbork$",Le((function(){var t=e.getKClass,n=e.throwCCE,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,r,o){var a;if(this.contains_9u06oy$(t(e))){var s,l;if(null==(l=null==(s=this.componentManager.getComponents_ahlfl2$(this).get_11rb$(t(e)))||r(s)?s:n()))throw i("Component "+t(e).simpleName+" is not found");a=l}else{var u=o();this.add_57nep2$(u),a=u}return a}}))),Zs.prototype.untag_s66lbm$=De("lets-plot-livemap.jetbrains.livemap.core.ecs.EcsEntity.untag_s66lbm$",Le((function(){var t=e.getKClass;return function(e,n){this.removeComponent_9u06oy$(t(e))}}))),Zs.$metadata$={kind:c,simpleName:"EcsEntity",interfaces:[tl]},Js.prototype.unaryPlus_jixjl7$=function(t){this.components.add_11rb$(t)},Js.$metadata$={kind:c,simpleName:"ComponentsList",interfaces:[]},tl.prototype.setRemoveFlag=function(){this.removeFlag_krvsok$_0=!0},tl.prototype.hasRemoveFlag=function(){return this.removeFlag_krvsok$_0},tl.$metadata$={kind:c,simpleName:"EcsRemovable",interfaces:[]},el.$metadata$={kind:v,simpleName:"EcsSystem",interfaces:[]},Object.defineProperty(nl.prototype,"rect",{configurable:!0,get:function(){return new He(this.myRenderBox_0.origin,this.myRenderBox_0.dimension)}}),nl.$metadata$={kind:c,simpleName:"ClickableComponent",interfaces:[Ys]},il.$metadata$={kind:c,simpleName:"CursorStyleComponent",interfaces:[Ys]},rl.$metadata$={kind:c,simpleName:"CursorStyle",interfaces:[me]},rl.values=function(){return[al()]},rl.valueOf_61zpoe$=function(t){switch(t){case"POINTER":return al();default:ye("No enum constant jetbrains.livemap.core.input.CursorStyle."+t)}},sl.prototype.initImpl_4pvjek$=function(t){this.componentManager.createEntity_61zpoe$("CursorInputComponent").add_57nep2$(this.myInput_0)},sl.prototype.updateImpl_og8vrq$=function(t,n){var i;if(null!=(i=this.myInput_0.location)){var r,o,a,s=this.getEntities_38uplf$(_l().COMPONENT_TYPES_0);t:do{var l;for(l=s.iterator();l.hasNext();){var u,c,h=l.next();if(null==(c=null==(u=h.componentManager.getComponents_ahlfl2$(h).get_11rb$(p(nl)))||e.isType(u,nl)?u:C()))throw S("Component "+p(nl).simpleName+" is not found");if(c.rect.contains_gpjtzr$(i.toDoubleVector())){a=h;break t}}a=null}while(0);if(null!=(r=a)){var _,f;if(null==(f=null==(_=r.componentManager.getComponents_ahlfl2$(r).get_11rb$(p(il)))||e.isType(_,il)?_:C()))throw S("Component "+p(il).simpleName+" is not found");Bt(f.cursorStyle,al())&&this.myCursorService_0.pointer(),o=N}else o=null;null!=o||this.myCursorService_0.default()}},ll.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var ul,cl,pl,hl=null;function _l(){return null===hl&&new ll,hl}function fl(){this.pressListeners_0=w(),this.clickListeners_0=w(),this.doubleClickListeners_0=w()}function dl(t){this.location=t,this.isStopped_wl0zz7$_0=!1}function ml(t,e){me.call(this),this.name$=t,this.ordinal$=e}function yl(){yl=function(){},ul=new ml("PRESS",0),cl=new ml("CLICK",1),pl=new ml("DOUBLE_CLICK",2)}function $l(){return yl(),ul}function vl(){return yl(),cl}function gl(){return yl(),pl}function bl(){return[$l(),vl(),gl()]}function wl(){this.location=null,this.dragDistance=null,this.press=null,this.click=null,this.doubleClick=null}function xl(t){Sl(),Bs.call(this,t),this.myInteractiveEntityView_0=new kl}function kl(){this.myInput_e8l61w$_0=this.myInput_e8l61w$_0,this.myClickable_rbak90$_0=this.myClickable_rbak90$_0,this.myListeners_gfgcs9$_0=this.myListeners_gfgcs9$_0,this.myEntity_2u1elx$_0=this.myEntity_2u1elx$_0}function El(){Cl=this,this.COMPONENTS_0=x([p(wl),p(nl),p(fl)])}sl.$metadata$={kind:c,simpleName:"CursorStyleSystem",interfaces:[Bs]},fl.prototype.getListeners_skrnrl$=function(t){var n;switch(t.name){case"PRESS":n=this.pressListeners_0;break;case"CLICK":n=this.clickListeners_0;break;case"DOUBLE_CLICK":n=this.doubleClickListeners_0;break;default:n=e.noWhenBranchMatched()}return n},fl.prototype.contains_uuhdck$=function(t){return!this.getListeners_skrnrl$(t).isEmpty()},fl.prototype.addPressListener_abz6et$=function(t){this.pressListeners_0.add_11rb$(t)},fl.prototype.removePressListener=function(){this.pressListeners_0.clear()},fl.prototype.removePressListener_abz6et$=function(t){this.pressListeners_0.remove_11rb$(t)},fl.prototype.addClickListener_abz6et$=function(t){this.clickListeners_0.add_11rb$(t)},fl.prototype.removeClickListener=function(){this.clickListeners_0.clear()},fl.prototype.removeClickListener_abz6et$=function(t){this.clickListeners_0.remove_11rb$(t)},fl.prototype.addDoubleClickListener_abz6et$=function(t){this.doubleClickListeners_0.add_11rb$(t)},fl.prototype.removeDoubleClickListener=function(){this.doubleClickListeners_0.clear()},fl.prototype.removeDoubleClickListener_abz6et$=function(t){this.doubleClickListeners_0.remove_11rb$(t)},fl.$metadata$={kind:c,simpleName:"EventListenerComponent",interfaces:[Ys]},Object.defineProperty(dl.prototype,"isStopped",{configurable:!0,get:function(){return this.isStopped_wl0zz7$_0},set:function(t){this.isStopped_wl0zz7$_0=t}}),dl.prototype.stopPropagation=function(){this.isStopped=!0},dl.$metadata$={kind:c,simpleName:"InputMouseEvent",interfaces:[]},ml.$metadata$={kind:c,simpleName:"MouseEventType",interfaces:[me]},ml.values=bl,ml.valueOf_61zpoe$=function(t){switch(t){case"PRESS":return $l();case"CLICK":return vl();case"DOUBLE_CLICK":return gl();default:ye("No enum constant jetbrains.livemap.core.input.MouseEventType."+t)}},wl.prototype.getEvent_uuhdck$=function(t){var n;switch(t.name){case"PRESS":n=this.press;break;case"CLICK":n=this.click;break;case"DOUBLE_CLICK":n=this.doubleClick;break;default:n=e.noWhenBranchMatched()}return n},wl.$metadata$={kind:c,simpleName:"MouseInputComponent",interfaces:[Ys]},xl.prototype.updateImpl_og8vrq$=function(t,n){var i,r,o,a,s,l,u=st(),c=this.componentManager.getSingletonEntity_9u06oy$(p(dc));if(null==(l=null==(s=c.componentManager.getComponents_ahlfl2$(c).get_11rb$(p(dc)))||e.isType(s,dc)?s:C()))throw S("Component "+p(dc).simpleName+" is not found");var h,_=l.canvasLayers;for(h=this.getEntities_38uplf$(Sl().COMPONENTS_0).iterator();h.hasNext();){var f=h.next();this.myInteractiveEntityView_0.setEntity_ag9c8t$(f);var d,m=bl();for(d=0;d!==m.length;++d){var y=m[d];if(this.myInteractiveEntityView_0.needToAdd_uuhdck$(y)){var $,v=this.myInteractiveEntityView_0,g=u.get_11rb$(y);if(null==g){var b=st();u.put_xwzc9p$(y,b),$=b}else $=g;v.addTo_o8fzf1$($,this.getZIndex_0(f,_))}}}for(i=bl(),r=0;r!==i.length;++r){var w=i[r];if(null!=(o=u.get_11rb$(w)))for(var x=o,k=_.size;k>=0;k--)null!=(a=x.get_11rb$(k))&&this.acceptListeners_0(w,a)}},xl.prototype.acceptListeners_0=function(t,n){var i;for(i=n.iterator();i.hasNext();){var r,o,a,s=i.next();if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(wl)))||e.isType(o,wl)?o:C()))throw S("Component "+p(wl).simpleName+" is not found");var l,u,c=a;if(null==(u=null==(l=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(fl)))||e.isType(l,fl)?l:C()))throw S("Component "+p(fl).simpleName+" is not found");var h,_=u;if(null!=(r=c.getEvent_uuhdck$(t))&&!r.isStopped)for(h=_.getListeners_skrnrl$(t).iterator();h.hasNext();)h.next()(r)}},xl.prototype.getZIndex_0=function(t,n){var i;if(t.contains_9u06oy$(p(ko)))i=0;else{var r,o,a=t.componentManager;if(null==(o=null==(r=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(yc)))||e.isType(r,yc)?r:C()))throw S("Component "+p(yc).simpleName+" is not found");var s,l,u=a.getEntityById_za3lpa$(o.layerId);if(null==(l=null==(s=u.componentManager.getComponents_ahlfl2$(u).get_11rb$(p(mc)))||e.isType(s,mc)?s:C()))throw S("Component "+p(mc).simpleName+" is not found");var c=l.canvasLayer;i=n.indexOf_11rb$(c)+1|0}return i},Object.defineProperty(kl.prototype,"myInput_0",{configurable:!0,get:function(){return null==this.myInput_e8l61w$_0?T("myInput"):this.myInput_e8l61w$_0},set:function(t){this.myInput_e8l61w$_0=t}}),Object.defineProperty(kl.prototype,"myClickable_0",{configurable:!0,get:function(){return null==this.myClickable_rbak90$_0?T("myClickable"):this.myClickable_rbak90$_0},set:function(t){this.myClickable_rbak90$_0=t}}),Object.defineProperty(kl.prototype,"myListeners_0",{configurable:!0,get:function(){return null==this.myListeners_gfgcs9$_0?T("myListeners"):this.myListeners_gfgcs9$_0},set:function(t){this.myListeners_gfgcs9$_0=t}}),Object.defineProperty(kl.prototype,"myEntity_0",{configurable:!0,get:function(){return null==this.myEntity_2u1elx$_0?T("myEntity"):this.myEntity_2u1elx$_0},set:function(t){this.myEntity_2u1elx$_0=t}}),kl.prototype.setEntity_ag9c8t$=function(t){var n,i,r,o,a,s;if(this.myEntity_0=t,null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(wl)))||e.isType(n,wl)?n:C()))throw S("Component "+p(wl).simpleName+" is not found");if(this.myInput_0=i,null==(o=null==(r=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(nl)))||e.isType(r,nl)?r:C()))throw S("Component "+p(nl).simpleName+" is not found");if(this.myClickable_0=o,null==(s=null==(a=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(fl)))||e.isType(a,fl)?a:C()))throw S("Component "+p(fl).simpleName+" is not found");this.myListeners_0=s},kl.prototype.needToAdd_uuhdck$=function(t){var e=this.myInput_0.getEvent_uuhdck$(t);return null!=e&&this.myListeners_0.contains_uuhdck$(t)&&this.myClickable_0.rect.contains_gpjtzr$(e.location.toDoubleVector())},kl.prototype.addTo_o8fzf1$=function(t,e){var n,i=t.get_11rb$(e);if(null==i){var r=w();t.put_xwzc9p$(e,r),n=r}else n=i;n.add_11rb$(this.myEntity_0)},kl.$metadata$={kind:c,simpleName:"InteractiveEntityView",interfaces:[]},El.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Cl=null;function Sl(){return null===Cl&&new El,Cl}function Tl(t){Bs.call(this,t),this.myRegs_0=new We([]),this.myLocation_0=null,this.myDragStartLocation_0=null,this.myDragCurrentLocation_0=null,this.myDragDelta_0=null,this.myPressEvent_0=null,this.myClickEvent_0=null,this.myDoubleClickEvent_0=null}function Ol(t,e){this.mySystemTime_0=t,this.myMicroTask_0=e,this.finishEventSource_0=new M,this.processTime_hf7vj9$_0=u,this.maxResumeTime_v6sfa5$_0=u}function Nl(t){this.closure$handler=t}function Pl(){}function Al(t,e){return ql().map_69kpin$(t,e)}function jl(t,e){return ql().flatMap_fgpnzh$(t,e)}function Ll(t,e){this.myClock_0=t,this.myFrameDurationLimit_0=e}function Rl(){}function Il(){Fl=this,this.EMPTY_MICRO_THREAD_0=new Ul}function zl(t,e){this.closure$microTask=t,this.closure$mapFunction=e,this.result_0=null,this.transformed_0=!1}function Dl(t,e){this.closure$microTask=t,this.closure$mapFunction=e,this.transformed_0=!1,this.result_0=null}function Ml(t){this.myTasks_0=t.iterator()}function Bl(t){this.threads_0=t.iterator(),this.currentMicroThread_0=ql().EMPTY_MICRO_THREAD_0,this.goToNextAliveMicroThread_0()}function Ul(){}xl.$metadata$={kind:c,simpleName:"MouseInputDetectionSystem",interfaces:[Bs]},Tl.prototype.init_c257f0$=function(t){this.myRegs_0.add_3xv6fb$(t.eventSource.addEventHandler_mfdhbe$(Ye.MOUSE_DOUBLE_CLICKED,Ve(A("onMouseDoubleClicked",function(t,e){return t.onMouseDoubleClicked_0(e),N}.bind(null,this))))),this.myRegs_0.add_3xv6fb$(t.eventSource.addEventHandler_mfdhbe$(Ye.MOUSE_PRESSED,Ve(A("onMousePressed",function(t,e){return t.onMousePressed_0(e),N}.bind(null,this))))),this.myRegs_0.add_3xv6fb$(t.eventSource.addEventHandler_mfdhbe$(Ye.MOUSE_RELEASED,Ve(A("onMouseReleased",function(t,e){return t.onMouseReleased_0(e),N}.bind(null,this))))),this.myRegs_0.add_3xv6fb$(t.eventSource.addEventHandler_mfdhbe$(Ye.MOUSE_DRAGGED,Ve(A("onMouseDragged",function(t,e){return t.onMouseDragged_0(e),N}.bind(null,this))))),this.myRegs_0.add_3xv6fb$(t.eventSource.addEventHandler_mfdhbe$(Ye.MOUSE_MOVED,Ve(A("onMouseMoved",function(t,e){return t.onMouseMoved_0(e),N}.bind(null,this))))),this.myRegs_0.add_3xv6fb$(t.eventSource.addEventHandler_mfdhbe$(Ye.MOUSE_CLICKED,Ve(A("onMouseClicked",function(t,e){return t.onMouseClicked_0(e),N}.bind(null,this)))))},Tl.prototype.update_tqyjj6$=function(t,n){var i,r;for(null!=(i=this.myDragCurrentLocation_0)&&(Bt(i,this.myDragStartLocation_0)||(this.myDragDelta_0=i.sub_119tl4$(s(this.myDragStartLocation_0)),this.myDragStartLocation_0=i)),r=this.getEntities_9u06oy$(p(wl)).iterator();r.hasNext();){var o,a,l=r.next();if(null==(a=null==(o=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(wl)))||e.isType(o,wl)?o:C()))throw S("Component "+p(wl).simpleName+" is not found");a.location=this.myLocation_0,a.dragDistance=this.myDragDelta_0,a.press=this.myPressEvent_0,a.click=this.myClickEvent_0,a.doubleClick=this.myDoubleClickEvent_0}this.myLocation_0=null,this.myPressEvent_0=null,this.myClickEvent_0=null,this.myDoubleClickEvent_0=null,this.myDragDelta_0=null},Tl.prototype.destroy=function(){this.myRegs_0.dispose()},Tl.prototype.onMouseClicked_0=function(t){t.button===Ke.LEFT&&(this.myClickEvent_0=new dl(t.location),this.myDragCurrentLocation_0=null,this.myDragStartLocation_0=null)},Tl.prototype.onMousePressed_0=function(t){t.button===Ke.LEFT&&(this.myPressEvent_0=new dl(t.location),this.myDragStartLocation_0=t.location)},Tl.prototype.onMouseReleased_0=function(t){t.button===Ke.LEFT&&(this.myDragCurrentLocation_0=null,this.myDragStartLocation_0=null)},Tl.prototype.onMouseDragged_0=function(t){null!=this.myDragStartLocation_0&&(this.myDragCurrentLocation_0=t.location)},Tl.prototype.onMouseDoubleClicked_0=function(t){t.button===Ke.LEFT&&(this.myDoubleClickEvent_0=new dl(t.location))},Tl.prototype.onMouseMoved_0=function(t){this.myLocation_0=t.location},Tl.$metadata$={kind:c,simpleName:"MouseInputSystem",interfaces:[Bs]},Object.defineProperty(Ol.prototype,"processTime",{configurable:!0,get:function(){return this.processTime_hf7vj9$_0},set:function(t){this.processTime_hf7vj9$_0=t}}),Object.defineProperty(Ol.prototype,"maxResumeTime",{configurable:!0,get:function(){return this.maxResumeTime_v6sfa5$_0},set:function(t){this.maxResumeTime_v6sfa5$_0=t}}),Ol.prototype.resume=function(){var t=this.mySystemTime_0.getTimeMs();this.myMicroTask_0.resume();var e=this.mySystemTime_0.getTimeMs().subtract(t);this.processTime=this.processTime.add(e);var n=this.maxResumeTime;this.maxResumeTime=e.compareTo_11rb$(n)>=0?e:n,this.myMicroTask_0.alive()||this.finishEventSource_0.fire_11rb$(null)},Nl.prototype.onEvent_11rb$=function(t){this.closure$handler()},Nl.$metadata$={kind:c,interfaces:[O]},Ol.prototype.addFinishHandler_o14v8n$=function(t){return this.finishEventSource_0.addHandler_gxwwpc$(new Nl(t))},Ol.prototype.alive=function(){return this.myMicroTask_0.alive()},Ol.prototype.getResult=function(){return this.myMicroTask_0.getResult()},Ol.$metadata$={kind:c,simpleName:"DebugMicroTask",interfaces:[Pl]},Pl.$metadata$={kind:v,simpleName:"MicroTask",interfaces:[]},Ll.prototype.start=function(){},Ll.prototype.stop=function(){},Ll.prototype.updateAndGetFinished_gjcz1g$=function(t){for(var e=pe(),n=!0;;){var i=n;if(i&&(i=!t.isEmpty()),!i)break;for(var r=t.iterator();r.hasNext();){if(this.myClock_0.frameDurationMs.compareTo_11rb$(this.myFrameDurationLimit_0)>0){n=!1;break}for(var o,a=r.next(),s=a.resumesBeforeTimeCheck_8be2vx$;s=(o=s)-1|0,o>0&&a.microTask.alive();)a.microTask.resume();a.microTask.alive()||(e.add_11rb$(a),r.remove())}}return e},Ll.$metadata$={kind:c,simpleName:"MicroTaskCooperativeExecutor",interfaces:[Rl]},Rl.$metadata$={kind:v,simpleName:"MicroTaskExecutor",interfaces:[]},zl.prototype.resume=function(){this.closure$microTask.alive()?this.closure$microTask.resume():this.transformed_0||(this.result_0=this.closure$mapFunction(this.closure$microTask.getResult()),this.transformed_0=!0)},zl.prototype.alive=function(){return this.closure$microTask.alive()||!this.transformed_0},zl.prototype.getResult=function(){var t;if(null==(t=this.result_0))throw S("".toString());return t},zl.$metadata$={kind:c,interfaces:[Pl]},Il.prototype.map_69kpin$=function(t,e){return new zl(t,e)},Dl.prototype.resume=function(){this.closure$microTask.alive()?this.closure$microTask.resume():this.transformed_0?s(this.result_0).alive()&&s(this.result_0).resume():(this.result_0=this.closure$mapFunction(this.closure$microTask.getResult()),this.transformed_0=!0)},Dl.prototype.alive=function(){return this.closure$microTask.alive()||!this.transformed_0||s(this.result_0).alive()},Dl.prototype.getResult=function(){return s(this.result_0).getResult()},Dl.$metadata$={kind:c,interfaces:[Pl]},Il.prototype.flatMap_fgpnzh$=function(t,e){return new Dl(t,e)},Il.prototype.create_o14v8n$=function(t){return new Ml(ct(t))},Il.prototype.create_xduz9s$=function(t){return new Ml(t)},Il.prototype.join_asgahm$=function(t){return new Bl(t)},Ml.prototype.resume=function(){this.myTasks_0.next()()},Ml.prototype.alive=function(){return this.myTasks_0.hasNext()},Ml.prototype.getResult=function(){return N},Ml.$metadata$={kind:c,simpleName:"CompositeMicroThread",interfaces:[Pl]},Bl.prototype.resume=function(){this.currentMicroThread_0.resume(),this.goToNextAliveMicroThread_0()},Bl.prototype.alive=function(){return this.currentMicroThread_0.alive()},Bl.prototype.getResult=function(){return N},Bl.prototype.goToNextAliveMicroThread_0=function(){for(;!this.currentMicroThread_0.alive();){if(!this.threads_0.hasNext())return;this.currentMicroThread_0=this.threads_0.next()}},Bl.$metadata$={kind:c,simpleName:"MultiMicroThread",interfaces:[Pl]},Ul.prototype.getResult=function(){return N},Ul.prototype.resume=function(){},Ul.prototype.alive=function(){return!1},Ul.$metadata$={kind:c,interfaces:[Pl]},Il.$metadata$={kind:b,simpleName:"MicroTaskUtil",interfaces:[]};var Fl=null;function ql(){return null===Fl&&new Il,Fl}function Gl(t,e){this.microTask=t,this.resumesBeforeTimeCheck_8be2vx$=e}function Hl(t,e,n){t.setComponent_qqqpmc$(new Gl(n,e))}function Yl(t,e){Bs.call(this,e),this.microTaskExecutor_0=t,this.loading_dhgexf$_0=u}function Vl(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Gl)))||e.isType(n,Gl)?n:C()))throw S("Component "+p(Gl).simpleName+" is not found");return i}function Kl(t,e){this.transform_0=t,this.epsilonSqr_0=e*e}function Wl(){Jl()}function Xl(){Zl=this,this.LON_LIMIT_0=new en(179.999),this.LAT_LIMIT_0=new en(90),this.VALID_RECTANGLE_0=on(rn(nn(this.LON_LIMIT_0),nn(this.LAT_LIMIT_0)),rn(this.LON_LIMIT_0,this.LAT_LIMIT_0))}Gl.$metadata$={kind:c,simpleName:"MicroThreadComponent",interfaces:[Ys]},Object.defineProperty(Yl.prototype,"loading",{configurable:!0,get:function(){return this.loading_dhgexf$_0},set:function(t){this.loading_dhgexf$_0=t}}),Yl.prototype.initImpl_4pvjek$=function(t){this.microTaskExecutor_0.start()},Yl.prototype.updateImpl_og8vrq$=function(t,n){if(this.componentManager.count_9u06oy$(p(Gl))>0){var i,r=Q(Ft(this.getEntities_9u06oy$(p(Gl)))),o=Xe(h(r,Vl)),a=A("updateAndGetFinished",function(t,e){return t.updateAndGetFinished_gjcz1g$(e)}.bind(null,this.microTaskExecutor_0))(o);for(i=y(r,function(t){return function(n){var i,r,o=t;if(null==(r=null==(i=n.componentManager.getComponents_ahlfl2$(n).get_11rb$(p(Gl)))||e.isType(i,Gl)?i:C()))throw S("Component "+p(Gl).simpleName+" is not found");return o.contains_11rb$(r)}}(a)).iterator();i.hasNext();)i.next().removeComponent_9u06oy$(p(Gl));this.loading=t.frameDurationMs}else this.loading=u},Yl.prototype.destroy=function(){this.microTaskExecutor_0.stop()},Yl.$metadata$={kind:c,simpleName:"SchedulerSystem",interfaces:[Bs]},Kl.prototype.pop_0=function(t){var e=t.get_za3lpa$(Ze(t));return t.removeAt_za3lpa$(Ze(t)),e},Kl.prototype.resample_ohchv7$=function(t){var e,n=rt(t.size);e=t.size;for(var i=1;i0?n<-wt.PI/2+ru().EPSILON_0&&(n=-wt.PI/2+ru().EPSILON_0):n>wt.PI/2-ru().EPSILON_0&&(n=wt.PI/2-ru().EPSILON_0);var i=this.f_0,r=ru().tany_0(n),o=this.n_0,a=i/Z.pow(r,o),s=this.n_0*e,l=a*Z.sin(s),u=this.f_0,c=this.n_0*e,p=u-a*Z.cos(c);return Qu().safePoint_y7b45i$(l,p)},eu.prototype.invert_11rc$=function(t){var e=t.x,n=t.y,i=this.f_0-n,r=this.n_0,o=e*e+i*i,a=Z.sign(r)*Z.sqrt(o),s=Z.abs(i),l=tn(Z.atan2(e,s)/this.n_0*Z.sign(i)),u=this.f_0/a,c=1/this.n_0,p=Z.pow(u,c),h=tn(2*Z.atan(p)-wt.PI/2);return Qu().safePoint_y7b45i$(l,h)},nu.prototype.tany_0=function(t){var e=(wt.PI/2+t)/2;return Z.tan(e)},nu.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var iu=null;function ru(){return null===iu&&new nu,iu}function ou(t,e){pu(),this.n_0=0,this.c_0=0,this.r0_0=0;var n=Z.sin(t);this.n_0=(n+Z.sin(e))/2,this.c_0=1+n*(2*this.n_0-n);var i=this.c_0;this.r0_0=Z.sqrt(i)/this.n_0}function au(){cu=this,this.VALID_RECTANGLE_0=on(H(-180,-90),H(180,90))}eu.$metadata$={kind:c,simpleName:"ConicConformalProjection",interfaces:[hu]},ou.prototype.validRect=function(){return pu().VALID_RECTANGLE_0},ou.prototype.project_11rb$=function(t){var e=Qe(t.x),n=Qe(t.y),i=this.c_0-2*this.n_0*Z.sin(n),r=Z.sqrt(i)/this.n_0;e*=this.n_0;var o=r*Z.sin(e),a=this.r0_0-r*Z.cos(e);return Qu().safePoint_y7b45i$(o,a)},ou.prototype.invert_11rc$=function(t){var e=t.x,n=t.y,i=this.r0_0-n,r=Z.abs(i),o=tn(Z.atan2(e,r)/this.n_0*Z.sign(i)),a=(this.c_0-(e*e+i*i)*this.n_0*this.n_0)/(2*this.n_0),s=tn(Z.asin(a));return Qu().safePoint_y7b45i$(o,s)},au.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var su,lu,uu,cu=null;function pu(){return null===cu&&new au,cu}function hu(){}function _u(t){var e,n=w();if(t.isEmpty())return n;n.add_11rb$(t.get_za3lpa$(0)),e=t.size;for(var i=1;i=0?1:-1)*uu/2;return t.add_11rb$(K(e,void 0,(r=l,function(t){return new en(r)}))),void t.add_11rb$(K(n,void 0,function(t){return function(e){return new en(t)}}(l)))}for(var u=du(e.x,n.x)<=du(n.x,e.x)?1:-1,c=mu(e.y),p=Z.tan(c),h=mu(n.y),_=Z.tan(h),f=mu(n.x-e.x),d=Z.sin(f),m=e.x;;){var y=m-n.x;if(!(Z.abs(y)>su))break;var $=mu((m=ln(m+=u*su))-e.x),v=_*Z.sin($),g=mu(n.x-m),b=(v+p*Z.sin(g))/d,w=(i=Z.atan(b),uu*i/wt.PI);t.add_11rb$(H(m,w))}}}function du(t,e){var n=e-t;return n+(n<0?lu:0)}function mu(t){return wt.PI*t/uu}function yu(){gu()}function $u(){vu=this,this.VALID_RECTANGLE_0=on(H(-180,-90),H(180,90))}ou.$metadata$={kind:c,simpleName:"ConicEqualAreaProjection",interfaces:[hu]},hu.$metadata$={kind:v,simpleName:"GeoProjection",interfaces:[Au]},yu.prototype.project_11rb$=function(t){return H(_t(t.x),ft(t.y))},yu.prototype.invert_11rc$=function(t){return H(_t(t.x),ft(t.y))},yu.prototype.validRect=function(){return gu().VALID_RECTANGLE_0},$u.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var vu=null;function gu(){return null===vu&&new $u,vu}function bu(){}function wu(){Pu()}function xu(){Nu=this,this.VALID_RECTANGLE_0=on(H(G.MercatorUtils.VALID_LONGITUDE_RANGE.lowerEnd,G.MercatorUtils.VALID_LATITUDE_RANGE.lowerEnd),H(G.MercatorUtils.VALID_LONGITUDE_RANGE.upperEnd,G.MercatorUtils.VALID_LATITUDE_RANGE.upperEnd))}yu.$metadata$={kind:c,simpleName:"GeographicProjection",interfaces:[hu]},bu.$metadata$={kind:v,simpleName:"MapRuler",interfaces:[]},wu.prototype.project_11rb$=function(t){return H(G.MercatorUtils.getMercatorX_14dthe$(_t(t.x)),G.MercatorUtils.getMercatorY_14dthe$(ft(t.y)))},wu.prototype.invert_11rc$=function(t){return H(_t(G.MercatorUtils.getLongitude_14dthe$(t.x)),ft(G.MercatorUtils.getLatitude_14dthe$(t.y)))},wu.prototype.validRect=function(){return Pu().VALID_RECTANGLE_0},xu.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var ku,Eu,Cu,Su,Tu,Ou,Nu=null;function Pu(){return null===Nu&&new xu,Nu}function Au(){}function ju(t,e){me.call(this),this.name$=t,this.ordinal$=e}function Lu(){Lu=function(){},ku=new ju("GEOGRAPHIC",0),Eu=new ju("MERCATOR",1),Cu=new ju("AZIMUTHAL_EQUAL_AREA",2),Su=new ju("AZIMUTHAL_EQUIDISTANT",3),Tu=new ju("CONIC_CONFORMAL",4),Ou=new ju("CONIC_EQUAL_AREA",5)}function Ru(){return Lu(),ku}function Iu(){return Lu(),Eu}function zu(){return Lu(),Cu}function Du(){return Lu(),Su}function Mu(){return Lu(),Tu}function Bu(){return Lu(),Ou}function Uu(){Ju=this,this.SAMPLING_EPSILON_0=.001,this.PROJECTION_MAP_0=fn([_n(Ru(),new yu),_n(Iu(),new wu),_n(zu(),new Ql),_n(Du(),new tu),_n(Mu(),new eu(0,wt.PI/3)),_n(Bu(),new ou(0,wt.PI/3))])}function Fu(t,e){this.closure$xProjection=t,this.closure$yProjection=e}function qu(t,e){this.closure$t1=t,this.closure$t2=e}function Gu(t){this.closure$scale=t}function Hu(t){this.closure$offset=t}wu.$metadata$={kind:c,simpleName:"MercatorProjection",interfaces:[hu]},Au.$metadata$={kind:v,simpleName:"Projection",interfaces:[]},ju.$metadata$={kind:c,simpleName:"ProjectionType",interfaces:[me]},ju.values=function(){return[Ru(),Iu(),zu(),Du(),Mu(),Bu()]},ju.valueOf_61zpoe$=function(t){switch(t){case"GEOGRAPHIC":return Ru();case"MERCATOR":return Iu();case"AZIMUTHAL_EQUAL_AREA":return zu();case"AZIMUTHAL_EQUIDISTANT":return Du();case"CONIC_CONFORMAL":return Mu();case"CONIC_EQUAL_AREA":return Bu();default:ye("No enum constant jetbrains.livemap.core.projections.ProjectionType."+t)}},Uu.prototype.createGeoProjection_7v9tu4$=function(t){var e;if(null==(e=this.PROJECTION_MAP_0.get_11rb$(t)))throw S(("Unknown projection type: "+t).toString());return e},Uu.prototype.calculateAngle_l9poh5$=function(t,e){var n=t.y-e.y,i=e.x-t.x;return Z.atan2(n,i)},Uu.prototype.rectToPolygon_0=function(t){var e,n=w();return n.add_11rb$(t.origin),n.add_11rb$(K(t.origin,(e=t,function(t){return W(t,un(e))}))),n.add_11rb$(L(t.origin,t.dimension)),n.add_11rb$(K(t.origin,void 0,function(t){return function(e){return W(e,cn(t))}}(t))),n.add_11rb$(t.origin),n},Uu.prototype.square_ilk2sd$=function(t){return this.tuple_bkiy7g$(t,t)},Fu.prototype.project_11rb$=function(t){return H(this.closure$xProjection.project_11rb$(t.x),this.closure$yProjection.project_11rb$(t.y))},Fu.prototype.invert_11rc$=function(t){return H(this.closure$xProjection.invert_11rc$(t.x),this.closure$yProjection.invert_11rc$(t.y))},Fu.$metadata$={kind:c,interfaces:[Au]},Uu.prototype.tuple_bkiy7g$=function(t,e){return new Fu(t,e)},qu.prototype.project_11rb$=function(t){var e=A("project",function(t,e){return t.project_11rb$(e)}.bind(null,this.closure$t1))(t);return A("project",function(t,e){return t.project_11rb$(e)}.bind(null,this.closure$t2))(e)},qu.prototype.invert_11rc$=function(t){var e=A("invert",function(t,e){return t.invert_11rc$(e)}.bind(null,this.closure$t2))(t);return A("invert",function(t,e){return t.invert_11rc$(e)}.bind(null,this.closure$t1))(e)},qu.$metadata$={kind:c,interfaces:[Au]},Uu.prototype.composite_ogd8x7$=function(t,e){return new qu(t,e)},Uu.prototype.zoom_t0n4v2$=function(t){return this.scale_d4mmvr$((e=t,function(){var t=e();return Z.pow(2,t)}));var e},Gu.prototype.project_11rb$=function(t){return t*this.closure$scale()},Gu.prototype.invert_11rc$=function(t){return t/this.closure$scale()},Gu.$metadata$={kind:c,interfaces:[Au]},Uu.prototype.scale_d4mmvr$=function(t){return new Gu(t)},Uu.prototype.linear_sdh6z7$=function(t,e){return this.composite_ogd8x7$(this.offset_tq0o01$(t),this.scale_tq0o01$(e))},Hu.prototype.project_11rb$=function(t){return t-this.closure$offset},Hu.prototype.invert_11rc$=function(t){return t+this.closure$offset},Hu.$metadata$={kind:c,interfaces:[Au]},Uu.prototype.offset_tq0o01$=function(t){return new Hu(t)},Uu.prototype.zoom_za3lpa$=function(t){return this.zoom_t0n4v2$((e=t,function(){return e}));var e},Uu.prototype.scale_tq0o01$=function(t){return this.scale_d4mmvr$((e=t,function(){return e}));var e},Uu.prototype.transformBBox_kr9gox$=function(t,e){return pn(this.transformRing_0(A("rectToPolygon",function(t,e){return t.rectToPolygon_0(e)}.bind(null,this))(t),e,this.SAMPLING_EPSILON_0))},Uu.prototype.transformMultiPolygon_c0yqik$=function(t,e){var n,i=rt(t.size);for(n=t.iterator();n.hasNext();){var r=n.next();i.add_11rb$(this.transformPolygon_0(r,e,this.SAMPLING_EPSILON_0))}return new ht(i)},Uu.prototype.transformPolygon_0=function(t,e,n){var i,r=rt(t.size);for(i=t.iterator();i.hasNext();){var o=i.next();r.add_11rb$(new ut(this.transformRing_0(o,e,n)))}return new pt(r)},Uu.prototype.transformRing_0=function(t,e,n){return new Kl(e,n).resample_ohchv7$(t)},Uu.prototype.transform_c0yqik$=function(t,e){var n,i=rt(t.size);for(n=t.iterator();n.hasNext();){var r=n.next();i.add_11rb$(this.transform_0(r,e,this.SAMPLING_EPSILON_0))}return new ht(i)},Uu.prototype.transform_0=function(t,e,n){var i,r=rt(t.size);for(i=t.iterator();i.hasNext();){var o=i.next();r.add_11rb$(new ut(this.transform_1(o,e,n)))}return new pt(r)},Uu.prototype.transform_1=function(t,e,n){var i,r=rt(t.size);for(i=t.iterator();i.hasNext();){var o=i.next();r.add_11rb$(e(o))}return r},Uu.prototype.safePoint_y7b45i$=function(t,e){if(hn(t)||hn(e))throw S(("Value for DoubleVector isNaN x = "+t+" and y = "+e).toString());return H(t,e)},Uu.$metadata$={kind:b,simpleName:"ProjectionUtil",interfaces:[]};var Yu,Vu,Ku,Wu,Xu,Zu,Ju=null;function Qu(){return null===Ju&&new Uu,Ju}function tc(){this.horizontal=ic(),this.vertical=lc()}function ec(t,e){me.call(this),this.name$=t,this.ordinal$=e}function nc(){nc=function(){},Yu=new ec("RIGHT",0),Vu=new ec("CENTER",1),Ku=new ec("LEFT",2)}function ic(){return nc(),Yu}function rc(){return nc(),Vu}function oc(){return nc(),Ku}function ac(t,e){me.call(this),this.name$=t,this.ordinal$=e}function sc(){sc=function(){},Wu=new ac("TOP",0),Xu=new ac("CENTER",1),Zu=new ac("BOTTOM",2)}function lc(){return sc(),Wu}function uc(){return sc(),Xu}function cc(){return sc(),Zu}function pc(t){this.myContext2d_0=t}function hc(){this.scale=0,this.position=E.Companion.ZERO}function _c(t,e){this.myCanvas_0=t,this.name=e,this.myRect_0=q(0,0,this.myCanvas_0.size.x,this.myCanvas_0.size.y),this.myRenderTaskList_0=w()}function fc(){}function dc(t){this.myGroupedLayers_0=t}function mc(t){this.canvasLayer=t}function yc(t){kc(),this.layerId=t}function $c(){xc=this}ec.$metadata$={kind:c,simpleName:"HorizontalAlignment",interfaces:[me]},ec.values=function(){return[ic(),rc(),oc()]},ec.valueOf_61zpoe$=function(t){switch(t){case"RIGHT":return ic();case"CENTER":return rc();case"LEFT":return oc();default:ye("No enum constant jetbrains.livemap.core.rendering.Alignment.HorizontalAlignment."+t)}},ac.$metadata$={kind:c,simpleName:"VerticalAlignment",interfaces:[me]},ac.values=function(){return[lc(),uc(),cc()]},ac.valueOf_61zpoe$=function(t){switch(t){case"TOP":return lc();case"CENTER":return uc();case"BOTTOM":return cc();default:ye("No enum constant jetbrains.livemap.core.rendering.Alignment.VerticalAlignment."+t)}},tc.prototype.calculatePosition_qt8ska$=function(t,n){var i,r;switch(this.horizontal.name){case"LEFT":i=-n.x;break;case"CENTER":i=-n.x/2;break;case"RIGHT":i=0;break;default:i=e.noWhenBranchMatched()}var o=i;switch(this.vertical.name){case"TOP":r=0;break;case"CENTER":r=-n.y/2;break;case"BOTTOM":r=-n.y;break;default:r=e.noWhenBranchMatched()}return sp(t,new E(o,r))},tc.$metadata$={kind:c,simpleName:"Alignment",interfaces:[]},pc.prototype.measure_2qe7uk$=function(t,e){this.myContext2d_0.save(),this.myContext2d_0.setFont_ov8mpe$(e);var n=this.myContext2d_0.measureText_61zpoe$(t);return this.myContext2d_0.restore(),new E(n,e.fontSize)},pc.$metadata$={kind:c,simpleName:"TextMeasurer",interfaces:[]},hc.$metadata$={kind:c,simpleName:"TransformComponent",interfaces:[Ys]},Object.defineProperty(_c.prototype,"size",{configurable:!0,get:function(){return this.myCanvas_0.size}}),_c.prototype.addRenderTask_ddf932$=function(t){this.myRenderTaskList_0.add_11rb$(t)},_c.prototype.render=function(){var t,e=this.myCanvas_0.context2d;for(t=this.myRenderTaskList_0.iterator();t.hasNext();)t.next()(e);this.myRenderTaskList_0.clear()},_c.prototype.takeSnapshot=function(){return this.myCanvas_0.takeSnapshot()},_c.prototype.clear=function(){this.myCanvas_0.context2d.clearRect_wthzt5$(this.myRect_0)},_c.prototype.removeFrom_49gm0j$=function(t){t.removeChild_eqkm0m$(this.myCanvas_0)},_c.$metadata$={kind:c,simpleName:"CanvasLayer",interfaces:[]},fc.$metadata$={kind:c,simpleName:"DirtyCanvasLayerComponent",interfaces:[Ys]},Object.defineProperty(dc.prototype,"canvasLayers",{configurable:!0,get:function(){return this.myGroupedLayers_0.orderedLayers}}),dc.$metadata$={kind:c,simpleName:"LayersOrderComponent",interfaces:[Ys]},mc.$metadata$={kind:c,simpleName:"CanvasLayerComponent",interfaces:[Ys]},$c.prototype.tagDirtyParentLayer_ahlfl2$=function(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(yc)))||e.isType(n,yc)?n:C()))throw S("Component "+p(yc).simpleName+" is not found");var r,o=i,a=t.componentManager.getEntityById_za3lpa$(o.layerId);if(a.contains_9u06oy$(p(fc))){if(null==(null==(r=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(fc)))||e.isType(r,fc)?r:C()))throw S("Component "+p(fc).simpleName+" is not found")}else a.add_57nep2$(new fc)},$c.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var vc,gc,bc,wc,xc=null;function kc(){return null===xc&&new $c,xc}function Ec(){this.myGroupedLayers_0=st(),this.orderedLayers=at()}function Cc(t,e){me.call(this),this.name$=t,this.ordinal$=e}function Sc(){Sc=function(){},vc=new Cc("BACKGROUND",0),gc=new Cc("FEATURES",1),bc=new Cc("FOREGROUND",2),wc=new Cc("UI",3)}function Tc(){return Sc(),vc}function Oc(){return Sc(),gc}function Nc(){return Sc(),bc}function Pc(){return Sc(),wc}function Ac(){return[Tc(),Oc(),Nc(),Pc()]}function jc(){}function Lc(){Gc=this}function Rc(t,e,n){this.closure$componentManager=t,this.closure$singleCanvasControl=e,this.closure$rect=n,this.myGroupedLayers_0=new Ec}function Ic(t,e){this.closure$singleCanvasControl=t,this.closure$rect=e}function zc(t,e,n){this.closure$componentManager=t,this.closure$singleCanvasControl=e,this.closure$rect=n,this.myGroupedLayers_0=new Ec}function Dc(t,e){this.closure$singleCanvasControl=t,this.closure$rect=e}function Mc(t,e){this.closure$componentManager=t,this.closure$canvasControl=e,this.myGroupedLayers_0=new Ec}function Bc(){}yc.$metadata$={kind:c,simpleName:"ParentLayerComponent",interfaces:[Ys]},Ec.prototype.add_vanbej$=function(t,e){var n,i=this.myGroupedLayers_0,r=i.get_11rb$(t);if(null==r){var o=w();i.put_xwzc9p$(t,o),n=o}else n=r;n.add_11rb$(e);var a,s=Ac(),l=w();for(a=0;a!==s.length;++a){var u,c=s[a],p=null!=(u=this.myGroupedLayers_0.get_11rb$(c))?u:at();xt(l,p)}this.orderedLayers=l},Ec.prototype.remove_vanbej$=function(t,e){var n;null!=(n=this.myGroupedLayers_0.get_11rb$(t))&&n.remove_11rb$(e)},Ec.$metadata$={kind:c,simpleName:"GroupedLayers",interfaces:[]},Cc.$metadata$={kind:c,simpleName:"LayerGroup",interfaces:[me]},Cc.values=Ac,Cc.valueOf_61zpoe$=function(t){switch(t){case"BACKGROUND":return Tc();case"FEATURES":return Oc();case"FOREGROUND":return Nc();case"UI":return Pc();default:ye("No enum constant jetbrains.livemap.core.rendering.layers.LayerGroup."+t)}},jc.$metadata$={kind:v,simpleName:"LayerManager",interfaces:[]},Lc.prototype.createLayerManager_ju5hjs$=function(t,n,i){var r;switch(n.name){case"SINGLE_SCREEN_CANVAS":r=this.singleScreenCanvas_0(i,t);break;case"OWN_OFFSCREEN_CANVAS":r=this.offscreenLayers_0(i,t);break;case"OWN_SCREEN_CANVAS":r=this.screenLayers_0(i,t);break;default:r=e.noWhenBranchMatched()}return r},Ic.prototype.render_wuw0ll$=function(t,n,i){var r,o;for(this.closure$singleCanvasControl.context.clearRect_wthzt5$(this.closure$rect),r=t.iterator();r.hasNext();)r.next().render();for(o=n.iterator();o.hasNext();){var a,s=o.next();if(s.contains_9u06oy$(p(fc))){if(null==(null==(a=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(fc)))||e.isType(a,fc)?a:C()))throw S("Component "+p(fc).simpleName+" is not found")}else s.add_57nep2$(new fc)}},Ic.$metadata$={kind:c,interfaces:[Vc]},Rc.prototype.createLayerRenderingSystem=function(){return new Yc(this.closure$componentManager,new Ic(this.closure$singleCanvasControl,this.closure$rect))},Rc.prototype.addLayer_kqh14j$=function(t,e){var n=new _c(this.closure$singleCanvasControl.canvas,t);return this.myGroupedLayers_0.add_vanbej$(e,n),new mc(n)},Rc.prototype.removeLayer_vanbej$=function(t,e){this.myGroupedLayers_0.remove_vanbej$(t,e)},Rc.prototype.createLayersOrderComponent=function(){return new dc(this.myGroupedLayers_0)},Rc.$metadata$={kind:c,interfaces:[jc]},Lc.prototype.singleScreenCanvas_0=function(t,e){return new Rc(e,new re(t),new He(E.Companion.ZERO,t.size.toDoubleVector()))},Dc.prototype.render_wuw0ll$=function(t,n,i){if(!i.isEmpty()){var r;for(r=i.iterator();r.hasNext();){var o,a,s=r.next();if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(mc)))||e.isType(o,mc)?o:C()))throw S("Component "+p(mc).simpleName+" is not found");var l=a.canvasLayer;l.clear(),l.render(),s.removeComponent_9u06oy$(p(fc))}var u,c=J.PlatformAsyncs,h=rt(it(t,10));for(u=t.iterator();u.hasNext();){var _=u.next();h.add_11rb$(_.takeSnapshot())}c.composite_a4rjr8$(h).onSuccess_qlkmfe$((f=this.closure$singleCanvasControl,d=this.closure$rect,function(t){var e;for(f.context.clearRect_wthzt5$(d),e=t.iterator();e.hasNext();){var n=e.next();f.context.drawImage_xo47pw$(n,0,0)}return N}))}var f,d},Dc.$metadata$={kind:c,interfaces:[Vc]},zc.prototype.createLayerRenderingSystem=function(){return new Yc(this.closure$componentManager,new Dc(this.closure$singleCanvasControl,this.closure$rect))},zc.prototype.addLayer_kqh14j$=function(t,e){var n=new _c(this.closure$singleCanvasControl.createCanvas(),t);return this.myGroupedLayers_0.add_vanbej$(e,n),new mc(n)},zc.prototype.removeLayer_vanbej$=function(t,e){this.myGroupedLayers_0.remove_vanbej$(t,e)},zc.prototype.createLayersOrderComponent=function(){return new dc(this.myGroupedLayers_0)},zc.$metadata$={kind:c,interfaces:[jc]},Lc.prototype.offscreenLayers_0=function(t,e){return new zc(e,new re(t),new He(E.Companion.ZERO,t.size.toDoubleVector()))},Bc.prototype.render_wuw0ll$=function(t,n,i){var r;for(r=i.iterator();r.hasNext();){var o,a,s=r.next();if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(mc)))||e.isType(o,mc)?o:C()))throw S("Component "+p(mc).simpleName+" is not found");var l=a.canvasLayer;l.clear(),l.render(),s.removeComponent_9u06oy$(p(fc))}},Bc.$metadata$={kind:c,interfaces:[Vc]},Mc.prototype.createLayerRenderingSystem=function(){return new Yc(this.closure$componentManager,new Bc)},Mc.prototype.addLayer_kqh14j$=function(t,e){var n=this.closure$canvasControl.createCanvas_119tl4$(this.closure$canvasControl.size),i=new _c(n,t);return this.myGroupedLayers_0.add_vanbej$(e,i),this.closure$canvasControl.addChild_fwfip8$(this.myGroupedLayers_0.orderedLayers.indexOf_11rb$(i),n),new mc(i)},Mc.prototype.removeLayer_vanbej$=function(t,e){e.removeFrom_49gm0j$(this.closure$canvasControl),this.myGroupedLayers_0.remove_vanbej$(t,e)},Mc.prototype.createLayersOrderComponent=function(){return new dc(this.myGroupedLayers_0)},Mc.$metadata$={kind:c,interfaces:[jc]},Lc.prototype.screenLayers_0=function(t,e){return new Mc(e,t)},Lc.$metadata$={kind:b,simpleName:"LayerManagers",interfaces:[]};var Uc,Fc,qc,Gc=null;function Hc(){return null===Gc&&new Lc,Gc}function Yc(t,e){Bs.call(this,t),this.myRenderingStrategy_0=e,this.myDirtyLayers_0=w()}function Vc(){}function Kc(t,e){me.call(this),this.name$=t,this.ordinal$=e}function Wc(){Wc=function(){},Uc=new Kc("SINGLE_SCREEN_CANVAS",0),Fc=new Kc("OWN_OFFSCREEN_CANVAS",1),qc=new Kc("OWN_SCREEN_CANVAS",2)}function Xc(){return Wc(),Uc}function Zc(){return Wc(),Fc}function Jc(){return Wc(),qc}function Qc(){this.origin_eatjrl$_0=E.Companion.ZERO,this.dimension_n63b3r$_0=E.Companion.ZERO,this.center_0=E.Companion.ZERO,this.strokeColor=null,this.strokeWidth=null,this.angle=wt.PI/2,this.startAngle=0}function tp(t,e){this.origin_rgqk5e$_0=t,this.texts_0=e,this.dimension_z2jy5m$_0=E.Companion.ZERO,this.rectangle_0=new up,this.alignment_0=new tc,this.padding=0,this.background=k.Companion.TRANSPARENT}function ep(){this.origin_ccvchv$_0=E.Companion.ZERO,this.dimension_mpx8hh$_0=E.Companion.ZERO,this.center_0=E.Companion.ZERO,this.strokeColor=null,this.strokeWidth=null,this.fillColor=null}function np(t,e){op(),this.position_0=t,this.renderBoxes_0=e}function ip(){rp=this}Object.defineProperty(Yc.prototype,"dirtyLayers",{configurable:!0,get:function(){return this.myDirtyLayers_0}}),Yc.prototype.updateImpl_og8vrq$=function(t,n){var i,r,o=this.componentManager.getSingletonEntity_9u06oy$(p(dc));if(null==(r=null==(i=o.componentManager.getComponents_ahlfl2$(o).get_11rb$(p(dc)))||e.isType(i,dc)?i:C()))throw S("Component "+p(dc).simpleName+" is not found");var a,s=r.canvasLayers,l=Ft(this.getEntities_9u06oy$(p(mc))),u=Ft(this.getEntities_9u06oy$(p(fc)));for(this.myDirtyLayers_0.clear(),a=u.iterator();a.hasNext();){var c=a.next();this.myDirtyLayers_0.add_11rb$(c.id_8be2vx$)}this.myRenderingStrategy_0.render_wuw0ll$(s,l,u)},Vc.$metadata$={kind:v,simpleName:"RenderingStrategy",interfaces:[]},Yc.$metadata$={kind:c,simpleName:"LayersRenderingSystem",interfaces:[Bs]},Kc.$metadata$={kind:c,simpleName:"RenderTarget",interfaces:[me]},Kc.values=function(){return[Xc(),Zc(),Jc()]},Kc.valueOf_61zpoe$=function(t){switch(t){case"SINGLE_SCREEN_CANVAS":return Xc();case"OWN_OFFSCREEN_CANVAS":return Zc();case"OWN_SCREEN_CANVAS":return Jc();default:ye("No enum constant jetbrains.livemap.core.rendering.layers.RenderTarget."+t)}},Object.defineProperty(Qc.prototype,"origin",{configurable:!0,get:function(){return this.origin_eatjrl$_0},set:function(t){this.origin_eatjrl$_0=t,this.update_0()}}),Object.defineProperty(Qc.prototype,"dimension",{configurable:!0,get:function(){return this.dimension_n63b3r$_0},set:function(t){this.dimension_n63b3r$_0=t,this.update_0()}}),Qc.prototype.update_0=function(){this.center_0=this.dimension.mul_14dthe$(.5)},Qc.prototype.render_pzzegf$=function(t){var e,n;t.beginPath(),t.arc_6p3vsx$(this.center_0.x,this.center_0.y,this.dimension.x/2,this.startAngle,this.startAngle+this.angle),null!=(e=this.strokeWidth)&&t.setLineWidth_14dthe$(e),null!=(n=this.strokeColor)&&t.setStrokeStyle_2160e9$(n),t.stroke()},Qc.$metadata$={kind:c,simpleName:"Arc",interfaces:[cp]},Object.defineProperty(tp.prototype,"origin",{get:function(){return this.origin_rgqk5e$_0},set:function(t){this.origin_rgqk5e$_0=t}}),Object.defineProperty(tp.prototype,"dimension",{configurable:!0,get:function(){return this.dimension_z2jy5m$_0},set:function(t){this.dimension_z2jy5m$_0=t}}),Object.defineProperty(tp.prototype,"horizontalAlignment",{configurable:!0,get:function(){return this.alignment_0.horizontal},set:function(t){this.alignment_0.horizontal=t}}),Object.defineProperty(tp.prototype,"verticalAlignment",{configurable:!0,get:function(){return this.alignment_0.vertical},set:function(t){this.alignment_0.vertical=t}}),tp.prototype.render_pzzegf$=function(t){if(this.isDirty_0()){var e;for(e=this.texts_0.iterator();e.hasNext();){var n=e.next(),i=n.isDirty?n.measureText_pzzegf$(t):n.dimension;n.origin=new E(this.dimension.x+this.padding,this.padding);var r=this.dimension.x+i.x,o=this.dimension.y,a=i.y;this.dimension=new E(r,Z.max(o,a))}this.dimension=this.dimension.add_gpjtzr$(new E(2*this.padding,2*this.padding)),this.origin=this.alignment_0.calculatePosition_qt8ska$(this.origin,this.dimension);var s,l=this.rectangle_0;for(l.rect=new He(this.origin,this.dimension),l.color=this.background,s=this.texts_0.iterator();s.hasNext();){var u=s.next();u.origin=sp(u.origin,this.origin)}}var c;for(t.setTransform_15yvbs$(1,0,0,1,0,0),this.rectangle_0.render_pzzegf$(t),c=this.texts_0.iterator();c.hasNext();){var p=c.next();this.renderPrimitive_0(t,p)}},tp.prototype.renderPrimitive_0=function(t,e){t.save();var n=e.origin;t.setTransform_15yvbs$(1,0,0,1,n.x,n.y),e.render_pzzegf$(t),t.restore()},tp.prototype.isDirty_0=function(){var t,n=this.texts_0;t:do{var i;if(e.isType(n,dn)&&n.isEmpty()){t=!1;break t}for(i=n.iterator();i.hasNext();)if(i.next().isDirty){t=!0;break t}t=!1}while(0);return t},tp.$metadata$={kind:c,simpleName:"Attribution",interfaces:[cp]},Object.defineProperty(ep.prototype,"origin",{configurable:!0,get:function(){return this.origin_ccvchv$_0},set:function(t){this.origin_ccvchv$_0=t,this.update_0()}}),Object.defineProperty(ep.prototype,"dimension",{configurable:!0,get:function(){return this.dimension_mpx8hh$_0},set:function(t){this.dimension_mpx8hh$_0=t,this.update_0()}}),ep.prototype.update_0=function(){this.center_0=this.dimension.mul_14dthe$(.5)},ep.prototype.render_pzzegf$=function(t){var e,n,i;t.beginPath(),t.arc_6p3vsx$(this.center_0.x,this.center_0.y,this.dimension.x/2,0,2*wt.PI),null!=(e=this.fillColor)&&t.setFillStyle_2160e9$(e),t.fill(),null!=(n=this.strokeWidth)&&t.setLineWidth_14dthe$(n),null!=(i=this.strokeColor)&&t.setStrokeStyle_2160e9$(i),t.stroke()},ep.$metadata$={kind:c,simpleName:"Circle",interfaces:[cp]},Object.defineProperty(np.prototype,"origin",{configurable:!0,get:function(){return this.position_0}}),Object.defineProperty(np.prototype,"dimension",{configurable:!0,get:function(){return this.calculateDimension_0()}}),np.prototype.render_pzzegf$=function(t){var e;for(e=this.renderBoxes_0.iterator();e.hasNext();){var n=e.next();t.save();var i=n.origin;t.translate_lu1900$(i.x,i.y),n.render_pzzegf$(t),t.restore()}},np.prototype.calculateDimension_0=function(){var t,e=this.getRight_0(this.renderBoxes_0.get_za3lpa$(0)),n=this.getBottom_0(this.renderBoxes_0.get_za3lpa$(0));for(t=this.renderBoxes_0.iterator();t.hasNext();){var i=t.next(),r=e,o=this.getRight_0(i);e=Z.max(r,o);var a=n,s=this.getBottom_0(i);n=Z.max(a,s)}return new E(e,n)},np.prototype.getRight_0=function(t){return t.origin.x+this.renderBoxes_0.get_za3lpa$(0).dimension.x},np.prototype.getBottom_0=function(t){return t.origin.y+this.renderBoxes_0.get_za3lpa$(0).dimension.y},ip.prototype.create_x8r7ta$=function(t,e){return new np(t,mn(e))},ip.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var rp=null;function op(){return null===rp&&new ip,rp}function ap(t,e){this.origin_71rgz7$_0=t,this.text_0=e,this.frame_0=null,this.dimension_4cjgkr$_0=E.Companion.ZERO,this.rectangle_0=new up,this.alignment_0=new tc,this.padding=0,this.background=k.Companion.TRANSPARENT}function sp(t,e){return t.add_gpjtzr$(e)}function lp(t,e){this.origin_lg7k8u$_0=t,this.dimension_6s7c2u$_0=e,this.snapshot=null}function up(){this.rect=q(0,0,0,0),this.color=null}function cp(){}function pp(){}function hp(){this.origin_7b8a1y$_0=E.Companion.ZERO,this.dimension_bbzer6$_0=E.Companion.ZERO,this.text_tsqtfx$_0=at(),this.color=k.Companion.WHITE,this.isDirty_nrslik$_0=!0,this.fontSize=10,this.fontFamily="serif"}function _p(){gp=this}function fp(t){yp(),Bs.call(this,t)}function dp(){mp=this,this.COMPONENT_TYPES_0=x([p($p),p(Ch),p(yc)])}np.$metadata$={kind:c,simpleName:"Frame",interfaces:[cp]},Object.defineProperty(ap.prototype,"origin",{get:function(){return this.origin_71rgz7$_0},set:function(t){this.origin_71rgz7$_0=t}}),Object.defineProperty(ap.prototype,"dimension",{configurable:!0,get:function(){return this.dimension_4cjgkr$_0},set:function(t){this.dimension_4cjgkr$_0=t}}),Object.defineProperty(ap.prototype,"horizontalAlignment",{configurable:!0,get:function(){return this.alignment_0.horizontal},set:function(t){this.alignment_0.horizontal=t}}),Object.defineProperty(ap.prototype,"verticalAlignment",{configurable:!0,get:function(){return this.alignment_0.vertical},set:function(t){this.alignment_0.vertical=t}}),ap.prototype.render_pzzegf$=function(t){var e;if(this.text_0.isDirty){this.dimension=sp(this.text_0.measureText_pzzegf$(t),new E(2*this.padding,2*this.padding));var n=this.rectangle_0;n.rect=new He(E.Companion.ZERO,this.dimension),n.color=this.background,this.origin=this.alignment_0.calculatePosition_qt8ska$(this.origin,this.dimension),this.text_0.origin=new E(this.padding,this.padding),this.frame_0=op().create_x8r7ta$(this.origin,[this.rectangle_0,this.text_0])}null!=(e=this.frame_0)&&e.render_pzzegf$(t)},ap.$metadata$={kind:c,simpleName:"Label",interfaces:[cp]},Object.defineProperty(lp.prototype,"origin",{get:function(){return this.origin_lg7k8u$_0}}),Object.defineProperty(lp.prototype,"dimension",{get:function(){return this.dimension_6s7c2u$_0}}),lp.prototype.render_pzzegf$=function(t){var e;null!=(e=this.snapshot)&&t.drawImage_nks7bk$(e,0,0,this.dimension.x,this.dimension.y)},lp.$metadata$={kind:c,simpleName:"MutableImage",interfaces:[cp]},Object.defineProperty(up.prototype,"origin",{configurable:!0,get:function(){return this.rect.origin}}),Object.defineProperty(up.prototype,"dimension",{configurable:!0,get:function(){return this.rect.dimension}}),up.prototype.render_pzzegf$=function(t){var e;null!=(e=this.color)&&t.setFillStyle_2160e9$(e),t.fillRect_6y0v78$(this.rect.left,this.rect.top,this.rect.width,this.rect.height)},up.$metadata$={kind:c,simpleName:"Rectangle",interfaces:[cp]},cp.$metadata$={kind:v,simpleName:"RenderBox",interfaces:[pp]},pp.$metadata$={kind:v,simpleName:"RenderObject",interfaces:[]},Object.defineProperty(hp.prototype,"origin",{configurable:!0,get:function(){return this.origin_7b8a1y$_0},set:function(t){this.origin_7b8a1y$_0=t}}),Object.defineProperty(hp.prototype,"dimension",{configurable:!0,get:function(){return this.dimension_bbzer6$_0},set:function(t){this.dimension_bbzer6$_0=t}}),Object.defineProperty(hp.prototype,"text",{configurable:!0,get:function(){return this.text_tsqtfx$_0},set:function(t){this.text_tsqtfx$_0=t,this.isDirty=!0}}),Object.defineProperty(hp.prototype,"isDirty",{configurable:!0,get:function(){return this.isDirty_nrslik$_0},set:function(t){this.isDirty_nrslik$_0=t}}),hp.prototype.render_pzzegf$=function(t){var e;t.setFont_ov8mpe$(new le(void 0,void 0,this.fontSize,this.fontFamily)),t.setTextBaseline_5cz80h$(ae.BOTTOM),this.isDirty&&(this.dimension=this.calculateDimension_0(t),this.isDirty=!1),t.setFillStyle_2160e9$(this.color);var n=this.fontSize;for(e=this.text.iterator();e.hasNext();){var i=e.next();t.fillText_ai6r6m$(i,0,n),n+=this.fontSize}},hp.prototype.measureText_pzzegf$=function(t){return this.isDirty&&(t.save(),t.setFont_ov8mpe$(new le(void 0,void 0,this.fontSize,this.fontFamily)),t.setTextBaseline_5cz80h$(ae.BOTTOM),this.dimension=this.calculateDimension_0(t),this.isDirty=!1,t.restore()),this.dimension},hp.prototype.calculateDimension_0=function(t){var e,n=0;for(e=this.text.iterator();e.hasNext();){var i=e.next(),r=n,o=t.measureText_61zpoe$(i);n=Z.max(r,o)}return new E(n,this.text.size*this.fontSize)},hp.$metadata$={kind:c,simpleName:"Text",interfaces:[cp]},_p.prototype.length_0=function(t,e){var n=e.x-t.x,i=e.y-t.y,r=n*n+i*i;return Z.sqrt(r)},fp.prototype.updateImpl_og8vrq$=function(t,n){var i,r;for(i=this.getEntities_38uplf$(yp().COMPONENT_TYPES_0).iterator();i.hasNext();){var o,a,s=i.next(),l=gt.GeometryUtil;if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(Ch)))||e.isType(o,Ch)?o:C()))throw S("Component "+p(Ch).simpleName+" is not found");var u,c,h=l.asLineString_8ft4gs$(a.geometry);if(null==(c=null==(u=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p($p)))||e.isType(u,$p)?u:C()))throw S("Component "+p($p).simpleName+" is not found");var _=c;if(_.lengthIndex.isEmpty()&&this.init_0(_,h),null==(r=this.getEntityById_za3lpa$(_.animationId)))return;var f,d,m=r;if(null==(d=null==(f=m.componentManager.getComponents_ahlfl2$(m).get_11rb$(p(Us)))||e.isType(f,Us)?f:C()))throw S("Component "+p(Us).simpleName+" is not found");this.calculateEffectState_0(_,h,d.progress),kc().tagDirtyParentLayer_ahlfl2$(s)}},fp.prototype.init_0=function(t,e){var n,i={v:0},r=rt(e.size);r.add_11rb$(0),n=e.size;for(var o=1;o=0)return t.endIndex=o,void(t.interpolatedPoint=null);if((o=~o-1|0)==(i.size-1|0))return t.endIndex=o,void(t.interpolatedPoint=null);var a=i.get_za3lpa$(o),s=i.get_za3lpa$(o+1|0)-a;if(s>2){var l=(n-a/r)/(s/r),u=e.get_za3lpa$(o),c=e.get_za3lpa$(o+1|0);t.endIndex=o,t.interpolatedPoint=H(u.x+(c.x-u.x)*l,u.y+(c.y-u.y)*l)}else t.endIndex=o,t.interpolatedPoint=null},dp.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var mp=null;function yp(){return null===mp&&new dp,mp}function $p(){this.animationId=0,this.lengthIndex=at(),this.length=0,this.endIndex=0,this.interpolatedPoint=null}function vp(){}fp.$metadata$={kind:c,simpleName:"GrowingPathEffectSystem",interfaces:[Bs]},$p.$metadata$={kind:c,simpleName:"GrowingPathEffectComponent",interfaces:[Ys]},vp.prototype.render_j83es7$=function(t,n){var i,r,o;if(t.contains_9u06oy$(p(Ch))){var a,s;if(null==(s=null==(a=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(hf)))||e.isType(a,hf)?a:C()))throw S("Component "+p(hf).simpleName+" is not found");var l,u,c=s;if(null==(u=null==(l=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Ch)))||e.isType(l,Ch)?l:C()))throw S("Component "+p(Ch).simpleName+" is not found");var h,_,f=u.geometry;if(null==(_=null==(h=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p($p)))||e.isType(h,$p)?h:C()))throw S("Component "+p($p).simpleName+" is not found");var d=_;for(n.setStrokeStyle_2160e9$(c.strokeColor),n.setLineWidth_14dthe$(c.strokeWidth),n.beginPath(),i=f.iterator();i.hasNext();){var m=i.next().get_za3lpa$(0),y=m.get_za3lpa$(0);n.moveTo_lu1900$(y.x,y.y),r=d.endIndex;for(var $=1;$<=r;$++)y=m.get_za3lpa$($),n.lineTo_lu1900$(y.x,y.y);null!=(o=d.interpolatedPoint)&&n.lineTo_lu1900$(o.x,o.y)}n.stroke()}},vp.$metadata$={kind:c,simpleName:"GrowingPathRenderer",interfaces:[Sf]},_p.$metadata$={kind:b,simpleName:"GrowingPath",interfaces:[]};var gp=null;function bp(){return null===gp&&new _p,gp}function wp(t){Cp(),Bs.call(this,t),this.myMapProjection_1mw1qp$_0=this.myMapProjection_1mw1qp$_0}function xp(t,e){return function(n){return e.get_worldPointInitializer_0(t)(n,e.myMapProjection_0.project_11rb$(e.get_point_0(t))),N}}function kp(){Ep=this,this.NEED_APPLY=x([p(Qp),p(oh)])}Object.defineProperty(wp.prototype,"myMapProjection_0",{configurable:!0,get:function(){return null==this.myMapProjection_1mw1qp$_0?T("myMapProjection"):this.myMapProjection_1mw1qp$_0},set:function(t){this.myMapProjection_1mw1qp$_0=t}}),wp.prototype.initImpl_4pvjek$=function(t){this.myMapProjection_0=t.mapProjection},wp.prototype.updateImpl_og8vrq$=function(t,e){var n;for(n=this.getMutableEntities_38uplf$(Cp().NEED_APPLY).iterator();n.hasNext();){var i=n.next();Qs(i,xp(i,this)),kc().tagDirtyParentLayer_ahlfl2$(i),i.removeComponent_9u06oy$(p(Qp)),i.removeComponent_9u06oy$(p(oh))}},wp.prototype.get_point_0=function(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Qp)))||e.isType(n,Qp)?n:C()))throw S("Component "+p(Qp).simpleName+" is not found");return i.point},wp.prototype.get_worldPointInitializer_0=function(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(oh)))||e.isType(n,oh)?n:C()))throw S("Component "+p(oh).simpleName+" is not found");return i.worldPointInitializer},kp.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Ep=null;function Cp(){return null===Ep&&new kp,Ep}function Sp(t,e){Pp(),Bs.call(this,t),this.myGeocodingService_0=e}function Tp(t){var e,n=d("request",1,(function(t){return t.request})),i=wn(bn(it(t,10)),16),r=xn(i);for(e=t.iterator();e.hasNext();){var o=e.next();r.put_xwzc9p$(n(o),o)}return r}function Op(){Np=this,this.NEED_BBOX=x([p(zp),p(th)]),this.WAIT_BBOX=x([p(zp),p(eh),p(A_)])}wp.$metadata$={kind:c,simpleName:"ApplyPointSystem",interfaces:[Bs]},Sp.prototype.updateImpl_og8vrq$=function(t,n){var i=this.getMutableEntities_38uplf$(Pp().NEED_BBOX);if(!i.isEmpty()){var r,o=rt(it(i,10));for(r=i.iterator();r.hasNext();){var a,s,l=r.next(),u=o.add_11rb$;if(null==(s=null==(a=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(zp)))||e.isType(a,zp)?a:C()))throw S("Component "+p(zp).simpleName+" is not found");u.call(o,s.regionId)}var c,h=$n(o),_=(new vn).setIds_mhpeer$(h).setFeatures_kzd2fe$(ct(gn.LIMIT)).build();for(A("execute",function(t,e){return t.execute_2yxzh4$(e)}.bind(null,this.myGeocodingService_0))(_).map_2o04qz$(Tp).map_2o04qz$(A("parseBBoxMap",function(t,e){return t.parseBBoxMap_0(e),N}.bind(null,this))),c=i.iterator();c.hasNext();){var f=c.next();f.add_57nep2$(ih()),f.removeComponent_9u06oy$(p(th))}}},Sp.prototype.parseBBoxMap_0=function(t){var n;for(n=this.getMutableEntities_38uplf$(Pp().WAIT_BBOX).iterator();n.hasNext();){var i,r,o,a,s=n.next();if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(zp)))||e.isType(o,zp)?o:C()))throw S("Component "+p(zp).simpleName+" is not found");null!=(r=null!=(i=t.get_11rb$(a.regionId))?i.limit:null)&&(s.add_57nep2$(new rh(r)),s.removeComponent_9u06oy$(p(eh)))}},Op.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Np=null;function Pp(){return null===Np&&new Op,Np}function Ap(t,e){Ip(),Bs.call(this,t),this.myGeocodingService_0=e,this.myProject_4p7cfa$_0=this.myProject_4p7cfa$_0}function jp(t){var e,n=d("request",1,(function(t){return t.request})),i=wn(bn(it(t,10)),16),r=xn(i);for(e=t.iterator();e.hasNext();){var o=e.next();r.put_xwzc9p$(n(o),o)}return r}function Lp(){Rp=this,this.NEED_CENTROID=x([p(Dp),p(zp)]),this.WAIT_CENTROID=x([p(Mp),p(zp)])}Sp.$metadata$={kind:c,simpleName:"BBoxGeocodingSystem",interfaces:[Bs]},Object.defineProperty(Ap.prototype,"myProject_0",{configurable:!0,get:function(){return null==this.myProject_4p7cfa$_0?T("myProject"):this.myProject_4p7cfa$_0},set:function(t){this.myProject_4p7cfa$_0=t}}),Ap.prototype.initImpl_4pvjek$=function(t){this.myProject_0=A("project",function(t,e){return t.project_11rb$(e)}.bind(null,t.mapProjection))},Ap.prototype.updateImpl_og8vrq$=function(t,n){var i=this.getMutableEntities_38uplf$(Ip().NEED_CENTROID);if(!i.isEmpty()){var r,o=rt(it(i,10));for(r=i.iterator();r.hasNext();){var a,s,l=r.next(),u=o.add_11rb$;if(null==(s=null==(a=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(zp)))||e.isType(a,zp)?a:C()))throw S("Component "+p(zp).simpleName+" is not found");u.call(o,s.regionId)}var c,h=$n(o),_=(new vn).setIds_mhpeer$(h).setFeatures_kzd2fe$(ct(gn.CENTROID)).build();for(A("execute",function(t,e){return t.execute_2yxzh4$(e)}.bind(null,this.myGeocodingService_0))(_).map_2o04qz$(jp).map_2o04qz$(A("parseCentroidMap",function(t,e){return t.parseCentroidMap_0(e),N}.bind(null,this))),c=i.iterator();c.hasNext();){var f=c.next();f.add_57nep2$(Up()),f.removeComponent_9u06oy$(p(Dp))}}},Ap.prototype.parseCentroidMap_0=function(t){var n;for(n=this.getMutableEntities_38uplf$(Ip().WAIT_CENTROID).iterator();n.hasNext();){var i,r,o,a,s=n.next();if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(zp)))||e.isType(o,zp)?o:C()))throw S("Component "+p(zp).simpleName+" is not found");null!=(r=null!=(i=t.get_11rb$(a.regionId))?i.centroid:null)&&(s.add_57nep2$(new Qp(kn(r))),s.removeComponent_9u06oy$(p(Mp)))}},Lp.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Rp=null;function Ip(){return null===Rp&&new Lp,Rp}function zp(t){this.regionId=t}function Dp(){}function Mp(){Bp=this}Ap.$metadata$={kind:c,simpleName:"CentroidGeocodingSystem",interfaces:[Bs]},zp.$metadata$={kind:c,simpleName:"RegionIdComponent",interfaces:[Ys]},Dp.$metadata$={kind:b,simpleName:"NeedCentroidComponent",interfaces:[Ys]},Mp.$metadata$={kind:b,simpleName:"WaitCentroidComponent",interfaces:[Ys]};var Bp=null;function Up(){return null===Bp&&new Mp,Bp}function Fp(){qp=this}Fp.$metadata$={kind:b,simpleName:"NeedLocationComponent",interfaces:[Ys]};var qp=null;function Gp(){return null===qp&&new Fp,qp}function Hp(){}function Yp(){Vp=this}Hp.$metadata$={kind:b,simpleName:"NeedGeocodeLocationComponent",interfaces:[Ys]},Yp.$metadata$={kind:b,simpleName:"WaitGeocodeLocationComponent",interfaces:[Ys]};var Vp=null;function Kp(){return null===Vp&&new Yp,Vp}function Wp(){Xp=this}Wp.$metadata$={kind:b,simpleName:"NeedCalculateLocationComponent",interfaces:[Ys]};var Xp=null;function Zp(){return null===Xp&&new Wp,Xp}function Jp(){this.myWaitingCount_0=null,this.locations=w()}function Qp(t){this.point=t}function th(){}function eh(){nh=this}Jp.prototype.add_9badfu$=function(t){this.locations.add_11rb$(t)},Jp.prototype.wait_za3lpa$=function(t){var e,n;this.myWaitingCount_0=null!=(n=null!=(e=this.myWaitingCount_0)?e+t|0:null)?n:t},Jp.prototype.isReady=function(){return null!=this.myWaitingCount_0&&this.myWaitingCount_0===this.locations.size},Jp.$metadata$={kind:c,simpleName:"LocationComponent",interfaces:[Ys]},Qp.$metadata$={kind:c,simpleName:"LonLatComponent",interfaces:[Ys]},th.$metadata$={kind:b,simpleName:"NeedBboxComponent",interfaces:[Ys]},eh.$metadata$={kind:b,simpleName:"WaitBboxComponent",interfaces:[Ys]};var nh=null;function ih(){return null===nh&&new eh,nh}function rh(t){this.bbox=t}function oh(t){this.worldPointInitializer=t}function ah(t,e){uh(),Bs.call(this,e),this.mapRuler_0=t,this.myLocation_f4pf0e$_0=this.myLocation_f4pf0e$_0}function sh(){lh=this,this.READY_CALCULATE=ct(p(Wp))}rh.$metadata$={kind:c,simpleName:"RegionBBoxComponent",interfaces:[Ys]},oh.$metadata$={kind:c,simpleName:"PointInitializerComponent",interfaces:[Ys]},Object.defineProperty(ah.prototype,"myLocation_0",{configurable:!0,get:function(){return null==this.myLocation_f4pf0e$_0?T("myLocation"):this.myLocation_f4pf0e$_0},set:function(t){this.myLocation_f4pf0e$_0=t}}),ah.prototype.initImpl_4pvjek$=function(t){var n,i,r=this.componentManager.getSingletonEntity_9u06oy$(p(Jp));if(null==(i=null==(n=r.componentManager.getComponents_ahlfl2$(r).get_11rb$(p(Jp)))||e.isType(n,Jp)?n:C()))throw S("Component "+p(Jp).simpleName+" is not found");this.myLocation_0=i},ah.prototype.updateImpl_og8vrq$=function(t,n){var i;for(i=this.getMutableEntities_38uplf$(uh().READY_CALCULATE).iterator();i.hasNext();){var r,o,a,s,l,u,c=i.next();if(c.contains_9u06oy$(p(Ah))){var h,_;if(null==(_=null==(h=c.componentManager.getComponents_ahlfl2$(c).get_11rb$(p(Ah)))||e.isType(h,Ah)?h:C()))throw S("Component "+p(Ah).simpleName+" is not found");if(null==(o=null!=(r=_.geometry)?this.mapRuler_0.calculateBoundingBox_yqwbdx$(En(r)):null))throw S("Unexpected - no geometry".toString());u=o}else if(c.contains_9u06oy$(p(qh))){var f,d,m;if(null==(d=null==(f=c.componentManager.getComponents_ahlfl2$(c).get_11rb$(p(qh)))||e.isType(f,qh)?f:C()))throw S("Component "+p(qh).simpleName+" is not found");if(a=d.origin,c.contains_9u06oy$(p(Fh))){var y,$;if(null==($=null==(y=c.componentManager.getComponents_ahlfl2$(c).get_11rb$(p(Fh)))||e.isType(y,Fh)?y:C()))throw S("Component "+p(Fh).simpleName+" is not found");m=$}else m=null;u=new zt(a,null!=(l=null!=(s=m)?s.dimension:null)?l:f_().ZERO_WORLD_POINT)}else u=null;null!=u&&(this.myLocation_0.add_9badfu$(u),c.removeComponent_9u06oy$(p(Wp)))}},sh.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var lh=null;function uh(){return null===lh&&new sh,lh}function ch(t,e){Bs.call(this,t),this.myNeedLocation_0=e,this.myLocation_0=new Jp}function ph(t,e){mh(),Bs.call(this,t),this.myGeocodingService_0=e,this.myLocation_7uyaqx$_0=this.myLocation_7uyaqx$_0,this.myMapProjection_mkxcyr$_0=this.myMapProjection_mkxcyr$_0}function hh(t){var e,n=d("request",1,(function(t){return t.request})),i=wn(bn(it(t,10)),16),r=xn(i);for(e=t.iterator();e.hasNext();){var o=e.next();r.put_xwzc9p$(n(o),o)}return r}function _h(){dh=this,this.NEED_LOCATION=x([p(zp),p(Hp)]),this.WAIT_LOCATION=x([p(zp),p(Yp)])}ah.$metadata$={kind:c,simpleName:"LocationCalculateSystem",interfaces:[Bs]},ch.prototype.initImpl_4pvjek$=function(t){this.createEntity_61zpoe$("LocationSingleton").add_57nep2$(this.myLocation_0)},ch.prototype.updateImpl_og8vrq$=function(t,e){var n,i,r=Ft(this.componentManager.getEntities_9u06oy$(p(Fp)));if(this.myNeedLocation_0)this.myLocation_0.wait_za3lpa$(r.size);else for(n=r.iterator();n.hasNext();){var o=n.next();o.removeComponent_9u06oy$(p(Wp)),o.removeComponent_9u06oy$(p(Hp))}for(i=r.iterator();i.hasNext();)i.next().removeComponent_9u06oy$(p(Fp))},ch.$metadata$={kind:c,simpleName:"LocationCounterSystem",interfaces:[Bs]},Object.defineProperty(ph.prototype,"myLocation_0",{configurable:!0,get:function(){return null==this.myLocation_7uyaqx$_0?T("myLocation"):this.myLocation_7uyaqx$_0},set:function(t){this.myLocation_7uyaqx$_0=t}}),Object.defineProperty(ph.prototype,"myMapProjection_0",{configurable:!0,get:function(){return null==this.myMapProjection_mkxcyr$_0?T("myMapProjection"):this.myMapProjection_mkxcyr$_0},set:function(t){this.myMapProjection_mkxcyr$_0=t}}),ph.prototype.initImpl_4pvjek$=function(t){var n,i,r=this.componentManager.getSingletonEntity_9u06oy$(p(Jp));if(null==(i=null==(n=r.componentManager.getComponents_ahlfl2$(r).get_11rb$(p(Jp)))||e.isType(n,Jp)?n:C()))throw S("Component "+p(Jp).simpleName+" is not found");this.myLocation_0=i,this.myMapProjection_0=t.mapProjection},ph.prototype.updateImpl_og8vrq$=function(t,n){var i=this.getMutableEntities_38uplf$(mh().NEED_LOCATION);if(!i.isEmpty()){var r,o=rt(it(i,10));for(r=i.iterator();r.hasNext();){var a,s,l=r.next(),u=o.add_11rb$;if(null==(s=null==(a=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(zp)))||e.isType(a,zp)?a:C()))throw S("Component "+p(zp).simpleName+" is not found");u.call(o,s.regionId)}var c,h=$n(o),_=(new vn).setIds_mhpeer$(h).setFeatures_kzd2fe$(ct(gn.POSITION)).build();for(A("execute",function(t,e){return t.execute_2yxzh4$(e)}.bind(null,this.myGeocodingService_0))(_).map_2o04qz$(hh).map_2o04qz$(A("parseLocationMap",function(t,e){return t.parseLocationMap_0(e),N}.bind(null,this))),c=i.iterator();c.hasNext();){var f=c.next();f.add_57nep2$(Kp()),f.removeComponent_9u06oy$(p(Hp))}}},ph.prototype.parseLocationMap_0=function(t){var n;for(n=this.getMutableEntities_38uplf$(mh().WAIT_LOCATION).iterator();n.hasNext();){var i,r,o,a,s=n.next();if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(zp)))||e.isType(o,zp)?o:C()))throw S("Component "+p(zp).simpleName+" is not found");if(null!=(r=null!=(i=t.get_11rb$(a.regionId))?i.position:null)){var l,u=jd().convertToWorldRects_oq2oou$(r,this.myMapProjection_0),c=A("add",function(t,e){return t.add_9badfu$(e),N}.bind(null,this.myLocation_0));for(l=u.iterator();l.hasNext();)c(l.next());s.removeComponent_9u06oy$(p(Yp))}}},_h.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var fh,dh=null;function mh(){return null===dh&&new _h,dh}function yh(t,e,n){Bs.call(this,t),this.myZoom_0=e,this.myLocationRect_0=n,this.myLocation_9g9fb6$_0=this.myLocation_9g9fb6$_0,this.myCamera_khy6qa$_0=this.myCamera_khy6qa$_0,this.myViewport_3hrnxt$_0=this.myViewport_3hrnxt$_0,this.myDefaultLocation_fypjfr$_0=this.myDefaultLocation_fypjfr$_0,this.myNeedLocation_0=!0}function $h(t,e){return function(n){t.myNeedLocation_0=!1;var i=t,r=ct(n);return i.calculatePosition_0(A("calculateBoundingBox",function(t,e){return t.calculateBoundingBox_anatxn$(e)}.bind(null,t.myViewport_0))(r),function(t,e){return function(n,i){return e.setCameraPosition_0(t,n,i),N}}(e,t)),N}}function vh(){bh=this}function gh(t){this.myTransform_0=t,this.myAdaptiveResampling_0=new Kl(this.myTransform_0,fh),this.myPrevPoint_0=null,this.myRing_0=null}ph.$metadata$={kind:c,simpleName:"LocationGeocodingSystem",interfaces:[Bs]},Object.defineProperty(yh.prototype,"myLocation_0",{configurable:!0,get:function(){return null==this.myLocation_9g9fb6$_0?T("myLocation"):this.myLocation_9g9fb6$_0},set:function(t){this.myLocation_9g9fb6$_0=t}}),Object.defineProperty(yh.prototype,"myCamera_0",{configurable:!0,get:function(){return null==this.myCamera_khy6qa$_0?T("myCamera"):this.myCamera_khy6qa$_0},set:function(t){this.myCamera_khy6qa$_0=t}}),Object.defineProperty(yh.prototype,"myViewport_0",{configurable:!0,get:function(){return null==this.myViewport_3hrnxt$_0?T("myViewport"):this.myViewport_3hrnxt$_0},set:function(t){this.myViewport_3hrnxt$_0=t}}),Object.defineProperty(yh.prototype,"myDefaultLocation_0",{configurable:!0,get:function(){return null==this.myDefaultLocation_fypjfr$_0?T("myDefaultLocation"):this.myDefaultLocation_fypjfr$_0},set:function(t){this.myDefaultLocation_fypjfr$_0=t}}),yh.prototype.initImpl_4pvjek$=function(t){var n,i,r=this.componentManager.getSingletonEntity_9u06oy$(p(Jp));if(null==(i=null==(n=r.componentManager.getComponents_ahlfl2$(r).get_11rb$(p(Jp)))||e.isType(n,Jp)?n:C()))throw S("Component "+p(Jp).simpleName+" is not found");this.myLocation_0=i,this.myCamera_0=this.getSingletonEntity_9u06oy$(p(ko)),this.myViewport_0=t.mapRenderContext.viewport,this.myDefaultLocation_0=jd().convertToWorldRects_oq2oou$(Wi().DEFAULT_LOCATION,t.mapProjection)},yh.prototype.updateImpl_og8vrq$=function(t,e){var n,i,r;if(this.myNeedLocation_0)if(null!=this.myLocationRect_0)this.myLocationRect_0.map_2o04qz$($h(this,t));else if(this.myLocation_0.isReady()){this.myNeedLocation_0=!1;var o=this.myLocation_0.locations,a=null!=(n=o.isEmpty()?null:o)?n:this.myDefaultLocation_0;this.calculatePosition_0(A("calculateBoundingBox",function(t,e){return t.calculateBoundingBox_anatxn$(e)}.bind(null,this.myViewport_0))(a),(i=t,r=this,function(t,e){return r.setCameraPosition_0(i,t,e),N}))}},yh.prototype.calculatePosition_0=function(t,e){var n;null==(n=this.myZoom_0)&&(n=0!==t.dimension.x&&0!==t.dimension.y?this.calculateMaxZoom_0(t.dimension,this.myViewport_0.size):this.calculateMaxZoom_0(this.myViewport_0.calculateBoundingBox_anatxn$(this.myDefaultLocation_0).dimension,this.myViewport_0.size)),e(n,Ce(t))},yh.prototype.setCameraPosition_0=function(t,e,n){t.camera.requestZoom_14dthe$(Z.floor(e)),t.camera.requestPosition_c01uj8$(n)},yh.prototype.calculateMaxZoom_0=function(t,e){var n=this.calculateMaxZoom_1(t.x,e.x),i=this.calculateMaxZoom_1(t.y,e.y),r=Z.min(n,i),o=this.myViewport_0.minZoom,a=this.myViewport_0.maxZoom,s=Z.min(r,a);return Z.max(o,s)},yh.prototype.calculateMaxZoom_1=function(t,e){var n;if(0===t)return this.myViewport_0.maxZoom;if(0===e)n=this.myViewport_0.minZoom;else{var i=e/t;n=Z.log(i)/Z.log(2)}return n},yh.$metadata$={kind:c,simpleName:"MapLocationInitializationSystem",interfaces:[Bs]},vh.prototype.resampling_2z2okz$=function(t,e){return this.createTransformer_0(t,this.resampling_0(e))},vh.prototype.simple_c0yqik$=function(t,e){return new Eh(t,this.simple_0(e))},vh.prototype.resampling_c0yqik$=function(t,e){return new Eh(t,this.resampling_0(e))},vh.prototype.simple_0=function(t){return e=t,function(t,n){return n.add_11rb$(e(t)),N};var e},vh.prototype.resampling_0=function(t){return A("next",function(t,e,n){return t.next_2w6fi5$(e,n),N}.bind(null,new gh(t)))},vh.prototype.createTransformer_0=function(t,n){var i;switch(t.type.name){case"MULTI_POLYGON":i=Al(new Eh(t.multiPolygon,n),A("createMultiPolygon",(function(t){return Cn.Companion.createMultiPolygon_8ft4gs$(t)})));break;case"MULTI_LINESTRING":i=Al(new xh(t.multiLineString,n),A("createMultiLineString",(function(t){return Cn.Companion.createMultiLineString_bc4hlz$(t)})));break;case"MULTI_POINT":i=Al(new kh(t.multiPoint,n),A("createMultiPoint",(function(t){return Cn.Companion.createMultiPoint_xgn53i$(t)})));break;default:i=e.noWhenBranchMatched()}return i},gh.prototype.next_2w6fi5$=function(t,e){var n;for(null!=this.myRing_0&&e===this.myRing_0||(this.myRing_0=e,this.myPrevPoint_0=null),n=this.resample_0(t).iterator();n.hasNext();){var i=n.next();s(this.myRing_0).add_11rb$(this.myTransform_0(i))}},gh.prototype.resample_0=function(t){var e,n=this.myPrevPoint_0;if(this.myPrevPoint_0=t,null!=n){var i=this.myAdaptiveResampling_0.resample_rbt1hw$(n,t);e=i.subList_vux9f0$(1,i.size)}else e=ct(t);return e},gh.$metadata$={kind:c,simpleName:"IterativeResampler",interfaces:[]},vh.$metadata$={kind:b,simpleName:"GeometryTransform",interfaces:[]};var bh=null;function wh(){return null===bh&&new vh,bh}function xh(t,n){this.myTransform_0=n,this.myLineStringIterator_go6o1r$_0=this.myLineStringIterator_go6o1r$_0,this.myPointIterator_8dl2ke$_0=this.myPointIterator_8dl2ke$_0,this.myNewLineString_0=w(),this.myNewMultiLineString_0=w(),this.myHasNext_0=!0,this.myResult_pphhuf$_0=this.myResult_pphhuf$_0;try{this.myLineStringIterator_0=t.iterator(),this.myPointIterator_0=this.myLineStringIterator_0.next().iterator()}catch(t){if(!e.isType(t,Nn))throw t;On(t)}}function kh(t,n){this.myTransform_0=n,this.myPointIterator_dr5tzt$_0=this.myPointIterator_dr5tzt$_0,this.myNewMultiPoint_0=w(),this.myHasNext_0=!0,this.myResult_kbfpjm$_0=this.myResult_kbfpjm$_0;try{this.myPointIterator_0=t.iterator()}catch(t){if(!e.isType(t,Nn))throw t;On(t)}}function Eh(t,n){this.myTransform_0=n,this.myPolygonsIterator_luodmq$_0=this.myPolygonsIterator_luodmq$_0,this.myRingIterator_1fq3dz$_0=this.myRingIterator_1fq3dz$_0,this.myPointIterator_tmjm9$_0=this.myPointIterator_tmjm9$_0,this.myNewRing_0=w(),this.myNewPolygon_0=w(),this.myNewMultiPolygon_0=w(),this.myHasNext_0=!0,this.myResult_7m5cwo$_0=this.myResult_7m5cwo$_0;try{this.myPolygonsIterator_0=t.iterator(),this.myRingIterator_0=this.myPolygonsIterator_0.next().iterator(),this.myPointIterator_0=this.myRingIterator_0.next().iterator()}catch(t){if(!e.isType(t,Nn))throw t;On(t)}}function Ch(){this.geometry_ycd7cj$_0=this.geometry_ycd7cj$_0,this.zoom=0}function Sh(t,e){Ph(),Bs.call(this,e),this.myQuantIterations_0=t}function Th(t,n,i){return function(r){return i.runLaterBySystem_ayosff$(t,function(t,n){return function(i){var r,o;if(kc().tagDirtyParentLayer_ahlfl2$(i),i.contains_9u06oy$(p(Ch))){var a,s;if(null==(s=null==(a=i.componentManager.getComponents_ahlfl2$(i).get_11rb$(p(Ch)))||e.isType(a,Ch)?a:C()))throw S("Component "+p(Ch).simpleName+" is not found");o=s}else{var l=new Ch;i.add_57nep2$(l),o=l}var u,c=o,h=t,_=n;if(c.geometry=h,c.zoom=_,i.contains_9u06oy$(p(qf))){var f,d;if(null==(d=null==(f=i.componentManager.getComponents_ahlfl2$(i).get_11rb$(p(qf)))||e.isType(f,qf)?f:C()))throw S("Component "+p(qf).simpleName+" is not found");u=d}else u=null;return null!=(r=u)&&(r.zoom=n,r.scale=1),N}}(r,n)),N}}function Oh(){Nh=this,this.COMPONENT_TYPES_0=x([p(bo),p(qh),p(Ah),p(Jh),p(yc)])}Object.defineProperty(xh.prototype,"myLineStringIterator_0",{configurable:!0,get:function(){return null==this.myLineStringIterator_go6o1r$_0?T("myLineStringIterator"):this.myLineStringIterator_go6o1r$_0},set:function(t){this.myLineStringIterator_go6o1r$_0=t}}),Object.defineProperty(xh.prototype,"myPointIterator_0",{configurable:!0,get:function(){return null==this.myPointIterator_8dl2ke$_0?T("myPointIterator"):this.myPointIterator_8dl2ke$_0},set:function(t){this.myPointIterator_8dl2ke$_0=t}}),Object.defineProperty(xh.prototype,"myResult_0",{configurable:!0,get:function(){return null==this.myResult_pphhuf$_0?T("myResult"):this.myResult_pphhuf$_0},set:function(t){this.myResult_pphhuf$_0=t}}),xh.prototype.getResult=function(){return this.myResult_0},xh.prototype.resume=function(){if(!this.myPointIterator_0.hasNext()){if(this.myNewMultiLineString_0.add_11rb$(new Sn(this.myNewLineString_0)),!this.myLineStringIterator_0.hasNext())return this.myHasNext_0=!1,void(this.myResult_0=new Tn(this.myNewMultiLineString_0));this.myPointIterator_0=this.myLineStringIterator_0.next().iterator(),this.myNewLineString_0=w()}this.myTransform_0(this.myPointIterator_0.next(),this.myNewLineString_0)},xh.prototype.alive=function(){return this.myHasNext_0},xh.$metadata$={kind:c,simpleName:"MultiLineStringTransform",interfaces:[Pl]},Object.defineProperty(kh.prototype,"myPointIterator_0",{configurable:!0,get:function(){return null==this.myPointIterator_dr5tzt$_0?T("myPointIterator"):this.myPointIterator_dr5tzt$_0},set:function(t){this.myPointIterator_dr5tzt$_0=t}}),Object.defineProperty(kh.prototype,"myResult_0",{configurable:!0,get:function(){return null==this.myResult_kbfpjm$_0?T("myResult"):this.myResult_kbfpjm$_0},set:function(t){this.myResult_kbfpjm$_0=t}}),kh.prototype.getResult=function(){return this.myResult_0},kh.prototype.resume=function(){if(!this.myPointIterator_0.hasNext())return this.myHasNext_0=!1,void(this.myResult_0=new Pn(this.myNewMultiPoint_0));this.myTransform_0(this.myPointIterator_0.next(),this.myNewMultiPoint_0)},kh.prototype.alive=function(){return this.myHasNext_0},kh.$metadata$={kind:c,simpleName:"MultiPointTransform",interfaces:[Pl]},Object.defineProperty(Eh.prototype,"myPolygonsIterator_0",{configurable:!0,get:function(){return null==this.myPolygonsIterator_luodmq$_0?T("myPolygonsIterator"):this.myPolygonsIterator_luodmq$_0},set:function(t){this.myPolygonsIterator_luodmq$_0=t}}),Object.defineProperty(Eh.prototype,"myRingIterator_0",{configurable:!0,get:function(){return null==this.myRingIterator_1fq3dz$_0?T("myRingIterator"):this.myRingIterator_1fq3dz$_0},set:function(t){this.myRingIterator_1fq3dz$_0=t}}),Object.defineProperty(Eh.prototype,"myPointIterator_0",{configurable:!0,get:function(){return null==this.myPointIterator_tmjm9$_0?T("myPointIterator"):this.myPointIterator_tmjm9$_0},set:function(t){this.myPointIterator_tmjm9$_0=t}}),Object.defineProperty(Eh.prototype,"myResult_0",{configurable:!0,get:function(){return null==this.myResult_7m5cwo$_0?T("myResult"):this.myResult_7m5cwo$_0},set:function(t){this.myResult_7m5cwo$_0=t}}),Eh.prototype.getResult=function(){return this.myResult_0},Eh.prototype.resume=function(){if(!this.myPointIterator_0.hasNext())if(this.myNewPolygon_0.add_11rb$(new ut(this.myNewRing_0)),this.myRingIterator_0.hasNext())this.myPointIterator_0=this.myRingIterator_0.next().iterator(),this.myNewRing_0=w();else{if(this.myNewMultiPolygon_0.add_11rb$(new pt(this.myNewPolygon_0)),!this.myPolygonsIterator_0.hasNext())return this.myHasNext_0=!1,void(this.myResult_0=new ht(this.myNewMultiPolygon_0));this.myRingIterator_0=this.myPolygonsIterator_0.next().iterator(),this.myPointIterator_0=this.myRingIterator_0.next().iterator(),this.myNewRing_0=w(),this.myNewPolygon_0=w()}this.myTransform_0(this.myPointIterator_0.next(),this.myNewRing_0)},Eh.prototype.alive=function(){return this.myHasNext_0},Eh.$metadata$={kind:c,simpleName:"MultiPolygonTransform",interfaces:[Pl]},Object.defineProperty(Ch.prototype,"geometry",{configurable:!0,get:function(){return null==this.geometry_ycd7cj$_0?T("geometry"):this.geometry_ycd7cj$_0},set:function(t){this.geometry_ycd7cj$_0=t}}),Ch.$metadata$={kind:c,simpleName:"ScreenGeometryComponent",interfaces:[Ys]},Sh.prototype.createScalingTask_0=function(t,n){var i,r;if(t.contains_9u06oy$(p(qf))||t.removeComponent_9u06oy$(p(Ch)),null==(r=null==(i=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(qh)))||e.isType(i,qh)?i:C()))throw S("Component "+p(qh).simpleName+" is not found");var o,a,l,u,c=r.origin,h=new w_(n),_=wh();if(null==(a=null==(o=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Ah)))||e.isType(o,Ah)?o:C()))throw S("Component "+p(Ah).simpleName+" is not found");return Al(_.simple_c0yqik$(s(a.geometry),(l=h,u=c,function(t){return l.project_11rb$(Ut(t,u))})),Th(t,n,this))},Sh.prototype.updateImpl_og8vrq$=function(t,e){var n,i=t.mapRenderContext.viewport;if(po(t.camera))for(n=this.getEntities_38uplf$(Ph().COMPONENT_TYPES_0).iterator();n.hasNext();){var r=n.next();r.setComponent_qqqpmc$(new Gl(this.createScalingTask_0(r,i.zoom),this.myQuantIterations_0))}},Oh.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Nh=null;function Ph(){return null===Nh&&new Oh,Nh}function Ah(){this.geometry=null}function jh(){this.points=w()}function Lh(t,e,n){Mh(),Bs.call(this,t),this.myComponentManager_0=t,this.myMapProjection_0=e,this.myViewport_0=n}function Rh(){Dh=this,this.WIDGET_COMPONENTS=x([p(lf),p(wl),p(jh)]),this.DARK_ORANGE=k.Companion.parseHex_61zpoe$("#cc7a00")}Sh.$metadata$={kind:c,simpleName:"WorldGeometry2ScreenUpdateSystem",interfaces:[Bs]},Ah.$metadata$={kind:c,simpleName:"WorldGeometryComponent",interfaces:[Ys]},jh.$metadata$={kind:c,simpleName:"MakeGeometryWidgetComponent",interfaces:[Ys]},Lh.prototype.updateImpl_og8vrq$=function(t,e){var n,i;if(null!=(n=this.getWidgetLayer_0())&&null!=(i=this.click_0(n))&&!i.isStopped){var r=m_(i.location),o=A("getMapCoord",function(t,e){return t.getMapCoord_5wcbfv$(e)}.bind(null,this.myViewport_0))(r),a=A("invert",function(t,e){return t.invert_11rc$(e)}.bind(null,this.myMapProjection_0))(o);this.createVisualEntities_0(a,n),this.add_0(n,a)}},Lh.prototype.createVisualEntities_0=function(t,e){var n=new xr(e),i=new zr(n);if(i.point=t,i.strokeColor=Mh().DARK_ORANGE,i.shape=20,i.build_h0uvfn$(!1,new Ns(500),!0),this.count_0(e)>0){var r=new Nr(n,this.myMapProjection_0);Ar(r,x([this.last_0(e),t]),!1),r.strokeColor=Mh().DARK_ORANGE,r.strokeWidth=1.5,r.build_6taknv$(!0)}},Lh.prototype.getWidgetLayer_0=function(){return this.myComponentManager_0.tryGetSingletonEntity_tv8pd9$(Mh().WIDGET_COMPONENTS)},Lh.prototype.click_0=function(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(wl)))||e.isType(n,wl)?n:C()))throw S("Component "+p(wl).simpleName+" is not found");return i.click},Lh.prototype.count_0=function(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(jh)))||e.isType(n,jh)?n:C()))throw S("Component "+p(jh).simpleName+" is not found");return i.points.size},Lh.prototype.last_0=function(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(jh)))||e.isType(n,jh)?n:C()))throw S("Component "+p(jh).simpleName+" is not found");return Je(i.points)},Lh.prototype.add_0=function(t,n){var i,r;if(null==(r=null==(i=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(jh)))||e.isType(i,jh)?i:C()))throw S("Component "+p(jh).simpleName+" is not found");return r.points.add_11rb$(n)},Rh.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Ih,zh,Dh=null;function Mh(){return null===Dh&&new Rh,Dh}function Bh(t){var e,n={v:0},i={v:""},r={v:""};for(e=t.iterator();e.hasNext();){var o=e.next();5===n.v&&(n.v=0,i.v+="\n ",r.v+="\n "),n.v=n.v+1|0,i.v+=Uh(o.x)+", ",r.v+=Uh(o.y)+", "}return"geometry = {\n 'lon': ["+An(i.v,2)+"], \n 'lat': ["+An(r.v,2)+"]\n}"}function Uh(t){var e=oe(t.toString(),["."]);return e.get_za3lpa$(0)+"."+(e.get_za3lpa$(1).length>6?e.get_za3lpa$(1).substring(0,6):e.get_za3lpa$(1))}function Fh(t){this.dimension=t}function qh(t){this.origin=t}function Gh(){this.origins=w(),this.rounding=Kh()}function Hh(t,e,n){me.call(this),this.f_wsutam$_0=n,this.name$=t,this.ordinal$=e}function Yh(){Yh=function(){},Ih=new Hh("NONE",0,Vh),zh=new Hh("FLOOR",1,Wh)}function Vh(t){return t}function Kh(){return Yh(),Ih}function Wh(t){var e=t.x,n=Z.floor(e),i=t.y;return H(n,Z.floor(i))}function Xh(){return Yh(),zh}function Zh(){this.dimension=f_().ZERO_CLIENT_POINT}function Jh(){this.origin=f_().ZERO_CLIENT_POINT}function Qh(){this.offset=f_().ZERO_CLIENT_POINT}function t_(t){i_(),Bs.call(this,t)}function e_(){n_=this,this.COMPONENT_TYPES_0=x([p(wo),p(Jh),p(Zh),p(Gh)])}Lh.$metadata$={kind:c,simpleName:"MakeGeometryWidgetSystem",interfaces:[Bs]},Fh.$metadata$={kind:c,simpleName:"WorldDimensionComponent",interfaces:[Ys]},qh.$metadata$={kind:c,simpleName:"WorldOriginComponent",interfaces:[Ys]},Hh.prototype.apply_5wcbfv$=function(t){return this.f_wsutam$_0(t)},Hh.$metadata$={kind:c,simpleName:"Rounding",interfaces:[me]},Hh.values=function(){return[Kh(),Xh()]},Hh.valueOf_61zpoe$=function(t){switch(t){case"NONE":return Kh();case"FLOOR":return Xh();default:ye("No enum constant jetbrains.livemap.placement.ScreenLoopComponent.Rounding."+t)}},Gh.$metadata$={kind:c,simpleName:"ScreenLoopComponent",interfaces:[Ys]},Zh.$metadata$={kind:c,simpleName:"ScreenDimensionComponent",interfaces:[Ys]},Jh.$metadata$={kind:c,simpleName:"ScreenOriginComponent",interfaces:[Ys]},Qh.$metadata$={kind:c,simpleName:"ScreenOffsetComponent",interfaces:[Ys]},t_.prototype.updateImpl_og8vrq$=function(t,n){var i,r=t.mapRenderContext.viewport;for(i=this.getEntities_38uplf$(i_().COMPONENT_TYPES_0).iterator();i.hasNext();){var o,a,s,l=i.next();if(l.contains_9u06oy$(p(Qh))){var u,c;if(null==(c=null==(u=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(Qh)))||e.isType(u,Qh)?u:C()))throw S("Component "+p(Qh).simpleName+" is not found");s=c}else s=null;var h,_,f=null!=(a=null!=(o=s)?o.offset:null)?a:f_().ZERO_CLIENT_POINT;if(null==(_=null==(h=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(Jh)))||e.isType(h,Jh)?h:C()))throw S("Component "+p(Jh).simpleName+" is not found");var d,m,y=L(_.origin,f);if(null==(m=null==(d=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(Zh)))||e.isType(d,Zh)?d:C()))throw S("Component "+p(Zh).simpleName+" is not found");var $,v,g=m.dimension;if(null==(v=null==($=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(Gh)))||e.isType($,Gh)?$:C()))throw S("Component "+p(Gh).simpleName+" is not found");var b,w=r.getOrigins_uqcerw$(y,g),x=rt(it(w,10));for(b=w.iterator();b.hasNext();){var k=b.next();x.add_11rb$(v.rounding.apply_5wcbfv$(k))}v.origins=x}},e_.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var n_=null;function i_(){return null===n_&&new e_,n_}function r_(t){s_(),Bs.call(this,t)}function o_(){a_=this,this.COMPONENT_TYPES_0=x([p(bo),p(Fh),p(yc)])}t_.$metadata$={kind:c,simpleName:"ScreenLoopsUpdateSystem",interfaces:[Bs]},r_.prototype.updateImpl_og8vrq$=function(t,n){var i;if(po(t.camera))for(i=this.getEntities_38uplf$(s_().COMPONENT_TYPES_0).iterator();i.hasNext();){var r,o,a=i.next();if(null==(o=null==(r=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(Fh)))||e.isType(r,Fh)?r:C()))throw S("Component "+p(Fh).simpleName+" is not found");var s,l=o.dimension,u=s_().world2Screen_t8ozei$(l,g(t.camera.zoom));if(a.contains_9u06oy$(p(Zh))){var c,h;if(null==(h=null==(c=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(Zh)))||e.isType(c,Zh)?c:C()))throw S("Component "+p(Zh).simpleName+" is not found");s=h}else{var _=new Zh;a.add_57nep2$(_),s=_}s.dimension=u,kc().tagDirtyParentLayer_ahlfl2$(a)}},o_.prototype.world2Screen_t8ozei$=function(t,e){return new w_(e).project_11rb$(t)},o_.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var a_=null;function s_(){return null===a_&&new o_,a_}function l_(t){p_(),Bs.call(this,t)}function u_(){c_=this,this.COMPONENT_TYPES_0=x([p(wo),p(qh),p(yc)])}r_.$metadata$={kind:c,simpleName:"WorldDimension2ScreenUpdateSystem",interfaces:[Bs]},l_.prototype.updateImpl_og8vrq$=function(t,n){var i,r=t.mapRenderContext.viewport;for(i=this.getEntities_38uplf$(p_().COMPONENT_TYPES_0).iterator();i.hasNext();){var o,a,s=i.next();if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(qh)))||e.isType(o,qh)?o:C()))throw S("Component "+p(qh).simpleName+" is not found");var l,u=a.origin,c=A("getViewCoord",function(t,e){return t.getViewCoord_c01uj8$(e)}.bind(null,r))(u);if(s.contains_9u06oy$(p(Jh))){var h,_;if(null==(_=null==(h=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(Jh)))||e.isType(h,Jh)?h:C()))throw S("Component "+p(Jh).simpleName+" is not found");l=_}else{var f=new Jh;s.add_57nep2$(f),l=f}l.origin=c,kc().tagDirtyParentLayer_ahlfl2$(s)}},u_.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var c_=null;function p_(){return null===c_&&new u_,c_}function h_(){__=this,this.ZERO_LONLAT_POINT=H(0,0),this.ZERO_WORLD_POINT=H(0,0),this.ZERO_CLIENT_POINT=H(0,0)}l_.$metadata$={kind:c,simpleName:"WorldOrigin2ScreenUpdateSystem",interfaces:[Bs]},h_.$metadata$={kind:b,simpleName:"Coordinates",interfaces:[]};var __=null;function f_(){return null===__&&new h_,__}function d_(t,e){return q(t.x,t.y,e.x,e.y)}function m_(t){return jn(t.x,t.y)}function y_(t){return H(t.x,t.y)}function $_(){}function v_(t,e){this.geoProjection_0=t,this.mapRect_0=e,this.reverseX_0=!1,this.reverseY_0=!1}function g_(t,e){this.this$MapProjectionBuilder=t,this.closure$proj=e}function b_(t,e){return new v_(Qu().createGeoProjection_7v9tu4$(t),e).reverseY().create()}function w_(t){this.projector_0=Qu().square_ilk2sd$(Qu().zoom_za3lpa$(t))}function x_(){this.myCache_0=st()}function k_(){S_(),this.myCache_0=new Ya(5e3)}function E_(){C_=this,this.EMPTY_FRAGMENTS_CACHE_LIMIT_0=5e4,this.REGIONS_CACHE_LIMIT_0=5e3}$_.$metadata$={kind:v,simpleName:"MapProjection",interfaces:[Au]},v_.prototype.reverseX=function(){return this.reverseX_0=!0,this},v_.prototype.reverseY=function(){return this.reverseY_0=!0,this},Object.defineProperty(g_.prototype,"mapRect",{configurable:!0,get:function(){return this.this$MapProjectionBuilder.mapRect_0}}),g_.prototype.project_11rb$=function(t){return this.closure$proj.project_11rb$(t)},g_.prototype.invert_11rc$=function(t){return this.closure$proj.invert_11rc$(t)},g_.$metadata$={kind:c,interfaces:[$_]},v_.prototype.create=function(){var t,n=Qu().transformBBox_kr9gox$(this.geoProjection_0.validRect(),A("project",function(t,e){return t.project_11rb$(e)}.bind(null,this.geoProjection_0))),i=It(this.mapRect_0)/It(n),r=Mt(this.mapRect_0)/Mt(n),o=Z.min(i,r),a=e.isType(t=Ln(this.mapRect_0.dimension,1/o),Rn)?t:C(),s=new zt(Ut(Ce(n),Ln(a,.5)),a),l=this.reverseX_0?Ht(s):Rt(s),u=this.reverseX_0?-o:o,c=this.reverseY_0?Yt(s):Dt(s),p=this.reverseY_0?-o:o,h=Qu().tuple_bkiy7g$(Qu().linear_sdh6z7$(l,u),Qu().linear_sdh6z7$(c,p));return new g_(this,Qu().composite_ogd8x7$(this.geoProjection_0,h))},v_.$metadata$={kind:c,simpleName:"MapProjectionBuilder",interfaces:[]},w_.prototype.project_11rb$=function(t){return this.projector_0.project_11rb$(t)},w_.prototype.invert_11rc$=function(t){return this.projector_0.invert_11rc$(t)},w_.$metadata$={kind:c,simpleName:"WorldProjection",interfaces:[Au]},x_.prototype.contains_x1fgxf$=function(t){return this.myCache_0.containsKey_11rb$(t)},x_.prototype.keys=function(){return this.myCache_0.keys},x_.prototype.store_9ormk8$=function(t,e){if(this.myCache_0.containsKey_11rb$(t))throw S(("Already existing fragment: "+e.name).toString());this.myCache_0.put_xwzc9p$(t,e)},x_.prototype.get_n5xzzq$=function(t){return this.myCache_0.get_11rb$(t)},x_.prototype.dispose_n5xzzq$=function(t){var e;null!=(e=this.get_n5xzzq$(t))&&e.remove(),this.myCache_0.remove_11rb$(t)},x_.$metadata$={kind:c,simpleName:"CachedFragmentsComponent",interfaces:[Ys]},k_.prototype.createCache=function(){return new Ya(5e4)},k_.prototype.add_x1fgxf$=function(t){this.myCache_0.getOrPut_kpg1aj$(t.regionId,A("createCache",function(t){return t.createCache()}.bind(null,this))).put_xwzc9p$(t.quadKey,!0)},k_.prototype.contains_ny6xdl$=function(t,e){var n=this.myCache_0.get_11rb$(t);return null!=n&&n.containsKey_11rb$(e)},k_.prototype.addAll_j9syn5$=function(t){var e;for(e=t.iterator();e.hasNext();){var n=e.next();this.add_x1fgxf$(n)}},E_.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var C_=null;function S_(){return null===C_&&new E_,C_}function T_(){this.existingRegions=pe()}function O_(){this.myNewFragments_0=pe(),this.myObsoleteFragments_0=pe()}function N_(){this.queue=st(),this.downloading=pe(),this.downloaded_hhbogc$_0=st()}function P_(t){this.fragmentKey=t}function A_(){this.myFragmentEntities_0=pe()}function j_(){this.myEmitted_0=pe()}function L_(){this.myEmitted_0=pe()}function R_(){this.fetching_0=st()}function I_(t,e,n){Bs.call(this,n),this.myMaxActiveDownloads_0=t,this.myFragmentGeometryProvider_0=e,this.myRegionFragments_0=st(),this.myLock_0=new Bn}function z_(t,e){return function(n){var i;for(i=n.entries.iterator();i.hasNext();){var r,o=i.next(),a=t,s=e,l=o.key,u=o.value,c=ze(u),p=d("key",1,(function(t){return t.key})),h=rt(it(u,10));for(r=u.iterator();r.hasNext();){var _=r.next();h.add_11rb$(p(_))}var f,m=Jt(h);for(f=Dn(a,m).iterator();f.hasNext();){var y=f.next();c.add_11rb$(new Mn(y,at()))}var $=s.myLock_0;try{$.lock();var v,g=s.myRegionFragments_0,b=g.get_11rb$(l);if(null==b){var x=w();g.put_xwzc9p$(l,x),v=x}else v=b;v.addAll_brywnq$(c)}finally{$.unlock()}}return N}}function D_(t,e){Bs.call(this,e),this.myProjectionQuant_0=t,this.myRegionIndex_0=new Q_(e),this.myWaitingForScreenGeometry_0=st()}function M_(t){return t.unaryPlus_jixjl7$(new R_),t.unaryPlus_jixjl7$(new j_),t.unaryPlus_jixjl7$(new x_),N}function B_(t){return function(e){return Qs(e,function(t){return function(e){return e.unaryPlus_jixjl7$(new Fh(t.dimension)),e.unaryPlus_jixjl7$(new qh(t.origin)),N}}(t)),N}}function U_(t,e,n){return function(i){var r;if(null==(r=gt.GeometryUtil.bbox_8ft4gs$(i)))throw S("Fragment bbox can't be null".toString());var o=r;return e.runLaterBySystem_ayosff$(t,B_(o)),wh().simple_c0yqik$(i,function(t,e){return function(n){return t.project_11rb$(Ut(n,e.origin))}}(n,o))}}function F_(t,n,i){return function(r){return Qs(r,function(t,n,i){return function(r){r.unaryPlus_jixjl7$(new xo),r.unaryPlus_jixjl7$(new wo),r.unaryPlus_jixjl7$(new bo);var o=new qf,a=t;o.zoom=af().zoom_x1fgxf$(a),r.unaryPlus_jixjl7$(o),r.unaryPlus_jixjl7$(new P_(t)),r.unaryPlus_jixjl7$(new Gh);var s=new Ch;s.geometry=n,r.unaryPlus_jixjl7$(s);var l,u,c=i.myRegionIndex_0.find_61zpoe$(t.regionId);if(null==(u=null==(l=c.componentManager.getComponents_ahlfl2$(c).get_11rb$(p(yc)))||e.isType(l,yc)?l:C()))throw S("Component "+p(yc).simpleName+" is not found");return r.unaryPlus_jixjl7$(u),N}}(t,n,i)),N}}function q_(t,e){this.regionId=t,this.quadKey=e}function G_(t){K_(),Bs.call(this,t)}function H_(t){return t.unaryPlus_jixjl7$(new O_),t.unaryPlus_jixjl7$(new k_),t.unaryPlus_jixjl7$(new T_),N}function Y_(){V_=this,this.REGION_ENTITY_COMPONENTS=x([p(zp),p(rh),p(A_)])}k_.$metadata$={kind:c,simpleName:"EmptyFragmentsComponent",interfaces:[Ys]},T_.$metadata$={kind:c,simpleName:"ExistingRegionsComponent",interfaces:[Ys]},Object.defineProperty(O_.prototype,"requested",{configurable:!0,get:function(){return this.myNewFragments_0}}),Object.defineProperty(O_.prototype,"obsolete",{configurable:!0,get:function(){return this.myObsoleteFragments_0}}),O_.prototype.setToAdd_c2k76v$=function(t){this.myNewFragments_0.clear(),this.myNewFragments_0.addAll_brywnq$(t)},O_.prototype.setToRemove_c2k76v$=function(t){this.myObsoleteFragments_0.clear(),this.myObsoleteFragments_0.addAll_brywnq$(t)},O_.prototype.anyChanges=function(){return!this.myNewFragments_0.isEmpty()&&this.myObsoleteFragments_0.isEmpty()},O_.$metadata$={kind:c,simpleName:"ChangedFragmentsComponent",interfaces:[Ys]},Object.defineProperty(N_.prototype,"downloaded",{configurable:!0,get:function(){return this.downloaded_hhbogc$_0},set:function(t){this.downloaded.clear(),this.downloaded.putAll_a2k3zr$(t)}}),N_.prototype.getZoomQueue_za3lpa$=function(t){var e;return null!=(e=this.queue.get_11rb$(t))?e:pe()},N_.prototype.extendQueue_j9syn5$=function(t){var e;for(e=t.iterator();e.hasNext();){var n,i=e.next(),r=this.queue,o=i.zoom(),a=r.get_11rb$(o);if(null==a){var s=pe();r.put_xwzc9p$(o,s),n=s}else n=a;n.add_11rb$(i)}},N_.prototype.reduceQueue_j9syn5$=function(t){var e,n;for(e=t.iterator();e.hasNext();){var i=e.next();null!=(n=this.queue.get_11rb$(i.zoom()))&&n.remove_11rb$(i)}},N_.prototype.extendDownloading_alj0n8$=function(t){this.downloading.addAll_brywnq$(t)},N_.prototype.reduceDownloading_alj0n8$=function(t){this.downloading.removeAll_brywnq$(t)},N_.$metadata$={kind:c,simpleName:"DownloadingFragmentsComponent",interfaces:[Ys]},P_.$metadata$={kind:c,simpleName:"FragmentComponent",interfaces:[Ys]},Object.defineProperty(A_.prototype,"fragments",{configurable:!0,get:function(){return this.myFragmentEntities_0},set:function(t){this.myFragmentEntities_0.clear(),this.myFragmentEntities_0.addAll_brywnq$(t)}}),A_.$metadata$={kind:c,simpleName:"RegionFragmentsComponent",interfaces:[Ys]},j_.prototype.setEmitted_j9syn5$=function(t){return this.myEmitted_0.clear(),this.myEmitted_0.addAll_brywnq$(t),this},j_.prototype.keys_8be2vx$=function(){return this.myEmitted_0},j_.$metadata$={kind:c,simpleName:"EmittedFragmentsComponent",interfaces:[Ys]},L_.prototype.keys=function(){return this.myEmitted_0},L_.$metadata$={kind:c,simpleName:"EmittedRegionsComponent",interfaces:[Ys]},R_.prototype.keys=function(){return this.fetching_0.keys},R_.prototype.add_x1fgxf$=function(t){this.fetching_0.put_xwzc9p$(t,null)},R_.prototype.addAll_alj0n8$=function(t){var e;for(e=t.iterator();e.hasNext();){var n=e.next();this.fetching_0.put_xwzc9p$(n,null)}},R_.prototype.set_j1gy6z$=function(t,e){this.fetching_0.put_xwzc9p$(t,e)},R_.prototype.getEntity_x1fgxf$=function(t){return this.fetching_0.get_11rb$(t)},R_.prototype.remove_x1fgxf$=function(t){this.fetching_0.remove_11rb$(t)},R_.$metadata$={kind:c,simpleName:"StreamingFragmentsComponent",interfaces:[Ys]},I_.prototype.initImpl_4pvjek$=function(t){this.createEntity_61zpoe$("DownloadingFragments").add_57nep2$(new N_)},I_.prototype.updateImpl_og8vrq$=function(t,n){var i,r,o=this.componentManager.getSingletonEntity_9u06oy$(p(N_));if(null==(r=null==(i=o.componentManager.getComponents_ahlfl2$(o).get_11rb$(p(N_)))||e.isType(i,N_)?i:C()))throw S("Component "+p(N_).simpleName+" is not found");var a,s,l=r,u=this.componentManager.getSingletonEntity_9u06oy$(p(O_));if(null==(s=null==(a=u.componentManager.getComponents_ahlfl2$(u).get_11rb$(p(O_)))||e.isType(a,O_)?a:C()))throw S("Component "+p(O_).simpleName+" is not found");var c,h,_=s,f=this.componentManager.getSingletonEntity_9u06oy$(p(R_));if(null==(h=null==(c=f.componentManager.getComponents_ahlfl2$(f).get_11rb$(p(R_)))||e.isType(c,R_)?c:C()))throw S("Component "+p(R_).simpleName+" is not found");var d,m,y=h,$=this.componentManager.getSingletonEntity_9u06oy$(p(x_));if(null==(m=null==(d=$.componentManager.getComponents_ahlfl2$($).get_11rb$(p(x_)))||e.isType(d,x_)?d:C()))throw S("Component "+p(x_).simpleName+" is not found");var v=m;if(l.reduceQueue_j9syn5$(_.obsolete),l.extendQueue_j9syn5$(rf().ofCopy_j9syn5$(_.requested).exclude_8tsrz2$(y.keys()).exclude_8tsrz2$(v.keys()).exclude_8tsrz2$(l.downloading).get()),l.downloading.size=0;)i.add_11rb$(r.next()),r.remove(),n=n-1|0;return i},I_.prototype.downloadGeometries_0=function(t){var n,i,r,o=st(),a=this.componentManager.getSingletonEntity_9u06oy$(p(R_));if(null==(r=null==(i=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(R_)))||e.isType(i,R_)?i:C()))throw S("Component "+p(R_).simpleName+" is not found");var s,l=r;for(n=t.iterator();n.hasNext();){var u,c=n.next(),h=c.regionId,_=o.get_11rb$(h);if(null==_){var f=pe();o.put_xwzc9p$(h,f),u=f}else u=_;u.add_11rb$(c.quadKey),l.add_x1fgxf$(c)}for(s=o.entries.iterator();s.hasNext();){var d=s.next(),m=d.key,y=d.value;this.myFragmentGeometryProvider_0.getFragments_u051w$(ct(m),y).onSuccess_qlkmfe$(z_(y,this))}},I_.$metadata$={kind:c,simpleName:"FragmentDownloadingSystem",interfaces:[Bs]},D_.prototype.initImpl_4pvjek$=function(t){Qs(this.createEntity_61zpoe$("FragmentsFetch"),M_)},D_.prototype.updateImpl_og8vrq$=function(t,n){var i,r,o=this.componentManager.getSingletonEntity_9u06oy$(p(N_));if(null==(r=null==(i=o.componentManager.getComponents_ahlfl2$(o).get_11rb$(p(N_)))||e.isType(i,N_)?i:C()))throw S("Component "+p(N_).simpleName+" is not found");var a=r.downloaded,s=pe();if(!a.isEmpty()){var l,u,c=this.componentManager.getSingletonEntity_9u06oy$(p(pa));if(null==(u=null==(l=c.componentManager.getComponents_ahlfl2$(c).get_11rb$(p(pa)))||e.isType(l,pa)?l:C()))throw S("Component "+p(pa).simpleName+" is not found");var h,_=u.visibleQuads,d=pe(),m=pe();for(h=a.entries.iterator();h.hasNext();){var y=h.next(),$=y.key,v=y.value;if(_.contains_11rb$($.quadKey))if(v.isEmpty()){s.add_11rb$($);var g,b,w=this.componentManager.getSingletonEntity_9u06oy$(p(R_));if(null==(b=null==(g=w.componentManager.getComponents_ahlfl2$(w).get_11rb$(p(R_)))||e.isType(g,R_)?g:C()))throw S("Component "+p(R_).simpleName+" is not found");b.remove_x1fgxf$($)}else{d.add_11rb$($.quadKey);var x=this.myWaitingForScreenGeometry_0,k=this.createFragmentEntity_0($,Un(v),t.mapProjection);x.put_xwzc9p$($,k)}else{var E,T,O=this.componentManager.getSingletonEntity_9u06oy$(p(R_));if(null==(T=null==(E=O.componentManager.getComponents_ahlfl2$(O).get_11rb$(p(R_)))||e.isType(E,R_)?E:C()))throw S("Component "+p(R_).simpleName+" is not found");T.remove_x1fgxf$($),m.add_11rb$($.quadKey)}}}var N,P=this.findTransformedFragments_0();for(N=P.entries.iterator();N.hasNext();){var A,j,L=N.next(),R=L.key,I=L.value,z=this.componentManager.getSingletonEntity_9u06oy$(p(R_));if(null==(j=null==(A=z.componentManager.getComponents_ahlfl2$(z).get_11rb$(p(R_)))||e.isType(A,R_)?A:C()))throw S("Component "+p(R_).simpleName+" is not found");j.remove_x1fgxf$(R);var D,M,B=this.componentManager.getSingletonEntity_9u06oy$(p(x_));if(null==(M=null==(D=B.componentManager.getComponents_ahlfl2$(B).get_11rb$(p(x_)))||e.isType(D,x_)?D:C()))throw S("Component "+p(x_).simpleName+" is not found");M.store_9ormk8$(R,I)}var U=pe();U.addAll_brywnq$(s),U.addAll_brywnq$(P.keys);var F,q,G=this.componentManager.getSingletonEntity_9u06oy$(p(O_));if(null==(q=null==(F=G.componentManager.getComponents_ahlfl2$(G).get_11rb$(p(O_)))||e.isType(F,O_)?F:C()))throw S("Component "+p(O_).simpleName+" is not found");var H,Y,V=q.requested,K=this.componentManager.getSingletonEntity_9u06oy$(p(x_));if(null==(Y=null==(H=K.componentManager.getComponents_ahlfl2$(K).get_11rb$(p(x_)))||e.isType(H,x_)?H:C()))throw S("Component "+p(x_).simpleName+" is not found");U.addAll_brywnq$(f(V,Y.keys()));var W,X,Z=this.componentManager.getSingletonEntity_9u06oy$(p(k_));if(null==(X=null==(W=Z.componentManager.getComponents_ahlfl2$(Z).get_11rb$(p(k_)))||e.isType(W,k_)?W:C()))throw S("Component "+p(k_).simpleName+" is not found");X.addAll_j9syn5$(s);var J,Q,tt=this.componentManager.getSingletonEntity_9u06oy$(p(j_));if(null==(Q=null==(J=tt.componentManager.getComponents_ahlfl2$(tt).get_11rb$(p(j_)))||e.isType(J,j_)?J:C()))throw S("Component "+p(j_).simpleName+" is not found");Q.setEmitted_j9syn5$(U)},D_.prototype.findTransformedFragments_0=function(){for(var t=st(),n=this.myWaitingForScreenGeometry_0.values.iterator();n.hasNext();){var i=n.next();if(i.contains_9u06oy$(p(Ch))){var r,o;if(null==(o=null==(r=i.componentManager.getComponents_ahlfl2$(i).get_11rb$(p(P_)))||e.isType(r,P_)?r:C()))throw S("Component "+p(P_).simpleName+" is not found");var a=o.fragmentKey;t.put_xwzc9p$(a,i),n.remove()}}return t},D_.prototype.createFragmentEntity_0=function(t,n,i){if(n.isEmpty())throw Ge("Failed requirement.".toString());var r,o,a,s=this.createEntity_61zpoe$(af().entityName_n5xzzq$(t)),l=Qu().square_ilk2sd$(Qu().zoom_za3lpa$(af().zoom_x1fgxf$(t))),u=Al(jl(wh().resampling_c0yqik$(n,A("project",function(t,e){return t.project_11rb$(e)}.bind(null,i))),U_(s,this,l)),(r=s,o=t,a=this,function(t){a.runLaterBySystem_ayosff$(r,F_(o,t,a))}));s.add_57nep2$(new Gl(u,this.myProjectionQuant_0));var c,h,_=this.componentManager.getSingletonEntity_9u06oy$(p(R_));if(null==(h=null==(c=_.componentManager.getComponents_ahlfl2$(_).get_11rb$(p(R_)))||e.isType(c,R_)?c:C()))throw S("Component "+p(R_).simpleName+" is not found");return h.set_j1gy6z$(t,s),s},D_.$metadata$={kind:c,simpleName:"FragmentEmitSystem",interfaces:[Bs]},q_.prototype.zoom=function(){return Fn(this.quadKey)},q_.$metadata$={kind:c,simpleName:"FragmentKey",interfaces:[]},q_.prototype.component1=function(){return this.regionId},q_.prototype.component2=function(){return this.quadKey},q_.prototype.copy_cwu9hm$=function(t,e){return new q_(void 0===t?this.regionId:t,void 0===e?this.quadKey:e)},q_.prototype.toString=function(){return"FragmentKey(regionId="+e.toString(this.regionId)+", quadKey="+e.toString(this.quadKey)+")"},q_.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.regionId)|0)+e.hashCode(this.quadKey)|0},q_.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.regionId,t.regionId)&&e.equals(this.quadKey,t.quadKey)},G_.prototype.initImpl_4pvjek$=function(t){Qs(this.createEntity_61zpoe$("FragmentsChange"),H_)},G_.prototype.updateImpl_og8vrq$=function(t,n){var i,r,o,a,s,l=this.componentManager.getSingletonEntity_9u06oy$(p(pa));if(null==(s=null==(a=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(pa)))||e.isType(a,pa)?a:C()))throw S("Component "+p(pa).simpleName+" is not found");var u,c,h=s,_=this.componentManager.getSingletonEntity_9u06oy$(p(O_));if(null==(c=null==(u=_.componentManager.getComponents_ahlfl2$(_).get_11rb$(p(O_)))||e.isType(u,O_)?u:C()))throw S("Component "+p(O_).simpleName+" is not found");var f,d,m=c,y=this.componentManager.getSingletonEntity_9u06oy$(p(k_));if(null==(d=null==(f=y.componentManager.getComponents_ahlfl2$(y).get_11rb$(p(k_)))||e.isType(f,k_)?f:C()))throw S("Component "+p(k_).simpleName+" is not found");var $,v,g=d,b=this.componentManager.getSingletonEntity_9u06oy$(p(T_));if(null==(v=null==($=b.componentManager.getComponents_ahlfl2$(b).get_11rb$(p(T_)))||e.isType($,T_)?$:C()))throw S("Component "+p(T_).simpleName+" is not found");var x=v.existingRegions,k=h.quadsToRemove,E=w(),T=w();for(i=this.getEntities_38uplf$(K_().REGION_ENTITY_COMPONENTS).iterator();i.hasNext();){var O,N,P=i.next();if(null==(N=null==(O=P.componentManager.getComponents_ahlfl2$(P).get_11rb$(p(rh)))||e.isType(O,rh)?O:C()))throw S("Component "+p(rh).simpleName+" is not found");var A,j,L=N.bbox;if(null==(j=null==(A=P.componentManager.getComponents_ahlfl2$(P).get_11rb$(p(zp)))||e.isType(A,zp)?A:C()))throw S("Component "+p(zp).simpleName+" is not found");var R=j.regionId,I=h.quadsToAdd;for(x.contains_11rb$(R)||(I=h.visibleQuads,x.add_11rb$(R)),r=I.iterator();r.hasNext();){var z=r.next();!g.contains_ny6xdl$(R,z)&&this.intersect_0(L,z)&&E.add_11rb$(new q_(R,z))}for(o=k.iterator();o.hasNext();){var D=o.next();g.contains_ny6xdl$(R,D)||T.add_11rb$(new q_(R,D))}}m.setToAdd_c2k76v$(E),m.setToRemove_c2k76v$(T)},G_.prototype.intersect_0=function(t,e){var n,i=qn(e);for(n=t.splitByAntiMeridian().iterator();n.hasNext();){var r=n.next();if(Gn(r,i))return!0}return!1},Y_.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var V_=null;function K_(){return null===V_&&new Y_,V_}function W_(t,e){Bs.call(this,e),this.myCacheSize_0=t}function X_(t){Bs.call(this,t),this.myRegionIndex_0=new Q_(t),this.myPendingFragments_0=st(),this.myPendingZoom_0=-1}function Z_(){this.myWaitingFragments_0=pe(),this.myReadyFragments_0=pe(),this.myIsDone_0=!1}function J_(){of=this}function Q_(t){this.myComponentManager_0=t,this.myRegionIndex_0=new Ya(1e4)}function tf(t){rf(),this.myValues_0=t}function ef(){nf=this}G_.$metadata$={kind:c,simpleName:"FragmentUpdateSystem",interfaces:[Bs]},W_.prototype.updateImpl_og8vrq$=function(t,n){var i,r,o,a,s,l=this.componentManager.getSingletonEntity_9u06oy$(p(O_));if(null==(a=null==(o=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(O_)))||e.isType(o,O_)?o:C()))throw S("Component "+p(O_).simpleName+" is not found");if(a.anyChanges()){var u,c,h=this.componentManager.getSingletonEntity_9u06oy$(p(O_));if(null==(c=null==(u=h.componentManager.getComponents_ahlfl2$(h).get_11rb$(p(O_)))||e.isType(u,O_)?u:C()))throw S("Component "+p(O_).simpleName+" is not found");var _,f,d,m=c.requested,y=pe(),$=this.componentManager.getSingletonEntity_9u06oy$(p(R_));if(null==(d=null==(f=$.componentManager.getComponents_ahlfl2$($).get_11rb$(p(R_)))||e.isType(f,R_)?f:C()))throw S("Component "+p(R_).simpleName+" is not found");var v,g=d,b=pe();if(!m.isEmpty()){var w=af().zoom_x1fgxf$(Ue(m));for(_=g.keys().iterator();_.hasNext();){var x=_.next();af().zoom_x1fgxf$(x)===w?y.add_11rb$(x):b.add_11rb$(x)}}for(v=b.iterator();v.hasNext();){var k,E=v.next();null!=(k=g.getEntity_x1fgxf$(E))&&k.remove(),g.remove_x1fgxf$(E)}var T=pe();for(i=this.getEntities_9u06oy$(p(A_)).iterator();i.hasNext();){var O,N,P=i.next();if(null==(N=null==(O=P.componentManager.getComponents_ahlfl2$(P).get_11rb$(p(A_)))||e.isType(O,A_)?O:C()))throw S("Component "+p(A_).simpleName+" is not found");var A,j=N.fragments,L=rt(it(j,10));for(A=j.iterator();A.hasNext();){var R,I,z=A.next(),D=L.add_11rb$;if(null==(I=null==(R=z.componentManager.getComponents_ahlfl2$(z).get_11rb$(p(P_)))||e.isType(R,P_)?R:C()))throw S("Component "+p(P_).simpleName+" is not found");D.call(L,I.fragmentKey)}T.addAll_brywnq$(L)}var M,B,U=this.componentManager.getSingletonEntity_9u06oy$(p(x_));if(null==(B=null==(M=U.componentManager.getComponents_ahlfl2$(U).get_11rb$(p(x_)))||e.isType(M,x_)?M:C()))throw S("Component "+p(x_).simpleName+" is not found");var F,q,G=B,H=this.componentManager.getSingletonEntity_9u06oy$(p(pa));if(null==(q=null==(F=H.componentManager.getComponents_ahlfl2$(H).get_11rb$(p(pa)))||e.isType(F,pa)?F:C()))throw S("Component "+p(pa).simpleName+" is not found");var Y,V,K=q.visibleQuads,W=Hn(G.keys()),X=this.componentManager.getSingletonEntity_9u06oy$(p(O_));if(null==(V=null==(Y=X.componentManager.getComponents_ahlfl2$(X).get_11rb$(p(O_)))||e.isType(Y,O_)?Y:C()))throw S("Component "+p(O_).simpleName+" is not found");W.addAll_brywnq$(V.obsolete),W.removeAll_brywnq$(m),W.removeAll_brywnq$(T),W.removeAll_brywnq$(y),Yn(W,(s=K,function(t){return s.contains_11rb$(t.quadKey)}));for(var Z=W.size-this.myCacheSize_0|0,J=W.iterator();J.hasNext()&&(Z=(r=Z)-1|0,r>0);){var Q=J.next();G.contains_x1fgxf$(Q)&&G.dispose_n5xzzq$(Q)}}},W_.$metadata$={kind:c,simpleName:"FragmentsRemovingSystem",interfaces:[Bs]},X_.prototype.initImpl_4pvjek$=function(t){this.createEntity_61zpoe$("emitted_regions").add_57nep2$(new L_)},X_.prototype.updateImpl_og8vrq$=function(t,n){var i;t.camera.isZoomChanged&&po(t.camera)&&(this.myPendingZoom_0=g(t.camera.zoom),this.myPendingFragments_0.clear());var r,o,a=this.componentManager.getSingletonEntity_9u06oy$(p(O_));if(null==(o=null==(r=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(O_)))||e.isType(r,O_)?r:C()))throw S("Component "+p(O_).simpleName+" is not found");var s,l=o.requested,u=A("wait",function(t,e){return t.wait_0(e),N}.bind(null,this));for(s=l.iterator();s.hasNext();)u(s.next());var c,h,_=this.componentManager.getSingletonEntity_9u06oy$(p(O_));if(null==(h=null==(c=_.componentManager.getComponents_ahlfl2$(_).get_11rb$(p(O_)))||e.isType(c,O_)?c:C()))throw S("Component "+p(O_).simpleName+" is not found");var f,d=h.obsolete,m=A("remove",function(t,e){return t.remove_0(e),N}.bind(null,this));for(f=d.iterator();f.hasNext();)m(f.next());var y,$,v=this.componentManager.getSingletonEntity_9u06oy$(p(j_));if(null==($=null==(y=v.componentManager.getComponents_ahlfl2$(v).get_11rb$(p(j_)))||e.isType(y,j_)?y:C()))throw S("Component "+p(j_).simpleName+" is not found");var b,w=$.keys_8be2vx$(),x=A("accept",function(t,e){return t.accept_0(e),N}.bind(null,this));for(b=w.iterator();b.hasNext();)x(b.next());var k,E,T=this.componentManager.getSingletonEntity_9u06oy$(p(L_));if(null==(E=null==(k=T.componentManager.getComponents_ahlfl2$(T).get_11rb$(p(L_)))||e.isType(k,L_)?k:C()))throw S("Component "+p(L_).simpleName+" is not found");var O=E;for(O.keys().clear(),i=this.checkReadyRegions_0().iterator();i.hasNext();){var P=i.next();O.keys().add_11rb$(P),this.renderRegion_0(P)}},X_.prototype.renderRegion_0=function(t){var n,i,r=this.myRegionIndex_0.find_61zpoe$(t),o=this.componentManager.getSingletonEntity_9u06oy$(p(x_));if(null==(i=null==(n=o.componentManager.getComponents_ahlfl2$(o).get_11rb$(p(x_)))||e.isType(n,x_)?n:C()))throw S("Component "+p(x_).simpleName+" is not found");var a,l,u=i;if(null==(l=null==(a=r.componentManager.getComponents_ahlfl2$(r).get_11rb$(p(A_)))||e.isType(a,A_)?a:C()))throw S("Component "+p(A_).simpleName+" is not found");var c,h=s(this.myPendingFragments_0.get_11rb$(t)).readyFragments(),_=A("get",function(t,e){return t.get_n5xzzq$(e)}.bind(null,u)),f=w();for(c=h.iterator();c.hasNext();){var d;null!=(d=_(c.next()))&&f.add_11rb$(d)}l.fragments=f,kc().tagDirtyParentLayer_ahlfl2$(r)},X_.prototype.wait_0=function(t){if(this.myPendingZoom_0===af().zoom_x1fgxf$(t)){var e,n=this.myPendingFragments_0,i=t.regionId,r=n.get_11rb$(i);if(null==r){var o=new Z_;n.put_xwzc9p$(i,o),e=o}else e=r;e.waitFragment_n5xzzq$(t)}},X_.prototype.accept_0=function(t){var e;this.myPendingZoom_0===af().zoom_x1fgxf$(t)&&null!=(e=this.myPendingFragments_0.get_11rb$(t.regionId))&&e.accept_n5xzzq$(t)},X_.prototype.remove_0=function(t){var e;this.myPendingZoom_0===af().zoom_x1fgxf$(t)&&null!=(e=this.myPendingFragments_0.get_11rb$(t.regionId))&&e.remove_n5xzzq$(t)},X_.prototype.checkReadyRegions_0=function(){var t,e=w();for(t=this.myPendingFragments_0.entries.iterator();t.hasNext();){var n=t.next(),i=n.key;n.value.checkDone()&&e.add_11rb$(i)}return e},Z_.prototype.waitFragment_n5xzzq$=function(t){this.myWaitingFragments_0.add_11rb$(t),this.myIsDone_0=!1},Z_.prototype.accept_n5xzzq$=function(t){this.myReadyFragments_0.add_11rb$(t),this.remove_n5xzzq$(t)},Z_.prototype.remove_n5xzzq$=function(t){this.myWaitingFragments_0.remove_11rb$(t),this.myWaitingFragments_0.isEmpty()&&(this.myIsDone_0=!0)},Z_.prototype.checkDone=function(){return!!this.myIsDone_0&&(this.myIsDone_0=!1,!0)},Z_.prototype.readyFragments=function(){return this.myReadyFragments_0},Z_.$metadata$={kind:c,simpleName:"PendingFragments",interfaces:[]},X_.$metadata$={kind:c,simpleName:"RegionEmitSystem",interfaces:[Bs]},J_.prototype.entityName_n5xzzq$=function(t){return this.entityName_cwu9hm$(t.regionId,t.quadKey)},J_.prototype.entityName_cwu9hm$=function(t,e){return"fragment_"+t+"_"+e.key},J_.prototype.zoom_x1fgxf$=function(t){return Fn(t.quadKey)},Q_.prototype.find_61zpoe$=function(t){var n,i,r;if(this.myRegionIndex_0.containsKey_11rb$(t)){var o;if(i=this.myComponentManager_0,null==(n=this.myRegionIndex_0.get_11rb$(t)))throw S("".toString());return o=n,i.getEntityById_za3lpa$(o)}for(r=this.myComponentManager_0.getEntities_9u06oy$(p(zp)).iterator();r.hasNext();){var a,s,l=r.next();if(null==(s=null==(a=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(zp)))||e.isType(a,zp)?a:C()))throw S("Component "+p(zp).simpleName+" is not found");if(Bt(s.regionId,t))return this.myRegionIndex_0.put_xwzc9p$(t,l.id_8be2vx$),l}throw S("".toString())},Q_.$metadata$={kind:c,simpleName:"RegionsIndex",interfaces:[]},tf.prototype.exclude_8tsrz2$=function(t){return this.myValues_0.removeAll_brywnq$(t),this},tf.prototype.get=function(){return this.myValues_0},ef.prototype.ofCopy_j9syn5$=function(t){return new tf(Hn(t))},ef.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var nf=null;function rf(){return null===nf&&new ef,nf}tf.$metadata$={kind:c,simpleName:"SetBuilder",interfaces:[]},J_.$metadata$={kind:b,simpleName:"Utils",interfaces:[]};var of=null;function af(){return null===of&&new J_,of}function sf(t){this.renderer=t}function lf(){this.myEntities_0=pe()}function uf(){this.shape=0}function cf(){this.textSpec_43kqrj$_0=this.textSpec_43kqrj$_0}function pf(){this.radius=0,this.startAngle=0,this.endAngle=0}function hf(){this.fillColor=null,this.strokeColor=null,this.strokeWidth=0,this.lineDash=null}function _f(t,e){t.lineDash=bt(e)}function ff(t,e){t.fillColor=e}function df(t,e){t.strokeColor=e}function mf(t,e){t.strokeWidth=e}function yf(t,e){t.moveTo_lu1900$(e.x,e.y)}function $f(t,e){t.lineTo_lu1900$(e.x,e.y)}function vf(t,e){t.translate_lu1900$(e.x,e.y)}function gf(t){Cf(),Bs.call(this,t)}function bf(t){var n;if(t.contains_9u06oy$(p(Gh))){var i,r;if(null==(r=null==(i=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Gh)))||e.isType(i,Gh)?i:C()))throw S("Component "+p(Gh).simpleName+" is not found");n=r}else n=null;return null!=n}function wf(t,e){this.closure$renderer=t,this.closure$layerEntity=e}function xf(t,n,i,r){return function(o){var a,s;if(o.save(),null!=t){var l=t;vf(o,l.scaleOrigin),o.scale_lu1900$(l.currentScale,l.currentScale),vf(o,Vn(l.scaleOrigin)),s=l}else s=null;for(null!=s||o.scale_lu1900$(1,1),a=y(i.getLayerEntities_0(n),bf).iterator();a.hasNext();){var u,c,h=a.next();if(null==(c=null==(u=h.componentManager.getComponents_ahlfl2$(h).get_11rb$(p(sf)))||e.isType(u,sf)?u:C()))throw S("Component "+p(sf).simpleName+" is not found");var _,f,d,m=c.renderer;if(null==(f=null==(_=h.componentManager.getComponents_ahlfl2$(h).get_11rb$(p(Gh)))||e.isType(_,Gh)?_:C()))throw S("Component "+p(Gh).simpleName+" is not found");for(d=f.origins.iterator();d.hasNext();){var $=d.next();r.mapRenderContext.draw_5xkfq8$(o,$,new wf(m,h))}}return o.restore(),N}}function kf(){Ef=this,this.DIRTY_LAYERS_0=x([p(fc),p(lf),p(mc)])}sf.$metadata$={kind:c,simpleName:"RendererComponent",interfaces:[Ys]},Object.defineProperty(lf.prototype,"entities",{configurable:!0,get:function(){return this.myEntities_0}}),lf.prototype.add_za3lpa$=function(t){this.myEntities_0.add_11rb$(t)},lf.prototype.remove_za3lpa$=function(t){this.myEntities_0.remove_11rb$(t)},lf.$metadata$={kind:c,simpleName:"LayerEntitiesComponent",interfaces:[Ys]},uf.$metadata$={kind:c,simpleName:"ShapeComponent",interfaces:[Ys]},Object.defineProperty(cf.prototype,"textSpec",{configurable:!0,get:function(){return null==this.textSpec_43kqrj$_0?T("textSpec"):this.textSpec_43kqrj$_0},set:function(t){this.textSpec_43kqrj$_0=t}}),cf.$metadata$={kind:c,simpleName:"TextSpecComponent",interfaces:[Ys]},pf.$metadata$={kind:c,simpleName:"PieSectorComponent",interfaces:[Ys]},hf.$metadata$={kind:c,simpleName:"StyleComponent",interfaces:[Ys]},wf.prototype.render_pzzegf$=function(t){this.closure$renderer.render_j83es7$(this.closure$layerEntity,t)},wf.$metadata$={kind:c,interfaces:[pp]},gf.prototype.updateImpl_og8vrq$=function(t,n){var i,r,o=this.componentManager.getSingletonEntity_9u06oy$(p(ko));if(o.contains_9u06oy$(p(yo))){var a,s;if(null==(s=null==(a=o.componentManager.getComponents_ahlfl2$(o).get_11rb$(p(yo)))||e.isType(a,yo)?a:C()))throw S("Component "+p(yo).simpleName+" is not found");r=s}else r=null;var l=r;for(i=this.getEntities_38uplf$(Cf().DIRTY_LAYERS_0).iterator();i.hasNext();){var u,c,h=i.next();if(null==(c=null==(u=h.componentManager.getComponents_ahlfl2$(h).get_11rb$(p(mc)))||e.isType(u,mc)?u:C()))throw S("Component "+p(mc).simpleName+" is not found");c.canvasLayer.addRenderTask_ddf932$(xf(l,h,this,t))}},gf.prototype.getLayerEntities_0=function(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(lf)))||e.isType(n,lf)?n:C()))throw S("Component "+p(lf).simpleName+" is not found");return this.getEntitiesById_wlb8mv$(i.entities)},kf.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Ef=null;function Cf(){return null===Ef&&new kf,Ef}function Sf(){}function Tf(){zf=this}function Of(){}function Nf(){}function Pf(){}function Af(t){return t.stroke(),N}function jf(){}function Lf(){}function Rf(){}function If(){}gf.$metadata$={kind:c,simpleName:"EntitiesRenderingTaskSystem",interfaces:[Bs]},Sf.$metadata$={kind:v,simpleName:"Renderer",interfaces:[]},Tf.prototype.drawLines_8zv1en$=function(t,e,n){var i,r;for(i=t.iterator();i.hasNext();)for(r=i.next().iterator();r.hasNext();){var o,a=r.next();for(yf(e,a.get_za3lpa$(0)),o=Kn(a,1).iterator();o.hasNext();)$f(e,o.next())}n(e)},Of.prototype.renderFeature_0=function(t,e,n,i){e.translate_lu1900$(n,n),e.beginPath(),Ff().drawPath_iz58c6$(e,n,i),null!=t.fillColor&&(e.setFillStyle_2160e9$(t.fillColor),e.fill()),null==t.strokeColor||hn(t.strokeWidth)||(e.setStrokeStyle_2160e9$(t.strokeColor),e.setLineWidth_14dthe$(t.strokeWidth),e.stroke())},Of.prototype.render_j83es7$=function(t,n){var i,r;if(null==(r=null==(i=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Zh)))||e.isType(i,Zh)?i:C()))throw S("Component "+p(Zh).simpleName+" is not found");var o,a,s,l=r.dimension.x/2;if(t.contains_9u06oy$(p(hc))){var u,c;if(null==(c=null==(u=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(hc)))||e.isType(u,hc)?u:C()))throw S("Component "+p(hc).simpleName+" is not found");s=c}else s=null;var h,_,f,d,m=l*(null!=(a=null!=(o=s)?o.scale:null)?a:1);if(n.translate_lu1900$(-m,-m),null==(_=null==(h=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(hf)))||e.isType(h,hf)?h:C()))throw S("Component "+p(hf).simpleName+" is not found");if(null==(d=null==(f=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(uf)))||e.isType(f,uf)?f:C()))throw S("Component "+p(uf).simpleName+" is not found");this.renderFeature_0(_,n,m,d.shape)},Of.$metadata$={kind:c,simpleName:"PointRenderer",interfaces:[Sf]},Nf.prototype.render_j83es7$=function(t,n){if(t.contains_9u06oy$(p(Ch))){if(n.save(),t.contains_9u06oy$(p(qf))){var i,r;if(null==(r=null==(i=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(qf)))||e.isType(i,qf)?i:C()))throw S("Component "+p(qf).simpleName+" is not found");var o=r.scale;1!==o&&n.scale_lu1900$(o,o)}var a,s;if(null==(s=null==(a=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(hf)))||e.isType(a,hf)?a:C()))throw S("Component "+p(hf).simpleName+" is not found");var l=s;n.setLineJoin_v2gigt$(Wn.ROUND),n.beginPath();var u,c,h=Df();if(null==(c=null==(u=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Ch)))||e.isType(u,Ch)?u:C()))throw S("Component "+p(Ch).simpleName+" is not found");h.drawLines_8zv1en$(c.geometry,n,(_=l,function(t){return t.closePath(),null!=_.fillColor&&(t.setFillStyle_2160e9$(_.fillColor),t.fill()),null!=_.strokeColor&&0!==_.strokeWidth&&(t.setStrokeStyle_2160e9$(_.strokeColor),t.setLineWidth_14dthe$(_.strokeWidth),t.stroke()),N})),n.restore()}var _},Nf.$metadata$={kind:c,simpleName:"PolygonRenderer",interfaces:[Sf]},Pf.prototype.render_j83es7$=function(t,n){if(t.contains_9u06oy$(p(Ch))){var i,r;if(null==(r=null==(i=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(hf)))||e.isType(i,hf)?i:C()))throw S("Component "+p(hf).simpleName+" is not found");var o=r;n.setLineDash_gf7tl1$(s(o.lineDash)),n.setStrokeStyle_2160e9$(o.strokeColor),n.setLineWidth_14dthe$(o.strokeWidth),n.beginPath();var a,l,u=Df();if(null==(l=null==(a=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Ch)))||e.isType(a,Ch)?a:C()))throw S("Component "+p(Ch).simpleName+" is not found");u.drawLines_8zv1en$(l.geometry,n,Af)}},Pf.$metadata$={kind:c,simpleName:"PathRenderer",interfaces:[Sf]},jf.prototype.render_j83es7$=function(t,n){var i,r;if(null==(r=null==(i=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(hf)))||e.isType(i,hf)?i:C()))throw S("Component "+p(hf).simpleName+" is not found");var o,a,s=r;if(null==(a=null==(o=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Zh)))||e.isType(o,Zh)?o:C()))throw S("Component "+p(Zh).simpleName+" is not found");var l=a.dimension;null!=s.fillColor&&(n.setFillStyle_2160e9$(s.fillColor),n.fillRect_6y0v78$(0,0,l.x,l.y)),null!=s.strokeColor&&0!==s.strokeWidth&&(n.setStrokeStyle_2160e9$(s.strokeColor),n.setLineWidth_14dthe$(s.strokeWidth),n.strokeRect_6y0v78$(0,0,l.x,l.y))},jf.$metadata$={kind:c,simpleName:"BarRenderer",interfaces:[Sf]},Lf.prototype.render_j83es7$=function(t,n){var i,r;if(null==(r=null==(i=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(hf)))||e.isType(i,hf)?i:C()))throw S("Component "+p(hf).simpleName+" is not found");var o,a,s=r;if(null==(a=null==(o=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(pf)))||e.isType(o,pf)?o:C()))throw S("Component "+p(pf).simpleName+" is not found");var l=a;null!=s.strokeColor&&s.strokeWidth>0&&(n.setStrokeStyle_2160e9$(s.strokeColor),n.setLineWidth_14dthe$(s.strokeWidth),n.beginPath(),n.arc_6p3vsx$(0,0,l.radius+s.strokeWidth/2,l.startAngle,l.endAngle),n.stroke()),null!=s.fillColor&&(n.setFillStyle_2160e9$(s.fillColor),n.beginPath(),n.moveTo_lu1900$(0,0),n.arc_6p3vsx$(0,0,l.radius,l.startAngle,l.endAngle),n.fill())},Lf.$metadata$={kind:c,simpleName:"PieSectorRenderer",interfaces:[Sf]},Rf.prototype.render_j83es7$=function(t,n){var i,r;if(null==(r=null==(i=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(hf)))||e.isType(i,hf)?i:C()))throw S("Component "+p(hf).simpleName+" is not found");var o,a,s=r;if(null==(a=null==(o=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(pf)))||e.isType(o,pf)?o:C()))throw S("Component "+p(pf).simpleName+" is not found");var l=a,u=.55*l.radius,c=Z.floor(u);if(null!=s.strokeColor&&s.strokeWidth>0){n.setStrokeStyle_2160e9$(s.strokeColor),n.setLineWidth_14dthe$(s.strokeWidth),n.beginPath();var h=c-s.strokeWidth/2;n.arc_6p3vsx$(0,0,Z.max(0,h),l.startAngle,l.endAngle),n.stroke(),n.beginPath(),n.arc_6p3vsx$(0,0,l.radius+s.strokeWidth/2,l.startAngle,l.endAngle),n.stroke()}null!=s.fillColor&&(n.setFillStyle_2160e9$(s.fillColor),n.beginPath(),n.arc_6p3vsx$(0,0,c,l.startAngle,l.endAngle),n.arc_6p3vsx$(0,0,l.radius,l.endAngle,l.startAngle,!0),n.fill())},Rf.$metadata$={kind:c,simpleName:"DonutSectorRenderer",interfaces:[Sf]},If.prototype.render_j83es7$=function(t,n){var i,r;if(null==(r=null==(i=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(hf)))||e.isType(i,hf)?i:C()))throw S("Component "+p(hf).simpleName+" is not found");var o,a,s=r;if(null==(a=null==(o=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(cf)))||e.isType(o,cf)?o:C()))throw S("Component "+p(cf).simpleName+" is not found");var l=a.textSpec;n.save(),n.rotate_14dthe$(l.angle),n.setFont_ov8mpe$(l.font),n.setFillStyle_2160e9$(s.fillColor),n.fillText_ai6r6m$(l.label,l.alignment.x,l.alignment.y),n.restore()},If.$metadata$={kind:c,simpleName:"TextRenderer",interfaces:[Sf]},Tf.$metadata$={kind:b,simpleName:"Renderers",interfaces:[]};var zf=null;function Df(){return null===zf&&new Tf,zf}function Mf(t,e,n,i,r,o,a,s){this.label=t,this.font=new le(j.CssStyleUtil.extractFontStyle_pdl1vz$(e),j.CssStyleUtil.extractFontWeight_pdl1vz$(e),n,i),this.dimension=null,this.alignment=null,this.angle=Qe(-r);var l=s.measure_2qe7uk$(this.label,this.font);this.alignment=H(-l.x*o,l.y*a),this.dimension=this.rotateTextSize_0(l.mul_14dthe$(2),this.angle)}function Bf(){Uf=this}Mf.prototype.rotateTextSize_0=function(t,e){var n=new E(t.x/2,+t.y/2).rotate_14dthe$(e),i=new E(t.x/2,-t.y/2).rotate_14dthe$(e),r=n.x,o=Z.abs(r),a=i.x,s=Z.abs(a),l=Z.max(o,s),u=n.y,c=Z.abs(u),p=i.y,h=Z.abs(p),_=Z.max(c,h);return H(2*l,2*_)},Mf.$metadata$={kind:c,simpleName:"TextSpec",interfaces:[]},Bf.prototype.apply_rxdkm1$=function(t,e){e.setFillStyle_2160e9$(t.fillColor),e.setStrokeStyle_2160e9$(t.strokeColor),e.setLineWidth_14dthe$(t.strokeWidth)},Bf.prototype.drawPath_iz58c6$=function(t,e,n){switch(n){case 0:this.square_mics58$(t,e);break;case 1:this.circle_mics58$(t,e);break;case 2:this.triangleUp_mics58$(t,e);break;case 3:this.plus_mics58$(t,e);break;case 4:this.cross_mics58$(t,e);break;case 5:this.diamond_mics58$(t,e);break;case 6:this.triangleDown_mics58$(t,e);break;case 7:this.square_mics58$(t,e),this.cross_mics58$(t,e);break;case 8:this.plus_mics58$(t,e),this.cross_mics58$(t,e);break;case 9:this.diamond_mics58$(t,e),this.plus_mics58$(t,e);break;case 10:this.circle_mics58$(t,e),this.plus_mics58$(t,e);break;case 11:this.triangleUp_mics58$(t,e),this.triangleDown_mics58$(t,e);break;case 12:this.square_mics58$(t,e),this.plus_mics58$(t,e);break;case 13:this.circle_mics58$(t,e),this.cross_mics58$(t,e);break;case 14:this.squareTriangle_mics58$(t,e);break;case 15:this.square_mics58$(t,e);break;case 16:this.circle_mics58$(t,e);break;case 17:this.triangleUp_mics58$(t,e);break;case 18:this.diamond_mics58$(t,e);break;case 19:case 20:case 21:this.circle_mics58$(t,e);break;case 22:this.square_mics58$(t,e);break;case 23:this.diamond_mics58$(t,e);break;case 24:this.triangleUp_mics58$(t,e);break;case 25:this.triangleDown_mics58$(t,e);break;default:throw S("Unknown point shape")}},Bf.prototype.circle_mics58$=function(t,e){t.arc_6p3vsx$(0,0,e,0,2*wt.PI)},Bf.prototype.square_mics58$=function(t,e){t.moveTo_lu1900$(-e,-e),t.lineTo_lu1900$(e,-e),t.lineTo_lu1900$(e,e),t.lineTo_lu1900$(-e,e),t.lineTo_lu1900$(-e,-e)},Bf.prototype.squareTriangle_mics58$=function(t,e){t.moveTo_lu1900$(-e,e),t.lineTo_lu1900$(0,-e),t.lineTo_lu1900$(e,e),t.lineTo_lu1900$(-e,e),t.lineTo_lu1900$(-e,-e),t.lineTo_lu1900$(e,-e),t.lineTo_lu1900$(e,e)},Bf.prototype.triangleUp_mics58$=function(t,e){var n=3*e/Z.sqrt(3);t.moveTo_lu1900$(0,-e),t.lineTo_lu1900$(n/2,e/2),t.lineTo_lu1900$(-n/2,e/2),t.lineTo_lu1900$(0,-e)},Bf.prototype.triangleDown_mics58$=function(t,e){var n=3*e/Z.sqrt(3);t.moveTo_lu1900$(0,e),t.lineTo_lu1900$(-n/2,-e/2),t.lineTo_lu1900$(n/2,-e/2),t.lineTo_lu1900$(0,e)},Bf.prototype.plus_mics58$=function(t,e){t.moveTo_lu1900$(0,-e),t.lineTo_lu1900$(0,e),t.moveTo_lu1900$(-e,0),t.lineTo_lu1900$(e,0)},Bf.prototype.cross_mics58$=function(t,e){t.moveTo_lu1900$(-e,-e),t.lineTo_lu1900$(e,e),t.moveTo_lu1900$(-e,e),t.lineTo_lu1900$(e,-e)},Bf.prototype.diamond_mics58$=function(t,e){t.moveTo_lu1900$(0,-e),t.lineTo_lu1900$(e,0),t.lineTo_lu1900$(0,e),t.lineTo_lu1900$(-e,0),t.lineTo_lu1900$(0,-e)},Bf.$metadata$={kind:b,simpleName:"Utils",interfaces:[]};var Uf=null;function Ff(){return null===Uf&&new Bf,Uf}function qf(){this.scale=1,this.zoom=0}function Gf(t){Kf(),Bs.call(this,t)}function Hf(){Vf=this,this.COMPONENT_TYPES_0=x([p(bo),p(qf)])}qf.$metadata$={kind:c,simpleName:"ScaleComponent",interfaces:[Ys]},Gf.prototype.updateImpl_og8vrq$=function(t,n){var i;if(po(t.camera))for(i=this.getEntities_38uplf$(Kf().COMPONENT_TYPES_0).iterator();i.hasNext();){var r,o,a=i.next();if(null==(o=null==(r=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(qf)))||e.isType(r,qf)?r:C()))throw S("Component "+p(qf).simpleName+" is not found");var s=o,l=t.camera.zoom-s.zoom,u=Z.pow(2,l);s.scale=u}},Hf.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Yf,Vf=null;function Kf(){return null===Vf&&new Hf,Vf}function Wf(){}function Xf(t,e){this.layerIndex=t,this.index=e}function Zf(t){this.locatorHelper=t}Gf.$metadata$={kind:c,simpleName:"ScaleUpdateSystem",interfaces:[Bs]},Wf.prototype.getColor_ahlfl2$=function(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(hf)))||e.isType(n,hf)?n:C()))throw S("Component "+p(hf).simpleName+" is not found");return i.fillColor},Wf.prototype.isCoordinateInTarget_29hhdz$=function(t,n){var i,r;if(null==(r=null==(i=n.componentManager.getComponents_ahlfl2$(n).get_11rb$(p(Zh)))||e.isType(i,Zh)?i:C()))throw S("Component "+p(Zh).simpleName+" is not found");var o,a,s,l=r.dimension;if(null==(a=null==(o=n.componentManager.getComponents_ahlfl2$(n).get_11rb$(p(Gh)))||e.isType(o,Gh)?o:C()))throw S("Component "+p(Gh).simpleName+" is not found");for(s=a.origins.iterator();s.hasNext();){var u=s.next();if(Xn(new zt(u,l),t))return!0}return!1},Wf.$metadata$={kind:c,simpleName:"BarLocatorHelper",interfaces:[nd]},Xf.$metadata$={kind:c,simpleName:"IndexComponent",interfaces:[Ys]},Zf.$metadata$={kind:c,simpleName:"LocatorComponent",interfaces:[Ys]};var Jf=Le((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(i),r(n))}}}));function Qf(){this.searchResult=null,this.zoom=null,this.cursotPosition=null}function td(t){Bs.call(this,t)}function ed(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Xf)))||e.isType(n,Xf)?n:C()))throw S("Component "+p(Xf).simpleName+" is not found");return i.layerIndex}function nd(){}function id(){rd=this}Qf.$metadata$={kind:c,simpleName:"HoverObjectComponent",interfaces:[Ys]},td.prototype.initImpl_4pvjek$=function(t){Bs.prototype.initImpl_4pvjek$.call(this,t),this.createEntity_61zpoe$("hover_object").add_57nep2$(new Qf).add_57nep2$(new wl)},td.prototype.updateImpl_og8vrq$=function(t,n){var i,r,o,a,s,l,u=this.componentManager.getSingletonEntity_9u06oy$(p(Qf));if(null==(l=null==(s=u.componentManager.getComponents_ahlfl2$(u).get_11rb$(p(wl)))||e.isType(s,wl)?s:C()))throw S("Component "+p(wl).simpleName+" is not found");var c,h=l;if(null!=(r=null!=(i=h.location)?Zn(i.x,i.y):null)){var _,f,d=r;if(null==(f=null==(_=u.componentManager.getComponents_ahlfl2$(u).get_11rb$(p(Qf)))||e.isType(_,Qf)?_:C()))throw S("Component "+p(Qf).simpleName+" is not found");var m=f;if(t.camera.isZoomChanged&&!po(t.camera))return m.cursotPosition=null,m.zoom=null,void(m.searchResult=null);if(!Bt(m.cursotPosition,d)||t.camera.zoom!==(null!=(a=null!=(o=m.zoom)?o:null)?a:kt.NaN))if(null==h.dragDistance){var $,v;if(m.cursotPosition=d,m.zoom=g(t.camera.zoom),null!=($=Fe(Jn(y(this.getEntities_38uplf$(Yf),(c=d,function(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Zf)))||e.isType(n,Zf)?n:C()))throw S("Component "+p(Zf).simpleName+" is not found");return i.locatorHelper.isCoordinateInTarget_29hhdz$(c,t)})),new Re(Jf(ed)))))){var b,w;if(null==(w=null==(b=$.componentManager.getComponents_ahlfl2$($).get_11rb$(p(Xf)))||e.isType(b,Xf)?b:C()))throw S("Component "+p(Xf).simpleName+" is not found");var x,k,E=w.layerIndex;if(null==(k=null==(x=$.componentManager.getComponents_ahlfl2$($).get_11rb$(p(Xf)))||e.isType(x,Xf)?x:C()))throw S("Component "+p(Xf).simpleName+" is not found");var T,O,N=k.index;if(null==(O=null==(T=$.componentManager.getComponents_ahlfl2$($).get_11rb$(p(Zf)))||e.isType(T,Zf)?T:C()))throw S("Component "+p(Zf).simpleName+" is not found");v=new wd(E,N,O.locatorHelper.getColor_ahlfl2$($))}else v=null;m.searchResult=v}else m.cursotPosition=d}},td.$metadata$={kind:c,simpleName:"HoverObjectDetectionSystem",interfaces:[Bs]},nd.$metadata$={kind:v,simpleName:"LocatorHelper",interfaces:[]},id.prototype.calculateAngle_2d1svq$=function(t,e){var n=e.x-t.x,i=e.y-t.y;return Z.atan2(i,n)},id.prototype.distance_2d1svq$=function(t,e){var n=t.x-e.x,i=Z.pow(n,2),r=t.y-e.y,o=i+Z.pow(r,2);return Z.sqrt(o)},id.prototype.coordInExtendedRect_3tn9i8$=function(t,e,n){var i=Xn(e,t);if(!i){var r=t.x-Rt(e);i=Z.abs(r)<=n}var o=i;if(!o){var a=t.x-Ht(e);o=Z.abs(a)<=n}var s=o;if(!s){var l=t.y-Yt(e);s=Z.abs(l)<=n}var u=s;if(!u){var c=t.y-Dt(e);u=Z.abs(c)<=n}return u},id.prototype.pathContainsCoordinate_ya4zfl$=function(t,e,n){var i;i=e.size-1|0;for(var r=0;r=s?this.calculateSquareDistanceToPathPoint_0(t,e,i):this.calculateSquareDistanceToPathPoint_0(t,e,n)-l},id.prototype.calculateSquareDistanceToPathPoint_0=function(t,e,n){var i=t.x-e.get_za3lpa$(n).x,r=t.y-e.get_za3lpa$(n).y;return i*i+r*r},id.prototype.ringContainsCoordinate_bsqkoz$=function(t,e){var n,i=0;n=t.size;for(var r=1;r=e.y&&t.get_za3lpa$(r).y>=e.y||t.get_za3lpa$(o).yn.radius)return!1;var i=od().calculateAngle_2d1svq$(e,t);return i<-wt.PI/2&&(i+=2*wt.PI),n.startAngle<=i&&ithis.myTileCacheLimit_0;)g.add_11rb$(this.myCache_0.removeAt_za3lpa$(0));this.removeCells_0(g)},nm.prototype.removeCells_0=function(t){var n,i=Ft(this.getEntities_9u06oy$(p(lf)));for(n=y(this.getEntities_9u06oy$(p(ha)),function(t){return function(n){var i,r,o=t;if(null==(r=null==(i=n.componentManager.getComponents_ahlfl2$(n).get_11rb$(p(ha)))||e.isType(i,ha)?i:C()))throw S("Component "+p(ha).simpleName+" is not found");return o.contains_11rb$(r.cellKey)}}(t)).iterator();n.hasNext();){var r,o=n.next();for(r=i.iterator();r.hasNext();){var a,s,l=r.next();if(null==(s=null==(a=l.componentManager.getComponents_ahlfl2$(l).get_11rb$(p(lf)))||e.isType(a,lf)?a:C()))throw S("Component "+p(lf).simpleName+" is not found");s.remove_za3lpa$(o.id_8be2vx$)}o.remove()}},nm.$metadata$={kind:c,simpleName:"TileRemovingSystem",interfaces:[Bs]},Object.defineProperty(im.prototype,"myCellRect_0",{configurable:!0,get:function(){return null==this.myCellRect_cbttp2$_0?T("myCellRect"):this.myCellRect_cbttp2$_0},set:function(t){this.myCellRect_cbttp2$_0=t}}),Object.defineProperty(im.prototype,"myCtx_0",{configurable:!0,get:function(){return null==this.myCtx_uwiahv$_0?T("myCtx"):this.myCtx_uwiahv$_0},set:function(t){this.myCtx_uwiahv$_0=t}}),im.prototype.render_j83es7$=function(t,n){var i,r,o;if(null==(o=null==(r=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Gd)))||e.isType(r,Gd)?r:C()))throw S("Component "+p(Gd).simpleName+" is not found");if(null!=(i=o.tile)){var a,s,l=i;if(null==(s=null==(a=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Zh)))||e.isType(a,Zh)?a:C()))throw S("Component "+p(Zh).simpleName+" is not found");var u=s.dimension;this.render_k86o6i$(l,new zt(f_().ZERO_CLIENT_POINT,u),n)}},im.prototype.render_k86o6i$=function(t,e,n){this.myCellRect_0=e,this.myCtx_0=n,this.renderTile_0(t,new Wt(""),new Wt(""))},im.prototype.renderTile_0=function(t,n,i){if(e.isType(t,Wd))this.renderSnapshotTile_0(t,n,i);else if(e.isType(t,Xd))this.renderSubTile_0(t,n,i);else if(e.isType(t,Zd))this.renderCompositeTile_0(t,n,i);else if(!e.isType(t,Jd))throw S(("Unsupported Tile class: "+p(Kd)).toString())},im.prototype.renderSubTile_0=function(t,e,n){this.renderTile_0(t.tile,t.subKey.plus_vnxxg4$(e),n)},im.prototype.renderCompositeTile_0=function(t,e,n){var i;for(i=t.tiles.iterator();i.hasNext();){var r=i.next(),o=r.component1(),a=r.component2();this.renderTile_0(o,e,n.plus_vnxxg4$(a))}},im.prototype.renderSnapshotTile_0=function(t,e,n){var i=li(e,this.myCellRect_0),r=li(n,this.myCellRect_0);this.myCtx_0.drawImage_urnjjc$(t.snapshot,Rt(i),Dt(i),It(i),Mt(i),Rt(r),Dt(r),It(r),Mt(r))},im.$metadata$={kind:c,simpleName:"TileRenderer",interfaces:[Sf]},Object.defineProperty(rm.prototype,"myMapRect_0",{configurable:!0,get:function(){return null==this.myMapRect_7veail$_0?T("myMapRect"):this.myMapRect_7veail$_0},set:function(t){this.myMapRect_7veail$_0=t}}),Object.defineProperty(rm.prototype,"myDonorTileCalculators_0",{configurable:!0,get:function(){return null==this.myDonorTileCalculators_o8thho$_0?T("myDonorTileCalculators"):this.myDonorTileCalculators_o8thho$_0},set:function(t){this.myDonorTileCalculators_o8thho$_0=t}}),rm.prototype.initImpl_4pvjek$=function(t){this.myMapRect_0=t.mapProjection.mapRect,Qs(this.createEntity_61zpoe$("tile_for_request"),om)},rm.prototype.updateImpl_og8vrq$=function(t,n){this.myDonorTileCalculators_0=this.createDonorTileCalculators_0();var i,r,o=this.componentManager.getSingletonEntity_9u06oy$(p(pa));if(null==(r=null==(i=o.componentManager.getComponents_ahlfl2$(o).get_11rb$(p(pa)))||e.isType(i,pa)?i:C()))throw S("Component "+p(pa).simpleName+" is not found");var a,s=Hn(r.requestCells);for(a=this.getEntities_9u06oy$(p(ha)).iterator();a.hasNext();){var l,u,c=a.next();if(null==(u=null==(l=c.componentManager.getComponents_ahlfl2$(c).get_11rb$(p(ha)))||e.isType(l,ha)?l:C()))throw S("Component "+p(ha).simpleName+" is not found");s.remove_11rb$(u.cellKey)}var h,_=A("createTileLayerEntities",function(t,e){return t.createTileLayerEntities_0(e),N}.bind(null,this));for(h=s.iterator();h.hasNext();)_(h.next());var f,d,m=this.componentManager.getSingletonEntity_9u06oy$(p(Hd));if(null==(d=null==(f=m.componentManager.getComponents_ahlfl2$(m).get_11rb$(p(Hd)))||e.isType(f,Hd)?f:C()))throw S("Component "+p(Hd).simpleName+" is not found");d.requestTiles=s},rm.prototype.createDonorTileCalculators_0=function(){var t,n,i=st();for(t=this.getEntities_38uplf$(py().TILE_COMPONENT_LIST).iterator();t.hasNext();){var r,o,a=t.next();if(null==(o=null==(r=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(Gd)))||e.isType(r,Gd)?r:C()))throw S("Component "+p(Gd).simpleName+" is not found");if(!o.nonCacheable){var s,l;if(null==(l=null==(s=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(Gd)))||e.isType(s,Gd)?s:C()))throw S("Component "+p(Gd).simpleName+" is not found");if(null!=(n=l.tile)){var u,c,h=n;if(null==(c=null==(u=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(ba)))||e.isType(u,ba)?u:C()))throw S("Component "+p(ba).simpleName+" is not found");var _,f=c.layerKind,d=i.get_11rb$(f);if(null==d){var m=st();i.put_xwzc9p$(f,m),_=m}else _=d;var y,$,v=_;if(null==($=null==(y=a.componentManager.getComponents_ahlfl2$(a).get_11rb$(p(ha)))||e.isType(y,ha)?y:C()))throw S("Component "+p(ha).simpleName+" is not found");var g=$.cellKey;v.put_xwzc9p$(g,h)}}}var b,w=xn(bn(i.size));for(b=i.entries.iterator();b.hasNext();){var x=b.next(),k=w.put_xwzc9p$,E=x.key,T=x.value;k.call(w,E,new Yd(T))}return w},rm.prototype.createTileLayerEntities_0=function(t){var n,i=t.length,r=_e(t,this.myMapRect_0);for(n=this.getEntities_9u06oy$(p(_a)).iterator();n.hasNext();){var o,a,s=n.next();if(null==(a=null==(o=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(_a)))||e.isType(o,_a)?o:C()))throw S("Component "+p(_a).simpleName+" is not found");var l,u,c=a.layerKind,h=Qs(wr(this.componentManager,new yc(s.id_8be2vx$),"tile_"+c+"_"+t),am(r,i,this,t,c,s));if(null==(u=null==(l=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(lf)))||e.isType(l,lf)?l:C()))throw S("Component "+p(lf).simpleName+" is not found");u.add_za3lpa$(h.id_8be2vx$)}},rm.prototype.getRenderer_0=function(t){return t.contains_9u06oy$(p(fa))?new _y:new im},rm.prototype.calculateDonorTile_0=function(t,e){var n;return null!=(n=this.myDonorTileCalculators_0.get_11rb$(t))?n.createDonorTile_92p1wg$(e):null},rm.prototype.screenDimension_0=function(t){var e=new Zh;return t(e),e},rm.prototype.renderCache_0=function(t){var e=new Md;return t(e),e},rm.$metadata$={kind:c,simpleName:"TileRequestSystem",interfaces:[Bs]},sm.$metadata$={kind:v,simpleName:"TileSystemProvider",interfaces:[]},um.prototype.create_v8qzyl$=function(t){return new Em(Om(this.closure$black,this.closure$white),t)},Object.defineProperty(um.prototype,"isVector",{configurable:!0,get:function(){return this.isVector_6ju0ww$_0}}),um.$metadata$={kind:c,interfaces:[sm]},lm.prototype.chessboard_a87jzg$=function(t,e){return void 0===t&&(t=k.Companion.GRAY),void 0===e&&(e=k.Companion.LIGHT_GRAY),new um(t,e)},cm.prototype.create_v8qzyl$=function(t){return new Em(Tm(this.closure$color),t)},Object.defineProperty(cm.prototype,"isVector",{configurable:!0,get:function(){return this.isVector_vug5zv$_0}}),cm.$metadata$={kind:c,interfaces:[sm]},lm.prototype.solid_98b62m$=function(t){return new cm(t)},pm.prototype.create_v8qzyl$=function(t){return new dm(this.closure$domains,t)},Object.defineProperty(pm.prototype,"isVector",{configurable:!0,get:function(){return this.isVector_e34bo7$_0}}),pm.$metadata$={kind:c,interfaces:[sm]},lm.prototype.raster_mhpeer$=function(t){return new pm(t)},hm.prototype.create_v8qzyl$=function(t){return new ny(this.closure$quantumIterations,this.closure$tileService,t)},Object.defineProperty(hm.prototype,"isVector",{configurable:!0,get:function(){return this.isVector_5jtyhf$_0}}),hm.$metadata$={kind:c,interfaces:[sm]},lm.prototype.letsPlot_e94j16$=function(t,e){return void 0===e&&(e=1e3),new hm(e,t)},lm.$metadata$={kind:b,simpleName:"Tilesets",interfaces:[]};var _m=null;function fm(){}function dm(t,e){xm(),Bs.call(this,e),this.myDomains_0=t,this.myIndex_0=0,this.myTileTransport_0=new hi}function mm(t,e){return function(n){return n.unaryPlus_jixjl7$(new ha(t)),n.unaryPlus_jixjl7$(e),N}}function ym(t){return function(e){return t.imageData=e,N}}function $m(t){return function(e){return t.imageData=new Int8Array(0),t.errorCode=e,N}}function vm(t,n,i){return function(r){return i.runLaterBySystem_ayosff$(t,function(t,n){return function(i){var r,o;if(null==(o=null==(r=i.componentManager.getComponents_ahlfl2$(i).get_11rb$(p(Gd)))||e.isType(r,Gd)?r:C()))throw S("Component "+p(Gd).simpleName+" is not found");var a=t,s=n;return o.nonCacheable=null!=a.errorCode,o.tile=new Wd(s),kc().tagDirtyParentLayer_ahlfl2$(i),N}}(n,r)),N}}function gm(t,e,n,i,r){return function(){var o,a;if(null!=t.errorCode){var l=null!=(o=s(t.errorCode).message)?o:"Unknown error",u=e.mapRenderContext.canvasProvider.createCanvas_119tl4$(xm().TILE_PIXEL_DIMESION),c=u.context2d,p=c.measureText_61zpoe$(l),h=p0&&ta.v&&1!==s.size;)l.add_wxm5ur$(0,s.removeAt_za3lpa$(s.size-1|0));1===s.size&&t.measureText_61zpoe$(s.get_za3lpa$(0))>a.v?(u.add_11rb$(s.get_za3lpa$(0)),a.v=t.measureText_61zpoe$(s.get_za3lpa$(0))):u.add_11rb$(m(s," ")),s=l,l=w()}for(o=e.iterator();o.hasNext();){var p=o.next(),h=this.bboxFromPoint_0(p,a.v,c);if(!this.labelInBounds_0(h)){var _,f,d=0;for(_=u.iterator();_.hasNext();){var y=_.next(),$=h.origin.y+c/2+c*ot((d=(f=d)+1|0,f));t.strokeText_ai6r6m$(y,p.x,$),t.fillText_ai6r6m$(y,p.x,$)}this.myLabelBounds_0.add_11rb$(h)}}},jm.prototype.labelInBounds_0=function(t){var e,n=this.myLabelBounds_0;t:do{var i;for(i=n.iterator();i.hasNext();){var r=i.next();if(t.intersects_wthzt5$(r)){e=r;break t}}e=null}while(0);return null!=e},jm.prototype.getLabel_0=function(t){var e,n=null!=(e=this.myStyle_0.labelField)?e:Bm().LABEL_0;switch(n){case"short":return t.short;case"label":return t.label;default:throw S("Unknown label field: "+n)}},jm.prototype.applyTo_pzzegf$=function(t){var e,n;t.setFont_ov8mpe$(_i(null!=(e=this.myStyle_0.fontStyle)?j.CssStyleUtil.extractFontStyle_pdl1vz$(e):null,null!=(n=this.myStyle_0.fontStyle)?j.CssStyleUtil.extractFontWeight_pdl1vz$(n):null,this.myStyle_0.size,this.myStyle_0.fontFamily)),t.setTextAlign_iwro1z$(se.CENTER),t.setTextBaseline_5cz80h$(ae.MIDDLE),Bm().setBaseStyle_ocy23$(t,this.myStyle_0)},jm.$metadata$={kind:c,simpleName:"PointTextSymbolizer",interfaces:[Nm]},Lm.prototype.createDrawTasks_ldp3af$=function(t,e){return at()},Lm.prototype.applyTo_pzzegf$=function(t){},Lm.$metadata$={kind:c,simpleName:"ShieldTextSymbolizer",interfaces:[Nm]},Rm.prototype.createDrawTasks_ldp3af$=function(t,e){return at()},Rm.prototype.applyTo_pzzegf$=function(t){},Rm.$metadata$={kind:c,simpleName:"LineTextSymbolizer",interfaces:[Nm]},Im.prototype.create_h15n9n$=function(t,e){var n,i;switch(n=t.type){case"line":i=new Am(t);break;case"polygon":i=new Pm(t);break;case"point-text":i=new jm(t,e);break;case"shield-text":i=new Lm(t,e);break;case"line-text":i=new Rm(t,e);break;default:throw S(null==n?"Empty symbolizer type.".toString():"Unknown symbolizer type.".toString())}return i},Im.prototype.stringToLineCap_61zpoe$=function(t){var e;switch(t){case"butt":e=fi.BUTT;break;case"round":e=fi.ROUND;break;case"square":e=fi.SQUARE;break;default:throw S(("Unknown lineCap type: "+t).toString())}return e},Im.prototype.stringToLineJoin_61zpoe$=function(t){var e;switch(t){case"bevel":e=Wn.BEVEL;break;case"round":e=Wn.ROUND;break;case"miter":e=Wn.MITER;break;default:throw S(("Unknown lineJoin type: "+t).toString())}return e},Im.prototype.splitLabel_61zpoe$=function(t){var e,n,i,r,o=w(),a=0;n=(e=di(t)).first,i=e.last,r=e.step;for(var s=n;s<=i;s+=r)if(32===t.charCodeAt(s)){if(a!==s){var l=a;o.add_11rb$(t.substring(l,s))}a=s+1|0}else if(-1!==mi("-',.)!?",t.charCodeAt(s))){var u=a,c=s+1|0;o.add_11rb$(t.substring(u,c)),a=s+1|0}if(a!==t.length){var p=a;o.add_11rb$(t.substring(p))}return o},Im.prototype.setBaseStyle_ocy23$=function(t,e){var n,i,r;null!=(n=e.strokeWidth)&&A("setLineWidth",function(t,e){return t.setLineWidth_14dthe$(e),N}.bind(null,t))(n),null!=(i=e.fill)&&t.setFillStyle_2160e9$(i),null!=(r=e.stroke)&&t.setStrokeStyle_2160e9$(r)},Im.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var zm,Dm,Mm=null;function Bm(){return null===Mm&&new Im,Mm}function Um(){}function Fm(t,e){this.myMapProjection_0=t,this.myTileService_0=e}function qm(){}function Gm(t){this.myMapProjection_0=t}function Hm(t,e){return function(n){var i=t,r=e.name;return i.put_xwzc9p$(r,n),N}}function Ym(t,e,n){return function(i){t.add_11rb$(new Zm(i,gi(e.kinds,n),gi(e.subs,n),gi(e.labels,n),gi(e.shorts,n)))}}function Vm(t){this.closure$tileGeometryParser=t,this.myDone_0=!1}function Km(){}function Wm(t){this.myMapConfigSupplier_0=t}function Xm(t,e){return function(){return t.applyTo_pzzegf$(e),N}}function Zm(t,e,n,i,r){this.tileGeometry=t,this.myKind_0=e,this.mySub_0=n,this.label=i,this.short=r}function Jm(t,e,n){me.call(this),this.field=n,this.name$=t,this.ordinal$=e}function Qm(){Qm=function(){},zm=new Jm("CLASS",0,"class"),Dm=new Jm("SUB",1,"sub")}function ty(){return Qm(),zm}function ey(){return Qm(),Dm}function ny(t,e,n){py(),Bs.call(this,n),this.myQuantumIterations_0=t,this.myTileService_0=e,this.myMapRect_x008rn$_0=this.myMapRect_x008rn$_0,this.myCanvasSupplier_rjbwhf$_0=this.myCanvasSupplier_rjbwhf$_0,this.myTileDataFetcher_x9uzis$_0=this.myTileDataFetcher_x9uzis$_0,this.myTileDataParser_z2wh1i$_0=this.myTileDataParser_z2wh1i$_0,this.myTileDataRenderer_gwohqu$_0=this.myTileDataRenderer_gwohqu$_0}function iy(t,e){return function(n){return n.unaryPlus_jixjl7$(new ha(t)),n.unaryPlus_jixjl7$(e),n.unaryPlus_jixjl7$(new Ja),N}}function ry(t){return function(e){return t.tileData=e,N}}function oy(t){return function(e){return t.tileData=at(),N}}function ay(t,n){return function(i){return n.runLaterBySystem_ayosff$(t,(r=i,function(t){var n,i;if(null==(i=null==(n=t.componentManager.getComponents_ahlfl2$(t).get_11rb$(p(Gd)))||e.isType(n,Gd)?n:C()))throw S("Component "+p(Gd).simpleName+" is not found");return i.tile=new Wd(r),t.removeComponent_9u06oy$(p(Ja)),kc().tagDirtyParentLayer_ahlfl2$(t),N})),N;var r}}function sy(t,e){return function(n){n.onSuccess_qlkmfe$(ay(t,e))}}function ly(t,n,i){return function(r){var o,a=w();for(o=t.iterator();o.hasNext();){var s=o.next(),l=n,u=i;s.add_57nep2$(new Ja);var c,h,_=l.myTileDataRenderer_0,f=l.myCanvasSupplier_0();if(null==(h=null==(c=s.componentManager.getComponents_ahlfl2$(s).get_11rb$(p(ba)))||e.isType(c,ba)?c:C()))throw S("Component "+p(ba).simpleName+" is not found");a.add_11rb$(Al(_.render_qge02a$(f,r,u,h.layerKind),sy(s,l)))}return ql().join_asgahm$(a)}}function uy(){cy=this,this.CELL_COMPONENT_LIST=x([p(ha),p(ba)]),this.TILE_COMPONENT_LIST=x([p(ha),p(ba),p(Gd)])}Nm.$metadata$={kind:v,simpleName:"Symbolizer",interfaces:[]},Um.$metadata$={kind:v,simpleName:"TileDataFetcher",interfaces:[]},Fm.prototype.fetch_92p1wg$=function(t){var e=ca(this.myMapProjection_0,t),n=this.calculateBBox_0(e),i=t.length;return this.myTileService_0.getTileData_h9hod0$(n,i)},Fm.prototype.calculateBBox_0=function(t){var e,n=G.BBOX_CALCULATOR,i=rt(it(t,10));for(e=t.iterator();e.hasNext();){var r=e.next();i.add_11rb$(yi(qn(r)))}return $i(n,i)},Fm.$metadata$={kind:c,simpleName:"TileDataFetcherImpl",interfaces:[Um]},qm.$metadata$={kind:v,simpleName:"TileDataParser",interfaces:[]},Gm.prototype.parse_yeqvx5$=function(t,e){var n,i=this.calculateTransform_0(t),r=st(),o=rt(it(e,10));for(n=e.iterator();n.hasNext();){var a=n.next();o.add_11rb$(Al(this.parseTileLayer_0(a,i),Hm(r,a)))}var s,l=o;return Al(ql().join_asgahm$(l),(s=r,function(t){return s}))},Gm.prototype.calculateTransform_0=function(t){var e,n,i,r=new w_(t.length),o=_e(t,this.myMapProjection_0.mapRect),a=r.project_11rb$(o.origin);return e=r,n=this,i=a,function(t){return Ut(e.project_11rb$(n.myMapProjection_0.project_11rb$(t)),i)}},Gm.prototype.parseTileLayer_0=function(t,e){return jl(this.createMicroThread_0(new vi(t.geometryCollection)),(n=e,i=t,function(t){for(var e=w(),r=w(),o=t.size,a=0;a]*>[^<]*<\\/a>|[^<]*)"),this.linkRegex_0=ki('href="([^"]*)"[^>]*>([^<]*)<\\/a>')}function Oy(){this.default=Ny,this.pointer=Py}function Ny(){return N}function Py(){return N}function Ay(t,e,n,i,r){My(),Bs.call(this,e),this.myUiService_0=t,this.myMapLocationConsumer_0=n,this.myLayerManager_0=i,this.myAttribution_0=r,this.myLiveMapLocation_d7ahsw$_0=this.myLiveMapLocation_d7ahsw$_0,this.myZoomPlus_swwfsu$_0=this.myZoomPlus_swwfsu$_0,this.myZoomMinus_plmgvc$_0=this.myZoomMinus_plmgvc$_0,this.myGetCenter_3ls1ty$_0=this.myGetCenter_3ls1ty$_0,this.myMakeGeometry_kkepht$_0=this.myMakeGeometry_kkepht$_0,this.myViewport_aqqdmf$_0=this.myViewport_aqqdmf$_0,this.myButtonPlus_jafosd$_0=this.myButtonPlus_jafosd$_0,this.myButtonMinus_v7ijll$_0=this.myButtonMinus_v7ijll$_0,this.myDrawingGeometry_0=!1,this.myUiState_0=new Ry(this)}function jy(t){return function(){return Zy(t.href),N}}function Ly(){}function Ry(t){this.$outer=t,Ly.call(this)}function Iy(t){this.$outer=t,Ly.call(this)}function zy(){Dy=this,this.KEY_PLUS_0="img_plus",this.KEY_PLUS_DISABLED_0="img_plus_disable",this.KEY_MINUS_0="img_minus",this.KEY_MINUS_DISABLED_0="img_minus_disable",this.KEY_GET_CENTER_0="img_get_center",this.KEY_MAKE_GEOMETRY_0="img_create_geometry",this.KEY_MAKE_GEOMETRY_ACTIVE_0="img_create_geometry_active",this.BUTTON_PLUS_0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAMAAADypuvZAAAAUVBMVEUAAADf39/f39/n5+fk5OTk5OTl5eXl5eXk5OTm5ubl5eXl5eXm5uYAAAAQEBAgICCfn5+goKDl5eXo6Oj29vb39/f4+Pj5+fn9/f3+/v7///8nQ8gkAAAADXRSTlMAECAgX2B/gL+/z9/fDLiFVAAAAKJJREFUeNrt1tEOwiAMheGi2xQ2KBzc3Hj/BxXv5K41MTHKf/+lCSRNichcLMS5gZ6dF6iaTxUtyPejSFszZkMjciXy9oyJHNaiaoMloOjaAT0qHXX0WRQDJzVi74Ma+drvoBj8S5xEiH1TEKHQIhahyM2g9I//1L4hq1HkkPqO6OgL0aFHFpvO3OBo0h9UA5kFeZWTLWN+80isjU5OrpMhegCRuP2dffXKGwAAAABJRU5ErkJggg==",this.BUTTON_MINUS_0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAMAAADypuvZAAAAUVBMVEUAAADf39/f39/n5+fk5OTk5OTl5eXl5eXk5OTm5ubl5eXl5eXm5uYAAAAQEBAgICCfn5+goKDl5eXo6Oj29vb39/f4+Pj5+fn9/f3+/v7///8nQ8gkAAAADXRSTlMAECAgX2B/gL+/z9/fDLiFVAAAAI1JREFUeNrt1rEOwjAMRdEXaAtJ2qZ9JqHJ/38oYqObzYRQ7n5kS14MwN081YUB764zTcULgJnyrE1bFkaHkVKboUM4ITA3U4UeZLN1kHbUOuqoo19E27p8lHYVSsupVYXWM0q69dJp0N6P21FHf4OqHXkWm3kwYLI/VAPcTMl6UoTx2ycRGIOe3CcHvAAlagACEKjXQgAAAABJRU5ErkJggg==",this.BUTTON_MINUS_DISABLED_0="data:image/png;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16X1LabWFOow7bu8aSmIMe2ANUM9Mg36JuAiGgJAMYYZyGKoihfV4qZlwCQ57mTf8lai/1+X3rZgpIkCdvt9reyvSwIAif6fqy1OB6PyPP80l42HA6jZjYAlkrTdHZuN5u4QMHMSyJaGmM+R1GUA8B3Hdvtjp1TGh0AAAAASUVORK5CYII=",this.CONTRIBUTORS_FONT_FAMILY_0='-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',this.BUTTON_MAKE_GEOMETRY_0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAMAAADypuvZAAAAQlBMVEUAAADf39/n5+fm5ubm5ubm5ubm5uYAAABvb29wcHB/f3+AgICPj4+/v7/f39/m5ubv7+/w8PD8/Pz9/f3+/v7////uOQjKAAAAB3RSTlMAICCvw/H3O5ZWYwAAAKZJREFUeAHt1sEOgyAQhGEURMWFsdR9/1ctddPepwlJD/z3LyRzIOvcHCKY/NTMArJlch6PS4nqieCAqlRPxIaUDOiPBhooixQWpbWVOFTWu0whMST90WaoMCiZOZRAb7OLZCVQ+jxCIDMcMsMhMwTKItttCPQdmkDFzK4MEkPSH2VDhUJ62Awc0iKS//Q3GmigiIsztaGAszLmOuF/OxLd7CkSw+RetQbMcCdSSXgAAAAASUVORK5CYII=",this.BUTTON_MAKE_GEOMETRY_ACTIVE_0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAMAAADypuvZAAAAflBMVEUAAACfv9+fv+eiv+aiwOajwOajv+ajwOaiv+ajv+akwOakweaiv+aoxu+ox++ox/Cx0fyy0vyz0/2z0/601P+92f++2v/G3v/H3v/H3//U5v/V5//Z6f/Z6v/a6f/a6v/d7P/f7f/n8f/o8f/o8v/s9P/6/P/7/P/7/f////8N3bWvAAAADHRSTlMAICCvr6/Dw/Hx9/cE8gnKAAABCUlEQVR42tXW2U7DMBAFUIcC6TJ0i20oDnRNyvz/DzJtJCJxkUdTqUK5T7Gs82JfTezcQzkjS54KMRMyZly4R1pU3pDVnEpHtPKmrGkqyBtDNBgUmy9mrrtFLZ+/VoeIKArJIm4joBNriBtArKP2T+QzYck/olqSMf2+frmblKK1EVuWfNpQ5GveTCh16P3+aN+hAChz5Nu+S/0+XC6aXUqvSiPA1JYaodERGh2h0ZH0bQ9GaXl/0ErLsW87w9yD6twRbbBvOvIfeAw68uGnb5BbBsvQhuVZ/wEganR0ABTOGmoDIB+OWdQ2YUhPAjuaUWUzS0ElzZcWU73Q6IZH4uTytByZyPS5cN9XNuQXxwNiAAAAAABJRU5ErkJggg=="}yy.$metadata$={kind:c,simpleName:"DebugDataSystem",interfaces:[Bs]},by.prototype.fetch_92p1wg$=function(t){var n,i,r,o=this.myTileDataFetcher_0.fetch_92p1wg$(t),a=this.mySystemTime_0.getTimeMs();return o.onSuccess_qlkmfe$((n=this,i=t,r=a,function(t){var o,a,s,u,c,p=n.myStats_0,h=i,_=Dd().CELL_DATA_SIZE,f=0;for(c=t.iterator();c.hasNext();)f=f+c.next().size|0;p.add_xamlz8$(h,_,(f/1024|0).toString()+"Kb"),n.myStats_0.add_xamlz8$(i,Dd().LOADING_TIME,n.mySystemTime_0.getTimeMs().subtract(r).toString()+"ms");var m,y=d("size",1,(function(t){return t.size}));t:do{var $=t.iterator();if(!$.hasNext()){m=null;break t}var v=$.next();if(!$.hasNext()){m=v;break t}var g=y(v);do{var b=$.next(),w=y(b);e.compareTo(g,w)<0&&(v=b,g=w)}while($.hasNext());m=v}while(0);var x=m;return u=n.myStats_0,o=Dd().BIGGEST_LAYER,s=l(null!=x?x.name:null)+" "+((null!=(a=null!=x?x.size:null)?a:0)/1024|0)+"Kb",u.add_xamlz8$(i,o,s),N})),o},by.$metadata$={kind:c,simpleName:"DebugTileDataFetcher",interfaces:[Um]},wy.prototype.parse_yeqvx5$=function(t,e){var n,i,r,o=new Ol(this.mySystemTime_0,this.myTileDataParser_0.parse_yeqvx5$(t,e));return o.addFinishHandler_o14v8n$((n=this,i=t,r=o,function(){return n.myStats_0.add_xamlz8$(i,Dd().PARSING_TIME,r.processTime.toString()+"ms ("+r.maxResumeTime.toString()+"ms)"),N})),o},wy.$metadata$={kind:c,simpleName:"DebugTileDataParser",interfaces:[qm]},xy.prototype.render_qge02a$=function(t,e,n,i){var r=this.myTileDataRenderer_0.render_qge02a$(t,e,n,i);if(i===va())return r;var o=Dd().renderTimeKey_23sqz4$(i),a=Dd().snapshotTimeKey_23sqz4$(i),s=new Ol(this.mySystemTime_0,r);return s.addFinishHandler_o14v8n$(ky(this,s,n,a,o)),s},xy.$metadata$={kind:c,simpleName:"DebugTileDataRenderer",interfaces:[Km]},Object.defineProperty(Cy.prototype,"text",{get:function(){return this.text_h19r89$_0}}),Cy.$metadata$={kind:c,simpleName:"SimpleText",interfaces:[Ey]},Cy.prototype.component1=function(){return this.text},Cy.prototype.copy_61zpoe$=function(t){return new Cy(void 0===t?this.text:t)},Cy.prototype.toString=function(){return"SimpleText(text="+e.toString(this.text)+")"},Cy.prototype.hashCode=function(){var t=0;return 31*t+e.hashCode(this.text)|0},Cy.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.text,t.text)},Object.defineProperty(Sy.prototype,"text",{get:function(){return this.text_xpr0uk$_0}}),Sy.$metadata$={kind:c,simpleName:"SimpleLink",interfaces:[Ey]},Sy.prototype.component1=function(){return this.href},Sy.prototype.component2=function(){return this.text},Sy.prototype.copy_puj7f4$=function(t,e){return new Sy(void 0===t?this.href:t,void 0===e?this.text:e)},Sy.prototype.toString=function(){return"SimpleLink(href="+e.toString(this.href)+", text="+e.toString(this.text)+")"},Sy.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.href)|0)+e.hashCode(this.text)|0},Sy.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.href,t.href)&&e.equals(this.text,t.text)},Ey.$metadata$={kind:v,simpleName:"AttributionParts",interfaces:[]},Ty.prototype.parse=function(){for(var t=w(),e=this.regex_0.find_905azu$(this.rawAttribution_0);null!=e;){if(e.value.length>0){var n=oi(e.value,"1)throw f("There are more than one mapper for "+e);return n.iterator().next()},zt.prototype.getMappers_abn725$=function(t,e){var n,i=this.getMappers_0(e),r=null;for(n=i.iterator();n.hasNext();){var o=n.next();if(It().isDescendant_1xbo8k$(t,o)){if(null==r){if(1===i.size)return Y(o);r=Z()}r.add_11rb$(o)}}return null==r?J():r},zt.prototype.put_teo19m$=function(t,e){if(this.myProperties_0.containsKey_11rb$(t))throw f("Property "+t+" is already defined");if(null==e)throw V("Trying to set null as a value of "+t);this.myProperties_0.put_xwzc9p$(t,e)},zt.prototype.get_kpbivk$=function(t){var n,i;if(null==(n=this.myProperties_0.get_11rb$(t)))throw f("Property "+t+" wasn't found");return null==(i=n)||e.isType(i,K)?i:k()},zt.prototype.contains_iegf2p$=function(t){return this.myProperties_0.containsKey_11rb$(t)},zt.prototype.remove_9l51dn$=function(t){var n;if(!this.myProperties_0.containsKey_11rb$(t))throw f("Property "+t+" wasn't found");return null==(n=this.myProperties_0.remove_11rb$(t))||e.isType(n,K)?n:k()},zt.prototype.getMappers=function(){var t,e=Z();for(t=this.myMappers_0.keys.iterator();t.hasNext();){var n=t.next();e.addAll_brywnq$(this.getMappers_0(n))}return e},zt.prototype.getMappers_0=function(t){var n,i,r;if(!this.myMappers_0.containsKey_11rb$(t))return J();var o=this.myMappers_0.get_11rb$(t);if(e.isType(o,st)){var a=e.isType(n=o,st)?n:k();return Y(a)}var s=Z();for(r=(e.isType(i=o,U)?i:k()).iterator();r.hasNext();){var l=r.next();s.add_11rb$(l)}return s},zt.$metadata$={kind:p,simpleName:"MappingContext",interfaces:[]},Ut.prototype.onItemAdded_u8tacu$=function(t){var e=this.this$ObservableCollectionRoleSynchronizer.createMapper_11rb$(_(t.newItem));this.closure$modifiableMappers.add_wxm5ur$(t.index,e),this.this$ObservableCollectionRoleSynchronizer.myTarget_0.add_wxm5ur$(t.index,e.target),this.this$ObservableCollectionRoleSynchronizer.processMapper_obu244$(e)},Ut.prototype.onItemRemoved_u8tacu$=function(t){this.closure$modifiableMappers.removeAt_za3lpa$(t.index),this.this$ObservableCollectionRoleSynchronizer.myTarget_0.removeAt_za3lpa$(t.index)},Ut.$metadata$={kind:p,interfaces:[Q]},Bt.prototype.onAttach=function(){var t;if(nt.prototype.onAttach.call(this),!this.myTarget_0.isEmpty())throw V("Target Collection Should Be Empty");this.myCollectionRegistration_0=B.Companion.EMPTY,new it(this).update_4f0l55$(this.mySource_0);var e=this.modifiableMappers;for(t=e.iterator();t.hasNext();){var n=t.next();this.myTarget_0.add_11rb$(n.target)}this.myCollectionRegistration_0=this.mySource_0.addListener_n5no9j$(new Ut(this,e))},Bt.prototype.onDetach=function(){nt.prototype.onDetach.call(this),_(this.myCollectionRegistration_0).remove(),this.myTarget_0.clear()},Bt.$metadata$={kind:p,simpleName:"ObservableCollectionRoleSynchronizer",interfaces:[nt]},Ft.$metadata$={kind:A,simpleName:"RefreshableSynchronizer",interfaces:[Wt]},qt.prototype.attach_1rog5x$=function(t){this.myReg_cuddgt$_0=this.doAttach_1rog5x$(t)},qt.prototype.detach=function(){_(this.myReg_cuddgt$_0).remove()},qt.$metadata$={kind:p,simpleName:"RegistrationSynchronizer",interfaces:[Wt]},Gt.$metadata$={kind:A,simpleName:"RoleSynchronizer",interfaces:[Wt]},Yt.prototype.mapperAdded_r9e1k2$=function(t,e){this.this$SimpleRoleSynchronizer.myTarget_0.add_wxm5ur$(t,e.target)},Yt.prototype.mapperRemoved_r9e1k2$=function(t,e){this.this$SimpleRoleSynchronizer.myTarget_0.removeAt_za3lpa$(t)},Yt.$metadata$={kind:p,interfaces:[it]},Ht.prototype.refresh=function(){new Yt(this).update_4f0l55$(this.mySource_0)},Ht.prototype.onAttach=function(){nt.prototype.onAttach.call(this),this.refresh()},Ht.prototype.onDetach=function(){nt.prototype.onDetach.call(this),this.myTarget_0.clear()},Ht.$metadata$={kind:p,simpleName:"SimpleRoleSynchronizer",interfaces:[Ft,nt]},Object.defineProperty(Vt.prototype,"mappers",{configurable:!0,get:function(){return null==this.myTargetMapper_0.get()?T():O(_(this.myTargetMapper_0.get()))}}),Kt.prototype.onEvent_11rb$=function(t){this.this$SingleChildRoleSynchronizer.sync_0()},Kt.$metadata$={kind:p,interfaces:[tt]},Vt.prototype.attach_1rog5x$=function(t){this.sync_0(),this.myChildRegistration_0=this.myChildProperty_0.addHandler_gxwwpc$(new Kt(this))},Vt.prototype.detach=function(){this.myChildRegistration_0.remove(),this.myTargetProperty_0.set_11rb$(null),this.myTargetMapper_0.set_11rb$(null)},Vt.prototype.sync_0=function(){var t,e=this.myChildProperty_0.get();if(e!==(null!=(t=this.myTargetMapper_0.get())?t.source:null))if(null!=e){var n=this.createMapper_11rb$(e);this.myTargetMapper_0.set_11rb$(n),this.myTargetProperty_0.set_11rb$(n.target),this.processMapper_obu244$(n)}else this.myTargetMapper_0.set_11rb$(null),this.myTargetProperty_0.set_11rb$(null)},Vt.$metadata$={kind:p,simpleName:"SingleChildRoleSynchronizer",interfaces:[rt]},Xt.$metadata$={kind:m,simpleName:"Companion",interfaces:[]};var Zt=null;function Jt(){return null===Zt&&new Xt,Zt}function Qt(){}function te(){he=this,this.EMPTY_0=new pe}function ee(t,e){this.closure$target=t,this.closure$source=e,qt.call(this)}function ne(t){this.closure$target=t}function ie(t,e){this.closure$source=t,this.closure$target=e,this.myOldValue_0=null,this.myRegistration_0=null}function re(t){this.closure$r=t}function oe(t){this.closure$disposable=t}function ae(t){this.closure$disposables=t}function se(t,e){this.closure$r=t,this.closure$src=e,qt.call(this)}function le(t){this.closure$r=t}function ue(t,e){this.closure$src=t,this.closure$h=e,qt.call(this)}function ce(t){this.closure$h=t}function pe(){}Wt.$metadata$={kind:A,simpleName:"Synchronizer",interfaces:[]},Qt.$metadata$={kind:A,simpleName:"SynchronizerContext",interfaces:[]},te.prototype.forSimpleRole_z48wgy$=function(t,e,n,i){return new Ht(t,e,n,i)},te.prototype.forObservableRole_abqnzq$=function(t,e,n,i,r){return new _e(t,e,n,i,r)},te.prototype.forObservableRole_umd8ru$=function(t,e,n,i){return this.forObservableRole_ndqwza$(t,e,n,i,null)},te.prototype.forObservableRole_ndqwza$=function(t,e,n,i,r){return new Bt(t,e,n,i,r)},te.prototype.forSingleRole_pri2ej$=function(t,e,n,i){return new Vt(t,e,n,i)},ne.prototype.onEvent_11rb$=function(t){this.closure$target.set_11rb$(t.newValue)},ne.$metadata$={kind:p,interfaces:[tt]},ee.prototype.doAttach_1rog5x$=function(t){return this.closure$target.set_11rb$(this.closure$source.get()),this.closure$source.addHandler_gxwwpc$(new ne(this.closure$target))},ee.$metadata$={kind:p,interfaces:[qt]},te.prototype.forPropsOneWay_2ov6i0$=function(t,e){return new ee(e,t)},ie.prototype.attach_1rog5x$=function(t){this.myOldValue_0=this.closure$source.get(),this.myRegistration_0=et.PropertyBinding.bindTwoWay_ejkotq$(this.closure$source,this.closure$target)},ie.prototype.detach=function(){var t;_(this.myRegistration_0).remove(),this.closure$target.set_11rb$(null==(t=this.myOldValue_0)||e.isType(t,K)?t:k())},ie.$metadata$={kind:p,interfaces:[Wt]},te.prototype.forPropsTwoWay_ejkotq$=function(t,e){return new ie(t,e)},re.prototype.attach_1rog5x$=function(t){},re.prototype.detach=function(){this.closure$r.remove()},re.$metadata$={kind:p,interfaces:[Wt]},te.prototype.forRegistration_3xv6fb$=function(t){return new re(t)},oe.prototype.attach_1rog5x$=function(t){},oe.prototype.detach=function(){this.closure$disposable.dispose()},oe.$metadata$={kind:p,interfaces:[Wt]},te.prototype.forDisposable_gg3y3y$=function(t){return new oe(t)},ae.prototype.attach_1rog5x$=function(t){},ae.prototype.detach=function(){var t,e;for(t=this.closure$disposables,e=0;e!==t.length;++e)t[e].dispose()},ae.$metadata$={kind:p,interfaces:[Wt]},te.prototype.forDisposables_h9hjd7$=function(t){return new ae(t)},le.prototype.onEvent_11rb$=function(t){this.closure$r.run()},le.$metadata$={kind:p,interfaces:[tt]},se.prototype.doAttach_1rog5x$=function(t){return this.closure$r.run(),this.closure$src.addHandler_gxwwpc$(new le(this.closure$r))},se.$metadata$={kind:p,interfaces:[qt]},te.prototype.forEventSource_giy12r$=function(t,e){return new se(e,t)},ce.prototype.onEvent_11rb$=function(t){this.closure$h(t)},ce.$metadata$={kind:p,interfaces:[tt]},ue.prototype.doAttach_1rog5x$=function(t){return this.closure$src.addHandler_gxwwpc$(new ce(this.closure$h))},ue.$metadata$={kind:p,interfaces:[qt]},te.prototype.forEventSource_k8sbiu$=function(t,e){return new ue(t,e)},te.prototype.empty=function(){return this.EMPTY_0},pe.prototype.attach_1rog5x$=function(t){},pe.prototype.detach=function(){},pe.$metadata$={kind:p,interfaces:[Wt]},te.$metadata$={kind:m,simpleName:"Synchronizers",interfaces:[]};var he=null;function _e(t,e,n,i,r){nt.call(this,t),this.mySource_0=e,this.mySourceTransformer_0=n,this.myTarget_0=i,this.myCollectionRegistration_0=null,this.mySourceTransformation_0=null,this.addMapperFactory_7h0hpi$(r)}function fe(t){this.this$TransformingObservableCollectionRoleSynchronizer=t,Q.call(this)}fe.prototype.onItemAdded_u8tacu$=function(t){var e=this.this$TransformingObservableCollectionRoleSynchronizer.createMapper_11rb$(_(t.newItem));this.this$TransformingObservableCollectionRoleSynchronizer.modifiableMappers.add_wxm5ur$(t.index,e),this.this$TransformingObservableCollectionRoleSynchronizer.myTarget_0.add_wxm5ur$(t.index,e.target),this.this$TransformingObservableCollectionRoleSynchronizer.processMapper_obu244$(e)},fe.prototype.onItemRemoved_u8tacu$=function(t){this.this$TransformingObservableCollectionRoleSynchronizer.modifiableMappers.removeAt_za3lpa$(t.index),this.this$TransformingObservableCollectionRoleSynchronizer.myTarget_0.removeAt_za3lpa$(t.index)},fe.$metadata$={kind:p,interfaces:[Q]},_e.prototype.onAttach=function(){var t;nt.prototype.onAttach.call(this);var e=new N;for(this.mySourceTransformation_0=this.mySourceTransformer_0.transform_xwzc9p$(this.mySource_0,e),new it(this).update_4f0l55$(e),t=this.modifiableMappers.iterator();t.hasNext();){var n=t.next();this.myTarget_0.add_11rb$(n.target)}this.myCollectionRegistration_0=e.addListener_n5no9j$(new fe(this))},_e.prototype.onDetach=function(){nt.prototype.onDetach.call(this),_(this.myCollectionRegistration_0).remove(),_(this.mySourceTransformation_0).dispose(),this.myTarget_0.clear()},_e.$metadata$={kind:p,simpleName:"TransformingObservableCollectionRoleSynchronizer",interfaces:[nt]},nt.MapperUpdater=it;var de=t.jetbrains||(t.jetbrains={}),me=de.datalore||(de.datalore={}),ye=me.mapper||(me.mapper={}),$e=ye.core||(ye.core={});return $e.BaseCollectionRoleSynchronizer=nt,$e.BaseRoleSynchronizer=rt,ot.DifferenceItem=at,$e.DifferenceBuilder=ot,st.SynchronizersConfiguration=$t,Object.defineProperty(st,"Companion",{get:Ot}),$e.Mapper=st,$e.MapperFactory=Nt,Object.defineProperty($e,"Mappers",{get:It}),$e.MappingContext=zt,$e.ObservableCollectionRoleSynchronizer=Bt,$e.RefreshableSynchronizer=Ft,$e.RegistrationSynchronizer=qt,$e.RoleSynchronizer=Gt,$e.SimpleRoleSynchronizer=Ht,$e.SingleChildRoleSynchronizer=Vt,Object.defineProperty(Wt,"Companion",{get:Jt}),$e.Synchronizer=Wt,$e.SynchronizerContext=Qt,Object.defineProperty($e,"Synchronizers",{get:function(){return null===he&&new te,he}}),$e.TransformingObservableCollectionRoleSynchronizer=_e,t})?i.apply(e,r):i)||(t.exports=o)},836:function(t,e,n){var i,r,o;r=[e,n(421),n(767),n(958),n(331)],void 0===(o="function"==typeof(i=function(t,e,n,i,r){"use strict";var o=n.jetbrains.datalore.base.gcommon.collect,a=e.kotlin.collections.Iterable,s=e.throwCCE,l=e.equals,u=e.kotlin.collections.List,c=e.kotlin.collections.ArrayList_init_287e2$,p=e.Kind.OBJECT,h=e.Kind.CLASS,_=n.jetbrains.datalore.base.typedKey.TypedKey,f=e.Kind.INTERFACE,d=e.kotlin.IllegalArgumentException_init_pdl1vj$,m=e.kotlin.text.StringBuilder_init,y=e.ensureNotNull,$=e.kotlin.collections.emptyList_287e2$,v=e.kotlin.collections.LinkedHashSet_init_mqih57$,g=e.kotlin.collections.Collection,b=i.jetbrains.datalore.plot.common.data,w=e.kotlin.Enum,x=e.throwISE,k=e.kotlin.isFinite_yrwdxr$,E=e.kotlin.collections.zip_45mdf7$,C=e.getCallableRef,S=e.kotlin.collections.toList_abgq59$,T=e.kotlin.comparisons.compareBy_bvgy4j$,O=e.kotlin.collections.sortedWith_eknfly$,N=e.kotlin.collections.reversed_7wnvza$,P=e.kotlin.collections.plus_mydzjv$,A=e.kotlin.collections.toSet_7wnvza$,j=n.jetbrains.datalore.base.logging,L=e.getKClass,R=e.kotlin.collections.ArrayList_init_mqih57$,I=e.kotlin.collections.HashMap_init_q3lmfv$,z=e.kotlin.collections.HashMap_init_73mtqc$,D=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,M=e.kotlin.collections.mapCapacity_za3lpa$,B=e.kotlin.collections.LinkedHashMap_init_bwtc7$,U=e.kotlin.collections.MutableCollection,F=e.toString,q=e.kotlin.IllegalStateException_init_pdl1vj$,G=n.jetbrains.datalore.base.gcommon.collect.TreeMap,H=e.kotlin.collections.intersect_q4559j$,Y=e.kotlin.collections.Map,V=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,K=e.kotlin.collections.ArrayList_init_ww73n8$,W=Math,X=e.kotlin.collections.listOf_i5x0yv$,Z=e.kotlin.Unit,J=n.jetbrains.datalore.base.typedKey.TypedKeyHashMap,Q=e.kotlin.js.internal.DoubleCompanionObject,tt=n.jetbrains.datalore.base.values.Color,et=n.jetbrains.datalore.base.gcommon.collect.ClosedRange,nt=e.kotlin.collections.HashSet_init_mqih57$,it=e.kotlin.NoSuchElementException,rt=e.kotlin.collections.Iterator,ot=n.jetbrains.datalore.base.function.Function,at=n.jetbrains.datalore.base.values,st=r.jetbrains.datalore.vis.svg,lt=n.jetbrains.datalore.base.geometry.DoubleVector,ut=n.jetbrains.datalore.base.geometry,ct=n.jetbrains.datalore.base.gcommon.collect.Ordering,pt=e.kotlin.Comparator,ht=e.getPropertyCallableRef,_t=e.kotlin.ranges.coerceAtLeast_dqglrj$,ft=n.jetbrains.datalore.base.gcommon.base,dt=e.kotlin.text.startsWith_7epoxm$,mt=e.kotlin.text.Regex_init_61zpoe$,yt=n.jetbrains.datalore.base.geometry.DoubleSegment,$t=e.kotlin.collections.HashSet_init_ww73n8$,vt=e.kotlin.collections.reverse_vvxzk3$,gt=Object,bt=n.jetbrains.datalore.base.geometry.DoubleRectangle,wt=n.jetbrains.datalore.base.geometry.DoubleRectangle_init_6y0v78$,xt=r.jetbrains.datalore.vis.svg.SvgLineElement_init_6y0v78$,kt=r.jetbrains.datalore.vis.svg.SvgGElement,Et=r.jetbrains.datalore.vis.svg.slim,Ct=r.jetbrains.datalore.vis.svg.SvgRectElement_init_6y0v78$,St=r.jetbrains.datalore.vis.svg.SvgImageElement_init_6y0v78$,Tt=e.throwUPAE,Ot=e.kotlin.isNaN_yrwdxr$,Nt=r.jetbrains.datalore.vis.svg.SvgPathDataBuilder,Pt=e.kotlin.math,At=e.kotlin.math.round_14dthe$,jt=e.numberToInt,Lt=r.jetbrains.datalore.vis.svg.SvgImageElementEx.Bitmap,Rt=r.jetbrains.datalore.vis.svg.SvgImageElementEx,It=r.jetbrains.datalore.vis.svg.SvgPathElement_init_7jrsat$,zt=r.jetbrains.datalore.vis.svg.SvgShape,Dt=r.jetbrains.datalore.vis.svg.SvgElement,Mt=e.kotlin.to_ujzrz7$,Bt=e.kotlin.collections.mapOf_qfcya0$,Ut=e.kotlin.collections.setOf_i5x0yv$,Ft=e.kotlin.collections.take_ba2ldo$,qt=e.kotlin.collections.copyToArray,Gt=n.jetbrains.datalore.base.algorithms.splitRings_bemo1h$,Ht=n.jetbrains.datalore.base.values.Pair,Yt=r.jetbrains.datalore.vis.svg.SvgRectElement_init_wthzt5$,Vt=e.kotlin.collections.emptyMap_q3lmfv$,Kt=e.kotlin.random.Random,Wt=e.kotlin.collections.asList_us0mfu$,Xt=r.jetbrains.datalore.vis.svg.slim.SvgSlimObject,Zt=r.jetbrains.datalore.vis.svg.SvgPathData,Jt=r.jetbrains.datalore.vis.svg.SvgPathDataBuilder.Interpolation,Qt=n.jetbrains.datalore.base.observable.property.WritableProperty,te=r.jetbrains.datalore.vis.svg.SvgColors,ee=n.jetbrains.datalore.base.observable.event.EventHandler,ne=n.jetbrains.datalore.base.registration.CompositeRegistration,ie=r.jetbrains.datalore.vis.svg.SvgClipPathElement,re=r.jetbrains.datalore.vis.svg.SvgRectElement,oe=r.jetbrains.datalore.vis.svg.SvgDefsElement,ae=r.jetbrains.datalore.vis.svg.SvgIRI,se=r.jetbrains.datalore.vis.svg.SvgGraphicsElement,le=r.jetbrains.datalore.vis.svg.SvgTransformBuilder,ue=n.jetbrains.datalore.base.random,ce=r.jetbrains.datalore.vis.svg.SvgTextElement_init_61zpoe$,pe=e.kotlin.text.isBlank_gw00vp$,he=e.kotlin.collections.filterNotNull_m3lr2h$,_e=e.kotlin.collections.checkIndexOverflow_za3lpa$,fe=e.numberToDouble,de=e.kotlin.Pair,me=e.kotlin.collections.toMap_6hr0sd$,ye=e.kotlin.collections.getValue_t9ocha$,$e=e.kotlin.collections.toList_7wnvza$,ve=e.kotlin.isInfinite_yrwdxr$,ge=e.kotlin.collections.toMutableList_4c7yge$,be=i.jetbrains.datalore.plot.common.time.interval.YearInterval,we=i.jetbrains.datalore.plot.common.time,xe=i.jetbrains.datalore.plot.common.time.interval,ke=e.kotlin.ranges.until_dqglrj$,Ee=e.kotlin.collections.listOf_mh5how$,Ce=e.kotlin.collections.asReversed_2p1efm$,Se=n.jetbrains.datalore.base.numberFormat.NumberFormat_init_61zpoe$,Te=i.jetbrains.datalore.plot.common.text,Oe=i.jetbrains.datalore.plot.common.time.interval.TimeInterval,Ne=e.kotlin.collections.first_2p1efm$,Pe=e.kotlin.collections.last_2p1efm$,Ae=e.kotlin.collections.binarySearch_jhx6be$,je=e.kotlin.math.abs_za3lpa$,Le=e.kotlin.collections.maxOrNull_l63kqw$,Re=e.kotlin.collections.mutableMapOf_qfcya0$,Ie=e.kotlin.collections.HashSet_init_287e2$,ze=e.kotlin.collections.sortWith_nqfjgj$,De=e.hashCode,Me=e.kotlin.ranges.rangeTo_38ydlf$,Be=e.kotlin.collections.withIndex_7wnvza$,Ue=e.kotlin.collections.LinkedHashSet_init_287e2$,Fe=e.kotlin.RuntimeException_init_pdl1vj$,qe=e.kotlin.collections.unzip_6hr0sd$,Ge=e.kotlin.collections.sorted_exjks8$,He=e.kotlin.collections.sum_l63kqw$,Ye=e.wrapFunction,Ve=Array,Ke=e.Long.fromInt(37),We=e.kotlin.random.Random_s8cxhz$,Xe=e.kotlin.ranges.coerceIn_nig4hr$,Ze=new e.Long(456400702,-8856424),Je=e.kotlin.collections.arrayCopy,Qe=e.kotlin.collections.average_bvy38s$,tn=e.kotlin.collections.arrayListOf_i5x0yv$,en=e.kotlin.collections.fill_x4f2cq$,nn=e.primitiveArraySort,rn=e.kotlin.collections.get_lastIndex_bvy38s$,on=e.kotlin.collections.get_indices_bvy38s$,an=e.kotlin.ranges.reversed_zf1xzc$,sn=e.kotlin.collections.toMutableList_bvy38s$,ln=e.kotlin.isNaN_81szk$,un=e.floatToBits,cn=e.doubleToBits,pn=e.kotlin.math.abs_s8cxhz$,hn=e.Long.fromInt(-2147483648),_n=new e.Long(1994767346,-1362668208),fn=e.kotlin.collections.zip_pmvpm9$,dn=e.kotlin.collections.toDoubleArray_tcduak$,mn=e.kotlin.collections.asSequence_7wnvza$,yn=e.kotlin.sequences.zip_r7q3s9$,$n=e.kotlin.sequences.drop_wuwhe2$;function vn(t,e){Cn(),void 0===e&&(e=!0),this.name=t,this.isNumeric=e,Cn().values_0.add_11rb$(this)}function gn(){En=this,this.values_0=c(),this.X=new vn("x"),this.Y=new vn("y"),this.Z=new vn("z"),this.COLOR=new vn("color",!1),this.FILL=new vn("fill",!1),this.ALPHA=new vn("alpha"),this.SHAPE=new vn("shape",!1),this.LINETYPE=new vn("linetype",!1),this.SIZE=new vn("size"),this.WIDTH=new vn("width"),this.HEIGHT=new vn("height"),this.WEIGHT=new vn("weight"),this.INTERCEPT=new vn("intercept"),this.SLOPE=new vn("slope"),this.XINTERCEPT=new vn("xintercept"),this.YINTERCEPT=new vn("yintercept"),this.LOWER=new vn("lower"),this.MIDDLE=new vn("middle"),this.UPPER=new vn("upper"),this.XMIN=new vn("xmin"),this.XMAX=new vn("xmax"),this.YMIN=new vn("ymin"),this.YMAX=new vn("ymax"),this.XEND=new vn("xend"),this.YEND=new vn("yend"),this.FRAME=new vn("frame",!1),this.SPEED=new vn("speed"),this.FLOW=new vn("flow"),this.LABEL=new vn("label",!1),this.FAMILY=new vn("family",!1),this.FONTFACE=new vn("fontface",!1),this.HJUST=new vn("hjust",!1),this.VJUST=new vn("vjust",!1),this.ANGLE=new vn("angle"),this.SYM_X=new vn("sym_x"),this.SYM_Y=new vn("sym_y")}function bn(t){return t.isNumeric}jn.prototype=Object.create(w.prototype),jn.prototype.constructor=jn,zi.prototype=Object.create(w.prototype),zi.prototype.constructor=zi,Kr.prototype=Object.create(Yr.prototype),Kr.prototype.constructor=Kr,Wr.prototype=Object.create(Yr.prototype),Wr.prototype.constructor=Wr,Xr.prototype=Object.create(Yr.prototype),Xr.prototype.constructor=Xr,mo.prototype=Object.create(Lr.prototype),mo.prototype.constructor=mo,vo.prototype=Object.create(Sa.prototype),vo.prototype.constructor=vo,xo.prototype=Object.create(Sa.prototype),xo.prototype.constructor=xo,So.prototype=Object.create(Sa.prototype),So.prototype.constructor=So,$l.prototype=Object.create(Sa.prototype),$l.prototype.constructor=$l,Ao.prototype=Object.create($l.prototype),Ao.prototype.constructor=Ao,Do.prototype=Object.create(tu.prototype),Do.prototype.constructor=Do,Io.prototype=Object.create(Sa.prototype),Io.prototype.constructor=Io,_s.prototype=Object.create(Sa.prototype),_s.prototype.constructor=_s,Fo.prototype=Object.create(_s.prototype),Fo.prototype.constructor=Fo,Ss.prototype=Object.create(Sa.prototype),Ss.prototype.constructor=Ss,Yo.prototype=Object.create(Ss.prototype),Yo.prototype.constructor=Yo,Xo.prototype=Object.create(Sa.prototype),Xo.prototype.constructor=Xo,ea.prototype=Object.create(Fo.prototype),ea.prototype.constructor=ea,oa.prototype=Object.create(Yo.prototype),oa.prototype.constructor=oa,ua.prototype=Object.create(xo.prototype),ua.prototype.constructor=ua,_a.prototype=Object.create(Sa.prototype),_a.prototype.constructor=_a,Va.prototype=Object.create(_s.prototype),Va.prototype.constructor=Va,xa.prototype=Object.create(Va.prototype),xa.prototype.constructor=xa,Pa.prototype=Object.create(Sa.prototype),Pa.prototype.constructor=Pa,Ra.prototype=Object.create(So.prototype),Ra.prototype.constructor=Ra,Ma.prototype=Object.create(Sa.prototype),Ma.prototype.constructor=Ma,ys.prototype=Object.create(Sa.prototype),ys.prototype.constructor=ys,qa.prototype=Object.create(ys.prototype),qa.prototype.constructor=qa,Za.prototype=Object.create(Sa.prototype),Za.prototype.constructor=Za,us.prototype=Object.create(Ss.prototype),us.prototype.constructor=us,Eu.prototype=Object.create(nu.prototype),Eu.prototype.constructor=Eu,ws.prototype=Object.create(Sa.prototype),ws.prototype.constructor=ws,Ps.prototype=Object.create(Sa.prototype),Ps.prototype.constructor=Ps,Rs.prototype=Object.create(Sa.prototype),Rs.prototype.constructor=Rs,Ms.prototype=Object.create(Sa.prototype),Ms.prototype.constructor=Ms,qs.prototype=Object.create(Sa.prototype),qs.prototype.constructor=qs,Ks.prototype=Object.create(Sa.prototype),Ks.prototype.constructor=Ks,il.prototype=Object.create(w.prototype),il.prototype.constructor=il,nl.prototype=Object.create(Va.prototype),nl.prototype.constructor=nl,_l.prototype=Object.create(Sa.prototype),_l.prototype.constructor=_l,xl.prototype=Object.create(Sa.prototype),xl.prototype.constructor=xl,zl.prototype=Object.create(tu.prototype),zl.prototype.constructor=zl,Dl.prototype=Object.create(w.prototype),Dl.prototype.constructor=Dl,ql.prototype=Object.create(w.prototype),ql.prototype.constructor=ql,Fu.prototype=Object.create(nu.prototype),Fu.prototype.constructor=Fu,rc.prototype=Object.create(w.prototype),rc.prototype.constructor=rc,uc.prototype=Object.create(w.prototype),uc.prototype.constructor=uc,kc.prototype=Object.create(w.prototype),kc.prototype.constructor=kc,Ac.prototype=Object.create(xc.prototype),Ac.prototype.constructor=Ac,Vc.prototype=Object.create(w.prototype),Vc.prototype.constructor=Vc,Jc.prototype=Object.create(w.prototype),Jc.prototype.constructor=Jc,wp.prototype=Object.create(w.prototype),wp.prototype.constructor=wp,Sp.prototype=Object.create(w.prototype),Sp.prototype.constructor=Sp,Rp.prototype=Object.create(w.prototype),Rp.prototype.constructor=Rp,Bp.prototype=Object.create(w.prototype),Bp.prototype.constructor=Bp,dh.prototype=Object.create(w.prototype),dh.prototype.constructor=dh,kh.prototype=Object.create(w.prototype),kh.prototype.constructor=kh,Nh.prototype=Object.create(Oh.prototype),Nh.prototype.constructor=Nh,Ph.prototype=Object.create(Oh.prototype),Ph.prototype.constructor=Ph,Dh.prototype=Object.create(w.prototype),Dh.prototype.constructor=Dh,Bh.prototype=Object.create(Dh.prototype),Bh.prototype.constructor=Bh,qh.prototype=Object.create(Dh.prototype),qh.prototype.constructor=qh,T_.prototype=Object.create(w.prototype),T_.prototype.constructor=T_,pf.prototype=Object.create(Sf.prototype),pf.prototype.constructor=pf,Rf.prototype=Object.create(Ef.prototype),Rf.prototype.constructor=Rf,hf.prototype=Object.create(Rf.prototype),hf.prototype.constructor=hf,mf.prototype=Object.create(Sf.prototype),mf.prototype.constructor=mf,Cf.prototype=Object.create(Rf.prototype),Cf.prototype.constructor=Cf,Nf.prototype=Object.create(Sf.prototype),Nf.prototype.constructor=Nf,Pf.prototype=Object.create(Sf.prototype),Pf.prototype.constructor=Pf,If.prototype=Object.create(Yf.prototype),If.prototype.constructor=If,zf.prototype=Object.create(Yf.prototype),zf.prototype.constructor=zf,cd.prototype=Object.create(w.prototype),cd.prototype.constructor=cd,dd.prototype=Object.create(w.prototype),dd.prototype.constructor=dd,ld.prototype=Object.create(Yf.prototype),ld.prototype.constructor=ld,Sd.prototype=Object.create(wd.prototype),Sd.prototype.constructor=Sd,Cd.prototype=Object.create(gd.prototype),Cd.prototype.constructor=Cd,Nd.prototype=Object.create(wd.prototype),Nd.prototype.constructor=Nd,Od.prototype=Object.create(gd.prototype),Od.prototype.constructor=Od,Zd.prototype=Object.create(Xd.prototype),Zd.prototype.constructor=Zd,Jd.prototype=Object.create(Xd.prototype),Jd.prototype.constructor=Jd,cm.prototype=Object.create(um.prototype),cm.prototype.constructor=cm,ym.prototype=Object.create(um.prototype),ym.prototype.constructor=ym,Tm.prototype=Object.create(um.prototype),Tm.prototype.constructor=Tm,Pm.prototype=Object.create(um.prototype),Pm.prototype.constructor=Pm,Dm.prototype=Object.create(Fm.prototype),Dm.prototype.constructor=Dm,qm.prototype=Object.create(Fm.prototype),qm.prototype.constructor=qm,Qm.prototype=Object.create(w.prototype),Qm.prototype.constructor=Qm,Jm.prototype=Object.create(Fm.prototype),Jm.prototype.constructor=Jm,dy.prototype=Object.create(Fm.prototype),dy.prototype.constructor=dy,Ay.prototype=Object.create(w.prototype),Ay.prototype.constructor=Ay,Uy.prototype=Object.create(Fm.prototype),Uy.prototype.constructor=Uy,Xy.prototype=Object.create(Fm.prototype),Xy.prototype.constructor=Xy,s$.prototype=Object.create(w.prototype),s$.prototype.constructor=s$,h$.prototype=Object.create(w.prototype),h$.prototype.constructor=h$,a$.prototype=Object.create(Fm.prototype),a$.prototype.constructor=a$,x$.prototype=Object.create(Fm.prototype),x$.prototype.constructor=x$,S$.prototype=Object.create(Dm.prototype),S$.prototype.constructor=S$,T$.prototype=Object.create(Dm.prototype),T$.prototype.constructor=T$,U$.prototype=Object.create(w.prototype),U$.prototype.constructor=U$,X$.prototype=Object.create(w.prototype),X$.prototype.constructor=X$,M$.prototype=Object.create(Fm.prototype),M$.prototype.constructor=M$,wv.prototype=Object.create(w.prototype),wv.prototype.constructor=wv,bv.prototype=Object.create(Fm.prototype),bv.prototype.constructor=bv,jv.prototype=Object.create(Fm.prototype),jv.prototype.constructor=jv,Yv.prototype=Object.create(eg.prototype),Yv.prototype.constructor=Yv,Kv.prototype=Object.create(w.prototype),Kv.prototype.constructor=Kv,lg.prototype=Object.create(vg.prototype),lg.prototype.constructor=lg,fg.prototype=Object.create(Yv.prototype),fg.prototype.constructor=fg,Ng.prototype=Object.create(vg.prototype),Ng.prototype.constructor=Ng,qg.prototype=Object.create(w.prototype),qg.prototype.constructor=qg,ob.prototype=Object.create(Iv.prototype),ob.prototype.constructor=ob,db.prototype=Object.create(bb.prototype),db.prototype.constructor=db,mb.prototype=Object.create(bb.prototype),mb.prototype.constructor=mb,yb.prototype=Object.create(bb.prototype),yb.prototype.constructor=yb,Object.defineProperty(vn.prototype,"isColor",{configurable:!0,get:function(){return Cn().isColor_896ixz$(this)}}),vn.prototype.toString=function(){return"aes '"+this.name+"'"},gn.prototype.numeric_shhb9a$=function(t){var n;return e.isType(n=o.Iterables.filter_fpit1u$(t,bn),a)?n:s()},gn.prototype.isPositional_896ixz$=function(t){return this.isPositionalXY_896ixz$(t)||l(t,this.SLOPE)},gn.prototype.isPositionalXY_896ixz$=function(t){return this.isPositionalX_896ixz$(t)||this.isPositionalY_896ixz$(t)},gn.prototype.isPositionalX_896ixz$=function(t){return l(t,this.X)||l(t,this.XINTERCEPT)||l(t,this.XMIN)||l(t,this.XMAX)||l(t,this.XEND)},gn.prototype.isPositionalY_896ixz$=function(t){return l(t,this.Y)||l(t,this.YMIN)||l(t,this.YMAX)||l(t,this.INTERCEPT)||l(t,this.YINTERCEPT)||l(t,this.LOWER)||l(t,this.MIDDLE)||l(t,this.UPPER)||l(t,this.YEND)},gn.prototype.isColor_896ixz$=function(t){return l(t,this.COLOR)||l(t,this.FILL)},gn.prototype.isAffectingScaleX_896ixz$=function(t){return this.isPositionalX_896ixz$(t)},gn.prototype.isAffectingScaleY_896ixz$=function(t){return this.isPositionalY_896ixz$(t)&&!l(t,this.INTERCEPT)},gn.prototype.affectingScaleX_shhb9a$=function(t){var e,n=this.numeric_shhb9a$(t);return o.Iterables.filter_fpit1u$(n,(e=this,function(t){return e.isAffectingScaleX_896ixz$(t)}))},gn.prototype.affectingScaleY_shhb9a$=function(t){var e,n=this.numeric_shhb9a$(t);return o.Iterables.filter_fpit1u$(n,(e=this,function(t){return e.isAffectingScaleY_896ixz$(t)}))},gn.prototype.noGuideNeeded_896ixz$=function(t){return l(t,this.FRAME)||l(t,this.SPEED)||l(t,this.FLOW)||l(t,this.LABEL)||l(t,this.SLOPE)||l(t,this.WIDTH)||l(t,this.HEIGHT)||l(t,this.HJUST)||l(t,this.VJUST)||l(t,this.ANGLE)||l(t,this.FAMILY)||l(t,this.FONTFACE)||l(t,this.SYM_X)||l(t,this.SYM_Y)||this.isPositional_896ixz$(t)},gn.prototype.values=function(){return this.values_0},gn.prototype.allPositional=function(){var t,n,i=this.values_0,r=c();for(n=i.iterator();n.hasNext();){var o=n.next();this.isPositional_896ixz$(o)&&r.add_11rb$(o)}return e.isType(t=r,u)?t:s()},gn.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var wn,xn,kn,En=null;function Cn(){return null===En&&new gn,En}function Sn(){}function Tn(){}function On(){}function Nn(t){var e;for(Yn(),this.myVectorByVar_0=null,this.myIsNumeric_0=null,this.myRanges_0=I(),this.myDistinctValues_0=I(),this.myOrderSpecs_0=null,this.assertAllSeriesAreSameSize_0(t.myVectorByVar_8be2vx$),this.myVectorByVar_0=z(t.myVectorByVar_8be2vx$),this.myIsNumeric_0=z(t.myIsNumeric_8be2vx$),this.myOrderSpecs_0=t.myOrderSpecs_8be2vx$,e=this.myOrderSpecs_0.iterator();e.hasNext();){var n=e.next(),i=this.myDistinctValues_0,r=n.variable,o=this.getOrderedDistinctValues_0(n);i.put_xwzc9p$(r,o)}}function Pn(t,e,n,i){void 0===i&&(i=null),this.variable=t,this.orderBy=e,this.direction=n,this.aggregateOperation=i}function An(t,e,n){Bn(),void 0===e&&(e=Rn()),void 0===n&&(n=t),this.name=t,this.source=e,this.label=n}function jn(t,e){w.call(this),this.name$=t,this.ordinal$=e}function Ln(){Ln=function(){},wn=new jn("ORIGIN",0),xn=new jn("TRANSFORM",1),kn=new jn("STAT",2)}function Rn(){return Ln(),wn}function In(){return Ln(),xn}function zn(){return Ln(),kn}function Dn(){Mn=this}vn.$metadata$={kind:h,simpleName:"Aes",interfaces:[_]},Sn.$metadata$={kind:f,simpleName:"Aesthetics",interfaces:[]},Tn.prototype.createApplicableDomain_yrwdxb$=function(t,e){return void 0===t&&(t=null),e?e(t):this.createApplicableDomain_yrwdxb$$default(t)},Tn.$metadata$={kind:f,simpleName:"ContinuousTransform",interfaces:[Sr]},On.prototype.isPointInLimits_k2qmv6$=function(t,e,n){return void 0===e&&(e=!0),n?n(t,e):this.isPointInLimits_k2qmv6$$default(t,e)},On.prototype.isRectInLimits_fd842m$=function(t,e,n){return void 0===e&&(e=!0),n?n(t,e):this.isRectInLimits_fd842m$$default(t,e)},On.prototype.isPathInLimits_f6t8kh$=function(t,e,n){return void 0===e&&(e=!0),n?n(t,e):this.isPathInLimits_f6t8kh$$default(t,e)},On.prototype.isPolygonInLimits_f6t8kh$=function(t,e,n){return void 0===e&&(e=!0),n?n(t,e):this.isPolygonInLimits_f6t8kh$$default(t,e)},On.$metadata$={kind:f,simpleName:"CoordinateSystem",interfaces:[]},Pn.$metadata$={kind:h,simpleName:"OrderSpec",interfaces:[]},Object.defineProperty(Nn.prototype,"isEmpty",{configurable:!0,get:function(){return this.myVectorByVar_0.isEmpty()}}),Nn.prototype.assertAllSeriesAreSameSize_0=function(t){if(t.size>1)for(var e=t.entries.iterator(),n=e.next().value.size;e.hasNext();)if(e.next().value.size!==n)throw d("All data series in data frame must have equal size\n"+this.dumpSizes_0(t))},Nn.prototype.dumpSizes_0=function(t){var e,n=m();for(e=t.entries.iterator();e.hasNext();){var i=e.next(),r=i.key,o=i.value;n.append_pdl1vj$(r.name).append_pdl1vj$(" : ").append_s8jyv4$(o.size).append_s8itvh$(10)}return n.toString()},Nn.prototype.rowCount=function(){return this.myVectorByVar_0.isEmpty()?0:this.myVectorByVar_0.entries.iterator().next().value.size},Nn.prototype.has_8xm3sj$=function(t){return this.myVectorByVar_0.containsKey_11rb$(t)},Nn.prototype.isEmpty_8xm3sj$=function(t){return this.get_8xm3sj$(t).isEmpty()},Nn.prototype.hasNoOrEmpty_8xm3sj$=function(t){return!this.has_8xm3sj$(t)||this.isEmpty_8xm3sj$(t)},Nn.prototype.get_8xm3sj$=function(t){return this.assertDefined_0(t),y(this.myVectorByVar_0.get_11rb$(t))},Nn.prototype.getNumeric_8xm3sj$=function(t){var n;this.assertDefined_0(t);var i=this.myVectorByVar_0.get_11rb$(t);return y(i).isEmpty()?$():(this.assertNumeric_0(t),e.isType(n=i,u)?n:s())},Nn.prototype.distinctValues_8xm3sj$=function(t){this.assertDefined_0(t);var n=this.myDistinctValues_0.get_11rb$(t);if(null==n){var i,r=v(this.get_8xm3sj$(t));r.remove_11rb$(null);var o=r;return e.isType(i=o,g)?i:s()}return n},Nn.prototype.variables=function(){return this.myVectorByVar_0.keys},Nn.prototype.isNumeric_8xm3sj$=function(t){if(this.assertDefined_0(t),!this.myIsNumeric_0.containsKey_11rb$(t)){var e=b.SeriesUtil.checkedDoubles_9ma18$(this.get_8xm3sj$(t)),n=this.myIsNumeric_0,i=e.notEmptyAndCanBeCast();n.put_xwzc9p$(t,i)}return y(this.myIsNumeric_0.get_11rb$(t))},Nn.prototype.range_8xm3sj$=function(t){if(!this.myRanges_0.containsKey_11rb$(t)){var e=this.getNumeric_8xm3sj$(t),n=b.SeriesUtil.range_l63ks6$(e);this.myRanges_0.put_xwzc9p$(t,n)}return this.myRanges_0.get_11rb$(t)},Nn.prototype.builder=function(){return Ai(this)},Nn.prototype.assertDefined_0=function(t){if(!this.has_8xm3sj$(t)){var e=d("Undefined variable: '"+t+"'");throw Yn().LOG_0.error_l35kib$(e,(n=e,function(){return y(n.message)})),e}var n},Nn.prototype.assertNumeric_0=function(t){if(!this.isNumeric_8xm3sj$(t)){var e=d("Not a numeric variable: '"+t+"'");throw Yn().LOG_0.error_l35kib$(e,(n=e,function(){return y(n.message)})),e}var n},Nn.prototype.selectIndices_pqoyrt$=function(t){return this.buildModified_0((e=t,function(t){return b.SeriesUtil.pickAtIndices_ge51dg$(t,e)}));var e},Nn.prototype.selectIndices_p1n9e9$=function(t){return this.buildModified_0((e=t,function(t){return b.SeriesUtil.pickAtIndices_jlfzfq$(t,e)}));var e},Nn.prototype.dropIndices_p1n9e9$=function(t){return t.isEmpty()?this:this.buildModified_0((e=t,function(t){return b.SeriesUtil.skipAtIndices_jlfzfq$(t,e)}));var e},Nn.prototype.buildModified_0=function(t){var e,n=this.builder();for(e=this.myVectorByVar_0.keys.iterator();e.hasNext();){var i=e.next(),r=this.myVectorByVar_0.get_11rb$(i),o=t(y(r));n.putIntern_bxyhp4$(i,o)}return n.build()},Object.defineProperty(An.prototype,"isOrigin",{configurable:!0,get:function(){return this.source===Rn()}}),Object.defineProperty(An.prototype,"isStat",{configurable:!0,get:function(){return this.source===zn()}}),Object.defineProperty(An.prototype,"isTransform",{configurable:!0,get:function(){return this.source===In()}}),An.prototype.toString=function(){return this.name},An.prototype.toSummaryString=function(){return this.name+", '"+this.label+"' ["+this.source+"]"},jn.$metadata$={kind:h,simpleName:"Source",interfaces:[w]},jn.values=function(){return[Rn(),In(),zn()]},jn.valueOf_61zpoe$=function(t){switch(t){case"ORIGIN":return Rn();case"TRANSFORM":return In();case"STAT":return zn();default:x("No enum constant jetbrains.datalore.plot.base.DataFrame.Variable.Source."+t)}},Dn.prototype.createOriginal_puj7f4$=function(t,e){return void 0===e&&(e=t),new An(t,Rn(),e)},Dn.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var Mn=null;function Bn(){return null===Mn&&new Dn,Mn}function Un(t){return null!=t&&(!("number"==typeof t)||k(t))}function Fn(t){var n;return e.isComparable(n=t.second)?n:s()}function qn(t){var n;return e.isComparable(n=t.first)?n:s()}function Gn(){Hn=this,this.LOG_0=j.PortableLogging.logger_xo1ogr$(L(Nn))}An.$metadata$={kind:h,simpleName:"Variable",interfaces:[]},Nn.prototype.getOrderedDistinctValues_0=function(t){var e,n,i=Un;if(null!=t.aggregateOperation){if(!this.isNumeric_8xm3sj$(t.orderBy))throw d("Can't apply aggregate operation to non-numeric values".toString());var r,o=E(this.get_8xm3sj$(t.variable),this.getNumeric_8xm3sj$(t.orderBy)),a=D();for(r=o.iterator();r.hasNext();){var s,l=r.next(),u=l.component1(),p=a.get_11rb$(u);if(null==p){var h=c();a.put_xwzc9p$(u,h),s=h}else s=p;var _=s,f=_.add_11rb$,m=l.component2();f.call(_,m)}var y,$=B(M(a.size));for(y=a.entries.iterator();y.hasNext();){var v,g=y.next(),b=$.put_xwzc9p$,w=g.key,x=g.value,k=t.aggregateOperation,C=c();for(v=x.iterator();v.hasNext();){var j=v.next();i(j)&&C.add_11rb$(j)}b.call($,w,k.call(t,C))}e=S($)}else e=E(this.get_8xm3sj$(t.variable),this.get_8xm3sj$(t.orderBy));var L,R=e,I=c();for(L=R.iterator();L.hasNext();){var z=L.next();i(z.second)&&i(z.first)&&I.add_11rb$(z)}var U,F=O(I,T([Fn,qn])),q=c();for(U=F.iterator();U.hasNext();){var G;null!=(G=U.next().first)&&q.add_11rb$(G)}var H,Y=q,V=E(this.get_8xm3sj$(t.variable),this.get_8xm3sj$(t.orderBy)),K=c();for(H=V.iterator();H.hasNext();){var W=H.next();i(W.second)||K.add_11rb$(W)}var X,Z=c();for(X=K.iterator();X.hasNext();){var J;null!=(J=X.next().first)&&Z.add_11rb$(J)}var Q=Z;return n=t.direction<0?N(Y):Y,A(P(n,Q))},Gn.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var Hn=null;function Yn(){return null===Hn&&new Gn,Hn}function Vn(){Ni(),this.myVectorByVar_8be2vx$=I(),this.myIsNumeric_8be2vx$=I(),this.myOrderSpecs_8be2vx$=c()}function Kn(){Oi=this}Vn.prototype.put_2l962d$=function(t,e){return this.putIntern_bxyhp4$(t,e),this.myIsNumeric_8be2vx$.remove_11rb$(t),this},Vn.prototype.putNumeric_s1rqo9$=function(t,e){return this.putIntern_bxyhp4$(t,e),this.myIsNumeric_8be2vx$.put_xwzc9p$(t,!0),this},Vn.prototype.putDiscrete_2l962d$=function(t,e){return this.putIntern_bxyhp4$(t,e),this.myIsNumeric_8be2vx$.put_xwzc9p$(t,!1),this},Vn.prototype.putIntern_bxyhp4$=function(t,e){var n=this.myVectorByVar_8be2vx$,i=R(e);n.put_xwzc9p$(t,i)},Vn.prototype.remove_8xm3sj$=function(t){return this.myVectorByVar_8be2vx$.remove_11rb$(t),this.myIsNumeric_8be2vx$.remove_11rb$(t),this},Vn.prototype.addOrderSpecs_l2t0xf$=function(t){var e,n=C("addOrderSpec",function(t,e){return t.addOrderSpec_22dbp4$(e)}.bind(null,this));for(e=t.iterator();e.hasNext();)n(e.next());return this},Vn.prototype.addOrderSpec_22dbp4$=function(t){var n,i=this.myOrderSpecs_8be2vx$;t:do{var r;for(r=i.iterator();r.hasNext();){var o=r.next();if(l(o.variable,t.variable)){n=o;break t}}n=null}while(0);var a=n;if(null==(null!=a?a.aggregateOperation:null)){var u,c=this.myOrderSpecs_8be2vx$;(e.isType(u=c,U)?u:s()).remove_11rb$(a),this.myOrderSpecs_8be2vx$.add_11rb$(t)}return this},Vn.prototype.build=function(){return new Nn(this)},Kn.prototype.emptyFrame=function(){return Pi().build()},Kn.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var Wn,Xn,Zn,Jn,Qn,ti,ei,ni,ii,ri,oi,ai,si,li,ui,ci,pi,hi,_i,fi,di,mi,yi,$i,vi,gi,bi,wi,xi,ki,Ei,Ci,Si,Ti,Oi=null;function Ni(){return null===Oi&&new Kn,Oi}function Pi(t){return t=t||Object.create(Vn.prototype),Vn.call(t),t}function Ai(t,e){return e=e||Object.create(Vn.prototype),Vn.call(e),e.myVectorByVar_8be2vx$.putAll_a2k3zr$(t.myVectorByVar_0),e.myIsNumeric_8be2vx$.putAll_a2k3zr$(t.myIsNumeric_0),e.myOrderSpecs_8be2vx$.addAll_brywnq$(t.myOrderSpecs_0),e}function ji(){}function Li(t,e){var n;this.domainValues=t,this.domainLimits=e,this.numberByDomainValue_0=D(),this.domainValueByNumber_0=new G;var i=this.domainLimits.isEmpty()?this.domainValues:H(this.domainLimits,this.domainValues);for(this.numberByDomainValue_0.putAll_a2k3zr$(Ld().mapDiscreteDomainValuesToNumbers_7f6uoc$(i)),n=this.numberByDomainValue_0.entries.iterator();n.hasNext();){var r=n.next(),o=r.key,a=r.value;this.domainValueByNumber_0.put_ncwa5f$(a,o)}}function Ri(){}function Ii(){}function zi(t,e){w.call(this),this.name$=t,this.ordinal$=e}function Di(){Di=function(){},Wn=new zi("PATH",0),Xn=new zi("LINE",1),Zn=new zi("SMOOTH",2),Jn=new zi("BAR",3),Qn=new zi("HISTOGRAM",4),ti=new zi("TILE",5),ei=new zi("BIN_2D",6),ni=new zi("MAP",7),ii=new zi("ERROR_BAR",8),ri=new zi("CROSS_BAR",9),oi=new zi("LINE_RANGE",10),ai=new zi("POINT_RANGE",11),si=new zi("POLYGON",12),li=new zi("AB_LINE",13),ui=new zi("H_LINE",14),ci=new zi("V_LINE",15),pi=new zi("BOX_PLOT",16),hi=new zi("LIVE_MAP",17),_i=new zi("POINT",18),fi=new zi("RIBBON",19),di=new zi("AREA",20),mi=new zi("DENSITY",21),yi=new zi("CONTOUR",22),$i=new zi("CONTOURF",23),vi=new zi("DENSITY2D",24),gi=new zi("DENSITY2DF",25),bi=new zi("JITTER",26),wi=new zi("FREQPOLY",27),xi=new zi("STEP",28),ki=new zi("RECT",29),Ei=new zi("SEGMENT",30),Ci=new zi("TEXT",31),Si=new zi("RASTER",32),Ti=new zi("IMAGE",33)}function Mi(){return Di(),Wn}function Bi(){return Di(),Xn}function Ui(){return Di(),Zn}function Fi(){return Di(),Jn}function qi(){return Di(),Qn}function Gi(){return Di(),ti}function Hi(){return Di(),ei}function Yi(){return Di(),ni}function Vi(){return Di(),ii}function Ki(){return Di(),ri}function Wi(){return Di(),oi}function Xi(){return Di(),ai}function Zi(){return Di(),si}function Ji(){return Di(),li}function Qi(){return Di(),ui}function tr(){return Di(),ci}function er(){return Di(),pi}function nr(){return Di(),hi}function ir(){return Di(),_i}function rr(){return Di(),fi}function or(){return Di(),di}function ar(){return Di(),mi}function sr(){return Di(),yi}function lr(){return Di(),$i}function ur(){return Di(),vi}function cr(){return Di(),gi}function pr(){return Di(),bi}function hr(){return Di(),wi}function _r(){return Di(),xi}function fr(){return Di(),ki}function dr(){return Di(),Ei}function mr(){return Di(),Ci}function yr(){return Di(),Si}function $r(){return Di(),Ti}function vr(){gr=this,this.renderedAesByGeom_0=I(),this.POINT_0=X([Cn().X,Cn().Y,Cn().SIZE,Cn().COLOR,Cn().FILL,Cn().ALPHA,Cn().SHAPE]),this.PATH_0=X([Cn().X,Cn().Y,Cn().SIZE,Cn().LINETYPE,Cn().COLOR,Cn().ALPHA,Cn().SPEED,Cn().FLOW]),this.POLYGON_0=X([Cn().X,Cn().Y,Cn().SIZE,Cn().LINETYPE,Cn().COLOR,Cn().FILL,Cn().ALPHA]),this.AREA_0=X([Cn().X,Cn().Y,Cn().SIZE,Cn().LINETYPE,Cn().COLOR,Cn().FILL,Cn().ALPHA])}Vn.$metadata$={kind:h,simpleName:"Builder",interfaces:[]},Nn.$metadata$={kind:h,simpleName:"DataFrame",interfaces:[]},ji.prototype.defined_896ixz$=function(t){var e;if(t.isNumeric){var n=this.get_31786j$(t);return null!=n&&k("number"==typeof(e=n)?e:s())}return!0},ji.$metadata$={kind:f,simpleName:"DataPointAesthetics",interfaces:[]},Li.prototype.hasDomainLimits=function(){return!this.domainLimits.isEmpty()},Li.prototype.isInDomain_s8jyv4$=function(t){var n,i=this.numberByDomainValue_0;return(e.isType(n=i,Y)?n:s()).containsKey_11rb$(t)},Li.prototype.apply_9ma18$=function(t){var e,n=K(V(t,10));for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(this.asNumber_0(i))}return n},Li.prototype.applyInverse_yrwdxb$=function(t){return this.fromNumber_0(t)},Li.prototype.asNumber_0=function(t){if(null==t)return null;if(this.numberByDomainValue_0.containsKey_11rb$(t))return this.numberByDomainValue_0.get_11rb$(t);throw q("value "+F(t)+" is not in the domain: "+this.numberByDomainValue_0.keys)},Li.prototype.fromNumber_0=function(t){var e;if(null==t)return null;if(this.domainValueByNumber_0.containsKey_mef7kx$(t))return this.domainValueByNumber_0.get_mef7kx$(t);var n=this.domainValueByNumber_0.ceilingKey_mef7kx$(t),i=this.domainValueByNumber_0.floorKey_mef7kx$(t),r=null;if(null!=n||null!=i){if(null==n)e=i;else if(null==i)e=n;else{var o=n-t,a=i-t;e=W.abs(o)0&&(l=this.alpha_il6rhx$(a,i)),t.update_mjoany$(o,s,a,l,r)},Qr.prototype.alpha_il6rhx$=function(t,e){return at.Colors.solid_98b62m$(t)?y(e.alpha()):st.SvgUtils.alpha2opacity_za3lpa$(t.alpha)},Qr.prototype.strokeWidth_l6g9mh$=function(t){return 2*y(t.size())},Qr.prototype.textSize_l6g9mh$=function(t){return 2*y(t.size())},Qr.prototype.updateStroke_g0plfl$=function(t,e,n){t.strokeColor().set_11rb$(e.color()),at.Colors.solid_98b62m$(y(e.color()))&&n&&t.strokeOpacity().set_11rb$(e.alpha())},Qr.prototype.updateFill_v4tjbc$=function(t,e){t.fillColor().set_11rb$(e.fill()),at.Colors.solid_98b62m$(y(e.fill()))&&t.fillOpacity().set_11rb$(e.alpha())},Qr.$metadata$={kind:p,simpleName:"AestheticsUtil",interfaces:[]};var to=null;function eo(){return null===to&&new Qr,to}function no(t){this.myMap_0=t}function io(){ro=this}no.prototype.get_31786j$=function(t){var e;return"function"==typeof(e=this.myMap_0.get_11rb$(t))?e:s()},no.$metadata$={kind:h,simpleName:"TypedIndexFunctionMap",interfaces:[]},io.prototype.create_wd6eaa$=function(t,e,n,i){void 0===n&&(n=null),void 0===i&&(i=null);var r=new lt(this.originX_0(t),this.originY_0(e));return this.create_e5yqp7$(r,n,i)},io.prototype.create_e5yqp7$=function(t,e,n){return void 0===e&&(e=null),void 0===n&&(n=null),new oo(this.toClientOffsetX_0(t.x),this.toClientOffsetY_0(t.y),this.fromClientOffsetX_0(t.x),this.fromClientOffsetY_0(t.y),e,n)},io.prototype.toClientOffsetX_4fzjta$=function(t){return this.toClientOffsetX_0(this.originX_0(t))},io.prototype.toClientOffsetY_4fzjta$=function(t){return this.toClientOffsetY_0(this.originY_0(t))},io.prototype.originX_0=function(t){return-t.lowerEnd},io.prototype.originY_0=function(t){return t.upperEnd},io.prototype.toClientOffsetX_0=function(t){return e=t,function(t){return e+t};var e},io.prototype.fromClientOffsetX_0=function(t){return e=t,function(t){return t-e};var e},io.prototype.toClientOffsetY_0=function(t){return e=t,function(t){return e-t};var e},io.prototype.fromClientOffsetY_0=function(t){return e=t,function(t){return e-t};var e},io.$metadata$={kind:p,simpleName:"Coords",interfaces:[]};var ro=null;function oo(t,e,n,i,r,o){this.myToClientOffsetX_0=t,this.myToClientOffsetY_0=e,this.myFromClientOffsetX_0=n,this.myFromClientOffsetY_0=i,this.xLim_0=r,this.yLim_0=o}function ao(){}function so(){uo=this}function lo(t,n){return e.compareTo(t.name,n.name)}oo.prototype.toClient_gpjtzr$=function(t){return new lt(this.myToClientOffsetX_0(t.x),this.myToClientOffsetY_0(t.y))},oo.prototype.fromClient_gpjtzr$=function(t){return new lt(this.myFromClientOffsetX_0(t.x),this.myFromClientOffsetY_0(t.y))},oo.prototype.isPointInLimits_k2qmv6$$default=function(t,e){var n,i,r,o,a=e?this.fromClient_gpjtzr$(t):t;return(null==(i=null!=(n=this.xLim_0)?n.contains_mef7kx$(a.x):null)||i)&&(null==(o=null!=(r=this.yLim_0)?r.contains_mef7kx$(a.y):null)||o)},oo.prototype.isRectInLimits_fd842m$$default=function(t,e){var n,i,r,o,a=e?new eu(this).fromClient_wthzt5$(t):t;return(null==(i=null!=(n=this.xLim_0)?n.encloses_d226ot$(a.xRange()):null)||i)&&(null==(o=null!=(r=this.yLim_0)?r.encloses_d226ot$(a.yRange()):null)||o)},oo.prototype.isPathInLimits_f6t8kh$$default=function(t,n){var i;t:do{var r;if(e.isType(t,g)&&t.isEmpty()){i=!1;break t}for(r=t.iterator();r.hasNext();){var o=r.next();if(this.isPointInLimits_k2qmv6$(o,n)){i=!0;break t}}i=!1}while(0);return i},oo.prototype.isPolygonInLimits_f6t8kh$$default=function(t,e){var n=ut.DoubleRectangles.boundingBox_qdtdbw$(t);return this.isRectInLimits_fd842m$(n,e)},Object.defineProperty(oo.prototype,"xClientLimit",{configurable:!0,get:function(){var t;return null!=(t=this.xLim_0)?this.convertRange_0(t,this.myToClientOffsetX_0):null}}),Object.defineProperty(oo.prototype,"yClientLimit",{configurable:!0,get:function(){var t;return null!=(t=this.yLim_0)?this.convertRange_0(t,this.myToClientOffsetY_0):null}}),oo.prototype.convertRange_0=function(t,e){var n=e(t.lowerEnd),i=e(t.upperEnd);return new et(o.Comparables.min_sdesaw$(n,i),o.Comparables.max_sdesaw$(n,i))},oo.$metadata$={kind:h,simpleName:"DefaultCoordinateSystem",interfaces:[On]},ao.$metadata$={kind:f,simpleName:"Projection",interfaces:[]},so.prototype.transformVarFor_896ixz$=function(t){return $o().forAes_896ixz$(t)},so.prototype.applyTransform_xaiv89$=function(t,e,n,i){var r=this.transformVarFor_896ixz$(n);return this.applyTransform_0(t,e,r,i)},so.prototype.applyTransform_0=function(t,e,n,i){var r=i.applyTransform_yzw12z$(t.get_8xm3sj$(e),!0);return t.builder().putNumeric_s1rqo9$(n,r).build()},so.prototype.hasVariable_vede35$=function(t,e){var n;for(n=t.variables().iterator();n.hasNext();){var i=n.next();if(l(e,i.name))return!0}return!1},so.prototype.findVariableOrFail_vede35$=function(t,e){var n;for(n=t.variables().iterator();n.hasNext();){var i=n.next();if(l(e,i.name))return i}var r,o="Variable not found: '"+e+"'. Variables in data frame: ",a=t.variables(),s=K(V(a,10));for(r=a.iterator();r.hasNext();){var u=r.next();s.add_11rb$("'"+u.name+"'")}throw d(o+s)},so.prototype.isNumeric_vede35$=function(t,e){return t.isNumeric_8xm3sj$(this.findVariableOrFail_vede35$(t,e))},so.prototype.sortedCopy_jgbhqw$=function(t){return ct.Companion.from_iajr8b$(new pt(lo)).sortedCopy_m5x2f4$(t)},so.prototype.variables_dhhkv7$=function(t){var e,n=t.variables(),i=ht("name",1,(function(t){return t.name})),r=_t(M(V(n,10)),16),o=B(r);for(e=n.iterator();e.hasNext();){var a=e.next();o.put_xwzc9p$(i(a),a)}return o},so.prototype.appendReplace_yxlle4$=function(t,n){var i,r,o=(r=this,function(t,n,i){var o,a=r;for(o=n.iterator();o.hasNext();){var s,l=o.next(),u=a.findVariableOrFail_vede35$(i,l.name);!0===(s=i.isNumeric_8xm3sj$(u))?t.putNumeric_s1rqo9$(l,i.getNumeric_8xm3sj$(u)):!1===s?t.putDiscrete_2l962d$(l,i.get_8xm3sj$(u)):e.noWhenBranchMatched()}return t}),a=Pi(),l=t.variables(),u=c();for(i=l.iterator();i.hasNext();){var p,h=i.next(),_=this.variables_dhhkv7$(n),f=h.name;(e.isType(p=_,Y)?p:s()).containsKey_11rb$(f)||u.add_11rb$(h)}var d,m=o(a,u,t),y=t.variables(),$=c();for(d=y.iterator();d.hasNext();){var v,g=d.next(),b=this.variables_dhhkv7$(n),w=g.name;(e.isType(v=b,Y)?v:s()).containsKey_11rb$(w)&&$.add_11rb$(g)}var x,k=o(m,$,n),E=n.variables(),C=c();for(x=E.iterator();x.hasNext();){var S,T=x.next(),O=this.variables_dhhkv7$(t),N=T.name;(e.isType(S=O,Y)?S:s()).containsKey_11rb$(N)||C.add_11rb$(T)}return o(k,C,n).build()},so.prototype.toMap_dhhkv7$=function(t){var e,n=I();for(e=t.variables().iterator();e.hasNext();){var i=e.next(),r=i.name,o=t.get_8xm3sj$(i);n.put_xwzc9p$(r,o)}return n},so.prototype.fromMap_bkhwtg$=function(t){var n,i=Pi();for(n=t.entries.iterator();n.hasNext();){var r=n.next(),o=r.key,a=r.value;if("string"!=typeof o){var s="Map to data-frame: key expected a String but was "+e.getKClassFromExpression(y(o)).simpleName+" : "+F(o);throw d(s.toString())}if(!e.isType(a,u)){var l="Map to data-frame: value expected a List but was "+e.getKClassFromExpression(y(a)).simpleName+" : "+F(a);throw d(l.toString())}i.put_2l962d$(this.createVariable_puj7f4$(o),a)}return i.build()},so.prototype.createVariable_puj7f4$=function(t,e){return void 0===e&&(e=t),$o().isTransformVar_61zpoe$(t)?$o().get_61zpoe$(t):Rv().isStatVar_61zpoe$(t)?Rv().statVar_61zpoe$(t):_o().isDummyVar_61zpoe$(t)?_o().newDummy_61zpoe$(t):new An(t,Rn(),e)},so.prototype.getSummaryText_dhhkv7$=function(t){var e,n=m();for(e=t.variables().iterator();e.hasNext();){var i=e.next();n.append_pdl1vj$(i.toSummaryString()).append_pdl1vj$(" numeric: "+F(t.isNumeric_8xm3sj$(i))).append_pdl1vj$(" size: "+F(t.get_8xm3sj$(i).size)).append_s8itvh$(10)}return n.toString()},so.prototype.removeAllExcept_dipqvu$=function(t,e){var n,i=t.builder();for(n=t.variables().iterator();n.hasNext();){var r=n.next();e.contains_11rb$(r.name)||i.remove_8xm3sj$(r)}return i.build()},so.$metadata$={kind:p,simpleName:"DataFrameUtil",interfaces:[]};var uo=null;function co(){return null===uo&&new so,uo}function po(){ho=this,this.PREFIX_0="__"}po.prototype.isDummyVar_61zpoe$=function(t){if(!ft.Strings.isNullOrEmpty_pdl1vj$(t)&&t.length>2&&dt(t,this.PREFIX_0)){var e=t.substring(2);return mt("[0-9]+").matches_6bul2c$(e)}return!1},po.prototype.dummyNames_za3lpa$=function(t){for(var e=c(),n=0;nb.SeriesUtil.TINY))throw d(("x-step is too small: "+h).toString());if(!(_>b.SeriesUtil.TINY))throw d(("y-step is too small: "+_).toString());var f=At(p.dimension.x/h)+1,m=At(p.dimension.y/_)+1;if(f*m>5e6){var $=p.center,v=["Raster image size","["+f+" X "+m+"]","exceeds capability","of","your imaging device"],g=$.y+16*v.length/2;for(a=0;a!==v.length;++a){var w=new ld(v[a]);w.textColor().set_11rb$(tt.Companion.DARK_MAGENTA),w.textOpacity().set_11rb$(.5),w.setFontSize_14dthe$(12),w.setFontWeight_pdl1vj$("bold"),w.setHorizontalAnchor_ja80zo$(fd()),w.setVerticalAnchor_yaudma$(vd());var x=c.toClient_vf7nkp$($.x,g,u);w.moveTo_gpjtzr$(x),t.add_26jijc$(w.rootGroup),g-=16}}else{var k=jt(At(f)),E=jt(At(m)),C=new lt(.5*h,.5*_),S=c.toClient_tkjljq$(p.origin.subtract_gpjtzr$(C),u),T=c.toClient_tkjljq$(p.origin.add_gpjtzr$(p.dimension).add_gpjtzr$(C),u),O=T.x=0?(n=new lt(r-a/2,0),i=new lt(a,o)):(n=new lt(r-a/2,o),i=new lt(a,-o)),new bt(n,i)},su.prototype.createGroups_83glv4$=function(t){var e,n=I();for(e=t.iterator();e.hasNext();){var i=e.next(),r=y(i.group());if(!n.containsKey_11rb$(r)){var o=c();n.put_xwzc9p$(r,o)}y(n.get_11rb$(r)).add_11rb$(i)}return n},su.prototype.rectToGeometry_6y0v78$=function(t,e,n,i){return X([new lt(t,e),new lt(t,i),new lt(n,i),new lt(n,e),new lt(t,e)])},lu.prototype.compare=function(t,n){var i=null!=t?t.x():null,r=null!=n?n.x():null;return null==i||null==r?0:e.compareTo(i,r)},lu.$metadata$={kind:h,interfaces:[pt]},uu.prototype.compare=function(t,n){var i=null!=t?t.y():null,r=null!=n?n.y():null;return null==i||null==r?0:e.compareTo(i,r)},uu.$metadata$={kind:h,interfaces:[pt]},su.$metadata$={kind:p,simpleName:"GeomUtil",interfaces:[]};var _u=null;function fu(){return null===_u&&new su,_u}function du(){mu=this}du.prototype.fromColor_l6g9mh$=function(t){return this.fromColorValue_o14uds$(y(t.color()),y(t.alpha()))},du.prototype.fromFill_l6g9mh$=function(t){return this.fromColorValue_o14uds$(y(t.fill()),y(t.alpha()))},du.prototype.fromColorValue_o14uds$=function(t,e){var n=jt(255*e);return at.Colors.solid_98b62m$(t)?t.changeAlpha_za3lpa$(n):t},du.$metadata$={kind:p,simpleName:"HintColorUtil",interfaces:[]};var mu=null;function yu(){return null===mu&&new du,mu}function $u(t,e){this.myPoint_0=t,this.myHelper_0=e,this.myHints_0=I()}function vu(){this.myDefaultObjectRadius_0=null,this.myDefaultX_0=null,this.myDefaultColor_0=null,this.myDefaultKind_0=null}function gu(t,e){this.$outer=t,this.aes=e,this.kind=null,this.objectRadius_u2tfw5$_0=null,this.x_is741i$_0=null,this.color_8be2vx$_ng3d4v$_0=null,this.objectRadius=this.$outer.myDefaultObjectRadius_0,this.x=this.$outer.myDefaultX_0,this.kind=this.$outer.myDefaultKind_0,this.color_8be2vx$=this.$outer.myDefaultColor_0}function bu(t,e,n,i){ku(),this.myTargetCollector_0=t,this.myDataPoints_0=e,this.myLinesHelper_0=n,this.myClosePath_0=i}function wu(){xu=this,this.DROP_POINT_DISTANCE_0=.999}Object.defineProperty($u.prototype,"hints",{configurable:!0,get:function(){return this.myHints_0}}),$u.prototype.addHint_p9kkqu$=function(t){var e=this.getCoord_0(t);if(null!=e){var n=this.hints,i=t.aes,r=this.createHint_0(t,e);n.put_xwzc9p$(i,r)}return this},$u.prototype.getCoord_0=function(t){if(null==t.x)throw d("x coord is not set");var e=t.aes;return this.myPoint_0.defined_896ixz$(e)?this.myHelper_0.toClient_tkjljq$(new lt(y(t.x),y(this.myPoint_0.get_31786j$(e))),this.myPoint_0):null},$u.prototype.createHint_0=function(t,e){var n,i,r=t.objectRadius,o=t.color_8be2vx$;if(null==r)throw d("object radius is not set");if(n=t.kind,l(n,tp()))i=gp().verticalTooltip_6lq1u6$(e,r,o);else if(l(n,ep()))i=gp().horizontalTooltip_6lq1u6$(e,r,o);else{if(!l(n,np()))throw d("Unknown hint kind: "+F(t.kind));i=gp().cursorTooltip_itpcqk$(e,o)}return i},vu.prototype.defaultObjectRadius_14dthe$=function(t){return this.myDefaultObjectRadius_0=t,this},vu.prototype.defaultX_14dthe$=function(t){return this.myDefaultX_0=t,this},vu.prototype.defaultColor_yo1m5r$=function(t,e){return this.myDefaultColor_0=null!=e?t.changeAlpha_za3lpa$(jt(255*e)):t,this},vu.prototype.create_vktour$=function(t){return new gu(this,t)},vu.prototype.defaultKind_nnfttk$=function(t){return this.myDefaultKind_0=t,this},Object.defineProperty(gu.prototype,"objectRadius",{configurable:!0,get:function(){return this.objectRadius_u2tfw5$_0},set:function(t){this.objectRadius_u2tfw5$_0=t}}),Object.defineProperty(gu.prototype,"x",{configurable:!0,get:function(){return this.x_is741i$_0},set:function(t){this.x_is741i$_0=t}}),Object.defineProperty(gu.prototype,"color_8be2vx$",{configurable:!0,get:function(){return this.color_8be2vx$_ng3d4v$_0},set:function(t){this.color_8be2vx$_ng3d4v$_0=t}}),gu.prototype.objectRadius_14dthe$=function(t){return this.objectRadius=t,this},gu.prototype.x_14dthe$=function(t){return this.x=t,this},gu.prototype.color_98b62m$=function(t){return this.color_8be2vx$=t,this},gu.$metadata$={kind:h,simpleName:"HintConfig",interfaces:[]},vu.$metadata$={kind:h,simpleName:"HintConfigFactory",interfaces:[]},$u.$metadata$={kind:h,simpleName:"HintsCollection",interfaces:[]},bu.prototype.construct_6taknv$=function(t){var e,n=c(),i=this.createMultiPointDataByGroup_0();for(e=i.iterator();e.hasNext();){var r=e.next();n.addAll_brywnq$(this.myLinesHelper_0.createPaths_edlkk9$(r.aes,r.points,this.myClosePath_0))}return t&&this.buildHints_0(i),n},bu.prototype.buildHints=function(){this.buildHints_0(this.createMultiPointDataByGroup_0())},bu.prototype.buildHints_0=function(t){var e;for(e=t.iterator();e.hasNext();){var n=e.next();this.myClosePath_0?this.myTargetCollector_0.addPolygon_sa5m83$(n.points,n.localToGlobalIndex,nc().params().setColor_98b62m$(yu().fromFill_l6g9mh$(n.aes))):this.myTargetCollector_0.addPath_sa5m83$(n.points,n.localToGlobalIndex,nc().params().setColor_98b62m$(yu().fromColor_l6g9mh$(n.aes)))}},bu.prototype.createMultiPointDataByGroup_0=function(){return Bu().createMultiPointDataByGroup_ugj9hh$(this.myDataPoints_0,Bu().singlePointAppender_v9bvvf$((t=this,function(e){return t.myLinesHelper_0.toClient_tkjljq$(y(fu().TO_LOCATION_X_Y(e)),e)})),Bu().reducer_8555vt$(ku().DROP_POINT_DISTANCE_0,this.myClosePath_0));var t},wu.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var xu=null;function ku(){return null===xu&&new wu,xu}function Eu(t,e,n){nu.call(this,t,e,n),this.myAlphaFilter_nxoahd$_0=Ou,this.myWidthFilter_sx37fb$_0=Nu,this.myAlphaEnabled_98jfa$_0=!0}function Cu(t){return function(e){return t(e)}}function Su(t){return function(e){return t(e)}}function Tu(t){this.path=t}function Ou(t){return t}function Nu(t){return t}function Pu(t,e){this.myAesthetics_0=t,this.myPointAestheticsMapper_0=e}function Au(t,e,n,i){this.aes=t,this.points=e,this.localToGlobalIndex=n,this.group=i}function ju(){Mu=this}function Lu(){return new zu}function Ru(){}function Iu(t,e){this.myCoordinateAppender_0=t,this.myPointCollector_0=e,this.myFirstAes_0=null}function zu(){this.myPoints_0=c(),this.myIndexes_0=c()}function Du(t,e){this.myDropPointDistance_0=t,this.myPolygon_0=e,this.myReducedPoints_0=c(),this.myReducedIndexes_0=c(),this.myLastAdded_0=null,this.myLastPostponed_0=null,this.myRegionStart_0=null}bu.$metadata$={kind:h,simpleName:"LinePathConstructor",interfaces:[]},Eu.prototype.insertPathSeparators_fr5rf4$_0=function(t){var e,n=c();for(e=t.iterator();e.hasNext();){var i=e.next();n.isEmpty()||n.add_11rb$(Ff().END_OF_SUBPATH),n.addAll_brywnq$(i)}return n},Eu.prototype.setAlphaEnabled_6taknv$=function(t){this.myAlphaEnabled_98jfa$_0=t},Eu.prototype.createLines_rrreuh$=function(t,e){return this.createPaths_gfkrhx$_0(t,e,!1)},Eu.prototype.createPaths_gfkrhx$_0=function(t,e,n){var i,r=c();for(i=Bu().createMultiPointDataByGroup_ugj9hh$(t,Bu().singlePointAppender_v9bvvf$(this.toClientLocation_sfitzs$(function(t){return function(e){return t(e)}}(e))),Bu().reducer_8555vt$(.999,n)).iterator();i.hasNext();){var o=i.next();r.addAll_brywnq$(this.createPaths_edlkk9$(o.aes,o.points,n))}return r},Eu.prototype.createPaths_edlkk9$=function(t,e,n){var i,r=c();for(n?r.add_11rb$(Ff().polygon_yh26e7$(this.insertPathSeparators_fr5rf4$_0(Gt(e)))):r.add_11rb$(Ff().line_qdtdbw$(e)),i=r.iterator();i.hasNext();){var o=i.next();this.decorate_frjrd5$(o,t,n)}return r},Eu.prototype.createSteps_1fp004$=function(t,e){var n,i,r=c();for(n=Bu().createMultiPointDataByGroup_ugj9hh$(t,Bu().singlePointAppender_v9bvvf$(this.toClientLocation_sfitzs$(fu().TO_LOCATION_X_Y)),Bu().reducer_8555vt$(.999,!1)).iterator();n.hasNext();){var o=n.next(),a=o.points;if(!a.isEmpty()){var s=c(),l=null;for(i=a.iterator();i.hasNext();){var u=i.next();if(null!=l){var p=e===ol()?u.x:l.x,h=e===ol()?l.y:u.y;s.add_11rb$(new lt(p,h))}s.add_11rb$(u),l=u}var _=Ff().line_qdtdbw$(s);this.decorate_frjrd5$(_,o.aes,!1),r.add_11rb$(new Tu(_))}}return r},Eu.prototype.createBands_22uu1u$=function(t,e,n){var i,r=c(),o=fu().createGroups_83glv4$(t);for(i=ct.Companion.natural_dahdeg$().sortedCopy_m5x2f4$(o.keys).iterator();i.hasNext();){var a=i.next(),s=o.get_11rb$(a),l=R(this.project_rrreuh$(y(s),Cu(e))),u=N(s);if(l.addAll_brywnq$(this.project_rrreuh$(u,Su(n))),!l.isEmpty()){var p=Ff().polygon_yh26e7$(l);this.decorateFillingPart_e7h5w8$_0(p,s.get_za3lpa$(0)),r.add_11rb$(p)}}return r},Eu.prototype.decorate_frjrd5$=function(t,e,n){var i=e.color(),r=y(this.myAlphaFilter_nxoahd$_0(eo().alpha_il6rhx$(y(i),e)));t.color().set_11rb$(at.Colors.withOpacity_o14uds$(i,r)),eo().ALPHA_CONTROLS_BOTH_8be2vx$||!n&&this.myAlphaEnabled_98jfa$_0||t.color().set_11rb$(i),n&&this.decorateFillingPart_e7h5w8$_0(t,e);var o=y(this.myWidthFilter_sx37fb$_0(jr().strokeWidth_l6g9mh$(e)));t.width().set_11rb$(o);var a=e.lineType();a.isBlank||a.isSolid||t.dashArray().set_11rb$(a.dashArray)},Eu.prototype.decorateFillingPart_e7h5w8$_0=function(t,e){var n=e.fill(),i=y(this.myAlphaFilter_nxoahd$_0(eo().alpha_il6rhx$(y(n),e)));t.fill().set_11rb$(at.Colors.withOpacity_o14uds$(n,i))},Eu.prototype.setAlphaFilter_m9g0ow$=function(t){this.myAlphaFilter_nxoahd$_0=t},Eu.prototype.setWidthFilter_m9g0ow$=function(t){this.myWidthFilter_sx37fb$_0=t},Tu.$metadata$={kind:h,simpleName:"PathInfo",interfaces:[]},Eu.$metadata$={kind:h,simpleName:"LinesHelper",interfaces:[nu]},Object.defineProperty(Pu.prototype,"isEmpty",{configurable:!0,get:function(){return this.myAesthetics_0.isEmpty}}),Pu.prototype.dataPointAt_za3lpa$=function(t){return this.myPointAestheticsMapper_0(this.myAesthetics_0.dataPointAt_za3lpa$(t))},Pu.prototype.dataPointCount=function(){return this.myAesthetics_0.dataPointCount()},Pu.prototype.dataPoints=function(){var t,e=this.myAesthetics_0.dataPoints(),n=K(V(e,10));for(t=e.iterator();t.hasNext();){var i=t.next();n.add_11rb$(this.myPointAestheticsMapper_0(i))}return n},Pu.prototype.range_vktour$=function(t){throw q("MappedAesthetics.range: not implemented "+t)},Pu.prototype.overallRange_vktour$=function(t){throw q("MappedAesthetics.overallRange: not implemented "+t)},Pu.prototype.resolution_594811$=function(t,e){throw q("MappedAesthetics.resolution: not implemented "+t)},Pu.prototype.numericValues_vktour$=function(t){throw q("MappedAesthetics.numericValues: not implemented "+t)},Pu.prototype.groups=function(){return this.myAesthetics_0.groups()},Pu.$metadata$={kind:h,simpleName:"MappedAesthetics",interfaces:[Sn]},Au.$metadata$={kind:h,simpleName:"MultiPointData",interfaces:[]},ju.prototype.collector=function(){return Lu},ju.prototype.reducer_8555vt$=function(t,e){return n=t,i=e,function(){return new Du(n,i)};var n,i},ju.prototype.singlePointAppender_v9bvvf$=function(t){return e=t,function(t,n){return n(e(t)),Z};var e},ju.prototype.multiPointAppender_t2aup3$=function(t){return e=t,function(t,n){var i;for(i=e(t).iterator();i.hasNext();)n(i.next());return Z};var e},ju.prototype.createMultiPointDataByGroup_ugj9hh$=function(t,n,i){var r,o,a=I();for(r=t.iterator();r.hasNext();){var l,u,p=r.next(),h=p.group();if(!(e.isType(l=a,Y)?l:s()).containsKey_11rb$(h)){var _=y(h),f=new Iu(n,i());a.put_xwzc9p$(_,f)}y((e.isType(u=a,Y)?u:s()).get_11rb$(h)).add_lsjzq4$(p)}var d=c();for(o=ct.Companion.natural_dahdeg$().sortedCopy_m5x2f4$(a.keys).iterator();o.hasNext();){var m=o.next(),$=y(a.get_11rb$(m)).create_kcn2v3$(m);$.points.isEmpty()||d.add_11rb$($)}return d},Ru.$metadata$={kind:f,simpleName:"PointCollector",interfaces:[]},Iu.prototype.add_lsjzq4$=function(t){var e,n;null==this.myFirstAes_0&&(this.myFirstAes_0=t),this.myCoordinateAppender_0(t,(e=this,n=t,function(t){return e.myPointCollector_0.add_aqrfag$(t,n.index()),Z}))},Iu.prototype.create_kcn2v3$=function(t){var e,n=this.myPointCollector_0.points;return new Au(y(this.myFirstAes_0),n.first,(e=n,function(t){return e.second.get_za3lpa$(t)}),t)},Iu.$metadata$={kind:h,simpleName:"MultiPointDataCombiner",interfaces:[]},Object.defineProperty(zu.prototype,"points",{configurable:!0,get:function(){return new Ht(this.myPoints_0,this.myIndexes_0)}}),zu.prototype.add_aqrfag$=function(t,e){this.myPoints_0.add_11rb$(y(t)),this.myIndexes_0.add_11rb$(e)},zu.$metadata$={kind:h,simpleName:"SimplePointCollector",interfaces:[Ru]},Object.defineProperty(Du.prototype,"points",{configurable:!0,get:function(){return null!=this.myLastPostponed_0&&(this.addPoint_0(y(this.myLastPostponed_0).first,y(this.myLastPostponed_0).second),this.myLastPostponed_0=null),new Ht(this.myReducedPoints_0,this.myReducedIndexes_0)}}),Du.prototype.isCloserThan_0=function(t,e,n){var i=t.x-e.x,r=W.abs(i)=0){var _=y(u),f=y(r.get_11rb$(u))+h;r.put_xwzc9p$(_,f)}else{var d=y(u),m=y(o.get_11rb$(u))-h;o.put_xwzc9p$(d,m)}}}var $=I();i=t.dataPointCount();for(var v=0;v=0;if(C&&(C=y((e.isType(E=r,Y)?E:s()).get_11rb$(x))>0),C){var S,T=1/y((e.isType(S=r,Y)?S:s()).get_11rb$(x));$.put_xwzc9p$(v,T)}else{var O,N=k<0;if(N&&(N=y((e.isType(O=o,Y)?O:s()).get_11rb$(x))>0),N){var P,A=1/y((e.isType(P=o,Y)?P:s()).get_11rb$(x));$.put_xwzc9p$(v,A)}else $.put_xwzc9p$(v,1)}}else $.put_xwzc9p$(v,1)}return $},Kp.prototype.translate_tshsjz$=function(t,e,n){var i=this.myStackPosHelper_0.translate_tshsjz$(t,e,n);return new lt(i.x,i.y*y(this.myScalerByIndex_0.get_11rb$(e.index()))*n.getUnitResolution_vktour$(Cn().Y))},Kp.prototype.handlesGroups=function(){return gh().handlesGroups()},Kp.$metadata$={kind:h,simpleName:"FillPos",interfaces:[br]},Wp.prototype.translate_tshsjz$=function(t,e,n){var i=this.myJitterPosHelper_0.translate_tshsjz$(t,e,n);return this.myDodgePosHelper_0.translate_tshsjz$(i,e,n)},Wp.prototype.handlesGroups=function(){return xh().handlesGroups()},Wp.$metadata$={kind:h,simpleName:"JitterDodgePos",interfaces:[br]},Xp.prototype.translate_tshsjz$=function(t,e,n){var i=(2*Kt.Default.nextDouble()-1)*this.myWidth_0*n.getResolution_vktour$(Cn().X),r=(2*Kt.Default.nextDouble()-1)*this.myHeight_0*n.getResolution_vktour$(Cn().Y);return t.add_gpjtzr$(new lt(i,r))},Xp.prototype.handlesGroups=function(){return bh().handlesGroups()},Zp.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var Jp=null;function Qp(){return null===Jp&&new Zp,Jp}function th(t,e){hh(),this.myWidth_0=0,this.myHeight_0=0,this.myWidth_0=null!=t?t:hh().DEF_NUDGE_WIDTH,this.myHeight_0=null!=e?e:hh().DEF_NUDGE_HEIGHT}function eh(){ph=this,this.DEF_NUDGE_WIDTH=0,this.DEF_NUDGE_HEIGHT=0}Xp.$metadata$={kind:h,simpleName:"JitterPos",interfaces:[br]},th.prototype.translate_tshsjz$=function(t,e,n){var i=this.myWidth_0*n.getUnitResolution_vktour$(Cn().X),r=this.myHeight_0*n.getUnitResolution_vktour$(Cn().Y);return t.add_gpjtzr$(new lt(i,r))},th.prototype.handlesGroups=function(){return wh().handlesGroups()},eh.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var nh,ih,rh,oh,ah,sh,lh,uh,ch,ph=null;function hh(){return null===ph&&new eh,ph}function _h(){Th=this}function fh(){}function dh(t,e,n){w.call(this),this.myHandlesGroups_39qcox$_0=n,this.name$=t,this.ordinal$=e}function mh(){mh=function(){},nh=new dh("IDENTITY",0,!1),ih=new dh("DODGE",1,!0),rh=new dh("STACK",2,!0),oh=new dh("FILL",3,!0),ah=new dh("JITTER",4,!1),sh=new dh("NUDGE",5,!1),lh=new dh("JITTER_DODGE",6,!0)}function yh(){return mh(),nh}function $h(){return mh(),ih}function vh(){return mh(),rh}function gh(){return mh(),oh}function bh(){return mh(),ah}function wh(){return mh(),sh}function xh(){return mh(),lh}function kh(t,e){w.call(this),this.name$=t,this.ordinal$=e}function Eh(){Eh=function(){},uh=new kh("SUM_POSITIVE_NEGATIVE",0),ch=new kh("SPLIT_POSITIVE_NEGATIVE",1)}function Ch(){return Eh(),uh}function Sh(){return Eh(),ch}th.$metadata$={kind:h,simpleName:"NudgePos",interfaces:[br]},Object.defineProperty(fh.prototype,"isIdentity",{configurable:!0,get:function(){return!0}}),fh.prototype.translate_tshsjz$=function(t,e,n){return t},fh.prototype.handlesGroups=function(){return yh().handlesGroups()},fh.$metadata$={kind:h,interfaces:[br]},_h.prototype.identity=function(){return new fh},_h.prototype.dodge_vvhcz8$=function(t,e,n){return new Vp(t,e,n)},_h.prototype.stack_4vnpmn$=function(t,n){var i;switch(n.name){case"SPLIT_POSITIVE_NEGATIVE":i=Lh().splitPositiveNegative_m7huy5$(t);break;case"SUM_POSITIVE_NEGATIVE":i=Lh().sumPositiveNegative_m7huy5$(t);break;default:i=e.noWhenBranchMatched()}return i},_h.prototype.fill_m7huy5$=function(t){return new Kp(t)},_h.prototype.jitter_jma9l8$=function(t,e){return new Xp(t,e)},_h.prototype.nudge_jma9l8$=function(t,e){return new th(t,e)},_h.prototype.jitterDodge_e2pc44$=function(t,e,n,i,r){return new Wp(t,e,n,i,r)},dh.prototype.handlesGroups=function(){return this.myHandlesGroups_39qcox$_0},dh.$metadata$={kind:h,simpleName:"Meta",interfaces:[w]},dh.values=function(){return[yh(),$h(),vh(),gh(),bh(),wh(),xh()]},dh.valueOf_61zpoe$=function(t){switch(t){case"IDENTITY":return yh();case"DODGE":return $h();case"STACK":return vh();case"FILL":return gh();case"JITTER":return bh();case"NUDGE":return wh();case"JITTER_DODGE":return xh();default:x("No enum constant jetbrains.datalore.plot.base.pos.PositionAdjustments.Meta."+t)}},kh.$metadata$={kind:h,simpleName:"StackingStrategy",interfaces:[w]},kh.values=function(){return[Ch(),Sh()]},kh.valueOf_61zpoe$=function(t){switch(t){case"SUM_POSITIVE_NEGATIVE":return Ch();case"SPLIT_POSITIVE_NEGATIVE":return Sh();default:x("No enum constant jetbrains.datalore.plot.base.pos.PositionAdjustments.StackingStrategy."+t)}},_h.$metadata$={kind:p,simpleName:"PositionAdjustments",interfaces:[]};var Th=null;function Oh(t){Lh(),this.myOffsetByIndex_0=null,this.myOffsetByIndex_0=this.mapIndexToOffset_m7huy5$(t)}function Nh(t){Oh.call(this,t)}function Ph(t){Oh.call(this,t)}function Ah(){jh=this}Oh.prototype.translate_tshsjz$=function(t,e,n){return t.add_gpjtzr$(new lt(0,y(this.myOffsetByIndex_0.get_11rb$(e.index()))))},Oh.prototype.handlesGroups=function(){return vh().handlesGroups()},Nh.prototype.mapIndexToOffset_m7huy5$=function(t){var n,i=I(),r=I();n=t.dataPointCount();for(var o=0;o=0?f.second.getAndAdd_14dthe$(h):f.first.getAndAdd_14dthe$(h);i.put_xwzc9p$(o,d)}}}return i},Nh.$metadata$={kind:h,simpleName:"SplitPositiveNegative",interfaces:[Oh]},Ph.prototype.mapIndexToOffset_m7huy5$=function(t){var e,n=I(),i=I();e=t.dataPointCount();for(var r=0;r0&&r.append_s8itvh$(44),r.append_pdl1vj$(o.toString())}t.getAttribute_61zpoe$(st.SvgConstants.SVG_STROKE_DASHARRAY_ATTRIBUTE).set_11rb$(r.toString())},qf.$metadata$={kind:p,simpleName:"StrokeDashArraySupport",interfaces:[]};var Gf=null;function Hf(){return null===Gf&&new qf,Gf}function Yf(){Xf(),this.myIsBuilt_hfl4wb$_0=!1,this.myIsBuilding_wftuqx$_0=!1,this.myRootGroup_34n42m$_0=new kt,this.myChildComponents_jx3u37$_0=c(),this.myOrigin_c2o9zl$_0=lt.Companion.ZERO,this.myRotationAngle_woxwye$_0=0,this.myCompositeRegistration_t8l21t$_0=new ne([])}function Vf(t){this.this$SvgComponent=t}function Kf(){Wf=this,this.CLIP_PATH_ID_PREFIX=""}Object.defineProperty(Yf.prototype,"childComponents",{configurable:!0,get:function(){if(!this.myIsBuilt_hfl4wb$_0)throw d("Plot has not yet built".toString());return R(this.myChildComponents_jx3u37$_0)}}),Object.defineProperty(Yf.prototype,"rootGroup",{configurable:!0,get:function(){return this.ensureBuilt(),this.myRootGroup_34n42m$_0}}),Yf.prototype.ensureBuilt=function(){this.myIsBuilt_hfl4wb$_0||this.myIsBuilding_wftuqx$_0||this.buildComponentIntern_92lbvk$_0()},Yf.prototype.buildComponentIntern_92lbvk$_0=function(){try{this.myIsBuilding_wftuqx$_0=!0,this.buildComponent()}finally{this.myIsBuilding_wftuqx$_0=!1,this.myIsBuilt_hfl4wb$_0=!0}},Vf.prototype.onEvent_11rb$=function(t){this.this$SvgComponent.needRebuild()},Vf.$metadata$={kind:h,interfaces:[ee]},Yf.prototype.rebuildHandler_287e2$=function(){return new Vf(this)},Yf.prototype.needRebuild=function(){this.myIsBuilt_hfl4wb$_0&&(this.clear(),this.buildComponentIntern_92lbvk$_0())},Yf.prototype.reg_3xv6fb$=function(t){this.myCompositeRegistration_t8l21t$_0.add_3xv6fb$(t)},Yf.prototype.clear=function(){var t;for(this.myIsBuilt_hfl4wb$_0=!1,t=this.myChildComponents_jx3u37$_0.iterator();t.hasNext();)t.next().clear();this.myChildComponents_jx3u37$_0.clear(),this.myRootGroup_34n42m$_0.children().clear(),this.myCompositeRegistration_t8l21t$_0.remove(),this.myCompositeRegistration_t8l21t$_0=new ne([])},Yf.prototype.add_8icvvv$=function(t){this.myChildComponents_jx3u37$_0.add_11rb$(t),this.add_26jijc$(t.rootGroup)},Yf.prototype.add_26jijc$=function(t){this.myRootGroup_34n42m$_0.children().add_11rb$(t)},Yf.prototype.moveTo_gpjtzr$=function(t){this.myOrigin_c2o9zl$_0=t,this.myRootGroup_34n42m$_0.transform().set_11rb$(Xf().buildTransform_e1sv3v$(this.myOrigin_c2o9zl$_0,this.myRotationAngle_woxwye$_0))},Yf.prototype.moveTo_lu1900$=function(t,e){this.moveTo_gpjtzr$(new lt(t,e))},Yf.prototype.rotate_14dthe$=function(t){this.myRotationAngle_woxwye$_0=t,this.myRootGroup_34n42m$_0.transform().set_11rb$(Xf().buildTransform_e1sv3v$(this.myOrigin_c2o9zl$_0,this.myRotationAngle_woxwye$_0))},Yf.prototype.toRelativeCoordinates_gpjtzr$=function(t){return this.rootGroup.pointToTransformedCoordinates_gpjtzr$(t)},Yf.prototype.toAbsoluteCoordinates_gpjtzr$=function(t){return this.rootGroup.pointToAbsoluteCoordinates_gpjtzr$(t)},Yf.prototype.clipBounds_wthzt5$=function(t){var e=new ie;e.id().set_11rb$(sd().get_61zpoe$(Xf().CLIP_PATH_ID_PREFIX));var n=e.children(),i=new re;i.x().set_11rb$(t.left),i.y().set_11rb$(t.top),i.width().set_11rb$(t.width),i.height().set_11rb$(t.height),n.add_11rb$(i);var r=e,o=new oe;o.children().add_11rb$(r);var a=o;this.add_26jijc$(a),this.rootGroup.clipPath().set_11rb$(new ae(y(r.id().get()))),this.rootGroup.setAttribute_qdh7ux$(se.Companion.CLIP_BOUNDS_JFX,t)},Yf.prototype.addClassName_61zpoe$=function(t){this.myRootGroup_34n42m$_0.addClass_61zpoe$(t)},Kf.prototype.buildTransform_e1sv3v$=function(t,e){var n=new le;return null!=t&&t.equals(lt.Companion.ZERO)||n.translate_lu1900$(t.x,t.y),0!==e&&n.rotate_14dthe$(e),n.build()},Kf.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var Wf=null;function Xf(){return null===Wf&&new Kf,Wf}function Zf(){ad=this,this.suffixGen_0=Qf}function Jf(){this.nextIndex_0=0}function Qf(){return ue.RandomString.randomString_za3lpa$(6)}Yf.$metadata$={kind:h,simpleName:"SvgComponent",interfaces:[]},Zf.prototype.setUpForTest=function(){var t,e=new Jf;this.suffixGen_0=(t=e,function(){return t.next()})},Zf.prototype.get_61zpoe$=function(t){return t+this.suffixGen_0().toString()},Jf.prototype.next=function(){var t;return"clip-"+(t=this.nextIndex_0,this.nextIndex_0=t+1|0,t)},Jf.$metadata$={kind:h,simpleName:"IncrementalId",interfaces:[]},Zf.$metadata$={kind:p,simpleName:"SvgUID",interfaces:[]};var td,ed,nd,id,rd,od,ad=null;function sd(){return null===ad&&new Zf,ad}function ld(t){Yf.call(this),this.myText_0=ce(t),this.myTextColor_0=null,this.myFontSize_0=0,this.myFontWeight_0=null,this.myFontFamily_0=null,this.myFontStyle_0=null,this.rootGroup.children().add_11rb$(this.myText_0)}function ud(t){this.this$TextLabel=t}function cd(t,e){w.call(this),this.name$=t,this.ordinal$=e}function pd(){pd=function(){},td=new cd("LEFT",0),ed=new cd("RIGHT",1),nd=new cd("MIDDLE",2)}function hd(){return pd(),td}function _d(){return pd(),ed}function fd(){return pd(),nd}function dd(t,e){w.call(this),this.name$=t,this.ordinal$=e}function md(){md=function(){},id=new dd("TOP",0),rd=new dd("BOTTOM",1),od=new dd("CENTER",2)}function yd(){return md(),id}function $d(){return md(),rd}function vd(){return md(),od}function gd(){this.definedBreaks_0=null,this.definedLabels_0=null,this.name_iafnnl$_0=null,this.mapper_ohg8eh$_0=null,this.multiplicativeExpand_lxi716$_0=0,this.additiveExpand_59ok4k$_0=0,this.labelFormatter_tb2f2k$_0=null}function bd(t){return t.toString()}function wd(t){this.myName_8be2vx$=t.name,this.myBreaks_8be2vx$=t.definedBreaks_0,this.myLabels_8be2vx$=t.definedLabels_0,this.myLabelFormatter_8be2vx$=t.labelFormatter,this.myMapper_8be2vx$=t.mapper,this.myMultiplicativeExpand_8be2vx$=t.multiplicativeExpand,this.myAdditiveExpand_8be2vx$=t.additiveExpand}function xd(t,e,n,i){return void 0===n&&(n=null),i=i||Object.create(gd.prototype),gd.call(i),i.name_iafnnl$_0=t,i.mapper_ohg8eh$_0=e,i.definedBreaks_0=n,i.definedLabels_0=null,i.labelFormatter_tb2f2k$_0=null,i}function kd(t,e){return e=e||Object.create(gd.prototype),gd.call(e),e.name_iafnnl$_0=t.myName_8be2vx$,e.definedBreaks_0=t.myBreaks_8be2vx$,e.definedLabels_0=t.myLabels_8be2vx$,e.labelFormatter_tb2f2k$_0=t.myLabelFormatter_8be2vx$,e.mapper_ohg8eh$_0=t.myMapper_8be2vx$,e.multiplicativeExpand=t.myMultiplicativeExpand_8be2vx$,e.additiveExpand=t.myAdditiveExpand_8be2vx$,e}function Ed(){}function Cd(){this.continuousTransform_0=null,this.customBreaksGenerator_0=null,this.isContinuous_r02bms$_0=!1,this.isContinuousDomain_cs93sw$_0=!0,this.continuousDomainLimits=null}function Sd(t){wd.call(this,t),this.myContinuousTransform=t.continuousTransform_0,this.myCustomBreaksGenerator=t.customBreaksGenerator_0,this.myLowerLimit=t.continuousDomainLimits.first,this.myUpperLimit=t.continuousDomainLimits.second,this.myContinuousOutput=t.isContinuous}function Td(t,e,n,i){return xd(t,e,void 0,i=i||Object.create(Cd.prototype)),Cd.call(i),i.isContinuous_r02bms$_0=n,i.continuousDomainLimits=new de(Q.NEGATIVE_INFINITY,Q.POSITIVE_INFINITY),i.continuousTransform_0=zm().IDENTITY,i.customBreaksGenerator_0=null,i.multiplicativeExpand=.05,i.additiveExpand=0,i}function Od(){this.discreteTransform_0=null}function Nd(t){wd.call(this,t),this.myDomainValues_8be2vx$=t.discreteTransform_0.domainValues,this.myDomainLimits_8be2vx$=t.discreteTransform_0.domainLimits}function Pd(t,e,n,i){return i=i||Object.create(Od.prototype),xd(t,n,$e(e),i),Od.call(i),i.discreteTransform_0=new Li(e,$()),i.multiplicativeExpand=0,i.additiveExpand=.6,i}function Ad(){jd=this}ld.prototype.buildComponent=function(){},ud.prototype.set_11rb$=function(t){this.this$TextLabel.myText_0.fillColor(),this.this$TextLabel.myTextColor_0=t,this.this$TextLabel.updateStyleAttribute_0()},ud.$metadata$={kind:h,interfaces:[Qt]},ld.prototype.textColor=function(){return new ud(this)},ld.prototype.textOpacity=function(){return this.myText_0.fillOpacity()},ld.prototype.x=function(){return this.myText_0.x()},ld.prototype.y=function(){return this.myText_0.y()},ld.prototype.setHorizontalAnchor_ja80zo$=function(t){this.myText_0.setAttribute_jyasbz$(st.SvgConstants.SVG_TEXT_ANCHOR_ATTRIBUTE,this.toTextAnchor_0(t))},ld.prototype.setVerticalAnchor_yaudma$=function(t){this.myText_0.setAttribute_jyasbz$(st.SvgConstants.SVG_TEXT_DY_ATTRIBUTE,this.toDY_0(t))},ld.prototype.setFontSize_14dthe$=function(t){this.myFontSize_0=t,this.updateStyleAttribute_0()},ld.prototype.setFontWeight_pdl1vj$=function(t){this.myFontWeight_0=t,this.updateStyleAttribute_0()},ld.prototype.setFontStyle_pdl1vj$=function(t){this.myFontStyle_0=t,this.updateStyleAttribute_0()},ld.prototype.setFontFamily_pdl1vj$=function(t){this.myFontFamily_0=t,this.updateStyleAttribute_0()},ld.prototype.updateStyleAttribute_0=function(){var t=m();if(null!=this.myTextColor_0&&t.append_pdl1vj$("fill:").append_pdl1vj$(y(this.myTextColor_0).toHexColor()).append_s8itvh$(59),this.myFontSize_0>0&&null!=this.myFontFamily_0){var e=m(),n=this.myFontStyle_0;null!=n&&0!==n.length&&e.append_pdl1vj$(y(this.myFontStyle_0)).append_s8itvh$(32);var i=this.myFontWeight_0;null!=i&&0!==i.length&&e.append_pdl1vj$(y(this.myFontWeight_0)).append_s8itvh$(32),e.append_s8jyv4$(this.myFontSize_0).append_pdl1vj$("px "),e.append_pdl1vj$(y(this.myFontFamily_0)).append_pdl1vj$(";"),t.append_pdl1vj$("font:").append_gw00v9$(e)}else{var r=this.myFontStyle_0;null==r||pe(r)||t.append_pdl1vj$("font-style:").append_pdl1vj$(y(this.myFontStyle_0)).append_s8itvh$(59);var o=this.myFontWeight_0;null!=o&&0!==o.length&&t.append_pdl1vj$("font-weight:").append_pdl1vj$(y(this.myFontWeight_0)).append_s8itvh$(59),this.myFontSize_0>0&&t.append_pdl1vj$("font-size:").append_s8jyv4$(this.myFontSize_0).append_pdl1vj$("px;");var a=this.myFontFamily_0;null!=a&&0!==a.length&&t.append_pdl1vj$("font-family:").append_pdl1vj$(y(this.myFontFamily_0)).append_s8itvh$(59)}this.myText_0.setAttribute_jyasbz$(st.SvgConstants.SVG_STYLE_ATTRIBUTE,t.toString())},ld.prototype.toTextAnchor_0=function(t){var n;switch(t.name){case"LEFT":n=null;break;case"MIDDLE":n=st.SvgConstants.SVG_TEXT_ANCHOR_MIDDLE;break;case"RIGHT":n=st.SvgConstants.SVG_TEXT_ANCHOR_END;break;default:n=e.noWhenBranchMatched()}return n},ld.prototype.toDominantBaseline_0=function(t){var n;switch(t.name){case"TOP":n="hanging";break;case"CENTER":n="central";break;case"BOTTOM":n=null;break;default:n=e.noWhenBranchMatched()}return n},ld.prototype.toDY_0=function(t){var n;switch(t.name){case"TOP":n=st.SvgConstants.SVG_TEXT_DY_TOP;break;case"CENTER":n=st.SvgConstants.SVG_TEXT_DY_CENTER;break;case"BOTTOM":n=null;break;default:n=e.noWhenBranchMatched()}return n},cd.$metadata$={kind:h,simpleName:"HorizontalAnchor",interfaces:[w]},cd.values=function(){return[hd(),_d(),fd()]},cd.valueOf_61zpoe$=function(t){switch(t){case"LEFT":return hd();case"RIGHT":return _d();case"MIDDLE":return fd();default:x("No enum constant jetbrains.datalore.plot.base.render.svg.TextLabel.HorizontalAnchor."+t)}},dd.$metadata$={kind:h,simpleName:"VerticalAnchor",interfaces:[w]},dd.values=function(){return[yd(),$d(),vd()]},dd.valueOf_61zpoe$=function(t){switch(t){case"TOP":return yd();case"BOTTOM":return $d();case"CENTER":return vd();default:x("No enum constant jetbrains.datalore.plot.base.render.svg.TextLabel.VerticalAnchor."+t)}},ld.$metadata$={kind:h,simpleName:"TextLabel",interfaces:[Yf]},Object.defineProperty(gd.prototype,"name",{configurable:!0,get:function(){return this.name_iafnnl$_0}}),Object.defineProperty(gd.prototype,"mapper",{configurable:!0,get:function(){return this.mapper_ohg8eh$_0}}),Object.defineProperty(gd.prototype,"multiplicativeExpand",{configurable:!0,get:function(){return this.multiplicativeExpand_lxi716$_0},set:function(t){this.multiplicativeExpand_lxi716$_0=t}}),Object.defineProperty(gd.prototype,"additiveExpand",{configurable:!0,get:function(){return this.additiveExpand_59ok4k$_0},set:function(t){this.additiveExpand_59ok4k$_0=t}}),Object.defineProperty(gd.prototype,"labelFormatter",{configurable:!0,get:function(){return this.labelFormatter_tb2f2k$_0}}),Object.defineProperty(gd.prototype,"isContinuous",{configurable:!0,get:function(){return!1}}),Object.defineProperty(gd.prototype,"isContinuousDomain",{configurable:!0,get:function(){return!1}}),gd.prototype.hasBreaks=function(){return null!=this.definedBreaks_0},gd.prototype.getBreaksIntern=function(){var t;if(!this.hasBreaks()){var n="No breaks defined for scale "+this.name;throw q(n.toString())}return e.isType(t=this.definedBreaks_0,u)?t:s()},gd.prototype.getLabelsIntern=function(){if(null==this.definedLabels_0){var t="No labels defined for scale "+this.name;throw q(t.toString())}return this.definedLabels_0},gd.prototype.applyTransform_yzw12z$=function(t,n){var i,r=t;if(n&&this.hasDomainLimits()){var o,a=r,l=K(V(a,10));for(o=a.iterator();o.hasNext();){var u=o.next();l.add_11rb$(null==u||this.isInDomainLimits_za3rmp$(u)?u:null)}r=l}if(e.isType(this.transform,Tn)){var c=e.isType(i=this.transform,Tn)?i:s();if(c.hasDomainLimits()){var p,h=r,_=K(V(h,10));for(p=h.iterator();p.hasNext();){var f,d=p.next();_.add_11rb$(c.isInDomain_yrwdxb$(null==(f=d)||"number"==typeof f?f:s())?d:null)}r=_}}return this.transform.apply_9ma18$(r)},gd.prototype.getScaleBreaks=function(){if(!this.hasBreaks())return Hd().EMPTY;var t,e,n=this.getBreaksIntern(),i=this.getLabels_0(n),r=this.applyTransform_yzw12z$(n,!1),o=K(V(r,10)),a=0;for(t=r.iterator();t.hasNext();){var s=t.next(),l=o.add_11rb$,u=_e((a=(e=a)+1|0,e));l.call(o,null==s?null:u)}var p,h,_=A(he(o)),f=c(),d=0;for(p=n.iterator();p.hasNext();){var m=p.next();_.contains_11rb$(_e((d=(h=d)+1|0,h)))&&f.add_11rb$(m)}var y,$,v=he(r),g=c(),b=0;for(y=i.iterator();y.hasNext();){var w=y.next();_.contains_11rb$(_e((b=($=b)+1|0,$)))&&g.add_11rb$(w)}return new Fd(f,v,g)},gd.prototype.getLabels_0=function(t){var e,n;if(null!=this.definedLabels_0){var i=this.getLabelsIntern();if(i.isEmpty()){for(var r=t.size,o=K(r),a=0;a=this.continuousDomainLimits.first&&i<=this.continuousDomainLimits.second}else n=!1;return n},Cd.prototype.hasDomainLimits=function(){return k(this.continuousDomainLimits.first)||k(this.continuousDomainLimits.second)},Cd.prototype.with=function(){return new Sd(this)},Sd.prototype.lowerLimit_14dthe$=function(t){if(!k(t))throw d(("`lower` can't be "+t).toString());return this.myLowerLimit=t,this},Sd.prototype.upperLimit_14dthe$=function(t){if(!k(t))throw d(("`upper` can't be "+t).toString());return this.myUpperLimit=t,this},Sd.prototype.limits_pqjuzw$=function(t){throw d("Can't apply discrete limits to scale with continuous domain")},Sd.prototype.continuousTransform_gxz7zd$=function(t){return this.myContinuousTransform=t,this},Sd.prototype.breaksGenerator_6q5k0b$=function(t){return this.myCustomBreaksGenerator=t,this},Sd.prototype.build=function(){return function(t,e){kd(t,e=e||Object.create(Cd.prototype)),Cd.call(e),e.continuousTransform_0=t.myContinuousTransform,e.customBreaksGenerator_0=t.myCustomBreaksGenerator,e.isContinuous_r02bms$_0=t.myContinuousOutput;var n=b.SeriesUtil.isFinite_yrwdxb$(t.myLowerLimit)?y(t.myLowerLimit):Q.NEGATIVE_INFINITY,i=b.SeriesUtil.isFinite_yrwdxb$(t.myUpperLimit)?y(t.myUpperLimit):Q.POSITIVE_INFINITY;return e.continuousDomainLimits=new de(W.min(n,i),W.max(n,i)),e}(this)},Sd.$metadata$={kind:h,simpleName:"MyBuilder",interfaces:[wd]},Cd.$metadata$={kind:h,simpleName:"ContinuousScale",interfaces:[gd]},Object.defineProperty(Od.prototype,"transform",{configurable:!0,get:function(){return this.discreteTransform_0}}),Od.prototype.getBreaksGenerator=function(){throw q("No breaks generator for discrete scale '"+this.name+"'")},Od.prototype.hasDomainLimits=function(){return this.discreteTransform_0.hasDomainLimits()},Od.prototype.isInDomainLimits_za3rmp$=function(t){return this.discreteTransform_0.isInDomain_s8jyv4$(t)},Od.prototype.getBreaksIntern=function(){var t;if(this.hasDomainLimits()){var e,n=A(gd.prototype.getBreaksIntern.call(this)),i=this.discreteTransform_0.domainLimits,r=c();for(e=i.iterator();e.hasNext();){var o=e.next();n.contains_11rb$(o)&&r.add_11rb$(o)}t=r}else t=gd.prototype.getBreaksIntern.call(this);return t},Od.prototype.getLabelsIntern=function(){var t,e=gd.prototype.getLabelsIntern.call(this);if(!this.hasDomainLimits()||e.isEmpty())t=e;else{var n,i,r=gd.prototype.getBreaksIntern.call(this),o=K(V(r,10)),a=0;for(n=r.iterator();n.hasNext();)n.next(),o.add_11rb$(e.get_za3lpa$(_e((a=(i=a)+1|0,i))%e.size));var s,l=me(E(r,o)),u=this.discreteTransform_0.domainLimits,p=c();for(s=u.iterator();s.hasNext();){var h=s.next();l.containsKey_11rb$(h)&&p.add_11rb$(h)}var _,f=K(V(p,10));for(_=p.iterator();_.hasNext();){var d=_.next();f.add_11rb$(ye(l,d))}t=f}return t},Od.prototype.with=function(){return new Nd(this)},Nd.prototype.breaksGenerator_6q5k0b$=function(t){throw q("Not applicable to scale with discrete domain")},Nd.prototype.lowerLimit_14dthe$=function(t){throw q("Not applicable to scale with discrete domain")},Nd.prototype.upperLimit_14dthe$=function(t){throw q("Not applicable to scale with discrete domain")},Nd.prototype.limits_pqjuzw$=function(t){return this.myDomainLimits_8be2vx$=t,this},Nd.prototype.continuousTransform_gxz7zd$=function(t){return this},Nd.prototype.build=function(){return kd(t=this,e=e||Object.create(Od.prototype)),Od.call(e),e.discreteTransform_0=new Li(t.myDomainValues_8be2vx$,t.myDomainLimits_8be2vx$),e;var t,e},Nd.$metadata$={kind:h,simpleName:"MyBuilder",interfaces:[wd]},Od.$metadata$={kind:h,simpleName:"DiscreteScale",interfaces:[gd]},Ad.prototype.map_rejkqi$=function(t,e){var n=y(e(t.lowerEnd)),i=y(e(t.upperEnd));return new et(W.min(n,i),W.max(n,i))},Ad.prototype.mapDiscreteDomainValuesToNumbers_7f6uoc$=function(t){return this.mapDiscreteDomainValuesToIndices_0(t)},Ad.prototype.mapDiscreteDomainValuesToIndices_0=function(t){var e,n,i=D(),r=0;for(e=t.iterator();e.hasNext();){var o=e.next();if(null!=o&&!i.containsKey_11rb$(o)){var a=(r=(n=r)+1|0,n);i.put_xwzc9p$(o,a)}}return i},Ad.prototype.rangeWithLimitsAfterTransform_1g0x2p$=function(t,n,i,r){var o=null!=n&&k(n)?n:t.lowerEnd;if(!r.isInDomain_yrwdxb$(o)){var a="["+F(e.getKClassFromExpression(r).simpleName)+"] Lower end "+o+" is outside of transform's domain.";throw q(a.toString())}var s=null!=i&&k(i)?i:t.upperEnd;if(!r.isInDomain_yrwdxb$(s)){var l="["+F(e.getKClassFromExpression(r).simpleName)+"] Lower end "+s+" is outside of transform's domain.";throw q(l.toString())}var u=X([o,s]);return et.Companion.encloseAll_17hg47$(r.apply_9ma18$(u))},Ad.$metadata$={kind:p,simpleName:"MapperUtil",interfaces:[]};var jd=null;function Ld(){return null===jd&&new Ad,jd}function Rd(){Bd=this,this.IDENTITY=Md}function Id(t){throw q("Undefined mapper")}function zd(t,e){this.myOutputValues_0=t,this.myDefaultOutputValue_0=e}function Dd(t,e){this.myQuantizer_0=t,this.myDefaultOutputValue_0=e}function Md(t){return t}Rd.prototype.undefined_287e2$=function(){return Id},Rd.prototype.nullable_q9jsah$=function(t,e){return n=e,i=t,function(t){return null==t?n:i(t)};var n,i},Rd.prototype.constant_14dthe$=function(t){return e=t,function(t){return e};var e},Rd.prototype.mul_mdyssk$=function(t,e){var n=e/(t.upperEnd-t.lowerEnd);if(ve(n)||Ot(n))throw q(("Can't create mapper with ratio: "+n).toString());return this.mul_14dthe$(n)},Rd.prototype.mul_14dthe$=function(t){return e=t,function(t){return null!=t?e*t:null};var e},Rd.prototype.linear_1jkouz$=function(t,e,n){return void 0===n&&(n=!1),this.linear_yl4mmw$(t,n?e.upperEnd:e.lowerEnd,n?e.lowerEnd:e.upperEnd,Q.NaN)},Rd.prototype.linear_lww37m$=function(t,e,n){return this.linear_yl4mmw$(t,e.lowerEnd,e.upperEnd,n)},Rd.prototype.linear_yl4mmw$=function(t,e,n,i){var r,o,a,s=(n-e)/(t.upperEnd-t.lowerEnd);if(!b.SeriesUtil.isFinite_14dthe$(s)){var l=(n-e)/2+e;return this.constant_14dthe$(l)}return r=s,o=e-t.lowerEnd*s,a=i,function(t){return b.SeriesUtil.isFinite_yrwdxb$(t)?y(t)*r+o:a}},Rd.prototype.discreteToContinuous_83ntpg$=function(t,e,n){var i,r=Ld().mapDiscreteDomainValuesToNumbers_7f6uoc$(t);if(null==(i=b.SeriesUtil.range_l63ks6$(r.values)))return this.IDENTITY;var o=i;return this.linear_lww37m$(o,e,n)},Rd.prototype.discrete_rath1t$=function(t,e){return n=new zd(t,e),function(t){return n.apply_11rb$(t)};var n},Rd.prototype.quantized_hd8s0$=function(t,e,n){if(null==t)return i=n,function(t){return i};var i,r,o=new im;return o.domain_lu1900$(t.lowerEnd,t.upperEnd),o.range_brywnq$(e),r=new Dd(o,n),function(t){return r.apply_11rb$(t)}},zd.prototype.apply_11rb$=function(t){if(!b.SeriesUtil.isFinite_yrwdxb$(t))return this.myDefaultOutputValue_0;var e=jt(At(y(t)));return(e%=this.myOutputValues_0.size)<0&&(e=e+this.myOutputValues_0.size|0),this.myOutputValues_0.get_za3lpa$(e)},zd.$metadata$={kind:h,simpleName:"DiscreteFun",interfaces:[ot]},Dd.prototype.apply_11rb$=function(t){return b.SeriesUtil.isFinite_yrwdxb$(t)?this.myQuantizer_0.quantize_14dthe$(y(t)):this.myDefaultOutputValue_0},Dd.$metadata$={kind:h,simpleName:"QuantizedFun",interfaces:[ot]},Rd.$metadata$={kind:p,simpleName:"Mappers",interfaces:[]};var Bd=null;function Ud(){return null===Bd&&new Rd,Bd}function Fd(t,e,n){if(Hd(),this.domainValues=t,this.transformedValues=e,this.labels=n,this.domainValues.size!==this.transformedValues.size){var i="Scale breaks size: "+this.domainValues.size+" transformed size: "+this.transformedValues.size+" but expected to be the same";throw d(i.toString())}if(this.domainValues.size!==this.labels.size){var r="Scale breaks size: "+this.domainValues.size+" labels size: "+this.labels.size+" but expected to be the same";throw d(r.toString())}}function qd(){Gd=this,this.EMPTY=new Fd($(),$(),$())}Object.defineProperty(Fd.prototype,"isEmpty",{configurable:!0,get:function(){return this.domainValues.isEmpty()}}),Object.defineProperty(Fd.prototype,"size",{configurable:!0,get:function(){return this.domainValues.size}}),qd.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var Gd=null;function Hd(){return null===Gd&&new qd,Gd}function Yd(){Vd=this}Fd.$metadata$={kind:h,simpleName:"ScaleBreaks",interfaces:[]},Yd.prototype.labelByBreak_x4zrm4$=function(t){var e=t.getScaleBreaks();return me(E(e.domainValues,e.labels))},Yd.prototype.map_dp4lfi$=function(t,e){return Ld().map_rejkqi$(t,e.mapper)},Yd.prototype.map_9ksyxk$=function(t,e){var n,i=e.mapper,r=K(V(t,10));for(n=t.iterator();n.hasNext();){var o=n.next();r.add_11rb$(i(o))}return r},Yd.prototype.inverseTransformToContinuousDomain_codrxm$=function(t,n){var i;if(!n.isContinuousDomain)throw q(("Not continuous numeric domain: "+n).toString());return(e.isType(i=n.transform,Tn)?i:s()).applyInverse_k9kaly$(t)},Yd.prototype.inverseTransform_codrxm$=function(t,n){var i,r=n.transform;if(e.isType(r,Tn))i=r.applyInverse_k9kaly$(t);else{var o,a=K(V(t,10));for(o=t.iterator();o.hasNext();){var s=o.next();a.add_11rb$(r.applyInverse_yrwdxb$(s))}i=a}return i},Yd.prototype.transformedDefinedLimits_x4zrm4$=function(t){var n;e.isType(t,Cd)||s();var i=t.continuousDomainLimits,r=i.component1(),o=i.component2(),a=e.isType(n=t.transform,Tn)?n:s(),l=new de(a.isInDomain_yrwdxb$(r)?y(a.apply_yrwdxb$(r)):Q.NaN,a.isInDomain_yrwdxb$(o)?y(a.apply_yrwdxb$(o)):Q.NaN),u=l.component1(),c=l.component2();return b.SeriesUtil.allFinite_jma9l8$(u,c)?new de(W.min(u,c),W.max(u,c)):new de(u,c)},Yd.$metadata$={kind:p,simpleName:"ScaleUtil",interfaces:[]};var Vd=null;function Kd(){Wd=this}Kd.prototype.continuousDomain_sqn2xl$=function(t,e){return Td(t,Ud().undefined_287e2$(),e.isNumeric)},Kd.prototype.continuousDomainNumericRange_61zpoe$=function(t){return Td(t,Ud().undefined_287e2$(),!0)},Kd.prototype.continuousDomain_lo18em$=function(t,e,n){return Td(t,e,n)},Kd.prototype.discreteDomain_uksd38$=function(t,e){return this.discreteDomain_l9mre7$(t,e,Ud().undefined_287e2$())},Kd.prototype.discreteDomain_l9mre7$=function(t,e,n){return Pd(t,e,n)},Kd.prototype.pureDiscrete_kiqtr1$=function(t,e,n,i){return this.discreteDomain_uksd38$(t,e).with().mapper_1uitho$(Ud().discrete_rath1t$(n,i)).build()},Kd.$metadata$={kind:p,simpleName:"Scales",interfaces:[]};var Wd=null;function Xd(t,e,n){if(this.normalStart=0,this.normalEnd=0,this.span=0,this.targetStep=0,this.isReversed=!1,!k(t))throw d(("range start "+t).toString());if(!k(e))throw d(("range end "+e).toString());if(!(n>0))throw d(("'count' must be positive: "+n).toString());var i=e-t,r=!1;i<0&&(i=-i,r=!0),this.span=i,this.targetStep=this.span/n,this.isReversed=r,this.normalStart=r?e:t,this.normalEnd=r?t:e}function Zd(t,e,n,i){var r;void 0===i&&(i=null),Xd.call(this,t,e,n),this.breaks_n95hiz$_0=null,this.formatter=null;var o=this.targetStep;if(o<1e3)this.formatter=new am(i).getFormatter_14dthe$(o),this.breaks_n95hiz$_0=new Jd(t,e,n).breaks;else{var a=this.normalStart,s=this.normalEnd,l=null;if(null!=i&&(l=ge(i.range_lu1900$(a,s))),null!=l&&l.size<=n)this.formatter=y(i).tickFormatter;else if(o>be.Companion.MS){this.formatter=be.Companion.TICK_FORMATTER,l=c();var u=we.TimeUtil.asDateTimeUTC_14dthe$(a),p=u.year;for(u.isAfter_amwj4p$(we.TimeUtil.yearStart_za3lpa$(p))&&(p=p+1|0),r=new Jd(p,we.TimeUtil.asDateTimeUTC_14dthe$(s).year,n).breaks.iterator();r.hasNext();){var h=r.next(),_=we.TimeUtil.yearStart_za3lpa$(jt(At(h)));l.add_11rb$(we.TimeUtil.asInstantUTC_amwj4p$(_).toNumber())}}else{var f=xe.NiceTimeInterval.forMillis_14dthe$(o);this.formatter=f.tickFormatter,l=ge(f.range_lu1900$(a,s))}this.isReversed&&vt(l),this.breaks_n95hiz$_0=l}}function Jd(t,e,n,i){var r,o;if(em(),void 0===i&&(i=!1),Xd.call(this,t,e,n),this.breaks_egvm9d$_0=null,!(n>0))throw q(("Can't compute breaks for count: "+n).toString());var a=i?this.targetStep:em().computeNiceStep_0(this.span,n);if(i){var s,l=ke(0,n),u=K(V(l,10));for(s=l.iterator();s.hasNext();){var c=s.next();u.add_11rb$(this.normalStart+a/2+c*a)}r=u}else r=em().computeNiceBreaks_0(this.normalStart,this.normalEnd,a);var p=r;o=p.isEmpty()?Ee(this.normalStart):this.isReversed?Ce(p):p,this.breaks_egvm9d$_0=o}function Qd(){tm=this}Xd.$metadata$={kind:h,simpleName:"BreaksHelperBase",interfaces:[]},Object.defineProperty(Zd.prototype,"breaks",{configurable:!0,get:function(){return this.breaks_n95hiz$_0}}),Zd.$metadata$={kind:h,simpleName:"DateTimeBreaksHelper",interfaces:[Xd]},Object.defineProperty(Jd.prototype,"breaks",{configurable:!0,get:function(){return this.breaks_egvm9d$_0}}),Qd.prototype.computeNiceStep_0=function(t,e){var n=t/e,i=W.log10(n),r=W.floor(i),o=W.pow(10,r),a=o*e/t;return a<=.15?10*o:a<=.35?5*o:a<=.75?2*o:o},Qd.prototype.computeNiceBreaks_0=function(t,e,n){if(0===n)return $();var i=n/1e4,r=t-i,o=e+i,a=c(),s=r/n,l=W.ceil(s)*n;for(t>=0&&r<0&&(l=0);l<=o;){var u=l;l=W.min(u,e),a.add_11rb$(l),l+=n}return a},Qd.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var tm=null;function em(){return null===tm&&new Qd,tm}function nm(t,e,n){this.formatter_0=null;var i=0===t?10*Q.MIN_VALUE:W.abs(t),r=0===e?i/10:W.abs(e),o="f",a="",s=W.abs(i),l=W.log10(s),u=W.log10(r),c=-u,p=!1;l<0&&u<-4?(p=!0,o="e",c=l-u):l>7&&u>2&&(p=!0,c=l-u),c<0&&(c=0,o="d");var h=c-.001;c=W.ceil(h),p?o=l>0&&n?"s":"e":a=",",this.formatter_0=Se(a+"."+jt(c)+o)}function im(){this.myHasDomain_0=!1,this.myDomainStart_0=0,this.myDomainEnd_0=0,this.myOutputValues_9bxfi2$_0=this.myOutputValues_9bxfi2$_0}function rm(){om=this}Jd.$metadata$={kind:h,simpleName:"LinearBreaksHelper",interfaces:[Xd]},nm.prototype.apply_za3rmp$=function(t){var n;return this.formatter_0.apply_3p81yu$(e.isNumber(n=t)?n:s())},nm.$metadata$={kind:h,simpleName:"NumericBreakFormatter",interfaces:[]},Object.defineProperty(im.prototype,"myOutputValues_0",{configurable:!0,get:function(){return null==this.myOutputValues_9bxfi2$_0?Tt("myOutputValues"):this.myOutputValues_9bxfi2$_0},set:function(t){this.myOutputValues_9bxfi2$_0=t}}),Object.defineProperty(im.prototype,"outputValues",{configurable:!0,get:function(){return this.myOutputValues_0}}),Object.defineProperty(im.prototype,"domainQuantized",{configurable:!0,get:function(){var t;if(this.myDomainStart_0===this.myDomainEnd_0)return Ee(new et(this.myDomainStart_0,this.myDomainEnd_0));var e=c(),n=this.myOutputValues_0.size,i=this.bucketSize_0();t=n-1|0;for(var r=0;r "+e).toString());return this.myHasDomain_0=!0,this.myDomainStart_0=t,this.myDomainEnd_0=e,this},im.prototype.range_brywnq$=function(t){return this.myOutputValues_0=R(t),this},im.prototype.quantize_14dthe$=function(t){var e=this.outputIndex_0(t);return this.myOutputValues_0.get_za3lpa$(e)},im.prototype.outputIndex_0=function(t){if(!this.myHasDomain_0)throw q("Domain not defined.".toString());var e=null!=this.myOutputValues_9bxfi2$_0;if(e&&(e=!this.myOutputValues_0.isEmpty()),!e)throw q("Output values are not defined.".toString());var n=this.bucketSize_0(),i=jt((t-this.myDomainStart_0)/n),r=this.myOutputValues_0.size-1|0,o=W.min(r,i);return W.max(0,o)},im.prototype.getOutputValueIndex_za3rmp$=function(t){return e.isNumber(t)?this.outputIndex_0(fe(t)):-1},im.prototype.getOutputValue_za3rmp$=function(t){return e.isNumber(t)?this.quantize_14dthe$(fe(t)):null},im.prototype.bucketSize_0=function(){return(this.myDomainEnd_0-this.myDomainStart_0)/this.myOutputValues_0.size},im.$metadata$={kind:h,simpleName:"QuantizeScale",interfaces:[sm]},rm.prototype.withBreaks_qt1l9m$=function(t,e,n){var i=t.getBreaksGenerator().generateBreaks_1tlvto$(e,n),r=i.domainValues,o=i.labels;return t.with().breaks_pqjuzw$(r).labels_mhpeer$(o).build()},rm.$metadata$={kind:p,simpleName:"ScaleBreaksUtil",interfaces:[]};var om=null;function am(t){this.minInterval_0=t}function sm(){}function lm(t){void 0===t&&(t=null),this.labelFormatter_0=t}function um(t,e){this.transformFun_vpw6mq$_0=t,this.inverseFun_2rsie$_0=e}function cm(){um.call(this,pm,hm)}function pm(t){return t}function hm(t){return t}function _m(t){mm(),void 0===t&&(t=null),this.formatter_0=t}function fm(){dm=this}am.prototype.getFormatter_14dthe$=function(t){return Te.Formatter.time_61zpoe$(this.formatPattern_0(t))},am.prototype.formatPattern_0=function(t){if(t<1e3)return Oe.Companion.milliseconds_za3lpa$(1).tickFormatPattern;if(null!=this.minInterval_0){var e=100*t;if(100>=this.minInterval_0.range_lu1900$(0,e).size)return this.minInterval_0.tickFormatPattern}return t>be.Companion.MS?be.Companion.TICK_FORMAT:xe.NiceTimeInterval.forMillis_14dthe$(t).tickFormatPattern},am.$metadata$={kind:h,simpleName:"TimeScaleTickFormatterFactory",interfaces:[]},sm.$metadata$={kind:f,simpleName:"WithFiniteOrderedOutput",interfaces:[]},lm.prototype.generateBreaks_1tlvto$=function(t,e){var n,i,r=this.breaksHelper_0(t,e),o=r.breaks,a=null!=(n=this.labelFormatter_0)?n:r.formatter,s=c();for(i=o.iterator();i.hasNext();){var l=i.next();s.add_11rb$(a(l))}return new Fd(o,o,s)},lm.prototype.breaksHelper_0=function(t,e){return new Zd(t.lowerEnd,t.upperEnd,e)},lm.prototype.labelFormatter_1tlvto$=function(t,e){var n;return null!=(n=this.labelFormatter_0)?n:this.breaksHelper_0(t,e).formatter},lm.$metadata$={kind:h,simpleName:"DateTimeBreaksGen",interfaces:[Ed]},um.prototype.apply_yrwdxb$=function(t){return null!=t?this.transformFun_vpw6mq$_0(t):null},um.prototype.apply_9ma18$=function(t){var e,n=this.safeCastToDoubles_9ma18$(t),i=K(V(n,10));for(e=n.iterator();e.hasNext();){var r=e.next();i.add_11rb$(this.apply_yrwdxb$(r))}return i},um.prototype.applyInverse_yrwdxb$=function(t){return null!=t?this.inverseFun_2rsie$_0(t):null},um.prototype.applyInverse_k9kaly$=function(t){var e,n=K(V(t,10));for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(this.applyInverse_yrwdxb$(i))}return n},um.prototype.safeCastToDoubles_9ma18$=function(t){var e=b.SeriesUtil.checkedDoubles_9ma18$(t);if(!e.canBeCast())throw d("Not a collections of Double(s)".toString());return e.cast()},um.$metadata$={kind:h,simpleName:"FunTransform",interfaces:[Tn]},cm.prototype.hasDomainLimits=function(){return!1},cm.prototype.isInDomain_yrwdxb$=function(t){return b.SeriesUtil.isFinite_yrwdxb$(t)},cm.prototype.createApplicableDomain_yrwdxb$$default=function(t){if(null==t)return this.createApplicableDomain_yrwdxb$(0);var e=k(t)?t:0;return new et(e-.5,e+.5)},cm.prototype.toApplicableDomain_4fzjta$=function(t){return t},cm.prototype.apply_9ma18$=function(t){return this.safeCastToDoubles_9ma18$(t)},cm.prototype.applyInverse_k9kaly$=function(t){return t},cm.$metadata$={kind:h,simpleName:"IdentityTransform",interfaces:[um]},_m.prototype.generateBreaks_1tlvto$=function(t,e){var n,i,r=mm().generateBreakValues_omwdpb$(t,e),o=null!=(n=this.formatter_0)?n:mm().createFormatter_0(r),a=K(V(r,10));for(i=r.iterator();i.hasNext();){var s=i.next();a.add_11rb$(o(s))}return new Fd(r,r,a)},_m.prototype.labelFormatter_1tlvto$=function(t,e){var n;return null!=(n=this.formatter_0)?n:mm().createFormatter_0(mm().generateBreakValues_omwdpb$(t,e))},fm.prototype.generateBreakValues_omwdpb$=function(t,e){return new Jd(t.lowerEnd,t.upperEnd,e).breaks},fm.prototype.createFormatter_0=function(t){var e,n;if(t.isEmpty())n=new de(0,.5);else{var i=Ne(t),r=W.abs(i),o=Pe(t),a=W.abs(o),s=W.max(r,a);if(1===t.size)e=s/10;else{var l=t.get_za3lpa$(1)-t.get_za3lpa$(0);e=W.abs(l)}n=new de(s,e)}var u=n,c=new nm(u.component1(),u.component2(),!0);return C("apply",function(t,e){return t.apply_za3rmp$(e)}.bind(null,c))},fm.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var dm=null;function mm(){return null===dm&&new fm,dm}function ym(){gm(),um.call(this,bm,wm)}function $m(){vm=this,this.LOWER_LIM_TRANSFOTMED_8be2vx$=-Q.MAX_VALUE/10,this.LOWER_LIM_DOMAIN_8be2vx$=10*Q.MIN_VALUE}_m.$metadata$={kind:h,simpleName:"LinearBreaksGen",interfaces:[Ed]},ym.prototype.hasDomainLimits=function(){return!0},ym.prototype.isInDomain_yrwdxb$=function(t){return b.SeriesUtil.isFinite_yrwdxb$(t)&&y(t)>=gm().LOWER_LIM_DOMAIN_8be2vx$},ym.prototype.isZero_0=function(t){return b.SeriesUtil.isFinite_yrwdxb$(t)&&y(t)>=0&&t=0},Pm.prototype.createApplicableDomain_yrwdxb$$default=function(t){var e;if(this.isInDomain_yrwdxb$(t)){var n=y(t);e=W.max(n,0)}else e=1;var i=e,r=i-.5;return new et(W.max(r,0),i+.5)},Pm.prototype.toApplicableDomain_4fzjta$=function(t){var e=t.lowerEnd,n=W.max(e,0),i=t.upperEnd,r=W.max(i,0);return new et(n,r)},Pm.$metadata$={kind:h,simpleName:"SqrtTransform",interfaces:[um]},Lm.prototype.createBreaksGeneratorForTransformedDomain_5x42z5$=function(t,n){var i;if(void 0===n&&(n=null),l(t,this.IDENTITY))i=new _m(n);else if(l(t,this.REVERSE))i=new _m(n);else if(l(t,this.SQRT))i=new xm(this.SQRT,n);else{if(!l(t,this.LOG10))throw q("Unexpected 'transform' type: "+F(e.getKClassFromExpression(t).simpleName));i=new xm(this.LOG10,n)}return new Rm(t,i)},Lm.prototype.ensureApplicableDomain_wa8y5m$=function(t,e){if(null==t)return e.createApplicableDomain_yrwdxb$();var n=e.toApplicableDomain_4fzjta$(t);return b.SeriesUtil.isSubTiny_4fzjta$(n)?e.createApplicableDomain_yrwdxb$(n.upperEnd):n},Rm.prototype.labelFormatter_1tlvto$=function(t,e){var n,i=Ld().map_rejkqi$(t,(n=this,function(t){return n.transform_0.applyInverse_yrwdxb$(t)}));return this.breaksGenerator.labelFormatter_1tlvto$(i,e)},Rm.prototype.generateBreaks_1tlvto$=function(t,e){var n,i,r=Ld().map_rejkqi$(t,(i=this,function(t){return i.transform_0.applyInverse_yrwdxb$(t)})),o=this.breaksGenerator.generateBreaks_1tlvto$(r,e),a=o.domainValues,l=this.transform_0.apply_9ma18$(a),u=K(V(l,10));for(n=l.iterator();n.hasNext();){var c,p=n.next();u.add_11rb$("number"==typeof(c=p)?c:s())}return new Fd(a,u,o.labels)},Rm.$metadata$={kind:h,simpleName:"BreaksGeneratorForTransformedDomain",interfaces:[Ed]},Lm.$metadata$={kind:p,simpleName:"Transforms",interfaces:[]};var Im=null;function zm(){return null===Im&&new Lm,Im}function Dm(t,e,n,i,r,o,a,s,l,u){if(Um(),Fm.call(this,Um().DEF_MAPPING_0),this.bandWidthX_pmqi0t$_0=t,this.bandWidthY_pmqi1o$_0=e,this.bandWidthMethod_3lcf4y$_0=n,this.adjust=i,this.kernel_ba223r$_0=r,this.nX=o,this.nY=a,this.isContour=s,this.binCount_6z2ebo$_0=l,this.binWidth_2e8jdx$_0=u,this.kernelFun=yv().kernel_uyf859$(this.kernel_ba223r$_0),this.binOptions=new cy(this.binCount_6z2ebo$_0,this.binWidth_2e8jdx$_0),!(this.nX<=999)){var c="The input nX = "+this.nX+" > 999 is too large!";throw d(c.toString())}if(!(this.nY<=999)){var p="The input nY = "+this.nY+" > 999 is too large!";throw d(p.toString())}}function Mm(){Bm=this,this.DEF_KERNEL=q$(),this.DEF_ADJUST=1,this.DEF_N=100,this.DEF_BW=J$(),this.DEF_CONTOUR=!0,this.DEF_BIN_COUNT=10,this.DEF_BIN_WIDTH=0,this.DEF_MAPPING_0=Bt([Mt(Cn().X,Rv().X),Mt(Cn().Y,Rv().Y)]),this.MAX_N_0=999}Dm.prototype.getBandWidthX_k9kaly$=function(t){var e;return null!=(e=this.bandWidthX_pmqi0t$_0)?e:yv().bandWidth_whucba$(this.bandWidthMethod_3lcf4y$_0,t)},Dm.prototype.getBandWidthY_k9kaly$=function(t){var e;return null!=(e=this.bandWidthY_pmqi1o$_0)?e:yv().bandWidth_whucba$(this.bandWidthMethod_3lcf4y$_0,t)},Dm.prototype.consumes=function(){return X([Cn().X,Cn().Y,Cn().WEIGHT])},Dm.prototype.apply_kdy6bf$$default=function(t,e,n){throw q("'density2d' statistic can't be executed on the client side")},Mm.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var Bm=null;function Um(){return null===Bm&&new Mm,Bm}function Fm(t){this.defaultMappings_lvkmi1$_0=t}function qm(t,e,n,i,r){Wm(),void 0===t&&(t=30),void 0===e&&(e=30),void 0===n&&(n=Wm().DEF_BINWIDTH),void 0===i&&(i=Wm().DEF_BINWIDTH),void 0===r&&(r=Wm().DEF_DROP),Fm.call(this,Wm().DEF_MAPPING_0),this.drop_0=r,this.binOptionsX_0=new cy(t,n),this.binOptionsY_0=new cy(e,i)}function Gm(){Km=this,this.DEF_BINS=30,this.DEF_BINWIDTH=null,this.DEF_DROP=!0,this.DEF_MAPPING_0=Bt([Mt(Cn().X,Rv().X),Mt(Cn().Y,Rv().Y),Mt(Cn().FILL,Rv().COUNT)])}Dm.$metadata$={kind:h,simpleName:"AbstractDensity2dStat",interfaces:[Fm]},Fm.prototype.hasDefaultMapping_896ixz$=function(t){return this.defaultMappings_lvkmi1$_0.containsKey_11rb$(t)},Fm.prototype.getDefaultMapping_896ixz$=function(t){if(this.defaultMappings_lvkmi1$_0.containsKey_11rb$(t))return y(this.defaultMappings_lvkmi1$_0.get_11rb$(t));throw d("Stat "+e.getKClassFromExpression(this).simpleName+" has no default mapping for aes: "+F(t))},Fm.prototype.hasRequiredValues_xht41f$=function(t,e){var n;for(n=0;n!==e.length;++n){var i=e[n],r=$o().forAes_896ixz$(i);if(t.hasNoOrEmpty_8xm3sj$(r))return!1}return!0},Fm.prototype.withEmptyStatValues=function(){var t,e=Pi();for(t=Cn().values().iterator();t.hasNext();){var n=t.next();this.hasDefaultMapping_896ixz$(n)&&e.put_2l962d$(this.getDefaultMapping_896ixz$(n),$())}return e.build()},Fm.$metadata$={kind:h,simpleName:"BaseStat",interfaces:[kr]},qm.prototype.consumes=function(){return X([Cn().X,Cn().Y,Cn().WEIGHT])},qm.prototype.apply_kdy6bf$$default=function(t,n,i){if(!this.hasRequiredValues_xht41f$(t,[Cn().X,Cn().Y]))return this.withEmptyStatValues();var r=n.overallXRange(),o=n.overallYRange();if(null==r||null==o)return this.withEmptyStatValues();var a=Wm().adjustRangeInitial_0(r),s=Wm().adjustRangeInitial_0(o),l=fy().binCountAndWidth_11nzti$(b.SeriesUtil.span_4fzjta$(a),this.binOptionsX_0),u=fy().binCountAndWidth_11nzti$(b.SeriesUtil.span_4fzjta$(s),this.binOptionsY_0),c=Wm().adjustRangeFinal_0(r,l.width),p=Wm().adjustRangeFinal_0(o,u.width),h=fy().binCountAndWidth_11nzti$(b.SeriesUtil.span_4fzjta$(c),this.binOptionsX_0),_=fy().binCountAndWidth_11nzti$(b.SeriesUtil.span_4fzjta$(p),this.binOptionsY_0),f=e.imul(h.count,_.count),d=Wm().densityNormalizingFactor_0(b.SeriesUtil.span_4fzjta$(c),b.SeriesUtil.span_4fzjta$(p),f),m=this.computeBins_0(t.getNumeric_8xm3sj$($o().X),t.getNumeric_8xm3sj$($o().Y),c.lowerEnd,p.lowerEnd,h.count,_.count,h.width,_.width,fy().weightAtIndex_dhhkv7$(t),d);return Pi().putNumeric_s1rqo9$(Rv().X,m.x_8be2vx$).putNumeric_s1rqo9$(Rv().Y,m.y_8be2vx$).putNumeric_s1rqo9$(Rv().COUNT,m.count_8be2vx$).putNumeric_s1rqo9$(Rv().DENSITY,m.density_8be2vx$).build()},qm.prototype.computeBins_0=function(t,e,n,i,r,o,a,s,l,u){for(var p=0,h=I(),_=0;_!==t.size;++_){var f=t.get_za3lpa$(_),d=e.get_za3lpa$(_);if(b.SeriesUtil.allFinite_jma9l8$(f,d)){var m=l(_);p+=m;var $=(y(f)-n)/a,v=jt(W.floor($)),g=(y(d)-i)/s,w=jt(W.floor(g)),x=new de(v,w);if(!h.containsKey_11rb$(x)){var k=new Cb(0);h.put_xwzc9p$(x,k)}y(h.get_11rb$(x)).getAndAdd_14dthe$(m)}}for(var E=c(),C=c(),S=c(),T=c(),O=n+a/2,N=i+s/2,P=0;P0?1/d:1,$=fy().computeBins_3oz8yg$(n,i,a,s,fy().weightAtIndex_dhhkv7$(t),m);if($.x_8be2vx$.size!==a){var v="Internal: stat data size="+F($.x_8be2vx$.size)+" expected bin count="+F(a);throw q(v.toString())}return $},Qm.$metadata$={kind:h,simpleName:"XPosKind",interfaces:[w]},Qm.values=function(){return[ey(),ny(),iy()]},Qm.valueOf_61zpoe$=function(t){switch(t){case"NONE":return ey();case"CENTER":return ny();case"BOUNDARY":return iy();default:x("No enum constant jetbrains.datalore.plot.base.stat.BinStat.XPosKind."+t)}},ry.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var oy=null;function ay(){return null===oy&&new ry,oy}function sy(){_y=this,this.MAX_BIN_COUNT_0=500}function ly(t){return function(e){var n=t.get_za3lpa$(e);return b.SeriesUtil.asFinite_z03gcz$(n,0)}}function uy(t){return 1}function cy(t,e){this.binWidth=e;var n=W.max(1,t);this.binCount=W.min(500,n)}function py(t,e){this.count=t,this.width=e}function hy(t,e,n){this.x_8be2vx$=t,this.count_8be2vx$=e,this.density_8be2vx$=n}Jm.$metadata$={kind:h,simpleName:"BinStat",interfaces:[Fm]},sy.prototype.weightAtIndex_dhhkv7$=function(t){return t.has_8xm3sj$($o().WEIGHT)?ly(t.getNumeric_8xm3sj$($o().WEIGHT)):uy},sy.prototype.weightVector_5m8trb$=function(t,e){var n;if(e.has_8xm3sj$($o().WEIGHT))n=e.getNumeric_8xm3sj$($o().WEIGHT);else{for(var i=K(t),r=0;r0},cy.$metadata$={kind:h,simpleName:"BinOptions",interfaces:[]},py.$metadata$={kind:h,simpleName:"CountAndWidth",interfaces:[]},hy.$metadata$={kind:h,simpleName:"BinsData",interfaces:[]},sy.$metadata$={kind:p,simpleName:"BinStatUtil",interfaces:[]};var _y=null;function fy(){return null===_y&&new sy,_y}function dy(t,e){$y(),Fm.call(this,$y().DEF_MAPPING_0),this.whiskerIQRRatio_0=t,this.computeWidth_0=e}function my(){yy=this,this.DEF_WHISKER_IQR_RATIO=1.5,this.DEF_COMPUTE_WIDTH=!1,this.DEF_MAPPING_0=Bt([Mt(Cn().X,Rv().X),Mt(Cn().Y,Rv().Y),Mt(Cn().YMIN,Rv().Y_MIN),Mt(Cn().YMAX,Rv().Y_MAX),Mt(Cn().LOWER,Rv().LOWER),Mt(Cn().MIDDLE,Rv().MIDDLE),Mt(Cn().UPPER,Rv().UPPER)])}dy.prototype.hasDefaultMapping_896ixz$=function(t){return Fm.prototype.hasDefaultMapping_896ixz$.call(this,t)||l(t,Cn().WIDTH)&&this.computeWidth_0},dy.prototype.getDefaultMapping_896ixz$=function(t){return l(t,Cn().WIDTH)?Rv().WIDTH:Fm.prototype.getDefaultMapping_896ixz$.call(this,t)},dy.prototype.consumes=function(){return X([Cn().X,Cn().Y])},dy.prototype.apply_kdy6bf$$default=function(t,e,n){var i,r,o,a;if(!this.hasRequiredValues_xht41f$(t,[Cn().Y]))return this.withEmptyStatValues();var s=t.getNumeric_8xm3sj$($o().Y);if(t.has_8xm3sj$($o().X))i=t.getNumeric_8xm3sj$($o().X);else{for(var l=s.size,u=K(l),c=0;c=G&&X<=H&&W.add_11rb$(X)}var Z=W,J=b.SeriesUtil.range_l63ks6$(Z);null!=J&&(Y=J.lowerEnd,V=J.upperEnd)}var tt,et=c();for(tt=R.iterator();tt.hasNext();){var nt=tt.next();(ntH)&&et.add_11rb$(nt)}for(o=et.iterator();o.hasNext();){var it=o.next();k.add_11rb$(L),C.add_11rb$(it),S.add_11rb$(Q.NaN),T.add_11rb$(Q.NaN),O.add_11rb$(Q.NaN),N.add_11rb$(Q.NaN),P.add_11rb$(Q.NaN),A.add_11rb$(z)}k.add_11rb$(L),C.add_11rb$(Q.NaN),S.add_11rb$(B),T.add_11rb$(U),O.add_11rb$(F),N.add_11rb$(Y),P.add_11rb$(V),A.add_11rb$(z)}return Re([Mt(Rv().X,k),Mt(Rv().Y,C),Mt(Rv().MIDDLE,S),Mt(Rv().LOWER,T),Mt(Rv().UPPER,O),Mt(Rv().Y_MIN,N),Mt(Rv().Y_MAX,P),Mt(Rv().COUNT,A)])},my.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var yy=null;function $y(){return null===yy&&new my,yy}function vy(){Cy(),this.myContourX_0=c(),this.myContourY_0=c(),this.myContourLevel_0=c(),this.myContourGroup_0=c(),this.myGroup_0=0}function gy(){Ey=this}dy.$metadata$={kind:h,simpleName:"BoxplotStat",interfaces:[Fm]},Object.defineProperty(vy.prototype,"dataFrame_0",{configurable:!0,get:function(){return Pi().putNumeric_s1rqo9$(Rv().X,this.myContourX_0).putNumeric_s1rqo9$(Rv().Y,this.myContourY_0).putNumeric_s1rqo9$(Rv().LEVEL,this.myContourLevel_0).putNumeric_s1rqo9$(Rv().GROUP,this.myContourGroup_0).build()}}),vy.prototype.add_e7h60q$=function(t,e){var n;for(n=t.iterator();n.hasNext();){var i=n.next();this.myContourX_0.add_11rb$(i.x),this.myContourY_0.add_11rb$(i.y),this.myContourLevel_0.add_11rb$(e),this.myContourGroup_0.add_11rb$(this.myGroup_0)}this.myGroup_0+=1},gy.prototype.getPathDataFrame_9s3d7f$=function(t,e){var n,i,r=new vy;for(n=t.iterator();n.hasNext();){var o=n.next();for(i=y(e.get_11rb$(o)).iterator();i.hasNext();){var a=i.next();r.add_e7h60q$(a,o)}}return r.dataFrame_0},gy.prototype.getPolygonDataFrame_dnsuee$=function(t,e){var n,i=new vy;for(n=t.iterator();n.hasNext();){var r=n.next(),o=y(e.get_11rb$(r));i.add_e7h60q$(o,r)}return i.dataFrame_0},gy.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var by,wy,xy,ky,Ey=null;function Cy(){return null===Ey&&new gy,Ey}function Sy(t,e){By(),this.myLowLeft_0=null,this.myLowRight_0=null,this.myUpLeft_0=null,this.myUpRight_0=null;var n=t.lowerEnd,i=t.upperEnd,r=e.lowerEnd,o=e.upperEnd;this.myLowLeft_0=new lt(n,r),this.myLowRight_0=new lt(i,r),this.myUpLeft_0=new lt(n,o),this.myUpRight_0=new lt(i,o)}function Ty(t,n){return e.compareTo(t.x,n.x)}function Oy(t,n){return e.compareTo(t.y,n.y)}function Ny(t,n){return e.compareTo(n.x,t.x)}function Py(t,n){return e.compareTo(n.y,t.y)}function Ay(t,e){w.call(this),this.name$=t,this.ordinal$=e}function jy(){jy=function(){},by=new Ay("DOWN",0),wy=new Ay("RIGHT",1),xy=new Ay("UP",2),ky=new Ay("LEFT",3)}function Ly(){return jy(),by}function Ry(){return jy(),wy}function Iy(){return jy(),xy}function zy(){return jy(),ky}function Dy(){My=this}vy.$metadata$={kind:h,simpleName:"Contour",interfaces:[]},Sy.prototype.createPolygons_lrt0be$=function(t,e,n){var i,r,o,a=I(),s=c();for(i=t.values.iterator();i.hasNext();){var l=i.next();s.addAll_brywnq$(l)}var u=c(),p=this.createOuterMap_0(s,u),h=t.keys.size;r=h+1|0;for(var _=0;_0&&f.addAll_brywnq$(By().reverseAll_0(y(t.get_11rb$(e.get_za3lpa$(_-1|0))))),_=0},Dy.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var My=null;function By(){return null===My&&new Dy,My}function Uy(t,e){Gy(),Fm.call(this,Gy().DEF_MAPPING_0),this.myBinOptions_0=new cy(t,e)}function Fy(){qy=this,this.DEF_BIN_COUNT=10,this.DEF_MAPPING_0=Bt([Mt(Cn().X,Rv().X),Mt(Cn().Y,Rv().Y)])}Sy.$metadata$={kind:h,simpleName:"ContourFillHelper",interfaces:[]},Uy.prototype.consumes=function(){return X([Cn().X,Cn().Y,Cn().Z])},Uy.prototype.apply_kdy6bf$$default=function(t,e,n){var i;if(!this.hasRequiredValues_xht41f$(t,[Cn().X,Cn().Y,Cn().Z]))return this.withEmptyStatValues();if(null==(i=Wy().computeLevels_wuiwgl$(t,this.myBinOptions_0)))return Ni().emptyFrame();var r=i,o=Wy().computeContours_jco5dt$(t,r);return Cy().getPathDataFrame_9s3d7f$(r,o)},Fy.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var qy=null;function Gy(){return null===qy&&new Fy,qy}function Hy(){Ky=this,this.xLoc_0=new Float64Array([0,1,1,0,.5]),this.yLoc_0=new Float64Array([0,0,1,1,.5])}function Yy(t,e,n){this.z=n,this.myX=0,this.myY=0,this.myIsCenter_0=0,this.myX=jt(t),this.myY=jt(e),this.myIsCenter_0=t%1==0?0:1}function Vy(t,e){this.myA=t,this.myB=e}Uy.$metadata$={kind:h,simpleName:"ContourStat",interfaces:[Fm]},Hy.prototype.estimateRegularGridShape_fsp013$=function(t){var e,n=0,i=null;for(e=t.iterator();e.hasNext();){var r=e.next();if(null==i)i=r;else if(r==i)break;n=n+1|0}if(n<=1)throw d("Data grid must be at least 2 columns wide (was "+n+")");var o=t.size/n|0;if(o<=1)throw d("Data grid must be at least 2 rows tall (was "+o+")");return new Ht(n,o)},Hy.prototype.computeLevels_wuiwgl$=function(t,e){if(!(t.has_8xm3sj$($o().X)&&t.has_8xm3sj$($o().Y)&&t.has_8xm3sj$($o().Z)))return null;var n=t.range_8xm3sj$($o().Z);return this.computeLevels_kgz263$(n,e)},Hy.prototype.computeLevels_kgz263$=function(t,e){var n;if(null==t||b.SeriesUtil.isSubTiny_4fzjta$(t))return null;var i=fy().binCountAndWidth_11nzti$(b.SeriesUtil.span_4fzjta$(t),e),r=c();n=i.count;for(var o=0;o1&&p.add_11rb$(_)}return p},Hy.prototype.confirmPaths_0=function(t){var e,n,i,r=c(),o=I();for(e=t.iterator();e.hasNext();){var a=e.next(),s=a.get_za3lpa$(0),l=a.get_za3lpa$(a.size-1|0);if(null!=s&&s.equals(l))r.add_11rb$(a);else if(o.containsKey_11rb$(s)||o.containsKey_11rb$(l)){var u=o.get_11rb$(s),p=o.get_11rb$(l);this.removePathByEndpoints_ebaanh$(u,o),this.removePathByEndpoints_ebaanh$(p,o);var h=c();if(u===p){h.addAll_brywnq$(y(u)),h.addAll_brywnq$(a.subList_vux9f0$(1,a.size)),r.add_11rb$(h);continue}null!=u&&null!=p?(h.addAll_brywnq$(u),h.addAll_brywnq$(a.subList_vux9f0$(1,a.size-1|0)),h.addAll_brywnq$(p)):null==u?(h.addAll_brywnq$(y(p)),h.addAll_u57x28$(0,a.subList_vux9f0$(0,a.size-1|0))):(h.addAll_brywnq$(u),h.addAll_brywnq$(a.subList_vux9f0$(1,a.size)));var _=h.get_za3lpa$(0);o.put_xwzc9p$(_,h);var f=h.get_za3lpa$(h.size-1|0);o.put_xwzc9p$(f,h)}else{var d=a.get_za3lpa$(0);o.put_xwzc9p$(d,a);var m=a.get_za3lpa$(a.size-1|0);o.put_xwzc9p$(m,a)}}for(n=nt(o.values).iterator();n.hasNext();){var $=n.next();r.add_11rb$($)}var v=c();for(i=r.iterator();i.hasNext();){var g=i.next();v.addAll_brywnq$(this.pathSeparator_0(g))}return v},Hy.prototype.removePathByEndpoints_ebaanh$=function(t,e){null!=t&&(e.remove_11rb$(t.get_za3lpa$(0)),e.remove_11rb$(t.get_za3lpa$(t.size-1|0)))},Hy.prototype.pathSeparator_0=function(t){var e,n,i=c(),r=0;e=t.size-1|0;for(var o=1;om&&r<=$)){var k=this.computeSegmentsForGridCell_0(r,d,u,l);s.addAll_brywnq$(k)}}}return s},Hy.prototype.computeSegmentsForGridCell_0=function(t,e,n,i){for(var r,o=c(),a=c(),s=0;s<=4;s++)a.add_11rb$(new Yy(n+this.xLoc_0[s],i+this.yLoc_0[s],e[s]));for(var l=0;l<=3;l++){var u=(l+1|0)%4;(r=c()).add_11rb$(a.get_za3lpa$(l)),r.add_11rb$(a.get_za3lpa$(u)),r.add_11rb$(a.get_za3lpa$(4));var p=this.intersectionSegment_0(r,t);null!=p&&o.add_11rb$(p)}return o},Hy.prototype.intersectionSegment_0=function(t,e){var n,i;switch((100*t.get_za3lpa$(0).getType_14dthe$(y(e))|0)+(10*t.get_za3lpa$(1).getType_14dthe$(e)|0)+t.get_za3lpa$(2).getType_14dthe$(e)|0){case 100:n=new Vy(t.get_za3lpa$(2),t.get_za3lpa$(0)),i=new Vy(t.get_za3lpa$(0),t.get_za3lpa$(1));break;case 10:n=new Vy(t.get_za3lpa$(0),t.get_za3lpa$(1)),i=new Vy(t.get_za3lpa$(1),t.get_za3lpa$(2));break;case 1:n=new Vy(t.get_za3lpa$(1),t.get_za3lpa$(2)),i=new Vy(t.get_za3lpa$(2),t.get_za3lpa$(0));break;case 110:n=new Vy(t.get_za3lpa$(0),t.get_za3lpa$(2)),i=new Vy(t.get_za3lpa$(2),t.get_za3lpa$(1));break;case 101:n=new Vy(t.get_za3lpa$(2),t.get_za3lpa$(1)),i=new Vy(t.get_za3lpa$(1),t.get_za3lpa$(0));break;case 11:n=new Vy(t.get_za3lpa$(1),t.get_za3lpa$(0)),i=new Vy(t.get_za3lpa$(0),t.get_za3lpa$(2));break;default:return null}return new Ht(n,i)},Hy.prototype.checkEdges_0=function(t,e,n){var i,r;for(i=t.iterator();i.hasNext();){var o=i.next();null!=(r=o.get_za3lpa$(0))&&r.equals(o.get_za3lpa$(o.size-1|0))||(this.checkEdge_0(o.get_za3lpa$(0),e,n),this.checkEdge_0(o.get_za3lpa$(o.size-1|0),e,n))}},Hy.prototype.checkEdge_0=function(t,e,n){var i=t.myA,r=t.myB;if(!(0===i.myX&&0===r.myX||0===i.myY&&0===r.myY||i.myX===(e-1|0)&&r.myX===(e-1|0)||i.myY===(n-1|0)&&r.myY===(n-1|0)))throw d("Check Edge Failed")},Object.defineProperty(Yy.prototype,"coord",{configurable:!0,get:function(){return new lt(this.x,this.y)}}),Object.defineProperty(Yy.prototype,"x",{configurable:!0,get:function(){return this.myX+.5*this.myIsCenter_0}}),Object.defineProperty(Yy.prototype,"y",{configurable:!0,get:function(){return this.myY+.5*this.myIsCenter_0}}),Yy.prototype.equals=function(t){var n,i;if(this===t)return!0;if(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))return!1;var r=null==(i=t)||e.isType(i,Yy)?i:s();return this.myX===y(r).myX&&this.myY===r.myY&&this.myIsCenter_0===r.myIsCenter_0},Yy.prototype.hashCode=function(){return De([this.myX,this.myY,this.myIsCenter_0])},Yy.prototype.getType_14dthe$=function(t){return this.z>=t?1:0},Yy.$metadata$={kind:h,simpleName:"TripleVector",interfaces:[]},Vy.prototype.equals=function(t){var n,i,r,o,a;if(!e.isType(t,Vy))return!1;var l=null==(n=t)||e.isType(n,Vy)?n:s();return(null!=(i=this.myA)?i.equals(y(l).myA):null)&&(null!=(r=this.myB)?r.equals(l.myB):null)||(null!=(o=this.myA)?o.equals(l.myB):null)&&(null!=(a=this.myB)?a.equals(l.myA):null)},Vy.prototype.hashCode=function(){return this.myA.coord.hashCode()+this.myB.coord.hashCode()|0},Vy.prototype.intersect_14dthe$=function(t){var e=this.myA.z,n=this.myB.z;if(t===e)return this.myA.coord;if(t===n)return this.myB.coord;var i=(n-e)/(t-e),r=this.myA.x,o=this.myA.y,a=this.myB.x,s=this.myB.y;return new lt(r+(a-r)/i,o+(s-o)/i)},Vy.$metadata$={kind:h,simpleName:"Edge",interfaces:[]},Hy.$metadata$={kind:p,simpleName:"ContourStatUtil",interfaces:[]};var Ky=null;function Wy(){return null===Ky&&new Hy,Ky}function Xy(t,e){o$(),Fm.call(this,o$().DEF_MAPPING_0),this.myBinOptions_0=new cy(t,e)}function Zy(){r$=this,this.DEF_MAPPING_0=Bt([Mt(Cn().X,Rv().X),Mt(Cn().Y,Rv().Y)])}Xy.prototype.consumes=function(){return X([Cn().X,Cn().Y,Cn().Z])},Xy.prototype.apply_kdy6bf$$default=function(t,e,n){var i;if(!this.hasRequiredValues_xht41f$(t,[Cn().X,Cn().Y,Cn().Z]))return this.withEmptyStatValues();if(null==(i=Wy().computeLevels_wuiwgl$(t,this.myBinOptions_0)))return Ni().emptyFrame();var r=i,o=Wy().computeContours_jco5dt$(t,r),a=y(t.range_8xm3sj$($o().X)),s=y(t.range_8xm3sj$($o().Y)),l=y(t.range_8xm3sj$($o().Z)),u=new Sy(a,s),c=By().computeFillLevels_4v6zbb$(l,r),p=u.createPolygons_lrt0be$(o,r,c);return Cy().getPolygonDataFrame_dnsuee$(c,p)},Zy.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var Jy,Qy,t$,e$,n$,i$,r$=null;function o$(){return null===r$&&new Zy,r$}function a$(t,e,n,i){v$(),Fm.call(this,v$().DEF_MAPPING_0),this.correlationMethod=t,this.type=e,this.fillDiagonal=n,this.threshold=i}function s$(t,e){w.call(this),this.name$=t,this.ordinal$=e}function l$(){l$=function(){},Jy=new s$("PEARSON",0),Qy=new s$("SPEARMAN",1),t$=new s$("KENDALL",2)}function u$(){return l$(),Jy}function c$(){return l$(),Qy}function p$(){return l$(),t$}function h$(t,e){w.call(this),this.name$=t,this.ordinal$=e}function _$(){_$=function(){},e$=new h$("FULL",0),n$=new h$("UPPER",1),i$=new h$("LOWER",2)}function f$(){return _$(),e$}function d$(){return _$(),n$}function m$(){return _$(),i$}function y$(){$$=this,this.DEF_MAPPING_0=Bt([Mt(Cn().X,Rv().X),Mt(Cn().Y,Rv().Y),Mt(Cn().COLOR,Rv().CORR),Mt(Cn().FILL,Rv().CORR),Mt(Cn().LABEL,Rv().CORR)]),this.DEF_CORRELATION_METHOD=u$(),this.DEF_TYPE=f$(),this.DEF_FILL_DIAGONAL=!0,this.DEF_THRESHOLD=0}Xy.$metadata$={kind:h,simpleName:"ContourfStat",interfaces:[Fm]},a$.prototype.apply_kdy6bf$$default=function(t,e,n){if(this.correlationMethod!==u$()){var i="Unsupported correlation method: "+this.correlationMethod+" (only Pearson is currently available)";throw d(i.toString())}if(!Me(0,1).contains_mef7kx$(this.threshold)){var r="Threshold value: "+this.threshold+" must be in interval [0.0, 1.0]";throw d(r.toString())}var o,a=w$().correlationMatrix_ofg6u8$(t,this.type,this.fillDiagonal,C("correlationPearson",(function(t,e){return kg(t,e)})),this.threshold),s=a.getNumeric_8xm3sj$(Rv().CORR),l=K(V(s,10));for(o=s.iterator();o.hasNext();){var u=o.next();l.add_11rb$(null!=u?W.abs(u):null)}var c=l;return a.builder().putNumeric_s1rqo9$(Rv().CORR_ABS,c).build()},a$.prototype.consumes=function(){return $()},s$.$metadata$={kind:h,simpleName:"Method",interfaces:[w]},s$.values=function(){return[u$(),c$(),p$()]},s$.valueOf_61zpoe$=function(t){switch(t){case"PEARSON":return u$();case"SPEARMAN":return c$();case"KENDALL":return p$();default:x("No enum constant jetbrains.datalore.plot.base.stat.CorrelationStat.Method."+t)}},h$.$metadata$={kind:h,simpleName:"Type",interfaces:[w]},h$.values=function(){return[f$(),d$(),m$()]},h$.valueOf_61zpoe$=function(t){switch(t){case"FULL":return f$();case"UPPER":return d$();case"LOWER":return m$();default:x("No enum constant jetbrains.datalore.plot.base.stat.CorrelationStat.Type."+t)}},y$.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var $$=null;function v$(){return null===$$&&new y$,$$}function g$(){b$=this}a$.$metadata$={kind:h,simpleName:"CorrelationStat",interfaces:[Fm]},g$.prototype.correlation_n2j75g$=function(t,e,n){var i=xb(t,e);return n(i.component1(),i.component2())},g$.prototype.createComparator_0=function(t){var e,n=Be(t),i=K(V(n,10));for(e=n.iterator();e.hasNext();){var r=e.next();i.add_11rb$(Mt(r.value.label,r.index))}var o,a=me(i);return new pt((o=a,function(t,e){var n,i;if(null==(n=o.get_11rb$(t)))throw q(("Unknown variable label "+t+".").toString());var r=n;if(null==(i=o.get_11rb$(e)))throw q(("Unknown variable label "+e+".").toString());return r-i|0}))},g$.prototype.correlationMatrix_ofg6u8$=function(t,e,n,i,r){var o,a;void 0===r&&(r=v$().DEF_THRESHOLD);var s,l=t.variables(),u=c();for(s=l.iterator();s.hasNext();){var p=s.next();co().isNumeric_vede35$(t,p.name)&&u.add_11rb$(p)}for(var h=u,_=Ue(),f=D(),d=function(t,e,n){return function(i,r,o){if(W.abs(o)>=t){e.add_11rb$(i),e.add_11rb$(r);var a=n,s=Mt(i,r);a.put_xwzc9p$(s,o)}}}(r,_,f),m=0,y=h.iterator();y.hasNext();++m){var $=y.next(),v=t.getNumeric_8xm3sj$($);n&&d($.label,$.label,1);for(var g=0;g 1024 is too large!";throw d(a.toString())}}function B$(t){return t.first}function U$(t,e){w.call(this),this.name$=t,this.ordinal$=e}function F$(){F$=function(){},O$=new U$("GAUSSIAN",0),N$=new U$("RECTANGULAR",1),P$=new U$("TRIANGULAR",2),A$=new U$("BIWEIGHT",3),j$=new U$("EPANECHNIKOV",4),L$=new U$("OPTCOSINE",5),R$=new U$("COSINE",6)}function q$(){return F$(),O$}function G$(){return F$(),N$}function H$(){return F$(),P$}function Y$(){return F$(),A$}function V$(){return F$(),j$}function K$(){return F$(),L$}function W$(){return F$(),R$}function X$(t,e){w.call(this),this.name$=t,this.ordinal$=e}function Z$(){Z$=function(){},I$=new X$("NRD0",0),z$=new X$("NRD",1)}function J$(){return Z$(),I$}function Q$(){return Z$(),z$}function tv(){ev=this,this.DEF_KERNEL=q$(),this.DEF_ADJUST=1,this.DEF_N=512,this.DEF_BW=J$(),this.DEF_FULL_SCAN_MAX=5e3,this.DEF_MAPPING_0=Bt([Mt(Cn().X,Rv().X),Mt(Cn().Y,Rv().DENSITY)]),this.MAX_N_0=1024}M$.prototype.consumes=function(){return X([Cn().X,Cn().WEIGHT])},M$.prototype.apply_kdy6bf$$default=function(t,n,i){var r,o,a,s,l,u,p;if(!this.hasRequiredValues_xht41f$(t,[Cn().X]))return this.withEmptyStatValues();if(t.has_8xm3sj$($o().WEIGHT)){var h=b.SeriesUtil.filterFinite_10sy24$(t.getNumeric_8xm3sj$($o().X),t.getNumeric_8xm3sj$($o().WEIGHT)),_=h.get_za3lpa$(0),f=h.get_za3lpa$(1),d=qe(O(E(_,f),new pt(D$(B$))));u=d.component1(),p=d.component2()}else{var m,$=he(t.getNumeric_8xm3sj$($o().X)),v=c();for(m=$.iterator();m.hasNext();){var g=m.next();k(g)&&v.add_11rb$(g)}for(var w=(u=Ge(v)).size,x=K(w),C=0;C0){var d=_/1.34;return.9*W.min(f,d)*W.pow(o,-.2)}if(f>0){return.9*f*W.pow(o,-.2)}break;case"NRD":if(_>0){var m=_/1.34;return 1.06*W.min(f,m)*W.pow(o,-.2)}if(f>0){return 1.06*f*W.pow(o,-.2)}}return 1},iv.prototype.kernel_uyf859$=function(t){var e;switch(t.name){case"GAUSSIAN":e=rv;break;case"RECTANGULAR":e=ov;break;case"TRIANGULAR":e=av;break;case"BIWEIGHT":e=sv;break;case"EPANECHNIKOV":e=lv;break;case"OPTCOSINE":e=uv;break;default:e=cv}return e},iv.prototype.densityFunctionFullScan_hztk2d$=function(t,e,n,i,r){return o=t,a=n,s=i*r,l=e,function(t){for(var e=0,n=0;n!==o.size;++n)e+=a((t-o.get_za3lpa$(n))/s)*l.get_za3lpa$(n);return e/s};var o,a,s,l},iv.prototype.densityFunctionFast_hztk2d$=function(t,e,n,i,r){var o,a,s,l,u,c=i*r;return o=t,a=5*c,s=n,l=c,u=e,function(t){var e,n=0,i=Ae(o,t-a);i<0&&(i=(0|-i)-1|0);var r=Ae(o,t+a);r<0&&(r=(0|-r)-1|0),e=r;for(var c=i;c=1))throw d("Degree of polynomial regression must be at least 1".toString());if(1===this.polynomialDegree_0)n=new db(t,e,this.confidenceLevel_0);else{if(!gb().canBeComputed_fgqkrm$(t,e,this.polynomialDegree_0))return p;n=new yb(t,e,this.confidenceLevel_0,this.polynomialDegree_0)}break;case"LOESS":var $=new mb(t,e,this.confidenceLevel_0,this.span_0);if(!$.canCompute)return p;n=$;break;default:throw d("Unsupported smoother method: "+this.smoothingMethod_0+" (only 'lm' and 'loess' methods are currently available)")}var v=n;if(null==(i=b.SeriesUtil.range_l63ks6$(t)))return p;var g=i,w=g.lowerEnd,x=(g.upperEnd-w)/(this.smootherPointCount_0-1|0);r=this.smootherPointCount_0;for(var k=0;ke)throw q(("NumberIsTooLarge - x0:"+t+", x1:"+e).toString());return this.cumulativeProbability_14dthe$(e)-this.cumulativeProbability_14dthe$(t)},zv.prototype.value_14dthe$=function(t){return this.this$AbstractRealDistribution.cumulativeProbability_14dthe$(t)-this.closure$p},zv.$metadata$={kind:h,interfaces:[ub]},Iv.prototype.inverseCumulativeProbability_14dthe$=function(t){if(t<0||t>1)throw q(("OutOfRange [0, 1] - p"+t).toString());var e=this.supportLowerBound;if(0===t)return e;var n=this.supportUpperBound;if(1===t)return n;var i,r=this.numericalMean,o=this.numericalVariance,a=W.sqrt(o);if(i=!(ve(r)||Ot(r)||ve(a)||Ot(a)),e===Q.NEGATIVE_INFINITY)if(i){var s=(1-t)/t;e=r-a*W.sqrt(s)}else for(e=-1;this.cumulativeProbability_14dthe$(e)>=t;)e*=2;if(n===Q.POSITIVE_INFINITY)if(i){var l=t/(1-t);n=r+a*W.sqrt(l)}else for(n=1;this.cumulativeProbability_14dthe$(n)=this.supportLowerBound){var h=this.cumulativeProbability_14dthe$(c);if(this.cumulativeProbability_14dthe$(c-p)===h){for(n=c;n-e>p;){var _=.5*(e+n);this.cumulativeProbability_14dthe$(_)1||e<=0||n<=0)o=Q.NaN;else if(t>(e+1)/(e+n+2))o=1-this.regularizedBeta_tychlm$(1-t,n,e,i,r);else{var a=new lg(n,e),s=1-t,l=e*W.log(t)+n*W.log(s)-W.log(e)-this.logBeta_88ee24$(e,n,i,r);o=1*W.exp(l)/a.evaluate_syxxoe$(t,i,r)}return o},sg.prototype.logBeta_88ee24$=function(t,e,n,i){return void 0===n&&(n=this.DEFAULT_EPSILON_0),void 0===i&&(i=2147483647),Ot(t)||Ot(e)||t<=0||e<=0?Q.NaN:Ag().logGamma_14dthe$(t)+Ag().logGamma_14dthe$(e)-Ag().logGamma_14dthe$(t+e)},sg.$metadata$={kind:p,simpleName:"Beta",interfaces:[]};var ug=null;function cg(){return null===ug&&new sg,ug}function pg(){this.BLOCK_SIZE_0=52,this.rows_0=0,this.columns_0=0,this.blockRows_0=0,this.blockColumns_0=0,this.blocks_4giiw5$_0=this.blocks_4giiw5$_0}function hg(t,e,n){return n=n||Object.create(pg.prototype),pg.call(n),n.rows_0=t,n.columns_0=e,n.blockRows_0=(t+n.BLOCK_SIZE_0-1|0)/n.BLOCK_SIZE_0|0,n.blockColumns_0=(e+n.BLOCK_SIZE_0-1|0)/n.BLOCK_SIZE_0|0,n.blocks_0=n.createBlocksLayout_0(t,e),n}function _g(t,e){return e=e||Object.create(pg.prototype),pg.call(e),e.create_omvvzo$(t.length,t[0].length,e.toBlocksLayout_n8oub7$(t),!1),e}function fg(){yg()}function dg(){mg=this,this.DEFAULT_ABSOLUTE_ACCURACY_0=1e-6}Object.defineProperty(pg.prototype,"blocks_0",{configurable:!0,get:function(){return null==this.blocks_4giiw5$_0?Tt("blocks"):this.blocks_4giiw5$_0},set:function(t){this.blocks_4giiw5$_0=t}}),pg.prototype.create_omvvzo$=function(t,n,i,r){var o;this.rows_0=t,this.columns_0=n,this.blockRows_0=(t+this.BLOCK_SIZE_0-1|0)/this.BLOCK_SIZE_0|0,this.blockColumns_0=(n+this.BLOCK_SIZE_0-1|0)/this.BLOCK_SIZE_0|0;var a=c();r||(this.blocks_0=i);var s=0;o=this.blockRows_0;for(var l=0;lthis.getRowDimension_0())throw q(("row out of range: "+t).toString());if(n<0||n>this.getColumnDimension_0())throw q(("column out of range: "+n).toString());var i=t/this.BLOCK_SIZE_0|0,r=n/this.BLOCK_SIZE_0|0,o=e.imul(t-e.imul(i,this.BLOCK_SIZE_0)|0,this.blockWidth_0(r))+(n-e.imul(r,this.BLOCK_SIZE_0))|0;return this.blocks_0[e.imul(i,this.blockColumns_0)+r|0][o]},pg.prototype.getRowDimension_0=function(){return this.rows_0},pg.prototype.getColumnDimension_0=function(){return this.columns_0},pg.prototype.blockWidth_0=function(t){return t===(this.blockColumns_0-1|0)?this.columns_0-e.imul(t,this.BLOCK_SIZE_0)|0:this.BLOCK_SIZE_0},pg.prototype.blockHeight_0=function(t){return t===(this.blockRows_0-1|0)?this.rows_0-e.imul(t,this.BLOCK_SIZE_0)|0:this.BLOCK_SIZE_0},pg.prototype.toBlocksLayout_n8oub7$=function(t){for(var n=t.length,i=t[0].length,r=(n+this.BLOCK_SIZE_0-1|0)/this.BLOCK_SIZE_0|0,o=(i+this.BLOCK_SIZE_0-1|0)/this.BLOCK_SIZE_0|0,a=0;a!==t.length;++a){var s=t[a].length;if(s!==i)throw q(("Wrong dimension: "+i+", "+s).toString())}for(var l=c(),u=0,p=0;p0?k=-k:x=-x,E=p,p=c;var S=y*k,T=x>=1.5*$*k-W.abs(S);if(!T){var O=.5*E*k;T=x>=W.abs(O)}T?p=c=$:c=x/k}r=a,o=s;var N=c;W.abs(N)>y?a+=c:$>0?a+=y:a-=y,((s=this.computeObjectiveValue_14dthe$(a))>0&&u>0||s<=0&&u<=0)&&(l=r,u=o,p=c=a-r)}},dg.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var mg=null;function yg(){return null===mg&&new dg,mg}function $g(t,e){return void 0===t&&(t=yg().DEFAULT_ABSOLUTE_ACCURACY_0),Vv(t,e=e||Object.create(fg.prototype)),fg.call(e),e}function vg(){wg()}function gg(){bg=this,this.DEFAULT_EPSILON_0=1e-8}fg.$metadata$={kind:h,simpleName:"BrentSolver",interfaces:[Yv]},vg.prototype.evaluate_12fank$=function(t,e){return this.evaluate_syxxoe$(t,wg().DEFAULT_EPSILON_0,e)},vg.prototype.evaluate_syxxoe$=function(t,e,n){void 0===e&&(e=wg().DEFAULT_EPSILON_0),void 0===n&&(n=2147483647);for(var i=1,r=this.getA_5wr77w$(0,t),o=0,a=1,s=r/a,l=0,u=Q.MAX_VALUE;le;){l=l+1|0;var c=this.getA_5wr77w$(l,t),p=this.getB_5wr77w$(l,t),h=c*r+p*i,_=c*a+p*o,f=!1;if(ve(h)||ve(_)){var d=1,m=1,y=W.max(c,p);if(y<=0)throw q("ConvergenceException".toString());f=!0;for(var $=0;$<5&&(m=d,d*=y,0!==c&&c>p?(h=r/m+p/d*i,_=a/m+p/d*o):0!==p&&(h=c/d*r+i/m,_=c/d*a+o/m),f=ve(h)||ve(_));$++);}if(f)throw q("ConvergenceException".toString());var v=h/_;if(Ot(v))throw q("ConvergenceException".toString());var g=v/s-1;u=W.abs(g),s=h/_,i=r,r=h,o=a,a=_}if(l>=n)throw q("MaxCountExceeded".toString());return s},gg.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var bg=null;function wg(){return null===bg&&new gg,bg}function xg(t){return Qe(t)}function kg(t,e){if(t.length!==e.length)throw d("Two series must have the same size.".toString());if(0===t.length)throw d("Can't correlate empty sequences.".toString());for(var n=xg(t),i=xg(e),r=0,o=0,a=0,s=0;s!==t.length;++s){var l=t[s]-n,u=e[s]-i;r+=l*u,o+=W.pow(l,2),a+=W.pow(u,2)}if(0===o||0===a)throw d("Correlation is not defined for sequences with zero variation.".toString());var c=o*a;return r/W.sqrt(c)}function Eg(t){if(Tg(),this.knots_0=t,this.ps_0=null,0===this.knots_0.length)throw d("The knots list must not be empty".toString());this.ps_0=tn([new Wg(new Float64Array([1])),new Wg(new Float64Array([-Qe(this.knots_0),1]))])}function Cg(){Sg=this,this.X=new Wg(new Float64Array([0,1]))}vg.$metadata$={kind:h,simpleName:"ContinuedFraction",interfaces:[]},Eg.prototype.alphaBeta_0=function(t){var e,n;if(t!==this.ps_0.size)throw d("Alpha must be calculated sequentially.".toString());var i=Pe(this.ps_0),r=this.ps_0.get_za3lpa$(this.ps_0.size-2|0),o=0,a=0,s=0;for(e=this.knots_0,n=0;n!==e.length;++n){var l=e[n],u=i.value_14dthe$(l),c=W.pow(u,2),p=r.value_14dthe$(l);o+=l*c,a+=c,s+=W.pow(p,2)}return new de(o/a,a/s)},Eg.prototype.getPolynomial_za3lpa$=function(t){var e;if(!(t>=0))throw d("Degree of Forsythe polynomial must not be negative".toString());if(!(t=this.ps_0.size){e=t+1|0;for(var n=this.ps_0.size;n<=e;n++){var i=this.alphaBeta_0(n),r=i.component1(),o=i.component2(),a=Pe(this.ps_0),s=this.ps_0.get_za3lpa$(this.ps_0.size-2|0),l=Tg().X.times_3j0b7h$(a).minus_3j0b7h$(Jg(r,a)).minus_3j0b7h$(Jg(o,s));this.ps_0.add_11rb$(l)}}return this.ps_0.get_za3lpa$(t)},Cg.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var Sg=null;function Tg(){return null===Sg&&new Cg,Sg}function Og(){Pg=this,this.GAMMA=.5772156649015329,this.DEFAULT_EPSILON_0=1e-14,this.LANCZOS_0=new Float64Array([.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22]);var t=2*Pt.PI;this.HALF_LOG_2_PI_0=.5*W.log(t),this.C_LIMIT_0=49,this.S_LIMIT_0=1e-5}function Ng(t){this.closure$a=t,vg.call(this)}Eg.$metadata$={kind:h,simpleName:"ForsythePolynomialGenerator",interfaces:[]},Og.prototype.logGamma_14dthe$=function(t){var e;if(Ot(t)||t<=0)e=Q.NaN;else{for(var n=0,i=this.LANCZOS_0.length-1|0;i>=1;i--)n+=this.LANCZOS_0[i]/(t+i);var r=t+607/128+.5,o=(n+=this.LANCZOS_0[0])/t;e=(t+.5)*W.log(r)-r+this.HALF_LOG_2_PI_0+W.log(o)}return e},Og.prototype.regularizedGammaP_88ee24$=function(t,e,n,i){var r;if(void 0===n&&(n=this.DEFAULT_EPSILON_0),void 0===i&&(i=2147483647),Ot(t)||Ot(e)||t<=0||e<0)r=Q.NaN;else if(0===e)r=0;else if(e>=t+1)r=1-this.regularizedGammaQ_88ee24$(t,e,n,i);else{for(var o=0,a=1/t,s=a;;){var l=a/s;if(!(W.abs(l)>n&&o=i)throw q(("MaxCountExceeded - maxIterations: "+i).toString());if(ve(s))r=1;else{var u=-e+t*W.log(e)-this.logGamma_14dthe$(t);r=W.exp(u)*s}}return r},Ng.prototype.getA_5wr77w$=function(t,e){return 2*t+1-this.closure$a+e},Ng.prototype.getB_5wr77w$=function(t,e){return t*(this.closure$a-t)},Ng.$metadata$={kind:h,interfaces:[vg]},Og.prototype.regularizedGammaQ_88ee24$=function(t,e,n,i){var r;if(void 0===n&&(n=this.DEFAULT_EPSILON_0),void 0===i&&(i=2147483647),Ot(t)||Ot(e)||t<=0||e<0)r=Q.NaN;else if(0===e)r=1;else if(e0&&t<=this.S_LIMIT_0)return-this.GAMMA-1/t;if(t>=this.C_LIMIT_0){var e=1/(t*t);return W.log(t)-.5/t-e*(1/12+e*(1/120-e/252))}return this.digamma_14dthe$(t+1)-1/t},Og.prototype.trigamma_14dthe$=function(t){if(t>0&&t<=this.S_LIMIT_0)return 1/(t*t);if(t>=this.C_LIMIT_0){var e=1/(t*t);return 1/t+e/2+e/t*(1/6-e*(1/30+e/42))}return this.trigamma_14dthe$(t+1)+1/(t*t)},Og.$metadata$={kind:p,simpleName:"Gamma",interfaces:[]};var Pg=null;function Ag(){return null===Pg&&new Og,Pg}function jg(t,e){void 0===t&&(t=0),void 0===e&&(e=new Rg),this.maximalCount=t,this.maxCountCallback_0=e,this.count_k39d42$_0=0}function Lg(){}function Rg(){}function Ig(t,e,n){if(Ug(),void 0===t&&(t=Ug().DEFAULT_BANDWIDTH),void 0===e&&(e=2),void 0===n&&(n=Ug().DEFAULT_ACCURACY),this.bandwidth_0=t,this.robustnessIters_0=e,this.accuracy_0=n,this.bandwidth_0<=0||this.bandwidth_0>1)throw q(("Out of range of bandwidth value: "+this.bandwidth_0+" should be > 0 and <= 1").toString());if(this.robustnessIters_0<0)throw q(("Not positive Robutness iterationa: "+this.robustnessIters_0).toString())}function zg(){Bg=this,this.DEFAULT_BANDWIDTH=.3,this.DEFAULT_ROBUSTNESS_ITERS=2,this.DEFAULT_ACCURACY=1e-12}Object.defineProperty(jg.prototype,"count",{configurable:!0,get:function(){return this.count_k39d42$_0},set:function(t){this.count_k39d42$_0=t}}),jg.prototype.canIncrement=function(){return this.countthis.maximalCount&&this.maxCountCallback_0.trigger_za3lpa$(this.maximalCount)},jg.prototype.resetCount=function(){this.count=0},Lg.$metadata$={kind:f,simpleName:"MaxCountExceededCallback",interfaces:[]},Rg.prototype.trigger_za3lpa$=function(t){throw q(("MaxCountExceeded: "+t).toString())},Rg.$metadata$={kind:h,interfaces:[Lg]},jg.$metadata$={kind:h,simpleName:"Incrementor",interfaces:[]},Ig.prototype.interpolate_g9g6do$=function(t,e){return(new rb).interpolate_g9g6do$(t,this.smooth_0(t,e))},Ig.prototype.smooth_1=function(t,e,n){var i;if(t.length!==e.length)throw q(("Dimension mismatch of interpolation points: "+t.length+" != "+e.length).toString());var r=t.length;if(0===r)throw q("No data to interpolate".toString());if(this.checkAllFiniteReal_0(t),this.checkAllFiniteReal_0(e),this.checkAllFiniteReal_0(n),Kg().checkOrder_gf7tl1$(t),1===r)return new Float64Array([e[0]]);if(2===r)return new Float64Array([e[0],e[1]]);var o=jt(this.bandwidth_0*r);if(o<2)throw q(("LOESS 'bandwidthInPoints' is too small: "+o+" < 2").toString());var a=new Float64Array(r),s=new Float64Array(r),l=new Float64Array(r),u=new Float64Array(r);en(u,1),i=this.robustnessIters_0;for(var c=0;c<=i;c++){for(var p=new Int32Array([0,o-1|0]),h=0;h0&&this.updateBandwidthInterval_0(t,n,h,p);for(var f=p[0],d=p[1],m=0,y=0,$=0,v=0,g=0,b=1/(t[t[h]-t[f]>t[d]-t[h]?f:d]-_),w=W.abs(b),x=f;x<=d;x++){var k=t[x],E=e[x],C=x=1)u[M]=0;else{var U=1-B*B;u[M]=U*U}}}return a},Ig.prototype.updateBandwidthInterval_0=function(t,e,n,i){var r=i[0],o=i[1],a=this.nextNonzero_0(e,o);if(a=1)return 0;var n=1-e*e*e;return n*n*n},Ig.prototype.nextNonzero_0=function(t,e){for(var n=e+1|0;n=o)break t}else if(t[r]>o)break t}o=t[r],r=r+1|0}if(r===a)return!0;if(i)throw q("Non monotonic sequence".toString());return!1},Fg.prototype.checkOrder_hixecd$=function(t,e,n){this.checkOrder_j8c91m$(t,e,n,!0)},Fg.prototype.checkOrder_gf7tl1$=function(t){this.checkOrder_hixecd$(t,Hg(),!0)},Fg.$metadata$={kind:p,simpleName:"MathArrays",interfaces:[]};var Vg=null;function Kg(){return null===Vg&&new Fg,Vg}function Wg(t){this.coefficients_0=null;var e=null==t;if(e||(e=0===t.length),e)throw q("Empty polynomials coefficients array".toString());for(var n=t.length;n>1&&0===t[n-1|0];)n=n-1|0;this.coefficients_0=new Float64Array(n),Je(t,this.coefficients_0,0,0,n)}function Xg(t,e){return t+e}function Zg(t,e){return t-e}function Jg(t,e){return e.multiply_14dthe$(t)}function Qg(t,n){if(this.knots=null,this.polynomials=null,this.n_0=0,null==t)throw q("Null argument ".toString());if(t.length<2)throw q(("Spline partition must have at least 2 points, got "+t.length).toString());if((t.length-1|0)!==n.length)throw q(("Dimensions mismatch: "+n.length+" polynomial functions != "+t.length+" segment delimiters").toString());Kg().checkOrder_gf7tl1$(t),this.n_0=t.length-1|0,this.knots=t,this.polynomials=e.newArray(this.n_0,null),Je(n,this.polynomials,0,0,this.n_0)}function tb(){eb=this,this.SGN_MASK_0=hn,this.SGN_MASK_FLOAT_0=-2147483648}Wg.prototype.value_14dthe$=function(t){return this.evaluate_0(this.coefficients_0,t)},Wg.prototype.evaluate_0=function(t,e){if(null==t)throw q("Null argument: coefficients of the polynomial to evaluate".toString());var n=t.length;if(0===n)throw q("Empty polynomials coefficients array".toString());for(var i=t[n-1|0],r=n-2|0;r>=0;r--)i=e*i+t[r];return i},Wg.prototype.unaryPlus=function(){return new Wg(this.coefficients_0)},Wg.prototype.unaryMinus=function(){var t,e=new Float64Array(this.coefficients_0.length);t=this.coefficients_0;for(var n=0;n!==t.length;++n){var i=t[n];e[n]=-i}return new Wg(e)},Wg.prototype.apply_op_0=function(t,e){for(var n=o.Comparables.max_sdesaw$(this.coefficients_0.length,t.coefficients_0.length),i=new Float64Array(n),r=0;r=0;e--)0!==this.coefficients_0[e]&&(0!==t.length&&t.append_pdl1vj$(" + "),t.append_pdl1vj$(this.coefficients_0[e].toString()),e>0&&t.append_pdl1vj$("x"),e>1&&t.append_pdl1vj$("^").append_s8jyv4$(e));return t.toString()},Wg.$metadata$={kind:h,simpleName:"PolynomialFunction",interfaces:[]},Qg.prototype.value_14dthe$=function(t){var e;if(tthis.knots[this.n_0])throw q((t.toString()+" out of ["+this.knots[0]+", "+this.knots[this.n_0]+"] range").toString());var n=Ae(sn(this.knots),t);return n<0&&(n=(0|-n)-2|0),n>=this.polynomials.length&&(n=n-1|0),null!=(e=this.polynomials[n])?e.value_14dthe$(t-this.knots[n]):null},Qg.$metadata$={kind:h,simpleName:"PolynomialSplineFunction",interfaces:[]},tb.prototype.compareTo_yvo9jy$=function(t,e,n){return this.equals_yvo9jy$(t,e,n)?0:t=0;_--)p[_]=s[_]-a[_]*p[_+1|0],c[_]=(n[_+1|0]-n[_])/r[_]-r[_]*(p[_+1|0]+2*p[_])/3,h[_]=(p[_+1|0]-p[_])/(3*r[_]);for(var f=e.newArray(i,null),d=new Float64Array(4),m=0;m1?0:Q.NaN}}),Object.defineProperty(ob.prototype,"numericalVariance",{configurable:!0,get:function(){var t=this.degreesOfFreedom_0;return t>2?t/(t-2):t>1&&t<=2?Q.POSITIVE_INFINITY:Q.NaN}}),Object.defineProperty(ob.prototype,"supportLowerBound",{configurable:!0,get:function(){return Q.NEGATIVE_INFINITY}}),Object.defineProperty(ob.prototype,"supportUpperBound",{configurable:!0,get:function(){return Q.POSITIVE_INFINITY}}),Object.defineProperty(ob.prototype,"isSupportLowerBoundInclusive",{configurable:!0,get:function(){return!1}}),Object.defineProperty(ob.prototype,"isSupportUpperBoundInclusive",{configurable:!0,get:function(){return!1}}),Object.defineProperty(ob.prototype,"isSupportConnected",{configurable:!0,get:function(){return!0}}),ob.prototype.probability_14dthe$=function(t){return 0},ob.prototype.density_14dthe$=function(t){var e=this.degreesOfFreedom_0,n=(e+1)/2,i=Ag().logGamma_14dthe$(n),r=Pt.PI,o=1+t*t/e,a=i-.5*(W.log(r)+W.log(e))-Ag().logGamma_14dthe$(e/2)-n*W.log(o);return W.exp(a)},ob.prototype.cumulativeProbability_14dthe$=function(t){var e;if(0===t)e=.5;else{var n=cg().regularizedBeta_tychlm$(this.degreesOfFreedom_0/(this.degreesOfFreedom_0+t*t),.5*this.degreesOfFreedom_0,.5);e=t<0?.5*n:1-.5*n}return e},ab.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var sb=null;function lb(){return null===sb&&new ab,sb}function ub(){}function cb(){}function pb(){hb=this}ob.$metadata$={kind:h,simpleName:"TDistribution",interfaces:[Iv]},ub.$metadata$={kind:f,simpleName:"UnivariateFunction",interfaces:[]},cb.$metadata$={kind:f,simpleName:"UnivariateSolver",interfaces:[ag]},pb.prototype.solve_ljmp9$=function(t,e,n){return $g().solve_rmnly1$(2147483647,t,e,n)},pb.prototype.solve_wb66u3$=function(t,e,n,i){return $g(i).solve_rmnly1$(2147483647,t,e,n)},pb.prototype.forceSide_i33h9z$=function(t,e,n,i,r,o,a){if(a===Xv())return i;for(var s=n.absoluteAccuracy,l=i*n.relativeAccuracy,u=W.abs(l),c=W.max(s,u),p=i-c,h=W.max(r,p),_=e.value_14dthe$(h),f=i+c,d=W.min(o,f),m=e.value_14dthe$(d),y=t-2|0;y>0;){if(_>=0&&m<=0||_<=0&&m>=0)return n.solve_epddgp$(y,e,h,d,i,a);var $=!1,v=!1;if(_=0?$=!0:v=!0:_>m?_<=0?$=!0:v=!0:($=!0,v=!0),$){var g=h-c;h=W.max(r,g),_=e.value_14dthe$(h),y=y-1|0}if(v){var b=d+c;d=W.min(o,b),m=e.value_14dthe$(d),y=y-1|0}}throw q("NoBracketing".toString())},pb.prototype.bracket_cflw21$=function(t,e,n,i,r){if(void 0===r&&(r=2147483647),r<=0)throw q("NotStrictlyPositive".toString());this.verifySequence_yvo9jy$(n,e,i);var o,a,s=e,l=e,u=0;do{var c=s-1;s=W.max(c,n);var p=l+1;l=W.min(p,i),o=t.value_14dthe$(s),a=t.value_14dthe$(l),u=u+1|0}while(o*a>0&&un||l0)throw q("NoBracketing".toString());return new Float64Array([s,l])},pb.prototype.midpoint_lu1900$=function(t,e){return.5*(t+e)},pb.prototype.isBracketing_ljmp9$=function(t,e,n){var i=t.value_14dthe$(e),r=t.value_14dthe$(n);return i>=0&&r<=0||i<=0&&r>=0},pb.prototype.isSequence_yvo9jy$=function(t,e,n){return t=e)throw q("NumberIsTooLarge".toString())},pb.prototype.verifySequence_yvo9jy$=function(t,e,n){this.verifyInterval_lu1900$(t,e),this.verifyInterval_lu1900$(e,n)},pb.prototype.verifyBracketing_ljmp9$=function(t,e,n){if(this.verifyInterval_lu1900$(e,n),!this.isBracketing_ljmp9$(t,e,n))throw q("NoBracketing".toString())},pb.$metadata$={kind:p,simpleName:"UnivariateSolverUtils",interfaces:[]};var hb=null;function _b(){return null===hb&&new pb,hb}function fb(t,e,n,i){this.y=t,this.ymin=e,this.ymax=n,this.se=i}function db(t,e,n){bb.call(this,t,e,n),this.n_0=0,this.meanX_0=0,this.sumXX_0=0,this.beta1_0=0,this.beta0_0=0,this.sy_0=0,this.tcritical_0=0;var i,r=xb(t,e),o=r.component1(),a=r.component2();this.n_0=o.length,this.meanX_0=Qe(o);var s=0;for(i=0;i!==o.length;++i){var l=o[i]-this.meanX_0;s+=W.pow(l,2)}this.sumXX_0=s;var u,c=Qe(a),p=0;for(u=0;u!==a.length;++u){var h=a[u]-c;p+=W.pow(h,2)}var _,f=p,d=0;for(_=fn(o,a).iterator();_.hasNext();){var m=_.next(),y=m.component1(),$=m.component2();d+=(y-this.meanX_0)*($-c)}var v=d;this.beta1_0=v/this.sumXX_0,this.beta0_0=c-this.beta1_0*this.meanX_0;var g=f-v*v/this.sumXX_0,b=W.max(0,g)/(this.n_0-2|0);this.sy_0=W.sqrt(b);var w=1-n;this.tcritical_0=new ob(this.n_0-2).inverseCumulativeProbability_14dthe$(1-w/2)}function mb(t,e,n,i){var r;bb.call(this,t,e,n),this.bandwidth_0=i,this.canCompute=!1,this.n_0=0,this.meanX_0=0,this.sumXX_0=0,this.sy_0=0,this.tcritical_0=0,this.polynomial_6goixr$_0=this.polynomial_6goixr$_0;var o=Eb(t,e),a=o.component1(),s=o.component2();this.n_0=a.length;var l,u=this.n_0-2,c=jt(this.bandwidth_0*this.n_0)>=2;this.canCompute=this.n_0>=3&&u>0&&c,this.meanX_0=Qe(a);var p=0;for(l=0;l!==a.length;++l){var h=a[l]-this.meanX_0;p+=W.pow(h,2)}this.sumXX_0=p;var _,f=Qe(s),d=0;for(_=0;_!==s.length;++_){var m=s[_]-f;d+=W.pow(m,2)}var y,$=d,v=0;for(y=fn(a,s).iterator();y.hasNext();){var g=y.next(),b=g.component1(),w=g.component2();v+=(b-this.meanX_0)*(w-f)}var x=$-v*v/this.sumXX_0,k=W.max(0,x)/(this.n_0-2|0);if(this.sy_0=W.sqrt(k),this.canCompute&&(this.polynomial_0=this.getPoly_0(a,s)),this.canCompute){var E=1-n;r=new ob(u).inverseCumulativeProbability_14dthe$(1-E/2)}else r=Q.NaN;this.tcritical_0=r}function yb(t,e,n,i){if(gb(),bb.call(this,t,e,n),this.p_0=null,this.n_0=0,this.meanX_0=0,this.sumXX_0=0,this.sy_0=0,this.tcritical_0=0,!(i>=2))throw d("Degree of polynomial must be at least 2".toString());var r,o=Eb(t,e),a=o.component1(),s=o.component2();if(this.n_0=a.length,!(this.n_0>i))throw d("The number of valid data points must be greater than deg".toString());this.p_0=this.calcPolynomial_0(i,a,s),this.meanX_0=Qe(a);var l=0;for(r=0;r!==a.length;++r){var u=a[r]-this.meanX_0;l+=W.pow(u,2)}this.sumXX_0=l;var c,p=(this.n_0-i|0)-1,h=0;for(c=fn(a,s).iterator();c.hasNext();){var _=c.next(),f=_.component1(),m=_.component2()-this.p_0.value_14dthe$(f);h+=W.pow(m,2)}var y=h/p;this.sy_0=W.sqrt(y);var $=1-n;this.tcritical_0=new ob(p).inverseCumulativeProbability_14dthe$(1-$/2)}function $b(){vb=this}fb.$metadata$={kind:h,simpleName:"EvalResult",interfaces:[]},fb.prototype.component1=function(){return this.y},fb.prototype.component2=function(){return this.ymin},fb.prototype.component3=function(){return this.ymax},fb.prototype.component4=function(){return this.se},fb.prototype.copy_6y0v78$=function(t,e,n,i){return new fb(void 0===t?this.y:t,void 0===e?this.ymin:e,void 0===n?this.ymax:n,void 0===i?this.se:i)},fb.prototype.toString=function(){return"EvalResult(y="+e.toString(this.y)+", ymin="+e.toString(this.ymin)+", ymax="+e.toString(this.ymax)+", se="+e.toString(this.se)+")"},fb.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*(t=31*t+e.hashCode(this.y)|0)+e.hashCode(this.ymin)|0)+e.hashCode(this.ymax)|0)+e.hashCode(this.se)|0},fb.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.y,t.y)&&e.equals(this.ymin,t.ymin)&&e.equals(this.ymax,t.ymax)&&e.equals(this.se,t.se)},db.prototype.value_0=function(t){return this.beta1_0*t+this.beta0_0},db.prototype.evalX_14dthe$=function(t){var e=t-this.meanX_0,n=W.pow(e,2),i=this.sy_0,r=1/this.n_0+n/this.sumXX_0,o=i*W.sqrt(r),a=this.tcritical_0*o,s=this.value_0(t);return new fb(s,s-a,s+a,o)},db.$metadata$={kind:h,simpleName:"LinearRegression",interfaces:[bb]},Object.defineProperty(mb.prototype,"polynomial_0",{configurable:!0,get:function(){return null==this.polynomial_6goixr$_0?Tt("polynomial"):this.polynomial_6goixr$_0},set:function(t){this.polynomial_6goixr$_0=t}}),mb.prototype.evalX_14dthe$=function(t){var e=t-this.meanX_0,n=W.pow(e,2),i=this.sy_0,r=1/this.n_0+n/this.sumXX_0,o=i*W.sqrt(r),a=this.tcritical_0*o,s=y(this.polynomial_0.value_14dthe$(t));return new fb(s,s-a,s+a,o)},mb.prototype.getPoly_0=function(t,e){return new Ig(this.bandwidth_0,4).interpolate_g9g6do$(t,e)},mb.$metadata$={kind:h,simpleName:"LocalPolynomialRegression",interfaces:[bb]},yb.prototype.calcPolynomial_0=function(t,e,n){for(var i=new Eg(e),r=new Wg(new Float64Array([0])),o=0;o<=t;o++){var a=i.getPolynomial_za3lpa$(o),s=this.coefficient_0(a,e,n);r=r.plus_3j0b7h$(Jg(s,a))}return r},yb.prototype.coefficient_0=function(t,e,n){for(var i=0,r=0,o=0;on},$b.$metadata$={kind:p,simpleName:"Companion",interfaces:[]};var vb=null;function gb(){return null===vb&&new $b,vb}function bb(t,e,n){if(!Me(.01,.99).contains_mef7kx$(n))throw d(("Confidence level is out of range [0.01-0.99]. CL:"+n).toString());if(t.size!==e.size){var i="X/Y must have same size. X:"+F(t.size)+" Y:"+F(e.size);throw d(i.toString())}}yb.$metadata$={kind:h,simpleName:"PolynomialRegression",interfaces:[bb]},bb.$metadata$={kind:h,simpleName:"RegressionEvaluator",interfaces:[]};var wb=Ye((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(n),r(i))}}}));function xb(t,e){var n,i=c(),r=c();for(n=yn(mn(t),mn(e)).iterator();n.hasNext();){var o=n.next(),a=o.component1(),s=o.component2();b.SeriesUtil.allFinite_jma9l8$(a,s)&&(i.add_11rb$(y(a)),r.add_11rb$(y(s)))}return new de(dn(i),dn(r))}function kb(t){return t.first}function Eb(t,e){var n=function(t,e){var n,i=c();for(n=yn(mn(t),mn(e)).iterator();n.hasNext();){var r=n.next(),o=r.component1(),a=r.component2();b.SeriesUtil.allFinite_jma9l8$(o,a)&&i.add_11rb$(new de(y(o),y(a)))}return i}(t,e);n.size>1&&ze(n,new pt(wb(kb)));var i=function(t){var e;if(t.isEmpty())return new de(c(),c());var n=c(),i=c(),r=Ne(t),o=r.component1(),a=r.component2(),s=1;for(e=$n(mn(t),1).iterator();e.hasNext();){var l=e.next(),u=l.component1(),p=l.component2();u===o?(a+=p,s=s+1|0):(n.add_11rb$(o),i.add_11rb$(a/s),o=u,a=p,s=1)}return n.add_11rb$(o),i.add_11rb$(a/s),new de(n,i)}(n);return new de(dn(i.first),dn(i.second))}function Cb(t){this.myValue_0=t}function Sb(t){this.myValue_0=t}function Tb(){Ob=this}Cb.prototype.getAndAdd_14dthe$=function(t){var e=this.myValue_0;return this.myValue_0=e+t,e},Cb.prototype.get=function(){return this.myValue_0},Cb.$metadata$={kind:h,simpleName:"MutableDouble",interfaces:[]},Object.defineProperty(Sb.prototype,"andIncrement",{configurable:!0,get:function(){return this.getAndAdd_za3lpa$(1)}}),Sb.prototype.get=function(){return this.myValue_0},Sb.prototype.getAndAdd_za3lpa$=function(t){var e=this.myValue_0;return this.myValue_0=e+t|0,e},Sb.prototype.increment=function(){this.getAndAdd_za3lpa$(1)},Sb.$metadata$={kind:h,simpleName:"MutableInteger",interfaces:[]},Tb.prototype.sampleWithoutReplacement_o7ew15$=function(t,e,n,i,r){for(var o=e<=(t/2|0),a=o?e:t-e|0,s=Ie();s.size"],r=this.myPreferredSize_8a54qv$_0.get().y/2-8;for(t=0;t!==i.length;++t){var o=new x(i[t]);o.setHorizontalAnchor_ja80zo$(k.MIDDLE),o.setVerticalAnchor_yaudma$(E.CENTER),o.moveTo_lu1900$(this.myPreferredSize_8a54qv$_0.get().x/2,r),this.rootGroup.children().add_11rb$(o.rootGroup),r+=16}}},hr.prototype.onEvent_11rb$=function(t){var e=t.newValue;S(e).x>0&&e.y>0&&this.this$Plot.rebuildPlot_v06af3$_0()},hr.$metadata$={kind:$,interfaces:[T]},_r.prototype.doRemove=function(){this.this$Plot.myTooltipHelper_3jkkzs$_0.removeAllTileInfos(),this.this$Plot.myLiveMapFigures_nd8qng$_0.clear()},_r.$metadata$={kind:$,interfaces:[O]},cr.prototype.buildPlot_wr1hxq$_0=function(){this.rootGroup.addClass_61zpoe$(d_().PLOT),this.buildPlotComponents_8cuv6w$_0(),this.reg_3xv6fb$(this.myPreferredSize_8a54qv$_0.addHandler_gxwwpc$(new hr(this))),this.reg_3xv6fb$(new _r(this))},cr.prototype.rebuildPlot_v06af3$_0=function(){this.clear(),this.buildPlot_wr1hxq$_0()},cr.prototype.createTile_rg9gwo$_0=function(t,e,n,i){var r,o,a;if(null!=e.xAxisInfo&&null!=e.yAxisInfo){var s=S(e.xAxisInfo.axisDomain),l=e.xAxisInfo.axisLength,u=S(e.yAxisInfo.axisDomain),c=e.yAxisInfo.axisLength;r=this.coordProvider.buildAxisScaleX_ny58zc$(this.scaleXProto,s,l,S(e.xAxisInfo.axisBreaks)),o=this.coordProvider.buildAxisScaleY_ny58zc$(this.scaleYProto,u,c,S(e.yAxisInfo.axisBreaks)),a=this.coordProvider.createCoordinateSystem_uncllg$(s,l,u,c)}else r=new rr,o=new rr,a=new ir;var p=new Cr(n,r,o,t,e,a,i);return p.setShowAxis_6taknv$(this.isAxisEnabled),p.debugDrawing().set_11rb$(yr().DEBUG_DRAWING_0),p},cr.prototype.createAxisTitle_depkt8$_0=function(t,n,i,r){var o,a=k.MIDDLE;switch(n.name){case"LEFT":case"RIGHT":case"TOP":o=E.TOP;break;case"BOTTOM":o=E.BOTTOM;break;default:o=e.noWhenBranchMatched()}var s,l=o,u=0;switch(n.name){case"LEFT":s=new h(i.left+$p().AXIS_TITLE_OUTER_MARGIN,r.center.y),u=-90;break;case"RIGHT":s=new h(i.right-$p().AXIS_TITLE_OUTER_MARGIN,r.center.y),u=90;break;case"TOP":s=new h(r.center.x,i.top+$p().AXIS_TITLE_OUTER_MARGIN);break;case"BOTTOM":s=new h(r.center.x,i.bottom-$p().AXIS_TITLE_OUTER_MARGIN);break;default:e.noWhenBranchMatched()}var c=new x(t);c.setHorizontalAnchor_ja80zo$(a),c.setVerticalAnchor_yaudma$(l),c.moveTo_gpjtzr$(s),c.rotate_14dthe$(u);var p=c.rootGroup;p.addClass_61zpoe$(d_().AXIS_TITLE);var _=new N;_.addClass_61zpoe$(d_().AXIS),_.children().add_11rb$(p),this.add_26jijc$(_)},fr.prototype.handle_42da0z$=function(t,e){s(this.closure$message)},fr.$metadata$={kind:$,interfaces:[A]},cr.prototype.onMouseMove_hnimoe$_0=function(t,e){t.addEventHandler_mm8kk2$(P.MOUSE_MOVE,new fr(e))},cr.prototype.buildPlotComponents_8cuv6w$_0=function(){var t,e,n,i,r=this.myPreferredSize_8a54qv$_0.get(),o=new j(h.Companion.ZERO,r);if(yr().DEBUG_DRAWING_0){var a=L(o);a.strokeColor().set_11rb$(R.Companion.MAGENTA),a.strokeWidth().set_11rb$(1),a.fillOpacity().set_11rb$(0),this.onMouseMove_hnimoe$_0(a,"MAGENTA: preferred size: "+o),this.add_26jijc$(a)}var s=this.hasLiveMap()?$p().liveMapBounds_wthzt5$(o):o;if(this.hasTitle()){var l=$p().titleDimensions_61zpoe$(this.title);t=new j(s.origin.add_gpjtzr$(new h(0,l.y)),s.dimension.subtract_gpjtzr$(new h(0,l.y)))}else t=s;var u=t,c=null,p=this.theme_5sfato$_0.legend(),_=p.position().isFixed?(c=new np(u,p).doLayout_8sg693$(this.legendBoxInfos)).plotInnerBoundsWithoutLegendBoxes:u;if(yr().DEBUG_DRAWING_0){var f=L(_);f.strokeColor().set_11rb$(R.Companion.BLUE),f.strokeWidth().set_11rb$(1),f.fillOpacity().set_11rb$(0),this.onMouseMove_hnimoe$_0(f,"BLUE: plot without title and legends: "+_),this.add_26jijc$(f)}var d=_;if(this.isAxisEnabled){if(this.hasAxisTitleLeft()){var m=$p().axisTitleDimensions_61zpoe$(this.axisTitleLeft).y+$p().AXIS_TITLE_OUTER_MARGIN+$p().AXIS_TITLE_INNER_MARGIN;d=I(d.left+m,d.top,d.width-m,d.height)}if(this.hasAxisTitleBottom()){var y=$p().axisTitleDimensions_61zpoe$(this.axisTitleBottom).y+$p().AXIS_TITLE_OUTER_MARGIN+$p().AXIS_TITLE_INNER_MARGIN;d=I(d.left,d.top,d.width,d.height-y)}}var $=this.plotLayout().doLayout_gpjtzr$(d.dimension);if(this.myLaidOutSize_jqfjq$_0.set_11rb$(r),!$.tiles.isEmpty()){var v=$p().absoluteGeomBounds_vjhcds$(d.origin,$);p.position().isOverlay&&(c=new np(v,p).doLayout_8sg693$(this.legendBoxInfos));var g=$.tiles.size>1?this.theme_5sfato$_0.multiTile():this.theme_5sfato$_0,b=d.origin;for(e=$.tiles.iterator();e.hasNext();){var w=e.next(),C=w.trueIndex,S=this.createTile_rg9gwo$_0(b,w,this.tileLayers_za3lpa$(C),g),T=b.add_gpjtzr$(w.plotOrigin);S.moveTo_gpjtzr$(T),this.add_8icvvv$(S),null!=(n=S.liveMapFigure)&&z("add",function(t,e){return t.add_11rb$(e)}.bind(null,this.myLiveMapFigures_nd8qng$_0))(n);var O=w.geomBounds.add_gpjtzr$(T);this.myTooltipHelper_3jkkzs$_0.addTileInfo_t6qbjr$(O,S.targetLocators)}if(yr().DEBUG_DRAWING_0){var N=L(v);N.strokeColor().set_11rb$(R.Companion.RED),N.strokeWidth().set_11rb$(1),N.fillOpacity().set_11rb$(0),this.add_26jijc$(N)}if(this.hasTitle()){var P=new x(this.title);P.addClassName_61zpoe$(d_().PLOT_TITLE),P.setHorizontalAnchor_ja80zo$(k.LEFT),P.setVerticalAnchor_yaudma$(E.CENTER);var A=$p().titleDimensions_61zpoe$(this.title),D=I(v.origin.x,0,A.x,A.y);if(P.moveTo_gpjtzr$(new h(D.left,D.center.y)),this.add_8icvvv$(P),yr().DEBUG_DRAWING_0){var M=L(D);M.strokeColor().set_11rb$(R.Companion.BLUE),M.strokeWidth().set_11rb$(1),M.fillOpacity().set_11rb$(0),this.add_26jijc$(M)}}if(this.isAxisEnabled&&(this.hasAxisTitleLeft()&&this.createAxisTitle_depkt8$_0(this.axisTitleLeft,Jl(),_,v),this.hasAxisTitleBottom()&&this.createAxisTitle_depkt8$_0(this.axisTitleBottom,eu(),_,v)),null!=c)for(i=c.boxWithLocationList.iterator();i.hasNext();){var B=i.next(),U=B.legendBox.createLegendBox();U.moveTo_gpjtzr$(B.location),this.add_8icvvv$(U)}}},cr.prototype.createTooltipSpecs_gpjtzr$=function(t){return this.myTooltipHelper_3jkkzs$_0.createTooltipSpecs_gpjtzr$(t)},cr.prototype.getGeomBounds_gpjtzr$=function(t){return this.myTooltipHelper_3jkkzs$_0.getGeomBounds_gpjtzr$(t)},dr.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var mr=null;function yr(){return null===mr&&new dr,mr}function $r(t){this.myTheme_0=t,this.myLayersByTile_0=p(),this.myTitle_0=null,this.myCoordProvider_3t551e$_0=this.myCoordProvider_3t551e$_0,this.myLayout_0=null,this.myAxisTitleLeft_0=null,this.myAxisTitleBottom_0=null,this.myLegendBoxInfos_0=p(),this.myScaleXProto_s7k1di$_0=this.myScaleXProto_s7k1di$_0,this.myScaleYProto_dj5r5h$_0=this.myScaleYProto_dj5r5h$_0,this.myAxisEnabled_0=!0,this.myInteractionsEnabled_0=!0,this.hasLiveMap_0=!1}function vr(t){cr.call(this,t.myTheme_0),this.scaleXProto_rbtdab$_0=t.myScaleXProto_0,this.scaleYProto_t0wegs$_0=t.myScaleYProto_0,this.myTitle_0=t.myTitle_0,this.myAxisTitleLeft_0=t.myAxisTitleLeft_0,this.myAxisTitleBottom_0=t.myAxisTitleBottom_0,this.myAxisXTitleEnabled_0=t.myTheme_0.axisX().showTitle(),this.myAxisYTitleEnabled_0=t.myTheme_0.axisY().showTitle(),this.coordProvider_o460zb$_0=t.myCoordProvider_0,this.myLayersByTile_0=null,this.myLayout_0=null,this.myLegendBoxInfos_0=null,this.hasLiveMap_0=!1,this.isAxisEnabled_70ondl$_0=!1,this.isInteractionsEnabled_dvtvmh$_0=!1,this.myLayersByTile_0=q(t.myLayersByTile_0),this.myLayout_0=t.myLayout_0,this.myLegendBoxInfos_0=q(t.myLegendBoxInfos_0),this.hasLiveMap_0=t.hasLiveMap_0,this.isAxisEnabled_70ondl$_0=t.myAxisEnabled_0,this.isInteractionsEnabled_dvtvmh$_0=t.myInteractionsEnabled_0}function gr(t,e){var n;Er(),this.plot=t,this.preferredSize_sl52i3$_0=e,this.svg=new K,this.myContentBuilt_l8hvkk$_0=!1,this.myRegistrations_wwtuqx$_0=new V([]),this.svg.addClass_61zpoe$(d_().PLOT_CONTAINER),this.setSvgSize_2l8z8v$_0(this.preferredSize_sl52i3$_0.get()),this.plot.laidOutSize().addHandler_gxwwpc$(Er().sizePropHandler_0((n=this,function(t){var e=n.preferredSize_sl52i3$_0.get().x,i=t.x,r=X.max(e,i),o=n.preferredSize_sl52i3$_0.get().y,a=t.y,s=new h(r,X.max(o,a));return n.setSvgSize_2l8z8v$_0(s),W}))),this.preferredSize_sl52i3$_0.addHandler_gxwwpc$(Er().sizePropHandler_0(function(t){return function(e){return e.x>0&&e.y>0&&t.revalidateContent_r8qzcp$_0(),W}}(this)))}function br(){}function wr(){kr=this}function xr(t){this.closure$block=t}cr.$metadata$={kind:$,simpleName:"Plot",interfaces:[B]},Object.defineProperty($r.prototype,"myCoordProvider_0",{configurable:!0,get:function(){return null==this.myCoordProvider_3t551e$_0?F("myCoordProvider"):this.myCoordProvider_3t551e$_0},set:function(t){this.myCoordProvider_3t551e$_0=t}}),Object.defineProperty($r.prototype,"myScaleXProto_0",{configurable:!0,get:function(){return null==this.myScaleXProto_s7k1di$_0?F("myScaleXProto"):this.myScaleXProto_s7k1di$_0},set:function(t){this.myScaleXProto_s7k1di$_0=t}}),Object.defineProperty($r.prototype,"myScaleYProto_0",{configurable:!0,get:function(){return null==this.myScaleYProto_dj5r5h$_0?F("myScaleYProto"):this.myScaleYProto_dj5r5h$_0},set:function(t){this.myScaleYProto_dj5r5h$_0=t}}),$r.prototype.setTitle_pdl1vj$=function(t){this.myTitle_0=t},$r.prototype.setAxisTitleLeft_61zpoe$=function(t){this.myAxisTitleLeft_0=t},$r.prototype.setAxisTitleBottom_61zpoe$=function(t){this.myAxisTitleBottom_0=t},$r.prototype.setCoordProvider_sdecqr$=function(t){return this.myCoordProvider_0=t,this},$r.prototype.addTileLayers_relqli$=function(t){return this.myLayersByTile_0.add_11rb$(q(t)),this},$r.prototype.setPlotLayout_vjneqj$=function(t){return this.myLayout_0=t,this},$r.prototype.addLegendBoxInfo_29gouq$=function(t){return this.myLegendBoxInfos_0.add_11rb$(t),this},$r.prototype.scaleXProto_iu85h4$=function(t){return this.myScaleXProto_0=t,this},$r.prototype.scaleYProto_iu85h4$=function(t){return this.myScaleYProto_0=t,this},$r.prototype.axisEnabled_6taknv$=function(t){return this.myAxisEnabled_0=t,this},$r.prototype.interactionsEnabled_6taknv$=function(t){return this.myInteractionsEnabled_0=t,this},$r.prototype.setLiveMap_6taknv$=function(t){return this.hasLiveMap_0=t,this},$r.prototype.build=function(){return new vr(this)},Object.defineProperty(vr.prototype,"scaleXProto",{configurable:!0,get:function(){return this.scaleXProto_rbtdab$_0}}),Object.defineProperty(vr.prototype,"scaleYProto",{configurable:!0,get:function(){return this.scaleYProto_t0wegs$_0}}),Object.defineProperty(vr.prototype,"coordProvider",{configurable:!0,get:function(){return this.coordProvider_o460zb$_0}}),Object.defineProperty(vr.prototype,"isAxisEnabled",{configurable:!0,get:function(){return this.isAxisEnabled_70ondl$_0}}),Object.defineProperty(vr.prototype,"isInteractionsEnabled",{configurable:!0,get:function(){return this.isInteractionsEnabled_dvtvmh$_0}}),Object.defineProperty(vr.prototype,"title",{configurable:!0,get:function(){if(!this.hasTitle())throw G("No title".toString());return S(this.myTitle_0)}}),Object.defineProperty(vr.prototype,"axisTitleLeft",{configurable:!0,get:function(){if(!this.hasAxisTitleLeft())throw G("No left axis title".toString());return S(this.myAxisTitleLeft_0)}}),Object.defineProperty(vr.prototype,"axisTitleBottom",{configurable:!0,get:function(){if(!this.hasAxisTitleBottom())throw G("No bottom axis title".toString());return S(this.myAxisTitleBottom_0)}}),Object.defineProperty(vr.prototype,"legendBoxInfos",{configurable:!0,get:function(){return this.myLegendBoxInfos_0}}),vr.prototype.hasTitle=function(){return!w.Strings.isNullOrEmpty_pdl1vj$(this.myTitle_0)},vr.prototype.hasAxisTitleLeft=function(){return this.myAxisYTitleEnabled_0&&!w.Strings.isNullOrEmpty_pdl1vj$(this.myAxisTitleLeft_0)},vr.prototype.hasAxisTitleBottom=function(){return this.myAxisXTitleEnabled_0&&!w.Strings.isNullOrEmpty_pdl1vj$(this.myAxisTitleBottom_0)},vr.prototype.hasLiveMap=function(){return this.hasLiveMap_0},vr.prototype.tileLayers_za3lpa$=function(t){return this.myLayersByTile_0.get_za3lpa$(t)},vr.prototype.plotLayout=function(){return S(this.myLayout_0)},vr.$metadata$={kind:$,simpleName:"MyPlot",interfaces:[cr]},$r.$metadata$={kind:$,simpleName:"PlotBuilder",interfaces:[]},Object.defineProperty(gr.prototype,"liveMapFigures",{configurable:!0,get:function(){return this.plot.liveMapFigures_8be2vx$}}),Object.defineProperty(gr.prototype,"isLiveMap",{configurable:!0,get:function(){return!this.plot.liveMapFigures_8be2vx$.isEmpty()}}),gr.prototype.ensureContentBuilt=function(){this.myContentBuilt_l8hvkk$_0||this.buildContent()},gr.prototype.revalidateContent_r8qzcp$_0=function(){this.myContentBuilt_l8hvkk$_0&&(this.clearContent(),this.buildContent())},br.prototype.css=function(){return d_().css},br.$metadata$={kind:$,interfaces:[H]},gr.prototype.buildContent=function(){if(this.myContentBuilt_l8hvkk$_0)throw d("Check failed.".toString());this.myContentBuilt_l8hvkk$_0=!0,this.svg.setStyle_i8z0m3$(new br);var t=new Y;t.addClass_61zpoe$(d_().PLOT_BACKDROP),t.setAttribute_jyasbz$("width","100%"),t.setAttribute_jyasbz$("height","100%"),this.svg.children().add_11rb$(t),this.plot.preferredSize_8be2vx$().set_11rb$(this.preferredSize_sl52i3$_0.get()),this.svg.children().add_11rb$(this.plot.rootGroup)},gr.prototype.clearContent=function(){this.myContentBuilt_l8hvkk$_0&&(this.myContentBuilt_l8hvkk$_0=!1,this.svg.children().clear(),this.plot.clear(),this.myRegistrations_wwtuqx$_0.remove(),this.myRegistrations_wwtuqx$_0=new V([]))},gr.prototype.reg_3xv6fb$=function(t){this.myRegistrations_wwtuqx$_0.add_3xv6fb$(t)},gr.prototype.setSvgSize_2l8z8v$_0=function(t){this.svg.width().set_11rb$(t.x),this.svg.height().set_11rb$(t.y)},xr.prototype.onEvent_11rb$=function(t){var e=t.newValue;null!=e&&this.closure$block(e)},xr.$metadata$={kind:$,interfaces:[T]},wr.prototype.sizePropHandler_0=function(t){return new xr(t)},wr.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var kr=null;function Er(){return null===kr&&new wr,kr}function Cr(t,e,n,i,r,o,a){B.call(this),this.myScaleX_0=e,this.myScaleY_0=n,this.myTilesOrigin_0=i,this.myLayoutInfo_0=r,this.myCoord_0=o,this.myTheme_0=a,this.myDebugDrawing_0=new U(!1),this.myLayers_0=null,this.myTargetLocators_0=p(),this.myShowAxis_0=!1,this.liveMapFigure_y5x745$_0=null,this.myLayers_0=q(t),this.moveTo_gpjtzr$(this.myLayoutInfo_0.getAbsoluteBounds_gpjtzr$(this.myTilesOrigin_0).origin)}function Sr(){this.myTileInfos_0=p()}function Tr(t,e){this.geomBounds_8be2vx$=t;var n,i=y(m(e,10));for(n=e.iterator();n.hasNext();){var r=n.next();i.add_11rb$(new Or(this,r))}this.myTargetLocators_0=i}function Or(t,e){this.$outer=t,Rc.call(this,e)}function Nr(){Ar=this}function Pr(t){this.closure$aes=t,this.groupCount_uijr2l$_0=it(function(t){return function(){return nt.Sets.newHashSet_yl67zr$(t.groups()).size}}(t))}gr.$metadata$={kind:$,simpleName:"PlotContainerPortable",interfaces:[]},Object.defineProperty(Cr.prototype,"liveMapFigure",{configurable:!0,get:function(){return this.liveMapFigure_y5x745$_0},set:function(t){this.liveMapFigure_y5x745$_0=t}}),Object.defineProperty(Cr.prototype,"targetLocators",{configurable:!0,get:function(){return this.myTargetLocators_0}}),Object.defineProperty(Cr.prototype,"isDebugDrawing_0",{configurable:!0,get:function(){return this.myDebugDrawing_0.get()}}),Cr.prototype.buildComponent=function(){var t,n,i,r=this.myLayoutInfo_0.geomBounds;if(this.myTheme_0.plot().showInnerFrame()){var o=L(r);o.strokeColor().set_11rb$(this.myTheme_0.plot().innerFrameColor()),o.strokeWidth().set_11rb$(1),o.fillOpacity().set_11rb$(0);var a=o;this.add_26jijc$(a)}this.addFacetLabels_0(r,this.myTheme_0.facets());var s,l=this.myLayers_0;t:do{var p;for(p=l.iterator();p.hasNext();){var h=p.next();if(h.isLiveMap){s=h;break t}}s=null}while(0);var _=s;if(null==_&&this.myShowAxis_0&&this.addAxis_0(r),this.isDebugDrawing_0){var f=this.myLayoutInfo_0.bounds,d=L(f);d.fillColor().set_11rb$(R.Companion.BLACK),d.strokeWidth().set_11rb$(0),d.fillOpacity().set_11rb$(.1),this.add_26jijc$(d)}if(this.isDebugDrawing_0){var m=this.myLayoutInfo_0.clipBounds,y=L(m);y.fillColor().set_11rb$(R.Companion.DARK_GREEN),y.strokeWidth().set_11rb$(0),y.fillOpacity().set_11rb$(.3),this.add_26jijc$(y)}if(this.isDebugDrawing_0){var $=L(r);$.fillColor().set_11rb$(R.Companion.PINK),$.strokeWidth().set_11rb$(1),$.fillOpacity().set_11rb$(.5),this.add_26jijc$($)}if(null!=_){var v=function(t,n){var i;return(e.isType(i=t.geom,tt)?i:c()).createCanvasFigure_wthzt5$(n)}(_,this.myLayoutInfo_0.getAbsoluteGeomBounds_gpjtzr$(this.myTilesOrigin_0));this.liveMapFigure=v.canvasFigure,this.myTargetLocators_0.add_11rb$(v.targetLocator)}else{var g=Z(),b=Z(),w=this.myLayoutInfo_0.xAxisInfo,x=this.myLayoutInfo_0.yAxisInfo,k=this.myScaleX_0.mapper,E=this.myScaleY_0.mapper,C=J.Companion.X;g.put_xwzc9p$(C,k);var T=J.Companion.Y;g.put_xwzc9p$(T,E);var O=J.Companion.SLOPE,N=u.Mappers.mul_14dthe$(S(E(1))/S(k(1)));g.put_xwzc9p$(O,N);var P=J.Companion.X,A=S(S(w).axisDomain);b.put_xwzc9p$(P,A);var j=J.Companion.Y,I=S(S(x).axisDomain);for(b.put_xwzc9p$(j,I),t=this.buildGeoms_0(g,b,this.myCoord_0).iterator();t.hasNext();){var z=t.next();z.moveTo_gpjtzr$(r.origin);var D=null!=(n=this.myCoord_0.xClientLimit)?n:new Q(0,r.width),M=null!=(i=this.myCoord_0.yClientLimit)?i:new Q(0,r.height),B=Xc().doubleRange_gyv40k$(D,M);z.clipBounds_wthzt5$(B),this.add_8icvvv$(z)}}},Cr.prototype.addFacetLabels_0=function(t,e){var n,i=this.myLayoutInfo_0.facetXLabels;if(!i.isEmpty()){var r=Vc().facetColLabelSize_14dthe$(t.width),o=new h(t.left+0,t.top-Vc().facetColHeadHeight_za3lpa$(i.size)+6),a=new j(o,r);for(n=i.iterator();n.hasNext();){var s=n.next(),l=L(a);l.strokeWidth().set_11rb$(0),l.fillColor().set_11rb$(e.labelBackground());var u=l;this.add_26jijc$(u);var c=a.center.x,p=a.center.y,_=new x(s);_.moveTo_lu1900$(c,p),_.setHorizontalAnchor_ja80zo$(k.MIDDLE),_.setVerticalAnchor_yaudma$(E.CENTER),this.add_8icvvv$(_),a=a.add_gpjtzr$(new h(0,r.y))}}if(null!=this.myLayoutInfo_0.facetYLabel){var f=I(t.right+6,t.top-0,Vc().FACET_TAB_HEIGHT-12,t.height-0),d=L(f);d.strokeWidth().set_11rb$(0),d.fillColor().set_11rb$(e.labelBackground()),this.add_26jijc$(d);var m=f.center.x,y=f.center.y,$=new x(this.myLayoutInfo_0.facetYLabel);$.moveTo_lu1900$(m,y),$.setHorizontalAnchor_ja80zo$(k.MIDDLE),$.setVerticalAnchor_yaudma$(E.CENTER),$.rotate_14dthe$(90),this.add_8icvvv$($)}},Cr.prototype.addAxis_0=function(t){if(this.myLayoutInfo_0.xAxisShown){var e=this.buildAxis_0(this.myScaleX_0,S(this.myLayoutInfo_0.xAxisInfo),this.myCoord_0,this.myTheme_0.axisX());e.moveTo_gpjtzr$(new h(t.left,t.bottom)),this.add_8icvvv$(e)}if(this.myLayoutInfo_0.yAxisShown){var n=this.buildAxis_0(this.myScaleY_0,S(this.myLayoutInfo_0.yAxisInfo),this.myCoord_0,this.myTheme_0.axisY());n.moveTo_gpjtzr$(t.origin),this.add_8icvvv$(n)}},Cr.prototype.buildAxis_0=function(t,e,n,i){var r=new Bs(e.axisLength,S(e.orientation));if(nr().setBreaks_6e5l22$(r,t,n,e.orientation.isHorizontal),nr().applyLayoutInfo_4pg061$(r,e),nr().applyTheme_tna4q5$(r,i),this.isDebugDrawing_0&&null!=e.tickLabelsBounds){var o=L(e.tickLabelsBounds);o.strokeColor().set_11rb$(R.Companion.GREEN),o.strokeWidth().set_11rb$(1),o.fillOpacity().set_11rb$(0),r.add_26jijc$(o)}return r},Cr.prototype.buildGeoms_0=function(t,e,n){var i,r=p();for(i=this.myLayers_0.iterator();i.hasNext();){var o=i.next(),a=ur().createLayerRendererData_knseyn$(o,t,e),s=a.aestheticMappers,l=a.aesthetics,u=new Fu(o.geomKind,o.locatorLookupSpec,o.contextualMapping,n);this.myTargetLocators_0.add_11rb$(u);var c=Hr().aesthetics_luqwb2$(l).aestheticMappers_4iu3o$(s).geomTargetCollector_xrq6q$(u).build(),h=a.pos,_=o.geom;r.add_11rb$(new Rr(l,_,h,n,c))}return r},Cr.prototype.setShowAxis_6taknv$=function(t){this.myShowAxis_0=t},Cr.prototype.debugDrawing=function(){return this.myDebugDrawing_0},Cr.$metadata$={kind:$,simpleName:"PlotTile",interfaces:[B]},Sr.prototype.removeAllTileInfos=function(){this.myTileInfos_0.clear()},Sr.prototype.addTileInfo_t6qbjr$=function(t,e){var n=new Tr(t,e);this.myTileInfos_0.add_11rb$(n)},Sr.prototype.createTooltipSpecs_gpjtzr$=function(t){var e;if(null==(e=this.findTileInfo_0(t)))return et();var n=e,i=n.findTargets_xoefl8$(t);return this.createTooltipSpecs_0(i,n.axisOrigin_8be2vx$)},Sr.prototype.getGeomBounds_gpjtzr$=function(t){var e;return null==(e=this.findTileInfo_0(t))?null:e.geomBounds_8be2vx$},Sr.prototype.findTileInfo_0=function(t){var e;for(e=this.myTileInfos_0.iterator();e.hasNext();){var n=e.next();if(n.contains_xoefl8$(t))return n}return null},Sr.prototype.createTooltipSpecs_0=function(t,e){var n,i=p();for(n=t.iterator();n.hasNext();){var r,o=n.next(),a=new Bu(o.contextualMapping,e);for(r=o.targets.iterator();r.hasNext();){var s=r.next();i.addAll_brywnq$(a.create_62opr5$(s))}}return i},Object.defineProperty(Tr.prototype,"axisOrigin_8be2vx$",{configurable:!0,get:function(){return new h(this.geomBounds_8be2vx$.left,this.geomBounds_8be2vx$.bottom)}}),Tr.prototype.findTargets_xoefl8$=function(t){var e,n=new Ju;for(e=this.myTargetLocators_0.iterator();e.hasNext();){var i=e.next().search_gpjtzr$(t);null!=i&&n.addLookupResult_9sakjw$(i,t)}return n.picked},Tr.prototype.contains_xoefl8$=function(t){return this.geomBounds_8be2vx$.contains_gpjtzr$(t)},Or.prototype.convertToTargetCoord_gpjtzr$=function(t){return t.subtract_gpjtzr$(this.$outer.geomBounds_8be2vx$.origin)},Or.prototype.convertToPlotCoord_gpjtzr$=function(t){return t.add_gpjtzr$(this.$outer.geomBounds_8be2vx$.origin)},Or.prototype.convertToPlotDistance_14dthe$=function(t){return t},Or.$metadata$={kind:$,simpleName:"TileTargetLocator",interfaces:[Rc]},Tr.$metadata$={kind:$,simpleName:"TileInfo",interfaces:[]},Sr.$metadata$={kind:$,simpleName:"PlotTooltipHelper",interfaces:[]},Object.defineProperty(Pr.prototype,"aesthetics",{configurable:!0,get:function(){return this.closure$aes}}),Object.defineProperty(Pr.prototype,"groupCount",{configurable:!0,get:function(){return this.groupCount_uijr2l$_0.value}}),Pr.$metadata$={kind:$,interfaces:[Lr]},Nr.prototype.createLayerPos_2iooof$=function(t,e){return t.createPos_q7kk9g$(new Pr(e))},Nr.prototype.computeLayerDryRunXYRanges_gl53zg$=function(t,e){var n=Hr().aesthetics_luqwb2$(e).build(),i=this.computeLayerDryRunXYRangesAfterPosAdjustment_0(t,e,n),r=this.computeLayerDryRunXYRangesAfterSizeExpand_0(t,e,n),o=r.component1(),a=r.component2(),s=i.first;null==s?s=o:null!=o&&(s=s.span_d226ot$(o));var l=i.second;return null==l?l=a:null!=a&&(l=l.span_d226ot$(a)),new rt(s,l)},Nr.prototype.combineRanges_0=function(t,e){var n,i,r=null;for(n=t.iterator();n.hasNext();){var o=n.next(),a=e.range_vktour$(o);null!=a&&(r=null!=(i=null!=r?r.span_d226ot$(a):null)?i:a)}return r},Nr.prototype.computeLayerDryRunXYRangesAfterPosAdjustment_0=function(t,n,i){var r,o,a,s=nt.Iterables.toList_yl67zr$(J.Companion.affectingScaleX_shhb9a$(t.renderedAes())),l=nt.Iterables.toList_yl67zr$(J.Companion.affectingScaleY_shhb9a$(t.renderedAes())),u=this.createLayerPos_2iooof$(t,n);if(u.isIdentity){var c=this.combineRanges_0(s,n),p=this.combineRanges_0(l,n);return new rt(c,p)}var _=0,f=0,d=0,m=0,y=!1,$=e.imul(s.size,l.size),v=e.newArray($,null),g=e.newArray($,null);for(r=n.dataPoints().iterator();r.hasNext();){var b=r.next(),w=-1;for(o=s.iterator();o.hasNext();){var x=o.next(),k=b.numeric_vktour$(x);for(a=l.iterator();a.hasNext();){var E=a.next(),C=b.numeric_vktour$(E);v[w=w+1|0]=k,g[w]=C}}for(;w>=0;){if(null!=v[w]&&null!=g[w]){var T=v[w],O=g[w];if(ot.SeriesUtil.isFinite_yrwdxb$(T)&&ot.SeriesUtil.isFinite_yrwdxb$(O)){var N=u.translate_tshsjz$(new h(S(T),S(O)),b,i),P=N.x,A=N.y;if(y){var j=_;_=X.min(P,j);var L=f;f=X.max(P,L);var R=d;d=X.min(A,R);var I=m;m=X.max(A,I)}else _=f=P,d=m=A,y=!0}}w=w-1|0}}var z=y?new Q(_,f):null,D=y?new Q(d,m):null;return new rt(z,D)},Nr.prototype.computeLayerDryRunXYRangesAfterSizeExpand_0=function(t,e,n){var i=t.renderedAes(),r=i.contains_11rb$(J.Companion.WIDTH),o=i.contains_11rb$(J.Companion.HEIGHT),a=r?this.computeLayerDryRunRangeAfterSizeExpand_0(J.Companion.X,J.Companion.WIDTH,e,n):null,s=o?this.computeLayerDryRunRangeAfterSizeExpand_0(J.Companion.Y,J.Companion.HEIGHT,e,n):null;return new rt(a,s)},Nr.prototype.computeLayerDryRunRangeAfterSizeExpand_0=function(t,e,n,i){var r,o=n.numericValues_vktour$(t).iterator(),a=n.numericValues_vktour$(e).iterator(),s=i.getResolution_vktour$(t),l=new Float64Array([at.POSITIVE_INFINITY,at.NEGATIVE_INFINITY]);r=n.dataPointCount();for(var u=0;u=0?_=0:f=0)}var m,y,$,v=p-_,g=null!=(m=null!=u?u.apply_yrwdxb$(v):null)?m:v,b=pt(g)?t.lowerEnd:g,w=h+f,x=null!=($=null!=u?u.apply_yrwdxb$(w):null)?$:w;return y=pt(x)?t.upperEnd:x,new Q(b,y)},Nr.$metadata$={kind:l,simpleName:"PlotUtil",interfaces:[]};var Ar=null;function jr(){return null===Ar&&new Nr,Ar}function Lr(){}function Rr(t,e,n,i,r){B.call(this),this.myAesthetics_0=t,this.myGeom_0=e,this.myPos_0=n,this.myCoord_0=i,this.myGeomContext_0=r}function Ir(t,e){this.variable=t,this.aes=e}function zr(t,e,n,i){Ur(),this.legendTitle_0=t,this.transformedDomain_0=e,this.scale_0=n,this.theme_0=i,this.colorBarOptions_0=null}function Dr(t,e){this.closure$spec=t,Zc.call(this,e)}function Mr(){Br=this,this.DEBUG_DRAWING_0=Qi().LEGEND_DEBUG_DRAWING}Lr.$metadata$={kind:b,simpleName:"PosProviderContext",interfaces:[]},Rr.prototype.buildComponent=function(){this.buildLayer_0()},Rr.prototype.buildLayer_0=function(){this.myGeom_0.build_uzv8ab$(this,this.myAesthetics_0,this.myPos_0,this.myCoord_0,this.myGeomContext_0)},Rr.$metadata$={kind:$,simpleName:"SvgLayerRenderer",interfaces:[_t,B]},Ir.prototype.toString=function(){return"VarBinding{variable="+this.variable+", aes="+this.aes},Ir.prototype.equals=function(t){var n;return this===t||!(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))&&(e.isType(t,Ir)||c(),!!ft(this.variable,t.variable)&&!!ft(this.aes,t.aes))},Ir.prototype.hashCode=function(){var t=dt(this.variable);return(31*t|0)+dt(this.aes)|0},Ir.$metadata$={kind:$,simpleName:"VarBinding",interfaces:[]},Dr.prototype.createLegendBox=function(){var t=new Fs(this.closure$spec);return t.debug=Ur().DEBUG_DRAWING_0,t},Dr.$metadata$={kind:$,interfaces:[Zc]},zr.prototype.createColorBar=function(){var t=this.scale_0;t.hasBreaks()||(t=mt.ScaleBreaksUtil.withBreaks_qt1l9m$(t,this.transformedDomain_0,5));var e=t.getScaleBreaks();if(e.isEmpty)return ep().EMPTY;var n=Ur().createColorBarSpec_6r6r64$(this.legendTitle_0,this.transformedDomain_0,e,t,this.theme_0,this.colorBarOptions_0);return new Dr(n,n.size)},zr.prototype.setOptions_p8ufd2$=function(t){this.colorBarOptions_0=t},Mr.prototype.createColorBarSpec_6r6r64$=function(t,e,n,i,r,o){var a;void 0===o&&(o=null);var s=fo().legendDirection_730mk3$(r)===Rl(),l=null!=o?o.width:null,u=null!=o?o.height:null,c=el().barAbsoluteSize_kkcal5$(s,r);null!=l&&(c=new h(l,c.y)),null!=u&&(c=new h(c.x,u));var p=!s,_=s?Ws().horizontal_dwxw1i$(t,e,n,c,p):Ws().vertical_dwxw1i$(t,e,n,c,p);return new Xs(t,e,n,i,null!=(a=null!=o?o.binCount:null)?a:20,r,_,p)},Mr.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Br=null;function Ur(){return null===Br&&new Mr,Br}function Fr(){Zr.call(this),this.width=null,this.height=null,this.binCount=null}function qr(){this.myAesthetics_0=null,this.myAestheticMappers_0=null,this.myGeomTargetCollector_0=new yt}function Gr(t){this.myAesthetics=t.myAesthetics_0,this.myAestheticMappers=t.myAestheticMappers_0,this.targetCollector_2hnek9$_0=t.myGeomTargetCollector_0}function Hr(t){return t=t||Object.create(qr.prototype),qr.call(t),t}function Yr(){Xr(),this.myBindings_0=p(),this.myConstantByAes_0=new gt,this.myStat_mcjcnw$_0=this.myStat_mcjcnw$_0,this.myPosProvider_gzkpo7$_0=this.myPosProvider_gzkpo7$_0,this.myGeomProvider_h6nr63$_0=this.myGeomProvider_h6nr63$_0,this.myGroupingVarName_0=null,this.myPathIdVarName_0=null,this.myScaleProviderByAes_0=Z(),this.myDataPreprocessor_0=null,this.myLocatorLookupSpec_0=xt.Companion.NONE,this.myContextualMappingProvider_0=au().NONE,this.myIsLegendDisabled_0=!1}function Vr(t,e,n,i,r,o,a,s,l,u,c,p){var h,_;for(this.dataFrame_uc8k26$_0=t,this.myPosProvider_0=n,this.group_btwr86$_0=r,this.scaleMap_9lvzv7$_0=s,this.dataAccess_qkhg5r$_0=l,this.locatorLookupSpec_65qeye$_0=u,this.contextualMapping_1qd07s$_0=c,this.isLegendDisabled_1bnyfg$_0=p,this.geom_ipep5v$_0=e.createGeom(),this.geomKind_qyi6z5$_0=e.geomKind,this.aestheticsDefaults_4lnusm$_0=null,this.myRenderedAes_0=null,this.myConstantByAes_0=null,this.myVarBindingsByAes_0=Z(),this.myRenderedAes_0=q(i),this.aestheticsDefaults_4lnusm$_0=e.aestheticsDefaults(),this.myConstantByAes_0=new gt,h=a.keys_287e2$().iterator();h.hasNext();){var f=h.next();this.myConstantByAes_0.put_ev6mlr$(f,a.get_ex36zt$(f))}for(_=o.iterator();_.hasNext();){var d=_.next(),m=this.myVarBindingsByAes_0,y=d.aes;m.put_xwzc9p$(y,d)}}function Kr(){Wr=this}zr.$metadata$={kind:$,simpleName:"ColorBarAssembler",interfaces:[]},Fr.$metadata$={kind:$,simpleName:"ColorBarOptions",interfaces:[Zr]},qr.prototype.aesthetics_luqwb2$=function(t){return this.myAesthetics_0=t,this},qr.prototype.aestheticMappers_4iu3o$=function(t){return this.myAestheticMappers_0=t,this},qr.prototype.geomTargetCollector_xrq6q$=function(t){return this.myGeomTargetCollector_0=t,this},qr.prototype.build=function(){return new Gr(this)},Object.defineProperty(Gr.prototype,"targetCollector",{configurable:!0,get:function(){return this.targetCollector_2hnek9$_0}}),Gr.prototype.getResolution_vktour$=function(t){var e=0;return null!=this.myAesthetics&&(e=this.myAesthetics.resolution_594811$(t,0)),e<=ot.SeriesUtil.TINY&&(e=this.getUnitResolution_vktour$(t)),e},Gr.prototype.getUnitResolution_vktour$=function(t){var e,n,i;return"number"==typeof(i=(null!=(n=null!=(e=this.myAestheticMappers)?e.get_11rb$(t):null)?n:u.Mappers.IDENTITY)(1))?i:c()},Gr.prototype.withTargetCollector_xrq6q$=function(t){return Hr().aesthetics_luqwb2$(this.myAesthetics).aestheticMappers_4iu3o$(this.myAestheticMappers).geomTargetCollector_xrq6q$(t).build()},Gr.prototype.with=function(){return t=this,e=e||Object.create(qr.prototype),qr.call(e),e.myAesthetics_0=t.myAesthetics,e.myAestheticMappers_0=t.myAestheticMappers,e;var t,e},Gr.$metadata$={kind:$,simpleName:"MyGeomContext",interfaces:[no]},qr.$metadata$={kind:$,simpleName:"GeomContextBuilder",interfaces:[io]},Object.defineProperty(Yr.prototype,"myStat_0",{configurable:!0,get:function(){return null==this.myStat_mcjcnw$_0?F("myStat"):this.myStat_mcjcnw$_0},set:function(t){this.myStat_mcjcnw$_0=t}}),Object.defineProperty(Yr.prototype,"myPosProvider_0",{configurable:!0,get:function(){return null==this.myPosProvider_gzkpo7$_0?F("myPosProvider"):this.myPosProvider_gzkpo7$_0},set:function(t){this.myPosProvider_gzkpo7$_0=t}}),Object.defineProperty(Yr.prototype,"myGeomProvider_0",{configurable:!0,get:function(){return null==this.myGeomProvider_h6nr63$_0?F("myGeomProvider"):this.myGeomProvider_h6nr63$_0},set:function(t){this.myGeomProvider_h6nr63$_0=t}}),Yr.prototype.stat_qbwusa$=function(t){return this.myStat_0=t,this},Yr.prototype.pos_r08v3h$=function(t){return this.myPosProvider_0=t,this},Yr.prototype.geom_9dfz59$=function(t){return this.myGeomProvider_0=t,this},Yr.prototype.addBinding_14cn14$=function(t){return this.myBindings_0.add_11rb$(t),this},Yr.prototype.groupingVar_8xm3sj$=function(t){return this.myGroupingVarName_0=t.name,this},Yr.prototype.groupingVarName_61zpoe$=function(t){return this.myGroupingVarName_0=t,this},Yr.prototype.pathIdVarName_61zpoe$=function(t){return this.myPathIdVarName_0=t,this},Yr.prototype.addConstantAes_bbdhip$=function(t,e){return this.myConstantByAes_0.put_ev6mlr$(t,e),this},Yr.prototype.addScaleProvider_jv3qxe$=function(t,e){return this.myScaleProviderByAes_0.put_xwzc9p$(t,e),this},Yr.prototype.locatorLookupSpec_271kgc$=function(t){return this.myLocatorLookupSpec_0=t,this},Yr.prototype.contextualMappingProvider_td8fxc$=function(t){return this.myContextualMappingProvider_0=t,this},Yr.prototype.disableLegend_6taknv$=function(t){return this.myIsLegendDisabled_0=t,this},Yr.prototype.build_fhj1j$=function(t,e){var n,i,r=t;null!=this.myDataPreprocessor_0&&(r=S(this.myDataPreprocessor_0)(r,e)),r=ms().transformOriginals_si9pes$(r,this.myBindings_0,e);var o,s=this.myBindings_0,l=y(m(s,10));for(o=s.iterator();o.hasNext();){var u,c,h=o.next(),_=l.add_11rb$;c=h.aes,u=h.variable.isOrigin?new Ir(a.DataFrameUtil.transformVarFor_896ixz$(h.aes),h.aes):h,_.call(l,$t(c,u))}var f=lt(vt(l)),d=p();for(n=f.values.iterator();n.hasNext();){var $=n.next(),v=$.variable;if(v.isStat){var g=$.aes,b=e.get_31786j$(g);r=a.DataFrameUtil.applyTransform_xaiv89$(r,v,g,b),d.add_11rb$(new Ir(a.TransformVar.forAes_896ixz$(g),g))}}for(i=d.iterator();i.hasNext();){var w=i.next(),x=w.aes;f.put_xwzc9p$(x,w)}var k=new Xa(r,f,e);return new Vr(r,this.myGeomProvider_0,this.myPosProvider_0,this.myGeomProvider_0.renders(),new Es(r,this.myBindings_0,this.myGroupingVarName_0,this.myPathIdVarName_0,this.handlesGroups_0()).groupMapper,f.values,this.myConstantByAes_0,e,k,this.myLocatorLookupSpec_0,this.myContextualMappingProvider_0.createContextualMapping_8fr62e$(k,r),this.myIsLegendDisabled_0)},Yr.prototype.handlesGroups_0=function(){return this.myGeomProvider_0.handlesGroups()||this.myPosProvider_0.handlesGroups()},Object.defineProperty(Vr.prototype,"dataFrame",{get:function(){return this.dataFrame_uc8k26$_0}}),Object.defineProperty(Vr.prototype,"group",{get:function(){return this.group_btwr86$_0}}),Object.defineProperty(Vr.prototype,"scaleMap",{get:function(){return this.scaleMap_9lvzv7$_0}}),Object.defineProperty(Vr.prototype,"dataAccess",{get:function(){return this.dataAccess_qkhg5r$_0}}),Object.defineProperty(Vr.prototype,"locatorLookupSpec",{get:function(){return this.locatorLookupSpec_65qeye$_0}}),Object.defineProperty(Vr.prototype,"contextualMapping",{get:function(){return this.contextualMapping_1qd07s$_0}}),Object.defineProperty(Vr.prototype,"isLegendDisabled",{get:function(){return this.isLegendDisabled_1bnyfg$_0}}),Object.defineProperty(Vr.prototype,"geom",{configurable:!0,get:function(){return this.geom_ipep5v$_0}}),Object.defineProperty(Vr.prototype,"geomKind",{configurable:!0,get:function(){return this.geomKind_qyi6z5$_0}}),Object.defineProperty(Vr.prototype,"aestheticsDefaults",{configurable:!0,get:function(){return this.aestheticsDefaults_4lnusm$_0}}),Object.defineProperty(Vr.prototype,"legendKeyElementFactory",{configurable:!0,get:function(){return this.geom.legendKeyElementFactory}}),Object.defineProperty(Vr.prototype,"isLiveMap",{configurable:!0,get:function(){return e.isType(this.geom,tt)}}),Vr.prototype.renderedAes=function(){return this.myRenderedAes_0},Vr.prototype.createPos_q7kk9g$=function(t){return this.myPosProvider_0.createPos_q7kk9g$(t)},Vr.prototype.hasBinding_896ixz$=function(t){return this.myVarBindingsByAes_0.containsKey_11rb$(t)},Vr.prototype.getBinding_31786j$=function(t){return S(this.myVarBindingsByAes_0.get_11rb$(t))},Vr.prototype.hasConstant_896ixz$=function(t){return this.myConstantByAes_0.containsKey_ex36zt$(t)},Vr.prototype.getConstant_31786j$=function(t){if(!this.hasConstant_896ixz$(t))throw G(("Constant value is not defined for aes "+t).toString());return this.myConstantByAes_0.get_ex36zt$(t)},Vr.prototype.getDefault_31786j$=function(t){return this.aestheticsDefaults.defaultValue_31786j$(t)},Vr.prototype.rangeIncludesZero_896ixz$=function(t){return this.aestheticsDefaults.rangeIncludesZero_896ixz$(t)},Vr.prototype.setLiveMapProvider_kld0fp$=function(t){if(!e.isType(this.geom,tt))throw d("Not Livemap: "+e.getKClassFromExpression(this.geom).simpleName);this.geom.setLiveMapProvider_kld0fp$(t)},Vr.$metadata$={kind:$,simpleName:"MyGeomLayer",interfaces:[or]},Kr.prototype.demoAndTest=function(){var t,e=new Yr;return e.myDataPreprocessor_0=(t=e,function(e,n){var i=ms().transformOriginals_si9pes$(e,t.myBindings_0,n),r=t.myStat_0;if(ft(r,bt.Stats.IDENTITY))return i;var o=new wt(i),a=new Es(i,t.myBindings_0,t.myGroupingVarName_0,t.myPathIdVarName_0,!0);return ms().buildStatData_x40e2x$(i,r,t.myBindings_0,n,a,Lo().undefined(),o,et(),et(),null,z("println",(function(t){return s(t),W}))).data}),e},Kr.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Wr=null;function Xr(){return null===Wr&&new Kr,Wr}function Zr(){eo(),this.isReverse=!1}function Jr(){to=this,this.NONE=new Qr}function Qr(){Zr.call(this)}Yr.$metadata$={kind:$,simpleName:"GeomLayerBuilder",interfaces:[]},Qr.$metadata$={kind:$,interfaces:[Zr]},Jr.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var to=null;function eo(){return null===to&&new Jr,to}function no(){}function io(){}function ro(t,e,n){co(),this.legendTitle_0=t,this.guideOptionsMap_0=e,this.theme_0=n,this.legendLayers_0=p()}function oo(t,e){this.closure$spec=t,Zc.call(this,e)}function ao(t,e,n,i,r,o){var a,s;this.keyElementFactory_8be2vx$=t,this.varBindings_0=e,this.constantByAes_0=n,this.aestheticsDefaults_0=i,this.scaleMap_0=r,this.keyAesthetics_8be2vx$=null,this.keyLabels_8be2vx$=null;var l=Et();for(a=this.varBindings_0.iterator();a.hasNext();){var c=a.next().aes,p=this.scaleMap_0.get_31786j$(c);if(p.hasBreaks()||(p=mt.ScaleBreaksUtil.withBreaks_qt1l9m$(p,Ct(o,c),5)),!p.hasBreaks())throw d(("No breaks were defined for scale "+c).toString());var h=p.getScaleBreaks(),_=u.ScaleUtil.map_9ksyxk$(h.transformedValues,p),f=h.labels;for(s=St(f,_).iterator();s.hasNext();){var m,y=s.next(),$=y.component1(),v=y.component2(),g=l.get_11rb$($);if(null==g){var b=Z();l.put_xwzc9p$($,b),m=b}else m=g;var w=m,x=S(v);w.put_xwzc9p$(c,x)}}this.keyAesthetics_8be2vx$=fo().mapToAesthetics_8kbmqf$(l.values,this.constantByAes_0,this.aestheticsDefaults_0),this.keyLabels_8be2vx$=q(l.keys)}function so(){uo=this,this.DEBUG_DRAWING_0=Qi().LEGEND_DEBUG_DRAWING}function lo(t){var e=t.x/2,n=2*X.floor(e)+1+1,i=t.y/2;return new h(n,2*X.floor(i)+1+1)}Zr.$metadata$={kind:$,simpleName:"GuideOptions",interfaces:[]},io.$metadata$={kind:b,simpleName:"Builder",interfaces:[]},no.$metadata$={kind:b,simpleName:"ImmutableGeomContext",interfaces:[kt]},ro.prototype.addLayer_446ka8$=function(t,e,n,i,r,o){this.legendLayers_0.add_11rb$(new ao(t,e,n,i,r,o))},oo.prototype.createLegendBox=function(){var t=new gl(this.closure$spec);return t.debug=co().DEBUG_DRAWING_0,t},oo.$metadata$={kind:$,interfaces:[Zc]},ro.prototype.createLegend=function(){var t,n,i,r,o,a,s=Et();for(t=this.legendLayers_0.iterator();t.hasNext();){var l=t.next(),u=l.keyElementFactory_8be2vx$,h=l.keyAesthetics_8be2vx$.dataPoints().iterator();for(n=l.keyLabels_8be2vx$.iterator();n.hasNext();){var _,f=n.next(),d=s.get_11rb$(f);if(null==d){var m=new dl(f);s.put_xwzc9p$(f,m),_=m}else _=d;_.addLayer_w0u015$(h.next(),u)}}var y=p();for(i=s.values.iterator();i.hasNext();){var $=i.next();$.isEmpty||y.add_11rb$($)}if(y.isEmpty())return ep().EMPTY;var v=p();for(r=this.legendLayers_0.iterator();r.hasNext();)for(o=r.next().aesList_8be2vx$.iterator();o.hasNext();){var g=o.next();e.isType(this.guideOptionsMap_0.get_11rb$(g),mo)&&v.add_11rb$(e.isType(a=this.guideOptionsMap_0.get_11rb$(g),mo)?a:c())}var b=co().createLegendSpec_esqxbx$(this.legendTitle_0,y,this.theme_0,vo().combine_pmdc6s$(v));return new oo(b,b.size)},Object.defineProperty(ao.prototype,"aesList_8be2vx$",{configurable:!0,get:function(){var t,e=this.varBindings_0,n=y(m(e,10));for(t=e.iterator();t.hasNext();){var i=t.next();n.add_11rb$(i.aes)}return n}}),ao.$metadata$={kind:$,simpleName:"LegendLayer",interfaces:[]},so.prototype.createLegendSpec_esqxbx$=function(t,e,n,i){var r,o,a;void 0===i&&(i=new mo);var s=fo().legendDirection_730mk3$(n),l=lo,u=new h(n.keySize(),n.keySize());for(r=e.iterator();r.hasNext();){var c=r.next().minimumKeySize;u=u.max_gpjtzr$(l(c))}var p,_,f,d=e.size;if(i.isByRow){if(i.hasColCount()){var m=i.colCount;o=X.min(m,d)}else if(i.hasRowCount()){var y=d/i.rowCount;o=Tt(X.ceil(y))}else o=s===Rl()?d:1;var $=d/(p=o);_=Tt(X.ceil($))}else{if(i.hasRowCount()){var v=i.rowCount;a=X.min(v,d)}else if(i.hasColCount()){var g=d/i.colCount;a=Tt(X.ceil(g))}else a=s!==Rl()?d:1;var b=d/(_=a);p=Tt(X.ceil(b))}return(f=s===Rl()?i.hasRowCount()||i.hasColCount()&&i.colCount1)for(i=this.createNameLevelTuples_5cxrh4$(t.subList_vux9f0$(1,t.size),e.subList_vux9f0$(1,e.size)).iterator();i.hasNext();){var l=i.next();a.add_11rb$(Dt(zt($t(r,s)),l))}else a.add_11rb$(zt($t(r,s)))}return a},Po.prototype.reorderLevels_dyo1lv$=function(t,e,n){for(var i=vt(St(t,n)),r=p(),o=0,a=t.iterator();a.hasNext();++o){var s=a.next();if(o>=e.size)break;r.add_11rb$(this.reorderVarLevels_pbdvt$(s,e.get_za3lpa$(o),Ct(i,s)))}return r},Po.prototype.reorderVarLevels_pbdvt$=function(t,n,i){return null==t?n:(e.isType(n,Mt)||c(),i<0?Bt(n):Ut(n))},Po.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var jo=null;function Lo(){return null===jo&&new Po,jo}function Ro(t,e,n,i,r,o,a){this.col=t,this.row=e,this.colLabs=n,this.rowLab=i,this.xAxis=r,this.yAxis=o,this.trueIndex=a}function Io(){zo=this}Ro.prototype.toString=function(){return"FacetTileInfo(col="+this.col+", row="+this.row+", colLabs="+this.colLabs+", rowLab="+f(this.rowLab)+")"},Ro.$metadata$={kind:$,simpleName:"FacetTileInfo",interfaces:[]},No.$metadata$={kind:$,simpleName:"PlotFacets",interfaces:[]},Io.prototype.mappedRenderedAesToCreateGuides_rf697z$=function(t,e){var n;if(t.isLegendDisabled)return et();var i=p();for(n=t.renderedAes().iterator();n.hasNext();){var r=n.next();J.Companion.noGuideNeeded_896ixz$(r)||t.hasConstant_896ixz$(r)||t.hasBinding_896ixz$(r)&&(e.containsKey_11rb$(r)&&e.get_11rb$(r)===eo().NONE||i.add_11rb$(r))}return i},Io.prototype.guideTransformedDomainByAes_rf697z$=function(t,e){var n,i=Z();for(n=this.mappedRenderedAesToCreateGuides_rf697z$(t,e).iterator();n.hasNext();){var r=n.next(),o=t.getBinding_896ixz$(r).variable;if(!o.isTransform)throw d("Check failed.".toString());var a=t.getDataRange_8xm3sj$(o),s=t.getScale_896ixz$(r);if(s.isContinuousDomain){var l=this.refineTransformedDataRangeForContinuousDomain_0(a,s);i.put_xwzc9p$(r,l)}else null!=a&&i.put_xwzc9p$(r,a)}return i},Io.prototype.refineTransformedDataRangeForContinuousDomain_0=function(t,n){var i,r,o=null==t?new Ft(at.NaN,at.NaN):new Ft(t.lowerEnd,t.upperEnd),a=o.component1(),s=o.component2(),l=!0===n.hasDomainLimits()?u.ScaleUtil.transformedDefinedLimits_x4zrm4$(n):new Ft(at.NaN,at.NaN),p=l.component1(),h=l.component2(),f=_(p)?p:a,d=_(h)?h:s,m=_(f)&&_(d)?new Q(f,d):_(f)?new Q(f,f):_(d)?new Q(d,d):null;return r=e.isType(i=n.transform,ct)?i:c(),qt.Transforms.ensureApplicableDomain_wa8y5m$(m,r)},Io.prototype.createColorBarAssembler_mzqjql$=function(t,e,n,i,r,o){var a=n.get_11rb$(e);if(null==a)throw d("Domain for continuous data must not be null".toString());var s=new zr(t,a,i,o);return s.setOptions_p8ufd2$(r),s},Io.prototype.fitsColorBar_k9b7d3$=function(t,e){return t.isColor&&e.isContinuous},Io.prototype.checkFitsColorBar_k9b7d3$=function(t,e){if(!t.isColor)throw d(("Color-bar is not applicable to "+t+" aesthetic").toString());if(!e.isContinuous)throw d("Color-bar is only applicable when both domain and color palette are continuous".toString())},Io.$metadata$={kind:l,simpleName:"PlotGuidesAssemblerUtil",interfaces:[]};var zo=null;function Do(){return null===zo&&new Io,zo}function Mo(){Wo()}function Bo(){Ko=this}function Uo(t){this.closure$pos=t,Mo.call(this)}function Fo(){Mo.call(this)}function qo(t){this.closure$width=t,Mo.call(this)}function Go(){Mo.call(this)}function Ho(t,e){this.closure$width=t,this.closure$height=e,Mo.call(this)}function Yo(t,e){this.closure$width=t,this.closure$height=e,Mo.call(this)}function Vo(t,e,n){this.closure$width=t,this.closure$jitterWidth=e,this.closure$jitterHeight=n,Mo.call(this)}Uo.prototype.createPos_q7kk9g$=function(t){return this.closure$pos},Uo.prototype.handlesGroups=function(){return this.closure$pos.handlesGroups()},Uo.$metadata$={kind:$,interfaces:[Mo]},Bo.prototype.wrap_dkjclg$=function(t){return new Uo(t)},Fo.prototype.createPos_q7kk9g$=function(t){return Gt.PositionAdjustments.stack_4vnpmn$(t.aesthetics,Ht.SPLIT_POSITIVE_NEGATIVE)},Fo.prototype.handlesGroups=function(){return Yt.STACK.handlesGroups()},Fo.$metadata$={kind:$,interfaces:[Mo]},Bo.prototype.barStack=function(){return new Fo},qo.prototype.createPos_q7kk9g$=function(t){var e=t.aesthetics,n=t.groupCount;return Gt.PositionAdjustments.dodge_vvhcz8$(e,n,this.closure$width)},qo.prototype.handlesGroups=function(){return Yt.DODGE.handlesGroups()},qo.$metadata$={kind:$,interfaces:[Mo]},Bo.prototype.dodge_yrwdxb$=function(t){return void 0===t&&(t=null),new qo(t)},Go.prototype.createPos_q7kk9g$=function(t){return Gt.PositionAdjustments.fill_m7huy5$(t.aesthetics)},Go.prototype.handlesGroups=function(){return Yt.FILL.handlesGroups()},Go.$metadata$={kind:$,interfaces:[Mo]},Bo.prototype.fill=function(){return new Go},Ho.prototype.createPos_q7kk9g$=function(t){return Gt.PositionAdjustments.jitter_jma9l8$(this.closure$width,this.closure$height)},Ho.prototype.handlesGroups=function(){return Yt.JITTER.handlesGroups()},Ho.$metadata$={kind:$,interfaces:[Mo]},Bo.prototype.jitter_jma9l8$=function(t,e){return new Ho(t,e)},Yo.prototype.createPos_q7kk9g$=function(t){return Gt.PositionAdjustments.nudge_jma9l8$(this.closure$width,this.closure$height)},Yo.prototype.handlesGroups=function(){return Yt.NUDGE.handlesGroups()},Yo.$metadata$={kind:$,interfaces:[Mo]},Bo.prototype.nudge_jma9l8$=function(t,e){return new Yo(t,e)},Vo.prototype.createPos_q7kk9g$=function(t){var e=t.aesthetics,n=t.groupCount;return Gt.PositionAdjustments.jitterDodge_e2pc44$(e,n,this.closure$width,this.closure$jitterWidth,this.closure$jitterHeight)},Vo.prototype.handlesGroups=function(){return Yt.JITTER_DODGE.handlesGroups()},Vo.$metadata$={kind:$,interfaces:[Mo]},Bo.prototype.jitterDodge_xjrefz$=function(t,e,n){return new Vo(t,e,n)},Bo.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Ko=null;function Wo(){return null===Ko&&new Bo,Ko}function Xo(t){this.myLayers_0=null,this.myLayers_0=q(t)}function Zo(t){ta(),this.myMap_0=Vt(t)}function Jo(){Qo=this,this.LOG_0=D.PortableLogging.logger_xo1ogr$(M(Zo))}Mo.$metadata$={kind:$,simpleName:"PosProvider",interfaces:[]},Object.defineProperty(Xo.prototype,"legendKeyElementFactory",{configurable:!0,get:function(){if(this.myLayers_0.isEmpty())throw d("Check failed.".toString());return this.myLayers_0.get_za3lpa$(0).legendKeyElementFactory}}),Object.defineProperty(Xo.prototype,"aestheticsDefaults",{configurable:!0,get:function(){if(this.myLayers_0.isEmpty())throw d("Check failed.".toString());return this.myLayers_0.get_za3lpa$(0).aestheticsDefaults}}),Object.defineProperty(Xo.prototype,"isLegendDisabled",{configurable:!0,get:function(){if(this.myLayers_0.isEmpty())throw d("Check failed.".toString());return this.myLayers_0.get_za3lpa$(0).isLegendDisabled}}),Xo.prototype.renderedAes=function(){return this.myLayers_0.isEmpty()?et():this.myLayers_0.get_za3lpa$(0).renderedAes()},Xo.prototype.hasBinding_896ixz$=function(t){return!this.myLayers_0.isEmpty()&&this.myLayers_0.get_za3lpa$(0).hasBinding_896ixz$(t)},Xo.prototype.hasConstant_896ixz$=function(t){return!this.myLayers_0.isEmpty()&&this.myLayers_0.get_za3lpa$(0).hasConstant_896ixz$(t)},Xo.prototype.getConstant_31786j$=function(t){if(this.myLayers_0.isEmpty())throw d("Check failed.".toString());return this.myLayers_0.get_za3lpa$(0).getConstant_31786j$(t)},Xo.prototype.getBinding_896ixz$=function(t){if(this.myLayers_0.isEmpty())throw d("Check failed.".toString());return this.myLayers_0.get_za3lpa$(0).getBinding_31786j$(t)},Xo.prototype.getScale_896ixz$=function(t){if(this.myLayers_0.isEmpty())throw d("Check failed.".toString());return this.myLayers_0.get_za3lpa$(0).scaleMap.get_31786j$(t)},Xo.prototype.getScaleMap=function(){if(this.myLayers_0.isEmpty())throw d("Check failed.".toString());return this.myLayers_0.get_za3lpa$(0).scaleMap},Xo.prototype.getDataRange_8xm3sj$=function(t){var e;if(!this.isNumericData_0(t))throw d(("Not numeric data ["+t+"]").toString());var n=null;for(e=this.myLayers_0.iterator();e.hasNext();){var i=e.next().dataFrame.range_8xm3sj$(t);n=ot.SeriesUtil.span_t7esj2$(n,i)}return n},Xo.prototype.isNumericData_0=function(t){var e;if(this.myLayers_0.isEmpty())throw d("Check failed.".toString());for(e=this.myLayers_0.iterator();e.hasNext();)if(!e.next().dataFrame.isNumeric_8xm3sj$(t))return!1;return!0},Xo.$metadata$={kind:$,simpleName:"StitchedPlotLayers",interfaces:[]},Zo.prototype.get_31786j$=function(t){var n,i,r;if(null==(i=e.isType(n=this.myMap_0.get_11rb$(t),g)?n:null)){var o="No scale found for aes: "+t;throw ta().LOG_0.error_l35kib$(d(o),(r=o,function(){return r})),d(o.toString())}return i},Zo.prototype.containsKey_896ixz$=function(t){return this.myMap_0.containsKey_11rb$(t)},Zo.prototype.keySet=function(){return this.myMap_0.keys},Jo.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Qo=null;function ta(){return null===Qo&&new Jo,Qo}function ea(t,n,i,r,o,a,s,l){void 0===s&&(s=Lo().DEF_FORMATTER),void 0===l&&(l=Lo().DEF_FORMATTER),No.call(this),this.xVar_0=t,this.yVar_0=n,this.xFormatter_0=s,this.yFormatter_0=l,this.isDefined_f95yff$_0=null!=this.xVar_0||null!=this.yVar_0,this.xLevels_0=Lo().reorderVarLevels_pbdvt$(this.xVar_0,i,o),this.yLevels_0=Lo().reorderVarLevels_pbdvt$(this.yVar_0,r,a);var u=i.size;this.colCount_bhcvpt$_0=X.max(1,u);var c=r.size;this.rowCount_8ohw8b$_0=X.max(1,c),this.numTiles_kasr4x$_0=e.imul(this.colCount,this.rowCount)}Zo.$metadata$={kind:$,simpleName:"TypedScaleMap",interfaces:[]},Object.defineProperty(ea.prototype,"isDefined",{configurable:!0,get:function(){return this.isDefined_f95yff$_0}}),Object.defineProperty(ea.prototype,"colCount",{configurable:!0,get:function(){return this.colCount_bhcvpt$_0}}),Object.defineProperty(ea.prototype,"rowCount",{configurable:!0,get:function(){return this.rowCount_8ohw8b$_0}}),Object.defineProperty(ea.prototype,"numTiles",{configurable:!0,get:function(){return this.numTiles_kasr4x$_0}}),Object.defineProperty(ea.prototype,"variables",{configurable:!0,get:function(){return Kt([this.xVar_0,this.yVar_0])}}),ea.prototype.dataByTile_dhhkv7$=function(t){var e,n,i,r;if(!this.isDefined)throw G("dataByTile() called on Undefined plot facets.".toString());e=Kt([this.xVar_0,this.yVar_0]),n=Kt([null!=this.xVar_0?this.xLevels_0:null,null!=this.yVar_0?this.yLevels_0:null]);var o=Lo().dataByLevelTuple_w4sfrb$(t,e,n),a=vt(o),s=this.xLevels_0,l=s.isEmpty()?zt(null):s,u=this.yLevels_0,c=u.isEmpty()?zt(null):u,h=p();for(i=c.iterator();i.hasNext();){var _=i.next();for(r=l.iterator();r.hasNext();){var f=r.next(),d=Kt([f,_]),m=Ct(a,d);h.add_11rb$(m)}}return h},ea.prototype.tileInfos=function(){var t,e,n,i,r,o=this.xLevels_0,a=o.isEmpty()?zt(null):o,s=y(m(a,10));for(r=a.iterator();r.hasNext();){var l=r.next();s.add_11rb$(null!=l?this.xFormatter_0(l):null)}var u,c=s,h=this.yLevels_0,_=h.isEmpty()?zt(null):h,f=y(m(_,10));for(u=_.iterator();u.hasNext();){var d=u.next();f.add_11rb$(null!=d?this.yFormatter_0(d):null)}var $=f,v=p();t=this.rowCount;for(var g=0;g=e.numTiles}}(function(t){return function(n,i){var r;switch(t.direction_0.name){case"H":r=e.imul(i,t.colCount)+n|0;break;case"V":r=e.imul(n,t.rowCount)+i|0;break;default:r=e.noWhenBranchMatched()}return r}}(this),this),E=p(),C=0,S=b.iterator();S.hasNext();++C){var T=S.next(),O=w(C),N=x(C),P=k(O,N),A=0===O;E.add_11rb$(new Ro(O,N,T,null,P,A,C))}return Wt(E,new te(oa(new te(ra(sa)),la)))},ua.$metadata$={kind:$,simpleName:"Direction",interfaces:[Xt]},ua.values=function(){return[pa(),ha()]},ua.valueOf_61zpoe$=function(t){switch(t){case"H":return pa();case"V":return ha();default:Zt("No enum constant jetbrains.datalore.plot.builder.assemble.facet.FacetWrap.Direction."+t)}},_a.prototype.numTiles_0=function(t,e){if(t.isEmpty())throw G("List of facets is empty.".toString());if(It(t).size!==t.size)throw G(("Duplicated values in the facets list: "+t).toString());if(t.size!==e.size)throw d("Check failed.".toString());return Lo().createNameLevelTuples_5cxrh4$(t,e).size},_a.prototype.shape_0=function(t,n,i,r){var o,a,s,l,u,c;if(null!=(o=null!=n?n>0:null)&&!o){var p=(u=n,function(){return"'ncol' must be positive, was "+f(u)})();throw G(p.toString())}if(null!=(a=null!=i?i>0:null)&&!a){var h=(c=i,function(){return"'nrow' must be positive, was "+f(c)})();throw G(h.toString())}if(null!=n){var _=X.min(n,t),d=t/_,m=Tt(X.ceil(d));s=$t(_,X.max(1,m))}else if(null!=i){var y=X.min(i,t),$=t/y,v=Tt(X.ceil($));s=$t(v,X.max(1,y))}else{var g=t/2|0,b=X.max(1,g),w=X.min(4,b),x=t/w,k=Tt(X.ceil(x)),E=X.max(1,k);s=$t(w,E)}var C=s,S=C.component1(),T=C.component2();switch(r.name){case"H":var O=t/S;l=new Ft(S,Tt(X.ceil(O)));break;case"V":var N=t/T;l=new Ft(Tt(X.ceil(N)),T);break;default:l=e.noWhenBranchMatched()}return l},_a.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var fa=null;function da(){return null===fa&&new _a,fa}function ma(){ya=this,this.SEED_0=ee,this.SAFETY_SAMPLING=w_().random_280ow0$(2e5,this.SEED_0),this.POINT=w_().random_280ow0$(5e4,this.SEED_0),this.TILE=w_().random_280ow0$(5e4,this.SEED_0),this.BIN_2D=this.TILE,this.AB_LINE=w_().random_280ow0$(5e3,this.SEED_0),this.H_LINE=w_().random_280ow0$(5e3,this.SEED_0),this.V_LINE=w_().random_280ow0$(5e3,this.SEED_0),this.JITTER=w_().random_280ow0$(5e3,this.SEED_0),this.RECT=w_().random_280ow0$(5e3,this.SEED_0),this.SEGMENT=w_().random_280ow0$(5e3,this.SEED_0),this.TEXT=w_().random_280ow0$(500,this.SEED_0),this.ERROR_BAR=w_().random_280ow0$(500,this.SEED_0),this.CROSS_BAR=w_().random_280ow0$(500,this.SEED_0),this.LINE_RANGE=w_().random_280ow0$(500,this.SEED_0),this.POINT_RANGE=w_().random_280ow0$(500,this.SEED_0),this.BAR=w_().pick_za3lpa$(50),this.HISTOGRAM=w_().systematic_za3lpa$(500),this.LINE=w_().systematic_za3lpa$(5e3),this.RIBBON=w_().systematic_za3lpa$(5e3),this.AREA=w_().systematic_za3lpa$(5e3),this.DENSITY=w_().systematic_za3lpa$(5e3),this.FREQPOLY=w_().systematic_za3lpa$(5e3),this.STEP=w_().systematic_za3lpa$(5e3),this.PATH=w_().vertexDp_za3lpa$(2e4),this.POLYGON=w_().vertexDp_za3lpa$(2e4),this.MAP=w_().vertexDp_za3lpa$(2e4),this.SMOOTH=w_().systematicGroup_za3lpa$(200),this.CONTOUR=w_().systematicGroup_za3lpa$(200),this.CONTOURF=w_().systematicGroup_za3lpa$(200),this.DENSITY2D=w_().systematicGroup_za3lpa$(200),this.DENSITY2DF=w_().systematicGroup_za3lpa$(200)}aa.$metadata$={kind:$,simpleName:"FacetWrap",interfaces:[No]},ma.$metadata$={kind:l,simpleName:"DefaultSampling",interfaces:[]};var ya=null;function $a(t){Wa(),this.geomKind=t}function va(t,e,n,i){this.myKind_0=t,this.myAestheticsDefaults_0=e,this.myHandlesGroups_0=n,this.myGeomSupplier_0=i}function ga(t,e){this.this$GeomProviderBuilder=t,$a.call(this,e)}function ba(){Ka=this}function wa(){return new ie}function xa(){return new ae}function ka(){return new se}function Ea(){return new le}function Ca(){return new ue}function Sa(){return new ce}function Ta(){return new pe}function Oa(){return new he}function Na(){return new _e}function Pa(){return new de}function Aa(){return new ye}function ja(){return new $e}function La(){return new ve}function Ra(){return new ge}function Ia(){return new be}function za(){return new we}function Da(){return new xe}function Ma(){return new Ee}function Ba(){return new Ce}function Ua(){return new Se}function Fa(){return new Te}function qa(){return new Oe}function Ga(){return new Ne}function Ha(){return new Pe}function Ya(){return new je}function Va(){return new Ie}Object.defineProperty($a.prototype,"preferredCoordinateSystem",{configurable:!0,get:function(){throw d("No preferred coordinate system")}}),$a.prototype.renders=function(){return ne.GeomMeta.renders_7dhqpi$(this.geomKind)},ga.prototype.createGeom=function(){return this.this$GeomProviderBuilder.myGeomSupplier_0()},ga.prototype.aestheticsDefaults=function(){return this.this$GeomProviderBuilder.myAestheticsDefaults_0},ga.prototype.handlesGroups=function(){return this.this$GeomProviderBuilder.myHandlesGroups_0},ga.$metadata$={kind:$,interfaces:[$a]},va.prototype.build_8be2vx$=function(){return new ga(this,this.myKind_0)},va.$metadata$={kind:$,simpleName:"GeomProviderBuilder",interfaces:[]},ba.prototype.point=function(){return this.point_8j1y0m$(wa)},ba.prototype.point_8j1y0m$=function(t){return new va(re.POINT,oe.Companion.point(),ie.Companion.HANDLES_GROUPS,t).build_8be2vx$()},ba.prototype.path=function(){return this.path_8j1y0m$(xa)},ba.prototype.path_8j1y0m$=function(t){return new va(re.PATH,oe.Companion.path(),ae.Companion.HANDLES_GROUPS,t).build_8be2vx$()},ba.prototype.line=function(){return new va(re.LINE,oe.Companion.line(),se.Companion.HANDLES_GROUPS,ka).build_8be2vx$()},ba.prototype.smooth=function(){return new va(re.SMOOTH,oe.Companion.smooth(),le.Companion.HANDLES_GROUPS,Ea).build_8be2vx$()},ba.prototype.bar=function(){return new va(re.BAR,oe.Companion.bar(),ue.Companion.HANDLES_GROUPS,Ca).build_8be2vx$()},ba.prototype.histogram=function(){return new va(re.HISTOGRAM,oe.Companion.histogram(),ce.Companion.HANDLES_GROUPS,Sa).build_8be2vx$()},ba.prototype.tile=function(){return new va(re.TILE,oe.Companion.tile(),pe.Companion.HANDLES_GROUPS,Ta).build_8be2vx$()},ba.prototype.bin2d=function(){return new va(re.BIN_2D,oe.Companion.bin2d(),he.Companion.HANDLES_GROUPS,Oa).build_8be2vx$()},ba.prototype.errorBar=function(){return new va(re.ERROR_BAR,oe.Companion.errorBar(),_e.Companion.HANDLES_GROUPS,Na).build_8be2vx$()},ba.prototype.crossBar_8j1y0m$=function(t){return new va(re.CROSS_BAR,oe.Companion.crossBar(),fe.Companion.HANDLES_GROUPS,t).build_8be2vx$()},ba.prototype.lineRange=function(){return new va(re.LINE_RANGE,oe.Companion.lineRange(),de.Companion.HANDLES_GROUPS,Pa).build_8be2vx$()},ba.prototype.pointRange_8j1y0m$=function(t){return new va(re.POINT_RANGE,oe.Companion.pointRange(),me.Companion.HANDLES_GROUPS,t).build_8be2vx$()},ba.prototype.contour=function(){return new va(re.CONTOUR,oe.Companion.contour(),ye.Companion.HANDLES_GROUPS,Aa).build_8be2vx$()},ba.prototype.contourf=function(){return new va(re.CONTOURF,oe.Companion.contourf(),$e.Companion.HANDLES_GROUPS,ja).build_8be2vx$()},ba.prototype.polygon=function(){return new va(re.POLYGON,oe.Companion.polygon(),ve.Companion.HANDLES_GROUPS,La).build_8be2vx$()},ba.prototype.map=function(){return new va(re.MAP,oe.Companion.map(),ge.Companion.HANDLES_GROUPS,Ra).build_8be2vx$()},ba.prototype.abline=function(){return new va(re.AB_LINE,oe.Companion.abline(),be.Companion.HANDLES_GROUPS,Ia).build_8be2vx$()},ba.prototype.hline=function(){return new va(re.H_LINE,oe.Companion.hline(),we.Companion.HANDLES_GROUPS,za).build_8be2vx$()},ba.prototype.vline=function(){return new va(re.V_LINE,oe.Companion.vline(),xe.Companion.HANDLES_GROUPS,Da).build_8be2vx$()},ba.prototype.boxplot_8j1y0m$=function(t){return new va(re.BOX_PLOT,oe.Companion.boxplot(),ke.Companion.HANDLES_GROUPS,t).build_8be2vx$()},ba.prototype.livemap_d2y5pu$=function(t){return new va(re.LIVE_MAP,oe.Companion.livemap_cx3y7u$(t.displayMode),tt.Companion.HANDLES_GROUPS,(e=t,function(){return new tt(e.displayMode)})).build_8be2vx$();var e},ba.prototype.ribbon=function(){return new va(re.RIBBON,oe.Companion.ribbon(),Ee.Companion.HANDLES_GROUPS,Ma).build_8be2vx$()},ba.prototype.area=function(){return new va(re.AREA,oe.Companion.area(),Ce.Companion.HANDLES_GROUPS,Ba).build_8be2vx$()},ba.prototype.density=function(){return new va(re.DENSITY,oe.Companion.density(),Se.Companion.HANDLES_GROUPS,Ua).build_8be2vx$()},ba.prototype.density2d=function(){return new va(re.DENSITY2D,oe.Companion.density2d(),Te.Companion.HANDLES_GROUPS,Fa).build_8be2vx$()},ba.prototype.density2df=function(){return new va(re.DENSITY2DF,oe.Companion.density2df(),Oe.Companion.HANDLES_GROUPS,qa).build_8be2vx$()},ba.prototype.jitter=function(){return new va(re.JITTER,oe.Companion.jitter(),Ne.Companion.HANDLES_GROUPS,Ga).build_8be2vx$()},ba.prototype.freqpoly=function(){return new va(re.FREQPOLY,oe.Companion.freqpoly(),Pe.Companion.HANDLES_GROUPS,Ha).build_8be2vx$()},ba.prototype.step_8j1y0m$=function(t){return new va(re.STEP,oe.Companion.step(),Ae.Companion.HANDLES_GROUPS,t).build_8be2vx$()},ba.prototype.rect=function(){return new va(re.RECT,oe.Companion.rect(),je.Companion.HANDLES_GROUPS,Ya).build_8be2vx$()},ba.prototype.segment_8j1y0m$=function(t){return new va(re.SEGMENT,oe.Companion.segment(),Le.Companion.HANDLES_GROUPS,t).build_8be2vx$()},ba.prototype.text_8j1y0m$=function(t){return new va(re.TEXT,oe.Companion.text(),Re.Companion.HANDLES_GROUPS,t).build_8be2vx$()},ba.prototype.raster=function(){return new va(re.RASTER,oe.Companion.raster(),Ie.Companion.HANDLES_GROUPS,Va).build_8be2vx$()},ba.prototype.image_8j1y0m$=function(t){return new va(re.IMAGE,oe.Companion.image(),ze.Companion.HANDLES_GROUPS,t).build_8be2vx$()},ba.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Ka=null;function Wa(){return null===Ka&&new ba,Ka}function Xa(t,e,n){var i;this.data_0=t,this.mappedAes_tolgcu$_0=Lt(e.keys),this.scaleByAes_c9kkhw$_0=(i=n,function(t){return i.get_31786j$(t)}),this.myBindings_0=Vt(e),this.myFormatters_0=Z()}function Za(t,e){Qa.call(this,t,e)}function Ja(){}function Qa(t,e){ns(),this.xLim_0=t,this.yLim_0=e}function ts(){es=this}$a.$metadata$={kind:$,simpleName:"GeomProvider",interfaces:[]},Object.defineProperty(Xa.prototype,"mappedAes",{configurable:!0,get:function(){return this.mappedAes_tolgcu$_0}}),Object.defineProperty(Xa.prototype,"scaleByAes",{configurable:!0,get:function(){return this.scaleByAes_c9kkhw$_0}}),Xa.prototype.isMapped_896ixz$=function(t){return this.myBindings_0.containsKey_11rb$(t)},Xa.prototype.getMappedData_pkitv1$=function(t,e){var n=this.getOriginalValue_pkitv1$(t,e),i=this.getScale_0(t),r=this.formatter_0(t)(n);return new Me(i.name,r,i.isContinuous)},Xa.prototype.getOriginalValue_pkitv1$=function(t,e){if(!this.isMapped_896ixz$(t))throw G(("Not mapped: "+t).toString());var n=Ct(this.myBindings_0,t),i=this.getScale_0(t),r=this.data_0.getNumeric_8xm3sj$(n.variable).get_za3lpa$(e);return i.transform.applyInverse_yrwdxb$(r)},Xa.prototype.getMappedDataLabel_896ixz$=function(t){return this.getScale_0(t).name},Xa.prototype.isMappedDataContinuous_896ixz$=function(t){return this.getScale_0(t).isContinuous},Xa.prototype.getScale_0=function(t){return this.scaleByAes(t)},Xa.prototype.formatter_0=function(t){var e,n=this.getScale_0(t),i=this.myFormatters_0,r=i.get_11rb$(t);if(null==r){var o=this.createFormatter_0(t,n);i.put_xwzc9p$(t,o),e=o}else e=r;return e},Xa.prototype.createFormatter_0=function(t,e){if(e.isContinuousDomain){var n=Ct(this.myBindings_0,t).variable,i=z("range",function(t,e){return t.range_8xm3sj$(e)}.bind(null,this.data_0))(n),r=ot.SeriesUtil.ensureApplicableRange_4am1sd$(i);return o=e.getBreaksGenerator().labelFormatter_1tlvto$(r,100),function(t){var e;return null!=(e=null!=t?o(t):null)?e:"n/a"}}var o,a;return a=u.ScaleUtil.labelByBreak_x4zrm4$(e),function(t){var e;return null!=(e=null!=t?Ct(a,t):null)?e:"n/a"}},Xa.$metadata$={kind:$,simpleName:"PointDataAccess",interfaces:[De]},Za.$metadata$={kind:$,simpleName:"CartesianCoordProvider",interfaces:[Qa]},Ja.$metadata$={kind:b,simpleName:"CoordProvider",interfaces:[]},Qa.prototype.buildAxisScaleX_ny58zc$=function(t,e,n,i){return ns().buildAxisScaleDefault_0(t,e,n,i)},Qa.prototype.buildAxisScaleY_ny58zc$=function(t,e,n,i){return ns().buildAxisScaleDefault_0(t,e,n,i)},Qa.prototype.createCoordinateSystem_uncllg$=function(t,e,n,i){var r,o,a=ns().linearMapper_mdyssk$(t,e),s=ns().linearMapper_mdyssk$(n,i);return Be.Coords.create_wd6eaa$(u.MapperUtil.map_rejkqi$(t,a),u.MapperUtil.map_rejkqi$(n,s),null!=(r=this.xLim_0)?u.MapperUtil.map_rejkqi$(r,a):null,null!=(o=this.yLim_0)?u.MapperUtil.map_rejkqi$(o,s):null)},Qa.prototype.adjustDomains_jz8wgn$=function(t,e,n){var i,r;return new rt(null!=(i=this.xLim_0)?i:t,null!=(r=this.yLim_0)?r:e)},ts.prototype.linearMapper_mdyssk$=function(t,e){return u.Mappers.mul_mdyssk$(t,e)},ts.prototype.buildAxisScaleDefault_0=function(t,e,n,i){return this.buildAxisScaleDefault_82iy2c$(t,this.linearMapper_mdyssk$(e,n),i)},ts.prototype.buildAxisScaleDefault_82iy2c$=function(t,e,n){return t.with().breaks_pqjuzw$(n.domainValues).labels_mhpeer$(n.labels).mapper_1uitho$(e).build()},ts.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var es=null;function ns(){return null===es&&new ts,es}function is(){rs=this}Qa.$metadata$={kind:$,simpleName:"CoordProviderBase",interfaces:[Ja]},is.prototype.cartesian_t7esj2$=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=null),new Za(t,e)},is.prototype.fixed_vvp5j4$=function(t,e,n){return void 0===e&&(e=null),void 0===n&&(n=null),new os(t,e,n)},is.prototype.map_t7esj2$=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=null),new as(new cs,new ps,t,e)},is.$metadata$={kind:l,simpleName:"CoordProviders",interfaces:[]};var rs=null;function os(t,e,n){Qa.call(this,e,n),this.ratio_0=t}function as(t,e,n,i){us(),Qa.call(this,n,i),this.projectionX_0=t,this.projectionY_0=e}function ss(){ls=this}os.prototype.adjustDomains_jz8wgn$=function(t,e,n){var i=Qa.prototype.adjustDomains_jz8wgn$.call(this,t,e,n),r=i.first,o=i.second,a=ot.SeriesUtil.span_4fzjta$(r),s=ot.SeriesUtil.span_4fzjta$(o);if(a1?l*=this.ratio_0:u*=1/this.ratio_0;var c=a/l,p=s/u;if(c>p){var h=u*c;o=ot.SeriesUtil.expand_mdyssk$(o,h)}else{var _=l*p;r=ot.SeriesUtil.expand_mdyssk$(r,_)}return new rt(r,o)},os.$metadata$={kind:$,simpleName:"FixedRatioCoordProvider",interfaces:[Qa]},as.prototype.adjustDomains_jz8wgn$=function(t,e,n){var i,r=Qa.prototype.adjustDomains_jz8wgn$.call(this,t,e,n),o=this.projectionX_0.toValidDomain_4fzjta$(r.first),a=this.projectionY_0.toValidDomain_4fzjta$(r.second),s=ot.SeriesUtil.span_4fzjta$(o),l=ot.SeriesUtil.span_4fzjta$(a);if(s>l){var u=o.lowerEnd+s/2,c=l/2;i=new rt(new Q(u-c,u+c),a)}else{var p=a.lowerEnd+l/2,h=s/2;i=new rt(o,new Q(p-h,p+h))}var _=i,f=this.projectionX_0.apply_14dthe$(_.first.lowerEnd),d=this.projectionX_0.apply_14dthe$(_.first.upperEnd),m=this.projectionY_0.apply_14dthe$(_.second.lowerEnd);return new os((this.projectionY_0.apply_14dthe$(_.second.upperEnd)-m)/(d-f),null,null).adjustDomains_jz8wgn$(o,a,n)},as.prototype.buildAxisScaleX_ny58zc$=function(t,e,n,i){return this.projectionX_0.nonlinear?us().buildAxisScaleWithProjection_0(this.projectionX_0,t,e,n,i):Qa.prototype.buildAxisScaleX_ny58zc$.call(this,t,e,n,i)},as.prototype.buildAxisScaleY_ny58zc$=function(t,e,n,i){return this.projectionY_0.nonlinear?us().buildAxisScaleWithProjection_0(this.projectionY_0,t,e,n,i):Qa.prototype.buildAxisScaleY_ny58zc$.call(this,t,e,n,i)},ss.prototype.buildAxisScaleWithProjection_0=function(t,e,n,i,r){var o=t.toValidDomain_4fzjta$(n),a=new Q(t.apply_14dthe$(o.lowerEnd),t.apply_14dthe$(o.upperEnd)),s=u.Mappers.linear_1jkouz$(a,o),l=ns().linearMapper_mdyssk$(n,i),c=this.twistScaleMapper_0(t,s,l),p=this.validateBreaks_0(o,r);return ns().buildAxisScaleDefault_82iy2c$(e,c,p)},ss.prototype.validateBreaks_0=function(t,e){var n,i=p(),r=0;for(n=e.domainValues.iterator();n.hasNext();){var o=n.next();"number"==typeof o&&t.contains_mef7kx$(o)&&i.add_11rb$(r),r=r+1|0}if(i.size===e.domainValues.size)return e;var a=ot.SeriesUtil.pickAtIndices_ge51dg$(e.domainValues,i),s=ot.SeriesUtil.pickAtIndices_ge51dg$(e.labels,i),l=ot.SeriesUtil.pickAtIndices_ge51dg$(e.transformedValues,i);return new Ue(a,l,s)},ss.prototype.twistScaleMapper_0=function(t,e,n){return i=t,r=e,o=n,function(t){return null!=t?o(r(i.apply_14dthe$(t))):null};var i,r,o},ss.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var ls=null;function us(){return null===ls&&new ss,ls}function cs(){this.nonlinear_z5go4f$_0=!1}function ps(){this.nonlinear_x0lz9c$_0=!0}function hs(){ds=this}function _s(t,n,i){return function(r){for(var o,a=!0===(o=t.isNumeric_8xm3sj$(r))?ot.SeriesUtil.mean_l4tjj7$(t.getNumeric_8xm3sj$(r),null):!1===o?ot.SeriesUtil.firstNotNull_rath1t$(t.get_8xm3sj$(r),null):e.noWhenBranchMatched(),s=n,l=y(s),u=0;u0&&t=_&&g<=d,w=y.get_za3lpa$(v%y.size),x=this.tickLabelOffset_0(v);v=v+1|0;var k=this.buildTick_0(w,x,b?this.gridLineLength.get():0);if(n=this.orientation_0.get(),ft(n,Jl())||ft(n,Ql()))fn.SvgUtils.transformTranslate_pw34rw$(k,0,g);else{if(!ft(n,tu())&&!ft(n,eu()))throw pn("Unexpected orientation:"+f(this.orientation_0.get()));fn.SvgUtils.transformTranslate_pw34rw$(k,g,0)}i.children().add_11rb$(k)}}}null!=h&&i.children().add_11rb$(h)},Bs.prototype.buildTick_0=function(t,e,n){var i,r=null;this.tickMarksEnabled().get()&&(r=new dn,this.reg_3xv6fb$(_n.PropertyBinding.bindOneWay_2ov6i0$(this.tickMarkWidth,r.strokeWidth())),this.reg_3xv6fb$(_n.PropertyBinding.bindOneWay_2ov6i0$(this.tickColor_0,r.strokeColor())));var o=null;this.tickLabelsEnabled().get()&&(o=new x(t),this.reg_3xv6fb$(_n.PropertyBinding.bindOneWay_2ov6i0$(this.tickColor_0,o.textColor())));var a=null;n>0&&(a=new dn,this.reg_3xv6fb$(_n.PropertyBinding.bindOneWay_2ov6i0$(this.gridLineColor,a.strokeColor())),this.reg_3xv6fb$(_n.PropertyBinding.bindOneWay_2ov6i0$(this.gridLineWidth,a.strokeWidth())));var s=this.tickMarkLength.get();if(i=this.orientation_0.get(),ft(i,Jl()))null!=r&&(r.x2().set_11rb$(-s),r.y2().set_11rb$(0)),null!=a&&(a.x2().set_11rb$(n),a.y2().set_11rb$(0));else if(ft(i,Ql()))null!=r&&(r.x2().set_11rb$(s),r.y2().set_11rb$(0)),null!=a&&(a.x2().set_11rb$(-n),a.y2().set_11rb$(0));else if(ft(i,tu()))null!=r&&(r.x2().set_11rb$(0),r.y2().set_11rb$(-s)),null!=a&&(a.x2().set_11rb$(0),a.y2().set_11rb$(n));else{if(!ft(i,eu()))throw pn("Unexpected orientation:"+f(this.orientation_0.get()));null!=r&&(r.x2().set_11rb$(0),r.y2().set_11rb$(s)),null!=a&&(a.x2().set_11rb$(0),a.y2().set_11rb$(-n))}var l=new N;return null!=a&&l.children().add_11rb$(a),null!=r&&l.children().add_11rb$(r),null!=o&&(o.moveTo_lu1900$(e.x,e.y),o.setHorizontalAnchor_ja80zo$(this.tickLabelHorizontalAnchor.get()),o.setVerticalAnchor_yaudma$(this.tickLabelVerticalAnchor.get()),o.rotate_14dthe$(this.tickLabelRotationDegree.get()),l.children().add_11rb$(o.rootGroup)),l.addClass_61zpoe$(d_().TICK),l},Bs.prototype.tickMarkLength_0=function(){return this.myTickMarksEnabled_0.get()?this.tickMarkLength.get():0},Bs.prototype.tickLabelDistance_0=function(){return this.tickMarkLength_0()+this.tickMarkPadding.get()},Bs.prototype.tickLabelBaseOffset_0=function(){var t,e,n=this.tickLabelDistance_0();if(t=this.orientation_0.get(),ft(t,Jl()))e=new h(-n,0);else if(ft(t,Ql()))e=new h(n,0);else if(ft(t,tu()))e=new h(0,-n);else{if(!ft(t,eu()))throw pn("Unexpected orientation:"+f(this.orientation_0.get()));e=new h(0,n)}return e},Bs.prototype.tickLabelOffset_0=function(t){var e=this.tickLabelOffsets.get(),n=null!=e?e.get_za3lpa$(t):h.Companion.ZERO;return this.tickLabelBaseOffset_0().add_gpjtzr$(n)},Bs.prototype.breaksEnabled_0=function(){return this.myTickMarksEnabled_0.get()||this.myTickLabelsEnabled_0.get()},Bs.prototype.tickMarksEnabled=function(){return this.myTickMarksEnabled_0},Bs.prototype.tickLabelsEnabled=function(){return this.myTickLabelsEnabled_0},Bs.prototype.axisLineEnabled=function(){return this.myAxisLineEnabled_0},Bs.$metadata$={kind:$,simpleName:"AxisComponent",interfaces:[B]},Object.defineProperty(Fs.prototype,"spec",{get:function(){return this.spec_xr0de$_0}}),Fs.prototype.appendGuideContent_26jijc$=function(t){var e,n=this.spec.layout,i=new N,r=n.barBounds,o=n.isHorizontal;this.addColorBar_0(i,this.spec.domain,this.spec.scale,this.spec.binCount,r,n.barLengthExpand,o,this.spec.reverse);var a=(o?r.height:r.width)/5,s=n.breakInfos_8be2vx$.iterator();for(e=this.spec.breaks.labels.iterator();e.hasNext();){var l=e.next(),u=s.next(),c=u.tickLocation,_=p();if(o){var f=r.left+c;_.add_11rb$(new h(f,r.top)),_.add_11rb$(new h(f,r.top+a)),_.add_11rb$(new h(f,r.bottom-a)),_.add_11rb$(new h(f,r.bottom))}else{var d=r.top+c;_.add_11rb$(new h(r.left,d)),_.add_11rb$(new h(r.left+a,d)),_.add_11rb$(new h(r.right-a,d)),_.add_11rb$(new h(r.right,d))}this.addTickMark_0(i,_.get_za3lpa$(0),_.get_za3lpa$(1)),this.addTickMark_0(i,_.get_za3lpa$(2),_.get_za3lpa$(3));var m=new x(l);m.setHorizontalAnchor_ja80zo$(u.labelHorizontalAnchor),m.setVerticalAnchor_yaudma$(u.labelVerticalAnchor),m.moveTo_lu1900$(u.labelLocation.x,u.labelLocation.y+r.top),i.children().add_11rb$(m.rootGroup)}if(i.children().add_11rb$(ul().createBorder_a5dgib$(r,this.spec.theme.backgroundFill(),1)),this.debug){var y=new j(h.Companion.ZERO,n.graphSize);i.children().add_11rb$(ul().createBorder_a5dgib$(y,R.Companion.DARK_BLUE,1))}return t.children().add_11rb$(i),n.size},Fs.prototype.addColorBar_0=function(t,e,n,i,r,o,a,s){for(var l=ot.SeriesUtil.span_4fzjta$(e),c=X.max(2,i),h=l/c,_=e.lowerEnd+h/2,f=p(),d=0;d0))throw d(("Row count must be greater than 0, was "+t).toString());this.rowCount_kvp0d1$_0=t}}),Object.defineProperty(bl.prototype,"colCount",{configurable:!0,get:function(){return this.colCount_nojzuj$_0},set:function(t){if(!(t>0))throw d(("Col count must be greater than 0, was "+t).toString());this.colCount_nojzuj$_0=t}}),Object.defineProperty(bl.prototype,"graphSize",{configurable:!0,get:function(){return this.ensureInited_chkycd$_0(),S(this.myContentSize_8rvo9o$_0)}}),Object.defineProperty(bl.prototype,"keyLabelBoxes",{configurable:!0,get:function(){return this.ensureInited_chkycd$_0(),this.myKeyLabelBoxes_uk7fn2$_0}}),Object.defineProperty(bl.prototype,"labelBoxes",{configurable:!0,get:function(){return this.ensureInited_chkycd$_0(),this.myLabelBoxes_9jhh53$_0}}),bl.prototype.ensureInited_chkycd$_0=function(){null==this.myContentSize_8rvo9o$_0&&this.doLayout_zctv6z$_0()},bl.prototype.doLayout_zctv6z$_0=function(){var t,e=_l().LABEL_SPEC_8be2vx$.height(),n=_l().LABEL_SPEC_8be2vx$.width_za3lpa$(1)/2,i=this.keySize.x+n,r=(this.keySize.y-e)/2,o=h.Companion.ZERO,a=null;t=this.breaks;for(var s=0;s!==t.size;++s){var l,u=this.labelSize_za3lpa$(s),c=new h(i+u.x,this.keySize.y);a=new j(null!=(l=null!=a?this.breakBoxOrigin_b4d9xv$(s,a):null)?l:o,c),this.myKeyLabelBoxes_uk7fn2$_0.add_11rb$(a),this.myLabelBoxes_9jhh53$_0.add_11rb$(I(i,r,u.x,u.y))}this.myContentSize_8rvo9o$_0=Xc().union_a7nkjf$(new j(o,h.Companion.ZERO),this.myKeyLabelBoxes_uk7fn2$_0).dimension},wl.prototype.breakBoxOrigin_b4d9xv$=function(t,e){return new h(e.right,0)},wl.prototype.labelSize_za3lpa$=function(t){var e=this.breaks.get_za3lpa$(t).label;return new h(_l().LABEL_SPEC_8be2vx$.width_za3lpa$(e.length),_l().LABEL_SPEC_8be2vx$.height())},wl.$metadata$={kind:$,simpleName:"MyHorizontal",interfaces:[bl]},xl.$metadata$={kind:$,simpleName:"MyHorizontalMultiRow",interfaces:[El]},kl.$metadata$={kind:$,simpleName:"MyVertical",interfaces:[El]},El.prototype.breakBoxOrigin_b4d9xv$=function(t,e){return this.isFillByRow?t%this.colCount==0?new h(0,e.bottom):new h(e.right,e.top):t%this.rowCount==0?new h(e.right,0):new h(e.left,e.bottom)},El.prototype.labelSize_za3lpa$=function(t){return new h(this.myMaxLabelWidth_0,_l().LABEL_SPEC_8be2vx$.height())},El.$metadata$={kind:$,simpleName:"MyMultiRow",interfaces:[bl]},Cl.prototype.horizontal_2y8ibu$=function(t,e,n){return new wl(t,e,n)},Cl.prototype.horizontalMultiRow_2y8ibu$=function(t,e,n){return new xl(t,e,n)},Cl.prototype.vertical_2y8ibu$=function(t,e,n){return new kl(t,e,n)},Cl.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Sl,Tl,Ol,Nl=null;function Pl(){return null===Nl&&new Cl,Nl}function Al(t,e,n,i,r){fl.call(this,t,n,r),this.breaks_8be2vx$=e,this.layout_ebqbgv$_0=i}function jl(t,e){Xt.call(this),this.name$=t,this.ordinal$=e}function Ll(){Ll=function(){},Sl=new jl("HORIZONTAL",0),Tl=new jl("VERTICAL",1),Ol=new jl("AUTO",2)}function Rl(){return Ll(),Sl}function Il(){return Ll(),Tl}function zl(){return Ll(),Ol}function Dl(t,e){Ul(),this.x=t,this.y=e}function Ml(){Bl=this,this.CENTER=new Dl(.5,.5)}bl.$metadata$={kind:$,simpleName:"LegendComponentLayout",interfaces:[cl]},Object.defineProperty(Al.prototype,"layout",{get:function(){return this.layout_ebqbgv$_0}}),Al.$metadata$={kind:$,simpleName:"LegendComponentSpec",interfaces:[fl]},jl.$metadata$={kind:$,simpleName:"LegendDirection",interfaces:[Xt]},jl.values=function(){return[Rl(),Il(),zl()]},jl.valueOf_61zpoe$=function(t){switch(t){case"HORIZONTAL":return Rl();case"VERTICAL":return Il();case"AUTO":return zl();default:Zt("No enum constant jetbrains.datalore.plot.builder.guide.LegendDirection."+t)}},Ml.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Bl=null;function Ul(){return null===Bl&&new Ml,Bl}function Fl(t,e){Wl(),this.x=t,this.y=e}function ql(){Kl=this,this.RIGHT=new Fl(1,.5),this.LEFT=new Fl(0,.5),this.TOP=new Fl(.5,1),this.BOTTOM=new Fl(.5,1),this.NONE=new Fl(at.NaN,at.NaN)}Dl.$metadata$={kind:$,simpleName:"LegendJustification",interfaces:[]},Object.defineProperty(Fl.prototype,"isFixed",{configurable:!0,get:function(){return this===Wl().LEFT||this===Wl().RIGHT||this===Wl().TOP||this===Wl().BOTTOM}}),Object.defineProperty(Fl.prototype,"isHidden",{configurable:!0,get:function(){return this===Wl().NONE}}),Object.defineProperty(Fl.prototype,"isOverlay",{configurable:!0,get:function(){return!(this.isFixed||this.isHidden)}}),ql.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Gl,Hl,Yl,Vl,Kl=null;function Wl(){return null===Kl&&new ql,Kl}function Xl(t,e,n){Xt.call(this),this.myValue_3zu241$_0=n,this.name$=t,this.ordinal$=e}function Zl(){Zl=function(){},Gl=new Xl("LEFT",0,"LEFT"),Hl=new Xl("RIGHT",1,"RIGHT"),Yl=new Xl("TOP",2,"TOP"),Vl=new Xl("BOTTOM",3,"BOTTOM")}function Jl(){return Zl(),Gl}function Ql(){return Zl(),Hl}function tu(){return Zl(),Yl}function eu(){return Zl(),Vl}function nu(){au()}function iu(){ou=this,this.NONE=new ru}function ru(){}Fl.$metadata$={kind:$,simpleName:"LegendPosition",interfaces:[]},Object.defineProperty(Xl.prototype,"isHorizontal",{configurable:!0,get:function(){return this===tu()||this===eu()}}),Xl.prototype.toString=function(){return"Orientation{myValue='"+this.myValue_3zu241$_0+String.fromCharCode(39)+String.fromCharCode(125)},Xl.$metadata$={kind:$,simpleName:"Orientation",interfaces:[Xt]},Xl.values=function(){return[Jl(),Ql(),tu(),eu()]},Xl.valueOf_61zpoe$=function(t){switch(t){case"LEFT":return Jl();case"RIGHT":return Ql();case"TOP":return tu();case"BOTTOM":return eu();default:Zt("No enum constant jetbrains.datalore.plot.builder.guide.Orientation."+t)}},ru.prototype.createContextualMapping_8fr62e$=function(t,e){return new kn(et(),null,null,null,!1,!1,!1,!1)},ru.$metadata$={kind:$,interfaces:[nu]},iu.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var ou=null;function au(){return null===ou&&new iu,ou}function su(t){cu(),this.myLocatorLookupSpace_0=t.locatorLookupSpace,this.myLocatorLookupStrategy_0=t.locatorLookupStrategy,this.myTooltipLines_0=t.tooltipLines,this.myTooltipProperties_0=t.tooltipProperties,this.myIgnoreInvisibleTargets_0=t.isIgnoringInvisibleTargets(),this.myIsCrosshairEnabled_0=t.isCrosshairEnabled}function lu(){uu=this}nu.$metadata$={kind:b,simpleName:"ContextualMappingProvider",interfaces:[]},su.prototype.createLookupSpec=function(){return new xt(this.myLocatorLookupSpace_0,this.myLocatorLookupStrategy_0)},su.prototype.createContextualMapping_8fr62e$=function(t,e){var n,i=cu(),r=this.myTooltipLines_0,o=y(m(r,10));for(n=r.iterator();n.hasNext();){var a=n.next();o.add_11rb$(km(a))}return i.createContextualMapping_0(o,t,e,this.myTooltipProperties_0,this.myIgnoreInvisibleTargets_0,this.myIsCrosshairEnabled_0)},lu.prototype.createTestContextualMapping_fdc7hd$=function(t,e,n,i,r,o){void 0===o&&(o=null);var a=yu().defaultValueSourceTooltipLines_dnbe1t$(t,e,n,o);return this.createContextualMapping_0(a,i,r,Om().NONE,!1,!1)},lu.prototype.createContextualMapping_0=function(t,n,i,r,o,a){var s,l=new En(i,n),u=p();for(s=t.iterator();s.hasNext();){var c,h=s.next(),_=h.fields,f=p();for(c=_.iterator();c.hasNext();){var d=c.next();e.isType(d,$m)&&f.add_11rb$(d)}var m,y=f;t:do{var $;if(e.isType(y,Pt)&&y.isEmpty()){m=!0;break t}for($=y.iterator();$.hasNext();){var v=$.next();if(!n.isMapped_896ixz$(v.aes)){m=!1;break t}}m=!0}while(0);m&&u.add_11rb$(h)}var g,b,w=u;for(g=w.iterator();g.hasNext();)g.next().initDataContext_rxi9tf$(l);t:do{var x;if(e.isType(w,Pt)&&w.isEmpty()){b=!1;break t}for(x=w.iterator();x.hasNext();){var k,E=x.next().fields,C=Nt("isOutlier",1,(function(t){return t.isOutlier}));e:do{var S;if(e.isType(E,Pt)&&E.isEmpty()){k=!0;break e}for(S=E.iterator();S.hasNext();)if(C(S.next())){k=!1;break e}k=!0}while(0);if(k){b=!0;break t}}b=!1}while(0);var T,O=b;t:do{var N;if(e.isType(w,Pt)&&w.isEmpty()){T=!1;break t}for(N=w.iterator();N.hasNext();){var P,A=N.next().fields,j=Nt("isAxis",1,(function(t){return t.isAxis}));e:do{var L;if(e.isType(A,Pt)&&A.isEmpty()){P=!1;break e}for(L=A.iterator();L.hasNext();)if(j(L.next())){P=!0;break e}P=!1}while(0);if(P){T=!0;break t}}T=!1}while(0);var R=T;return new kn(w,r.anchor,r.minWidth,r.color,o,O,R,a)},lu.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var uu=null;function cu(){return null===uu&&new lu,uu}function pu(t){yu(),this.mySupportedAesList_0=t,this.myIgnoreInvisibleTargets_0=!1,this.locatorLookupSpace_3dt62f$_0=this.locatorLookupSpace_3dt62f$_0,this.locatorLookupStrategy_gpx4i$_0=this.locatorLookupStrategy_gpx4i$_0,this.myAxisTooltipVisibilityFromFunctionKind_0=!1,this.myAxisTooltipVisibilityFromConfig_0=null,this.myAxisAesFromFunctionKind_0=null,this.myTooltipAxisAes_vm9teg$_0=this.myTooltipAxisAes_vm9teg$_0,this.myTooltipAes_um80ux$_0=this.myTooltipAes_um80ux$_0,this.myTooltipOutlierAesList_r7qit3$_0=this.myTooltipOutlierAesList_r7qit3$_0,this.myTooltipConstantsAesList_0=null,this.myUserTooltipSpec_0=null,this.myIsCrosshairEnabled_0=!1}function hu(){mu=this,this.AREA_GEOM=!0,this.NON_AREA_GEOM=!1,this.AES_X_0=zt(J.Companion.X),this.AES_XY_0=an([J.Companion.X,J.Companion.Y])}su.$metadata$={kind:$,simpleName:"GeomInteraction",interfaces:[nu]},Object.defineProperty(pu.prototype,"locatorLookupSpace",{configurable:!0,get:function(){return null==this.locatorLookupSpace_3dt62f$_0?F("locatorLookupSpace"):this.locatorLookupSpace_3dt62f$_0},set:function(t){this.locatorLookupSpace_3dt62f$_0=t}}),Object.defineProperty(pu.prototype,"locatorLookupStrategy",{configurable:!0,get:function(){return null==this.locatorLookupStrategy_gpx4i$_0?F("locatorLookupStrategy"):this.locatorLookupStrategy_gpx4i$_0},set:function(t){this.locatorLookupStrategy_gpx4i$_0=t}}),Object.defineProperty(pu.prototype,"myTooltipAxisAes_0",{configurable:!0,get:function(){return null==this.myTooltipAxisAes_vm9teg$_0?F("myTooltipAxisAes"):this.myTooltipAxisAes_vm9teg$_0},set:function(t){this.myTooltipAxisAes_vm9teg$_0=t}}),Object.defineProperty(pu.prototype,"myTooltipAes_0",{configurable:!0,get:function(){return null==this.myTooltipAes_um80ux$_0?F("myTooltipAes"):this.myTooltipAes_um80ux$_0},set:function(t){this.myTooltipAes_um80ux$_0=t}}),Object.defineProperty(pu.prototype,"myTooltipOutlierAesList_0",{configurable:!0,get:function(){return null==this.myTooltipOutlierAesList_r7qit3$_0?F("myTooltipOutlierAesList"):this.myTooltipOutlierAesList_r7qit3$_0},set:function(t){this.myTooltipOutlierAesList_r7qit3$_0=t}}),Object.defineProperty(pu.prototype,"getAxisFromFunctionKind",{configurable:!0,get:function(){var t;return null!=(t=this.myAxisAesFromFunctionKind_0)?t:et()}}),Object.defineProperty(pu.prototype,"isAxisTooltipEnabled",{configurable:!0,get:function(){return null==this.myAxisTooltipVisibilityFromConfig_0?this.myAxisTooltipVisibilityFromFunctionKind_0:S(this.myAxisTooltipVisibilityFromConfig_0)}}),Object.defineProperty(pu.prototype,"tooltipLines",{configurable:!0,get:function(){return this.prepareTooltipValueSources_0()}}),Object.defineProperty(pu.prototype,"tooltipProperties",{configurable:!0,get:function(){var t,e;return null!=(e=null!=(t=this.myUserTooltipSpec_0)?t.tooltipProperties:null)?e:Om().NONE}}),Object.defineProperty(pu.prototype,"isCrosshairEnabled",{configurable:!0,get:function(){return this.myIsCrosshairEnabled_0}}),pu.prototype.showAxisTooltip_6taknv$=function(t){return this.myAxisTooltipVisibilityFromConfig_0=t,this},pu.prototype.tooltipAes_3lrecq$=function(t){return this.myTooltipAes_0=t,this},pu.prototype.axisAes_3lrecq$=function(t){return this.myTooltipAxisAes_0=t,this},pu.prototype.tooltipOutliers_3lrecq$=function(t){return this.myTooltipOutlierAesList_0=t,this},pu.prototype.tooltipConstants_ayg7dr$=function(t){return this.myTooltipConstantsAesList_0=t,this},pu.prototype.tooltipLinesSpec_uvmyj9$=function(t){return this.myUserTooltipSpec_0=t,this},pu.prototype.setIsCrosshairEnabled_6taknv$=function(t){return this.myIsCrosshairEnabled_0=t,this},pu.prototype.multilayerLookupStrategy=function(){return this.locatorLookupStrategy=Cn.NEAREST,this.locatorLookupSpace=Sn.XY,this},pu.prototype.univariateFunction_7k7ojo$=function(t){return this.myAxisAesFromFunctionKind_0=yu().AES_X_0,this.locatorLookupStrategy=t,this.myAxisTooltipVisibilityFromFunctionKind_0=!0,this.locatorLookupSpace=Sn.X,this.initDefaultTooltips_0(),this},pu.prototype.bivariateFunction_6taknv$=function(t){return this.myAxisAesFromFunctionKind_0=yu().AES_XY_0,t?(this.locatorLookupStrategy=Cn.HOVER,this.myAxisTooltipVisibilityFromFunctionKind_0=!1):(this.locatorLookupStrategy=Cn.NEAREST,this.myAxisTooltipVisibilityFromFunctionKind_0=!0),this.locatorLookupSpace=Sn.XY,this.initDefaultTooltips_0(),this},pu.prototype.none=function(){return this.myAxisAesFromFunctionKind_0=q(this.mySupportedAesList_0),this.locatorLookupStrategy=Cn.NONE,this.myAxisTooltipVisibilityFromFunctionKind_0=!0,this.locatorLookupSpace=Sn.NONE,this.initDefaultTooltips_0(),this},pu.prototype.initDefaultTooltips_0=function(){this.myTooltipAxisAes_0=this.isAxisTooltipEnabled?this.getAxisFromFunctionKind:et(),this.myTooltipAes_0=Tn(this.mySupportedAesList_0,this.getAxisFromFunctionKind),this.myTooltipOutlierAesList_0=et()},pu.prototype.prepareTooltipValueSources_0=function(){var t;if(null==this.myUserTooltipSpec_0)t=yu().defaultValueSourceTooltipLines_dnbe1t$(this.myTooltipAes_0,this.myTooltipAxisAes_0,this.myTooltipOutlierAesList_0,null,this.myTooltipConstantsAesList_0);else if(null==S(this.myUserTooltipSpec_0).tooltipLinePatterns)t=yu().defaultValueSourceTooltipLines_dnbe1t$(this.myTooltipAes_0,this.myTooltipAxisAes_0,this.myTooltipOutlierAesList_0,S(this.myUserTooltipSpec_0).valueSources,this.myTooltipConstantsAesList_0);else if(S(S(this.myUserTooltipSpec_0).tooltipLinePatterns).isEmpty())t=et();else{var n,i=On(this.myTooltipOutlierAesList_0);for(n=S(S(this.myUserTooltipSpec_0).tooltipLinePatterns).iterator();n.hasNext();){var r,o=n.next().fields,a=p();for(r=o.iterator();r.hasNext();){var s=r.next();e.isType(s,$m)&&a.add_11rb$(s)}var l,u=y(m(a,10));for(l=a.iterator();l.hasNext();){var c=l.next();u.add_11rb$(c.aes)}var h=u;i.removeAll_brywnq$(h)}var _,f=this.myTooltipAxisAes_0,d=y(m(f,10));for(_=f.iterator();_.hasNext();){var $=_.next();d.add_11rb$(new $m($,!0,!0))}var v,g=d,b=y(m(i,10));for(v=i.iterator();v.hasNext();){var w,x,k,E=v.next(),C=b.add_11rb$,T=S(this.myUserTooltipSpec_0).valueSources,O=p();for(x=T.iterator();x.hasNext();){var N=x.next();e.isType(N,$m)&&O.add_11rb$(N)}t:do{var P;for(P=O.iterator();P.hasNext();){var A=P.next();if(ft(A.aes,E)){k=A;break t}}k=null}while(0);var j=k;C.call(b,null!=(w=null!=j?j.toOutlier():null)?w:new $m(E,!0))}var L,R=b,I=S(S(this.myUserTooltipSpec_0).tooltipLinePatterns),D=Dt(g,R),M=z("defaultLineForValueSource",function(t,e){return t.defaultLineForValueSource_u47np3$(e)}.bind(null,xm())),B=y(m(D,10));for(L=D.iterator();L.hasNext();){var U=L.next();B.add_11rb$(M(U))}t=Dt(I,B)}return t},pu.prototype.build=function(){return new su(this)},pu.prototype.ignoreInvisibleTargets_6taknv$=function(t){return this.myIgnoreInvisibleTargets_0=t,this},pu.prototype.isIgnoringInvisibleTargets=function(){return this.myIgnoreInvisibleTargets_0},hu.prototype.defaultValueSourceTooltipLines_dnbe1t$=function(t,n,i,r,o){var a;void 0===r&&(r=null),void 0===o&&(o=null);var s,l=y(m(n,10));for(s=n.iterator();s.hasNext();){var u=s.next();l.add_11rb$(new $m(u,!0,!0))}var c,h=l,_=y(m(i,10));for(c=i.iterator();c.hasNext();){var f,d,$,v,g=c.next(),b=_.add_11rb$;if(null!=r){var w,x=p();for(w=r.iterator();w.hasNext();){var k=w.next();e.isType(k,$m)&&x.add_11rb$(k)}$=x}else $=null;if(null!=(f=$)){var E;t:do{var C;for(C=f.iterator();C.hasNext();){var S=C.next();if(ft(S.aes,g)){E=S;break t}}E=null}while(0);v=E}else v=null;var T=v;b.call(_,null!=(d=null!=T?T.toOutlier():null)?d:new $m(g,!0))}var O,N=_,P=y(m(t,10));for(O=t.iterator();O.hasNext();){var A,j,L,R=O.next(),I=P.add_11rb$;if(null!=r){var D,M=p();for(D=r.iterator();D.hasNext();){var B=D.next();e.isType(B,$m)&&M.add_11rb$(B)}j=M}else j=null;if(null!=(A=j)){var U;t:do{var F;for(F=A.iterator();F.hasNext();){var q=F.next();if(ft(q.aes,R)){U=q;break t}}U=null}while(0);L=U}else L=null;var G=L;I.call(P,null!=G?G:new $m(R))}var H,Y=P;if(null!=o){var V,K=y(o.size);for(V=o.entries.iterator();V.hasNext();){var W=V.next(),X=K.add_11rb$,Z=W.value;X.call(K,new mm(Z,null))}H=K}else H=null;var J,Q=null!=(a=H)?a:et(),tt=Dt(Dt(Dt(Y,h),N),Q),nt=z("defaultLineForValueSource",function(t,e){return t.defaultLineForValueSource_u47np3$(e)}.bind(null,xm())),it=y(m(tt,10));for(J=tt.iterator();J.hasNext();){var rt=J.next();it.add_11rb$(nt(rt))}return it},hu.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var _u,fu,du,mu=null;function yu(){return null===mu&&new hu,mu}function $u(){Ou=this}function vu(t){this.target=t,this.distance_pberzz$_0=-1,this.coord_ovwx85$_0=null}function gu(t,e){Xt.call(this),this.name$=t,this.ordinal$=e}function bu(){bu=function(){},_u=new gu("NEW_CLOSER",0),fu=new gu("NEW_FARTHER",1),du=new gu("EQUAL",2)}function wu(){return bu(),_u}function xu(){return bu(),fu}function ku(){return bu(),du}function Eu(t,e){if(Tu(),this.myStart_0=t,this.myLength_0=e,this.myLength_0<0)throw d("Length should be positive")}function Cu(){Su=this}pu.$metadata$={kind:$,simpleName:"GeomInteractionBuilder",interfaces:[]},$u.prototype.polygonContainsCoordinate_sz9prc$=function(t,e){var n,i=0;n=t.size;for(var r=1;r=e.y&&a.y>=e.y||o.y=t.start()&&this.end()<=t.end()},Eu.prototype.contains_14dthe$=function(t){return t>=this.start()&&t<=this.end()},Eu.prototype.start=function(){return this.myStart_0},Eu.prototype.end=function(){return this.myStart_0+this.length()},Eu.prototype.move_14dthe$=function(t){return Tu().withStartAndLength_lu1900$(this.start()+t,this.length())},Eu.prototype.moveLeft_14dthe$=function(t){if(t<0)throw d("Value should be positive");return Tu().withStartAndLength_lu1900$(this.start()-t,this.length())},Eu.prototype.moveRight_14dthe$=function(t){if(t<0)throw d("Value should be positive");return Tu().withStartAndLength_lu1900$(this.start()+t,this.length())},Cu.prototype.withStartAndEnd_lu1900$=function(t,e){var n=X.min(t,e);return new Eu(n,X.max(t,e)-n)},Cu.prototype.withStartAndLength_lu1900$=function(t,e){return new Eu(t,e)},Cu.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Su=null;function Tu(){return null===Su&&new Cu,Su}Eu.$metadata$={kind:$,simpleName:"DoubleRange",interfaces:[]},$u.$metadata$={kind:l,simpleName:"MathUtil",interfaces:[]};var Ou=null;function Nu(){return null===Ou&&new $u,Ou}function Pu(t,e,n,i,r,o,a){void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=!1),this.layoutHint=t,this.fill=n,this.isOutlier=i,this.anchor=r,this.minWidth=o,this.isCrosshairEnabled=a,this.lines=q(e)}function Au(t,e){Mu(),this.label=t,this.value=e}function ju(){Du=this}Pu.prototype.toString=function(){var t,e="TooltipSpec("+this.layoutHint+", lines=",n=this.lines,i=y(m(n,10));for(t=n.iterator();t.hasNext();){var r=t.next();i.add_11rb$(r.toString())}return e+i+")"},Au.prototype.toString=function(){var t=this.label;return null==t||0===t.length?this.value:f(this.label)+": "+this.value},ju.prototype.withValue_61zpoe$=function(t){return new Au(null,t)},ju.prototype.withLabelAndValue_f5e6j7$=function(t,e){return new Au(t,e)},ju.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Lu,Ru,Iu,zu,Du=null;function Mu(){return null===Du&&new ju,Du}function Bu(t,e){this.contextualMapping_0=t,this.axisOrigin_0=e}function Uu(t,e){this.$outer=t,this.myGeomTarget_0=e,this.myDataPoints_0=this.$outer.contextualMapping_0.getDataPoints_za3lpa$(this.hitIndex_0()),this.myTooltipAnchor_0=this.$outer.contextualMapping_0.tooltipAnchor,this.myTooltipMinWidth_0=this.$outer.contextualMapping_0.tooltipMinWidth,this.myTooltipColor_0=this.$outer.contextualMapping_0.tooltipColor,this.myIsCrosshairEnabled_0=this.$outer.contextualMapping_0.isCrosshairEnabled}function Fu(t,e,n,i){this.geomKind_0=t,this.lookupSpec_0=e,this.contextualMapping_0=n,this.coordinateSystem_0=i,this.myTargets_0=p(),this.myLocator_0=null}function qu(t,n,i,r){var o,a;this.geomKind_0=t,this.lookupSpec_0=n,this.contextualMapping_0=i,this.myTargets_0=p(),this.myTargetDetector_0=new rc(this.lookupSpec_0.lookupSpace,this.lookupSpec_0.lookupStrategy),this.mySimpleGeometry_0=Un([re.RECT,re.POLYGON]),o=this.mySimpleGeometry_0.contains_11rb$(this.geomKind_0)?Wu():this.lookupSpec_0.lookupSpace===Sn.X&&this.lookupSpec_0.lookupStrategy===Cn.NEAREST?Xu():this.lookupSpec_0.lookupSpace===Sn.X||this.lookupSpec_0.lookupStrategy===Cn.HOVER?Ku():this.lookupSpec_0.lookupStrategy===Cn.NONE||this.lookupSpec_0.lookupSpace===Sn.NONE?Zu():Wu(),this.myCollectingStrategy_0=o;var s,l=(s=this,function(t){var n;switch(t.hitShape_8be2vx$.kind.name){case"POINT":n=hc().create_p1yge$(t.hitShape_8be2vx$.point.center,s.lookupSpec_0.lookupSpace);break;case"RECT":n=mc().create_tb1cvm$(t.hitShape_8be2vx$.rect,s.lookupSpec_0.lookupSpace);break;case"POLYGON":n=gc().create_a95qp$(t.hitShape_8be2vx$.points,s.lookupSpec_0.lookupSpace);break;case"PATH":n=Oc().create_zb7j6l$(t.hitShape_8be2vx$.points,t.indexMapper_8be2vx$,s.lookupSpec_0.lookupSpace);break;default:n=e.noWhenBranchMatched()}return n});for(a=r.iterator();a.hasNext();){var u=a.next();this.myTargets_0.add_11rb$(new Gu(l(u),u))}}function Gu(t,e){this.targetProjection_0=t,this.prototype=e}function Hu(t,e,n){var i;this.myStrategy_0=e,this.result_0=p(),i=n===Sn.X?new vu(new h(t.x,0)):new vu(t),this.closestPointChecker=i,this.myLastAddedDistance_0=-1}function Yu(t,e){Xt.call(this),this.name$=t,this.ordinal$=e}function Vu(){Vu=function(){},Lu=new Yu("APPEND",0),Ru=new Yu("REPLACE",1),Iu=new Yu("APPEND_IF_EQUAL",2),zu=new Yu("IGNORE",3)}function Ku(){return Vu(),Lu}function Wu(){return Vu(),Ru}function Xu(){return Vu(),Iu}function Zu(){return Vu(),zu}function Ju(){ic(),this.myPicked_0=p(),this.myMinDistance_0=0,this.myAllLookupResults_0=p()}function Qu(t){return t.contextualMapping.hasGeneralTooltip}function tc(t){return t.contextualMapping.hasAxisTooltip||an([re.V_LINE,re.H_LINE]).contains_11rb$(t.geomKind)}function ec(){nc=this,this.CUTOFF_DISTANCE_8be2vx$=30,this.FAKE_DISTANCE_8be2vx$=15,this.UNIVARIATE_GEOMS_0=an([re.DENSITY,re.FREQPOLY,re.BOX_PLOT,re.HISTOGRAM,re.LINE,re.AREA,re.BAR,re.ERROR_BAR,re.CROSS_BAR,re.LINE_RANGE,re.POINT_RANGE]),this.UNIVARIATE_LINES_0=an([re.DENSITY,re.FREQPOLY,re.LINE,re.AREA,re.SEGMENT])}Au.$metadata$={kind:$,simpleName:"Line",interfaces:[]},Pu.$metadata$={kind:$,simpleName:"TooltipSpec",interfaces:[]},Bu.prototype.create_62opr5$=function(t){return q(new Uu(this,t).createTooltipSpecs_8be2vx$())},Uu.prototype.createTooltipSpecs_8be2vx$=function(){var t=p();return Rn(t,this.outlierTooltipSpec_0()),Rn(t,this.generalTooltipSpec_0()),Rn(t,this.axisTooltipSpec_0()),t},Uu.prototype.hitIndex_0=function(){return this.myGeomTarget_0.hitIndex},Uu.prototype.tipLayoutHint_0=function(){return this.myGeomTarget_0.tipLayoutHint},Uu.prototype.outlierHints_0=function(){return this.myGeomTarget_0.aesTipLayoutHints},Uu.prototype.hintColors_0=function(){var t,e=this.myGeomTarget_0.aesTipLayoutHints,n=y(e.size);for(t=e.entries.iterator();t.hasNext();){var i=t.next();n.add_11rb$($t(i.key,i.value.color))}return vt(n)},Uu.prototype.outlierTooltipSpec_0=function(){var t,e=p(),n=this.outlierDataPoints_0();for(t=this.outlierHints_0().entries.iterator();t.hasNext();){var i,r,o=t.next(),a=o.key,s=o.value,l=p();for(r=n.iterator();r.hasNext();){var u=r.next();ft(a,u.aes)&&l.add_11rb$(u)}var c,h=Nt("value",1,(function(t){return t.value})),_=y(m(l,10));for(c=l.iterator();c.hasNext();){var f=c.next();_.add_11rb$(h(f))}var d,$=z("withValue",function(t,e){return t.withValue_61zpoe$(e)}.bind(null,Mu())),v=y(m(_,10));for(d=_.iterator();d.hasNext();){var g=d.next();v.add_11rb$($(g))}var b=v;b.isEmpty()||e.add_11rb$(new Pu(s,b,null!=(i=s.color)?i:S(this.tipLayoutHint_0().color),!0))}return e},Uu.prototype.axisTooltipSpec_0=function(){var t,e=p(),n=J.Companion.X,i=this.axisDataPoints_0(),r=p();for(t=i.iterator();t.hasNext();){var o=t.next();ft(J.Companion.X,o.aes)&&r.add_11rb$(o)}var a,s=Nt("value",1,(function(t){return t.value})),l=y(m(r,10));for(a=r.iterator();a.hasNext();){var u=a.next();l.add_11rb$(s(u))}var c,h=z("withValue",function(t,e){return t.withValue_61zpoe$(e)}.bind(null,Mu())),_=y(m(l,10));for(c=l.iterator();c.hasNext();){var f=c.next();_.add_11rb$(h(f))}var d,$=$t(n,_),v=J.Companion.Y,g=this.axisDataPoints_0(),b=p();for(d=g.iterator();d.hasNext();){var w=d.next();ft(J.Companion.Y,w.aes)&&b.add_11rb$(w)}var x,k=Nt("value",1,(function(t){return t.value})),E=y(m(b,10));for(x=b.iterator();x.hasNext();){var C=x.next();E.add_11rb$(k(C))}var T,O,N=z("withValue",function(t,e){return t.withValue_61zpoe$(e)}.bind(null,Mu())),P=y(m(E,10));for(T=E.iterator();T.hasNext();){var A=T.next();P.add_11rb$(N(A))}for(O=Pn([$,$t(v,P)]).entries.iterator();O.hasNext();){var j=O.next(),L=j.key,R=j.value;if(!R.isEmpty()){var I=this.createHintForAxis_0(L);e.add_11rb$(new Pu(I,R,S(I.color),!0))}}return e},Uu.prototype.generalTooltipSpec_0=function(){var t,e,n=this.generalDataPoints_0(),i=y(m(n,10));for(e=n.iterator();e.hasNext();){var r=e.next();i.add_11rb$(Mu().withLabelAndValue_f5e6j7$(r.label,r.value))}var o,a=i,s=this.hintColors_0(),l=Et();for(o=s.entries.iterator();o.hasNext();){var u,c=o.next(),h=c.key,_=y(m(n,10));for(u=n.iterator();u.hasNext();){var f=u.next();_.add_11rb$(f.aes)}_.contains_11rb$(h)&&l.put_xwzc9p$(c.key,c.value)}var d,$=l;if(null!=(t=$.get_11rb$(J.Companion.Y)))d=t;else{var v,g=p();for(v=$.entries.iterator();v.hasNext();){var b;null!=(b=v.next().value)&&g.add_11rb$(b)}d=An(g)}var w=d,x=null!=this.myTooltipColor_0?this.myTooltipColor_0:null!=w?w:S(this.tipLayoutHint_0().color);return a.isEmpty()?et():zt(new Pu(this.tipLayoutHint_0(),a,x,!1,this.myTooltipAnchor_0,this.myTooltipMinWidth_0,this.myIsCrosshairEnabled_0))},Uu.prototype.outlierDataPoints_0=function(){var t,e=this.myDataPoints_0,n=p();for(t=e.iterator();t.hasNext();){var i=t.next();i.isOutlier&&!i.isAxis&&n.add_11rb$(i)}return n},Uu.prototype.axisDataPoints_0=function(){var t,e=this.myDataPoints_0,n=Nt("isAxis",1,(function(t){return t.isAxis})),i=p();for(t=e.iterator();t.hasNext();){var r=t.next();n(r)&&i.add_11rb$(r)}return i},Uu.prototype.generalDataPoints_0=function(){var t,e=this.myDataPoints_0,n=Nt("isOutlier",1,(function(t){return t.isOutlier})),i=p();for(t=e.iterator();t.hasNext();){var r=t.next();n(r)||i.add_11rb$(r)}var o,a=i,s=this.outlierDataPoints_0(),l=Nt("aes",1,(function(t){return t.aes})),u=p();for(o=s.iterator();o.hasNext();){var c;null!=(c=l(o.next()))&&u.add_11rb$(c)}var h,_=u,f=Nt("aes",1,(function(t){return t.aes})),d=p();for(h=a.iterator();h.hasNext();){var m;null!=(m=f(h.next()))&&d.add_11rb$(m)}var y,$=Tn(d,_),v=p();for(y=a.iterator();y.hasNext();){var g,b=y.next();(null==(g=b.aes)||jn($,g))&&v.add_11rb$(b)}return v},Uu.prototype.createHintForAxis_0=function(t){var e;if(ft(t,J.Companion.X))e=Ln.Companion.xAxisTooltip_cgf2ia$(new h(S(this.tipLayoutHint_0().coord).x,this.$outer.axisOrigin_0.y),Nh().AXIS_TOOLTIP_COLOR,Nh().AXIS_RADIUS);else{if(!ft(t,J.Companion.Y))throw d(("Not an axis aes: "+t).toString());e=Ln.Companion.yAxisTooltip_cgf2ia$(new h(this.$outer.axisOrigin_0.x,S(this.tipLayoutHint_0().coord).y),Nh().AXIS_TOOLTIP_COLOR,Nh().AXIS_RADIUS)}return e},Uu.$metadata$={kind:$,simpleName:"Helper",interfaces:[]},Bu.$metadata$={kind:$,simpleName:"TooltipSpecFactory",interfaces:[]},Fu.prototype.addPoint_cnsimy$$default=function(t,e,n,i,r){var o;(!this.contextualMapping_0.ignoreInvisibleTargets||0!==n&&0!==i.getColor().alpha)&&this.coordinateSystem_0.isPointInLimits_k2qmv6$(e)&&this.addTarget_0(new Pc(In.Companion.point_e1sv3v$(e,n),(o=t,function(t){return o}),i,r))},Fu.prototype.addRectangle_bxzvr8$$default=function(t,e,n,i){var r;(!this.contextualMapping_0.ignoreInvisibleTargets||0!==e.width&&0!==e.height&&0!==n.getColor().alpha)&&this.coordinateSystem_0.isRectInLimits_fd842m$(e)&&this.addTarget_0(new Pc(In.Companion.rect_wthzt5$(e),(r=t,function(t){return r}),n,i))},Fu.prototype.addPath_sa5m83$$default=function(t,e,n,i){this.coordinateSystem_0.isPathInLimits_f6t8kh$(t)&&this.addTarget_0(new Pc(In.Companion.path_ytws2g$(t),e,n,i))},Fu.prototype.addPolygon_sa5m83$$default=function(t,e,n,i){this.coordinateSystem_0.isPolygonInLimits_f6t8kh$(t)&&this.addTarget_0(new Pc(In.Companion.polygon_ytws2g$(t),e,n,i))},Fu.prototype.addTarget_0=function(t){this.myTargets_0.add_11rb$(t),this.myLocator_0=null},Fu.prototype.search_gpjtzr$=function(t){return null==this.myLocator_0&&(this.myLocator_0=new qu(this.geomKind_0,this.lookupSpec_0,this.contextualMapping_0,this.myTargets_0)),S(this.myLocator_0).search_gpjtzr$(t)},Fu.$metadata$={kind:$,simpleName:"LayerTargetCollectorWithLocator",interfaces:[Dn,zn]},qu.prototype.addLookupResults_0=function(t,e){if(0!==t.size()){var n=t.collection(),i=t.closestPointChecker.distance;e.add_11rb$(new Mn(n,X.max(0,i),this.geomKind_0,this.contextualMapping_0,this.contextualMapping_0.isCrosshairEnabled))}},qu.prototype.search_gpjtzr$=function(t){var e;if(this.myTargets_0.isEmpty())return null;var n=new Hu(t,this.myCollectingStrategy_0,this.lookupSpec_0.lookupSpace),i=new Hu(t,this.myCollectingStrategy_0,this.lookupSpec_0.lookupSpace),r=new Hu(t,this.myCollectingStrategy_0,this.lookupSpec_0.lookupSpace),o=new Hu(t,Wu(),this.lookupSpec_0.lookupSpace);for(e=this.myTargets_0.iterator();e.hasNext();){var a=e.next();switch(a.prototype.hitShape_8be2vx$.kind.name){case"RECT":this.processRect_0(t,a,n);break;case"POINT":this.processPoint_0(t,a,i);break;case"PATH":this.processPath_0(t,a,r);break;case"POLYGON":this.processPolygon_0(t,a,o)}}var s=p();return this.addLookupResults_0(r,s),this.addLookupResults_0(n,s),this.addLookupResults_0(i,s),this.addLookupResults_0(o,s),this.getClosestTarget_0(s)},qu.prototype.getClosestTarget_0=function(t){var e;if(t.isEmpty())return null;var n=t.get_za3lpa$(0);if(!(n.distance>=0))throw G("Failed requirement.".toString());for(e=t.iterator();e.hasNext();){var i=e.next();i.distanceic().CUTOFF_DISTANCE_8be2vx$||(this.myPicked_0.isEmpty()||this.myMinDistance_0>i?(this.myPicked_0.clear(),this.myPicked_0.add_11rb$(n),this.myMinDistance_0=i):this.myMinDistance_0===i&&ic().isSameUnivariateGeom_0(this.myPicked_0.get_za3lpa$(0),n)?this.myPicked_0.add_11rb$(n):this.myMinDistance_0===i&&(this.myPicked_0.clear(),this.myPicked_0.add_11rb$(n)),this.myAllLookupResults_0.add_11rb$(n))},Ju.prototype.chooseBestResult_0=function(){var t,n,i=Qu,r=tc,o=this.myPicked_0;t:do{var a;if(e.isType(o,Pt)&&o.isEmpty()){n=!1;break t}for(a=o.iterator();a.hasNext();){var s=a.next();if(i(s)&&r(s)){n=!0;break t}}n=!1}while(0);if(n)t=this.myPicked_0;else{var l,u=this.myAllLookupResults_0;t:do{var c;if(e.isType(u,Pt)&&u.isEmpty()){l=!0;break t}for(c=u.iterator();c.hasNext();)if(i(c.next())){l=!1;break t}l=!0}while(0);if(l)t=this.myPicked_0;else{var p,h=this.myAllLookupResults_0;t:do{var _;if(e.isType(h,Pt)&&h.isEmpty()){p=!1;break t}for(_=h.iterator();_.hasNext();){var f=_.next();if(i(f)&&r(f)){p=!0;break t}}p=!1}while(0);if(p){var d,m=this.myAllLookupResults_0;t:do{for(var y=m.listIterator_za3lpa$(m.size);y.hasPrevious();){var $=y.previous();if(i($)&&r($)){d=$;break t}}throw new qn("List contains no element matching the predicate.")}while(0);t=zt(d)}else{var v,g=this.myAllLookupResults_0;t:do{for(var b=g.listIterator_za3lpa$(g.size);b.hasPrevious();){var w=b.previous();if(i(w)){v=w;break t}}v=null}while(0);var x,k=v,E=this.myAllLookupResults_0;t:do{for(var C=E.listIterator_za3lpa$(E.size);C.hasPrevious();){var S=C.previous();if(r(S)){x=S;break t}}x=null}while(0);t=Kt([k,x])}}}return t},ec.prototype.distance_0=function(t,e){var n,i,r=t.distance;if(0===r)if(t.isCrosshairEnabled&&null!=e){var o,a=t.targets,s=p();for(o=a.iterator();o.hasNext();){var l=o.next();null!=l.tipLayoutHint.coord&&s.add_11rb$(l)}var u,c=y(m(s,10));for(u=s.iterator();u.hasNext();){var h=u.next();c.add_11rb$(Nu().distance_l9poh5$(e,S(h.tipLayoutHint.coord)))}i=null!=(n=Fn(c))?n:this.FAKE_DISTANCE_8be2vx$}else i=this.FAKE_DISTANCE_8be2vx$;else i=r;return i},ec.prototype.isSameUnivariateGeom_0=function(t,e){return t.geomKind===e.geomKind&&this.UNIVARIATE_GEOMS_0.contains_11rb$(e.geomKind)},ec.prototype.filterResults_0=function(t,n){if(null==n||!this.UNIVARIATE_LINES_0.contains_11rb$(t.geomKind))return t;var i,r=t.targets,o=p();for(i=r.iterator();i.hasNext();){var a=i.next();null!=a.tipLayoutHint.coord&&o.add_11rb$(a)}var s,l,u=o,c=y(m(u,10));for(s=u.iterator();s.hasNext();){var h=s.next();c.add_11rb$(S(h.tipLayoutHint.coord).subtract_gpjtzr$(n).x)}t:do{var _=c.iterator();if(!_.hasNext()){l=null;break t}var f=_.next();if(!_.hasNext()){l=f;break t}var d=f,$=X.abs(d);do{var v=_.next(),g=X.abs(v);e.compareTo($,g)>0&&(f=v,$=g)}while(_.hasNext());l=f}while(0);var b,w,x=l,k=p();for(b=u.iterator();b.hasNext();){var E=b.next();S(E.tipLayoutHint.coord).subtract_gpjtzr$(n).x===x&&k.add_11rb$(E)}var C=Ye(),T=p();for(w=k.iterator();w.hasNext();){var O=w.next(),N=O.hitIndex;C.add_11rb$(N)&&T.add_11rb$(O)}return new Mn(T,t.distance,t.geomKind,t.contextualMapping,t.isCrosshairEnabled)},ec.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var nc=null;function ic(){return null===nc&&new ec,nc}function rc(t,e){sc(),this.locatorLookupSpace_0=t,this.locatorLookupStrategy_0=e}function oc(){ac=this,this.POINT_AREA_EPSILON_0=.1,this.POINT_X_NEAREST_EPSILON_0=2,this.RECT_X_NEAREST_EPSILON_0=2}Ju.$metadata$={kind:$,simpleName:"LocatedTargetsPicker",interfaces:[]},rc.prototype.checkPath_z3141m$=function(t,n,i){var r,o,a,s;switch(this.locatorLookupSpace_0.name){case"X":if(this.locatorLookupStrategy_0===Cn.NONE)return null;var l=n.points;if(l.isEmpty())return null;var u=sc().binarySearch_0(t.x,l.size,(s=l,function(t){return s.get_za3lpa$(t).projection().x()})),c=l.get_za3lpa$(u);switch(this.locatorLookupStrategy_0.name){case"HOVER":r=t.xl.get_za3lpa$(l.size-1|0).projection().x()?null:c;break;case"NEAREST":r=c;break;default:throw d("Unknown lookup strategy: "+this.locatorLookupStrategy_0)}return r;case"XY":switch(this.locatorLookupStrategy_0.name){case"HOVER":for(o=n.points.iterator();o.hasNext();){var p=o.next(),h=p.projection().xy();if(Nu().areEqual_f1g2it$(h,t,sc().POINT_AREA_EPSILON_0))return p}return null;case"NEAREST":var _=null;for(a=n.points.iterator();a.hasNext();){var f=a.next(),m=f.projection().xy();i.check_gpjtzr$(m)&&(_=f)}return _;case"NONE":return null;default:e.noWhenBranchMatched()}break;case"NONE":return null;default:throw Gn()}},rc.prototype.checkPoint_w0b42b$=function(t,n,i){var r,o;switch(this.locatorLookupSpace_0.name){case"X":var a=n.x();switch(this.locatorLookupStrategy_0.name){case"HOVER":r=Nu().areEqual_hln2n9$(a,t.x,sc().POINT_AREA_EPSILON_0);break;case"NEAREST":r=i.check_gpjtzr$(new h(a,0));break;case"NONE":r=!1;break;default:r=e.noWhenBranchMatched()}return r;case"XY":var s=n.xy();switch(this.locatorLookupStrategy_0.name){case"HOVER":o=Nu().areEqual_f1g2it$(s,t,sc().POINT_AREA_EPSILON_0);break;case"NEAREST":o=i.check_gpjtzr$(s);break;case"NONE":o=!1;break;default:o=e.noWhenBranchMatched()}return o;case"NONE":return!1;default:throw Gn()}},rc.prototype.checkRect_fqo6rd$=function(t,e,n){switch(this.locatorLookupSpace_0.name){case"X":var i=e.x();return this.rangeBasedLookup_0(t,n,i);case"XY":var r=e.xy();switch(this.locatorLookupStrategy_0.name){case"HOVER":return r.contains_gpjtzr$(t);case"NEAREST":if(r.contains_gpjtzr$(t))return n.check_gpjtzr$(t);var o=t.xn(e-1|0))return e-1|0;for(var i=0,r=e-1|0;i<=r;){var o=(r+i|0)/2|0,a=n(o);if(ta))return o;i=o+1|0}}return n(i)-tthis.POINTS_COUNT_TO_SKIP_SIMPLIFICATION_0){var s=a*this.AREA_TOLERANCE_RATIO_0,l=this.MAX_TOLERANCE_0,u=X.min(s,l);r=Kn.Companion.visvalingamWhyatt_ytws2g$(i).setWeightLimit_14dthe$(u).points,this.isLogEnabled_0&&this.log_0("Simp: "+f(i.size)+" -> "+f(r.size)+", tolerance="+f(u)+", bbox="+f(o)+", area="+f(a))}else this.isLogEnabled_0&&this.log_0("Keep: size: "+f(i.size)+", bbox="+f(o)+", area="+f(a)),r=i;r.size<4||n.add_11rb$(new bc(r,o))}}return n},$c.prototype.log_0=function(t){s(t)},$c.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var vc=null;function gc(){return null===vc&&new $c,vc}function bc(t,e){this.edges=t,this.bbox=e}function wc(t){Oc(),lc.call(this),this.data=t,this.points=this.data}function xc(t,e,n){Cc(),this.myPointTargetProjection_0=t,this.originalCoord=e,this.index=n}function kc(){Ec=this}bc.$metadata$={kind:$,simpleName:"RingXY",interfaces:[]},yc.$metadata$={kind:$,simpleName:"PolygonTargetProjection",interfaces:[lc]},xc.prototype.projection=function(){return this.myPointTargetProjection_0},kc.prototype.create_hdp8xa$=function(t,n,i){var r;switch(i.name){case"X":case"XY":r=new xc(hc().create_p1yge$(t,i),t,n);break;case"NONE":r=Nc();break;default:r=e.noWhenBranchMatched()}return r},kc.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Ec=null;function Cc(){return null===Ec&&new kc,Ec}function Sc(){Tc=this}xc.$metadata$={kind:$,simpleName:"PathPoint",interfaces:[]},Sc.prototype.create_zb7j6l$=function(t,e,n){for(var i=p(),r=0,o=t.iterator();o.hasNext();++r){var a=o.next();i.add_11rb$(Cc().create_hdp8xa$(a,e(r),n))}return new wc(i)},Sc.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Tc=null;function Oc(){return null===Tc&&new Sc,Tc}function Nc(){throw d("Undefined geom lookup space")}function Pc(t,e,n,i){Lc(),this.hitShape_8be2vx$=t,this.indexMapper_8be2vx$=e,this.tooltipParams_0=n,this.tooltipKind_8be2vx$=i}function Ac(){jc=this}wc.$metadata$={kind:$,simpleName:"PathTargetProjection",interfaces:[lc]},Pc.prototype.createGeomTarget_x7nr8i$=function(t,e){return new Wn(e,Lc().createTipLayoutHint_17pt0e$(t,this.hitShape_8be2vx$,this.tooltipParams_0.getColor(),this.tooltipKind_8be2vx$,this.tooltipParams_0.getStemLength()),this.tooltipParams_0.getTipLayoutHints())},Ac.prototype.createTipLayoutHint_17pt0e$=function(t,n,i,r,o){var a;switch(n.kind.name){case"POINT":switch(r.name){case"VERTICAL_TOOLTIP":a=Ln.Companion.verticalTooltip_6lq1u6$(t,n.point.radius,i,o);break;case"CURSOR_TOOLTIP":a=Ln.Companion.cursorTooltip_itpcqk$(t,i,o);break;default:throw d(("Wrong TipLayoutHint.kind = "+r+" for POINT").toString())}break;case"RECT":switch(r.name){case"VERTICAL_TOOLTIP":a=Ln.Companion.verticalTooltip_6lq1u6$(t,0,i,o);break;case"HORIZONTAL_TOOLTIP":a=Ln.Companion.horizontalTooltip_6lq1u6$(t,n.rect.width/2,i,o);break;case"CURSOR_TOOLTIP":a=Ln.Companion.cursorTooltip_itpcqk$(t,i,o);break;default:throw d(("Wrong TipLayoutHint.kind = "+r+" for RECT").toString())}break;case"PATH":if(!ft(r,Bn.HORIZONTAL_TOOLTIP))throw d(("Wrong TipLayoutHint.kind = "+r+" for PATH").toString());a=Ln.Companion.horizontalTooltip_6lq1u6$(t,0,i,o);break;case"POLYGON":if(!ft(r,Bn.CURSOR_TOOLTIP))throw d(("Wrong TipLayoutHint.kind = "+r+" for POLYGON").toString());a=Ln.Companion.cursorTooltip_itpcqk$(t,i,o);break;default:a=e.noWhenBranchMatched()}return a},Ac.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var jc=null;function Lc(){return null===jc&&new Ac,jc}function Rc(t){this.targetLocator_q7bze5$_0=t}function Ic(){}function zc(t){if(this.axisBreaks=null,this.axisLength=0,this.orientation=null,this.axisDomain=null,this.tickLabelsBounds=null,this.tickLabelRotationAngle=0,this.tickLabelHorizontalAnchor=null,this.tickLabelVerticalAnchor=null,this.tickLabelAdditionalOffsets=null,this.tickLabelSmallFont=!1,this.tickLabelsBoundsMax_0=null,null==t.myAxisBreaks)throw G("Failed requirement.".toString());if(null==t.myOrientation)throw G("Failed requirement.".toString());if(null==t.myTickLabelsBounds)throw G("Failed requirement.".toString());if(null==t.myAxisDomain)throw G("Failed requirement.".toString());this.axisBreaks=t.myAxisBreaks,this.axisLength=t.myAxisLength,this.orientation=t.myOrientation,this.axisDomain=t.myAxisDomain,this.tickLabelsBounds=t.myTickLabelsBounds,this.tickLabelRotationAngle=t.myTickLabelRotationAngle,this.tickLabelHorizontalAnchor=t.myLabelHorizontalAnchor,this.tickLabelVerticalAnchor=t.myLabelVerticalAnchor,this.tickLabelAdditionalOffsets=t.myLabelAdditionalOffsets,this.tickLabelSmallFont=t.myTickLabelSmallFont,this.tickLabelsBoundsMax_0=t.myMaxTickLabelsBounds}function Dc(){this.myAxisLength=0,this.myOrientation=null,this.myAxisDomain=null,this.myMaxTickLabelsBounds=null,this.myTickLabelSmallFont=!1,this.myLabelAdditionalOffsets=null,this.myLabelHorizontalAnchor=null,this.myLabelVerticalAnchor=null,this.myTickLabelRotationAngle=0,this.myTickLabelsBounds=null,this.myAxisBreaks=null}function Mc(t,e,n){Fc(),this.myOrientation_0=n,this.myAxisDomain_0=null,this.myAxisDomain_0=this.myOrientation_0.isHorizontal?t:e}function Bc(){Uc=this}Pc.$metadata$={kind:$,simpleName:"TargetPrototype",interfaces:[]},Rc.prototype.search_gpjtzr$=function(t){var e,n=this.convertToTargetCoord_gpjtzr$(t);if(null==(e=this.targetLocator_q7bze5$_0.search_gpjtzr$(n)))return null;var i=e;return this.convertLookupResult_rz45e2$_0(i)},Rc.prototype.convertLookupResult_rz45e2$_0=function(t){return new Mn(this.convertGeomTargets_cu5hhh$_0(t.targets),this.convertToPlotDistance_14dthe$(t.distance),t.geomKind,t.contextualMapping,t.contextualMapping.isCrosshairEnabled)},Rc.prototype.convertGeomTargets_cu5hhh$_0=function(t){return q(nt.Lists.transform_l7riir$(t,(e=this,function(t){return new Wn(t.hitIndex,e.convertTipLayoutHint_jnrdzl$_0(t.tipLayoutHint),e.convertTipLayoutHints_dshtp8$_0(t.aesTipLayoutHints))})));var e},Rc.prototype.convertTipLayoutHint_jnrdzl$_0=function(t){return new Ln(t.kind,S(this.safeConvertToPlotCoord_eoxeor$_0(t.coord)),this.convertToPlotDistance_14dthe$(t.objectRadius),t.color,t.stemLength)},Rc.prototype.convertTipLayoutHints_dshtp8$_0=function(t){var e,n=Z();for(e=t.entries.iterator();e.hasNext();){var i=e.next(),r=i.key,o=i.value,a=this.convertTipLayoutHint_jnrdzl$_0(o);n.put_xwzc9p$(r,a)}return n},Rc.prototype.safeConvertToPlotCoord_eoxeor$_0=function(t){return null==t?null:this.convertToPlotCoord_gpjtzr$(t)},Rc.$metadata$={kind:$,simpleName:"TransformedTargetLocator",interfaces:[Dn]},Ic.$metadata$={kind:b,simpleName:"AxisLayout",interfaces:[]},zc.prototype.withAxisLength_14dthe$=function(t){var e=new Dc;return e.myAxisBreaks=this.axisBreaks,e.myAxisLength=t,e.myOrientation=this.orientation,e.myAxisDomain=this.axisDomain,e.myTickLabelsBounds=this.tickLabelsBounds,e.myTickLabelRotationAngle=this.tickLabelRotationAngle,e.myLabelHorizontalAnchor=this.tickLabelHorizontalAnchor,e.myLabelVerticalAnchor=this.tickLabelVerticalAnchor,e.myLabelAdditionalOffsets=this.tickLabelAdditionalOffsets,e.myTickLabelSmallFont=this.tickLabelSmallFont,e.myMaxTickLabelsBounds=this.tickLabelsBoundsMax_0,e},zc.prototype.axisBounds=function(){return S(this.tickLabelsBounds).union_wthzt5$(I(0,0,0,0))},Dc.prototype.build=function(){return new zc(this)},Dc.prototype.axisLength_14dthe$=function(t){return this.myAxisLength=t,this},Dc.prototype.orientation_9y97dg$=function(t){return this.myOrientation=t,this},Dc.prototype.axisDomain_4fzjta$=function(t){return this.myAxisDomain=t,this},Dc.prototype.tickLabelsBoundsMax_myx2hi$=function(t){return this.myMaxTickLabelsBounds=t,this},Dc.prototype.tickLabelSmallFont_6taknv$=function(t){return this.myTickLabelSmallFont=t,this},Dc.prototype.tickLabelAdditionalOffsets_eajcfd$=function(t){return this.myLabelAdditionalOffsets=t,this},Dc.prototype.tickLabelHorizontalAnchor_tk0ev1$=function(t){return this.myLabelHorizontalAnchor=t,this},Dc.prototype.tickLabelVerticalAnchor_24j3ht$=function(t){return this.myLabelVerticalAnchor=t,this},Dc.prototype.tickLabelRotationAngle_14dthe$=function(t){return this.myTickLabelRotationAngle=t,this},Dc.prototype.tickLabelsBounds_myx2hi$=function(t){return this.myTickLabelsBounds=t,this},Dc.prototype.axisBreaks_hbp697$=function(t){return this.myAxisBreaks=t,this},Dc.$metadata$={kind:$,simpleName:"Builder",interfaces:[]},zc.$metadata$={kind:$,simpleName:"AxisLayoutInfo",interfaces:[]},Mc.prototype.initialThickness=function(){return 0},Mc.prototype.doLayout_o2m17x$=function(t,e){var n=this.myOrientation_0.isHorizontal?t.x:t.y,i=this.myOrientation_0.isHorizontal?I(0,0,n,0):I(0,0,0,n);return(new Dc).axisBreaks_hbp697$(Ue.Companion.EMPTY).axisLength_14dthe$(n).orientation_9y97dg$(this.myOrientation_0).axisDomain_4fzjta$(this.myAxisDomain_0).tickLabelsBounds_myx2hi$(i).build()},Bc.prototype.bottom_gyv40k$=function(t,e){return new Mc(t,e,eu())},Bc.prototype.left_gyv40k$=function(t,e){return new Mc(t,e,Jl())},Bc.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Uc=null;function Fc(){return null===Uc&&new Bc,Uc}function qc(t,e){if(Vc(),fp.call(this),this.facets_0=t,this.tileLayout_0=e,this.totalPanelHorizontalPadding_0=Vc().PANEL_PADDING_0*(this.facets_0.colCount-1|0),this.totalPanelVerticalPadding_0=Vc().PANEL_PADDING_0*(this.facets_0.rowCount-1|0),this.setPadding_6y0v78$(10,10,0,0),!this.facets_0.isDefined)throw G("Undefined facets.".toString())}function Gc(t){this.layoutInfo_8be2vx$=t}function Hc(){Yc=this,this.FACET_TAB_HEIGHT=30,this.FACET_H_PADDING=0,this.FACET_V_PADDING=6,this.PANEL_PADDING_0=10}Mc.$metadata$={kind:$,simpleName:"EmptyAxisLayout",interfaces:[Ic]},qc.prototype.doLayout_gpjtzr$=function(t){var n,i,r,o,a,s=new h(t.x-(this.paddingLeft_0+this.paddingRight_0),t.y-(this.paddingTop_0+this.paddingBottom_0)),l=this.facets_0.tileInfos();t:do{var u;for(u=l.iterator();u.hasNext();){var c=u.next();if(!c.colLabs.isEmpty()){a=c;break t}}a=null}while(0);var _,f,d=null!=(r=null!=(i=null!=(n=a)?n.colLabs:null)?i.size:null)?r:0,m=p();for(_=l.iterator();_.hasNext();){var y=_.next();y.colLabs.isEmpty()||m.add_11rb$(y)}var $=Ye(),v=p();for(f=m.iterator();f.hasNext();){var g=f.next(),b=g.row;$.add_11rb$(b)&&v.add_11rb$(g)}var w,x=v.size,k=Vc().facetColHeadHeight_za3lpa$(d)*x;t:do{var E;if(e.isType(l,Pt)&&l.isEmpty()){w=!1;break t}for(E=l.iterator();E.hasNext();)if(null!=E.next().rowLab){w=!0;break t}w=!1}while(0);for(var C=new h((w?1:0)*Vc().FACET_TAB_HEIGHT,k),S=((s=s.subtract_gpjtzr$(C)).x-this.totalPanelHorizontalPadding_0)/this.facets_0.colCount,T=(s.y-this.totalPanelVerticalPadding_0)/this.facets_0.rowCount,O=this.layoutTile_0(S,T),N=0;N<=1;N++){var P=this.tilesAreaSize_0(O),A=s.x-P.x,L=s.y-P.y,R=X.abs(A)<=this.facets_0.colCount;if(R&&(R=X.abs(L)<=this.facets_0.rowCount),R)break;var z=O.geomWidth_8be2vx$()+A/this.facets_0.colCount+O.axisThicknessY_8be2vx$(),D=O.geomHeight_8be2vx$()+L/this.facets_0.rowCount+O.axisThicknessX_8be2vx$();O=this.layoutTile_0(z,D)}var M=O.axisThicknessX_8be2vx$(),B=O.axisThicknessY_8be2vx$(),U=O.geomWidth_8be2vx$(),F=O.geomHeight_8be2vx$(),q=new j(h.Companion.ZERO,h.Companion.ZERO),G=new h(this.paddingLeft_0,this.paddingTop_0),H=p(),Y=0,V=0,K=0,W=0;for(o=l.iterator();o.hasNext();){var Z=o.next(),J=U,Q=0;Z.yAxis&&(J+=B,Q=B),null!=Z.rowLab&&(J+=Vc().FACET_TAB_HEIGHT);var tt,et=F;Z.xAxis&&Z.row===(this.facets_0.rowCount-1|0)&&(et+=M);var nt=Vc().facetColHeadHeight_za3lpa$(Z.colLabs.size);tt=nt;var it=I(0,0,J,et+=nt),rt=I(Q,tt,U,F),ot=Z.row;ot>K&&(K=ot,V+=W+Vc().PANEL_PADDING_0),W=et,0===Z.col&&(Y=0);var at=new h(Y,V);Y+=J+Vc().PANEL_PADDING_0;var st=wp(it,rt,Ep().clipBounds_wthzt5$(rt),O.layoutInfo_8be2vx$.xAxisInfo,O.layoutInfo_8be2vx$.yAxisInfo,Z.xAxis,Z.yAxis,Z.trueIndex).withOffset_gpjtzr$(G.add_gpjtzr$(at)).withFacetLabels_5hkr16$(Z.colLabs,Z.rowLab);H.add_11rb$(st),q=q.union_wthzt5$(st.getAbsoluteBounds_gpjtzr$(G))}return new dp(H,new h(q.right+this.paddingRight_0,q.height+this.paddingBottom_0))},qc.prototype.layoutTile_0=function(t,e){return new Gc(this.tileLayout_0.doLayout_gpjtzr$(new h(t,e)))},qc.prototype.tilesAreaSize_0=function(t){var e=t.geomWidth_8be2vx$()*this.facets_0.colCount+this.totalPanelHorizontalPadding_0+t.axisThicknessY_8be2vx$(),n=t.geomHeight_8be2vx$()*this.facets_0.rowCount+this.totalPanelVerticalPadding_0+t.axisThicknessX_8be2vx$();return new h(e,n)},Gc.prototype.axisThicknessX_8be2vx$=function(){return this.layoutInfo_8be2vx$.bounds.bottom-this.layoutInfo_8be2vx$.geomBounds.bottom},Gc.prototype.axisThicknessY_8be2vx$=function(){return this.layoutInfo_8be2vx$.geomBounds.left-this.layoutInfo_8be2vx$.bounds.left},Gc.prototype.geomWidth_8be2vx$=function(){return this.layoutInfo_8be2vx$.geomBounds.width},Gc.prototype.geomHeight_8be2vx$=function(){return this.layoutInfo_8be2vx$.geomBounds.height},Gc.$metadata$={kind:$,simpleName:"MyTileInfo",interfaces:[]},Hc.prototype.facetColLabelSize_14dthe$=function(t){return new h(t-0,this.FACET_TAB_HEIGHT-12)},Hc.prototype.facetColHeadHeight_za3lpa$=function(t){return t>0?this.facetColLabelSize_14dthe$(0).y*t+12:0},Hc.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Yc=null;function Vc(){return null===Yc&&new Hc,Yc}function Kc(){Wc=this}qc.$metadata$={kind:$,simpleName:"FacetGridPlotLayout",interfaces:[fp]},Kc.prototype.union_te9coj$=function(t,e){return null==e?t:t.union_wthzt5$(e)},Kc.prototype.union_a7nkjf$=function(t,e){var n,i=t;for(n=e.iterator();n.hasNext();){var r=n.next();i=i.union_wthzt5$(r)}return i},Kc.prototype.doubleRange_gyv40k$=function(t,e){var n=t.lowerEnd,i=e.lowerEnd,r=t.upperEnd-t.lowerEnd,o=e.upperEnd-e.lowerEnd;return I(n,i,r,o)},Kc.prototype.changeWidth_j6cmed$=function(t,e){return I(t.origin.x,t.origin.y,e,t.dimension.y)},Kc.prototype.changeWidthKeepRight_j6cmed$=function(t,e){return I(t.right-e,t.origin.y,e,t.dimension.y)},Kc.prototype.changeHeight_j6cmed$=function(t,e){return I(t.origin.x,t.origin.y,t.dimension.x,e)},Kc.prototype.changeHeightKeepBottom_j6cmed$=function(t,e){return I(t.origin.x,t.bottom-e,t.dimension.x,e)},Kc.$metadata$={kind:l,simpleName:"GeometryUtil",interfaces:[]};var Wc=null;function Xc(){return null===Wc&&new Kc,Wc}function Zc(t){ep(),this.size_8be2vx$=t}function Jc(){tp=this,this.EMPTY=new Qc(h.Companion.ZERO)}function Qc(t){Zc.call(this,t)}Object.defineProperty(Zc.prototype,"isEmpty",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Qc.prototype,"isEmpty",{configurable:!0,get:function(){return!0}}),Qc.prototype.createLegendBox=function(){throw d("Empty legend box info")},Qc.$metadata$={kind:$,interfaces:[Zc]},Jc.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var tp=null;function ep(){return null===tp&&new Jc,tp}function np(t,e){this.myPlotBounds_0=t,this.myTheme_0=e}function ip(t,e){this.plotInnerBoundsWithoutLegendBoxes=t,this.boxWithLocationList=q(e)}function rp(t,e){this.legendBox=t,this.location=e}function op(){ap=this}Zc.$metadata$={kind:$,simpleName:"LegendBoxInfo",interfaces:[]},np.prototype.doLayout_8sg693$=function(t){var e,n=this.myTheme_0.position(),i=this.myTheme_0.justification(),r=ol(),o=this.myPlotBounds_0.center,a=this.myPlotBounds_0,s=r===ol()?sp().verticalStack_8sg693$(t):sp().horizontalStack_8sg693$(t),l=sp().size_9w4uif$(s);if(ft(n,Wl().LEFT)||ft(n,Wl().RIGHT)){var u=a.width-l.x,c=X.max(0,u);a=ft(n,Wl().LEFT)?Xc().changeWidthKeepRight_j6cmed$(a,c):Xc().changeWidth_j6cmed$(a,c)}else if(ft(n,Wl().TOP)||ft(n,Wl().BOTTOM)){var p=a.height-l.y,_=X.max(0,p);a=ft(n,Wl().TOP)?Xc().changeHeightKeepBottom_j6cmed$(a,_):Xc().changeHeight_j6cmed$(a,_)}return e=ft(n,Wl().LEFT)?new h(a.left-l.x,o.y-l.y/2):ft(n,Wl().RIGHT)?new h(a.right,o.y-l.y/2):ft(n,Wl().TOP)?new h(o.x-l.x/2,a.top-l.y):ft(n,Wl().BOTTOM)?new h(o.x-l.x/2,a.bottom):sp().overlayLegendOrigin_tmgej$(a,l,n,i),new ip(a,sp().moveAll_cpge3q$(e,s))},ip.$metadata$={kind:$,simpleName:"Result",interfaces:[]},rp.prototype.size_8be2vx$=function(){return this.legendBox.size_8be2vx$},rp.prototype.bounds_8be2vx$=function(){return new j(this.location,this.legendBox.size_8be2vx$)},rp.$metadata$={kind:$,simpleName:"BoxWithLocation",interfaces:[]},np.$metadata$={kind:$,simpleName:"LegendBoxesLayout",interfaces:[]},op.prototype.verticalStack_8sg693$=function(t){var e,n=p(),i=0;for(e=t.iterator();e.hasNext();){var r=e.next();n.add_11rb$(new rp(r,new h(0,i))),i+=r.size_8be2vx$.y}return n},op.prototype.horizontalStack_8sg693$=function(t){var e,n=p(),i=0;for(e=t.iterator();e.hasNext();){var r=e.next();n.add_11rb$(new rp(r,new h(i,0))),i+=r.size_8be2vx$.x}return n},op.prototype.moveAll_cpge3q$=function(t,e){var n,i=p();for(n=e.iterator();n.hasNext();){var r=n.next();i.add_11rb$(new rp(r.legendBox,r.location.add_gpjtzr$(t)))}return i},op.prototype.size_9w4uif$=function(t){var e,n,i,r=null;for(e=t.iterator();e.hasNext();){var o=e.next();r=null!=(n=null!=r?r.union_wthzt5$(o.bounds_8be2vx$()):null)?n:o.bounds_8be2vx$()}return null!=(i=null!=r?r.dimension:null)?i:h.Companion.ZERO},op.prototype.overlayLegendOrigin_tmgej$=function(t,e,n,i){var r=t.dimension,o=new h(t.left+r.x*n.x,t.bottom-r.y*n.y),a=new h(-e.x*i.x,e.y*i.y-e.y);return o.add_gpjtzr$(a)},op.$metadata$={kind:l,simpleName:"LegendBoxesLayoutUtil",interfaces:[]};var ap=null;function sp(){return null===ap&&new op,ap}function lp(){}function up(t,e,n,i,r,o){hp(),this.scale_0=t,this.domainX_0=e,this.domainY_0=n,this.coordProvider_0=i,this.theme_0=r,this.orientation_0=o}function cp(){pp=this,this.TICK_LABEL_SPEC_0=s_()}lp.prototype.doLayout_gpjtzr$=function(t){var e=Ep().geomBounds_pym7oz$(0,0,t);return wp(e=e.union_wthzt5$(new j(e.origin,Ep().GEOM_MIN_SIZE)),e,Ep().clipBounds_wthzt5$(e),null,null,void 0,void 0,0)},lp.$metadata$={kind:$,simpleName:"LiveMapTileLayout",interfaces:[gp]},up.prototype.initialThickness=function(){if(this.theme_0.showTickMarks()||this.theme_0.showTickLabels()){var t=this.theme_0.tickLabelDistance();return this.theme_0.showTickLabels()?t+hp().initialTickLabelSize_0(this.orientation_0):t}return 0},up.prototype.doLayout_o2m17x$=function(t,e){return this.createLayouter_0(t).doLayout_p1d3jc$(hp().axisLength_0(t,this.orientation_0),e)},up.prototype.createLayouter_0=function(t){var e=this.coordProvider_0.adjustDomains_jz8wgn$(this.domainX_0,this.domainY_0,t),n=hp().axisDomain_0(e,this.orientation_0),i=Lp().createAxisBreaksProvider_oftday$(this.scale_0,n);return Dp().create_4ebi60$(this.orientation_0,n,i,this.theme_0)},cp.prototype.bottom_eknalg$=function(t,e,n,i,r){return new up(t,e,n,i,r,eu())},cp.prototype.left_eknalg$=function(t,e,n,i,r){return new up(t,e,n,i,r,Jl())},cp.prototype.initialTickLabelSize_0=function(t){return t.isHorizontal?this.TICK_LABEL_SPEC_0.height():this.TICK_LABEL_SPEC_0.width_za3lpa$(1)},cp.prototype.axisLength_0=function(t,e){return e.isHorizontal?t.x:t.y},cp.prototype.axisDomain_0=function(t,e){return e.isHorizontal?t.first:t.second},cp.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var pp=null;function hp(){return null===pp&&new cp,pp}function _p(){}function fp(){this.paddingTop_72hspu$_0=0,this.paddingRight_oc6xpz$_0=0,this.paddingBottom_phgrg6$_0=0,this.paddingLeft_66kgx2$_0=0}function dp(t,e){this.size=e,this.tiles=q(t)}function mp(){yp=this,this.AXIS_TITLE_OUTER_MARGIN=4,this.AXIS_TITLE_INNER_MARGIN=4,this.TITLE_V_MARGIN_0=4,this.LIVE_MAP_PLOT_PADDING_0=new h(10,0),this.LIVE_MAP_PLOT_MARGIN_0=new h(10,10)}up.$metadata$={kind:$,simpleName:"PlotAxisLayout",interfaces:[Ic]},_p.$metadata$={kind:b,simpleName:"PlotLayout",interfaces:[]},Object.defineProperty(fp.prototype,"paddingTop_0",{configurable:!0,get:function(){return this.paddingTop_72hspu$_0},set:function(t){this.paddingTop_72hspu$_0=t}}),Object.defineProperty(fp.prototype,"paddingRight_0",{configurable:!0,get:function(){return this.paddingRight_oc6xpz$_0},set:function(t){this.paddingRight_oc6xpz$_0=t}}),Object.defineProperty(fp.prototype,"paddingBottom_0",{configurable:!0,get:function(){return this.paddingBottom_phgrg6$_0},set:function(t){this.paddingBottom_phgrg6$_0=t}}),Object.defineProperty(fp.prototype,"paddingLeft_0",{configurable:!0,get:function(){return this.paddingLeft_66kgx2$_0},set:function(t){this.paddingLeft_66kgx2$_0=t}}),fp.prototype.setPadding_6y0v78$=function(t,e,n,i){this.paddingTop_0=t,this.paddingRight_0=e,this.paddingBottom_0=n,this.paddingLeft_0=i},fp.$metadata$={kind:$,simpleName:"PlotLayoutBase",interfaces:[_p]},dp.$metadata$={kind:$,simpleName:"PlotLayoutInfo",interfaces:[]},mp.prototype.titleDimensions_61zpoe$=function(t){if(w.Strings.isNullOrEmpty_pdl1vj$(t))return h.Companion.ZERO;var e=a_();return new h(e.width_za3lpa$(t.length),e.height()+2*this.TITLE_V_MARGIN_0)},mp.prototype.axisTitleDimensions_61zpoe$=function(t){if(w.Strings.isNullOrEmpty_pdl1vj$(t))return h.Companion.ZERO;var e=u_();return new h(e.width_za3lpa$(t.length),e.height())},mp.prototype.absoluteGeomBounds_vjhcds$=function(t,e){var n,i;if(e.tiles.isEmpty())throw G("Plot is empty".toString());var r=null;for(n=e.tiles.iterator();n.hasNext();){var o=n.next().getAbsoluteGeomBounds_gpjtzr$(t);r=null!=(i=null!=r?r.union_wthzt5$(o):null)?i:o}return S(r)},mp.prototype.liveMapBounds_wthzt5$=function(t){return new j(t.origin.add_gpjtzr$(this.LIVE_MAP_PLOT_PADDING_0),t.dimension.subtract_gpjtzr$(this.LIVE_MAP_PLOT_MARGIN_0))},mp.$metadata$={kind:l,simpleName:"PlotLayoutUtil",interfaces:[]};var yp=null;function $p(){return null===yp&&new mp,yp}function vp(t){fp.call(this),this.myTileLayout_0=t,this.setPadding_6y0v78$(10,10,0,0)}function gp(){}function bp(t,e,n,i,r,o,a,s,l,u,c){this.plotOrigin=t,this.bounds=e,this.geomBounds=n,this.clipBounds=i,this.xAxisInfo=r,this.yAxisInfo=o,this.facetXLabels=l,this.facetYLabel=u,this.trueIndex=c,this.xAxisShown=null!=this.xAxisInfo&&a,this.yAxisShown=null!=this.yAxisInfo&&s}function wp(t,e,n,i,r,o,a,s,l){return void 0===o&&(o=!0),void 0===a&&(a=!0),l=l||Object.create(bp.prototype),bp.call(l,h.Companion.ZERO,t,e,n,i,r,o,a,et(),null,s),l}function xp(){kp=this,this.GEOM_MARGIN=0,this.CLIP_EXTEND_0=5,this.GEOM_MIN_SIZE=new h(50,50)}vp.prototype.doLayout_gpjtzr$=function(t){var e=new h(t.x-(this.paddingLeft_0+this.paddingRight_0),t.y-(this.paddingTop_0+this.paddingBottom_0)),n=this.myTileLayout_0.doLayout_gpjtzr$(e),i=(n=n.withOffset_gpjtzr$(new h(this.paddingLeft_0,this.paddingTop_0))).bounds.dimension;return i=i.add_gpjtzr$(new h(this.paddingRight_0,this.paddingBottom_0)),new dp(zt(n),i)},vp.$metadata$={kind:$,simpleName:"SingleTilePlotLayout",interfaces:[fp]},gp.$metadata$={kind:b,simpleName:"TileLayout",interfaces:[]},bp.prototype.withOffset_gpjtzr$=function(t){return new bp(t,this.bounds,this.geomBounds,this.clipBounds,this.xAxisInfo,this.yAxisInfo,this.xAxisShown,this.yAxisShown,this.facetXLabels,this.facetYLabel,this.trueIndex)},bp.prototype.getAbsoluteBounds_gpjtzr$=function(t){var e=t.add_gpjtzr$(this.plotOrigin);return this.bounds.add_gpjtzr$(e)},bp.prototype.getAbsoluteGeomBounds_gpjtzr$=function(t){var e=t.add_gpjtzr$(this.plotOrigin);return this.geomBounds.add_gpjtzr$(e)},bp.prototype.withFacetLabels_5hkr16$=function(t,e){return new bp(this.plotOrigin,this.bounds,this.geomBounds,this.clipBounds,this.xAxisInfo,this.yAxisInfo,this.xAxisShown,this.yAxisShown,t,e,this.trueIndex)},bp.$metadata$={kind:$,simpleName:"TileLayoutInfo",interfaces:[]},xp.prototype.geomBounds_pym7oz$=function(t,e,n){var i=new h(e,this.GEOM_MARGIN),r=new h(this.GEOM_MARGIN,t),o=n.subtract_gpjtzr$(i).subtract_gpjtzr$(r);return o.x0&&(r.v=I(r.v.origin.x+s,r.v.origin.y,r.v.dimension.x-s,r.v.dimension.y)),l>0&&(r.v=I(r.v.origin.x,r.v.origin.y,r.v.dimension.x-l,r.v.dimension.y)),r.v=r.v.union_wthzt5$(new j(r.v.origin,Ep().GEOM_MIN_SIZE));var u=Op().tileBounds_0(n.v.axisBounds(),i.axisBounds(),r.v);return n.v=n.v.withAxisLength_14dthe$(r.v.width).build(),i=i.withAxisLength_14dthe$(r.v.height).build(),wp(u,r.v,Ep().clipBounds_wthzt5$(r.v),n.v,i,void 0,void 0,0)},Sp.prototype.tileBounds_0=function(t,e,n){var i=new h(n.left-e.width,n.top-Ep().GEOM_MARGIN),r=new h(n.right+Ep().GEOM_MARGIN,n.bottom+t.height);return new j(i,r.subtract_gpjtzr$(i))},Sp.prototype.computeAxisInfos_0=function(t,e,n){var i=t.initialThickness(),r=this.computeYAxisInfo_0(e,Ep().geomBounds_pym7oz$(i,e.initialThickness(),n)),o=r.axisBounds().dimension.x,a=this.computeXAxisInfo_0(t,n,Ep().geomBounds_pym7oz$(i,o,n));return a.axisBounds().dimension.y>i&&(r=this.computeYAxisInfo_0(e,Ep().geomBounds_pym7oz$(a.axisBounds().dimension.y,o,n))),new Ft(a,r)},Sp.prototype.computeXAxisInfo_0=function(t,e,n){var i=n.dimension.x*this.AXIS_STRETCH_RATIO_0,r=Ep().maxTickLabelsBounds_m3y558$(eu(),i,n,e);return t.doLayout_o2m17x$(n.dimension,r)},Sp.prototype.computeYAxisInfo_0=function(t,e){return t.doLayout_o2m17x$(e.dimension,null)},Sp.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Tp=null;function Op(){return null===Tp&&new Sp,Tp}function Np(t,e){this.domainAfterTransform_0=t,this.breaksGenerator_0=e}function Pp(){}function Ap(){jp=this}Cp.$metadata$={kind:$,simpleName:"XYPlotTileLayout",interfaces:[gp]},Object.defineProperty(Np.prototype,"isFixedBreaks",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Np.prototype,"fixedBreaks",{configurable:!0,get:function(){throw d("Not a fixed breaks provider")}}),Np.prototype.getBreaks_5wr77w$=function(t,e){return this.breaksGenerator_0.generateBreaks_1tlvto$(this.domainAfterTransform_0,t)},Np.$metadata$={kind:$,simpleName:"AdaptableAxisBreaksProvider",interfaces:[Pp]},Pp.$metadata$={kind:b,simpleName:"AxisBreaksProvider",interfaces:[]},Ap.prototype.createAxisBreaksProvider_oftday$=function(t,e){return t.hasBreaks()?new Mp(t.getScaleBreaks()):new Np(e,t.getBreaksGenerator())},Ap.$metadata$={kind:l,simpleName:"AxisBreaksUtil",interfaces:[]};var jp=null;function Lp(){return null===jp&&new Ap,jp}function Rp(t,e,n){Dp(),this.orientation=t,this.domainRange_jxchw$_0=e,this.labelsLayout_ft0nu6$_0=n}function Ip(){zp=this}Rp.prototype.doLayout_p1d3jc$=function(t,e){var n=this.labelsLayout_ft0nu6$_0.doLayout_s0wrr0$(t,this.toAxisMapper_14dthe$(t),e),i=n.bounds;return(new Dc).axisBreaks_hbp697$(n.breaks).axisLength_14dthe$(t).orientation_9y97dg$(this.orientation).axisDomain_4fzjta$(this.domainRange_jxchw$_0).tickLabelsBoundsMax_myx2hi$(e).tickLabelSmallFont_6taknv$(n.smallFont).tickLabelAdditionalOffsets_eajcfd$(n.labelAdditionalOffsets).tickLabelHorizontalAnchor_tk0ev1$(n.labelHorizontalAnchor).tickLabelVerticalAnchor_24j3ht$(n.labelVerticalAnchor).tickLabelRotationAngle_14dthe$(n.labelRotationAngle).tickLabelsBounds_myx2hi$(i).build()},Rp.prototype.toScaleMapper_14dthe$=function(t){return u.Mappers.mul_mdyssk$(this.domainRange_jxchw$_0,t)},Ip.prototype.create_4ebi60$=function(t,e,n,i){return t.isHorizontal?new Bp(t,e,n.isFixedBreaks?Xp().horizontalFixedBreaks_3unth9$(t,e,n.fixedBreaks,i):Xp().horizontalFlexBreaks_4ebi60$(t,e,n,i)):new Up(t,e,n.isFixedBreaks?Xp().verticalFixedBreaks_3unth9$(t,e,n.fixedBreaks,i):Xp().verticalFlexBreaks_4ebi60$(t,e,n,i))},Ip.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var zp=null;function Dp(){return null===zp&&new Ip,zp}function Mp(t){this.fixedBreaks_cixykn$_0=t}function Bp(t,e,n){Rp.call(this,t,e,n)}function Up(t,e,n){Rp.call(this,t,e,n)}function Fp(t,e,n,i,r){Yp(),Vp.call(this,t,e,n,r),this.breaks_0=i}function qp(){Hp=this,this.HORIZONTAL_TICK_LOCATION=Gp}function Gp(t){return new h(t,0)}Rp.$metadata$={kind:$,simpleName:"AxisLayouter",interfaces:[]},Object.defineProperty(Mp.prototype,"fixedBreaks",{get:function(){return this.fixedBreaks_cixykn$_0}}),Object.defineProperty(Mp.prototype,"isFixedBreaks",{configurable:!0,get:function(){return!0}}),Mp.prototype.getBreaks_5wr77w$=function(t,e){return this.fixedBreaks},Mp.$metadata$={kind:$,simpleName:"FixedAxisBreaksProvider",interfaces:[Pp]},Bp.prototype.toAxisMapper_14dthe$=function(t){return e=this.toScaleMapper_14dthe$(t),n=Be.Coords.toClientOffsetX_4fzjta$(new Q(0,t)),function(t){var i=e(t);return null!=i?n(i):null};var e,n},Bp.$metadata$={kind:$,simpleName:"HorizontalAxisLayouter",interfaces:[Rp]},Up.prototype.toAxisMapper_14dthe$=function(t){return e=this.toScaleMapper_14dthe$(t),n=Be.Coords.toClientOffsetY_4fzjta$(new Q(0,t)),function(t){var i=e(t);return null!=i?n(i):null};var e,n},Up.$metadata$={kind:$,simpleName:"VerticalAxisLayouter",interfaces:[Rp]},Fp.prototype.labelBounds_0=function(t,e){var n=this.labelSpec.dimensions_za3lpa$(e);return this.labelBounds_gpjtzr$(n).add_gpjtzr$(t)},Fp.prototype.labelsBounds_c3fefx$=function(t,e,n){var i,r=null;for(i=this.labelBoundsList_c3fefx$(t,this.breaks_0.labels,n).iterator();i.hasNext();){var o=i.next();r=Xc().union_te9coj$(o,r)}return r},Fp.prototype.labelBoundsList_c3fefx$=function(t,e,n){var i,r=p(),o=e.iterator();for(i=t.iterator();i.hasNext();){var a=i.next(),s=o.next(),l=this.labelBounds_0(n(a),s.length);r.add_11rb$(l)}return r},Fp.prototype.createAxisLabelsLayoutInfoBuilder_fd842m$=function(t,e){return(new Jp).breaks_d6t06k$(this.breaks_0).bounds_wthzt5$(this.applyLabelsOffset_w7e9pi$(t)).smallFont_6taknv$(!1).overlap_6taknv$(e)},Fp.prototype.noLabelsLayoutInfo_c0p8fa$=function(t,e){if(e.isHorizontal){var n=I(t/2,0,0,0);return n=this.applyLabelsOffset_w7e9pi$(n),(new Jp).breaks_d6t06k$(this.breaks_0).bounds_wthzt5$(n).smallFont_6taknv$(!1).overlap_6taknv$(!1).labelAdditionalOffsets_eajcfd$(null).labelHorizontalAnchor_ja80zo$(k.MIDDLE).labelVerticalAnchor_yaudma$(E.TOP).build()}throw d("Not implemented for "+e)},qp.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Hp=null;function Yp(){return null===Hp&&new qp,Hp}function Vp(t,e,n,i){Xp(),this.orientation=t,this.axisDomain=e,this.labelSpec=n,this.theme=i}function Kp(){Wp=this,this.TICK_LABEL_SPEC=s_(),this.INITIAL_TICK_LABEL_LENGTH=4,this.MIN_TICK_LABEL_DISTANCE=20,this.TICK_LABEL_SPEC_SMALL=l_()}Fp.$metadata$={kind:$,simpleName:"AbstractFixedBreaksLabelsLayout",interfaces:[Vp]},Object.defineProperty(Vp.prototype,"isHorizontal",{configurable:!0,get:function(){return this.orientation.isHorizontal}}),Vp.prototype.mapToAxis_d2cc22$=function(t,e){return eh().mapToAxis_lhkzxb$(t,this.axisDomain,e)},Vp.prototype.applyLabelsOffset_w7e9pi$=function(t){return eh().applyLabelsOffset_tsgpmr$(t,this.theme.tickLabelDistance(),this.orientation)},Kp.prototype.horizontalFlexBreaks_4ebi60$=function(t,e,n,i){if(!t.isHorizontal){var r=t.toString();throw G(r.toString())}if(n.isFixedBreaks)throw G("fixed breaks".toString());return new ih(t,e,this.TICK_LABEL_SPEC,n,i)},Kp.prototype.horizontalFixedBreaks_3unth9$=function(t,e,n,i){if(!t.isHorizontal){var r=t.toString();throw G(r.toString())}return new nh(t,e,this.TICK_LABEL_SPEC,n,i)},Kp.prototype.verticalFlexBreaks_4ebi60$=function(t,e,n,i){if(t.isHorizontal){var r=t.toString();throw G(r.toString())}if(n.isFixedBreaks)throw G("fixed breaks".toString());return new bh(t,e,this.TICK_LABEL_SPEC,n,i)},Kp.prototype.verticalFixedBreaks_3unth9$=function(t,e,n,i){if(t.isHorizontal){var r=t.toString();throw G(r.toString())}return new gh(t,e,this.TICK_LABEL_SPEC,n,i)},Kp.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Wp=null;function Xp(){return null===Wp&&new Kp,Wp}function Zp(t){this.breaks=null,this.bounds=null,this.smallFont=!1,this.labelAdditionalOffsets=null,this.labelHorizontalAnchor=null,this.labelVerticalAnchor=null,this.labelRotationAngle=0,this.isOverlap_8be2vx$=!1,this.breaks=t.myBreaks_8be2vx$,this.smallFont=t.mySmallFont_8be2vx$,this.bounds=t.myBounds_8be2vx$,this.isOverlap_8be2vx$=t.myOverlap_8be2vx$,this.labelAdditionalOffsets=null==t.myLabelAdditionalOffsets_8be2vx$?null:q(S(t.myLabelAdditionalOffsets_8be2vx$)),this.labelHorizontalAnchor=t.myLabelHorizontalAnchor_8be2vx$,this.labelVerticalAnchor=t.myLabelVerticalAnchor_8be2vx$,this.labelRotationAngle=t.myLabelRotationAngle_8be2vx$}function Jp(){this.myBreaks_8be2vx$=null,this.myBounds_8be2vx$=null,this.mySmallFont_8be2vx$=!1,this.myOverlap_8be2vx$=!1,this.myLabelAdditionalOffsets_8be2vx$=null,this.myLabelHorizontalAnchor_8be2vx$=null,this.myLabelVerticalAnchor_8be2vx$=null,this.myLabelRotationAngle_8be2vx$=0}function Qp(){th=this}Vp.$metadata$={kind:$,simpleName:"AxisLabelsLayout",interfaces:[]},Jp.prototype.breaks_d6t06k$=function(t){return this.myBreaks_8be2vx$=t,this},Jp.prototype.bounds_wthzt5$=function(t){return this.myBounds_8be2vx$=t,this},Jp.prototype.smallFont_6taknv$=function(t){return this.mySmallFont_8be2vx$=t,this},Jp.prototype.overlap_6taknv$=function(t){return this.myOverlap_8be2vx$=t,this},Jp.prototype.labelAdditionalOffsets_eajcfd$=function(t){return this.myLabelAdditionalOffsets_8be2vx$=t,this},Jp.prototype.labelHorizontalAnchor_ja80zo$=function(t){return this.myLabelHorizontalAnchor_8be2vx$=t,this},Jp.prototype.labelVerticalAnchor_yaudma$=function(t){return this.myLabelVerticalAnchor_8be2vx$=t,this},Jp.prototype.labelRotationAngle_14dthe$=function(t){return this.myLabelRotationAngle_8be2vx$=t,this},Jp.prototype.build=function(){return new Zp(this)},Jp.$metadata$={kind:$,simpleName:"Builder",interfaces:[]},Zp.$metadata$={kind:$,simpleName:"AxisLabelsLayoutInfo",interfaces:[]},Qp.prototype.getFlexBreaks_73ga93$=function(t,e,n){if(t.isFixedBreaks)throw G("fixed breaks not expected".toString());if(!(e>0))throw G(("maxCount="+e).toString());var i=t.getBreaks_5wr77w$(e,n);if(1===e&&!i.isEmpty)return new Ue(i.domainValues.subList_vux9f0$(0,1),i.transformedValues.subList_vux9f0$(0,1),i.labels.subList_vux9f0$(0,1));for(var r=e;i.size>e;){var o=(i.size-e|0)/2|0;r=r-X.max(1,o)|0,i=t.getBreaks_5wr77w$(r,n)}return i},Qp.prototype.maxLength_mhpeer$=function(t){var e,n=0;for(e=t.iterator();e.hasNext();){var i=n,r=e.next().length;n=X.max(i,r)}return n},Qp.prototype.horizontalCenteredLabelBounds_gpjtzr$=function(t){return I(-t.x/2,0,t.x,t.y)},Qp.prototype.doLayoutVerticalAxisLabels_7l1gh9$=function(t,e,n,i,r){var o;if(r.showTickLabels()){var a=this.verticalAxisLabelsBounds_0(e,n,i);o=this.applyLabelsOffset_tsgpmr$(a,r.tickLabelDistance(),t)}else if(r.showTickMarks()){var s=new j(h.Companion.ZERO,h.Companion.ZERO);o=this.applyLabelsOffset_tsgpmr$(s,r.tickLabelDistance(),t)}else o=new j(h.Companion.ZERO,h.Companion.ZERO);var l=o;return(new Jp).breaks_d6t06k$(e).bounds_wthzt5$(l).build()},Qp.prototype.mapToAxis_lhkzxb$=function(t,e,n){var i,r=e.lowerEnd,o=p();for(i=t.iterator();i.hasNext();){var a=n(i.next()-r);o.add_11rb$(S(a))}return o},Qp.prototype.applyLabelsOffset_tsgpmr$=function(t,n,i){var r,o=t;switch(i.name){case"LEFT":r=new h(-n,0);break;case"RIGHT":r=new h(n,0);break;case"TOP":r=new h(0,-n);break;case"BOTTOM":r=new h(0,n);break;default:r=e.noWhenBranchMatched()}var a=r;return i===Ql()||i===eu()?o=o.add_gpjtzr$(a):i!==Jl()&&i!==tu()||(o=o.add_gpjtzr$(a).subtract_gpjtzr$(new h(o.width,0))),o},Qp.prototype.verticalAxisLabelsBounds_0=function(t,e,n){var i=this.maxLength_mhpeer$(t.labels),r=Xp().TICK_LABEL_SPEC.width_za3lpa$(i),o=0,a=0;if(!t.isEmpty){var s=this.mapToAxis_lhkzxb$(t.transformedValues,e,n),l=s.get_za3lpa$(0),u=nt.Iterables.getLast_yl67zr$(s);o=X.min(l,u);var c=s.get_za3lpa$(0),p=nt.Iterables.getLast_yl67zr$(s);a=X.max(c,p),o-=Xp().TICK_LABEL_SPEC.height()/2,a+=Xp().TICK_LABEL_SPEC.height()/2}var _=new h(0,o),f=new h(r,a-o);return new j(_,f)},Qp.$metadata$={kind:l,simpleName:"BreakLabelsLayoutUtil",interfaces:[]};var th=null;function eh(){return null===th&&new Qp,th}function nh(t,e,n,i,r){if(Fp.call(this,t,e,n,i,r),!t.isHorizontal){var o=t.toString();throw G(o.toString())}}function ih(t,e,n,i,r){if(Vp.call(this,t,e,n,r),this.myBreaksProvider_0=i,!t.isHorizontal){var o=t.toString();throw G(o.toString())}if(this.myBreaksProvider_0.isFixedBreaks)throw G("fixed breaks".toString())}function rh(t,e,n,i,r,o){sh(),Fp.call(this,t,e,n,i,r),this.myMaxLines_0=o,this.myShelfIndexForTickIndex_0=p()}function oh(){ah=this,this.LINE_HEIGHT_0=1.2,this.MIN_DISTANCE_0=60}nh.prototype.overlap_0=function(t,e){return t.isOverlap_8be2vx$||null!=e&&!(e.xRange().encloses_d226ot$(S(t.bounds).xRange())&&e.yRange().encloses_d226ot$(t.bounds.yRange()))},nh.prototype.doLayout_s0wrr0$=function(t,e,n){if(!this.theme.showTickLabels())return this.noLabelsLayoutInfo_c0p8fa$(t,this.orientation);var i=this.simpleLayout_0().doLayout_s0wrr0$(t,e,n);return this.overlap_0(i,n)&&(i=this.multilineLayout_0().doLayout_s0wrr0$(t,e,n),this.overlap_0(i,n)&&(i=this.tiltedLayout_0().doLayout_s0wrr0$(t,e,n),this.overlap_0(i,n)&&(i=this.verticalLayout_0(this.labelSpec).doLayout_s0wrr0$(t,e,n),this.overlap_0(i,n)&&(i=this.verticalLayout_0(Xp().TICK_LABEL_SPEC_SMALL).doLayout_s0wrr0$(t,e,n))))),i},nh.prototype.simpleLayout_0=function(){return new lh(this.orientation,this.axisDomain,this.labelSpec,this.breaks_0,this.theme)},nh.prototype.multilineLayout_0=function(){return new rh(this.orientation,this.axisDomain,this.labelSpec,this.breaks_0,this.theme,2)},nh.prototype.tiltedLayout_0=function(){return new hh(this.orientation,this.axisDomain,this.labelSpec,this.breaks_0,this.theme)},nh.prototype.verticalLayout_0=function(t){return new mh(this.orientation,this.axisDomain,t,this.breaks_0,this.theme)},nh.prototype.labelBounds_gpjtzr$=function(t){throw d("Not implemented here")},nh.$metadata$={kind:$,simpleName:"HorizontalFixedBreaksLabelsLayout",interfaces:[Fp]},ih.prototype.doLayout_s0wrr0$=function(t,e,n){for(var i=ph().estimateBreakCountInitial_14dthe$(t),r=this.getBreaks_0(i,t),o=this.doLayoutLabels_0(r,t,e,n);o.isOverlap_8be2vx$;){var a=ph().estimateBreakCount_g5yaez$(r.labels,t);if(a>=i)break;i=a,r=this.getBreaks_0(i,t),o=this.doLayoutLabels_0(r,t,e,n)}return o},ih.prototype.doLayoutLabels_0=function(t,e,n,i){return new lh(this.orientation,this.axisDomain,this.labelSpec,t,this.theme).doLayout_s0wrr0$(e,n,i)},ih.prototype.getBreaks_0=function(t,e){return eh().getFlexBreaks_73ga93$(this.myBreaksProvider_0,t,e)},ih.$metadata$={kind:$,simpleName:"HorizontalFlexBreaksLabelsLayout",interfaces:[Vp]},Object.defineProperty(rh.prototype,"labelAdditionalOffsets_0",{configurable:!0,get:function(){var t,e=this.labelSpec.height()*sh().LINE_HEIGHT_0,n=p();t=this.breaks_0.size;for(var i=0;ithis.myMaxLines_0).labelAdditionalOffsets_eajcfd$(this.labelAdditionalOffsets_0).labelHorizontalAnchor_ja80zo$(k.MIDDLE).labelVerticalAnchor_yaudma$(E.TOP).build()},rh.prototype.labelBounds_gpjtzr$=function(t){return eh().horizontalCenteredLabelBounds_gpjtzr$(t)},oh.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var ah=null;function sh(){return null===ah&&new oh,ah}function lh(t,e,n,i,r){ph(),Fp.call(this,t,e,n,i,r)}function uh(){ch=this}rh.$metadata$={kind:$,simpleName:"HorizontalMultilineLabelsLayout",interfaces:[Fp]},lh.prototype.doLayout_s0wrr0$=function(t,e,n){var i;if(this.breaks_0.isEmpty)return this.noLabelsLayoutInfo_c0p8fa$(t,this.orientation);if(!this.theme.showTickLabels())return this.noLabelsLayoutInfo_c0p8fa$(t,this.orientation);var r=null,o=!1,a=this.mapToAxis_d2cc22$(this.breaks_0.transformedValues,e);for(i=this.labelBoundsList_c3fefx$(a,this.breaks_0.labels,Yp().HORIZONTAL_TICK_LOCATION).iterator();i.hasNext();){var s=i.next();o=o||null!=r&&r.xRange().isConnected_d226ot$(ot.SeriesUtil.expand_wws5xy$(s.xRange(),Xp().MIN_TICK_LABEL_DISTANCE/2,Xp().MIN_TICK_LABEL_DISTANCE/2)),r=Xc().union_te9coj$(s,r)}return(new Jp).breaks_d6t06k$(this.breaks_0).bounds_wthzt5$(this.applyLabelsOffset_w7e9pi$(S(r))).smallFont_6taknv$(!1).overlap_6taknv$(o).labelAdditionalOffsets_eajcfd$(null).labelHorizontalAnchor_ja80zo$(k.MIDDLE).labelVerticalAnchor_yaudma$(E.TOP).build()},lh.prototype.labelBounds_gpjtzr$=function(t){return eh().horizontalCenteredLabelBounds_gpjtzr$(t)},uh.prototype.estimateBreakCountInitial_14dthe$=function(t){return this.estimateBreakCount_0(4,t)},uh.prototype.estimateBreakCount_g5yaez$=function(t,e){var n=eh().maxLength_mhpeer$(t);return this.estimateBreakCount_0(n,e)},uh.prototype.estimateBreakCount_0=function(t,e){var n=e/(Xp().TICK_LABEL_SPEC.width_za3lpa$(t)+Xp().MIN_TICK_LABEL_DISTANCE);return Tt(X.max(1,n))},uh.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var ch=null;function ph(){return null===ch&&new uh,ch}function hh(t,e,n,i,r){dh(),Fp.call(this,t,e,n,i,r)}function _h(){fh=this,this.MIN_DISTANCE_0=5,this.ROTATION_DEGREE_0=-30;var t=Xn(this.ROTATION_DEGREE_0);this.SIN_0=X.sin(t);var e=Xn(this.ROTATION_DEGREE_0);this.COS_0=X.cos(e)}lh.$metadata$={kind:$,simpleName:"HorizontalSimpleLabelsLayout",interfaces:[Fp]},Object.defineProperty(hh.prototype,"labelHorizontalAnchor_0",{configurable:!0,get:function(){if(this.orientation===eu())return k.RIGHT;throw pn("Not implemented")}}),Object.defineProperty(hh.prototype,"labelVerticalAnchor_0",{configurable:!0,get:function(){return E.TOP}}),hh.prototype.doLayout_s0wrr0$=function(t,e,n){var i=this.labelSpec.height(),r=this.mapToAxis_d2cc22$(this.breaks_0.transformedValues,e),o=!1;if(this.breaks_0.size>=2){var a=(i+dh().MIN_DISTANCE_0)/dh().SIN_0,s=X.abs(a),l=r.get_za3lpa$(0)-r.get_za3lpa$(1);o=X.abs(l)=-90&&dh().ROTATION_DEGREE_0<=0&&this.labelHorizontalAnchor_0===k.RIGHT&&this.labelVerticalAnchor_0===E.TOP))throw pn("Not implemented");var e=t.x*dh().COS_0,n=X.abs(e),i=t.y*dh().SIN_0,r=n+2*X.abs(i),o=t.x*dh().SIN_0,a=X.abs(o),s=t.y*dh().COS_0,l=a+X.abs(s),u=t.x*dh().COS_0,c=X.abs(u),p=t.y*dh().SIN_0,h=-(c+X.abs(p));return I(h,0,r,l)},_h.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var fh=null;function dh(){return null===fh&&new _h,fh}function mh(t,e,n,i,r){vh(),Fp.call(this,t,e,n,i,r)}function yh(){$h=this,this.MIN_DISTANCE_0=5,this.ROTATION_DEGREE_0=90}hh.$metadata$={kind:$,simpleName:"HorizontalTiltedLabelsLayout",interfaces:[Fp]},Object.defineProperty(mh.prototype,"labelHorizontalAnchor",{configurable:!0,get:function(){if(this.orientation===eu())return k.LEFT;throw pn("Not implemented")}}),Object.defineProperty(mh.prototype,"labelVerticalAnchor",{configurable:!0,get:function(){return E.CENTER}}),mh.prototype.doLayout_s0wrr0$=function(t,e,n){var i=this.labelSpec.height(),r=this.mapToAxis_d2cc22$(this.breaks_0.transformedValues,e),o=!1;if(this.breaks_0.size>=2){var a=i+vh().MIN_DISTANCE_0,s=r.get_za3lpa$(0)-r.get_za3lpa$(1);o=X.abs(s)0))throw G(("axis length: "+t).toString());var i=this.maxTickCount_0(t),r=this.getBreaks_0(i,t);return eh().doLayoutVerticalAxisLabels_7l1gh9$(this.orientation,r,this.axisDomain,e,this.theme)},bh.prototype.getBreaks_0=function(t,e){return eh().getFlexBreaks_73ga93$(this.myBreaksProvider_0,t,e)},bh.$metadata$={kind:$,simpleName:"VerticalFlexBreaksLabelsLayout",interfaces:[Vp]},kh.$metadata$={kind:l,simpleName:"Title",interfaces:[]};var Eh=null;function Ch(){Sh=this,this.TITLE_FONT_SIZE=12,this.ITEM_FONT_SIZE=10,this.OUTLINE_COLOR=R.Companion.parseHex_61zpoe$(Uh().XX_LIGHT_GRAY)}Ch.$metadata$={kind:l,simpleName:"Legend",interfaces:[]};var Sh=null;function Th(){Oh=this,this.MAX_POINTER_FOOTING_LENGTH=12,this.POINTER_FOOTING_TO_SIDE_LENGTH_RATIO=.4,this.MARGIN_BETWEEN_TOOLTIPS=5,this.DATA_TOOLTIP_FONT_SIZE=12,this.LINE_INTERVAL=3,this.H_CONTENT_PADDING=4,this.V_CONTENT_PADDING=4,this.LABEL_VALUE_INTERVAL=8,this.BORDER_WIDTH=4,this.DARK_TEXT_COLOR=R.Companion.BLACK,this.LIGHT_TEXT_COLOR=R.Companion.WHITE,this.AXIS_TOOLTIP_FONT_SIZE=12,this.AXIS_TOOLTIP_COLOR=Mh().LINE_COLOR,this.AXIS_RADIUS=1.5}Th.$metadata$={kind:l,simpleName:"Tooltip",interfaces:[]};var Oh=null;function Nh(){return null===Oh&&new Th,Oh}function Ph(){}function Ah(){jh=this,this.FONT_SIZE=12,this.FONT_SIZE_CSS=f(12)+"px"}xh.$metadata$={kind:$,simpleName:"Common",interfaces:[]},Ah.$metadata$={kind:l,simpleName:"Head",interfaces:[]};var jh=null;function Lh(){Rh=this,this.FONT_SIZE=12,this.FONT_SIZE_CSS=f(12)+"px"}Lh.$metadata$={kind:l,simpleName:"Data",interfaces:[]};var Rh=null;function Ih(){}function zh(){Dh=this,this.TITLE_FONT_SIZE=12,this.TICK_FONT_SIZE=10,this.TICK_FONT_SIZE_SMALL=8,this.LINE_COLOR=R.Companion.parseHex_61zpoe$(Uh().DARK_GRAY),this.TICK_COLOR=R.Companion.parseHex_61zpoe$(Uh().DARK_GRAY),this.GRID_LINE_COLOR=R.Companion.parseHex_61zpoe$(Uh().X_LIGHT_GRAY),this.LINE_WIDTH=1,this.TICK_LINE_WIDTH=1,this.GRID_LINE_WIDTH=1}Ph.$metadata$={kind:$,simpleName:"Table",interfaces:[]},zh.$metadata$={kind:l,simpleName:"Axis",interfaces:[]};var Dh=null;function Mh(){return null===Dh&&new zh,Dh}Ih.$metadata$={kind:$,simpleName:"Plot",interfaces:[]},wh.$metadata$={kind:l,simpleName:"Defaults",interfaces:[]};var Bh=null;function Uh(){return null===Bh&&new wh,Bh}function Fh(){qh=this}Fh.prototype.get_diyz8p$=function(t,e){var n=Zn();return n.append_pdl1vj$(e).append_pdl1vj$(" {").append_pdl1vj$(t.isMonospaced?"\n font-family: "+Uh().FONT_FAMILY_MONOSPACED+";":"\n").append_pdl1vj$("\n font-size: ").append_s8jyv4$(t.fontSize).append_pdl1vj$("px;").append_pdl1vj$(t.isBold?"\n font-weight: bold;":"").append_pdl1vj$("\n}\n"),n.toString()},Fh.$metadata$={kind:l,simpleName:"LabelCss",interfaces:[]};var qh=null;function Gh(){return null===qh&&new Fh,qh}function Hh(){}function Yh(){e_(),this.fontSize_yu4fth$_0=0,this.isBold_4ltcm$_0=!1,this.isMonospaced_kwm1y$_0=!1}function Vh(){t_=this,this.FONT_SIZE_TO_GLYPH_WIDTH_RATIO_0=.67,this.FONT_SIZE_TO_GLYPH_WIDTH_RATIO_MONOSPACED_0=.6,this.FONT_WEIGHT_BOLD_TO_NORMAL_WIDTH_RATIO_0=1.075,this.LABEL_PADDING_0=0}Hh.$metadata$={kind:b,simpleName:"Serializable",interfaces:[]},Object.defineProperty(Yh.prototype,"fontSize",{configurable:!0,get:function(){return this.fontSize_yu4fth$_0}}),Object.defineProperty(Yh.prototype,"isBold",{configurable:!0,get:function(){return this.isBold_4ltcm$_0}}),Object.defineProperty(Yh.prototype,"isMonospaced",{configurable:!0,get:function(){return this.isMonospaced_kwm1y$_0}}),Yh.prototype.dimensions_za3lpa$=function(t){return new h(this.width_za3lpa$(t),this.height())},Yh.prototype.width_za3lpa$=function(t){var e=e_().FONT_SIZE_TO_GLYPH_WIDTH_RATIO_0;this.isMonospaced&&(e=e_().FONT_SIZE_TO_GLYPH_WIDTH_RATIO_MONOSPACED_0);var n=t*this.fontSize*e+2*e_().LABEL_PADDING_0;return this.isBold?n*e_().FONT_WEIGHT_BOLD_TO_NORMAL_WIDTH_RATIO_0:n},Yh.prototype.height=function(){return this.fontSize+2*e_().LABEL_PADDING_0},Vh.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Kh,Wh,Xh,Zh,Jh,Qh,t_=null;function e_(){return null===t_&&new Vh,t_}function n_(t,e,n,i){return void 0===e&&(e=!1),void 0===n&&(n=!1),i=i||Object.create(Yh.prototype),Yh.call(i),i.fontSize_yu4fth$_0=t,i.isBold_4ltcm$_0=e,i.isMonospaced_kwm1y$_0=n,i}function i_(){}function r_(t,e,n,i,r){void 0===i&&(i=!1),void 0===r&&(r=!1),Xt.call(this),this.name$=t,this.ordinal$=e,this.myLabelMetrics_3i33aj$_0=null,this.myLabelMetrics_3i33aj$_0=n_(n,i,r)}function o_(){o_=function(){},Kh=new r_("PLOT_TITLE",0,16,!0),Wh=new r_("AXIS_TICK",1,10),Xh=new r_("AXIS_TICK_SMALL",2,8),Zh=new r_("AXIS_TITLE",3,12),Jh=new r_("LEGEND_TITLE",4,12,!0),Qh=new r_("LEGEND_ITEM",5,10)}function a_(){return o_(),Kh}function s_(){return o_(),Wh}function l_(){return o_(),Xh}function u_(){return o_(),Zh}function c_(){return o_(),Jh}function p_(){return o_(),Qh}function h_(){return[a_(),s_(),l_(),u_(),c_(),p_()]}function __(){f_=this,this.JFX_PLOT_STYLESHEET="/svgMapper/jfx/plot.css",this.PLOT_CONTAINER="plt-container",this.PLOT="plt-plot",this.PLOT_TITLE="plt-plot-title",this.PLOT_TRANSPARENT="plt-transparent",this.PLOT_BACKDROP="plt-backdrop",this.AXIS="plt-axis",this.AXIS_TITLE="plt-axis-title",this.TICK="tick",this.SMALL_TICK_FONT="small-tick-font",this.BACK="back",this.LEGEND="plt_legend",this.LEGEND_TITLE="legend-title",this.PLOT_DATA_TOOLTIP="plt-data-tooltip",this.PLOT_AXIS_TOOLTIP="plt-axis-tooltip",this.CSS_0=Qn('\n |.plt-container {\n |\tfont-family: "Lucida Grande", sans-serif;\n |\tcursor: crosshair;\n |\tuser-select: none;\n |\t-webkit-user-select: none;\n |\t-moz-user-select: none;\n |\t-ms-user-select: none;\n |}\n |.plt-backdrop {\n | fill: white;\n |}\n |.plt-transparent .plt-backdrop {\n | visibility: hidden;\n |}\n |text {\n |\tfont-size: 12px;\n |\tfill: #3d3d3d;\n |\t\n |\ttext-rendering: optimizeLegibility;\n |}\n |.plt-data-tooltip text {\n |\tfont-size: 12px;\n |}\n |.plt-axis-tooltip text {\n |\tfont-size: 12px;\n |}\n |.plt-axis line {\n |\tshape-rendering: crispedges;\n |}\n ')}Yh.$metadata$={kind:$,simpleName:"LabelMetrics",interfaces:[Hh,i_]},i_.$metadata$={kind:b,simpleName:"LabelSpec",interfaces:[]},Object.defineProperty(r_.prototype,"isBold",{configurable:!0,get:function(){return this.myLabelMetrics_3i33aj$_0.isBold}}),Object.defineProperty(r_.prototype,"isMonospaced",{configurable:!0,get:function(){return this.myLabelMetrics_3i33aj$_0.isMonospaced}}),Object.defineProperty(r_.prototype,"fontSize",{configurable:!0,get:function(){return this.myLabelMetrics_3i33aj$_0.fontSize}}),r_.prototype.dimensions_za3lpa$=function(t){return this.myLabelMetrics_3i33aj$_0.dimensions_za3lpa$(t)},r_.prototype.width_za3lpa$=function(t){return this.myLabelMetrics_3i33aj$_0.width_za3lpa$(t)},r_.prototype.height=function(){return this.myLabelMetrics_3i33aj$_0.height()},r_.$metadata$={kind:$,simpleName:"PlotLabelSpec",interfaces:[i_,Xt]},r_.values=h_,r_.valueOf_61zpoe$=function(t){switch(t){case"PLOT_TITLE":return a_();case"AXIS_TICK":return s_();case"AXIS_TICK_SMALL":return l_();case"AXIS_TITLE":return u_();case"LEGEND_TITLE":return c_();case"LEGEND_ITEM":return p_();default:Zt("No enum constant jetbrains.datalore.plot.builder.presentation.PlotLabelSpec."+t)}},Object.defineProperty(__.prototype,"css",{configurable:!0,get:function(){var t,e,n=new Jn(this.CSS_0.toString());for(n.append_s8itvh$(10),t=h_(),e=0;e!==t.length;++e){var i=t[e],r=this.selector_0(i);n.append_pdl1vj$(Gh().get_diyz8p$(i,r))}return n.toString()}}),__.prototype.selector_0=function(t){var n;switch(t.name){case"PLOT_TITLE":n=".plt-plot-title";break;case"AXIS_TICK":n=".plt-axis .tick text";break;case"AXIS_TICK_SMALL":n=".plt-axis.small-tick-font .tick text";break;case"AXIS_TITLE":n=".plt-axis-title text";break;case"LEGEND_TITLE":n=".plt_legend .legend-title text";break;case"LEGEND_ITEM":n=".plt_legend text";break;default:n=e.noWhenBranchMatched()}return n},__.$metadata$={kind:l,simpleName:"Style",interfaces:[]};var f_=null;function d_(){return null===f_&&new __,f_}function m_(){}function y_(){}function $_(){}function v_(){b_=this,this.RANDOM=M_().ALIAS,this.PICK=R_().ALIAS,this.SYSTEMATIC=tf().ALIAS,this.RANDOM_GROUP=C_().ALIAS,this.SYSTEMATIC_GROUP=P_().ALIAS,this.RANDOM_STRATIFIED=H_().ALIAS_8be2vx$,this.VERTEX_VW=af().ALIAS,this.VERTEX_DP=cf().ALIAS,this.NONE=new g_}function g_(){}m_.$metadata$={kind:b,simpleName:"GroupAwareSampling",interfaces:[$_]},y_.$metadata$={kind:b,simpleName:"PointSampling",interfaces:[$_]},$_.$metadata$={kind:b,simpleName:"Sampling",interfaces:[]},v_.prototype.random_280ow0$=function(t,e){return new I_(t,e)},v_.prototype.pick_za3lpa$=function(t){return new A_(t)},v_.prototype.vertexDp_za3lpa$=function(t){return new sf(t)},v_.prototype.vertexVw_za3lpa$=function(t){return new nf(t)},v_.prototype.systematic_za3lpa$=function(t){return new Z_(t)},v_.prototype.randomGroup_280ow0$=function(t,e){return new x_(t,e)},v_.prototype.systematicGroup_za3lpa$=function(t){return new T_(t)},v_.prototype.randomStratified_vcwos1$=function(t,e,n){return new B_(t,e,n)},Object.defineProperty(g_.prototype,"expressionText",{configurable:!0,get:function(){return"none"}}),g_.prototype.isApplicable_dhhkv7$=function(t){return!1},g_.prototype.apply_dhhkv7$=function(t){return t},g_.$metadata$={kind:$,simpleName:"NoneSampling",interfaces:[y_]},v_.$metadata$={kind:l,simpleName:"Samplings",interfaces:[]};var b_=null;function w_(){return null===b_&&new v_,b_}function x_(t,e){C_(),S_.call(this,t),this.mySeed_0=e}function k_(){E_=this,this.ALIAS="group_random"}Object.defineProperty(x_.prototype,"expressionText",{configurable:!0,get:function(){return"sampling_"+C_().ALIAS+"(n="+f(this.sampleSize)+(null!=this.mySeed_0?", seed="+f(this.mySeed_0):"")+")"}}),x_.prototype.apply_se5qvl$=function(t,e){if(!this.isApplicable_se5qvl$(t,e))throw G("Failed requirement.".toString());var n=X_().distinctGroups_ejae6o$(e,t.rowCount());ti(n,this.createRandom_0());var i=ni(ei(n,this.sampleSize));return this.doSelect_z69lec$(t,i,e)},x_.prototype.createRandom_0=function(){var t,e;return null!=(e=null!=(t=this.mySeed_0)?ii(t):null)?e:ri.Default},k_.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var E_=null;function C_(){return null===E_&&new k_,E_}function S_(t){Y_.call(this,t)}function T_(t){P_(),S_.call(this,t)}function O_(){N_=this,this.ALIAS="group_systematic"}x_.$metadata$={kind:$,simpleName:"GroupRandomSampling",interfaces:[S_]},S_.prototype.isApplicable_se5qvl$=function(t,e){return this.isApplicable_ijg2gx$(t,e,X_().groupCount_ejae6o$(e,t.rowCount()))},S_.prototype.isApplicable_ijg2gx$=function(t,e,n){return n>this.sampleSize},S_.prototype.doSelect_z69lec$=function(t,e,n){var i,r=ks().indicesByGroup_wc9gac$(t.rowCount(),n),o=p();for(i=e.iterator();i.hasNext();){var a=i.next();o.addAll_brywnq$(S(r.get_11rb$(a)))}return t.selectIndices_pqoyrt$(o)},S_.$metadata$={kind:$,simpleName:"GroupSamplingBase",interfaces:[m_,Y_]},Object.defineProperty(T_.prototype,"expressionText",{configurable:!0,get:function(){return"sampling_"+P_().ALIAS+"(n="+f(this.sampleSize)+")"}}),T_.prototype.isApplicable_ijg2gx$=function(t,e,n){return S_.prototype.isApplicable_ijg2gx$.call(this,t,e,n)&&tf().computeStep_vux9f0$(n,this.sampleSize)>=2},T_.prototype.apply_se5qvl$=function(t,e){if(!this.isApplicable_se5qvl$(t,e))throw G("Failed requirement.".toString());for(var n=X_().distinctGroups_ejae6o$(e,t.rowCount()),i=tf().computeStep_vux9f0$(n.size,this.sampleSize),r=Ye(),o=0;othis.sampleSize},B_.prototype.apply_se5qvl$=function(t,e){var n,i,r,o,a;if(!this.isApplicable_se5qvl$(t,e))throw G("Failed requirement.".toString());var s=ks().indicesByGroup_wc9gac$(t.rowCount(),e),l=null!=(n=this.myMinSubsampleSize_0)?n:2,u=l;l=X.max(0,u);var c=t.rowCount(),h=p(),_=null!=(r=null!=(i=this.mySeed_0)?ii(i):null)?r:ri.Default;for(o=s.keys.iterator();o.hasNext();){var f=o.next(),d=S(s.get_11rb$(f)),m=d.size,y=m/c,$=Tt(ai(this.sampleSize*y)),v=$,g=l;if(($=X.max(v,g))>=m)h.addAll_brywnq$(d);else for(a=oi.SamplingUtil.sampleWithoutReplacement_o7ew15$(m,$,_,U_(d),F_(d)).iterator();a.hasNext();){var b=a.next();h.add_11rb$(d.get_za3lpa$(b))}}return t.selectIndices_pqoyrt$(h)},q_.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var G_=null;function H_(){return null===G_&&new q_,G_}function Y_(t){if(this.sampleSize=t,!(this.sampleSize>0)){var e="Sample size must be greater than zero, but was: "+f(this.sampleSize);throw d(e.toString())}}B_.$metadata$={kind:$,simpleName:"RandomStratifiedSampling",interfaces:[m_,Y_]},Y_.prototype.isApplicable_dhhkv7$=function(t){return t.rowCount()>this.sampleSize},Y_.$metadata$={kind:$,simpleName:"SamplingBase",interfaces:[$_]};var V_=Qt((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(n),r(i))}}}));function K_(){W_=this}K_.prototype.groupCount_ejae6o$=function(t,e){var n,i=si(0,e),r=y(m(i,10));for(n=i.iterator();n.hasNext();){var o=n.next();r.add_11rb$(t(o))}return It(r).size},K_.prototype.distinctGroups_ejae6o$=function(t,e){var n,i=si(0,e),r=y(m(i,10));for(n=i.iterator();n.hasNext();){var o=n.next();r.add_11rb$(t(o))}return On(It(r))},K_.prototype.xVar_bbyvt0$=function(t){return t.contains_11rb$(bt.Stats.X)?bt.Stats.X:t.contains_11rb$(a.TransformVar.X)?a.TransformVar.X:null},K_.prototype.xVar_dhhkv7$=function(t){var e;if(null==(e=this.xVar_bbyvt0$(t.variables())))throw d("Can't apply sampling: couldn't deduce the (X) variable.");return e},K_.prototype.yVar_dhhkv7$=function(t){if(t.has_8xm3sj$(bt.Stats.Y))return bt.Stats.Y;if(t.has_8xm3sj$(a.TransformVar.Y))return a.TransformVar.Y;throw d("Can't apply sampling: couldn't deduce the (Y) variable.")},K_.prototype.splitRings_dhhkv7$=function(t){for(var n,i,r=p(),o=null,a=-1,s=new pf(e.isType(n=t.get_8xm3sj$(this.xVar_dhhkv7$(t)),Mt)?n:c(),e.isType(i=t.get_8xm3sj$(this.yVar_dhhkv7$(t)),Mt)?i:c()),l=0;l!==s.size;++l){var u=s.get_za3lpa$(l);a<0?(a=l,o=u):ft(o,u)&&(r.add_11rb$(s.subList_vux9f0$(a,l+1|0)),a=-1,o=null)}return a>=0&&r.add_11rb$(s.subList_vux9f0$(a,s.size)),r},K_.prototype.calculateRingLimits_rmr3bv$=function(t,e){var n,i=y(m(t,10));for(n=t.iterator();n.hasNext();){var r=n.next();i.add_11rb$(Vn(r))}var o,a,s=li(i),l=new ui(0),u=new ci(0);return yi(_i(di(_i(di(_i(hi(pi(t)),(a=t,function(t){return new rt(t,Vn(a.get_za3lpa$(t)))})),fi(new te(V_((o=this,function(t){return o.getRingArea_0(t)}))))),function(t,e,n,i,r,o){return function(a){var s=mi(a.second/(t-e.get())*(n-i.get()|0)),l=r.get_za3lpa$(o.getRingIndex_3gcxfl$(a)).size,u=X.min(s,l);return u>=4?(e.getAndAdd_14dthe$(o.getRingArea_0(a)),i.getAndAdd_za3lpa$(u)):u=0,new rt(o.getRingIndex_3gcxfl$(a),u)}}(s,l,e,u,t,this)),new te(V_(function(t){return function(e){return t.getRingIndex_3gcxfl$(e)}}(this)))),function(t){return function(e){return t.getRingLimit_66os8t$(e)}}(this)))},K_.prototype.getRingIndex_3gcxfl$=function(t){return t.first},K_.prototype.getRingArea_0=function(t){return t.second},K_.prototype.getRingLimit_66os8t$=function(t){return t.second},K_.$metadata$={kind:l,simpleName:"SamplingUtil",interfaces:[]};var W_=null;function X_(){return null===W_&&new K_,W_}function Z_(t){tf(),Y_.call(this,t)}function J_(){Q_=this,this.ALIAS="systematic"}Object.defineProperty(Z_.prototype,"expressionText",{configurable:!0,get:function(){return"sampling_"+tf().ALIAS+"(n="+f(this.sampleSize)+")"}}),Z_.prototype.isApplicable_dhhkv7$=function(t){return Y_.prototype.isApplicable_dhhkv7$.call(this,t)&&this.computeStep_0(t.rowCount())>=2},Z_.prototype.apply_dhhkv7$=function(t){if(!this.isApplicable_dhhkv7$(t))throw G("Failed requirement.".toString());for(var e=t.rowCount(),n=this.computeStep_0(e),i=p(),r=0;r180&&(h>=p?p+=360:h+=360)}return o=t,a=r,s=u.Mappers.linear_yl4mmw$(t,p,h,at.NaN),l=u.Mappers.linear_yl4mmw$(t,_,f,at.NaN),c=u.Mappers.linear_yl4mmw$(t,e.v,n.v,at.NaN),function(t){if(null!=t&&o.contains_mef7kx$(t)){var e=s(t)%360,n=e>=0?e:360+e,i=l(t),r=c(t);return Ni.Colors.rgbFromHsv_yvo9jy$(n,i,r)}return a}},Xf.$metadata$={kind:l,simpleName:"ColorMapper",interfaces:[]};var Zf=null;function Jf(){return null===Zf&&new Xf,Zf}function Qf(t,e){this.mapper_0=t,this.isContinuous_zgpeec$_0=e}function td(t,e,n){this.mapper_0=t,this.breaks_3tqv0$_0=e,this.formatter_dkp6z6$_0=n,this.isContinuous_jvxsgv$_0=!1}function ed(){rd=this,this.IDENTITY=new Qf(u.Mappers.IDENTITY,!1),this.UNDEFINED=new Qf(u.Mappers.undefined_287e2$(),!1)}function nd(t){return t.toString()}function id(t){return t.toString()}Object.defineProperty(Qf.prototype,"isContinuous",{get:function(){return this.isContinuous_zgpeec$_0}}),Qf.prototype.apply_11rb$=function(t){return this.mapper_0(t)},Qf.$metadata$={kind:$,simpleName:"GuideMapperAdapter",interfaces:[Ff]},Object.defineProperty(td.prototype,"breaks",{get:function(){return this.breaks_3tqv0$_0}}),Object.defineProperty(td.prototype,"formatter",{get:function(){return this.formatter_dkp6z6$_0}}),Object.defineProperty(td.prototype,"isContinuous",{configurable:!0,get:function(){return this.isContinuous_jvxsgv$_0}}),td.prototype.apply_11rb$=function(t){return this.mapper_0(t)},td.$metadata$={kind:$,simpleName:"GuideMapperWithGuideBreaks",interfaces:[Wf,Ff]},ed.prototype.discreteToDiscrete_udkttt$=function(t,e,n,i){var r=t.distinctValues_8xm3sj$(e);return this.discreteToDiscrete_pkbp8v$(r,n,i)},ed.prototype.discreteToDiscrete_pkbp8v$=function(t,e,n){var i,r=u.Mappers.discrete_rath1t$(e,n),o=p();for(i=t.iterator();i.hasNext();){var a;null!=(a=i.next())&&o.add_11rb$(a)}return new td(r,o,nd)},ed.prototype.continuousToDiscrete_fooeq8$=function(t,e,n){var i=u.Mappers.quantized_hd8s0$(t,e,n);return this.asNotContinuous_rjdepr$(i)},ed.prototype.discreteToContinuous_83ntpg$=function(t,e,n){var i,r=u.Mappers.discreteToContinuous_83ntpg$(t,e,n),o=p();for(i=t.iterator();i.hasNext();){var a;null!=(a=i.next())&&o.add_11rb$(a)}return new td(r,o,id)},ed.prototype.continuousToContinuous_lww37m$=function(t,e,n){return this.asContinuous_rjdepr$(u.Mappers.linear_lww37m$(t,e,n))},ed.prototype.asNotContinuous_rjdepr$=function(t){return new Qf(t,!1)},ed.prototype.asContinuous_rjdepr$=function(t){return new Qf(t,!0)},ed.$metadata$={kind:l,simpleName:"GuideMappers",interfaces:[]};var rd=null;function od(){return null===rd&&new ed,rd}function ad(){sd=this,this.NA_VALUE=wi.SOLID}ad.prototype.allLineTypes=function(){return an([wi.SOLID,wi.DASHED,wi.DOTTED,wi.DOTDASH,wi.LONGDASH,wi.TWODASH])},ad.$metadata$={kind:l,simpleName:"LineTypeMapper",interfaces:[]};var sd=null;function ld(){return null===sd&&new ad,sd}function ud(){cd=this,this.NA_VALUE=bi.TinyPointShape}ud.prototype.allShapes=function(){var t=an([Ai.SOLID_CIRCLE,Ai.SOLID_TRIANGLE_UP,Ai.SOLID_SQUARE,Ai.STICK_PLUS,Ai.STICK_SQUARE_CROSS,Ai.STICK_STAR]),e=Li(an(ji().slice()));e.removeAll_brywnq$(t);var n=q(t);return n.addAll_brywnq$(e),n},ud.prototype.hollowShapes=function(){var t,e=an([Ai.STICK_CIRCLE,Ai.STICK_TRIANGLE_UP,Ai.STICK_SQUARE]),n=Li(an(ji().slice()));n.removeAll_brywnq$(e);var i=q(e);for(t=n.iterator();t.hasNext();){var r=t.next();r.isHollow&&i.add_11rb$(r)}return i},ud.$metadata$={kind:l,simpleName:"ShapeMapper",interfaces:[]};var cd=null;function pd(){return null===cd&&new ud,cd}function hd(t,e){dd(),Gd.call(this,t,e)}function _d(){fd=this,this.DEF_RANGE_0=new Q(.1,1),this.DEFAULT=new hd(this.DEF_RANGE_0,Bf().get_31786j$(J.Companion.ALPHA))}_d.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var fd=null;function dd(){return null===fd&&new _d,fd}function md(t,n,i,r){var o,a;if(gd(),Hd.call(this,r),this.paletteTypeName_0=t,this.paletteNameOrIndex_0=n,this.direction_0=i,null!=(o=null!=this.paletteNameOrIndex_0?"string"==typeof this.paletteNameOrIndex_0||e.isNumber(this.paletteNameOrIndex_0):null)&&!o){var s=(a=this,function(){return"palette: expected a name or index but was: "+f(e.getKClassFromExpression(S(a.paletteNameOrIndex_0)).simpleName)})();throw G(s.toString())}if(e.isNumber(this.paletteNameOrIndex_0)&&null==this.paletteTypeName_0)throw G("brewer palette type required: 'seq', 'div' or 'qual'.".toString())}function yd(){vd=this}function $d(t){return"'"+t.name+"'"}hd.$metadata$={kind:$,simpleName:"AlphaMapperProvider",interfaces:[Gd]},md.prototype.createDiscreteMapper_7f6uoc$=function(t){var e=this.colorScheme_0(!0,t.size),n=this.colors_0(e,t.size);return od().discreteToDiscrete_pkbp8v$(t,n,this.naValue)},md.prototype.createContinuousMapper_1g0x2p$=function(t,e,n,i){var r=this.colorScheme_0(!1),o=this.colors_0(r,r.maxColors),a=u.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(t,e,n,i);return od().continuousToDiscrete_fooeq8$(a,o,this.naValue)},md.prototype.colors_0=function(t,n){var i,r,o=Ri.PaletteUtil.schemeColors_7q5c77$(t,n);return!0===(r=null!=(i=null!=this.direction_0?this.direction_0<0:null)&&i)?nt.Lists.reverse_bemo1h$(o):!1===r?o:e.noWhenBranchMatched()},md.prototype.colorScheme_0=function(t,n){var i;if(void 0===n&&(n=null),"string"==typeof this.paletteNameOrIndex_0){var r=Ri.PaletteUtil.paletteTypeByPaletteName_61zpoe$(this.paletteNameOrIndex_0);if(null==r){var o=gd().cantFindPaletteError_0(this.paletteNameOrIndex_0);throw G(o.toString())}i=r}else i=null!=this.paletteTypeName_0?gd().paletteType_0(this.paletteTypeName_0):t?Ii.QUALITATIVE:Ii.SEQUENTIAL;var a=i;return e.isNumber(this.paletteNameOrIndex_0)?Ri.PaletteUtil.colorSchemeByIndex_vfydh1$(a,Tt(this.paletteNameOrIndex_0)):"string"==typeof this.paletteNameOrIndex_0?gd().colorSchemeByName_0(a,this.paletteNameOrIndex_0):a===Ii.QUALITATIVE?null!=n&&n<=zi.Set2.maxColors?zi.Set2:zi.Set3:Ri.PaletteUtil.colorSchemeByIndex_vfydh1$(a,0)},yd.prototype.paletteType_0=function(t){var e;if(null==t)return Ii.SEQUENTIAL;switch(t){case"seq":e=Ii.SEQUENTIAL;break;case"div":e=Ii.DIVERGING;break;case"qual":e=Ii.QUALITATIVE;break;default:throw G("Palette type expected one of 'seq' (sequential), 'div' (diverging) or 'qual' (qualitative) but was: '"+f(t)+"'")}return e},yd.prototype.colorSchemeByName_0=function(t,n){var i;try{switch(t.name){case"SEQUENTIAL":i=Di(n);break;case"DIVERGING":i=Mi(n);break;case"QUALITATIVE":i=Bi(n);break;default:i=e.noWhenBranchMatched()}return i}catch(t){throw e.isType(t,Ui)?G(this.cantFindPaletteError_0(n)):t}},yd.prototype.cantFindPaletteError_0=function(t){return Qn("\n |Brewer palette '"+t+"' was not found. \n |Valid palette names are: \n | Type 'seq' (sequential): \n | "+this.names_0(Fi())+" \n | Type 'div' (diverging): \n | "+this.names_0(qi())+" \n | Type 'qual' (qualitative): \n | "+this.names_0(Gi())+" \n ")},yd.prototype.names_0=function(t){return Hi(t,", ",void 0,void 0,void 0,void 0,$d)},yd.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var vd=null;function gd(){return null===vd&&new yd,vd}function bd(t,e,n,i,r){kd(),df.call(this,r),this.myLow_0=null,this.myMid_0=null,this.myHigh_0=null,this.myMidpoint_0=null,this.myLow_0=null!=t?t:kd().DEF_GRADIENT_LOW_0,this.myMid_0=null!=e?e:kd().DEF_GRADIENT_MID_0,this.myHigh_0=null!=n?n:kd().DEF_GRADIENT_HIGH_0,this.myMidpoint_0=null!=i?i:0}function wd(){xd=this,this.DEF_GRADIENT_LOW_0=R.Companion.parseHex_61zpoe$("#964540"),this.DEF_GRADIENT_MID_0=R.Companion.WHITE,this.DEF_GRADIENT_HIGH_0=R.Companion.parseHex_61zpoe$("#3B3D96")}md.$metadata$={kind:$,simpleName:"ColorBrewerMapperProvider",interfaces:[Hd]},bd.prototype.createContinuousMapper_1g0x2p$=function(t,e,n,i){var r,o,a,s=u.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(t,e,n,i),l=s.lowerEnd,c=S(this.myMidpoint_0),p=s.lowerEnd,h=new Q(l,X.max(c,p)),_=this.myMidpoint_0,f=s.upperEnd,d=new Q(X.min(_,f),s.upperEnd),m=Jf().gradient_e4qimg$(h,this.myLow_0,this.myMid_0,this.naValue),y=Jf().gradient_e4qimg$(d,this.myMid_0,this.myHigh_0,this.naValue),$=(a=Pn([$t(h,m),$t(d,y)]),r=function(t){var e,n=null;if(ot.SeriesUtil.isFinite_yrwdxb$(t)){var i=at.NaN;for(e=a.keys.iterator();e.hasNext();){var r=e.next();if(r.contains_mef7kx$(S(t))){var o=r.upperEnd-r.lowerEnd;(null==n||0===i||o0)&&(n=a.get_11rb$(r),i=o)}}}return n},o=this,function(t){var e,n=r(t);return null!=(e=null!=n?n(t):null)?e:o.naValue});return od().asContinuous_rjdepr$($)},wd.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var xd=null;function kd(){return null===xd&&new wd,xd}function Ed(t,e,n){Td(),Hd.call(this,n),this.low_0=null!=t?t:Jf().DEF_GRADIENT_LOW,this.high_0=null!=e?e:Jf().DEF_GRADIENT_HIGH}function Cd(){Sd=this,this.DEFAULT=new Ed(null,null,Jf().NA_VALUE)}bd.$metadata$={kind:$,simpleName:"ColorGradient2MapperProvider",interfaces:[df]},Ed.prototype.createDiscreteMapper_7f6uoc$=function(t){var e=u.MapperUtil.mapDiscreteDomainValuesToNumbers_7f6uoc$(t),n=S(ot.SeriesUtil.range_l63ks6$(e.values)),i=Jf().gradient_e4qimg$(n,this.low_0,this.high_0,this.naValue);return od().asNotContinuous_rjdepr$(i)},Ed.prototype.createContinuousMapper_1g0x2p$=function(t,e,n,i){var r=u.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(t,e,n,i),o=Jf().gradient_e4qimg$(r,this.low_0,this.high_0,this.naValue);return od().asContinuous_rjdepr$(o)},Cd.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Sd=null;function Td(){return null===Sd&&new Cd,Sd}function Od(t,e,n,i,r,o){Ad(),Dd.call(this,o),this.myFromHSV_0=null,this.myToHSV_0=null,this.myHSVIntervals_0=null;var a,s=Ad().normalizeHueRange_0(t),l=null==r||-1!==r,u=l?s.lowerEnd:s.upperEnd,c=l?s.upperEnd:s.lowerEnd,p=null!=i?i:Ad().DEF_START_HUE_0,h=s.contains_mef7kx$(p)&&p-s.lowerEnd>1&&s.upperEnd-p>1?an([$t(p,c),$t(u,p)]):zt($t(u,c)),_=(null!=e?e%100:Ad().DEF_SATURATION_0)/100,f=(null!=n?n%100:Ad().DEF_VALUE_0)/100,d=y(m(h,10));for(a=h.iterator();a.hasNext();){var $=a.next();d.add_11rb$($t(new Pi($.first,_,f),new Pi($.second,_,f)))}this.myHSVIntervals_0=d,this.myFromHSV_0=new Pi(u,_,f),this.myToHSV_0=new Pi(c,_,f)}function Nd(){Pd=this,this.DEF_SATURATION_0=50,this.DEF_VALUE_0=90,this.DEF_START_HUE_0=0,this.DEF_HUE_RANGE_0=new Q(15,375),this.DEFAULT=new Od(null,null,null,null,null,R.Companion.GRAY)}Ed.$metadata$={kind:$,simpleName:"ColorGradientMapperProvider",interfaces:[Hd]},Od.prototype.createDiscreteMapper_7f6uoc$=function(t){return this.createDiscreteMapper_q8tf2k$(t,this.myFromHSV_0,this.myToHSV_0)},Od.prototype.createContinuousMapper_1g0x2p$=function(t,e,n,i){var r=u.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(t,e,n,i);return this.createContinuousMapper_ytjjc$(r,this.myHSVIntervals_0)},Nd.prototype.normalizeHueRange_0=function(t){var e;if(null==t||2!==t.size)e=this.DEF_HUE_RANGE_0;else{var n=t.get_za3lpa$(0),i=t.get_za3lpa$(1),r=X.min(n,i),o=t.get_za3lpa$(0),a=t.get_za3lpa$(1);e=new Q(r,X.max(o,a))}return e},Nd.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Pd=null;function Ad(){return null===Pd&&new Nd,Pd}function jd(t,e){df.call(this,e),this.max_ks8piw$_0=t}function Ld(t,e,n){zd(),Dd.call(this,n),this.myFromHSV_0=null,this.myToHSV_0=null;var i=null!=t?t:zd().DEF_START_0,r=null!=e?e:zd().DEF_END_0;if(!Yi(0,1).contains_mef7kx$(i)){var o="Value of 'start' must be in range: [0,1]: "+f(t);throw G(o.toString())}if(!Yi(0,1).contains_mef7kx$(r)){var a="Value of 'end' must be in range: [0,1]: "+f(e);throw G(a.toString())}this.myFromHSV_0=new Pi(0,0,i),this.myToHSV_0=new Pi(0,0,r)}function Rd(){Id=this,this.DEF_START_0=.2,this.DEF_END_0=.8}Od.$metadata$={kind:$,simpleName:"ColorHueMapperProvider",interfaces:[Dd]},jd.prototype.createContinuousMapper_1g0x2p$=function(t,e,n,i){var r=u.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(t,e,n,i).upperEnd;return od().continuousToContinuous_lww37m$(new Q(0,r),new Q(0,this.max_ks8piw$_0),this.naValue)},jd.$metadata$={kind:$,simpleName:"DirectlyProportionalMapperProvider",interfaces:[df]},Ld.prototype.createDiscreteMapper_7f6uoc$=function(t){return this.createDiscreteMapper_q8tf2k$(t,this.myFromHSV_0,this.myToHSV_0)},Ld.prototype.createContinuousMapper_1g0x2p$=function(t,e,n,i){var r=u.MapperUtil.rangeWithLimitsAfterTransform_1g0x2p$(t,e,n,i);return this.createContinuousMapper_ytjjc$(r,zt($t(this.myFromHSV_0,this.myToHSV_0)))},Rd.$metadata$={kind:l,simpleName:"Companion",interfaces:[]};var Id=null;function zd(){return null===Id&&new Rd,Id}function Dd(t){Ud(),Hd.call(this,t)}function Md(){Bd=this}Ld.$metadata$={kind:$,simpleName:"GreyscaleLightnessMapperProvider",interfaces:[Dd]},Dd.prototype.createDiscreteMapper_q8tf2k$=function(t,e,n){var i=u.MapperUtil.mapDiscreteDomainValuesToNumbers_7f6uoc$(t),r=ot.SeriesUtil.ensureApplicableRange_4am1sd$(ot.SeriesUtil.range_l63ks6$(i.values)),o=e.h,a=n.h;if(t.size>1){var s=n.h%360-e.h%360,l=X.abs(s),c=(n.h-e.h)/t.size;lthis.$outer.contentRect.right?At():null;break;case"VERTICAL":i=t.y>this.$outer.contentRect.bottom?Lt():t.ye.end()?t.move_14dthe$(e.end()-t.end()):t},re.prototype.centered_0=function(t,e){return rt.Companion.withStartAndLength_lu1900$(t-e/2,e)},re.prototype.leftAligned_0=function(t,e,n){return rt.Companion.withStartAndLength_lu1900$(t-e-n,e)},re.prototype.rightAligned_0=function(t,e,n){return rt.Companion.withStartAndLength_lu1900$(t+n,e)},re.prototype.centerInsideRange_0=function(t,e,n){return this.moveIntoLimit_a8bojh$(this.centered_0(t,e),n).start()},re.prototype.select_0=function(t,e){var n,i=O();for(n=t.iterator();n.hasNext();){var r=n.next();ut(e,r.hintKind_8be2vx$)&&i.add_11rb$(r)}return i},re.prototype.isOverlapped_0=function(t,e){var n;t:do{var i;for(i=t.iterator();i.hasNext();){var r=i.next();if(!M(r,e)&&r.rect_8be2vx$().intersects_wthzt5$(e.rect_8be2vx$())){n=r;break t}}n=null}while(0);return null!=n},re.prototype.withOverlapped_0=function(t,e){var n,i=O();for(n=e.iterator();n.hasNext();){var r=n.next();this.isOverlapped_0(t,r)&&i.add_11rb$(r)}var o=i;return et(st(t,e),o)},re.$metadata$={kind:ct,simpleName:"Companion",interfaces:[]};var oe=null;function ae(){return null===oe&&new re,oe}function se(t){ve(),this.myVerticalSpace_0=t}function le(){me(),this.myTopSpaceOk_0=null,this.myTopCursorOk_0=null,this.myBottomSpaceOk_0=null,this.myBottomCursorOk_0=null,this.myPreferredAlignment_0=null}function ue(t){return me().getBottomCursorOk_bd4p08$(t)}function ce(t){return me().getBottomSpaceOk_bd4p08$(t)}function pe(t){return me().getTopCursorOk_bd4p08$(t)}function he(t){return me().getTopSpaceOk_bd4p08$(t)}function _e(t){return me().getPreferredAlignment_bd4p08$(t)}function fe(){de=this}Gt.$metadata$={kind:w,simpleName:"LayoutManager",interfaces:[]},se.prototype.resolve_yatt61$=function(t,e,n,i){var r,o=(new le).topCursorOk_1v8dbw$(!t.overlaps_oqgc3u$(i)).topSpaceOk_1v8dbw$(t.inside_oqgc3u$(this.myVerticalSpace_0)).bottomCursorOk_1v8dbw$(!e.overlaps_oqgc3u$(i)).bottomSpaceOk_1v8dbw$(e.inside_oqgc3u$(this.myVerticalSpace_0)).preferredAlignment_tcfutp$(n);for(r=ve().PLACEMENT_MATCHERS_0.iterator();r.hasNext();){var a=r.next();if(a.first.match_bd4p08$(o))return a.second}throw E("Some matcher should match")},le.prototype.match_bd4p08$=function(t){return this.match_0(ue,t)&&this.match_0(ce,t)&&this.match_0(pe,t)&&this.match_0(he,t)&&this.match_0(_e,t)},le.prototype.topSpaceOk_1v8dbw$=function(t){return this.myTopSpaceOk_0=t,this},le.prototype.topCursorOk_1v8dbw$=function(t){return this.myTopCursorOk_0=t,this},le.prototype.bottomSpaceOk_1v8dbw$=function(t){return this.myBottomSpaceOk_0=t,this},le.prototype.bottomCursorOk_1v8dbw$=function(t){return this.myBottomCursorOk_0=t,this},le.prototype.preferredAlignment_tcfutp$=function(t){return this.myPreferredAlignment_0=t,this},le.prototype.match_0=function(t,e){var n;return null==(n=t(this))||M(n,t(e))},fe.prototype.getTopSpaceOk_bd4p08$=function(t){return t.myTopSpaceOk_0},fe.prototype.getTopCursorOk_bd4p08$=function(t){return t.myTopCursorOk_0},fe.prototype.getBottomSpaceOk_bd4p08$=function(t){return t.myBottomSpaceOk_0},fe.prototype.getBottomCursorOk_bd4p08$=function(t){return t.myBottomCursorOk_0},fe.prototype.getPreferredAlignment_bd4p08$=function(t){return t.myPreferredAlignment_0},fe.$metadata$={kind:ct,simpleName:"Companion",interfaces:[]};var de=null;function me(){return null===de&&new fe,de}function ye(){$e=this,this.PLACEMENT_MATCHERS_0=_t([this.rule_0((new le).preferredAlignment_tcfutp$(Vt()).topSpaceOk_1v8dbw$(!0).topCursorOk_1v8dbw$(!0),Vt()),this.rule_0((new le).preferredAlignment_tcfutp$(Kt()).bottomSpaceOk_1v8dbw$(!0).bottomCursorOk_1v8dbw$(!0),Kt()),this.rule_0((new le).preferredAlignment_tcfutp$(Vt()).topSpaceOk_1v8dbw$(!0).topCursorOk_1v8dbw$(!1).bottomSpaceOk_1v8dbw$(!0).bottomCursorOk_1v8dbw$(!0),Kt()),this.rule_0((new le).preferredAlignment_tcfutp$(Kt()).bottomSpaceOk_1v8dbw$(!0).bottomCursorOk_1v8dbw$(!1).topSpaceOk_1v8dbw$(!0).topCursorOk_1v8dbw$(!0),Vt()),this.rule_0((new le).topSpaceOk_1v8dbw$(!1),Kt()),this.rule_0((new le).bottomSpaceOk_1v8dbw$(!1),Vt()),this.rule_0(new le,Vt())])}le.$metadata$={kind:w,simpleName:"Matcher",interfaces:[]},ye.prototype.rule_0=function(t,e){return new ht(t,e)},ye.$metadata$={kind:ct,simpleName:"Companion",interfaces:[]};var $e=null;function ve(){return null===$e&&new ye,$e}function ge(t,e){ke(),this.verticalSpace_0=t,this.horizontalSpace_0=e}function be(t){this.myAttachToTooltipsTopOffset_0=null,this.myAttachToTooltipsBottomOffset_0=null,this.myAttachToTooltipsLeftOffset_0=null,this.myAttachToTooltipsRightOffset_0=null,this.myTooltipSize_0=t.tooltipSize_8be2vx$,this.myTargetCoord_0=t.stemCoord;var e=this.myTooltipSize_0.x/2,n=this.myTooltipSize_0.y/2;this.myAttachToTooltipsTopOffset_0=new $(-e,0),this.myAttachToTooltipsBottomOffset_0=new $(-e,-this.myTooltipSize_0.y),this.myAttachToTooltipsLeftOffset_0=new $(0,n),this.myAttachToTooltipsRightOffset_0=new $(-this.myTooltipSize_0.x,n)}function we(){xe=this,this.STEM_TO_LEFT_SIDE_ANGLE_RANGE_0=rt.Companion.withStartAndEnd_lu1900$(-1/4*dt.PI,1/4*dt.PI),this.STEM_TO_BOTTOM_SIDE_ANGLE_RANGE_0=rt.Companion.withStartAndEnd_lu1900$(1/4*dt.PI,3/4*dt.PI),this.STEM_TO_RIGHT_SIDE_ANGLE_RANGE_0=rt.Companion.withStartAndEnd_lu1900$(3/4*dt.PI,5/4*dt.PI),this.STEM_TO_TOP_SIDE_ANGLE_RANGE_0=rt.Companion.withStartAndEnd_lu1900$(5/4*dt.PI,7/4*dt.PI),this.SECTOR_COUNT_0=36,this.SECTOR_ANGLE_0=2*dt.PI/36,this.POINT_RESTRICTION_SIZE_0=new $(1,1)}se.$metadata$={kind:w,simpleName:"VerticalAlignmentResolver",interfaces:[]},ge.prototype.fixOverlapping_jhkzok$=function(t,e){for(var n,i=O(),r=0,o=t.size;rdt.PI&&(i-=dt.PI),n.add_11rb$(e.rotate_14dthe$(i)),r=r+1|0,i+=ke().SECTOR_ANGLE_0;return n},ge.prototype.intersectsAny_0=function(t,e){var n;for(n=e.iterator();n.hasNext();){var i=n.next();if(t.intersects_wthzt5$(i))return!0}return!1},ge.prototype.findValidCandidate_0=function(t,e){var n;for(n=t.iterator();n.hasNext();){var i=n.next();if(!this.intersectsAny_0(i,e)&&rt.Companion.withStartAndLength_lu1900$(i.origin.y,i.dimension.y).inside_oqgc3u$(this.verticalSpace_0)&&rt.Companion.withStartAndLength_lu1900$(i.origin.x,i.dimension.x).inside_oqgc3u$(this.horizontalSpace_0))return i}return null},be.prototype.rotate_14dthe$=function(t){var e,n=mt.NORMAL.value,i=new $(n*X.cos(t),n*X.sin(t)).add_gpjtzr$(this.myTargetCoord_0);if(ke().STEM_TO_BOTTOM_SIDE_ANGLE_RANGE_0.contains_14dthe$(t))e=i.add_gpjtzr$(this.myAttachToTooltipsBottomOffset_0);else if(ke().STEM_TO_TOP_SIDE_ANGLE_RANGE_0.contains_14dthe$(t))e=i.add_gpjtzr$(this.myAttachToTooltipsTopOffset_0);else if(ke().STEM_TO_LEFT_SIDE_ANGLE_RANGE_0.contains_14dthe$(t))e=i.add_gpjtzr$(this.myAttachToTooltipsLeftOffset_0);else{if(!ke().STEM_TO_RIGHT_SIDE_ANGLE_RANGE_0.contains_14dthe$(t))throw yt();e=i.add_gpjtzr$(this.myAttachToTooltipsRightOffset_0)}return new v(e,this.myTooltipSize_0)},be.$metadata$={kind:w,simpleName:"TooltipRotationHelper",interfaces:[]},we.$metadata$={kind:ct,simpleName:"Companion",interfaces:[]};var xe=null;function ke(){return null===xe&&new we,xe}ge.$metadata$={kind:w,simpleName:"VerticalTooltipRotatingExpander",interfaces:[]};var Ee=t.jetbrains||(t.jetbrains={}),Ce=Ee.datalore||(Ee.datalore={}),Se=Ce.plot||(Ce.plot={}),Te=Se.builder||(Se.builder={});Te.PlotContainer=$t;var Oe=Te.interact||(Te.interact={});(Oe.render||(Oe.render={})).TooltipLayer=wt;var Ne=Te.tooltip||(Te.tooltip={});Ne.CrosshairComponent=xt,Object.defineProperty(Et,"VERTICAL",{get:St}),Object.defineProperty(Et,"HORIZONTAL",{get:Tt}),kt.Orientation=Et,Object.defineProperty(Ot,"LEFT",{get:Pt}),Object.defineProperty(Ot,"RIGHT",{get:At}),Object.defineProperty(Ot,"UP",{get:jt}),Object.defineProperty(Ot,"DOWN",{get:Lt}),kt.PointerDirection=Ot,Ne.TooltipBox=kt,zt.Group_init_xdl8vp$=Ut,zt.Group=Bt;var Pe=Ne.layout||(Ne.layout={});return Pe.HorizontalTooltipExpander=zt,Object.defineProperty(Ht,"TOP",{get:Vt}),Object.defineProperty(Ht,"BOTTOM",{get:Kt}),Gt.VerticalAlignment=Ht,Object.defineProperty(Wt,"LEFT",{get:Zt}),Object.defineProperty(Wt,"RIGHT",{get:Jt}),Object.defineProperty(Wt,"CENTER",{get:Qt}),Gt.HorizontalAlignment=Wt,Gt.PositionedTooltip_init_3c33xi$=ee,Gt.PositionedTooltip=te,Gt.MeasuredTooltip_init_eds8ux$=ie,Gt.MeasuredTooltip=ne,Object.defineProperty(Gt,"Companion",{get:ae}),Pe.LayoutManager=Gt,Object.defineProperty(le,"Companion",{get:me}),se.Matcher=le,Object.defineProperty(se,"Companion",{get:ve}),Pe.VerticalAlignmentResolver=se,ge.TooltipRotationHelper=be,Object.defineProperty(ge,"Companion",{get:ke}),Pe.VerticalTooltipRotatingExpander=ge,t})?i.apply(e,r):i)||(t.exports=o)},958:function(t,e,n){var i,r,o;r=[e,n(421),n(767)],void 0===(o="function"==typeof(i=function(t,e,n){"use strict";var i,r,o,a,s,l,u,c,p,h,_,f,d,m,y,$,v,g,b,w,x,k,E,C,S,T,O,N,P,A,j,L,R,I,z,D,M,B,U=e.kotlin.Enum,F=e.Kind.CLASS,q=e.throwISE,G=e.Kind.OBJECT,H=Math,Y=e.Kind.INTERFACE,V=e.kotlin.collections.ArrayList_init_287e2$,K=e.kotlin.collections.ArrayList_init_ww73n8$,W=n.jetbrains.datalore.base.values.Color,X=n.jetbrains.datalore.base.gcommon.collect,Z=e.kotlin.Exception,J=e.throwCCE,Q=e.kotlin.collections.setOf_i5x0yv$,tt=e.kotlin.collections.HashMap_init_q3lmfv$,et=e.numberToInt,nt=e.ensureNotNull,it=n.jetbrains.datalore.base.gcommon.collect.ClosedRange,rt=n.jetbrains.datalore.base.gcommon.collect.Ordering,ot=e.kotlin.isFinite_yrwdxr$,at=e.kotlin.IllegalStateException_init_pdl1vj$,st=e.kotlin.collections.take_ba2ldo$,lt=e.kotlin.collections.toList_7wnvza$,ut=e.kotlin.collections.List,ct=e.kotlin.collections.listOf_i5x0yv$,pt=e.kotlin.collections.Iterable,ht=e.kotlin.isInfinite_yrwdxr$,_t=e.equals,ft=e.kotlin.collections.contains_2ws7j4$,dt=e.kotlin.IllegalArgumentException_init_pdl1vj$,mt=n.jetbrains.datalore.base.gcommon.collect.Stack,yt=e.kotlin.js.internal.DoubleCompanionObject,$t=n.jetbrains.datalore.base.values.Pair,vt=n.jetbrains.datalore.base.geometry.DoubleSegment,gt=e.kotlin.ranges.until_dqglrj$,bt=e.kotlin.isNaN_yrwdxr$,wt=e.kotlin.comparisons.reversed_2avth4$,xt=e.kotlin.collections.sortedWith_eknfly$,kt=e.kotlin.collections.sorted_exjks8$,Et=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,Ct=e.wrapFunction,St=e.kotlin.Comparator,Tt=e.kotlin.collections.binarySearch_vikexg$,Ot=n.jetbrains.datalore.base.dateFormat.Format_init_61zpoe$,Nt=e.numberToLong,Pt=n.jetbrains.datalore.base.datetime.Instant,At=e.getCallableRef,jt=n.jetbrains.datalore.base.datetime.tz.TimeZone,Lt=n.jetbrains.datalore.base.numberFormat.NumberFormat_init_61zpoe$,Rt=e.kotlin.math.roundToLong_yrwdxr$,It=e.kotlin.RuntimeException,zt=n.jetbrains.datalore.base.datetime.Date,Dt=n.jetbrains.datalore.base.datetime.DateTime,Mt=n.jetbrains.datalore.base.datetime.Duration,Bt=e.kotlin.RuntimeException_init_pdl1vj$,Ut=n.jetbrains.datalore.base.datetime.Month,Ft=e.kotlin.UnsupportedOperationException_init,qt=e.kotlin.text.startsWith_7epoxm$,Gt=e.kotlin.text.toInt_pdl1vz$,Ht=e.kotlin.NumberFormatException;function Yt(){Fe=this,this.MIN_COLOR_SET_SIZE_0=3}function Vt(t,e,n){U.call(this),this.myPresentation_6glhnl$_0=n,this.name$=t,this.ordinal$=e}function Kt(){Kt=function(){},i=new Vt("SEQUENTIAL",0,"sequential"),r=new Vt("DIVERGING",1,"diverging"),o=new Vt("QUALITATIVE",2,"qualitative")}function Wt(){return Kt(),i}function Xt(){return Kt(),r}function Zt(){return Kt(),o}function Jt(t,e,n,i){U.call(this),this.myPresentation_w2uxp8$_0=n,this.colorSet_b1v09h$_0=i,this.name$=t,this.ordinal$=e}function Qt(){Qt=function(){},a=new Jt("Blues",0,"blues",Ve().BLUES),s=new Jt("BuGn",1,"blue-green",Ve().BU_GN),l=new Jt("BuPu",2,"blue-purple",Ve().BU_PU),u=new Jt("GnBu",3,"green-blue",Ve().GN_BU),c=new Jt("Greens",4,"greens",Ve().GREENS),p=new Jt("Greys",5,"greys",Ve().GREYS),h=new Jt("Oranges",6,"oranges",Ve().ORANGES),_=new Jt("OrRd",7,"orange-red",Ve().OR_RD),f=new Jt("PuBu",8,"purple-blue",Ve().PU_BU),d=new Jt("PuBuGn",9,"purple-blue-green",Ve().PU_BU_GN),m=new Jt("PuRd",10,"purple-red",Ve().PU_RD),y=new Jt("Purples",11,"purples",Ve().PURPLES),$=new Jt("RdPu",12,"red-purple",Ve().RD_PU),v=new Jt("Reds",13,"reds",Ve().REDS),g=new Jt("YlGn",14,"yellow-green",Ve().YL_GN),b=new Jt("YlGnBu",15,"yellow-green-blue",Ve().YL_GN_BU),w=new Jt("YlOrBr",16,"yellow-orange-brown",Ve().YL_OR_BR),x=new Jt("YlOrRd",17,"yellow-orange-red",Ve().YL_OR_RD)}function te(){return Qt(),a}function ee(){return Qt(),s}function ne(){return Qt(),l}function ie(){return Qt(),u}function re(){return Qt(),c}function oe(){return Qt(),p}function ae(){return Qt(),h}function se(){return Qt(),_}function le(){return Qt(),f}function ue(){return Qt(),d}function ce(){return Qt(),m}function pe(){return Qt(),y}function he(){return Qt(),$}function _e(){return Qt(),v}function fe(){return Qt(),g}function de(){return Qt(),b}function me(){return Qt(),w}function ye(){return Qt(),x}function $e(){return[te(),ee(),ne(),ie(),re(),oe(),ae(),se(),le(),ue(),ce(),pe(),he(),_e(),fe(),de(),me(),ye()]}function ve(t,e,n,i){U.call(this),this.myPresentation_im16qo$_0=n,this.colorSet_las6nb$_0=i,this.name$=t,this.ordinal$=e}function ge(){ge=function(){},k=new ve("BrBG",0,"brown-blue/green",Ve().BR_BG),E=new ve("PiYG",1,"pink-yellow/green",Ve().PI_YG),C=new ve("PRGn",2,"purple/red-green",Ve().PR_GN),S=new ve("PuOr",3,"purple-orange",Ve().PU_OR),T=new ve("RdBu",4,"red-blue",Ve().RD_BU),O=new ve("RdGy",5,"red-grey",Ve().RD_GY),N=new ve("RdYlBu",6,"red-yellow-blue",Ve().RD_YL_BU),P=new ve("RdYlGn",7,"red-yellow-green",Ve().RD_YL_GN),A=new ve("Spectral",8,"spectral",Ve().SPECTRAL)}function be(){return ge(),k}function we(){return ge(),E}function xe(){return ge(),C}function ke(){return ge(),S}function Ee(){return ge(),T}function Ce(){return ge(),O}function Se(){return ge(),N}function Te(){return ge(),P}function Oe(){return ge(),A}function Ne(){return[be(),we(),xe(),ke(),Ee(),Ce(),Se(),Te(),Oe()]}function Pe(t,e,n,i){U.call(this),this.myPresentation_av4sq6$_0=n,this.colorSet_cgz7kp$_0=i,this.name$=t,this.ordinal$=e}function Ae(){Ae=function(){},j=new Pe("Accent",0,"accent",Ve().ACCENT),L=new Pe("Dark2",1,"dark 2",Ve().DARK_2),R=new Pe("Paired",2,"paired",Ve().PAIRED),I=new Pe("Pastel1",3,"pastel 1",Ve().PASTEL_1),z=new Pe("Pastel2",4,"pastel 2",Ve().PASTEL_2),D=new Pe("Set1",5,"set 1",Ve().SET_1),M=new Pe("Set2",6,"set 2",Ve().SET_2),B=new Pe("Set3",7,"set 3",Ve().SET_3)}function je(){return Ae(),j}function Le(){return Ae(),L}function Re(){return Ae(),R}function Ie(){return Ae(),I}function ze(){return Ae(),z}function De(){return Ae(),D}function Me(){return Ae(),M}function Be(){return Ae(),B}function Ue(){return[je(),Le(),Re(),Ie(),ze(),De(),Me(),Be()]}Vt.prototype=Object.create(U.prototype),Vt.prototype.constructor=Vt,Jt.prototype=Object.create(U.prototype),Jt.prototype.constructor=Jt,ve.prototype=Object.create(U.prototype),ve.prototype.constructor=ve,Pe.prototype=Object.create(U.prototype),Pe.prototype.constructor=Pe,on.prototype=Object.create(rn.prototype),on.prototype.constructor=on,an.prototype=Object.create(rn.prototype),an.prototype.constructor=an,ln.prototype=Object.create(rn.prototype),ln.prototype.constructor=ln,hn.prototype=Object.create(_n.prototype),hn.prototype.constructor=hn,Yn.prototype=Object.create(ii.prototype),Yn.prototype.constructor=Yn,Vn.prototype=Object.create(ii.prototype),Vn.prototype.constructor=Vn,Kn.prototype=Object.create(Vn.prototype),Kn.prototype.constructor=Kn,Zn.prototype=Object.create(ii.prototype),Zn.prototype.constructor=Zn,Jn.prototype=Object.create(ii.prototype),Jn.prototype.constructor=Jn,si.prototype=Object.create(Vn.prototype),si.prototype.constructor=si,Yt.prototype.colors_0=function(t,e){var n=e,i=n;n=H.max(3,i);var r=t.maxColors,o=n;return n=H.min(r,o),t.colorSet[n-3|0]},Yt.prototype.maxColorSetSize_0=function(t){var e=t.colorSet;return e[e.length-1|0].length},Vt.prototype.toString=function(){return this.myPresentation_6glhnl$_0},Vt.$metadata$={kind:F,simpleName:"Type",interfaces:[U]},Vt.values=function(){return[Wt(),Xt(),Zt()]},Vt.valueOf_61zpoe$=function(t){switch(t){case"SEQUENTIAL":return Wt();case"DIVERGING":return Xt();case"QUALITATIVE":return Zt();default:q("No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Type."+t)}},Object.defineProperty(Jt.prototype,"colorSet",{get:function(){return this.colorSet_b1v09h$_0}}),Object.defineProperty(Jt.prototype,"type",{configurable:!0,get:function(){return Wt()}}),Object.defineProperty(Jt.prototype,"maxColors",{configurable:!0,get:function(){return qe().maxColorSetSize_0(this)}}),Jt.prototype.getColors_za3lpa$=function(t){return qe().colors_0(this,t)},Jt.prototype.toString=function(){return this.myPresentation_w2uxp8$_0},Jt.$metadata$={kind:F,simpleName:"Sequential",interfaces:[Ge,U]},Jt.values=$e,Jt.valueOf_61zpoe$=function(t){switch(t){case"Blues":return te();case"BuGn":return ee();case"BuPu":return ne();case"GnBu":return ie();case"Greens":return re();case"Greys":return oe();case"Oranges":return ae();case"OrRd":return se();case"PuBu":return le();case"PuBuGn":return ue();case"PuRd":return ce();case"Purples":return pe();case"RdPu":return he();case"Reds":return _e();case"YlGn":return fe();case"YlGnBu":return de();case"YlOrBr":return me();case"YlOrRd":return ye();default:q("No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Sequential."+t)}},Object.defineProperty(ve.prototype,"colorSet",{get:function(){return this.colorSet_las6nb$_0}}),Object.defineProperty(ve.prototype,"type",{configurable:!0,get:function(){return Xt()}}),Object.defineProperty(ve.prototype,"maxColors",{configurable:!0,get:function(){return qe().maxColorSetSize_0(this)}}),ve.prototype.getColors_za3lpa$=function(t){return qe().colors_0(this,t)},ve.prototype.toString=function(){return this.myPresentation_im16qo$_0},ve.$metadata$={kind:F,simpleName:"Diverging",interfaces:[Ge,U]},ve.values=Ne,ve.valueOf_61zpoe$=function(t){switch(t){case"BrBG":return be();case"PiYG":return we();case"PRGn":return xe();case"PuOr":return ke();case"RdBu":return Ee();case"RdGy":return Ce();case"RdYlBu":return Se();case"RdYlGn":return Te();case"Spectral":return Oe();default:q("No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Diverging."+t)}},Object.defineProperty(Pe.prototype,"colorSet",{get:function(){return this.colorSet_cgz7kp$_0}}),Object.defineProperty(Pe.prototype,"type",{configurable:!0,get:function(){return Zt()}}),Object.defineProperty(Pe.prototype,"maxColors",{configurable:!0,get:function(){return qe().maxColorSetSize_0(this)}}),Pe.prototype.getColors_za3lpa$=function(t){return qe().colors_0(this,t)},Pe.prototype.toString=function(){return this.myPresentation_av4sq6$_0},Pe.$metadata$={kind:F,simpleName:"Qualitative",interfaces:[Ge,U]},Pe.values=Ue,Pe.valueOf_61zpoe$=function(t){switch(t){case"Accent":return je();case"Dark2":return Le();case"Paired":return Re();case"Pastel1":return Ie();case"Pastel2":return ze();case"Set1":return De();case"Set2":return Me();case"Set3":return Be();default:q("No enum constant jetbrains.datalore.plot.common.color.ColorPalette.Qualitative."+t)}},Yt.$metadata$={kind:G,simpleName:"ColorPalette",interfaces:[]};var Fe=null;function qe(){return null===Fe&&new Yt,Fe}function Ge(){}function He(){Ye=this,this.BU_GN_3=["#e5f5f9","#99d8c9","#2ca25f"],this.BU_GN_4=["#edf8fb","#b2e2e2","#66c2a4","#238b45"],this.BU_GN_5=["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],this.BU_GN_6=["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],this.BU_GN_7=["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],this.BU_GN_8=["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],this.BU_GN_9=["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],this.BU_PU_3=["#e0ecf4","#9ebcda","#8856a7"],this.BU_PU_4=["#edf8fb","#b3cde3","#8c96c6","#88419d"],this.BU_PU_5=["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],this.BU_PU_6=["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],this.BU_PU_7=["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],this.BU_PU_8=["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],this.BU_PU_9=["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],this.GN_BU_3=["#e0f3db","#a8ddb5","#43a2ca"],this.GN_BU_4=["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],this.GN_BU_5=["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],this.GN_BU_6=["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],this.GN_BU_7=["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],this.GN_BU_8=["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],this.GN_BU_9=["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],this.OR_RD_3=["#fee8c8","#fdbb84","#e34a33"],this.OR_RD_4=["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],this.OR_RD_5=["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],this.OR_RD_6=["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],this.OR_RD_7=["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],this.OR_RD_8=["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],this.OR_RD_9=["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],this.PU_BU_3=["#ece7f2","#a6bddb","#2b8cbe"],this.PU_BU_4=["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],this.PU_BU_5=["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],this.PU_BU_6=["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],this.PU_BU_7=["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],this.PU_BU_8=["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],this.PU_BU_9=["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],this.PU_BU_GN_3=["#ece2f0","#a6bddb","#1c9099"],this.PU_BU_GN_4=["#f6eff7","#bdc9e1","#67a9cf","#02818a"],this.PU_BU_GN_5=["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],this.PU_BU_GN_6=["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],this.PU_BU_GN_7=["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],this.PU_BU_GN_8=["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],this.PU_BU_GN_9=["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],this.PU_RD_3=["#e7e1ef","#c994c7","#dd1c77"],this.PU_RD_4=["#f1eef6","#d7b5d8","#df65b0","#ce1256"],this.PU_RD_5=["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],this.PU_RD_6=["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],this.PU_RD_7=["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],this.PU_RD_8=["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],this.PU_RD_9=["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],this.RD_PU_3=["#fde0dd","#fa9fb5","#c51b8a"],this.RD_PU_4=["#feebe2","#fbb4b9","#f768a1","#ae017e"],this.RD_PU_5=["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],this.RD_PU_6=["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],this.RD_PU_7=["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],this.RD_PU_8=["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],this.RD_PU_9=["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],this.YL_GN_3=["#f7fcb9","#addd8e","#31a354"],this.YL_GN_4=["#ffffcc","#c2e699","#78c679","#238443"],this.YL_GN_5=["#ffffcc","#c2e699","#78c679","#31a354","#006837"],this.YL_GN_6=["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],this.YL_GN_7=["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],this.YL_GN_8=["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],this.YL_GN_9=["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],this.YL_GN_BU_3=["#edf8b1","#7fcdbb","#2c7fb8"],this.YL_GN_BU_4=["#ffffcc","#a1dab4","#41b6c4","#225ea8"],this.YL_GN_BU_5=["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],this.YL_GN_BU_6=["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],this.YL_GN_BU_7=["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],this.YL_GN_BU_8=["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],this.YL_GN_BU_9=["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],this.YL_OR_BR_3=["#fff7bc","#fec44f","#d95f0e"],this.YL_OR_BR_4=["#ffffd4","#fed98e","#fe9929","#cc4c02"],this.YL_OR_BR_5=["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],this.YL_OR_BR_6=["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],this.YL_OR_BR_7=["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],this.YL_OR_BR_8=["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],this.YL_OR_BR_9=["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],this.YL_OR_RD_3=["#ffeda0","#feb24c","#f03b20"],this.YL_OR_RD_4=["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],this.YL_OR_RD_5=["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],this.YL_OR_RD_6=["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],this.YL_OR_RD_7=["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],this.YL_OR_RD_8=["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],this.YL_OR_RD_9=["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],this.BU_GN=[this.BU_GN_3,this.BU_GN_4,this.BU_GN_5,this.BU_GN_6,this.BU_GN_7,this.BU_GN_8,this.BU_GN_9],this.BU_PU=[this.BU_PU_3,this.BU_PU_4,this.BU_PU_5,this.BU_PU_6,this.BU_PU_7,this.BU_PU_8,this.BU_PU_9],this.GN_BU=[this.GN_BU_3,this.GN_BU_4,this.GN_BU_5,this.GN_BU_6,this.GN_BU_7,this.GN_BU_8,this.GN_BU_9],this.OR_RD=[this.OR_RD_3,this.OR_RD_4,this.OR_RD_5,this.OR_RD_6,this.OR_RD_7,this.OR_RD_8,this.OR_RD_9],this.PU_BU=[this.PU_BU_3,this.PU_BU_4,this.PU_BU_5,this.PU_BU_6,this.PU_BU_7,this.PU_BU_8,this.PU_BU_9],this.PU_BU_GN=[this.PU_BU_GN_3,this.PU_BU_GN_4,this.PU_BU_GN_5,this.PU_BU_GN_6,this.PU_BU_GN_7,this.PU_BU_GN_8,this.PU_BU_GN_9],this.PU_RD=[this.PU_RD_3,this.PU_RD_4,this.PU_RD_5,this.PU_RD_6,this.PU_RD_7,this.PU_RD_8,this.PU_RD_9],this.RD_PU=[this.RD_PU_3,this.RD_PU_4,this.RD_PU_5,this.RD_PU_6,this.RD_PU_7,this.RD_PU_8,this.RD_PU_9],this.YL_GN=[this.YL_GN_3,this.YL_GN_4,this.YL_GN_5,this.YL_GN_6,this.YL_GN_7,this.YL_GN_8,this.YL_GN_9],this.YL_GN_BU=[this.YL_GN_BU_3,this.YL_GN_BU_4,this.YL_GN_BU_5,this.YL_GN_BU_6,this.YL_GN_BU_7,this.YL_GN_BU_8,this.YL_GN_BU_9],this.YL_OR_BR=[this.YL_OR_BR_3,this.YL_OR_BR_4,this.YL_OR_BR_5,this.YL_OR_BR_6,this.YL_OR_BR_7,this.YL_OR_BR_8,this.YL_OR_BR_9],this.YL_OR_RD=[this.YL_OR_RD_3,this.YL_OR_RD_4,this.YL_OR_RD_5,this.YL_OR_RD_6,this.YL_OR_RD_7,this.YL_OR_RD_8,this.YL_OR_RD_9],this.BLUES_3=["#deebf7","#9ecae1","#3182bd"],this.BLUES_4=["#eff3ff","#bdd7e7","#6baed6","#2171b5"],this.BLUES_5=["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],this.BLUES_6=["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],this.BLUES_7=["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],this.BLUES_8=["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],this.BLUES_9=["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],this.GREENS_3=["#e5f5e0","#a1d99b","#31a354"],this.GREENS_4=["#edf8e9","#bae4b3","#74c476","#238b45"],this.GREENS_5=["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],this.GREENS_6=["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],this.GREENS_7=["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],this.GREENS_8=["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],this.GREENS_9=["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],this.GREYS_3=["#f0f0f0","#bdbdbd","#636363"],this.GREYS_4=["#f7f7f7","#cccccc","#969696","#525252"],this.GREYS_5=["#f7f7f7","#cccccc","#969696","#636363","#252525"],this.GREYS_6=["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],this.GREYS_7=["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],this.GREYS_8=["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],this.GREYS_9=["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],this.ORANGES_3=["#fee6ce","#fdae6b","#e6550d"],this.ORANGES_4=["#feedde","#fdbe85","#fd8d3c","#d94701"],this.ORANGES_5=["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],this.ORANGES_6=["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],this.ORANGES_7=["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],this.ORANGES_8=["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],this.ORANGES_9=["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],this.PURPLES_3=["#efedf5","#bcbddc","#756bb1"],this.PURPLES_4=["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],this.PURPLES_5=["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],this.PURPLES_6=["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],this.PURPLES_7=["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],this.PURPLES_8=["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],this.PURPLES_9=["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],this.REDS_3=["#fee0d2","#fc9272","#de2d26"],this.REDS_4=["#fee5d9","#fcae91","#fb6a4a","#cb181d"],this.REDS_5=["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],this.REDS_6=["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],this.REDS_7=["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],this.REDS_8=["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],this.REDS_9=["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],this.BLUES=[this.BLUES_3,this.BLUES_4,this.BLUES_5,this.BLUES_6,this.BLUES_7,this.BLUES_8,this.BLUES_9],this.GREENS=[this.GREENS_3,this.GREENS_4,this.GREENS_5,this.GREENS_6,this.GREENS_7,this.GREENS_8,this.GREENS_9],this.GREYS=[this.GREYS_3,this.GREYS_4,this.GREYS_5,this.GREYS_6,this.GREYS_7,this.GREYS_8,this.GREYS_9],this.ORANGES=[this.ORANGES_3,this.ORANGES_4,this.ORANGES_5,this.ORANGES_6,this.ORANGES_7,this.ORANGES_8,this.ORANGES_9],this.PURPLES=[this.PURPLES_3,this.PURPLES_4,this.PURPLES_5,this.PURPLES_6,this.PURPLES_7,this.PURPLES_8,this.PURPLES_9],this.REDS=[this.REDS_3,this.REDS_4,this.REDS_5,this.REDS_6,this.REDS_7,this.REDS_8,this.REDS_9],this.BR_BG_3=["#d8b365","#f5f5f5","#5ab4ac"],this.BR_BG_4=["#a6611a","#dfc27d","#80cdc1","#018571"],this.BR_BG_5=["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],this.BR_BG_6=["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],this.BR_BG_7=["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],this.BR_BG_8=["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],this.BR_BG_9=["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],this.BR_BG_10=["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],this.BR_BG_11=["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],this.PI_YG_3=["#e9a3c9","#f7f7f7","#a1d76a"],this.PI_YG_4=["#d01c8b","#f1b6da","#b8e186","#4dac26"],this.PI_YG_5=["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],this.PI_YG_6=["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],this.PI_YG_7=["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],this.PI_YG_8=["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],this.PI_YG_9=["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],this.PI_YG_10=["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],this.PI_YG_11=["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],this.PR_GN_3=["#af8dc3","#f7f7f7","#7fbf7b"],this.PR_GN_4=["#7b3294","#c2a5cf","#a6dba0","#008837"],this.PR_GN_5=["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],this.PR_GN_6=["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],this.PR_GN_7=["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],this.PR_GN_8=["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],this.PR_GN_9=["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],this.PR_GN_10=["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],this.PR_GN_11=["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],this.PU_OR_3=["#f1a340","#f7f7f7","#998ec3"],this.PU_OR_4=["#e66101","#fdb863","#b2abd2","#5e3c99"],this.PU_OR_5=["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],this.PU_OR_6=["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],this.PU_OR_7=["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],this.PU_OR_8=["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],this.PU_OR_9=["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],this.PU_OR_10=["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],this.PU_OR_11=["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],this.RD_BU_3=["#ef8a62","#f7f7f7","#67a9cf"],this.RD_BU_4=["#ca0020","#f4a582","#92c5de","#0571b0"],this.RD_BU_5=["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],this.RD_BU_6=["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],this.RD_BU_7=["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],this.RD_BU_8=["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],this.RD_BU_9=["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],this.RD_BU_10=["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],this.RD_BU_11=["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],this.RD_GY_3=["#ef8a62","#ffffff","#999999"],this.RD_GY_4=["#ca0020","#f4a582","#bababa","#404040"],this.RD_GY_5=["#ca0020","#f4a582","#ffffff","#bababa","#404040"],this.RD_GY_6=["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],this.RD_GY_7=["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],this.RD_GY_8=["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],this.RD_GY_9=["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],this.RD_GY_10=["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],this.RD_GY_11=["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],this.RD_YL_BU_3=["#fc8d59","#ffffbf","#91bfdb"],this.RD_YL_BU_4=["#d7191c","#fdae61","#abd9e9","#2c7bb6"],this.RD_YL_BU_5=["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],this.RD_YL_BU_6=["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],this.RD_YL_BU_7=["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],this.RD_YL_BU_8=["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],this.RD_YL_BU_9=["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],this.RD_YL_BU_10=["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],this.RD_YL_BU_11=["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],this.RD_YL_GN_3=["#fc8d59","#ffffbf","#91cf60"],this.RD_YL_GN_4=["#d7191c","#fdae61","#a6d96a","#1a9641"],this.RD_YL_GN_5=["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],this.RD_YL_GN_6=["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],this.RD_YL_GN_7=["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],this.RD_YL_GN_8=["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],this.RD_YL_GN_9=["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],this.RD_YL_GN_10=["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],this.RD_YL_GN_11=["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],this.SPECTRAL_3=["#fc8d59","#ffffbf","#99d594"],this.SPECTRAL_4=["#d7191c","#fdae61","#abdda4","#2b83ba"],this.SPECTRAL_5=["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],this.SPECTRAL_6=["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],this.SPECTRAL_7=["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],this.SPECTRAL_8=["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],this.SPECTRAL_9=["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],this.SPECTRAL_10=["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],this.SPECTRAL_11=["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],this.BR_BG=[this.BR_BG_3,this.BR_BG_4,this.BR_BG_5,this.BR_BG_6,this.BR_BG_7,this.BR_BG_8,this.BR_BG_9,this.BR_BG_10,this.BR_BG_11],this.PI_YG=[this.PI_YG_3,this.PI_YG_4,this.PI_YG_5,this.PI_YG_6,this.PI_YG_7,this.PI_YG_8,this.PI_YG_9,this.PI_YG_10,this.PI_YG_11],this.PR_GN=[this.PR_GN_3,this.PR_GN_4,this.PR_GN_5,this.PR_GN_6,this.PR_GN_7,this.PR_GN_8,this.PR_GN_9,this.PR_GN_10,this.PR_GN_11],this.PU_OR=[this.PU_OR_3,this.PU_OR_4,this.PU_OR_5,this.PU_OR_6,this.PU_OR_7,this.PU_OR_8,this.PU_OR_9,this.PU_OR_10,this.PU_OR_11],this.RD_BU=[this.RD_BU_3,this.RD_BU_4,this.RD_BU_5,this.RD_BU_6,this.RD_BU_7,this.RD_BU_8,this.RD_BU_9,this.RD_BU_10,this.RD_BU_11],this.RD_GY=[this.RD_GY_3,this.RD_GY_4,this.RD_GY_5,this.RD_GY_6,this.RD_GY_7,this.RD_GY_8,this.RD_GY_9,this.RD_GY_10,this.RD_GY_11],this.RD_YL_BU=[this.RD_YL_BU_3,this.RD_YL_BU_4,this.RD_YL_BU_5,this.RD_YL_BU_6,this.RD_YL_BU_7,this.RD_YL_BU_8,this.RD_YL_BU_9,this.RD_YL_BU_10,this.RD_YL_BU_11],this.RD_YL_GN=[this.RD_YL_GN_3,this.RD_YL_GN_4,this.RD_YL_GN_5,this.RD_YL_GN_6,this.RD_YL_GN_7,this.RD_YL_GN_8,this.RD_YL_GN_9,this.RD_YL_GN_10,this.RD_YL_GN_11],this.SPECTRAL=[this.SPECTRAL_3,this.SPECTRAL_4,this.SPECTRAL_5,this.SPECTRAL_6,this.SPECTRAL_7,this.SPECTRAL_8,this.SPECTRAL_9,this.SPECTRAL_10,this.SPECTRAL_11],this.ACCENT_3=["#7fc97f","#beaed4","#fdc086"],this.ACCENT_4=["#7fc97f","#beaed4","#fdc086","#ffff99"],this.ACCENT_5=["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],this.ACCENT_6=["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],this.ACCENT_7=["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],this.ACCENT_8=["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],this.DARK_2_3=["#1b9e77","#d95f02","#7570b3"],this.DARK_2_4=["#1b9e77","#d95f02","#7570b3","#e7298a"],this.DARK_2_5=["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],this.DARK_2_6=["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],this.DARK_2_7=["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],this.DARK_2_8=["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],this.PAIRED_3=["#a6cee3","#1f78b4","#b2df8a"],this.PAIRED_4=["#a6cee3","#1f78b4","#b2df8a","#33a02c"],this.PAIRED_5=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],this.PAIRED_6=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],this.PAIRED_7=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],this.PAIRED_8=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],this.PAIRED_9=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],this.PAIRED_10=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],this.PAIRED_11=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],this.PAIRED_12=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],this.PASTEL_1_3=["#fbb4ae","#b3cde3","#ccebc5"],this.PASTEL_1_4=["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],this.PASTEL_1_5=["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],this.PASTEL_1_6=["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],this.PASTEL_1_7=["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],this.PASTEL_1_8=["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],this.PASTEL_1_9=["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"],this.PASTEL_2_3=["#b3e2cd","#fdcdac","#cbd5e8"],this.PASTEL_2_4=["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],this.PASTEL_2_5=["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],this.PASTEL_2_6=["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],this.PASTEL_2_7=["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],this.PASTEL_2_8=["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],this.SET_1_3=["#e41a1c","#377eb8","#4daf4a"],this.SET_1_4=["#e41a1c","#377eb8","#4daf4a","#984ea3"],this.SET_1_5=["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],this.SET_1_6=["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],this.SET_1_7=["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],this.SET_1_8=["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],this.SET_1_9=["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],this.SET_2_3=["#66c2a5","#fc8d62","#8da0cb"],this.SET_2_4=["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],this.SET_2_5=["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],this.SET_2_6=["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],this.SET_2_7=["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],this.SET_2_8=["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],this.SET_3_3=["#8dd3c7","#ffffb3","#bebada"],this.SET_3_4=["#8dd3c7","#ffffb3","#bebada","#fb8072"],this.SET_3_5=["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],this.SET_3_6=["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],this.SET_3_7=["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],this.SET_3_8=["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],this.SET_3_9=["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],this.SET_3_10=["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],this.SET_3_11=["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],this.SET_3_12=["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],this.ACCENT=[this.ACCENT_3,this.ACCENT_4,this.ACCENT_5,this.ACCENT_6,this.ACCENT_7,this.ACCENT_8],this.DARK_2=[this.DARK_2_3,this.DARK_2_4,this.DARK_2_5,this.DARK_2_6,this.DARK_2_7,this.DARK_2_8],this.PAIRED=[this.PAIRED_3,this.PAIRED_4,this.PAIRED_5,this.PAIRED_6,this.PAIRED_7,this.PAIRED_8,this.PAIRED_9,this.PAIRED_10,this.PAIRED_11,this.PAIRED_12],this.PASTEL_1=[this.PASTEL_1_3,this.PASTEL_1_4,this.PASTEL_1_5,this.PASTEL_1_6,this.PASTEL_1_7,this.PASTEL_1_8,this.PASTEL_1_9],this.PASTEL_2=[this.PASTEL_2_3,this.PASTEL_2_4,this.PASTEL_2_5,this.PASTEL_2_6,this.PASTEL_2_7,this.PASTEL_2_8],this.SET_1=[this.SET_1_3,this.SET_1_4,this.SET_1_5,this.SET_1_6,this.SET_1_7,this.SET_1_8,this.SET_1_9],this.SET_2=[this.SET_2_3,this.SET_2_4,this.SET_2_5,this.SET_2_6,this.SET_2_7,this.SET_2_8],this.SET_3=[this.SET_3_3,this.SET_3_4,this.SET_3_5,this.SET_3_6,this.SET_3_7,this.SET_3_8,this.SET_3_9,this.SET_3_10,this.SET_3_11,this.SET_3_12]}Ge.$metadata$={kind:Y,simpleName:"ColorScheme",interfaces:[]},He.$metadata$={kind:G,simpleName:"ColorSets",interfaces:[]};var Ye=null;function Ve(){return null===Ye&&new He,Ye}function Ke(){We=this}Ke.prototype.genColors_2c6x13$=function(t,e){var n,i=V(),r=V(),o=V();for(n=e.iterator();n.hasNext();){var a=n.next();i.add_11rb$(a.red),r.add_11rb$(a.green),o.add_11rb$(a.blue)}for(var s=new Qe(i),l=new Qe(r),u=new Qe(o),c=s.generate_za3lpa$(t).iterator(),p=l.generate_za3lpa$(t).iterator(),h=u.generate_za3lpa$(t).iterator(),_=K(t);c.hasNext()&&p.hasNext()&&h.hasNext();){var f=new W(c.next(),p.next(),h.next());_.add_11rb$(f)}return _},Ke.$metadata$={kind:G,simpleName:"ColorUtil",interfaces:[]};var We=null;function Xe(){return null===We&&new Ke,We}function Ze(){Je=this,this.NULL_COLOR=W.Companion.LIGHT_GRAY,this.EXTENSIBLE_COLOR_SCHEMES_0=Q([je(),Le(),Ie(),ze(),De(),Me(),Be()]),this.PAL_TYPE_BY_PAL_NAME_0=null;var t,e,n=tt(),i=$e(),r=K(i.length);for(t=0;t!==i.length;++t){var o=i[t];r.add_11rb$(o.name)}for(e=r.iterator();e.hasNext();){var a=e.next(),s=Wt();n.put_xwzc9p$(a,s)}var l,u,c=Ne(),p=K(c.length);for(l=0;l!==c.length;++l){var h=c[l];p.add_11rb$(h.name)}for(u=p.iterator();u.hasNext();){var _=u.next(),f=Xt();n.put_xwzc9p$(_,f)}var d,m,y=Ue(),$=K(y.length);for(d=0;d!==y.length;++d){var v=y[d];$.add_11rb$(v.name)}for(m=$.iterator();m.hasNext();){var g=m.next(),b=Zt();n.put_xwzc9p$(g,b)}this.PAL_TYPE_BY_PAL_NAME_0=n}Ze.prototype.isExtensibleScheme_0=function(t){return this.EXTENSIBLE_COLOR_SCHEMES_0.contains_11rb$(t)},Ze.prototype.schemeColors_7q5c77$=function(t,e){var n=t.getColors_za3lpa$(e),i=this.fromColorsHex_0(n);if(n.length=this.myMinRowSize_0){this.isMesh=!0;var a=nt(i[1])-nt(i[0]);this.resolution=H.abs(a)}},an.$metadata$={kind:F,simpleName:"MyColumnDetector",interfaces:[rn]},sn.prototype.tryRow_l63ks6$=function(t){var e=X.Iterables.get_dhabsj$(t,0,null),n=X.Iterables.get_dhabsj$(t,1,null);if(null==e||null==n)return this.NO_MESH_0;var i=n-e,r=H.abs(i);if(!ot(r))return this.NO_MESH_0;var o=r/1e4;return this.tryRow_4sxsdq$(50,o,t)},sn.prototype.tryRow_4sxsdq$=function(t,e,n){return new on(t,e,n)},sn.prototype.tryColumn_l63ks6$=function(t){return this.tryColumn_4sxsdq$(50,$n().TINY,t)},sn.prototype.tryColumn_4sxsdq$=function(t,e,n){return new an(t,e,n)},Object.defineProperty(ln.prototype,"isMesh",{configurable:!0,get:function(){return!1},set:function(t){e.callSetter(this,rn.prototype,"isMesh",t)}}),ln.$metadata$={kind:F,interfaces:[rn]},sn.$metadata$={kind:G,simpleName:"Companion",interfaces:[]};var un=null;function cn(){return null===un&&new sn,un}function pn(){var t;yn=this,this.TINY=1e-50,this.REAL_NUMBER_0=(t=this,function(e){return t.isFinite_yrwdxb$(e)}),this.NEGATIVE_NUMBER=mn}function hn(t){_n.call(this,t)}function _n(t){var e;this.myIterable_n2c9gl$_0=t,this.myEmpty_3k4vh6$_0=X.Iterables.isEmpty_fakr2g$(this.myIterable_n2c9gl$_0),this.myCanBeCast_310oqz$_0=!1,e=!!this.myEmpty_3k4vh6$_0||X.Iterables.all_fpit1u$(X.Iterables.filter_fpit1u$(this.myIterable_n2c9gl$_0,fn),dn),this.myCanBeCast_310oqz$_0=e}function fn(t){return null!=t}function dn(t){return"number"==typeof t}function mn(t){return t<0}rn.$metadata$={kind:F,simpleName:"RegularMeshDetector",interfaces:[]},pn.prototype.isSubTiny_14dthe$=function(t){return t0&&(p10?e.size:10,r=K(i);for(n=e.iterator();n.hasNext();){var o=n.next();o=0?i:e},pn.prototype.sum_k9kaly$=function(t){var e,n=0;for(e=t.iterator();e.hasNext();){var i=e.next();null!=i&&ot(i)&&(n+=i)}return n},pn.prototype.toDoubleList_8a6n3n$=function(t){return null==t?null:new hn(t).cast()},hn.prototype.cast=function(){var t;return e.isType(t=_n.prototype.cast.call(this),ut)?t:J()},hn.$metadata$={kind:F,simpleName:"CheckedDoubleList",interfaces:[_n]},_n.prototype.notEmptyAndCanBeCast=function(){return!this.myEmpty_3k4vh6$_0&&this.myCanBeCast_310oqz$_0},_n.prototype.canBeCast=function(){return this.myCanBeCast_310oqz$_0},_n.prototype.cast=function(){var t;if(!this.myCanBeCast_310oqz$_0)throw at("Can't cast to a collection of Double(s)".toString());return e.isType(t=this.myIterable_n2c9gl$_0,pt)?t:J()},_n.$metadata$={kind:F,simpleName:"CheckedDoubleIterable",interfaces:[]},pn.$metadata$={kind:G,simpleName:"SeriesUtil",interfaces:[]};var yn=null;function $n(){return null===yn&&new pn,yn}function vn(){this.myEpsilon_0=yt.MIN_VALUE}function gn(t,e){return function(n){return new vt(t.get_za3lpa$(e),n).length()}}function bn(t){return function(e){return t.distance_gpjtzr$(e)}}vn.prototype.calculateWeights_0=function(t){for(var e=new mt,n=t.size,i=K(n),r=0;ru&&(c=h,u=_),h=h+1|0}u>=this.myEpsilon_0&&(e.push_11rb$(new $t(a,c)),e.push_11rb$(new $t(c,s)),o.set_wxm5ur$(c,u))}return o},vn.prototype.getWeights_ytws2g$=function(t){return this.calculateWeights_0(t)},vn.$metadata$={kind:F,simpleName:"DouglasPeuckerSimplification",interfaces:[kn]};var wn=Ct((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(n),r(i))}}}));function xn(t,e){Sn(),this.myPoints_0=t,this.myWeights_0=null,this.myWeightLimit_0=yt.NaN,this.myCountLimit_0=-1,this.myWeights_0=e.getWeights_ytws2g$(this.myPoints_0)}function kn(){}function En(){Cn=this}Object.defineProperty(xn.prototype,"points",{configurable:!0,get:function(){var t,e=this.indices,n=K(Et(e,10));for(t=e.iterator();t.hasNext();){var i=t.next();n.add_11rb$(this.myPoints_0.get_za3lpa$(i))}return n}}),Object.defineProperty(xn.prototype,"indices",{configurable:!0,get:function(){var t,e=gt(0,this.myPoints_0.size),n=K(Et(e,10));for(t=e.iterator();t.hasNext();){var i=t.next();n.add_11rb$(new $t(i,this.myWeights_0.get_za3lpa$(i)))}var r,o=V();for(r=n.iterator();r.hasNext();){var a=r.next();bt(this.getWeight_0(a))||o.add_11rb$(a)}var s,l,u=xt(o,wt(new St(wn((l=this,function(t){return l.getWeight_0(t)})))));if(this.isWeightLimitSet_0){var c,p=V();for(c=u.iterator();c.hasNext();){var h=c.next();this.getWeight_0(h)>this.myWeightLimit_0&&p.add_11rb$(h)}s=p}else s=st(u,this.myCountLimit_0);var _,f=s,d=K(Et(f,10));for(_=f.iterator();_.hasNext();){var m=_.next();d.add_11rb$(this.getIndex_0(m))}return kt(d)}}),Object.defineProperty(xn.prototype,"isWeightLimitSet_0",{configurable:!0,get:function(){return!bt(this.myWeightLimit_0)}}),xn.prototype.setWeightLimit_14dthe$=function(t){return this.myWeightLimit_0=t,this.myCountLimit_0=-1,this},xn.prototype.setCountLimit_za3lpa$=function(t){return this.myWeightLimit_0=yt.NaN,this.myCountLimit_0=t,this},xn.prototype.getWeight_0=function(t){return t.second},xn.prototype.getIndex_0=function(t){return t.first},kn.$metadata$={kind:Y,simpleName:"RankingStrategy",interfaces:[]},En.prototype.visvalingamWhyatt_ytws2g$=function(t){return new xn(t,new On)},En.prototype.douglasPeucker_ytws2g$=function(t){return new xn(t,new vn)},En.$metadata$={kind:G,simpleName:"Companion",interfaces:[]};var Cn=null;function Sn(){return null===Cn&&new En,Cn}xn.$metadata$={kind:F,simpleName:"PolylineSimplifier",interfaces:[]};var Tn=Ct((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(n),r(i))}}}));function On(){Ln(),this.myVerticesToRemove_0=V(),this.myTriangles_0=null}function Nn(t){return t.area}function Pn(t,e){this.currentVertex=t,this.myPoints_0=e,this.area_nqp3v0$_0=0,this.prevVertex_0=0,this.nextVertex_0=0,this.prev=null,this.next=null,this.prevVertex_0=this.currentVertex-1|0,this.nextVertex_0=this.currentVertex+1|0,this.area=this.calculateArea_0()}function An(){jn=this,this.INITIAL_AREA_0=yt.MAX_VALUE}Object.defineProperty(On.prototype,"isSimplificationDone_0",{configurable:!0,get:function(){return this.isEmpty_0}}),Object.defineProperty(On.prototype,"isEmpty_0",{configurable:!0,get:function(){return nt(this.myTriangles_0).isEmpty()}}),On.prototype.getWeights_ytws2g$=function(t){this.myTriangles_0=K(t.size-2|0),this.initTriangles_0(t);for(var e=t.size,n=K(e),i=0;io?a.area:o,r.set_wxm5ur$(a.currentVertex,o);var s=a.next;null!=s&&(s.takePrevFrom_em8fn6$(a),this.update_0(s));var l=a.prev;null!=l&&(l.takeNextFrom_em8fn6$(a),this.update_0(l)),this.myVerticesToRemove_0.add_11rb$(a.currentVertex)}return r},On.prototype.initTriangles_0=function(t){for(var e=K(t.size-2|0),n=1,i=t.size-1|0;ne)throw Bt("Duration must be positive");var n=Hn().asDateTimeUTC_14dthe$(t),i=this.getFirstDayContaining_amwj4p$(n),r=new Dt(i);r.compareTo_11rb$(n)<0&&(r=this.addInterval_amwj4p$(r));for(var o=V(),a=Hn().asInstantUTC_amwj4p$(r).toNumber();a<=e;)o.add_11rb$(a),r=this.addInterval_amwj4p$(r),a=Hn().asInstantUTC_amwj4p$(r).toNumber();return o},Vn.$metadata$={kind:F,simpleName:"MeasuredInDays",interfaces:[ii]},Object.defineProperty(Kn.prototype,"tickFormatPattern",{configurable:!0,get:function(){return"%b"}}),Kn.prototype.getFirstDayContaining_amwj4p$=function(t){var e=t.date;return zt.Companion.firstDayOf_8fsw02$(e.year,e.month)},Kn.prototype.addInterval_amwj4p$=function(t){var e,n=t;e=this.count;for(var i=0;i=t){n=t-this.AUTO_STEPS_MS_0[i-1|0]").find_905azu$(t);if(null==e||2!==e.groupValues.size)throw N("Couldn't find 'svg' tag".toString());var n=e.groupValues.get_za3lpa$(1),i=this.extractDouble_0(j('.*width="(\\d+)\\.?(\\d+)?"'),n),r=this.extractDouble_0(j('.*height="(\\d+)\\.?(\\d+)?"'),n);return new m(i,r)},tr.prototype.extractDouble_0=function(t,e){var n=L(t.find_905azu$(e)).groupValues;return n.size<3?R(n.get_za3lpa$(1)):R(n.get_za3lpa$(1)+"."+n.get_za3lpa$(2))},tr.$metadata$={kind:b,simpleName:"PlotSizeHelper",interfaces:[]};var er=null;function nr(){return null===er&&new tr,er}function ir(t){ar(),yl.call(this,t)}function rr(){or=this,this.DEF_ANGLE_0=30,this.DEF_LENGTH_0=10,this.DEF_END_0=U.LAST,this.DEF_TYPE_0=F.OPEN}ir.prototype.createArrowSpec=function(){var t=ar().DEF_ANGLE_0,e=ar().DEF_LENGTH_0,n=ar().DEF_END_0,i=ar().DEF_TYPE_0;if(this.has_61zpoe$(tl().ANGLE)&&(t=L(this.getDouble_61zpoe$(tl().ANGLE))),this.has_61zpoe$(tl().LENGTH)&&(e=L(this.getDouble_61zpoe$(tl().LENGTH))),this.has_61zpoe$(tl().ENDS))switch(this.getString_61zpoe$(tl().ENDS)){case"last":n=U.LAST;break;case"first":n=U.FIRST;break;case"both":n=U.BOTH;break;default:throw N("Expected: first|last|both")}if(this.has_61zpoe$(tl().TYPE))switch(this.getString_61zpoe$(tl().TYPE)){case"open":i=F.OPEN;break;case"closed":i=F.CLOSED;break;default:throw N("Expected: open|closed")}return new G(q(t),e,n,i)},rr.prototype.create_za3rmp$=function(t){var n;if(e.isType(t,A)){var i=_r().featureName_bkhwtg$(t);if(H("arrow",i))return new ir(e.isType(n=t,A)?n:c())}throw N("Expected: 'arrow = arrow(...)'")},rr.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var or=null;function ar(){return null===or&&new rr,or}function sr(t){var n,i;for(yl.call(this,t),this.myItems_0=d(),n=this.getList_61zpoe$(ra().ITEMS).iterator();n.hasNext();){var r=n.next();if(e.isType(r,A)){var o=new yl(e.isType(i=r,u)?i:c());this.myItems_0.add_11rb$(new lr(o.getMap_61zpoe$(na().FEATURE_SPEC),L(o.getDouble_61zpoe$(na().X)),L(o.getDouble_61zpoe$(na().Y)),o.getDouble_61zpoe$(na().WIDTH),o.getDouble_61zpoe$(na().HEIGHT)))}}}function lr(t,e,n,i,r){this.myFeatureSpec_0=t,this.x=e,this.y=n,this.myWidth_0=i,this.myHeight_0=r}function ur(){hr=this}function cr(t,e){var n,i=k(x(e,10));for(n=e.iterator();n.hasNext();){var r,o,a=n.next(),s=i.add_11rb$;o="string"==typeof(r=a)?r:c(),s.call(i,V.DataFrameUtil.findVariableOrFail_vede35$(t,o))}var l,u=i,p=K(0,t.rowCount()),h=k(x(p,10));for(l=p.iterator();l.hasNext();){var _,f=l.next(),d=h.add_11rb$,m=k(x(u,10));for(_=u.iterator();_.hasNext();){var y=_.next();m.add_11rb$(t.get_8xm3sj$(y).get_za3lpa$(f))}d.call(h,m)}return h}function pr(t){return W(t).size=0){var j,R;for(C.remove_11rb$(O),j=n.variables().iterator();j.hasNext();){var I=j.next();L(h.get_11rb$(I)).add_11rb$(n.get_8xm3sj$(I).get_za3lpa$(A))}for(R=t.variables().iterator();R.hasNext();){var z=R.next();L(h.get_11rb$(z)).add_11rb$(t.get_8xm3sj$(z).get_za3lpa$(P))}}}}for(b=C.iterator();b.hasNext();){var D;for(D=E(u,b.next()).iterator();D.hasNext();){var M,B,U=D.next();for(M=n.variables().iterator();M.hasNext();){var F=M.next();L(h.get_11rb$(F)).add_11rb$(n.get_8xm3sj$(F).get_za3lpa$(U))}for(B=t.variables().iterator();B.hasNext();){var q=B.next();L(h.get_11rb$(q)).add_11rb$(null)}}}var G,Y=h.entries,V=Q();for(G=Y.iterator();G.hasNext();){var K=G.next(),W=V,tt=K.key,et=K.value;V=W.put_2l962d$(tt,et)}return V.build()},ur.prototype.asVarNameMap_0=function(t){var n,i;if(null==t)return tt();var r=X();if(e.isType(t,A))for(n=t.keys.iterator();n.hasNext();){var o,a=n.next(),s=(e.isType(o=t,A)?o:c()).get_11rb$(a);if(e.isType(s,et)){var l=f(a);r.put_xwzc9p$(l,s)}}else{if(!e.isType(t,et))throw N("Unsupported data structure: "+e.getKClassFromExpression(t).simpleName);var u=!0,p=-1;for(i=t.iterator();i.hasNext();){var h=i.next();if(!e.isType(h,et)||!(p<0||h.size===p)){u=!1;break}p=h.size}if(u)for(var _=V.Dummies.dummyNames_za3lpa$(t.size),d=0;d!==t.size;++d){var m,y=_.get_za3lpa$(d),$=e.isType(m=t.get_za3lpa$(d),et)?m:c();r.put_xwzc9p$(y,$)}else{var v=V.Dummies.dummyNames_za3lpa$(1).get_za3lpa$(0);r.put_xwzc9p$(v,t)}}return r},ur.prototype.updateDataFrame_0=function(t,e){var n,i,r=V.DataFrameUtil.variables_dhhkv7$(t),o=t.builder();for(n=e.entries.iterator();n.hasNext();){var a=n.next(),s=a.key,l=a.value,u=null!=(i=r.get_11rb$(s))?i:V.DataFrameUtil.createVariable_puj7f4$(s);o.put_2l962d$(u,l)}return o.build()},ur.prototype.toList_0=function(t){var n;if(e.isType(t,et))n=t;else if(e.isNumber(t))n=_(nt(t));else{if(e.isType(t,it))throw N("Can't cast/transform to list: "+e.getKClassFromExpression(t).simpleName);n=_(t.toString())}return n},ur.prototype.createAesMapping_5bl3vv$=function(t,n){var i;if(null==n)return tt();var r=V.DataFrameUtil.variables_dhhkv7$(t),o=X();for(i=Fs().REAL_AES_OPTION_NAMES.iterator();i.hasNext();){var a,s=i.next(),l=(e.isType(a=n,A)?a:c()).get_11rb$(s);if("string"==typeof l){var u,p=null!=(u=r.get_11rb$(l))?u:V.DataFrameUtil.createVariable_puj7f4$(l),h=Fs().toAes_61zpoe$(s);o.put_xwzc9p$(h,p)}}return o},ur.prototype.toNumericPair_9ma18$=function(t){var n=0,i=0,r=t.iterator();if(r.hasNext())try{n=R(""+f(r.next()))}catch(t){if(!e.isType(t,rt))throw t}if(r.hasNext())try{i=R(""+f(r.next()))}catch(t){if(!e.isType(t,rt))throw t}return new m(n,i)},ur.$metadata$={kind:b,simpleName:"ConfigUtil",interfaces:[]};var hr=null;function _r(){return null===hr&&new ur,hr}function fr(t,e){yr(),yl.call(this,e),this.coord=gr().createCoordProvider_5ai0im$(t,this)}function dr(){mr=this}dr.prototype.create_za3rmp$=function(t){var n;if(e.isType(t,A)){var i=e.isType(n=t,A)?n:c();return this.createForName_0(_r().featureName_bkhwtg$(i),i)}return this.createForName_0(t.toString(),X())},dr.prototype.createForName_0=function(t,e){return new fr(t,e)},dr.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var mr=null;function yr(){return null===mr&&new dr,mr}function $r(){vr=this,this.X_LIM_0="xlim",this.Y_LIM_0="ylim",this.RATIO_0="ratio",this.EXPAND_0="expand",this.ORIENTATION_0="orientation",this.PROJECTION_0="projection"}fr.$metadata$={kind:v,simpleName:"CoordConfig",interfaces:[yl]},$r.prototype.createCoordProvider_5ai0im$=function(t,e){var n,i,r=e.getRangeOrNull_61zpoe$(this.X_LIM_0),o=e.getRangeOrNull_61zpoe$(this.Y_LIM_0);switch(t){case"cartesian":i=at.CoordProviders.cartesian_t7esj2$(r,o);break;case"fixed":i=at.CoordProviders.fixed_vvp5j4$(null!=(n=e.getDouble_61zpoe$(this.RATIO_0))?n:1,r,o);break;case"map":i=at.CoordProviders.map_t7esj2$(r,o);break;default:throw N("Unknown coordinate system name: '"+t+"'")}return i},$r.$metadata$={kind:b,simpleName:"CoordProto",interfaces:[]};var vr=null;function gr(){return null===vr&&new $r,vr}function br(){wr=this,this.prefix_0="@as_discrete@"}br.prototype.isDiscrete_0=function(t){return st(t,this.prefix_0)},br.prototype.toDiscrete_61zpoe$=function(t){if(this.isDiscrete_0(t))throw N(("toDiscrete() - variable already encoded: "+t).toString());return this.prefix_0+t},br.prototype.fromDiscrete_0=function(t){if(!this.isDiscrete_0(t))throw N(("fromDiscrete() - variable is not encoded: "+t).toString());return lt(t,this.prefix_0)},br.prototype.getMappingAnnotationsSpec_0=function(t,e){var n,i,r,o;if(null!=(i=null!=(n=Al(t,[Jo().DATA_META]))?Il(n,[Xo().TAG]):null)){var a,s=d();for(a=i.iterator();a.hasNext();){var l=a.next();H(Cl(l,[Xo().ANNOTATION]),e)&&s.add_11rb$(l)}o=s}else o=null;return null!=(r=o)?r:ut()},br.prototype.getAsDiscreteAesSet_bkhwtg$=function(t){var e,n,i,r,o,a;if(null!=(e=Il(t,[Xo().TAG]))){var s,l=xt(wt(x(e,10)),16),u=kt(l);for(s=e.iterator();s.hasNext();){var c=s.next(),p=ct(L(Cl(c,[Xo().AES])),L(Cl(c,[Xo().ANNOTATION])));u.put_xwzc9p$(p.first,p.second)}o=u}else o=null;if(null!=(n=o)){var h,_=pt("equals",function(t,e){return H(t,e)}.bind(null,Xo().AS_DISCRETE)),f=Et();for(h=n.entries.iterator();h.hasNext();){var d=h.next();_(d.value)&&f.put_xwzc9p$(d.key,d.value)}a=f}else a=null;return null!=(r=null!=(i=a)?i.keys:null)?r:ht()},br.prototype.createScaleSpecs_x7u0o8$=function(t){var e,n,i,r,o=this.getMappingAnnotationsSpec_0(t,Xo().AS_DISCRETE);if(null!=(e=Il(t,[ca().LAYERS]))){var a,s=k(x(e,10));for(a=e.iterator();a.hasNext();){var l=a.next();s.add_11rb$(this.getMappingAnnotationsSpec_0(l,Xo().AS_DISCRETE))}r=s}else r=null;var u,c=null!=(i=null!=(n=r)?_t(n):null)?i:ut(),p=ft(o,c),h=Et();for(u=p.iterator();u.hasNext();){var _,f=u.next(),m=L(Cl(f,[Xo().AES])),y=h.get_11rb$(m);if(null==y){var $=d();h.put_xwzc9p$(m,$),_=$}else _=y;_.add_11rb$(Cl(f,[Xo().PARAMETERS,Xo().LABEL]))}var v,g=kt(wt(h.size));for(v=h.entries.iterator();v.hasNext();){var b,w=v.next(),E=g.put_xwzc9p$,C=w.key,S=w.value;t:do{for(var T=S.listIterator_za3lpa$(S.size);T.hasPrevious();){var O=T.previous();if(null!=O){b=O;break t}}b=null}while(0);E.call(g,C,b)}var N,P=k(g.size);for(N=g.entries.iterator();N.hasNext();){var A=N.next(),j=P.add_11rb$,R=A.key,I=A.value;j.call(P,dt([ct(Is().AES,R),ct(Is().DISCRETE_DOMAIN,!0),ct(Is().NAME,I)]))}return P},br.prototype.createDataFrame_dgfi6i$=function(t,e,n,i,r){var o=_r().createDataFrame_8ea4ql$(t.get_61zpoe$(sa().DATA)),a=t.getMap_61zpoe$(sa().MAPPING);if(r){var s,l=V.DataFrameUtil.toMap_dhhkv7$(o),u=Et();for(s=l.entries.iterator();s.hasNext();){var c=s.next(),p=c.key;this.isDiscrete_0(p)&&u.put_xwzc9p$(c.key,c.value)}var h,_=u.entries,f=mt(o);for(h=_.iterator();h.hasNext();){var d=h.next(),m=f,y=d.key,$=d.value,v=V.DataFrameUtil.findVariableOrFail_vede35$(o,y);m.remove_8xm3sj$(v),f=m.putDiscrete_2l962d$(v,$)}return new D(a,f.build())}var g,b=this.getAsDiscreteAesSet_bkhwtg$(t.getMap_61zpoe$(Jo().DATA_META)),w=Et();for(g=a.entries.iterator();g.hasNext();){var E=g.next(),C=E.key;b.contains_11rb$(C)&&w.put_xwzc9p$(E.key,E.value)}var S,T=w,O=Et();for(S=i.entries.iterator();S.hasNext();){var P=S.next();yt(n,P.key)&&O.put_xwzc9p$(P.key,P.value)}var A,j=kr(O),L=pt("fromDiscrete",function(t,e){return t.fromDiscrete_0(e)}.bind(null,this)),R=k(x(j,10));for(A=j.iterator();A.hasNext();){var I=A.next();R.add_11rb$(L(I))}var z,M=R,B=$t(kr(a),kr(T)),U=$t(vt(kr(T),M),B),F=gt(V.DataFrameUtil.toMap_dhhkv7$(e),V.DataFrameUtil.toMap_dhhkv7$(o)),q=kt(wt(T.size));for(z=T.entries.iterator();z.hasNext();){var G=z.next(),H=q.put_xwzc9p$,Y=G.key,K=G.value;if("string"!=typeof K)throw N("Failed requirement.".toString());H.call(q,Y,this.toDiscrete_61zpoe$(K))}var W,X=gt(a,q),Z=Et();for(W=F.entries.iterator();W.hasNext();){var J=W.next(),Q=J.key;U.contains_11rb$(Q)&&Z.put_xwzc9p$(J.key,J.value)}var tt,et=kt(wt(Z.size));for(tt=Z.entries.iterator();tt.hasNext();){var nt=tt.next(),it=et.put_xwzc9p$,rt=nt.key;it.call(et,V.DataFrameUtil.createVariable_puj7f4$(this.toDiscrete_61zpoe$(rt)),nt.value)}var ot,at=et.entries,st=mt(o);for(ot=at.iterator();ot.hasNext();){var lt=ot.next(),ut=st,ct=lt.key,ht=lt.value;st=ut.putDiscrete_2l962d$(ct,ht)}return new D(X,st.build())},br.prototype.getOrderOptions_tjia25$=function(t,n){var i,r,o,a,s;if(null!=(i=null!=t?this.getMappingAnnotationsSpec_0(t,Xo().AS_DISCRETE):null)){var l,u=xt(wt(x(i,10)),16),p=kt(u);for(l=i.iterator();l.hasNext();){var h=l.next(),_=ct(L(Nl(h,[Xo().AES])),Al(h,[Xo().PARAMETERS]));p.put_xwzc9p$(_.first,_.second)}a=p}else a=null;if(null!=(r=a)){var f,m=d();for(f=r.entries.iterator();f.hasNext();){var y,$,v,g,b=f.next(),w=b.key,k=b.value;if(!(e.isType(v=n,A)?v:c()).containsKey_11rb$(w))throw N("Failed requirement.".toString());var E="string"==typeof($=(e.isType(g=n,A)?g:c()).get_11rb$(w))?$:c();null!=(y=bt.Companion.create_yyjhqb$(E,null!=k?Nl(k,[Xo().ORDER_BY]):null,null!=k?Cl(k,[Xo().ORDER]):null))&&m.add_11rb$(y)}s=m}else s=null;return null!=(o=s)?o:ut()},br.prototype.inheritToNonDiscrete_qxcvtk$=function(t,e){var n,i=kr(e),r=pt("isDiscrete",function(t,e){return t.isDiscrete_0(e)}.bind(null,this)),o=d();for(n=i.iterator();n.hasNext();){var a=n.next();r(a)||o.add_11rb$(a)}var s,l=d();for(s=o.iterator();s.hasNext();){var u,c,p=s.next();t:do{var h,_,f,m=d();for(_=t.iterator();_.hasNext();){var y=_.next();this.isDiscrete_0(y.variableName)&&m.add_11rb$(y)}e:do{var $;for($=m.iterator();$.hasNext();){var v=$.next();if(H(this.fromDiscrete_0(v.variableName),p)){f=v;break e}}f=null}while(0);if(null==(h=f)){c=null;break t}var g=h,b=g.byVariable;c=bt.Companion.create_yyjhqb$(p,H(b,g.variableName)?null:b,g.getOrderDir())}while(0);null!=(u=c)&&l.add_11rb$(u)}return ft(t,l)},br.$metadata$={kind:b,simpleName:"DataMetaUtil",interfaces:[]};var wr=null;function xr(){return null===wr&&new br,wr}function kr(t){var e,n=t.values,i=k(x(n,10));for(e=n.iterator();e.hasNext();){var r,o=e.next();i.add_11rb$("string"==typeof(r=o)?r:c())}return W(i)}function Er(t){yl.call(this,t)}function Cr(){Tr=this}function Sr(t,e){this.message=t,this.isInternalError=e}Er.prototype.createFacets_wcy4lu$=function(t){var e,n=this.getStringSafe_61zpoe$(Ms().NAME);switch(n){case"grid":e=this.createGrid_0(t);break;case"wrap":e=this.createWrap_0(t);break;default:throw N("Facet 'grid' or 'wrap' expected but was: `"+n+"`")}return e},Er.prototype.createGrid_0=function(t){var e,n,i=null,r=Ct();if(this.has_61zpoe$(Ms().X))for(i=this.getStringSafe_61zpoe$(Ms().X),e=t.iterator();e.hasNext();){var o=e.next();if(V.DataFrameUtil.hasVariable_vede35$(o,i)){var a=V.DataFrameUtil.findVariableOrFail_vede35$(o,i);r.addAll_brywnq$(o.distinctValues_8xm3sj$(a))}}var s=null,l=Ct();if(this.has_61zpoe$(Ms().Y))for(s=this.getStringSafe_61zpoe$(Ms().Y),n=t.iterator();n.hasNext();){var u=n.next();if(V.DataFrameUtil.hasVariable_vede35$(u,s)){var c=V.DataFrameUtil.findVariableOrFail_vede35$(u,s);l.addAll_brywnq$(u.distinctValues_8xm3sj$(c))}}return new Tt(i,s,St(r),St(l),this.getOrderOption_0(Ms().X_ORDER),this.getOrderOption_0(Ms().Y_ORDER),this.getFormatterOption_0(Ms().X_FORMAT),this.getFormatterOption_0(Ms().Y_FORMAT))},Er.prototype.createWrap_0=function(t){var e,n,i=this.getAsStringList_61zpoe$(Ms().FACETS),r=this.getInteger_61zpoe$(Ms().NCOL),o=this.getInteger_61zpoe$(Ms().NROW),a=d();for(e=i.iterator();e.hasNext();){var s=e.next(),l=Ot();for(n=t.iterator();n.hasNext();){var u=n.next();if(V.DataFrameUtil.hasVariable_vede35$(u,s)){var c=V.DataFrameUtil.findVariableOrFail_vede35$(u,s);l.addAll_brywnq$(Z(u.get_8xm3sj$(c)))}}a.add_11rb$(Nt(l))}var p,h=this.getAsList_61zpoe$(Ms().FACETS_ORDER),_=k(x(h,10));for(p=h.iterator();p.hasNext();){var f=p.next();_.add_11rb$(this.toOrderVal_0(f))}for(var m=_,y=i.size,$=k(y),v=0;v")+" : "+(null!=(i=r.message)?i:""),!0)},Sr.$metadata$={kind:v,simpleName:"FailureInfo",interfaces:[]},Cr.$metadata$={kind:b,simpleName:"FailureHandler",interfaces:[]};var Tr=null;function Or(){return null===Tr&&new Cr,Tr}function Nr(t,n,i,r){var o,a,s,l,u,p,h;jr(),this.dataAndCoordinates=null,this.mappings=null;var _,f,d,m=(d=i,function(t){var e,n,i;switch(t){case"map":if(null==(e=Al(d,[ga().GEO_POSITIONS])))throw z("require 'map' parameter".toString());i=e;break;case"data":if(null==(n=Al(d,[sa().DATA])))throw z("require 'data' parameter".toString());i=n;break;default:throw z(("Unknown gdf location: "+t).toString())}var r=i;return V.DataFrameUtil.fromMap_bkhwtg$(r)}),y=Tl(i,[Jo().MAP_DATA_META,Ho().GDF,Ho().GEOMETRY])&&!Tl(i,[_a().MAP_JOIN])&&!n.isEmpty;if(y&&(y=!r.isEmpty()),y){if(!Tl(i,[ga().GEO_POSITIONS]))throw N("'map' parameter is mandatory with MAP_DATA_META".toString());throw z(jr().MAP_JOIN_REQUIRED_MESSAGE.toString())}if(Tl(i,[Jo().MAP_DATA_META,Ho().GDF,Ho().GEOMETRY])&&Tl(i,[_a().MAP_JOIN])){if(!Tl(i,[ga().GEO_POSITIONS]))throw N("'map' parameter is mandatory with MAP_DATA_META".toString());if(null==(o=Ll(i,[_a().MAP_JOIN])))throw z("require map_join parameter".toString());var $=o;s=e.isType(a=$.get_za3lpa$(0),et)?a:c(),l=m(ga().GEO_POSITIONS),p=e.isType(u=$.get_za3lpa$(1),et)?u:c(),_=_r().join_h5afbe$(n,s,l,p),f=V.DataFrameUtil.findVariableOrFail_vede35$(_,jr().getGeometryColumn_gp9epa$(i,ga().GEO_POSITIONS))}else if(Tl(i,[Jo().MAP_DATA_META,Ho().GDF,Ho().GEOMETRY])&&!Tl(i,[_a().MAP_JOIN])){if(!Tl(i,[ga().GEO_POSITIONS]))throw N("'map' parameter is mandatory with MAP_DATA_META".toString());_=m(ga().GEO_POSITIONS),f=V.DataFrameUtil.findVariableOrFail_vede35$(_,jr().getGeometryColumn_gp9epa$(i,ga().GEO_POSITIONS))}else{if(!Tl(i,[Jo().DATA_META,Ho().GDF,Ho().GEOMETRY])||Tl(i,[ga().GEO_POSITIONS])||Tl(i,[_a().MAP_JOIN]))throw z("GeoDataFrame not found in data or map".toString());if(!Tl(i,[sa().DATA]))throw N("'data' parameter is mandatory with DATA_META".toString());_=n,f=V.DataFrameUtil.findVariableOrFail_vede35$(_,jr().getGeometryColumn_gp9epa$(i,sa().DATA))}switch(t.name){case"MAP":case"POLYGON":h=new qr(_,f);break;case"LIVE_MAP":case"POINT":case"TEXT":h=new Ur(_,f);break;case"RECT":h=new Gr(_,f);break;case"PATH":h=new Fr(_,f);break;default:throw z(("Unsupported geom: "+t).toString())}var v=h;this.dataAndCoordinates=v.buildDataFrame(),this.mappings=_r().createAesMapping_5bl3vv$(this.dataAndCoordinates,gt(r,v.mappings))}function Pr(){Ar=this,this.GEO_ID="__geo_id__",this.POINT_X="lon",this.POINT_Y="lat",this.RECT_XMIN="lonmin",this.RECT_YMIN="latmin",this.RECT_XMAX="lonmax",this.RECT_YMAX="latmax",this.MAP_JOIN_REQUIRED_MESSAGE="map_join is required when both data and map parameters used"}Pr.prototype.isApplicable_t8fn1w$=function(t,n){var i,r=n.keys,o=d();for(i=r.iterator();i.hasNext();){var a,s;null!=(a="string"==typeof(s=i.next())?s:null)&&o.add_11rb$(a)}var l,u=d();for(l=o.iterator();l.hasNext();){var p,h,_=l.next();try{h=new ee(Fs().toAes_61zpoe$(_))}catch(t){if(!e.isType(t,ne))throw t;h=new ee(ie(t))}var f,m=h;null!=(p=m.isFailure?null:null==(f=m.value)||e.isType(f,re)?f:c())&&u.add_11rb$(p)}var y,$=pt("isPositional",function(t,e){return t.isPositional_896ixz$(e)}.bind(null,Dt.Companion));t:do{var v;if(e.isType(u,oe)&&u.isEmpty()){y=!1;break t}for(v=u.iterator();v.hasNext();)if($(v.next())){y=!0;break t}y=!1}while(0);return!y&&(Tl(t,[Jo().MAP_DATA_META,Ho().GDF,Ho().GEOMETRY])||Tl(t,[Jo().DATA_META,Ho().GDF,Ho().GEOMETRY]))},Pr.prototype.isGeoDataframe_gp9epa$=function(t,e){return Tl(t,[this.toDataMetaKey_0(e),Ho().GDF,Ho().GEOMETRY])},Pr.prototype.getGeometryColumn_gp9epa$=function(t,e){var n;if(null==(n=Nl(t,[this.toDataMetaKey_0(e),Ho().GDF,Ho().GEOMETRY])))throw z("Geometry column not set".toString());return n},Pr.prototype.toDataMetaKey_0=function(t){switch(t){case"map":return Jo().MAP_DATA_META;case"data":return Jo().DATA_META;default:throw z(("Unknown gdf role: '"+t+"'. Expected: '"+ga().GEO_POSITIONS+"' or '"+sa().DATA+"'").toString())}},Pr.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Ar=null;function jr(){return null===Ar&&new Pr,Ar}function Lr(t,e,n){Vr(),this.dataFrame_0=t,this.geometries_0=e,this.mappings=n,this.dupCounter_0=d();var i,r=this.mappings.values,o=xt(wt(x(r,10)),16),a=kt(o);for(i=r.iterator();i.hasNext();){var s=i.next();a.put_xwzc9p$(s,d())}this.coordinates_0=a}function Rr(t){return y}function Ir(t){return y}function zr(t){return y}function Dr(t){return y}function Mr(t){return y}function Br(t){return y}function Ur(t,e){var n;Lr.call(this,t,e,Vr().POINT_COLUMNS),this.supportedFeatures_njr4m6$_0=_("Point, MultiPoint"),this.geoJsonConsumer_4woj0e$_0=this.defaultConsumer_5s5pfw$((n=this,function(t){return t.onPoint=function(t){return function(e){return Vr().append_ad8zgy$(t.coordinates_0,e),y}}(n),t.onMultiPoint=function(t){return function(e){var n;for(n=e.iterator();n.hasNext();){var i=n.next(),r=t;Vr().append_ad8zgy$(r.coordinates_0,i)}return y}}(n),y}))}function Fr(t,e){var n;Lr.call(this,t,e,Vr().POINT_COLUMNS),this.supportedFeatures_ozgutd$_0=_("LineString, MultiLineString"),this.geoJsonConsumer_idjvc5$_0=this.defaultConsumer_5s5pfw$((n=this,function(t){return t.onLineString=function(t){return function(e){var n;for(n=e.iterator();n.hasNext();){var i=n.next(),r=t;Vr().append_ad8zgy$(r.coordinates_0,i)}return y}}(n),t.onMultiLineString=function(t){return function(e){var n;for(n=Gt(qt(e)).iterator();n.hasNext();){var i=n.next(),r=t;Vr().append_ad8zgy$(r.coordinates_0,i)}return y}}(n),y}))}function qr(t,e){var n;Lr.call(this,t,e,Vr().POINT_COLUMNS),this.supportedFeatures_d0rxnq$_0=_("Polygon, MultiPolygon"),this.geoJsonConsumer_noor7u$_0=this.defaultConsumer_5s5pfw$((n=this,function(t){return t.onPolygon=function(t){return function(e){var n;for(n=Gt(qt(e)).iterator();n.hasNext();){var i=n.next(),r=t;Vr().append_ad8zgy$(r.coordinates_0,i)}return y}}(n),t.onMultiPolygon=function(t){return function(e){var n;for(n=Gt(Gt(qt(e))).iterator();n.hasNext();){var i=n.next(),r=t;Vr().append_ad8zgy$(r.coordinates_0,i)}return y}}(n),y}))}function Gr(t,e){var n;Lr.call(this,t,e,Vr().RECT_MAPPINGS),this.supportedFeatures_bieyrp$_0=_("MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon"),this.geoJsonConsumer_w3z015$_0=this.defaultConsumer_5s5pfw$((n=this,function(t){var e,i=function(t){return function(e){var n;for(n=Yt(pt("union",function(t,e){return Ht(t,e)}.bind(null,Mt.BBOX_CALCULATOR))(e)).splitByAntiMeridian().iterator();n.hasNext();){var i=n.next(),r=t;Vr().append_4y8q68$(r.coordinates_0,i)}}}(n),r=(e=i,function(t){e(_(t))});return t.onMultiPoint=function(t){return function(e){return t(Vt(e)),y}}(r),t.onLineString=function(t){return function(e){return t(Vt(e)),y}}(r),t.onMultiLineString=function(t){return function(e){return t(Vt(_t(e))),y}}(r),t.onPolygon=function(t){return function(e){return t(Kt(e)),y}}(r),t.onMultiPolygon=function(t){return function(e){return t(Wt(e)),y}}(i),y}))}function Hr(){Yr=this,this.POINT_COLUMNS=te([ct(Dt.Companion.X.name,jr().POINT_X),ct(Dt.Companion.Y.name,jr().POINT_Y)]),this.RECT_MAPPINGS=te([ct(Dt.Companion.XMIN.name,jr().RECT_XMIN),ct(Dt.Companion.YMIN.name,jr().RECT_YMIN),ct(Dt.Companion.XMAX.name,jr().RECT_XMAX),ct(Dt.Companion.YMAX.name,jr().RECT_YMAX)])}Nr.$metadata$={kind:v,simpleName:"GeoConfig",interfaces:[]},Lr.prototype.duplicate_0=function(t,e){var n,i,r=k(x(e,10)),o=0;for(n=e.iterator();n.hasNext();){for(var a=n.next(),s=r.add_11rb$,l=ot((o=(i=o)+1|0,i)),u=k(a),c=0;c=2)){var n=t+" requires a list of 2 but was "+e.size;throw N(n.toString())}return new D(e.get_za3lpa$(0),e.get_za3lpa$(1))},yl.prototype.getNumList_61zpoe$=function(t){var n;return e.isType(n=this.getNumList_q98glf$_0(t,gl),et)?n:c()},yl.prototype.getNumQList_61zpoe$=function(t){return this.getNumList_q98glf$_0(t,bl)},yl.prototype.getNumber_p2oh8l$_0=function(t){var n;if(null==(n=this.get_61zpoe$(t)))return null;var i=n;if(!e.isNumber(i)){var r="Parameter '"+t+"' expected to be a Number, but was "+f(e.getKClassFromExpression(i).simpleName);throw N(r.toString())}return i},yl.prototype.getNumList_q98glf$_0=function(t,n){var i,r,o=this.getList_61zpoe$(t);return El().requireAll_0(o,n,(r=t,function(t){return r+" requires a list of numbers but not numeric encountered: "+f(t)})),e.isType(i=o,et)?i:c()},yl.prototype.getAsList_61zpoe$=function(t){var n,i=null!=(n=this.get_61zpoe$(t))?n:ut();return e.isType(i,et)?i:_(i)},yl.prototype.getAsStringList_61zpoe$=function(t){var e,n=Z(this.getAsList_61zpoe$(t)),i=k(x(n,10));for(e=n.iterator();e.hasNext();){var r=e.next();i.add_11rb$(r.toString())}return i},yl.prototype.getStringList_61zpoe$=function(t){var n,i,r=this.getList_61zpoe$(t);return El().requireAll_0(r,wl,(i=t,function(t){return i+" requires a list of strings but not string encountered: "+f(t)})),e.isType(n=r,et)?n:c()},yl.prototype.getRange_y4putb$=function(t){if(!this.has_61zpoe$(t))throw N("'Range' value is expected in form: [min, max]".toString());var e=this.getRangeOrNull_61zpoe$(t);if(null==e){var n="'range' value is expected in form: [min, max] but was: "+f(this.get_61zpoe$(t));throw N(n.toString())}return e},yl.prototype.getRangeOrNull_61zpoe$=function(t){var n,i,r,o=this.get_61zpoe$(t),a=e.isType(o,et)&&2===o.size;if(a){var s;t:do{var l;if(e.isType(o,oe)&&o.isEmpty()){s=!0;break t}for(l=o.iterator();l.hasNext();){var u=l.next();if(!e.isNumber(u)){s=!1;break t}}s=!0}while(0);a=s}if(!0!==a)return null;var p=nt(e.isNumber(n=Fe(o))?n:c()),h=nt(e.isNumber(i=Qe(o))?i:c());try{r=new tn(p,h)}catch(t){if(!e.isType(t,ne))throw t;r=null}return r},yl.prototype.getMap_61zpoe$=function(t){var n,i;if(null==(n=this.get_61zpoe$(t)))return tt();var r=n;if(!e.isType(r,A)){var o="Not a Map: "+t+": "+e.getKClassFromExpression(r).simpleName;throw N(o.toString())}return e.isType(i=r,A)?i:c()},yl.prototype.getBoolean_ivxn3r$=function(t,e){var n,i;return void 0===e&&(e=!1),null!=(i="boolean"==typeof(n=this.get_61zpoe$(t))?n:null)?i:e},yl.prototype.getDouble_61zpoe$=function(t){var e;return null!=(e=this.getNumber_p2oh8l$_0(t))?nt(e):null},yl.prototype.getInteger_61zpoe$=function(t){var e;return null!=(e=this.getNumber_p2oh8l$_0(t))?C(e):null},yl.prototype.getLong_61zpoe$=function(t){var e;return null!=(e=this.getNumber_p2oh8l$_0(t))?en(e):null},yl.prototype.getDoubleDef_io5o9c$=function(t,e){var n;return null!=(n=this.getDouble_61zpoe$(t))?n:e},yl.prototype.getIntegerDef_bm4lxs$=function(t,e){var n;return null!=(n=this.getInteger_61zpoe$(t))?n:e},yl.prototype.getLongDef_4wgjuj$=function(t,e){var n;return null!=(n=this.getLong_61zpoe$(t))?n:e},yl.prototype.getValueOrNull_qu2sip$_0=function(t,e){var n;return null==(n=this.get_61zpoe$(t))?null:e(n)},yl.prototype.getColor_61zpoe$=function(t){return this.getValue_1va84n$(Dt.Companion.COLOR,t)},yl.prototype.getShape_61zpoe$=function(t){return this.getValue_1va84n$(Dt.Companion.SHAPE,t)},yl.prototype.getValue_1va84n$=function(t,e){var n;if(null==(n=this.get_61zpoe$(e)))return null;var i=n;return rc().apply_kqseza$(t,i)},xl.prototype.over_x7u0o8$=function(t){return new yl(t)},xl.prototype.requireAll_0=function(t,e,n){var i,r,o=d();for(r=t.iterator();r.hasNext();){var a=r.next();e(a)||o.add_11rb$(a)}if(null!=(i=nn(o))){var s=n(i);throw N(s.toString())}},xl.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var kl=null;function El(){return null===kl&&new xl,kl}function Cl(t,e){return Sl(t,rn(e,1),on(e))}function Sl(t,e,n){var i;return null!=(i=jl(t,e))?i.get_11rb$(n):null}function Tl(t,e){return Ol(t,rn(e,1),on(e))}function Ol(t,e,n){var i,r;return null!=(r=null!=(i=jl(t,e))?i.containsKey_11rb$(n):null)&&r}function Nl(t,e){return Pl(t,rn(e,1),on(e))}function Pl(t,e,n){var i,r;return"string"==typeof(r=null!=(i=jl(t,e))?i.get_11rb$(n):null)?r:null}function Al(t,e){var n;return null!=(n=jl(t,an(e)))?zl(n):null}function jl(t,n){var i,r,o=t;for(r=n.iterator();r.hasNext();){var a,s=r.next(),l=o;t:do{var u,c,p;if(null==(c=null!=(u=null!=l?Cl(l,[s]):null)&&e.isType(p=u,A)?p:null)){a=null;break t}a=c}while(0);o=a}return null!=(i=o)?zl(i):null}function Ll(t,e){return Rl(t,rn(e,1),on(e))}function Rl(t,n,i){var r,o;return e.isType(o=null!=(r=jl(t,n))?r.get_11rb$(i):null,et)?o:null}function Il(t,n){var i,r,o;if(null!=(i=Ll(t,n.slice()))){var a,s=d();for(a=i.iterator();a.hasNext();){var l,u,c=a.next();null!=(l=e.isType(u=c,A)?u:null)&&s.add_11rb$(l)}o=s}else o=null;return null!=(r=o)?Nt(r):null}function zl(t){var n;return e.isType(n=t,A)?n:c()}function Dl(t){var e,n;Ul(),yl.call(this,t,Ul().DEF_OPTIONS_0),this.layerConfigs=null,this.facets=null,this.scaleMap=null,this.scaleConfigs=null,this.sharedData_n7yy0l$_0=null;var i=xr().createDataFrame_dgfi6i$(this,Y.Companion.emptyFrame(),ht(),tt(),this.isClientSide),r=i.component1(),o=i.component2();this.sharedData=o,this.isClientSide||this.update_bm4g0d$(sa().MAPPING,r),this.layerConfigs=this.createLayerConfigs_usvduj$_0(this.sharedData);var a=!this.isClientSide;this.scaleConfigs=this.createScaleConfigs_9ma18$(ft(this.getList_61zpoe$(ca().SCALES),xr().createScaleSpecs_x7u0o8$(t)));var s=Ql().createScaleProviders_4llv70$(this.layerConfigs,this.scaleConfigs,a),l=Ql().createTransforms_9cm35a$(this.layerConfigs,s,a);if(this.scaleMap=Ql().createScales_a30s6a$(this.layerConfigs,l,s,a),this.has_61zpoe$(ca().FACET)){var u=new Er(this.getMap_61zpoe$(ca().FACET)),c=d();for(e=this.layerConfigs.iterator();e.hasNext();){var p=e.next();c.add_11rb$(p.combinedData)}n=u.createFacets_wcy4lu$(c)}else n=P.Companion.undefined();this.facets=n}function Ml(){Bl=this,this.ERROR_MESSAGE_0="__error_message",this.DEF_OPTIONS_0=ye(ct(ca().COORD,hl().CARTESIAN)),this.PLOT_COMPUTATION_MESSAGES_8be2vx$="computation_messages"}yl.$metadata$={kind:v,simpleName:"OptionsAccessor",interfaces:[]},Object.defineProperty(Dl.prototype,"sharedData",{configurable:!0,get:function(){return this.sharedData_n7yy0l$_0},set:function(t){this.sharedData_n7yy0l$_0=t}}),Object.defineProperty(Dl.prototype,"title",{configurable:!0,get:function(){var t;return null==(t=this.getMap_61zpoe$(ca().TITLE).get_11rb$(ca().TITLE_TEXT))||"string"==typeof t?t:c()}}),Object.defineProperty(Dl.prototype,"isClientSide",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Dl.prototype,"containsLiveMap",{configurable:!0,get:function(){var t,n=this.layerConfigs,i=De("isLiveMap",1,(function(t){return t.isLiveMap}));t:do{var r;if(e.isType(n,oe)&&n.isEmpty()){t=!1;break t}for(r=n.iterator();r.hasNext();)if(i(r.next())){t=!0;break t}t=!1}while(0);return t}}),Dl.prototype.createScaleConfigs_9ma18$=function(t){var n,i,r,o=X();for(n=t.iterator();n.hasNext();){var a=n.next(),s=e.isType(i=a,A)?i:c(),l=Ou().aesOrFail_x7u0o8$(s);if(!o.containsKey_11rb$(l)){var u=X();o.put_xwzc9p$(l,u)}L(o.get_11rb$(l)).putAll_a2k3zr$(s)}var p=d();for(r=o.values.iterator();r.hasNext();){var h=r.next();p.add_11rb$(new _u(h))}return p},Dl.prototype.createLayerConfigs_usvduj$_0=function(t){var n,i=d();for(n=this.getList_61zpoe$(ca().LAYERS).iterator();n.hasNext();){var r=n.next();if(!e.isType(r,A)){var o="Layer options: expected Map but was "+f(e.getKClassFromExpression(L(r)).simpleName);throw N(o.toString())}e.isType(r,A)||c();var a=this.createLayerConfig_ookg2q$(r,t,this.getMap_61zpoe$(sa().MAPPING),xr().getAsDiscreteAesSet_bkhwtg$(this.getMap_61zpoe$(Jo().DATA_META)),xr().getOrderOptions_tjia25$(this.mergedOptions,this.getMap_61zpoe$(sa().MAPPING)));i.add_11rb$(a)}return i},Dl.prototype.replaceSharedData_dhhkv7$=function(t){if(this.isClientSide)throw z("Check failed.".toString());this.sharedData=t,this.update_bm4g0d$(sa().DATA,V.DataFrameUtil.toMap_dhhkv7$(t))},Ml.prototype.failure_61zpoe$=function(t){return ye(ct(this.ERROR_MESSAGE_0,t))},Ml.prototype.assertPlotSpecOrErrorMessage_x7u0o8$=function(t){if(!(this.isFailure_x7u0o8$(t)||this.isPlotSpec_bkhwtg$(t)||this.isGGBunchSpec_bkhwtg$(t)))throw N("Invalid root feature kind: absent or unsupported `kind` key")},Ml.prototype.assertPlotSpec_x7u0o8$=function(t){if(!this.isPlotSpec_bkhwtg$(t)&&!this.isGGBunchSpec_bkhwtg$(t))throw N("Invalid root feature kind: absent or unsupported `kind` key")},Ml.prototype.isFailure_x7u0o8$=function(t){return t.containsKey_11rb$(this.ERROR_MESSAGE_0)},Ml.prototype.getErrorMessage_x7u0o8$=function(t){return f(t.get_11rb$(this.ERROR_MESSAGE_0))},Ml.prototype.isPlotSpec_bkhwtg$=function(t){return H(Bo().PLOT,this.specKind_bkhwtg$(t))},Ml.prototype.isGGBunchSpec_bkhwtg$=function(t){return H(Bo().GG_BUNCH,this.specKind_bkhwtg$(t))},Ml.prototype.specKind_bkhwtg$=function(t){var n,i=Jo().KIND;return(e.isType(n=t,A)?n:c()).get_11rb$(i)},Ml.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Bl=null;function Ul(){return null===Bl&&new Ml,Bl}function Fl(t){var n,i;Hl(),Dl.call(this,t),this.theme_8be2vx$=new Lc(this.getMap_61zpoe$(ca().THEME)).theme,this.coordProvider_8be2vx$=null,this.guideOptionsMap_8be2vx$=null;var r=yr().create_za3rmp$(L(this.get_61zpoe$(ca().COORD))).coord;if(!this.hasOwn_61zpoe$(ca().COORD))for(n=this.layerConfigs.iterator();n.hasNext();){var o=n.next(),a=e.isType(i=o.geomProto,ro)?i:c();a.hasPreferredCoordinateSystem()&&(r=a.preferredCoordinateSystem())}this.coordProvider_8be2vx$=r,this.guideOptionsMap_8be2vx$=gt(Kl().createGuideOptionsMap_v6zdyz$(this.scaleConfigs),Kl().createGuideOptionsMap_e6mjjf$(this.getMap_61zpoe$(ca().GUIDES)))}function ql(){Gl=this}Dl.$metadata$={kind:v,simpleName:"PlotConfig",interfaces:[yl]},Object.defineProperty(Fl.prototype,"isClientSide",{configurable:!0,get:function(){return!0}}),Fl.prototype.createLayerConfig_ookg2q$=function(t,e,n,i,r){var o,a="string"==typeof(o=t.get_11rb$(_a().GEOM))?o:c();return new wo(t,e,n,i,r,new ro(ul().toGeomKind_61zpoe$(a)),!0)},ql.prototype.processTransform_2wxo1b$=function(t){var e=t,n=Ul().isGGBunchSpec_bkhwtg$(e);return e=ip().builderForRawSpec().build().apply_i49brq$(e),ip().builderForRawSpec().change_t6n62v$(Sp().specSelector_6taknv$(n),new kp).build().apply_i49brq$(e)},ql.prototype.create_vb0rb2$=function(t,e){var n=Ql().findComputationMessages_x7u0o8$(t);return n.isEmpty()||e(n),new Fl(t)},ql.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Gl=null;function Hl(){return null===Gl&&new ql,Gl}function Yl(){Vl=this}Fl.$metadata$={kind:v,simpleName:"PlotConfigClientSide",interfaces:[Dl]},Yl.prototype.createGuideOptionsMap_v6zdyz$=function(t){var e,n=X();for(e=t.iterator();e.hasNext();){var i=e.next();if(i.hasGuideOptions()){var r=i.getGuideOptions().createGuideOptions(),o=i.aes;n.put_xwzc9p$(o,r)}}return n},Yl.prototype.createGuideOptionsMap_e6mjjf$=function(t){var e,n=X();for(e=t.entries.iterator();e.hasNext();){var i=e.next(),r=i.key,o=i.value,a=Fs().toAes_61zpoe$(r),s=go().create_za3rmp$(o).createGuideOptions();n.put_xwzc9p$(a,s)}return n},Yl.prototype.createPlotAssembler_6u1zvq$=function(t){var e=this.buildPlotLayers_0(t),n=sn.Companion.multiTile_bm7ueq$(t.scaleMap,e,t.coordProvider_8be2vx$,t.theme_8be2vx$);return n.setTitle_pdl1vj$(t.title),n.setGuideOptionsMap_qayxze$(t.guideOptionsMap_8be2vx$),n.facets=t.facets,n},Yl.prototype.buildPlotLayers_0=function(t){var n,i,r=d();for(n=t.layerConfigs.iterator();n.hasNext();){var o=n.next().combinedData;r.add_11rb$(o)}var a=Ql().toLayersDataByTile_rxbkhd$(r,t.facets),s=d(),l=d();for(i=a.iterator();i.hasNext();){var u,c=i.next(),p=d(),h=c.size>1,_=t.layerConfigs;t:do{var f;if(e.isType(_,oe)&&_.isEmpty()){u=!1;break t}for(f=_.iterator();f.hasNext();)if(f.next().geomProto.geomKind===se.LIVE_MAP){u=!0;break t}u=!1}while(0);for(var m=u,y=0;y!==c.size;++y){if(!(s.size>=y))throw z("Check failed.".toString());if(s.size===y){var $=t.layerConfigs.get_za3lpa$(y),v=Zr().configGeomTargets_hra3pl$($,t.scaleMap,h,m,t.theme_8be2vx$);s.add_11rb$(this.createLayerBuilder_0($,v))}var g=c.get_za3lpa$(y),b=s.get_za3lpa$(y).build_fhj1j$(g,t.scaleMap);p.add_11rb$(b)}l.add_11rb$(p)}return l},Yl.prototype.createLayerBuilder_0=function(t,n){var i,r,o,a,s=(e.isType(i=t.geomProto,ro)?i:c()).geomProvider_opf53k$(t),l=t.stat,u=(new ln).stat_qbwusa$(l).geom_9dfz59$(s).pos_r08v3h$(t.posProvider),p=t.constantsMap;for(r=p.keys.iterator();r.hasNext();){var h=r.next();u.addConstantAes_bbdhip$(e.isType(o=h,Dt)?o:c(),L(p.get_11rb$(h)))}for(t.hasExplicitGrouping()&&u.groupingVarName_61zpoe$(L(t.explicitGroupingVarName)),null!=V.DataFrameUtil.variables_dhhkv7$(t.combinedData).get_11rb$(jr().GEO_ID)&&u.pathIdVarName_61zpoe$(jr().GEO_ID),a=t.varBindings.iterator();a.hasNext();){var _=a.next();u.addBinding_14cn14$(_)}return u.disableLegend_6taknv$(t.isLegendDisabled),u.locatorLookupSpec_271kgc$(n.createLookupSpec()).contextualMappingProvider_td8fxc$(n),u},Yl.$metadata$={kind:b,simpleName:"PlotConfigClientSideUtil",interfaces:[]};var Vl=null;function Kl(){return null===Vl&&new Yl,Vl}function Wl(){Jl=this}function Xl(t){var e;return"string"==typeof(e=t)?e:c()}function Zl(t,e){return function(n,i){var r,o;if(i){var a=Ct(),s=Ct();for(r=n.iterator();r.hasNext();){var l=r.next(),u=fn(t,l);a.addAll_brywnq$(u.domainValues),s.addAll_brywnq$(u.domainLimits)}o=new dn(a,Nt(s))}else o=n.isEmpty()?mn.Transforms.IDENTITY:fn(e,Fe(n));return o}}Wl.prototype.toLayersDataByTile_rxbkhd$=function(t,e){var n,i;if(e.isDefined){for(var r=e.numTiles,o=k(r),a=0;a1&&(H(t,Dt.Companion.X)||H(t,Dt.Companion.Y))?t.name:S(a)}else e=t.name;return e}),D=X();for(a=vt(d,pn([Dt.Companion.X,Dt.Companion.Y])).iterator();a.hasNext();){var M=a.next(),B=z(M),U=fn(i,M),F=fn(n,M);if(e.isType(F,dn))s=U.createScale_4d40sm$(B,F.domainValues);else if(I.containsKey_11rb$(M)){var q=fn(I,M);s=U.createScale_phlls$(B,q)}else s=U.createScale_phlls$(B,tn.Companion.singleton_f1zjgi$(0));var G=s;D.put_xwzc9p$(M,G)}return new $n(D)},Wl.prototype.computeContinuousDomain_0=function(t,e,n){var i;if(n.hasDomainLimits()){var r,o=t.getNumeric_8xm3sj$(e),a=d();for(r=o.iterator();r.hasNext();){var s=r.next();n.isInDomain_yrwdxb$(s)&&a.add_11rb$(s)}var l=a;i=je.SeriesUtil.range_l63ks6$(l)}else i=t.range_8xm3sj$(e);return i},Wl.prototype.isDiscreteScaleForEmptyData_0=function(t){var n,i;if(t.discreteDomain)return!0;var r=t.mapperProvider;if(e.isType(r,vn))return!0;if(e.isType(r,gn))return!1;var o,a=t.breaks,s=t.limits;if(null!=a){var l;t:do{var u;if(e.isType(a,oe)&&a.isEmpty()){l=!1;break t}for(u=a.iterator();u.hasNext();){var c=u.next();if(!e.isNumber(c)){l=!0;break t}}l=!1}while(0);o=l}else o=null;var p,h=null!=(n=o)&&n;if(null!=s){var _;if(s.size>2)_=!0;else{var f,d=Z(s);t:do{var m;if(e.isType(d,oe)&&d.isEmpty()){f=!1;break t}for(m=d.iterator();m.hasNext();){var y=m.next();if(!e.isNumber(y)){f=!0;break t}}f=!1}while(0);_=f}p=_}else p=null;var $=null!=(i=p)&&i;return h||$},Wl.$metadata$={kind:b,simpleName:"PlotConfigUtil",interfaces:[]};var Jl=null;function Ql(){return null===Jl&&new Wl,Jl}function tu(t,e){iu(),yl.call(this,e),this.pos=au().createPosProvider_d0u64m$(t,this.mergedOptions)}function eu(){nu=this}eu.prototype.create_za3rmp$=function(t){var n;if(e.isType(t,A)){var i=bn(e.isType(n=t,A)?n:c());return this.createForName_0(_r().featureName_bkhwtg$(i),i)}return this.createForName_0(t.toString(),X())},eu.prototype.createForName_0=function(t,e){return new tu(t,e)},eu.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var nu=null;function iu(){return null===nu&&new eu,nu}function ru(){ou=this,this.IDENTITY_0="identity",this.STACK_8be2vx$="stack",this.DODGE_0="dodge",this.FILL_0="fill",this.NUDGE_0="nudge",this.JITTER_0="jitter",this.JITTER_DODGE_0="jitterdodge",this.DODGE_WIDTH_0="width",this.JITTER_WIDTH_0="width",this.JITTER_HEIGHT_0="height",this.NUDGE_WIDTH_0="x",this.NUDGE_HEIGHT_0="y",this.JD_DODGE_WIDTH_0="dodge_width",this.JD_JITTER_WIDTH_0="jitter_width",this.JD_JITTER_HEIGHT_0="jitter_height"}tu.$metadata$={kind:v,simpleName:"PosConfig",interfaces:[yl]},ru.prototype.createPosProvider_d0u64m$=function(t,e){var n,i=new yl(e);switch(t){case"identity":n=de.Companion.wrap_dkjclg$(me.PositionAdjustments.identity());break;case"stack":n=de.Companion.barStack();break;case"dodge":n=de.Companion.dodge_yrwdxb$(i.getDouble_61zpoe$(this.DODGE_WIDTH_0));break;case"fill":n=de.Companion.fill();break;case"jitter":n=de.Companion.jitter_jma9l8$(i.getDouble_61zpoe$(this.JITTER_WIDTH_0),i.getDouble_61zpoe$(this.JITTER_HEIGHT_0));break;case"nudge":n=de.Companion.nudge_jma9l8$(i.getDouble_61zpoe$(this.NUDGE_WIDTH_0),i.getDouble_61zpoe$(this.NUDGE_HEIGHT_0));break;case"jitterdodge":n=de.Companion.jitterDodge_xjrefz$(i.getDouble_61zpoe$(this.JD_DODGE_WIDTH_0),i.getDouble_61zpoe$(this.JD_JITTER_WIDTH_0),i.getDouble_61zpoe$(this.JD_JITTER_HEIGHT_0));break;default:throw N("Unknown position adjustments name: '"+t+"'")}return n},ru.$metadata$={kind:b,simpleName:"PosProto",interfaces:[]};var ou=null;function au(){return null===ou&&new ru,ou}function su(){lu=this}su.prototype.create_za3rmp$=function(t){var n,i;if(e.isType(t,u)&&_r().isFeatureList_511yu9$(t)){var r=_r().featuresInFeatureList_ui7x64$(e.isType(n=t,u)?n:c()),o=d();for(i=r.iterator();i.hasNext();){var a=i.next();o.add_11rb$(this.createOne_0(a))}return o}return _(this.createOne_0(t))},su.prototype.createOne_0=function(t){var n;if(e.isType(t,A))return hu().createSampling_d0u64m$(_r().featureName_bkhwtg$(t),e.isType(n=t,A)?n:c());if(H(il().NONE,t))return fe.Samplings.NONE;throw N("Incorrect sampling specification")},su.$metadata$={kind:b,simpleName:"SamplingConfig",interfaces:[]};var lu=null;function uu(){return null===lu&&new su,lu}function cu(){pu=this}cu.prototype.createSampling_d0u64m$=function(t,e){var n,i=El().over_x7u0o8$(e);switch(t){case"random":n=fe.Samplings.random_280ow0$(L(i.getInteger_61zpoe$(il().N)),i.getLong_61zpoe$(il().SEED));break;case"pick":n=fe.Samplings.pick_za3lpa$(L(i.getInteger_61zpoe$(il().N)));break;case"systematic":n=fe.Samplings.systematic_za3lpa$(L(i.getInteger_61zpoe$(il().N)));break;case"group_random":n=fe.Samplings.randomGroup_280ow0$(L(i.getInteger_61zpoe$(il().N)),i.getLong_61zpoe$(il().SEED));break;case"group_systematic":n=fe.Samplings.systematicGroup_za3lpa$(L(i.getInteger_61zpoe$(il().N)));break;case"random_stratified":n=fe.Samplings.randomStratified_vcwos1$(L(i.getInteger_61zpoe$(il().N)),i.getLong_61zpoe$(il().SEED),i.getInteger_61zpoe$(il().MIN_SUB_SAMPLE));break;case"vertex_vw":n=fe.Samplings.vertexVw_za3lpa$(L(i.getInteger_61zpoe$(il().N)));break;case"vertex_dp":n=fe.Samplings.vertexDp_za3lpa$(L(i.getInteger_61zpoe$(il().N)));break;default:throw N("Unknown sampling method: '"+t+"'")}return n},cu.$metadata$={kind:b,simpleName:"SamplingProto",interfaces:[]};var pu=null;function hu(){return null===pu&&new cu,pu}function _u(t){var n;Ou(),yl.call(this,t),this.aes=e.isType(n=Ou().aesOrFail_x7u0o8$(t),Dt)?n:c()}function fu(t){return"'"+t+"'"}function du(){Tu=this,this.IDENTITY_0="identity",this.COLOR_GRADIENT_0="color_gradient",this.COLOR_GRADIENT2_0="color_gradient2",this.COLOR_HUE_0="color_hue",this.COLOR_GREY_0="color_grey",this.COLOR_BREWER_0="color_brewer",this.SIZE_AREA_0="size_area"}_u.prototype.createScaleProvider=function(){return this.createScaleProviderBuilder_0().build()},_u.prototype.createScaleProviderBuilder_0=function(){var t,n,i,r,o,a,s,l,u,p,h,_,f=null,d=this.has_61zpoe$(Is().NA_VALUE)?L(this.getValue_1va84n$(this.aes,Is().NA_VALUE)):hn.DefaultNaValue.get_31786j$(this.aes);if(this.has_61zpoe$(Is().OUTPUT_VALUES)){var m=this.getList_61zpoe$(Is().OUTPUT_VALUES),y=rc().applyToList_s6xytz$(this.aes,m);f=hn.DefaultMapperProviderUtil.createWithDiscreteOutput_rath1t$(y,d)}if(H(this.aes,Dt.Companion.SHAPE)){var $=this.get_61zpoe$(Is().SHAPE_SOLID);"boolean"==typeof $&&H($,!1)&&(f=hn.DefaultMapperProviderUtil.createWithDiscreteOutput_rath1t$(wn.ShapeMapper.hollowShapes(),wn.ShapeMapper.NA_VALUE))}else H(this.aes,Dt.Companion.ALPHA)&&this.has_61zpoe$(Is().RANGE)?f=new xn(this.getRange_y4putb$(Is().RANGE),"number"==typeof(t=d)?t:c()):H(this.aes,Dt.Companion.SIZE)&&this.has_61zpoe$(Is().RANGE)&&(f=new kn(this.getRange_y4putb$(Is().RANGE),"number"==typeof(n=d)?n:c()));var v=this.getBoolean_ivxn3r$(Is().DISCRETE_DOMAIN),g=this.getBoolean_ivxn3r$(Is().DISCRETE_DOMAIN_REVERSE),b=null!=(i=this.getString_61zpoe$(Is().SCALE_MAPPER_KIND))?i:!this.has_61zpoe$(Is().OUTPUT_VALUES)&&v&&pn([Dt.Companion.FILL,Dt.Companion.COLOR]).contains_11rb$(this.aes)?Ou().COLOR_BREWER_0:null;if(null!=b)switch(b){case"identity":f=Ou().createIdentityMapperProvider_bbdhip$(this.aes,d);break;case"color_gradient":f=new Cn(this.getColor_61zpoe$(Is().LOW),this.getColor_61zpoe$(Is().HIGH),e.isType(r=d,En)?r:c());break;case"color_gradient2":f=new Sn(this.getColor_61zpoe$(Is().LOW),this.getColor_61zpoe$(Is().MID),this.getColor_61zpoe$(Is().HIGH),this.getDouble_61zpoe$(Is().MIDPOINT),e.isType(o=d,En)?o:c());break;case"color_hue":f=new Tn(this.getDoubleList_61zpoe$(Is().HUE_RANGE),this.getDouble_61zpoe$(Is().CHROMA),this.getDouble_61zpoe$(Is().LUMINANCE),this.getDouble_61zpoe$(Is().START_HUE),this.getDouble_61zpoe$(Is().DIRECTION),e.isType(a=d,En)?a:c());break;case"color_grey":f=new On(this.getDouble_61zpoe$(Is().START),this.getDouble_61zpoe$(Is().END),e.isType(s=d,En)?s:c());break;case"color_brewer":f=new Nn(this.getString_61zpoe$(Is().PALETTE_TYPE),this.get_61zpoe$(Is().PALETTE),this.getDouble_61zpoe$(Is().DIRECTION),e.isType(l=d,En)?l:c());break;case"size_area":f=new Pn(this.getDouble_61zpoe$(Is().MAX_SIZE),"number"==typeof(u=d)?u:c());break;default:throw N("Aes '"+this.aes.name+"' - unexpected scale mapper kind: '"+b+"'")}var w=new An(this.aes);if(null!=f&&w.mapperProvider_dw300d$(e.isType(p=f,jn)?p:c()),w.discreteDomain_6taknv$(v),w.discreteDomainReverse_6taknv$(g),this.getBoolean_ivxn3r$(Is().DATE_TIME)){var x=null!=(h=this.getString_61zpoe$(Is().FORMAT))?Ln.Formatter.time_61zpoe$(h):null;w.breaksGenerator_6q5k0b$(new Rn(x))}else if(!v&&this.has_61zpoe$(Is().CONTINUOUS_TRANSFORM)){var k=this.getStringSafe_61zpoe$(Is().CONTINUOUS_TRANSFORM);switch(k.toLowerCase()){case"identity":_=mn.Transforms.IDENTITY;break;case"log10":_=mn.Transforms.LOG10;break;case"reverse":_=mn.Transforms.REVERSE;break;case"sqrt":_=mn.Transforms.SQRT;break;default:throw N("Unknown transform name: '"+k+"'. Supported: "+S(le([dl().IDENTITY,dl().LOG10,dl().REVERSE,dl().SQRT]),void 0,void 0,void 0,void 0,void 0,fu)+".")}var E=_;w.continuousTransform_gxz7zd$(E)}return this.applyCommons_0(w)},_u.prototype.applyCommons_0=function(t){var n,i;if(this.has_61zpoe$(Is().NAME)&&t.name_61zpoe$(L(this.getString_61zpoe$(Is().NAME))),this.has_61zpoe$(Is().BREAKS)){var r,o=this.getList_61zpoe$(Is().BREAKS),a=d();for(r=o.iterator();r.hasNext();){var s;null!=(s=r.next())&&a.add_11rb$(s)}t.breaks_pqjuzw$(a)}if(this.has_61zpoe$(Is().LABELS)?t.labels_mhpeer$(this.getStringList_61zpoe$(Is().LABELS)):t.labelFormat_pdl1vj$(this.getString_61zpoe$(Is().FORMAT)),this.has_61zpoe$(Is().EXPAND)){var l=this.getList_61zpoe$(Is().EXPAND);if(!l.isEmpty()){var u=e.isNumber(n=l.get_za3lpa$(0))?n:c();if(t.multiplicativeExpand_14dthe$(nt(u)),l.size>1){var p=e.isNumber(i=l.get_za3lpa$(1))?i:c();t.additiveExpand_14dthe$(nt(p))}}}return this.has_61zpoe$(Is().LIMITS)&&t.limits_9ma18$(this.getList_61zpoe$(Is().LIMITS)),t},_u.prototype.hasGuideOptions=function(){return this.has_61zpoe$(Is().GUIDE)},_u.prototype.getGuideOptions=function(){return go().create_za3rmp$(L(this.get_61zpoe$(Is().GUIDE)))},du.prototype.aesOrFail_x7u0o8$=function(t){var e=new yl(t);if(!e.has_61zpoe$(Is().AES))throw N("Required parameter 'aesthetic' is missing".toString());return Fs().toAes_61zpoe$(e.getStringSafe_61zpoe$(Is().AES))},du.prototype.createIdentityMapperProvider_bbdhip$=function(t,e){var n=rc().getConverter_31786j$(t),i=new In(n,e);if($c().contain_896ixz$(t)){var r=$c().get_31786j$(t);return new Dn(i,zn.Mappers.nullable_q9jsah$(r,e))}return i},du.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var mu,yu,$u,vu,gu,bu,wu,xu,ku,Eu,Cu,Su,Tu=null;function Ou(){return null===Tu&&new du,Tu}function Nu(t,e){Mn.call(this),this.name$=t,this.ordinal$=e}function Pu(){Pu=function(){},mu=new Nu("IDENTITY",0),yu=new Nu("COUNT",1),$u=new Nu("BIN",2),vu=new Nu("BIN2D",3),gu=new Nu("SMOOTH",4),bu=new Nu("CONTOUR",5),wu=new Nu("CONTOURF",6),xu=new Nu("BOXPLOT",7),ku=new Nu("DENSITY",8),Eu=new Nu("DENSITY2D",9),Cu=new Nu("DENSITY2DF",10),Su=new Nu("CORR",11),Yu()}function Au(){return Pu(),mu}function ju(){return Pu(),yu}function Lu(){return Pu(),$u}function Ru(){return Pu(),vu}function Iu(){return Pu(),gu}function zu(){return Pu(),bu}function Du(){return Pu(),wu}function Mu(){return Pu(),xu}function Bu(){return Pu(),ku}function Uu(){return Pu(),Eu}function Fu(){return Pu(),Cu}function qu(){return Pu(),Su}function Gu(){Hu=this,this.ENUM_INFO_0=new Un(Nu.values())}_u.$metadata$={kind:v,simpleName:"ScaleConfig",interfaces:[yl]},Gu.prototype.safeValueOf_61zpoe$=function(t){var e;if(null==(e=this.ENUM_INFO_0.safeValueOf_pdl1vj$(t)))throw N("Unknown stat name: '"+t+"'");return e},Gu.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Hu=null;function Yu(){return Pu(),null===Hu&&new Gu,Hu}function Vu(){Ku=this}Nu.$metadata$={kind:v,simpleName:"StatKind",interfaces:[Mn]},Nu.values=function(){return[Au(),ju(),Lu(),Ru(),Iu(),zu(),Du(),Mu(),Bu(),Uu(),Fu(),qu()]},Nu.valueOf_61zpoe$=function(t){switch(t){case"IDENTITY":return Au();case"COUNT":return ju();case"BIN":return Lu();case"BIN2D":return Ru();case"SMOOTH":return Iu();case"CONTOUR":return zu();case"CONTOURF":return Du();case"BOXPLOT":return Mu();case"DENSITY":return Bu();case"DENSITY2D":return Uu();case"DENSITY2DF":return Fu();case"CORR":return qu();default:Bn("No enum constant jetbrains.datalore.plot.config.StatKind."+t)}},Vu.prototype.defaultOptions_xssx85$=function(t,e){var n;if(H(Yu().safeValueOf_61zpoe$(t),qu()))switch(e.name){case"TILE":n=ye(ct("size",0));break;case"POINT":case"TEXT":n=te([ct("size",.8),ct("size_unit","x"),ct("label_format",".2f")]);break;default:n=tt()}else n=tt();return n},Vu.prototype.createStat_77pq5g$=function(t,e){switch(t.name){case"IDENTITY":return Re.Stats.IDENTITY;case"COUNT":return Re.Stats.count();case"BIN":return Re.Stats.bin_yyf5ez$(e.getIntegerDef_bm4lxs$(fs().BINS,30),e.getDouble_61zpoe$(fs().BINWIDTH),e.getDouble_61zpoe$(fs().CENTER),e.getDouble_61zpoe$(fs().BOUNDARY));case"BIN2D":var n=e.getNumPairDef_j0281h$(ys().BINS,new D(30,30)),i=n.component1(),r=n.component2(),o=e.getNumQPairDef_alde63$(ys().BINWIDTH,new D(Fn.Companion.DEF_BINWIDTH,Fn.Companion.DEF_BINWIDTH)),a=o.component1(),s=o.component2();return new Fn(C(i),C(r),null!=a?nt(a):null,null!=s?nt(s):null,e.getBoolean_ivxn3r$(ys().DROP,Fn.Companion.DEF_DROP));case"CONTOUR":return new qn(e.getIntegerDef_bm4lxs$(gs().BINS,10),e.getDouble_61zpoe$(gs().BINWIDTH));case"CONTOURF":return new Gn(e.getIntegerDef_bm4lxs$(gs().BINS,10),e.getDouble_61zpoe$(gs().BINWIDTH));case"SMOOTH":return this.configureSmoothStat_0(e);case"CORR":return this.configureCorrStat_0(e);case"BOXPLOT":return Re.Stats.boxplot_8555vt$(e.getDoubleDef_io5o9c$(ps().COEF,Hn.Companion.DEF_WHISKER_IQR_RATIO),e.getBoolean_ivxn3r$(ps().VARWIDTH,Hn.Companion.DEF_COMPUTE_WIDTH));case"DENSITY":return this.configureDensityStat_0(e);case"DENSITY2D":return this.configureDensity2dStat_0(e,!1);case"DENSITY2DF":return this.configureDensity2dStat_0(e,!0);default:throw N("Unknown stat: '"+t+"'")}},Vu.prototype.configureSmoothStat_0=function(t){var e,n;if(null!=(e=t.getString_61zpoe$(Cs().METHOD))){var i;t:do{switch(e.toLowerCase()){case"lm":i=Yn.LM;break t;case"loess":case"lowess":i=Yn.LOESS;break t;case"glm":i=Yn.GLM;break t;case"gam":i=Yn.GAM;break t;case"rlm":i=Yn.RLM;break t;default:throw N("Unsupported smoother method: '"+e+"'\nUse one of: lm, loess, lowess, glm, gam, rlm.")}}while(0);n=i}else n=null;var r=n;return new Vn(t.getIntegerDef_bm4lxs$(Cs().POINT_COUNT,80),null!=r?r:Vn.Companion.DEF_SMOOTHING_METHOD,t.getDoubleDef_io5o9c$(Cs().CONFIDENCE_LEVEL,Vn.Companion.DEF_CONFIDENCE_LEVEL),t.getBoolean_ivxn3r$(Cs().DISPLAY_CONFIDENCE_INTERVAL,Vn.Companion.DEF_DISPLAY_CONFIDENCE_INTERVAL),t.getDoubleDef_io5o9c$(Cs().SPAN,Vn.Companion.DEF_SPAN),t.getIntegerDef_bm4lxs$(Cs().POLYNOMIAL_DEGREE,1),t.getIntegerDef_bm4lxs$(Cs().LOESS_CRITICAL_SIZE,1e3),t.getLongDef_4wgjuj$(Cs().LOESS_CRITICAL_SIZE,Kn))},Vu.prototype.configureCorrStat_0=function(t){var e,n,i;if(null!=(e=t.getString_61zpoe$(xs().METHOD))){if(!H(e.toLowerCase(),"pearson"))throw N("Unsupported correlation method: '"+e+"'. Must be: 'pearson'");i=Wn.PEARSON}else i=null;var r,o=i;if(null!=(n=t.getString_61zpoe$(xs().TYPE))){var a;t:do{switch(n.toLowerCase()){case"full":a=Xn.FULL;break t;case"upper":a=Xn.UPPER;break t;case"lower":a=Xn.LOWER;break t;default:throw N("Unsupported matrix type: '"+n+"'. Expected: 'full', 'upper' or 'lower'.")}}while(0);r=a}else r=null;var s=r;return new Zn(null!=o?o:Zn.Companion.DEF_CORRELATION_METHOD,null!=s?s:Zn.Companion.DEF_TYPE,t.getBoolean_ivxn3r$(xs().FILL_DIAGONAL,Zn.Companion.DEF_FILL_DIAGONAL),t.getDoubleDef_io5o9c$(xs().THRESHOLD,Zn.Companion.DEF_THRESHOLD))},Vu.prototype.configureDensityStat_0=function(t){var n,i,r={v:null},o={v:Jn.Companion.DEF_BW};null!=(n=t.get_61zpoe$(Os().BAND_WIDTH))&&(e.isNumber(n)?r.v=nt(n):"string"==typeof n&&(o.v=Re.DensityStatUtil.toBandWidthMethod_61zpoe$(n)));var a=null!=(i=t.getString_61zpoe$(Os().KERNEL))?Re.DensityStatUtil.toKernel_61zpoe$(i):null;return new Jn(r.v,o.v,t.getDoubleDef_io5o9c$(Os().ADJUST,Jn.Companion.DEF_ADJUST),null!=a?a:Jn.Companion.DEF_KERNEL,t.getIntegerDef_bm4lxs$(Os().N,512),t.getIntegerDef_bm4lxs$(Os().FULL_SCAN_MAX,5e3))},Vu.prototype.configureDensity2dStat_0=function(t,n){var i,r,o,a,s,l,u,p,h,_={v:null},f={v:null},d={v:null};if(null!=(i=t.get_61zpoe$(As().BAND_WIDTH)))if(e.isNumber(i))_.v=nt(i),f.v=nt(i);else if("string"==typeof i)d.v=Re.DensityStatUtil.toBandWidthMethod_61zpoe$(i);else if(e.isType(i,et))for(var m=0,y=i.iterator();y.hasNext();++m){var $=y.next();switch(m){case 0:var v,g;v=null!=$?nt(e.isNumber(g=$)?g:c()):null,_.v=v;break;case 1:var b,w;b=null!=$?nt(e.isNumber(w=$)?w:c()):null,f.v=b}}var x=null!=(r=t.getString_61zpoe$(As().KERNEL))?Re.DensityStatUtil.toKernel_61zpoe$(r):null,k={v:null},E={v:null};if(null!=(o=t.get_61zpoe$(As().N)))if(e.isNumber(o))k.v=C(o),E.v=C(o);else if(e.isType(o,et))for(var S=0,T=o.iterator();T.hasNext();++S){var O=T.next();switch(S){case 0:var N,P;N=null!=O?C(e.isNumber(P=O)?P:c()):null,k.v=N;break;case 1:var A,j;A=null!=O?C(e.isNumber(j=O)?j:c()):null,E.v=A}}return n?new ti(_.v,f.v,null!=(a=d.v)?a:Qn.Companion.DEF_BW,t.getDoubleDef_io5o9c$(As().ADJUST,Qn.Companion.DEF_ADJUST),null!=x?x:Qn.Companion.DEF_KERNEL,null!=(s=k.v)?s:100,null!=(l=E.v)?l:100,t.getBoolean_ivxn3r$(As().IS_CONTOUR,Qn.Companion.DEF_CONTOUR),t.getIntegerDef_bm4lxs$(As().BINS,10),t.getDoubleDef_io5o9c$(As().BINWIDTH,Qn.Companion.DEF_BIN_WIDTH)):new ei(_.v,f.v,null!=(u=d.v)?u:Qn.Companion.DEF_BW,t.getDoubleDef_io5o9c$(As().ADJUST,Qn.Companion.DEF_ADJUST),null!=x?x:Qn.Companion.DEF_KERNEL,null!=(p=k.v)?p:100,null!=(h=E.v)?h:100,t.getBoolean_ivxn3r$(As().IS_CONTOUR,Qn.Companion.DEF_CONTOUR),t.getIntegerDef_bm4lxs$(As().BINS,10),t.getDoubleDef_io5o9c$(As().BINWIDTH,Qn.Companion.DEF_BIN_WIDTH))},Vu.$metadata$={kind:b,simpleName:"StatProto",interfaces:[]};var Ku=null;function Wu(){return null===Ku&&new Vu,Ku}function Xu(t,e,n,i){ec(),yl.call(this,t),this.constantsMap_0=e,this.groupingVarName_0=n,this.varBindings_0=i}function Zu(t,e,n,i){this.$outer=t,this.tooltipLines_0=e;var r,o=this.prepareFormats_0(n),a=kt(wt(o.size));for(r=o.entries.iterator();r.hasNext();){var s=r.next(),l=a.put_xwzc9p$,u=s.key,c=s.key,p=s.value;l.call(a,u,this.createValueSource_0(c.name,c.isAes,p))}var h,_=a,f=Et(),d=k(o.size);for(h=o.entries.iterator();h.hasNext();){var m=h.next(),$=d.add_11rb$,v=m.key,g=m.value,b=this.getAesValueSourceForVariable_0(v,g,_);f.putAll_a2k3zr$(b),$.call(d,y)}this.myValueSources_0=di(gt(_,f));var w,E=k(x(i,10));for(w=i.iterator();w.hasNext();){var C=w.next(),S=E.add_11rb$,T=this.getValueSource_1(this.varField_0(C));S.call(E,ri.Companion.defaultLineForValueSource_u47np3$(T))}this.myLinesForVariableList_0=E}function Ju(t,e){this.name=t,this.isAes=e}function Qu(){tc=this,this.AES_NAME_PREFIX_0="^",this.VARIABLE_NAME_PREFIX_0="@",this.LABEL_SEPARATOR_0="|",this.SOURCE_RE_PATTERN_0=j("(?:\\\\\\^|\\\\@)|(\\^\\w+)|@(([\\w^@]+)|(\\{(.*?)\\})|\\.{2}\\w+\\.{2})")}Xu.prototype.createTooltips=function(){return new Zu(this,this.has_61zpoe$(_a().TOOLTIP_LINES)?this.getStringList_61zpoe$(_a().TOOLTIP_LINES):null,this.getList_61zpoe$(_a().TOOLTIP_FORMATS),this.getStringList_61zpoe$(_a().TOOLTIP_VARIABLES)).parse_8be2vx$()},Zu.prototype.parse_8be2vx$=function(){var t,e;if(null!=(t=this.tooltipLines_0)){var n,i=pt("parseLine",function(t,e){return t.parseLine_0(e)}.bind(null,this)),r=k(x(t,10));for(n=t.iterator();n.hasNext();){var o=n.next();r.add_11rb$(i(o))}e=r}else e=null;var a,s=e,l=null!=s?ft(this.myLinesForVariableList_0,s):this.myLinesForVariableList_0.isEmpty()?null:this.myLinesForVariableList_0,u=this.myValueSources_0,c=k(u.size);for(a=u.entries.iterator();a.hasNext();){var p=a.next();c.add_11rb$(p.value)}return new ze(c,l,new ni(this.readAnchor_0(),this.readMinWidth_0(),this.readColor_0()))},Zu.prototype.parseLine_0=function(t){var e,n=this.detachLabel_0(t),i=ii(t,ec().LABEL_SEPARATOR_0),r=d(),o=ec().SOURCE_RE_PATTERN_0;t:do{var a=o.find_905azu$(i);if(null==a){e=i.toString();break t}var s=0,l=i.length,u=mi(l);do{var c=L(a);u.append_ezbsdh$(i,s,c.range.start);var p,h=u.append_gw00v9$;if(H(c.value,"\\^")||H(c.value,"\\@"))p=lt(c.value,"\\");else{var _=this.getValueSource_0(c.value);r.add_11rb$(_),p=Lt.Companion.valueInLinePattern()}h.call(u,p),s=c.range.endInclusive+1|0,a=c.next()}while(s0&&(y=v,$=g)}while(m.hasNext());f=y}while(0);var b=null!=(i=f)?i.second:null,w=this.myValueSources_0,x=null!=b?b:this.createValueSource_0(t.name,t.isAes);w.put_xwzc9p$(t,x)}return L(this.myValueSources_0.get_11rb$(t))},Zu.prototype.getValueSource_0=function(t){var e;if(st(t,ec().AES_NAME_PREFIX_0))e=this.aesField_0(lt(t,ec().AES_NAME_PREFIX_0));else{if(!st(t,ec().VARIABLE_NAME_PREFIX_0))throw z(('Unknown type of the field with name = "'+t+'"').toString());e=this.varField_0(this.detachVariableName_0(t))}var n=e;return this.getValueSource_1(n)},Zu.prototype.detachVariableName_0=function(t){return ui(lt(t,ec().VARIABLE_NAME_PREFIX_0),"{","}")},Zu.prototype.detachLabel_0=function(t){var n;if(O(t,ec().LABEL_SEPARATOR_0)){var i,r=ci(t,ec().LABEL_SEPARATOR_0);n=yi(e.isCharSequence(i=r)?i:c()).toString()}else n=null;return n},Zu.prototype.aesField_0=function(t){return new Ju(t,!0)},Zu.prototype.varField_0=function(t){return new Ju(t,!1)},Zu.prototype.readAnchor_0=function(){var t;if(!this.$outer.has_61zpoe$(_a().TOOLTIP_ANCHOR))return null;var e=this.$outer.getString_61zpoe$(_a().TOOLTIP_ANCHOR);switch(e){case"top_left":t=new _i(pi.TOP,hi.LEFT);break;case"top_center":t=new _i(pi.TOP,hi.CENTER);break;case"top_right":t=new _i(pi.TOP,hi.RIGHT);break;case"middle_left":t=new _i(pi.MIDDLE,hi.LEFT);break;case"middle_center":t=new _i(pi.MIDDLE,hi.CENTER);break;case"middle_right":t=new _i(pi.MIDDLE,hi.RIGHT);break;case"bottom_left":t=new _i(pi.BOTTOM,hi.LEFT);break;case"bottom_center":t=new _i(pi.BOTTOM,hi.CENTER);break;case"bottom_right":t=new _i(pi.BOTTOM,hi.RIGHT);break;default:throw N("Illegal value "+f(e)+", "+_a().TOOLTIP_ANCHOR+", expected values are: 'top_left'/'top_center'/'top_right'/'middle_left'/'middle_center'/'middle_right'/'bottom_left'/'bottom_center'/'bottom_right'")}return t},Zu.prototype.readMinWidth_0=function(){return this.$outer.has_61zpoe$(_a().TOOLTIP_MIN_WIDTH)?this.$outer.getDouble_61zpoe$(_a().TOOLTIP_MIN_WIDTH):null},Zu.prototype.readColor_0=function(){if(this.$outer.has_61zpoe$(_a().TOOLTIP_COLOR)){var t=this.$outer.getString_61zpoe$(_a().TOOLTIP_COLOR);return null!=t?pt("parseColor",function(t,e){return t.parseColor_61zpoe$(e)}.bind(null,fi.Colors))(t):null}return null},Zu.$metadata$={kind:v,simpleName:"TooltipConfigParseHelper",interfaces:[]},Ju.$metadata$={kind:v,simpleName:"Field",interfaces:[]},Ju.prototype.component1=function(){return this.name},Ju.prototype.component2=function(){return this.isAes},Ju.prototype.copy_ivxn3r$=function(t,e){return new Ju(void 0===t?this.name:t,void 0===e?this.isAes:e)},Ju.prototype.toString=function(){return"Field(name="+e.toString(this.name)+", isAes="+e.toString(this.isAes)+")"},Ju.prototype.hashCode=function(){var t=0;return 31*(t=31*t+e.hashCode(this.name)|0)+e.hashCode(this.isAes)|0},Ju.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)&&e.equals(this.isAes,t.isAes)},Qu.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var tc=null;function ec(){return null===tc&&new Qu,tc}function nc(){ic=this,this.CONVERTERS_MAP_0=new vc}Xu.$metadata$={kind:v,simpleName:"TooltipConfig",interfaces:[yl]},nc.prototype.getConverter_31786j$=function(t){return this.CONVERTERS_MAP_0.get_31786j$(t)},nc.prototype.apply_kqseza$=function(t,e){return this.getConverter_31786j$(t)(e)},nc.prototype.applyToList_s6xytz$=function(t,e){var n,i=this.getConverter_31786j$(t),r=d();for(n=e.iterator();n.hasNext();){var o=n.next();r.add_11rb$(i(L(o)))}return r},nc.prototype.has_896ixz$=function(t){return this.CONVERTERS_MAP_0.containsKey_896ixz$(t)},nc.$metadata$={kind:b,simpleName:"AesOptionConversion",interfaces:[]};var ic=null;function rc(){return null===ic&&new nc,ic}function oc(){}function ac(){uc()}function sc(){var t,e;for(lc=this,this.LINE_TYPE_BY_CODE_0=X(),this.LINE_TYPE_BY_NAME_0=X(),t=bi(),e=0;e!==t.length;++e){var n=t[e],i=this.LINE_TYPE_BY_CODE_0,r=n.code;i.put_xwzc9p$(r,n);var o=this.LINE_TYPE_BY_NAME_0,a=n.name.toLowerCase();o.put_xwzc9p$(a,n)}}oc.prototype.apply_11rb$=function(t){if(null==t)return null;if(e.isType(t,En))return t;if(e.isNumber(t))return $c().COLOR(nt(t));try{return fi.Colors.parseColor_61zpoe$(t.toString())}catch(n){throw e.isType(n,T)?N("Can't convert to color: '"+f(t)+"' ("+f(e.getKClassFromExpression(t).simpleName)+")"):n}},oc.$metadata$={kind:v,simpleName:"ColorOptionConverter",interfaces:[$i]},ac.prototype.apply_11rb$=function(t){return null==t?vi.SOLID:e.isType(t,gi)?t:"string"==typeof t&&uc().LINE_TYPE_BY_NAME_0.containsKey_11rb$(t)?L(uc().LINE_TYPE_BY_NAME_0.get_11rb$(t)):e.isNumber(t)&&uc().LINE_TYPE_BY_CODE_0.containsKey_11rb$(C(t))?L(uc().LINE_TYPE_BY_CODE_0.get_11rb$(C(t))):vi.SOLID},sc.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var lc=null;function uc(){return null===lc&&new sc,lc}function cc(){}function pc(){fc()}function hc(){var t,e;_c=this,this.SHAPE_BY_CODE_0=null;var n=X();for(t=Ei(),e=0;e!==t.length;++e){var i=t[e],r=i.code;n.put_xwzc9p$(r,i)}var o=xi.TinyPointShape.code,a=xi.TinyPointShape;n.put_xwzc9p$(o,a),this.SHAPE_BY_CODE_0=n}ac.$metadata$={kind:v,simpleName:"LineTypeOptionConverter",interfaces:[$i]},cc.prototype.apply_11rb$=function(t){if(null==t)return null;if(e.isNumber(t))return nt(t);try{return R(t.toString())}catch(n){throw e.isType(n,rt)?N("Can't convert to number: '"+f(t)+"'"):n}},cc.$metadata$={kind:v,simpleName:"NumericOptionConverter",interfaces:[$i]},pc.prototype.apply_11rb$=function(t){return fc().convert_0(t)},hc.prototype.convert_0=function(t){return null==t?null:e.isType(t,wi)?t:e.isNumber(t)&&this.SHAPE_BY_CODE_0.containsKey_11rb$(C(t))?L(this.SHAPE_BY_CODE_0.get_11rb$(C(t))):this.charShape_0(t.toString())},hc.prototype.charShape_0=function(t){return t.length>0?46===t.charCodeAt(0)?xi.TinyPointShape:ki.BULLET:xi.TinyPointShape},hc.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var _c=null;function fc(){return null===_c&&new hc,_c}function dc(){var t;for(yc=this,this.COLOR=mc,this.MAP_0=X(),t=Dt.Companion.numeric_shhb9a$(Dt.Companion.values()).iterator();t.hasNext();){var e=t.next(),n=this.MAP_0,i=zn.Mappers.IDENTITY;n.put_xwzc9p$(e,i)}var r=this.MAP_0,o=Dt.Companion.COLOR,a=this.COLOR;r.put_xwzc9p$(o,a);var s=this.MAP_0,l=Dt.Companion.FILL,u=this.COLOR;s.put_xwzc9p$(l,u)}function mc(t){if(null==t)return null;var e=Si(Ci(t));return new En(e>>16&255,e>>8&255,255&e)}pc.$metadata$={kind:v,simpleName:"ShapeOptionConverter",interfaces:[$i]},dc.prototype.contain_896ixz$=function(t){return this.MAP_0.containsKey_11rb$(t)},dc.prototype.get_31786j$=function(t){var e;if(!this.contain_896ixz$(t)){var n="No continuous identity mapper found for aes "+t.name;throw N(n.toString())}return"function"==typeof(e=L(this.MAP_0.get_11rb$(t)))?e:c()},dc.$metadata$={kind:b,simpleName:"TypedContinuousIdentityMappers",interfaces:[]};var yc=null;function $c(){return null===yc&&new dc,yc}function vc(){Tc(),this.myMap_0=X(),this.put_0(Dt.Companion.X,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.Y,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.Z,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.YMIN,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.YMAX,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.COLOR,Tc().COLOR_CVT_0),this.put_0(Dt.Companion.FILL,Tc().COLOR_CVT_0),this.put_0(Dt.Companion.ALPHA,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.SHAPE,Tc().SHAPE_CVT_0),this.put_0(Dt.Companion.LINETYPE,Tc().LINETYPE_CVT_0),this.put_0(Dt.Companion.SIZE,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.WIDTH,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.HEIGHT,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.WEIGHT,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.INTERCEPT,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.SLOPE,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.XINTERCEPT,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.YINTERCEPT,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.LOWER,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.MIDDLE,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.UPPER,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.FRAME,Tc().IDENTITY_S_CVT_0),this.put_0(Dt.Companion.SPEED,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.FLOW,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.XMIN,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.XMAX,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.XEND,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.YEND,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.LABEL,Tc().IDENTITY_O_CVT_0),this.put_0(Dt.Companion.FAMILY,Tc().IDENTITY_S_CVT_0),this.put_0(Dt.Companion.FONTFACE,Tc().IDENTITY_S_CVT_0),this.put_0(Dt.Companion.HJUST,Tc().IDENTITY_O_CVT_0),this.put_0(Dt.Companion.VJUST,Tc().IDENTITY_O_CVT_0),this.put_0(Dt.Companion.ANGLE,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.SYM_X,Tc().DOUBLE_CVT_0),this.put_0(Dt.Companion.SYM_Y,Tc().DOUBLE_CVT_0)}function gc(){Sc=this,this.IDENTITY_O_CVT_0=bc,this.IDENTITY_S_CVT_0=wc,this.DOUBLE_CVT_0=xc,this.COLOR_CVT_0=kc,this.SHAPE_CVT_0=Ec,this.LINETYPE_CVT_0=Cc}function bc(t){return t}function wc(t){return null!=t?t.toString():null}function xc(t){return(new cc).apply_11rb$(t)}function kc(t){return(new oc).apply_11rb$(t)}function Ec(t){return(new pc).apply_11rb$(t)}function Cc(t){return(new ac).apply_11rb$(t)}vc.prototype.put_0=function(t,e){this.myMap_0.put_xwzc9p$(t,e)},vc.prototype.get_31786j$=function(t){var e;return"function"==typeof(e=this.myMap_0.get_11rb$(t))?e:c()},vc.prototype.containsKey_896ixz$=function(t){return this.myMap_0.containsKey_11rb$(t)},gc.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Sc=null;function Tc(){return null===Sc&&new gc,Sc}function Oc(t,e,n){Ac(),yl.call(this,t,e),this.isX_0=n}function Nc(){Pc=this}vc.$metadata$={kind:v,simpleName:"TypedOptionConverterMap",interfaces:[]},Oc.prototype.defTheme_0=function(){return this.isX_0?Bc().DEF_8be2vx$.axisX():Bc().DEF_8be2vx$.axisY()},Oc.prototype.optionSuffix_0=function(){return this.isX_0?"_x":"_y"},Oc.prototype.showLine=function(){return!this.disabled_0(al().AXIS_LINE)},Oc.prototype.showTickMarks=function(){return!this.disabled_0(al().AXIS_TICKS)},Oc.prototype.showTickLabels=function(){return!this.disabled_0(al().AXIS_TEXT)},Oc.prototype.showTitle=function(){return!this.disabled_0(al().AXIS_TITLE)},Oc.prototype.showTooltip=function(){return!this.disabled_0(al().AXIS_TOOLTIP)},Oc.prototype.lineWidth=function(){return this.defTheme_0().lineWidth()},Oc.prototype.tickMarkWidth=function(){return this.defTheme_0().tickMarkWidth()},Oc.prototype.tickMarkLength=function(){return this.defTheme_0().tickMarkLength()},Oc.prototype.tickMarkPadding=function(){return this.defTheme_0().tickMarkPadding()},Oc.prototype.getViewElementConfig_0=function(t){if(!this.hasApplicable_61zpoe$(t))throw z(("option '"+t+"' is not specified").toString());return Gc().create_za3rmp$(L(this.getApplicable_61zpoe$(t)))},Oc.prototype.disabled_0=function(t){return this.hasApplicable_61zpoe$(t)&&this.getViewElementConfig_0(t).isBlank},Oc.prototype.hasApplicable_61zpoe$=function(t){var e=t+this.optionSuffix_0();return this.has_61zpoe$(e)||this.has_61zpoe$(t)},Oc.prototype.getApplicable_61zpoe$=function(t){var e=t+this.optionSuffix_0();return this.hasOwn_61zpoe$(e)?this.get_61zpoe$(e):this.hasOwn_61zpoe$(t)?this.get_61zpoe$(t):this.has_61zpoe$(e)?this.get_61zpoe$(e):this.get_61zpoe$(t)},Nc.prototype.X_d1i6zg$=function(t,e){return new Oc(t,e,!0)},Nc.prototype.Y_d1i6zg$=function(t,e){return new Oc(t,e,!1)},Nc.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Pc=null;function Ac(){return null===Pc&&new Nc,Pc}function jc(t,e){yl.call(this,t,e)}function Lc(t){Bc(),this.theme=new Ic(t)}function Rc(t,e){this.options_0=t,this.axisXTheme_0=Ac().X_d1i6zg$(this.options_0,e),this.axisYTheme_0=Ac().Y_d1i6zg$(this.options_0,e),this.legendTheme_0=new jc(this.options_0,e)}function Ic(t){Rc.call(this,t,Bc().DEF_OPTIONS_0)}function zc(t){Rc.call(this,t,Bc().DEF_OPTIONS_MULTI_TILE_0)}function Dc(){Mc=this,this.DEF_8be2vx$=new Li,this.DEF_OPTIONS_0=te([ct(al().LEGEND_POSITION,this.DEF_8be2vx$.legend().position()),ct(al().LEGEND_JUSTIFICATION,this.DEF_8be2vx$.legend().justification()),ct(al().LEGEND_DIRECTION,this.DEF_8be2vx$.legend().direction())]),this.DEF_OPTIONS_MULTI_TILE_0=gt(this.DEF_OPTIONS_0,te([ct("axis_line_x",al().ELEMENT_BLANK),ct("axis_line_y",al().ELEMENT_BLANK)]))}Oc.$metadata$={kind:v,simpleName:"AxisThemeConfig",interfaces:[Ti,yl]},jc.prototype.keySize=function(){return Bc().DEF_8be2vx$.legend().keySize()},jc.prototype.margin=function(){return Bc().DEF_8be2vx$.legend().margin()},jc.prototype.padding=function(){return Bc().DEF_8be2vx$.legend().padding()},jc.prototype.position=function(){var t,n,i=this.get_61zpoe$(al().LEGEND_POSITION);if("string"==typeof i){switch(i){case"right":t=Oi.Companion.RIGHT;break;case"left":t=Oi.Companion.LEFT;break;case"top":t=Oi.Companion.TOP;break;case"bottom":t=Oi.Companion.BOTTOM;break;case"none":t=Oi.Companion.NONE;break;default:throw N("Illegal value '"+f(i)+"', "+al().LEGEND_POSITION+" expected values are: left/right/top/bottom/none or or two-element numeric list")}return t}if(e.isType(i,et)){var r=_r().toNumericPair_9ma18$(L(null==(n=i)||e.isType(n,et)?n:c()));return new Oi(r.x,r.y)}return e.isType(i,Oi)?i:Bc().DEF_8be2vx$.legend().position()},jc.prototype.justification=function(){var t,n=this.get_61zpoe$(al().LEGEND_JUSTIFICATION);if("string"==typeof n){if(H(n,"center"))return Ni.Companion.CENTER;throw N("Illegal value '"+f(n)+"', "+al().LEGEND_JUSTIFICATION+" expected values are: 'center' or two-element numeric list")}if(e.isType(n,et)){var i=_r().toNumericPair_9ma18$(L(null==(t=n)||e.isType(t,et)?t:c()));return new Ni(i.x,i.y)}return e.isType(n,Ni)?n:Bc().DEF_8be2vx$.legend().justification()},jc.prototype.direction=function(){var t=this.get_61zpoe$(al().LEGEND_DIRECTION);if("string"==typeof t)switch(t){case"horizontal":return Pi.HORIZONTAL;case"vertical":return Pi.VERTICAL}return Pi.AUTO},jc.prototype.backgroundFill=function(){return Bc().DEF_8be2vx$.legend().backgroundFill()},jc.$metadata$={kind:v,simpleName:"LegendThemeConfig",interfaces:[Ai,yl]},Rc.prototype.axisX=function(){return this.axisXTheme_0},Rc.prototype.axisY=function(){return this.axisYTheme_0},Rc.prototype.legend=function(){return this.legendTheme_0},Rc.prototype.facets=function(){return Bc().DEF_8be2vx$.facets()},Rc.prototype.plot=function(){return Bc().DEF_8be2vx$.plot()},Rc.prototype.multiTile=function(){return new zc(this.options_0)},Rc.$metadata$={kind:v,simpleName:"ConfiguredTheme",interfaces:[ji]},Ic.$metadata$={kind:v,simpleName:"OneTileTheme",interfaces:[Rc]},zc.prototype.plot=function(){return Bc().DEF_8be2vx$.multiTile().plot()},zc.$metadata$={kind:v,simpleName:"MultiTileTheme",interfaces:[Rc]},Dc.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Mc=null;function Bc(){return null===Mc&&new Dc,Mc}function Uc(t,e){if(Gc(),yl.call(this,e),this.name_0=t,!H(al().ELEMENT_BLANK,this.name_0))throw z("Only 'element_blank' is supported".toString())}function Fc(){qc=this}Lc.$metadata$={kind:v,simpleName:"ThemeConfig",interfaces:[]},Object.defineProperty(Uc.prototype,"isBlank",{configurable:!0,get:function(){return H(al().ELEMENT_BLANK,this.name_0)}}),Fc.prototype.create_za3rmp$=function(t){var n;if(e.isType(t,A)){var i=e.isType(n=t,A)?n:c();return this.createForName_0(_r().featureName_bkhwtg$(i),i)}return this.createForName_0(t.toString(),X())},Fc.prototype.createForName_0=function(t,e){return new Uc(t,e)},Fc.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var qc=null;function Gc(){return null===qc&&new Fc,qc}function Hc(){Yc=this}Uc.$metadata$={kind:v,simpleName:"ViewElementConfig",interfaces:[yl]},Hc.prototype.apply_bkhwtg$=function(t){return this.cleanCopyOfMap_0(t)},Hc.prototype.cleanCopyOfMap_0=function(t){var n,i=X();for(n=t.keys.iterator();n.hasNext();){var r,o=n.next(),a=(e.isType(r=t,A)?r:c()).get_11rb$(o);if(null!=a){var s=f(o),l=this.cleanValue_0(a);i.put_xwzc9p$(s,l)}}return i},Hc.prototype.cleanValue_0=function(t){return e.isType(t,A)?this.cleanCopyOfMap_0(t):e.isType(t,et)?this.cleanList_0(t):t},Hc.prototype.cleanList_0=function(t){var e;if(!this.containSpecs_0(t))return t;var n=k(t.size);for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(this.cleanValue_0(L(i)))}return n},Hc.prototype.containSpecs_0=function(t){var n;t:do{var i;if(e.isType(t,oe)&&t.isEmpty()){n=!1;break t}for(i=t.iterator();i.hasNext();){var r=i.next();if(e.isType(r,A)||e.isType(r,et)){n=!0;break t}}n=!1}while(0);return n},Hc.$metadata$={kind:b,simpleName:"PlotSpecCleaner",interfaces:[]};var Yc=null;function Vc(){return null===Yc&&new Hc,Yc}function Kc(t){var e;for(ip(),this.myMakeCleanCopy_0=!1,this.mySpecChanges_0=null,this.myMakeCleanCopy_0=t.myMakeCleanCopy_8be2vx$,this.mySpecChanges_0=X(),e=t.mySpecChanges_8be2vx$.entries.iterator();e.hasNext();){var n=e.next(),i=n.key,r=n.value;if(r.isEmpty())throw z("Check failed.".toString());this.mySpecChanges_0.put_xwzc9p$(i,r)}}function Wc(t){this.closure$result=t}function Xc(t){this.myMakeCleanCopy_8be2vx$=t,this.mySpecChanges_8be2vx$=X()}function Zc(){np=this}Wc.prototype.getSpecsAbsolute_vqirvp$=function(t){var n,i=mp(an(t)).findSpecs_bkhwtg$(this.closure$result);return e.isType(n=i,et)?n:c()},Wc.$metadata$={kind:v,interfaces:[fp]},Kc.prototype.apply_i49brq$=function(t){var n,i=this.myMakeCleanCopy_0?Vc().apply_bkhwtg$(t):e.isType(n=t,u)?n:c(),r=new Wc(i),o=xp().root();return this.applyChangesToSpec_0(o,i,r),i},Kc.prototype.applyChangesToSpec_0=function(t,e,n){var i,r;for(i=e.keys.iterator();i.hasNext();){var o=i.next(),a=L(e.get_11rb$(o)),s=t.with().part_61zpoe$(o).build();this.applyChangesToValue_0(s,a,n)}for(r=this.applicableSpecChanges_0(t,e).iterator();r.hasNext();)r.next().apply_il3x6g$(e,n)},Kc.prototype.applyChangesToValue_0=function(t,n,i){var r,o;if(e.isType(n,A)){var a=e.isType(r=n,u)?r:c();this.applyChangesToSpec_0(t,a,i)}else if(e.isType(n,et))for(o=n.iterator();o.hasNext();){var s=o.next();this.applyChangesToValue_0(t,s,i)}},Kc.prototype.applicableSpecChanges_0=function(t,e){var n;if(this.mySpecChanges_0.containsKey_11rb$(t)){var i=d();for(n=L(this.mySpecChanges_0.get_11rb$(t)).iterator();n.hasNext();){var r=n.next();r.isApplicable_x7u0o8$(e)&&i.add_11rb$(r)}return i}return ut()},Xc.prototype.change_t6n62v$=function(t,e){if(!this.mySpecChanges_8be2vx$.containsKey_11rb$(t)){var n=this.mySpecChanges_8be2vx$,i=d();n.put_xwzc9p$(t,i)}return L(this.mySpecChanges_8be2vx$.get_11rb$(t)).add_11rb$(e),this},Xc.prototype.build=function(){return new Kc(this)},Xc.$metadata$={kind:v,simpleName:"Builder",interfaces:[]},Zc.prototype.builderForRawSpec=function(){return new Xc(!0)},Zc.prototype.builderForCleanSpec=function(){return new Xc(!1)},Zc.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Jc,Qc,tp,ep,np=null;function ip(){return null===np&&new Zc,np}function rp(){pp=this,this.GGBUNCH_KEY_PARTS=[ra().ITEMS,na().FEATURE_SPEC],this.PLOT_WITH_LAYERS_TARGETS_0=le([sp(),lp(),up(),cp()])}function op(t,e){Mn.call(this),this.name$=t,this.ordinal$=e}function ap(){ap=function(){},Jc=new op("PLOT",0),Qc=new op("LAYER",1),tp=new op("GEOM",2),ep=new op("STAT",3)}function sp(){return ap(),Jc}function lp(){return ap(),Qc}function up(){return ap(),tp}function cp(){return ap(),ep}Kc.$metadata$={kind:v,simpleName:"PlotSpecTransform",interfaces:[]},rp.prototype.getDataSpecFinders_6taknv$=function(t){return this.getPlotAndLayersSpecFinders_esgbho$(t,[sa().DATA])},rp.prototype.getPlotAndLayersSpecFinders_esgbho$=function(t,e){var n=this.getPlotAndLayersSpecSelectorKeys_0(t,e.slice());return this.toFinders_0(n)},rp.prototype.toFinders_0=function(t){var e,n=d();for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(mp(i))}return n},rp.prototype.getPlotAndLayersSpecSelectors_esgbho$=function(t,e){var n=this.getPlotAndLayersSpecSelectorKeys_0(t,e.slice());return this.toSelectors_0(n)},rp.prototype.toSelectors_0=function(t){var e,n=k(x(t,10));for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(xp().from_upaayv$(i))}return n},rp.prototype.getPlotAndLayersSpecSelectorKeys_0=function(t,e){var n,i=d();for(n=this.PLOT_WITH_LAYERS_TARGETS_0.iterator();n.hasNext();){var r=n.next(),o=this.selectorKeys_0(r,t),a=le(this.concat_0(o,e).slice());i.add_11rb$(a)}return i},rp.prototype.concat_0=function(t,e){return t.concat(e)},rp.prototype.selectorKeys_0=function(t,n){var i;switch(t.name){case"PLOT":i=[];break;case"LAYER":i=[ca().LAYERS];break;case"GEOM":i=[ca().LAYERS,_a().GEOM];break;case"STAT":i=[ca().LAYERS,_a().STAT];break;default:e.noWhenBranchMatched()}return n&&(i=this.concat_0(this.GGBUNCH_KEY_PARTS,i)),i},op.$metadata$={kind:v,simpleName:"TargetSpec",interfaces:[Mn]},op.values=function(){return[sp(),lp(),up(),cp()]},op.valueOf_61zpoe$=function(t){switch(t){case"PLOT":return sp();case"LAYER":return lp();case"GEOM":return up();case"STAT":return cp();default:Bn("No enum constant jetbrains.datalore.plot.config.transform.PlotSpecTransformUtil.TargetSpec."+t)}},rp.$metadata$={kind:b,simpleName:"PlotSpecTransformUtil",interfaces:[]};var pp=null;function hp(){return null===pp&&new rp,pp}function _p(){}function fp(){}function dp(){this.myKeys_0=null}function mp(t,e){return e=e||Object.create(dp.prototype),dp.call(e),e.myKeys_0=St(t),e}function yp(t){xp(),this.myKey_0=null,this.myKey_0=S(L(t.mySelectorParts_8be2vx$),"|")}function $p(){this.mySelectorParts_8be2vx$=null}function vp(t){return t=t||Object.create($p.prototype),$p.call(t),t.mySelectorParts_8be2vx$=d(),L(t.mySelectorParts_8be2vx$).add_11rb$("/"),t}function gp(t,e){var n;for(e=e||Object.create($p.prototype),$p.call(e),e.mySelectorParts_8be2vx$=d(),n=0;n!==t.length;++n){var i=t[n];L(e.mySelectorParts_8be2vx$).add_11rb$(i)}return e}function bp(){wp=this}_p.prototype.isApplicable_x7u0o8$=function(t){return!0},_p.$metadata$={kind:Ri,simpleName:"SpecChange",interfaces:[]},fp.$metadata$={kind:Ri,simpleName:"SpecChangeContext",interfaces:[]},dp.prototype.findSpecs_bkhwtg$=function(t){return this.myKeys_0.isEmpty()?_(t):this.findSpecs_0(this.myKeys_0.get_za3lpa$(0),this.myKeys_0.subList_vux9f0$(1,this.myKeys_0.size),t)},dp.prototype.findSpecs_0=function(t,n,i){var r,o;if((e.isType(o=i,A)?o:c()).containsKey_11rb$(t)){var a,s=(e.isType(a=i,A)?a:c()).get_11rb$(t);if(e.isType(s,A))return n.isEmpty()?_(s):this.findSpecs_0(n.get_za3lpa$(0),n.subList_vux9f0$(1,n.size),s);if(e.isType(s,et)){if(n.isEmpty()){var l=d();for(r=s.iterator();r.hasNext();){var u=r.next();e.isType(u,A)&&l.add_11rb$(u)}return l}return this.findSpecsInList_0(n.get_za3lpa$(0),n.subList_vux9f0$(1,n.size),s)}}return ut()},dp.prototype.findSpecsInList_0=function(t,n,i){var r,o=d();for(r=i.iterator();r.hasNext();){var a=r.next();e.isType(a,A)?o.addAll_brywnq$(this.findSpecs_0(t,n,a)):e.isType(a,et)&&o.addAll_brywnq$(this.findSpecsInList_0(t,n,a))}return o},dp.$metadata$={kind:v,simpleName:"SpecFinder",interfaces:[]},yp.prototype.with=function(){var t,e=this.myKey_0,n=j("\\|").split_905azu$(e,0);t:do{if(!n.isEmpty())for(var i=n.listIterator_za3lpa$(n.size);i.hasPrevious();)if(0!==i.previous().length){t=Pt(n,i.nextIndex()+1|0);break t}t=ut()}while(0);return gp(zi(t))},yp.prototype.equals=function(t){var n,i;if(this===t)return!0;if(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))return!1;var r=null==(i=t)||e.isType(i,yp)?i:c();return H(this.myKey_0,L(r).myKey_0)},yp.prototype.hashCode=function(){return Ii(_(this.myKey_0))},yp.prototype.toString=function(){return"SpecSelector{myKey='"+this.myKey_0+String.fromCharCode(39)+String.fromCharCode(125)},$p.prototype.part_61zpoe$=function(t){return L(this.mySelectorParts_8be2vx$).add_11rb$(t),this},$p.prototype.build=function(){return new yp(this)},$p.$metadata$={kind:v,simpleName:"Builder",interfaces:[]},bp.prototype.root=function(){return vp().build()},bp.prototype.of_vqirvp$=function(t){return this.from_upaayv$(le(t.slice()))},bp.prototype.from_upaayv$=function(t){for(var e=vp(),n=t.iterator();n.hasNext();){var i=n.next();e.part_61zpoe$(i)}return e.build()},bp.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var wp=null;function xp(){return null===wp&&new bp,wp}function kp(){Sp()}function Ep(){Cp=this}yp.$metadata$={kind:v,simpleName:"SpecSelector",interfaces:[]},kp.prototype.isApplicable_x7u0o8$=function(t){return e.isType(t.get_11rb$(_a().GEOM),A)},kp.prototype.apply_il3x6g$=function(t,n){var i,r,o,a,s=e.isType(i=t.remove_11rb$(_a().GEOM),u)?i:c(),l=Jo().NAME,p="string"==typeof(r=(e.isType(a=s,u)?a:c()).remove_11rb$(l))?r:c(),h=_a().GEOM;t.put_xwzc9p$(h,p),t.putAll_a2k3zr$(e.isType(o=s,A)?o:c())},Ep.prototype.specSelector_6taknv$=function(t){var e=d();return t&&e.addAll_brywnq$(an(hp().GGBUNCH_KEY_PARTS)),e.add_11rb$(ca().LAYERS),xp().from_upaayv$(e)},Ep.$metadata$={kind:b,simpleName:"Companion",interfaces:[]};var Cp=null;function Sp(){return null===Cp&&new Ep,Cp}function Tp(t,e){this.dataFrames_0=t,this.scaleByAes_0=e}function Op(t){Lp(),Dl.call(this,t)}function Np(t,e,n,i){return function(r){return t(e,i.createStatMessage_omgxfc$_0(r,n)),y}}function Pp(t,e,n,i){return function(r){return t(e,i.createSamplingMessage_b1krad$_0(r,n)),y}}function Ap(){jp=this,this.LOG_0=M.PortableLogging.logger_xo1ogr$(B(Op))}kp.$metadata$={kind:v,simpleName:"MoveGeomPropertiesToLayerMigration",interfaces:[_p]},Tp.prototype.overallRange_0=function(t,e){var n,i=null;for(n=e.iterator();n.hasNext();){var r=n.next();r.has_8xm3sj$(t)&&(i=je.SeriesUtil.span_t7esj2$(i,r.range_8xm3sj$(t)))}return i},Tp.prototype.overallXRange=function(){return this.overallRange_1(Dt.Companion.X)},Tp.prototype.overallYRange=function(){return this.overallRange_1(Dt.Companion.Y)},Tp.prototype.overallRange_1=function(t){var e,n,i=V.DataFrameUtil.transformVarFor_896ixz$(t),r=new D(Di.NaN,Di.NaN);if(this.scaleByAes_0.containsKey_896ixz$(t)){var o=this.scaleByAes_0.get_31786j$(t);e=o.isContinuousDomain?zn.ScaleUtil.transformedDefinedLimits_x4zrm4$(o):r}else e=r;var a=e,s=a.component1(),l=a.component2(),u=this.overallRange_0(i,this.dataFrames_0);if(null!=u){var c=Mi(s)?s:u.lowerEnd,p=Mi(l)?l:u.upperEnd;n=ct(c,p)}else n=je.SeriesUtil.allFinite_jma9l8$(s,l)?ct(s,l):null;var h=n;return null!=h?new tn(h.first,h.second):null},Tp.$metadata$={kind:v,simpleName:"ConfiguredStatContext",interfaces:[Bi]},Op.prototype.createLayerConfig_ookg2q$=function(t,e,n,i,r){var o,a="string"==typeof(o=t.get_11rb$(_a().GEOM))?o:c();return new wo(t,e,n,i,r,new to(ul().toGeomKind_61zpoe$(a)),!1)},Op.prototype.updatePlotSpec_47ur7o$_0=function(){for(var t=Ot(),e=this.dataByTileByLayerAfterStat_5qft8t$_0(function(t,e){return function(n,i){return t.add_11rb$(n),Ql().addComputationMessage_qqfnr1$(e,i),y}}(t,this)),n=d(),i=this.layerConfigs,r=0;r!==i.size;++r){var o,a,s,l,u=X();for(o=e.iterator();o.hasNext();){var c=o.next().get_za3lpa$(r),p=c.variables();if(u.isEmpty())for(a=p.iterator();a.hasNext();){var h=a.next(),_=h.name,f=new Ui(h,St(c.get_8xm3sj$(h)));u.put_xwzc9p$(_,f)}else for(s=p.iterator();s.hasNext();){var m=s.next();L(u.get_11rb$(m.name)).second.addAll_brywnq$(c.get_8xm3sj$(m))}}var $=Q();for(l=u.keys.iterator();l.hasNext();){var v=l.next(),g=L(u.get_11rb$(v)).first,b=L(u.get_11rb$(v)).second;$.put_2l962d$(g,b)}var w=$.build();n.add_11rb$(w)}for(var x=0,k=i.iterator();k.hasNext();++x){var E=k.next();if(E.stat!==Re.Stats.IDENTITY||t.contains_11rb$(x)){var C=n.get_za3lpa$(x);E.replaceOwnData_84jd1e$(C)}}this.dropUnusedDataBeforeEncoding_r9oln7$_0(i)},Op.prototype.dropUnusedDataBeforeEncoding_r9oln7$_0=function(t){var e,n,i,r,o=kt(xt(wt(x(t,10)),16));for(r=t.iterator();r.hasNext();){var a=r.next();o.put_xwzc9p$(a,Lp().variablesToKeep_0(this.facets,a))}var s=o,l=this.sharedData,u=V.DataFrameUtil.variables_dhhkv7$(l),c=Ot();for(e=u.keys.iterator();e.hasNext();){var p=e.next(),h=!0;for(n=s.entries.iterator();n.hasNext();){var _=n.next(),f=_.key,d=_.value,m=L(f.ownData);if(!V.DataFrameUtil.variables_dhhkv7$(m).containsKey_11rb$(p)&&d.contains_11rb$(p)){h=!1;break}}h||c.add_11rb$(p)}if(c.size\n | .plt-container {\n |\tfont-family: "Lucida Grande", sans-serif;\n |\tcursor: crosshair;\n |\tuser-select: none;\n |\t-webkit-user-select: none;\n |\t-moz-user-select: none;\n |\t-ms-user-select: none;\n |}\n |.plt-backdrop {\n | fill: white;\n |}\n |.plt-transparent .plt-backdrop {\n | visibility: hidden;\n |}\n |text {\n |\tfont-size: 12px;\n |\tfill: #3d3d3d;\n |\t\n |\ttext-rendering: optimizeLegibility;\n |}\n |.plt-data-tooltip text {\n |\tfont-size: 12px;\n |}\n |.plt-axis-tooltip text {\n |\tfont-size: 12px;\n |}\n |.plt-axis line {\n |\tshape-rendering: crispedges;\n |}\n |.plt-plot-title {\n |\n | font-size: 16.0px;\n | font-weight: bold;\n |}\n |.plt-axis .tick text {\n |\n | font-size: 10.0px;\n |}\n |.plt-axis.small-tick-font .tick text {\n |\n | font-size: 8.0px;\n |}\n |.plt-axis-title text {\n |\n | font-size: 12.0px;\n |}\n |.plt_legend .legend-title text {\n |\n | font-size: 12.0px;\n | font-weight: bold;\n |}\n |.plt_legend text {\n |\n | font-size: 10.0px;\n |}\n |\n | \n '),E('\n |\n |'+Kp+'\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | Lunch\n | \n | \n | \n | \n | \n | \n | \n | \n | Dinner\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | 0.0\n | \n | \n | \n | \n | \n | \n | \n | \n | 0.5\n | \n | \n | \n | \n | \n | \n | \n | \n | 1.0\n | \n | \n | \n | \n | \n | \n | \n | \n | 1.5\n | \n | \n | \n | \n | \n | \n | \n | \n | 2.0\n | \n | \n | \n | \n | \n | \n | \n | \n | 2.5\n | \n | \n | \n | \n | \n | \n | \n | \n | 3.0\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | count\n | \n | \n | \n | \n | \n | \n | time\n | \n | \n | \n | \n |\n '),E('\n |\n |\n |\n | \n | \n | \n | \n | \n | \n | \n | 1\n | \n | \n | \n | \n | \n | \n | \n | \n | 2\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | 0\n | \n | \n | \n | \n | \n | \n | \n | \n | 1\n | \n | \n | \n | \n | \n | \n | \n | \n | 2\n | \n | \n | \n | \n | \n | \n | \n | \n | 3\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | b\n | \n | \n | \n | \n | \n | \n | a\n | \n | \n | \n | \n |\n |\n | \n | \n | \n | \n | \n | \n | \n | 1\n | \n | \n | \n | \n | \n | \n | \n | \n | 2\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | 0\n | \n | \n | \n | \n | \n | \n | \n | \n | 1\n | \n | \n | \n | \n | \n | \n | \n | \n | 2\n | \n | \n | \n | \n | \n | \n | \n | \n | 3\n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | \n | b\n | \n | \n | \n | \n | \n | \n | a\n | \n | \n | \n | \n |\n |\n '),t})?i.apply(e,r):i)||(t.exports=o)},698:function(t,e,n){var i,r,o;r=[e,n(421),n(770),n(767),n(836),n(52),n(958),n(623)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o,a,s){"use strict";e.kotlin.io.println_s8jyv4$,e.kotlin.Unit;var l=n.jetbrains.datalore.plot.config.PlotConfig,u=e.kotlin.IllegalArgumentException_init_pdl1vj$,c=n.jetbrains.datalore.plot.config.PlotConfigClientSide,p=(n.jetbrains.datalore.plot.config,n.jetbrains.datalore.plot.server.config.PlotConfigServerSide,i.jetbrains.datalore.base.geometry.DoubleVector,e.kotlin.collections.ArrayList_init_287e2$),h=e.kotlin.collections.HashMap_init_q3lmfv$,_=e.kotlin.collections.Map,f=(e.kotlin.collections.emptyMap_q3lmfv$,e.Kind.OBJECT),d=e.Kind.CLASS,m=n.jetbrains.datalore.plot.config.transform.SpecChange,y=r.jetbrains.datalore.plot.base.data,$=e.kotlin.collections.List,v=e.throwCCE,g=r.jetbrains.datalore.plot.base.DataFrame.Builder_init,b=o.jetbrains.datalore.plot.common.base64,w=e.kotlin.collections.ArrayList_init_mqih57$,x=e.kotlin.Comparator,k=e.kotlin.collections.sortWith_nqfjgj$,E=e.kotlin.collections.sort_4wi501$,C=a.jetbrains.datalore.plot.common.data,S=n.jetbrains.datalore.plot.config.transform,T=n.jetbrains.datalore.plot.config.Option,O=n.jetbrains.datalore.plot.config.transform.PlotSpecTransform,N=s.jetbrains.datalore.plot;function P(){}function A(){}function j(){R=this,this.DATA_FRAME_KEY_0="__data_frame_encoded",this.DATA_SPEC_KEY_0="__data_spec_encoded"}function L(t,n){return e.compareTo(t.name,n.name)}P.prototype.isApplicable_x7u0o8$=function(t){return I().isEncodedDataSpec_za3rmp$(t)},P.prototype.apply_il3x6g$=function(t,e){var n;n=I().decode1_6uu7i0$(t),t.clear(),t.putAll_a2k3zr$(n)},P.$metadata$={kind:d,simpleName:"ClientSideDecodeChange",interfaces:[m]},A.prototype.isApplicable_x7u0o8$=function(t){return I().isEncodedDataFrame_bkhwtg$(t)},A.prototype.apply_il3x6g$=function(t,e){var n=I().decode_bkhwtg$(t);t.clear(),t.putAll_a2k3zr$(y.DataFrameUtil.toMap_dhhkv7$(n))},A.$metadata$={kind:d,simpleName:"ClientSideDecodeOldStyleChange",interfaces:[m]},j.prototype.isEncodedDataFrame_bkhwtg$=function(t){var n=1===t.size;if(n){var i,r=this.DATA_FRAME_KEY_0;n=(e.isType(i=t,_)?i:v()).containsKey_11rb$(r)}return n},j.prototype.isEncodedDataSpec_za3rmp$=function(t){var n;if(e.isType(t,_)){var i=1===t.size;if(i){var r,o=this.DATA_SPEC_KEY_0;i=(e.isType(r=t,_)?r:v()).containsKey_11rb$(o)}n=i}else n=!1;return n},j.prototype.decode_bkhwtg$=function(t){var n,i,r,o;if(!this.isEncodedDataFrame_bkhwtg$(t))throw u("Not a data frame".toString());for(var a,s=this.DATA_FRAME_KEY_0,l=e.isType(n=(e.isType(a=t,_)?a:v()).get_11rb$(s),$)?n:v(),c=e.isType(i=l.get_za3lpa$(0),$)?i:v(),p=e.isType(r=l.get_za3lpa$(1),$)?r:v(),h=e.isType(o=l.get_za3lpa$(2),$)?o:v(),f=g(),d=0;d!==c.size;++d){var m,w,x,k,E,C="string"==typeof(m=c.get_za3lpa$(d))?m:v(),S="string"==typeof(w=p.get_za3lpa$(d))?w:v(),T="boolean"==typeof(x=h.get_za3lpa$(d))?x:v(),O=y.DataFrameUtil.createVariable_puj7f4$(C,S),N=l.get_za3lpa$(3+d|0);if(T){var P=b.BinaryUtil.decodeList_61zpoe$("string"==typeof(k=N)?k:v());f.putNumeric_s1rqo9$(O,P)}else f.put_2l962d$(O,e.isType(E=N,$)?E:v())}return f.build()},j.prototype.decode1_6uu7i0$=function(t){var n,i,r;if(!this.isEncodedDataSpec_za3rmp$(t))throw u("Not an encoded data spec".toString());for(var o=e.isType(n=t.get_11rb$(this.DATA_SPEC_KEY_0),$)?n:v(),a=e.isType(i=o.get_za3lpa$(0),$)?i:v(),s=e.isType(r=o.get_za3lpa$(1),$)?r:v(),l=h(),c=0;c!==a.size;++c){var p,_,f,d,m="string"==typeof(p=a.get_za3lpa$(c))?p:v(),y="boolean"==typeof(_=s.get_za3lpa$(c))?_:v(),g=o.get_za3lpa$(2+c|0),w=y?b.BinaryUtil.decodeList_61zpoe$("string"==typeof(f=g)?f:v()):e.isType(d=g,$)?d:v();l.put_xwzc9p$(m,w)}return l},j.prototype.encode_dhhkv7$=function(t){var n,i,r=h(),o=p(),a=this.DATA_FRAME_KEY_0;r.put_xwzc9p$(a,o);var s=p(),l=p(),u=p();o.add_11rb$(s),o.add_11rb$(l),o.add_11rb$(u);var c=w(t.variables());for(k(c,new x(L)),n=c.iterator();n.hasNext();){var _=n.next();s.add_11rb$(_.name),l.add_11rb$(_.label);var f=t.isNumeric_8xm3sj$(_);u.add_11rb$(f);var d=t.get_8xm3sj$(_);if(f){var m=b.BinaryUtil.encodeList_k9kaly$(e.isType(i=d,$)?i:v());o.add_11rb$(m)}else o.add_11rb$(d)}return r},j.prototype.encode1_x7u0o8$=function(t){var n,i=h(),r=p(),o=this.DATA_SPEC_KEY_0;i.put_xwzc9p$(o,r);var a=p(),s=p();r.add_11rb$(a),r.add_11rb$(s);var l=w(t.keys);for(E(l),n=l.iterator();n.hasNext();){var u=n.next(),c=t.get_11rb$(u);if(e.isType(c,$)){var _=C.SeriesUtil.checkedDoubles_9ma18$(c),f=_.notEmptyAndCanBeCast();if(a.add_11rb$(u),s.add_11rb$(f),f){var d=b.BinaryUtil.encodeList_k9kaly$(_.cast());r.add_11rb$(d)}else r.add_11rb$(c)}}return i},j.$metadata$={kind:f,simpleName:"DataFrameEncoding",interfaces:[]};var R=null;function I(){return null===R&&new j,R}function z(){D=this}z.prototype.addDataChanges_0=function(t,e,n){var i;for(i=S.PlotSpecTransformUtil.getPlotAndLayersSpecSelectors_esgbho$(n,[T.PlotBase.DATA]).iterator();i.hasNext();){var r=i.next();t.change_t6n62v$(r,e)}return t},z.prototype.clientSideDecode_6taknv$=function(t){var e=O.Companion.builderForRawSpec();return this.addDataChanges_0(e,new P,t),this.addDataChanges_0(e,new A,t),e.build()},z.prototype.serverSideEncode_6taknv$=function(t){var e;return e=t?O.Companion.builderForRawSpec():O.Companion.builderForCleanSpec(),this.addDataChanges_0(e,new B,!1).build()},z.$metadata$={kind:f,simpleName:"DataSpecEncodeTransforms",interfaces:[]};var D=null;function M(){return null===D&&new z,D}function B(){}function U(){F=this}B.prototype.apply_il3x6g$=function(t,e){if(N.FeatureSwitch.printEncodedDataSummary_d0u64m$("DataFrameOptionHelper.encodeUpdateOption",t),N.FeatureSwitch.USE_DATA_FRAME_ENCODING){var n=I().encode1_x7u0o8$(t);t.clear(),t.putAll_a2k3zr$(n)}},B.$metadata$={kind:d,simpleName:"ServerSideEncodeChange",interfaces:[m]},U.prototype.processTransform_2wxo1b$=function(t){var e=l.Companion.isGGBunchSpec_bkhwtg$(t),n=M().clientSideDecode_6taknv$(e).apply_i49brq$(t);return c.Companion.processTransform_2wxo1b$(n)},U.$metadata$={kind:f,simpleName:"PlotConfigClientSideJvmJs",interfaces:[]};var F=null;var q=t.jetbrains||(t.jetbrains={}),G=q.datalore||(q.datalore={}),H=G.plot||(G.plot={}),Y=H.config||(H.config={}),V=Y.transform||(Y.transform={}),K=V.encode||(V.encode={});K.ClientSideDecodeChange=P,K.ClientSideDecodeOldStyleChange=A,Object.defineProperty(K,"DataFrameEncoding",{get:I}),Object.defineProperty(K,"DataSpecEncodeTransforms",{get:M}),K.ServerSideEncodeChange=B;var W=H.server||(H.server={}),X=W.config||(W.config={});return Object.defineProperty(X,"PlotConfigClientSideJvmJs",{get:function(){return null===F&&new U,F}}),B.prototype.isApplicable_x7u0o8$=m.prototype.isApplicable_x7u0o8$,t})?i.apply(e,r):i)||(t.exports=o)},362:function(t,e,n){var i,r,o;r=[e,n(421),n(521),n(836),n(958),n(767),n(770),n(564),n(623)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o,a,s,l){"use strict";var u=n.jetbrains.livemap.ui.CursorService,c=e.Kind.CLASS,p=e.kotlin.IllegalArgumentException_init_pdl1vj$,h=e.numberToInt,_=e.toString,f=i.jetbrains.datalore.plot.base.geom.PathGeom,d=i.jetbrains.datalore.plot.base.geom.util,m=e.kotlin.collections.ArrayList_init_287e2$,y=e.getCallableRef,$=i.jetbrains.datalore.plot.base.geom.SegmentGeom,v=e.kotlin.collections.ArrayList_init_ww73n8$,g=r.jetbrains.datalore.plot.common.data,b=e.ensureNotNull,w=e.kotlin.collections.emptyList_287e2$,x=o.jetbrains.datalore.base.geometry.DoubleVector,k=e.kotlin.collections.listOf_i5x0yv$,E=e.kotlin.collections.toList_7wnvza$,C=e.equals,S=i.jetbrains.datalore.plot.base.geom.PointGeom,T=o.jetbrains.datalore.base.typedGeometry.explicitVec_y7b45i$,O=Math,N=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,P=i.jetbrains.datalore.plot.base.aes,A=i.jetbrains.datalore.plot.base.Aes,j=e.kotlin.IllegalStateException_init_pdl1vj$,L=e.throwUPAE,R=a.jetbrains.datalore.plot.config.Option.Geom.LiveMap,I=e.throwCCE,z=e.kotlin.Unit,D=n.jetbrains.livemap.config.DevParams,M=n.jetbrains.livemap.config.LiveMapSpec,B=e.kotlin.ranges.IntRange,U=e.Kind.OBJECT,F=e.kotlin.collections.List,q=s.jetbrains.gis.geoprotocol.MapRegion,G=o.jetbrains.datalore.base.spatial.convertToGeoRectangle_i3vl8m$,H=n.jetbrains.livemap.core.projections.ProjectionType,Y=e.kotlin.collections.HashMap_init_q3lmfv$,V=e.kotlin.collections.Map,K=n.jetbrains.livemap.MapLocation,W=n.jetbrains.livemap.tiles,X=o.jetbrains.datalore.base.values.Color,Z=a.jetbrains.datalore.plot.config.getString_wpa7aq$,J=s.jetbrains.gis.tileprotocol.TileService.Theme.valueOf_61zpoe$,Q=n.jetbrains.livemap.api.liveMapVectorTiles_jo61jr$,tt=e.unboxChar,et=e.kotlin.collections.listOf_mh5how$,nt=e.kotlin.ranges.CharRange,it=n.jetbrains.livemap.api.liveMapGeocoding_leryx0$,rt=n.jetbrains.livemap.api,ot=e.kotlin.collections.setOf_i5x0yv$,at=o.jetbrains.datalore.base.spatial,st=o.jetbrains.datalore.base.spatial.pointsBBox_2r9fhj$,lt=o.jetbrains.datalore.base.spatial.makeSegments_8o5yvy$,ut=e.kotlin.collections.checkIndexOverflow_za3lpa$,ct=e.kotlin.collections.Collection,pt=e.kotlin.text.get_indices_gw00vp$,ht=e.toBoxedChar,_t=e.kotlin.ranges.reversed_zf1xzc$,ft=e.kotlin.text.iterator_gw00vp$,dt=i.jetbrains.datalore.plot.base.interact.GeomTargetLocator,mt=i.jetbrains.datalore.plot.base.interact.TipLayoutHint,yt=e.kotlin.collections.emptyMap_q3lmfv$,$t=i.jetbrains.datalore.plot.base.interact.GeomTarget,vt=i.jetbrains.datalore.plot.base.GeomKind,gt=e.kotlin.to_ujzrz7$,bt=i.jetbrains.datalore.plot.base.interact.GeomTargetLocator.LookupResult,wt=e.getPropertyCallableRef,xt=e.kotlin.collections.first_2p1efm$,kt=n.jetbrains.livemap.api.point_4sq48w$,Et=n.jetbrains.livemap.api.points_5t73na$,Ct=n.jetbrains.livemap.api.polygon_z7sk6d$,St=n.jetbrains.livemap.api.polygons_6q4rqs$,Tt=n.jetbrains.livemap.api.path_noshw0$,Ot=n.jetbrains.livemap.api.paths_dvul77$,Nt=n.jetbrains.livemap.api.line_us2cr2$,Pt=n.jetbrains.livemap.api.vLines_t2cee4$,At=n.jetbrains.livemap.api.hLines_t2cee4$,jt=n.jetbrains.livemap.api.text_od6cu8$,Lt=n.jetbrains.livemap.api.texts_mbu85n$,Rt=n.jetbrains.livemap.api.pie_m5p8e8$,It=n.jetbrains.livemap.api.pies_vquu0q$,zt=n.jetbrains.livemap.api.bar_1evwdj$,Dt=n.jetbrains.livemap.api.bars_q7kt7x$,Mt=n.jetbrains.livemap.config.LiveMapFactory,Bt=n.jetbrains.livemap.config.LiveMapCanvasFigure,Ut=o.jetbrains.datalore.base.geometry.Rectangle_init_tjonv8$,Ft=i.jetbrains.datalore.plot.base.geom.LiveMapProvider.LiveMapData,qt=l.jetbrains.datalore.plot.builder,Gt=e.kotlin.collections.drop_ba2ldo$,Ht=n.jetbrains.livemap.ui,Yt=n.jetbrains.livemap.LiveMapLocation,Vt=i.jetbrains.datalore.plot.base.geom.LiveMapProvider,Kt=e.kotlin.collections.checkCountOverflow_za3lpa$,Wt=o.jetbrains.datalore.base.gcommon.collect,Xt=e.kotlin.collections.ArrayList_init_mqih57$,Zt=l.jetbrains.datalore.plot.builder.scale,Jt=i.jetbrains.datalore.plot.base.geom.util.GeomHelper,Qt=i.jetbrains.datalore.plot.base.render.svg.TextLabel.HorizontalAnchor,te=i.jetbrains.datalore.plot.base.render.svg.TextLabel.VerticalAnchor,ee=n.jetbrains.livemap.api.limitCoord_now9aw$,ne=n.jetbrains.livemap.api.geometry_5qim13$,ie=e.kotlin.Enum,re=e.throwISE,oe=e.kotlin.collections.get_lastIndex_55thoc$,ae=e.kotlin.collections.sortedWith_eknfly$,se=e.wrapFunction,le=e.kotlin.Comparator;function ue(){this.cursorService=new u}function ce(t){this.myGeodesic_0=t}function pe(t,e){this.myPointFeatureConverter_0=new de(this,t),this.mySinglePathFeatureConverter_0=new fe(this,t,e),this.myMultiPathFeatureConverter_0=new _e(this,t,e)}function he(t,e,n){this.$outer=t,this.aesthetics_8be2vx$=e,this.myGeodesic_0=n,this.myArrowSpec_0=null,this.myAnimation_0=null}function _e(t,e,n){this.$outer=t,he.call(this,this.$outer,e,n)}function fe(t,e,n){this.$outer=t,he.call(this,this.$outer,e,n)}function de(t,e){this.$outer=t,this.myAesthetics_0=e,this.myAnimation_0=null}function me(t,e){this.myAesthetics_0=t,this.myLayerKind_0=this.getLayerKind_0(e.displayMode),this.myGeodesic_0=e.geodesic,this.myFrameSpecified_0=this.allAesMatch_0(this.myAesthetics_0,y("isFrameSet",function(t,e){return t.isFrameSet_0(e)}.bind(null,this)))}function ye(t,e,n){this.geom=t,this.geomKind=e,this.aesthetics=n}function $e(){Ce(),this.myAesthetics_rxz54u$_0=this.myAesthetics_rxz54u$_0,this.myLayers_u9pl8d$_0=this.myLayers_u9pl8d$_0,this.myLiveMapOptions_92ydlj$_0=this.myLiveMapOptions_92ydlj$_0,this.myDataAccess_85d5nb$_0=this.myDataAccess_85d5nb$_0,this.mySize_1s22w4$_0=this.mySize_1s22w4$_0,this.myDevParams_rps7kc$_0=this.myDevParams_rps7kc$_0,this.myMapLocationConsumer_hhmy08$_0=this.myMapLocationConsumer_hhmy08$_0,this.myCursorService_1uez3k$_0=this.myCursorService_1uez3k$_0,this.minZoom_0=1,this.maxZoom_0=15}function ve(){Ee=this,this.REGION_TYPE_0="type",this.REGION_DATA_0="data",this.REGION_TYPE_NAME_0="region_name",this.REGION_TYPE_IDS_0="region_ids",this.REGION_TYPE_COORDINATES_0="coordinates",this.REGION_TYPE_DATAFRAME_0="data_frame",this.POINT_X_0="lon",this.POINT_Y_0="lat",this.RECT_XMIN_0="lonmin",this.RECT_XMAX_0="lonmax",this.RECT_YMIN_0="latmin",this.RECT_YMAX_0="latmax",this.DEFAULT_SHOW_TILES_0=!0,this.DEFAULT_LOOP_Y_0=!1,this.CYLINDRICAL_PROJECTIONS_0=ot([H.GEOGRAPHIC,H.MERCATOR])}function ge(){be=this,this.URL="url"}_e.prototype=Object.create(he.prototype),_e.prototype.constructor=_e,fe.prototype=Object.create(he.prototype),fe.prototype.constructor=fe,Xe.prototype=Object.create(ie.prototype),Xe.prototype.constructor=Xe,dn.prototype=Object.create(ie.prototype),dn.prototype.constructor=dn,ue.prototype.defaultSetter_o14v8n$=function(t){this.cursorService.default=t},ue.prototype.pointerSetter_o14v8n$=function(t){this.cursorService.pointer=t},ue.$metadata$={kind:c,simpleName:"CursorServiceConfig",interfaces:[]},ce.prototype.createConfigurator_blfxhp$=function(t,e){var n,i,r,o=e.geomKind,a=new pe(e.aesthetics,this.myGeodesic_0);switch(o.name){case"POINT":n=a.toPoint_qbow5e$(e.geom),i=Je();break;case"H_LINE":n=a.toHorizontalLine(),i=en();break;case"V_LINE":n=a.toVerticalLine(),i=nn();break;case"SEGMENT":n=a.toSegment_qbow5e$(e.geom),i=tn();break;case"RECT":n=a.toRect(),i=Qe();break;case"TILE":case"BIN_2D":n=a.toTile(),i=Qe();break;case"DENSITY2D":case"CONTOUR":case"PATH":n=a.toPath_qbow5e$(e.geom),i=tn();break;case"TEXT":n=a.toText(),i=rn();break;case"DENSITY2DF":case"CONTOURF":case"POLYGON":case"MAP":n=a.toPolygon(),i=Qe();break;default:throw p("Layer '"+o.name+"' is not supported on Live Map.")}for(r=n.iterator();r.hasNext();)r.next().layerIndex=t+1|0;return Ye().createLayersConfigurator_7kwpjf$(i,n)},pe.prototype.toPoint_qbow5e$=function(t){return this.myPointFeatureConverter_0.point_n4jwzf$(t)},pe.prototype.toHorizontalLine=function(){return this.myPointFeatureConverter_0.hLine_8be2vx$()},pe.prototype.toVerticalLine=function(){return this.myPointFeatureConverter_0.vLine_8be2vx$()},pe.prototype.toSegment_qbow5e$=function(t){return this.mySinglePathFeatureConverter_0.segment_n4jwzf$(t)},pe.prototype.toRect=function(){return this.myMultiPathFeatureConverter_0.rect_8be2vx$()},pe.prototype.toTile=function(){return this.mySinglePathFeatureConverter_0.tile_8be2vx$()},pe.prototype.toPath_qbow5e$=function(t){return this.myMultiPathFeatureConverter_0.path_n4jwzf$(t)},pe.prototype.toPolygon=function(){return this.myMultiPathFeatureConverter_0.polygon_8be2vx$()},pe.prototype.toText=function(){return this.myPointFeatureConverter_0.text_8be2vx$()},he.prototype.parsePathAnimation_0=function(t){if(null==t)return null;if(e.isNumber(t))return h(t);if("string"==typeof t)switch(t){case"dash":return 1;case"plane":return 2;case"circle":return 3}throw p("Unknown path animation: '"+_(t)+"'")},he.prototype.pathToBuilder_zbovrq$=function(t,e,n){return Ke(t,this.getRender_0(n)).setGeometryData_5qim13$(e,n,this.myGeodesic_0).setArrowSpec_la4xi3$(this.myArrowSpec_0).setAnimation_s8ev37$(this.myAnimation_0)},he.prototype.getRender_0=function(t){return t?Qe():tn()},he.prototype.setArrowSpec_28xgda$=function(t){this.myArrowSpec_0=t},he.prototype.setAnimation_8ea4ql$=function(t){this.myAnimation_0=this.parsePathAnimation_0(t)},he.$metadata$={kind:c,simpleName:"PathFeatureConverterBase",interfaces:[]},_e.prototype.path_n4jwzf$=function(t){return this.setAnimation_8ea4ql$(e.isType(t,f)?t.animation:null),this.process_0(this.multiPointDataByGroup_0(d.MultiPointDataConstructor.singlePointAppender_v9bvvf$(d.GeomUtil.TO_LOCATION_X_Y)),!1)},_e.prototype.polygon_8be2vx$=function(){return this.process_0(this.multiPointDataByGroup_0(d.MultiPointDataConstructor.singlePointAppender_v9bvvf$(d.GeomUtil.TO_LOCATION_X_Y)),!0)},_e.prototype.rect_8be2vx$=function(){return this.process_0(this.multiPointDataByGroup_0(d.MultiPointDataConstructor.multiPointAppender_t2aup3$(d.GeomUtil.TO_RECTANGLE)),!0)},_e.prototype.multiPointDataByGroup_0=function(t){return d.MultiPointDataConstructor.createMultiPointDataByGroup_ugj9hh$(this.aesthetics_8be2vx$.dataPoints(),t,d.MultiPointDataConstructor.collector())},_e.prototype.process_0=function(t,e){var n,i=m();for(n=t.iterator();n.hasNext();){var r=n.next(),o=this.pathToBuilder_zbovrq$(r.aes,this.$outer.toVecs_0(r.points),e);y("add",function(t,e){return t.add_11rb$(e)}.bind(null,i))(o)}return i},_e.$metadata$={kind:c,simpleName:"MultiPathFeatureConverter",interfaces:[he]},fe.prototype.tile_8be2vx$=function(){return this.process_0(!0,this.tileGeometryGenerator_0())},fe.prototype.segment_n4jwzf$=function(t){return this.setArrowSpec_28xgda$(e.isType(t,$)?t.arrowSpec:null),this.setAnimation_8ea4ql$(e.isType(t,$)?t.animation:null),this.process_0(!1,y("pointToSegmentGeometry",function(t,e){return t.pointToSegmentGeometry_0(e)}.bind(null,this)))},fe.prototype.process_0=function(t,e){var n,i=v(this.aesthetics_8be2vx$.dataPointCount());for(n=this.aesthetics_8be2vx$.dataPoints().iterator();n.hasNext();){var r=n.next(),o=e(r);if(!o.isEmpty()){var a=this.pathToBuilder_zbovrq$(r,this.$outer.toVecs_0(o),t);y("add",function(t,e){return t.add_11rb$(e)}.bind(null,i))(a)}}return i.trimToSize(),i},fe.prototype.tileGeometryGenerator_0=function(){return t=this.getMinXYNonZeroDistance_0(this.aesthetics_8be2vx$),e=this,function(n){if(g.SeriesUtil.allFinite_rd1tgs$(n.x(),n.y(),n.width(),n.height())){var i=e.nonZero_0(b(n.width())*t.x,1),r=e.nonZero_0(b(n.height())*t.y,1);return d.GeomUtil.rectToGeometry_6y0v78$(b(n.x())-i/2,b(n.y())-r/2,b(n.x())+i/2,b(n.y())+r/2)}return w()};var t,e},fe.prototype.pointToSegmentGeometry_0=function(t){return g.SeriesUtil.allFinite_rd1tgs$(t.x(),t.y(),t.xend(),t.yend())?k([new x(b(t.x()),b(t.y())),new x(b(t.xend()),b(t.yend()))]):w()},fe.prototype.nonZero_0=function(t,e){return 0===t?e:t},fe.prototype.getMinXYNonZeroDistance_0=function(t){var e=E(t.dataPoints());if(e.size<2)return x.Companion.ZERO;for(var n=0,i=0,r=0,o=e.size-1|0;rh)throw p("Error parsing subdomains: wrong brackets order");var _,f=l+1|0,d=t.substring(f,h);if(0===d.length)throw p("Empty subdomains list");t:do{var m;for(m=ft(d);m.hasNext();){var y=tt(m.next()),$=ht(y),g=new nt(97,122),b=tt($);if(!g.contains_mef7kx$(String.fromCharCode(b).toLowerCase().charCodeAt(0))){_=!0;break t}}_=!1}while(0);if(_)throw p("subdomain list contains non-letter symbols");var w,x=t.substring(0,l),k=h+1|0,E=t.length,C=t.substring(k,E),S=v(d.length);for(w=ft(d);w.hasNext();){var T=tt(w.next()),O=S.add_11rb$,N=ht(T);O.call(S,x+String.fromCharCode(N)+C)}return S},ve.prototype.createGeocodingService_0=function(t){var n,i,r,o,a=we().URL;return null!=(i=null!=(n=(e.isType(r=t,V)?r:I()).get_11rb$(a))?it((o=n,function(t){var e;return t.url="string"==typeof(e=o)?e:I(),z})):null)?i:rt.Services.bogusGeocodingService()},ve.$metadata$={kind:U,simpleName:"Companion",interfaces:[]};var Ee=null;function Ce(){return null===Ee&&new ve,Ee}function Se(){Te=this}Se.prototype.calculateBoundingBox_d3e2cz$=function(t){return st(at.BBOX_CALCULATOR,t)},Se.prototype.calculateBoundingBox_2a5262$=function(t,e){if(t.size!==e.size)throw p("Longitude list count is not equal Latitude list count.".toString());return at.BBOX_CALCULATOR.calculateBoundingBox_qpfwx8$(lt(y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,t)),y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,t)),t.size),lt(y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,e)),y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,e)),t.size))},Se.prototype.calculateBoundingBox_55b83s$=function(t,e,n,i){var r=t.size;if(e.size!==r||n.size!==r||i.size!==r)throw p("Counts of 'minLongitudes', 'minLatitudes', 'maxLongitudes', 'maxLatitudes' lists are not equal.".toString());return at.BBOX_CALCULATOR.calculateBoundingBox_qpfwx8$(lt(y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,t)),y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,n)),r),lt(y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,e)),y("get",function(t,e){return t.get_za3lpa$(e)}.bind(null,i)),r))},Se.$metadata$={kind:U,simpleName:"BboxUtil",interfaces:[]};var Te=null;function Oe(){return null===Te&&new Se,Te}function Ne(t,e){var n;this.myTargetSource_0=e,this.myLiveMap_0=null,t.map_2o04qz$((n=this,function(t){return n.myLiveMap_0=t,z}))}function Pe(){He=this}function Ae(t,e){return function(n){switch(t.name){case"POINT":Et(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toPointBuilder())&&y("point",function(t,e){return kt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"POLYGON":St(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i=n.next();Ct(e,i.createPolygonConfigurator())}return z}}(e));break;case"PATH":Ot(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toPathBuilder())&&y("path",function(t,e){return Tt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"V_LINE":Pt(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toLineBuilder())&&y("line",function(t,e){return Nt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"H_LINE":At(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toLineBuilder())&&y("line",function(t,e){return Nt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"TEXT":Lt(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toTextBuilder())&&y("text",function(t,e){return jt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"PIE":It(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toChartBuilder())&&y("pie",function(t,e){return Rt(t,e),z}.bind(null,e))(i)}return z}}(e));break;case"BAR":Dt(n,function(t){return function(e){var n;for(n=t.iterator();n.hasNext();){var i;null!=(i=n.next().toChartBuilder())&&y("bar",function(t,e){return zt(t,e),z}.bind(null,e))(i)}return z}}(e));break;default:throw j(("Unsupported layer kind: "+t).toString())}return z}}function je(t,e,n){if(this.myLiveMapOptions_0=e,this.liveMapSpecBuilder_0=null,this.myTargetSource_0=Y(),t.isEmpty())throw p("Failed requirement.".toString());if(!xt(t).isLiveMap)throw p("geom_livemap have to be the very first geom after ggplot()".toString());var i,r,o,a=Le,s=v(N(t,10));for(i=t.iterator();i.hasNext();){var l=i.next();s.add_11rb$(a(l))}var u=0;for(r=s.iterator();r.hasNext();){var c,h=r.next(),_=ut((u=(o=u)+1|0,o));for(c=h.aesthetics.dataPoints().iterator();c.hasNext();){var f=c.next(),d=this.myTargetSource_0,m=gt(_,f.index()),y=h.contextualMapping;d.put_xwzc9p$(m,y)}}var $,g=Gt(t,1),b=v(N(g,10));for($=g.iterator();$.hasNext();){var w=$.next();b.add_11rb$(a(w))}var x,k=v(N(b,10));for(x=b.iterator();x.hasNext();){var E=x.next();k.add_11rb$(new ye(E.geom,E.geomKind,E.aesthetics))}var C=k,S=a(xt(t));this.liveMapSpecBuilder_0=(new $e).liveMapOptions_d2y5pu$(this.myLiveMapOptions_0).aesthetics_m7huy5$(S.aesthetics).dataAccess_c3j6od$(S.dataAccess).layers_ipzze3$(C).devParams_5pp8sb$(new D(this.myLiveMapOptions_0.devParams)).mapLocationConsumer_te0ohe$(Re).cursorService_kmk1wb$(n)}function Le(t){return qt.LayerRendererUtil.createLayerRendererData_knseyn$(t,yt(),yt())}function Re(t){return Ht.Clipboard.copy_61zpoe$(Yt.Companion.getLocationString_wthzt5$(t)),z}$e.$metadata$={kind:c,simpleName:"LiveMapSpecBuilder",interfaces:[]},Ne.prototype.search_gpjtzr$=function(t){var e,n,i;if(null!=(n=null!=(e=this.myLiveMap_0)?e.searchResult():null)){var r,o,a;if(r=et(new $t(n.index,mt.Companion.cursorTooltip_itpcqk$(t,n.color),yt())),o=vt.LIVE_MAP,null==(a=this.myTargetSource_0.get_11rb$(gt(n.layerIndex,n.index))))throw j("Can't find target.".toString());i=new bt(r,0,o,a,!1)}else i=null;return i},Ne.$metadata$={kind:c,simpleName:"LiveMapTargetLocator",interfaces:[dt]},Pe.prototype.injectLiveMapProvider_q1corz$=function(t,n,i){var r;for(r=t.iterator();r.hasNext();){var o,a=r.next(),s=wt("isLiveMap",1,(function(t){return t.isLiveMap}));t:do{var l;if(e.isType(a,ct)&&a.isEmpty()){o=!1;break t}for(l=a.iterator();l.hasNext();)if(s(l.next())){o=!0;break t}o=!1}while(0);if(o){var u,c=wt("isLiveMap",1,(function(t){return t.isLiveMap}));t:do{var h;if(e.isType(a,ct)&&a.isEmpty()){u=0;break t}var _=0;for(h=a.iterator();h.hasNext();)c(h.next())&&Kt(_=_+1|0);u=_}while(0);if(1!==u)throw p("Failed requirement.".toString());if(!xt(a).isLiveMap)throw p("Failed requirement.".toString());xt(a).setLiveMapProvider_kld0fp$(new je(a,n,i.cursorService))}}},Pe.prototype.createLayersConfigurator_7kwpjf$=function(t,e){return Ae(t,e)},je.prototype.createLiveMap_wthzt5$=function(t){var e=new Mt(this.liveMapSpecBuilder_0.size_gpjtzr$(t.dimension).build()).createLiveMap(),n=new Bt(e);return n.setBounds_vfns7u$(Ut(h(t.origin.x),h(t.origin.y),h(t.dimension.x),h(t.dimension.y))),new Ft(n,new Ne(e,this.myTargetSource_0))},je.$metadata$={kind:c,simpleName:"MyLiveMapProvider",interfaces:[Vt]},Pe.$metadata$={kind:U,simpleName:"LiveMapUtil",interfaces:[]};var Ie,ze,De,Me,Be,Ue,Fe,qe,Ge,He=null;function Ye(){return null===He&&new Pe,He}function Ve(){this.myP_0=null,this.indices_0=w(),this.myArrowSpec_0=null,this.myValueArray_0=w(),this.myColorArray_0=w(),this.myLayerKind=null,this.geometry=null,this.point=null,this.animation=0,this.geodesic=!1,this.layerIndex=null}function Ke(t,e,n){return n=n||Object.create(Ve.prototype),Ve.call(n),n.myLayerKind=e,n.myP_0=t,n}function We(t,e,n){return n=n||Object.create(Ve.prototype),Ve.call(n),n.myLayerKind=e,n.myP_0=t.aes,n.indices_0=t.indices,n.myValueArray_0=t.values,n.myColorArray_0=t.colors,n}function Xe(t,e){ie.call(this),this.name$=t,this.ordinal$=e}function Ze(){Ze=function(){},Ie=new Xe("POINT",0),ze=new Xe("POLYGON",1),De=new Xe("PATH",2),Me=new Xe("H_LINE",3),Be=new Xe("V_LINE",4),Ue=new Xe("TEXT",5),Fe=new Xe("PIE",6),qe=new Xe("BAR",7),Ge=new Xe("HEATMAP",8)}function Je(){return Ze(),Ie}function Qe(){return Ze(),ze}function tn(){return Ze(),De}function en(){return Ze(),Me}function nn(){return Ze(),Be}function rn(){return Ze(),Ue}function on(){return Ze(),Fe}function an(){return Ze(),qe}function sn(){return Ze(),Ge}Object.defineProperty(Ve.prototype,"index",{configurable:!0,get:function(){return this.myP_0.index()}}),Object.defineProperty(Ve.prototype,"shape",{configurable:!0,get:function(){return b(this.myP_0.shape()).code}}),Object.defineProperty(Ve.prototype,"size",{configurable:!0,get:function(){return P.AestheticsUtil.textSize_l6g9mh$(this.myP_0)}}),Object.defineProperty(Ve.prototype,"speed",{configurable:!0,get:function(){return b(this.myP_0.speed())}}),Object.defineProperty(Ve.prototype,"flow",{configurable:!0,get:function(){return b(this.myP_0.flow())}}),Object.defineProperty(Ve.prototype,"fillColor",{configurable:!0,get:function(){return this.colorWithAlpha_0(b(this.myP_0.fill()))}}),Object.defineProperty(Ve.prototype,"strokeColor",{configurable:!0,get:function(){return C(this.myLayerKind,Qe())?b(this.myP_0.color()):this.colorWithAlpha_0(b(this.myP_0.color()))}}),Object.defineProperty(Ve.prototype,"label",{configurable:!0,get:function(){var t,e;return null!=(e=null!=(t=this.myP_0.label())?t.toString():null)?e:"n/a"}}),Object.defineProperty(Ve.prototype,"family",{configurable:!0,get:function(){return this.myP_0.family()}}),Object.defineProperty(Ve.prototype,"hjust",{configurable:!0,get:function(){return this.hjust_0(this.myP_0.hjust())}}),Object.defineProperty(Ve.prototype,"vjust",{configurable:!0,get:function(){return this.vjust_0(this.myP_0.vjust())}}),Object.defineProperty(Ve.prototype,"angle",{configurable:!0,get:function(){return b(this.myP_0.angle())}}),Object.defineProperty(Ve.prototype,"fontface",{configurable:!0,get:function(){var t=this.myP_0.fontface();return C(t,P.AesInitValue.get_31786j$(A.Companion.FONTFACE))?"":t}}),Object.defineProperty(Ve.prototype,"radius",{configurable:!0,get:function(){switch(this.myLayerKind.name){case"POLYGON":case"PATH":case"H_LINE":case"V_LINE":case"POINT":case"PIE":case"BAR":var t=b(this.myP_0.shape()).size_l6g9mh$(this.myP_0)/2;return O.ceil(t);case"HEATMAP":return b(this.myP_0.size());case"TEXT":return 0;default:return e.noWhenBranchMatched()}}}),Object.defineProperty(Ve.prototype,"strokeWidth",{configurable:!0,get:function(){switch(this.myLayerKind.name){case"POLYGON":case"PATH":case"H_LINE":case"V_LINE":return P.AestheticsUtil.strokeWidth_l6g9mh$(this.myP_0);case"POINT":case"PIE":case"BAR":return 1;case"TEXT":case"HEATMAP":return 0;default:return e.noWhenBranchMatched()}}}),Object.defineProperty(Ve.prototype,"lineDash",{configurable:!0,get:function(){var t=this.myP_0.lineType();if(t.isSolid||t.isBlank)return w();var e,n=P.AestheticsUtil.strokeWidth_l6g9mh$(this.myP_0);return Xt(Wt.Lists.transform_l7riir$(t.dashArray,(e=n,function(t){return t*e})))}}),Object.defineProperty(Ve.prototype,"colorArray_0",{configurable:!0,get:function(){return this.myLayerKind===on()&&this.allZeroes_0(this.myValueArray_0)?this.createNaColorList_0(this.myValueArray_0.size):this.myColorArray_0}}),Ve.prototype.allZeroes_0=function(t){var n,i=y("equals",function(t,e){return C(t,e)}.bind(null,0));t:do{var r;if(e.isType(t,ct)&&t.isEmpty()){n=!0;break t}for(r=t.iterator();r.hasNext();)if(!i(r.next())){n=!1;break t}n=!0}while(0);return n},Ve.prototype.createNaColorList_0=function(t){for(var e=v(t),n=0;n0&&(a=a+"/"+l);var u=a;return d(o).replaceFirst_x2uqeu$(t,u)},le.prototype.scaleFontValue_0=function(t,e){return null==t?"":(t*e).toString()+"px"},le.$metadata$={kind:s,simpleName:"CssStyleUtil",interfaces:[]};var ue=null;function ce(){this.myLastTick_0=g,this.myDt_0=g}function pe(){}function he(t,e){return function(n){return e.schedule_klfg04$(function(t,e){return function(){return t.success_11rb$(e),w}}(t,n)),w}}function _e(t,e){return function(n){return e.schedule_klfg04$(function(t,e){return function(){return t.failure_tcv7n7$(e),w}}(t,n)),w}}function fe(t){this.myEventHandlers_51nth5$_0=E()}function de(t,e,n){this.closure$addReg=t,this.this$EventPeer=e,this.closure$eventSpec=n}function me(t){this.closure$event=t}function ye(t,e,n){this.size_mf5u5r$_0=e,this.context2d_imt5ib$_0=1===n?t:new $e(t,n)}function $e(t,e){this.myContext2d_0=t,this.myScale_0=e}function ve(t){this.myCanvasControl_0=t,this.canvas=null,this.canvas=this.myCanvasControl_0.createCanvas_119tl4$(this.myCanvasControl_0.size),this.myCanvasControl_0.addChild_eqkm0m$(this.canvas)}function ge(){}function be(){this.myHandle_0=null,this.myIsStarted_0=!1,this.myIsStarted_0=!1}function we(t,n,i){var r;Ce(),ye.call(this,new Pe(e.isType(r=t.getContext("2d"),CanvasRenderingContext2D)?r:$()),n,i),this.canvasElement=t,N(this.canvasElement.style,n.x),P(this.canvasElement.style,n.y);var o=this.canvasElement,a=n.x*i;o.width=A(j.ceil(a));var s=this.canvasElement,l=n.y*i;s.height=A(j.ceil(l))}function xe(t){this.$outer=t}function ke(){Ee=this,this.DEVICE_PIXEL_RATIO=window.devicePixelRatio}ce.prototype.tick_s8cxhz$=function(t){return this.myLastTick_0.toNumber()>0&&(this.myDt_0=t.subtract(this.myLastTick_0)),this.myLastTick_0=t,this.myDt_0},ce.prototype.dt=function(){return this.myDt_0},ce.$metadata$={kind:a,simpleName:"DeltaTime",interfaces:[]},pe.$metadata$={kind:o,simpleName:"Dispatcher",interfaces:[]},de.prototype.dispose=function(){this.closure$addReg.remove(),u(this.this$EventPeer.myEventHandlers_51nth5$_0.get_11rb$(this.closure$eventSpec)).isEmpty&&(this.this$EventPeer.myEventHandlers_51nth5$_0.remove_11rb$(this.closure$eventSpec),this.this$EventPeer.onSpecRemoved_1gkqfp$(this.closure$eventSpec))},de.$metadata$={kind:a,interfaces:[p]},fe.prototype.addEventHandler_b14a3c$=function(t,e){if(!this.myEventHandlers_51nth5$_0.containsKey_11rb$(t)){var n=this.myEventHandlers_51nth5$_0,i=new x;n.put_xwzc9p$(t,i),this.onSpecAdded_1gkqfp$(t)}var r=u(this.myEventHandlers_51nth5$_0.get_11rb$(t)).add_11rb$(e);return c.Companion.from_gg3y3y$(new de(r,this,t))},me.prototype.call_11rb$=function(t){t.onEvent_11rb$(this.closure$event)},me.$metadata$={kind:a,interfaces:[k]},fe.prototype.dispatch_b6y3vz$=function(t,e){var n;null!=(n=this.myEventHandlers_51nth5$_0.get_11rb$(t))&&n.fire_kucmxw$(new me(e))},fe.$metadata$={kind:a,simpleName:"EventPeer",interfaces:[]},Object.defineProperty(ye.prototype,"size",{get:function(){return this.size_mf5u5r$_0}}),Object.defineProperty(ye.prototype,"context2d",{configurable:!0,get:function(){return this.context2d_imt5ib$_0}}),ye.$metadata$={kind:a,simpleName:"ScaledCanvas",interfaces:[Q]},$e.prototype.scaled_0=function(t){return this.myScale_0*t},$e.prototype.descaled_0=function(t){return t/this.myScale_0},$e.prototype.scaled_1=function(t){if(1===this.myScale_0)return t;for(var e=new Float64Array(t.length),n=0;n!==t.length;++n)e[n]=this.scaled_0(t[n]);return e},$e.prototype.scaled_2=function(t){return t.copy_edneyn$(void 0,void 0,t.fontSize*this.myScale_0)},$e.prototype.drawImage_xo47pw$=function(t,e,n){this.myContext2d_0.drawImage_xo47pw$(t,this.scaled_0(e),this.scaled_0(n))},$e.prototype.drawImage_nks7bk$=function(t,e,n,i,r){this.myContext2d_0.drawImage_nks7bk$(t,this.scaled_0(e),this.scaled_0(n),this.scaled_0(i),this.scaled_0(r))},$e.prototype.drawImage_urnjjc$=function(t,e,n,i,r,o,a,s,l){this.myContext2d_0.drawImage_urnjjc$(t,this.scaled_0(e),this.scaled_0(n),this.scaled_0(i),this.scaled_0(r),this.scaled_0(o),this.scaled_0(a),this.scaled_0(s),this.scaled_0(l))},$e.prototype.beginPath=function(){this.myContext2d_0.beginPath()},$e.prototype.closePath=function(){this.myContext2d_0.closePath()},$e.prototype.stroke=function(){this.myContext2d_0.stroke()},$e.prototype.fill=function(){this.myContext2d_0.fill()},$e.prototype.fillRect_6y0v78$=function(t,e,n,i){this.myContext2d_0.fillRect_6y0v78$(this.scaled_0(t),this.scaled_0(e),this.scaled_0(n),this.scaled_0(i))},$e.prototype.moveTo_lu1900$=function(t,e){this.myContext2d_0.moveTo_lu1900$(this.scaled_0(t),this.scaled_0(e))},$e.prototype.lineTo_lu1900$=function(t,e){this.myContext2d_0.lineTo_lu1900$(this.scaled_0(t),this.scaled_0(e))},$e.prototype.arc_6p3vsx$$default=function(t,e,n,i,r,o){this.myContext2d_0.arc_6p3vsx$(this.scaled_0(t),this.scaled_0(e),this.scaled_0(n),i,r,o)},$e.prototype.save=function(){this.myContext2d_0.save()},$e.prototype.restore=function(){this.myContext2d_0.restore()},$e.prototype.setFillStyle_2160e9$=function(t){this.myContext2d_0.setFillStyle_2160e9$(t)},$e.prototype.setStrokeStyle_2160e9$=function(t){this.myContext2d_0.setStrokeStyle_2160e9$(t)},$e.prototype.setGlobalAlpha_14dthe$=function(t){this.myContext2d_0.setGlobalAlpha_14dthe$(t)},$e.prototype.setFont_ov8mpe$=function(t){this.myContext2d_0.setFont_ov8mpe$(this.scaled_2(t))},$e.prototype.setLineWidth_14dthe$=function(t){this.myContext2d_0.setLineWidth_14dthe$(this.scaled_0(t))},$e.prototype.strokeRect_6y0v78$=function(t,e,n,i){this.myContext2d_0.strokeRect_6y0v78$(this.scaled_0(t),this.scaled_0(e),this.scaled_0(n),this.scaled_0(i))},$e.prototype.strokeText_ai6r6m$=function(t,e,n){this.myContext2d_0.strokeText_ai6r6m$(t,this.scaled_0(e),this.scaled_0(n))},$e.prototype.fillText_ai6r6m$=function(t,e,n){this.myContext2d_0.fillText_ai6r6m$(t,this.scaled_0(e),this.scaled_0(n))},$e.prototype.scale_lu1900$=function(t,e){this.myContext2d_0.scale_lu1900$(t,e)},$e.prototype.rotate_14dthe$=function(t){this.myContext2d_0.rotate_14dthe$(t)},$e.prototype.translate_lu1900$=function(t,e){this.myContext2d_0.translate_lu1900$(this.scaled_0(t),this.scaled_0(e))},$e.prototype.transform_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.transform_15yvbs$(t,e,n,i,this.scaled_0(r),this.scaled_0(o))},$e.prototype.bezierCurveTo_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.bezierCurveTo_15yvbs$(this.scaled_0(t),this.scaled_0(e),this.scaled_0(n),this.scaled_0(i),this.scaled_0(r),this.scaled_0(o))},$e.prototype.setLineJoin_v2gigt$=function(t){this.myContext2d_0.setLineJoin_v2gigt$(t)},$e.prototype.setLineCap_useuqn$=function(t){this.myContext2d_0.setLineCap_useuqn$(t)},$e.prototype.setTextBaseline_5cz80h$=function(t){this.myContext2d_0.setTextBaseline_5cz80h$(t)},$e.prototype.setTextAlign_iwro1z$=function(t){this.myContext2d_0.setTextAlign_iwro1z$(t)},$e.prototype.setTransform_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.setTransform_15yvbs$(t,e,n,i,this.scaled_0(r),this.scaled_0(o))},$e.prototype.fillEvenOdd=function(){this.myContext2d_0.fillEvenOdd()},$e.prototype.setLineDash_gf7tl1$=function(t){this.myContext2d_0.setLineDash_gf7tl1$(this.scaled_1(t))},$e.prototype.measureText_61zpoe$=function(t){return this.descaled_0(this.myContext2d_0.measureText_61zpoe$(t))},$e.prototype.clearRect_wthzt5$=function(t){this.myContext2d_0.clearRect_wthzt5$(new C(t.origin.mul_14dthe$(2),t.dimension.mul_14dthe$(2)))},$e.$metadata$={kind:a,simpleName:"ScaledContext2d",interfaces:[kt]},Object.defineProperty(ve.prototype,"context",{configurable:!0,get:function(){return this.canvas.context2d}}),Object.defineProperty(ve.prototype,"size",{configurable:!0,get:function(){return this.myCanvasControl_0.size}}),ve.prototype.createCanvas=function(){return this.myCanvasControl_0.createCanvas_119tl4$(this.myCanvasControl_0.size)},ve.prototype.dispose=function(){this.myCanvasControl_0.removeChild_eqkm0m$(this.canvas)},ve.$metadata$={kind:a,simpleName:"SingleCanvasControl",interfaces:[]},ge.$metadata$={kind:o,simpleName:"CanvasFigure",interfaces:[S]},be.prototype.start=function(){this.myIsStarted_0||(this.myIsStarted_0=!0,this.requestNextFrame_0())},be.prototype.stop=function(){this.myIsStarted_0&&(this.myIsStarted_0=!1,window.cancelAnimationFrame(u(this.myHandle_0)))},be.prototype.execute_0=function(t){this.myIsStarted_0&&(this.handle_s8cxhz$(e.Long.fromNumber(t)),this.requestNextFrame_0())},be.prototype.requestNextFrame_0=function(){var t;this.myHandle_0=window.requestAnimationFrame((t=this,function(e){return t.execute_0(e),w}))},be.$metadata$={kind:a,simpleName:"DomAnimationTimer",interfaces:[V]},we.prototype.takeSnapshot=function(){return O.Asyncs.constant_mh5how$(new xe(this))},Object.defineProperty(xe.prototype,"canvasElement",{configurable:!0,get:function(){return this.$outer.canvasElement}}),xe.$metadata$={kind:a,simpleName:"DomSnapshot",interfaces:[tt]},ke.prototype.create_duqvgq$=function(t,n){var i;return new we(e.isType(i=document.createElement("canvas"),HTMLCanvasElement)?i:$(),t,n)},ke.$metadata$={kind:s,simpleName:"Companion",interfaces:[]};var Ee=null;function Ce(){return null===Ee&&new ke,Ee}function Se(t,e,n){this.myRootElement_0=t,this.size_malc5o$_0=e,this.myEventPeer_0=n}function Te(t){this.closure$eventHandler=t,be.call(this)}function Oe(t,n,i,r){return function(o){var a,s,l;if(null!=t){var u,c=t;l=e.isType(u=n.createCanvas_119tl4$(c),we)?u:$()}else l=null;var p=null!=(a=l)?a:Ce().create_duqvgq$(new M(i.width,i.height),1);return(e.isType(s=p.canvasElement.getContext("2d"),CanvasRenderingContext2D)?s:$()).drawImage(i,0,0,p.canvasElement.width,p.canvasElement.height),p.takeSnapshot().onSuccess_qlkmfe$(function(t){return function(e){return t(e),w}}(r))}}function Ne(t,e){var n;fe.call(this,q(G)),this.myEventTarget_0=t,this.myTargetBounds_0=e,this.myButtonPressed_0=!1,this.myWasDragged_0=!1,this.myButtonPressCoord_0=null,this.myDragToleranceDistance_0=3,this.handle_0(U.Companion.MOUSE_ENTER,(n=this,function(t){if(n.isHitOnTarget_0(t))return n.dispatch_b6y3vz$(G.MOUSE_ENTERED,n.translate_0(t)),w})),this.handle_0(U.Companion.MOUSE_LEAVE,function(t){return function(e){if(t.isHitOnTarget_0(e))return t.dispatch_b6y3vz$(G.MOUSE_LEFT,t.translate_0(e)),w}}(this)),this.handle_0(U.Companion.CLICK,function(t){return function(e){if(!t.myWasDragged_0){if(!t.isHitOnTarget_0(e))return;t.dispatch_b6y3vz$(G.MOUSE_CLICKED,t.translate_0(e))}return t.myWasDragged_0=!1,w}}(this)),this.handle_0(U.Companion.DOUBLE_CLICK,function(t){return function(e){if(t.isHitOnTarget_0(e))return t.dispatch_b6y3vz$(G.MOUSE_DOUBLE_CLICKED,t.translate_0(e)),w}}(this)),this.handle_0(U.Companion.MOUSE_DOWN,function(t){return function(e){if(t.isHitOnTarget_0(e))return t.myButtonPressed_0=!0,t.myButtonPressCoord_0=new M(A(e.x),A(e.y)),t.dispatch_b6y3vz$(G.MOUSE_PRESSED,F.DomEventUtil.translateInPageCoord_tfvzir$(e)),w}}(this)),this.handle_0(U.Companion.MOUSE_UP,function(t){return function(e){return t.myButtonPressed_0=!1,t.myButtonPressCoord_0=null,t.dispatch_b6y3vz$(G.MOUSE_RELEASED,t.translate_0(e)),w}}(this)),this.handle_0(U.Companion.MOUSE_MOVE,function(t){return function(e){var n,i,r;if(t.myWasDragged_0)t.dispatch_b6y3vz$(G.MOUSE_DRAGGED,F.DomEventUtil.translateInPageCoord_tfvzir$(e));else if(t.myButtonPressed_0&&!t.myWasDragged_0)(null!=(r=null!=(i=null!=(n=t.myButtonPressCoord_0)?n.sub_119tl4$(new M(A(e.x),A(e.y))):null)?i.length():null)?r:0)>t.myDragToleranceDistance_0&&(t.myWasDragged_0=!0,t.dispatch_b6y3vz$(G.MOUSE_DRAGGED,F.DomEventUtil.translateInPageCoord_tfvzir$(e)));else if(!t.myButtonPressed_0&&!t.myWasDragged_0){if(!t.isHitOnTarget_0(e))return;t.dispatch_b6y3vz$(G.MOUSE_MOVED,t.translate_0(e))}return w}}(this))}function Pe(t){this.myContext2d_0=t}we.$metadata$={kind:a,simpleName:"DomCanvas",interfaces:[ye]},Object.defineProperty(Se.prototype,"size",{get:function(){return this.size_malc5o$_0}}),Te.prototype.handle_s8cxhz$=function(t){this.closure$eventHandler.onEvent_s8cxhz$(t)},Te.$metadata$={kind:a,interfaces:[be]},Se.prototype.createAnimationTimer_ckdfex$=function(t){return new Te(t)},Se.prototype.addEventHandler_mfdhbe$=function(t,e){return this.myEventPeer_0.addEventHandler_b14a3c$(t,L((n=e,function(t){return n.onEvent_11rb$(t),w})));var n},Se.prototype.createCanvas_119tl4$=function(t){var e=Ce().create_duqvgq$(t,Ce().DEVICE_PIXEL_RATIO);return I(e.canvasElement.style,R.ABSOLUTE),e},Se.prototype.createSnapshot_61zpoe$=function(t){return this.createSnapshotAsync_0(t,null)},Se.prototype.createSnapshot_50eegg$=function(t,e){var n={type:"image/png"};return this.createSnapshotAsync_0(URL.createObjectURL(new Blob([t],n)),e)},Se.prototype.createSnapshotAsync_0=function(t,e){void 0===e&&(e=null);var n=new z,i=new Image;return i.onload=this.onLoad_0(i,e,D("success",function(t,e){return t.success_11rb$(e),w}.bind(null,n))),i.src=t,n},Se.prototype.onLoad_0=function(t,e,n){return Oe(e,this,t,n)},Se.prototype.addChild_eqkm0m$=function(t){var n;this.myRootElement_0.appendChild((e.isType(n=t,we)?n:$()).canvasElement)},Se.prototype.addChild_fwfip8$=function(t,n){var i;this.myRootElement_0.insertBefore((e.isType(i=n,we)?i:$()).canvasElement,this.myRootElement_0.childNodes[t])},Se.prototype.removeChild_eqkm0m$=function(t){var n;this.myRootElement_0.removeChild((e.isType(n=t,we)?n:$()).canvasElement)},Se.prototype.schedule_klfg04$=function(t){t()},Ne.prototype.handle_0=function(t,e){var n;this.targetNode_0(t).addEventListener(t.name,new B((n=e,function(t){return n(t),!1})))},Ne.prototype.targetNode_0=function(t){return T(t,U.Companion.MOUSE_MOVE)||T(t,U.Companion.MOUSE_UP)?document:this.myEventTarget_0},Ne.prototype.onSpecAdded_1gkqfp$=function(t){},Ne.prototype.onSpecRemoved_1gkqfp$=function(t){},Ne.prototype.isHitOnTarget_0=function(t){return this.myTargetBounds_0.contains_119tl4$(new M(A(t.offsetX),A(t.offsetY)))},Ne.prototype.translate_0=function(t){return F.DomEventUtil.translateInTargetCoordWithOffset_6zzdys$(t,this.myEventTarget_0,this.myTargetBounds_0.origin)},Ne.$metadata$={kind:a,simpleName:"DomEventPeer",interfaces:[fe]},Se.$metadata$={kind:a,simpleName:"DomCanvasControl",interfaces:[et]},Pe.prototype.convertLineJoin_0=function(t){var n;switch(t.name){case"BEVEL":n="bevel";break;case"MITER":n="miter";break;case"ROUND":n="round";break;default:n=e.noWhenBranchMatched()}return n},Pe.prototype.convertLineCap_0=function(t){var n;switch(t.name){case"BUTT":n="butt";break;case"ROUND":n="round";break;case"SQUARE":n="square";break;default:n=e.noWhenBranchMatched()}return n},Pe.prototype.convertTextBaseline_0=function(t){var n;switch(t.name){case"ALPHABETIC":n="alphabetic";break;case"BOTTOM":n="bottom";break;case"MIDDLE":n="middle";break;case"TOP":n="top";break;default:n=e.noWhenBranchMatched()}return n},Pe.prototype.convertTextAlign_0=function(t){var n;switch(t.name){case"CENTER":n="center";break;case"END":n="end";break;case"START":n="start";break;default:n=e.noWhenBranchMatched()}return n},Pe.prototype.drawImage_xo47pw$=function(t,n,i){var r,o=e.isType(r=t,xe)?r:$();this.myContext2d_0.drawImage(o.canvasElement,n,i)},Pe.prototype.drawImage_nks7bk$=function(t,n,i,r,o){var a,s=e.isType(a=t,xe)?a:$();this.myContext2d_0.drawImage(s.canvasElement,n,i,r,o)},Pe.prototype.drawImage_urnjjc$=function(t,n,i,r,o,a,s,l,u){var c,p=e.isType(c=t,xe)?c:$();this.myContext2d_0.drawImage(p.canvasElement,n,i,r,o,a,s,l,u)},Pe.prototype.beginPath=function(){this.myContext2d_0.beginPath()},Pe.prototype.closePath=function(){this.myContext2d_0.closePath()},Pe.prototype.stroke=function(){this.myContext2d_0.stroke()},Pe.prototype.fill=function(){this.myContext2d_0.fill("nonzero")},Pe.prototype.fillEvenOdd=function(){this.myContext2d_0.fill("evenodd")},Pe.prototype.fillRect_6y0v78$=function(t,e,n,i){this.myContext2d_0.fillRect(t,e,n,i)},Pe.prototype.moveTo_lu1900$=function(t,e){this.myContext2d_0.moveTo(t,e)},Pe.prototype.lineTo_lu1900$=function(t,e){this.myContext2d_0.lineTo(t,e)},Pe.prototype.arc_6p3vsx$$default=function(t,e,n,i,r,o){this.myContext2d_0.arc(t,e,n,i,r,o)},Pe.prototype.save=function(){this.myContext2d_0.save()},Pe.prototype.restore=function(){this.myContext2d_0.restore()},Pe.prototype.setFillStyle_2160e9$=function(t){this.myContext2d_0.fillStyle=null!=t?t.toCssColor():null},Pe.prototype.setStrokeStyle_2160e9$=function(t){this.myContext2d_0.strokeStyle=null!=t?t.toCssColor():null},Pe.prototype.setGlobalAlpha_14dthe$=function(t){this.myContext2d_0.globalAlpha=t},Pe.prototype.toCssString_0=function(t){var n,i;switch(t.fontWeight.name){case"NORMAL":n="normal";break;case"BOLD":n="bold";break;default:n=e.noWhenBranchMatched()}var r=n;switch(t.fontStyle.name){case"NORMAL":i="normal";break;case"ITALIC":i="italic";break;default:i=e.noWhenBranchMatched()}return i+" "+r+" "+t.fontSize+"px "+t.fontFamily},Pe.prototype.setFont_ov8mpe$=function(t){this.myContext2d_0.font=this.toCssString_0(t)},Pe.prototype.setLineWidth_14dthe$=function(t){this.myContext2d_0.lineWidth=t},Pe.prototype.strokeRect_6y0v78$=function(t,e,n,i){this.myContext2d_0.strokeRect(t,e,n,i)},Pe.prototype.strokeText_ai6r6m$=function(t,e,n){this.myContext2d_0.strokeText(t,e,n)},Pe.prototype.fillText_ai6r6m$=function(t,e,n){this.myContext2d_0.fillText(t,e,n)},Pe.prototype.scale_lu1900$=function(t,e){this.myContext2d_0.scale(t,e)},Pe.prototype.rotate_14dthe$=function(t){this.myContext2d_0.rotate(t)},Pe.prototype.translate_lu1900$=function(t,e){this.myContext2d_0.translate(t,e)},Pe.prototype.transform_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.transform(t,e,n,i,r,o)},Pe.prototype.bezierCurveTo_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.bezierCurveTo(t,e,n,i,r,o)},Pe.prototype.setLineJoin_v2gigt$=function(t){this.myContext2d_0.lineJoin=this.convertLineJoin_0(t)},Pe.prototype.setLineCap_useuqn$=function(t){this.myContext2d_0.lineCap=this.convertLineCap_0(t)},Pe.prototype.setTextBaseline_5cz80h$=function(t){this.myContext2d_0.textBaseline=this.convertTextBaseline_0(t)},Pe.prototype.setTextAlign_iwro1z$=function(t){this.myContext2d_0.textAlign=this.convertTextAlign_0(t)},Pe.prototype.setTransform_15yvbs$=function(t,e,n,i,r,o){this.myContext2d_0.setTransform(t,e,n,i,r,o)},Pe.prototype.setLineDash_gf7tl1$=function(t){this.myContext2d_0.setLineDash(H(t))},Pe.prototype.measureText_61zpoe$=function(t){return this.myContext2d_0.measureText(t).width},Pe.prototype.clearRect_wthzt5$=function(t){this.myContext2d_0.clearRect(t.left,t.top,t.width,t.height)},Pe.$metadata$={kind:a,simpleName:"DomContext2d",interfaces:[kt]},Y.AnimationTimer=V,Object.defineProperty(K,"Companion",{get:J}),Y.AnimationEventHandler=K;var Ae=t.jetbrains||(t.jetbrains={}),je=Ae.datalore||(Ae.datalore={}),Le=je.vis||(je.vis={}),Re=Le.canvas||(Le.canvas={});Re.AnimationProvider=Y,Q.Snapshot=tt,Re.Canvas=Q,Re.CanvasControl=et,Object.defineProperty(Re,"CanvasControlUtil",{get:function(){return null===wt&&new nt,wt}}),Re.CanvasProvider=xt,Object.defineProperty(Et,"BEVEL",{get:St}),Object.defineProperty(Et,"MITER",{get:Tt}),Object.defineProperty(Et,"ROUND",{get:Ot}),kt.LineJoin=Et,Object.defineProperty(Nt,"BUTT",{get:At}),Object.defineProperty(Nt,"ROUND",{get:jt}),Object.defineProperty(Nt,"SQUARE",{get:Lt}),kt.LineCap=Nt,Object.defineProperty(Rt,"ALPHABETIC",{get:zt}),Object.defineProperty(Rt,"BOTTOM",{get:Dt}),Object.defineProperty(Rt,"MIDDLE",{get:Mt}),Object.defineProperty(Rt,"TOP",{get:Bt}),kt.TextBaseline=Rt,Object.defineProperty(Ut,"CENTER",{get:qt}),Object.defineProperty(Ut,"END",{get:Gt}),Object.defineProperty(Ut,"START",{get:Ht}),kt.TextAlign=Ut,Object.defineProperty(Vt,"NORMAL",{get:Wt}),Object.defineProperty(Vt,"ITALIC",{get:Xt}),Yt.FontStyle=Vt,Object.defineProperty(Zt,"NORMAL",{get:Qt}),Object.defineProperty(Zt,"BOLD",{get:te}),Yt.FontWeight=Zt,Object.defineProperty(Yt,"Companion",{get:ie}),kt.Font_init_1nsek9$=function(t,e,n,i,r){return r=r||Object.create(Yt.prototype),Yt.call(r,null!=t?t:Wt(),null!=e?e:Qt(),null!=n?n:ie().DEFAULT_SIZE,null!=i?i:ie().DEFAULT_FAMILY),r},kt.Font=Yt,Re.Context2d=kt,Object.defineProperty(re,"Companion",{get:se}),Re.CssFontParser=re,Object.defineProperty(Re,"CssStyleUtil",{get:function(){return null===ue&&new le,ue}}),Re.DeltaTime=ce,Re.Dispatcher=pe,Re.scheduleAsync_ebnxch$=function(t,e){var n=new b;return e.onResult_m8e4a6$(he(n,t),_e(n,t)),n},Re.EventPeer=fe,Re.ScaledCanvas=ye,Re.ScaledContext2d=$e,Re.SingleCanvasControl=ve,(Le.canvasFigure||(Le.canvasFigure={})).CanvasFigure=ge;var Ie=Re.dom||(Re.dom={});return Ie.DomAnimationTimer=be,we.DomSnapshot=xe,Object.defineProperty(we,"Companion",{get:Ce}),Ie.DomCanvas=we,Se.DomEventPeer=Ne,Ie.DomCanvasControl=Se,Ie.DomContext2d=Pe,$e.prototype.arc_6p3vsx$=kt.prototype.arc_6p3vsx$,Pe.prototype.arc_6p3vsx$=kt.prototype.arc_6p3vsx$,t})?i.apply(e,r):i)||(t.exports=o)},179:function(t,e,n){var i,r,o;r=[e,n(421),n(331),n(799),n(767),n(602)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o){"use strict";var a=e.kotlin.collections.ArrayList_init_287e2$,s=n.jetbrains.datalore.vis.svg.slim.SvgSlimNode,l=e.toString,u=e.ensureNotNull,c=n.jetbrains.datalore.vis.svg.SvgElement,p=n.jetbrains.datalore.vis.svg.SvgTextNode,h=e.kotlin.IllegalStateException_init_pdl1vj$,_=n.jetbrains.datalore.vis.svg.slim,f=e.equals,d=e.Kind.CLASS,m=i.jetbrains.datalore.mapper.core.Synchronizer,y=e.kotlin.IllegalArgumentException_init_pdl1vj$,$=e.Kind.INTERFACE,v=(n.jetbrains.datalore.vis.svg.SvgNodeContainer,e.Kind.OBJECT),g=e.throwCCE,b=r.jetbrains.datalore.base.registration.CompositeRegistration,w=o.jetbrains.datalore.base.js.dom.DomEventType,x=o.jetbrains.datalore.base.event.dom,k=r.jetbrains.datalore.base.event.MouseEvent,E=r.jetbrains.datalore.base.registration.Registration,C=n.jetbrains.datalore.vis.svg.SvgImageElementEx.RGBEncoder,S=n.jetbrains.datalore.vis.svg.SvgNode,T=r.jetbrains.datalore.base.geometry.DoubleVector,O=r.jetbrains.datalore.base.geometry.DoubleRectangle_init_6y0v78$,N=e.kotlin.collections.HashMap_init_q3lmfv$,P=n.jetbrains.datalore.vis.svg.SvgPlatformPeer,A=n.jetbrains.datalore.vis.svg.SvgElementListener,j=i.jetbrains.datalore.mapper.core,L=n.jetbrains.datalore.vis.svg.event.SvgEventSpec.values,R=e.kotlin.IllegalStateException_init,I=r.jetbrains.datalore.base.function.Function,z=r.jetbrains.datalore.base.observable.property.WritableProperty,D=e.numberToInt,M=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,B=i.jetbrains.datalore.mapper.core.Mapper,U=n.jetbrains.datalore.vis.svg.SvgImageElementEx,F=n.jetbrains.datalore.vis.svg.SvgImageElement,q=i.jetbrains.datalore.mapper.core.MapperFactory,G=n.jetbrains.datalore.vis.svg,H=(e.defineInlineFunction,e.kotlin.Unit),Y=e.kotlin.collections.AbstractMutableList,V=r.jetbrains.datalore.base.function.Value,K=r.jetbrains.datalore.base.observable.property.PropertyChangeEvent,W=r.jetbrains.datalore.base.observable.event.ListenerCaller,X=r.jetbrains.datalore.base.observable.event.Listeners,Z=r.jetbrains.datalore.base.observable.property.Property,J=e.kotlinx.dom.addClass_hhb33f$,Q=e.kotlinx.dom.removeClass_hhb33f$,tt=r.jetbrains.datalore.base.geometry.Vector,et=r.jetbrains.datalore.base.function.Supplier,nt=o.jetbrains.datalore.base.observable.property.UpdatableProperty,it=n.jetbrains.datalore.vis.svg.SvgEllipseElement,rt=n.jetbrains.datalore.vis.svg.SvgCircleElement,ot=n.jetbrains.datalore.vis.svg.SvgRectElement,at=n.jetbrains.datalore.vis.svg.SvgTextElement,st=n.jetbrains.datalore.vis.svg.SvgPathElement,lt=n.jetbrains.datalore.vis.svg.SvgLineElement,ut=n.jetbrains.datalore.vis.svg.SvgSvgElement,ct=n.jetbrains.datalore.vis.svg.SvgGElement,pt=n.jetbrains.datalore.vis.svg.SvgStyleElement,ht=n.jetbrains.datalore.vis.svg.SvgTSpanElement,_t=n.jetbrains.datalore.vis.svg.SvgDefsElement,ft=n.jetbrains.datalore.vis.svg.SvgClipPathElement;function dt(t,e,n){this.source_0=t,this.target_0=e,this.targetPeer_0=n,this.myHandlersRegs_0=null}function mt(){}function yt(){}function $t(t,e){this.closure$source=t,this.closure$spec=e}function vt(t,e,n){this.closure$target=t,this.closure$eventType=e,this.closure$listener=n,E.call(this)}function gt(){}function bt(){this.myMappingMap_0=N()}function wt(t,e,n){St.call(this,t,e,n),this.myPeer_0=n,this.myHandlersRegs_0=null}function xt(t){this.this$SvgElementMapper=t,this.myReg_0=null}function kt(t){this.this$SvgElementMapper=t}function Et(t){this.this$SvgElementMapper=t}function Ct(t,e){this.this$SvgElementMapper=t,this.closure$spec=e}function St(t,e,n){B.call(this,t,e),this.peer_cyou3s$_0=n}function Tt(t){this.myPeer_0=t}function Ot(t){At(),B.call(this,t,At().createDocument_0()),this.myRootMapper_0=null}function Nt(){Pt=this}vt.prototype=Object.create(E.prototype),vt.prototype.constructor=vt,St.prototype=Object.create(B.prototype),St.prototype.constructor=St,wt.prototype=Object.create(St.prototype),wt.prototype.constructor=wt,Ot.prototype=Object.create(B.prototype),Ot.prototype.constructor=Ot,jt.prototype=Object.create(St.prototype),jt.prototype.constructor=jt,Ft.prototype=Object.create(E.prototype),Ft.prototype.constructor=Ft,Qt.prototype=Object.create(Y.prototype),Qt.prototype.constructor=Qt,te.prototype=Object.create(Y.prototype),te.prototype.constructor=te,re.prototype=Object.create(E.prototype),re.prototype.constructor=re,oe.prototype=Object.create(E.prototype),oe.prototype.constructor=oe,pe.prototype=Object.create(nt.prototype),pe.prototype.constructor=pe,dt.prototype.attach_1rog5x$=function(t){if(this.myHandlersRegs_0=a(),e.isType(this.source_0,s)){var n="Slim SVG node is not expected: "+l(e.getKClassFromExpression(this.source_0).simpleName);throw y(n.toString())}this.targetPeer_0.appendChild_xwzc9q$(this.target_0,this.generateNode_0(this.source_0))},dt.prototype.detach=function(){var t;for(t=u(this.myHandlersRegs_0).iterator();t.hasNext();)t.next().remove();this.myHandlersRegs_0=null,this.targetPeer_0.removeAllChildren_11rb$(this.target_0)},dt.prototype.generateNode_0=function(t){if(e.isType(t,s))return this.generateSlimNode_0(t);if(e.isType(t,c))return this.generateElement_0(t);if(e.isType(t,p))return this.generateTextNode_0(t);throw h("Can't generate dom for svg node "+e.getKClassFromExpression(t).simpleName)},dt.prototype.generateElement_0=function(t){var e,n,i=this.targetPeer_0.newSvgElement_b1cgbq$(t);for(e=t.attributeKeys.iterator();e.hasNext();){var r=e.next();this.targetPeer_0.setAttribute_ohl585$(i,r.name,l(t.getAttribute_61zpoe$(r.name).get()))}var o=t.handlersSet().get();for(o.isEmpty()||this.targetPeer_0.hookEventHandlers_ewuthb$(t,i,o),n=t.children().iterator();n.hasNext();){var a=n.next();this.targetPeer_0.appendChild_xwzc9q$(i,this.generateNode_0(a))}return i},dt.prototype.generateTextNode_0=function(t){return this.targetPeer_0.newSvgTextNode_tginx7$(t)},dt.prototype.generateSlimNode_0=function(t){var e,n,i=this.targetPeer_0.newSvgSlimNode_qwqme8$(t);if(f(t.elementName,_.SvgSlimElements.GROUP))for(e=t.slimChildren.iterator();e.hasNext();){var r=e.next();this.targetPeer_0.appendChild_xwzc9q$(i,this.generateSlimNode_0(r))}for(n=t.attributes.iterator();n.hasNext();){var o=n.next();this.targetPeer_0.setAttribute_ohl585$(i,o.key,o.value)}return i},dt.$metadata$={kind:d,simpleName:"SvgNodeSubtreeGeneratingSynchronizer",interfaces:[m]},mt.$metadata$={kind:$,simpleName:"TargetPeer",interfaces:[]},yt.prototype.appendChild_xwzc9q$=function(t,e){t.appendChild(e)},yt.prototype.removeAllChildren_11rb$=function(t){if(t.hasChildNodes())for(var e=t.firstChild;null!=e;){var n=e.nextSibling;t.removeChild(e),e=n}},yt.prototype.newSvgElement_b1cgbq$=function(t){return _e().generateElement_b1cgbq$(t)},yt.prototype.newSvgTextNode_tginx7$=function(t){var e=document.createTextNode("");return e.nodeValue=t.textContent().get(),e},yt.prototype.newSvgSlimNode_qwqme8$=function(t){return _e().generateSlimNode_qwqme8$(t)},yt.prototype.setAttribute_ohl585$=function(t,n,i){var r;(e.isType(r=t,Element)?r:g()).setAttribute(n,i)},yt.prototype.hookEventHandlers_ewuthb$=function(t,n,i){var r,o,a,s=new b([]);for(r=i.iterator();r.hasNext();){var l=r.next();switch(l.name){case"MOUSE_CLICKED":o=w.Companion.CLICK;break;case"MOUSE_PRESSED":o=w.Companion.MOUSE_DOWN;break;case"MOUSE_RELEASED":o=w.Companion.MOUSE_UP;break;case"MOUSE_OVER":o=w.Companion.MOUSE_OVER;break;case"MOUSE_MOVE":o=w.Companion.MOUSE_MOVE;break;case"MOUSE_OUT":o=w.Companion.MOUSE_OUT;break;default:throw y("unexpected event spec "+l)}var u=o;s.add_3xv6fb$(this.addMouseHandler_0(t,e.isType(a=n,EventTarget)?a:g(),l,u.name))}return s},$t.prototype.handleEvent=function(t){var n;t.stopPropagation();var i=e.isType(n=t,MouseEvent)?n:g(),r=new k(i.clientX,i.clientY,x.DomEventUtil.getButton_tfvzir$(i),x.DomEventUtil.getModifiers_tfvzir$(i));this.closure$source.dispatch_lgzia2$(this.closure$spec,r)},$t.$metadata$={kind:d,interfaces:[]},vt.prototype.doRemove=function(){this.closure$target.removeEventListener(this.closure$eventType,this.closure$listener,!1)},vt.$metadata$={kind:d,interfaces:[E]},yt.prototype.addMouseHandler_0=function(t,e,n,i){var r=new $t(t,n);return e.addEventListener(i,r,!1),new vt(e,i,r)},yt.$metadata$={kind:d,simpleName:"DomTargetPeer",interfaces:[mt]},gt.prototype.toDataUrl_nps3vt$=function(t,n,i){var r,o,a=null==(r=document.createElement("canvas"))||e.isType(r,HTMLCanvasElement)?r:g();if(null==a)throw h("Canvas is not supported.");a.width=t,a.height=n;for(var s=e.isType(o=a.getContext("2d"),CanvasRenderingContext2D)?o:g(),l=s.createImageData(t,n),u=l.data,c=0;c>24&255,t,e),Vt(i,r,n>>16&255,t,e),Yt(i,r,n>>8&255,t,e),Ht(i,r,255&n,t,e)},gt.$metadata$={kind:d,simpleName:"RGBEncoderDom",interfaces:[C]},bt.prototype.ensureSourceRegistered_0=function(t){if(!this.myMappingMap_0.containsKey_11rb$(t))throw h("Trying to call platform peer method of unmapped node")},bt.prototype.registerMapper_dxg7rd$=function(t,e){this.myMappingMap_0.put_xwzc9p$(t,e)},bt.prototype.unregisterMapper_26jijc$=function(t){this.myMappingMap_0.remove_11rb$(t)},bt.prototype.getComputedTextLength_u60gfq$=function(t){var n,i;this.ensureSourceRegistered_0(e.isType(n=t,S)?n:g());var r=u(this.myMappingMap_0.get_11rb$(t)).target;return(e.isType(i=r,SVGTextContentElement)?i:g()).getComputedTextLength()},bt.prototype.transformCoordinates_1=function(t,n,i){var r,o;this.ensureSourceRegistered_0(e.isType(r=t,S)?r:g());var a=u(this.myMappingMap_0.get_11rb$(t)).target;return this.transformCoordinates_0(e.isType(o=a,SVGElement)?o:g(),n.x,n.y,i)},bt.prototype.transformCoordinates_0=function(t,n,i,r){var o,a=(e.isType(o=t,SVGGraphicsElement)?o:g()).getCTM();r&&(a=u(a).inverse());var s=u(t.ownerSVGElement).createSVGPoint();s.x=n,s.y=i;var l=s.matrixTransform(u(a));return new T(l.x,l.y)},bt.prototype.inverseScreenTransform_ljxa03$=function(t,n){var i,r=t.ownerSvgElement;this.ensureSourceRegistered_0(u(r));var o=u(this.myMappingMap_0.get_11rb$(r)).target;return this.inverseScreenTransform_0(e.isType(i=o,SVGSVGElement)?i:g(),n.x,n.y)},bt.prototype.inverseScreenTransform_0=function(t,e,n){var i=u(t.getScreenCTM()).inverse(),r=t.createSVGPoint();return r.x=e,r.y=n,r=r.matrixTransform(i),new T(r.x,r.y)},bt.prototype.invertTransform_12yub8$=function(t,e){return this.transformCoordinates_1(t,e,!0)},bt.prototype.applyTransform_12yub8$=function(t,e){return this.transformCoordinates_1(t,e,!1)},bt.prototype.getBBox_7snaev$=function(t){var n;this.ensureSourceRegistered_0(e.isType(n=t,S)?n:g());var i=u(this.myMappingMap_0.get_11rb$(t)).target;return this.getBoundingBox_0(i)},bt.prototype.getBoundingBox_0=function(t){var n,i=(e.isType(n=t,SVGGraphicsElement)?n:g()).getBBox();return O(i.x,i.y,i.width,i.height)},bt.$metadata$={kind:d,simpleName:"SvgDomPeer",interfaces:[P]},kt.prototype.onAttrSet_ud3ldc$=function(t){null==t.newValue&&this.this$SvgElementMapper.target.removeAttribute(t.attrSpec.name),this.this$SvgElementMapper.target.setAttribute(t.attrSpec.name,l(t.newValue))},kt.$metadata$={kind:d,interfaces:[A]},xt.prototype.attach_1rog5x$=function(t){var e;for(this.myReg_0=this.this$SvgElementMapper.source.addListener_e4m8w6$(new kt(this.this$SvgElementMapper)),e=this.this$SvgElementMapper.source.attributeKeys.iterator();e.hasNext();){var n=e.next(),i=n.name,r=l(this.this$SvgElementMapper.source.getAttribute_61zpoe$(i).get());n.hasNamespace()?this.this$SvgElementMapper.target.setAttributeNS(n.namespaceUri,i,r):this.this$SvgElementMapper.target.setAttribute(i,r)}},xt.prototype.detach=function(){u(this.myReg_0).remove()},xt.$metadata$={kind:d,interfaces:[m]},Ct.prototype.apply_11rb$=function(t){if(e.isType(t,MouseEvent)){var n=this.this$SvgElementMapper.createMouseEvent_0(t);return this.this$SvgElementMapper.source.dispatch_lgzia2$(this.closure$spec,n),!0}return!1},Ct.$metadata$={kind:d,interfaces:[I]},Et.prototype.set_11rb$=function(t){var e,n,i;for(null==this.this$SvgElementMapper.myHandlersRegs_0&&(this.this$SvgElementMapper.myHandlersRegs_0=M()),e=L(),n=0;n!==e.length;++n){var r=e[n];if(!u(t).contains_11rb$(r)&&u(this.this$SvgElementMapper.myHandlersRegs_0).containsKey_11rb$(r)&&u(u(this.this$SvgElementMapper.myHandlersRegs_0).remove_11rb$(r)).dispose(),t.contains_11rb$(r)&&!u(this.this$SvgElementMapper.myHandlersRegs_0).containsKey_11rb$(r)){switch(r.name){case"MOUSE_CLICKED":i=w.Companion.CLICK;break;case"MOUSE_PRESSED":i=w.Companion.MOUSE_DOWN;break;case"MOUSE_RELEASED":i=w.Companion.MOUSE_UP;break;case"MOUSE_OVER":i=w.Companion.MOUSE_OVER;break;case"MOUSE_MOVE":i=w.Companion.MOUSE_MOVE;break;case"MOUSE_OUT":i=w.Companion.MOUSE_OUT;break;default:throw R()}var o=i,a=u(this.this$SvgElementMapper.myHandlersRegs_0),s=Ut(this.this$SvgElementMapper.target,o,new Ct(this.this$SvgElementMapper,r));a.put_xwzc9p$(r,s)}}},Et.$metadata$={kind:d,interfaces:[z]},wt.prototype.registerSynchronizers_jp3a7u$=function(t){St.prototype.registerSynchronizers_jp3a7u$.call(this,t),t.add_te27wm$(new xt(this)),t.add_te27wm$(j.Synchronizers.forPropsOneWay_2ov6i0$(this.source.handlersSet(),new Et(this)))},wt.prototype.onDetach=function(){var t;if(St.prototype.onDetach.call(this),null!=this.myHandlersRegs_0){for(t=u(this.myHandlersRegs_0).values.iterator();t.hasNext();)t.next().dispose();u(this.myHandlersRegs_0).clear()}},wt.prototype.createMouseEvent_0=function(t){t.stopPropagation();var e=this.myPeer_0.inverseScreenTransform_ljxa03$(this.source,new T(t.clientX,t.clientY));return new k(D(e.x),D(e.y),x.DomEventUtil.getButton_tfvzir$(t),x.DomEventUtil.getModifiers_tfvzir$(t))},wt.$metadata$={kind:d,simpleName:"SvgElementMapper",interfaces:[St]},St.prototype.registerSynchronizers_jp3a7u$=function(t){B.prototype.registerSynchronizers_jp3a7u$.call(this,t),this.source.isPrebuiltSubtree?t.add_te27wm$(new dt(this.source,this.target,new yt)):t.add_te27wm$(j.Synchronizers.forObservableRole_umd8ru$(this,this.source.children(),_e().nodeChildren_b3w3xb$(this.target),new Tt(this.peer_cyou3s$_0)))},St.prototype.onAttach_8uof53$=function(t){B.prototype.onAttach_8uof53$.call(this,t),this.peer_cyou3s$_0.registerMapper_dxg7rd$(this.source,this)},St.prototype.onDetach=function(){B.prototype.onDetach.call(this),this.peer_cyou3s$_0.unregisterMapper_26jijc$(this.source)},St.$metadata$={kind:d,simpleName:"SvgNodeMapper",interfaces:[B]},Tt.prototype.createMapper_11rb$=function(t){if(e.isType(t,F)){var n=t;return e.isType(n,U)&&(n=n.asImageElement_xhdger$(new gt)),new wt(n,_e().generateElement_b1cgbq$(t),this.myPeer_0)}if(e.isType(t,c))return new wt(t,_e().generateElement_b1cgbq$(t),this.myPeer_0);if(e.isType(t,p))return new jt(t,_e().generateTextElement_tginx7$(t),this.myPeer_0);if(e.isType(t,s))return new St(t,_e().generateSlimNode_qwqme8$(t),this.myPeer_0);throw h("Unsupported SvgNode "+e.getKClassFromExpression(t))},Tt.$metadata$={kind:d,simpleName:"SvgNodeMapperFactory",interfaces:[q]},Nt.prototype.createDocument_0=function(){var t;return e.isType(t=document.createElementNS(G.XmlNamespace.SVG_NAMESPACE_URI,"svg"),SVGSVGElement)?t:g()},Nt.$metadata$={kind:v,simpleName:"Companion",interfaces:[]};var Pt=null;function At(){return null===Pt&&new Nt,Pt}function jt(t,e,n){St.call(this,t,e,n)}function Lt(t){this.this$SvgTextNodeMapper=t}function Rt(){It=this,this.DEFAULT="default",this.NONE="none",this.BLOCK="block",this.FLEX="flex",this.GRID="grid",this.INLINE_BLOCK="inline-block"}Ot.prototype.onAttach_8uof53$=function(t){if(B.prototype.onAttach_8uof53$.call(this,t),!this.source.isAttached())throw h("Element must be attached");var e=new bt;this.source.container().setPeer_kqs5uc$(e),this.myRootMapper_0=new wt(this.source,this.target,e),this.target.setAttribute("shape-rendering","geometricPrecision"),u(this.myRootMapper_0).attachRoot_8uof53$()},Ot.prototype.onDetach=function(){u(this.myRootMapper_0).detachRoot(),this.myRootMapper_0=null,this.source.isAttached()&&this.source.container().setPeer_kqs5uc$(null),B.prototype.onDetach.call(this)},Ot.$metadata$={kind:d,simpleName:"SvgRootDocumentMapper",interfaces:[B]},Lt.prototype.set_11rb$=function(t){this.this$SvgTextNodeMapper.target.nodeValue=t},Lt.$metadata$={kind:d,interfaces:[z]},jt.prototype.registerSynchronizers_jp3a7u$=function(t){St.prototype.registerSynchronizers_jp3a7u$.call(this,t),t.add_te27wm$(j.Synchronizers.forPropsOneWay_2ov6i0$(this.source.textContent(),new Lt(this)))},jt.$metadata$={kind:d,simpleName:"SvgTextNodeMapper",interfaces:[St]},Rt.$metadata$={kind:v,simpleName:"CssDisplay",interfaces:[]};var It=null;function zt(){return null===It&&new Rt,It}function Dt(t,e){return t.removeProperty(e),t}function Mt(t){return Dt(t,"display")}function Bt(t){this.closure$handler=t}function Ut(t,e,n){return qt(t,e,new Bt(n),!1)}function Ft(t,e,n){this.closure$type=t,this.closure$listener=e,this.this$onEvent=n,E.call(this)}function qt(t,e,n,i){return t.addEventListener(e.name,n,i),new Ft(e,n,t)}function Gt(t,e,n,i,r){Kt(t,e,n,i,r,3)}function Ht(t,e,n,i,r){Kt(t,e,n,i,r,2)}function Yt(t,e,n,i,r){Kt(t,e,n,i,r,1)}function Vt(t,e,n,i,r){Kt(t,e,n,i,r,0)}function Kt(t,n,i,r,o,a){n[(4*(r+e.imul(o,t.width)|0)|0)+a|0]=i}function Wt(t){return t.childNodes.length}function Xt(t,e){return t.insertBefore(e,t.firstChild)}function Zt(t,e,n){var i=null!=n?n.nextSibling:null;null==i?t.appendChild(e):t.insertBefore(e,i)}function Jt(){he=this}function Qt(t){this.closure$n=t,Y.call(this)}function te(t,e){this.closure$items=t,this.closure$base=e,Y.call(this)}function ee(t){this.closure$e=t}function ne(t){this.closure$element=t,this.myTimerRegistration_0=null,this.myListeners_0=new X}function ie(t,e){this.closure$value=t,this.closure$currentValue=e}function re(t){this.closure$timer=t,E.call(this)}function oe(t,e){this.closure$reg=t,this.this$=e,E.call(this)}function ae(t,e){this.closure$el=t,this.closure$cls=e,this.myValue_0=null}function se(t,e){this.closure$el=t,this.closure$attr=e}function le(t,e,n){this.closure$el=t,this.closure$attr=e,this.closure$attrValue=n}function ue(t){this.closure$el=t}function ce(t){this.closure$el=t}function pe(t,e){this.closure$period=t,this.closure$supplier=e,nt.call(this),this.myTimer_0=-1}Bt.prototype.handleEvent=function(t){this.closure$handler.apply_11rb$(t)||(t.preventDefault(),t.stopPropagation())},Bt.$metadata$={kind:d,interfaces:[]},Ft.prototype.doRemove=function(){this.this$onEvent.removeEventListener(this.closure$type.name,this.closure$listener)},Ft.$metadata$={kind:d,interfaces:[E]},Jt.prototype.elementChildren_2rdptt$=function(t){return this.nodeChildren_b3w3xb$(t)},Object.defineProperty(Qt.prototype,"size",{configurable:!0,get:function(){return Wt(this.closure$n)}}),Qt.prototype.get_za3lpa$=function(t){return this.closure$n.childNodes[t]},Qt.prototype.set_wxm5ur$=function(t,e){if(null!=u(e).parentNode)throw R();var n=u(this.get_za3lpa$(t));return this.closure$n.replaceChild(n,e),n},Qt.prototype.add_wxm5ur$=function(t,e){if(null!=u(e).parentNode)throw R();if(0===t)Xt(this.closure$n,e);else{var n=t-1|0,i=this.closure$n.childNodes[n];Zt(this.closure$n,e,i)}},Qt.prototype.removeAt_za3lpa$=function(t){var e=u(this.closure$n.childNodes[t]);return this.closure$n.removeChild(e),e},Qt.$metadata$={kind:d,interfaces:[Y]},Jt.prototype.nodeChildren_b3w3xb$=function(t){return new Qt(t)},Object.defineProperty(te.prototype,"size",{configurable:!0,get:function(){return this.closure$items.size}}),te.prototype.get_za3lpa$=function(t){return this.closure$items.get_za3lpa$(t)},te.prototype.set_wxm5ur$=function(t,e){var n=this.closure$items.set_wxm5ur$(t,e);return this.closure$base.set_wxm5ur$(t,u(n).getElement()),n},te.prototype.add_wxm5ur$=function(t,e){this.closure$items.add_wxm5ur$(t,e),this.closure$base.add_wxm5ur$(t,u(e).getElement())},te.prototype.removeAt_za3lpa$=function(t){var e=this.closure$items.removeAt_za3lpa$(t);return this.closure$base.removeAt_za3lpa$(t),e},te.$metadata$={kind:d,interfaces:[Y]},Jt.prototype.withElementChildren_9w66cp$=function(t){return new te(a(),t)},ee.prototype.set_11rb$=function(t){this.closure$e.innerHTML=t},ee.$metadata$={kind:d,interfaces:[z]},Jt.prototype.innerTextOf_2rdptt$=function(t){return new ee(t)},Object.defineProperty(ne.prototype,"propExpr",{configurable:!0,get:function(){return"checkbox("+this.closure$element+")"}}),ne.prototype.get=function(){return this.closure$element.checked},ne.prototype.set_11rb$=function(t){this.closure$element.checked=t},ie.prototype.call_11rb$=function(t){t.onEvent_11rb$(new K(this.closure$value.get(),this.closure$currentValue))},ie.$metadata$={kind:d,interfaces:[W]},re.prototype.doRemove=function(){window.clearInterval(this.closure$timer)},re.$metadata$={kind:d,interfaces:[E]},oe.prototype.doRemove=function(){this.closure$reg.remove(),this.this$.myListeners_0.isEmpty&&(u(this.this$.myTimerRegistration_0).remove(),this.this$.myTimerRegistration_0=null)},oe.$metadata$={kind:d,interfaces:[E]},ne.prototype.addHandler_gxwwpc$=function(t){if(this.myListeners_0.isEmpty){var e=new V(this.closure$element.checked),n=window.setInterval((i=this.closure$element,r=e,o=this,function(){var t=i.checked;return t!==r.get()&&(o.myListeners_0.fire_kucmxw$(new ie(r,t)),r.set_11rb$(t)),H}));this.myTimerRegistration_0=new re(n)}var i,r,o;return new oe(this.myListeners_0.add_11rb$(t),this)},ne.$metadata$={kind:d,interfaces:[Z]},Jt.prototype.checkbox_36rv4q$=function(t){return new ne(t)},ae.prototype.set_11rb$=function(t){this.myValue_0!==t&&(t?J(this.closure$el,[this.closure$cls]):Q(this.closure$el,[this.closure$cls]),this.myValue_0=t)},ae.$metadata$={kind:d,interfaces:[z]},Jt.prototype.hasClass_t9mn69$=function(t,e){return new ae(t,e)},se.prototype.set_11rb$=function(t){this.closure$el.setAttribute(this.closure$attr,t)},se.$metadata$={kind:d,interfaces:[z]},Jt.prototype.attribute_t9mn69$=function(t,e){return new se(t,e)},le.prototype.set_11rb$=function(t){t?this.closure$el.setAttribute(this.closure$attr,this.closure$attrValue):this.closure$el.removeAttribute(this.closure$attr)},le.$metadata$={kind:d,interfaces:[z]},Jt.prototype.hasAttribute_1x5wil$=function(t,e,n){return new le(t,e,n)},ue.prototype.set_11rb$=function(t){t?Mt(this.closure$el.style):this.closure$el.style.display=zt().NONE},ue.$metadata$={kind:d,interfaces:[z]},Jt.prototype.visibilityOf_lt8gi4$=function(t){return new ue(t)},ce.prototype.get=function(){return new tt(this.closure$el.clientWidth,this.closure$el.clientHeight)},ce.$metadata$={kind:d,interfaces:[et]},Jt.prototype.dimension_2rdptt$=function(t){return this.timerBasedProperty_ndenup$(new ce(t),200)},pe.prototype.doAddListeners=function(){var t;this.myTimer_0=window.setInterval((t=this,function(){return t.update(),H}),this.closure$period)},pe.prototype.doRemoveListeners=function(){window.clearInterval(this.myTimer_0)},pe.prototype.doGet=function(){return this.closure$supplier.get()},pe.$metadata$={kind:d,interfaces:[nt]},Jt.prototype.timerBasedProperty_ndenup$=function(t,e){return new pe(e,t)},Jt.prototype.generateElement_b1cgbq$=function(t){if(e.isType(t,it))return this.createSVGElement_0("ellipse");if(e.isType(t,rt))return this.createSVGElement_0("circle");if(e.isType(t,ot))return this.createSVGElement_0("rect");if(e.isType(t,at))return this.createSVGElement_0("text");if(e.isType(t,st))return this.createSVGElement_0("path");if(e.isType(t,lt))return this.createSVGElement_0("line");if(e.isType(t,ut))return this.createSVGElement_0("svg");if(e.isType(t,ct))return this.createSVGElement_0("g");if(e.isType(t,pt))return this.createSVGElement_0("style");if(e.isType(t,ht))return this.createSVGElement_0("tspan");if(e.isType(t,_t))return this.createSVGElement_0("defs");if(e.isType(t,ft))return this.createSVGElement_0("clipPath");if(e.isType(t,F))return this.createSVGElement_0("image");throw h("Unsupported svg element "+l(e.getKClassFromExpression(t).simpleName))},Jt.prototype.generateSlimNode_qwqme8$=function(t){switch(t.elementName){case"g":return this.createSVGElement_0("g");case"line":return this.createSVGElement_0("line");case"circle":return this.createSVGElement_0("circle");case"rect":return this.createSVGElement_0("rect");case"path":return this.createSVGElement_0("path");default:throw h("Unsupported SvgSlimNode "+e.getKClassFromExpression(t))}},Jt.prototype.generateTextElement_tginx7$=function(t){return document.createTextNode("")},Jt.prototype.createSVGElement_0=function(t){var n;return e.isType(n=document.createElementNS(G.XmlNamespace.SVG_NAMESPACE_URI,t),SVGElement)?n:g()},Jt.$metadata$={kind:v,simpleName:"DomUtil",interfaces:[]};var he=null;function _e(){return null===he&&new Jt,he}var fe=t.jetbrains||(t.jetbrains={}),de=fe.datalore||(fe.datalore={}),me=de.vis||(de.vis={}),ye=me.svgMapper||(me.svgMapper={});ye.SvgNodeSubtreeGeneratingSynchronizer=dt,ye.TargetPeer=mt;var $e=ye.dom||(ye.dom={});$e.DomTargetPeer=yt,$e.RGBEncoderDom=gt,$e.SvgDomPeer=bt,$e.SvgElementMapper=wt,$e.SvgNodeMapper=St,$e.SvgNodeMapperFactory=Tt,Object.defineProperty(Ot,"Companion",{get:At}),$e.SvgRootDocumentMapper=Ot,$e.SvgTextNodeMapper=jt;var ve=$e.css||($e.css={});Object.defineProperty(ve,"CssDisplay",{get:zt});var ge=$e.domExtensions||($e.domExtensions={});ge.clearProperty_77nir7$=Dt,ge.clearDisplay_b8w5wr$=Mt,ge.on_wkfwsw$=Ut,ge.onEvent_jxnl6r$=qt,ge.setAlphaAt_h5k0c3$=Gt,ge.setBlueAt_h5k0c3$=Ht,ge.setGreenAt_h5k0c3$=Yt,ge.setRedAt_h5k0c3$=Vt,ge.setColorAt_z0tnfj$=Kt,ge.get_childCount_asww5s$=Wt,ge.insertFirst_fga9sf$=Xt,ge.insertAfter_5a54o3$=Zt;var be=$e.domUtil||($e.domUtil={});return Object.defineProperty(be,"DomUtil",{get:_e}),t})?i.apply(e,r):i)||(t.exports=o)},331:function(t,e,n){var i,r,o;r=[e,n(421),n(767)],void 0===(o="function"==typeof(i=function(t,e,n){"use strict";var i=e.Kind.OBJECT,r=e.hashCode,o=e.throwCCE,a=e.equals,s=e.Kind.CLASS,l=e.ensureNotNull,u=e.kotlin.Enum,c=e.throwISE,p=e.Kind.INTERFACE,h=e.kotlin.collections.HashMap_init_q3lmfv$,_=e.kotlin.IllegalArgumentException_init,f=Object,d=n.jetbrains.datalore.base.observable.property.PropertyChangeEvent,m=n.jetbrains.datalore.base.observable.property.Property,y=n.jetbrains.datalore.base.observable.event.ListenerCaller,$=n.jetbrains.datalore.base.observable.event.Listeners,v=n.jetbrains.datalore.base.registration.Registration,g=n.jetbrains.datalore.base.listMap.ListMap,b=e.kotlin.collections.emptySet_287e2$,w=e.kotlin.text.StringBuilder_init,x=n.jetbrains.datalore.base.observable.property.ReadableProperty,k=(e.kotlin.Unit,e.kotlin.IllegalStateException_init_pdl1vj$),E=n.jetbrains.datalore.base.observable.collections.list.ObservableList,C=n.jetbrains.datalore.base.observable.children.ChildList,S=n.jetbrains.datalore.base.observable.children.SimpleComposite,T=e.kotlin.text.StringBuilder,O=n.jetbrains.datalore.base.observable.property.ValueProperty,N=e.toBoxedChar,P=e.kotlin.text.uppercaseChar_myv2d0$,A=e.getKClass,j=e.toString,L=e.kotlin.IllegalArgumentException_init_pdl1vj$,R=e.unboxChar,I=e.kotlin.collections.ArrayList_init_ww73n8$,z=e.kotlin.collections.ArrayList_init_287e2$,D=n.jetbrains.datalore.base.geometry.DoubleVector,M=e.kotlin.collections.ArrayList_init_mqih57$,B=Math,U=e.kotlin.text.split_ip8yn$,F=e.kotlin.text.contains_li3zpu$,q=n.jetbrains.datalore.base.observable.property.WritableProperty,G=e.kotlin.UnsupportedOperationException_init_pdl1vj$,H=n.jetbrains.datalore.base.observable.collections.list.ObservableArrayList,Y=e.numberToInt,V=n.jetbrains.datalore.base.event.Event,K=(e.numberToDouble,e.kotlin.text.toDouble_pdl1vz$,e.kotlin.collections.filterNotNull_m3lr2h$),W=e.kotlin.collections.emptyList_287e2$,X=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$;function Z(t,e){tt(),this.name=t,this.namespaceUri=e}function J(){Q=this}Is.prototype=Object.create(S.prototype),Is.prototype.constructor=Is,la.prototype=Object.create(Is.prototype),la.prototype.constructor=la,Al.prototype=Object.create(la.prototype),Al.prototype.constructor=Al,Oa.prototype=Object.create(Al.prototype),Oa.prototype.constructor=Oa,et.prototype=Object.create(Oa.prototype),et.prototype.constructor=et,Qn.prototype=Object.create(u.prototype),Qn.prototype.constructor=Qn,ot.prototype=Object.create(Oa.prototype),ot.prototype.constructor=ot,ri.prototype=Object.create(u.prototype),ri.prototype.constructor=ri,sa.prototype=Object.create(Oa.prototype),sa.prototype.constructor=sa,da.prototype=Object.create(v.prototype),da.prototype.constructor=da,$a.prototype=Object.create(Oa.prototype),$a.prototype.constructor=$a,ka.prototype=Object.create(v.prototype),ka.prototype.constructor=ka,Ea.prototype=Object.create(v.prototype),Ea.prototype.constructor=Ea,Ta.prototype=Object.create(Oa.prototype),Ta.prototype.constructor=Ta,Va.prototype=Object.create(u.prototype),Va.prototype.constructor=Va,os.prototype=Object.create(u.prototype),os.prototype.constructor=os,hs.prototype=Object.create(Oa.prototype),hs.prototype.constructor=hs,ys.prototype=Object.create(hs.prototype),ys.prototype.constructor=ys,bs.prototype=Object.create(Oa.prototype),bs.prototype.constructor=bs,zs.prototype=Object.create(C.prototype),zs.prototype.constructor=zs,Fs.prototype=Object.create(O.prototype),Fs.prototype.constructor=Fs,Gs.prototype=Object.create(u.prototype),Gs.prototype.constructor=Gs,_l.prototype=Object.create(u.prototype),_l.prototype.constructor=_l,$l.prototype=Object.create(Oa.prototype),$l.prototype.constructor=$l,xl.prototype=Object.create(Oa.prototype),xl.prototype.constructor=xl,Il.prototype=Object.create(la.prototype),Il.prototype.constructor=Il,zl.prototype=Object.create(Al.prototype),zl.prototype.constructor=zl,Gl.prototype=Object.create(la.prototype),Gl.prototype.constructor=Gl,Ql.prototype=Object.create(Oa.prototype),Ql.prototype.constructor=Ql,ou.prototype=Object.create(H.prototype),ou.prototype.constructor=ou,iu.prototype=Object.create(Is.prototype),iu.prototype.constructor=iu,Nu.prototype=Object.create(V.prototype),Nu.prototype.constructor=Nu,Au.prototype=Object.create(u.prototype),Au.prototype.constructor=Au,Bu.prototype=Object.create(Is.prototype),Bu.prototype.constructor=Bu,Uu.prototype=Object.create(Yu.prototype),Uu.prototype.constructor=Uu,Gu.prototype=Object.create(Bu.prototype),Gu.prototype.constructor=Gu,qu.prototype=Object.create(Uu.prototype),qu.prototype.constructor=qu,J.prototype.createSpec_ytbaoo$=function(t){return new Z(t,null)},J.prototype.createSpecNS_wswq18$=function(t,e,n){return new Z(e+":"+t,n)},J.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Q=null;function tt(){return null===Q&&new J,Q}function et(){rt(),Oa.call(this),this.elementName_4ww0r9$_0="circle"}function nt(){it=this,this.CX=tt().createSpec_ytbaoo$("cx"),this.CY=tt().createSpec_ytbaoo$("cy"),this.R=tt().createSpec_ytbaoo$("r")}Z.prototype.hasNamespace=function(){return null!=this.namespaceUri},Z.prototype.toString=function(){return this.name},Z.prototype.hashCode=function(){return r(this.name)},Z.prototype.equals=function(t){var n;return this===t||!(null==t||null==(n=e.getKClassFromExpression(this))||!n.equals(e.getKClassFromExpression(t)))&&(e.isType(t,Z)||o(),!!a(this.name,t.name))},Z.$metadata$={kind:s,simpleName:"SvgAttributeSpec",interfaces:[]},nt.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var it=null;function rt(){return null===it&&new nt,it}function ot(){Jn(),Oa.call(this)}function at(){Zn=this,this.CLIP_PATH_UNITS_0=tt().createSpec_ytbaoo$("clipPathUnits")}Object.defineProperty(et.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_4ww0r9$_0}}),Object.defineProperty(et.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),et.prototype.cx=function(){return this.getAttribute_mumjwj$(rt().CX)},et.prototype.cy=function(){return this.getAttribute_mumjwj$(rt().CY)},et.prototype.r=function(){return this.getAttribute_mumjwj$(rt().R)},et.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},et.prototype.fill=function(){return this.getAttribute_mumjwj$(Pl().FILL)},et.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},et.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Pl().FILL_OPACITY)},et.prototype.stroke=function(){return this.getAttribute_mumjwj$(Pl().STROKE)},et.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},et.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Pl().STROKE_OPACITY)},et.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Pl().STROKE_WIDTH)},et.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},et.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},et.$metadata$={kind:s,simpleName:"SvgCircleElement",interfaces:[Tl,_u,Oa]},at.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var st,lt,ut,ct,pt,ht,_t,ft,dt,mt,yt,$t,vt,gt,bt,wt,xt,kt,Et,Ct,St,Tt,Ot,Nt,Pt,At,jt,Lt,Rt,It,zt,Dt,Mt,Bt,Ut,Ft,qt,Gt,Ht,Yt,Vt,Kt,Wt,Xt,Zt,Jt,Qt,te,ee,ne,ie,re,oe,ae,se,le,ue,ce,pe,he,_e,fe,de,me,ye,$e,ve,ge,be,we,xe,ke,Ee,Ce,Se,Te,Oe,Ne,Pe,Ae,je,Le,Re,Ie,ze,De,Me,Be,Ue,Fe,qe,Ge,He,Ye,Ve,Ke,We,Xe,Ze,Je,Qe,tn,en,nn,rn,on,an,sn,ln,un,cn,pn,hn,_n,fn,dn,mn,yn,$n,vn,gn,bn,wn,xn,kn,En,Cn,Sn,Tn,On,Nn,Pn,An,jn,Ln,Rn,In,zn,Dn,Mn,Bn,Un,Fn,qn,Gn,Hn,Yn,Vn,Kn,Wn,Xn,Zn=null;function Jn(){return null===Zn&&new at,Zn}function Qn(t,e,n){u.call(this),this.myAttributeString_ss0dpy$_0=n,this.name$=t,this.ordinal$=e}function ti(){ti=function(){},st=new Qn("USER_SPACE_ON_USE",0,"userSpaceOnUse"),lt=new Qn("OBJECT_BOUNDING_BOX",1,"objectBoundingBox")}function ei(){return ti(),st}function ni(){return ti(),lt}function ii(){}function ri(t,e,n){u.call(this),this.literal_7kwssz$_0=n,this.name$=t,this.ordinal$=e}function oi(){oi=function(){},ut=new ri("ALICE_BLUE",0,"aliceblue"),ct=new ri("ANTIQUE_WHITE",1,"antiquewhite"),pt=new ri("AQUA",2,"aqua"),ht=new ri("AQUAMARINE",3,"aquamarine"),_t=new ri("AZURE",4,"azure"),ft=new ri("BEIGE",5,"beige"),dt=new ri("BISQUE",6,"bisque"),mt=new ri("BLACK",7,"black"),yt=new ri("BLANCHED_ALMOND",8,"blanchedalmond"),$t=new ri("BLUE",9,"blue"),vt=new ri("BLUE_VIOLET",10,"blueviolet"),gt=new ri("BROWN",11,"brown"),bt=new ri("BURLY_WOOD",12,"burlywood"),wt=new ri("CADET_BLUE",13,"cadetblue"),xt=new ri("CHARTREUSE",14,"chartreuse"),kt=new ri("CHOCOLATE",15,"chocolate"),Et=new ri("CORAL",16,"coral"),Ct=new ri("CORNFLOWER_BLUE",17,"cornflowerblue"),St=new ri("CORNSILK",18,"cornsilk"),Tt=new ri("CRIMSON",19,"crimson"),Ot=new ri("CYAN",20,"cyan"),Nt=new ri("DARK_BLUE",21,"darkblue"),Pt=new ri("DARK_CYAN",22,"darkcyan"),At=new ri("DARK_GOLDEN_ROD",23,"darkgoldenrod"),jt=new ri("DARK_GRAY",24,"darkgray"),Lt=new ri("DARK_GREEN",25,"darkgreen"),Rt=new ri("DARK_GREY",26,"darkgrey"),It=new ri("DARK_KHAKI",27,"darkkhaki"),zt=new ri("DARK_MAGENTA",28,"darkmagenta"),Dt=new ri("DARK_OLIVE_GREEN",29,"darkolivegreen"),Mt=new ri("DARK_ORANGE",30,"darkorange"),Bt=new ri("DARK_ORCHID",31,"darkorchid"),Ut=new ri("DARK_RED",32,"darkred"),Ft=new ri("DARK_SALMON",33,"darksalmon"),qt=new ri("DARK_SEA_GREEN",34,"darkseagreen"),Gt=new ri("DARK_SLATE_BLUE",35,"darkslateblue"),Ht=new ri("DARK_SLATE_GRAY",36,"darkslategray"),Yt=new ri("DARK_SLATE_GREY",37,"darkslategrey"),Vt=new ri("DARK_TURQUOISE",38,"darkturquoise"),Kt=new ri("DARK_VIOLET",39,"darkviolet"),Wt=new ri("DEEP_PINK",40,"deeppink"),Xt=new ri("DEEP_SKY_BLUE",41,"deepskyblue"),Zt=new ri("DIM_GRAY",42,"dimgray"),Jt=new ri("DIM_GREY",43,"dimgrey"),Qt=new ri("DODGER_BLUE",44,"dodgerblue"),te=new ri("FIRE_BRICK",45,"firebrick"),ee=new ri("FLORAL_WHITE",46,"floralwhite"),ne=new ri("FOREST_GREEN",47,"forestgreen"),ie=new ri("FUCHSIA",48,"fuchsia"),re=new ri("GAINSBORO",49,"gainsboro"),oe=new ri("GHOST_WHITE",50,"ghostwhite"),ae=new ri("GOLD",51,"gold"),se=new ri("GOLDEN_ROD",52,"goldenrod"),le=new ri("GRAY",53,"gray"),ue=new ri("GREY",54,"grey"),ce=new ri("GREEN",55,"green"),pe=new ri("GREEN_YELLOW",56,"greenyellow"),he=new ri("HONEY_DEW",57,"honeydew"),_e=new ri("HOT_PINK",58,"hotpink"),fe=new ri("INDIAN_RED",59,"indianred"),de=new ri("INDIGO",60,"indigo"),me=new ri("IVORY",61,"ivory"),ye=new ri("KHAKI",62,"khaki"),$e=new ri("LAVENDER",63,"lavender"),ve=new ri("LAVENDER_BLUSH",64,"lavenderblush"),ge=new ri("LAWN_GREEN",65,"lawngreen"),be=new ri("LEMON_CHIFFON",66,"lemonchiffon"),we=new ri("LIGHT_BLUE",67,"lightblue"),xe=new ri("LIGHT_CORAL",68,"lightcoral"),ke=new ri("LIGHT_CYAN",69,"lightcyan"),Ee=new ri("LIGHT_GOLDEN_ROD_YELLOW",70,"lightgoldenrodyellow"),Ce=new ri("LIGHT_GRAY",71,"lightgray"),Se=new ri("LIGHT_GREEN",72,"lightgreen"),Te=new ri("LIGHT_GREY",73,"lightgrey"),Oe=new ri("LIGHT_PINK",74,"lightpink"),Ne=new ri("LIGHT_SALMON",75,"lightsalmon"),Pe=new ri("LIGHT_SEA_GREEN",76,"lightseagreen"),Ae=new ri("LIGHT_SKY_BLUE",77,"lightskyblue"),je=new ri("LIGHT_SLATE_GRAY",78,"lightslategray"),Le=new ri("LIGHT_SLATE_GREY",79,"lightslategrey"),Re=new ri("LIGHT_STEEL_BLUE",80,"lightsteelblue"),Ie=new ri("LIGHT_YELLOW",81,"lightyellow"),ze=new ri("LIME",82,"lime"),De=new ri("LIME_GREEN",83,"limegreen"),Me=new ri("LINEN",84,"linen"),Be=new ri("MAGENTA",85,"magenta"),Ue=new ri("MAROON",86,"maroon"),Fe=new ri("MEDIUM_AQUA_MARINE",87,"mediumaquamarine"),qe=new ri("MEDIUM_BLUE",88,"mediumblue"),Ge=new ri("MEDIUM_ORCHID",89,"mediumorchid"),He=new ri("MEDIUM_PURPLE",90,"mediumpurple"),Ye=new ri("MEDIUM_SEAGREEN",91,"mediumseagreen"),Ve=new ri("MEDIUM_SLATE_BLUE",92,"mediumslateblue"),Ke=new ri("MEDIUM_SPRING_GREEN",93,"mediumspringgreen"),We=new ri("MEDIUM_TURQUOISE",94,"mediumturquoise"),Xe=new ri("MEDIUM_VIOLET_RED",95,"mediumvioletred"),Ze=new ri("MIDNIGHT_BLUE",96,"midnightblue"),Je=new ri("MINT_CREAM",97,"mintcream"),Qe=new ri("MISTY_ROSE",98,"mistyrose"),tn=new ri("MOCCASIN",99,"moccasin"),en=new ri("NAVAJO_WHITE",100,"navajowhite"),nn=new ri("NAVY",101,"navy"),rn=new ri("OLD_LACE",102,"oldlace"),on=new ri("OLIVE",103,"olive"),an=new ri("OLIVE_DRAB",104,"olivedrab"),sn=new ri("ORANGE",105,"orange"),ln=new ri("ORANGE_RED",106,"orangered"),un=new ri("ORCHID",107,"orchid"),cn=new ri("PALE_GOLDEN_ROD",108,"palegoldenrod"),pn=new ri("PALE_GREEN",109,"palegreen"),hn=new ri("PALE_TURQUOISE",110,"paleturquoise"),_n=new ri("PALE_VIOLET_RED",111,"palevioletred"),fn=new ri("PAPAYA_WHIP",112,"papayawhip"),dn=new ri("PEACH_PUFF",113,"peachpuff"),mn=new ri("PERU",114,"peru"),yn=new ri("PINK",115,"pink"),$n=new ri("PLUM",116,"plum"),vn=new ri("POWDER_BLUE",117,"powderblue"),gn=new ri("PURPLE",118,"purple"),bn=new ri("RED",119,"red"),wn=new ri("ROSY_BROWN",120,"rosybrown"),xn=new ri("ROYAL_BLUE",121,"royalblue"),kn=new ri("SADDLE_BROWN",122,"saddlebrown"),En=new ri("SALMON",123,"salmon"),Cn=new ri("SANDY_BROWN",124,"sandybrown"),Sn=new ri("SEA_GREEN",125,"seagreen"),Tn=new ri("SEASHELL",126,"seashell"),On=new ri("SIENNA",127,"sienna"),Nn=new ri("SILVER",128,"silver"),Pn=new ri("SKY_BLUE",129,"skyblue"),An=new ri("SLATE_BLUE",130,"slateblue"),jn=new ri("SLATE_GRAY",131,"slategray"),Ln=new ri("SLATE_GREY",132,"slategrey"),Rn=new ri("SNOW",133,"snow"),In=new ri("SPRING_GREEN",134,"springgreen"),zn=new ri("STEEL_BLUE",135,"steelblue"),Dn=new ri("TAN",136,"tan"),Mn=new ri("TEAL",137,"teal"),Bn=new ri("THISTLE",138,"thistle"),Un=new ri("TOMATO",139,"tomato"),Fn=new ri("TURQUOISE",140,"turquoise"),qn=new ri("VIOLET",141,"violet"),Gn=new ri("WHEAT",142,"wheat"),Hn=new ri("WHITE",143,"white"),Yn=new ri("WHITE_SMOKE",144,"whitesmoke"),Vn=new ri("YELLOW",145,"yellow"),Kn=new ri("YELLOW_GREEN",146,"yellowgreen"),Wn=new ri("NONE",147,"none"),Xn=new ri("CURRENT_COLOR",148,"currentColor"),Zo()}function ai(){return oi(),ut}function si(){return oi(),ct}function li(){return oi(),pt}function ui(){return oi(),ht}function ci(){return oi(),_t}function pi(){return oi(),ft}function hi(){return oi(),dt}function _i(){return oi(),mt}function fi(){return oi(),yt}function di(){return oi(),$t}function mi(){return oi(),vt}function yi(){return oi(),gt}function $i(){return oi(),bt}function vi(){return oi(),wt}function gi(){return oi(),xt}function bi(){return oi(),kt}function wi(){return oi(),Et}function xi(){return oi(),Ct}function ki(){return oi(),St}function Ei(){return oi(),Tt}function Ci(){return oi(),Ot}function Si(){return oi(),Nt}function Ti(){return oi(),Pt}function Oi(){return oi(),At}function Ni(){return oi(),jt}function Pi(){return oi(),Lt}function Ai(){return oi(),Rt}function ji(){return oi(),It}function Li(){return oi(),zt}function Ri(){return oi(),Dt}function Ii(){return oi(),Mt}function zi(){return oi(),Bt}function Di(){return oi(),Ut}function Mi(){return oi(),Ft}function Bi(){return oi(),qt}function Ui(){return oi(),Gt}function Fi(){return oi(),Ht}function qi(){return oi(),Yt}function Gi(){return oi(),Vt}function Hi(){return oi(),Kt}function Yi(){return oi(),Wt}function Vi(){return oi(),Xt}function Ki(){return oi(),Zt}function Wi(){return oi(),Jt}function Xi(){return oi(),Qt}function Zi(){return oi(),te}function Ji(){return oi(),ee}function Qi(){return oi(),ne}function tr(){return oi(),ie}function er(){return oi(),re}function nr(){return oi(),oe}function ir(){return oi(),ae}function rr(){return oi(),se}function or(){return oi(),le}function ar(){return oi(),ue}function sr(){return oi(),ce}function lr(){return oi(),pe}function ur(){return oi(),he}function cr(){return oi(),_e}function pr(){return oi(),fe}function hr(){return oi(),de}function _r(){return oi(),me}function fr(){return oi(),ye}function dr(){return oi(),$e}function mr(){return oi(),ve}function yr(){return oi(),ge}function $r(){return oi(),be}function vr(){return oi(),we}function gr(){return oi(),xe}function br(){return oi(),ke}function wr(){return oi(),Ee}function xr(){return oi(),Ce}function kr(){return oi(),Se}function Er(){return oi(),Te}function Cr(){return oi(),Oe}function Sr(){return oi(),Ne}function Tr(){return oi(),Pe}function Or(){return oi(),Ae}function Nr(){return oi(),je}function Pr(){return oi(),Le}function Ar(){return oi(),Re}function jr(){return oi(),Ie}function Lr(){return oi(),ze}function Rr(){return oi(),De}function Ir(){return oi(),Me}function zr(){return oi(),Be}function Dr(){return oi(),Ue}function Mr(){return oi(),Fe}function Br(){return oi(),qe}function Ur(){return oi(),Ge}function Fr(){return oi(),He}function qr(){return oi(),Ye}function Gr(){return oi(),Ve}function Hr(){return oi(),Ke}function Yr(){return oi(),We}function Vr(){return oi(),Xe}function Kr(){return oi(),Ze}function Wr(){return oi(),Je}function Xr(){return oi(),Qe}function Zr(){return oi(),tn}function Jr(){return oi(),en}function Qr(){return oi(),nn}function to(){return oi(),rn}function eo(){return oi(),on}function no(){return oi(),an}function io(){return oi(),sn}function ro(){return oi(),ln}function oo(){return oi(),un}function ao(){return oi(),cn}function so(){return oi(),pn}function lo(){return oi(),hn}function uo(){return oi(),_n}function co(){return oi(),fn}function po(){return oi(),dn}function ho(){return oi(),mn}function _o(){return oi(),yn}function fo(){return oi(),$n}function mo(){return oi(),vn}function yo(){return oi(),gn}function $o(){return oi(),bn}function vo(){return oi(),wn}function go(){return oi(),xn}function bo(){return oi(),kn}function wo(){return oi(),En}function xo(){return oi(),Cn}function ko(){return oi(),Sn}function Eo(){return oi(),Tn}function Co(){return oi(),On}function So(){return oi(),Nn}function To(){return oi(),Pn}function Oo(){return oi(),An}function No(){return oi(),jn}function Po(){return oi(),Ln}function Ao(){return oi(),Rn}function jo(){return oi(),In}function Lo(){return oi(),zn}function Ro(){return oi(),Dn}function Io(){return oi(),Mn}function zo(){return oi(),Bn}function Do(){return oi(),Un}function Mo(){return oi(),Fn}function Bo(){return oi(),qn}function Uo(){return oi(),Gn}function Fo(){return oi(),Hn}function qo(){return oi(),Yn}function Go(){return oi(),Vn}function Ho(){return oi(),Kn}function Yo(){return oi(),Wn}function Vo(){return oi(),Xn}function Ko(){Xo=this,this.svgColorList_0=this.createSvgColorList_0()}function Wo(t,e,n){this.myR_0=t,this.myG_0=e,this.myB_0=n}Object.defineProperty(ot.prototype,"elementName",{configurable:!0,get:function(){return"clipPath"}}),Object.defineProperty(ot.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),ot.prototype.clipPathUnits=function(){return this.getAttribute_mumjwj$(Jn().CLIP_PATH_UNITS_0)},ot.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},ot.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},ot.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},Qn.prototype.toString=function(){return this.myAttributeString_ss0dpy$_0},Qn.$metadata$={kind:s,simpleName:"ClipPathUnits",interfaces:[u]},Qn.values=function(){return[ei(),ni()]},Qn.valueOf_61zpoe$=function(t){switch(t){case"USER_SPACE_ON_USE":return ei();case"OBJECT_BOUNDING_BOX":return ni();default:c("No enum constant jetbrains.datalore.vis.svg.SvgClipPathElement.ClipPathUnits."+t)}},ot.$metadata$={kind:s,simpleName:"SvgClipPathElement",interfaces:[_u,Oa]},ii.$metadata$={kind:p,simpleName:"SvgColor",interfaces:[]},ri.prototype.toString=function(){return this.literal_7kwssz$_0},Ko.prototype.createSvgColorList_0=function(){var t,e=h(),n=Jo();for(t=0;t!==n.length;++t){var i=n[t],r=i.toString().toLowerCase();e.put_xwzc9p$(r,i)}return e},Ko.prototype.isColorName_61zpoe$=function(t){return this.svgColorList_0.containsKey_11rb$(t.toLowerCase())},Ko.prototype.forName_61zpoe$=function(t){var e;if(null==(e=this.svgColorList_0.get_11rb$(t.toLowerCase())))throw _();return e},Ko.prototype.create_qt1dr2$=function(t,e,n){return new Wo(t,e,n)},Ko.prototype.create_2160e9$=function(t){return null==t?Yo():new Wo(t.red,t.green,t.blue)},Wo.prototype.toString=function(){return"rgb("+this.myR_0+","+this.myG_0+","+this.myB_0+")"},Wo.$metadata$={kind:s,simpleName:"SvgColorRgb",interfaces:[ii]},Wo.prototype.component1_0=function(){return this.myR_0},Wo.prototype.component2_0=function(){return this.myG_0},Wo.prototype.component3_0=function(){return this.myB_0},Wo.prototype.copy_qt1dr2$=function(t,e,n){return new Wo(void 0===t?this.myR_0:t,void 0===e?this.myG_0:e,void 0===n?this.myB_0:n)},Wo.prototype.hashCode=function(){var t=0;return 31*(t=31*(t=31*t+e.hashCode(this.myR_0)|0)+e.hashCode(this.myG_0)|0)+e.hashCode(this.myB_0)|0},Wo.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.myR_0,t.myR_0)&&e.equals(this.myG_0,t.myG_0)&&e.equals(this.myB_0,t.myB_0)},Ko.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Xo=null;function Zo(){return oi(),null===Xo&&new Ko,Xo}function Jo(){return[ai(),si(),li(),ui(),ci(),pi(),hi(),_i(),fi(),di(),mi(),yi(),$i(),vi(),gi(),bi(),wi(),xi(),ki(),Ei(),Ci(),Si(),Ti(),Oi(),Ni(),Pi(),Ai(),ji(),Li(),Ri(),Ii(),zi(),Di(),Mi(),Bi(),Ui(),Fi(),qi(),Gi(),Hi(),Yi(),Vi(),Ki(),Wi(),Xi(),Zi(),Ji(),Qi(),tr(),er(),nr(),ir(),rr(),or(),ar(),sr(),lr(),ur(),cr(),pr(),hr(),_r(),fr(),dr(),mr(),yr(),$r(),vr(),gr(),br(),wr(),xr(),kr(),Er(),Cr(),Sr(),Tr(),Or(),Nr(),Pr(),Ar(),jr(),Lr(),Rr(),Ir(),zr(),Dr(),Mr(),Br(),Ur(),Fr(),qr(),Gr(),Hr(),Yr(),Vr(),Kr(),Wr(),Xr(),Zr(),Jr(),Qr(),to(),eo(),no(),io(),ro(),oo(),ao(),so(),lo(),uo(),co(),po(),ho(),_o(),fo(),mo(),yo(),$o(),vo(),go(),bo(),wo(),xo(),ko(),Eo(),Co(),So(),To(),Oo(),No(),Po(),Ao(),jo(),Lo(),Ro(),Io(),zo(),Do(),Mo(),Bo(),Uo(),Fo(),qo(),Go(),Ho(),Yo(),Vo()]}function Qo(){ta=this,this.WIDTH="width",this.HEIGHT="height",this.SVG_TEXT_ANCHOR_ATTRIBUTE="text-anchor",this.SVG_STROKE_DASHARRAY_ATTRIBUTE="stroke-dasharray",this.SVG_STYLE_ATTRIBUTE="style",this.SVG_TEXT_DY_ATTRIBUTE="dy",this.SVG_TEXT_ANCHOR_START="start",this.SVG_TEXT_ANCHOR_MIDDLE="middle",this.SVG_TEXT_ANCHOR_END="end",this.SVG_TEXT_DY_TOP="0.7em",this.SVG_TEXT_DY_CENTER="0.35em"}ri.$metadata$={kind:s,simpleName:"SvgColors",interfaces:[ii,u]},ri.values=Jo,ri.valueOf_61zpoe$=function(t){switch(t){case"ALICE_BLUE":return ai();case"ANTIQUE_WHITE":return si();case"AQUA":return li();case"AQUAMARINE":return ui();case"AZURE":return ci();case"BEIGE":return pi();case"BISQUE":return hi();case"BLACK":return _i();case"BLANCHED_ALMOND":return fi();case"BLUE":return di();case"BLUE_VIOLET":return mi();case"BROWN":return yi();case"BURLY_WOOD":return $i();case"CADET_BLUE":return vi();case"CHARTREUSE":return gi();case"CHOCOLATE":return bi();case"CORAL":return wi();case"CORNFLOWER_BLUE":return xi();case"CORNSILK":return ki();case"CRIMSON":return Ei();case"CYAN":return Ci();case"DARK_BLUE":return Si();case"DARK_CYAN":return Ti();case"DARK_GOLDEN_ROD":return Oi();case"DARK_GRAY":return Ni();case"DARK_GREEN":return Pi();case"DARK_GREY":return Ai();case"DARK_KHAKI":return ji();case"DARK_MAGENTA":return Li();case"DARK_OLIVE_GREEN":return Ri();case"DARK_ORANGE":return Ii();case"DARK_ORCHID":return zi();case"DARK_RED":return Di();case"DARK_SALMON":return Mi();case"DARK_SEA_GREEN":return Bi();case"DARK_SLATE_BLUE":return Ui();case"DARK_SLATE_GRAY":return Fi();case"DARK_SLATE_GREY":return qi();case"DARK_TURQUOISE":return Gi();case"DARK_VIOLET":return Hi();case"DEEP_PINK":return Yi();case"DEEP_SKY_BLUE":return Vi();case"DIM_GRAY":return Ki();case"DIM_GREY":return Wi();case"DODGER_BLUE":return Xi();case"FIRE_BRICK":return Zi();case"FLORAL_WHITE":return Ji();case"FOREST_GREEN":return Qi();case"FUCHSIA":return tr();case"GAINSBORO":return er();case"GHOST_WHITE":return nr();case"GOLD":return ir();case"GOLDEN_ROD":return rr();case"GRAY":return or();case"GREY":return ar();case"GREEN":return sr();case"GREEN_YELLOW":return lr();case"HONEY_DEW":return ur();case"HOT_PINK":return cr();case"INDIAN_RED":return pr();case"INDIGO":return hr();case"IVORY":return _r();case"KHAKI":return fr();case"LAVENDER":return dr();case"LAVENDER_BLUSH":return mr();case"LAWN_GREEN":return yr();case"LEMON_CHIFFON":return $r();case"LIGHT_BLUE":return vr();case"LIGHT_CORAL":return gr();case"LIGHT_CYAN":return br();case"LIGHT_GOLDEN_ROD_YELLOW":return wr();case"LIGHT_GRAY":return xr();case"LIGHT_GREEN":return kr();case"LIGHT_GREY":return Er();case"LIGHT_PINK":return Cr();case"LIGHT_SALMON":return Sr();case"LIGHT_SEA_GREEN":return Tr();case"LIGHT_SKY_BLUE":return Or();case"LIGHT_SLATE_GRAY":return Nr();case"LIGHT_SLATE_GREY":return Pr();case"LIGHT_STEEL_BLUE":return Ar();case"LIGHT_YELLOW":return jr();case"LIME":return Lr();case"LIME_GREEN":return Rr();case"LINEN":return Ir();case"MAGENTA":return zr();case"MAROON":return Dr();case"MEDIUM_AQUA_MARINE":return Mr();case"MEDIUM_BLUE":return Br();case"MEDIUM_ORCHID":return Ur();case"MEDIUM_PURPLE":return Fr();case"MEDIUM_SEAGREEN":return qr();case"MEDIUM_SLATE_BLUE":return Gr();case"MEDIUM_SPRING_GREEN":return Hr();case"MEDIUM_TURQUOISE":return Yr();case"MEDIUM_VIOLET_RED":return Vr();case"MIDNIGHT_BLUE":return Kr();case"MINT_CREAM":return Wr();case"MISTY_ROSE":return Xr();case"MOCCASIN":return Zr();case"NAVAJO_WHITE":return Jr();case"NAVY":return Qr();case"OLD_LACE":return to();case"OLIVE":return eo();case"OLIVE_DRAB":return no();case"ORANGE":return io();case"ORANGE_RED":return ro();case"ORCHID":return oo();case"PALE_GOLDEN_ROD":return ao();case"PALE_GREEN":return so();case"PALE_TURQUOISE":return lo();case"PALE_VIOLET_RED":return uo();case"PAPAYA_WHIP":return co();case"PEACH_PUFF":return po();case"PERU":return ho();case"PINK":return _o();case"PLUM":return fo();case"POWDER_BLUE":return mo();case"PURPLE":return yo();case"RED":return $o();case"ROSY_BROWN":return vo();case"ROYAL_BLUE":return go();case"SADDLE_BROWN":return bo();case"SALMON":return wo();case"SANDY_BROWN":return xo();case"SEA_GREEN":return ko();case"SEASHELL":return Eo();case"SIENNA":return Co();case"SILVER":return So();case"SKY_BLUE":return To();case"SLATE_BLUE":return Oo();case"SLATE_GRAY":return No();case"SLATE_GREY":return Po();case"SNOW":return Ao();case"SPRING_GREEN":return jo();case"STEEL_BLUE":return Lo();case"TAN":return Ro();case"TEAL":return Io();case"THISTLE":return zo();case"TOMATO":return Do();case"TURQUOISE":return Mo();case"VIOLET":return Bo();case"WHEAT":return Uo();case"WHITE":return Fo();case"WHITE_SMOKE":return qo();case"YELLOW":return Go();case"YELLOW_GREEN":return Ho();case"NONE":return Yo();case"CURRENT_COLOR":return Vo();default:c("No enum constant jetbrains.datalore.vis.svg.SvgColors."+t)}},Qo.$metadata$={kind:i,simpleName:"SvgConstants",interfaces:[]};var ta=null;function ea(){return null===ta&&new Qo,ta}function na(){oa()}function ia(){ra=this,this.OPACITY=tt().createSpec_ytbaoo$("opacity"),this.CLIP_PATH=tt().createSpec_ytbaoo$("clip-path")}ia.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var ra=null;function oa(){return null===ra&&new ia,ra}function aa(){}function sa(){Oa.call(this),this.elementName_ohv755$_0="defs"}function la(){pa(),Is.call(this),this.myAttributes_9lwppr$_0=new ma(this),this.myListeners_acqj1r$_0=null,this.myEventPeer_bxokaa$_0=new wa}function ua(){ca=this,this.ID_0=tt().createSpec_ytbaoo$("id")}na.$metadata$={kind:p,simpleName:"SvgContainer",interfaces:[]},aa.$metadata$={kind:p,simpleName:"SvgCssResource",interfaces:[]},Object.defineProperty(sa.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_ohv755$_0}}),Object.defineProperty(sa.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),sa.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},sa.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},sa.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},sa.$metadata$={kind:s,simpleName:"SvgDefsElement",interfaces:[_u,na,Oa]},ua.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var ca=null;function pa(){return null===ca&&new ua,ca}function ha(t,e){this.closure$spec=t,this.this$SvgElement=e}function _a(t,e){this.closure$spec=t,this.closure$handler=e}function fa(t){this.closure$event=t}function da(t,e){this.closure$reg=t,this.this$SvgElement=e,v.call(this)}function ma(t){this.$outer=t,this.myAttrs_0=null}function ya(){}function $a(){ba(),Oa.call(this),this.elementName_psynub$_0="ellipse"}function va(){ga=this,this.CX=tt().createSpec_ytbaoo$("cx"),this.CY=tt().createSpec_ytbaoo$("cy"),this.RX=tt().createSpec_ytbaoo$("rx"),this.RY=tt().createSpec_ytbaoo$("ry")}Object.defineProperty(la.prototype,"ownerSvgElement",{configurable:!0,get:function(){for(var t,n=this;null!=n&&!e.isType(n,zl);)n=n.parentProperty().get();return null!=n?null==(t=n)||e.isType(t,zl)?t:o():null}}),Object.defineProperty(la.prototype,"attributeKeys",{configurable:!0,get:function(){return this.myAttributes_9lwppr$_0.keySet()}}),la.prototype.id=function(){return this.getAttribute_mumjwj$(pa().ID_0)},la.prototype.handlersSet=function(){return this.myEventPeer_bxokaa$_0.handlersSet()},la.prototype.addEventHandler_mm8kk2$=function(t,e){return this.myEventPeer_bxokaa$_0.addEventHandler_mm8kk2$(t,e)},la.prototype.dispatch_lgzia2$=function(t,n){var i;this.myEventPeer_bxokaa$_0.dispatch_2raoxs$(t,n,this),null!=this.parentProperty().get()&&!n.isConsumed&&e.isType(this.parentProperty().get(),la)&&(e.isType(i=this.parentProperty().get(),la)?i:o()).dispatch_lgzia2$(t,n)},la.prototype.getSpecByName_o4z2a7$_0=function(t){return tt().createSpec_ytbaoo$(t)},Object.defineProperty(ha.prototype,"propExpr",{configurable:!0,get:function(){return this.toString()+"."+this.closure$spec}}),ha.prototype.get=function(){return this.this$SvgElement.myAttributes_9lwppr$_0.get_mumjwj$(this.closure$spec)},ha.prototype.set_11rb$=function(t){this.this$SvgElement.myAttributes_9lwppr$_0.set_qdh7ux$(this.closure$spec,t)},_a.prototype.onAttrSet_ud3ldc$=function(t){var n,i;if(this.closure$spec===t.attrSpec){var r=null==(n=t.oldValue)||e.isType(n,f)?n:o(),a=null==(i=t.newValue)||e.isType(i,f)?i:o();this.closure$handler.onEvent_11rb$(new d(r,a))}},_a.$metadata$={kind:s,interfaces:[ya]},ha.prototype.addHandler_gxwwpc$=function(t){return this.this$SvgElement.addListener_e4m8w6$(new _a(this.closure$spec,t))},ha.$metadata$={kind:s,interfaces:[m]},la.prototype.getAttribute_mumjwj$=function(t){return new ha(t,this)},la.prototype.getAttribute_61zpoe$=function(t){var e=this.getSpecByName_o4z2a7$_0(t);return this.getAttribute_mumjwj$(e)},la.prototype.setAttribute_qdh7ux$=function(t,e){this.getAttribute_mumjwj$(t).set_11rb$(e)},la.prototype.setAttribute_jyasbz$=function(t,e){this.getAttribute_61zpoe$(t).set_11rb$(e)},fa.prototype.call_11rb$=function(t){t.onAttrSet_ud3ldc$(this.closure$event)},fa.$metadata$={kind:s,interfaces:[y]},la.prototype.onAttributeChanged_2oaikr$_0=function(t){null!=this.myListeners_acqj1r$_0&&l(this.myListeners_acqj1r$_0).fire_kucmxw$(new fa(t)),this.isAttached()&&this.container().attributeChanged_1u4bot$(this,t)},da.prototype.doRemove=function(){this.closure$reg.remove(),l(this.this$SvgElement.myListeners_acqj1r$_0).isEmpty&&(this.this$SvgElement.myListeners_acqj1r$_0=null)},da.$metadata$={kind:s,interfaces:[v]},la.prototype.addListener_e4m8w6$=function(t){return null==this.myListeners_acqj1r$_0&&(this.myListeners_acqj1r$_0=new $),new da(l(this.myListeners_acqj1r$_0).add_11rb$(t),this)},la.prototype.toString=function(){return"<"+this.elementName+" "+this.myAttributes_9lwppr$_0.toSvgString_8be2vx$()+">"},Object.defineProperty(ma.prototype,"isEmpty",{configurable:!0,get:function(){return null==this.myAttrs_0||l(this.myAttrs_0).isEmpty}}),ma.prototype.size=function(){return null==this.myAttrs_0?0:l(this.myAttrs_0).size()},ma.prototype.containsKey_p8ci7$=function(t){return null!=this.myAttrs_0&&l(this.myAttrs_0).containsKey_11rb$(t)},ma.prototype.get_mumjwj$=function(t){var n;return null!=this.myAttrs_0&&l(this.myAttrs_0).containsKey_11rb$(t)?null==(n=l(this.myAttrs_0).get_11rb$(t))||e.isType(n,f)?n:o():null},ma.prototype.set_qdh7ux$=function(t,n){var i,r;null==this.myAttrs_0&&(this.myAttrs_0=new g);var s=null==n?null==(i=l(this.myAttrs_0).remove_11rb$(t))||e.isType(i,f)?i:o():null==(r=l(this.myAttrs_0).put_xwzc9p$(t,n))||e.isType(r,f)?r:o();if(!a(n,s)){var u=new Nu(t,s,n);this.$outer.onAttributeChanged_2oaikr$_0(u)}return s},ma.prototype.remove_mumjwj$=function(t){return this.set_qdh7ux$(t,null)},ma.prototype.keySet=function(){return null==this.myAttrs_0?b():l(this.myAttrs_0).keySet()},ma.prototype.toSvgString_8be2vx$=function(){var t,e=w();for(t=this.keySet().iterator();t.hasNext();){var n=t.next();e.append_pdl1vj$(n.name).append_pdl1vj$('="').append_s8jyv4$(this.get_mumjwj$(n)).append_pdl1vj$('" ')}return e.toString()},ma.prototype.toString=function(){return this.toSvgString_8be2vx$()},ma.$metadata$={kind:s,simpleName:"AttributeMap",interfaces:[]},la.$metadata$={kind:s,simpleName:"SvgElement",interfaces:[Is]},ya.$metadata$={kind:p,simpleName:"SvgElementListener",interfaces:[]},va.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var ga=null;function ba(){return null===ga&&new va,ga}function wa(){this.myEventHandlers_0=null,this.myListeners_0=null}function xa(t){this.this$SvgEventPeer=t}function ka(t,e){this.closure$addReg=t,this.this$SvgEventPeer=e,v.call(this)}function Ea(t,e,n,i){this.closure$addReg=t,this.closure$specListeners=e,this.closure$eventHandlers=n,this.closure$spec=i,v.call(this)}function Ca(t,e){this.closure$oldHandlersSet=t,this.this$SvgEventPeer=e}function Sa(t,e){this.closure$event=t,this.closure$target=e}function Ta(){Oa.call(this),this.elementName_84zyy2$_0="g"}function Oa(){Ya(),Al.call(this)}function Na(){Ha=this,this.POINTER_EVENTS_0=tt().createSpec_ytbaoo$("pointer-events"),this.OPACITY=tt().createSpec_ytbaoo$("opacity"),this.VISIBILITY=tt().createSpec_ytbaoo$("visibility"),this.CLIP_PATH=tt().createSpec_ytbaoo$("clip-path"),this.CLIP_BOUNDS_JFX=tt().createSpec_ytbaoo$("clip-bounds-jfx")}Object.defineProperty($a.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_psynub$_0}}),Object.defineProperty($a.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),$a.prototype.cx=function(){return this.getAttribute_mumjwj$(ba().CX)},$a.prototype.cy=function(){return this.getAttribute_mumjwj$(ba().CY)},$a.prototype.rx=function(){return this.getAttribute_mumjwj$(ba().RX)},$a.prototype.ry=function(){return this.getAttribute_mumjwj$(ba().RY)},$a.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},$a.prototype.fill=function(){return this.getAttribute_mumjwj$(Pl().FILL)},$a.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},$a.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Pl().FILL_OPACITY)},$a.prototype.stroke=function(){return this.getAttribute_mumjwj$(Pl().STROKE)},$a.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},$a.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Pl().STROKE_OPACITY)},$a.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Pl().STROKE_WIDTH)},$a.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},$a.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},$a.$metadata$={kind:s,simpleName:"SvgEllipseElement",interfaces:[Tl,_u,Oa]},Object.defineProperty(xa.prototype,"propExpr",{configurable:!0,get:function(){return this.toString()+".handlersProp"}}),xa.prototype.get=function(){return this.this$SvgEventPeer.handlersKeySet_0()},ka.prototype.doRemove=function(){this.closure$addReg.remove(),l(this.this$SvgEventPeer.myListeners_0).isEmpty&&(this.this$SvgEventPeer.myListeners_0=null)},ka.$metadata$={kind:s,interfaces:[v]},xa.prototype.addHandler_gxwwpc$=function(t){return null==this.this$SvgEventPeer.myListeners_0&&(this.this$SvgEventPeer.myListeners_0=new $),new ka(l(this.this$SvgEventPeer.myListeners_0).add_11rb$(t),this.this$SvgEventPeer)},xa.$metadata$={kind:s,interfaces:[x]},wa.prototype.handlersSet=function(){return new xa(this)},wa.prototype.handlersKeySet_0=function(){return null==this.myEventHandlers_0?b():l(this.myEventHandlers_0).keys},Ea.prototype.doRemove=function(){this.closure$addReg.remove(),this.closure$specListeners.isEmpty&&this.closure$eventHandlers.remove_11rb$(this.closure$spec)},Ea.$metadata$={kind:s,interfaces:[v]},Ca.prototype.call_11rb$=function(t){t.onEvent_11rb$(new d(this.closure$oldHandlersSet,this.this$SvgEventPeer.handlersKeySet_0()))},Ca.$metadata$={kind:s,interfaces:[y]},wa.prototype.addEventHandler_mm8kk2$=function(t,e){var n;null==this.myEventHandlers_0&&(this.myEventHandlers_0=h());var i=l(this.myEventHandlers_0);if(!i.containsKey_11rb$(t)){var r=new $;i.put_xwzc9p$(t,r)}var o=i.keys,a=l(i.get_11rb$(t)),s=new Ea(a.add_11rb$(e),a,i,t);return null!=(n=this.myListeners_0)&&n.fire_kucmxw$(new Ca(o,this)),s},Sa.prototype.call_11rb$=function(t){var n;this.closure$event.isConsumed||(e.isType(n=t,Pu)?n:o()).handle_42da0z$(this.closure$target,this.closure$event)},Sa.$metadata$={kind:s,interfaces:[y]},wa.prototype.dispatch_2raoxs$=function(t,e,n){null!=this.myEventHandlers_0&&l(this.myEventHandlers_0).containsKey_11rb$(t)&&l(l(this.myEventHandlers_0).get_11rb$(t)).fire_kucmxw$(new Sa(e,n))},wa.$metadata$={kind:s,simpleName:"SvgEventPeer",interfaces:[]},Object.defineProperty(Ta.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_84zyy2$_0}}),Object.defineProperty(Ta.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),Ta.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},Ta.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},Ta.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},Ta.$metadata$={kind:s,simpleName:"SvgGElement",interfaces:[na,_u,Oa]},Na.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Pa,Aa,ja,La,Ra,Ia,za,Da,Ma,Ba,Ua,Fa,qa,Ga,Ha=null;function Ya(){return null===Ha&&new Na,Ha}function Va(t,e,n){u.call(this),this.myAttributeString_wpy0pw$_0=n,this.name$=t,this.ordinal$=e}function Ka(){Ka=function(){},Pa=new Va("VISIBLE_PAINTED",0,"visiblePainted"),Aa=new Va("VISIBLE_FILL",1,"visibleFill"),ja=new Va("VISIBLE_STROKE",2,"visibleStroke"),La=new Va("VISIBLE",3,"visible"),Ra=new Va("PAINTED",4,"painted"),Ia=new Va("FILL",5,"fill"),za=new Va("STROKE",6,"stroke"),Da=new Va("ALL",7,"all"),Ma=new Va("NONE",8,"none"),Ba=new Va("INHERIT",9,"inherit")}function Wa(){return Ka(),Pa}function Xa(){return Ka(),Aa}function Za(){return Ka(),ja}function Ja(){return Ka(),La}function Qa(){return Ka(),Ra}function ts(){return Ka(),Ia}function es(){return Ka(),za}function ns(){return Ka(),Da}function is(){return Ka(),Ma}function rs(){return Ka(),Ba}function os(t,e,n){u.call(this),this.myAttrString_w3r471$_0=n,this.name$=t,this.ordinal$=e}function as(){as=function(){},Ua=new os("VISIBLE",0,"visible"),Fa=new os("HIDDEN",1,"hidden"),qa=new os("COLLAPSE",2,"collapse"),Ga=new os("INHERIT",3,"inherit")}function ss(){return as(),Ua}function ls(){return as(),Fa}function us(){return as(),qa}function cs(){return as(),Ga}function ps(t){this.myElementId_0=t}function hs(){ds(),Oa.call(this),this.elementName_r17hoq$_0="image",this.setAttribute_qdh7ux$(ds().PRESERVE_ASPECT_RATIO,"none"),this.setAttribute_jyasbz$(ea().SVG_STYLE_ATTRIBUTE,"image-rendering: pixelated;image-rendering: crisp-edges;")}function _s(){fs=this,this.X=tt().createSpec_ytbaoo$("x"),this.Y=tt().createSpec_ytbaoo$("y"),this.WIDTH=tt().createSpec_ytbaoo$(ea().WIDTH),this.HEIGHT=tt().createSpec_ytbaoo$(ea().HEIGHT),this.HREF=tt().createSpecNS_wswq18$("href",Ou().XLINK_PREFIX,Ou().XLINK_NAMESPACE_URI),this.PRESERVE_ASPECT_RATIO=tt().createSpec_ytbaoo$("preserveAspectRatio")}Oa.prototype.pointerEvents=function(){return this.getAttribute_mumjwj$(Ya().POINTER_EVENTS_0)},Oa.prototype.opacity=function(){return this.getAttribute_mumjwj$(Ya().OPACITY)},Oa.prototype.visibility=function(){return this.getAttribute_mumjwj$(Ya().VISIBILITY)},Oa.prototype.clipPath=function(){return this.getAttribute_mumjwj$(Ya().CLIP_PATH)},Va.prototype.toString=function(){return this.myAttributeString_wpy0pw$_0},Va.$metadata$={kind:s,simpleName:"PointerEvents",interfaces:[u]},Va.values=function(){return[Wa(),Xa(),Za(),Ja(),Qa(),ts(),es(),ns(),is(),rs()]},Va.valueOf_61zpoe$=function(t){switch(t){case"VISIBLE_PAINTED":return Wa();case"VISIBLE_FILL":return Xa();case"VISIBLE_STROKE":return Za();case"VISIBLE":return Ja();case"PAINTED":return Qa();case"FILL":return ts();case"STROKE":return es();case"ALL":return ns();case"NONE":return is();case"INHERIT":return rs();default:c("No enum constant jetbrains.datalore.vis.svg.SvgGraphicsElement.PointerEvents."+t)}},os.prototype.toString=function(){return this.myAttrString_w3r471$_0},os.$metadata$={kind:s,simpleName:"Visibility",interfaces:[u]},os.values=function(){return[ss(),ls(),us(),cs()]},os.valueOf_61zpoe$=function(t){switch(t){case"VISIBLE":return ss();case"HIDDEN":return ls();case"COLLAPSE":return us();case"INHERIT":return cs();default:c("No enum constant jetbrains.datalore.vis.svg.SvgGraphicsElement.Visibility."+t)}},Oa.$metadata$={kind:s,simpleName:"SvgGraphicsElement",interfaces:[Al]},ps.prototype.toString=function(){return"url(#"+this.myElementId_0+")"},ps.$metadata$={kind:s,simpleName:"SvgIRI",interfaces:[]},_s.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var fs=null;function ds(){return null===fs&&new _s,fs}function ms(t,e,n,i,r){return r=r||Object.create(hs.prototype),hs.call(r),r.setAttribute_qdh7ux$(ds().X,t),r.setAttribute_qdh7ux$(ds().Y,e),r.setAttribute_qdh7ux$(ds().WIDTH,n),r.setAttribute_qdh7ux$(ds().HEIGHT,i),r}function ys(t,e,n,i,r){ms(t,e,n,i,this),this.myBitmap_0=r}function $s(t,e){this.closure$hrefProp=t,this.this$SvgImageElementEx=e}function vs(){}function gs(t,e,n){this.width=t,this.height=e,this.argbValues=n.slice()}function bs(){Ls(),Oa.call(this),this.elementName_7igd9t$_0="line"}function ws(){js=this,this.X1=tt().createSpec_ytbaoo$("x1"),this.Y1=tt().createSpec_ytbaoo$("y1"),this.X2=tt().createSpec_ytbaoo$("x2"),this.Y2=tt().createSpec_ytbaoo$("y2")}Object.defineProperty(hs.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_r17hoq$_0}}),Object.defineProperty(hs.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),hs.prototype.x=function(){return this.getAttribute_mumjwj$(ds().X)},hs.prototype.y=function(){return this.getAttribute_mumjwj$(ds().Y)},hs.prototype.width=function(){return this.getAttribute_mumjwj$(ds().WIDTH)},hs.prototype.height=function(){return this.getAttribute_mumjwj$(ds().HEIGHT)},hs.prototype.href=function(){return this.getAttribute_mumjwj$(ds().HREF)},hs.prototype.preserveAspectRatio=function(){return this.getAttribute_mumjwj$(ds().PRESERVE_ASPECT_RATIO)},hs.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},hs.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},hs.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},hs.$metadata$={kind:s,simpleName:"SvgImageElement",interfaces:[_u,Oa]},Object.defineProperty($s.prototype,"propExpr",{configurable:!0,get:function(){return this.closure$hrefProp.propExpr}}),$s.prototype.get=function(){return this.closure$hrefProp.get()},$s.prototype.addHandler_gxwwpc$=function(t){return this.closure$hrefProp.addHandler_gxwwpc$(t)},$s.prototype.set_11rb$=function(t){throw k("href property is read-only in "+e.getKClassFromExpression(this.this$SvgImageElementEx).simpleName)},$s.$metadata$={kind:s,interfaces:[m]},ys.prototype.href=function(){return new $s(hs.prototype.href.call(this),this)},ys.prototype.asImageElement_xhdger$=function(t){var e=new hs;gu().copyAttributes_azdp7k$(this,e);var n=t.toDataUrl_nps3vt$(this.myBitmap_0.width,this.myBitmap_0.height,this.myBitmap_0.argbValues);return e.href().set_11rb$(n),e},vs.$metadata$={kind:p,simpleName:"RGBEncoder",interfaces:[]},gs.$metadata$={kind:s,simpleName:"Bitmap",interfaces:[]},ys.$metadata$={kind:s,simpleName:"SvgImageElementEx",interfaces:[hs]},ws.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var xs,ks,Es,Cs,Ss,Ts,Os,Ns,Ps,As,js=null;function Ls(){return null===js&&new ws,js}function Rs(){}function Is(){S.call(this),this.myContainer_rnn3uj$_0=null,this.myChildren_jvkzg9$_0=null,this.isPrebuiltSubtree=!1}function zs(t,e){this.$outer=t,C.call(this,e)}function Ds(t){this.mySvgRoot_0=new Fs(this,t),this.myListeners_0=new $,this.myPeer_0=null,this.mySvgRoot_0.get().attach_1gwaml$(this)}function Ms(t,e){this.closure$element=t,this.closure$event=e}function Bs(t){this.closure$node=t}function Us(t){this.closure$node=t}function Fs(t,e){this.this$SvgNodeContainer=t,O.call(this,e)}function qs(t){pl(),this.myPathData_0=t}function Gs(t,e,n){u.call(this),this.myChar_90i289$_0=n,this.name$=t,this.ordinal$=e}function Hs(){Hs=function(){},xs=new Gs("MOVE_TO",0,109),ks=new Gs("LINE_TO",1,108),Es=new Gs("HORIZONTAL_LINE_TO",2,104),Cs=new Gs("VERTICAL_LINE_TO",3,118),Ss=new Gs("CURVE_TO",4,99),Ts=new Gs("SMOOTH_CURVE_TO",5,115),Os=new Gs("QUADRATIC_BEZIER_CURVE_TO",6,113),Ns=new Gs("SMOOTH_QUADRATIC_BEZIER_CURVE_TO",7,116),Ps=new Gs("ELLIPTICAL_ARC",8,97),As=new Gs("CLOSE_PATH",9,122),rl()}function Ys(){return Hs(),xs}function Vs(){return Hs(),ks}function Ks(){return Hs(),Es}function Ws(){return Hs(),Cs}function Xs(){return Hs(),Ss}function Zs(){return Hs(),Ts}function Js(){return Hs(),Os}function Qs(){return Hs(),Ns}function tl(){return Hs(),Ps}function el(){return Hs(),As}function nl(){var t,e;for(il=this,this.MAP_0=h(),t=ol(),e=0;e!==t.length;++e){var n=t[e],i=this.MAP_0,r=n.absoluteCmd();i.put_xwzc9p$(r,n);var o=this.MAP_0,a=n.relativeCmd();o.put_xwzc9p$(a,n)}}Object.defineProperty(bs.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_7igd9t$_0}}),Object.defineProperty(bs.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),bs.prototype.x1=function(){return this.getAttribute_mumjwj$(Ls().X1)},bs.prototype.y1=function(){return this.getAttribute_mumjwj$(Ls().Y1)},bs.prototype.x2=function(){return this.getAttribute_mumjwj$(Ls().X2)},bs.prototype.y2=function(){return this.getAttribute_mumjwj$(Ls().Y2)},bs.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},bs.prototype.fill=function(){return this.getAttribute_mumjwj$(Pl().FILL)},bs.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},bs.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Pl().FILL_OPACITY)},bs.prototype.stroke=function(){return this.getAttribute_mumjwj$(Pl().STROKE)},bs.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},bs.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Pl().STROKE_OPACITY)},bs.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Pl().STROKE_WIDTH)},bs.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},bs.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},bs.$metadata$={kind:s,simpleName:"SvgLineElement",interfaces:[Tl,_u,Oa]},Rs.$metadata$={kind:p,simpleName:"SvgLocatable",interfaces:[]},Is.prototype.isAttached=function(){return null!=this.myContainer_rnn3uj$_0},Is.prototype.container=function(){return l(this.myContainer_rnn3uj$_0)},Is.prototype.children=function(){var t;return null==this.myChildren_jvkzg9$_0&&(this.myChildren_jvkzg9$_0=new zs(this,this)),e.isType(t=this.myChildren_jvkzg9$_0,E)?t:o()},Is.prototype.attach_1gwaml$=function(t){var e;if(this.isAttached())throw k("Svg element is already attached");for(e=this.children().iterator();e.hasNext();)e.next().attach_1gwaml$(t);this.myContainer_rnn3uj$_0=t,l(this.myContainer_rnn3uj$_0).svgNodeAttached_vvfmut$(this)},Is.prototype.detach_8be2vx$=function(){var t;if(!this.isAttached())throw k("Svg element is not attached");for(t=this.children().iterator();t.hasNext();)t.next().detach_8be2vx$();l(this.myContainer_rnn3uj$_0).svgNodeDetached_vvfmut$(this),this.myContainer_rnn3uj$_0=null},zs.prototype.beforeItemAdded_wxm5ur$=function(t,e){this.$outer.isAttached()&&e.attach_1gwaml$(this.$outer.container()),C.prototype.beforeItemAdded_wxm5ur$.call(this,t,e)},zs.prototype.beforeItemSet_hu11d4$=function(t,e,n){this.$outer.isAttached()&&(e.detach_8be2vx$(),n.attach_1gwaml$(this.$outer.container())),C.prototype.beforeItemSet_hu11d4$.call(this,t,e,n)},zs.prototype.beforeItemRemoved_wxm5ur$=function(t,e){this.$outer.isAttached()&&e.detach_8be2vx$(),C.prototype.beforeItemRemoved_wxm5ur$.call(this,t,e)},zs.$metadata$={kind:s,simpleName:"SvgChildList",interfaces:[C]},Is.$metadata$={kind:s,simpleName:"SvgNode",interfaces:[S]},Ds.prototype.setPeer_kqs5uc$=function(t){this.myPeer_0=t},Ds.prototype.getPeer=function(){return this.myPeer_0},Ds.prototype.root=function(){return this.mySvgRoot_0},Ds.prototype.addListener_6zkzfn$=function(t){return this.myListeners_0.add_11rb$(t)},Ms.prototype.call_11rb$=function(t){t.onAttributeSet_os9wmi$(this.closure$element,this.closure$event)},Ms.$metadata$={kind:s,interfaces:[y]},Ds.prototype.attributeChanged_1u4bot$=function(t,e){this.myListeners_0.fire_kucmxw$(new Ms(t,e))},Bs.prototype.call_11rb$=function(t){t.onNodeAttached_26jijc$(this.closure$node)},Bs.$metadata$={kind:s,interfaces:[y]},Ds.prototype.svgNodeAttached_vvfmut$=function(t){this.myListeners_0.fire_kucmxw$(new Bs(t))},Us.prototype.call_11rb$=function(t){t.onNodeDetached_26jijc$(this.closure$node)},Us.$metadata$={kind:s,interfaces:[y]},Ds.prototype.svgNodeDetached_vvfmut$=function(t){this.myListeners_0.fire_kucmxw$(new Us(t))},Fs.prototype.set_11rb$=function(t){this.get().detach_8be2vx$(),O.prototype.set_11rb$.call(this,t),t.attach_1gwaml$(this.this$SvgNodeContainer)},Fs.$metadata$={kind:s,interfaces:[O]},Ds.$metadata$={kind:s,simpleName:"SvgNodeContainer",interfaces:[]},Gs.prototype.relativeCmd=function(){return N(this.myChar_90i289$_0)},Gs.prototype.absoluteCmd=function(){return N(P(this.myChar_90i289$_0))},nl.prototype.get_s8itvh$=function(t){if(this.MAP_0.containsKey_11rb$(N(t)))return l(this.MAP_0.get_11rb$(N(t)));throw L("No enum constant "+j(A(Gs))+"@myChar."+String.fromCharCode(N(t)))},nl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var il=null;function rl(){return Hs(),null===il&&new nl,il}function ol(){return[Ys(),Vs(),Ks(),Ws(),Xs(),Zs(),Js(),Qs(),tl(),el()]}function al(){cl=this,this.EMPTY=new qs("")}Gs.$metadata$={kind:s,simpleName:"Action",interfaces:[u]},Gs.values=ol,Gs.valueOf_61zpoe$=function(t){switch(t){case"MOVE_TO":return Ys();case"LINE_TO":return Vs();case"HORIZONTAL_LINE_TO":return Ks();case"VERTICAL_LINE_TO":return Ws();case"CURVE_TO":return Xs();case"SMOOTH_CURVE_TO":return Zs();case"QUADRATIC_BEZIER_CURVE_TO":return Js();case"SMOOTH_QUADRATIC_BEZIER_CURVE_TO":return Qs();case"ELLIPTICAL_ARC":return tl();case"CLOSE_PATH":return el();default:c("No enum constant jetbrains.datalore.vis.svg.SvgPathData.Action."+t)}},qs.prototype.toString=function(){return this.myPathData_0},al.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var sl,ll,ul,cl=null;function pl(){return null===cl&&new al,cl}function hl(t){void 0===t&&(t=!0),this.myDefaultAbsolute_0=t,this.myStringBuilder_0=null,this.myTension_0=.7,this.myStringBuilder_0=w()}function _l(t,e){u.call(this),this.name$=t,this.ordinal$=e}function fl(){fl=function(){},sl=new _l("LINEAR",0),ll=new _l("CARDINAL",1),ul=new _l("MONOTONE",2)}function dl(){return fl(),sl}function ml(){return fl(),ll}function yl(){return fl(),ul}function $l(){bl(),Oa.call(this),this.elementName_d87la8$_0="path"}function vl(){gl=this,this.D=tt().createSpec_ytbaoo$("d")}qs.$metadata$={kind:s,simpleName:"SvgPathData",interfaces:[]},_l.$metadata$={kind:s,simpleName:"Interpolation",interfaces:[u]},_l.values=function(){return[dl(),ml(),yl()]},_l.valueOf_61zpoe$=function(t){switch(t){case"LINEAR":return dl();case"CARDINAL":return ml();case"MONOTONE":return yl();default:c("No enum constant jetbrains.datalore.vis.svg.SvgPathDataBuilder.Interpolation."+t)}},hl.prototype.build=function(){return new qs(this.myStringBuilder_0.toString())},hl.prototype.addAction_0=function(t,e,n){var i;for(e?this.myStringBuilder_0.append_s8itvh$(R(t.absoluteCmd())):this.myStringBuilder_0.append_s8itvh$(R(t.relativeCmd())),i=0;i!==n.length;++i){var r=n[i];this.myStringBuilder_0.append_s8jyv4$(r).append_s8itvh$(32)}},hl.prototype.addActionWithStringTokens_0=function(t,e,n){var i;for(e?this.myStringBuilder_0.append_s8itvh$(R(t.absoluteCmd())):this.myStringBuilder_0.append_s8itvh$(R(t.relativeCmd())),i=0;i!==n.length;++i){var r=n[i];this.myStringBuilder_0.append_pdl1vj$(r).append_s8itvh$(32)}},hl.prototype.moveTo_przk3b$=function(t,e,n){return void 0===n&&(n=this.myDefaultAbsolute_0),this.addAction_0(Ys(),n,new Float64Array([t,e])),this},hl.prototype.moveTo_k2qmv6$=function(t,e){return this.moveTo_przk3b$(t.x,t.y,e)},hl.prototype.moveTo_gpjtzr$=function(t){return this.moveTo_przk3b$(t.x,t.y)},hl.prototype.lineTo_przk3b$=function(t,e,n){return void 0===n&&(n=this.myDefaultAbsolute_0),this.addAction_0(Vs(),n,new Float64Array([t,e])),this},hl.prototype.lineTo_k2qmv6$=function(t,e){return this.lineTo_przk3b$(t.x,t.y,e)},hl.prototype.lineTo_gpjtzr$=function(t){return this.lineTo_przk3b$(t.x,t.y)},hl.prototype.horizontalLineTo_8555vt$=function(t,e){return void 0===e&&(e=this.myDefaultAbsolute_0),this.addAction_0(Ks(),e,new Float64Array([t])),this},hl.prototype.verticalLineTo_8555vt$=function(t,e){return void 0===e&&(e=this.myDefaultAbsolute_0),this.addAction_0(Ws(),e,new Float64Array([t])),this},hl.prototype.curveTo_igz2nj$=function(t,e,n,i,r,o,a){return void 0===a&&(a=this.myDefaultAbsolute_0),this.addAction_0(Xs(),a,new Float64Array([t,e,n,i,r,o])),this},hl.prototype.curveTo_d4nu7w$=function(t,e,n,i){return this.curveTo_igz2nj$(t.x,t.y,e.x,e.y,n.x,n.y,i)},hl.prototype.curveTo_fkixjx$=function(t,e,n){return this.curveTo_igz2nj$(t.x,t.y,e.x,e.y,n.x,n.y)},hl.prototype.smoothCurveTo_84c9il$=function(t,e,n,i,r){return void 0===r&&(r=this.myDefaultAbsolute_0),this.addAction_0(Zs(),r,new Float64Array([t,e,n,i])),this},hl.prototype.smoothCurveTo_sosulb$=function(t,e,n){return this.smoothCurveTo_84c9il$(t.x,t.y,e.x,e.y,n)},hl.prototype.smoothCurveTo_qt8ska$=function(t,e){return this.smoothCurveTo_84c9il$(t.x,t.y,e.x,e.y)},hl.prototype.quadraticBezierCurveTo_84c9il$=function(t,e,n,i,r){return void 0===r&&(r=this.myDefaultAbsolute_0),this.addAction_0(Js(),r,new Float64Array([t,e,n,i])),this},hl.prototype.quadraticBezierCurveTo_sosulb$=function(t,e,n){return this.quadraticBezierCurveTo_84c9il$(t.x,t.y,e.x,e.y,n)},hl.prototype.quadraticBezierCurveTo_qt8ska$=function(t,e){return this.quadraticBezierCurveTo_84c9il$(t.x,t.y,e.x,e.y)},hl.prototype.smoothQuadraticBezierCurveTo_przk3b$=function(t,e,n){return void 0===n&&(n=this.myDefaultAbsolute_0),this.addAction_0(Qs(),n,new Float64Array([t,e])),this},hl.prototype.smoothQuadraticBezierCurveTo_k2qmv6$=function(t,e){return this.smoothQuadraticBezierCurveTo_przk3b$(t.x,t.y,e)},hl.prototype.smoothQuadraticBezierCurveTo_gpjtzr$=function(t){return this.smoothQuadraticBezierCurveTo_przk3b$(t.x,t.y)},hl.prototype.ellipticalArc_d37okh$=function(t,e,n,i,r,o,a,s){return void 0===s&&(s=this.myDefaultAbsolute_0),this.addActionWithStringTokens_0(tl(),s,[t.toString(),e.toString(),n.toString(),i?"1":"0",r?"1":"0",o.toString(),a.toString()]),this},hl.prototype.ellipticalArc_dcaprc$=function(t,e,n,i,r,o,a){return this.ellipticalArc_d37okh$(t,e,n,i,r,o.x,o.y,a)},hl.prototype.ellipticalArc_gc0whr$=function(t,e,n,i,r,o){return this.ellipticalArc_d37okh$(t,e,n,i,r,o.x,o.y)},hl.prototype.closePath=function(){return this.addAction_0(el(),this.myDefaultAbsolute_0,new Float64Array([])),this},hl.prototype.setTension_14dthe$=function(t){if(0>t||t>1)throw L("Tension should be within [0, 1] interval");this.myTension_0=t},hl.prototype.lineSlope_0=function(t,e){return(e.y-t.y)/(e.x-t.x)},hl.prototype.finiteDifferences_0=function(t){var e,n=I(t.size),i=this.lineSlope_0(t.get_za3lpa$(0),t.get_za3lpa$(1));n.add_11rb$(i),e=t.size-1|0;for(var r=1;r1){a=e.get_za3lpa$(1),r=t.get_za3lpa$(s),s=s+1|0,this.curveTo_igz2nj$(i.x+o.x,i.y+o.y,r.x-a.x,r.y-a.y,r.x,r.y,!0);for(var l=2;l9){var l=s;s=3*r/B.sqrt(l),n.set_wxm5ur$(i,s*o),n.set_wxm5ur$(i+1|0,s*a)}}}for(var u=z(),c=0;c!==t.size;++c){var p=c+1|0,h=t.size-1|0,_=c-1|0,f=(t.get_za3lpa$(B.min(p,h)).x-t.get_za3lpa$(B.max(_,0)).x)/(6*(1+n.get_za3lpa$(c)*n.get_za3lpa$(c)));u.add_11rb$(new D(f,n.get_za3lpa$(c)*f))}return u},hl.prototype.interpolatePoints_3g1a62$=function(t,e,n){if(t.size!==e.size)throw L("Sizes of xs and ys must be equal");for(var i=I(t.size),r=M(t),o=M(e),a=0;a!==t.size;++a)i.add_11rb$(new D(r.get_za3lpa$(a),o.get_za3lpa$(a)));switch(n.name){case"LINEAR":this.doLinearInterpolation_0(i);break;case"CARDINAL":i.size<3?this.doLinearInterpolation_0(i):this.doCardinalInterpolation_0(i);break;case"MONOTONE":i.size<3?this.doLinearInterpolation_0(i):this.doHermiteInterpolation_0(i,this.monotoneTangents_0(i))}return this},hl.prototype.interpolatePoints_1ravjc$=function(t,e){var n,i=I(t.size),r=I(t.size);for(n=t.iterator();n.hasNext();){var o=n.next();i.add_11rb$(o.x),r.add_11rb$(o.y)}return this.interpolatePoints_3g1a62$(i,r,e)},hl.$metadata$={kind:s,simpleName:"SvgPathDataBuilder",interfaces:[]},vl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var gl=null;function bl(){return null===gl&&new vl,gl}function wl(){}function xl(){Cl(),Oa.call(this),this.elementName_sgtow1$_0="rect"}function kl(){El=this,this.X=tt().createSpec_ytbaoo$("x"),this.Y=tt().createSpec_ytbaoo$("y"),this.WIDTH=tt().createSpec_ytbaoo$(ea().WIDTH),this.HEIGHT=tt().createSpec_ytbaoo$(ea().HEIGHT)}Object.defineProperty($l.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_d87la8$_0}}),Object.defineProperty($l.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),$l.prototype.d=function(){return this.getAttribute_mumjwj$(bl().D)},$l.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},$l.prototype.fill=function(){return this.getAttribute_mumjwj$(Pl().FILL)},$l.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},$l.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Pl().FILL_OPACITY)},$l.prototype.stroke=function(){return this.getAttribute_mumjwj$(Pl().STROKE)},$l.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},$l.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Pl().STROKE_OPACITY)},$l.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Pl().STROKE_WIDTH)},$l.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},$l.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},$l.$metadata$={kind:s,simpleName:"SvgPathElement",interfaces:[Tl,_u,Oa]},wl.$metadata$={kind:p,simpleName:"SvgPlatformPeer",interfaces:[]},kl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var El=null;function Cl(){return null===El&&new kl,El}function Sl(t,e,n,i,r){return r=r||Object.create(xl.prototype),xl.call(r),r.setAttribute_qdh7ux$(Cl().X,t),r.setAttribute_qdh7ux$(Cl().Y,e),r.setAttribute_qdh7ux$(Cl().HEIGHT,i),r.setAttribute_qdh7ux$(Cl().WIDTH,n),r}function Tl(){Pl()}function Ol(){Nl=this,this.FILL=tt().createSpec_ytbaoo$("fill"),this.FILL_OPACITY=tt().createSpec_ytbaoo$("fill-opacity"),this.STROKE=tt().createSpec_ytbaoo$("stroke"),this.STROKE_OPACITY=tt().createSpec_ytbaoo$("stroke-opacity"),this.STROKE_WIDTH=tt().createSpec_ytbaoo$("stroke-width")}Object.defineProperty(xl.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_sgtow1$_0}}),Object.defineProperty(xl.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),xl.prototype.x=function(){return this.getAttribute_mumjwj$(Cl().X)},xl.prototype.y=function(){return this.getAttribute_mumjwj$(Cl().Y)},xl.prototype.height=function(){return this.getAttribute_mumjwj$(Cl().HEIGHT)},xl.prototype.width=function(){return this.getAttribute_mumjwj$(Cl().WIDTH)},xl.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},xl.prototype.fill=function(){return this.getAttribute_mumjwj$(Pl().FILL)},xl.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},xl.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Pl().FILL_OPACITY)},xl.prototype.stroke=function(){return this.getAttribute_mumjwj$(Pl().STROKE)},xl.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},xl.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Pl().STROKE_OPACITY)},xl.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Pl().STROKE_WIDTH)},xl.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},xl.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},xl.$metadata$={kind:s,simpleName:"SvgRectElement",interfaces:[Tl,_u,Oa]},Ol.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Nl=null;function Pl(){return null===Nl&&new Ol,Nl}function Al(){Rl(),la.call(this)}function jl(){Ll=this,this.CLASS=tt().createSpec_ytbaoo$("class")}Tl.$metadata$={kind:p,simpleName:"SvgShape",interfaces:[]},jl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Ll=null;function Rl(){return null===Ll&&new jl,Ll}function Il(t){la.call(this),this.resource=t,this.elementName_1a5z8g$_0="style",this.setContent_61zpoe$(this.resource.css())}function zl(){Bl(),Al.call(this),this.elementName_9c3al$_0="svg"}function Dl(){Ml=this,this.X=tt().createSpec_ytbaoo$("x"),this.Y=tt().createSpec_ytbaoo$("y"),this.WIDTH=tt().createSpec_ytbaoo$(ea().WIDTH),this.HEIGHT=tt().createSpec_ytbaoo$(ea().HEIGHT),this.VIEW_BOX=tt().createSpec_ytbaoo$("viewBox")}Al.prototype.classAttribute=function(){return this.getAttribute_mumjwj$(Rl().CLASS)},Al.prototype.addClass_61zpoe$=function(t){this.validateClassName_rb6n0l$_0(t);var e=this.classAttribute();return null==e.get()?(e.set_11rb$(t),!0):!U(l(e.get()),[" "]).contains_11rb$(t)&&(e.set_11rb$(e.get()+" "+t),!0)},Al.prototype.removeClass_61zpoe$=function(t){this.validateClassName_rb6n0l$_0(t);var e=this.classAttribute();if(null==e.get())return!1;var n=M(U(l(e.get()),[" "])),i=n.remove_11rb$(t);return i&&e.set_11rb$(this.buildClassString_fbk06u$_0(n)),i},Al.prototype.replaceClass_puj7f4$=function(t,e){this.validateClassName_rb6n0l$_0(t),this.validateClassName_rb6n0l$_0(e);var n=this.classAttribute();if(null==n.get())throw k("Trying to replace class when class is empty");var i=U(l(n.get()),[" "]);if(!i.contains_11rb$(t))throw k("Class attribute does not contain specified oldClass");for(var r=i.size,o=I(r),a=0;a0&&n.append_s8itvh$(32),n.append_pdl1vj$(i)}return n.toString()},Al.prototype.validateClassName_rb6n0l$_0=function(t){if(F(t," "))throw L("Class name cannot contain spaces")},Al.$metadata$={kind:s,simpleName:"SvgStylableElement",interfaces:[la]},Object.defineProperty(Il.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_1a5z8g$_0}}),Il.prototype.setContent_61zpoe$=function(t){for(var e=this.children();!e.isEmpty();)e.removeAt_za3lpa$(0);var n=new iu(t);e.add_11rb$(n),this.setAttribute_jyasbz$("type","text/css")},Il.$metadata$={kind:s,simpleName:"SvgStyleElement",interfaces:[la]},Dl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Ml=null;function Bl(){return null===Ml&&new Dl,Ml}function Ul(t){this.this$SvgSvgElement=t}function Fl(){this.myX_0=0,this.myY_0=0,this.myWidth_0=0,this.myHeight_0=0}function ql(t,e){return e=e||Object.create(Fl.prototype),Fl.call(e),e.myX_0=t.origin.x,e.myY_0=t.origin.y,e.myWidth_0=t.dimension.x,e.myHeight_0=t.dimension.y,e}function Gl(){Vl(),la.call(this),this.elementName_7co8y5$_0="tspan"}function Hl(){Yl=this,this.X_0=tt().createSpec_ytbaoo$("x"),this.Y_0=tt().createSpec_ytbaoo$("y")}Object.defineProperty(zl.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_9c3al$_0}}),Object.defineProperty(zl.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),zl.prototype.setStyle_i8z0m3$=function(t){this.children().add_11rb$(new Il(t))},zl.prototype.x=function(){return this.getAttribute_mumjwj$(Bl().X)},zl.prototype.y=function(){return this.getAttribute_mumjwj$(Bl().Y)},zl.prototype.width=function(){return this.getAttribute_mumjwj$(Bl().WIDTH)},zl.prototype.height=function(){return this.getAttribute_mumjwj$(Bl().HEIGHT)},zl.prototype.viewBox=function(){return this.getAttribute_mumjwj$(Bl().VIEW_BOX)},Ul.prototype.set_11rb$=function(t){this.this$SvgSvgElement.viewBox().set_11rb$(ql(t))},Ul.$metadata$={kind:s,interfaces:[q]},zl.prototype.viewBoxRect=function(){return new Ul(this)},zl.prototype.opacity=function(){return this.getAttribute_mumjwj$(oa().OPACITY)},zl.prototype.clipPath=function(){return this.getAttribute_mumjwj$(oa().CLIP_PATH)},zl.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},zl.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},Fl.prototype.toString=function(){return this.myX_0.toString()+" "+this.myY_0+" "+this.myWidth_0+" "+this.myHeight_0},Fl.$metadata$={kind:s,simpleName:"ViewBoxRectangle",interfaces:[]},zl.$metadata$={kind:s,simpleName:"SvgSvgElement",interfaces:[Rs,na,Al]},Hl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Yl=null;function Vl(){return null===Yl&&new Hl,Yl}function Kl(t,e){return e=e||Object.create(Gl.prototype),Gl.call(e),e.setText_61zpoe$(t),e}function Wl(){Jl()}function Xl(){Zl=this,this.FILL=tt().createSpec_ytbaoo$("fill"),this.FILL_OPACITY=tt().createSpec_ytbaoo$("fill-opacity"),this.STROKE=tt().createSpec_ytbaoo$("stroke"),this.STROKE_OPACITY=tt().createSpec_ytbaoo$("stroke-opacity"),this.STROKE_WIDTH=tt().createSpec_ytbaoo$("stroke-width"),this.TEXT_ANCHOR=tt().createSpec_ytbaoo$(ea().SVG_TEXT_ANCHOR_ATTRIBUTE),this.TEXT_DY=tt().createSpec_ytbaoo$(ea().SVG_TEXT_DY_ATTRIBUTE)}Object.defineProperty(Gl.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_7co8y5$_0}}),Object.defineProperty(Gl.prototype,"computedTextLength",{configurable:!0,get:function(){return l(this.container().getPeer()).getComputedTextLength_u60gfq$(this)}}),Gl.prototype.x=function(){return this.getAttribute_mumjwj$(Vl().X_0)},Gl.prototype.y=function(){return this.getAttribute_mumjwj$(Vl().Y_0)},Gl.prototype.setText_61zpoe$=function(t){this.children().clear(),this.addText_61zpoe$(t)},Gl.prototype.addText_61zpoe$=function(t){var e=new iu(t);this.children().add_11rb$(e)},Gl.prototype.fill=function(){return this.getAttribute_mumjwj$(Jl().FILL)},Gl.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},Gl.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Jl().FILL_OPACITY)},Gl.prototype.stroke=function(){return this.getAttribute_mumjwj$(Jl().STROKE)},Gl.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},Gl.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Jl().STROKE_OPACITY)},Gl.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Jl().STROKE_WIDTH)},Gl.prototype.textAnchor=function(){return this.getAttribute_mumjwj$(Jl().TEXT_ANCHOR)},Gl.prototype.textDy=function(){return this.getAttribute_mumjwj$(Jl().TEXT_DY)},Gl.$metadata$={kind:s,simpleName:"SvgTSpanElement",interfaces:[Wl,la]},Xl.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Zl=null;function Jl(){return null===Zl&&new Xl,Zl}function Ql(){nu(),Oa.call(this),this.elementName_s70iuw$_0="text"}function tu(){eu=this,this.X=tt().createSpec_ytbaoo$("x"),this.Y=tt().createSpec_ytbaoo$("y")}Wl.$metadata$={kind:p,simpleName:"SvgTextContent",interfaces:[]},tu.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var eu=null;function nu(){return null===eu&&new tu,eu}function iu(t){su(),Is.call(this),this.myContent_0=null,this.myContent_0=new O(t)}function ru(){au=this,this.NO_CHILDREN_LIST_0=new ou}function ou(){H.call(this)}Object.defineProperty(Ql.prototype,"elementName",{configurable:!0,get:function(){return this.elementName_s70iuw$_0}}),Object.defineProperty(Ql.prototype,"computedTextLength",{configurable:!0,get:function(){return l(this.container().getPeer()).getComputedTextLength_u60gfq$(this)}}),Object.defineProperty(Ql.prototype,"bBox",{configurable:!0,get:function(){return l(this.container().getPeer()).getBBox_7snaev$(this)}}),Ql.prototype.x=function(){return this.getAttribute_mumjwj$(nu().X)},Ql.prototype.y=function(){return this.getAttribute_mumjwj$(nu().Y)},Ql.prototype.transform=function(){return this.getAttribute_mumjwj$(mu().TRANSFORM)},Ql.prototype.setTextNode_61zpoe$=function(t){this.children().clear(),this.addTextNode_61zpoe$(t)},Ql.prototype.addTextNode_61zpoe$=function(t){var e=new iu(t);this.children().add_11rb$(e)},Ql.prototype.setTSpan_ddcap8$=function(t){this.children().clear(),this.addTSpan_ddcap8$(t)},Ql.prototype.setTSpan_61zpoe$=function(t){this.children().clear(),this.addTSpan_61zpoe$(t)},Ql.prototype.addTSpan_ddcap8$=function(t){this.children().add_11rb$(t)},Ql.prototype.addTSpan_61zpoe$=function(t){this.children().add_11rb$(Kl(t))},Ql.prototype.fill=function(){return this.getAttribute_mumjwj$(Jl().FILL)},Ql.prototype.fillColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.fill(),this.fillOpacity())},Ql.prototype.fillOpacity=function(){return this.getAttribute_mumjwj$(Jl().FILL_OPACITY)},Ql.prototype.stroke=function(){return this.getAttribute_mumjwj$(Jl().STROKE)},Ql.prototype.strokeColor=function(){return gu().colorAttributeTransform_dc5zq8$(this.stroke(),this.strokeOpacity())},Ql.prototype.strokeOpacity=function(){return this.getAttribute_mumjwj$(Jl().STROKE_OPACITY)},Ql.prototype.strokeWidth=function(){return this.getAttribute_mumjwj$(Jl().STROKE_WIDTH)},Ql.prototype.textAnchor=function(){return this.getAttribute_mumjwj$(Jl().TEXT_ANCHOR)},Ql.prototype.textDy=function(){return this.getAttribute_mumjwj$(Jl().TEXT_DY)},Ql.prototype.pointToTransformedCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).invertTransform_12yub8$(this,t)},Ql.prototype.pointToAbsoluteCoordinates_gpjtzr$=function(t){return l(this.container().getPeer()).applyTransform_12yub8$(this,t)},Ql.$metadata$={kind:s,simpleName:"SvgTextElement",interfaces:[Wl,_u,Oa]},iu.prototype.textContent=function(){return this.myContent_0},iu.prototype.children=function(){return su().NO_CHILDREN_LIST_0},iu.prototype.toString=function(){return this.textContent().get()},ou.prototype.checkAdd_wxm5ur$=function(t,e){throw G("Cannot add children to SvgTextNode")},ou.prototype.checkRemove_wxm5ur$=function(t,e){throw G("Cannot remove children from SvgTextNode")},ou.$metadata$={kind:s,interfaces:[H]},ru.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var au=null;function su(){return null===au&&new ru,au}function lu(t){pu(),this.myTransform_0=t}function uu(){cu=this,this.EMPTY=new lu(""),this.MATRIX="matrix",this.ROTATE="rotate",this.SCALE="scale",this.SKEW_X="skewX",this.SKEW_Y="skewY",this.TRANSLATE="translate"}iu.$metadata$={kind:s,simpleName:"SvgTextNode",interfaces:[Is]},lu.prototype.toString=function(){return this.myTransform_0},uu.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var cu=null;function pu(){return null===cu&&new uu,cu}function hu(){this.myStringBuilder_0=w()}function _u(){mu()}function fu(){du=this,this.TRANSFORM=tt().createSpec_ytbaoo$("transform")}lu.$metadata$={kind:s,simpleName:"SvgTransform",interfaces:[]},hu.prototype.build=function(){return new lu(this.myStringBuilder_0.toString())},hu.prototype.addTransformation_0=function(t,e){var n;for(this.myStringBuilder_0.append_pdl1vj$(t).append_s8itvh$(40),n=0;n!==e.length;++n){var i=e[n];this.myStringBuilder_0.append_s8jyv4$(i).append_s8itvh$(32)}return this.myStringBuilder_0.append_pdl1vj$(") "),this},hu.prototype.matrix_15yvbs$=function(t,e,n,i,r,o){return this.addTransformation_0(pu().MATRIX,new Float64Array([t,e,n,i,r,o]))},hu.prototype.translate_lu1900$=function(t,e){return this.addTransformation_0(pu().TRANSLATE,new Float64Array([t,e]))},hu.prototype.translate_gpjtzr$=function(t){return this.translate_lu1900$(t.x,t.y)},hu.prototype.translate_14dthe$=function(t){return this.addTransformation_0(pu().TRANSLATE,new Float64Array([t]))},hu.prototype.scale_lu1900$=function(t,e){return this.addTransformation_0(pu().SCALE,new Float64Array([t,e]))},hu.prototype.scale_14dthe$=function(t){return this.addTransformation_0(pu().SCALE,new Float64Array([t]))},hu.prototype.rotate_yvo9jy$=function(t,e,n){return this.addTransformation_0(pu().ROTATE,new Float64Array([t,e,n]))},hu.prototype.rotate_jx7lbv$=function(t,e){return this.rotate_yvo9jy$(t,e.x,e.y)},hu.prototype.rotate_14dthe$=function(t){return this.addTransformation_0(pu().ROTATE,new Float64Array([t]))},hu.prototype.skewX_14dthe$=function(t){return this.addTransformation_0(pu().SKEW_X,new Float64Array([t]))},hu.prototype.skewY_14dthe$=function(t){return this.addTransformation_0(pu().SKEW_Y,new Float64Array([t]))},hu.$metadata$={kind:s,simpleName:"SvgTransformBuilder",interfaces:[]},fu.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var du=null;function mu(){return null===du&&new fu,du}function yu(){vu=this,this.OPACITY_TABLE_0=new Float64Array(256);for(var t=0;t<=255;t++)this.OPACITY_TABLE_0[t]=t/255}function $u(t,e){this.closure$color=t,this.closure$opacity=e}_u.$metadata$={kind:p,simpleName:"SvgTransformable",interfaces:[Rs]},yu.prototype.opacity_98b62m$=function(t){return this.OPACITY_TABLE_0[t.alpha]},yu.prototype.alpha2opacity_za3lpa$=function(t){return this.OPACITY_TABLE_0[t]},yu.prototype.toARGB_98b62m$=function(t){return this.toARGB_tjonv8$(t.red,t.green,t.blue,t.alpha)},yu.prototype.toARGB_o14uds$=function(t,e){var n=t.red,i=t.green,r=t.blue,o=255*e,a=B.min(255,o);return this.toARGB_tjonv8$(n,i,r,Y(B.max(0,a)))},yu.prototype.toARGB_tjonv8$=function(t,e,n,i){return(i<<24)+((t<<16)+(e<<8)+n|0)|0},$u.prototype.set_11rb$=function(t){this.closure$color.set_11rb$(Zo().create_2160e9$(t)),null!=t?this.closure$opacity.set_11rb$(gu().opacity_98b62m$(t)):this.closure$opacity.set_11rb$(1)},$u.$metadata$={kind:s,interfaces:[q]},yu.prototype.colorAttributeTransform_dc5zq8$=function(t,e){return new $u(t,e)},yu.prototype.transformMatrix_98ex5o$=function(t,e,n,i,r,o,a){t.transform().set_11rb$((new hu).matrix_15yvbs$(e,n,i,r,o,a).build())},yu.prototype.transformTranslate_pw34rw$=function(t,e,n){t.transform().set_11rb$((new hu).translate_lu1900$(e,n).build())},yu.prototype.transformTranslate_cbcjvx$=function(t,e){this.transformTranslate_pw34rw$(t,e.x,e.y)},yu.prototype.transformTranslate_wl99a6$=function(t,e){t.transform().set_11rb$((new hu).translate_14dthe$(e).build())},yu.prototype.transformScale_pw34rw$=function(t,e,n){t.transform().set_11rb$((new hu).scale_lu1900$(e,n).build())},yu.prototype.transformScale_wl99a6$=function(t,e){t.transform().set_11rb$((new hu).scale_14dthe$(e).build())},yu.prototype.transformRotate_tk1esa$=function(t,e,n,i){t.transform().set_11rb$((new hu).rotate_yvo9jy$(e,n,i).build())},yu.prototype.transformRotate_wl99a6$=function(t,e){t.transform().set_11rb$((new hu).rotate_14dthe$(e).build())},yu.prototype.transformSkewX_wl99a6$=function(t,e){t.transform().set_11rb$((new hu).skewX_14dthe$(e).build())},yu.prototype.transformSkewY_wl99a6$=function(t,e){t.transform().set_11rb$((new hu).skewY_14dthe$(e).build())},yu.prototype.copyAttributes_azdp7k$=function(t,n){var i,r;for(i=t.attributeKeys.iterator();i.hasNext();){var a=i.next(),s=e.isType(r=a,Z)?r:o();n.setAttribute_qdh7ux$(s,t.getAttribute_mumjwj$(a).get())}},yu.prototype.pngDataURI_61zpoe$=function(t){return new T("data:image/png;base64,").append_pdl1vj$(t).toString()},yu.$metadata$={kind:i,simpleName:"SvgUtils",interfaces:[]};var vu=null;function gu(){return null===vu&&new yu,vu}function bu(){Tu=this,this.SVG_NAMESPACE_URI="http://www.w3.org/2000/svg",this.XLINK_NAMESPACE_URI="http://www.w3.org/1999/xlink",this.XLINK_PREFIX="xlink"}bu.$metadata$={kind:i,simpleName:"XmlNamespace",interfaces:[]};var wu,xu,ku,Eu,Cu,Su,Tu=null;function Ou(){return null===Tu&&new bu,Tu}function Nu(t,e,n){V.call(this),this.attrSpec=t,this.oldValue=e,this.newValue=n}function Pu(){}function Au(t,e){u.call(this),this.name$=t,this.ordinal$=e}function ju(){ju=function(){},wu=new Au("MOUSE_CLICKED",0),xu=new Au("MOUSE_PRESSED",1),ku=new Au("MOUSE_RELEASED",2),Eu=new Au("MOUSE_OVER",3),Cu=new Au("MOUSE_MOVE",4),Su=new Au("MOUSE_OUT",5)}function Lu(){return ju(),wu}function Ru(){return ju(),xu}function Iu(){return ju(),ku}function zu(){return ju(),Eu}function Du(){return ju(),Cu}function Mu(){return ju(),Su}function Bu(){Is.call(this),this.isPrebuiltSubtree=!0}function Uu(t){Yu.call(this,t),this.myAttributes_0=e.newArray(Wu().ATTR_COUNT_8be2vx$,null)}function Fu(t,e){this.closure$key=t,this.closure$value=e}function qu(t){Uu.call(this,Ju().GROUP),this.myChildren_0=I(t)}function Gu(t){Bu.call(this),this.myGroup_0=t}function Hu(t,e,n){return n=n||Object.create(qu.prototype),qu.call(n,t),n.setAttribute_vux3hl$(19,e),n}function Yu(t){Wu(),this.elementName=t}function Vu(){Ku=this,this.fill_8be2vx$=0,this.fillOpacity_8be2vx$=1,this.stroke_8be2vx$=2,this.strokeOpacity_8be2vx$=3,this.strokeWidth_8be2vx$=4,this.strokeTransform_8be2vx$=5,this.classes_8be2vx$=6,this.x1_8be2vx$=7,this.y1_8be2vx$=8,this.x2_8be2vx$=9,this.y2_8be2vx$=10,this.cx_8be2vx$=11,this.cy_8be2vx$=12,this.r_8be2vx$=13,this.x_8be2vx$=14,this.y_8be2vx$=15,this.height_8be2vx$=16,this.width_8be2vx$=17,this.pathData_8be2vx$=18,this.transform_8be2vx$=19,this.ATTR_KEYS_8be2vx$=["fill","fill-opacity","stroke","stroke-opacity","stroke-width","transform","classes","x1","y1","x2","y2","cx","cy","r","x","y","height","width","d","transform"],this.ATTR_COUNT_8be2vx$=this.ATTR_KEYS_8be2vx$.length}Nu.$metadata$={kind:s,simpleName:"SvgAttributeEvent",interfaces:[V]},Pu.$metadata$={kind:p,simpleName:"SvgEventHandler",interfaces:[]},Au.$metadata$={kind:s,simpleName:"SvgEventSpec",interfaces:[u]},Au.values=function(){return[Lu(),Ru(),Iu(),zu(),Du(),Mu()]},Au.valueOf_61zpoe$=function(t){switch(t){case"MOUSE_CLICKED":return Lu();case"MOUSE_PRESSED":return Ru();case"MOUSE_RELEASED":return Iu();case"MOUSE_OVER":return zu();case"MOUSE_MOVE":return Du();case"MOUSE_OUT":return Mu();default:c("No enum constant jetbrains.datalore.vis.svg.event.SvgEventSpec."+t)}},Bu.prototype.children=function(){var t=Is.prototype.children.call(this);if(!t.isEmpty())throw k("Can't have children");return t},Bu.$metadata$={kind:s,simpleName:"DummySvgNode",interfaces:[Is]},Object.defineProperty(Fu.prototype,"key",{configurable:!0,get:function(){return this.closure$key}}),Object.defineProperty(Fu.prototype,"value",{configurable:!0,get:function(){return this.closure$value.toString()}}),Fu.$metadata$={kind:s,interfaces:[ec]},Object.defineProperty(Uu.prototype,"attributes",{configurable:!0,get:function(){var t,e,n=this.myAttributes_0,i=I(n.length),r=0;for(t=0;t!==n.length;++t){var o,a=n[t],s=i.add_11rb$,l=(r=(e=r)+1|0,e),u=Wu().ATTR_KEYS_8be2vx$[l];o=null==a?null:new Fu(u,a),s.call(i,o)}return K(i)}}),Object.defineProperty(Uu.prototype,"slimChildren",{configurable:!0,get:function(){return W()}}),Uu.prototype.setAttribute_vux3hl$=function(t,e){this.myAttributes_0[t]=e},Uu.prototype.hasAttribute_za3lpa$=function(t){return null!=this.myAttributes_0[t]},Uu.prototype.getAttribute_za3lpa$=function(t){return this.myAttributes_0[t]},Uu.prototype.appendTo_i2myw1$=function(t){var n;(e.isType(n=t,qu)?n:o()).addChild_3o5936$(this)},Uu.$metadata$={kind:s,simpleName:"ElementJava",interfaces:[tc,Yu]},Object.defineProperty(qu.prototype,"slimChildren",{configurable:!0,get:function(){var t,e=this.myChildren_0,n=I(X(e,10));for(t=e.iterator();t.hasNext();){var i=t.next();n.add_11rb$(i)}return n}}),qu.prototype.addChild_3o5936$=function(t){this.myChildren_0.add_11rb$(t)},qu.prototype.asDummySvgNode=function(){return new Gu(this)},Object.defineProperty(Gu.prototype,"elementName",{configurable:!0,get:function(){return this.myGroup_0.elementName}}),Object.defineProperty(Gu.prototype,"attributes",{configurable:!0,get:function(){return this.myGroup_0.attributes}}),Object.defineProperty(Gu.prototype,"slimChildren",{configurable:!0,get:function(){return this.myGroup_0.slimChildren}}),Gu.$metadata$={kind:s,simpleName:"MyDummySvgNode",interfaces:[tc,Bu]},qu.$metadata$={kind:s,simpleName:"GroupJava",interfaces:[Qu,Uu]},Vu.$metadata$={kind:i,simpleName:"Companion",interfaces:[]};var Ku=null;function Wu(){return null===Ku&&new Vu,Ku}function Xu(){Zu=this,this.GROUP="g",this.LINE="line",this.CIRCLE="circle",this.RECT="rect",this.PATH="path"}Yu.prototype.setFill_o14uds$=function(t,e){this.setAttribute_vux3hl$(0,t.toHexColor()),e<1&&this.setAttribute_vux3hl$(1,e.toString())},Yu.prototype.setStroke_o14uds$=function(t,e){this.setAttribute_vux3hl$(2,t.toHexColor()),e<1&&this.setAttribute_vux3hl$(3,e.toString())},Yu.prototype.setStrokeWidth_14dthe$=function(t){this.setAttribute_vux3hl$(4,t.toString())},Yu.prototype.setAttribute_7u9h3l$=function(t,e){this.setAttribute_vux3hl$(t,e.toString())},Yu.$metadata$={kind:s,simpleName:"SlimBase",interfaces:[ic]},Xu.prototype.createElement_0=function(t){return new Uu(t)},Xu.prototype.g_za3lpa$=function(t){return new qu(t)},Xu.prototype.g_vux3hl$=function(t,e){return Hu(t,e)},Xu.prototype.line_6y0v78$=function(t,e,n,i){var r=this.createElement_0(this.LINE);return r.setAttribute_7u9h3l$(7,t),r.setAttribute_7u9h3l$(8,e),r.setAttribute_7u9h3l$(9,n),r.setAttribute_7u9h3l$(10,i),r},Xu.prototype.circle_yvo9jy$=function(t,e,n){var i=this.createElement_0(this.CIRCLE);return i.setAttribute_7u9h3l$(11,t),i.setAttribute_7u9h3l$(12,e),i.setAttribute_7u9h3l$(13,n),i},Xu.prototype.rect_6y0v78$=function(t,e,n,i){var r=this.createElement_0(this.RECT);return r.setAttribute_7u9h3l$(14,t),r.setAttribute_7u9h3l$(15,e),r.setAttribute_7u9h3l$(17,n),r.setAttribute_7u9h3l$(16,i),r},Xu.prototype.path_za3rmp$=function(t){var e=this.createElement_0(this.PATH);return e.setAttribute_vux3hl$(18,t.toString()),e},Xu.$metadata$={kind:i,simpleName:"SvgSlimElements",interfaces:[]};var Zu=null;function Ju(){return null===Zu&&new Xu,Zu}function Qu(){}function tc(){}function ec(){}function nc(){}function ic(){}Qu.$metadata$={kind:p,simpleName:"SvgSlimGroup",interfaces:[nc]},ec.$metadata$={kind:p,simpleName:"Attr",interfaces:[]},tc.$metadata$={kind:p,simpleName:"SvgSlimNode",interfaces:[]},nc.$metadata$={kind:p,simpleName:"SvgSlimObject",interfaces:[]},ic.$metadata$={kind:p,simpleName:"SvgSlimShape",interfaces:[nc]},Object.defineProperty(Z,"Companion",{get:tt});var rc=t.jetbrains||(t.jetbrains={}),oc=rc.datalore||(rc.datalore={}),ac=oc.vis||(oc.vis={}),sc=ac.svg||(ac.svg={});sc.SvgAttributeSpec=Z,Object.defineProperty(et,"Companion",{get:rt}),sc.SvgCircleElement=et,Object.defineProperty(ot,"Companion",{get:Jn}),Object.defineProperty(Qn,"USER_SPACE_ON_USE",{get:ei}),Object.defineProperty(Qn,"OBJECT_BOUNDING_BOX",{get:ni}),ot.ClipPathUnits=Qn,sc.SvgClipPathElement=ot,sc.SvgColor=ii,Object.defineProperty(ri,"ALICE_BLUE",{get:ai}),Object.defineProperty(ri,"ANTIQUE_WHITE",{get:si}),Object.defineProperty(ri,"AQUA",{get:li}),Object.defineProperty(ri,"AQUAMARINE",{get:ui}),Object.defineProperty(ri,"AZURE",{get:ci}),Object.defineProperty(ri,"BEIGE",{get:pi}),Object.defineProperty(ri,"BISQUE",{get:hi}),Object.defineProperty(ri,"BLACK",{get:_i}),Object.defineProperty(ri,"BLANCHED_ALMOND",{get:fi}),Object.defineProperty(ri,"BLUE",{get:di}),Object.defineProperty(ri,"BLUE_VIOLET",{get:mi}),Object.defineProperty(ri,"BROWN",{get:yi}),Object.defineProperty(ri,"BURLY_WOOD",{get:$i}),Object.defineProperty(ri,"CADET_BLUE",{get:vi}),Object.defineProperty(ri,"CHARTREUSE",{get:gi}),Object.defineProperty(ri,"CHOCOLATE",{get:bi}),Object.defineProperty(ri,"CORAL",{get:wi}),Object.defineProperty(ri,"CORNFLOWER_BLUE",{get:xi}),Object.defineProperty(ri,"CORNSILK",{get:ki}),Object.defineProperty(ri,"CRIMSON",{get:Ei}),Object.defineProperty(ri,"CYAN",{get:Ci}),Object.defineProperty(ri,"DARK_BLUE",{get:Si}),Object.defineProperty(ri,"DARK_CYAN",{get:Ti}),Object.defineProperty(ri,"DARK_GOLDEN_ROD",{get:Oi}),Object.defineProperty(ri,"DARK_GRAY",{get:Ni}),Object.defineProperty(ri,"DARK_GREEN",{get:Pi}),Object.defineProperty(ri,"DARK_GREY",{get:Ai}),Object.defineProperty(ri,"DARK_KHAKI",{get:ji}),Object.defineProperty(ri,"DARK_MAGENTA",{get:Li}),Object.defineProperty(ri,"DARK_OLIVE_GREEN",{get:Ri}),Object.defineProperty(ri,"DARK_ORANGE",{get:Ii}),Object.defineProperty(ri,"DARK_ORCHID",{get:zi}),Object.defineProperty(ri,"DARK_RED",{get:Di}),Object.defineProperty(ri,"DARK_SALMON",{get:Mi}),Object.defineProperty(ri,"DARK_SEA_GREEN",{get:Bi}),Object.defineProperty(ri,"DARK_SLATE_BLUE",{get:Ui}),Object.defineProperty(ri,"DARK_SLATE_GRAY",{get:Fi}),Object.defineProperty(ri,"DARK_SLATE_GREY",{get:qi}),Object.defineProperty(ri,"DARK_TURQUOISE",{get:Gi}),Object.defineProperty(ri,"DARK_VIOLET",{get:Hi}),Object.defineProperty(ri,"DEEP_PINK",{get:Yi}),Object.defineProperty(ri,"DEEP_SKY_BLUE",{get:Vi}),Object.defineProperty(ri,"DIM_GRAY",{get:Ki}),Object.defineProperty(ri,"DIM_GREY",{get:Wi}),Object.defineProperty(ri,"DODGER_BLUE",{get:Xi}),Object.defineProperty(ri,"FIRE_BRICK",{get:Zi}),Object.defineProperty(ri,"FLORAL_WHITE",{get:Ji}),Object.defineProperty(ri,"FOREST_GREEN",{get:Qi}),Object.defineProperty(ri,"FUCHSIA",{get:tr}),Object.defineProperty(ri,"GAINSBORO",{get:er}),Object.defineProperty(ri,"GHOST_WHITE",{get:nr}),Object.defineProperty(ri,"GOLD",{get:ir}),Object.defineProperty(ri,"GOLDEN_ROD",{get:rr}),Object.defineProperty(ri,"GRAY",{get:or}),Object.defineProperty(ri,"GREY",{get:ar}),Object.defineProperty(ri,"GREEN",{get:sr}),Object.defineProperty(ri,"GREEN_YELLOW",{get:lr}),Object.defineProperty(ri,"HONEY_DEW",{get:ur}),Object.defineProperty(ri,"HOT_PINK",{get:cr}),Object.defineProperty(ri,"INDIAN_RED",{get:pr}),Object.defineProperty(ri,"INDIGO",{get:hr}),Object.defineProperty(ri,"IVORY",{get:_r}),Object.defineProperty(ri,"KHAKI",{get:fr}),Object.defineProperty(ri,"LAVENDER",{get:dr}),Object.defineProperty(ri,"LAVENDER_BLUSH",{get:mr}),Object.defineProperty(ri,"LAWN_GREEN",{get:yr}),Object.defineProperty(ri,"LEMON_CHIFFON",{get:$r}),Object.defineProperty(ri,"LIGHT_BLUE",{get:vr}),Object.defineProperty(ri,"LIGHT_CORAL",{get:gr}),Object.defineProperty(ri,"LIGHT_CYAN",{get:br}),Object.defineProperty(ri,"LIGHT_GOLDEN_ROD_YELLOW",{get:wr}),Object.defineProperty(ri,"LIGHT_GRAY",{get:xr}),Object.defineProperty(ri,"LIGHT_GREEN",{get:kr}),Object.defineProperty(ri,"LIGHT_GREY",{get:Er}),Object.defineProperty(ri,"LIGHT_PINK",{get:Cr}),Object.defineProperty(ri,"LIGHT_SALMON",{get:Sr}),Object.defineProperty(ri,"LIGHT_SEA_GREEN",{get:Tr}),Object.defineProperty(ri,"LIGHT_SKY_BLUE",{get:Or}),Object.defineProperty(ri,"LIGHT_SLATE_GRAY",{get:Nr}),Object.defineProperty(ri,"LIGHT_SLATE_GREY",{get:Pr}),Object.defineProperty(ri,"LIGHT_STEEL_BLUE",{get:Ar}),Object.defineProperty(ri,"LIGHT_YELLOW",{get:jr}),Object.defineProperty(ri,"LIME",{get:Lr}),Object.defineProperty(ri,"LIME_GREEN",{get:Rr}),Object.defineProperty(ri,"LINEN",{get:Ir}),Object.defineProperty(ri,"MAGENTA",{get:zr}),Object.defineProperty(ri,"MAROON",{get:Dr}),Object.defineProperty(ri,"MEDIUM_AQUA_MARINE",{get:Mr}),Object.defineProperty(ri,"MEDIUM_BLUE",{get:Br}),Object.defineProperty(ri,"MEDIUM_ORCHID",{get:Ur}),Object.defineProperty(ri,"MEDIUM_PURPLE",{get:Fr}),Object.defineProperty(ri,"MEDIUM_SEAGREEN",{get:qr}),Object.defineProperty(ri,"MEDIUM_SLATE_BLUE",{get:Gr}),Object.defineProperty(ri,"MEDIUM_SPRING_GREEN",{get:Hr}),Object.defineProperty(ri,"MEDIUM_TURQUOISE",{get:Yr}),Object.defineProperty(ri,"MEDIUM_VIOLET_RED",{get:Vr}),Object.defineProperty(ri,"MIDNIGHT_BLUE",{get:Kr}),Object.defineProperty(ri,"MINT_CREAM",{get:Wr}),Object.defineProperty(ri,"MISTY_ROSE",{get:Xr}),Object.defineProperty(ri,"MOCCASIN",{get:Zr}),Object.defineProperty(ri,"NAVAJO_WHITE",{get:Jr}),Object.defineProperty(ri,"NAVY",{get:Qr}),Object.defineProperty(ri,"OLD_LACE",{get:to}),Object.defineProperty(ri,"OLIVE",{get:eo}),Object.defineProperty(ri,"OLIVE_DRAB",{get:no}),Object.defineProperty(ri,"ORANGE",{get:io}),Object.defineProperty(ri,"ORANGE_RED",{get:ro}),Object.defineProperty(ri,"ORCHID",{get:oo}),Object.defineProperty(ri,"PALE_GOLDEN_ROD",{get:ao}),Object.defineProperty(ri,"PALE_GREEN",{get:so}),Object.defineProperty(ri,"PALE_TURQUOISE",{get:lo}),Object.defineProperty(ri,"PALE_VIOLET_RED",{get:uo}),Object.defineProperty(ri,"PAPAYA_WHIP",{get:co}),Object.defineProperty(ri,"PEACH_PUFF",{get:po}),Object.defineProperty(ri,"PERU",{get:ho}),Object.defineProperty(ri,"PINK",{get:_o}),Object.defineProperty(ri,"PLUM",{get:fo}),Object.defineProperty(ri,"POWDER_BLUE",{get:mo}),Object.defineProperty(ri,"PURPLE",{get:yo}),Object.defineProperty(ri,"RED",{get:$o}),Object.defineProperty(ri,"ROSY_BROWN",{get:vo}),Object.defineProperty(ri,"ROYAL_BLUE",{get:go}),Object.defineProperty(ri,"SADDLE_BROWN",{get:bo}),Object.defineProperty(ri,"SALMON",{get:wo}),Object.defineProperty(ri,"SANDY_BROWN",{get:xo}),Object.defineProperty(ri,"SEA_GREEN",{get:ko}),Object.defineProperty(ri,"SEASHELL",{get:Eo}),Object.defineProperty(ri,"SIENNA",{get:Co}),Object.defineProperty(ri,"SILVER",{get:So}),Object.defineProperty(ri,"SKY_BLUE",{get:To}),Object.defineProperty(ri,"SLATE_BLUE",{get:Oo}),Object.defineProperty(ri,"SLATE_GRAY",{get:No}),Object.defineProperty(ri,"SLATE_GREY",{get:Po}),Object.defineProperty(ri,"SNOW",{get:Ao}),Object.defineProperty(ri,"SPRING_GREEN",{get:jo}),Object.defineProperty(ri,"STEEL_BLUE",{get:Lo}),Object.defineProperty(ri,"TAN",{get:Ro}),Object.defineProperty(ri,"TEAL",{get:Io}),Object.defineProperty(ri,"THISTLE",{get:zo}),Object.defineProperty(ri,"TOMATO",{get:Do}),Object.defineProperty(ri,"TURQUOISE",{get:Mo}),Object.defineProperty(ri,"VIOLET",{get:Bo}),Object.defineProperty(ri,"WHEAT",{get:Uo}),Object.defineProperty(ri,"WHITE",{get:Fo}),Object.defineProperty(ri,"WHITE_SMOKE",{get:qo}),Object.defineProperty(ri,"YELLOW",{get:Go}),Object.defineProperty(ri,"YELLOW_GREEN",{get:Ho}),Object.defineProperty(ri,"NONE",{get:Yo}),Object.defineProperty(ri,"CURRENT_COLOR",{get:Vo}),Object.defineProperty(ri,"Companion",{get:Zo}),sc.SvgColors=ri,Object.defineProperty(sc,"SvgConstants",{get:ea}),Object.defineProperty(na,"Companion",{get:oa}),sc.SvgContainer=na,sc.SvgCssResource=aa,sc.SvgDefsElement=sa,Object.defineProperty(la,"Companion",{get:pa}),sc.SvgElement=la,sc.SvgElementListener=ya,Object.defineProperty($a,"Companion",{get:ba}),sc.SvgEllipseElement=$a,sc.SvgEventPeer=wa,sc.SvgGElement=Ta,Object.defineProperty(Oa,"Companion",{get:Ya}),Object.defineProperty(Va,"VISIBLE_PAINTED",{get:Wa}),Object.defineProperty(Va,"VISIBLE_FILL",{get:Xa}),Object.defineProperty(Va,"VISIBLE_STROKE",{get:Za}),Object.defineProperty(Va,"VISIBLE",{get:Ja}),Object.defineProperty(Va,"PAINTED",{get:Qa}),Object.defineProperty(Va,"FILL",{get:ts}),Object.defineProperty(Va,"STROKE",{get:es}),Object.defineProperty(Va,"ALL",{get:ns}),Object.defineProperty(Va,"NONE",{get:is}),Object.defineProperty(Va,"INHERIT",{get:rs}),Oa.PointerEvents=Va,Object.defineProperty(os,"VISIBLE",{get:ss}),Object.defineProperty(os,"HIDDEN",{get:ls}),Object.defineProperty(os,"COLLAPSE",{get:us}),Object.defineProperty(os,"INHERIT",{get:cs}),Oa.Visibility=os,sc.SvgGraphicsElement=Oa,sc.SvgIRI=ps,Object.defineProperty(hs,"Companion",{get:ds}),sc.SvgImageElement_init_6y0v78$=ms,sc.SvgImageElement=hs,ys.RGBEncoder=vs,ys.Bitmap=gs,sc.SvgImageElementEx=ys,Object.defineProperty(bs,"Companion",{get:Ls}),sc.SvgLineElement_init_6y0v78$=function(t,e,n,i,r){return r=r||Object.create(bs.prototype),bs.call(r),r.setAttribute_qdh7ux$(Ls().X1,t),r.setAttribute_qdh7ux$(Ls().Y1,e),r.setAttribute_qdh7ux$(Ls().X2,n),r.setAttribute_qdh7ux$(Ls().Y2,i),r},sc.SvgLineElement=bs,sc.SvgLocatable=Rs,sc.SvgNode=Is,sc.SvgNodeContainer=Ds,Object.defineProperty(Gs,"MOVE_TO",{get:Ys}),Object.defineProperty(Gs,"LINE_TO",{get:Vs}),Object.defineProperty(Gs,"HORIZONTAL_LINE_TO",{get:Ks}),Object.defineProperty(Gs,"VERTICAL_LINE_TO",{get:Ws}),Object.defineProperty(Gs,"CURVE_TO",{get:Xs}),Object.defineProperty(Gs,"SMOOTH_CURVE_TO",{get:Zs}),Object.defineProperty(Gs,"QUADRATIC_BEZIER_CURVE_TO",{get:Js}),Object.defineProperty(Gs,"SMOOTH_QUADRATIC_BEZIER_CURVE_TO",{get:Qs}),Object.defineProperty(Gs,"ELLIPTICAL_ARC",{get:tl}),Object.defineProperty(Gs,"CLOSE_PATH",{get:el}),Object.defineProperty(Gs,"Companion",{get:rl}),qs.Action=Gs,Object.defineProperty(qs,"Companion",{get:pl}),sc.SvgPathData=qs,Object.defineProperty(_l,"LINEAR",{get:dl}),Object.defineProperty(_l,"CARDINAL",{get:ml}),Object.defineProperty(_l,"MONOTONE",{get:yl}),hl.Interpolation=_l,sc.SvgPathDataBuilder=hl,Object.defineProperty($l,"Companion",{get:bl}),sc.SvgPathElement_init_7jrsat$=function(t,e){return e=e||Object.create($l.prototype),$l.call(e),e.setAttribute_qdh7ux$(bl().D,t),e},sc.SvgPathElement=$l,sc.SvgPlatformPeer=wl,Object.defineProperty(xl,"Companion",{get:Cl}),sc.SvgRectElement_init_6y0v78$=Sl,sc.SvgRectElement_init_wthzt5$=function(t,e){return e=e||Object.create(xl.prototype),Sl(t.origin.x,t.origin.y,t.dimension.x,t.dimension.y,e),e},sc.SvgRectElement=xl,Object.defineProperty(Tl,"Companion",{get:Pl}),sc.SvgShape=Tl,Object.defineProperty(Al,"Companion",{get:Rl}),sc.SvgStylableElement=Al,sc.SvgStyleElement=Il,Object.defineProperty(zl,"Companion",{get:Bl}),zl.ViewBoxRectangle_init_6y0v78$=function(t,e,n,i,r){return r=r||Object.create(Fl.prototype),Fl.call(r),r.myX_0=t,r.myY_0=e,r.myWidth_0=n,r.myHeight_0=i,r},zl.ViewBoxRectangle_init_wthzt5$=ql,zl.ViewBoxRectangle=Fl,sc.SvgSvgElement=zl,Object.defineProperty(Gl,"Companion",{get:Vl}),sc.SvgTSpanElement_init_61zpoe$=Kl,sc.SvgTSpanElement=Gl,Object.defineProperty(Wl,"Companion",{get:Jl}),sc.SvgTextContent=Wl,Object.defineProperty(Ql,"Companion",{get:nu}),sc.SvgTextElement_init_61zpoe$=function(t,e){return e=e||Object.create(Ql.prototype),Ql.call(e),e.setTextNode_61zpoe$(t),e},sc.SvgTextElement=Ql,Object.defineProperty(iu,"Companion",{get:su}),sc.SvgTextNode=iu,Object.defineProperty(lu,"Companion",{get:pu}),sc.SvgTransform=lu,sc.SvgTransformBuilder=hu,Object.defineProperty(_u,"Companion",{get:mu}),sc.SvgTransformable=_u,Object.defineProperty(sc,"SvgUtils",{get:gu}),Object.defineProperty(sc,"XmlNamespace",{get:Ou});var lc=sc.event||(sc.event={});lc.SvgAttributeEvent=Nu,lc.SvgEventHandler=Pu,Object.defineProperty(Au,"MOUSE_CLICKED",{get:Lu}),Object.defineProperty(Au,"MOUSE_PRESSED",{get:Ru}),Object.defineProperty(Au,"MOUSE_RELEASED",{get:Iu}),Object.defineProperty(Au,"MOUSE_OVER",{get:zu}),Object.defineProperty(Au,"MOUSE_MOVE",{get:Du}),Object.defineProperty(Au,"MOUSE_OUT",{get:Mu}),lc.SvgEventSpec=Au;var uc=sc.slim||(sc.slim={});return uc.DummySvgNode=Bu,uc.ElementJava=Uu,uc.GroupJava_init_vux3hl$=Hu,uc.GroupJava=qu,Object.defineProperty(Yu,"Companion",{get:Wu}),uc.SlimBase=Yu,Object.defineProperty(uc,"SvgSlimElements",{get:Ju}),uc.SvgSlimGroup=Qu,tc.Attr=ec,uc.SvgSlimNode=tc,uc.SvgSlimObject=nc,uc.SvgSlimShape=ic,t})?i.apply(e,r):i)||(t.exports=o)},975:t=>{function e(t){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}e.keys=()=>[],e.resolve=e,e.id=975,t.exports=e}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i=n(837);window.LetsPlot=i})(); //# sourceMappingURL=js-package.js.map \ No newline at end of file diff --git a/python-package/lets_plot/_version.py b/python-package/lets_plot/_version.py index b909d9ba178..5290663443a 100644 --- a/python-package/lets_plot/_version.py +++ b/python-package/lets_plot/_version.py @@ -3,4 +3,4 @@ # Use of this source code is governed by the MIT license that can be found in the LICENSE file. # # see: https://www.python.org/dev/peps/pep-0440/#developmental-releases -__version__ = '2.0.6.dev1' \ No newline at end of file +__version__ = '2.1.0rc1' \ No newline at end of file