// @ts-check
(()=>{
  'use strict';
  const App=window.IUS_TEMPLATE,{utils}=App,q=s=>utils.$(s);
  function icon(platform){return `<svg aria-hidden="true"><use href="#icon-${utils.escapeHtml(platform)}"></use></svg>`}
  function render(){const host=q('[data-social-list]');if(!host)return;host.replaceChildren();(App.data.siteConfig.socials||[]).filter(s=>s.url).forEach(s=>{const a=document.createElement('a');a.href=s.url;a.target='_blank';a.rel='noopener noreferrer';a.innerHTML=`${icon(s.platform)}<span>${utils.escapeHtml(s.label)}</span>`;host.append(a)})}
  function init(){utils.$$('[data-social-open]').forEach(b=>b.addEventListener('click',()=>{render();utils.openDialog(q('[data-social-dialog]'),b)}));utils.$$('[data-social-close]').forEach(b=>b.addEventListener('click',()=>utils.closeDialog(q('[data-social-dialog]'))))}
  App.modules.socials={init,render};
})();
