',e.util.clobberBody=function(e){document.body.innerHTML=e},e.util.clobberDocument=function(e){e.responseText&&(e=e.responseText),document.documentElement&&document.removeChild(document.documentElement);var t=document.open("text/html","replace");t.writeln(e),t.close(),setTimeout(function(){var e=t.querySelector("[autofocus]");e&&e.focus()},100)},e.util.serializeForm=function(e){if(e&&"FORM"===e.nodeName){var t,n,r={};for(t=e.elements.length-1;t>=0;t-=1)if(""!==e.elements[t].name)switch(e.elements[t].nodeName){case"INPUT":switch(e.elements[t].type){default:case"text":case"hidden":case"password":case"button":case"reset":case"submit":r[e.elements[t].name]=e.elements[t].value;break;case"checkbox":case"radio":e.elements[t].checked&&(r[e.elements[t].name]=e.elements[t].value);break;case"file":}break;case"TEXTAREA":r[e.elements[t].name]=e.elements[t].value;break;case"SELECT":switch(e.elements[t].type){case"select-one":r[e.elements[t].name]=e.elements[t].value;break;case"select-multiple":for(n=e.elements[t].options.length-1;n>=0;n-=1)e.elements[t].options[n].selected&&(r[e.elements[t].name]=e.elements[t].options[n].value)}break;case"BUTTON":switch(e.elements[t].type){case"reset":case"submit":case"button":r[e.elements[t].name]=e.elements[t].value}}return r}},e.util.on=function(e,t,n,r){r=r||document;var o="locksmith-"+e+t,i=function(e){var r=e.target,i=e.target.parentElement,a=r.className.baseVal||r.className||"",s=i.className.baseVal||i.className||"";("string"==typeof a&&-1!==a.split(/\s+/).indexOf(t)||"string"==typeof s&&-1!==s.split(/\s+/).indexOf(t))&&!e[o]&&(e[o]=!0,n(e))};r.attachEvent?r.attachEvent(e,i):r.addEventListener(e,i,!1)},e.util.enableActions=function(t){e.util.on("click","locksmith-action",function(t){t.preventDefault();var n=t.target;(!n.dataset.confirmWith||confirm(n.dataset.confirmWith))&&(n.disabled=!0,n.innerText=n.dataset.disableWith,e.post("/action",n.dataset.locksmithParams,{spinner:!1,type:"text",success:function(t){t=JSON.parse(t.responseText),t.message&&alert(t.message),e.util.reload()}}))},t)},e.util.inject=function(e,t){var n=["data","locksmith","append"];if(-1!==t.indexOf(n.join("-"))){var r=document.createElement("div");r.innerHTML=t,e.appendChild(r)}else e.innerHTML=t;var o,i,a=e.querySelectorAll("script");for(i=0;i0&&e.showMessages(t.messages)}})}},e.showMessages=function(t){var n=document.createElement("div");n.style.position="fixed",n.style.left=0,n.style.right=0,n.style.bottom="-50px",n.style.opacity=0,n.style.background="#191919",n.style.color="#ddd",n.style.transition="bottom 0.2s, opacity 0.2s",n.style.zIndex=999999,n.innerHTML=" "+t.map(function(e){return'