(function premiumUi() {
const ready = (fn) => {
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", fn, { once: true });
} else {
fn();
}
};
ready(() => {
document.documentElement.classList.add("premium-ui");
syncActivePanelState();
ensureReferenceWorkspace();
ensureDashboardRail();
bindReplicaBindings();
updateReplicaBindings();
updateDashboardRail();
addRevealStagger();
bindSpotlights();
bindPanelPulse();
observeDynamicCards();
window.setInterval(updateDashboardRail, 1800);
window.setInterval(updateReplicaBindings, 1200);
});
function addRevealStagger(root = document) {
const groups = [
".overviewCard",
".configRail",
".workspaceHeader",
".panel.active",
".card[data-panel]",
".statsGrid .stat",
".chartBlock",
".premiumConfigCard",
];
let index = 0;
root.querySelectorAll(groups.join(",")).forEach((el) => {
if (el.dataset.premiumReveal === "1") return;
el.dataset.premiumReveal = "1";
el.style.setProperty("--stagger", String(Math.min(index, 12)));
el.classList.add("premiumReveal");
index += 1;
});
}
function bindSpotlights(root = document) {
const selector = [
".header",
".overviewCard",
".card",
".panel",
".workspaceHeader",
".chartBlock",
".stat",
".reservationItem",
".btn",
".tabBtn",
".premiumConfigCard",
".premiumField",
].join(",");
root.querySelectorAll(selector).forEach((el) => {
if (el.dataset.premiumSpotlight === "1") return;
el.dataset.premiumSpotlight = "1";
let raf = 0;
let lastEvent = null;
const update = () => {
raf = 0;
if (!lastEvent) return;
const rect = el.getBoundingClientRect();
const x = ((lastEvent.clientX - rect.left) / Math.max(rect.width, 1)) * 100;
const y = ((lastEvent.clientY - rect.top) / Math.max(rect.height, 1)) * 100;
el.style.setProperty("--mx", `${Math.max(0, Math.min(100, x)).toFixed(2)}%`);
el.style.setProperty("--my", `${Math.max(0, Math.min(100, y)).toFixed(2)}%`);
};
el.addEventListener("pointermove", (event) => {
if (window.matchMedia && window.matchMedia("(pointer: coarse)").matches) return;
lastEvent = event;
if (!raf) raf = requestAnimationFrame(update);
}, { passive: true });
el.addEventListener("pointerleave", () => {
lastEvent = null;
if (raf) cancelAnimationFrame(raf);
raf = 0;
el.style.removeProperty("--mx");
el.style.removeProperty("--my");
}, { passive: true });
});
}
function bindPanelPulse() {
document.querySelectorAll(".tabBtn[data-target]").forEach((btn) => {
if (btn.dataset.premiumTabBound === "1") return;
btn.dataset.premiumTabBound = "1";
btn.addEventListener("click", () => {
syncActivePanelState(btn.dataset.target);
window.requestAnimationFrame(() => {
const target = btn.dataset.target;
const panel = findPanelByTarget(target);
if (!panel) return;
panel.classList.remove("isPremiumPulse");
void panel.offsetWidth;
panel.classList.add("isPremiumPulse");
setTimeout(() => panel.classList.remove("isPremiumPulse"), 620);
addRevealStagger(panel);
bindSpotlights(panel);
});
});
});
}
function findPanelByTarget(target) {
if (!target) return null;
try {
if (window.CSS && typeof window.CSS.escape === "function") {
return document.querySelector(`.panel[data-panel="${window.CSS.escape(target)}"]`);
}
} catch (_) {}
return Array.from(document.querySelectorAll(".panel[data-panel]"))
.find((panel) => panel.dataset.panel === target) || null;
}
function syncActivePanelState(target) {
const activeTarget = target
|| document.querySelector(".tabBtn.active[data-target]")?.dataset.target
|| "device";
document.documentElement.dataset.premiumPanel = activeTarget;
if (activeTarget === "device") {
const workspace = document.querySelector(".configWorkspace");
if (workspace) workspace.scrollTop = 0;
}
}
function ensureReferenceWorkspace() {
const workspace = document.querySelector(".configWorkspace");
if (!workspace || workspace.querySelector(".premiumReplica")) return;
const replica = document.createElement("div");
replica.className = "premiumReplica";
replica.innerHTML = `