import { memoize } from 'lodash-es';
export const getIcon = memoize((name) => import('./lib/generated').then(m => m[`nxIcon${name}`]));
export const extractAllColors = memoize(async () => {
    const allIcons = await import('./lib/generated');
    const allSvgData = Object.values(allIcons)
        .map(({ data }) => data)
        .join('');
    const tempElement = document.createElement('div');
    tempElement.innerHTML = allSvgData;
    const colors = new Set();
    tempElement.querySelectorAll('[fill], [stroke]').forEach(el => {
        const fill = el.getAttribute('fill');
        const stroke = el.getAttribute('stroke');
        if (fill) {
            colors.add(fill);
        }
        if (stroke) {
            colors.add(stroke);
        }
    });
    return [...colors];
});
export const removeInlineStyles = memoize((svg) => svg.replace(/fill="[^"]*"/g, 'apply-fill').replace(/stroke="[^"]*"/g, 'apply-stroke'));
export const fullHeightAutoWidth = memoize((svg) => svg.replace(/(<svg.*?)(>)/g, '$1 style="height: 100%; width: auto"$2'));
export const removeHeight = memoize((svg) => svg.replace(/(<svg.*?)height=".*?"(.*?>)/g, '$1$2'));
export const removeWidth = memoize((svg) => svg.replace(/(<svg.*?)width=".*?"(.*?>)/g, '$1$2'));
export * from './types';
//# sourceMappingURL=index.js.map