/*!
 * KoliBri - The accessible HTML-Standard
 */
'use strict';

var common = require('./common-DAAt5YQ7.js');
var index = require('./index-DBbl8tEq.js');

const initMeta = () => {
    try {
        const document = common.getDocument();
        if (!document || typeof document.querySelector !== 'function') {
            return;
        }
        const meta = document.querySelector('meta[name="kolibri"]');
        if (meta && meta.hasAttribute('content')) {
            const content = meta.getAttribute('content');
            if (typeof content === 'string') {
                common.setExperimentalMode(content.includes('experimental-mode=true'));
                common.setColorContrastAnalysis(content.includes('color-contrast-analysis=true'));
            }
        }
    }
    catch (_a) {
    }
};
const getKoliBri = () => {
    let kolibri = common.getWindow().KoliBri;
    if (kolibri === undefined) {
        kolibri = {};
        Object.defineProperty(common.getWindow(), 'KoliBri', {
            value: kolibri,
            writable: false,
        });
    }
    return kolibri;
};
const initKoliBri = () => {
    initMeta();
    common.Log.debug(`
,--. ,--.         ,--. ,--. ,-----.           ,--.
|  .'   /  ,---.  |  | \`--' |  |) /_  ,--.--. \`--'
|  .   '  | .-. | |  | ,--. |  .-.  \\ |  .--' ,--.
|  |\\   \\ | '-' | |  | |  | |  '--' / |  |    |  |
\`--' \`--´  \`---´  \`--' \`--' \`------´  \`--'    \`--'
🚹 The accessible HTML-Standard | 👉 https://public-ui.github.io | ${index.Env.kolibriVersion}
	`, {
        forceLog: true,
    });
};
const renderDevAdvice = () => {
    if (getKoliBri().adviceShown !== true) {
        Object.defineProperty(getKoliBri(), 'adviceShown', {
            get: function () {
                return true;
            },
        });
        common.Log.debug(`
You are using the KoliBri component library. If you have any suggestions for improvement or find a problem, please contact us:

Ticket: https://github.com/public-ui/kolibri/issues/new/choose (for privacy reasons, please use email)
Email: kolibri@itzbund.de
`);
    }
};
exports.nonce = () => Math.floor(Math.random() * 16777215).toString(16);
if (common.isTestMode()) {
    exports.nonce = () => 'nonce';
}
const createUniqueId = (prefix) => `${prefix}-${exports.nonce()}`;
const createRelatedUniqueId = (baseId, suffix) => {
    const separatorIndex = baseId.lastIndexOf('-');
    if (separatorIndex === -1)
        return `${baseId}-${suffix}`;
    const lastSegment = baseId.slice(separatorIndex + 1);
    const isNonce = lastSegment === 'nonce' || /^[0-9a-f]+$/.test(lastSegment);
    return isNonce ? `${baseId.slice(0, separatorIndex)}-${suffix}-${lastSegment}` : `${baseId}-${suffix}`;
};

exports.createRelatedUniqueId = createRelatedUniqueId;
exports.createUniqueId = createUniqueId;
exports.initKoliBri = initKoliBri;
exports.renderDevAdvice = renderDevAdvice;
//# sourceMappingURL=dev.utils-Cdn-EtYb.js.map

//# sourceMappingURL=dev.utils-Cdn-EtYb.js.map