"use strict";window.onload=async()=>{const m=JSON.parse(localStorage.getItem("account")).token,E=(e,t={})=>new Promise((d,a)=>{m&&(t.i=m),fetch(e.indexOf("://")>-1?e:`/api/${e}`,{method:"POST",body:JSON.stringify(t),credentials:"omit",cache:"no-cache"}).then(async n=>{const o=n.status===204?null:await n.json();n.status===200?d(o):n.status===204?d():a(o.error)}).catch(a)}),u=document.getElementById("content");document.getElementById("ls").addEventListener("click",()=>{u.innerHTML="";const e=document.createElement("div");e.id="lsEditor";const t=document.createElement("div");t.classList.add("adder");const l=document.createElement("input"),d=document.createElement("textarea"),a=document.createElement("button");a.textContent="Add",a.addEventListener("click",()=>{localStorage.setItem(l.value,d.value),location.reload()}),t.appendChild(l),t.appendChild(d),t.appendChild(a),e.appendChild(t);for(let n=0;n<localStorage.length;n++){const o=localStorage.key(n),c=document.createElement("div");c.classList.add("record");const p=document.createElement("header");p.textContent=o;const r=document.createElement("textarea");r.textContent=localStorage.getItem(o);const i=document.createElement("button");i.textContent="Save",i.addEventListener("click",()=>{localStorage.setItem(o,r.value),location.reload()});const s=document.createElement("button");s.textContent="Remove",s.addEventListener("click",()=>{localStorage.removeItem(o),location.reload()}),c.appendChild(p),c.appendChild(r),c.appendChild(i),c.appendChild(s),e.appendChild(c)}u.appendChild(e)})};
