import * as i0 from '@angular/core';
import { Injectable } from '@angular/core';
import * as i1 from '@angular/material/icon';
import * as i2 from '@angular/platform-browser';

/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
class Position {
    constructor(left, top) {
        this.left = left || 0;
        this.top = top || 0;
    }
    static equals(p1, p2) {
        return p1.left === p2.left && p1.top === p2.top;
    }
    offset(x, y) {
        return new Position(this.left + x, this.top + y);
    }
    clone() {
        return new Position(this.left, this.top);
    }
    constrain(xmin, xmax, ymin, ymax) {
        return new Position(Math.min(Math.max(xmin, this.left), xmax), Math.min(Math.max(ymin, this.top), ymax));
    }
    around(x, y, xspan, yspan) {
        return Math.abs(this.left - x) <= xspan && Math.abs(this.top - y) <= (yspan || xspan);
    }
}

/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
class Rect {
    constructor(left, top, width, height) {
        if (typeof left === 'number') {
            this.left = left || 0;
            this.top = top || 0;
            this.width = width || 0;
            this.height = height || 0;
        }
        else {
            const bounds = (left || {});
            this.left = bounds.left || 0;
            this.top = bounds.top || 0;
            this.width = bounds.right !== undefined ? bounds.right - this.left : bounds.width || 0;
            this.height = bounds.bottom !== undefined ? bounds.bottom - this.top : bounds.height || 0;
        }
    }
    static equals(r1, r2) {
        return r1 && r2 && r1.left === r2.left && r1.top === r2.top && r1.width === r2.width && r1.height === r2.height;
    }
    static union(r1, r2) {
        return Rect.fromLTRB(Math.min(r1.left, r2.left), Math.min(r1.top, r2.top), Math.max(r1.left + r1.width, r2.left + r2.width), Math.max(r1.top + r1.height, r2.top + r2.height));
    }
    static overlapInfos(rect1, rect2) {
        const x = Math.max(0, Math.min(rect1.right, rect2.right) - Math.max(rect1.left, rect2.left));
        const y = Math.max(0, Math.min(rect1.bottom, rect2.bottom) - Math.max(rect1.top, rect2.top));
        return {
            area: x * y,
            width: x,
            height: y,
            direction: x > y ? 'horizontal' : 'vertical'
        };
    }
    // eslint-disable-next-line @typescript-eslint/naming-convention
    static fromLTRB(left, top, right, bottom) {
        return new Rect(left, top, right - left, bottom - top);
    }
    static fromPoints(p1, p2) {
        return Rect.fromLTRB(Math.min(p1.left, p2.left), Math.min(p1.top, p2.top), Math.max(p1.left, p2.left), Math.max(p1.top, p2.top));
    }
    set right(value) {
        this.width = value - this.left;
    }
    get right() {
        return this.left + this.width;
    }
    set bottom(value) {
        this.height = value - this.top;
    }
    get bottom() {
        return this.top + this.height;
    }
    get position() {
        return new Position(this.left, this.top);
    }
    offset(x, y) {
        return new Rect(this.left + x, this.top + y, this.width, this.height);
    }
    adjacent(bounds) {
        return bounds.left <= this.right &&
            bounds.right >= this.left &&
            bounds.top <= this.bottom &&
            bounds.bottom >= this.top;
    }
    contains(bounds) {
        return bounds.left >= this.left && bounds.right <= this.right && bounds.top >= this.top && bounds.bottom <= this.bottom;
    }
    containsPoint(point) {
        return point.left >= this.left && point.left <= this.right && point.top >= this.top && point.top <= this.bottom;
    }
    intersectWith(bounds) {
        return bounds.left < this.right &&
            bounds.right > this.left &&
            bounds.top < this.bottom &&
            bounds.bottom > this.top;
    }
    isEmpty() {
        return !this.width || !this.height;
    }
    clone() {
        return new Rect(this.left, this.top, this.width, this.height);
    }
    toClientRect() {
        return {
            left: this.left,
            top: this.top,
            bottom: this.bottom,
            right: this.right,
            width: this.width,
            height: this.height
        };
    }
    /**
     * @deprecated use toClientRect instead
     */
    toRectStruct() {
        return this.toClientRect();
    }
}

/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
class Circle {
    /** Create e new circle instance from the center position and the radius */
    constructor(center, radius) {
        this.center = center;
        this.radius = radius;
    }
    /**
     * Return a circle from his outer rectangle.
     *
     * @param left      The left position of the circle center or a rectangle object.
     * @param top       The top position of the circle center
     * @param width     The width of the outer rectangle
     * @param height    The height of the outer rectangle
     * @return A circle contained end centered inside the passed ractangle
     */
    static fromOuterRect(left, top, width, height) {
        if (typeof left === 'object') {
            const bounds = left;
            left = bounds.left;
            top = bounds.top;
            width = bounds.width;
            height = bounds.height;
        }
        const radius = Math.min(width, height) / 2;
        const center = new Position(+left + (width / 2), top + (height / 2));
        return new Circle(center, radius);
    }
    /** Return a boolean indicating if the two circle are equals */
    static equals(c1, c2) {
        return !c1 === !c2 && Position.equals(c1.center, c2.center) && c1.radius === c2.radius;
    }
    /** Return the outer rectangle of the circle */
    get outerRect() {
        return Rect.fromLTRB(this.center.left - this.radius, this.center.top - this.radius, this.center.left + this.radius, this.center.top + this.radius);
    }
    /** Return a boolean indicate if the circle contains the passed circle */
    contains(circle) {
        return this.outerRect.contains(circle.outerRect);
    }
    /** Return a boolean indicate if the passed point is inside the circle */
    containsPoint(point) {
        const dx = Math.abs(point.left - this.center.left);
        const dy = Math.abs(point.top - this.center.top);
        return dx * dx + dy * dy <= this.radius * this.radius;
    }
    /** Return a the cloned of the cirlce */
    clone() {
        return new Circle(this.center, this.radius);
    }
    /** Inflate the circle radius with the specified value */
    inflate(radius) {
        return new Circle(this.center, this.radius + radius);
    }
}

/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
/* eslint-disable @typescript-eslint/naming-convention */
var Directions;
(function (Directions) {
    Directions[Directions["none"] = 0] = "none";
    Directions[Directions["left"] = 1] = "left";
    Directions[Directions["right"] = 2] = "right";
    Directions[Directions["top"] = 4] = "top";
    Directions[Directions["bottom"] = 8] = "bottom";
    Directions[Directions["horizontal"] = 3] = "horizontal";
    Directions[Directions["vertical"] = 12] = "vertical";
    Directions[Directions["all"] = 15] = "all";
})(Directions || (Directions = {}));

/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
class IconService {
    constructor(iconRegistry, sanitizer) {
        this.iconRegistry = iconRegistry;
        this.sanitizer = sanitizer;
        const defaultFontSetClasses = iconRegistry.getDefaultFontSetClass();
        const outlinedFontSetClasses = defaultFontSetClasses.concat(['material-symbols-outlined']);
        iconRegistry.setDefaultFontSetClass(...outlinedFontSetClasses);
    }
    /**
     * register an SVG icon to the MatIconRegistry, so that this icon can be used with the MatIcon component.
     *
     * &lt;mat-icon svgIcon='my-svg-icon' &gt;&lt;/mat-icon&gt;
     *
     * @param iconName
     * @param iconUrl
     */
    addSvgIcon(iconName, iconUrl) {
        this.iconRegistry.addSvgIcon(iconName, this.sanitizer.bypassSecurityTrustResourceUrl(iconUrl));
    }
    useMaterialIcons(value = true) {
        this.iconRegistry.registerFontClassAlias('deja-icons', value ? 'material-icons' : null);
    }
}
IconService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: IconService, deps: [{ token: i1.MatIconRegistry }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Injectable });
IconService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: IconService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: IconService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }], ctorParameters: function () { return [{ type: i1.MatIconRegistry }, { type: i2.DomSanitizer }]; } });

/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
class Size {
    constructor(width, height) {
        this.width = width || 0;
        this.height = height || 0;
    }
    static equals(s1, s2) {
        return s1.width === s2.width && s1.height === s2.height;
    }
    clone() {
        return new Size(this.width, this.height);
    }
}

/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
class UnitValue {
    constructor(value, unit) {
        if (typeof value === 'string') {
            // eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
            const match = value.match(/([0-9.]+)(.*)/);
            this.value = match && match.length >= 2 && parseInt(match[1], 10);
            this.unit = match && match.length >= 3 && match[2];
        }
        else {
            this.value = value;
            this.unit = unit;
        }
    }
    static equals(s1, s2) {
        return s1.value === s2.value && s1.unit === s2.unit;
    }
    clone() {
        return new UnitValue(this.value, this.unit);
    }
    toString() {
        return String(this.value) + this.unit;
    }
    isInvalid() {
        return this.value === undefined || this.value === null || isNaN(this.value);
    }
}

class Color {
    constructor(r, g, b, a) {
        this._r = r;
        this._g = g;
        this._b = b;
        this._a = a;
    }
    static equals(c1, c2) {
        return !c1 === !c2 && !c1.isEmpty() && c1.r === c2.r && c1.g === c2.g && c1.b === c2.b && c1.a === c2.a;
    }
    // eslint-disable-next-line @typescript-eslint/naming-convention
    static fromHSL(h, s, l) {
        let r;
        let g;
        let b;
        if (s === 0) {
            r = g = b = l; // achromatic
        }
        else {
            const hue2rgb = (p, q, t) => {
                if (t < 0) {
                    t += 1;
                }
                if (t > 1) {
                    t -= 1;
                }
                if (t < 1 / 6) {
                    return p + (q - p) * 6 * t;
                }
                if (t < 1 / 2) {
                    return q;
                }
                if (t < 2 / 3) {
                    return p + (q - p) * (2 / 3 - t) * 6;
                }
                return p;
            };
            const qq = l < 0.5 ? l * (1 + s) : l + s - l * s;
            const pp = 2 * l - qq;
            r = hue2rgb(pp, qq, h + 1 / 3);
            g = hue2rgb(pp, qq, h);
            b = hue2rgb(pp, qq, h - 1 / 3);
        }
        return new Color(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255));
    }
    /**
     * @param hex hexadecimal color value, exemple: #127bdc #FFF #127bdc56
     */
    static fromHex(hex) {
        if (!hex || hex.length < 3) {
            return new Color();
        }
        let r;
        let g;
        let b;
        let a;
        let startIndex = hex.startsWith('#') ? 1 : 0;
        switch (hex.length - startIndex) {
            case 3:
                r = parseInt(hex[startIndex] + hex[startIndex], 16);
                g = parseInt(hex[++startIndex] + hex[startIndex], 16);
                b = parseInt(hex[++startIndex] + hex[startIndex], 16);
                break;
            case 4:
                r = parseInt(hex[startIndex] + hex[startIndex], 16);
                g = parseInt(hex[++startIndex] + hex[startIndex], 16);
                b = parseInt(hex[++startIndex] + hex[startIndex], 16);
                a = parseInt(hex[++startIndex] + hex[startIndex], 16);
                break;
            case 6:
                r = parseInt(hex[startIndex] + hex[++startIndex], 16);
                g = parseInt(hex[++startIndex] + hex[++startIndex], 16);
                b = parseInt(hex[++startIndex] + hex[++startIndex], 16);
                break;
            case 8:
                r = parseInt(hex[startIndex] + hex[++startIndex], 16);
                g = parseInt(hex[++startIndex] + hex[++startIndex], 16);
                b = parseInt(hex[++startIndex] + hex[++startIndex], 16);
                a = parseInt(hex[++startIndex] + hex[++startIndex], 16);
                break;
            default:
                throw new Error('Invalid color.');
        }
        return new Color(r, g, b, a);
    }
    static parse(color) {
        if (!color || color.length === 0) {
            return new Color();
        }
        else if (Color.COLOR_NAMES[color]) {
            return Color.fromHex(Color.COLOR_NAMES[color]);
        }
        else if (color.startsWith('#')) {
            return Color.fromHex(color);
        }
        else {
            const rgb = /rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)/.exec(color);
            if (rgb !== null) {
                return new Color(+rgb[1], +rgb[2], +rgb[3]);
            }
            const rgba = /rgba\((\d{1,3}), (\d{1,3}), (\d{1,3}), ([0-9.]*)\)/.exec(color);
            if (rgba !== null) {
                let a = +rgba[4];
                if (isNaN(a)) {
                    a = 1;
                }
                else if (a <= 1) {
                    a = Math.round(a * 255);
                }
                return new Color(+rgba[1], +rgba[2], +rgba[3], a);
            }
            return undefined;
        }
    }
    get r() {
        return this._r;
    }
    get g() {
        return this._g;
    }
    get b() {
        return this._b;
    }
    get a() {
        return this._a;
    }
    get bestTextColor() {
        if (this.isEmpty()) {
            return new Color();
        }
        const m = 1 - (0.299 * this.r + 0.587 * this.g + 0.114 * this.b) / 255;
        const d = m < 0.5 ? 0 : 255;
        return new Color(d, d, d);
    }
    get grayScale() {
        if (this.isEmpty()) {
            return new Color();
        }
        const g = Math.round((this.r + this.g + this.b) / 3);
        return new Color(g, g, g, this.a);
    }
    isEmpty() {
        return this.r === undefined || this.g === undefined || this.b === undefined;
    }
    clone() {
        return new Color(this.r, this.g, this.b, this.a);
    }
    toHex() {
        const toHex = (d) => {
            const s = Number(d).toString(16);
            return `0${s}`.slice(-2).toUpperCase();
        };
        if (this.isEmpty()) {
            return undefined;
        }
        else if (this.a !== undefined) {
            return `#${toHex(this.r)}${toHex(this.g)}${toHex(this.b)}${toHex(this.a)}`;
        }
        else {
            return `#${toHex(this.r)}${toHex(this.g)}${toHex(this.b)}`;
        }
    }
    // eslint-disable-next-line @typescript-eslint/naming-convention
    toHSL() {
        const r = this.r / 255;
        const g = this.g / 255;
        const b = this.b / 255;
        const max = Math.max(r, g, b);
        const min = Math.min(r, g, b);
        let h = (max + min) / 2;
        let s = h;
        const l = h;
        if (max === min) {
            h = s = 0; // achromatic
        }
        else {
            const d = max - min;
            s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
            if (r > g && r > b) {
                h = (g - b) / d + (g < b ? 6 : 0);
            }
            else if (g > b) {
                h = (b - r) / d + 2;
            }
            else {
                h = (r - g) / d + 4;
            }
            h /= 6;
        }
        return { h: h, s: s, l: l };
    }
}
Color.COLOR_NAMES = {
    aliceblue: '#f0f8ff',
    antiquewhite: '#faebd7',
    aqua: '#00ffff',
    aquamarine: '#7fffd4',
    azure: '#f0ffff',
    beige: '#f5f5dc',
    bisque: '#ffe4c4',
    black: '#000000',
    blanchedalmond: '#ffebcd',
    blue: '#0000ff',
    blueviolet: '#8a2be2',
    brown: '#a52a2a',
    burlywood: '#deb887',
    cadetblue: '#5f9ea0',
    chartreuse: '#7fff00',
    chocolate: '#d2691e',
    coral: '#ff7f50',
    cornflowerblue: '#6495ed',
    cornsilk: '#fff8dc',
    crimson: '#dc143c',
    cyan: '#00ffff',
    darkblue: '#00008b',
    darkcyan: '#008b8b',
    darkgoldenrod: '#b8860b',
    darkgray: '#a9a9a9',
    darkgreen: '#006400',
    darkkhaki: '#bdb76b',
    darkmagenta: '#8b008b',
    darkolivegreen: '#556b2f',
    darkorange: '#ff8c00',
    darkorchid: '#9932cc',
    darkred: '#8b0000',
    darksalmon: '#e9967a',
    darkseagreen: '#8fbc8f',
    darkslateblue: '#483d8b',
    darkslategray: '#2f4f4f',
    darkturquoise: '#00ced1',
    darkviolet: '#9400d3',
    deeppink: '#ff1493',
    deepskyblue: '#00bfff',
    dimgray: '#696969',
    dodgerblue: '#1e90ff',
    firebrick: '#b22222',
    floralwhite: '#fffaf0',
    forestgreen: '#228b22',
    fuchsia: '#ff00ff',
    gainsboro: '#dcdcdc',
    ghostwhite: '#f8f8ff',
    gold: '#ffd700',
    goldenrod: '#daa520',
    gray: '#808080',
    green: '#008000',
    greenyellow: '#adff2f',
    honeydew: '#f0fff0',
    hotpink: '#ff69b4',
    indianred: '#cd5c5c',
    indigo: '#4b0082',
    ivory: '#fffff0',
    khaki: '#f0e68c',
    lavender: '#e6e6fa',
    lavenderblush: '#fff0f5',
    lawngreen: '#7cfc00',
    lemonchiffon: '#fffacd',
    lightblue: '#add8e6',
    lightcoral: '#f08080',
    lightcyan: '#e0ffff',
    lightgoldenrodyellow: '#fafad2',
    lightgrey: '#d3d3d3',
    lightgreen: '#90ee90',
    lightpink: '#ffb6c1',
    lightsalmon: '#ffa07a',
    lightseagreen: '#20b2aa',
    lightskyblue: '#87cefa',
    lightslategray: '#778899',
    lightsteelblue: '#b0c4de',
    lightyellow: '#ffffe0',
    lime: '#00ff00',
    limegreen: '#32cd32',
    linen: '#faf0e6',
    magenta: '#ff00ff',
    maroon: '#800000',
    mediumaquamarine: '#66cdaa',
    mediumblue: '#0000cd',
    mediumorchid: '#ba55d3',
    mediumpurple: '#9370d8',
    mediumseagreen: '#3cb371',
    mediumslateblue: '#7b68ee',
    mediumspringgreen: '#00fa9a',
    mediumturquoise: '#48d1cc',
    mediumvioletred: '#c71585',
    midnightblue: '#191970',
    mintcream: '#f5fffa',
    mistyrose: '#ffe4e1',
    moccasin: '#ffe4b5',
    navajowhite: '#ffdead',
    navy: '#000080',
    oldlace: '#fdf5e6',
    olive: '#808000',
    olivedrab: '#6b8e23',
    orange: '#ffa500',
    orangered: '#ff4500',
    orchid: '#da70d6',
    palegoldenrod: '#eee8aa',
    palegreen: '#98fb98',
    paleturquoise: '#afeeee',
    palevioletred: '#d87093',
    papayawhip: '#ffefd5',
    peachpuff: '#ffdab9',
    peru: '#cd853f',
    pink: '#ffc0cb',
    plum: '#dda0dd',
    powderblue: '#b0e0e6',
    purple: '#800080',
    rebeccapurple: '#663399',
    red: '#ff0000',
    rosybrown: '#bc8f8f',
    royalblue: '#4169e1',
    saddlebrown: '#8b4513',
    salmon: '#fa8072',
    sandybrown: '#f4a460',
    seagreen: '#2e8b57',
    seashell: '#fff5ee',
    sienna: '#a0522d',
    silver: '#c0c0c0',
    skyblue: '#87ceeb',
    slateblue: '#6a5acd',
    slategray: '#708090',
    snow: '#fffafa',
    springgreen: '#00ff7f',
    steelblue: '#4682b4',
    tan: '#d2b48c',
    teal: '#008080',
    thistle: '#d8bfd8',
    tomato: '#ff6347',
    turquoise: '#40e0d0',
    violet: '#ee82ee',
    wheat: '#f5deb3',
    white: '#ffffff',
    whitesmoke: '#f5f5f5',
    yellow: '#ffff00',
    yellowgreen: '#9acd3'
};

/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
class MaterialColor extends Color {
    constructor() {
        super(...arguments);
        this.subColors = [];
    }
}

/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
class MaterialColorService {
    constructor() {
        this.palet = {
            'mat-red': {
                50: '#ffebee',
                100: '#ffcdd2',
                200: '#ef9a9a',
                300: '#e57373',
                400: '#ef5350',
                500: '#f44336',
                600: '#e53935',
                700: '#d32f2f',
                800: '#c62828',
                900: '#b71c1c'
            },
            'mat-pink': {
                50: '#fce4ec',
                100: '#f8bbd0',
                200: '#f48fb1',
                300: '#f06292',
                400: '#ec407a',
                500: '#e91e63',
                600: '#d81b60',
                700: '#c2185b',
                800: '#ad1457',
                900: '#880e4f'
            },
            'mat-purple': {
                50: '#f3e5f5',
                100: '#e1bee7',
                200: '#ce93d8',
                300: '#ba68c8',
                400: '#ab47bc',
                500: '#9c27b0',
                600: '#8e24aa',
                700: '#7b1fa2',
                800: '#6a1b9a',
                900: '#4a148c'
            },
            'mat-deep-purple': {
                50: '#ede7f6',
                100: '#d1c4e9',
                200: '#b39ddb',
                300: '#9575cd',
                400: '#7e57c2',
                500: '#673ab7',
                600: '#5e35b1',
                700: '#512da8',
                800: '#4527a0',
                900: '#311b92'
            },
            'mat-indigo': {
                50: '#e8eaf6',
                100: '#c5cae9',
                200: '#9fa8da',
                300: '#7986cb',
                400: '#5c6bc0',
                500: '#3f51b5',
                600: '#3949ab',
                700: '#303f9f',
                800: '#283593',
                900: '#1a237e'
            },
            'mat-blue': {
                50: '#e3f2fd',
                100: '#bbdefb',
                200: '#90caf9',
                300: '#64b5f6',
                400: '#42a5f5',
                500: '#2196f3',
                600: '#1e88e5',
                700: '#1976d2',
                800: '#1565c0',
                900: '#0d47a1'
            },
            'mat-light-blue': {
                50: '#e1f5fe',
                100: '#b3e5fc',
                200: '#81d4fa',
                300: '#4fc3f7',
                400: '#29b6f6',
                500: '#03a9f4',
                600: '#039be5',
                700: '#0288d1',
                800: '#0277bd',
                900: '#01579b'
            },
            'mat-cyan': {
                50: '#e0f7fa',
                100: '#b2ebf2',
                200: '#80deea',
                300: '#4dd0e1',
                400: '#26c6da',
                500: '#00bcd4',
                600: '#00acc1',
                700: '#0097a7',
                800: '#00838f',
                900: '#006064'
            },
            'mat-teal': {
                50: '#e0f2f1',
                100: '#b2dfdb',
                200: '#80cbc4',
                300: '#4db6ac',
                400: '#26a69a',
                500: '#009688',
                600: '#00897b',
                700: '#00796b',
                800: '#00695c',
                900: '#004d40'
            },
            'mat-green': {
                50: '#e8f5e9',
                100: '#c8e6c9',
                200: '#a5d6a7',
                300: '#81c784',
                400: '#66bb6a',
                500: '#4caf50',
                600: '#43a047',
                700: '#388e3c',
                800: '#2e7d32',
                900: '#1b5e20'
            },
            'mat-light-green': {
                50: '#f1f8e9',
                100: '#dcedc8',
                200: '#c5e1a5',
                300: '#aed581',
                400: '#9ccc65',
                500: '#8bc34a',
                600: '#7cb342',
                700: '#689f38',
                800: '#558b2f',
                900: '#33691e'
            },
            'mat-lime': {
                50: '#f9fbe7',
                100: '#f0f4c3',
                200: '#e6ee9c',
                300: '#dce775',
                400: '#d4e157',
                500: '#cddc39',
                600: '#c0ca33',
                700: '#afb42b',
                800: '#9e9d24',
                900: '#827717'
            },
            'mat-yellow': {
                50: '#fffde7',
                100: '#fff9c4',
                200: '#fff59d',
                300: '#fff176',
                400: '#ffee58',
                500: '#ffeb3b',
                600: '#fdd835',
                700: '#fbc02d',
                800: '#f9a825',
                900: '#f57f17'
            },
            'mat-amber': {
                50: '#fff8e1',
                100: '#ffecb3',
                200: '#ffe082',
                300: '#ffd54f',
                400: '#ffca28',
                500: '#ffc107',
                600: '#ffb300',
                700: '#ffa000',
                800: '#ff8f00',
                900: '#ff6f00'
            },
            'mat-orange': {
                50: '#fff3e0',
                100: '#ffe0b2',
                200: '#ffcc80',
                300: '#ffb74d',
                400: '#ffa726',
                500: '#ff9800',
                600: '#fb8c00',
                700: '#f57c00',
                800: '#ef6c00',
                900: '#e65100'
            },
            'mat-deep-orange': {
                50: '#fbe9e7',
                100: '#ffccbc',
                200: '#ffab91',
                300: '#ff8a65',
                400: '#ff7043',
                500: '#ff5722',
                600: '#f4511e',
                700: '#e64a19',
                800: '#d84315',
                900: '#bf360c'
            },
            'mat-brown': {
                50: '#efebe9',
                100: '#d7ccc8',
                200: '#bcaaa4',
                300: '#a1887f',
                400: '#8d6e63',
                500: '#795548',
                600: '#6d4c41',
                700: '#5d4037',
                800: '#4e342e',
                900: '#3e2723'
            },
            'mat-grey': {
                0: '#ffffff',
                50: '#fafafa',
                100: '#f5f5f5',
                200: '#eeeeee',
                300: '#e0e0e0',
                400: '#bdbdbd',
                500: '#9e9e9e',
                600: '#757575',
                700: '#616161',
                800: '#424242',
                900: '#212121',
                1000: '#000000'
            },
            'mat-blue-grey': {
                50: '#eceff1',
                100: '#cfd8dc',
                200: '#b0bec5',
                300: '#90a4ae',
                400: '#78909c',
                500: '#607d8b',
                600: '#546e7a',
                700: '#455a64',
                800: '#37474f',
                900: '#263238'
            }
        };
    }
    get colors() {
        if (!this._colors) {
            this._colors = [];
            Object.keys(this.palet).forEach(baseColorName => {
                const baseColor = MaterialColor.fromHex(this.palet[baseColorName]['500']);
                baseColor.subColors = [];
                baseColor.name = baseColorName;
                this._colors.push(baseColor);
                Object.keys(this.palet[baseColorName]).forEach(subColorName => {
                    const subColor = MaterialColor.fromHex(this.palet[baseColorName][subColorName]);
                    subColor.name = subColorName;
                    baseColor.subColors.unshift(subColor);
                });
            });
        }
        return this._colors;
    }
    getColor(name) {
        return this.palet[name];
    }
    getPalet(subColor) {
        if (!this.palettes) {
            this.palettes = {};
            Object.keys(this.palet).forEach(baseColorName => {
                const baseColorObj = this.palet[baseColorName];
                Object.keys(baseColorObj).forEach(subColorName => {
                    if (!this.palettes[subColorName]) {
                        this.palettes[subColorName] = [];
                    }
                    this.palettes[subColorName].push(Color.fromHex(this.palet[baseColorName][subColorName]));
                });
            });
        }
        return this.palettes[subColor];
    }
    getColorFromText(text) {
        let sum = 0;
        // eslint-disable-next-line no-loops/no-loops
        for (let i = 0; i < text.length; i++) {
            sum += text.charCodeAt(i);
        }
        const colors = this.colors;
        const subColors = (colors[sum % colors.length]).subColors;
        return subColors[sum % subColors.length];
    }
}
MaterialColorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialColorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
MaterialColorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialColorService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialColorService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root'
                }]
        }] });

/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */

/**
 * Generated bundle index. Do not edit.
 */

export { Circle, Color, Directions, IconService, MaterialColor, MaterialColorService, Position, Rect, Size, UnitValue };
//# sourceMappingURL=deja-js-component-core-graphics.mjs.map
