import { globalConfig } from "../../global/config";
/**
 * Component used to set global configuration for Lime Elements.
 *
 * :::warning
 * **Building something for Lime CRM?** Then you should _NOT_ use this component.
 * Lime CRM already uses this component to set the global configuration for
 * Lime Elements. No matter what problem you are facing at the moment, using
 * this component will not help, and might cause other problems.
 * :::
 *
 * Building your own software, which is using Lime Elements?
 * Then you _might_ need to use this component.
 *
 * @private
 */
export class ConfigComponent {
    componentDidLoad() {
        this.setGlobalConfig();
    }
    componentDidUpdate() {
        this.setGlobalConfig();
    }
    /*
     * Copy any config settings to the global config object
     */
    setGlobalConfig() {
        if (!this.config) {
            return;
        }
        for (const key of Object.keys(this.config)) {
            globalConfig[key] = this.config[key];
        }
    }
    render() {
        return null;
    }
    static get is() { return "limel-config"; }
    static get encapsulation() { return "shadow"; }
    static get properties() {
        return {
            "config": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "Config",
                    "resolved": "{ iconPath?: string; defaultLocale?: string; markdownWhitelist?: CustomElementDefinition[]; featureSwitches?: Record<string, boolean>; }",
                    "references": {
                        "Config": {
                            "location": "import",
                            "path": "../../global/config",
                            "id": "src/global/config.ts::Config",
                            "referenceLocation": "Config"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Global configuration for Lime Elements."
                },
                "getter": false,
                "setter": false
            }
        };
    }
}
