// Stylesheets are added at the end of
so that they have higher precedence
// than those in and above dark mode which is appended at the start of
const stylesheetContainer = document.createElement('div');
stylesheetContainer.style.display = 'none';
document.body.appendChild(stylesheetContainer);
/**
* Maps opaque module IDs to its ConditionalStyle.
* @type {Map}
*/
const allSheets = new Map();
/**
* Determine if the contents of a list are equal (===) to each other.
* @param {unknown[]} a The first list
* @param {unknown[]} b The second list
* @returns {boolean} true if the lists are identical
*/
const areArraysEqual = (a, b) => {
if (a.length !== b.length) {
return false;
}
for (let i = 0; i < a.length; a++) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
};
const updateAll = () => {
for (const sheet of allSheets.values()) {
sheet.update();
}
};
class ConditionalStyle {
/**
* @param {string} styleText CSS text
*/
constructor (styleText) {
/**
* Lazily created