| 104 | } |
| 105 | |
| 106 | function resolveActiveSourceId() { |
| 107 | try { |
| 108 | if (typeof window.__frGetActiveSourceId === 'function') { |
| 109 | const v = window.__frGetActiveSourceId(); |
| 110 | if (v) return String(v).trim(); |
| 111 | } |
| 112 | } catch (e) { /* ignore */ } |
| 113 | const sel = document.getElementById('sourceSelector'); |
| 114 | if (sel && sel.value) return String(sel.value).trim(); |
| 115 | try { |
| 116 | const stored = localStorage.getItem('fr_active_source'); |
| 117 | if (stored) return String(stored).trim(); |
| 118 | } catch (e) { /* ignore */ } |
| 119 | return ''; |
| 120 | } |
| 121 | |
| 122 | function isRemoteSourceId(sourceId) { |
| 123 | const id = String(sourceId || '').trim(); |