var C = "\u037c" var COUNT = typeof Symbol == "undefined" ? "__" + C : Symbol.for(C) var SET = typeof Symbol == "undefined" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet") var top = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : {} // :: - Style modules encapsulate a set of CSS rules defined from // JavaScript. Their definitions are only available in a given DOM // root after it has been _mounted_ there with `StyleModule.mount`. // // Style modules should be created once and stored somewhere, as // opposed to re-creating them every time you need them. The amount of // CSS rules generated for a given DOM root is bounded by the amount // of style modules that were used. So to avoid leaking rules, don't // create these dynamically, but treat them as one-time allocations. var StyleModule = exports.StyleModule = function StyleModule(spec, options) { this.rules = [] var ref = options || {}; var finish = ref.finish; function splitSelector(selector) { return /^@/.test(selector) ? [selector] : selector.split(/,\s*/) } function render(selectors, spec, target, isKeyframes) { var local = [], isAt = /^@(\w+)\b/.exec(selectors[0]), keyframes = isAt && isAt[1] == "keyframes" if (isAt && spec == null) { return target.push(selectors[0] + ";") } for (var prop in spec) { var value = spec[prop] if (/&/.test(prop)) { render(prop.split(/,\s*/).map(function (part) { return selectors.map(function (sel) { return part.replace(/&/, sel); }); }).reduce(function (a, b) { return a.concat(b); }), value, target) } else if (value && typeof value == "object") { if (!isAt) { throw new RangeError("The value of a property (" + prop + ") should be a primitive value.") } render(splitSelector(prop), value, local, keyframes) } else if (value != null) { local.push(prop.replace(/_.*/, "").replace(/[A-Z]/g, function (l) { return "-" + l.toLowerCase(); }) + ": " + value + ";") } } if (local.length || keyframes) { target.push((finish && !isAt && !isKeyframes ? selectors.map(finish) : selectors).join(", ") + " {" + local.join(" ") + "}") } } for (var prop in spec) { render(splitSelector(prop), spec[prop], this.rules) } }; // :: () → string // Returns a string containing the module's CSS rules. StyleModule.prototype.getRules = function getRules () { return this.rules.join("\n") }; // :: () → string // Generate a new unique CSS class name. StyleModule.newName = function newName () { var id = top[COUNT] || 1 top[COUNT] = id + 1 return C + id.toString(36) }; // :: (union, union<[StyleModule], StyleModule>, ?{nonce: ?string}) // // Mount the given set of modules in the given DOM root, which ensures // that the CSS rules defined by the module are available in that // context. // // Rules are only added to the document once per root. // // Rule order will follow the order of the modules, so that rules from // modules later in the array take precedence of those from earlier // modules. If you call this function multiple times for the same root // in a way that changes the order of already mounted modules, the old // order will be changed. // // If a Content Security Policy nonce is provided, it is added to // the `