(function(window,document){'use strict';if(window.fiAwardColumnFitInstalled)return;window.fiAwardColumnFitInstalled=true; var scheduled=false,observed=new Map(); function fit(table){var heads=Array.from(table.querySelectorAll('thead tr:first-child th')),quantity=table.querySelector('.awards-col-quantity');if(!quantity||!table.getBoundingClientRect().width)return;var other=0; heads.forEach(function(th){th.style.boxSizing='border-box';if(th===quantity)return;var width;if(th.classList.contains('awards-col-medal')||th.classList.contains('awards-col-cup-count')){th.style.whiteSpace=th.classList.contains('awards-col-medal')?'nowrap':'normal';var lines=Array.from(th.querySelectorAll('.awards-heading-line'));if(!lines.length)lines=[th];var natural=0;lines.forEach(function(line){var range=document.createRange();range.selectNodeContents(line);natural=Math.max(natural,range.getBoundingClientRect().width);});var style=getComputedStyle(th);width=Math.ceil(natural+parseFloat(style.paddingLeft||0)+parseFloat(style.paddingRight||0)+parseFloat(style.borderLeftWidth||0)+parseFloat(style.borderRightWidth||0));}else{width=th.classList.contains('awards-col-category')?160:th.classList.contains('awards-col-stats')?115:th.classList.contains('awards-col-cups')?150:th.classList.contains('awards-col-team')?140:76;}th.style.width=width+'px';other+=width;}); var minimum=Math.max(1400,other+300),wrap=table.closest('.awards-table-wrap'),available=wrap?wrap.clientWidth:table.parentElement.clientWidth;table.style.minWidth=minimum+'px';quantity.style.width=Math.max(300,Math.floor(Math.max(minimum,available)-other))+'px'; } function refresh(){scheduled=false;observed.forEach(function(observer,table){if(!table.isConnected){observer.disconnect();observed.delete(table);}});document.querySelectorAll('#awardsPage .awards-table').forEach(function(table){fit(table);var wrap=table.closest('.awards-table-wrap');if(wrap&&!observed.has(table)&&window.ResizeObserver){var observer=new ResizeObserver(schedule);observed.set(table,observer);observer.observe(wrap);}});} function schedule(){if(scheduled)return;scheduled=true;requestAnimationFrame(refresh);} window.addEventListener('resize',schedule);if(document.fonts&&document.fonts.ready)document.fonts.ready.then(schedule); function start(){schedule();if(window.MutationObserver)new MutationObserver(function(records){if(records.some(function(record){return Array.from(record.addedNodes).concat(Array.from(record.removedNodes)).some(function(node){return node.nodeType===1&&(node.id==='awardsPage'||node.querySelector&&node.querySelector('#awardsPage'));});}))schedule();}).observe(document.body,{childList:true,subtree:true});} if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start);else start();window.fiAwardColumnFit=schedule; })(window,document);