/* micro-style-loader runtime */ function createStyleTag () { var head = document.head || document.getElementsByTagName('head')[0]; var style = document.createElement('style'); style.type = 'text/css'; head.appendChild(style); return style; } function removeTag (tag) { if (tag.parentNode) { tag.parentNode.removeChild(tag); } } // multi-tag mode function insertMultiple (source, map) { var style = createStyleTag(); var css = source; if (map) { var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(map)))); css += '\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64 + ' */'; } if (style.styleSheet) { style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } return function () { removeTag(style) }; } var singleTag = null; var uniqueIndex = 0; var textList = {}; function insertSingle (css) { // single tag mode does not support source maps // initialize the single tag if needed if (!singleTag) { singleTag = createStyleTag(); } function recomputeText () { var sortedKeys = Object.keys(textList) .sort(function(a,b) { return a - b; }) .map(function (key) { return textList[key] }) .join('\n') } if (singleTag.styleSheet) { // update textlist var currentIndex = uniqueIndex; uniqueIndex += 1; textList[currentIndex] = css; // update css text singleTag.styleSheet.cssText = recomputeText(); return function () { delete textList[currentIndex]; singleTag.styleSheet.cssText = recomputeText(); } } else { // append a text node to the style tag var textNode = document.createTextNode(css); singleTag.appendChild(textNode); return function () { remove(textNode); } } } var useSingleTag = false; var insert = useSingleTag ? insertSingle : insertMultiple; var modules = {}; function use (moduleId, source, map) { if (modules[moduleId]) { // module is already inserted if (modules[moduleId].source !== source) { modules[moduleId].remove(); // source changed: remove the module (and reinsert after) } else { return; // same source, nothing to do } } var removeStyle = insert(source, map); // ensure removeStyle is only called once a & when style is presented function remove () { if (modules[moduleId]) { removeStyle(); modules[moduleId] = null; } } var newModule = { source: source, map: map, remove: remove }; modules[moduleId] = newModule; return remove; } module.exports = { modules: modules, use: use };