git-digger
Version:
 
1,248 lines (1,247 loc) • 64.3 kB
JavaScript
(function (_, kotlin_kotlin) {
'use strict';
//region block: imports
var imul = Math.imul;
var log2 = Math.log2;
var protoOf = kotlin_kotlin.$_$.r8;
var initMetadataForInterface = kotlin_kotlin.$_$.v7;
var toString = kotlin_kotlin.$_$.u8;
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.d1;
var Unit_instance = kotlin_kotlin.$_$.j3;
var initMetadataForClass = kotlin_kotlin.$_$.s7;
var getStringHashCode = kotlin_kotlin.$_$.q7;
var THROW_CCE = kotlin_kotlin.$_$.zb;
var initMetadataForObject = kotlin_kotlin.$_$.x7;
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.l;
var charSequenceLength = kotlin_kotlin.$_$.j7;
var charSequenceGet = kotlin_kotlin.$_$.i7;
var toString_0 = kotlin_kotlin.$_$.t1;
var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.q1;
var arrayConcat = kotlin_kotlin.$_$.a;
var listOf = kotlin_kotlin.$_$.j5;
var withSign = kotlin_kotlin.$_$.w8;
var trimMargin = kotlin_kotlin.$_$.hb;
var hashCode = kotlin_kotlin.$_$.r7;
var equals = kotlin_kotlin.$_$.m7;
var VOID = kotlin_kotlin.$_$.g;
var initMetadataForCompanion = kotlin_kotlin.$_$.t7;
var coerceAtLeast = kotlin_kotlin.$_$.x8;
var getNumberHashCode = kotlin_kotlin.$_$.o7;
var numberToDouble = kotlin_kotlin.$_$.n8;
var roundToInt = kotlin_kotlin.$_$.v8;
var coerceIn = kotlin_kotlin.$_$.b9;
var Char = kotlin_kotlin.$_$.nb;
var toInt = kotlin_kotlin.$_$.fb;
var numberRangeToNumber = kotlin_kotlin.$_$.l8;
var slice = kotlin_kotlin.$_$.wa;
var startsWith = kotlin_kotlin.$_$.ya;
var isInterface = kotlin_kotlin.$_$.g8;
var contentEquals = kotlin_kotlin.$_$.j4;
var coerceAtLeast_0 = kotlin_kotlin.$_$.z8;
var objectCreate = kotlin_kotlin.$_$.q8;
//endregion
//region block: pre-declaration
function toXYZ() {
return this.b1z().c1z();
}
initMetadataForInterface(Color, 'Color');
initMetadataForClass(ColorComponentInfo, 'ColorComponentInfo');
initMetadataForClass(WhitePoint, 'WhitePoint');
initMetadataForObject(Illuminant, 'Illuminant');
initMetadataForClass(Matrix, 'Matrix');
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.m20(r, g, b, alpha) : $super.m20.call(this, r, g, b, alpha);
}
function invoke(r, g, b, alpha) {
return this.m20(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.r21(r, g, b, alpha) : invoke(r, g, b, alpha);
}
function from255(r, g, b, alpha) {
return this.m20(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.s21(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.s21(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.i1z_1 = name;
this.j1z_1 = isPolar;
this.k1z_1 = min;
this.l1z_1 = max;
// Inline function 'kotlin.require' call
if (!(this.k1z_1 <= this.l1z_1)) {
var message = 'min must be less than or equal to max';
throw IllegalArgumentException_init_$Create$(toString(message));
}
}
function WhitePoint(name, chromaticity) {
this.m1z_1 = name;
this.n1z_1 = chromaticity;
}
protoOf(WhitePoint).toString = function () {
return this.m1z_1;
};
protoOf(WhitePoint).hashCode = function () {
var result = getStringHashCode(this.m1z_1);
result = imul(result, 31) + this.n1z_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.m1z_1 === tmp0_other_with_cast.m1z_1))
return false;
if (!this.n1z_1.equals(tmp0_other_with_cast.n1z_1))
return false;
return true;
};
function Illuminant() {
Illuminant_instance = this;
this.o1z_1 = new WhitePoint('A', xyY_init_$Create$(0.44758, 0.40745));
this.p1z_1 = new WhitePoint('B', xyY_init_$Create$(0.34842, 0.35161));
this.q1z_1 = new WhitePoint('C', xyY_init_$Create$(0.31006, 0.31616));
this.r1z_1 = new WhitePoint('D50', xyY_init_$Create$(0.3457, 0.3585));
this.s1z_1 = new WhitePoint('D55', xyY_init_$Create$(0.33243, 0.34744));
this.t1z_1 = new WhitePoint('D65', xyY_init_$Create$(0.3127, 0.329));
this.u1z_1 = new WhitePoint('D75', xyY_init_$Create$(0.29903, 0.31488));
this.v1z_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.c5();
}
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.c5();
}
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.w1z_1 : THROW_CCE();
if (!equals($this, tmp0_other_with_cast))
return false;
return true;
}
function Matrix(rowMajor) {
this.w1z_1 = rowMajor;
}
protoOf(Matrix).toString = function () {
return Matrix__toString_impl_l0abk0(this.w1z_1);
};
protoOf(Matrix).hashCode = function () {
return Matrix__hashCode_impl_s9ntm9(this.w1z_1);
};
protoOf(Matrix).equals = function (other) {
return Matrix__equals_impl_g5p8p9(this.w1z_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 dot_0(_this__u8e3s4, v0, v1, v2) {
// Inline function 'com.github.ajalt.colormath.internal.dot' call
var tmp4 = 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 tmp5 = 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(tmp4, tmp5, 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.x1z_1 = componentInfoList([new ColorComponentInfo('code', false, 30.0, 107.0)]);
}
protoOf(Companion).y1z = function () {
return this.x1z_1;
};
var Companion_instance;
function Companion_getInstance() {
if (Companion_instance == null)
new Companion();
return Companion_instance;
}
function Ansi16(code) {
Companion_getInstance();
this.z1z_1 = code;
}
protoOf(Ansi16).a1z = function () {
return Companion_getInstance();
};
protoOf(Ansi16).b1z = function () {
switch (this.z1z_1) {
case 30:
case 40:
return Companion_getInstance_2().a20(0.0, 0.0, 0.0);
case 90:
case 100:
return Companion_getInstance_2().b20(128, 128, 128);
case 37:
case 47:
return Companion_getInstance_2().b20(192, 192, 192);
case 97:
case 107:
return Companion_getInstance_2().a20(1.0, 1.0, 1.0);
}
var color = this.z1z_1 % 10 | 0;
var mul = this.z1z_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().a20(r, g, b);
};
protoOf(Ansi16).toString = function () {
return 'Ansi16(code=' + this.z1z_1 + ')';
};
protoOf(Ansi16).hashCode = function () {
return this.z1z_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.z1z_1 === tmp0_other_with_cast.z1z_1))
return false;
return true;
};
function Companion_0() {
Companion_instance_0 = this;
this.c20_1 = componentInfoList([new ColorComponentInfo('code', false, 0.0, 255.0)]);
}
protoOf(Companion_0).y1z = function () {
return this.c20_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.d20_1 = code;
}
protoOf(Ansi256).a1z = function () {
return Companion_getInstance_0();
};
protoOf(Ansi256).b1z = function () {
if (this.d20_1 < 16)
return this.e20().b1z();
if (this.d20_1 >= 232) {
var c = imul(this.d20_1 - 232 | 0, 10) + 8 | 0;
return Companion_getInstance_2().b20(c, c, c);
}
var c_0 = this.d20_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().f20(r, g, b);
};
protoOf(Ansi256).e20 = function () {
return this.d20_1 < 8 ? new Ansi16(this.d20_1 + 30 | 0) : this.d20_1 < 16 ? new Ansi16((this.d20_1 - 8 | 0) + 90 | 0) : this.b1z().e20();
};
protoOf(Ansi256).toString = function () {
return 'Ansi256(code=' + this.d20_1 + ')';
};
protoOf(Ansi256).hashCode = function () {
return this.d20_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.d20_1 === tmp0_other_with_cast.d20_1))
return false;
return true;
};
function Companion_1() {
Companion_instance_1 = this;
this.g20_1 = polarComponentInfo('HSV', 0.0, 1.0);
}
protoOf(Companion_1).y1z = function () {
return this.g20_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.h20_1 = h;
this.i20_1 = s;
this.j20_1 = v;
this.k20_1 = alpha;
}
protoOf(HSV).a1z = function () {
return Companion_getInstance_1();
};
protoOf(HSV).b1z = function () {
if (this.i20_1 < 1.0E-7)
return Companion_getInstance_2().m20(this.j20_1, this.j20_1, this.j20_1, this.k20_1);
var v = this.j20_1;
var h = normalizeDeg_0(this.h20_1) / 60.0;
var s = this.i20_1;
return SRGB_getInstance().m20(toSRGB$f(h, v, s, 5), toSRGB$f(h, v, s, 3), toSRGB$f(h, v, s, 1), this.k20_1);
};
protoOf(HSV).toString = function () {
return 'HSV(h=' + this.h20_1 + ', s=' + this.i20_1 + ', v=' + this.j20_1 + ', alpha=' + this.k20_1 + ')';
};
protoOf(HSV).hashCode = function () {
var result = getNumberHashCode(this.h20_1);
result = imul(result, 31) + getNumberHashCode(this.i20_1) | 0;
result = imul(result, 31) + getNumberHashCode(this.j20_1) | 0;
result = imul(result, 31) + getNumberHashCode(this.k20_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.h20_1, tmp0_other_with_cast.h20_1))
return false;
if (!equals(this.i20_1, tmp0_other_with_cast.i20_1))
return false;
if (!equals(this.j20_1, tmp0_other_with_cast.j20_1))
return false;
if (!equals(this.k20_1, tmp0_other_with_cast.k20_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).s20 = function () {
var fo = RGBColorSpaces_getInstance().a21_1.f21();
var tmp0 = get_ICTCP_ICTCP_to_LMS();
var tmp1 = this.o20_1;
var tmp2 = this.p20_1;
// Inline function 'com.github.ajalt.colormath.internal.dot' call
var v2 = this.q20_1;
var tmp4 = Matrix__get_impl_xogbpk(tmp0, 0, 0) * tmp1 + Matrix__get_impl_xogbpk(tmp0, 1, 0) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 2, 0) * v2;
var tmp5 = Matrix__get_impl_xogbpk(tmp0, 0, 1) * tmp1 + Matrix__get_impl_xogbpk(tmp0, 1, 1) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 2, 1) * v2;
var s = Matrix__get_impl_xogbpk(tmp0, 0, 2) * tmp1 + Matrix__get_impl_xogbpk(tmp0, 1, 2) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 2, 2) * v2;
var tmp0_0 = get_ICTCP_LMS_to_RGB();
var tmp1_0 = PqNonlinearity_instance.o21(tmp4);
var tmp2_0 = PqNonlinearity_instance.o21(tmp5);
// Inline function 'com.github.ajalt.colormath.internal.dot' call
var v2_0 = PqNonlinearity_instance.o21(s);
var tmp4_0 = Matrix__get_impl_xogbpk(tmp0_0, 0, 0) * tmp1_0 + Matrix__get_impl_xogbpk(tmp0_0, 1, 0) * tmp2_0 + Matrix__get_impl_xogbpk(tmp0_0, 2, 0) * v2_0;
var tmp5_0 = Matrix__get_impl_xogbpk(tmp0_0, 0, 1) * tmp1_0 + Matrix__get_impl_xogbpk(tmp0_0, 1, 1) * tmp2_0 + Matrix__get_impl_xogbpk(tmp0_0, 2, 1) * v2_0;
var b = Matrix__get_impl_xogbpk(tmp0_0, 0, 2) * tmp1_0 + Matrix__get_impl_xogbpk(tmp0_0, 1, 2) * tmp2_0 + Matrix__get_impl_xogbpk(tmp0_0, 2, 2) * v2_0;
return RGBColorSpaces_getInstance().a21_1.m20(fo.p21(tmp4_0), fo.p21(tmp5_0), fo.p21(b), this.r20_1);
};
function PqNonlinearity() {
this.g21_1 = 0.1593017578125;
this.h21_1 = 78.84375;
this.i21_1 = 0.8359375;
this.j21_1 = 18.8515625;
this.k21_1 = 18.6875;
this.l21_1 = 10000.0;
this.m21_1 = 6.277394636015326;
this.n21_1 = 0.012683313515655966;
}
protoOf(PqNonlinearity).o21 = 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).p21 = 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.q21_1 = gamma;
}
protoOf(GammaTransferFunctions).o21 = function (x) {
return spow(x, this.q21_1);
};
protoOf(GammaTransferFunctions).p21 = function (x) {
return spow(x, 1.0 / this.q21_1);
};
protoOf(GammaTransferFunctions).toString = function () {
return 'GammaTransferFunctions(gamma=' + this.q21_1 + ')';
};
protoOf(GammaTransferFunctions).hashCode = function () {
return getNumberHashCode(this.q21_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.q21_1, tmp0_other_with_cast.q21_1))
return false;
return true;
};
function LinearTransferFunctions() {
}
protoOf(LinearTransferFunctions).o21 = function (x) {
return x;
};
protoOf(LinearTransferFunctions).p21 = function (x) {
return x;
};
var LinearTransferFunctions_instance;
function LinearTransferFunctions_getInstance() {
return LinearTransferFunctions_instance;
}
function RGBColorSpace() {
}
function Companion_2() {
Companion_instance_2 = this;
this.l20_1 = RGBColorSpaces_getInstance().t20_1;
}
protoOf(Companion_2).m20 = function (r, g, b, alpha) {
return this.l20_1.m20(r, g, b, alpha);
};
protoOf(Companion_2).r21 = function (r, g, b, alpha) {
return this.l20_1.r21(r, g, b, alpha);
};
protoOf(Companion_2).t21 = function (hex) {
return this.l20_1.t21(hex);
};
protoOf(Companion_2).s21 = function (r, g, b, alpha) {
return this.l20_1.s21(r, g, b, alpha);
};
protoOf(Companion_2).f21 = function () {
return this.l20_1.f21();
};
protoOf(Companion_2).u21 = function () {
return this.l20_1.u21();
};
protoOf(Companion_2).v21 = function () {
return this.l20_1.v21();
};
protoOf(Companion_2).w21 = function () {
return this.l20_1.w21();
};
protoOf(Companion_2).u15 = function () {
return this.l20_1.u15();
};
protoOf(Companion_2).y1z = function () {
return this.l20_1.y1z();
};
protoOf(Companion_2).equals = function (other) {
return equals(RGBColorSpaces_getInstance().t20_1, other);
};
protoOf(Companion_2).hashCode = function () {
return hashCode(RGBColorSpaces_getInstance().t20_1);
};
var Companion_instance_2;
function Companion_getInstance_2() {
if (Companion_instance_2 == null)
new Companion_2();
return Companion_instance_2;
}
function clamp$copy(receiver, p0, p1, p2, p3) {
return receiver.x21(p0, p1, p2, p3);
}
function RGB(r, g, b, alpha, space) {
Companion_getInstance_2();
this.d1z_1 = r;
this.e1z_1 = g;
this.f1z_1 = b;
this.g1z_1 = alpha;
this.h1z_1 = space;
}
protoOf(RGB).a1z = function () {
return this.h1z_1;
};
protoOf(RGB).y21 = function () {
// Inline function 'kotlin.math.roundToInt' call
var this_0 = this.d1z_1 * 255;
return roundToInt(this_0);
};
protoOf(RGB).z21 = function () {
// Inline function 'kotlin.math.roundToInt' call
var this_0 = this.e1z_1 * 255;
return roundToInt(this_0);
};
protoOf(RGB).a22 = function () {
// Inline function 'kotlin.math.roundToInt' call
var this_0 = this.f1z_1 * 255;
return roundToInt(this_0);
};
protoOf(RGB).b22 = function (space) {
var f = SRGB_getInstance().f21();
return equals(this.h1z_1, space) ? this : equals(this.h1z_1, SRGB_getInstance()) && equals(space, RGBColorSpaces_getInstance().u20_1) ? space.m20(f.o21(this.d1z_1), f.o21(this.e1z_1), f.o21(this.f1z_1), this.g1z_1) : equals(this.h1z_1, RGBColorSpaces_getInstance().u20_1) && equals(space, SRGB_getInstance()) ? space.m20(f.p21(this.d1z_1), f.p21(this.e1z_1), f.p21(this.f1z_1), this.g1z_1) : this.c1z().h22(space);
};
protoOf(RGB).i22 = 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.b22(SRGB_getInstance());
var r = $this$toSRGB.d1z_1;
var g = $this$toSRGB.e1z_1;
var b = $this$toSRGB.f1z_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.g1z_1);
break $l$block;
}
return tmp$ret$3;
};
protoOf(RGB).c1z = function () {
var f = this.h1z_1.f21();
var tmp0 = _Matrix___init__impl__q3kp4w(this.h1z_1.u21());
var tmp1 = f.o21(this.d1z_1);
var tmp2 = f.o21(this.e1z_1);
// Inline function 'com.github.ajalt.colormath.internal.dot' call
var v2 = f.o21(this.f1z_1);
var tmp4 = Matrix__get_impl_xogbpk(tmp0, 0, 0) * tmp1 + Matrix__get_impl_xogbpk(tmp0, 1, 0) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 2, 0) * v2;
var tmp5 = Matrix__get_impl_xogbpk(tmp0, 0, 1) * tmp1 + Matrix__get_impl_xogbpk(tmp0, 1, 1) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 2, 1) * v2;
var z = Matrix__get_impl_xogbpk(tmp0, 0, 2) * tmp1 + Matrix__get_impl_xogbpk(tmp0, 1, 2) * tmp2 + Matrix__get_impl_xogbpk(tmp0, 2, 2) * v2;
return XYZColorSpace_0(this.h1z_1.w21()).m20(tmp4, tmp5, z, this.g1z_1);
};
protoOf(RGB).e20 = function () {
// Inline function 'com.github.ajalt.colormath.model.RGB.toSRGB' call
var $this$toSRGB = this.b22(SRGB_getInstance());
// Inline function 'kotlin.math.roundToInt' call
var this_0 = $this$toSRGB.i22().j20_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.f1z_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.e1z_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.d1z_1;
var ansi = 30 + (tmp_0 | roundToInt(this_3)) | 0;
return new Ansi16(v === 2 ? ansi + 60 | 0 : ansi);
};
protoOf(RGB).j22 = function () {
// Inline function 'com.github.ajalt.colormath.model.RGB.toSRGB' call
var $this$toSRGB = this.b22(SRGB_getInstance());
var ri = $this$toSRGB.y21();
var gi = $this$toSRGB.z21();
var bi = $this$toSRGB.a22();
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.d1z_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.e1z_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.f1z_1 * 5;
tmp = tmp_1 + roundToInt(this_2) | 0;
}
var code = tmp;
return new Ansi256(code);
};
protoOf(RGB).b1z = function () {
return this.b22(RGBColorSpaces_getInstance().t20_1);
};
protoOf(RGB).k22 = function () {
var tmp1 = this.d1z_1;
var tmp2 = this.e1z_1;
var tmp3 = this.f1z_1;
// Inline function 'com.github.ajalt.colormath.internal.clamp3' call
var alpha = this.g1z_1;
var _destruct__k2r9zo = this.a1z().y1z();
// Inline function 'kotlin.collections.component1' call
var c1 = _destruct__k2r9zo.t(0);
// Inline function 'kotlin.collections.component2' call
var c2 = _destruct__k2r9zo.t(1);
// Inline function 'kotlin.collections.component3' call
var c3 = _destruct__k2r9zo.t(2);
var tmp;
var tmp_0;
var tmp_1;
var tmp_2;
var containsLower = c1.k1z_1;
if (tmp1 <= c1.l1z_1 ? containsLower <= tmp1 : false) {
var containsLower_0 = c2.k1z_1;
tmp_2 = tmp2 <= c2.l1z_1 ? containsLower_0 <= tmp2 : false;
} else {
tmp_2 = false;
}
if (tmp_2) {
var containsLower_1 = c3.k1z_1;
tmp_1 = tmp3 <= c3.l1z_1 ? containsLower_1 <= tmp3 : 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 {
tmp = clamp$copy(this, coerceIn(tmp1, c1.k1z_1, c1.l1z_1), coerceIn(tmp2, c2.k1z_1, c2.l1z_1), coerceIn(tmp3, c3.k1z_1, c3.l1z_1), coerceIn(alpha, 0.0, 1.0));
}
return tmp;
};
protoOf(RGB).l22 = function (r, g, b, alpha, space) {
return new RGB(r, g, b, alpha, space);
};
protoOf(RGB).x21 = function (r, g, b, alpha, space, $super) {
r = r === VOID ? this.d1z_1 : r;
g = g === VOID ? this.e1z_1 : g;
b = b === VOID ? this.f1z_1 : b;
alpha = alpha === VOID ? this.g1z_1 : alpha;
space = space === VOID ? this.h1z_1 : space;
return $super === VOID ? this.l22(r, g, b, alpha, space) : $super.l22.call(this, r, g, b, alpha, space);
};
protoOf(RGB).toString = function () {
return 'RGB(r=' + this.d1z_1 + ', g=' + this.e1z_1 + ', b=' + this.f1z_1 + ', alpha=' + this.g1z_1 + ', space=' + toString(this.h1z_1) + ')';
};
protoOf(RGB).hashCode = function () {
var result = getNumberHashCode(this.d1z_1);
result = imul(result, 31) + getNumberHashCode(this.e1z_1) | 0;
result = imul(result, 31) + getNumberHashCode(this.f1z_1) | 0;
result = imul(result, 31) + getNumberHashCode(this.g1z_1) | 0;
result = imul(result, 31) + hashCode(this.h1z_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.d1z_1, tmp0_other_with_cast.d1z_1))
return false;
if (!equals(this.e1z_1, tmp0_other_with_cast.e1z_1))
return false;
if (!equals(this.f1z_1, tmp0_other_with_cast.f1z_1))
return false;
if (!equals(this.g1z_1, tmp0_other_with_cast.g1z_1))
return false;
if (!equals(this.h1z_1, tmp0_other_with_cast.h1z_1))
return false;
return true;
};
function parseHex(_this__u8e3s4, startIndex) {
var tmp;
if (get_hexLength(_this__u8e3s4) > 4) {
var i = charSequenceGet(_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 = charSequenceGet(_this__u8e3s4, 0) === _Char___init__impl__6a9atx(35) ? startIndex + 1 | 0 : startIndex;
// Inline function 'kotlin.let' call
var it = charSequenceGet(_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.b1z();
}
function RGBColorSpaces$BT2020$lambda($this$RGBColorSpaceImpl, color) {
var tmp;
if (color instanceof RGB) {
tmp = color.b22($this$RGBColorSpaceImpl);
} else {
if (color instanceof ICtCp) {
tmp = color.s20();
} else {
tmp = color.c1z().h22($this$RGBColorSpaceImpl);
}
}
return tmp;
}
function RGBColorSpaces() {
RGBColorSpaces_instance = this;
var tmp = this;
var tmp_0 = Illuminant_getInstance().t1z_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.t20_1 = new RGBColorSpaceImpl('sRGB', tmp_0, tmp_1, tmp_2, tmp_3, tmp_4, RGBColorSpaces$SRGB$lambda);
this.u20_1 = RGBColorSpace_0('Linear sRGB', Illuminant_getInstance().t1z_1, LinearTransferFunctions_instance, get_SRGB_R(), get_SRGB_G(), get_SRGB_B());
this.v20_1 = RGBColorSpace_0('ACES2065-1', get_ACES_WHITE_POINT(), LinearTransferFunctions_instance, get_ACES_AP0_R(), get_ACES_AP0_G(), get_ACES_AP0_B());
this.w20_1 = RGBColorSpace_0('ACEScc', get_ACES_WHITE_POINT(), ACESccTransferFunctions_getInstance(), get_ACES_AP1_R(), get_ACES_AP1_G(), get_ACES_AP1_B());
this.x20_1 = RGBColorSpace_0('ACEScct', get_ACES_WHITE_POINT(), ACEScctTransferFunctions_getInstance(), get_ACES_AP1_R(), get_ACES_AP1_G(), get_ACES_AP1_B());
this.y20_1 = RGBColorSpace_0('ACEScg', get_ACES_WHITE_POINT(), LinearTransferFunctions_instance, get_ACES_AP1_R(), get_ACES_AP1_G(), get_ACES_AP1_B());
this.z20_1 = RGBColorSpace_0('Adobe RGB', Illuminant_getInstance().t1z_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().t1z_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.a21_1 = new RGBColorSpaceImpl('BT.2020', tmp_6, tmp_7, tmp_8, tmp_9, tmp_10, RGBColorSpaces$BT2020$lambda);
this.b21_1 = RGBColorSpace_0('BT.709', Illuminant_getInstance().t1z_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.c21_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.d21_1 = RGBColorSpace_0('Display P3', Illuminant_getInstance().t1z_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.e21_1 = RGBColorSpace_0('ROMM RGB', Illuminant_getInstance().r1z_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.n20_1 = RGBColorSpaces_getInstance().t20_1;
}
protoOf(SRGB).m20 = function (r, g, b, alpha) {
return this.n20_1.m20(r, g, b, alpha);
};
protoOf(SRGB).r21 = function (r, g, b, alpha) {
return this.n20_1.r21(r, g, b, alpha);
};
protoOf(SRGB).t21 = function (hex) {
return this.n20_1.t21(hex);
};
protoOf(SRGB).s21 = function (r, g, b, alpha) {
return this.n20_1.s21(r, g, b, alpha);
};
protoOf(SRGB).f21 = function () {
return this.n20_1.f21();
};
protoOf(SRGB).u21 = function () {
return this.n20_1.u21();
};
protoOf(SRGB).v21 = function () {
return this.n20_1.v21();
};
protoOf(SRGB).w21 = function () {
return this.n20_1.w21();
};
protoOf(SRGB).u15 = function () {
return this.n20_1.u15();
};
protoOf(SRGB).y1z = function () {
return this.n20_1.y1z();
};
protoOf(SRGB).equals = function (other) {
return equals(RGBColorSpaces_getInstance().t20_1, other);
};
protoOf(SRGB).hashCode = function () {
return hashCode(RGBColorSpaces_getInstance().t20_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.m22_1 = name;
this.n22_1 = whitePoint;
this.o22_1 = transferFunctions;
this.p22_1 = r;
this.q22_1 = g;
this.r22_1 = b;
this.s22_1 = convertImpl;
this.t22_1 = zeroOneComponentInfo('RGB');
this.u22_1 = _Matrix___get_rowMajor__impl__vmgxkq(rgbToXyzMatrix(this.n22_1, this.p22_1, this.q22_1, this.r22_1));
this.v22_1 = _Matrix___get_rowMajor__impl__vmgxkq(inverse(_Matrix___init__impl__q3kp4w(this.u22_1)));
}
protoOf(RGBColorSpaceImpl).u15 = function () {
return this.m22_1;
};
protoOf(RGBColorSpaceImpl).w21 = function () {
return this.n22_1;
};
protoOf(RGBColorSpaceImpl).f21 = function () {
return this.o22_1;
};
protoOf(RGBColorSpaceImpl).y1z = function () {
return this.t22_1;
};
protoOf(RGBColorSpaceImpl).u21 = function () {
return this.u22_1;
};
protoOf(RGBColorSpaceImpl).v21 = function () {
return this.v22_1;
};
protoOf(RGBColorSpaceImpl).toString = function () {
return this.m22_1;
};
protoOf(RGBColorSpaceImpl).m20 = 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.m22_1 === other.u15()))
return false;
if (!this.n22_1.equals(other.w21()))
return false;
if (!equals(this.o22_1, other.f21()))
return false;
if (other instanceof RGBColorSpaceImpl) {
if (!this.p22_1.equals(other.p22_1))
return false;
if (!this.q22_1.equals(other.q22_1))
return false;
if (!this.r22_1.equals(other.r22_1))
return false;
} else {
if (!contentEquals(this.u22_1, other.u21()))
return false;
if (!contentEquals(this.v22_1, other.v21()))
return false;
}
return true;
};
protoOf(RGBColorSpaceImpl).hashCode = function () {
var result = getStringHashCode(this.m22_1);
result = imul(31, result) + this.n22_1.hashCode() | 0;
result = imul(31, result) + hashCode(this.o22_1) | 0;
result = imul(31, result) + this.p22_1.hashCode() | 0;
result = imul(31, result) + this.q22_1.hashCode() | 0;
result = imul(31, result) + this.r22_1.hashCode() | 0;
return result;
};
function SRGBTransferFunctions() {
}
protoOf(SRGBTransferFunctions).p21 = function (x) {
return x <= 0.0031308 ? x * 12.92 : 1.055 * spow(x, 1 / 2.4) - 0.055;
};
protoOf(SRGBTransferFunctions).o21 = 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.w22_1 = 3.0517578125E-5;
this.x22_1 = 1.52587890625E-5;
this.y22_1 = -0.3013698630136986;
var tmp = this;
// Inline function 'kotlin.math.log2' call
tmp.z22_1 = (log2(65504.0) + 9.72) / 17.52;
}
protoOf(ACESccTransferFunctions).o21 = 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.z22_1) {
// Inline function 'kotlin.math.pow' call
var x_0 = x * 17.52 - 9.72;
tmp = Math.pow(2.0, x_0);
} else {
tmp = 65504.0;
}
return tmp;
};
protoOf(ACESccTransferFunctions).p21 = function (x) {
var tmp;
if (x < 3.0517578125E-5) {
// Inline function 'kotlin.math.log2' call
var x_0 = 1.52587890625E-5 + coerceAtLeast_0(x, 0.0) / 2.0;
tmp = (log2(x_0) + 9.72) / 17.52;
} else {
// Inline function 'kotlin.math.log2' call
tmp = (log2(x) + 9.72) / 17.52;
}
return tmp;
};
var ACESccTransferFunctions_instance;
function ACESccTransferFunctions_getInstance() {
if (ACESccTransferFunctions_instance == null)
new ACESccTransferFunctions();
return ACESccTransferFunctions_instance;
}
function ACEScctTransferFunctions() {
ACEScctTransferFunctions_instance = this;
this.a23_1 = 10.5402377416545;
this.b23_1 = 0.0729055341958355;