const cachedStyles = new WeakSet();
export function adaptStatic(_target, context) {
    context.addInitializer(function () {
        let { styles } = this;
        if (!styles) {
            return;
        }
        if (!Array.isArray(styles)) {
            styles = [styles];
        }
        styles = styles.filter((i) => !cachedStyles.has(i));
        if (!styles.length) {
            return;
        }
        styles.forEach((i) => cachedStyles.add(i));
        const sheets = styles.map((i) => i.styleSheet).filter((i) => !!i);
        document.adoptedStyleSheets = [...document.adoptedStyleSheets, ...sheets];
    });
}
//# sourceMappingURL=styles.js.map