// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0-or-later
import{PopStateHandlers as u,post as i}from"../utils/utils.js";const n=document.getElementById("text"),s=document.getElementById("config-textarea"),a=document.getElementById("output"),t=document.getElementById("error-msg");t.innerHTML.trim()&&alert(t.innerHTML.trim());function r(e,l=!1){if(!e){console.log("data is falsy!");return}if(e.error){o(e);return}l||(e.stateType="swappedWords",window.history.pushState(e,"Vertauschte Wörter",window.location.href)),n.value=e.text||"",s.value=e.config||"",a.innerText=e.replaced_text||"",t.innerText=""}function o(e){console.error(e),e.error?(alert(e.error),t.innerText="".concat(e.error," In line ").concat(e.line_num,': "').concat(e.line,'"')):(alert(e),t.innerText=JSON.stringify(e))}document.getElementById("form").onsubmit=e=>{e.preventDefault()};document.getElementById("reset").onclick=()=>i("/api/vertauschte-woerter",{text:n.value,minify_config:!1,return_config:!0},r,o);document.getElementById("submit").onclick=()=>i("/api/vertauschte-woerter",{text:n.value||"",config:s.value||"",minify_config:!1,return_config:!0},r,o);u.swappedWords=e=>{e.state&&r(e.state,!0)};// @license-end
//# sourceMappingURL=swap.js.map
