let w=256;let h=256;let r=1;let sl=(t)=>new Promise((r)=>setTimeout(r,t));let td=(s)=>({s:s,x:parseInt(s.substr(0,2),16),y:parseInt(s.substr(2,2),16),c:"#"+s.substr(4,3)});let tdl=(l)=>l.split(',').map((s)=>td(s));let lh=async(id)=>{try{let u='/content/'+id;if(location.host=="test-sq.unisat.io")u='/inscription'+u;let x=new XMLHttpRequest();x.open("GET",u,false);x.send(null);if(x.status===200){let d=x.responseText;const doc=new DOMParser().parseFromString(d,'text/html');const pstr=await getSnapshotData(doc);if(pstr!=null)return{p:pstr,c:null};let _p=d.match(/(?<=let p=")[^"]+/g);let _c=d.match(/(?<=let c=")[^"]+/g);let dd={p:(_p!=null?_p[0]:null),c:(_c!=null?_c[0]:null)};return dd}}catch(error){}};let dp=(l,needCanvas=false)=>{const c=document.createElement('canvas');const t=c.getContext('2d');c.width=w*r;c.height=h*r;l.reverse().forEach(p=>{t.fillStyle=p.c;t.fillRect(p.x*r,p.y*r,r,r)});if(needCanvas)return c;return c.toDataURL('image/png')};