git-digger
Version:
 
1,247 lines • 65.2 kB
JavaScript
(function (_, kotlin_kotlin) {
'use strict';
//region block: imports
var imul = Math.imul;
var log2 = Math.log2;
var protoOf = kotlin_kotlin.$_$.f8;
var initMetadataForInterface = kotlin_kotlin.$_$.k7;
var toString = kotlin_kotlin.$_$.i8;
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.a1;
var Unit_instance = kotlin_kotlin.$_$.d3;
var initMetadataForClass = kotlin_kotlin.$_$.h7;
var getStringHashCode = kotlin_kotlin.$_$.f7;
var THROW_CCE = kotlin_kotlin.$_$.jb;
var initMetadataForObject = kotlin_kotlin.$_$.m7;
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.l;
var charSequenceLength = kotlin_kotlin.$_$.y6;
var charSequenceGet = kotlin_kotlin.$_$.x6;
var toString_0 = kotlin_kotlin.$_$.m1;
var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.k1;
var arrayConcat = kotlin_kotlin.$_$.a;
var listOf = kotlin_kotlin.$_$.b5;
var withSign = kotlin_kotlin.$_$.k8;
var trimMargin = kotlin_kotlin.$_$.sa;
var hashCode = kotlin_kotlin.$_$.g7;
var equals = kotlin_kotlin.$_$.b7;
var VOID = kotlin_kotlin.$_$.g;
var initMetadataForCompanion = kotlin_kotlin.$_$.i7;
var coerceAtLeast = kotlin_kotlin.$_$.l8;
var getNumberHashCode = kotlin_kotlin.$_$.d7;
var numberToDouble = kotlin_kotlin.$_$.c8;
var roundToInt = kotlin_kotlin.$_$.j8;
var coerceIn = kotlin_kotlin.$_$.p8;
var charCodeAt = kotlin_kotlin.$_$.w6;
var Char = kotlin_kotlin.$_$.ya;
var toInt = kotlin_kotlin.$_$.qa;
var numberRangeToNumber = kotlin_kotlin.$_$.a8;
var slice = kotlin_kotlin.$_$.ga;
var startsWith = kotlin_kotlin.$_$.ia;
var isInterface = kotlin_kotlin.$_$.v7;
var contentEquals = kotlin_kotlin.$_$.c4;
var coerceAtLeast_0 = kotlin_kotlin.$_$.n8;
var objectCreate = kotlin_kotlin.$_$.e8;
//endregion
//region block: pre-declaration
function toXYZ() {
return this.v1j().w1j();
}
initMetadataForInterface(Color, 'Color');
initMetadataForClass(ColorComponentInfo, 'ColorComponentInfo');
initMetadataForClass(WhitePoint, 'WhitePoint');
initMetadataForObject(Illuminant, 'Illuminant');
initMetadataForClass(Matrix, 'Matrix');
initMetadataForClass(Vector, 'Vector');
initMetadataForCompanion(Companion);
initMetadataForClass(Ansi16, 'Ansi16', VOID, VOID, [Color]);
initMetadataForCompanion(Companion_0);
initMetadataForClass(Ansi256, 'Ansi256', VOID, VOID, [Color]);
initMetadataForCompanion(Companion_1);
initMetadataForClass(HSV, 'HSV', VOID, VOID, [Color]);
initMetadataForClass(ICtCp, 'ICtCp', VOID, VOID, [Color]);
initMetadataForObject(PqNonlinearity, 'PqNonlinearity');
initMetadataForClass(GammaTransferFunctions, 'GammaTransferFunctions');
initMetadataForObject(LinearTransferFunctions, 'LinearTransferFunctions');
function invoke$default(r, g, b, alpha, $super) {
alpha = alpha === VOID ? 1.0 : alpha;
return $super === VOID ? this.h1l(r, g, b, alpha) : $super.h1l.call(this, r, g, b, alpha);
}
function invoke(r, g, b, alpha) {
return this.h1l(numberToDouble(r), numberToDouble(g), numberToDouble(b), numberToDouble(alpha));
}
function invoke$default_0(r, g, b, alpha, $super) {
alpha = alpha === VOID ? 1.0 : alpha;
return $super === VOID ? this.m1m(r, g, b, alpha) : invoke(r, g, b, alpha);
}
function from255(r, g, b, alpha) {
return this.h1l(r / 255.0, g / 255.0, b / 255.0, alpha / 255.0);
}
function from255$default(r, g, b, alpha, $super) {
alpha = alpha === VOID ? 255 : alpha;
return $super === VOID ? this.n1m(r, g, b, alpha) : from255(r, g, b, alpha);
}
function invoke_0(hex) {
var tmp = parseHex(validateHex(hex), 0);
var tmp_0 = parseHex(hex, 1);
var tmp_1 = parseHex(hex, 2);
var tmp_2;
// Inline function 'kotlin.let' call
var it = get_hexLength(hex);
if (it === 4 || it === 8) {
tmp_2 = parseHex(hex, 3);
} else {
tmp_2 = 255;
}
return this.n1m(tmp, tmp_0, tmp_1, tmp_2);
}
initMetadataForInterface(RGBColorSpace, 'RGBColorSpace');
initMetadataForCompanion(Companion_2, VOID, [RGBColorSpace]);
initMetadataForClass(RGB, 'RGB', VOID, VOID, [Color]);
initMetadataForObject(RGBColorSpaces, 'RGBColorSpaces');
initMetadataForObject(SRGB, 'SRGB', VOID, VOID, [RGBColorSpace]);
initMetadataForClass(RGBColorSpaceImpl, 'RGBColorSpaceImpl', VOID, VOID, [RGBColorSpace]);
initMetadataForObject(SRGBTransferFunctions, 'SRGBTransferFunctions');
initMetadataForObject(ACESccTransferFunctions, 'ACESccTransferFunctions');
initMetadataForObject(ACEScctTransferFunctions, 'ACEScctTransferFunctions');
initMetadataForObject(BT2020TransferFunctions, 'BT2020TransferFunctions');
initMetadataForObject(BT709TransferFunctions, 'BT709TransferFunctions');
initMetadataForObject(ROMMTransferFunctions, 'ROMMTransferFunctions');
initMetadataForInterface(XYZColorSpace, 'XYZColorSpace');
initMetadataForCompanion(Companion_3, VOID, [XYZColorSpace]);
initMetadataForClass(XYZ, 'XYZ', VOID, VOID, [Color]);
initMetadataForObject(XYZColorSpaces, 'XYZColorSpaces');
initMetadataForClass(XYZColorSpaceImpl, 'XYZColorSpaceImpl', VOID, VOID, [XYZColorSpace]);
initMetadataForClass(xyY, 'xyY');
//endregion
function Color() {
}
function ColorComponentInfo(name, isPolar, min, max) {
this.c1k_1 = name;
this.d1k_1 = isPolar;
this.e1k_1 = min;
this.f1k_1 = max;
// Inline function 'kotlin.require' call
if (!(this.e1k_1 <= this.f1k_1)) {
var message = 'min must be less than or equal to max';
throw IllegalArgumentException_init_$Create$(toString(message));
}
}
function WhitePoint(name, chromaticity) {
this.g1k_1 = name;
this.h1k_1 = chromaticity;
}
protoOf(WhitePoint).toString = function () {
return this.g1k_1;
};
protoOf(WhitePoint).hashCode = function () {
var result = getStringHashCode(this.g1k_1);
result = imul(result, 31) + this.h1k_1.hashCode() | 0;
return result;
};
protoOf(WhitePoint).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof WhitePoint))
return false;
var tmp0_other_with_cast = other instanceof WhitePoint ? other : THROW_CCE();
if (!(this.g1k_1 === tmp0_other_with_cast.g1k_1))
return false;
if (!this.h1k_1.equals(tmp0_other_with_cast.h1k_1))
return false;
return true;
};
function Illuminant() {
Illuminant_instance = this;
this.i1k_1 = new WhitePoint('A', xyY_init_$Create$(0.44758, 0.40745));
this.j1k_1 = new WhitePoint('B', xyY_init_$Create$(0.34842, 0.35161));
this.k1k_1 = new WhitePoint('C', xyY_init_$Create$(0.31006, 0.31616));
this.l1k_1 = new WhitePoint('D50', xyY_init_$Create$(0.3457, 0.3585));
this.m1k_1 = new WhitePoint('D55', xyY_init_$Create$(0.33243, 0.34744));
this.n1k_1 = new WhitePoint('D65', xyY_init_$Create$(0.3127, 0.329));
this.o1k_1 = new WhitePoint('D75', xyY_init_$Create$(0.29903, 0.31488));
this.p1k_1 = new WhitePoint('E', xyY_init_$Create$(1.0 / 3.0, 1.0 / 3.0));
}
var Illuminant_instance;
function Illuminant_getInstance() {
if (Illuminant_instance == null)
new Illuminant();
return Illuminant_instance;
}
function get_alphaInfo() {
_init_properties_ColorSpaceUtils_kt__cnwylg();
return alphaInfo;
}
var alphaInfo;
function zeroOneComponentInfo(name) {
_init_properties_ColorSpaceUtils_kt__cnwylg();
// Inline function 'kotlin.collections.buildList' call
// Inline function 'kotlin.collections.buildListInternal' call
// Inline function 'kotlin.apply' call
var this_0 = ArrayList_init_$Create$();
// Inline function 'kotlin.text.mapTo' call
var inductionVariable = 0;
while (inductionVariable < charSequenceLength(name)) {
var item = charSequenceGet(name, inductionVariable);
inductionVariable = inductionVariable + 1 | 0;
var tmp$ret$0 = new ColorComponentInfo(toString_0(item), false, 0.0, 1.0);
this_0.e(tmp$ret$0);
}
this_0.e(get_alphaInfo());
return this_0.e5();
}
function polarComponentInfo(name, l, r) {
_init_properties_ColorSpaceUtils_kt__cnwylg();
// Inline function 'kotlin.collections.buildList' call
// Inline function 'kotlin.collections.buildListInternal' call
// Inline function 'kotlin.apply' call
var this_0 = ArrayList_init_$Create$();
// Inline function 'kotlin.text.mapTo' call
var inductionVariable = 0;
while (inductionVariable < charSequenceLength(name)) {
var item = charSequenceGet(name, inductionVariable);
inductionVariable = inductionVariable + 1 | 0;
var tmp$ret$0 = new ColorComponentInfo(toString_0(item), item === _Char___init__impl__6a9atx(72), item === _Char___init__impl__6a9atx(72) ? 0.0 : l, item === _Char___init__impl__6a9atx(72) ? 360.0 : r);
this_0.e(tmp$ret$0);
}
this_0.e(get_alphaInfo());
return this_0.e5();
}
function componentInfoList(c) {
_init_properties_ColorSpaceUtils_kt__cnwylg();
return listOf(arrayConcat([c, [get_alphaInfo()]]));
}
var properties_initialized_ColorSpaceUtils_kt_kskdoe;
function _init_properties_ColorSpaceUtils_kt__cnwylg() {
if (!properties_initialized_ColorSpaceUtils_kt_kskdoe) {
properties_initialized_ColorSpaceUtils_kt_kskdoe = true;
alphaInfo = new ColorComponentInfo('alpha', false, 0.0, 1.0);
}
}
function get_CAT02_XYZ_TO_LMS() {
_init_properties_Constants_kt__atb1ur();
return CAT02_XYZ_TO_LMS;
}
var CAT02_XYZ_TO_LMS;
function get_CAT02_LMS_TO_XYZ() {
_init_properties_Constants_kt__atb1ur();
return CAT02_LMS_TO_XYZ;
}
var CAT02_LMS_TO_XYZ;
var properties_initialized_Constants_kt_w4w61t;
function _init_properties_Constants_kt__atb1ur() {
if (!properties_initialized_Constants_kt_w4w61t) {
properties_initialized_Constants_kt_w4w61t = true;
CAT02_XYZ_TO_LMS = _Matrix___init__impl__q3kp4w_0(+0.7328, +0.4296, -0.1624, -0.7036, +1.6975, +0.0061, +0.003, +0.0136, +0.9834);
CAT02_LMS_TO_XYZ = inverse(get_CAT02_XYZ_TO_LMS());
}
}
function spow(_this__u8e3s4, p) {
return spow_0(_this__u8e3s4, p);
}
function normalizeDeg(_this__u8e3s4) {
return (_this__u8e3s4 % 360.0 + 360.0) % 360.0;
}
function spow_0(_this__u8e3s4, p) {
// Inline function 'kotlin.math.absoluteValue' call
// Inline function 'kotlin.math.pow' call
var this_0 = Math.abs(_this__u8e3s4);
var tmp$ret$1 = Math.pow(this_0, p);
return withSign(tmp$ret$1, _this__u8e3s4);
}
function normalizeDeg_0(_this__u8e3s4) {
return (_this__u8e3s4 % 360.0 + 360.0) % 360.0;
}
function _Matrix___init__impl__q3kp4w(rowMajor) {
return rowMajor;
}
function _Matrix___get_rowMajor__impl__vmgxkq($this) {
return $this;
}
function _Matrix___init__impl__q3kp4w_0(v00, v10, v20, v01, v11, v21, v02, v12, v22) {
// Inline function 'kotlin.floatArrayOf' call
var tmp$ret$0 = new Float32Array([v00, v10, v20, v01, v11, v21, v02, v12, v22]);
return _Matrix___init__impl__q3kp4w(tmp$ret$0);
}
function Matrix__copy_impl_kmkvzd($this) {
// Inline function 'kotlin.collections.copyOf' call
// Inline function 'kotlin.js.asDynamic' call
var tmp$ret$1 = _Matrix___get_rowMajor__impl__vmgxkq($this).slice();
return _Matrix___init__impl__q3kp4w(tmp$ret$1);
}
function Matrix__get_impl_xogbpk($this, x, y) {
return _Matrix___get_rowMajor__impl__vmgxkq($this)[imul(y, 3) + x | 0];
}
function Matrix__set_impl_s2l54c($this, x, y, value) {
_Matrix___get_rowMajor__impl__vmgxkq($this)[imul(y, 3) + x | 0] = value;
}
function Matrix__set_impl_s2l54c_0($this, x, y, value) {
return Matrix__set_impl_s2l54c($this, x, y, value);
}
function Matrix__toString_impl_l0abk0($this) {
return trimMargin('Mat3(\n | ' + Matrix__get_impl_xogbpk($this, 0, 0) + ', ' + Matrix__get_impl_xogbpk($this, 1, 0) + ', ' + Matrix__get_impl_xogbpk($this, 2, 0) + ', \n | ' + Matrix__get_impl_xogbpk($this, 0, 1) + ', ' + Matrix__get_impl_xogbpk($this, 1, 1) + ', ' + Matrix__get_impl_xogbpk($this, 2, 1) + ', \n | ' + Matrix__get_impl_xogbpk($this, 0, 2) + ', ' + Matrix__get_impl_xogbpk($this, 1, 2) + ', ' + Matrix__get_impl_xogbpk($this, 2, 2) + ', \n |)\n ');
}
function Matrix__hashCode_impl_s9ntm9($this) {
return hashCode($this);
}
function Matrix__equals_impl_g5p8p9($this, other) {
if (!(other instanceof Matrix))
return false;
var tmp0_other_with_cast = other instanceof Matrix ? other.q1k_1 : THROW_CCE();
if (!equals($this, tmp0_other_with_cast))
return false;
return true;
}
function Matrix(rowMajor) {
this.q1k_1 = rowMajor;
}
protoOf(Matrix).toString = function () {
return Matrix__toString_impl_l0abk0(this.q1k_1);
};
protoOf(Matrix).hashCode = function () {
return Matrix__hashCode_impl_s9ntm9(this.q1k_1);
};
protoOf(Matrix).equals = function (other) {
return Matrix__equals_impl_g5p8p9(this.q1k_1, other);
};
function inverse(_this__u8e3s4, inPlace) {
inPlace = inPlace === VOID ? false : inPlace;
var a = Matrix__get_impl_xogbpk(_this__u8e3s4, 0, 0);
var b = Matrix__get_impl_xogbpk(_this__u8e3s4, 1, 0);
var c = Matrix__get_impl_xogbpk(_this__u8e3s4, 2, 0);
var d = Matrix__get_impl_xogbpk(_this__u8e3s4, 0, 1);
var e = Matrix__get_impl_xogbpk(_this__u8e3s4, 1, 1);
var f = Matrix__get_impl_xogbpk(_this__u8e3s4, 2, 1);
var g = Matrix__get_impl_xogbpk(_this__u8e3s4, 0, 2);
var h = Matrix__get_impl_xogbpk(_this__u8e3s4, 1, 2);
var i = Matrix__get_impl_xogbpk(_this__u8e3s4, 2, 2);
var A = e * i - h * f;
var B = h * c - b * i;
var C = b * f - e * c;
var det = a * A + d * B + g * C;
var out = inPlace ? _this__u8e3s4 : Matrix__copy_impl_kmkvzd(_this__u8e3s4);
Matrix__set_impl_s2l54c_0(out, 0, 0, A / det);
Matrix__set_impl_s2l54c_0(out, 0, 1, (g * f - d * i) / det);
Matrix__set_impl_s2l54c_0(out, 0, 2, (d * h - g * e) / det);
Matrix__set_impl_s2l54c_0(out, 1, 0, B / det);
Matrix__set_impl_s2l54c_0(out, 1, 1, (a * i - g * c) / det);
Matrix__set_impl_s2l54c_0(out, 1, 2, (g * b - a * h) / det);
Matrix__set_impl_s2l54c_0(out, 2, 0, C / det);
Matrix__set_impl_s2l54c_0(out, 2, 1, (d * c - a * f) / det);
Matrix__set_impl_s2l54c_0(out, 2, 2, (a * e - d * b) / det);
return out;
}
function scalarDiv(_this__u8e3s4, x, inPlace) {
inPlace = inPlace === VOID ? false : inPlace;
var out = _Matrix___get_rowMajor__impl__vmgxkq(inPlace ? _this__u8e3s4 : Matrix__copy_impl_kmkvzd(_this__u8e3s4));
var inductionVariable = 0;
var last = out.length - 1 | 0;
if (inductionVariable <= last)
do {
var i = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
out[i] = out[i] / x;
}
while (inductionVariable <= last);
return _Matrix___init__impl__q3kp4w(out);
}
function dot(_this__u8e3s4, other) {
return _Matrix___init__impl__q3kp4w_0(dot$f(_this__u8e3s4, other, 0, 0), dot$f(_this__u8e3s4, other, 1, 0), dot$f(_this__u8e3s4, other, 2, 0), dot$f(_this__u8e3s4, other, 0, 1), dot$f(_this__u8e3s4, other, 1, 1), dot$f(_this__u8e3s4, other, 2, 1), dot$f(_this__u8e3s4, other, 0, 2), dot$f(_this__u8e3s4, other, 1, 2), dot$f(_this__u8e3s4, other, 2, 2));
}
function dotDiagonal(_this__u8e3s4, v0, v1, v2) {
return _Matrix___init__impl__q3kp4w_0(Matrix__get_impl_xogbpk(_this__u8e3s4, 0, 0) * v0, Matrix__get_impl_xogbpk(_this__u8e3s4, 1, 0) * v1, Matrix__get_impl_xogbpk(_this__u8e3s4, 2, 0) * v2, Matrix__get_impl_xogbpk(_this__u8e3s4, 0, 1) * v0, Matrix__get_impl_xogbpk(_this__u8e3s4, 1, 1) * v1, Matrix__get_impl_xogbpk(_this__u8e3s4, 2, 1) * v2, Matrix__get_impl_xogbpk(_this__u8e3s4, 0, 2) * v0, Matrix__get_impl_xogbpk(_this__u8e3s4, 1, 2) * v1, Matrix__get_impl_xogbpk(_this__u8e3s4, 2, 2) * v2);
}
function _Vector___init__impl__y7x4qq(values) {
return values;
}
function _Vector___get_values__impl__3gdbp5($this) {
return $this;
}
function _Vector___init__impl__y7x4qq_0(v0, v1, v2) {
// Inline function 'kotlin.floatArrayOf' call
var tmp$ret$0 = new Float32Array([v0, v1, v2]);
return _Vector___init__impl__y7x4qq(tmp$ret$0);
}
function _Vector___get_l__impl__envr1l($this) {
return _Vector___get_values__impl__3gdbp5($this)[0];
}
function _Vector___get_m__impl__e5qq0m($this) {
return _Vector___get_values__impl__3gdbp5($this)[1];
}
function _Vector___get_s__impl__pzuljk($this) {
return _Vector___get_values__impl__3gdbp5($this)[2];
}
function Vector__toString_impl_hn2ybi($this) {
return 'Vector(values=' + toString($this) + ')';
}
function Vector__hashCode_impl_442yhd($this) {
return hashCode($this);
}
function Vector__equals_impl_hy6igl($this, other) {
if (!(other instanceof Vector))
return false;
var tmp0_other_with_cast = other instanceof Vector ? other.r1k_1 : THROW_CCE();
if (!equals($this, tmp0_other_with_cast))
return false;
return true;
}
function Vector(values) {
this.r1k_1 = values;
}
protoOf(Vector).toString = function () {
return Vector__toString_impl_hn2ybi(this.r1k_1);
};
protoOf(Vector).hashCode = function () {
return Vector__hashCode_impl_442yhd(this.r1k_1);
};
protoOf(Vector).equals = function (other) {
return Vector__equals_impl_hy6igl(this.r1k_1, other);
};
function dot_0(_this__u8e3s4, v0, v1, v2) {
// Inline function 'com.github.ajalt.colormath.internal.dot' call
var tmp0 = Matrix__get_impl_xogbpk(_this__u8e3s4, 0, 0) * v0 + Matrix__get_impl_xogbpk(_this__u8e3s4, 1, 0) * v1 + Matrix__get_impl_xogbpk(_this__u8e3s4, 2, 0) * v2;
var tmp2 = Matrix__get_impl_xogbpk(_this__u8e3s4, 0, 1) * v0 + Matrix__get_impl_xogbpk(_this__u8e3s4, 1, 1) * v1 + Matrix__get_impl_xogbpk(_this__u8e3s4, 2, 1) * v2;
var p2 = Matrix__get_impl_xogbpk(_this__u8e3s4, 0, 2) * v0 + Matrix__get_impl_xogbpk(_this__u8e3s4, 1, 2) * v1 + Matrix__get_impl_xogbpk(_this__u8e3s4, 2, 2) * v2;
return _Vector___init__impl__y7x4qq_0(tmp0, tmp2, p2);
}
function dot$f($this_dot, $other, x, y) {
return Matrix__get_impl_xogbpk($this_dot, 0, y) * Matrix__get_impl_xogbpk($other, x, 0) + Matrix__get_impl_xogbpk($this_dot, 1, y) * Matrix__get_impl_xogbpk($other, x, 1) + Matrix__get_impl_xogbpk($this_dot, 2, y) * Matrix__get_impl_xogbpk($other, x, 2);
}
function Companion() {
Companion_instance = this;
this.s1k_1 = componentInfoList([new ColorComponentInfo('code', false, 30.0, 107.0)]);
}
protoOf(Companion).t1k = function () {
return this.s1k_1;
};
var Companion_instance;
function Companion_getInstance() {
if (Companion_instance == null)
new Companion();
return Companion_instance;
}
function Ansi16(code) {
Companion_getInstance();
this.u1k_1 = code;
}
protoOf(Ansi16).u1j = function () {
return Companion_getInstance();
};
protoOf(Ansi16).v1j = function () {
switch (this.u1k_1) {
case 30:
case 40:
return Companion_getInstance_2().v1k(0.0, 0.0, 0.0);
case 90:
case 100:
return Companion_getInstance_2().w1k(128, 128, 128);
case 37:
case 47:
return Companion_getInstance_2().w1k(192, 192, 192);
case 97:
case 107:
return Companion_getInstance_2().v1k(1.0, 1.0, 1.0);
}
var color = this.u1k_1 % 10 | 0;
var mul = this.u1k_1 > 50 ? 1.0 : 0.5;
var r = (color % 2 | 0) * mul;
var g = ((color / 2 | 0) % 2 | 0) * mul;
var b = ((color / 4 | 0) % 2 | 0) * mul;
return Companion_getInstance_2().v1k(r, g, b);
};
protoOf(Ansi16).toString = function () {
return 'Ansi16(code=' + this.u1k_1 + ')';
};
protoOf(Ansi16).hashCode = function () {
return this.u1k_1;
};
protoOf(Ansi16).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof Ansi16))
return false;
var tmp0_other_with_cast = other instanceof Ansi16 ? other : THROW_CCE();
if (!(this.u1k_1 === tmp0_other_with_cast.u1k_1))
return false;
return true;
};
function Companion_0() {
Companion_instance_0 = this;
this.x1k_1 = componentInfoList([new ColorComponentInfo('code', false, 0.0, 255.0)]);
}
protoOf(Companion_0).t1k = function () {
return this.x1k_1;
};
var Companion_instance_0;
function Companion_getInstance_0() {
if (Companion_instance_0 == null)
new Companion_0();
return Companion_instance_0;
}
function Ansi256(code) {
Companion_getInstance_0();
this.y1k_1 = code;
}
protoOf(Ansi256).u1j = function () {
return Companion_getInstance_0();
};
protoOf(Ansi256).v1j = function () {
if (this.y1k_1 < 16)
return this.z1k().v1j();
if (this.y1k_1 >= 232) {
var c = imul(this.y1k_1 - 232 | 0, 10) + 8 | 0;
return Companion_getInstance_2().w1k(c, c, c);
}
var c_0 = this.y1k_1 - 16 | 0;
var rem = c_0 % 36 | 0;
// Inline function 'kotlin.math.floor' call
var x = c_0 / 36.0;
var r = Math.floor(x) / 5.0;
// Inline function 'kotlin.math.floor' call
var x_0 = rem / 6.0;
var g = Math.floor(x_0) / 5.0;
var b = (rem % 6 | 0) / 5.0;
return Companion_getInstance_2().a1l(r, g, b);
};
protoOf(Ansi256).z1k = function () {
return this.y1k_1 < 8 ? new Ansi16(this.y1k_1 + 30 | 0) : this.y1k_1 < 16 ? new Ansi16((this.y1k_1 - 8 | 0) + 90 | 0) : this.v1j().z1k();
};
protoOf(Ansi256).toString = function () {
return 'Ansi256(code=' + this.y1k_1 + ')';
};
protoOf(Ansi256).hashCode = function () {
return this.y1k_1;
};
protoOf(Ansi256).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof Ansi256))
return false;
var tmp0_other_with_cast = other instanceof Ansi256 ? other : THROW_CCE();
if (!(this.y1k_1 === tmp0_other_with_cast.y1k_1))
return false;
return true;
};
function Companion_1() {
Companion_instance_1 = this;
this.b1l_1 = polarComponentInfo('HSV', 0.0, 1.0);
}
protoOf(Companion_1).t1k = function () {
return this.b1l_1;
};
var Companion_instance_1;
function Companion_getInstance_1() {
if (Companion_instance_1 == null)
new Companion_1();
return Companion_instance_1;
}
function toSRGB$f(h, v, s, n) {
var k = (n + h) % 6;
var tmp = v * s;
// Inline function 'kotlin.comparisons.minOf' call
var b = 4 - k;
var tmp$ret$0 = Math.min(k, b, 1.0);
return v - tmp * coerceAtLeast(tmp$ret$0, 0.0);
}
function HSV(h, s, v, alpha) {
Companion_getInstance_1();
alpha = alpha === VOID ? 1.0 : alpha;
this.c1l_1 = h;
this.d1l_1 = s;
this.e1l_1 = v;
this.f1l_1 = alpha;
}
protoOf(HSV).u1j = function () {
return Companion_getInstance_1();
};
protoOf(HSV).v1j = function () {
if (this.d1l_1 < 1.0E-7)
return Companion_getInstance_2().h1l(this.e1l_1, this.e1l_1, this.e1l_1, this.f1l_1);
var v = this.e1l_1;
var h = normalizeDeg_0(this.c1l_1) / 60.0;
var s = this.d1l_1;
return SRGB_getInstance().h1l(toSRGB$f(h, v, s, 5), toSRGB$f(h, v, s, 3), toSRGB$f(h, v, s, 1), this.f1l_1);
};
protoOf(HSV).toString = function () {
return 'HSV(h=' + this.c1l_1 + ', s=' + this.d1l_1 + ', v=' + this.e1l_1 + ', alpha=' + this.f1l_1 + ')';
};
protoOf(HSV).hashCode = function () {
var result = getNumberHashCode(this.c1l_1);
result = imul(result, 31) + getNumberHashCode(this.d1l_1) | 0;
result = imul(result, 31) + getNumberHashCode(this.e1l_1) | 0;
result = imul(result, 31) + getNumberHashCode(this.f1l_1) | 0;
return result;
};
protoOf(HSV).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof HSV))
return false;
var tmp0_other_with_cast = other instanceof HSV ? other : THROW_CCE();
if (!equals(this.c1l_1, tmp0_other_with_cast.c1l_1))
return false;
if (!equals(this.d1l_1, tmp0_other_with_cast.d1l_1))
return false;
if (!equals(this.e1l_1, tmp0_other_with_cast.e1l_1))
return false;
if (!equals(this.f1l_1, tmp0_other_with_cast.f1l_1))
return false;
return true;
};
function get_ICTCP_RGB_TO_LMS() {
_init_properties_ICtCp_kt__7vx7or();
return ICTCP_RGB_TO_LMS;
}
var ICTCP_RGB_TO_LMS;
function get_ICTCP_LMS_TO_ICTCP() {
_init_properties_ICtCp_kt__7vx7or();
return ICTCP_LMS_TO_ICTCP;
}
var ICTCP_LMS_TO_ICTCP;
function get_ICTCP_LMS_to_RGB() {
_init_properties_ICtCp_kt__7vx7or();
return ICTCP_LMS_to_RGB;
}
var ICTCP_LMS_to_RGB;
function get_ICTCP_ICTCP_to_LMS() {
_init_properties_ICtCp_kt__7vx7or();
return ICTCP_ICTCP_to_LMS;
}
var ICTCP_ICTCP_to_LMS;
function get_ICTCP_CROSSTALK() {
_init_properties_ICtCp_kt__7vx7or();
return ICTCP_CROSSTALK;
}
var ICTCP_CROSSTALK;
function get_HPE_XYZ_TO_LMS() {
_init_properties_ICtCp_kt__7vx7or();
return HPE_XYZ_TO_LMS;
}
var HPE_XYZ_TO_LMS;
function get_ICTCP_XYZ_TO_LMS() {
_init_properties_ICtCp_kt__7vx7or();
return ICTCP_XYZ_TO_LMS;
}
var ICTCP_XYZ_TO_LMS;
var ICTCP_LMS_TO_XYZ;
function ICtCp() {
}
protoOf(ICtCp).n1l = function () {
var fo = RGBColorSpaces_getInstance().v1l_1.a1m();
var tmp0 = get_ICTCP_ICTCP_to_LMS();
var tmp2 = this.j1l_1;
var tmp4 = this.k1l_1;
// Inline function 'com.github.ajalt.colormath.internal.dot' call
var v2 = this.l1l_1;
var tmp0_0 = Matrix__get_impl_xogbpk(tmp0, 0, 0) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 1, 0) * tmp4 + Matrix__get_impl_xogbpk(tmp0, 2, 0) * v2;
var tmp2_0 = Matrix__get_impl_xogbpk(tmp0, 0, 1) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 1, 1) * tmp4 + Matrix__get_impl_xogbpk(tmp0, 2, 1) * v2;
var s = Matrix__get_impl_xogbpk(tmp0, 0, 2) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 1, 2) * tmp4 + Matrix__get_impl_xogbpk(tmp0, 2, 2) * v2;
var tmp0_1 = get_ICTCP_LMS_to_RGB();
var tmp2_1 = PqNonlinearity_instance.j1m(tmp0_0);
var tmp4_0 = PqNonlinearity_instance.j1m(tmp2_0);
// Inline function 'com.github.ajalt.colormath.internal.dot' call
var v2_0 = PqNonlinearity_instance.j1m(s);
var tmp0_2 = Matrix__get_impl_xogbpk(tmp0_1, 0, 0) * tmp2_1 + Matrix__get_impl_xogbpk(tmp0_1, 1, 0) * tmp4_0 + Matrix__get_impl_xogbpk(tmp0_1, 2, 0) * v2_0;
var tmp2_2 = Matrix__get_impl_xogbpk(tmp0_1, 0, 1) * tmp2_1 + Matrix__get_impl_xogbpk(tmp0_1, 1, 1) * tmp4_0 + Matrix__get_impl_xogbpk(tmp0_1, 2, 1) * v2_0;
var b = Matrix__get_impl_xogbpk(tmp0_1, 0, 2) * tmp2_1 + Matrix__get_impl_xogbpk(tmp0_1, 1, 2) * tmp4_0 + Matrix__get_impl_xogbpk(tmp0_1, 2, 2) * v2_0;
return RGBColorSpaces_getInstance().v1l_1.h1l(fo.k1m(tmp0_2), fo.k1m(tmp2_2), fo.k1m(b), this.m1l_1);
};
function PqNonlinearity() {
this.b1m_1 = 0.1593017578125;
this.c1m_1 = 78.84375;
this.d1m_1 = 0.8359375;
this.e1m_1 = 18.8515625;
this.f1m_1 = 18.6875;
this.g1m_1 = 10000.0;
this.h1m_1 = 6.277394636015326;
this.i1m_1 = 0.012683313515655966;
}
protoOf(PqNonlinearity).j1m = function (x) {
var vp = spow(x, 0.012683313515655966);
var n = coerceAtLeast(vp - 0.8359375, 0.0);
var l = spow_0(n / (18.8515625 - 18.6875 * vp), 6.277394636015326);
return 10000.0 * l;
};
protoOf(PqNonlinearity).k1m = function (x) {
var yp = spow_0(x / 10000.0, 0.1593017578125);
return spow_0((0.8359375 + 18.8515625 * yp) / (1.0 + 18.6875 * yp), 78.84375);
};
var PqNonlinearity_instance;
function PqNonlinearity_getInstance() {
return PqNonlinearity_instance;
}
var properties_initialized_ICtCp_kt_w6y8uv;
function _init_properties_ICtCp_kt__7vx7or() {
if (!properties_initialized_ICtCp_kt_w6y8uv) {
properties_initialized_ICtCp_kt_w6y8uv = true;
ICTCP_RGB_TO_LMS = scalarDiv(_Matrix___init__impl__q3kp4w_0(1688.0, 2146.0, 262.0, 683.0, 2951.0, 462.0, 99.0, 309.0, 3688.0), 4096.0, true);
ICTCP_LMS_TO_ICTCP = scalarDiv(_Matrix___init__impl__q3kp4w_0(2048.0, 2048.0, 0.0, 6610.0, -13613.0, 7003.0, 17933.0, -17390.0, -543.0), 4096.0, true);
ICTCP_LMS_to_RGB = inverse(get_ICTCP_RGB_TO_LMS());
ICTCP_ICTCP_to_LMS = inverse(get_ICTCP_LMS_TO_ICTCP());
ICTCP_CROSSTALK = _Matrix___init__impl__q3kp4w_0(0.92, 0.04, 0.04, 0.04, 0.92, 0.04, 0.04, 0.04, 0.92);
HPE_XYZ_TO_LMS = _Matrix___init__impl__q3kp4w_0(0.4002, 0.7076, -0.0808, -0.2263, 1.1653, 0.0457, 0.0, 0.0, 0.9182);
ICTCP_XYZ_TO_LMS = dot(get_ICTCP_CROSSTALK(), get_HPE_XYZ_TO_LMS());
ICTCP_LMS_TO_XYZ = inverse(get_ICTCP_XYZ_TO_LMS());
}
}
function GammaTransferFunctions(gamma) {
this.l1m_1 = gamma;
}
protoOf(GammaTransferFunctions).j1m = function (x) {
return spow(x, this.l1m_1);
};
protoOf(GammaTransferFunctions).k1m = function (x) {
return spow(x, 1.0 / this.l1m_1);
};
protoOf(GammaTransferFunctions).toString = function () {
return 'GammaTransferFunctions(gamma=' + this.l1m_1 + ')';
};
protoOf(GammaTransferFunctions).hashCode = function () {
return getNumberHashCode(this.l1m_1);
};
protoOf(GammaTransferFunctions).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof GammaTransferFunctions))
return false;
var tmp0_other_with_cast = other instanceof GammaTransferFunctions ? other : THROW_CCE();
if (!equals(this.l1m_1, tmp0_other_with_cast.l1m_1))
return false;
return true;
};
function LinearTransferFunctions() {
}
protoOf(LinearTransferFunctions).j1m = function (x) {
return x;
};
protoOf(LinearTransferFunctions).k1m = function (x) {
return x;
};
var LinearTransferFunctions_instance;
function LinearTransferFunctions_getInstance() {
return LinearTransferFunctions_instance;
}
function RGBColorSpace() {
}
function Companion_2() {
Companion_instance_2 = this;
this.g1l_1 = RGBColorSpaces_getInstance().o1l_1;
}
protoOf(Companion_2).h1l = function (r, g, b, alpha) {
return this.g1l_1.h1l(r, g, b, alpha);
};
protoOf(Companion_2).m1m = function (r, g, b, alpha) {
return this.g1l_1.m1m(r, g, b, alpha);
};
protoOf(Companion_2).o1m = function (hex) {
return this.g1l_1.o1m(hex);
};
protoOf(Companion_2).n1m = function (r, g, b, alpha) {
return this.g1l_1.n1m(r, g, b, alpha);
};
protoOf(Companion_2).a1m = function () {
return this.g1l_1.a1m();
};
protoOf(Companion_2).p1m = function () {
return this.g1l_1.p1m();
};
protoOf(Companion_2).q1m = function () {
return this.g1l_1.q1m();
};
protoOf(Companion_2).r1m = function () {
return this.g1l_1.r1m();
};
protoOf(Companion_2).c13 = function () {
return this.g1l_1.c13();
};
protoOf(Companion_2).t1k = function () {
return this.g1l_1.t1k();
};
protoOf(Companion_2).equals = function (other) {
return equals(RGBColorSpaces_getInstance().o1l_1, other);
};
protoOf(Companion_2).hashCode = function () {
return hashCode(RGBColorSpaces_getInstance().o1l_1);
};
var Companion_instance_2;
function Companion_getInstance_2() {
if (Companion_instance_2 == null)
new Companion_2();
return Companion_instance_2;
}
function RGB(r, g, b, alpha, space) {
Companion_getInstance_2();
this.x1j_1 = r;
this.y1j_1 = g;
this.z1j_1 = b;
this.a1k_1 = alpha;
this.b1k_1 = space;
}
protoOf(RGB).u1j = function () {
return this.b1k_1;
};
protoOf(RGB).s1m = function () {
// Inline function 'kotlin.math.roundToInt' call
var this_0 = this.x1j_1 * 255;
return roundToInt(this_0);
};
protoOf(RGB).t1m = function () {
// Inline function 'kotlin.math.roundToInt' call
var this_0 = this.y1j_1 * 255;
return roundToInt(this_0);
};
protoOf(RGB).u1m = function () {
// Inline function 'kotlin.math.roundToInt' call
var this_0 = this.z1j_1 * 255;
return roundToInt(this_0);
};
protoOf(RGB).v1m = function (space) {
var f = SRGB_getInstance().a1m();
return equals(this.b1k_1, space) ? this : equals(this.b1k_1, SRGB_getInstance()) && equals(space, RGBColorSpaces_getInstance().p1l_1) ? space.h1l(f.j1m(this.x1j_1), f.j1m(this.y1j_1), f.j1m(this.z1j_1), this.a1k_1) : equals(this.b1k_1, RGBColorSpaces_getInstance().p1l_1) && equals(space, SRGB_getInstance()) ? space.h1l(f.k1m(this.x1j_1), f.k1m(this.y1j_1), f.k1m(this.z1j_1), this.a1k_1) : this.w1j().b1n(space);
};
protoOf(RGB).c1n = function () {
var tmp$ret$3;
$l$block: {
// Inline function 'com.github.ajalt.colormath.model.RGB.srgbHueMinMaxChroma' call
// Inline function 'com.github.ajalt.colormath.model.RGB.toSRGB' call
var $this$toSRGB = this.v1m(SRGB_getInstance());
var r = $this$toSRGB.x1j_1;
var g = $this$toSRGB.y1j_1;
var b = $this$toSRGB.z1j_1;
// Inline function 'kotlin.comparisons.minOf' call
var min = Math.min(r, g, b);
// Inline function 'kotlin.comparisons.maxOf' call
var max = Math.max(r, g, b);
var chroma = max - min;
var h = (chroma < 1.0E-7 ? NaN : r === max ? (g - b) / chroma : g === max ? 2 + (b - r) / chroma : b === max ? 4 + (r - g) / chroma : 0.0) * 60;
var h_0 = normalizeDeg(h);
var s = max === 0.0 ? 0.0 : chroma / max;
tmp$ret$3 = new HSV(h_0, s, max, this.a1k_1);
break $l$block;
}
return tmp$ret$3;
};
protoOf(RGB).w1j = function () {
var f = this.b1k_1.a1m();
var tmp0 = _Matrix___init__impl__q3kp4w(this.b1k_1.p1m());
var tmp2 = f.j1m(this.x1j_1);
var tmp4 = f.j1m(this.y1j_1);
// Inline function 'com.github.ajalt.colormath.internal.dot' call
var v2 = f.j1m(this.z1j_1);
var tmp0_0 = Matrix__get_impl_xogbpk(tmp0, 0, 0) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 1, 0) * tmp4 + Matrix__get_impl_xogbpk(tmp0, 2, 0) * v2;
var tmp2_0 = Matrix__get_impl_xogbpk(tmp0, 0, 1) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 1, 1) * tmp4 + Matrix__get_impl_xogbpk(tmp0, 2, 1) * v2;
var z = Matrix__get_impl_xogbpk(tmp0, 0, 2) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 1, 2) * tmp4 + Matrix__get_impl_xogbpk(tmp0, 2, 2) * v2;
return XYZColorSpace_0(this.b1k_1.r1m()).h1l(tmp0_0, tmp2_0, z, this.a1k_1);
};
protoOf(RGB).z1k = function () {
// Inline function 'com.github.ajalt.colormath.model.RGB.toSRGB' call
var $this$toSRGB = this.v1m(SRGB_getInstance());
// Inline function 'kotlin.math.roundToInt' call
var this_0 = $this$toSRGB.c1n().e1l_1 * 100;
var value = roundToInt(this_0);
if (value === 30)
return new Ansi16(30);
var v = value / 50 | 0;
// Inline function 'kotlin.math.roundToInt' call
var this_1 = $this$toSRGB.z1j_1;
var tmp$ret$1 = roundToInt(this_1);
var tmp = imul(tmp$ret$1, 4);
// Inline function 'kotlin.math.roundToInt' call
var this_2 = $this$toSRGB.y1j_1;
var tmp$ret$2 = roundToInt(this_2);
var tmp_0 = tmp | imul(tmp$ret$2, 2);
// Inline function 'kotlin.math.roundToInt' call
var this_3 = $this$toSRGB.x1j_1;
var ansi = 30 + (tmp_0 | roundToInt(this_3)) | 0;
return new Ansi16(v === 2 ? ansi + 60 | 0 : ansi);
};
protoOf(RGB).d1n = function () {
// Inline function 'com.github.ajalt.colormath.model.RGB.toSRGB' call
var $this$toSRGB = this.v1m(SRGB_getInstance());
var ri = $this$toSRGB.s1m();
var gi = $this$toSRGB.t1m();
var bi = $this$toSRGB.u1m();
var tmp;
if (ri === gi && gi === bi) {
tmp = ri < 8 ? 16 : ri > 248 ? 231 : roundToInt((ri - 8 | 0) / 247.0 * 24.0) + 232 | 0;
} else {
// Inline function 'kotlin.math.roundToInt' call
var this_0 = $this$toSRGB.x1j_1 * 5;
var tmp$ret$0 = roundToInt(this_0);
var tmp_0 = 16 + imul(36, tmp$ret$0) | 0;
// Inline function 'kotlin.math.roundToInt' call
var this_1 = $this$toSRGB.y1j_1 * 5;
var tmp$ret$1 = roundToInt(this_1);
var tmp_1 = tmp_0 + imul(6, tmp$ret$1) | 0;
// Inline function 'kotlin.math.roundToInt' call
var this_2 = $this$toSRGB.z1j_1 * 5;
tmp = tmp_1 + roundToInt(this_2) | 0;
}
var code = tmp;
return new Ansi256(code);
};
protoOf(RGB).v1j = function () {
return this.v1m(RGBColorSpaces_getInstance().o1l_1);
};
protoOf(RGB).e1n = function () {
var tmp2 = this.x1j_1;
var tmp4 = this.y1j_1;
var tmp6 = this.z1j_1;
// Inline function 'com.github.ajalt.colormath.internal.clamp3' call
var alpha = this.a1k_1;
var _destruct__k2r9zo = this.u1j().t1k();
// Inline function 'kotlin.collections.component1' call
var c1 = _destruct__k2r9zo.q(0);
// Inline function 'kotlin.collections.component2' call
var c2 = _destruct__k2r9zo.q(1);
// Inline function 'kotlin.collections.component3' call
var c3 = _destruct__k2r9zo.q(2);
var tmp;
var tmp_0;
var tmp_1;
var tmp_2;
var containsLower = c1.e1k_1;
if (tmp2 <= c1.f1k_1 ? containsLower <= tmp2 : false) {
var containsLower_0 = c2.e1k_1;
tmp_2 = tmp4 <= c2.f1k_1 ? containsLower_0 <= tmp4 : false;
} else {
tmp_2 = false;
}
if (tmp_2) {
var containsLower_1 = c3.e1k_1;
tmp_1 = tmp6 <= c3.f1k_1 ? containsLower_1 <= tmp6 : false;
} else {
tmp_1 = false;
}
if (tmp_1) {
tmp_0 = 0.0 <= alpha ? alpha <= 1.0 : false;
} else {
tmp_0 = false;
}
if (tmp_0) {
tmp = this;
} else {
var tmp2_0 = coerceIn(tmp2, c1.e1k_1, c1.f1k_1);
var tmp4_0 = coerceIn(tmp4, c2.e1k_1, c2.f1k_1);
var tmp6_0 = coerceIn(tmp6, c3.e1k_1, c3.f1k_1);
var p3 = coerceIn(alpha, 0.0, 1.0);
tmp = this.f1n(tmp2_0, tmp4_0, tmp6_0, p3);
}
return tmp;
};
protoOf(RGB).g1n = function (r, g, b, alpha, space) {
return new RGB(r, g, b, alpha, space);
};
protoOf(RGB).f1n = function (r, g, b, alpha, space, $super) {
r = r === VOID ? this.x1j_1 : r;
g = g === VOID ? this.y1j_1 : g;
b = b === VOID ? this.z1j_1 : b;
alpha = alpha === VOID ? this.a1k_1 : alpha;
space = space === VOID ? this.b1k_1 : space;
return $super === VOID ? this.g1n(r, g, b, alpha, space) : $super.g1n.call(this, r, g, b, alpha, space);
};
protoOf(RGB).toString = function () {
return 'RGB(r=' + this.x1j_1 + ', g=' + this.y1j_1 + ', b=' + this.z1j_1 + ', alpha=' + this.a1k_1 + ', space=' + toString(this.b1k_1) + ')';
};
protoOf(RGB).hashCode = function () {
var result = getNumberHashCode(this.x1j_1);
result = imul(result, 31) + getNumberHashCode(this.y1j_1) | 0;
result = imul(result, 31) + getNumberHashCode(this.z1j_1) | 0;
result = imul(result, 31) + getNumberHashCode(this.a1k_1) | 0;
result = imul(result, 31) + hashCode(this.b1k_1) | 0;
return result;
};
protoOf(RGB).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof RGB))
return false;
var tmp0_other_with_cast = other instanceof RGB ? other : THROW_CCE();
if (!equals(this.x1j_1, tmp0_other_with_cast.x1j_1))
return false;
if (!equals(this.y1j_1, tmp0_other_with_cast.y1j_1))
return false;
if (!equals(this.z1j_1, tmp0_other_with_cast.z1j_1))
return false;
if (!equals(this.a1k_1, tmp0_other_with_cast.a1k_1))
return false;
if (!equals(this.b1k_1, tmp0_other_with_cast.b1k_1))
return false;
return true;
};
function parseHex(_this__u8e3s4, startIndex) {
var tmp;
if (get_hexLength(_this__u8e3s4) > 4) {
var i = charCodeAt(_this__u8e3s4, 0) === _Char___init__impl__6a9atx(35) ? imul(startIndex, 2) + 1 | 0 : imul(startIndex, 2);
tmp = toInt(slice(_this__u8e3s4, numberRangeToNumber(i, i + 1 | 0)), 16);
} else {
var i_0 = charCodeAt(_this__u8e3s4, 0) === _Char___init__impl__6a9atx(35) ? startIndex + 1 | 0 : startIndex;
// Inline function 'kotlin.let' call
var it = charCodeAt(_this__u8e3s4, i_0);
var tmp$ret$1 = toString_0(it) + toString_0(it);
tmp = toInt(tmp$ret$1, 16);
}
return tmp;
}
function validateHex(_this__u8e3s4) {
// Inline function 'kotlin.apply' call
// Inline function 'kotlin.let' call
var it = get_hexLength(_this__u8e3s4);
// Inline function 'kotlin.require' call
if (!(it === 3 || it === 4 || it === 6 || it === 8)) {
var message = 'Hex string must be in the format "#ffffff" or "ffffff"';
throw IllegalArgumentException_init_$Create$(toString(message));
}
return _this__u8e3s4;
}
function get_hexLength(_this__u8e3s4) {
return startsWith(_this__u8e3s4, '#') ? _this__u8e3s4.length - 1 | 0 : _this__u8e3s4.length;
}
function get_SRGB_R() {
_init_properties_RGBColorSpaces_kt__nc9fsz();
return SRGB_R;
}
var SRGB_R;
function get_SRGB_G() {
_init_properties_RGBColorSpaces_kt__nc9fsz();
return SRGB_G;
}
var SRGB_G;
function get_SRGB_B() {
_init_properties_RGBColorSpaces_kt__nc9fsz();
return SRGB_B;
}
var SRGB_B;
function get_ACES_WHITE_POINT() {
_init_properties_RGBColorSpaces_kt__nc9fsz();
return ACES_WHITE_POINT;
}
var ACES_WHITE_POINT;
function get_ACES_AP0_R() {
_init_properties_RGBColorSpaces_kt__nc9fsz();
return ACES_AP0_R;
}
var ACES_AP0_R;
function get_ACES_AP0_G() {
_init_properties_RGBColorSpaces_kt__nc9fsz();
return ACES_AP0_G;
}
var ACES_AP0_G;
function get_ACES_AP0_B() {
_init_properties_RGBColorSpaces_kt__nc9fsz();
return ACES_AP0_B;
}
var ACES_AP0_B;
function get_ACES_AP1_R() {
_init_properties_RGBColorSpaces_kt__nc9fsz();
return ACES_AP1_R;
}
var ACES_AP1_R;
function get_ACES_AP1_G() {
_init_properties_RGBColorSpaces_kt__nc9fsz();
return ACES_AP1_G;
}
var ACES_AP1_G;
function get_ACES_AP1_B() {
_init_properties_RGBColorSpaces_kt__nc9fsz();
return ACES_AP1_B;
}
var ACES_AP1_B;
function RGBColorSpaces$SRGB$lambda($this$RGBColorSpaceImpl, it) {
return it.v1j();
}
function RGBColorSpaces$BT2020$lambda($this$RGBColorSpaceImpl, color) {
var tmp;
if (color instanceof RGB) {
tmp = color.v1m($this$RGBColorSpaceImpl);
} else {
if (color instanceof ICtCp) {
tmp = color.n1l();
} else {
tmp = color.w1j().b1n($this$RGBColorSpaceImpl);
}
}
return tmp;
}
function RGBColorSpaces() {
RGBColorSpaces_instance = this;
var tmp = this;
var tmp_0 = Illuminant_getInstance().n1k_1;
var tmp_1 = SRGBTransferFunctions_instance;
var tmp_2 = get_SRGB_R();
var tmp_3 = get_SRGB_G();
var tmp_4 = get_SRGB_B();
tmp.o1l_1 = new RGBColorSpaceImpl('sRGB', tmp_0, tmp_1, tmp_2, tmp_3, tmp_4, RGBColorSpaces$SRGB$lambda);
this.p1l_1 = RGBColorSpace_0('Linear sRGB', Illuminant_getInstance().n1k_1, LinearTransferFunctions_instance, get_SRGB_R(), get_SRGB_G(), get_SRGB_B());
this.q1l_1 = RGBColorSpace_0('ACES2065-1', get_ACES_WHITE_POINT(), LinearTransferFunctions_instance, get_ACES_AP0_R(), get_ACES_AP0_G(), get_ACES_AP0_B());
this.r1l_1 = RGBColorSpace_0('ACEScc', get_ACES_WHITE_POINT(), ACESccTransferFunctions_getInstance(), get_ACES_AP1_R(), get_ACES_AP1_G(), get_ACES_AP1_B());
this.s1l_1 = RGBColorSpace_0('ACEScct', get_ACES_WHITE_POINT(), ACEScctTransferFunctions_getInstance(), get_ACES_AP1_R(), get_ACES_AP1_G(), get_ACES_AP1_B());
this.t1l_1 = RGBColorSpace_0('ACEScg', get_ACES_WHITE_POINT(), LinearTransferFunctions_instance, get_ACES_AP1_R(), get_ACES_AP1_G(), get_ACES_AP1_B());
this.u1l_1 = RGBColorSpace_0('Adobe RGB', Illuminant_getInstance().n1k_1, new GammaTransferFunctions(2.19921875), xyY_init_$Create$(0.64, 0.33), xyY_init_$Create$(0.21, 0.71), xyY_init_$Create$(0.15, 0.06));
var tmp_5 = this;
var tmp_6 = Illuminant_getInstance().n1k_1;
var tmp_7 = BT2020TransferFunctions_getInstance();
var tmp_8 = xyY_init_$Create$(0.708, 0.292);
var tmp_9 = xyY_init_$Create$(0.17, 0.797);
var tmp_10 = xyY_init_$Create$(0.131, 0.046);
tmp_5.v1l_1 = new RGBColorSpaceImpl('BT.2020', tmp_6, tmp_7, tmp_8, tmp_9, tmp_10, RGBColorSpaces$BT2020$lambda);
this.w1l_1 = RGBColorSpace_0('BT.709', Illuminant_getInstance().n1k_1, BT709TransferFunctions_getInstance(), xyY_init_$Create$(0.64, 0.33), xyY_init_$Create$(0.3, 0.6), xyY_init_$Create$(0.15, 0.06));
this.x1l_1 = RGBColorSpace_0('DCI P3', new WhitePoint('DCI P3', xyY_init_$Create$(0.314, 0.351)), new GammaTransferFunctions(2.6), xyY_init_$Create$(0.68, 0.32), xyY_init_$Create$(0.265, 0.69), xyY_init_$Create$(0.15, 0.06));
this.y1l_1 = RGBColorSpace_0('Display P3', Illuminant_getInstance().n1k_1, SRGBTransferFunctions_instance, xyY_init_$Create$(0.68, 0.32), xyY_init_$Create$(0.265, 0.69), xyY_init_$Create$(0.15, 0.06));
this.z1l_1 = RGBColorSpace_0('ROMM RGB', Illuminant_getInstance().l1k_1, ROMMTransferFunctions_instance, xyY_init_$Create$(0.7347, 0.2653), xyY_init_$Create$(0.1596, 0.8404), xyY_init_$Create$(0.0366, 1.0E-4));
}
var RGBColorSpaces_instance;
function RGBColorSpaces_getInstance() {
if (RGBColorSpaces_instance == null)
new RGBColorSpaces();
return RGBColorSpaces_instance;
}
function SRGB() {
SRGB_instance = this;
this.i1l_1 = RGBColorSpaces_getInstance().o1l_1;
}
protoOf(SRGB).h1l = function (r, g, b, alpha) {
return this.i1l_1.h1l(r, g, b, alpha);
};
protoOf(SRGB).m1m = function (r, g, b, alpha) {
return this.i1l_1.m1m(r, g, b, alpha);
};
protoOf(SRGB).o1m = function (hex) {
return this.i1l_1.o1m(hex);
};
protoOf(SRGB).n1m = function (r, g, b, alpha) {
return this.i1l_1.n1m(r, g, b, alpha);
};
protoOf(SRGB).a1m = function () {
return this.i1l_1.a1m();
};
protoOf(SRGB).p1m = function () {
return this.i1l_1.p1m();
};
protoOf(SRGB).q1m = function () {
return this.i1l_1.q1m();
};
protoOf(SRGB).r1m = function () {
return this.i1l_1.r1m();
};
protoOf(SRGB).c13 = function () {
return this.i1l_1.c13();
};
protoOf(SRGB).t1k = function () {
return this.i1l_1.t1k();
};
protoOf(SRGB).equals = function (other) {
return equals(RGBColorSpaces_getInstance().o1l_1, other);
};
protoOf(SRGB).hashCode = function () {
return hashCode(RGBColorSpaces_getInstance().o1l_1);
};
protoOf(SRGB).toString = function () {
return 'sRGB';
};
var SRGB_instance;
function SRGB_getInstance() {
if (SRGB_instance == null)
new SRGB();
return SRGB_instance;
}
function RGBColorSpaceImpl(name, whitePoint, transferFunctions, r, g, b, convertImpl) {
this.h1n_1 = name;
this.i1n_1 = whitePoint;
this.j1n_1 = transferFunctions;
this.k1n_1 = r;
this.l1n_1 = g;
this.m1n_1 = b;
this.n1n_1 = convertImpl;
this.o1n_1 = zeroOneComponentInfo('RGB');
this.p1n_1 = _Matrix___get_rowMajor__impl__vmgxkq(rgbToXyzMatrix(this.i1n_1, this.k1n_1, this.l1n_1, this.m1n_1));
this.q1n_1 = _Matrix___get_rowMajor__impl__vmgxkq(inverse(_Matrix___init__impl__q3kp4w(this.p1n_1)));
}
protoOf(RGBColorSpaceImpl).c13 = function () {
return this.h1n_1;
};
protoOf(RGBColorSpaceImpl).r1m = function () {
return this.i1n_1;
};
protoOf(RGBColorSpaceImpl).a1m = function () {
return this.j1n_1;
};
protoOf(RGBColorSpaceImpl).t1k = function () {
return this.o1n_1;
};
protoOf(RGBColorSpaceImpl).p1m = function () {
return this.p1n_1;
};
protoOf(RGBColorSpaceImpl).q1m = function () {
return this.q1n_1;
};
protoOf(RGBColorSpaceImpl).toString = function () {
return this.h1n_1;
};
protoOf(RGBColorSpaceImpl).h1l = function (r, g, b, alpha) {
return new RGB(r, g, b, alpha, this);
};
protoOf(RGBColorSpaceImpl).equals = function (other) {
if (this === other)
return true;
if (!(!(other == null) ? isInterface(other, RGBColorSpace) : false))
return false;
if (!(this.h1n_1 === other.c13()))
return false;
if (!this.i1n_1.equals(other.r1m()))
return false;
if (!equals(this.j1n_1, other.a1m()))
return false;
if (other instanceof RGBColorSpaceImpl) {
if (!this.k1n_1.equals(other.k1n_1))
return false;
if (!this.l1n_1.equals(other.l1n_1))
return false;
if (!this.m1n_1.equals(other.m1n_1))
return false;
} else {
if (!contentEquals(this.p1n_1, other.p1m()))
return false;
if (!contentEquals(this.q1n_1, other.q1m()))
return false;
}
return true;
};
protoOf(RGBColorSpaceImpl).hashCode = function () {
var result = getStringHashCode(this.h1n_1);
result = imul(31, result) + this.i1n_1.hashCode() | 0;
result = imul(31, result) + hashCode(this.j1n_1) | 0;
result = imul(31, result) + this.k1n_1.hashCode() | 0;
result = imul(31, result) + this.l1n_1.hashCode() | 0;
result = imul(31, result) + this.m1n_1.hashCode() | 0;
return result;
};
function SRGBTransferFunctions() {
}
protoOf(SRGBTransferFunctions).k1m = function (x) {
return x <= 0.0031308 ? x * 12.92 : 1.055 * spow(x, 1 / 2.4) - 0.055;
};
protoOf(SRGBTransferFunctions).j1m = function (x) {
return x <= 0.04045 ? x / 12.92 : spow_0((x + 0.055) / 1.055, 2.4);
};
var SRGBTransferFunctions_instance;
function SRGBTransferFunctions_getInstance() {
return SRGBTransferFunctions_instance;
}
function RGBColorSpace_0(name, whitePoint, transferFunctions, r, g, b) {
_init_properties_RGBColorSpaces_kt__nc9fsz();
return new RGBColorSpaceImpl(name, whitePoint, transferFunctions, r, g, b, RGBColorSpace$lambda);
}
function ACESccTransferFunctions() {
ACESccTransferFunctions_instance = this;
this.r1n_1 = 3.0517578125E-5;
this.s1n_1 = 1.52587890625E-5;
this.t1n_1 = -0.3013698630136986;
var tmp = this;
// Inline function 'kotlin.math.log2' call
tmp.u1n_1 = (log2(65504.0) + 9.72) / 17.52;
}
protoOf(ACESccTransferFunctions).j1m = function (x) {
var tmp;
if (x <= -0.3013698630136986) {
tmp = (spow_0(2.0, x * 17.52 - 9.72) - 1.52587890625E-5) * 2.0;
} else if (x < this.u1n_1) {
// Inline function 'k