import { d as documentNode, g as govWarningLog } from './gov.log-BtqD9K8d.js';
import { s as splitByWhitespace } from './string.utils-vN03FcXN.js';
import { i as isString } from './helpers.types-DNztiAH0.js';

const validateWcagProp = (value, propName, component) => {
    if (value === undefined || String(value).length === 0) {
        govWarningLog(`[${component}]: The (${propName}) attribute is important for correct accessibility.`);
    }
};
const validateWcagRef = (referenceId, name, component) => {
    if (typeof referenceId === 'undefined' || referenceId === undefined) {
        return true;
    }
    if (String(referenceId).length === 0) {
        govWarningLog(`[${component}]: Attribute (${name}) is defined with an empty value.`);
        return false;
    }
    let strings = [];
    const referenceIds = splitByWhitespace(referenceId);
    if (Array.isArray(referenceIds)) {
        strings = referenceIds.filter(function (e) {
            return isString(e) ? e.trim().length > 0 : false;
        });
    }
    return !!strings.filter(referenceId => {
        if (documentNode().getElementById(referenceId) === null) {
            //govWarningLog(`[${component}][${name}]: Reference to element with id (${referenceId}) does not exist.`)
            return false;
        }
        else {
            return true;
        }
    }).length;
};
const validateAccessibleLabel = (label, labelledBy, component, el = undefined) => {
    if (isString(label) && label.length > 0) {
        return true;
    }
    if (typeof labelledBy === 'string' && labelledBy.length > 0) {
        const labelledByEl = documentNode().getElementById(labelledBy);
        if (labelledByEl) {
            return true;
        }
    }
    govWarningLog(`[${component}]: The element has no defined aria-label or aria-labelledby attribute.`, el);
    return false;
};

export { validateWcagRef as a, validateWcagProp as b, validateAccessibleLabel as v };
//# sourceMappingURL=wcag-CD6_13JO.js.map

//# sourceMappingURL=wcag-CD6_13JO.js.map