/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { Base, toNullable, Boolean_$type, typeCast, Point_$type, EnumUtil, markType, Number_$type, fromEnum } from "igniteui-angular-core";
import { CT_GroupTransform2D } from "./CT_GroupTransform2D";
import { ST_Angle } from "./ST_Angle";
import { CT_Transform2D } from "./CT_Transform2D";
import { CT_Point2D } from "./CT_Point2D";
import { ExcelUtils } from "./ExcelUtils";
import { ST_CoordinateUnqualified } from "./ST_CoordinateUnqualified";
import { ST_Coordinate } from "./ST_Coordinate";
import { CT_PositiveSize2D } from "./CT_PositiveSize2D";
import { ST_PositiveCoordinate } from "./ST_PositiveCoordinate";
import { ImageHolder } from "./ImageHolder";
import { MemoryStream } from "igniteui-angular-core";
import { ExcelImage } from "./ExcelImage";
import { FillPatternStyle_$type } from "./FillPatternStyle";
import { ST_PatternType_$type } from "./ST_PatternType";
import { ST_HorizontalAlignment_$type } from "./ST_HorizontalAlignment";
import { ST_SystemColorVal_$type } from "./ST_SystemColorVal";
import { Color } from "igniteui-angular-core";
import { SystemColorsInternal } from "./SystemColorsInternal";
import { ST_VerticalAlignment_$type } from "./ST_VerticalAlignment";
import { ColorsInternal } from "./ColorsInternal";
import { WorkbookColorInfo } from "./WorkbookColorInfo";
import { Workbook } from "./Workbook";
import { WorksheetCellAddress } from "./WorksheetCellAddress";
import { Tuple } from "igniteui-angular-core";
import { ST_PresetColorVal_$type } from "./ST_PresetColorVal";
import { wrapNullable, nullableEquals, nullableNotEquals } from "igniteui-angular-core";
import { stringStartsWith } from "igniteui-angular-core";
import { IEG_ColorChoiceVisitor$2_$type } from "./IEG_ColorChoiceVisitor$2";
import { IEG_FillPropertiesVisitor$2_$type } from "./IEG_FillPropertiesVisitor$2";
import { ST_HexColorRGB } from "./ST_HexColorRGB";
import { ColorTransform_LumMod } from "./ColorTransform_LumMod";
import { ColorTransform_LumOff } from "./ColorTransform_LumOff";
import { ST_Percentage } from "./ST_Percentage";
import { WorkbookColorTransform } from "./WorkbookColorTransform";
import { XlsxUtilities_ColorTransformsApplicator } from "./XlsxUtilities_ColorTransformsApplicator";
/**
 * @hidden
 */
var XlsxUtilities = /** @class */ (function (_super) {
    tslib_1.__extends(XlsxUtilities, _super);
    function XlsxUtilities() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    XlsxUtilities.af = function (a) {
        var b = a._getBoundsInTwips();
        return ((function () {
            var $ret = new CT_GroupTransform2D();
            $ret.j = toNullable(ST_Angle.$, ST_Angle.a(a._b6));
            $ret.i = toNullable(Boolean_$type, a.flippedHorizontally);
            $ret.k = toNullable(Boolean_$type, a.flippedVertically);
            $ret.a = ((function () {
                var $ret = new CT_Point2D();
                $ret.a = new ST_Coordinate(1, ST_CoordinateUnqualified.a(ExcelUtils.dm(b.x)));
                $ret.b = new ST_Coordinate(1, ST_CoordinateUnqualified.a(ExcelUtils.dm(b.y)));
                return $ret;
            })());
            $ret.b = ((function () {
                var $ret = new CT_PositiveSize2D();
                $ret.a = new ST_PositiveCoordinate(1, ExcelUtils.dm(b.width));
                $ret.b = new ST_PositiveCoordinate(1, ExcelUtils.dm(b.height));
                return $ret;
            })());
            $ret.l = ((function () {
                var $ret = new CT_Point2D();
                $ret.a = new ST_Coordinate(1, ST_CoordinateUnqualified.a(ExcelUtils.dm(b.x)));
                $ret.b = new ST_Coordinate(1, ST_CoordinateUnqualified.a(ExcelUtils.dm(b.y)));
                return $ret;
            })());
            $ret.m = ((function () {
                var $ret = new CT_PositiveSize2D();
                $ret.a = new ST_PositiveCoordinate(1, ExcelUtils.dm(b.width));
                $ret.b = new ST_PositiveCoordinate(1, ExcelUtils.dm(b.height));
                return $ret;
            })());
            return $ret;
        })());
    };
    XlsxUtilities.ag = function (a) {
        var b = a._getBoundsInTwips();
        return ((function () {
            var $ret = new CT_Transform2D();
            $ret.j = toNullable(ST_Angle.$, ST_Angle.a(a._b6));
            $ret.i = toNullable(Boolean_$type, a.flippedHorizontally);
            $ret.k = toNullable(Boolean_$type, a.flippedVertically);
            $ret.a = ((function () {
                var $ret = new CT_Point2D();
                $ret.a = new ST_Coordinate(1, ST_CoordinateUnqualified.a(ExcelUtils.dm(b.x)));
                $ret.b = new ST_Coordinate(1, ST_CoordinateUnqualified.a(ExcelUtils.dm(b.y)));
                return $ret;
            })());
            $ret.b = ((function () {
                var $ret = new CT_PositiveSize2D();
                $ret.a = new ST_PositiveCoordinate(1, ExcelUtils.dm(b.width));
                $ret.b = new ST_PositiveCoordinate(1, ExcelUtils.dm(b.height));
                return $ret;
            })());
            return $ret;
        })());
    };
    XlsxUtilities.u = function (a) {
        var b = typeCast(ImageHolder.$, a.e);
        if (b == null) {
            {
                var c = new MemoryStream(2, a.b);
                try {
                    b = XlsxUtilities.v(c, a.d);
                }
                finally {
                    if (c != null) {
                        c.dispose();
                    }
                }
            }
            a.e = b;
        }
        return b;
    };
    XlsxUtilities.v = function (a, b) {
        var c = new ExcelImage(1, b, a);
        return new ImageHolder(c, b);
    };
    XlsxUtilities.a = function (a) {
        switch (a) {
            case 1: return 1;
            case 2: return 2;
            case 0: return 0;
            default: return 1;
        }
    };
    XlsxUtilities.f = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            case 2: return 2;
            case 3: return 3;
            case 4: return 4;
            case 5: return 5;
            case 6: return 6;
            case 7: return 7;
            case 8: return 8;
            case 9: return 9;
            case 10: return 10;
            case 11: return 11;
            case 12: return 12;
            case 13: return 13;
            default: return 10;
        }
    };
    XlsxUtilities.b = function (a) {
        switch (a) {
            case 9: return 9;
            case 11: return 11;
            case 3: return 3;
            case 4: return 4;
            case 6: return 6;
            case 7: return 7;
            case 2: return 2;
            case 10: return 10;
            case 12: return 12;
            case 8: return 8;
            case 0: return 0;
            case 13: return 13;
            case 5: return 5;
            case 1: return 1;
            default: return 0;
        }
    };
    XlsxUtilities.c = function (a) {
        switch (a) {
            case 0: return 1;
            case 1: return 0;
            default: return 1;
        }
    };
    XlsxUtilities.d = function (a) {
        switch (a) {
            case 2: return 2;
            case 0: return 0;
            case 1: return 1;
            default: return 2;
        }
    };
    XlsxUtilities.s = function (a) {
        switch (a) {
            case 0: return 0;
            case 2: return 2;
            case 6: return 4;
            case 7: return 6;
            case 4: return 5;
            case 5: return 7;
            case 1: return 1;
            case 3: return 3;
            default: return 2;
        }
    };
    XlsxUtilities.t = function (a) {
        switch (a) {
            case 0: return 0;
            case 4: return 4;
            case 2: return 2;
            case 7: return 7;
            case 3: return 3;
            case 6: return 6;
            case 5: return 5;
            case 1: return 1;
            default: return 0;
        }
    };
    XlsxUtilities.a7 = function (a) {
        return wrapNullable(Boolean_$type, (a));
    };
    XlsxUtilities.a6 = function (a) {
        var b = toNullable(Boolean_$type, a);
        return wrapNullable(Boolean_$type, (b));
    };
    XlsxUtilities.a8 = function (a) {
        if (nullableEquals(a, null)) {
            return toNullable(FillPatternStyle_$type, null);
        }
        return toNullable(FillPatternStyle_$type, XlsxUtilities.e(a.value));
    };
    XlsxUtilities.e = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            case 2: return 2;
            case 3: return 3;
            case 4: return 4;
            case 5: return 5;
            case 6: return 6;
            case 7: return 7;
            case 8: return 8;
            case 9: return 9;
            case 10: return 10;
            case 11: return 11;
            case 12: return 12;
            case 13: return 13;
            case 14: return 14;
            case 15: return 15;
            case 16: return 16;
            case 17: return 17;
            case 18: return 18;
            default: return 0;
        }
    };
    XlsxUtilities.g = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            case 2: return 2;
            default: return 0;
        }
    };
    XlsxUtilities.i = function (a) {
        switch (a) {
            case 4: return 0;
            case 0: return 1;
            case 1: return 2;
            case 2: return 33;
            case 3: return 34;
            default: return 0;
        }
    };
    XlsxUtilities.h = function (a) {
        switch (a) {
            case 0: return 0;
            case 2: return 1;
            case 3: return 2;
            default: return 1;
        }
    };
    XlsxUtilities.k = function (a) {
        if (nullableEquals(a, null)) {
            return -1;
        }
        return XlsxUtilities.j(a.value);
    };
    XlsxUtilities.j = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            case 2: return 2;
            case 3: return 3;
            case 4: return 4;
            case 5: return 5;
            case 6: return 6;
            case 7: return 7;
            default: return 0;
        }
    };
    XlsxUtilities.l = function (a) {
        switch (a) {
            case 1: return 0;
            case 3: return 2;
            case 4: return 3;
            case 0: return 4;
            case 2: return 5;
            case 5: return 6;
            case 6: return 1;
            default: return 4;
        }
    };
    XlsxUtilities.p = function (a) {
        switch (a) {
            case 3: return 3;
            case 1: return 1;
            case 2: return 2;
            case 0: return 0;
            default: return 3;
        }
    };
    XlsxUtilities.m = function (a) {
        switch (a) {
            case 2: return 2;
            case 0: return 0;
            case 1: return 1;
            default: return 0;
        }
    };
    XlsxUtilities.n = function (a) {
        switch (a) {
            case 0: return 2;
            case 2: return 0;
            case 1: return 1;
            default: return 2;
        }
    };
    XlsxUtilities.o = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            default: return 1;
        }
    };
    XlsxUtilities.q = function (a) {
        switch (a) {
            case 1: return 1;
            case 2: return 2;
            case 0: return 0;
            case 3: return 3;
            default: return 0;
        }
    };
    XlsxUtilities.r = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            case 2: return 2;
            default: return 0;
        }
    };
    XlsxUtilities.w = function (a) {
        switch (a) {
            case 2: return 3;
            case 0: return 0;
            case 1: return 2;
            default: return 3;
        }
    };
    XlsxUtilities.am = function (a) {
        switch (a) {
            case 9: return 9;
            case 11: return 11;
            case 3: return 3;
            case 4: return 4;
            case 6: return 6;
            case 7: return 7;
            case 2: return 2;
            case 10: return 10;
            case 12: return 12;
            case 8: return 8;
            case -1:
            case 0: return 0;
            case 13: return 13;
            case 5: return 5;
            case 1: return 1;
            default: return 0;
        }
    };
    XlsxUtilities.aq = function (a) {
        switch (a) {
            case 2: return 2;
            case 0: return 0;
            case 1: return 1;
            default: return 2;
        }
    };
    XlsxUtilities.ar = function (a) {
        switch (a) {
            case 0: return 0;
            case 2: return 2;
            case 4: return 6;
            case 6: return 7;
            case 5: return 4;
            case 7: return 5;
            case 1: return 1;
            case 3: return 3;
            default: return 2;
        }
    };
    XlsxUtilities.as = function (a) {
        switch (a) {
            case 0: return 0;
            case 4: return 4;
            case 2: return 2;
            case 7: return 7;
            case 3: return 3;
            case 6: return 6;
            case 5: return 5;
            case 1: return 1;
            default: return 0;
        }
    };
    XlsxUtilities.an = function (a) {
        switch (a) {
            case 1: return 1;
            case 2: return 2;
            case 0: return 0;
            default: return 1;
        }
    };
    XlsxUtilities.ao = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            case 2: return 2;
            case 3: return 3;
            case 4: return 4;
            case 5: return 5;
            case 6: return 6;
            case 7: return 7;
            case 8: return 8;
            case 9: return 9;
            case 10: return 10;
            case 11: return 11;
            case 12: return 12;
            case 13: return 13;
            default: return 10;
        }
    };
    XlsxUtilities.ap = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            case 2: return 2;
            default: return 0;
        }
    };
    XlsxUtilities.at = function (a) {
        switch (a) {
            case 3: return 2;
            case 0: return 0;
            case 2: return 1;
            default: return 2;
        }
    };
    XlsxUtilities.a9 = function (a) {
        switch (a) {
            case -1: return toNullable(ST_HorizontalAlignment_$type, null);
            case 0: return toNullable(ST_HorizontalAlignment_$type, 0);
            case 1: return toNullable(ST_HorizontalAlignment_$type, 1);
            case 2: return toNullable(ST_HorizontalAlignment_$type, 2);
            case 3: return toNullable(ST_HorizontalAlignment_$type, 3);
            case 4: return toNullable(ST_HorizontalAlignment_$type, 4);
            case 5: return toNullable(ST_HorizontalAlignment_$type, 5);
            case 6: return toNullable(ST_HorizontalAlignment_$type, 6);
            case 7: return toNullable(ST_HorizontalAlignment_$type, 7);
            default: return toNullable(ST_HorizontalAlignment_$type, 0);
        }
    };
    XlsxUtilities.au = function (a) {
        switch (a) {
            case 2: return 2;
            case 0: return 0;
            case 1: return 1;
            default: return 0;
        }
    };
    XlsxUtilities.av = function (a) {
        switch (a) {
            case 2: return 0;
            case 0: return 2;
            case 1: return 1;
            default: return 0;
        }
    };
    XlsxUtilities.aw = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            default: return 1;
        }
    };
    XlsxUtilities.ax = function (a) {
        switch (a) {
            case 3: return 3;
            case 1: return 1;
            case 2: return 2;
            case 0: return 0;
            default: return 3;
        }
    };
    XlsxUtilities.ba = function (a) {
        if (nullableEquals(a, null)) {
            return toNullable(ST_PatternType_$type, null);
        }
        return toNullable(ST_PatternType_$type, XlsxUtilities.ay(a.value));
    };
    XlsxUtilities.ay = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            case 2: return 2;
            case 3: return 3;
            case 4: return 4;
            case 5: return 5;
            case 6: return 6;
            case 7: return 7;
            case 8: return 8;
            case 9: return 9;
            case 10: return 10;
            case 11: return 11;
            case 12: return 12;
            case 13: return 13;
            case 14: return 14;
            case 15: return 15;
            case 16: return 16;
            case 17: return 17;
            case 18: return 18;
            default: return 0;
        }
    };
    XlsxUtilities.az = function (a) {
        switch (a) {
            case 1: return 1;
            case 2: return 2;
            case 0: return 0;
            case 3: return 3;
            default: return 0;
        }
    };
    XlsxUtilities.a0 = function (a) {
        switch (a) {
            case 1: return 0;
            case 0: return 1;
            default: return 0;
        }
    };
    XlsxUtilities.ah = function (a) {
        switch (a) {
            case 4: return 4;
            case 5: return 5;
            case 6: return 6;
            case 7: return 7;
            case 8: return 8;
            case 9: return 9;
            case 1: return 13;
            case 3: return 15;
            case 11: return 11;
            case 10: return 10;
            case 0: return 14;
            case 2: return 16;
            default: return 4;
        }
    };
    XlsxUtilities.a1 = function (a) {
        switch (a) {
            case 1: return 1;
            case 2: return 2;
            case 0: return 0;
            default: return 0;
        }
    };
    XlsxUtilities.a2 = function (a) {
        switch (a) {
            case 0: return 0;
            case 2: return 1;
            case 1: return 2;
            default: return 0;
        }
    };
    XlsxUtilities.a3 = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            case 2: return 2;
            default: return 0;
        }
    };
    XlsxUtilities.bb = function (a) {
        if (ExcelUtils.al(a) == false) {
            return toNullable(ST_SystemColorVal_$type, null);
        }
        if (a.equals(SystemColorsInternal.d)) {
            return toNullable(ST_SystemColorVal_$type, 0);
        }
        if (a.equals(SystemColorsInternal.f)) {
            return toNullable(ST_SystemColorVal_$type, 1);
        }
        if (a.equals(SystemColorsInternal.j)) {
            return toNullable(ST_SystemColorVal_$type, 3);
        }
        if (a.equals(SystemColorsInternal.ab)) {
            return toNullable(ST_SystemColorVal_$type, 10);
        }
        if (a.equals(SystemColorsInternal.l)) {
            return toNullable(ST_SystemColorVal_$type, 4);
        }
        if (a.equals(SystemColorsInternal.n)) {
            return toNullable(ST_SystemColorVal_$type, 8);
        }
        if (a.equals(SystemColorsInternal.z)) {
            return toNullable(ST_SystemColorVal_$type, 9);
        }
        if (a.equals(SystemColorsInternal.h)) {
            return toNullable(ST_SystemColorVal_$type, 2);
        }
        if (a.equals(SystemColorsInternal.t)) {
            return toNullable(ST_SystemColorVal_$type, 5);
        }
        if (a.equals(SystemColorsInternal.af)) {
            return toNullable(ST_SystemColorVal_$type, 11);
        }
        if (a.equals(SystemColorsInternal.ah)) {
            return toNullable(ST_SystemColorVal_$type, 12);
        }
        if (a.equals(SystemColorsInternal.aj)) {
            return toNullable(ST_SystemColorVal_$type, 13);
        }
        if (a.equals(SystemColorsInternal.al)) {
            return toNullable(ST_SystemColorVal_$type, 14);
        }
        if (a.equals(SystemColorsInternal.an)) {
            return toNullable(ST_SystemColorVal_$type, 15);
        }
        if (a.equals(SystemColorsInternal.ap)) {
            return toNullable(ST_SystemColorVal_$type, 16);
        }
        if (a.equals(SystemColorsInternal.ar)) {
            return toNullable(ST_SystemColorVal_$type, 17);
        }
        if (a.equals(SystemColorsInternal.av)) {
            return toNullable(ST_SystemColorVal_$type, 19);
        }
        if (a.equals(SystemColorsInternal.ax)) {
            return toNullable(ST_SystemColorVal_$type, 21);
        }
        if (a.equals(SystemColorsInternal.v)) {
            return toNullable(ST_SystemColorVal_$type, 7);
        }
        if (a.equals(SystemColorsInternal.a3)) {
            return toNullable(ST_SystemColorVal_$type, 22);
        }
        if (a.equals(SystemColorsInternal.a1)) {
            return toNullable(ST_SystemColorVal_$type, 23);
        }
        if (a.equals(SystemColorsInternal.a5)) {
            return toNullable(ST_SystemColorVal_$type, 24);
        }
        if (a.equals(SystemColorsInternal.a7)) {
            return toNullable(ST_SystemColorVal_$type, 25);
        }
        if (a.equals(SystemColorsInternal.a9)) {
            return toNullable(ST_SystemColorVal_$type, 26);
        }
        if (a.equals(SystemColorsInternal.bb)) {
            return toNullable(ST_SystemColorVal_$type, 27);
        }
        if (a.equals(SystemColorsInternal.bd)) {
            return toNullable(ST_SystemColorVal_$type, 28);
        }
        if (a.equals(SystemColorsInternal.bf)) {
            return toNullable(ST_SystemColorVal_$type, 29);
        }
        return toNullable(ST_SystemColorVal_$type, null);
    };
    XlsxUtilities.a4 = function (a) {
        return a;
    };
    XlsxUtilities.ai = function (a) {
        switch (a) {
            case 0: return 1;
            case 2: return 3;
            case 3: return 4;
            case 4: return 0;
            case 5: return 2;
            case 1: return 6;
            case 6: return 5;
            default: return 0;
        }
    };
    XlsxUtilities.aj = function (a) {
        switch (a) {
            case 0: return 2;
            case 1: return 1;
            case 2: return 0;
            default: return 2;
        }
    };
    XlsxUtilities.ak = function (a) {
        switch (a) {
            case -1:
            case 0: return 0;
            case 1:
            case 33: return 2;
            case 2:
            case 34: return 3;
            default: return 0;
        }
    };
    XlsxUtilities.a5 = function (a) {
        switch (a) {
            case -1:
            case 0: return 4;
            case 1: return 0;
            case 2: return 1;
            case 33: return 2;
            case 34: return 3;
            default: return 4;
        }
    };
    XlsxUtilities.bc = function (a) {
        switch (a) {
            case -1: return toNullable(ST_VerticalAlignment_$type, null);
            case 0: return toNullable(ST_VerticalAlignment_$type, 0);
            case 1: return toNullable(ST_VerticalAlignment_$type, 1);
            case 2: return toNullable(ST_VerticalAlignment_$type, 2);
            case 3: return toNullable(ST_VerticalAlignment_$type, 3);
            case 4: return toNullable(ST_VerticalAlignment_$type, 4);
            default: return toNullable(ST_VerticalAlignment_$type, 2);
        }
    };
    XlsxUtilities.al = function (a) {
        switch (a) {
            case -1:
            case 0: return 0;
            case 1: return 1;
            case 2: return 2;
            default: return 0;
        }
    };
    XlsxUtilities.bf = function (a) {
        switch (a) {
            case 0: return SystemColorsInternal.d;
            case 1: return SystemColorsInternal.f;
            case 3: return SystemColorsInternal.j;
            case 10: return SystemColorsInternal.ab;
            case 4: return SystemColorsInternal.l;
            case 8: return SystemColorsInternal.n;
            case 9: return SystemColorsInternal.z;
            case 2: return SystemColorsInternal.h;
            case 5: return SystemColorsInternal.t;
            case 11: return SystemColorsInternal.af;
            case 12: return SystemColorsInternal.ah;
            case 13: return SystemColorsInternal.aj;
            case 14: return SystemColorsInternal.al;
            case 15: return SystemColorsInternal.an;
            case 16: return SystemColorsInternal.ap;
            case 17: return SystemColorsInternal.ar;
            case 19: return SystemColorsInternal.av;
            case 21: return SystemColorsInternal.ax;
            case 7: return SystemColorsInternal.v;
            case 22: return SystemColorsInternal.a3;
            case 23: return SystemColorsInternal.a1;
            case 24: return SystemColorsInternal.a5;
            case 25: return SystemColorsInternal.a7;
            case 26: return SystemColorsInternal.a9;
            case 27: return SystemColorsInternal.bb;
            case 28: return SystemColorsInternal.bd;
            case 29: return SystemColorsInternal.bf;
            default: break;
        }
        return ColorsInternal.c;
    };
    XlsxUtilities.y = function (a) {
        if (nullableEquals(a, null)) {
            return -1;
        }
        return XlsxUtilities.x(a.value);
    };
    XlsxUtilities.x = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            case 2: return 2;
            case 3: return 3;
            case 4: return 4;
            default: return 2;
        }
    };
    XlsxUtilities.z = function (a) {
        switch (a) {
            case 2: return 0;
            case 1: return 1;
            case 4: return 0;
            case 3: return 0;
            case 0: return 2;
            default: return 0;
        }
    };
    XlsxUtilities.aa = function (a, b) {
        return a._accept$2$i(Workbook.$, WorkbookColorInfo.$, XlsxUtilities_WorkbookColorInfoCreator.a, b);
    };
    XlsxUtilities.ab = function (a, b) {
        return a._accept$2$i(Workbook.$, WorkbookColorInfo.$, XlsxUtilities_WorkbookColorInfoCreator.a, b);
    };
    XlsxUtilities.ac = function (a) {
        switch (a) {
            case 4: return 4;
            case 5: return 5;
            case 6: return 6;
            case 7: return 7;
            case 8: return 8;
            case 9: return 9;
            case 13: return 1;
            case 15: return 3;
            case 1: return 1;
            case 3: return 3;
            case 11: return 11;
            case 10: return 10;
            case 14: return 0;
            case 16: return 2;
            case 0: return 0;
            case 2: return 2;
            default: return 4;
        }
    };
    XlsxUtilities.bd = function (a, b) {
        var c = new WorksheetCellAddress(1, a.d, a.c);
        var d = b._gd(a.c, true);
        var e = b._gh(a.d, true, true);
        var f = a.a.k();
        var g = a.b.k();
        var h = { $type: Point_$type, x: d == 0 ? 0 : ((f * 100) / d), y: e == 0 ? 0 : ((g * 100) / e) };
        return Tuple.a(WorksheetCellAddress.$, Point_$type, c, h);
    };
    XlsxUtilities.ad = function (a) {
        switch (a) {
            case 0: return 0;
            case 1: return 2;
            case 2: return 1;
            default: return 0;
        }
    };
    XlsxUtilities.ae = function (a) {
        switch (a) {
            case 1: return 1;
            case 2: return 2;
            case 0: return 0;
            default: return 0;
        }
    };
    XlsxUtilities.be = function (a) {
        var b = EnumUtil.getName(ST_PresetColorVal_$type, a);
        if (stringStartsWith(b, "dk")) {
            b = "dark" + b.substr(2);
        }
        else if (stringStartsWith(b, "lt")) {
            b = "light" + b.substr(2);
        }
        else if (stringStartsWith(b, "med")) {
            b = "medium" + b.substr(3);
        }
        var c = new Color();
        c = new Color();
        c.colorString = b;
        return c;
    };
    XlsxUtilities.$t = markType(XlsxUtilities, 'XlsxUtilities');
    return XlsxUtilities;
}(Base));
export { XlsxUtilities };
/**
 * @hidden
 */
var XlsxUtilities_WorkbookColorInfoCreator = /** @class */ (function (_super) {
    tslib_1.__extends(XlsxUtilities_WorkbookColorInfoCreator, _super);
    function XlsxUtilities_WorkbookColorInfoCreator() {
        return _super.call(this) || this;
    }
    XlsxUtilities_WorkbookColorInfoCreator.prototype._visitCT_SchemeColor$i = function (a, b) {
        var c = new WorkbookColorInfo(XlsxUtilities.ac(a.c));
        var d = XlsxUtilities_WorkbookColorInfoCreator.b(a, b, c);
        c = d.p2;
        return c;
    };
    XlsxUtilities_WorkbookColorInfoCreator.prototype._visitCT_SRgbColor$i = function (a, b) {
        var c = new WorkbookColorInfo(ST_HexColorRGB.s(a.c));
        var d = XlsxUtilities_WorkbookColorInfoCreator.b(a, b, c);
        c = d.p2;
        return c;
    };
    XlsxUtilities_WorkbookColorInfoCreator.prototype._visitCT_SysColor$i = function (a, b) {
        if (a.d == 27 && a.b.count == 0) {
            return WorkbookColorInfo.automatic;
        }
        var c = new WorkbookColorInfo(XlsxUtilities.bf(a.d));
        var d = XlsxUtilities_WorkbookColorInfoCreator.b(a, b, c);
        c = d.p2;
        return c;
    };
    XlsxUtilities_WorkbookColorInfoCreator.prototype._visitCT_PresetColor$i = function (a, b) {
        var c = XlsxUtilities.be(a.c);
        var d = new WorkbookColorInfo(c);
        var e = XlsxUtilities_WorkbookColorInfoCreator.b(a, b, d);
        d = e.p2;
        return d;
    };
    XlsxUtilities_WorkbookColorInfoCreator.prototype._visitCT_BlipFillProperties$i = function (a, b) {
        return null;
    };
    XlsxUtilities_WorkbookColorInfoCreator.prototype._visitCT_GroupFillProperties$i = function (a, b) {
        return null;
    };
    XlsxUtilities_WorkbookColorInfoCreator.prototype._visitCT_NoFillProperties$i = function (a, b) {
        return null;
    };
    XlsxUtilities_WorkbookColorInfoCreator.prototype._visitCT_SolidFillProperties$i = function (a, b) {
        return XlsxUtilities.aa(a.a, b);
    };
    XlsxUtilities_WorkbookColorInfoCreator.b = function (a, b, c) {
        var e_1, _a;
        if (a.b.count == 0) {
            return {
                p2: c
            };
        }
        if (nullableNotEquals(c._themeColorType$i, null) && nullableEquals(c._tint$i, null)) {
            if (a.b.count == 1) {
                var d = typeCast(ColorTransform_LumMod.$, a.b._inner[0]);
                if (d != null) {
                    c = c._h(new WorkbookColorTransform(toNullable(Number_$type, null), toNullable(Number_$type, ST_Percentage.l(d.a) / 100), toNullable(Number_$type, null), toNullable(Number_$type, null)));
                    return {
                        p2: c
                    };
                }
            }
            else if (a.b.count == 2) {
                var e = typeCast(ColorTransform_LumMod.$, a.b._inner[0]);
                var f = typeCast(ColorTransform_LumOff.$, a.b._inner[1]);
                if (e == null && f == null) {
                    e = typeCast(ColorTransform_LumMod.$, a.b._inner[1]);
                    f = typeCast(ColorTransform_LumOff.$, a.b._inner[0]);
                }
                if (e != null && f != null) {
                    c = c._h(new WorkbookColorTransform(toNullable(Number_$type, null), toNullable(Number_$type, ST_Percentage.l(e.a) / 100), toNullable(Number_$type, ST_Percentage.l(f.a) / 100), toNullable(Number_$type, null)));
                    return {
                        p2: c
                    };
                }
            }
        }
        var g = c._getResolvedColor1(b);
        try {
            for (var _b = tslib_1.__values(fromEnum(a.b)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var h = _c.value;
                g = h._accept$2$i(Color.$, Color.$, XlsxUtilities_ColorTransformsApplicator.a, g);
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_1) throw e_1.error; }
        }
        c = new WorkbookColorInfo(g);
        return {
            p2: c
        };
    };
    XlsxUtilities_WorkbookColorInfoCreator.$t = markType(XlsxUtilities_WorkbookColorInfoCreator, 'XlsxUtilities_WorkbookColorInfoCreator', Base.$, [IEG_ColorChoiceVisitor$2_$type.specialize(Workbook.$, WorkbookColorInfo.$), IEG_FillPropertiesVisitor$2_$type.specialize(Workbook.$, WorkbookColorInfo.$)]);
    XlsxUtilities_WorkbookColorInfoCreator.a = new XlsxUtilities_WorkbookColorInfoCreator();
    return XlsxUtilities_WorkbookColorInfoCreator;
}(Base));
export { XlsxUtilities_WorkbookColorInfoCreator };
//# sourceMappingURL=XlsxUtilities_combined.js.map