scrobble.life
#propolis-wallet

Propolis Wallet v1 (EN)

Propolis Wallet v1 (EN)

Self-contained Hive wallet distributed on-chain.

SHA-256: a2bc162a862b2d10018e6d3861d568c23c1c02245cfa39b617716f19b73f58cd Size: 166.8 KB Parts: 4

This post and its comments contain the complete wallet application. Use the Propolis bootstrap loader or the reassemble script to build the wallet from these parts.


Published by @propolis-publish using Propolis distribution tools.

Comments · 9

  • ar b=sa(a);if(!b)return null;for(let e of b){b=pa(a,e);var c=b.matrix;if(null==c)c=null;else{var d=L(c);if(d)c=d;else{for(d=0;d<c.width;d++)for(let f=d+1;f<c.height;f++)c.get(d,f)!==c.get(f,d)&&(c.set(d,f,!c.get(d,f)),c.set(f,d,!c.get(f,d)));c=L(c)}}if(c)return{binaryData:c.bytes,data:c.text,chunks:c.chunks,version:c.version,location:{topRightCorner:b.mappingFunction(e.dimension,0),topLeftCorner:b.mappingFunction(0,0),bottomRightCorner:b.mappingFunction(e.dimension,e.dimension),bottomLeftCorner:b.mappingFunction(0,
    e.dimension),topRightFinderPattern:e.topRight,topLeftFinderPattern:e.topLeft,bottomLeftFinderPattern:e.bottomLeft,bottomRightAlignmentPattern:e.alignmentPattern},matrix:b.matrix}}return null}let ta={inversionAttempts:"attemptBoth",greyScaleWeights:{red:.2126,green:.7152,blue:.0722,useIntegerApproximation:!1},canOverwriteImage:!0};function W(a,b){Object.keys(b).forEach(c=>{a[c]=b[c]})}
    function X(a,b,c,d={}){let e=Object.create(null);W(e,ta);W(e,d);d="onlyInvert"===e.inversionAttempts||"invertFirst"===e.inversionAttempts;var f="attemptBoth"===e.inversionAttempts||d;var g=e.greyScaleWeights,h=e.canOverwriteImage,k=b*c;if(a.length!==4*k)throw Error("Malformed data passed to binarizer.");var m=0;if(h){var l=new Uint8ClampedArray(a.buffer,m,k);m+=k}l=new A(b,c,l);if(g.useIntegerApproximation)for(var n=0;n<c;n++)for(var q=0;q<b;q++){var r=4*(n*b+q);l.set(q,n,g.red*a[r]+g.green*a[r+1]+
    g.blue*a[r+2]+128>>8)}else for(n=0;n<c;n++)for(q=0;q<b;q++)r=4*(n*b+q),l.set(q,n,g.red*a[r]+g.green*a[r+1]+g.blue*a[r+2]);g=Math.ceil(b/8);n=Math.ceil(c/8);q=g*n;if(h){var u=new Uint8ClampedArray(a.buffer,m,q);m+=q}u=new A(g,n,u);for(q=0;q<n;q++)for(r=0;r<g;r++){var p=Infinity,t=0;for(var v=0;8>v;v++)for(let w=0;8>w;w++){let aa=l.get(8*r+w,8*q+v);p=Math.min(p,aa);t=Math.max(t,aa)}v=(p+t)/2;v=Math.min(255,1.11*v);24>=t-p&&(v=p/2,0<q&&0<r&&(t=(u.get(r,q-1)+2*u.get(r-1,q)+u.get(r-1,q-1))/4,p<t&&(v=t)));
    u.set(r,q,v)}h?(q=new Uint8ClampedArray(a.buffer,m,k),m+=k,q=new x(q,b)):q=x.createEmpty(b,c);r=null;f&&(h?(a=new Uint8ClampedArray(a.buffer,m,k),r=new x(a,b)):r=x.createEmpty(b,c));for(b=0;b<n;b++)for(a=0;a<g;a++){c=g-3;c=2>a?2:a>c?c:a;h=n-3;h=2>b?2:b>h?h:b;k=0;for(m=-2;2>=m;m++)for(p=-2;2>=p;p++)k+=u.get(c+m,h+p);c=k/25;for(h=0;8>h;h++)for(k=0;8>k;k++)m=8*a+h,p=8*b+k,t=l.get(m,p),q.set(m,p,t<=c),f&&r.set(m,p,!(t<=c))}f=f?{binarized:q,inverted:r}:{binarized:q};let {binarized:z,inverted:y}=f;(f=V(d?
    y:z))||"attemptBoth"!==e.inversionAttempts&&"invertFirst"!==e.inversionAttempts||(f=V(d?z:y));return f}X.default=X;let Y="dontInvert",Z={red:77,green:150,blue:29,useIntegerApproximation:!0};
    self.onmessage=a=>{let b=a.data.id,c=a.data.data;switch(a.data.type){case "decode":(a=X(c.data,c.width,c.height,{inversionAttempts:Y,greyScaleWeights:Z}))?self.postMessage({id:b,type:"qrResult",data:a.data,cornerPoints:[a.location.topLeftCorner,a.location.topRightCorner,a.location.bottomRightCorner,a.location.bottomLeftCorner]}):self.postMessage({id:b,type:"qrResult",data:null});break;case "grayscaleWeights":Z.red=c.red;Z.green=c.green;Z.blue=c.blue;Z.useIntegerApproximation=c.useIntegerApproximation;
    break;case "inversionMode":switch(c){case "original":Y="dontInvert";break;case "invert":Y="onlyInvert";break;case "both":Y="attemptBoth";break;default:throw Error("Invalid inversion mode");}break;case "close":self.close()}}
    `]),{type:"application/javascript"})),ci=Object.freeze(Object.defineProperty({__proto__:null,createWorker:ai},Symbol.toStringTag,{value:"Module"}));</script>
      <style rel="stylesheet" crossorigin>*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:root{--bg:#1a1a2e;--sf:#16213e;--in:#0f3460;--tx:#e8e8e8;--tm:#a0a0b0;--ac:#e94560;--ah:#ff6b81;--ok:#4ecca3;--wn:#f0c040;--er:#e94560;--bd:#2a2a4a;--r:8px}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;background:var(--bg);color:var(--tx);min-height:100vh;line-height:1.5}.ct{max-width:480px;margin:0 auto;padding:24px 16px}h1{font-size:1.5rem;margin-bottom:8px}h2{font-size:1.2rem;margin-bottom:12px}p{margin-bottom:8px}button{background:var(--ac);color:var(--tx);border:none;padding:10px 20px;border-radius:var(--r);cursor:pointer;font-size:1rem;width:100%;margin-bottom:8px}button:hover{background:var(--ah)}button:disabled{opacity:.5;cursor:not-allowed}.btn-s{background:var(--sf);border:1px solid var(--bd)}.btn-ok{background:var(--ok)}.btn-er{background:var(--er)}input,textarea,select{background:var(--in);color:var(--tx);border:1px solid var(--bd);padding:10px 12px;border-radius:var(--r);font-size:1rem;width:100%;margin-bottom:12px}input:focus,textarea:focus,select:focus{outline:none;border-color:var(--ac)}label{display:block;font-size:.85rem;color:var(--tm);margin-bottom:4px}.card{background:var(--sf);border:1px solid var(--bd);border-radius:var(--r);padding:16px;margin-bottom:12px}.ba{font-size:1.8rem;font-weight:700}.bl{font-size:.85rem;color:var(--tm)}.sm{font-size:.85rem}.xs{font-size:.75rem}.err{color:var(--er);font-size:.85rem}.ok{color:var(--ok);font-size:.85rem}.wrn{color:var(--wn);font-size:.85rem}.mt{color:var(--tm)}.gc{color:var(--ok)}.g2{display:grid;grid-template-columns:1fr 1fr;gap:12px}.mb{margin-bottom:12px}.mt1{margin-top:8px}.mt2{margin-top:12px}.info{padding:8px;background:var(--in);border-radius:var(--r)}.fx{display:flex;gap:8px}nav{display:flex;gap:4px;margin-bottom:16px;overflow-x:auto}nav a{color:var(--tm);text-decoration:none;padding:8px 12px;border-radius:var(--r);font-size:.85rem;white-space:nowrap}nav a.active{background:var(--sf);color:var(--tx)}nav a:hover{color:var(--tx)}.hidden{display:none}[dir=rtl],[dir=rtl] input,[dir=rtl] textarea,[dir=rtl] select{text-align:right}[dir=rtl] nav{flex-direction:row-reverse}[dir=rtl] .fx{flex-direction:row-reverse}</style>
    </head>
    <body>
      <div id="app"></div>
    
    </body>
    </html>
    
  • o),l=$e("#b",o),d=$e("#e",o),u=$e("#s",o);n.addEventListener("blur",()=>{n.value=n.value.trim().toLowerCase().replace("@","")}),r&&(i.value=r);const f=(b,w)=>{b.textContent=w,b.classList.remove("hidden")},h=(...b)=>b.forEach(w=>w.classList.add("hidden")),p=o.querySelector("#qr");p&&p.addEventListener("click",async()=>{try{const b=await Fs();if(!b)return;h(d,u);const w=Vs(b);w.type==="combined"?(n.value=w.account,s.value=w.activeWif,w.memoWif&&(i.value=w.memoWif),f(u,m.qr_filled_all)):w.type==="wif"?s.value?i.value?(s.value=w.key,f(u,m.qr_filled_active)):(i.value=w.key,f(u,m.qr_filled_memo)):(s.value=w.key,f(u,m.qr_filled_active)):f(d,m.qr_unknown)}catch(b){f(d,b instanceof Error?b.message:m.qr_no_camera)}}),c.addEventListener("change",()=>a.classList.toggle("hidden",!c.checked)),l.addEventListener("click",async()=>{const b=n.value.trim().toLowerCase().replace("@",""),w=s.value.trim(),k=i.value.trim()||null;if(!b||!w){f(d,m.account_key_required);return}l.disabled=!0,h(d),f(u,m.validating);try{const B=await Ar(w,b);if(B.role!=="active"&&B.role!=="owner"){f(d,fe(m.wrong_key_role,B.role)),h(u),l.disabled=!1;return}if(k){const C=await Ar(k,b);if(C.role!=="memo"){f(d,fe(m.wrong_memo_role,C.role)),h(u),l.disabled=!1;return}}e.account=b,e.activeKeyWif=w,e.memoKeyWif=k,e.persistKeys=c.checked,t.saveState(),t.startDiscovery(),t.navigate("balance")}catch(B){_t(d,B),h(u),l.disabled=!1}})}async function js(o,e,t){o.innerHTML=`<div class="card"><p class="bl">${m.account_label}</p>
    <p style="font-size:1.1rem;font-weight:bold" class="mb">@${e.account}</p>
    <div id="b"><p class="mt">${m.loading}</p></div></div>
    <button class="btn-s" id="r">${m.refresh}</button>`;const r=o.querySelector("#b"),n=o.querySelector("#r");async function s(){r.innerHTML=`<p class="mt">${m.loading}</p>`,n.disabled=!0;try{const i=Ne(),c=await i.getAccounts([e.account]);if(!c.length){r.innerHTML=`<p class="err">${m.account_not_found}</p>`;return}const a=c[0],l=Fe(a.balance),d=Fe(a.hbd_balance),u=Fe(a.savings_balance),f=Fe(a.savings_hbd_balance);r.innerHTML=`<div class="g2">
    <div><p class="bl">${m.hive}</p><p class="ba">${l.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hbd}</p><p class="ba">${d.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hive_savings}</p><p class="ba">${u.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hbd_savings}</p><p class="ba gc">${f.amount.toFixed(3)}</p></div></div>
    ${f.amount>0?`<div class="info mt2"><p class="sm mt">${m.est_interest} <strong class="gc">~${(f.amount*.2).toFixed(3)} ${m.hbd_yr}</strong></p></div>`:""}
    ${a.savings_withdraw_requests>0?`<p class="wrn mt1">${fe(m.pending_withdrawals,a.savings_withdraw_requests)}</p>`:""}
    <p class="xs mt mt2">${m.rpc_label} ${i.currentEndpoint}${(()=>{const p=it().allEndpoints.find(b=>b.url===i.currentEndpoint);return p?` (${p.source})`:""})()}${Ls()?` | ${Wt()?`<span class="gc">${m.obfuscated}</span>`:`<span class="wrn">${m.direct}</span>`}`:""}</p>`}catch(i){r.innerHTML=`<p class="err">${sr(i instanceof Error?i.message:String(i))}</p>`}finally{n.disabled=!1}}n.addEventListener("click",s),await s()}function Ks(o,e,t,r=""){return["transfer",{from:o,to:e,amount:t,memo:r}]}function Zs(o,e,t,r=""){return["transfer_to_savings",{from:o,to:e,amount:t,memo:r}]}function Xs(o,e,t,r,n=""){return["transfer_from_savings",{from:o,request_id:e,to:t,amount:r,memo:n}]}function Ys(o,e){return["cancel_transfer_from_savings",{from:o,request_id:e}]}async function Ct(o,e){const r=Ne().getEndpoints();let n;for(let s=0;s<r.length;s++){ae.nodes=[r[s]];try{const i=new rr;for(const[a,l]of o)await i.addOperation(a,l);return i.sign(e.private),await i.broadcast(!0)}catch(i){n=i instanceof Error?i:new Error(String(i)),console.warn(`Broadcast via ${r[s]} failed: ${n.message}`)}}throw n??new Error("All RPC endpoints failed")}async function Gs(o,e,t){o.innerHTML=`<div class="card"><h2>${m.send_transfer}</h2>
    <label>${m.recipient}</label><input id="to" placeholder="${m.username_placeholder}" autocomplete="off" spellcheck="false">
    <label>${m.amount}</label><input type="number" id="am" placeholder="0.000" step="0.001" min="0.001">
    <label>${m.currency}</label><select id="cu"><option value="HBD">${m.hbd}</option><option value="HIVE">${m.hive}</option></select>
    <label>${m.memo_optional}</label><input id="me" placeholder="${m.public_memo}" autocomplete="off">
    <div id="cb" class="hidden mb"><div class="card" style="background:var(--bg);border-color:var(--wn)">
    <p class="sm" id="ct"></p><div class="fx mt2"><button class="btn-ok" id="y">${m.confirm}</button><button class="btn-s" id="n">${m.cancel}</button></div></div></div>
    <button id="s">${m.send}</button><p class="err hidden" id="e"></p><p class="ok hidden" id="o"></p></div>`;const r=o.querySelector("#to"),n=o.querySelector("#am"),s=o.querySelector("#cu"),i=o.querySelector("#me"),c=o.querySelector("#s"),a=o.querySelector("#cb"),l=o.querySelector("#ct"),d=o.querySelector("#y"),u=o.querySelector("#n"),f=o.querySelector("#e"),h=o.querySelector("#o");r.addEventListener("blur",()=>{r.value=r.value.trim().toLowerCase().replace("@","")});const p=(w,k)=>{w.textContent=k,w.classList.remove("hidden")},b=(...w)=>w.forEach(k=>k.classList.add("hidden"));c.addEventListener("click",()=>{const w=r.value.trim().toLowerCase().replace("@",""),k=parseFloat(n.value);if(b(f,h),!w){p(f,m.recipient_required);return}if(!k||k<=0){p(f,m.amount_positive);return}l.textContent=fe(m.confirm_send,We(k,s.value),w),a.classList.remove("hidden"),c.classList.add("hidden")}),u.addEventListener("click",()=>{a.classList.add("hidden"),c.classList.remove("hidden")}),d.addEventListener("click",async()=>{const w=r.value.trim().toLowerCase().replace("@",""),k=parseFloat(n.value),B=s.value;d.disabled=!0,d.textContent=m.broadcasting,b(f);try{const C=st(e.activeKeyWif),E=await Ct([Ks(e.account,w,We(k,B),i.value)],C);a.classList.add("hidden"),c.classList.remove("hidden"),p(h,fe(m.sent_tx,E.tx_id?.slice(0,12)||"",E.status)),r.value="",n.value="",i.value=""}catch(C){_t(f,C),a.classList.add("hidden"),c.classList.remove("hidden")}finally{d.disabled=!1,d.textContent=m.confirm}})}async function Qs(o,e,t){o.innerHTML=`<div id="si" class="card"><p class="mt">${m.loading}</p></div>
    <div class="card"><h2>${m.deposit_heading}</h2><label>${m.amount}</label>
    <input type="number" id="da" placeholder="0.000" step="0.001" min="0.001">
    <select id="dc"><option value="HBD">${m.hbd}</option><option value="HIVE">${m.hive}</option></select>
    <button id="db">${m.deposit_btn}</button></div>
    <div class="card"><h2>${m.withdraw_heading}</h2><p class="sm mt mb">${m.three_day_wait}</p>
    <label>${m.amount}</label><input type="number" id="wa" placeholder="0.000" step="0.001" min="0.001">
    <select id="wc"><option value="HBD">${m.hbd}</option><option value="HIVE">${m.hive}</option></select>
    <button id="wb">${m.withdraw_btn}</button></div>
    <div id="pw" class="card hidden"><h2>${m.pending_heading}</h2><div id="pl"></div></div>
    <p class="err hidden" id="e"></p><p class="ok hidden" id="o"></p>`;const r=o.querySelector("#si"),n=o.querySelector("#da"),s=o.querySelector("#dc"),i=o.querySelector("#db"),c=o.querySelector("#wa"),a=o.querySelector("#wc"),l=o.querySelector("#wb"),d=o.querySelector("#pw"),u=o.querySelector("#pl"),f=o.querySelector("#e"),h=o.querySelector("#o"),p=B=>{f.textContent=B,f.classList.remove("hidden"),h.classList.add("hidden")},b=B=>{h.textContent=B,h.classList.remove("hidden"),f.classList.add("hidden")};async function w(){try{const B=(await Ne().getAccounts([e.account]))[0];if(!B){r.innerHTML=`<p class="err">${m.not_found}</p>`;return}const C=Fe(B.savings_hbd_balance),E=Fe(B.savings_balance),T=Fe(B.hbd_balance);r.innerHTML=`<div class="g2">
    <div><p class="bl">${m.hbd_savings}</p><p class="ba gc">${C.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hive_savings}</p><p class="ba">${E.amount.toFixed(3)}</p></div></div>
    <p class="sm mt mt1">${fe(m.available_hbd,T.amount.toFixed(3))}</p>
    ${C.amount>0?`<p class="sm gc mt1">${fe(m.apr_estimate,(C.amount*.2).toFixed(3))}</p>`:""}`,B.savings_withdraw_requests>0?(d.classList.remove("hidden"),u.innerHTML=`<p class="wrn">${fe(m.n_pending,B.savings_withdraw_requests)}</p>
    <button class="btn-s mt1" id="cb">${m.cancel_latest}</button>`,u.querySelector("#cb").addEventListener("click",async function(){this.disabled=!0;try{const V=await Ct([Ys(e.account,0)],st(e.activeKeyWif));b(fe(m.cancelled,V.status)),await w()}catch(V){_t(f,V)}finally{this.disabled=!1}})):d.classList.add("hidden")}catch(B){r.innerHTML=`<p class="err">${sr(B instanceof Error?B.message:String(B))}</p>`}}async function k(B,C,E,T){const V=parseFloat(C.value),oe=E.value;if(!V||V<=0){p(m.amount_positive);return}const X=fe(T?m.confirm_deposit:m.confirm_withdraw,We(V,oe));if(confirm(X)){B.disabled=!0,B.textContent=m.broadcasting;try{const U=st(e.activeKeyWif),de=T?Zs(e.account,e.account,We(V,oe)):Xs(e.account,Math.floor(Date.now()/1e3)%2147483647,e.account,We(V,oe)),se=await Ct([de],U);b(`${T?m.deposited:m.withdrawal_initiated}. (${se.status})`),C.value="",await w()}catch(U){_t(f,U)}finally{B.disabled=!1,B.textContent=T?m.deposit_btn:m.withdraw_btn}}}i.addEventListener("click",()=>k(i,n,s,!0)),l.addEventListener("click",()=>k(l,c,a,!1)),await w()}const Js=["https://api.hive.blog","https://api.deathwing.me","https://hive-api.arcange.eu"];async function ei(o,e,t){const r=Ne(),n=it();n.allEndpoints.filter(f=>f.source==="discovered").length>0,e.memoKeyWif;const i=(f,h)=>`<p class="sm ${f}">${h}</p>`;o.innerHTML=`
    <div class="card"><h2>${m.rpc_endpoint}</h2>
    ${i("mt mb",`${m.current_label} <code id="ce">${r.currentEndpoint}</code>`)}
    <label>${m.custom_endpoint}</label><input type="url" id="ci" placeholder="${m.rpc_placeholder}">
    <button class="btn-s" id="se">${m.set_btn}</button><button class="btn-s" id="re">${m.reset_btn}</button><button class="btn-s" id="hc">${m.check_btn}</button>
    <p class="sm hidden" id="es"></p></div>
    
    
    <div class="card"><h2>${m.account_heading}</h2>
    ${i("",`@<strong>${e.account}</strong>`)}
    ${i("mt mb",`${m.active_check} ${e.activeKeyWif?"✓":"✗"} | ${m.memo_check} ${e.memoKeyWif?"✓":"✗"} | ${e.persistKeys?m.persistent:m.session}`)}
    <button class="btn-er" id="lo">${m.logout}</button></div>
    <div class="card"><h2>${m.about}</h2>${i("mt",m.about_text)}</div>`;const c=o.querySelector("#ci"),a=o.querySelector("#ce"),l=o.querySelector("#es");o.querySelector("#ds");const d=o.querySelector("#el"),u=(f,h,p)=>{f.className=`sm ${h}`,f.textContent=p,f.classList.remove("hidden")};o.querySelector("#se").addEventListener("click",()=>{const f=c.value.trim();if(!f){u(l,"err",m.enter_url);return}let h;try{h=new URL(f)}catch{u(l,"err",m.invalid_url);return}if(h.protocol!=="https:"&&h.hostname!=="localhost"&&h.hostname!=="127.0.0.1"){u(l,"err",m.https_required);return}n.addManualEndpoint(f),a.textContent=r.currentEndpoint,u(l,"ok",m.added),c.value="",d&&(d.innerHTML=ti(n))}),o.querySelector("#re").addEventListener("click",()=>{r.setEndpoints(Js),a.textContent=r.currentEndpoint,u(l,"ok",m.reset_done)}),o.querySelector("#hc").addEventListener("click",async function(){this.disabled=!0,u(l,"mt","...");const f=await r.healthCheck();u(l,f?"ok":"err",f?"✓ OK":"✗ Failed"),this.disabled=!1}),o.querySelector("#lo").addEventListener("click",()=>{confirm(m.confirm_logout)&&t.logout()})}function ti(o){const e=o.allEndpoints;return e.length?e.map(t=>`<p class="sm"><code>${t.url}</code> <span class="xs">[${t.source}]</span> ${t.healthy?'<span class="gc">✓</span>':'<span class="err">✗</span>'}</p>`).join(""):`<p class="sm">${m.none}</p>`}const ri={login:Ws,balance:js,transfer:Gs,savings:Qs,settings:ei},oi=[{hash:"balance",label:m.nav_balance},{hash:"transfer",label:m.nav_transfer},{hash:"savings",label:m.nav_savings},{hash:"settings",label:m.nav_settings}];class ni{container;navEl;contentEl;state;constructor(e){this.container=e,this.state=this.loadState(),this.container.innerHTML="";const t=document.createElement("div");t.className="ct",document.documentElement.lang=m.html_lang,document.documentElement.dir=m.html_dir,document.title=m.app_title,t.innerHTML=`<h1>${m.app_title}</h1>`,this.navEl=document.createElement("nav"),this.contentEl=document.createElement("div"),this.contentEl.className="ct",t.appendChild(this.navEl),this.container.appendChild(t),this.container.appendChild(this.contentEl),this.renderNav(),window.addEventListener("hashchange",()=>this.route()),this.route(),this.startDiscovery()}loadState(){const e=localStorage.getItem("haa_keys");if(e)try{const s=JSON.parse(e);return{account:s.account||null,activeKeyWif:s.activeKeyWif||null,memoKeyWif:s.memoKeyWif||null,persistKeys:!0}}catch{}const t=sessionStorage.getItem("haa_account"),r=sessionStorage.getItem("haa_activeKey"),n=sessionStorage.getItem("haa_memoKey");return{account:t,activeKeyWif:r,memoKeyWif:n,persistKeys:!1}}saveState(){this.state.persistKeys?localStorage.setItem("haa_keys",JSON.stringify({account:this.state.account,activeKeyWif:this.state.activeKeyWif,memoKeyWif:this.state.memoKeyWif})):(localStorage.removeItem("haa_keys"),this.state.account&&sessionStorage.setItem("haa_account",this.state.account),this.state.activeKeyWif&&sessionStorage.setItem("haa_activeKey",this.state.activeKeyWif),this.state.memoKeyWif&&sessionStorage.setItem("haa_memoKey",this.state.memoKeyWif))}startDiscovery(){this.state.account&&this.state.memoKeyWif&&it().startPeriodicChecks(this.state.account,this.state.memoKeyWif)}logout(){it().stopPeriodicChecks(),this.state.account=null,this.state.activeKeyWif=null,this.state.memoKeyWif=null,localStorage.removeItem("haa_keys"),sessionStorage.clear(),this.navigate("login")}navigate(e){window.location.hash=`#${e}`}renderNav(){if(this.navEl.innerHTML="",!this.state.account){this.navEl.classList.add("hidden");return}this.navEl.classList.remove("hidden");const e=(window.location.hash||"#balance").slice(1);for(const t of oi){const r=document.createElement("a");r.href=`#${t.hash}`,r.textContent=t.label,t.hash===e&&(r.className="active"),this.navEl.appendChild(r)}}route(){const e=(window.location.hash||"").slice(1)||"login";if(e!=="login"&&!this.state.account){this.navigate("login");return}if(e==="login"&&this.state.account){this.navigate("balance");return}const t=ri[e];if(!t){this.navigate("balance");return}this.renderNav(),this.contentEl.innerHTML="",t(this.contentEl,this.state,this)}}const si=document.getElementById("app"),ii=new ni(si);window.propolis={app:ii,getClient:Ne,importKey:st,formatAsset:We,signAndBroadcast:Ct,decryptMemo:Lo};const ai=()=>new Worker(URL.createObjectURL(new Blob([`class x{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new x(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let g=a;g<a+c;g++)this.set(g,f,!!e)}}
    class A{constructor(a,b,c){this.width=a;a*=b;if(c&&c.length!==a)throw Error("Wrong buffer size");this.data=c||new Uint8ClampedArray(a)}get(a,b){return this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c}}
    class ba{constructor(a){this.bitOffset=this.byteOffset=0;this.bytes=a}readBits(a){if(1>a||32<a||a>this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0<this.bitOffset){b=8-this.bitOffset;var c=a<b?a:b;b-=c;b=(this.bytes[this.byteOffset]&255>>8-c<<b)>>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(0<a){for(;8<=a;)b=b<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,a-=8;0<a&&(c=8-a,b=b<<a|(this.bytes[this.byteOffset]&255>>c<<c)>>c,
    this.bitOffset+=a)}return b}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var B,C=B||(B={});C.Numeric="numeric";C.Alphanumeric="alphanumeric";C.Byte="byte";C.Kanji="kanji";C.ECI="eci";C.StructuredAppend="structuredappend";var D,E=D||(D={});E[E.Terminator=0]="Terminator";E[E.Numeric=1]="Numeric";E[E.Alphanumeric=2]="Alphanumeric";E[E.Byte=4]="Byte";E[E.Kanji=8]="Kanji";E[E.ECI=7]="ECI";E[E.StructuredAppend=3]="StructuredAppend";let F="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");
    function ca(a,b){let c=[],d="";b=a.readBits([8,16,16][b]);for(let e=0;e<b;e++){let f=a.readBits(8);c.push(f)}try{d+=decodeURIComponent(c.map(e=>\`%\${("0"+e.toString(16)).substr(-2)}\`).join(""))}catch(e){}return{bytes:c,text:d}}
    function da(a,b){a=new ba(a);let c=9>=b?0:26>=b?1:2;for(b={text:"",bytes:[],chunks:[],version:b};4<=a.available();){var d=a.readBits(4);if(d===D.Terminator)return b;if(d===D.ECI)0===a.readBits(1)?b.chunks.push({type:B.ECI,assignmentNumber:a.readBits(7)}):0===a.readBits(1)?b.chunks.push({type:B.ECI,assignmentNumber:a.readBits(14)}):0===a.readBits(1)?b.chunks.push({type:B.ECI,assignmentNumber:a.readBits(21)}):b.chunks.push({type:B.ECI,assignmentNumber:-1});else if(d===D.Numeric){var e=a,f=[];d="";for(var g=
    e.readBits([10,12,14][c]);3<=g;){var h=e.readBits(10);if(1E3<=h)throw Error("Invalid numeric value above 999");var k=Math.floor(h/100),m=Math.floor(h/10)%10;h%=10;f.push(48+k,48+m,48+h);d+=k.toString()+m.toString()+h.toString();g-=3}if(2===g){g=e.readBits(7);if(100<=g)throw Error("Invalid numeric value above 99");e=Math.floor(g/10);g%=10;f.push(48+e,48+g);d+=e.toString()+g.toString()}else if(1===g){e=e.readBits(4);if(10<=e)throw Error("Invalid numeric value above 9");f.push(48+e);d+=e.toString()}b.text+=
    d;b.bytes.push(...f);b.chunks.push({type:B.Numeric,text:d})}else if(d===D.Alphanumeric){e=a;f=[];d="";for(g=e.readBits([9,11,13][c]);2<=g;)m=e.readBits(11),k=Math.floor(m/45),m%=45,f.push(F[k].charCodeAt(0),F[m].charCodeAt(0)),d+=F[k]+F[m],g-=2;1===g&&(e=e.readBits(6),f.push(F[e].charCodeAt(0)),d+=F[e]);b.text+=d;b.bytes.push(...f);b.chunks.push({type:B.Alphanumeric,text:d})}else if(d===D.Byte)d=ca(a,c),b.text+=d.text,b.bytes.push(...d.bytes),b.chunks.push({type:B.Byte,bytes:d.bytes,text:d.text});
    else if(d===D.Kanji){f=a;d=[];e=f.readBits([8,10,12][c]);for(g=0;g<e;g++)k=f.readBits(13),k=Math.floor(k/192)<<8|k%192,k=7936>k?k+33088:k+49472,d.push(k>>8,k&255);f=(new TextDecoder("shift-jis")).decode(Uint8Array.from(d));b.text+=f;b.bytes.push(...d);b.chunks.push({type:B.Kanji,bytes:d,text:f})}else d===D.StructuredAppend&&b.chunks.push({type:B.StructuredAppend,currentSequence:a.readBits(4),totalSequence:a.readBits(4),parity:a.readBits(8)})}if(0===a.available()||0===a.readBits(a.available()))return b}
    class G{constructor(a,b){if(0===b.length)throw Error("No coefficients.");this.field=a;let c=b.length;if(1<c&&0===b[0]){let d=1;for(;d<c&&0===b[d];)d++;if(d===c)this.coefficients=a.zero.coefficients;else for(this.coefficients=new Uint8ClampedArray(c-d),a=0;a<this.coefficients.length;a++)this.coefficients[a]=b[d+a]}else this.coefficients=b}degree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(a){return this.coefficients[this.coefficients.length-1-a]}addOrSubtract(a){if(this.isZero())return a;
    if(a.isZero())return this;let b=this.coefficients;a=a.coefficients;b.length>a.length&&([b,a]=[a,b]);let c=new Uint8ClampedArray(a.length),d=a.length-b.length;for(var e=0;e<d;e++)c[e]=a[e];for(e=d;e<a.length;e++)c[e]=b[e-d]^a[e];return new G(this.field,c)}multiply(a){if(0===a)return this.field.zero;if(1===a)return this;let b=this.coefficients.length,c=new Uint8ClampedArray(b);for(let d=0;d<b;d++)c[d]=this.field.multiply(this.coefficients[d],a);return new G(this.field,c)}multiplyPoly(a){if(this.isZero()||
    a.isZero())return this.field.zero;let b=this.coefficients,c=b.length;a=a.coefficients;let d=a.length,e=new Uint8ClampedArray(c+d-1);for(let f=0;f<c;f++){let g=b[f];for(let h=0;h<d;h++)e[f+h]=H(e[f+h],this.field.multiply(g,a[h]))}return new G(this.field,e)}multiplyByMonomial(a,b){if(0>a)throw Error("Invalid degree less than 0");if(0===b)return this.field.zero;let c=this.coefficients.length;a=new Uint8ClampedArray(c+a);for(let d=0;d<c;d++)a[d]=this.field.multiply(this.coefficients[d],b);return new G(this.field,
    a)}evaluateAt(a){let b=0;if(0===a)return this.getCoefficient(0);let c=this.coefficients.length;if(1===a)return this.coefficients.forEach(d=>{b^=d}),b;b=this.coefficients[0];for(let d=1;d<c;d++)b=H(this.field.multiply(a,b),this.coefficients[d]);return b}}function H(a,b){return a^b}
    class ea{constructor(a,b,c){this.primitive=a;this.size=b;this.generatorBase=c;this.expTable=Array(this.size);this.logTable=Array(this.size);a=1;for(b=0;b<this.size;b++)this.expTable[b]=a,a*=2,a>=this.size&&(a=(a^this.primitive)&this.size-1);for(a=0;a<this.size-1;a++)this.logTable[this.expTable[a]]=a;this.zero=new G(this,Uint8ClampedArray.from([0]));this.one=new G(this,Uint8ClampedArray.from([1]))}multiply(a,b){return 0===a||0===b?0:this.expTable[(this.logTable[a]+this.logTable[b])%(this.size-1)]}inverse(a){if(0===
    a)throw Error("Can't invert 0");return this.expTable[this.size-this.logTable[a]-1]}buildMonomial(a,b){if(0>a)throw Error("Invalid monomial degree less than 0");if(0===b)return this.zero;a=new Uint8ClampedArray(a+1);a[0]=b;return new G(this,a)}log(a){if(0===a)throw Error("Can't take log(0)");return this.logTable[a]}exp(a){return this.expTable[a]}}
    function fa(a,b,c,d){b.degree()<c.degree()&&([b,c]=[c,b]);let e=a.zero;for(var f=a.one;c.degree()>=d/2;){var g=b;let h=e;b=c;e=f;if(b.isZero())return null;c=g;f=a.zero;g=b.getCoefficient(b.degree());for(g=a.inverse(g);c.degree()>=b.degree()&&!c.isZero();){let k=c.degree()-b.degree(),m=a.multiply(c.getCoefficient(c.degree()),g);f=f.addOrSubtract(a.buildMonomial(k,m));c=c.addOrSubtract(b.multiplyByMonomial(k,m))}f=f.multiplyPoly(e).addOrSubtract(h);if(c.degree()>=b.degree())return null}d=f.getCoefficient(0);
    if(0===d)return null;a=a.inverse(d);return[f.multiply(a),c.multiply(a)]}
    function ha(a,b){let c=new Uint8ClampedArray(a.length);c.set(a);a=new ea(285,256,0);var d=new G(a,c),e=new Uint8ClampedArray(b),f=!1;for(var g=0;g<b;g++){var h=d.evaluateAt(a.exp(g+a.generatorBase));e[e.length-1-g]=h;0!==h&&(f=!0)}if(!f)return c;d=new G(a,e);d=fa(a,a.buildMonomial(b,1),d,b);if(null===d)return null;b=d[0];g=b.degree();if(1===g)b=[b.getCoefficient(1)];else{e=Array(g);f=0;for(h=1;h<a.size&&f<g;h++)0===b.evaluateAt(h)&&(e[f]=a.inverse(h),f++);b=f!==g?null:e}if(null==b)return null;e=d[1];
    f=b.length;d=Array(f);for(g=0;g<f;g++){h=a.inverse(b[g]);let k=1;for(let m=0;m<f;m++)g!==m&&(k=a.multiply(k,H(1,a.multiply(b[m],h))));d[g]=a.multiply(e.evaluateAt(h),a.inverse(k));0!==a.generatorBase&&(d[g]=a.multiply(d[g],h))}for(e=0;e<b.length;e++){f=c.length-1-a.log(b[e]);if(0>f)return null;c[f]^=d[e]}return c}
    let I=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,
    dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,
    ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},
    {infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,
    34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,
    ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},
    {numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},
    {numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,
    dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,
    dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},
    {ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},
    {ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},
    {numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,
    ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,
    74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,
    versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,
    dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,
    dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,dataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},
    {ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},
    {numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},
    {numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},
    {numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},
    {numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,
    ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,
    dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,
    dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},
    {ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},
    {numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,
    ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,
    26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},
    {infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},
    {numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,
    dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},
    {ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,
    dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},
    {ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,
    dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},
    {ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,
    dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],
    errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,
    versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,dataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},
    {numBlocks:61,dataCodewordsPerBlock:16}]}]}];function J(a,b){a^=b;for(b=0;a;)b++,a&=a-1;return b}function K(a,b){return b<<1|a}
    let ia=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,dataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,
    dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,formatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,
    formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,dataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,
    dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,dataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],ja=[a=>0===(a.y+a.x)%2,a=>0===a.y%2,a=>0===a.x%3,a=>0===(a.y+a.x)%3,a=>0===(Math.floor(a.y/2)+Math.floor(a.x/3))%2,a=>0===a.x*a.y%
    2+a.x*a.y%3,a=>0===(a.y*a.x%2+a.y*a.x%3)%2,a=>0===((a.y+a.x)%2+a.y*a.x%3)%2];
    function ka(a,b,c){c=ja[c.dataMask];let d=a.height;var e=17+4*b.versionNumber;let f=x.createEmpty(e,e);f.setRegion(0,0,9,9,!0);f.setRegion(e-8,0,8,9,!0);f.setRegion(0,e-8,9,8,!0);for(var g of b.alignmentPatternCenters)for(var h of b.alignmentPatternCenters)6===g&&6===h||6===g&&h===e-7||g===e-7&&6===h||f.setRegion(g-2,h-2,5,5,!0);f.setRegion(6,9,1,e-17,!0);f.setRegion(9,6,e-17,1,!0);6<b.versionNumber&&(f.setRegion(e-11,0,3,6,!0),f.setRegion(0,e-11,6,3,!0));b=[];h=g=0;e=!0;for(let k=d-1;0<k;k-=2){6===
    k&&k--;for(let m=0;m<d;m++){let l=e?d-1-m:m;for(let n=0;2>n;n++){let q=k-n;if(!f.get(q,l)){h++;let r=a.get(q,l);c({y:l,x:q})&&(r=!r);g=g<<1|r;8===h&&(b.push(g),g=h=0)}}}e=!e}return b}
    function la(a){var b=a.height,c=Math.floor((b-17)/4);if(6>=c)return I[c-1];c=0;for(var d=5;0<=d;d--)for(var e=b-9;e>=b-11;e--)c=K(a.get(e,d),c);d=0;for(e=5;0<=e;e--)for(let g=b-9;g>=b-11;g--)d=K(a.get(e,g),d);a=Infinity;let f;for(let g of I){if(g.infoBits===c||g.infoBits===d)return g;b=J(c,g.infoBits);b<a&&(f=g,a=b);b=J(d,g.infoBits);b<a&&(f=g,a=b)}if(3>=a)return f}
    function ma(a){let b=0;for(var c=0;8>=c;c++)6!==c&&(b=K(a.get(c,8),b));for(c=7;0<=c;c--)6!==c&&(b=K(a.get(8,c),b));var d=a.height;c=0;for(var e=d-1;e>=d-7;e--)c=K(a.get(8,e),c);for(e=d-8;e<d;e++)c=K(a.get(e,8),c);a=Infinity;d=null;for(let {bits:f,formatInfo:g}of ia){if(f===b||f===c)return g;e=J(b,f);e<a&&(d=g,a=e);b!==c&&(e=J(c,f),e<a&&(d=g,a=e))}return 3>=a?d:null}
    function na(a,b,c){let d=b.errorCorrectionLevels[c],e=[],f=0;d.ecBlocks.forEach(h=>{for(let k=0;k<h.numBlocks;k++)e.push({numDataCodewords:h.dataCodewordsPerBlock,codewords:[]}),f+=h.dataCodewordsPerBlock+d.ecCodewordsPerBlock});if(a.length<f)return null;a=a.slice(0,f);b=d.ecBlocks[0].dataCodewordsPerBlock;for(c=0;c<b;c++)for(var g of e)g.codewords.push(a.shift());if(1<d.ecBlocks.length)for(g=d.ecBlocks[0].numBlocks,b=d.ecBlocks[1].numBlocks,c=0;c<b;c++)e[g+c].codewords.push(a.shift());for(;0<a.length;)for(let h of e)h.codewords.push(a.shift());
    return e}function L(a){let b=la(a);if(!b)return null;var c=ma(a);if(!c)return null;a=ka(a,b,c);var d=na(a,b,c.errorCorrectionLevel);if(!d)return null;c=d.reduce((e,f)=>e+f.numDataCodewords,0);c=new Uint8ClampedArray(c);a=0;for(let e of d){d=ha(e.codewords,e.codewords.length-e.numDataCodewords);if(!d)return null;for(let f=0;f<e.numDataCodewords;f++)c[a++]=d[f]}try{return da(c,b.versionNumber)}catch(e){return null}}
    function M(a,b,c,d){var e=a.x-b.x+c.x-d.x;let f=a.y-b.y+c.y-d.y;if(0===e&&0===f)return{a11:b.x-a.x,a12:b.y-a.y,a13:0,a21:c.x-b.x,a22:c.y-b.y,a23:0,a31:a.x,a32:a.y,a33:1};let g=b.x-c.x;var h=d.x-c.x;let k=b.y-c.y,m=d.y-c.y;c=g*m-h*k;h=(e*m-h*f)/c;e=(g*f-e*k)/c;return{a11:b.x-a.x+h*b.x,a12:b.y-a.y+h*b.y,a13:h,a21:d.x-a.x+e*d.x,a22:d.y-a.y+e*d.y,a23:e,a31:a.x,a32:a.y,a33:1}}
    function oa(a,b,c,d){a=M(a,b,c,d);return{a11:a.a22*a.a33-a.a23*a.a32,a12:a.a13*a.a32-a.a12*a.a33,a13:a.a12*a.a23-a.a13*a.a22,a21:a.a23*a.a31-a.a21*a.a33,a22:a.a11*a.a33-a.a13*a.a31,a23:a.a13*a.a21-a.a11*a.a23,a31:a.a21*a.a32-a.a22*a.a31,a32:a.a12*a.a31-a.a11*a.a32,a33:a.a11*a.a22-a.a12*a.a21}}
    function pa(a,b){var c=oa({x:3.5,y:3.5},{x:b.dimension-3.5,y:3.5},{x:b.dimension-6.5,y:b.dimension-6.5},{x:3.5,y:b.dimension-3.5}),d=M(b.topLeft,b.topRight,b.alignmentPattern,b.bottomLeft),e=d.a11*c.a11+d.a21*c.a12+d.a31*c.a13,f=d.a12*c.a11+d.a22*c.a12+d.a32*c.a13,g=d.a13*c.a11+d.a23*c.a12+d.a33*c.a13,h=d.a11*c.a21+d.a21*c.a22+d.a31*c.a23,k=d.a12*c.a21+d.a22*c.a22+d.a32*c.a23,m=d.a13*c.a21+d.a23*c.a22+d.a33*c.a23,l=d.a11*c.a31+d.a21*c.a32+d.a31*c.a33,n=d.a12*c.a31+d.a22*c.a32+d.a32*c.a33,q=d.a13*
    c.a31+d.a23*c.a32+d.a33*c.a33;c=x.createEmpty(b.dimension,b.dimension);d=(r,u)=>{const p=g*r+m*u+q;return{x:(e*r+h*u+l)/p,y:(f*r+k*u+n)/p}};for(let r=0;r<b.dimension;r++)for(let u=0;u<b.dimension;u++){let p=d(u+.5,r+.5);c.set(u,r,a.get(Math.floor(p.x),Math.floor(p.y)))}return{matrix:c,mappingFunction:d}}let N=(a,b)=>Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2));function O(a){return a.reduce((b,c)=>b+c)}
    function qa(a,b,c){let d=N(a,b),e=N(b,c),f=N(a,c),g,h,k;e>=d&&e>=f?[g,h,k]=[b,a,c]:f>=e&&f>=d?[g,h,k]=[a,b,c]:[g,h,k]=[a,c,b];0>(k.x-h.x)*(g.y-h.y)-(k.y-h.y)*(g.x-h.x)&&([g,k]=[k,g]);return{bottomLeft:g,topLeft:h,topRight:k}}
    function ra(a,b,c,d){d=(O(P(a,c,d,5))/7+O(P(a,b,d,5))/7+O(P(c,a,d,5))/7+O(P(b,a,d,5))/7)/4;if(1>d)throw Error("Invalid module size");b=Math.round(N(a,b)/d);a=Math.round(N(a,c)/d);a=Math.floor((b+a)/2)+7;switch(a%4){case 0:a++;break;case 2:a--}return{dimension:a,moduleSize:d}}
    function Q(a,b,c,d){let e=[{x:Math.floor(a.x),y:Math.floor(a.y)}];var f=Math.abs(b.y-a.y)>Math.abs(b.x-a.x);if(f){var g=Math.floor(a.y);var h=Math.floor(a.x);a=Math.floor(b.y);b=Math.floor(b.x)}else g=Math.floor(a.x),h=Math.floor(a.y),a=Math.floor(b.x),b=Math.floor(b.y);let k=Math.abs(a-g),m=Math.abs(b-h),l=Math.floor(-k/2),n=g<a?1:-1,q=h<b?1:-1,r=!0;for(let u=g,p=h;u!==a+n;u+=n){g=f?p:u;h=f?u:p;if(c.get(g,h)!==r&&(r=!r,e.push({x:g,y:h}),e.length===d+1))break;l+=m;if(0<l){if(p===b)break;p+=q;l-=k}}c=
    [];for(f=0;f<d;f++)e[f]&&e[f+1]?c.push(N(e[f],e[f+1])):c.push(0);return c}function P(a,b,c,d){let e=b.y-a.y,f=b.x-a.x;b=Q(a,b,c,Math.ceil(d/2));a=Q(a,{x:a.x-f,y:a.y-e},c,Math.ceil(d/2));c=b.shift()+a.shift()-1;return a.concat(c).concat(...b)}function R(a,b){let c=O(a)/O(b),d=0;b.forEach((e,f)=>{d+=Math.pow(a[f]-e*c,2)});return{averageSize:c,error:d}}
    function S(a,b,c){try{let d=P(a,{x:-1,y:a.y},c,b.length),e=P(a,{x:a.x,y:-1},c,b.length),f=P(a,{x:Math.max(0,a.x-a.y)-1,y:Math.max(0,a.y-a.x)-1},c,b.length),g=P(a,{x:Math.min(c.width,a.x+a.y)+1,y:Math.min(c.height,a.y+a.x)+1},c,b.length),h=R(d,b),k=R(e,b),m=R(f,b),l=R(g,b),n=(h.averageSize+k.averageSize+m.averageSize+l.averageSize)/4;return Math.sqrt(h.error*h.error+k.error*k.error+m.error*m.error+l.error*l.error)+(Math.pow(h.averageSize-n,2)+Math.pow(k.averageSize-n,2)+Math.pow(m.averageSize-n,2)+
    Math.pow(l.averageSize-n,2))/n}catch(d){return Infinity}}function T(a,b){for(var c=Math.round(b.x);a.get(c,Math.round(b.y));)c--;for(var d=Math.round(b.x);a.get(d,Math.round(b.y));)d++;c=(c+d)/2;for(d=Math.round(b.y);a.get(Math.round(c),d);)d--;for(b=Math.round(b.y);a.get(Math.round(c),b);)b++;return{x:c,y:(d+b)/2}}
    function sa(a){var b=[],c=[];let d=[];var e=[];for(let p=0;p<=a.height;p++){var f=0,g=!1;let t=[0,0,0,0,0];for(let v=-1;v<=a.width;v++){var h=a.get(v,p);if(h===g)f++;else{t=[t[1],t[2],t[3],t[4],f];f=1;g=h;var k=O(t)/7;k=Math.abs(t[0]-k)<k&&Math.abs(t[1]-k)<k&&Math.abs(t[2]-3*k)<3*k&&Math.abs(t[3]-k)<k&&Math.abs(t[4]-k)<k&&!h;var m=O(t.slice(-3))/3;h=Math.abs(t[2]-m)<m&&Math.abs(t[3]-m)<m&&Math.abs(t[4]-m)<m&&h;if(k){let z=v-t[3]-t[4],y=z-t[2];k={startX:y,endX:z,y:p};m=c.filter(w=>y>=w.bottom.startX&&
    y<=w.bottom.endX||z>=w.bottom.startX&&y<=w.bottom.endX||y<=w.bottom.startX&&z>=w.bottom.endX&&1.5>t[2]/(w.bottom.endX-w.bottom.startX)&&.5<t[2]/(w.bottom.endX-w.bottom.startX));0<m.length?m[0].bottom=k:c.push({top:k,bottom:k})}if(h){let z=v-t[4],y=z-t[3];h={startX:y,y:p,endX:z};k=e.filter(w=>y>=w.bottom.startX&&y<=w.bottom.endX||z>=w.bottom.startX&&y<=w.bottom.endX||y<=w.bottom.startX&&z>=w.bottom.endX&&1.5>t[2]/(w.bottom.endX-w.bottom.startX)&&.5<t[2]/(w.bottom.endX-w.bottom.startX));0<k.length?
    k[0].bottom=h:e.push({top:h,bottom:h})}}}b.push(...c.filter(v=>v.bottom.y!==p&&2<=v.bottom.y-v.top.y));c=c.filter(v=>v.bottom.y===p);d.push(...e.filter(v=>v.bottom.y!==p));e=e.filter(v=>v.bottom.y===p)}b.push(...c.filter(p=>2<=p.bottom.y-p.top.y));d.push(...e);c=[];for(var l of b)2>l.bottom.y-l.top.y||(b=(l.top.startX+l.top.endX+l.bottom.startX+l.bottom.endX)/4,e=(l.top.y+l.bottom.y+1)/2,a.get(Math.round(b),Math.round(e))&&(f=[l.top.endX-l.top.startX,l.bottom.endX-l.bottom.startX,l.bottom.y-l.top.y+
    1],f=O(f)/f.length,g=S({x:Math.round(b),y:Math.round(e)},[1,1,3,1,1],a),c.push({score:g,x:b,y:e,size:f})));if(3>c.length)return null;c.sort((p,t)=>p.score-t.score);l=[];for(b=0;b<Math.min(c.length,5);++b){e=c[b];f=[];for(var n of c)n!==e&&f.push(Object.assign(Object.assign({},n),{score:n.score+Math.pow(n.size-e.size,2)/e.size}));f.sort((p,t)=>p.score-t.score);l.push({points:[e,f[0],f[1]],score:e.score+f[0].score+f[1].score})}l.sort((p,t)=>p.score-t.score);let {topRight:q,topLeft:r,bottomLeft:u}=qa(...l[0].points);
    l=U(a,d,q,r,u);n=[];l&&n.push({alignmentPattern:{x:l.alignmentPattern.x,y:l.alignmentPattern.y},bottomLeft:{x:u.x,y:u.y},dimension:l.dimension,topLeft:{x:r.x,y:r.y},topRight:{x:q.x,y:q.y}});l=T(a,q);b=T(a,r);c=T(a,u);(a=U(a,d,l,b,c))&&n.push({alignmentPattern:{x:a.alignmentPattern.x,y:a.alignmentPattern.y},bottomLeft:{x:c.x,y:c.y},topLeft:{x:b.x,y:b.y},topRight:{x:l.x,y:l.y},dimension:a.dimension});return 0===n.length?null:n}
    function U(a,b,c,d,e){let f,g;try{({dimension:f,moduleSize:g}=ra(d,c,e,a))}catch(l){return null}var h=c.x-d.x+e.x,k=c.y-d.y+e.y;c=(N(d,e)+N(d,c))/2/g;e=1-3/c;let m={x:d.x+e*(h-d.x),y:d.y+e*(k-d.y)};b=b.map(l=>{const n=(l.top.startX+l.top.endX+l.bottom.startX+l.bottom.endX)/4;l=(l.top.y+l.bottom.y+1)/2;if(a.get(Math.floor(n),Math.floor(l))){var q=S({x:Math.floor(n),y:Math.floor(l)},[1,1,1],a)+N({x:n,y:l},m);return{x:n,y:l,score:q}}}).filter(l=>!!l).sort((l,n)=>l.score-n.score);return{alignmentPattern:15<=
    c&&b.length?b[0]:m,dimension:f}}
    function V(a){v
    
  • lse e.writeVarint32(r);e.append(t.buffer)},mo=ho(),zt=(o,e)=>(t,r)=>{t.writeVarint32(r.length);for(const[n,s]of r)o(t,n),e(t,s)},K=o=>(e,t)=>{e.writeVarint32(t.length);for(const r of t)o(e,r)},me=o=>(e,t)=>{for(const[r,n]of o)try{n(e,t[r])}catch(s){throw s.message=`${r}: ${s.message}`,s}},Ve=o=>(e,t)=>{t!==void 0?(e.writeByte(1),o(e,t)):e.writeByte(0)},G=me([["weight_threshold",te],["account_auths",zt(g,he)],["key_auths",zt(ke,he)]]),Hn=me([["account",g],["weight",he]]),tr=me([["base",z],["quote",z]]),zn=me([["account_creation_fee",z],["maximum_block_size",te],["hbd_interest_rate",he]]),M=(o,e)=>{const t=me(e);return(r,n)=>{r.writeVarint32(o),t(r,n)}},I={};I.account_create=M($.account_create,[["fee",z],["creator",g],["new_account_name",g],["owner",G],["active",G],["posting",G],["memo_key",ke],["json_metadata",g]]);I.account_create_with_delegation=M($.account_create_with_delegation,[["fee",z],["delegation",z],["creator",g],["new_account_name",g],["owner",G],["active",G],["posting",G],["memo_key",ke],["json_metadata",g],["extensions",K(le)]]);I.account_update=M($.account_update,[["account",g],["owner",Ve(G)],["active",Ve(G)],["posting",Ve(G)],["memo_key",ke],["json_metadata",g]]);I.account_witness_proxy=M($.account_witness_proxy,[["account",g],["proxy",g]]);I.account_witness_vote=M($.account_witness_vote,[["account",g],["witness",g],["approve",Ee]]);I.cancel_transfer_from_savings=M($.cancel_transfer_from_savings,[["from",g],["request_id",te]]);I.change_recovery_account=M($.change_recovery_account,[["account_to_recover",g],["new_recovery_account",g],["extensions",K(le)]]);I.claim_account=M($.claim_account,[["creator",g],["fee",z],["extensions",K(le)]]);I.claim_reward_balance=M($.claim_reward_balance,[["account",g],["reward_hive",z],["reward_hbd",z],["reward_vests",z]]);I.comment=M($.comment,[["parent_author",g],["parent_permlink",g],["author",g],["permlink",g],["title",g],["body",g],["json_metadata",g]]);I.comment_options=M($.comment_options,[["author",g],["permlink",g],["max_accepted_payout",z],["percent_hbd",he],["allow_votes",Ee],["allow_curation_rewards",Ee],["extensions",K(fo([me([["beneficiaries",K(Hn)]])]))]]);I.convert=M($.convert,[["owner",g],["requestid",te],["amount",z]]);I.create_claimed_account=M($.create_claimed_account,[["creator",g],["new_account_name",g],["owner",G],["active",G],["posting",G],["memo_key",ke],["json_metadata",g],["extensions",K(le)]]);I.custom=M($.custom,[["required_auths",K(g)],["id",he],["data",mo]]);I.custom_json=M($.custom_json,[["required_auths",K(g)],["required_posting_auths",K(g)],["id",g],["json",g]]);I.decline_voting_rights=M($.decline_voting_rights,[["account",g],["decline",Ee]]);I.delegate_vesting_shares=M($.delegate_vesting_shares,[["delegator",g],["delegatee",g],["vesting_shares",z]]);I.delete_comment=M($.delete_comment,[["author",g],["permlink",g]]);I.escrow_approve=M($.escrow_approve,[["from",g],["to",g],["agent",g],["who",g],["escrow_id",te],["approve",Ee]]);I.escrow_dispute=M($.escrow_dispute,[["from",g],["to",g],["agent",g],["who",g],["escrow_id",te]]);I.escrow_release=M($.escrow_release,[["from",g],["to",g],["agent",g],["who",g],["receiver",g],["escrow_id",te],["hbd_amount",z],["hive_amount",z]]);I.escrow_transfer=M($.escrow_transfer,[["from",g],["to",g],["hbd_amount",z],["hive_amount",z],["escrow_id",te],["agent",g],["fee",z],["json_meta",g],["ratification_deadline",De],["escrow_expiration",De]]);I.feed_publish=M($.feed_publish,[["publisher",g],["exchange_rate",tr]]);I.limit_order_cancel=M($.limit_order_cancel,[["owner",g],["orderid",te]]);I.limit_order_create=M($.limit_order_create,[["owner",g],["orderid",te],["amount_to_sell",z],["min_to_receive",z],["fill_or_kill",Ee],["expiration",De]]);I.limit_order_create2=M($.limit_order_create2,[["owner",g],["orderid",te],["amount_to_sell",z],["exchange_rate",tr],["fill_or_kill",Ee],["expiration",De]]);I.recover_account=M($.recover_account,[["account_to_recover",g],["new_owner_authority",G],["recent_owner_authority",G],["extensions",K(le)]]);I.request_account_recovery=M($.request_account_recovery,[["recovery_account",g],["account_to_recover",g],["new_owner_authority",G],["extensions",K(le)]]);I.reset_account=M($.reset_account,[["reset_account",g],["account_to_reset",g],["new_owner_authority",G]]);I.set_reset_account=M($.set_reset_account,[["account",g],["current_reset_account",g],["reset_account",g]]);I.set_withdraw_vesting_route=M($.set_withdraw_vesting_route,[["from_account",g],["to_account",g],["percent",he],["auto_vest",Ee]]);I.transfer=M($.transfer,[["from",g],["to",g],["amount",z],["memo",g]]);I.transfer_from_savings=M($.transfer_from_savings,[["from",g],["request_id",te],["to",g],["amount",z],["memo",g]]);I.transfer_to_savings=M($.transfer_to_savings,[["from",g],["to",g],["amount",z],["memo",g]]);I.transfer_to_vesting=M($.transfer_to_vesting,[["from",g],["to",g],["amount",z]]);I.vote=M($.vote,[["voter",g],["author",g],["permlink",g],["weight",Nn]]);I.withdraw_vesting=M($.withdraw_vesting,[["account",g],["vesting_shares",z]]);I.witness_update=M($.witness_update,[["owner",g],["url",g],["block_signing_key",ke],["props",zn],["fee",z]]);I.witness_set_properties=M($.witness_set_properties,[["owner",g],["props",zt(g,mo)],["extensions",K(le)]]);I.account_update2=M($.account_update2,[["account",g],["owner",Ve(G)],["active",Ve(G)],["posting",Ve(G)],["memo_key",Ve(ke)],["json_metadata",g],["posting_json_metadata",g],["extensions",K(le)]]);I.create_proposal=M($.create_proposal,[["creator",g],["receiver",g],["start_date",De],["end_date",De],["daily_pay",z],["subject",g],["permlink",g],["extensions",K(le)]]);I.update_proposal_votes=M($.update_proposal_votes,[["voter",g],["proposal_ids",K(lo)],["approve",Ee],["extensions",K(le)]]);I.remove_proposal=M($.remove_proposal,[["proposal_owner",g],["proposal_ids",K(lo)],["extensions",K(le)]]);const Vn=me([["end_date",De]]);I.update_proposal=M($.update_proposal,[["proposal_id",uo],["creator",g],["daily_pay",z],["subject",g],["permlink",g],["extensions",K(fo([le,Vn]))]]);I.collateralized_convert=M($.collateralized_convert,[["owner",g],["requestid",te],["amount",z]]);I.recurrent_transfer=M($.recurrent_transfer,[["from",g],["to",g],["amount",z],["memo",g],["recurrence",he],["executions",he],["extensions",K(me([["type",_r],["value",me([["pair_id",_r]])]]))]]);const Fn=(o,e)=>{const t=I[e[0]];if(!t)throw new Error(`No serializer for operation: ${e[0]}`);try{t(o,e[1])}catch(r){throw r.message=`${e[0]}: ${r.message}`,r}},Wn=me([["ref_block_num",he],["ref_block_prefix",te],["expiration",De],["operations",K(Fn)],["extensions",K(g)]]),jn=me([["from",ke],["to",ke],["nonce",uo],["check",te],["encrypted",ho()]]),wo={Asset:z,Memo:jn,Price:tr,PublicKey:ke,String:g,Transaction:Wn,UInt16:he,UInt32:te};let Vt=0,Cr=0;class vt extends Error{constructor(e){super(e.message),this.name="RPCError",this.stack=void 0,this.code=e.code,"data"in e&&(this.data=e.data)}}const po=async(o,e,t,r=ae.timeout,n=!1)=>{const s=Math.floor(Math.random()*1e8),i={jsonrpc:"2.0",method:e,params:t,id:s};try{const a=await(await fetch(o,{method:"POST",body:JSON.stringify(i),headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(r)})).json();if(!a||typeof a.id>"u"||a.id!==s||a.jsonrpc!=="2.0")throw new Error("JSONRPC id missmatch");if("result"in a)return a.result;if("error"in a){const l=a.error;throw"message"in l&&"code"in l?new vt(l):a.error}throw a}catch(c){if(c instanceof vt)throw c;if(n)return po(o,e,t,r,!1);throw c}},bt=async(o,e=[],t=ae.timeout,r=ae.retry)=>{if(!Array.isArray(ae.nodes))throw new Error("config.nodes is not an array");const n=ae.nodes[Vt];try{return await po(n,o,e,t)}catch(s){if(s instanceof vt||(Cr++,Cr>r))throw s;return Kn(),bt(o,e,t,r)}},Kn=(o=Vt+1)=>{o>ae.nodes.length-1&&(o=0),Vt=o},xr=o=>new Promise(e=>setTimeout(e,o)),Zn=ye(ae.chain_id);class rr{constructor(e){this.expiration=6e4,this.createTransaction=async t=>{const r=await bt("condenser_api.get_dynamic_global_properties",[]),n=ye(r.head_block_id),s=Number(new Uint32Array(n.buffer,n.byteOffset+4,1)[0]),i=new Date(Date.now()+t).toISOString().slice(0,-5);this.transaction={expiration:i,extensions:[],operations:[],ref_block_num:r.head_block_number&65535,ref_block_prefix:s,signatures:[]}},e?.transaction&&(e.transaction instanceof rr?(this.transaction=e.transaction.transaction,this.expiration=e.transaction.expiration):this.transaction=e.transaction,this.txId=this.digest().txId),e?.expiration&&(this.expiration=e.expiration)}async addOperation(e,t){this.transaction||await this.createTransaction(this.expiration),this.transaction.operations.push([e,t])}sign(e){if(!this.transaction)throw new Error("First create a transaction by .addOperation()");if(this.transaction){const{digest:t,txId:r}=this.digest();Array.isArray(e)||(e=[e]);for(const n of e){const s=n.sign(t);this.transaction.signatures.push(s.customToString())}return this.txId=r,this.transaction}else throw new Error("No transaction to sign")}async broadcast(e=!1){if(!this.transaction)throw new Error("Attempted to broadcast an empty transaction. Add operations by .addOperation()");if(this.transaction.signatures.length===0)throw new Error("Attempted to broadcast a transaction with no signatures. Sign using .sign(keys)");try{await bt("condenser_api.broadcast_transaction",[this.transaction])}catch(n){if(!(n instanceof vt&&n.message.includes("Duplicate transaction check failed")))throw n}if(this.txId||(this.txId=this.digest().txId),!e)return{tx_id:this.txId,status:"unknown"};await xr(1e3);let t=await this.checkStatus(),r=1;for(;t?.status!=="within_irreversible_block"&&t?.status!=="expired_irreversible"&&t?.status!=="too_old";)await xr(1e3+r*300),t=await this.checkStatus(),r++;return{tx_id:this.txId,status:t.status}}digest(){if(!this.transaction)throw new Error("First create a transaction by .addOperation()");const e=new R(R.DEFAULT_CAPACITY,R.LITTLE_ENDIAN),t={...this.transaction};try{wo.Transaction(e,t)}catch(i){throw new Error("Unable to serialize transaction: "+i)}e.flip();const r=new Uint8Array(e.toBuffer()),n=be(Ke(r)).slice(0,40);return{digest:Ke(new Uint8Array([...Zn,...r])),txId:n}}addSignature(e){if(!this.transaction)throw new Error("First create a transaction by .create(operations)");if(typeof e!="string")throw new Error("Signature must be string");if(e.length!==130)throw new Error("Signature must be 130 characters long");return this.transaction.signatures.push(e),this.transaction}async checkStatus(){return this.txId||(this.txId=this.digest().txId),bt("transaction_status_api.find_transaction",{transaction_id:this.txId,expiration:this.transaction?.expiration})}}const go=new Uint8Array([128]);class _e{constructor(e){this.key=e;try{xe.getPublicKey(e)}catch{throw new Error("invalid private key")}}static from(e){return typeof e=="string"?_e.fromString(e):new _e(e)}static fromString(e){return new _e(Yn(e).subarray(1))}static fromSeed(e){return typeof e=="string"&&(/^[0-9a-fA-F]+$/.test(e)?e=ye(e):e=new TextEncoder().encode(e)),new _e(Ke(e))}static fromLogin(e,t,r="active"){const n=e+r+t;return _e.fromSeed(n)}sign(e){const t=xe.sign(e,this.key,{extraEntropy:!0,format:"recovered",prehash:!1}),r=parseInt(be(t.subarray(0,1)),16);return Et.from((r+31).toString(16)+be(t.subarray(1)))}createPublic(e){return new ce(xe.getPublicKey(this.key),e)}toString(){return Xn(new Uint8Array([...go,...this.key]))}inspect(){const e=this.toString();return`PrivateKey: ${e.slice(0,6)}...${e.slice(-6)}`}getSharedSecret(e){const t=xe.getSharedSecret(this.key,e.key);return Hr(t.subarray(1))}static randomKey(){return new _e(xe.keygen().secretKey)}}const bo=o=>Ke(Ke(o)),Xn=o=>{const e=bo(o);return rt.encode(new Uint8Array([...o,...e.slice(0,4)]))},Yn=o=>{const e=rt.decode(o);if(!Pr(e.slice(0,1),go))throw new Error("Private key network id mismatch");const t=e.slice(-4),r=e.slice(0,-4),n=bo(r).slice(0,4);if(!Pr(t,n))throw new Error("Private key checksum mismatch");return r},Pr=(o,e)=>{if(o===e)return!0;if(o.byteLength!==e.byteLength)return!1;const t=o.byteLength;let r=0;for(;r<t&&o[r]===e[r];)r++;return r===t};/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function Gn(o){return o instanceof Uint8Array||ArrayBuffer.isView(o)&&o.constructor.name==="Uint8Array"}function Ce(o,e,t=""){const r=Gn(o),n=o?.length,s=e!==void 0;if(!r||s&&n!==e){const i=t&&`"${t}" `,c=s?` of length ${e}`:"",a=r?`length=${n}`:`type=${typeof o}`;throw new Error(i+"expected Uint8Array"+c+", got "+a)}return o}function Ue(o){return new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4))}function nt(...o){for(let e=0;e<o.length;e++)o[e].fill(0)}const Qn=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Jn(o,e){return o.buffer===e.buffer&&o.byteOffset<e.byteOffset+e.byteLength&&e.byteOffset<o.byteOffset+o.byteLength}function yo(o,e){if(Jn(o,e)&&o.byteOffset<e.byteOffset)throw new Error("complex overlap of input and output is not supported")}const es=(o,e)=>{function t(r,...n){if(Ce(r,void 0,"key"),!Qn)throw new Error("Non little-endian hardware is not yet supported");if(o.nonceLength!==void 0){const d=n[0];Ce(d,o.varSizeNonce?void 0:o.nonceLength,"nonce")}const s=o.tagLength;s&&n[1]!==void 0&&Ce(n[1],void 0,"AAD");const i=e(r,...n),c=(d,u)=>{if(u!==void 0){if(d!==2)throw new Error("cipher output not supported");Ce(u,void 0,"output")}};let a=!1;return{encrypt(d,u){if(a)throw new Error("cannot encrypt() twice with same key + nonce");return a=!0,Ce(d),c(i.encrypt.length,u),i.encrypt(d,u)},decrypt(d,u){if(Ce(d),s&&d.length<s)throw new Error('"ciphertext" expected length bigger than tagLength='+s);return c(i.decrypt.length,u),i.decrypt(d,u)}}}return Object.assign(t,o),t};function ko(o,e,t=!0){if(e===void 0)return new Uint8Array(o);if(e.length!==o)throw new Error('"output" expected Uint8Array of length '+o+", got: "+e.length);if(t&&!et(e))throw new Error("invalid output, must be aligned");return e}function et(o){return o.byteOffset%4===0}function ot(o){return Uint8Array.from(o)}const Te=16,ts=283;function rs(o){if(![16,24,32].includes(o.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+o.length)}function or(o){return o<<1^ts&-(o>>7)}function Qe(o,e){let t=0;for(;e>0;e>>=1)t^=o&-(e&1),o=or(o);return t}const Ft=(()=>{const o=new Uint8Array(256);for(let t=0,r=1;t<256;t++,r^=or(r))o[t]=r;const e=new Uint8Array(256);e[0]=99;for(let t=0;t<255;t++){let r=o[255-t];r|=r<<8,e[o[t]]=(r^r>>4^r>>5^r>>6^r>>7^99)&255}return nt(o),e})(),os=Ft.map((o,e)=>Ft.indexOf(e)),ns=o=>o<<24|o>>>8,Mt=o=>o<<8|o>>>24;function Bo(o,e){if(o.length!==256)throw new Error("Wrong sbox length");const t=new Uint32Array(256).map((l,d)=>e(o[d])),r=t.map(Mt),n=r.map(Mt),s=n.map(Mt),i=new Uint32Array(256*256),c=new Uint32Array(256*256),a=new Uint16Array(256*256);for(let l=0;l<256;l++)for(let d=0;d<256;d++){const u=l*256+d;i[u]=t[l]^r[d],c[u]=n[l]^s[d],a[u]=o[l]<<8|o[d]}return{sbox:o,sbox2:a,T0:t,T1:r,T2:n,T3:s,T01:i,T23:c}}const nr=Bo(Ft,o=>Qe(o,3)<<24|o<<16|o<<8|Qe(o,2)),vo=Bo(os,o=>Qe(o,11)<<24|Qe(o,13)<<16|Qe(o,9)<<8|Qe(o,14)),ss=(()=>{const o=new Uint8Array(16);for(let e=0,t=1;e<16;e++,t=or(t))o[e]=t;return o})();function _o(o){Ce(o);const e=o.length;rs(o);const{sbox2:t}=nr,r=[];et(o)||r.push(o=ot(o));const n=Ue(o),s=n.length,i=a=>ge(t,a,a,a,a),c=new Uint32Array(e+28);c.set(n);for(let a=s;a<c.length;a++){let l=c[a-1];a%s===0?l=i(ns(l))^ss[a/s-1]:s>6&&a%s===4&&(l=i(l)),c[a]=c[a-s]^l}return nt(...r),c}function is(o){const e=_o(o),t=e.slice(),r=e.length,{sbox2:n}=nr,{T0:s,T1:i,T2:c,T3:a}=vo;for(let l=0;l<r;l+=4)for(let d=0;d<4;d++)t[l+d]=e[r-l-4+d];nt(e);for(let l=4;l<r-4;l++){const d=t[l],u=ge(n,d,d,d,d);t[l]=s[u&255]^i[u>>>8&255]^c[u>>>16&255]^a[u>>>24]}return t}function Re(o,e,t,r,n,s){return o[t<<8&65280|r>>>8&255]^e[n>>>8&65280|s>>>24&255]}function ge(o,e,t,r,n){return o[e&255|t&65280]|o[r>>>16&255|n>>>16&65280]<<16}function Er(o,e,t,r,n){const{sbox2:s,T01:i,T23:c}=nr;let a=0;e^=o[a++],t^=o[a++],r^=o[a++],n^=o[a++];const l=o.length/4-2;for(let p=0;p<l;p++){const b=o[a++]^Re(i,c,e,t,r,n),w=o[a++]^Re(i,c,t,r,n,e),k=o[a++]^Re(i,c,r,n,e,t),B=o[a++]^Re(i,c,n,e,t,r);e=b,t=w,r=k,n=B}const d=o[a++]^ge(s,e,t,r,n),u=o[a++]^ge(s,t,r,n,e),f=o[a++]^ge(s,r,n,e,t),h=o[a++]^ge(s,n,e,t,r);return{s0:d,s1:u,s2:f,s3:h}}function as(o,e,t,r,n){const{sbox2:s,T01:i,T23:c}=vo;let a=0;e^=o[a++],t^=o[a++],r^=o[a++],n^=o[a++];const l=o.length/4-2;for(let p=0;p<l;p++){const b=o[a++]^Re(i,c,e,n,r,t),w=o[a++]^Re(i,c,t,e,n,r),k=o[a++]^Re(i,c,r,t,e,n),B=o[a++]^Re(i,c,n,r,t,e);e=b,t=w,r=k,n=B}const d=o[a++]^ge(s,e,n,r,t),u=o[a++]^ge(s,t,e,n,r),f=o[a++]^ge(s,r,t,e,n),h=o[a++]^ge(s,n,r,t,e);return{s0:d,s1:u,s2:f,s3:h}}function cs(o){if(Ce(o),o.length%Te!==0)throw new Error("aes-(cbc/ecb).decrypt ciphertext should consist of blocks with size "+Te)}function ls(o,e,t){Ce(o);let r=o.length;const n=r%Te;if(!e&&n!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");et(o)||(o=ot(o));const s=Ue(o);if(e){let c=Te-n;c||(c=Te),r=r+c}t=ko(r,t),yo(o,t);const i=Ue(t);return{b:s,o:i,out:t}}function ds(o,e){if(!e)return o;const t=o.length;if(!t)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=o[t-1];if(r<=0||r>16)throw new Error("aes/pcks5: wrong padding");const n=o.subarray(0,-r);for(let s=0;s<r;s++)if(o[t-s-1]!==r)throw new Error("aes/pcks5: wrong padding");return n}function us(o){const e=new Uint8Array(16),t=Ue(e);e.set(o);const r=Te-o.length;for(let n=Te-r;n<Te;n++)e[n]=r;return t}const Co=es({blockSize:16,nonceLength:16},function(e,t,r={}){const n=!r.disablePadding;return{encrypt(s,i){const c=_o(e),{b:a,o:l,out:d}=ls(s,n,i);let u=t;const f=[c];et(u)||f.push(u=ot(u));const h=Ue(u);let p=h[0],b=h[1],w=h[2],k=h[3],B=0;for(;B+4<=a.length;)p^=a[B+0],b^=a[B+1],w^=a[B+2],k^=a[B+3],{s0:p,s1:b,s2:w,s3:k}=Er(c,p,b,w,k),l[B++]=p,l[B++]=b,l[B++]=w,l[B++]=k;if(n){const C=us(s.subarray(B*4));p^=C[0],b^=C[1],w^=C[2],k^=C[3],{s0:p,s1:b,s2:w,s3:k}=Er(c,p,b,w,k),l[B++]=p,l[B++]=b,l[B++]=w,l[B++]=k}return nt(...f),d},decrypt(s,i){cs(s);const c=is(e);let a=t;const l=[c];et(a)||l.push(a=ot(a));const d=Ue(a);i=ko(s.length,i),et(s)||l.push(s=ot(s)),yo(s,i);const u=Ue(s),f=Ue(i);let h=d[0],p=d[1],b=d[2],w=d[3];for(let k=0;k+4<=u.length;){const B=h,C=p,E=b,T=w;h=u[k+0],p=u[k+1],b=u[k+2],w=u[k+3];const{s0:V,s1:oe,s2:X,s3:U}=as(c,h,p,b,w);f[k++]=V^B,f[k++]=oe^C,f[k++]=X^E,f[k++]=U^T}return nt(...l),ds(i,n)}}}),fs=(o,e,t,r=ps())=>xo(o,e,r,t),hs=(o,e,t,r,n)=>xo(o,e,t,r,n).message,xo=(o,e,t,r,n)=>{const s=typeof t=="bigint"?t:BigInt(t),i=o.getSharedSecret(e);let c=new R(R.DEFAULT_CAPACITY,R.LITTLE_ENDIAN);c.writeUint64(s),c.append(i),c.flip();const a=Hr(new Uint8Array(c.toBuffer())),l=a.subarray(32,48),d=a.subarray(0,32),u=Ke(a).subarray(0,4),f=new R(R.DEFAULT_CAPACITY,R.LITTLE_ENDIAN);f.append(u),f.flip();const h=f.readUint32();if(n){if(h!==n)throw new Error("Invalid key");r=ms(r,d,l)}else r=ws(r,d,l);return{nonce:s,message:r,checksum:h}},ms=(o,e,t)=>{let r=o;return r=Co(e,t).decrypt(r),r},ws=(o,e,t)=>{let r=o;return r=Co(e,t).encrypt(r),r};let Ot=null;const ps=()=>{if(Ot===null){const t=xe.utils.randomSecretKey();Ot=Math.round(t[0]<<8|t[1])}let o=BigInt(Date.now());const e=++Ot%65535;return o=o<<BigInt(16)|BigInt(e),o},Sr=o=>{const e=Bs(o,33);return new ce(e)},gs=o=>o.readUint64(),bs=o=>o.readUint32(),ys=o=>{const e=o.readVarint32(),t=o.copy(o.offset,o.offset+e);return o.skip(e),new Uint8Array(t.toBuffer())},ks=o=>e=>{const t={},r=new R(R.DEFAULT_CAPACITY,R.LITTLE_ENDIAN);r.append(e),r.flip();for(const[n,s]of o)try{t[n]=s(r)}catch(i){throw i.message=`${n}: ${i.message}`,i}return t};function Bs(o,e){if(o){const t=o.copy(o.offset,o.offset+e);return o.skip(e),new Uint8Array(t.toBuffer())}else throw Error("No buffer found on first parameter")}const vs=ks([["from",Sr],["to",Sr],["nonce",gs],["check",bs],["encrypted",ys]]),_s={Memo:vs},Po=(o,e,t,r)=>{if(!t.startsWith("#"))return t;t=t.substring(1),So(),o=Ao(o),e=Cs(e);const n=new R(R.DEFAULT_CAPACITY,R.LITTLE_ENDIAN);n.writeVString(t);const s=new Uint8Array(n.copy(0,n.offset).toBuffer()),{nonce:i,message:c,checksum:a}=fs(o,e,s,r),l=new R(R.DEFAULT_CAPACITY,R.LITTLE_ENDIAN);wo.Memo(l,{check:a,encrypted:c,from:o.createPublic(),nonce:i,to:e}),l.flip();const d=new Uint8Array(l.toBuffer());return"#"+rt.encode(d)},Eo=(o,e)=>{if(!e.startsWith("#"))return e;e=e.substring(1),So(),o=Ao(o);let t=_s.Memo(rt.decode(e));const{from:r,to:n,nonce:s,check:i,encrypted:c}=t,l=o.createPublic().toString()===new ce(r.key).toString()?new ce(n.key):new ce(r.key);t=hs(o,l,s,c,i);const d=new R(R.DEFAULT_CAPACITY,R.LITTLE_ENDIAN);return d.append(t),d.flip(),"#"+d.readVString()};let pt;const So=()=>{if(pt===void 0){let o;pt=!0;try{const e="5JdeC9P7Pbd1uGdFVEsJ41EkEnADbbHGq6p1BwFxm6txNBsQnsw",r=Po(e,"STM8m5UgaFAAYQRuaNejYdS8FVLVp9Ss3K1qAVk5de6F8s3HnVbvA","#memo爱");o=Eo(e,r)}finally{pt=o==="#memo爱"}}if(pt===!1)throw new Error("This environment does not support encryption.")},Ao=o=>typeof o=="string"?_e.fromString(o):o,Cs=o=>typeof o=="string"?ce.fromString(o):o,xs={decode:Eo,encode:Po};class Ps{timeout;constructor(e=1e4){this.timeout=e}async send(e,t){const r=new AbortController,n=setTimeout(()=>r.abort(),this.timeout);try{const s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:r.signal});if(!s.ok)throw new Error(`HTTP ${s.status}: ${s.statusText}`);return await s.json()}finally{clearTimeout(n)}}}class Es{endpoints;currentIndex=0;transport;requestId=1;constructor(e,t){this.endpoints=e??["https://api.hive.blog","https://api.deathwing.me","https://hive-api.arcange.eu"],this.transport=t??new Ps,ae.nodes=[this.endpoints[0]]}get currentEndpoint(){return this.endpoints[this.currentIndex]}getEndpoints(){return this.endpoints.map((e,t)=>this.endpoints[(this.currentIndex+t)%this.endpoints.length])}setEndpoints(e){if(e.length===0)throw new Error("At least one endpoint required");this.endpoints=e,this.currentIndex=0,ae.nodes=[e[0]]}setTransport(e){this.transport=e}async call(e,t=[]){const r=this.endpoints.length;let n;for(let s=0;s<r;s++){const i=this.endpoints[(this.currentIndex+s)%this.endpoints.length],c={jsonrpc:"2.0",method:e,params:t,id:this.requestId++};try{const a=await this.transport.send(i,c);if(a.error)throw new Error(`RPC error ${a.error.code}: ${a.error.message}`);return this.currentIndex=(this.currentIndex+s)%this.endpoints.length,ae.nodes=[this.endpoints[this.currentIndex]],a.result}catch(a){n=a instanceof Error?a:new Error(String(a)),console.warn(`RPC call to ${i} failed: ${n.message}`)}}throw new Error(`All RPC endpoints failed. Last error: ${n?.message}`)}async healthCheck(){try{return await this.call("condenser_api.get_dynamic_global_properties"),!0}catch{return!1}}async getAccounts(e){return this.call("condenser_api.get_accounts",[e])}async getDynamicGlobalProperties(){return this.call("condenser_api.get_dynamic_global_properties")}async broadcastTransaction(e){return this.call("condenser_api.broadcast_transaction_synchronous",[e])}async getAccountHistory(e,t=-1,r=100){return this.call("condenser_api.get_account_history",[e,t,r])}}let Ut;function Ne(){return Ut||(Ut=new Es),Ut}function st(o){const e=_e.from(o),t=e.createPublic();return{private:e,public:t}}function Ss(o,e){const t=o.toString();return e.active.key_auths.some(([r])=>r===t)?"active":e.posting.key_auths.some(([r])=>r===t)?"posting":e.owner.key_auths.some(([r])=>r===t)?"owner":e.memo_key===t?"memo":null}async function Ar(o,e){const t=st(o),n=await Ne().getAccounts([e]);if(n.length===0)throw new Error(`Account @${e} not found`);const s=n[0],i=Ss(t.public,s);if(!i)throw new Error(`Key does not match any authority on @${e}`);return{...t,role:i,account:s}}function Fe(o){const e=o.trim().split(" ");if(e.length!==2)throw new Error(`Invalid asset format: ${o}`);return{amount:parseFloat(e[0]),symbol:e[1]}}function We(o,e){return`${o.toFixed(3)} ${e}`}const As=1;function Ls(){return As>=2}function Wt(){return!1}function Lo(o,e){if(!o.startsWith("#"))return o;const t=xs.decode(e,o);return t.startsWith("#")?t.slice(1):t}const Is=["haa-service"];async function $s(o,e,t=Is,r=500){const n=Ne(),s=[],i=new Set(t.map(l=>l.toLowerCase())),c=Math.min(r,1e3),a=await n.getAccountHistory(o,-1,c);for(const[l,d]of a){const[u,f]=d.op;if(u!=="transfer")continue;const{from:h,to:p,memo:b}=f;if(p.toLowerCase()===o.toLowerCase()&&i.has(h.toLowerCase())&&!(!b||!b.startsWith("#")))try{const w=Lo(b,e),k=JSON.parse(w);if(!Os(k)||new Date(k.expires)<new Date)continue;s.push({payload:k,timestamp:d.timestamp,trxId:d.trx_id,from:h})}catch{continue}}return s.sort((l,d)=>new Date(d.timestamp).getTime()-new Date(l.timestamp).getTime()),s}async function Ms(o,e,t){const r=await $s(o,e,t);return r.length>0?r[0].payload:null}function Os(o){if(typeof o!="object"||o===null)return!1;const e=o;return typeof e.v=="number"&&Array.isArray(e.endpoints)&&e.endpoints.length>0&&e.endpoints.every(t=>typeof t=="string")&&typeof e.expires=="string"}const Us=["https://api.hive.blog","https://api.deathwing.me","https://hive-api.arcange.eu"],Rt="propolis_manual_endpoints";class Rs{endpoints=[];discoveryInterval=null;healthInterval=null;serviceAccounts;lastPayload=null;lastDiscoveryTime=0;discoveryAttempted=!1;constructor(e=["haa-service"]){this.serviceAccounts=e,this.loadManualEndpoints(),this.addFallbacks()}hasProxyEndpoints(){return this.endpoints.some(e=>e.source==="discovered"||e.source==="manual")}get allEndpoints(){return[...this.endpoints]}get healthyEndpoints(){const e={discovered:0,manual:1,fallback:2};return this.endpoints.filter(t=>t.healthy).sort((t,r)=>e[t.source]-e[r.source]).map(t=>t.url)}addManualEndpoint(e){this.endpoints.some(t=>t.url===e)||(this.endpoints.push({url:e,source:"manual",healthy:!0,lastCheck:0}),this.saveManualEndpoints(),this.applyToClient())}removeManualEndpoint(e){this.endpoints=this.endpoints.filter(t=>!(t.url===e&&t.source==="manual")),this.saveManualEndpoints(),this.applyToClient()}async discover(e,t){this.discoveryAttempted=!0;try{const r=await Ms(e,t,this.serviceAccounts);if(r){this.lastPayload=r,this.lastDiscoveryTime=Date.now(),this.endpoints=this.endpoints.filter(n=>n.source!=="discovered");for(const n of r.endpoints)this.endpoints.push({url:n,source:"discovered",healthy:!0,lastCheck:0});return this.applyToClient(),!0}return!1}catch(r){return console.warn("Endpoint discovery failed:",r),!1}}async healthCheckAll(){const t=(Wt()?this.endpoints.filter(r=>r.source!=="fallback"):this.endpoints).map(async r=>{try{const n=new AbortController,s=setTimeout(()=>n.abort(),8e3),i=await fetch(r.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"condenser_api.get_dynamic_global_properties",params:[],id:1}),signal:n.signal});clearTimeout(s),r.healthy=i.ok}catch{r.healthy=!1}r.lastCheck=Date.now()});await Promise.allSettled(t),this.applyToClient()}startPeriodicChecks(e,t,r=30*6e4,n=5*6e4){this.stopPeriodicChecks(),this.discover(e,t),this.discoveryInterval=setInterval(()=>this.discover(e,t),r),setTimeout(()=>{this.healthCheckAll(),this.healthInterval=setInterval(()=>this.healthCheckAll(),n)},15e3)}stopPeriodicChecks(){this.discoveryInterval&&(clearInterval(this.discoveryInterval),this.discoveryInterval=null),this.healthInterval&&(clearInterval(this.healthInterval),this.healthInterval=null)}applyToClient(){const e={discovered:0,manual:1,fallback:2};let t=this.endpoints.filter(n=>n.healthy);Wt()&&(t=t.filter(n=>n.source!=="fallback"));const r=t.sort((n,s)=>e[n.source]-e[s.source]).map(n=>n.url);if(r.length>0)try{Ne().setEndpoints(r)}catch{}}loadManualEndpoints(){try{const e=localStorage.getItem(Rt);if(!e)return;const t=JSON.parse(e);for(const r of t)this.endpoints.some(n=>n.url===r)||this.endpoints.push({url:r,source:"manual",healthy:!0,lastCheck:0})}catch{}}saveManualEndpoints(){const e=this.endpoints.filter(t=>t.source==="manual").map(t=>t.url);e.length>0?localStorage.setItem(Rt,JSON.stringify(e)):localStorage.removeItem(Rt)}addFallbacks(){for(const e of Us)this.endpoints.some(t=>t.url===e)||this.endpoints.push({url:e,source:"fallback",healthy:!0,lastCheck:0})}}let Tt;function it(){return Tt||(Tt=new Rs),Tt}function fe(o,...e){return e.reduce((t,r,n)=>t.replace(`%${n+1}`,String(r)),o)}const m={html_lang:"en",html_dir:"ltr",app_title:"Propolis Wallet",nav_balance:"Balance",nav_transfer:"Transfer",nav_savings:"Savings",nav_settings:"Settings",loading:"Loading...",amount:"Amount",confirm:"Confirm",cancel:"Cancel",broadcasting:"Broadcasting...",invalid_url:"Invalid URL.",https_required:"HTTPS required for proxy URLs.",enter_proxy_url:"Enter a proxy URL.",amount_positive:"Amount must be > 0.",username_placeholder:"username",key_placeholder:"5K...",proxy_placeholder:"https://proxy.example.com",rpc_placeholder:"https://proxy.example.com/rpc",confirm_direct_mode:"Direct mode exposes Hive traffic. Continue?",confirm_logout:"Logout and clear keys?",login_title:"Login",login_info:"Enter your Hive account name and private active key. Your key never leaves this device.",account_name:"Account name",private_active_key:"Private active key",private_memo_key:"Private memo key (optional)",memo_key_placeholder:"5K... (for encrypted messages)",remember_keys:"Remember keys",remember_warning:"Keys stored in localStorage. Only use on a trusted device.",login_btn:"Login",account_key_required:"Account and active key required.",validating:"Validating...",wrong_key_role:"This is a %1 key. Active key required.",wrong_memo_role:"Second key is %1, not memo.",scan_qr:"Scan QR Code",qr_scanning:"Point camera at QR code",qr_filled_all:"Scanned! Account and keys filled.",qr_filled_active:"Scanned! Active key filled.",qr_filled_memo:"Scanned! Memo key filled.",qr_unknown:"Unrecognized QR code format",qr_no_camera:"Camera access denied",proxy_setup:"Proxy Setup",proxy_required:"Proxy required",proxy_desc_reconnect:"Obfuscation is enabled but no proxy endpoint is configured. Enter a proxy URL to reconnect.",proxy_desc_connect:"Obfuscation is enabled. Enter a proxy endpoint URL to connect.",proxy_url:"Proxy URL",connect:"Connect",switch_direct_link:"Or switch to Direct mode",paste_memo_prefix:"Or paste an encrypted memo from a",block_explorer:"block explorer",paste_memo_suffix:":",memo_textarea_placeholder:"#encrypted_memo...",decrypt_connect:"Decrypt & Connect",paste_memo_error:"Paste the encrypted memo.",memo_key_required:"Memo key required to decrypt.",private_memo_key_label:"Private memo key",memo_not_hash:"Memo must start with #",memo_bad_json:"Decrypted memo is not valid JSON.",memo_bad_payload:"Memo does not contain endpoint data.",memo_expired:"Endpoint data has expired.",account_label:"Account",account_not_found:"Account not found.",refresh:"Refresh",hive:"HIVE",hbd:"HBD",hive_savings:"HIVE Savings",hbd_savings:"HBD Savings",est_interest:"Est. interest (~20% APR):",hbd_yr:"HBD/yr",pending_withdrawals:"%1 pending withdrawal(s)",rpc_label:"RPC:",obfuscated:"obfuscated",direct:"direct",send_transfer:"Send Transfer",recipient:"Recipient",currency:"Currency",memo_optional:"Memo (optional)",public_memo:"Public memo",send:"Send",recipient_required:"Recipient required.",confirm_send:"Send %1 to @%2?",sent_tx:"Sent! TX: %1... (%2)",deposit_heading:"Deposit to Savings",withdraw_heading:"Withdraw from Savings",three_day_wait:"3-day waiting period for security.",deposit_btn:"Deposit to Savings",withdraw_btn:"Withdraw from Savings",pending_heading:"Pending",cancel_latest:"Cancel Latest",available_hbd:"Available: %1 HBD",apr_estimate:"~%1 HBD/yr (~20% APR)",n_pending:"%1 pending",cancelled:"Cancelled. (%1)",confirm_deposit:"Deposit %1?",confirm_withdraw:"Withdraw (3-day wait) %1?",deposited:"Deposited",withdrawal_initiated:"Withdrawal initiated",not_found:"Not found.",privacy:"Privacy",mode_label:"Mode:",mode_obfuscated:"Obfuscated",mode_direct:"Direct",traffic_disguised:"Traffic disguised as normal web requests.",traffic_plain:"Plain JSON-RPC — visible to network observers.",switch_to_direct:"Switch to Direct",switch_to_obfuscated:"Switch to Obfuscated",rpc_endpoint:"RPC Endpoint",current_label:"Current:",custom_endpoint:"Custom endpoint",set_btn:"Set",reset_btn:"Reset",check_btn:"Check",enter_url:"Enter a URL.",added:"Added.",reset_done:"Reset.",discovery:"Discovery",status_label:"Status:",n_found:"%1 found",none_found:"None found",checking:"Checking...",expires_label:"Expires: %1",discover:"Discover",check_all:"Check All",no_memo_key:"No memo key — discovery disabled.",add_memo_hint:"Add memo key at login to discover proxy endpoints.",found_n:"Found %1",none_found_dot:"None found.",done:"Done.",endpoints:"Endpoints",none:"None.",account_heading:"Account",active_check:"Active:",memo_check:"Memo:",persistent:"Persistent",session:"Session",logout:"Logout",about:"About",about_text:"Propolis Wallet v1.0.0 — Keys never leave this device.",err_missing_active_auth:"Active key does not have authority for this account.",err_missing_posting_auth:"Posting key does not have authority for this account.",err_missing_owner_auth:"Owner key does not have authority for this account.",err_key_mismatch:"Key does not match this account.",err_insufficient_rc:"Insufficient resource credits. Wait for recovery or request HP delegation.",err_account_not_found:"Account not found on the blockchain.",err_tx_expired:"Transaction expired. Please try again.",err_duplicate_tx:"Duplicate transaction — already processed.",err_all_endpoints_failed:"Unable to reach any RPC node. Check your network connection.",err_http_error:"Server error. Try again or switch RPC node.",err_network:"Network error. Check your internet connection.",err_timeout:"Request timed out. Try again or switch RPC node.",err_unknown:"Operation failed. Please try again."};function qt(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const Ts=[[/missing required active authority/i,()=>m.err_missing_active_auth],[/missing required posting authority/i,()=>m.err_missing_posting_auth],[/missing required owner authority/i,()=>m.err_missing_owner_auth],[/does not match any authority/i,()=>m.err_key_mismatch],[/insufficient Resource Credits/i,()=>m.err_insufficient_rc],[/Account.+not found/i,()=>m.err_account_not_found],[/uniqueness constraint/i,()=>m.err_duplicate_tx],[/All RPC endpoints failed/i,()=>m.err_all_endpoints_failed],[/HTTP [45]\d\d/i,()=>m.err_http_error],[/Failed to fetch|NetworkError|ERR_/i,()=>m.err_network],[/AbortError|timed?\s*out/i,()=>m.err_timeout],[/expir/i,()=>m.err_tx_expired]];function sr(o){const e=qt(o);for(const[t,r]of Ts)if(t.test(o))return`${qt(r())}<br><span class="xs" style="opacity:0.7;word-break:break-all">${e}</span>`;return`${qt(m.err_unknown)}<br><span class="xs" style="opacity:0.7;word-break:break-all">${e}</span>`}function _t(o,e){o.innerHTML=sr(e instanceof Error?e.message:String(e)),o.classList.remove("hidden")}const qs="modulepreload",Ds=function(o,e){return new URL(o,e).href},Lr={},Ns=function(e,t,r){let n=Promise.resolve();if(t&&t.length>0){let i=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const c=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");n=i(t.map(d=>{if(d=Ds(d,r),d in Lr)return;Lr[d]=!0;const u=d.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(!!r)for(let b=c.length-1;b>=0;b--){const w=c[b];if(w.href===d&&(!u||w.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${f}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":qs,u||(p.as="script"),p.crossOrigin="",p.href=d,l&&p.setAttribute("nonce",l),document.head.appendChild(p),u)return new Promise((b,w)=>{p.addEventListener("load",b),p.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return n.then(i=>{for(const c of i||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};class D{constructor(e,t,r,n,s){this._legacyCanvasSize=D.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=e,this.$canvas=document.createElement("canvas"),r&&typeof r=="object"?this._onDecode=t:(console.warn(r||n||s?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=t),t=typeof r=="object"?r:{},this._onDecodeError=t.onDecodeError||(typeof r=="function"?r:this._onDecodeError),this._calculateScanRegion=t.calculateScanRegion||(typeof n=="function"?n:this._calculateScanRegion),this._preferredCamera=t.preferredCamera||s||this._preferredCamera,this._legacyCanvasSize=typeof r=="number"?r:typeof n=="number"?n:this._legacyCanvasSize,this._maxScansPerSecond=t.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),e.disablePictureInPicture=!0,e.playsInline=!0,e.muted=!0;let i=!1;if(e.hidden&&(e.hidden=!1,i=!0),document.body.contains(e)||(document.body.appendChild(e),i=!0),r=e.parentElement,t.highlightScanRegion||t.highlightCodeOutline){if(n=!!t.overlay,this.$overlay=t.overlay||document.createElement("div"),s=this.$overlay.style,s.position="absolute",s.display="none",s.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!n&&t.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}r.insertBefore(this.$overlay,this.$video.nextSibling)}t.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(e),requestAnimationFrame(()=>{let c=window.getComputedStyle(e);c.display==="none"&&(e.style.setProperty("display","block","important"),i=!0),c.visibility!=="visible"&&(e.style.setProperty("visibility","visible","important"),i=!0),i&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),e.style.opacity="0",e.style.width="0",e.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),e.addEventListener("play",this._onPlay),e.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=D.createQrEngine()}static set WORKER_PATH(e){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await D.listCameras(!1)).length}catch{return!1}}static async listCameras(e=!1){if(!navigator.mediaDevices)return[];let t=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(n=>n.kind==="videoinput"),r;try{e&&(await t()).every(n=>!n.label)&&(r=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await t()).map((n,s)=>({id:n.deviceId,label:n.label||(s===0?"Default Camera":`Camera ${s+1}`)}))}finally{r&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),D._stopVideoStream(r))}}async hasFlash(){let e;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;e=this.$video.srcObject}else e=(await this._getCameraStream()).stream;return"torch"in e.getVideoTracks()[0].getSettings()}catch{return!1}finally{e&&e!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),D._stopVideoStream(e))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(e){throw this._flashOn=!1,e}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),D._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:e,facingMode:t}=await this._getCameraStream();!this._active||this._paused?D._stopVideoStream(e):(this._setVideoMirror(t),this.$video.srcObject=e,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(e){if(!this._paused)throw this._active=!1,e}}stop(){this.pause(),this._active=!1}async pause(e=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let t=()=>{this.$video.srcObject instanceof MediaStream&&(D._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return e?(t(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(t(),!0):!1)}async setCamera(e){e!==this._preferredCamera&&(this._preferredCamera=e,await this._restartVideoStream())}static async scanImage(e,t,r,n,s=!1,i=!1){let c,a=!1;t&&("scanRegion"in t||"qrEngine"in t||"canvas"in t||"disallowCanvasResizing"in t||"alsoTryWithoutScanRegion"in t||"returnDetailedScanResult"in t)?(c=t.scanRegion,r=t.qrEngine,n=t.canvas,s=t.disallowCanvasResizing||!1,i=t.alsoTryWithoutScanRegion||!1,a=!0):console.warn(t||r||n||s||i?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),t=!!r;try{let l,d;[r,l]=await Promise.all([r||D.createQrEngine(),D._loadImage(e)]),[n,d]=D._drawToCanvas(l,c,n,s);let u;if(r instanceof Worker){let f=r;t||D._postWorkerMessageSync(f,"inversionMode","both"),u=await new Promise((h,p)=>{let b,w,k,B=-1;w=E=>{E.data.id===B&&(f.removeEventListener("message",w),f.removeEventListener("error",k),clearTimeout(b),E.data.data!==null?h({data:E.data.data,cornerPoints:D._convertPoints(E.data.cornerPoints,c)}):p(D.NO_QR_CODE_FOUND))},k=E=>{f.removeEventListener("message",w),f.removeEventListener("error",k),clearTimeout(b),p("Scanner error: "+(E?E.message||E:"Unknown Error"))},f.addEventListener("message",w),f.addEventListener("error",k),b=setTimeout(()=>k("timeout"),1e4);let C=d.getImageData(0,0,n.width,n.height);B=D._postWorkerMessageSync(f,"decode",C,[C.data.buffer])})}else u=await Promise.race([new Promise((f,h)=>window.setTimeout(()=>h("Scanner error: timeout"),1e4)),(async()=>{try{var[f]=await r.detect(n);if(!f)throw D.NO_QR_CODE_FOUND;return{data:f.rawValue,cornerPoints:D._convertPoints(f.cornerPoints,c)}}catch(h){if(f=h.message||h,/not implemented|service unavailable/.test(f))return D._disableBarcodeDetector=!0,D.scanImage(e,{scanRegion:c,canvas:n,disallowCanvasResizing:s,alsoTryWithoutScanRegion:i});throw`Scanner error: ${f}`}})()]);return a?u:u.data}catch(l){if(!c||!i)throw l;let d=await D.scanImage(e,{qrEngine:r,canvas:n,disallowCanvasResizing:s});return a?d:d.data}finally{t||D._postWorkerMessage(r,"close")}}setGrayscaleWeights(e,t,r,n=!0){D._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:e,green:t,blue:r,useIntegerApproximation:n})}setInversionMode(e){D._postWorkerMessage(this._qrEnginePromise,"inversionMode",e)}static async createQrEngine(e){if(e&&console.warn("Specifying a worker path is not required and not supported anymore."),e=()=>Ns(()=>Promise.resolve().then(()=>ci),void 0,import.meta.url).then(r=>r.createWorker()),!(!D._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return e();let t=navigator.userAgentData;return t&&t.brands.some(({brand:r})=>/Chromium/i.test(r))&&/mac ?OS/i.test(t.platform)&&await t.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:r,platformVersion:n})=>/arm/i.test(r||"arm")&&13<=parseInt(n||"13")).catch(()=>!0)?e():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(e){let t=Math.round(.6666666666666666*Math.min(e.videoWidth,e.videoHeight));return{x:Math.round((e.videoWidth-t)/2),y:Math.round((e.videoHeight-t)/2),width:t,height:t,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var e=this.$video,t=e.videoWidth,r=e.videoHeight,n=e.offsetWidth,s=e.offsetHeight,i=e.offsetLeft,c=e.offsetTop,a=window.getComputedStyle(e),l=a.objectFit,d=t/r,u=n/s;switch(l){case"none":var f=t,h=r;break;case"fill":f=n,h=s;break;default:(l==="cover"?d>u:d<u)?(h=s,f=h*d):(f=n,h=f/d),l==="scale-down"&&(f=Math.min(f,t),h=Math.min(h,r))}var[p,b]=a.objectPosition.split(" ").map((k,B)=>{const C=parseFloat(k);return k.endsWith("%")?(B?s-h:n-f)*C/100:C});a=this._scanRegion.width||t,u=this._scanRegion.height||r,l=this._scanRegion.x||0;var w=this._scanRegion.y||0;d=this.$overlay.style,d.width=`${a/t*f}px`,d.height=`${u/r*h}px`,d.top=`${c+b+w/r*h}px`,r=/scaleX\(-1\)/.test(e.style.transform),d.left=`${i+(r?n-p-f:p)+(r?t-l-a:l)/t*f}px`,d.transform=e.style.transform}})}static _convertPoints(e,t){if(!t)return e;let r=t.x||0,n=t.y||0,s=t.width&&t.downScaledWidth?t.width/t.downScaledWidth:1;t=t.height&&t.downScaledHeight?t.height/t.downScaledHeight:1;for(let i of e)i.x=i.x*s+r,i.y=i.y*t+n;return e}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var e=Date.now()-this._lastScanTimestamp,t=1e3/this._maxScansPerSecond;e<t&&await new Promise(n=>setTimeout(n,t-e)),this._lastScanTimestamp=Date.now();try{var r=await D.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(n){if(!this._active)return;this._onDecodeError(n)}!D._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=D.createQrEngine()),r?(this._onDecode?this._onDecode(r):this._legacyOnDecode&&this._legacyOnDecode(r.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",r.cornerPoints.map(({x:n,y:s})=>`${n},${s}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(e){e!==D.NO_QR_CODE_FOUND&&console.log(e)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let e=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",t=[{width:{min:1024}},{width:{min:768}},{}],r=t.map(n=>Object.assign({},n,{[e]:{exact:this._preferredCamera}}));for(let n of[...r,...t])try{let s=await navigator.mediaDevices.getUserMedia({video:n,audio:!1}),i=this._getFacingMode(s)||(n.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:s,facingMode:i}}catch{}throw"Camera not found."}async _restartVideoStream(){let e=this._paused;await this.pause(!0)&&!e&&this._active&&await this.start()}static _stopVideoStream(e){for(let t of e.getTracks())t.stop(),e.removeTrack(t)}_setVideoMirror(e){this.$video.style.transform="scaleX("+(e==="user"?-1:1)+")"}_getFacingMode(e){return(e=e.getVideoTracks()[0])?/rear|back|environment/i.test(e.label)?"environment":/front|user|face/i.test(e.label)?"user":null:null}static _drawToCanvas(e,t,r,n=!1){r=r||document.createElement("canvas");let s=t&&t.x?t.x:0,i=t&&t.y?t.y:0,c=t&&t.width?t.width:e.videoWidth||e.width,a=t&&t.height?t.height:e.videoHeight||e.height;return n||(n=t&&t.downScaledWidth?t.downScaledWidth:c,t=t&&t.downScaledHeight?t.downScaledHeight:a,r.width!==n&&(r.width=n),r.height!==t&&(r.height=t)),t=r.getContext("2d",{alpha:!1}),t.imageSmoothingEnabled=!1,t.drawImage(e,s,i,c,a,0,0,r.width,r.height),[r,t]}static async _loadImage(e){if(e instanceof Image)return await D._awaitImageLoad(e),e;if(e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof SVGImageElement||"OffscreenCanvas"in window&&e instanceof OffscreenCanvas||"ImageBitmap"in window&&e instanceof ImageBitmap)return e;if(e instanceof File||e instanceof Blob||e instanceof URL||typeof e=="string"){let t=new Image;t.src=e instanceof File||e instanceof Blob?URL.createObjectURL(e):e.toString();try{return await D._awaitImageLoad(t),t}finally{(e instanceof File||e instanceof Blob)&&URL.revokeObjectURL(t.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(e){e.complete&&e.naturalWidth!==0||await new Promise((t,r)=>{let n=s=>{e.removeEventListener("load",n),e.removeEventListener("error",n),s instanceof ErrorEvent?r("Image load error"):t()};e.addEventListener("load",n),e.addEventListener("error",n)})}static async _postWorkerMessage(e,t,r,n){return D._postWorkerMessageSync(await e,t,r,n)}static _postWorkerMessageSync(e,t,r,n){if(!(e instanceof Worker))return-1;let s=D._workerMessageId++;return e.postMessage({id:s,type:t,data:r},n),s}}D.DEFAULT_CANVAS_SIZE=400;D.NO_QR_CODE_FOUND="No QR code found";D._disableBarcodeDetector=!1;D._workerMessageId=0;function Hs(){return!!navigator.mediaDevices?.getUserMedia}const zs=/^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/;function Vs(o){const e=o.trim();if(e.startsWith("propolis://login"))try{const t=new URL(e.replace("propolis://","https://")),r=t.searchParams.get("a"),n=t.searchParams.get("k"),s=t.searchParams.get("m")||void 0;if(r&&n)return{type:"combined",account:r,activeWif:n,memoWif:s}}catch{}return e.length===51&&e[0]==="5"&&zs.test(e)?{type:"wif",key:e}:{type:"unknown"}}function Fs(){return new Promise(o=>{const e=document.createElement("div");e.style.cssText="position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,0.92);display:flex;flex-direction:column;align-items:center;justify-content:center;";const t=document.createElement("button");t.textContent="×",t.style.cssText="position:absolute;top:12px;right:16px;background:none;border:none;color:#fff;font-size:2rem;cursor:pointer;z-index:10000;width:auto;padding:4px 12px;";const r=document.createElement("video");r.setAttribute("playsinline",""),r.setAttribute("autoplay",""),r.muted=!0,r.style.cssText="width:80vw;max-height:60vh;min-height:200px;border-radius:8px;border:2px solid #4ecca3;object-fit:cover;background:#000;";const n=document.createElement("p");n.textContent=m.qr_scanning,n.style.cssText="color:#a0a0b0;font-size:0.85rem;margin-top:12px;text-align:center;padding:0 1rem;",e.appendChild(t),e.appendChild(r),e.appendChild(n),document.body.appendChild(e);let s=null,i=!1;const c=()=>{s&&(s.destroy(),s=null),e.parentNode&&e.parentNode.removeChild(e)},a=d=>{i||(i=!0,c(),o(d))},l=d=>{n.textContent=d,n.style.color="#ff6b6b"};t.addEventListener("click",()=>a(null)),navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}}).then(d=>{d.getTracks().forEach(u=>u.stop()),s=new D(r,u=>{a(u.data)},{preferredCamera:"environment",maxScansPerSecond:5,returnDetailedScanResult:!0,onDecodeError:()=>{}}),s.start().catch(u=>{l(u instanceof Error?u.message:m.qr_no_camera)})}).catch(d=>{const u=d instanceof Error&&d.name==="NotAllowedError"?m.qr_no_camera:d instanceof Error?d.message:m.qr_no_camera;l(u)})})}const $e=(o,e)=>e.querySelector(o);async function Ws(o,e,t){it(),e.account;let r=null;try{r=localStorage.getItem("propolis_bootstrap_memo_key"),r&&localStorage.removeItem("propolis_bootstrap_memo_key")}catch{}o.innerHTML=`<div class="card"><h2>${m.login_title}</h2>
    
    <p class="sm mt mb">${m.login_info}</p>
    ${Hs()?`<button class="btn-s mb" id="qr" type="button">${m.scan_qr}</button>`:""}
    <label>${m.account_name}</label><input id="a" placeholder="${m.username_placeholder}" autocomplete="off" spellcheck="false">
    <label>${m.private_active_key}</label><input type="password" id="k" placeholder="${m.key_placeholder}" autocomplete="off">
    <label>${m.private_memo_key}</label><input type="password" id="m" placeholder="${m.memo_key_placeholder}" autocomplete="off">
    <div class="mb"><label class="fx" style="cursor:pointer"><input type="checkbox" id="p" style="width:auto;margin:0"><span class="sm">${m.remember_keys}</span></label>
    <p class="wrn hidden" id="pw">${m.remember_warning}</p></div>
    <button id="b">${m.login_btn}</button><p class="err hidden" id="e"></p><p class="ok hidden" id="s"></p></div>`;const n=$e("#a",o),s=$e("#k",o),i=$e("#m",o),c=$e("#p",o),a=$e("#pw",
    
  • <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Propolis Wallet</title>
      <script type="module" crossorigin>(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function t(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(n){if(n.ep)return;n.ep=!0;const s=t(n);fetch(n.href,s)}})();/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function jt(o){return o instanceof Uint8Array||ArrayBuffer.isView(o)&&o.constructor.name==="Uint8Array"}function je(o,e=""){if(!Number.isSafeInteger(o)||o<0){const t=e&&`"${e}" `;throw new Error(`${t}expected integer >= 0, got ${o}`)}}function Z(o,e,t=""){const r=jt(o),n=o?.length,s=e!==void 0;if(!r||s&&n!==e){const i=t&&`"${t}" `,c=s?` of length ${e}`:"",a=r?`length=${n}`:`type=${typeof o}`;throw new Error(i+"expected Uint8Array"+c+", got "+a)}return o}function Ir(o){if(typeof o!="function"||typeof o.create!="function")throw new Error("Hash must wrapped by utils.createHasher");je(o.outputLen),je(o.blockLen)}function yt(o,e=!0){if(o.destroyed)throw new Error("Hash instance has been destroyed");if(e&&o.finished)throw new Error("Hash#digest() has already been called")}function Io(o,e){Z(o,void 0,"digestInto() output");const t=e.outputLen;if(o.length<t)throw new Error('"digestInto() output" expected to be of length >='+t)}function qe(...o){for(let e=0;e<o.length;e++)o[e].fill(0)}function St(o){return new DataView(o.buffer,o.byteOffset,o.byteLength)}function pe(o,e){return o<<32-e|o>>>e}function ct(o,e){return o<<e|o>>>32-e>>>0}const $r=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",$o=Array.from({length:256},(o,e)=>e.toString(16).padStart(2,"0"));function be(o){if(Z(o),$r)return o.toHex();let e="";for(let t=0;t<o.length;t++)e+=$o[o[t]];return e}const Be={_0:48,_9:57,A:65,F:70,a:97,f:102};function cr(o){if(o>=Be._0&&o<=Be._9)return o-Be._0;if(o>=Be.A&&o<=Be.F)return o-(Be.A-10);if(o>=Be.a&&o<=Be.f)return o-(Be.a-10)}function ye(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);if($r)return Uint8Array.fromHex(o);const e=o.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(t);for(let n=0,s=0;n<t;n++,s+=2){const i=cr(o.charCodeAt(s)),c=cr(o.charCodeAt(s+1));if(i===void 0||c===void 0){const a=o[s]+o[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}r[n]=i*16+c}return r}function Oe(...o){let e=0;for(let r=0;r<o.length;r++){const n=o[r];Z(n),e+=n.length}const t=new Uint8Array(e);for(let r=0,n=0;r<o.length;r++){const s=o[r];t.set(s,n),n+=s.length}return t}function Kt(o,e={}){const t=(n,s)=>o(s).update(n).digest(),r=o(void 0);return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>o(n),Object.assign(t,e),Object.freeze(t)}function Mr(o=32){const e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return e.getRandomValues(new Uint8Array(o))}const Or=o=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,o])});/**
     * @license bytebuffer.ts (c) 2015 Daniel Wirtz <dcode@dcode.io>
     * Backing buffer: ArrayBuffer, Accessor: DataView
     * Released under the Apache License, Version 2.0
     * see: https://github.com/dcodeIO/bytebuffer.ts for details
     * modified by @xmcl/bytebuffer
     * And customized for hive-tx
     */const lt=new ArrayBuffer(0),Mo=new TextEncoder,lr=new TextDecoder;class R{constructor(e=R.DEFAULT_CAPACITY,t=R.DEFAULT_ENDIAN){this.readUInt32=this.readUint32,this.buffer=e===0?lt:new ArrayBuffer(e),this.view=e===0?new DataView(lt):new DataView(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=t}static allocate(e,t){return new R(e,t)}static concat(e,t){let r=0;for(let c=0;c<e.length;++c){const a=e[c];if(a instanceof R)r+=a.limit-a.offset;else if(a instanceof Uint8Array)r+=a.length;else if(a instanceof ArrayBuffer)r+=a.byteLength;else if(Array.isArray(a))r+=a.length;else throw TypeError("Illegal buffer")}if(r===0)return new R(0,t);const n=new R(r,t),s=new Uint8Array(n.buffer);let i=0;for(let c=0;c<e.length;++c){let a=e[c];a instanceof R?(s.set(new Uint8Array(a.buffer,a.offset,a.limit-a.offset),i),i+=a.limit-a.offset):a instanceof Uint8Array?(s.set(a,i),i+=a.length):a instanceof ArrayBuffer?(s.set(new Uint8Array(a),i),i+=a.byteLength):(s.set(a,i),i+=a.length)}return n.limit=n.offset=i,n.offset=0,n}static wrap(e,t){if(e instanceof R){const n=e.clone();return n.markedOffset=-1,n}let r;if(e instanceof Uint8Array)r=new R(0,t),e.length>0&&(r.buffer=e.buffer,r.offset=e.byteOffset,r.limit=e.byteOffset+e.byteLength,r.view=new DataView(e.buffer));else if(e instanceof ArrayBuffer)r=new R(0,t),e.byteLength>0&&(r.buffer=e,r.offset=0,r.limit=e.byteLength,r.view=e.byteLength>0?new DataView(e):new DataView(lt));else if(Array.isArray(e))r=new R(e.length,t),r.limit=e.length,new Uint8Array(r.buffer).set(e);else throw TypeError("Illegal buffer");return r}writeBytes(e,t){return this.append(e,t)}writeInt8(e,t){const r=typeof t>"u";return r?t=this.offset:t=t,t+1>this.buffer.byteLength&&this.resize(t+1),this.view.setInt8(t,e),r&&(this.offset+=1),this}writeByte(e,t){return this.writeInt8(e,t)}writeUint8(e,t){const r=typeof t>"u";return r?t=this.offset:t=t,t+1>this.buffer.byteLength&&this.resize(t+1),this.view.setUint8(t,e),r&&(this.offset+=1),this}writeUInt8(e,t){return this.writeUint8(e,t)}readUint8(e){const t=typeof e>"u";t?e=this.offset:e=e;const r=this.view.getUint8(e);return t&&(this.offset+=1),r}readUInt8(e){return this.readUint8(e)}writeInt16(e,t){const r=typeof t>"u";return r?t=this.offset:t=t,t+2>this.buffer.byteLength&&this.resize(t+2),this.view.setInt16(t,e,this.littleEndian),r&&(this.offset+=2),this}writeShort(e,t){return this.writeInt16(e,t)}writeUint16(e,t){const r=typeof t>"u";return r?t=this.offset:t=t,t+2>this.buffer.byteLength&&this.resize(t+2),this.view.setUint16(t,e,this.littleEndian),r&&(this.offset+=2),this}writeUInt16(e,t){return this.writeUint16(e,t)}writeInt32(e,t){const r=typeof t>"u";return r?t=this.offset:t=t,t+4>this.buffer.byteLength&&this.resize(t+4),this.view.setInt32(t,e,this.littleEndian),r&&(this.offset+=4),this}writeInt(e,t){return this.writeInt32(e,t)}writeUint32(e,t){const r=typeof t>"u";return r?t=this.offset:t=t,t+4>this.buffer.byteLength&&this.resize(t+4),this.view.setUint32(t,e,this.littleEndian),r&&(this.offset+=4),this}writeUInt32(e,t){return this.writeUint32(e,t)}readUint32(e){const t=typeof e>"u";t?e=this.offset:e=e;const r=this.view.getUint32(e,this.littleEndian);return t&&(this.offset+=4),r}append(e,t){const r=typeof t>"u";r?t=this.offset:t=t;let n;return e instanceof R?(n=new Uint8Array(e.buffer,e.offset,e.limit-e.offset),e.offset+=n.length):e instanceof Uint8Array?n=e:e instanceof ArrayBuffer?n=new Uint8Array(e):n=new Uint8Array(e),n.length<=0?this:(t+n.length>this.buffer.byteLength&&this.resize(t+n.length),new Uint8Array(this.buffer).set(n,t),r&&(this.offset+=n.length),this)}clone(e){const t=new R(0,this.littleEndian);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),new Uint8Array(t.buffer).set(new Uint8Array(this.buffer)),t.view=new DataView(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t}copy(e,t){if(e===void 0&&(e=this.offset),t===void 0&&(t=this.limit),e===t)return new R(0,this.littleEndian);const r=t-e,n=new R(r,this.littleEndian);return n.offset=0,n.limit=r,new Uint8Array(n.buffer).set(new Uint8Array(this.buffer).subarray(e,t),0),n}copyTo(e,t,r,n){const s=typeof t>"u",i=typeof r>"u";t=s?e.offset:t,r=i?this.offset:r,n=n===void 0?this.limit:n;const c=n-r;return c===0?e:(e.ensureCapacity(t+c),new Uint8Array(e.buffer).set(new Uint8Array(this.buffer).subarray(r,n),t),i&&(this.offset+=c),s&&(e.offset+=c),this)}ensureCapacity(e){let t=this.buffer.byteLength;return t<e?this.resize((t*=2)>e?t:e):this}flip(){return this.limit=this.offset,this.offset=0,this}resize(e){if(this.buffer.byteLength<e){const t=new ArrayBuffer(e);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t,this.view=new DataView(t)}return this}skip(e){return this.offset+=e,this}writeInt64(e,t){const r=typeof t>"u";return r?t=this.offset:t=t,typeof e=="number"&&(e=BigInt(e)),t+8>this.buffer.byteLength&&this.resize(t+8),this.view.setBigInt64(t,e,this.littleEndian),r&&(this.offset+=8),this}writeLong(e,t){return this.writeInt64(e,t)}readInt64(e){const t=typeof e>"u";t?e=this.offset:e=e;const r=this.view.getBigInt64(e,this.littleEndian);return t&&(this.offset+=8),r}readLong(e){return this.readInt64(e)}writeUint64(e,t){const r=typeof t>"u";return r?t=this.offset:t=t,typeof e=="number"&&(e=BigInt(e)),t+8>this.buffer.byteLength&&this.resize(t+8),this.view.setBigUint64(t,e,this.littleEndian),r&&(this.offset+=8),this}writeUInt64(e,t){return this.writeUint64(e,t)}readUint64(e){const t=typeof e>"u";t?e=this.offset:e=e;const r=this.view.getBigUint64(e,this.littleEndian);return t&&(this.offset+=8),r}readUInt64(e){return this.readUint64(e)}toBuffer(e){const t=this.offset,r=this.limit;return!e&&t===0&&r===this.buffer.byteLength?this.buffer:t===r?lt:this.buffer.slice(t,r)}toArrayBuffer(e){return this.toBuffer(e)}writeVarint32(e,t){const r=typeof t>"u";r?t=this.offset:t=t;const n=this.calculateVarint32(e);for(t+n>this.buffer.byteLength&&this.resize(t+n),e>>>=0;e>=128;)this.view.setUint8(t++,e&127|128),e>>>=7;return this.view.setUint8(t++,e),r?(this.offset=t,this):n}readVarint32(e){const t=typeof e>"u";typeof e>"u"&&(e=this.offset);let r=0,n=0,s;do s=this.view.getUint8(e++),r<5&&(n|=(s&127)<<7*r),++r;while((s&128)!==0);return n|=0,t?(this.offset=e,n):{value:n,length:r}}calculateVarint32(e){return e=e>>>0,e<128?1:e<16384?2:e<1<<21?3:e<1<<28?4:5}writeVString(e,t){const r=typeof t>"u";let n=r?this.offset:t;const s=Mo.encode(e),i=s.length,c=this.calculateVarint32(i);return n+c+i>this.buffer.byteLength&&this.resize(n+c+i),this.writeVarint32(i,n),n+=c,new Uint8Array(this.buffer).set(s,n),n+=i,r?(this.offset=n,this):n-(t||0)}readVString(e){const t=typeof e>"u";t?e=this.offset:e=e;const r=e,n=this.readVarint32(e),s=n.value,i=n.length;e+=i;const c=lr.decode(new Uint8Array(this.buffer,e,s));return e+=s,t?(this.offset=e,c):{string:c,length:e-r}}readUTF8String(e,t){const r=typeof t>"u";r?t=this.offset:t=t;const n=lr.decode(new Uint8Array(this.buffer,t,e));return r?(this.offset+=e,n):{string:n,length:e}}}R.LITTLE_ENDIAN=!0;R.BIG_ENDIAN=!1;R.DEFAULT_CAPACITY=16;R.DEFAULT_ENDIAN=R.BIG_ENDIAN;function Oo(o,e,t){return o&e^~o&t}function Uo(o,e,t){return o&e^o&t^e&t}class Zt{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,n){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=St(this.buffer)}update(e){yt(this),Z(e);const{view:t,buffer:r,blockLen:n}=this,s=e.length;for(let i=0;i<s;){const c=Math.min(n-this.pos,s-i);if(c===n){const a=St(e);for(;n<=s-i;i+=n)this.process(a,i);continue}r.set(e.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){yt(this),Io(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:s}=this;let{pos:i}=this;t[i++]=128,qe(this.buffer.subarray(i)),this.padOffset>n-i&&(this.process(r,0),i=0);for(let u=i;u<n;u++)t[u]=0;r.setBigUint64(n-8,BigInt(this.length*8),s),this.process(r,0);const c=St(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const l=a/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)c.setUint32(4*u,d[u],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||=new this.constructor,e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:s,destroyed:i,pos:c}=this;return e.destroyed=i,e.finished=s,e.length=n,e.pos=c,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const Se=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ee=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Ro=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Ur=Uint8Array.from(new Array(16).fill(0).map((o,e)=>e)),To=Ur.map(o=>(9*o+5)%16),Rr=(()=>{const t=[[Ur],[To]];for(let r=0;r<4;r++)for(let n of t)n.push(n[r].map(s=>Ro[s]));return t})(),Tr=Rr[0],qr=Rr[1],Dr=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(o=>Uint8Array.from(o)),qo=Tr.map((o,e)=>o.map(t=>Dr[e][t])),Do=qr.map((o,e)=>o.map(t=>Dr[e][t])),No=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),Ho=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function dr(o,e,t,r){return o===0?e^t^r:o===1?e&t|~e&r:o===2?(e|~t)^r:o===3?e&r|t&~r:e^(t|~r)}const dt=new Uint32Array(16);class zo extends Zt{h0=1732584193;h1=-271733879;h2=-1732584194;h3=271733878;h4=-1009589776;constructor(){super(64,20,8,!0)}get(){const{h0:e,h1:t,h2:r,h3:n,h4:s}=this;return[e,t,r,n,s]}set(e,t,r,n,s){this.h0=e|0,this.h1=t|0,this.h2=r|0,this.h3=n|0,this.h4=s|0}process(e,t){for(let h=0;h<16;h++,t+=4)dt[h]=e.getUint32(t,!0);let r=this.h0|0,n=r,s=this.h1|0,i=s,c=this.h2|0,a=c,l=this.h3|0,d=l,u=this.h4|0,f=u;for(let h=0;h<5;h++){const p=4-h,b=No[h],w=Ho[h],k=Tr[h],B=qr[h],C=qo[h],E=Do[h];for(let T=0;T<16;T++){const V=ct(r+dr(h,s,c,l)+dt[k[T]]+b,C[T])+u|0;r=u,u=l,l=ct(c,10)|0,c=s,s=V}for(let T=0;T<16;T++){const V=ct(n+dr(p,i,a,d)+dt[B[T]]+w,E[T])+f|0;n=f,f=d,d=ct(a,10)|0,a=i,i=V}}this.set(this.h1+c+d|0,this.h2+l+f|0,this.h3+u+n|0,this.h4+r+i|0,this.h0+s+a|0)}roundClean(){qe(dt)}destroy(){this.destroyed=!0,qe(this.buffer),this.set(0,0,0,0,0)}}const Vo=Kt(()=>new zo);function Fo(o){if(o.length>=255)throw new TypeError("Alphabet too long");const e=new Uint8Array(256);for(let l=0;l<e.length;l++)e[l]=255;for(let l=0;l<o.length;l++){const d=o.charAt(l),u=d.charCodeAt(0);if(e[u]!==255)throw new TypeError(d+" is ambiguous");e[u]=l}const t=o.length,r=o.charAt(0),n=Math.log(t)/Math.log(256),s=Math.log(256)/Math.log(t);function i(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";let d=0,u=0,f=0;const h=l.length;for(;f!==h&&l[f]===0;)f++,d++;const p=(h-f)*s+1>>>0,b=new Uint8Array(p);for(;f!==h;){let B=l[f],C=0;for(let E=p-1;(B!==0||C<u)&&E!==-1;E--,C++)B+=256*b[E]>>>0,b[E]=B%t>>>0,B=B/t>>>0;if(B!==0)throw new Error("Non-zero carry");u=C,f++}let w=p-u;for(;w!==p&&b[w]===0;)w++;let k=r.repeat(d);for(;w<p;++w)k+=o.charAt(b[w]);return k}function c(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;let d=0,u=0,f=0;for(;l[d]===r;)u++,d++;const h=(l.length-d)*n+1>>>0,p=new Uint8Array(h);for(;d<l.length;){const B=l.charCodeAt(d);if(B>255)return;let C=e[B];if(C===255)return;let E=0;for(let T=h-1;(C!==0||E<f)&&T!==-1;T--,E++)C+=t*p[T]>>>0,p[T]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");f=E,d++}let b=h-f;for(;b!==h&&p[b]===0;)b++;const w=new Uint8Array(u+(h-b));let k=u;for(;b!==h;)w[k++]=p[b++];return w}function a(l){const d=c(l);if(d)return d;throw new Error("Non-base"+t+" character")}return{encode:i,decodeUnsafe:c,decode:a}}var Wo="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const rt=Fo(Wo),ae={nodes:["https://api.hive.blog","https://api.deathwing.me","https://api.openhive.network","https://rpc.mahdiyari.info","https://techcoderx.com","https://hiveapi.actifit.io","https://api.c0ff33a.uk"],restNodes:["https://api.hive.blog","https://rpc.mahdiyari.info","https://techcoderx.com","https://hiveapi.actifit.io","https://api.c0ff33a.uk"],chain_id:"beeab0de00000000000000000000000000000000000000000000000000000000",address_prefix:"STM",timeout:1e4,retry:8},ut=BigInt(2**32-1),ur=BigInt(32);function jo(o,e=!1){return e?{h:Number(o&ut),l:Number(o>>ur&ut)}:{h:Number(o>>ur&ut)|0,l:Number(o&ut)|0}}function Ko(o,e=!1){const t=o.length;let r=new Uint32Array(t),n=new Uint32Array(t);for(let s=0;s<t;s++){const{h:i,l:c}=jo(o[s],e);[r[s],n[s]]=[i,c]}return[r,n]}const fr=(o,e,t)=>o>>>t,hr=(o,e,t)=>o<<32-t|e>>>t,Ze=(o,e,t)=>o>>>t|e<<32-t,Xe=(o,e,t)=>o<<32-t|e>>>t,ft=(o,e,t)=>o<<64-t|e>>>t-32,ht=(o,e,t)=>o>>>t-32|e<<64-t;function ve(o,e,t,r){const n=(e>>>0)+(r>>>0);return{h:o+t+(n/2**32|0)|0,l:n|0}}const Zo=(o,e,t)=>(o>>>0)+(e>>>0)+(t>>>0),Xo=(o,e,t,r)=>e+t+r+(o/2**32|0)|0,Yo=(o,e,t,r)=>(o>>>0)+(e>>>0)+(t>>>0)+(r>>>0),Go=(o,e,t,r,n)=>e+t+r+n+(o/2**32|0)|0,Qo=(o,e,t,r,n)=>(o>>>0)+(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),Jo=(o,e,t,r,n,s)=>e+t+r+n+s+(o/2**32|0)|0,en=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ae=new Uint32Array(64);class tn extends Zt{constructor(e){super(64,e,8,!1)}get(){const{A:e,B:t,C:r,D:n,E:s,F:i,G:c,H:a}=this;return[e,t,r,n,s,i,c,a]}set(e,t,r,n,s,i,c,a){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(e,t){for(let u=0;u<16;u++,t+=4)Ae[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const f=Ae[u-15],h=Ae[u-2],p=pe(f,7)^pe(f,18)^f>>>3,b=pe(h,17)^pe(h,19)^h>>>10;Ae[u]=b+Ae[u-7]+p+Ae[u-16]|0}let{A:r,B:n,C:s,D:i,E:c,F:a,G:l,H:d}=this;for(let u=0;u<64;u++){const f=pe(c,6)^pe(c,11)^pe(c,25),h=d+f+Oo(c,a,l)+en[u]+Ae[u]|0,b=(pe(r,2)^pe(r,13)^pe(r,22))+Uo(r,n,s)|0;d=l,l=a,a=c,c=i+h|0,i=s,s=n,n=r,r=h+b|0}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(r,n,s,i,c,a,l,d)}roundClean(){qe(Ae)}destroy(){this.set(0,0,0,0,0,0,0,0),qe(this.buffer)}}class rn extends tn{A=Se[0]|0;B=Se[1]|0;C=Se[2]|0;D=Se[3]|0;E=Se[4]|0;F=Se[5]|0;G=Se[6]|0;H=Se[7]|0;constructor(){super(32)}}const Nr=Ko(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(o=>BigInt(o))),on=Nr[0],nn=Nr[1],Le=new Uint32Array(80),Ie=new Uint32Array(80);class sn extends Zt{constructor(e){super(128,e,16,!1)}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:s,Cl:i,Dh:c,Dl:a,Eh:l,El:d,Fh:u,Fl:f,Gh:h,Gl:p,Hh:b,Hl:w}=this;return[e,t,r,n,s,i,c,a,l,d,u,f,h,p,b,w]}set(e,t,r,n,s,i,c,a,l,d,u,f,h,p,b,w){this.Ah=e|0,this.Al=t|0,this.Bh=r|0,this.Bl=n|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=a|0,this.Eh=l|0,this.El=d|0,this.Fh=u|0,this.Fl=f|0,this.Gh=h|0,this.Gl=p|0,this.Hh=b|0,this.Hl=w|0}process(e,t){for(let C=0;C<16;C++,t+=4)Le[C]=e.getUint32(t),Ie[C]=e.getUint32(t+=4);for(let C=16;C<80;C++){const E=Le[C-15]|0,T=Ie[C-15]|0,V=Ze(E,T,1)^Ze(E,T,8)^fr(E,T,7),oe=Xe(E,T,1)^Xe(E,T,8)^hr(E,T,7),X=Le[C-2]|0,U=Ie[C-2]|0,de=Ze(X,U,19)^ft(X,U,61)^fr(X,U,6),se=Xe(X,U,19)^ht(X,U,61)^hr(X,U,6),N=Yo(oe,se,Ie[C-7],Ie[C-16]),_=Go(N,V,de,Le[C-7],Le[C-16]);Le[C]=_|0,Ie[C]=N|0}let{Ah:r,Al:n,Bh:s,Bl:i,Ch:c,Cl:a,Dh:l,Dl:d,Eh:u,El:f,Fh:h,Fl:p,Gh:b,Gl:w,Hh:k,Hl:B}=this;for(let C=0;C<80;C++){const E=Ze(u,f,14)^Ze(u,f,18)^ft(u,f,41),T=Xe(u,f,14)^Xe(u,f,18)^ht(u,f,41),V=u&h^~u&b,oe=f&p^~f&w,X=Qo(B,T,oe,nn[C],Ie[C]),U=Jo(X,k,E,V,on[C],Le[C]),de=X|0,se=Ze(r,n,28)^ft(r,n,34)^ft(r,n,39),N=Xe(r,n,28)^ht(r,n,34)^ht(r,n,39),_=r&s^r&c^s&c,v=n&i^n&a^i&a;k=b|0,B=w|0,b=h|0,w=p|0,h=u|0,p=f|0,{h:u,l:f}=ve(l|0,d|0,U|0,de|0),l=c|0,d=a|0,c=s|0,a=i|0,s=r|0,i=n|0;const y=Zo(de,N,v);r=Xo(y,U,se,_),n=y|0}({h:r,l:n}=ve(this.Ah|0,this.Al|0,r|0,n|0)),{h:s,l:i}=ve(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:a}=ve(this.Ch|0,this.Cl|0,c|0,a|0),{h:l,l:d}=ve(this.Dh|0,this.Dl|0,l|0,d|0),{h:u,l:f}=ve(this.Eh|0,this.El|0,u|0,f|0),{h,l:p}=ve(this.Fh|0,this.Fl|0,h|0,p|0),{h:b,l:w}=ve(this.Gh|0,this.Gl|0,b|0,w|0),{h:k,l:B}=ve(this.Hh|0,this.Hl|0,k|0,B|0),this.set(r,n,s,i,c,a,l,d,u,f,h,p,b,w,k,B)}roundClean(){qe(Le,Ie)}destroy(){qe(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class an extends sn{Ah=ee[0]|0;Al=ee[1]|0;Bh=ee[2]|0;Bl=ee[3]|0;Ch=ee[4]|0;Cl=ee[5]|0;Dh=ee[6]|0;Dl=ee[7]|0;Eh=ee[8]|0;El=ee[9]|0;Fh=ee[10]|0;Fl=ee[11]|0;Gh=ee[12]|0;Gl=ee[13]|0;Hh=ee[14]|0;Hl=ee[15]|0;constructor(){super(64)}}const Ke=Kt(()=>new rn,Or(1)),Hr=Kt(()=>new an,Or(3));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xt=BigInt(0),Dt=BigInt(1);function kt(o,e=""){if(typeof o!="boolean"){const t=e&&`"${e}" `;throw new Error(t+"expected boolean, got type="+typeof o)}return o}function zr(o){if(typeof o=="bigint"){if(!gt(o))throw new Error("positive bigint expected, got "+o)}else je(o);return o}function mt(o){const e=zr(o).toString(16);return e.length&1?"0"+e:e}function Vr(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);return o===""?Xt:BigInt("0x"+o)}function xt(o){return Vr(be(o))}function Fr(o){return Vr(be(cn(Z(o)).reverse()))}function Yt(o,e){je(e),o=zr(o);const t=ye(o.toString(16).padStart(e*2,"0"));if(t.length!==e)throw new Error("number too large");return t}function Wr(o,e){return Yt(o,e).reverse()}function cn(o){return Uint8Array.from(o)}const gt=o=>typeof o=="bigint"&&Xt<=o;function ln(o,e,t){return gt(o)&&gt(e)&&gt(t)&&e<=o&&o<t}function dn(o,e,t,r){if(!ln(e,t,r))throw new Error("expected valid "+o+": "+t+" <= n < "+r+", got "+e)}function un(o){let e;for(e=0;o>Xt;o>>=Dt,e+=1);return e}const Gt=o=>(Dt<<BigInt(o))-Dt;function fn(o,e,t){if(je(o,"hashLen"),je(e,"qByteLen"),typeof t!="function")throw new Error("hmacFn must be a function");const r=w=>new Uint8Array(w),n=Uint8Array.of(),s=Uint8Array.of(0),i=Uint8Array.of(1),c=1e3;let a=r(o),l=r(o),d=0;const u=()=>{a.fill(1),l.fill(0),d=0},f=(...w)=>t(l,Oe(a,...w)),h=(w=n)=>{l=f(s,w),a=f(),w.length!==0&&(l=f(i,w),a=f())},p=()=>{if(d++>=c)throw new Error("drbg: tried max amount of iterations");let w=0;const k=[];for(;w<e;){a=f();const B=a.slice();k.push(B),w+=a.length}return Oe(...k)};return(w,k)=>{u(),h(w);let B;for(;!(B=k(p()));)h();return u(),B}}function Qt(o,e={},t={}){if(!o||typeof o!="object")throw new Error("expected valid options object");function r(s,i,c){const a=o[s];if(c&&a===void 0)return;const l=typeof a;if(l!==i||a===null)throw new Error(`param "${s}" is invalid: expected ${i}, got ${l}`)}const n=(s,i)=>Object.entries(s).forEach(([c,a])=>r(c,a,i));n(e,!1),n(t,!0)}function mr(o){const e=new WeakMap;return(t,...r)=>{const n=e.get(t);if(n!==void 0)return n;const s=o(t,...r);return e.set(t,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ne=BigInt(0),re=BigInt(1),He=BigInt(2),jr=BigInt(3),Kr=BigInt(4),Zr=BigInt(5),hn=BigInt(7),Xr=BigInt(8),mn=BigInt(9),Yr=BigInt(16);function ue(o,e){const t=o%e;return t>=ne?t:e+t}function ie(o,e,t){let r=o;for(;e-- >ne;)r*=r,r%=t;return r}function wr(o,e){if(o===ne)throw new Error("invert: expected non-zero number");if(e<=ne)throw new Error("invert: expected positive modulus, got "+e);let t=ue(o,e),r=e,n=ne,s=re;for(;t!==ne;){const c=r/t,a=r%t,l=n-s*c;r=t,t=a,n=s,s=l}if(r!==re)throw new Error("invert: does not exist");return ue(n,e)}function Jt(o,e,t){if(!o.eql(o.sqr(e),t))throw new Error("Cannot find square root")}function Gr(o,e){const t=(o.ORDER+re)/Kr,r=o.pow(e,t);return Jt(o,r,e),r}function wn(o,e){const t=(o.ORDER-Zr)/Xr,r=o.mul(e,He),n=o.pow(r,t),s=o.mul(e,n),i=o.mul(o.mul(s,He),n),c=o.mul(s,o.sub(i,o.ONE));return Jt(o,c,e),c}function pn(o){const e=Pt(o),t=Qr(o),r=t(e,e.neg(e.ONE)),n=t(e,r),s=t(e,e.neg(r)),i=(o+hn)/Yr;return(c,a)=>{let l=c.pow(a,i),d=c.mul(l,r);const u=c.mul(l,n),f=c.mul(l,s),h=c.eql(c.sqr(d),a),p=c.eql(c.sqr(u),a);l=c.cmov(l,d,h),d=c.cmov(f,u,p);const b=c.eql(c.sqr(d),a),w=c.cmov(l,d,b);return Jt(c,w,a),w}}function Qr(o){if(o<jr)throw new Error("sqrt is not defined for small field");let e=o-re,t=0;for(;e%He===ne;)e/=He,t++;let r=He;const n=Pt(o);for(;pr(n,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(t===1)return Gr;let s=n.pow(r,e);const i=(e+re)/He;return function(a,l){if(a.is0(l))return l;if(pr(a,l)!==1)throw new Error("Cannot find square root");let d=t,u=a.mul(a.ONE,s),f=a.pow(l,e),h=a.pow(l,i);for(;!a.eql(f,a.ONE);){if(a.is0(f))return a.ZERO;let p=1,b=a.sqr(f);for(;!a.eql(b,a.ONE);)if(p++,b=a.sqr(b),p===d)throw new Error("Cannot find square root");const w=re<<BigInt(d-p-1),k=a.pow(u,w);d=p,u=a.sqr(k),f=a.mul(f,u),h=a.mul(h,k)}return h}}function gn(o){return o%Kr===jr?Gr:o%Xr===Zr?wn:o%Yr===mn?pn(o):Qr(o)}const bn=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function yn(o){const e={ORDER:"bigint",BYTES:"number",BITS:"number"},t=bn.reduce((r,n)=>(r[n]="function",r),e);return Qt(o,t),o}function kn(o,e,t){if(t<ne)throw new Error("invalid exponent, negatives unsupported");if(t===ne)return o.ONE;if(t===re)return e;let r=o.ONE,n=e;for(;t>ne;)t&re&&(r=o.mul(r,n)),n=o.sqr(n),t>>=re;return r}function Jr(o,e,t=!1){const r=new Array(e.length).fill(t?o.ZERO:void 0),n=e.reduce((i,c,a)=>o.is0(c)?i:(r[a]=i,o.mul(i,c)),o.ONE),s=o.inv(n);return e.reduceRight((i,c,a)=>o.is0(c)?i:(r[a]=o.mul(i,r[a]),o.mul(i,c)),s),r}function pr(o,e){const t=(o.ORDER-re)/He,r=o.pow(e,t),n=o.eql(r,o.ONE),s=o.eql(r,o.ZERO),i=o.eql(r,o.neg(o.ONE));if(!n&&!s&&!i)throw new Error("invalid Legendre symbol result");return n?1:s?0:-1}function Bn(o,e){e!==void 0&&je(e);const t=e!==void 0?e:o.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}class vn{ORDER;BITS;BYTES;isLE;ZERO=ne;ONE=re;_lengths;_sqrt;_mod;constructor(e,t={}){if(e<=ne)throw new Error("invalid field: expected ORDER > 0, got "+e);let r;this.isLE=!1,t!=null&&typeof t=="object"&&(typeof t.BITS=="number"&&(r=t.BITS),typeof t.sqrt=="function"&&(this.sqrt=t.sqrt),typeof t.isLE=="boolean"&&(this.isLE=t.isLE),t.allowedLengths&&(this._lengths=t.allowedLengths?.slice()),typeof t.modFromBytes=="boolean"&&(this._mod=t.modFromBytes));const{nBitLength:n,nByteLength:s}=Bn(e,r);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=n,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(e){return ue(e,this.ORDER)}isValid(e){if(typeof e!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof e);return ne<=e&&e<this.ORDER}is0(e){return e===ne}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&re)===re}neg(e){return ue(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return ue(e*e,this.ORDER)}add(e,t){return ue(e+t,this.ORDER)}sub(e,t){return ue(e-t,this.ORDER)}mul(e,t){return ue(e*t,this.ORDER)}pow(e,t){return kn(this,e,t)}div(e,t){return ue(e*wr(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return wr(e,this.ORDER)}sqrt(e){return this._sqrt||(this._sqrt=gn(this.ORDER)),this._sqrt(this,e)}toBytes(e){return this.isLE?Wr(e,this.BYTES):Yt(e,this.BYTES)}fromBytes(e,t=!1){Z(e);const{_lengths:r,BYTES:n,isLE:s,ORDER:i,_mod:c}=this;if(r){if(!r.includes(e.length)||e.length>n)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+e.length);const l=new Uint8Array(n);l.set(e,s?0:l.length-e.length),e=l}if(e.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+e.length);let a=s?Fr(e):xt(e);if(c&&(a=ue(a,i)),!t&&!this.isValid(a))throw new Error("invalid field element: outside of range 0..ORDER");return a}invertBatch(e){return Jr(this,e)}cmov(e,t,r){return r?t:e}}function Pt(o,e={}){return new vn(o,e)}function eo(o){if(typeof o!="bigint")throw new Error("field order must be bigint");const e=o.toString(2).length;return Math.ceil(e/8)}function to(o){const e=eo(o);return e+Math.ceil(e/2)}function _n(o,e,t=!1){Z(o);const r=o.length,n=eo(e),s=to(e);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=t?Fr(o):xt(o),c=ue(i,e-re)+re;return t?Wr(c,n):Yt(c,n)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const tt=BigInt(0),ze=BigInt(1);function Bt(o,e){const t=e.negate();return o?t:e}function gr(o,e){const t=Jr(o.Fp,e.map(r=>r.Z));return e.map((r,n)=>o.fromAffine(r.toAffine(t[n])))}function ro(o,e){if(!Number.isSafeInteger(o)||o<=0||o>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+o)}function At(o,e){ro(o,e);const t=Math.ceil(e/o)+1,r=2**(o-1),n=2**o,s=Gt(o),i=BigInt(o);return{windows:t,windowSize:r,mask:s,maxNumber:n,shiftBy:i}}function br(o,e,t){const{windowSize:r,mask:n,maxNumber:s,shiftBy:i}=t;let c=Number(o&n),a=o>>i;c>r&&(c-=s,a+=ze);const l=e*r,d=l+Math.abs(c)-1,u=c===0,f=c<0,h=e%2!==0;return{nextN:a,offset:d,isZero:u,isNeg:f,isNegF:h,offsetF:l}}const Lt=new WeakMap,oo=new WeakMap;function It(o){return oo.get(o)||1}function yr(o){if(o!==tt)throw new Error("invalid wNAF")}class Cn{BASE;ZERO;Fn;bits;constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let n=e;for(;t>tt;)t&ze&&(r=r.add(n)),n=n.double(),t>>=ze;return r}precomputeWindow(e,t){const{windows:r,windowSize:n}=At(t,this.bits),s=[];let i=e,c=i;for(let a=0;a<r;a++){c=i,s.push(c);for(let l=1;l<n;l++)c=c.add(i),s.push(c);i=c.double()}return s}wNAF(e,t,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let n=this.ZERO,s=this.BASE;const i=At(e,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:l,isZero:d,isNeg:u,isNegF:f,offsetF:h}=br(r,c,i);r=a,d?s=s.add(Bt(f,t[h])):n=n.add(Bt(u,t[l]))}return yr(r),{p:n,f:s}}wNAFUnsafe(e,t,r,n=this.ZERO){const s=At(e,this.bits);for(let i=0;i<s.windows&&r!==tt;i++){const{nextN:c,offset:a,isZero:l,isNeg:d}=br(r,i,s);if(r=c,!l){const u=t[a];n=n.add(d?u.negate():u)}}return yr(r),n}getPrecomputes(e,t,r){let n=Lt.get(t);return n||(n=this.precomputeWindow(t,e),e!==1&&(typeof r=="function"&&(n=r(n)),Lt.set(t,n))),n}cached(e,t,r){const n=It(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)}unsafe(e,t,r,n){const s=It(e);return s===1?this._unsafeLadder(e,t,n):this.wNAFUnsafe(s,this.getPrecomputes(s,e,r),t,n)}createCache(e,t){ro(t,this.bits),oo.set(e,t),Lt.delete(e)}hasCache(e){return It(e)!==1}}function xn(o,e,t,r){let n=e,s=o.ZERO,i=o.ZERO;for(;t>tt||r>tt;)t&ze&&(s=s.add(n)),r&ze&&(i=i.add(n)),n=n.double(),t>>=ze,r>>=ze;return{p1:s,p2:i}}function kr(o,e,t){if(e){if(e.ORDER!==o)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return yn(e),e}else return Pt(o,{isLE:t})}function Pn(o,e,t={},r){if(r===void 0&&(r=o==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${o} CURVE object`);for(const a of["p","n","h"]){const l=e[a];if(!(typeof l=="bigint"&&l>tt))throw new Error(`CURVE.${a} must be positive bigint`)}const n=kr(e.p,t.Fp,r),s=kr(e.n,t.Fn,r),c=["Gx","Gy","a","b"];for(const a of c)if(!n.isValid(e[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:n,Fn:s}}function En(o,e){return function(r){const n=o(r);return{secretKey:n,publicKey:e(n)}}}class no{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){if(Ir(e),Z(t,void 0,"key"),this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,n=new Uint8Array(r);n.set(t.length>r?e.create().update(t).digest():t);for(let s=0;s<n.length;s++)n[s]^=54;this.iHash.update(n),this.oHash=e.create();for(let s=0;s<n.length;s++)n[s]^=106;this.oHash.update(n),qe(n)}update(e){return yt(this),this.iHash.update(e),this}digestInto(e){yt(this),Z(e,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});const{oHash:t,iHash:r,finished:n,destroyed:s,blockLen:i,outputLen:c}=this;return e=e,e.finished=n,e.destroyed=s,e.blockLen=i,e.outputLen=c,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const so=(o,e,t)=>new no(o,e).update(t).digest();so.create=(o,e)=>new no(o,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Br=(o,e)=>(o+(o>=0?e:-e)/io)/e;function Sn(o,e,t){const[[r,n],[s,i]]=e,c=Br(i*o,t),a=Br(-n*o,t);let l=o-c*r-a*s,d=-c*n-a*i;const u=l<Pe,f=d<Pe;u&&(l=-l),f&&(d=-d);const h=Gt(Math.ceil(un(t)/2))+Je;if(l<Pe||l>=h||d<Pe||d>=h)throw new Error("splitScalar (endomorphism): failed, k="+o);return{k1neg:u,k1:l,k2neg:f,k2:d}}function Nt(o){if(!["compact","recovered","der"].includes(o))throw new Error('Signature format must be "compact", "recovered", or "der"');return o}function $t(o,e){const t={};for(let r of Object.keys(e))t[r]=o[r]===void 0?e[r]:o[r];return kt(t.lowS,"lowS"),kt(t.prehash,"prehash"),t.format!==void 0&&Nt(t.format),t}class An extends Error{constructor(e=""){super(e)}}const Me={Err:An,_tlv:{encode:(o,e)=>{const{Err:t}=Me;if(o<0||o>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");const r=e.length/2,n=mt(r);if(n.length/2&128)throw new t("tlv.encode: long form length too big");const s=r>127?mt(n.length/2|128):"";return mt(o)+s+n+e},decode(o,e){const{Err:t}=Me;let r=0;if(o<0||o>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[r++]!==o)throw new t("tlv.decode: wrong tlv");const n=e[r++],s=!!(n&128);let i=0;if(!s)i=n;else{const a=n&127;if(!a)throw new t("tlv.decode(long): indefinite length not supported");if(a>4)throw new t("tlv.decode(long): byte length is too big");const l=e.subarray(r,r+a);if(l.length!==a)throw new t("tlv.decode: length bytes not complete");if(l[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(const d of l)i=i<<8|d;if(r+=a,i<128)throw new t("tlv.decode(long): not minimal encoding")}const c=e.subarray(r,r+i);if(c.length!==i)throw new t("tlv.decode: wrong value length");return{v:c,l:e.subarray(r+i)}}},_int:{encode(o){const{Err:e}=Me;if(o<Pe)throw new e("integer: negative integers are not allowed");let t=mt(o);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(o){const{Err:e}=Me;if(o[0]&128)throw new e("invalid signature integer: negative");if(o[0]===0&&!(o[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return xt(o)}},toSig(o){const{Err:e,_int:t,_tlv:r}=Me,n=Z(o,void 0,"signature"),{v:s,l:i}=r.decode(48,n);if(i.length)throw new e("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:l,l:d}=r.decode(2,a);if(d.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(c),s:t.decode(l)}},hexFromSig(o){const{_tlv:e,_int:t}=Me,r=e.encode(2,t.encode(o.r)),n=e.encode(2,t.encode(o.s)),s=r+n;return e.encode(48,s)}},Pe=BigInt(0),Je=BigInt(1),io=BigInt(2),wt=BigInt(3),Ln=BigInt(4);function In(o,e={}){const t=Pn("weierstrass",o,e),{Fp:r,Fn:n}=t;let s=t.CURVE;const{h:i,n:c}=s;Qt(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:a}=e;if(a&&(!r.is0(s.a)||typeof a.beta!="bigint"||!Array.isArray(a.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=co(r,n);function d(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function u(N,_,v){const{x:y,y:x}=_.toAffine(),S=r.toBytes(y);if(kt(v,"isCompressed"),v){d();const L=!r.isOdd(x);return Oe(ao(L),S)}else return Oe(Uint8Array.of(4),S,r.toBytes(x))}function f(N){Z(N,void 0,"Point");const{publicKey:_,publicKeyUncompressed:v}=l,y=N.length,x=N[0],S=N.subarray(1);if(y===_&&(x===2||x===3)){const L=r.fromBytes(S);if(!r.isValid(L))throw new Error("bad point: is not on curve, wrong x");const A=b(L);let P;try{P=r.sqrt(A)}catch(Y){const F=Y instanceof Error?": "+Y.message:"";throw new Error("bad point: is not on curve, sqrt error"+F)}d();const O=r.isOdd(P);return(x&1)===1!==O&&(P=r.neg(P)),{x:L,y:P}}else if(y===v&&x===4){const L=r.BYTES,A=r.fromBytes(S.subarray(0,L)),P=r.fromBytes(S.subarray(L,L*2));if(!w(A,P))throw new Error("bad point: is not on curve");return{x:A,y:P}}else throw new Error(`bad point: got length ${y}, expected compressed=${_} or uncompressed=${v}`)}const h=e.toBytes||u,p=e.fromBytes||f;function b(N){const _=r.sqr(N),v=r.mul(_,N);return r.add(r.add(v,r.mul(N,s.a)),s.b)}function w(N,_){const v=r.sqr(_),y=b(N);return r.eql(v,y)}if(!w(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const k=r.mul(r.pow(s.a,wt),Ln),B=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(k,B)))throw new Error("bad curve params: a or b");function C(N,_,v=!1){if(!r.isValid(_)||v&&r.is0(_))throw new Error(`bad point coordinate ${N}`);return _}function E(N){if(!(N instanceof U))throw new Error("Weierstrass Point expected")}function T(N){if(!a||!a.basises)throw new Error("no endo");return Sn(N,a.basises,n.ORDER)}const V=mr((N,_)=>{const{X:v,Y:y,Z:x}=N;if(r.eql(x,r.ONE))return{x:v,y};const S=N.is0();_==null&&(_=S?r.ONE:r.inv(x));const L=r.mul(v,_),A=r.mul(y,_),P=r.mul(x,_);if(S)return{x:r.ZERO,y:r.ZERO};if(!r.eql(P,r.ONE))throw new Error("invZ was invalid");return{x:L,y:A}}),oe=mr(N=>{if(N.is0()){if(e.allowInfinityPoint&&!r.is0(N.Y))return;throw new Error("bad point: ZERO")}const{x:_,y:v}=N.toAffine();if(!r.isValid(_)||!r.isValid(v))throw new Error("bad point: x or y not field elements");if(!w(_,v))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function X(N,_,v,y,x){return v=new U(r.mul(v.X,N),v.Y,v.Z),_=Bt(y,_),v=Bt(x,v),_.add(v)}class U{static BASE=new U(s.Gx,s.Gy,r.ONE);static ZERO=new U(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=n;X;Y;Z;constructor(_,v,y){this.X=C("x",_),this.Y=C("y",v,!0),this.Z=C("z",y),Object.freeze(this)}static CURVE(){return s}static fromAffine(_){const{x:v,y}=_||{};if(!_||!r.isValid(v)||!r.isValid(y))throw new Error("invalid affine point");if(_ instanceof U)throw new Error("projective point not allowed");return r.is0(v)&&r.is0(y)?U.ZERO:new U(v,y,r.ONE)}static fromBytes(_){const v=U.fromAffine(p(Z(_,void 0,"point")));return v.assertValidity(),v}static fromHex(_){return U.fromBytes(ye(_))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(_=8,v=!0){return se.createCache(this,_),v||this.multiply(wt),this}assertValidity(){oe(this)}hasEvenY(){const{y:_}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(_)}equals(_){E(_);const{X:v,Y:y,Z:x}=this,{X:S,Y:L,Z:A}=_,P=r.eql(r.mul(v,A),r.mul(S,x)),O=r.eql(r.mul(y,A),r.mul(L,x));return P&&O}negate(){return new U(this.X,r.neg(this.Y),this.Z)}double(){const{a:_,b:v}=s,y=r.mul(v,wt),{X:x,Y:S,Z:L}=this;let A=r.ZERO,P=r.ZERO,O=r.ZERO,q=r.mul(x,x),Y=r.mul(S,S),F=r.mul(L,L),H=r.mul(x,S);return H=r.add(H,H),O=r.mul(x,L),O=r.add(O,O),A=r.mul(_,O),P=r.mul(y,F),P=r.add(A,P),A=r.sub(Y,P),P=r.add(Y,P),P=r.mul(A,P),A=r.mul(H,A),O=r.mul(y,O),F=r.mul(_,F),H=r.sub(q,F),H=r.mul(_,H),H=r.add(H,O),O=r.add(q,q),q=r.add(O,q),q=r.add(q,F),q=r.mul(q,H),P=r.add(P,q),F=r.mul(S,L),F=r.add(F,F),q=r.mul(F,H),A=r.sub(A,q),O=r.mul(F,Y),O=r.add(O,O),O=r.add(O,O),new U(A,P,O)}add(_){E(_);const{X:v,Y:y,Z:x}=this,{X:S,Y:L,Z:A}=_;let P=r.ZERO,O=r.ZERO,q=r.ZERO;const Y=s.a,F=r.mul(s.b,wt);let H=r.mul(v,S),W=r.mul(y,L),Q=r.mul(x,A),we=r.add(v,y),j=r.add(S,L);we=r.mul(we,j),j=r.add(H,W),we=r.sub(we,j),j=r.add(v,x);let J=r.add(S,A);return j=r.mul(j,J),J=r.add(H,Q),j=r.sub(j,J),J=r.add(y,x),P=r.add(L,A),J=r.mul(J,P),P=r.add(W,Q),J=r.sub(J,P),q=r.mul(Y,j),P=r.mul(F,Q),q=r.add(P,q),P=r.sub(W,q),q=r.add(W,q),O=r.mul(P,q),W=r.add(H,H),W=r.add(W,H),Q=r.mul(Y,Q),j=r.mul(F,j),W=r.add(W,Q),Q=r.sub(H,Q),Q=r.mul(Y,Q),j=r.add(j,Q),H=r.mul(W,j),O=r.add(O,H),H=r.mul(J,j),P=r.mul(we,P),P=r.sub(P,H),H=r.mul(we,W),q=r.mul(J,q),q=r.add(q,H),new U(P,O,q)}subtract(_){return this.add(_.negate())}is0(){return this.equals(U.ZERO)}multiply(_){const{endo:v}=e;if(!n.isValidNot0(_))throw new Error("invalid scalar: out of range");let y,x;const S=L=>se.cached(this,L,A=>gr(U,A));if(v){const{k1neg:L,k1:A,k2neg:P,k2:O}=T(_),{p:q,f:Y}=S(A),{p:F,f:H}=S(O);x=Y.add(H),y=X(v.beta,q,F,L,P)}else{const{p:L,f:A}=S(_);y=L,x=A}return gr(U,[y,x])[0]}multiplyUnsafe(_){const{endo:v}=e,y=this;if(!n.isValid(_))throw new Error("invalid scalar: out of range");if(_===Pe||y.is0())return U.ZERO;if(_===Je)return y;if(se.hasCache(this))return this.multiply(_);if(v){const{k1neg:x,k1:S,k2neg:L,k2:A}=T(_),{p1:P,p2:O}=xn(U,y,S,A);return X(v.beta,P,O,x,L)}else return se.unsafe(y,_)}toAffine(_){return V(this,_)}isTorsionFree(){const{isTorsionFree:_}=e;return i===Je?!0:_?_(U,this):se.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:_}=e;return i===Je?this:_?_(U,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(_=!0){return kt(_,"isCompressed"),this.assertValidity(),h(U,this,_)}toHex(_=!0){return be(this.toBytes(_))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const de=n.BITS,se=new Cn(U,e.endo?Math.ceil(de/2):de);return U.BASE.precompute(8),U}function ao(o){return Uint8Array.of(o?2:3)}function co(o,e){return{secretKey:e.BYTES,publicKey:1+o.BYTES,publicKeyUncompressed:1+2*o.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function $n(o,e={}){const{Fn:t}=o,r=e.randomBytes||Mr,n=Object.assign(co(o.Fp,t),{seed:to(t.ORDER)});function s(h){try{const p=t.fromBytes(h);return t.isValidNot0(p)}catch{return!1}}function i(h,p){const{publicKey:b,publicKeyUncompressed:w}=n;try{const k=h.length;return p===!0&&k!==b||p===!1&&k!==w?!1:!!o.fromBytes(h)}catch{return!1}}function c(h=r(n.seed)){return _n(Z(h,n.seed,"seed"),t.ORDER)}function a(h,p=!0){return o.BASE.multiply(t.fromBytes(h)).toBytes(p)}function l(h){const{secretKey:p,publicKey:b,publicKeyUncompressed:w}=n;if(!jt(h)||"_lengths"in t&&t._lengths||p===b)return;const k=Z(h,void 0,"key").length;return k===b||k===w}function d(h,p,b=!0){if(l(h)===!0)throw new Error("first arg must be private key");if(l(p)===!1)throw new Error("second arg must be public key");const w=t.fromBytes(h);return o.fromBytes(p).multiply(w).toBytes(b)}const u={isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c},f=En(c,a);return Object.freeze({getPublicKey:a,getSharedSecret:d,keygen:f,Point:o,utils:u,lengths:n})}function Mn(o,e,t={}){Ir(e),Qt(t,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),t=Object.assign({},t);const r=t.randomBytes||Mr,n=t.hmac||((v,y)=>so(e,v,y)),{Fp:s,Fn:i}=o,{ORDER:c,BITS:a}=i,{keygen:l,getPublicKey:d,getSharedSecret:u,utils:f,lengths:h}=$n(o,t),p={prehash:!0,lowS:typeof t.lowS=="boolean"?t.lowS:!0,format:"compact",extraEntropy:!1},b=c*io<s.ORDER;function w(v){const y=c>>Je;return v>y}function k(v,y){if(!i.isValidNot0(y))throw new Error(`invalid signature ${v}: out of range 1..Point.Fn.ORDER`);return y}function B(){if(b)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function C(v,y){Nt(y);const x=h.signature,S=y==="compact"?x:y==="recovered"?x+1:void 0;return Z(v,S)}class E{r;s;recovery;constructor(y,x,S){if(this.r=k("r",y),this.s=k("s",x),S!=null){if(B(),![0,1,2,3].includes(S))throw new Error("invalid recovery id");this.recovery=S}Object.freeze(this)}static fromBytes(y,x=p.format){C(y,x);let S;if(x==="der"){const{r:O,s:q}=Me.toSig(Z(y));return new E(O,q)}x==="recovered"&&(S=y[0],x="compact",y=y.subarray(1));const L=h.signature/2,A=y.subarray(0,L),P=y.subarray(L,L*2);return new E(i.fromBytes(A),i.fromBytes(P),S)}static fromHex(y,x){return this.fromBytes(ye(y),x)}assertRecovery(){const{recovery:y}=this;if(y==null)throw new Error("invalid recovery id: must be present");return y}addRecoveryBit(y){return new E(this.r,this.s,y)}recoverPublicKey(y){const{r:x,s:S}=this,L=this.assertRecovery(),A=L===2||L===3?x+c:x;if(!s.isValid(A))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const P=s.toBytes(A),O=o.fromBytes(Oe(ao((L&1)===0),P)),q=i.inv(A),Y=V(Z(y,void 0,"msgHash")),F=i.create(-Y*q),H=i.create(S*q),W=o.BASE.multiplyUnsafe(F).add(O.multiplyUnsafe(H));if(W.is0())throw new Error("invalid recovery: point at infinify");return W.assertValidity(),W}hasHighS(){return w(this.s)}toBytes(y=p.format){if(Nt(y),y==="der")return ye(Me.hexFromSig(this));const{r:x,s:S}=this,L=i.toBytes(x),A=i.toBytes(S);return y==="recovered"?(B(),Oe(Uint8Array.of(this.assertRecovery()),L,A)):Oe(L,A)}toHex(y){return be(this.toBytes(y))}}const T=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const x=xt(y),S=y.length*8-a;return S>0?x>>BigInt(S):x},V=t.bits2int_modN||function(y){return i.create(T(y))},oe=Gt(a);function X(v){return dn("num < 2^"+a,v,Pe,oe),i.toBytes(v)}function U(v,y){return Z(v,void 0,"message"),y?Z(e(v),void 0,"prehashed message"):v}function de(v,y,x){const{lowS:S,prehash:L,extraEntropy:A}=$t(x,p);v=U(v,L);const P=V(v),O=i.fromBytes(y);if(!i.isValidNot0(O))throw new Error("invalid private key");const q=[X(O),X(P)];if(A!=null&&A!==!1){const W=A===!0?r(h.secretKey):A;q.push(Z(W,void 0,"extraEntropy"))}const Y=Oe(...q),F=P;function H(W){const Q=T(W);if(!i.isValidNot0(Q))return;const we=i.inv(Q),j=o.BASE.multiply(Q).toAffine(),J=i.create(j.x);if(J===Pe)return;const at=i.create(we*i.create(F+J*O));if(at===Pe)return;let ir=(j.x===J?0:2)|Number(j.y&Je),ar=at;return S&&w(at)&&(ar=i.neg(at),ir^=1),new E(J,ar,b?void 0:ir)}return{seed:Y,k2sig:H}}function se(v,y,x={}){const{seed:S,k2sig:L}=de(v,y,x);return fn(e.outputLen,i.BYTES,n)(S,L).toBytes(x.format)}function N(v,y,x,S={}){const{lowS:L,prehash:A,format:P}=$t(S,p);if(x=Z(x,void 0,"publicKey"),y=U(y,A),!jt(v)){const O=v instanceof E?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+O)}C(v,P);try{const O=E.fromBytes(v,P),q=o.fromBytes(x);if(L&&O.hasHighS())return!1;const{r:Y,s:F}=O,H=V(y),W=i.inv(F),Q=i.create(H*W),we=i.create(Y*W),j=o.BASE.multiplyUnsafe(Q).add(q.multiplyUnsafe(we));return j.is0()?!1:i.create(j.x)===Y}catch{return!1}}function _(v,y,x={}){const{prehash:S}=$t(x,p);return y=U(y,S),E.fromBytes(v,"recovered").recoverPublicKey(y).toBytes()}return Object.freeze({keygen:l,getPublicKey:d,getSharedSecret:u,utils:f,lengths:h,Point:o,sign:se,verify:N,recoverPublicKey:_,Signature:E,hash:e})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const er={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},On={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},vr=BigInt(2);function Un(o){const e=er.p,t=BigInt(3),r=BigInt(6),n=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),l=o*o*o%e,d=l*l*o%e,u=ie(d,t,e)*d%e,f=ie(u,t,e)*d%e,h=ie(f,vr,e)*l%e,p=ie(h,n,e)*h%e,b=ie(p,s,e)*p%e,w=ie(b,c,e)*b%e,k=ie(w,a,e)*w%e,B=ie(k,c,e)*b%e,C=ie(B,t,e)*d%e,E=ie(C,i,e)*p%e,T=ie(E,r,e)*l%e,V=ie(T,vr,e);if(!Ht.eql(Ht.sqr(V),o))throw new Error("Cannot find square root");return V}const Ht=Pt(er.p,{sqrt:Un}),Rn=In(er,{Fp:Ht,endo:On}),xe=Mn(Rn,Ke);class Et{constructor(e,t,r){this.data=e,this.recovery=t,this.compressed=r??!0}static from(e){if(typeof e=="string"){const t=ye(e);let r=parseInt(be(t.subarray(0,1)),16)-31,n=!0;r<0&&(n=!1,r=r+4);const s=t.subarray(1);return new Et(s,r,n)}else throw new Error("Expected string for data")}toBuffer(){const e=new Uint8Array(65).fill(0);return this.compressed?e[0]=this.recovery+31&255:e[0]=this.recovery+27&255,e.set(this.data,1),e}customToString(){return be(this.toBuffer())}getPublicKey(e){if(e instanceof Uint8Array&&e.length!==32||typeof e=="string"&&e.length!==64)throw new Error("Expected a valid sha256 hash as message");typeof e=="string"&&(e=ye(e));const t=xe.Signature.fromBytes(this.data,"compact"),r=new xe.Signature(t.r,t.s,this.recovery);return new ce(r.recoverPublicKey(e).toBytes())}}const Tn=ae.address_prefix;class ce{constructor(e,t){this.key=e,this.prefix=t??Tn}static fromString(e){const{key:t,prefix:r}=Dn(e);return new ce(t,r)}static from(e){return e instanceof ce?e:ce.fromString(e)}verify(e,t){return typeof t=="string"&&(t=Et.from(t)),xe.verify(t.data,e,this.key,{prehash:!1,format:"compact"})}toString(){return qn(this.key,this.prefix)}toJSON(){return this.toString()}inspect(){return`PublicKey: ${this.toString()}`}}const qn=(o,e)=>{const t=Vo(o);return e+rt.encode(new Uint8Array([...o,...t.subarray(0,4)]))},Dn=o=>{const e=o.slice(0,3);o=o.slice(3);const t=rt.decode(o);return{key:t.subarray(0,t.length-4),prefix:e}};class Ye{constructor(e,t){this.amount=e,this.symbol=t==="HIVE"?"STEEM":t==="HBD"?"SBD":t}static fromString(e,t=null){const[r,n]=e.split(" ");if(["STEEM","VESTS","SBD","TESTS","TBD","HIVE","HBD"].indexOf(n)===-1)throw new Error(`Invalid asset symbol: ${n}`);if(t&&n!==t)throw new Error(`Invalid asset, expected symbol: ${t} got: ${n}`);const s=Number.parseFloat(r);if(!Number.isFinite(s))throw new Error(`Invalid asset amount: ${r}`);return new Ye(s,n)}static from(e,t){if(e instanceof Ye){if(t&&e.symbol!==t)throw new Error(`Invalid asset, expected symbol: ${t} got: ${e.symbol}`);return e}else{if(typeof e=="number"&&Number.isFinite(e))return new Ye(e,t||"STEEM");if(typeof e=="string")return Ye.fromString(e,t);throw new Error(`Invalid asset '${String(e)}'`)}}getPrecision(){switch(this.symbol){case"TESTS":case"TBD":case"STEEM":case"SBD":case"HBD":case"HIVE":return 3;case"VESTS":return 6;default:return 3}}toString(){return`${this.amount.toFixed(this.getPrecision())} ${this.symbol}`}toJSON(){return this.toString()}}class Ge{static from(e){return e instanceof Ge?e:e instanceof Uint8Array?new Ge(e):typeof e=="string"?new Ge(ye(e)):new Ge(new Uint8Array(e))}constructor(e){this.buffer=e}toString(){return be(this.buffer)}toJSON(){return this.toString()}}const $={vote:0,comment:1,transfer:2,transfer_to_vesting:3,withdraw_vesting:4,limit_order_create:5,limit_order_cancel:6,feed_publish:7,convert:8,account_create:9,account_update:10,witness_update:11,account_witness_vote:12,account_witness_proxy:13,custom:15,delete_comment:17,custom_json:18,comment_options:19,set_withdraw_vesting_route:20,limit_order_create2:21,claim_account:22,create_claimed_account:23,request_account_recovery:24,recover_account:25,change_recovery_account:26,escrow_transfer:27,escrow_dispute:28,escrow_release:29,escrow_approve:31,transfer_to_savings:32,transfer_from_savings:33,cancel_transfer_from_savings:34,decline_voting_rights:36,reset_account:37,set_reset_account:38,claim_reward_balance:39,delegate_vesting_shares:40,account_create_with_delegation:41,witness_set_properties:42,account_update2:43,create_proposal:44,update_proposal_votes:45,remove_proposal:46,update_proposal:47,collateralized_convert:48,recurrent_transfer:49},le=()=>{throw new Error("Void can not be serialized")},g=(o,e)=>{o.writeVString(e)},Nn=(o,e)=>{o.writeInt16(e)},lo=(o,e)=>{o.writeInt64(e)},_r=(o,e)=>{o.writeUint8(e)},he=(o,e)=>{o.writeUint16(e)},te=(o,e)=>{o.writeUint32(e)},uo=(o,e)=>{o.writeUint64(e)},Ee=(o,e)=>{o.writeByte(e?1:0)},fo=o=>(e,t)=>{const[r,n]=t;e.writeVarint32(r),o[r](e,n)},z=(o,e)=>{const t=Ye.from(e),r=t.getPrecision();o.writeInt64(Math.round(t.amount*Math.pow(10,r))),o.writeUint8(r);for(let n=0;n<7;n++)o.writeUint8(t.symbol.charCodeAt(n)||0)},De=(o,e)=>{o.writeUint32(Math.floor(new Date(e+"Z").getTime()/1e3))},ke=(o,e)=>{e===null||typeof e=="string"&&e.slice(-39)==="1111111111111111111111111111111114T1Anm"?o.append(new Uint8Array(33).fill(0)):o.append(ce.from(e).key)},ho=(o=null)=>(e,t)=>{t=Ge.from(t);const r=t.buffer.length;if(o){if(r!==o)throw new Error(`Unable to serialize binary. Expected ${o} bytes, got ${r}`)}e
    
  • Varint32(r);t.append(e.buffer)},lr=ar(),He=(n,t)=>(e,r)=>{e.writeVarint32(r.length);for(const[i,s]of r)n(e,i),t(e,s)},j=n=>(t,e)=>{t.writeVarint32(e.length);for(const r of e)n(t,r)},ht=n=>(t,e)=>{for(const[r,i]of n)try{i(t,e[r])}catch(s){throw s.message=`${r}: ${s.message}`,s}},Vt=n=>(t,e)=>{e!==void 0?(t.writeByte(1),n(t,e)):t.writeByte(0)},G=ht([["weight_threshold",tt],["account_auths",He(p,ft)],["key_auths",He(bt,ft)]]),Ri=ht([["account",p],["weight",ft]]),Je=ht([["base",V],["quote",V]]),Oi=ht([["account_creation_fee",V],["maximum_block_size",tt],["hbd_interest_rate",ft]]),C=(n,t)=>{const e=ht(t);return(r,i)=>{r.writeVarint32(n),e(r,i)}},k={};k.account_create=C(T.account_create,[["fee",V],["creator",p],["new_account_name",p],["owner",G],["active",G],["posting",G],["memo_key",bt],["json_metadata",p]]);k.account_create_with_delegation=C(T.account_create_with_delegation,[["fee",V],["delegation",V],["creator",p],["new_account_name",p],["owner",G],["active",G],["posting",G],["memo_key",bt],["json_metadata",p],["extensions",j(ct)]]);k.account_update=C(T.account_update,[["account",p],["owner",Vt(G)],["active",Vt(G)],["posting",Vt(G)],["memo_key",bt],["json_metadata",p]]);k.account_witness_proxy=C(T.account_witness_proxy,[["account",p],["proxy",p]]);k.account_witness_vote=C(T.account_witness_vote,[["account",p],["witness",p],["approve",It]]);k.cancel_transfer_from_savings=C(T.cancel_transfer_from_savings,[["from",p],["request_id",tt]]);k.change_recovery_account=C(T.change_recovery_account,[["account_to_recover",p],["new_recovery_account",p],["extensions",j(ct)]]);k.claim_account=C(T.claim_account,[["creator",p],["fee",V],["extensions",j(ct)]]);k.claim_reward_balance=C(T.claim_reward_balance,[["account",p],["reward_hive",V],["reward_hbd",V],["reward_vests",V]]);k.comment=C(T.comment,[["parent_author",p],["parent_permlink",p],["author",p],["permlink",p],["title",p],["body",p],["json_metadata",p]]);k.comment_options=C(T.comment_options,[["author",p],["permlink",p],["max_accepted_payout",V],["percent_hbd",ft],["allow_votes",It],["allow_curation_rewards",It],["extensions",j(cr([ht([["beneficiaries",j(Ri)]])]))]]);k.convert=C(T.convert,[["owner",p],["requestid",tt],["amount",V]]);k.create_claimed_account=C(T.create_claimed_account,[["creator",p],["new_account_name",p],["owner",G],["active",G],["posting",G],["memo_key",bt],["json_metadata",p],["extensions",j(ct)]]);k.custom=C(T.custom,[["required_auths",j(p)],["id",ft],["data",lr]]);k.custom_json=C(T.custom_json,[["required_auths",j(p)],["required_posting_auths",j(p)],["id",p],["json",p]]);k.decline_voting_rights=C(T.decline_voting_rights,[["account",p],["decline",It]]);k.delegate_vesting_shares=C(T.delegate_vesting_shares,[["delegator",p],["delegatee",p],["vesting_shares",V]]);k.delete_comment=C(T.delete_comment,[["author",p],["permlink",p]]);k.escrow_approve=C(T.escrow_approve,[["from",p],["to",p],["agent",p],["who",p],["escrow_id",tt],["approve",It]]);k.escrow_dispute=C(T.escrow_dispute,[["from",p],["to",p],["agent",p],["who",p],["escrow_id",tt]]);k.escrow_release=C(T.escrow_release,[["from",p],["to",p],["agent",p],["who",p],["receiver",p],["escrow_id",tt],["hbd_amount",V],["hive_amount",V]]);k.escrow_transfer=C(T.escrow_transfer,[["from",p],["to",p],["hbd_amount",V],["hive_amount",V],["escrow_id",tt],["agent",p],["fee",V],["json_meta",p],["ratification_deadline",qt],["escrow_expiration",qt]]);k.feed_publish=C(T.feed_publish,[["publisher",p],["exchange_rate",Je]]);k.limit_order_cancel=C(T.limit_order_cancel,[["owner",p],["orderid",tt]]);k.limit_order_create=C(T.limit_order_create,[["owner",p],["orderid",tt],["amount_to_sell",V],["min_to_receive",V],["fill_or_kill",It],["expiration",qt]]);k.limit_order_create2=C(T.limit_order_create2,[["owner",p],["orderid",tt],["amount_to_sell",V],["exchange_rate",Je],["fill_or_kill",It],["expiration",qt]]);k.recover_account=C(T.recover_account,[["account_to_recover",p],["new_owner_authority",G],["recent_owner_authority",G],["extensions",j(ct)]]);k.request_account_recovery=C(T.request_account_recovery,[["recovery_account",p],["account_to_recover",p],["new_owner_authority",G],["extensions",j(ct)]]);k.reset_account=C(T.reset_account,[["reset_account",p],["account_to_reset",p],["new_owner_authority",G]]);k.set_reset_account=C(T.set_reset_account,[["account",p],["current_reset_account",p],["reset_account",p]]);k.set_withdraw_vesting_route=C(T.set_withdraw_vesting_route,[["from_account",p],["to_account",p],["percent",ft],["auto_vest",It]]);k.transfer=C(T.transfer,[["from",p],["to",p],["amount",V],["memo",p]]);k.transfer_from_savings=C(T.transfer_from_savings,[["from",p],["request_id",tt],["to",p],["amount",V],["memo",p]]);k.transfer_to_savings=C(T.transfer_to_savings,[["from",p],["to",p],["amount",V],["memo",p]]);k.transfer_to_vesting=C(T.transfer_to_vesting,[["from",p],["to",p],["amount",V]]);k.vote=C(T.vote,[["voter",p],["author",p],["permlink",p],["weight",Di]]);k.withdraw_vesting=C(T.withdraw_vesting,[["account",p],["vesting_shares",V]]);k.witness_update=C(T.witness_update,[["owner",p],["url",p],["block_signing_key",bt],["props",Oi],["fee",V]]);k.witness_set_properties=C(T.witness_set_properties,[["owner",p],["props",He(p,lr)],["extensions",j(ct)]]);k.account_update2=C(T.account_update2,[["account",p],["owner",Vt(G)],["active",Vt(G)],["posting",Vt(G)],["memo_key",Vt(bt)],["json_metadata",p],["posting_json_metadata",p],["extensions",j(ct)]]);k.create_proposal=C(T.create_proposal,[["creator",p],["receiver",p],["start_date",qt],["end_date",qt],["daily_pay",V],["subject",p],["permlink",p],["extensions",j(ct)]]);k.update_proposal_votes=C(T.update_proposal_votes,[["voter",p],["proposal_ids",j(sr)],["approve",It],["extensions",j(ct)]]);k.remove_proposal=C(T.remove_proposal,[["proposal_owner",p],["proposal_ids",j(sr)],["extensions",j(ct)]]);const Ni=ht([["end_date",qt]]);k.update_proposal=C(T.update_proposal,[["proposal_id",or],["creator",p],["daily_pay",V],["subject",p],["permlink",p],["extensions",j(cr([ct,Ni]))]]);k.collateralized_convert=C(T.collateralized_convert,[["owner",p],["requestid",tt],["amount",V]]);k.recurrent_transfer=C(T.recurrent_transfer,[["from",p],["to",p],["amount",V],["memo",p],["recurrence",ft],["executions",ft],["extensions",j(ht([["type",_n],["value",ht([["pair_id",_n]])]]))]]);const qi=(n,t)=>{const e=k[t[0]];if(!e)throw new Error(`No serializer for operation: ${t[0]}`);try{e(n,t[1])}catch(r){throw r.message=`${t[0]}: ${r.message}`,r}},Hi=ht([["ref_block_num",ft],["ref_block_prefix",tt],["expiration",qt],["operations",j(qi)],["extensions",j(p)]]),Mi=ht([["from",bt],["to",bt],["nonce",or],["check",tt],["encrypted",ar()]]),dr={Asset:V,Memo:Mi,Price:Je,PublicKey:bt,String:p,Transaction:Hi,UInt16:ft,UInt32:tt};let Me=0,vn=0;class ve extends Error{constructor(t){super(t.message),this.name="RPCError",this.stack=void 0,this.code=t.code,"data"in t&&(this.data=t.data)}}const ur=async(n,t,e,r=ut.timeout,i=!1)=>{const s=Math.floor(Math.random()*1e8),c={jsonrpc:"2.0",method:t,params:e,id:s};try{const o=await(await fetch(n,{method:"POST",body:JSON.stringify(c),headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(r)})).json();if(!o||typeof o.id>"u"||o.id!==s||o.jsonrpc!=="2.0")throw new Error("JSONRPC id missmatch");if("result"in o)return o.result;if("error"in o){const l=o.error;throw"message"in l&&"code"in l?new ve(l):o.error}throw o}catch(a){if(a instanceof ve)throw a;if(i)return ur(n,t,e,r,!1);throw a}},ye=async(n,t=[],e=ut.timeout,r=ut.retry)=>{if(!Array.isArray(ut.nodes))throw new Error("config.nodes is not an array");const i=ut.nodes[Me];try{return await ur(i,n,t,e)}catch(s){if(s instanceof ve||(vn++,vn>r))throw s;return Vi(),ye(n,t,e,r)}},Vi=(n=Me+1)=>{n>ut.nodes.length-1&&(n=0),Me=n},xn=n=>new Promise(t=>setTimeout(t,n)),zi=gt(ut.chain_id);class Qe{constructor(t){this.expiration=6e4,this.createTransaction=async e=>{const r=await ye("condenser_api.get_dynamic_global_properties",[]),i=gt(r.head_block_id),s=Number(new Uint32Array(i.buffer,i.byteOffset+4,1)[0]),c=new Date(Date.now()+e).toISOString().slice(0,-5);this.transaction={expiration:c,extensions:[],operations:[],ref_block_num:r.head_block_number&65535,ref_block_prefix:s,signatures:[]}},t?.transaction&&(t.transaction instanceof Qe?(this.transaction=t.transaction.transaction,this.expiration=t.transaction.expiration):this.transaction=t.transaction,this.txId=this.digest().txId),t?.expiration&&(this.expiration=t.expiration)}async addOperation(t,e){this.transaction||await this.createTransaction(this.expiration),this.transaction.operations.push([t,e])}sign(t){if(!this.transaction)throw new Error("First create a transaction by .addOperation()");if(this.transaction){const{digest:e,txId:r}=this.digest();Array.isArray(t)||(t=[t]);for(const i of t){const s=i.sign(e);this.transaction.signatures.push(s.customToString())}return this.txId=r,this.transaction}else throw new Error("No transaction to sign")}async broadcast(t=!1){if(!this.transaction)throw new Error("Attempted to broadcast an empty transaction. Add operations by .addOperation()");if(this.transaction.signatures.length===0)throw new Error("Attempted to broadcast a transaction with no signatures. Sign using .sign(keys)");try{await ye("condenser_api.broadcast_transaction",[this.transaction])}catch(i){if(!(i instanceof ve&&i.message.includes("Duplicate transaction check failed")))throw i}if(this.txId||(this.txId=this.digest().txId),!t)return{tx_id:this.txId,status:"unknown"};await xn(1e3);let e=await this.checkStatus(),r=1;for(;e?.status!=="within_irreversible_block"&&e?.status!=="expired_irreversible"&&e?.status!=="too_old";)await xn(1e3+r*300),e=await this.checkStatus(),r++;return{tx_id:this.txId,status:e.status}}digest(){if(!this.transaction)throw new Error("First create a transaction by .addOperation()");const t=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN),e={...this.transaction};try{dr.Transaction(t,e)}catch(c){throw new Error("Unable to serialize transaction: "+c)}t.flip();const r=new Uint8Array(t.toBuffer()),i=yt(Ft(r)).slice(0,40);return{digest:Ft(new Uint8Array([...zi,...r])),txId:i}}addSignature(t){if(!this.transaction)throw new Error("First create a transaction by .create(operations)");if(typeof t!="string")throw new Error("Signature must be string");if(t.length!==130)throw new Error("Signature must be 130 characters long");return this.transaction.signatures.push(t),this.transaction}async checkStatus(){return this.txId||(this.txId=this.digest().txId),ye("transaction_status_api.find_transaction",{transaction_id:this.txId,expiration:this.transaction?.expiration})}}const fr=new Uint8Array([128]);class xt{constructor(t){this.key=t;try{St.getPublicKey(t)}catch{throw new Error("invalid private key")}}static from(t){return typeof t=="string"?xt.fromString(t):new xt(t)}static fromString(t){return new xt(Pi(t).subarray(1))}static fromSeed(t){return typeof t=="string"&&(/^[0-9a-fA-F]+$/.test(t)?t=gt(t):t=new TextEncoder().encode(t)),new xt(Ft(t))}static fromLogin(t,e,r="active"){const i=t+r+e;return xt.fromSeed(i)}sign(t){const e=St.sign(t,this.key,{extraEntropy:!0,format:"recovered",prehash:!1}),r=parseInt(yt(e.subarray(0,1)),16);return Ae.from((r+31).toString(16)+yt(e.subarray(1)))}createPublic(t){return new ot(St.getPublicKey(this.key),t)}toString(){return Ki(new Uint8Array([...fr,...this.key]))}inspect(){const t=this.toString();return`PrivateKey: ${t.slice(0,6)}...${t.slice(-6)}`}getSharedSecret(t){const e=St.getSharedSecret(this.key,t.key);return Nn(e.subarray(1))}static randomKey(){return new xt(St.keygen().secretKey)}}const hr=n=>Ft(Ft(n)),Ki=n=>{const t=hr(n);return ee.encode(new Uint8Array([...n,...t.slice(0,4)]))},Pi=n=>{const t=ee.decode(n);if(!En(t.slice(0,1),fr))throw new Error("Private key network id mismatch");const e=t.slice(-4),r=t.slice(0,-4),i=hr(r).slice(0,4);if(!En(e,i))throw new Error("Private key checksum mismatch");return r},En=(n,t)=>{if(n===t)return!0;if(n.byteLength!==t.byteLength)return!1;const e=n.byteLength;let r=0;for(;r<e&&n[r]===t[r];)r++;return r===e};/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function Fi(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Et(n,t,e=""){const r=Fi(n),i=n?.length,s=t!==void 0;if(!r||s&&i!==t){const c=e&&`"${e}" `,a=s?` of length ${t}`:"",o=r?`length=${i}`:`type=${typeof n}`;throw new Error(c+"expected Uint8Array"+a+", got "+o)}return n}function Dt(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function re(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}const ji=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Zi(n,t){return n.buffer===t.buffer&&n.byteOffset<t.byteOffset+t.byteLength&&t.byteOffset<n.byteOffset+n.byteLength}function pr(n,t){if(Zi(n,t)&&n.byteOffset<t.byteOffset)throw new Error("complex overlap of input and output is not supported")}const Wi=(n,t)=>{function e(r,...i){if(Et(r,void 0,"key"),!ji)throw new Error("Non little-endian hardware is not yet supported");if(n.nonceLength!==void 0){const d=i[0];Et(d,n.varSizeNonce?void 0:n.nonceLength,"nonce")}const s=n.tagLength;s&&i[1]!==void 0&&Et(i[1],void 0,"AAD");const c=t(r,...i),a=(d,u)=>{if(u!==void 0){if(d!==2)throw new Error("cipher output not supported");Et(u,void 0,"output")}};let o=!1;return{encrypt(d,u){if(o)throw new Error("cannot encrypt() twice with same key + nonce");return o=!0,Et(d),a(c.encrypt.length,u),c.encrypt(d,u)},decrypt(d,u){if(Et(d),s&&d.length<s)throw new Error('"ciphertext" expected length bigger than tagLength='+s);return a(c.decrypt.length,u),c.decrypt(d,u)}}}return Object.assign(e,n),e};function mr(n,t,e=!0){if(t===void 0)return new Uint8Array(n);if(t.length!==n)throw new Error('"output" expected Uint8Array of length '+n+", got: "+t.length);if(e&&!Qt(t))throw new Error("invalid output, must be aligned");return t}function Qt(n){return n.byteOffset%4===0}function ne(n){return Uint8Array.from(n)}const Ot=16,Yi=283;function Gi(n){if(![16,24,32].includes(n.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+n.length)}function tn(n){return n<<1^Yi&-(n>>7)}function Xt(n,t){let e=0;for(;t>0;t>>=1)e^=n&-(t&1),n=tn(n);return e}const Ve=(()=>{const n=new Uint8Array(256);for(let e=0,r=1;e<256;e++,r^=tn(r))n[e]=r;const t=new Uint8Array(256);t[0]=99;for(let e=0;e<255;e++){let r=n[255-e];r|=r<<8,t[n[e]]=(r^r>>4^r>>5^r>>6^r>>7^99)&255}return re(n),t})(),Xi=Ve.map((n,t)=>Ve.indexOf(t)),Ji=n=>n<<24|n>>>8,$e=n=>n<<8|n>>>24;function wr(n,t){if(n.length!==256)throw new Error("Wrong sbox length");const e=new Uint32Array(256).map((l,d)=>t(n[d])),r=e.map($e),i=r.map($e),s=i.map($e),c=new Uint32Array(256*256),a=new Uint32Array(256*256),o=new Uint16Array(256*256);for(let l=0;l<256;l++)for(let d=0;d<256;d++){const u=l*256+d;c[u]=e[l]^r[d],a[u]=i[l]^s[d],o[u]=n[l]<<8|n[d]}return{sbox:n,sbox2:o,T0:e,T1:r,T2:i,T3:s,T01:c,T23:a}}const en=wr(Ve,n=>Xt(n,3)<<24|n<<16|n<<8|Xt(n,2)),yr=wr(Xi,n=>Xt(n,11)<<24|Xt(n,13)<<16|Xt(n,9)<<8|Xt(n,14)),Qi=(()=>{const n=new Uint8Array(16);for(let t=0,e=1;t<16;t++,e=tn(e))n[t]=e;return n})();function gr(n){Et(n);const t=n.length;Gi(n);const{sbox2:e}=en,r=[];Qt(n)||r.push(n=ne(n));const i=Dt(n),s=i.length,c=o=>wt(e,o,o,o,o),a=new Uint32Array(t+28);a.set(i);for(let o=s;o<a.length;o++){let l=a[o-1];o%s===0?l=c(Ji(l))^Qi[o/s-1]:s>6&&o%s===4&&(l=c(l)),a[o]=a[o-s]^l}return re(...r),a}function ts(n){const t=gr(n),e=t.slice(),r=t.length,{sbox2:i}=en,{T0:s,T1:c,T2:a,T3:o}=yr;for(let l=0;l<r;l+=4)for(let d=0;d<4;d++)e[l+d]=t[r-l-4+d];re(t);for(let l=4;l<r-4;l++){const d=e[l],u=wt(i,d,d,d,d);e[l]=s[u&255]^c[u>>>8&255]^a[u>>>16&255]^o[u>>>24]}return e}function Rt(n,t,e,r,i,s){return n[e<<8&65280|r>>>8&255]^t[i>>>8&65280|s>>>24&255]}function wt(n,t,e,r,i){return n[t&255|e&65280]|n[r>>>16&255|i>>>16&65280]<<16}function Sn(n,t,e,r,i){const{sbox2:s,T01:c,T23:a}=en;let o=0;t^=n[o++],e^=n[o++],r^=n[o++],i^=n[o++];const l=n.length/4-2;for(let w=0;w<l;w++){const b=n[o++]^Rt(c,a,t,e,r,i),y=n[o++]^Rt(c,a,e,r,i,t),x=n[o++]^Rt(c,a,r,i,t,e),E=n[o++]^Rt(c,a,i,t,e,r);t=b,e=y,r=x,i=E}const d=n[o++]^wt(s,t,e,r,i),u=n[o++]^wt(s,e,r,i,t),h=n[o++]^wt(s,r,i,t,e),f=n[o++]^wt(s,i,t,e,r);return{s0:d,s1:u,s2:h,s3:f}}function es(n,t,e,r,i){const{sbox2:s,T01:c,T23:a}=yr;let o=0;t^=n[o++],e^=n[o++],r^=n[o++],i^=n[o++];const l=n.length/4-2;for(let w=0;w<l;w++){const b=n[o++]^Rt(c,a,t,i,r,e),y=n[o++]^Rt(c,a,e,t,i,r),x=n[o++]^Rt(c,a,r,e,t,i),E=n[o++]^Rt(c,a,i,r,e,t);t=b,e=y,r=x,i=E}const d=n[o++]^wt(s,t,i,r,e),u=n[o++]^wt(s,e,t,i,r),h=n[o++]^wt(s,r,e,t,i),f=n[o++]^wt(s,i,r,e,t);return{s0:d,s1:u,s2:h,s3:f}}function ns(n){if(Et(n),n.length%Ot!==0)throw new Error("aes-(cbc/ecb).decrypt ciphertext should consist of blocks with size "+Ot)}function rs(n,t,e){Et(n);let r=n.length;const i=r%Ot;if(!t&&i!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");Qt(n)||(n=ne(n));const s=Dt(n);if(t){let a=Ot-i;a||(a=Ot),r=r+a}e=mr(r,e),pr(n,e);const c=Dt(e);return{b:s,o:c,out:e}}function is(n,t){if(!t)return n;const e=n.length;if(!e)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=n[e-1];if(r<=0||r>16)throw new Error("aes/pcks5: wrong padding");const i=n.subarray(0,-r);for(let s=0;s<r;s++)if(n[e-s-1]!==r)throw new Error("aes/pcks5: wrong padding");return i}function ss(n){const t=new Uint8Array(16),e=Dt(t);t.set(n);const r=Ot-n.length;for(let i=Ot-r;i<Ot;i++)t[i]=r;return e}const br=Wi({blockSize:16,nonceLength:16},function(t,e,r={}){const i=!r.disablePadding;return{encrypt(s,c){const a=gr(t),{b:o,o:l,out:d}=rs(s,i,c);let u=e;const h=[a];Qt(u)||h.push(u=ne(u));const f=Dt(u);let w=f[0],b=f[1],y=f[2],x=f[3],E=0;for(;E+4<=o.length;)w^=o[E+0],b^=o[E+1],y^=o[E+2],x^=o[E+3],{s0:w,s1:b,s2:y,s3:x}=Sn(a,w,b,y,x),l[E++]=w,l[E++]=b,l[E++]=y,l[E++]=x;if(i){const S=ss(s.subarray(E*4));w^=S[0],b^=S[1],y^=S[2],x^=S[3],{s0:w,s1:b,s2:y,s3:x}=Sn(a,w,b,y,x),l[E++]=w,l[E++]=b,l[E++]=y,l[E++]=x}return re(...h),d},decrypt(s,c){ns(s);const a=ts(t);let o=e;const l=[a];Qt(o)||l.push(o=ne(o));const d=Dt(o);c=mr(s.length,c),Qt(s)||l.push(s=ne(s)),pr(s,c);const u=Dt(s),h=Dt(c);let f=d[0],w=d[1],b=d[2],y=d[3];for(let x=0;x+4<=u.length;){const E=f,S=w,R=b,N=y;f=u[x+0],w=u[x+1],b=u[x+2],y=u[x+3];const{s0:z,s1:nt,s2:W,s3:$}=es(a,f,w,b,y);h[x++]=z^E,h[x++]=nt^S,h[x++]=W^R,h[x++]=$^N}return re(...l),is(c,i)}}}),os=(n,t,e,r=ds())=>_r(n,t,r,e),cs=(n,t,e,r,i)=>_r(n,t,e,r,i).message,_r=(n,t,e,r,i)=>{const s=typeof e=="bigint"?e:BigInt(e),c=n.getSharedSecret(t);let a=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);a.writeUint64(s),a.append(c),a.flip();const o=Nn(new Uint8Array(a.toBuffer())),l=o.subarray(32,48),d=o.subarray(0,32),u=Ft(o).subarray(0,4),h=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);h.append(u),h.flip();const f=h.readUint32();if(i){if(f!==i)throw new Error("Invalid key");r=as(r,d,l)}else r=ls(r,d,l);return{nonce:s,message:r,checksum:f}},as=(n,t,e)=>{let r=n;return r=br(t,e).decrypt(r),r},ls=(n,t,e)=>{let r=n;return r=br(t,e).encrypt(r),r};let Te=null;const ds=()=>{if(Te===null){const e=St.utils.randomSecretKey();Te=Math.round(e[0]<<8|e[1])}let n=BigInt(Date.now());const t=++Te%65535;return n=n<<BigInt(16)|BigInt(t),n},An=n=>{const t=ms(n,33);return new ot(t)},us=n=>n.readUint64(),fs=n=>n.readUint32(),hs=n=>{const t=n.readVarint32(),e=n.copy(n.offset,n.offset+t);return n.skip(t),new Uint8Array(e.toBuffer())},ps=n=>t=>{const e={},r=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);r.append(t),r.flip();for(const[i,s]of n)try{e[i]=s(r)}catch(c){throw c.message=`${i}: ${c.message}`,c}return e};function ms(n,t){if(n){const e=n.copy(n.offset,n.offset+t);return n.skip(t),new Uint8Array(e.toBuffer())}else throw Error("No buffer found on first parameter")}const ws=ps([["from",An],["to",An],["nonce",us],["check",fs],["encrypted",hs]]),ys={Memo:ws},vr=(n,t,e,r)=>{if(!e.startsWith("#"))return e;e=e.substring(1),Er(),n=Sr(n),t=gs(t);const i=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);i.writeVString(e);const s=new Uint8Array(i.copy(0,i.offset).toBuffer()),{nonce:c,message:a,checksum:o}=os(n,t,s,r),l=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);dr.Memo(l,{check:o,encrypted:a,from:n.createPublic(),nonce:c,to:t}),l.flip();const d=new Uint8Array(l.toBuffer());return"#"+ee.encode(d)},xr=(n,t)=>{if(!t.startsWith("#"))return t;t=t.substring(1),Er(),n=Sr(n);let e=ys.Memo(ee.decode(t));const{from:r,to:i,nonce:s,check:c,encrypted:a}=e,l=n.createPublic().toString()===new ot(r.key).toString()?new ot(i.key):new ot(r.key);e=cs(n,l,s,a,c);const d=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);return d.append(e),d.flip(),"#"+d.readVString()};let me;const Er=()=>{if(me===void 0){let n;me=!0;try{const t="5JdeC9P7Pbd1uGdFVEsJ41EkEnADbbHGq6p1BwFxm6txNBsQnsw",r=vr(t,"STM8m5UgaFAAYQRuaNejYdS8FVLVp9Ss3K1qAVk5de6F8s3HnVbvA","#memo爱");n=xr(t,r)}finally{me=n==="#memo爱"}}if(me===!1)throw new Error("This environment does not support encryption.")},Sr=n=>typeof n=="string"?xt.fromString(n):n,gs=n=>typeof n=="string"?ot.fromString(n):n,bs={decode:xr,encode:vr};class _s{timeout;constructor(t=1e4){this.timeout=t}async send(t,e){const r=new AbortController,i=setTimeout(()=>r.abort(),this.timeout);try{const s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:r.signal});if(!s.ok)throw new Error(`HTTP ${s.status}: ${s.statusText}`);return await s.json()}finally{clearTimeout(i)}}}class vs{endpoints;currentIndex=0;transport;requestId=1;constructor(t,e){this.endpoints=t??["https://api.hive.blog","https://api.deathwing.me","https://hive-api.arcange.eu"],this.transport=e??new _s,ut.nodes=[this.endpoints[0]]}get currentEndpoint(){return this.endpoints[this.currentIndex]}setEndpoints(t){if(t.length===0)throw new Error("At least one endpoint required");this.endpoints=t,this.currentIndex=0,ut.nodes=[t[0]]}setTransport(t){this.transport=t}async call(t,e=[]){const r=this.endpoints.length;let i;for(let s=0;s<r;s++){const c=this.endpoints[(this.currentIndex+s)%this.endpoints.length],a={jsonrpc:"2.0",method:t,params:e,id:this.requestId++};try{const o=await this.transport.send(c,a);if(o.error)throw new Error(`RPC error ${o.error.code}: ${o.error.message}`);return this.currentIndex=(this.currentIndex+s)%this.endpoints.length,ut.nodes=[this.endpoints[this.currentIndex]],o.result}catch(o){i=o instanceof Error?o:new Error(String(o)),console.warn(`RPC call to ${c} failed: ${i.message}`)}}throw new Error(`All RPC endpoints failed. Last error: ${i?.message}`)}async healthCheck(){try{return await this.call("condenser_api.get_dynamic_global_properties"),!0}catch{return!1}}async getAccounts(t){return this.call("condenser_api.get_accounts",[t])}async getDynamicGlobalProperties(){return this.call("condenser_api.get_dynamic_global_properties")}async broadcastTransaction(t){return this.call("condenser_api.broadcast_transaction_synchronous",[t])}async getAccountHistory(t,e=-1,r=100){return this.call("condenser_api.get_account_history",[t,e,r])}}let Ce;function jt(){return Ce||(Ce=new vs),Ce}function ie(n){const t=xt.from(n),e=t.createPublic();return{private:t,public:e}}function xs(n,t){const e=n.toString();return t.active.key_auths.some(([r])=>r===e)?"active":t.posting.key_auths.some(([r])=>r===e)?"posting":t.owner.key_auths.some(([r])=>r===e)?"owner":t.memo_key===e?"memo":null}async function In(n,t){const e=ie(n),i=await jt().getAccounts([t]);if(i.length===0)throw new Error(`Account @${t} not found`);const s=i[0],c=xs(e.public,s);if(!c)throw new Error(`Key does not match any authority on @${t}`);return{...e,role:c,account:s}}function zt(n){const t=n.trim().split(" ");if(t.length!==2)throw new Error(`Invalid asset format: ${n}`);return{amount:parseFloat(t[0]),symbol:t[1]}}function Kt(n,t){return`${n.toFixed(3)} ${t}`}const Es=1;function Ss(){return Es>=2}function ze(){return!1}function Ar(n,t){if(!n.startsWith("#"))return n;const e=bs.decode(t,n);return e.startsWith("#")?e.slice(1):e}const As=["haa-service"];async function Is(n,t,e=As,r=500){const i=jt(),s=[],c=new Set(e.map(l=>l.toLowerCase())),a=Math.min(r,1e3),o=await i.getAccountHistory(n,-1,a);for(const[l,d]of o){const[u,h]=d.op;if(u!=="transfer")continue;const{from:f,to:w,memo:b}=h;if(w.toLowerCase()===n.toLowerCase()&&c.has(f.toLowerCase())&&!(!b||!b.startsWith("#")))try{const y=Ar(b,t),x=JSON.parse(y);if(!Bs(x)||new Date(x.expires)<new Date)continue;s.push({payload:x,timestamp:d.timestamp,trxId:d.trx_id,from:f})}catch{continue}}return s.sort((l,d)=>new Date(d.timestamp).getTime()-new Date(l.timestamp).getTime()),s}async function Ls(n,t,e){const r=await Is(n,t,e);return r.length>0?r[0].payload:null}function Bs(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.v=="number"&&Array.isArray(t.endpoints)&&t.endpoints.length>0&&t.endpoints.every(e=>typeof e=="string")&&typeof t.expires=="string"}const Us=["https://api.hive.blog","https://api.deathwing.me","https://hive-api.arcange.eu"],De="haa_manual_endpoints";class ks{endpoints=[];discoveryInterval=null;healthInterval=null;serviceAccounts;lastPayload=null;lastDiscoveryTime=0;discoveryAttempted=!1;constructor(t=["haa-service"]){this.serviceAccounts=t,this.loadManualEndpoints(),this.addFallbacks()}hasProxyEndpoints(){return this.endpoints.some(t=>t.source==="discovered"||t.source==="manual")}get allEndpoints(){return[...this.endpoints]}get healthyEndpoints(){const t={discovered:0,manual:1,fallback:2};return this.endpoints.filter(e=>e.healthy).sort((e,r)=>t[e.source]-t[r.source]).map(e=>e.url)}addManualEndpoint(t){this.endpoints.some(e=>e.url===t)||(this.endpoints.push({url:t,source:"manual",healthy:!0,lastCheck:0}),this.saveManualEndpoints(),this.applyToClient())}removeManualEndpoint(t){this.endpoints=this.endpoints.filter(e=>!(e.url===t&&e.source==="manual")),this.saveManualEndpoints(),this.applyToClient()}async discover(t,e){this.discoveryAttempted=!0;try{const r=await Ls(t,e,this.serviceAccounts);if(r){this.lastPayload=r,this.lastDiscoveryTime=Date.now(),this.endpoints=this.endpoints.filter(i=>i.source!=="discovered");for(const i of r.endpoints)this.endpoints.push({url:i,source:"discovered",healthy:!0,lastCheck:0});return this.applyToClient(),!0}return!1}catch(r){return console.warn("Endpoint discovery failed:",r),!1}}async healthCheckAll(){const e=(ze()?this.endpoints.filter(r=>r.source!=="fallback"):this.endpoints).map(async r=>{try{const i=new AbortController,s=setTimeout(()=>i.abort(),8e3),c=await fetch(r.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"condenser_api.get_dynamic_global_properties",params:[],id:1}),signal:i.signal});clearTimeout(s),r.healthy=c.ok}catch{r.healthy=!1}r.lastCheck=Date.now()});await Promise.allSettled(e),this.applyToClient()}startPeriodicChecks(t,e,r=30*6e4,i=5*6e4){this.stopPeriodicChecks(),this.discover(t,e),this.discoveryInterval=setInterval(()=>this.discover(t,e),r),setTimeout(()=>{this.healthCheckAll(),this.healthInterval=setInterval(()=>this.healthCheckAll(),i)},15e3)}stopPeriodicChecks(){this.discoveryInterval&&(clearInterval(this.discoveryInterval),this.discoveryInterval=null),this.healthInterval&&(clearInterval(this.healthInterval),this.healthInterval=null)}applyToClient(){const t={discovered:0,manual:1,fallback:2};let e=this.endpoints.filter(i=>i.healthy);ze()&&(e=e.filter(i=>i.source!=="fallback"));const r=e.sort((i,s)=>t[i.source]-t[s.source]).map(i=>i.url);if(r.length>0)try{jt().setEndpoints(r)}catch{}}loadManualEndpoints(){try{const t=localStorage.getItem(De);if(!t)return;const e=JSON.parse(t);for(const r of e)this.endpoints.some(i=>i.url===r)||this.endpoints.push({url:r,source:"manual",healthy:!0,lastCheck:0})}catch{}}saveManualEndpoints(){const t=this.endpoints.filter(e=>e.source==="manual").map(e=>e.url);t.length>0?localStorage.setItem(De,JSON.stringify(t)):localStorage.removeItem(De)}addFallbacks(){for(const t of Us)this.endpoints.some(e=>e.url===t)||this.endpoints.push({url:t,source:"fallback",healthy:!0,lastCheck:0})}}let Re;function se(){return Re||(Re=new ks),Re}function dt(n,...t){return t.reduce((e,r,i)=>e.replace(`%${i+1}`,String(r)),n)}const m={html_lang:"en",app_title:"Propolis Wallet",nav_balance:"Balance",nav_transfer:"Transfer",nav_savings:"Savings",nav_settings:"Settings",loading:"Loading...",amount:"Amount",confirm:"Confirm",cancel:"Cancel",broadcasting:"Broadcasting...",invalid_url:"Invalid URL.",enter_proxy_url:"Enter a proxy URL.",amount_positive:"Amount must be > 0.",username_placeholder:"username",key_placeholder:"5K...",proxy_placeholder:"https://proxy.example.com",rpc_placeholder:"https://proxy.example.com/rpc",confirm_direct_mode:"Direct mode exposes Hive traffic. Continue?",confirm_logout:"Logout and clear keys?",login_title:"Login",login_info:"Enter your Hive account name and private active key. Your key never leaves this device.",account_name:"Account name",private_active_key:"Private active key",private_memo_key:"Private memo key (optional)",memo_key_placeholder:"5K... (for encrypted messages)",remember_keys:"Remember keys",remember_warning:"Keys stored in localStorage. Only use on a trusted device.",login_btn:"Login",account_key_required:"Account and active key required.",validating:"Validating...",wrong_key_role:"This is a %1 key. Active key required.",wrong_memo_role:"Second key is %1, not memo.",proxy_setup:"Proxy Setup",proxy_required:"Proxy required",proxy_desc_reconnect:"Obfuscation is enabled but no proxy endpoint is configured. Enter a proxy URL to reconnect.",proxy_desc_connect:"Obfuscation is enabled. Enter a proxy endpoint URL to connect.",proxy_url:"Proxy URL",connect:"Connect",switch_direct_link:"Or switch to Direct mode",paste_memo_prefix:"Or paste an encrypted memo from a",block_explorer:"block explorer",paste_memo_suffix:":",memo_textarea_placeholder:"#encrypted_memo...",decrypt_connect:"Decrypt & Connect",paste_memo_error:"Paste the encrypted memo.",memo_key_required:"Memo key required to decrypt.",private_memo_key_label:"Private memo key",memo_not_hash:"Memo must start with #",memo_bad_json:"Decrypted memo is not valid JSON.",memo_bad_payload:"Memo does not contain endpoint data.",memo_expired:"Endpoint data has expired.",account_label:"Account",account_not_found:"Account not found.",refresh:"Refresh",hive:"HIVE",hbd:"HBD",hive_savings:"HIVE Savings",hbd_savings:"HBD Savings",est_interest:"Est. interest (~20% APR):",hbd_yr:"HBD/yr",pending_withdrawals:"%1 pending withdrawal(s)",rpc_label:"RPC:",obfuscated:"obfuscated",direct:"direct",send_transfer:"Send Transfer",recipient:"Recipient",currency:"Currency",memo_optional:"Memo (optional)",public_memo:"Public memo",send:"Send",recipient_required:"Recipient required.",confirm_send:"Send %1 to @%2?",sent_tx:"Sent! TX: %1... (%2)",deposit_heading:"Deposit to Savings",withdraw_heading:"Withdraw from Savings",three_day_wait:"3-day waiting period for security.",deposit_btn:"Deposit to Savings",withdraw_btn:"Withdraw from Savings",pending_heading:"Pending",cancel_latest:"Cancel Latest",available_hbd:"Available: %1 HBD",apr_estimate:"~%1 HBD/yr (~20% APR)",n_pending:"%1 pending",cancelled:"Cancelled. (%1)",confirm_deposit:"Deposit %1?",confirm_withdraw:"Withdraw (3-day wait) %1?",deposited:"Deposited",withdrawal_initiated:"Withdrawal initiated",not_found:"Not found.",privacy:"Privacy",mode_label:"Mode:",mode_obfuscated:"Obfuscated",mode_direct:"Direct",traffic_disguised:"Traffic disguised as normal web requests.",traffic_plain:"Plain JSON-RPC — visible to network observers.",switch_to_direct:"Switch to Direct",switch_to_obfuscated:"Switch to Obfuscated",rpc_endpoint:"RPC Endpoint",current_label:"Current:",custom_endpoint:"Custom endpoint",set_btn:"Set",reset_btn:"Reset",check_btn:"Check",enter_url:"Enter a URL.",added:"Added.",reset_done:"Reset.",discovery:"Discovery",status_label:"Status:",n_found:"%1 found",none_found:"None found",checking:"Checking...",expires_label:"Expires: %1",discover:"Discover",check_all:"Check All",no_memo_key:"No memo key — discovery disabled.",add_memo_hint:"Add memo key at login to discover proxy endpoints.",found_n:"Found %1",none_found_dot:"None found.",done:"Done.",endpoints:"Endpoints",none:"None.",account_heading:"Account",active_check:"Active:",memo_check:"Memo:",persistent:"Persistent",session:"Session",logout:"Logout",about:"About",about_text:"Propolis Wallet v1.0.0 — Keys never leave this device."},$t=(n,t)=>t.querySelector(n);async function $s(n,t,e){se(),t.account,n.innerHTML=`<div class="card"><h2>${m.login_title}</h2>
    
    <p class="sm mt mb">${m.login_info}</p>
    <label>${m.account_name}</label><input id="a" placeholder="${m.username_placeholder}" autocomplete="off" spellcheck="false">
    <label>${m.private_active_key}</label><input type="password" id="k" placeholder="${m.key_placeholder}" autocomplete="off">
    <label>${m.private_memo_key}</label><input type="password" id="m" placeholder="${m.memo_key_placeholder}" autocomplete="off">
    <div class="mb"><label class="fx" style="cursor:pointer"><input type="checkbox" id="p" style="width:auto;margin:0"><span class="sm">${m.remember_keys}</span></label>
    <p class="wrn hidden" id="pw">${m.remember_warning}</p></div>
    <button id="b">${m.login_btn}</button><p class="err hidden" id="e"></p><p class="ok hidden" id="s"></p></div>`;const r=$t("#a",n),i=$t("#k",n),s=$t("#m",n),c=$t("#p",n),a=$t("#pw",n),o=$t("#b",n),l=$t("#e",n),d=$t("#s",n),u=(f,w)=>{f.textContent=w,f.classList.remove("hidden")},h=(...f)=>f.forEach(w=>w.classList.add("hidden"));c.addEventListener("change",()=>a.classList.toggle("hidden",!c.checked)),o.addEventListener("click",async()=>{const f=r.value.trim().toLowerCase().replace("@",""),w=i.value.trim(),b=s.value.trim()||null;if(!f||!w){u(l,m.account_key_required);return}o.disabled=!0,h(l),u(d,m.validating);try{const y=await In(w,f);if(y.role!=="active"&&y.role!=="owner"){u(l,dt(m.wrong_key_role,y.role)),h(d),o.disabled=!1;return}if(b){const x=await In(b,f);if(x.role!=="memo"){u(l,dt(m.wrong_memo_role,x.role)),h(d),o.disabled=!1;return}}t.account=f,t.activeKeyWif=w,t.memoKeyWif=b,t.persistKeys=c.checked,e.saveState(),e.startDiscovery(),e.navigate("balance")}catch(y){u(l,y instanceof Error?y.message:String(y)),h(d),o.disabled=!1}})}async function Ts(n,t,e){n.innerHTML=`<div class="card"><p class="bl">${m.account_label}</p>
    <p style="font-size:1.1rem;font-weight:bold" class="mb">@${t.account}</p>
    <div id="b"><p class="mt">${m.loading}</p></div></div>
    <button class="btn-s" id="r">${m.refresh}</button>`;const r=n.querySelector("#b"),i=n.querySelector("#r");async function s(){r.innerHTML=`<p class="mt">${m.loading}</p>`,i.disabled=!0;try{const c=jt(),a=await c.getAccounts([t.account]);if(!a.length){r.innerHTML=`<p class="err">${m.account_not_found}</p>`;return}const o=a[0],l=zt(o.balance),d=zt(o.hbd_balance),u=zt(o.savings_balance),h=zt(o.savings_hbd_balance);r.innerHTML=`<div class="g2">
    <div><p class="bl">${m.hive}</p><p class="ba">${l.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hbd}</p><p class="ba">${d.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hive_savings}</p><p class="ba">${u.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hbd_savings}</p><p class="ba gc">${h.amount.toFixed(3)}</p></div></div>
    ${h.amount>0?`<div class="info mt2"><p class="sm mt">${m.est_interest} <strong class="gc">~${(h.amount*.2).toFixed(3)} ${m.hbd_yr}</strong></p></div>`:""}
    ${o.savings_withdraw_requests>0?`<p class="wrn mt1">${dt(m.pending_withdrawals,o.savings_withdraw_requests)}</p>`:""}
    <p class="xs mt mt2">${m.rpc_label} ${c.currentEndpoint}${(()=>{const w=se().allEndpoints.find(b=>b.url===c.currentEndpoint);return w?` (${w.source})`:""})()}${Ss()?` | ${ze()?`<span class="gc">${m.obfuscated}</span>`:`<span class="wrn">${m.direct}</span>`}`:""}</p>`}catch(c){r.innerHTML=`<p class="err">${c instanceof Error?c.message:c}</p>`}finally{i.disabled=!1}}i.addEventListener("click",s),await s()}function Cs(n,t,e,r=""){return["transfer",{from:n,to:t,amount:e,memo:r}]}function Ds(n,t,e,r=""){return["transfer_to_savings",{from:n,to:t,amount:e,memo:r}]}function Rs(n,t,e,r,i=""){return["transfer_from_savings",{from:n,request_id:t,to:e,amount:r,memo:i}]}function Os(n,t){return["cancel_transfer_from_savings",{from:n,request_id:t}]}async function xe(n,t){const e=new Qe;for(const[i,s]of n)await e.addOperation(i,s);return e.sign(t.private),await e.broadcast(!0)}async function Ns(n,t,e){n.innerHTML=`<div class="card"><h2>${m.send_transfer}</h2>
    <label>${m.recipient}</label><input id="to" placeholder="${m.username_placeholder}" autocomplete="off" spellcheck="false">
    <label>${m.amount}</label><input type="number" id="am" placeholder="0.000" step="0.001" min="0.001">
    <label>${m.currency}</label><select id="cu"><option value="HBD">${m.hbd}</option><option value="HIVE">${m.hive}</option></select>
    <label>${m.memo_optional}</label><input id="me" placeholder="${m.public_memo}" autocomplete="off">
    <div id="cb" class="hidden mb"><div class="card" style="background:var(--bg);border-color:var(--wn)">
    <p class="sm" id="ct"></p><div class="fx mt2"><button class="btn-ok" id="y">${m.confirm}</button><button class="btn-s" id="n">${m.cancel}</button></div></div></div>
    <button id="s">${m.send}</button><p class="err hidden" id="e"></p><p class="ok hidden" id="o"></p></div>`;const r=n.querySelector("#to"),i=n.querySelector("#am"),s=n.querySelector("#cu"),c=n.querySelector("#me"),a=n.querySelector("#s"),o=n.querySelector("#cb"),l=n.querySelector("#ct"),d=n.querySelector("#y"),u=n.querySelector("#n"),h=n.querySelector("#e"),f=n.querySelector("#o"),w=(y,x)=>{y.textContent=x,y.classList.remove("hidden")},b=(...y)=>y.forEach(x=>x.classList.add("hidden"));a.addEventListener("click",()=>{const y=r.value.trim().toLowerCase().replace("@",""),x=parseFloat(i.value);if(b(h,f),!y){w(h,m.recipient_required);return}if(!x||x<=0){w(h,m.amount_positive);return}l.textContent=dt(m.confirm_send,Kt(x,s.value),y),o.classList.remove("hidden"),a.classList.add("hidden")}),u.addEventListener("click",()=>{o.classList.add("hidden"),a.classList.remove("hidden")}),d.addEventListener("click",async()=>{const y=r.value.trim().toLowerCase().replace("@",""),x=parseFloat(i.value),E=s.value;d.disabled=!0,d.textContent=m.broadcasting,b(h);try{const S=ie(t.activeKeyWif),R=await xe([Cs(t.account,y,Kt(x,E),c.value)],S);o.classList.add("hidden"),a.classList.remove("hidden"),w(f,dt(m.sent_tx,R.tx_id?.slice(0,12)||"",R.status)),r.value="",i.value="",c.value=""}catch(S){w(h,S instanceof Error?S.message:String(S)),o.classList.add("hidden"),a.classList.remove("hidden")}finally{d.disabled=!1,d.textContent=m.confirm}})}async function qs(n,t,e){n.innerHTML=`<div id="si" class="card"><p class="mt">${m.loading}</p></div>
    <div class="card"><h2>${m.deposit_heading}</h2><label>${m.amount}</label>
    <input type="number" id="da" placeholder="0.000" step="0.001" min="0.001">
    <select id="dc"><option value="HBD">${m.hbd}</option><option value="HIVE">${m.hive}</option></select>
    <button id="db">${m.deposit_btn}</button></div>
    <div class="card"><h2>${m.withdraw_heading}</h2><p class="sm mt mb">${m.three_day_wait}</p>
    <label>${m.amount}</label><input type="number" id="wa" placeholder="0.000" step="0.001" min="0.001">
    <select id="wc"><option value="HBD">${m.hbd}</option><option value="HIVE">${m.hive}</option></select>
    <button id="wb">${m.withdraw_btn}</button></div>
    <div id="pw" class="card hidden"><h2>${m.pending_heading}</h2><div id="pl"></div></div>
    <p class="err hidden" id="e"></p><p class="ok hidden" id="o"></p>`;const r=n.querySelector("#si"),i=n.querySelector("#da"),s=n.querySelector("#dc"),c=n.querySelector("#db"),a=n.querySelector("#wa"),o=n.querySelector("#wc"),l=n.querySelector("#wb"),d=n.querySelector("#pw"),u=n.querySelector("#pl"),h=n.querySelector("#e"),f=n.querySelector("#o"),w=E=>{h.textContent=E,h.classList.remove("hidden"),f.classList.add("hidden")},b=E=>{f.textContent=E,f.classList.remove("hidden"),h.classList.add("hidden")};async function y(){try{const E=(await jt().getAccounts([t.account]))[0];if(!E){r.innerHTML=`<p class="err">${m.not_found}</p>`;return}const S=zt(E.savings_hbd_balance),R=zt(E.savings_balance),N=zt(E.hbd_balance);r.innerHTML=`<div class="g2">
    <div><p class="bl">${m.hbd_savings}</p><p class="ba gc">${S.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hive_savings}</p><p class="ba">${R.amount.toFixed(3)}</p></div></div>
    <p class="sm mt mt1">${dt(m.available_hbd,N.amount.toFixed(3))}</p>
    ${S.amount>0?`<p class="sm gc mt1">${dt(m.apr_estimate,(S.amount*.2).toFixed(3))}</p>`:""}`,E.savings_withdraw_requests>0?(d.classList.remove("hidden"),u.innerHTML=`<p class="wrn">${dt(m.n_pending,E.savings_withdraw_requests)}</p>
    <button class="btn-s mt1" id="cb">${m.cancel_latest}</button>`,u.querySelector("#cb").addEventListener("click",async function(){this.disabled=!0;try{const z=await xe([Os(t.account,0)],ie(t.activeKeyWif));b(dt(m.cancelled,z.status)),await y()}catch(z){w(z instanceof Error?z.message:String(z))}finally{this.disabled=!1}})):d.classList.add("hidden")}catch(E){r.innerHTML=`<p class="err">${E instanceof Error?E.message:E}</p>`}}async function x(E,S,R,N){const z=parseFloat(S.value),nt=R.value;if(!z||z<=0){w(m.amount_positive);return}const W=dt(N?m.confirm_deposit:m.confirm_withdraw,Kt(z,nt));if(confirm(W)){E.disabled=!0,E.textContent=m.broadcasting;try{const $=ie(t.activeKeyWif),at=N?Ds(t.account,t.account,Kt(z,nt)):Rs(t.account,Math.floor(Date.now()/1e3)%2147483647,t.account,Kt(z,nt)),it=await xe([at],$);b(`${N?m.deposited:m.withdrawal_initiated}. (${it.status})`),S.value="",await y()}catch($){w($ instanceof Error?$.message:String($))}finally{E.disabled=!1,E.textContent=N?m.deposit_btn:m.withdraw_btn}}}c.addEventListener("click",()=>x(c,i,s,!0)),l.addEventListener("click",()=>x(l,a,o,!1)),await y()}const Hs=["https://api.hive.blog","https://api.deathwing.me","https://hive-api.arcange.eu"];async function Ms(n,t,e){const r=jt(),i=se();i.allEndpoints.filter(h=>h.source==="discovered").length>0,t.memoKeyWif;const c=(h,f)=>`<p class="sm ${h}">${f}</p>`;n.innerHTML=`
    <div class="card"><h2>${m.rpc_endpoint}</h2>
    ${c("mt mb",`${m.current_label} <code id="ce">${r.currentEndpoint}</code>`)}
    <label>${m.custom_endpoint}</label><input type="url" id="ci" placeholder="${m.rpc_placeholder}">
    <button class="btn-s" id="se">${m.set_btn}</button><button class="btn-s" id="re">${m.reset_btn}</button><button class="btn-s" id="hc">${m.check_btn}</button>
    <p class="sm hidden" id="es"></p></div>
    
    
    <div class="card"><h2>${m.account_heading}</h2>
    ${c("",`@<strong>${t.account}</strong>`)}
    ${c("mt mb",`${m.active_check} ${t.activeKeyWif?"✓":"✗"} | ${m.memo_check} ${t.memoKeyWif?"✓":"✗"} | ${t.persistKeys?m.persistent:m.session}`)}
    <button class="btn-er" id="lo">${m.logout}</button></div>
    <div class="card"><h2>${m.about}</h2>${c("mt",m.about_text)}</div>`;const a=n.querySelector("#ci"),o=n.querySelector("#ce"),l=n.querySelector("#es");n.querySelector("#ds");const d=n.querySelector("#el"),u=(h,f,w)=>{h.className=`sm ${f}`,h.textContent=w,h.classList.remove("hidden")};n.querySelector("#se").addEventListener("click",()=>{const h=a.value.trim();if(!h){u(l,"err",m.enter_url);return}try{new URL(h),i.addManualEndpoint(h),o.textContent=r.currentEndpoint,u(l,"ok",m.added),a.value="",d&&(d.innerHTML=Vs(i))}catch{u(l,"err",m.invalid_url)}}),n.querySelector("#re").addEventListener("click",()=>{r.setEndpoints(Hs),o.textContent=r.currentEndpoint,u(l,"ok",m.reset_done)}),n.querySelector("#hc").addEventListener("click",async function(){this.disabled=!0,u(l,"mt","...");const h=await r.healthCheck();u(l,h?"ok":"err",h?"✓ OK":"✗ Failed"),this.disabled=!1}),n.querySelector("#lo").addEventListener("click",()=>{confirm(m.confirm_logout)&&e.logout()})}function Vs(n){const t=n.allEndpoints;return t.length?t.map(e=>`<p class="sm"><code>${e.url}</code> <span class="xs">[${e.source}]</span> ${e.healthy?'<span class="gc">✓</span>':'<span class="err">✗</span>'}</p>`).join(""):`<p class="sm">${m.none}</p>`}const zs={login:$s,balance:Ts,transfer:Ns,savings:qs,settings:Ms},Ks=[{hash:"balance",label:m.nav_balance},{hash:"transfer",label:m.nav_transfer},{hash:"savings",label:m.nav_savings},{hash:"settings",label:m.nav_settings}];class Ps{container;navEl;contentEl;state;constructor(t){this.container=t,this.state=this.loadState(),this.container.innerHTML="";const e=document.createElement("div");e.className="ct",document.documentElement.lang=m.html_lang,document.title=m.app_title,e.innerHTML=`<h1>${m.app_title}</h1>`,this.navEl=document.createElement("nav"),this.contentEl=document.createElement("div"),this.contentEl.className="ct",e.appendChild(this.navEl),this.container.appendChild(e),this.container.appendChild(this.contentEl),this.renderNav(),window.addEventListener("hashchange",()=>this.route()),this.route(),this.startDiscovery()}loadState(){const t=localStorage.getItem("haa_keys");if(t)try{const s=JSON.parse(t);return{account:s.account||null,activeKeyWif:s.activeKeyWif||null,memoKeyWif:s.memoKeyWif||null,persistKeys:!0}}catch{}const e=sessionStorage.getItem("haa_account"),r=sessionStorage.getItem("haa_activeKey"),i=sessionStorage.getItem("haa_memoKey");return{account:e,activeKeyWif:r,memoKeyWif:i,persistKeys:!1}}saveState(){this.state.persistKeys?localStorage.setItem("haa_keys",JSON.stringify({account:this.state.account,activeKeyWif:this.state.activeKeyWif,memoKeyWif:this.state.memoKeyWif})):(localStorage.removeItem("haa_keys"),this.state.account&&sessionStorage.setItem("haa_account",this.state.account),this.state.activeKeyWif&&sessionStorage.setItem("haa_activeKey",this.state.activeKeyWif),this.state.memoKeyWif&&sessionStorage.setItem("haa_memoKey",this.state.memoKeyWif))}startDiscovery(){this.state.account&&this.state.memoKeyWif&&se().startPeriodicChecks(this.state.account,this.state.memoKeyWif)}logout(){se().stopPeriodicChecks(),this.state.account=null,this.state.activeKeyWif=null,this.state.memoKeyWif=null,localStorage.removeItem("haa_keys"),sessionStorage.clear(),this.navigate("login")}navigate(t){window.location.hash=`#${t}`}renderNav(){if(this.navEl.innerHTML="",!this.state.account){this.navEl.classList.add("hidden");return}this.navEl.classList.remove("hidden");const t=(window.location.hash||"#balance").slice(1);for(const e of Ks){const r=document.createElement("a");r.href=`#${e.hash}`,r.textContent=e.label,e.hash===t&&(r.className="active"),this.navEl.appendChild(r)}}route(){const t=(window.location.hash||"").slice(1)||"login";if(t!=="login"&&!this.state.account){this.navigate("login");return}if(t==="login"&&this.state.account){this.navigate("balance");return}const e=zs[t];if(!e){this.navigate("balance");return}this.renderNav(),this.contentEl.innerHTML="",e(this.contentEl,this.state,this)}}const Fs=document.getElementById("app"),js=new Ps(Fs);window.propolis={app:js,getClient:jt,importKey:ie,formatAsset:Kt,signAndBroadcast:xe,decryptMemo:Ar};</script>
      <style rel="stylesheet" crossorigin>*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:root{--bg:#1a1a2e;--sf:#16213e;--in:#0f3460;--tx:#e8e8e8;--tm:#a0a0b0;--ac:#e94560;--ah:#ff6b81;--ok:#4ecca3;--wn:#f0c040;--er:#e94560;--bd:#2a2a4a;--r:8px}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;background:var(--bg);color:var(--tx);min-height:100vh;line-height:1.5}.ct{max-width:480px;margin:0 auto;padding:24px 16px}h1{font-size:1.5rem;margin-bottom:8px}h2{font-size:1.2rem;margin-bottom:12px}p{margin-bottom:8px}button{background:var(--ac);color:var(--tx);border:none;padding:10px 20px;border-radius:var(--r);cursor:pointer;font-size:1rem;width:100%;margin-bottom:8px}button:hover{background:var(--ah)}button:disabled{opacity:.5;cursor:not-allowed}.btn-s{background:var(--sf);border:1px solid var(--bd)}.btn-ok{background:var(--ok)}.btn-er{background:var(--er)}input,textarea,select{background:var(--in);color:var(--tx);border:1px solid var(--bd);padding:10px 12px;border-radius:var(--r);font-size:1rem;width:100%;margin-bottom:12px}input:focus,textarea:focus,select:focus{outline:none;border-color:var(--ac)}label{display:block;font-size:.85rem;color:var(--tm);margin-bottom:4px}.card{background:var(--sf);border:1px solid var(--bd);border-radius:var(--r);padding:16px;margin-bottom:12px}.ba{font-size:1.8rem;font-weight:700}.bl{font-size:.85rem;color:var(--tm)}.sm{font-size:.85rem}.xs{font-size:.75rem}.err{color:var(--er);font-size:.85rem}.ok{color:var(--ok);font-size:.85rem}.wrn{color:var(--wn);font-size:.85rem}.mt{color:var(--tm)}.gc{color:var(--ok)}.g2{display:grid;grid-template-columns:1fr 1fr;gap:12px}.mb{margin-bottom:12px}.mt1{margin-top:8px}.mt2{margin-top:12px}.info{padding:8px;background:var(--in);border-radius:var(--r)}.fx{display:flex;gap:8px}nav{display:flex;gap:4px;margin-bottom:16px;overflow-x:auto}nav a{color:var(--tm);text-decoration:none;padding:8px 12px;border-radius:var(--r);font-size:.85rem;white-space:nowrap}nav a.active{background:var(--sf);color:var(--tx)}nav a:hover{color:var(--tx)}.hidden{display:none}</style>
    </head>
    <body>
      <div id="app"></div>
    
    </body>
    </html>
    
  • <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Propolis Wallet</title>
      <script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const c of s.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function e(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=e(i);fetch(i.href,s)}})();/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ke(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Pt(n,t=""){if(!Number.isSafeInteger(n)||n<0){const e=t&&`"${t}" `;throw new Error(`${e}expected integer >= 0, got ${n}`)}}function Z(n,t,e=""){const r=Ke(n),i=n?.length,s=t!==void 0;if(!r||s&&i!==t){const c=e&&`"${e}" `,a=s?` of length ${t}`:"",o=r?`length=${i}`:`type=${typeof n}`;throw new Error(c+"expected Uint8Array"+a+", got "+o)}return n}function Ln(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash must wrapped by utils.createHasher");Pt(n.outputLen),Pt(n.blockLen)}function ge(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function Ir(n,t){Z(n,void 0,"digestInto() output");const e=t.outputLen;if(n.length<e)throw new Error('"digestInto() output" expected to be of length >='+e)}function Nt(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function Ie(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function mt(n,t){return n<<32-t|n>>>t}function ce(n,t){return n<<t|n>>>32-t>>>0}const Bn=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Lr=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function yt(n){if(Z(n),Bn)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=Lr[n[e]];return t}const _t={_0:48,_9:57,A:65,F:70,a:97,f:102};function sn(n){if(n>=_t._0&&n<=_t._9)return n-_t._0;if(n>=_t.A&&n<=_t.F)return n-(_t.A-10);if(n>=_t.a&&n<=_t.f)return n-(_t.a-10)}function gt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(Bn)return Uint8Array.fromHex(n);const t=n.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){const c=sn(n.charCodeAt(s)),a=sn(n.charCodeAt(s+1));if(c===void 0||a===void 0){const o=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+o+'" at index '+s)}r[i]=c*16+a}return r}function Ct(...n){let t=0;for(let r=0;r<n.length;r++){const i=n[r];Z(i),t+=i.length}const e=new Uint8Array(t);for(let r=0,i=0;r<n.length;r++){const s=n[r];e.set(s,i),i+=s.length}return e}function Pe(n,t={}){const e=(i,s)=>n(s).update(i).digest(),r=n(void 0);return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=i=>n(i),Object.assign(e,t),Object.freeze(e)}function Un(n=32){const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(n))}const kn=n=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,n])});/**
     * @license bytebuffer.ts (c) 2015 Daniel Wirtz <dcode@dcode.io>
     * Backing buffer: ArrayBuffer, Accessor: DataView
     * Released under the Apache License, Version 2.0
     * see: https://github.com/dcodeIO/bytebuffer.ts for details
     * modified by @xmcl/bytebuffer
     * And customized for hive-tx
     */const ae=new ArrayBuffer(0),Br=new TextEncoder,on=new TextDecoder;class O{constructor(t=O.DEFAULT_CAPACITY,e=O.DEFAULT_ENDIAN){this.readUInt32=this.readUint32,this.buffer=t===0?ae:new ArrayBuffer(t),this.view=t===0?new DataView(ae):new DataView(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=e}static allocate(t,e){return new O(t,e)}static concat(t,e){let r=0;for(let a=0;a<t.length;++a){const o=t[a];if(o instanceof O)r+=o.limit-o.offset;else if(o instanceof Uint8Array)r+=o.length;else if(o instanceof ArrayBuffer)r+=o.byteLength;else if(Array.isArray(o))r+=o.length;else throw TypeError("Illegal buffer")}if(r===0)return new O(0,e);const i=new O(r,e),s=new Uint8Array(i.buffer);let c=0;for(let a=0;a<t.length;++a){let o=t[a];o instanceof O?(s.set(new Uint8Array(o.buffer,o.offset,o.limit-o.offset),c),c+=o.limit-o.offset):o instanceof Uint8Array?(s.set(o,c),c+=o.length):o instanceof ArrayBuffer?(s.set(new Uint8Array(o),c),c+=o.byteLength):(s.set(o,c),c+=o.length)}return i.limit=i.offset=c,i.offset=0,i}static wrap(t,e){if(t instanceof O){const i=t.clone();return i.markedOffset=-1,i}let r;if(t instanceof Uint8Array)r=new O(0,e),t.length>0&&(r.buffer=t.buffer,r.offset=t.byteOffset,r.limit=t.byteOffset+t.byteLength,r.view=new DataView(t.buffer));else if(t instanceof ArrayBuffer)r=new O(0,e),t.byteLength>0&&(r.buffer=t,r.offset=0,r.limit=t.byteLength,r.view=t.byteLength>0?new DataView(t):new DataView(ae));else if(Array.isArray(t))r=new O(t.length,e),r.limit=t.length,new Uint8Array(r.buffer).set(t);else throw TypeError("Illegal buffer");return r}writeBytes(t,e){return this.append(t,e)}writeInt8(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+1>this.buffer.byteLength&&this.resize(e+1),this.view.setInt8(e,t),r&&(this.offset+=1),this}writeByte(t,e){return this.writeInt8(t,e)}writeUint8(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+1>this.buffer.byteLength&&this.resize(e+1),this.view.setUint8(e,t),r&&(this.offset+=1),this}writeUInt8(t,e){return this.writeUint8(t,e)}readUint8(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getUint8(t);return e&&(this.offset+=1),r}readUInt8(t){return this.readUint8(t)}writeInt16(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+2>this.buffer.byteLength&&this.resize(e+2),this.view.setInt16(e,t,this.littleEndian),r&&(this.offset+=2),this}writeShort(t,e){return this.writeInt16(t,e)}writeUint16(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+2>this.buffer.byteLength&&this.resize(e+2),this.view.setUint16(e,t,this.littleEndian),r&&(this.offset+=2),this}writeUInt16(t,e){return this.writeUint16(t,e)}writeInt32(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+4>this.buffer.byteLength&&this.resize(e+4),this.view.setInt32(e,t,this.littleEndian),r&&(this.offset+=4),this}writeInt(t,e){return this.writeInt32(t,e)}writeUint32(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+4>this.buffer.byteLength&&this.resize(e+4),this.view.setUint32(e,t,this.littleEndian),r&&(this.offset+=4),this}writeUInt32(t,e){return this.writeUint32(t,e)}readUint32(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getUint32(t,this.littleEndian);return e&&(this.offset+=4),r}append(t,e){const r=typeof e>"u";r?e=this.offset:e=e;let i;return t instanceof O?(i=new Uint8Array(t.buffer,t.offset,t.limit-t.offset),t.offset+=i.length):t instanceof Uint8Array?i=t:t instanceof ArrayBuffer?i=new Uint8Array(t):i=new Uint8Array(t),i.length<=0?this:(e+i.length>this.buffer.byteLength&&this.resize(e+i.length),new Uint8Array(this.buffer).set(i,e),r&&(this.offset+=i.length),this)}clone(t){const e=new O(0,this.littleEndian);return t?(e.buffer=new ArrayBuffer(this.buffer.byteLength),new Uint8Array(e.buffer).set(new Uint8Array(this.buffer)),e.view=new DataView(e.buffer)):(e.buffer=this.buffer,e.view=this.view),e.offset=this.offset,e.markedOffset=this.markedOffset,e.limit=this.limit,e}copy(t,e){if(t===void 0&&(t=this.offset),e===void 0&&(e=this.limit),t===e)return new O(0,this.littleEndian);const r=e-t,i=new O(r,this.littleEndian);return i.offset=0,i.limit=r,new Uint8Array(i.buffer).set(new Uint8Array(this.buffer).subarray(t,e),0),i}copyTo(t,e,r,i){const s=typeof e>"u",c=typeof r>"u";e=s?t.offset:e,r=c?this.offset:r,i=i===void 0?this.limit:i;const a=i-r;return a===0?t:(t.ensureCapacity(e+a),new Uint8Array(t.buffer).set(new Uint8Array(this.buffer).subarray(r,i),e),c&&(this.offset+=a),s&&(t.offset+=a),this)}ensureCapacity(t){let e=this.buffer.byteLength;return e<t?this.resize((e*=2)>t?e:t):this}flip(){return this.limit=this.offset,this.offset=0,this}resize(t){if(this.buffer.byteLength<t){const e=new ArrayBuffer(t);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e,this.view=new DataView(e)}return this}skip(t){return this.offset+=t,this}writeInt64(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,typeof t=="number"&&(t=BigInt(t)),e+8>this.buffer.byteLength&&this.resize(e+8),this.view.setBigInt64(e,t,this.littleEndian),r&&(this.offset+=8),this}writeLong(t,e){return this.writeInt64(t,e)}readInt64(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getBigInt64(t,this.littleEndian);return e&&(this.offset+=8),r}readLong(t){return this.readInt64(t)}writeUint64(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,typeof t=="number"&&(t=BigInt(t)),e+8>this.buffer.byteLength&&this.resize(e+8),this.view.setBigUint64(e,t,this.littleEndian),r&&(this.offset+=8),this}writeUInt64(t,e){return this.writeUint64(t,e)}readUint64(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getBigUint64(t,this.littleEndian);return e&&(this.offset+=8),r}readUInt64(t){return this.readUint64(t)}toBuffer(t){const e=this.offset,r=this.limit;return!t&&e===0&&r===this.buffer.byteLength?this.buffer:e===r?ae:this.buffer.slice(e,r)}toArrayBuffer(t){return this.toBuffer(t)}writeVarint32(t,e){const r=typeof e>"u";r?e=this.offset:e=e;const i=this.calculateVarint32(t);for(e+i>this.buffer.byteLength&&this.resize(e+i),t>>>=0;t>=128;)this.view.setUint8(e++,t&127|128),t>>>=7;return this.view.setUint8(e++,t),r?(this.offset=e,this):i}readVarint32(t){const e=typeof t>"u";typeof t>"u"&&(t=this.offset);let r=0,i=0,s;do s=this.view.getUint8(t++),r<5&&(i|=(s&127)<<7*r),++r;while((s&128)!==0);return i|=0,e?(this.offset=t,i):{value:i,length:r}}calculateVarint32(t){return t=t>>>0,t<128?1:t<16384?2:t<1<<21?3:t<1<<28?4:5}writeVString(t,e){const r=typeof e>"u";let i=r?this.offset:e;const s=Br.encode(t),c=s.length,a=this.calculateVarint32(c);return i+a+c>this.buffer.byteLength&&this.resize(i+a+c),this.writeVarint32(c,i),i+=a,new Uint8Array(this.buffer).set(s,i),i+=c,r?(this.offset=i,this):i-(e||0)}readVString(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=t,i=this.readVarint32(t),s=i.value,c=i.length;t+=c;const a=on.decode(new Uint8Array(this.buffer,t,s));return t+=s,e?(this.offset=t,a):{string:a,length:t-r}}readUTF8String(t,e){const r=typeof e>"u";r?e=this.offset:e=e;const i=on.decode(new Uint8Array(this.buffer,e,t));return r?(this.offset+=t,i):{string:i,length:t}}}O.LITTLE_ENDIAN=!0;O.BIG_ENDIAN=!1;O.DEFAULT_CAPACITY=16;O.DEFAULT_ENDIAN=O.BIG_ENDIAN;function Ur(n,t,e){return n&t^~n&e}function kr(n,t,e){return n&t^n&e^t&e}class Fe{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,e,r,i){this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Ie(this.buffer)}update(t){ge(this),Z(t);const{view:e,buffer:r,blockLen:i}=this,s=t.length;for(let c=0;c<s;){const a=Math.min(i-this.pos,s-c);if(a===i){const o=Ie(t);for(;i<=s-c;c+=i)this.process(o,c);continue}r.set(t.subarray(c,c+a),this.pos),this.pos+=a,c+=a,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ge(this),Ir(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:i,isLE:s}=this;let{pos:c}=this;e[c++]=128,Nt(this.buffer.subarray(c)),this.padOffset>i-c&&(this.process(r,0),c=0);for(let u=c;u<i;u++)e[u]=0;r.setBigUint64(i-8,BigInt(this.length*8),s),this.process(r,0);const a=Ie(t),o=this.outputLen;if(o%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const l=o/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)a.setUint32(4*u,d[u],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:e,buffer:r,length:i,finished:s,destroyed:c,pos:a}=this;return t.destroyed=c,t.finished=s,t.length=i,t.pos=a,i%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Lt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Q=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),$r=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),$n=Uint8Array.from(new Array(16).fill(0).map((n,t)=>t)),Tr=$n.map(n=>(9*n+5)%16),Tn=(()=>{const e=[[$n],[Tr]];for(let r=0;r<4;r++)for(let i of e)i.push(i[r].map(s=>$r[s]));return e})(),Cn=Tn[0],Dn=Tn[1],Rn=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(n=>Uint8Array.from(n)),Cr=Cn.map((n,t)=>n.map(e=>Rn[t][e])),Dr=Dn.map((n,t)=>n.map(e=>Rn[t][e])),Rr=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),Or=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function cn(n,t,e,r){return n===0?t^e^r:n===1?t&e|~t&r:n===2?(t|~e)^r:n===3?t&r|e&~r:t^(e|~r)}const le=new Uint32Array(16);class Nr extends Fe{h0=1732584193;h1=-271733879;h2=-1732584194;h3=271733878;h4=-1009589776;constructor(){super(64,20,8,!0)}get(){const{h0:t,h1:e,h2:r,h3:i,h4:s}=this;return[t,e,r,i,s]}set(t,e,r,i,s){this.h0=t|0,this.h1=e|0,this.h2=r|0,this.h3=i|0,this.h4=s|0}process(t,e){for(let f=0;f<16;f++,e+=4)le[f]=t.getUint32(e,!0);let r=this.h0|0,i=r,s=this.h1|0,c=s,a=this.h2|0,o=a,l=this.h3|0,d=l,u=this.h4|0,h=u;for(let f=0;f<5;f++){const w=4-f,b=Rr[f],y=Or[f],x=Cn[f],E=Dn[f],S=Cr[f],R=Dr[f];for(let N=0;N<16;N++){const z=ce(r+cn(f,s,a,l)+le[x[N]]+b,S[N])+u|0;r=u,u=l,l=ce(a,10)|0,a=s,s=z}for(let N=0;N<16;N++){const z=ce(i+cn(w,c,o,d)+le[E[N]]+y,R[N])+h|0;i=h,h=d,d=ce(o,10)|0,o=c,c=z}}this.set(this.h1+a+d|0,this.h2+l+h|0,this.h3+u+i|0,this.h4+r+c|0,this.h0+s+o|0)}roundClean(){Nt(le)}destroy(){this.destroyed=!0,Nt(this.buffer),this.set(0,0,0,0,0)}}const qr=Pe(()=>new Nr);function Hr(n){if(n.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let l=0;l<t.length;l++)t[l]=255;for(let l=0;l<n.length;l++){const d=n.charAt(l),u=d.charCodeAt(0);if(t[u]!==255)throw new TypeError(d+" is ambiguous");t[u]=l}const e=n.length,r=n.charAt(0),i=Math.log(e)/Math.log(256),s=Math.log(256)/Math.log(e);function c(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";let d=0,u=0,h=0;const f=l.length;for(;h!==f&&l[h]===0;)h++,d++;const w=(f-h)*s+1>>>0,b=new Uint8Array(w);for(;h!==f;){let E=l[h],S=0;for(let R=w-1;(E!==0||S<u)&&R!==-1;R--,S++)E+=256*b[R]>>>0,b[R]=E%e>>>0,E=E/e>>>0;if(E!==0)throw new Error("Non-zero carry");u=S,h++}let y=w-u;for(;y!==w&&b[y]===0;)y++;let x=r.repeat(d);for(;y<w;++y)x+=n.charAt(b[y]);return x}function a(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;let d=0,u=0,h=0;for(;l[d]===r;)u++,d++;const f=(l.length-d)*i+1>>>0,w=new Uint8Array(f);for(;d<l.length;){const E=l.charCodeAt(d);if(E>255)return;let S=t[E];if(S===255)return;let R=0;for(let N=f-1;(S!==0||R<h)&&N!==-1;N--,R++)S+=e*w[N]>>>0,w[N]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");h=R,d++}let b=f-h;for(;b!==f&&w[b]===0;)b++;const y=new Uint8Array(u+(f-b));let x=u;for(;b!==f;)y[x++]=w[b++];return y}function o(l){const d=a(l);if(d)return d;throw new Error("Non-base"+e+" character")}return{encode:c,decodeUnsafe:a,decode:o}}var Mr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const ee=Hr(Mr),ut={nodes:["https://api.hive.blog","https://api.deathwing.me","https://api.openhive.network","https://rpc.mahdiyari.info","https://techcoderx.com","https://hiveapi.actifit.io","https://api.c0ff33a.uk"],restNodes:["https://api.hive.blog","https://rpc.mahdiyari.info","https://techcoderx.com","https://hiveapi.actifit.io","https://api.c0ff33a.uk"],chain_id:"beeab0de00000000000000000000000000000000000000000000000000000000",address_prefix:"STM",timeout:1e4,retry:8},de=BigInt(2**32-1),an=BigInt(32);function Vr(n,t=!1){return t?{h:Number(n&de),l:Number(n>>an&de)}:{h:Number(n>>an&de)|0,l:Number(n&de)|0}}function zr(n,t=!1){const e=n.length;let r=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:c,l:a}=Vr(n[s],t);[r[s],i[s]]=[c,a]}return[r,i]}const ln=(n,t,e)=>n>>>e,dn=(n,t,e)=>n<<32-e|t>>>e,Zt=(n,t,e)=>n>>>e|t<<32-e,Wt=(n,t,e)=>n<<32-e|t>>>e,ue=(n,t,e)=>n<<64-e|t>>>e-32,fe=(n,t,e)=>n>>>e-32|t<<64-e;function vt(n,t,e,r){const i=(t>>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:i|0}}const Kr=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Pr=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,Fr=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),jr=(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0,Zr=(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),Wr=(n,t,e,r,i,s)=>t+e+r+i+s+(n/2**32|0)|0,Yr=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Bt=new Uint32Array(64);class Gr extends Fe{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:e,C:r,D:i,E:s,F:c,G:a,H:o}=this;return[t,e,r,i,s,c,a,o]}set(t,e,r,i,s,c,a,o){this.A=t|0,this.B=e|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=c|0,this.G=a|0,this.H=o|0}process(t,e){for(let u=0;u<16;u++,e+=4)Bt[u]=t.getUint32(e,!1);for(let u=16;u<64;u++){const h=Bt[u-15],f=Bt[u-2],w=mt(h,7)^mt(h,18)^h>>>3,b=mt(f,17)^mt(f,19)^f>>>10;Bt[u]=b+Bt[u-7]+w+Bt[u-16]|0}let{A:r,B:i,C:s,D:c,E:a,F:o,G:l,H:d}=this;for(let u=0;u<64;u++){const h=mt(a,6)^mt(a,11)^mt(a,25),f=d+h+Ur(a,o,l)+Yr[u]+Bt[u]|0,b=(mt(r,2)^mt(r,13)^mt(r,22))+kr(r,i,s)|0;d=l,l=o,o=a,a=c+f|0,c=s,s=i,i=r,r=f+b|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,c=c+this.D|0,a=a+this.E|0,o=o+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(r,i,s,c,a,o,l,d)}roundClean(){Nt(Bt)}destroy(){this.set(0,0,0,0,0,0,0,0),Nt(this.buffer)}}class Xr extends Gr{A=Lt[0]|0;B=Lt[1]|0;C=Lt[2]|0;D=Lt[3]|0;E=Lt[4]|0;F=Lt[5]|0;G=Lt[6]|0;H=Lt[7]|0;constructor(){super(32)}}const On=zr(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Jr=On[0],Qr=On[1],Ut=new Uint32Array(80),kt=new Uint32Array(80);class ti extends Fe{constructor(t){super(128,t,16,!1)}get(){const{Ah:t,Al:e,Bh:r,Bl:i,Ch:s,Cl:c,Dh:a,Dl:o,Eh:l,El:d,Fh:u,Fl:h,Gh:f,Gl:w,Hh:b,Hl:y}=this;return[t,e,r,i,s,c,a,o,l,d,u,h,f,w,b,y]}set(t,e,r,i,s,c,a,o,l,d,u,h,f,w,b,y){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=i|0,this.Ch=s|0,this.Cl=c|0,this.Dh=a|0,this.Dl=o|0,this.Eh=l|0,this.El=d|0,this.Fh=u|0,this.Fl=h|0,this.Gh=f|0,this.Gl=w|0,this.Hh=b|0,this.Hl=y|0}process(t,e){for(let S=0;S<16;S++,e+=4)Ut[S]=t.getUint32(e),kt[S]=t.getUint32(e+=4);for(let S=16;S<80;S++){const R=Ut[S-15]|0,N=kt[S-15]|0,z=Zt(R,N,1)^Zt(R,N,8)^ln(R,N,7),nt=Wt(R,N,1)^Wt(R,N,8)^dn(R,N,7),W=Ut[S-2]|0,$=kt[S-2]|0,at=Zt(W,$,19)^ue(W,$,61)^ln(W,$,6),it=Wt(W,$,19)^fe(W,$,61)^dn(W,$,6),H=Fr(nt,it,kt[S-7],kt[S-16]),v=jr(H,z,at,Ut[S-7],Ut[S-16]);Ut[S]=v|0,kt[S]=H|0}let{Ah:r,Al:i,Bh:s,Bl:c,Ch:a,Cl:o,Dh:l,Dl:d,Eh:u,El:h,Fh:f,Fl:w,Gh:b,Gl:y,Hh:x,Hl:E}=this;for(let S=0;S<80;S++){const R=Zt(u,h,14)^Zt(u,h,18)^ue(u,h,41),N=Wt(u,h,14)^Wt(u,h,18)^fe(u,h,41),z=u&f^~u&b,nt=h&w^~h&y,W=Zr(E,N,nt,Qr[S],kt[S]),$=Wr(W,x,R,z,Jr[S],Ut[S]),at=W|0,it=Zt(r,i,28)^ue(r,i,34)^ue(r,i,39),H=Wt(r,i,28)^fe(r,i,34)^fe(r,i,39),v=r&s^r&a^s&a,_=i&c^i&o^c&o;x=b|0,E=y|0,b=f|0,y=w|0,f=u|0,w=h|0,{h:u,l:h}=vt(l|0,d|0,$|0,at|0),l=a|0,d=o|0,a=s|0,o=c|0,s=r|0,c=i|0;const g=Kr(at,H,_);r=Pr(g,$,it,v),i=g|0}({h:r,l:i}=vt(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:c}=vt(this.Bh|0,this.Bl|0,s|0,c|0),{h:a,l:o}=vt(this.Ch|0,this.Cl|0,a|0,o|0),{h:l,l:d}=vt(this.Dh|0,this.Dl|0,l|0,d|0),{h:u,l:h}=vt(this.Eh|0,this.El|0,u|0,h|0),{h:f,l:w}=vt(this.Fh|0,this.Fl|0,f|0,w|0),{h:b,l:y}=vt(this.Gh|0,this.Gl|0,b|0,y|0),{h:x,l:E}=vt(this.Hh|0,this.Hl|0,x|0,E|0),this.set(r,i,s,c,a,o,l,d,u,h,f,w,b,y,x,E)}roundClean(){Nt(Ut,kt)}destroy(){Nt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class ei extends ti{Ah=Q[0]|0;Al=Q[1]|0;Bh=Q[2]|0;Bl=Q[3]|0;Ch=Q[4]|0;Cl=Q[5]|0;Dh=Q[6]|0;Dl=Q[7]|0;Eh=Q[8]|0;El=Q[9]|0;Fh=Q[10]|0;Fl=Q[11]|0;Gh=Q[12]|0;Gl=Q[13]|0;Hh=Q[14]|0;Hl=Q[15]|0;constructor(){super(64)}}const Ft=Pe(()=>new Xr,kn(1)),Nn=Pe(()=>new ei,kn(3));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const je=BigInt(0),Oe=BigInt(1);function be(n,t=""){if(typeof n!="boolean"){const e=t&&`"${t}" `;throw new Error(e+"expected boolean, got type="+typeof n)}return n}function qn(n){if(typeof n=="bigint"){if(!we(n))throw new Error("positive bigint expected, got "+n)}else Pt(n);return n}function he(n){const t=qn(n).toString(16);return t.length&1?"0"+t:t}function Hn(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?je:BigInt("0x"+n)}function Ee(n){return Hn(yt(n))}function Mn(n){return Hn(yt(ni(Z(n)).reverse()))}function Ze(n,t){Pt(t),n=qn(n);const e=gt(n.toString(16).padStart(t*2,"0"));if(e.length!==t)throw new Error("number too large");return e}function Vn(n,t){return Ze(n,t).reverse()}function ni(n){return Uint8Array.from(n)}const we=n=>typeof n=="bigint"&&je<=n;function ri(n,t,e){return we(n)&&we(t)&&we(e)&&t<=n&&n<e}function ii(n,t,e,r){if(!ri(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function si(n){let t;for(t=0;n>je;n>>=Oe,t+=1);return t}const We=n=>(Oe<<BigInt(n))-Oe;function oi(n,t,e){if(Pt(n,"hashLen"),Pt(t,"qByteLen"),typeof e!="function")throw new Error("hmacFn must be a function");const r=y=>new Uint8Array(y),i=Uint8Array.of(),s=Uint8Array.of(0),c=Uint8Array.of(1),a=1e3;let o=r(n),l=r(n),d=0;const u=()=>{o.fill(1),l.fill(0),d=0},h=(...y)=>e(l,Ct(o,...y)),f=(y=i)=>{l=h(s,y),o=h(),y.length!==0&&(l=h(c,y),o=h())},w=()=>{if(d++>=a)throw new Error("drbg: tried max amount of iterations");let y=0;const x=[];for(;y<t;){o=h();const E=o.slice();x.push(E),y+=o.length}return Ct(...x)};return(y,x)=>{u(),f(y);let E;for(;!(E=x(w()));)f();return u(),E}}function Ye(n,t={},e={}){if(!n||typeof n!="object")throw new Error("expected valid options object");function r(s,c,a){const o=n[s];if(a&&o===void 0)return;const l=typeof o;if(l!==c||o===null)throw new Error(`param "${s}" is invalid: expected ${c}, got ${l}`)}const i=(s,c)=>Object.entries(s).forEach(([a,o])=>r(a,o,c));i(t,!1),i(e,!0)}function un(n){const t=new WeakMap;return(e,...r)=>{const i=t.get(e);if(i!==void 0)return i;const s=n(e,...r);return t.set(e,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const rt=BigInt(0),et=BigInt(1),Ht=BigInt(2),zn=BigInt(3),Kn=BigInt(4),Pn=BigInt(5),ci=BigInt(7),Fn=BigInt(8),ai=BigInt(9),jn=BigInt(16);function lt(n,t){const e=n%t;return e>=rt?e:t+e}function st(n,t,e){let r=n;for(;t-- >rt;)r*=r,r%=e;return r}function fn(n,t){if(n===rt)throw new Error("invert: expected non-zero number");if(t<=rt)throw new Error("invert: expected positive modulus, got "+t);let e=lt(n,t),r=t,i=rt,s=et;for(;e!==rt;){const a=r/e,o=r%e,l=i-s*a;r=e,e=o,i=s,s=l}if(r!==et)throw new Error("invert: does not exist");return lt(i,t)}function Ge(n,t,e){if(!n.eql(n.sqr(t),e))throw new Error("Cannot find square root")}function Zn(n,t){const e=(n.ORDER+et)/Kn,r=n.pow(t,e);return Ge(n,r,t),r}function li(n,t){const e=(n.ORDER-Pn)/Fn,r=n.mul(t,Ht),i=n.pow(r,e),s=n.mul(t,i),c=n.mul(n.mul(s,Ht),i),a=n.mul(s,n.sub(c,n.ONE));return Ge(n,a,t),a}function di(n){const t=Se(n),e=Wn(n),r=e(t,t.neg(t.ONE)),i=e(t,r),s=e(t,t.neg(r)),c=(n+ci)/jn;return(a,o)=>{let l=a.pow(o,c),d=a.mul(l,r);const u=a.mul(l,i),h=a.mul(l,s),f=a.eql(a.sqr(d),o),w=a.eql(a.sqr(u),o);l=a.cmov(l,d,f),d=a.cmov(h,u,w);const b=a.eql(a.sqr(d),o),y=a.cmov(l,d,b);return Ge(a,y,o),y}}function Wn(n){if(n<zn)throw new Error("sqrt is not defined for small field");let t=n-et,e=0;for(;t%Ht===rt;)t/=Ht,e++;let r=Ht;const i=Se(n);for(;hn(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return Zn;let s=i.pow(r,t);const c=(t+et)/Ht;return function(o,l){if(o.is0(l))return l;if(hn(o,l)!==1)throw new Error("Cannot find square root");let d=e,u=o.mul(o.ONE,s),h=o.pow(l,t),f=o.pow(l,c);for(;!o.eql(h,o.ONE);){if(o.is0(h))return o.ZERO;let w=1,b=o.sqr(h);for(;!o.eql(b,o.ONE);)if(w++,b=o.sqr(b),w===d)throw new Error("Cannot find square root");const y=et<<BigInt(d-w-1),x=o.pow(u,y);d=w,u=o.sqr(x),h=o.mul(h,u),f=o.mul(f,x)}return f}}function ui(n){return n%Kn===zn?Zn:n%Fn===Pn?li:n%jn===ai?di(n):Wn(n)}const fi=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function hi(n){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},e=fi.reduce((r,i)=>(r[i]="function",r),t);return Ye(n,e),n}function pi(n,t,e){if(e<rt)throw new Error("invalid exponent, negatives unsupported");if(e===rt)return n.ONE;if(e===et)return t;let r=n.ONE,i=t;for(;e>rt;)e&et&&(r=n.mul(r,i)),i=n.sqr(i),e>>=et;return r}function Yn(n,t,e=!1){const r=new Array(t.length).fill(e?n.ZERO:void 0),i=t.reduce((c,a,o)=>n.is0(a)?c:(r[o]=c,n.mul(c,a)),n.ONE),s=n.inv(i);return t.reduceRight((c,a,o)=>n.is0(a)?c:(r[o]=n.mul(c,r[o]),n.mul(c,a)),s),r}function hn(n,t){const e=(n.ORDER-et)/Ht,r=n.pow(t,e),i=n.eql(r,n.ONE),s=n.eql(r,n.ZERO),c=n.eql(r,n.neg(n.ONE));if(!i&&!s&&!c)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function mi(n,t){t!==void 0&&Pt(t);const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}class wi{ORDER;BITS;BYTES;isLE;ZERO=rt;ONE=et;_lengths;_sqrt;_mod;constructor(t,e={}){if(t<=rt)throw new Error("invalid field: expected ORDER > 0, got "+t);let r;this.isLE=!1,e!=null&&typeof e=="object"&&(typeof e.BITS=="number"&&(r=e.BITS),typeof e.sqrt=="function"&&(this.sqrt=e.sqrt),typeof e.isLE=="boolean"&&(this.isLE=e.isLE),e.allowedLengths&&(this._lengths=e.allowedLengths?.slice()),typeof e.modFromBytes=="boolean"&&(this._mod=e.modFromBytes));const{nBitLength:i,nByteLength:s}=mi(t,r);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=i,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return lt(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return rt<=t&&t<this.ORDER}is0(t){return t===rt}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&et)===et}neg(t){return lt(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return lt(t*t,this.ORDER)}add(t,e){return lt(t+e,this.ORDER)}sub(t,e){return lt(t-e,this.ORDER)}mul(t,e){return lt(t*e,this.ORDER)}pow(t,e){return pi(this,t,e)}div(t,e){return lt(t*fn(e,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,e){return t+e}subN(t,e){return t-e}mulN(t,e){return t*e}inv(t){return fn(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=ui(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Vn(t,this.BYTES):Ze(t,this.BYTES)}fromBytes(t,e=!1){Z(t);const{_lengths:r,BYTES:i,isLE:s,ORDER:c,_mod:a}=this;if(r){if(!r.includes(t.length)||t.length>i)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);const l=new Uint8Array(i);l.set(t,s?0:l.length-t.length),t=l}if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);let o=s?Mn(t):Ee(t);if(a&&(o=lt(o,c)),!e&&!this.isValid(o))throw new Error("invalid field element: outside of range 0..ORDER");return o}invertBatch(t){return Yn(this,t)}cmov(t,e,r){return r?e:t}}function Se(n,t={}){return new wi(n,t)}function Gn(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function Xn(n){const t=Gn(n);return t+Math.ceil(t/2)}function yi(n,t,e=!1){Z(n);const r=n.length,i=Gn(t),s=Xn(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const c=e?Mn(n):Ee(n),a=lt(c,t-et)+et;return e?Vn(a,i):Ze(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const te=BigInt(0),Mt=BigInt(1);function _e(n,t){const e=t.negate();return n?e:t}function pn(n,t){const e=Yn(n.Fp,t.map(r=>r.Z));return t.map((r,i)=>n.fromAffine(r.toAffine(e[i])))}function Jn(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function Le(n,t){Jn(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),i=2**n,s=We(n),c=BigInt(n);return{windows:e,windowSize:r,mask:s,maxNumber:i,shiftBy:c}}function mn(n,t,e){const{windowSize:r,mask:i,maxNumber:s,shiftBy:c}=e;let a=Number(n&i),o=n>>c;a>r&&(a-=s,o+=Mt);const l=t*r,d=l+Math.abs(a)-1,u=a===0,h=a<0,f=t%2!==0;return{nextN:o,offset:d,isZero:u,isNeg:h,isNegF:f,offsetF:l}}const Be=new WeakMap,Qn=new WeakMap;function Ue(n){return Qn.get(n)||1}function wn(n){if(n!==te)throw new Error("invalid wNAF")}class gi{BASE;ZERO;Fn;bits;constructor(t,e){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=e}_unsafeLadder(t,e,r=this.ZERO){let i=t;for(;e>te;)e&Mt&&(r=r.add(i)),i=i.double(),e>>=Mt;return r}precomputeWindow(t,e){const{windows:r,windowSize:i}=Le(e,this.bits),s=[];let c=t,a=c;for(let o=0;o<r;o++){a=c,s.push(a);for(let l=1;l<i;l++)a=a.add(c),s.push(a);c=a.double()}return s}wNAF(t,e,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let i=this.ZERO,s=this.BASE;const c=Le(t,this.bits);for(let a=0;a<c.windows;a++){const{nextN:o,offset:l,isZero:d,isNeg:u,isNegF:h,offsetF:f}=mn(r,a,c);r=o,d?s=s.add(_e(h,e[f])):i=i.add(_e(u,e[l]))}return wn(r),{p:i,f:s}}wNAFUnsafe(t,e,r,i=this.ZERO){const s=Le(t,this.bits);for(let c=0;c<s.windows&&r!==te;c++){const{nextN:a,offset:o,isZero:l,isNeg:d}=mn(r,c,s);if(r=a,!l){const u=e[o];i=i.add(d?u.negate():u)}}return wn(r),i}getPrecomputes(t,e,r){let i=Be.get(e);return i||(i=this.precomputeWindow(e,t),t!==1&&(typeof r=="function"&&(i=r(i)),Be.set(e,i))),i}cached(t,e,r){const i=Ue(t);return this.wNAF(i,this.getPrecomputes(i,t,r),e)}unsafe(t,e,r,i){const s=Ue(t);return s===1?this._unsafeLadder(t,e,i):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),e,i)}createCache(t,e){Jn(e,this.bits),Qn.set(t,e),Be.delete(t)}hasCache(t){return Ue(t)!==1}}function bi(n,t,e,r){let i=t,s=n.ZERO,c=n.ZERO;for(;e>te||r>te;)e&Mt&&(s=s.add(i)),r&Mt&&(c=c.add(i)),i=i.double(),e>>=Mt,r>>=Mt;return{p1:s,p2:c}}function yn(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return hi(t),t}else return Se(n,{isLE:e})}function _i(n,t,e={},r){if(r===void 0&&(r=n==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${n} CURVE object`);for(const o of["p","n","h"]){const l=t[o];if(!(typeof l=="bigint"&&l>te))throw new Error(`CURVE.${o} must be positive bigint`)}const i=yn(t.p,e.Fp,r),s=yn(t.n,e.Fn,r),a=["Gx","Gy","a","b"];for(const o of a)if(!i.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:s}}function vi(n,t){return function(r){const i=n(r);return{secretKey:i,publicKey:t(i)}}}class tr{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(t,e){if(Ln(t),Z(e,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(e.length>r?t.create().update(e).digest():e);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=t.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),Nt(i)}update(t){return ge(this),this.iHash.update(t),this}digestInto(t){ge(this),Z(t,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});const{oHash:e,iHash:r,finished:i,destroyed:s,blockLen:c,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=c,t.outputLen=a,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const er=(n,t,e)=>new tr(n,t).update(e).digest();er.create=(n,t)=>new tr(n,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gn=(n,t)=>(n+(n>=0?t:-t)/nr)/t;function xi(n,t,e){const[[r,i],[s,c]]=t,a=gn(c*n,e),o=gn(-i*n,e);let l=n-a*r-o*s,d=-a*i-o*c;const u=l<At,h=d<At;u&&(l=-l),h&&(d=-d);const f=We(Math.ceil(si(e)/2))+Jt;if(l<At||l>=f||d<At||d>=f)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:u,k1:l,k2neg:h,k2:d}}function Ne(n){if(!["compact","recovered","der"].includes(n))throw new Error('Signature format must be "compact", "recovered", or "der"');return n}function ke(n,t){const e={};for(let r of Object.keys(t))e[r]=n[r]===void 0?t[r]:n[r];return be(e.lowS,"lowS"),be(e.prehash,"prehash"),e.format!==void 0&&Ne(e.format),e}class Ei extends Error{constructor(t=""){super(t)}}const Tt={Err:Ei,_tlv:{encode:(n,t)=>{const{Err:e}=Tt;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const r=t.length/2,i=he(r);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const s=r>127?he(i.length/2|128):"";return he(n)+s+i+t},decode(n,t){const{Err:e}=Tt;let r=0;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==n)throw new e("tlv.decode: wrong tlv");const i=t[r++],s=!!(i&128);let c=0;if(!s)c=i;else{const o=i&127;if(!o)throw new e("tlv.decode(long): indefinite length not supported");if(o>4)throw new e("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+o);if(l.length!==o)throw new e("tlv.decode: length bytes not complete");if(l[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const d of l)c=c<<8|d;if(r+=o,c<128)throw new e("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+c);if(a.length!==c)throw new e("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+c)}}},_int:{encode(n){const{Err:t}=Tt;if(n<At)throw new t("integer: negative integers are not allowed");let e=he(n);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(n){const{Err:t}=Tt;if(n[0]&128)throw new t("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Ee(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=Tt,i=Z(n,void 0,"signature"),{v:s,l:c}=r.decode(48,i);if(c.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:o}=r.decode(2,s),{v:l,l:d}=r.decode(2,o);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(a),s:e.decode(l)}},hexFromSig(n){const{_tlv:t,_int:e}=Tt,r=t.encode(2,e.encode(n.r)),i=t.encode(2,e.encode(n.s)),s=r+i;return t.encode(48,s)}},At=BigInt(0),Jt=BigInt(1),nr=BigInt(2),pe=BigInt(3),Si=BigInt(4);function Ai(n,t={}){const e=_i("weierstrass",n,t),{Fp:r,Fn:i}=e;let s=e.CURVE;const{h:c,n:a}=s;Ye(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:o}=t;if(o&&(!r.is0(s.a)||typeof o.beta!="bigint"||!Array.isArray(o.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=ir(r,i);function d(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function u(H,v,_){const{x:g,y:A}=v.toAffine(),L=r.toBytes(g);if(be(_,"isCompressed"),_){d();const U=!r.isOdd(A);return Ct(rr(U),L)}else return Ct(Uint8Array.of(4),L,r.toBytes(A))}function h(H){Z(H,void 0,"Point");const{publicKey:v,publicKeyUncompressed:_}=l,g=H.length,A=H[0],L=H.subarray(1);if(g===v&&(A===2||A===3)){const U=r.fromBytes(L);if(!r.isValid(U))throw new Error("bad point: is not on curve, wrong x");const B=b(U);let I;try{I=r.sqrt(B)}catch(Y){const K=Y instanceof Error?": "+Y.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}d();const D=r.isOdd(I);return(A&1)===1!==D&&(I=r.neg(I)),{x:U,y:I}}else if(g===_&&A===4){const U=r.BYTES,B=r.fromBytes(L.subarray(0,U)),I=r.fromBytes(L.subarray(U,U*2));if(!y(B,I))throw new Error("bad point: is not on curve");return{x:B,y:I}}else throw new Error(`bad point: got length ${g}, expected compressed=${v} or uncompressed=${_}`)}const f=t.toBytes||u,w=t.fromBytes||h;function b(H){const v=r.sqr(H),_=r.mul(v,H);return r.add(r.add(_,r.mul(H,s.a)),s.b)}function y(H,v){const _=r.sqr(v),g=b(H);return r.eql(_,g)}if(!y(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const x=r.mul(r.pow(s.a,pe),Si),E=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(x,E)))throw new Error("bad curve params: a or b");function S(H,v,_=!1){if(!r.isValid(v)||_&&r.is0(v))throw new Error(`bad point coordinate ${H}`);return v}function R(H){if(!(H instanceof $))throw new Error("Weierstrass Point expected")}function N(H){if(!o||!o.basises)throw new Error("no endo");return xi(H,o.basises,i.ORDER)}const z=un((H,v)=>{const{X:_,Y:g,Z:A}=H;if(r.eql(A,r.ONE))return{x:_,y:g};const L=H.is0();v==null&&(v=L?r.ONE:r.inv(A));const U=r.mul(_,v),B=r.mul(g,v),I=r.mul(A,v);if(L)return{x:r.ZERO,y:r.ZERO};if(!r.eql(I,r.ONE))throw new Error("invZ was invalid");return{x:U,y:B}}),nt=un(H=>{if(H.is0()){if(t.allowInfinityPoint&&!r.is0(H.Y))return;throw new Error("bad point: ZERO")}const{x:v,y:_}=H.toAffine();if(!r.isValid(v)||!r.isValid(_))throw new Error("bad point: x or y not field elements");if(!y(v,_))throw new Error("bad point: equation left != right");if(!H.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function W(H,v,_,g,A){return _=new $(r.mul(_.X,H),_.Y,_.Z),v=_e(g,v),_=_e(A,_),v.add(_)}class ${static BASE=new $(s.Gx,s.Gy,r.ONE);static ZERO=new $(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=i;X;Y;Z;constructor(v,_,g){this.X=S("x",v),this.Y=S("y",_,!0),this.Z=S("z",g),Object.freeze(this)}static CURVE(){return s}static fromAffine(v){const{x:_,y:g}=v||{};if(!v||!r.isValid(_)||!r.isValid(g))throw new Error("invalid affine point");if(v instanceof $)throw new Error("projective point not allowed");return r.is0(_)&&r.is0(g)?$.ZERO:new $(_,g,r.ONE)}static fromBytes(v){const _=$.fromAffine(w(Z(v,void 0,"point")));return _.assertValidity(),_}static fromHex(v){return $.fromBytes(gt(v))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(v=8,_=!0){return it.createCache(this,v),_||this.multiply(pe),this}assertValidity(){nt(this)}hasEvenY(){const{y:v}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(v)}equals(v){R(v);const{X:_,Y:g,Z:A}=this,{X:L,Y:U,Z:B}=v,I=r.eql(r.mul(_,B),r.mul(L,A)),D=r.eql(r.mul(g,B),r.mul(U,A));return I&&D}negate(){return new $(this.X,r.neg(this.Y),this.Z)}double(){const{a:v,b:_}=s,g=r.mul(_,pe),{X:A,Y:L,Z:U}=this;let B=r.ZERO,I=r.ZERO,D=r.ZERO,q=r.mul(A,A),Y=r.mul(L,L),K=r.mul(U,U),M=r.mul(A,L);return M=r.add(M,M),D=r.mul(A,U),D=r.add(D,D),B=r.mul(v,D),I=r.mul(g,K),I=r.add(B,I),B=r.sub(Y,I),I=r.add(Y,I),I=r.mul(B,I),B=r.mul(M,B),D=r.mul(g,D),K=r.mul(v,K),M=r.sub(q,K),M=r.mul(v,M),M=r.add(M,D),D=r.add(q,q),q=r.add(D,q),q=r.add(q,K),q=r.mul(q,M),I=r.add(I,q),K=r.mul(L,U),K=r.add(K,K),q=r.mul(K,M),B=r.sub(B,q),D=r.mul(K,Y),D=r.add(D,D),D=r.add(D,D),new $(B,I,D)}add(v){R(v);const{X:_,Y:g,Z:A}=this,{X:L,Y:U,Z:B}=v;let I=r.ZERO,D=r.ZERO,q=r.ZERO;const Y=s.a,K=r.mul(s.b,pe);let M=r.mul(_,L),P=r.mul(g,U),X=r.mul(A,B),pt=r.add(_,g),F=r.add(L,U);pt=r.mul(pt,F),F=r.add(M,P),pt=r.sub(pt,F),F=r.add(_,A);let J=r.add(L,B);return F=r.mul(F,J),J=r.add(M,X),F=r.sub(F,J),J=r.add(g,A),I=r.add(U,B),J=r.mul(J,I),I=r.add(P,X),J=r.sub(J,I),q=r.mul(Y,F),I=r.mul(K,X),q=r.add(I,q),I=r.sub(P,q),q=r.add(P,q),D=r.mul(I,q),P=r.add(M,M),P=r.add(P,M),X=r.mul(Y,X),F=r.mul(K,F),P=r.add(P,X),X=r.sub(M,X),X=r.mul(Y,X),F=r.add(F,X),M=r.mul(P,F),D=r.add(D,M),M=r.mul(J,F),I=r.mul(pt,I),I=r.sub(I,M),M=r.mul(pt,P),q=r.mul(J,q),q=r.add(q,M),new $(I,D,q)}subtract(v){return this.add(v.negate())}is0(){return this.equals($.ZERO)}multiply(v){const{endo:_}=t;if(!i.isValidNot0(v))throw new Error("invalid scalar: out of range");let g,A;const L=U=>it.cached(this,U,B=>pn($,B));if(_){const{k1neg:U,k1:B,k2neg:I,k2:D}=N(v),{p:q,f:Y}=L(B),{p:K,f:M}=L(D);A=Y.add(M),g=W(_.beta,q,K,U,I)}else{const{p:U,f:B}=L(v);g=U,A=B}return pn($,[g,A])[0]}multiplyUnsafe(v){const{endo:_}=t,g=this;if(!i.isValid(v))throw new Error("invalid scalar: out of range");if(v===At||g.is0())return $.ZERO;if(v===Jt)return g;if(it.hasCache(this))return this.multiply(v);if(_){const{k1neg:A,k1:L,k2neg:U,k2:B}=N(v),{p1:I,p2:D}=bi($,g,L,B);return W(_.beta,I,D,A,U)}else return it.unsafe(g,v)}toAffine(v){return z(this,v)}isTorsionFree(){const{isTorsionFree:v}=t;return c===Jt?!0:v?v($,this):it.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:v}=t;return c===Jt?this:v?v($,this):this.multiplyUnsafe(c)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}toBytes(v=!0){return be(v,"isCompressed"),this.assertValidity(),f($,this,v)}toHex(v=!0){return yt(this.toBytes(v))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const at=i.BITS,it=new gi($,t.endo?Math.ceil(at/2):at);return $.BASE.precompute(8),$}function rr(n){return Uint8Array.of(n?2:3)}function ir(n,t){return{secretKey:t.BYTES,publicKey:1+n.BYTES,publicKeyUncompressed:1+2*n.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Ii(n,t={}){const{Fn:e}=n,r=t.randomBytes||Un,i=Object.assign(ir(n.Fp,e),{seed:Xn(e.ORDER)});function s(f){try{const w=e.fromBytes(f);return e.isValidNot0(w)}catch{return!1}}function c(f,w){const{publicKey:b,publicKeyUncompressed:y}=i;try{const x=f.length;return w===!0&&x!==b||w===!1&&x!==y?!1:!!n.fromBytes(f)}catch{return!1}}function a(f=r(i.seed)){return yi(Z(f,i.seed,"seed"),e.ORDER)}function o(f,w=!0){return n.BASE.multiply(e.fromBytes(f)).toBytes(w)}function l(f){const{secretKey:w,publicKey:b,publicKeyUncompressed:y}=i;if(!Ke(f)||"_lengths"in e&&e._lengths||w===b)return;const x=Z(f,void 0,"key").length;return x===b||x===y}function d(f,w,b=!0){if(l(f)===!0)throw new Error("first arg must be private key");if(l(w)===!1)throw new Error("second arg must be public key");const y=e.fromBytes(f);return n.fromBytes(w).multiply(y).toBytes(b)}const u={isValidSecretKey:s,isValidPublicKey:c,randomSecretKey:a},h=vi(a,o);return Object.freeze({getPublicKey:o,getSharedSecret:d,keygen:h,Point:n,utils:u,lengths:i})}function Li(n,t,e={}){Ln(t),Ye(e,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),e=Object.assign({},e);const r=e.randomBytes||Un,i=e.hmac||((_,g)=>er(t,_,g)),{Fp:s,Fn:c}=n,{ORDER:a,BITS:o}=c,{keygen:l,getPublicKey:d,getSharedSecret:u,utils:h,lengths:f}=Ii(n,e),w={prehash:!0,lowS:typeof e.lowS=="boolean"?e.lowS:!0,format:"compact",extraEntropy:!1},b=a*nr<s.ORDER;function y(_){const g=a>>Jt;return _>g}function x(_,g){if(!c.isValidNot0(g))throw new Error(`invalid signature ${_}: out of range 1..Point.Fn.ORDER`);return g}function E(){if(b)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function S(_,g){Ne(g);const A=f.signature,L=g==="compact"?A:g==="recovered"?A+1:void 0;return Z(_,L)}class R{r;s;recovery;constructor(g,A,L){if(this.r=x("r",g),this.s=x("s",A),L!=null){if(E(),![0,1,2,3].includes(L))throw new Error("invalid recovery id");this.recovery=L}Object.freeze(this)}static fromBytes(g,A=w.format){S(g,A);let L;if(A==="der"){const{r:D,s:q}=Tt.toSig(Z(g));return new R(D,q)}A==="recovered"&&(L=g[0],A="compact",g=g.subarray(1));const U=f.signature/2,B=g.subarray(0,U),I=g.subarray(U,U*2);return new R(c.fromBytes(B),c.fromBytes(I),L)}static fromHex(g,A){return this.fromBytes(gt(g),A)}assertRecovery(){const{recovery:g}=this;if(g==null)throw new Error("invalid recovery id: must be present");return g}addRecoveryBit(g){return new R(this.r,this.s,g)}recoverPublicKey(g){const{r:A,s:L}=this,U=this.assertRecovery(),B=U===2||U===3?A+a:A;if(!s.isValid(B))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const I=s.toBytes(B),D=n.fromBytes(Ct(rr((U&1)===0),I)),q=c.inv(B),Y=z(Z(g,void 0,"msgHash")),K=c.create(-Y*q),M=c.create(L*q),P=n.BASE.multiplyUnsafe(K).add(D.multiplyUnsafe(M));if(P.is0())throw new Error("invalid recovery: point at infinify");return P.assertValidity(),P}hasHighS(){return y(this.s)}toBytes(g=w.format){if(Ne(g),g==="der")return gt(Tt.hexFromSig(this));const{r:A,s:L}=this,U=c.toBytes(A),B=c.toBytes(L);return g==="recovered"?(E(),Ct(Uint8Array.of(this.assertRecovery()),U,B)):Ct(U,B)}toHex(g){return yt(this.toBytes(g))}}const N=e.bits2int||function(g){if(g.length>8192)throw new Error("input is too large");const A=Ee(g),L=g.length*8-o;return L>0?A>>BigInt(L):A},z=e.bits2int_modN||function(g){return c.create(N(g))},nt=We(o);function W(_){return ii("num < 2^"+o,_,At,nt),c.toBytes(_)}function $(_,g){return Z(_,void 0,"message"),g?Z(t(_),void 0,"prehashed message"):_}function at(_,g,A){const{lowS:L,prehash:U,extraEntropy:B}=ke(A,w);_=$(_,U);const I=z(_),D=c.fromBytes(g);if(!c.isValidNot0(D))throw new Error("invalid private key");const q=[W(D),W(I)];if(B!=null&&B!==!1){const P=B===!0?r(f.secretKey):B;q.push(Z(P,void 0,"extraEntropy"))}const Y=Ct(...q),K=I;function M(P){const X=N(P);if(!c.isValidNot0(X))return;const pt=c.inv(X),F=n.BASE.multiply(X).toAffine(),J=c.create(F.x);if(J===At)return;const oe=c.create(pt*c.create(K+J*D));if(oe===At)return;let nn=(F.x===J?0:2)|Number(F.y&Jt),rn=oe;return L&&y(oe)&&(rn=c.neg(oe),nn^=1),new R(J,rn,b?void 0:nn)}return{seed:Y,k2sig:M}}function it(_,g,A={}){const{seed:L,k2sig:U}=at(_,g,A);return oi(t.outputLen,c.BYTES,i)(L,U).toBytes(A.format)}function H(_,g,A,L={}){const{lowS:U,prehash:B,format:I}=ke(L,w);if(A=Z(A,void 0,"publicKey"),g=$(g,B),!Ke(_)){const D=_ instanceof R?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+D)}S(_,I);try{const D=R.fromBytes(_,I),q=n.fromBytes(A);if(U&&D.hasHighS())return!1;const{r:Y,s:K}=D,M=z(g),P=c.inv(K),X=c.create(M*P),pt=c.create(Y*P),F=n.BASE.multiplyUnsafe(X).add(q.multiplyUnsafe(pt));return F.is0()?!1:c.create(F.x)===Y}catch{return!1}}function v(_,g,A={}){const{prehash:L}=ke(A,w);return g=$(g,L),R.fromBytes(_,"recovered").recoverPublicKey(g).toBytes()}return Object.freeze({keygen:l,getPublicKey:d,getSharedSecret:u,utils:h,lengths:f,Point:n,sign:it,verify:H,recoverPublicKey:v,Signature:R,hash:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xe={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Bi={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},bn=BigInt(2);function Ui(n){const t=Xe.p,e=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),c=BigInt(23),a=BigInt(44),o=BigInt(88),l=n*n*n%t,d=l*l*n%t,u=st(d,e,t)*d%t,h=st(u,e,t)*d%t,f=st(h,bn,t)*l%t,w=st(f,i,t)*f%t,b=st(w,s,t)*w%t,y=st(b,a,t)*b%t,x=st(y,o,t)*y%t,E=st(x,a,t)*b%t,S=st(E,e,t)*d%t,R=st(S,c,t)*w%t,N=st(R,r,t)*l%t,z=st(N,bn,t);if(!qe.eql(qe.sqr(z),n))throw new Error("Cannot find square root");return z}const qe=Se(Xe.p,{sqrt:Ui}),ki=Ai(Xe,{Fp:qe,endo:Bi}),St=Li(ki,Ft);class Ae{constructor(t,e,r){this.data=t,this.recovery=e,this.compressed=r??!0}static from(t){if(typeof t=="string"){const e=gt(t);let r=parseInt(yt(e.subarray(0,1)),16)-31,i=!0;r<0&&(i=!1,r=r+4);const s=e.subarray(1);return new Ae(s,r,i)}else throw new Error("Expected string for data")}toBuffer(){const t=new Uint8Array(65).fill(0);return this.compressed?t[0]=this.recovery+31&255:t[0]=this.recovery+27&255,t.set(this.data,1),t}customToString(){return yt(this.toBuffer())}getPublicKey(t){if(t instanceof Uint8Array&&t.length!==32||typeof t=="string"&&t.length!==64)throw new Error("Expected a valid sha256 hash as message");typeof t=="string"&&(t=gt(t));const e=St.Signature.fromBytes(this.data,"compact"),r=new St.Signature(e.r,e.s,this.recovery);return new ot(r.recoverPublicKey(t).toBytes())}}const $i=ut.address_prefix;class ot{constructor(t,e){this.key=t,this.prefix=e??$i}static fromString(t){const{key:e,prefix:r}=Ci(t);return new ot(e,r)}static from(t){return t instanceof ot?t:ot.fromString(t)}verify(t,e){return typeof e=="string"&&(e=Ae.from(e)),St.verify(e.data,t,this.key,{prehash:!1,format:"compact"})}toString(){return Ti(this.key,this.prefix)}toJSON(){return this.toString()}inspect(){return`PublicKey: ${this.toString()}`}}const Ti=(n,t)=>{const e=qr(n);return t+ee.encode(new Uint8Array([...n,...e.subarray(0,4)]))},Ci=n=>{const t=n.slice(0,3);n=n.slice(3);const e=ee.decode(n);return{key:e.subarray(0,e.length-4),prefix:t}};class Yt{constructor(t,e){this.amount=t,this.symbol=e==="HIVE"?"STEEM":e==="HBD"?"SBD":e}static fromString(t,e=null){const[r,i]=t.split(" ");if(["STEEM","VESTS","SBD","TESTS","TBD","HIVE","HBD"].indexOf(i)===-1)throw new Error(`Invalid asset symbol: ${i}`);if(e&&i!==e)throw new Error(`Invalid asset, expected symbol: ${e} got: ${i}`);const s=Number.parseFloat(r);if(!Number.isFinite(s))throw new Error(`Invalid asset amount: ${r}`);return new Yt(s,i)}static from(t,e){if(t instanceof Yt){if(e&&t.symbol!==e)throw new Error(`Invalid asset, expected symbol: ${e} got: ${t.symbol}`);return t}else{if(typeof t=="number"&&Number.isFinite(t))return new Yt(t,e||"STEEM");if(typeof t=="string")return Yt.fromString(t,e);throw new Error(`Invalid asset '${String(t)}'`)}}getPrecision(){switch(this.symbol){case"TESTS":case"TBD":case"STEEM":case"SBD":case"HBD":case"HIVE":return 3;case"VESTS":return 6;default:return 3}}toString(){return`${this.amount.toFixed(this.getPrecision())} ${this.symbol}`}toJSON(){return this.toString()}}class Gt{static from(t){return t instanceof Gt?t:t instanceof Uint8Array?new Gt(t):typeof t=="string"?new Gt(gt(t)):new Gt(new Uint8Array(t))}constructor(t){this.buffer=t}toString(){return yt(this.buffer)}toJSON(){return this.toString()}}const T={vote:0,comment:1,transfer:2,transfer_to_vesting:3,withdraw_vesting:4,limit_order_create:5,limit_order_cancel:6,feed_publish:7,convert:8,account_create:9,account_update:10,witness_update:11,account_witness_vote:12,account_witness_proxy:13,custom:15,delete_comment:17,custom_json:18,comment_options:19,set_withdraw_vesting_route:20,limit_order_create2:21,claim_account:22,create_claimed_account:23,request_account_recovery:24,recover_account:25,change_recovery_account:26,escrow_transfer:27,escrow_dispute:28,escrow_release:29,escrow_approve:31,transfer_to_savings:32,transfer_from_savings:33,cancel_transfer_from_savings:34,decline_voting_rights:36,reset_account:37,set_reset_account:38,claim_reward_balance:39,delegate_vesting_shares:40,account_create_with_delegation:41,witness_set_properties:42,account_update2:43,create_proposal:44,update_proposal_votes:45,remove_proposal:46,update_proposal:47,collateralized_convert:48,recurrent_transfer:49},ct=()=>{throw new Error("Void can not be serialized")},p=(n,t)=>{n.writeVString(t)},Di=(n,t)=>{n.writeInt16(t)},sr=(n,t)=>{n.writeInt64(t)},_n=(n,t)=>{n.writeUint8(t)},ft=(n,t)=>{n.writeUint16(t)},tt=(n,t)=>{n.writeUint32(t)},or=(n,t)=>{n.writeUint64(t)},It=(n,t)=>{n.writeByte(t?1:0)},cr=n=>(t,e)=>{const[r,i]=e;t.writeVarint32(r),n[r](t,i)},V=(n,t)=>{const e=Yt.from(t),r=e.getPrecision();n.writeInt64(Math.round(e.amount*Math.pow(10,r))),n.writeUint8(r);for(let i=0;i<7;i++)n.writeUint8(e.symbol.charCodeAt(i)||0)},qt=(n,t)=>{n.writeUint32(Math.floor(new Date(t+"Z").getTime()/1e3))},bt=(n,t)=>{t===null||typeof t=="string"&&t.slice(-39)==="1111111111111111111111111111111114T1Anm"?n.append(new Uint8Array(33).fill(0)):n.append(ot.from(t).key)},ar=(n=null)=>(t,e)=>{e=Gt.from(e);const r=e.buffer.length;if(n){if(r!==n)throw new Error(`Unable to serialize binary. Expected ${n} bytes, got ${r}`)}else t.write
    
  • Varint32(r);t.append(e.buffer)},lr=ar(),He=(n,t)=>(e,r)=>{e.writeVarint32(r.length);for(const[i,s]of r)n(e,i),t(e,s)},j=n=>(t,e)=>{t.writeVarint32(e.length);for(const r of e)n(t,r)},ht=n=>(t,e)=>{for(const[r,i]of n)try{i(t,e[r])}catch(s){throw s.message=`${r}: ${s.message}`,s}},Vt=n=>(t,e)=>{e!==void 0?(t.writeByte(1),n(t,e)):t.writeByte(0)},G=ht([["weight_threshold",tt],["account_auths",He(p,ft)],["key_auths",He(bt,ft)]]),Ri=ht([["account",p],["weight",ft]]),Je=ht([["base",V],["quote",V]]),Oi=ht([["account_creation_fee",V],["maximum_block_size",tt],["hbd_interest_rate",ft]]),C=(n,t)=>{const e=ht(t);return(r,i)=>{r.writeVarint32(n),e(r,i)}},k={};k.account_create=C(T.account_create,[["fee",V],["creator",p],["new_account_name",p],["owner",G],["active",G],["posting",G],["memo_key",bt],["json_metadata",p]]);k.account_create_with_delegation=C(T.account_create_with_delegation,[["fee",V],["delegation",V],["creator",p],["new_account_name",p],["owner",G],["active",G],["posting",G],["memo_key",bt],["json_metadata",p],["extensions",j(ct)]]);k.account_update=C(T.account_update,[["account",p],["owner",Vt(G)],["active",Vt(G)],["posting",Vt(G)],["memo_key",bt],["json_metadata",p]]);k.account_witness_proxy=C(T.account_witness_proxy,[["account",p],["proxy",p]]);k.account_witness_vote=C(T.account_witness_vote,[["account",p],["witness",p],["approve",It]]);k.cancel_transfer_from_savings=C(T.cancel_transfer_from_savings,[["from",p],["request_id",tt]]);k.change_recovery_account=C(T.change_recovery_account,[["account_to_recover",p],["new_recovery_account",p],["extensions",j(ct)]]);k.claim_account=C(T.claim_account,[["creator",p],["fee",V],["extensions",j(ct)]]);k.claim_reward_balance=C(T.claim_reward_balance,[["account",p],["reward_hive",V],["reward_hbd",V],["reward_vests",V]]);k.comment=C(T.comment,[["parent_author",p],["parent_permlink",p],["author",p],["permlink",p],["title",p],["body",p],["json_metadata",p]]);k.comment_options=C(T.comment_options,[["author",p],["permlink",p],["max_accepted_payout",V],["percent_hbd",ft],["allow_votes",It],["allow_curation_rewards",It],["extensions",j(cr([ht([["beneficiaries",j(Ri)]])]))]]);k.convert=C(T.convert,[["owner",p],["requestid",tt],["amount",V]]);k.create_claimed_account=C(T.create_claimed_account,[["creator",p],["new_account_name",p],["owner",G],["active",G],["posting",G],["memo_key",bt],["json_metadata",p],["extensions",j(ct)]]);k.custom=C(T.custom,[["required_auths",j(p)],["id",ft],["data",lr]]);k.custom_json=C(T.custom_json,[["required_auths",j(p)],["required_posting_auths",j(p)],["id",p],["json",p]]);k.decline_voting_rights=C(T.decline_voting_rights,[["account",p],["decline",It]]);k.delegate_vesting_shares=C(T.delegate_vesting_shares,[["delegator",p],["delegatee",p],["vesting_shares",V]]);k.delete_comment=C(T.delete_comment,[["author",p],["permlink",p]]);k.escrow_approve=C(T.escrow_approve,[["from",p],["to",p],["agent",p],["who",p],["escrow_id",tt],["approve",It]]);k.escrow_dispute=C(T.escrow_dispute,[["from",p],["to",p],["agent",p],["who",p],["escrow_id",tt]]);k.escrow_release=C(T.escrow_release,[["from",p],["to",p],["agent",p],["who",p],["receiver",p],["escrow_id",tt],["hbd_amount",V],["hive_amount",V]]);k.escrow_transfer=C(T.escrow_transfer,[["from",p],["to",p],["hbd_amount",V],["hive_amount",V],["escrow_id",tt],["agent",p],["fee",V],["json_meta",p],["ratification_deadline",qt],["escrow_expiration",qt]]);k.feed_publish=C(T.feed_publish,[["publisher",p],["exchange_rate",Je]]);k.limit_order_cancel=C(T.limit_order_cancel,[["owner",p],["orderid",tt]]);k.limit_order_create=C(T.limit_order_create,[["owner",p],["orderid",tt],["amount_to_sell",V],["min_to_receive",V],["fill_or_kill",It],["expiration",qt]]);k.limit_order_create2=C(T.limit_order_create2,[["owner",p],["orderid",tt],["amount_to_sell",V],["exchange_rate",Je],["fill_or_kill",It],["expiration",qt]]);k.recover_account=C(T.recover_account,[["account_to_recover",p],["new_owner_authority",G],["recent_owner_authority",G],["extensions",j(ct)]]);k.request_account_recovery=C(T.request_account_recovery,[["recovery_account",p],["account_to_recover",p],["new_owner_authority",G],["extensions",j(ct)]]);k.reset_account=C(T.reset_account,[["reset_account",p],["account_to_reset",p],["new_owner_authority",G]]);k.set_reset_account=C(T.set_reset_account,[["account",p],["current_reset_account",p],["reset_account",p]]);k.set_withdraw_vesting_route=C(T.set_withdraw_vesting_route,[["from_account",p],["to_account",p],["percent",ft],["auto_vest",It]]);k.transfer=C(T.transfer,[["from",p],["to",p],["amount",V],["memo",p]]);k.transfer_from_savings=C(T.transfer_from_savings,[["from",p],["request_id",tt],["to",p],["amount",V],["memo",p]]);k.transfer_to_savings=C(T.transfer_to_savings,[["from",p],["to",p],["amount",V],["memo",p]]);k.transfer_to_vesting=C(T.transfer_to_vesting,[["from",p],["to",p],["amount",V]]);k.vote=C(T.vote,[["voter",p],["author",p],["permlink",p],["weight",Di]]);k.withdraw_vesting=C(T.withdraw_vesting,[["account",p],["vesting_shares",V]]);k.witness_update=C(T.witness_update,[["owner",p],["url",p],["block_signing_key",bt],["props",Oi],["fee",V]]);k.witness_set_properties=C(T.witness_set_properties,[["owner",p],["props",He(p,lr)],["extensions",j(ct)]]);k.account_update2=C(T.account_update2,[["account",p],["owner",Vt(G)],["active",Vt(G)],["posting",Vt(G)],["memo_key",Vt(bt)],["json_metadata",p],["posting_json_metadata",p],["extensions",j(ct)]]);k.create_proposal=C(T.create_proposal,[["creator",p],["receiver",p],["start_date",qt],["end_date",qt],["daily_pay",V],["subject",p],["permlink",p],["extensions",j(ct)]]);k.update_proposal_votes=C(T.update_proposal_votes,[["voter",p],["proposal_ids",j(sr)],["approve",It],["extensions",j(ct)]]);k.remove_proposal=C(T.remove_proposal,[["proposal_owner",p],["proposal_ids",j(sr)],["extensions",j(ct)]]);const Ni=ht([["end_date",qt]]);k.update_proposal=C(T.update_proposal,[["proposal_id",or],["creator",p],["daily_pay",V],["subject",p],["permlink",p],["extensions",j(cr([ct,Ni]))]]);k.collateralized_convert=C(T.collateralized_convert,[["owner",p],["requestid",tt],["amount",V]]);k.recurrent_transfer=C(T.recurrent_transfer,[["from",p],["to",p],["amount",V],["memo",p],["recurrence",ft],["executions",ft],["extensions",j(ht([["type",_n],["value",ht([["pair_id",_n]])]]))]]);const qi=(n,t)=>{const e=k[t[0]];if(!e)throw new Error(`No serializer for operation: ${t[0]}`);try{e(n,t[1])}catch(r){throw r.message=`${t[0]}: ${r.message}`,r}},Hi=ht([["ref_block_num",ft],["ref_block_prefix",tt],["expiration",qt],["operations",j(qi)],["extensions",j(p)]]),Mi=ht([["from",bt],["to",bt],["nonce",or],["check",tt],["encrypted",ar()]]),dr={Asset:V,Memo:Mi,Price:Je,PublicKey:bt,String:p,Transaction:Hi,UInt16:ft,UInt32:tt};let Me=0,vn=0;class ve extends Error{constructor(t){super(t.message),this.name="RPCError",this.stack=void 0,this.code=t.code,"data"in t&&(this.data=t.data)}}const ur=async(n,t,e,r=ut.timeout,i=!1)=>{const s=Math.floor(Math.random()*1e8),c={jsonrpc:"2.0",method:t,params:e,id:s};try{const o=await(await fetch(n,{method:"POST",body:JSON.stringify(c),headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(r)})).json();if(!o||typeof o.id>"u"||o.id!==s||o.jsonrpc!=="2.0")throw new Error("JSONRPC id missmatch");if("result"in o)return o.result;if("error"in o){const l=o.error;throw"message"in l&&"code"in l?new ve(l):o.error}throw o}catch(a){if(a instanceof ve)throw a;if(i)return ur(n,t,e,r,!1);throw a}},ye=async(n,t=[],e=ut.timeout,r=ut.retry)=>{if(!Array.isArray(ut.nodes))throw new Error("config.nodes is not an array");const i=ut.nodes[Me];try{return await ur(i,n,t,e)}catch(s){if(s instanceof ve||(vn++,vn>r))throw s;return Vi(),ye(n,t,e,r)}},Vi=(n=Me+1)=>{n>ut.nodes.length-1&&(n=0),Me=n},xn=n=>new Promise(t=>setTimeout(t,n)),zi=gt(ut.chain_id);class Qe{constructor(t){this.expiration=6e4,this.createTransaction=async e=>{const r=await ye("condenser_api.get_dynamic_global_properties",[]),i=gt(r.head_block_id),s=Number(new Uint32Array(i.buffer,i.byteOffset+4,1)[0]),c=new Date(Date.now()+e).toISOString().slice(0,-5);this.transaction={expiration:c,extensions:[],operations:[],ref_block_num:r.head_block_number&65535,ref_block_prefix:s,signatures:[]}},t?.transaction&&(t.transaction instanceof Qe?(this.transaction=t.transaction.transaction,this.expiration=t.transaction.expiration):this.transaction=t.transaction,this.txId=this.digest().txId),t?.expiration&&(this.expiration=t.expiration)}async addOperation(t,e){this.transaction||await this.createTransaction(this.expiration),this.transaction.operations.push([t,e])}sign(t){if(!this.transaction)throw new Error("First create a transaction by .addOperation()");if(this.transaction){const{digest:e,txId:r}=this.digest();Array.isArray(t)||(t=[t]);for(const i of t){const s=i.sign(e);this.transaction.signatures.push(s.customToString())}return this.txId=r,this.transaction}else throw new Error("No transaction to sign")}async broadcast(t=!1){if(!this.transaction)throw new Error("Attempted to broadcast an empty transaction. Add operations by .addOperation()");if(this.transaction.signatures.length===0)throw new Error("Attempted to broadcast a transaction with no signatures. Sign using .sign(keys)");try{await ye("condenser_api.broadcast_transaction",[this.transaction])}catch(i){if(!(i instanceof ve&&i.message.includes("Duplicate transaction check failed")))throw i}if(this.txId||(this.txId=this.digest().txId),!t)return{tx_id:this.txId,status:"unknown"};await xn(1e3);let e=await this.checkStatus(),r=1;for(;e?.status!=="within_irreversible_block"&&e?.status!=="expired_irreversible"&&e?.status!=="too_old";)await xn(1e3+r*300),e=await this.checkStatus(),r++;return{tx_id:this.txId,status:e.status}}digest(){if(!this.transaction)throw new Error("First create a transaction by .addOperation()");const t=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN),e={...this.transaction};try{dr.Transaction(t,e)}catch(c){throw new Error("Unable to serialize transaction: "+c)}t.flip();const r=new Uint8Array(t.toBuffer()),i=yt(Ft(r)).slice(0,40);return{digest:Ft(new Uint8Array([...zi,...r])),txId:i}}addSignature(t){if(!this.transaction)throw new Error("First create a transaction by .create(operations)");if(typeof t!="string")throw new Error("Signature must be string");if(t.length!==130)throw new Error("Signature must be 130 characters long");return this.transaction.signatures.push(t),this.transaction}async checkStatus(){return this.txId||(this.txId=this.digest().txId),ye("transaction_status_api.find_transaction",{transaction_id:this.txId,expiration:this.transaction?.expiration})}}const fr=new Uint8Array([128]);class xt{constructor(t){this.key=t;try{St.getPublicKey(t)}catch{throw new Error("invalid private key")}}static from(t){return typeof t=="string"?xt.fromString(t):new xt(t)}static fromString(t){return new xt(Pi(t).subarray(1))}static fromSeed(t){return typeof t=="string"&&(/^[0-9a-fA-F]+$/.test(t)?t=gt(t):t=new TextEncoder().encode(t)),new xt(Ft(t))}static fromLogin(t,e,r="active"){const i=t+r+e;return xt.fromSeed(i)}sign(t){const e=St.sign(t,this.key,{extraEntropy:!0,format:"recovered",prehash:!1}),r=parseInt(yt(e.subarray(0,1)),16);return Ae.from((r+31).toString(16)+yt(e.subarray(1)))}createPublic(t){return new ot(St.getPublicKey(this.key),t)}toString(){return Ki(new Uint8Array([...fr,...this.key]))}inspect(){const t=this.toString();return`PrivateKey: ${t.slice(0,6)}...${t.slice(-6)}`}getSharedSecret(t){const e=St.getSharedSecret(this.key,t.key);return Nn(e.subarray(1))}static randomKey(){return new xt(St.keygen().secretKey)}}const hr=n=>Ft(Ft(n)),Ki=n=>{const t=hr(n);return ee.encode(new Uint8Array([...n,...t.slice(0,4)]))},Pi=n=>{const t=ee.decode(n);if(!En(t.slice(0,1),fr))throw new Error("Private key network id mismatch");const e=t.slice(-4),r=t.slice(0,-4),i=hr(r).slice(0,4);if(!En(e,i))throw new Error("Private key checksum mismatch");return r},En=(n,t)=>{if(n===t)return!0;if(n.byteLength!==t.byteLength)return!1;const e=n.byteLength;let r=0;for(;r<e&&n[r]===t[r];)r++;return r===e};/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function Fi(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Et(n,t,e=""){const r=Fi(n),i=n?.length,s=t!==void 0;if(!r||s&&i!==t){const c=e&&`"${e}" `,a=s?` of length ${t}`:"",o=r?`length=${i}`:`type=${typeof n}`;throw new Error(c+"expected Uint8Array"+a+", got "+o)}return n}function Dt(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function re(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}const ji=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Zi(n,t){return n.buffer===t.buffer&&n.byteOffset<t.byteOffset+t.byteLength&&t.byteOffset<n.byteOffset+n.byteLength}function pr(n,t){if(Zi(n,t)&&n.byteOffset<t.byteOffset)throw new Error("complex overlap of input and output is not supported")}const Wi=(n,t)=>{function e(r,...i){if(Et(r,void 0,"key"),!ji)throw new Error("Non little-endian hardware is not yet supported");if(n.nonceLength!==void 0){const d=i[0];Et(d,n.varSizeNonce?void 0:n.nonceLength,"nonce")}const s=n.tagLength;s&&i[1]!==void 0&&Et(i[1],void 0,"AAD");const c=t(r,...i),a=(d,u)=>{if(u!==void 0){if(d!==2)throw new Error("cipher output not supported");Et(u,void 0,"output")}};let o=!1;return{encrypt(d,u){if(o)throw new Error("cannot encrypt() twice with same key + nonce");return o=!0,Et(d),a(c.encrypt.length,u),c.encrypt(d,u)},decrypt(d,u){if(Et(d),s&&d.length<s)throw new Error('"ciphertext" expected length bigger than tagLength='+s);return a(c.decrypt.length,u),c.decrypt(d,u)}}}return Object.assign(e,n),e};function mr(n,t,e=!0){if(t===void 0)return new Uint8Array(n);if(t.length!==n)throw new Error('"output" expected Uint8Array of length '+n+", got: "+t.length);if(e&&!Qt(t))throw new Error("invalid output, must be aligned");return t}function Qt(n){return n.byteOffset%4===0}function ne(n){return Uint8Array.from(n)}const Ot=16,Yi=283;function Gi(n){if(![16,24,32].includes(n.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+n.length)}function tn(n){return n<<1^Yi&-(n>>7)}function Xt(n,t){let e=0;for(;t>0;t>>=1)e^=n&-(t&1),n=tn(n);return e}const Ve=(()=>{const n=new Uint8Array(256);for(let e=0,r=1;e<256;e++,r^=tn(r))n[e]=r;const t=new Uint8Array(256);t[0]=99;for(let e=0;e<255;e++){let r=n[255-e];r|=r<<8,t[n[e]]=(r^r>>4^r>>5^r>>6^r>>7^99)&255}return re(n),t})(),Xi=Ve.map((n,t)=>Ve.indexOf(t)),Ji=n=>n<<24|n>>>8,$e=n=>n<<8|n>>>24;function wr(n,t){if(n.length!==256)throw new Error("Wrong sbox length");const e=new Uint32Array(256).map((l,d)=>t(n[d])),r=e.map($e),i=r.map($e),s=i.map($e),c=new Uint32Array(256*256),a=new Uint32Array(256*256),o=new Uint16Array(256*256);for(let l=0;l<256;l++)for(let d=0;d<256;d++){const u=l*256+d;c[u]=e[l]^r[d],a[u]=i[l]^s[d],o[u]=n[l]<<8|n[d]}return{sbox:n,sbox2:o,T0:e,T1:r,T2:i,T3:s,T01:c,T23:a}}const en=wr(Ve,n=>Xt(n,3)<<24|n<<16|n<<8|Xt(n,2)),yr=wr(Xi,n=>Xt(n,11)<<24|Xt(n,13)<<16|Xt(n,9)<<8|Xt(n,14)),Qi=(()=>{const n=new Uint8Array(16);for(let t=0,e=1;t<16;t++,e=tn(e))n[t]=e;return n})();function gr(n){Et(n);const t=n.length;Gi(n);const{sbox2:e}=en,r=[];Qt(n)||r.push(n=ne(n));const i=Dt(n),s=i.length,c=o=>wt(e,o,o,o,o),a=new Uint32Array(t+28);a.set(i);for(let o=s;o<a.length;o++){let l=a[o-1];o%s===0?l=c(Ji(l))^Qi[o/s-1]:s>6&&o%s===4&&(l=c(l)),a[o]=a[o-s]^l}return re(...r),a}function ts(n){const t=gr(n),e=t.slice(),r=t.length,{sbox2:i}=en,{T0:s,T1:c,T2:a,T3:o}=yr;for(let l=0;l<r;l+=4)for(let d=0;d<4;d++)e[l+d]=t[r-l-4+d];re(t);for(let l=4;l<r-4;l++){const d=e[l],u=wt(i,d,d,d,d);e[l]=s[u&255]^c[u>>>8&255]^a[u>>>16&255]^o[u>>>24]}return e}function Rt(n,t,e,r,i,s){return n[e<<8&65280|r>>>8&255]^t[i>>>8&65280|s>>>24&255]}function wt(n,t,e,r,i){return n[t&255|e&65280]|n[r>>>16&255|i>>>16&65280]<<16}function Sn(n,t,e,r,i){const{sbox2:s,T01:c,T23:a}=en;let o=0;t^=n[o++],e^=n[o++],r^=n[o++],i^=n[o++];const l=n.length/4-2;for(let w=0;w<l;w++){const b=n[o++]^Rt(c,a,t,e,r,i),y=n[o++]^Rt(c,a,e,r,i,t),x=n[o++]^Rt(c,a,r,i,t,e),E=n[o++]^Rt(c,a,i,t,e,r);t=b,e=y,r=x,i=E}const d=n[o++]^wt(s,t,e,r,i),u=n[o++]^wt(s,e,r,i,t),h=n[o++]^wt(s,r,i,t,e),f=n[o++]^wt(s,i,t,e,r);return{s0:d,s1:u,s2:h,s3:f}}function es(n,t,e,r,i){const{sbox2:s,T01:c,T23:a}=yr;let o=0;t^=n[o++],e^=n[o++],r^=n[o++],i^=n[o++];const l=n.length/4-2;for(let w=0;w<l;w++){const b=n[o++]^Rt(c,a,t,i,r,e),y=n[o++]^Rt(c,a,e,t,i,r),x=n[o++]^Rt(c,a,r,e,t,i),E=n[o++]^Rt(c,a,i,r,e,t);t=b,e=y,r=x,i=E}const d=n[o++]^wt(s,t,i,r,e),u=n[o++]^wt(s,e,t,i,r),h=n[o++]^wt(s,r,e,t,i),f=n[o++]^wt(s,i,r,e,t);return{s0:d,s1:u,s2:h,s3:f}}function ns(n){if(Et(n),n.length%Ot!==0)throw new Error("aes-(cbc/ecb).decrypt ciphertext should consist of blocks with size "+Ot)}function rs(n,t,e){Et(n);let r=n.length;const i=r%Ot;if(!t&&i!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");Qt(n)||(n=ne(n));const s=Dt(n);if(t){let a=Ot-i;a||(a=Ot),r=r+a}e=mr(r,e),pr(n,e);const c=Dt(e);return{b:s,o:c,out:e}}function is(n,t){if(!t)return n;const e=n.length;if(!e)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=n[e-1];if(r<=0||r>16)throw new Error("aes/pcks5: wrong padding");const i=n.subarray(0,-r);for(let s=0;s<r;s++)if(n[e-s-1]!==r)throw new Error("aes/pcks5: wrong padding");return i}function ss(n){const t=new Uint8Array(16),e=Dt(t);t.set(n);const r=Ot-n.length;for(let i=Ot-r;i<Ot;i++)t[i]=r;return e}const br=Wi({blockSize:16,nonceLength:16},function(t,e,r={}){const i=!r.disablePadding;return{encrypt(s,c){const a=gr(t),{b:o,o:l,out:d}=rs(s,i,c);let u=e;const h=[a];Qt(u)||h.push(u=ne(u));const f=Dt(u);let w=f[0],b=f[1],y=f[2],x=f[3],E=0;for(;E+4<=o.length;)w^=o[E+0],b^=o[E+1],y^=o[E+2],x^=o[E+3],{s0:w,s1:b,s2:y,s3:x}=Sn(a,w,b,y,x),l[E++]=w,l[E++]=b,l[E++]=y,l[E++]=x;if(i){const S=ss(s.subarray(E*4));w^=S[0],b^=S[1],y^=S[2],x^=S[3],{s0:w,s1:b,s2:y,s3:x}=Sn(a,w,b,y,x),l[E++]=w,l[E++]=b,l[E++]=y,l[E++]=x}return re(...h),d},decrypt(s,c){ns(s);const a=ts(t);let o=e;const l=[a];Qt(o)||l.push(o=ne(o));const d=Dt(o);c=mr(s.length,c),Qt(s)||l.push(s=ne(s)),pr(s,c);const u=Dt(s),h=Dt(c);let f=d[0],w=d[1],b=d[2],y=d[3];for(let x=0;x+4<=u.length;){const E=f,S=w,R=b,N=y;f=u[x+0],w=u[x+1],b=u[x+2],y=u[x+3];const{s0:z,s1:nt,s2:W,s3:$}=es(a,f,w,b,y);h[x++]=z^E,h[x++]=nt^S,h[x++]=W^R,h[x++]=$^N}return re(...l),is(c,i)}}}),os=(n,t,e,r=ds())=>_r(n,t,r,e),cs=(n,t,e,r,i)=>_r(n,t,e,r,i).message,_r=(n,t,e,r,i)=>{const s=typeof e=="bigint"?e:BigInt(e),c=n.getSharedSecret(t);let a=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);a.writeUint64(s),a.append(c),a.flip();const o=Nn(new Uint8Array(a.toBuffer())),l=o.subarray(32,48),d=o.subarray(0,32),u=Ft(o).subarray(0,4),h=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);h.append(u),h.flip();const f=h.readUint32();if(i){if(f!==i)throw new Error("Invalid key");r=as(r,d,l)}else r=ls(r,d,l);return{nonce:s,message:r,checksum:f}},as=(n,t,e)=>{let r=n;return r=br(t,e).decrypt(r),r},ls=(n,t,e)=>{let r=n;return r=br(t,e).encrypt(r),r};let Te=null;const ds=()=>{if(Te===null){const e=St.utils.randomSecretKey();Te=Math.round(e[0]<<8|e[1])}let n=BigInt(Date.now());const t=++Te%65535;return n=n<<BigInt(16)|BigInt(t),n},An=n=>{const t=ms(n,33);return new ot(t)},us=n=>n.readUint64(),fs=n=>n.readUint32(),hs=n=>{const t=n.readVarint32(),e=n.copy(n.offset,n.offset+t);return n.skip(t),new Uint8Array(e.toBuffer())},ps=n=>t=>{const e={},r=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);r.append(t),r.flip();for(const[i,s]of n)try{e[i]=s(r)}catch(c){throw c.message=`${i}: ${c.message}`,c}return e};function ms(n,t){if(n){const e=n.copy(n.offset,n.offset+t);return n.skip(t),new Uint8Array(e.toBuffer())}else throw Error("No buffer found on first parameter")}const ws=ps([["from",An],["to",An],["nonce",us],["check",fs],["encrypted",hs]]),ys={Memo:ws},vr=(n,t,e,r)=>{if(!e.startsWith("#"))return e;e=e.substring(1),Er(),n=Sr(n),t=gs(t);const i=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);i.writeVString(e);const s=new Uint8Array(i.copy(0,i.offset).toBuffer()),{nonce:c,message:a,checksum:o}=os(n,t,s,r),l=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);dr.Memo(l,{check:o,encrypted:a,from:n.createPublic(),nonce:c,to:t}),l.flip();const d=new Uint8Array(l.toBuffer());return"#"+ee.encode(d)},xr=(n,t)=>{if(!t.startsWith("#"))return t;t=t.substring(1),Er(),n=Sr(n);let e=ys.Memo(ee.decode(t));const{from:r,to:i,nonce:s,check:c,encrypted:a}=e,l=n.createPublic().toString()===new ot(r.key).toString()?new ot(i.key):new ot(r.key);e=cs(n,l,s,a,c);const d=new O(O.DEFAULT_CAPACITY,O.LITTLE_ENDIAN);return d.append(e),d.flip(),"#"+d.readVString()};let me;const Er=()=>{if(me===void 0){let n;me=!0;try{const t="5JdeC9P7Pbd1uGdFVEsJ41EkEnADbbHGq6p1BwFxm6txNBsQnsw",r=vr(t,"STM8m5UgaFAAYQRuaNejYdS8FVLVp9Ss3K1qAVk5de6F8s3HnVbvA","#memo爱");n=xr(t,r)}finally{me=n==="#memo爱"}}if(me===!1)throw new Error("This environment does not support encryption.")},Sr=n=>typeof n=="string"?xt.fromString(n):n,gs=n=>typeof n=="string"?ot.fromString(n):n,bs={decode:xr,encode:vr};class _s{timeout;constructor(t=1e4){this.timeout=t}async send(t,e){const r=new AbortController,i=setTimeout(()=>r.abort(),this.timeout);try{const s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:r.signal});if(!s.ok)throw new Error(`HTTP ${s.status}: ${s.statusText}`);return await s.json()}finally{clearTimeout(i)}}}class vs{endpoints;currentIndex=0;transport;requestId=1;constructor(t,e){this.endpoints=t??["https://api.hive.blog","https://api.deathwing.me","https://hive-api.arcange.eu"],this.transport=e??new _s,ut.nodes=[this.endpoints[0]]}get currentEndpoint(){return this.endpoints[this.currentIndex]}setEndpoints(t){if(t.length===0)throw new Error("At least one endpoint required");this.endpoints=t,this.currentIndex=0,ut.nodes=[t[0]]}setTransport(t){this.transport=t}async call(t,e=[]){const r=this.endpoints.length;let i;for(let s=0;s<r;s++){const c=this.endpoints[(this.currentIndex+s)%this.endpoints.length],a={jsonrpc:"2.0",method:t,params:e,id:this.requestId++};try{const o=await this.transport.send(c,a);if(o.error)throw new Error(`RPC error ${o.error.code}: ${o.error.message}`);return this.currentIndex=(this.currentIndex+s)%this.endpoints.length,ut.nodes=[this.endpoints[this.currentIndex]],o.result}catch(o){i=o instanceof Error?o:new Error(String(o)),console.warn(`RPC call to ${c} failed: ${i.message}`)}}throw new Error(`All RPC endpoints failed. Last error: ${i?.message}`)}async healthCheck(){try{return await this.call("condenser_api.get_dynamic_global_properties"),!0}catch{return!1}}async getAccounts(t){return this.call("condenser_api.get_accounts",[t])}async getDynamicGlobalProperties(){return this.call("condenser_api.get_dynamic_global_properties")}async broadcastTransaction(t){return this.call("condenser_api.broadcast_transaction_synchronous",[t])}async getAccountHistory(t,e=-1,r=100){return this.call("condenser_api.get_account_history",[t,e,r])}}let Ce;function jt(){return Ce||(Ce=new vs),Ce}function ie(n){const t=xt.from(n),e=t.createPublic();return{private:t,public:e}}function xs(n,t){const e=n.toString();return t.active.key_auths.some(([r])=>r===e)?"active":t.posting.key_auths.some(([r])=>r===e)?"posting":t.owner.key_auths.some(([r])=>r===e)?"owner":t.memo_key===e?"memo":null}async function In(n,t){const e=ie(n),i=await jt().getAccounts([t]);if(i.length===0)throw new Error(`Account @${t} not found`);const s=i[0],c=xs(e.public,s);if(!c)throw new Error(`Key does not match any authority on @${t}`);return{...e,role:c,account:s}}function zt(n){const t=n.trim().split(" ");if(t.length!==2)throw new Error(`Invalid asset format: ${n}`);return{amount:parseFloat(t[0]),symbol:t[1]}}function Kt(n,t){return`${n.toFixed(3)} ${t}`}const Es=1;function Ss(){return Es>=2}function ze(){return!1}function Ar(n,t){if(!n.startsWith("#"))return n;const e=bs.decode(t,n);return e.startsWith("#")?e.slice(1):e}const As=["haa-service"];async function Is(n,t,e=As,r=500){const i=jt(),s=[],c=new Set(e.map(l=>l.toLowerCase())),a=Math.min(r,1e3),o=await i.getAccountHistory(n,-1,a);for(const[l,d]of o){const[u,h]=d.op;if(u!=="transfer")continue;const{from:f,to:w,memo:b}=h;if(w.toLowerCase()===n.toLowerCase()&&c.has(f.toLowerCase())&&!(!b||!b.startsWith("#")))try{const y=Ar(b,t),x=JSON.parse(y);if(!Bs(x)||new Date(x.expires)<new Date)continue;s.push({payload:x,timestamp:d.timestamp,trxId:d.trx_id,from:f})}catch{continue}}return s.sort((l,d)=>new Date(d.timestamp).getTime()-new Date(l.timestamp).getTime()),s}async function Ls(n,t,e){const r=await Is(n,t,e);return r.length>0?r[0].payload:null}function Bs(n){if(typeof n!="object"||n===null)return!1;const t=n;return typeof t.v=="number"&&Array.isArray(t.endpoints)&&t.endpoints.length>0&&t.endpoints.every(e=>typeof e=="string")&&typeof t.expires=="string"}const Us=["https://api.hive.blog","https://api.deathwing.me","https://hive-api.arcange.eu"],De="haa_manual_endpoints";class ks{endpoints=[];discoveryInterval=null;healthInterval=null;serviceAccounts;lastPayload=null;lastDiscoveryTime=0;discoveryAttempted=!1;constructor(t=["haa-service"]){this.serviceAccounts=t,this.loadManualEndpoints(),this.addFallbacks()}hasProxyEndpoints(){return this.endpoints.some(t=>t.source==="discovered"||t.source==="manual")}get allEndpoints(){return[...this.endpoints]}get healthyEndpoints(){const t={discovered:0,manual:1,fallback:2};return this.endpoints.filter(e=>e.healthy).sort((e,r)=>t[e.source]-t[r.source]).map(e=>e.url)}addManualEndpoint(t){this.endpoints.some(e=>e.url===t)||(this.endpoints.push({url:t,source:"manual",healthy:!0,lastCheck:0}),this.saveManualEndpoints(),this.applyToClient())}removeManualEndpoint(t){this.endpoints=this.endpoints.filter(e=>!(e.url===t&&e.source==="manual")),this.saveManualEndpoints(),this.applyToClient()}async discover(t,e){this.discoveryAttempted=!0;try{const r=await Ls(t,e,this.serviceAccounts);if(r){this.lastPayload=r,this.lastDiscoveryTime=Date.now(),this.endpoints=this.endpoints.filter(i=>i.source!=="discovered");for(const i of r.endpoints)this.endpoints.push({url:i,source:"discovered",healthy:!0,lastCheck:0});return this.applyToClient(),!0}return!1}catch(r){return console.warn("Endpoint discovery failed:",r),!1}}async healthCheckAll(){const e=(ze()?this.endpoints.filter(r=>r.source!=="fallback"):this.endpoints).map(async r=>{try{const i=new AbortController,s=setTimeout(()=>i.abort(),8e3),c=await fetch(r.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"condenser_api.get_dynamic_global_properties",params:[],id:1}),signal:i.signal});clearTimeout(s),r.healthy=c.ok}catch{r.healthy=!1}r.lastCheck=Date.now()});await Promise.allSettled(e),this.applyToClient()}startPeriodicChecks(t,e,r=30*6e4,i=5*6e4){this.stopPeriodicChecks(),this.discover(t,e),this.discoveryInterval=setInterval(()=>this.discover(t,e),r),setTimeout(()=>{this.healthCheckAll(),this.healthInterval=setInterval(()=>this.healthCheckAll(),i)},15e3)}stopPeriodicChecks(){this.discoveryInterval&&(clearInterval(this.discoveryInterval),this.discoveryInterval=null),this.healthInterval&&(clearInterval(this.healthInterval),this.healthInterval=null)}applyToClient(){const t={discovered:0,manual:1,fallback:2};let e=this.endpoints.filter(i=>i.healthy);ze()&&(e=e.filter(i=>i.source!=="fallback"));const r=e.sort((i,s)=>t[i.source]-t[s.source]).map(i=>i.url);if(r.length>0)try{jt().setEndpoints(r)}catch{}}loadManualEndpoints(){try{const t=localStorage.getItem(De);if(!t)return;const e=JSON.parse(t);for(const r of e)this.endpoints.some(i=>i.url===r)||this.endpoints.push({url:r,source:"manual",healthy:!0,lastCheck:0})}catch{}}saveManualEndpoints(){const t=this.endpoints.filter(e=>e.source==="manual").map(e=>e.url);t.length>0?localStorage.setItem(De,JSON.stringify(t)):localStorage.removeItem(De)}addFallbacks(){for(const t of Us)this.endpoints.some(e=>e.url===t)||this.endpoints.push({url:t,source:"fallback",healthy:!0,lastCheck:0})}}let Re;function se(){return Re||(Re=new ks),Re}function dt(n,...t){return t.reduce((e,r,i)=>e.replace(`%${i+1}`,String(r)),n)}const m={html_lang:"en",app_title:"Propolis Wallet",nav_balance:"Balance",nav_transfer:"Transfer",nav_savings:"Savings",nav_settings:"Settings",loading:"Loading...",amount:"Amount",confirm:"Confirm",cancel:"Cancel",broadcasting:"Broadcasting...",invalid_url:"Invalid URL.",enter_proxy_url:"Enter a proxy URL.",amount_positive:"Amount must be > 0.",username_placeholder:"username",key_placeholder:"5K...",proxy_placeholder:"https://proxy.example.com",rpc_placeholder:"https://proxy.example.com/rpc",confirm_direct_mode:"Direct mode exposes Hive traffic. Continue?",confirm_logout:"Logout and clear keys?",login_title:"Login",login_info:"Enter your Hive account name and private active key. Your key never leaves this device.",account_name:"Account name",private_active_key:"Private active key",private_memo_key:"Private memo key (optional)",memo_key_placeholder:"5K... (for encrypted messages)",remember_keys:"Remember keys",remember_warning:"Keys stored in localStorage. Only use on a trusted device.",login_btn:"Login",account_key_required:"Account and active key required.",validating:"Validating...",wrong_key_role:"This is a %1 key. Active key required.",wrong_memo_role:"Second key is %1, not memo.",proxy_setup:"Proxy Setup",proxy_required:"Proxy required",proxy_desc_reconnect:"Obfuscation is enabled but no proxy endpoint is configured. Enter a proxy URL to reconnect.",proxy_desc_connect:"Obfuscation is enabled. Enter a proxy endpoint URL to connect.",proxy_url:"Proxy URL",connect:"Connect",switch_direct_link:"Or switch to Direct mode",paste_memo_prefix:"Or paste an encrypted memo from a",block_explorer:"block explorer",paste_memo_suffix:":",memo_textarea_placeholder:"#encrypted_memo...",decrypt_connect:"Decrypt & Connect",paste_memo_error:"Paste the encrypted memo.",memo_key_required:"Memo key required to decrypt.",private_memo_key_label:"Private memo key",memo_not_hash:"Memo must start with #",memo_bad_json:"Decrypted memo is not valid JSON.",memo_bad_payload:"Memo does not contain endpoint data.",memo_expired:"Endpoint data has expired.",account_label:"Account",account_not_found:"Account not found.",refresh:"Refresh",hive:"HIVE",hbd:"HBD",hive_savings:"HIVE Savings",hbd_savings:"HBD Savings",est_interest:"Est. interest (~20% APR):",hbd_yr:"HBD/yr",pending_withdrawals:"%1 pending withdrawal(s)",rpc_label:"RPC:",obfuscated:"obfuscated",direct:"direct",send_transfer:"Send Transfer",recipient:"Recipient",currency:"Currency",memo_optional:"Memo (optional)",public_memo:"Public memo",send:"Send",recipient_required:"Recipient required.",confirm_send:"Send %1 to @%2?",sent_tx:"Sent! TX: %1... (%2)",deposit_heading:"Deposit to Savings",withdraw_heading:"Withdraw from Savings",three_day_wait:"3-day waiting period for security.",deposit_btn:"Deposit to Savings",withdraw_btn:"Withdraw from Savings",pending_heading:"Pending",cancel_latest:"Cancel Latest",available_hbd:"Available: %1 HBD",apr_estimate:"~%1 HBD/yr (~20% APR)",n_pending:"%1 pending",cancelled:"Cancelled. (%1)",confirm_deposit:"Deposit %1?",confirm_withdraw:"Withdraw (3-day wait) %1?",deposited:"Deposited",withdrawal_initiated:"Withdrawal initiated",not_found:"Not found.",privacy:"Privacy",mode_label:"Mode:",mode_obfuscated:"Obfuscated",mode_direct:"Direct",traffic_disguised:"Traffic disguised as normal web requests.",traffic_plain:"Plain JSON-RPC — visible to network observers.",switch_to_direct:"Switch to Direct",switch_to_obfuscated:"Switch to Obfuscated",rpc_endpoint:"RPC Endpoint",current_label:"Current:",custom_endpoint:"Custom endpoint",set_btn:"Set",reset_btn:"Reset",check_btn:"Check",enter_url:"Enter a URL.",added:"Added.",reset_done:"Reset.",discovery:"Discovery",status_label:"Status:",n_found:"%1 found",none_found:"None found",checking:"Checking...",expires_label:"Expires: %1",discover:"Discover",check_all:"Check All",no_memo_key:"No memo key — discovery disabled.",add_memo_hint:"Add memo key at login to discover proxy endpoints.",found_n:"Found %1",none_found_dot:"None found.",done:"Done.",endpoints:"Endpoints",none:"None.",account_heading:"Account",active_check:"Active:",memo_check:"Memo:",persistent:"Persistent",session:"Session",logout:"Logout",about:"About",about_text:"Propolis Wallet v1.0.0 — Keys never leave this device."},$t=(n,t)=>t.querySelector(n);async function $s(n,t,e){se(),t.account,n.innerHTML=`<div class="card"><h2>${m.login_title}</h2>
    
    <p class="sm mt mb">${m.login_info}</p>
    <label>${m.account_name}</label><input id="a" placeholder="${m.username_placeholder}" autocomplete="off" spellcheck="false">
    <label>${m.private_active_key}</label><input type="password" id="k" placeholder="${m.key_placeholder}" autocomplete="off">
    <label>${m.private_memo_key}</label><input type="password" id="m" placeholder="${m.memo_key_placeholder}" autocomplete="off">
    <div class="mb"><label class="fx" style="cursor:pointer"><input type="checkbox" id="p" style="width:auto;margin:0"><span class="sm">${m.remember_keys}</span></label>
    <p class="wrn hidden" id="pw">${m.remember_warning}</p></div>
    <button id="b">${m.login_btn}</button><p class="err hidden" id="e"></p><p class="ok hidden" id="s"></p></div>`;const r=$t("#a",n),i=$t("#k",n),s=$t("#m",n),c=$t("#p",n),a=$t("#pw",n),o=$t("#b",n),l=$t("#e",n),d=$t("#s",n),u=(f,w)=>{f.textContent=w,f.classList.remove("hidden")},h=(...f)=>f.forEach(w=>w.classList.add("hidden"));c.addEventListener("change",()=>a.classList.toggle("hidden",!c.checked)),o.addEventListener("click",async()=>{const f=r.value.trim().toLowerCase().replace("@",""),w=i.value.trim(),b=s.value.trim()||null;if(!f||!w){u(l,m.account_key_required);return}o.disabled=!0,h(l),u(d,m.validating);try{const y=await In(w,f);if(y.role!=="active"&&y.role!=="owner"){u(l,dt(m.wrong_key_role,y.role)),h(d),o.disabled=!1;return}if(b){const x=await In(b,f);if(x.role!=="memo"){u(l,dt(m.wrong_memo_role,x.role)),h(d),o.disabled=!1;return}}t.account=f,t.activeKeyWif=w,t.memoKeyWif=b,t.persistKeys=c.checked,e.saveState(),e.startDiscovery(),e.navigate("balance")}catch(y){u(l,y instanceof Error?y.message:String(y)),h(d),o.disabled=!1}})}async function Ts(n,t,e){n.innerHTML=`<div class="card"><p class="bl">${m.account_label}</p>
    <p style="font-size:1.1rem;font-weight:bold" class="mb">@${t.account}</p>
    <div id="b"><p class="mt">${m.loading}</p></div></div>
    <button class="btn-s" id="r">${m.refresh}</button>`;const r=n.querySelector("#b"),i=n.querySelector("#r");async function s(){r.innerHTML=`<p class="mt">${m.loading}</p>`,i.disabled=!0;try{const c=jt(),a=await c.getAccounts([t.account]);if(!a.length){r.innerHTML=`<p class="err">${m.account_not_found}</p>`;return}const o=a[0],l=zt(o.balance),d=zt(o.hbd_balance),u=zt(o.savings_balance),h=zt(o.savings_hbd_balance);r.innerHTML=`<div class="g2">
    <div><p class="bl">${m.hive}</p><p class="ba">${l.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hbd}</p><p class="ba">${d.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hive_savings}</p><p class="ba">${u.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hbd_savings}</p><p class="ba gc">${h.amount.toFixed(3)}</p></div></div>
    ${h.amount>0?`<div class="info mt2"><p class="sm mt">${m.est_interest} <strong class="gc">~${(h.amount*.2).toFixed(3)} ${m.hbd_yr}</strong></p></div>`:""}
    ${o.savings_withdraw_requests>0?`<p class="wrn mt1">${dt(m.pending_withdrawals,o.savings_withdraw_requests)}</p>`:""}
    <p class="xs mt mt2">${m.rpc_label} ${c.currentEndpoint}${(()=>{const w=se().allEndpoints.find(b=>b.url===c.currentEndpoint);return w?` (${w.source})`:""})()}${Ss()?` | ${ze()?`<span class="gc">${m.obfuscated}</span>`:`<span class="wrn">${m.direct}</span>`}`:""}</p>`}catch(c){r.innerHTML=`<p class="err">${c instanceof Error?c.message:c}</p>`}finally{i.disabled=!1}}i.addEventListener("click",s),await s()}function Cs(n,t,e,r=""){return["transfer",{from:n,to:t,amount:e,memo:r}]}function Ds(n,t,e,r=""){return["transfer_to_savings",{from:n,to:t,amount:e,memo:r}]}function Rs(n,t,e,r,i=""){return["transfer_from_savings",{from:n,request_id:t,to:e,amount:r,memo:i}]}function Os(n,t){return["cancel_transfer_from_savings",{from:n,request_id:t}]}async function xe(n,t){const e=new Qe;for(const[i,s]of n)await e.addOperation(i,s);return e.sign(t.private),await e.broadcast(!0)}async function Ns(n,t,e){n.innerHTML=`<div class="card"><h2>${m.send_transfer}</h2>
    <label>${m.recipient}</label><input id="to" placeholder="${m.username_placeholder}" autocomplete="off" spellcheck="false">
    <label>${m.amount}</label><input type="number" id="am" placeholder="0.000" step="0.001" min="0.001">
    <label>${m.currency}</label><select id="cu"><option value="HBD">${m.hbd}</option><option value="HIVE">${m.hive}</option></select>
    <label>${m.memo_optional}</label><input id="me" placeholder="${m.public_memo}" autocomplete="off">
    <div id="cb" class="hidden mb"><div class="card" style="background:var(--bg);border-color:var(--wn)">
    <p class="sm" id="ct"></p><div class="fx mt2"><button class="btn-ok" id="y">${m.confirm}</button><button class="btn-s" id="n">${m.cancel}</button></div></div></div>
    <button id="s">${m.send}</button><p class="err hidden" id="e"></p><p class="ok hidden" id="o"></p></div>`;const r=n.querySelector("#to"),i=n.querySelector("#am"),s=n.querySelector("#cu"),c=n.querySelector("#me"),a=n.querySelector("#s"),o=n.querySelector("#cb"),l=n.querySelector("#ct"),d=n.querySelector("#y"),u=n.querySelector("#n"),h=n.querySelector("#e"),f=n.querySelector("#o"),w=(y,x)=>{y.textContent=x,y.classList.remove("hidden")},b=(...y)=>y.forEach(x=>x.classList.add("hidden"));a.addEventListener("click",()=>{const y=r.value.trim().toLowerCase().replace("@",""),x=parseFloat(i.value);if(b(h,f),!y){w(h,m.recipient_required);return}if(!x||x<=0){w(h,m.amount_positive);return}l.textContent=dt(m.confirm_send,Kt(x,s.value),y),o.classList.remove("hidden"),a.classList.add("hidden")}),u.addEventListener("click",()=>{o.classList.add("hidden"),a.classList.remove("hidden")}),d.addEventListener("click",async()=>{const y=r.value.trim().toLowerCase().replace("@",""),x=parseFloat(i.value),E=s.value;d.disabled=!0,d.textContent=m.broadcasting,b(h);try{const S=ie(t.activeKeyWif),R=await xe([Cs(t.account,y,Kt(x,E),c.value)],S);o.classList.add("hidden"),a.classList.remove("hidden"),w(f,dt(m.sent_tx,R.tx_id?.slice(0,12)||"",R.status)),r.value="",i.value="",c.value=""}catch(S){w(h,S instanceof Error?S.message:String(S)),o.classList.add("hidden"),a.classList.remove("hidden")}finally{d.disabled=!1,d.textContent=m.confirm}})}async function qs(n,t,e){n.innerHTML=`<div id="si" class="card"><p class="mt">${m.loading}</p></div>
    <div class="card"><h2>${m.deposit_heading}</h2><label>${m.amount}</label>
    <input type="number" id="da" placeholder="0.000" step="0.001" min="0.001">
    <select id="dc"><option value="HBD">${m.hbd}</option><option value="HIVE">${m.hive}</option></select>
    <button id="db">${m.deposit_btn}</button></div>
    <div class="card"><h2>${m.withdraw_heading}</h2><p class="sm mt mb">${m.three_day_wait}</p>
    <label>${m.amount}</label><input type="number" id="wa" placeholder="0.000" step="0.001" min="0.001">
    <select id="wc"><option value="HBD">${m.hbd}</option><option value="HIVE">${m.hive}</option></select>
    <button id="wb">${m.withdraw_btn}</button></div>
    <div id="pw" class="card hidden"><h2>${m.pending_heading}</h2><div id="pl"></div></div>
    <p class="err hidden" id="e"></p><p class="ok hidden" id="o"></p>`;const r=n.querySelector("#si"),i=n.querySelector("#da"),s=n.querySelector("#dc"),c=n.querySelector("#db"),a=n.querySelector("#wa"),o=n.querySelector("#wc"),l=n.querySelector("#wb"),d=n.querySelector("#pw"),u=n.querySelector("#pl"),h=n.querySelector("#e"),f=n.querySelector("#o"),w=E=>{h.textContent=E,h.classList.remove("hidden"),f.classList.add("hidden")},b=E=>{f.textContent=E,f.classList.remove("hidden"),h.classList.add("hidden")};async function y(){try{const E=(await jt().getAccounts([t.account]))[0];if(!E){r.innerHTML=`<p class="err">${m.not_found}</p>`;return}const S=zt(E.savings_hbd_balance),R=zt(E.savings_balance),N=zt(E.hbd_balance);r.innerHTML=`<div class="g2">
    <div><p class="bl">${m.hbd_savings}</p><p class="ba gc">${S.amount.toFixed(3)}</p></div>
    <div><p class="bl">${m.hive_savings}</p><p class="ba">${R.amount.toFixed(3)}</p></div></div>
    <p class="sm mt mt1">${dt(m.available_hbd,N.amount.toFixed(3))}</p>
    ${S.amount>0?`<p class="sm gc mt1">${dt(m.apr_estimate,(S.amount*.2).toFixed(3))}</p>`:""}`,E.savings_withdraw_requests>0?(d.classList.remove("hidden"),u.innerHTML=`<p class="wrn">${dt(m.n_pending,E.savings_withdraw_requests)}</p>
    <button class="btn-s mt1" id="cb">${m.cancel_latest}</button>`,u.querySelector("#cb").addEventListener("click",async function(){this.disabled=!0;try{const z=await xe([Os(t.account,0)],ie(t.activeKeyWif));b(dt(m.cancelled,z.status)),await y()}catch(z){w(z instanceof Error?z.message:String(z))}finally{this.disabled=!1}})):d.classList.add("hidden")}catch(E){r.innerHTML=`<p class="err">${E instanceof Error?E.message:E}</p>`}}async function x(E,S,R,N){const z=parseFloat(S.value),nt=R.value;if(!z||z<=0){w(m.amount_positive);return}const W=dt(N?m.confirm_deposit:m.confirm_withdraw,Kt(z,nt));if(confirm(W)){E.disabled=!0,E.textContent=m.broadcasting;try{const $=ie(t.activeKeyWif),at=N?Ds(t.account,t.account,Kt(z,nt)):Rs(t.account,Math.floor(Date.now()/1e3)%2147483647,t.account,Kt(z,nt)),it=await xe([at],$);b(`${N?m.deposited:m.withdrawal_initiated}. (${it.status})`),S.value="",await y()}catch($){w($ instanceof Error?$.message:String($))}finally{E.disabled=!1,E.textContent=N?m.deposit_btn:m.withdraw_btn}}}c.addEventListener("click",()=>x(c,i,s,!0)),l.addEventListener("click",()=>x(l,a,o,!1)),await y()}const Hs=["https://api.hive.blog","https://api.deathwing.me","https://hive-api.arcange.eu"];async function Ms(n,t,e){const r=jt(),i=se();i.allEndpoints.filter(h=>h.source==="discovered").length>0,t.memoKeyWif;const c=(h,f)=>`<p class="sm ${h}">${f}</p>`;n.innerHTML=`
    <div class="card"><h2>${m.rpc_endpoint}</h2>
    ${c("mt mb",`${m.current_label} <code id="ce">${r.currentEndpoint}</code>`)}
    <label>${m.custom_endpoint}</label><input type="url" id="ci" placeholder="${m.rpc_placeholder}">
    <button class="btn-s" id="se">${m.set_btn}</button><button class="btn-s" id="re">${m.reset_btn}</button><button class="btn-s" id="hc">${m.check_btn}</button>
    <p class="sm hidden" id="es"></p></div>
    
    
    <div class="card"><h2>${m.account_heading}</h2>
    ${c("",`@<strong>${t.account}</strong>`)}
    ${c("mt mb",`${m.active_check} ${t.activeKeyWif?"✓":"✗"} | ${m.memo_check} ${t.memoKeyWif?"✓":"✗"} | ${t.persistKeys?m.persistent:m.session}`)}
    <button class="btn-er" id="lo">${m.logout}</button></div>
    <div class="card"><h2>${m.about}</h2>${c("mt",m.about_text)}</div>`;const a=n.querySelector("#ci"),o=n.querySelector("#ce"),l=n.querySelector("#es");n.querySelector("#ds");const d=n.querySelector("#el"),u=(h,f,w)=>{h.className=`sm ${f}`,h.textContent=w,h.classList.remove("hidden")};n.querySelector("#se").addEventListener("click",()=>{const h=a.value.trim();if(!h){u(l,"err",m.enter_url);return}try{new URL(h),i.addManualEndpoint(h),o.textContent=r.currentEndpoint,u(l,"ok",m.added),a.value="",d&&(d.innerHTML=Vs(i))}catch{u(l,"err",m.invalid_url)}}),n.querySelector("#re").addEventListener("click",()=>{r.setEndpoints(Hs),o.textContent=r.currentEndpoint,u(l,"ok",m.reset_done)}),n.querySelector("#hc").addEventListener("click",async function(){this.disabled=!0,u(l,"mt","...");const h=await r.healthCheck();u(l,h?"ok":"err",h?"✓ OK":"✗ Failed"),this.disabled=!1}),n.querySelector("#lo").addEventListener("click",()=>{confirm(m.confirm_logout)&&e.logout()})}function Vs(n){const t=n.allEndpoints;return t.length?t.map(e=>`<p class="sm"><code>${e.url}</code> <span class="xs">[${e.source}]</span> ${e.healthy?'<span class="gc">✓</span>':'<span class="err">✗</span>'}</p>`).join(""):`<p class="sm">${m.none}</p>`}const zs={login:$s,balance:Ts,transfer:Ns,savings:qs,settings:Ms},Ks=[{hash:"balance",label:m.nav_balance},{hash:"transfer",label:m.nav_transfer},{hash:"savings",label:m.nav_savings},{hash:"settings",label:m.nav_settings}];class Ps{container;navEl;contentEl;state;constructor(t){this.container=t,this.state=this.loadState(),this.container.innerHTML="";const e=document.createElement("div");e.className="ct",document.documentElement.lang=m.html_lang,document.title=m.app_title,e.innerHTML=`<h1>${m.app_title}</h1>`,this.navEl=document.createElement("nav"),this.contentEl=document.createElement("div"),this.contentEl.className="ct",e.appendChild(this.navEl),this.container.appendChild(e),this.container.appendChild(this.contentEl),this.renderNav(),window.addEventListener("hashchange",()=>this.route()),this.route(),this.startDiscovery()}loadState(){const t=localStorage.getItem("haa_keys");if(t)try{const s=JSON.parse(t);return{account:s.account||null,activeKeyWif:s.activeKeyWif||null,memoKeyWif:s.memoKeyWif||null,persistKeys:!0}}catch{}const e=sessionStorage.getItem("haa_account"),r=sessionStorage.getItem("haa_activeKey"),i=sessionStorage.getItem("haa_memoKey");return{account:e,activeKeyWif:r,memoKeyWif:i,persistKeys:!1}}saveState(){this.state.persistKeys?localStorage.setItem("haa_keys",JSON.stringify({account:this.state.account,activeKeyWif:this.state.activeKeyWif,memoKeyWif:this.state.memoKeyWif})):(localStorage.removeItem("haa_keys"),this.state.account&&sessionStorage.setItem("haa_account",this.state.account),this.state.activeKeyWif&&sessionStorage.setItem("haa_activeKey",this.state.activeKeyWif),this.state.memoKeyWif&&sessionStorage.setItem("haa_memoKey",this.state.memoKeyWif))}startDiscovery(){this.state.account&&this.state.memoKeyWif&&se().startPeriodicChecks(this.state.account,this.state.memoKeyWif)}logout(){se().stopPeriodicChecks(),this.state.account=null,this.state.activeKeyWif=null,this.state.memoKeyWif=null,localStorage.removeItem("haa_keys"),sessionStorage.clear(),this.navigate("login")}navigate(t){window.location.hash=`#${t}`}renderNav(){if(this.navEl.innerHTML="",!this.state.account){this.navEl.classList.add("hidden");return}this.navEl.classList.remove("hidden");const t=(window.location.hash||"#balance").slice(1);for(const e of Ks){const r=document.createElement("a");r.href=`#${e.hash}`,r.textContent=e.label,e.hash===t&&(r.className="active"),this.navEl.appendChild(r)}}route(){const t=(window.location.hash||"").slice(1)||"login";if(t!=="login"&&!this.state.account){this.navigate("login");return}if(t==="login"&&this.state.account){this.navigate("balance");return}const e=zs[t];if(!e){this.navigate("balance");return}this.renderNav(),this.contentEl.innerHTML="",e(this.contentEl,this.state,this)}}const Fs=document.getElementById("app"),js=new Ps(Fs);window.propolis={app:js,getClient:jt,importKey:ie,formatAsset:Kt,signAndBroadcast:xe,decryptMemo:Ar};</script>
      <style rel="stylesheet" crossorigin>*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:root{--bg:#1a1a2e;--sf:#16213e;--in:#0f3460;--tx:#e8e8e8;--tm:#a0a0b0;--ac:#e94560;--ah:#ff6b81;--ok:#4ecca3;--wn:#f0c040;--er:#e94560;--bd:#2a2a4a;--r:8px}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;background:var(--bg);color:var(--tx);min-height:100vh;line-height:1.5}.ct{max-width:480px;margin:0 auto;padding:24px 16px}h1{font-size:1.5rem;margin-bottom:8px}h2{font-size:1.2rem;margin-bottom:12px}p{margin-bottom:8px}button{background:var(--ac);color:var(--tx);border:none;padding:10px 20px;border-radius:var(--r);cursor:pointer;font-size:1rem;width:100%;margin-bottom:8px}button:hover{background:var(--ah)}button:disabled{opacity:.5;cursor:not-allowed}.btn-s{background:var(--sf);border:1px solid var(--bd)}.btn-ok{background:var(--ok)}.btn-er{background:var(--er)}input,textarea,select{background:var(--in);color:var(--tx);border:1px solid var(--bd);padding:10px 12px;border-radius:var(--r);font-size:1rem;width:100%;margin-bottom:12px}input:focus,textarea:focus,select:focus{outline:none;border-color:var(--ac)}label{display:block;font-size:.85rem;color:var(--tm);margin-bottom:4px}.card{background:var(--sf);border:1px solid var(--bd);border-radius:var(--r);padding:16px;margin-bottom:12px}.ba{font-size:1.8rem;font-weight:700}.bl{font-size:.85rem;color:var(--tm)}.sm{font-size:.85rem}.xs{font-size:.75rem}.err{color:var(--er);font-size:.85rem}.ok{color:var(--ok);font-size:.85rem}.wrn{color:var(--wn);font-size:.85rem}.mt{color:var(--tm)}.gc{color:var(--ok)}.g2{display:grid;grid-template-columns:1fr 1fr;gap:12px}.mb{margin-bottom:12px}.mt1{margin-top:8px}.mt2{margin-top:12px}.info{padding:8px;background:var(--in);border-radius:var(--r)}.fx{display:flex;gap:8px}nav{display:flex;gap:4px;margin-bottom:16px;overflow-x:auto}nav a{color:var(--tm);text-decoration:none;padding:8px 12px;border-radius:var(--r);font-size:.85rem;white-space:nowrap}nav a.active{background:var(--sf);color:var(--tx)}nav a:hover{color:var(--tx)}.hidden{display:none}</style>
    </head>
    <body>
      <div id="app"></div>
    
    </body>
    </html>
    
  • <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Propolis Wallet</title>
      <script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const c of s.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function e(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=e(i);fetch(i.href,s)}})();/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ke(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Pt(n,t=""){if(!Number.isSafeInteger(n)||n<0){const e=t&&`"${t}" `;throw new Error(`${e}expected integer >= 0, got ${n}`)}}function Z(n,t,e=""){const r=Ke(n),i=n?.length,s=t!==void 0;if(!r||s&&i!==t){const c=e&&`"${e}" `,a=s?` of length ${t}`:"",o=r?`length=${i}`:`type=${typeof n}`;throw new Error(c+"expected Uint8Array"+a+", got "+o)}return n}function Ln(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash must wrapped by utils.createHasher");Pt(n.outputLen),Pt(n.blockLen)}function ge(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function Ir(n,t){Z(n,void 0,"digestInto() output");const e=t.outputLen;if(n.length<e)throw new Error('"digestInto() output" expected to be of length >='+e)}function Nt(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function Ie(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function mt(n,t){return n<<32-t|n>>>t}function ce(n,t){return n<<t|n>>>32-t>>>0}const Bn=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Lr=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function yt(n){if(Z(n),Bn)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=Lr[n[e]];return t}const _t={_0:48,_9:57,A:65,F:70,a:97,f:102};function sn(n){if(n>=_t._0&&n<=_t._9)return n-_t._0;if(n>=_t.A&&n<=_t.F)return n-(_t.A-10);if(n>=_t.a&&n<=_t.f)return n-(_t.a-10)}function gt(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(Bn)return Uint8Array.fromHex(n);const t=n.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){const c=sn(n.charCodeAt(s)),a=sn(n.charCodeAt(s+1));if(c===void 0||a===void 0){const o=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+o+'" at index '+s)}r[i]=c*16+a}return r}function Ct(...n){let t=0;for(let r=0;r<n.length;r++){const i=n[r];Z(i),t+=i.length}const e=new Uint8Array(t);for(let r=0,i=0;r<n.length;r++){const s=n[r];e.set(s,i),i+=s.length}return e}function Pe(n,t={}){const e=(i,s)=>n(s).update(i).digest(),r=n(void 0);return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=i=>n(i),Object.assign(e,t),Object.freeze(e)}function Un(n=32){const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(n))}const kn=n=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,n])});/**
     * @license bytebuffer.ts (c) 2015 Daniel Wirtz <dcode@dcode.io>
     * Backing buffer: ArrayBuffer, Accessor: DataView
     * Released under the Apache License, Version 2.0
     * see: https://github.com/dcodeIO/bytebuffer.ts for details
     * modified by @xmcl/bytebuffer
     * And customized for hive-tx
     */const ae=new ArrayBuffer(0),Br=new TextEncoder,on=new TextDecoder;class O{constructor(t=O.DEFAULT_CAPACITY,e=O.DEFAULT_ENDIAN){this.readUInt32=this.readUint32,this.buffer=t===0?ae:new ArrayBuffer(t),this.view=t===0?new DataView(ae):new DataView(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=e}static allocate(t,e){return new O(t,e)}static concat(t,e){let r=0;for(let a=0;a<t.length;++a){const o=t[a];if(o instanceof O)r+=o.limit-o.offset;else if(o instanceof Uint8Array)r+=o.length;else if(o instanceof ArrayBuffer)r+=o.byteLength;else if(Array.isArray(o))r+=o.length;else throw TypeError("Illegal buffer")}if(r===0)return new O(0,e);const i=new O(r,e),s=new Uint8Array(i.buffer);let c=0;for(let a=0;a<t.length;++a){let o=t[a];o instanceof O?(s.set(new Uint8Array(o.buffer,o.offset,o.limit-o.offset),c),c+=o.limit-o.offset):o instanceof Uint8Array?(s.set(o,c),c+=o.length):o instanceof ArrayBuffer?(s.set(new Uint8Array(o),c),c+=o.byteLength):(s.set(o,c),c+=o.length)}return i.limit=i.offset=c,i.offset=0,i}static wrap(t,e){if(t instanceof O){const i=t.clone();return i.markedOffset=-1,i}let r;if(t instanceof Uint8Array)r=new O(0,e),t.length>0&&(r.buffer=t.buffer,r.offset=t.byteOffset,r.limit=t.byteOffset+t.byteLength,r.view=new DataView(t.buffer));else if(t instanceof ArrayBuffer)r=new O(0,e),t.byteLength>0&&(r.buffer=t,r.offset=0,r.limit=t.byteLength,r.view=t.byteLength>0?new DataView(t):new DataView(ae));else if(Array.isArray(t))r=new O(t.length,e),r.limit=t.length,new Uint8Array(r.buffer).set(t);else throw TypeError("Illegal buffer");return r}writeBytes(t,e){return this.append(t,e)}writeInt8(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+1>this.buffer.byteLength&&this.resize(e+1),this.view.setInt8(e,t),r&&(this.offset+=1),this}writeByte(t,e){return this.writeInt8(t,e)}writeUint8(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+1>this.buffer.byteLength&&this.resize(e+1),this.view.setUint8(e,t),r&&(this.offset+=1),this}writeUInt8(t,e){return this.writeUint8(t,e)}readUint8(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getUint8(t);return e&&(this.offset+=1),r}readUInt8(t){return this.readUint8(t)}writeInt16(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+2>this.buffer.byteLength&&this.resize(e+2),this.view.setInt16(e,t,this.littleEndian),r&&(this.offset+=2),this}writeShort(t,e){return this.writeInt16(t,e)}writeUint16(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+2>this.buffer.byteLength&&this.resize(e+2),this.view.setUint16(e,t,this.littleEndian),r&&(this.offset+=2),this}writeUInt16(t,e){return this.writeUint16(t,e)}writeInt32(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+4>this.buffer.byteLength&&this.resize(e+4),this.view.setInt32(e,t,this.littleEndian),r&&(this.offset+=4),this}writeInt(t,e){return this.writeInt32(t,e)}writeUint32(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,e+4>this.buffer.byteLength&&this.resize(e+4),this.view.setUint32(e,t,this.littleEndian),r&&(this.offset+=4),this}writeUInt32(t,e){return this.writeUint32(t,e)}readUint32(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getUint32(t,this.littleEndian);return e&&(this.offset+=4),r}append(t,e){const r=typeof e>"u";r?e=this.offset:e=e;let i;return t instanceof O?(i=new Uint8Array(t.buffer,t.offset,t.limit-t.offset),t.offset+=i.length):t instanceof Uint8Array?i=t:t instanceof ArrayBuffer?i=new Uint8Array(t):i=new Uint8Array(t),i.length<=0?this:(e+i.length>this.buffer.byteLength&&this.resize(e+i.length),new Uint8Array(this.buffer).set(i,e),r&&(this.offset+=i.length),this)}clone(t){const e=new O(0,this.littleEndian);return t?(e.buffer=new ArrayBuffer(this.buffer.byteLength),new Uint8Array(e.buffer).set(new Uint8Array(this.buffer)),e.view=new DataView(e.buffer)):(e.buffer=this.buffer,e.view=this.view),e.offset=this.offset,e.markedOffset=this.markedOffset,e.limit=this.limit,e}copy(t,e){if(t===void 0&&(t=this.offset),e===void 0&&(e=this.limit),t===e)return new O(0,this.littleEndian);const r=e-t,i=new O(r,this.littleEndian);return i.offset=0,i.limit=r,new Uint8Array(i.buffer).set(new Uint8Array(this.buffer).subarray(t,e),0),i}copyTo(t,e,r,i){const s=typeof e>"u",c=typeof r>"u";e=s?t.offset:e,r=c?this.offset:r,i=i===void 0?this.limit:i;const a=i-r;return a===0?t:(t.ensureCapacity(e+a),new Uint8Array(t.buffer).set(new Uint8Array(this.buffer).subarray(r,i),e),c&&(this.offset+=a),s&&(t.offset+=a),this)}ensureCapacity(t){let e=this.buffer.byteLength;return e<t?this.resize((e*=2)>t?e:t):this}flip(){return this.limit=this.offset,this.offset=0,this}resize(t){if(this.buffer.byteLength<t){const e=new ArrayBuffer(t);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e,this.view=new DataView(e)}return this}skip(t){return this.offset+=t,this}writeInt64(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,typeof t=="number"&&(t=BigInt(t)),e+8>this.buffer.byteLength&&this.resize(e+8),this.view.setBigInt64(e,t,this.littleEndian),r&&(this.offset+=8),this}writeLong(t,e){return this.writeInt64(t,e)}readInt64(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getBigInt64(t,this.littleEndian);return e&&(this.offset+=8),r}readLong(t){return this.readInt64(t)}writeUint64(t,e){const r=typeof e>"u";return r?e=this.offset:e=e,typeof t=="number"&&(t=BigInt(t)),e+8>this.buffer.byteLength&&this.resize(e+8),this.view.setBigUint64(e,t,this.littleEndian),r&&(this.offset+=8),this}writeUInt64(t,e){return this.writeUint64(t,e)}readUint64(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=this.view.getBigUint64(t,this.littleEndian);return e&&(this.offset+=8),r}readUInt64(t){return this.readUint64(t)}toBuffer(t){const e=this.offset,r=this.limit;return!t&&e===0&&r===this.buffer.byteLength?this.buffer:e===r?ae:this.buffer.slice(e,r)}toArrayBuffer(t){return this.toBuffer(t)}writeVarint32(t,e){const r=typeof e>"u";r?e=this.offset:e=e;const i=this.calculateVarint32(t);for(e+i>this.buffer.byteLength&&this.resize(e+i),t>>>=0;t>=128;)this.view.setUint8(e++,t&127|128),t>>>=7;return this.view.setUint8(e++,t),r?(this.offset=e,this):i}readVarint32(t){const e=typeof t>"u";typeof t>"u"&&(t=this.offset);let r=0,i=0,s;do s=this.view.getUint8(t++),r<5&&(i|=(s&127)<<7*r),++r;while((s&128)!==0);return i|=0,e?(this.offset=t,i):{value:i,length:r}}calculateVarint32(t){return t=t>>>0,t<128?1:t<16384?2:t<1<<21?3:t<1<<28?4:5}writeVString(t,e){const r=typeof e>"u";let i=r?this.offset:e;const s=Br.encode(t),c=s.length,a=this.calculateVarint32(c);return i+a+c>this.buffer.byteLength&&this.resize(i+a+c),this.writeVarint32(c,i),i+=a,new Uint8Array(this.buffer).set(s,i),i+=c,r?(this.offset=i,this):i-(e||0)}readVString(t){const e=typeof t>"u";e?t=this.offset:t=t;const r=t,i=this.readVarint32(t),s=i.value,c=i.length;t+=c;const a=on.decode(new Uint8Array(this.buffer,t,s));return t+=s,e?(this.offset=t,a):{string:a,length:t-r}}readUTF8String(t,e){const r=typeof e>"u";r?e=this.offset:e=e;const i=on.decode(new Uint8Array(this.buffer,e,t));return r?(this.offset+=t,i):{string:i,length:t}}}O.LITTLE_ENDIAN=!0;O.BIG_ENDIAN=!1;O.DEFAULT_CAPACITY=16;O.DEFAULT_ENDIAN=O.BIG_ENDIAN;function Ur(n,t,e){return n&t^~n&e}function kr(n,t,e){return n&t^n&e^t&e}class Fe{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,e,r,i){this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Ie(this.buffer)}update(t){ge(this),Z(t);const{view:e,buffer:r,blockLen:i}=this,s=t.length;for(let c=0;c<s;){const a=Math.min(i-this.pos,s-c);if(a===i){const o=Ie(t);for(;i<=s-c;c+=i)this.process(o,c);continue}r.set(t.subarray(c,c+a),this.pos),this.pos+=a,c+=a,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ge(this),Ir(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:i,isLE:s}=this;let{pos:c}=this;e[c++]=128,Nt(this.buffer.subarray(c)),this.padOffset>i-c&&(this.process(r,0),c=0);for(let u=c;u<i;u++)e[u]=0;r.setBigUint64(i-8,BigInt(this.length*8),s),this.process(r,0);const a=Ie(t),o=this.outputLen;if(o%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const l=o/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)a.setUint32(4*u,d[u],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:e,buffer:r,length:i,finished:s,destroyed:c,pos:a}=this;return t.destroyed=c,t.finished=s,t.length=i,t.pos=a,i%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Lt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Q=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),$r=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),$n=Uint8Array.from(new Array(16).fill(0).map((n,t)=>t)),Tr=$n.map(n=>(9*n+5)%16),Tn=(()=>{const e=[[$n],[Tr]];for(let r=0;r<4;r++)for(let i of e)i.push(i[r].map(s=>$r[s]));return e})(),Cn=Tn[0],Dn=Tn[1],Rn=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(n=>Uint8Array.from(n)),Cr=Cn.map((n,t)=>n.map(e=>Rn[t][e])),Dr=Dn.map((n,t)=>n.map(e=>Rn[t][e])),Rr=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),Or=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function cn(n,t,e,r){return n===0?t^e^r:n===1?t&e|~t&r:n===2?(t|~e)^r:n===3?t&r|e&~r:t^(e|~r)}const le=new Uint32Array(16);class Nr extends Fe{h0=1732584193;h1=-271733879;h2=-1732584194;h3=271733878;h4=-1009589776;constructor(){super(64,20,8,!0)}get(){const{h0:t,h1:e,h2:r,h3:i,h4:s}=this;return[t,e,r,i,s]}set(t,e,r,i,s){this.h0=t|0,this.h1=e|0,this.h2=r|0,this.h3=i|0,this.h4=s|0}process(t,e){for(let f=0;f<16;f++,e+=4)le[f]=t.getUint32(e,!0);let r=this.h0|0,i=r,s=this.h1|0,c=s,a=this.h2|0,o=a,l=this.h3|0,d=l,u=this.h4|0,h=u;for(let f=0;f<5;f++){const w=4-f,b=Rr[f],y=Or[f],x=Cn[f],E=Dn[f],S=Cr[f],R=Dr[f];for(let N=0;N<16;N++){const z=ce(r+cn(f,s,a,l)+le[x[N]]+b,S[N])+u|0;r=u,u=l,l=ce(a,10)|0,a=s,s=z}for(let N=0;N<16;N++){const z=ce(i+cn(w,c,o,d)+le[E[N]]+y,R[N])+h|0;i=h,h=d,d=ce(o,10)|0,o=c,c=z}}this.set(this.h1+a+d|0,this.h2+l+h|0,this.h3+u+i|0,this.h4+r+c|0,this.h0+s+o|0)}roundClean(){Nt(le)}destroy(){this.destroyed=!0,Nt(this.buffer),this.set(0,0,0,0,0)}}const qr=Pe(()=>new Nr);function Hr(n){if(n.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let l=0;l<t.length;l++)t[l]=255;for(let l=0;l<n.length;l++){const d=n.charAt(l),u=d.charCodeAt(0);if(t[u]!==255)throw new TypeError(d+" is ambiguous");t[u]=l}const e=n.length,r=n.charAt(0),i=Math.log(e)/Math.log(256),s=Math.log(256)/Math.log(e);function c(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";let d=0,u=0,h=0;const f=l.length;for(;h!==f&&l[h]===0;)h++,d++;const w=(f-h)*s+1>>>0,b=new Uint8Array(w);for(;h!==f;){let E=l[h],S=0;for(let R=w-1;(E!==0||S<u)&&R!==-1;R--,S++)E+=256*b[R]>>>0,b[R]=E%e>>>0,E=E/e>>>0;if(E!==0)throw new Error("Non-zero carry");u=S,h++}let y=w-u;for(;y!==w&&b[y]===0;)y++;let x=r.repeat(d);for(;y<w;++y)x+=n.charAt(b[y]);return x}function a(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;let d=0,u=0,h=0;for(;l[d]===r;)u++,d++;const f=(l.length-d)*i+1>>>0,w=new Uint8Array(f);for(;d<l.length;){const E=l.charCodeAt(d);if(E>255)return;let S=t[E];if(S===255)return;let R=0;for(let N=f-1;(S!==0||R<h)&&N!==-1;N--,R++)S+=e*w[N]>>>0,w[N]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");h=R,d++}let b=f-h;for(;b!==f&&w[b]===0;)b++;const y=new Uint8Array(u+(f-b));let x=u;for(;b!==f;)y[x++]=w[b++];return y}function o(l){const d=a(l);if(d)return d;throw new Error("Non-base"+e+" character")}return{encode:c,decodeUnsafe:a,decode:o}}var Mr="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const ee=Hr(Mr),ut={nodes:["https://api.hive.blog","https://api.deathwing.me","https://api.openhive.network","https://rpc.mahdiyari.info","https://techcoderx.com","https://hiveapi.actifit.io","https://api.c0ff33a.uk"],restNodes:["https://api.hive.blog","https://rpc.mahdiyari.info","https://techcoderx.com","https://hiveapi.actifit.io","https://api.c0ff33a.uk"],chain_id:"beeab0de00000000000000000000000000000000000000000000000000000000",address_prefix:"STM",timeout:1e4,retry:8},de=BigInt(2**32-1),an=BigInt(32);function Vr(n,t=!1){return t?{h:Number(n&de),l:Number(n>>an&de)}:{h:Number(n>>an&de)|0,l:Number(n&de)|0}}function zr(n,t=!1){const e=n.length;let r=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:c,l:a}=Vr(n[s],t);[r[s],i[s]]=[c,a]}return[r,i]}const ln=(n,t,e)=>n>>>e,dn=(n,t,e)=>n<<32-e|t>>>e,Zt=(n,t,e)=>n>>>e|t<<32-e,Wt=(n,t,e)=>n<<32-e|t>>>e,ue=(n,t,e)=>n<<64-e|t>>>e-32,fe=(n,t,e)=>n>>>e-32|t<<64-e;function vt(n,t,e,r){const i=(t>>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:i|0}}const Kr=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Pr=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,Fr=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),jr=(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0,Zr=(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),Wr=(n,t,e,r,i,s)=>t+e+r+i+s+(n/2**32|0)|0,Yr=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Bt=new Uint32Array(64);class Gr extends Fe{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:e,C:r,D:i,E:s,F:c,G:a,H:o}=this;return[t,e,r,i,s,c,a,o]}set(t,e,r,i,s,c,a,o){this.A=t|0,this.B=e|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=c|0,this.G=a|0,this.H=o|0}process(t,e){for(let u=0;u<16;u++,e+=4)Bt[u]=t.getUint32(e,!1);for(let u=16;u<64;u++){const h=Bt[u-15],f=Bt[u-2],w=mt(h,7)^mt(h,18)^h>>>3,b=mt(f,17)^mt(f,19)^f>>>10;Bt[u]=b+Bt[u-7]+w+Bt[u-16]|0}let{A:r,B:i,C:s,D:c,E:a,F:o,G:l,H:d}=this;for(let u=0;u<64;u++){const h=mt(a,6)^mt(a,11)^mt(a,25),f=d+h+Ur(a,o,l)+Yr[u]+Bt[u]|0,b=(mt(r,2)^mt(r,13)^mt(r,22))+kr(r,i,s)|0;d=l,l=o,o=a,a=c+f|0,c=s,s=i,i=r,r=f+b|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,c=c+this.D|0,a=a+this.E|0,o=o+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(r,i,s,c,a,o,l,d)}roundClean(){Nt(Bt)}destroy(){this.set(0,0,0,0,0,0,0,0),Nt(this.buffer)}}class Xr extends Gr{A=Lt[0]|0;B=Lt[1]|0;C=Lt[2]|0;D=Lt[3]|0;E=Lt[4]|0;F=Lt[5]|0;G=Lt[6]|0;H=Lt[7]|0;constructor(){super(32)}}const On=zr(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Jr=On[0],Qr=On[1],Ut=new Uint32Array(80),kt=new Uint32Array(80);class ti extends Fe{constructor(t){super(128,t,16,!1)}get(){const{Ah:t,Al:e,Bh:r,Bl:i,Ch:s,Cl:c,Dh:a,Dl:o,Eh:l,El:d,Fh:u,Fl:h,Gh:f,Gl:w,Hh:b,Hl:y}=this;return[t,e,r,i,s,c,a,o,l,d,u,h,f,w,b,y]}set(t,e,r,i,s,c,a,o,l,d,u,h,f,w,b,y){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=i|0,this.Ch=s|0,this.Cl=c|0,this.Dh=a|0,this.Dl=o|0,this.Eh=l|0,this.El=d|0,this.Fh=u|0,this.Fl=h|0,this.Gh=f|0,this.Gl=w|0,this.Hh=b|0,this.Hl=y|0}process(t,e){for(let S=0;S<16;S++,e+=4)Ut[S]=t.getUint32(e),kt[S]=t.getUint32(e+=4);for(let S=16;S<80;S++){const R=Ut[S-15]|0,N=kt[S-15]|0,z=Zt(R,N,1)^Zt(R,N,8)^ln(R,N,7),nt=Wt(R,N,1)^Wt(R,N,8)^dn(R,N,7),W=Ut[S-2]|0,$=kt[S-2]|0,at=Zt(W,$,19)^ue(W,$,61)^ln(W,$,6),it=Wt(W,$,19)^fe(W,$,61)^dn(W,$,6),H=Fr(nt,it,kt[S-7],kt[S-16]),v=jr(H,z,at,Ut[S-7],Ut[S-16]);Ut[S]=v|0,kt[S]=H|0}let{Ah:r,Al:i,Bh:s,Bl:c,Ch:a,Cl:o,Dh:l,Dl:d,Eh:u,El:h,Fh:f,Fl:w,Gh:b,Gl:y,Hh:x,Hl:E}=this;for(let S=0;S<80;S++){const R=Zt(u,h,14)^Zt(u,h,18)^ue(u,h,41),N=Wt(u,h,14)^Wt(u,h,18)^fe(u,h,41),z=u&f^~u&b,nt=h&w^~h&y,W=Zr(E,N,nt,Qr[S],kt[S]),$=Wr(W,x,R,z,Jr[S],Ut[S]),at=W|0,it=Zt(r,i,28)^ue(r,i,34)^ue(r,i,39),H=Wt(r,i,28)^fe(r,i,34)^fe(r,i,39),v=r&s^r&a^s&a,_=i&c^i&o^c&o;x=b|0,E=y|0,b=f|0,y=w|0,f=u|0,w=h|0,{h:u,l:h}=vt(l|0,d|0,$|0,at|0),l=a|0,d=o|0,a=s|0,o=c|0,s=r|0,c=i|0;const g=Kr(at,H,_);r=Pr(g,$,it,v),i=g|0}({h:r,l:i}=vt(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:c}=vt(this.Bh|0,this.Bl|0,s|0,c|0),{h:a,l:o}=vt(this.Ch|0,this.Cl|0,a|0,o|0),{h:l,l:d}=vt(this.Dh|0,this.Dl|0,l|0,d|0),{h:u,l:h}=vt(this.Eh|0,this.El|0,u|0,h|0),{h:f,l:w}=vt(this.Fh|0,this.Fl|0,f|0,w|0),{h:b,l:y}=vt(this.Gh|0,this.Gl|0,b|0,y|0),{h:x,l:E}=vt(this.Hh|0,this.Hl|0,x|0,E|0),this.set(r,i,s,c,a,o,l,d,u,h,f,w,b,y,x,E)}roundClean(){Nt(Ut,kt)}destroy(){Nt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class ei extends ti{Ah=Q[0]|0;Al=Q[1]|0;Bh=Q[2]|0;Bl=Q[3]|0;Ch=Q[4]|0;Cl=Q[5]|0;Dh=Q[6]|0;Dl=Q[7]|0;Eh=Q[8]|0;El=Q[9]|0;Fh=Q[10]|0;Fl=Q[11]|0;Gh=Q[12]|0;Gl=Q[13]|0;Hh=Q[14]|0;Hl=Q[15]|0;constructor(){super(64)}}const Ft=Pe(()=>new Xr,kn(1)),Nn=Pe(()=>new ei,kn(3));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const je=BigInt(0),Oe=BigInt(1);function be(n,t=""){if(typeof n!="boolean"){const e=t&&`"${t}" `;throw new Error(e+"expected boolean, got type="+typeof n)}return n}function qn(n){if(typeof n=="bigint"){if(!we(n))throw new Error("positive bigint expected, got "+n)}else Pt(n);return n}function he(n){const t=qn(n).toString(16);return t.length&1?"0"+t:t}function Hn(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?je:BigInt("0x"+n)}function Ee(n){return Hn(yt(n))}function Mn(n){return Hn(yt(ni(Z(n)).reverse()))}function Ze(n,t){Pt(t),n=qn(n);const e=gt(n.toString(16).padStart(t*2,"0"));if(e.length!==t)throw new Error("number too large");return e}function Vn(n,t){return Ze(n,t).reverse()}function ni(n){return Uint8Array.from(n)}const we=n=>typeof n=="bigint"&&je<=n;function ri(n,t,e){return we(n)&&we(t)&&we(e)&&t<=n&&n<e}function ii(n,t,e,r){if(!ri(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function si(n){let t;for(t=0;n>je;n>>=Oe,t+=1);return t}const We=n=>(Oe<<BigInt(n))-Oe;function oi(n,t,e){if(Pt(n,"hashLen"),Pt(t,"qByteLen"),typeof e!="function")throw new Error("hmacFn must be a function");const r=y=>new Uint8Array(y),i=Uint8Array.of(),s=Uint8Array.of(0),c=Uint8Array.of(1),a=1e3;let o=r(n),l=r(n),d=0;const u=()=>{o.fill(1),l.fill(0),d=0},h=(...y)=>e(l,Ct(o,...y)),f=(y=i)=>{l=h(s,y),o=h(),y.length!==0&&(l=h(c,y),o=h())},w=()=>{if(d++>=a)throw new Error("drbg: tried max amount of iterations");let y=0;const x=[];for(;y<t;){o=h();const E=o.slice();x.push(E),y+=o.length}return Ct(...x)};return(y,x)=>{u(),f(y);let E;for(;!(E=x(w()));)f();return u(),E}}function Ye(n,t={},e={}){if(!n||typeof n!="object")throw new Error("expected valid options object");function r(s,c,a){const o=n[s];if(a&&o===void 0)return;const l=typeof o;if(l!==c||o===null)throw new Error(`param "${s}" is invalid: expected ${c}, got ${l}`)}const i=(s,c)=>Object.entries(s).forEach(([a,o])=>r(a,o,c));i(t,!1),i(e,!0)}function un(n){const t=new WeakMap;return(e,...r)=>{const i=t.get(e);if(i!==void 0)return i;const s=n(e,...r);return t.set(e,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const rt=BigInt(0),et=BigInt(1),Ht=BigInt(2),zn=BigInt(3),Kn=BigInt(4),Pn=BigInt(5),ci=BigInt(7),Fn=BigInt(8),ai=BigInt(9),jn=BigInt(16);function lt(n,t){const e=n%t;return e>=rt?e:t+e}function st(n,t,e){let r=n;for(;t-- >rt;)r*=r,r%=e;return r}function fn(n,t){if(n===rt)throw new Error("invert: expected non-zero number");if(t<=rt)throw new Error("invert: expected positive modulus, got "+t);let e=lt(n,t),r=t,i=rt,s=et;for(;e!==rt;){const a=r/e,o=r%e,l=i-s*a;r=e,e=o,i=s,s=l}if(r!==et)throw new Error("invert: does not exist");return lt(i,t)}function Ge(n,t,e){if(!n.eql(n.sqr(t),e))throw new Error("Cannot find square root")}function Zn(n,t){const e=(n.ORDER+et)/Kn,r=n.pow(t,e);return Ge(n,r,t),r}function li(n,t){const e=(n.ORDER-Pn)/Fn,r=n.mul(t,Ht),i=n.pow(r,e),s=n.mul(t,i),c=n.mul(n.mul(s,Ht),i),a=n.mul(s,n.sub(c,n.ONE));return Ge(n,a,t),a}function di(n){const t=Se(n),e=Wn(n),r=e(t,t.neg(t.ONE)),i=e(t,r),s=e(t,t.neg(r)),c=(n+ci)/jn;return(a,o)=>{let l=a.pow(o,c),d=a.mul(l,r);const u=a.mul(l,i),h=a.mul(l,s),f=a.eql(a.sqr(d),o),w=a.eql(a.sqr(u),o);l=a.cmov(l,d,f),d=a.cmov(h,u,w);const b=a.eql(a.sqr(d),o),y=a.cmov(l,d,b);return Ge(a,y,o),y}}function Wn(n){if(n<zn)throw new Error("sqrt is not defined for small field");let t=n-et,e=0;for(;t%Ht===rt;)t/=Ht,e++;let r=Ht;const i=Se(n);for(;hn(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return Zn;let s=i.pow(r,t);const c=(t+et)/Ht;return function(o,l){if(o.is0(l))return l;if(hn(o,l)!==1)throw new Error("Cannot find square root");let d=e,u=o.mul(o.ONE,s),h=o.pow(l,t),f=o.pow(l,c);for(;!o.eql(h,o.ONE);){if(o.is0(h))return o.ZERO;let w=1,b=o.sqr(h);for(;!o.eql(b,o.ONE);)if(w++,b=o.sqr(b),w===d)throw new Error("Cannot find square root");const y=et<<BigInt(d-w-1),x=o.pow(u,y);d=w,u=o.sqr(x),h=o.mul(h,u),f=o.mul(f,x)}return f}}function ui(n){return n%Kn===zn?Zn:n%Fn===Pn?li:n%jn===ai?di(n):Wn(n)}const fi=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function hi(n){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},e=fi.reduce((r,i)=>(r[i]="function",r),t);return Ye(n,e),n}function pi(n,t,e){if(e<rt)throw new Error("invalid exponent, negatives unsupported");if(e===rt)return n.ONE;if(e===et)return t;let r=n.ONE,i=t;for(;e>rt;)e&et&&(r=n.mul(r,i)),i=n.sqr(i),e>>=et;return r}function Yn(n,t,e=!1){const r=new Array(t.length).fill(e?n.ZERO:void 0),i=t.reduce((c,a,o)=>n.is0(a)?c:(r[o]=c,n.mul(c,a)),n.ONE),s=n.inv(i);return t.reduceRight((c,a,o)=>n.is0(a)?c:(r[o]=n.mul(c,r[o]),n.mul(c,a)),s),r}function hn(n,t){const e=(n.ORDER-et)/Ht,r=n.pow(t,e),i=n.eql(r,n.ONE),s=n.eql(r,n.ZERO),c=n.eql(r,n.neg(n.ONE));if(!i&&!s&&!c)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function mi(n,t){t!==void 0&&Pt(t);const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}class wi{ORDER;BITS;BYTES;isLE;ZERO=rt;ONE=et;_lengths;_sqrt;_mod;constructor(t,e={}){if(t<=rt)throw new Error("invalid field: expected ORDER > 0, got "+t);let r;this.isLE=!1,e!=null&&typeof e=="object"&&(typeof e.BITS=="number"&&(r=e.BITS),typeof e.sqrt=="function"&&(this.sqrt=e.sqrt),typeof e.isLE=="boolean"&&(this.isLE=e.isLE),e.allowedLengths&&(this._lengths=e.allowedLengths?.slice()),typeof e.modFromBytes=="boolean"&&(this._mod=e.modFromBytes));const{nBitLength:i,nByteLength:s}=mi(t,r);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=i,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return lt(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return rt<=t&&t<this.ORDER}is0(t){return t===rt}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&et)===et}neg(t){return lt(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return lt(t*t,this.ORDER)}add(t,e){return lt(t+e,this.ORDER)}sub(t,e){return lt(t-e,this.ORDER)}mul(t,e){return lt(t*e,this.ORDER)}pow(t,e){return pi(this,t,e)}div(t,e){return lt(t*fn(e,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,e){return t+e}subN(t,e){return t-e}mulN(t,e){return t*e}inv(t){return fn(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=ui(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Vn(t,this.BYTES):Ze(t,this.BYTES)}fromBytes(t,e=!1){Z(t);const{_lengths:r,BYTES:i,isLE:s,ORDER:c,_mod:a}=this;if(r){if(!r.includes(t.length)||t.length>i)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);const l=new Uint8Array(i);l.set(t,s?0:l.length-t.length),t=l}if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);let o=s?Mn(t):Ee(t);if(a&&(o=lt(o,c)),!e&&!this.isValid(o))throw new Error("invalid field element: outside of range 0..ORDER");return o}invertBatch(t){return Yn(this,t)}cmov(t,e,r){return r?e:t}}function Se(n,t={}){return new wi(n,t)}function Gn(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function Xn(n){const t=Gn(n);return t+Math.ceil(t/2)}function yi(n,t,e=!1){Z(n);const r=n.length,i=Gn(t),s=Xn(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const c=e?Mn(n):Ee(n),a=lt(c,t-et)+et;return e?Vn(a,i):Ze(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const te=BigInt(0),Mt=BigInt(1);function _e(n,t){const e=t.negate();return n?e:t}function pn(n,t){const e=Yn(n.Fp,t.map(r=>r.Z));return t.map((r,i)=>n.fromAffine(r.toAffine(e[i])))}function Jn(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function Le(n,t){Jn(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),i=2**n,s=We(n),c=BigInt(n);return{windows:e,windowSize:r,mask:s,maxNumber:i,shiftBy:c}}function mn(n,t,e){const{windowSize:r,mask:i,maxNumber:s,shiftBy:c}=e;let a=Number(n&i),o=n>>c;a>r&&(a-=s,o+=Mt);const l=t*r,d=l+Math.abs(a)-1,u=a===0,h=a<0,f=t%2!==0;return{nextN:o,offset:d,isZero:u,isNeg:h,isNegF:f,offsetF:l}}const Be=new WeakMap,Qn=new WeakMap;function Ue(n){return Qn.get(n)||1}function wn(n){if(n!==te)throw new Error("invalid wNAF")}class gi{BASE;ZERO;Fn;bits;constructor(t,e){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=e}_unsafeLadder(t,e,r=this.ZERO){let i=t;for(;e>te;)e&Mt&&(r=r.add(i)),i=i.double(),e>>=Mt;return r}precomputeWindow(t,e){const{windows:r,windowSize:i}=Le(e,this.bits),s=[];let c=t,a=c;for(let o=0;o<r;o++){a=c,s.push(a);for(let l=1;l<i;l++)a=a.add(c),s.push(a);c=a.double()}return s}wNAF(t,e,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let i=this.ZERO,s=this.BASE;const c=Le(t,this.bits);for(let a=0;a<c.windows;a++){const{nextN:o,offset:l,isZero:d,isNeg:u,isNegF:h,offsetF:f}=mn(r,a,c);r=o,d?s=s.add(_e(h,e[f])):i=i.add(_e(u,e[l]))}return wn(r),{p:i,f:s}}wNAFUnsafe(t,e,r,i=this.ZERO){const s=Le(t,this.bits);for(let c=0;c<s.windows&&r!==te;c++){const{nextN:a,offset:o,isZero:l,isNeg:d}=mn(r,c,s);if(r=a,!l){const u=e[o];i=i.add(d?u.negate():u)}}return wn(r),i}getPrecomputes(t,e,r){let i=Be.get(e);return i||(i=this.precomputeWindow(e,t),t!==1&&(typeof r=="function"&&(i=r(i)),Be.set(e,i))),i}cached(t,e,r){const i=Ue(t);return this.wNAF(i,this.getPrecomputes(i,t,r),e)}unsafe(t,e,r,i){const s=Ue(t);return s===1?this._unsafeLadder(t,e,i):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),e,i)}createCache(t,e){Jn(e,this.bits),Qn.set(t,e),Be.delete(t)}hasCache(t){return Ue(t)!==1}}function bi(n,t,e,r){let i=t,s=n.ZERO,c=n.ZERO;for(;e>te||r>te;)e&Mt&&(s=s.add(i)),r&Mt&&(c=c.add(i)),i=i.double(),e>>=Mt,r>>=Mt;return{p1:s,p2:c}}function yn(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return hi(t),t}else return Se(n,{isLE:e})}function _i(n,t,e={},r){if(r===void 0&&(r=n==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${n} CURVE object`);for(const o of["p","n","h"]){const l=t[o];if(!(typeof l=="bigint"&&l>te))throw new Error(`CURVE.${o} must be positive bigint`)}const i=yn(t.p,e.Fp,r),s=yn(t.n,e.Fn,r),a=["Gx","Gy","a","b"];for(const o of a)if(!i.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:s}}function vi(n,t){return function(r){const i=n(r);return{secretKey:i,publicKey:t(i)}}}class tr{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(t,e){if(Ln(t),Z(e,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(e.length>r?t.create().update(e).digest():e);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=t.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),Nt(i)}update(t){return ge(this),this.iHash.update(t),this}digestInto(t){ge(this),Z(t,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});const{oHash:e,iHash:r,finished:i,destroyed:s,blockLen:c,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=c,t.outputLen=a,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const er=(n,t,e)=>new tr(n,t).update(e).digest();er.create=(n,t)=>new tr(n,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gn=(n,t)=>(n+(n>=0?t:-t)/nr)/t;function xi(n,t,e){const[[r,i],[s,c]]=t,a=gn(c*n,e),o=gn(-i*n,e);let l=n-a*r-o*s,d=-a*i-o*c;const u=l<At,h=d<At;u&&(l=-l),h&&(d=-d);const f=We(Math.ceil(si(e)/2))+Jt;if(l<At||l>=f||d<At||d>=f)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:u,k1:l,k2neg:h,k2:d}}function Ne(n){if(!["compact","recovered","der"].includes(n))throw new Error('Signature format must be "compact", "recovered", or "der"');return n}function ke(n,t){const e={};for(let r of Object.keys(t))e[r]=n[r]===void 0?t[r]:n[r];return be(e.lowS,"lowS"),be(e.prehash,"prehash"),e.format!==void 0&&Ne(e.format),e}class Ei extends Error{constructor(t=""){super(t)}}const Tt={Err:Ei,_tlv:{encode:(n,t)=>{const{Err:e}=Tt;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const r=t.length/2,i=he(r);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const s=r>127?he(i.length/2|128):"";return he(n)+s+i+t},decode(n,t){const{Err:e}=Tt;let r=0;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==n)throw new e("tlv.decode: wrong tlv");const i=t[r++],s=!!(i&128);let c=0;if(!s)c=i;else{const o=i&127;if(!o)throw new e("tlv.decode(long): indefinite length not supported");if(o>4)throw new e("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+o);if(l.length!==o)throw new e("tlv.decode: length bytes not complete");if(l[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const d of l)c=c<<8|d;if(r+=o,c<128)throw new e("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+c);if(a.length!==c)throw new e("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+c)}}},_int:{encode(n){const{Err:t}=Tt;if(n<At)throw new t("integer: negative integers are not allowed");let e=he(n);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(n){const{Err:t}=Tt;if(n[0]&128)throw new t("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Ee(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=Tt,i=Z(n,void 0,"signature"),{v:s,l:c}=r.decode(48,i);if(c.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:o}=r.decode(2,s),{v:l,l:d}=r.decode(2,o);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(a),s:e.decode(l)}},hexFromSig(n){const{_tlv:t,_int:e}=Tt,r=t.encode(2,e.encode(n.r)),i=t.encode(2,e.encode(n.s)),s=r+i;return t.encode(48,s)}},At=BigInt(0),Jt=BigInt(1),nr=BigInt(2),pe=BigInt(3),Si=BigInt(4);function Ai(n,t={}){const e=_i("weierstrass",n,t),{Fp:r,Fn:i}=e;let s=e.CURVE;const{h:c,n:a}=s;Ye(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:o}=t;if(o&&(!r.is0(s.a)||typeof o.beta!="bigint"||!Array.isArray(o.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=ir(r,i);function d(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function u(H,v,_){const{x:g,y:A}=v.toAffine(),L=r.toBytes(g);if(be(_,"isCompressed"),_){d();const U=!r.isOdd(A);return Ct(rr(U),L)}else return Ct(Uint8Array.of(4),L,r.toBytes(A))}function h(H){Z(H,void 0,"Point");const{publicKey:v,publicKeyUncompressed:_}=l,g=H.length,A=H[0],L=H.subarray(1);if(g===v&&(A===2||A===3)){const U=r.fromBytes(L);if(!r.isValid(U))throw new Error("bad point: is not on curve, wrong x");const B=b(U);let I;try{I=r.sqrt(B)}catch(Y){const K=Y instanceof Error?": "+Y.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}d();const D=r.isOdd(I);return(A&1)===1!==D&&(I=r.neg(I)),{x:U,y:I}}else if(g===_&&A===4){const U=r.BYTES,B=r.fromBytes(L.subarray(0,U)),I=r.fromBytes(L.subarray(U,U*2));if(!y(B,I))throw new Error("bad point: is not on curve");return{x:B,y:I}}else throw new Error(`bad point: got length ${g}, expected compressed=${v} or uncompressed=${_}`)}const f=t.toBytes||u,w=t.fromBytes||h;function b(H){const v=r.sqr(H),_=r.mul(v,H);return r.add(r.add(_,r.mul(H,s.a)),s.b)}function y(H,v){const _=r.sqr(v),g=b(H);return r.eql(_,g)}if(!y(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const x=r.mul(r.pow(s.a,pe),Si),E=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(x,E)))throw new Error("bad curve params: a or b");function S(H,v,_=!1){if(!r.isValid(v)||_&&r.is0(v))throw new Error(`bad point coordinate ${H}`);return v}function R(H){if(!(H instanceof $))throw new Error("Weierstrass Point expected")}function N(H){if(!o||!o.basises)throw new Error("no endo");return xi(H,o.basises,i.ORDER)}const z=un((H,v)=>{const{X:_,Y:g,Z:A}=H;if(r.eql(A,r.ONE))return{x:_,y:g};const L=H.is0();v==null&&(v=L?r.ONE:r.inv(A));const U=r.mul(_,v),B=r.mul(g,v),I=r.mul(A,v);if(L)return{x:r.ZERO,y:r.ZERO};if(!r.eql(I,r.ONE))throw new Error("invZ was invalid");return{x:U,y:B}}),nt=un(H=>{if(H.is0()){if(t.allowInfinityPoint&&!r.is0(H.Y))return;throw new Error("bad point: ZERO")}const{x:v,y:_}=H.toAffine();if(!r.isValid(v)||!r.isValid(_))throw new Error("bad point: x or y not field elements");if(!y(v,_))throw new Error("bad point: equation left != right");if(!H.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function W(H,v,_,g,A){return _=new $(r.mul(_.X,H),_.Y,_.Z),v=_e(g,v),_=_e(A,_),v.add(_)}class ${static BASE=new $(s.Gx,s.Gy,r.ONE);static ZERO=new $(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=i;X;Y;Z;constructor(v,_,g){this.X=S("x",v),this.Y=S("y",_,!0),this.Z=S("z",g),Object.freeze(this)}static CURVE(){return s}static fromAffine(v){const{x:_,y:g}=v||{};if(!v||!r.isValid(_)||!r.isValid(g))throw new Error("invalid affine point");if(v instanceof $)throw new Error("projective point not allowed");return r.is0(_)&&r.is0(g)?$.ZERO:new $(_,g,r.ONE)}static fromBytes(v){const _=$.fromAffine(w(Z(v,void 0,"point")));return _.assertValidity(),_}static fromHex(v){return $.fromBytes(gt(v))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(v=8,_=!0){return it.createCache(this,v),_||this.multiply(pe),this}assertValidity(){nt(this)}hasEvenY(){const{y:v}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(v)}equals(v){R(v);const{X:_,Y:g,Z:A}=this,{X:L,Y:U,Z:B}=v,I=r.eql(r.mul(_,B),r.mul(L,A)),D=r.eql(r.mul(g,B),r.mul(U,A));return I&&D}negate(){return new $(this.X,r.neg(this.Y),this.Z)}double(){const{a:v,b:_}=s,g=r.mul(_,pe),{X:A,Y:L,Z:U}=this;let B=r.ZERO,I=r.ZERO,D=r.ZERO,q=r.mul(A,A),Y=r.mul(L,L),K=r.mul(U,U),M=r.mul(A,L);return M=r.add(M,M),D=r.mul(A,U),D=r.add(D,D),B=r.mul(v,D),I=r.mul(g,K),I=r.add(B,I),B=r.sub(Y,I),I=r.add(Y,I),I=r.mul(B,I),B=r.mul(M,B),D=r.mul(g,D),K=r.mul(v,K),M=r.sub(q,K),M=r.mul(v,M),M=r.add(M,D),D=r.add(q,q),q=r.add(D,q),q=r.add(q,K),q=r.mul(q,M),I=r.add(I,q),K=r.mul(L,U),K=r.add(K,K),q=r.mul(K,M),B=r.sub(B,q),D=r.mul(K,Y),D=r.add(D,D),D=r.add(D,D),new $(B,I,D)}add(v){R(v);const{X:_,Y:g,Z:A}=this,{X:L,Y:U,Z:B}=v;let I=r.ZERO,D=r.ZERO,q=r.ZERO;const Y=s.a,K=r.mul(s.b,pe);let M=r.mul(_,L),P=r.mul(g,U),X=r.mul(A,B),pt=r.add(_,g),F=r.add(L,U);pt=r.mul(pt,F),F=r.add(M,P),pt=r.sub(pt,F),F=r.add(_,A);let J=r.add(L,B);return F=r.mul(F,J),J=r.add(M,X),F=r.sub(F,J),J=r.add(g,A),I=r.add(U,B),J=r.mul(J,I),I=r.add(P,X),J=r.sub(J,I),q=r.mul(Y,F),I=r.mul(K,X),q=r.add(I,q),I=r.sub(P,q),q=r.add(P,q),D=r.mul(I,q),P=r.add(M,M),P=r.add(P,M),X=r.mul(Y,X),F=r.mul(K,F),P=r.add(P,X),X=r.sub(M,X),X=r.mul(Y,X),F=r.add(F,X),M=r.mul(P,F),D=r.add(D,M),M=r.mul(J,F),I=r.mul(pt,I),I=r.sub(I,M),M=r.mul(pt,P),q=r.mul(J,q),q=r.add(q,M),new $(I,D,q)}subtract(v){return this.add(v.negate())}is0(){return this.equals($.ZERO)}multiply(v){const{endo:_}=t;if(!i.isValidNot0(v))throw new Error("invalid scalar: out of range");let g,A;const L=U=>it.cached(this,U,B=>pn($,B));if(_){const{k1neg:U,k1:B,k2neg:I,k2:D}=N(v),{p:q,f:Y}=L(B),{p:K,f:M}=L(D);A=Y.add(M),g=W(_.beta,q,K,U,I)}else{const{p:U,f:B}=L(v);g=U,A=B}return pn($,[g,A])[0]}multiplyUnsafe(v){const{endo:_}=t,g=this;if(!i.isValid(v))throw new Error("invalid scalar: out of range");if(v===At||g.is0())return $.ZERO;if(v===Jt)return g;if(it.hasCache(this))return this.multiply(v);if(_){const{k1neg:A,k1:L,k2neg:U,k2:B}=N(v),{p1:I,p2:D}=bi($,g,L,B);return W(_.beta,I,D,A,U)}else return it.unsafe(g,v)}toAffine(v){return z(this,v)}isTorsionFree(){const{isTorsionFree:v}=t;return c===Jt?!0:v?v($,this):it.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:v}=t;return c===Jt?this:v?v($,this):this.multiplyUnsafe(c)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}toBytes(v=!0){return be(v,"isCompressed"),this.assertValidity(),f($,this,v)}toHex(v=!0){return yt(this.toBytes(v))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const at=i.BITS,it=new gi($,t.endo?Math.ceil(at/2):at);return $.BASE.precompute(8),$}function rr(n){return Uint8Array.of(n?2:3)}function ir(n,t){return{secretKey:t.BYTES,publicKey:1+n.BYTES,publicKeyUncompressed:1+2*n.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Ii(n,t={}){const{Fn:e}=n,r=t.randomBytes||Un,i=Object.assign(ir(n.Fp,e),{seed:Xn(e.ORDER)});function s(f){try{const w=e.fromBytes(f);return e.isValidNot0(w)}catch{return!1}}function c(f,w){const{publicKey:b,publicKeyUncompressed:y}=i;try{const x=f.length;return w===!0&&x!==b||w===!1&&x!==y?!1:!!n.fromBytes(f)}catch{return!1}}function a(f=r(i.seed)){return yi(Z(f,i.seed,"seed"),e.ORDER)}function o(f,w=!0){return n.BASE.multiply(e.fromBytes(f)).toBytes(w)}function l(f){const{secretKey:w,publicKey:b,publicKeyUncompressed:y}=i;if(!Ke(f)||"_lengths"in e&&e._lengths||w===b)return;const x=Z(f,void 0,"key").length;return x===b||x===y}function d(f,w,b=!0){if(l(f)===!0)throw new Error("first arg must be private key");if(l(w)===!1)throw new Error("second arg must be public key");const y=e.fromBytes(f);return n.fromBytes(w).multiply(y).toBytes(b)}const u={isValidSecretKey:s,isValidPublicKey:c,randomSecretKey:a},h=vi(a,o);return Object.freeze({getPublicKey:o,getSharedSecret:d,keygen:h,Point:n,utils:u,lengths:i})}function Li(n,t,e={}){Ln(t),Ye(e,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),e=Object.assign({},e);const r=e.randomBytes||Un,i=e.hmac||((_,g)=>er(t,_,g)),{Fp:s,Fn:c}=n,{ORDER:a,BITS:o}=c,{keygen:l,getPublicKey:d,getSharedSecret:u,utils:h,lengths:f}=Ii(n,e),w={prehash:!0,lowS:typeof e.lowS=="boolean"?e.lowS:!0,format:"compact",extraEntropy:!1},b=a*nr<s.ORDER;function y(_){const g=a>>Jt;return _>g}function x(_,g){if(!c.isValidNot0(g))throw new Error(`invalid signature ${_}: out of range 1..Point.Fn.ORDER`);return g}function E(){if(b)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function S(_,g){Ne(g);const A=f.signature,L=g==="compact"?A:g==="recovered"?A+1:void 0;return Z(_,L)}class R{r;s;recovery;constructor(g,A,L){if(this.r=x("r",g),this.s=x("s",A),L!=null){if(E(),![0,1,2,3].includes(L))throw new Error("invalid recovery id");this.recovery=L}Object.freeze(this)}static fromBytes(g,A=w.format){S(g,A);let L;if(A==="der"){const{r:D,s:q}=Tt.toSig(Z(g));return new R(D,q)}A==="recovered"&&(L=g[0],A="compact",g=g.subarray(1));const U=f.signature/2,B=g.subarray(0,U),I=g.subarray(U,U*2);return new R(c.fromBytes(B),c.fromBytes(I),L)}static fromHex(g,A){return this.fromBytes(gt(g),A)}assertRecovery(){const{recovery:g}=this;if(g==null)throw new Error("invalid recovery id: must be present");return g}addRecoveryBit(g){return new R(this.r,this.s,g)}recoverPublicKey(g){const{r:A,s:L}=this,U=this.assertRecovery(),B=U===2||U===3?A+a:A;if(!s.isValid(B))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const I=s.toBytes(B),D=n.fromBytes(Ct(rr((U&1)===0),I)),q=c.inv(B),Y=z(Z(g,void 0,"msgHash")),K=c.create(-Y*q),M=c.create(L*q),P=n.BASE.multiplyUnsafe(K).add(D.multiplyUnsafe(M));if(P.is0())throw new Error("invalid recovery: point at infinify");return P.assertValidity(),P}hasHighS(){return y(this.s)}toBytes(g=w.format){if(Ne(g),g==="der")return gt(Tt.hexFromSig(this));const{r:A,s:L}=this,U=c.toBytes(A),B=c.toBytes(L);return g==="recovered"?(E(),Ct(Uint8Array.of(this.assertRecovery()),U,B)):Ct(U,B)}toHex(g){return yt(this.toBytes(g))}}const N=e.bits2int||function(g){if(g.length>8192)throw new Error("input is too large");const A=Ee(g),L=g.length*8-o;return L>0?A>>BigInt(L):A},z=e.bits2int_modN||function(g){return c.create(N(g))},nt=We(o);function W(_){return ii("num < 2^"+o,_,At,nt),c.toBytes(_)}function $(_,g){return Z(_,void 0,"message"),g?Z(t(_),void 0,"prehashed message"):_}function at(_,g,A){const{lowS:L,prehash:U,extraEntropy:B}=ke(A,w);_=$(_,U);const I=z(_),D=c.fromBytes(g);if(!c.isValidNot0(D))throw new Error("invalid private key");const q=[W(D),W(I)];if(B!=null&&B!==!1){const P=B===!0?r(f.secretKey):B;q.push(Z(P,void 0,"extraEntropy"))}const Y=Ct(...q),K=I;function M(P){const X=N(P);if(!c.isValidNot0(X))return;const pt=c.inv(X),F=n.BASE.multiply(X).toAffine(),J=c.create(F.x);if(J===At)return;const oe=c.create(pt*c.create(K+J*D));if(oe===At)return;let nn=(F.x===J?0:2)|Number(F.y&Jt),rn=oe;return L&&y(oe)&&(rn=c.neg(oe),nn^=1),new R(J,rn,b?void 0:nn)}return{seed:Y,k2sig:M}}function it(_,g,A={}){const{seed:L,k2sig:U}=at(_,g,A);return oi(t.outputLen,c.BYTES,i)(L,U).toBytes(A.format)}function H(_,g,A,L={}){const{lowS:U,prehash:B,format:I}=ke(L,w);if(A=Z(A,void 0,"publicKey"),g=$(g,B),!Ke(_)){const D=_ instanceof R?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+D)}S(_,I);try{const D=R.fromBytes(_,I),q=n.fromBytes(A);if(U&&D.hasHighS())return!1;const{r:Y,s:K}=D,M=z(g),P=c.inv(K),X=c.create(M*P),pt=c.create(Y*P),F=n.BASE.multiplyUnsafe(X).add(q.multiplyUnsafe(pt));return F.is0()?!1:c.create(F.x)===Y}catch{return!1}}function v(_,g,A={}){const{prehash:L}=ke(A,w);return g=$(g,L),R.fromBytes(_,"recovered").recoverPublicKey(g).toBytes()}return Object.freeze({keygen:l,getPublicKey:d,getSharedSecret:u,utils:h,lengths:f,Point:n,sign:it,verify:H,recoverPublicKey:v,Signature:R,hash:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xe={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Bi={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},bn=BigInt(2);function Ui(n){const t=Xe.p,e=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),c=BigInt(23),a=BigInt(44),o=BigInt(88),l=n*n*n%t,d=l*l*n%t,u=st(d,e,t)*d%t,h=st(u,e,t)*d%t,f=st(h,bn,t)*l%t,w=st(f,i,t)*f%t,b=st(w,s,t)*w%t,y=st(b,a,t)*b%t,x=st(y,o,t)*y%t,E=st(x,a,t)*b%t,S=st(E,e,t)*d%t,R=st(S,c,t)*w%t,N=st(R,r,t)*l%t,z=st(N,bn,t);if(!qe.eql(qe.sqr(z),n))throw new Error("Cannot find square root");return z}const qe=Se(Xe.p,{sqrt:Ui}),ki=Ai(Xe,{Fp:qe,endo:Bi}),St=Li(ki,Ft);class Ae{constructor(t,e,r){this.data=t,this.recovery=e,this.compressed=r??!0}static from(t){if(typeof t=="string"){const e=gt(t);let r=parseInt(yt(e.subarray(0,1)),16)-31,i=!0;r<0&&(i=!1,r=r+4);const s=e.subarray(1);return new Ae(s,r,i)}else throw new Error("Expected string for data")}toBuffer(){const t=new Uint8Array(65).fill(0);return this.compressed?t[0]=this.recovery+31&255:t[0]=this.recovery+27&255,t.set(this.data,1),t}customToString(){return yt(this.toBuffer())}getPublicKey(t){if(t instanceof Uint8Array&&t.length!==32||typeof t=="string"&&t.length!==64)throw new Error("Expected a valid sha256 hash as message");typeof t=="string"&&(t=gt(t));const e=St.Signature.fromBytes(this.data,"compact"),r=new St.Signature(e.r,e.s,this.recovery);return new ot(r.recoverPublicKey(t).toBytes())}}const $i=ut.address_prefix;class ot{constructor(t,e){this.key=t,this.prefix=e??$i}static fromString(t){const{key:e,prefix:r}=Ci(t);return new ot(e,r)}static from(t){return t instanceof ot?t:ot.fromString(t)}verify(t,e){return typeof e=="string"&&(e=Ae.from(e)),St.verify(e.data,t,this.key,{prehash:!1,format:"compact"})}toString(){return Ti(this.key,this.prefix)}toJSON(){return this.toString()}inspect(){return`PublicKey: ${this.toString()}`}}const Ti=(n,t)=>{const e=qr(n);return t+ee.encode(new Uint8Array([...n,...e.subarray(0,4)]))},Ci=n=>{const t=n.slice(0,3);n=n.slice(3);const e=ee.decode(n);return{key:e.subarray(0,e.length-4),prefix:t}};class Yt{constructor(t,e){this.amount=t,this.symbol=e==="HIVE"?"STEEM":e==="HBD"?"SBD":e}static fromString(t,e=null){const[r,i]=t.split(" ");if(["STEEM","VESTS","SBD","TESTS","TBD","HIVE","HBD"].indexOf(i)===-1)throw new Error(`Invalid asset symbol: ${i}`);if(e&&i!==e)throw new Error(`Invalid asset, expected symbol: ${e} got: ${i}`);const s=Number.parseFloat(r);if(!Number.isFinite(s))throw new Error(`Invalid asset amount: ${r}`);return new Yt(s,i)}static from(t,e){if(t instanceof Yt){if(e&&t.symbol!==e)throw new Error(`Invalid asset, expected symbol: ${e} got: ${t.symbol}`);return t}else{if(typeof t=="number"&&Number.isFinite(t))return new Yt(t,e||"STEEM");if(typeof t=="string")return Yt.fromString(t,e);throw new Error(`Invalid asset '${String(t)}'`)}}getPrecision(){switch(this.symbol){case"TESTS":case"TBD":case"STEEM":case"SBD":case"HBD":case"HIVE":return 3;case"VESTS":return 6;default:return 3}}toString(){return`${this.amount.toFixed(this.getPrecision())} ${this.symbol}`}toJSON(){return this.toString()}}class Gt{static from(t){return t instanceof Gt?t:t instanceof Uint8Array?new Gt(t):typeof t=="string"?new Gt(gt(t)):new Gt(new Uint8Array(t))}constructor(t){this.buffer=t}toString(){return yt(this.buffer)}toJSON(){return this.toString()}}const T={vote:0,comment:1,transfer:2,transfer_to_vesting:3,withdraw_vesting:4,limit_order_create:5,limit_order_cancel:6,feed_publish:7,convert:8,account_create:9,account_update:10,witness_update:11,account_witness_vote:12,account_witness_proxy:13,custom:15,delete_comment:17,custom_json:18,comment_options:19,set_withdraw_vesting_route:20,limit_order_create2:21,claim_account:22,create_claimed_account:23,request_account_recovery:24,recover_account:25,change_recovery_account:26,escrow_transfer:27,escrow_dispute:28,escrow_release:29,escrow_approve:31,transfer_to_savings:32,transfer_from_savings:33,cancel_transfer_from_savings:34,decline_voting_rights:36,reset_account:37,set_reset_account:38,claim_reward_balance:39,delegate_vesting_shares:40,account_create_with_delegation:41,witness_set_properties:42,account_update2:43,create_proposal:44,update_proposal_votes:45,remove_proposal:46,update_proposal:47,collateralized_convert:48,recurrent_transfer:49},ct=()=>{throw new Error("Void can not be serialized")},p=(n,t)=>{n.writeVString(t)},Di=(n,t)=>{n.writeInt16(t)},sr=(n,t)=>{n.writeInt64(t)},_n=(n,t)=>{n.writeUint8(t)},ft=(n,t)=>{n.writeUint16(t)},tt=(n,t)=>{n.writeUint32(t)},or=(n,t)=>{n.writeUint64(t)},It=(n,t)=>{n.writeByte(t?1:0)},cr=n=>(t,e)=>{const[r,i]=e;t.writeVarint32(r),n[r](t,i)},V=(n,t)=>{const e=Yt.from(t),r=e.getPrecision();n.writeInt64(Math.round(e.amount*Math.pow(10,r))),n.writeUint8(r);for(let i=0;i<7;i++)n.writeUint8(e.symbol.charCodeAt(i)||0)},qt=(n,t)=>{n.writeUint32(Math.floor(new Date(t+"Z").getTime()/1e3))},bt=(n,t)=>{t===null||typeof t=="string"&&t.slice(-39)==="1111111111111111111111111111111114T1Anm"?n.append(new Uint8Array(33).fill(0)):n.append(ot.from(t).key)},ar=(n=null)=>(t,e)=>{e=Gt.from(e);const r=e.buffer.length;if(n){if(r!==n)throw new Error(`Unable to serialize binary. Expected ${n} bytes, got ${r}`)}else t.write
    
  • @stayout.bot(48)· 172d

    Welcome to Hive! 🎉 Great to have you here! Take your time to explore, engage with the communities and don't hesitate to ask @stayoutoftherz if you need any help. If you are interested, you might want to check out this post about the basics of how Hive works: https://peakd.com/hive-153850/@stayoutoftherz/hive-the-basics. Wishing you a great start! 🚀