(function () { 'use strict'; const importModal = new bootstrap.Modal(document.getElementById('importModal')); let currentLibraryItemId = null; // Open preview modal when any "Preview & Import" button is clicked document.getElementById('libraryGrid')?.addEventListener('click', function (e) { const btn = e.target.closest('.btn-import'); if (!btn) return; currentLibraryItemId = parseInt(btn.dataset.itemId, 10); const itemName = btn.dataset.itemName; document.getElementById('importModalLabel').textContent = 'Import — ' + itemName; document.getElementById('importModalBody').innerHTML = '
Loading formula details…
${escHtml(d.name)}${alreadyBadge}
${escHtml(d.sourceCompanyName)}
${inspiredRow} ${d.description ? `${escHtml(d.description)}
` : ''}Default rate: ${escHtml(String(d.defaultRate))} ${escHtml(d.rateLabel || '')}
` : ''} ${d.notes ? `${escHtml(d.notes)}
` : ''}| Field | Unit | Default |
|---|
No fields defined.
'}${escHtml(d.formula)}