const e=document.querySelector("form"),r=document.querySelector(".message-container"),t=document.querySelector("input[type=submit]");function n(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s(e){return(e??[]).map(n).join("<br>")}e.addEventListener("submit",(a=>{a.preventDefault();const o=t.value;t.disabled=!0,t.value="Importing…",r.innerHTML="";const i=new Request(e.action,{method:"POST",body:new FormData(e)});fetch(i).then((e=>e.json().then((({messages:t})=>{200===e.status?r.innerHTML=`<p class="msg success">${s(t)} You might want to <a href="update">update now</a> or <a href="./">view your feeds</a>.</p>`:202===e.status?r.innerHTML=`<p class="msg error">The following feeds could not be imported:<br>${s(t)}</p>`:400===e.status?r.innerHTML=`<p class="msg error">There was a problem importing your OPML file:<br>${s(t)}</p>`:r.innerHTML=`<p class="msg error">Unexpected happened. <details><pre>${n(JSON.stringify(t))}</pre></details></p>`})))).catch((e=>{r.innerHTML=`<p class="msg error">Unexpected happened. <details><pre>${n(JSON.stringify(e))}</pre></details></p>`})).finally((()=>{t.disabled=!1,t.value=o}))}));
//# sourceMappingURL=opml.1c191e1e.js.map
