// Generated, do not edit. sha256:bee329db148fa1f318902e8add4230015eac6bdf80b4700aa7a993e8d1c5e7ee import { momentumOf } from '../price/momentum.js'; import { esc } from '../ui/escape.js'; import { t } from '../i18n/index.js'; export function momentumOn(instance) { const p = instance && instance.params; return !(p && p.momentum === false); } export function momentumDotHtml(assetId, on) { if (!on || assetId == null) return ''; const { up, down, tone } = momentumOf(assetId); if (!tone) return ''; const n = up + down; const pct = Math.round(((tone === 'up' ? up : down) / n) * 100); const hint = t(tone === 'up' ? 'dashboard.momentumUp' : 'dashboard.momentumDown', { pct, n }); return ``; } export function renderMomentumSetting(host, instance, commit) { const row = document.createElement('div'); row.className = 'dash-set-row'; row.innerHTML = ``; host.appendChild(row); row.addEventListener('change', e => { const box = e.target.closest('[data-momentum]'); if (!box) return; instance.params = { ...(instance.params || {}), momentum: box.checked }; commit(); }); }