/* pages/helper.js — Helper Bot: Authorized Servers (staff, admin+). Manages the helper_authorized_guilds allowlist via /api/v1/helper/guilds. Add a server (optional expiry for support cases) · revoke · see expiry/expired. */ (function () { 'use strict'; const esc = (s) => TD.escapeHtml(s == null ? '' : s); const escA = (s) => TD.escapeAttr(s == null ? '' : s); function fmtExpiry(item) { if (!item.expires_at) return 'No expiry'; const when = TD.fmtDate ? TD.fmtDate(item.expires_at) : item.expires_at; if (item.expired) return `Expired ${esc(when)}`; return `Until ${esc(when)}`; } function ensureStyles() { if (document.getElementById('hb-styles')) return; const s = document.createElement('style'); s.id = 'hb-styles'; s.textContent = ` .hb-row{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--border,rgba(255,255,255,.08)); border-radius:10px;margin-bottom:8px;background:var(--bg-2,#16161c)} .hb-ic{width:34px;height:34px;border-radius:8px;background:#2a2a33;flex-shrink:0;background-size:cover;background-position:center; display:flex;align-items:center;justify-content:center;font-weight:600;color:#aaa} .hb-main{flex:1;min-width:0} .hb-name{font-weight:600} .hb-sub{font-size:12px;color:var(--t-d,rgba(240,240,245,.5));margin-top:2px;word-break:break-word} .hb-pill{display:inline-block;font-size:11px;font-weight:600;padding:1px 8px;border-radius:999px} .hb-perm{background:rgba(139,92,246,.16);color:#a98bff} .hb-temp{background:rgba(59,130,246,.16);color:#6ea8fe} .hb-expired{background:rgba(239,68,68,.16);color:#f08a8a} .hb-muted{font-size:12px;color:var(--t-d,rgba(240,240,245,.5))} .hb-overlay{position:fixed;inset:0;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;z-index:1000} .hb-modal{background:var(--bg-1,#0f0f14);border:1px solid var(--border,rgba(255,255,255,.1));border-radius:14px; width:min(440px,92vw);padding:20px} .hb-modal h2{font-size:15px;margin:0 0 14px} .hb-field{margin-bottom:12px} .hb-field label{display:block;font-size:12px;color:var(--t-m,rgba(240,240,245,.7));margin-bottom:5px} .hb-input{width:100%;padding:9px 11px;border-radius:8px;border:1px solid var(--border,rgba(255,255,255,.12)); background:var(--bg-2,#16161c);color:var(--t,#f0f0f5);font-size:13px;box-sizing:border-box} .hb-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:6px} .hb-err{background:rgba(239,68,68,.1);border:1px solid rgba(239,68,68,.3);color:#f08a8a;padding:8px 11px; border-radius:8px;font-size:12.5px;margin-bottom:12px;display:none} `; document.head.appendChild(s); } async function load(listEl) { listEl.innerHTML = `
Servers where the Aperra Helper Bot may operate. Use an expiry for support cases so access lapses automatically. Admin+ only — every change is audited.