(function () {
"use strict";
function applyOne(el) {
var spec = el.getAttribute("data-sx-style");
if (!spec) return;
var decls = spec.split(";");
for (var i = 0; i < decls.length; i++) {
var d = decls[i];
if (!d) continue;
var c = d.indexOf(":");
if (c < 0) continue;
var prop = d.slice(0, c).trim();
var val = d.slice(c + 1).trim();
if (prop) el.style.setProperty(prop, val);
}
el.removeAttribute("data-sx-style");
}
function apply(root) {
if (!root) root = document;
if (root.nodeType === 1 && root.hasAttribute("data-sx-style")) applyOne(root);
var list = root.querySelectorAll ? root.querySelectorAll("[data-sx-style]") : [];
for (var i = 0; i < list.length; i++) applyOne(list[i]);
}
window.sxApply = apply;
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", function () { apply(document); });
} else {
apply(document);
}
window.__sxCss = "";
try {
fetch("/static/app.css").then(function (r) { return r.text(); })
.then(function (t) { window.__sxCss = t; }).catch(function () {});
} catch (e) { }
window.sxSelfContain = function (html) {
if (!window.__sxCss) return html;
return html.replace(
/<link\b[^>]*href="\/static\/app\.css"[^>]*>/,
"<style>" + window.__sxCss + "</style>"
);
};
if (typeof MutationObserver === "function") {
new MutationObserver(function (muts) {
for (var i = 0; i < muts.length; i++) {
var added = muts[i].addedNodes;
for (var j = 0; j < added.length; j++) {
if (added[j].nodeType === 1) apply(added[j]);
}
}
}).observe(document.documentElement, { childList: true, subtree: true });
}
})();